Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nasaworldwind/worldwindjava/llms.txt
Use this file to discover all available pages before exploring further.
WorldWindow is the top-level interface that every WorldWind rendering surface implements. It binds together a Model (globe + layers), a View (camera), a SceneController (render loop), an InputHandler (mouse/keyboard routing), and a set of event-listener registries into a single object that an application can embed in its UI hierarchy. All rendering, picking, and event dispatch flows through a WorldWindow. The interface extends AVList so that arbitrary key-value metadata can be attached to any window instance.
Package: gov.nasa.worldwind
Interface: public interface WorldWindow extends AVList
Implementations
WorldWind ships two ready-to-use concrete implementations, both located ingov.nasa.worldwind.awt.
WorldWindowGLCanvas
WorldWindowGLCanvas — heavyweight AWT component
WorldWindowGLCanvas is a heavyweight AWT component backed by JOGL’s GLCanvas. Because it is a native peer component it has the best and most consistent performance across platforms and is the recommended choice for most applications. It can be mixed with lightweight Swing components provided the standard Swing light/heavyweight workarounds are applied (disable lightweight pop-ups via ToolTipManager.setLightWeightPopupEnabled(false) etc.).
It is stereo-capable: set the JVM property gov.nasa.worldwind.stereo.mode=device before constructing the canvas to request a stereo-capable OpenGL context; pair this with a StereoSceneController in worldwind.xml.
WorldWindowGLJPanel
WorldWindowGLJPanel — lightweight Swing component
WorldWindowGLJPanel is a lightweight Swing panel backed by JOGL’s GLJPanel. It allows the WorldWind globe to participate in z-ordering with other Swing components (translucent panels, overlays, etc.) without the airspace clipping problems that heavyweight components impose. The trade-off is historically lower and less predictable rendering performance. Use it only when Swing z-order integration is essential.
Model and View
setModel / getModel
Model access
Model (the globe plus its layer list) to this window. Passing null disassociates any current model. The scene controller is notified automatically.
The model to display. May be
null to detach the current model.setView / getView
View access
View (camera) used to render this window’s model. Passing null disassociates the current view.
The view to use. May be
null to detach the current view.setModelAndView
Atomic model and view assignment
null.
The model to display. May be
null.The view to use. May be
null.getSceneController / setSceneController
SceneController access
SceneController that drives the render and pick loops for this window. When replacing the scene controller the caller is responsible for populating the new instance with a View, Model, and any desired per-frame statistics keys before passing it in.
The new scene controller. The caller must configure its view and model before attaching it.
SceneController — the current scene controller, or null if none is associated.
Rendering
redraw
Asynchronous repaint request
WorldWindowGLCanvas this delegates to Component.repaint().
redrawNow
Synchronous immediate repaint
redraw().
getGpuResourceCache
GPU resource cache
GpuResourceCache that manages all GPU-resident resources (textures, VBOs, display lists) allocated for this window’s OpenGL context. This method is primarily for use by custom shapes and layers that manage their own GPU objects. Applications should not clear or modify the cache directly.
Returns: GpuResourceCache
Event Listeners
Select Listeners
Select listener registration
SelectEvent notifications whenever the user performs an operation that identifies a visible object — a left-click, right-click, hover, drag, or box-select. The event carries the PickedObjectList of all objects under the cursor at the time of the event.
The listener to add or remove.
Position Listeners
Position listener registration
Position (latitude, longitude, altitude) under the cursor, or null if the cursor is not over the globe.
The listener to add or remove.
Rendering Listeners
Rendering listener registration
The listener to add or remove.
Rendering Exception Listeners
Rendering exception listener registration
The listener to add or remove.
Input Handler
Input handler access
InputHandler translates AWT mouse and keyboard events into WorldWind SelectEvents and view-manipulation gestures. The default implementation installed by both concrete window classes is AWTInputHandler, configured via AVKey.INPUT_HANDLER_CLASS_NAME in worldwind.xml. Pass null to setInputHandler to detach the current handler (a no-op handler is installed internally so the window remains functional).
The input handler to use. Pass
null to detach the current handler.Performance
getPerFrameStatistics
Per-frame statistics
setPerFrameStatisticsKeys are populated.
Returns: Collection<PerformanceStatistic>
setPerFrameStatisticsKeys
Activating statistics
PerformanceStatistic (e.g., PerformanceStatistic.FRAME_RATE). Passing an empty set disables all per-frame measurement. The activated set is forwarded to the SceneController.
The set of statistic keys to activate. Use
PerformanceStatistic constant strings.WorldWindowGLCanvas Constructors
WorldWindowGLCanvas provides four constructors to cover the most common deployment scenarios.
Default constructor — single window on the default graphics device
GraphicsDevice using WorldWind’s required GLCapabilities. A default View and AWTInputHandler are constructed and attached automatically.
Shared-context constructor
GpuResourceCache (and underlying OpenGL context) with an existing WorldWindow. Use this when displaying multiple synchronized views of the same scene so that textures and geometry are not duplicated in GPU memory.
An existing
WorldWindow whose GPU resources should be shared. May be null for an independent context.Device-specific constructor
GraphicsDevice (useful for multi-monitor setups) with optional GPU resource sharing.
An existing
WorldWindow to share resources with. May be null.The target graphics device. Pass
null to use the default screen device.Full-control constructor
GLCapabilities profile or GLCapabilitiesChooser.
Resource-sharing partner. May be
null.Target display device. May be
null.Custom OpenGL capabilities. May be
null to use WorldWind defaults.Custom capabilities chooser. May be
null to use the default BasicGLCapabilitiesChooser.Code Example
The following example creates a basic application window with aWorldWindowGLCanvas embedded in a Swing frame and registers a SelectListener to print the name of any picked object.
Creating a WorldWindowGLCanvas with a SelectListener