Class TLcdDAFIFDataPreparatorMain

java.lang.Object
com.luciad.format.dafif.tools.TLcdDAFIFDataPreparatorMain
All Implemented Interfaces:
ILcdStatusSource

public class TLcdDAFIFDataPreparatorMain extends Object implements ILcdStatusSource
A tool to split large DAFIF files into smaller ones. The division of the DAFIF data is based on the two letter ICAO region found in each record.

Given a directory containing one or more DAFIF files, the TLcdDAFIFDataPreparatorMain class will create a directory tree. The the top directory, that should be specified in the config file, will contain a subdirectory for each ICAO region found in the source data. Each subdirectory contains

  • the records having the ICAO region mentioned in the subdirectory's name, organized in files having 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, containing the relationship between the model objects and their data file names: source.<model object name>File=<file name>

Besides 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 code> i=0 .. number of ICAO regions : an enumeration of all ICAO regions (subdirectories),
  • 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
 

Important remark: If the TLcdDAFIFDataPreparatorMain class is used to split data in a source directory, it will always look for a dafif.toc file in that source directory. The dafif.toc file in the source directory is slightly different from the one in the splitting result. It only 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 (e.g. FILE0 for aerodromes, FILE1 for helipads, ...). In other words, if the file names in the source directory differ from the default files, there should be a dafif.toc file specifying the right names.

Limitations of the splitter: All entities, such as waypoints and routes, are split independently. This means, for example, that when a certain route depends on waypoints not in its own ICAO region, this waypoint will not be available in the waypoint file for this region, and the affected route segments will be omitted from the route.

  • Constructor Details

    • TLcdDAFIFDataPreparatorMain

      public TLcdDAFIFDataPreparatorMain()
  • Method Details

    • addStatusListener

      public void addStatusListener(ILcdStatusListener aListener)
      Adds an ILcdStatusListener, which will be triggered with progress messages during the data preparation process.
      Specified by:
      addStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - an ILcdStatusListener
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aListener)
      Removes the specified status listener.
      Specified by:
      removeStatusListener in interface ILcdStatusSource
      Parameters:
      aListener - an ILcdStatusListener
    • prepareData

      public void prepareData()
      Separates all DAFIF data files found in the source directory over a set of subdirectories. Each subdirectory contains the data located in a certain ICAO region.

      The data in each subdirectory is organized in files like the data in the source directory (same file names are used).

      In addition to data files, the subdirectories will contain .bnd files and .toc files (there is one .bnd file for each data file and only one .toc file for each subdirectory). The .bnd file contains the bounds of the matching data file. The .toc file contains the relationship between model objects and data file names.

      Finally, this method will add a dafif.toc file in the destination directory.

    • setProperties

      public void setProperties(Properties aProperties)
      Specifies a properties object. This properties object should contain
      • the source directory or a directory that can be used as initial directory of a fileChooser,
      • the destination directory,
      • the deviation used when calculating the bounds stored in the .bnd files.
      Parameters:
      aProperties - the properties object to be used during the splitting process
      See Also:
    • isTraceOn

      public static boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • setTraceOn

      public static void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • setWriteBounds

      public static void setWriteBounds(boolean aWriteBounds)
      Specifies whether or not .bnd files should be generated. Defaults to true. Setting this to false results in a performance increase.
    • isWriteBounds

      public static boolean isWriteBounds()
      Indicates whether or not .bnd files will be generated.
    • getDecoderErrorMessages

      public String getDecoderErrorMessages()
      Returns the concatenated error messages of the different decoders used to split the DAFIF data. This message is available (and changed) after each prepareData call.
    • main

      public static void main(String[] args)
      Configures the dataPreparator and starts the data preparing process.

      To configure the dataPreparator, the user should specify the path to a configuration file on the command line. This configuration file should contain the following attributes:

      • filechooser_initial_directory : specifies the base directory for the file chooser that will be used to choose the source directory. The user should define this attribute or the fullall_directory attribute
      • fullall_directory : specifies the path to the source directory. The user should define 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 left most edge will be positioned 1 degree more to the west and the right most edge will be 1 degree more to the east. The same goes for the upper and lower edges.
      Additionally, the user may specify "-noBounds" as the second command line argument. This will disable the output of the .bnd files, which results in a performance increase. The .bnd files are not required by the LuciadLightspeed DAFIF decoders.