Package com.anylogic.engine.presentation
- Field Summary
- Fields inherited from class com.anylogic.engine.presentation.Shape3D
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.Shape3D
- Methods inherited from class com.anylogic.engine.presentation.Shape
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Methods inherited from interface com.anylogic.engine.Locatable2D
- Constructor Detail
- Method Detail
- java.lang.Object
-
- com.anylogic.engine.presentation.Shape
-
- com.anylogic.engine.presentation.Shape3D
-
- com.anylogic.engine.presentation.ShapeImage
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,java.io.Serializable
,java.lang.Cloneable
public class ShapeImage extends Shape3D implements com.anylogic.engine.internal.Child
Persistent image shape.
The set of images is fixed during the lifetime of this object, but
you can control the index of the image to display.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
UNKNOWN_NAME
ShapeImage(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
double width,
double height,
java.lang.String[] filenames) |
|
ShapeImage(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String[] filenames) |
Constructs a 2D-only image shape with specific attributes.
|
ShapeImage(Presentable presentable,
ShapeDrawMode drawMode,
boolean ispublic,
double x,
double y,
double z,
double rotation,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String[] filenames) |
Constructs an image shape with specific attributes.
|
Constructor | Description |
---|
void |
add(java.lang.String filename) |
Adds an image to the image shape.
|
ShapeImage |
clone() |
Creates and returns a copy of this shape (i.e.
|
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.
|
double |
getHeight() |
Returns the height of the image.
|
int |
getImageCount() |
Returns the number of the image files in this shape.
|
java.lang.String |
getImageFileName(int i) |
Returns the file name of the image with the given index.
|
java.util.List<java.lang.String> |
getImageFileNames() |
Returns the list of image file names of this image shape.
|
int |
getIndex() |
Returns the current index of the image being displayed.
|
Presentable |
getPresentable() |
Returns the Presentable object (
Agent or Experiment ) where
this shape belongs to, or null. |
double |
getWidth() |
Returns the width of the image.
|
void |
postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att,
java.util.List<java.lang.String> val,
boolean publicOnly) |
Posts general properties specific to a particular shape class.
|
Point |
randomPointInside(java.util.Random rng) |
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator. Throws error if this shape type doesn't support returning random point inside. |
void |
remove(int i) |
Removes the image with the given index from the image shape.
|
void |
restoreOwner(java.lang.Object owner) |
Deprecated.
|
void |
setHeight(double height) |
Sets the height of the image.
|
void |
setIndex(int index) |
Sets the index of the image to display.
|
void |
setSize(double width,
double height) |
Sets the width and height of the image.
|
void |
setWidth(double width) |
Sets the width of the image.
|
Modifier and Type | Method | Description |
---|
canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setRotation, setScale, setScale, setScaleZ, setZ
executeUserAction, findSVGElement, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeInternal, postInitialize
getX, getY
@Deprecated public ShapeImage(Presentable presentable, boolean ispublic, double x, double y, double rotation, double width, double height, java.lang.String[] filenames)
Deprecated.
Constructs a 2D-only image shape with specific attributes.
- Parameters:
presentable
- the presentable object owning this imageispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the image upper left cornery
- the y coordinate of the image upper left cornerrotation
- the rotation of the image in radianswidth
- the width of the imageheight
- the height of the imagefilenames
- the array of image file names
public ShapeImage(Presentable presentable, boolean ispublic, double x, double y, double rotation, double width, double height, java.lang.String packagePrefix, java.lang.String[] filenames)
Constructs a 2D-only image shape with specific attributes.
- Parameters:
presentable
- the presentable object owning this imageispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the image upper left cornery
- the y coordinate of the image upper left cornerrotation
- the rotation of the image in radianswidth
- the width of the imageheight
- the height of the imagepackagePrefix
- the package name of original agent where this image is defined, formatted using '/' characters; with '/' character at the beginning and at the endfilenames
- the array of image file names
public ShapeImage(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, double width, double height, java.lang.String packagePrefix, java.lang.String[] filenames)
Constructs an image shape with specific attributes.
- Parameters:
presentable
- the presentable object owning this imagedrawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the image upper left cornery
- the y coordinate of the image upper left cornerz
- the z coordinate of the imagerotation
- the rotation of the image around Z-axis from +X to +Y, in radianswidth
- the width of the imageheight
- the height of the imagepackagePrefix
- the package name of original agent where this image is defined, formatted using '/' characters; with '/' character at the beginning and at the endfilenames
- the array of image file names
public void setWidth(double width)
Sets the width of the image.
- Parameters:
width
- the width of the image
public double getWidth()
Returns the width of the image.
- Returns:
- the width of the image
public void setHeight(double height)
Sets the height of the image.
- Parameters:
height
- the height of the image
public double getHeight()
Returns the height of the image.
- Returns:
- the height of the image
public void setSize(double width, double height)
Sets the width and height of the image.
- Parameters:
width
- the new width of the imageheight
- the new height of the image
public Point randomPointInside(java.util.Random rng)
Description copied from class:
Shape
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
- Overrides:
randomPointInside
in classShape
- Parameters:
rng
- the random number generator.- Returns:
- the randomly chosen point inside the shape area.
public void setIndex(int index)
Sets the index of the image to display.
- Parameters:
index
- the index of the image to display
public int getIndex()
Returns the current index of the image being displayed.
- Returns:
- the current index of the image being displayed
public java.util.List<java.lang.String> getImageFileNames()
Returns the list of image file names of this image shape.
- Returns:
- the list of image file names of this image shape
public java.lang.String getImageFileName(int i)
Returns the file name of the image with the given index.
- Parameters:
i
- the index- Returns:
- the file name of the image with the given index
public int getImageCount()
Returns the number of the image files in this shape.
- Returns:
- the number of the image files.
- Since:
- 7.3
public void add(java.lang.String filename)
Adds an image to the image shape.
- Parameters:
filename
- the file name of the image being added
public void remove(int i)
Removes the image with the given index from the image shape.
- Parameters:
i
- the index of the image
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 classShape
- Parameters:
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's container- Returns:
true
if the shape contains the point with the given coordinates
public Presentable getPresentable()
Description copied from class:
Shape
Returns the Presentable object (
Agent
or Experiment
) where
this shape belongs to, or null.- Overrides:
getPresentable
in classShape
- Returns:
- the Presentable that owns this shape, or null
@AnyLogicInternalCodegenAPI @Deprecated public void restoreOwner(java.lang.Object owner)
Deprecated.
Description copied from class:
Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
This method restores owner of this object
The method is used in snapshot saving/loading
- Specified by:
restoreOwner
in interfacecom.anylogic.engine.internal.Child
- Overrides:
restoreOwner
in classShape
- Parameters:
owner
- owner of this object, usuallyAgent
,Experiment
orShapeGroup
public ShapeImage clone()
Description copied from class:
Shape
Creates and returns a copy of this shape (i.e. new shape instance).
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or agent
Note that cloning of GIS shape, controls and charts is not supported
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or agent
Note that cloning of GIS shape, controls and charts is not supported
public void postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att, java.util.List<java.lang.String> val, boolean publicOnly)
Description copied from class:
Shape
Posts general properties specific to a particular shape class.
Is triggered by SVG_DIRTY_SHAPE flag.
Made public for occasional posting of additional SVG properties from outside engine
(e.g. from libraries)
- Overrides:
postSVGShapeSpecificAttributes
in classShape
- Parameters:
att
- attribute namesval
- attribute valuespublicOnly
- TODO
-
How can we improve this article?
-