This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-3.1 in repository https://gitbox.apache.org/repos/asf/sis.git
commit ff6542a3f7c116c3afb4db935c1385899da71971 Merge: 43241772b6 3e79841b4c Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Mon Apr 22 13:02:25 2024 +0200 Merge 'geoapi-4.0' into geoapi-3.1. .../apache/sis/io/wkt/GeodeticObjectParser.java | 5 ++- .../main/org/apache/sis/referencing/CommonCRS.java | 6 +++- .../sis/referencing/StandardDefinitions.java | 2 +- .../referencing/factory/GeodeticObjectFactory.java | 4 +-- .../apache/sis/referencing/internal/Legacy.java | 2 +- .../referencing/internal/VerticalDatumTypes.java | 39 +++++++++++++++++----- .../operation/CoordinateOperationRegistry.java | 2 +- .../privy/EllipsoidalHeightCombiner.java | 3 +- .../internal/VerticalDatumTypesTest.java | 12 +++++++ 9 files changed, 55 insertions(+), 20 deletions(-) diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java index d0f57b09ec,882f14cc30..0438435cad --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java @@@ -348,7 -347,7 +348,7 @@@ final class StandardDefinitions case 5103: name = "North American Vertical Datum 1988"; alias = "NAVD88"; break; default: throw new AssertionError(code); } - return new DefaultVerticalDatum(properties(code, name, alias, true), RealizationMethod.GEOID); - return new DefaultVerticalDatum(properties(code, name, alias, true), null); ++ return new DefaultVerticalDatum(properties(code, name, alias, true), (RealizationMethod) null); } /** diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java index d7ff9b2036,d1e2e82a46..11f58d1e6d --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/VerticalDatumTypes.java @@@ -109,13 -127,12 +128,13 @@@ public final class VerticalDatumTypes * Returns the legacy code for the datum type, or 2000 (other surface) if unknown. * This method is used for WKT 1 formatting. * - * @param method the realization method, or {@code null} if unknown. + * @param type the vertical datum type, or {@code null} if unknown. * @return the legacy code for the given datum type, or 0 if unknown. */ - public static int toLegacy(final RealizationMethod method) { - if (method != null) { - switch (method.name().toUpperCase(Locale.US)) { + @SuppressWarnings("deprecation") + public static int toLegacy(final VerticalDatumType type) { + if (type != null) { - switch (type.name()) { ++ switch (type.name().toUpperCase(Locale.US)) { case ORTHOMETRIC: return 2001; // CS_VD_Orthometric case ELLIPSOIDAL: return 2002; // CS_VD_Ellipsoidal case BAROMETRIC: return 2003; // CS_VD_AltitudeBarometric @@@ -130,18 -147,18 +149,19 @@@ * Returns the vertical datum type from a realization method. * If the given method cannot be mapped to a legacy type, then this method returns "other surface". * This is because the vertical datum type was a mandatory property in legacy OGC/ISO standards. + * This method is used for writing GML documents older than GML 3.2. * * @param method the realization method, or {@code null}. - * @return the vertical datum type name (never null). + * @return the vertical datum type (never null). */ - public static String toName(final RealizationMethod method) { - if (method == RealizationMethod.GEOID) return "geoidal"; - if (method == RealizationMethod.TIDAL) return "depth"; + @SuppressWarnings("deprecation") + public static VerticalDatumType fromMethod(final RealizationMethod method) { + if (method == RealizationMethod.GEOID) return VerticalDatumType.GEOIDAL; + if (method == RealizationMethod.TIDAL) return VerticalDatumType.DEPTH; if (method != null) { - return method.name().toLowerCase(Locale.US); + return VerticalDatumType.valueOf(method.name().toUpperCase(Locale.US)); } - return "other surface"; + return VerticalDatumType.OTHER_SURFACE; } /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/internal/VerticalDatumTypesTest.java index 98bc4ab01d,8e98da4827..2b846e8736 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/internal/VerticalDatumTypesTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/internal/VerticalDatumTypesTest.java @@@ -17,7 -17,7 +17,8 @@@ package org.apache.sis.referencing.internal; import org.opengis.referencing.datum.RealizationMethod; +import org.opengis.referencing.datum.VerticalDatumType; + import org.apache.sis.referencing.CommonCRS; import org.apache.sis.util.ArraysExt; // Test dependencies