sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmarec...@apache.org
Subject svn commit: r1708776 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/operation/projection/ test/java/org/apache/sis/referencing/operation/projection/ test/ja...
Date Thu, 15 Oct 2015 10:23:51 GMT
Author: rmarechal
Date: Thu Oct 15 10:23:51 2015
New Revision: 1708776

URL: http://svn.apache.org/viewvc?rev=1708776&view=rev
Log:
Projection : Add ObliqueStereographic projection and relative tests

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java?rev=1708776&r1=1708775&r2=1708776&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ObliqueStereographic.java
[UTF-8] Thu Oct 15 10:23:51 2015
@@ -94,6 +94,6 @@ public final class ObliqueStereographic
      */
     @Override
     protected NormalizedProjection createProjection(Parameters parameters) throws ParameterNotFoundException
{
-        throw new UnsupportedOperationException("Not supported yet.");  // TODO
+        return new org.apache.sis.referencing.operation.projection.ObliqueStereographic(this,
parameters);
     }
 }

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java?rev=1708776&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueStereographic.java
Thu Oct 15 10:23:51 2015
@@ -0,0 +1,374 @@
+/*
+ * 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.projection;
+
+import java.util.EnumMap;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.MathTransformFactory;
+import org.opengis.util.FactoryException;
+
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.util.Workaround;
+import org.apache.sis.referencing.operation.matrix.Matrix2;
+import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.util.resources.Errors;
+
+import static java.lang.Math.*;
+import static org.apache.sis.internal.referencing.provider.ObliqueStereographic.*;
+
+
+/**
+ * <cite>Oblique Stereographic</cite> projection (EPSG code 9809).
+ * The formulas used below are from the EPSG guide.
+ *
+ * {@section References}
+ * <ul>
+ *   <li>{@code libproj4} is available at
+ *       <a href = http://www.iogp.org/pubs/373-07-2.pdf>EPSG guide</a>.<br>
+ *        Relevant files are: {@code PJ_sterea.c}, {@code pj_gauss.c},
+ *        {@code pj_fwd.c}, {@code pj_inv.c} and {@code lib_proj.h}</li>
+ * </ul>
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @author  Rémi Maréchal (Geomatys)
+ * @since   0.6
+ * @version 0.7
+ * @module
+ */
+public class ObliqueStereographic extends NormalizedProjection {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = -5098015759558831875L;
+
+    /**
+     * Conformal latitude of origin only use
+     * into {@link #inverseTransform(double[], int, double[], int) }.
+     */
+    private final double χ0;
+
+    /**
+     * Value of sin(χ0) only use
+     * into {@link #transform(double[], int, double[], int, boolean)  }.
+     *
+     * @see #χ0
+     */
+    private final double sinχ0;
+
+    /**
+     * Value of cos(χ0) only use
+     * into {@link #transform(double[], int, double[], int, boolean)  }.
+     *
+     * @see #χ0
+     */
+    private final double cosχ0;
+
+    /**
+     * c, internaly parameter used to define conformal sphere, used
+     * into {@link #transform(double[], int, double[], int, boolean)  }
+     * and {@link #inverseTransform(double[], int, double[], int) }.
+     */
+    private final double c;
+
+    /**
+     * n, internaly parameter used to define conformal sphere, used
+     * into {@link #transform(double[], int, double[], int, boolean)  }
+     * and {@link #inverseTransform(double[], int, double[], int) }.
+     */
+    private final double n;
+
+    /**
+     * g, internaly parameter used to define conformal sphere coordinate conversion,
+     * during {@link #inverseTransform(double[], int, double[], int) }.
+     * More precisely g is used to compute i and j parameters and i and j,
+     * are used to compute only conformal longitude.
+     */
+    private final double g;
+
+    /**
+     * h, internaly parameter used to define conformal sphere coordinate conversion,
+     * during {@link #inverseTransform(double[], int, double[], int) }.
+     * More precisely h is used to compute i and j parameters and i and j,
+     * are used to compute only conformal longitude.
+     */
+    private final double h;
+
+    /**
+     * A convenient computing for 1 - {@link #excentricitySquared}.
+     */
+    private final double eS1;
+
+    /**
+     * Creates a Oblique Stereographic projection from the given parameters.
+     * The {@code method} argument can be the description of one of the following:
+     *
+     * <ul>
+     *   <li><cite>"Oblique Stereographic"</cite>.</li>
+     * </ul>
+     *
+     * @param method     Description of the projection parameters.
+     * @param parameters The parameter values of the projection to create.
+     */
+    public ObliqueStereographic(final OperationMethod method, final Parameters parameters)
{
+        this(initializer(method, parameters));
+    }
+
+    /**
+     * Work around for RFE #4093999 in Sun's bug database
+     * ("Relax constraint on placement of this()/super() call in constructors").
+     */
+    @Workaround(library="JDK", version="1.7")
+    private static Initializer initializer(final OperationMethod method, final Parameters
parameters) {
+        final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new
EnumMap<>(ParameterRole.class);
+        roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
+        roles.put(ParameterRole.SCALE_FACTOR,     SCALE_FACTOR);
+        roles.put(ParameterRole.FALSE_EASTING,    FALSE_EASTING);
+        roles.put(ParameterRole.FALSE_NORTHING,   FALSE_NORTHING);
+        return new Initializer(method, parameters, roles, (byte) 0);
+    }
+
+    /**
+     * Work around for RFE #4093999 in Sun's bug database
+     * ("Relax constraint on placement of this()/super() call in constructors").
+     */
+    private ObliqueStereographic(final Initializer initializer) {
+        super(initializer);
+
+        eS1 = 1 - excentricitySquared;
+
+        final double φ0 = toRadians(initializer.getAndStore(LATITUDE_OF_ORIGIN));
+
+        final double cosφ0   = cos(φ0);
+        final double cos4_φ0 = pow(cosφ0, 4);
+        n = sqrt((1 + ((excentricitySquared * cos4_φ0) / eS1)));
+
+        final double sinφ0  = sin(φ0);
+        final double esinφ0 = excentricity * sinφ0;
+
+        final double s1 = (1 +  sinφ0) / (1 -  sinφ0);
+        final double s2 = (1 - esinφ0) / (1 + esinφ0);
+        final double w1 = pow(s1 * pow(s2, excentricity), n);
+
+        /*
+         * Original formula : sinχ0 = ...
+         * To avoid confusion with χ0 conformal latitude of origin,
+         * renamed sinχ0 into sinχc.
+         */
+        final double sinχc = (w1 - 1) / (w1 + 1);
+        c = (n + sinφ0) * (1 - sinχc) / ((n - sinφ0) * (1 + sinχc));
+
+        //-- for invert formula
+        final double w2 = c * w1;
+        χ0 = asin((w2 - 1) / (w2 + 1));
+
+        sinχ0 = sin(χ0);
+        cosχ0 = cos(χ0);
+
+        final double R = initializer.radiusOfConformalSphere(sinφ0);
+
+        g = tan(PI / 4 - χ0 / 2);
+        h = 2 * tan(χ0) + g;
+
+        final MatrixSIS normalize   = context.getMatrix(true);
+        final MatrixSIS denormalize = context.getMatrix(false);
+        normalize.convertAfter(0, n, null);
+
+        final double R2 = 2 * R;
+        denormalize.convertBefore(0, R2, null);
+        denormalize.convertBefore(1, R2, null);
+    }
+
+    /**
+     * Creates a new projection initialized to the same parameters than the given one.
+     */
+    ObliqueStereographic(final ObliqueStereographic other) {
+        super(other);
+        χ0    = other.χ0;
+        sinχ0 = other.sinχ0;
+        cosχ0 = other.cosχ0;
+        c     = other.c;
+        n     = other.n;
+        g     = other.g;
+        h     = other.h;
+        eS1   = other.eS1;
+    }
+
+    /**
+     * Returns the sequence of <cite>normalization</cite> → {@code this}
→ <cite>denormalization</cite> transforms
+     * as a whole. The transform returned by this method expects (<var>longitude</var>,
<var>latitude</var>)
+     * coordinates in <em>degrees</em> and returns (<var>x</var>,<var>y</var>)
coordinates in <em>metres</em>.
+     *
+     * <p>The non-linear part of the returned transform will be {@code this} transform,
except if the ellipsoid
+     * is spherical. In the later case, {@code this} transform will be replaced by a simplified
implementation.</p>
+     *
+     * @param  factory The factory to use for creating the transform.
+     * @return The map projection from (λ,φ) to (<var>x</var>,<var>y</var>)
coordinates.
+     * @throws FactoryException if an error occurred while creating a transform.
+     */
+    @Override
+    public MathTransform createMapProjection(final MathTransformFactory factory) throws FactoryException
{
+        ObliqueStereographic kernel = this;
+        if (excentricity == 0) {
+//            kernel = new Spherical(this);     // not implemented yet
+        }
+        return context.completeTransform(factory, kernel);
+    }
+
+    /**
+     * Converts the specified (λ,φ) coordinate (units in radians) and stores the result
in {@code dstPts}.
+     * In addition, opportunistically computes the projection derivative if {@code derivate}
is {@code true}.
+     *
+     * @return The matrix of the projection derivative at the given source position,
+     *         or {@code null} if the {@code derivate} argument is {@code false}.
+     * @throws ProjectionException if the coordinate can not be converted.
+     */
+    @Override
+    public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean
derivate) throws ProjectionException {
+        final double φ = srcPts[srcOff + 1];
+        final double λ = srcPts[srcOff];
+
+        final double sinφ      = sin(φ);
+        final double esinφ     = excentricity * sinφ;
+        final double v1_sinφ   = 1 - sinφ;
+        final double v1esinφ   = 1 + esinφ;
+        final double Sa        = (1 + sinφ)  / v1_sinφ;
+        final double Sb        = (1 - esinφ) / v1esinφ;
+        final double sbpowex   = pow(Sb, excentricity);
+        final double sasbpowex = Sa * sbpowex;
+        final double w         = c * pow(sasbpowex, n);
+        final double w1        = w + 1;
+        final double w1_w1     = (w - 1) / w1;
+        /*
+         * Sometimes to compute projection coordinates values, computing pass by a
+         * "conformal sphere" to approximate as better, destination projection coordinates.
+         */
+        //-- latitude coordinate into conformal sphere space.
+        final double χ    = asin(w1_w1);
+        final double cosχ = cos(χ);
+        final double sinχ = sin(χ);
+        /*
+         * Longitude coordinate into conformal sphere space is Λ = n(λ–ΛO)+
ΛO.
+         * But in our case, all of this linears computing are delegate into
+         * normalize matrix. See contructor for more precisions.
+         * We work directly with λ.
+         */
+        final double cosλ = cos(λ);
+        final double sinλ = sin(λ);
+        /*
+         * Now transform conformal sphere coordinates
+         * into projection destination space
+         */
+        final double sinχsinχ0 = sinχ * sinχ0;
+        final double cosχcosχ0 = cosχ * cosχ0;
+        final double cosχsinλ  = cosχ * sinλ;
+
+        final double B = 1 + sinχsinχ0 + cosχcosχ0 * cosλ;
+
+        final double y = (sinχ * cosχ0 - cosχ * sinχ0 * cosλ) / B;
+        final double x =  cosχsinλ / B;
+
+        if (dstPts != null) {
+            dstPts[dstOff  ] = x;
+            dstPts[dstOff+1] = y;
+        }
+
+        if (!derivate) {
+            return null;
+        }
+
+        final double cosφ   = cos(φ);
+        final double B2     = B * B;
+
+        //-- derivative code
+        //-- dSa_dλ = 0;
+        final double dSa_dφ = 2 * cosφ / (v1_sinφ * v1_sinφ);
+
+        //-- dSb_dλ = 0;
+        final double dSb_dφ = - 2 * excentricity * cosφ / (v1esinφ * v1esinφ);
+
+        //-- dsasbpowex_dλ = 0;
+        final double dsasbpowex_dφ = dSa_dφ * sbpowex + Sa * excentricity * dSb_dφ
* pow(Sb, excentricity - 1);
+
+        //-- dw_dλ = 0;
+        final double dw_dφ = c * n * dsasbpowex_dφ * pow(sasbpowex, n - 1);
+
+        //-- dχ_dλ = 0;
+        final double dχ_dφ = dw_dφ / (w1 * sqrt(w));
+
+        final double addsinχsinχ0 = sinχ + sinχ0;
+
+        //-- Jacobian coefficients
+        final double dx_dλ = cosχ * (cosλ * (1 + sinχsinχ0) + cosχcosχ0)
/ B2;
+
+        final double dx_dφ = - dχ_dφ * sinλ * addsinχsinχ0 / B2;
+
+        final double dy_dλ = cosχsinλ * addsinχsinχ0 / B2;
+
+        final double dy_dφ = dχ_dφ * (cosχcosχ0 + cosλ * (sinχsinχ0
+ 1)) / B2;
+
+        return new Matrix2(dx_dλ, dx_dφ,
+                           dy_dλ, dy_dφ);
+    }
+
+    /**
+     * Transforms the specified (x, y) coordinates and stores the result in {@code dstPts}
(angles in radians).
+     *
+     * @throws ProjectionException if the point can not be converted.
+     */
+    @Override
+    protected void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff)
throws ProjectionException {
+        final double x = srcPts[srcOff];
+        final double y = srcPts[srcOff + 1];
+
+        final double i = atan(x / (h + y));
+        final double j = atan(x / (g - y)) - i;
+        /*
+         * Longitude coordinate into conformal sphere space is Λ = j + 2 * i
+         * Where λ = Λ + Λ0, but Λ0 is added into normalize matrix which regroup
all linears operations.
+         * Also in our particularity case Geodetic longitude λ is the same.
+         */
+        final double λ    = j + 2*i;
+
+        //-- latitude coordinate into conformal sphere space.
+        final double χ    = χ0 + 2*atan((y - x*tan(j/2)));
+        final double sinχ = sin(χ);
+
+        final double ψ = log((1 + sinχ) / (c * (1 - sinχ))) / (2 * n);
+
+        double φi_1 = 2*atan(exp(ψ)) - PI/2;
+
+        for (int it = 0; it < MAXIMUM_ITERATIONS; it++) {
+            final double sinφi_1  = sin(φi_1);
+            final double esinφi_1 = excentricity*sinφi_1;
+
+            double ψi_1 = log(tan(φi_1/2 + PI/4) * pow((1 - esinφi_1) / (1 + esinφi_1),
excentricity / 2));
+
+            final double φi = φi_1 - (ψi_1 - ψ) * cos(φi_1) * (1 - esinφi_1
* esinφi_1) / eS1;
+
+            if (abs(φi - φi_1) <= ITERATION_TOLERANCE) {
+                dstPts[dstOff]     = λ;
+                dstPts[dstOff + 1] = φi;
+                return;
+            }
+            φi_1 = φi;
+        }
+        throw new ProjectionException(Errors.Keys.NoConvergence);
+    }
+}

Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java?rev=1708776&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ObliqueStereographicTest.java
Thu Oct 15 10:23:51 2015
@@ -0,0 +1,176 @@
+/*
+ * 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.projection;
+
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.referencing.operation.MathTransform;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.TransformException;
+import org.opengis.util.FactoryException;
+
+import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.parameter.Parameters;
+import org.apache.sis.referencing.operation.transform.ContextualParameters;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static java.lang.Math.sqrt;
+
+
+/**
+ * Tests {@link ObliqueStereographic} projection.
+ *
+ * @author  Rémi Marechal (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+public final strictfp class ObliqueStereographicTest extends MapProjectionTestCase {
+    /**
+     * Parameter values provided by the <a href = http://www.iogp.org/pubs/373-07-2.pdf>EPSG
guide</a>
+     * for testing {@link ObliqueStereographic} transform conformity.
+     *
+     * @see ContextualParameters#getMatrix(boolean) where boolean is true for value n.
+     * @see ContextualParameters#getMatrix(boolean) where boolean is false for k0, a, FE,
FN and R.
+     * @see Initializer#radiusOfConformalSphere(double) for value R
+     *
+     */
+    private final static double eSQUARED = 0.08169683 * 0.08169683,     // Excentricity squared.
+                                φ0       = 0.910296727,                 // Latitude of
natural origin (rad)
+
+                                //-- Some attributs are considered as linear and put into
normalize matrix and apply before transform
+                                n        = sqrt(1 + (eSQUARED * Math.pow(Math.cos(φ0),
4)) / (1 - eSQUARED)),
+
+                                //-- Some attributs are considered as linear and put into
denormalize matrix and apply just after
+                                k0       = 0.9999079,
+                                a        = 6377397.155,
+                                FE       = 155000.00,
+                                FN       = 463000.00,
+                                R        = 6382644.571 / a;
+
+    /**
+     * Tested {@link MathTransform} projection.
+     */
+    private final NormalizedProjection ObliqueStereographic;
+
+    /**
+     * Buid tested {@link ObliqueStereographic} {@link MathTransform}.
+     */
+    public ObliqueStereographicTest() {
+        final OperationMethod op = new org.apache.sis.internal.referencing.provider.ObliqueStereographic();
+
+        final ParameterValueGroup p = op.getParameters().createValue();
+
+        //-- implicit names from OGC.
+        p.parameter("semi_major").setValue(6377397.155);
+        p.parameter("inverse_flattening").setValue(299.15281);
+
+        //-- Name parameters from Epsg registry
+        p.parameter("Latitude of natural origin").setValue(52.156160556);
+        p.parameter("Longitude of natural origin").setValue(5.387638889);
+        p.parameter("Scale factor at natural origin").setValue(0.9999079);
+        p.parameter("False easting").setValue(155000.00);
+        p.parameter("False northing").setValue(463000.00);
+
+        ObliqueStereographic = new ObliqueStereographic(op, (Parameters) p);
+    }
+
+    /**
+     * {@link MathTransform#transform(org.opengis.geometry.DirectPosition, org.opengis.geometry.DirectPosition)
}
+     * test with expected values from
+     * <a href = http://www.iogp.org/pubs/373-07-2.pdf> EPSG guide</a>
+     *
+     * @throws FactoryException if an error occurred while creating the map projection.
+     * @throws TransformException if an error occurred while projecting a coordinate.
+     */
+    @Test
+    public void testEPSGTransform() throws FactoryException, TransformException {
+
+        final double[] srcPts = new double[]{6, 53}; //-- deg
+        srcPts[0] = Math.toRadians(srcPts[0] - 5.387638889) ;
+        srcPts[1] = Math.toRadians(srcPts[1]);
+
+        final double[] dstPts = new double[2];
+
+        srcPts[0] = srcPts[0] * n;
+
+        ObliqueStereographic.transform(srcPts, 0, dstPts, 0, 1);
+
+        final double destE = dstPts[0] * k0 * a * 2 * R + FE;
+        final double destN = dstPts[1] * k0 * a * 2 * R + FN;
+
+        Assert.assertEquals("destination East coordinate",  196105.283, destE, Formulas.LINEAR_TOLERANCE);
+        Assert.assertEquals("destination North coordinate", 557057.739, destN, Formulas.LINEAR_TOLERANCE);
+    }
+
+
+   /**
+     * Test method {@link ObliqueStereographic#inverseTransform(double[], int, double[],
int)}
+     * test with expected values from
+     * <a href = http://www.iogp.org/pubs/373-07-2.pdf> EPSG guide</a>
+     *
+     * @throws org.apache.sis.referencing.operation.projection.ProjectionException
+     */
+    @Test
+    public void testEPSGinvertTransform() throws ProjectionException {
+
+        double srcEast  = 196105.28;
+        double srcNorth = 557057.74;
+
+        srcEast  -= FE;
+        srcNorth -= FN;
+        srcEast  /= k0;
+        srcNorth /= k0;
+        srcEast  /= a;
+        srcNorth /= a;
+        srcEast  /= (2 * R);
+        srcNorth /= (2 * R);
+
+        //-- tcheck transform
+        final double[] srcPts = new double[]{srcEast, srcNorth}; //-- meter
+
+        final double[] dstPts = new double[2];
+        ObliqueStereographic.inverseTransform(srcPts, 0, dstPts, 0);
+
+        final double λO = 0.094032038;
+
+        double destλ = dstPts[0] / n + λO;
+        double destφ = dstPts[1];
+
+        destλ = Math.toDegrees(destλ);
+        destφ = Math.toDegrees(destφ);
+
+        Assert.assertEquals("destination East coordinate",  6, destλ, Formulas.ANGULAR_TOLERANCE);
+        Assert.assertEquals("destination North coordinate", 53, destφ, Formulas.ANGULAR_TOLERANCE);
+    }
+
+    /**
+     * Tests the <cite>Oblique Stereographic</cite> case (EPSG:9809).
+     * This test is defined in GeoAPI conformance test suite.
+     *
+     * @throws FactoryException if an error occurred while creating the map projection.
+     * @throws TransformException if an error occurred while projecting a coordinate.
+     *
+     * @see org.opengis.test.referencing.ParameterizedTransformTest#testObliqueStereographic()
+     */
+    @Test
+    public void testGeoapi() throws FactoryException, TransformException {
+        createGeoApiTest(new org.apache.sis.internal.referencing.provider.ObliqueStereographic()).testObliqueStereographic();
+    }
+}

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1708776&r1=1708775&r2=1708776&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Thu Oct 15 10:23:51 2015
@@ -110,6 +110,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.projection.LambertConicConformalTest.class,
     org.apache.sis.referencing.operation.projection.TransverseMercatorTest.class,
     org.apache.sis.referencing.operation.projection.PolarStereographicTest.class,
+    org.apache.sis.referencing.operation.projection.ObliqueStereographicTest.class,
 
     // Coordinate Reference System components.
     org.apache.sis.referencing.datum.BursaWolfParametersTest.class,



Mime
View raw message