This guide shows how to decode DAFIF data defined according to the Edition 7 specifications.

More information on individual classes can be found in the javadoc under com.luciad.format.dafif.

In most cases, you can simply decode the data using TLcdDAFIFModelDecoder, and create a layer using TLspDAFIFLayerBuilder (for Lightspeed views) or TLcdDAFIFDefaultLayerFactory (for GXY views).

Preparing DAFIF data

What does 'preparing' DAFIF data mean?

DAFIF data files may be very large. Decoding these large files is time-consuming and unnecessary if you are interested in just a small part of it.

Therefore, DAFIF provides a class, the TLcdDAFIFDataPreparatorMain class, which is able to divide large data files into smaller ones. This division is based on the ICAO region found in the records. This class is also provided as a sample, in samples/decoder/dafif/datapreparator.

Given a directory containing one or more DAFIF files, the TLcdDAFIFDataPreparatorMain class will create a new directory tree, starting from the path specified in the configuration file for the data preparation. For more information, see How to prepare DAFIF data?.

The root of the tree will contain a sub-directory for each ICAO region found in the source data. Each sub-directory contains:

  • The records containing the ICAO region of the sub-directory name. The records are organized in files with the same names as the source files.

  • For each data file, a matching .bnd file containing the bounds surrounding the data in the data file

  • A file named dafif_<ICAO region>.toc, specifying the relationship between the model objects and their data file names: source.< model object name >File=< file name>.

In addition to reorganizing a given data set and calculating bounds, the TLcdDAFIFDataPreparatorMain class also writes a dafif.toc file into the top directory.The dafif.toc file is a properties file containing:

  • ICAO.regioni= < ICAO region > i=0 .. number of ICAO regions : an enumeration of all ICAO regions (sub-directories),

  • source.< model object name> File= < file name > : for each model object the name of its data file.

The result of running the TLcdDAFIFDataPreparatorMain class will look like this:

  - < split_directory >
    - AG
      FILE0
      FILE0.bnd
      FILE2
      FILE2.bnd
      ...
      dafif_AG.toc
    - AN
      FILE0
      FILE0.bnd
      FILE2
      FILE2.bnd
      ...
      dafif_AN.toc
    ...
    dafif.toc

How to prepare DAFIF data?

To prepare DAFIF data, you need to check two things:

  • The DAFIF data preparator needs a configuration file.

  • The source directory may have to include a .toc file.

Setting up the configuration file

You must specify the path to the configuration file as a program parameter when running the TLcdDAFIFDataPreparatorMain. The configuration file must contain the following attributes:

  • filechooser_initial_directory: specifies the base directory for the file chooser. It will be used to choose the source directory. You either define this attribute, or the fullall_directory attribute.

  • fullall_directory: specifies the path to the source directory. Define either this attribute, or the filechooser_initial_directory attribute.

  • split_directory : specifies the top directory for the result of the splitting process.

  • bounds_deviation: specifies the number of degrees used to enlarge the bounds stored in the .bnd files in both horizontal and vertical directions. A bounds_deviation of 1 means that the leftmost edge will be positioned 1 degree more to the west and the rightmost edge will be 1 degree more to the east. The same applies to the upper and lower edges.

Adding the .toc file in the source directory

AIS assumes that the DAFIF files are by default named as follows: FILE0, FILE1, FILE2, FILE3, FILE4, FILE5, FILE6, FILE7, FILE8, FILE9, FILE10, FILE11, FILE12, FILE13, FILE14 and FILE15.

If the file names in the source directory differ from these default file names, the source directory should contain a .toc file. Such a .toc file, dafif.toc for example, contains the file name for each model object: source.<model object name>File=<file name>. If the source directory does not contain a dafif.toc file, the default file names for DAFIF data will be used: for example, FILE0 for aerodromes, FILE1 for helipads, and so on.

Decoding DAFIF data

The TLcdDAFIFModelDecoder can decode a single DAFIF file, FILE0 for example. It can also handle a directory that contains DAFIF files: it creates a model tree node with a model for each file.

If you need more control over the decoding, such as filtering, you can use one of the decoders for specific types. These decoder classes are located in the package com.luciad.format.dafift.decoder.

The following decoders are currently provided in the decoder sub-package:

Some of these decoders require that a number of models are set on the decoder before decoding can start. The reason for this is that an ATS route, for instance, refers to a number waypoints which must be known during the decode process.

For these decoders, extensions that do not require such models to be set beforehand, are available. They have the prefix Independent in their names. These independent decoders will decode any necessary data, such as waypoints, before starting to decode themselves. The following independent decoders are provided:

When a DAFIF file is decoded successfully, the specific decoder returns an ILcdModel containing the decoded objects.

Filtering DAFIF data

DAFIF data can be filtered in two ways:

The ILcdBounds filter

By calling the setDecodingBounds method on an ILcdDAFIFDecoder, you can specify filter bounds. When decoding a DAFIF data file with the configured DAFIF decoder, this decoder will only put an object in the resulting model if the bounds of the object interact with the specified bounds. If no bounds are specified on a decoder, all objects will be inserted into the model.

The ILcdDAFIFModelFilter

You can specify an ILcdDAFIFModelFilter using the setDAFIFModelFilter of the ILcdDAFIFDecoder interface. When decoding a DAFIF data file with the configured DAFIF decoder, this decoder will only put an object in the resulting model, if the object passes through the specified filter. If no ILcdDAFIFModelFilter are specified on a decoder, all objects will be inserted into the model.

A filter example is supplied with the sample source code. It accepts objects with a certain feature value. You can find the source code, DAFIFModelFeatureFilter, under samples/decoder/dafif.