1 package org.opentrafficsim.water.network;
2
3 import java.io.Serializable;
4 import java.rmi.RemoteException;
5
6 import javax.media.j3d.BoundingSphere;
7 import javax.media.j3d.Bounds;
8
9 import org.djunits.value.vdouble.scalar.Length;
10 import org.opentrafficsim.core.geometry.OTSGeometryException;
11
12 import nl.tudelft.simulation.dsol.animation.Locatable;
13 import nl.tudelft.simulation.language.Throw;
14 import nl.tudelft.simulation.language.d3.DirectedPoint;
15
16
17
18
19
20
21
22
23
24
25 public class WaterwayLocation implements Locatable, Serializable
26 {
27
28 private static final long serialVersionUID = 20161106L;
29
30
31 private final Waterway waterway;
32
33
34 private final Length position;
35
36
37 private final DirectedPoint location;
38
39
40
41
42
43
44 public WaterwayLocation(final Waterway waterway, final Length position) throws OTSGeometryException
45 {
46 Throw.whenNull(waterway, "waterway cannot be null");
47 Throw.whenNull(position, "position cannot be null");
48 this.waterway = waterway;
49 this.position = position;
50 this.location = waterway.getDesignLine().getLocation(position);
51 }
52
53
54
55
56 public final Waterway getWaterway()
57 {
58 return this.waterway;
59 }
60
61
62
63
64 public final Length getPosition()
65 {
66 return this.position;
67 }
68
69
70 @Override
71 public final DirectedPoint getLocation() throws RemoteException
72 {
73 return this.location;
74 }
75
76
77 @Override
78 public final Bounds getBounds() throws RemoteException
79 {
80 return new BoundingSphere();
81 }
82
83 }