AnyLogic
Expand
Font size
Type Parameters:
N - network node based on com.anylogic.engine.markup.INode interface
All Superinterfaces:
AnimationMovingLocationProvider, AnimationStaticLocationProvider, INetworkMarkupElement, java.io.Serializable
All Known Implementing Classes:
ConveyorPath, GISRoute, Path

public interface IPath<N extends INode>
extends INetworkMarkupElement, AnimationMovingLocationProvider
This is the basic interface for implementation connection between nodes inside network.
Author:
AnyLogic North America, LLC https://anylogic.com

Method Summary

All Methods Instance Methods Abstract Methods Default Methods 
Point getEndPoint()
Returns the location of the end point
Point getEndPoint​(Point out)
Returns the location of the end point
Position getEndPosition​(Position out)
Returns the end position
java.awt.Color getLineColor()
Returns the line color of the markup element, or null if markup element has no line color or has textured line (in this case getLineTexture() should be used instead)
Texture getLineTexture()
Returns the line texture of the markup element, if the markup element has line texture
double getLineWidth()
Returns the line width of the markup element.
java.lang.String getName()
If the markup shape is declared as field in an agent class, e.g.
N getOtherNode​(N n)
If the given node is source of this path, returns path's target, otherwise returns source.
default INode<?,​?> getPathEnd​(PathEndType type)  
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.
IMarkupSegment getSegment​(int index)
Returns the segment by its index
int getSegmentCount()
Returns the number of segments
N 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​(Position out)
Returns the start position
N getTarget()
Returns target node of this path.
boolean isBidirectional()
Returns the 'bidirectional' property (true by default).
java.util.Iterator<? extends IMarkupSegment> iterator()
Returns iterator over segments of the path
void setBidirectional​(boolean bidirectional)
Sets the 'bidirectional' property (true by default).
void setLineColor​(java.awt.Paint lineColor)
Sets the line color (or Texture) of the markup element.
void setLineWidth​(double width)
Sets the line width of the markup element, 0 means thinnest possible
void setSource​(N node)
Sets source node of this path.
void setTarget​(N node)
Sets source node of this path.
Modifier and Type Method Description

Methods inherited from interface com.anylogic.engine.markup.AnimationMovingLocationProvider

getPosition, length, length

Methods inherited from interface com.anylogic.engine.markup.AnimationStaticLocationProvider

getPosition, getSpace

Methods inherited from interface com.anylogic.engine.markup.INetworkMarkupElement

contains, getNearestPoint, getNetwork, getSpace, randomPointInside, randomPointInside, randomPointInside, randomPointInside

Method Detail

getPathEnd

default INode<?,​?> getPathEnd​(PathEndType type)

getSource

N getSource()
Returns source node of this path.
Returns:
instance of com.anylogic.engine.markup.INode interface

setSource

void setSource​(N node)
Sets source node of this path. This method should be called before initialize() method.
Parameters:
node - instance of com.anylogic.engine.markup.INode interface

getTarget

N getTarget()
Returns target node of this path.
Returns:
instance of com.anylogic.engine.markup.INode interface

setTarget

void setTarget​(N node)
Sets source node of this path. This method should be called before initialize() method.
Parameters:
node - instance of com.anylogic.engine.markup.INode interface

getStartPoint

Point getStartPoint()
Returns the location of the start point
Returns:
the Point object with coordinates of the first point

getStartPoint

Point getStartPoint​(Point out)
Returns the location of the start point
Parameters:
out - output object to write to, may be null
Returns:
the Point object with coordinates of the first point

getEndPoint

Point getEndPoint()
Returns the location of the end point
Returns:
the Point object with coordinates of the last point

getEndPoint

Point getEndPoint​(Point out)
Returns the location of the end point
Parameters:
out - output object to write to, may be null
Returns:
the Point object with coordinates of the last point

isBidirectional

boolean isBidirectional()
Returns the 'bidirectional' property (true by default).
Returns:
true for paths which allow movements in both directions, false for paths which allow movements from source to target only

setBidirectional

void setBidirectional​(boolean bidirectional)
Sets the 'bidirectional' property (true by default).
Parameters:
bidirectional - true for paths which allow movements in both directions, false for paths which allow movements from source to target only
See Also:
isBidirectional()

getSegmentCount

int getSegmentCount()
Returns the number of segments
Returns:
the number of segments

getSegment

IMarkupSegment getSegment​(int index)
Returns the segment by its index
Parameters:
index - the segment index, [0 .. getSegmentCount() - 1]
Returns:
the segment

iterator

java.util.Iterator<? extends IMarkupSegment> iterator()
Returns iterator over segments of the path

getOtherNode

N getOtherNode​(N 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.
Parameters:
n - the node (one of the path endings)
Returns:
the node of the other end of this path

getName

java.lang.String getName()
If the markup shape is declared as field in an agent class, e.g. if it was drawn in the graphical editor, returns the name of the field, otherwise returns the string #UNKNOWN_NAME. For replicated shapes returns the name of the field with the index of the shape in square brackets.
This method is designed to be used for debug/development purposes only. It has a very inefficient implementation
Returns:
the name of the corresponding field or #UNKNOWN_NAME

getPositionAtOffset

Position getPositionAtOffset​(double offset,
                             Position out)
Returns the point (+rotations) located on the markup element with the given offset distance calculated from start point.
Parameters:
offset - offset, non-negative value, should be less or equal to the full length.
out - output object to write to, may be null
Returns:
the Position object with coordinates of the point with the given offset and orientation along markup element line at this point

getPositionAtOffset

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.
Parameters:
offset - offset, non-negative value, should be less or equal to the full length.
units - the length units
out - output object to write to, may be null
Returns:
the Position object with coordinates of the point with the given offset and orientation along markup element line at this point
Since:
7.1

getStartPosition

Position getStartPosition​(Position out)
Returns the start position
Parameters:
out - output object to write to, may be null
Returns:
the Position object with coordinates of the first position

getEndPosition

Position getEndPosition​(Position out)
Returns the end position
Parameters:
out - output object to write to, may be null
Returns:
the Position object with coordinates of the last position

getLineColor

java.awt.Color getLineColor()
Returns the line color of the markup element, or null if markup element has no line color or has textured line (in this case getLineTexture() should be used instead)
Returns:
the line color of the markup element

setLineColor

void setLineColor​(java.awt.Paint lineColor)
Sets the line color (or Texture) of the markup element.
Parameters:
lineColor - the new line color, null = do not draw the markup element line

getLineTexture

Texture getLineTexture()
Returns the line texture of the markup element, if the markup element has line texture
Returns:
the line texture of the markup element

getLineWidth

double getLineWidth()
Returns the line width of the markup element.
Returns:
the line width of the markup element

setLineWidth

void setLineWidth​(double width)
Sets the line width of the markup element, 0 means thinnest possible
Parameters:
width - the new line width of the markup element
How can we improve this article?