AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, java.io.Serializable, java.lang.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

Constructors 
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, java.lang.String svg)
Creates an SVG image with specific properties
ShapeSVG​(java.lang.String svg)
Creates an SVG image with default properties: public, located at (0,0) and not rotated.
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
boolean contains​(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
java.lang.String getSVG()
Returns the current SVG image (XML format) or null
void removeSVG()
Removes SVG image (same effect as setting it to null).
void setSVG​(java.lang.String svg)
Sets the new SVG image
Modifier and Type Method Description

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

canHandleClick, clone, executeUserAction, findSVGElement, getDrawMode, getGroup, getLevel, getName, getPresentable, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, postSVGShapeSpecificAttributes, randomPointInside, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, restoreOwner, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties

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 Detail

ShapeSVG

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

ShapeSVG

public ShapeSVG​(java.lang.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,
                java.lang.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 Detail

getSVG

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

setSVG

public void setSVG​(java.lang.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
How can we improve this article?