|
||||||||||
| 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.ShapeCAD
public class ShapeCAD
Persistent CAD drawing shape.
This object is only available in the AnyLogic Professional
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
ShapeCAD(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String filename,
int id,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
java.awt.Color[] customLayerColors,
boolean invertDefaultColors)
Deprecated. this constructor will be removed in the future releases, please use ShapeCAD(Presentable, boolean, double, double, double, double, String, String, int, Color, String[], Color[], int) |
|
ShapeCAD(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String filename,
int id,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
java.awt.Color[] customLayerColors,
int drawingAttributes)
Constructs a CAD drawing shape with specific attributes. |
|
| Method Summary | |
|---|---|
ShapeCAD |
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 shape in a given context |
java.awt.Color |
getBackgroundColor()
|
java.awt.Color |
getCustomLayerColor(java.lang.String layerName)
Returns custom color of the layer's shapes, if the one is defined. |
double |
getHeight()
Returns the height of the shape. |
java.lang.String |
getImageFileName()
Returns the file name of the CAD drawing. |
java.lang.String[] |
getLayerNames()
Returns the array of layer names in this CAD, the returned array is backed by this shape and therefore shouldn't be modified by user. |
Presentable |
getPresentable()
Returns the Presentable object (ActiveObject or Experiment) where this shape belongs to, or null. |
double |
getWidth()
Returns the width of the shape. |
boolean |
isLayerVisible(java.lang.String layerName)
Returns true if the layer with the given
name is visible, otherwise returns false. |
boolean |
onClickAt(double px,
double py,
boolean publicOnly)
Tests if the CAD drawing contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point. |
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 |
setBackgroundColor(java.awt.Color backgroundColor)
|
void |
setCustomLayerColor(java.lang.String layerName,
java.awt.Color color)
Sets custom color for all the shapes for the given layer. |
void |
setHeight(double height)
Sets the height of the shape. |
void |
setLayerVisible(java.lang.String layerName,
boolean visible)
Makes the layer with the given name visible/invisible. |
void |
setVisibleLayers(java.lang.String... layerNames)
Makes the layers with given names visible and hides all other layers in this CAD. |
void |
setWidth(double width)
Sets the width of the shape. |
| 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 |
|---|
public ShapeCAD(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String filename,
int id,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
java.awt.Color[] customLayerColors,
boolean invertDefaultColors)
ShapeCAD(Presentable, boolean, double, double, double, double, String, String, int, Color, String[], Color[], int)
public ShapeCAD(Presentable presentable,
boolean ispublic,
double x,
double y,
double width,
double height,
java.lang.String packagePrefix,
java.lang.String filename,
int id,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
java.awt.Color[] customLayerColors,
int drawingAttributes)
presentable - the presentable object owning this shapeispublic - if true, the shape is visible on container's presentationx - the x coordinate of the shape upper left cornery - the y coordinate of the shape upper left cornerwidth - the width of the shapeheight - the height of the shapepackagePrefix - the package name of original active object where
this CAD is defined, formatted using '/' characters; with '/'
character at the beginning and at the endfilename - the CAD drawing file name (.DXF)backgroundColor - the background color for CAD drawinglayerNames - the array of names of CAD layers to be drawn.customLayerColors - the array of the same length as
layerNames. Allows user to specify custom color for
all the shapes in a particular layer(s). Default layer colors are
used for layers having null item in this array.drawingAttributes - the drawing attributes, this value should be
zero or an "OR" combination of CAD_* constants,
e.g. CAD_NEGATIVE | CAD_ANTIALIASING| Method Detail |
|---|
public void setWidth(double width)
width - the width of the shapepublic double getWidth()
public void setHeight(double height)
height - the height of the shapepublic double getHeight()
public java.lang.String getImageFileName()
public java.lang.String[] getLayerNames()
public boolean isLayerVisible(java.lang.String layerName)
true if the layer with the given
name is visible, otherwise returns false.false if layer with the
given name isn't found.
layerName - the name of the layer
true if the layer with the given
name is visible.
public void setLayerVisible(java.lang.String layerName,
boolean visible)
layerName - the name of the layervisible - new visibility state of the layerpublic void setVisibleLayers(java.lang.String... layerNames)
setVisibleLayers(getLayerNames())
layerNames - visible layer namespublic java.awt.Color getCustomLayerColor(java.lang.String layerName)
null.null if layer with the
given name isn't found.
layerName - the name of the layer
public void setCustomLayerColor(java.lang.String layerName,
java.awt.Color color)
null indicates that
layer will be drawn using its default color(s).
layerName - the name of the layercolor - the value of custom layer color, or nullpublic java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color backgroundColor)
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 final ShapeCAD clone()
Shape
clone in class Shape
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||