Introduction

You can choose between two ways to style vector data based on its properties:

  • You can use regular styles in an ILspStyler: in this approach, the styler decides which styles to use for each object, and submits those styles to the style collector. The styles you can use with the ILspStyler are the regular styles, such as TLspIconStyle, TLspLineStyle, TLspFillStyle, and so on.

  • You can use parameterized styles: the style objects themselves contain the style selection logic in the form of an ILcdExpression, a type of expression that can be evaluated on the GPU.

    As a result, the actual style selection for each object happens on the GPU, leading to significant performance gains.

    The drawback is that parameterized styling offers you fewer styling options than regular styling.

When you use the same, constant style for all objects in your layer, there is no performance distinction between regular styling and parameterized styling.

When to use parameterized styling?

We recommend parameterized styling if the data you want to style fulfills all of the following requirements:

  • You want to style your data based on properties of your domain objects. For example, you want to assign a style to city objects based on their population properties.

  • The properties you want to use for the styling are numbers, boolean values, colors or ILcdPoint instances. Because the property evaluation and style selection happens on the GPU, you are limited to statements that the GPU can evaluate. This means that you can use only numeric properties, and no String properties, for example.

  • The styling parameters are known up-front, and their number is limited. If you need to use parameters in your style, the parameters needs to be known up-front. The number of parameters you can use is also limited. The exact limit is determined by your GPU driver.

When not to use parameterized styling ?

There are a few scenarios where all requirements to use parameterized styling are fulfilled, but where parameterized styling is not the recommended approach.

Large point data sets

We have specialized styling classes for data sets that contain large numbers of points:

  • TLspPointCloudStyle: this class has been designed for the styling of point clouds served through the OGC 3D tiles protocol (PNTS data). You visualize such data through the TLsp3DTileLayerBuilder, which uses TLspPointCloudStyle for styling.

  • TLspPlotStyle: this class has been designed for the styling of large point data sets. A typical example of such data is LIDAR (LAS) data.

    The LuciadLightspeed API offers dedicated layer builder classes for these data sets: TLspPlotLayerBuilder and TLspLIDARLayerBuilder. They use TLspPlotStyle instances for the styling.

    You can only use TLspPlotStyle and the corresponding layer builder classes with static data.

    For dynamic data you will have to use parameterized styling. The parameterized styling API can deal with both dynamic and static data.

Both TLspPointCloudStyle and TLspPlotStyle are very similar to the parameterized style classes. They both use ILcdExpression to define which style to apply to which object.

Adjusting the visibility of objects in large data sets

The parameterized styling API also allows to filter objects, by specifying they should not be visible.

Although this ensures that the objects are not painted, this filtering happens only after the layer requested all data from the model.

When you are working with large data sets, it is best to already set up some coarse-grained filtering up-front, at the model level, and not to use parameterized styling for all the filtering. You do so by specifying a TLcdModelQueryConfiguration on the layer.

By filtering in the model first, you prevent that too much data is loaded, and your application runs out of memory.

When to use regular styling ?

Use regular styling in all situations where you cannot use parameterized styling.