RouteData object stores the information about transporter's route as a list of movement tasks. The tasks are executed consequently in the order of listing. Each task describes transporter's movement along a single segment of the route. The segment ends when the type of movement changes. The movements can be of the following types:
RouteData object provides the following functions:
Function |
Description |
boolean isEmpty() |
Returns true if the RouteData object contains information about a transporter's route. Otherwise, returns false. |
int size() |
Returns the amount of movement tasks in the RouteData object. |
RouteData findShortestRoute(Collection<RouteData> collection, LengthUnits units) |
Returns the shortest route from the collection of RouteData objects in the specified length units. Parameters: |
Function |
Description |
IRouteLocation getSourceLocation() |
Returns the source location of the route described by the RouteData object. |
IRouteLocation getTargetLocation() |
Returns the target location of the route described by the RouteData object. |
double distance(LengthUnits units) |
Returns the distance of the route described in the RouteData object in specified length units. Parameter: |
boolean contains(INode node) |
Checks whether the route described in the RouteData object contains the given node. Parameter: |
boolean contains(IPath path) |
Checks whether the route described in the RouteData object contains the given path. Parameter: |
Function |
Description |
IMovement getMovement(int index) |
Returns a movement task with a specified index from the RouteData object. Parameter: |
IMovement getFirstMovement() |
Returns the first movement task. If the RouteData object is empty, this function returns null. |
IMovement getLastMovement() |
Returns the last movement task. If the RouteData object is empty, this function returns null. |
List<IMovement> getMovements() |
Returns the unmodifiable list of all movement tasks. |
Function |
Description |
IMovement createPlainMovement(INetworkMarkupElement networkElement, Point source, Point target) |
Creates a movement task of PLAIN type within a given network node. Parameters: |
IMovement createPathMovement(IPath path, boolean forward) |
Creates a movement task of PATH type along the given path in the specified direction. Parameters: |
IMovement createPathMovement(IPath path, double sourceOffset, double targetOffset, LengthUnits units) |
Creates a movement task of PATH type. The movement takes place within a single path, begins at the given offset from the starting point of the path and ends at the given offset from the starting point of the path. The offset is given in the specified length units. Parameters: |
IMovement createPortMovement(MarkupPort source, MarkupPort target) |
Creates a movement task of PORT type between the two given network ports. Parameters: |
IMovement createNodeTransferMovement(INode node, IPath sourcePath, IPath targetPath) |
Creates a movement task of either PATH type or PLAIN type between the two given paths within a given network node. In case of polygonal and rectangular nodes it will be a PLAIN type, and in case of point node - a PATH type. Parameters: |
Function |
Description |
addMovement(IMovement movement) |
Adds a given movement task to the RouteData object. This task is placed at the end of the existing list of movement tasks. Parameter: |
addMovement(int index, IMovement movement) |
Adds a given movement task to the RouteData object and inserts it in the existing list of movement tasks by the specified index. Parameters: |
addMovements(IMovement... movements) |
Adds movement tasks to the RouteData object. These movements are placed at the end of the existing list of movement tasks in the same order as the arguments passed. Parameter: |
addMovements(Collection<? extends IMovement> movements) |
Adds a collection of movement tasks to the RouteData object. These movements are placed at the end of the existing list of movement tasks in the same order as they are in the collection. Parameter: |
addPlainMovement(INetworkMarkupElement networkElement, Point source, Point target) |
Adds a movement task of PLAIN type within a given network node. Parameters: |
addPathMovement(IPath path, boolean isForward) |
Adds a movement task of PATH type along the given path in the specified direction to the RouteData object. Parameters: |
addPathMovement(IPath path, double sourceOffset, double targetOffset, LengthUnits units) |
Adds a movement task of PATH type to the RouteData object. The movement takes place within one path, begins at the given offset from the starting point of the path and ends at the given offset from the starting point of the path. The offset is given in the specified length units. Parameters: |
addNodeTransferMovement(INode node, IPath sourcePath, IPath targetPath) |
Adds a movement task of either PATH type or PLAIN type from one given path to another within a given network node to the RouteData object. In case of polygonal and rectangular nodes it will be a PLAIN type, and in case of point node - a PATH type. Parameters: |
addPortMovement(MarkupPort source, MarkupPort target) |
Adds a movement task of PORT type between the two given network ports to the RouteData object. Parameters: |
Function |
Description |
boolean removeMovement(IMovement movement) |
Removes the given movement task from the RouteData object. If the function returns true, the task was found in the object and successfully removed. If the function returns false, the task wasn't found. Parameter: |
removeMovement(int index) |
Removes a movement task with a given index from the RouteData object. Parameter: |
removeFirstMovement() |
Removes the first movement task from the RouteData object. |
removeLastMovement() |
Removes the last movement task from the RouteData object. |