Working with layers already describes the creation of layer lists and hierarchical layer structures, but LuciadLightspeed allows you to control the layers in your view in more advanced ways. To do so, it is useful to first learn more about the specifics of managing layers in a Lightspeed view.

Working with Lightspeed layers?

Layers are the LuciadLightspeed view components that process and group the objects of a model to take care of their visualization. A view typically displays multiple layers, which allows you to have objects from multiple data models on screen.

For more information about the visualization of domain objects, refer to Visualizing domain objects in a Lightspeed view.

Which layer to choose for your model

LuciadLightspeed offers several kinds of Lightspeed layers. Which type of layer you choose depends on what you want to do with the model data in the layer.

The root interface for all layers is ILspLayer. Most likely, you will use one of two default implementations:

  • TLspLayer. Use this layer type to create layers that can paint domain objects, and that allow users to edit those objects. This layer type is the default implementation of ILspInteractivePaintableLayer. It also implements ILspEditableStyledLayer, which lets you use a styler to link styling to the objects in the layer.

  • TLspRasterLayer. Lets you display domain objects such as rasters, multi-level rasters and Earth tilesets. You can define and control the styling of the raster objects. This layer is an implementation of ILspEditableStyledLayer.

The view displays the layers in a certain order. To optimize layer ordering, the view also considers the type of the layer.

There are four pre-defined layer types, represented by ILspLayer.LayerType. The performance of each layer type has been optimized for a specific data type and user interaction level:

  • BACKGROUND: intended for data that rarely changes, and resides in the background of the view. Background layers have been optimized to achieve the best possible performance for static data. To obtain optimal performance for data that changes more frequently, use one of the other layer types in this list.

  • INTERACTIVE: intended for static data that does not change often, but may be manipulated by the user. This layer type is a good choice for layers that are frequently switched on and off, or for layers in which the styling changes often. In the event of user interaction with the layer, the interaction will be smooth.

  • EDITABLE: intended for data that changes more often, because a user can manipulate it extensively, for example vector data that is graphically edited by the application user.

  • REALTIME: intended for data that changes constantly over time, like moving aircraft.

For more information about the visualization of the data in your models, see Visualizing domain objects in a Lightspeed view.

Building a layer

There are many configuration options available to you during the setup of a layer. LuciadLightspeed offers layer builders to construct your layers. These layer builders allow you to specify just those layer aspects that you want to configure. Defaults are chose for the other aspects, so that most of the configuration can be left to the builder. Layer builders let you select:

  • The styling for your objects

  • Whether selection is activated

  • Whether editing is activated

  • Whether labels are visible

  • Whether objects are filtered or not

To construct layers that are well-suited to display shapes, you can use TLspShapeLayerBuilder. By default, the construction of a layer with TLspShapeLayerBuilder results in a ILspInteractivePaintableLayer of the EDITABLE type.

To construct layers that can display raster layers, use TLspRasterLayerBuilder. This builder creates TLspRasterLayer objects. You can choose to set the layer type to either INTERACTIVE or BACKGROUND.