/** * 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(); }
public void doActionOnButton3() { // Sector sector = Sector.fromDegrees( 44d, 46d, -123.3d, -123.2d ); ArrayList<LatLon> latlons = new ArrayList<LatLon>(); latlons.add(LatLon.fromDegrees(45.50d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.52d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.54d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.56d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.58d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.60d, -123.3d)); ElevationModel model = this.wwd.getModel().getGlobe().getElevationModel(); StringBuffer sb = new StringBuffer(); for (LatLon ll : latlons) { double e = model.getElevation(ll.getLatitude(), ll.getLongitude()); sb.append("\n").append(e); } Logging.logger().info(sb.toString()); }
public void doActionOnButton4() { ArrayList<LatLon> locations = new ArrayList<LatLon>(); locations.add(LatLon.fromDegrees(45.50d, -123.3d)); locations.add(LatLon.fromDegrees(45.52d, -123.3d)); locations.add(LatLon.fromDegrees(45.54d, -123.3d)); locations.add(LatLon.fromDegrees(45.56d, -123.3d)); locations.add(LatLon.fromDegrees(45.58d, -123.3d)); locations.add(LatLon.fromDegrees(45.60d, -123.3d)); locations.add(LatLon.fromDegrees(40.50d, -120.1d)); locations.add(LatLon.fromDegrees(40.52d, -120.2d)); locations.add(LatLon.fromDegrees(40.54d, -120.3d)); locations.add(LatLon.fromDegrees(40.56d, -120.4d)); locations.add(LatLon.fromDegrees(40.58d, -120.5d)); locations.add(LatLon.fromDegrees(40.60d, -120.6d)); // Now, let's find WMSBasicElevationModel WMSBasicElevationModel wmsbem = null; ElevationModel model = this.wwd.getModel().getGlobe().getElevationModel(); if (model instanceof CompoundElevationModel) { CompoundElevationModel cbem = (CompoundElevationModel) model; for (ElevationModel em : cbem.getElevationModels()) { // you can have additional checks if you know specific model name, etc. if (em instanceof WMSBasicElevationModel) { wmsbem = (WMSBasicElevationModel) em; break; } } } else if (model instanceof WMSBasicElevationModel) { wmsbem = (WMSBasicElevationModel) model; } if (null != wmsbem) { ElevationsRetriever retriever = new ElevationsRetriever(wmsbem, locations, 10000, 30000, new NotifyWhenReady()); retriever.start(); } else { String message = Logging.getMessage( "ElevationModel.ExceptionRequestingElevations", "No instance of WMSBasicElevationModel was found"); Logging.logger().severe(message); } }
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { String message = "ExceptionWhileSettingSystemLookAndFeel"; Logging.logger().log(java.util.logging.Level.WARNING, message, e); } start("World Wind - elevations demo", AppFrame.class); }
public void onSuccess(Position[] positions) { for (Position p : positions) { Logging.logger() .info( p.getLatitude().degrees + "," + p.getLongitude().degrees + " --> " + p.getElevation()); } }
public void doActionOnButton1() { Logging.logger().info("Zooming to Matterhorn"); View view = this.wwd.getView(); Position matterhorn = new Position(LatLon.fromDegrees(45.9763888888889d, 7.65833333333333d), 0d); // Position eyePos = new Position( LatLon.fromDegrees( 46.01066860997058d, // 7.633097536001656d ), 3363d ); // // view.setEyePosition( eyePos ); // view.setHeading( Angle.fromDegrees( 156d )); // view.setPitch( Angle.fromDegrees( 89.9d )); view.goTo(matterhorn, 5000d); }
public void doActionOnButton2() { ArrayList<LatLon> latlons = new ArrayList<LatLon>(); latlons.add(LatLon.fromDegrees(45.50d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.52d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.54d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.56d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.58d, -123.3d)); // latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) ); latlons.add(LatLon.fromDegrees(45.60d, -123.3d)); Sector sector = Sector.fromDegrees(44d, 46d, -123d, -121d); // Sector sector = Sector.boundingSector( latlons ); double[] elevations = new double[latlons.size()]; // request resolution of DTED2 (1degree / 3600 ) double targetResolution = Angle.fromDegrees(1d).radians / 3600; double resolutionAchieved = this.wwd .getModel() .getGlobe() .getElevationModel() .getElevations(sector, latlons, targetResolution, elevations); StringBuffer sb = new StringBuffer(); for (double e : elevations) { sb.append("\n").append(e); } sb.append("\nresolutionAchieved = ").append(resolutionAchieved); sb.append(", requested resolution = ").append(targetResolution); Logging.logger().info(sb.toString()); }
public void doActionOnButton5() { Logging.logger().info("You have pressed button 5"); }
public void onError(String error) { String message = Logging.getMessage("ElevationModel.ExceptionRequestingElevations", error); Logging.logger().severe(message); }