![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
Passive base component for displaying data to a user supplied window.
The TSLDrawingSurfaceBase component is the common functionality used for both 2D and 3D Drawing Surfaces. 3D Drawing Surfaces are supplied in a separate MapLink component. It is an abstract class and cannot be instantiated. Instead the platform specific derivative must be created.
As the TSLDrawingSurfaceBase is passive, there are no inherent event handling routines.
This component provides the following capabilities
Drawing methods and view management are provided by the derived classes.
A TSLDrawingSurfaceBase must be connected to a user-supplied window (or HDC/Pixmap) before it can display anything. It does not create a window of its own. This gives the user control over what is displayed in the window.
A TSLDrawingSurfaceBase derived object will display data from any data layers that are connected to it. The ordering and visibility of the data layers used in the TSLDrawingSurfaceBase are under the control of the user. The methods for connection and disconnection of the data layers to the TSLDrawingSurfaceBase are 'addDataLayer' and 'removeDataLayer'. The ordering of the data layers are controlled by the methods 'bringInFrontOf', 'sendToBackOf', 'bringToFront' and 'sendToBack'. The properties of the data layer within the TSLDrawingSurfaceBase, e.g. detectability, selectability, visibility and automatic tiling for map layers, can be modified using 'setDataLayerProps' and examined by 'getDataLayerProps'.
The background colour of the TSLDrawingSurfaceBase may be defined by the method 'setBackgroundColour'. To make the TSLDrawingSurface transparent, the method 'clearBackgroundColour' may be called. This allows the user application to draw under the TSLDrawingSurface without the image being erased when the TSLDrawingSurface is drawn.
The rendering of map features within the TSLDrawingSurface can be modified using the methods 'loadRendering', 'saveRendering', 'setFeatureRendering', 'getFeatureRendering' and 'clearFeatureRendering'. Rendering information held by the TSLDrawingSurfaceBase overrides any rendering information held within a Data Layer for a particular feature.
The visibility of individual map features within the TSLDrawingSurfaceBase can be modified using the methods 'loadDeclutter', 'saveDeclutter' , 'setDeclutterRange' , 'setDeclutterStatus' and examined using the method 'getDeclutterRange' and 'getDeclutterStatus'. Groups of related features can be decluttered using 'setDeclutterStatus'. A drawing surface internally has two sets of declutter settings, a global list that is applied to all data layers in the drawing surface, and a per-layer list that applies to a single data layer that inherits and extends the global list. When modifying declutter settings using the above methods the application can control whether the setting should be set on the global list (and thus apply to all layers in the drawing surface) or a specific data layer's list through the layer name argument of each method.
This class is an abstract class, specifying the generic behaviour of a TSLDrawingSurfaceBase.
MapLink can be used in multiple threads if a degree of care is taken by the user.
The principle rule is that Drawing surfaces and TSLMapDataLayers must be not be shared between threads.
Additionally loading of the Coordinate Systems and adding or removing coordinate systems is not thread safe.
Additional guidance can be obtained from support.
The types used to return OS specific drawing are as follows:
TSLDeviceContext : Windows 'HDC'. TSLWindowHandle : Windows 'HWND'. TSLBitmapHandle : Windows 'HBITMAP', X11 a pointer to a structure declared in tslplatformtypes.h. TSLDrawableHandle : X11 'Drawable'. TSLVisualHandle : X11 'Visual *'. TSLColourmapHandle : X11 'Colormap'. TSLScreenHandle : X11 'Screen *'. TSLDisplayHandle : X11 'Display *'.
If you pass a specific OS type to a method or you are querying a method which returns an OS specific type as defined above you may need to cast the result or argument to the type expected.
Public Member Functions | |
bool | addDataLayer (TSLDataLayer *data_layer_interface, const char *data_id) |
bool | addDynamicRenderer (TSLDynamicRenderer *renderer, TSLFeatureID featureID=-1, const char *layerName=0) |
bool | addFeatureRendering (const char *featureName, TSLFeatureID featureID) |
void | attach (TSLDeviceContext handle) |
void | attach (TSLWindowHandle handle) |
void | attach (TSLDrawableHandle handle) |
bool | bringInFrontof (const char *move_data_layer, const char *target_data_layer) |
bool | bringToFront (const char *move_data_layer) |
bool | clearAllDeclutterData (const char *layer_name=0) |
void | clearAllDynamicRenderers () |
bool | clearBackgroundColour () |
bool | clearDeclutterData (const char *feature_name, const char *layer_name=0) |
bool | clearDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
bool | clearFeatureRendering (const char *featureName, TSLFeatureID featureID) |
bool | clearFrame () |
bool | copyDeclutterData (const char *src_feature_name, const char *dest_feature_name, const char *src_layer_name=0, const char *dest_layer_name=0) |
void | detach () |
void | detachAllDynamicRenderers () |
bool | detachDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
const char * | featureClass (TSLFeatureID feature_id) |
bool | forceLayer (const char *data_id, const char *detail_layer_name) |
bool | getBackgroundColour (TSLStyleID *value) |
bool | getColourValue (int colour, unsigned char &r, unsigned char &g, unsigned char &b) |
TSLDataLayer * | getDataLayer (const char *data_id) |
bool | getDataLayerInfo (int N, TSLDataLayer **dataLayer, const char **layerName) const |
bool | getDataLayerProps (const char *data_id, TSLPropertyEnum property_id, TSLPropertyValue *old_value) |
bool | getDeclutterStatus (const char *feature_name, TSLDeclutterStatusResultEnum *value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | getDeclutterStatus (TSLFeatureID feature_id, TSLDeclutterStatusResultEnum *value, const char *dataLayerName, const char *detailLayerName=0) |
TSLDynamicRenderer * | getDynamicRenderer (TSLFeatureID featureID=-1, const char *layerName=0) |
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 |
int | getNumDataLayers () const |
bool | getOption (TSLOptionEnum option) |
void | id (int id_) |
int | id () const |
bool | idleProcess () |
bool | loadDeclutter (const char *filename) |
bool | loadRendering (const char *filename) |
TSLPickResultSet * | pick (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture, int depth, TSLPickSelector *selector=0) |
TSLPickResultSet * | pick (const char *data_id, TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture, int depth=-1, TSLPickSelector *selector=0) |
bool | queryActiveLayer (const char *data_id, char *detail_layer_name, int detail_layer_name_size) |
bool | removeDataLayer (const char *data_id) |
bool | saveDeclutter (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION) |
bool | saveRendering (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION) |
bool | sendToBack (const char *move_data_layer) |
bool | sendToBackOf (const char *move_data_layer, const char *target_data_layer) |
bool | setBackgroundColour (int value) |
bool | setCoordinateProvidingLayer (const char *layer_name) |
bool | setDataLayerProps (const char *data_id, TSLPropertyEnum property_id, TSLPropertyValue new_value) |
bool | setDeclutterStatus (const char *feature_name, TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | setDeclutterStatus (TSLFeatureID feature_id, TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
bool | setDeclutterStatusOnAllFeatures (TSLDeclutterStatusEnum value, const char *dataLayerName=0, const char *detailLayerName=0) |
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 | setFrame (int style, int colour, int thickness) |
virtual void | setOption (TSLOptionEnum option, bool value) |
double | TMCperMU () |
TSLDrawingSurfaceTypeEnum | type () const |
void | userWord (void *ptr) const |
void * | userWord () const |
bool | cloneDynamicRenderersFrom (const TSLDrawingSurfaceBase *otherSurface) |
void | addDuplicateLayers (bool value) |
virtual | ~TSLDrawingSurfaceBase () |
Static Public Member Functions | |
static bool | addLoader (TSLFileLoader *loader) |
static bool | addPathList (TSLPathList *path_list) |
static bool | findFile (const char *filename, TSLSimpleString &foundPath) |
static TSLFileLoader * | getLoader () |
Protected Member Functions | |
TSLDrawingSurfaceBase () | |
Protected Attributes | |
void * | m_classID |
|
virtual |
|
protected |
bool TSLDrawingSurfaceBase::addDataLayer | ( | TSLDataLayer * | data_layer_interface, |
const char * | data_id ) |
Add TSLDataLayer to Drawing Surface.
Visual display of data in TMS is through a Drawing Surface. This method allows the user to add a Data Layer to the Drawing Surface. When a draw request is made to the Drawing Surface any (visible) Data Layer that is attached to it will be displayed in the window.
Calling addDataLayer may change the coordinate providing layer. The default coordinate providing layer is the last layer added that reports itself to be coordinate providing. You can also set a fixed coordinate providing layer by calling setCoordinateProvidingLayer.
Note: Data Layers may be added to more than one Drawing Surface.
data_layer_interface | Actual data layer to be added to the Drawing Surface. The object must be constructed beforehand. |
data_id | This is the user defined name of the data layer to be added to the Drawing Surface. |
void TSLDrawingSurfaceBase::addDuplicateLayers | ( | bool | value | ) |
If enabled, allow multiple data layers with the same name to be added to the drawing surface.
value | Pass true to allow the duplicate feature. |
bool TSLDrawingSurfaceBase::addDynamicRenderer | ( | TSLDynamicRenderer * | renderer, |
TSLFeatureID | featureID = -1, | ||
const char * | layerName = 0 ) |
This method adds a Dynamic Renderer to the drawing surface, or clears an existing one for a specific feature/layer combination.
There are 4 different ways of deciding if a Dynamic Renderer should be used to render a particular entity - in this order.
Any existing renderer for this featureID/layerName combination is destroyed.
renderer | Renderer to use. The Drawing Surface assumes ownership of it. If NULL, then this clears the feature/layer combination. |
featureID | Feature ID of entities that trigger this renderer. -1 if featureID is not relevant in the decision. Default -1 |
layerName | Name of data layer that this renderer applies to. 0 if layer is not relevant in the decision. Default 0 |
bool TSLDrawingSurfaceBase::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 |
|
static |
The application can provide a file loader for drawing surfaces to use when loading data.
If addLoader has not been called when a loader is needed, the surface 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 surfaces take a reference to the loader but do not take ownership of it. The loader could be added to data layers as well as the surface. The application must ensure that the loader remains in existence while the surface has a reference to it, and the application must delete the loader when it is no longer needed.
But if the surface creates a TSLFileLoaderBlocking because no loader was added, the surface will own the loader and will delete it when necessary. In fact, all surfaces share a single static loader which is created when first needed and destroyed when no longer needed.
The loader is always used in synchronous mode.
The loader is shared between drawing surfaces. The adding of a loader is not thread safe. Either add the loader before starting any threads that use Drawing Surfaces or block the use of all Drawing Surfaces while adding a loader. This is only necessary if you are using Drawing Surfaces in separate threads.
loader | the loader to add. Pass NULL to remove the loader from the Drawing Surfaces. |
|
static |
Add a TSLPathList object to all surfaces. This will be used for finding files, for example in setupColours.
The pathlist is shared between drawing surfaces. The adding of a pathlist is not thread safe. Either add the pathlist before starting any threads that use Drawing Surfaces or block the use of all Drawing Surfaces while adding a pathlist. This is only necessary if you are using Drawing Surfaces in separate threads.
The pathlist object is only thread safe if it is not modified while in use.
path_list | the pathlist to add. Pass NULL to remove the pathlist from the drawing surfaces. |
void TSLDrawingSurfaceBase::attach | ( | TSLDeviceContext | handle | ) |
Attaches a new Device Context (HDC) to the drawing surface.
The TSLDrawingSurface will require update of window size after this call.
Note:
handle | HDC to attach to the drawing surface. |
void TSLDrawingSurfaceBase::attach | ( | TSLDrawableHandle | handle | ) |
Attaches a new Drawable to the drawing surface.
The TSLDrawingSurface will require update of window size after this call.
Note:
handle | Drawable to attach to the drawing surface. |
void TSLDrawingSurfaceBase::attach | ( | TSLWindowHandle | handle | ) |
Attaches a new Window handle (HWND) to the drawing surface.
The TSLDrawingSurface will require update of window size after this call.
Note:
handle | HWND to attach to the drawing surface. |
bool TSLDrawingSurfaceBase::bringInFrontof | ( | const char * | move_data_layer, |
const char * | target_data_layer ) |
Move Data Layer in front of another Data Layer.
This method allows the display order of the attached TSLDataLayer instances to be modified. The TSLDataLayer identified by 'move_data_layer' is moved so that it is drawn immediately after the TSLDataLayer identified by 'target_ data_layer'.
move_data_layer | Name of a TSLDataLayer instance attached to this TSLDrawingSurface. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
target_data_layer | Name of a TSLDataLayer instance attached to this TSLDrawingSurface. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
bool TSLDrawingSurfaceBase::bringToFront | ( | const char * | move_data_layer | ) |
Move Data Layer to top of Drawing Surface display list.
This method allows the display order of the attached TSLDataLayer instances to be modified. The specified TSLDataLayer instance will be drawn on top of all other TSLDataLayer instances attached to this TSLDrawingSurface.
move_data_layer | Name of a TSLDataLayer. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
bool TSLDrawingSurfaceBase::clearAllDeclutterData | ( | const char * | layer_name = 0 | ) |
Clears all feature decluttering.
layer_name | Name of the layer to clear the decluttering on. If this is NULL, feature decluttering is cleared from all layers in the drawing surface. |
void TSLDrawingSurfaceBase::clearAllDynamicRenderers | ( | ) |
Clears (and destroys) all dynamic renderers that have been added to the drawing surface. This includes any dynamic renderers that are associated with a specific data layer in the surface.
If the same data layer is shared between multiple drawing surfaces in separate threads and has a dynamic render associated with it, care should be taken when calling this method to ensure that the common data layer is not being drawn or otherwise used by the other threads.
bool TSLDrawingSurfaceBase::clearBackgroundColour | ( | ) |
Clears the background colour of the TSLDrawingSurface.
If the background colour is cleared and a draw request is made which specifies the clear flag, then under Windows, the Drawing Surface will clear the area using a white brush; under X the Drawing Surface will clear the area of (i) a window using the 'background_pixel' / 'background_pixmap' attributes or (ii) a pixmap using WhitePixel of the display.
Returns true on success, false otherwise.
bool TSLDrawingSurfaceBase::clearDeclutterData | ( | const char * | feature_name, |
const char * | layer_name = 0 ) |
Clear feature decluttering.
This method removes the declutter data for the named feature. If there is no declutter data for a given feature the TSLDrawingSurface will not check for visibility when that feature is encountered, therefore this feature is always visible.
feature_name | Name of the feature for which to clear the declutter settings |
layer_name | Name of the layer to clear the decluttering on. If this is NULL, the declutter settings for the feature will be cleared from all layers in the drawing surface. |
bool TSLDrawingSurfaceBase::clearDynamicRenderer | ( | TSLFeatureID | featureID = -1, |
const char * | layerName = 0 ) |
This method clears (and destroys) a Dynamic Renderer from the drawing surface.
There are 4 different ways of deciding if a Dynamic Renderer should be used to render a particular entity - in this order.
Any existing renderer for this featureID/layerName combination is destroyed.
featureID | Feature ID of entities that trigger this renderer. -1 if featureID is not relevant in the decision. Default -1 |
layerName | Name of data layer that this renderer applies to. 0 if layer is not relevant in the decision. Default 0 |
bool TSLDrawingSurfaceBase::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 'setRendering' 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 from which the rendering style information is removed. NULL means use featureID. |
featureID | Numeric ID of feature class as stored in TSLEntity::featureID |
bool TSLDrawingSurfaceBase::clearFrame | ( | ) |
Inhibit frame from being drawn around TSLDrawingSurface.
Returns true on success, false otherwise.
bool TSLDrawingSurfaceBase::cloneDynamicRenderersFrom | ( | const TSLDrawingSurfaceBase * | otherSurface | ) |
bool TSLDrawingSurfaceBase::copyDeclutterData | ( | const char * | src_feature_name, |
const char * | dest_feature_name, | ||
const char * | src_layer_name = 0, | ||
const char * | dest_layer_name = 0 ) |
Copy feature decluttering.
This method copies the declutter information for one named feature to another named feature.
If no declutter data for the source feature exists then the declutter information for the destination feature will be cleared as if clearDeclutterData was called for that feature.
Any existing declutter data for the destination feature will be overwritten.
src_feature_name | Name of the source feature. |
dest_feature_name | Name of the destination feature. |
src_layer_name | Name of the source layer from which to read the declutter data for the source feature. If this is NULL, the declutter data for the source feature is read from the global declutter settings. |
dest_layer_name | Name of the destination layer for which to set the declutter data for the destination feature. If this is NULL, the declutter data for the destination feature is set on all data layers in the drawing surface. |
void TSLDrawingSurfaceBase::detach | ( | ) |
Detach HDC/Pixmap/window from TSLDrawingSurface.
The user is responsible for the management of the detached HDC/Pixmap/window.
NB. The TSLDrawingSurface is made invalid until a valid HDC/Pixmap/window is re-attached.
void TSLDrawingSurfaceBase::detachAllDynamicRenderers | ( | ) |
This method removes all dynamic renderers that have been added to the drawing surface, but does not destroy them. This includes any dynamic renderers that are associated with a specific data layer in the surface. The application is responsible for ensuring any dynamic renderers that were added to the drawing surface are destroyed.
If the same data layer is shared between multiple drawing surfaces in separate threads and has a dynamic render associated with it, care should be taken when calling this method to ensure that the common data layer is not being drawn or otherwise used by the other threads.
bool TSLDrawingSurfaceBase::detachDynamicRenderer | ( | TSLFeatureID | featureID = -1, |
const char * | layerName = 0 ) |
This method removes a Dynamic Renderer from the drawing surface but does not destroy it. The application is responsible for ensuring that the dynamic renderer is deleted.
There are 4 different ways of deciding if a Dynamic Renderer should be used to render a particular entity - in this order.
featureID | Feature ID of entities that trigger this renderer. -1 if featureID is not relevant in the decision. Default -1 |
layerName | Name of data layer that this renderer applies to. 0 if layer is not relevant in the decision. Default 0 |
const char * TSLDrawingSurfaceBase::featureClass | ( | TSLFeatureID | feature_id | ) |
Convert numeric feature id to feature class name.
The last map data layer added to the drawing surface is searched to provide the mapping between id and class name.
Returns feature class name associated with the given feature id.
feature_id | Feature id being queried. The feature id may be queried from a TSLEntity. |
|
static |
Uses the drawing surface's external and internal pathlists (i.e. that added by calling addPathList, and that created by calling loadStandardConfig, respectively) to search for a file.
filename | The name of the file to search for. |
foundPath | This will be populated with the location that the file is found at. |
bool TSLDrawingSurfaceBase::forceLayer | ( | const char * | data_id, |
const char * | detail_layer_name ) |
Force map layer to display specific detail layer.
This method forces the TSLDrawingSurface to use a specific layer for display purposes, rather than the layer automatically chosen by the TSLDrawingSurface.
data_id | Name of the TSLMapDataLayer when added to the TSLDrawingSurface. |
detail_layer_name | Detail layer name, as specified in the MapLink Processing Tool. |
bool TSLDrawingSurfaceBase::getBackgroundColour | ( | TSLStyleID * | value | ) |
Returns the colour index for background colour.
This method returns the colour index of the background colour that TSLDrawingSurface uses to clear the background area with before the MapLink map data is drawn.
value | Storage for Index into the current colour palette used by the application. If the index is '-1' then there is not current background colour. |
bool TSLDrawingSurfaceBase::getColourValue | ( | int | colour, |
unsigned char & | r, | ||
unsigned char & | g, | ||
unsigned char & | b ) |
Returns the RGB value that corresponds to the given colour index according to the current drawing surface's palette.
If the given colour is an RGB colour and not a colour index, this function is equivalent to using the TSLDecomposeRGB macro.
TSLDataLayer * TSLDrawingSurfaceBase::getDataLayer | ( | const char * | data_id | ) |
Query TSLDataLayer from Drawing Surface.
This method allows the user to query a Data Layer from the Drawing Surface.
Note: Data Layers may be added to more than one Drawing Surface.
data_id | This is the user defined name of the Data Layer to be queried from the Drawing Surface. |
bool TSLDrawingSurfaceBase::getDataLayerInfo | ( | int | N, |
TSLDataLayer ** | dataLayer, | ||
const char ** | layerName ) const |
Query information about a Data Layer.
This method allows the user to get the name & pointer to the Nth TSLDataLayer.
N | the index to the Data Layer. |
dataLayer | a pointer to the Nth Data Layer. |
layerName | the name of the Nth Data Layer. |
bool TSLDrawingSurfaceBase::getDataLayerProps | ( | const char * | data_id, |
TSLPropertyEnum | property_id, | ||
TSLPropertyValue * | old_value ) |
Query properties and flags for Data Layer.
This method allows the user to get the current property value for the TSLDataLayer.
Default values for the properties are documented in TSLPropertyEnum.
data_id | User defined name of a TSLDataLayer. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
property_id | Property to get. |
old_value | Storage for value of this property. |
bool TSLDrawingSurfaceBase::getDeclutterStatus | ( | const char * | feature_name, |
TSLDeclutterStatusResultEnum * | value, | ||
const char * | dataLayerName = 0, | ||
const char * | detailLayerName = 0 ) |
Queries feature decluttering settings for a given feature.
This method gets the visibility status of a feature within the TSLDrawingSurface. The visibility for a feature is either always ON, always OFF, or automatically set by the TSLDrawingSurface based on the current resolution.
Passing a partial feature class name gets the visibility setting for the set of all subclasses. For example, getting "VMAP0.Contour Line (Land)" will return a value of ON if all contour lines are on, OFF if all contour lines are off, AUTOMATIC if all contour lines are automatically decluttered or PARTIAL if the contour lines have a mixture of statuses.
Applications should generally always pass a layer name to this method, as the declutter status of a given feature may be different for each layer that contains that feature.
feature_name | Name of the feature type to get the status from. |
value | Storage for current status. |
dataLayerName | The data layer to get the decluttering for. If this is NULL the declutter status is read from the global declutter list, which may differ from the declutter status of the layers in the drawing surface. |
detailLayerName | The detail layer to get the decluttering for - default to 0 to get the decluttering for all detail layers |
bool TSLDrawingSurfaceBase::getDeclutterStatus | ( | TSLFeatureID | feature_id, |
TSLDeclutterStatusResultEnum * | value, | ||
const char * | dataLayerName, | ||
const char * | detailLayerName = 0 ) |
Queries feature decluttering settings for a given feature by its identifier.
This method gets the visibility status of a feature within the TSLDrawingSurface. The visibility for a feature is either always ON, always OFF, or automatically set by the TSLDrawingSurface based on the current resolution.
When getting the status of a singular feature on a data layer and the feature ID is known then this method is more efficient than the alternative getDeclutterStatus that takes the feature name rather than the feature ID.
feature_id | ID of the feature type to get the status from. |
value | Storage for current status. |
dataLayerName | The data layer to get the decluttering for. This cannot be NULL. |
detailLayerName | the detail layer to get the decluttering for - default to 0 to get the decluttering for all detail layers |
TSLDynamicRenderer * TSLDrawingSurfaceBase::getDynamicRenderer | ( | TSLFeatureID | featureID = -1, |
const char * | layerName = 0 ) |
This method gets a Dynamic Renderer from the drawing surface
There are 4 different ways of deciding if a Dynamic Renderer should be used to render a particular entity - in this order.
featureID | Feature ID of entities that trigger this renderer. -1 if featureID is not relevant in the decision. Default -1 |
layerName | Name of data layer that this renderer applies to. 0 if layer is not relevant in the decision. Default 0 |
bool TSLDrawingSurfaceBase::getFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeBool | attribute, | ||
bool * | result ) const |
Gets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
bool TSLDrawingSurfaceBase::getFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeDouble | attribute, | ||
double * | result ) const |
Gets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
bool TSLDrawingSurfaceBase::getFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeInt | attribute, | ||
int * | result ) const |
Gets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to get |
result | Storage for returned rendering attribute value |
bool TSLDrawingSurfaceBase::getFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributes * | result ) const |
Gets rendering for a specified feature class.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
|
static |
Returns either the loader added by addLoader or the default static loader. If no static loader exists it is created.
int TSLDrawingSurfaceBase::getNumDataLayers | ( | ) | const |
Returns the number of Data Layers attached to this Drawing Surface.
bool TSLDrawingSurfaceBase::getOption | ( | TSLOptionEnum | option | ) |
Query option flag.
option | Enumeration value specifying option to query |
int TSLDrawingSurfaceBase::id | ( | ) | const |
Returns the user drawing surface ID. If no ID has been set, a number less than 0 that uniquely identifies the drawing surface will be returned instead.
void TSLDrawingSurfaceBase::id | ( | int | id_ | ) |
Sets the user drawing surface ID. Negative values are reserved.
id_ | the user drawing surface ID to be set. |
bool TSLDrawingSurfaceBase::idleProcess | ( | ) |
Perform idle processing.
This method should be called by the client application when it is idle to allow MapLink to carry out low priority tasks.
Returns true if MapLink needs more idle time, false if all idle processing is complete.
bool TSLDrawingSurfaceBase::loadDeclutter | ( | const char * | filename | ) |
Load feature decluttering file.
This method allows the user to load a set of declutter data from a given file. Each TSLDrawingSurface may, optionally, declutter features differently from another TSLDrawingSurface.
If addPathList or loadStandardConfig has been called then the pathlist is used to search for the file in suitable directories (using keying), if not then the system Path and the environment variable MAPLINK_PATH are used to search for the file, or alternatively the filename may be fully qualified.
filename | Declutter file name. |
bool TSLDrawingSurfaceBase::loadRendering | ( | const char * | filename | ) |
Load feature rendering file.
This method allows the user to load a set of rendering data from a given file. Each TSLDrawingSurface may, optionally, render data types in different ways from another TSLDrawingSurface.
If addPathList or loadStandardConfig has been called then the pathlist is used to search for the file in suitable directories (using keying), if not then the system Path and the environment variable MAPLINK_PATH are used to search for the file, or alternatively the filename may be fully qualified.
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 neither attribute set nor 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. |
TSLPickResultSet * TSLDrawingSurfaceBase::pick | ( | const char * | data_id, |
TSLDeviceUnits | x, | ||
TSLDeviceUnits | y, | ||
TSLDeviceUnits | aperture, | ||
int | depth = -1, | ||
TSLPickSelector * | selector = 0 ) |
Pick objects from a data layer from specified pixel location.
The detail layers used are the layer for the current drawing surface extent.
This method the specified layer to return a set of TSLPickResult objects which allows the user to determine what objects are contained within the specified pick area.
The TSLPickResultSet for a TSLDrawingSurface 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 whose extents intersect the region. An optional feature name may also be specified.
NOTE:
data_id | ID of the datalayer to pick from. |
(x,y) | The location in pixels of the area to pick. |
aperture | The size in pixels of the area to pick. |
depth | Specifies how deep to look before returning a pointer to an object. If the depth is -1 (the default), individual 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). |
selector | Optional class derived from TSLPickSelector that can be used to further filter the results based on user criteria. |
The return value is a TSLPickResultSet that contains the picked results. This object must be destroyed when finished with.
TSLPickResultSet * TSLDrawingSurfaceBase::pick | ( | TSLDeviceUnits | x, |
TSLDeviceUnits | y, | ||
TSLDeviceUnits | aperture, | ||
int | depth, | ||
TSLPickSelector * | selector = 0 ) |
Pick objects from datalayers from specified pixel location.
The detail layers used are the layer for the current drawing surface extent.
This method requests all layers to return a set of TSLPickResult objects which allows the user to determine what objects are contained within the specified pick area.
The TSLPickResultSet for a TSLDrawingSurface 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 whose extents intersect the region. An optional feature name may also be specified.
NOTE:
(x,y) | The location in pixels of the area to pick. |
aperture | The size in pixels of the area to pick. |
depth | Specifies how deep to look before returning a pointer to an object. If the depth is -1 (the default), individual 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). |
selector | Optional class derived from TSLPickSelector that can be used to further filter the results based on user criteria. |
The return value is a TSLPickResultSet that contains the picked results. This object must be destroyed when finished with.
bool TSLDrawingSurfaceBase::queryActiveLayer | ( | const char * | data_id, |
char * | detail_layer_name, | ||
int | detail_layer_name_size ) |
Query active detail layer from map data layer.
This method gets the name of the current detail layer used by the specified TSLMapDataLayer on the drawing surface. The name is copied into the supplied buffer.
data_id | This is the user defined name of the data layer when it was added to the Drawing Surface, ie. passed to 'addDataLayer'. |
detail_layer_name | Layer name output buffer. |
detail_layer_name_size | Size of the buffer |
bool TSLDrawingSurfaceBase::removeDataLayer | ( | const char * | data_id | ) |
Removes the named Data Layer from the Drawing Surface.
data_id | User defined name of the TSLDataLayer object instance to be removed from the Drawing Surface. |
bool TSLDrawingSurfaceBase::saveDeclutter | ( | const char * | filename, |
TSLMapLinkVersion | ver = TSL_CURRENT_MAPLINK_VERSION ) |
Save feature decluttering file.
This method allows any declutter data that the user has set for a TSLDrawingSurface to be saved to the specified file.
filename | Declutter file name. |
ver | the MapLink version to save as |
bool TSLDrawingSurfaceBase::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 TSLDrawingSurface to be saved to the specified file.
filename | Name of the rendering data file. |
ver | the MapLink version to save as |
bool TSLDrawingSurfaceBase::sendToBack | ( | const char * | move_data_layer | ) |
Move Data Layer to bottom of Drawing Surface display list.
This method allows the specified TSLDataLayer to be placed behind all other attached TSLDataLayer instances attached to this TSLDrawingSurface.
move_data_layer | Name of a TSLDataLayer instance. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
bool TSLDrawingSurfaceBase::sendToBackOf | ( | const char * | move_data_layer, |
const char * | target_data_layer ) |
Move Data Layer behind another Data Layer.
This method allows the display order of the attached TSLDatalayer instances to be modified. The TSLDataLayer object 'move_data_layer' is moved immediately behind the TSLDataLayer object 'target_data_layer'.
move_data_layer | Name of a TSLDataLayer instance. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
target_data_layer | Name of a TSLDataLayer instance. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
bool TSLDrawingSurfaceBase::setBackgroundColour | ( | int | value | ) |
Set colour index for background colour.
This method sets the colour to be used by the TSLDrawingSurface when drawing a background area before the MapLink map data is drawn.
The default for the background colour is either the map background colour (should there be one) or else see the documentation for clearBackgroundColour.
value | Index into the current colour palette used by the application. |
bool TSLDrawingSurfaceBase::setCoordinateProvidingLayer | ( | const char * | layer_name | ) |
Sets the current coordinate providing layer to the one specified.
Once this method has been called with a valid layer name the coordinate providing layer will be fixed until the method is called again or the layer is removed from the drawing-surface.
Passing NULL as the parameter removes the current coordinate providing layer, and the surface uses the default behaviour for selection of a coordinate providing layer.
layer_name | Name of an attached data layer |
bool TSLDrawingSurfaceBase::setDataLayerProps | ( | const char * | data_id, |
TSLPropertyEnum | property_id, | ||
TSLPropertyValue | new_value ) |
Set properties and flags for Data Layer.
This method allows the user to set the properties for the TSLDataLayer. The properties are specific to this Drawing Surface and will not affect any other Drawing Surface that the named Data Layer is displayed in.
Default values for the properties are documented in TSLPropertyEnum.
data_id | User defined name of a TSLDataLayer in this TSLDrawingSurface. This is the 'data_id' parameter that was passed when the TSLDataLayer was added to the TSLDrawingSurface. |
property_id | Property to be set. |
new_value | New value for this property. |
bool TSLDrawingSurfaceBase::setDeclutterStatus | ( | const char * | feature_name, |
TSLDeclutterStatusEnum | value, | ||
const char * | dataLayerName = 0, | ||
const char * | detailLayerName = 0 ) |
Set feature decluttering action for a named feature.
This method sets the visibility of a feature within the TSLDrawingSurface. If the visibility is set to automatic the TSLDrawingSurface will determine when a feature should be made visible or invisible based upon on a resolution factor set in the setDeclutterRange method.
Passing a partial feature class name allows decluttering of the set of all subclasses. For example, decluttering "VMAP0.Contour Line (Land)" will declutter all VMAP0 contour lines.
feature_name | Name of the feature class. |
value | Status value. |
dataLayerName | Name of the layer to set the decluttering on. If this is NULL then the name feature(s) are decluttered on all layers in the drawing surface. |
detailLayerName | name of the detail layer to set the decluttering on - default is 0 to set decluttering for all detail layers in which the feature appears |
bool TSLDrawingSurfaceBase::setDeclutterStatus | ( | TSLFeatureID | feature_id, |
TSLDeclutterStatusEnum | value, | ||
const char * | dataLayerName = 0, | ||
const char * | detailLayerName = 0 ) |
Set feature decluttering action for a feature by its identifier.
This method sets the visibility of a feature within the TSLDrawingSurface. If the visibility is set to automatic the TSLDrawingSurface will determine when a feature should be made visible or invisible based upon on a resolution factor set in the setDeclutterRange method.
If setting the declutter status of a singular feature and the feature ID is known then this method is more efficient than the alternative setDeclutterStatus that takes the feature name instead of the feature ID.
Applications should generally always pass a layer name to this function. Features in different data layers may have the same feature ID associated with different features as feature IDs are only unique to a data layer. Therefore decluttering features by ID across layers may result in a different feature being decluttered in each layer as the ID maps to a different feature name.
feature_id | ID of the feature class. |
value | Status value. |
dataLayerName | Name of the layer to set the decluttering on. If this is NULL, the given feature ID will be decluttered on all layers in the drawing surface. |
detailLayerName | name of the detail layer to set the decluttering on - default is 0 to set decluttering for all detail layers in which the feature appears |
bool TSLDrawingSurfaceBase::setDeclutterStatusOnAllFeatures | ( | TSLDeclutterStatusEnum | value, |
const char * | dataLayerName = 0, | ||
const char * | detailLayerName = 0 ) |
Set feature decluttering action on all features that meet the criteria passed.
This method sets the visibility of a set of features within the TSLDrawingSurface. If the visibility is set to automatic the TSLDrawingSurface will determine when a feature should be made visible or invisible based upon on a resolution factor set in the setDeclutterRange method.
value | Status value. |
dataLayerName | Name of the layer to set the decluttering on. Default is 0 i.e. set for all layers. |
detailLayerName | Name of the detail layer to set the decluttering on - default is 0 to set decluttering for all detail layers in which the feature appears |
bool TSLDrawingSurfaceBase::setFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeBool | attribute, | ||
bool | value ) |
Sets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
bool TSLDrawingSurfaceBase::setFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeDouble | attribute, | ||
double | value ) |
Sets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
bool TSLDrawingSurfaceBase::setFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributeInt | attribute, | ||
int | value ) |
Sets rendering for a specified feature class.
For further information about what attributes are available, see the setRendering methods on TSLEntity.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 |
attribute | Type of rendering attribute to set |
value | New value for rendering attribute |
bool TSLDrawingSurfaceBase::setFeatureRendering | ( | const char * | featureName, |
TSLFeatureID | featureID, | ||
TSLRenderingAttributes * | value ) |
Sets rendering for a specified feature class.
If a name is specified, then all data layers attached to the drawing surface are searched to provide a mapping to ID. They are searched in rendering order from back to front.
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 TSLDrawingSurfaceBase::setFrame | ( | int | style, |
int | colour, | ||
int | thickness ) |
Setup a frame to be drawn around drawing surface.
This frame is drawn once all rendering is complete.
This functionality is not supported in the OpenGL drawing surface.
style | Style for the frame |
colour | Colour of the frame |
thickness | Thickness of the frame |
|
virtual |
Set option bitfield.
option | Enumeration value specifying option to set |
value | New value for option flag. |
Reimplemented in TSL3DDrawingSurface, and TSLAcceleratedSurface.
double TSLDrawingSurfaceBase::TMCperMU | ( | ) |
Query number of TMC units per map unit.
This value is the number of internal TMC co-ordinates per map unit. These is based upon the last map data layer added to the drawing surface.
Returns the TMC units per map unit, 0.0 on error.
TSLDrawingSurfaceTypeEnum TSLDrawingSurfaceBase::type | ( | ) | const |
This method returns the type of the drawing surface.
void * TSLDrawingSurfaceBase::userWord | ( | ) | const |
Returns a pointer to the user data stored on the drawing surface.
void TSLDrawingSurfaceBase::userWord | ( | void * | ptr | ) | const |
Stores a pointer to user data on the drawing surface.
ptr | The pointer to the user data. |
|
protected |