/**
   * 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) {
      for (Layer layer : 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();
  }
Ejemplo n.º 2
0
    protected Vec4 getSurfacePoint(LatLon latlon, double elevation) {
      Vec4 point = null;

      SceneController sc = this.getApp().getWwd().getSceneController();
      Globe globe = this.getApp().getWwd().getModel().getGlobe();

      if (sc.getTerrain() != null) {
        point =
            sc.getTerrain()
                .getSurfacePoint(
                    latlon.getLatitude(),
                    latlon.getLongitude(),
                    elevation * sc.getVerticalExaggeration());
      }

      if (point == null) {
        double e = globe.getElevation(latlon.getLatitude(), latlon.getLongitude());
        point =
            globe.computePointFromPosition(
                latlon.getLatitude(),
                latlon.getLongitude(),
                (e + elevation) * sc.getVerticalExaggeration());
      }

      return point;
    }
Ejemplo n.º 3
0
 protected Vec4 getPoint(LatLon latlon, double elevation) {
   SceneController sc = this.getApp().getWwd().getSceneController();
   Globe globe = this.getApp().getWwd().getModel().getGlobe();
   double e = globe.getElevation(latlon.getLatitude(), latlon.getLongitude());
   return globe.computePointFromPosition(
       latlon.getLatitude(),
       latlon.getLongitude(),
       (e + elevation) * sc.getVerticalExaggeration());
 }
  public void setSceneController(SceneController sc) {
    if (sc != null && this.getSceneController() != null) {
      sc.setGpuResourceCache(this.sceneController.getGpuResourceCache());
    }

    this.sceneController = sc;
  }