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 439b0075d3bfc67f37f5b58ed7261efa67086fd2
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Mon Feb 7 11:04:24 2022 +0100

    Remove `PoleRotationMock`, replaced by the real operation.
    It forces us to remove the constraint on the θp parameter value.
---
 .../operation/transform/PoleRotation.java          | 16 +++---
 .../referencing/provider/PoleRotationMock.java     | 60 ----------------------
 .../referencing/provider/SeismicBinGridMock.java   |  2 +-
 .../provider/TopocentricConversionMock.java        |  2 +-
 .../operation/transform/PoleRotationTest.java      | 15 ++----
 ...g.opengis.referencing.operation.OperationMethod |  1 -
 6 files changed, 13 insertions(+), 83 deletions(-)

diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
index 4910a94..c522210 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java
@@ -290,6 +290,14 @@ public class PoleRotation extends AbstractMathTransform2D 
implements Serializabl
      * The 0° rotated meridian is defined as the meridian that runs through 
both the geographical and the
      * rotated North pole.
      *
+     * <div class="warning">
+     * The sign of the {@code θp} argument is not yet well determined.
+     * Should it be a rotation clockwise or anti-clockwise?
+     * Looking from northern to southern pole or the opposite direction?
+     * The sign may change in the future if we find an authoritative 
definition.
+     * In the meantime, it is safer to keep the {@code θp} value equal to zero.
+     * </div>
+     *
      * @param  factory  the factory to use for creating the transform.
      * @param  φp       geographic  latitude in degrees of the northern pole 
of the coordinate system.
      * @param  λp       geographic longitude in degrees of the northern pole 
of the coordinate system.
@@ -297,18 +305,10 @@ public class PoleRotation extends AbstractMathTransform2D 
implements Serializabl
      *                  looking from the northern to the southern pole.
      * @return the conversion doing a north pole rotation.
      * @throws FactoryException if an error occurred while creating a 
transform.
-     *
-     * @todo Current implementation does not accept non-zero {@code θp} 
argument value,
-     *       because we have not yet resolved an ambiguity about the sign of 
this parameter.
-     *       Should it be a rotation clockwise or anti-clockwise? Looking from 
northern to
-     *       southern pole or the opposite direction?
      */
     public static MathTransform rotateNorthPole(final MathTransformFactory 
factory,
             final double φp, final double λp, final double θp) throws 
FactoryException
     {
-        if (θp != 0) {
-            throw new IllegalArgumentException("Non-zero axis rotation not yet 
accepted.");
-        }
         final PoleRotation kernel = new PoleRotation(false, φp, λp, θp);
         return kernel.context.completeTransform(factory, kernel);
     }
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
deleted file mode 100644
index bdc9c6e..0000000
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
+++ /dev/null
@@ -1,60 +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.internal.referencing.provider;
-
-import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDescriptorGroup;
-import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.measure.Units;
-
-
-/**
- * The provider for <cite>"Pole rotation"</cite> conversion.
- *
- * This conversion is not yet implemented in Apache SIS, but we need to at 
least accept the parameters
- * for a Well Known Text (WKT) parsing test in the {@link 
org.apache.sis.io.wkt.WKTParserTest} class.
- *
- * <p>This class may be promoted to a real operation if we implement the 
formulas in a future Apache SIS version.</p>
- *
- * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
- * @since   0.6
- * @module
- */
-@SuppressWarnings("serial")
-public final strictfp class PoleRotationMock extends ProviderMock {
-    /**
-     * The group of all parameters expected by this coordinate operation.
-     */
-    private static final ParameterDescriptorGroup PARAMETERS;
-    static {
-        final ParameterBuilder builder = new 
ParameterBuilder().setRequired(true);
-        final ParameterDescriptor<?>[] parameters = {
-            createLatitude (builder.addName("Latitude of rotated pole"), true),
-            createLongitude(builder.addName("Longitude of rotated pole")),
-                            builder.addName("Axis 
rotation").create(Double.NaN, Units.DEGREE)
-        };
-        PARAMETERS = builder.addName("Pole rotation").createGroup(parameters);
-    }
-
-    /**
-     * Creates a new <cite>"Pole rotation"</cite> operation method.
-     */
-    public PoleRotationMock() {
-        super(2, 2, PARAMETERS);
-    }
-}
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
index 03349dc..3fc49f7 100644
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
+++ 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
@@ -62,7 +62,7 @@ public final strictfp class SeismicBinGridMock extends 
ProviderMock {
     }
 
     /**
-     * Creates a new <cite>"Pole rotation"</cite> operation method.
+     * Creates a new <cite>"Seismic bin grid transformation"</cite> operation 
method.
      */
     public SeismicBinGridMock() {
         super(2, 2, PARAMETERS);
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
index 14ed531..c46a448 100644
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
+++ 
b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
@@ -55,7 +55,7 @@ public final strictfp class TopocentricConversionMock extends 
ProviderMock {
     }
 
     /**
-     * Creates a new <cite>"Pole rotation"</cite> operation method.
+     * Creates a new <cite>"Geographic/topocentric conversions"</cite> 
operation method.
      */
     public TopocentricConversionMock() {
         super(3, 3, PARAMETERS);
diff --git 
a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
 
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
index f346857..e489057 100644
--- 
a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
+++ 
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java
@@ -72,7 +72,7 @@ public final strictfp class PoleRotationTest extends 
MathTransformTestCase {
      */
     private void inverseNorthPoleTransform() throws FactoryException, 
TransformException {
         final ParameterValueGroup pg = ((Parameterized) 
transform.inverse()).getParameterValues();
-        rotateNorthPole(
+        transform = PoleRotation.rotateNorthPole(factory(),
                 pg.parameter("grid_north_pole_latitude") .doubleValue(),
                 pg.parameter("grid_north_pole_longitude").doubleValue(),
                 pg.parameter("north_pole_grid_longitude").doubleValue());
@@ -239,15 +239,6 @@ public final strictfp class PoleRotationTest extends 
MathTransformTestCase {
     }
 
     /**
-     * Temporary workaround for {@code PoleRotation.rotateNorthPole(…)} which 
does not accept
-     * non-zero {@code pa} argument. To be deleted after we resolved the sign 
ambiguity.
-     */
-    private void rotateNorthPole(final double φp, final double λp, final 
double pa) throws FactoryException {
-        final PoleRotation kernel = new PoleRotation(false, φp, λp, pa);
-        transform = 
kernel.getContextualParameters().completeTransform(factory(), kernel);
-    }
-
-    /**
      * Tests a rotation of north pole with the pole on arbitrary meridian.
      * Result can be compared with PROJ using the following command, where
      * {@code coords.txt} is a file containing input coordinates in (λ,φ)
@@ -266,7 +257,7 @@ public final strictfp class PoleRotationTest extends 
MathTransformTestCase {
     @Test
     @DependsOnMethod("testRotateNorthPoleOnGreenwich")
     public void testRotateNorthPole() throws FactoryException, 
TransformException {
-        rotateNorthPole(70, 40, 10);
+        transform = PoleRotation.rotateNorthPole(factory(), 70, 40, 10);
         final double[] coordinates = {      // (λ,φ) coordinates to convert.
              0, 54,
             20, 62,
@@ -290,7 +281,7 @@ public final strictfp class PoleRotationTest extends 
MathTransformTestCase {
      */
     @Test
     public void testRotateNorthToOppositeHemisphere() throws FactoryException, 
TransformException {
-        rotateNorthPole(-50, 20, -10);
+        transform = PoleRotation.rotateNorthPole(factory(), -50, 20, -10);
         final double[] coordinates = {      // (λ,φ) coordinates to convert.
              20, -51,
              80, -44,
diff --git 
a/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
 
b/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
index 87c7f18..b6d93bb 100644
--- 
a/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
+++ 
b/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
@@ -1,5 +1,4 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements;
 # and to You under the Apache License, Version 2.0.
-org.apache.sis.internal.referencing.provider.PoleRotationMock
 org.apache.sis.internal.referencing.provider.TopocentricConversionMock
 org.apache.sis.internal.referencing.provider.SeismicBinGridMock

Reply via email to