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 47d67c936cbb0521c5978d49d6091c0d9e3e1ec2 Author: Martin Desruisseaux <[email protected]> AuthorDate: Tue Dec 2 17:15:00 2025 +0100 Support the legacy way to define a CRS and "grid to CRS" transform in GeoHEIF files. This legacy encoding should not be used anymore, but some data are still using it. --- .../sis/storage/isobmff/MainBoxRegistry.java | 18 ++++++++++++++++ .../apache/sis/storage/isobmff/gimi/ModelCRS.java | 24 ++++++++++++++++++++++ .../sis/storage/isobmff/gimi/ModelTiePoint.java | 24 ++++++++++++++++++++++ .../storage/isobmff/gimi/ModelTransformation.java | 24 ++++++++++++++++++++++ .../sis/storage/isobmff/gimi/ExtensionTest.java | 5 +++++ 5 files changed, 95 insertions(+) diff --git a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java index e49e9bdf4a..b1a1a821d3 100644 --- a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java +++ b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/MainBoxRegistry.java @@ -170,6 +170,24 @@ final class MainBoxRegistry extends BoxRegistry { @Override public Box create(final Reader reader, final UUID extension) throws IOException, DataStoreException { switch ((int) extension.getMostSignificantBits()) { + case (int) ModelCRS.UUID_HIGH_BITS: { + if (extension.equals(ModelCRS.EXTENDED_TYPE)) { + return new ModelCRS(reader); + } + break; + } + case (int) ModelTiePoint.UUID_HIGH_BITS: { + if (extension.equals(ModelTiePoint.EXTENDED_TYPE)) { + return new ModelTiePoint(reader); + } + break; + } + case (int) ModelTransformation.UUID_HIGH_BITS: { + if (extension.equals(ModelTransformation.EXTENDED_TYPE)) { + return new ModelTransformation(reader); + } + break; + } case (int) UnknownProperty.UUID_HIGH_BITS: { if (extension.equals(UnknownProperty.EXTENDED_TYPE)) { return new UnknownProperty(reader); diff --git a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java index 1ba9bae0c0..42670c2f58 100644 --- a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java +++ b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelCRS.java @@ -16,6 +16,7 @@ */ package org.apache.sis.storage.isobmff.gimi; +import java.util.UUID; import java.io.IOException; import org.opengis.util.FactoryException; import org.opengis.referencing.crs.CoordinateReferenceSystem; @@ -48,6 +49,29 @@ public final class ModelCRS extends FullBox { return BOXTYPE; } + /** + * The most significant bits of the <abbr>UUID</abbr> as a long integer. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final long UUID_HIGH_BITS = 0x137a1742_75ac_4747L; + + /** + * The <abbr>UUID</abbr> that identify this extension. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final UUID EXTENDED_TYPE = new UUID(UUID_HIGH_BITS, 0x82bc_659576e8675bL); + + /** + * Returns the identifier of this extension. + * This value is fixed to {@link #EXTENDED_TYPE}. + */ + @Override + public final UUID extendedType() { + return EXTENDED_TYPE; + } + /** * Possible values for {@link #crsEncoding}. */ diff --git a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTiePoint.java b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTiePoint.java index 9b57864f8f..f845bd4ca4 100644 --- a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTiePoint.java +++ b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTiePoint.java @@ -16,6 +16,7 @@ */ package org.apache.sis.storage.isobmff.gimi; +import java.util.UUID; import java.io.IOException; import org.apache.sis.io.stream.ChannelDataInput; import org.apache.sis.storage.isobmff.FullBox; @@ -45,6 +46,29 @@ public final class ModelTiePoint extends FullBox { return BOXTYPE; } + /** + * The most significant bits of the <abbr>UUID</abbr> as a long integer. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final long UUID_HIGH_BITS = 0xc683364f_d6a4_48b8L; + + /** + * The <abbr>UUID</abbr> that identify this extension. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final UUID EXTENDED_TYPE = new UUID(UUID_HIGH_BITS, 0xa76b_17a30af40c10L); + + /** + * Returns the identifier of this extension. + * This value is fixed to {@link #EXTENDED_TYPE}. + */ + @Override + public final UUID extendedType() { + return EXTENDED_TYPE; + } + /** * Pixel coordinates and corresponding "real world" coordinates for a single point. */ diff --git a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTransformation.java b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTransformation.java index bfb6f2d9e1..37120cb26b 100644 --- a/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTransformation.java +++ b/incubator/src/org.apache.sis.storage.geoheif/main/org/apache/sis/storage/isobmff/gimi/ModelTransformation.java @@ -16,6 +16,7 @@ */ package org.apache.sis.storage.isobmff.gimi; +import java.util.UUID; import java.io.IOException; import org.opengis.referencing.operation.MathTransform; import org.apache.sis.referencing.operation.matrix.Matrices; @@ -48,6 +49,29 @@ public final class ModelTransformation extends FullBox { return BOXTYPE; } + /** + * The most significant bits of the <abbr>UUID</abbr> as a long integer. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final long UUID_HIGH_BITS = 0x763cf838_b630_440bL; + + /** + * The <abbr>UUID</abbr> that identify this extension. + * It was used in an older version of the <abbr>GIMI</abbr> specification. + * Should not be used anymore, but nevertheless kept for compatibility. + */ + public static final UUID EXTENDED_TYPE = new UUID(UUID_HIGH_BITS, 0x84f8_be44bf9910afL); + + /** + * Returns the identifier of this extension. + * This value is fixed to {@link #EXTENDED_TYPE}. + */ + @Override + public final UUID extendedType() { + return EXTENDED_TYPE; + } + /** * The matrix coefficients as an array of 6 or 12 elements, for the 2D and 3D case respectively. */ diff --git a/incubator/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/isobmff/gimi/ExtensionTest.java b/incubator/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/isobmff/gimi/ExtensionTest.java index dab54f2f72..4228c6b848 100644 --- a/incubator/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/isobmff/gimi/ExtensionTest.java +++ b/incubator/src/org.apache.sis.storage.geoheif/test/org/apache/sis/storage/isobmff/gimi/ExtensionTest.java @@ -37,9 +37,14 @@ public final class ExtensionTest { /** * Verifies the <abbr>UUID</abbr> declared in extensions. + * Some identifiers were defined in previous <abbr>GIMI</abbr> versions + * and are supported by <abbr>SIS</abbr> for compatibility reasons. */ @Test public void verifyUUIDs() { assertEquals(UUID.fromString("4a66efa7-e541-526c-9427-9e77617feb7d"), UnknownProperty.EXTENDED_TYPE); + assertEquals(UUID.fromString("137a1742-75ac-4747-82bc-659576e8675b"), ModelCRS.EXTENDED_TYPE); + assertEquals(UUID.fromString("c683364f-d6a4-48b8-a76b-17a30af40c10"), ModelTiePoint.EXTENDED_TYPE); + assertEquals(UUID.fromString("763cf838-b630-440b-84f8-be44bf9910af"), ModelTransformation.EXTENDED_TYPE); } }
