com.bbn.openmap.gui
Class DistQuickTool.MouseMode

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.event.AbstractMouseMode
              extended by com.bbn.openmap.event.CoordMouseMode
                  extended by com.bbn.openmap.gui.DistQuickTool.MouseMode
All Implemented Interfaces:
MapMouseMode, PaintListener, ProjectionListener, 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
Enclosing class:
DistQuickTool

public class DistQuickTool.MouseMode
extends CoordMouseMode
implements ProjectionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.event.AbstractMouseMode
AbstractMouseMode.MouseWheelTimerListener
 
Field Summary
static java.lang.String AllUnitsPropertyValue
          Special units value for displaying all units ...
protected  java.lang.String coordString
           
 java.text.DecimalFormat df
           
 double distance
          Distance of the current segment
protected  OMGraphicList distanceList
           
static java.lang.String modeID
           
 boolean mousePressed
          Flag, true if the mouse has already been pressed
protected  MapMouseMode proxyParent
           
 java.awt.geom.Point2D rPoint1
          rPoint1 is the anchor point of a line segment
 java.awt.geom.Point2D rPoint2
          rPoint2 is the new (current) point of a line segment
 java.util.Vector<java.awt.geom.Point2D> segments
          Vector to store all distance segments, first point and last point pairs
static java.lang.String ShowAngleProperty
           
static java.lang.String ShowCircleProperty
           
protected  BufferedMapBean theMap
           
 double totalDistance
          The cumulative distance from the first mouse click
static java.lang.String UnitProperty
           
 
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
DistQuickTool.MouseMode()
           
 
Method Summary
 void cleanUp()
          Reset the segments and distances
protected  java.lang.String createDistanceInformationLine(java.awt.geom.Point2D llp, double distance, double azimuth)
           
protected  BufferedMapBean getBufferedMapBean(java.awt.event.MouseEvent evt)
          Checks the MouseEvent to see if a BufferedMapBean can be found.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 double getSphericalAzimuth(double phi1, double lambda0, double phi, double lambda)
          Return the azimuth angle in decimal degrees from north.
 Length getUnit()
          Return the unit of distance being displayed: Length.NM, Length.KM or Length.MILE.
 void go(MapMouseMode proxyParent)
           
 boolean isDisplayCircle()
           
 boolean isShowAngle()
           
 void listenerPaint(java.lang.Object source, java.awt.Graphics g)
          PaintListener interface, notifying the MouseMode that the MapBean has repainted itself.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(java.awt.event.MouseEvent arg0)
          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)
          Process a mouse pressed event.
 void mouseReleased(java.awt.event.MouseEvent arg0)
          Invoked when a mouse button has been released on a component.
 void paintCircle(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
          Draw a rubberband circle between two points
 void paintLine(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
          Draw a rubberband line between two points
 void paintRubberband(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2, java.lang.String coordString)
          Draw a rubberband line and circle between two points
 void paintText(java.awt.geom.Point2D base, java.awt.geom.Point2D pt1, java.lang.String coordString)
           
 void projectionChanged(ProjectionEvent e)
          Invoked when there has been a fundamental change to the Map.
protected  void reset()
           
 void setDisplayCircle(boolean displayCircle)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setShowAngle(boolean showAngle)
           
 void setUnit(Length units)
          Set the unit of distance to be displayed: Length.NM, Length.KM or Length.MILE.
 
Methods inherited from class com.bbn.openmap.event.CoordMouseMode
findAndInit, findAndUndo, fireMouseLocation, getCoordFormatter, getCoordFormatterHandler, getInfoDelegator, mouseMoved, 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, mouseEntered, mouseExited, 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

UnitProperty

public static final java.lang.String UnitProperty
See Also:
Constant Field Values

ShowCircleProperty

public static final java.lang.String ShowCircleProperty
See Also:
Constant Field Values

ShowAngleProperty

public static final java.lang.String ShowAngleProperty
See Also:
Constant Field Values

modeID

public static final transient java.lang.String modeID
See Also:
Constant Field Values

df

public transient java.text.DecimalFormat df

rPoint1

public java.awt.geom.Point2D rPoint1
rPoint1 is the anchor point of a line segment


rPoint2

public java.awt.geom.Point2D rPoint2
rPoint2 is the new (current) point of a line segment


mousePressed

public boolean mousePressed
Flag, true if the mouse has already been pressed


segments

public java.util.Vector<java.awt.geom.Point2D> segments
Vector to store all distance segments, first point and last point pairs


distance

public double distance
Distance of the current segment


totalDistance

public double totalDistance
The cumulative distance from the first mouse click


AllUnitsPropertyValue

public static final java.lang.String AllUnitsPropertyValue
Special units value for displaying all units ... use only in properties file

See Also:
Constant Field Values

theMap

protected BufferedMapBean theMap

coordString

protected java.lang.String coordString

distanceList

protected OMGraphicList distanceList

proxyParent

protected MapMouseMode proxyParent
Constructor Detail

DistQuickTool.MouseMode

public DistQuickTool.MouseMode()
Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

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

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class CoordMouseMode
Parameters:
props - 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 props)
Description copied from class: OMComponent
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class CoordMouseMode
Parameters:
props - 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.

getBufferedMapBean

protected BufferedMapBean getBufferedMapBean(java.awt.event.MouseEvent evt)
Checks the MouseEvent to see if a BufferedMapBean can be found.

Parameters:
evt - MouseEvent, or a MapMouseEvent
Returns:
BufferedMapBean, or null if source is not a BufferedMapBean.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent arg0)
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:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class CoordMouseMode
Parameters:
arg0 - mouse event.
See Also:
The first click for drag, the image is generated. This image is redrawing when the mouse is move, but, I need to repain the original image.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Process a mouse pressed event. Add the mouse location to the segment vector. Calculate the cumulative total distance.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class AbstractMouseMode
Parameters:
e - mouse event.

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent arg0)
Description copied from class: AbstractMouseMode
Invoked when a mouse button has been released on a component. Calls fireMapMouseReleased on the MouseSupport.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class AbstractMouseMode
Parameters:
arg0 - MouseEvent
See Also:
Make Pan event for the map.

go

public void go(MapMouseMode proxyParent)

reset

protected void reset()

listenerPaint

public void listenerPaint(java.lang.Object source,
                          java.awt.Graphics g)
PaintListener interface, notifying the MouseMode that the MapBean has repainted itself. Useful if the MouseMode is drawing stuff.

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

projectionChanged

public void projectionChanged(ProjectionEvent e)
Description copied from interface: ProjectionListener
Invoked when there has been a fundamental change to the Map.

Layers are expected to recompute their graphics (if this makes sense), and then repaint() themselves.

Specified by:
projectionChanged in interface ProjectionListener
Parameters:
e - ProjectionEvent

paintRubberband

public void paintRubberband(java.awt.geom.Point2D pt1,
                            java.awt.geom.Point2D pt2,
                            java.lang.String coordString)
Draw a rubberband line and circle between two points

Parameters:
pt1 - the anchor point.
pt2 - the current (mouse) position.

paintLine

public void paintLine(java.awt.geom.Point2D pt1,
                      java.awt.geom.Point2D pt2)
Draw a rubberband line between two points

Parameters:
pt1 - the anchor point.
pt2 - the current (mouse) position.

paintText

public void paintText(java.awt.geom.Point2D base,
                      java.awt.geom.Point2D pt1,
                      java.lang.String coordString)

paintCircle

public void paintCircle(java.awt.geom.Point2D pt1,
                        java.awt.geom.Point2D pt2)
Draw a rubberband circle between two points

Parameters:
pt1 - the anchor point.
pt2 - the current (mouse) position.

cleanUp

public void cleanUp()
Reset the segments and distances


getSphericalAzimuth

public double getSphericalAzimuth(double phi1,
                                  double lambda0,
                                  double phi,
                                  double lambda)
Return the azimuth angle in decimal degrees from north. Based on spherical_azimuth. See class GreatCircle.java

Parameters:
phi1 - latitude in decimal degrees of start point
lambda0 - longitude in decimal degrees of start point
phi - latitude in decimal degrees of end point
lambda - longitude in decimal degrees of end point
Returns:
float azimuth angle in degrees

createDistanceInformationLine

protected java.lang.String createDistanceInformationLine(java.awt.geom.Point2D llp,
                                                         double distance,
                                                         double azimuth)

setUnit

public void setUnit(Length units)
Set the unit of distance to be displayed: Length.NM, Length.KM or Length.MILE. If null, displays all of them.


isShowAngle

public boolean isShowAngle()

setShowAngle

public void setShowAngle(boolean showAngle)

isDisplayCircle

public boolean isDisplayCircle()

setDisplayCircle

public void setDisplayCircle(boolean displayCircle)

getUnit

public Length getUnit()
Return the unit of distance being displayed: Length.NM, Length.KM or Length.MILE. If null, displays all of them.



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