Class Connection
java.lang.Object
org.eclipse.mosaic.lib.database.road.Connection
This represents an abstraction layer on top of a
Way
. A connection is a directed
part of a way that connects two intersection nodes.-
Constructor Summary
ConstructorsConstructorDescriptionConnection
(String id, Way way) Connection
(String id, Way way, boolean isBackward) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIncomingConnection
(Connection connection) Adds a connection through that this connection can be accessed.void
Adds aNode
belonging to this connection.void
Adds all givenNode
s belonging to this connection.void
addOutgoingConnection
(Connection connection) Adds a connection that is accessible through this one.void
applyTurnRestriction
(Restriction.Type type, Connection target) This applies a turn restriction to the connection.getFrom()
This returns theNode
the connection starts from.getId()
Returns the ID of this connection.Returns the list of connections that lead into this connection..int
getLanes()
Returns the number of lanes this Connection presents.double
This connections length in meters.double
Gets the maximum speed allowed on this connection in km/h.double
Gets the maximum speed allowed on this connection in m/s.getNodes()
These are theNode
s that are part of this connection.Returns the connections that are accessible through this one.getTo()
This returns theNode
that the connections ends at.getWay()
This returns theWay
this connection belongs to.setLanes
(int lanes) Sets the number of lanes for this connection.setLength
(double length) Sets the connections length in meters.
-
Constructor Details
-
Connection
-
Connection
Default constructor.- Parameters:
id
- Unique identifier of the connection.way
- Way represents a number of edges in the network graph.isBackward
- if this connection represents the forward or backward direction of the way
-
-
Method Details
-
getId
Returns the ID of this connection.- Returns:
- Unique identifier of the connection.
-
getWay
This returns theWay
this connection belongs to.- Returns:
- The way of the connection.
-
getFrom
This returns theNode
the connection starts from.- Returns:
- Null if no from node exist, otherwise the node.
-
getTo
This returns theNode
that the connections ends at.- Returns:
- Null if no to node exist, otherwise the node.
-
getLanes
public int getLanes()Returns the number of lanes this Connection presents.- Returns:
- Number of the lanes.
-
getLength
public double getLength()This connections length in meters.- Returns:
- The length of the connection.
-
getMaxSpeedInKmh
public double getMaxSpeedInKmh()Gets the maximum speed allowed on this connection in km/h.- Returns:
- The speed in [km/h].
-
getMaxSpeedInMs
public double getMaxSpeedInMs()Gets the maximum speed allowed on this connection in m/s.- Returns:
- The speed in [m/s].
-
getNodes
These are theNode
s that are part of this connection. Beware that the order is important.- Returns:
- List of Nodes representing a connection.
-
getOutgoingConnections
Returns the connections that are accessible through this one.- Returns:
- List of accessible / upcoming connections.
-
getIncomingConnections
Returns the list of connections that lead into this connection..- Returns:
- List of incoming connections
-
setLength
Sets the connections length in meters.- Parameters:
length
- Length to set.
-
setLanes
Sets the number of lanes for this connection. This overrides eventual values copied from theWay
.- Parameters:
lanes
- Lanes to set.
-
addNode
Adds aNode
belonging to this connection. Be aware that the order of nodes is vital to the order of edges belonging to this connection.- Parameters:
node
- Node to add.
-
addNodes
Adds all givenNode
s belonging to this connection. Be aware that the order of nodes is vital to the order of edges belonging to this connection.- Parameters:
node
- Nodes to add.
-
addOutgoingConnection
Adds a connection that is accessible through this one.- Parameters:
connection
- Outgoing connection to add.
-
addIncomingConnection
Adds a connection through that this connection can be accessed.- Parameters:
connection
- Incoming connection to add.
-
applyTurnRestriction
This applies a turn restriction to the connection. Restrictions can be of type 'only' or 'not' which will cause the outgoing connections to be either trimmed down to the target or the target will be removed from the outgoing connections.- Parameters:
type
- either 'only' or 'not'target
- the connection
-