com.bbn.openmap.event
Class NavMouseMode2
java.lang.Object
|
+--com.bbn.openmap.MapHandlerChild
|
+--com.bbn.openmap.OMComponent
|
+--com.bbn.openmap.event.AbstractMouseMode
|
+--com.bbn.openmap.event.CoordMouseMode
|
+--com.bbn.openmap.event.NavMouseMode
|
+--com.bbn.openmap.event.NavMouseMode2
- All Implemented Interfaces:
- java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, LightMapHandlerChild, MapMouseMode, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, PaintListener, PropertyConsumer, java.io.Serializable
- Direct Known Subclasses:
- DefaultOverviewMouseMode
- public class NavMouseMode2
- extends NavMouseMode
The Navigation Mouse Mode interprets mouse clicks and mouse drags
to recenter and rescale the map. The map is centered on the
location where a click occurs. The difference between this
MouseMode and the original NavMouseMode is that the box drawn is
interpreted differently. The point where the mouse is pressed is
interpreted to be the center of the new zoom area (instead of one
of the corners), and the dragged mouse point is the edge of the
box, reflected equally on the other side of the center point.
You MUST add this MouseMode as a ProjectionListener to the MapBean
to get it to work. If you use a MouseDelegator with the bean, it
will take care of that for you.
- See Also:
- Serialized Form
Constructor Summary |
NavMouseMode2()
Construct a NavMouseMode2. |
NavMouseMode2(boolean shouldConsumeEvents)
Construct a NavMouseMode2. |
Method Summary |
void |
mouseReleased(java.awt.event.MouseEvent e)
Handle a mouseReleased MouseListener event. |
protected void |
paintRectangle(java.awt.Graphics g,
java.awt.Point pt1,
java.awt.Point pt2)
Draws or erases boxes between two screen pixel points. |
Methods inherited from class com.bbn.openmap.event.AbstractMouseMode |
actAsProxyFor, actAsProxyFor, addMapMouseListener, getGUIIcon, getID, getModeCursor, getMouseSupport, getPrettyName, getProperties, getPropertyInfo, getProxyDistributionMask, isConsumeEvents, isProxyFor, isVisible, mouseClicked, releaseProxy, removeAllMapMouseListeners, removeMapMouseListener, setConsumeEvents, setGUIIcon, setID, setModeCursor, setMouseSupport, setPrettyName, setProperties, setProxyDistributionMask, setVisible |
Methods inherited from class com.bbn.openmap.MapHandlerChild |
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NavMouseMode2
public NavMouseMode2()
- Construct a NavMouseMode2. Sets the ID of the mode to the
modeID, the consume mode to true, and the cursor to the
crosshair.
NavMouseMode2
public NavMouseMode2(boolean shouldConsumeEvents)
- Construct a NavMouseMode2. Lets you set the consume mode. If
the events are consumed, then a MouseEvent is sent only to the
first MapMouseListener that successfully processes the event.
If they are not consumed, then all of the listeners get a
chance to act on the event.
- Parameters:
shouldConsumeEvents
- the mode setting.
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Handle a mouseReleased MouseListener event. If there was no
drag events, or if there was only a small amount of dragging
between the occurence of the mousePressed and this event, then
recenter the map. Otherwise we get the second corner of the
navigation rectangle and try to figure out the best scale and
location to zoom in to based on that rectangle.
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
- Overrides:
mouseReleased
in class NavMouseMode
- Parameters:
e
- MouseEvent to be handled
paintRectangle
protected void paintRectangle(java.awt.Graphics g,
java.awt.Point pt1,
java.awt.Point pt2)
- Draws or erases boxes between two screen pixel points. The
graphics from the map is set to XOR mode, and this method uses
two colors to make the box disappear if on has been drawn at
these coordinates, and the box to appear if it hasn't.
- Overrides:
paintRectangle
in class NavMouseMode
- Parameters:
pt1
- one corner of the box to drawn, in window pixel
coordinates.pt2
- the opposite corner of the box.
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details