@Test public void testReadResolutionCalculator() throws Exception { final CoordinateReferenceSystem requestCRS = CRS.decode("EPSG:3857", true); final CoordinateReferenceSystem nativeCRS = CRS.decode("EPSG:4326", true); final ReferencedEnvelope requestBounds = new ReferencedEnvelope(-10000000, -5000000, 10000000, 15000000, requestCRS); GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 256, 256), requestBounds); ReadResolutionCalculator calculator = new ReadResolutionCalculator(gg, nativeCRS, new double[] {NATIVE_RES, NATIVE_RES}); ReferencedEnvelope readBounds = requestBounds.transform(nativeCRS, true); calculator.setAccurateResolution(true); double[] requestedResolution = calculator.computeRequestedResolution(readBounds); assertEquals(0.0331, requestedResolution[0], 1e-4); assertEquals(0.0331, requestedResolution[1], 1e-4); }
public ReadResolutionCalculator( GridGeometry2D requestedGridGeometry, CoordinateReferenceSystem nativeCrs, double[] fullResolution) throws FactoryException { Utilities.ensureNonNull("gridGeometry", requestedGridGeometry); this.requestedBBox = new ReferencedEnvelope((Envelope) requestedGridGeometry.getEnvelope2D()); this.requestedRasterArea = requestedGridGeometry.getGridRange2D().getBounds(); this.requestedGridToWorld = (AffineTransform) requestedGridGeometry.getGridToCRS2D(); this.fullResolution = fullResolution; if (fullResolution == null) { this.fullResolution = computeClassicResolution(requestedBBox); isFullResolutionInRequestedCRS = true; } CoordinateReferenceSystem requestedCRS = requestedGridGeometry.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(nativeCrs, requestedCRS)) { this.destinationToSourceTransform = CRS.findMathTransform(requestedCRS, nativeCrs); } }
ReadResolutionCalculator { public ReadResolutionCalculator( GridGeometry2D requestedGridGeometry, CoordinateReferenceSystem nativeCrs, double[] fullResolution) throws FactoryException { Utilities.ensureNonNull("gridGeometry", requestedGridGeometry); this.requestedBBox = new ReferencedEnvelope((Envelope) requestedGridGeometry.getEnvelope2D()); this.requestedRasterArea = requestedGridGeometry.getGridRange2D().getBounds(); this.requestedGridToWorld = (AffineTransform) requestedGridGeometry.getGridToCRS2D(); this.fullResolution = fullResolution; if (fullResolution == null) { this.fullResolution = computeClassicResolution(requestedBBox); isFullResolutionInRequestedCRS = true; } CoordinateReferenceSystem requestedCRS = requestedGridGeometry.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(nativeCrs, requestedCRS)) { this.destinationToSourceTransform = CRS.findMathTransform(requestedCRS, nativeCrs); } } }
ReadResolutionCalculator { public ReadResolutionCalculator( GridGeometry2D requestedGridGeometry, CoordinateReferenceSystem nativeCrs, double[] fullResolution) throws FactoryException { Utilities.ensureNonNull("gridGeometry", requestedGridGeometry); this.requestedBBox = new ReferencedEnvelope((Envelope) requestedGridGeometry.getEnvelope2D()); this.requestedRasterArea = requestedGridGeometry.getGridRange2D().getBounds(); this.requestedGridToWorld = (AffineTransform) requestedGridGeometry.getGridToCRS2D(); this.fullResolution = fullResolution; if (fullResolution == null) { this.fullResolution = computeClassicResolution(requestedBBox); isFullResolutionInRequestedCRS = true; } CoordinateReferenceSystem requestedCRS = requestedGridGeometry.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(nativeCrs, requestedCRS)) { this.destinationToSourceTransform = CRS.findMathTransform(requestedCRS, nativeCrs); } } ReadResolutionCalculator(
            GridGeometry2D requestedGridGeometry,
            CoordinateReferenceSystem nativeCrs,
            double[] fullResolution); }
ReadResolutionCalculator { public ReadResolutionCalculator( GridGeometry2D requestedGridGeometry, CoordinateReferenceSystem nativeCrs, double[] fullResolution) throws FactoryException { Utilities.ensureNonNull("gridGeometry", requestedGridGeometry); this.requestedBBox = new ReferencedEnvelope((Envelope) requestedGridGeometry.getEnvelope2D()); this.requestedRasterArea = requestedGridGeometry.getGridRange2D().getBounds(); this.requestedGridToWorld = (AffineTransform) requestedGridGeometry.getGridToCRS2D(); this.fullResolution = fullResolution; if (fullResolution == null) { this.fullResolution = computeClassicResolution(requestedBBox); isFullResolutionInRequestedCRS = true; } CoordinateReferenceSystem requestedCRS = requestedGridGeometry.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(nativeCrs, requestedCRS)) { this.destinationToSourceTransform = CRS.findMathTransform(requestedCRS, nativeCrs); } } ReadResolutionCalculator(
            GridGeometry2D requestedGridGeometry,
            CoordinateReferenceSystem nativeCrs,
            double[] fullResolution); double[] computeRequestedResolution(ReferencedEnvelope readBounds); boolean isAccurateResolution(); void setAccurateResolution(boolean accurateResolution); int getMaxOversamplingFactor(); void setMaxOversamplingFactor(int maxOversamplingFactor); }
ReadResolutionCalculator { public ReadResolutionCalculator( GridGeometry2D requestedGridGeometry, CoordinateReferenceSystem nativeCrs, double[] fullResolution) throws FactoryException { Utilities.ensureNonNull("gridGeometry", requestedGridGeometry); this.requestedBBox = new ReferencedEnvelope((Envelope) requestedGridGeometry.getEnvelope2D()); this.requestedRasterArea = requestedGridGeometry.getGridRange2D().getBounds(); this.requestedGridToWorld = (AffineTransform) requestedGridGeometry.getGridToCRS2D(); this.fullResolution = fullResolution; if (fullResolution == null) { this.fullResolution = computeClassicResolution(requestedBBox); isFullResolutionInRequestedCRS = true; } CoordinateReferenceSystem requestedCRS = requestedGridGeometry.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(nativeCrs, requestedCRS)) { this.destinationToSourceTransform = CRS.findMathTransform(requestedCRS, nativeCrs); } } ReadResolutionCalculator(
            GridGeometry2D requestedGridGeometry,
            CoordinateReferenceSystem nativeCrs,
            double[] fullResolution); double[] computeRequestedResolution(ReferencedEnvelope readBounds); boolean isAccurateResolution(); void setAccurateResolution(boolean accurateResolution); int getMaxOversamplingFactor(); void setMaxOversamplingFactor(int maxOversamplingFactor);  }