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 theWorldWindowinterface. Classes implementingWorldWindowcan subclass or aggregate this object to provide defaultWorldWindowfunctionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected GpuResourceCachegpuResourceCache
-
Constructor Summary
Constructors Constructor Description WorldWindowImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPositionListener(PositionListener listener)Adds a position listener to this WorldWindow.voidaddRenderingExceptionListener(RenderingExceptionListener listener)Adds an exception listener to this WorldWindow.voidaddRenderingListener(RenderingListener listener)Adds a rendering listener to this WorldWindow.voidaddSelectListener(SelectListener listener)Adds a select listener to this WorldWindow.protected voidcallPositionListeners(PositionEvent event)protected voidcallRenderingExceptionListeners(java.lang.Throwable exception)protected voidcallRenderingListeners(RenderingEvent event)protected voidcallSelectListeners(SelectEvent event)static voidconfigureIdentityPixelScale(com.jogamp.nativewindow.ScalableSurface surface)Configures JOGL's surface pixel scaling on the specifiedScalableSurfaceto ensure backward compatibility with WorldWind applications developed prior to JOGL pixel scaling's introduction.This method is used byGLCanvasandGLJPanelto effectively disable JOGL's surface pixel scaling by requesting a 1:1 scale.static GpuResourceCachecreateGpuResourceCache()protected PickedObjectListgetCurrentBoxSelection()PositiongetCurrentPosition()Returns the current latitude, longitude and altitude of the current cursor position, ornullif the cursor is not on the globe.protected PickedObjectgetCurrentSelection()GpuResourceCachegetGpuResourceCache()Returns the GPU Resource used by this WorldWindow.InputHandlergetInputHandler()Returns the input handler associated with this instance.ModelgetModel()Returns the window's current model.PickedObjectListgetObjectsAtCurrentPosition()Returns the WorldWind objects at the current cursor position.PickedObjectListgetObjectsInSelectionBox()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.SceneControllergetSceneController()Returns the scene controller associated with this instance.ViewgetView()Returns this window's current view.voidredraw()Causes a repaint event to be enqueued with the window system for this WorldWindow.voidredrawNow()Immediately repaints the WorldWindow without waiting for a window system repaint event.voidremovePositionListener(PositionListener listener)Removes the specified position listener associated with this WorldWindow.voidremoveRenderingExceptionListener(RenderingExceptionListener listener)Removes the specified rendering exception listener associated with this WorldWindow.voidremoveRenderingListener(RenderingListener listener)Removes a specified rendering listener associated with this WorldWindow.voidremoveSelectListener(SelectListener listener)Removes the specified select listener associated with this WorldWindow.voidsetGpuResourceCache(GpuResourceCache gpuResourceCache)voidsetInputHandler(InputHandler inputHandler)Sets the input handler to use for this instance.voidsetModel(Model model)Sets the model to display in this window.voidsetModelAndView(Model model, View view)Sets the model to display in this window and the view used to display it.voidsetPerFrameStatisticsKeys(java.util.Set<java.lang.String> keys)Activates the per-frame performance statistic specified.voidsetSceneController(SceneController sc)Specifies a new scene controller for the window.voidsetView(View view)Sets the view to use when displaying this window's model.voidshutdown()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:
shutdownin interfaceWorldWindow
-
getGpuResourceCache
public GpuResourceCache getGpuResourceCache()
Description copied from interface:WorldWindowReturns 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:
getGpuResourceCachein 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:WorldWindowSets the model to display in this window. Ifnullis specified for the model, the current model, if any, is disassociated with the window.- Specified by:
setModelin interfaceWorldWindow- Parameters:
model- the model to display. May benull.
-
getModel
public Model getModel()
Description copied from interface:WorldWindowReturns the window's current model.- Specified by:
getModelin interfaceWorldWindow- Returns:
- the window's current model.
-
setView
public void setView(View view)
Description copied from interface:WorldWindowSets the view to use when displaying this window's model. Ifnullis specified for the view, the current view, if any, is disassociated with the window.- Specified by:
setViewin interfaceWorldWindow- Parameters:
view- the view to use to display this window's model. May be null.
-
getView
public View getView()
Description copied from interface:WorldWindowReturns this window's current view.- Specified by:
getViewin interfaceWorldWindow- Returns:
- the window's current view.
-
setModelAndView
public void setModelAndView(Model model, View view)
Description copied from interface:WorldWindowSets the model to display in this window and the view used to display it. Ifnullis specified for the model, the current model, if any, is disassociated with the window. Ifnullis specified for the view, the current view, if any, is disassociated with the window.- Specified by:
setModelAndViewin 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:WorldWindowReturns the scene controller associated with this instance.- Specified by:
getSceneControllerin interfaceWorldWindow- Returns:
- The scene controller associated with the instance, or
nullif no scene controller is associated.
-
setSceneController
public void setSceneController(SceneController sc)
Description copied from interface:WorldWindowSpecifies a new scene controller for the window. The caller is responsible for populating the new scene controller with aView,Modeland any desired per-frame statistics keys.- Specified by:
setSceneControllerin 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:WorldWindowReturns the input handler associated with this instance.- Specified by:
getInputHandlerin interfaceWorldWindow- Returns:
- The input handler associated with this instance, or
nullif no input handler is associated.
-
setInputHandler
public void setInputHandler(InputHandler inputHandler)
Description copied from interface:WorldWindowSets the input handler to use for this instance.- Specified by:
setInputHandlerin interfaceWorldWindow- Parameters:
inputHandler- The input handler to use for this WorldWindow. May bynullifnullis specified, the current input handler, if any, is disassociated with the WorldWindow.
-
redraw
public void redraw()
Description copied from interface:WorldWindowCauses 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:
redrawin interfaceWorldWindow
-
redrawNow
public void redrawNow()
Description copied from interface:WorldWindowImmediately 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:
redrawNowin interfaceWorldWindow
-
setPerFrameStatisticsKeys
public void setPerFrameStatisticsKeys(java.util.Set<java.lang.String> keys)
Description copied from interface:WorldWindowActivates 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:
setPerFrameStatisticsKeysin interfaceWorldWindow- Parameters:
keys- The statistics to activate.
-
getPerFrameStatistics
public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
Description copied from interface:WorldWindowReturns the active per-frame performance statistics such as number of tiles drawn in the most recent frame.- Specified by:
getPerFrameStatisticsin interfaceWorldWindow- Returns:
- The keys and values of the active per-frame statistics.
-
getObjectsAtCurrentPosition
public PickedObjectList getObjectsAtCurrentPosition()
Description copied from interface:WorldWindowReturns 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:
getObjectsAtCurrentPositionin interfaceWorldWindow- Returns:
- The list of objects at the cursor position, or
nullif no objects are under the cursor.
-
getObjectsInSelectionBox
public PickedObjectList getObjectsInSelectionBox()
Description copied from interface:WorldWindowReturns 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:
getObjectsInSelectionBoxin interfaceWorldWindow- Returns:
- The list of objects intersecting the selection box, or
nullif no objects are in the box.
-
getCurrentPosition
public Position getCurrentPosition()
Description copied from interface:WorldWindowReturns the current latitude, longitude and altitude of the current cursor position, ornullif the cursor is not on the globe.- Specified by:
getCurrentPositionin interfaceWorldWindow- Returns:
- The current position of the cursor, or
nullif 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:WorldWindowAdds 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:
addRenderingListenerin 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:WorldWindowRemoves a specified rendering listener associated with this WorldWindow.- Specified by:
removeRenderingListenerin interfaceWorldWindow- Parameters:
listener- The rendering listener to remove.
-
callRenderingListeners
protected void callRenderingListeners(RenderingEvent event)
-
addPositionListener
public void addPositionListener(PositionListener listener)
Description copied from interface:WorldWindowAdds 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:
addPositionListenerin interfaceWorldWindow- Parameters:
listener- The position listener to add.
-
removePositionListener
public void removePositionListener(PositionListener listener)
Description copied from interface:WorldWindowRemoves the specified position listener associated with this WorldWindow.- Specified by:
removePositionListenerin interfaceWorldWindow- Parameters:
listener- The listener to remove.
-
callPositionListeners
protected void callPositionListeners(PositionEvent event)
-
addSelectListener
public void addSelectListener(SelectListener listener)
Description copied from interface:WorldWindowAdds 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:
addSelectListenerin interfaceWorldWindow- Parameters:
listener- The select listener to add.
-
removeSelectListener
public void removeSelectListener(SelectListener listener)
Description copied from interface:WorldWindowRemoves the specified select listener associated with this WorldWindow.- Specified by:
removeSelectListenerin interfaceWorldWindow- Parameters:
listener- The select listener to remove.
-
callSelectListeners
protected void callSelectListeners(SelectEvent event)
-
addRenderingExceptionListener
public void addRenderingExceptionListener(RenderingExceptionListener listener)
Description copied from interface:WorldWindowAdds 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:
addRenderingExceptionListenerin interfaceWorldWindow- Parameters:
listener- the The exception listener to add.
-
removeRenderingExceptionListener
public void removeRenderingExceptionListener(RenderingExceptionListener listener)
Description copied from interface:WorldWindowRemoves the specified rendering exception listener associated with this WorldWindow.- Specified by:
removeRenderingExceptionListenerin 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 specifiedScalableSurfaceto ensure backward compatibility with WorldWind applications developed prior to JOGL pixel scaling's introduction.This method is used byGLCanvasandGLJPanelto 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.
-
-