View Javadoc
1   package org.opentrafficsim.animation.data;
2   
3   import org.djunits.value.vdouble.scalar.Speed;
4   import org.djutils.draw.point.OrientedPoint2d;
5   import org.opentrafficsim.base.geometry.OtsBounds2d;
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 SpeedSign; speed sign.
26       */
27      public AnimationSpeedSignData(final SpeedSign speedSign)
28      {
29          this.speedSign = speedSign;
30      }
31  
32      /** {@inheritDoc} */
33      @Override
34      public OrientedPoint2d getLocation()
35      {
36          return this.speedSign.getLocation();
37      }
38  
39      /** {@inheritDoc} */
40      @Override
41      public OtsBounds2d getBounds()
42      {
43          return this.speedSign.getBounds();
44      }
45  
46      /** {@inheritDoc} */
47      @Override
48      public Speed getSpeed()
49      {
50          return this.speedSign.getSpeed();
51      }
52  
53      /**
54       * Returns the speed sign.
55       * @return SpeedSign; speed sign.
56       */
57      public SpeedSign getSpeedSign()
58      {
59          return this.speedSign;
60      }
61  
62      /** {@inheritDoc} */
63      @Override
64      public String toString()
65      {
66          return "Speed sign " + this.speedSign.getId();
67      }
68  
69  }