PROGRAMMING GUIDE
In Visualize, all lines are polylines, even if they consist of one segment. Like other geometry, the line object has a LineKey and LineKit. Lines can also be specified without a kit using a PointArray object as shown below:
Note that polylines are not assumed to be closed, so if a closed shape is desired, it must be explicitly specified.
Segment-level line attributes are set using the LineAttributeControl. These attributes include line weight and pattern. The line above was rendered with a weight of 2.
Infinite lines have no start or end point. They extend indefinitely into space. To draw an infinite line, call InsertInfiniteLine using your SegmentKey. Two points along the line are needed. Note that the type of infinite line (InfiniteLine or Ray) must be specified. The different colors are set at the segment level using the segment key's MaterialMappingControl. Continuing from the example above:
Note that infinite lines are considered unbounded geometry. Thus, they will be ignored in bounding calculations.
Rays are a type of infinite line. Just like the infinite line, two points are needed in order to insert it. However, in the case of the ray, the first point specified acts as the starting point of the ray. The other end extends indefinitely into space. The only other difference between the two is that the object type is set to InfiniteLine::Ray.
Note that rays are considered unbounded geometry. Thus, they will be ignored in bounding calculations.
Sometimes it is more desirable to edit a line in place instead of deleting and recreating it. Visualize allows editing of line points through the use of a kit or through direct action on the key. Legal edits include inserting a point into the line, deleting points, and modifying points. In the example below, the position of the first point from the original blue polyline has been modified, then the polygon is closed by inserting a new point at the end of the point list.
Infinite lines and rays can also be modified by calling SetFirst or SetSecond again.
Often, it is desirable to show a symbol as a line endpoint. Any glyph can be used for this purpose. For example, to set the endpoints, use a LinePatternOptionsKit to set the start and end caps:
Visualize also supports joining of lines by styling the intersection of line segments. Three styles are offered: LinePattern::Join::BevelJoin, LinePattern::Join::MitreJoin (the default), and LinePattern::Join::RoundJoin. The image below shows each join, respectively.
In engineering drawings, arrowheads are a common endpoint to a line segment. In Visualize, arrowheads are a type of line end cap. The Glyph::Default::SolidTriangleLeft and Glyph::Default::SolidTriangleRight glyphs are commonly used as arrowheads. All of the predefined glyphs can be found in the appendix.