Class ALcdDAFIFAirspaceDecoder
- All Implemented Interfaces:
ILcdDAFIFDecoder
,ILcdInputStreamFactoryCapable
,ILcdModelDecoder
- Direct Known Subclasses:
TLcdDAFIFAirspaceDecoder
,TLcdDAFIFSpecialUseAirspaceDecoder
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 Summary
Modifier and TypeFieldDescriptionprotected String[]
The names of the features to be decoded.protected static final int
Record type format 01.protected static final int
Record type format 02.protected static final int
Record type format 03.protected static final int
Record type format 04.protected static final int
Record type format 05.protected static final int
Record type format 06.Fields inherited from class com.luciad.format.dafif.decoder.ALcdDAFIFDecoder
DAFIF_PROP_EXTENSION, fRecordCount
-
Constructor Summary
ConstructorDescriptionALcdDAFIFAirspaceDecoder
(Properties aDAFIFProperties) Initializes the DAFIFProperties field with the specified properties object. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ILcdEditableAirspace
createAirspace
(char[] aRecord) Creates and initializes an instance of an implementation of theILcdEditableAirspace
interface.Calls the decode method ofALcdDAFIFSingleModelDecoder
class.protected String[]
Returns the features currently selected for decoding into the model objects.protected void
handleRecord
(int aFormat, char[] aRecord) Deals with one record of input.protected abstract void
handleRecordFmt2
(char[] aRecord) Deals with the information found in a record of format 02.protected abstract String
readAirspaceUID
(char[] aRecord) Reads the unique identifier of an airspace.protected abstract float
readBearing1FromFmt4
(char[] aRecord) Reads bearing 1 of an arc or circle segment from a record of format 04.protected abstract float
readBearing2FromFmt4
(char[] aRecord) Reads bearing 2 of an arc or circle segment from a record of format 04.protected abstract double
readGeodeticLat0FromFmt4
(char[] record) Reads a segments geodetic latitude from a record of format 04.protected abstract double
readGeodeticLat1FromFmt3
(char[] aRecord) Reads a segments geodetic latitude 1 from a aRecord of format 03.protected abstract double
readGeodeticLon0FromFmt4
(char[] aRecord) Reads a segments geodetic longitude 0 from a record of format 04.protected abstract double
readGeodeticLon1FromFmt3
(char[] aRecord) Reads a segments geodetic longitude 1 from a aRecord of format 03.protected abstract double
readLat0FromFmt3
(char[] aRecord) Reads a segments latitude 0 from a record of format 03.protected abstract double
readLat1FromFmt3
(char[] aRecord) Reads a segments latitude 1 from a record of format 03.protected abstract double
readLon0FromFmt3
(char[] aRecord) Reads a segments longitude 0 from a record of format 03.protected abstract double
readLon1FromFmt3
(char[] aRecord) Reads a segments longitude 1 from a record of format 03.protected abstract String
readNavaidUIDFromFmt4
(char[] aRecord) Reads the unique identifier of a navaid.protected abstract float
readRadius1FromFmt4
(char[] aRecord) Reads the radius of an arc or circle segment from a record of format 04.protected abstract float
readRadius2FromFmt4
(char[] aRecord) Reads radius 2 of an arc or circle segment from a record of format 04.protected abstract int
readSegmentNumber
(char[] aRecord) Reads the segment number.protected abstract char
readShapeFromFmt3
(char[] aRecord) Reads a segments shape from a record of format 03.protected TLcdAltitudeReference
retrieveAltitudeReference
(String aAltitudeString) Returns aTLcdAltitudeReference
object representing the reference of the given altitude.protected TLcdAltitudeUnit
retrieveAltitudeUnit
(String aAltitudeString) Returns aTLcdAltitudeUnit
object representing the unit of the given altitude.protected Float
retrieveAltitudeValue
(String aAltitudeString) Returns aFloat
representing the numerical value of the given altitude.void
setAirspaceFeaturesToBeDecoded
(String[] aAirspaceFeaturesToBeDecoded) Specifies the features to be decoded into the model objects.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.Methods inherited from class com.luciad.format.dafif.decoder.ALcdDAFIFSingleModelDecoder
cleanUp, createModelDescriptor, setKeyFeatureNames
Methods inherited from class com.luciad.format.dafif.decoder.ALcdDAFIFDecoder
addErrorReport, canDecodeSource, getAltitudeType, getBearingTypeForChar, getBounds, getDAFIFProperties, getDataObjectFactory, getDecodingBounds, getDisplayName, getDomainFactory, getErrorMessage, getInputStream, getInputStreamFactory, getLocalHorizontalDatum, getModelFilter, getRecordCount, initializeErrorMessage, isStoreOriginalReference, isTraceOn, loadCFGProperties, read, readExactValue, readFormat, readMinLength, readRecord, setBounds, setDAFIFModelFilter, setDAFIFProperties, setDataObjectFactory, setDecodingBounds, setDomainFactory, setInputStreamFactory, setStoreOriginalReference, setTraceOn, transformPointToReferenceDatumSFCT
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.format.dafif.decoder.ILcdDAFIFDecoder
getDecodeFileName
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
FORMAT_1
protected static final int FORMAT_1Record type format 01.- See Also:
-
FORMAT_2
protected static final int FORMAT_2Record type format 02.- See Also:
-
FORMAT_3
protected static final int FORMAT_3Record type format 03.- See Also:
-
FORMAT_4
protected static final int FORMAT_4Record type format 04.- See Also:
-
FORMAT_5
protected static final int FORMAT_5Record type format 05.- See Also:
-
FORMAT_6
protected static final int FORMAT_6Record type format 06.- See Also:
-
fAirspaceFeaturesToBeDecoded
The names of the features to be decoded.
-
-
Constructor Details
-
ALcdDAFIFAirspaceDecoder
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
- aProperties
object containing for each domain object the name of its data file or NULL
-
-
Method Details
-
decode
Calls the decode method ofALcdDAFIFSingleModelDecoder
class. Prints additional information about the number of segments to the log.- Specified by:
decode
in interfaceILcdModelDecoder
- Overrides:
decode
in classALcdDAFIFSingleModelDecoder
- 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 classALcdDAFIFSingleModelDecoder
- Parameters:
aFormat
- the format of the recordaRecord
- the record
-
setAirspaceTypeToFilter
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
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
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
Returns aFloat
representing the numerical value of the given altitude.- Parameters:
aAltitudeString
- aString
representing an altitude- Returns:
- a
Float
representing the numerical value of the given altitude
-
retrieveAltitudeUnit
Returns aTLcdAltitudeUnit
object representing the unit of the given altitude.- Parameters:
aAltitudeString
- aString
representing an altitude- Returns:
- a
TLcdAltitudeUnit
object representing the unit of the given altitude
-
retrieveAltitudeReference
Returns aTLcdAltitudeReference
object representing the reference of the given altitude.- Parameters:
aAltitudeString
- aString
representing an altitude- Returns:
- a
TLcdAltitudeReference
object representing the reference of the given altitude
-
createAirspace
Creates and initializes an instance of an implementation of theILcdEditableAirspace
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
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:
-
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:
-
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
-