View Javadoc
1   package org.opentrafficsim.animation.data;
2   
3   import org.djutils.draw.line.PolyLine2d;
4   import org.opentrafficsim.draw.road.LaneAnimation.LaneData;
5   import org.opentrafficsim.road.network.lane.Lane;
6   
7   /**
8    * Animation data of a Lane.
9    * <p>
10   * Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12   * </p>
13   * @author <a href="https://github.com/wjschakel">Wouter Schakel</a>
14   */
15  public class AnimationLaneData extends AnimationCrossSectionElementData<Lane> implements LaneData
16  {
17  
18      /**
19       * Constructor.
20       * @param lane Lane; lane.
21       */
22      public AnimationLaneData(final Lane lane)
23      {
24          super(lane);
25      }
26  
27      /** {@inheritDoc} */
28      @Override
29      public String getId()
30      {
31          return getElement().getId();
32      }
33  
34      /** {@inheritDoc} */
35      @Override
36      public PolyLine2d getCenterLine()
37      {
38          return getElement().getCenterLine().getLine2d();
39      }
40  
41      /** {@inheritDoc} */
42      @Override
43      public String getLinkId()
44      {
45          return getElement().getLink().getId();
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public String toString()
51      {
52          return "Lane " + getElement().getFullId();
53      }
54  
55  }