}
// Determine if the view has changed since the last frame.
this.checkForViewChange();
Position positionAtStart = this.getCurrentPosition();
PickedObject selectionAtStart = this.getCurrentSelection();
PickedObjectList boxSelectionAtStart = this.getCurrentBoxSelection();
try
{
this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.BEFORE_RENDERING));
}
catch (Exception e)
{
Logging.logger().log(Level.SEVERE,
Logging.getMessage("WorldWindowGLAutoDrawable.ExceptionDuringGLEventListenerDisplay"), e);
}
int redrawDelay = this.doDisplay();
if (redrawDelay > 0)
{
if (this.redrawTimer == null)
{
this.redrawTimer = new Timer(redrawDelay, new ActionListener()
{
public void actionPerformed(ActionEvent actionEvent)
{
redraw();
redrawTimer = null;
}
});
redrawTimer.setRepeats(false);
redrawTimer.start();
}
}
try
{
this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.BEFORE_BUFFER_SWAP));
}
catch (Exception e)
{
Logging.logger().log(Level.SEVERE,
Logging.getMessage("WorldWindowGLAutoDrawable.ExceptionDuringGLEventListenerDisplay"), e);
}
this.doSwapBuffers(this.drawable);
Double frameTime = sc.getFrameTime();
if (frameTime != null)
this.setValue(PerformanceStatistic.FRAME_TIME, frameTime);
Double frameRate = sc.getFramesPerSecond();
if (frameRate != null)
this.setValue(PerformanceStatistic.FRAME_RATE, frameRate);
// Dispatch the rendering exceptions accumulated by the SceneController during this frame to our
// RenderingExceptionListeners.
Iterable<Throwable> renderingExceptions = sc.getRenderingExceptions();
if (renderingExceptions != null)
{
for (Throwable t : renderingExceptions)
{
if (t != null)
this.callRenderingExceptionListeners(t);
}
}
this.callRenderingListeners(new RenderingEvent(this.drawable, RenderingEvent.AFTER_BUFFER_SWAP));
// Position and selection notification occurs only on triggering conditions, not same-state conditions:
// start == null, end == null: nothing selected -- don't notify
// start == null, end != null: something now selected -- notify
// start != null, end == null: something was selected but no longer is -- notify
// start != null, end != null, start != end: something new was selected -- notify
// start != null, end != null, start == end: same thing is selected -- don't notify
Position positionAtEnd = this.getCurrentPosition();
if (positionAtStart != null || positionAtEnd != null)
{
// call the listener if both are not null or positions are the same
if (positionAtStart != null && positionAtEnd != null)
{