Class TLcdSymbol

java.lang.Object
com.luciad.gui.TLcdSymbol
All Implemented Interfaces:
ILcdIcon, ILcdResizeableIcon, ILcdCloneable, Serializable, Cloneable

public class TLcdSymbol extends Object implements ILcdResizeableIcon
A convenience icon implementation for simple symbols, such as squares or circles.

This width and the height of this icon are always the same. Setting the width using setIconWidth(int) also sets the height and vice versa.

Note that the hashCode implementation of this class matches the equals implementation, and therefore the hashcode will change when modifying the instance. Hence, it is strongly advised to treat a TLcdSymbol as an immutable object, and never change it after construction. If you want to change the symbol, create a new one instead.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant for an area symbol.
    static final int
    Constant for a circle.
    static final int
    Constant for a cross symbol.
    static final int
    Constant for cross symbol in a rectangle.
    static final int
    Constant for a filled circle having a double outline.
    static final int
    Constant for a filled rectangle having a double outline.
    static final int
    Constant for a filled circle.
    static final int
    Constant for a filled rectangle.
    static final int
    Constant for a filled triangle.
    static final int
    The number of available symbols.
    static final int
    Constant for a outlined area symbol.
    static final int
    Constant for a plus sign.
    static final int
    Constant for a plus sign in a diamond.
    static final int
    Constant for a plus sign in a rectangle.
    static final int
    Constant for points symbol.
    static final int
    Constant for a polygon symbol.
    static final int
    Constant for a polyline symbol.
    static final int
    Constant for rectangle.
    static final int
    Constant for a text symbol.
    static final int
    Constant for a triangle.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a default symbol (using FILLED_RECT).
    TLcdSymbol(int aType)
    Constructs a symbol of type aType.
    TLcdSymbol(int aType, int aSize)
    Construct a symbol of a given type and size.
    TLcdSymbol(int aType, int aSize, Color aColor)
    Construct a symbol of a given type, size and color.
    TLcdSymbol(int aType, int aSize, Color aBorderColor, Color aFillColor)
    Construct a symbol of a given type, size and colors.
    TLcdSymbol(int aType, int aSize, Color aBorderColor, Color aFillColor, float aBorderWidth)
    Construct a symbol of a given type, size, colors and border width.
    Constructs a symbol, identical to the argument symbol.
  • Method Summary

    Modifier and Type
    Method
    Description
    Makes Object.clone() public.
    boolean
    equals(Object aObject)
     
    Returns the color used for the outline/border of this symbol.
    float
    Returns the width of the outline (if any).
    The border width can only be specified when constructing a new symbol.
    Returns the color used for the inner area of this symbol.
    int
    Returns the fixed height of the icon.
    int
    Returns the fixed width of the icon.
    int
    Returns the symbol shape.
    int
    Returns the symbol shape.
    int
    Returns the size of the symbol.
    static String[]
    Returns the names of the symbols.
    int
     
    boolean
    Determines if anti-aliasing is enabled or not.
    static void
    paint(int aType, int aSize, Graphics g, Color aBorderColor, Color aFillColor, int aX, int aY)
    Deprecated.
    use the non-static paint method
    void
    paintIcon(Component aComponent, Graphics aGraphics, int aX, int aY)
    Draw the ILcdIcon at the specified location.
    void
    setAntiAliasing(boolean aAntiAliasing)
    Enables or disables anti-aliased rendering of this symbol.
    void
    Sets the border color for this symbol.
    void
    setFillColor(Color newColor)
    Sets the fill color for this symbol.
    void
    setIconHeight(int aHeight)
    Set the height of the icon.
    void
    setIconWidth(int aWidth)
    Set the width of the icon.
    void
    setShape(int aShape)
    Sets the symbol shape.
    void
    setSize(int aSize)
    Sets the size of the symbol.
     
    toString(int aType)
    Return the name of this type of symbol.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • N_ICON

      public static final int N_ICON
      The number of available symbols.
      See Also:
    • CIRCLE

      public static final int CIRCLE
      Constant for a circle.
      See Also:
    • FILLED_CIRCLE

      public static final int FILLED_CIRCLE
      Constant for a filled circle.
      See Also:
    • RECT

      public static final int RECT
      Constant for rectangle.
      See Also:
    • FILLED_RECT

      public static final int FILLED_RECT
      Constant for a filled rectangle.
      See Also:
    • PLUS

      public static final int PLUS
      Constant for a plus sign.
      See Also:
    • PLUS_RECT

      public static final int PLUS_RECT
      Constant for a plus sign in a rectangle.
      See Also:
    • CROSS

      public static final int CROSS
      Constant for a cross symbol.
      See Also:
    • CROSS_RECT

      public static final int CROSS_RECT
      Constant for cross symbol in a rectangle.
      See Also:
    • TRIANGLE

      public static final int TRIANGLE
      Constant for a triangle.
      See Also:
    • FILLED_TRIANGLE

      public static final int FILLED_TRIANGLE
      Constant for a filled triangle.
      See Also:
    • POLYLINE

      public static final int POLYLINE
      Constant for a polyline symbol.
      See Also:
    • POLYGON

      public static final int POLYGON
      Constant for a polygon symbol.
      See Also:
    • AREA

      public static final int AREA
      Constant for an area symbol.
      See Also:
    • POINTS

      public static final int POINTS
      Constant for points symbol.
      See Also:
    • OUTLINED_AREA

      public static final int OUTLINED_AREA
      Constant for a outlined area symbol.
      See Also:
    • TEXT

      public static final int TEXT
      Constant for a text symbol.
      See Also:
    • DOUBLE_OUTLINED_RECT

      public static final int DOUBLE_OUTLINED_RECT
      Constant for a filled rectangle having a double outline. The inner outline uses the border color, the outer outline uses the fill color.
      Since:
      2012.1
      See Also:
    • DOUBLE_OUTLINED_CIRCLE

      public static final int DOUBLE_OUTLINED_CIRCLE
      Constant for a filled circle having a double outline. The inner outline uses the border color, the outer outline uses the fill color.
      Since:
      2017.0
      See Also:
    • PLUS_DIAMOND

      public static final int PLUS_DIAMOND
      Constant for a plus sign in a diamond.
      Since:
      2023.1
      See Also:
  • Constructor Details

    • TLcdSymbol

      public TLcdSymbol()
      Constructs a default symbol (using FILLED_RECT).
    • TLcdSymbol

      public TLcdSymbol(int aType)
      Constructs a symbol of type aType.
      Parameters:
      aType - the type this symbol should represent.
    • TLcdSymbol

      public TLcdSymbol(int aType, int aSize)
      Construct a symbol of a given type and size.
      Parameters:
      aType - the type this symbol should represent.
      aSize - the size of the symbol, in pixels.
    • TLcdSymbol

      public TLcdSymbol(int aType, int aSize, Color aColor)
      Construct a symbol of a given type, size and color.
      Parameters:
      aType - the type this symbol should represent.
      aSize - the size of the symbol, in pixels.
      aColor - the color of this symbol.
    • TLcdSymbol

      public TLcdSymbol(int aType, int aSize, Color aBorderColor, Color aFillColor)
      Construct a symbol of a given type, size and colors.
      Parameters:
      aType - the type this symbol should represent.
      aSize - the size of the symbol, in pixels.
      aBorderColor - the color to use for the outline of this symbol.
      aFillColor - the color to use for the inner area of this symbol.
    • TLcdSymbol

      public TLcdSymbol(int aType, int aSize, Color aBorderColor, Color aFillColor, float aBorderWidth)
      Construct a symbol of a given type, size, colors and border width.
      Parameters:
      aType - the type this symbol should represent.
      aSize - the size of the symbol, in pixels.
      aBorderColor - the color to use for the outline of this symbol.
      aFillColor - the color to use for the inner area of this symbol.
      aBorderWidth - the width used for the outline/border of this symbol.
      Since:
      2019.1
    • TLcdSymbol

      public TLcdSymbol(TLcdSymbol aSymbol)
      Constructs a symbol, identical to the argument symbol.
      Parameters:
      aSymbol - the symbol to copy.
  • Method Details

    • isAntiAliasing

      public boolean isAntiAliasing()
      Determines if anti-aliasing is enabled or not.
      Returns:
      true if anti-aliasing is enabled; false otherwise
      Since:
      2014.0
      See Also:
    • setAntiAliasing

      public void setAntiAliasing(boolean aAntiAliasing)
      Enables or disables anti-aliased rendering of this symbol. By default, anti-aliasing is enabled.
      Parameters:
      aAntiAliasing - true to enable anti-aliasing; false to disable it
      Since:
      2014.0
      See Also:
    • getTypeNames

      public static String[] getTypeNames()
      Returns the names of the symbols.
      Returns:
      the names of the symbols.
    • getIconWidth

      public int getIconWidth()
      Description copied from interface: ILcdIcon
      Returns the fixed width of the icon.
      Specified by:
      getIconWidth in interface ILcdIcon
      Returns:
      the fixed width of the icon.
    • getIconHeight

      public int getIconHeight()
      Description copied from interface: ILcdIcon
      Returns the fixed height of the icon.
      Specified by:
      getIconHeight in interface ILcdIcon
      Returns:
      the fixed height of the icon.
    • getShape

      public int getShape()
      Returns the symbol shape.
      Returns:
      the symbol shape.
      See Also:
    • setShape

      public void setShape(int aShape)
      Sets the symbol shape.
      Parameters:
      aShape - the shape this symbol should display.
      See Also:
    • getMemberIndex

      public int getMemberIndex()
      Returns the symbol shape.
      Returns:
      get the symbol shape.
      See Also:
    • setSize

      public void setSize(int aSize)
      Sets the size of the symbol.
      Parameters:
      aSize - the size to set to the symbol.
      See Also:
    • getSize

      public int getSize()
      Returns the size of the symbol.
      Returns:
      the size of the symbol.
      See Also:
    • setBorderColor

      public void setBorderColor(Color newColor)
      Sets the border color for this symbol.
      Parameters:
      newColor - the color to use for the border/outline.
      See Also:
    • getBorderColor

      public Color getBorderColor()
      Returns the color used for the outline/border of this symbol.
      Returns:
      the color used for the outline/border of this symbol.
      See Also:
    • getBorderWidth

      public float getBorderWidth()
      Returns the width of the outline (if any).
      The border width can only be specified when constructing a new symbol.
      Returns:
      the width of the outline
      Since:
      2019.1
    • setFillColor

      public void setFillColor(Color newColor)
      Sets the fill color for this symbol.
      Parameters:
      newColor - the color to use for the inner area of this symbol.
      See Also:
    • getFillColor

      public Color getFillColor()
      Returns the color used for the inner area of this symbol.
      Returns:
      the color used for the inner area of this symbol.
      See Also:
    • paint

      public static void paint(int aType, int aSize, Graphics g, Color aBorderColor, Color aFillColor, int aX, int aY)
      Deprecated.
      use the non-static paint method
    • paintIcon

      public void paintIcon(Component aComponent, Graphics aGraphics, int aX, int aY)
      Description copied from interface: ILcdIcon
      Draw the ILcdIcon at the specified location. ILcdIcon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
      Specified by:
      paintIcon in interface ILcdIcon
      Parameters:
      aComponent - a Component to retrieve properties from.
      aGraphics - the Graphics on which the icon will be painted.
      aX - the x position where the icon will be painted. x is the first coordinate of the top left corner point of the icon.
      aY - the y position where the icon will be painted. y is the second coordinate of the top left corner point of the icon.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int aType)
      Return the name of this type of symbol.
      Parameters:
      aType - the type of symbol.
      Returns:
      the name for this type of symbol.
    • clone

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class Object
      See Also:
    • equals

      public boolean equals(Object aObject)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setIconWidth

      public void setIconWidth(int aWidth)
      Description copied from interface: ILcdResizeableIcon
      Set the width of the icon.
      Specified by:
      setIconWidth in interface ILcdResizeableIcon
      Parameters:
      aWidth - the new width.
    • setIconHeight

      public void setIconHeight(int aHeight)
      Description copied from interface: ILcdResizeableIcon
      Set the height of the icon.
      Specified by:
      setIconHeight in interface ILcdResizeableIcon
      Parameters:
      aHeight - the new height.