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 cfb0e166e291a96049faff4cb9a9d1c7230f8786 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Apr 5 16:37:00 2024 +0200 Post-merge cleanup. The `DefaultGeocentricCRS` class and its factory methods are marked as deprecated since 2.0 instead of 1.5 because we will not deprecate that class in the branch that depends on GeoAPI 3.0, because there is no replacement. The replacements will need to wait for GeoAPI 3.1. --- .../main/org/apache/sis/util/iso/Types.java | 4 ++-- .../apache/sis/metadata/PropertyAccessorTest.java | 2 +- .../main/org/apache/sis/referencing/CRS.java | 20 ++++++++++++++------ .../sis/referencing/crs/DefaultGeocentricCRS.java | 2 +- .../factory/ConcurrentAuthorityFactory.java | 2 +- .../factory/GeodeticAuthorityFactory.java | 2 +- .../referencing/factory/GeodeticObjectFactory.java | 10 +++++----- .../referencing/factory/MultiAuthoritiesFactory.java | 2 +- .../referencing/internal/EPSGFactoryProxyCRS.java | 2 +- .../apache/sis/referencing/internal/Resources.java | 5 +++++ .../sis/referencing/internal/Resources.properties | 1 + .../sis/referencing/internal/Resources_fr.properties | 1 + .../operation/AbstractCoordinateOperation.java | 2 +- .../operation/TransformedCoordinateSet.java | 2 +- .../referencing/factory/AuthorityFactoryMock.java | 3 +++ .../operation/provider/ProvidersTest.java | 1 - 16 files changed, 39 insertions(+), 22 deletions(-) diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/Types.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/Types.java index af97040987..fabfd4b0d5 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/Types.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/util/iso/Types.java @@ -506,8 +506,8 @@ public final class Types extends Static { * The package prefix (e.g. {@code "CI_"} in {@code "CI_Citation"}) can be omitted. * The flexibility is provided for allowing transition to newer ISO standards, * which are dropping the package prefixes. - * For example, {@code "AxisDirection"} in ISO 19111:2007 - * has been renamed {@code "AxisDirection"} in ISO 19111:2018. + * For example, {@code "CS_AxisDirection"} in ISO 19111:2007 + * has been renamed {@code "AxisDirection"} in ISO 19111:2019. * * <p>Only identifiers for the stable part of GeoAPI or for some Apache SIS classes are recognized. * This method does not handle the identifiers for interfaces in the {@code geoapi-pending} module.</p> diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java index c54740d362..22c99e5890 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/PropertyAccessorTest.java @@ -64,12 +64,12 @@ import static org.apache.sis.metadata.Assertions.assertTitleEquals; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.metadata.content.AttributeGroup; +import org.opengis.referencing.datum.DatumEnsemble; import org.opengis.referencing.ObjectDomain; import org.opengis.temporal.Duration; // Specific to the geoapi-4.0 branch: import org.opengis.metadata.citation.Responsibility; -import org.opengis.referencing.datum.DatumEnsemble; /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java index 502d5a95ec..3e50020cb0 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/CRS.java @@ -958,30 +958,38 @@ public final class CRS extends Static { /** * Returns the epoch to which the coordinates of stations defining the dynamic CRS are referenced. - * If the CRS is associated to a {@linkplain DynamicReferenceFrame dynamic datum}, then reference - * epoch of that datum is returned. Otherwise if the CRS is {@linkplain CompoundCRS compound}, - * then the first reference epoch found in a component is returned. + * If the CRS is associated to a {@linkplain DynamicReferenceFrame dynamic datum}, then the epoch + * of that datum is returned. Otherwise if the CRS is {@linkplain CompoundCRS compound}, then this + * method requires that all dynamic components have the same epoch. * * @param crs the coordinate reference frame from which to get the epoch, or {@code null}. * @return epoch to which the coordinates of stations defining the dynamic CRS frame are referenced. + * @throws GeodeticException if some CRS components haave different epochs. * * @since 1.5 */ public static Optional<Temporal> getFrameReferenceEpoch(final CoordinateReferenceSystem crs) { + Temporal epoch = null; if (crs instanceof SingleCRS) { final Datum datum = ((SingleCRS) crs).getDatum(); if (datum instanceof DynamicReferenceFrame) { - return Optional.of(((DynamicReferenceFrame) datum).getFrameReferenceEpoch()); + epoch = ((DynamicReferenceFrame) datum).getFrameReferenceEpoch(); } } else if (crs instanceof CompoundCRS) { for (SingleCRS component : ((CompoundCRS) crs).getSingleComponents()) { final Datum datum = component.getDatum(); if (datum instanceof DynamicReferenceFrame) { - return Optional.of(((DynamicReferenceFrame) datum).getFrameReferenceEpoch()); + final Temporal t = ((DynamicReferenceFrame) datum).getFrameReferenceEpoch(); + if (t != null) { + if (epoch == null) epoch = t; + else if (!epoch.equals(t)) { + throw new GeodeticException(Resources.format(Resources.Keys.InconsistentEpochs_2, epoch, t)); + } + } } } } - return Optional.empty(); + return Optional.ofNullable(epoch); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java index fd38c79180..e8cb41b856 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java @@ -79,7 +79,7 @@ import org.apache.sis.io.wkt.Formatter; * @since 0.4 */ @XmlTransient -@Deprecated(since = "1.5") +@Deprecated(since = "2.0") public class DefaultGeocentricCRS extends DefaultGeodeticCRS implements GeocentricCRS { /** * Serial number for inter-operability with different versions. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java index f32cffccf1..d298156a52 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java @@ -942,7 +942,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa * The {@code GeodeticCRS} parent class should be used instead. */ @Override - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(final String code) throws FactoryException { if (isDefault(GeocentricCRS.class)) { return super.createGeocentricCRS(code); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java index 981f93e539..45f6fa8d79 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java @@ -338,7 +338,7 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * @deprecated ISO 19111:2019 does not define an explicit class for geocentric CRS. * The {@code GeodeticCRS} parent class should be used instead. */ - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { return cast(GeocentricCRS.class, createCoordinateReferenceSystem(code), code); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticObjectFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticObjectFactory.java index 2778ac1f24..b3079f115b 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticObjectFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/GeodeticObjectFactory.java @@ -146,9 +146,9 @@ import org.apache.sis.xml.XML; * <td>{@link InternationalString} or {@link String}</td> * <td>{@link AbstractDatum#getAnchorDefinition()}</td> * </tr><tr> - * <td>{@value org.opengis.referencing.datum.Datum#ANCHOR_EPOCH_KEY}</td> - * <td>{@link java.time.temporal.Temporal}</td> - * <td>{@link AbstractDatum#getAnchorEpoch()}</td> + * <td>{@value org.opengis.referencing.datum.Datum#ANCHOR_EPOCH_KEY}</td> + * <td>{@link java.time.temporal.Temporal}</td> + * <td>{@link AbstractDatum#getAnchorEpoch()}</td> * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td> * <td>{@link InternationalString} or {@link String}</td> @@ -355,7 +355,7 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory * The {@code GeodeticCRS} parent class should be used instead. */ @Override - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(final Map<String,?> properties, final GeodeticDatum datum, final CartesianCS cs) throws FactoryException { @@ -437,7 +437,7 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory * The {@code GeodeticCRS} parent class should be used instead. */ @Override - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(final Map<String,?> properties, final GeodeticDatum datum, final SphericalCS cs) throws FactoryException { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java index ca2bcea3de..2e9feec087 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java @@ -961,7 +961,7 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements * The {@code GeodeticCRS} parent class should be used instead. */ @Override - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(final String code) throws FactoryException { return create(AuthorityFactoryProxy.GEOCENTRIC_CRS, code); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyCRS.java index 1dd3734765..0f6ca0aa37 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyCRS.java @@ -80,7 +80,7 @@ public final class EPSGFactoryProxyCRS extends EPSGFactoryProxy implements CRSAu } @Override - @Deprecated(since = "1.5") + @Deprecated(since = "2.0") public GeocentricCRS createGeocentricCRS(String code) throws FactoryException { return factory().createGeocentricCRS(code); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java index 42b7fba5e3..36bf379eae 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java @@ -309,6 +309,11 @@ public class Resources extends IndexedResourceBundle { */ public static final short IncompatibleDatum_2 = 28; + /** + * All dynamic components should have the same epoch, but found “{0}” and “{1}”. + */ + public static final short InconsistentEpochs_2 = 103; + /** * Inverse operation uses this parameter value with opposite sign. */ diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties index ef5ddb5941..5336e2c8a4 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties @@ -87,6 +87,7 @@ IllegalParameterValueClass_3 = Parameter \u201c{0}\u201d does not accept va IllegalUnitFor_2 = Unit of measurement \u201c{1}\u201d is not valid for \u201c{0}\u201d values. IncompatibleCoordinateSystemTypes = Incompatible coordinate system types. IncompatibleDatum_2 = Datum of \u201c{1}\u201d shall be \u201c{0}\u201d. +InconsistentEpochs_2 = All dynamic components should have the same epoch, but found \u201c{0}\u201d and \u201c{1}\u201d. LatitudesAreOpposite_2 = Latitudes {0} and {1} are opposite. MismatchedParameterDescriptor_1 = Mismatched descriptor for \u201c{0}\u201d parameter. MismatchedPrimeMeridian_2 = Expected the \u201c{0}\u201d prime meridian but found \u201c{1}\u201d. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties index 792b7d048b..ccbfa111b4 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties @@ -92,6 +92,7 @@ IllegalParameterValueClass_3 = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00b IllegalUnitFor_2 = L\u2019unit\u00e9 de mesure \u00ab\u202f{1}\u202f\u00bb n\u2019est pas valide pour les valeurs de \u00ab\u202f{0}\u202f\u00bb. IncompatibleCoordinateSystemTypes = Types de syst\u00e8mes de coordonn\u00e9es incompatibles. IncompatibleDatum_2 = Le r\u00e9f\u00e9rentiel de \u00ab\u202f{1}\u202f\u00bb doit \u00eatre \u00ab\u202f{0}\u202f\u00bb. +InconsistentEpochs_2 = Toutes les composantes dynamiques devraient avoir la m\u00eame \u00e9poque de r\u00e9f\u00e9rence, mais on a trouv\u00e9 \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb. LatitudesAreOpposite_2 = Les latitudes {0} et {1} sont oppos\u00e9es. MismatchedParameterDescriptor_1 = Le descripteur du param\u00e8tre \u00ab\u202f{0}\u202f\u00bb ne correspond pas. MismatchedPrimeMeridian_2 = Le m\u00e9ridien d\u2019origine \u00ab\u202f{0}\u202f\u00bb \u00e9tait attendu, mais \u00ab\u202f{1}\u202f\u00bb a \u00e9t\u00e9 trouv\u00e9. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java index 3c6683a62b..43f6c32c02 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java @@ -42,6 +42,7 @@ import org.opengis.referencing.operation.CoordinateOperation; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.PassThroughOperation; +import org.opengis.referencing.operation.TransformException; import org.opengis.parameter.GeneralParameterValue; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; @@ -76,7 +77,6 @@ import static org.apache.sis.util.Utilities.deepEquals; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.coordinate.CoordinateSet; -import org.opengis.referencing.operation.TransformException; /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/TransformedCoordinateSet.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/TransformedCoordinateSet.java index e998216d16..373f089828 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/TransformedCoordinateSet.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/TransformedCoordinateSet.java @@ -82,7 +82,7 @@ final class TransformedCoordinateSet extends AbstractCoordinateSet implements Un final CoordinateMetadata metadata = data.getCoordinateMetadata(); if (metadata != null) try { GeographicBoundingBox aoi = CRS.getGeographicBoundingBox(op); - CoordinateMetadata step = new DefaultCoordinateMetadata(op.getSourceCRS(), op.getSourceEpoch().orElse(null)); + final var step = new DefaultCoordinateMetadata(op.getSourceCRS(), op.getSourceEpoch().orElse(null)); transform = MathTransforms.concatenate(CRS.findOperation(metadata, step, aoi).getMathTransform(), transform); } catch (FactoryException | MismatchedDimensionException e) { throw new TransformException(e.getMessage(), e); diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/AuthorityFactoryMock.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/AuthorityFactoryMock.java index eb3a284b6b..010e8db29d 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/AuthorityFactoryMock.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/AuthorityFactoryMock.java @@ -103,6 +103,9 @@ public final class AuthorityFactoryMock extends GeodeticAuthorityFactory impleme /** * Returns the authority codes for the given type. + * + * @param type the type of referencing object for which to get authority codes. + * @return the set of authority codes for referencing objects of the given type. */ @Override @SuppressWarnings("deprecation") diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java index 581667a272..5bd7bc567f 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/ProvidersTest.java @@ -42,7 +42,6 @@ public final class ProvidersTest extends TestCase { /** * Returns all providers to test. */ - @SuppressWarnings("deprecation") private static Class<?>[] methods() { return new Class<?>[] { Affine.class,