NASA World Wind

gov.nasa.worldwind.view
Class AbstractView

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

public abstract class AbstractView
extends WWObjectImpl
implements View


Field Summary
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Fields inherited from interface gov.nasa.worldwind.View
VIEW_STOPPED
 
Constructor Summary
AbstractView()
           
 
Method Summary
 void apply(DrawContext dc)
          Calculates and applies this View's internal state to the graphics context in the specified dc.
 void applyStateIterator(ViewStateIterator viewStateIterator)
          Iterates over View state changes in ViewStateIterator and applies them to the View.
protected abstract  void doApply(DrawContext dc)
           
protected  void flagHadCollisions()
           
 boolean hadCollisions()
          Returns whether or not a collision has occurred since the last call to hadCollisions.
 boolean hasStateIterator()
          Returns true when View is actively iterating over an instance of ViewStateIterator.
 boolean isDetectCollisions()
          Returns whether the this View will detect collisions with other objects, such as the surface geometry.
 void popReferenceCenter(DrawContext dc)
          Removes the model-view matrix on top of the matrix stack, and restores the original matrix.
 Matrix pushReferenceCenter(DrawContext dc, Vec4 referenceCenter)
          Defines and applies a new model-view matrix in which the world origin is located at referenceCenter.
 void setDetectCollisions(boolean detectCollisions)
          Sets whether or not this View will detect collisions with other objects, such as the surface geometry.
 void stopMovement()
          Stops any movement associated with this View.
 void stopStateIterators()
          Immediately stops all active iteration over ViewStateIterator.
 
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
computeHorizonDistance, computePixelSizeAtDistance, computePositionFromScreenPoint, computeRayFromScreenPoint, getAutoFarClipDistance, getAutoNearClipDistance, getCurrentEyePoint, getCurrentEyePosition, getEyePoint, getEyePosition, getFarClipDistance, getFieldOfView, getForwardVector, getFrustum, getFrustumInModelCoordinates, getModelviewMatrix, getNearClipDistance, getProjectionMatrix, getUpVector, getViewport, project, setEyePosition, setFarClipDistance, setFieldOfView, setNearClipDistance, setOrientation, unProject
 
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.Restorable
getRestorableState, restoreState
 

Constructor Detail

AbstractView

public AbstractView()
Method Detail

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.

applyStateIterator

public void applyStateIterator(ViewStateIterator viewStateIterator)
Description copied from interface: View
Iterates over View state changes in ViewStateIterator and applies them to the View. The View will automatically refresh and request state from viewStateIterator until the iteration is complete, or View has been stopped by invoking View.stopStateIterators().

Specified by:
applyStateIterator in interface View
Parameters:
viewStateIterator - the ViewStateIterator to iterate over.

doApply

protected abstract void doApply(DrawContext dc)

flagHadCollisions

protected void flagHadCollisions()

hadCollisions

public boolean hadCollisions()
Description copied from interface: View
Returns whether or not a collision has occurred since the last call to hadCollisions. If View.isDetectCollisions() is false, collisions will not be detected and hadCollisions will always return false.

Specified by:
hadCollisions in interface View
Returns:
true if a collision has occurred since the last call; false otherwise.

hasStateIterator

public boolean hasStateIterator()
Description copied from interface: View
Returns true when View is actively iterating over an instance of ViewStateIterator.

Specified by:
hasStateIterator in interface View
Returns:
true when iterating over ViewStateIterator; false otherwise.

isDetectCollisions

public boolean isDetectCollisions()
Description copied from interface: View
Returns whether the this View will detect collisions with other objects, such as the surface geometry. If true, implementations may also automatically resolve any detected collisions.

Specified by:
isDetectCollisions in interface View
Returns:
true If this View will detect collisions; false otherwise.

popReferenceCenter

public void popReferenceCenter(DrawContext dc)
Description copied from interface: View
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.

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 View.popReferenceCenter(gov.nasa.worldwind.render.DrawContext) 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.

setDetectCollisions

public void setDetectCollisions(boolean detectCollisions)
Description copied from interface: View
Sets whether or not this View will detect collisions with other objects, such as the surface geometry. If detectCollisions is true, implementations may also automatically resolve any detected collisions.

Specified by:
setDetectCollisions in interface View
Parameters:
detectCollisions - If true, this View will resolve collisions; otherwise this View will ignore collisions.

stopMovement

public void stopMovement()
Description copied from interface: View
Stops any movement associated with this View. This will stop any currently active ViewStateIterators on this View.

Specified by:
stopMovement in interface View

stopStateIterators

public void stopStateIterators()
Description copied from interface: View
Immediately stops all active iteration over ViewStateIterator.

Specified by:
stopStateIterators in interface View

NASA World Wind