Package com.anylogic.engine.presentation
- Field Summary
- 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.Segment2D
- Methods inherited from interface com.anylogic.engine.Segment3D
- Constructor Details
- Method Details
- setColor
- setColor
- getColor
- getTexture
- setDx
- getDx
- setDy
- getDy
- setDz
- getDz
- setEndX
- getEndX
- setEndY
- getEndY
- setEndZ
- getEndZ
- getZOffset
- setZHeight
- getZHeight
- randomPointInside
- length
- getLength
- setLineWidth
- getLineWidth
- setLineStyle
- getLineStyle
- setBeginArrowStyle
- setBeginArrowOffset
- setBeginArrowLength
- setBeginArrowWidth
- setEndArrowStyle
- setEndArrowOffset
- setEndArrowLength
- setEndArrowWidth
- getBeginArrowStyle
- getBeginArrowOffset
- getBeginArrowLength
- getBeginArrowWidth
- getEndArrowStyle
- getEndArrowOffset
- getEndArrowLength
- getEndArrowWidth
- contains
- clone
- postSVGShapeSpecificAttributes
- getPresentable
- setContextReference_xjal
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.Shape3D
- com.anylogic.engine.presentation.ShapeLine
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Segment2D
,Segment3D
,Serializable
,Cloneable
- Direct Known Subclasses:
ShapeArrowLine
public class ShapeLine extends Shape3D implements Segment3D
A basic line. For line with arrows see
ShapeArrowLine
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
ShapeLine() |
Constructs a line with default attributes.
|
ShapeLine |
Constructs a 2D-only line with specific attributes.
|
ShapeLine |
Constructs a line with specific attributes.
|
ShapeLine |
Deprecated.
this constructor is deprecated since version 8.4 and will be removed in the future.
|
Modifier and Type | Method | Description |
---|---|---|
ShapeLine | clone() |
Creates and returns a copy of this shape (i.e.
|
boolean | contains |
Always returns
false as line has no area and does not contain any point. |
float | getBeginArrowLength() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
float | getBeginArrowOffset() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
LineArrowStyle | getBeginArrowStyle() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
float | getBeginArrowWidth() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
Color | getColor() |
Returns the color of the line, or
null if line has no color or
has texture (in this case getTexture() should be used instead) |
double | getDx() |
Returns the difference of x coordinates of the line end and start points.
|
double | getDy() |
Returns the difference of y coordinates of the line end and start points.
|
double | getDz() |
Returns the difference of z coordinates of the line end and start points.
|
float | getEndArrowLength() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
float | getEndArrowOffset() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
LineArrowStyle | getEndArrowStyle() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
float | getEndArrowWidth() |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
double | getEndX() |
Returns the x coordinate of the line end point.
|
double | getEndY() |
Returns the y coordinate of the line end point.
|
double | getEndZ() |
Returns the z coordinate of the line end point.
|
double | getLength() |
This function is obsolete.
|
LineStyle | getLineStyle() |
Returns the style of the line: LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED
|
double | getLineWidth() |
Returns the width of the line.
|
Presentable | getPresentable() |
Returns the Presentable object (
Agent or Experiment ) where
this shape belongs to, or null. |
Texture | getTexture() |
Returns the texture of the line, if the line has it
|
double | getZHeight() |
Returns the height of the shape along Z-axis
|
double | getZOffset() |
Returns the offset from z coordinate of the location base.
This e.g. |
double | length() |
Returns the length of the line.
|
void | postSVGShapeSpecificAttributes |
Posts general properties specific to a particular shape class.
|
Point | randomPointInside |
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 | setBeginArrowLength |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setBeginArrowOffset |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setBeginArrowStyle |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setBeginArrowWidth |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setColor |
Sets the color of the line.
|
void | setColor |
Sets the color (or
Texture ) of the line. |
void | setContextReference_xjal |
Deprecated.
|
void | setDx |
Sets the difference of x coordinates of the line end and start points.
|
void | setDy |
Sets the difference of y coordinates of the line end and start points.
|
void | setDz |
Sets the difference of z coordinates of the line end and start points.
|
void | setEndArrowLength |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setEndArrowOffset |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setEndArrowStyle |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setEndArrowWidth |
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
|
void | setEndX |
Sets the x coordinate of the line end point.
|
void | setEndY |
Sets the y coordinate of the line end point.
|
void | setEndZ |
Sets the z coordinate of the line end point.
|
void | setLineStyle |
Sets the style of the line: LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED
|
void | setLineWidth |
Sets the width of the line
|
void | setZHeight |
Sets the height of the shape along Z-axis
|
canHandleClick, getDrawMode, getScaleZ, getZ, 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, restoreOwner, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public ShapeLine()
Constructs a line with default attributes.
public ShapeLine(boolean ispublic, double x, double y, Paint color, double dx, double dy, double width, LineStyle style)
Constructs a 2D-only line with specific attributes.
- Parameters:
ispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the line start pointy
- the y coordinate of the line start pointcolor
- color (orTexture
) of the linedx
- the difference of x coordinates of the line end and start pointsdy
- the difference of y coordinates of the line end and start pointswidth
- the line widthstyle
- the line stroke style (solid, dotted, dashed)
public ShapeLine(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, Paint color, double dx, double dy, double dz, double width, double zHeight, LineStyle style)
Constructs a line with specific attributes.
- Parameters:
drawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the line start pointy
- the y coordinate of the line start pointz
- the z coordinate of the line start pointcolor
- color (orTexture
) of the linedx
- the difference of x coordinates of the line end and start pointsdy
- the difference of y coordinates of the line end and start pointsdz
- the difference of z coordinates of the line end and start pointswidth
- the line widthzHeight
- the height of a line along Z-axisstyle
- the line stroke style (only solid is supported)
@Deprecated public ShapeLine(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, Paint color, double dx, double dy, double dz, double width, double zHeight, LineStyle style, LineArrowStyle beginArrowStyle, double beginArrowOffset, double beginArrowLength, double beginArrowWidth, LineArrowStyle endArrowStyle, double endArrowOffset, double endArrowLength, double endArrowWidth)
Deprecated.
this constructor is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.
Constructs a line with specific attributes and possible arrows a the end(s).- Parameters:
drawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the line start pointy
- the y coordinate of the line start pointz
- the z coordinate of the line start pointcolor
- color (orTexture
) of the linedx
- the difference of x coordinates of the line end and start pointsdy
- the difference of y coordinates of the line end and start pointsdz
- the difference of z coordinates of the line end and start pointswidth
- the line widthzHeight
- the height of a line along Z-axisstyle
- the line stroke style (only solid is supported)beginArrowStyle
- the style of the start arrow, default value isARROW_NONE
beginArrowOffset
- the offset of the start arrow (0..1, where 0=start of line), default value is0
beginArrowLength
- the length factor of the start arrow, it is multiplied by line width to obtain arrow figure length, default value is4
beginArrowWidth
- the width factor of the start arrow, it is multiplied by line width to obtain arrow figure width, default value is3
endArrowStyle
- the style of the start arrow, default value isARROW_NONE
endArrowOffset
- the offset of the start arrow (0..1, where 0=start of line), default value is0
endArrowLength
- the length factor of the start arrow, it is multiplied by line width to obtain arrow figure length, default value is4
endArrowWidth
- the width factor of the start arrow, it is multiplied by line width to obtain arrow figure width, default value is3
public void setColor(Color color)
Sets the color of the line.
- Parameters:
color
- the new color, null = do not draw the line
public void setColor(Paint color)
Sets the color (or
Texture
) of the line.- Parameters:
color
- the new color, null = do not draw the line
public Color getColor()
Returns the color of the line, or
null
if line has no color or
has texture (in this case getTexture()
should be used instead)- Returns:
- the color of the line
public Texture getTexture()
Returns the texture of the line, if the line has it
- Returns:
- the texture of the line
public void setDx(double dx)
Sets the difference of x coordinates of the line end and start points.
- Parameters:
dx
- the new difference of x coordinates of the line end and start points
public double getDx()
Returns the difference of x coordinates of the line end and start points.
public void setDy(double dy)
Sets the difference of y coordinates of the line end and start points.
- Parameters:
dy
- the new difference of y coordinates of the line end and start points
public double getDy()
Returns the difference of y coordinates of the line end and start points.
public void setDz(double dz)
Sets the difference of z coordinates of the line end and start points.
- Parameters:
dz
- the new difference of z coordinates of the line end and start points
public double getDz()
Returns the difference of z coordinates of the line end and start points.
public void setEndX(double endx)
Sets the x coordinate of the line end point.
- Parameters:
endx
- the new value of x coordinate of line end
public double getEndX()
Returns the x coordinate of the line end point.
public void setEndY(double endy)
Sets the y coordinate of the line end point.
- Parameters:
endy
- the new value of y coordinate of line end
public double getEndY()
Returns the y coordinate of the line end point.
public void setEndZ(double endz)
Sets the z coordinate of the line end point.
- Parameters:
endz
- the new value of z coordinate of line end
public double getEndZ()
Returns the z coordinate of the line end point.
public double getZOffset()
Description copied from interface:
Locatable3D
Returns the offset from z coordinate of the location base.
This e.g. returns
This e.g. returns
getZHeight()
for
some 3D shapes- Specified by:
getZOffset
in interfaceLocatable3D
- Overrides:
getZOffset
in classShape3D
- Returns:
- the offset from z coordinate of the location
public void setZHeight(double zHeight)
Sets the height of the shape along Z-axis
- Parameters:
zHeight
- the new value of z-height
public double getZHeight()
Returns the height of the shape along Z-axis
- Returns:
- the height of the shape along Z-axis
public Point randomPointInside(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 double length()
Returns the length of the line.
- Returns:
- the length of the line
- Since:
- 7.1
@AnyLogicLegacyAPI public double getLength()
This function is obsolete. Please use
length()
insteadpublic void setLineWidth(double width)
Sets the width of the line
- Parameters:
width
- the new width of the line
public double getLineWidth()
Returns the width of the line.
- Returns:
- the width of the line
public void setLineStyle(LineStyle lineStyle)
Sets the style of the line: LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED
- Parameters:
lineStyle
- the new style of the line
public LineStyle getLineStyle()
Returns the style of the line: LINE_STYLE_SOLID, LINE_STYLE_DOTTED or LINE_STYLE_DASHED
- Returns:
- the style of the line
@Deprecated public void setBeginArrowStyle(LineArrowStyle beginArrowStyle)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setBeginArrowOffset(double beginArrowOffset)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setBeginArrowLength(double beginArrowLength)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setBeginArrowWidth(double beginArrowWidth)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setEndArrowStyle(LineArrowStyle endArrowStyle)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setEndArrowOffset(double endArrowOffset)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setEndArrowLength(double endArrowLength)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public void setEndArrowWidth(double endArrowWidth)
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public LineArrowStyle getBeginArrowStyle()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getBeginArrowOffset()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getBeginArrowLength()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getBeginArrowWidth()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public LineArrowStyle getEndArrowStyle()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getEndArrowOffset()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getEndArrowLength()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.@Deprecated public float getEndArrowWidth()
Deprecated.
this method is deprecated since version 8.4 and will be removed in the future.
Use
ShapeArrowLine
instead.public boolean contains(double px, double py)
Always returns
false
as line has no area and does not contain any point.public ShapeLine 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(List<String> att, List<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 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
@AnyLogicInternalAPI @Deprecated public void setContextReference_xjal(Presentable contextReference)
Deprecated.