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 c39f9ef2560e2a003f0801b602fb126cb06f3e49 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Apr 5 19:18:04 2024 +0200 Update for the removal of deprecated ImageDatum, ImageCRS and UserDefinedCS interfaces. Those interfaces were defined in ISO 19111:2007 but removed in ISO 19111:2019. --- .../org/apache/sis/buildtools/book/GEOAPI.lst | 3 - .../org/apache/sis/buildtools/book/OGC.lst | 2 - .../sis/openoffice/ReferencingFunctions.java | 11 +- .../main/org/apache/sis/io/wkt/Convention.java | 7 +- .../apache/sis/io/wkt/GeodeticObjectParser.java | 27 ++--- .../apache/sis/referencing/crs/AbstractCRS.java | 3 +- .../sis/referencing/crs/DefaultEngineeringCRS.java | 12 +- .../sis/referencing/crs/DefaultImageCRS.java | 71 ++--------- .../org/apache/sis/referencing/crs/SubTypes.java | 4 - .../org/apache/sis/referencing/cs/AbstractCS.java | 5 +- .../sis/referencing/cs/DefaultUserDefinedCS.java | 51 +------- .../org/apache/sis/referencing/cs/SubTypes.java | 5 - .../sis/referencing/datum/AbstractDatum.java | 5 +- .../sis/referencing/datum/DefaultImageDatum.java | 68 +---------- .../org/apache/sis/referencing/datum/SubTypes.java | 4 - .../referencing/factory/AuthorityFactoryProxy.java | 32 ++--- .../factory/ConcurrentAuthorityFactory.java | 54 --------- .../factory/GeodeticAuthorityFactory.java | 50 -------- .../referencing/factory/GeodeticObjectFactory.java | 133 +-------------------- .../factory/MultiAuthoritiesFactory.java | 45 ------- .../sis/referencing/internal/EPSGFactoryProxy.java | 6 - .../referencing/internal/EPSGFactoryProxyCRS.java | 7 -- .../internal/EPSGFactoryProxyDatum.java | 7 -- .../referencing/operation/SubOperationInfo.java | 6 +- .../sis/xml/bind/referencing/CD_ImageDatum.java | 14 +-- .../sis/xml/bind/referencing/CS_UserDefinedCS.java | 14 +-- .../sis/referencing/AuthorityFactoriesTest.java | 3 +- geoapi/snapshot | 2 +- 28 files changed, 80 insertions(+), 571 deletions(-) diff --git a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/GEOAPI.lst b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/GEOAPI.lst index fa371b7c86..98b792e99c 100644 --- a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/GEOAPI.lst +++ b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/GEOAPI.lst @@ -101,8 +101,6 @@ GriddedDataPositionalAccuracy Identification IdentifiedObject Identifier -ImageCRS -ImageDatum ImageDescription ImagingCondition Individual @@ -223,7 +221,6 @@ Trigger UML Usability Usage -UserDefinedCS ValidatorContainer Validators VectorSpatialRepresentation diff --git a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst index 771ccac556..7cc85d7506 100644 --- a/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst +++ b/buildSrc/src/main/resources/org/apache/sis/buildtools/book/OGC.lst @@ -17,7 +17,6 @@ CD_Datum CD_Ellipsoid CD_EngineeringDatum CD_GeodeticDatum -CD_ImageDatum CD_PixelInCell CD_PrimeMeridian CD_TemporalDatum @@ -53,7 +52,6 @@ CS_PolarCS CS_RangeMeaning CS_SphericalCS CS_TimeCS -CS_UserDefinedCS CS_VerticalCS CV_ContinuousCoverage CV_Coverage diff --git a/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java b/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java index 2701a8bf28..2fbfc7b4d3 100644 --- a/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java +++ b/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java @@ -45,6 +45,10 @@ import org.apache.sis.storage.base.CodeType; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.referencing.ObjectDomain; +// Specific to the geoapi-4.0 branch: +import org.opengis.referencing.crs.CRSAuthorityFactory; +import org.apache.sis.referencing.factory.GeodeticAuthorityFactory; + /** * Implements the {@link XReferencing} methods to make available to Apache OpenOffice. @@ -120,7 +124,12 @@ public class ReferencingFunctions extends CalcAddins implements XReferencing { type = CodeType.guess(codeOrPath); } if (type.equals(CodeType.URN)) { - object = CRS.getAuthorityFactory(null).createObject(codeOrPath); + CRSAuthorityFactory factory = CRS.getAuthorityFactory(null); + if (factory instanceof GeodeticAuthorityFactory) { + object = ((GeodeticAuthorityFactory) factory).createObject(codeOrPath); + } else { + object = factory.createCoordinateReferenceSystem(codeOrPath); + } } else if (type.isCRS) { object = CRS.forCode(codeOrPath); } else { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java index e7541c1555..032e1bdd53 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/Convention.java @@ -196,12 +196,7 @@ public enum Convention { * <li>{@code Remarks} element is formatted for all * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject identified objects}, * not only CRS or coordinate operations.</li> - * <li>Additional attributes not defined by ISO 19162 may be formatted: - * <ul> - * <li>{@code ImageDatum} includes the {@linkplain org.apache.sis.referencing.datum.DefaultImageDatum#getPixelInCell() Pixel in Cell} code.</li> - * <li>{@code TemporalDatum} includes the {@linkplain org.apache.sis.referencing.datum.DefaultTemporalDatum#getOrigin() Origin} date.</li> - * </ul> - * </li> + * <li>Additional attributes not defined by ISO 19162 may be formatted.</li> * </ul> * * This convention is used only for debugging purpose. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java index ae5252bdc6..56001c098e 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java @@ -85,6 +85,10 @@ import org.apache.sis.util.privy.Strings; import org.apache.sis.util.resources.Errors; import org.apache.sis.util.iso.Types; +// Specific to the geoapi-4.0 branch: +import org.apache.sis.referencing.crs.DefaultImageCRS; +import org.apache.sis.referencing.datum.DefaultImageDatum; + /** * Well Known Text (WKT) parser for referencing objects. This include, but is not limited too, @@ -1560,11 +1564,10 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo * * @param mode {@link #FIRST}, {@link #OPTIONAL} or {@link #MANDATORY}. * @param parent the parent element. - * @return the {@code "ImageDatum"} element as an {@link ImageDatum} object. + * @return the {@code "ImageDatum"} element. * @throws ParseException if the {@code "ImageDatum"} element cannot be parsed. */ - @SuppressWarnings("deprecation") - private ImageDatum parseImageDatum(final int mode, final Element parent) throws ParseException { + private DefaultImageDatum parseImageDatum(final int mode, final Element parent) throws ParseException { final Element element = parent.pullElement(mode, WKTKeywords.ImageDatum, WKTKeywords.IDatum); if (element == null) { return null; @@ -1572,12 +1575,7 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo final String name = element.pullString("name"); final PixelInCell pixelInCell = Types.forCodeName(PixelInCell.class, element.pullVoidElement("pixelInCell").keyword, PixelInCell::valueOf); - final DatumFactory datumFactory = factories.getDatumFactory(); - try { - return datumFactory.createImageDatum(parseAnchorAndClose(element, name), pixelInCell); - } catch (FactoryException exception) { - throw element.parseFailed(exception); - } + return new DefaultImageDatum(parseAnchorAndClose(element, name), pixelInCell); } /** @@ -1669,21 +1667,20 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo * @return the {@code "ImageCRS"} element as an {@link ImageCRS} object. * @throws ParseException if the {@code "ImageCRS"} element cannot be parsed. */ - @SuppressWarnings("deprecation") - private ImageCRS parseImageCRS(final int mode, final Element parent) throws ParseException { + private DefaultImageCRS parseImageCRS(final int mode, final Element parent) throws ParseException { final Element element = parent.pullElement(mode, WKTKeywords.ImageCRS); if (element == null) { return null; } - final String name = element.pullString("name"); - final ImageDatum datum = parseImageDatum(MANDATORY, element); - final Unit<?> unit = parseUnit(element); + final String name = element.pullString("name"); + final var datum = parseImageDatum(MANDATORY, element); + final Unit<?> unit = parseUnit(element); final CoordinateSystem cs; try { cs = parseCoordinateSystem(element, WKTKeywords.Cartesian, 2, false, unit, datum); final Map<String,?> properties = parseMetadataAndClose(element, name, datum); if (cs instanceof AffineCS) { - return factories.getCRSFactory().createImageCRS(properties, datum, (AffineCS) cs); + return new DefaultImageCRS(properties, datum, (AffineCS) cs); } } catch (FactoryException exception) { throw element.parseFailed(exception); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractCRS.java index 1065afe2fb..32f34b8cdc 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractCRS.java @@ -227,8 +227,7 @@ public class AbstractCRS extends AbstractReferenceSystem implements CoordinateRe * {@link org.opengis.referencing.crs.GeocentricCRS} subtypes), * {@link org.opengis.referencing.crs.VerticalCRS}, * {@link org.opengis.referencing.crs.TemporalCRS}, - * {@link org.opengis.referencing.crs.EngineeringCRS}, - * {@link org.opengis.referencing.crs.ImageCRS} or + * {@link org.opengis.referencing.crs.EngineeringCRS} or * {@link org.apache.sis.referencing.cs.DefaultCompoundCS}, * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass. * Note that if the given object implements more than one of the above-cited interfaces, diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java index 416297c6cd..5a62c3e211 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java @@ -325,8 +325,9 @@ public class DefaultEngineeringCRS extends AbstractCRS implements EngineeringCRS @XmlElement(name="linearCS") private LinearCS getLinearCS() {return getCoordinateSystem(LinearCS .class);} @XmlElement(name="polarCS") private PolarCS getPolarCS() {return getCoordinateSystem(PolarCS .class);} @XmlElement(name="sphericalCS") private SphericalCS getSphericalCS() {return getCoordinateSystem(SphericalCS .class);} - @Deprecated(since = "1.5") - @XmlElement(name="userDefinedCS") private UserDefinedCS getUserDefinedCS() {return getCoordinateSystem(UserDefinedCS.class);} + + // Types that do not exist anymore in lastest ISO 19111 standard. + @XmlElement(name="userDefinedCS") private DefaultUserDefinedCS getUserDefinedCS() {return getCoordinateSystem(DefaultUserDefinedCS.class);} /** * Invoked by JAXB at unmarshalling time. @@ -337,8 +338,9 @@ public class DefaultEngineeringCRS extends AbstractCRS implements EngineeringCRS private void setLinearCS (final LinearCS cs) {super.setCoordinateSystem("linearCS", cs);} private void setPolarCS (final PolarCS cs) {super.setCoordinateSystem("polarCS", cs);} private void setSphericalCS (final SphericalCS cs) {super.setCoordinateSystem("sphericalCS", cs);} - @Deprecated(since = "1.5") - private void setUserDefinedCS(final UserDefinedCS cs) {super.setCoordinateSystem("userDefinedCS", cs);} + + // Types that do not exist anymore in lastest ISO 19111 standard. + private void setUserDefinedCS(final DefaultUserDefinedCS cs) {super.setCoordinateSystem("userDefinedCS", cs);} /** * The types for which a specialized method exists. @@ -346,7 +348,7 @@ public class DefaultEngineeringCRS extends AbstractCRS implements EngineeringCRS */ @SuppressWarnings("deprecation") private static final Class<?>[] SPECIALIZED_TYPES = { - AffineCS.class, SphericalCS.class, CylindricalCS.class, PolarCS.class, LinearCS.class, UserDefinedCS.class + AffineCS.class, SphericalCS.class, CylindricalCS.class, PolarCS.class, LinearCS.class, DefaultUserDefinedCS.class }; /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultImageCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultImageCRS.java index 6eff39afc2..e9e58b45d8 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultImageCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultImageCRS.java @@ -23,8 +23,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; import org.opengis.referencing.cs.AffineCS; import org.opengis.referencing.cs.CartesianCS; -import org.opengis.referencing.crs.ImageCRS; -import org.opengis.referencing.datum.ImageDatum; import org.apache.sis.referencing.AbstractReferenceSystem; import org.apache.sis.referencing.privy.WKTKeywords; import org.apache.sis.referencing.cs.AxesConvention; @@ -32,6 +30,9 @@ import org.apache.sis.referencing.cs.AbstractCS; import org.apache.sis.metadata.privy.ImplementationHelper; import org.apache.sis.io.wkt.Formatter; +// Specific to the geoapi-4.0 branch: +import org.apache.sis.referencing.datum.DefaultImageDatum; + /** * A 2-dimensional engineering coordinate reference system applied to locations in images. @@ -61,14 +62,14 @@ import org.apache.sis.io.wkt.Formatter; * * @since 0.4 */ -@Deprecated(since = "1.5") +@Deprecated(since="1.5", forRemoval=true) // Actually to be moved to an internal package for GML and WKT purposes. @XmlType(name = "ImageCRSType", propOrder = { "cartesianCS", "affineCS", "datum" }) @XmlRootElement(name = "ImageCRS") -public class DefaultImageCRS extends AbstractCRS implements ImageCRS { +public final class DefaultImageCRS extends AbstractCRS { /** * Serial number for inter-operability with different versions. */ @@ -78,12 +79,11 @@ public class DefaultImageCRS extends AbstractCRS implements ImageCRS { * The datum. * * <p><b>Consider this field as final!</b> - * This field is modified only at unmarshalling time by {@link #setDatum(ImageDatum)}</p> + * This field is modified only at unmarshalling time.</p> * * @see #getDatum() */ - @SuppressWarnings("serial") // Most SIS implementations are serializable. - private ImageDatum datum; + private DefaultImageDatum datum; /** * Creates a coordinate reference system from the given properties, datum and coordinate system. @@ -123,12 +123,10 @@ public class DefaultImageCRS extends AbstractCRS implements ImageCRS { * @param properties the properties to be given to the coordinate reference system. * @param datum the datum. * @param cs the coordinate system. - * - * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createImageCRS(Map, ImageDatum, AffineCS) */ public DefaultImageCRS(final Map<String,?> properties, - final ImageDatum datum, - final AffineCS cs) + final DefaultImageDatum datum, + final AffineCS cs) { super(properties, cs); this.datum = Objects.requireNonNull(datum); @@ -143,53 +141,6 @@ public class DefaultImageCRS extends AbstractCRS implements ImageCRS { datum = original.datum; } - /** - * Constructs a new coordinate reference system with the same values as the specified one. - * This copy constructor provides a way to convert an arbitrary implementation into a SIS one - * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. - * - * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> - * - * @param crs the coordinate reference system to copy. - * - * @see #castOrCopy(ImageCRS) - */ - protected DefaultImageCRS(final ImageCRS crs) { - super(crs); - datum = crs.getDatum(); - } - - /** - * Returns a SIS coordinate reference system implementation with the same values as the given - * arbitrary implementation. If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. - * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. - * - * @param object the object to get as a SIS implementation, or {@code null} if none. - * @return a SIS implementation containing the values of the given object (may be the - * given object itself), or {@code null} if the argument was null. - */ - public static DefaultImageCRS castOrCopy(final ImageCRS object) { - return (object == null) || (object instanceof DefaultImageCRS) - ? (DefaultImageCRS) object : new DefaultImageCRS(object); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code ImageCRS.class}. - * - * <h4>Note for implementers</h4> - * Subclasses usually do not need to override this method since GeoAPI does not define {@code ImageCRS} - * sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with - * their own set of interfaces. - * - * @return {@code ImageCRS.class} or a user-defined sub-interface. - */ - @Override - public Class<? extends ImageCRS> getInterface() { - return ImageCRS.class; - } - /** * Returns the datum. * @@ -197,7 +148,7 @@ public class DefaultImageCRS extends AbstractCRS implements ImageCRS { */ @Override @XmlElement(name = "imageDatum", required = true) - public ImageDatum getDatum() { + public DefaultImageDatum getDatum() { return datum; } @@ -287,7 +238,7 @@ public class DefaultImageCRS extends AbstractCRS implements ImageCRS { * * @see #getDatum() */ - private void setDatum(final ImageDatum value) { + private void setDatum(final DefaultImageDatum value) { if (datum == null) { datum = value; } else { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/SubTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/SubTypes.java index 1053074749..2b160b158a 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/SubTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/SubTypes.java @@ -25,7 +25,6 @@ import org.opengis.referencing.crs.EngineeringCRS; import org.opengis.referencing.crs.GeocentricCRS; import org.opengis.referencing.crs.GeodeticCRS; import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ImageCRS; import org.opengis.referencing.crs.ProjectedCRS; import org.opengis.referencing.crs.TemporalCRS; import org.opengis.referencing.crs.VerticalCRS; @@ -154,9 +153,6 @@ final class SubTypes implements Comparator<Object> { if (object instanceof EngineeringCRS) { return DefaultEngineeringCRS.castOrCopy((EngineeringCRS) object); } - if (object instanceof ImageCRS) { - return DefaultImageCRS.castOrCopy((ImageCRS) object); - } if (object instanceof CompoundCRS) { return DefaultCompoundCRS.castOrCopy((CompoundCRS) object); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/AbstractCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/AbstractCS.java index 1bd437faf7..a7a8ca7b3b 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/AbstractCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/AbstractCS.java @@ -323,9 +323,8 @@ public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSy * {@link org.opengis.referencing.cs.CylindricalCS}, * {@link org.opengis.referencing.cs.PolarCS}, * {@link org.opengis.referencing.cs.LinearCS}, - * {@link org.opengis.referencing.cs.VerticalCS}, - * {@link org.opengis.referencing.cs.TimeCS} or - * {@link org.opengis.referencing.cs.UserDefinedCS}, + * {@link org.opengis.referencing.cs.VerticalCS} or + * {@link org.opengis.referencing.cs.TimeCS}. * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass. * Note that if the given object implements more than one of the above-cited interfaces, * then the {@code castOrCopy(…)} method to be used is unspecified.</li> diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java index 677feb5fb1..304f1a38dd 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.cs; import java.util.Map; import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.XmlRootElement; -import org.opengis.referencing.cs.UserDefinedCS; import org.opengis.referencing.cs.CoordinateSystemAxis; @@ -48,10 +47,10 @@ import org.opengis.referencing.cs.CoordinateSystemAxis; * * @deprecated The {@code UserDefinedCS} class has been removed from ISO 19111:2019. */ -@Deprecated(since = "1.5") +@Deprecated(since="1.5", forRemoval=true) // Actually to be moved to an internal package for GML and WKT purposes. @XmlType(name = "UserDefinedCSType") @XmlRootElement(name = "UserDefinedCS") -public class DefaultUserDefinedCS extends AbstractCS implements UserDefinedCS { +public final class DefaultUserDefinedCS extends AbstractCS { /** * Serial number for inter-operability with different versions. */ @@ -130,52 +129,6 @@ public class DefaultUserDefinedCS extends AbstractCS implements UserDefinedCS { super(original, name, axes); } - /** - * Creates a new coordinate system with the same values as the specified one. - * This copy constructor provides a way to convert an arbitrary implementation into a SIS one - * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. - * - * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> - * - * @param original the coordinate system to copy. - * - * @see #castOrCopy(UserDefinedCS) - */ - protected DefaultUserDefinedCS(final UserDefinedCS original) { - super(original); - } - - /** - * Returns a SIS coordinate system implementation with the same values as the given arbitrary implementation. - * If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. - * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. - * - * @param object the object to get as a SIS implementation, or {@code null} if none. - * @return a SIS implementation containing the values of the given object (may be the - * given object itself), or {@code null} if the argument was null. - */ - public static DefaultUserDefinedCS castOrCopy(final UserDefinedCS object) { - return (object == null) || (object instanceof DefaultUserDefinedCS) - ? (DefaultUserDefinedCS) object : new DefaultUserDefinedCS(object); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code UserDefinedCS.class}. - * - * <h4>Note for implementers</h4> - * Subclasses usually do not need to override this method since GeoAPI does not define {@code UserDefinedCS} - * sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their - * own set of interfaces. - * - * @return {@code UserDefinedCS.class} or a user-defined sub-interface. - */ - @Override - public Class<? extends UserDefinedCS> getInterface() { - return UserDefinedCS.class; - } - /** * {@inheritDoc} * diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java index 3a74904d43..47f7d4b422 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java @@ -27,7 +27,6 @@ import org.opengis.referencing.cs.LinearCS; import org.opengis.referencing.cs.PolarCS; import org.opengis.referencing.cs.SphericalCS; import org.opengis.referencing.cs.TimeCS; -import org.opengis.referencing.cs.UserDefinedCS; import org.opengis.referencing.cs.VerticalCS; import org.apache.sis.referencing.privy.AxisDirections; @@ -56,7 +55,6 @@ final class SubTypes { * * @see AbstractCS#castOrCopy(CoordinateSystem) */ - @SuppressWarnings("deprecation") static AbstractCS castOrCopy(final CoordinateSystem object) { if (object instanceof AffineCS) { return DefaultAffineCS.castOrCopy((AffineCS) object); @@ -82,9 +80,6 @@ final class SubTypes { if (object instanceof TimeCS) { return DefaultTimeCS.castOrCopy((TimeCS) object); } - if (object instanceof UserDefinedCS) { - return DefaultUserDefinedCS.castOrCopy((UserDefinedCS) object); - } /* * Intentionally check for AbstractCS after the interfaces because user may have defined his own * subclass implementing the interface. If we were checking for AbstractCS before the interfaces, diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java index e379725baf..e62924f482 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/AbstractDatum.java @@ -203,9 +203,8 @@ public class AbstractDatum extends AbstractIdentifiedObject implements Datum { * <li>Otherwise if the given object is an instance of * {@link org.opengis.referencing.datum.GeodeticDatum}, * {@link org.opengis.referencing.datum.VerticalDatum}, - * {@link org.opengis.referencing.datum.TemporalDatum}, - * {@link org.opengis.referencing.datum.EngineeringDatum} or - * {@link org.opengis.referencing.datum.ImageDatum}, + * {@link org.opengis.referencing.datum.TemporalDatum} or + * {@link org.opengis.referencing.datum.EngineeringDatum}, * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass. * Note that if the given object implements more than one of the above-cited interfaces, * then the {@code castOrCopy(…)} method to be used is unspecified.</li> diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultImageDatum.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultImageDatum.java index 9100a447af..2dabc1c611 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultImageDatum.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/DefaultImageDatum.java @@ -23,7 +23,6 @@ import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; import org.opengis.util.GenericName; import org.opengis.util.InternationalString; -import org.opengis.referencing.datum.ImageDatum; import org.opengis.referencing.datum.PixelInCell; import org.apache.sis.referencing.privy.WKTKeywords; import org.apache.sis.metadata.privy.ImplementationHelper; @@ -56,10 +55,10 @@ import org.opengis.metadata.Identifier; * * @since 0.4 */ -@Deprecated(since = "1.5") +@Deprecated(since="1.5", forRemoval=true) // Actually to be moved to an internal package for GML and WKT purposes. @XmlType(name = "ImageDatumType") @XmlRootElement(name = "ImageDatum") -public class DefaultImageDatum extends AbstractDatum implements ImageDatum { +public final class DefaultImageDatum extends AbstractDatum { /** * Serial number for inter-operability with different versions. */ @@ -128,59 +127,11 @@ public class DefaultImageDatum extends AbstractDatum implements ImageDatum { this.pixelInCell = Objects.requireNonNull(pixelInCell); } - /** - * Creates a new datum with the same values as the specified one. - * This copy constructor provides a way to convert an arbitrary implementation into a SIS one - * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. - * - * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> - * - * @param datum the datum to copy. - * - * @see #castOrCopy(ImageDatum) - */ - protected DefaultImageDatum(final ImageDatum datum) { - super(datum); - pixelInCell = datum.getPixelInCell(); - } - - /** - * Returns a SIS datum implementation with the same values as the given arbitrary implementation. - * If the given object is {@code null}, then this method returns {@code null}. - * Otherwise if the given object is already a SIS implementation, then the given object is returned unchanged. - * Otherwise a new SIS implementation is created and initialized to the attribute values of the given object. - * - * @param object the object to get as a SIS implementation, or {@code null} if none. - * @return a SIS implementation containing the values of the given object (may be the - * given object itself), or {@code null} if the argument was null. - */ - public static DefaultImageDatum castOrCopy(final ImageDatum object) { - return (object == null) || (object instanceof DefaultImageDatum) - ? (DefaultImageDatum) object : new DefaultImageDatum(object); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code ImageDatum.class}. - * - * <h4>Note for implementers</h4> - * Subclasses usually do not need to override this method since GeoAPI does not define {@code ImageDatum} - * sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with - * their own set of interfaces. - * - * @return {@code ImageDatum.class} or a user-defined sub-interface. - */ - @Override - public Class<? extends ImageDatum> getInterface() { - return ImageDatum.class; - } - /** * Specification of the way the image grid is associated with the image data attributes. * * @return the way image grid is associated with image data attributes. */ - @Override @XmlElement(required = true) public PixelInCell getPixelInCell() { return pixelInCell; @@ -198,19 +149,10 @@ public class DefaultImageDatum extends AbstractDatum implements ImageDatum { @Override public boolean equals(final Object object, final ComparisonMode mode) { if (object == this) { - return true; // Slight optimization. - } - if (!super.equals(object, mode)) { - return false; - } - switch (mode) { - case STRICT: { - return Objects.equals(pixelInCell, ((DefaultImageDatum) object).pixelInCell); - } - default: { - return Objects.equals(getPixelInCell(), ((ImageDatum) object).getPixelInCell()); - } + return true; // Slight optimization. } + return (object instanceof DefaultImageDatum) && + Objects.equals(pixelInCell, ((DefaultImageDatum) object).pixelInCell); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/SubTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/SubTypes.java index 49e765c5a5..e5a7af5fcc 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/SubTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/datum/SubTypes.java @@ -21,7 +21,6 @@ import org.opengis.referencing.datum.GeodeticDatum; import org.opengis.referencing.datum.VerticalDatum; import org.opengis.referencing.datum.TemporalDatum; import org.opengis.referencing.datum.EngineeringDatum; -import org.opengis.referencing.datum.ImageDatum; /** @@ -62,9 +61,6 @@ final class SubTypes { if (object instanceof EngineeringDatum) { return DefaultEngineeringDatum.castOrCopy((EngineeringDatum) object); } - if (object instanceof ImageDatum) { - return DefaultImageDatum.castOrCopy((ImageDatum) object); - } /* * Intentionally check for AbstractDatum after the interfaces because user may have defined his own * subclass implementing the interface. If we were checking for AbstractDatum before the interfaces, diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java index 4f7a0b5c3d..abe367a11d 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryProxy.java @@ -192,9 +192,15 @@ abstract class AuthorityFactoryProxy<T> { */ static final AuthorityFactoryProxy<IdentifiedObject> OBJECT = new AuthorityFactoryProxy<IdentifiedObject>(IdentifiedObject.class, AuthorityFactoryIdentifier.ANY) { - @Override IdentifiedObject createFromAPI(AuthorityFactory factory, String code) throws FactoryException { + @Override IdentifiedObject create(GeodeticAuthorityFactory factory, String code) throws FactoryException { return factory.createObject(code); } + @Override IdentifiedObject createFromAPI(AuthorityFactory factory, String code) throws FactoryException { + if (factory instanceof GeodeticAuthorityFactory) { + return ((GeodeticAuthorityFactory) factory).createObject(code); + } + throw new FactoryException(Errors.format(Errors.Keys.UnsupportedOperation_1, "createObject")); + } }; static final AuthorityFactoryProxy<Datum> DATUM = @@ -217,17 +223,6 @@ abstract class AuthorityFactoryProxy<T> { } }; - @SuppressWarnings("deprecation") - static final AuthorityFactoryProxy<ImageDatum> IMAGE_DATUM = - new AuthorityFactoryProxy<ImageDatum>(ImageDatum.class, AuthorityFactoryIdentifier.DATUM) { - @Override ImageDatum create(GeodeticAuthorityFactory factory, String code) throws FactoryException { - return factory.createImageDatum(code); - } - @Override ImageDatum createFromAPI(AuthorityFactory factory, String code) throws FactoryException { - return datumFactory(factory).createImageDatum(code); - } - }; - static final AuthorityFactoryProxy<ParametricDatum> PARAMETRIC_DATUM = new AuthorityFactoryProxy<ParametricDatum>(ParametricDatum.class, AuthorityFactoryIdentifier.DATUM) { @Override ParametricDatum create(GeodeticAuthorityFactory factory, String code) throws FactoryException { @@ -470,17 +465,6 @@ abstract class AuthorityFactoryProxy<T> { } }; - @SuppressWarnings("deprecation") - static final AuthorityFactoryProxy<ImageCRS> IMAGE_CRS = - new AuthorityFactoryProxy<ImageCRS>(ImageCRS.class, AuthorityFactoryIdentifier.CRS) { - @Override ImageCRS create(GeodeticAuthorityFactory factory, String code) throws FactoryException { - return factory.createImageCRS(code); - } - @Override ImageCRS createFromAPI(AuthorityFactory factory, String code) throws FactoryException { - return crsFactory(factory).createImageCRS(code); - } - }; - static final AuthorityFactoryProxy<ProjectedCRS> PROJECTED_CRS = new AuthorityFactoryProxy<ProjectedCRS>(ProjectedCRS.class, AuthorityFactoryIdentifier.CRS) { @Override ProjectedCRS create(GeodeticAuthorityFactory factory, String code) throws FactoryException { @@ -563,7 +547,6 @@ abstract class AuthorityFactoryProxy<T> { GEOCENTRIC_CRS, // Special kind of GeodeticCRS. VERTICAL_CRS, TEMPORAL_CRS, - IMAGE_CRS, // Can be seen as a special kind of EngineeringCRS (even if not shown in hierarchy). ENGINEERING_CRS, DERIVED_CRS, // DerivedCRS can be also Vertical, Temporal or Engineering CRS. Give precedence to those. COMPOUND_CRS, @@ -571,7 +554,6 @@ abstract class AuthorityFactoryProxy<T> { GEODETIC_DATUM, VERTICAL_DATUM, TEMPORAL_DATUM, - IMAGE_DATUM, // Can be seen as a special kind of EngineeringDatum (even if not shown in hierarchy). ENGINEERING_DATUM, DATUM, ELLIPSOID, 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 d298156a52..fa6331cab3 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 @@ -1113,33 +1113,6 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa return create(AuthorityFactoryProxy.ENGINEERING_CRS, code); } - /** - * Returns a 2-dimensional engineering coordinate reference system applied to locations in images. - * The default implementation performs the following steps: - * <ul> - * <li>Return the cached instance for the given code if such instance already exists.</li> - * <li>Otherwise if the Data Access Object (DAO) overrides the {@code createImageCRS(String)} - * method, invoke that method and cache the result for future use.</li> - * <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createImageCRS(String)} - * method in the parent class. This allows to check if the more generic - * {@link #createCoordinateReferenceSystem(String)} method cached a value before to try that method.</li> - * </ul> - * - * @return the coordinate reference system for the given code. - * @throws FactoryException if the object creation failed. - * - * @deprecated The {@code ImageCRS} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringCRS}. - */ - @Override - @Deprecated(since = "1.5") - public ImageCRS createImageCRS(final String code) throws FactoryException { - if (isDefault(ImageCRS.class)) { - return super.createImageCRS(code); - } - return create(AuthorityFactoryProxy.IMAGE_CRS, code); - } - /** * Returns an arbitrary datum from a code. The returned object will typically be an * The default implementation performs the following steps: @@ -1280,33 +1253,6 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa return create(AuthorityFactoryProxy.ENGINEERING_DATUM, code); } - /** - * Returns a datum defining the origin of an image coordinate reference system. - * The default implementation performs the following steps: - * <ul> - * <li>Return the cached instance for the given code if such instance already exists.</li> - * <li>Otherwise if the Data Access Object (DAO) overrides the {@code createImageDatum(String)} - * method, invoke that method and cache the result for future use.</li> - * <li>Otherwise delegate to the {@link GeodeticAuthorityFactory#createImageDatum(String)} - * method in the parent class. This allows to check if the more generic - * {@link #createDatum(String)} method cached a value before to try that method.</li> - * </ul> - * - * @return the datum for the given code. - * @throws FactoryException if the object creation failed. - * - * @deprecated The {@code ImageDatum} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringDatum}. - */ - @Override - @Deprecated(since = "1.5") - public ImageDatum createImageDatum(final String code) throws FactoryException { - if (isDefault(ImageDatum.class)) { - return super.createImageDatum(code); - } - return create(AuthorityFactoryProxy.IMAGE_DATUM, code); - } - /** * Returns a geometric figure that can be used to describe the approximate shape of the earth. * The default implementation performs the following steps: 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 45f6fa8d79..338d80a203 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 @@ -211,8 +211,6 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement * * @see org.apache.sis.referencing.AbstractIdentifiedObject */ - @Override - @SuppressWarnings("deprecation") public abstract IdentifiedObject createObject(String code) throws NoSuchAuthorityCodeException, FactoryException; /** @@ -526,30 +524,6 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement return cast(EngineeringCRS.class, createCoordinateReferenceSystem(code), code); } - /** - * Creates a 2-dimensional engineering coordinate reference system applied to locations in images. - * Image coordinate reference systems are treated as a separate sub-type because a separate - * user community exists for images with its own terms of reference. - * - * <h4>Default implementation</h4> - * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result. - * If the result cannot be casted, then a {@link NoSuchAuthorityCodeException} is thrown. - * - * @param code value allocated by authority. - * @return the coordinate reference system for the given code. - * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. - * @throws FactoryException if the object creation failed for some other reason. - * - * @see org.apache.sis.referencing.crs.DefaultImageCRS - * - * @deprecated The {@code ImageCRS} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringCRS}. - */ - @Deprecated(since = "1.5") - public ImageCRS createImageCRS(final String code) throws NoSuchAuthorityCodeException, FactoryException { - return cast(ImageCRS.class, createCoordinateReferenceSystem(code), code); - } - /** * Creates an arbitrary datum from a code. The returned object will typically be an * instance of {@link GeodeticDatum}, {@link VerticalDatum} or {@link TemporalDatum}. @@ -724,30 +698,6 @@ public abstract class GeodeticAuthorityFactory extends AbstractFactory implement return cast(EngineeringDatum.class, createDatum(code), code); } - /** - * Creates a datum defining the origin of an image coordinate reference system. - * An image datum is used in a local context only. - * For an image datum, the anchor point is usually either the centre of the image or the corner of the image. - * - * <h4>Default implementation</h4> - * The default implementation delegates to {@link #createDatum(String)} and casts the result. - * If the result cannot be casted, then a {@link NoSuchAuthorityCodeException} is thrown. - * - * @param code value allocated by authority. - * @return the datum for the given code. - * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. - * @throws FactoryException if the object creation failed for some other reason. - * - * @see org.apache.sis.referencing.datum.DefaultImageDatum - * - * @deprecated The {@code ImageDatum} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringDatum}. - */ - @Deprecated(since = "1.5") - public ImageDatum createImageDatum(final String code) throws NoSuchAuthorityCodeException, FactoryException { - return cast(ImageDatum.class, createDatum(code), code); - } - /** * Creates a geometric figure that can be used to describe the approximate shape of the earth. * In mathematical terms, it is a surface formed by the rotation of an ellipse about its minor axis. 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 b3079f115b..0af6cb5ee8 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 @@ -177,7 +177,7 @@ import org.apache.sis.xml.XML; * @author Martin Desruisseaux (IRD, Geomatys) * @author Guilhem Legal (Geomatys) * @author Johann Sorel (Geomatys) - * @version 1.4 + * @version 1.5 * @since 0.6 */ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory, CSFactory, DatumFactory, Parser { @@ -1201,63 +1201,6 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory return unique("createCompoundCRS", crs); } - /** - * Creates an image coordinate reference system. - * The default implementation creates a {@link DefaultImageCRS} instance. - * - * @param properties name and other properties to give to the new object. - * @param datum the image datum to use in created CRS. - * @param cs the Cartesian or oblique Cartesian coordinate system for the created CRS. - * @throws FactoryException if the object creation failed. - * - * @see DefaultImageCRS#DefaultImageCRS(Map, ImageDatum, AffineCS) - * @see GeodeticAuthorityFactory#createImageCRS(String) - * - * @deprecated The {@code ImageCRS} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringCRS}. - */ - @Override - @Deprecated(since = "1.5") - public ImageCRS createImageCRS(final Map<String,?> properties, - final ImageDatum datum, final AffineCS cs) throws FactoryException - { - final DefaultImageCRS crs; - try { - crs = new DefaultImageCRS(complete(properties), datum, cs); - } catch (IllegalArgumentException exception) { - throw new InvalidGeodeticParameterException(exception); - } - return unique("createImageCRS", crs); - } - - /** - * Creates an image datum. - * The default implementation creates a {@link DefaultImageDatum} instance. - * - * @param properties Name and other properties to give to the new object. - * @param pixelInCell Specification of the way the image grid is associated with the image data attributes. - * @throws FactoryException if the object creation failed. - * - * @see DefaultImageDatum#DefaultImageDatum(Map, PixelInCell) - * @see GeodeticAuthorityFactory#createImageDatum(String) - * - * @deprecated The {@code ImageDatum} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringDatum}. - */ - @Override - @Deprecated(since = "1.5") - public ImageDatum createImageDatum(final Map<String,?> properties, - final PixelInCell pixelInCell) throws FactoryException - { - final DefaultImageDatum datum; - try { - datum = new DefaultImageDatum(complete(properties), pixelInCell); - } catch (IllegalArgumentException exception) { - throw new InvalidGeodeticParameterException(exception); - } - return unique("createImageDatum", datum); - } - /** * Creates a two-dimensional affine coordinate system from the given pair of axis. * This coordinate system can be used with image and engineering CRS. @@ -1490,80 +1433,6 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory return unique("createLinearCS", cs); } - /** - * Creates a two-dimensional user defined coordinate system from the given pair of axis. - * This coordinate system can be used with engineering CRS. - * - * <h4>Dependencies</h4> - * The components needed by this method can be created by the following methods: - * <ol> - * <li>{@link #createCoordinateSystemAxis(Map, String, AxisDirection, Unit)}</li> - * </ol> - * - * The default implementation creates a {@link DefaultUserDefinedCS} instance. - * - * @param properties name and other properties to give to the new object. - * @param axis0 the first axis. - * @param axis1 the second axis. - * @throws FactoryException if the object creation failed. - * - * @see DefaultUserDefinedCS#DefaultUserDefinedCS(Map, CoordinateSystemAxis, CoordinateSystemAxis) - * - * @deprecated The {@code UserDefinedCS} class has been removed from ISO 19111:2019. - */ - @Override - @Deprecated(since = "1.5") - public UserDefinedCS createUserDefinedCS(final Map<String,?> properties, - final CoordinateSystemAxis axis0, - final CoordinateSystemAxis axis1) throws FactoryException - { - final DefaultUserDefinedCS cs; - try { - cs = new DefaultUserDefinedCS(complete(properties), axis0, axis1); - } catch (IllegalArgumentException exception) { - throw new InvalidGeodeticParameterException(exception); - } - return unique("createUserDefinedCS", cs); - } - - /** - * Creates a three-dimensional user defined coordinate system from the given set of axis. - * This coordinate system can be used with engineering CRS. - * - * <h4>Dependencies</h4> - * The components needed by this method can be created by the following methods: - * <ol> - * <li>{@link #createCoordinateSystemAxis(Map, String, AxisDirection, Unit)}</li> - * </ol> - * - * The default implementation creates a {@link DefaultUserDefinedCS} instance. - * - * @param properties name and other properties to give to the new object. - * @param axis0 the first axis. - * @param axis1 the second axis. - * @param axis2 the third axis. - * @throws FactoryException if the object creation failed. - * - * @see DefaultUserDefinedCS#DefaultUserDefinedCS(Map, CoordinateSystemAxis, CoordinateSystemAxis, CoordinateSystemAxis) - * - * @deprecated The {@code UserDefinedCS} class has been removed from ISO 19111:2019. - */ - @Override - @Deprecated(since = "1.5") - public UserDefinedCS createUserDefinedCS(final Map<String,?> properties, - final CoordinateSystemAxis axis0, - final CoordinateSystemAxis axis1, - final CoordinateSystemAxis axis2) throws FactoryException - { - final DefaultUserDefinedCS cs; - try { - cs = new DefaultUserDefinedCS(complete(properties), axis0, axis1, axis2); - } catch (IllegalArgumentException exception) { - throw new InvalidGeodeticParameterException(exception); - } - return unique("createUserDefinedCS", cs); - } - /** * Creates a coordinate system axis from an abbreviation and a unit. * Note that the axis name is constrained by ISO 19111 depending on the coordinate reference system type. 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 2e9feec087..a3a645da73 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 @@ -1080,29 +1080,6 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements return create(AuthorityFactoryProxy.ENGINEERING_CRS, code); } - /** - * Creates a 2-dimensional engineering coordinate reference system applied to locations in images. - * The given code can use any of the following patterns, where <var>version</var> is optional: - * <ul> - * <li><var>authority</var>{@code :}<var>code</var></li> - * <li><var>authority</var>{@code :}<var>version</var>{@code :}<var>code</var></li> - * <li><code>urn:ogc:def:<b>crs</b>:</code><var>authority</var>{@code :}<var>version</var>{@code :}<var>code</var></li> - * <li><code>http://www.opengis.net/def/<b>crs</b>/</code><var>authority</var>{@code /}<var>version</var>{@code /}<var>code</var></li> - * <li>{@code http://www.opengis.net/gml/srs/}<var>authority</var>{@code .xml#}<var>code</var></li> - * </ul> - * - * @return the coordinate reference system for the given code. - * @throws FactoryException if the object creation failed. - * - * @deprecated The {@code ImageCRS} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringCRS}. - */ - @Override - @Deprecated(since = "1.5") - public ImageCRS createImageCRS(final String code) throws FactoryException { - return create(AuthorityFactoryProxy.IMAGE_CRS, code); - } - /** * Creates an arbitrary datum from a code. The returned object will typically be an * The given code can use any of the following patterns, where <var>version</var> is optional: @@ -1193,28 +1170,6 @@ public class MultiAuthoritiesFactory extends GeodeticAuthorityFactory implements return create(AuthorityFactoryProxy.ENGINEERING_DATUM, code); } - /** - * Creates a datum defining the origin of an image coordinate reference system. - * The given code can use any of the following patterns, where <var>version</var> is optional: - * <ul> - * <li><var>authority</var>{@code :}<var>code</var></li> - * <li><var>authority</var>{@code :}<var>version</var>{@code :}<var>code</var></li> - * <li><code>urn:ogc:def:<b>datum</b>:</code><var>authority</var>{@code :}<var>version</var>{@code :}<var>code</var></li> - * <li><code>http://www.opengis.net/def/<b>datum</b>/</code><var>authority</var>{@code /}<var>version</var>{@code /}<var>code</var></li> - * </ul> - * - * @return the datum for the given code. - * @throws FactoryException if the object creation failed. - * - * @deprecated The {@code ImageDatum} class has been removed in ISO 19111:2019. - * It is replaced by {@code EngineeringDatum}. - */ - @Override - @Deprecated(since = "1.5") - public ImageDatum createImageDatum(final String code) throws FactoryException { - return create(AuthorityFactoryProxy.IMAGE_DATUM, code); - } - /** * Creates a geometric figure that can be used to describe the approximate shape of the earth. * The given code can use any of the following patterns, where <var>version</var> is optional: diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxy.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxy.java index d6eaeb701f..a4a079fcdf 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxy.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxy.java @@ -65,12 +65,6 @@ public abstract class EPSGFactoryProxy implements AuthorityFactory { return factory().getDescriptionText(type, code); } - @Override - @SuppressWarnings("deprecation") - public final IdentifiedObject createObject(String code) throws FactoryException { - return factory().createObject(code); - } - @Override public final Set<String> getAuthorityCodes(Class<? extends IdentifiedObject> type) throws FactoryException { return factory().getAuthorityCodes(type); 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 0f6ca0aa37..d257e5d221 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 @@ -23,7 +23,6 @@ import org.opengis.referencing.crs.DerivedCRS; import org.opengis.referencing.crs.EngineeringCRS; import org.opengis.referencing.crs.GeocentricCRS; import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ImageCRS; import org.opengis.referencing.crs.ProjectedCRS; import org.opengis.referencing.crs.TemporalCRS; import org.opengis.referencing.crs.VerticalCRS; @@ -85,12 +84,6 @@ public final class EPSGFactoryProxyCRS extends EPSGFactoryProxy implements CRSAu return factory().createGeocentricCRS(code); } - @Override - @Deprecated(since = "1.5") - public ImageCRS createImageCRS(String code) throws FactoryException { - return factory().createImageCRS(code); - } - @Override public ProjectedCRS createProjectedCRS(String code) throws FactoryException { return factory().createProjectedCRS(code); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyDatum.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyDatum.java index ae1f696a1d..399d5dd277 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyDatum.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/EPSGFactoryProxyDatum.java @@ -22,7 +22,6 @@ import org.opengis.referencing.datum.Ellipsoid; import org.opengis.referencing.datum.GeodeticDatum; import org.opengis.referencing.datum.PrimeMeridian; import org.opengis.referencing.datum.EngineeringDatum; -import org.opengis.referencing.datum.ImageDatum; import org.opengis.referencing.datum.TemporalDatum; import org.opengis.referencing.datum.VerticalDatum; import org.opengis.util.FactoryException; @@ -75,12 +74,6 @@ public final class EPSGFactoryProxyDatum extends EPSGFactoryProxy implements Dat return factory().createEngineeringDatum(code); } - @Override - @Deprecated(since = "1.5") - public ImageDatum createImageDatum(String code) throws FactoryException { - return factory().createImageDatum(code); - } - @Override public TemporalDatum createTemporalDatum(String code) throws FactoryException { return factory().createTemporalDatum(code); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubOperationInfo.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubOperationInfo.java index 06c84c9d90..2c0e08999d 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubOperationInfo.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubOperationInfo.java @@ -25,6 +25,9 @@ import org.opengis.util.FactoryException; import org.apache.sis.referencing.operation.matrix.Matrices; import org.apache.sis.referencing.operation.matrix.MatrixSIS; +// Specific to the geoapi-4.0 branch: +import org.apache.sis.referencing.crs.DefaultImageCRS; + /** * Information about the operation from a source component to a target component in {@code CompoundCRS} instances. @@ -51,14 +54,13 @@ final class SubOperationInfo { * {@link ProjectedCRS} and {@link DerivedCRS} are not in this list because we rather use their base CRS * as the criterion for determining their type. */ - @SuppressWarnings("deprecation") private static final Class<?>[][] COMPATIBLE_TYPES = { {GeodeticCRS.class}, {VerticalCRS.class, GeodeticCRS.class}, {TemporalCRS.class}, {ParametricCRS.class}, {EngineeringCRS.class}, - {ImageCRS.class} + {DefaultImageCRS.class} }; /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CD_ImageDatum.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CD_ImageDatum.java index d0574355b3..2e1c5d77f1 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CD_ImageDatum.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CD_ImageDatum.java @@ -17,7 +17,6 @@ package org.apache.sis.xml.bind.referencing; import jakarta.xml.bind.annotation.XmlElement; -import org.opengis.referencing.datum.ImageDatum; import org.apache.sis.xml.bind.gco.PropertyType; import org.apache.sis.referencing.datum.DefaultImageDatum; @@ -29,8 +28,7 @@ import org.apache.sis.referencing.datum.DefaultImageDatum; * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) */ -@SuppressWarnings("deprecation") -public final class CD_ImageDatum extends PropertyType<CD_ImageDatum, ImageDatum> { +public final class CD_ImageDatum extends PropertyType<CD_ImageDatum, DefaultImageDatum> { /** * Empty constructor for JAXB only. */ @@ -45,14 +43,14 @@ public final class CD_ImageDatum extends PropertyType<CD_ImageDatum, ImageDatum> * @return {@code ImageDatum.class} */ @Override - protected Class<ImageDatum> getBoundType() { - return ImageDatum.class; + protected Class<DefaultImageDatum> getBoundType() { + return DefaultImageDatum.class; } /** * Constructor for the {@link #wrap} method only. */ - private CD_ImageDatum(final ImageDatum datum) { + private CD_ImageDatum(final DefaultImageDatum datum) { super(datum); } @@ -64,7 +62,7 @@ public final class CD_ImageDatum extends PropertyType<CD_ImageDatum, ImageDatum> * @return a {@code PropertyType} wrapping the given the element. */ @Override - protected CD_ImageDatum wrap(final ImageDatum datum) { + protected CD_ImageDatum wrap(final DefaultImageDatum datum) { return new CD_ImageDatum(datum); } @@ -77,7 +75,7 @@ public final class CD_ImageDatum extends PropertyType<CD_ImageDatum, ImageDatum> */ @XmlElement(name = "ImageDatum") public DefaultImageDatum getElement() { - return DefaultImageDatum.castOrCopy(metadata); + return metadata; } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CS_UserDefinedCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CS_UserDefinedCS.java index 41ee56e38c..488042cc75 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CS_UserDefinedCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/xml/bind/referencing/CS_UserDefinedCS.java @@ -17,7 +17,6 @@ package org.apache.sis.xml.bind.referencing; import jakarta.xml.bind.annotation.XmlElement; -import org.opengis.referencing.cs.UserDefinedCS; import org.apache.sis.referencing.cs.DefaultUserDefinedCS; import org.apache.sis.xml.bind.gco.PropertyType; @@ -28,8 +27,7 @@ import org.apache.sis.xml.bind.gco.PropertyType; * * @author Martin Desruisseaux (Geomatys) */ -@SuppressWarnings("deprecation") -public final class CS_UserDefinedCS extends PropertyType<CS_UserDefinedCS, UserDefinedCS> { +public final class CS_UserDefinedCS extends PropertyType<CS_UserDefinedCS, DefaultUserDefinedCS> { /** * Empty constructor for JAXB only. */ @@ -44,14 +42,14 @@ public final class CS_UserDefinedCS extends PropertyType<CS_UserDefinedCS, UserD * @return {@code UserDefinedCS.class} */ @Override - protected Class<UserDefinedCS> getBoundType() { - return UserDefinedCS.class; + protected Class<DefaultUserDefinedCS> getBoundType() { + return DefaultUserDefinedCS.class; } /** * Constructor for the {@link #wrap} method only. */ - private CS_UserDefinedCS(final UserDefinedCS cs) { + private CS_UserDefinedCS(final DefaultUserDefinedCS cs) { super(cs); } @@ -63,7 +61,7 @@ public final class CS_UserDefinedCS extends PropertyType<CS_UserDefinedCS, UserD * @return a {@code PropertyType} wrapping the given the element. */ @Override - protected CS_UserDefinedCS wrap(final UserDefinedCS cs) { + protected CS_UserDefinedCS wrap(final DefaultUserDefinedCS cs) { return new CS_UserDefinedCS(cs); } @@ -76,7 +74,7 @@ public final class CS_UserDefinedCS extends PropertyType<CS_UserDefinedCS, UserD */ @XmlElement(name = "UserDefinedCS") public DefaultUserDefinedCS getElement() { - return DefaultUserDefinedCS.castOrCopy(metadata); + return metadata; } /** diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AuthorityFactoriesTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AuthorityFactoriesTest.java index 7b24a3965d..1592f40443 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AuthorityFactoriesTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/AuthorityFactoriesTest.java @@ -30,6 +30,7 @@ import org.apache.sis.util.privy.Constants; import org.apache.sis.referencing.internal.EPSGFactoryProxy; import org.apache.sis.referencing.factory.CommonAuthorityFactory; import org.apache.sis.referencing.factory.IdentifiedObjectFinder; +import org.apache.sis.referencing.factory.GeodeticAuthorityFactory; // Test dependencies import org.junit.jupiter.api.Test; @@ -160,7 +161,7 @@ public final class AuthorityFactoriesTest extends TestCaseWithLogs { */ @Test public void testCreateCRS() throws FactoryException { - final CRSAuthorityFactory factory = AuthorityFactories.ALL; + final GeodeticAuthorityFactory factory = AuthorityFactories.ALL; final CRSAuthorityFactory wms = AuthorityFactories.ALL.getAuthorityFactory(CRSAuthorityFactory.class, Constants.OGC, null); CoordinateReferenceSystem actual, expected; diff --git a/geoapi/snapshot b/geoapi/snapshot index c8e052d679..622eb1227c 160000 --- a/geoapi/snapshot +++ b/geoapi/snapshot @@ -1 +1 @@ -Subproject commit c8e052d67955103c0224e2a91c8e5ffe6e751e14 +Subproject commit 622eb1227c8c04cf243747f3426e66565453cbb9