Package com.anylogic.engine.presentation
- Field Summary
- Fields inherited from class com.anylogic.engine.presentation.Shape
- Constructor Summary
- Method Summary
- 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
- Constructor Detail
- Method Detail
- java.lang.Object
-
- com.anylogic.engine.presentation.Shape
-
- com.anylogic.engine.presentation.ShapeCAD
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,java.io.Serializable
,java.lang.Cloneable
public class ShapeCAD extends Shape implements com.anylogic.engine.internal.Child
Persistent CAD drawing shape.
This object is only available in the AnyLogic Professional
This object is only available in the AnyLogic Professional
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
UNKNOWN_NAME
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.
|
Constructor | Description |
---|
ShapeCAD |
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.
|
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 (
Agent 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 .Returns false if layer with the
given name isn't found. |
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.
|
void |
printCAD() |
|
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 |
restoreOwner(java.lang.Object owner) |
Deprecated.
|
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.
Throws an error if layer with the given name isn't found. |
void |
setVisibleLayers(java.lang.String... layerNames) |
Makes the layers with given names visible and
hides all other layers in this CAD.
Throws an error if layer(s) with the given name isn't found. To show all the layers, please call setVisibleLayers( |
void |
setWidth(double width) |
Sets the width of the shape.
|
Modifier and Type | Method | Description |
---|
canHandleClick, executeUserAction, findSVGElement, getDrawMode, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeInternal, postInitialize
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)
Constructs a CAD drawing shape with specific attributes.
- Parameters:
presentable
- the presentable object owning this shapeispublic
- iftrue
, 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 agent 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 aslayerNames
. Allows user to specify custom color for all the shapes in a particular layer(s). Default layer colors are used for layers havingnull
item in this array.drawingAttributes
- the drawing attributes, this value should be zero or an "OR" combination ofCAD_*
constants, e.g.CAD_INVERTED | CAD_ANTIALIASING
public void setWidth(double width)
Sets the width of the shape.
- Parameters:
width
- the width of the shape
public double getWidth()
Returns the width of the shape.
- Returns:
- the width of the shape
public void setHeight(double height)
Sets the height of the shape.
- Parameters:
height
- the height of the shape
public double getHeight()
Returns the height of the shape.
- Returns:
- the height of the shape
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 java.lang.String getImageFileName()
Returns the file name of the CAD drawing.
- Returns:
- the file name of the CAD drawing
public 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.
- Returns:
- the array of layer names
public boolean isLayerVisible(java.lang.String layerName)
Returns
Returns
true
if the layer with the given
name is visible, otherwise returns false
.Returns
false
if layer with the
given name isn't found.- Parameters:
layerName
- the name of the layer- Returns:
true
if the layer with the given name is visible.
public void setLayerVisible(java.lang.String layerName, boolean visible)
Makes the layer with the given name visible/invisible.
Throws an error if layer with the given name isn't found.
Throws an error if layer with the given name isn't found.
- Parameters:
layerName
- the name of the layervisible
- new visibility state of the layer
public void setVisibleLayers(java.lang.String... layerNames)
Makes the layers with given names visible and
hides all other layers in this CAD.
Throws an error if layer(s) with the given name isn't found.
To show all the layers, please call
Throws an error if layer(s) with the given name isn't found.
To show all the layers, please call
setVisibleLayers(getLayerNames()
)
- Parameters:
layerNames
- visible layer names
public java.awt.Color getCustomLayerColor(java.lang.String layerName)
Returns custom color of the layer's shapes, if
the one is defined. Otherwise returns
Returns
null
.Returns
null
if layer with the
given name isn't found.- Parameters:
layerName
- the name of the layer- Returns:
- custom color of the layer's shapes
public void setCustomLayerColor(java.lang.String layerName, java.awt.Color color)
Sets custom color for all the shapes for the given
layer. The value of
Throws an error if layer with the given name isn't found.
null
indicates that
layer will be drawn using its default color(s).Throws an error if layer with the given name isn't found.
- Parameters:
layerName
- the name of the layercolor
- the value of custom layer color, ornull
public java.awt.Color getBackgroundColor()
public void setBackgroundColor(java.awt.Color backgroundColor)
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 final ShapeCAD 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
public void printCAD()
-
How can we improve this article?
-