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

Detailed Description

A drawing surface implementation, which visualises data on a 3D earth model

The Surface3D class is responsible for displaying 2D and 3D data on an earth model, to a window/rendering handle provided by the application.

This class provides the following capabilities

  • Display of 2D data layers (TSLDataLayer), draped over terrain
  • Display of terrain data (TSLTerrainDataBase) as part of the earth model
  • Display of 3D geometry within the scene, from various sources.

Functionality contained within the base Surface class will mostly affect the display of draped 2D layers when using this drawing surface. Most 2D operations may be performed in the same fashion as a 2D-only surface, and will affect the view in a similar manner. setOption is a notable exception - Most options will not be supported as they do not apply within a 3D scene.

The main divergence from 2D concepts within this class is within the 3D Camera class, which allows a virtual camera to be moved around the scene.

Some 2D-focused methods such as setViewedLatLongRange may behave slightly differently.

Internally, the surface uses the WGS84 (EPSG ID: 4326) coordinate system (CS) with a TMCperMU value of 5 million. This is to enable non-CS providing layers to be positioned correctly. The surface coordinate conversion functions use this CS so if a loaded map has a different CS then the coordinate conversion functions on the data layer should be used.

Public Member Functions

 Surface3D ()
 Create a 3D drawing surface.
 
 Surface3D (TSLDeviceContext handle)
 
 Surface3D (TSLWindowHandle handle)
 
 Surface3D (Display *x11Display, Drawable handle)
 
virtual ~Surface3D ()
 Delete the surface.
 
Cameracamera () const
 
bool reset (bool auto_redraw=true)
 
bool resize (double x1, double y1, double x2, double y2, bool auto_redraw=true)
 
bool wndResize (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool auto_redraw=true)
 
void getDUExtent (TSLDeviceUnits *x1, TSLDeviceUnits *y1, TSLDeviceUnits *x2, TSLDeviceUnits *y2) const
 
bool redraw ()
 
bool drawDU (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2, bool clear, bool updateExtentOnly=false)
 
bool DUToLatLong (TSLDeviceUnits x, TSLDeviceUnits y, double *latitude, double *longitude) const
 
bool latLongToDU (double latitude, double longitude, TSLDeviceUnits *x, TSLDeviceUnits *y) const
 
bool TMCToLatLong (TSLTMC x, TSLTMC y, double *latitude, double *longitude) const
 
bool TMCToLatLong (const TSLCoord &coord, GeodeticPoint &latLon) const
 
bool latLongToTMC (double latitude, double longitude, TSLTMC *x, TSLTMC *y) const
 
bool latLongToTMC (const GeodeticPoint &latLon, TSLCoord &coord) const
 
bool geocentricToGeodetic (double x, double y, double z, double &lat, double &lon, double &alt) const
 
GeodeticPoint geocentricToGeodetic (GeocentricPoint coord) const
 
bool geodeticToGeocentric (double lat, double lon, double alt, double &x, double &y, double &z) const
 
GeocentricPoint geodeticToGeocentric (GeodeticPoint coord) const
 
GeocentricDirection geodeticToUpVector (double latitude, double longitude) const
 
bool getDeviceCapabilities (TSLDeviceCapabilities &capabilities) const
 
bool setDeviceCapabilities (const TSLDeviceCapabilities &capabilities)
 
void globeBackgroundColour (TSLRGBA colour)
 
TSLRGBA globeBackgroundColour () const
 
void antiAliasSamples (unsigned int samples)
 
unsigned int antiAliasSamples () const
 
bool addTerrainDatabase (TSLTerrainDatabase &database)
 
TSLTerrainDatabasegetTerrainDatabase (unsigned int i)
 
unsigned int numTerrainDatabases () const
 Query the number of terrain databases used by the surface.
 
bool removeTerrainDatabase (unsigned int i)
 
bool removeTerrainDatabase (TSLTerrainDatabase &database)
 
bool getTerrainHeight (double latitude, double longitude, double &altitude) const
 
void terrainExaggeration (double scalingFactor)
 
double terrainExaggeration () const
 Query the terrain exaggeration factor.
 
void lighting (bool enable)
 
bool lighting () const
 Query whether lighting effects are enabled.
 
void lightPosition (const GeodeticPoint &pos)
 
GeodeticPoint lightPosition () const
 Query the position of the light.
 
void lightDiffuse (const TSLRGBA &col)
 
TSLRGBA lightDiffuse () const
 Query the diffuse colour for the scene's light.
 
void lightAmbient (const TSLRGBA &col)
 
TSLRGBA lightAmbient () const
 Query the ambient colour for the scene's light.
 
bool addTrack (Track &t)
 
bool removeTrack (Track &t)
 
void removeAllTracks ()
 Remove all tracks from the surface.
 
unsigned int numTracks () const
 
TrackgetTrack (unsigned int index) const
 
bool removeTrack (unsigned int index)
 
void dynamicDecluttering (bool enable)
 
bool dynamicDecluttering () const
 Query whether dynamic decluttering is enabled.
 
TrackpickTrack (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture) const
 
TSLPickResultSetpickTracks (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture) const
 
bool addGeometry (geometry::Geometry &geom)
 
bool removeGeometry (geometry::Geometry &f)
 
void removeAllGeometry ()
 Remove all geometry from the surface.
 
unsigned int numGeometries () const
 
geometry::GeometrygetGeometry (unsigned int index) const
 
bool removeGeometry (unsigned int index)
 
geometry::GeometrypickGeometry (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture) const
 
TSLPickResultSetpickGeometries (TSLDeviceUnits x, TSLDeviceUnits y, TSLDeviceUnits aperture) const
 
bool setStyle (const char *styleName, const geometry::Style &s)
 
geometry::Style getStyle (const char *styleName) const
 
bool removeStyle (const char *styleName)
 
unsigned int numStyles () const
 
geometry::Style getStyle (unsigned int index) const
 
const char * styleName (unsigned int index) const
 
bool removeStyle (unsigned int index)
 
bool screenshot (const char *fileName)
 
bool drawToHDC (TSLDeviceContext &hdc, TSLDeviceUnits width, TSLDeviceUnits height)
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ Surface3D() [1/4]

envitia::maplink::earth::Surface3D::Surface3D ( )

Create a 3D drawing surface.

◆ Surface3D() [2/4]

envitia::maplink::earth::Surface3D::Surface3D ( TSLDeviceContext handle)

Create a 3D drawing surface, and attach it to a device context

Parameters
handleThe device context (HDC) to attach the surface to.

◆ Surface3D() [3/4]

envitia::maplink::earth::Surface3D::Surface3D ( TSLWindowHandle handle)

Create a 3D drawing surface, and attach it to a window

Parameters
handleThe window (HWND) to attach the surface to.

◆ Surface3D() [4/4]

envitia::maplink::earth::Surface3D::Surface3D ( Display * x11Display,
Drawable handle )

Create a 3D drawing surface, and attach it to a window

Parameters
displayX11 Display pointer to use.
handleID of X11 window or pixmap to attach to the surface.

◆ ~Surface3D()

virtual envitia::maplink::earth::Surface3D::~Surface3D ( )
virtual

Delete the surface.

Member Function Documentation

◆ addGeometry()

bool envitia::maplink::earth::Surface3D::addGeometry ( geometry::Geometry & geom)

Add geometry to the display.

Note
The application retains ownership of the geometry instance, and is responsible for management of all Geometry instances.
Parameters
geomThe geometry to add
Returns
true if the geometry was added, false otherwise.

◆ addTerrainDatabase()

bool envitia::maplink::earth::Surface3D::addTerrainDatabase ( TSLTerrainDatabase & database)

Add a maplink terrain database to the surface

The provided database will be used as a terrain data source for the 3D earth model, and any 2D layers will be automatically draped over the terrain.

If multiple terrain databases are added they will be queried in the reverse of the order they were added, i.e applications should first add any global, low resolution terrain database, and then add any higher resolution or smaller-extent databases. This will ensure that the highest resolution areas are used as a height source first, and that the lower resolutions will only be used where this data is unavailable.

Parameters
databaseThe terrain database to add. The application retains ownership of the terrain database, and must ensure it is not deleted before the drawing surface.

◆ addTrack()

bool envitia::maplink::earth::Surface3D::addTrack ( Track & t)

Add a track to the display.

Note
The application retains ownership of the track instance, and is responsible for management of all track instances.
Parameters
tThe track to add.
Returns
true if the track was added, false otherwise.

◆ antiAliasSamples() [1/2]

unsigned int envitia::maplink::earth::Surface3D::antiAliasSamples ( ) const

Query the amount of anti-aliasing applied to the view

If set to zero anti-aliasing will be disabled on the drawing surface.

Returns
The number of anti-aliasing (MSAA) samples

◆ antiAliasSamples() [2/2]

void envitia::maplink::earth::Surface3D::antiAliasSamples ( unsigned int samples)

Set the amount of anti-aliasing applied to the view

If enabled anti-aliasing (MSAA) can dramatically improve the visual quality, for a moderate performance cost.

By default anti-aliasing will be set to 4 samples at minimum. There may be some cases where the graphics hardware cannot provide this level.

Applications may override this value as desired, and should provide values which are a power of 2. Setting this value to zero will disable anti-aliasing.

Note
This parameter will primarily affect the rendering of 3D data. Draped 2D layers may not respect this parameter.
Parameters
samplesThe minimum desired number of samples

◆ camera()

Camera & envitia::maplink::earth::Surface3D::camera ( ) const

Access the surface's camera.

The application may modify the camera in order to reposition the view and adjust other visual parameters within the application.

Returns
The camera used by the surface.

◆ drawDU()

bool envitia::maplink::earth::Surface3D::drawDU ( TSLDeviceUnits x1,
TSLDeviceUnits y1,
TSLDeviceUnits x2,
TSLDeviceUnits y2,
bool clear,
bool updateExtentOnly = false )

Redraw the surface to the window/rendering handle.

On Surface3D this method is present for compatibility with the 2D surfaces. If called this method will call redraw(), ignoring all arguments.

Calling this method will perform a draw operation on the surface, and should be called by the application any time the view needs to be refreshed.

For Surface3D the recommended approach is to call redraw regularly, using a rendering loop or timer system. This system may perform other operations such as data loading and event handling during a redraw operation, and is designed to operate primarily in a continuous-render mode.

When called any visible layers will be rendered, and any data within these layers will be rendered according to the current rendering set up.

Returns
true if the surface was redrawn, false otherwise.

◆ drawToHDC()

bool envitia::maplink::earth::Surface3D::drawToHDC ( TSLDeviceContext & hdc,
TSLDeviceUnits width,
TSLDeviceUnits height )

Render a screenshot of the surface to an HDC.

Calling this method will perform a redraw, and render the surface to the provided HDC.

Calling this method will not affect the surface state - The surface will remain attached to the window/render context, and will update the window as part of the call.

This method is only implemented on Windows - The screenshot method provides similar functionality in a platform-independent manner.

Parameters
hdcThe target HDC.
widthThe target's width.
heightThe target's height.
Returns
true if the render was successful, false otherwise.

◆ DUToLatLong()

bool envitia::maplink::earth::Surface3D::DUToLatLong ( TSLDeviceUnits x,
TSLDeviceUnits y,
double * latitude,
double * longitude ) const

Convert from device coordinates to latitude/longitude (WGS84).

Parameters
xThe DU coordinate to convert.
yThe DU coordinate to convert.
latitudeWill be set to the latitude of x,y on the display.
longitudeWill be set to the longitude of x,y on the display.
Returns
true if the conversion was performed, false otherwise.

◆ dynamicDecluttering() [1/2]

bool envitia::maplink::earth::Surface3D::dynamicDecluttering ( ) const

Query whether dynamic decluttering is enabled.

◆ dynamicDecluttering() [2/2]

void envitia::maplink::earth::Surface3D::dynamicDecluttering ( bool enable)

Enable or disable dynamic decluttering.

When dynamic decluttering is enabled the surface will automatically reduce the size and transparency of tracks, symbols, and text in order to reduce visual clutter.

This decluttering capability may be controlled further via:

Parameters
enabletrue to enable dynamic decluttering, false to disable.

◆ geocentricToGeodetic() [1/2]

bool envitia::maplink::earth::Surface3D::geocentricToGeodetic ( double x,
double y,
double z,
double & lat,
double & lon,
double & alt ) const

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

Parameters
xInput geocentric coordinate.
yInput geocentric coordinate.
zInput geocentric coordinate.
latoutput for the converted latitude.
lonoutput for the converted longitude.
altoutput for the converted altitude (in meters).
Returns
true if the conversion was performed, false otherwise.

◆ geocentricToGeodetic() [2/2]

GeodeticPoint envitia::maplink::earth::Surface3D::geocentricToGeodetic ( GeocentricPoint coord) const

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

Parameters
coordInput geocentric coordinate.
Returns
The converted geographic coordinate.

◆ geodeticToGeocentric() [1/2]

bool envitia::maplink::earth::Surface3D::geodeticToGeocentric ( double lat,
double lon,
double alt,
double & x,
double & y,
double & z ) const

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

Parameters
latInput geodetic coordinate.
lonInput geodetic coordinate.
altInput altitude in meters.
xoutput for the converted geocentric coordinate.
youtput for the converted geocentric coordinate.
zoutput for the converted geocentric coordinate.
Returns
true if the conversion was performed, false otherwise.

◆ geodeticToGeocentric() [2/2]

GeocentricPoint envitia::maplink::earth::Surface3D::geodeticToGeocentric ( GeodeticPoint coord) const

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

Parameters
coordInput geodetic coordinate.
Returns
The converted geocentric coordinate.

◆ geodeticToUpVector()

GeocentricDirection envitia::maplink::earth::Surface3D::geodeticToUpVector ( double latitude,
double longitude ) const

Obtain an 'up' vector for a given geodetic point

This method will return a vector in geocentric coordinates, which corresponds to the positive Z axis in geographic space, at the provided lat/lon position.

Parameters
latitudeThe latitude to calculate 'up' at.
longitudeThe longitude to calculate 'up' at.

◆ getDeviceCapabilities()

bool envitia::maplink::earth::Surface3D::getDeviceCapabilities ( TSLDeviceCapabilities & capabilities) const

Returns the device capabilities as determined by the drawing surface, or as passed to setDeviceCapabilities.

Parameters
capabilitiesWill be set to the surface's device capabilities.
Returns
true if the values were populated, false otherwise.

◆ getDUExtent()

void envitia::maplink::earth::Surface3D::getDUExtent ( TSLDeviceUnits * x1,
TSLDeviceUnits * y1,
TSLDeviceUnits * x2,
TSLDeviceUnits * y2 ) const

Query the extent of the surface within the window/rendering handle.

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
x1Storage for top left co-ordinate of the extent.
y1Storage for top left co-ordinate of the extent.
x2Storage for bottom right co-ordinate of the extent.
y2Storage for bottom right co-ordinate of the extent.

◆ getGeometry()

geometry::Geometry * envitia::maplink::earth::Surface3D::getGeometry ( unsigned int index) const

Query a geometry instance from the display.

Parameters
indexThe index of the geometry to query.
Returns
The requested geometry, or null if index >= numGeometries().

◆ getStyle() [1/2]

geometry::Style envitia::maplink::earth::Surface3D::getStyle ( const char * styleName) const

Query a geometry style by name.

If the specified style has not yet been configured a default style will be returned.

Returns
The requested Style, or Style::Style() on error.

◆ getStyle() [2/2]

geometry::Style envitia::maplink::earth::Surface3D::getStyle ( unsigned int index) const

Query a style by index.

Parameters
indexThe index of the style to query.
Returns
The requested Style, or the default style if index >= numStyles().

◆ getTerrainDatabase()

TSLTerrainDatabase * envitia::maplink::earth::Surface3D::getTerrainDatabase ( unsigned int i)

Query a terrain database used by the surface.

Parameters
iThe index of the database to query.
Returns
The requested terrain database, or null on error.

◆ getTerrainHeight()

bool envitia::maplink::earth::Surface3D::getTerrainHeight ( double latitude,
double longitude,
double & altitude ) const

Query the height of the terrain at a given location.

Note
If terrainExaggeration has been set this method will return the exaggerated values.
Parameters
latitudeThe latitude to query (WGS84).
longitudeThe longitude to query (WGS84).
altitudeWill be set to the terrain height in meters.
Returns
true if the height was queried, false otherwise.

◆ getTrack()

Track * envitia::maplink::earth::Surface3D::getTrack ( unsigned int index) const

Query a track instance from the display.

Parameters
indexThe index of the track to query.
Returns
The requested track, or null if index >= numTracks().

◆ globeBackgroundColour() [1/2]

TSLRGBA envitia::maplink::earth::Surface3D::globeBackgroundColour ( ) const

Query the background colour of the globe.

Returns
The background colour of the 3D globe.

◆ globeBackgroundColour() [2/2]

void envitia::maplink::earth::Surface3D::globeBackgroundColour ( TSLRGBA colour)

Set the background colour of the globe.

This method will set the base colour of the 3D globe. This is provided primarily to allow applications to rendering the globe as transparent, or the same as the overall backgroundColour.

This method supports full 32-bit colour, including alpha.

Parameters
colourThe background colour of the 3D globe.

◆ latLongToDU()

bool envitia::maplink::earth::Surface3D::latLongToDU ( double latitude,
double longitude,
TSLDeviceUnits * x,
TSLDeviceUnits * y ) const

Convert from latitude/longitude (WGS84) to device coordinates.

Parameters
latitudeThe latitude to convert.
longitudeThe longitude to convert.
xWill be set to the DU position on the display.
yWill be set to the DU position on the display.
Returns
true if the conversion was performed, false otherwise.

◆ latLongToTMC() [1/2]

bool envitia::maplink::earth::Surface3D::latLongToTMC ( const GeodeticPoint & latLon,
TSLCoord & coord ) const

Convert from latitude/longitude to TMCs.

Unlike the 2D drawing surfaces this surface does not use the concept of a 'coordinate providing layer'. However, internally, the surface uses the WGS84 (EPSG ID: 4326) coordinate system (CS) with a TMCperMU value of 5 million. In order to ensure TMC-based geometry (such as a TSLStandardDataLayer) aligns correctly on the 3D globe the application should perform all coordinate transforms through the Surface3D class. However, if a loaded map has a different CS and that layer is being queried then the application should use the coordinate conversion functions on the data layer instead.

Parameters
latLonThe latitude/longitude to convert. The altitude of this point will be ignored.
coordStorage for the converted TMC coordinate.
Returns
true if the coordinate was converted, false otherwise.

◆ latLongToTMC() [2/2]

bool envitia::maplink::earth::Surface3D::latLongToTMC ( double latitude,
double longitude,
TSLTMC * x,
TSLTMC * y ) const

Convert from latitude/longitude to TMCs.

Unlike the 2D drawing surfaces this surface does not use the concept of a 'coordinate providing layer'. However, internally, the surface uses the WGS84 (EPSG ID: 4326) coordinate system (CS) with a TMCperMU value of 5 million. In order to ensure TMC-based geometry (such as a TSLStandardDataLayer) aligns correctly on the 3D globe the application should perform all coordinate transforms through the Surface3D class. However, if a loaded map has a different CS and that layer is being queried then the application should use the coordinate conversion functions on the data layer instead.

Parameters
latitudeThe latitude to convert.
longitudeThe longitude to convert.
xStorage for the converted TMC coordinate.
yStorage for the converted TMC coordinate.
Returns
true if the coordinate was converted, false otherwise.

◆ lightAmbient() [1/2]

TSLRGBA envitia::maplink::earth::Surface3D::lightAmbient ( ) const

Query the ambient colour for the scene's light.

◆ lightAmbient() [2/2]

void envitia::maplink::earth::Surface3D::lightAmbient ( const TSLRGBA & col)

Set the ambient colour for the scene's light.

Parameters
colThe new ambient colour to use.

◆ lightDiffuse() [1/2]

TSLRGBA envitia::maplink::earth::Surface3D::lightDiffuse ( ) const

Query the diffuse colour for the scene's light.

◆ lightDiffuse() [2/2]

void envitia::maplink::earth::Surface3D::lightDiffuse ( const TSLRGBA & col)

Set the diffuse colour for the scene's light.

Parameters
colThe new diffuse colour to use.

◆ lighting() [1/2]

bool envitia::maplink::earth::Surface3D::lighting ( ) const

Query whether lighting effects are enabled.

◆ lighting() [2/2]

void envitia::maplink::earth::Surface3D::lighting ( bool enable)

Enable or disable lighting effects.

Parameters
enabletrue to enable lighting effects, false to disable.

◆ lightPosition() [1/2]

GeodeticPoint envitia::maplink::earth::Surface3D::lightPosition ( ) const

Query the position of the light.

◆ lightPosition() [2/2]

void envitia::maplink::earth::Surface3D::lightPosition ( const GeodeticPoint & pos)

Set the light position for the scene.

Parameters
posThe new position of the light, in geodetic space.

◆ numGeometries()

unsigned int envitia::maplink::earth::Surface3D::numGeometries ( ) const

Query the number of Geometry instances within the surface.

In most cases applications should add/remove geometry by reference, and should maintain a list of geometry within the application. The application is responsible for managing geometry instances, and adding them to surfaces. The surface will not take ownership of geometry primitives in order to allow them to be displayed in multiple surfaces.

The following methods are provided to allow applications to iterate through the geometry currently added to the surface:

Returns
The number of geometry instances currently added to the surface.

◆ numStyles()

unsigned int envitia::maplink::earth::Surface3D::numStyles ( ) const

Query the number of geometry styles configured on the surface.

In most cases applications should manage styles by name. The following methods are provided to allow applications to iterate through the styles on the surface:

Returns
The number of styles configured on the surface.

◆ numTerrainDatabases()

unsigned int envitia::maplink::earth::Surface3D::numTerrainDatabases ( ) const

Query the number of terrain databases used by the surface.

◆ numTracks()

unsigned int envitia::maplink::earth::Surface3D::numTracks ( ) const

Query the number of tracks within the surface.

In most cases applications should add/remove tracks by reference, and should maintain a list of tracks within the application. The application is responsible for managing track instances, and adding them to surfaces. The surface will not take ownership of tracks in order to allow them to be displayed in multiple surfaces.

The following methods are provided to allow applications to iterate through the tracks currently added to the surface:

Returns
The number of tracks currently added to the surface.

◆ pickGeometries()

TSLPickResultSet * envitia::maplink::earth::Surface3D::pickGeometries ( TSLDeviceUnits x,
TSLDeviceUnits y,
TSLDeviceUnits aperture ) const

Pick geometry from the display.

Note
The returned result set will contain instances of the earth::PickResultGeometry class.
Parameters
xThe x component of the pick location, in display units.
yThe y component of the pick location, in display units.
apertureThe size of the area to pick, in display units.
Returns
A pick result set containing the results. The application must call TSLPickResultSet::destroy when the pick results are finished with.

◆ pickGeometry()

geometry::Geometry * envitia::maplink::earth::Surface3D::pickGeometry ( TSLDeviceUnits x,
TSLDeviceUnits y,
TSLDeviceUnits aperture ) const

Pick a single Geometry from the display.

Parameters
xThe x component of the pick location, in display units.
yThe y component of the pick location, in display units.
apertureThe size of the area to pick, in display units.
Returns
The geometry instance closest to the pick location, or null if no geometry is within the aperture.

◆ pickTrack()

Track * envitia::maplink::earth::Surface3D::pickTrack ( TSLDeviceUnits x,
TSLDeviceUnits y,
TSLDeviceUnits aperture ) const

Pick a single track from the display.

Parameters
xThe x component of the pick location, in display units.
yThe y component of the pick location, in display units.
apertureThe size of the area to pick, in display units.
Returns
The track instance closest to the pick location, or null if no tracks are within the aperture.

◆ pickTracks()

TSLPickResultSet * envitia::maplink::earth::Surface3D::pickTracks ( TSLDeviceUnits x,
TSLDeviceUnits y,
TSLDeviceUnits aperture ) const

Pick tracks from the display.

Note
The returned result set will contain instances of the earth::PickResultTrack class.
Parameters
xThe x component of the pick location, in display units.
yThe y component of the pick location, in display units.
apertureThe size of the area to pick, in display units.
Returns
A pick result set containing the results. The application must call TSLPickResultSet::destroy when the pick results are finished with.

◆ redraw()

bool envitia::maplink::earth::Surface3D::redraw ( )

Redraw the surface to the window/rendering handle.

Calling this method will perform a draw operation on the surface, and should be called by the application any time the view needs to be refreshed.

For Surface3D the recommended approach is to call redraw regularly, using a rendering loop or timer system. This system may perform other operations such as data loading and event handling during a redraw operation, and is designed to operate primarily in a continuous-render mode.

When called any visible layers will be rendered, and any data within these layers will be rendered according to the current rendering set up.

Returns
true if the surface was redrawn, false otherwise.

◆ removeAllGeometry()

void envitia::maplink::earth::Surface3D::removeAllGeometry ( )

Remove all geometry from the surface.

◆ removeAllTracks()

void envitia::maplink::earth::Surface3D::removeAllTracks ( )

Remove all tracks from the surface.

◆ removeGeometry() [1/2]

bool envitia::maplink::earth::Surface3D::removeGeometry ( geometry::Geometry & f)

Remove geometry from the display.

Parameters
geomThe Geometry to remove.
Returns
true if the geometry was removed, false otherwise.

◆ removeGeometry() [2/2]

bool envitia::maplink::earth::Surface3D::removeGeometry ( unsigned int index)

Remove a geometry from the display.

Parameters
indexThe index of the geometry to remove.
Returns
true if the geometry was removed, false otherwise.

◆ removeStyle() [1/2]

bool envitia::maplink::earth::Surface3D::removeStyle ( const char * styleName)

Remove/clear a geometry style.

Parameters
styleNameThe name of the style to remove
Returns
true if the style was cleared, false otherwise.

◆ removeStyle() [2/2]

bool envitia::maplink::earth::Surface3D::removeStyle ( unsigned int index)

Remove a style.

Parameters
indexThe index of the style to remove.
Returns
true if the style was removed, false if index >= numStyles().

◆ removeTerrainDatabase() [1/2]

bool envitia::maplink::earth::Surface3D::removeTerrainDatabase ( TSLTerrainDatabase & database)

Remove a terrain database from the surface.

Parameters
databaseThe database to remove.
Returns
true if the database was removed, false otherwise.

◆ removeTerrainDatabase() [2/2]

bool envitia::maplink::earth::Surface3D::removeTerrainDatabase ( unsigned int i)

Remove a terrain database from the surface.

Parameters
iThe index of the database to remove.
Returns
true if the database was removed, false otherwise.

◆ removeTrack() [1/2]

bool envitia::maplink::earth::Surface3D::removeTrack ( Track & t)

Remove a track from the display.

Parameters
tThe track to remove.
Returns
true if the track was removed, false otherwise.

◆ removeTrack() [2/2]

bool envitia::maplink::earth::Surface3D::removeTrack ( unsigned int index)

Remove a track from the display.

Parameters
indexThe index of the track to remove.
Returns
true if the track was removed, false otherwise.

◆ reset()

bool envitia::maplink::earth::Surface3D::reset ( bool auto_redraw = true)

Reset to full view.

Calling this method will reset the view to display all available data within the surface.

For 3D this will zoom out to view the whole globe, and reset the camera's parameters to a default state.

Parameters
auto_redrawIf true this method will also perform a redraw operation.
Returns
true if the view was reset, false otherwise.

◆ resize()

bool envitia::maplink::earth::Surface3D::resize ( double x1,
double y1,
double x2,
double y2,
bool auto_redraw = true )

Changes displayed extent of map.

When called on Surface3D the surface will mimic the behaviour of the 2D surfaces by pointing the camera towards the ground. Surface3D will represent the provided area as best as possible, however the view may not match the parameters exactly.

Also note that in Surface3D the coordinate provided are always in degrees latitude and longitude, whereas in the 2D surfaces this method handles user units.

Parameters
x1The longitude of the bottom-left coordinate of the view area.
y1The latitude of the bottom-left coordinate of the view area.
x2The longitude of the top-right coordinate of the view area.
y2The latitude of the top-right coordinate of the view area.
auto_redrawIf true this method will also perform a redraw operation.
Returns
true if the view was set, false otherwise.

◆ screenshot()

bool envitia::maplink::earth::Surface3D::screenshot ( const char * fileName)

Take a screenshot of the surface.

Calling this method will perform a redraw, and save a copy of the display to the specified filename.

The extension of the filename will be used to determine the output image format. Most common formats are supported including png, jpeg, and tiff.

Parameters
fileNamethe path to save the screenshot to.
Returns
true if the screenshot was successful, false otherwise.

◆ setDeviceCapabilities()

bool envitia::maplink::earth::Surface3D::setDeviceCapabilities ( const TSLDeviceCapabilities & capabilities)

Set the device capabilities.

The set values are used when drawing items whose dimensions are defined as TSLDimensionUnitsPoints, and may be used by the surface/layers to manage the display of detail layers/sub-layers within the data.

This method only needs to be called it the values need to be adjusted or reset to the default.

The set values will be discarded if attach is called.

Default values are obtained from the underlying drawing system.

On Windows the values can be obtained using the Windows SDK method: GetDeviceCaps.

On X11 targets the values can be obtained using the macros found in Xlib.h: DisplayWidthMM, DIsplayHeightMM, DisplayWidth, DisplayHeight.

If the parameters are all set to zero the method queries the System defaults and sets those values.

Parameters
capabilitiesThe device capabilities to set.
Returns
true if device capabilities were set, false otherwise.

◆ setStyle()

bool envitia::maplink::earth::Surface3D::setStyle ( const char * styleName,
const geometry::Style & s )

Configure a geometry style.

Geometry styles are be specified on a per-surface basis, indexed by style name. When added to the surface Geometry will be rendered based on its styleName attribute.

If no style has been configured for the Geometry then a default style will be used (Style::Style()).

If a style is already configured with the provided name it will be updated.

Parameters
styleNameThe name of the style to set.
sThe styling information.
Returns
true if the style was set, false otherwise.

◆ styleName()

const char * envitia::maplink::earth::Surface3D::styleName ( unsigned int index) const

Query the name of a style.

Parameters
indexThe index of the style to query.
Returns
The name of the requested style, or null if index >= numStyles().

◆ terrainExaggeration() [1/2]

double envitia::maplink::earth::Surface3D::terrainExaggeration ( ) const

Query the terrain exaggeration factor.

◆ terrainExaggeration() [2/2]

void envitia::maplink::earth::Surface3D::terrainExaggeration ( double scalingFactor)

Set the terrain exaggeration factor.

This scaling factor will be applied to the terrain rendering and any height queries.

Parameters
scalingFactorThe terrain scaling factor to set.

◆ TMCToLatLong() [1/2]

bool envitia::maplink::earth::Surface3D::TMCToLatLong ( const TSLCoord & coord,
GeodeticPoint & latLon ) const

Convert from TMCs to latitude/longitude.

Unlike the 2D drawing surfaces this surface does not use the concept of a 'coordinate providing layer'. However, internally, the surface uses the WGS84 (EPSG ID: 4326) coordinate system (CS) with a TMCperMU value of 5 million. In order to ensure TMC-based geometry (such as a TSLStandardDataLayer) aligns correctly on the 3D globe the application should perform all coordinate transforms through the Surface3D class. However, if a loaded map has a different CS and that layer is being queried then the application should use the coordinate conversion functions on the data layer instead.

Parameters
coordThe TMC coordinate to convert.
latLonStorage for the converted latitude coordinate. The altitude of this point will be set to zero.
Returns
true if the coordinate was converted, false otherwise.

◆ TMCToLatLong() [2/2]

bool envitia::maplink::earth::Surface3D::TMCToLatLong ( TSLTMC x,
TSLTMC y,
double * latitude,
double * longitude ) const

Convert from TMCs to latitude/longitude.

Unlike the 2D drawing surfaces this surface does not use the concept of a 'coordinate providing layer'. However, internally, the surface uses the WGS84 (EPSG ID: 4326) coordinate system (CS) with a TMCperMU value of 5 million. In order to ensure TMC-based geometry (such as a TSLStandardDataLayer) aligns correctly on the 3D globe the application should perform all coordinate transforms through the Surface3D class. However, if a loaded map has a different CS and that layer is being queried then the application should use the coordinate conversion functions on the data layer instead.

Parameters
xThe TMC coordinate to convert.
yThe TMC coordinate to convert.
latitudeStorage for the converted latitude coordinate.
longitudeStorage for the converted longitude coordinate.
Returns
true if the coordinate was converted, false otherwise.

◆ wndResize()

bool envitia::maplink::earth::Surface3D::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 drawing surface of a change in size of the attached window handle. If the handle is resized and the surface is not informed then the displayed area may not cover the full window area.

Optionally, the view extent may be adjusted to fit the new window size. The action parameter determines what should happen.

Note
TSLDeviceUnits are typically pixels, however can vary based on platform. For the OpenGL surface 0,0 is the bottom left corner, y positive upwards. For all other drawing surfaces 0,0 is the top-left corner, y positive downwards.
Parameters
x1The top left coordinate if the area to draw, in device units.
y1The top left coordinate if the area to draw, in device units.
x2The bottom right coordinate if the area to draw, in device units.
y2The bottom right coordinate if the area to draw, in device units.
auto_redrawIf true this method will also perform a redraw operation.
Returns
true if the view was updated, false otherwise.