Objects may or may not contain altitude or elevation information. In 3D mode, the global terrain is used for the visualization of objects: if an object does not contain information about its altitude, it is draped over 3D terrain as a 2D object. If it does have altitude information, it is displayed as a 3D object.

How objects are painted in the view depends on the ALspStyle you use to paint the object. All Lightspeed styles have an elevation mode. It can be set to the following options:

ON_TERRAIN

The data is draped on the terrain. Any altitude information stored with the objects is ignored. This is a useful elevation mode for painting and styling street data, for example.

ABOVE_TERRAIN

The Z-coordinates in the data are used to set the altitude of an object above the terrain. This mode can be used for painting and styling icons.

ABOVE_ELLIPSOID

The terrain elevation is not taken into account. Only the altitude stored with the objects as used to paint the objects: the Z-coordinates in the data are used to set an object’s altitude above the reference point. You could select this style to paint flight plans, for example, as these objects typically contain such altitude information.

OBJECT_DEPENDENT

The most appropriate mode is chosen based on the object, and the style that is applied to it. This elevation mode is especially convenient when you are writing generic stylers for undetermined data input formats.

In 2D mode, Z-coordinates are always ignored when layers are visualized.

Draping 2D objects over the terrain

2D domain objects in a model can be draped over the 3D terrain for visualization. ILspTerrainSupport provides some utilities for correct draping. These are:

  • getDrapingContext(): converts a TLspContext received by a painter into one that is suitable for use with draped objects. Specifically, it transforms the cursor coordinates in the context to compensate for the presence of the 3D terrain. This is particularly important when you are implementing the isTouchedSFCT() method, for instance.

  • convertFromDrapingContextSFCT() takes a world point as input and computes the corresponding location where that point would end up if it were draped on the terrain.