Class TLcdDGNLevelSymbology

java.lang.Object
com.luciad.format.dgn.TLcdDGNLevelSymbology
All Implemented Interfaces:
Serializable

public class TLcdDGNLevelSymbology extends Object implements Serializable
This class represents the level symbology table that is specified inside a DGN file. The level symbology table can have colors, weights, and styles, which override the colors, weights, and styles of the individual DGN elements. The element levels are identified by their indices in the list of defined levels.

Whether or not the table is overriding the element values is specified by the three respective boolean properties (cfr. hasStyle(), hasWeight(), and hasColor()).

If the element values are overridden, they can be requested for each level (cfr. getStyle(int), getWeight(int), and getColor(int)). Note that each DGN level has in fact two sets of symbologies:

  • the elements' default symbology, which is used by the elements whose color, weight or style is marked as "ByLevel"
  • the level symbology, which is used to override the style of the individual elements when the view level symbology flag is on, and the flags "useColor", "useWeight" or "useStyle" of the level are set to true.
This implementation keeps only the level symbology and the "UseViewLevelSymbology" flag is always true. If you attempt to retrieve the element ('bylevel') symbology, you get the values of the level symbology !

Note: for convenience, you can use the getColor(TLcdDGNDisplayInfo), getStyle(TLcdDGNDisplayInfo) and getWeight(TLcdDGNDisplayInfo) methods to retrieve the styling for an element according to the rules above.

See Also:
  • Field Details

  • Constructor Details

    • TLcdDGNLevelSymbology

      public TLcdDGNLevelSymbology(boolean aUseColor, boolean aUseWeight, boolean aUseStyle, int[] aSymbologies)
      Creates a new TLcdDGNLevelSymbology.
      Parameters:
      aUseColor - specifies whether the symbology colors should be used.
      aUseWeight - specifies whether the symbology weights should be used.
      aUseStyle - specifies whether the symbology styles should be used.
      aSymbologies - the level symbologies.
    • TLcdDGNLevelSymbology

      public TLcdDGNLevelSymbology(boolean aUseColor, boolean aUseWeight, boolean aUseStyle, int[] aSymbologies, String[] aNames, String[] aDescriptions)
      Creates a new TLcdDGNLevelSymbology.
      Parameters:
      aUseColor - specifies whether the symbology colors should be used.
      aUseWeight - specifies whether the symbology weights should be used.
      aUseStyle - specifies whether the symbology styles should be used.
      aSymbologies - the level symbologies.
      aNames - the level names.
      aDescriptions - the level descriptions.
    • TLcdDGNLevelSymbology

      public TLcdDGNLevelSymbology(TLcdDGNLevel[] aLevels)
      Deprecated.
      You should not create a level symbology yourself, the decoder will create it for you.
      Creates a new TLcdDGNLevelSymbology.
      Parameters:
      aLevels - the level objects that make up the symbology.
  • Method Details

    • hasColor

      public boolean hasColor()
      Deprecated.
      Use hasColor(int) for compatibility with DGN V8 files.
      Returns whether the symbology colors should be used.
    • hasWeight

      public boolean hasWeight()
      Deprecated.
      Use hasWeight(int) for compatibility with DGN V8 files.
      Returns whether the symbology weights should be used.
    • hasStyle

      public boolean hasStyle()
      Deprecated.
      Use hasStyle(int) for compatibility with DGN V8 files.
      Returns whether the symbology styles should be used.
    • getLevelCount

      public int getLevelCount()
      Returns the number of defined levels. For DGN V7 files, the number is always 64.
    • getLevelID

      public int getLevelID(int aLevelIndex)
      Returns the level ID, based on the level index. For DGN V7 files, the level index is always equal to the level ID.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the level ID.
    • getLevelNumber

      public int getLevelNumber(int aLevelIndex)
      Returns the level number of the specified level. For DGN V7 files, the level number is always equal to the level ID (and the level index). For DGN V8 files, the level number can be entirely different.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the level number.
    • getLevelIndex

      public int getLevelIndex(int aLevelID)
      Returns the level index, based on the level ID, which is stored with DGN elements. For DGN V7 files, the level index is always equal to the level ID.
      Parameters:
      aLevelID - the level ID.
      Returns:
      the level index.
    • getLevel

      public int getLevel(int aLevelID)
      Deprecated.
      Use (@link #getLevelIndex(int)}.
    • getName

      public String getName(int aLevelIndex)
      Returns the name of the specified level.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the level name.
    • getDescription

      public String getDescription(int aLevelIndex)
      Returns the description of the specified level.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the level description.
    • hasColor

      public boolean hasColor(int aLevelIndex)
      Returns whether the symbology override color should be used.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the override flag.
    • hasWeight

      public boolean hasWeight(int aLevelIndex)
      Returns whether the symbology override weight should be used.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the override flag.
    • hasStyle

      public boolean hasStyle(int aLevelIndex)
      Returns whether the symbology override style should be used.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the override flag.
    • hasFillColor

      public boolean hasFillColor(int aLevelIndex)
      Returns whether the symbology override fill color should be used. Symbology fill colors are only supported as of DGN V8.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the override flag.
    • getColor

      public int getColor(int aLevelIndex)
      Returns the symbology override color of elements at the specified level.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the symbology color.
    • getWeight

      public int getWeight(int aLevelIndex)
      Returns the symbology override weight of elements at the specified level.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the symbology weight.
    • getStyle

      public int getStyle(int aLevelIndex)
      Returns the symbology override style of elements at the specified level.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the symbology style.
    • getFillColor

      public int getFillColor(int aLevelIndex)
      Returns the symbology fill color of elements at the specified level. Symbology fill colors are only supported as of DGN V8.
      Parameters:
      aLevelIndex - the level index.
      Returns:
      the symbology fill color.
    • isUseViewLevelSymbology

      public boolean isUseViewLevelSymbology()
      Indicates whether the view level overrides should be used for styling.

      By default, this is the ViewLevelSymbology flag of the model descriptor. You can override this.

      See getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable) for styling resolution priorities.

      Returns:
      whether view level overrides should be used.
    • setUseViewLevelSymbology

      public void setUseViewLevelSymbology(boolean aUseLevelSymbology)
      Set whether the view level overrides should be used for styling.
      Parameters:
      aUseLevelSymbology - the desired setting
      See Also:
    • getElementColor

      public int getElementColor(int aLevelIndex)
      Deprecated.
      This call does not take RGB colors into account. Use getElementColor(int, TLcdDGNColorTable) instead.
      Returns the element color of the elements on the given level, which is used to display the elements that have the 'bylevel' color value.
      Parameters:
      aLevelIndex -
      Returns:
      the level color index.
    • getElementColor

      public Color getElementColor(int aLevelIndex, TLcdDGNColorTable aColorTable)
      Returns the element color of the elements on the given level, which is used to display the elements that have the 'bylevel' color value.
      Parameters:
      aLevelIndex - The level index
      aColorTable - The color table to use
      Returns:
      the level color.
    • getElementWeight

      public int getElementWeight(int aLevelIndex)
      This implementation returns the same value as getElementWeight()
      Parameters:
      aLevelIndex -
      Returns:
      the level weight.
    • getElementStyle

      public int getElementStyle(int aLevelIndex)
      This implementation returns the same value as getStyle()
      Parameters:
      aLevelIndex -
      Returns:
      the level style.
    • getColor

      public int getColor(TLcdDGNDisplayInfo aDisplayInfo)

      Retrieve the color index for a particular element based on the styling priorities defined by MicroStation.

      This call does not take "extended" RGB colors into account. Use getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable) instead.

      See getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable) for priority rules.

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      a color index that can be used with the model descriptor's color table
      See Also:
    • getColor

      public Color getColor(TLcdDGNDisplayInfo aDisplayInfo, TLcdDGNColorTable aColorTable)

      Retrieve the color for a particular element based on the styling priorities defined by MicroStation.

      Priorities:

      1. Defined by the "Overrides" symbology
        • Only if view level symbology is set
        • If defined for particular level
      2. Defined by specific element
        • If defined
      3. Defined by the "ByLevel" symbology

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      a color
      See Also:
    • getColor

      public Color getColor(TLcdDGNDisplayInfo aDisplayInfo, TLcdDGNColorTable aColorTable, Color aBackgroundColor)

      Retrieve the color for a particular element based on the styling priorities defined by MicroStation.

      Priorities:

      1. Defined by the "Overrides" symbology
        • Only if view level symbology is set
        • If defined for particular level
      2. Defined by specific element
        • If defined
      3. Defined by the "ByLevel" symbology

      Parameters:
      aDisplayInfo - Display info associated with the element
      aColorTable - The color table to use (see TLcdDGNModelDescriptor.getDGNColorTable())
      aBackgroundColor - The view's background color
      Returns:
      a color
      See Also:
    • getStyle

      public int getStyle(TLcdDGNDisplayInfo aDisplayInfo)

      Retrieve the style for a particular element based on the styling priorities defined by MicroStation.

      A line style can either be:

      Possible basic line styles:

      • 0: solid
      • 1: dotted
      • 2: medium dash
      • 3: long dash
      • 4: dot-dash
      • 5: short dash
      • 6: dash-dot-dot
      • 7: long dash-short dash

      See getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable) for priority rules.

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      line style number as defined by MicroStation
    • getStyleName

      public String getStyleName(TLcdDGNDisplayInfo aDisplayInfo)
      Returns the line style name associated with the style for the given element.
      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      The line style name, or null if unknown
    • getStyleName

      public String getStyleName(int aStyle)
      Returns the line style name associated with the given line style ID.
      Parameters:
      aStyle - A line style ID
      Returns:
      The line style name, or null if unknown
    • getWeight

      public int getWeight(TLcdDGNDisplayInfo aDisplayInfo)

      Retrieve the line weight for a particular element based on the styling priorities defined by MicroStation.

      The returned weight is between 0 and 31 and can be interpreted as pixels.

      See getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable) for priority rules.

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      line width, between 0 and 31.
    • getFillColor

      public int getFillColor(TLcdDGNDisplayInfo aDisplayInfo)

      Retrieve the fill color for a particular element based on the styling priorities defined by MicroStation.

      Note: this function does not take fill style (hole vs. solid) into account, see TLcdDGNDisplayInfo.isHole() and TLcdDGNDisplayInfo.isFilled().

      See getColor(TLcdDGNDisplayInfo, TLcdDGNColorTable, Color) for priority rules.

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      a color index that can be used with the model descriptor's color table
      See Also:
    • getFillColor

      public Color getFillColor(TLcdDGNDisplayInfo aDisplayInfo, TLcdDGNColorTable aColorTable)

      Retrieve the fill color for a particular element based on the styling priorities defined by MicroStation.

      Note: this function does not take fill style (hole vs. solid) into account, see TLcdDGNDisplayInfo.isHole() and TLcdDGNDisplayInfo.isFilled().

      See getColor(TLcdDGNDisplayInfo) for priority rules

      Parameters:
      aDisplayInfo - Display info associated with the element
      Returns:
      a color
      See Also:
    • getFillColor

      public Color getFillColor(TLcdDGNDisplayInfo aDisplayInfo, TLcdDGNColorTable aColorTable, Color aBackgroundColor)

      Retrieve the fill color for a particular element based on the styling priorities defined by MicroStation.

      Note: this function does not take fill style (hole vs. solid) into account, see TLcdDGNDisplayInfo.isHole() and TLcdDGNDisplayInfo.isFilled().

      See getColor(TLcdDGNDisplayInfo) for priority rules

      Parameters:
      aDisplayInfo - Display info associated with the element
      aColorTable - The color table to use (see TLcdDGNModelDescriptor.getDGNColorTable())
      aBackgroundColor - The view's background color
      Returns:
      a color
      See Also: