MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLCoordSet Class Reference

Detailed Description

Class managing a set of internal TMC coordinates.

Used to construct geometric objects such as polylines and polygons.

NOTE: Instances of TSLCoordSet must be allocated on the heap since the allocation is redirected to MapLink. To prevent users creating these objects statically, automatically or embedded, the destructor is private. To destroy a TSLCoordSet, call the public destroy method, rather than the delete operator.

Public Member Functions

 TSLCoordSet ()
 
 TSLCoordSet (const TSLCoordSet &other)
 
TSLCoordSetoperator= (const TSLCoordSet &right)
 
TSLCoordoperator[] (int index)
 
const TSLCoordoperator[] (int index) const
 
bool add (TSLTMC x, TSLTMC y, int index=-1)
 
bool add (const TSLCoord &coord, int index=-1)
 
bool addCoords (const TSLCoord *coords, int num)
 
bool addCoords (const TSLTMC *xy, int num)
 
TSLCoordback ()
 
const TSLCoordback () const
 
unsigned int capacity ()
 
bool clear ()
 
bool concatenate (const TSLCoordSet &rhs)
 
TSLAreaRelations coordInArea (const TSLCoord &coord) const
 
bool destroy ()
 
TSLCoordelementAt (int index)
 
const TSLCoordelementAt (int index) const
 
TSLEnvelope envelope () const
 
void extendHint (TSLCoordSetExtendHint hint, int extendBlockSize)
 
TSLCoordfront ()
 
const TSLCoordfront () const
 
double length () const
 
bool move (const TSLCoord &location, const TSLCoord &reference)
 
bool nearest (const TSLCoord &coord, TSLCoord &nearestCoord, int &nearestIndex) const
 
bool remove (int index)
 
void reserve (int size)
 
void resize (int newSize)
 
bool reverse ()
 
bool rotate (double angle, const TSLCoord *origin=0)
 
bool scale (double scaleParam, const TSLCoord *origin=0)
 
int size () const
 
void swap (TSLCoordSet &rhs)
 
bool translate (TSLTMC dx, TSLTMC dy)
 
void * operator new (size_t size) TSL_NO_THROW
 
void * operator new (size_t size, char *filename, int line)
 

Constructor & Destructor Documentation

◆ TSLCoordSet() [1/2]

TSLCoordSet::TSLCoordSet ( )

Default constructor.

Creates an empty coordinate set.

Use the destroy method to destroy an instance of this class, rather than the delete operator.

◆ TSLCoordSet() [2/2]

TSLCoordSet::TSLCoordSet ( const TSLCoordSet & other)

Copy constructor.

Creates a coordinate set that is a copy of that specified.

Use the destroy method to destroy an instance of this class, rather than the delete operator.

Member Function Documentation

◆ add() [1/2]

bool TSLCoordSet::add ( const TSLCoord & coord,
int index = -1 )

Add a new coordinate to the set.

Parameters
coordNew coordinate to append
indexPosition for new point. If value is out of range, then new coordinate is appended.
Returns
true on success, false otherwise.

◆ add() [2/2]

bool TSLCoordSet::add ( TSLTMC x,
TSLTMC y,
int index = -1 )

Add a new coordinate to the set.

Parameters
xX coordinate for new point.
yY coordinate for new point.
indexPosition for new point. If value is out of range, then new coordinate is appended.
Returns
true on success, false otherwise.

◆ addCoords() [1/2]

bool TSLCoordSet::addCoords ( const TSLCoord * coords,
int num )

Add a number of new coordinates to the set.

Parameters
coordsPointer to new coordinates to append.
numNumber of coordinates to add
Returns
true on success, false on error.

◆ addCoords() [2/2]

bool TSLCoordSet::addCoords ( const TSLTMC * xy,
int num )

Add a number of new coordinates to the set.

Parameters
xyPointer to new xy pairs to append.
numNumber of xy pairs to add
Returns
true on success, false on error.

◆ back() [1/2]

TSLCoord & TSLCoordSet::back ( )

Access the last coordinate.

Returns a reference to the last coordinate.

◆ back() [2/2]

const TSLCoord & TSLCoordSet::back ( ) const

Access the last coordinate.

Returns a reference to the last coordinate

◆ capacity()

unsigned int TSLCoordSet::capacity ( )

Returns the capacity of the coordinate set, ie the number of coordinates that can be held in the allocated memory.

◆ clear()

bool TSLCoordSet::clear ( )

Clears the coordinate set.

◆ concatenate()

bool TSLCoordSet::concatenate ( const TSLCoordSet & rhs)

Concatenates anotherCoordSet to the supplier.

Parameters
rhsCoordSet to concatenate
Returns
false on error, true otherwise.

◆ coordInArea()

TSLAreaRelations TSLCoordSet::coordInArea ( const TSLCoord & coord) const

Query whether the specified coordinate is inside the area formed by the coordinate set. This assumes that the coordinate set is closed.

The coordinates in this TSLCoordSet must be valid for creating a TSLPolygon i.e. edges must not cross, although they may touch and the coordinates must be specified in an anti-clockwise direction.

Parameters
coordCoordinate to test
Returns
whether the coordinate lies outside, inside or on the edge of the coordinate set.

◆ destroy()

bool TSLCoordSet::destroy ( )

Destroy a TSLCoordSet.

NOTE : Instances of TSLCoordSet must be allocated on the heap since the allocation is redirected to MapLink. To prevent users creating these objects statically, automatically or embedded, we make the destructor private. To destroy a TSLCoordSet, call the public destroy method, rather than the delete operator.

◆ elementAt() [1/2]

TSLCoord & TSLCoordSet::elementAt ( int index)

Access the coordinate at the specified index.

Parameters
indexIndex into coordinate set
Returns
a reference to the specified coordinate.

◆ elementAt() [2/2]

const TSLCoord & TSLCoordSet::elementAt ( int index) const

Access the read-only coordinate at the specified index.

Parameters
indexIndex into coordinate set
Returns
a read-only reference to the specified coordinate.

◆ envelope()

TSLEnvelope TSLCoordSet::envelope ( ) const

Return the minimum bounding box of the coordinate set.

◆ extendHint()

void TSLCoordSet::extendHint ( TSLCoordSetExtendHint hint,
int extendBlockSize )

The extend hint determines the way in which the coordinate set reallocates its memory when the capacity of the coordinate set has been exceeded.

Parameters
hintThe new hint for this coordinate set.
extendBlockSizeNumber of coordinates in the block. If you specify TSLCoordSetExtendByBlockSize, then this parameter defines the block size used. This is ignored for all other capacity hints.

See documentation in TSLCoordSetExtendHint for further information.

◆ front() [1/2]

TSLCoord & TSLCoordSet::front ( )

Access the first coordinate.

Returns a reference to the first coordinate.

◆ front() [2/2]

const TSLCoord & TSLCoordSet::front ( ) const

Access the first coordinate.

Returns a reference to the first coordinate

◆ length()

double TSLCoordSet::length ( ) const

Returns the length of the polyline described by this set of coordinates in TMC units.

◆ move()

bool TSLCoordSet::move ( const TSLCoord & location,
const TSLCoord & reference )

Moves the coordSet, matching the "reference" point of the coordSet (this can be a point which does not belong to the Entity) with the point defined by "location".

Parameters
locationPoint to move to.
referenceReference point to move from.
Returns
true on success, false otherwise.

◆ nearest()

bool TSLCoordSet::nearest ( const TSLCoord & coord,
TSLCoord & nearestCoord,
int & nearestIndex ) const

Queries for the index and value of the nearest coordinate in the coordset, to the specified point.

Parameters
coordCoord to find nearest to
nearestCoordStorage for nearest coordinate
nearestIndexStorage for index of nearest Coordinate
Returns
Returns true on success, false on failure. By reference value and index of nearest coordinate.

◆ operator new() [1/2]

void * TSLCoordSet::operator new ( size_t size)

These are here to avoid being documented Allocation redirection for API.

◆ operator new() [2/2]

void * TSLCoordSet::operator new ( size_t size,
char * filename,
int line )

When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.

◆ operator=()

TSLCoordSet & TSLCoordSet::operator= ( const TSLCoordSet & right)

Assignment operator.

Assigns the argument coordinate set to this.

Parameters
rightSource for new value.
Returns
reference to updated value.

◆ operator[]() [1/2]

TSLCoord & TSLCoordSet::operator[] ( int index)

Access the coordinate at the specified index.

Parameters
indexIndex into coordinate set
Returns
a reference to the specified coordinate.

◆ operator[]() [2/2]

const TSLCoord & TSLCoordSet::operator[] ( int index) const

Access the read-only coordinate at the specified index.

Parameters
indexIndex into coordinate set
Returns
a read-only reference to the specified coordinate.

◆ remove()

bool TSLCoordSet::remove ( int index)

Remove the coordinate at the specified index.

Parameters
indexPosition for the point to remove.
Returns
false on error, true otherwise.

◆ reserve()

void TSLCoordSet::reserve ( int size)

Pre-allocate storage space for a specified number of coordinates.

Parameters
sizeThe number of coordinates to reserve storage space for.

◆ resize()

void TSLCoordSet::resize ( int newSize)

Resizes the coordinate set so it contains newSize coordinates.

If the new size is smaller than the current size, the extra coordinates will be removed from the end, leaving the first newSize coordinates unchanged.

If the new size is larger than the current size, the new coordinates will be added to the end, and all will be set to (0,0).

Parameters
newSizeThe new size.

◆ reverse()

bool TSLCoordSet::reverse ( )

Reverses the order of the coordinate sequence in the set of coordinates.

Returns true on success, false otherwise.

◆ rotate()

bool TSLCoordSet::rotate ( double angle,
const TSLCoord * origin = 0 )

Rotates the coordSet clockwise by angle, using origin as the reference of the rotation or its envelope centre if origin = NULL.

The angle is given in radians.

Parameters
angleAngle to rotate by - radians, +ve anti-clockwise from +ve X axis
originPosition to rotate about
Returns
true on success, false otherwise.

◆ scale()

bool TSLCoordSet::scale ( double scaleParam,
const TSLCoord * origin = 0 )

Scales a coordSet. The origin of the scale is the envelope centre of the coordSet if origin = NULL.. A scale factor of 0 is not valid.

Parameters
scaleParamScale factor
originLocation to scale about.
Returns
true on success, false otherwise.

◆ size()

int TSLCoordSet::size ( ) const

Query the number of coordinates in the coordinate set.

◆ swap()

void TSLCoordSet::swap ( TSLCoordSet & rhs)

Efficiently swaps the contents of this TSLCoordSet with the one given.

Parameters
rhsTSLCoordSet to swap the contents with.

◆ translate()

bool TSLCoordSet::translate ( TSLTMC dx,
TSLTMC dy )

Moves the coordSet by the specified x and y amounts.

Parameters
dxDelta to translate horizontally
dyDelta to translate vertically
Returns
true on success, false otherwise.