AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, Serializable, Cloneable

public class ShapeSVG
extends Shape
A custom SVG image rendered from the SVG XML provided by the user as a String object.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Fields inherited from class com.anylogic.engine.presentation.Shape

UNKNOWN_NAME

Constructor Summary

ConstructorDescription
ShapeSVG()
Creates an empty SVG image with default properties: public, located at (0,0) and not rotated.
ShapeSVG(boolean ispublic, double x, double y, double rotation, String svg)
Creates an SVG image with specific properties
ShapeSVG(String svg)
Creates an SVG image with default properties: public, located at (0,0) and not rotated.

Method Summary

Modifier and TypeMethodDescription
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
StringgetSVG()
Returns the current SVG image (XML format) or null
voidremoveSVG()
Removes SVG image (same effect as setting it to null).
voidsetSVG(String svg)
Sets the new SVG image

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Constructor Details

ShapeSVG

public ShapeSVG()
Creates an empty SVG image with default properties: public, located at (0,0) and not rotated.

ShapeSVG

public ShapeSVG(String svg)
Creates an SVG image with default properties: public, located at (0,0) and not rotated.

ShapeSVG

public ShapeSVG(boolean ispublic,
 double x,
 double y,
 double rotation,
 String svg)
Creates an SVG image with specific properties
Parameters:
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the SVG image upper left corner
y - the y coordinate of the SVG image upper left corner
rotation - the rotation of the SVG image around Z-axis from +X to +Y, in radians
svg - the SVG image (XML format)

Method Details

getSVG

public String getSVG()
Returns the current SVG image (XML format) or null
Returns:
the SVG image in XML format or null

setSVG

public void setSVG(String svg)
Sets the new SVG image
Parameters:
svg - the new SVG image in XML format or null for no image

removeSVG

public void removeSVG()
Removes SVG image (same effect as setting it to null).

contains

public boolean contains(double px,
 double py)
Description copied from class: Shape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates