![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
Specialist data layer for the display of MapLink maps generated via MapLink Studio.
The TSLStaticMapDataLayer is an alternative to the TSLMapDataLayer for use with the OpenGL drawing surface. It offers less advanced functionality than the TSLMapDataLayer, but in return gives significantly higher performance. The differences between this layer and the TSLMapDataLayer are summarised in the limitations section.
Map data is read-only and modification of this layer by the user is limited to changing the rendering of the entities within it.
The following capabilities are available through the TSLStaticMapDataLayer component:
The methods 'loadData' and 'removeData' (inherited from TSLDataLayer) allow complete maps to be loaded into and removed from the map layer.
Cache management is an important area for the map layer since it is not normally possible to hold a complete map in memory. The cache functions allows the user to fine tune the performance of a map layer by setting aside memory to hold recently accessed areas of the map so that they do not need to be loaded from disk when requested. The following cache properties are available:
Instances of this class should be destroyed using the destroy method.
This layer does not support runtime reprojection. It does however support realtime reprojection in conjunction with the TSLOpenGLSurface.
The following functionality offered by the TSLMapDataLayer is not available on this layer. Applications requiring these features should use the TSLMapataLayer instead:
Modifying the rendering of items in the data layer, e.g. by calling load Rendering or by modifying feature rendering on the layer may cause the layer to reload data from disk.
Range-based decluttering set on the layer through TSLDrawingSurface::setDeclutterRange is only evaluated for a tile the first time that tile is drawn, so features decluttered in this fashion will remain decluttered if they are decluttered the first time the tile that contains them is drawn regardless of subsequent changes to the view resolution.
This layer can not be shared between multiple TSLOpenGLSurface instances.
Public Member Functions | |
TSLStaticMapDataLayer () | |
void | drawCacheSize (unsigned int size) |
unsigned int | drawCacheSize () const |
void | clearDrawCache () |
void | clearQueryCache () |
bool | clearRuntimeProjection () |
TSLEntity * | findEntityID (TSLEntityID entityID, TSLSLMEntityRefHandler *handler) |
TSLStyleID | getBackgroundColour () const |
bool | getDetailLayerMUExtent (const char *layerName, double *x1, double *y1, double *x2, double *y2) const |
const char * | getDetailLayerName (int nth) const |
bool | getDetailLayerTMCExtent (const char *layerName, TSLTMC *x1, TSLTMC *y1, TSLTMC *x2, TSLTMC *y2) const |
bool | getLayerLoadingThreshold (const char *layerName, double *upperThreshold, double *lowerThreshold) const |
bool | getMUExtent (double *x1, double *y1, double *x2, double *y2) const |
int | getNumDetailLayers () const |
const char * | getOverviewLayer () const |
bool | getPaletteFilename (TSLSimpleString &filename) const |
bool | getPathlistFilename (TSLSimpleString &filename) const |
bool | getSynchronousLoading () const |
int | metadata (int pos, char **fileName) |
void | metadata (int sourceID, TSLSimpleString &filename) const |
int | metadataCount () const |
bool | MUToTMC (double x1, double y1, TSLTMC *x2, TSLTMC *y2) const |
void | queryCacheSize (unsigned int size) |
int | queryCacheSize () const |
const TSLCoordinateSystem * | queryCoordinateSystem () const |
const TSLCoordinateSystem * | queryMapCoordinateSystem () const |
TSLCoordinateSystem * | queryRuntimeCoordinateSystem () const |
bool | removeLayer (const char *layerName) |
bool | setLayerLoadingThreshold (const char *layerName, double upperThreshold, double lowerThreshold=0.0) |
void | setSynchronousLoading (bool synchronous) |
bool | setRuntimeProjection (const TSLCoordinateSystem *projection, double greatCircleDistance, TSLRuntimeProjectionChangedCallback callback, void *arg) |
bool | setRuntimeProjectionOrigin (double latitude, double longitude, TSLRuntimeProjectionChangedCallback callback, void *arg) |
double | TMCperMU () const |
bool | TMCToMU (TSLTMC x1, TSLTMC y1, double *x2, double *y2) const |
void * | operator new (size_t size) TSL_NO_THROW |
void * | operator new (size_t size, char *filename, int line) |
![]() | |
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 |
TSLStaticMapDataLayer::TSLStaticMapDataLayer | ( | ) |
void TSLStaticMapDataLayer::clearDrawCache | ( | ) |
Clears the tile cache used for drawing for this data layer.
This method requests the data layer to clear all cached data from memory. After a call to this method any draw operation involving the layer will re-load all required map data from its original location.
void TSLStaticMapDataLayer::clearQueryCache | ( | ) |
Clears the tile cache used for querying for this data layer.
This method requests the data layer to clear all cached data from memory. After a call to this method any query operation involving the layer will re-load all required map data from its original location.
bool TSLStaticMapDataLayer::clearRuntimeProjection | ( | ) |
Clears any runtime projection set with 'setRuntimeProjection'.
Returns true on success, false otherwise.
unsigned int TSLStaticMapDataLayer::drawCacheSize | ( | ) | const |
Query the amount of memory that the drawing cache may currently use, in kilobytes.
void TSLStaticMapDataLayer::drawCacheSize | ( | unsigned int | size | ) |
Sets maximum size of the tile cache used for drawing.
This method allows the user to set the amount of memory that the tile cache can use. To operate more efficiently the data layer holds data in memory so that it does not need to reload data from disk every time a draw request is made. The larger the cache size, the more data can be held in memory and draw requests are handled much more efficiently. However the client application must find a compromise between a large cache size and the memory requirements of the application itself.
The default tile cache is 32Mb (32768 KB)
size | Size of the cache in kilobytes. |
TSLEntity * TSLStaticMapDataLayer::findEntityID | ( | TSLEntityID | entityID, |
TSLSLMEntityRefHandler * | handler ) |
Find an entity in a seamless layer, given its ID.
This method returns a pointer to the first visible, selectable entity matching the given ID, If the map does not contain a seamless layer or if no such entity exists in the seamless layer, NULL is returned.
Entities are marked as visible or selectable via TSLRenderingAttributeVisible and TSLRenderingAttributeSelectable.
entityID | the entity ID |
handler | the entity reference handler |
The entity reference handler must be configured appropriately otherwise this method will return NULL; in particular, if the handler has no associated seamless configuration object, then NULL will be returned.
TSLStyleID TSLStaticMapDataLayer::getBackgroundColour | ( | ) | const |
This method returns the background colour index for the loaded map.
Returns the background colour index of the map or -1 if the colour is not defined. The return value will either be a colour index or a composed RGB value. See tslcolourhelper.h for information on determining the type and in the case of an RGB value uncomposing it back into its respective components.
bool TSLStaticMapDataLayer::getDetailLayerMUExtent | ( | const char * | layerName, |
double * | x1, | ||
double * | y1, | ||
double * | x2, | ||
double * | y2 ) const |
Query extent of detail layer.
This method allows the user to get the extent of a particular detail layer of the map. The extent returned is in Map Unit co-ordinates.
layerName | Layer for which the extent are returned |
(x1,y1) | Storage for bottom left corner |
(x2,y2) | Storage for top right corner |
const char * TSLStaticMapDataLayer::getDetailLayerName | ( | int | nth | ) | const |
This method returns name of the 'nth' detail layer.
The name is stored in an internal buffer which may be overwritten by subsequent calls to this method.
Returns a pointer to the name of the 'nth'detail layer, NULL if no detail layers are loaded.
bool TSLStaticMapDataLayer::getDetailLayerTMCExtent | ( | const char * | layerName, |
TSLTMC * | x1, | ||
TSLTMC * | y1, | ||
TSLTMC * | x2, | ||
TSLTMC * | y2 ) const |
Query extent of detail layer.
This method allows the user to get the extent of a particular detail layer of the map. The extent returned is in internal TMC co-ordinates.
layerName | Layer for which the extent are returned |
(x1,y1) | Storage for bottom left corner |
(x2,y2) | Storage for top right corner |
bool TSLStaticMapDataLayer::getLayerLoadingThreshold | ( | const char * | layerName, |
double * | upperThreshold, | ||
double * | lowerThreshold ) const |
Allows the top and bottom thresholds for which a particular layer is displayed to be queried at runtime.
layerName | The name of the layer to query. |
lowerThreshold | The lower value in Map Units per Pixel. |
upperThreshold | The upper value in Map Units per Pixel. |
Return true on success, false otherwise.
bool TSLStaticMapDataLayer::getMUExtent | ( | double * | x1, |
double * | y1, | ||
double * | x2, | ||
double * | y2 ) const |
Query extent of map, in map units.
This method requests the full extent of the area covered by the TSLData Layer. The returned values will be in map unit.
(x1,y1) | Storage for bottom left co-ordinate of the extent. |
(x2,y2) | Storage for top right co-ordinate of the extent. |
int TSLStaticMapDataLayer::getNumDetailLayers | ( | ) | const |
This method returns the number of detail layers in the currently loaded map.
Returns number of detail layers in the currently loaded map. 0 if no map is loaded
const char * TSLStaticMapDataLayer::getOverviewLayer | ( | ) | const |
This method returns name of a layer to be used for an overview.
At present, this method will return "thumbnail" or "overview" if those detail layers exist. Otherwise it returns that detail layer with the largest extent. In a future release, it may be possible to tag a detail layer to be used via MapLink Studio.
Returns a pointer to the name of the overview detail layer, NULL if no detail layers are loaded.
bool TSLStaticMapDataLayer::getPaletteFilename | ( | TSLSimpleString & | filename | ) | const |
This method queries the full path to the palette file associated with this map data layer if one exists.
filename | This will be populated with the palette filename should one be associated |
Return true if the filename parameter was populated with the paletted filename, false otherwise.
bool TSLStaticMapDataLayer::getPathlistFilename | ( | TSLSimpleString & | filename | ) | const |
This method queries the full path to the pathlist definition file associated with this map data layer if one exists.
filename | This will be populated with the pathlist definition file path should one be associated |
Return true if the filename parameter was populated with the pathlist filename, false otherwise.
bool TSLStaticMapDataLayer::getSynchronousLoading | ( | ) | const |
Queries whether the layer is currently set to synchronous loading of its data. Synchronous loading is usually only required when printing as all data that is to be drawn must be loaded before the print draw occurs. Use the set SynchronousLoading method to alter the value of this setting.
int TSLStaticMapDataLayer::metadata | ( | int | pos, |
char ** | fileName ) |
This method returns the source ID and the full path of the associated xml file for the given position.
pos | the nth piece of metadata for which source ID and the xml file are required |
fileName | the filename of the associated metadata (memory owned by the caller) |
void TSLStaticMapDataLayer::metadata | ( | int | sourceID, |
TSLSimpleString & | filename ) const |
The method returns the full path of the Envitia generated metadata xml file associated with the given source ID in the filename argument.
sourceID | sourceID for which associated metadata xml file path should be returned |
filename | The full path to the metadata file. An empty path is returned if there was no metadata file. |
int TSLStaticMapDataLayer::metadataCount | ( | ) | const |
This method returns a count of the number of metadata files associated with this layer.
bool TSLStaticMapDataLayer::MUToTMC | ( | double | x1, |
double | y1, | ||
TSLTMC * | x2, | ||
TSLTMC * | y2 ) const |
Map unit to TMC conversion method.
x1 | input X (map units). |
y1 | input Y (map units). |
x2 | output X (TMC units). |
y2 | output Y (TMC units). |
Return true on success, false otherwise.
void * TSLStaticMapDataLayer::operator new | ( | size_t | size | ) |
Overridden allocation to redirect to MapLink
void * TSLStaticMapDataLayer::operator new | ( | size_t | size, |
char * | filename, | ||
int | line ) |
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.
int TSLStaticMapDataLayer::queryCacheSize | ( | ) | const |
Returns the amount of memory that the query cache may currently use, in kilobytes.
void TSLStaticMapDataLayer::queryCacheSize | ( | unsigned int | size | ) |
Set maximum size of the tile cache used for data layer queries (e.g. find Entity).
This method allows the user to set the amount of memory that the tile cache can use. To operate more efficiently the data layer holds data in memory so that it does not need to reload data from disk every time a query is performed. The larger the cache size the more data can be held in memory. However the client application must find a compromise between a large cache size and the memory requirements of the application itself.
The default tile cache is 16Mb (16384 KB)
size | Size of the cache in kilobytes. |
const TSLCoordinateSystem * TSLStaticMapDataLayer::queryCoordinateSystem | ( | ) | const |
Query for the coordinate system used by this layer to convert between map units and lat/long.
This method requests the TSLMapDataLayer to return a TSLCoordinateSystem object which allows the user to access information concerning the transforms used to create the map. 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(). If runtime projection is not in use, this will be the same object as returned from queryMapCoordinateSystem().
const TSLCoordinateSystem * TSLStaticMapDataLayer::queryMapCoordinateSystem | ( | ) | const |
Query for the coordinate system associated with the map that is loaded in this layer.
This method requests the TSLStaticMapDataLayer to return a TSLCoordinateSystem object which allows the user to access information concerning the transforms used to create the map. The TSLCoordinateSystem is only valid as long as no new map has been loaded into the layer since last obtaining the component.
If realtime projection is not in use, this will be the same object as returned from queryCoordinateSystem(). If realtime projection is in use, queryRuntimeCoordinateSystem() will return the transform given to setRuntimeProjection() and this method will return the transform associated with the loaded map.
TSLCoordinateSystem * TSLStaticMapDataLayer::queryRuntimeCoordinateSystem | ( | ) | const |
Query for the runtime coordinate system added with setRuntimeProjection.
If realtime projection is not in use, this will return NULL.
bool TSLStaticMapDataLayer::removeLayer | ( | const char * | layerName | ) |
Remove existing detail layer.
This method requests the TSLMapDataLayer to remove the named detail layer. If the layer identified by input layer file name does not exist in the TSLMap DataLayer then this will have no effect. If the layer is currently on the display then nothing will happen until the data is redisplayed.
layerName | The name of the layer to be removed. |
bool TSLStaticMapDataLayer::setLayerLoadingThreshold | ( | const char * | layerName, |
double | upperThreshold, | ||
double | lowerThreshold = 0.0 ) |
Allows the top and bottom thresholds for which a particular layer is displayed to be set at runtime, rather than relying on settings via MapLink studio.
layerName | The name of the layer to apply the changes. |
upperThreshold | The upper threshold in Map Units per pixel. |
lowerThreshold | The lower threshold in Map Units per pixel. Defaulted to 0.0. |
Return true on success, false otherwise.
bool TSLStaticMapDataLayer::setRuntimeProjection | ( | const TSLCoordinateSystem * | projection, |
double | greatCircleDistance, | ||
TSLRuntimeProjectionChangedCallback | callback, | ||
void * | arg ) |
Changes the current projection if using runtime projection.
If a callback is given, then the recalculation of the projection will happen in a background thread, and the callback will be called when it is complete. Drawing operations will fail if called during the time when the recalculation is being performed.
If the callback parameter is null then the calculations happen synchronously in the main thread, within this call.
The same callback pointer may be given to both setRuntimeProjection and set RuntimeProjectionOrigin. The reason parameter of the callback indicates the reason for the callback.
If the runtime projection is referenced against a different datum to that against which the map was created, then a suitable datum transform must be set on the projection before calling this method.
projection | the new coordinate system to use. This is copied, the pointer is not stored. |
greatCircleDistance | a map tile will be projected if any part of the tile falls within this distance from the projection origin (metres). Set this value to the maximum geographical area the you need to view. Reducing the value makes setprojection and setProjectionOrigin work faster. Avoid values so large that the edge of the map projection becomes visible. |
callback | callback to call when new projection calculated, or NULL if calculations to be synchronous |
arg | user-defined argument, returned in callback. |
bool TSLStaticMapDataLayer::setRuntimeProjectionOrigin | ( | double | latitude, |
double | longitude, | ||
TSLRuntimeProjectionChangedCallback | callback, | ||
void * | arg ) |
Changes the origin of the current projection if using runtime projection.
If a callback is given, then the recalculation of the projection will happen in a background thread, and the callback will be called when it is complete. Drawing operations will fail if called during the time when the recalculation is being performed.
If the callback parameter is null then the calculations happen synchronously in the main thread, within this call.
The same callback pointer may be given to both setRuntimeProjection and setRuntimeProjectionOrigin. The reason parameter of the callback indicates the reason for the callback.
(latitude,longitude) | the new projection origin to be set, degrees |
callback | callback to call when new projection calculated, or null if calculations to be synchronous |
arg | user-defined argument, returned in callback. |
void TSLStaticMapDataLayer::setSynchronousLoading | ( | bool | synchronous | ) |
Call with the synchronous parameter set to true to load map data synchronously, it also inhibits callbacks after each map tile is loaded.
Call this during printing to ensure that all map data is loaded synchronously, as printing may use a different tile resolution from those displayed on the screen.
The allLoadedCallback callback (as passed in the addLoader() method) is always called at the end of loading all tiles, but the tile loaded callback (as passed in the addLoader() method) is only called for asynchronous loading.
double TSLStaticMapDataLayer::TMCperMU | ( | ) | const |
This method returns the number of TMCs per Map Unit for the loaded map.
Returns the number of TMCs per Map Unit if data is loaded, 0.0 if not.
bool TSLStaticMapDataLayer::TMCToMU | ( | TSLTMC | x1, |
TSLTMC | y1, | ||
double * | x2, | ||
double * | y2 ) const |
TMC to map unit conversion method.
x1 | input X (TMC units). |
y1 | input Y (TMC units). |
x2 | output X (map units). |
y2 | output Y (map units). |
Return true on success, false otherwise.