|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
javax.media.opengl.awt.GLJPanel
gov.nasa.worldwind.awt.WorldWindowGLJPanel
public class WorldWindowGLJPanel
WorldWindowGLCanvas is a lightweight Swing component for displaying World Wind Models (globe and
layers). It's a self-contained component intended to serve as an application's WorldWindow. Construction
options exist to specify a specific graphics device and to share graphics resources with another graphics device.
GLJPanel that this class uses has
historically been problematic. It works well on some devices but not on others, and its performance varies much more
among devices than that of its heavyweight counterpart, WorldWindowGLCanvas. It's therefore best to use the
heavyweight component if possible. You can find detailed information on this issue in the Heavyweight and
Lightweight Issues section of the "JOGL User's
Guide"
This class is capable of supporting stereo devices. To cause a stereo device to be selected and used, specify the
Java VM property "gov.nasa.worldwind.stereo.mode=device" prior to creating an instance of this class. A stereo
capable SceneController such as StereoSceneController must also be specified in
the World Wind Configuration. The default configuration specifies a stereo-capable controller. To prevent
stereo from being used by subsequently opened WorldWindowGLCanvases, set the property to a an empty string,
"". If a stereo device cannot be selected and used, this falls back to a non-stereo device that supports World Wind's
minimum requirements.
Under certain conditions, JOGL replaces the GLContext associated with instances of this class. This then
necessitates that all resources such as textures that have been stored on the graphic devices must be regenerated for
the new context. World Wind does this automatically by clearing the associated GpuResourceCache. Objects
subsequently rendered automatically re-create those resources. If an application creates its own graphics resources,
including textures, vertex buffer objects and display lists, it must store them in the GpuResourceCache
associated with the current DrawContext so that they are automatically cleared, and
be prepared to re-create them if they do not exist in the DrawContext's current
GpuResourceCache when needed. Examples of doing this can be found by searching for usages of the method
GpuResourceCache.get(Object) and GpuResourceCache.getTexture(Object).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Nested classes/interfaces inherited from interface javax.media.nativewindow.WindowClosingProtocol |
|---|
WindowClosingProtocol.WindowClosingMode |
| Nested classes/interfaces inherited from interface com.jogamp.nativewindow.awt.AWTPrintLifecycle |
|---|
AWTPrintLifecycle.Context |
| Field Summary | |
|---|---|
protected WorldWindowGLDrawable |
wwd
The drawable to which WorldWindow methods are delegated. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface com.jogamp.nativewindow.awt.AWTPrintLifecycle |
|---|
DEFAULT_PRINT_TILE_SIZE |
| Fields inherited from interface javax.media.opengl.GLAutoDrawable |
|---|
SCREEN_CHANGE_ACTION_ENABLED |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
WorldWindowGLJPanel()
Constructs a new WorldWindowGLCanvas window on the default graphics device. |
|
WorldWindowGLJPanel(WorldWindow shareWith)
Constructs a new WorldWindowGLJPanel on the default graphics device and shares graphics resources
with another WorldWindow. |
|
WorldWindowGLJPanel(WorldWindow shareWith,
GLCapabilities capabilities,
GLCapabilitiesChooser chooser)
Constructs a new WorldWindowGLJPanel that shares graphics resources with another
WorldWindow and whose capabilities are chosen via a specified GLCapabilities object and a
GLCapabilitiesChooser. |
|
| Method Summary | |
|---|---|
void |
addPositionListener(PositionListener listener)
Adds a position listener to this world window. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified all-property property change listener that will be called for all list changes. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a property change listener for the specified key. |
void |
addRenderingExceptionListener(RenderingExceptionListener listener)
Adds an exception listener to this world window. |
void |
addRenderingListener(RenderingListener listener)
Adds a rendering listener to this world window. |
void |
addSelectListener(SelectListener listener)
Adds a select listener to this world window. |
AVList |
clearList()
|
AVList |
copy()
Returns a shallow copy of this AVList instance: the keys and values themselves are not cloned. |
protected void |
createDefaultInputHandler()
Constructs and attaches the InputHandler for this WorldWindow. |
protected void |
createView()
Constructs and attaches the View for this WorldWindow. |
void |
firePropertyChange(PropertyChangeEvent propertyChangeEvent)
Calls all registered property change listeners with the specified property change event. |
void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Calls all property change listeners associated with the specified key. |
Position |
getCurrentPosition()
Returns the current latitude, longitude and altitude of the current cursor position, or null if the
cursor is not on the globe. |
Set<Map.Entry<String,Object>> |
getEntries()
|
GpuResourceCache |
getGpuResourceCache()
Returns the GPU Resource used by this World Window. |
InputHandler |
getInputHandler()
Returns the input handler associated with this instance. |
Model |
getModel()
Returns the window's current model. |
PickedObjectList |
getObjectsAtCurrentPosition()
Returns the World Wind objects at the current cursor position. |
PickedObjectList |
getObjectsInSelectionBox()
Returns the World Wind objects intersecting the current selection box. |
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. |
String |
getStringValue(String key)
Returns the value for a specified key. |
Object |
getValue(String key)
Returns the value for a specified key. |
Collection<Object> |
getValues()
|
View |
getView()
Returns this window's current view. |
boolean |
hasKey(String key)
Indicates whether a key is in the collection. |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
redraw()
Causes a repaint event to be enqueued with the window system for this world window. |
void |
redrawNow()
Immediately repaints the world window without waiting for a window system repaint event. |
Object |
removeKey(String key)
Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection. |
void |
removePositionListener(PositionListener listener)
Removes the specified position listener associated with this world window. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified all-property property change listener. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a property change listener associated with the specified key. |
void |
removeRenderingExceptionListener(RenderingExceptionListener listener)
Removes the specified rendering exception listener associated with this world window. |
void |
removeRenderingListener(RenderingListener listener)
Removes a specified rendering listener associated with this world window. |
void |
removeSelectListener(SelectListener listener)
Removes the specified select listener associated with this world window. |
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(Set<String> keys)
Activates the per-frame performance statistic specified. |
void |
setSceneController(SceneController sceneController)
Specifies a new scene controller for the window. |
Object |
setValue(String key,
Object value)
Adds a key/value pair to the list. |
AVList |
setValues(AVList avList)
Adds the contents of another attribute-value list to the list. |
void |
setView(View view)
Sets the view to use when displaying this window's model. |
void |
shutdown()
Causes resources used by the World Window to be freed. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface gov.nasa.worldwind.WorldWindow |
|---|
getContext |
| Methods inherited from interface javax.media.opengl.awt.AWTGLAutoDrawable |
|---|
repaint, setSize |
| Methods inherited from interface javax.media.opengl.GLDrawable |
|---|
getHeight, getWidth |
| Field Detail |
|---|
protected final WorldWindowGLDrawable wwd
WorldWindow methods are delegated.
| Constructor Detail |
|---|
public WorldWindowGLJPanel()
WorldWindowGLCanvas window on the default graphics device.
public WorldWindowGLJPanel(WorldWindow shareWith)
WorldWindowGLJPanel on the default graphics device and shares graphics resources
with another WorldWindow.
shareWith - a WorldWindow with which to share graphics resources.GLJPanel.GLJPanel(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser,
javax.media.opengl.GLContext)
public WorldWindowGLJPanel(WorldWindow shareWith,
GLCapabilities capabilities,
GLCapabilitiesChooser chooser)
WorldWindowGLJPanel that shares graphics resources with another
WorldWindow and whose capabilities are chosen via a specified GLCapabilities object and a
GLCapabilitiesChooser.
shareWith - a WorldWindow with which to share graphics resources.capabilities - a capabilities object indicating the OpenGL rendering context's capabilities. May be null, in
which case a default set of capabilities is used.chooser - a chooser object that customizes the specified capabilities. May be null, in which case a
default chooser is used.GLJPanel.GLJPanel(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser,
javax.media.opengl.GLContext)| Method Detail |
|---|
public void addPositionListener(PositionListener listener)
WorldWindow
addPositionListener in interface WorldWindowlistener - The position listener to add.public void addPropertyChangeListener(PropertyChangeListener listener)
AVList
addPropertyChangeListener in interface AVListaddPropertyChangeListener in interface ComponentEventsaddPropertyChangeListener in class Containerlistener - the listener to call.PropertyChangeSupport
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
AVList
addPropertyChangeListener in interface AVListaddPropertyChangeListener in interface ComponentEventsaddPropertyChangeListener in class ContainerpropertyName - the key to associate the listener with.listener - the listener to associate with the key.PropertyChangeSupportpublic void addRenderingExceptionListener(RenderingExceptionListener listener)
WorldWindow
addRenderingExceptionListener in interface WorldWindowlistener - the The exception listener to add.public void addRenderingListener(RenderingListener listener)
WorldWindow
addRenderingListener in interface WorldWindowlistener - The rendering listener to add to those notified of rendering events by this world window.public void addSelectListener(SelectListener listener)
WorldWindow
addSelectListener in interface WorldWindowlistener - The select listener to add.public AVList clearList()
clearList in interface AVListpublic AVList copy()
AVListAVList instance: the keys and values themselves are not cloned.
copy in interface AVListAVList.protected void createDefaultInputHandler()
InputHandler for this WorldWindow.
protected void createView()
View for this WorldWindow.
public void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
AVList
firePropertyChange in interface AVListpropertyChangeEvent - the eventPropertyChangeSupport
public void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
AVListodValue and newValue are equal and non-null.
firePropertyChange in interface AVListfirePropertyChange in class ComponentpropertyName - the keyoldValue - the value associated with the key before the even causing the firing.newValue - the new value associated with the key.PropertyChangeSupportpublic Position getCurrentPosition()
WorldWindownull if the
cursor is not on the globe.
getCurrentPosition in interface WorldWindownull if the cursor is not positioned on the globe.public Set<Map.Entry<String,Object>> getEntries()
getEntries in interface AVListpublic GpuResourceCache getGpuResourceCache()
WorldWindow
getGpuResourceCache in interface WorldWindowpublic InputHandler getInputHandler()
WorldWindow
getInputHandler in interface WorldWindownull if no input handler is associated.public Model getModel()
WorldWindow
getModel in interface WorldWindowpublic PickedObjectList getObjectsAtCurrentPosition()
WorldWindow
getObjectsAtCurrentPosition in interface WorldWindownull if no objects are under the cursor.public PickedObjectList getObjectsInSelectionBox()
WorldWindow
getObjectsInSelectionBox in interface WorldWindownull if no objects are in the box.public Collection<PerformanceStatistic> getPerFrameStatistics()
WorldWindow
getPerFrameStatistics in interface WorldWindowpublic SceneController getSceneController()
WorldWindow
getSceneController in interface WorldWindownull if no scene controller is
associated.public String getStringValue(String key)
AVListString.
getStringValue in interface AVListkey - the attribute name. May not be null.
null.public Object getValue(String key)
AVList
getValue in interface AVListkey - the attribute name. May not be null.
null.public Collection<Object> getValues()
getValues in interface AVListpublic View getView()
WorldWindow
getView in interface WorldWindowpublic boolean hasKey(String key)
AVList
hasKey in interface AVListkey - the attribute name. May not be null.
true if the key exists in the collection, otherwise false.public void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic void redraw()
WorldWindow
redraw in interface WorldWindowpublic void redrawNow()
WorldWindow
redrawNow in interface WorldWindowpublic Object removeKey(String key)
AVList
removeKey in interface AVListkey - the attribute name. May not be null.
public void removePositionListener(PositionListener listener)
WorldWindow
removePositionListener in interface WorldWindowlistener - The listener to remove.public void removePropertyChangeListener(PropertyChangeListener listener)
AVList
removePropertyChangeListener in interface AVListremovePropertyChangeListener in interface ComponentEventsremovePropertyChangeListener in class Componentlistener - the listener to remove.PropertyChangeSupport
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
AVList
removePropertyChangeListener in interface AVListremovePropertyChangeListener in interface ComponentEventsremovePropertyChangeListener in class ComponentpropertyName - the key associated with the change listener.listener - the listener to remove.PropertyChangeSupportpublic void removeRenderingExceptionListener(RenderingExceptionListener listener)
WorldWindow
removeRenderingExceptionListener in interface WorldWindowlistener - The listener to remove.public void removeRenderingListener(RenderingListener listener)
WorldWindow
removeRenderingListener in interface WorldWindowlistener - The rendering listener to remove.public void removeSelectListener(SelectListener listener)
WorldWindow
removeSelectListener in interface WorldWindowlistener - The select listener to remove.public void setInputHandler(InputHandler inputHandler)
WorldWindow
setInputHandler in interface WorldWindowinputHandler - The input handler to use for this world window. May by null if null
is specified, the current input handler, if any, is disassociated with the world window.public void setModel(Model model)
WorldWindownull is specified for the model, the current model, if
any, is disassociated with the window.
setModel in interface WorldWindowmodel - the model to display. May be null.
public void setModelAndView(Model model,
View view)
WorldWindownull is specified for
the model, the current model, if any, is disassociated with the window. If null is specified for the
view, the current view, if any, is disassociated with the window.
setModelAndView in interface WorldWindowmodel - the model to display. May benull.view - the view to use to display this window's model. May benull.public void setPerFrameStatisticsKeys(Set<String> keys)
WorldWindow
setPerFrameStatisticsKeys in interface WorldWindowkeys - The statistics to activate.public void setSceneController(SceneController sceneController)
WorldWindowView, Model and any desired per-frame statistics keys.
setSceneController in interface WorldWindowsceneController - the new scene controller.SceneController.setView(View),
SceneController.setModel(Model),
SceneController.setPerFrameStatisticsKeys(java.util.Set)
public Object setValue(String key,
Object value)
AVList
setValue in interface AVListkey - the attribute name. May not be null.value - the attribute value. May be null, in which case any existing value for the key is
removed from the collection.
public AVList setValues(AVList avList)
AVList
setValues in interface AVListavList - the list to copy. May not be null.
this, a self reference.public void setView(View view)
WorldWindownull is specified for the view, the
current view, if any, is disassociated with the window.
setView in interface WorldWindowview - the view to use to display this window's model. May be null.public void shutdown()
WorldWindow
shutdown in interface WorldWindow
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||