View Javadoc
1   package org.opentrafficsim.road.network.lane;
2   
3   import java.io.Serializable;
4   
5   import javax.media.j3d.Bounds;
6   
7   import nl.tudelft.simulation.dsol.animation.LocatableInterface;
8   import nl.tudelft.simulation.language.d3.DirectedPoint;
9   
10  import org.djunits.value.vdouble.scalar.Length;
11  import org.opentrafficsim.core.gtu.RelativePosition;
12  import org.opentrafficsim.road.gtu.lane.LaneBasedGTU;
13  
14  /**
15   * <p>
16   * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
17   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
18   * <p>
19   * $LastChangedDate: 2015-09-14 01:33:02 +0200 (Mon, 14 Sep 2015) $, @version $Revision: 1401 $, by $Author: averbraeck $,
20   * initial version Dec 31, 2014 <br>
21   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
23   */
24  public interface Sensor extends Serializable, Comparable<Sensor>, LocatableInterface
25  {
26      /** @return The lane for which this is a sensor. */
27      Lane getLane();
28  
29      /** @return the position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane. */
30      Length.Rel getLongitudinalPosition();
31  
32      /** @return the position as a double in SI units for quick sorting and sensor triggering. */
33      double getLongitudinalPositionSI();
34  
35      /** @return the relative position type of the vehicle (e.g., FRONT, BACK) that triggers the sensor. */
36      RelativePosition.TYPE getPositionType();
37  
38      /**
39       * Trigger an action on the GTU. Normally this is the GTU that triggered the sensor. The typical call therefore is
40       * <code>sensor.trigger(this);</code>.
41       * @param gtu the GTU for which to carry out the trigger action.
42       */
43      void trigger(LaneBasedGTU gtu);
44  
45      /** @return The name of the sensor. */
46      String getName();
47  
48      /** {@inheritDoc} */
49      @Override
50      DirectedPoint getLocation();
51  
52      /** {@inheritDoc} */
53      @Override
54      Bounds getBounds();
55  
56  }