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 c6225542f4 Rename `GridCoverageResource.getResolutions()` as 
`getAvailableResolutions()`. Keep the old method as a deprecated method. This 
is for compatibility.
c6225542f4 is described below

commit c6225542f4fd15e630ba570f6e248b3b9291212f
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Mar 25 21:41:24 2026 +0100

    Rename `GridCoverageResource.getResolutions()` as 
`getAvailableResolutions()`.
    Keep the old method as a deprecated method. This is for compatibility.
---
 .../coverage/MultiResolutionCoverageLoader.java    | 10 +++++-----
 .../MultiResolutionCoverageLoaderTest.java         |  2 +-
 .../org/apache/sis/storage/CoverageSubset.java     |  4 ++--
 .../apache/sis/storage/GridCoverageResource.java   | 22 ++++++++++++++++++++--
 .../aggregate/BandAggregateGridResource.java       |  4 ++--
 .../aggregate/ConcatenatedGridResource.java        |  6 +++---
 .../sis/storage/base/GridResourceWrapper.java      |  4 ++--
 .../apache/sis/storage/image/SingleImageStore.java |  4 ++--
 .../storage/image/WritableSingleImageStore.java    |  4 ++--
 .../apache/sis/storage/tiling/TileReadEvent.java   |  4 ++--
 .../storage/tiling/TiledGridCoverageResource.java  | 12 ++++++------
 .../apache/sis/gui/coverage/CoverageCanvas.java    |  2 +-
 12 files changed, 48 insertions(+), 30 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/map/coverage/MultiResolutionCoverageLoader.java
 
b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/map/coverage/MultiResolutionCoverageLoader.java
index 3cb9209229..dff07b9262 100644
--- 
a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/map/coverage/MultiResolutionCoverageLoader.java
+++ 
b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/map/coverage/MultiResolutionCoverageLoader.java
@@ -43,7 +43,7 @@ import org.apache.sis.util.collection.BackingStoreException;
 
 /**
  * A helper class for reading {@link GridCoverage} instances at various 
resolutions.
- * The resolutions are inferred from {@link 
GridCoverageResource#getResolutions()},
+ * The resolutions are inferred from {@link 
GridCoverageResource#getAvailableResolutions()},
  * using default values if necessary. The objective CRS does not need to be 
the same
  * than the coverage CRS, in which case transformations are applied at the 
point in
  * the center of the display bounds.
@@ -86,8 +86,8 @@ public class MultiResolutionCoverageLoader {
 
     /**
      * Squares of resolution at each pyramid level, from coarsest (largest 
numbers) to finest (smaller numbers).
-     * This is same same order as {@link 
GridCoverageResource#getResolutions()}. For a given level, the array
-     * {@code resolutionSquared[level]} gives the squares of the resolution 
for each CRS dimension.
+     * This is same same order as {@link 
GridCoverageResource#getAvailableResolutions()}. For a given level,
+     * the array {@code resolutionSquared[level]} gives the squares of the 
resolution for each CRS dimension.
      */
     private final double[][] resolutionSquared;
 
@@ -127,7 +127,7 @@ public class MultiResolutionCoverageLoader {
         readRanges     = range;
         double[][] resolutions;
         try {
-            resolutions = resource.getResolutions().toArray(double[][]::new);
+            resolutions = 
resource.getAvailableResolutions().toArray(double[][]::new);
         } catch (BackingStoreException e) {
             throw e.unwrapOrRethrow(DataStoreException.class);
         }
@@ -251,7 +251,7 @@ dimensions: for (int j=0; j<tgtDim; j++) {
                 }
                 /*
                  * Cannot use `Arrays.binarySearch(…)` because elements are 
not guaranteed to be sorted.
-                 * Even if `GridCoverageResource.getResolutions()` contract 
said "coarsest to finest",
+                 * Even if `GridCoverageResource.getAvailableResolutions()` 
contract said "coarsest to finest",
                  * it may not be possible to respect this condition on all 
dimensions in same time.
                  * The main goal is to have a `level` value as high as 
possible while having a resolution
                  * equals or better than `sum`.
diff --git 
a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/map/coverage/MultiResolutionCoverageLoaderTest.java
 
b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/map/coverage/MultiResolutionCoverageLoaderTest.java
index 0ec37ee89b..ff1c284ff0 100644
--- 
a/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/map/coverage/MultiResolutionCoverageLoaderTest.java
+++ 
b/endorsed/src/org.apache.sis.portrayal/test/org/apache/sis/map/coverage/MultiResolutionCoverageLoaderTest.java
@@ -105,7 +105,7 @@ public final class MultiResolutionCoverageLoaderTest 
extends TestCase {
         }
 
         /** Returns the preferred resolutions in units of CRS axes. */
-        @Override public List<double[]> getResolutions() {
+        @Override public List<double[]> getAvailableResolutions() {
             return List.of(new double[] {8, 9, 5},
                            new double[] {4, 4, 3},
                            new double[] {2, 3, 1});
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/CoverageSubset.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/CoverageSubset.java
index 2544cc414e..d1be9768ed 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/CoverageSubset.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/CoverageSubset.java
@@ -141,8 +141,8 @@ final class CoverageSubset extends 
AbstractGridCoverageResource {
      * @throws DataStoreException if an error occurred while reading 
definitions from the underlying data store.
      */
     @Override
-    public List<double[]> getResolutions() throws DataStoreException {
-        List<double[]> resolutions = source.getResolutions();
+    public List<double[]> getAvailableResolutions() throws DataStoreException {
+        List<double[]> resolutions = source.getAvailableResolutions();
         if (reduction != null) try {
             resolutions = JDK16.toList(resolutions.stream()
                     .map((resolution) -> reduction.apply(new 
DirectPositionView.Double(resolution)).getCoordinates()));
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/GridCoverageResource.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/GridCoverageResource.java
index 88e2ef6be4..d76c8b2844 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/GridCoverageResource.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/GridCoverageResource.java
@@ -153,9 +153,9 @@ public interface GridCoverageResource extends DataSet {
      * @see GridGeometry#getResolution(boolean)
      * @see org.apache.sis.storage.tiling.TileMatrixSet#getTileMatrices()
      *
-     * @since 1.2
+     * @since 1.7
      */
-    default List<double[]> getResolutions() throws DataStoreException {
+    default List<double[]> getAvailableResolutions() throws DataStoreException 
{
         final GridGeometry gg = getGridGeometry();
         if (gg != null && gg.isDefined(GridGeometry.RESOLUTION)) {      // 
Should never be null but we are paranoiac.
             final double[] resolution = gg.getResolution(false);
@@ -166,6 +166,24 @@ public interface GridCoverageResource extends DataSet {
         return List.of();
     }
 
+    /**
+     * Returns the preferred resolutions ordered from finest to coarsest 
resolution.
+     *
+     * @return preferred resolutions for read operations in this data store, 
or an empty list if none.
+     * @throws DataStoreException if an error occurred while reading 
definitions from the underlying data store.
+     *
+     * @since 1.2
+     *
+     * @deprecated Replaced by {@link #getAvailableResolutions()} but with 
opposite order.
+     *             The new order is more conform to <abbr>OGC</abbr> 
specifications.
+     */
+    @Deprecated(since = "1.7", forRemoval = true)
+    default List<double[]> getResolutions() throws DataStoreException {
+        final var resolutions = new 
java.util.ArrayList<>(getAvailableResolutions());
+        java.util.Collections.reverse(resolutions);
+        return resolutions;
+    }
+
     /**
      * Requests a subset of the coverage.
      * The filtering can be applied in two aspects:
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/BandAggregateGridResource.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/BandAggregateGridResource.java
index df23c8c06c..5e465d0cdc 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/BandAggregateGridResource.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/BandAggregateGridResource.java
@@ -79,7 +79,7 @@ final class BandAggregateGridResource extends 
AggregatedResource implements Grid
      * Can be an empty array after computation.
      * Shall be read-only after computation.
      *
-     * @see #getResolutions()
+     * @see #getAvailableResolutions()
      */
     private double[][] resolutions;
 
@@ -310,7 +310,7 @@ final class BandAggregateGridResource extends 
AggregatedResource implements Grid
      * @throws DataStoreException if an error occurred while reading 
definitions from an underlying resource.
      */
     @Override
-    public List<double[]> getResolutions() throws DataStoreException {
+    public List<double[]> getAvailableResolutions() throws DataStoreException {
         synchronized (getSynchronizationLock()) {
             if (resolutions == null) {
                 resolutions = 
ConcatenatedGridResource.commonResolutions(sources);
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/ConcatenatedGridResource.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/ConcatenatedGridResource.java
index ab698f4b1c..3d5837f971 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/ConcatenatedGridResource.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/aggregate/ConcatenatedGridResource.java
@@ -109,7 +109,7 @@ final class ConcatenatedGridResource extends 
AggregatedResource implements GridC
      * The resolutions, or {@code null} if not yet computed. Can be an empty 
array after computation.
      * Shall be read-only after computation.
      *
-     * @see #getResolutions()
+     * @see #getAvailableResolutions()
      */
     private double[][] resolutions;
 
@@ -222,7 +222,7 @@ final class ConcatenatedGridResource extends 
AggregatedResource implements GridC
      * @throws DataStoreException if an error occurred while reading 
definitions from an underlying resource.
      */
     @Override
-    public List<double[]> getResolutions() throws DataStoreException {
+    public List<double[]> getAvailableResolutions() throws DataStoreException {
         synchronized (getSynchronizationLock()) {
             if (resolutions == null) {
                 final GridSlice[] slices = locator.slices;
@@ -248,7 +248,7 @@ final class ConcatenatedGridResource extends 
AggregatedResource implements GridC
         for (final GridCoverageResource slice : sources) {
             final double[][] sr;
             try {
-                sr = slice.getResolutions().toArray(double[][]::new);
+                sr = slice.getAvailableResolutions().toArray(double[][]::new);
             } catch (BackingStoreException e) {
                 throw e.unwrapOrRethrow(DataStoreException.class);
             }
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/GridResourceWrapper.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/GridResourceWrapper.java
index 0f3f6c8023..cf241a6336 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/GridResourceWrapper.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/GridResourceWrapper.java
@@ -163,8 +163,8 @@ public abstract class GridResourceWrapper implements 
GridCoverageResource {
      * @throws DataStoreException if an error occurred while reading 
definitions from the underlying data store.
      */
     @Override
-    public List<double[]> getResolutions() throws DataStoreException {
-        return source().getResolutions();
+    public List<double[]> getAvailableResolutions() throws DataStoreException {
+        return source().getAvailableResolutions();
     }
 
     /**
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/SingleImageStore.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/SingleImageStore.java
index db400d1b36..06a79a5b3f 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/SingleImageStore.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/SingleImageStore.java
@@ -107,8 +107,8 @@ final class SingleImageStore extends WorldFileStore 
implements GridCoverageResou
      * Returns the preferred resolutions (in units of CRS axes) for read 
operations in this data store.
      */
     @Override
-    public final List<double[]> getResolutions() throws DataStoreException {
-        return delegate().getResolutions();
+    public final List<double[]> getAvailableResolutions() throws 
DataStoreException {
+        return delegate().getAvailableResolutions();
     }
 
     /**
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableSingleImageStore.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableSingleImageStore.java
index d75f393d47..0975c56933 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableSingleImageStore.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/image/WritableSingleImageStore.java
@@ -102,8 +102,8 @@ final class WritableSingleImageStore extends WritableStore 
implements WritableGr
      * Returns the preferred resolutions (in units of CRS axes) for read 
operations in this data store.
      */
     @Override
-    public final List<double[]> getResolutions() throws DataStoreException {
-        return delegate().getResolutions();
+    public final List<double[]> getAvailableResolutions() throws 
DataStoreException {
+        return delegate().getAvailableResolutions();
     }
 
     /**
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileReadEvent.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileReadEvent.java
index c15f30b9b9..98a321382d 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileReadEvent.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TileReadEvent.java
@@ -168,8 +168,8 @@ public class TileReadEvent extends StoreEvent {
 
     /**
      * Returns the zero-based index of the pyramid level of the tile which is 
read.
-     * This is typically the index in the {@linkplain 
TiledGridCoverageResource#getResolutions() list
-     * of resource's resolution} where the values returned by {@link 
#getResolution()} can be found.
+     * This is typically the index in the {@linkplain 
TiledGridCoverageResource#getAvailableResolutions()
+     * list of resource's resolution} where the values returned by {@link 
#getResolution()} can be found.
      * The level with coarsest resolution (the overview) is the level 0.
      *
      * @return zero-based index of the pyramid level of the tile which is read.
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TiledGridCoverageResource.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TiledGridCoverageResource.java
index feb89429e5..833361beb1 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TiledGridCoverageResource.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/TiledGridCoverageResource.java
@@ -436,11 +436,11 @@ check:  if (dataType.isInteger()) {
      */
     @Override
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
-    public List<double[]> getResolutions() throws DataStoreException {
+    public List<double[]> getAvailableResolutions() throws DataStoreException {
         synchronized (getSynchronizationLock()) {
             final Pyramid pyramid = Containers.peekFirst(getPyramids());
             if (pyramid == null) {
-                return super.getResolutions();
+                return super.getAvailableResolutions();
             }
             return new ListOfUnknownSize<double[]>() {
                 /** Returns characteristics of this collection as a 
combination of {@code Spliterator} bits. */
@@ -1128,7 +1128,7 @@ check:  if (dataType.isInteger()) {
      * @return information about the tile matrix sets to create.
      * @throws DataStoreException if an error occurred while fetching 
information about the pyramid.
      *
-     * @see #getResolutions()
+     * @see #getAvailableResolutions()
      * @see #getTileMatrixSets()
      */
     protected List<Pyramid> getPyramids() throws DataStoreException {
@@ -1151,7 +1151,7 @@ check:  if (dataType.isInteger()) {
      * Coordinate Reference System (<abbr>CRS</abbr>).
      *
      * <p>Each pyramid can have an arbitrary number of levels.
-     * It is recommended to have one pyramid level for each {@linkplain 
#getResolutions() preferred resolutions}.
+     * It is recommended to have one pyramid level for each {@link 
#getAvailableResolutions() preferred resolutions}.
      * The pyramid levels must be sorted from coarsest resolution (at level 0) 
to finest resolution.</p>
      *
      * <p>The number of levels is unspecified because some data stores cannot 
provide this information in advance.
@@ -1243,13 +1243,13 @@ check:  if (dataType.isInteger()) {
          *
          * <p>If this method returns a non-null instance <var>r</var>, then 
the following condition should hold:
          * {@code r.getGridGeometry().getResolution(false)} should be equal, 
ignoring NaN values and rounding errors,
-         * to {@code getResolutions().get(level)}.</p>
+         * to {@code getAvailableResolutions().get(level)}.</p>
          *
          * @param  level  the pyramid level where 0 is the level with the 
coarsest resolution (the overview).
          * @return a resource for data at the specified pyramid level, or 
{@code null} if the given level is too high.
          * @throws DataStoreException if an error occurred while creating the 
resource.
          *
-         * @see #getResolutions()
+         * @see #getAvailableResolutions()
          */
         TiledGridCoverageResource forPyramidLevel(int level) throws 
DataStoreException;
 
diff --git 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
index 635cb296d6..9f9e94320b 100644
--- 
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ 
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -666,7 +666,7 @@ public class CoverageCanvas extends MapCanvasAWT {
                         } else try {
                             domain = resource.getGridGeometry();
                             ranges = resource.getSampleDimensions();
-                            scales = 
Containers.peekFirst(resource.getResolutions());
+                            scales = 
Containers.peekFirst(resource.getAvailableResolutions());
                         } catch (BackingStoreException e) {
                             throw e.unwrapOrRethrow(DataStoreException.class);
                         }

Reply via email to