You visualize density plots of vector data with the TLspShapeLayerBuilder in combination with these ALspDensityStyle instances:

The following example visualizes a density plot of some point data:

TLspDensityPointStyle densityPointStyle =
    TLspDensityPointStyle.newBuilder()
                         .pixelSize(10)
                         .build();

TLspLayer layer =
    TLspShapeLayerBuilder.newBuilder()
                         .model(aModel)
                         .bodyStyles(TLspPaintState.REGULAR, densityPointStyle)
                         .build();

resulting in

lls vectorpainting density defaultcolor

In this example, we only adjusted the pixelSize on the builder. Consult the Javadoc to discover the other customization options.

It is not possible to submit a mix of density styles and regular styles. Doing so will result in undefined behavior.

Changing the color mapping

To change the color mapping, submit a TLspIndexColorModelStyle along with the density styles:

TLspDensityPointStyle densityPointStyle =
    TLspDensityPointStyle.newBuilder()
                         .pixelSize(10)
                         .build();

//Create an java.awt.image.IndexColorModel
//Here we use the TLcdIndexColorModel class based on a TLcdColorMap,
//but any IndexColorModel will do
TLcdColorMap colorMap = new TLcdColorMap(new TLcdInterval(0, 255),
                                         new double[]{0.0, 10.0},
                                         new Color[]{
                                             new Color(0, 155, 236),
                                             new Color(255, 255, 255)
                                         });

TLspIndexColorModelStyle indexColorModelStyle =
    TLspIndexColorModelStyle.newBuilder()
                            .indexColorModel(new TLcdIndexColorModel(8, colorMap))
                            .build();

//Specify both the TLspDensityPointStyle and TLspIndexColorModelStyle
TLspLayer layer =
    TLspShapeLayerBuilder.newBuilder()
                         .model(aModel)
                         .bodyStyles(TLspPaintState.REGULAR, densityPointStyle, indexColorModelStyle)
                         .build();

resulting in:

lls vectorpainting density customcolor