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
ConstructorDescriptionCreates 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 TypeMethodDescriptionvoid
addExtendedEntityString
(String aStringPrefix) Adds a string prefix to the set of prefixes that determine which extended entity strings are decoded.void
addExtendedEntityType
(int aType) Adds a DWG extended entity type to the set of types that is decoded.boolean
canDecodeSource
(String aSourceAsString) Checks whether this model decoder can decode the specified data source.void
Clears the set of DWG extended entity strings that is decoded.void
Clears 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.boolean
Returns whether DWG layers that are marked as frozen are decoded.boolean
Returns whether DWG layers that are marked as invisible are decoded.boolean
Returns whether DWG objects that are marked as invisible are decoded.boolean
Returns whether to DWG layers that don't contain any elements are returned.void
Resets the set of DWG extended entity strings that is decoded.void
Resets the set of DWG extended entity types that is decoded.void
setDecodeFrozenLayers
(boolean aDecodeFrozenLayers) Specifies whether DWG layers that are marked as frozen should be decoded.void
setDecodeInvisibleLayers
(boolean aDecodeInvisibleLayers) Specifies whether DWG layers that are marked as invisible should be decoded.void
setDecodeInvisibleObjects
(boolean aDecodeInvisibleObjects) Specifies whether DWG objects that are marked as invisible should be decoded.void
setDefaultModelReference
(ILcdModelReference aDefaultModelReference) Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.void
setExtendedEntityStringSelection
(String[] aStringPrefixes) Sets the set of DWG extended entity strings that is decoded.void
setExtendedEntityTypeSelection
(int[] aTypes) Sets the set of DWG extended entity types that is decoded.void
setModelReferenceDecoder
(ILcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder that will be used for creating model references for decoded models.void
setReturnEmptyLayers
(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, wait
Methods 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:ILcdDWGModelDecoder
Sets the model reference decoder that will be used for creating model references for decoded models. The default isnull
.- Specified by:
setModelReferenceDecoder
in interfaceILcdDWGModelDecoder
-
getModelReferenceDecoder
Description copied from interface:ILcdDWGModelDecoder
Returns the model reference decoder that is for creating model references for decoded models.- Specified by:
getModelReferenceDecoder
in interfaceILcdDWGModelDecoder
-
setDefaultModelReference
Description copied from interface:ILcdDWGModelDecoder
Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one. The default isnull
.- Specified by:
setDefaultModelReference
in interfaceILcdDWGModelDecoder
-
getDefaultModelReference
Description copied from interface:ILcdDWGModelDecoder
Returns the default model reference for decoded models.- Specified by:
getDefaultModelReference
in interfaceILcdDWGModelDecoder
-
setDecodeInvisibleObjects
public void setDecodeInvisibleObjects(boolean aDecodeInvisibleObjects) Description copied from interface:ILcdDWGModelDecoder
Specifies whether DWG objects that are marked as invisible should be decoded. The default isfalse
.- Specified by:
setDecodeInvisibleObjects
in interfaceILcdDWGModelDecoder
-
isDecodeInvisibleObjects
public boolean isDecodeInvisibleObjects()Description copied from interface:ILcdDWGModelDecoder
Returns whether DWG objects that are marked as invisible are decoded.- Specified by:
isDecodeInvisibleObjects
in interfaceILcdDWGModelDecoder
-
setDecodeInvisibleLayers
public void setDecodeInvisibleLayers(boolean aDecodeInvisibleLayers) Description copied from interface:ILcdDWGModelDecoder
Specifies whether DWG layers that are marked as invisible should be decoded. The default isfalse
.- Specified by:
setDecodeInvisibleLayers
in interfaceILcdDWGModelDecoder
-
isDecodeInvisibleLayers
public boolean isDecodeInvisibleLayers()Description copied from interface:ILcdDWGModelDecoder
Returns whether DWG layers that are marked as invisible are decoded.- Specified by:
isDecodeInvisibleLayers
in interfaceILcdDWGModelDecoder
-
setDecodeFrozenLayers
public void setDecodeFrozenLayers(boolean aDecodeFrozenLayers) Description copied from interface:ILcdDWGModelDecoder
Specifies whether DWG layers that are marked as frozen should be decoded. The default isfalse
.- Specified by:
setDecodeFrozenLayers
in interfaceILcdDWGModelDecoder
-
isDecodeFrozenLayers
public boolean isDecodeFrozenLayers()Description copied from interface:ILcdDWGModelDecoder
Returns whether DWG layers that are marked as frozen are decoded.- Specified by:
isDecodeFrozenLayers
in interfaceILcdDWGModelDecoder
-
resetExtendedEntityTypeSelection
public void resetExtendedEntityTypeSelection()Description copied from interface:ILcdDWGModelDecoder
Resets 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:
resetExtendedEntityTypeSelection
in interfaceILcdDWGModelDecoder
- See Also:
-
clearExtendedEntityTypeSelection
public void clearExtendedEntityTypeSelection()Description copied from interface:ILcdDWGModelDecoder
Clears 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:
clearExtendedEntityTypeSelection
in interfaceILcdDWGModelDecoder
- See Also:
-
setExtendedEntityTypeSelection
public void setExtendedEntityTypeSelection(int[] aTypes) Description copied from interface:ILcdDWGModelDecoder
Sets 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:
setExtendedEntityTypeSelection
in interfaceILcdDWGModelDecoder
- Parameters:
aTypes
- a list of extended entity types.- See Also:
-
addExtendedEntityType
public void addExtendedEntityType(int aType) Description copied from interface:ILcdDWGModelDecoder
Adds a DWG extended entity type to the set of types that is decoded.- Specified by:
addExtendedEntityType
in interfaceILcdDWGModelDecoder
- Parameters:
aType
- an extended entity type.- See Also:
-
resetExtendedEntityStringSelection
public void resetExtendedEntityStringSelection()Description copied from interface:ILcdDWGModelDecoder
Resets 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:
resetExtendedEntityStringSelection
in interfaceILcdDWGModelDecoder
- See Also:
-
clearExtendedEntityStringSelection
public void clearExtendedEntityStringSelection()Description copied from interface:ILcdDWGModelDecoder
Clears 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:
clearExtendedEntityStringSelection
in interfaceILcdDWGModelDecoder
- See Also:
-
setExtendedEntityStringSelection
Description copied from interface:ILcdDWGModelDecoder
Sets 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:
setExtendedEntityStringSelection
in interfaceILcdDWGModelDecoder
- Parameters:
aStringPrefixes
- a list of string prefixes.
-
addExtendedEntityString
Description copied from interface:ILcdDWGModelDecoder
Adds a string prefix to the set of prefixes that determine which extended entity strings are decoded.- Specified by:
addExtendedEntityString
in interfaceILcdDWGModelDecoder
- Parameters:
aStringPrefix
- a list of string prefixes.
-
getDisplayName
Returns "DWG List".- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- "DWG List"
-
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:
aSourceAsString
- 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:
-
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:
-