View Javadoc
1   package org.opentrafficsim.animation.data;
2   
3   import org.djunits.value.vdouble.scalar.Speed;
4   import org.djutils.draw.line.Polygon2d;
5   import org.djutils.draw.point.OrientedPoint2d;
6   import org.opentrafficsim.draw.road.SpeedSignAnimation.SpeedSignData;
7   import org.opentrafficsim.road.network.lane.object.SpeedSign;
8   
9   /**
10   * Animation data of a SpeedSign.
11   * <p>
12   * Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
13   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
14   * </p>
15   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
16   */
17  public class AnimationSpeedSignData implements SpeedSignData
18  {
19  
20      /** Speed sign. */
21      private final SpeedSign speedSign;
22  
23      /**
24       * Constructor.
25       * @param speedSign speed sign.
26       */
27      public AnimationSpeedSignData(final SpeedSign speedSign)
28      {
29          this.speedSign = speedSign;
30      }
31  
32      @Override
33      public OrientedPoint2d getLocation()
34      {
35          return this.speedSign.getLocation();
36      }
37  
38      @Override
39      public Polygon2d getContour()
40      {
41          return this.speedSign.getContour();
42      }
43  
44      @Override
45      public Speed getSpeed()
46      {
47          return this.speedSign.getSpeed();
48      }
49  
50      /**
51       * Returns the speed sign.
52       * @return speed sign.
53       */
54      public SpeedSign getSpeedSign()
55      {
56          return this.speedSign;
57      }
58  
59      @Override
60      public String toString()
61      {
62          return "Speed sign " + this.speedSign.getId();
63      }
64  
65  }