public class DrawContextImpl extends WWObjectImpl implements DrawContext
Modifier and Type | Class and Description |
---|---|
protected static class |
DrawContextImpl.OrderedRenderableEntry |
Modifier and Type | Field and Description |
---|---|
protected AnnotationRenderer |
annotationRenderer |
protected java.awt.Color |
clearColor |
protected ClutterFilter |
clutterFilter |
protected java.util.LinkedHashMap<ScreenCredit,java.lang.Long> |
credits |
protected Layer |
currentLayer |
protected DeclutteringTextRenderer |
declutteringTextRenderer |
protected boolean |
deepPickingMode |
static float |
DEFAULT_DEPTH_OFFSET_FACTOR |
static float |
DEFAULT_DEPTH_OFFSET_UNITS |
protected long |
frameTimestamp |
protected SurfaceTileRenderer |
geographicSurfaceTileRenderer |
protected GLContext |
glContext |
protected Globe |
globe |
protected GLRuntimeCapabilities |
glRuntimeCaps |
protected GLU |
glu |
protected GpuResourceCache |
gpuResourceCache |
protected boolean |
isOrderedRenderingMode |
protected Model |
model |
protected PickedObjectList |
objectsInPickRect
The list of objects intersecting the pick rectangle during the most recent pick traversal.
|
protected java.util.PriorityQueue<DrawContextImpl.OrderedRenderableEntry> |
orderedRenderables |
protected java.util.Queue<OrderedRenderable> |
orderedSurfaceRenderables |
protected java.util.Collection<PerformanceStatistic> |
perFrameStatistics |
protected java.util.Set<java.lang.String> |
perFrameStatisticsKeys |
protected PickedObjectList |
pickedObjects
The list of objects at the pick point during the most recent pick traversal.
|
protected PickPointFrustumList |
pickFrustumList |
protected boolean |
pickingMode |
protected java.awt.Point |
pickPoint
Indicates the current pick point in AWT screen coordinates, or
null to indicate that there is no
pick point. |
protected java.awt.Dimension |
pickPointFrustumDimension |
protected java.awt.Rectangle |
pickRect
Indicates the current pick rectangle in AWT screen coordinates, or
null to indicate that there is no
pick rectangle. |
protected java.nio.ByteBuffer |
pixelColors
Buffer of RGB colors used to read back the framebuffer's colors and store them in client memory.
|
protected boolean |
preRenderMode |
protected int |
redrawRequested |
protected java.util.Collection<java.lang.Throwable> |
renderingExceptions |
protected LightingModel |
standardLighting |
protected SectorGeometryList |
surfaceGeometry |
protected Terrain |
terrain |
protected TextRendererCache |
textRendererCache |
protected int |
uniquePickNumber |
protected IntSet |
uniquePixelColors
Set of ints used by
getPickColorsInRectangle(java.awt.Rectangle, int[]) to identify the unique color
codes in the specified rectangle. |
protected double |
verticalExaggeration |
protected View |
view |
protected Position |
viewportCenterPosition |
protected java.awt.Point |
viewportCenterScreenPoint |
protected Sector |
visibleSector |
protected SectorVisibilityTree |
visibleSectors |
Constructor and Description |
---|
DrawContextImpl() |
Modifier and Type | Method and Description |
---|---|
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(java.lang.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 |
dispose()
Free internal resources held by this draw context.
|
void |
drawNormals(float length,
java.nio.FloatBuffer vBuf,
java.nio.FloatBuffer nBuf)
This is a diagnostic method to display normal vectors.
|
void |
drawOutlinedShape(OutlinedShape renderer,
java.lang.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
DrawContext.beginStandardLighting() . |
AnnotationRenderer |
getAnnotationRenderer()
Returns the draw context's annotation renderer, typically used by annotations that are not contained in an
AnnotationLayer . |
java.awt.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
DrawContext s 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.
|
java.util.Queue<OrderedRenderable> |
getOrderedSurfaceRenderables()
Returns the draw context's ordered surface renderable queue.
|
java.util.Collection<PerformanceStatistic> |
getPerFrameStatistics()
Returns the performance statistics that are gathered during each frame.
|
java.util.Set<java.lang.String> |
getPerFrameStatisticsKeys()
Indicates the statistics that are monitored for each frame.
|
int |
getPickColorAtPoint(java.awt.Point point)
Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code.
|
int[] |
getPickColorsInRectangle(java.awt.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
|
java.awt.Point |
getPickPoint()
Returns the current pick point in AWT screen coordinates.
|
java.awt.Dimension |
getPickPointFrustumDimension()
Gets the dimension of the current Pick Point Frustum
|
java.awt.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 . |
java.util.Collection<java.lang.Throwable> |
getRenderingExceptions()
Gets the rendering exceptions associated with this DrawContext as a
Collection of Throwable objects. |
java.util.Map<ScreenCredit,java.lang.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.
|
java.awt.Color |
getUniquePickColor()
Returns a unique color to serve as a pick identifier during picking.
|
java.awt.Color |
getUniquePickColorRange(int count)
Returns a range of unique colors to serve as pick identifiers 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.
|
java.awt.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. |
java.util.List<Sector> |
getVisibleSectors(double[] resolutions,
long timeLimit,
Sector sector)
Returns the visible sectors at one of several specified resolutions within a specified search sector.
|
void |
initialize(GLContext glContext)
Initializes this
DrawContext . |
boolean |
is2DGlobe() |
boolean |
isContinuous2DGlobe() |
boolean |
isDeepPickingEnabled()
Indicates whether all items under cursor are picked.
|
boolean |
isOrderedRenderingMode()
Indicates whether the
SceneController is currently rendering the draw context's OrderedRenderable s. |
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
DrawContext.pushProjectionOffest(Double) . |
void |
pushProjectionOffest(java.lang.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 ar)
Since
Annotation s are Renderable s, 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 OrderedRenderable s. |
void |
setPerFrameStatistic(java.lang.String key,
java.lang.String displayName,
java.lang.Object value)
Specifies a performance statistic that's assigned for each frame.
|
void |
setPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)
Specifies a collection of per-frame performance statistics.
|
void |
setPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys,
java.util.Collection<PerformanceStatistic> stats)
Specifies the performance statistics that are monitored during each frame.
|
void |
setPickPoint(java.awt.Point pickPoint)
Specifies the current pick point in AWT screen coordinates, or
null to indicate that there is no
pick point. |
void |
setPickPointFrustumDimension(java.awt.Dimension dim)
Set the size (in pixels) of the pick point frustum at the near plane.
|
void |
setPickRectangle(java.awt.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(java.util.Collection<java.lang.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(java.awt.Point viewportCenterScreenPoint)
Specifies the screen-coordinate point of the current viewport's center.
|
void |
setVisibleSector(Sector s)
Sets the visible
Sector . |
onMessage, propertyChange
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
protected AnnotationRenderer annotationRenderer
protected java.awt.Color clearColor
protected ClutterFilter clutterFilter
protected java.util.LinkedHashMap<ScreenCredit,java.lang.Long> credits
protected Layer currentLayer
protected DeclutteringTextRenderer declutteringTextRenderer
protected boolean deepPickingMode
public static final float DEFAULT_DEPTH_OFFSET_FACTOR
public static final float DEFAULT_DEPTH_OFFSET_UNITS
protected long frameTimestamp
protected SurfaceTileRenderer geographicSurfaceTileRenderer
protected GLContext glContext
protected Globe globe
protected GLRuntimeCapabilities glRuntimeCaps
protected GLU glu
protected GpuResourceCache gpuResourceCache
protected boolean isOrderedRenderingMode
protected Model model
protected PickedObjectList objectsInPickRect
protected java.util.PriorityQueue<DrawContextImpl.OrderedRenderableEntry> orderedRenderables
protected java.util.Queue<OrderedRenderable> orderedSurfaceRenderables
protected java.util.Collection<PerformanceStatistic> perFrameStatistics
protected java.util.Set<java.lang.String> perFrameStatisticsKeys
protected PickedObjectList pickedObjects
protected PickPointFrustumList pickFrustumList
protected boolean pickingMode
protected java.awt.Point pickPoint
null
to indicate that there is no
pick point. Initially null
.protected java.awt.Dimension pickPointFrustumDimension
protected java.awt.Rectangle pickRect
null
to indicate that there is no
pick rectangle. Initially null
.protected java.nio.ByteBuffer pixelColors
protected boolean preRenderMode
protected int redrawRequested
protected java.util.Collection<java.lang.Throwable> renderingExceptions
protected LightingModel standardLighting
protected SectorGeometryList surfaceGeometry
protected Terrain terrain
protected TextRendererCache textRendererCache
protected int uniquePickNumber
protected IntSet uniquePixelColors
getPickColorsInRectangle(java.awt.Rectangle, int[])
to identify the unique color
codes in the specified rectangle. This consolidates duplicate colors to a single entry. We use IntSet to achieve
constant time insertion, and to reduce overhead associated associated with storing integer primitives in a
HashSet.protected double verticalExaggeration
protected View view
protected Position viewportCenterPosition
protected java.awt.Point viewportCenterScreenPoint
protected Sector visibleSector
protected SectorVisibilityTree visibleSectors
public void addObjectInPickRectangle(PickedObject pickedObject)
DrawContext
DrawContext.getObjectsInPickRectangle()
.addObjectInPickRectangle
in interface DrawContext
pickedObject
- the object to add.public void addOrderedRenderable(OrderedRenderable orderedRenderable)
DrawContext
OrderedRenderable
to the draw context's ordered renderable list.addOrderedRenderable
in interface DrawContext
orderedRenderable
- the ordered renderable to add.public void addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
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.addOrderedRenderable
in interface DrawContext
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.public void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
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.addOrderedSurfaceRenderable
in interface DrawContext
orderedRenderable
- the ordered renderable to add.public void addPickedObject(PickedObject pickedObject)
DrawContext
DrawContext.getPickedObjects()
.addPickedObject
in interface DrawContext
pickedObject
- the object to add.public void addPickedObjects(PickedObjectList pickedObjects)
DrawContext
DrawContext.getPickedObjects()
.addPickedObjects
in interface DrawContext
pickedObjects
- the list to add.public void addPickPointFrustum()
DrawContext
DrawContext.setPickPointFrustumDimension(java.awt.Dimension)
.
This does nothing if the current pick point is null
.addPickPointFrustum
in interface DrawContext
public void addPickRectangleFrustum()
DrawContext
null
.addPickRectangleFrustum
in interface DrawContext
public void addRenderingException(java.lang.Throwable t)
DrawContext
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.addRenderingException
in interface DrawContext
t
- the rendering exception to add as a Throwable
.public void addScreenCredit(ScreenCredit credit)
DrawContext
addScreenCredit
in interface DrawContext
credit
- the screen credit to display.public void applyClutterFilter()
DrawContext
applyClutterFilter
in interface DrawContext
public void beginStandardLighting()
DrawContext
DrawContext.endStandardLighting()
must be called when rendering of the
current shape is complete.beginStandardLighting
in interface DrawContext
DrawContext.setStandardLightingModel(LightingModel)
,
DrawContext.endStandardLighting()
public Vec4 computePointFromPosition(Position position, int altitudeMode)
DrawContext
computePointFromPosition
in interface DrawContext
position
- the position to convert.altitudeMode
- the altitude mode.public Vec4 computeTerrainPoint(Angle lat, Angle lon, double offset)
DrawContext
computeTerrainPoint
in interface DrawContext
lat
- the point's latitude.lon
- the point's longitude.offset
- an distance in meters to place the point above or below the terrain.public void disablePickingMode()
DrawContext
disablePickingMode
in interface DrawContext
public void dispose()
dispose
in interface Disposable
GLException
- - If an OpenGL context is not current when this method is called.public void drawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)
DrawContext
drawNormals
in interface DrawContext
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.public void drawOutlinedShape(OutlinedShape renderer, java.lang.Object shape)
DrawContext
drawOutlinedShape
in interface DrawContext
renderer
- an object implementing the OutlinedShape
interface for the
shape.shape
- the shape to render.OutlinedShape
public void drawUnitQuad()
DrawContext
drawUnitQuad
in interface DrawContext
public void drawUnitQuad(TextureCoords texCoords)
DrawContext
drawUnitQuad
in interface DrawContext
texCoords
- texture coordinates to assign to each quadrilateral vertex.public void drawUnitQuadOutline()
DrawContext
drawUnitQuadOutline
in interface DrawContext
public void enablePickingMode()
DrawContext
enablePickingMode
in interface DrawContext
public void endStandardLighting()
DrawContext
DrawContext.beginStandardLighting()
.endStandardLighting
in interface DrawContext
public AnnotationRenderer getAnnotationRenderer()
DrawContext
AnnotationLayer
.getAnnotationRenderer
in interface DrawContext
public java.awt.Color getClearColor()
DrawContext
getClearColor
in interface DrawContext
public ClutterFilter getClutterFilter()
DrawContext
getClutterFilter
in interface DrawContext
public Layer getCurrentLayer()
DrawContext
getCurrentLayer
in interface DrawContext
public DeclutteringTextRenderer getDeclutteringTextRenderer()
DrawContext
getDeclutteringTextRenderer
in interface DrawContext
public final int getDrawableHeight()
DrawContext
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
.getDrawableHeight
in interface DrawContext
DrawContext
, in pixels.public final int getDrawableWidth()
DrawContext
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
.getDrawableWidth
in interface DrawContext
DrawContext
, in pixels.public long getFrameTimeStamp()
DrawContext
getFrameTimeStamp
in interface DrawContext
System.currentTimeMillis()
for its numerical meaning.public SurfaceTileRenderer getGeographicSurfaceTileRenderer()
DrawContext
getGeographicSurfaceTileRenderer
in interface DrawContext
public final GL getGL()
DrawContext
javax.media.opengl.GL
. A GL
or GLU
is required for
all graphical rendering in WorldWind.getGL
in interface DrawContext
GL
if available, null otherwisepublic final GLContext getGLContext()
DrawContext
DrawContext
s javax.media.opengl.GLContext. If this method returns null,
then there are potentially no active GLContext
s and rendering should be aborted.getGLContext
in interface DrawContext
DrawContext
s javax.media.opengl.GLContext.public final GLDrawable getGLDrawable()
DrawContext
javax.media.opengl.GLDrawable
. A GLDrawable
can be used to create
a GLContext
, which can then be used for rendering.getGLDrawable
in interface DrawContext
GLDrawable
, null if none availablepublic final Globe getGlobe()
DrawContext
Globe
, which may be null.getGlobe
in interface DrawContext
Globe
, which may be nullpublic GLRuntimeCapabilities getGLRuntimeCapabilities()
DrawContext
GLRuntimeCapabilities
associated with this DrawContext.getGLRuntimeCapabilities
in interface DrawContext
public final GLU getGLU()
DrawContext
javax.media.opengl.glu.GLU
. A GLU
or GL
is required
for all graphical rendering in WorldWind.getGLU
in interface DrawContext
GLU
if available, null otherwisepublic GpuResourceCache getGpuResourceCache()
DrawContext
getGpuResourceCache
in interface DrawContext
public final LayerList getLayers()
DrawContext
getLayers
in interface DrawContext
LayerList
containing all the current layerspublic final Model getModel()
DrawContext
Model
, which may be null.getModel
in interface DrawContext
Model
, which may be nullpublic PickedObjectList getObjectsInPickRectangle()
DrawContext
null
.getObjectsInPickRectangle
in interface DrawContext
public java.util.Queue<OrderedRenderable> getOrderedSurfaceRenderables()
getOrderedSurfaceRenderables
in interface DrawContext
public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
DrawContext
getPerFrameStatistics
in interface DrawContext
public java.util.Set<java.lang.String> getPerFrameStatisticsKeys()
DrawContext
getPerFrameStatisticsKeys
in interface DrawContext
public int getPickColorAtPoint(java.awt.Point point)
getPickColorAtPoint
in interface DrawContext
point
- the point to return a color for, in AWT screen coordinates.public int[] getPickColorsInRectangle(java.awt.Rectangle rectangle, int[] minAndMaxColorCodes)
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.getPickColorsInRectangle
in interface DrawContext
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.null
if the rectangle is
empty or the rectangle contains only the clear color.public PickedObjectList getPickedObjects()
DrawContext
null
.getPickedObjects
in interface DrawContext
public PickPointFrustumList getPickFrustums()
DrawContext
getPickFrustums
in interface DrawContext
public java.awt.Point getPickPoint()
DrawContext
getPickPoint
in interface DrawContext
null
if no pick point is available.DrawContext.setPickPoint(java.awt.Point)
public java.awt.Dimension getPickPointFrustumDimension()
DrawContext
getPickPointFrustumDimension
in interface DrawContext
public java.awt.Rectangle getPickRectangle()
DrawContext
getPickRectangle
in interface DrawContext
null
if no pick rectangle is current.DrawContext.setPickRectangle(java.awt.Rectangle)
public Vec4 getPointOnTerrain(Angle latitude, Angle longitude)
DrawContext
getPointOnTerrain
in interface DrawContext
latitude
- the location's latitude.longitude
- the location's longitude.public int getRedrawRequested()
DrawContext
SceneController
.getRedrawRequested
in interface DrawContext
public java.util.Collection<java.lang.Throwable> getRenderingExceptions()
DrawContext
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 DrawContext.addRenderingException(Throwable)
. A null collection indicates
this DrawContext does not accumulate rendering exceptions.getRenderingExceptions
in interface DrawContext
public java.util.Map<ScreenCredit,java.lang.Long> getScreenCredits()
DrawContext
getScreenCredits
in interface DrawContext
public LightingModel getStandardLightingModel()
DrawContext
getStandardLightingModel
in interface DrawContext
public SectorGeometryList getSurfaceGeometry()
DrawContext
getSurfaceGeometry
in interface DrawContext
SectorGeometryList
containing every SectorGeometry
rendered so far this
render pass.public Terrain getTerrain()
DrawContext
Terrain
object that uses the current sector geometry or the current globe to compute surface
points.getTerrain
in interface DrawContext
public TextRendererCache getTextRendererCache()
DrawContext
getTextRendererCache
in interface DrawContext
public GpuResourceCache getTextureCache()
DrawContext
DrawContext.getGpuResourceCache()
.getTextureCache
in interface DrawContext
DrawContext.getGpuResourceCache()
public java.awt.Color getUniquePickColor()
DrawContext
getUniquePickColor
in interface DrawContext
public java.awt.Color getUniquePickColorRange(int count)
DrawContext
count
unique colors from the pick color address space and returns the first color in the range. The first color's RGB
components represent an address to the beginning of a sequential range of pick color codes. This method is
similar to calling the no-argument DrawContext.getUniquePickColor()
count
times, but guarantees a
contiguous range of color codes and is more efficient when count
is large.
The number of pick colors is limited to a finite address space. This method returns null when there are fewer
than count
remaining unique colors in the pick color address space, or when count
is
less than 1.getUniquePickColorRange
in interface DrawContext
count
- the number of unique colors to allocate.count
is
greater than 0, otherwise null.public final double getVerticalExaggeration()
DrawContext
Globe
. A vertical exaggeration of 3 will create mountains and valleys which are three times as
high/deep as they really are.getVerticalExaggeration
in interface DrawContext
public final View getView()
DrawContext
View
, which may be null.getView
in interface DrawContext
View
, which may be nullpublic Position getViewportCenterPosition()
DrawContext
getViewportCenterPosition
in interface DrawContext
public java.awt.Point getViewportCenterScreenPoint()
DrawContext
getViewportCenterScreenPoint
in interface DrawContext
public final Sector getVisibleSector()
DrawContext
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.getVisibleSector
in interface DrawContext
Sector
at least the size of the current visible sector, null if unavailablepublic java.util.List<Sector> getVisibleSectors(double[] resolutions, long timeLimit, Sector sector)
DrawContext
getVisibleSectors
in interface DrawContext
resolutions
- the resolutions of the sectors to return, in latitude.timeLimit
- the amount of time, in milliseconds, to allow for searching.sector
- the sector to decompose into visible sectors.public final void initialize(GLContext glContext)
DrawContext
DrawContext
. This method should be called at the beginning of each frame to prepare
the DrawContext
for the coming render pass.initialize
in interface DrawContext
glContext
- the javax.media.opengl.GLContext
to use for this render passpublic boolean is2DGlobe()
is2DGlobe
in interface DrawContext
public boolean isContinuous2DGlobe()
isContinuous2DGlobe
in interface DrawContext
public boolean isDeepPickingEnabled()
DrawContext
isDeepPickingEnabled
in interface DrawContext
public boolean isOrderedRenderingMode()
DrawContext
SceneController
is currently rendering the draw context's OrderedRenderable
s. 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
DrawContext.addOrderedRenderable(OrderedRenderable)
rather than draw it. When this method returns true during a call
to its render method, the ordered renderable should draw itself.isOrderedRenderingMode
in interface DrawContext
public boolean isPickingMode()
DrawContext
isPickingMode
in interface DrawContext
public boolean isPreRenderMode()
DrawContext
isPreRenderMode
in interface DrawContext
PreRenderable
public boolean isSmall(Extent extent, int numPixels)
DrawContext
isSmall
in interface DrawContext
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.public OrderedRenderable peekOrderedRenderables()
DrawContext
OrderedRenderable
on the ordered-renderable priority queue but
does not remove it from the queue.peekOrderedRenderables
in interface DrawContext
public OrderedRenderable pollOrderedRenderables()
DrawContext
OrderedRenderable
on the ordered-renderable priority queue and
removes it from the queue.pollOrderedRenderables
in interface DrawContext
public void popProjectionOffest()
DrawContext
DrawContext.pushProjectionOffest(Double)
.popProjectionOffest
in interface DrawContext
DrawContext.pushProjectionOffest(Double)
public void pushProjectionOffest(java.lang.Double offset)
DrawContext
DrawContext.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.pushProjectionOffest
in interface DrawContext
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.DrawContext.popProjectionOffest()
public void restoreDefaultBlending()
DrawContext
restoreDefaultBlending
in interface DrawContext
public void restoreDefaultCurrentColor()
DrawContext
restoreDefaultCurrentColor
in interface DrawContext
public void restoreDefaultDepthTesting()
DrawContext
restoreDefaultDepthTesting
in interface DrawContext
public void setAnnotationRenderer(AnnotationRenderer ar)
DrawContext
Annotation
s are Renderable
s, 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.setAnnotationRenderer
in interface DrawContext
ar
- the new annotation renderer for the draw context.public void setClutterFilter(ClutterFilter filter)
DrawContext
setClutterFilter
in interface DrawContext
filter
- the clutter filter.public void setCurrentLayer(Layer layer)
DrawContext
setCurrentLayer
in interface DrawContext
layer
- the current layer or null.public void setDeepPickingEnabled(boolean tf)
DrawContext
setDeepPickingEnabled
in interface DrawContext
tf
- true to pick all objects under the cursorpublic void setFrameTimeStamp(long frameTimeStamp)
DrawContext
setFrameTimeStamp
in interface DrawContext
frameTimeStamp
- the frame time stamp. See System.currentTimeMillis()
for its numerical meaning.public final void setGLContext(GLContext glContext)
DrawContext
DrawContext
a new javax.media.opengl.GLContext. May throw a
NullPointerException
if glContext
is null.setGLContext
in interface DrawContext
glContext
- the new javax.media.opengl.GLContext
public void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
DrawContext
GLRuntimeCapabilities
associated with this DrawContext to the specified parameter.setGLRuntimeCapabilities
in interface DrawContext
capabilities
- the GLRuntimeCapabilities to be associated with this DrawContext.public void setGpuResourceCache(GpuResourceCache gpuResourceCache)
DrawContext
setGpuResourceCache
in interface DrawContext
gpuResourceCache
- the GPU resource cache for this draw context.public final void setModel(Model model)
DrawContext
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.setModel
in interface DrawContext
model
- the new Model
public void setOrderedRenderingMode(boolean tf)
DrawContext
SceneController
to indicate whether it is currently drawing the draw
context's OrderedRenderable
s. See DrawContext.isOrderedRenderingMode()
for more
information.setOrderedRenderingMode
in interface DrawContext
tf
- true if ordered renderables are being drawn, false if ordered renderables are only being accumulated.public void setPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.Object value)
DrawContext
setPerFrameStatistic
in interface DrawContext
key
- the key identifying the statistic to monitor.displayName
- the name to use when displaying this statistic.value
- the statistic's value. May be null.DrawContext.setPerFrameStatistics(java.util.Collection)
public void setPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)
DrawContext
setPerFrameStatistics
in interface DrawContext
stats
- the statistic keys and their associated values.DrawContext.setPerFrameStatistic(String, String, Object)
public void setPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.Collection<PerformanceStatistic> stats)
DrawContext
setPerFrameStatisticsKeys
in interface DrawContext
statKeys
- the keys identifying the statistics to monitor.stats
- a list in which the statistics are placed as they're monitored.public void setPickPoint(java.awt.Point pickPoint)
DrawContext
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 DrawContext.addPickedObject(gov.nasa.worldwind.pick.PickedObject)
. This list can be accessed by calling DrawContext.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.setPickPoint
in interface DrawContext
pickPoint
- the current pick point, or null
to specify that there is no pick point.public void setPickPointFrustumDimension(java.awt.Dimension dim)
DrawContext
setPickPointFrustumDimension
in interface DrawContext
dim
- dimension of pick point frustumpublic void setPickRectangle(java.awt.Rectangle pickRect)
DrawContext
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 DrawContext.addObjectInPickRectangle(gov.nasa.worldwind.pick.PickedObject)
. This is list can be accessed by calling DrawContext.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.setPickRectangle
in interface DrawContext
pickRect
- the current pick rectangle, or null
to specify that there is no pick rectangle.public void setPreRenderMode(boolean preRenderMode)
DrawContext
setPreRenderMode
in interface DrawContext
preRenderMode
- true to indicate pre-rendering, otherwise false.PreRenderable
public void setRedrawRequested(int redrawRequested)
DrawContext
SceneController
.setRedrawRequested
in interface DrawContext
redrawRequested
- a delay in milliseconds if a redraw is requested, otherwise 0.public void setRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)
DrawContext
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 DrawContext.addRenderingException(Throwable)
. A null collection
indicates this DrawContext should not accumulate rendering exceptions.setRenderingExceptions
in interface DrawContext
exceptions
- the Collection of exceptions to be used to accumulate rendering exceptions, or null to disable
accumulation of rendering exception.public void setStandardLightingModel(LightingModel standardLighting)
DrawContext
setStandardLightingModel
in interface DrawContext
standardLighting
- the lighting model to use for standard lighting, or null to disable standard lighting.public void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
DrawContext
setSurfaceGeometry
in interface DrawContext
surfaceGeometry
- the surface geometry to make current. May be null, indicating no surface geometry.public void setTextRendererCache(TextRendererCache textRendererCache)
DrawContext
setTextRendererCache
in interface DrawContext
textRendererCache
- the context's text renderer cache.public final void setVerticalExaggeration(double verticalExaggeration)
DrawContext
Globe
. A vertical exaggeration of 3 will create mountains and valleys which are three times as
high/deep as they really are.setVerticalExaggeration
in interface DrawContext
verticalExaggeration
- the new vertical exaggeration.public final void setView(View view)
DrawContext
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.setView
in interface DrawContext
view
- the enw View
public void setViewportCenterPosition(Position viewportCenterPosition)
DrawContext
setViewportCenterPosition
in interface DrawContext
viewportCenterPosition
- the geographic coordinates of the current viewport's center. May be null.public void setViewportCenterScreenPoint(java.awt.Point viewportCenterScreenPoint)
DrawContext
setViewportCenterScreenPoint
in interface DrawContext
viewportCenterScreenPoint
- the screen-coordinate point of the current viewport's center.public final void setVisibleSector(Sector s)
DrawContext
Sector
. The new visible sector must completely encompass the Sector which is
visible on the display.setVisibleSector
in interface DrawContext
s
- the new visible Sector