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

Detailed Description

An island is a contiguous set of features.

Islands are created by calling the static method createIslands() and passing it a data layer. This method looks for contiguous features; for each such set it will create an island and add it to the set of islands.

NOTE : When creating islands, an assumption is made that the features are touching, rather than overlapping. This is the case for data such as OS MasterMap - as TSLTMC as features such as cliffs, slopes and landform polygons are ignored. This latter is important when capturing island boundaries with holes.

Islands can be merged by calling the static method mergeIslands(), passing it two island sets. This method first works out groups of overlapping islands. For each group, it performs a merging process (which respects version information). The merged result passes through a final island extraction process in case departed features have resulted in the merged island splitting. Once this has been done for all groups, the result is a set of non-overlapping islands.

Users can construct islands in one of two ways: (1) by passing a (tmf) file and extent or (2) by passing a data layer. In the first case, it is assumed that the (tmf) file represents an existing island i.e. it has been produced as a result of an earlier call to createIslands(). The extent is expected to be the extent of the island. In the second case, the data layer is assumed to represent an existing island. The island will assume ownership of the data layer.

Public Member Functions

 TSLIsland (const char *dataFile, const TSLEnvelope &extent, const char *id=0)
 
 TSLIsland (TSLStandardDataLayer *data, const char *id=0)
 
 TSLIsland (const TSLIsland &other)
 
TSLIslandoperator= (const TSLIsland &rhs)
 
const TSLPolygonboundary (bool includingInners=false) const
 
bool contains (const TSLCoord &position) const
 
void destroy ()
 
const TSLEnvelopeextent () const
 
const TSLStandardDataLayerfeatures () const
 
const char * id () const
 
void id (const char *islandID)
 
void * operator new (size_t)
 
void operator delete (void *)
 
void * operator new (size_t, char *, int)
 

Static Public Member Functions

static void configure (TSLTMC pointCoincidence=0, TSLTMC tmcPerVertexStrip=6500)
 
static bool createIslands (const TSLStandardDataLayer *data, TSLIslandSet &islands)
 
static bool createIslands (TSLStandardDataLayer *data, TSLMapDataLayer *mapLayer, TSLSLMEntityRefHandler &mapRefHandler, TSLIslandSet &islands)
 
static bool mergeIslands (const TSLIslandSet &islands, TSLIslandMergeSet &mergedIslands)
 
static bool mergeIslands (const TSLIslandSet &islands, TSLStandardDataLayer *layer, const char *mapName, TSLSLMEntityRefHandler &mapRefHandler, TSLIslandMergeSet &mergedIslands, bool replaceDepartedFeatures=true)
 
static bool mergeIslands (const TSLIslandSet &islands, const char *mapName, TSLSLMEntityRefHandler &mapRefHandler, TSLIslandMergeSet &mergedIslands, bool replaceDepartedFeatures=true)
 
static bool sortDepartedFeatures (TSLMapDataLayer *mapLayer, TSLSLMEntityRefHandler &mapRefHandler, TSLIslandSet &islands)
 
static bool createIslands (TSLStandardDataLayer *data, const char *mapName, TSLSLMEntityRefHandler &mapRefHandler, TSLIslandSet &islands)
 

Constructor & Destructor Documentation

◆ TSLIsland() [1/3]

TSLIsland::TSLIsland ( const char * dataFile,
const TSLEnvelope & extent,
const char * id = 0 )

Constructs an island based on its (tmf) file and extent. The (tmf) file is assumed to contain the island features only. It is not automatically loaded into the data layer. This will only happen if the data layer is required.

Parameters
dataFileThe (tmf) file containing the island features.
extentThe extent of the features.
idThe id of the island. If this is NULL, then a default id will be generated.

◆ TSLIsland() [2/3]

TSLIsland::TSLIsland ( TSLStandardDataLayer * data,
const char * id = 0 )

Constructs an island given a data layer. The data layer is assumed to contain the island features only.

Parameters
dataThe data layer containing the island features.
idThe id of the island. If this is NULL, then a default id will be generated.

The island takes ownership of the data layer.

◆ TSLIsland() [3/3]

TSLIsland::TSLIsland ( const TSLIsland & other)

Copy constructor.

Member Function Documentation

◆ boundary()

const TSLPolygon * TSLIsland::boundary ( bool includingInners = false) const

Returns the polygon that represents the boundary of the island. If the polygon has not yet been constructed, then, if necessary, the data is loaded into the data layer and the boundary is constructed based on the layer contents.

When the boundary includes inners, it is important that the island polygons do not overlap. Typical problem cases are OSMM cliffs, slopes and landform polygons. This is not an issue if inners are not required.

Parameters
includingInnersTrue if the created boundary should check for inner boundaries as well. Default false.

◆ configure()

static void TSLIsland::configure ( TSLTMC pointCoincidence = 0,
TSLTMC tmcPerVertexStrip = 6500 )
static

Internally, the island creation uses some highly optimised spatial algorithms. This method allows an application to tune some parameters of these algorithms.

The default values that are used if this method is not called are suitable for OS MasterMap with 1000 TMC per metre scaling.

Parameters
pointCoincidenceThis is the distance in TMC whereby points are considered the same. Default 0.
tmcPerVertexStripVertices are organised in horizontal strips for fast searching. This is the number of TMC for each vertex strip. The maximum number of vertex strips is 10000. Default value is 6500.

◆ contains()

bool TSLIsland::contains ( const TSLCoord & position) const

Returns True if the boundary contains the given position.

Parameters
positionThe position to query against.

◆ createIslands() [1/3]

static bool TSLIsland::createIslands ( const TSLStandardDataLayer * data,
TSLIslandSet & islands )
static

Static method that creates a set of islands from the supplied data layer.

Parameters
dataThe data layer from which we wish to extract islands.
islandsAn island set which will be populated with the islands that are created from the layer.
Returns
false if no islands were created or if some other error occurred, otherwise returns true.
Note
  1. Each island is given a unique ID. This is unique only for the duration of the application that calls this method.
  2. All entities within the supplied data layer are removed from the layer.
  3. If the input data contains no polygons, then no islands will be created.

◆ createIslands() [2/3]

static bool TSLIsland::createIslands ( TSLStandardDataLayer * data,
const char * mapName,
TSLSLMEntityRefHandler & mapRefHandler,
TSLIslandSet & islands )
static

Deprecated Functions

◆ createIslands() [3/3]

static bool TSLIsland::createIslands ( TSLStandardDataLayer * data,
TSLMapDataLayer * mapLayer,
TSLSLMEntityRefHandler & mapRefHandler,
TSLIslandSet & islands )
static

Static method that creates a set of islands from the supplied data layer for the given (seamless layer) map. The difference between this method and the other createIslands() method is that this method will attempt to preserve 'departed' features and also reconstruct their geometries (from the existing map).

Parameters
dataThe data layer from which we wish to extract islands.
mapLayerThe MapDataLayer which is associated with the islands.
mapRefHandlerThe entity-reference handler for the map.
islandsAn island set which will be populated with the islands that are created from the layer.
Returns

Returns false under the following conditions:

  1. If no map layer is specified.
  2. If the map cannot be found.
  3. If the map has no associated seamless layer configuration.
  4. If no islands were created or if some other error occurred.

Otherwise returns true.

Note
  1. Each island is given a unique ID. This is unique only for the duration of the application that calls this method.
  2. All entities within the supplied data layer are removed from the layer.
  3. The associated map must contain one or more seamless layers.
  4. If the input data contains no polygons, then no islands will be created.

◆ destroy()

void TSLIsland::destroy ( )

Deletes the object.

◆ extent()

const TSLEnvelope & TSLIsland::extent ( ) const

Returns the extent of the island. If the extent has not yet been calculated, then, if necessary, the data is loaded into the data layer and the layer queried for the extent.

◆ features()

const TSLStandardDataLayer * TSLIsland::features ( ) const

Returns the island features as a data layer. If the data layer has not yet been constructed, then it is constructed now and the data loaded.

◆ id() [1/2]

const char * TSLIsland::id ( ) const

Returns the unique ID of the layer.

◆ id() [2/2]

void TSLIsland::id ( const char * islandID)

Sets the unique ID of the island.

Parameters
islandIDA string representing the unique ID of the island.

◆ mergeIslands() [1/3]

static bool TSLIsland::mergeIslands ( const TSLIslandSet & islands,
const char * mapName,
TSLSLMEntityRefHandler & mapRefHandler,
TSLIslandMergeSet & mergedIslands,
bool replaceDepartedFeatures = true )
static

Static method that merges a set of islands. The difference between this method and the other mergeIslands() method is that this method will automatically update existing features with respect to version changes and it will also attempt to preserve 'departed' features.

Parameters
islandsThe input island set.
mapNameThe full path of the map which is associated with the islands.
mapRefHandlerThe entity-reference handler for the map.
mergedIslandsThe resulting set of merged islands.
replaceDepartedFeaturesIf true, departed features will have their geometry replaced with that of the original feature from the map. Default is true.
Returns
true if the merge was successful, false otherwise.

◆ mergeIslands() [2/3]

static bool TSLIsland::mergeIslands ( const TSLIslandSet & islands,
TSLIslandMergeSet & mergedIslands )
static

Static method that merges a set of islands. This is a purely geometrical merge.

Parameters
islandsThe input island set.
mergedIslandsThe resulting set of merged islands.
Returns
true if the merge was successful, false otherwise.

◆ mergeIslands() [3/3]

static bool TSLIsland::mergeIslands ( const TSLIslandSet & islands,
TSLStandardDataLayer * layer,
const char * mapName,
TSLSLMEntityRefHandler & mapRefHandler,
TSLIslandMergeSet & mergedIslands,
bool replaceDepartedFeatures = true )
static

Static method that merges a data layer with a set of islands. The difference between this method and the other mergeIslands() method is that this method will automatically update existing features with respect to version changes and it will also attempt to preserve 'departed' features.

Parameters
islandsThe input island set.
layerThe data layer.
mapNameThe full path of the map which is associated with the islands.
mapRefHandlerThe entity-reference handler for the map.
mergedIslandsThe resulting set of merged islands.
replaceDepartedFeaturesIf true, departed features will have their geometry replaced with that of the original feature from the map. Default is true.
Returns
true if the merge was successful, false otherwise.

◆ operator delete()

void TSLIsland::operator delete ( void * )

◆ operator new() [1/2]

void * TSLIsland::operator new ( size_t )

Allocation override for API redirection.

◆ operator new() [2/2]

void * TSLIsland::operator new ( size_t ,
char * ,
int  )

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=()

TSLIsland & TSLIsland::operator= ( const TSLIsland & rhs)

Assignment operator.

◆ sortDepartedFeatures()

static bool TSLIsland::sortDepartedFeatures ( TSLMapDataLayer * mapLayer,
TSLSLMEntityRefHandler & mapRefHandler,
TSLIslandSet & islands )
static

Static method that rearranges departed features present in the source islands as points into the correct island based on the location of the original feature in the map.

This method is intended for use after a call to createIslands(TSLStandardd DataLayer, TSLIslandSet) as this method does not correctly place these departed features in the resulting island set. This method can also be used to correctly place departed features in islands created by the other createIslands() method that are inside the island rather than having contiguous edges and so would otherwise be placed into a separate island.

No features will be deleted by this operation.

Parameters
mapLayerThe map layer that is associated with the islands.
mapRefHandlerThe entity reference handler for the map.
islandsAn island set containing the features to be reorganised.
Returns
true on success, or false on failure.