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
ConstructorsConstructorDescriptionTLcdSVGIcon(String aSource) Constructs a newTLcdSVGIconobject to display the given SVG file.TLcdSVGIcon(String aSource, int aWidth, int aHeight) Constructs a newTLcdSVGIconobject to display an SVG (Scalable Vector Graphics) icon.TLcdSVGIcon(Document aDocument) Constructs a newTLcdSVGIconobject to display the given SVG document. -
Method Summary
Modifier and TypeMethodDescriptionclone()MakesObject.clone()public.booleangetColor()Returns the color that will be used to paint the SVG icon.intReturns the fixed height of the icon.intReturns the fixed width of the icon.Returns the XML content of this icon.doubleGet the world-height of the icon,doubleGet the ratio of the icon's world-width to the icon's width in pixels.doubleGet the world-width of the icon,inthashCode()booleanDetermines whether this icon is assumed to be world-sized.voidDraw theILcdIconat the specified location.voidSpecifies a color to be used to paint the SVG icon.voidsetIconHeight(int aHeight) Specifies the height of the SVG icon to be displayed.voidsetIconWidth(int aWidth) Specifies the width of the SVG icon to be displayed.voidsetSize(int aWidth, int aHeight) Specifies the width and height of the SVG icon to be displayed.toString()
-
Constructor Details
-
TLcdSVGIcon
Constructs a newTLcdSVGIconobject 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 newTLcdSVGIconobject 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 newTLcdSVGIconobject 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:ILcdIconDraw theILcdIconat the specified location.ILcdIconimplementations may use theComponentargument to get properties useful for painting, e.g. the foreground or background color.- Specified by:
paintIconin 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:ILcdIconReturns the fixed width of the icon.- Specified by:
getIconWidthin interfaceILcdIcon- Returns:
- the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Description copied from interface:ILcdIconReturns the fixed height of the icon.- Specified by:
getIconHeightin interfaceILcdIcon- Returns:
- the fixed height of the icon.
-
toString
-
equals
-
hashCode
public int hashCode() -
clone
Description copied from interface:ILcdCloneableMakes
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:
clonein interfaceILcdCloneable- Overrides:
clonein 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:
setIconWidthin 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:
setIconHeightin 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, ornullto 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.
-