Class EditorMap

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Remote, EventListener, Accessible, org.djutils.event.EventListener

public class EditorMap extends JPanel implements org.djutils.event.EventListener
Editor map.

Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
See Also:
  • Method Details

    • addToggle

      public final void addToggle(String name, Class<? extends nl.tudelft.simulation.dsol.animation.Locatable> locatableClass, String iconPath, String toolTipText, boolean initiallyVisible, boolean idButton)
      Add a button for toggling an animatable class on or off. Button icons for which 'idButton' is true will be placed to the right of the previous button, which should be the corresponding button without the id. An example is an icon for showing/hiding the class 'Lane' followed by the button to show/hide the Lane ids.
      Parameters:
      name - String; the name of the button
      locatableClass - Class<? extends Locatable>; the class for which the button holds (e.g., GTU.class)
      iconPath - String; the path to the 24x24 icon to display
      toolTipText - String; the tool tip text to show when hovering over the button
      initiallyVisible - boolean; whether the class is initially shown or not
      idButton - boolean; id button that needs to be placed next to the previous button
    • build

      public static EditorMap build(OtsEditor editor) throws RemoteException, NamingException
      Builds a map panel with an animator and context.
      Parameters:
      editor - OtsEditor; editor.
      Returns:
      Map; map.
      Throws:
      RemoteException - context binding problem.
      NamingException - context binding problem.
    • notify

      public void notify(org.djutils.event.Event event) throws RemoteException
      Specified by:
      notify in interface org.djutils.event.EventListener
      Throws:
      RemoteException
    • setValid

      public void setValid(MapData data)
      Set the data as being valid to draw.
      Parameters:
      data - MapData; data that is valid to draw.
    • setInvalid

      public void setInvalid(MapData data)
      Set the data as being invalid to draw.
      Parameters:
      data - MapData; data that is invalid to draw.
    • reinitialize

      public void reinitialize(XsdTreeNode node)
      Reinitialize animation on object who's animator stores static information that depends on something that was changed. This will create a new animation object. Only data objects that know their animations have static data, should call this. And only when information changed on which the static data depends.
      Parameters:
      node - XsdTreeNode; node.
    • getData

      public MapData getData(XsdTreeNode node)
      Returns the map data of the given XSD node.
      Parameters:
      node - XsdTreeNode; node.
      Returns:
      MapData; map data of the given XSD node, null if no such data.
    • getRoadLayoutListener

      RoadLayoutListener getRoadLayoutListener(XsdTreeNode node)
      Returns the road layout listener from which a MapLinkData can obtain offsets.
      Parameters:
      node - XsdTreeNode; node of a defined layout.
      Returns:
      RoadLayoutListener; listener, can be used to obtain offsets.
    • removeAnimation

      void removeAnimation(nl.tudelft.simulation.dsol.animation.d2.Renderable2d<?> animation)
      Remove animation.
      Parameters:
      animation - Renderable2d<?>; animation to remove.
    • getContextualized

      nl.tudelft.simulation.naming.context.Contextualized getContextualized()
      Returns the context.
      Returns:
      Contextualized; context.
    • getNetworkFlattener

      public org.opentrafficsim.core.geometry.Flattener getNetworkFlattener()
      Returns the network level flattener, or a 64 segment flattener of none specified.
      Returns:
      Flattener; flattener.