Package com.luciad.format.dwg
Class TLcdDWGModelListDecoder
java.lang.Object
com.luciad.format.dwg.TLcdDWGModelListDecoder
- All Implemented Interfaces:
ILcdDWGModelDecoder,ILcdModelDecoder
This
ILcdModelDecoder decodes data in AutoCAD's drawing format.
Internally, the decoding is delegated to a given ILcdDWGModelDecoder.
Once decoded, the internal model is split into several sub-models, each
corresponding to a single DWG layer. The sub-models are returned as a
TLcd2DBoundsIndexedModelList.
The descriptor of the model list is the TLcdDWGModelDescriptor
decoded by the internal DWGModelDecoder. The descriptors
of the submodels are also TLcdDWGModelDescriptor objects,
except that they each contain a single TLcdDWGLayer and the display
name is replaced by the name of that layer.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdDWGModelListDecoder that delegates the actual decoding to an instance of TLcdDWGModelDecoder.TLcdDWGModelListDecoder(ILcdDWGModelDecoder aDWGModelDecoder) Creates a new TLcdDWGModelListDecoder that delegates the actual decoding to a given instance of ILcdDWGModelDecoder. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtendedEntityString(String aStringPrefix) Adds a string prefix to the set of prefixes that determine which extended entity strings are decoded.voidaddExtendedEntityType(int aType) Adds a DWG extended entity type to the set of types that is decoded.booleancanDecodeSource(String aSourceAsString) Checks whether this model decoder can decode the specified data source.voidClears the set of DWG extended entity strings that is decoded.voidClears the set of DWG extended entity types that is decoded.Creates a new model from the given data source.Returns the default model reference for decoded models.Returns "DWG List".Returns the model reference decoder that is for creating model references for decoded models.booleanReturns whether DWG layers that are marked as frozen are decoded.booleanReturns whether DWG layers that are marked as invisible are decoded.booleanReturns whether DWG objects that are marked as invisible are decoded.booleanReturns whether to DWG layers that don't contain any elements are returned.voidResets the set of DWG extended entity strings that is decoded.voidResets the set of DWG extended entity types that is decoded.voidsetDecodeFrozenLayers(boolean aDecodeFrozenLayers) Specifies whether DWG layers that are marked as frozen should be decoded.voidsetDecodeInvisibleLayers(boolean aDecodeInvisibleLayers) Specifies whether DWG layers that are marked as invisible should be decoded.voidsetDecodeInvisibleObjects(boolean aDecodeInvisibleObjects) Specifies whether DWG objects that are marked as invisible should be decoded.voidsetDefaultModelReference(ILcdModelReference aDefaultModelReference) Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.voidsetExtendedEntityStringSelection(String[] aStringPrefixes) Sets the set of DWG extended entity strings that is decoded.voidsetExtendedEntityTypeSelection(int[] aTypes) Sets the set of DWG extended entity types that is decoded.voidsetModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder that will be used for creating model references for decoded models.voidsetReturnEmptyLayers(boolean aReturnEmptyLayers) Specifies whether to return DWG layers that don't contain any elements.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
-
TLcdDWGModelListDecoder
public TLcdDWGModelListDecoder()Creates a new TLcdDWGModelListDecoder that delegates the actual decoding to an instance of TLcdDWGModelDecoder. -
TLcdDWGModelListDecoder
Creates a new TLcdDWGModelListDecoder that delegates the actual decoding to a given instance of ILcdDWGModelDecoder.- Parameters:
aDWGModelDecoder- the model decoder that will decode the DWG files.
-
-
Method Details
-
setReturnEmptyLayers
public void setReturnEmptyLayers(boolean aReturnEmptyLayers) Specifies whether to return DWG layers that don't contain any elements. The default isfalse. -
isReturnEmptyLayers
public boolean isReturnEmptyLayers()Returns whether to DWG layers that don't contain any elements are returned. -
setModelReferenceDecoder
Description copied from interface:ILcdDWGModelDecoderSets the model reference decoder that will be used for creating model references for decoded models. The default isnull.- Specified by:
setModelReferenceDecoderin interfaceILcdDWGModelDecoder
-
getModelReferenceDecoder
Description copied from interface:ILcdDWGModelDecoderReturns the model reference decoder that is for creating model references for decoded models.- Specified by:
getModelReferenceDecoderin interfaceILcdDWGModelDecoder
-
setDefaultModelReference
Description copied from interface:ILcdDWGModelDecoderSets the default model reference for decoded models, in case the model reference decoder doesn't provide one. The default isnull.- Specified by:
setDefaultModelReferencein interfaceILcdDWGModelDecoder
-
getDefaultModelReference
Description copied from interface:ILcdDWGModelDecoderReturns the default model reference for decoded models.- Specified by:
getDefaultModelReferencein interfaceILcdDWGModelDecoder
-
setDecodeInvisibleObjects
public void setDecodeInvisibleObjects(boolean aDecodeInvisibleObjects) Description copied from interface:ILcdDWGModelDecoderSpecifies whether DWG objects that are marked as invisible should be decoded. The default isfalse.- Specified by:
setDecodeInvisibleObjectsin interfaceILcdDWGModelDecoder
-
isDecodeInvisibleObjects
public boolean isDecodeInvisibleObjects()Description copied from interface:ILcdDWGModelDecoderReturns whether DWG objects that are marked as invisible are decoded.- Specified by:
isDecodeInvisibleObjectsin interfaceILcdDWGModelDecoder
-
setDecodeInvisibleLayers
public void setDecodeInvisibleLayers(boolean aDecodeInvisibleLayers) Description copied from interface:ILcdDWGModelDecoderSpecifies whether DWG layers that are marked as invisible should be decoded. The default isfalse.- Specified by:
setDecodeInvisibleLayersin interfaceILcdDWGModelDecoder
-
isDecodeInvisibleLayers
public boolean isDecodeInvisibleLayers()Description copied from interface:ILcdDWGModelDecoderReturns whether DWG layers that are marked as invisible are decoded.- Specified by:
isDecodeInvisibleLayersin interfaceILcdDWGModelDecoder
-
setDecodeFrozenLayers
public void setDecodeFrozenLayers(boolean aDecodeFrozenLayers) Description copied from interface:ILcdDWGModelDecoderSpecifies whether DWG layers that are marked as frozen should be decoded. The default isfalse.- Specified by:
setDecodeFrozenLayersin interfaceILcdDWGModelDecoder
-
isDecodeFrozenLayers
public boolean isDecodeFrozenLayers()Description copied from interface:ILcdDWGModelDecoderReturns whether DWG layers that are marked as frozen are decoded.- Specified by:
isDecodeFrozenLayersin interfaceILcdDWGModelDecoder
-
resetExtendedEntityTypeSelection
public void resetExtendedEntityTypeSelection()Description copied from interface:ILcdDWGModelDecoderResets the set of DWG extended entity types that is decoded. All extended entity data types will now be included in the models when decoding DWG files.- Specified by:
resetExtendedEntityTypeSelectionin interfaceILcdDWGModelDecoder- See Also:
-
clearExtendedEntityTypeSelection
public void clearExtendedEntityTypeSelection()Description copied from interface:ILcdDWGModelDecoderClears the set of DWG extended entity types that is decoded. None of the extended entity data types will now be included in the models when decoding DWG files.- Specified by:
clearExtendedEntityTypeSelectionin interfaceILcdDWGModelDecoder- See Also:
-
setExtendedEntityTypeSelection
public void setExtendedEntityTypeSelection(int[] aTypes) Description copied from interface:ILcdDWGModelDecoderSets the set of DWG extended entity types that is decoded. Only extended entity data with the specified types will now be included in the models when decoding DWG files.- Specified by:
setExtendedEntityTypeSelectionin interfaceILcdDWGModelDecoder- Parameters:
aTypes- a list of extended entity types.- See Also:
-
addExtendedEntityType
public void addExtendedEntityType(int aType) Description copied from interface:ILcdDWGModelDecoderAdds a DWG extended entity type to the set of types that is decoded.- Specified by:
addExtendedEntityTypein interfaceILcdDWGModelDecoder- Parameters:
aType- an extended entity type.- See Also:
-
resetExtendedEntityStringSelection
public void resetExtendedEntityStringSelection()Description copied from interface:ILcdDWGModelDecoderResets the set of DWG extended entity strings that is decoded. All DWG extended entity strings will now be included in the models when decoding DWG files.- Specified by:
resetExtendedEntityStringSelectionin interfaceILcdDWGModelDecoder- See Also:
-
clearExtendedEntityStringSelection
public void clearExtendedEntityStringSelection()Description copied from interface:ILcdDWGModelDecoderClears the set of DWG extended entity strings that is decoded. None of the DWG extended entity strings will now be included in the models when decoding DWG files.- Specified by:
clearExtendedEntityStringSelectionin interfaceILcdDWGModelDecoder- See Also:
-
setExtendedEntityStringSelection
Description copied from interface:ILcdDWGModelDecoderSets the set of DWG extended entity strings that is decoded. Only DWG extended entity strings with the specified prefixes will now be included in the models when decoding DWG files.- Specified by:
setExtendedEntityStringSelectionin interfaceILcdDWGModelDecoder- Parameters:
aStringPrefixes- a list of string prefixes.
-
addExtendedEntityString
Description copied from interface:ILcdDWGModelDecoderAdds a string prefix to the set of prefixes that determine which extended entity strings are decoded.- Specified by:
addExtendedEntityStringin interfaceILcdDWGModelDecoder- Parameters:
aStringPrefix- a list of string prefixes.
-
getDisplayName
Returns "DWG List".- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- "DWG List"
-
canDecodeSource
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:
aSourceAsString- 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
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:
-