Package org.opentrafficsim.road.network
Class OTSRoadNetwork
java.lang.Object
org.djutils.event.EventProducer
org.opentrafficsim.core.network.OTSNetwork
org.opentrafficsim.road.network.OTSRoadNetwork
- All Implemented Interfaces:
java.io.Serializable
,EventProducerInterface
,Identifiable
,Definitions
,Network
,PerceivableContext
,RoadDefinitions
,RoadNetwork
public class OTSRoadNetwork extends OTSNetwork implements RoadNetwork
OTSRoadNetwork adds a number of methods to the Network class that are specific for roads, such as the LaneTypes.
Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
Fields inherited from interface org.opentrafficsim.core.network.Network
ANIMATION_GENERATOR_ADD_EVENT, ANIMATION_GENERATOR_REMOVE_EVENT, ANIMATION_GTU_ADD_EVENT, ANIMATION_GTU_REMOVE_EVENT, ANIMATION_INVISIBLE_OBJECT_ADD_EVENT, ANIMATION_INVISIBLE_OBJECT_REMOVE_EVENT, ANIMATION_LINK_ADD_EVENT, ANIMATION_LINK_REMOVE_EVENT, ANIMATION_NODE_ADD_EVENT, ANIMATION_NODE_REMOVE_EVENT, ANIMATION_OBJECT_ADD_EVENT, ANIMATION_OBJECT_REMOVE_EVENT, ANIMATION_ROUTE_ADD_EVENT, ANIMATION_ROUTE_REMOVE_EVENT, GENERATOR_ADD_EVENT, GENERATOR_REMOVE_EVENT, GTU_ADD_EVENT, GTU_REMOVE_EVENT, INVISIBLE_OBJECT_ADD_EVENT, INVISIBLE_OBJECT_REMOVE_EVENT, LINK_ADD_EVENT, LINK_REMOVE_EVENT, NODE_ADD_EVENT, NODE_REMOVE_EVENT, OBJECT_ADD_EVENT, OBJECT_REMOVE_EVENT, ROUTE_ADD_EVENT, ROUTE_REMOVE_EVENT
-
Constructor Summary
Constructors Constructor Description OTSRoadNetwork(java.lang.String id, boolean addDefaultTypes)
Construction of an empty network. -
Method Summary
Modifier and Type Method Description void
addDefaultLaneTypes()
Add the default LaneTypes that have been defined in the enum LaneType.DEFAULTS to the network.void
addLaneType(LaneType laneType)
Add a Lane type to the map.LaneType
getLaneType(java.lang.String laneTypeId)
Retrieve a defined LaneType based on its id.LaneType
getLaneType(LaneType.DEFAULTS laneTypeEnum)
Retrieve a defined default LaneType based on its enum.ImmutableMap<java.lang.String,LaneType>
getLaneTypes()
Retrieve a safe copy of the map of defined LaneTypes in this network.Methods inherited from class org.opentrafficsim.core.network.OTSNetwork
addDefaultGtuTypes, addDefaultLinkTypes, addGTU, addGtuType, addInvisibleObject, addLink, addLinkType, addNode, addObject, addRoute, buildGraph, containsGTU, containsGtuId, containsInvisibleObject, containsInvisibleObject, containsLink, containsLink, containsNode, containsNode, containsObject, containsObject, containsRoute, containsRoute, getDefinedRouteMap, getExtent, getGTU, getGTUs, getGtuType, getGtuType, getGtuTypes, getId, getInvisibleObjectMap, getInvisibleObjectMap, getLink, getLink, getLink, getLinkGraphs, getLinkMap, getLinkType, getLinkType, getLinkTypes, getNode, getNodeMap, getObject, getObjectMap, getObjectMap, getRoute, getRoute, getRouteMap, getRoutesBetween, getShortestRouteBetween, getShortestRouteBetween, getShortestRouteBetween, getSourceId, getUnbalancedCentroids, removeGTU, removeInvisibleObject, removeLink, removeNode, removeObject, removeRoute, setRawRouteMap, toString
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, getEventTypesWithListeners, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opentrafficsim.core.definitions.Definitions
addDefaultGtuTypes, addDefaultLinkTypes, addGtuType, addLinkType, getGtuType, getGtuType, getGtuTypes, getLinkType, getLinkType, getLinkTypes
Methods inherited from interface org.djutils.event.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, getSourceId, hasListeners, numberOfListeners, removeListener
Methods inherited from interface org.opentrafficsim.core.network.Network
addInvisibleObject, addLink, addNode, addObject, addRoute, buildGraph, containsInvisibleObject, containsInvisibleObject, containsLink, containsLink, containsNode, containsNode, containsObject, containsObject, containsRoute, containsRoute, getDefinedRouteMap, getId, getInvisibleObjectMap, getInvisibleObjectMap, getLink, getLink, getLink, getLinkMap, getNode, getNodeMap, getObject, getObjectMap, getObjectMap, getRoute, getRoutesBetween, getShortestRouteBetween, getShortestRouteBetween, getShortestRouteBetween, getShortestRouteBetween, removeInvisibleObject, removeLink, removeNode, removeObject, removeRoute
Methods inherited from interface org.opentrafficsim.core.perception.PerceivableContext
addGTU, containsGTU, containsGtuId, getGTU, getGTUs, getId, removeGTU
-
Constructor Details
-
OTSRoadNetwork
public OTSRoadNetwork(java.lang.String id, boolean addDefaultTypes)Construction of an empty network.- Parameters:
id
- String; the network id.addDefaultTypes
- add the default GTUTypes, LinkTypesand LaneTypes, or not
-
-
Method Details
-
addDefaultLaneTypes
public void addDefaultLaneTypes()Add the default LaneTypes that have been defined in the enum LaneType.DEFAULTS to the network. It is not necessary to call this method on every network; when the LaneTypes are for instance defined in an XML file, adding the default types might not be needed.- Specified by:
addDefaultLaneTypes
in interfaceRoadDefinitions
-
addLaneType
Add a Lane type to the map. This method is automatically called from the LaneType constructor.- Specified by:
addLaneType
in interfaceRoadDefinitions
- Parameters:
laneType
- the LaneType to add
-
getLaneType
Retrieve a defined LaneType based on its id.- Specified by:
getLaneType
in interfaceRoadDefinitions
- Parameters:
laneTypeId
- the id to search for- Returns:
- the LaneType or null in case it could not be found
-
getLaneType
Retrieve a defined default LaneType based on its enum.- Specified by:
getLaneType
in interfaceRoadDefinitions
- Parameters:
laneTypeEnum
- the enum to search for- Returns:
- the LaneType or null in case it could not be found
-
getLaneTypes
Retrieve a safe copy of the map of defined LaneTypes in this network.- Specified by:
getLaneTypes
in interfaceRoadDefinitions
- Returns:
- the map of defined LaneTypes
-