NASA World Wind

gov.nasa.worldwind.render
Class DrawContextImpl

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.DrawContextImpl
All Implemented Interfaces:
AVList, Disposable, DrawContext, WWObject, PropertyChangeListener, EventListener

public class DrawContextImpl
extends WWObjectImpl
implements DrawContext


Field Summary
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Fields inherited from interface gov.nasa.worldwind.render.DrawContext
HIGH_PRIORITY, LOW_PRIORITY
 
Constructor Summary
DrawContextImpl()
           
 
Method Summary
 void addOrderedRenderable(OrderedRenderable orderedRenderable)
           
 void addPickedObject(PickedObject pickedObject)
          Adds a single insatnce of the picked object to the current picked-object list
 void addPickedObjects(PickedObjectList pickedObjects)
          Add picked objects to the current list of picked objects.
 void disablePickingMode()
          Disables color picking mode
 void dispose()
          Free internal resources held by this draw context.
 void drawUnitQuad()
           
 void drawUnitQuad(TextureCoords texCoords)
           
 void enablePickingMode()
          Enables color picking mode
 AnnotationRenderer getAnnotationRenderer()
           
 Color getClearColor()
           
 int getDrawableHeight()
          Retrieves the drawable height of this DrawContext.
 int getDrawableWidth()
          Retrieves the drawable width of this DrawContext.
 SurfaceTileRenderer getGeographicSurfaceTileRenderer()
           
 GL getGL()
          Retrieves the current javax.media.opengl.GL.
 GLContext getGLContext()
          Retrieves this DrawContexts javax.media.opengl.GLContext.
 GLDrawable getGLDrawable()
          Retrieves the currentjavax.media.opengl.GLDrawable.
 Globe getGlobe()
          Retrieves the current Globe, which may be null.
 GLU getGLU()
          Retrieves the current javax.media.opengl.glu.GLU.
 LayerList getLayers()
          Retrieves a list containing all the current layers.
 Model getModel()
          Retrieves the current Model, which may be null.
 int getNumTextureUnits()
           
 Queue<OrderedRenderable> getOrderedRenderables()
           
 Collection<PerformanceStatistic> getPerFrameStatistics()
           
 Set<String> getPerFrameStatisticsKeys()
           
 PickedObjectList getPickedObjects()
          Returns the list of objects picked during the most recent pick traversal.
 Point getPickPoint()
           
 Vec4 getPointOnGlobe(Angle latitude, Angle longitude)
           
 SectorGeometryList getSurfaceGeometry()
          Retrieves a list of all the sectors rendered so far this frame.
 TextRendererCache getTextRendererCache()
           
 TextureCache getTextureCache()
           
 Color getUniquePickColor()
          Returns a unique color to serve as a pick identifier during picking.
 double getVerticalExaggeration()
          Retrieves the current vertical exaggeration.
 View getView()
          Retrieves the current View, which may be null.
 Vec4 getViewportCenterGlobePoint()
           
 Position getViewportCenterPosition()
           
 Point getViewportCenterScreenPoint()
           
 Vec4 getViewportCenterSurfacePoint()
           
 Sector getVisibleSector()
          Retrieves a Sector which is at least as large as the current visible sector.
 void initialize(GLContext glContext)
          Initializes this DrawContext.
 boolean isPickingMode()
          Returns true if the Picking mode is active, otherwise return false
 void reinitialize()
           
 void setAnnotationRenderer(AnnotationRenderer ar)
           
 void setGLContext(GLContext glContext)
          Assigns this DrawContext a new javax.media.opengl.GLContext.
 void setModel(Model model)
          Assign a new Model.
 void setNumTextureUnits(int numTextureUnits)
           
 void setPerFrameStatistic(String key, String displayName, Object value)
           
 void setPerFrameStatistics(Collection<PerformanceStatistic> stats)
           
 void setPerFrameStatisticsKeys(Set<String> statKeys, Collection<PerformanceStatistic> stats)
           
 void setPickPoint(Point pickPoint)
           
 void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
           
 void setTextRendererCache(TextRendererCache textRendererCache)
           
 void setTextureCache(TextureCache textureCache)
           
 void setVerticalExaggeration(double verticalExaggeration)
          Sets the vertical exaggeration.
 void setView(View view)
          Assigns a new View.
 void setViewportCenterPosition(Position viewportCenterPosition)
           
 void setViewportCenterScreenPoint(Point viewportCenterScreenPoint)
           
 void setVisibleSector(Sector s)
          Sets the visible Sector.
 
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.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

DrawContextImpl

public DrawContextImpl()
Method Detail

addOrderedRenderable

public void addOrderedRenderable(OrderedRenderable orderedRenderable)
Specified by:
addOrderedRenderable in interface DrawContext

addPickedObject

public void addPickedObject(PickedObject pickedObject)
Adds a single insatnce of the picked object to the current picked-object list

Specified by:
addPickedObject in interface DrawContext
Parameters:
pickedObject - the object to add
Throws:
IllegalArgumentException - if picked Object is null

addPickedObjects

public void addPickedObjects(PickedObjectList pickedObjects)
Add picked objects to the current list of picked objects.

Specified by:
addPickedObjects in interface DrawContext
Parameters:
pickedObjects - the list of picked objects to add
Throws:
IllegalArgumentException - if pickedObjects is null

disablePickingMode

public void disablePickingMode()
Disables color picking mode

Specified by:
disablePickingMode in interface DrawContext

dispose

public void dispose()
Free internal resources held by this draw context. A GL context must be current when this method is called.

Specified by:
dispose in interface Disposable
Throws:
javax.media.opengl.GLException - - If an OpenGL context is not current when this method is called.

drawUnitQuad

public void drawUnitQuad()
Specified by:
drawUnitQuad in interface DrawContext

drawUnitQuad

public void drawUnitQuad(TextureCoords texCoords)
Specified by:
drawUnitQuad in interface DrawContext

enablePickingMode

public void enablePickingMode()
Enables color picking mode

Specified by:
enablePickingMode in interface DrawContext

getAnnotationRenderer

public AnnotationRenderer getAnnotationRenderer()
Specified by:
getAnnotationRenderer in interface DrawContext

getClearColor

public Color getClearColor()
Specified by:
getClearColor in interface DrawContext

getDrawableHeight

public final int getDrawableHeight()
Description copied from interface: DrawContext
Retrieves the drawable height of this DrawContext.

Specified by:
getDrawableHeight in interface DrawContext
Returns:
the drawable height of this DrawCOntext

getDrawableWidth

public final int getDrawableWidth()
Description copied from interface: DrawContext
Retrieves the drawable width of this DrawContext.

Specified by:
getDrawableWidth in interface DrawContext
Returns:
the drawable width of this DrawCOntext

getGeographicSurfaceTileRenderer

public SurfaceTileRenderer getGeographicSurfaceTileRenderer()
Specified by:
getGeographicSurfaceTileRenderer in interface DrawContext

getGL

public final GL getGL()
Description copied from interface: DrawContext
Retrieves the current javax.media.opengl.GL. A GL or GLU is required for all graphical rendering in World Wind Raptor.

Specified by:
getGL in interface DrawContext
Returns:
the current GL if available, null otherwise

getGLContext

public final GLContext getGLContext()
Description copied from interface: DrawContext
Retrieves this DrawContexts javax.media.opengl.GLContext. If this method returns null, then there are potentially no active GLContexts and rendering should be aborted.

Specified by:
getGLContext in interface DrawContext
Returns:
this DrawContexts javax.media.opengl.GLContext.

getGLDrawable

public final GLDrawable getGLDrawable()
Description copied from interface: DrawContext
Retrieves the currentjavax.media.opengl.GLDrawable. A GLDrawable can be used to create a GLContext, which can then be used for rendering.

Specified by:
getGLDrawable in interface DrawContext
Returns:
the current GLDrawable, null if none available

getGlobe

public final Globe getGlobe()
Description copied from interface: DrawContext
Retrieves the current Globe, which may be null.

Specified by:
getGlobe in interface DrawContext
Returns:
the current Globe, which may be null

getGLU

public final GLU getGLU()
Description copied from interface: DrawContext
Retrieves the current javax.media.opengl.glu.GLU. A GLU or GL is required for all graphical rendering in World Wind Raptor.

Specified by:
getGLU in interface DrawContext
Returns:
the current GLU if available, null otherwise

getLayers

public final LayerList getLayers()
Description copied from interface: DrawContext
Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.

Specified by:
getLayers in interface DrawContext
Returns:
a LayerList containing all the current layers

getModel

public final Model getModel()
Description copied from interface: DrawContext
Retrieves the current Model, which may be null.

Specified by:
getModel in interface DrawContext
Returns:
the current Model, which may be null

getNumTextureUnits

public int getNumTextureUnits()
Specified by:
getNumTextureUnits in interface DrawContext

getOrderedRenderables

public Queue<OrderedRenderable> getOrderedRenderables()
Specified by:
getOrderedRenderables in interface DrawContext

getPerFrameStatistics

public Collection<PerformanceStatistic> getPerFrameStatistics()
Specified by:
getPerFrameStatistics in interface DrawContext

getPerFrameStatisticsKeys

public Set<String> getPerFrameStatisticsKeys()
Specified by:
getPerFrameStatisticsKeys in interface DrawContext

getPickedObjects

public PickedObjectList getPickedObjects()
Description copied from interface: DrawContext
Returns the list of objects picked during the most recent pick traversal.

Specified by:
getPickedObjects in interface DrawContext
Returns:
the list of picked objects

getPickPoint

public Point getPickPoint()
Specified by:
getPickPoint in interface DrawContext

getPointOnGlobe

public Vec4 getPointOnGlobe(Angle latitude,
                            Angle longitude)
Specified by:
getPointOnGlobe in interface DrawContext

getSurfaceGeometry

public SectorGeometryList getSurfaceGeometry()
Description copied from interface: DrawContext
Retrieves a list of all the sectors rendered so far this frame.

Specified by:
getSurfaceGeometry in interface DrawContext
Returns:
a SectorGeometryList containing every SectorGeometry rendered so far this render pass.

getTextRendererCache

public TextRendererCache getTextRendererCache()
Specified by:
getTextRendererCache in interface DrawContext

getTextureCache

public TextureCache getTextureCache()
Specified by:
getTextureCache in interface DrawContext

getUniquePickColor

public Color getUniquePickColor()
Description copied from interface: DrawContext
Returns a unique color to serve as a pick identifier during picking.

Specified by:
getUniquePickColor in interface DrawContext
Returns:
a unique pick color

getVerticalExaggeration

public final double getVerticalExaggeration()
Description copied from interface: DrawContext
Retrieves the current vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying Globe. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.

Specified by:
getVerticalExaggeration in interface DrawContext
Returns:
the current vertical exaggeration

getView

public final View getView()
Description copied from interface: DrawContext
Retrieves the current View, which may be null.

Specified by:
getView in interface DrawContext
Returns:
the current View, which may be null

getViewportCenterGlobePoint

public Vec4 getViewportCenterGlobePoint()
Specified by:
getViewportCenterGlobePoint in interface DrawContext

getViewportCenterPosition

public Position getViewportCenterPosition()
Specified by:
getViewportCenterPosition in interface DrawContext

getViewportCenterScreenPoint

public Point getViewportCenterScreenPoint()
Specified by:
getViewportCenterScreenPoint in interface DrawContext

getViewportCenterSurfacePoint

public Vec4 getViewportCenterSurfacePoint()
Specified by:
getViewportCenterSurfacePoint in interface DrawContext

getVisibleSector

public final Sector getVisibleSector()
Description copied from interface: DrawContext
Retrieves a Sector which is at least as large as the current visible sector. The value returned is the value passed to SetVisibleSector. This method may return null.

Specified by:
getVisibleSector in interface DrawContext
Returns:
a Sector at least the size of the curernt visible sector, null if unavailable

initialize

public final void initialize(GLContext glContext)
Description copied from interface: DrawContext
Initializes this DrawContext. This method should be called at the beginning of each frame to prepare the DrawContext for the coming render pass.

Specified by:
initialize in interface DrawContext
Parameters:
glContext - the javax.media.opengl.GLContext to use for this render pass

isPickingMode

public boolean isPickingMode()
Returns true if the Picking mode is active, otherwise return false

Specified by:
isPickingMode in interface DrawContext
Returns:
true for Picking mode, otherwise false

reinitialize

public void reinitialize()

setAnnotationRenderer

public void setAnnotationRenderer(AnnotationRenderer ar)
Specified by:
setAnnotationRenderer in interface DrawContext

setGLContext

public final void setGLContext(GLContext glContext)
Description copied from interface: DrawContext
Assigns this DrawContext a new javax.media.opengl.GLContext. May throw a NullPointerException if glContext is null.

Specified by:
setGLContext in interface DrawContext
Parameters:
glContext - the new javax.media.opengl.GLContext

setModel

public final void setModel(Model model)
Description copied from interface: DrawContext
Assign a new Model. Some layers cannot function properly with a null Model. It is recommended that the Model is never set to null during a normal render pass.

Specified by:
setModel in interface DrawContext
Parameters:
model - the new Model

setNumTextureUnits

public void setNumTextureUnits(int numTextureUnits)
Specified by:
setNumTextureUnits in interface DrawContext

setPerFrameStatistic

public void setPerFrameStatistic(String key,
                                 String displayName,
                                 Object value)
Specified by:
setPerFrameStatistic in interface DrawContext

setPerFrameStatistics

public void setPerFrameStatistics(Collection<PerformanceStatistic> stats)
Specified by:
setPerFrameStatistics in interface DrawContext

setPerFrameStatisticsKeys

public void setPerFrameStatisticsKeys(Set<String> statKeys,
                                      Collection<PerformanceStatistic> stats)
Specified by:
setPerFrameStatisticsKeys in interface DrawContext

setPickPoint

public void setPickPoint(Point pickPoint)
Specified by:
setPickPoint in interface DrawContext

setSurfaceGeometry

public void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
Specified by:
setSurfaceGeometry in interface DrawContext

setTextRendererCache

public void setTextRendererCache(TextRendererCache textRendererCache)
Specified by:
setTextRendererCache in interface DrawContext

setTextureCache

public void setTextureCache(TextureCache textureCache)
Specified by:
setTextureCache in interface DrawContext

setVerticalExaggeration

public final void setVerticalExaggeration(double verticalExaggeration)
Description copied from interface: DrawContext
Sets the vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlying Globe. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.

Specified by:
setVerticalExaggeration in interface DrawContext
Parameters:
verticalExaggeration - the new vertical exaggeration.

setView

public final void setView(View view)
Description copied from interface: DrawContext
Assigns a new View. Some layers cannot function properly with a null View. It is recommended that the View is never set to null during a normal render pass.

Specified by:
setView in interface DrawContext
Parameters:
view - the enw View

setViewportCenterPosition

public void setViewportCenterPosition(Position viewportCenterPosition)
Specified by:
setViewportCenterPosition in interface DrawContext

setViewportCenterScreenPoint

public void setViewportCenterScreenPoint(Point viewportCenterScreenPoint)
Specified by:
setViewportCenterScreenPoint in interface DrawContext

setVisibleSector

public final void setVisibleSector(Sector s)
Description copied from interface: DrawContext
Sets the visible Sector. The new visible sector must completely encompass the Sector which is visible on the display.

Specified by:
setVisibleSector in interface DrawContext
Parameters:
s - the new visible Sector

NASA World Wind