sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/02: Implements GridEnvelope and GridCoordinates following resolution of https://github.com/opengeospatial/geoapi/issues/36
Date Tue, 30 Apr 2019 16:32:19 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

commit 24fcb0f8820f9ea2af2c5d44200f84bb4cc9a3ed
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Apr 30 18:22:48 2019 +0200

    Implements GridEnvelope and GridCoordinates following resolution of https://github.com/opengeospatial/geoapi/issues/36
---
 .../sis/coverage/grid/GridCoordinatesView.java     | 18 +++++++++--------
 .../org/apache/sis/coverage/grid/GridExtent.java   | 23 ++++++++++------------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridCoordinatesView.java
b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridCoordinatesView.java
index 3e68c4e..1e9dadd 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridCoordinatesView.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridCoordinatesView.java
@@ -17,6 +17,8 @@
 package org.apache.sis.coverage.grid;
 
 import java.util.Arrays;
+import org.opengis.coverage.grid.GridCoordinates;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 
 
@@ -24,16 +26,12 @@ import org.apache.sis.util.ArgumentChecks;
  * A view over the low or high grid envelope coordinates.
  * This is not a general-purpose grid coordinates since it assumes a {@link GridExtent} coordinates
layout.
  *
- * <div class="note"><b>Upcoming API generalization:</b>
- * this class may implement the {@code GridCoordinates} interface in a future Apache SIS
version.
- * This is pending <a href="https://github.com/opengeospatial/geoapi/issues/36">GeoAPI
update</a>.</div>
- *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.0
  * @since   1.0
  * @module
  */
-final class GridCoordinatesView /* implements GridCoordinates */ {
+final class GridCoordinatesView implements GridCoordinates {
     /**
      * A reference to the coordinate array of the enclosing grid envelope.
      */
@@ -56,6 +54,7 @@ final class GridCoordinatesView /* implements GridCoordinates */ {
     /**
      * Returns the number of dimension.
      */
+    @Override
     public final int getDimension() {
         return ordinates.length >>> 1;
     }
@@ -63,6 +62,7 @@ final class GridCoordinatesView /* implements GridCoordinates */ {
     /**
      * Returns all coordinate values.
      */
+    @Override
     public final long[] getCoordinateValues() {
         return Arrays.copyOfRange(ordinates, offset, offset + getDimension());
     }
@@ -70,6 +70,7 @@ final class GridCoordinatesView /* implements GridCoordinates */ {
     /**
      * Returns the coordinate value for the specified dimension.
      */
+    @Override
     public final long getCoordinateValue(final int index) {
         ArgumentChecks.ensureValidIndex(getDimension(), index);
         return ordinates[offset + index];
@@ -78,9 +79,10 @@ final class GridCoordinatesView /* implements GridCoordinates */ {
     /**
      * Do not allow modification of grid coordinates since they are backed by {@link GridExtent}.
      */
-//  public void setCoordinateValue(final int index, long value) {
-//      throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableObject_1,
"GridCoordinates"));
-//  }
+    @Override
+    public void setCoordinateValue(final int index, long value) {
+        throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableObject_1,
"GridCoordinates"));
+    }
 
     /**
      * Returns a string representation of this grid coordinates for debugging purpose.
diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index c441503..8cbd609 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -53,6 +53,7 @@ import org.apache.sis.util.iso.Types;
 
 // Branch-dependent imports
 import org.opengis.coverage.grid.GridEnvelope;
+import org.opengis.coverage.grid.GridCoordinates;
 import org.opengis.coverage.CannotEvaluateException;
 import org.opengis.coverage.PointOutsideCoverageException;
 
@@ -71,16 +72,12 @@ import org.opengis.coverage.PointOutsideCoverageException;
  * <p>{@code GridExtent} instances are immutable and thread-safe.
  * The same instance can be shared by different {@link GridGeometry} instances.</p>
  *
- * <div class="note"><b>Upcoming API generalization:</b>
- * this class may implement the {@code GridEnvelope} interface in a future Apache SIS version.
- * This is pending <a href="https://github.com/opengeospatial/geoapi/issues/36">GeoAPI
update</a>.</div>
- *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @version 1.0
  * @since   1.0
  * @module
  */
-public class GridExtent implements Serializable {
+public class GridExtent implements GridEnvelope, Serializable {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -509,6 +506,7 @@ public class GridExtent implements Serializable {
      *
      * @see #reduce(int...)
      */
+    @Override
     public final int getDimension() {
         return coordinates.length >>> 1;
     }
@@ -533,11 +531,9 @@ public class GridExtent implements Serializable {
      * The sequence contains a minimum value for each dimension of the grid coverage.
      *
      * @return the valid minimum grid coordinates, inclusive.
-     *
-     * @todo Pending resolution of <a href="https://github.com/opengeospatial/geoapi/issues/36">GeoAPI
update</a>
-     *       before to become public API, in order to use the interface in return type.
      */
-    GridCoordinatesView getLow() {
+    @Override
+    public GridCoordinates getLow() {
         return new GridCoordinatesView(coordinates, 0);
     }
 
@@ -546,11 +542,9 @@ public class GridExtent implements Serializable {
      * The sequence contains a maximum value for each dimension of the grid coverage.
      *
      * @return the valid maximum grid coordinates, <strong>inclusive</strong>.
-     *
-     * @todo Pending resolution of <a href="https://github.com/opengeospatial/geoapi/issues/36">GeoAPI
update</a>
-     *       before to become public API, in order to use the interface in return type.
      */
-    GridCoordinatesView getHigh() {
+    @Override
+    public GridCoordinates getHigh() {
         return new GridCoordinatesView(coordinates, getDimension());
     }
 
@@ -565,6 +559,7 @@ public class GridExtent implements Serializable {
      * @see #getLow()
      * @see #getHigh(int)
      */
+    @Override
     public long getLow(final int index) {
         ArgumentChecks.ensureValidIndex(getDimension(), index);
         return coordinates[index];
@@ -581,6 +576,7 @@ public class GridExtent implements Serializable {
      * @see #getHigh()
      * @see #getLow(int)
      */
+    @Override
     public long getHigh(final int index) {
         final int dimension = getDimension();
         ArgumentChecks.ensureValidIndex(dimension, index);
@@ -600,6 +596,7 @@ public class GridExtent implements Serializable {
      * @see #getLow(int)
      * @see #getHigh(int)
      */
+    @Override
     public long getSize(final int index) {
         final int dimension = getDimension();
         ArgumentChecks.ensureValidIndex(dimension, index);


Mime
View raw message