Polygon specific access methods.
This class represents the access methods that are specific to a polygon. They also allow setting of rendering attributes.
Rendering attributes can be set directly to this geometry using the inherited TSLEntityBase::setRendering method. This is called 'Entity Rendering'.
Rendering can be applied to a large range of geometry using 'Feature Rendering' which is set by the datalayer using TSLDataLayer::addFeatureRendering which creates a featureID. The featureID can then have attributes applied to it using TSLDataLayer::setFeatureRendering.
A featureID can be applied to geometry on creation, or it can be added later using TSLEntityBase::featureID.
Valid Rendering Attributes for TSLPolygon:
- TSLRenderingAttributeExteriorEdgeColour
- TSLRenderingAttributeExteriorEdgeStyle
- TSLRenderingAttributeExteriorEdgeThickness
- TSLRenderingAttributeExteriorEdgeThicknessUnits
- TSLRenderingAttributeFillColour
- TSLRenderingAttributeFillStyle
The above is not a complete list, see TSLRenderingAttributeInt, TSLRenderingAttributeDouble and TSLRenderingAttributeBool for more details.
|
bool | addInner (TSLCoordSet *newPoints, bool keepCoordSet=false) |
|
bool | addInner (const TSLCoordSet &newPoints) |
|
double | area () const |
|
const TSLCoordSet * | inner (int index) const |
|
bool | inner (int index, TSLCoordSet *newPoints, bool keepCoordSet=false) |
|
bool | inner (int index, const TSLCoordSet &newPoints) |
|
int | numInners () const |
|
const TSLCoordSet & | outer () const |
|
bool | outer (TSLCoordSet *newPoints, bool keepCoordSet=false) |
|
bool | outer (const TSLCoordSet &newPoints) |
|
bool | perimeter (double *outerPerimeter, double *innerPerimeter) const |
|
bool | removeInner (int index) |
|
TSLEntitySet * | xOr (TSLPolygon const *const *otherPolygons, int numOtherPolygons) const |
|
TSLCoord | centroid () const |
|
TSLEntity * | clone () const |
|
bool | contains (const TSLEntity *other) const |
|
bool | crosses (const TSLEntity *other) const |
|
void | alwaysMergeDifferences (bool _alwaysMergeDifferences) |
|
TSLEntity * | difference (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 |
|
TSLEntity * | intersection (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 |
|
TSLEntitySet * | parent () |
|
const TSLEntitySet * | parent () 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) |
|
TSLEntity * | unionWith (const TSLEntity *other) const |
|
bool | within (const TSLEntity *other) const |
|
TSLCoord | adjustedWeightedCentroid () |
| reserved for future use
|
|
TSLCoord | centreOfGravity () |
| reserved for future use
|
|
bool | addDataSet () |
|
bool | addDataSet (TSLDataHandler *toUseDataHandler) |
|
bool | clearRenderingAttributes () |
|
TSLDataSet * | dataSet () |
|
const TSLDataSet * | dataSet () 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 |
|
TSL3DEntity * | is3DEntity () |
|
const TSL3DEntity * | is3DEntity () const |
|
TSLEntity * | isEntity () |
|
const TSLEntity * | isEntity () 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 TSLPolygon * | create (TSLFeatureID featureID, TSLCoordSet *coords, bool keepCoordSet=false) |
|
static TSLPolygon * | create (TSLFeatureID featureID, const TSLCoordSet &coords) |
|
static const TSLPolygon * | isPolygon (const TSLEntity *entity) |
|
static TSLPolygon * | isPolygon (TSLEntity *entity) |
|
static 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 TSLEntity * | createFromWKT (const char *wkt, double TMCPerMU, double mapOffsetX=0.0, double mapOffsetY=0.0, bool multiAsEntitySet=false, double maxCurveAngle=0.0) |
|
Creates a polygon with the specified parameters.
A polygon is a closed, filled feature. It must be non-complex, ie. edges must not cross, although they may touch. In addition, any holes may not touch or cross the outer, nor touch or cross any other hole.
This call should only be used for temporary entities. For example, this call may be used to create entities that are used in the spatial tests.
- Parameters
-
featureID | ID of the feature code to assign to the entity. This is used when rendering map features if no specific attribute set has been created for the entity. |
coords | Coordinate set describing the polygon. |
- Returns
- NULL on error.
static TSLPolygon * TSLPolygon::create |
( |
TSLFeatureID | featureID, |
|
|
TSLCoordSet * | coords, |
|
|
bool | keepCoordSet = false ) |
|
static |
Creates a polygon with the specified parameters.
A polygon is a closed, filled feature. It must be non-complex, ie. edges must not cross, although they may touch. In addition, any holes may not touch or cross the outer, nor touch or cross any other hole.
This call should only be used for temporary entities. For example, this call may be used to create entities that are used in the spatial tests.
- Parameters
-
featureID | ID of the feature code to assign to the entity. This is used when rendering map features if no specific attribute set has been created for the entity. |
coords | Coordinate set describing the polygon. |
keepCoordSet | Flag to indicate whether the polygon should keep the specified coordinate set, or clone it. Note that if this flag is set, the polygon assumes control of the coordinate set and invalidates it. The user should not attempt to make further use of the coordinate set. |
- Returns
- NULL on error.
bool TSLPolygon::inner |
( |
int | index, |
|
|
TSLCoordSet * | newPoints, |
|
|
bool | keepCoordSet = false ) |
Sets the coordinates of the inner boundary at the specified index.
A polygon must be non-complex, ie. edges must not cross, although they may touch. In addition, any holes may not touch or cross the outer, nor touch or cross any other hole.
- Parameters
-
index | Index of inner boundary to change. |
newPoints | New points for inner boundary. |
keepCoordSet | Flag to indicate whether the polygon should keep the specified coordinate set, or clone it. Note that if this flag is set, the polygon assumes control of the coordinate set and invalidates it. The user should not attempt to make further use of the coordinate set. |
- Returns
- If the polygon would be made invalid, then false. Also returns false if there is no such inner. Otherwise returns true.
bool TSLPolygon::outer |
( |
TSLCoordSet * | newPoints, |
|
|
bool | keepCoordSet = false ) |
Sets the coordinates of the outer boundary of the polygon.
A polygon must be non-complex, ie. edges must not cross, although they may touch. In addition, any holes may not touch or cross the outer, nor touch or cross any other hole.
- Parameters
-
newPoints | New points for the outer boundary. |
keepCoordSet | Flag to indicate whether the polygon should keep the specified coordinate set, or clone it. Note that if this flag is set, the polygon assumes control of the coordinate set and invalidates it. The user should not attempt to make further use of the coordinate set. |
- Returns
- If the polygon would be made invalid, then false. Otherwise returns true.
bool TSLPolygon::perimeter |
( |
double * | outerPerimeter, |
|
|
double * | innerPerimeter ) const |
Query the perimeter of the polygon.
Calculates and returns the perimeter of the polygon, in TMC units. Both inner and outer perimeters may be returned by reference. If only the outer perimeter is required, then the inner perimeter parameter may be NULL.
Returns true if successful, false otherwise.
bool TSLPolygon::removeInner |
( |
int | index | ) |
|
Removes the inner boundary from the polygon.
A polygon must be non-complex, ie. edges must not cross, although they may touch. In addition, any holes may not touch or cross the outer, nor touch or cross any other hole.
- Parameters
-
index | Index of inner boundary to remove. |
- Returns
- If the polygon would be made invalid, then false. Also returns false if there is no such inner. Otherwise returns true.