AnyLogic
Expand
Font size
Type Parameters:
N - network node, an instance of INode
P - network path, an instance of IPath
All Superinterfaces:
IRouteProvider<ShortestPathData<N,P>>, Serializable
All Known Implementing Classes:
AbstractNetwork, ConveyorNetwork, GISNetwork, Network

public interface INetwork<N extends INode<N,P>,P extends IPath<N>>
extends IRouteProvider<ShortestPathData<N,P>>
Basic interface of network for agent movement based on markup elements.
Author:
AnyLogic North America, LLC https://anylogic.com

Method Summary

Modifier and TypeMethodDescription
voidadd(N n)
Adds node to network.
voidadd(P p)
Adds relation to network.
Class<? extends ExtAgentWithSpatialMetrics>getCompatibleAgentExtensionClass()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
doublegetDistance(Point source, Point target, ShortestPathData<N,P> data)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, N from, N to, ShortestPathData<N,P> data)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, N from, N to, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, N from, P to, double toOffset, ShortestPathData<N,P> data)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, N from, P to, double toOffset, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, P from, double fromOffset, N to, ShortestPathData<N,P> data)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, P from, double fromOffset, N to, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, P from, double fromOffset, P to, double toOffset, ShortestPathData<N,P> data)
Calculates the distance between two points using the network paths.
doublegetDistance(Point source, Point target, P from, double fromOffset, P to, double toOffset, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance between two points using the network paths.
doublegetDistance(N from, N to, ShortestPathData<N,P> data)
Calculates the distance from source object in the network to the target object.
doublegetDistance(N from, N to, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance from source object in the network to the target object.
doublegetDistance(N from, P to, double toOffset, ShortestPathData<N,P> data)
Calculates the distance from source object in the network to the target object.
doublegetDistance(N from, P to, double toOffset, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance from source object in the network to the target object.
doublegetDistance(P from, double fromOffset, N to, ShortestPathData<N,P> data)
Calculates the distance from source object in the network to the target object.
doublegetDistance(P from, double fromOffset, N to, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance from source object in the network to the target object.
doublegetDistance(P from, double fromOffset, P to, double toOffset, ShortestPathData<N,P> data)
Calculates the distance from source object in the network to the target object.
doublegetDistance(P from, double fromOffset, P to, double toOffset, ShortestPathData<N,P> data, LengthUnits units)
Calculates the distance from source object in the network to the target object.
INetworkMarkupElementgetNearestNetworkElement(double x, double y, double z, Point out)
Looking for the closest markup element in this network to the given coordinates.
INetworkMarkupElementgetNearestNetworkElement(Point givenPoint, Point out)
Looking for the closest markup element in this network to the given point.
NgetNearestNode(Point p)
Looking for the closest node in this network to the given point.
NgetNode(int index) 
intgetNodeCount()
Amount of nodes in this network.
PgetPath(int index) 
intgetPathCount()
Amount of paths in this network.
doublegetPlainDistance(Point firstPoint, Point secondPoint)
Straight line distance between two points.
doublegetPlainDistance(Point firstPoint, Point secondPoint, LengthUnits units)
Straight line distance between two points in given units of length.
PositiongetPosition(ShortestPathData<N,P> data, double reverseOffset, LengthUnits units, Position out)
Calculates current position on the shortest path through network by the given offset
PositiongetPosition(ShortestPathData<N,P> data, double reverseOffset, Position out)
Calculates current position on the shortest path through network by the given offset
List<INetwork<?,?>>getRelatedNetworks() 
AgentgetSpace()
Returns the space where the markup element is defined
List<N>nodes() 
List<P>paths() 
List<NetworkPort>ports() 

Methods inherited from interface com.anylogic.engine.IRouteProvider

getDistance, getLength, getPathData, getPositionAtOffset

Method Details

add

void add(N n)
Adds node to network. Don't call this method when network has been initialized.
Parameters:
n - network node, instance of INode

add

void add(P p)
Adds relation to network. Don't call this method when network has been initialized.
Parameters:
p - network path, instance of IPath

getNearestNode

N getNearestNode(Point p)
Looking for the closest node in this network to the given point.
Parameters:
p - the given point
Returns:

getNearestNetworkElement

INetworkMarkupElement getNearestNetworkElement(double x,
 double y,
 double z,
 Point out)
Looking for the closest markup element in this network to the given coordinates.
Parameters:
x - the x given coordinate
y - the y given coordinate
z - the z given coordinate
out - the point in this markup element nearest to the given coordinates
Returns:
nearest markup element

getNearestNetworkElement

INetworkMarkupElement getNearestNetworkElement(Point givenPoint,
 Point out)
Looking for the closest markup element in this network to the given point.
Parameters:
givenPoint - the given point
out - the point in this markup element nearest to the given point
Returns:
nearest markup element

getNode

N getNode(int index)

getNodeCount

int getNodeCount()
Amount of nodes in this network.
Returns:
amount of nodes

getPath

P getPath(int index)

getPathCount

int getPathCount()
Amount of paths in this network.
Returns:
amount of paths

ports

List<NetworkPort> ports()
Returns:
all ports of this network

nodes

List<N> nodes()
Returns:
all nodes of this network

paths

List<P> paths()
Returns:
all paths of this network

getRelatedNetworks

@AnyLogicInternalAPI
List<INetwork<?,?>> getRelatedNetworks()
Returns:
list of related networks

getDistance

double getDistance(N from,
 N to,
 ShortestPathData<N,P> data)
Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - from node
    to - to node
    data - output object to write to, may be null
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(N from,
     N to,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source node
    to - target node
    data - output object to write to, may be null
    units - length units
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(N from,
     P to,
     double toOffset,
     ShortestPathData<N,P> data)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source node
    to - target path
    toOffset - offset on the target path
    data - output object to write to, may be null
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(N from,
     P to,
     double toOffset,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source node
    to - target path
    toOffset - offset on the target path
    data - output object to write to, may be null
    units - length units
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(P from,
     double fromOffset,
     N to,
     ShortestPathData<N,P> data)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source path
    fromOffset - offset on the source path
    to - target node
    data - output object to write to, may be null
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(P from,
     double fromOffset,
     N to,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source path
    fromOffset - offset on the source path
    to - target node
    data - output object to write to, may be null
    units - length units
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(P from,
     double fromOffset,
     P to,
     double toOffset,
     ShortestPathData<N,P> data)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source path
    fromOffset - offset on the source path
    to - target path
    toOffset - offset on the target path
    data - output object to write to, may be null
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(P from,
     double fromOffset,
     P to,
     double toOffset,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance from source object in the network to the target object. Source and target points can be extracted from source and target objects in the following ways:
  • From network node - extracted point is a connection point of the node and the path, that will be used to calculate distance
  • From path and offset - extracted point lies at the certain distance (offset) from the start of the path
  • Parameters:
    from - source path
    fromOffset - offset on the source path
    to - target path
    toOffset - offset on the target path
    data - output object to write to, may be null
    units - length units
    Returns:
    distance between two points in the network

    getDistance

    double getDistance(Point source,
     Point target,
     N from,
     N to,
     ShortestPathData<N,P> data)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting node
    to - network end node
    data - output object to write into, may be null
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     N from,
     N to,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting node
    to - network end node
    data - output object to write into, may be null
    units - length units
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     N from,
     P to,
     double toOffset,
     ShortestPathData<N,P> data)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting node
    to - network end path
    toOffset - offset on the network end path
    data - output object to write into, may be null
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     N from,
     P to,
     double toOffset,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting node
    to - network end path
    toOffset - offset on the network end path
    data - output object to write into, may be null
    units - length units
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     P from,
     double fromOffset,
     N to,
     ShortestPathData<N,P> data)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting path
    fromOffset - offset on the network starting path
    to - network end node
    data - output object to write into, may be null
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     P from,
     double fromOffset,
     N to,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting path
    fromOffset - offset on the network starting path
    to - network end node
    data - output object to write into, may be null
    units - length units
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     P from,
     double fromOffset,
     P to,
     double toOffset,
     ShortestPathData<N,P> data)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting path
    fromOffset - offset on the network starting path
    to - network end path
    toOffset - offset on the network end path
    data - output object to write into, may be null
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     P from,
     double fromOffset,
     P to,
     double toOffset,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. You have two options in terms of 'connecting' the source point to the network start point and the network end point to the target point, namely:
  • Specifying the network node. The network point will lie at the connection point of the node and the path, that will be used to calculate distance
  • Specifying the path and the offset. The network point will lie at the certain distance (offset) from the start of this path
  • Parameters:
    source - source point
    target - target point
    from - network starting path
    fromOffset - offset on the network starting path
    to - network end path
    toOffset - offset on the network end path
    data - output object to write into, may be null
    units - length units
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     ShortestPathData<N,P> data)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. Network starting and and points will be chosen as network closest points to the source and target points respectively.
    Parameters:
    source - source point
    target - target point
    data - data output object to write into, may be null
    Returns:
    the distance between two points if traveling using network

    getDistance

    double getDistance(Point source,
     Point target,
     ShortestPathData<N,P> data,
     LengthUnits units)
    Calculates the distance between two points using the network paths. Source and target points do not have to belong to the network. Network starting and and points will be chosen as network closest points to the source and target points respectively.
    Parameters:
    source - source point
    target - target point
    data - data output object to write into, may be null
    units - length units
    Returns:
    the distance between two points if traveling using network

    getPlainDistance

    double getPlainDistance(Point firstPoint,
     Point secondPoint)
    Straight line distance between two points.
    Parameters:
    firstPoint -
    secondPoint -
    Returns:
    distance between two points

    getPlainDistance

    double getPlainDistance(Point firstPoint,
     Point secondPoint,
     LengthUnits units)
    Straight line distance between two points in given units of length.
    Parameters:
    firstPoint -
    secondPoint -
    units - unit of length
    Returns:
    distance between two points

    getPosition

    Position getPosition(ShortestPathData<N,P> data,
     double reverseOffset,
     Position out)
    Calculates current position on the shortest path through network by the given offset
    Parameters:
    data - shortest path data, see #getDistance(Node, Node, ShortestPathData) methods
    reverseOffset - offset from the end of route
    out - the Position object to use for output, may be null
    Returns:
    the position on the shortest path

    getPosition

    Position getPosition(ShortestPathData<N,P> data,
     double reverseOffset,
     LengthUnits units,
     Position out)
    Calculates current position on the shortest path through network by the given offset
    Parameters:
    data - shortest path data, see #getDistance(Node, Node, ShortestPathData) methods
    reverseOffset - offset from the end of route
    units - the units of length
    out - the Position object to use for output, may be null
    Returns:
    the position on the shortest path
    Since:
    7.1

    getSpace

    Agent getSpace()
    Returns the space where the markup element is defined
    Returns:
    the space associated with this element

    getCompatibleAgentExtensionClass

    @AnyLogicInternalAPI
    Class<? extends ExtAgentWithSpatialMetrics> getCompatibleAgentExtensionClass()
    This method is internal and shouldn't be called by user.
    it may be removed/renamed in future.