View Javadoc
1   package org.opentrafficsim.core.network.geotools;
2   
3   import org.opentrafficsim.core.network.AbstractNode;
4   import org.opentrafficsim.core.unit.AnglePlaneUnit;
5   import org.opentrafficsim.core.unit.AngleSlopeUnit;
6   import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
7   
8   import com.vividsolutions.jts.geom.Coordinate;
9   
10  /**
11   * <p>
12   * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
14   * <p>
15   * @version 11 Nov 2014 <br>
16   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
17   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
18   * @param <ID> Name of the node
19   */
20  public class NodeGeotools<ID> extends AbstractNode<ID, Coordinate>
21  {
22      /** */
23      private static final long serialVersionUID = 20150101L;
24  
25      /**
26       * Construct a new Node.
27       * @param id ID; the Id of the new Node
28       * @param coordinate P; the location of the new Node
29       */
30      public NodeGeotools(final ID id, final Coordinate coordinate)
31      {
32          super(id, coordinate);
33      }
34  
35      /**
36       * Construct a new Node.
37       * @param id ID; the Id of the new Node
38       * @param coordinate P; the location of the new Node
39       * @param direction the 3D direction. "East" is 0 degrees. "North" is 90 degrees (1/2 pi radians).
40       * @param slope the slope as an angle.
41       */
42      public NodeGeotools(final ID id, final Coordinate coordinate, final DoubleScalar.Abs<AnglePlaneUnit> direction,
43          final DoubleScalar.Abs<AngleSlopeUnit> slope)
44      {
45          super(id, coordinate, direction, slope);
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public final double getX()
51      {
52          return getPoint().x;
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      public final double getY()
58      {
59          return getPoint().y;
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public final double getZ()
65      {
66          return getPoint().z;
67      }
68  
69      /**
70       * String ID implementation of the Geotools node.
71       * <p>
72       * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. <br>
73       * All rights reserved. <br>
74       * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
75       * <p>
76       * @version Jan 4, 2015 <br>
77       * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
78       * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
79       */
80      public static class STR extends NodeGeotools<String>
81      {
82          /** */
83          private static final long serialVersionUID = 20150104L;
84  
85          /**
86           * @param id String id.
87           * @param coordinate the location of the Node.
88           */
89          public STR(final String id, final Coordinate coordinate)
90          {
91              super(id, coordinate);
92          }
93          
94          /**
95           * Construct a new Node.
96           * @param id ID; the String Id of the new Node
97           * @param coordinate P; the location of the new Node
98           * @param direction the 3D direction. "East" is 0 degrees. "North" is 90 degrees (1/2 pi radians).
99           * @param slope the slope as an angle.
100          */
101         public STR(final String id, final Coordinate coordinate, final DoubleScalar.Abs<AnglePlaneUnit> direction,
102             final DoubleScalar.Abs<AngleSlopeUnit> slope)
103         {
104             super(id, coordinate, direction, slope);
105         }
106     }
107 
108     /**
109      * Integer ID implementation of the Geotools node.
110      * <p>
111      * Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. <br>
112      * All rights reserved. <br>
113      * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
114      * <p>
115      * @version Jan 4, 2015 <br>
116      * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
117      * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
118      */
119     public static class INT extends NodeGeotools<Integer>
120     {
121         /** */
122         private static final long serialVersionUID = 20150104L;
123 
124         /**
125          * @param id Integer id.
126          * @param coordinate the location of the Node.
127          */
128         public INT(final int id, final Coordinate coordinate)
129         {
130             super(id, coordinate);
131         }
132 
133         /**
134          * Construct a new Node.
135          * @param id ID; the Integer Id of the new Node
136          * @param coordinate P; the location of the new Node
137          * @param direction the 3D direction. "East" is 0 degrees. "North" is 90 degrees (1/2 pi radians).
138          * @param slope the slope as an angle.
139          */
140         public INT(final int id, final Coordinate coordinate, final DoubleScalar.Abs<AnglePlaneUnit> direction,
141             final DoubleScalar.Abs<AngleSlopeUnit> slope)
142         {
143             super(id, coordinate, direction, slope);
144         }
145     }
146 
147 }