NASA World Wind

gov.nasa.worldwind.awt
Class WorldWindowGLJPanel

java.lang.Object
  extended by GLJPanel
      extended by gov.nasa.worldwind.awt.WorldWindowGLJPanel
All Implemented Interfaces:
AVList, WorldWindow

public class WorldWindowGLJPanel
extends GLJPanel
implements WorldWindow


Constructor Summary
WorldWindowGLJPanel()
          Constructs a new WorldWindowGLCanvas window on the default graphics device.
WorldWindowGLJPanel(WorldWindowGLCanvas shareWith)
          Constructs a new WorldWindowGLJPanel window on the default graphics device that will share graphics resources with another WorldWindowGLJPanel window.
WorldWindowGLJPanel(WorldWindowGLCanvas shareWith, GraphicsDevice device)
          Constructs a new WorldWindowGLJPanel window that will share graphics resources with another WorldWindowGLJPanel window.
 
Method Summary
 void addPositionListener(PositionListener listener)
          Adds a position 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.
 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()
           
 InputHandler getInputHandler()
          Returns the input handler associated with this instance.
 Model getModel()
          Returns the window's current model.
 PickedObjectList getObjectsAtCurrentPosition()
          Returns the World Wind ojbects at the current cursor position.
 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 assocciated with this instance.
 String getStringValue(String key)
          Returns the value for a specified key.
 TextureCache getTextureCache()
          Returns the texture cache used by this World Window.?
 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 redraw()
          Causes a repaint event to be enqued with the window system for this world window.
 void redrawNow()
          Immediately repaints the world window without waiting for a window system repaint event.
 void 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 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 setValue(String key, Object value)
          Adds a key/value pair to the list.
 void setValues(AVList avList)
           
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

WorldWindowGLJPanel

public WorldWindowGLJPanel()
Constructs a new WorldWindowGLCanvas window on the default graphics device.


WorldWindowGLJPanel

public WorldWindowGLJPanel(WorldWindowGLCanvas shareWith)
Constructs a new WorldWindowGLJPanel window on the default graphics device that will share graphics resources with another WorldWindowGLJPanel window. The other window, sharewith, may not be null

Parameters:
shareWith - a WorldWindowGLJPanel with which to share graphics resources.
Throws:
NullPointerException - if shareWith is null
See Also:
GLCanvas#GLCanvas(GLCapabilities,GLCapabilitiesChooser,GLContext,GraphicsDevice)

WorldWindowGLJPanel

public WorldWindowGLJPanel(WorldWindowGLCanvas shareWith,
                           GraphicsDevice device)
Constructs a new WorldWindowGLJPanel window that will share graphics resources with another WorldWindowGLJPanel window. The new window is created on the specified graphics device. Neither shareWith or device may be null.

Parameters:
shareWith - a WorldWindowGLCanvas with which to share graphics resources.
device - the GraphicsDevice on which to create the window.
Throws:
NullPointerException - if shareWith is null
IllegalArgumentException - if deevice is null
See Also:
GLCanvas#GLCanvas(GLCapabilities,GLCapabilitiesChooser,GLContext,GraphicsDevice)
Method Detail

addPositionListener

public void addPositionListener(PositionListener listener)
Description copied from interface: WorldWindow
Adds a position listener to this world window. 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 interface WorldWindow
Parameters:
listener - The position listener to add.

addRenderingListener

public void addRenderingListener(RenderingListener listener)
Description copied from interface: WorldWindow
Adds a rendering listener to this world window. Rendering listeners are called at key point during World Wind drawing and provide applications the ability to participate or monitor rendering.

Specified by:
addRenderingListener in interface WorldWindow
Parameters:
listener - The rendering listener to add to those notified of rendering events by this world window.

addSelectListener

public void addSelectListener(SelectListener listener)
Description copied from interface: WorldWindow
Adds a select listener to this world window. Select listeners are called when a selection is made by the user in the world window. A selection is any operation that idetifies a visible item.

Specified by:
addSelectListener in interface WorldWindow
Parameters:
listener - The select listener to add.

clearList

public AVList clearList()
Specified by:
clearList in interface AVList

copy

public AVList copy()
Description copied from interface: AVList
Returns a shallow copy of this AVList instance: the keys and values themselves are not cloned.

Specified by:
copy in interface AVList
Returns:
a shallow copy of this AVList.

firePropertyChange

public void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
Description copied from interface: AVList
Calls all registered property change listeners with the specified property change event.

Specified by:
firePropertyChange in interface AVList
Parameters:
propertyChangeEvent - the event
See Also:
PropertyChangeSupport

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
Description copied from interface: AVList
Calls all property change listeners associated with the specified key. No listeners are called if odValue and newValue are equal and non-null.

Specified by:
firePropertyChange in interface AVList
Parameters:
propertyName - the key
oldValue - the value associated with the key before the even causing the firing.
newValue - the new value associated with the key.
See Also:
PropertyChangeSupport

getCurrentPosition

public Position getCurrentPosition()
Description copied from interface: WorldWindow
Returns the current latitude, longitude and altitude of the current cursor position, or null if the cursor is not on the globe.

Specified by:
getCurrentPosition in interface WorldWindow
Returns:
The current position of the cursor, or null if the cursor is not positioned on the globe.

getEntries

public Set<Map.Entry<String,Object>> getEntries()
Specified by:
getEntries in interface AVList

getInputHandler

public InputHandler getInputHandler()
Description copied from interface: WorldWindow
Returns the input handler associated with this instance.

Specified by:
getInputHandler in interface WorldWindow
Returns:
The input handler associated with this instance, or null if no input handler is associated.

getModel

public Model getModel()
Description copied from interface: WorldWindow
Returns the window's current model.

Specified by:
getModel in interface WorldWindow
Returns:
the window's current model.

getObjectsAtCurrentPosition

public PickedObjectList getObjectsAtCurrentPosition()
Description copied from interface: WorldWindow
Returns the World Wind ojbects at the current cursor position. The list of objects under the cursor is determined each time the world window is repainted. This method returns the list of objects determined when the most recent repaint was performed.

Specified by:
getObjectsAtCurrentPosition in interface WorldWindow
Returns:
The list of objects at the cursor position, or null if no objects are under the cursor.

getPerFrameStatistics

public 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 interface WorldWindow
Returns:
The keys and values of the active per-frame statistics.

getSceneController

public SceneController getSceneController()
Description copied from interface: WorldWindow
Returns the scene controller assocciated with this instance.

Specified by:
getSceneController in interface WorldWindow
Returns:
The scene controller associated with the instance, or null if no scene controller is associated.

getStringValue

public String getStringValue(String key)
Description copied from interface: AVList
Returns the value for a specified key. The value must be a String.

Specified by:
getStringValue in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
the attribute value if one exists in the collection, otherwise null.

getTextureCache

public TextureCache getTextureCache()
Description copied from interface: WorldWindow
Returns the texture cache used by this World Window.?

Specified by:
getTextureCache in interface WorldWindow
Returns:
The texture cache used by the World Window.

getValue

public Object getValue(String key)
Description copied from interface: AVList
Returns the value for a specified key.

Specified by:
getValue in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
the attribute value if one exists in the collection, otherwise null.

getValues

public Collection<Object> getValues()
Specified by:
getValues in interface AVList

getView

public View getView()
Description copied from interface: WorldWindow
Returns this window's current view.

Specified by:
getView in interface WorldWindow
Returns:
the window's current view.

hasKey

public boolean hasKey(String key)
Description copied from interface: AVList
Indicates whether a key is in the collection.

Specified by:
hasKey in interface AVList
Parameters:
key - the attribute name. May not be null.
Returns:
true if the key exists in the collection, otherwise false.

redraw

public void redraw()
Description copied from interface: WorldWindow
Causes a repaint event to be enqued with the window system for this world window. 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 world window.

Specified by:
redraw in interface WorldWindow

redrawNow

public void redrawNow()
Description copied from interface: WorldWindow
Immediately repaints the world window 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 interface WorldWindow

removeKey

public void removeKey(String key)
Description copied from interface: AVList
Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.

Specified by:
removeKey in interface AVList
Parameters:
key - the attribute name. May not be null.

removePositionListener

public void removePositionListener(PositionListener listener)
Description copied from interface: WorldWindow
Removes the specified position listener associated with this world window.

Specified by:
removePositionListener in interface WorldWindow
Parameters:
listener - The listener to remove.

removeRenderingListener

public void removeRenderingListener(RenderingListener listener)
Description copied from interface: WorldWindow
Removes a specified rendering listener associated with this world window.

Specified by:
removeRenderingListener in interface WorldWindow
Parameters:
listener - The rendering listener to remove.

removeSelectListener

public void removeSelectListener(SelectListener listener)
Description copied from interface: WorldWindow
Removes the specified select listener associated with this world window.

Specified by:
removeSelectListener in interface WorldWindow
Parameters:
listener - The select listener to remove.

setInputHandler

public void setInputHandler(InputHandler inputHandler)
Description copied from interface: WorldWindow
Sets the input handler to use for this instance.

Specified by:
setInputHandler in interface WorldWindow
Parameters:
inputHandler - 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.

setModel

public void setModel(Model model)
Description copied from interface: WorldWindow
Sets the model to display in this window. If null is specified for the model, the current model, if any, is disassociated with the window.

Specified by:
setModel in interface WorldWindow
Parameters:
model - the model to display. May be null.

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. If null 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.

Specified by:
setModelAndView in interface WorldWindow
Parameters:
model - the model to display. May benull.
view - the view to use to display this window's model. May benull.

setPerFrameStatisticsKeys

public void setPerFrameStatisticsKeys(Set<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 interface WorldWindow
Parameters:
keys - The statistics to activate.

setValue

public void setValue(String key,
                     Object value)
Description copied from interface: AVList
Adds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.

Specified by:
setValue in interface AVList
Parameters:
key - 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.

setValues

public void setValues(AVList avList)
Specified by:
setValues in interface AVList

setView

public void setView(View view)
Description copied from interface: WorldWindow
Sets the view to use when displaying this window's model. If null is specified for the view, the current view, if any, is disassociated with the window.

Specified by:
setView in interface WorldWindow
Parameters:
view - the view to use to display this window's model. May be null.

shutdown

public void shutdown()
Description copied from interface: WorldWindow
Causes resources used by the World Window to be freed. The World Window cannot be used once this method is called.

Specified by:
shutdown in interface WorldWindow

NASA World Wind