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
ILspStylerare the regular styles, such as
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.
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
ILcdPointinstances. 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.
There are a few scenarios where all requirements to use parameterized styling are fulfilled, but where parameterized styling is not the recommended approach.
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
TLspPlotStyle: this class has been designed for the styling of large point data sets. A typical example of such data is LIDAR (LAS) data.
You can only use
TLspPlotStyleand 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.
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.
See Visualizing large vector data sets on a Lightspeed view and Visualizing large vector data sets on a GXY view for more information about dealing with large data sets.