NASA World Wind

gov.nasa.worldwind.view
Class ViewElevationAnimator

java.lang.Object
  extended by gov.nasa.worldwind.animation.BasicAnimator
      extended by gov.nasa.worldwind.animation.DoubleAnimator
          extended by gov.nasa.worldwind.view.ViewElevationAnimator
All Implemented Interfaces:
Animator
Direct Known Subclasses:
FlyToFlyViewAnimator.FlyToElevationAnimator

public class ViewElevationAnimator
extends DoubleAnimator

An Animator for elevation values. Calculates a mid-zoom value that gives the effect of flying up and them back down again.


Field Summary
protected  int altitudeMode
           
protected  LatLon endLatLon
           
protected  Globe globe
           
protected  double midZoom
           
protected  double trueEndZoom
           
protected  boolean useMidZoom
           
 
Fields inherited from class gov.nasa.worldwind.animation.DoubleAnimator
begin, end, propertyAccessor
 
Fields inherited from class gov.nasa.worldwind.animation.BasicAnimator
interpolator
 
Constructor Summary
ViewElevationAnimator(Globe globe, double beginZoom, double endZoom, LatLon beginLatLon, LatLon endLatLon, int altitudeMode, PropertyAccessor.DoubleAccessor propertyAccessor)
          Create the animator.
 
Method Summary
protected static double computeMidZoom(Globe globe, LatLon beginLatLon, LatLon endLatLon, double beginZoom, double endZoom)
           
 double getTrueEndZoom()
          return the true position to end the elevation animation at.
 boolean getUseMidZoom()
          determines whether this Animator is using midZoom.
 Double nextDouble(double interpolant)
           
protected  double nextDouble(double interpolant, double start, double end)
          Computes the value for the given interpolant.
 void set(double interpolant)
          Set the value of the field being animated based on the given interpolant.
 void setEnd(Double end)
          Set the animator's end zoom level.
protected  void setImpl(double interpolant)
          No-op intended to be overrided by deriving classes.
protected  boolean useMidZoom(double beginZoom, double endZoom, double midZoom)
          Determines if the animation will use mid-zoom.
 
Methods inherited from class gov.nasa.worldwind.animation.DoubleAnimator
getBegin, getEnd, getPropertyAccessor, setBegin
 
Methods inherited from class gov.nasa.worldwind.animation.BasicAnimator
flagLastStateInvalid, hasNext, isLastStateValid, isStopOnInvalidState, next, setStopOnInvalidState, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

altitudeMode

protected int altitudeMode

endLatLon

protected LatLon endLatLon

globe

protected Globe globe

midZoom

protected double midZoom

trueEndZoom

protected double trueEndZoom

useMidZoom

protected boolean useMidZoom
Constructor Detail

ViewElevationAnimator

public ViewElevationAnimator(Globe globe,
                             double beginZoom,
                             double endZoom,
                             LatLon beginLatLon,
                             LatLon endLatLon,
                             int altitudeMode,
                             PropertyAccessor.DoubleAccessor propertyAccessor)
Create the animator. If the altitude mode is relative to surface elevation, the ending elevation will be re-calculated as the animation runs to ensure that the final elevation is based on the most accurate elevation data available.

Parameters:
globe - Globe used to evaluate altitude mode and determine if mid-zoom is necessary. May be null.
beginZoom - Beginning elevation.
endZoom - Ending elevation.
beginLatLon - Beginning location.
endLatLon - Ending location.
altitudeMode - Altitude mode of ending elevation (WorldWind.CLAMP_TO_GROUND, WorldWind.RELATIVE_TO_GROUND, or WorldWind.ABSOLUTE. Altitude mode is not used if globe is null.
propertyAccessor - Accessor to set elevation.
Method Detail

computeMidZoom

protected static double computeMidZoom(Globe globe,
                                       LatLon beginLatLon,
                                       LatLon endLatLon,
                                       double beginZoom,
                                       double endZoom)

getTrueEndZoom

public double getTrueEndZoom()
return the true position to end the elevation animation at.

Returns:
the true end elevation position.

getUseMidZoom

public boolean getUseMidZoom()
determines whether this Animator is using midZoom. The mid-point zoom is an interpolated value between minimum(the lesser of beginZoom and endZoom, and maximum zoom (3* the radius of the globe).

Returns:
whether this Animator is using midZoom.

nextDouble

public Double nextDouble(double interpolant)
Overrides:
nextDouble in class DoubleAnimator

nextDouble

protected double nextDouble(double interpolant,
                            double start,
                            double end)
Computes the value for the given interpolant.

Parameters:
interpolant - the interpolant to use for interpolating
start - the lower end of the interpolated range.
end - the upper end of the interpolated range.
Returns:
the interpolated value.

set

public void set(double interpolant)
Set the value of the field being animated based on the given interpolant.

Specified by:
set in interface Animator
Overrides:
set in class BasicAnimator
Parameters:
interpolant - A value between 0 and 1.

setEnd

public void setEnd(Double end)
Set the animator's end zoom level. Setting the end zoom does not change the mid-zoom.

Overrides:
setEnd in class DoubleAnimator
Parameters:
end - New end zoom.

setImpl

protected void setImpl(double interpolant)
Description copied from class: BasicAnimator
No-op intended to be overrided by deriving classes. Deriving classes are expected to implement the desired action of a set operation in this method.

Overrides:
setImpl in class DoubleAnimator
Parameters:
interpolant - A value between 0 and 1.

useMidZoom

protected boolean useMidZoom(double beginZoom,
                             double endZoom,
                             double midZoom)
Determines if the animation will use mid-zoom. Mid-zoom animation is used if the difference between the beginZoom and endZoom values is less than the difference between the midZoom value and the larger of the beginZoom or endZoom values.

Parameters:
beginZoom - the begin zoom value
endZoom - the end zoom value
midZoom - the elevation at the middle of the animation
Returns:
true if it is appropriate to use the midZoom value.

NASA World Wind