View Javadoc
1   package org.opentrafficsim.editor.extensions.map;
2   
3   import org.djutils.draw.line.PolyLine2d;
4   import org.djutils.draw.line.Polygon2d;
5   import org.opentrafficsim.draw.road.LaneAnimation.LaneData;
6   import org.opentrafficsim.editor.XsdTreeNode;
7   import org.opentrafficsim.road.network.lane.SliceInfo;
8   
9   /**
10   * Lane data for in the editor.
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 MapLaneData extends MapCrossSectionData implements LaneData
18  {
19  
20      /** Id. */
21      private final String id;
22  
23      /**
24       * Constructor.
25       * @param id String; id.
26       * @param linkNode XsdTreeNode; node representing the element.
27       * @param centerLine PolyLine2d; center line.
28       * @param contour PolyLine2d; contour.
29       * @param sliceInfo SliceInfo; slice info.
30       */
31      public MapLaneData(final String id, final XsdTreeNode linkNode, final PolyLine2d centerLine, final Polygon2d contour,
32              final SliceInfo sliceInfo)
33      {
34          super(linkNode, centerLine, contour, sliceInfo);
35          this.id = id;
36      }
37  
38      /** {@inheritDoc} */
39      @Override
40      public String getId()
41      {
42          return this.id;
43      }
44  
45      /** {@inheritDoc} */
46      @Override
47      public PolyLine2d getCenterLine()
48      {
49          return this.centerLine;
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      public String toString()
55      {
56          return "Lane " + getLinkId() + "." + this.id;
57      }
58  
59  }