Package com.luciad.format.cgm
Class TLcdCGMModelDecoder
java.lang.Object
com.luciad.format.cgm.TLcdCGMModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
@Deprecated
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public class TLcdCGMModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
Deprecated.
we do not recommend using CGM for georeferenced data. Use TLcdCGMIcon to decode CGM as an icon.
This
Coordinates can be scaled and then shifted by means of the shift and scale
properties.
The model reference is obtained from an
ILcdModelDecoder decodes data in CGM format (Computer
Graphics Metafile), as defined by MIL-STD-2301.
Typically CGM documents are not directly decoded as models but rather used as styled icons to decorate existing models.
For that use case, consider using TLcdCGMIcon instead.
The following CGM elements are currently supported:
| CGM element name | Decoded object |
|---|---|
| POLYLINE | |
| TEXT | |
| POLYGON | |
| RECTANGLE | |
| CIRCLE | |
| CIRCULAR ARC | |
| CIRCULAR ARC, CLOSED | |
| ELLIPSE | |
| ELLIPTICAL ARC | |
| ELLIPTICAL ARC, CLOSED | |
ILcdModelReferenceDecoder. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService annotation, and can handle
- EPSG references (
<filename>.epsg): seeTLcdEPSGModelReferenceDecoderfor more info. - WKT references (
<filename>.prj): seeTLcdWKTModelReferenceDecoderfor more info. - Luciad encoded model references (
<filename>.ref): seeTLcdModelReferenceDecoderfor more info.
ILcdDataObject. Their data types
can be found in TLcdCGMDataTypes.
The decode method of this model decoder will make sure that the model descriptor of
the decoded model will have all the data types of elements of the model. This
can be queried at runtime using the TLcdCGMModelDescriptor.getModelElementTypes() method.
If the model is updated after decoding to feature more model element data types, a new model
descriptor will have to be added with an updated list of model element data types.
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a newTLcdCGMModelDecoder.TLcdCGMModelDecoder(ILcdModelReference aDefaultModelReference) Deprecated.Creates a newTLcdCGMModelDecoder.TLcdCGMModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder) Deprecated.Creates a newTLcdCGMModelDecoder.TLcdCGMModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference) Deprecated.Creates a newTLcdCGMModelDecoder. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aSourceName) Deprecated.Checks whether this model decoder can decode the specified data source.Deprecated.Creates a new model from the given data source.voiddecodeElements(DataInputStream aStream, ILcdModel aModelSFCT) Deprecated.Decodes the CGM elements from the given stream and adds them to the given model.voiddecodeElements(String aSourceName, int aOffset, ILcdModel aModelSFCT) Deprecated.Decodes the CGM elements from the given source and adds them to the given model.Deprecated.Deprecated.Deprecated.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Deprecated.Returns the input stream factory that is used.Deprecated.Returns the model reference decoder that is used for creating model references for decoded models.doubleDeprecated.doubleDeprecated.doubleDeprecated.doubleDeprecated.voidsetDefaultModelReference(ILcdModelReference aDefaultModelReference) Deprecated.Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Deprecated.Sets the input stream factory that will be used for creating input streams given source names.voidsetModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder) Deprecated.Sets the model reference decoder that will be used for creating model references for decoded models.voidsetScaleX(double aScaleX) Deprecated.Sets the factor by which x ordinates are scaled.voidsetScaleY(double aScaleY) Deprecated.Sets the factor by which y ordinates are scaled.voidsetShiftX(double aShiftX) Deprecated.Sets the distance by which x ordinates are shifted, after having been scaled.voidsetShiftY(double aShiftY) Deprecated.Sets the distance by which y ordinates are shifted, after having been scaled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdCGMModelDecoder
public TLcdCGMModelDecoder()Deprecated.Creates a newTLcdCGMModelDecoder. -
TLcdCGMModelDecoder
Deprecated.Creates a newTLcdCGMModelDecoder.- Parameters:
aModelReferenceDecoder- the model reference decoder that can assign references to decoded models.
-
TLcdCGMModelDecoder
Deprecated.Creates a newTLcdCGMModelDecoder.- Parameters:
aDefaultModelReference- the model reference that decoded models will get if the model reference decoder can't decode one.
-
TLcdCGMModelDecoder
public TLcdCGMModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference) Deprecated.Creates a newTLcdCGMModelDecoder.- Parameters:
aModelReferenceDecoder- the model reference decoder that can assign references to decoded models.aDefaultModelReference- the model reference that decoded models will get if the model reference decoder can't decode one.
-
-
Method Details
-
setInputStreamFactory
Deprecated.Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- the input stream factory to be used.
-
getInputStreamFactory
Deprecated.Description copied from interface:ILcdInputStreamFactoryCapableReturns the input stream factory that is used.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the input stream factory that is used.
-
setModelReferenceDecoder
Deprecated.Sets the model reference decoder that will be used for creating model references for decoded models. -
getModelReferenceDecoder
Deprecated.Returns the model reference decoder that is used for creating model references for decoded models. The default value supports WKT (*.prj), REF (*.ref), and EPSG (*.epsg).- Returns:
- the model reference decoder used by this decoder
- See Also:
-
setDefaultModelReference
Deprecated.Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one. -
getDefaultModelReference
Deprecated. -
setShiftX
public void setShiftX(double aShiftX) Deprecated.Sets the distance by which x ordinates are shifted, after having been scaled. -
getShiftX
public double getShiftX()Deprecated. -
setShiftY
public void setShiftY(double aShiftY) Deprecated.Sets the distance by which y ordinates are shifted, after having been scaled. -
getShiftY
public double getShiftY()Deprecated. -
setScaleX
public void setScaleX(double aScaleX) Deprecated.Sets the factor by which x ordinates are scaled. -
getScaleX
public double getScaleX()Deprecated. -
setScaleY
public void setScaleY(double aScaleY) Deprecated.Sets the factor by which y ordinates are scaled. -
getScaleY
public double getScaleY()Deprecated. -
getDefaultExtension
Deprecated.- Returns:
- "cgm".
-
getDisplayName
Deprecated.Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
canDecodeSource
Deprecated.Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows 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:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
Deprecated.Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis 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:
-
decodeElements
public void decodeElements(String aSourceName, int aOffset, ILcdModel aModelSFCT) throws IOException Deprecated.Decodes the CGM elements from the given source and adds them to the given model.- Parameters:
aSourceName- the name of the source containing CGM data.aOffset- the offset indicating the start of the CGM dataaModelSFCT- the model to which the decoded elements are added.- Throws:
IOException
-
decodeElements
Deprecated.Decodes the CGM elements from the given stream and adds them to the given model.- Parameters:
aStream- the stream containing CGM data.aModelSFCT- the model to which the decoded elements are added.- Throws:
IOException
-