1 /**
2 *
3 */
4 package org.opentrafficsim.water;
5
6 import java.io.Serializable;
7
8 import javax.vecmath.Point3d;
9
10 import org.locationtech.jts.geom.Coordinate;
11 import org.opentrafficsim.core.geometry.OTSPoint3D;
12
13 import nl.tudelft.simulation.dsol.animation.Locatable;
14 import nl.tudelft.simulation.language.d3.DirectedPoint;
15
16 /**
17 * A located object can report its location.
18 * <p>
19 * Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
20 * BSD-style license. See <a href="http://opentrafficsim.org/docs/current/license.html">OpenTrafficSim License</a>.
21 * </p>
22 * <p>
23 * Based on software from the IDVV project, which is Copyright (c) 2013 Rijkswaterstaat - Dienst Water, Verkeer en Leefomgeving
24 * and licensed without restrictions to Delft University of Technology, including the right to sub-license sources and derived
25 * products to third parties.
26 * </p>
27 * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
28 * initial version Nov 6, 2016 <br>
29 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
30 */
31 public interface Located extends Locatable, Serializable
32 {
33 /** @return the directed point */
34 @Override
35 DirectedPoint getLocation();
36
37 /** @return the GIS coordinate */
38 default Coordinate getCoordinate()
39 {
40 return new Coordinate(getLocation().x, getLocation().y);
41 }
42
43 /** @return the coordinate for DSOL 2D or 3D */
44 default Point3d getPoint3d()
45 {
46 return new Point3d(getLocation().x, getLocation().y, getLocation().z);
47 }
48
49 /** @return the coordinate for DSOL 2D or 3D */
50 default OTSPoint3D getOTSPoint3D()
51 {
52 return new OTSPoint3D(getLocation());
53 }
54
55 }