View Javadoc
1   package org.opentrafficsim.animation.data;
2   
3   import org.djutils.draw.point.OrientedPoint2d;
4   import org.opentrafficsim.base.geometry.OtsBounds2d;
5   import org.opentrafficsim.core.network.Node;
6   import org.opentrafficsim.draw.network.NodeAnimation.NodeData;
7   
8   /**
9    * Animation data of a Node.
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 AnimationNodeData implements NodeData
17  {
18  
19      /** Node */
20      private final Node node;
21  
22      /**
23       * Constructor.
24       * @param node Node; node.
25       */
26      public AnimationNodeData(final Node node)
27      {
28          this.node = node;
29      }
30  
31      /** {@inheritDoc} */
32      @Override
33      public OtsBounds2d getBounds()
34      {
35          return this.node.getBounds();
36      }
37  
38      /** {@inheritDoc} */
39      @Override
40      public String getId()
41      {
42          return this.node.getId();
43      }
44  
45      /** {@inheritDoc} */
46      @Override
47      public OrientedPoint2d getLocation()
48      {
49          return this.node.getLocation();
50      }
51  
52      /**
53       * Returns the node.
54       * @return Node; node.
55       */
56      public Node getNode()
57      {
58          return this.node;
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      public String toString()
64      {
65          return "Node " + this.node.getId();
66      }
67  
68  }