String[] boundsPrep(BoundingBox bbox) { String[] bs = { Double.toString(bbox.getMinX()), Double.toString(bbox.getMinY()), Double.toString(bbox.getMaxX()), Double.toString(bbox.getMaxY()) }; return bs; } }
String[] boundsPrep(BoundingBox bbox) { String[] bs = { Double.toString(bbox.getMinX()), Double.toString(bbox.getMinY()), Double.toString(bbox.getMaxX()), Double.toString(bbox.getMaxY()) }; return bs; } }
String[] boundsPrep(BoundingBox bbox) { String[] bs = { Double.toString(bbox.getMinX()), Double.toString(bbox.getMinY()), Double.toString(bbox.getMaxX()), Double.toString(bbox.getMaxY()) }; return bs; }
String[] boundsPrep(BoundingBox bbox) { String[] bs = { Double.toString(bbox.getMinX()), Double.toString(bbox.getMinY()), Double.toString(bbox.getMaxX()), Double.toString(bbox.getMaxY()) }; return bs; } }
protected void determineCanvasLayout() { srcRectangle = gridSubset.getCoverageIntersection(srcIdx, reqBounds); srcBounds = gridSubset.boundsFromRectangle(srcRectangle); // We now have the complete area, lets figure out our offsets // Positive means that there is blank space to the first tile, // negative means we will not use the entire tile boundOfs[0] = srcBounds.getMinX() - reqBounds.getMinX(); boundOfs[1] = srcBounds.getMinY() - reqBounds.getMinY(); boundOfs[2] = reqBounds.getMaxX() - srcBounds.getMaxX(); boundOfs[3] = reqBounds.getMaxY() - srcBounds.getMaxY(); canvasSize[0] = (int) Math.round(reqBounds.getWidth() / this.srcResolution); canvasSize[1] = (int) Math.round(reqBounds.getHeight() / this.srcResolution); // Calculate the corresponding pixel offsets. We'll stick to sane, // i.e. bottom left, coordinates at this point for (int i = 0; i < 4; i++) { canvOfs[i] = (int) Math.round(boundOfs[i] / this.srcResolution); } if (log.isDebugEnabled()) { log.debug("intersection rectangle: " + Arrays.toString(srcRectangle)); log.debug("intersection bounds: " + srcBounds + " (" + reqBounds + ")"); log.debug("Bound offsets: " + Arrays.toString(boundOfs)); log.debug("Canvas size: " + Arrays.toString(canvasSize) + "(" + reqWidth + "," + reqHeight + ")"); log.debug("Canvas offsets: " + Arrays.toString(canvOfs)); } }
private static Envelope toEnvelope(BoundingBox bounds) { return new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()); } }
/** * Find the rectangle of tiles that most closely covers the given rectangle * * @param level integer zoom level to consider tiles at * @param rectangeBounds rectangle to match * @return Array of long, the rectangle of tiles in tile coordinates: {minx, miny, maxx, maxy, * level} */ protected long[] closestRectangle(int level, BoundingBox rectangeBounds) { Grid grid = getGridLevels()[level]; double width = grid.getResolution() * getTileWidth(); double height = grid.getResolution() * getTileHeight(); long minX = (long) Math.floor((rectangeBounds.getMinX() - tileOrigin()[0]) / width); long minY = (long) Math.floor((rectangeBounds.getMinY() - tileOrigin()[1]) / height); long maxX = (long) Math.ceil(((rectangeBounds.getMaxX() - tileOrigin()[0]) / width)); long maxY = (long) Math.ceil(((rectangeBounds.getMaxY() - tileOrigin()[1]) / height)); if (yBaseToggle) { minY = minY + grid.getNumTilesHigh(); maxY = maxY + grid.getNumTilesHigh(); } // We substract one, since that's the tile at that position long[] ret = {minX, minY, maxX - 1, maxY - 1, level}; return ret; }
@Override public void checkSecurity(TileLayer layer, BoundingBox extent, SRS srs) throws SecurityException, GeoWebCacheException { if (GWC.get().getConfig().isSecurityEnabled()) { try { ReferencedEnvelope env; if (Objects.nonNull(extent)) { env = new ReferencedEnvelope( extent.getMinX(), extent.getMaxX(), extent.getMinY(), extent.getMaxY(), CRS.decode(srs.toString())); } else { env = null; } GWC.get().verifyAccessLayer(layer.getName(), env); } catch (ServiceException | MismatchedDimensionException | FactoryException e) { throw new GeoWebCacheException(e); } } } }
private static String getLookAt(BoundingBox bbox) { double lon1 = bbox.getMinX(); double lat1 = bbox.getMinY(); double lon2 = bbox.getMaxX(); double lat2 = bbox.getMaxY(); double R_EARTH = 6.371 * 1000000; // meters // double VIEWER_WIDTH = 22 * Math.PI / 180; // The field of view of the // // google maps camera, in // // radians double[] p1 = getRect(lon1, lat1, R_EARTH); double[] p2 = getRect(lon2, lat2, R_EARTH); double[] midpoint = new double[] { (p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2, (p1[2] + p2[2]) / 2 }; midpoint = getGeographic(midpoint[0], midpoint[1], midpoint[2]); // averaging the longitudes; using the rectangular coordinates makes the // calculated center tend toward the corner that's closer to the // equator. midpoint[0] = ((lon1 + lon2) / 2); double distance = distance(p1, p2); // double height = distance / (2 * Math.tan(VIEWER_WIDTH)); return "<LookAt id=\"superoverlay\">" + "\n<longitude>" + ((lon1 + lon2) / 2) + "</longitude>" + "\n<latitude>" + midpoint[1] + "</latitude>" + "\n<altitude>0</altitude>" + "\n<heading>0</heading>" + "\n<tilt>0</tilt>" + "\n<range>" + distance + "</range>" + "\n<altitudeMode>clampToGround</altitudeMode>" // + "\n<!--kml:altitudeModeEnum:clampToGround, relativeToGround, absolute -->" + "\n</LookAt>\n"; }
assertFalse(bounds.intersects(layerBounds.getMaxX(), layerBounds.getMaxY()));
private static String getLookAt(BoundingBox bbox) { double lon1 = bbox.getMinX(); double lat1 = bbox.getMinY(); double lon2 = bbox.getMaxX(); double lat2 = bbox.getMaxY();
bounds = tileLayer.getGridSubset(expectedGridset).boundsFromIndex(tileIndex); Envelope reqBbox = new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()); request.setBbox(reqBbox);
metaTileWidth += gutterConfig; gutter[2] = gutterConfig; metaBbox.setMaxX(metaBbox.getMaxX() + coordWidthDelta);
ReferencedEnvelope tilebbox = new ReferencedEnvelope( metaTileContext.getCoordinateReferenceSystem()); tilebbox.init(tileBounds.getMinX(), tileBounds.getMaxX(), tileBounds.getMinY(), tileBounds.getMaxY()); tileContext.getViewport().setBounds(tilebbox);
Matcher<BoundingBox> closeTo(BoundingBox expected, double error) { return allOf( hasProperty("minX", Matchers.closeTo(expected.getMinX(), error)), hasProperty("minY", Matchers.closeTo(expected.getMinY(), error)), hasProperty("maxX", Matchers.closeTo(expected.getMaxX(), error)), hasProperty("maxY", Matchers.closeTo(expected.getMaxY(), error))); }
BoundingBox prescribedBounds = gridSetBroker.WORLD_EPSG3857.getBounds(); return JTS.toGeometry(new Envelope(prescribedBounds.getMinX(), prescribedBounds .getMaxX(), prescribedBounds.getMinY(), prescribedBounds.getMaxY()));
bounds = tileLayer.getGridSubset("EPSG:900913").boundsFromIndex(new long[] { 0, 0, 1 }); Envelope reqBbox = new Envelope(bounds.getMinX(), bounds.getMaxX(), bounds.getMinY(), bounds.getMaxY()); request.setBbox(reqBbox);
BoundingBox bboxEast = new BoundingBox(0.0, bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY());