Package hec.map

Class MapMouseAdapter

java.lang.Object
hec.map.MapMouseAdapter
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener
Direct Known Subclasses:
AnnotationTool, ElevationAdapter, IconMouseAdapter, ImageMouseAdapter, MousePanAdapter, MouseZoomAdapter, NetTinAdapter, PointerMouseAdapter, ShapeQueryMouseAdapter, ShapeStreamAlignmentMouseAdapter, StreamAlignmentAdapter, StreamNodeAdapter, TinDepthAdapter

public class MapMouseAdapter extends Object implements MouseListener, MouseMotionListener
Base class for Mouse Adapters for MapCanvas.
See Also:
  • Field Details

    • _mapCanvas

      protected MapCanvas _mapCanvas
      the MapCanvas that this adapter belongs to
    • _mapPanel

      protected MapPanel _mapPanel
      the MapPanel that this adapter belongs to
    • _strbuf

      protected StringBuffer _strbuf
      buffer used to create the message for the default mouseMoved event
  • Constructor Details

    • MapMouseAdapter

      public MapMouseAdapter(MapPanel panel, MapCanvas canvas)
      Create a new MapMouseAdapter object
      Parameters:
      panel - The MapPanel
      canvas - The MapCanvas
  • Method Details

    • buildDefaultButtonGifStrings

      public static ButtonGifStrings buildDefaultButtonGifStrings()
      return a new ButtonGifStrings object
      Returns:
      a new ButtonGifStrings object
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      called when the mouse is released. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      e - the MouseEvent
    • mousePressed

      public void mousePressed(MouseEvent e)
      called when the mouse is Pressed. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e - the MouseEvent
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      called when the mouse is Pressed. This method translates the current mouse coordinates into world coordinates and tells the MapPanel to display the information This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Parameters:
      e - the MouseEvent
    • mouseExited

      public void mouseExited(MouseEvent e)
      called when the mouse exits this object. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      e - The MouseEvent
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      called when the mouse enters this object. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      e - the MouseEvent
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      called when the mouse is dragged. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseDragged in interface MouseMotionListener
      Parameters:
      e - the MouseEvent
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      called when the mouse is clicked. This method is expected to be overridden by subclasses that are interested in this event.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      e - the MouseEvent
    • init

      public void init()
      called when this MouseAdapter is made the active adapter. Sub classes should do any initialization that they need done here.
    • abort

      public void abort()
      called when this MouseAdapter is made no longer the active adapter. Sub classes should do any cleanup that they need done here.
    • pressedButton1

      public static boolean pressedButton1(MouseEvent e)
      checks to see if the MouseEvent e's Button 1 is pressed
      Parameters:
      e - the MouseEvent
      Returns:
      true if e's Button 1 is pressed
    • pressedButton2

      public static boolean pressedButton2(MouseEvent e)
      checks to see if the MouseEvent e's Button 2 is pressed
      Parameters:
      e - the MouseEvent
      Returns:
      true if e's Button 2 is pressed
    • pressedButton3

      public static boolean pressedButton3(MouseEvent e)
      checks to see if the MouseEvent e's Button 3 is pressed
      Parameters:
      e - the MouseEvent
      Returns:
      true if e's Button 3 is pressed
    • getCursor

      public Cursor getCursor()
      Gets the Cursor that should be displayed when this mouse adapter is active. By default it returns java.awt.Cursor.getDefaultCursor()
      Returns:
      the Cursor to use for this adapter
    • getWorldPt

      public WorldPt getWorldPt(Point point)
      get the WorldPt from the Point (usually from a MouseEvent)
      Parameters:
      point - a Point
      Returns:
      an invalid WorldPt if point is null or the MapPanel is null, a valid WorldPt otherwise
    • getWorldPt

      public WorldPt getWorldPt(Point point, WorldPt wpt)
      get the WorldPt from the Point (usually from a MouseEvent)
      Parameters:
      point - a java.awt.Point
      wpt - the WorldPt to initialize to
      Returns:
      an invalid WorldPt if point is null or the MapPanel is null, a valid WorldPt otherwise