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

Detailed Description

Collection of all entities used to make up a coherent set of data.

TSLDataLayer is an abstract class and so cannot be instantiated directly. Clients should instantiate one of its derived classes (e.g. TSLMapDataLayer).

Data layers should be destroyed by calling the destroy method rather than deleting them.

TSLDataLayer provides a mechanism by which historical versions of a layer can be viewed - this is termed 'flashback'. The methods flashbackToVersion() and flashbackToTimestamp() allow the user to look at historical versions of the layer based either on a version number or on a timestamp. When these methods are called, both the memory and persistent caches will be cleared.

Users can query whether a layer has any historical versions by calling the method versionHistory(). This returns an object that users can query for the number of versions. If it is empty it means that no archived versions of the layer exist. To revert to the current layer, simply call cancelFlashback(). If the data layer is being dynamically archived, then calling refreshFlashback() will refresh all internal memory structures and allow the newly archived versions to be available to the user.

When using either of the two flashbackTo...() methods, users must provide a callback function. MapLink will use the callback to ask for the location of the layer's archive at a particular version. This will then be cached until flashback is cancelled or refreshed. The directory that should be returned by the callback is the same directory that was used to create the archive originally. This will depend on the application that creates the original archive.

Public Member Functions

void addDrawingCallback (TSLDataLayerDrawingCallback *drawingCallback)
 
bool addFeatureRendering (const char *featureName, TSLFeatureID featureID)
 
bool addLoader (TSLFileLoader *loader, TSLLoaderAppCallback callback, void *arg, TSLAllLoadedCallback allLoadedCallback=0, void *arg2=0)
 
bool addPathList (const TSLPathList *path_list)
 
void cancelFlashback ()
 
bool clearFeatureRendering (const char *featureName, TSLFeatureID featureID)
 
TSLDataHandlercreateDataHandler (const char *config_file=0)
 
TSLHistoryVersion currentVersion () const
 
TSLDataHandlerdataHandler ()
 
const TSLDataHandlerdataHandler () const
 
void destroy ()
 
bool entityIsVisible (const TSLEntity *entity, const TSLDrawingSurface *drawingSurface) const
 
const TSLFeatureClassListfeatureList () const
 
const TSLFeatureClassListfeatureList (const char *detailLayerName) const
 
bool fileModificationTime (const char *filename, TSLTimeType &lastModificationTime)
 
TSLEntityfindEntity (TSLTMC x, TSLTMC y, TSLTMC aperture, int depth, const char *featureName=0, int drawingSurfaceID=-1)
 
bool findFile (const char *filename, TSLSimpleString &foundPath) const
 
void flashbackToTimestamp (TSLHistoryTimestamp timestamp, TSLLayerArchiveCallback archiveCallback, void *arg=0)
 
void flashbackToTimestamp (TSLHistoryTimestamp timestamp, TSLLayerArchiveTileCallback archiveTileCallback, void *arg=0)
 
void flashbackToVersion (TSLHistoryVersion version, TSLLayerArchiveCallback archiveCallback, void *arg=0)
 
void flashbackToVersion (TSLHistoryVersion version, TSLLayerArchiveTileCallback archiveTileCallback, void *arg=0)
 
bool getActiveLayerName (const TSLEnvelope &extent, double screenResolution, TSLSimpleString &activeLayerName) const
 
TSLEntityIteratorgetEntityIterator (const char *detailLayer, TSLSelector *selector=NULL, TSLEnvelope *extent=NULL, bool splitOptimisedPrimitives=true)
 
bool getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int *result) const
 
bool getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double *result) const
 
bool getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool *result) const
 
bool getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *result) const
 
TSLFileLoadergetLoader ()
 
bool getMUExtent (double *x1, double *y1, double *x2, double *y2, int drawingSurfaceID=-1) const
 
bool getTMCExtent (TSLTMC *x1, TSLTMC *y1, TSLTMC *x2, TSLTMC *y2, int drawingSurfaceID=-1) const
 
bool getUUExtent (double *x1, double *y1, double *x2, double *y2, const TSLDrawingSurface *drawingSurface) const
 
bool importHistory (TSLHistoryVersion mapVersion, TSLHistoryTimestamp timestamp, TSLHistoryImportSet *historySet)
 
bool latLongToTMC (double latitude, double longitude, TSLTMC *x, TSLTMC *y, bool local=false) const
 
bool latLongToTMC (int num, double *latitudes, double *longitudes, TSLTMC *xs, TSLTMC *ys, bool local=false) const
 
TSLDataLayerTypeEnum layerType () const
 
bool loadData (const char *filename)
 
bool loadRendering (const char *filename)
 
void notifyChanged (bool changed=true)
 
TSLMapQueryquery (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, int depth=-1, const char *featureName=NULL, int drawingSurfaceID=-1) const
 
TSLMapQueryquery (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, TSLSelector *selector, int drawingSurfaceID=-1) const
 
const TSLCoordinateSystemgetCoordinateSystem () const
 
bool queryVersionHistory (const TSLEnvelope &extent, TSLVersionHistorySet &history)
 
void refreshFlashback ()
 
bool removeData ()
 
void releaseResources (int surfaceID)
 
bool saveRendering (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION)
 
bool setCoordinateSystem (const TSLCoordinateSystem *coordinateSystem)
 
bool setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int value)
 
bool setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double value)
 
bool setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool value)
 
bool setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *value)
 
bool TMCToLatLong (TSLTMC x, TSLTMC y, double *latitude, double *longitude, bool local=false, bool boundCheck=true) const
 
bool TMCToLatLong (int num, TSLTMC *xs, TSLTMC *ys, double *latitudes, double *longitudes, bool local=false) const
 
const TSLVersionHistorySetversionHistory () const
 

Member Function Documentation

◆ addDrawingCallback()

void TSLDataLayer::addDrawingCallback ( TSLDataLayerDrawingCallback * drawingCallback)

Adds a TSLDataLayerDrawingCallback object to the layer. The user retains ownership of the callback object. Any existing callback object for this data layer is replaced.

Parameters
drawingCallbacka user created TSLDataLayerDrawingCallback.

◆ addFeatureRendering()

bool TSLDataLayer::addFeatureRendering ( const char * featureName,
TSLFeatureID featureID )

Adds feature rendering.

This method allows the user to add a new feature to the rendering list. If a rendering style for the feature name already exists, it will be cleared, otherwise a new style will be created.

When MapLink is rendering a feature, it first looks at whether the entity has an attribute set. If so, then it tries to apply that attribute set and render the entity. If not, then it uses the feature id of the entity to index into the rendering information loaded into the TSLDrawingSurface. If there is no rendering information in the TSLDrawingSurface, then it defaults to the rendering information stored with the TSLDataLayer.

If an entity has no attribute set or feature id, then the parent is recursively queried for attribute set and feature code.

If neither an entity, nor any of its parents have attribute sets or feature id, then the entity will not be rendered.

Parameters
featureNameFeature class name to which the rendering style is applied.
featureIDNumeric ID of feature class
Returns
true on success , false otherwise.

◆ addLoader()

bool TSLDataLayer::addLoader ( TSLFileLoader * loader,
TSLLoaderAppCallback callback,
void * arg,
TSLAllLoadedCallback allLoadedCallback = 0,
void * arg2 = 0 )

The application can provide a file loader for the data layer to use when loading data.

If 'addLoader' has not been called when a loader is needed, the data layer will create a FileLoaderBlocking.

If a loader is already instantiated, it will be replaced by the one provided.

Typically, 'addLoader' would be called to add a TSLFileLoaderMT so that an application can load data in a background thread whilst continuing to respond to user input, or a TSLFileLoaderRemote so that an application can load data from an internet server.

If 'addLoader' is called, the data layer takes a reference to the loader but does not take ownership of it. The loader could be added to many data layers as well as the surface. The application must ensure that the loader remains in existence while the layer has a reference to it, and the application must delete the loader when it is no longer needed.

But if the layer creates a TSLFileLoaderBlocking because no loader was added, the surface will own the loader and will delete it when necessary. In fact, all data layers share a single static loader which is created when first needed and destroyed when no longer needed.

The application may add a callback which is called when each tile loads.

The application may also provide an "allLoaded" callback to be called after every draw of a map data layer when all required tiles have been loaded. If all required tiles are already loaded in the cache then the callback will not be called.

NOTE: Both callbacks may be issued from a background thread within MapLink. The user must ensure that they are handled in a thread-safe manner.

NOTE: The following data layers do not currently use loaders, and will load data directly from files on disk:

NOTE: The TSLWMSDataLayer may only have a TSLFileLoaderRemote associated with it. Attempting to set a file loader of a different type will fail

Parameters
loaderReference to loader to add.
callbackCallback to be made when each tile has loaded.
argUser-defined argument, passed to application callback.
allLoadedCallbackCallback to be made when map tiles have loaded following a draw.
arg2User-defined argument, passed to application allLoaded callback.
Returns
true if successful.

◆ addPathList()

bool TSLDataLayer::addPathList ( const TSLPathList * path_list)

Adds a TSLPathList object to the TSLDataLayer.

When a TSLDataLayer requires any files it will search the directory list built by the user and specified by the TSLPathList object.

In the case of the MapDataLayer, an internal pathlist may also be created by loadData.

A subsequent call to this method will replace the previous TSLPathList added to the TSLDataLayer. Therefore the TSLDataLayer will use the new added TSLPathList to search for the files required.

Note: a single TSLPathList object may be used by a number of TSLDataLayers.

Parameters
path_listPath list object to be added to the TSLDataLayer. The class retains a pointer to the pathlist but does not take ownership of it. The user must delete it when no longer needed.
Returns
true on success, false otherwise.

◆ cancelFlashback()

void TSLDataLayer::cancelFlashback ( )

Cancels the flashback.

◆ clearFeatureRendering()

bool TSLDataLayer::clearFeatureRendering ( const char * featureName,
TSLFeatureID featureID )

Clear feature rendering.

This method removes the rendering style information that has been previously set for a given feature, by one of the 'setFeatureRendering' methods.

When MapLink is rendering a feature, it first looks at whether the entity has an attribute set. If so, then it tries to apply that attribute set and render the entity. If not, then it uses the feature id of the entity to index into the rendering information loaded into the drawing surface. If there is no rendering information in the drawing surface, then it defaults to the rendering information stored with the map.

If an entity has no attribute set or feature id, then the parent is recursively queried for attribute set and feature code.

If neither an entity, nor any of its parents have attribute sets or feature id, then the entity will not be rendered.

Parameters
featureNameFeature class name to which the rendering style information is removed. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
Returns
true on success, false otherwise.

◆ createDataHandler()

TSLDataHandler * TSLDataLayer::createDataHandler ( const char * config_file = 0)

Creates a default TSLDataHandler object for use with entities contained by this TSLDataLayer.

If the TSLDataLayer refers to a map the information from the map will determine the information required to create the TSLDataHandler. Otherwise a configuration file must be provided to create the default TSLDataHandler.

The TSLDataHandler is required to access any entity specific data which is held externally from the entity in memory.

Parameters
config_fileName of the configuration file (if any) to use when creating the TSLDataHandler.
Parameters
config_fileTSLDatahandler.

◆ currentVersion()

TSLHistoryVersion TSLDataLayer::currentVersion ( ) const

Returns the current version of the layer. The default value is 1.

◆ dataHandler() [1/2]

TSLDataHandler * TSLDataLayer::dataHandler ( )

Returns a pointer to the data handler.

◆ dataHandler() [2/2]

const TSLDataHandler * TSLDataLayer::dataHandler ( ) const

Returns a const pointer to the data handler.

◆ destroy()

void TSLDataLayer::destroy ( )

Destroy method for general data layers. This should be called rather than deleting the data layer, since the calls are redirected internally to MapLink.

◆ entityIsVisible()

bool TSLDataLayer::entityIsVisible ( const TSLEntity * entity,
const TSLDrawingSurface * drawingSurface ) const

Returns whether the given entity from this data layer will be drawn given the entity's rendering attributes and the current configuration of the drawing surface. For this method to return the correct result the following conditions should be true:

1) The entity should have been retrieved from this data layer. 2) This data layer should have already been added to the given drawing surface.

Returns true if the entity will be drawn, false otherwise. Note that the current view extent of the drawing surface is not considered as part of this function, so this method will still return true if the position of the entity is outside this extent.

◆ featureList() [1/2]

const TSLFeatureClassList * TSLDataLayer::featureList ( ) const

Query feature list associated with TSLDataLayer.

This method returns a read-only pointer to the TSLFeatureClassList attached to the TSLDataLayer. This is embedded within the TSLDataLayer and should not be destroyed by the user. The TSLFeatureClassList gives a mapping between a feature name and a numeric feature ID.

For TSLMapDataLayers, the feature list is defined by the currently loaded map. When the MapLink Processing Tool creates a '.map' file, it embeds within it the feature classes of the actual features that are within the map.

For TSLStandardDataLayers, the feature list must be created by the user using the 'addFeature' method.

Returns clone of TSLFeatureClassList, NULL on error.

◆ featureList() [2/2]

const TSLFeatureClassList * TSLDataLayer::featureList ( const char * detailLayerName) const

Query feature list associated with TSLDataLayer.

This has the same functionality as the method of the same name which does not take a parameter, but allows the user to pass in a detail layer name, and so only returns a feature class list detailing those features in the given layer.

Parameters
detailLayerNamethe detail layer name to use as a filter on the features.

◆ fileModificationTime()

bool TSLDataLayer::fileModificationTime ( const char * filename,
TSLTimeType & lastModificationTime )

Query for the time of the last modification to the given file. If a loader has been added to the layer then that is used, otherwise a blocking loader is created.

If a pathlist has been added to the layer then it is used, otherwise the filename must be fully qualified. In the case of the MapDataLayer, an internal pathlist may also exist, created by loadData; if so then any pathlist added is tried first and then the internal one.

Parameters
filenameThe name of the file.
lastModificationTimeA reference to the modification time.
Returns
true if the time could be discovered, false otherwise.

◆ findEntity()

TSLEntity * TSLDataLayer::findEntity ( TSLTMC x,
TSLTMC y,
TSLTMC aperture,
int depth,
const char * featureName = 0,
int drawingSurfaceID = -1 )

Find nearest entity to a position.

This method allows the user to retrieve an entity from a data layer according to a location. The entity search can be refined by setting the last parameter in the argument list to a valid feature name. In this case an entity will be returned only if it belongs to the named feature.

The TSLEntity returned is embedded within the tile so should not be destroyed by the user unless it is not required. Note that an entity deleted from a MapDataLayer tile may be reloaded when the tile is removed from the cache.

The search algorithm is as follows:

  • Iterate across visible, selectable entities in reverse order (ie. from topmost to bottommost)
  • For map layers, the detail layer that would be used for drawing the aperture extent is used
  • All entities whose last rendered extent overlaps the aperture extent are analysed further
    • If a feature name is specified, only entities of that feature name are considered
    • The analysis goes no deeper into the Entity Set hierarchy than specified below
    • These entities have the distance to the selection point calculated
      • If the point is within a polygon, the distance to the polygon is 0.
      • If the point is within the last rendered extent of a text or symbol entity, the distance to that entity is 0
    • If the distance is within the aperture distance then the entity is considered a candidate
    • If any candidate entities are found, then the closest entity in list is returned
    • Note:
      • No check is made for entities being decluttered
      • Entities drawn last have priority

NOTE: When querying an Optimised map the query may return objects that can not be further analysed.

Parameters
(x,y)Co-ordinate of the location where to find the entity on the data layer. These co-ordinates are in internal TMC units.
apertureThis specifies an extent around the location co-ordinate in which to search for the entity. This is in internal TMC units.
depthSpecifies how deep to look before returning a pointer to an object. If the depth is 0 it searches at the highest level in the model (that is it will return a Group rather than an entity within the Group).
featureNameIf not NULL, the entity returned will be of this feature.
drawingSurfaceIDID of drawing surface to use when querying entity extents. This is required when multiple drawingSurfaces are in use and when non-default drawing surface ID's have been used. If the default is used then the extents of symbol and text objects may be defaulted to their origin point. This also has an effect on groups containing such entities.
Returns
a pointer to a TSLEntity if found, NULL otherwise.

◆ findFile()

bool TSLDataLayer::findFile ( const char * filename,
TSLSimpleString & foundPath ) const

Search for a file. If a loader has been added to the layer then that is used, otherwise a blocking loader is created.

If a pathlist has been added to the layer then it is used, otherwise the filename must be fully qualified. In the case of the MapDataLayer, an internal pathlist may also exist, created by loadData; if so then any pathlist added is tried first and then the internal one.

Parameters
filenameThe name of the file to search for.
foundPathThis will be populated with the path that the file is found at.
Returns
true if the full path is found, false otherwise.

◆ flashbackToTimestamp() [1/2]

void TSLDataLayer::flashbackToTimestamp ( TSLHistoryTimestamp timestamp,
TSLLayerArchiveCallback archiveCallback,
void * arg = 0 )

Selects the version of the layer that is to be loaded.

Parameters
timestampThe timestamp at which the layer is required.
archiveCallbackA callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated.
argA user-defined argument that will be passed to the callback.
Note
  1. This call has no effect if no map data has been loaded. Call loadData() before calling flashback().
  2. Both the memory and persistent caches will be cleared.

◆ flashbackToTimestamp() [2/2]

void TSLDataLayer::flashbackToTimestamp ( TSLHistoryTimestamp timestamp,
TSLLayerArchiveTileCallback archiveTileCallback,
void * arg = 0 )

Selects the version of the layer that is to be loaded.

Parameters
timestampThe timestamp at which the layer is required.
archiveTileCallbackA callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated.
argA user-defined argument that will be passed to the callback.
Note
  1. This call has no effect if no map data has been loaded. Call loadData() before calling flashback().
  2. Both the memory and persistent caches will be cleared.

◆ flashbackToVersion() [1/2]

void TSLDataLayer::flashbackToVersion ( TSLHistoryVersion version,
TSLLayerArchiveCallback archiveCallback,
void * arg = 0 )

Selects the version of the layer that is to be loaded.

Parameters
versionThe version at which the layer is required.
archiveCallbackA callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated.
argA user-defined argument that will be passed to the callback.
Note
  1. This call has no effect if no map data has been loaded. Call loadData() before calling flashback().
  2. Both the memory and persistent caches will be cleared.

◆ flashbackToVersion() [2/2]

void TSLDataLayer::flashbackToVersion ( TSLHistoryVersion version,
TSLLayerArchiveTileCallback archiveTileCallback,
void * arg = 0 )

Selects the version of the layer that is to be loaded.

Parameters
versionThe version at which the layer is required.
archiveTileCallbackA callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated.
argA user-defined argument that will be passed to the callback.
Note
  1. This call has no effect if no map data has been loaded. Call loadData() before calling flashback().
  2. Both the memory and persistent caches will be cleared.

◆ getActiveLayerName()

bool TSLDataLayer::getActiveLayerName ( const TSLEnvelope & extent,
double screenResolution,
TSLSimpleString & activeLayerName ) const

This method is called when the Drawing Surface needs to know what active layer the application will be drawing for a given extent and drawing surface resolution.

The activeLayerName is basically a name given to a particular level of data (detail layer) being displayed, for example;

if you have several different scales to display with different data, you would return a different name for each scale (detail layer).

This allows the drawing surface the ability to detect when it needs to throw away any cached detail-layer specific tile data. This affects the Accelerator and 3D drawing surfaces.

Parameters
extentextent of the area that is being queried
screenResolutionThe TMC units per Device Unit.
activeLayerNameThe layer name for the extent and screenResolution is returned in this parameter.
Returns
, true ok, false if we fail.

◆ getCoordinateSystem()

const TSLCoordinateSystem * TSLDataLayer::getCoordinateSystem ( ) const

Query for the coordinate system used by this layer to convert between map units and lat/long.

This method requests the TSLDataLayer to return a TSLCoordinateSystem object which allows the user to access information concerning the transforms used to create the map.

The method has slightly different behaviour depending on which type of TSLDataLayer derived class the layer is. Typically this method will return the coordinate system of any data loaded into the layer.

Some layers allow the application to set a coordinate system, which will affect how the data is displayed within the drawing surface.

The behaviour of this method when called for a TSLMapDataLayer is as follows:

  • The TSLCoordinateSystem is only valid as long as no new map has been loaded into the layer since last obtaining the component.
  • If runtime projection is in use, this will be the same object as returned from queryRuntimeCoordinateSystem() on the TSLMapDataLayer.
  • If runtime projection is not in use, this will be the same object as returned from queryMapCoordinateSystem().

The TSLCoordinateSystem returned by this method should not be modified. If you need to modify the coordinate system take a clone and modify the clone.

Returns
The TSLCoordinateSystem of the data, or as set by the user. NULL is returned to indicate that the layer does not have a TSLCoordinateSystem.

◆ getEntityIterator()

TSLEntityIterator * TSLDataLayer::getEntityIterator ( const char * detailLayer,
TSLSelector * selector = NULL,
TSLEnvelope * extent = NULL,
bool splitOptimisedPrimitives = true )

This method returns a TSLEntityIterator which allows a user to iterate through the entities in a layer.

Parameters
detailLayerthe name of the detail layer to return entities from.
selectorA selector to chose which entities are to be returned - if NULL then all entities are returned.
extentA TSLEnvelope within which to return entities - if NULL all entities are returned.
splitOptimisedPrimitivesshould Optimised Entities be split into primitives or not
Returns
an iterator. If the returned value is NULL then this concept is not supported by the layer.

◆ getFeatureRendering() [1/4]

bool TSLDataLayer::getFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeBool attribute,
bool * result ) const

Gets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to get
resultStorage for returned rendering attribute value
Returns
true if rendering attribute successfully read and stored in result, false otherwise.

◆ getFeatureRendering() [2/4]

bool TSLDataLayer::getFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeDouble attribute,
double * result ) const

Gets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to get
resultStorage for returned rendering attribute value
Returns
true if rendering attribute successfully read and stored in result, false otherwise.

◆ getFeatureRendering() [3/4]

bool TSLDataLayer::getFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeInt attribute,
int * result ) const

Gets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to get
resultStorage for returned rendering attribute value
Returns
true if rendering attribute successfully read and stored in result, false otherwise.

◆ getFeatureRendering() [4/4]

bool TSLDataLayer::getFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributes * result ) const

Gets rendering for a specified feature class.

Where possible, it is more efficient for an application to use the featureID directly.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
resultStorage for returned rendering attribute values
Returns
true if rendering attributes successfully read and stored in result, false otherwise.

◆ getLoader()

TSLFileLoader * TSLDataLayer::getLoader ( )

Returns either the loader added by addLoader or the default static loader. If no static loader exists it is created.

◆ getMUExtent()

bool TSLDataLayer::getMUExtent ( double * x1,
double * y1,
double * x2,
double * y2,
int drawingSurfaceID = -1 ) const

Queries the Map Unit extent of the layer.

This method requests the full extent of the area covered by the TSLDataLayer.

Parameters
(x1,y1)Storage for bottom left co-ordinate of the extent.
(x2,y2)Storage for top right co-ordinate of the extent.
drawingSurfaceIDID of drawing surface to use when querying entity extents. If the default is used then the extents of symbol and text objects may be defaulted to their origin point. This also has an effect on groups containing such entities.
Returns
If the layer is not a coordinate providing layer (e.g. if the layer is a TSLStandardDataLayer) or has no data loaded, this method false.

◆ getTMCExtent()

bool TSLDataLayer::getTMCExtent ( TSLTMC * x1,
TSLTMC * y1,
TSLTMC * x2,
TSLTMC * y2,
int drawingSurfaceID = -1 ) const

Query for TMC extent of data.

This method requests the full extent of the area covered by the TSLDataLayer. The returned values will be in internal TMC co-ordinates.

Parameters
(x1,y1)Storage for bottom left co-ordinate of the extent.
(x2,y2)Storage for top right co-ordinate of the extent.
drawingSurfaceIDID of drawing surface to use when querying entity extents. If the default is used then the extents of symbol and text objects may be defaulted to their origin point. This also has an effect on groups containing such entities.
Returns
true if successful, false if no data is loaded.

◆ getUUExtent()

bool TSLDataLayer::getUUExtent ( double * x1,
double * y1,
double * x2,
double * y2,
const TSLDrawingSurface * drawingSurface ) const

Query extent in user units.

This method requests the full extent of the area covered by the TSLDataLayer. The returned values will be in user units.

Parameters
(x1,y1)Storage for bottom left co-ordinate of the extent.
(x2,y2)Storage for top right co-ordinate of the extent.
drawingSurfaceTSLDrawingSurface to which the Data Layer is attached. This is necessary since each drawingSurface that the Data Layer is attached to may have different User Unit specifications.
Returns
true if successful, false if no data is loaded.

◆ importHistory()

bool TSLDataLayer::importHistory ( TSLHistoryVersion mapVersion,
TSLHistoryTimestamp timestamp,
TSLHistoryImportSet * historySet )

This method allows importing of history into a map without the associated import of data. This means that map versions and their corresponding timestamps can be added and retrieved via the vesionHistory and queryVersionHistory methods without needing to update the contents of the map and checkpoint each version.

Calling this method multiple times for the same version will append the additional information to any existing history information.

Parameters
mapVersionThe version to use for the layer.
timestampThe timestamp to associate with this version.
historySetA list of tile history information to import into the map.

◆ latLongToTMC() [1/2]

bool TSLDataLayer::latLongToTMC ( double latitude,
double longitude,
TSLTMC * x,
TSLTMC * y,
bool local = false ) const

Convert from latitude/longitude to internal TMC co-ordinate.

This operation will use the current Coordinate System to perform the conversion. This will usually be defined only for TSLMapDatalayers.

Parameters
(latitude,longitude)Point to convert.
(x,y)Storage for internal TMC co-ordinate.
localIndicates whether the latitude and longitude are in the local datum, or WGS84.
Returns
true on success, false otherwise.

◆ latLongToTMC() [2/2]

bool TSLDataLayer::latLongToTMC ( int num,
double * latitudes,
double * longitudes,
TSLTMC * xs,
TSLTMC * ys,
bool local = false ) const

Convert from latitude/longitude to internal TMC co-ordinates.

This operation will use the current Coordinate System to perform the conversion. This will usually be defined only for TSLMapDatalayers.

Parameters
(num)Number of points to convert
(latitudes,longitudes)Arrays of points to convert.
(xs,ys)Storage array for internal TMC co-ordinates. The arrays should be large enough to hold num elements.
localIndicates whether the latitude and longitude are in the local datum, or WGS84.
Returns
true if all co-ordinates successfully transformed, false otherwise.

◆ layerType()

TSLDataLayerTypeEnum TSLDataLayer::layerType ( ) const

Returns the type of this TSLDataLayer. For more information see the documentation for the TSLDataLayerTypeEnum enumeration.

◆ loadData()

bool TSLDataLayer::loadData ( const char * filename)

Load data from a file for the TSLDataLayer. The filename should either be fully qualified or should be found using a pathlist added with addPathList.

If data is already loaded into this TSLDataLayer then it will be removed from memory and all references to it deleted.

For a TSLMapDataLayer, the file should be a '.map' file, usually generated by the MapLink Processing Tool. If no pathlist has been added with addPathList, then an internal pathlist is created, initialised to the root path of the map file given, and will be used to find map data. It is initialised from the pathlist file associated with the map file, if present. In this case, the palette file associated with the map will also be loaded.

For a TSLStandardDataLayer, the file should be a '.tmf' file.

For a TSLDirectImportDataLayer this method will return false. Files must first be analysed using TSLDirectImportDataLayer::createDataSets and may then be loaded through TSLDirectImportDataLayer::loadData.

Parameters
filenameName of the file from which to load the data.
Returns
true on success , false otherwise.

◆ loadRendering()

bool TSLDataLayer::loadRendering ( const char * filename)

Load feature rendering file. The filename should either be fully qualified or should be found using a pathlist added with addPathList.

This method allows the user to load a set of rendering data from a given file. Each TSLDataLayer may, optionally, render data types in different ways from another TSLDataLayer.

When MapLink is rendering a feature, it first looks at whether the entity has an attribute set. If so, then it tries to apply that attribute set and render the entity. If not, then it uses the feature id of the entity to index into the rendering information loaded into the TSLDrawingSurface. If there is no rendering information in the TSLDrawingSurface, then it defaults to the rendering information stored with the TSLDataLayer.

If an entity has no attribute set or feature id, then the parent is recursively queried for attribute set and feature code.

If neither an entity, nor any of its parents have attribute sets or feature id, then the entity will not be rendered.

Parameters
filenameName of the rendering data file.
Returns
true if file successfully loaded, false otherwise.

◆ notifyChanged()

void TSLDataLayer::notifyChanged ( bool changed = true)

Notifies the data layer that its contents have been changed.

If the data layer contents change (e.g. objects move in a TSLObjectDataLayer) then by calling this method, clients will ensure that a subsequent 'draw' on the drawing surface will force the updated contents to be correctly displayed.

Parameters
changedtrue (default), if layer contents have changed, false otherwise.

◆ query() [1/2]

TSLMapQuery * TSLDataLayer::query ( TSLTMC x1,
TSLTMC y1,
TSLTMC x2,
TSLTMC y2,
int depth = -1,
const char * featureName = NULL,
int drawingSurfaceID = -1 ) const

Query for entities in extent.

The detail layer used is chosen by the TSLMapDataLayer, based on the extent.

This method requests the TSLDataLayer to return a TSLMapQuery object which allows the user to access the data tiles required for the display of the specified area. The TSLMapQuery for a TSLDataLayer is only valid for immediate use since the data tiles to which they refer may be removed from memory if the cache is flushed.

In the default case, all tiles whose extent intersects the specified extent will be returned. These will include all entities within those tiles, even though some individual entities may not be within the extent.

Alternatively, if a depth is specified, then the query recurses into the tiles and returns only those individual entities that intersect the region. An optional feature name may also be specified.

Please note: The query function will not flush the cache if the cache limit is exceeded. Thus, if you are performing repetitive queries in a tight loop, where each query is requesting a different geographic region and returning large amounts of data, it is recommended to periodically call clearCache() yourself to ensure that the cache limit is not exceeded. Failure to do so may result in out of memory in extreme cases.

Parameters
(x1,y1)The bottom left co-ordinate of the specified area (in internal TMC units)
(x2,y2)the top right co-ordinate of the specified area (in internal TMC units)
depthSpecifies how deep to look before returning a pointer to an object. If the depth is -1, then all entities are returned. If the depth is 0 it searches at the highest level in the tile (that is it may return a Group rather than an entity within the Group). Pass a large number, such as 9999, if individual entities are required.
featureNameIf not NULL, only entities of this feature name will be checked.
drawingSurfaceIDID of drawing surface to use when querying entity extents. This is required when multiple drawingSurfaces are in use and when non-default drawing surface ID's have been used. If the default is used then the extents of symbol and text objects may be defaulted to their origin point. This also has an effect on groups containing such entities.
Returns
a pointer to a TSLMapQuery object. If NULL, it indicates that no tiles were found for the specified area.

◆ query() [2/2]

TSLMapQuery * TSLDataLayer::query ( TSLTMC x1,
TSLTMC y1,
TSLTMC x2,
TSLTMC y2,
TSLSelector * selector,
int drawingSurfaceID = -1 ) const

Query for entities in extent based on a client-supplied search criteria.

The detail layer used is chosen by the TSLMapDataLayer, based on the extent.

This method requests the TSLDataLayer to return a TSLMapQuery object which allows the user to access the data tiles required for the display of the specified area. The TSLMapQuery for a TSLDataLayer is only valid for immediate use since the data tiles to which they refer may be removed from memory if the cache is flushed.

The client must specify the selection policy through a suitable TSLSelector-derived object.

NOTE: When querying an Optimised map the query may return objects that can not be further analysed.

Please note: The query function will not flush the cache if the cache limit is exceeded. Thus, if you are performing repetitive queries in a tight loop, where each query is requesting a different geographic region and returning large amounts of data, it is recommended to periodically call clearCache() yourself to ensure that the cache limit is not exceeded. Failure to do so may result in out of memory in extreme cases.

Parameters
(x1,y1)The bottom left co-ordinate of the specified area (in internal TMC units)
(x2,y2)the top right co-ordinate of the specified area (in internal TMC units)
selectorpointer to a TSLSelector-derived object which specifies the selection criteria.
drawingSurfaceIDID of drawing surface to use when querying entity extents. This is required when multiple drawingSurfaces are in use and when non-default drawing surface ID's have been used. If the default is used then the extents of symbol and text objects may be defaulted to their origin point. This also has an effect on groups containing such entities.
Returns
the query results.

◆ queryVersionHistory()

bool TSLDataLayer::queryVersionHistory ( const TSLEnvelope & extent,
TSLVersionHistorySet & history )

Queries the version history for the given area.

For each tile that overlaps the given area, query its version history. If the associated change area overlaps the given area, add the history to the given version history set.

Parameters
extentThe area that is being queried.
historyThe resulting version history for the area.
Returns
true if the change area has any history, false otherwise.

◆ refreshFlashback()

void TSLDataLayer::refreshFlashback ( )

Refreshes the history information.

◆ releaseResources()

void TSLDataLayer::releaseResources ( int surfaceID)

This method is for use when an Optimised Drawing Surface is used (future capability).

This method should be called when the Drawing Surface invalidates its native drawing resources.

This method only needs to be called if the layer is contained by a class which has been derived from TSLClientCustomDataLayer.

This method does not need to be called if the layer has been added to a drawing surface or the layer has not been used for drawing.

The user should call this method from the TSLClientCustomDataLayer::releaseResources method passing through the surfaceID.

The method should only be called from the same thread the Drawing Surface is being used in (Graphics API context issues).

Parameters
surfaceIDA unique surface number.

◆ removeData()

bool TSLDataLayer::removeData ( )

This method allows the user to remove data from memory.

Clears all data attached to this TSLDataLayer, rendition classes etc.

Returns true on success , false otherwise.

◆ saveRendering()

bool TSLDataLayer::saveRendering ( const char * filename,
TSLMapLinkVersion ver = TSL_CURRENT_MAPLINK_VERSION )

Save rendering file.

This method allows any rendering information that the user has set up for a TSLDataLayer to be saved to the specified file.

Parameters
filenameName of the rendering data file.
verMapLink version to save as
Returns
true on success , false otherwise.

◆ setCoordinateSystem()

bool TSLDataLayer::setCoordinateSystem ( const TSLCoordinateSystem * coordinateSystem)

The method setCoordinateSystem sets the TSLCoordinateSystem on the layer for use by the coordinate conversion methods.

The method can not set a TSLCoordinateSystem on a layer that has one automatically created, such as a TSLMapDataLayer.

The TSLCoordinateSystem that is set via this method is not currently saved when the layer is saved.

TSLFilterDataLayer behaviour differences

  • The method sets the output coordinate system to use to project the data loaded on the data layer.
  • By passing NULL to this method then the default coordinate system will be used.
  • Changing the output coordinate system will cause all display items to require re-processing.

TSLKMLDataLayer behaviour differences

  • Coordinates in KML are stored as latitude/longitude/altitude, and must be converted on load in order to display correctly on top of a coordinate providing layer.
  • Because of this, the layer must have a coordinate system before loading any data.
  • The layer will use this coordinate system if present, or if not will use the coordinate system from the drawing surface.

TSLDirectImportDataLayer behaviour differences

  • All data loaded into the layer will be reprojected into this coordinate system before it is displayed.
  • This coordinate system may only be set once. To change it the application must create a new TSLDirectImportDataLayer.
  • The provided coordinate system must have an appropriate TMC per MU value set.
    • For coordinate systems in meters, 50 TMC per MU is recommended.
    • For coordinate systems in lat/lon, 5,000,000 TMC per MU is recommended.
Parameters
coordinateSystemthe TSLCoordinateSystem to use. A clone is taken of the coordinateSystem. If the parameter is NULL the current user set TSLCoordinateSystem is deleted.
Returns
true if the coordinateSystem has been set, false otherwise.

◆ setFeatureRendering() [1/4]

bool TSLDataLayer::setFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeBool attribute,
bool value )

Sets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to set
valueNew value for rendering attribute
Returns
true if rendering attribute successfully set, false otherwise.

◆ setFeatureRendering() [2/4]

bool TSLDataLayer::setFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeDouble attribute,
double value )

Sets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to set
valueNew value for rendering attribute
Returns
true if rendering attribute successfully set, false otherwise.

◆ setFeatureRendering() [3/4]

bool TSLDataLayer::setFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributeInt attribute,
int value )

Sets rendering for a specified feature class.

For further information about the attributes available, see the setRendering methods on TSLEntity.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
attributeType of rendering attribute to set
valueNew value for rendering attribute
Returns
true if rendering attribute successfully set, false otherwise.

◆ setFeatureRendering() [4/4]

bool TSLDataLayer::setFeatureRendering ( const char * featureName,
TSLFeatureID featureID,
TSLRenderingAttributes * value )

Sets rendering for a specified feature class.

Where possible, it is more efficient for an application to use the featureID directly.

Parameters
featureNameName of feature class. NULL means use featureID.
featureIDNumeric ID of feature class as stored in TSLEntity::featureID
valueNew value for rendering attributes
Returns
true if rendering attributes successfully set, false otherwise.

◆ TMCToLatLong() [1/2]

bool TSLDataLayer::TMCToLatLong ( int num,
TSLTMC * xs,
TSLTMC * ys,
double * latitudes,
double * longitudes,
bool local = false ) const

Converts set of points from internal TMC co-ordinate to latitude/longitude.

This operation will use the current Coordinate System to perform the conversion. This will usually be defined only for TSLMapDatalayers.

Parameters
(num)Number of points to convert
(xs,ys)Arrays of internal TMC co-ordinates of the points to convert.
latitudesStorage for latitudes of the points. Should be large enough to hold num values.
longitudesStorage for longitudes of the points. Should be large enough to hold num values.
localIndicates whether the latitude and longitude are in the local datum, or WGS84.
Returns
true if all co-ordinates are successfully transformed, false otherwise.

◆ TMCToLatLong() [2/2]

bool TSLDataLayer::TMCToLatLong ( TSLTMC x,
TSLTMC y,
double * latitude,
double * longitude,
bool local = false,
bool boundCheck = true ) const

Convert from internal TMC co-ordinate to latitude/longitude.

This operation will use the current Coordinate System to perform the conversion. This will usually be defined only for TSLMapDatalayers.

Parameters
(x,y)Internal TMC co-ordinate of the point to convert.
latitudeStorage for latitude of the point
longitudeStorage for longitude of the point
localIndicates whether the latitude and longitude are in the local datum, or WGS84.
boundCheckIf true, the function will fail if the calculated values are outside the valid Latitude/Longitude range
Returns
true on success, false otherwise.

◆ versionHistory()

const TSLVersionHistorySet * TSLDataLayer::versionHistory ( ) const

Queries the layer for its version history set.