2D line pattern descriptor. More...
Data Fields | |
A3DBool | m_bRealLength |
If A3D_TRUE , segments lengths are expressed in absolute values, using unit model file. | |
A3DDouble | m_dPhase |
Offset value defining the starting position of the pattern within the array. | |
A3DDouble * | m_pdLengths |
The array of segments describing the pattern. | |
A3DUns32 | m_uiNumberOfLengths |
The size of m_pdLengths in bytes. | |
Detailed Description
2D line pattern descriptor.
- Version
- 2.0
A3DGraphStyleData
can hold a line pattern, which describes how lines are represented: continous, dashed, dotted or a mix of some.
A line pattern is made of segments, which are cycled through in the order they are written in. Each segment is represented by a pair of A3DDouble
values:
- The length of the line segment (the stroke)
- The length of the spacing before the next segment is drawned (the blank)
All segments are written sequentially in a C-Style array, m_pdLengths
, each of them consisting of its stroke/blank pair. Thus, when describing a line pattern consisting in s segments, the array has the following layout:
Stroke | Blank | |
---|---|---|
Segment 0 | 0 | 1 |
Segment 1 | 2 | 3 |
Segment 2 | 4 | 5 |
... | ... | ... |
Segment s-1 | ... | i-1 |
The total number of elements in the array is i and is twice s.
For example a continuous line segment can be described using any non-zero value for the stroke, and 0.0
for the blank: {5.0, 0.0}
. A dotted pattern would be described using a unit length for the stroke and a wider value for the blank ({1.0, 5.0}
) while the other way around would end up having a dashed pattern ({5.0, 1.0}
).
Using any combinaison of those segments description would give a mixed pattern: {1.0, 5.0, 5.0, 0.0, 5.0, 1.0}
.
An ASCII representation of these patterns, repeated three times, would give:
- continuous:
_______________
- dotted:
_ _ _
- dashed:
_____ _____ _____
- mixed:
_ __________ _ __________ _ __________
The actual length of each segment depends on the drawing implementation and the m_bRealLength
option (see below).
m_dPhase
is a length value that offsets the starting position within the pattern. By default the value is 0.0
(no offset).
- Absolute Length
- When
m_bRealLength
is true, all lengths (strokes and blanks) are considered absolute and using the model file unit. Each segment is drawned in order and the pattern is repeated until the line is entirely drawned.For example, upon drawing a line of length 20 millimeters with the following pattern:
{1.0, 5.0, 5.0, 0.0, 5.0, 1.0}
- The full description will be drawn once using the first 17mm
- The first segment will be drawned (and cropped) to fill in the last 3mm.
- Relative Length
- When
m_bRealLength
is false, the length is not absolute and their representation is up to the drawing implementor. Because the lengths are not expressed using the model file unit,m_bRealLength
is generally false when the display of the line patterns does not depend on the representation, such as orientation or zoom.
- Global access
- HOOPS stores line patterns into a globally accessible container which lives until the library is terminated. patterns are identified by an index and the actual data can be queried using
A3DGlobalGetGraphLinePatternData
.
- Validity
- Setting a negative value within
m_pdLengths
is unsupported.