Package gov.nasa.worldwind.layers
Class ViewControlsSelectListener
- java.lang.Object
-
- gov.nasa.worldwind.layers.ViewControlsSelectListener
-
- All Implemented Interfaces:
SelectListener
,java.util.EventListener
public class ViewControlsSelectListener extends java.lang.Object implements SelectListener
Controller for onscreen view controls displayed byViewControlsLayer
.- See Also:
ViewControlsLayer
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_TIMER_DELAY
protected double
fovStep
protected double
headingStep
protected java.awt.Point
lastPickPoint
protected double
panStep
protected double
pitchStep
protected ScreenAnnotation
pressedControl
protected java.lang.String
pressedControlType
protected javax.swing.Timer
repeatTimer
protected double
veStep
protected ViewControlsLayer
viewControlsLayer
protected WorldWindow
wwd
protected double
zoomStep
-
Constructor Summary
Constructors Constructor Description ViewControlsSelectListener(WorldWindow wwd, ViewControlsLayer layer)
Construct a controller for specifiedWorldWindow
andViewControlsLayer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, java.lang.String controlType)
-
-
-
Field Detail
-
DEFAULT_TIMER_DELAY
protected static final int DEFAULT_TIMER_DELAY
- See Also:
- Constant Field Values
-
wwd
protected WorldWindow wwd
-
viewControlsLayer
protected ViewControlsLayer viewControlsLayer
-
pressedControl
protected ScreenAnnotation pressedControl
-
pressedControlType
protected java.lang.String pressedControlType
-
lastPickPoint
protected java.awt.Point lastPickPoint
-
repeatTimer
protected javax.swing.Timer repeatTimer
-
panStep
protected double panStep
-
zoomStep
protected double zoomStep
-
headingStep
protected double headingStep
-
pitchStep
protected double pitchStep
-
fovStep
protected double fovStep
-
veStep
protected double veStep
-
-
Constructor Detail
-
ViewControlsSelectListener
public ViewControlsSelectListener(WorldWindow wwd, ViewControlsLayer layer)
Construct a controller for specifiedWorldWindow
andViewControlsLayer
.ViewControlLayer
s are not sharable amongWorldWindow
s. A separate layer and controller must be established for each window that's to have view controls.- Parameters:
wwd
- theWorldWindow
the specified layer is associated with.layer
- the layer to control.
-
-
Method Detail
-
setRepeatTimerDelay
public void setRepeatTimerDelay(int delay)
Set the repeat timer delay in milliseconds.- Parameters:
delay
- the repeat timer delay in milliseconds.- Throws:
java.lang.IllegalArgumentException
- if delay is less than or equal to zero.
-
getRepeatTimerDelay
public int getRepeatTimerDelay()
Get the repeat timer delay in milliseconds.- Returns:
- the repeat timer delay in milliseconds.
-
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.
-
getPanIncrement
public double getPanIncrement()
Get the panning distance factor.- Returns:
- the panning distance factor.
-
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.
-
getZoomIncrement
public double getZoomIncrement()
Get the zooming distance factor.- Returns:
- the zooming distance factor.
-
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.
-
getHeadingIncrement
public double getHeadingIncrement()
Get the heading increment value in decimal degrees.- Returns:
- the heading increment value in decimal degrees.
-
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:
java.lang.IllegalArgumentException
- if value is < zero.
-
getPitchIncrement
public double getPitchIncrement()
Get the pitch increment value in decimal degrees.- Returns:
- the pitch increment value in decimal degrees.
-
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:
java.lang.IllegalArgumentException
- if value < 1;
-
getFovIncrement
public double getFovIncrement()
Get the field of view increment factor.- Returns:
- the field of view increment factor.
-
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:
java.lang.IllegalArgumentException
- if value < 0.
-
getVeIncrement
public double getVeIncrement()
Get the vertical exaggeration increment.- Returns:
- the vertical exaggeration increment.
-
selected
public void selected(SelectEvent event)
- Specified by:
selected
in interfaceSelectListener
-
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.
-
updateView
protected void updateView(ScreenAnnotation control, java.lang.String controlType)
-
computeNewZoom
protected double computeNewZoom(OrbitView view, double amount)
-
computePanHeading
protected Angle computePanHeading(OrbitView view, ScreenAnnotation control)
-
computePanAmount
protected Angle computePanAmount(Globe globe, OrbitView view, ScreenAnnotation control, double panStep)
-
computeLookHeading
protected Angle computeLookHeading(OrbitView view, ScreenAnnotation control, double headingStep)
-
computeLookPitch
protected Angle computeLookPitch(OrbitView view, ScreenAnnotation control, double pitchStep)
-
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
-
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.
-
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 viewheading
- 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.
-
-