sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmarec...@apache.org
Subject svn commit: r1708771 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/operation/projection/ test/java/org/apache/sis/referencing/operation/projection/ test/java/org/apache/sis/test/suite/
Date Thu, 15 Oct 2015 10:16:35 GMT
Author: rmarechal
Date: Thu Oct 15 10:16:35 2015
New Revision: 1708771

URL: http://svn.apache.org/viewvc?rev=1708771&view=rev
Log:
Projection : add Radius Conformal Sphere computing into Initializer class and add relative
test

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.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/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1708771&r1=1708770&r2=1708771&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] Thu Oct 15 10:16:35 2015
@@ -295,7 +295,7 @@ final class Initializer {
         final DoubleDouble t = verbatim(sinφ);
         t.square();
         t.multiply(excentricitySquared);
-
+        
         // Compute 1 - ℯ²⋅sin²φ.  Since  ℯ²⋅sin²φ  may be small,
         // this is where double-double arithmetic has more value.
         t.negate();
@@ -304,6 +304,32 @@ final class Initializer {
     }
 
     /**
+     * Returns the radius of the conformal sphere.
+     *
+     * The radius of conformal sphere is computed from ρ,
+     * which is the radius of curvature in the meridian,
+     * and ν which is the radius of curvature in the prime vertical,
+     * like follow :
+     *
+     * <blockquote>Rc = √(ρ ν) = √(1 – e²) / (1 – e²sin²φ)</blockquote>
+     *
+     * This is a function of latitude and therefore not constant. When used for
+     * spherical projections the use of φO(or φ1as relevant to method) for φis
+     * suggested, except if the projection is equal area
+     * when the radius of authalic sphere should be used.
+     *
+     * @param sinφ The sine of the φ latitude.
+     * @return radius of the conformal sphere at latitude φ.
+     */
+    final double radiusOfConformalSphere(final double sinφ) {
+        final DoubleDouble Rc = verbatim(1);
+        Rc.subtract(excentricitySquared); //-- 1 - e²
+        Rc.sqrt();                        //-- √1 - e²
+        Rc.divide(rν2(sinφ));           //-- (√1 - e²) * (1 / (1 - e²sin²φ))
+        return Rc.value;
+    }
+
+    /**
      * Returns the scale factor at latitude φ. This is computed as:
      *
      * <blockquote>cosφ / sqrt(rν2(sinφ))</blockquote>

Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java?rev=1708771&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/InitializerTest.java
Thu Oct 15 10:16:35 2015
@@ -0,0 +1,79 @@
+/*
+ * 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.parameter.ParameterValueGroup;
+import org.opengis.referencing.operation.OperationMethod;
+
+import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.referencing.provider.ObliqueStereographic;
+import org.apache.sis.parameter.Parameters;
+import org.junit.Test;
+
+import static org.apache.sis.internal.referencing.provider.ObliqueStereographic.*;
+import static org.opengis.test.Assert.*;
+import org.opengis.test.TestCase;
+
+
+/**
+ * Test about computing method from
+ * <a href = http://www.iogp.org/pubs/373-07-2.pdf> EPSG guide</a>
+ *
+ * @author Rémi Marechal (Geomatys).
+ * @author Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+public strictfp class InitializerTest extends TestCase{
+    /**
+     * Test computing of Radius of conformal Sphere.
+     *
+     * @see Initializer#radiusOfConformalSphere(double)
+     */
+    @Test
+    public void testConformalSphereRadius() {
+
+        final EnumMap<NormalizedProjection.ParameterRole, ParameterDescriptor<Double>>
roles = new EnumMap<>(NormalizedProjection.ParameterRole.class);
+        roles.put(NormalizedProjection.ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
+        roles.put(NormalizedProjection.ParameterRole.SCALE_FACTOR,     SCALE_FACTOR);
+        roles.put(NormalizedProjection.ParameterRole.FALSE_EASTING,    FALSE_EASTING);
+        roles.put(NormalizedProjection.ParameterRole.FALSE_NORTHING,   FALSE_NORTHING);
+
+        final OperationMethod op = new 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);
+
+        final Initializer initializer = new Initializer(op, (Parameters) p, roles, (byte)
0);
+
+        assertEquals("Conformal Sphere Radius", 6382644.571, 6377397.155 * initializer.radiusOfConformalSphere(Math.sin(Math.toRadians(52.156160556))),
Formulas.LINEAR_TOLERANCE);
+    }
+}

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=1708771&r1=1708770&r2=1708771&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:16:35 2015
@@ -102,6 +102,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class,
 
     // Test map projections. Those tests need the providers tested above.
+    org.apache.sis.referencing.operation.projection.InitializerTest.class,
     org.apache.sis.referencing.operation.projection.NormalizedProjectionTest.class,
     org.apache.sis.referencing.operation.projection.EquirectangularTest.class,
     org.apache.sis.referencing.operation.projection.ConformalProjectionTest.class,



Mime
View raw message