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
Base class for Mouse Adapters for MapCanvas.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MapCanvas
the MapCanvas that this adapter belongs toprotected MapPanel
the MapPanel that this adapter belongs toprotected StringBuffer
buffer used to create the message for the default mouseMoved event -
Constructor Summary
ConstructorsConstructorDescriptionMapMouseAdapter
(MapPanel panel, MapCanvas canvas) Create a new MapMouseAdapter object -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
called when this MouseAdapter is made no longer the active adapter.static ButtonGifStrings
return a new ButtonGifStrings objectGets the Cursor that should be displayed when this mouse adapter is active.getWorldPt
(Point point) get the WorldPt from the Point (usually from a MouseEvent)getWorldPt
(Point point, WorldPt wpt) get the WorldPt from the Point (usually from a MouseEvent)void
init()
called when this MouseAdapter is made the active adapter.void
called when the mouse is clicked.void
called when the mouse is dragged.void
called when the mouse enters this object.void
called when the mouse exits this object.void
called when the mouse is Pressed.void
called when the mouse is Pressed.void
called when the mouse is released.static boolean
checks to see if the MouseEvent e's Button 1 is pressedstatic boolean
checks to see if the MouseEvent e's Button 2 is pressedstatic boolean
checks to see if the MouseEvent e's Button 3 is pressed
-
Field Details
-
_mapCanvas
the MapCanvas that this adapter belongs to -
_mapPanel
the MapPanel that this adapter belongs to -
_strbuf
buffer used to create the message for the default mouseMoved event
-
-
Constructor Details
-
MapMouseAdapter
Create a new MapMouseAdapter object- Parameters:
panel
- The MapPanelcanvas
- The MapCanvas
-
-
Method Details
-
buildDefaultButtonGifStrings
return a new ButtonGifStrings object- Returns:
- a new ButtonGifStrings object
-
mouseReleased
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 interfaceMouseListener
- Parameters:
e
- the MouseEvent
-
mousePressed
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 interfaceMouseListener
- Parameters:
e
- the MouseEvent
-
mouseMoved
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 interfaceMouseMotionListener
- Parameters:
e
- the MouseEvent
-
mouseExited
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 interfaceMouseListener
- Parameters:
e
- The MouseEvent
-
mouseEntered
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 interfaceMouseListener
- Parameters:
e
- the MouseEvent
-
mouseDragged
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 interfaceMouseMotionListener
- Parameters:
e
- the MouseEvent
-
mouseClicked
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 interfaceMouseListener
- 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
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
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
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
Gets the Cursor that should be displayed when this mouse adapter is active. By default it returnsjava.awt.Cursor.getDefaultCursor()
- Returns:
- the Cursor to use for this adapter
-
getWorldPt
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
get the WorldPt from the Point (usually from a MouseEvent)- Parameters:
point
- a java.awt.Pointwpt
- the WorldPt to initialize to- Returns:
- an invalid WorldPt if point is null or the MapPanel is null, a valid WorldPt otherwise
-