Class ALcdDAFIFAirspaceDecoder

All Implemented Interfaces:
ILcdDAFIFDecoder, ILcdInputStreamFactoryCapable, ILcdModelDecoder
Direct Known Subclasses:
TLcdDAFIFAirspaceDecoder, TLcdDAFIFSpecialUseAirspaceDecoder

public abstract class ALcdDAFIFAirspaceDecoder extends ALcdDAFIFSingleModelDecoder
This extension of the ALcdDAFIFSingleModelDecoder defines the skeleton of the decode algorithm used to decode DAFIF airspaces and special use airspaces.

Airspace and special use airspace records contain mostly the same information, but the fields do not start at the same positions. That's why the most of the read methods are abstract methods.

Also, the structure of airspaces and special use airspaces is different. Airspaces consist of segments while special use airspaces consist of sectors. Each sector is an airspace, so it consists of segments. That's why the createEditableAirspace method is left as an abstract method.

Extensions of the ALcdDAFIFAirspaceDecoder class allow the user to filter on the airspace operations type. If an airspace type is specified, the model will only contain those airspaces that have the specified filter value as the value of their TYPE feature.

Please remark that if the you want to filter on an airspace type, you have to specify the ILcdAirspaceFeature.TYPE feature in your list of features to be decoded.

  • Field Details

    • FORMAT_1

      protected static final int FORMAT_1
      Record type format 01.
      See Also:
    • FORMAT_2

      protected static final int FORMAT_2
      Record type format 02.
      See Also:
    • FORMAT_3

      protected static final int FORMAT_3
      Record type format 03.
      See Also:
    • FORMAT_4

      protected static final int FORMAT_4
      Record type format 04.
      See Also:
    • FORMAT_5

      protected static final int FORMAT_5
      Record type format 05.
      See Also:
    • FORMAT_6

      protected static final int FORMAT_6
      Record type format 06.
      See Also:
    • fAirspaceFeaturesToBeDecoded

      protected String[] fAirspaceFeaturesToBeDecoded
      The names of the features to be decoded.
  • Constructor Details

    • ALcdDAFIFAirspaceDecoder

      public ALcdDAFIFAirspaceDecoder(Properties aDAFIFProperties)
      Initializes the DAFIFProperties field with the specified properties object. This object may be null.

      If you don't have a properties object here, you can still specify it by decoding a .toc file containing the dafif properties. The decoder will read the properties from the .toc file and look for the data file to be decoded in the directory containing this .toc file.

      Parameters:
      aDAFIFProperties - a Properties object containing for each domain object the name of its data file or NULL
  • Method Details

    • decode

      public ILcdModel decode(String aSource) throws IOException
      Calls the decode method of ALcdDAFIFSingleModelDecoder class. Prints additional information about the number of segments to the log.
      Specified by:
      decode in interface ILcdModelDecoder
      Overrides:
      decode in class ALcdDAFIFSingleModelDecoder
      Parameters:
      aSource - either the directory containing the Dafif source file to decode (if you did not specify a properties file in the constructor, the default file name will be used) or a .toc file containing the Dafif properties (the data file should be in the same directory as the .toc file)
      Returns:
      the model build by reading the file found with aSource
      Throws:
      IOException - if an error occurs during the reading process
      See Also:
    • handleRecord

      protected void handleRecord(int aFormat, char[] aRecord)
      Description copied from class: ALcdDAFIFSingleModelDecoder
      Deals with one record of input.
      Specified by:
      handleRecord in class ALcdDAFIFSingleModelDecoder
      Parameters:
      aFormat - the format of the record
      aRecord - the record
    • setAirspaceTypeToFilter

      public void setAirspaceTypeToFilter(TLcdAirspaceType aAirspaceTypeToFilter)
      Sets the airspace type to be filtered on, i.e., the decode method will only put airspaces of the chosen type in the decoded model.

      If aAirspaceTypeToFilter is null, the decode method will put all airspaces in the model.

      Parameters:
      aAirspaceTypeToFilter - the airspace type to be filtered on
    • setAirspaceFeaturesToBeDecoded

      public void setAirspaceFeaturesToBeDecoded(String[] aAirspaceFeaturesToBeDecoded)
      Specifies the features to be decoded into the model objects.

      Please add the BOUNDARY_IDENTIFICATION feature to your list.

      If you want to filter on an airspace type, you should also include the ILcdAirspaceFeature.TYPE feature into your list.

      Parameters:
      aAirspaceFeaturesToBeDecoded - a list of features that should be decoded into the airspace objects
    • getAirspaceFeaturesToBeDecoded

      protected String[] getAirspaceFeaturesToBeDecoded()
      Returns the features currently selected for decoding into the model objects.
      Returns:
      the features currently selected for decoding into the model objects
      See Also:
    • retrieveAltitudeValue

      protected Float retrieveAltitudeValue(String aAltitudeString)
      Returns a Float representing the numerical value of the given altitude.
      Parameters:
      aAltitudeString - a String representing an altitude
      Returns:
      a Float representing the numerical value of the given altitude
    • retrieveAltitudeUnit

      protected TLcdAltitudeUnit retrieveAltitudeUnit(String aAltitudeString)
      Returns a TLcdAltitudeUnit object representing the unit of the given altitude.
      Parameters:
      aAltitudeString - a String representing an altitude
      Returns:
      a TLcdAltitudeUnit object representing the unit of the given altitude
    • retrieveAltitudeReference

      protected TLcdAltitudeReference retrieveAltitudeReference(String aAltitudeString)
      Returns a TLcdAltitudeReference object representing the reference of the given altitude.
      Parameters:
      aAltitudeString - a String representing an altitude
      Returns:
      a TLcdAltitudeReference object representing the reference of the given altitude
    • createAirspace

      protected abstract ILcdEditableAirspace createAirspace(char[] aRecord)
      Creates and initializes an instance of an implementation of the ILcdEditableAirspace interface.
      Parameters:
      aRecord - the record to retrieve information from
    • handleRecordFmt2

      protected abstract void handleRecordFmt2(char[] aRecord)
      Deals with the information found in a record of format 02.
      Parameters:
      aRecord - a record of format 02
    • readAirspaceUID

      protected abstract String readAirspaceUID(char[] aRecord)
      Reads the unique identifier of an airspace.

      This unique identifier may consist of one or more features. The resulting String object is a concatenation of these feature values.

      Parameters:
      aRecord - the record to read from
      Returns:
      the unique identifier of an airspace
    • readSegmentNumber

      protected abstract int readSegmentNumber(char[] aRecord)
      Reads the segment number.
      Parameters:
      aRecord - the record to read from
      Returns:
      the segment sequence number
    • readLon1FromFmt3

      protected abstract double readLon1FromFmt3(char[] aRecord)
      Reads a segments longitude 1 from a record of format 03.

      Longitude 1 is the longitude of the begin point of the segment w.r.t a user specified geodetic datum.

      Note: we don't need the coordinates of the endpoint, because airspaces are closed. The end point of a segment is the begin point of the next segment.

      Parameters:
      aRecord - the record to read from
      Returns:
      the longitude of the begin point of a segment
    • readLat1FromFmt3

      protected abstract double readLat1FromFmt3(char[] aRecord)
      Reads a segments latitude 1 from a record of format 03.

      Latitude 1 is the latitude of the begin point of the segment w.r.t a user specified geodetic datum.

      Note: we don't need the coordinates of the endpoint, because airspaces are closed. The end point of a segment is the begin point of the next segment.

      Parameters:
      aRecord - the record to read from
      Returns:
      the latitude of the begin point of a segment
    • readGeodeticLon1FromFmt3

      protected abstract double readGeodeticLon1FromFmt3(char[] aRecord)
      Reads a segments geodetic longitude 1 from a aRecord of format 03.

      Geodetic longitude 1 is the longitude of the begin point of the segment w.r.t WGS84.

      Note: we don't need the coordinates of the endpoint, because airspaces are closed. The end point of a segment is the begin point of the next segment.

      Parameters:
      aRecord - the record to read from
      Returns:
      the geodetic longitude of the begin point of a segment
      See Also:
      • readLon1(char[])
    • readGeodeticLat1FromFmt3

      protected abstract double readGeodeticLat1FromFmt3(char[] aRecord)
      Reads a segments geodetic latitude 1 from a aRecord of format 03.

      Latitude 1 is the latitude of the begin point of the segment w.r.t WGS84.

      Note: we don't need the coordinates of the endpoint, because airspaces are closed. The end point of a segment is the begin point of the next segment.

      Parameters:
      aRecord - the record to read from
      Returns:
      the geodetic latitude of the begin point of a segment
      See Also:
      • readLat1(char[])
    • readLon0FromFmt3

      protected abstract double readLon0FromFmt3(char[] aRecord)
      Reads a segments longitude 0 from a record of format 03.

      The longitude 0 is the longitude of the center point of an arc or circle segment w.r.t. a user specified geodetic datum.

      Parameters:
      aRecord - the record to read from
      Returns:
      the longitude of the center point of an arc or circle segment
    • readLat0FromFmt3

      protected abstract double readLat0FromFmt3(char[] aRecord)
      Reads a segments latitude 0 from a record of format 03.

      The latitude 0 is the latitude of the center point of an arc or circle segment w.r.t. a user specified geodetic datum.

      Parameters:
      aRecord - the record to read from
      Returns:
      the latitude of the center point of an arc or circle segment
    • readGeodeticLon0FromFmt4

      protected abstract double readGeodeticLon0FromFmt4(char[] aRecord)
      Reads a segments geodetic longitude 0 from a record of format 04.

      The longitude 0 is the longitude of the center point of an arc or circle segment w.r.t. WGS84.

      Parameters:
      aRecord - the record to read from
      Returns:
      the geodetic longitude of the center point of an arc or circle segment
      See Also:
    • readGeodeticLat0FromFmt4

      protected abstract double readGeodeticLat0FromFmt4(char[] record)
      Reads a segments geodetic latitude from a record of format 04.

      The latitude 0 is the latitude of the center point of an arc or circle segment w.r.t. WGS84.

      Parameters:
      record - the record to read from
      Returns:
      the geodetic latitude of the center point of an arc or circle segment
      See Also:
    • readShapeFromFmt3

      protected abstract char readShapeFromFmt3(char[] aRecord)
      Reads a segments shape from a record of format 03.
      Parameters:
      aRecord - the record to read from
      Returns:
      a character that describes the shape of the segment (circle, arc, geodesic line, ...).
    • readRadius1FromFmt4

      protected abstract float readRadius1FromFmt4(char[] aRecord)
      Reads the radius of an arc or circle segment from a record of format 04.

      All arc and circle segments have a non-empty value for radius 1. If this field is empty or non-numeric, an exception will be thrown.

      Parameters:
      aRecord - the record to read from
      Returns:
      the radius of an arc or circle segment
    • readRadius2FromFmt4

      protected abstract float readRadius2FromFmt4(char[] aRecord)
      Reads radius 2 of an arc or circle segment from a record of format 04.

      This field may be empty.

      Parameters:
      aRecord - the record to read from
      Returns:
      radius 2 of an arc or circle segment
    • readBearing1FromFmt4

      protected abstract float readBearing1FromFmt4(char[] aRecord)
      Reads bearing 1 of an arc or circle segment from a record of format 04.

      This field may be empty.

      Parameters:
      aRecord - the record to read from
      Returns:
      bearing 1 of an arc or circle segment
    • readBearing2FromFmt4

      protected abstract float readBearing2FromFmt4(char[] aRecord)
      Reads bearing 2 of an arc or circle segment from a record of format 04.

      This field may be empty.

      Parameters:
      aRecord - the record to read from
      Returns:
      bearing 2 of an arc or circle segment
    • readNavaidUIDFromFmt4

      protected abstract String readNavaidUIDFromFmt4(char[] aRecord)
      Reads the unique identifier of a navaid.
      Parameters:
      aRecord - the record to read from
      Returns:
      the unique identifier of a navaid