Class WorldWindowImpl
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.WorldWindowImpl
-
- All Implemented Interfaces:
AVList
,MessageListener
,WorldWindow
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
WorldWindowGLAutoDrawable
public abstract class WorldWindowImpl extends WWObjectImpl implements WorldWindow
An implementation class for theWorldWindow
interface. Classes implementingWorldWindow
can subclass or aggregate this object to provide defaultWorldWindow
functionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected GpuResourceCache
gpuResourceCache
-
Constructor Summary
Constructors Constructor Description WorldWindowImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPositionListener(PositionListener listener)
Adds a position listener to this WorldWindow.void
addRenderingExceptionListener(RenderingExceptionListener listener)
Adds an exception listener to this WorldWindow.void
addRenderingListener(RenderingListener listener)
Adds a rendering listener to this WorldWindow.void
addSelectListener(SelectListener listener)
Adds a select listener to this WorldWindow.protected void
callPositionListeners(PositionEvent event)
protected void
callRenderingExceptionListeners(java.lang.Throwable exception)
protected void
callRenderingListeners(RenderingEvent event)
protected void
callSelectListeners(SelectEvent event)
static void
configureIdentityPixelScale(com.jogamp.nativewindow.ScalableSurface surface)
Configures JOGL's surface pixel scaling on the specifiedScalableSurface
to ensure backward compatibility with WorldWind applications developed prior to JOGL pixel scaling's introduction.This method is used byGLCanvas
andGLJPanel
to effectively disable JOGL's surface pixel scaling by requesting a 1:1 scale.static GpuResourceCache
createGpuResourceCache()
protected PickedObjectList
getCurrentBoxSelection()
Position
getCurrentPosition()
Returns the current latitude, longitude and altitude of the current cursor position, ornull
if the cursor is not on the globe.protected PickedObject
getCurrentSelection()
GpuResourceCache
getGpuResourceCache()
Returns the GPU Resource used by this WorldWindow.InputHandler
getInputHandler()
Returns the input handler associated with this instance.Model
getModel()
Returns the window's current model.PickedObjectList
getObjectsAtCurrentPosition()
Returns the WorldWind objects at the current cursor position.PickedObjectList
getObjectsInSelectionBox()
Returns the WorldWind objects intersecting the current selection box.java.util.Collection<PerformanceStatistic>
getPerFrameStatistics()
Returns the active per-frame performance statistics such as number of tiles drawn in the most recent frame.SceneController
getSceneController()
Returns the scene controller associated with this instance.View
getView()
Returns this window's current view.void
redraw()
Causes a repaint event to be enqueued with the window system for this WorldWindow.void
redrawNow()
Immediately repaints the WorldWindow without waiting for a window system repaint event.void
removePositionListener(PositionListener listener)
Removes the specified position listener associated with this WorldWindow.void
removeRenderingExceptionListener(RenderingExceptionListener listener)
Removes the specified rendering exception listener associated with this WorldWindow.void
removeRenderingListener(RenderingListener listener)
Removes a specified rendering listener associated with this WorldWindow.void
removeSelectListener(SelectListener listener)
Removes the specified select listener associated with this WorldWindow.void
setGpuResourceCache(GpuResourceCache gpuResourceCache)
void
setInputHandler(InputHandler inputHandler)
Sets the input handler to use for this instance.void
setModel(Model model)
Sets the model to display in this window.void
setModelAndView(Model model, View view)
Sets the model to display in this window and the view used to display it.void
setPerFrameStatisticsKeys(java.util.Set<java.lang.String> keys)
Activates the per-frame performance statistic specified.void
setSceneController(SceneController sc)
Specifies a new scene controller for the window.void
setView(View view)
Sets the view to use when displaying this window's model.void
shutdown()
Causes resources used by the WorldWindow to be freed.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
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
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.WorldWindow
getContext, isEnableGpuCacheReinitialization, setEnableGpuCacheReinitialization
-
-
-
-
Field Detail
-
gpuResourceCache
protected GpuResourceCache gpuResourceCache
-
-
Method Detail
-
shutdown
public void shutdown()
Causes resources used by the WorldWindow to be freed. The WorldWindow cannot be used once this method is called. An OpenGL context for the window must be current.- Specified by:
shutdown
in interfaceWorldWindow
-
getGpuResourceCache
public GpuResourceCache getGpuResourceCache()
Description copied from interface:WorldWindow
Returns the GPU Resource used by this WorldWindow. This method is for internal use only.Note: Applications do not need to interact with the GPU resource cache. It is self managed. Modifying it in any way will cause significant problems such as excessive memory usage or application crashes. The only reason to use the GPU resource cache is to request management of GPU resources within implementations of shapes or layers. And then access should be only through the draw context only.
- Specified by:
getGpuResourceCache
in interfaceWorldWindow
- Returns:
- The GPU Resource cache used by this WorldWindow.
-
setGpuResourceCache
public void setGpuResourceCache(GpuResourceCache gpuResourceCache)
-
setModel
public void setModel(Model model)
Description copied from interface:WorldWindow
Sets the model to display in this window. Ifnull
is specified for the model, the current model, if any, is disassociated with the window.- Specified by:
setModel
in interfaceWorldWindow
- Parameters:
model
- the model to display. May benull
.
-
getModel
public Model getModel()
Description copied from interface:WorldWindow
Returns the window's current model.- Specified by:
getModel
in interfaceWorldWindow
- Returns:
- the window's current model.
-
setView
public void setView(View view)
Description copied from interface:WorldWindow
Sets the view to use when displaying this window's model. Ifnull
is specified for the view, the current view, if any, is disassociated with the window.- Specified by:
setView
in interfaceWorldWindow
- Parameters:
view
- the view to use to display this window's model. May be null.
-
getView
public View getView()
Description copied from interface:WorldWindow
Returns this window's current view.- Specified by:
getView
in interfaceWorldWindow
- Returns:
- the window's current view.
-
setModelAndView
public void setModelAndView(Model model, View view)
Description copied from interface:WorldWindow
Sets the model to display in this window and the view used to display it. Ifnull
is specified for the model, the current model, if any, is disassociated with the window. Ifnull
is specified for the view, the current view, if any, is disassociated with the window.- Specified by:
setModelAndView
in interfaceWorldWindow
- Parameters:
model
- the model to display. May benull
.view
- the view to use to display this window's model. May benull
.
-
getSceneController
public SceneController getSceneController()
Description copied from interface:WorldWindow
Returns the scene controller associated with this instance.- Specified by:
getSceneController
in interfaceWorldWindow
- Returns:
- The scene controller associated with the instance, or
null
if no scene controller is associated.
-
setSceneController
public void setSceneController(SceneController sc)
Description copied from interface:WorldWindow
Specifies a new scene controller for the window. The caller is responsible for populating the new scene controller with aView
,Model
and any desired per-frame statistics keys.- Specified by:
setSceneController
in interfaceWorldWindow
- Parameters:
sc
- the new scene controller.- See Also:
SceneController.setView(View)
,SceneController.setModel(Model)
,SceneController.setPerFrameStatisticsKeys(java.util.Set)
-
getInputHandler
public InputHandler getInputHandler()
Description copied from interface:WorldWindow
Returns the input handler associated with this instance.- Specified by:
getInputHandler
in interfaceWorldWindow
- Returns:
- The input handler associated with this instance, or
null
if no input handler is associated.
-
setInputHandler
public void setInputHandler(InputHandler inputHandler)
Description copied from interface:WorldWindow
Sets the input handler to use for this instance.- Specified by:
setInputHandler
in interfaceWorldWindow
- Parameters:
inputHandler
- The input handler to use for this WorldWindow. May bynull
ifnull
is specified, the current input handler, if any, is disassociated with the WorldWindow.
-
redraw
public void redraw()
Description copied from interface:WorldWindow
Causes a repaint event to be enqueued with the window system for this WorldWindow. The repaint will occur at the window system's discretion, within the window system toolkit's event loop, and on the thread of that loop. This is the preferred method for requesting a repaint of the WorldWindow.- Specified by:
redraw
in interfaceWorldWindow
-
redrawNow
public void redrawNow()
Description copied from interface:WorldWindow
Immediately repaints the WorldWindow without waiting for a window system repaint event. This is not the preferred way to cause a repaint, but is provided for the rare cases that require it.- Specified by:
redrawNow
in interfaceWorldWindow
-
setPerFrameStatisticsKeys
public void setPerFrameStatisticsKeys(java.util.Set<java.lang.String> keys)
Description copied from interface:WorldWindow
Activates the per-frame performance statistic specified. Per-frame statistics measure values within a single frame of rendering, such as number of tiles drawn to produce the frame.- Specified by:
setPerFrameStatisticsKeys
in interfaceWorldWindow
- Parameters:
keys
- The statistics to activate.
-
getPerFrameStatistics
public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
Description copied from interface:WorldWindow
Returns the active per-frame performance statistics such as number of tiles drawn in the most recent frame.- Specified by:
getPerFrameStatistics
in interfaceWorldWindow
- Returns:
- The keys and values of the active per-frame statistics.
-
getObjectsAtCurrentPosition
public PickedObjectList getObjectsAtCurrentPosition()
Description copied from interface:WorldWindow
Returns the WorldWind objects at the current cursor position. The list of objects under the cursor is determined each time the WorldWindow is repainted. This method returns the list of objects determined when the most recent repaint was performed.- Specified by:
getObjectsAtCurrentPosition
in interfaceWorldWindow
- Returns:
- The list of objects at the cursor position, or
null
if no objects are under the cursor.
-
getObjectsInSelectionBox
public PickedObjectList getObjectsInSelectionBox()
Description copied from interface:WorldWindow
Returns the WorldWind objects intersecting the current selection box. The list of objects in the selection box is determined each time the WorldWindow is repainted. This method returns the list of objects determined when the most recent repaint was performed.- Specified by:
getObjectsInSelectionBox
in interfaceWorldWindow
- Returns:
- The list of objects intersecting the selection box, or
null
if no objects are in the box.
-
getCurrentPosition
public Position getCurrentPosition()
Description copied from interface:WorldWindow
Returns the current latitude, longitude and altitude of the current cursor position, ornull
if the cursor is not on the globe.- Specified by:
getCurrentPosition
in interfaceWorldWindow
- Returns:
- The current position of the cursor, or
null
if the cursor is not positioned on the globe.
-
getCurrentSelection
protected PickedObject getCurrentSelection()
-
getCurrentBoxSelection
protected PickedObjectList getCurrentBoxSelection()
-
addRenderingListener
public void addRenderingListener(RenderingListener listener)
Description copied from interface:WorldWindow
Adds a rendering listener to this WorldWindow. Rendering listeners are called at key point during WorldWind drawing and provide applications the ability to participate or monitor rendering.- Specified by:
addRenderingListener
in interfaceWorldWindow
- Parameters:
listener
- The rendering listener to add to those notified of rendering events by this WorldWindow.
-
removeRenderingListener
public void removeRenderingListener(RenderingListener listener)
Description copied from interface:WorldWindow
Removes a specified rendering listener associated with this WorldWindow.- Specified by:
removeRenderingListener
in interfaceWorldWindow
- Parameters:
listener
- The rendering listener to remove.
-
callRenderingListeners
protected void callRenderingListeners(RenderingEvent event)
-
addPositionListener
public void addPositionListener(PositionListener listener)
Description copied from interface:WorldWindow
Adds a position listener to this WorldWindow. Position listeners are called when the cursor's position changes. They identify the position of the cursor on the globe, or that the cursor is not on the globe.- Specified by:
addPositionListener
in interfaceWorldWindow
- Parameters:
listener
- The position listener to add.
-
removePositionListener
public void removePositionListener(PositionListener listener)
Description copied from interface:WorldWindow
Removes the specified position listener associated with this WorldWindow.- Specified by:
removePositionListener
in interfaceWorldWindow
- Parameters:
listener
- The listener to remove.
-
callPositionListeners
protected void callPositionListeners(PositionEvent event)
-
addSelectListener
public void addSelectListener(SelectListener listener)
Description copied from interface:WorldWindow
Adds a select listener to this WorldWindow. Select listeners are called when a selection is made by the user in the WorldWindow. A selection is any operation that identifies a visible item.- Specified by:
addSelectListener
in interfaceWorldWindow
- Parameters:
listener
- The select listener to add.
-
removeSelectListener
public void removeSelectListener(SelectListener listener)
Description copied from interface:WorldWindow
Removes the specified select listener associated with this WorldWindow.- Specified by:
removeSelectListener
in interfaceWorldWindow
- Parameters:
listener
- The select listener to remove.
-
callSelectListeners
protected void callSelectListeners(SelectEvent event)
-
addRenderingExceptionListener
public void addRenderingExceptionListener(RenderingExceptionListener listener)
Description copied from interface:WorldWindow
Adds an exception listener to this WorldWindow. Exception listeners are called when an exception or other critical event occurs during drawable initialization or during rendering.- Specified by:
addRenderingExceptionListener
in interfaceWorldWindow
- Parameters:
listener
- the The exception listener to add.
-
removeRenderingExceptionListener
public void removeRenderingExceptionListener(RenderingExceptionListener listener)
Description copied from interface:WorldWindow
Removes the specified rendering exception listener associated with this WorldWindow.- Specified by:
removeRenderingExceptionListener
in interfaceWorldWindow
- Parameters:
listener
- The listener to remove.
-
callRenderingExceptionListeners
protected void callRenderingExceptionListeners(java.lang.Throwable exception)
-
createGpuResourceCache
public static GpuResourceCache createGpuResourceCache()
-
configureIdentityPixelScale
public static void configureIdentityPixelScale(com.jogamp.nativewindow.ScalableSurface surface)
Configures JOGL's surface pixel scaling on the specifiedScalableSurface
to ensure backward compatibility with WorldWind applications developed prior to JOGL pixel scaling's introduction.This method is used byGLCanvas
andGLJPanel
to effectively disable JOGL's surface pixel scaling by requesting a 1:1 scale.Since v2.2.0, JOGL defaults to using high-dpi pixel scales where possible. This causes WorldWind screen elements such as placemarks, the compass, the world map, the view controls, and the scale bar (plus many more) to appear smaller than they are intended to on screen. The high-dpi default also has the effect of degrading WorldWind rendering performance.
- Parameters:
surface
- The surface to configure.
-
-