Package gov.nasa.worldwind.view
Class ViewElevationAnimator
- java.lang.Object
-
- gov.nasa.worldwind.animation.BasicAnimator
-
- gov.nasa.worldwind.animation.DoubleAnimator
-
- gov.nasa.worldwind.view.ViewElevationAnimator
-
- All Implemented Interfaces:
Animator
- Direct Known Subclasses:
FlyToFlyViewAnimator.FlyToElevationAnimator
public class ViewElevationAnimator extends DoubleAnimator
AnAnimator
for elevation values. Calculates a mid-zoom value that gives the effect of flying up and them back down again.
-
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description ViewElevationAnimator(Globe globe, double beginZoom, double endZoom, LatLon beginLatLon, LatLon endLatLon, int altitudeMode, PropertyAccessor.DoubleAccessor propertyAccessor)
Create the animator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.lang.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(java.lang.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
-
-
-
-
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
, orWorldWind.ABSOLUTE
. Altitude mode is not used ifglobe
is null.propertyAccessor
- Accessor to set elevation.
-
-
Method Detail
-
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.
-
setEnd
public void setEnd(java.lang.Double end)
Set the animator's end zoom level. Setting the end zoom does not change the mid-zoom.- Overrides:
setEnd
in classDoubleAnimator
- Parameters:
end
- New end zoom.
-
set
public void set(double interpolant)
Set the value of the field being animated based on the given interpolant.- Specified by:
set
in interfaceAnimator
- Overrides:
set
in classBasicAnimator
- Parameters:
interpolant
- A value between 0 and 1.
-
nextDouble
public java.lang.Double nextDouble(double interpolant)
- Overrides:
nextDouble
in classDoubleAnimator
-
nextDouble
protected double nextDouble(double interpolant, double start, double end)
Computes the value for the given interpolant.- Parameters:
interpolant
- the interpolant to use for interpolatingstart
- the lower end of the interpolated range.end
- the upper end of the interpolated range.- Returns:
- the interpolated value.
-
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 classDoubleAnimator
- Parameters:
interpolant
- A value between 0 and 1.
-
computeMidZoom
protected static double computeMidZoom(Globe globe, LatLon beginLatLon, LatLon endLatLon, double beginZoom, double endZoom)
-
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 valueendZoom
- the end zoom valuemidZoom
- the elevation at the middle of the animation- Returns:
- true if it is appropriate to use the midZoom value.
-
-