Controlling the paint order of objects in a single layer and a single paint representation

Within a single paint representation of a single layer, you can control the order in which objects — or parts of objects — are painted. To do so, you can set the zOrder property on the styles. Styles of the same type are painted from the lowest Z-order to the highest Z-order, so styles with the highest Z-order will be painted on top.

The Z-order works in 2D views.

When you are using a 3D view, the Z-order affects certain cases only. For example, when you are visualizing points using a TLspIconStyle, the Z-order is respected when the icons are draped on the terrain. However, when you are not draping the icons, the painting order is determined by the relative position of the point compared to the camera.

Controlling the paint order between layers and paint representations

You can determine the painting order of layers and their paint representations in a view through an implementation of ILspPaintingOrder. You can retrieve ILspPaintingOrder from an ILspView, or set it on an ILspView.

For most users, the default implementation, TLspPaintingOrder, should be sufficient. It ensures that:

  • Layers are painted in the order of the layer tree in the view.

  • Selected objects are painted on top.

  • Labels appear above the domain object to which they belong.

For more information about implementing custom ordering behavior, see the API documentation of ILspPaintingOrder and TLspPaintingOrder.

An example use case for installing a custom painting order is: layer A is located above layer B in the layer tree of a view. Consequently, you want to ensure that selected objects from layer B are never painted on top of objects from layer A.