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
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new 5bfa0612ca Remove usage of `PlanarProjection`, `ConicProjection` and `CylindricalProjection` sub-interfaces. 5bfa0612ca is described below commit 5bfa0612ca40c0a431b16ca937f401fd62b812b4 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Apr 17 11:36:30 2024 +0200 Remove usage of `PlanarProjection`, `ConicProjection` and `CylindricalProjection` sub-interfaces. https://issues.apache.org/jira/browse/SIS-597 --- .../operation/AbstractCoordinateOperation.java | 3 - .../operation/DefaultConicProjection.java | 108 --------------------- .../referencing/operation/DefaultConversion.java | 36 +++---- .../DefaultCoordinateOperationFactory.java | 15 +-- .../operation/DefaultCylindricalProjection.java | 108 --------------------- .../operation/DefaultOperationMethod.java | 5 +- .../operation/DefaultPlanarProjection.java | 108 --------------------- .../referencing/operation/DefaultProjection.java | 13 ++- .../apache/sis/referencing/operation/SubTypes.java | 40 +------- .../operation/provider/AbstractLambert.java | 3 +- .../operation/provider/AbstractMercator.java | 3 +- .../operation/provider/AbstractStereographic.java | 3 +- .../operation/provider/AlbersEqualArea.java | 3 +- .../provider/AzimuthalEquidistantSpherical.java | 3 +- .../operation/provider/CassiniSoldner.java | 3 +- .../operation/provider/Equirectangular.java | 4 +- .../provider/LambertAzimuthalEqualArea.java | 3 +- .../provider/LambertCylindricalEqualArea.java | 3 +- .../LambertCylindricalEqualAreaSpherical.java | 3 +- .../operation/provider/MapProjection.java | 9 +- .../provider/ModifiedAzimuthalEquidistant.java | 3 +- .../referencing/operation/provider/Mollweide.java | 3 +- .../operation/provider/Orthographic.java | 3 +- .../referencing/operation/provider/Polyconic.java | 3 +- .../operation/provider/SatelliteTracking.java | 3 +- .../referencing/operation/provider/Sinusoidal.java | 3 +- .../referencing/factory/sql/EPSGFactoryTest.java | 3 +- .../transform/OperationMethodSetTest.java | 52 +++++----- .../report/CoordinateOperationMethods.java | 19 ++-- geoapi/snapshot | 2 +- 30 files changed, 82 insertions(+), 488 deletions(-) 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 75910575f1..9bd95fe8b8 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 @@ -439,9 +439,6 @@ check: for (int isTarget=0; ; isTarget++) { // 0 == source check; 1 * {@link org.opengis.referencing.operation.Transformation}, * {@link org.opengis.referencing.operation.Conversion}, * {@link org.opengis.referencing.operation.Projection}, - * {@link org.opengis.referencing.operation.CylindricalProjection}, - * {@link org.opengis.referencing.operation.ConicProjection}, - * {@link org.opengis.referencing.operation.PlanarProjection}, * {@link org.opengis.referencing.operation.PassThroughOperation} or * {@link org.opengis.referencing.operation.ConcatenatedOperation}, * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConicProjection.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConicProjection.java deleted file mode 100644 index a801bd6094..0000000000 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConicProjection.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.referencing.operation; - -import java.util.Map; -import jakarta.xml.bind.annotation.XmlTransient; -import org.opengis.util.FactoryException; -import org.opengis.referencing.operation.Conversion; -import org.opengis.referencing.operation.ConicProjection; -import org.opengis.referencing.operation.OperationMethod; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.MathTransformFactory; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ProjectedCRS; - - -/** - * Conical map projections. - * - * @author Martin Desruisseaux (IRD, Geomatys) - * - * @see org.apache.sis.referencing.crs.DefaultProjectedCRS - * @see <a href="https://mathworld.wolfram.com/ConicProjection.html">Conic projection on MathWorld</a> - */ -@XmlTransient -final class DefaultConicProjection extends DefaultProjection implements ConicProjection { - /** - * Serial number for inter-operability with different versions. - */ - private static final long serialVersionUID = -8717453834398763963L; - - /** - * Creates a projection from the given properties. - * - * @param properties the properties to be given to the identified object. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param method the coordinate operation method. - * @param transform transform from positions in the source CRS to positions in the target CRS. - */ - public DefaultConicProjection(final Map<String,?> properties, - final GeographicCRS sourceCRS, - final ProjectedCRS targetCRS, - final OperationMethod method, - final MathTransform transform) - { - super(properties, sourceCRS, targetCRS, method, transform); - } - - /** - * Creates a new projection with the same values as the specified one, together with the - * specified source and target CRS. While the source conversion can be an arbitrary one, it - * is typically a defining conversion. - * - * @param definition the defining conversion. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param factory the factory to use for creating a transform from the parameters or for performing axis changes. - * @param actual an array of length 1 where to store the actual operation method used by the math transform factory. - */ - DefaultConicProjection(final Conversion definition, - final CoordinateReferenceSystem sourceCRS, - final CoordinateReferenceSystem targetCRS, - final MathTransformFactory factory, - final OperationMethod[] actual) throws FactoryException - { - super(definition, sourceCRS, targetCRS, factory, actual); - } - - /** - * Creates a new coordinate operation 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 operation the coordinate operation to copy. - */ - protected DefaultConicProjection(final ConicProjection operation) { - super(operation); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code ConicProjection.class}. - * - * @return {@code ConicProjection.class}. - */ - @Override - public Class<? extends ConicProjection> getInterface() { - return ConicProjection.class; - } -} diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConversion.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConversion.java index 6ec4bc2908..4c383dff45 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConversion.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConversion.java @@ -23,6 +23,7 @@ import javax.measure.IncommensurableException; import org.opengis.util.FactoryException; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.operation.Conversion; +import org.opengis.referencing.operation.Projection; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.MathTransformFactory; @@ -65,9 +66,7 @@ import org.apache.sis.util.resources.Errors; * <p>After the source and target CRS become known, we can invoke the {@link #specialize specialize(…)} method for * {@linkplain DefaultMathTransformFactory#createParameterizedTransform creating a math transform from the parameters}, * instantiate a new {@code Conversion} of a more specific type - * ({@link org.opengis.referencing.operation.ConicProjection}, - * {@link org.opengis.referencing.operation.CylindricalProjection} or - * {@link org.opengis.referencing.operation.PlanarProjection}) if possible, + * ({@link org.opengis.referencing.operation.Projection}) if relevant, * and assign the source and target CRS to it.</p> * * <h2>Immutability and thread safety</h2> @@ -319,15 +318,6 @@ public class DefaultConversion extends AbstractSingleOperation implements Conver * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> - * <li>Otherwise if the given object is an instance of - * {@link org.opengis.referencing.operation.Conversion}, - * {@link org.opengis.referencing.operation.Projection}, - * {@link org.opengis.referencing.operation.CylindricalProjection}, - * {@link org.opengis.referencing.operation.ConicProjection} or - * {@link org.opengis.referencing.operation.PlanarProjection}, - * 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> * <li>Otherwise if the given object is already an instance of * {@code DefaultConversion}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultConversion} instance is created using the @@ -341,13 +331,19 @@ public class DefaultConversion extends AbstractSingleOperation implements Conver * given object itself), or {@code null} if the argument was null. */ public static DefaultConversion castOrCopy(final Conversion object) { - return SubTypes.forConversion(object); + if (object == null || object instanceof DefaultConversion) { + return (DefaultConversion) object; + } + if (object instanceof Projection) { + return new DefaultProjection((Projection) object); + } else { + return new DefaultConversion(object); + } } /** * Returns the GeoAPI interface implemented by this class. * The default implementation returns {@code Conversion.class}. - * Subclasses implementing a more specific GeoAPI interface shall override this method. * * @return the conversion interface implemented by this class. */ @@ -357,7 +353,7 @@ public class DefaultConversion extends AbstractSingleOperation implements Conver } /** - * Returns a specialization of this conversion with a more specific type, source and target CRS. + * Returns a specialization of this conversion with a more specific type and non-null <abbr>CRS</abbr>s. * This {@code specialize(…)} method is typically invoked on {@linkplain #DefaultConversion(Map, * OperationMethod, MathTransform, ParameterValueGroup) defining conversion} instances, * when more information become available about the conversion to create. @@ -366,14 +362,12 @@ public class DefaultConversion extends AbstractSingleOperation implements Conver * <ul> * <li><code>{@linkplain org.opengis.referencing.operation.Conversion}.class</code></li> * <li><code>{@linkplain org.opengis.referencing.operation.Projection}.class</code></li> - * <li><code>{@linkplain org.opengis.referencing.operation.CylindricalProjection}.class</code></li> - * <li><code>{@linkplain org.opengis.referencing.operation.ConicProjection}.class</code></li> - * <li><code>{@linkplain org.opengis.referencing.operation.PlanarProjection}.class</code></li> * </ul> * * This {@code specialize(…)} method returns a conversion which implement at least the given {@code baseType} - * interface, but may also implement a more specific GeoAPI interface if {@code specialize(…)} has been able - * to infer the type from the {@linkplain #getMethod() operation method}. + * interface, but may also implement a more specific interface if {@code specialize(…)} has been able to infer + * the type from the {@linkplain #getMethod() operation method}. + * The list of interfaces supported by this method may change in any version of Apache SIS. * * @param <T> compile-time type of the {@code baseType} argument. * @param baseType the base GeoAPI interface to be implemented by the conversion to return. @@ -381,7 +375,7 @@ public class DefaultConversion extends AbstractSingleOperation implements Conver * @param targetCRS the target CRS. * @param factory the factory to use for creating a transform from the parameters or for performing axis changes, * or {@code null} for the default factory. - * @return the conversion of the given type between the given CRS. + * @return conversion of the given type which declares the given <abbr>CRS</abbr>s as the source and target. * @throws ClassCastException if a contradiction is found between the given {@code baseType}, * the defining {@linkplain DefaultConversion#getInterface() conversion type} and * the {@linkplain DefaultOperationMethod#getOperationType() method operation type}. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java index b4f4c42b55..1903225188 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java @@ -456,8 +456,7 @@ next: for (int i=components.size(); --i >= 0;) { /** * Creates a transformation or conversion from the given properties. * This method infers by itself if the operation to create is a - * {@link Transformation}, a {@link Conversion} or a {@link Projection} sub-type - * ({@link CylindricalProjection}, {@link ConicProjection} or {@link PlanarProjection}) + * {@link Transformation}, a {@link Conversion} or a {@link Projection} * using the {@linkplain DefaultOperationMethod#getOperationType() information provided by the given method}. * * <p>The properties given in argument follow the same rules as for the @@ -593,17 +592,7 @@ next: for (int i=components.size(); --i >= 0;) { throw new IllegalArgumentException(Errors.format( Errors.Keys.ForbiddenAttribute_2, "interpolationCRS", baseType)); } - final GeographicCRS baseCRS = (GeographicCRS) sourceCRS; - final ProjectedCRS crs = (ProjectedCRS) targetCRS; - if (CylindricalProjection.class.isAssignableFrom(baseType)) { - op = new DefaultCylindricalProjection(properties, baseCRS, crs, method, transform); - } else if (ConicProjection.class.isAssignableFrom(baseType)) { - op = new DefaultConicProjection(properties, baseCRS, crs, method, transform); - } else if (PlanarProjection.class.isAssignableFrom(baseType)) { - op = new DefaultPlanarProjection(properties, baseCRS, crs, method, transform); - } else { - op = new DefaultProjection(properties, baseCRS, crs, method, transform); - } + op = new DefaultProjection(properties, (GeographicCRS) sourceCRS, (ProjectedCRS) targetCRS, method, transform); } else if (Conversion.class.isAssignableFrom(baseType)) { op = new DefaultConversion(properties, sourceCRS, targetCRS, interpolationCRS, method, transform); } else { // See above comment about this last-resort fallback. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java deleted file mode 100644 index cd5de1372f..0000000000 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultCylindricalProjection.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.referencing.operation; - -import java.util.Map; -import jakarta.xml.bind.annotation.XmlTransient; -import org.opengis.util.FactoryException; -import org.opengis.referencing.operation.Conversion; -import org.opengis.referencing.operation.CylindricalProjection; -import org.opengis.referencing.operation.OperationMethod; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.MathTransformFactory; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ProjectedCRS; - - -/** - * Cylindrical map projections. - * - * @author Martin Desruisseaux (IRD, Geomatys) - * - * @see org.apache.sis.referencing.crs.DefaultProjectedCRS - * @see <a href="https://mathworld.wolfram.com/CylindricalProjection.html">Cylindrical projection on MathWorld</a> - */ -@XmlTransient -final class DefaultCylindricalProjection extends DefaultProjection implements CylindricalProjection { - /** - * Serial number for inter-operability with different versions. - */ - private static final long serialVersionUID = -969486613826553580L; - - /** - * Creates a projection from the given properties. - * - * @param properties the properties to be given to the identified object. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param method the coordinate operation method. - * @param transform transform from positions in the source CRS to positions in the target CRS. - */ - public DefaultCylindricalProjection(final Map<String,?> properties, - final GeographicCRS sourceCRS, - final ProjectedCRS targetCRS, - final OperationMethod method, - final MathTransform transform) - { - super(properties, sourceCRS, targetCRS, method, transform); - } - - /** - * Creates a new projection with the same values as the specified one, together with the - * specified source and target CRS. While the source conversion can be an arbitrary one, it - * is typically a defining conversion. - * - * @param definition the defining conversion. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param factory the factory to use for creating a transform from the parameters or for performing axis changes. - * @param actual an array of length 1 where to store the actual operation method used by the math transform factory. - */ - DefaultCylindricalProjection(final Conversion definition, - final CoordinateReferenceSystem sourceCRS, - final CoordinateReferenceSystem targetCRS, - final MathTransformFactory factory, - final OperationMethod[] actual) throws FactoryException - { - super(definition, sourceCRS, targetCRS, factory, actual); - } - - /** - * Creates a new coordinate operation 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 operation the coordinate operation to copy. - */ - protected DefaultCylindricalProjection(final CylindricalProjection operation) { - super(operation); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code CylindricalProjection.class}. - * - * @return {@code CylindricalProjection.class}. - */ - @Override - public Class<? extends CylindricalProjection> getInterface() { - return CylindricalProjection.class; - } -} diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java index f8f1f15bf3..60ace525eb 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultOperationMethod.java @@ -343,10 +343,7 @@ public class DefaultOperationMethod extends AbstractIdentifiedObject implements * point arithmetic (including rounding errors) and the approximations implied by finite series expansions.</li> * <li>{@link org.opengis.referencing.operation.Projection} * if the coordinate operation is a conversion (as defined above) converting geodetic latitudes and longitudes - * to plane (map) coordinates. This type can optionally be refined with one of the - * {@link org.opengis.referencing.operation.CylindricalProjection}, - * {@link org.opengis.referencing.operation.ConicProjection} or - * {@link org.opengis.referencing.operation.PlanarProjection} subtypes.</li> + * to plane (map) coordinates.</li> * </ul> * * In case of doubt, {@code getOperationType()} can conservatively return the base type. diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPlanarProjection.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPlanarProjection.java deleted file mode 100644 index f8abdb043a..0000000000 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultPlanarProjection.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.sis.referencing.operation; - -import java.util.Map; -import jakarta.xml.bind.annotation.XmlTransient; -import org.opengis.util.FactoryException; -import org.opengis.referencing.operation.Conversion; -import org.opengis.referencing.operation.PlanarProjection; -import org.opengis.referencing.operation.OperationMethod; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.MathTransformFactory; -import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.crs.GeographicCRS; -import org.opengis.referencing.crs.ProjectedCRS; - - -/** - * Azimuthal (or planar) map projections. - * - * @author Martin Desruisseaux (IRD, Geomatys) - * - * @see org.apache.sis.referencing.crs.DefaultProjectedCRS - * @see <a href="https://mathworld.wolfram.com/AzimuthalProjection.html">Azimuthal projection on MathWorld</a> - */ -@XmlTransient -final class DefaultPlanarProjection extends DefaultProjection implements PlanarProjection { - /** - * Serial number for inter-operability with different versions. - */ - private static final long serialVersionUID = 8171256287775067736L; - - /** - * Creates a projection from the given properties. - * - * @param properties the properties to be given to the identified object. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param method the coordinate operation method. - * @param transform transform from positions in the source CRS to positions in the target CRS. - */ - public DefaultPlanarProjection(final Map<String,?> properties, - final GeographicCRS sourceCRS, - final ProjectedCRS targetCRS, - final OperationMethod method, - final MathTransform transform) - { - super(properties, sourceCRS, targetCRS, method, transform); - } - - /** - * Creates a new projection with the same values as the specified one, together with the - * specified source and target CRS. While the source conversion can be an arbitrary one, it - * is typically a defining conversion. - * - * @param definition the defining conversion. - * @param sourceCRS the source CRS. - * @param targetCRS the target CRS. - * @param factory the factory to use for creating a transform from the parameters or for performing axis changes. - * @param actual an array of length 1 where to store the actual operation method used by the math transform factory. - */ - DefaultPlanarProjection(final Conversion definition, - final CoordinateReferenceSystem sourceCRS, - final CoordinateReferenceSystem targetCRS, - final MathTransformFactory factory, - final OperationMethod[] actual) throws FactoryException - { - super(definition, sourceCRS, targetCRS, factory, actual); - } - - /** - * Creates a new coordinate operation 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 operation the coordinate operation to copy. - */ - protected DefaultPlanarProjection(final PlanarProjection operation) { - super(operation); - } - - /** - * Returns the GeoAPI interface implemented by this class. - * The SIS implementation returns {@code PlanarProjection.class}. - * - * @return {@code PlanarProjection.class}. - */ - @Override - public Class<? extends PlanarProjection> getInterface() { - return PlanarProjection.class; - } -} diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultProjection.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultProjection.java index 337f5591b6..fe4ab2a377 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultProjection.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultProjection.java @@ -51,7 +51,7 @@ import org.apache.sis.util.ArgumentChecks; * @see org.apache.sis.referencing.crs.DefaultProjectedCRS */ @XmlTransient -class DefaultProjection extends DefaultConversion implements Projection { +final class DefaultProjection extends DefaultConversion implements Projection { /** * Serial number for inter-operability with different versions. */ @@ -77,14 +77,15 @@ class DefaultProjection extends DefaultConversion implements Projection { /** * Creates a new projection with the same values as the specified one, together with the - * specified source and target CRS. While the source conversion can be an arbitrary one, it - * is typically a defining conversion. + * specified source and target CRS. While the source conversion can be an arbitrary one, + * it is typically a defining conversion. * * @param definition the defining conversion. * @param sourceCRS the source CRS. * @param targetCRS the target CRS. * @param factory the factory to use for creating a transform from the parameters or for performing axis changes. * @param actual an array of length 1 where to store the actual operation method used by the math transform factory. + * @throws IllegalArgumentException if the source or targe CRS is not of the requested type. */ DefaultProjection(final Conversion definition, final CoordinateReferenceSystem sourceCRS, @@ -99,8 +100,8 @@ class DefaultProjection extends DefaultConversion implements Projection { /** * Creates a new coordinate operation 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. + * This copy constructor provides a way to convert an arbitrary implementation + * into a SIS one, usually in order to leverage some implementation-specific API. * * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> * @@ -112,8 +113,6 @@ class DefaultProjection extends DefaultConversion implements Projection { /** * Returns the GeoAPI interface implemented by this class. - * The default implementation returns {@code Projection.class}. - * Subclasses implementing a more specific GeoAPI interface shall override this method. * * @return the conversion interface implemented by this class. */ diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubTypes.java index 2bcfa060b7..c17d8883d6 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/SubTypes.java @@ -53,7 +53,7 @@ final class SubTypes { return DefaultTransformation.castOrCopy((Transformation) object); } if (object instanceof Conversion) { - return forConversion((Conversion) object); + return DefaultConversion.castOrCopy((Conversion) object); } if (object instanceof PassThroughOperation) { return DefaultPassThroughOperation.castOrCopy((PassThroughOperation) object); @@ -77,38 +77,8 @@ final class SubTypes { return new AbstractCoordinateOperation(object); } - /** - * Returns a SIS implementation for the given conversion. - * - * @see DefaultConversion#castOrCopy(Conversion) - */ - static DefaultConversion forConversion(final Conversion object) { - if (object instanceof CylindricalProjection) { - return (object instanceof DefaultCylindricalProjection) ? ((DefaultCylindricalProjection) object) - : new DefaultCylindricalProjection((CylindricalProjection) object); - } - if (object instanceof ConicProjection) { - return (object instanceof DefaultConicProjection) ? ((DefaultConicProjection) object) - : new DefaultConicProjection((ConicProjection) object); - } - if (object instanceof PlanarProjection) { - return (object instanceof DefaultPlanarProjection) ? ((DefaultPlanarProjection) object) - : new DefaultPlanarProjection((PlanarProjection) object); - } - if (object instanceof Projection) { - return (object instanceof DefaultProjection) ? ((DefaultProjection) object) - : new DefaultProjection((Projection) object); - } - if (object == null || object instanceof DefaultConversion) { - return (DefaultConversion) object; - } - return new DefaultConversion(object); - } - /** * Returns a conversion from the specified defining conversion. - * The new conversion will be a more specific type like a {@linkplain PlanarProjection planar}, - * {@linkplain CylindricalProjection cylindrical} or {@linkplain ConicProjection conic projection}. * The returned conversion will implement at least the {@code baseType} interface, but may implement * a more specific GeoAPI interface if this method has been able to infer the type from the * {@code conversion} argument. @@ -153,13 +123,7 @@ final class SubTypes { boolean tryAgain; do { tryAgain = false; - if (CylindricalProjection.class.isAssignableFrom(type)) { - conversion = new DefaultCylindricalProjection(definition, sourceCRS, targetCRS, factory, actual); - } else if (ConicProjection.class.isAssignableFrom(type)) { - conversion = new DefaultConicProjection(definition, sourceCRS, targetCRS, factory, actual); - } else if (PlanarProjection.class.isAssignableFrom(type)) { - conversion = new DefaultPlanarProjection(definition, sourceCRS, targetCRS, factory, actual); - } else if (Projection.class.isAssignableFrom(type)) { + if (Projection.class.isAssignableFrom(type)) { conversion = new DefaultProjection(definition, sourceCRS, targetCRS, factory, actual); } else { conversion = new DefaultConversion(definition, sourceCRS, targetCRS, factory, actual); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractLambert.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractLambert.java index 7415f3b168..cf1d00d4c6 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractLambert.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractLambert.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.ConicProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.LambertConicConformal; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -75,7 +74,7 @@ class AbstractLambert extends MapProjection { * For subclass constructors only. */ AbstractLambert(final ParameterDescriptorGroup parameters) { - super(ConicProjection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractMercator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractMercator.java index aaf5761375..8f504819aa 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractMercator.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractMercator.java @@ -21,7 +21,6 @@ import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.GeneralParameterDescriptor; -import org.opengis.referencing.operation.CylindricalProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.Mercator; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -94,7 +93,7 @@ class AbstractMercator extends MapProjection { * For subclass constructors only. */ AbstractMercator(final ParameterDescriptorGroup parameters) { - super(CylindricalProjection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractStereographic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractStereographic.java index a5117e7b7d..1d2acc3ff5 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractStereographic.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AbstractStereographic.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.PlanarProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.NormalizedProjection; import org.apache.sis.referencing.operation.projection.PolarStereographic; @@ -75,7 +74,7 @@ abstract class AbstractStereographic extends MapProjection { * For subclass constructors only. */ AbstractStereographic(final ParameterDescriptorGroup parameters) { - super(PlanarProjection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AlbersEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AlbersEqualArea.java index aaf3a764e5..124b227dd5 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AlbersEqualArea.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AlbersEqualArea.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.ConicProjection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; @@ -246,7 +245,7 @@ public final class AlbersEqualArea extends MapProjection { * Constructs a new provider. */ public AlbersEqualArea() { - super(ConicProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AzimuthalEquidistantSpherical.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AzimuthalEquidistantSpherical.java index 1f332c8b47..a6983e18cd 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AzimuthalEquidistantSpherical.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/AzimuthalEquidistantSpherical.java @@ -18,7 +18,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.PlanarProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -56,7 +55,7 @@ public final class AzimuthalEquidistantSpherical extends MapProjection { * Constructs a new provider. */ public AzimuthalEquidistantSpherical() { - super(PlanarProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/CassiniSoldner.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/CassiniSoldner.java index 536610fd2e..e65cc74d51 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/CassiniSoldner.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/CassiniSoldner.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.Projection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.referencing.operation.projection.NormalizedProjection; import org.apache.sis.parameter.Parameters; @@ -165,7 +164,7 @@ public class CassiniSoldner extends MapProjection { * Constructs a provider from a set of parameters. */ CassiniSoldner(final ParameterDescriptorGroup parameters) { - super(Projection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Equirectangular.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Equirectangular.java index bea52f75b7..46ed35bf62 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Equirectangular.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Equirectangular.java @@ -25,7 +25,7 @@ import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.cs.EllipsoidalCS; -import org.opengis.referencing.operation.CylindricalProjection; +import org.opengis.referencing.operation.Projection; import org.opengis.referencing.operation.MathTransform; import org.apache.sis.parameter.Parameters; import org.apache.sis.parameter.ParameterBuilder; @@ -270,7 +270,7 @@ public final class Equirectangular extends AbstractProvider { * @see MapProjection#MapProjection(Class, ParameterDescriptorGroup) */ public Equirectangular() { - super(CylindricalProjection.class, PARAMETERS, + super(Projection.class, PARAMETERS, EllipsoidalCS.class, true, CartesianCS.class, false, (byte) 2); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertAzimuthalEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertAzimuthalEqualArea.java index d16276e27d..950fefc9e4 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertAzimuthalEqualArea.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertAzimuthalEqualArea.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.PlanarProjection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; @@ -157,7 +156,7 @@ public class LambertAzimuthalEqualArea extends MapProjection { * @param parameters the set of parameters (never {@code null}). */ LambertAzimuthalEqualArea(final ParameterDescriptorGroup parameters) { - super(PlanarProjection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualArea.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualArea.java index 11060b8207..f56aee9761 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualArea.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualArea.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.CylindricalProjection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -160,7 +159,7 @@ public final class LambertCylindricalEqualArea extends MapProjection { * Constructs a new provider. */ public LambertCylindricalEqualArea() { - super(CylindricalProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualAreaSpherical.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualAreaSpherical.java index 7610dd0d4c..b277794c34 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualAreaSpherical.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/LambertCylindricalEqualAreaSpherical.java @@ -18,7 +18,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.CylindricalProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.NormalizedProjection; import org.apache.sis.referencing.operation.projection.CylindricalEqualArea; @@ -61,7 +60,7 @@ public final class LambertCylindricalEqualAreaSpherical extends MapProjection { * Constructs a new provider. */ public LambertCylindricalEqualAreaSpherical() { - super(CylindricalProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/MapProjection.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/MapProjection.java index 5d8af20bed..09ef70ddd3 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/MapProjection.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/MapProjection.java @@ -170,13 +170,10 @@ public abstract class MapProjection extends AbstractProvider { * Constructs a math transform provider from a set of parameters. The provider * {@linkplain #getIdentifiers() identifiers} will be the same as the parameter ones. * - * @param operationType interface of the {@code CoordinateOperation} instances that use this projection. - * @param parameters the set of parameters (never {@code null}). + * @param parameters the set of parameters (never {@code null}). */ - protected MapProjection(final Class<? extends Projection> operationType, - final ParameterDescriptorGroup parameters) - { - super(operationType, parameters, + protected MapProjection(final ParameterDescriptorGroup parameters) { + super(Projection.class, parameters, EllipsoidalCS.class, true, CartesianCS.class, false, (byte) 2); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/ModifiedAzimuthalEquidistant.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/ModifiedAzimuthalEquidistant.java index 4646a561f2..7b06e0f82c 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/ModifiedAzimuthalEquidistant.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/ModifiedAzimuthalEquidistant.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.PlanarProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.metadata.iso.citation.Citations; @@ -151,7 +150,7 @@ public final class ModifiedAzimuthalEquidistant extends MapProjection { * Constructs a new provider. */ public ModifiedAzimuthalEquidistant() { - super(PlanarProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Mollweide.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Mollweide.java index 6fd95c4b2a..4d790853ac 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Mollweide.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Mollweide.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.Projection; import org.apache.sis.parameter.Parameters; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -108,7 +107,7 @@ public final class Mollweide extends MapProjection { * Constructs a new provider. */ public Mollweide() { - super(Projection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Orthographic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Orthographic.java index e35285d713..ef812a8dc5 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Orthographic.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Orthographic.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.PlanarProjection; import org.apache.sis.parameter.Parameters; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.metadata.iso.citation.Citations; @@ -168,7 +167,7 @@ public class Orthographic extends MapProjection { * Constructs a new provider. */ public Orthographic() { - super(PlanarProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Polyconic.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Polyconic.java index c94f5488cd..caad6a9cad 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Polyconic.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Polyconic.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.ConicProjection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.projection.NormalizedProjection; @@ -132,7 +131,7 @@ public class Polyconic extends MapProjection { * Constructs a new provider. */ public Polyconic() { - super(ConicProjection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/SatelliteTracking.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/SatelliteTracking.java index fcd3267c89..8e904627b1 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/SatelliteTracking.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/SatelliteTracking.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.Projection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; @@ -177,7 +176,7 @@ public class SatelliteTracking extends MapProjection { * Constructs a new provider. */ public SatelliteTracking() { - super(Projection.class, PARAMETERS); + super(PARAMETERS); } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Sinusoidal.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Sinusoidal.java index 18674f2510..5ed40a2500 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Sinusoidal.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/provider/Sinusoidal.java @@ -19,7 +19,6 @@ package org.apache.sis.referencing.operation.provider; import jakarta.xml.bind.annotation.XmlTransient; import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.Projection; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.util.privy.Constants; import org.apache.sis.parameter.Parameters; @@ -115,7 +114,7 @@ public class Sinusoidal extends MapProjection { * @param parameters the set of parameters (never {@code null}). */ Sinusoidal(final ParameterDescriptorGroup parameters) { - super(Projection.class, parameters); + super(parameters); } /** diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java index c754bc93af..a71ea42375 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java @@ -40,7 +40,6 @@ import org.opengis.referencing.datum.VerticalDatum; import org.opengis.referencing.operation.Conversion; import org.opengis.referencing.operation.Transformation; import org.opengis.referencing.operation.CoordinateOperation; -import org.opengis.referencing.operation.CylindricalProjection; import org.opengis.referencing.operation.SingleOperation; import org.opengis.referencing.operation.OperationMethod; import org.opengis.referencing.operation.MathTransform; @@ -753,7 +752,7 @@ public final class EPSGFactoryTest extends TestCaseWithLogs { assertNotSame(projection, operation, "The defining conversion and the actual conversion should differ " + "because the actual conversion should have semi-axis length values."); - assertInstanceOf(CylindricalProjection.class, projection); + assertInstanceOf(Projection.class, projection); assertNotNull(projection.getSourceCRS()); assertNotNull(projection.getTargetCRS()); assertNotNull(projection.getMathTransform()); diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/OperationMethodSetTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/OperationMethodSetTest.java index 587c3a6910..b6a07c54f1 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/OperationMethodSetTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/transform/OperationMethodSetTest.java @@ -21,11 +21,11 @@ import java.util.Map; import java.util.Iterator; import java.util.NoSuchElementException; import org.opengis.parameter.ParameterDescriptorGroup; -import org.opengis.referencing.operation.Projection; -import org.opengis.referencing.operation.ConicProjection; -import org.opengis.referencing.operation.PlanarProjection; -import org.opengis.referencing.operation.CylindricalProjection; +import org.opengis.referencing.operation.Conversion; +import org.opengis.referencing.operation.Transformation; import org.opengis.referencing.operation.OperationMethod; +import org.opengis.referencing.operation.SingleOperation; +import org.opengis.referencing.operation.PointMotionOperation; import org.apache.sis.referencing.operation.DefaultOperationMethod; import org.apache.sis.parameter.DefaultParameterDescriptorGroup; import org.apache.sis.util.privy.UnmodifiableArrayList; @@ -56,7 +56,7 @@ public final class OperationMethodSetTest extends TestCase { * @return the operation method. */ @SuppressWarnings("serial") - private static DefaultOperationMethod createMethod(final Class<? extends Projection> type, final String method) { + private static DefaultOperationMethod createMethod(final Class<? extends SingleOperation> type, String method) { Map<String,?> properties = Map.of(DefaultOperationMethod.NAME_KEY, method); final ParameterDescriptorGroup parameters = new DefaultParameterDescriptorGroup(properties, 1, 1); /* @@ -65,7 +65,7 @@ public final class OperationMethodSetTest extends TestCase { */ properties = Map.of(DefaultOperationMethod.NAME_KEY, parameters.getName()); return new DefaultOperationMethod(properties, parameters) { - @Override public Class<? extends Projection> getOperationType() { + @Override public Class<? extends SingleOperation> getOperationType() { return type; } }; @@ -78,7 +78,9 @@ public final class OperationMethodSetTest extends TestCase { * @param type the type of coordinate operation for which to retain methods. * @param methods the {@link DefaultMathTransformFactory#methods} used for fetching the initial methods. */ - private static OperationMethodSet create(final Class<? extends Projection> type, final DefaultOperationMethod... methods) { + private static OperationMethodSet create(final Class<? extends SingleOperation> type, + final DefaultOperationMethod... methods) + { @SuppressWarnings("serial") final Iterable<DefaultOperationMethod> asList = new UnmodifiableArrayList<DefaultOperationMethod>(methods) { private boolean isIterationDone; @@ -100,7 +102,7 @@ public final class OperationMethodSetTest extends TestCase { */ @Test public void testEmpty() { - assertEmpty(create(Projection.class)); + assertEmpty(create(Conversion.class)); } /** @@ -120,18 +122,18 @@ public final class OperationMethodSetTest extends TestCase { */ @Test public void testMixedCases() { - final DefaultOperationMethod merA = createMethod(CylindricalProjection.class, "Mercator (variant A)"); - final DefaultOperationMethod merB = createMethod(CylindricalProjection.class, "Mercator (variant B)"); - final DefaultOperationMethod merC = createMethod(CylindricalProjection.class, "Mercator (variant C)"); - final DefaultOperationMethod dup = createMethod(CylindricalProjection.class, "Mercator (variant B)"); - final DefaultOperationMethod lamb = createMethod(ConicProjection.class, "Lambert"); - final DefaultOperationMethod[] methods = new DefaultOperationMethod[] {merA, merB, merC, dup, lamb}; - final OperationMethodSet mercators = create(CylindricalProjection.class, methods); - final OperationMethodSet lambert = create( ConicProjection.class, methods); - final OperationMethodSet all = create( Projection.class, methods); + final DefaultOperationMethod merA = createMethod(Conversion.class, "Mercator (variant A)"); + final DefaultOperationMethod merB = createMethod(Conversion.class, "Mercator (variant B)"); + final DefaultOperationMethod merC = createMethod(Conversion.class, "Mercator (variant C)"); + final DefaultOperationMethod dup = createMethod(Conversion.class, "Mercator (variant B)"); + final DefaultOperationMethod nad = createMethod(Transformation.class, "NADCON"); + final var methods = new DefaultOperationMethod[] {merA, merB, merC, dup, nad}; + final OperationMethodSet mercators = create(Conversion.class, methods); + final OperationMethodSet shifts = create(Transformation.class, methods); + final OperationMethodSet all = create(SingleOperation.class, methods); /* * Mercator case. - * - Intentionally start the iteration without checking 'hasNext()' - the iterator shall be robust to that. + * - Intentionally start the iteration without checking `hasNext()` - the iterator shall be robust to that. * - Intentionally start another iteration (indirectly) in the middle of the first one. */ final Iterator<OperationMethod> iterator = mercators.iterator(); @@ -143,19 +145,19 @@ public final class OperationMethodSetTest extends TestCase { assertFalse (mercators.isEmpty()); assertEquals(3, mercators.size()); /* - * Lambert case. Test twice since the two excecutions will take different code paths. + * NADCON case. Test twice because the two excecutions will take different code paths. */ - assertEquals(Set.of(lamb), lambert); - assertEquals(Set.of(lamb), lambert); + assertEquals(Set.of(nad), shifts); + assertEquals(Set.of(nad), shifts); /* - * Test filtering: the test should not contain any conic projection. + * Test filtering: the test should not contain any point motion operation. */ - assertEmpty(create(PlanarProjection.class, methods)); + assertEmpty(create(PointMotionOperation.class, methods)); /* * Opportunist tests. */ - assertFalse(lambert.containsAll(all)); - assertTrue(all.containsAll(lambert)); + assertFalse(shifts.containsAll(all)); + assertTrue(all.containsAll(shifts)); assertTrue(all.containsAll(mercators)); } } diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateOperationMethods.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateOperationMethods.java index 5bea3d2068..d649065fe5 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateOperationMethods.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateOperationMethods.java @@ -100,8 +100,7 @@ public class CoordinateOperationMethods extends HTMLGenerator { /** * Values returned by {@link #category(OperationMethod)}. */ - private static final int CYLINDRICAL_PROJECTION = 1, CONIC_PROJECTION = 2, - PLANAR_PROJECTION = 3, CONVERSION = 4, TRANSFORMATION = 5; + private static final int PROJECTION = 1, CONVERSION = 2, TRANSFORMATION = 3; /** * Parameters to default to the latitude of origin. We can hardly detect those cases @@ -193,11 +192,9 @@ public class CoordinateOperationMethods extends HTMLGenerator { closeTags(innerUL); reopenTag("li"); switch (nc) { - case CYLINDRICAL_PROJECTION: println("Cylindrical projections"); break; - case CONIC_PROJECTION: println("Conic projections"); break; - case PLANAR_PROJECTION: println("Planar projections"); break; - case CONVERSION: println("Conversions"); break; - case TRANSFORMATION: println("Tranformations"); break; + case PROJECTION: println("Projections"); break; + case CONVERSION: println("Conversions"); break; + case TRANSFORMATION: println("Tranformations"); break; default: throw new AssertionError(category); } innerUL = openTag("ul"); @@ -525,11 +522,9 @@ public class CoordinateOperationMethods extends HTMLGenerator { */ private static int category(final OperationMethod method) { final Class<?> c = getOperationType((DefaultOperationMethod) method); - if (CylindricalProjection.class.isAssignableFrom(c)) return CYLINDRICAL_PROJECTION; - if (ConicProjection .class.isAssignableFrom(c)) return CONIC_PROJECTION; - if (PlanarProjection .class.isAssignableFrom(c)) return PLANAR_PROJECTION; - if (Conversion .class.isAssignableFrom(c)) return CONVERSION; - if (Transformation .class.isAssignableFrom(c)) return TRANSFORMATION; + if (Projection .class.isAssignableFrom(c)) return PROJECTION; + if (Conversion .class.isAssignableFrom(c)) return CONVERSION; + if (Transformation.class.isAssignableFrom(c)) return TRANSFORMATION; return 0; } diff --git a/geoapi/snapshot b/geoapi/snapshot index ada952e12e..535e3e0647 160000 --- a/geoapi/snapshot +++ b/geoapi/snapshot @@ -1 +1 @@ -Subproject commit ada952e12e675417e67d13b1a404b62a49b23546 +Subproject commit 535e3e0647e8849d4dead1ced6f622428b539ffd