NASA World Wind

gov.nasa.worldwind.render
Interface DrawContext

All Superinterfaces:
AVList, Disposable, EventListener, MessageListener, PropertyChangeListener, WWObject
All Known Implementing Classes:
DrawContextImpl

public interface DrawContext
extends WWObject, Disposable


Method Summary
 void addObjectInPickRectangle(PickedObject pickedObject)
          Adds the specified picked object to the current list of objects intersecting the pick rectangle.
 void addOrderedRenderable(OrderedRenderable orderedRenderable)
          Adds an OrderedRenderable to the draw context's ordered renderable list.
 void addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
          Adds an OrderedRenderable to the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables.
 void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
          Adds an OrderedRenderable to the draw context's ordered surface renderable queue.
 void addPickedObject(PickedObject pickedObject)
          Adds the specified picked object to the list of objects at the pick point.
 void addPickedObjects(PickedObjectList pickedObjects)
          Adds a list of picked objects to the current list of objects at the pick point.
 void addPickPointFrustum()
          Creates a frustum around the current pick point and adds it to the current list of pick frustums.
 void addPickRectangleFrustum()
          Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.
 void addRenderingException(Throwable t)
          Adds the specified Throwable to this DrawContext's collection of rendering exceptions.
 void addScreenCredit(ScreenCredit credit)
          Adds a screen-credit icon to display.
 void applyClutterFilter()
          Filter overlapping text from the ordered renderable list.
 void beginStandardLighting()
          Enables the current standard lighting model.
 Vec4 computePointFromPosition(Position position, int altitudeMode)
          Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.
 Vec4 computeTerrainPoint(Angle lat, Angle lon, double offset)
          Compute a model-coordinate point on the terrain.
 void disablePickingMode()
          Specifies that the scene controller has ended its pick traversal.
 void drawNormals(float length, FloatBuffer vBuf, FloatBuffer nBuf)
          This is a diagnostic method to display normal vectors.
 void drawOutlinedShape(OutlinedShape renderer, Object shape)
          Performs a multi-pass rendering technique to ensure that outlines around filled shapes are drawn correctly when blending or ant-aliasing is performed, and that filled portions of the shape resolve depth-buffer fighting with shapes previously drawn in favor of the current shape.
 void drawUnitQuad()
          Draws a quadrilateral using the current OpenGL state.
 void drawUnitQuad(TextureCoords texCoords)
          Draws a quadrilateral using the current OpenGL state and specified texture coordinates.
 void drawUnitQuadOutline()
          Draws a quadrilateral outline using the current OpenGL state.
 void enablePickingMode()
          Specifies that the scene controller is beginning its pick traversal.
 void endStandardLighting()
          Pops the OpenGL state previously established by beginStandardLighting().
 AnnotationRenderer getAnnotationRenderer()
          Returns the draw context's annotation renderer, typically used by annotations that are not contained in an AnnotationLayer.
 Color getClearColor()
          Returns the WorldWindow's background color.
 ClutterFilter getClutterFilter()
          Returns the current clutter filter.
 Layer getCurrentLayer()
          Returns the current-layer.
 DeclutteringTextRenderer getDeclutteringTextRenderer()
          Returns the draw context's decluttering text renderer.
 int getDrawableHeight()
          Indicates the height in pixels of the drawing target associated with this DrawContext.
 int getDrawableWidth()
          Indicates the width in pixels of the drawing target associated with this DrawContext.
 long getFrameTimeStamp()
          Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence.
 SurfaceTileRenderer getGeographicSurfaceTileRenderer()
          Returns this draw context's surface tile renderer.
 GL getGL()
          Retrieves the current javax.media.opengl.GL.
 GLContext getGLContext()
          Retrieves this DrawContexts javax.media.opengl.GLContext.
 GLDrawable getGLDrawable()
          Retrieves the current javax.media.opengl.GLDrawable.
 Globe getGlobe()
          Retrieves the current Globe, which may be null.
 GLRuntimeCapabilities getGLRuntimeCapabilities()
          Returns the GLRuntimeCapabilities associated with this DrawContext.
 GLU getGLU()
          Retrieves the current javax.media.opengl.glu.GLU.
 GpuResourceCache getGpuResourceCache()
          Returns the GPU resource cache used by this draw context.
 LayerList getLayers()
          Retrieves a list containing all the current layers.
 Model getModel()
          Retrieves the current Model, which may be null.
 PickedObjectList getObjectsInPickRectangle()
          Returns the list of objects intersecting the pick rectangle during the most recent pick traversal.
 Queue<OrderedRenderable> getOrderedSurfaceRenderables()
          Returns the draw context's ordered surface renderable queue.
 Collection<PerformanceStatistic> getPerFrameStatistics()
          Returns the performance statistics that are gathered during each frame.
 Set<String> getPerFrameStatisticsKeys()
          Indicates the statistics that are monitored for each frame.
 int getPickColorAtPoint(Point point)
          Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code.
 int[] getPickColorsInRectangle(Rectangle rectangle, int[] minAndMaxColorCodes)
          Returns an array of the unique framebuffer RGB colors within a rectangle in AWT screen coordinates, formatted as pick color codes.
 PickedObjectList getPickedObjects()
          Returns the list of objects at the pick point during the most recent pick traversal.
 PickPointFrustumList getPickFrustums()
          Gets the FrustumList containing all the current Pick Frustums
 Point getPickPoint()
          Returns the current pick point in AWT screen coordinates.
 Dimension getPickPointFrustumDimension()
          Gets the dimension of the current Pick Point Frustum
 Rectangle getPickRectangle()
          Returns the current pick rectangle in AWT screen coordinates.
 Vec4 getPointOnTerrain(Angle latitude, Angle longitude)
          Computes a location's Cartesian point on the currently visible terrain.
 int getRedrawRequested()
          Indicates whether a new frame should be generated by the SceneController.
 Collection<Throwable> getRenderingExceptions()
          Gets the rendering exceptions associated with this DrawContext as a Collection of Throwable objects.
 Map<ScreenCredit,Long> getScreenCredits()
          Returns the screen credits currently held and displayed by this draw context.
 LightingModel getStandardLightingModel()
          Returns the current model used for standard lighting.
 SectorGeometryList getSurfaceGeometry()
          Retrieves a list of all the sectors rendered so far this frame.
 Terrain getTerrain()
          Returns a Terrain object that uses the current sector geometry or the current globe to compute surface points.
 TextRendererCache getTextRendererCache()
          Returns this draw context's text-renderer cache.
 GpuResourceCache getTextureCache()
          Returns the GPU resource cache for this draw context.
 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.
 Position getViewportCenterPosition()
          Indicates the geographic coordinates of the point on the terrain at the current viewport's center.
 Point getViewportCenterScreenPoint()
          Indicates the screen-coordinate point of the current viewport's center.
 Sector getVisibleSector()
          Retrieves a Sector which is at least as large as the current visible sector.
 List<Sector> getVisibleSectors(double[] resolutions, long timeLimit, Sector searchSector)
          Returns the visible sectors at one of several specified resolutions within a specified search sector.
 void initialize(GLContext glContext)
          Initializes this DrawContext.
 boolean isDeepPickingEnabled()
          Indicates whether all items under cursor are picked.
 boolean isOrderedRenderingMode()
          Indicates whether the SceneController is currently rendering the draw context's OrderedRenderables.
 boolean isPickingMode()
          Indicates whether the scene controller is currently picking.
 boolean isPreRenderMode()
          Indicates whether the scene controller is currently pre-rendering.
 boolean isSmall(Extent extent, int numPixels)
          Indicates whether a specified extent is smaller than a specified number of pixels for the current view.
 OrderedRenderable peekOrderedRenderables()
          Returns the next OrderedRenderable on the ordered-renderable priority queue but does not remove it from the queue.
 OrderedRenderable pollOrderedRenderables()
          Returns the next OrderedRenderable on the ordered-renderable priority queue and removes it from the queue.
 void popProjectionOffest()
          Removes the current projection matrix offset added by pushProjectionOffest(Double).
 void pushProjectionOffest(Double offset)
          Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point.
 void restoreDefaultBlending()
          Restores the current OpenGL context's blending state to its default.
 void restoreDefaultCurrentColor()
          Restores the current OpenGL context's current color to its default.
 void restoreDefaultDepthTesting()
          Restores the current OpenGL context's depth testing state to its default.
 void setAnnotationRenderer(AnnotationRenderer annotationRenderer)
          Since Annotations are Renderables, they can be exist outside an AnnotationLayer, in which case they are responsible for rendering themselves.
 void setClutterFilter(ClutterFilter filter)
          Specifies the clutter filter to use.
 void setCurrentLayer(Layer layer)
          Sets the current-layer field to the specified layer or null.
 void setDeepPickingEnabled(boolean tf)
          Specifies whether all items under the cursor are picked.
 void setFrameTimeStamp(long frameTimeStamp)
          Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence.
 void setGLContext(GLContext glContext)
          Assigns this DrawContext a new javax.media.opengl.GLContext.
 void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
          Sets the GLRuntimeCapabilities associated with this DrawContext to the specified parameter.
 void setGpuResourceCache(GpuResourceCache gpuResourceCache)
          Specifies the GPU resource cache for this draw context.
 void setModel(Model model)
          Assign a new Model.
 void setOrderedRenderingMode(boolean tf)
          Called by the SceneController to indicate whether it is currently drawing the draw context's OrderedRenderables.
 void setPerFrameStatistic(String key, String displayName, Object statistic)
          Specifies a performance statistic that's assigned for each frame.
 void setPerFrameStatistics(Collection<PerformanceStatistic> stats)
          Specifies a collection of per-frame performance statistics.
 void setPerFrameStatisticsKeys(Set<String> statKeys, Collection<PerformanceStatistic> stats)
          Specifies the performance statistics that are monitored during each frame.
 void setPickPoint(Point pickPoint)
          Specifies the current pick point in AWT screen coordinates, or null to indicate that there is no pick point.
 void setPickPointFrustumDimension(Dimension dim)
          Set the size (in pixels) of the pick point frustum at the near plane.
 void setPickRectangle(Rectangle pickRect)
          Specifies the current pick rectangle in AWT screen coordinates, or null to indicate that there is no pick rectangle.
 void setPreRenderMode(boolean preRenderMode)
          Specifies whether the scene controller is pre-rendering.
 void setRedrawRequested(int redrawRequested)
          Requests that a new frame should be generated by the SceneController.
 void setRenderingExceptions(Collection<Throwable> exceptions)
          Sets the rendering exceptions associated with this DrawContext to the specified Collection of Throwable objects.
 void setStandardLightingModel(LightingModel standardLighting)
          Specifies the lighting model used for standard lighting.
 void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
          Specifies the current surface geometry.
 void setTextRendererCache(TextRendererCache textRendererCache)
          Specifies this context's text renderer cache.
 void setVerticalExaggeration(double verticalExaggeration)
          Sets the vertical exaggeration.
 void setView(View view)
          Assigns a new View.
 void setViewportCenterPosition(Position viewportCenterPosition)
          Specifies the geographic coordinates of the point on the terrain at the current viewport's center.
 void setViewportCenterScreenPoint(Point viewportCenterPoint)
          Specifies the screen-coordinate point of the current viewport's center.
 void setVisibleSector(Sector s)
          Sets the visible Sector.
 
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
 
Methods inherited from interface gov.nasa.worldwind.Disposable
dispose
 

Method Detail

addObjectInPickRectangle

void addObjectInPickRectangle(PickedObject pickedObject)
Adds the specified picked object to the current list of objects intersecting the pick rectangle. This list can be accessed by calling getObjectsInPickRectangle().

Parameters:
pickedObject - the object to add.
Throws:
IllegalArgumentException - if pickedObject is null.

addOrderedRenderable

void addOrderedRenderable(OrderedRenderable orderedRenderable)
Adds an OrderedRenderable to the draw context's ordered renderable list.

Parameters:
orderedRenderable - the ordered renderable to add.
Throws:
IllegalArgumentException - if the ordered renderable is null.

addOrderedRenderable

void addOrderedRenderable(OrderedRenderable orderedRenderable,
                          boolean isBehind)
Adds an OrderedRenderable to the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables. If isBehind is true, the draw context treats the specified ordered renderable as though it is behind all other ordered renderables and ignores the ordered renderable's eye distance. If multiple ordered renderables are added with isBehind specified as true, those ordered renderables are drawn according to the order in which they are added.

Parameters:
orderedRenderable - the ordered renderable to add.
isBehind - true to specify that the ordered renderable is behind all other ordered renderables, or false to interpret the ordered renderable according to its eye distance.

addOrderedSurfaceRenderable

void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
Adds an OrderedRenderable to the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.

Parameters:
orderedRenderable - the ordered renderable to add.

addPickedObject

void addPickedObject(PickedObject pickedObject)
Adds the specified picked object to the list of objects at the pick point. This list can be accessed by calling getPickedObjects().

Parameters:
pickedObject - the object to add.
Throws:
IllegalArgumentException - if pickedObject is null.

addPickedObjects

void addPickedObjects(PickedObjectList pickedObjects)
Adds a list of picked objects to the current list of objects at the pick point. This list can be accessed by calling getPickedObjects().

Parameters:
pickedObjects - the list to add.
Throws:
IllegalArgumentException - if pickedObjects is null.

addPickPointFrustum

void addPickPointFrustum()
Creates a frustum around the current pick point and adds it to the current list of pick frustums. The frustum's dimension is specified by calling setPickPointFrustumDimension(java.awt.Dimension).

This does nothing if the current pick point is null.


addPickRectangleFrustum

void addPickRectangleFrustum()
Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.

This does nothing if the current pick rectangle is null.


addRenderingException

void addRenderingException(Throwable t)
Adds the specified Throwable to this DrawContext's collection of rendering exceptions. If this DrawContext's collection is null, the specified Throwable is ignored and calling this method is benign.

Parameters:
t - the rendering exception to add as a Throwable.
Throws:
IllegalArgumentException - if the Throwable is null.

addScreenCredit

void addScreenCredit(ScreenCredit credit)
Adds a screen-credit icon to display.

Parameters:
credit - the screen credit to display.
Throws:
IllegalArgumentException - if the credit is null.

applyClutterFilter

void applyClutterFilter()
Filter overlapping text from the ordered renderable list.


beginStandardLighting

void beginStandardLighting()
Enables the current standard lighting model. endStandardLighting() must be called when rendering of the current shape is complete.

See Also:
setStandardLightingModel(LightingModel), endStandardLighting()

computePointFromPosition

Vec4 computePointFromPosition(Position position,
                              int altitudeMode)
Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.

Parameters:
position - the position to convert.
altitudeMode - the altitude mode.
Returns:
the Cartesian point corresponding to the specified position and this context's current globe or terrain.
Throws:
IllegalArgumentException - if the position is null.

computeTerrainPoint

Vec4 computeTerrainPoint(Angle lat,
                         Angle lon,
                         double offset)
Compute a model-coordinate point on the terrain.

Parameters:
lat - the point's latitude.
lon - the point's longitude.
offset - an distance in meters to place the point above or below the terrain.
Returns:
a model-coordinate point offset the specified amount from the current terrain.
Throws:
IllegalArgumentException - if either the latitude or longitude is null.

disablePickingMode

void disablePickingMode()
Specifies that the scene controller has ended its pick traversal.


drawNormals

void drawNormals(float length,
                 FloatBuffer vBuf,
                 FloatBuffer nBuf)
This is a diagnostic method to display normal vectors.

Parameters:
length - the length to draw the vectors, in meters.
vBuf - a vertex buffer. If null, no vectors are drawn.
nBuf - a buffer of normal vectors corresponding to the vertex buffer. If null, no vectors are drawn.

drawOutlinedShape

void drawOutlinedShape(OutlinedShape renderer,
                       Object shape)
Performs a multi-pass rendering technique to ensure that outlines around filled shapes are drawn correctly when blending or ant-aliasing is performed, and that filled portions of the shape resolve depth-buffer fighting with shapes previously drawn in favor of the current shape.

Parameters:
renderer - an object implementing the OutlinedShape interface for the shape.
shape - the shape to render.
See Also:
OutlinedShape

drawUnitQuad

void drawUnitQuad()
Draws a quadrilateral using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).


drawUnitQuad

void drawUnitQuad(TextureCoords texCoords)
Draws a quadrilateral using the current OpenGL state and specified texture coordinates. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).

Parameters:
texCoords - texture coordinates to assign to each quadrilateral vertex.
Throws:
NullPointerException - if the texture coordinate reference is null.

drawUnitQuadOutline

void drawUnitQuadOutline()
Draws a quadrilateral outline using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).


enablePickingMode

void enablePickingMode()
Specifies that the scene controller is beginning its pick traversal.


endStandardLighting

void endStandardLighting()
Pops the OpenGL state previously established by beginStandardLighting().


getAnnotationRenderer

AnnotationRenderer getAnnotationRenderer()
Returns the draw context's annotation renderer, typically used by annotations that are not contained in an AnnotationLayer.

Returns:
the annotation renderer.

getClearColor

Color getClearColor()
Returns the WorldWindow's background color.

Returns:
the WorldWindow's background color.

getClutterFilter

ClutterFilter getClutterFilter()
Returns the current clutter filter.

Returns:
the current clutter filter.

getCurrentLayer

Layer getCurrentLayer()
Returns the current-layer. The field is informative only and enables layer contents to determine their containing layer.

Returns:
the current layer, or null if no layer is current.

getDeclutteringTextRenderer

DeclutteringTextRenderer getDeclutteringTextRenderer()
Returns the draw context's decluttering text renderer.

Returns:
the decluttering text renderer.

getDrawableHeight

int getDrawableHeight()
Indicates the height in pixels of the drawing target associated with this DrawContext. The returned height is potentially different from the GL viewport height. If this DrawContext is associated with a GLJPanel, the returned height is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport height.

The GL viewport dimensions can be accessed by calling getView().getViewport() on this DrawContext.

Returns:
the height of the drawing target associated with this DrawContext, in pixels.

getDrawableWidth

int getDrawableWidth()
Indicates the width in pixels of the drawing target associated with this DrawContext. The returned width is potentially different from the GL viewport width. If this DrawContext is associated with a GLJPanel, the returned width is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport width.

The GL viewport dimensions can be accessed by calling getView().getViewport() on this DrawContext.

Returns:
the width of the drawing target associated with this DrawContext, in pixels.

getFrameTimeStamp

long getFrameTimeStamp()
Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp remains constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.

Returns:
the frame time stamp. See System.currentTimeMillis() for its numerical meaning.

getGeographicSurfaceTileRenderer

SurfaceTileRenderer getGeographicSurfaceTileRenderer()
Returns this draw context's surface tile renderer.

Returns:
this draw context's surface tile renderer.s

getGL

GL getGL()
Retrieves the current javax.media.opengl.GL. A GL or GLU is required for all graphical rendering in World Wind.

Returns:
the current GL if available, null otherwise
Since:
1.5

getGLContext

GLContext getGLContext()
Retrieves this DrawContexts javax.media.opengl.GLContext. If this method returns null, then there are potentially no active GLContexts and rendering should be aborted.

Returns:
this DrawContexts javax.media.opengl.GLContext.
Since:
1.5

getGLDrawable

GLDrawable getGLDrawable()
Retrieves the current javax.media.opengl.GLDrawable. A GLDrawable can be used to create a GLContext, which can then be used for rendering.

Returns:
the current GLDrawable, null if none available
Since:
1.5

getGlobe

Globe getGlobe()
Retrieves the current Globe, which may be null.

Returns:
the current Globe, which may be null
Since:
1.5

getGLRuntimeCapabilities

GLRuntimeCapabilities getGLRuntimeCapabilities()
Returns the GLRuntimeCapabilities associated with this DrawContext.

Returns:
this DrawContext's associated GLRuntimeCapabilities.

getGLU

GLU getGLU()
Retrieves the current javax.media.opengl.glu.GLU. A GLU or GL is required for all graphical rendering in World Wind.

Returns:
the current GLU if available, null otherwise
Since:
1.5

getGpuResourceCache

GpuResourceCache getGpuResourceCache()
Returns the GPU resource cache used by this draw context.

Returns:
the GPU resource cache used by this draw context.

getLayers

LayerList getLayers()
Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.

Returns:
a LayerList containing all the current layers
Since:
1.5

getModel

Model getModel()
Retrieves the current Model, which may be null.

Returns:
the current Model, which may be null
Since:
1.5

getObjectsInPickRectangle

PickedObjectList getObjectsInPickRectangle()
Returns the list of objects intersecting the pick rectangle during the most recent pick traversal. The returned list is empty if nothing intersects the pick rectangle, or if the pick rectangle is null.

Returns:
the list of picked objects.

getOrderedSurfaceRenderables

Queue<OrderedRenderable> getOrderedSurfaceRenderables()
Returns the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.

Returns:
the draw context's ordered surface renderable queue.

getPerFrameStatistics

Collection<PerformanceStatistic> getPerFrameStatistics()
Returns the performance statistics that are gathered during each frame.

Returns:
the performance statistics that are gathered during each frame.

getPerFrameStatisticsKeys

Set<String> getPerFrameStatisticsKeys()
Indicates the statistics that are monitored for each frame.

Returns:
the keys of the statistics monitored for each frame.

getPickColorAtPoint

int getPickColorAtPoint(Point point)
Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integer as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.

This returns 0 if the point contains the clear color, or is outside this draw context's drawable area.

Parameters:
point - the point to return a color for, in AWT screen coordinates.
Returns:
the RGB color corresponding to the specified point.
Throws:
IllegalArgumentException - if the point is null.

getPickColorsInRectangle

int[] getPickColorsInRectangle(Rectangle rectangle,
                               int[] minAndMaxColorCodes)
Returns an array of the unique framebuffer RGB colors within a rectangle in AWT screen coordinates, formatted as pick color codes. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integers as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.

The returned array contains one entry for each unique color. Points in the rectangle that contain the clear color or are outside this draw context's drawable area are ignored. This returns null if the specified rectangle is empty, or contains only the clear color.

The minAndMaxColorCodes parameter limits the unique colors that this method returns to the specified range. The minimum color must be stored in array index 0, and the maximum color must be stored in array index 1. These values can be used to specify a small range of colors relative to the framebuffer contents, effectively culling the colors that must be considered by this method and the caller. When specified, these integers must be formatted exactly as the integers this method returns.

Parameters:
rectangle - the rectangle to return unique colors for, in AWT screen coordinates.
minAndMaxColorCodes - an two element array representing the minimum and maximum RGB colors to return. May be null to specify that all color codes must be returned.
Returns:
the unique RGB colors corresponding to the specified rectangle, or null if the rectangle is empty or the rectangle contains only the clear color.
Throws:
IllegalArgumentException - if the rectangle is null.

getPickedObjects

PickedObjectList getPickedObjects()
Returns the list of objects at the pick point during the most recent pick traversal. The returned list is empty if nothing is at the pick point, or if the pick point is null.

Returns:
the list of picked objects.

getPickFrustums

PickPointFrustumList getPickFrustums()
Gets the FrustumList containing all the current Pick Frustums

Returns:
FrustumList of Pick Frustums

getPickPoint

Point getPickPoint()
Returns the current pick point in AWT screen coordinates.

Returns:
the current pick point, or null if no pick point is available.
See Also:
setPickPoint(java.awt.Point)

getPickPointFrustumDimension

Dimension getPickPointFrustumDimension()
Gets the dimension of the current Pick Point Frustum

Returns:
the dimension of the current Pick Point Frustum

getPickRectangle

Rectangle getPickRectangle()
Returns the current pick rectangle in AWT screen coordinates.

Returns:
the current pick rectangle, or null if no pick rectangle is current.
See Also:
setPickRectangle(java.awt.Rectangle)

getPointOnTerrain

Vec4 getPointOnTerrain(Angle latitude,
                       Angle longitude)
Computes a location's Cartesian point on the currently visible terrain.

Parameters:
latitude - the location's latitude.
longitude - the location's longitude.
Returns:
the location's corresponding Cartesian point, or null if the location is not currently visible.

getRedrawRequested

int getRedrawRequested()
Indicates whether a new frame should be generated by the SceneController.

Returns:
the delay in milliseconds if a redraw has been requested, otherwise 0.

getRenderingExceptions

Collection<Throwable> getRenderingExceptions()
Gets the rendering exceptions associated with this DrawContext as a Collection of Throwable objects. If non-null, the returned Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext in addRenderingException(Throwable). A null collection indicates this DrawContext does not accumulate rendering exceptions.

Returns:
the Collection used to accumulate rendering exceptions, or null if this DrawContext does not accumulate rendering exceptions.

getScreenCredits

Map<ScreenCredit,Long> getScreenCredits()
Returns the screen credits currently held and displayed by this draw context.

Returns:
the screen credits currently held by this draw context.

getStandardLightingModel

LightingModel getStandardLightingModel()
Returns the current model used for standard lighting.

Returns:
the current standard lighting model, or null if no model is defined.

getSurfaceGeometry

SectorGeometryList getSurfaceGeometry()
Retrieves a list of all the sectors rendered so far this frame.

Returns:
a SectorGeometryList containing every SectorGeometry rendered so far this render pass.
Since:
1.5

getTerrain

Terrain getTerrain()
Returns a Terrain object that uses the current sector geometry or the current globe to compute surface points.

Returns:
a terrain object for computing surface points and intersections.

getTextRendererCache

TextRendererCache getTextRendererCache()
Returns this draw context's text-renderer cache.

Returns:
this context's text renderer cache.

getTextureCache

GpuResourceCache getTextureCache()
Returns the GPU resource cache for this draw context. This method returns the same value as getGpuResourceCache().

Returns:
the GPU resource cache for this draw context.
See Also:
getGpuResourceCache()

getUniquePickColor

Color getUniquePickColor()
Returns a unique color to serve as a pick identifier during picking.

Returns:
a unique pick color

getVerticalExaggeration

double getVerticalExaggeration()
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.

Returns:
the current vertical exaggeration
Since:
1.5

getView

View getView()
Retrieves the current View, which may be null.

Returns:
the current View, which may be null
Since:
1.5

getViewportCenterPosition

Position getViewportCenterPosition()
Indicates the geographic coordinates of the point on the terrain at the current viewport's center.

Returns:
the geographic coordinates of the current viewport's center. Returns null if the globe's surface is not under the viewport's center point.

getViewportCenterScreenPoint

Point getViewportCenterScreenPoint()
Indicates the screen-coordinate point of the current viewport's center.

Returns:
the screen-coordinate point of the current viewport's center.

getVisibleSector

Sector getVisibleSector()
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.

Returns:
a Sector at least the size of the current visible sector, null if unavailable
Since:
1.5

getVisibleSectors

List<Sector> getVisibleSectors(double[] resolutions,
                               long timeLimit,
                               Sector searchSector)
Returns the visible sectors at one of several specified resolutions within a specified search sector. Several sectors resolutions may be specified along with a time limit. The best resolution that can be determined within the time limit is returned.

Adherence to the time limit is not precise. The limit is checked only between full searches at each resolution. The search may take more than the specified time, but will terminate if no time is left before starting a higher-resolution search.

Parameters:
resolutions - the resolutions of the sectors to return, in latitude.
timeLimit - the amount of time, in milliseconds, to allow for searching.
searchSector - the sector to decompose into visible sectors.
Returns:
the visible sectors at the best resolution achievable given the time limit. The actual resolution can be determined by examining the delta-latitude value of any of the returned sectors.
Throws:
IllegalArgumentException - if the resolutions array or the search sector is null.

initialize

void initialize(GLContext glContext)
Initializes this DrawContext. This method should be called at the beginning of each frame to prepare the DrawContext for the coming render pass.

Parameters:
glContext - the javax.media.opengl.GLContext to use for this render pass
Since:
1.5

isDeepPickingEnabled

boolean isDeepPickingEnabled()
Indicates whether all items under cursor are picked.

Returns:
true if all items under the cursor are picked, otherwise false

isOrderedRenderingMode

boolean isOrderedRenderingMode()
Indicates whether the SceneController is currently rendering the draw context's OrderedRenderables. When the this method returns false during a call to an ordered renderable's Renderable.render(DrawContext) method, the ordered renderable should add itself to the draw context via addOrderedRenderable(OrderedRenderable) rather than draw it. When this method returns true during a call to its render method, the ordered renderable should draw itself.

Returns:
true if the scene controller is currently rendering its ordered renderables, otherwise false.

isPickingMode

boolean isPickingMode()
Indicates whether the scene controller is currently picking.

Returns:
true if the scene controller is picking, otherwise false

isPreRenderMode

boolean isPreRenderMode()
Indicates whether the scene controller is currently pre-rendering.

Returns:
true if pre-rendering, otherwise false.
See Also:
PreRenderable

isSmall

boolean isSmall(Extent extent,
                int numPixels)
Indicates whether a specified extent is smaller than a specified number of pixels for the current view.

Parameters:
extent - the extent to test. May be null, in which case this method returns false.
numPixels - the number of pixels at and below which the extent is considered too small.
Returns:
true if the projected extent is smaller than the specified number of pixels, otherwise false.

peekOrderedRenderables

OrderedRenderable peekOrderedRenderables()
Returns the next OrderedRenderable on the ordered-renderable priority queue but does not remove it from the queue.

Returns:
the next ordered renderable, or null if there are no more ordered renderables on the queue.

pollOrderedRenderables

OrderedRenderable pollOrderedRenderables()
Returns the next OrderedRenderable on the ordered-renderable priority queue and removes it from the queue.

Returns:
the next ordered renderable, or null if there are no more ordered renderables on the queue.

popProjectionOffest

void popProjectionOffest()
Removes the current projection matrix offset added by pushProjectionOffest(Double).

See Also:
pushProjectionOffest(Double)

pushProjectionOffest

void pushProjectionOffest(Double offset)
Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point. This gives those objects visual priority over objects at the same or nearly the same position. After the objects are drawn, call popProjectionOffest() to cancel the effect for subsequently drawn objects.

Note: This capability is meant to be applied only within a single Renderable. It is not intended as a means to offset a whole Renderable or collection of Renderables.

See "Mathematics for Game Programming and 3D Computer Graphics, 2 ed." by Eric Lengyel, Section 9.1, "Depth Value Offset" for a description of this technique.

Parameters:
offset - a reference to an offset value, typically near 1.0, or null to request use of the default value. Values less than 1.0 pull objects toward the eye point, values greater than 1.0 push objects away from the eye point. The default value is 0.99.
See Also:
popProjectionOffest()

restoreDefaultBlending

void restoreDefaultBlending()
Restores the current OpenGL context's blending state to its default.


restoreDefaultCurrentColor

void restoreDefaultCurrentColor()
Restores the current OpenGL context's current color to its default.


restoreDefaultDepthTesting

void restoreDefaultDepthTesting()
Restores the current OpenGL context's depth testing state to its default.


setAnnotationRenderer

void setAnnotationRenderer(AnnotationRenderer annotationRenderer)
Since Annotations are Renderables, they can be exist outside an AnnotationLayer, in which case they are responsible for rendering themselves. The draw context's annotation renderer provides an active renderer for that purpose.

Parameters:
annotationRenderer - the new annotation renderer for the draw context.
Throws:
IllegalArgumentException - if annotationRenderer is null;

setClutterFilter

void setClutterFilter(ClutterFilter filter)
Specifies the clutter filter to use. May be null to indicate no decluttering.

Parameters:
filter - the clutter filter.

setCurrentLayer

void setCurrentLayer(Layer layer)
Sets the current-layer field to the specified layer or null. The field is informative only and enables layer contents to determine their containing layer.

Parameters:
layer - the current layer or null.

setDeepPickingEnabled

void setDeepPickingEnabled(boolean tf)
Specifies whether all items under the cursor are picked.

Parameters:
tf - true to pick all objects under the cursor

setFrameTimeStamp

void setFrameTimeStamp(long frameTimeStamp)
Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp must remain constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.

Parameters:
frameTimeStamp - the frame time stamp. See System.currentTimeMillis() for its numerical meaning.

setGLContext

void setGLContext(GLContext glContext)
Assigns this DrawContext a new javax.media.opengl.GLContext. May throw a NullPointerException if glContext is null.

Parameters:
glContext - the new javax.media.opengl.GLContext
Throws:
NullPointerException - if glContext is null
Since:
1.5

setGLRuntimeCapabilities

void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
Sets the GLRuntimeCapabilities associated with this DrawContext to the specified parameter.

Parameters:
capabilities - the GLRuntimeCapabilities to be associated with this DrawContext.
Throws:
IllegalArgumentException - if the capabilities are null.

setGpuResourceCache

void setGpuResourceCache(GpuResourceCache gpuResourceCache)
Specifies the GPU resource cache for this draw context.

Parameters:
gpuResourceCache - the GPU resource cache for this draw context.

setModel

void setModel(Model model)
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.

Parameters:
model - the new Model
Since:
1.5

setOrderedRenderingMode

void setOrderedRenderingMode(boolean tf)
Called by the SceneController to indicate whether it is currently drawing the draw context's OrderedRenderables. See isOrderedRenderingMode() for more information.

Parameters:
tf - true if ordered renderables are being drawn, false if ordered renderables are only being accumulated.

setPerFrameStatistic

void setPerFrameStatistic(String key,
                          String displayName,
                          Object statistic)
Specifies a performance statistic that's assigned for each frame. Use this method to update the value of a specific statistic.

Parameters:
key - the key identifying the statistic to monitor.
displayName - the name to use when displaying this statistic.
statistic - the statistic's value. May be null.
Throws:
IllegalArgumentException - if either the key or display name are null.
See Also:
setPerFrameStatistics(java.util.Collection)

setPerFrameStatistics

void setPerFrameStatistics(Collection<PerformanceStatistic> stats)
Specifies a collection of per-frame performance statistics. Use this method to update a group of statistics.

Parameters:
stats - the statistic keys and their associated values.
Throws:
IllegalArgumentException - if the list is null.
See Also:
setPerFrameStatistic(String, String, Object)

setPerFrameStatisticsKeys

void setPerFrameStatisticsKeys(Set<String> statKeys,
                               Collection<PerformanceStatistic> stats)
Specifies the performance statistics that are monitored during each frame. Both arguments to this method may be null. If either is null then statistics are not gathered.

Parameters:
statKeys - the keys identifying the statistics to monitor.
stats - a list in which the statistics are placed as they're monitored.

setPickPoint

void setPickPoint(Point pickPoint)
Specifies the current pick point in AWT screen coordinates, or null to indicate that there is no pick point. During each pick traversal, layers determine if their contents are drawn at the pick point. If so, layers add each unique picked object to a PickedObjectList on this draw context by calling addPickedObject(gov.nasa.worldwind.pick.PickedObject). This list can be accessed by calling getPickedObjects().

If the pick point is null, the pick point is ignored during each pick traversal, and the list of objects returned by getPickedObjects is empty.

Parameters:
pickPoint - the current pick point, or null to specify that there is no pick point.

setPickPointFrustumDimension

void setPickPointFrustumDimension(Dimension dim)
Set the size (in pixels) of the pick point frustum at the near plane.

Parameters:
dim - dimension of pick point frustum

setPickRectangle

void setPickRectangle(Rectangle pickRect)
Specifies the current pick rectangle in AWT screen coordinates, or null to indicate that there is no pick rectangle. During each pick traversal, layers determine if their contents intersect the pick rectangle. If so, layers add each unique picked object to a PickedObjectList on this draw context by calling addObjectInPickRectangle(gov.nasa.worldwind.pick.PickedObject). This is list can be accessed by calling getObjectsInPickRectangle().

If the pick rectangle is null, the pick rectangle is ignored during each pick traversal, and the list of objects returned by getObjectsInPickRectangle is empty.

Parameters:
pickRect - the current pick rectangle, or null to specify that there is no pick rectangle.

setPreRenderMode

void setPreRenderMode(boolean preRenderMode)
Specifies whether the scene controller is pre-rendering.

Parameters:
preRenderMode - true to indicate pre-rendering, otherwise false.
See Also:
PreRenderable

setRedrawRequested

void setRedrawRequested(int redrawRequested)
Requests that a new frame should be generated by the SceneController.

Parameters:
redrawRequested - a delay in milliseconds if a redraw is requested, otherwise 0.

setRenderingExceptions

void setRenderingExceptions(Collection<Throwable> exceptions)
Sets the rendering exceptions associated with this DrawContext to the specified Collection of Throwable objects. If non-null, the specified Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext in addRenderingException(Throwable). A null collection indicates this DrawContext should not accumulate rendering exceptions.

Parameters:
exceptions - the Collection of exceptions to be used to accumulate rendering exceptions, or null to disable accumulation of rendering exception.

setStandardLightingModel

void setStandardLightingModel(LightingModel standardLighting)
Specifies the lighting model used for standard lighting.

Parameters:
standardLighting - the lighting model to use for standard lighting, or null to disable standard lighting.

setSurfaceGeometry

void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
Specifies the current surface geometry.

Parameters:
surfaceGeometry - the surface geometry to make current. May be null, indicating no surface geometry.

setTextRendererCache

void setTextRendererCache(TextRendererCache textRendererCache)
Specifies this context's text renderer cache.

Parameters:
textRendererCache - the context's text renderer cache.
Throws:
IllegalArgumentException - if the cache is null.

setVerticalExaggeration

void setVerticalExaggeration(double verticalExaggeration)
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.

Parameters:
verticalExaggeration - the new vertical exaggeration.
Since:
1.5

setView

void setView(View view)
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.

Parameters:
view - the enw View
Since:
1.5

setViewportCenterPosition

void setViewportCenterPosition(Position viewportCenterPosition)
Specifies the geographic coordinates of the point on the terrain at the current viewport's center.

Parameters:
viewportCenterPosition - the geographic coordinates of the current viewport's center. May be null.

setViewportCenterScreenPoint

void setViewportCenterScreenPoint(Point viewportCenterPoint)
Specifies the screen-coordinate point of the current viewport's center.

Parameters:
viewportCenterPoint - the screen-coordinate point of the current viewport's center.

setVisibleSector

void setVisibleSector(Sector s)
Sets the visible Sector. The new visible sector must completely encompass the Sector which is visible on the display.

Parameters:
s - the new visible Sector
Since:
1.5

NASA World Wind