NASA World Wind

gov.nasa.worldwind.view
Class BasicView

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.view.BasicView
All Implemented Interfaces:
AVList, MessageListener, Restorable, View, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
BasicFlyView, BasicOrbitView

public class BasicView
extends WWObjectImpl
implements View

A base class from which View implementations can be derived. Currently BasicFlyView and BasicOrbitView are both derived from BasicView BasicView models the view in terms of a geographic position, and a pitch, heading, and roll. It provides a mapping from that geocentric view model to a 3D graphics modelview matrix. BasicView also manages the projection matrix via a Frustum.

The view model is based on


Field Summary
protected static int COLLISION_NUM_ITERATIONS
           
protected static double COLLISION_THRESHOLD
           
protected  DrawContext dc
           
protected static double DEFAULT_DEPTH_RESOLUTION
          The views's default worst-case depth resolution, in meters.
protected  boolean detectCollisions
           
protected  Position eyePosition
           
protected  double farClipDistance
           
protected  Angle fieldOfView
          The field of view in degrees.
protected  Frustum frustum
           
protected  Globe globe
           
protected  boolean hadCollisions
           
protected  Angle heading
           
protected  double horizonDistance
           
protected  Vec4 lastEyePoint
           
protected  Position lastEyePosition
           
protected  Vec4 lastForwardVector
           
protected  Frustum lastFrustumInModelCoords
           
protected  Vec4 lastUpVector
           
protected static double MINIMUM_FAR_DISTANCE
           
protected static double MINIMUM_NEAR_DISTANCE
           
protected  Matrix modelview
           
protected  Matrix modelviewInv
           
protected  double nearClipDistance
           
protected  Angle pitch
           
protected  Matrix projection
           
protected  Angle roll
           
protected  ViewInputHandler viewInputHandler
           
protected  ViewPropertyLimits viewLimits
           
protected  Rectangle viewport
           
protected  long viewStateID
          Identifier for the modelview matrix state.
 
Fields inherited from interface gov.nasa.worldwind.View
VIEW_STOPPED
 
Constructor Summary
BasicView()
          Construct a BasicView
 
Method Summary
 void addAnimator(Animator animator)
          Add an animator to the this View.
 void apply(DrawContext dc)
          Calculates and applies this View's internal state to the graphics context in the specified dc.
protected  Position computeEyePositionFromModelview()
           
protected  double computeFarClipDistance()
           
protected  double computeFarDistance(Position eyePosition)
           
protected  double computeHorizonDistance()
           
protected  double computeHorizonDistance(Position eyePosition)
           
protected  double computeNearClipDistance()
           
protected  double computeNearDistance(Position eyePosition)
           
 double computePixelSizeAtDistance(double distance)
          Computes the dimension (in meters) that a screen pixel would cover at a given distance from the eye point (also in meters).
 Position computePositionFromScreenPoint(double x, double y)
          Computes the intersection of a line originating from the eye point and passing through (x, y) with the Globe.
 Line computeRayFromScreenPoint(double x, double y)
          Computes a line, in model coordinates, originating from the eye point, and passing through the point contained by (x, y) on the View's projection plane (or after projection into model space).
 void copyViewState(View view)
          Copy the state of the given View.
protected  void doApply(DrawContext dc)
           
protected  void doGetRestorableState(RestorableSupport rs, RestorableSupport.StateObject context)
           
protected  void doRestoreState(RestorableSupport rs, RestorableSupport.StateObject context)
           
 Vec4 getCenterPoint()
          Gets the center point of the view.
 Position getCenterPosition()
           
 Vec4 getCurrentEyePoint()
          Returns the most up-to-date location of the eye in cartesian coordinates.
 Position getCurrentEyePosition()
          Returns the current geographic coordinates of this view's eye position, as determined from this view's current parameters.
 Vec4 getCurrentForwardVector()
          Returns the most up-to-date forward vector.
 DrawContext getDC()
           
 Vec4 getEyePoint()
          Returns the location of the eye in cartesian coordinates.
 Position getEyePosition()
          Returns the current geographic coordinates of this view's eye position, as computed for the most recent model traversal.
 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.
 Globe getGlobe()
          Gets the globe associated with this view.
 Angle getHeading()
          Returns the view's current heading.
 double getHorizonDistance()
          Returns the horizon distance for this view's most recently used eye position.
 Matrix getModelviewMatrix()
          Returns the modelview matrix.
 double getNearClipDistance()
          Returns the near clipping plane distance, in eye coordinates.
 Angle getPitch()
          Returns the view's current pitch.
 Matrix getProjectionMatrix()
          Gets the projection matrix.
 String getRestorableState()
          Returns an XML document string describing the object's state.
 Angle getRoll()
          Returns this View's current roll.
 Vec4 getUpVector()
          Returns the up axis in cartesian coordinates.
 ViewInputHandler getViewInputHandler()
          Gets the ViewInputHandler being used to map input events to View controls.
 Rectangle getViewport()
          Returns the bounds (x, y, width, height) of the viewport.
 ViewPropertyLimits getViewPropertyLimits()
          Get the ViewPropertyLimits for this view.
 long getViewStateID()
          Get an identifier for the current state of the modelview matrix.
 void goTo(Position position, double distance)
          Animate to the specified position.
 boolean hadCollisions()
           
 boolean isAnimating()
          Determine if there are any animations active in the View.
 boolean isDetectCollisions()
           
static void loadGLViewState(DrawContext dc, Matrix modelview, Matrix projection)
          Sets the the opengl modelview and projection matrices to the given matrices.
 void popReferenceCenter(DrawContext dc)
          Removes the model-view matrix on top of the matrix stack, and restores the original matrix.
 Vec4 project(Vec4 modelPoint)
          Maps a Point in model (cartesian) coordinates to a Point in screen coordinates.
 Vec4 project(Vec4 point, Matrix modelview, Matrix projection, Rectangle viewport)
          Transforms the specified object coordinates into window coordinates using the given modelview and projection matrices, and viewport.
 Matrix pushReferenceCenter(DrawContext dc, Vec4 referenceCenter)
          Defines and applies a new model-view matrix in which the world origin is located at referenceCenter.
 void restoreState(String stateInXml)
          Restores the object's state to what is described in the specified XML document string.
 void setDetectCollisions(boolean detectCollisions)
           
 void setEyePosition(Position eyePosition)
          Sets the geographic position of the eye.
protected  void setFarClipDistance(double clipDistance)
           
 void setFieldOfView(Angle fieldOfView)
          Sets the horizontal field-of-view angle (the angle of visibility) to the specified fieldOfView.
 void setGlobe(Globe globe)
          Set the globe associated with this view.
 void setHeading(Angle heading)
          Sets the heading of the view.
protected  void setNearClipDistance(double clipDistance)
           
 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)
          Sets the pitch of the view.
 Matrix setReferenceCenter(DrawContext dc, Vec4 referenceCenter)
          Sets the reference center matrix without pushing the stack.
 void setRoll(Angle roll)
          Set the roll of the view.
 void setViewInputHandler(ViewInputHandler viewInputHandler)
           
protected  void setViewState(ViewUtil.ViewState modelCoords)
           
 void stopAnimations()
          Stops any animations that are active in this View
 void stopMovement()
          Stops any movement associated with this View.
 Vec4 unProject(Vec4 windowPoint)
          Maps a Point in screen coordinates to a Point in model coordinates.
 Vec4 unProject(Vec4 windowPoint, Matrix modelview, Matrix projection, Rectangle viewport)
          Maps the given window coordinates into model coordinates using the given matrices and viewport.
protected  void updateModelViewStateID()
          Update the modelview state identifier.
 
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, finalize, 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 java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

COLLISION_NUM_ITERATIONS

protected static final int COLLISION_NUM_ITERATIONS
See Also:
Constant Field Values

COLLISION_THRESHOLD

protected static final double COLLISION_THRESHOLD
See Also:
Constant Field Values

dc

protected DrawContext dc

DEFAULT_DEPTH_RESOLUTION

protected static final double DEFAULT_DEPTH_RESOLUTION
The views's default worst-case depth resolution, in meters. May be specified in the World Wind configuration file as the gov.nasa.worldwind.avkey.DepthResolution property. The default if not specified in the configuration is 3.0 meters.


detectCollisions

protected boolean detectCollisions

eyePosition

protected Position eyePosition

farClipDistance

protected double farClipDistance

fieldOfView

protected Angle fieldOfView
The field of view in degrees.


frustum

protected Frustum frustum

globe

protected Globe globe

hadCollisions

protected boolean hadCollisions

heading

protected Angle heading

horizonDistance

protected double horizonDistance

lastEyePoint

protected Vec4 lastEyePoint

lastEyePosition

protected Position lastEyePosition

lastForwardVector

protected Vec4 lastForwardVector

lastFrustumInModelCoords

protected Frustum lastFrustumInModelCoords

lastUpVector

protected Vec4 lastUpVector

MINIMUM_FAR_DISTANCE

protected static final double MINIMUM_FAR_DISTANCE
See Also:
Constant Field Values

MINIMUM_NEAR_DISTANCE

protected static final double MINIMUM_NEAR_DISTANCE
See Also:
Constant Field Values

modelview

protected Matrix modelview

modelviewInv

protected Matrix modelviewInv

nearClipDistance

protected double nearClipDistance

pitch

protected Angle pitch

projection

protected Matrix projection

roll

protected Angle roll

viewInputHandler

protected ViewInputHandler viewInputHandler

viewLimits

protected ViewPropertyLimits viewLimits

viewport

protected Rectangle viewport

viewStateID

protected long viewStateID
Identifier for the modelview matrix state. This number is incremented when one of the fields that affects the modelview matrix is set.

Constructor Detail

BasicView

public BasicView()
Construct a BasicView

Method Detail

addAnimator

public void addAnimator(Animator animator)
Add an animator to the this View. The View does not start the animator.

Specified by:
addAnimator in interface View
Parameters:
animator - the Animator to be added

apply

public void apply(DrawContext dc)
Description copied from interface: View
Calculates and applies this View's internal state to the graphics context in the specified dc. All subsequently rendered objects use this new state. Upon return, the OpenGL graphics context reflects the values of this view, as do any computed values of the view, such as the modelview matrix, projection matrix and viewing frustum.

Specified by:
apply in interface View
Parameters:
dc - the current World Wind DrawContext on which View will apply its state.

computeEyePositionFromModelview

protected Position computeEyePositionFromModelview()

computeFarClipDistance

protected double computeFarClipDistance()

computeFarDistance

protected double computeFarDistance(Position eyePosition)

computeHorizonDistance

protected double computeHorizonDistance()

computeHorizonDistance

protected double computeHorizonDistance(Position eyePosition)

computeNearClipDistance

protected double computeNearClipDistance()

computeNearDistance

protected double computeNearDistance(Position eyePosition)

computePixelSizeAtDistance

public double computePixelSizeAtDistance(double distance)
Description copied from interface: View
Computes the dimension (in meters) that a screen pixel would cover at a given distance from the eye point (also in meters). The distance is interpreted as the linear distance between the eye point and the world point in question. This computation assumes that pixels dimensions are square, and therefore returns a single dimension.

Specified by:
computePixelSizeAtDistance in interface View
Parameters:
distance - the distance in meters from the eye point. 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 and passing through (x, y) with the Globe. Only the ellipsoid itself is considered; terrain elevations are not incorporated.

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 coordinates.

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 through 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 through (x, y) transformed into model space.

copyViewState

public void copyViewState(View view)
Description copied from interface: View
Copy the state of the given View.

Specified by:
copyViewState in interface View
Parameters:
view - The View whose state is to be copied.

doApply

protected void doApply(DrawContext dc)

doGetRestorableState

protected void doGetRestorableState(RestorableSupport rs,
                                    RestorableSupport.StateObject context)

doRestoreState

protected void doRestoreState(RestorableSupport rs,
                              RestorableSupport.StateObject context)

getCenterPoint

public Vec4 getCenterPoint()
Description copied from interface: View
Gets the center point of the view.

Specified by:
getCenterPoint in interface View
Returns:
the center point of the view if that point is on the globe, otherwise, return null

getCenterPosition

public Position getCenterPosition()

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 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:
getCurrentEyePosition in interface View
Returns:
the position of the eye corresponding to the current parameters of this view.

getCurrentForwardVector

public Vec4 getCurrentForwardVector()
Returns the most up-to-date forward vector. Unlike getForwardVector(), this method will return the View's immediate forward vector.

Returns:
Vec4 of the forward axis.

getDC

public DrawContext getDC()

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 current geographic coordinates of this view's eye position, as computed for the most recent model traversal.

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 most recently applied state.

Specified by:
getEyePosition in interface View
Returns:
the position of the eye corresponding to the most recent application of this view, or null if the view has not yet been applied.

getFarClipDistance

public double getFarClipDistance()
Description copied from interface: View
Returns the far clipping plane distance, in eye coordinates. Implementations of the View interface are not required to have a method for setting the near and far distance. Applications that need to control the near and far clipping distances can derive from BasicOrbitView or BasicFlyView

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.

getGlobe

public Globe getGlobe()
Description copied from interface: View
Gets the globe associated with this view. The Globe is updated at the beginning of each frame, during View.apply(). View.getGlobe() returns null if called before the first invocation of View.apply().

Specified by:
getGlobe in interface View
Returns:
the globe being rendered by this view, or null before the first invocation of View.apply().

getHeading

public Angle getHeading()
Description copied from interface: View
Returns the view's current heading.

Specified by:
getHeading in interface View
Returns:
Angle of the view's heading.

getHorizonDistance

public double getHorizonDistance()
Description copied from interface: View
Returns the horizon distance for this view's most recently used eye position. The eye position changes when this view changes, so the horizon distance also changes when this view changes. The value returned is the value used during the most recent model traversal.

Specified by:
getHorizonDistance in interface View
Returns:
the horizon position, in meters, or 0 if this view has not yet been applied.

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. Implementations of the View interface are not required to have a method for setting the near and far distance. Applications that need to control the near and far clipping distances can derive from BasicOrbitView or BasicFlyView

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

getPitch

public Angle getPitch()
Description copied from interface: View
Returns the view's current pitch.

Specified by:
getPitch in interface View
Returns:
Angle of the view's pitch.

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 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.

getRoll

public Angle getRoll()
Description copied from interface: View
Returns this View's current roll.

Specified by:
getRoll in interface View
Returns:
Angle of the view's roll.

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.

getViewInputHandler

public ViewInputHandler getViewInputHandler()
Description copied from interface: View
Gets the ViewInputHandler being used to map input events to View controls.

Specified by:
getViewInputHandler in interface View
Returns:
the ViewInputHandler being used to map input events to View controls.

getViewport

public 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.

getViewPropertyLimits

public ViewPropertyLimits getViewPropertyLimits()
Description copied from interface: View
Get the ViewPropertyLimits for this view.

Specified by:
getViewPropertyLimits in interface View
Returns:
the ViewPropertyLimits for this view.

getViewStateID

public long getViewStateID()
Get an identifier for the current state of the modelview matrix. The modelview matrix transforms model coordinates to eye coordinates. This identifier can be used to determine if the view has changed state since a previous frame.

Specified by:
getViewStateID in interface View
Returns:
an identifier for the current modelview matrix state.

goTo

public void goTo(Position position,
                 double distance)
Description copied from interface: View
Animate to the specified position. The implementation is expected to animate the View to look at the given position from the given elevation.

Specified by:
goTo in interface View
Parameters:
position - The position to animate to.
distance - The elevation to look at the position from.

hadCollisions

public boolean hadCollisions()

isAnimating

public boolean isAnimating()
Description copied from interface: View
Determine if there are any animations active in the View.

Specified by:
isAnimating in interface View
Returns:
true if there are active animations, false otherwise.

isDetectCollisions

public boolean isDetectCollisions()

loadGLViewState

public static void loadGLViewState(DrawContext dc,
                                   Matrix modelview,
                                   Matrix projection)
Sets the the opengl modelview and projection matrices to the given matrices.

Parameters:
dc - the drawing context
modelview - the modelview matrix
projection - the projection matrix

popReferenceCenter

public void popReferenceCenter(DrawContext dc)
Removes the model-view matrix on top of the matrix stack, and restores the original matrix.

Specified by:
popReferenceCenter in interface View
Parameters:
dc - the current World Wind drawing context on which the original matrix will be restored.
Throws:
IllegalArgumentException - if dc is null, or if the Globe or GL instances in dc are null.

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 successfully 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.

project

public Vec4 project(Vec4 point,
                    Matrix modelview,
                    Matrix projection,
                    Rectangle viewport)
Transforms the specified object coordinates into window coordinates using the given modelview and projection matrices, and viewport.

Parameters:
point - The object coordinate to transform
modelview - The modelview matrix
projection - The projection matrix
viewport - The viewport
Returns:
the transformed coordinates

pushReferenceCenter

public Matrix pushReferenceCenter(DrawContext dc,
                                  Vec4 referenceCenter)
Description copied from interface: View
Defines and applies a new model-view matrix in which the world origin is located at referenceCenter. Geometry rendered after a call to pushReferenceCenter should be transformed with respect to referenceCenter, rather than the canonical origin (0, 0, 0). Calls to pushReferenceCenter must be followed by popReferenceCenter after rendering is complete. Note that calls to View.getModelviewMatrix() will not return reference-center model-view matrix, but the original matrix.

Specified by:
pushReferenceCenter in interface View
Parameters:
dc - the current World Wind drawing context on which new model-view state will be applied.
referenceCenter - the location to become the new world origin.
Returns:
a new model-view matrix with origin is at referenceCenter, or null if this method failed.

restoreState

public void restoreState(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.

setDetectCollisions

public void setDetectCollisions(boolean detectCollisions)

setEyePosition

public void setEyePosition(Position eyePosition)
Description copied from interface: View
Sets the geographic position of the eye.

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

setFarClipDistance

protected void setFarClipDistance(double clipDistance)

setFieldOfView

public void setFieldOfView(Angle fieldOfView)
Description copied from interface: View
Sets the horizontal field-of-view angle (the angle of visibility) 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.

setGlobe

public void setGlobe(Globe globe)
Set the globe associated with this view. Note that the globe is reset each frame.

Parameters:
globe - New globe.

setHeading

public void setHeading(Angle heading)
Description copied from interface: View
Sets the heading of the view. The implementation may interpret this command in whatever way it chooses.

Specified by:
setHeading in interface View
Parameters:
heading - The direction to aim the view in degrees

setNearClipDistance

protected void setNearClipDistance(double clipDistance)

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 chooses, so long as the eye is placed at the specified eyePosition, and the center of the screen is the specified centerPosition. 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)
Description copied from interface: View
Sets the pitch of the view. The implementation may interpret pitch as it chooses

Specified by:
setPitch in interface View
Parameters:
pitch - The pitch of the view.

setReferenceCenter

public Matrix setReferenceCenter(DrawContext dc,
                                 Vec4 referenceCenter)
Description copied from interface: View
Sets the reference center matrix without pushing the stack.

Specified by:
setReferenceCenter in interface View
Parameters:
dc - the drawing context.
referenceCenter - the new reference center
Returns:
a new model-view matrix with origin is at referenceCenter, or null if this method failed.
See Also:
View.pushReferenceCenter(gov.nasa.worldwind.render.DrawContext, gov.nasa.worldwind.geom.Vec4)

setRoll

public void setRoll(Angle roll)
Description copied from interface: View
Set the roll of the view. The implementation may interpret roll as it chooses.

Specified by:
setRoll in interface View
Parameters:
roll - New roll. May not be null.

setViewInputHandler

public void setViewInputHandler(ViewInputHandler viewInputHandler)

setViewState

protected void setViewState(ViewUtil.ViewState modelCoords)

stopAnimations

public void stopAnimations()
Description copied from interface: View
Stops any animations that are active in this View

Specified by:
stopAnimations in interface View

stopMovement

public void stopMovement()
Description copied from interface: View
Stops any movement associated with this View.

Specified by:
stopMovement in interface View

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 successfully 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.

unProject

public Vec4 unProject(Vec4 windowPoint,
                      Matrix modelview,
                      Matrix projection,
                      Rectangle viewport)
Maps the given window coordinates into model coordinates using the given matrices and viewport.

Parameters:
windowPoint - the window point
modelview - the modelview matrix
projection - the projection matrix
viewport - the window viewport
Returns:
the unprojected point

updateModelViewStateID

protected void updateModelViewStateID()
Update the modelview state identifier. This method should be called whenever one of the fields that affects the modelview matrix is changed.


NASA World Wind