class HT_Dash_Pattern
This class provides the data structure for the dashed
line pattern which, if called with set_line_pattern,
is automatically set to the User_Defined
line pattern in pattern.h.
HT_Dash_Pattern can
be any type of customized line pattern that you specify¾not
just a dashed pattern.
For a further description of line patterns, see the section,
"Line Patterns"
in chapter 2, "Heidi Architecture."
See Also
HT_Line_Pattern,
HT_Renderer::line_pattern_lengths,
HT_Rendition::dash_pattern
Methods
count
The number of on
and off
pixel descriptions or spans in the array that make up the line pattern
definition.
nominal_length
Scale factor for adaptive
line patterns only.
packed_data
Returns the starting position
of the array that holds the dash pattern.
pattern
Returns the first elements
of the array of the actual pattern, in shorts.
Constructor
HT_Dash_Pattern::count
Purpose
The number of on
and off
pixel descriptions or spans in the array that make up the line pattern
definition.
Synopsis
int count (void) const
Details
In the following example of a dashed pattern, the first
number, 20, represents the nominal_length.
count is the
second number, in this case 2,
and is the number of spans of on/off
pixel descriptions in the array. The third number, 10, is the length of
the portion of the dash that is on
and the fourth number, 10, is the length of the portion that is off.
The last number, -1, is a terminator.
Note: that the nominal_length,
count and terminator are internal data packed together
and the user would only see the on
and off values.
An example of a dashed line pattern with the span array
20, 2, 10, 10,-1
would look similar to:
¾¾ ¾¾
In translation, this means that the scale factor is 20,
there are 2
spans (the first dash and the first space) and the driver should draw 10
* pattern_scale
on pixels (the current drawing color), followed
by 10
* pattern_scale off pixels (the contrast color
) followed by the terminator -1, which indicates that you must
then repeat the array for the length of the line. The default pattern scale,
determined in m_pattern_scale,
is 50 pixels. The line pattern is also scaled by line_pattern_scale
which is set in the rendition.
HT_Dash_Pattern::HT_Dash_Pattern
Purpose
Constructs an HT_Dash_Pattern
object.
Synopsis
HT_Dash_Pattern () {}
HT_Dash_Pattern::HT_Dash_Pattern (int count, short const * pattern, short nominal)
Details
The first form takes no parameters.
The second form allows 2 or 3 parameters for the HT_Dash_Pattern.
The first parameter is count;
the second is an array of the on/off
description; and, the third, optional parameter is the nominal_length.
HT_Dash_Pattern::nominal_length
Purpose
Scale factor for adaptive
line patterns only.
Synopsis
int nominal_length (void) const
Details
In the following example of a dashed pattern, the first
number in the array, 20, represents the nominal_length.
This is a scaling factor for adaptive patterns¾the
actual length or a percentage length that will display a line type pattern
array within the varying segments of a polyline. If it is not specified,
then it is the sum of all of the individual span lengths.
Thus, as the polyline changes direction at each vertex,
it is possible to display whole line types within varying line segments.
This is important in many applications for indicating property lines, contour
lines, and so forth.
count
is the second number, in this case 2.
The third number, 10,
is the length of the portion of the dash that is on
and the fourth number, 10,
is the length of the portion that is off.
The last number, -1,
is a terminator.
Note: that the nominal_length,
count and terminator are internal data packed together
and the user would only see the on
and off values.
An example of the span array for a dashed line pattern
20, 2, 10, 10,-1
would look similar to:
¾¾ ¾¾ .
In translation, this means that the scale factor for
adaptive line patterns is 20,
there are 2
spans and the driver should draw 10
* pattern_scale
on pixels (the current drawing color), followed by
10
* pattern_scale off pixels (the contrast color
) followed by the terminator -1, which indicates that you must
then repeat the array for the length of the line. The default pattern scale,
as determined in m_pattern_scale,
is 50 pixels. The line pattern is also scaled by line_pattern_scale
which is set in the rendition.
HT_Dash_Pattern::packed_data
Purpose
Returns the starting position
of the array that holds the dash pattern.
Synopsis
short const * packed_data (void) const
Details
This method, unlike pattern,
does not skip to the first 2 numbers in the array, but returns the
starting position of the array¾the
dash pattern . It assumes that you know the representation of the
HT_Dash_Pattern.
Typically, it is best to use the HT_Dash_Pattern
methods to query and set these values¾using
packed_data
could yield differing results as the internal Heidi program information
may change at some future time.
In the following example
for a dash line pattern, packed_data
points to the 20:
20, 2, 10, 10,-1
HT_Dash_Pattern::pattern
Purpose
Returns the first elements
of the array of the actual pattern, in shorts.
Synopsis
short const * pattern (void) const
Details
This method returns the starting point of the array
of shorts that defines the dashed line pattern.
In the following example
for a dash line pattern, pattern
points to the starting point of the actual pattern 10,10:
20, 2, 10, 10,-1