Class TLcdPOLModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
This ILcdModelDecoder
allows to decode Polygon files produced by the TAAM
application of the Preston Group PTY Ltd.
The implementation decodes polygons as ILcdEditablePOLGeometry
objects.
Whether they are open or closed can be retrieved through the method ILcdPOLGeometry.isClosed()
.
All ILcdPOLGeometry
instances implement both the ILcdFeatured
and the ILcdDataObject
interface. The ILcdDataObject
interface
was implemented to support the new unified domain model across all LuciadLightspeed products. The ILcdFeatured
interface exists
for backwards compatibility.
The TLcdDataModel
used by all decoded models of this model decoder can
be retrieved by calling TLcdPOLDataTypes.getDataModel()
NOTE: the current implementation does not support grouping of elements as indicated with {} brackets in the POL files. Grouped objects are ignored. NOTE: the decoder stores the color index for every element in the model, though no mechanism is present to add a color table to the model to map the index to a color.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Returnstrue
when the source ends with '.pol' (case insensitive) and when the file starts with "%Gtool".protected Object
createGeometry
(boolean aClosed, String aName, String aType, boolean aSetColorFlag, int aColorIndex, String aAltitudeUnit, double aMinAltitude, double aMaxAltitude, ILcd2DEditablePointList aPointList) Create an element for the model, based on the given parameters.protected ILcdModelDescriptor
createModelDescriptor
(String aSourceName, String aType, String aModelDisplayName, ILcdModel aModel, ILcdPOLTypeTable aPOLTypeTable, ILcdBounds aModelBounds) protected InputStream
createSourceInputStream
(String aSourceName) Creates an input stream to retrieve the data at the given location.Creates a new model from the given data source.Returns the display name for this decoder (e.g. when displayed in a list of decoders).Returns the input stream factory that is used.com.luciad.internal.format.pol.TLinPOLTypeTable
protected String
makeModelDisplayName
(String aSourceName) Creates a display name for the model descriptor based on the data source name.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.void
setTypeTable
(com.luciad.internal.format.pol.TLinPOLTypeTable aTypeTable) 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
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
TYPE_NAME
- See Also:
-
DISPLAY_NAME
- See Also:
-
-
Constructor Details
-
TLcdPOLModelDecoder
public TLcdPOLModelDecoder()
-
-
Method Details
-
getTypeTable
public com.luciad.internal.format.pol.TLinPOLTypeTable getTypeTable() -
setTypeTable
public void setTypeTable(com.luciad.internal.format.pol.TLinPOLTypeTable aTypeTable) -
getDisplayName
Returns the display name for this decoder (e.g. when displayed in a list of decoders).- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
DISPLAY_NAME
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Returns the input stream factory that is used.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Sets the input stream factory to be used.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
canDecodeSource
Returnstrue
when the source ends with '.pol' (case insensitive) and when the file starts with "%Gtool".- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- a data source; typically a file name or a URL.- Returns:
true
when the source ends with '.pol' (case insensitive) and when the file starts with "%Gtool",false
otherwise.- See Also:
-
createSourceInputStream
Creates an input stream to retrieve the data at the given location. This implementation uses the input stream factory set. When the input stream factory is null,TLcdIOUtil
is used.- Parameters:
aSourceName
- the location to retrieve the data from.- Returns:
- an input stream containing the data at the given location.
- Throws:
IOException
- when an I/O error occurs while retrieving the data.
-
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:
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
createModelDescriptor
protected ILcdModelDescriptor createModelDescriptor(String aSourceName, String aType, String aModelDisplayName, ILcdModel aModel, ILcdPOLTypeTable aPOLTypeTable, ILcdBounds aModelBounds) -
makeModelDisplayName
Creates a display name for the model descriptor based on the data source name.- Parameters:
aSourceName
- the location where the data was retrieved from.- Returns:
- a display name for the model descriptor.
-
createGeometry
protected Object createGeometry(boolean aClosed, String aName, String aType, boolean aSetColorFlag, int aColorIndex, String aAltitudeUnit, double aMinAltitude, double aMaxAltitude, ILcd2DEditablePointList aPointList) Create an element for the model, based on the given parameters. This implementationTLcdPOLGeometryFactory.createClosedGeometry(java.lang.String, java.lang.String, boolean, int, java.lang.String, double, double, com.luciad.shape.shape2D.ILcd2DEditablePointList)
orTLcdPOLGeometryFactory.createOpenGeometry(java.lang.String, java.lang.String, boolean, int, java.lang.String, double, double, com.luciad.shape.shape2D.ILcd2DEditablePointList)
depending on the value of aClosed.
-