public class Path extends NetworkMarkupElement implements IPath<Node>, java.lang.Iterable<MarkupSegment>, com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
IPath
for network in continuous space.Constructor and Description |
---|
Path() |
Path(Agent owner,
ShapeDrawMode drawMode,
boolean isPublic,
boolean bidirectional,
boolean isLimitSpeed,
double maxSpeedInMPS,
boolean limitNumberOfTransporters,
int maxNumberOfTransporters,
PathDrawingType drawingType,
java.awt.Paint color,
double lineWidth,
MarkupSegment... segments) |
Path(Agent owner,
ShapeDrawMode drawMode,
boolean isPublic,
boolean bidirectional,
boolean isLimitSpeed,
double maxSpeedInMPS,
boolean limitNumberOfTransporters,
int maxNumberOfTransporters,
PathDrawingType drawingType,
java.awt.Paint color,
double lineWidth,
Node source,
Node target,
MarkupSegment... segments) |
Modifier and Type | Method and Description |
---|---|
void |
addSegment(MarkupSegment segment)
Adds segment to this markup element
|
void |
arcTo(double x,
double y,
double z,
double startAngle,
double endAngle,
double ratioStartToEnd)
Adds arc segment with two circular arcs (available for markup elements created with no-argument constructor)
|
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)
|
boolean |
contains(double px,
double py,
double distance)
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), using
the given tolerance
|
boolean |
containsSq(double px,
double py,
double squareDistance)
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), using
the given tolerance
|
PathDrawingType |
getDrawingType()
Returns the drawing type of this path
|
Point |
getEndPoint()
Returns the location of the end point
|
Point |
getEndPoint(Point out)
Returns the location of the end point
|
Position |
getEndPosition()
Returns the end position
|
Position |
getEndPosition(Position out)
Returns the end position
|
java.awt.Color |
getLineColor()
Returns the color of the path, or
null if path has no color or
has texture (in this case getLineTexture() should be used instead) |
Texture |
getLineTexture()
Returns the texture of the path, if the path has it
|
double |
getLineWidth()
Returns the width of the path.
|
double |
getLineWidth(LengthUnits units)
Returns line width
|
com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent> |
getMaterialLibraryDescriptor() |
int |
getMaxNumberOfTransporters() |
double |
getMaxSpeed(SpeedUnits units) |
double |
getNearestPoint(double x,
double y,
double z,
Point out)
Calculates (using the
output object) the point in this space markup element
nearest to the given (x, y, z) point. |
double |
getNearestPoint(double x,
double y,
Point out)
Calculates (using the
output object) the point in this space markup element
nearest to the given (x, y) point. |
double |
getNearestPointOnRay(double x1,
double y1,
double x2,
double y2,
LengthUnits units,
Point out) |
double |
getNearestPointOnRay(double x1,
double y1,
double x2,
double y2,
Point out)
Calculates the intersection point between this element and the given ray.
|
int |
getNumberOfTransporters() |
Node |
getOtherNode(Node n)
If the given node is source of this path, returns path's target,
otherwise returns source.
|
Point |
getPointAtOffset(double offset,
LengthUnits units,
Point out)
Returns the point located on the markup element with the given
offset
distance calculated from start point. |
Point |
getPointAtOffset(double offset,
Point out)
Returns the point located on the markup element with the given
offset
distance calculated from start point. |
Position |
getPosition(double value,
double maxValue,
Position out)
Returns position with offset corresponding to the given
value ,
assuming that 0 is start and maxValue is end |
Position |
getPosition(int index,
int totalNumber,
Position out)
Returns the item position with the given index.
|
Position |
getPositionAtOffset(double offset,
LengthUnits units,
Position out)
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
Position |
getPositionAtOffset(double offset,
Position out)
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
MarkupSegment |
getSegment(int index)
Returns the segment by its index
|
int |
getSegmentCount()
Returns the number of segments
|
Node |
getSource()
Returns source node of this path.
|
Point |
getStartPoint()
Returns the location of the start point
|
Point |
getStartPoint(Point out)
Returns the location of the start point
|
Position |
getStartPosition()
Returns the start position
|
Position |
getStartPosition(Position out)
Returns the start position
|
Node |
getTarget()
Returns target node of this path.
|
Agent |
getTransporter(int index) |
java.util.List<Agent> |
getTransporters() |
boolean |
isBidirectional()
Returns the 'bidirectional' property (
true by default). |
boolean |
isLimitNumberOfTransporters() |
boolean |
isLimitSpeed() |
java.util.Iterator<MarkupSegment> |
iterator()
Creates and returns read-only iterator over segments
|
double |
length()
Returns the length of the markup element, calculated in 3D space.
|
double |
length(LengthUnits units)
Returns the length of the markup element, calculated in 3D space.
|
void |
lineTo(double x,
double y,
double z)
Adds line segment (available for markup elements created with no-argument constructor)
|
Point |
randomPointInside(java.util.Random rng,
Point out)
Returns the randomly chosen point inside/along the given space markup element.
|
Position |
randomPositionInside(java.util.Random rng,
Position out)
Returns the randomly chosen position along the path.
|
void |
setBidirectional(boolean bidirectional)
Sets the 'bidirectional' property (
true by default). |
void |
setDrawingType(PathDrawingType drawingType)
Sets the drawing type of this path
|
void |
setLimitNumberOfTransporters(boolean limitNumberOfTransporters) |
void |
setLimitSpeed(boolean limitSpeed) |
void |
setLineColor(java.awt.Color color)
Sets the color of the path.
|
void |
setLineColor(java.awt.Paint color)
Sets the color (or
Texture ) of the path. |
void |
setLineWidth(double widthInPixels)
Sets the width of the path, 0 means thinnest possible
|
void |
setLineWidth(double lineWidth,
LengthUnits units)
Sets line width
|
void |
setMaxNumberOfTransporters(int maxNumberOfTransporters) |
void |
setMaxSpeed(double maxSpeed,
SpeedUnits units) |
void |
setSource(Node node)
Sets source node of this path.
|
void |
setTarget(Node node)
Sets source node of this path.
|
void |
startDrawing(double x,
double y,
double z)
Starts drawing (available for markup elements created with no-argument constructor)
|
Path3D |
toPath3D()
Converts this markup element to
Path3D interface |
getDrawMode, getNearestPoint, getNearestPoint, getNearestPoint, getNetwork
error, getPresentable, getSpace, initialize, isClickHandled, onClick, setDrawMode, setOwner
executeUserAction, findSVGElement, getName, getSVGId, isVisible, resetSVGState, setVisible, updateDynamicProperties, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNearestPoint, getNetwork, getSpace, randomPointInside, randomPointInside, randomPointInside
getSpace
public Path()
public Path(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean bidirectional, boolean isLimitSpeed, double maxSpeedInMPS, boolean limitNumberOfTransporters, int maxNumberOfTransporters, PathDrawingType drawingType, java.awt.Paint color, double lineWidth, MarkupSegment... segments)
owner
- drawMode
- isPublic
- bidirectional
- isLimitSpeed
- maxSpeedInMPS
- limitNumberOfTransporters
- maxNumberOfTransportersInMPS
- drawingType
- color
- lineWidth
- line width,drawingType
(PathDrawingType.PATH_LINE
, PathDrawingType.PATH_DASHEDLINE
) - measured in pixels,segments
- public Path(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean bidirectional, boolean isLimitSpeed, double maxSpeedInMPS, boolean limitNumberOfTransporters, int maxNumberOfTransporters, PathDrawingType drawingType, java.awt.Paint color, double lineWidth, Node source, Node target, MarkupSegment... segments)
owner
- drawMode
- isPublic
- bidirectional
- isLimitSpeed
- maxSpeedInMPS
- limitNumberOfTransporters
- maxNumberOfTransportersInMPS
- drawingType
- color
- lineWidth
- line width,drawingType
(PathDrawingType.PATH_LINE
, PathDrawingType.PATH_DASHEDLINE
) - measured in pixels,source
- target
- segments
- @AnyLogicInternalAPI public com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent> getMaterialLibraryDescriptor()
public boolean isLimitSpeed()
public void setLimitSpeed(boolean limitSpeed)
public double getMaxSpeed(SpeedUnits units)
public void setMaxSpeed(double maxSpeed, SpeedUnits units)
public boolean isLimitNumberOfTransporters()
public void setLimitNumberOfTransporters(boolean limitNumberOfTransporters)
public int getMaxNumberOfTransporters()
public void setMaxNumberOfTransporters(int maxNumberOfTransporters)
public int getNumberOfTransporters()
getNumberOfTransporters
in interface com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public Agent getTransporter(int index)
getTransporter
in interface com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public java.util.List<Agent> getTransporters()
getTransporters
in interface com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public void setBidirectional(boolean bidirectional)
IPath
true
by default).setBidirectional
in interface IPath<Node>
bidirectional
- true
for paths which allow movements
in both directions, false
for paths which allow movements
from source to target onlyIPath.isBidirectional()
public boolean isBidirectional()
IPath
true
by default).isBidirectional
in interface IPath<Node>
true
for paths which allow movements
in both directions, false
for paths which allow movements
from source to target onlypublic void setSource(Node node)
IPath
initialize()
method.public Node getSource()
IPath
public void setTarget(Node node)
IPath
initialize()
method.public Node getTarget()
IPath
public Node getOtherNode(Node n)
getOtherNode
in interface IPath<Node>
n
- the node (one of the path endings)public PathDrawingType getDrawingType()
public void setDrawingType(PathDrawingType drawingType)
drawingType
- the drawing type of this pathpublic void setLineColor(java.awt.Color color)
color
- the new color, null = do not draw the pathpublic void setLineColor(java.awt.Paint color)
Texture
) of the path.setLineColor
in interface IPath<Node>
color
- the new color, null = do not draw the pathpublic java.awt.Color getLineColor()
null
if path has no color or
has texture (in this case getLineTexture()
should be used instead)getLineColor
in interface IPath<Node>
public Texture getLineTexture()
getLineTexture
in interface IPath<Node>
public void setLineWidth(double widthInPixels)
setLineWidth
in interface IPath<Node>
width
- the new width of the path, measured in meterspublic void setLineWidth(double lineWidth, LengthUnits units)
laneWidth
- line width, measured in the given unitsunits
- length unitspublic double getLineWidth()
getLineWidth
in interface IPath<Node>
public double getLineWidth(LengthUnits units)
units
- length unitspublic boolean contains(double px, double py)
MarkupShape
contains
in interface INetworkMarkupElement
contains
in class MarkupShape
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's containertrue
if the shape contains the point with the given
coordinatespublic boolean contains(double px, double py, double distance)
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's containerdistance
- the distance tolerance to determine
whether the given point lies on the markup element line or nottrue
if the shape contains the point with the given
coordinatespublic boolean containsSq(double px, double py, double squareDistance)
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's containersquareDistance
- the square of distance tolerance to determine
whether the given point lies on the markup element line or nottrue
if the shape contains the point with the given
coordinatespublic void startDrawing(double x, double y, double z)
x
- the x coordinate of the first pointy
- the y coordinate of the first pointz
- the z coordinate of the first pointpublic void lineTo(double x, double y, double z)
x
- the x coordinate of the segment end pointy
- the y coordinate of the segment end pointz
- the z coordinate of the segment end pointpublic void arcTo(double x, double y, double z, double startAngle, double endAngle, double ratioStartToEnd)
x
- the x coordinate of the segment end pointy
- the y coordinate of the segment end pointz
- the z coordinate of the segment end pointstartAngle
- orientation of segment line startendAngle
- orientation of segment line endratioStartToEnd
- ratio between two circular arcspublic void addSegment(MarkupSegment segment)
segment
- the segment, should be initialized if was created using no-argument constructorpublic int getSegmentCount()
IPath
getSegmentCount
in interface IPath<Node>
public MarkupSegment getSegment(int index)
IPath
getSegment
in interface IPath<Node>
index
- the segment index, [0 .. IPath.getSegmentCount()
- 1]public java.util.Iterator<MarkupSegment> iterator()
iterator
in interface IPath<Node>
iterator
in interface java.lang.Iterable<MarkupSegment>
public Point getStartPoint(Point out)
IPath
getStartPoint
in interface IPath<Node>
out
- output object to write to, may be null
public Point getStartPoint()
IPath
getStartPoint
in interface IPath<Node>
public Point getEndPoint(Point out)
IPath
getEndPoint
in interface IPath<Node>
out
- output object to write to, may be null
public Point getEndPoint()
IPath
getEndPoint
in interface IPath<Node>
public Position getStartPosition(Position out)
IPath
getStartPosition
in interface IPath<Node>
public Position getStartPosition()
public Position getEndPosition(Position out)
IPath
getEndPosition
in interface IPath<Node>
public Position getEndPosition()
public final double length()
length
in interface AnimationMovingLocationProvider
public final double length(LengthUnits units)
length
in interface AnimationMovingLocationProvider
units
- the units of lengthpublic final Point getPointAtOffset(double offset, Point out)
offset
distance calculated from start point.offset
- offset, non-negative value, should be less or equal to the full length.out
- output object to write to, may be null
getPositionAtOffset(double, Position)
public final Point getPointAtOffset(double offset, LengthUnits units, Point out)
offset
distance calculated from start point.offset
- offset, non-negative value, should be less or equal to the full length.units
- the length unitsout
- output object to write to, may be null
getPositionAtOffset(double, Position)
public final Position getPositionAtOffset(double offset, Position out)
IPath
offset
distance calculated from start point.getPositionAtOffset
in interface IPath<Node>
offset
- offset, non-negative value, should be less or equal to the full length.out
- output object to write to, may be null
public final Position getPositionAtOffset(double offset, LengthUnits units, Position out)
IPath
offset
distance calculated from start point.getPositionAtOffset
in interface IPath<Node>
offset
- offset, non-negative value, should be less or equal to the full length.units
- the length unitsout
- output object to write to, may be null
public double getNearestPoint(double x, double y, Point out)
output
object) the point in this space markup element
nearest to the given (x, y) point. Returns the square of distance to the point
(in the XY-projection).
All the calculations are performed in the horizontal projection (z-coordinates aren't used,
as if all of the z coordinates were zero).getNearestPoint
in class NetworkMarkupElement
x
- x coordinate of the pointy
- y coordinate of the pointoutput
- the output point to write result to. Note that output.z
is left unchanged.public double getNearestPoint(double x, double y, double z, Point out)
output
object) the point in this space markup element
nearest to the given (x, y, z) point. Returns the square of distance to the point.getNearestPoint
in class NetworkMarkupElement
x
- x coordinate of the pointy
- y coordinate of the pointz
- z coordinate of the pointoutput
- the output point to write result to.public double getNearestPointOnRay(double x1, double y1, double x2, double y2, Point out)
x1
- the x coordinate of ray starty1
- the y coordinate of ray startx2
- the x coordinate of some ray pointy2
- the y coordinate of some ray pointout
- the output: intersection point, should be not null
-1
if there is no intersections
with the given raypublic double getNearestPointOnRay(double x1, double y1, double x2, double y2, LengthUnits units, Point out)
public final Point randomPointInside(java.util.Random rng, Point out)
INetworkMarkupElement
randomPointInside
in interface INetworkMarkupElement
rng
- the random number generator.out
- output object to write to, may be null
public final Position randomPositionInside(java.util.Random rng, Position out)
rng
- the random number generator.out
- output object to write to, may be null
public Position getPosition(int index, int totalNumber, Position out)
AnimationStaticLocationProvider
getPosition
in interface AnimationStaticLocationProvider
index
- the index of some item positions, should be not negative and less than totalNumber
totalNumber
- the total number of item positions, should be positiveout
- output object to write to, may be null
public Position getPosition(double value, double maxValue, Position out)
AnimationMovingLocationProvider
value
,
assuming that 0
is start and maxValue
is endgetPosition
in interface AnimationMovingLocationProvider
Copyright © AnyLogic North America, LLC. All Rights Reserved.