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 433c27f0fd Use shorter name in `TileMatrixSet` identifier. The 
identifier now hides the image identifier.
433c27f0fd is described below

commit 433c27f0fd50212c578f5fc4399a59b49dc3443f
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Mar 25 22:43:17 2026 +0100

    Use shorter name in `TileMatrixSet` identifier.
    The identifier now hides the image identifier.
---
 .../org/apache/sis/storage/geotiff/ReaderTest.java |  3 ++-
 .../apache/sis/storage/tiling/ImagePyramid.java    | 22 ++++++++++++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/ReaderTest.java
 
b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/ReaderTest.java
index af324c7db5..6addcc99eb 100644
--- 
a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/ReaderTest.java
+++ 
b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/ReaderTest.java
@@ -101,7 +101,8 @@ public class ReaderTest extends TestCase {
             assertTrue(matrices.subMap(matrices.firstKey(), 
matrices.lastKey()).isEmpty());
 
             final TileMatrix matrix = assertSingleton(matrices.values());
-            assertEquals("untiled:1:TMS:L0", 
matrix.getIdentifier().toString());
+            assertEquals("untiled:1:TMS:L0", 
matrix.getIdentifier().toFullyQualifiedName().toString());
+            assertEquals("TMS:L0", matrix.getIdentifier().toString());
             assertEquals(assertSingleton(matrices.keySet()), 
matrix.getIdentifier());
             assertArrayEquals(resource.getGridGeometry().getResolution(false), 
matrix.getResolution());
             assertSame(TileStatus.OUTSIDE_EXTENT, matrix.getTileStatus(1, 0));
diff --git 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/ImagePyramid.java
 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/ImagePyramid.java
index 740323171c..87f867e194 100644
--- 
a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/ImagePyramid.java
+++ 
b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/tiling/ImagePyramid.java
@@ -163,7 +163,7 @@ final class ImagePyramid extends AbstractMap<GenericName, 
ImageTileMatrix>
                 upperMatrixIndex = level;
                 return null;
             }
-            GenericName id = Names.createScopedName(identifier, null, 
provider.identifierOfLevel(level));
+            GenericName id = Names.createScopedName(identifier.tip(), null, 
provider.identifierOfLevel(level));
             tm = new ImageTileMatrix(id, resource, processor);
         } catch (DataStoreException | TransformException e) {
             throw new BackingStoreException(e);
@@ -187,7 +187,7 @@ final class ImagePyramid extends AbstractMap<GenericName, 
ImageTileMatrix>
      */
     private int indexOf(final GenericName name, final boolean required) {
         final LocalName tip = name.tip();
-        if (tip.scope().name().equals(identifier)) {
+        if (endsWith(identifier.getParsedNames(), 
tip.scope().name().toFullyQualifiedName().getParsedNames())) {
             final int level;
             try {
                 level = provider.levelOfIdentifier(tip.toString());
@@ -208,6 +208,24 @@ final class ImagePyramid extends AbstractMap<GenericName, 
ImageTileMatrix>
         return -1;
     }
 
+    /**
+     * Returns whether the given name ends with the expected values.
+     * If one list is longer than the other, the extra elements are ignored.
+     * The comparison is case-insensitive.
+     *
+     * @param  expected  the expected path.
+     * @param  name      the actual name to test.
+     * @return whether {@code name} ends with {@code expected}.
+     */
+    private static boolean endsWith(final List<? extends LocalName> expected, 
final List<? extends LocalName> name) {
+        for (int i = expected.size(), j = name.size(); (--i | --j) >= 0;) {
+            if 
(!expected.get(i).toString().equalsIgnoreCase(name.get(j).toString())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     /**
      * Compares two generic names for order based on the resolution of the 
associated tile matrix.
      * If a call to {@code compare(o1, o2)}, the comparator returns a positive 
number if {@code o1}

Reply via email to