/** * Returns the coordinates of the sector as an array of values in radians, in the order minLat, maxLat, minLon, * maxLon. * * @return the array of sector coordinates. */ public double[] asRadiansArray() { return new double[] { this.getMinLatitude().radians, this.getMaxLatitude().radians, this.getMinLongitude().radians, this.getMaxLongitude().radians }; }
/** * Returns the coordinates of the sector as an array of values in degrees, in the order minLat, maxLat, minLon, * maxLon. * * @return the array of sector coordinates. */ public double[] asDegreesArray() { return new double[] { this.getMinLatitude().degrees, this.getMaxLatitude().degrees, this.getMinLongitude().degrees, this.getMaxLongitude().degrees }; }
public URL getURL(Tile tile, String string) throws MalformedURLException { StringBuffer sb = new StringBuffer(tile.getLevel().getService()); if (sb.lastIndexOf("?") != sb.length() - 1) sb.append("?"); sb.append("request=GetMap"); sb.append("&layers="); sb.append(tile.getLevel().getDataset()); sb.append("&srs=EPSG:4326"); sb.append("&width="); sb.append(tile.getLevel().getTileWidth()); sb.append("&height="); sb.append(tile.getLevel().getTileHeight()); Sector s = tile.getSector(); sb.append("&bbox="); sb.append(s.getMinLongitude().getDegrees()); sb.append(","); sb.append(s.getMinLatitude().getDegrees()); sb.append(","); sb.append(s.getMaxLongitude().getDegrees()); sb.append(","); sb.append(s.getMaxLatitude().getDegrees()); sb.append("&format=image/jpeg"); sb.append("&version=1.1.1"); sb.append("&styles="); return new java.net.URL(sb.toString()); } }
public URL getURL(Tile tile, String string) throws MalformedURLException { String layerName = tile.getLevel().getDataset() + layerNames[tile.getLevelNumber()] + "K"; StringBuffer sb = new StringBuffer(tile.getLevel().getService()); if (sb.lastIndexOf("?") != sb.length() - 1) { sb.append("?"); } sb.append("request=GetMap"); sb.append("&layers="); sb.append(layerName); sb.append("&srs=EPSG:4326"); sb.append("&width="); sb.append(tile.getLevel().getTileWidth()); sb.append("&height="); sb.append(tile.getLevel().getTileHeight()); Sector s = tile.getSector(); sb.append("&bbox="); sb.append(s.getMinLongitude().getDegrees()); sb.append(","); sb.append(s.getMinLatitude().getDegrees()); sb.append(","); sb.append(s.getMaxLongitude().getDegrees()); sb.append(","); sb.append(s.getMaxLatitude().getDegrees()); sb.append("&format=image/png"); sb.append("&version=1.1.1"); sb.append("&styles="); //System.out.println(tile.getLevelNumber() + " " + sb); return new java.net.URL(sb.toString()); } }
@Nonnull public static MercatorSector fromSector (final @Nonnull Sector sector) { return new MercatorSector(gudermannianInverse(sector.getMinLatitude()), gudermannianInverse(sector.getMaxLatitude()), new Angle(sector.getMinLongitude()), new Angle(sector.getMaxLongitude())); }
/** * Returns the latitude and longitude of the sector's angular center: (minimum latitude + maximum latitude) / 2, * (minimum longitude + maximum longitude) / 2. * * @return The latitude and longitude of the sector's angular center */ public LatLon getCentroid() { Angle la = Angle.fromDegrees(0.5 * (this.getMaxLatitude().degrees + this.getMinLatitude().degrees)); Angle lo = Angle.fromDegrees(0.5 * (this.getMaxLongitude().degrees + this.getMinLongitude().degrees)); return new LatLon(la, lo); }
public LatLon next() { if (this.position > 3) throw new NoSuchElementException(); LatLon p; switch (this.position) { case 0: p = new LatLon(Sector.this.getMinLatitude(), Sector.this.getMinLongitude()); break; case 1: p = new LatLon(Sector.this.getMinLatitude(), Sector.this.getMaxLongitude()); break; case 2: p = new LatLon(Sector.this.getMaxLatitude(), Sector.this.getMaxLongitude()); break; default: p = new LatLon(Sector.this.getMaxLatitude(), Sector.this.getMinLongitude()); break; } ++this.position; return p; }
public Sector(Sector sector) { if (sector == null) { throw new IllegalArgumentException("Sector Is Null"); } this.minLatitude = new Angle(sector.getMinLatitude()); this.maxLatitude = new Angle(sector.getMaxLatitude()); this.minLongitude = new Angle(sector.getMinLongitude()); this.maxLongitude = new Angle(sector.getMaxLongitude()); this.deltaLat = Angle.fromDegrees(this.maxLatitude.degrees - this.minLatitude.degrees); this.deltaLon = Angle.fromDegrees(this.maxLongitude.degrees - this.minLongitude.degrees); }
return 1; if (this.getMaxLongitude().compareTo(that.getMaxLongitude()) < 0) return -1; if (this.getMaxLongitude().compareTo(that.getMaxLongitude()) > 0) return 1;
@Override @Nonnull public MercatorTextureTile[] createSubTiles (final @Nonnull Level nextLevel) { Parameters.notNull("nextLevel", nextLevel); final double minLatitude = mercatorSector.getMinLatPercent(); final double maxLatitude = mercatorSector.getMaxLatPercent(); final double midLatitude = minLatitude + (maxLatitude - minLatitude) / 2.0; final Angle minLongitude = getSector().getMinLongitude(); final Angle maxLongitude = getSector().getMaxLongitude(); final Angle midLongitude = Angle.midAngle(minLongitude, maxLongitude); final String nextLevelCacheName = nextLevel.getCacheName(); final int nextLevelNum = nextLevel.getLevelNumber(); final int row = 2 * getRow(); final int column = 2 * getColumn(); final TileKey[] key = new TileKey[4]; key[0] = new TileKey(nextLevelNum, row, column, nextLevelCacheName); // sw key[1] = new TileKey(nextLevelNum, row, column + 1, nextLevelCacheName); // se key[2] = new TileKey(nextLevelNum, row + 1, column, nextLevelCacheName); // nw key[3] = new TileKey(nextLevelNum, row + 1, column + 1, nextLevelCacheName); // ne final MercatorTextureTile[] subTiles = new MercatorTextureTile[4]; subTiles[0] = findOrCreateTile(minLatitude, midLatitude, minLongitude, midLongitude, nextLevel, key[0]); subTiles[1] = findOrCreateTile(minLatitude, midLatitude, midLongitude, maxLongitude, nextLevel, key[1]); subTiles[2] = findOrCreateTile(midLatitude, maxLatitude, minLongitude, midLongitude, nextLevel, key[2]); subTiles[3] = findOrCreateTile(midLatitude, maxLatitude, midLongitude, maxLongitude, nextLevel, key[3]); return subTiles; }