Package com.luciad.gui
Class TLcdSymbol
java.lang.Object
com.luciad.gui.TLcdSymbol
- All Implemented Interfaces:
ILcdIcon
,ILcdResizeableIcon
,ILcdCloneable
,Serializable
,Cloneable
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
Modifier and TypeFieldDescriptionstatic 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
ConstructorDescriptionConstructs 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.TLcdSymbol
(TLcdSymbol aSymbol) Constructs a symbol, identical to the argument symbol. -
Method Summary
Modifier and TypeMethodDescriptionclone()
MakesObject.clone()
public.boolean
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
getShape()
Returns the symbol shape.int
getSize()
Returns the size of the symbol.static String[]
Returns the names of the symbols.int
hashCode()
boolean
Determines if anti-aliasing is enabled or not.static void
Deprecated.use the non-static paint methodvoid
Draw theILcdIcon
at the specified location.void
setAntiAliasing
(boolean aAntiAliasing) Enables or disables anti-aliased rendering of this symbol.void
setBorderColor
(Color newColor) 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()
toString
(int aType) Return the name of this type of symbol.
-
Field Details
-
N_ICON
public static final int N_ICONThe number of available symbols.- See Also:
-
CIRCLE
public static final int CIRCLEConstant for a circle.- See Also:
-
FILLED_CIRCLE
public static final int FILLED_CIRCLEConstant for a filled circle.- See Also:
-
RECT
public static final int RECTConstant for rectangle.- See Also:
-
FILLED_RECT
public static final int FILLED_RECTConstant for a filled rectangle.- See Also:
-
PLUS
public static final int PLUSConstant for a plus sign.- See Also:
-
PLUS_RECT
public static final int PLUS_RECTConstant for a plus sign in a rectangle.- See Also:
-
CROSS
public static final int CROSSConstant for a cross symbol.- See Also:
-
CROSS_RECT
public static final int CROSS_RECTConstant for cross symbol in a rectangle.- See Also:
-
TRIANGLE
public static final int TRIANGLEConstant for a triangle.- See Also:
-
FILLED_TRIANGLE
public static final int FILLED_TRIANGLEConstant for a filled triangle.- See Also:
-
POLYLINE
public static final int POLYLINEConstant for a polyline symbol.- See Also:
-
POLYGON
public static final int POLYGONConstant for a polygon symbol.- See Also:
-
AREA
public static final int AREAConstant for an area symbol.- See Also:
-
POINTS
public static final int POINTSConstant for points symbol.- See Also:
-
OUTLINED_AREA
public static final int OUTLINED_AREAConstant for a outlined area symbol.- See Also:
-
TEXT
public static final int TEXTConstant for a text symbol.- See Also:
-
DOUBLE_OUTLINED_RECT
public static final int DOUBLE_OUTLINED_RECTConstant 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_CIRCLEConstant 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_DIAMONDConstant 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
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
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
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
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
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 interfaceILcdIcon
- 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 interfaceILcdIcon
- 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
Sets the border color for this symbol.- Parameters:
newColor
- the color to use for the border/outline.- See Also:
-
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
Sets the fill color for this symbol.- Parameters:
newColor
- the color to use for the inner area of this symbol.- See Also:
-
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
Description copied from interface:ILcdIcon
Draw theILcdIcon
at the specified location.ILcdIcon
implementations may use theComponent
argument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIcon
in interfaceILcdIcon
- 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
-
toString
Return the name of this type of symbol.- Parameters:
aType
- the type of symbol.- Returns:
- the name for this type of symbol.
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.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 interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
equals
-
hashCode
public int hashCode() -
setIconWidth
public void setIconWidth(int aWidth) Description copied from interface:ILcdResizeableIcon
Set the width of the icon.- Specified by:
setIconWidth
in interfaceILcdResizeableIcon
- 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 interfaceILcdResizeableIcon
- Parameters:
aHeight
- the new height.
-