tsc_PolylineList

This class is a list of polyline objects.  It is generally a snapshot of the polylines in a Job database, at the time it was constructed from the job. A Polyline List can be filtered in various ways to reduce it to some desired subset of all polylines in the job.

The list can be indexed by using the zero-based [] operator on the class to obtain a tsc_Polyline object.

Construction

tsc_PolylineList (const tsc_PolylineList& copy);
Generally a PolylineList is constructed by calling a function on tsc_JobPolylines that returns a list of polylines in the job.  The copy constructor simply makes a reference to the same list, so that changes made to either copy will be reflected in the other.

tsc_PolylineList ();
Creates an empty list.

tsc_PolylineList Clone();
Clone makes a shallow copy of the list.  The list itself is copied but all references are to the same line objects.  Changes made to the copy list will not affect the original list.

Public methods

tsc_Polyline operator[] (int item);
The [] operator will access any arc in the list by index, with item values that start at zero and end at Count()-1.
Arc objects in an unmodified list obtained from tsc_Database are always in database (time) sequence.

tsc_StringList ToStringList();
Returns a string list containing the names of all the arcs in the tsc_ArcList.

int Count () const;
The number of arcs in the list is returned.

bool IsEmpty() const;
Returns true if the list is empty.

void Append (const tsc_Polyline& poly);
Adds a polyline object to the end of the list.  This action affects only the list, not the job.

void Remove (const tsc_Polyline& poly);
Removes a polyline from the list.  If the same polyline exists more than once in the list, only the first is removed.  Note: The list is searched sequentially for the object, and then compacted; avoid using this repetitively on potentially large lists or consider using SelectBy instead.

void Remove (int index);
Removes the polyline from the list at the given index counted from zero.  Note: The list is compacted after the item is removed; avoid use on large lists or consider using SelectBy instead.

void Clear();
Removes all items.

void Find (tsc_IEntityFilter match, int startIndex = 0);
To find an polyline in a list, this function may be used; it is significantly faster than looping through the list yourself.  Construct a subclass of tsc_IEntityFilter and implement your search function there.

Filtering the list

These functions remove all but the selected items from an existing list.  They are significantly faster than iterating through the list to access and remove individual polyline objects.  It is also more efficient to first select for uncommon conditions.

void SelectGridable (int dimensions);
Use this to select items that are convertible to grid coordinates with the given number of dimensions - 1, 2, or 3.  A dimension of 1 selects all polylines with a height, 2 selects lines with both horizontal dimensions, and 3 selects only lines with all three. This applies across all parts of each polyline; that is, a polyline is only considered 3D if every coordinate in every part has a height component.

void SelectCollatingNameRange (const char* from, const char* to);
This function selects all arcs within a name range.  The names are first sorted such that numeric segments within the name are collated in a more intuitive sequence.  For instance, a normally sorted list of arcs might contain the sequence of names [A1,A10,A2,A20,A3], whereas this function sorts them as [A1,A2,A3,A10,A20] prior to selecting the range.  The resulting line list will also be sorted by name in this manner.

void RemoveDeleted();
Deleted items are normally included in polyline lists.  Use this function to remove them.

void SelectBy (tsc_IEntityFilter* keep);
This function allows any line to be tested by a callback function and kept or removed as determined by the callback. See the documentation for tsc_IEntityFilter for details and an example.  Using this function is very much faster than individually testing and removing lines in a list.

A NULL filter will result in no filtering and all objects will be retained.