protected static ArrayList<Position> computeElevations(ArrayList<Position> locations) { Sector sector = Sector.boundingSector(locations); HighResolutionTerrain hrt = new HighResolutionTerrain(new Earth(), sector, null, 1.0); ArrayList<Position> computedPositions = new ArrayList<Position>(); for (LatLon latLon : locations) { Double elevation = hrt.getElevation(latLon); computedPositions.add(new Position(latLon, Math.round(elevation * 10000.0) / 10000.0)); } return computedPositions; }
protected static ArrayList<Position> generateReferenceLocations( Sector sector, int numLats, int numLons) { ArrayList<Position> locations = new ArrayList<Position>(); double dLat = (sector.getMaxLatitude().degrees - sector.getMinLatitude().degrees) / (numLats - 1); double dLon = (sector.getMaxLongitude().degrees - sector.getMinLongitude().degrees) / (numLons - 1); for (int j = 0; j < numLats; j++) { double lat = sector.getMinLatitude().degrees + j * dLat; for (int i = 0; i < numLons; i++) { double lon = sector.getMinLongitude().degrees + i * dLon; // Specify angles to five decimal places. locations.add( Position.fromDegrees( Math.round(lat * 100000.0) / 100000.0, Math.round(lon * 100000.0) / 100000.0, 0)); } } return locations; }