public WorldWindowImpl() { this.sceneController = (SceneController)WorldWind.createConfigurationComponent( AVKey.SCENE_CONTROLLER_CLASS_NAME); // Set up to initiate a repaint whenever a file is retrieved and added to the local file store. WorldWind.getDataFileStore().addPropertyChangeListener(this); }
/** * Causes resources used by the World Window to be freed. The World Window cannot be used once this method is * called. An OpenGL context for the window must be current. */ public void shutdown() { WorldWind.getDataFileStore().removePropertyChangeListener(this); if (this.inputHandler != null) { this.inputHandler.dispose(); this.inputHandler = new NoOpInputHandler(); } // Clear the texture cache if (this.getGpuResourceCache() != null) { this.getGpuResourceCache().clear(); } // Dispose all the layers // TODO: Need per-window dispose for layers if (this.getModel() != null && this.getModel().getLayers() != null) { foreach (Layer layer in this.getModel().getLayers()) { try { layer.dispose(); } catch (Exception e) { Logging.logger().log(java.util.logging.Level.SEVERE, Logging.getMessage( "WorldWindowGLCanvas.ExceptionWhileShuttingDownWorldWindow"), e); } } } SceneController sc = this.getSceneController(); if (sc != null) { sc.dispose(); } }