Class TLcdASTERIXModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdDataSourceModelDecoder
,ILcdModelDecoder
trajectories
, plots
,
weather pictures
or service messages
.
The current implementation of TLcdASTERIXLiveDecoder will
add trajectories
, plots
,
weather pictures
or service messages
to the sub models.
The domain object depends on the incoming messages. Messages without ID's will
be generated as plots, other messages will be generated as trajectories except if there are weather pictures or service messages.
Timing information of ASTERIX data is relative to midnight, but for replay purposes it is
convenient to have absolute time values. An offset date can be specified using
setTimeOffset(long)
to convert time-since-midnight to an absolute time value.
You can decode single files using the decode(String)
method. If you have recorded ASTERIX data
that is split in separate files, you can use the decodeSource(com.luciad.model.ILcdDataSource)
method to decode several files in one
go, keeping trajectories split over multiple files together.
Input files
File | Required | Entry point | Description |
---|---|---|---|
*.ast | x | x | AST file containing a simple sequence of ASTERIX blocks (see ASTERIX_FORMAT ) |
*.asterix | x | x | ASTERIX file containing a simple sequence of ASTERIX blocks (see ASTERIX_FORMAT ) |
*.astfin | x | x | ASTERIX Final file containing a sequence of ASTERIX blocks within a header and footer (see ASTERIX_FINAL_FORMAT ) |
*.pcap | x | x | ASTERIX blocks captured from the network in a PCAP file (see PCAP_FORMAT ) |
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by
the
ILcdInputStreamFactory
of this decoder.
Model structure
- This model decoder returns a
model list
with a model for each data type in the input. - All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
.
Model descriptor
- Sub-models containing trajectory data will have a
track model descriptor
- Sub-models containing plots will have a
plot model descriptor
- Sub-models containing weather pictures will have a
weather model descriptor
- Sub-models containing a radar will have a
TLcdASTERIXRadarVideoModelDescriptor
- Sub-models containing radar service messages will have a
TLcdASTERIXRadarServiceMessageModelDescriptor
Model reference
- All models returned by this model decoder have an
ILcdGridReference
.
Model elements
- All domain objects decoded with this decoder implement the ILcdDataObject interface. This interface allows you to retrieve information on each of the domain models of ASTERIX in a uniform way. The data models and types can be obtained from either the domain objects or from the TLcdASTERIXDataTypes class.
- The domain objects decoded with this model decoder also implement the ILcdFeatured
interface. While this interface will also provide information about the attributes of the domain model, it
is recommended to use the newer ILcdDataObject interface to query a domain
object on its properties. The ILcdFeatured does not provide information about the
metadata of the features it represents. For this, an ILcdFeaturedDescriptor can
be used. The use of the ILcdFeaturedDescriptor interface in ASTERIX is described
in
ALcdASTERIXModelDescriptor
Sample code
ILcdModelDecoder decoder = new TLcdASTERIXModelDecoder();
ILcdModel model = decoder.decode( "asterix_data.ast" );
Performance tips
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models are thread-safe for read access.
Supported versions
- The decoder supports the categories 1, 8, 10, 11, 21, 30, 34, 48, 62, 240 and 244 of the ASTERIX standard. See the Overview of the ASTERIX specifications for the supported categories for the full list of specifications used to implement the categories. For more information on the ASTERIX standard, see the EUROCONTROL website.
Limitations
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant describing the ASTERIX final file format.static final int
Constant describing the standard ASTERIX file format: regular ASTERIX data blocks concatenated one after the other, without any headers or footers.static final int
Constant describing the PCAP file format.static final int
Constant describing an unknown format. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(ILcdDataSource aDataSource) Checks whether the data source is aTLcdASTERIXDataSource
.boolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.decodeSource
(ILcdDataSource aDataSource) Decodes instances ofTLcdASTERIXDataSource
, allowing you to decode multiple sources in one go.static int
determineFormat
(String aSourceName) Derives the format from the given source name.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is currently used for creating input streams given source names.long
Returns the time offset.protected int
retrieveFormat
(String aSourceName) Retrieves the format for the given source name.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.void
setTimeOffset
(long aTimeOffset) Sets the time offset used to convert time-since-midnight values to an absolute date and time.Methods inherited from class com.luciad.format.asterix.ALcdASTERIXDecoder
getCategories, getRecordFilter, getReferenceProvider, getScalingFactorProvider, getTransformationProvider, isClassTraceOn, setCategories, setClassTraceOn, setRecordFilter, setReferenceProvider, setScalingFactorProvider, setTransformationProvider
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
decodeModelMetadata, decodeModelMetadata, discoverDataSources
-
Field Details
-
UNKNOWN_FORMAT
public static final int UNKNOWN_FORMATConstant describing an unknown format.- See Also:
-
ASTERIX_FORMAT
public static final int ASTERIX_FORMATConstant describing the standard ASTERIX file format: regular ASTERIX data blocks concatenated one after the other, without any headers or footers.- See Also:
-
ASTERIX_FINAL_FORMAT
public static final int ASTERIX_FINAL_FORMATConstant describing the ASTERIX final file format. ASTERIX final is a simple extension of the ASTERIX standard, where every ASTERIX final record is composed like this:HEADER NormalAsterixBlock1 NormalAsterixBlock2 ... FOOTER
These ASTERIX final records are concatenated in a file, one after the other. The header of 8 bytes is composed like this:byte 0 length (msb) byte 1 length (lsb) byte 2 board number byte 3 line number byte 4 recording day byte 5 time (msb) byte 6 time byte 7 time (lsb) - See Also:
-
PCAP_FORMAT
public static final int PCAP_FORMATConstant describing the PCAP file format. Files in this format should be in the PCAP file format. Currently the decoder can only extract ASTERIX data from the following protocols:- Data link layer
- Only Ethernet (version II, LLC, LLC+SNAP) is supported
- Network layer
- Only IPv4 is supported.
- Transport layer
- Only UDP is supported. UDP datagrams sent across IP fragments are supported.
- See Also:
- Data link layer
-
-
Constructor Details
-
TLcdASTERIXModelDecoder
public TLcdASTERIXModelDecoder()
-
-
Method Details
-
setInputStreamFactory
Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
getInputStreamFactory
Returns the input stream factory that is currently used for creating input streams given source names.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is currently used.
-
getTimeOffset
public long getTimeOffset()Returns the time offset. SeesetTimeOffset(long)
for details.- Returns:
- The offset date that is used to get absolute dates from the relative dates of ASTERIX data.
-
setTimeOffset
public void setTimeOffset(long aTimeOffset) Sets the time offset used to convert time-since-midnight values to an absolute date and time. ASTERIX data only contains dates relative to midnight. With this method, it is possible to set an offset date of choice. To calculate absolute dates, this offset date is added together with the time-since-midnight found in ASTERIX data. Note that the time part of the offset date is ignored, so only the year, month and day are used.- Parameters:
aTimeOffset
- Date used as offset for the relative ASTERIX dates, it is specified as a value in milliseconds since 1970, similar toDate.getTime()
. Set -1 to use the start of today as the offset.
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
retrieveFormat
Retrieves the format for the given source name. By default, this method callsdetermineFormat(String)
. Override if your source names don't follow the conventions used by that method.- Parameters:
aSourceName
- The source name, similar as the source given to thedecode
method.- Returns:
- One of
ASTERIX_FORMAT
,ASTERIX_FINAL_FORMAT
,PCAP_FORMAT
orUNKNOWN_FORMAT
. This list can be expanded in the future, when support for new file formats is added. - See Also:
-
determineFormat
Derives the format from the given source name. This method maps file names as described below:- *.asterix, *.asterix .zip, *.asterix.gz, *.ast, *.ast.zip or *.ast.gz ->
ASTERIX_FORMAT
, - *.astfin, *.astfin.zip or *.astfin.gz ->
ASTERIX_FINAL_FORMAT
, - *.pcap, *.pcap.zip or *.pcap.gz ->
PCAP_FORMAT
, - other file names ->
UNKNOWN_FORMAT
.
- Parameters:
aSourceName
- The source name from which to derive the format.- Returns:
- One of
ASTERIX_FORMAT
,ASTERIX_FINAL_FORMAT
,PCAP_FORMAT
orUNKNOWN_FORMAT
. This list can be expanded in the future, when support for new file formats is added. - Since:
- 2018.0
- *.asterix, *.asterix .zip, *.asterix.gz, *.ast, *.ast.zip or *.ast.gz ->
-
canDecodeSource
Description copied from interface:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
throws an exception for that same source name.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be verified; typically a file name or a URL.- Returns:
true
if this decoder can likely decode the data specified by the source name,false
otherwise.- See Also:
-
canDecodeSource
Checks whether the data source is aTLcdASTERIXDataSource
.Checks whether this model decoder can decode the data source(s), identified by the passed
ILcdDataSource
.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the instance class of
aDataSource
, or check the file extension if it is aTLcdDataSource
.The default implementation of this method will check if the given
ILcdDataSource
is aTLcdDataSource
. If not, this method returns false. Otherwise, it delegates the source to theILcdModelDecoder.canDecodeSource(String)
method.- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- The data source to check.- Returns:
true
if the data source is aTLcdASTERIXDataSource
,false
otherwise.- See Also:
-
decodeSource
Decodes instances of
TLcdASTERIXDataSource
, allowing you to decode multiple sources in one go.The sources are decoded in the order they are listed in the
TLcdASTERIXDataSource.getSourceNames
.By using this method, a trajectory that spans two files can still be decoded as a single trajectory. In contrast, if you decode the two files separately using the
decode(String)
method, the trajectory will be cut at the boundaries of the files, and be split over the two resulting models.Use this method if you have recorded your ASTERIX data in several files, for instance, when you record your ASTERIX data in chunks of one hour each.
Note: the sources described by theTLcdASTERIXDataSource
- should be consecutive files, i.e. the end of one file should correspond to the beginning of the next file.
- should all be in the same file format, for instance,
PCAP_FORMAT
Creates a new model from the given data source.
By default, this method:
- Throws a
NullPointerException
when anull
data source is passed. - Delegates to the
ILcdModelDecoder.decode(String)
method when aTLcdDataSource
is passed. - Throws an IOException in other case.
- Specified by:
decodeSource
in interfaceILcdModelDecoder
- Parameters:
aDataSource
- TheILcdDataSource
to decode. This must be an instance ofTLcdASTERIXDataSource
. This must not benull
.- Returns:
- The decoded model list.
- Throws:
IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException { try { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- See Also:
-
decode
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- See Also:
-