MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLEntity Class Reference
Inheritance diagram for TSLEntity:

Detailed Description

TSLEntity is an interface to a generic 2D entity.

TSLEntity and its derived classes are not instantiable classes. They may only be created by other calls to the API.

Public Member Functions

TSLCoord centroid () const
 
TSLEntityclone () const
 
bool contains (const TSLEntity *other) const
 
bool crosses (const TSLEntity *other) const
 
void alwaysMergeDifferences (bool _alwaysMergeDifferences)
 
TSLEntitydifference (const TSLEntity *other) const
 
double distance (const TSLCoord &point, bool useRenderedExtent=true, int drawingSurfaceID=-1) const
 
TSLEnvelope envelope (int surfaceID=-1) const
 
bool equals (const TSLEntity *other) const
 
TSLEntityintersection (const TSLEntity *other) const
 
bool intersects (const TSLEntity *other) const
 
bool intersects (const TSLEnvelope *envelope) const
 
bool move (const TSLCoord &location, const TSLCoord &reference)
 
bool overlaps (const TSLEntity *other) const
 
TSLEntitySetparent ()
 
const TSLEntitySetparent () const
 
void renderLevel (int level)
 
int renderLevel () const
 
bool rotate (double angle, const TSLCoord *origin=NULL)
 
double rotation () const
 
bool rotation (double newValue)
 
bool scale (double scaleParam, TSLCoord *origin=0)
 
bool scaleXY (double scaleX, double scaleY, TSLCoord *origin=0)
 
double squareDistance (const TSLCoord &point, bool useRenderedExtent=true, int drawingSurfaceID=-1) const
 
double squareDistance (const TSLEntity *otherEntity) const
 
bool touches (const TSLEntity *other) const
 
bool translate (TSLTMC xoffset, TSLTMC yoffset)
 
TSLEntityunionWith (const TSLEntity *other) const
 
bool within (const TSLEntity *other) const
 
TSLCoord adjustedWeightedCentroid ()
 reserved for future use
 
TSLCoord centreOfGravity ()
 reserved for future use
 
- Public Member Functions inherited from TSLEntityBase
bool addDataSet ()
 
bool addDataSet (TSLDataHandler *toUseDataHandler)
 
bool clearRenderingAttributes ()
 
TSLDataSetdataSet ()
 
const TSLDataSetdataSet () const
 
short dataSourceID () const
 
void dataSourceID (short dataSourceID)
 
bool deleteDataSet ()
 
void destroy ()
 
TSLEntityID entityID () const
 
void entityID (TSLEntityID value)
 
TSLFeatureID featureID () const
 
void featureID (TSLFeatureID newValue)
 
bool getRendering (TSLRenderingAttributeInt attribute, int *result) const
 
bool getRendering (TSLRenderingAttributeDouble attribute, double *result) const
 
bool getRendering (TSLRenderingAttributeBool attribute, bool *result) const
 
bool getRendering (TSLRenderingAttributes &result) const
 
TSL3DEntityis3DEntity ()
 
const TSL3DEntityis3DEntity () const
 
TSLEntityisEntity ()
 
const TSLEntityisEntity () const
 
bool isOptimisedEntity () const
 
void name (const char *newValue)
 
const char * name () const
 
void releaseResources (int surfaceID)
 
bool setRendering (TSLRenderingAttributeInt attribute, int value)
 
bool setRendering (TSLRenderingAttributeDouble attribute, double value)
 
bool setRendering (TSLRenderingAttributeBool attribute, bool value)
 
bool setRendering (const TSLRenderingAttributes &attributes)
 
void sourceID (int value)
 
int sourceID () const
 
TSLGeometryType type () const
 
void version (TSLVersion value)
 
TSLVersion version () const
 

Static Public Member Functions

static TSLEntitycreateFromWKB (const unsigned char *wkb, unsigned int wkbLength, double TMCPerMU, double mapOffsetX=0.0, double mapOffsetY=0.0, bool multiAsEntitySet=false, double maxCurveAngle=0.0)
 
static TSLEntitycreateFromWKT (const char *wkt, double TMCPerMU, double mapOffsetX=0.0, double mapOffsetY=0.0, bool multiAsEntitySet=false, double maxCurveAngle=0.0)
 

Protected Member Functions

 ~TSLEntity ()
 
- Protected Member Functions inherited from TSLEntityBase
 ~TSLEntityBase ()
 

Constructor & Destructor Documentation

◆ ~TSLEntity()

TSLEntity::~TSLEntity ( )
protected

Member Function Documentation

◆ adjustedWeightedCentroid()

TSLCoord TSLEntity::adjustedWeightedCentroid ( )

reserved for future use

◆ alwaysMergeDifferences()

void TSLEntity::alwaysMergeDifferences ( bool _alwaysMergeDifferences)

The method sets a flag to indicate that when a group difference occurs we should always merge the entity differences.

This changes the spatial difference behaviour to be non standard.

Parameters
_alwaysMergeDifferencestrue to merge the entity differences, false for default behaviour.

◆ centreOfGravity()

TSLCoord TSLEntity::centreOfGravity ( )

reserved for future use

◆ centroid()

TSLCoord TSLEntity::centroid ( ) const

Query the centre of the entity extent.

This is the centre of the extent, rather than the centre of mass, which only applies to certain classes of object.

Returns a TSLCoord which is the centre of the TSLEntity.

◆ clone()

TSLEntity * TSLEntity::clone ( ) const

Returns a clone of the entity.

Note: You can not clone a entity which is a user geometry object.

◆ contains()

bool TSLEntity::contains ( const TSLEntity * other) const

Tests if this entity 'spatially contains' another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the other entity is contained, false otherwise.

◆ createFromWKB()

static TSLEntity * TSLEntity::createFromWKB ( const unsigned char * wkb,
unsigned int wkbLength,
double TMCPerMU,
double mapOffsetX = 0.0,
double mapOffsetY = 0.0,
bool multiAsEntitySet = false,
double maxCurveAngle = 0.0 )
static

Convert from well known binary to MapLink geometry.

The following WKB types will be converted:

The coordinate system of the data will not be modified, but the coordinates of each geometry will be scaled according to the TMCPerMU value.

Any invalid geometry will be ignored, and will not be present in the output entity.

Parameters
wkbA pointer to the well known binary data
wkbLengthThe length, in bytes, of the data
TMCPerMUThe TMC per Map Unit conversion value to use when converting the geometry.
mapOffsetXThe x coordinate of the MapLink TMC coordinate space for the projected coordinate system, in map units. This can be queried from the TSLCoordinateSystem::getMapOffsets method when creating geometry compatible with a MapLink coordinate system.
mapOffsetYThe y coordinate of the MapLink TMC coordinate space for the projected coordinate system, in map units. This can be queried from the TSLCoordinateSystem::getMapOffsets method when creating geometry compatible with a MapLink coordinate system.
multiAsEntitySetIf true, all multi geometry types will be converted to entity sets. If false the TSLMultiXXX types will be used.
maxCurveAngleThe largest step in degrees along an arc when drawing curved geometry (From MapLink Pro 8.2 onwards)

◆ createFromWKT()

static TSLEntity * TSLEntity::createFromWKT ( const char * wkt,
double TMCPerMU,
double mapOffsetX = 0.0,
double mapOffsetY = 0.0,
bool multiAsEntitySet = false,
double maxCurveAngle = 0.0 )
static

Convert from well known text to MapLink geometry.

The following WKT types will be converted:

The coordinate system of the data will not be modified, but the coordinates of each geometry will be scaled according to the TMCPerMU value.

Any invalid geometry will be ignored, and will not be present in the output entity.

Parameters
wktThe well known text string to convert
TMCPerMUThe TMC per Map Unit conversion value to use when converting the geometry.
mapOffsetXThe x coordinate of the MapLink TMC coordinate space for the projected coordinate system, in map units. This can be queried from the TSLCoordinateSystem::getMapOffsets method when creating geometry compatible with a MapLink coordinate system.
mapOffsetYThe y coordinate of the MapLink TMC coordinate space for the projected coordinate system, in map units. This can be queried from the TSLCoordinateSystem::getMapOffsets method when creating geometry compatible with a MapLink coordinate system.
multiAsEntitySetIf true, all multi geometry types will be converted to entity sets. If false the TSLMultiXXX types will be used.
maxCurveAngleThe largest step in degrees along an arc when drawing curved geometry (From MapLink Pro 8.2 onwards)

◆ crosses()

bool TSLEntity::crosses ( const TSLEntity * other) const

Tests if this entity 'spatially crosses' another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the entities cross, false otherwise.

◆ difference()

TSLEntity * TSLEntity::difference ( const TSLEntity * other) const

Creates the spatial difference between the two entities.

Parameters
otherAnother entity to perform test against.
Returns
a entity that represents the difference of the source TSLentity and another TSLEntity.

If no geometric difference is possible, then a NULL entity is returned.

◆ distance()

double TSLEntity::distance ( const TSLCoord & point,
bool useRenderedExtent = true,
int drawingSurfaceID = -1 ) const

Query the shortest distance between this entity and the specified point.

Parameters
pointPosition to query for distance from.
useRenderedExtentFlag to indicate whether to use last rendered extent of object. If this flag is true, then for text and symbols, and point inside the rendered extent will return 0.0 as the distance. If this flag is false, then for text and symbols, the distance to the object position is used. Default true
drawingSurfaceIDID of drawing surface to use for rendered extent.
Returns
the shortest distance between any points in the TSLEntity and the specified position. If the entity does not contain any points then returns 0.0 and places an error in TSLErrorStack.

◆ envelope()

TSLEnvelope TSLEntity::envelope ( int surfaceID = -1) const

Query the minimum bounding box of the entity.

Parameters
surfaceIDan id for a drawing surface. Since some entities, such as Symbol and Text, can vary according to the zoom factor, an optional surfaceID may be passed in. This is the id that has been attached to an individual drawing surface using TSLDrawingSurface::id(). By default these id's are 0 and therefore all drawing surfaces will share a common envelope.
Returns
the minimum bounding box of the entity.

◆ equals()

bool TSLEntity::equals ( const TSLEntity * other) const

Test for spatial equality with another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the entities are the same, false otherwise.

◆ intersection()

TSLEntity * TSLEntity::intersection ( const TSLEntity * other) const

Creates a spatial intersection between the two entities.

Parameters
otherAnother entity to perform test against.
Returns
a entity that represents the intersection of the source TSLentity with another TSLEntity.

◆ intersects() [1/2]

bool TSLEntity::intersects ( const TSLEntity * other) const

Test for spatial intersection between the two entities.

Parameters
otherAnother entity to perform test against.
Returns
true if the entities intersect, false otherwise.

◆ intersects() [2/2]

bool TSLEntity::intersects ( const TSLEnvelope * envelope) const

Test for spatial intersection between the entity and an envelope.

Parameters
envelopeEnvelope to test against.
Returns
true if the entity and envelope intersect, false otherwise.

◆ move()

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

Moves this entity to the specified point.

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

Parameters
locationNew position for reference point.
referencePoint to translate
Returns
true if the move occurred, false if the move could not be applied. If the move can not be applied then the entity is not changed. The only reason for the move not being applied is if an attempt is made to move the entity fully or partially outside TMC space.

◆ overlaps()

bool TSLEntity::overlaps ( const TSLEntity * other) const

Tests if this entity 'spatially overlaps' another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the entities overlap, false otherwise.

◆ parent() [1/2]

TSLEntitySet * TSLEntity::parent ( )

Query the entity set containing this entity.

If this is a free-standing or top-level entity, then NULL is returned.

◆ parent() [2/2]

const TSLEntitySet * TSLEntity::parent ( ) const

Query the read-only entity set containing this entity.

If this is a free-standing or top-level entity, then NULL is returned.

◆ renderLevel() [1/2]

int TSLEntity::renderLevel ( ) const

Queries the rendering level for the entity.

All entities of a specific rendering level are drawn together. Lines drawn using Multi-pass line styles have their edges merged if they are at the same rendering level. Rendering levels are drawn in the order -5 through to +5.

◆ renderLevel() [2/2]

void TSLEntity::renderLevel ( int level)

Sets the rendering level for the entity.

All entities of a specific rendering level are drawn together. Lines drawn using Multi-pass line styles have their edges merged if they are at the same rendering level. Rendering levels are drawn in the order -5 through to +5.

Parameters
levelNew rendering level for entity. Valid values are -5 to +5.

◆ rotate()

bool TSLEntity::rotate ( double angle,
const TSLCoord * origin = NULL )

Rotates the entity.

Rotates the TSLEntity anti-clockwise by angle, about specified origin. Uses centroid as the reference of the rotation if origin is NULL.

Angle is given in radians.

For entities that have an internal rotation, such as text or symbols, this adds to the rotation angle, and possibly changes the position of the entity.

For entities that contain a CoordSet, the coordinates are changed.

Parameters
angleAngle to rotate by, in radians, anti-clockwise +ve.
originPoint to rotate about. NULL origin uses centroid.
Returns
true if the rotate occurred, false if the rotate could not be applied. If the rotate can not be applied then the entity is not changed. The only reason for the rotate not being applied is if an attempt is made to rotate the entity fully or partially outside TMC space.
Note
TSLEntitySet rotate is done on each entity and as such is applied to all entities in turn. If one entity can not be rotated then the rotation is removed on the ones that succeeded. False will be returned in this situation.

◆ rotation() [1/2]

double TSLEntity::rotation ( ) const

Query the rotation angle of the entity

◆ rotation() [2/2]

bool TSLEntity::rotation ( double newValue)

Set the rotation angle of the entity

Parameters
newValueNew angle of rotation of the entity, in radians, +ve anti-clockwise from +ve X axis.
Returns
true if the rotation can be applied, false otherwise. If the rotation is not applied the entity will not have been rotated.

◆ scale()

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

Scales this entity, equally in both directions.

Parameters
scaleParamScaling factor to apply. 0 is invalid.
originOrigin to scale about. If origin is NULL, the origin of the scale is the centroid of the TSLEntity.
Returns
true if the scale occurred, false if the scale could not be applied. If the scale can not be applied then the entity is not changed. The possible reasons for the scale not being applied are if an attempt is made to scale the entity fully or partially outside TMC space or scaling the entity too small.

◆ scaleXY()

bool TSLEntity::scaleXY ( double scaleX,
double scaleY,
TSLCoord * origin = 0 )

Scales this entity.

Parameters
scaleXScaling factor to apply in X. 0 is invalid.
scaleYScaling factor to apply in Y. 0 is invalid.
originOrigin to scale about. If origin is NULL, the origin of the scale is the centroid of the TSLEntity.
Returns
true if the scale occurred, false if the scale could not be applied. If the scale can not be applied then the entity is not changed. The possible reasons for the scale not being applied are if an attempt is made to scale the entity fully or partially outside TMC space or scaling the entity too small.

◆ squareDistance() [1/2]

double TSLEntity::squareDistance ( const TSLCoord & point,
bool useRenderedExtent = true,
int drawingSurfaceID = -1 ) const

Query the shortest square distance between the entity and the specified point.

Parameters
pointPosition to query for square distance from.
useRenderedExtentFlag to indicate whether to use last rendered extent of object. If this flag is true, then for text and symbols, and point inside the rendered extent will return 0.0 as the distance. If this flag is false, then for text and symbols, the distance to the object position is used. Default true
drawingSurfaceIDID of drawing surface to use for rendered extent.
Returns
the shortest square distance between any points in the TSLEntity and the specified position. If the entity does not contain any points then return 0.0 and place error in TSLErrorStack.

◆ squareDistance() [2/2]

double TSLEntity::squareDistance ( const TSLEntity * otherEntity) const

This method calculates the shortest square distance between entities.

The otherEntity may be a TSLEntitySet or series of entity sets. In this case the square distance returned is to the closest non-set entity.

The square distance is calculated for the following entity types:

All other entities will cause a warning to be raised and the that entity will be ignored.

Parameters
otherEntityentity to query the shortest distance too.
Returns
the shortest square distance to the otherEntity. If -1 is returned than an error occurred. In this case please check the error stack (TSLError*Stack)

◆ touches()

bool TSLEntity::touches ( const TSLEntity * other) const

Tests if this entity 'spatially touches' another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the entities touch, false otherwise.

◆ translate()

bool TSLEntity::translate ( TSLTMC xoffset,
TSLTMC yoffset )

Translates this entity by delta.

Parameters
xoffsetdelta applied to X coordinates.
yoffsetdelta applied to Y coordinates.
Returns
true if the translate occurred, false if the translate could not be applied. If the translate can not be applied then the entity is not changed. The only reason for the translate not being applied is if an attempt is made to translate the entity fully or partially outside TMC space.

◆ unionWith()

TSLEntity * TSLEntity::unionWith ( const TSLEntity * other) const

Creates a spatial union between the two entities.

Parameters
otherAnother entity to perform test against.
Returns
a entity that represents the union of the source TSLEntity with another TSLEntity.

If no geometric union is possible, then a TSLEntitySet containing the entities is returned.

◆ within()

bool TSLEntity::within ( const TSLEntity * other) const

Tests if this entity is 'spatially within' another entity.

Parameters
otherAnother entity to perform test against.
Returns
true if the other entity is within this entity, false otherwise.