public boolean addAllCoverages(ElevationModel model) { if (model == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ElevationModel", "addAllCoverages", "missingModel")); } ArrayList<ElevationCoverage> thisList = this.coverages; ArrayList<ElevationCoverage> thatList = model.coverages; thisList.ensureCapacity(thatList.size()); boolean changed = false; for (int idx = 0, len = thatList.size(); idx < len; idx++) { ElevationCoverage thatCoverage = thatList.get(idx); // we know the contents of model.coverages is valid changed |= this.addCoverage(thatCoverage); } return changed; }
public ElevationModel(ElevationModel model) { if (model == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ElevationModel", "constructor", "missingModel")); } this.addAllCoverages(model); }
protected BoundingBox getExtent(RenderContext rc) { if (this.heightLimits == null) { this.heightLimits = new float[2]; } if (this.extent == null) { this.extent = new BoundingBox(); } long elevationTimestamp = rc.globe.getElevationModel().getTimestamp(); if (elevationTimestamp != this.heightLimitsTimestamp) { // initialize the heights for elevation model scan this.heightLimits[0] = Float.MAX_VALUE; this.heightLimits[1] = -Float.MAX_VALUE; rc.globe.getElevationModel().getHeightLimits(this.sector, this.heightLimits); // check for valid height limits if (this.heightLimits[0] > this.heightLimits[1]) { Arrays.fill(this.heightLimits, 0f); } } double verticalExaggeration = rc.verticalExaggeration; if (verticalExaggeration != this.extentExaggeration || elevationTimestamp != this.heightLimitsTimestamp) { float minHeight = (float) (this.heightLimits[0] * verticalExaggeration); float maxHeight = (float) (this.heightLimits[1] * verticalExaggeration); this.extent.setToSector(this.sector, rc.globe, minHeight, maxHeight); } this.heightLimitsTimestamp = elevationTimestamp; this.extentExaggeration = verticalExaggeration; return this.extent; }
/** * Creates a new WorldWindow (GLSurfaceView) object with a WCS Elevation Coverage * * @return The WorldWindow object containing the globe. */ @Override public WorldWindow createWorldWindow() { // Let the super class (BasicGlobeFragment) do the creation WorldWindow wwd = super.createWorldWindow(); // Specify the bounding sector - provided by the WCS Sector coverageSector = Sector.fromDegrees(25.0, -125.0, 25.0, 60.0); // Specify the number of levels to match data resolution int numberOfLevels = 12; // Specify the version 1.0.0 WCS address String serviceAddress = "https://worldwind26.arc.nasa.gov/wcs"; // Specify the coverage name String coverage = "USGS-NED"; // Create an elevation coverage from a version 1.0.0 WCS ElevationCoverage usgsNed = new Wcs100ElevationCoverage(coverageSector, numberOfLevels, serviceAddress, coverage); // Remove any existing coverages from the Globe wwd.getGlobe().getElevationModel().clearCoverages(); // Add the coverage to the Globes elevation model wwd.getGlobe().getElevationModel().addCoverage(usgsNed); // Position the camera to look at Mt. Rainier this.positionView(wwd); return wwd; }
int tileHeight = tile.level.tileHeight; long elevationTimestamp = rc.globe.getElevationModel().getTimestamp(); if (elevationTimestamp != tile.getHeightTimestamp()) { rc.globe.getElevationModel().getHeightGrid(tile.sector, tileWidth, tileHeight, heights); tile.setHeights(heights);
public ElevationModel(Iterable<? extends ElevationCoverage> iterable) { if (iterable == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ElevationModel", "constructor", "missingIterable")); } for (ElevationCoverage coverage : iterable) { if (coverage == null) { throw new IllegalArgumentException( Logger.logMessage(Logger.ERROR, "ElevationModel", "constructor", "missingCoverage")); } this.addCoverage(coverage); } }
/** * Creates a new WorldWindow (GLSurfaceView) object. */ public WorldWindow createWorldWindow() { // Create the WorldWindow (a GLSurfaceView) which displays the globe. this.wwd = new WorldWindow(getContext()); // Setup the WorldWindow's layers. this.wwd.getLayers().addLayer(new BackgroundLayer()); this.wwd.getLayers().addLayer(new BlueMarbleLandsatLayer()); // Setup the WorldWindow's elevation coverages. this.wwd.getGlobe().getElevationModel().addCoverage(new BasicElevationCoverage()); return this.wwd; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Establish the activity content setContentView(this.layoutResourceId); setAboutBoxTitle("About the " + this.getResources().getText(R.string.title_basic_globe)); setAboutBoxText("Demonstrates how to construct a WorldWindow with a few layers.\n" + "The globe uses the default navigation gestures: \n" + " - one-finger pan moves the camera,\n" + " - two-finger pinch-zoom adjusts the range to the look at position, \n" + " - two-finger rotate arcs the camera horizontally around the look at position,\n" + " - three-finger tilt arcs the camera vertically around the look at position."); // Create the WorldWindow (a GLSurfaceView) which displays the globe. this.wwd = new WorldWindow(this); // Add the WorldWindow view object to the layout that was reserved for the globe. FrameLayout globeLayout = (FrameLayout) findViewById(R.id.globe); globeLayout.addView(this.wwd); // Setup the WorldWindow's layers. this.wwd.getLayers().addLayer(new BackgroundLayer()); this.wwd.getLayers().addLayer(new BlueMarbleLandsatLayer()); this.wwd.getLayers().addLayer(new AtmosphereLayer()); // Setup the WorldWindow's elevation coverages. this.wwd.getGlobe().getElevationModel().addCoverage(new BasicElevationCoverage()); }