You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/06/15 17:31:09 UTC
[sis] 03/05: Change argument order in `ImageProcessor.resample(…)`. No change in functionality.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit d386e7c9bef68b094ac4622817bc7ae78f2031d1
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Mon Jun 15 16:22:50 2020 +0200
Change argument order in `ImageProcessor.resample(…)`.
No change in functionality.
---
.../java/org/apache/sis/gui/coverage/RenderingData.java | 2 +-
.../apache/sis/coverage/grid/ResampledGridCoverage.java | 2 +-
.../src/main/java/org/apache/sis/image/ImageProcessor.java | 14 +++++++-------
.../src/main/java/org/apache/sis/image/ResampledImage.java | 6 +++---
.../test/java/org/apache/sis/image/ResampledImageTest.java | 6 +++---
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
index c269bb2..a88ae5b 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/RenderingData.java
@@ -262,7 +262,7 @@ final class RenderingData implements Cloneable {
final PreferredSize bounds = (PreferredSize) Shapes2D.transform(
MathTransforms.bidimensional(cornerToDisplay),
ImageUtilities.getBounds(data), new PreferredSize());
- return processor.resample(bounds, displayToCenter, data);
+ return processor.resample(data, bounds, displayToCenter);
}
/**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ResampledGridCoverage.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ResampledGridCoverage.java
index c1905df..22da1bc 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ResampledGridCoverage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ResampledGridCoverage.java
@@ -525,7 +525,7 @@ final class ResampledGridCoverage extends GridCoverage {
* call this method only here, when remaining operations are unlikely to fail.
*/
final RenderedImage values = source.render(sourceExtent);
- return imageProcessor.resample(bounds, toSource, values);
+ return imageProcessor.resample(values, bounds, toSource);
}
/**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java b/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java
index 82a80e6..72a1bee 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ImageProcessor.java
@@ -245,7 +245,7 @@ public class ImageProcessor implements Cloneable {
*
* @return interpolation method to use during resample operations.
*
- * @see #resample(Rectangle, MathTransform, RenderedImage)
+ * @see #resample(RenderedImage, Rectangle, MathTransform)
*/
public Interpolation getInterpolation() {
return interpolation;
@@ -256,7 +256,7 @@ public class ImageProcessor implements Cloneable {
*
* @param method interpolation method to use during resample operations.
*
- * @see #resample(Rectangle, MathTransform, RenderedImage)
+ * @see #resample(RenderedImage, Rectangle, MathTransform)
*/
public void setInterpolation(final Interpolation method) {
ArgumentChecks.ensureNonNull("method", method);
@@ -561,16 +561,16 @@ public class ImageProcessor implements Cloneable {
* in the new image are set to {@linkplain #getFillValues() fill values}. Otherwise sample values are interpolated
* using the method given by {@link #getInterpolation()}.
*
- * <p>If the given source is an instance of {@link ResampledImage} or {@link AnnotatedImage},
+ * <p>If the given source is an instance of {@link ResampledImage},
* then this method will use {@linkplain PlanarImage#getSources() the source} of the given source.
* The intent is to avoid resampling a resampled image; instead this method tries to work on the original data.</p>
*
- * @param bounds domain of pixel coordinates of resampled image.
- * @param toSource conversion of pixel coordinates of this image to pixel coordinates of {@code source} image.
* @param source the image to be resampled.
+ * @param bounds domain of pixel coordinates of resampled image to create.
+ * @param toSource conversion of pixel coordinates from resampled image to {@code source} image.
* @return resampled image (may be {@code source}).
*/
- public RenderedImage resample(final Rectangle bounds, MathTransform toSource, RenderedImage source) {
+ public RenderedImage resample(RenderedImage source, final Rectangle bounds, MathTransform toSource) {
ArgumentChecks.ensureNonNull("bounds", bounds);
ArgumentChecks.ensureNonNull("toSource", toSource);
ArgumentChecks.ensureNonNull("source", source);
@@ -600,7 +600,7 @@ public class ImageProcessor implements Cloneable {
}
}
}
- resampled = new ResampledImage(bounds, toSource, source, interpolation,
+ resampled = new ResampledImage(source, bounds, toSource, interpolation,
(float) getPositionalAccuracy(Units.PIXEL), fillValues);
break;
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
index c86f7ad..fc0c301 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
@@ -158,9 +158,9 @@ public class ResampledImage extends ComputedImage {
* to {@code fillValues}. If the given array is {@code null}, or if any element in the given array is {@code null},
* then the default fill value is NaN for floating point data types or zero for integer data types.</p>
*
+ * @param source the image to be resampled.
* @param bounds domain of pixel coordinates of this resampled image.
* @param toSource conversion of pixel coordinates of this image to pixel coordinates of {@code source} image.
- * @param source the image to be resampled.
* @param interpolation the object to use for performing interpolations.
* @param accuracy desired positional accuracy in pixel units, or 0 for the best accuracy available.
* A value such as 0.125 pixel may enable the use of a slightly faster algorithm
@@ -170,9 +170,9 @@ public class ResampledImage extends ComputedImage {
* missing values are assumed {@code null}. If longer than the number of bands, extraneous
* values are ignored.
*
- * @see ImageProcessor#resample(Rectangle, MathTransform, RenderedImage)
+ * @see ImageProcessor#resample(RenderedImage, Rectangle, MathTransform)
*/
- protected ResampledImage(final Rectangle bounds, final MathTransform toSource, final RenderedImage source,
+ protected ResampledImage(final RenderedImage source, final Rectangle bounds, final MathTransform toSource,
final Interpolation interpolation, final float accuracy, final Number[] fillValues)
{
super(ImageLayout.DEFAULT.createCompatibleSampleModel(source, bounds), source);
diff --git a/core/sis-feature/src/test/java/org/apache/sis/image/ResampledImageTest.java b/core/sis-feature/src/test/java/org/apache/sis/image/ResampledImageTest.java
index 6a88d0b..16a1575 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/image/ResampledImageTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/image/ResampledImageTest.java
@@ -100,7 +100,7 @@ public final strictfp class ResampledImageTest extends TestCase {
* Creates an interpolated image in the simple case where the image is scaled by a factor 2.
* The {@link #source} and {@link #interpolation} fields must be initialized before this method is invoked.
* This method uses processor instead than instantiating {@link ResampledImage} directly for opportunistic
- * testing of {@link ImageProcessor#resample(Rectangle, MathTransform, RenderedImage)} method.
+ * testing of {@link ImageProcessor#resample(RenderedImage, Rectangle, MathTransform)} method.
*
* @param minX minimal X coordinate to give to the resampled image.
* @param minY minimal Y coordinate to give to the resampled image.
@@ -112,7 +112,7 @@ public final strictfp class ResampledImageTest extends TestCase {
tr.translate(-bounds.x, -bounds.y);
final ImageProcessor processor = new ImageProcessor();
processor.setInterpolation(interpolation);
- target = (ResampledImage) processor.resample(bounds, new AffineTransform2D(tr), source);
+ target = (ResampledImage) processor.resample(source, bounds, new AffineTransform2D(tr));
try {
tr.invert();
} catch (NoninvertibleTransformException e) {
@@ -270,7 +270,7 @@ public final strictfp class ResampledImageTest extends TestCase {
} catch (NoninvertibleTransformException e) {
throw new AssertionError(e);
}
- target = new ResampledImage(new Rectangle(9, 9), toSource, source, interpolation, 0, null);
+ target = new ResampledImage(source, new Rectangle(9, 9), toSource, interpolation, 0, null);
assertEquals("numXTiles", 1, target.getNumXTiles());
assertEquals("numYTiles", 1, target.getNumYTiles());