![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class provides low-level access to the underlying bound, lasso and auto-title functionality.
Before using this class, you should set up the (static) snap-tolerance in the TSLBoundaryVertex class.
Public Member Functions | |
TSLBoundaryHelper (TSLFeatureID *buildingFeatureCodes=0, int numBuildingFeatureCodes=0, TSLFeatureID *extensionFeatureCodes=0, int numExtensionFeatureCodes=0) | |
TSLBoundaryHelper (TSLBoundaryHelper &src, TSLEnvelope &extent, bool includeMarked, bool extensionOnly) | |
TSLBoundaryHelper (TSLDrawingSurface *surface) | |
~TSLBoundaryHelper () | |
void | addEdge (TSLTMC end1_x, TSLTMC end1_y, TSLTMC end2_x, TSLTMC end2_y) |
void | clear () |
void | decompose (const TSLEntitySet *entity, bool(*valid)(const TSLEntity *entity)=0, const TSLEntity *clipEntity=0) |
void | decompose (const TSLPolyline *entity, const TSLEntity *clipEntity=0, bool mark=false, bool clearMarkIfExists=false) |
void | decompose (const TSLPolygon *entity, const TSLEntity *clipEntity=0, bool mark=false, bool clearMarkIfExists=false) |
TSLCoordSet * | dynamicBound (const TSLCoord *coord, const TSLEnvelope *boundary=0) |
void | extendMarkedCorners (double minCornerAngleChange, TSLTMC maxExtensionLength) |
void | extendOrphans (double angleTolerance, double scaleFactor) |
TSLBoundaryEdgeList * | getEdges () const |
TSLBoundaryEdgeList * | getEdgesWithVerticesNear (const TSLCoord &point, TSLTMC tolerance) const |
TSLBoundaryVertex * | getNearestPoint (const TSLCoord &pt, TSLTMC maxTMCDistance) |
TSLBoundaryVertex * | getNearestVertex (const TSLCoord &pt, bool existingOnly, TSLTMC maxTMCDistance) |
void | insertGapFillets (TSLTMC maximumDistance) |
TSLCoordSet * | largestContained (TSLBoundaryEdgeList **constituentEdges) |
void | removeOrphans (double angleTolerance=360.0, TSLTMC maximumLength=0) |
void | removeMarkedEdges () |
const TSLCoordSet * | seeds () const |
TSLCoordSet * | smallestEnclosure (const TSLCoord &coord, TSLBoundaryEdgeList **constituentEdges) |
void | splitEdges () |
void | unmarkContinuationEdges (Double angleTolerance) |
void * | getHandle () const |
TSLBoundaryHelper::TSLBoundaryHelper | ( | TSLFeatureID * | buildingFeatureCodes = 0, |
int | numBuildingFeatureCodes = 0, | ||
TSLFeatureID * | extensionFeatureCodes = 0, | ||
int | numExtensionFeatureCodes = 0 ) |
This method is the basic constructor for TSLBoundaryHelper.
buildingFeatureCodes | Feature codes to identify building outlines and seed points. |
numBuildingFeatureCodes | Number of feature codes specified in 'building FeatureCodes'. |
extensionFeatureCodes | Feature codes for features used during 'extendMarked Corners'. |
numExtensionFeatureCodes | Number of feature codes specified in 'extension FeatureCodes'. |
TSLBoundaryHelper::TSLBoundaryHelper | ( | TSLBoundaryHelper & | src, |
TSLEnvelope & | extent, | ||
bool | includeMarked, | ||
bool | extensionOnly ) |
This is a copy constructor for the TSLBoundaryHelper class.
This takes an existing TSLBoundaryHelper and copies across all edges that intersect the specified extent. Optionally, marked edges can be ignored.
src | Source TSLBoundaryHelper to copy from |
extent | Extent of edges to copy. Note that all edges that intersect the extent will be copied without being clipped. |
includeMarked | This flag indicates whether marked edges should be copied as well. |
extensionOnly | This flag indicates whether only extension features shuld be copied. |
TSLBoundaryHelper::TSLBoundaryHelper | ( | TSLDrawingSurface * | surface | ) |
TSLBoundaryHelper::~TSLBoundaryHelper | ( | ) |
Destructor for boundary helper
void TSLBoundaryHelper::addEdge | ( | TSLTMC | end1_x, |
TSLTMC | end1_y, | ||
TSLTMC | end2_x, | ||
TSLTMC | end2_y ) |
Add an edge line to the map data.
When all required edges have been added, call splitEdges to make sure vertices are created where edges cross.
end1_x,end1_y | coordinates of one end of the edge |
end2_x,end2_y | coordinates of the other end of the edge |
void TSLBoundaryHelper::clear | ( | ) |
This clears the all vertex and edge lists held within the boundary helper.
void TSLBoundaryHelper::decompose | ( | const TSLEntitySet * | entity, |
bool(* | valid )(const TSLEntity *entity) = 0, | ||
const TSLEntity * | clipEntity = 0 ) |
This method decomposes the specified entity into its component edges. For entities that contain other entities, this function recursively calls itself.
The (optional) validate function is called for all entities. If the validate function returns true, then that entity's edges are added. If no validate function is specified, then all entities edges are added
An optional clipping entity may be specified. The edges will be clipped to the boundary of this entity prior to addition.
Arguments list details :
entity : A pointer to the entity to be decomposed.
valid : Optional pointer to the validate function.
clipEntity : A pointer to the optional clip region.
void TSLBoundaryHelper::decompose | ( | const TSLPolygon * | entity, |
const TSLEntity * | clipEntity = 0, | ||
bool | mark = false, | ||
bool | clearMarkIfExists = false ) |
This method decomposes the specified polygon into its component edges.
An optional clipping entity may be specified. The edges will be clipped to the boundary of this entity prior to addition.
Arguments list details :
entity : A pointer to the entity to be decomposed.
clipEntity: Optional pointer to the clip boundary
mark : Flag to indicate whether the edges of the polygon should be marked.
clearMarkIfExists: Flag to indicate whether the edges of the polyline should have their mark cleared if they are already in the network.
void TSLBoundaryHelper::decompose | ( | const TSLPolyline * | entity, |
const TSLEntity * | clipEntity = 0, | ||
bool | mark = false, | ||
bool | clearMarkIfExists = false ) |
This method decomposes the specified polyline into its component edges.
An optional clipping entity may be specified. The edges will be clipped to the boundary of this entity prior to addition.
Arguments list details :
entity : A pointer to the entity to be decomposed.
clipEntity: Optional pointer to the clip boundary
mark : Flag to indicate whether the edges of the polyline should be marked.
clearMarkIfExists: Flag to indicate whether the edges of the polyline should have their mark cleared if they are already in the network.
TSLCoordSet * TSLBoundaryHelper::dynamicBound | ( | const TSLCoord * | coord, |
const TSLEnvelope * | boundary = 0 ) |
Use this method to find the smallest possible polygon at a given point on a drawing surface. To use this method you must use the constructor that takes a drawing surface.
coord | The point at which the search should start. |
boundary | A bounding polygon which specifies the extent to the search. If this is not declared, then a 'smart' search will take place. |
void TSLBoundaryHelper::extendMarkedCorners | ( | double | minCornerAngleChange, |
TSLTMC | maxExtensionLength ) |
This method extends corners including marked edges be extended to a nearby non marked edge.
minCornerAngleChange | Minimum angle change, in degrees, that must occur to indicate a corner. |
maxExtensionLength | Maximum length, in TMC units, that a corner may be extended by, |
void TSLBoundaryHelper::extendOrphans | ( | double | angleTolerance, |
double | scaleFactor ) |
This method extends any orphan chains by the maximum specified amount.
An orphan chain is a chain of edges, starting with a vertex that is only used by a single edge (the end vertex). The angle between each edge in the chain may vary by no more than the specified tolerance, typically a few degrees. The chain will also be terminated by a vertex that is used by three or more edges (eg. a T junction). Once the chain edges have been determined, the length of the chain is calculated. A ray is cast, extending out from the end vertex. If the ray intersects with another edge, then the distance from the end vertex to the intersection is calculated. If this distance is less than the chain length multiplied by the scaleFactor, then an edge is added between the end vertex and the intersection.
angleTolerance | This is the angle that determines whether the chain is to be continued. The angle is in degrees. |
scaleFactor | Multiplication factor to determine the maximum length of edge that may be added. |
TSLBoundaryEdgeList * TSLBoundaryHelper::getEdges | ( | ) | const |
Returns a new list of the edges found by the operation. Note that though the list is new (and should be destroyed after use), the list contains references to edges actually owned by the TSLBoundaryHelper. Therefore the helper must stay in existence while the list or its edges are in use.
No arguments.
TSLBoundaryEdgeList * TSLBoundaryHelper::getEdgesWithVerticesNear | ( | const TSLCoord & | point, |
TSLTMC | tolerance ) const |
Returns a list of edges that have at least one vertex close to the given point. Note that though the list is new (and should be destroyed after use), the list contains references to edges actually owned by the TSLBoundary Helper. Therefore the helper must stay in existence while the list or its edges are in use.
point | Point to test. |
tolerance | Maximum distance that the vertex may be from the edge to return true. If the point must be exacly on the edge, pass zero. |
void * TSLBoundaryHelper::getHandle | ( | ) | const |
TSLBoundaryVertex * TSLBoundaryHelper::getNearestPoint | ( | const TSLCoord & | pt, |
TSLTMC | maxTMCDistance ) |
Returns the nearest vertex within the specified distance to the specified point. If no such vertex currently exists within the vertex list, but the point is within maxTMCDistance of an existing edge, then a new vertex is created at the closest point along the edge and returned. The edge is split into two by the new vertex.
Argument descripton: pt : The point to check against maxTMCDistance: Tolerance value to decide whether the vertex and point are the same
Returns nearest Vertex within tolerance or nearest vertex along an edge, NULL if none found
TSLBoundaryVertex * TSLBoundaryHelper::getNearestVertex | ( | const TSLCoord & | pt, |
bool | existingOnly, | ||
TSLTMC | maxTMCDistance ) |
Returns the nearest vertex within the specified distance to the specified point. If no such point currently exists within the vertex list and the 'existingOnly' flag is false, then all edges are checked to see if they are within the tolerance value if the point. If so, then the nearest vertex of that edge is returned. No new vertex is created. Under the latter circumstances, the returned vertex may be outside the tolerance value.
Argument descripton: pt : The point to check against existingOnly : If true, only looks for an existing vertex. If false, also checks for edges within tolerance and returns nearest vertex of any edge within the tolerance value. maxTMCDistance: Tolerance value to decide whether the vertex and point are the same
Returns nearest Vertex within tolerance, NULL if none found and existingOnly is true.
void TSLBoundaryHelper::insertGapFillets | ( | TSLTMC | maximumDistance | ) |
Inserts additional edges between end vertices.
An end vertex is a vertex that is only used by a single edge. This method inserts an edge between end vertices that are within the specified distance of each other.
maximumDistance | Maximum distance between end vertices to be filled. |
TSLCoordSet * TSLBoundaryHelper::largestContained | ( | TSLBoundaryEdgeList ** | constituentEdges | ) |
This method determines the largest polygon that can be constructed within the edges. If necessary, the edges that make up the polygon can be returned by reference.
Both the coordinate set and any constituentEdges returned must be destroyed by the caller.
constituentEdges | Storage for list of edges that make up the returned polygon. |
void TSLBoundaryHelper::removeMarkedEdges | ( | ) |
This method removes all marked edges from list of edges.
void TSLBoundaryHelper::removeOrphans | ( | double | angleTolerance = 360.0, |
TSLTMC | maximumLength = 0 ) |
This method removes any orphan chains
An orphan chain is a chain of edges, starting with a vertex that is only used by a single edge (the end vertex). The angle between each edge in the chain may vary by no more than the specified tolerance, typically a few degrees.
angleTolerance | This is the angle that determines whether the chain is to be continued. The angle is in degrees. The default (360.0) will ignore angle changes when determining the chain. The chain will then be terminated by a vertex that is used by three or more edges (eg. a T junction). |
maximumLength | Maximum length of orphan chain to be removed, in TMC units. The default (0.0) will ignore the length and remove all orphan chains. |
const TSLCoordSet * TSLBoundaryHelper::seeds | ( | ) | const |
This method queries for any seed points found during the decomposition of entity sets.
Returns coord set containing seed points found.
TSLCoordSet * TSLBoundaryHelper::smallestEnclosure | ( | const TSLCoord & | coord, |
TSLBoundaryEdgeList ** | constituentEdges ) |
This method determines the smallest polygon that can be constructed around the specified point. If necessary, the edges that make up the polygon can be returned by reference.
Both the coordinate set and any constituentEdges returned must be destroyed by the caller.
coord | Coordinate to construct polygon around. |
constituentEdges | Storage for list of edges that make up the returned polygon. |
void TSLBoundaryHelper::splitEdges | ( | ) |
This splits up existing edges where vertices touch. eg. T junctions and + junctions
Arguments list details :
No parameters.
void TSLBoundaryHelper::unmarkContinuationEdges | ( | Double | angleTolerance | ) |
This method removes the 'marked' flag from edges which run in a straight line from unmarked edges.
A tolerance angle may be specified to determine how straight the line should be.
toleranceAngle | This is the angle that determines whether the line is straight. The angle is in degrees. |