View Javadoc
1   package org.opentrafficsim.road.definitions;
2   
3   import org.djutils.immutablecollections.ImmutableMap;
4   import org.opentrafficsim.core.definitions.Definitions;
5   import org.opentrafficsim.road.network.lane.LaneType;
6   
7   /**
8    * The RoadDefinitions interface contains access to the core definitions that can be used to interpret the RoadNetwork and the
9    * RoadPerceivableContext. An example interface allows for the retrieval of LaneTypes.<br>
10   * <br>
11   * Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12   * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
13   * source code and binary code of this software is proprietary information of Delft University of Technology.
14   * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
15   */
16  public interface RoadDefinitions extends Definitions
17  {
18      /***************************************************************************************/
19      /************************************** LaneTypes **************************************/
20      /***************************************************************************************/
21  
22      /**
23       * Add the default LaneTypes that have been defined in the enum LaneType.DEFAULTS to the network. It is not necessary to
24       * call this method on every network; when the LaneTypes are for instance defined in an XML file, adding the default types
25       * might not be needed.
26       */
27      void addDefaultLaneTypes();
28  
29      /**
30       * Add a Lane type to the map. This method is automatically called from the LaneType constructor.
31       * @param laneType the LaneType to add
32       */
33      void addLaneType(LaneType laneType);
34  
35      /**
36       * Retrieve a defined LaneType based on its id.
37       * @param laneTypeId the id to search for
38       * @return the LaneType or null in case it could not be found
39       */
40      LaneType getLaneType(String laneTypeId);
41  
42      /**
43       * Retrieve a defined default LaneType based on its enum.
44       * @param laneTypeEnum the enum to search for
45       * @return the LaneType or null in case it could not be found
46       */
47      LaneType getLaneType(LaneType.DEFAULTS laneTypeEnum);
48  
49      /**
50       * Retrieve a safe copy of the map of defined LaneTypes in this network.
51       * @return the map of defined LaneTypes
52       */
53      ImmutableMap<String, LaneType> getLaneTypes();
54  }