public final class LaneFactory extends Object
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-09-16 19:20:07 +0200 (Wed, 16 Sep 2015) $, @version $Revision: 1405 $, by $Author: averbraeck $,
initial version 30 okt. 2014
Constructor and Description |
---|
LaneFactory(OTSNetwork network,
OTSNode from,
OTSNode to,
LinkType type,
OTSSimulatorInterface simulator,
LaneKeepingPolicy policy) |
LaneFactory(OTSNetwork network,
OTSNode from,
OTSNode to,
LinkType type,
OTSSimulatorInterface simulator,
LaneKeepingPolicy policy,
OTSLine3D line) |
Modifier and Type | Method and Description |
---|---|
LaneFactory |
addLanes(Stripe.Permeable... permeable)
Adds a lane pair for each permeable, where the permeable determines the right-hand side line when building from left to
right and vice versa.
|
LaneFactory |
addShoulder(Length width,
LateralDirectionality lat)
Adds 1 or 2 shoulders to the current set of lanes.
|
List<Lane> |
getLanes()
Returns the created lanes in build order.
|
LaneFactory |
leftToRight(double leftLanes,
Length laneWidth,
LaneType laneType,
Speed speedLimit)
Prepare the factory to add lanes from left to right.
|
static OTSLine3D |
makeBezier(OTSNode n1,
OTSNode n2,
OTSNode n3,
OTSNode n4) |
static Lane |
makeLane(Network network,
String name,
OTSNode from,
OTSNode to,
OTSPoint3D[] intermediatePoints,
LaneType laneType,
Speed speedLimit,
OTSSimulatorInterface simulator)
Create a simple Lane.
|
static CrossSectionLink |
makeLink(Network network,
String name,
Node from,
Node to,
OTSPoint3D[] intermediatePoints,
OTSSimulatorInterface simulator)
Create a Link along intermediate coordinates from one Node to another.
|
static Lane[] |
makeMultiLane(Network network,
String name,
OTSNode from,
OTSNode to,
OTSPoint3D[] intermediatePoints,
int laneCount,
int laneOffsetAtStart,
int laneOffsetAtEnd,
LaneType laneType,
Speed speedLimit,
OTSSimulatorInterface simulator)
Create a simple road with the specified number of Lanes.
This method returns an array of Lane. |
static Lane[] |
makeMultiLane(Network network,
String name,
OTSNode from,
OTSNode to,
OTSPoint3D[] intermediatePoints,
int laneCount,
LaneType laneType,
Speed speedLimit,
OTSSimulatorInterface simulator)
Create a simple road with the specified number of Lanes.
This method returns an array of Lane. |
static Lane[] |
makeMultiLaneBezier(Network network,
String name,
OTSNode n1,
OTSNode n2,
OTSNode n3,
OTSNode n4,
int laneCount,
int laneOffsetAtStart,
int laneOffsetAtEnd,
LaneType laneType,
Speed speedLimit,
OTSSimulatorInterface simulator)
Create a simple road with the specified number of Lanes, based on a Bezier curve.
This method returns an array of Lane. |
LaneFactory |
rightToLeft(double rightLanes,
Length laneWidth,
LaneType laneType,
Speed speedLimit)
Prepare the factory to add lanes from right to left.
|
public LaneFactory(OTSNetwork network, OTSNode from, OTSNode to, LinkType type, OTSSimulatorInterface simulator, LaneKeepingPolicy policy) throws OTSGeometryException, NetworkException
network
- OTSNetwork; networkfrom
- OTSNode; from nodeto
- OTSNode; to nodetype
- LinkType; link typesimulator
- OTSSimulatorInterface; simulatorpolicy
- LaneKeepingPolicy; lane keeping policyOTSGeometryException
- if no valid line can be createdNetworkException
- if the link exists, or a node does not exist, in the networkpublic LaneFactory(OTSNetwork network, OTSNode from, OTSNode to, LinkType type, OTSSimulatorInterface simulator, LaneKeepingPolicy policy, OTSLine3D line) throws NetworkException
network
- OTSNetwork; networkfrom
- OTSNode; from nodeto
- OTSNode; to nodetype
- LinkType; link typesimulator
- OTSSimulatorInterface; simulatorpolicy
- LaneKeepingPolicy; lane keeping policyline
- OTSLine3D; lineNetworkException
- if the link exists, or a node does not exist, in the networkpublic LaneFactory leftToRight(double leftLanes, Length laneWidth, LaneType laneType, Speed speedLimit)
leftLanes
- double; number of lanes left from the link design linelaneWidth
- Length; lane widthlaneType
- LaneType; lane typespeedLimit
- Speed; speed limitpublic LaneFactory rightToLeft(double rightLanes, Length laneWidth, LaneType laneType, Speed speedLimit)
rightLanes
- double; number of lanes right from the link design linelaneWidth
- Length; lane widthlaneType
- LaneType; lane typespeedLimit
- Speed; speed limitpublic LaneFactory addLanes(Stripe.Permeable... permeable)
leftToRight()
, meaning that each permeable describes
permeablility between a lane and it's right-hand neighbor, when building left to right (and vice versa). For no allowed
lane changes use null
. This method internally adds null
to create the final continuous stripe.permeable
- Permeable...; permeable per lane pair, for N lanes N-1 should be providedpublic LaneFactory addShoulder(Length width, LateralDirectionality lat)
width
- Length; width of the shoulderlat
- LateralDirectionality; side of shoulder, use null
or NONE
for bothIllegalStateException
- if no lanes are definedpublic List<Lane> getLanes()
public static CrossSectionLink makeLink(Network network, String name, Node from, Node to, OTSPoint3D[] intermediatePoints, OTSSimulatorInterface simulator) throws OTSGeometryException, NetworkException
network
- Network; the networkname
- String; name of the new Linkfrom
- Node; start Node of the new Linkto
- Node; end Node of the new LinkintermediatePoints
- OTSPoint3D[]; array of intermediate coordinates (may be null); the intermediate points may
contain the coordinates of the from node and to nodesimulator
- OTSSimulatorInterface; the simulator for this networkOTSGeometryException
- when the design line is degenerate (only one point or duplicate point)NetworkException
- if link already exists in the network, if name of the link is not unique, or if the start node
or the end node of the link are not registered in the network.public static Lane makeLane(Network network, String name, OTSNode from, OTSNode to, OTSPoint3D[] intermediatePoints, LaneType laneType, Speed speedLimit, OTSSimulatorInterface simulator) throws NetworkException, OTSGeometryException
network
- Network; the networkname
- String; name of the Lane (and also of the Link that owns it)from
- OTSNode; starting node of the new Laneto
- OTSNode; ending node of the new LaneintermediatePoints
- OTSPoint3D[]; intermediate coordinates or null to create a straight road; the intermediate
points may contain the coordinates of the from node and to nodelaneType
- LaneType; type of the new LanespeedLimit
- Speed; the speed limit on the new Lanesimulator
- OTSSimulatorInterface; the simulatorNetworkException
- on network inconsistencyOTSGeometryException
- when creation of center line or contour failspublic static Lane[] makeMultiLane(Network network, String name, OTSNode from, OTSNode to, OTSPoint3D[] intermediatePoints, int laneCount, int laneOffsetAtStart, int laneOffsetAtEnd, LaneType laneType, Speed speedLimit, OTSSimulatorInterface simulator) throws NetworkException, OTSGeometryException
network
- Network; the networkname
- String; name of the Linkfrom
- OTSNode; starting node of the new Laneto
- OTSNode; ending node of the new LaneintermediatePoints
- OTSPoint3D[]; intermediate coordinates or null to create a straight road; the intermediate
points may contain the coordinates of the from node and to nodelaneCount
- int; number of lanes in the roadlaneOffsetAtStart
- int; extra offset from design line in lane widths at start of linklaneOffsetAtEnd
- int; extra offset from design line in lane widths at end of linklaneType
- LaneType; type of the new LanesspeedLimit
- Speed; the speed limit on all lanessimulator
- OTSSimulatorInterface; the simulatorNetworkException
- on topological problemsOTSGeometryException
- when creation of center line or contour failspublic static Lane[] makeMultiLane(Network network, String name, OTSNode from, OTSNode to, OTSPoint3D[] intermediatePoints, int laneCount, LaneType laneType, Speed speedLimit, OTSSimulatorInterface simulator) throws NamingException, NetworkException, OTSGeometryException
network
- Network; the networkname
- String; name of the Linkfrom
- OTSNode; starting node of the new Laneto
- OTSNode; ending node of the new LaneintermediatePoints
- OTSPoint3D[]; intermediate coordinates or null to create a straight road; the intermediate
points may contain the coordinates of the from node and to nodelaneCount
- int; number of lanes in the roadlaneType
- LaneType; type of the new LanesspeedLimit
- Speed; Speed the speed limit (applies to all generated lanes)simulator
- OTSSimulatorInterface; the simulatorNamingException
- when names cannot be registered for animationNetworkException
- on topological problemsOTSGeometryException
- when creation of center line or contour failspublic static Lane[] makeMultiLaneBezier(Network network, String name, OTSNode n1, OTSNode n2, OTSNode n3, OTSNode n4, int laneCount, int laneOffsetAtStart, int laneOffsetAtEnd, LaneType laneType, Speed speedLimit, OTSSimulatorInterface simulator) throws NamingException, NetworkException, OTSGeometryException
network
- Network; the networkname
- String; name of the Linkn1
- OTSNode; control node for the start directionn2
- OTSNode; starting node of the new Lanen3
- OTSNode; ending node of the new Lanen4
- OTSNode; control node for the end directionlaneCount
- int; number of lanes in the roadlaneOffsetAtStart
- int; extra offset from design line in lane widths at start of linklaneOffsetAtEnd
- int; extra offset from design line in lane widths at end of linklaneType
- LaneType; type of the new LanesspeedLimit
- Speed; the speed limit on all lanessimulator
- OTSSimulatorInterface; the simulatorNamingException
- when names cannot be registered for animationNetworkException
- on topological problemsOTSGeometryException
- when creation of center line or contour failspublic static OTSLine3D makeBezier(OTSNode n1, OTSNode n2, OTSNode n3, OTSNode n4) throws OTSGeometryException
n1
- OTSNode; node 1n2
- OTSNode; node 2n3
- OTSNode; node 3n4
- OTSNode; node 4OTSGeometryException
- on failure of Bezier curve creationCopyright © 2014–2019 Delft University of Technology. All rights reserved.