Package com.anylogic.engine.markup
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.markup.NetworkMarkupElement
- Methods inherited from class com.anylogic.engine.markup.MarkupShape
- Methods inherited from class com.anylogic.engine.markup.AbstractMarkup
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Methods inherited from interface com.anylogic.engine.markup.AnimationStaticLocationProvider
- Methods inherited from interface com.anylogic.engine.markup.material_handling.IMaterialMarkupLibraryDescriptor
- Methods inherited from interface com.anylogic.engine.markup.INetworkMarkupElement
- Methods inherited from interface com.anylogic.engine.markup.IPath
- Methods inherited from interface java.lang.Iterable
- Constructor Details
- Method Details
- getMaterialLibraryDescriptor
- isLimitSpeed
- setLimitSpeed
- getMaxSpeed
- setMaxSpeed
- isLimitNumberOfTransporters
- setLimitNumberOfTransporters
- getMaxNumberOfTransporters
- setMaxNumberOfTransporters
- getNumberOfTransporters
- getTransporter
- getTransporters
- setBidirectional
- isBidirectional
- createPort
- createPort
- createPortInternal
- setSource
- getSource
- setTarget
- getTarget
- getOtherNode
- getDrawingType
- setDrawingType
- setLineColor
- setLineColor
- getLineColor
- getLineTexture
- setLineWidth
- setLineWidth
- getLineWidth
- getLineWidth
- contains
- contains
- containsSq
- startDrawing
- lineTo
- arcTo
- addSegment
- getSegmentCount
- getSegment
- iterator
- getStartPoint
- getStartPoint
- getEndPoint
- getEndPoint
- getStartPosition
- getStartPosition
- getEndPosition
- getEndPosition
- length
- length
- getPointAtOffset
- getPointAtOffset
- getPositionAtOffset
- getPositionAtOffset
- getNearestPoint
- getNearestPoint
- getNearestPointOnRay
- getNearestPointOnRay
- randomPointInside
- randomPositionInside
- toPath3D
- getPosition
- getPosition
- getBoundingRectangle
- createPort
- createPort
- java.lang.Object
- com.anylogic.engine.markup.AbstractMarkup
- com.anylogic.engine.markup.MarkupShape
- com.anylogic.engine.markup.NetworkMarkupElement
- com.anylogic.engine.markup.Path
- All Implemented Interfaces:
AggregatableAnimationElement
,AnimationMovingLocationProvider
,AnimationStaticLocationProvider
,HasLevel
,IMarkupLibraryDescriptor
,INetworkMarkupElement
,IPath<Node>
,com.anylogic.engine.markup.material_handling.IMaterialMarkupLibraryDescriptor
,com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
,SVGElement
,Serializable
,Iterable<MarkupSegment>
public class Path extends NetworkMarkupElement implements IPath<Node>, Iterable<MarkupSegment>, com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
Implementation of
IPath
for network in continuous space.- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
Path() | |
Path | |
Path |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Path |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Path |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
Modifier and Type | Method | Description |
---|---|---|
void | addSegment |
Adds segment to this markup element
|
void | arcTo |
Adds arc segment with two circular arcs (available for markup elements created with no-argument constructor)
|
boolean | contains |
Test if the shape contains the point with the given coordinates (relative
to this shape's container, i.e.
|
boolean | contains |
Test if the shape contains the point with the given coordinates (relative
to this shape's container, i.e.
|
boolean | containsSq |
Test if the shape contains the point with the given coordinates (relative
to this shape's container, i.e.
|
default NetworkPort | createPort | |
default NetworkPort | createPort | |
NetworkPort | createPort |
Creates and returns a Network Port located on specified path's end
|
NetworkPort | createPort |
Creates and returns a Network Port located on specified path's end and pairs created port with specified one
|
NetworkPort | createPortInternal | |
BoundingRectangle | getBoundingRectangle() | |
PathDrawingType | getDrawingType() |
Returns the drawing type of this path
|
Point | getEndPoint() |
Returns the location of the end point
|
Point | getEndPoint |
Returns the location of the end point
|
Position | getEndPosition() |
Returns the end position
|
Position | getEndPosition |
Returns the end position
|
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 |
Returns line width
|
com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent> | getMaterialLibraryDescriptor() | |
int | getMaxNumberOfTransporters() |
Returns the maximum allowed number of transporters on this path
|
double | getMaxSpeed |
Returns max allowed speed on this path in specified speed units
|
double | getNearestPoint |
Calculates (using the
output object) the point in this space markup element
nearest to the given (x, y, z) point. |
double | getNearestPoint |
Calculates (using the
output object) the point in this space markup element
nearest to the given (x, y) point. |
double | getNearestPointOnRay |
Calculates the intersection point between this element and the given ray.
|
double | getNearestPointOnRay |
Calculates the intersection point between this element and the given ray.
|
int | getNumberOfTransporters() |
Returns the number of transporters currently located on this path
|
Node | getOtherNode |
If the given node is source of this path, returns path's target,
otherwise returns source.
|
final Point | getPointAtOffset |
Returns the point located on the markup element with the given
offset
distance calculated from start point.This method may be slightly faster in some cases but returns no orientation information (rotations). |
final Point | getPointAtOffset |
Returns the point located on the markup element with the given
offset
distance calculated from start point.This method may be slightly faster in some cases but returns no orientation information (rotations). |
Position | getPosition |
Returns position with offset corresponding to the given
value ,
assuming that 0 is start and maxValue is end |
Position | getPosition |
Returns the item position with the given index.
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1). |
final Position | getPositionAtOffset |
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
final Position | getPositionAtOffset |
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point. |
MarkupSegment | getSegment |
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 |
Returns the location of the start point
|
Position | getStartPosition() |
Returns the start position
|
Position | getStartPosition |
Returns the start position
|
Node | getTarget() |
Returns target node of this path.
|
Agent | getTransporter |
Returns the transporter with the specified index
|
List<Agent> | getTransporters() |
Returns the list of all transporters currently located on this path
|
boolean | isBidirectional() |
Returns the 'bidirectional' property (
true by default). |
boolean | isLimitNumberOfTransporters() |
Returns true if the number of transporters is limited on this path, false otherwise
|
boolean | isLimitSpeed() |
Returns true if speed is limited on this path, false otherwise
|
Iterator<MarkupSegment> | iterator() |
Creates and returns read-only iterator over segments
|
final double | length() |
Returns the length of the markup element, calculated in 3D space.
|
final double | length |
Returns the length of the markup element, calculated in 3D space.
|
void | lineTo |
Adds line segment (available for markup elements created with no-argument constructor)
|
final Point | randomPointInside |
Returns the randomly chosen point inside/along the given space markup element.
|
final Position | randomPositionInside |
Returns the randomly chosen position along the path.
|
void | setBidirectional |
Sets the 'bidirectional' property (
true by default). |
void | setDrawingType |
Sets the drawing type of this path
|
void | setLimitNumberOfTransporters |
Enables limiting the number of transporters on this path if the argument is true, disables it otherwise
|
void | setLimitSpeed |
Enables speed limit on this path if the argument is true, disables it if the argument is false
The element should be uninitialized
|
void | setLineColor |
Sets the color of the path.
|
void | setLineColor |
Sets the color (or
Texture ) of the path. |
void | setLineWidth |
Sets the width of the path, 0 means thinnest possible
|
void | setLineWidth |
Sets line width
|
void | setMaxNumberOfTransporters |
Sets the maximum allowed number of transporters on this path
|
void | setMaxSpeed |
Sets the maximum allowed speed in specified units
|
void | setSource |
Sets source node of this path.
|
void | setTarget |
Sets source node of this path.
|
void | startDrawing |
Starts drawing (available for markup elements created with no-argument constructor)
|
Path3D | toPath3D() |
Converts this markup element to
Path3D interface |
error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner
discardOwner, executeUserAction, findSVGElement, getName, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
Methods inherited from interface com.anylogic.engine.markup.material_handling.IMaterialMarkupLibraryDescriptor
getMarkup, setMarkup
public Path()
public Path(Agent owner)
@Deprecated public Path(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean bidirectional, PathDrawingType drawingType, Paint color, double lineWidth, MarkupSegment... segments)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
- Parameters:
owner
-drawMode
-isPublic
-bidirectional
-drawingType
-color
-lineWidth
- line width,
fordrawingType
(PathDrawingType.PATH_LINE
,PathDrawingType.PATH_DASHEDLINE
) - measured in pixels,
for other drawing types - measured in meterssegments
-
@Deprecated public Path(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean bidirectional, boolean isLimitSpeed, double maxSpeedInMPS, boolean limitNumberOfTransporters, int maxNumberOfTransporters, PathDrawingType drawingType, Paint color, double lineWidth, MarkupSegment... segments)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
- Parameters:
owner
-drawMode
-isPublic
-bidirectional
-isLimitSpeed
-maxSpeedInMPS
-limitNumberOfTransporters
-maxNumberOfTransportersInMPS
-drawingType
-color
-lineWidth
- line width,
fordrawingType
(PathDrawingType.PATH_LINE
,PathDrawingType.PATH_DASHEDLINE
) - measured in pixels,
for other drawing types - measured in meterssegments
-
@Deprecated public Path(Agent owner, ShapeDrawMode drawMode, boolean isPublic, boolean bidirectional, boolean isLimitSpeed, double maxSpeedInMPS, boolean limitNumberOfTransporters, int maxNumberOfTransporters, PathDrawingType drawingType, Paint color, double lineWidth, Node source, Node target, MarkupSegment... segments)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
- Parameters:
owner
-drawMode
-isPublic
-bidirectional
-isLimitSpeed
-maxSpeedInMPS
-limitNumberOfTransporters
-maxNumberOfTransportersInMPS
-drawingType
-color
-lineWidth
- line width,
fordrawingType
(PathDrawingType.PATH_LINE
,PathDrawingType.PATH_DASHEDLINE
) - measured in pixels,
for other drawing types - measured in meterssource
-target
-segments
-
@AnyLogicInternalAPI public com.anylogic.engine.markup.material_handling.IPathDescriptor<Agent> getMaterialLibraryDescriptor()
public boolean isLimitSpeed()
Returns true if speed is limited on this path, false otherwise
public void setLimitSpeed(boolean limitSpeed)
Enables speed limit on this path if the argument is true, disables it if the argument is false
The element should be uninitialized
- Parameters:
limitSpeed
- argument flag
public double getMaxSpeed(SpeedUnits units)
Returns max allowed speed on this path in specified speed units
- Parameters:
units
- speed units- Returns:
- max speed
public void setMaxSpeed(double maxSpeed, SpeedUnits units)
Sets the maximum allowed speed in specified units
- Parameters:
maxSpeed
- new max speedunits
- speed units
public boolean isLimitNumberOfTransporters()
Returns true if the number of transporters is limited on this path, false otherwise
public void setLimitNumberOfTransporters(boolean limitNumberOfTransporters)
Enables limiting the number of transporters on this path if the argument is true, disables it otherwise
- Parameters:
limitNumberOfTransporters
- argument flag
public int getMaxNumberOfTransporters()
Returns the maximum allowed number of transporters on this path
public void setMaxNumberOfTransporters(int maxNumberOfTransporters)
Sets the maximum allowed number of transporters on this path
- Parameters:
maxNumberOfTransporters
- new value
public int getNumberOfTransporters()
Returns the number of transporters currently located on this path
- Specified by:
getNumberOfTransporters
in interfacecom.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public Agent getTransporter(int index)
Returns the transporter with the specified index
- Specified by:
getTransporter
in interfacecom.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public List<Agent> getTransporters()
Returns the list of all transporters currently located on this path
- Specified by:
getTransporters
in interfacecom.anylogic.engine.markup.material_handling.IPathDescriptor<Agent>
public void setBidirectional(boolean bidirectional)
Description copied from interface:
IPath
Sets the 'bidirectional' property (
true
by default).- Specified by:
setBidirectional
in interfaceIPath<Node>
- Parameters:
bidirectional
-true
for paths which allow movements in both directions,false
for paths which allow movements from source to target only- See Also:
-
IPath.isBidirectional()
public boolean isBidirectional()
Description copied from interface:
IPath
Returns the 'bidirectional' property (
true
by default).- Specified by:
isBidirectional
in interfaceIPath<Node>
- Returns:
true
for paths which allow movements in both directions,false
for paths which allow movements from source to target only
public NetworkPort createPort(PathEndType endType)
Creates and returns a Network Port located on specified path's end
- Parameters:
endType
- determines the port's location- Returns:
- new network port
public NetworkPort createPort(PathEndType endType, NetworkPort pairedPort)
Creates and returns a Network Port located on specified path's end and pairs created port with specified one
- Parameters:
endType
- determines the port's location.pairedPort
- another port to be paired with the new one. May be a port, located on another path or a lift port. Should not benull
- Returns:
- new network port
@AnyLogicInternalAPI public NetworkPort createPortInternal(PathEndType endType)
public void setSource(Node node)
Description copied from interface:
IPath
Sets source node of this path. This method should be called before
initialize()
method.public Node getSource()
Description copied from interface:
IPath
Returns source node of this path.
public void setTarget(Node node)
Description copied from interface:
IPath
Sets source node of this path. This method should be called before
initialize()
method.public Node getTarget()
Description copied from interface:
IPath
Returns target node of this path.
public Node getOtherNode(Node n)
If the given node is source of this path, returns path's target,
otherwise returns source. Note that this function doesn't check
that the given is either source or target: this is the responsibility
of user calling this function. The ordinal use case is calling this
method for some path connected to some node.
- Specified by:
getOtherNode
in interfaceIPath<Node>
- Parameters:
n
- the node (one of the path endings)- Returns:
- the node of the other end of this path
public PathDrawingType getDrawingType()
Returns the drawing type of this path
- Returns:
- the drawing type of this path
public void setDrawingType(PathDrawingType drawingType)
Sets the drawing type of this path
- Parameters:
drawingType
- the drawing type of this path
public void setLineColor(Color color)
Sets the color of the path.
- Parameters:
color
- the new color, null = do not draw the path
public void setLineColor(Paint color)
Sets the color (or
Texture
) of the path.- Specified by:
setLineColor
in interfaceIPath<Node>
- Parameters:
color
- the new color, null = do not draw the path
public 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)- Specified by:
getLineColor
in interfaceIPath<Node>
- Returns:
- the color of the path
public Texture getLineTexture()
Returns the texture of the path, if the path has it
- Specified by:
getLineTexture
in interfaceIPath<Node>
- Returns:
- the texture of the path
public void setLineWidth(double widthInPixels)
Sets the width of the path, 0 means thinnest possible
- Specified by:
setLineWidth
in interfaceIPath<Node>
- Parameters:
width
- the new width of the path, measured in meters
public void setLineWidth(double lineWidth, LengthUnits units)
Sets line width
- Parameters:
laneWidth
- line width, measured in the given unitsunits
- length units
public double getLineWidth()
Returns the width of the path.
- Specified by:
getLineWidth
in interfaceIPath<Node>
- Returns:
- the width of the path, measured in pixels
public double getLineWidth(LengthUnits units)
Returns line width
- Parameters:
units
- length units- Returns:
- line width, measured in the given units
public boolean contains(double px, double py)
Description copied from class:
MarkupShape
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 interfaceINetworkMarkupElement
- Specified by:
contains
in classMarkupShape
- 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 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
- Parameters:
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 not- Returns:
true
if the shape contains the point with the given coordinates
public 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
- Parameters:
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 not- Returns:
true
if the shape contains the point with the given coordinates
public void startDrawing(double x, double y, double z)
Starts drawing (available for markup elements created with no-argument constructor)
- Parameters:
x
- the x coordinate of the first pointy
- the y coordinate of the first pointz
- the z coordinate of the first point
public void lineTo(double x, double y, double z)
Adds line segment (available for markup elements created with no-argument constructor)
- Parameters:
x
- the x coordinate of the segment end pointy
- the y coordinate of the segment end pointz
- the z coordinate of the segment end point
public 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)
- Parameters:
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 arcs
public void addSegment(MarkupSegment segment)
Adds segment to this markup element
- Parameters:
segment
- the segment, should be initialized if was created using no-argument constructor
public int getSegmentCount()
Description copied from interface:
IPath
Returns the number of segments
- Specified by:
getSegmentCount
in interfaceIPath<Node>
- Returns:
- the number of segments
public MarkupSegment getSegment(int index)
Description copied from interface:
IPath
Returns the segment by its index
- Specified by:
getSegment
in interfaceIPath<Node>
- Parameters:
index
- the segment index, [0 ..IPath.getSegmentCount()
- 1]- Returns:
- the segment
public Iterator<MarkupSegment> iterator()
Creates and returns read-only iterator over segments
public Point getStartPoint(Point out)
Description copied from interface:
IPath
Returns the location of the start point
- Specified by:
getStartPoint
in interfaceIPath<Node>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the first point
public Point getStartPoint()
Description copied from interface:
IPath
Returns the location of the start point
- Specified by:
getStartPoint
in interfaceIPath<Node>
- Returns:
- the Point object with coordinates of the first point
public Point getEndPoint(Point out)
Description copied from interface:
IPath
Returns the location of the end point
- Specified by:
getEndPoint
in interfaceIPath<Node>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the last point
public Point getEndPoint()
Description copied from interface:
IPath
Returns the location of the end point
- Specified by:
getEndPoint
in interfaceIPath<Node>
- Returns:
- the Point object with coordinates of the last point
public Position getStartPosition(Position out)
Description copied from interface:
IPath
Returns the start position
- Specified by:
getStartPosition
in interfaceIPath<Node>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the first position
public Position getStartPosition()
Returns the start position
- Returns:
- the Position object with coordinates of the first position
public Position getEndPosition(Position out)
Description copied from interface:
IPath
Returns the end position
- Specified by:
getEndPosition
in interfaceIPath<Node>
- Parameters:
out
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the last position
public Position getEndPosition()
Returns the end position
- Returns:
- the Position object with coordinates of the last position
public final double length()
Returns the length of the markup element, calculated in 3D space.
- Specified by:
length
in interfaceAnimationMovingLocationProvider
- Returns:
- the length of the markup element (measured in pixels), a positive number
public final double length(LengthUnits units)
Returns the length of the markup element, calculated in 3D space.
- Specified by:
length
in interfaceAnimationMovingLocationProvider
- Parameters:
units
- the units of length- Returns:
- the length of the markup element, a positive number
- Since:
- 7.1
public final Point getPointAtOffset(double offset, Point out)
Returns the point located on the markup element with the given
This method may be slightly faster in some cases but returns no orientation information (rotations).
offset
distance calculated from start point.This method may be slightly faster in some cases but returns no orientation information (rotations).
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.out
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the point with the given offset
- See Also:
public final Point getPointAtOffset(double offset, LengthUnits units, Point out)
Returns the point located on the markup element with the given
This method may be slightly faster in some cases but returns no orientation information (rotations).
offset
distance calculated from start point.This method may be slightly faster in some cases but returns no orientation information (rotations).
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.units
- the length unitsout
- output object to write to, may benull
- Returns:
- the Point object with coordinates of the point with the given offset
- See Also:
public final Position getPositionAtOffset(double offset, Position out)
Description copied from interface:
IPath
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point.- Specified by:
getPositionAtOffset
in interfaceIPath<Node>
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.out
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the point with the given offset and orientation along markup element line at this point
public final Position getPositionAtOffset(double offset, LengthUnits units, Position out)
Description copied from interface:
IPath
Returns the point (+rotations) located on the markup element with the given
offset
distance calculated from start point.- Specified by:
getPositionAtOffset
in interfaceIPath<Node>
- Parameters:
offset
- offset, non-negative value, should be less or equal to the full length.units
- the length unitsout
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the point with the given offset and orientation along markup element line at this point
public 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. 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).- Specified by:
getNearestPoint
in classNetworkMarkupElement
- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointoutput
- the output point to write result to. Note thatoutput.z
is left unchanged.- Returns:
- the square of distance to the nearest point in the horizontal (XY) projection
public 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. Returns the square of distance to the point.- Specified by:
getNearestPoint
in classNetworkMarkupElement
- Parameters:
x
- x coordinate of the pointy
- y coordinate of the pointz
- z coordinate of the pointoutput
- the output point to write result to.- Returns:
- the square of distance to the nearest point
public double getNearestPointOnRay(double x1, double y1, double x2, double y2, Point out)
Calculates the intersection point between this element and the given ray.
If there are several intersections, returns the one nearest to the ray start
- Parameters:
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 notnull
- Returns:
- the offset of the nearest point or
-1
if there is no intersections with the given ray
public double getNearestPointOnRay(double x1, double y1, double x2, double y2, LengthUnits units, Point out)
Calculates the intersection point between this element and the given ray.
If there are several intersections, returns the one nearest to the ray start
- Parameters:
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- Returns:
- the offset of the nearest point or -1 if there is no intersections with the given ray
public final Point randomPointInside(Random rng, Point out)
Description copied from interface:
INetworkMarkupElement
Returns the randomly chosen point inside/along the given space markup element.
This method utilises the given Random Number Generator.
- Specified by:
randomPointInside
in interfaceINetworkMarkupElement
- Parameters:
rng
- the random number generator.out
- output object to write to, may benull
- Returns:
- the randomly chosen point
public final Position randomPositionInside(Random rng, Position out)
Returns the randomly chosen position along the path.
This method utilizes the given Random Number Generator.
Returned position is set to the orientation 'along' the path
Returned position is set to the orientation 'along' the path
- Parameters:
rng
- the random number generator.out
- output object to write to, may benull
- Returns:
- the randomly chosen point along the path
public Path3D toPath3D()
Converts this markup element to
Path3D
interfacepublic Position getPosition(int index, int totalNumber, Position out)
Description copied from interface:
AnimationStaticLocationProvider
Returns the item position with the given index.
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1).
In case of any wrong argument returns zero-index position (position for index=0 with totalNumber=1).
- Specified by:
getPosition
in interfaceAnimationStaticLocationProvider
- Parameters:
index
- the index of some item positions, should be not negative and less thantotalNumber
totalNumber
- the total number of item positions, should be positiveout
- output object to write to, may benull
- Returns:
- the Position object with coordinates of the requested item position
public Position getPosition(double value, double maxValue, Position out)
Description copied from interface:
AnimationMovingLocationProvider
Returns position with offset corresponding to the given
value
,
assuming that 0
is start and maxValue
is end- Specified by:
getPosition
in interfaceAnimationMovingLocationProvider
- Returns:
- position by offset
@AnyLogicInternalAPI public BoundingRectangle getBoundingRectangle()
@AnyLogicInternalAPI default NetworkPort createPort(IPath<?> path, PathEndType endType)
@AnyLogicInternalAPI default NetworkPort createPort(IPath<?> path, PathEndType endType, NetworkPort pairedPort)