public abstract class ALcdDAFIFAirspaceDecoder extends ALcdDAFIFSingleModelDecoder
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.
Modifier and Type | Field and Description |
---|---|
protected String[] |
fAirspaceFeaturesToBeDecoded
The names of the features to be decoded.
|
protected static int |
FORMAT_1
Record type format 01.
|
protected static int |
FORMAT_2
Record type format 02.
|
protected static int |
FORMAT_3
Record type format 03.
|
protected static int |
FORMAT_4
Record type format 04.
|
protected static int |
FORMAT_5
Record type format 05.
|
protected static int |
FORMAT_6
Record type format 06.
|
DAFIF_PROP_EXTENSION, fRecordCount
Constructor and Description |
---|
ALcdDAFIFAirspaceDecoder(Properties aDAFIFProperties)
Initializes the DAFIFProperties field with the
specified properties object.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ILcdEditableAirspace |
createAirspace(char[] aRecord)
Creates and initializes an instance of an implementation of the
ILcdEditableAirspace interface. |
ILcdModel |
decode(String aSource)
Calls the decode method of
ALcdDAFIFSingleModelDecoder class. |
protected String[] |
getAirspaceFeaturesToBeDecoded()
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 a
TLcdAltitudeReference object representing the reference
of the given altitude. |
protected TLcdAltitudeUnit |
retrieveAltitudeUnit(String aAltitudeString)
Returns a
TLcdAltitudeUnit object representing the unit of
the given altitude. |
protected Float |
retrieveAltitudeValue(String aAltitudeString)
Returns a
Float 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.
|
cleanUp, createModelDescriptor, setKeyFeatureNames
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDecodeFileName
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
protected static final int FORMAT_1
protected static final int FORMAT_2
protected static final int FORMAT_3
protected static final int FORMAT_4
protected static final int FORMAT_5
protected static final int FORMAT_6
protected String[] fAirspaceFeaturesToBeDecoded
public ALcdDAFIFAirspaceDecoder(Properties aDAFIFProperties)
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.
aDAFIFProperties
- a Properties
object containing for each domain
object the name of its data file or NULLpublic ILcdModel decode(String aSource) throws IOException
ALcdDAFIFSingleModelDecoder
class. Prints
additional information about the number of segments to the log.decode
in interface ILcdModelDecoder
decode
in class ALcdDAFIFSingleModelDecoder
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)IOException
- if an error occurs during the reading processILcdModelDecoder.canDecodeSource(String)
protected void handleRecord(int aFormat, char[] aRecord)
ALcdDAFIFSingleModelDecoder
handleRecord
in class ALcdDAFIFSingleModelDecoder
aFormat
- the format of the recordaRecord
- the recordpublic void setAirspaceTypeToFilter(TLcdAirspaceType aAirspaceTypeToFilter)
If aAirspaceTypeToFilter is null, the decode method will put all airspaces in the model.
aAirspaceTypeToFilter
- the airspace type to be filtered onpublic void setAirspaceFeaturesToBeDecoded(String[] aAirspaceFeaturesToBeDecoded)
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.
aAirspaceFeaturesToBeDecoded
- a list of features that should be decoded into the airspace objectsprotected String[] getAirspaceFeaturesToBeDecoded()
setAirspaceFeaturesToBeDecoded(String[])
protected Float retrieveAltitudeValue(String aAltitudeString)
Float
representing the numerical value of
the given altitude.aAltitudeString
- a String
representing an altitudeFloat
representing the numerical value of
the given altitudeprotected TLcdAltitudeUnit retrieveAltitudeUnit(String aAltitudeString)
TLcdAltitudeUnit
object representing the unit of
the given altitude.aAltitudeString
- a String
representing an altitudeTLcdAltitudeUnit
object representing the unit of
the given altitudeprotected TLcdAltitudeReference retrieveAltitudeReference(String aAltitudeString)
TLcdAltitudeReference
object representing the reference
of the given altitude.aAltitudeString
- a String
representing an altitudeTLcdAltitudeReference
object representing the reference
of the given altitudeprotected abstract ILcdEditableAirspace createAirspace(char[] aRecord)
ILcdEditableAirspace
interface.aRecord
- the record to retrieve information fromprotected abstract void handleRecordFmt2(char[] aRecord)
aRecord
- a record of format 02protected abstract String readAirspaceUID(char[] aRecord)
This unique identifier may consist of
one or more features. The resulting String
object is a concatenation of
these feature values.
aRecord
- the record to read fromprotected abstract int readSegmentNumber(char[] aRecord)
aRecord
- the record to read fromprotected abstract double readLon1FromFmt3(char[] aRecord)
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.
aRecord
- the record to read fromprotected abstract double readLat1FromFmt3(char[] aRecord)
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.
aRecord
- the record to read fromprotected abstract double readGeodeticLon1FromFmt3(char[] aRecord)
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.
aRecord
- the record to read fromreadLon1(char[])
protected abstract double readGeodeticLat1FromFmt3(char[] aRecord)
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.
aRecord
- the record to read fromreadLat1(char[])
protected abstract double readLon0FromFmt3(char[] aRecord)
The longitude 0 is the longitude of the center point of an arc or circle segment w.r.t. a user specified geodetic datum.
aRecord
- the record to read fromprotected abstract double readLat0FromFmt3(char[] aRecord)
The latitude 0 is the latitude of the center point of an arc or circle segment w.r.t. a user specified geodetic datum.
aRecord
- the record to read fromprotected abstract double readGeodeticLon0FromFmt4(char[] aRecord)
The longitude 0 is the longitude of the center point of an arc or circle segment w.r.t. WGS84.
aRecord
- the record to read fromreadLon0FromFmt3(char[])
protected abstract double readGeodeticLat0FromFmt4(char[] record)
The latitude 0 is the latitude of the center point of an arc or circle segment w.r.t. WGS84.
record
- the record to read fromreadLat0FromFmt3(char[])
protected abstract char readShapeFromFmt3(char[] aRecord)
aRecord
- the record to read fromprotected abstract float readRadius1FromFmt4(char[] aRecord)
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.
aRecord
- the record to read fromprotected abstract float readRadius2FromFmt4(char[] aRecord)
This field may be empty.
aRecord
- the record to read fromprotected abstract float readBearing1FromFmt4(char[] aRecord)
This field may be empty.
aRecord
- the record to read fromprotected abstract float readBearing2FromFmt4(char[] aRecord)
This field may be empty.
aRecord
- the record to read fromprotected abstract String readNavaidUIDFromFmt4(char[] aRecord)
aRecord
- the record to read from