NavMouseMode (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.event
Class NavMouseMode

    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

All Implemented Interfaces:
  MapMouseMode, PaintListener, LightMapHandlerChild, PropertyConsumer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

Direct Known Subclasses:
  NavMouseMode2

    public class NavMouseMode

extends CoordMouseMode

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. If a box is drawn by clicking down and dragging the mouse, the map is centered on the dot in the center of the box, and the scale is adjusted so the screen fills the area designated by the box.

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

Nested Class Summary

Nested classes/interfaces inherited from class com.bbn.openmap.event.AbstractMouseMode
`AbstractMouseMode.MouseWheelTimerListener`

Field Summary
`protected boolean` | `autoZoom`
`static java.lang.String` | `modeID` Mouse Mode identifier, which is "Navigation".
`protected java.awt.Point` | `point1`
`protected java.awt.Point` | `point2`
`protected DrawingAttributes` | `rectAttributes` DrawingAttributes to use for drawn rectangle.

Fields inherited from class com.bbn.openmap.event.CoordMouseMode
`coordFormatter, coordFormatterHandler, CoordFormatterProperty, infoDelegator`

Fields inherited from class com.bbn.openmap.event.AbstractMouseMode
`cursor, CursorIDProperty, guiIcon, iconName, IconProperty, ID, IDProperty, logger, mouseSupport, mouseTimer, mouseWheelListener, MouseWheelListenerProperty, mouseWheelTimerInterval, MouseWheelTimerIntervalProperty, mouseWheelTimerListener, MouseWheelZoomProperty, noMouseWheelListenerTimer, NoMouseWheelListenerTimerProperty, prettyName, PrettyNameProperty, propertyChangeSupport, visible, ZOOM_IN, ZOOM_OUT, zoomWhenMouseWheelUp`

Fields inherited from class com.bbn.openmap.OMComponent
`i18n, propertyPrefix`

Fields inherited from class com.bbn.openmap.MapHandlerChild
`beanContextChildSupport, isolated`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`NavMouseMode()` Construct a NavMouseMode.
`NavMouseMode(boolean shouldConsumeEvents)` Construct a NavMouseMode.

Method Summary
`protected void` | `cleanUp()`
`java.util.Properties` | `getProperties(java.util.Properties getList)` PropertyConsumer interface method.
`java.util.Properties` | `getPropertyInfo(java.util.Properties list)` PropertyConsumer interface method.
`protected java.awt.Point` | `getRatioPoint(MapBean map, java.awt.Point pt1, java.awt.Point pt2)` Given a MapBean, which provides the projection, and the starting point of a box (pt1), look at pt2 to see if it represents the ratio of the projection map size.
`DrawingAttributes` | `getRectAttributes()`
`protected void` | `handleMouseReleased(java.awt.event.MouseEvent e)` Override this method to change what happens when the mouse is released.
`void` | `listenerPaint(java.lang.Object obj, java.awt.Graphics g)` Called by the MapBean when it repaints, to let the MouseMode know when to update itself on the map.
`void` | `mouseClicked(java.awt.event.MouseEvent e)` Invoked when the mouse has been clicked on a component.
`void` | `mouseDragged(java.awt.event.MouseEvent e)` Handle a mouseDragged MouseMotionListener event.
`void` | `mouseEntered(java.awt.event.MouseEvent e)` Handle a mouseEntered MouseListener event.
`void` | `mouseExited(java.awt.event.MouseEvent e)` Handle a mouseExited MouseListener event.
`void` | `mouseMoved(java.awt.event.MouseEvent e)` Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.
`void` | `mousePressed(java.awt.event.MouseEvent e)` Handle a mousePressed MouseListener event.
`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.
`void` | `setProperties(java.lang.String prefix, java.util.Properties setList)` PropertyConsumer interface method.
`void` | `setRectAttributes(DrawingAttributes rectAttributes)`

Methods inherited from class com.bbn.openmap.event.CoordMouseMode
`findAndInit, findAndUndo, fireMouseLocation, getCoordFormatter, getCoordFormatterHandler, getInfoDelegator, propertyChange, setActive, setCoordFormatter, setCoordFormatterHandler, setInfoDelegator`

Methods inherited from class com.bbn.openmap.event.AbstractMouseMode
`actAsProxyFor, actAsProxyFor, addMapMouseListener, addPropertyChangeListener, getClassToUseForIconRetrieval, getGUIIcon, getIconName, getID, getModeCursor, getMouseSupport, getMouseWheelTimerInterval, getNoMouseWheelListener, getPrettyName, getProxied, getProxyDistributionMask, isConsumeEvents, isMouseWheelListener, isNoMouseWheelListenerTimer, isProxyFor, isVisible, isZoomWhenMouseWheelUp, mouseWheelMoved, releaseProxy, removeAllMapMouseListeners, removeMapMouseListener, removePropertyChangeListener, setConsumeEvents, setGUIIcon, setIconName, setID, setModeCursor, setModeCursor, setMouseSupport, setMouseWheelListener, setMouseWheelTimerInterval, setNoMouseWheelListener, setNoMouseWheelListenerTimer, setPrettyName, setProxyDistributionMask, setVisible, setZoomWhenMouseWheelUp, updateMouseWheelMoved`

Methods inherited from class com.bbn.openmap.OMComponent
`getPropertyPrefix, setProperties, setPropertyPrefix`

Methods inherited from class com.bbn.openmap.MapHandlerChild
`addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### modeID

    public static final transient java.lang.String modeID

  Mouse Mode identifier, which is "Navigation".

  See Also:
    Constant Field Values

### point1

    protected java.awt.Point point1

### point2

    protected java.awt.Point point2

### autoZoom

    protected boolean autoZoom

### rectAttributes

    protected DrawingAttributes rectAttributes

  DrawingAttributes to use for drawn rectangle. Fill paint will be used for XOR color, line paint will be used for paint color.

Constructor Detail

### NavMouseMode

    public NavMouseMode()

  Construct a NavMouseMode. Sets the ID of the mode to the modeID, the consume mode to true, and the cursor to the crosshair.

### NavMouseMode

    public NavMouseMode(boolean shouldConsumeEvents)

  Construct a NavMouseMode. 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.

Method Detail

### mousePressed

    public void mousePressed(java.awt.event.MouseEvent e)

  Handle a mousePressed MouseListener event. Erases the old navigation rectangle if there is one, and then keeps the press point for reference later.

  Specified by:
    `mousePressed` in interface `java.awt.event.MouseListener`
  Overrides:
    `mousePressed` in class `AbstractMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### mouseClicked

    public void mouseClicked(java.awt.event.MouseEvent e)

  Description copied from class: `AbstractMouseMode`
  Invoked when the mouse has been clicked on a component. Calls fireMapMouseClicked on MouseSupport.

  Specified by:
    `mouseClicked` in interface `java.awt.event.MouseListener`
  Overrides:
    `mouseClicked` in class `AbstractMouseMode`
  Parameters:
    `e` - MouseEvent

### mouseMoved

    public void mouseMoved(java.awt.event.MouseEvent e)

  Description copied from class: `CoordMouseMode`
  Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.

  Specified by:
    `mouseMoved` in interface `java.awt.event.MouseMotionListener`
  Overrides:
    `mouseMoved` in class `CoordMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### 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 occurrence 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 `AbstractMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### handleMouseReleased

    protected void handleMouseReleased(java.awt.event.MouseEvent e)

  Override this method to change what happens when the mouse is released.

  Parameters:
    `e` - MouseEvent

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Handle a mouseEntered MouseListener event. The boolean autoZoom is set to true, which will make the delegate ask the map to zoom in to a box that is drawn.

  Specified by:
    `mouseEntered` in interface `java.awt.event.MouseListener`
  Overrides:
    `mouseEntered` in class `AbstractMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Handle a mouseExited MouseListener event. The boolean autoZoom is set to false, which will cause the delegate to NOT ask the map to zoom in on a box. If a box is being drawn, it will be erased. The point1 is kept in case the mouse comes back on the screen with the button still down. Then, a new box will be drawn with the original mouse press position.

  Specified by:
    `mouseExited` in interface `java.awt.event.MouseListener`
  Overrides:
    `mouseExited` in class `AbstractMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### mouseDragged

    public void mouseDragged(java.awt.event.MouseEvent e)

  Handle a mouseDragged MouseMotionListener event. A rectangle is drawn from the mousePressed point, since I'm assuming that I'm drawing a box to zoom the map to. If a previous box was drawn, it is erased.

  Specified by:
    `mouseDragged` in interface `java.awt.event.MouseMotionListener`
  Overrides:
    `mouseDragged` in class `CoordMouseMode`
  Parameters:
    `e` - MouseEvent to be handled

### cleanUp

    protected void cleanUp()

### getRatioPoint

    protected java.awt.Point getRatioPoint(MapBean map,
                                           java.awt.Point pt1,
                                           java.awt.Point pt2)

  Given a MapBean, which provides the projection, and the starting point of a box (pt1), look at pt2 to see if it represents the ratio of the projection map size. If it doesn't, provide a point that does. This method signature is provided for backwards compatibility.

### 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.

  Parameters:
    `pt1` - one corner of the box to drawn, in window pixel coordinates.
    `pt2` - the opposite corner of the box.

### listenerPaint

    public void listenerPaint(java.lang.Object obj,
                              java.awt.Graphics g)

  Called by the MapBean when it repaints, to let the MouseMode know when to update itself on the map. PaintListener interface.

  Specified by:
    `listenerPaint` in interface `PaintListener`
  Overrides:
    `listenerPaint` in class `AbstractMouseMode`
  Parameters:
    `obj` - the source object, may be null, you need to check.
    `g` - the graphics to paint into.

### getRectAttributes

    public DrawingAttributes getRectAttributes()

### setRectAttributes

    public void setRectAttributes(DrawingAttributes rectAttributes)

### setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties setList)

  PropertyConsumer interface method.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `CoordMouseMode`
  Parameters:
    `prefix` - the token to prefix the property names
    `setList` - the `Properties` object

### getProperties

    public java.util.Properties getProperties(java.util.Properties getList)

  PropertyConsumer interface method.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Overrides:
    `getProperties` in class `CoordMouseMode`
  Parameters:
    `getList` - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties list)

  PropertyConsumer interface method.

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Overrides:
    `getPropertyInfo` in class `CoordMouseMode`
  Parameters:
    `list` - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details