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

Detailed Description

Passive component for displaying 2D and 3D data to a user supplied window. This class is an abstract class, specifying the generic behaviour of a 3D Drawing Surface.

The TSL3DDrawingSurface component is responsible for the display of 2D and 3D data in a window supplied by the end user. As the TSL3DDrawingSurface is passive, there are no inherent event handling routines.

This component provides the following capabilities

  • Drawing and view methods
  • Coordinate Conversions
  • Miscellaneous methods

Other capabilities such as feature rendering, decluttering and style queries are provided by the base TSLDrawingSurfaceBase class and the derived platform specific classes.

A TSL3DDrawingSurface 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 TSL3DDrawingSurface will display 3D data and draped 2D data from any data layers that are connected to it. Layer control is handled by the TSLDrawing SurfaceBase class.

The area of data displayed by the TSLDrawingSurface can be modified by the methods contained on the drawing surface 'camera'. See the documentation of TSL3DCamera for further details.

To redraw a specific area on the TSLDrawingSurface, use 'drawDU'. The user must inform the TSL3DDrawingSurface of any modifications to the window size (in pixels) using the method 'wndResize' so that the TSL3DDrawingSurface can correctly calculate the area to display in the window.

3D Model styles are loaded by the TSLDrawingSurface from a file by calling 'loadStandardConfig' or by an individual call to setupModels' These methods are static and need to be called only per application. To free the memory associated with these configurations, the 'cleanup' static method should be called when an application finishes. References to single styles take the form of an index into the list of styles loaded.

The following is experimental:

Sharing of data layers between multiple 3D drawing surfaces in different threads. For a list of data layers that are safe to share between drawing surfaces please refer to the Threading section of the MapLink Developer's Guide. Note that picking using TSLDrawingSurfaceBase::pick() on these data layers is not thread safe.

Deprecated
Deprecated as of MapLink 11.1. Advised to use MapLink Earth SDK instead.

Public Member Functions

TSL3DCameracamera ()
 
const TSL3DCameracamera () const
 
bool drawDU (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool clear, bool offscreenSurface=false)
 
bool DUToLatLon (const TSLDeviceUnits x, const TSLDeviceUnits y, double &latitude, double &longitude) const
 
void exaggerateTerrain (double asl, double bsl)
 
bool frameRateIdle (bool onOff)
 
bool geocentricToGeodetic (double x, double y, double z, double &lat, double &lon, double &alt) const
 
bool geodeticToGeocentric (double lat, double lon, double alt, double &x, double &y, double &z) const
 
bool geocentricToWorld (double x, double y, double z, double &x1, double &y1, double &z1) const
 
bool geodeticToWorld (double lat, double lon, double alt, double &x, double &y, double &z) const
 
bool get3DOption (TSL3DOptionEnum option) const
 
bool getAnisotropicFilter () const
 
float getAnisotropicFilterLevel () const
 
void getDUExtent (TSLDeviceUnits *x1, TSLDeviceUnits *y1, TSLDeviceUnits *x2, TSLDeviceUnits *y2) const
 
int getFrameRate () const
 
bool getLightingOption (TSL3DLightingOptionEnum option) const
 
void getLODConfiguration (TSL3DLODConfiguration &lodConfiguration) const
 
int getMaxMapTextureCacheSize () const
 
bool getTerrainHeight (double latitude, double longitude, double &altitude) const
 
bool getTerrainRendering (int *wireframeColour, int *solidColour, const char **bitmapFile) const
 
void getTextureCacheSize (int &fontMaxSize, int &symbolMaxSize, int &app6aMaxSize) const
 
bool globalAmbientLight (double red, double green, double blue, double alpha)
 
bool globalAmbientLight (double *red, double *green, double *blue, double *alpha) const
 
bool isMapThreadStopped () const
 
bool queryModelIndices (int **indices, int *num) const
 
void set3DOption (TSL3DOptionEnum option, bool value)
 
void setAnisotropicFilter (bool state)
 
void setFrameRate (int frameRate)
 
void setLightingOption (TSL3DLightingOptionEnum option, bool value)
 
void setAnisotropicFilterLevel (float level)
 
bool setLODConfiguration (const TSL3DLODConfiguration &lodConfiguration)
 
void setMaxMapTextureCacheSize (int cacheInMB)
 
virtual void setOption (TSLOptionEnum option, bool value)
 
bool setRenderingCallback (TSL3DRenderingCallback callback, void *arg)
 
bool setTerrainRendering (int wireframeColour, int solidColour, const char *bitmapFile)
 
void setTextureCacheSize (const int fontMaxSize, const int symbolMaxSize, const int app6aMaxSize)
 
void stopMapThread ()
 
void startMapThread ()
 
void swapBuffers ()
 
bool wndResize (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool auto_redraw=true)
 
virtual ~TSL3DDrawingSurface ()
 
virtual double viewAspect ()
 
bool setTerrainLoadedCallback (TSL3DRenderingCallback callback, void *arg)
 
- Public Member Functions inherited from TSLDrawingSurfaceBase
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)
 
TSLDataLayergetDataLayer (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)
 
TSLDynamicRenderergetDynamicRenderer (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)
 
TSLPickResultSetpick (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture, int depth, TSLPickSelector *selector=0)
 
TSLPickResultSetpick (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)
 
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 loadStandardConfig (const char *path=0)
 
static bool setupModels (const char *filename)
 
- Static Public Member Functions inherited from TSLDrawingSurfaceBase
static bool addLoader (TSLFileLoader *loader)
 
static bool addPathList (TSLPathList *path_list)
 
static bool findFile (const char *filename, TSLSimpleString &foundPath)
 
static TSLFileLoadergetLoader ()
 

Protected Member Functions

 TSL3DDrawingSurface ()
 
- Protected Member Functions inherited from TSLDrawingSurfaceBase
 TSLDrawingSurfaceBase ()
 

Additional Inherited Members

- Protected Attributes inherited from TSLDrawingSurfaceBase
void * m_classID
 

Constructor & Destructor Documentation

◆ ~TSL3DDrawingSurface()

virtual TSL3DDrawingSurface::~TSL3DDrawingSurface ( )
virtual

◆ TSL3DDrawingSurface()

TSL3DDrawingSurface::TSL3DDrawingSurface ( )
inlineprotected

Protected Constructor to prevent direct instantiation

Member Function Documentation

◆ camera() [1/2]

TSL3DCamera * TSL3DDrawingSurface::camera ( )

Query function for the drawing surface camera.

The camera must not be destroyed by the user and will only be valid for the lifetime of the associated drawing surface.

◆ camera() [2/2]

const TSL3DCamera * TSL3DDrawingSurface::camera ( ) const

Query function for the drawing surface camera.

The camera must not be destroyed by the user and will only be valid for the lifetime of the associated drawing surface.

◆ drawDU()

bool TSL3DDrawingSurface::drawDU ( TSLDeviceUnits x1,
TSLDeviceUnits y1,
TSLDeviceUnits x2,
TSLDeviceUnits y2,
bool clear,
bool offscreenSurface = false )

Draw area of map onto drawing surface.

This method requests the TSL3DDrawingSurface to redraw the MapLink data within the area defined by the input co-ordinates. This method may be called whenever a part of the Drawing Surface has been exposed through some action.

Parameters
(x1,y1)Bottom left co-ordinate (in device units) of the area to redraw.
(x2,y2)Top right co-ordinate (in device units) of the area to redraw.
clearIf true this will clear the specified area before drawing any of the data.
offscreenSurfaceIf the destination for the draw is an offscreen rendering surface such as an OpenGL pixel buffer (PBuffer) or framebuffer object (FBO), set this flag to true. This allows for corrections to be applied to the drawing to account for the destination surface being inverted compared
tothe screen. Items that are affected by this flag are
  • Fill styles for 3D entities (TSLRenderingAttributeFillStyle)

If the same drawing surface is being used to draw to both the screen and an offscreen surface notifyChanged() should be called on any data layers within the drawing surface whenever the active render target is changed. Not doing so may cause any necessary corrections to not be applied.

Returns
true on success, false otherwise.

◆ DUToLatLon()

bool TSL3DDrawingSurface::DUToLatLon ( const TSLDeviceUnits x,
const TSLDeviceUnits y,
double & latitude,
double & longitude ) const

Given a Screen X & Y the method calculates the latitude and longitude of the X & Y.

The method takes no account of any terrain database loaded into the 3D (see TSLTerrainLOS for information on how to use the latitude and longitude returned by this method to find an intersection with the terrain).

Parameters
xScreen pixel x position
yScreen pixel y position
latitudereturned latitude
longitudereturned longitude
Returns
true if ok. Otherwise the latitude and longitude are undefined.

The screen x and y must be part of the visible screen.

Note
The pixel screen coordinates are used to calculate the angles in the x and y axis of the near clipping plane given the Field of View of the display.

The angles are used to project a ray from the view frustum eye point to the clipping plane and thus to obtain an x, y, and z intersection with either the plane (Flat earth) or sphere (Ellipsoid Earth).

Given that we are currently using a Sphere for the calculating the intersections with the Earth the accuracy of the intersection will not be particularly high when the viewer is not looking straight down.

◆ exaggerateTerrain()

void TSL3DDrawingSurface::exaggerateTerrain ( double asl,
double bsl )

Set the terrain exaggeration factors.

Parameters
aslThe 'above sea level' exaggeration factor.
bslThe 'below sea level' exaggeration factor.

◆ frameRateIdle()

bool TSL3DDrawingSurface::frameRateIdle ( bool onOff)

Calling this method allows the user to ask MapLink 3D to limit the number of frames per second that are drawn.

The frame rate limiting is done my inserting a small sleep after the swap buffers (swapBuffers) call to the underlying graphics library.

Enabling the frame rate limit means that MapLink 3D attempts to limit the update rate to the rate specified.

MapLink 3D relies upon the user causing a redraw to occur so the frame rate limiting is very much an approximation.

Parameters
onOffenable (true) the frame rate limit or disable (false) the frame rate limit.
Returns
the status of the frame rate limit.

◆ geocentricToGeodetic()

bool TSL3DDrawingSurface::geocentricToGeodetic ( double x,
double y,
double z,
double & lat,
double & lon,
double & alt ) const

This function converts from geocentric coordinates (x, y, z from the centre of the earth in metres) to geodetic coordinates (lat, lon, alt).

Parameters
x,y,zinput geocentric coordinates
lat,lon,altoutput geodetic coordinates
Returnvalue

Error code.

Parameters
Seealso geocentricToGeodetic, geodeticToGeocentric, geocentricToWorld, geodeticToWorld

◆ geocentricToWorld()

bool TSL3DDrawingSurface::geocentricToWorld ( double x,
double y,
double z,
double & x1,
double & y1,
double & z1 ) const

This function converts from geocentric coordinates (x, y, z from the centre of the earth in metres) to World coordinates (coordinates for use with the underlying 3D drawing API).

Note: Do not store the World coordinate values as they will change with altitude.

Parameters
x,y,zinput geocentric coordinates
x1,y1,z1output World coordinates
Returnvalue

Error code.

Parameters
Seealso geocentricToGeodetic, geodeticToGeocentric, geocentricToWorld, geodeticToWorld

◆ geodeticToGeocentric()

bool TSL3DDrawingSurface::geodeticToGeocentric ( double lat,
double lon,
double alt,
double & x,
double & y,
double & z ) const

This function converts from geodetic coordinates (lat, lon, alt) to geocentric coordinates (x, y, z from the centre of the earth in metres).

Parameters
lat,lon,altinput geodetic coordinates
x,y,zoutput geocentric coordinates
Returnvalue

Error code.

Parameters
Seealso geocentricToGeodetic, geodeticToGeocentric, geocentricToWorld, geodeticToWorld

◆ geodeticToWorld()

bool TSL3DDrawingSurface::geodeticToWorld ( double lat,
double lon,
double alt,
double & x,
double & y,
double & z ) const

This function converts from geodetic coordinates (lat, lon, alt) to World coordinates (coordinates for use with the underlying 3D drawing API).

Note: Do not store the World coordinate values as they will change with altitude.

Parameters
lat,lon,altinput geodetic coordinates
x,y,zoutput World coordinates
Returnvalue

Error code.

Parameters
Seealso geocentricToGeodetic, geodeticToGeocentric, geocentricToWorld, geodeticToWorld

◆ get3DOption()

bool TSL3DDrawingSurface::get3DOption ( TSL3DOptionEnum option) const

Query option flag.

Parameters
optionEnumeration value specifying option to query
Returns
the specified options flag for the behaviour of the TSL3DDrawing Surface.

◆ getAnisotropicFilter()

bool TSL3DDrawingSurface::getAnisotropicFilter ( ) const

Queries the Anisotropic filter state.

◆ getAnisotropicFilterLevel()

float TSL3DDrawingSurface::getAnisotropicFilterLevel ( ) const

This method gets the anisotropic filter level

◆ getDUExtent()

void TSL3DDrawingSurface::getDUExtent ( TSLDeviceUnits * x1,
TSLDeviceUnits * y1,
TSLDeviceUnits * x2,
TSLDeviceUnits * y2 ) const

Query extent of window.

This method allows the user to query the extent of the window handle currently displayed in terms of device units. This is the same extent that will have been passed in the last call to 'wndResize'.

Parameters
(x1,y1)Storage for top left co-ordinate of the extent in device units.
(x2,y2)Storage for bottom right co-ordinate of the extent in device units.

◆ getFrameRate()

int TSL3DDrawingSurface::getFrameRate ( ) const

Gets the display frame rate limit.

Enabling the frame rate limit means that MapLink 3D attempts to limit the update rate to the rate specified.

MapLink 3D relies upon the user causing a redraw to occur so the frame rate limiting is an approximation.

Returns the number of frames per second MapLink 3D is limiting too.

◆ getLightingOption()

bool TSL3DDrawingSurface::getLightingOption ( TSL3DLightingOptionEnum option) const

Query option flag.

Parameters
optionEnumeration value specifying option to query
Returns
the specified options flag for the behaviour of the TSL3DDrawing Surface.

◆ getLODConfiguration()

void TSL3DDrawingSurface::getLODConfiguration ( TSL3DLODConfiguration & lodConfiguration) const

Returns the Level Of Detail current configuration.

Parameters
lodConfigurationreturned LOD configuration.

◆ getMaxMapTextureCacheSize()

int TSL3DDrawingSurface::getMaxMapTextureCacheSize ( ) const

Returns the size in MB of the map texture cache.

A value of 0 indicates that there is no limit imposed on the number of textures allocated. This should be fine for cards with 256MB of graphics memory.

Cards with less then 256MB should work as the OpenGL driver should swap out textures to main memory.

◆ getTerrainHeight()

bool TSL3DDrawingSurface::getTerrainHeight ( double latitude,
double longitude,
double & altitude ) const

Returns the altitude of the latitude and longitude specified, taking into account any terrain loaded.

Parameters
latitudelatitude in degrees
longitudelongitude in degrees
altreturned altitude in meters
Returns
true if ok, false otherwise.

◆ getTerrainRendering()

bool TSL3DDrawingSurface::getTerrainRendering ( int * wireframeColour,
int * solidColour,
const char ** bitmapFile ) const

Query the rendering for Terrain when no draped layers are available.

Parameters
typeStorage for type of terrain rendering
wireframeColourColour for wireframe rendering, typically index into tslcolours.dat
solidColourColour for solid rendering, typically index into tslcolours.dat
bitmapFileStorage for name of bitmap file for bitmap rendering.

If solid rendering is in use, then bitmapFile will be 0.

Returns
true on success, false otherwise.

◆ getTextureCacheSize()

void TSL3DDrawingSurface::getTextureCacheSize ( int & fontMaxSize,
int & symbolMaxSize,
int & app6aMaxSize ) const

This method allows the user to query the maximumTexture cache size in MB.

Parameters
fontMaxSizecache size for texture fonts.
symbolMaxSizecache size for standard symbols
app6aMaxSizecache size for APP6A composite symbols

◆ globalAmbientLight() [1/2]

bool TSL3DDrawingSurface::globalAmbientLight ( double * red,
double * green,
double * blue,
double * alpha ) const

Return global ambient light colour.

Default is a dull grey (0.2, 0.2, 0.2).

Parameters
redred component of global ambient light colour, value between 0 and 1
greengreen component of global ambient light colour, value between 0 and 1
blueblue component of global ambient light colour, value between 0 and 1
alphaalpha component of global ambient light colour to set, value between 0 and 1

◆ globalAmbientLight() [2/2]

bool TSL3DDrawingSurface::globalAmbientLight ( double red,
double green,
double blue,
double alpha )

Set global ambient light colour.

Default is a dull grey (0.2, 0.2, 0.2).

Parameters
redred component of global ambient light colour to set, value between 0 and 1
greengreen component of global ambient light colour to set, value between 0 and 1
blueblue component of global ambient light colour to set, value between 0 and 1
alphaalpha component of global ambient light colour to set, value between 0 and 1

◆ isMapThreadStopped()

bool TSL3DDrawingSurface::isMapThreadStopped ( ) const

Queries if the background map thread is stopped.

Returns true if stopped, false if running.

◆ loadStandardConfig()

static bool TSL3DDrawingSurface::loadStandardConfig ( const char * path = 0)
static

Loads the 3D related tsl*.dat files with the default names into all drawing surfaces. This is equivalent to firstly adding a pathlist configured to find data files, fonts, symbols and so on in the default subdirectories (e.g. addKeyedDirectory(root+"model", 0, ".3ds", TSLCompressedDefault) ),

and secondly calling:

setupModels( "tsl3dmodels.dat" ) ;

Parameters
pathIf supplied, this is the path from which the configuration files are to be loaded. If null, then the files are assumed to be present in the \config subdirectory of the maplink installation on the local machine (whose location is found using TSLUtilityFunctions::getMapLinkHome())
Returns
true if successful, false otherwise.

◆ queryModelIndices()

bool TSL3DDrawingSurface::queryModelIndices ( int ** indices,
int * num ) const

Query Model indices.

Parameters
indicesStorage for pointer to indices. Populated if successful.
numStorage for number of indices in array.
Returns
true if the arguments were populated, false otherwise.

◆ set3DOption()

void TSL3DDrawingSurface::set3DOption ( TSL3DOptionEnum option,
bool value )

Set option bitfield.

Parameters
optionEnumeration value specifying option to query
valueNew value for option flag.

◆ setAnisotropicFilter()

void TSL3DDrawingSurface::setAnisotropicFilter ( bool state)

This method sets the anisotropic filter state.

Anisotropic filtering can be used to improve the quality of the displayed map data by reducing the swimming effect of textures displayed in the distance.

Turning on anisotropic filtering will impact performance. The amount of impact will depend on the level of anisotropic filtering applied and the graphics card being used.

Parameters
statetrue turn on the anisotropic filter, false turn the filter off.

◆ setAnisotropicFilterLevel()

void TSL3DDrawingSurface::setAnisotropicFilterLevel ( float level)

This method sets the anisotropic filter level

Anisotropic filtering can be used to improve the quality of the displayed map data by reducing the swimming effect of textures displayed in the distance.

Turning on anisotropic filtering will impact performance. The amount of impact will depend on the level of anisotropic filtering applied and the graphics card being used.

A value of 1.0 means that the filtering will not be applied.

The maximum value that can be set is dependent on the graphics driver.

If a value less then 1.0 or greater then the maximum is set then the level is limited.

Parameters
levelAnisotropic filter level.

◆ setFrameRate()

void TSL3DDrawingSurface::setFrameRate ( int frameRate)

Sets the display frame rate to aim for,

Enabling the frame rate limit means that MapLink 3D attempts to limit the update rate to the rate specified.

MapLink 3D relies upon the user causing a redraw to occur so the frame rate limiting is an approximation.

The frame rate limit must be set on (see frameRateIdle).

Parameters
frameRatenumber of frames per second to limit the redrawing too.

◆ setLightingOption()

void TSL3DDrawingSurface::setLightingOption ( TSL3DLightingOptionEnum option,
bool value )

Set lighting option bitfield.

Parameters
optionenumeration value specifying option to set
valuenew value

◆ setLODConfiguration()

bool TSL3DDrawingSurface::setLODConfiguration ( const TSL3DLODConfiguration & lodConfiguration)

Sets the Level Of Detail Configuration parameters.

Parameters
lodConfigurationconfiguration required.
Returns
true if ok, false otherwise.

◆ setMaxMapTextureCacheSize()

void TSL3DDrawingSurface::setMaxMapTextureCacheSize ( int cacheInMB)

Sets the size in MB of the map texture cache.

A value of 0 indicates that there is no limit imposed on the number of textures allocated. This should be fine for cards with 256MB of graphics memory. However this is very dependent on how many fonts, symbols and application textures are used.

Cards with less then 256MB should work as the OpenGL driver should swap out textures to main memory.

If problems occur (such as missing textures or OpenGL errors) then a limit should be imposed. If you do not have a problem then leave on the default as performance will be affected.

Note: The cache will basically unload textures which have not been used in the previous display 60 frames.

Parameters
cacheInMBmaximum map texture cache size in MB.

◆ setOption()

virtual void TSL3DDrawingSurface::setOption ( TSLOptionEnum option,
bool value )
virtual

Set option bitfield.

Parameters
optionEnumeration value specifying option to query
valueNew value for option flag.

Reimplemented from TSLDrawingSurfaceBase.

◆ setRenderingCallback()

bool TSL3DDrawingSurface::setRenderingCallback ( TSL3DRenderingCallback callback,
void * arg )

Register a callback to be triggered when draped data is ready to be rendered.

The 3D Drawing Surface renders 2D draped information in a background thread. This callback is triggered when the background thread has new information ready to be draped.

The function called should trigger a redraw of drawing surface. However since the callback will be called from the background thread, it must not call the draw method directly unless the application has locked out any redraw calls in the main thread. Typically a message is posted to the view which is picked up by the main thread message handler.

Arguments :

callback: Pointer to callback function. See TSL3DRenderingCallback for signature

arg: Application argument passed to callback.

◆ setTerrainLoadedCallback()

bool TSL3DDrawingSurface::setTerrainLoadedCallback ( TSL3DRenderingCallback callback,
void * arg )

experimental

◆ setTerrainRendering()

bool TSL3DDrawingSurface::setTerrainRendering ( int wireframeColour,
int solidColour,
const char * bitmapFile )

Set the rendering for Terrain when no draped layers are available.

Parameters
wireframeColourColour for wireframe rendering, typically index into tslcolours.dat
solidColourColour for solid rendering, typically index into tslcolours.dat
bitmapFileName of bitmap file for bitmap rendering.

If solid rendering is required, then set bitmapFile to 0.

Returns
true on success, false otherwise.

◆ setTextureCacheSize()

void TSL3DDrawingSurface::setTextureCacheSize ( const int fontMaxSize,
const int symbolMaxSize,
const int app6aMaxSize )

This method allows the user to set the maximum Texture cache size in MB.

Parameters
fontMaxSizecache size for texture fonts.
symbolMaxSizecache size for standard symbols.
app6aMaxSizecache size for APP6A composite symbols.

◆ setupModels()

static bool TSL3DDrawingSurface::setupModels ( const char * filename)
static

Load 3D model definition file.

This method allows the user to set up the list of models that will be used by all TSL3DDrawingSurfaces.

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.

Note: this need to be done only once per application. Calling this more than once will not have any effects on the original symbol list.

Parameters
filenameName of the models file.
Returns
true on success, false otherwise.

◆ startMapThread()

void TSL3DDrawingSurface::startMapThread ( )

Start the background map rendering thread.

◆ stopMapThread()

void TSL3DDrawingSurface::stopMapThread ( )

Stops the background map rendering thread.

You would normally stop the thread if you wished to edit the contents of a layer.

You should keep the time you have the thread stopped as short as possible.

Adding and removing a layer is thread safe.

Making the layer invisible is also a sensible approach while the layer is edited. This should be done in conjunction with stopping the thread to ensure that the layer is not still being referenced in the background thread.

Locking is kept to a minimum within MapLink to ensure that performance is not affected.

◆ swapBuffers()

void TSL3DDrawingSurface::swapBuffers ( )

Swaps the drawing buffers.

◆ viewAspect()

virtual double TSL3DDrawingSurface::viewAspect ( )
virtual

Returns the aspect ratio of the view

◆ wndResize()

bool TSL3DDrawingSurface::wndResize ( TSLDeviceUnits x1,
TSLDeviceUnits y1,
TSLDeviceUnits x2,
TSLDeviceUnits y2,
bool auto_redraw = true )

The user application should call this function on a window resize.

This methods informs the TS3DLDrawingSurface of a change in size of the attached window handle. If the handle is resized and the TSLDrawingSurface is not informed then the displayed area will remain the same though it may be clipped if the attached handle is reduced in size. All input co-ordinates are given in device units; this is typically in pixels.

Note: when the Drawing Surface is first attached to a handle it must be given the co-ordinates of the area that it is to display. This is not necessarily the full area of the handle.

Parameters
(x1,y1)Top left co-ordinate (in device units) of the area to draw. For device units 0,0 is the top-left corner, y positive downwards.
(x2,y2)Bottom right co-ordinate (in device units) of the area to draw. For device units 0,0 is the top-left corner, y positive downwards.

auto_redraw If true, will result in the whole drawing surface area being redrawn.

Returns
true on success, false otherwise.