Class MapVisualizationPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
org.opentrafficsim.editor.extensions.map.MapVisualizationPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, EventListener, EventProducer

public class MapVisualizationPanel extends nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
Visualization panel to show the map. This implementation has an adaptive grid color, fixed grid drawing imprecision, and makes certain methods accessible.

Copyright (c) 2026-2026 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:
  • Field Details

    • EXTENT_CHANGED

      public static final EventType EXTENT_CHANGED
      Event when extent changed.
  • Constructor Details

    • MapVisualizationPanel

      public MapVisualizationPanel(Bounds2d homeExtent, EventProducer producer, nl.tudelft.simulation.naming.context.ContextInterface context) throws RemoteException, NamingException
      Constructor.
      Parameters:
      homeExtent - the initial extent
      producer - the object firing animation update events
      context - the context that contains the drawing objects
      Throws:
      RemoteException - on error when remote panel and producer cannot connect
      NamingException - on context error
  • Method Details

    • setBackground

      public void setBackground(Color bg)
      Overrides:
      setBackground in class JComponent
    • drawGrid

      protected void drawGrid(Graphics g)
      Overrides:
      drawGrid in class nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
    • pxScale

      public double pxScale()
      Returns the current world size of 1px.
      Returns:
      current world size of 1px
    • setExtent

      public void setExtent(Bounds2d extent)
      Overrides:
      setExtent in class nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
    • pan

      public void pan(Point2D mouseClickedPoint, Point2D mouseReleasedPoint)
      Overrides:
      pan in class nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
    • getSelectedObjects

      public List<nl.tudelft.simulation.dsol.animation.Locatable> getSelectedObjects(Point2D mousePoint)
      Overrides:
      getSelectedObjects in class nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel
    • getSelectedObject

      public Object getSelectedObject(List<nl.tudelft.simulation.dsol.animation.Locatable> targets)
      Overrides:
      getSelectedObject in class nl.tudelft.simulation.dsol.swing.animation.d2.VisualizationPanel