Class TLcdDGNModelDecoder

java.lang.Object
com.luciad.format.dgn.TLcdDGNModelDecoder
All Implemented Interfaces:
ILcdDGNModelDecoder, ILcdInputStreamFactoryCapable, ILcdModelDecoder

This model decoder decodes vector data in Intergraph Standard File Formats (ISFF). These file formats are common to Bentley's MicroStation and Intergraph's Interactive Graphics Design System.

Input files Link icon

File Required Entry point Description
*.dgn x x Design file (V7 or V8) containing vector data

Model reference Link icon

The model reference is obtained from an 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 If this fails, the decoder's default model reference is returned. Unless set by the user, the default model reference is null.

Supported file transfer protocols Link icon

  • This model decoder supports currently only supports reading data from files.

Model structure Link icon

  • This model decoder creates a model per DGN file.
  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel.
  • The models are expose any DGN tags through its data model. See further for more details.

Model descriptor Link icon

  • All models returned by this model decoder have a TLcdDGNModelDescriptor. Among other information, the descriptor contains the DGN symbology.
  • The type name of the model descriptor is the display name of this decoder.
  • The model descriptor returned by this model decoder is a TLcdDataModelDescriptor. Its data model exposes the DGN tags in a uniform way.

Model elements Link icon

  • Decoded models contain elements that all implement ILcdDGNShape.
  • All elements are ILcdDataObjects. 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.
The following DGN elements are currently supported:
DGN element typeDGN element name Decoded object
1LIBRARY_CELL
2CELL TLcdDGNCell
3LINE TLcdDGNLine2D
4LINE_STRING TLcdDGNLineString2D
5GROUP_DATA
6SHAPE TLcdDGNShape2D
7TEXT_NODE TLcdDGNText2D
9DESIGN_SETTINGS
10LEVEL_SYMBOLOGY
11CURVE TLcdDGNCurve2D
12COMPLEX_CHAIN TLcdDGNComplexChain
14COMPLEX_SHAPE TLcdDGNComplexShape
15ELLIPSE TLcdDGNEllipse2D
16ARC TLcdDGNArc2D
17TEXT TLcdDGNText2D
183D_SURFACE TLcdDGN3DSurface
19SOLID TLcdDGNSolid
33DIMENSION (note) TLcdDGNDimension
34SHARED_CELL_DEFINITION
35SHARED_CELL_INSTANCE TLcdDGNCell
36CELL_MULTI_LINE TLcdDGNCell
37TAG_DATA

The following DGN elements that are not supported (basically splines, 3D surfaces, and rasters):

DGN element typeDGN element name
8DIGITIZER_SETUP
13CONIC
20SUBFIGURE
21B_SPLINE_CURVE
22POINT_STRING
23CONE
24B_SPLINE_SURFACE
25B_SPLINE_BOUNDARY
26B_SPLINE_KNOT
27B_SPLINE_WEIGHT
28B_SPLINE
33DIMENSION
66APPLICATION
87RASTER_HEADER
88RASTER_DATA

Useful settings Link icon

Sample code Link icon


 ILcdModelDecoder decoder =
   new TLcdDGNNativeModelDecoder(new TLcdEPSGModelReferenceDecoder(),
                                 new TLcdGeodeticReference(new TLcdGeodeticDatum()));

 ILcdModel model = decoder.decode("vectordata.dgn");
 

Performance tips Link icon

  • By default, attributes are not decoded, potentially saving some memory and some processing time.

Thread safety Link icon

  • The decoding of models is not thread-safe.
  • The decoded models are thread-safe for read access.

Supported versions and specifications Link icon

  • DGN V7
  • DGN V8

Known limitations Link icon

  • The current implementation does not support splines, 3D surfaces, and rasters.
  • The current implementation will bypass the ILcdInputStreamFactory if the source is a regular file that can be read locally. If the source cannot be read locally (e.g. it is a URL) the source is copied to a local temp file before decoding, using the ILcdInputStreamFactory. Note that you can force the decoder to always use the input stream factory using system property dgn.decoder.alwaysuseinputstream=true.
  • The current implementation does not support user-defined fonts.
  • The symbology of the model elements corresponds to the first DGN view.
  • Constructor Details Link icon

    • TLcdDGNModelDecoder Link icon

      public TLcdDGNModelDecoder()
      Creates a new TLcdDGNModelDecoder.
    • TLcdDGNModelDecoder Link icon

      public TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
      Creates a new TLcdDGNModelDecoder.
      Parameters:
      aModelReferenceDecoder - the model reference decoder that can assign references to decoded models.
    • TLcdDGNModelDecoder Link icon

      public TLcdDGNModelDecoder(ILcdModelReference aDefaultModelReference)
      Creates a new TLcdDGNModelDecoder.
      Parameters:
      aDefaultModelReference - the model reference that decoded models will get if the model reference decoder can't decode one.
    • TLcdDGNModelDecoder Link icon

      public TLcdDGNModelDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference)
      Creates a new TLcdDGNModelDecoder.
      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 Link icon

    • clearUserDefinedFont Link icon

      public void clearUserDefinedFont(int aFontIndex)
    • setUserDefinedFont Link icon

      public void setUserDefinedFont(int aFontIndex, String aFontFileName) throws IOException
      Throws:
      IOException
    • setInputStreamFactory Link icon

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Description copied from interface: ILcdInputStreamFactoryCapable
      Sets the input stream factory to be used.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used.
    • getInputStreamFactory Link icon

      public ILcdInputStreamFactory getInputStreamFactory()
      Description copied from interface: ILcdInputStreamFactoryCapable
      Returns the input stream factory that is used.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory that is used.
    • setModelReferenceDecoder Link icon

      public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the model reference decoder that will be used for creating model references for decoded models.
      Specified by:
      setModelReferenceDecoder in interface ILcdDGNModelDecoder
    • getModelReferenceDecoder Link icon

      public ILcdModelReferenceDecoder getModelReferenceDecoder()
      Specified by:
      getModelReferenceDecoder in interface ILcdDGNModelDecoder
    • setDefaultModelReference Link icon

      public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.
      Specified by:
      setDefaultModelReference in interface ILcdDGNModelDecoder
    • getDefaultModelReference Link icon

      public ILcdModelReference getDefaultModelReference()
      Specified by:
      getDefaultModelReference in interface ILcdDGNModelDecoder
    • setModelReference Link icon

      public void setModelReference(ILcdModelReference aDefaultModelReference)
    • getModelReference Link icon

      public ILcdModelReference getModelReference()
      Deprecated.
    • setDatabaseURL Link icon

      public void setDatabaseURL(String aDatabaseURL)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the default database URL that is assigned to all decoded attributes. The URL can then be used by the application.
      Specified by:
      setDatabaseURL in interface ILcdDGNModelDecoder
    • getDatabaseURL Link icon

      public String getDatabaseURL()
      Specified by:
      getDatabaseURL in interface ILcdDGNModelDecoder
    • setUseFloat Link icon

      public void setUseFloat(boolean aUseFloat)
      Description copied from interface: ILcdDGNModelDecoder
      Specifies whether to use memory-conserving floating point data structures for the decoded models.
      Specified by:
      setUseFloat in interface ILcdDGNModelDecoder
    • isUseFloat Link icon

      public boolean isUseFloat()
      Specified by:
      isUseFloat in interface ILcdDGNModelDecoder
    • resetLevelSelection Link icon

      public void resetLevelSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Resets the list of DGN levels that is included into decoded models. As a result, all DGN levels will be included in the models when decoding DGN files.
      Specified by:
      resetLevelSelection in interface ILcdDGNModelDecoder
    • clearLevelSelection Link icon

      public void clearLevelSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Clears the list of DGN levels that is included into decoded models. As a result, only level 0 will be included in the models when decoding DGN files.
      Specified by:
      clearLevelSelection in interface ILcdDGNModelDecoder
      See Also:
    • setLevelSelection Link icon

      public 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.
    • getLevelSelection Link icon

      public 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.
    • setLevelSelection Link icon

      public void setLevelSelection(int[] aLevels)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the list of DGN levels that is included into all decoded models. Level 0 is always included, irrespective of the selection setting.
      Specified by:
      setLevelSelection in interface ILcdDGNModelDecoder
      Parameters:
      aLevels - the levels to be included in the decoded models. They can be listed in any order, and duplicate numbers are allowed.
    • addLevel Link icon

      public void addLevel(int aLevel)
      Description copied from interface: ILcdDGNModelDecoder
      Adds a level to the list of DGN levels that is included into all decoded models.
      Specified by:
      addLevel in interface ILcdDGNModelDecoder
      Parameters:
      aLevel - the level to be included in the decoded models.
    • clearLevelNameSelection Link icon

      public void clearLevelNameSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Clears the list of names of DGN levels that are to be included into all decoded models. As a result, only levels specified in the numeric level selection will be included.
      Specified by:
      clearLevelNameSelection in interface ILcdDGNModelDecoder
      See Also:
    • setLevelNameSelection Link icon

      public void setLevelNameSelection(String[] aLevelNames)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the list of names of DGN levels that are to be included into all decoded models, in addition to the numeric level selection.
      Specified by:
      setLevelNameSelection in interface ILcdDGNModelDecoder
      Parameters:
      aLevelNames - the names of levels to be included in the decoded models. They can be listed in any order, and duplicate names are allowed.
    • getLevelNameSelection Link icon

      public String[] getLevelNameSelection()
    • addLevelName Link icon

      public void addLevelName(String aLevelName)
      Description copied from interface: ILcdDGNModelDecoder
      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.
      Specified by:
      addLevelName in interface ILcdDGNModelDecoder
      Parameters:
      aLevelName - the name of the level to be included in the decoded models.
    • resetElementClassSelection Link icon

      public void resetElementClassSelection()
      Description copied from interface: ILcdDGNModelDecoder
      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.
      Specified by:
      resetElementClassSelection in interface ILcdDGNModelDecoder
    • setElementClassSelection Link icon

      public void setElementClassSelection(int aElementClasses)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the list of element classes that is included into decoded models. This property allows to exclude certain classes from the decoded models, e.g. construction elements.
      Specified by:
      setElementClassSelection in interface ILcdDGNModelDecoder
      Parameters:
      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:
      • TLcdDGNDisplayInfo.CLASS_PRIMARY
      • TLcdDGNDisplayInfo.CLASS_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION
      • TLcdDGNDisplayInfo.CLASS_DIMENSION
      • TLcdDGNDisplayInfo.CLASS_PRIMARY_RULE
      • TLcdDGNDisplayInfo.CLASS_LINEAR_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION_RULE
    • getElementClassSelection Link icon

      public int getElementClassSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Gets the the bitmask specifying list of element classes that is included into decoded models.
      Specified by:
      getElementClassSelection in interface ILcdDGNModelDecoder
    • setElementClassSelection Link icon

      public void setElementClassSelection(int[] aElementClasses)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the list of element classes that is included into decoded models. This property allows to exclude certain classes from the decoded models, e.g. construction elements.
      Specified by:
      setElementClassSelection in interface ILcdDGNModelDecoder
      Parameters:
      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

      • TLcdDGNDisplayInfo.CLASS_PRIMARY
      • TLcdDGNDisplayInfo.CLASS_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION
      • TLcdDGNDisplayInfo.CLASS_DIMENSION
      • TLcdDGNDisplayInfo.CLASS_PRIMARY_RULE
      • TLcdDGNDisplayInfo.CLASS_LINEAR_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION_RULE
      See Also:
    • addElementClass Link icon

      public void addElementClass(int aElementClass)
      Description copied from interface: ILcdDGNModelDecoder
      Adds an element class to the list of element classes that is included into decoded models. This property allows to exclude certain classes from the decoded models, e.g. construction elements.
      Specified by:
      addElementClass in interface ILcdDGNModelDecoder
      Parameters:
      aElementClass - the element class to be included in the decoded models.

      The available DGN element classes are

      • TLcdDGNDisplayInfo.CLASS_PRIMARY
      • TLcdDGNDisplayInfo.CLASS_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION
      • TLcdDGNDisplayInfo.CLASS_DIMENSION
      • TLcdDGNDisplayInfo.CLASS_PRIMARY_RULE
      • TLcdDGNDisplayInfo.CLASS_LINEAR_PATTERN
      • TLcdDGNDisplayInfo.CLASS_CONSTRUCTION_RULE
    • resetUserAttributeTypeSelection Link icon

      public void resetUserAttributeTypeSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Resets the set of DGN MSLINK attributes that is decoded. All MSLINK attributes will now be included in the models when decoding DGN files.
      Specified by:
      resetUserAttributeTypeSelection in interface ILcdDGNModelDecoder
      See Also:
    • clearUserAttributeTypeSelection Link icon

      public void clearUserAttributeTypeSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Clears the set of DGN MSLINK attributes that is decoded. None of the MSLINK attributes will now be included in the models when decoding DGN files.
      Specified by:
      clearUserAttributeTypeSelection in interface ILcdDGNModelDecoder
      See Also:
    • setUserAttributeTypeSelection Link icon

      public void setUserAttributeTypeSelection(String[] aTypes)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the set of DGN MSLINK attributes that is decoded. Only MSLINK attributes with the specified types will now be included in the models when decoding DGN files.

      Note that the attribute entities to be decoded have to be specified as well, using the addAttributeEntity method.

      Specified by:
      setUserAttributeTypeSelection in interface ILcdDGNModelDecoder
      Parameters:
      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
    • setUserAttributeTypeSelection Link icon

      public void setUserAttributeTypeSelection(int[] aTypes)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the set of DGN MSLINK attributes that is decoded. Only MSLINK attributes with the specified types will now be included in the models when decoding DGN files.
      Specified by:
      setUserAttributeTypeSelection in interface ILcdDGNModelDecoder
      Parameters:
      aTypes - a list of MSLINK attribute types, specified as integers (unsigned shorts, e.g. 0x5e62, which corresponds to 'ODB' in radix 50).
      See Also:
    • getUserAttributeTypeSelection Link icon

      public int[] getUserAttributeTypeSelection()
    • addUserAttributeType Link icon

      public void addUserAttributeType(String aType)
      Description copied from interface: ILcdDGNModelDecoder
      Adds a DGN MSLINK attribute type to the set of types that is decoded.
      Specified by:
      addUserAttributeType in interface ILcdDGNModelDecoder
      Parameters:
      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
      See Also:
    • addUserAttributeType Link icon

      public void addUserAttributeType(int aType)
      Description copied from interface: ILcdDGNModelDecoder
      Adds a DGN MSLINK attribute type to the set of types that is decoded. Only MSLINK attributes that have types in this set are decoded.

      Note that the attribute entities to be decoded have to be specified as well, using the addAttributeEntity method.

      Specified by:
      addUserAttributeType in interface ILcdDGNModelDecoder
      Parameters:
      aType - an MSLINK attribute type specified as an integer (an unsigned short, e.g. 0x5e62, which corresponds to 'ODB' in radix 50).
      See Also:
    • resetAttributeEntitySelection Link icon

      public void resetAttributeEntitySelection()
      Description copied from interface: ILcdDGNModelDecoder
      Resets the set of DGN database attributes that is decoded. All DGN database attributes will now be included in the models when decoding DGN files.
      Specified by:
      resetAttributeEntitySelection in interface ILcdDGNModelDecoder
      See Also:
    • clearAttributeEntitySelection Link icon

      public void clearAttributeEntitySelection()
      Description copied from interface: ILcdDGNModelDecoder
      Clears the set of DGN database attributes that is decoded. None of the DGN database attributes will now be included in the models when decoding DGN files.
      Specified by:
      clearAttributeEntitySelection in interface ILcdDGNModelDecoder
      See Also:
    • setAttributeEntitySelection Link icon

      public void setAttributeEntitySelection(int[] aEntities)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the set of DGN database attributes that is decoded. Only DGN database attributes with the specified entity numbers will now be included in the models when decoding DGN files.
      Specified by:
      setAttributeEntitySelection in interface ILcdDGNModelDecoder
      Parameters:
      aEntities - a list of entity numbers of database attributes (user or non-user).
    • getAttributeEntitySelection Link icon

      public int[] getAttributeEntitySelection()
    • addAttributeEntity Link icon

      public void addAttributeEntity(int aEntity)
      Description copied from interface: ILcdDGNModelDecoder
      Adds an attribute entity number to the set of numbers that is decoded. Only attributes that have entity numbers in this set are decoded.

      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.

      Specified by:
      addAttributeEntity in interface ILcdDGNModelDecoder
      Parameters:
      aEntity - an entity number of an database attribute (user or non-user).
    • resetTagSetSelection Link icon

      public void resetTagSetSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Resets the set of DGN tag sets that is decoded. All tag sets and their attributes will now be included in the models when decoding DGN files.
      Specified by:
      resetTagSetSelection in interface ILcdDGNModelDecoder
      See Also:
    • clearTagSetSelection Link icon

      public void clearTagSetSelection()
      Description copied from interface: ILcdDGNModelDecoder
      Clears the set of DGN tag sets that is decoded. None of the tag sets will now be included in the models when decoding DGN files.
      Specified by:
      clearTagSetSelection in interface ILcdDGNModelDecoder
      See Also:
    • setTagSetSelection Link icon

      public void setTagSetSelection(String[] aTagSetNames)
      Description copied from interface: ILcdDGNModelDecoder
      Sets the set of DGN tag attributes that is decoded. Only the specified tag sets and their attributes will now be included in the models when decoding DGN files.
      Specified by:
      setTagSetSelection in interface ILcdDGNModelDecoder
      Parameters:
      aTagSetNames - a list of tag set names.
    • getTagSetSelection Link icon

      public String[] getTagSetSelection()
    • addTagSet Link icon

      public void addTagSet(String aTagSetName)
      Description copied from interface: ILcdDGNModelDecoder
      Adds a tag set name to the set of names that is decoded. Only the specified tag sets and their attributes will now be included in the models when decoding DGN files.
      Specified by:
      addTagSet in interface ILcdDGNModelDecoder
      Parameters:
      aTagSetName - a tag set name.
    • getDefaultExtension Link icon

      public String getDefaultExtension()
    • getSelectedLevels Link icon

      public int[] getSelectedLevels()
    • isLevelSelected Link icon

      public boolean isLevelSelected(int aLevel)
    • getDisplayName Link icon

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      "DGN".
    • canDecodeSource Link icon

      public boolean canDecodeSource(String aSourceAsString)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return 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.

      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceAsString - the data source to be verified; typically a file name or a URL.
      Returns:
      true if the file extension is <defaultExtension> or <defaultExtension>.gz, <code>false</code> otherwise (<defaultExtension> is the String returned by getDefaultExtension).
      See Also:
    • decode Link icon

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      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: