View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import org.djunits.value.vdouble.scalar.Direction;
4   import org.opentrafficsim.core.geometry.OTSPoint3D;
5   import org.opentrafficsim.core.network.Network;
6   import org.opentrafficsim.core.network.NetworkException;
7   import org.opentrafficsim.core.network.OTSNode;
8   
9   import nl.tudelft.simulation.language.d3.DirectedPoint;
10  
11  /**
12   * The Node is a point with an id and a direction. It is used in the network to connect Links.
13   * <p>
14   * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
15   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
16   * <p>
17   * $LastChangedDate: 2019-04-25 17:00:14 +0200 (Thu, 25 Apr 2019) $, @version $Revision: 5424 $, by $Author: pknoppers $,
18   * initial version May 5, 2019 <br>
19   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
20   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
21   * @author <a href="http://www.citg.tudelft.nl">Guus Tamminga</a>
22   */
23  public class OTSRoadNode extends OTSNode
24  {
25      /** ... */
26      private static final long serialVersionUID = 20190528L;
27  
28      /** Direction of traffic at this node. */
29      private final Direction direction;
30  
31      /**
32       * Construct a new OTSRoadNode.
33       * @param network Network; the network
34       * @param id String; name of the node
35       * @param point OTSPoint3D location of the node
36       * @param direction Direction; driving direction at the node
37       * @throws NetworkException if node already exists in the network, or if name of the node is not unique.
38       */
39      public OTSRoadNode(final Network network, final String id, final OTSPoint3D point, final Direction direction)
40              throws NetworkException
41      {
42          super(network, id, point);
43          this.direction = direction;
44      }
45  
46      @Override
47      public final DirectedPoint getLocation()
48      {
49          OTSPoint3D p = getPoint();
50          return new DirectedPoint(p.x, p.y, p.z, 0, 0, this.direction.si);
51      }
52      
53  }