View Javadoc
1   package org.opentrafficsim.editor.extensions.map;
2   
3   import java.awt.Color;
4   
5   import org.opentrafficsim.draw.road.TrafficLightAnimation.TrafficLightData;
6   import org.opentrafficsim.editor.OtsEditor;
7   import org.opentrafficsim.editor.XsdTreeNode;
8   
9   /**
10   * Traffic light data for the editor Map.
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 MapTrafficLightData extends MapLaneBasedObjectData implements TrafficLightData
18  {
19  
20      /** */
21      private static final long serialVersionUID = 20240212L;
22  
23      /**
24       * Constructor.
25       * @param map Map; map.
26       * @param node XsdTreeNode; node Ots.Network.Link.TrafficLight.
27       * @param editor OtsEditor; editor.
28       */
29      public MapTrafficLightData(final EditorMap map, final XsdTreeNode node, final OtsEditor editor)
30      {
31          super(map, node, editor);
32          setLinkNode(getNode().getParent());
33      }
34  
35      /** {@inheritDoc} */
36      @Override
37      public Color getColor()
38      {
39          return Color.RED;
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public String toString()
45      {
46          return "Traffic light " + getId();
47      }
48  
49  }