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