|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface View
The View interface provides basic methods for implementations to communicate state and state chages to
the caller. Views provide a coordinate transformation from the object coordinates of the model to eye
coordinates, which follow the OpenGL convention of a left-handed coordinate system with origin at the eye point and
looking down the negative-z axis.
setFieldOfView(gov.nasa.worldwind.geom.Angle), goToCoordinate(gov.nasa.worldwind.geom.LatLon, double), goToLatLon(gov.nasa.worldwind.geom.LatLon) or goToAltitude(double) are not guaranteed to produce the requested transformation. When exact
knowledge of these values in necessary, calling getFieldOfView(), getPosition() or getAltitude()
immediately after a call to apply(gov.nasa.worldwind.DrawContext) guarantees the value to be synchronized with data structures used for view
transformation (e.g. model-view and projection matrices).
Views contain both fixed state and computed state. The computed state is typically updated during a call to the
apply(gov.nasa.worldwind.DrawContext) method. Most accessor methods in this interface return the computed state that was set during the most
recent call to apply().
Frustum,
ViewFrustum| Method Summary | |
|---|---|
void |
apply(DrawContext dc)
Calculates and applies View's internal state to the graphics context in DrawContext. |
double |
computeHorizonDistance()
Returns 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). |
double |
getAltitude()
Returns the View eye altitude (in meters) above the last rendered SectorGeometry, or
the analytical Globe, depending on the implementation. |
Point |
getEyePoint()
Returns the eye position in model coordinates. |
Angle |
getFieldOfView()
Returns the horizontal field-of-view angle (the angle of visibility) associated with this View, or
null if the View implementation does not support a field-of-view. |
Point |
getForwardVector()
Returns the View z-axis orientation in model coordinates. |
Frustum |
getFrustum()
Returns the viewing Frustum in eye coordinates, computed in apply(). |
Frustum |
getFrustumInModelCoordinates()
Returns the viewing Frustum transformed to model coordinates. |
Angle |
getHeading()
Returns the View's angle from true North. |
Matrix4 |
getModelViewMatrix()
Returns the 'model-view' matrix computed in apply(), which transforms model coordinates to eye
coordinates (where the eye is located at the origin, facing down the negative-z axis). |
Angle |
getPitch()
Returns the View's angle from the plane tangent to the surface. |
Angle[] |
getPitchConstraints()
Returns a two-dimensional array containing the range of angles (inclusive) the View may limit
its pitch to, if pitch constraints are enabled. |
Position |
getPosition()
Returns the geographic (latitude, longitude, elevation) coordinate of the View's eye point. |
Matrix4 |
getProjectionMatrix()
Returns the 'projection' matrix computed in apply(), which transforms eye coordinates to homogeneous
clip coordinates (a box of dimension (2, 2, 2) centered at the origin). |
Angle |
getRoll()
Returns the View's angle about its local z-axis. |
Point |
getUpVector()
Returns the View y-axis orientation in model coordinates. |
Rectangle |
getViewport()
Returns a Rectangle representing the window bounds (x, y, width, height) of the viewport, computed in apply(). |
double |
getZoom()
Returns the View's translation in its forward direction. |
double[] |
getZoomConstraints()
Returns a two-dimensional array containing the range of values (inclusive) the View may limit
its zoom to, if zoom constraints are enabled. |
void |
goToAltitude(double newAltitude)
Moves the View eye point to the new altitude (in meters) above the last rendered
SectorGeometry, or the analytical Globe, depending on the implementation. |
void |
goToCoordinate(LatLon newLatLon,
double newAltitude)
Moves the View eye point to the new polar coordinate (latitude, longitude, elevation). |
void |
goToLatLon(LatLon newLatLon)
Moves the View eye point to the new geographic (latitude, longitude) coordinate. |
boolean |
isEnablePitchConstraints()
Returns true when pitch constraints are enabled. |
boolean |
isEnableZoomConstraints()
Returns true when zoom constraints are enabled. |
void |
popReferenceCenter(DrawContext dc)
Removes the model-view matrix on top of the matrix stack, and restores the matrix now on top. |
Point |
project(Point modelPoint)
Maps a Point in model (cartesian) coordinates to a Point in screen coordinates. |
void |
pushReferenceCenter(DrawContext dc,
Point referenceCenter)
Generates a new coordinate system in which the View does not move, and model coordinates are reverse
transformed into eye coordinates. |
void |
setEnablePitchConstraints(boolean enabled)
Enable or disable pitch constraints. |
void |
setEnableZoomConstraints(boolean enabled)
Enable or disable zoom constraints. |
void |
setFieldOfView(Angle newFov)
Sets the horiziontal field-of-view angle (the angle of visibillity) associated with this View. |
void |
setHeading(Angle newHeading)
Sets the View's angle to true North. |
void |
setPitch(Angle newPitch)
Sets the View's angle to the plane tangent to the surface. |
void |
setPitchConstraints(Angle newMinPitch,
Angle newMaxPitch)
Sets the range of angles (inclusive) the View may limit its pitch to, if pitch constraints are
enabled. |
void |
setRoll(Angle newRoll)
Sets the View's angle about its local z-axis. |
void |
setZoom(double newZoom)
Sets the View's translation in its forward direction. |
void |
setZoomConstraints(double newMinZoom,
double newMaxZoom)
Sets the range of values (inclusive) the View may limit its zoom to, if zoom constraints are
enabled. |
Point |
unProject(Point windowPoint)
Maps a Point in screen coordinates to a Point in model coordinates. |
| Methods inherited from interface gov.nasa.worldwind.AVList |
|---|
addPropertyChangeListener, addPropertyChangeListener, copy, firePropertyChange, firePropertyChange, getStringValue, getValue, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue |
| Methods inherited from interface java.beans.PropertyChangeListener |
|---|
propertyChange |
| Method Detail |
|---|
void apply(DrawContext dc)
View's internal state to the graphics context in DrawContext.
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 model-view matrix and
Frustum.
dc - the current World Wind drawing context on which View's state will apply.
IllegalArgumentException - if dc is null, or if the Globe or GL
contained in dc is null.double computeHorizonDistance()
View's eye point to the horizon point on the last rendered
Globe.
double computePixelSizeAtDistance(double distance)
distance - the distance from the eye point, in eye coordinates, along the z-axis. This value must be
positive but is otherwise unbounded.
IllegalArgumentException - if distance is negative.
Position computePositionFromScreenPoint(double x,
double y)
SectorGeometry, or the last analytical Globe if no rendered geometry exists.
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 throught (x, y) transformed into model
space.double getAltitude()
View eye altitude (in meters) above the last rendered SectorGeometry, or
the analytical Globe, depending on the implementation.
View's altitude (in meters) above the surface.Point getEyePoint()
Angle getFieldOfView()
View, or
null if the View implementation does not support a field-of-view.
Point getForwardVector()
View z-axis orientation in model coordinates.
Frustum getFrustum()
Frustum in eye coordinates, computed in apply(). The
Frustum is the portion of viewable space defined by three sets of parallel 'clipping' planes. The
method getFrustumInModelCoordinates() maintains the shape of this Frustum, but it has been
translated and aligned with the eye in model space.
Frustum getFrustumInModelCoordinates()
Frustum transformed to model coordinates. Model coordinate frustums are useful
for performing multiple intersection tests in model coordinates.
Angle getHeading()
View's angle from true North.
Matrix4 getModelViewMatrix()
apply(), which transforms model coordinates to eye
coordinates (where the eye is located at the origin, facing down the negative-z axis). This matrix is constructed
using the model space translation and orientation specific to each implementation of View.
Angle getPitch()
View's angle from the plane tangent to the surface.
Angle[] getPitchConstraints()
View may limit
its pitch to, if pitch constraints are enabled.
Position getPosition()
View's eye point. Latitude
and longitude represent the coordinate directly beneath (or above) the View, while elevation
represents the View altitude above the analytical Globe radius.
Matrix4 getProjectionMatrix()
apply(), which transforms eye coordinates to homogeneous
clip coordinates (a box of dimension (2, 2, 2) centered at the origin). This matrix is constructed using the
projection parameters specific to each implementation of View (e.g. field-of-view, clipping plane
distances). The getFrustum() method returns the planes corresponding to this matrix.
Angle getRoll()
View's angle about its local z-axis.
Point getUpVector()
View y-axis orientation in model coordinates.
Rectangle getViewport()
apply(). Implementations of View will configure themselves to render in this viewport.
double getZoom()
View's translation in its forward direction.
double[] getZoomConstraints()
View may limit
its zoom to, if zoom constraints are enabled.
void goToAltitude(double newAltitude)
View eye point to the new altitude (in meters) above the last rendered
SectorGeometry, or the analytical Globe, depending on the implementation.
newAltitude - the new eye altitude (in meters) above the surface,
void goToCoordinate(LatLon newLatLon,
double newAltitude)
View eye point to the new polar coordinate (latitude, longitude, elevation).
newLatLon - the new latitude and longitude of the eye point.newAltitude - the new eye altitude (in meters) above the surface,
IllegalArgumentException - if newLatlon is null.void goToLatLon(LatLon newLatLon)
View eye point to the new geographic (latitude, longitude) coordinate. Altitude is left
unchanged.
newLatLon - the new latitude and longitude of the eye point.
IllegalArgumentException - if newLatlon is null.boolean isEnablePitchConstraints()
boolean isEnableZoomConstraints()
void popReferenceCenter(DrawContext dc)
apply(), this method will
throw an exception.
dc - the current World Wind drawing context on which View's state will apply.
IllegalStateException - if the the refernce matrix stack is empty.Point project(Point 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 sucessfully mapped, this will return null.
modelPoint - the model coordinate Point to project.
Point.
IllegalArgumentException - if modelPoint is null.
void pushReferenceCenter(DrawContext dc,
Point referenceCenter)
View does not move, and model coordinates are reverse
transformed into eye coordinates. The origin for these coordinates will be referenceCenter,
therefore all objects drawn after a call to pushReferenceCenter should be with respect to this
Point, rather than the customary origin (0, 0, 0). This creates a new model-view matrix, which is
placed on the top of a matrix stack, and immediately applied to the current OpenGL context. In order to return to
the original coordinate space, callers should invoke popReferenceCenter(gov.nasa.worldwind.DrawContext) after rendering is complete.
Note that calls to getModelViewMatrix() will not return reference-center model-view matrix, but the
original matrix.
dc - the current World Wind drawing context on which View's state will apply.referenceCenter - the Point to become the new model space origin.
IllegalArgumentException - if referenceCenter is null.void setEnablePitchConstraints(boolean enabled)
enabled - true when pitch constraints should be enabled, false otherwise.void setEnableZoomConstraints(boolean enabled)
enabled - trhe when zoom constraints should be enabled, false otherwise.void setFieldOfView(Angle newFov)
View. This
call may be ignored by implementations that do not support a field-of-view.
newFov - the new horizontal field-of-view angle.
IllegalArgumentException - if newFov is null.void setHeading(Angle newHeading)
View's angle to true North.
newHeading - the new angle to true North.
IllegalArgumentException - if newHeading is null.void setPitch(Angle newPitch)
View's angle to the plane tangent to the surface.
newPitch - the new angle to the surface tangent plane.
IllegalArgumentException - if newPitch is null.
void setPitchConstraints(Angle newMinPitch,
Angle newMaxPitch)
View may limit its pitch to, if pitch constraints are
enabled.
newMinPitch - the minimum pitch angle.newMaxPitch - the maximum pitch angle.void setRoll(Angle newRoll)
View's angle about its local z-axis.
newRoll - the new angle about the local z-axis.
IllegalArgumentException - if newRoll is null.void setZoom(double newZoom)
View's translation in its forward direction.
newZoom - translation along the forward direction.
void setZoomConstraints(double newMinZoom,
double newMaxZoom)
View may limit its zoom to, if zoom constraints are
enabled.
newMinZoom - the minimum zoom value.newMaxZoom - the maximum zoom value.Point unProject(Point 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 sucessfully mapped, this will return null.
windowPoint - the window coordinate Point to project.
Point.
IllegalArgumentException - if windowPoint is null.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||