NASA World Wind

gov.nasa.worldwind.view
Class BasicOrbitView

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.view.AbstractView
              extended by gov.nasa.worldwind.view.BasicOrbitView
All Implemented Interfaces:
AVList, Restorable, View, OrbitView, WWObject, java.beans.PropertyChangeListener, java.util.EventListener
Direct Known Subclasses:
FlatOrbitView

public class BasicOrbitView
extends AbstractView
implements OrbitView


Field Summary
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Fields inherited from interface gov.nasa.worldwind.view.OrbitView
CENTER_STOPPED
 
Fields inherited from interface gov.nasa.worldwind.View
VIEW_STOPPED
 
Constructor Summary
BasicOrbitView()
           
BasicOrbitView(OrbitViewModel orbitViewModel)
           
 
Method Summary
protected  void afterDoApply()
           
 boolean canFocusOnViewportCenter()
           
 double computeHorizonDistance()
          Gets the distance from the View's eye point to the horizon point on the last rendered Globe.
 double computePixelSizeAtDistance(double distance)
          Computes the screen-aligned dimension (in meters) that a screen pixel would cover at a given distance (also in meters).
 Position computePositionFromScreenPoint(double x, double y)
          Computes the intersection of a line originating from the eye point (passing throught (x, y)) with the last rendered SectorGeometry, or the last analytical Globe if no rendered geometry exists.
 Line computeRayFromScreenPoint(double x, double y)
          Computes a line, in model coordinates, originating from the eye point, and passing throught the point contained by (x, y) on the View's projection plane (or after projection into model space).
protected  void doApply(DrawContext dc)
           
 void focusOnViewportCenter()
           
 double getAutoFarClipDistance()
          Returns the auto-configured far clipping plane distance, in eye coordinates.
 double getAutoNearClipDistance()
          Returns the auto-configured near clipping plane distance, in eye coordinates.
 Position getCenterPosition()
           
 Vec4 getCurrentEyePoint()
          Returns the most up-to-date location of the eye in cartesian coordinates.
 Position getCurrentEyePosition()
          Returns the most up-to-date location of the eye in geographic coordintes.
 Vec4 getEyePoint()
          Returns the location of the eye in cartesian coordinates.
 Position getEyePosition()
          Returns the location of the eye in geographic coordinates.
 double getFarClipDistance()
          Returns the far clipping plane distance, in eye coordinates.
 Angle getFieldOfView()
          Returns the horizontal field-of-view angle (the angle of visibility), or null if the implementation does not support a field-of-view.
 Vec4 getForwardVector()
          Returns the forward axis in cartesian coordinates.
 Frustum getFrustum()
          Returns the viewing Frustum in eye coordinates.
 Frustum getFrustumInModelCoordinates()
          Returns the viewing Frustum in model coordinates.
 Angle getHeading()
           
 Matrix getModelviewMatrix()
          Returns the modelview matrix.
 double getNearClipDistance()
          Returns the near clipping plane distance, in eye coordinates.
 OrbitViewModel getOrbitViewModel()
           
 Angle getPitch()
           
 Matrix getProjectionMatrix()
          Gets the projection matrix.
 java.lang.String getRestorableState()
          Returns an XML document string describing the object?s state.
 Vec4 getUpVector()
          Returns the up axis in cartesian coordinates.
 java.awt.Rectangle getViewport()
          Returns the bounds (x, y, width, height) of the viewport.
 double getZoom()
           
 Vec4 project(Vec4 modelPoint)
          Maps a Point in model (cartesian) coordinates to a Point in screen coordinates.
 void restoreState(java.lang.String stateInXml)
          Restores the object?s state to what is described in the specified XML document string.
 void setCenterPosition(Position center)
           
 void setEyePosition(Position eyePosition)
          Sets the location of the eye in geographic coordinates.
 void setFarClipDistance(double distance)
          Sets the far clipping plane distance, in eye coordinates.
 void setFieldOfView(Angle fieldOfView)
          Sets the horiziontal field-of-view angle (the angle of visibillity) to the specified fieldOfView.
 void setHeading(Angle heading)
           
 void setNearClipDistance(double distance)
          Sets the near clipping plane distance, in eye coordinates.
 void setOrientation(Position eyePosition, Position centerPosition)
          Sets the location of the eye, and the center of the screen in geographic coordinates.
 void setPitch(Angle pitch)
           
 void setZoom(double zoom)
           
 void stopMovementOnCenter()
           
 Vec4 unProject(Vec4 windowPoint)
          Maps a Point in screen coordinates to a Point in model coordinates.
 
Methods inherited from class gov.nasa.worldwind.view.AbstractView
apply, applyStateIterator, flagHadCollisions, hadCollisions, hasStateIterator, isDetectCollisions, popReferenceCenter, pushReferenceCenter, setDetectCollisions, stopMovement, stopStateIterators
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.View
apply, applyStateIterator, hadCollisions, hasStateIterator, isDetectCollisions, popReferenceCenter, pushReferenceCenter, setDetectCollisions, stopMovement, stopStateIterators
 
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 java.beans.PropertyChangeListener
propertyChange
 

Constructor Detail

BasicOrbitView

public BasicOrbitView()

BasicOrbitView

public BasicOrbitView(OrbitViewModel orbitViewModel)
Method Detail

afterDoApply

protected void afterDoApply()

canFocusOnViewportCenter

public boolean canFocusOnViewportCenter()
Specified by:
canFocusOnViewportCenter in interface OrbitView

computeHorizonDistance

public double computeHorizonDistance()
Description copied from interface: View
Gets the distance from the View's eye point to the horizon point on the last rendered Globe.

Specified by:
computeHorizonDistance in interface View
Returns:
the distance from the eye point to the horizon.

computePixelSizeAtDistance

public double computePixelSizeAtDistance(double distance)
Description copied from interface: View
Computes the screen-aligned dimension (in meters) that a screen pixel would cover at a given distance (also in meters). This computation assumes that pixels dimensions are square, and therefore returns a single dimension.

Specified by:
computePixelSizeAtDistance in interface View
Parameters:
distance - the distance from the eye point, in eye coordinates, along the z-axis. This value must be positive but is otherwise unbounded.
Returns:
the dimension of a pixel (in meters) at the given distance.

computePositionFromScreenPoint

public Position computePositionFromScreenPoint(double x,
                                               double y)
Description copied from interface: View
Computes the intersection of a line originating from the eye point (passing throught (x, y)) with the last rendered SectorGeometry, or the last analytical Globe if no rendered geometry exists.

Specified by:
computePositionFromScreenPoint in interface View
Parameters:
x - the horizontal coordinate originating from the left side of View's projection plane.
y - the vertical coordinate originating from the top of View's projection plane.
Returns:
the point on the surface in polar coordiantes.

computeRayFromScreenPoint

public Line computeRayFromScreenPoint(double x,
                                      double y)
Description copied from interface: View
Computes a line, in model coordinates, originating from the eye point, and passing throught the point contained by (x, y) on the View's projection plane (or after projection into model space).

Specified by:
computeRayFromScreenPoint in interface View
Parameters:
x - the horizontal coordinate originating from the left side of View's projection plane.
y - the vertical coordinate originating from the top of View's projection plane.
Returns:
a line beginning at the View's eye point and passing throught (x, y) transformed into model space.

doApply

protected void doApply(DrawContext dc)
Specified by:
doApply in class AbstractView

focusOnViewportCenter

public void focusOnViewportCenter()
Specified by:
focusOnViewportCenter in interface OrbitView

getAutoFarClipDistance

public double getAutoFarClipDistance()
Description copied from interface: View
Returns the auto-configured far clipping plane distance, in eye coordinates. The distance is implementation dependent, and should be based on the View's current position and orientation.

Specified by:
getAutoFarClipDistance in interface View
Returns:
auto-configured far clipping plane distance.

getAutoNearClipDistance

public double getAutoNearClipDistance()
Description copied from interface: View
Returns the auto-configured near clipping plane distance, in eye coordinates. The distance is implementation dependent, and should be based on the View's current position and orientation.

Specified by:
getAutoNearClipDistance in interface View
Returns:
auto-configured near clipping plane distance.

getCenterPosition

public Position getCenterPosition()
Specified by:
getCenterPosition in interface OrbitView

getCurrentEyePoint

public Vec4 getCurrentEyePoint()
Description copied from interface: View
Returns the most up-to-date location of the eye in cartesian coordinates. Unlike View.getEyePosition() and View.getEyePoint(), getCurrentEyePoint will return the View's immediate position.

Specified by:
getCurrentEyePoint in interface View
Returns:
Vec4 of the eye.

getCurrentEyePosition

public Position getCurrentEyePosition()
Description copied from interface: View
Returns the most up-to-date location of the eye in geographic coordintes. Unlike View.getEyePosition() and View.getEyePoint(), getCurrentEyePosition will return the View's immediate position.

Specified by:
getCurrentEyePosition in interface View
Returns:
Position of the eye.

getEyePoint

public Vec4 getEyePoint()
Description copied from interface: View
Returns the location of the eye in cartesian coordinates. This value is computed in the most recent call to apply.

Specified by:
getEyePoint in interface View
Returns:
Vec4 of the eye.

getEyePosition

public Position getEyePosition()
Description copied from interface: View
Returns the location of the eye in geographic coordinates. This value is computed in the most recent call to apply.

Specified by:
getEyePosition in interface View
Returns:
Position of the eye.

getFarClipDistance

public double getFarClipDistance()
Description copied from interface: View
Returns the far clipping plane distance, in eye coordinates. If the far clipping plane is auto-configured by the View, this will still return the value last specified by the caller. To get the auto-configured value, see View.getAutoFarClipDistance()

Specified by:
getFarClipDistance in interface View
Returns:
far clipping plane distance, in eye coordinates.

getFieldOfView

public Angle getFieldOfView()
Description copied from interface: View
Returns the horizontal field-of-view angle (the angle of visibility), or null if the implementation does not support a field-of-view.

Specified by:
getFieldOfView in interface View
Returns:
Angle of the horizontal field-of-view, or null if none exists.

getForwardVector

public Vec4 getForwardVector()
Description copied from interface: View
Returns the forward axis in cartesian coordinates. This value is computed in the most recent call to apply.

Specified by:
getForwardVector in interface View
Returns:
Vec4 of the forward axis.

getFrustum

public Frustum getFrustum()
Description copied from interface: View
Returns the viewing Frustum in eye coordinates. The Frustum is the portion of viewable space defined by three sets of parallel 'clipping' planes. This value is computed in the most recent call to apply.

Specified by:
getFrustum in interface View
Returns:
viewing Frustum in eye coordinates.

getFrustumInModelCoordinates

public Frustum getFrustumInModelCoordinates()
Description copied from interface: View
Returns the viewing Frustum in model coordinates. Model coordinate frustums are useful for performing visibility tests against world geometry. This frustum has the same shape as the frustum returned in getFrustum, but it has been transformed into model space. This value is computed in the most recent call to apply.

Specified by:
getFrustumInModelCoordinates in interface View
Returns:
viewing Frustum in model coordinates.

getHeading

public Angle getHeading()
Specified by:
getHeading in interface OrbitView

getModelviewMatrix

public Matrix getModelviewMatrix()
Description copied from interface: View
Returns the modelview matrix. The modelview matrix transforms model coordinates to eye coordinates. This matrix is constructed using the model space translation and orientation specific to each the implementation. This value is computed in the most recent call to apply.

Specified by:
getModelviewMatrix in interface View
Returns:
the current model-view matrix.

getNearClipDistance

public double getNearClipDistance()
Description copied from interface: View
Returns the near clipping plane distance, in eye coordinates. If the near clipping plane is auto-configured by the View, this will still return the value last specified by the caller. To get the auto-configured value, see View.getAutoNearClipDistance().

Specified by:
getNearClipDistance in interface View
Returns:
near clipping plane distance, in eye coordinates.

getOrbitViewModel

public OrbitViewModel getOrbitViewModel()
Specified by:
getOrbitViewModel in interface OrbitView

getPitch

public Angle getPitch()
Specified by:
getPitch in interface OrbitView

getProjectionMatrix

public Matrix getProjectionMatrix()
Description copied from interface: View
Gets the projection matrix. The projection matrix transforms eye coordinates to screen coordinates. This matrix is constructed using the projection parameters specific to each implementation of View. The method View.getFrustum() returns the geometry corresponding to this matrix. This value is computed in the most recent call to apply.

Specified by:
getProjectionMatrix in interface View
Returns:
the current projection matrix.

getRestorableState

public java.lang.String getRestorableState()
Description copied from interface: Restorable
Returns an XML document string describing the object?s state. This state can be restored later by calling restoreState and passing the XML document.

Specified by:
getRestorableState in interface Restorable
Returns:
an XML document string describing the object's state.

getUpVector

public Vec4 getUpVector()
Description copied from interface: View
Returns the up axis in cartesian coordinates. This value is computed in the most recent call to apply.

Specified by:
getUpVector in interface View
Returns:
Vec4 of the up axis.

getViewport

public java.awt.Rectangle getViewport()
Description copied from interface: View
Returns the bounds (x, y, width, height) of the viewport. The implementation will configure itself to render in this viewport. This value is computed in the most recent call to apply.

Specified by:
getViewport in interface View
Returns:
the Rectangle of the viewport.

getZoom

public double getZoom()
Specified by:
getZoom in interface OrbitView

project

public Vec4 project(Vec4 modelPoint)
Description copied from interface: View
Maps a Point in model (cartesian) coordinates to a Point in screen coordinates. The returned x and y are relative to the lower left hand screen corner, while z is the screen depth-coordinate. If the model point cannot be sucessfully mapped, this will return null.

Specified by:
project in interface View
Parameters:
modelPoint - the model coordinate Point to project.
Returns:
the mapped screen coordinate Point.

restoreState

public void restoreState(java.lang.String stateInXml)
Description copied from interface: Restorable
Restores the object?s state to what is described in the specified XML document string.

Specified by:
restoreState in interface Restorable
Parameters:
stateInXml - an XML document string describing an object's state.

setCenterPosition

public void setCenterPosition(Position center)
Specified by:
setCenterPosition in interface OrbitView

setEyePosition

public void setEyePosition(Position eyePosition)
Description copied from interface: View
Sets the location of the eye in geographic coordinates. The implementation may interpret this command in whatever way it chooses, so long as the eye is placed at the specified eyePosition.

Specified by:
setEyePosition in interface View
Parameters:
eyePosition - Position of the eye.

setFarClipDistance

public void setFarClipDistance(double distance)
Description copied from interface: View
Sets the far clipping plane distance, in eye coordinates. Implementations may restrict the range of valid distances. When the caller specifies an invalid distance, implementations may interpret this as an indicator to auto-configure the far clipping distance. Otherwise, specifying an invalid distance will cause an IllegalArgumentException to be thrown.

Specified by:
setFarClipDistance in interface View
Parameters:
distance - the far clipping plane distance.

setFieldOfView

public void setFieldOfView(Angle fieldOfView)
Description copied from interface: View
Sets the horiziontal field-of-view angle (the angle of visibillity) to the specified fieldOfView. This may be ignored if the implementation that do not support a field-of-view.

Specified by:
setFieldOfView in interface View
Parameters:
fieldOfView - the horizontal field-of-view angle.

setHeading

public void setHeading(Angle heading)
Specified by:
setHeading in interface OrbitView

setNearClipDistance

public void setNearClipDistance(double distance)
Description copied from interface: View
Sets the near clipping plane distance, in eye coordinates. Implementations may restrict the range of valid distances. When the caller specifies an invalid distance, implementations may interpret this as an indicator to auto-configure the near clipping distance. Otherwise, specifying an invalid distance will cause an IllegalArgumentException to be thrown.

Specified by:
setNearClipDistance in interface View
Parameters:
distance - the near clipping plane distance.

setOrientation

public void setOrientation(Position eyePosition,
                           Position centerPosition)
Description copied from interface: View
Sets the location of the eye, and the center of the screen in geographic coordinates. The implementation may interpret this command in whatever way it choooses, so long as the eye is placed at the specified eyePosition, and the center of the screen is the specified centerPositoin. Specifically, implementations must determine what the up direction will be given these parameters, and apply these parameters in a meaningful way.

Specified by:
setOrientation in interface View
Parameters:
eyePosition - Position of they eye.
centerPosition - Position of the screen center.

setPitch

public void setPitch(Angle pitch)
Specified by:
setPitch in interface OrbitView

setZoom

public void setZoom(double zoom)
Specified by:
setZoom in interface OrbitView

stopMovementOnCenter

public void stopMovementOnCenter()
Specified by:
stopMovementOnCenter in interface OrbitView

unProject

public Vec4 unProject(Vec4 windowPoint)
Description copied from interface: View
Maps a Point in screen coordinates to a Point in model coordinates. The input x and y are relative to the lower left hand screen corner, while z is the screen depth-coordinate. If the screen point cannot be sucessfully mapped, this will return null.

Specified by:
unProject in interface View
Parameters:
windowPoint - the window coordinate Point to project.
Returns:
the mapped screen coordinate Point.

NASA World Wind