Package com.luciad.gui
Class TLcdSVGIcon
java.lang.Object
com.luciad.gui.TLcdSVGIcon
- All Implemented Interfaces:
ILcdIcon
,ILcdResizeableIcon
,ILcdCloneable
,Serializable
,Cloneable
Icon implementation based on a Scalable Vector Graphics (SVG) file or XML document.
The size and the color of the icon can be overridden.
- Since:
- 2015.0
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdSVGIcon
(String aSource) Constructs a newTLcdSVGIcon
object to display the given SVG file.TLcdSVGIcon
(String aSource, int aWidth, int aHeight) Constructs a newTLcdSVGIcon
object to display an SVG (Scalable Vector Graphics) icon.TLcdSVGIcon
(Document aDocument) Constructs a newTLcdSVGIcon
object to display the given SVG document. -
Method Summary
Modifier and TypeMethodDescriptionclone()
MakesObject.clone()
public.boolean
getColor()
Returns the color that will be used to paint the SVG icon.int
Returns the fixed height of the icon.int
Returns the fixed width of the icon.Returns the XML content of this icon.double
Get the world-height of the icon,double
Get the ratio of the icon's world-width to the icon's width in pixels.double
Get the world-width of the icon,int
hashCode()
boolean
Determines whether this icon is assumed to be world-sized.void
Draw theILcdIcon
at the specified location.void
Specifies a color to be used to paint the SVG icon.void
setIconHeight
(int aHeight) Specifies the height of the SVG icon to be displayed.void
setIconWidth
(int aWidth) Specifies the width of the SVG icon to be displayed.void
setSize
(int aWidth, int aHeight) Specifies the width and height of the SVG icon to be displayed.toString()
-
Constructor Details
-
TLcdSVGIcon
Constructs a newTLcdSVGIcon
object to display the given SVG file. The size of the icon will be the bounds of the SVG content in SVG user space (typically pixels). This includes primitive paint, filtering, clipping and masking.- Parameters:
aSource
- the source of the icon to be displayed
-
TLcdSVGIcon
Constructs a newTLcdSVGIcon
object to display the given SVG document. The size of the icon will be the bounds of the SVG content in SVG user space (typically pixels). This includes primitive paint, filtering, clipping and masking.- Parameters:
aDocument
- the XML document containing the SVG content
-
TLcdSVGIcon
Constructs a newTLcdSVGIcon
object to display an SVG (Scalable Vector Graphics) icon. The displayed icon is retrieved from the given source and its size will be as specified in aWidth and aHeight.- Parameters:
aSource
- the source of the icon to be displayedaWidth
- the width of the icon to be displayedaHeight
- the height of the icon to be displayed
-
-
Method Details
-
getSVGDocument
Returns the XML content of this icon.- Returns:
- the XML content
-
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.
-
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.
-
toString
-
equals
-
hashCode
public int hashCode() -
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:
-
setIconWidth
public void setIconWidth(int aWidth) Specifies the width of the SVG icon to be displayed. Overwrites the width specified in the source file, if any.- Specified by:
setIconWidth
in interfaceILcdResizeableIcon
- Parameters:
aWidth
- the width of the icon to be displayed- See Also:
-
setIconHeight
public void setIconHeight(int aHeight) Specifies the height of the SVG icon to be displayed. Overwrites the height specified in the source file, if any.- Specified by:
setIconHeight
in interfaceILcdResizeableIcon
- Parameters:
aHeight
- the height of the icon to be displayed- See Also:
-
setSize
public void setSize(int aWidth, int aHeight) Specifies the width and height of the SVG icon to be displayed. Using this method is more efficient than using both the methodssetIconWidth(int)
andsetIconHeight(int)
one after another.- Parameters:
aWidth
- the width of the icon to be displayedaHeight
- the height of the icon to be displayed
-
getColor
Returns the color that will be used to paint the SVG icon. This color will be used to draw the outline and the fill.
By default, the colors from the SVG icon are used, in which case this method returnsnull
.- Returns:
- the color used to paint the icon to be displayed
- See Also:
-
setColor
Specifies a color to be used to paint the SVG icon. This color will be used as line and fill color.- Parameters:
aColor
- the color used to paint the icon to be displayed, ornull
to use the colors as specified by the SVG file itself- See Also:
-
isWorldSized
public boolean isWorldSized()Determines whether this icon is assumed to be world-sized.- Returns:
- whether the icon is world-sized.
-
getWorldWidth
public double getWorldWidth()Get the world-width of the icon,- Returns:
- The world-width of the icon in meters. The value is -1.0 when the world-size is undefined.
-
getWorldHeight
public double getWorldHeight()Get the world-height of the icon,- Returns:
- The world-height of the icon in meters. The value is -1.0 when the world-size is undefined.
-
getWorldScalingFactor
public double getWorldScalingFactor()Get the ratio of the icon's world-width to the icon's width in pixels. This is equivalent to the scaling factor that you need to use withTLcdGXYIconPainter.setScale(double)
. When this is set correctly, the painter can correctly determine how it needs to scale the icon to correctly render it in world-size.- Returns:
- the scaling factor to convert the icon's width from pixels to world-size.
-