Interface DrawContext
-
- All Superinterfaces:
AVList,Disposable,java.util.EventListener,MessageListener,java.beans.PropertyChangeListener,WWObject
- All Known Implementing Classes:
DrawContextImpl
public interface DrawContext extends WWObject, Disposable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddObjectInPickRectangle(PickedObject pickedObject)Adds the specified picked object to the current list of objects intersecting the pick rectangle.voidaddOrderedRenderable(OrderedRenderable orderedRenderable)Adds anOrderedRenderableto the draw context's ordered renderable list.voidaddOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)Adds anOrderedRenderableto the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables.voidaddOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)Adds anOrderedRenderableto the draw context's ordered surface renderable queue.voidaddPickedObject(PickedObject pickedObject)Adds the specified picked object to the list of objects at the pick point.voidaddPickedObjects(PickedObjectList pickedObjects)Adds a list of picked objects to the current list of objects at the pick point.voidaddPickPointFrustum()Creates a frustum around the current pick point and adds it to the current list of pick frustums.voidaddPickRectangleFrustum()Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.voidaddRenderingException(java.lang.Throwable t)Adds the specifiedThrowableto this DrawContext's collection of rendering exceptions.voidaddScreenCredit(ScreenCredit credit)Adds a screen-credit icon to display.voidapplyClutterFilter()Filter overlapping text from the ordered renderable list.voidbeginStandardLighting()Enables the current standard lighting model.Vec4computePointFromPosition(Position position, int altitudeMode)Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.Vec4computeTerrainPoint(Angle lat, Angle lon, double offset)Compute a model-coordinate point on the terrain.voiddisablePickingMode()Specifies that the scene controller has ended its pick traversal.voiddrawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)This is a diagnostic method to display normal vectors.voiddrawOutlinedShape(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.voiddrawUnitQuad()Draws a quadrilateral using the current OpenGL state.voiddrawUnitQuad(com.jogamp.opengl.util.texture.TextureCoords texCoords)Draws a quadrilateral using the current OpenGL state and specified texture coordinates.voiddrawUnitQuadOutline()Draws a quadrilateral outline using the current OpenGL state.voidenablePickingMode()Specifies that the scene controller is beginning its pick traversal.voidendStandardLighting()Pops the OpenGL state previously established bybeginStandardLighting().AnnotationRenderergetAnnotationRenderer()Returns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer.java.awt.ColorgetClearColor()Returns the WorldWindow's background color.ClutterFiltergetClutterFilter()Returns the current clutter filter.LayergetCurrentLayer()Returns the current-layer.DeclutteringTextRenderergetDeclutteringTextRenderer()Returns the draw context's decluttering text renderer.intgetDrawableHeight()Indicates the height in pixels of the drawing target associated with thisDrawContext.intgetDrawableWidth()Indicates the width in pixels of the drawing target associated with thisDrawContext.longgetFrameTimeStamp()Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence.SurfaceTileRenderergetGeographicSurfaceTileRenderer()Returns this draw context's surface tile renderer.com.jogamp.opengl.GLgetGL()Retrieves the currentcom.jogamp.opengl.GL.com.jogamp.opengl.GLContextgetGLContext()Retrieves thisDrawContextscom.jogamp.opengl.GLContext.com.jogamp.opengl.GLDrawablegetGLDrawable()Retrieves the currentcom.jogamp.opengl.GLDrawable.GlobegetGlobe()Retrieves the currentGlobe, which may be null.GLRuntimeCapabilitiesgetGLRuntimeCapabilities()Returns theGLRuntimeCapabilitiesassociated with this DrawContext.com.jogamp.opengl.glu.GLUgetGLU()Retrieves the currentcom.jogamp.opengl.glu.GLU.GpuResourceCachegetGpuResourceCache()Returns the GPU resource cache used by this draw context.LayerListgetLayers()Retrieves a list containing all the current layers.ModelgetModel()Retrieves the currentModel, which may be null.PickedObjectListgetObjectsInPickRectangle()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.intgetPickColorAtPoint(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.PickedObjectListgetPickedObjects()Returns the list of objects at the pick point during the most recent pick traversal.PickPointFrustumListgetPickFrustums()Gets the FrustumList containing all the current Pick Frustumsjava.awt.PointgetPickPoint()Returns the current pick point in AWT screen coordinates.java.awt.DimensiongetPickPointFrustumDimension()Gets the dimension of the current Pick Point Frustumjava.awt.RectanglegetPickRectangle()Returns the current pick rectangle in AWT screen coordinates.Vec4getPointOnTerrain(Angle latitude, Angle longitude)Computes a location's Cartesian point on the currently visible terrain.intgetRedrawRequested()Indicates whether a new frame should be generated by theSceneController.java.util.Collection<java.lang.Throwable>getRenderingExceptions()Gets the rendering exceptions associated with this DrawContext as aCollectionofThrowableobjects.java.util.Map<ScreenCredit,java.lang.Long>getScreenCredits()Returns the screen credits currently held and displayed by this draw context.LightingModelgetStandardLightingModel()Returns the current model used for standard lighting.SectorGeometryListgetSurfaceGeometry()Retrieves a list of all the sectors rendered so far this frame.TerraingetTerrain()Returns aTerrainobject that uses the current sector geometry or the current globe to compute surface points.TextRendererCachegetTextRendererCache()Returns this draw context's text-renderer cache.GpuResourceCachegetTextureCache()Returns the GPU resource cache for this draw context.java.awt.ColorgetUniquePickColor()Returns a unique color to serve as a pick identifier during picking.java.awt.ColorgetUniquePickColorRange(int count)Returns a range of unique colors to serve as pick identifiers during picking.doublegetVerticalExaggeration()Retrieves the current vertical exaggeration.ViewgetView()Retrieves the currentView, which may be null.PositiongetViewportCenterPosition()Indicates the geographic coordinates of the point on the terrain at the current viewport's center.java.awt.PointgetViewportCenterScreenPoint()Indicates the screen-coordinate point of the current viewport's center.SectorgetVisibleSector()Retrieves aSectorwhich is at least as large as the current visible sector.java.util.List<Sector>getVisibleSectors(double[] resolutions, long timeLimit, Sector searchSector)Returns the visible sectors at one of several specified resolutions within a specified search sector.voidinitialize(com.jogamp.opengl.GLContext glContext)Initializes thisDrawContext.booleanis2DGlobe()booleanisContinuous2DGlobe()booleanisDeepPickingEnabled()Indicates whether all items under cursor are picked.booleanisOrderedRenderingMode()Indicates whether theSceneControlleris currently rendering the draw context'sOrderedRenderables.booleanisPickingMode()Indicates whether the scene controller is currently picking.booleanisPreRenderMode()Indicates whether the scene controller is currently pre-rendering.booleanisSmall(Extent extent, int numPixels)Indicates whether a specified extent is smaller than a specified number of pixels for the current view.OrderedRenderablepeekOrderedRenderables()Returns the nextOrderedRenderableon the ordered-renderable priority queue but does not remove it from the queue.OrderedRenderablepollOrderedRenderables()Returns the nextOrderedRenderableon the ordered-renderable priority queue and removes it from the queue.voidpopProjectionOffest()Removes the current projection matrix offset added bypushProjectionOffest(Double).voidpushProjectionOffest(java.lang.Double offset)Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point.voidrestoreDefaultBlending()Restores the current OpenGL context's blending state to its default.voidrestoreDefaultCurrentColor()Restores the current OpenGL context's current color to its default.voidrestoreDefaultDepthTesting()Restores the current OpenGL context's depth testing state to its default.voidsetAnnotationRenderer(AnnotationRenderer annotationRenderer)SinceAnnotations areRenderables, they can be exist outside anAnnotationLayer, in which case they are responsible for rendering themselves.voidsetClutterFilter(ClutterFilter filter)Specifies the clutter filter to use.voidsetCurrentLayer(Layer layer)Sets the current-layer field to the specified layer or null.voidsetDeepPickingEnabled(boolean tf)Specifies whether all items under the cursor are picked.voidsetFrameTimeStamp(long frameTimeStamp)Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence.voidsetGLContext(com.jogamp.opengl.GLContext glContext)Assigns thisDrawContexta newcom.jogamp.opengl.GLContext.voidsetGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)Sets theGLRuntimeCapabilitiesassociated with this DrawContext to the specified parameter.voidsetGpuResourceCache(GpuResourceCache gpuResourceCache)Specifies the GPU resource cache for this draw context.voidsetModel(Model model)Assign a newModel.voidsetOrderedRenderingMode(boolean tf)Called by theSceneControllerto indicate whether it is currently drawing the draw context'sOrderedRenderables.voidsetPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.Object statistic)Specifies a performance statistic that's assigned for each frame.voidsetPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)Specifies a collection of per-frame performance statistics.voidsetPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.Collection<PerformanceStatistic> stats)Specifies the performance statistics that are monitored during each frame.voidsetPickPoint(java.awt.Point pickPoint)Specifies the current pick point in AWT screen coordinates, ornullto indicate that there is no pick point.voidsetPickPointFrustumDimension(java.awt.Dimension dim)Set the size (in pixels) of the pick point frustum at the near plane.voidsetPickRectangle(java.awt.Rectangle pickRect)Specifies the current pick rectangle in AWT screen coordinates, ornullto indicate that there is no pick rectangle.voidsetPreRenderMode(boolean preRenderMode)Specifies whether the scene controller is pre-rendering.voidsetRedrawRequested(int redrawRequested)Requests that a new frame should be generated by theSceneController.voidsetRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)Sets the rendering exceptions associated with this DrawContext to the specifiedCollectionofThrowableobjects.voidsetStandardLightingModel(LightingModel standardLighting)Specifies the lighting model used for standard lighting.voidsetSurfaceGeometry(SectorGeometryList surfaceGeometry)Specifies the current surface geometry.voidsetTextRendererCache(TextRendererCache textRendererCache)Specifies this context's text renderer cache.voidsetVerticalExaggeration(double verticalExaggeration)Sets the vertical exaggeration.voidsetView(View view)Assigns a newView.voidsetViewportCenterPosition(Position viewportCenterPosition)Specifies the geographic coordinates of the point on the terrain at the current viewport's center.voidsetViewportCenterScreenPoint(java.awt.Point viewportCenterPoint)Specifies the screen-coordinate point of the current viewport's center.voidsetVisibleSector(Sector s)Sets the visibleSector.-
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 gov.nasa.worldwind.Disposable
dispose
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Method Detail
-
setGLContext
void setGLContext(com.jogamp.opengl.GLContext glContext)
Assigns thisDrawContexta newcom.jogamp.opengl.GLContext. May throw aNullPointerExceptionifglContextis null.- Parameters:
glContext- the newcom.jogamp.opengl.GLContext- Throws:
java.lang.NullPointerException- if glContext is null- Since:
- 1.5
-
getGLContext
com.jogamp.opengl.GLContext getGLContext()
Retrieves thisDrawContextscom.jogamp.opengl.GLContext. If this method returns null, then there are potentially no activeGLContexts and rendering should be aborted.- Returns:
- this
DrawContextscom.jogamp.opengl.GLContext. - Since:
- 1.5
-
getGL
com.jogamp.opengl.GL getGL()
Retrieves the currentcom.jogamp.opengl.GL. AGLorGLUis required for all graphical rendering in WorldWind.- Returns:
- the current
GLif available, null otherwise - Since:
- 1.5
-
getGLU
com.jogamp.opengl.glu.GLU getGLU()
Retrieves the currentcom.jogamp.opengl.glu.GLU. AGLUorGLis required for all graphical rendering in WorldWind.- Returns:
- the current
GLUif available, null otherwise - Since:
- 1.5
-
getGLDrawable
com.jogamp.opengl.GLDrawable getGLDrawable()
Retrieves the currentcom.jogamp.opengl.GLDrawable. AGLDrawablecan be used to create aGLContext, which can then be used for rendering.- Returns:
- the current
GLDrawable, null if none available - Since:
- 1.5
-
getDrawableWidth
int getDrawableWidth()
Indicates the width in pixels of the drawing target associated with thisDrawContext. The returned width is potentially different from the GL viewport width. If this DrawContext is associated with aGLJPanel, 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 thisDrawContext.- Returns:
- the width of the drawing target associated with this
DrawContext, in pixels.
-
getDrawableHeight
int getDrawableHeight()
Indicates the height in pixels of the drawing target associated with thisDrawContext. The returned height is potentially different from the GL viewport height. If this DrawContext is associated with aGLJPanel, 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 thisDrawContext.- Returns:
- the height of the drawing target associated with this
DrawContext, in pixels.
-
getGLRuntimeCapabilities
GLRuntimeCapabilities getGLRuntimeCapabilities()
Returns theGLRuntimeCapabilitiesassociated with this DrawContext.- Returns:
- this DrawContext's associated GLRuntimeCapabilities.
-
setGLRuntimeCapabilities
void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
Sets theGLRuntimeCapabilitiesassociated with this DrawContext to the specified parameter.- Parameters:
capabilities- the GLRuntimeCapabilities to be associated with this DrawContext.- Throws:
java.lang.IllegalArgumentException- if the capabilities are null.
-
initialize
void initialize(com.jogamp.opengl.GLContext glContext)
Initializes thisDrawContext. This method should be called at the beginning of each frame to prepare theDrawContextfor the coming render pass.- Parameters:
glContext- thecom.jogamp.opengl.GLContextto use for this render pass- Since:
- 1.5
-
setView
void setView(View view)
Assigns a newView. Some layers cannot function properly with a nullView. It is recommended that theViewis never set to null during a normal render pass.- Parameters:
view- the enwView- Since:
- 1.5
-
getView
View getView()
Retrieves the currentView, which may be null.- Returns:
- the current
View, which may be null - Since:
- 1.5
-
setModel
void setModel(Model model)
Assign a newModel. Some layers cannot function properly with a nullModel. It is recommended that theModelis never set to null during a normal render pass.- Parameters:
model- the newModel- Since:
- 1.5
-
getModel
Model getModel()
Retrieves the currentModel, which may be null.- Returns:
- the current
Model, which may be null - Since:
- 1.5
-
getGlobe
Globe getGlobe()
Retrieves the currentGlobe, which may be null.- Returns:
- the current
Globe, which may be null - Since:
- 1.5
-
getLayers
LayerList getLayers()
Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.- Returns:
- a
LayerListcontaining all the current layers - Since:
- 1.5
-
getVisibleSector
Sector getVisibleSector()
Retrieves aSectorwhich is at least as large as the current visible sector. The value returned is the value passed toSetVisibleSector. This method may return null.- Returns:
- a
Sectorat least the size of the current visible sector, null if unavailable - Since:
- 1.5
-
setVisibleSector
void setVisibleSector(Sector s)
Sets the visibleSector. The new visible sector must completely encompass the Sector which is visible on the display.- Parameters:
s- the new visibleSector- Since:
- 1.5
-
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 underlyingGlobe. 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
-
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 underlyingGlobe. 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
-
getSurfaceGeometry
SectorGeometryList getSurfaceGeometry()
Retrieves a list of all the sectors rendered so far this frame.- Returns:
- a
SectorGeometryListcontaining everySectorGeometryrendered so far this render pass. - Since:
- 1.5
-
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 isnull.- Returns:
- the list of picked objects.
-
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 callinggetPickedObjects().- Parameters:
pickedObjects- the list to add.- Throws:
java.lang.IllegalArgumentException- if pickedObjects isnull.
-
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 callinggetPickedObjects().- Parameters:
pickedObject- the object to add.- Throws:
java.lang.IllegalArgumentException- if pickedObject isnull.
-
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 isnull.- Returns:
- the list of picked objects.
-
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 callinggetObjectsInPickRectangle().- Parameters:
pickedObject- the object to add.- Throws:
java.lang.IllegalArgumentException- if pickedObject isnull.
-
getUniquePickColor
java.awt.Color getUniquePickColor()
Returns a unique color to serve as a pick identifier during picking. This allocates a single unique color from the pick color address space and returns that color. The color's RGB components represent an address to the pick color code.- Returns:
- a unique pick color.
-
getUniquePickColorRange
java.awt.Color getUniquePickColorRange(int count)
Returns a range of unique colors to serve as pick identifiers during picking. This allocatescountunique 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-argumentgetUniquePickColor()counttimes, but guarantees a contiguous range of color codes and is more efficient whencountis large.The number of pick colors is limited to a finite address space. This method returns null when there are fewer than
countremaining unique colors in the pick color address space, or whencountis less than 1.- Parameters:
count- the number of unique colors to allocate.- Returns:
- the first unique pick color if there are sufficient unique colors remaining and
countis greater than 0, otherwise null.
-
getClearColor
java.awt.Color getClearColor()
Returns the WorldWindow's background color.- Returns:
- the WorldWindow's background color.
-
getPickColorAtPoint
int getPickColorAtPoint(java.awt.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:
java.lang.IllegalArgumentException- if the point isnull.
-
getPickColorsInRectangle
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. 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
nullif 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 benullto specify that all color codes must be returned.- Returns:
- the unique RGB colors corresponding to the specified rectangle, or
nullif the rectangle is empty or the rectangle contains only the clear color. - Throws:
java.lang.IllegalArgumentException- if the rectangle isnull.
-
enablePickingMode
void enablePickingMode()
Specifies that the scene controller is beginning its pick traversal.
-
isPickingMode
boolean isPickingMode()
Indicates whether the scene controller is currently picking.- Returns:
- true if the scene controller is picking, otherwise false
-
disablePickingMode
void disablePickingMode()
Specifies that the scene controller has ended its pick traversal.
-
setDeepPickingEnabled
void setDeepPickingEnabled(boolean tf)
Specifies whether all items under the cursor are picked.- Parameters:
tf- true to pick all objects under the cursor
-
isDeepPickingEnabled
boolean isDeepPickingEnabled()
Indicates whether all items under cursor are picked.- Returns:
- true if all items under the cursor are picked, otherwise false
-
addOrderedRenderable
void addOrderedRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderableto the draw context's ordered renderable list.- Parameters:
orderedRenderable- the ordered renderable to add.- Throws:
java.lang.IllegalArgumentException- if the ordered renderable is null.
-
addOrderedRenderable
void addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
Adds anOrderedRenderableto the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables. IfisBehindistrue, 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 withisBehindspecified astrue, those ordered renderables are drawn according to the order in which they are added.- Parameters:
orderedRenderable- the ordered renderable to add.isBehind-trueto specify that the ordered renderable is behind all other ordered renderables, orfalseto interpret the ordered renderable according to its eye distance.
-
addOrderedSurfaceRenderable
void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderableto 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.
-
getOrderedSurfaceRenderables
java.util.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.
-
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(com.jogamp.opengl.util.texture.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:
java.lang.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).
-
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.
-
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.
-
getGeographicSurfaceTileRenderer
SurfaceTileRenderer getGeographicSurfaceTileRenderer()
Returns this draw context's surface tile renderer.- Returns:
- this draw context's surface tile renderer.s
-
getPickPoint
java.awt.Point getPickPoint()
Returns the current pick point in AWT screen coordinates.- Returns:
- the current pick point, or
nullif no pick point is available. - See Also:
setPickPoint(java.awt.Point)
-
setPickPoint
void setPickPoint(java.awt.Point pickPoint)
Specifies the current pick point in AWT screen coordinates, ornullto 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 callingaddPickedObject(gov.nasa.worldwind.pick.PickedObject). This list can be accessed by callinggetPickedObjects().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, ornullto specify that there is no pick point.
-
getPickRectangle
java.awt.Rectangle getPickRectangle()
Returns the current pick rectangle in AWT screen coordinates.- Returns:
- the current pick rectangle, or
nullif no pick rectangle is current. - See Also:
setPickRectangle(java.awt.Rectangle)
-
setPickRectangle
void setPickRectangle(java.awt.Rectangle pickRect)
Specifies the current pick rectangle in AWT screen coordinates, ornullto 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 callingaddObjectInPickRectangle(gov.nasa.worldwind.pick.PickedObject). This is list can be accessed by callinggetObjectsInPickRectangle().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, ornullto specify that there is no pick rectangle.
-
getTextureCache
GpuResourceCache getTextureCache()
Returns the GPU resource cache for this draw context. This method returns the same value asgetGpuResourceCache().- Returns:
- the GPU resource cache for this draw context.
- See Also:
getGpuResourceCache()
-
getGpuResourceCache
GpuResourceCache getGpuResourceCache()
Returns the GPU resource cache used by this draw context.- Returns:
- the GPU resource cache used by this draw context.
-
setGpuResourceCache
void setGpuResourceCache(GpuResourceCache gpuResourceCache)
Specifies the GPU resource cache for this draw context.- Parameters:
gpuResourceCache- the GPU resource cache for this draw context.
-
getPerFrameStatistics
java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
Returns the performance statistics that are gathered during each frame.- Returns:
- the performance statistics that are gathered during each frame.
-
setPerFrameStatisticsKeys
void setPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.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.
-
setPerFrameStatistic
void setPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.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:
java.lang.IllegalArgumentException- if either the key or display name are null.- See Also:
setPerFrameStatistics(java.util.Collection)
-
setPerFrameStatistics
void setPerFrameStatistics(java.util.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:
java.lang.IllegalArgumentException- if the list is null.- See Also:
setPerFrameStatistic(String, String, Object)
-
getPerFrameStatisticsKeys
java.util.Set<java.lang.String> getPerFrameStatisticsKeys()
Indicates the statistics that are monitored for each frame.- Returns:
- the keys of the statistics monitored for each frame.
-
getViewportCenterScreenPoint
java.awt.Point getViewportCenterScreenPoint()
Indicates the screen-coordinate point of the current viewport's center.- Returns:
- the screen-coordinate point of the current viewport's center.
-
setViewportCenterScreenPoint
void setViewportCenterScreenPoint(java.awt.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.
-
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.
-
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.
-
getTextRendererCache
TextRendererCache getTextRendererCache()
Returns this draw context's text-renderer cache.- Returns:
- this context's text renderer cache.
-
setTextRendererCache
void setTextRendererCache(TextRendererCache textRendererCache)
Specifies this context's text renderer cache.- Parameters:
textRendererCache- the context's text renderer cache.- Throws:
java.lang.IllegalArgumentException- if the cache is null.
-
getAnnotationRenderer
AnnotationRenderer getAnnotationRenderer()
Returns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer.- Returns:
- the annotation renderer.
-
setAnnotationRenderer
void setAnnotationRenderer(AnnotationRenderer annotationRenderer)
SinceAnnotations areRenderables, they can be exist outside anAnnotationLayer, 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:
java.lang.IllegalArgumentException- ifannotationRendereris null;
-
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.
-
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. SeeSystem.currentTimeMillis()for its numerical meaning.
-
getVisibleSectors
java.util.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:
java.lang.IllegalArgumentException- if the resolutions array or the search sector is null.
-
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.
-
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.
-
addScreenCredit
void addScreenCredit(ScreenCredit credit)
Adds a screen-credit icon to display.- Parameters:
credit- the screen credit to display.- Throws:
java.lang.IllegalArgumentException- if the credit is null.
-
getScreenCredits
java.util.Map<ScreenCredit,java.lang.Long> getScreenCredits()
Returns the screen credits currently held and displayed by this draw context.- Returns:
- the screen credits currently held by this draw context.
-
getRedrawRequested
int getRedrawRequested()
Indicates whether a new frame should be generated by theSceneController.- Returns:
- the delay in milliseconds if a redraw has been requested, otherwise 0.
-
setRedrawRequested
void setRedrawRequested(int redrawRequested)
Requests that a new frame should be generated by theSceneController.- Parameters:
redrawRequested- a delay in milliseconds if a redraw is requested, otherwise 0.
-
getPickFrustums
PickPointFrustumList getPickFrustums()
Gets the FrustumList containing all the current Pick Frustums- Returns:
- FrustumList of Pick Frustums
-
setPickPointFrustumDimension
void setPickPointFrustumDimension(java.awt.Dimension dim)
Set the size (in pixels) of the pick point frustum at the near plane.- Parameters:
dim- dimension of pick point frustum
-
getPickPointFrustumDimension
java.awt.Dimension getPickPointFrustumDimension()
Gets the dimension of the current Pick Point Frustum- Returns:
- the dimension of the current Pick Point Frustum
-
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 callingsetPickPointFrustumDimension(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.
-
getRenderingExceptions
java.util.Collection<java.lang.Throwable> getRenderingExceptions()
Gets the rendering exceptions associated with this DrawContext as aCollectionofThrowableobjects. If non-null, the returned Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext inaddRenderingException(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.
-
setRenderingExceptions
void setRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)
Sets the rendering exceptions associated with this DrawContext to the specifiedCollectionofThrowableobjects. If non-null, the specified Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext inaddRenderingException(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.
-
addRenderingException
void addRenderingException(java.lang.Throwable t)
Adds the specifiedThrowableto 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 aThrowable.- Throws:
java.lang.IllegalArgumentException- if the Throwable is null.
-
pushProjectionOffest
void pushProjectionOffest(java.lang.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, callpopProjectionOffest()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()
-
popProjectionOffest
void popProjectionOffest()
Removes the current projection matrix offset added bypushProjectionOffest(Double).- See Also:
pushProjectionOffest(Double)
-
isOrderedRenderingMode
boolean isOrderedRenderingMode()
Indicates whether theSceneControlleris currently rendering the draw context'sOrderedRenderables. When the this method returns false during a call to an ordered renderable'sRenderable.render(DrawContext)method, the ordered renderable should add itself to the draw context viaaddOrderedRenderable(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.
-
setOrderedRenderingMode
void setOrderedRenderingMode(boolean tf)
Called by theSceneControllerto indicate whether it is currently drawing the draw context'sOrderedRenderables. SeeisOrderedRenderingMode()for more information.- Parameters:
tf- true if ordered renderables are being drawn, false if ordered renderables are only being accumulated.
-
drawOutlinedShape
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.- Parameters:
renderer- an object implementing theOutlinedShapeinterface for the shape.shape- the shape to render.- See Also:
OutlinedShape
-
beginStandardLighting
void beginStandardLighting()
Enables the current standard lighting model.endStandardLighting()must be called when rendering of the current shape is complete.
-
endStandardLighting
void endStandardLighting()
Pops the OpenGL state previously established bybeginStandardLighting().
-
getStandardLightingModel
LightingModel getStandardLightingModel()
Returns the current model used for standard lighting.- Returns:
- the current standard lighting model, or null if no model is defined.
-
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.
-
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:
java.lang.IllegalArgumentException- if either the latitude or longitude is null.
-
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.
-
drawNormals
void drawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.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.
-
peekOrderedRenderables
OrderedRenderable peekOrderedRenderables()
Returns the nextOrderedRenderableon 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 nextOrderedRenderableon 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.
-
getTerrain
Terrain getTerrain()
Returns aTerrainobject that uses the current sector geometry or the current globe to compute surface points.- Returns:
- a terrain object for computing surface points and intersections.
-
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.
-
isPreRenderMode
boolean isPreRenderMode()
Indicates whether the scene controller is currently pre-rendering.- Returns:
- true if pre-rendering, otherwise false.
- See Also:
PreRenderable
-
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
-
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:
java.lang.IllegalArgumentException- if the position is null.
-
getDeclutteringTextRenderer
DeclutteringTextRenderer getDeclutteringTextRenderer()
Returns the draw context's decluttering text renderer.- Returns:
- the decluttering text renderer.
-
applyClutterFilter
void applyClutterFilter()
Filter overlapping text from the ordered renderable list.
-
setClutterFilter
void setClutterFilter(ClutterFilter filter)
Specifies the clutter filter to use. May be null to indicate no decluttering.- Parameters:
filter- the clutter filter.
-
getClutterFilter
ClutterFilter getClutterFilter()
Returns the current clutter filter.- Returns:
- the current clutter filter.
-
is2DGlobe
boolean is2DGlobe()
-
isContinuous2DGlobe
boolean isContinuous2DGlobe()
-
-