1 package org.opentrafficsim.core.network.lane;
2
3 import java.rmi.RemoteException;
4 import java.util.ArrayList;
5 import java.util.List;
6
7 import javax.media.j3d.Bounds;
8
9 import nl.tudelft.simulation.language.d3.BoundingBox;
10 import nl.tudelft.simulation.language.d3.DirectedPoint;
11
12 import org.opentrafficsim.core.network.geotools.LinkGeotools;
13 import org.opentrafficsim.core.network.geotools.NodeGeotools;
14 import org.opentrafficsim.core.unit.FrequencyUnit;
15 import org.opentrafficsim.core.unit.LengthUnit;
16 import org.opentrafficsim.core.value.vdouble.scalar.DoubleScalar;
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public class CrossSectionLink<IDL, IDN> extends LinkGeotools<IDL, IDN>
31 {
32
33 private final List<CrossSectionElement> crossSectionElementList = new ArrayList<>();
34
35
36 private static final long serialVersionUID = 20141015L;
37
38
39
40
41
42
43
44
45
46 public CrossSectionLink(final IDL id, final NodeGeotools<IDN> startNode, final NodeGeotools<IDN> endNode,
47 final DoubleScalar.Rel<LengthUnit> length, final DoubleScalar.Abs<FrequencyUnit> capacity)
48 {
49 super(id, startNode, endNode, length, capacity);
50 }
51
52
53
54
55
56
57
58
59 public CrossSectionLink(final IDL id, final NodeGeotools<IDN> startNode, final NodeGeotools<IDN> endNode,
60 final DoubleScalar.Rel<LengthUnit> length)
61 {
62 super(id, startNode, endNode, length);
63 }
64
65
66
67
68
69
70 protected final void addCrossSectionElement(final CrossSectionElement cse)
71 {
72 this.crossSectionElementList.add(cse);
73 }
74
75
76
77
78
79
80
81 protected final void addCrossSectionElement(final CrossSectionElement cse, final int index)
82 {
83 this.crossSectionElementList.add(index, cse);
84 }
85
86
87
88
89 public final List<CrossSectionElement> getCrossSectionElementList()
90 {
91 return this.crossSectionElementList;
92 }
93
94
95 @Override
96 public final DirectedPoint getLocation() throws RemoteException
97 {
98 return getStartNode().getLocation();
99 }
100
101
102 @Override
103 public final Bounds getBounds() throws RemoteException
104 {
105 return new BoundingBox(getEndNode().getLocation().x - getStartNode().getLocation().x, getEndNode().getLocation().y
106 - getStartNode().getLocation().y, getEndNode().getLocation().z - getStartNode().getLocation().z);
107 }
108
109 }