public class WorldWindowGLAutoDrawable extends WorldWindowImpl implements WorldWindowGLDrawable, GLEventListener
WorldWindow
class. This class can be aggregated into platform-specific classes to
provide the core functionality of WorldWind.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_VIEW_STOP_TIME
Default time in milliseconds that the view must remain unchanged before the
View.VIEW_STOPPED message is
sent. |
protected boolean |
enableGpuCacheReinitialization |
protected long |
lastViewID
The most recent View modelView ID.
|
protected java.util.concurrent.ScheduledFuture |
viewRefreshTask
Schedule task to send the
View.VIEW_STOPPED message after the view stop time elapses. |
protected long |
viewStopTime
Time in milliseconds that the view must remain unchanged before the
View.VIEW_STOPPED message is sent. |
gpuResourceCache
Constructor and Description |
---|
WorldWindowGLAutoDrawable()
Construct a new
WorldWindowGLCanvas for a specified GLDrawable . |
Modifier and Type | Method and Description |
---|---|
protected void |
checkForViewChange()
Determine if the view has changed since the previous frame.
|
void |
display(GLAutoDrawable glAutoDrawable)
|
void |
dispose(GLAutoDrawable glAutoDrawable)
|
protected int |
doDisplay()
Performs the actual repaint.
|
protected void |
doShutdown() |
protected void |
doSwapBuffers(GLAutoDrawable drawable)
Performs the actual buffer swap.
|
void |
endInitialization() |
GLContext |
getContext()
Returns the
GLContext associated with this WorldWindow . |
protected java.lang.String[] |
getRequiredOglExtensions() |
protected java.lang.String[] |
getRequiredOglFunctions() |
long |
getViewStopTime()
Indicates the amount of time, in milliseconds, that the View must remain unchanged before a
View.VIEW_STOPPED event is triggered. |
void |
init(GLAutoDrawable glAutoDrawable)
|
void |
initDrawable(GLAutoDrawable glAutoDrawable) |
void |
initGpuResourceCache(GpuResourceCache cache) |
protected void |
initializeCreditsController() |
boolean |
isEnableGpuCacheReinitialization()
Indicates whether the GPU resource cache is reinitialized when this window is reinitialized.
|
protected boolean |
isGLContextCompatible(GLContext context) |
void |
onMessage(Message msg)
Empty implementation of MessageListener.
|
void |
propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
The property change listener for this instance.
|
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.
|
protected void |
reinitialize(GLAutoDrawable glAutoDrawable) |
void |
reshape(GLAutoDrawable glAutoDrawable,
int x,
int y,
int w,
int h)
|
protected void |
scheduleViewStopTask(long delay)
Schedule a task that will send a
View.VIEW_STOPPED message to the Model when the task executes. |
void |
setEnableGpuCacheReinitialization(boolean enableGpuCacheReinitialization)
Specifies whether to reinitialize the GPU resource cache when this window is reinitialized.
|
void |
setViewStopTime(long time)
Specifies the amount of time, in milliseconds, that the View must remain unchanged before a
View.VIEW_STOPPED event is triggered. |
void |
shutdown()
Causes resources used by the WorldWindow to be freed.
|
addPositionListener, addRenderingExceptionListener, addRenderingListener, addSelectListener, callPositionListeners, callRenderingExceptionListeners, callRenderingListeners, callSelectListeners, createGpuResourceCache, getCurrentBoxSelection, getCurrentPosition, getCurrentSelection, getGpuResourceCache, getInputHandler, getModel, getObjectsAtCurrentPosition, getObjectsInSelectionBox, getPerFrameStatistics, getSceneController, getView, removePositionListener, removeRenderingExceptionListener, removeRenderingListener, removeSelectListener, setGpuResourceCache, setInputHandler, setModel, setModelAndView, setPerFrameStatisticsKeys, setSceneController, setView
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPositionListener, addRenderingExceptionListener, addRenderingListener, addSelectListener, getCurrentPosition, getGpuResourceCache, getInputHandler, getModel, getObjectsAtCurrentPosition, getObjectsInSelectionBox, getPerFrameStatistics, getSceneController, getView, removePositionListener, removeRenderingExceptionListener, removeRenderingListener, removeSelectListener, setInputHandler, setModel, setModelAndView, setPerFrameStatisticsKeys, setSceneController, setView
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
public static final long DEFAULT_VIEW_STOP_TIME
View.VIEW_STOPPED
message is
sent.protected boolean enableGpuCacheReinitialization
protected long lastViewID
View.getViewStateID()
protected java.util.concurrent.ScheduledFuture viewRefreshTask
View.VIEW_STOPPED
message after the view stop time elapses.protected long viewStopTime
View.VIEW_STOPPED
message is sent.public WorldWindowGLAutoDrawable()
WorldWindowGLCanvas
for a specified GLDrawable
.protected void checkForViewChange()
View.VIEW_STOPPED
to the Model if the view does not change for viewStopTime
milliseconds.getViewStopTime()
public void display(GLAutoDrawable glAutoDrawable)
display
in interface GLEventListener
glAutoDrawable
- the drawablejava.lang.IllegalStateException
- if no SceneController
exists for this canvaspublic void dispose(GLAutoDrawable glAutoDrawable)
GLEventListener.init(GLAutoDrawable)
.
GLEventListener's dispose method indicates that the GL context has been released, and provides the listener an
opportunity to clean up any resources. Dispose does not imply that the component's lifecycle has ended or that
the application is closing. There are three cases in which dispose may be called:
WorldWindow.shutdown()
or WorldWind.shutDown()
, respectively. In the case when a WorldWindow is removed from its parent
frame or that frame is closed without a call to shutdown, it is assumed that the application intends to reuse the
WorldWindow. Resources associated with the previous GL context are released in the subsequent call to init.dispose
in interface GLEventListener
glAutoDrawable
- the drawableprotected int doDisplay()
protected void doShutdown()
protected void doSwapBuffers(GLAutoDrawable drawable)
drawable
- the window's associated drawable.public void endInitialization()
endInitialization
in interface WorldWindowGLDrawable
public GLContext getContext()
WorldWindow
GLContext
associated with this WorldWindow
.getContext
in interface WorldWindow
GLContext
associated with this window. May be null.protected java.lang.String[] getRequiredOglExtensions()
protected java.lang.String[] getRequiredOglFunctions()
public long getViewStopTime()
View.VIEW_STOPPED
event is triggered.public void init(GLAutoDrawable glAutoDrawable)
init
in interface GLEventListener
glAutoDrawable
- the drawablepublic void initDrawable(GLAutoDrawable glAutoDrawable)
initDrawable
in interface WorldWindowGLDrawable
public void initGpuResourceCache(GpuResourceCache cache)
initGpuResourceCache
in interface WorldWindowGLDrawable
protected void initializeCreditsController()
public boolean isEnableGpuCacheReinitialization()
WorldWindow
isEnableGpuCacheReinitialization
in interface WorldWindow
true
if reinitialization is enabled, otherwise false
.protected boolean isGLContextCompatible(GLContext context)
public void onMessage(Message msg)
onMessage
in interface MessageListener
onMessage
in class WWObjectImpl
msg
- Message event.public void propertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
WWObjectImpl
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class WWObjectImpl
propertyChangeEvent
- the eventpublic void redraw()
WorldWindow
redraw
in interface WorldWindow
redraw
in class WorldWindowImpl
public void redrawNow()
WorldWindow
redrawNow
in interface WorldWindow
redrawNow
in class WorldWindowImpl
protected void reinitialize(GLAutoDrawable glAutoDrawable)
public void reshape(GLAutoDrawable glAutoDrawable, int x, int y, int w, int h)
reshape
in interface GLEventListener
glAutoDrawable
- the drawableprotected void scheduleViewStopTask(long delay)
View.VIEW_STOPPED
message to the Model when the task executes. If the
task runs (is not cancelled), then the view is considered stopped. Only one view stop task is scheduled at a
time. If this method is called again before the task executes, the task will be cancelled and a new task
scheduled.delay
- Delay in milliseconds until the task runs.public void setEnableGpuCacheReinitialization(boolean enableGpuCacheReinitialization)
WorldWindow
true
indicates that the GPU resource cache this window is using should be cleared when its init()
method is called, typically when re-parented. Set this to false
when this window is sharing context
with other windows and is likely to be re-parented. It prevents the flashing caused by clearing and
re-populating the GPU resource cache during re-parenting. The default value is true
.setEnableGpuCacheReinitialization
in interface WorldWindow
enableGpuCacheReinitialization
- true
to enable reinitialization, otherwise false
.public void setViewStopTime(long time)
View.VIEW_STOPPED
event is triggered.time
- Time in milliseconds that the View must must remain unchanged before the view stopped event is
triggered.public void shutdown()
WorldWindowImpl
shutdown
in interface WorldWindow
shutdown
in class WorldWindowImpl