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
The following commit(s) were added to refs/heads/geoapi-3.1 by this push:
new ae75ef285f Add implementation for deprecated GeoAPI 3.1 methods that
have been removed in GeoAPI 4.0.
ae75ef285f is described below
commit ae75ef285fa3a96b7f7e05e76a4c448fb29854bb
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Mon Jul 21 15:47:08 2025 +0200
Add implementation for deprecated GeoAPI 3.1 methods that have been removed
in GeoAPI 4.0.
---
.../referencing/datum/DefaultDatumEnsemble.java | 102 +++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultDatumEnsemble.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultDatumEnsemble.java
index 1dfbebbb57..8dcd01ede9 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultDatumEnsemble.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultDatumEnsemble.java
@@ -53,6 +53,8 @@ import org.apache.sis.util.resources.Errors;
// Specific to the main and geoapi-3.1 branches:
import java.util.Date;
+import org.opengis.metadata.extent.Extent;
+import org.opengis.referencing.datum.VerticalDatumType;
// Specific to the geoapi-3.1 and geoapi-4.0 branches:
import org.opengis.referencing.crs.ParametricCRS;
@@ -331,6 +333,21 @@ public class DefaultDatumEnsemble<D extends Datum> extends
AbstractIdentifiedObj
return getCommonOptionalValue(Datum::getAnchorDefinition);
}
+ /**
+ * Returns an anchor point which is common to all members of the datum
ensemble.
+ * If the value is not the same for all members, or if at least one member
returned
+ * null, then this method returns null.
+ *
+ * @return the common anchor point, or null if there is no common value.
+ *
+ * @deprecated Renamed {@link #getAnchorDefinition()} for conformance with
ISO 19111:2019 revision.
+ */
+ @Override
+ @Deprecated
+ public InternationalString getAnchorPoint() {
+ return getCommonValue(Datum::getAnchorPoint);
+ }
+
/**
* Returns an anchor epoch which is common to all members of the datum
ensemble.
* If the value is not the same for all members, or if at least one member
returned
@@ -343,6 +360,21 @@ public class DefaultDatumEnsemble<D extends Datum> extends
AbstractIdentifiedObj
return getCommonOptionalValue(Datum::getAnchorEpoch);
}
+ /**
+ * Returns a realization epoch which is common to all members of the datum
ensemble.
+ * If the value is not the same for all members, or if at least one member
returned
+ * null, then this method returns null.
+ *
+ * @return the common realization epoch, null if there is no common value.
+ *
+ * @deprecated Renamed {@link #getAnchorEpoch()} for conformance with ISO
19111:2019 revision.
+ */
+ @Override
+ @Deprecated
+ public Date getRealizationEpoch() {
+ return getCommonValue(Datum::getRealizationEpoch);
+ }
+
/**
* Returns a publication date which is common to all members of the datum
ensemble.
* If the value is not the same for all members, or if at least one member
returned
@@ -355,6 +387,34 @@ public class DefaultDatumEnsemble<D extends Datum> extends
AbstractIdentifiedObj
return getCommonOptionalValue(Datum::getPublicationDate);
}
+ /**
+ * Returns a domain of validity which is common to all members of the
datum ensemble.
+ * If the value is not the same for all members, or if at least one member
returned
+ * null, then this method returns null.
+ *
+ * @return the common domain of validity, or null if there is no common
value.
+ *
+ * @deprecated Replaced by {@link #getDomains()} as of ISO 19111:2019.
+ */
+ @Override
+ public Extent getDomainOfValidity() {
+ return getCommonValue(Datum::getDomainOfValidity);
+ }
+
+ /**
+ * Returns a scope which is common to all members of the datum ensemble.
+ * If the value is not the same for all members, or if at least one member
returned
+ * null, then this method returns null.
+ *
+ * @return the common scope, or null if there is no common value.
+ *
+ * @deprecated Replaced by {@link #getDomains()} as of ISO 19111:2019.
+ */
+ @Override
+ public InternationalString getScope() {
+ return getCommonValue(Datum::getScope);
+ }
+
/**
* Returns a conventional reference system which is common to all members
of the datum ensemble.
* The returned value should never be empty, because it is illegal for a
datum ensemble to have
@@ -368,6 +428,33 @@ public class DefaultDatumEnsemble<D extends Datum> extends
AbstractIdentifiedObj
return getCommonOptionalValue(Datum::getConventionalRS);
}
+ /**
+ * Returns a value which is common to all ensemble members.
+ * If all members do not have the same value, returns null.
+ *
+ * @param <V> type of value.
+ * @param getter method to invoke on each member for getting the value.
+ * @return a value common to all members, or null if there is no common
value.
+ *
+ * @deprecated For implementation of deprecated methods only.
+ */
+ @Deprecated
+ final <V> V getCommonValue(final Function<D,V> getter) {
+ final Iterator<D> it = members.iterator();
+check: if (it.hasNext()) {
+ final V value = getter.apply(it.next());
+ if (value != null) {
+ while (it.hasNext()) {
+ if (!value.equals(getter.apply(it.next()))) {
+ break check;
+ }
+ }
+ return value;
+ }
+ }
+ return null;
+ }
+
/**
* Returns an optional value which is common to all ensemble members.
* If all members do not have the same value, returns an empty value.
@@ -571,6 +658,21 @@ check: if (it.hasNext()) {
public Optional<RealizationMethod> getRealizationMethod() {
return getCommonOptionalValue(VerticalDatum::getRealizationMethod);
}
+
+ /**
+ * Returns a vertical datum type which is common to all members of the
datum ensemble.
+ * If the value is not the same for all members, or if at least one
member has a null value,
+ * then this method returns null.
+ *
+ * @return the common realization method, or null if there is no
common value.
+ *
+ * @deprecated Replaced by {@link #getRealizationMethod()}.
+ */
+ @Override
+ @Deprecated
+ public VerticalDatumType getVerticalDatumType() {
+ return getCommonValue(VerticalDatum::getVerticalDatumType);
+ }
}
/**