![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
Specialist data layer for the handling of non-map data.
The Standard Layer component is provided to allow the user to load, create, manipulate and save non-map data.
The methods provided by the TSLStandardDataLayer are divided into a number of categories:
The methods 'loadData()', 'loadDataFromBuffer()', 'append()' and 'appendDataFromBuffer()' allow data to be loaded from files or data streams. 'removeData()' removes all data from the data layer. The data stream is expected as a pointer to a memory buffer of unsigned char *. The methods 'saveData()' and 'saveDataToBuffer()' allow the user to save all the data in the layer to a file or a data stream. When saving to a buffer, the buffer should be deleted using the 'deleteBufferData()' call. A buffer is often used when the data is subsequently saved to a database.
Entities may be cloned from other data layers using the methods 'cloneEntity()' 'cloneExtent()' and 'cloneFeature()'. Entities may be removed from the TSLStandardDataLayer using the methods 'removeEntity()' and 'removeFeature()'. The ordering of the entities may be modified using the methods 'bringToFront()' and 'sendToBack()'.
The rendering of features within the TSLStandardDataLayer can be modified using the methods 'loadRendering()', 'saveRendering()', 'setRendering()', 'getRendering()' and 'clearRendering()'. Rendering information held by the TSLStandardDataLayer is used for any entities that do not have any individual rendering attributes.
A number of miscellaneous methods and properties are also available.
Instances of this class should be destroyed using the destroy method.
Public Member Functions | |
TSLStandardDataLayer () | |
bool | addFeature (const char *feature_name, TSLFeatureID feature_id) |
bool | addSourceInfo (const char *featureName, TSLFeatureID featureID, const char *sourceName, TSLFeatureID sourceID, const char *sourceDescription, TSLGeometryType sourceType, int minOccurs=1, int maxOccurs=1) |
bool | appendData (const char *filename) |
bool | appendDataFromBuffer (const unsigned char *data_stream, TSLSize data_len) |
bool | bringEntityToFront (TSLEntity *entity) |
bool | bringEntityToFront (TSLEntityID entity_id, bool uniqueID=false) |
bool | clearFeatures () |
bool | cloneEntity (TSLDataLayer *src_data_layer, TSLEntityID entity_id) |
bool | cloneExtent (TSLDataLayer *src_data_layer, TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2) |
bool | cloneFeature (TSLDataLayer *src_data_layer, const char *detail_layer_name, TSLTMC xmin, TSLTMC ymin, TSLTMC xmax, TSLTMC ymax, TSLFeatureID feature_id) |
void | deleteBufferData (unsigned char *buffer) const |
bool | deleteSourceInfo (const char *featureName, TSLFeatureID featureID, int index) |
TSLEntitySet * | entitySet () |
const TSLEntitySet * | entitySet () const |
TSLMapQuery * | findEntityID (TSLEntityID entity_id, TSLFindTypeEnum type=TSLFindTypeAll) |
bool | loadDataFromBuffer (const unsigned char *data_stream, TSLSize data_len, bool loadConfigDetails=false) |
bool | loadDataWithConfig (const char *filename) |
bool | loadDataWithConfigFromBuffer (const unsigned char *data_stream, TSLSize data_len) |
bool | removeEntity (TSLEntityID entity_id) |
bool | removeFeature (TSLFeatureID feature_id) |
bool | saveData (const char *filename, TSLMapLinkVersion version=TSL_MAPLINK_DEFAULT_VERSION) const |
unsigned char * | saveDataToBuffer (TSLSize *data_len, TSLMapLinkVersion version=TSL_MAPLINK_DEFAULT_VERSION) const |
bool | saveDataWithConfig (const char *filename, TSLMapLinkVersion version=TSL_MAPLINK_DEFAULT_VERSION) const |
unsigned char * | saveDataWithConfigToBuffer (TSLSize *data_len, TSLMapLinkVersion version=TSL_MAPLINK_DEFAULT_VERSION) const |
bool | sendEntityToBack (TSLEntityID entity_id, bool uniqueID=false) |
bool | sendEntityToBack (TSLEntity *entity) |
bool | updateSourceInfo (const char *featureName, TSLFeatureID featureID, int index, const char *sourceName, TSLFeatureID sourceID, const char *sourceDescription, TSLGeometryType sourceType, int minOccurs=1, int maxOccurs=1) |
void * | operator new (size_t size) TSL_NO_THROW |
void * | operator new (size_t size, char *filename, int line) |
TTL_DEPRECATED_PRE bool | addFeature (TSLFeatureID feature_id, const char *feature_name) TTL_DEPRECATED_POST |
![]() | |
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 |
Protected Member Functions | |
~TSLStandardDataLayer () | |
TSLStandardDataLayer (const TSLStandardDataLayer &) | |
TSLStandardDataLayer & | operator= (const TSLStandardDataLayer &) |
TSLStandardDataLayer::TSLStandardDataLayer | ( | ) |
Default constructor.
|
protected |
Protected destructor to stop being instantiated on the stack Forces user to use new operator and destroy method.
|
protected |
bool TSLStandardDataLayer::addFeature | ( | const char * | feature_name, |
TSLFeatureID | feature_id ) |
Add a feature to the feature class list.
This method adds a feature to the feature class list. This list may subsequently be queried but has no effect on the display of data.
If the specified feature_id already exists in the feature list, then the name of that feature is changed to the feature_name passed. No limitation is placed on features sharing the same name, but this is not recommended.
feature_name | Textual description of feature. |
feature_id | ID of feature to add. |
|
inline |
Deprecated methods - retained for backwards compatibility
bool TSLStandardDataLayer::addSourceInfo | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
const char * | sourceName, | ||
TSLFeatureID | sourceID, | ||
const char * | sourceDescription, | ||
TSLGeometryType | sourceType, | ||
int | minOccurs = 1, | ||
int | maxOccurs = 1 ) |
This method adds source information to the specified feature. The information which is added can be retrieved via the TSLFeatureClassList::getSourceInfoItem() method.
Note: Either a valid feature name or feature ID need to be specified. It is not required to provide both.
featureName | The name of the feature to attach the source information to. |
featureID | The identifier of the feature to attach the source information to. |
sourceName | The name of the source data. |
sourceID | The feature ID of the source data. |
sourceDescription | A textual description of the source data. |
sourceType | The TSLGeometryType of the source data. |
minOccurs | The minimum number of occurrences of the source data. Usually this will be 1. |
maxOccurs | The maximum number of occurrences of the source data. Usually this will be 1. |
bool TSLStandardDataLayer::appendData | ( | const char * | filename | ) |
Add data from a file.
This method allows the user to append data to this TSLStandardDataLayer from the named file. The file to be loaded must be in TMF, and will usually have the ".tmf" extension.
filename | Name of the file from which to get the data. |
bool TSLStandardDataLayer::appendDataFromBuffer | ( | const unsigned char * | data_stream, |
TSLSize | data_len ) |
Add data from a memory buffer.
This method allows the user to append data to this TSLStandardDataLayer from the given buffer. The data must be the equivalent of a TMF file, although it is usually extracted from a database. The management of the buffer is the user's responsibility.
data_stream | Address of the first byte of the buffer to be appended to the Data Layer. |
data_len | Size of the buffer to be appended. |
bool TSLStandardDataLayer::bringEntityToFront | ( | TSLEntity * | entity | ) |
Move entity in front of all others.
This method allows the user to bring the specified entity in front of all other entities in its group.
entity | Pointer to the entity to bring to the front. |
bool TSLStandardDataLayer::bringEntityToFront | ( | TSLEntityID | entity_id, |
bool | uniqueID = false ) |
Move entity in front of all others.
This method allows the user to bring the specified entity in front of all other entities in its group.
entity_id | ID of the entity to bring to the front. |
uniqueID | Whether the provided entity ID is unique or not. |
bool TSLStandardDataLayer::clearFeatures | ( | ) |
Clear feature list associated with the data layer.
bool TSLStandardDataLayer::cloneEntity | ( | TSLDataLayer * | src_data_layer, |
TSLEntityID | entity_id ) |
Clone entities with the specified entity_id.
This method allows the user to clone all entities with the given entity_id from the source TSLStandardDataLayer to this TSLStandardDataLayer.
src_data_layer | Data layer where to find the feature. |
entity_id | ID of the entities to be cloned. |
bool TSLStandardDataLayer::cloneExtent | ( | TSLDataLayer * | src_data_layer, |
TSLTMC | x1, | ||
TSLTMC | y1, | ||
TSLTMC | x2, | ||
TSLTMC | y2 ) |
Clone all entities within the specified area.
This method allows the user to clone all entities within the given extent from the source TSLStandardDataLayer to this TSLStandardDataLayer. Extent must be given in internal TMC co-ordinates. The entities are clipped to the extent boundary.
src_data_layer | Source TSLStandardDataLayer. |
(x1,y1) | Bottom left corner of the area from which entities have to be cloned. |
(x2,y2) | Top right corner of the area from which entities have to be cloned. |
bool TSLStandardDataLayer::cloneFeature | ( | TSLDataLayer * | src_data_layer, |
const char * | detail_layer_name, | ||
TSLTMC | xmin, | ||
TSLTMC | ymin, | ||
TSLTMC | xmax, | ||
TSLTMC | ymax, | ||
TSLFeatureID | feature_id ) |
Clone entities with specific feature_id.
This method allows the user to clone all entities with the given feature from the source TSLMapDataLayer to this TSLStandardDataLayer.
A detail layer name within the TSLMapDataLayer must be specified, along with an extent to request.
For TSLStandardDataLayers, both the extent and detail layer name parameters are ignored. All entities with the feature id specified will be cloned.
src_data_layer | Data layer where to find the features. |
detail_layer_name | Detail layer name within the src_data_layer. |
(xmin,ymin) | Bottom left corner of extent to clone. |
(xmax,ymax) | Top right corner of extent to clone. |
feature_id | ID of the features to be cloned. |
void TSLStandardDataLayer::deleteBufferData | ( | unsigned char * | buffer | ) | const |
Delete the buffer returned from 'saveDataToBuffer'.
This method must be used to delete the buffer after a call to 'saveDataToBuffer'. If this does not happen then memory will be leaked.
buffer | Buffer to be deleted, returned from saveDataToBuffer. |
bool TSLStandardDataLayer::deleteSourceInfo | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
int | index ) |
Deletes the source information attached to the specified feature at the given index.
Note: Either a valid feature name or feature ID need to be specified. It is not required to provide both.
featureName | The name of the feature to attach the source information to. |
featureID | The identifier of the feature to attach the source information to. |
index | The index of the source information item to be deleted. |
TSLEntitySet * TSLStandardDataLayer::entitySet | ( | ) |
Query the top level entity set.
This method allows the user to get the TSLEntitySet attached to this TSLStandardDataLayer. This will give access to the set of entities within the layer.
Returns a pointer to a TSLEntitySet object or NULL on error. The user should not delete the TSLEntitySet passed, since it is embedded within the TSLStandardDataLayer.
const TSLEntitySet * TSLStandardDataLayer::entitySet | ( | ) | const |
Query the read-only top level entity set.
This method allows the user to get a read-only TSLEntitySet attached to this TSLStandardDataLayer. This will give access to the set of entities within the layer.
Returns a pointer to a TSLEntitySet object or NULL on error. The user should not delete the TSLEntitySet passed, since it is embedded within the TSLStandardDataLayer.
TSLMapQuery * TSLStandardDataLayer::findEntityID | ( | TSLEntityID | entity_id, |
TSLFindTypeEnum | type = TSLFindTypeAll ) |
Find entities matching the specified entity ID.
This method allows the user to retrieve all visible, selectable entities from a TSLStandardDataLayer according to their entity ID and geometric type. The type is defaulted to return all matching entities.
Entities are marked as visible or selectable via TSLRenderingAttributeVisible and TSLRenderingAttributeSelectable.
The TSLMapQuery returned contains entities that are embedded within the layer, so the TSLEntity objects should not be destroyed by the user.
The user must destroy the TSLMapQuery object returned using the destroy method.
entity_id | Entity ID to search for. |
type | Type of geometric object to limit search to. Defaults to any type. |
bool TSLStandardDataLayer::loadDataFromBuffer | ( | const unsigned char * | data_stream, |
TSLSize | data_len, | ||
bool | loadConfigDetails = false ) |
Load data from a data buffer.
This method allows the user to load data onto this TSLStandardDataLayer from the given buffer. Any data which is currently in the layer will be deleted. The data must be the equivalent of a TMF file, although it is usually extracted from a database. The management of the buffer is the user's responsibility.
data_stream | Address of the first byte of the buffer to be loaded onto the Data Layer. |
data_len | Size of the buffer to be loaded. |
loadConfigDetails | If true, also attempts to load the feature list, rendering list and data handler if they exist in the specified file. |
bool TSLStandardDataLayer::loadDataWithConfig | ( | const char * | filename | ) |
Load data from a file for the TSLStandardDataLayer. The filename should either be fully qualified or should be found using a pathlist added with addPathList.
If data is already loaded into this TSLStandardDataLayer then it will be removed from memory and all references to it deleted.
For a TSLStandardDataLayer, the file should be a '.tmf' file.
This method also attempts to load the feature list, rendering list and data handler if they exist in the specified file
filename | Name of the file from which to load the data. |
bool TSLStandardDataLayer::loadDataWithConfigFromBuffer | ( | const unsigned char * | data_stream, |
TSLSize | data_len ) |
Load data from a data buffer.
This method allows the user to load data onto this TSLStandardDataLayer from the given buffer. Any data which is currently in the layer will be deleted. The data must be the equivalent of a TMF file, although it is usually extracted from a database. The management of the buffer is the user's responsibility.
This method also attempts to load the feature list, rendering list and data handler if they exist in the specified file
data_stream | Address of the first byte of the buffer to be loaded onto the Data Layer. |
data_len | Size of the buffer to be loaded. |
void * TSLStandardDataLayer::operator new | ( | size_t | size | ) |
Allocation override for API redirection.
void * TSLStandardDataLayer::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.
|
protected |
bool TSLStandardDataLayer::removeEntity | ( | TSLEntityID | entity_id | ) |
Remove all entities with a specified entity_id.
This method allows the user to remove an entity of the given id.
entity_id | ID of the entity to remove from the TSLStandardDataLayer. |
bool TSLStandardDataLayer::removeFeature | ( | TSLFeatureID | feature_id | ) |
Remove all entities with a specified feature_id.
This method allows the user to remove all features of a given type from this TSLStandardDataLayer.
feature_id | ID of the feature to be removed. |
bool TSLStandardDataLayer::saveData | ( | const char * | filename, |
TSLMapLinkVersion | version = TSL_MAPLINK_DEFAULT_VERSION ) const |
Saves data to the specified file.
This method allows the user to save the data currently loaded in the TSLStandardDataLayer to the given filename.
filename | Save data file name. |
version | MapLink version to save as. Defaults to the current version. |
unsigned char * TSLStandardDataLayer::saveDataToBuffer | ( | TSLSize * | data_len, |
TSLMapLinkVersion | version = TSL_MAPLINK_DEFAULT_VERSION ) const |
Create a buffer and saves the contents to it.
This method allows the user to save data from this TSLStandardDataLayer to a buffer. A buffer is created, whose size is returned. It is the user's responsibility to free the buffer using the 'deleteBufferData' call.
data_len | Storage for size of the data to be saved. |
version | MapLink version to save as. Defaults to the current version. |
bool TSLStandardDataLayer::saveDataWithConfig | ( | const char * | filename, |
TSLMapLinkVersion | version = TSL_MAPLINK_DEFAULT_VERSION ) const |
Saves data to the specified file, including configuration details such as the feature list, feature rendering list and data handler.
This method allows the user to save the data currently loaded in the TSLStandardDataLayer to the given filename.
filename | Save data file name. |
version | MapLink version to save as. Defaults to the current version. |
unsigned char * TSLStandardDataLayer::saveDataWithConfigToBuffer | ( | TSLSize * | data_len, |
TSLMapLinkVersion | version = TSL_MAPLINK_DEFAULT_VERSION ) const |
Create a buffer and saves the contents to it, including configuration details such as the feature list, feature rendering list and data handler.
This method allows the user to save data from this TSLStandardDataLayer to a buffer. A buffer is created, whose size is returned. It is the user's responsibility to free the buffer using the 'deleteBufferData' call.
data_len | Storage for size of the data to be saved. |
version | MapLink version to save as. Defaults to the current version. |
bool TSLStandardDataLayer::sendEntityToBack | ( | TSLEntity * | entity | ) |
Move the entity behind all others.
This method allows the user to send the specified entity to the back of all other entities in its group.
entity | Pointer to entity to send on the back. |
bool TSLStandardDataLayer::sendEntityToBack | ( | TSLEntityID | entity_id, |
bool | uniqueID = false ) |
Move the entity behind all others.
This method allows the user to send the specified entity to the back of all other entities in its group.
entity_id | ID of the entity to send on the back. |
uniqueID | Whether the provided entity ID is unique or not. |
bool TSLStandardDataLayer::updateSourceInfo | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
int | index, | ||
const char * | sourceName, | ||
TSLFeatureID | sourceID, | ||
const char * | sourceDescription, | ||
TSLGeometryType | sourceType, | ||
int | minOccurs = 1, | ||
int | maxOccurs = 1 ) |
Update the source information attached to the specified feature at the given index.
Note: Either a valid feature name or feature ID need to be specified. It is not required to provide both.
featureName | The name of the feature to attach the source information to. |
featureID | The identifier of the feature to attach the source information to. |
index | The index of the source information item. |
sourceName | The updated name of the source data. |
sourceID | The updated feature ID of the source data. |
sourceDescription | The updated textual description of the source data. |
sourceType | The updated TSLGeometryType of the source data. |
minOccurs | The updated minimum number of occurrences of the source data. Usually this will be 1. |
maxOccurs | The updated maximum number of occurrences of the source data. Usually this will be 1. |