@Override public void doFrame(long frameTimeNanos) { if (this.lastFrameTimeNanos != 0) { // Compute the frame duration in seconds. double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9; double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond); // Move the navigator to continuously bring new tiles into view. Navigator navigator = getWorldWindow().getNavigator(); navigator.setLongitude(navigator.getLongitude() + cameraDegrees); // Redraw the WorldWindow to display the above changes. this.getWorldWindow().requestRedraw(); } Choreographer.getInstance().postFrameCallback(this); this.lastFrameTimeNanos = frameTimeNanos; }
@Override public void creationSucceeded(LayerFactory factory, Layer layer) { // Add the finished GeoPackage layer to the WorldWindow. getWorldWindow().getLayers().addLayer(layer); // Place the viewer directly over the GeoPackage image. getWorldWindow().getNavigator().setLatitude(36.8139677556754); getWorldWindow().getNavigator().setLongitude(-76.03260320181615); getWorldWindow().getNavigator().setAltitude(20e3); Log.i("gov.nasa.worldwind", "GeoPackage layer creation succeeded"); }
@Override public void doFrame(long frameTimeNanos) { if (this.lastFrameTimeNanos != 0) { // Compute the frame duration in seconds. double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9; double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond); // Move the navigator to simulate the Earth's rotation about its axis. Navigator navigator = getWorldWindow().getNavigator(); navigator.setLongitude(navigator.getLongitude() - cameraDegrees); // Redraw the WorldWindow to display the above changes. this.getWorldWindow().requestRedraw(); } if (!this.activityPaused) { // stop animating when this Activity is paused Choreographer.getInstance().postFrameCallback(this); } this.lastFrameTimeNanos = frameTimeNanos; }
@Override public void doFrame(long frameTimeNanos) { if (this.lastFrameTimeNanos != 0) { // Compute the frame duration in seconds. double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9; double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond); // Move the navigator to simulate the Earth's rotation about its axis. Navigator navigator = getWorldWindow().getNavigator(); navigator.setLongitude(navigator.getLongitude() - cameraDegrees); // Redraw the WorldWindow to display the above changes. this.getWorldWindow().requestRedraw(); } if (!this.activityPaused) { // stop animating when this Activity is paused Choreographer.getInstance().postFrameCallback(this); } this.lastFrameTimeNanos = frameTimeNanos; }
@Override public void doFrame(long frameTimeNanos) { if (this.lastFrameTimeNanos != 0) { // Compute the frame duration in seconds. double frameDurationSeconds = (frameTimeNanos - this.lastFrameTimeNanos) * 1.0e-9; double cameraDegrees = (frameDurationSeconds * this.cameraDegreesPerSecond); double lightDegrees = (frameDurationSeconds * this.lightDegreesPerSecond); // Move the navigator to simulate the Earth's rotation about its axis. Navigator navigator = getWorldWindow().getNavigator(); navigator.setLongitude(navigator.getLongitude() - cameraDegrees); // Move the sun location to simulate the Sun's rotation about the Earth. this.sunLocation.set(this.sunLocation.latitude, this.sunLocation.longitude - lightDegrees); this.atmosphereLayer.setLightLocation(this.sunLocation); // Redraw the WorldWindow to display the above changes. this.getWorldWindow().requestRedraw(); } if (!this.activityPaused) { // stop animating when this Activity is paused Choreographer.getInstance().postFrameCallback(this); } this.lastFrameTimeNanos = frameTimeNanos; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setAboutBoxTitle("About the " + this.getResources().getText(R.string.title_day_night_cycle)); setAboutBoxText("Demonstrates how to display a continuous day-night cycle on the WorldWind globe.\n" + "This gradually changes both the Navigator's location and the AtmosphereLayer's light location."); // Initialize the Atmosphere layer's light location to our custom location. By default the light location is // always behind the viewer. LayerList layers = this.getWorldWindow().getLayers(); this.atmosphereLayer = (AtmosphereLayer) layers.getLayer(layers.indexOfLayerNamed("Atmosphere")); this.atmosphereLayer.setLightLocation(this.sunLocation); // Initialize the Navigator so that the sun is behind the viewer. Navigator navigator = this.getWorldWindow().getNavigator(); navigator.setLatitude(20); navigator.setLongitude(this.sunLocation.longitude); // Use this Activity's Choreographer to animate the day-night cycle. Choreographer.getInstance().postFrameCallback(this); }
/** * Prepares this WorldWindow for drawing and event handling. * * @param configChooser optional argument for choosing an EGL configuration; may be null */ protected void init(EGLConfigChooser configChooser) { // Initialize the WorldWindow's navigator. Location initLocation = Location.fromTimeZone(TimeZone.getDefault()); double initAltitude = this.distanceToViewGlobeExtents() * 1.1; // add 10% to the minimum distance to allow for space around the screen edges this.navigator.setLatitude(initLocation.latitude); this.navigator.setLongitude(initLocation.longitude); this.navigator.setAltitude(initAltitude); // Initialize the WorldWindow's controller. this.worldWindowController.setWorldWindow(this); // Initialize the WorldWindow's render resource cache. int cacheCapacity = RenderResourceCache.recommendedCapacity(this.getContext()); this.renderResourceCache = new RenderResourceCache(cacheCapacity); // Set up to render on demand to an OpenGL ES 2.x context // TODO Investigate and use the EGL chooser submitted by jgiovino this.setEGLConfigChooser(configChooser); this.setEGLContextClientVersion(2); // must be called before setRenderer this.setRenderer(this); this.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); // must be called after setRenderer // Log a message with some basic information about the WorldWindow's configuration. Logger.log(Logger.INFO, "WorldWindow initialized"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setAboutBoxTitle("About the " + this.getResources().getText(R.string.title_texture_stress_test)); this.setAboutBoxText("Continuously allocates OpenGL texture objects to test the effect of an excessive number of textures on the WorldWind render resource cache."); // Setup the WorldWindow to display the tessellation layer and a layer of surface images. We use a minimal // layer configuration in order to gather precise metrics on memory usage. this.getWorldWindow().getLayers().clearLayers(); this.getWorldWindow().getLayers().addLayer(new ShowTessellationLayer()); this.getWorldWindow().getLayers().addLayer(this.layer); // Position the viewer so that the surface images will be visible as they're added. this.firstSector.set(35.0, 10.0, 0.5, 0.5); this.sector.set(this.firstSector); this.getWorldWindow().getNavigator().setLatitude(37.5); this.getWorldWindow().getNavigator().setLongitude(15.0); this.getWorldWindow().getNavigator().setAltitude(1.0e6); // Allocate a 32-bit 1024 x 1024 bitmap that we'll use to create all of the OpenGL texture objects in this test. int[] colors = new int[1024 * 1024]; Arrays.fill(colors, 0xFF00FF00); this.bitmap = Bitmap.createBitmap(colors, 1024, 1024, Bitmap.Config.ARGB_8888); }
wwd.getNavigator().setLongitude(14.97980511744455); wwd.getNavigator().setAltitude(4.0e5);
wwd.getNavigator().setLongitude(-77.023611); wwd.getNavigator().setAltitude(10e3);