The DAFIF Edition 7 decoders and the DAFIF Edition 8 decoders create the same type of DAFIF objects. Therefore, DAFIF and DAFIFT layers can be created in the same way.

Creating Lightspeed layers for DAFIF data

The TLspDAFIFLayerBuilder is a convenience layer builder for DAFIF and DAFIFT models, as demonstrated by Program: Using the TLspDAFIFLayerBuilder to create a layer for DAFIF data. It is very similar to a regular TLspShapeLayerBuilder and offers many of its configuration options. It makes use of a TLspAISStyler that is configured specifically for the styling of DAFIF object bodies and labels according to the ICAO symbology.

Program: Using the TLspDAFIFLayerBuilder to create a layer for DAFIF data
ILspLayer layer = TLspDAFIFLayerBuilder.newBuilder()
                                       .model(model)
                                       .build();

You can also create your own layer and use it with a TLspAISStyler, as demonstrated in Program: Using the TLspAISStyler to customize styling.

TLspAISStyler uses Symbology Encoding files for the ICAO styling. These files have an .sld extension.

Symbology Encoding is an OGC standard that defines a common XML language for describing styling information. To learn more, see http://www.opengeospatial.org/standards/se.

Defining your own styling

You can also specify your own SE files to style the DAFIF objects. The easiest way to override the default styling of the objects is to define SE styling files with your own styling, and pass those custom SE files to the styler constructor.

There is a default SE styling file available for each DAFIF data type. This means that you can also define custom styling for each data type. To define custom styling for a data type:

  1. Copy the SE styling file for with the default styling definitions for the data type.

  2. Store the file copy in a distinct directory.

  3. Customize the SE styling definitions in the copied file.

  4. Pass the directory with the custom styling file to the styler constructor, as demonstrated in Program: Using the TLspAISStyler to customize styling

Program: Using the TLspAISStyler to customize styling
TLspAISStyler aisStyler = new TLspAISStyler("com/my/symbology/se/", TLspDAFIFLayerBuilder.SYMBOLOGY_ENCODING_FILES_LOCATION);
TLspShapeLayerBuilder.newBuilder()
                     .model(model)
                     .bodyStyler(TLspPaintState.REGULAR, aisStyler)
                     .labelStyler(TLspPaintState.REGULAR, aisStyler)
                     .build();

If you pass a custom styling directory to the AIS styler, it will check this directory first to find a styling file for the data types it needs to style. If the styler finds a styling file for a data type, it will apply the style definitions from that file. Otherwise, the styler goes on to retrieve the default SLD styles in the default styling directory, and the result of Program: Using the TLspAISStyler to customize styling will be identical to the result of Program: Using the TLspDAFIFLayerBuilder to create a layer for DAFIF data.

To define styling for a custom extension of a data type, create a styling file for that custom data type. However, make sure that the name of the base data type is in the file name of the custom styling file. For example, you can define custom styling for a runway data type extension, and name the styling file MyRunwayType.sld file. The styler will then look for this styling file, before proceeding to look for a custom Runway.sld file, and finally a default Runway.sld file.

You can also use code to customize the styling of DAFIF data. This is useful if you want to base your styling on derived data properties, or if you want to take full styling control:

  • Use a custom property retriever: you can plug in an SLD property retriever to calculate derived properties. If you want to style the AIS data based on a property that is not directly available in the data, you can calculate it from properties that are available. Set up a custom SLD property retriever for this, and provide it to the constructor of the AIS styler through the SLD context. For internationalization purposes, you could retrieve the text on the formatted DAFIF object labels, for instance, and translate it. For more information about working with OGC SLD property retrievers and OGC filters, see the LuciadLightspeed developer’s guide.

  • Wrap the styler: you can decorate or override the styler’s style() method to customize the styling in Java. A useful class for this is com.luciad.view.lightspeed.style.styler.ALspStyleCollectorWrapper. It allows you to take full control of styling, and set up styling delegation to different style collectors depending on specific conditions. See the javadoc of this class for more details. The LuciadLightspeed developer’s guide provides more information about the purpose and use of style collectors.

See the javadoc of TLspAISStyler for more details about these custom styling options. For a demonstration, see the ais.lightspeed sample.