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.
Author:
Alexander Verbraeck
See Also:
Serialized Form
  • 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 interface RoadDefinitions
    • addLaneType

      public void addLaneType​(LaneType laneType)
      Add a Lane type to the map. This method is automatically called from the LaneType constructor.
      Specified by:
      addLaneType in interface RoadDefinitions
      Parameters:
      laneType - the LaneType to add
    • getLaneType

      public LaneType getLaneType​(java.lang.String laneTypeId)
      Retrieve a defined LaneType based on its id.
      Specified by:
      getLaneType in interface RoadDefinitions
      Parameters:
      laneTypeId - the id to search for
      Returns:
      the LaneType or null in case it could not be found
    • getLaneType

      public LaneType getLaneType​(LaneType.DEFAULTS laneTypeEnum)
      Retrieve a defined default LaneType based on its enum.
      Specified by:
      getLaneType in interface RoadDefinitions
      Parameters:
      laneTypeEnum - the enum to search for
      Returns:
      the LaneType or null in case it could not be found
    • getLaneTypes

      public ImmutableMap<java.lang.String,​LaneType> getLaneTypes()
      Retrieve a safe copy of the map of defined LaneTypes in this network.
      Specified by:
      getLaneTypes in interface RoadDefinitions
      Returns:
      the map of defined LaneTypes