@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdDGNModelDecoder extends Object implements ILcdDGNModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
*.dgn | x | x | Design file (V7 or V8) containing vector data |
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
<filename>.epsg
): see TLcdEPSGModelReferenceDecoder
for more info.<filename>.prj
): see TLcdWKTModelReferenceDecoder
for more info.<filename>.ref
): see TLcdModelReferenceDecoder
for more info.ILcd2DBoundsIndexedModel
.TLcdDGNModelDescriptor
. Among other information, the descriptor
contains the DGN symbology.TLcdDataModelDescriptor
.
Its data model exposes the DGN tags in a uniform way.ILcdDGNShape
.ILcdDataObject
s. If the element has any
tags associated with it, the data object is a "TagSet" with property "Tags" that is a
list of "AbstractTag" entities.DGN element type | DGN element name | Decoded object |
---|---|---|
1 | LIBRARY_CELL | |
2 | CELL |
|
3 | LINE |
|
4 | LINE_STRING |
|
5 | GROUP_DATA | |
6 | SHAPE |
|
7 | TEXT_NODE |
|
9 | DESIGN_SETTINGS | |
10 | LEVEL_SYMBOLOGY | |
11 | CURVE |
|
12 | COMPLEX_CHAIN |
|
14 | COMPLEX_SHAPE |
|
15 | ELLIPSE |
|
16 | ARC |
|
17 | TEXT |
|
18 | 3D_SURFACE |
|
19 | SOLID |
|
33 | DIMENSION (note) |
|
34 | SHARED_CELL_DEFINITION | |
35 | SHARED_CELL_INSTANCE |
|
36 | CELL_MULTI_LINE |
|
37 | TAG_DATA |
DGN element type | DGN element name |
---|---|
8 | DIGITIZER_SETUP |
13 | CONIC |
20 | SUBFIGURE |
21 | B_SPLINE_CURVE |
22 | POINT_STRING |
23 | CONE |
24 | B_SPLINE_SURFACE |
25 | B_SPLINE_BOUNDARY |
26 | B_SPLINE_KNOT |
27 | B_SPLINE_WEIGHT |
28 | B_SPLINE |
33 | DIMENSION |
66 | APPLICATION |
87 | RASTER_HEADER |
88 | RASTER_DATA |
dgn.decoder.legacy=true
.
ILcdModelDecoder decoder =
new TLcdDGNNativeModelDecoder(new TLcdEPSGModelReferenceDecoder(),
new TLcdGeodeticReference(new TLcdGeodeticDatum()));
ILcdModel model = decoder.decode("vectordata.dgn");
dgn.decoder.alwaysuseinputstream=true
.Constructor and Description |
---|
TLcdDGNModelDecoder()
Creates a new
TLcdDGNModelDecoder . |
TLcdDGNModelDecoder(ILcdModelReference aDefaultModelReference)
Creates a new
TLcdDGNModelDecoder . |
TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Creates a new
TLcdDGNModelDecoder . |
TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder,
ILcdModelReference aDefaultModelReference)
Creates a new
TLcdDGNModelDecoder . |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeEntity(int aEntity)
Adds an attribute entity number to the set of numbers that is decoded.
|
void |
addElementClass(int aElementClass)
Adds an element class to the list of element classes that is included into
decoded models.
|
void |
addLevel(int aLevel)
Adds a level to the list of DGN levels that is included into all decoded models.
|
void |
addLevelName(String aLevelName)
Adds a name of a DGN level to the list of names of DGN levels that are to
be included into all decoded models, in addition to the numeric level
selection.
|
void |
addTagSet(String aTagSetName)
Adds a tag set name to the set of names that is decoded.
|
void |
addUserAttributeType(int aType)
Adds a DGN MSLINK attribute type to the set of types that is decoded.
|
void |
addUserAttributeType(String aType)
Adds a DGN MSLINK attribute 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 |
clearAttributeEntitySelection()
Clears the set of DGN database attributes that is decoded.
|
void |
clearLevelNameSelection()
Clears the list of names of DGN levels that are to be included into all
decoded models.
|
void |
clearLevelSelection()
Clears the list of DGN levels that is included into decoded models.
|
void |
clearTagSetSelection()
Clears the set of DGN tag sets that is decoded.
|
void |
clearUserAttributeTypeSelection()
Clears the set of DGN MSLINK attributes that is decoded.
|
void |
clearUserDefinedFont(int aFontIndex)
Clears a user-defined font, so it will not be used in subsequently decoded
models.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
int[] |
getAttributeEntitySelection() |
String |
getDatabaseURL() |
String |
getDefaultExtension() |
ILcdModelReference |
getDefaultModelReference() |
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
int |
getElementClassSelection()
Gets the the bitmask specifying list of element classes that is included
into decoded models.
|
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used.
|
String[] |
getLevelNameSelection() |
long |
getLevelSelection()
Deprecated.
the returned value is limited to the first 64 levels. Starting with DGN version 8,
this is no longer sufficient. Use
isLevelSelected(int) or getSelectedLevels()
instead. |
ILcdModelReference |
getModelReference()
Deprecated.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder() |
int[] |
getSelectedLevels()
Returns the array of selected levels.
|
String[] |
getTagSetSelection() |
int[] |
getUserAttributeTypeSelection() |
boolean |
isLevelSelected(int aLevel)
Returns true if the given level is selected, false otherwise.
|
boolean |
isUseFloat() |
void |
resetAttributeEntitySelection()
Resets the set of DGN database attributes that is decoded.
|
void |
resetElementClassSelection()
Resets the list of DGN element classes that is included into decoded models;
As a result, all DGN element classes will be included in the models when
decoding DGN files.
|
void |
resetLevelSelection()
Resets the list of DGN levels that is included into decoded models.
|
void |
resetTagSetSelection()
Resets the set of DGN tag sets that is decoded.
|
void |
resetUserAttributeTypeSelection()
Resets the set of DGN MSLINK attributes that is decoded.
|
void |
setAttributeEntitySelection(int[] aEntities)
Sets the set of DGN database attributes that is decoded.
|
void |
setDatabaseURL(String aDatabaseURL)
Sets the default database URL that is assigned to all decoded attributes.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the default model reference for decoded models, in case the model
reference decoder doesn't provide one.
|
void |
setElementClassSelection(int aElementClasses)
Sets the list of element classes that is included into decoded models.
|
void |
setElementClassSelection(int[] aElementClasses)
Sets the list of element classes that is included into decoded models.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used.
|
void |
setLevelNameSelection(String[] aLevelNames)
Sets the list of names of DGN levels that are to be included into all
decoded models, in addition to the numeric level selection.
|
void |
setLevelSelection(int[] aLevels)
Sets the list of DGN levels that is included into all decoded models.
|
void |
setLevelSelection(long aLevels)
Deprecated.
this method is limited to the first 64 levels. Starting with DGN version 8, this
is no longer sufficient. Use
setLevelSelection(long) or addLevel(int) instead. |
void |
setModelReference(ILcdModelReference aDefaultModelReference)
Deprecated.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder that will be used for creating model
references for decoded models.
|
void |
setTagSetSelection(String[] aTagSetNames)
Sets the set of DGN tag attributes that is decoded.
|
void |
setUseFloat(boolean aUseFloat)
Specifies whether to use memory-conserving floating point data structures
for the decoded models.
|
void |
setUserAttributeTypeSelection(int[] aTypes)
Sets the set of DGN MSLINK attributes that is decoded.
|
void |
setUserAttributeTypeSelection(String[] aTypes)
Sets the set of DGN MSLINK attributes that is decoded.
|
void |
setUserDefinedFont(int aFontIndex,
String aFontFileName)
Sets a user-defined font to be used in subsequently decoded models.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdDGNModelDecoder()
TLcdDGNModelDecoder
.public TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
TLcdDGNModelDecoder
.aModelReferenceDecoder
- the model reference decoder that can assign references to decoded
models.public TLcdDGNModelDecoder(ILcdModelReference aDefaultModelReference)
TLcdDGNModelDecoder
.aDefaultModelReference
- the model reference that decoded models will get if the model
reference decoder can't decode one.public TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference)
TLcdDGNModelDecoder
.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.public void clearUserDefinedFont(int aFontIndex)
aFontIndex
- the index of the font, as used in the DGN files.
The index must lie between 0 and 255.public void setUserDefinedFont(int aFontIndex, String aFontFileName) throws IOException
aFontIndex
- the index of the font, as used in the DGN files.
The index must lie between 0 and 255.aFontFileName
- the name of the cell definition file that defines the
font. This file is typically produced using Bentley's FONTEXPT utility,
which converts original RSC font files to CEL files.IOException
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ILcdInputStreamFactoryCapable
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactoryCapable
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
ILcdDGNModelDecoder
setModelReferenceDecoder
in interface ILcdDGNModelDecoder
public ILcdModelReferenceDecoder getModelReferenceDecoder()
getModelReferenceDecoder
in interface ILcdDGNModelDecoder
public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
ILcdDGNModelDecoder
setDefaultModelReference
in interface ILcdDGNModelDecoder
public ILcdModelReference getDefaultModelReference()
getDefaultModelReference
in interface ILcdDGNModelDecoder
public void setModelReference(ILcdModelReference aDefaultModelReference)
setDefaultModelReference(ILcdModelReference)
.public ILcdModelReference getModelReference()
getDefaultModelReference()
.public void setDatabaseURL(String aDatabaseURL)
ILcdDGNModelDecoder
setDatabaseURL
in interface ILcdDGNModelDecoder
public String getDatabaseURL()
getDatabaseURL
in interface ILcdDGNModelDecoder
public void setUseFloat(boolean aUseFloat)
ILcdDGNModelDecoder
setUseFloat
in interface ILcdDGNModelDecoder
public boolean isUseFloat()
isUseFloat
in interface ILcdDGNModelDecoder
public void resetLevelSelection()
ILcdDGNModelDecoder
resetLevelSelection
in interface ILcdDGNModelDecoder
public void clearLevelSelection()
ILcdDGNModelDecoder
clearLevelSelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.resetLevelSelection()
,
ILcdDGNModelDecoder.addLevel(int)
public void setLevelSelection(long aLevels)
setLevelSelection(long)
or addLevel(int)
instead.aLevels
- the level selection mask.public long getLevelSelection()
isLevelSelected(int)
or getSelectedLevels()
instead.public void setLevelSelection(int[] aLevels)
ILcdDGNModelDecoder
setLevelSelection
in interface ILcdDGNModelDecoder
aLevels
- the levels to be included in the decoded models.
They can be listed in any order, and duplicate numbers are allowed.public void addLevel(int aLevel)
ILcdDGNModelDecoder
addLevel
in interface ILcdDGNModelDecoder
aLevel
- the level to be included in the decoded models.public void clearLevelNameSelection()
ILcdDGNModelDecoder
clearLevelNameSelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.clearLevelSelection()
,
ILcdDGNModelDecoder.addLevelName(String)
public void setLevelNameSelection(String[] aLevelNames)
ILcdDGNModelDecoder
setLevelNameSelection
in interface ILcdDGNModelDecoder
aLevelNames
- the names of levels to be included in the decoded models.
They can be listed in any order, and duplicate names are allowed.public String[] getLevelNameSelection()
public void addLevelName(String aLevelName)
ILcdDGNModelDecoder
addLevelName
in interface ILcdDGNModelDecoder
aLevelName
- the name of the level to be included in the decoded models.public void resetElementClassSelection()
ILcdDGNModelDecoder
resetElementClassSelection
in interface ILcdDGNModelDecoder
public void setElementClassSelection(int aElementClasses)
ILcdDGNModelDecoder
setElementClassSelection
in interface ILcdDGNModelDecoder
aElementClasses
- a bitmask, specifying the element classes to be
included in the decoded models. It is a logical OR of 1-bits that are
shifted left by the following constants:
public int getElementClassSelection()
ILcdDGNModelDecoder
getElementClassSelection
in interface ILcdDGNModelDecoder
public void setElementClassSelection(int[] aElementClasses)
ILcdDGNModelDecoder
setElementClassSelection
in interface ILcdDGNModelDecoder
aElementClasses
- the element classes to be included in the decoded models.
They can be listed in any order, and duplicate entries are allowed.
The available DGN element classes are
ILcdDGNModelDecoder.setElementClassSelection(int)
public void addElementClass(int aElementClass)
ILcdDGNModelDecoder
addElementClass
in interface ILcdDGNModelDecoder
aElementClass
- the element class to be included in the decoded models.
The available DGN element classes are
public void resetUserAttributeTypeSelection()
ILcdDGNModelDecoder
resetUserAttributeTypeSelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.clearUserAttributeTypeSelection()
public void clearUserAttributeTypeSelection()
ILcdDGNModelDecoder
public void setUserAttributeTypeSelection(String[] aTypes)
ILcdDGNModelDecoder
Note that the attribute entities to be decoded have to be specified as
well, using the addAttributeEntity
method.
setUserAttributeTypeSelection
in interface ILcdDGNModelDecoder
aTypes
- a list of MSLINK attribute types, specified as numbers in RAD50 format
(strings of length 3, e.g. "ODB"
). Note that
RAD50 is actually radix 40, with the following 40 digits:
<space> A
...Z $ . 0
...9
public void setUserAttributeTypeSelection(int[] aTypes)
ILcdDGNModelDecoder
setUserAttributeTypeSelection
in interface ILcdDGNModelDecoder
aTypes
- a list of MSLINK attribute types, specified as integers
(unsigned shorts, e.g. 0x5e62, which corresponds to 'ODB'
in radix 50).ILcdDGNUserAttribute
public int[] getUserAttributeTypeSelection()
public void addUserAttributeType(String aType)
ILcdDGNModelDecoder
addUserAttributeType
in interface ILcdDGNModelDecoder
aType
- an MSLINK attribute type specified as a number in RAD50 format
(a string of length 3, e.g. "ODB"
). Note that
RAD50 is actually radix 40, with the following 40 digits:
<space> A
...Z $ . 0
...9
ILcdDGNModelDecoder.addUserAttributeType(int)
public void addUserAttributeType(int aType)
ILcdDGNModelDecoder
Note that the attribute entities to be decoded have to be specified as
well, using the addAttributeEntity
method.
addUserAttributeType
in interface ILcdDGNModelDecoder
aType
- an MSLINK attribute type specified as an integer
(an unsigned short, e.g. 0x5e62, which corresponds to 'ODB'
in radix 50).ILcdDGNModelDecoder.addUserAttributeType(java.lang.String)
,
ILcdDGNUserAttribute
public void resetAttributeEntitySelection()
ILcdDGNModelDecoder
resetAttributeEntitySelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.clearAttributeEntitySelection()
public void clearAttributeEntitySelection()
ILcdDGNModelDecoder
clearAttributeEntitySelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.resetAttributeEntitySelection()
,
ILcdDGNModelDecoder.addAttributeEntity(int)
public void setAttributeEntitySelection(int[] aEntities)
ILcdDGNModelDecoder
setAttributeEntitySelection
in interface ILcdDGNModelDecoder
aEntities
- a list of entity numbers of database attributes (user or non-user).public int[] getAttributeEntitySelection()
public void addAttributeEntity(int aEntity)
ILcdDGNModelDecoder
Note that, for decoding user attributes, the user attribute types to be
decoded have to be specified as well, using the addUserAttributeType
method.
Also note that the fill color, which is also stored as an element attribute, is an exception: it is always decoded as part of the display info.
addAttributeEntity
in interface ILcdDGNModelDecoder
aEntity
- an entity number of an database attribute (user or non-user).public void resetTagSetSelection()
ILcdDGNModelDecoder
resetTagSetSelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.clearTagSetSelection()
public void clearTagSetSelection()
ILcdDGNModelDecoder
clearTagSetSelection
in interface ILcdDGNModelDecoder
ILcdDGNModelDecoder.resetTagSetSelection()
,
ILcdDGNModelDecoder.addTagSet(java.lang.String)
public void setTagSetSelection(String[] aTagSetNames)
ILcdDGNModelDecoder
setTagSetSelection
in interface ILcdDGNModelDecoder
aTagSetNames
- a list of tag set names.public String[] getTagSetSelection()
public void addTagSet(String aTagSetName)
ILcdDGNModelDecoder
addTagSet
in interface ILcdDGNModelDecoder
aTagSetName
- a tag set name.public String getDefaultExtension()
public int[] getSelectedLevels()
public boolean isLevelSelected(int aLevel)
aLevel
- the level to checkpublic String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
public boolean canDecodeSource(String aSourceAsString)
ILcdModelDecoder
true
for a source name while decode
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.
canDecodeSource
in interface ILcdModelDecoder
aSourceAsString
- the data source to be verified; typically a file name or a URL.true
if the file extension is <defaultExtension> or
<defaultExtension>.gz, <code>false</code> otherwise (<defaultExtension> is the String
returned by getDefaultExtension).ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.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);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)