Package gov.nasa.worldwind.view.orbit
Class BasicOrbitView
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.view.BasicView
-
- gov.nasa.worldwind.view.orbit.BasicOrbitView
-
- All Implemented Interfaces:
AVList,MessageListener,Restorable,View,OrbitView,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class BasicOrbitView extends BasicView implements OrbitView
-
-
Field Summary
Fields Modifier and Type Field Description protected Positioncenterprotected OrbitViewCollisionSupportcollisionSupportprotected booleanviewOutOfFocusprotected doublezoom-
Fields inherited from class gov.nasa.worldwind.view.BasicView
COLLISION_NUM_ITERATIONS, COLLISION_THRESHOLD, dc, DEFAULT_DEPTH_RESOLUTION, detectCollisions, eyePosition, farClipDistance, fieldOfView, frustum, globe, hadCollisions, heading, horizonDistance, lastEyePoint, lastEyePosition, lastForwardVector, lastFrustumInModelCoords, lastUpVector, MINIMUM_FAR_DISTANCE, MINIMUM_NEAR_DISTANCE, modelview, modelviewInv, nearClipDistance, pitch, projection, roll, viewInputHandler, viewLimits, viewport, viewStateID
-
Fields inherited from interface gov.nasa.worldwind.view.orbit.OrbitView
CENTER_STOPPED
-
Fields inherited from interface gov.nasa.worldwind.View
VIEW_STOPPED
-
-
Constructor Summary
Constructors Constructor Description BasicOrbitView()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCenterAnimator(Position begin, Position end, boolean smoothed)voidaddCenterAnimator(Position begin, Position end, long lengthMillis, boolean smoothed)voidaddEyePositionAnimator(long timeToIterate, Position beginPosition, Position endPosition)voidaddFlyToZoomAnimator(Angle heading, Angle pitch, double zoomAmount)voidaddHeadingAnimator(Angle begin, Angle end)voidaddHeadingPitchAnimator(Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch)voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom)voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, boolean endCenterOnSurface)voidaddPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, long timeToMove, boolean endCenterOnSurface)voidaddPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, boolean endCenterOnSurface)voidaddPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, long timeToMove, boolean endCenterOnSurface)voidaddPitchAnimator(Angle begin, Angle end)voidaddZoomAnimator(double zoomStart, double zoomEnd)protected voidafterDoApply()booleancanFocusOnTerrainCenter()booleancanFocusOnViewportCenter()Determines if the BasicOrbitView can be focused on the viewport centerfocusOnViewportCenter().voidcomputeAndSetViewCenter()Computes and sets the center of rotation for heading and pitch changes.voidcomputeAndSetViewCenterIfNeeded()Computes and sets the center of rotation for heading and pitch changes, if it is needed.protected doublecomputeFarDistance(Position eyePosition)protected doublecomputeHorizonDistance(Position eyePosition)voidcopyViewState(View view)Copy the state of the givenView.protected voiddoApply(DrawContext dc)protected voiddoGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)protected voiddoRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)protected voidflagHadCollisions()voidfocusOnTerrainCenter()voidfocusOnViewportCenter()Sets the point of rotation for heading and pitch changes to the surface position at the viewport center.Vec4getCenterPoint()Gets the center point of the view.PositiongetCenterPosition()Get the center position of the OrbitView.Vec4getCurrentEyePoint()Returns the most up-to-date location of the eye in cartesian coordinates.PositiongetCurrentEyePosition()Returns the current geographic coordinates of this view's eye position, as determined from this view's current parameters.OrbitViewLimitsgetOrbitViewLimits()Returns theOrbitViewLimitsthat apply to thisOrbitView.doublegetZoom()Get the zoom value for the OrbitView.protected voidlegacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)Restores state values from previous versions of the BasicObitView state XML.protected voidloadConfigurationValues()static PositionnormalizedCenterPosition(Position unnormalizedPosition)static AnglenormalizedHeading(Angle unnormalizedHeading)static AnglenormalizedPitch(Angle unnormalizedPitch)protected voidresolveCollisionsWithCenterPosition()protected voidresolveCollisionsWithPitch()voidsetCenterPosition(Position center)Sets the center position of the OrbitView.voidsetEyePosition(Position eyePosition)Sets the geographic position of the eye.voidsetHeading(Angle heading)Sets the heading of the view.protected voidsetModelCoordinates(OrbitViewInputSupport.OrbitViewState modelCoords)voidsetOrbitViewLimits(OrbitViewLimits viewLimits)Sets theOrbitViewLimitsthat will apply to thisOrbitView.voidsetOrientation(Position eyePosition, Position centerPosition)Sets the location of the eye, and the center of the screen in geographic coordinates.voidsetPitch(Angle pitch)Sets the pitch of the view.voidsetViewOutOfFocus(boolean b)Alerts the BasicOrbitView that the view requires the point of rotation for heading and pitch changes to be recalculated.voidsetZoom(double zoom)Set the zoom value for the OrbitVeiw.voidstopMovementOnCenter()Stop any changes to the center position.protected booleanvalidateModelCoordinates(OrbitViewInputSupport.OrbitViewState modelCoords)-
Methods inherited from class gov.nasa.worldwind.view.BasicView
addAnimator, apply, computeEyePositionFromModelview, computeFarClipDistance, computeHorizonDistance, computeNearClipDistance, computeNearDistance, computePixelSizeAtDistance, computePositionFromScreenPoint, computeRayFromScreenPoint, getCurrentForwardVector, getDC, getEyePoint, getEyePosition, getFarClipDistance, getFieldOfView, getForwardVector, getFrustum, getFrustumInModelCoordinates, getGlobe, getHeading, getHorizonDistance, getModelviewMatrix, getNearClipDistance, getPitch, getProjectionMatrix, getRestorableState, getRoll, getUpVector, getViewInputHandler, getViewport, getViewPropertyLimits, getViewStateID, goTo, hadCollisions, isAnimating, isDetectCollisions, loadGLViewState, popReferenceCenter, project, project, pushReferenceCenter, restoreState, setDetectCollisions, setFarClipDistance, setFieldOfView, setGlobe, setNearClipDistance, setReferenceCenter, setRoll, setViewInputHandler, setViewState, stopAnimations, stopMovement, unProject, unProject, updateModelViewStateID
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
Methods inherited from interface gov.nasa.worldwind.view.orbit.OrbitView
hadCollisions, isDetectCollisions, setDetectCollisions
-
Methods inherited from interface gov.nasa.worldwind.Restorable
getRestorableState, restoreState
-
Methods inherited from interface gov.nasa.worldwind.View
addAnimator, apply, computePixelSizeAtDistance, computePositionFromScreenPoint, computeRayFromScreenPoint, getEyePoint, getEyePosition, getFarClipDistance, getFieldOfView, getForwardVector, getFrustum, getFrustumInModelCoordinates, getGlobe, getHeading, getHorizonDistance, getModelviewMatrix, getNearClipDistance, getPitch, getProjectionMatrix, getRoll, getUpVector, getViewInputHandler, getViewport, getViewPropertyLimits, getViewStateID, goTo, isAnimating, popReferenceCenter, project, pushReferenceCenter, setFieldOfView, setReferenceCenter, setRoll, stopAnimations, stopMovement, unProject
-
-
-
-
Field Detail
-
center
protected Position center
-
zoom
protected double zoom
-
viewOutOfFocus
protected boolean viewOutOfFocus
-
collisionSupport
protected final OrbitViewCollisionSupport collisionSupport
-
-
Method Detail
-
loadConfigurationValues
protected void loadConfigurationValues()
-
flagHadCollisions
protected void flagHadCollisions()
-
stopMovementOnCenter
public void stopMovementOnCenter()
Description copied from interface:OrbitViewStop any changes to the center position.- Specified by:
stopMovementOnCenterin interfaceOrbitView
-
copyViewState
public void copyViewState(View view)
Description copied from interface:ViewCopy the state of the givenView.- Specified by:
copyViewStatein interfaceView- Overrides:
copyViewStatein classBasicView- Parameters:
view- TheViewwhose state is to be copied.
-
getCenterPosition
public Position getCenterPosition()
Description copied from interface:OrbitViewGet the center position of the OrbitView. The center position is used as the point about which the heading and pitch rotate. It is defined by the intersection of a ray from the eye position through the center of the viewport with the surface of the globe.- Specified by:
getCenterPositionin interfaceOrbitView- Overrides:
getCenterPositionin classBasicView- Returns:
- the center position.
-
getCenterPoint
public Vec4 getCenterPoint()
Description copied from interface:ViewGets the center point of the view.- Specified by:
getCenterPointin interfaceView- Overrides:
getCenterPointin classBasicView- Returns:
- the center point of the view if that point is on the globe, otherwise, return null
-
setCenterPosition
public void setCenterPosition(Position center)
Description copied from interface:OrbitViewSets the center position of the OrbitView. The center position is used as the point about which the heading and pitch rotate. It is defined by the intersection of a ray from the eye position through the center of the viewport with the surface of the globe.- Specified by:
setCenterPositionin interfaceOrbitView- Parameters:
center- The desired center position.
-
setHeading
public void setHeading(Angle heading)
Description copied from interface:ViewSets the heading of the view. The implementation may interpret this command in whatever way it chooses.- Specified by:
setHeadingin interfaceView- Overrides:
setHeadingin classBasicView- Parameters:
heading- The direction to aim the view in degrees
-
setPitch
public void setPitch(Angle pitch)
Description copied from interface:ViewSets the pitch of the view. The implementation may interpret pitch as it chooses
-
getZoom
public double getZoom()
Description copied from interface:OrbitViewGet the zoom value for the OrbitView. The zoom value is the distance between the eye position and the center position.
-
setZoom
public void setZoom(double zoom)
Description copied from interface:OrbitViewSet the zoom value for the OrbitVeiw. The zoom value is the distance between the eye position and the center position.
-
getOrbitViewLimits
public OrbitViewLimits getOrbitViewLimits()
Returns theOrbitViewLimitsthat apply to thisOrbitView. Incoming parameters to the methods setCenterPosition, setHeading, setPitch, or setZoom are be limited by the parameters defined in thisOrbitViewLimits.- Specified by:
getOrbitViewLimitsin interfaceOrbitView- Returns:
- the
OrbitViewLimitsthat apply to thisOrbitView
-
setOrbitViewLimits
public void setOrbitViewLimits(OrbitViewLimits viewLimits)
Sets theOrbitViewLimitsthat will apply to thisOrbitView. Incoming parameters to the methods setCenterPosition, setHeading, setPitch, or setZoom will be limited by the parameters defined inviewLimits.- Specified by:
setOrbitViewLimitsin interfaceOrbitView- Parameters:
viewLimits- theOrbitViewLimitsthat will apply to thisOrbitView.- Throws:
java.lang.IllegalArgumentException- ifviewLimitsis null.
-
normalizedCenterPosition
public static Position normalizedCenterPosition(Position unnormalizedPosition)
-
resolveCollisionsWithCenterPosition
protected void resolveCollisionsWithCenterPosition()
-
resolveCollisionsWithPitch
protected void resolveCollisionsWithPitch()
-
computeAndSetViewCenterIfNeeded
public void computeAndSetViewCenterIfNeeded()
Computes and sets the center of rotation for heading and pitch changes, if it is needed.
-
computeAndSetViewCenter
public void computeAndSetViewCenter()
Computes and sets the center of rotation for heading and pitch changes.
-
setViewOutOfFocus
public void setViewOutOfFocus(boolean b)
Alerts the BasicOrbitView that the view requires the point of rotation for heading and pitch changes to be recalculated.- Parameters:
b- true if the point of rotation needs recalculation, false if it does not.
-
canFocusOnViewportCenter
public boolean canFocusOnViewportCenter()
Determines if the BasicOrbitView can be focused on the viewport centerfocusOnViewportCenter(). Focusing on the viewport center requires a non-nullGlobe, a non-nullDrawContext, and the viewport center is on the terrain.- Specified by:
canFocusOnViewportCenterin interfaceOrbitView- Returns:
- true if the BasicOrbitView can focus on the viewport center.
-
focusOnViewportCenter
public void focusOnViewportCenter()
Sets the point of rotation for heading and pitch changes to the surface position at the viewport center.- Specified by:
focusOnViewportCenterin interfaceOrbitView
-
canFocusOnTerrainCenter
public boolean canFocusOnTerrainCenter()
-
focusOnTerrainCenter
public void focusOnTerrainCenter()
-
setEyePosition
public void setEyePosition(Position eyePosition)
Description copied from interface:ViewSets the geographic position of the eye.- Specified by:
setEyePositionin interfaceView- Overrides:
setEyePositionin classBasicView- Parameters:
eyePosition- the eye position.
-
getCurrentEyePoint
public Vec4 getCurrentEyePoint()
Description copied from interface:ViewReturns the most up-to-date location of the eye in cartesian coordinates. UnlikeView.getEyePosition()andView.getEyePoint(), getCurrentEyePoint will return the View's immediate position.- Specified by:
getCurrentEyePointin interfaceView- Overrides:
getCurrentEyePointin classBasicView- Returns:
- Vec4 of the eye.
-
getCurrentEyePosition
public Position getCurrentEyePosition()
Description copied from interface:ViewReturns the current geographic coordinates of this view's eye position, as determined from this view's current parameters.Note: The value returned is not necessarily the value specified to
View.setEyePosition(gov.nasa.worldwind.geom.Position)but is the eye position corresponding to this view's current parameters.- Specified by:
getCurrentEyePositionin interfaceView- Overrides:
getCurrentEyePositionin classBasicView- Returns:
- the position of the eye corresponding to the current parameters of this view.
-
setOrientation
public void setOrientation(Position eyePosition, Position centerPosition)
Description copied from interface:ViewSets the location of the eye, and the center of the screen in geographic coordinates. The implementation may interpret this command in whatever way it chooses, so long as the eye is placed at the specifiedeyePosition, and the center of the screen is the specifiedcenterPosition. Specifically, implementations must determine what the up direction will be given these parameters, and apply these parameters in a meaningful way.- Specified by:
setOrientationin interfaceView- Overrides:
setOrientationin classBasicView- Parameters:
eyePosition- Position of they eye.centerPosition- Position of the screen center.
-
doApply
protected void doApply(DrawContext dc)
-
afterDoApply
protected void afterDoApply()
-
setModelCoordinates
protected void setModelCoordinates(OrbitViewInputSupport.OrbitViewState modelCoords)
-
validateModelCoordinates
protected boolean validateModelCoordinates(OrbitViewInputSupport.OrbitViewState modelCoords)
-
computeHorizonDistance
protected double computeHorizonDistance(Position eyePosition)
- Overrides:
computeHorizonDistancein classBasicView
-
computeFarDistance
protected double computeFarDistance(Position eyePosition)
- Overrides:
computeFarDistancein classBasicView
-
doGetRestorableState
protected void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doGetRestorableStatein classBasicView
-
doRestoreState
protected void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
- Overrides:
doRestoreStatein classBasicView
-
legacyRestoreState
protected void legacyRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
Restores state values from previous versions of the BasicObitView state XML. These values are stored or named differently than the current implementation. Those values which have not changed are ignored here, and are restored indoRestoreState(gov.nasa.worldwind.util.RestorableSupport, gov.nasa.worldwind.util.RestorableSupport.StateObject).- Parameters:
rs- RestorableSupport object which contains the state value properties.context- active context in the RestorableSupport to read state from.
-
addPanToAnimator
public void addPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, long timeToMove, boolean endCenterOnSurface)
-
addPanToAnimator
public void addPanToAnimator(Position beginCenterPos, Position endCenterPos, Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch, double beginZoom, double endZoom, boolean endCenterOnSurface)
-
addPanToAnimator
public void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, long timeToMove, boolean endCenterOnSurface)
-
addPanToAnimator
public void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom, boolean endCenterOnSurface)
-
addPanToAnimator
public void addPanToAnimator(Position centerPos, Angle heading, Angle pitch, double zoom)
-
addEyePositionAnimator
public void addEyePositionAnimator(long timeToIterate, Position beginPosition, Position endPosition)
-
addHeadingPitchAnimator
public void addHeadingPitchAnimator(Angle beginHeading, Angle endHeading, Angle beginPitch, Angle endPitch)
-
addZoomAnimator
public void addZoomAnimator(double zoomStart, double zoomEnd)
-
addFlyToZoomAnimator
public void addFlyToZoomAnimator(Angle heading, Angle pitch, double zoomAmount)
-
-