public interface View extends WWObject, Restorable
View
interface provides a coordinate transformation from model coordinates to eye coordinates. This
follows the OpenGL convention of a right-handed coordinate system with the origin at the eye point and looking down
the negative Z axis. View
also provides a transformation from eye coordinates to screen coordinates,
following the OpenGL convention of an origin in the lower left hand screen corner.
Most of the accessor and computation methods on View
will use viewing state computed in the last call to
apply
.
The following methods return state values updated in the most recent call to apply.
getEyePosition
getEyePoint
getUpVector
getForwardVector
getModelviewMatrix
getViewport
getFrustum
getFrustumInModelCoordinates
getProjectionMatrix
The following methods return computed values using state that was updated in the most recent call to
apply
.
OrbitView
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VIEW_STOPPED |
Modifier and Type | Method and Description |
---|---|
void |
addAnimator(Animator animator)
Add an animator to the
View . |
void |
apply(DrawContext dc)
Calculates and applies this
View's internal state to the graphics context in the specified
dc . |
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 . |
Vec4 |
getCenterPoint()
Gets the center point of the view.
|
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 |
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.
|
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. |
java.awt.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 elevation)
Animate to the specified position.
|
boolean |
isAnimating()
Determine if there are any animations active in the
View . |
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. |
Matrix |
pushReferenceCenter(DrawContext dc,
Vec4 referenceCenter)
Defines and applies a new model-view matrix in which the world origin is located at
referenceCenter . |
void |
setEyePosition(Position eyePosition)
Sets the geographic position of the eye.
|
void |
setFieldOfView(Angle fieldOfView)
Sets the horizontal field-of-view angle (the angle of visibility) to the specified
fieldOfView . |
void |
setHeading(Angle heading)
Sets the heading of the view.
|
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 |
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. |
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
getRestorableState, restoreState
static final java.lang.String VIEW_STOPPED
void addAnimator(Animator animator)
View
. This method does not start the Animator
. Starting the Animator
is the
responsibility of the application.animator
- the Animator
to be addedvoid apply(DrawContext dc)
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.dc
- the current WorldWind DrawContext on which View
will apply its state.java.lang.IllegalArgumentException
- If dc
is null, or if the Globe
or GL
instances in dc
are null.double computePixelSizeAtDistance(double distance)
distance
- the distance in meters from the eye point. This value must be positive but is otherwise
unbounded.java.lang.IllegalArgumentException
- if distance
is negative.Position computePositionFromScreenPoint(double x, double y)
Globe
. Only the ellipsoid itself is considered; terrain elevations are not incorporated.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.Line computeRayFromScreenPoint(double x, double y)
View's
projection plane (or after projection into model space).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.View's
eye point and passing through (x, y) transformed into model
space.void copyViewState(View view)
View
.view
- The View
whose state is to be copied.Vec4 getCenterPoint()
Vec4 getCurrentEyePoint()
getEyePosition()
and
getEyePoint()
, getCurrentEyePoint will return the View's immediate position.Position getCurrentEyePosition()
Note: The value returned is not necessarily the value specified to setEyePosition(gov.nasa.worldwind.geom.Position)
but is the eye position corresponding to this view's current parameters.
Vec4 getEyePoint()
apply
.Position getEyePosition()
Note: The value returned is not necessarily the value specified to setEyePosition(gov.nasa.worldwind.geom.Position)
but is the eye position corresponding to this view's most recently applied state.
double getFarClipDistance()
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
Angle getFieldOfView()
Vec4 getForwardVector()
apply
.Frustum getFrustum()
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
.Frustum getFrustumInModelCoordinates()
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
.Globe getGlobe()
View.apply()
. View.getGlobe()
returns null if called before the first invocation of
View.apply()
.View.apply()
.Angle getHeading()
double getHorizonDistance()
Matrix getModelviewMatrix()
apply
.double getNearClipDistance()
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
Angle getPitch()
Matrix getProjectionMatrix()
View
. The method
getFrustum()
returns the geometry corresponding to this matrix. This value is computed in the most recent
call to apply
.Angle getRoll()
Vec4 getUpVector()
apply
.ViewInputHandler getViewInputHandler()
ViewInputHandler
being used to map input events to View
controls.ViewInputHandler
being used to map input events to View
controls.java.awt.Rectangle getViewport()
apply
.ViewPropertyLimits getViewPropertyLimits()
ViewPropertyLimits
for this view.ViewPropertyLimits
for this view.long getViewStateID()
void goTo(Position position, double elevation)
View
to look at
the given position from the given elevation.position
- The position to animate to.elevation
- The elevation to look at the position
from.boolean isAnimating()
View
.void popReferenceCenter(DrawContext dc)
dc
- the current WorldWind drawing context on which the original matrix will be restored.java.lang.IllegalArgumentException
- if dc
is null, or if the Globe
or GL
instances in dc
are null.Vec4 project(Vec4 modelPoint)
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.modelPoint
- the model coordinate Point
to project.Point
.java.lang.IllegalArgumentException
- if modelPoint
is null.Matrix pushReferenceCenter(DrawContext dc, Vec4 referenceCenter)
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 getModelviewMatrix()
will not return
reference-center model-view matrix, but the original matrix.dc
- the current WorldWind drawing context on which new model-view state will be applied.referenceCenter
- the location to become the new world origin.referenceCenter
, or null if this method failed.java.lang.IllegalArgumentException
- if referenceCenter
is null, if dc
is null, or if the
Globe
or GL
instances in dc
are null.void setEyePosition(Position eyePosition)
eyePosition
- the eye position.java.lang.IllegalArgumentException
- If eyePosition
is null.void setFieldOfView(Angle fieldOfView)
fieldOfView
. This
may be ignored if the implementation that do not support a field-of-view.fieldOfView
- the horizontal field-of-view angle.java.lang.IllegalArgumentException
- If the implementation supports field-of-view, and fieldOfView
is
null.void setHeading(Angle heading)
heading
- The direction to aim the view in degreesvoid setOrientation(Position eyePosition, Position centerPosition)
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.eyePosition
- Position of they eye.centerPosition
- Position of the screen center.void setPitch(Angle pitch)
pitch
- The pitch of the view.Matrix setReferenceCenter(DrawContext dc, Vec4 referenceCenter)
dc
- the drawing context.referenceCenter
- the new reference centerreferenceCenter
, or null if this method failed.java.lang.IllegalArgumentException
- if referenceCenter
is null, if dc
is null, or if the
Globe
or GL
instances in dc
are null.pushReferenceCenter(gov.nasa.worldwind.render.DrawContext, gov.nasa.worldwind.geom.Vec4)
void setRoll(Angle roll)
roll
- New roll. May not be null.void stopAnimations()
View
void stopMovement()
View
.Vec4 unProject(Vec4 windowPoint)
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.windowPoint
- the window coordinate Point
to project.Point
.java.lang.IllegalArgumentException
- if windowPoint
is null.