|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.Shape
com.xj.anylogic.engine.presentation.ShapeImage
public class ShapeImage
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.
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
ShapeImage(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
double width,
double height,
java.lang.String[] filenames)
Deprecated. use ShapeImage(Presentable, boolean, double, double, double, double, double, String, String[]) |
|
ShapeImage(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String[] filenames)
Constructs an image shape with specific attributes. |
|
| Method Summary | |
|---|---|
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. new shape instance). |
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. in the same system with the coordinates of this shape, x and y) |
void |
draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
Draws the image in a given context. |
double |
getHeight()
Returns the height of the image. |
java.lang.String |
getImageFileName(int i)
Returns the file name of the image with the given index. |
java.util.ArrayList<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 (ActiveObject or Experiment) where this shape belongs to, or null. |
double |
getWidth()
Returns the width of the image. |
boolean |
onClickAt(double px,
double py,
boolean publicOnly)
Tests if the image contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point. |
void |
remove(int i)
Removes the image with the given index from the image shape. |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object The method is used in snapshot saving/loading |
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. |
| Methods inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, setPos, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated
public ShapeImage(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
double width,
double height,
java.lang.String[] filenames)
ShapeImage(Presentable, boolean, double, double, double, double, double, String, String[])
presentable - the presentable object owning this imageispublic - if true, 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)
presentable - the presentable object owning this imageispublic - if true, 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 active object where
this image is defined, formatted using '/' characters; with '/'
character at the beginning and at the endfilenames - the array of image file names| Method Detail |
|---|
public void setWidth(double width)
width - the width of the imagepublic double getWidth()
public void setHeight(double height)
height - the height of the imagepublic double getHeight()
public void setSize(double width,
double height)
width - the new width of the imageheight - the new height of the imagepublic void setIndex(int index)
index - the index of the image to displaypublic int getIndex()
public java.util.ArrayList<java.lang.String> getImageFileNames()
public java.lang.String getImageFileName(int i)
i - the index
public void add(java.lang.String filename)
filename - the file name of the image being addedpublic void remove(int i)
i - the index of the image
public boolean onClickAt(double px,
double py,
boolean publicOnly)
onClickAt in class Shapepx - the x coordinate of the clickpy - the y coordinate of the clickpublicOnly - if true, not public shape returns false
public boolean contains(double px,
double py)
Shape
contains in class Shapepx - the x coordinate relative to this shape's containerpy - the y coordinate relative to this shape's container
public void draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
draw in class Shapepanel - the panel where the drawing is doneg - the graphics where the drawing takes placexform - the "original" transform that must be restored before drawingpublicOnly - if true, the shape is only drawn if it is publicpublic Presentable getPresentable()
Shape
getPresentable in class Shapepublic void restoreOwner(java.lang.Object owner)
Shape
restoreOwner in interface com.xj.anylogic.engine.internal.ChildrestoreOwner in class Shapeowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGrouppublic ShapeImage clone()
Shape
clone in class Shape
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||