public BoundingBox getCoverageBestFitBounds() { return boundsFromRectangle(getCoverageBestFit()); }
private Geometry transformToGridCrs(final Geometry geometryInLayerCrs, final int zoomLevel) { final MathTransform worldToGrid; if (transformCache[zoomLevel] == null) { final long[] coverage = getGridCoverage(zoomLevel); final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage); worldToGrid = getWorldToGridTransform(coverageBounds, coverage); transformCache[zoomLevel] = worldToGrid; } else { worldToGrid = transformCache[zoomLevel]; } Geometry geomInGridCrs; try { geomInGridCrs = JTS.transform(geometryInLayerCrs, worldToGrid); } catch (MismatchedDimensionException e) { throw new IllegalArgumentException(e); } catch (TransformException e) { throw new IllegalArgumentException(e); } return geomInGridCrs; }
private Geometry transformToGridCrs(final Geometry geometryInLayerCrs, final int zoomLevel) { final MathTransform worldToGrid; if (transformCache[zoomLevel] == null) { final long[] coverage = getGridCoverage(zoomLevel); final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage); worldToGrid = getWorldToGridTransform(coverageBounds, coverage); transformCache[zoomLevel] = worldToGrid; } else { worldToGrid = transformCache[zoomLevel]; } Geometry geomInGridCrs; try { geomInGridCrs = JTS.transform(geometryInLayerCrs, worldToGrid); } catch (MismatchedDimensionException e) { throw new IllegalArgumentException(e); } catch (TransformException e) { throw new IllegalArgumentException(e); } return geomInGridCrs; }
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)); } }
protected void determineCanvasLayout() { srcBounds = gridSubset.boundsFromRectangle(srcRectangle);
final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage); final MathTransform worldToGrid = getWorldToGridTransform(coverageBounds, coverage);
this.metaBbox = gridSubset.boundsFromRectangle(metaGridCov);
final BoundingBox coverageBounds = gridSubset.boundsFromRectangle(coverage); final MathTransform worldToGrid = getWorldToGridTransform(coverageBounds, coverage);