![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
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) |
TSLDataHandler * | createDataHandler (const char *config_file=0) |
TSLHistoryVersion | currentVersion () const |
TSLDataHandler * | dataHandler () |
const TSLDataHandler * | dataHandler () const |
void | destroy () |
bool | entityIsVisible (const TSLEntity *entity, const TSLDrawingSurface *drawingSurface) const |
const TSLFeatureClassList * | featureList () const |
const TSLFeatureClassList * | featureList (const char *detailLayerName) const |
bool | fileModificationTime (const char *filename, TSLTimeType &lastModificationTime) |
TSLEntity * | findEntity (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 |
TSLEntityIterator * | getEntityIterator (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 |
TSLFileLoader * | getLoader () |
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) |
TSLMapQuery * | query (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, int depth=-1, const char *featureName=NULL, int drawingSurfaceID=-1) const |
TSLMapQuery * | query (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, TSLSelector *selector, int drawingSurfaceID=-1) const |
const TSLCoordinateSystem * | getCoordinateSystem () 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 TSLVersionHistorySet * | versionHistory () const |
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.
drawingCallback | a user created TSLDataLayerDrawingCallback. |
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.
featureName | Feature class name to which the rendering style is applied. |
featureID | Numeric ID of feature class |
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
loader | Reference to loader to add. |
callback | Callback to be made when each tile has loaded. |
arg | User-defined argument, passed to application callback. |
allLoadedCallback | Callback to be made when map tiles have loaded following a draw. |
arg2 | User-defined argument, passed to application allLoaded callback. |
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.
path_list | Path 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. |
void TSLDataLayer::cancelFlashback | ( | ) |
Cancels the flashback.
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.
featureName | Feature class name to which the rendering style information is removed. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
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.
config_file | Name of the configuration file (if any) to use when creating the TSLDataHandler. |
config_file | TSLDatahandler. |
TSLHistoryVersion TSLDataLayer::currentVersion | ( | ) | const |
Returns the current version of the layer. The default value is 1.
TSLDataHandler * TSLDataLayer::dataHandler | ( | ) |
Returns a pointer to the data handler.
const TSLDataHandler * TSLDataLayer::dataHandler | ( | ) | const |
Returns a const pointer to the data handler.
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.
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.
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.
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.
detailLayerName | the detail layer name to use as a filter on the features. |
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.
filename | The name of the file. |
lastModificationTime | A reference to the modification time. |
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:
NOTE: When querying an Optimised map the query may return objects that can not be further analysed.
(x,y) | Co-ordinate of the location where to find the entity on the data layer. These co-ordinates are in internal TMC units. |
aperture | This specifies an extent around the location co-ordinate in which to search for the entity. This is in internal TMC units. |
depth | Specifies 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). |
featureName | If not NULL, the entity returned will be of this feature. |
drawingSurfaceID | ID 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. |
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.
filename | The name of the file to search for. |
foundPath | This will be populated with the path that the file is found at. |
void TSLDataLayer::flashbackToTimestamp | ( | TSLHistoryTimestamp | timestamp, |
TSLLayerArchiveCallback | archiveCallback, | ||
void * | arg = 0 ) |
Selects the version of the layer that is to be loaded.
timestamp | The timestamp at which the layer is required. |
archiveCallback | A callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated. |
arg | A user-defined argument that will be passed to the callback. |
void TSLDataLayer::flashbackToTimestamp | ( | TSLHistoryTimestamp | timestamp, |
TSLLayerArchiveTileCallback | archiveTileCallback, | ||
void * | arg = 0 ) |
Selects the version of the layer that is to be loaded.
timestamp | The timestamp at which the layer is required. |
archiveTileCallback | A callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated. |
arg | A user-defined argument that will be passed to the callback. |
void TSLDataLayer::flashbackToVersion | ( | TSLHistoryVersion | version, |
TSLLayerArchiveCallback | archiveCallback, | ||
void * | arg = 0 ) |
Selects the version of the layer that is to be loaded.
version | The version at which the layer is required. |
archiveCallback | A callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated. |
arg | A user-defined argument that will be passed to the callback. |
void TSLDataLayer::flashbackToVersion | ( | TSLHistoryVersion | version, |
TSLLayerArchiveTileCallback | archiveTileCallback, | ||
void * | arg = 0 ) |
Selects the version of the layer that is to be loaded.
version | The version at which the layer is required. |
archiveTileCallback | A callback which allows the application to provide the archive location of a layer. If this is 0, then the flashback will not be activated. |
arg | A user-defined argument that will be passed to the callback. |
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.
extent | extent of the area that is being queried |
screenResolution | The TMC units per Device Unit. |
activeLayerName | The layer name for the extent and screenResolution is returned in this parameter. |
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 returned by this method should not be modified. If you need to modify the coordinate system take a clone and modify the clone.
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.
detailLayer | the name of the detail layer to return entities from. |
selector | A selector to chose which entities are to be returned - if NULL then all entities are returned. |
extent | A TSLEnvelope within which to return entities - if NULL all entities are returned. |
splitOptimisedPrimitives | should Optimised Entities be split into primitives or not |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
result | Storage for returned rendering attribute values |
TSLFileLoader * TSLDataLayer::getLoader | ( | ) |
Returns either the loader added by addLoader or the default static loader. If no static loader exists it is created.
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.
(x1,y1) | Storage for bottom left co-ordinate of the extent. |
(x2,y2) | Storage for top right co-ordinate of the extent. |
drawingSurfaceID | ID 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. |
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.
(x1,y1) | Storage for bottom left co-ordinate of the extent. |
(x2,y2) | Storage for top right co-ordinate of the extent. |
drawingSurfaceID | ID 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. |
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.
(x1,y1) | Storage for bottom left co-ordinate of the extent. |
(x2,y2) | Storage for top right co-ordinate of the extent. |
drawingSurface | TSLDrawingSurface 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. |
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.
mapVersion | The version to use for the layer. |
timestamp | The timestamp to associate with this version. |
historySet | A list of tile history information to import into the map. |
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.
(latitude,longitude) | Point to convert. |
(x,y) | Storage for internal TMC co-ordinate. |
local | Indicates whether the latitude and longitude are in the local datum, or WGS84. |
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.
(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. |
local | Indicates whether the latitude and longitude are in the local datum, or WGS84. |
TSLDataLayerTypeEnum TSLDataLayer::layerType | ( | ) | const |
Returns the type of this TSLDataLayer. For more information see the documentation for the TSLDataLayerTypeEnum enumeration.
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.
filename | Name of the file from which to load the data. |
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.
filename | Name of the rendering data file. |
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.
changed | true (default), if layer contents have changed, false otherwise. |
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.
(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) |
depth | Specifies 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. |
featureName | If not NULL, only entities of this feature name will be checked. |
drawingSurfaceID | ID 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. |
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.
(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) |
selector | pointer to a TSLSelector-derived object which specifies the selection criteria. |
drawingSurfaceID | ID 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. |
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.
extent | The area that is being queried. |
history | The resulting version history for the area. |
void TSLDataLayer::refreshFlashback | ( | ) |
Refreshes the history information.
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).
surfaceID | A unique surface number. |
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.
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.
filename | Name of the rendering data file. |
ver | MapLink version to save as |
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
TSLKMLDataLayer behaviour differences
TSLDirectImportDataLayer behaviour differences
coordinateSystem | the TSLCoordinateSystem to use. A clone is taken of the coordinateSystem. If the parameter is NULL the current user set TSLCoordinateSystem is deleted. |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
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.
featureName | Name of feature class. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
value | New value for rendering attributes |
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.
(num) | Number of points to convert |
(xs,ys) | Arrays of internal TMC co-ordinates of the points to convert. |
latitudes | Storage for latitudes of the points. Should be large enough to hold num values. |
longitudes | Storage for longitudes of the points. Should be large enough to hold num values. |
local | Indicates whether the latitude and longitude are in the local datum, or WGS84. |
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.
(x,y) | Internal TMC co-ordinate of the point to convert. |
latitude | Storage for latitude of the point |
longitude | Storage for longitude of the point |
local | Indicates whether the latitude and longitude are in the local datum, or WGS84. |
boundCheck | If true, the function will fail if the calculated values are outside the valid Latitude/Longitude range |
const TSLVersionHistorySet * TSLDataLayer::versionHistory | ( | ) | const |
Queries the layer for its version history set.