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

Detailed Description

Specialist data layer for the manipulation of kml data.

The TSLKMLDataLayer loads .kml or .kmz files, and processes them into a set of TSLDataLayers.

Vector data from the kml such as placemarks, geometry and their associated attributes are loaded into TSLStandardDataLayer(s). Raster data for ground overlays are loaded into TSLRasterFilterDataLayers.

The hierarchical structure of the KML data is preserved when imported, such that placemarks/folders/etc will produce a TSLEntitySet containing any child elements. KML elements with no children, such as geometry will produce the corresponding type of TSLEntity. Attribute data from the KML is stored in a TSLDataSet on the relevant TSLEntity. Name and Visibility attributes are mapped to the name and visibility members of TSLEntity.

KML Styles are translated to MapLink feature rendering. The Feature IDs used are auto generated, either starting at 0, or the value passed to set InitialFeatureID. Both shared and inline styles are supported, with inline styles mapped to feature names such as Document.Folder.Unamed_xxx. For shared styles the styleURL is used to create a feature name such as Document.Folder.originalStyleURL.

The TSLKMLDataLayer reserves 2 coordinate system IDs, 1000000000 and 1000000001, these should not be used by an application.

The TSLKMLDataLayer currently supports the following subset of kml 2.2: Features: Document Folder Placemark NetworkLink GroundOverlay - Rotation is not currently supported. ScreenOverlay - These are not handled directly, but are passed to the application through the TSLKMLScreenOverlayCallback.

Geometry: Point LineString Polygon MultiGeometry

Style selector: Style StyleMap - The interactive element of kml is not directly supported, and is left for the application to implement. Elements with a styleMap will have the normal style applied, and 2 entries will be added to the corresponding TSLDataSet: featureID.normal : The maplink feature ID which corresponds to the normal style. featureID.highlight : The maplink feature ID which corresponds to the highlighted style. To 'select' the entity and apply the highlighted style, the feature ID on the TSLEntity should be set to the featureID.highlight value. In the case of a placemark, the highlighted ID should be set on the TSLEntitySet, and any child entities that have the same feature ID. A child entity may have a different feature ID if it has an inline style in the original KML.

TimePrimitive: TimeSpan - These are stored as a TSLEntitySet, containing all elements that the timespan applies to TimeStamp - These are stored as attributes on the relevant TSLEntity, any time-based display of data is left for an application to implement

Instances of this class should be destroyed using the destroy method.

Public Member Functions

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

Constructor & Destructor Documentation

◆ TSLKMLDataLayer()

TSLKMLDataLayer::TSLKMLDataLayer ( )

Member Function Documentation

◆ clearCache()

void TSLKMLDataLayer::clearCache ( )

Clears the contents of the KML cache

The file ttlkmlcache.txt, and all file entries contained within it will be removed from the cache directory.

If the input data to the layer has changed, whether on disk or fetched remotely, this must be called to clear the old version from the cache directory

◆ getCacheDirectory()

const char * TSLKMLDataLayer::getCacheDirectory ( )

Gets the cache directory

Returns
The current cache directory in use by the layer

◆ getLayer()

TSLDataLayer * TSLKMLDataLayer::getLayer ( int index)

Gets the internal datalayer at index

Parameters
indexThe index of the layer to return
Returns
The TSLDataLayer at index

◆ numberOfLayers()

int TSLKMLDataLayer::numberOfLayers ( )

Gets the number of internal datalayers present in the KML datalayer

Returns
The number of internal datalayers

◆ operator new() [1/2]

void * TSLKMLDataLayer::operator new ( size_t size)

Allocation override for API redirection.

◆ operator new() [2/2]

void * TSLKMLDataLayer::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.

◆ setCacheDirectory()

void TSLKMLDataLayer::setCacheDirectory ( const char * directory)

Sets the cache directory

The KML cache directory is used to store local copies of all fetched data, so that data such as icons and other kml files don't need to be fetched every load. Image data is also converted to PNG format before being written to the cache.

The default cache directory is in the system temporary directory.

Parameters
directoryThe cache directory to change to, if NULL the system temporary directory will be used.

◆ setInitialFeatureID()

void TSLKMLDataLayer::setInitialFeatureID ( TSLFeatureID id)

Sets the starting feature ID for the layers rendering.

Parameters
idThe initial featureID value

◆ setRemoteAuthenticationCallback()

void TSLKMLDataLayer::setRemoteAuthenticationCallback ( TSLRemoteAuthenticationCallback * callback = NULL)

Sets the callback used to provide authentication credentials to servers.

Parameters
callbackThe TSLRemoteAuthenticationCallback class to use.

◆ setScreenOverlayCallback()

void TSLKMLDataLayer::setScreenOverlayCallback ( TSLKMLScreenOverlayCallback * callback = NULL)

Sets the callback used whenever a screen overlay element is encountered.

Parameters
callbackThe TSLKMLScreenOverlayCallback class to use.