@Override public void onNavigatorEvent(WorldWindow wwd, NavigatorEvent event) { long currentTime = System.currentTimeMillis(); long elapsedTime = currentTime - lastEventTime; int eventAction = event.getAction(); boolean receivedUserInput = (eventAction == WorldWind.NAVIGATOR_MOVED && event.getLastInputEvent() != null); // Update the status overlay views whenever the navigator stops moving, // and also it is moving but at an (arbitrary) maximum refresh rate of 20 Hz. if (eventAction == WorldWind.NAVIGATOR_STOPPED || elapsedTime > 50) { // Get the current navigator state to apply to the overlays event.getNavigator().getAsLookAt(wwd.getGlobe(), lookAt); event.getNavigator().getAsCamera(wwd.getGlobe(), camera); // Update the overlays updateOverlayContents(lookAt, camera); updateOverlayColor(eventAction); lastEventTime = currentTime; } // Show the crosshairs while the user is gesturing and fade them out after the user stops if (receivedUserInput) { showCrosshairs(); } else { fadeCrosshairs(); } } };
@Override public void onNavigatorEvent(WorldWindow wwd, NavigatorEvent event) { long currentTime = System.currentTimeMillis(); long elapsedTime = currentTime - lastEventTime; int eventAction = event.getAction(); boolean receivedUserInput = (eventAction == WorldWind.NAVIGATOR_MOVED && event.getLastInputEvent() != null); // Update the status overlay views whenever the navigator stops moving, // and also it is moving but at an (arbitrary) maximum refresh rate of 20 Hz. if (eventAction == WorldWind.NAVIGATOR_STOPPED || elapsedTime > 50) { // Get the current navigator state to apply to the overlays event.getNavigator().getAsLookAt(wwd.getGlobe(), lookAt); event.getNavigator().getAsCamera(wwd.getGlobe(), camera); // Update the overlays updateOverlayContents(lookAt, camera); updateOverlayColor(eventAction); lastEventTime = currentTime; } // Show the crosshairs while the user is gesturing and fade them out after the user stops if (receivedUserInput) { showCrosshairs(); } else { fadeCrosshairs(); } } };