This class represents the parts that make up a polyline, specifically line parts and arc parts. Methods are provided to create, modify, merge, and iterate over the list.
This class deals in tsc_Point objects for the positions describing the lines and arcs that make up the polyline. Because only live polylines and feature-coded polylines are defined by point objects, this class will only work for these two types and not for legacy "grid style" polylines. Also, any polylines in attached jobs are unsupported by this class since the defining points would be dependent on that job's coordinate system.
Note that a polyline always has a "next part start coordinate", which is generally the end point of the last part appended. When a part is appended by specifying its end point, it is drawn from the last end point of the polyline. If the polyline is empty (has zero parts) then we use the start point given to the constructor.
explicit tsc_PolylinePointParts() = default;
explicit tsc_PolylinePointParts (const tsc_Point& start);
Constructs an empty set of polyline parts, and optionally a starting point for the first line or arc to be added.
int Count() const;
Returns the number of parts in the polyline.
void Clear() noexcept;
Removes all parts.
void AppendLineTo (const tsc_Point end);
Adds a straight line from the previous end point to the supplied end point - which becomes the start for the next part.
void AppendArcTo (const tsc_Point mid, const tsc_Point end);
Adds an arc to the polyline. The arc is defined by three points; the previous end point, a point on the arc given by mid, and the end point given by end - which comes the next start point.
bool MergeLineInto (const tsc_Point& start, const tsc_Point& end, double tol = 0);
All points must have horizontal coordinates.
start and end define the line to be appended. If the start ordinate is not within tol meters of the previous end point then a line is first appended from the previous end point to start.
Returns true if merged (i.e. the additional line was required).
bool MergeArcInto (const tsc_Point& start, const tsc_Point& mid, const tsc_Point& end, double tol = 0);
All points must have horizontal coordinates.
start, mid, and end define the arc to be appended. If the start ordinate is not within tol meters of the previous end point then a line is first appended from the previous end point to start.
Returns true if merged (i.e. the additional line was required).
bool CompareExact (const tsc_PolylineParts& rhs) const;
Tests for exact equality of the polyline to rhs. Note that the coordinates of the parts are compared exactly with zero tolerance.
void VisitEach (class tsc_IPolylinePointVisitor& visitor) const;
Passes geometric data describing each component part of the polyline to visitor.
See tsc_IPolylinePointVisitor.
tsc_Point Start;
The starting coordinate of the (first part of the) polyline. Modifying this would alter only the start position of the first part.