sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Rename RelocatedImage as ReshapedImage because this class can also change the image size.
Date Sun, 29 Dec 2019 12:46:15 GMT
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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new bc51b96  Rename RelocatedImage as ReshapedImage because this class can also change
the image size.
bc51b96 is described below

commit bc51b967aeffd5e7a35cc2e66f488fce2fff02d4
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sun Dec 29 13:45:43 2019 +0100

    Rename RelocatedImage as ReshapedImage because this class can also change the image size.
---
 .../src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java  | 6 +++---
 .../sis/coverage/grid/{RelocatedImage.java => ReshapedImage.java}   | 4 ++--
 .../grid/{RelocatedImageTest.java => ReshapedImageTest.java}        | 6 +++---
 .../src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java   | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
index 614fa86..66fc23b 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverage2D.java
@@ -209,8 +209,8 @@ public class GridCoverage2D extends GridCoverage {
      */
     @Workaround(library="JDK", version="1.8")
     private static RenderedImage unwrapIfSameSize(RenderedImage data) {
-        if (data instanceof RelocatedImage) {
-            final RenderedImage image = ((RelocatedImage) data).image;
+        if (data instanceof ReshapedImage) {
+            final RenderedImage image = ((ReshapedImage) data).image;
             if (image.getWidth() == data.getWidth() && image.getHeight() == data.getHeight())
{
                 data = image;
             }
@@ -540,7 +540,7 @@ public class GridCoverage2D extends GridCoverage {
              * and actual region of the returned image. For example if the user requested
an image starting at
              * (5,5) but the image to return starts at (1,1), then we need to set its location
to (-4,-4).
              */
-            final RelocatedImage r = new RelocatedImage(data, xmin, ymin, xmax, ymax);
+            final ReshapedImage r = new ReshapedImage(data, xmin, ymin, xmax, ymax);
             String error; assert (error = r.verify()) != null : error;
             return r.isIdentity() ? data : r;
         } catch (ArithmeticException e) {
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/RelocatedImage.java
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ReshapedImage.java
similarity index 98%
rename from core/sis-feature/src/main/java/org/apache/sis/coverage/grid/RelocatedImage.java
rename to core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ReshapedImage.java
index 2110dc0..7fd6ab3 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/RelocatedImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/ReshapedImage.java
@@ -45,7 +45,7 @@ import static java.lang.Math.toIntExact;
  * @since   1.1
  * @module
  */
-final class RelocatedImage extends PlanarImage {
+final class ReshapedImage extends PlanarImage {
     /**
      * The image to translate.
      */
@@ -93,7 +93,7 @@ final class RelocatedImage extends PlanarImage {
      * @param  ymax   maximal <var>y</var> coordinate of the requested region,
inclusive.
      * @throws ArithmeticException if image indices would overflow 32 bits integer capacity.
      */
-    RelocatedImage(final RenderedImage image, final long xmin, final long ymin, final long
xmax, final long ymax) {
+    ReshapedImage(final RenderedImage image, final long xmin, final long ymin, final long
xmax, final long ymax) {
         this.image = image;
         /*
          * Compute indices of all tiles to retain in this image. All local fields are `long`
in order to force
diff --git a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/RelocatedImageTest.java
b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/ReshapedImageTest.java
similarity index 90%
rename from core/sis-feature/src/test/java/org/apache/sis/coverage/grid/RelocatedImageTest.java
rename to core/sis-feature/src/test/java/org/apache/sis/coverage/grid/ReshapedImageTest.java
index a5dfac3..de15b71 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/RelocatedImageTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/ReshapedImageTest.java
@@ -26,7 +26,7 @@ import static org.apache.sis.test.FeatureAssert.assertValuesEqual;
 
 
 /**
- * Tests the {@link RelocatedImage} implementation.
+ * Tests the {@link ReshapedImage} implementation.
  *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -34,7 +34,7 @@ import static org.apache.sis.test.FeatureAssert.assertValuesEqual;
  * @since   1.1
  * @module
  */
-public final strictfp class RelocatedImageTest extends TestCase {
+public final strictfp class ReshapedImageTest extends TestCase {
     /**
      * Tests with a request starting on the left and on top of data.
      */
@@ -47,7 +47,7 @@ public final strictfp class RelocatedImageTest extends TestCase {
         raster.setSample(0, 1, 0, 3);
         raster.setSample(1, 1, 0, 4);
 
-        final RelocatedImage trs = new RelocatedImage(image, -1, -2, 4, 4);
+        final ReshapedImage trs = new ReshapedImage(image, -1, -2, 4, 4);
         assertEquals(1, trs.getMinX());
         assertEquals(2, trs.getMinY());
         assertValuesEqual(trs.getData(), 0, new int[][] {
diff --git a/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
b/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
index f7af982..e9a6f4c 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/test/suite/FeatureTestSuite.java
@@ -84,8 +84,8 @@ import org.junit.runners.Suite;
     org.apache.sis.coverage.grid.GridExtentTest.class,
     org.apache.sis.coverage.grid.GridGeometryTest.class,
     org.apache.sis.coverage.grid.GridDerivationTest.class,
-    org.apache.sis.coverage.grid.FractionalGridCoordinates.class,
-    org.apache.sis.coverage.grid.RelocatedImageTest.class,
+    org.apache.sis.coverage.grid.FractionalGridCoordinatesTest.class,
+    org.apache.sis.coverage.grid.ReshapedImageTest.class,
     org.apache.sis.coverage.grid.GridCoverage2DTest.class,
     org.apache.sis.internal.coverage.j2d.ImageUtilitiesTest.class,
     org.apache.sis.internal.coverage.j2d.ScaledColorSpaceTest.class,


Mime
View raw message