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 4080d18a4d427ac988b4bc6edb1cb0be863431b2 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Mon Jan 31 12:15:59 2022 +0100 Rename `RotatedPole` as `PoleRotation` for consistency with EPSG database usage (e.g. "Longitude rotation") and with example in ISO 19162. --- ...otatedNorthPole.java => NorthPoleRotation.java} | 10 ++++---- ...otatedSouthPole.java => SouthPoleRotation.java} | 10 ++++---- .../{RotatedPole.java => PoleRotation.java} | 28 +++++++++++----------- ...g.opengis.referencing.operation.OperationMethod | 4 ++-- .../referencing/provider/ProvidersTest.java | 4 ++-- ...{RotatedPoleTest.java => PoleRotationTest.java} | 28 +++++++++++----------- .../sis/test/suite/ReferencingTestSuite.java | 2 +- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedNorthPole.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NorthPoleRotation.java similarity index 94% rename from core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedNorthPole.java rename to core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NorthPoleRotation.java index ba921ad..53efb43 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedNorthPole.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NorthPoleRotation.java @@ -23,7 +23,7 @@ import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.MathTransformFactory; -import org.apache.sis.referencing.operation.transform.RotatedPole; +import org.apache.sis.referencing.operation.transform.PoleRotation; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; @@ -51,7 +51,7 @@ import org.apache.sis.measure.Units; * @module */ @XmlTransient -public final class RotatedNorthPole extends AbstractProvider { +public final class NorthPoleRotation extends AbstractProvider { /** * For cross-version compatibility. */ @@ -122,7 +122,7 @@ public final class RotatedNorthPole extends AbstractProvider { PARAMETERS = builder.setRequired(true) .addName("rotated_latitude_longitude") - .createGroup(GRID_POLE_LATITUDE, // Note: `RotatedPole` implementation depends on this parameter order. + .createGroup(GRID_POLE_LATITUDE, // Note: `PoleRotation` implementation depends on this parameter order. GRID_POLE_LONGITUDE, GRID_POLE_ANGLE); } @@ -130,7 +130,7 @@ public final class RotatedNorthPole extends AbstractProvider { /** * Constructs a new provider. */ - public RotatedNorthPole() { + public NorthPoleRotation() { super(2, 2, PARAMETERS); } @@ -147,7 +147,7 @@ public final class RotatedNorthPole extends AbstractProvider { throws FactoryException { final Parameters p = Parameters.castOrWrap(parameters); - return RotatedPole.rotateNorthPole(factory, + return PoleRotation.rotateNorthPole(factory, p.getValue(GRID_POLE_LATITUDE), p.getValue(GRID_POLE_LONGITUDE), p.getValue(GRID_POLE_ANGLE)); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedSouthPole.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/SouthPoleRotation.java similarity index 94% rename from core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedSouthPole.java rename to core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/SouthPoleRotation.java index 2f18264..37c57b3 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RotatedSouthPole.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/SouthPoleRotation.java @@ -23,7 +23,7 @@ import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.MathTransformFactory; -import org.apache.sis.referencing.operation.transform.RotatedPole; +import org.apache.sis.referencing.operation.transform.PoleRotation; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.parameter.ParameterBuilder; import org.apache.sis.parameter.Parameters; @@ -46,7 +46,7 @@ import org.apache.sis.measure.Units; * @module */ @XmlTransient -public final class RotatedSouthPole extends AbstractProvider { +public final class SouthPoleRotation extends AbstractProvider { /** * For cross-version compatibility. */ @@ -125,7 +125,7 @@ public final class RotatedSouthPole extends AbstractProvider { PARAMETERS = builder.setRequired(true) .addName(Citations.WMO, "Rotated Latitude/longitude") .addName("rotated_latlon_grib") - .createGroup(GRID_POLE_LATITUDE, // Note: `RotatedPole` implementation depends on this parameter order. + .createGroup(GRID_POLE_LATITUDE, // Note: `PoleRotation` implementation depends on this parameter order. GRID_POLE_LONGITUDE, GRID_POLE_ANGLE); } @@ -133,7 +133,7 @@ public final class RotatedSouthPole extends AbstractProvider { /** * Constructs a new provider. */ - public RotatedSouthPole() { + public SouthPoleRotation() { super(2, 2, PARAMETERS); } @@ -150,7 +150,7 @@ public final class RotatedSouthPole extends AbstractProvider { throws FactoryException { final Parameters p = Parameters.castOrWrap(parameters); - return RotatedPole.rotateSouthPole(factory, + return PoleRotation.rotateSouthPole(factory, p.getValue(GRID_POLE_LATITUDE), p.getValue(GRID_POLE_LONGITUDE), p.getValue(GRID_POLE_ANGLE)); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java similarity index 95% rename from core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java rename to core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java index 41ae31d..36309fd 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java @@ -32,8 +32,8 @@ import org.opengis.parameter.ParameterDescriptor; import org.opengis.parameter.ParameterDescriptorGroup; import org.apache.sis.parameter.DefaultParameterDescriptorGroup; import org.apache.sis.parameter.Parameters; -import org.apache.sis.internal.referencing.provider.RotatedNorthPole; -import org.apache.sis.internal.referencing.provider.RotatedSouthPole; +import org.apache.sis.internal.referencing.provider.NorthPoleRotation; +import org.apache.sis.internal.referencing.provider.SouthPoleRotation; import org.apache.sis.internal.referencing.Formulas; import org.apache.sis.internal.util.Numerics; import org.apache.sis.internal.util.Constants; @@ -75,7 +75,7 @@ import static org.apache.sis.internal.referencing.Formulas.fastHypot; * @since 1.2 * @module */ -public class RotatedPole extends AbstractMathTransform2D implements Serializable { +public class PoleRotation extends AbstractMathTransform2D implements Serializable { /** * For cross-version compatibility. */ @@ -126,8 +126,8 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable * * @see #inverse() */ - private RotatedPole(final RotatedPole forward) { - context = forward.context.inverse(forward.context.getDescriptor(), RotatedPole::inverseParameter); + private PoleRotation(final PoleRotation forward) { + context = forward.context.inverse(forward.context.getDescriptor(), PoleRotation::inverseParameter); sinφp = forward.sinφp; cosφp = -forward.cosφp; inverse = forward; @@ -176,10 +176,10 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable * @param pa angle of rotation in degrees about the new polar axis measured clockwise when * looking from the southern to the northern pole. */ - protected RotatedPole(final boolean south, final double φp, final double λp, final double pa) { + protected PoleRotation(final boolean south, final double φp, final double λp, final double pa) { context = new ContextualParameters( - south ? RotatedSouthPole.PARAMETERS - : RotatedNorthPole.PARAMETERS, DIMENSION, DIMENSION); + south ? SouthPoleRotation.PARAMETERS + : NorthPoleRotation.PARAMETERS, DIMENSION, DIMENSION); setValue(0, φp); // grid_south_pole_latitude or grid_north_pole_latitude setValue(1, λp); // grid_south_pole_longitude or grid_north_pole_longitude setValue(2, pa); // grid_south_pole_angle or north_pole_grid_longitude @@ -217,7 +217,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable public static MathTransform rotateSouthPole(final MathTransformFactory factory, final double φp, final double λp, final double pa) throws FactoryException { - final RotatedPole kernel = new RotatedPole(true, φp, λp, pa); + final PoleRotation kernel = new PoleRotation(true, φp, λp, pa); return kernel.context.completeTransform(factory, kernel); } @@ -235,7 +235,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable public static MathTransform rotateNorthPole(final MathTransformFactory factory, final double φp, final double λp, final double pa) throws FactoryException { - final RotatedPole kernel = new RotatedPole(false, φp, λp, pa); + final PoleRotation kernel = new PoleRotation(false, φp, λp, pa); return kernel.context.completeTransform(factory, kernel); } @@ -358,7 +358,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable final double[] dstPts, int dstOff, int numPts) throws TransformException { - if ((srcPts == dstPts && srcOff < dstOff) || getClass() != RotatedPole.class) { + if ((srcPts == dstPts && srcOff < dstOff) || getClass() != PoleRotation.class) { super.transform(srcPts, srcOff, dstPts, dstOff, numPts); return; } @@ -385,7 +385,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable @Override public synchronized MathTransform2D inverse() { if (inverse == null) { - inverse = new RotatedPole(this); + inverse = new PoleRotation(this); } return inverse; } @@ -402,7 +402,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable * We do not test `cosφp` because that value can be small but not zero, because * there is no way to compute exactly `cos(π/2)` with `Math.PI` approximation. * Testing `sinφp == -1` is a way to allow for a small tolerance around π/2. - * This policy is also needed for consistency with `RotatedPole(RotatedPole)` implementation. + * This policy is also needed for consistency with `PoleRotation(PoleRotation)` implementation. */ } @@ -416,7 +416,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable @Override public boolean equals(final Object object, final ComparisonMode mode) { if (super.equals(object, mode)) { - final RotatedPole other = (RotatedPole) object; + final PoleRotation other = (PoleRotation) object; if (mode.isApproximate()) { return Numerics.epsilonEqual(sinφp, other.sinφp, Formulas.ANGULAR_TOLERANCE * (PI/180)) && Numerics.epsilonEqual(cosφp, other.cosφp, Formulas.ANGULAR_TOLERANCE * (PI/180)); diff --git a/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod b/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod index 2526f0e..f5398c4 100644 --- a/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod +++ b/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod @@ -63,8 +63,8 @@ org.apache.sis.internal.referencing.provider.ZonedTransverseMercator org.apache.sis.internal.referencing.provider.Sinusoidal org.apache.sis.internal.referencing.provider.Polyconic org.apache.sis.internal.referencing.provider.Mollweide -org.apache.sis.internal.referencing.provider.RotatedSouthPole -org.apache.sis.internal.referencing.provider.RotatedNorthPole +org.apache.sis.internal.referencing.provider.SouthPoleRotation +org.apache.sis.internal.referencing.provider.NorthPoleRotation org.apache.sis.internal.referencing.provider.NTv2 org.apache.sis.internal.referencing.provider.NTv1 org.apache.sis.internal.referencing.provider.NADCON diff --git a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java index 21351a0..18096e3 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java @@ -113,8 +113,8 @@ public final strictfp class ProvidersTest extends TestCase { Sinusoidal.class, Polyconic.class, Mollweide.class, - RotatedSouthPole.class, - RotatedNorthPole.class, + SouthPoleRotation.class, + NorthPoleRotation.class, NTv2.class, NTv1.class, NADCON.class, diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/RotatedPoleTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java similarity index 91% rename from core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/RotatedPoleTest.java rename to core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java index dba1a4c..b629c03 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/RotatedPoleTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java @@ -27,14 +27,14 @@ import org.apache.sis.test.DependsOnMethod; /** - * Tests {@link RotatedPole}. + * Tests {@link PoleRotation}. * * @author Martin Desruisseaux (Geomatys) * @version 1.2 * @since 1.2 * @module */ -public final strictfp class RotatedPoleTest extends MathTransformTestCase { +public final strictfp class PoleRotationTest extends MathTransformTestCase { /** * Returns the transform factory to use for testing purpose. * This mock supports only the "affine" and "concatenate" operations. @@ -46,20 +46,20 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { /** * Creates a new test case. */ - public RotatedPoleTest() { + public PoleRotationTest() { tolerance = Formulas.ANGULAR_TOLERANCE; } /** * Creates a new transform which should be the inverse of current transform according the - * parameters declared in {@link RotatedPole#context}. Those parameters may be wrong even + * parameters declared in {@link PoleRotation#context}. Those parameters may be wrong even * if the coordinates transformed by {@code transform.inverse()} are corrects because the * parameters are only for WKT formatting (they are not actually used for transformation, * unless we force their use as done in this method). */ private void inverseSouthPoleTransform() throws FactoryException, TransformException { final ParameterValueGroup pg = ((Parameterized) transform.inverse()).getParameterValues(); - transform = RotatedPole.rotateSouthPole(factory(), + transform = PoleRotation.rotateSouthPole(factory(), pg.parameter("grid_south_pole_latitude") .doubleValue(), pg.parameter("grid_south_pole_longitude").doubleValue(), pg.parameter("grid_south_pole_angle") .doubleValue()); @@ -67,12 +67,12 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { /** * Creates a new transform which should be the inverse of current transform according - * the parameters declared in {@link RotatedPole#context}. This is the same work than + * the parameters declared in {@link PoleRotation#context}. This is the same work than * {@link #inverseSouthPoleTransform()} but for the other transform. */ private void inverseNorthPoleTransform() throws FactoryException, TransformException { final ParameterValueGroup pg = ((Parameterized) transform.inverse()).getParameterValues(); - transform = RotatedPole.rotateNorthPole(factory(), + 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()); @@ -88,7 +88,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { */ @Test public void testRotateSouthPoleOnGreenwich() throws FactoryException, TransformException { - transform = RotatedPole.rotateSouthPole(factory(), -60, 0, 0); + transform = PoleRotation.rotateSouthPole(factory(), -60, 0, 0); final double[] coordinates = { // (λ,φ) coordinates to convert. 0, -51, 20, -51, @@ -115,7 +115,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { @Test @DependsOnMethod("testRotateSouthPoleOnGreenwich") public void testRotateSouthPoleWithAngle() throws FactoryException, TransformException { - transform = RotatedPole.rotateSouthPole(factory(), -50, 20, 10); + transform = PoleRotation.rotateSouthPole(factory(), -50, 20, 10); final double[] coordinates = { // (λ,φ) coordinates to convert. 20, -51, 80, -44, @@ -139,7 +139,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { */ @Test public void testRotateSouthToOppositeHemisphere() throws FactoryException, TransformException { - transform = RotatedPole.rotateSouthPole(factory(), 50, 20, 10); + transform = PoleRotation.rotateSouthPole(factory(), 50, 20, 10); final double[] coordinates = { // (λ,φ) coordinates to convert. 20, 51, 80, 44, @@ -170,7 +170,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { */ @Test public void testRotateNorthPoleOnGreenwich() throws FactoryException, TransformException { - transform = RotatedPole.rotateNorthPole(factory(), 60, 0, 0); + transform = PoleRotation.rotateNorthPole(factory(), 60, 0, 0); final double[] coordinates = { // (λ,φ) coordinates to convert. 0, 54, 20, 62, @@ -203,7 +203,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { @Test @DependsOnMethod("testRotateNorthPoleOnGreenwich") public void testRotateNorthPole() throws FactoryException, TransformException { - transform = RotatedPole.rotateNorthPole(factory(), 70, 40, 0); + transform = PoleRotation.rotateNorthPole(factory(), 70, 40, 0); final double[] coordinates = { // (λ,φ) coordinates to convert. 0, 54, 20, 62, @@ -227,7 +227,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { */ @Test public void testRotateNorthToOppositeHemisphere() throws FactoryException, TransformException { - transform = RotatedPole.rotateNorthPole(factory(), -50, 20, 10); + transform = PoleRotation.rotateNorthPole(factory(), -50, 20, 10); final double[] coordinates = { // (λ,φ) coordinates to convert. 20, -51, 80, -44, @@ -251,7 +251,7 @@ public final strictfp class RotatedPoleTest extends MathTransformTestCase { */ @Test public void testDerivative() throws FactoryException, TransformException { - transform = RotatedPole.rotateSouthPole(factory(), -50, 0, 0); + transform = PoleRotation.rotateSouthPole(factory(), -50, 0, 0); derivativeDeltas = new double[] {1E-6, 1E-6}; verifyDerivative( 0, -51); verifyDerivative( 20, -58); diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java index 412d597..c10aaea 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java @@ -142,7 +142,7 @@ import org.junit.BeforeClass; org.apache.sis.referencing.operation.transform.EllipsoidToCentricTransformTest.class, org.apache.sis.referencing.operation.transform.MolodenskyTransformTest.class, org.apache.sis.referencing.operation.transform.AbridgedMolodenskyTransformTest.class, - org.apache.sis.referencing.operation.transform.RotatedPoleTest.class, + org.apache.sis.referencing.operation.transform.PoleRotationTest.class, org.apache.sis.referencing.operation.transform.SphericalToCartesianTest.class, org.apache.sis.referencing.operation.transform.CartesianToSphericalTest.class, org.apache.sis.referencing.operation.transform.PolarToCartesianTest.class,