![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
A data source driver for the Direct Import SDK
On startup, plugins will be loaded from:
A driver plugin library must include a class which inherits from TSLDirectImportDriver, and must implement TSLDirectImportDriver::DriverCreationFunc.
Classes | |
class | CancelCallback |
class | Configuration |
struct | LayerInformation |
Public Types | |
enum | DataType { DataTypeNone = 0x00 , DataTypeVector = 0x01 , DataTypeRaster = 0x02 , DataTypeTerrain = 0x04 } |
enum | OverviewType { OverviewTypeNone = 0x00 , OverviewTypeNative = 0x01 , OverviewTypeGenerated = 0x02 , OverviewTypeAny = 0xFF } |
typedef TSLDirectImportDriver *(* | DriverCreationFunc) () |
Public Member Functions | |
TSLDirectImportDriver::Configuration & | configuration () |
virtual bool | supportsThreadedProcessing () |
virtual TSLDirectImportDriver * | clone () |
void | inc () |
Increment the driver's reference count. | |
void | dec () |
void | lock () |
void | unlock () |
Unlock the drivers mutex. | |
virtual TSLDirectImportDriver::DataType | getSupportedDataTypes ()=0 |
virtual bool | supportsData (const char *data)=0 |
virtual const char * | supportedExtensions () const |
virtual bool | supportsOverviews () const |
virtual bool | usesTMFVector () const |
virtual bool | usesEntityRendering () const |
virtual bool | analyseData (const char *data)=0 |
virtual TSLDirectImportDriver::DataType | getTypeOfData ()=0 |
virtual unsigned int | numLayers ()=0 |
virtual TSLDirectImportDriver::LayerInformation * | layerInformation (unsigned int index)=0 |
virtual bool | createOverviewLayer (unsigned int baseLayerIndex, unsigned int overviewFactor, unsigned int insertAtIndex) |
virtual bool | updateLayerExtent (unsigned int index, TSLDirectImportDriver::LayerInformation *layerInfo, const TSLMUExtent &extent) |
virtual bool | updateLayerCoordinateSystem (unsigned int index, TSLDirectImportDriver::LayerInformation *layerInfo, const TSLCoordinateSystem *coordinateSystem) |
virtual bool | updateLayerScale (unsigned int index, TSLDirectImportDriver::LayerInformation *layerInfo, double scale) |
virtual bool | getFeatures (TSLFeatureList &featureList, unsigned int startLayer, unsigned int endLayer)=0 |
virtual bool | getRasterChannelStatistics (unsigned int layerIndex, unsigned int channelIndex, TSLDirectImportRasterSettings::ChannelStatistics &statistics) |
virtual void | setFeatureConfig (const TSLFeatureClassConfig *featureConfig) |
virtual const TSLAttributeValues * | getAttributeValues (const char *featureName, const char *attributeName, unsigned int startLayer, unsigned int endLayer)=0 |
virtual bool | preprocess () |
virtual TSLMUGeometrySet * | getVector (const TSLMUExtent &boundingBox, unsigned int startLayer, unsigned int endLayer) |
virtual TSLEntitySet * | getVectorTMF (const TSLMUExtent &boundingBox, unsigned int startLayer, unsigned int endLayer) |
virtual TSLDirectImportRaster * | getRaster (const TSLMUExtent &boundingBox, unsigned int layerIndex) |
virtual void | setConfig (const TSLDirectImportDriver::Configuration &config) |
Set The configuration object for this driver instance. | |
virtual const char * | name () const =0 |
virtual const char * | description () const =0 |
The human-readable description of the driver. | |
void | setCancelCallback (TSLDirectImportDriver::CancelCallback *callback) |
Protected Member Functions | |
TSLDirectImportDriver () | |
Constructor. | |
TSLDirectImportDriver (const TSLDirectImportDriver &other) | |
Copy constructor. | |
virtual | ~TSLDirectImportDriver () |
Protected Attributes | |
TSLDirectImportDriver::Configuration | m_configuration |
TSLDirectImportDriver::CancelCallback * | m_cancelCallback |
typedef TSLDirectImportDriver *(* TSLDirectImportDriver::DriverCreationFunc) () |
Each plugin must provide a function with this signature, which creates an instance of the direct import driver class.
This function must be exported from the shared library, and be called 'createTSLDirectImportDriver'.
The type of a data set
Applications should treat these values as a bitmask. Unless otherwise specified, functions may return a combination of data types.
If a driver supports more than one type, the values should be combined with a bitwise OR.
Enumerator | |
---|---|
DataTypeNone | None. |
DataTypeVector | Vector data. |
DataTypeRaster | Raster data. |
DataTypeTerrain | Terrain data. |
This enum specifies the type of a raster overview, and is used with TSLDirectImportDataLayer::createDataSets to specify which overview types should be created.
This enum may be used as a bitmask to specify multiple overview types.
Overview data sets contain the same data as their parent data set, however will be processed and displayed at a lower resolution.
Enumerator | |
---|---|
OverviewTypeNone | No type/Not an overview data set When creating data sets used to specify that no overviews should be created |
OverviewTypeNative | A Native overview, as found in the source data. |
OverviewTypeGenerated | A Generated overview, created by the TSLDirectImportDataLayer based on the source data. |
OverviewTypeAny | Any overview type. This is a helper bitmask used to request any type of overview from TSLDirectImportDataLayer::createDataSets |
|
protected |
Constructor.
|
protected |
Copy constructor.
|
protectedvirtual |
Destructor
This class is reference counted. To delete it call TSLDirectImportDriver::dec().
|
pure virtual |
Open the provided data and perform basic analysis.
In this function the driver should determine and store a reference to
If the driver cannot determine these parameters the TSLDirectImportDataLayer will ask the application to provide them via TSLDirectImportDataLayerCallbacks. As such if this method returns false the datalayer will not immediately abort loading the data.
This should be a fast analysis. The driver should not read any geometry from the data, or perform any analysis on the features/attributes contained within the data. This should instead be done in getFeatures, getVector or getRaster.
The driver should store a copy of the 'data' parameter Unless specified otherwise all future function calls to the driver will relate to this data path.
data | The data to analyse. |
|
virtual |
Clone the driver
If a driver supports processing of data in multiple threads, this method must be implemented. It will be used to clone the driver before calling getVector/getRaster from multiple threads.
The created driver must be in the same state as the original. If any load/analyse methods need to be called to setup the state the driver must do so at this point.
If this method is not implemented a single driver instance will be used for each data path. This will greatly increase loading and processing times.
lock() must be called before cloning a driver.
TSLDirectImportDriver::Configuration & TSLDirectImportDriver::configuration | ( | ) |
Query the driver's configuration data
This data may be modified in order to set driver-specific options
|
virtual |
Create a definition for an overview layer
This function will be called by TSLDirectImportDataLayer during basic data analysis if:
If the driver is able to return data for the given overview settings it should create an additional layer definition. Layer definitions remain up to the driver to define. Future references to this layer will be made by layer index.
If the driver is not able to return data for the given overview settings it must return false.
This function will be called repeatedly until the driver returns false, or the minimum overview size is reached.
Example set of function calls:
The driver should not perform any heavy processing in this function. If an overview cannot be defined without processing data at this point the driver cannot support overviews. In this case TSLDirectImportDriver::supportsOverviews must return false, leaving overview creation to the TSLDirectImportDataLayer.
baseLayerIndex | The index of the base layer. The created overview layer will be a reduced resolution of this layer. |
overviewFactor | The amount the base layer should be reduced by. This is a power of 2, starting at 2. |
insertAtIndex | The index to insert the overview layer at. Overview layers are always placed largest first, immediately after the base layer definition. |
void TSLDirectImportDriver::dec | ( | ) |
Decrement the driver's reference count
If the reference count reaches zero the driver will be deleted
|
pure virtual |
The human-readable description of the driver.
|
pure virtual |
Query the values of an attribute
This function will be called during the import process, in order to perform feature classification.
The results should contain each different value of the specified feature, and the number of times it occurs within the data.
featureName | The feature to query attributes for. |
attributeName | The attribute to query values for. |
|
pure virtual |
Query the list of features and attributes in the data
This function will be called during TSLDirectImportDataLayer::analyseData. This function will not be called during TSLDirectImportDataLayer::loadData.
The driver must add any features from the data to the provided TSLFeatureList. Each feature in the list must contain a list of attribute names. Attribute values are not required from this function.
This function will be called repeatedly if the data contains multiple sub-layers (TSLDirectImportDataSets).
featureList | The feature list to add new features to. |
startLayer | The first layer index to process (inclusive). |
endLayer | The last layer index to process (inclusive). |
|
virtual |
Will be called to read raster data from the driver
The driver should return all raster data which overlaps the boundingBox
In most situations the driver should not perform any processing on the data, however it may perform simple operations such as a rough cull/clip if it will speed up the reading of data.
boundingBox | The extent to return data for. |
layerIndex | The layer index to query data from. |
|
virtual |
Query the minimum and maximum values for a raster channel
This function will be called by TSLDirectImportRasterSettings::calculateChannelStatistics This function will be called after analyseRaster.
The driver does not need to implement this function, or calculate all values supported by TSLDirectImportRasterSettings::ChannelStatistics. The behaviour of this calculation will always depend on the driver implementation and data format/product.
If a value is set by the driver it must also set the corresponding validity flag to true.
layerIndex | The index of the raster layer |
channelIndex | The channel index within the raster |
statistics | Storage for the calculates statistics |
|
pure virtual |
Query which data types this driver can read
If a driver is able to read multiple data types, the values should be combined with a bitwise OR.
|
pure virtual |
Query the type of the analysed data.
As with getSupportedDataTypes the driver may return a bitmask of data types.
|
virtual |
Will be called to read vector data from the driver
The driver should process all vector layers between startLayer and endLayer (inclusive). The driver may return vector data from the entire data extent, however should use the provided boundingBox to perform a basic clip operation.
The driver does not need to perform any styling. The driver just needs to extract geometry, feature names, and attribute values. It may use the feature configuration object to mask features/attributes but this is not required.
boundingBox | The extent to return data for. |
startLayer | The first layer index to query data from. |
endLayer | The last layer index to query data from. |
|
virtual |
Will be called to read vector data from the driver, if usesTMFVector() == true
The driver should process all vector layers between startLayer and endLayer (inclusive). The driver may return vector data from the entire data extent, however should use the provided boundingBox to perform a basic clip operation.
The driver does not need to perform any styling, however may return preset entity rendering on the returned entity set.
boundingBox | The extent to return data for. |
startLayer | The first layer index to query data from. |
endLayer | The last layer index to query data from. |
void TSLDirectImportDriver::inc | ( | ) |
Increment the driver's reference count.
|
pure virtual |
Query information about a layer in the analysed data
This function will be called by TSLDirectImportDataLayer during basic data analysis.
For driver-specific data a child class of LayerInfomation should be declared. If the TSLDirectImportDataLayer has to make callbacks in order to determine information about the data the returned LayerInfomation* will be modified.
If the driver uses a separate mechanism for layer management it must preserve the returned object and use its setting during data loading.
index | The index of the layer to query |
void TSLDirectImportDriver::lock | ( | ) |
Lock the driver's mutex
The driver must be locked before cloning.
|
pure virtual |
The name of the driver
The returned name will be used to uniquely identify the driver for registration and data processing. As such this function must always return the same value.
|
pure virtual |
Query the number of layers in the analysed data
Layers will be processed as separate TSLDirectImportDataSets where needed, however a collection of vector layers without raster between them will be processed as a single data set.
|
virtual |
Perform any preprocessing operations on the data before it is read from the driver.
This function will be called during TSLDirectImportDataLayer::loadData.
This function may be overridden in derived classes to perform any preprocessing tasks before the data is read from the driver for processing.
This function will be called on the root driver instance in a single-threaded manner.
void TSLDirectImportDriver::setCancelCallback | ( | TSLDirectImportDriver::CancelCallback * | callback | ) |
Provides a mechanism to allow a job to be cancelled.
The driver should store the value passed and use the value to determine if the current processing should be cancelled.
callback | class instance that implements the cancel() method. |
|
virtual |
Set The configuration object for this driver instance.
|
virtual |
Set the feature/attribute configuration to use when loading data.
This function will be called during TSLDirectImportDataLayer::loadData.
The driver may use this information while loading data, however it is not required to.
|
virtual |
Query the file extension(s) supported by this driver
If multiple file extensions are supported, they should be separated with a semi-colon.
If no extensions are returned, the direct import datalayer will try to use this driver for any extension, and call supportsData for every loaded file.
|
pure virtual |
Query whether a driver supports a data file
The driver should not process the data when this method is called. It should only perform the checks required to test whether the data is supported by the driver.
data | Path to the data. This may be a file, folder or any other identifier if supportedExtensions returned NULL. |
|
virtual |
Query whether the driver supports overview layers
If overview data sets are supported by the driver it is expected to provide an implementation of TSLDirectImportDriver::createOverviewLayer. The driver will also be expected to handle definitions of overview layers in getRaster.
If overview data sets are not supported by the driver they may still be exposed by TSLDirectImportDataLayer however will be handled by down-sampling the base data set accordingly. In this situation the driver doesn't need any handling of overview data sets in getRaster.
|
virtual |
Query whether a driver supports threaded processing
If this function returns true the driver must be thread safe and must implement TSLDirectImportDriver::clone.
A single driver instance will not be accessed from multiple threads at once, however multiple threads may access a single driver instance sequentially.
void TSLDirectImportDriver::unlock | ( | ) |
Unlock the drivers mutex.
|
virtual |
Update layer information with information provided by the application
This function will be called during TSLDirectImportDataLayer::createDataSets, if a coordinate system was specified by the application
For most drivers the default implementation will suffice, and will simply update the following
If this method is overridden the child driver must set this variable, or call back to the base implementation to do so.
index | The index of the layer to update. |
layerInfo | The LayerInformation to update, as queried from TSLDirectImportDriver::layerInformation. |
coordinateSystem | The coordinate system as provided by the application. |
|
virtual |
Update layer information with information provided by the application
This function will be called during TSLDirectImportDataLayer::createDataSets, if an extent was specified by the application
For most drivers the default implementation will suffice, and will simply update the following
If this method is overridden the child driver must set this variable, or call back to the base implementation to do so.
index | The index of the layer to update. |
layerInfo | The LayerInformation to update, as queried from TSLDirectImportDriver::layerInformation. |
extent | The extent as provided by the application. |
|
virtual |
Update layer information with information provided by the application
This function will be called during TSLDirectImportDataLayer::createDataSets, if a scale was calculated by the data layer
For most drivers the default implementation will suffice, and will simply update the following
If this method is overridden the child driver must set this variable, or call back to the base implementation to do so.
index | The index of the layer to update. |
layerInfo | The LayerInformation to update, as queried from TSLDirectImportDriver::layerInformation. |
scale | The scale as calculated by the data layer. |
|
virtual |
Query whether the driver returns vector data with pre-set entity rendering
This capability should only be used for compatibility with legacy import mechanisms, or where the driver is unable to support feature rendering. If this capability is used the driver must return vector data as TMF.
|
virtual |
Query whether the driver returns vector data as TMF/TSLEntity based classes
This capability should only be used for compatibility with legacy import mechanisms. Wherever possible the driver should return vector data using the default TSLMUGeometry hierarchy, which provides a more flexible interface to the TSLDirectImportDataLayer.
If this method returns true the datalayer will call getVectorTMF instead of getVector.
|
protected |
|
protected |