NASA World Wind

gov.nasa.worldwind.layers
Class ViewControlsSelectListener

java.lang.Object
  extended by gov.nasa.worldwind.layers.ViewControlsSelectListener
All Implemented Interfaces:
SelectListener, EventListener

public class ViewControlsSelectListener
extends Object
implements SelectListener

Controller for onscreen view controls displayed by ViewControlsLayer.

See Also:
ViewControlsLayer

Field Summary
protected static int DEFAULT_TIMER_DELAY
           
protected  double fovStep
           
protected  double headingStep
           
protected  Point lastPickPoint
           
protected  double panStep
           
protected  double pitchStep
           
protected  ScreenAnnotation pressedControl
           
protected  String pressedControlType
           
protected  Timer repeatTimer
           
protected  double veStep
           
protected  ViewControlsLayer viewControlsLayer
           
protected  WorldWindow wwd
           
protected  double zoomStep
           
 
Constructor Summary
ViewControlsSelectListener(WorldWindow wwd, ViewControlsLayer layer)
          Construct a controller for specified WorldWindow and ViewControlsLayer.
 
Method Summary
protected  Angle computeLookHeading(OrbitView view, ScreenAnnotation control, double headingStep)
           
protected  Angle computeLookPitch(OrbitView view, ScreenAnnotation control, double pitchStep)
           
protected  double computeNewZoom(OrbitView view, double amount)
           
protected  Angle computePanAmount(Globe globe, OrbitView view, ScreenAnnotation control, double panStep)
           
protected  Angle computePanHeading(OrbitView view, ScreenAnnotation control)
           
protected  Vec4 computeSurfacePoint(OrbitView view, Angle heading, Angle pitch)
          Find out where on the terrain surface the eye would be looking at with the given heading and pitch angles.
 double getFovIncrement()
          Get the field of view increment factor.
 double getHeadingIncrement()
          Get the heading increment value in decimal degrees.
 double getPanIncrement()
          Get the panning distance factor.
protected  Layer getParentLayer()
          Returns this ViewControlsSelectListener's parent layer.
 double getPitchIncrement()
          Get the pitch increment value in decimal degrees.
 int getRepeatTimerDelay()
          Get the repeat timer delay in milliseconds.
 double getVeIncrement()
          Get the vertical exaggeration increment.
 double getZoomIncrement()
          Get the zooming distance factor.
protected  boolean isPathCrossingAPole(LatLon p1, LatLon p2)
           
protected  void resetOrbitView(OrbitView view)
          Reset the view to an orbit view state if in first person mode (zoom = 0)
 void selected(SelectEvent event)
           
 void setFovIncrement(double value)
          Set the field of view increment factor.
 void setHeadingIncrement(double value)
          Set the heading increment value in decimal degrees.
 void setPanIncrement(double value)
          Set the panning distance factor.
 void setPitchIncrement(double value)
          Set the pitch increment value in decimal degrees.
 void setRepeatTimerDelay(int delay)
          Set the repeat timer delay in milliseconds.
protected  void setupFirstPersonView(OrbitView view)
          Setup the view to a first person mode (zoom = 0)
 void setVeIncrement(double value)
          Set the vertical exaggeration increment.
 void setZoomIncrement(double value)
          Set the zoom distance factor.
protected  void updateView(ScreenAnnotation control, String controlType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMER_DELAY

protected static final int DEFAULT_TIMER_DELAY
See Also:
Constant Field Values

fovStep

protected double fovStep

headingStep

protected double headingStep

lastPickPoint

protected Point lastPickPoint

panStep

protected double panStep

pitchStep

protected double pitchStep

pressedControl

protected ScreenAnnotation pressedControl

pressedControlType

protected String pressedControlType

repeatTimer

protected Timer repeatTimer

veStep

protected double veStep

viewControlsLayer

protected ViewControlsLayer viewControlsLayer

wwd

protected WorldWindow wwd

zoomStep

protected double zoomStep
Constructor Detail

ViewControlsSelectListener

public ViewControlsSelectListener(WorldWindow wwd,
                                  ViewControlsLayer layer)
Construct a controller for specified WorldWindow and ViewControlsLayer.

ViewControlLayers are not sharable among WorldWindows. A separate layer and controller must be established for each window that's to have view controls.

Parameters:
wwd - the WorldWindow the specified layer is associated with.
layer - the layer to control.
Method Detail

computeLookHeading

protected Angle computeLookHeading(OrbitView view,
                                   ScreenAnnotation control,
                                   double headingStep)

computeLookPitch

protected Angle computeLookPitch(OrbitView view,
                                 ScreenAnnotation control,
                                 double pitchStep)

computeNewZoom

protected double computeNewZoom(OrbitView view,
                                double amount)

computePanAmount

protected Angle computePanAmount(Globe globe,
                                 OrbitView view,
                                 ScreenAnnotation control,
                                 double panStep)

computePanHeading

protected Angle computePanHeading(OrbitView view,
                                  ScreenAnnotation control)

computeSurfacePoint

protected Vec4 computeSurfacePoint(OrbitView view,
                                   Angle heading,
                                   Angle pitch)
Find out where on the terrain surface the eye would be looking at with the given heading and pitch angles.

Parameters:
view - the orbit view
heading - heading direction clockwise from north.
pitch - view pitch angle from the surface normal at the center point.
Returns:
the terrain surface point the view would be looking at in the viewport center.

getFovIncrement

public double getFovIncrement()
Get the field of view increment factor.

Returns:
the field of view increment factor.

getHeadingIncrement

public double getHeadingIncrement()
Get the heading increment value in decimal degrees.

Returns:
the heading increment value in decimal degrees.

getPanIncrement

public double getPanIncrement()
Get the panning distance factor.

Returns:
the panning distance factor.

getParentLayer

protected Layer getParentLayer()
Returns this ViewControlsSelectListener's parent layer. The parent layer is associated with picked objects, and is used to determine which SelectEvents thsi ViewControlsSelectListner responds to.

Returns:
this ViewControlsSelectListener's parent layer.

getPitchIncrement

public double getPitchIncrement()
Get the pitch increment value in decimal degrees.

Returns:
the pitch increment value in decimal degrees.

getRepeatTimerDelay

public int getRepeatTimerDelay()
Get the repeat timer delay in milliseconds.

Returns:
the repeat timer delay in milliseconds.

getVeIncrement

public double getVeIncrement()
Get the vertical exaggeration increment.

Returns:
the vertical exaggeration increment.

getZoomIncrement

public double getZoomIncrement()
Get the zooming distance factor.

Returns:
the zooming distance factor.

isPathCrossingAPole

protected boolean isPathCrossingAPole(LatLon p1,
                                      LatLon p2)

resetOrbitView

protected void resetOrbitView(OrbitView view)
Reset the view to an orbit view state if in first person mode (zoom = 0)

Parameters:
view - the orbit view to reset

selected

public void selected(SelectEvent event)
Specified by:
selected in interface SelectListener

setFovIncrement

public void setFovIncrement(double value)
Set the field of view increment factor. At each iteration the current field of view will be multiplied or divided by this value. Must be greater then or equal to one. Default value is 1.05.

Parameters:
value - the field of view increment factor.
Throws:
IllegalArgumentException

setHeadingIncrement

public void setHeadingIncrement(double value)
Set the heading increment value in decimal degrees. Doubling this value will double the heading change speed. Negating it will reverse the heading change direction. Default value is 1 degree.

Parameters:
value - the heading increment value in decimal degrees.

setPanIncrement

public void setPanIncrement(double value)
Set the panning distance factor. Doubling this value will double the panning speed. Negating it will reverse the panning direction. Default value is .6.

Parameters:
value - the panning distance factor.

setPitchIncrement

public void setPitchIncrement(double value)
Set the pitch increment value in decimal degrees. Doubling this value will double the pitch change speed. Must be positive. Default value is 1 degree.

Parameters:
value - the pitch increment value in decimal degrees.
Throws:
IllegalArgumentException

setRepeatTimerDelay

public void setRepeatTimerDelay(int delay)
Set the repeat timer delay in milliseconds.

Parameters:
delay - the repeat timer delay in milliseconds.
Throws:
IllegalArgumentException

setupFirstPersonView

protected void setupFirstPersonView(OrbitView view)
Setup the view to a first person mode (zoom = 0)

Parameters:
view - the orbit view to set into a first person view.

setVeIncrement

public void setVeIncrement(double value)
Set the vertical exaggeration increment. At each iteration the current vertical exaggeration will be increased or decreased by this amount. Must be greater than or equal to zero. Default value is 0.1.

Parameters:
value - the vertical exaggeration increment.
Throws:
IllegalArgumentException

setZoomIncrement

public void setZoomIncrement(double value)
Set the zoom distance factor. Doubling this value will double the zooming speed. Negating it will reverse the zooming direction. Default value is .8.

Parameters:
value - the zooming distance factor.

updateView

protected void updateView(ScreenAnnotation control,
                          String controlType)

NASA World Wind