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