PROGRAMMING GUIDE
A glyph is a defined symbol used to represent a marker, a shell vertex, an element in a line pattern, or a line endpoint such as an arrowhead.
Each Visualize segment has its own attribute setting for the current marker symbol. As glyphs are used as marker symbols, it follows that in order to use different glyphs as markers, you must use different segments. Visualize comes with a number of glyphs predefined and ready to use. A list of these glyphs can be found in the appendix. Before using a pre-defined glyph, you must import it into the active portfolio. The code sample below demonstrates how to set a glyph as the current marker symbol and insert the marker at the origin:
If the set of predefined glyphs is not sufficient, you can create a custom glyph. The following section demonstrates how to do that.
Glyphs are composed of one or more GlyphElement objects which are used to draw the lines, dots, and curves of the glyph. These elements can be any of the following:
Geometry type | Associated class |
---|---|
circular arcs | CircularArcGlyphElement |
ellipses | EllipseGlyphElement |
lines | LineGlyphElement |
infinite lines | InfiniteLineGlyphElement |
individual pixels | DotGlyphElement |
Attribute settings for glyphs include color and fill and are set at the attribute level. Glyphs are programmatically defined as shown in the following steps:
As glyph settings affect glyphs at the segment-level, it is important to arrange the scene hierarchy to achieve the desired result. For this example, a new segment is created in order to make a glyph in the shape of a modified X. A new GlyphKit is also initialized.
All glyphs have an associated drawing canvas, the maximum size of which is 256 x 256 units. Although glyphs are rectangular in shape, each one has a "radius" which sets the drawable area. The glyph offset must also be set. This locates the origin of the glyph coordinate system relative to the center of the glyph. For example, the following code sets a drawable area of -100 to 100 in both x and y directions, and additionally creates an offset of zero, leaving the origin in the center of the glyph.
This glyph will be drawn using lines, so the LineGlyphElement will be used. This class requires a series of GlyphPoint objects to build the line. There can be any number of line glyph elements in a single glyph, but for this example, only one is needed. The result is a sort of polyline. Note that the color is set at the element level using SetExplicitColor.
For a glyph that is composed of multiple elements, assembling the glyph elements into a collection seems more natural. However, regardless of the number of elements, the GlyphElementArray is necessary, even for a single element:
All glyphs must be associated with a portfolio, and this portfolio must be made active for the segment that will display the glyph. Give your glyph a descriptive name if there is any possibility of ambiguity. Portfolios are discussed in detail in section 4.1.
At this point, the glyph is imported into Visualize and is ready to use. To insert it as a marker, be sure to make it the active marker symbol:
talk about marker fill (currently broken)