sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1690231 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ sis-referencing/src/test/java/org/apache/sis/r...
Date Fri, 10 Jul 2015 09:16:42 GMT
Author: desruisseaux
Date: Fri Jul 10 09:16:41 2015
New Revision: 1690231

URL: http://svn.apache.org/r1690231
Log:
Modify the way we handle the "West orientated" case, keeping in mind that the "kernel" part
of SIS projections used normalized (easting,northing) directions.
The reversal of the 'x' axis from "easting" to "westing" is done outside the projection package,
by the CoordinateSystems.swapAndScaleAxes(...) method.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java
[UTF-8] Fri Jul 10 09:16:41 2015
@@ -16,12 +16,24 @@
  */
 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.util.resources.Messages;
 
 
 /**
- * The provider for <cite>Lambert Conic Conformal (West Orientated)"</cite> projection
(EPSG:9826).
+ * The provider for <cite>"Lambert Conic Conformal (West Orientated)"</cite>
projection (EPSG:9826).
+ * In this projection method, the <var>x</var> values increase toward West. However
the projection
+ * is defined in such a way that the sign of <var>x</var> values are reversed
before to apply the
+ * <cite>"false easting"</cite> translation. As a consequence of this operation
order, despite its
+ * name the <cite>"false easting"</cite> is effectively a <cite>"false
westing"</cite> (FW) parameter.
+ * See §1.3.1.3 in <i>Geomatics Guidance Note number 7, part 2 – April 2015</i>.
+ *
+ * <p>In Apache SIS implementation, this operation method does <strong>not</strong>
reverse the sign of
+ * <var>x</var> values because all our map projection "kernels" go from (longitude,
latitude) in degrees
+ * to (easting, northing) in metres by definition. The sign reversal is applied later, by
examination of
+ * axis directions in {@link org.apache.sis.referencing.cs.CoordinateSystems}.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
@@ -45,6 +57,9 @@ public final class LambertConformalWest
     static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
+        final ParameterDescriptor<?> falseEasting = createShift(builder
+                .addNamesAndIdentifiers(LambertConformal1SP.FALSE_EASTING)
+                .setRemarks(Messages.formatInternational(Messages.Keys.MisnamedParameter_1,
"False westing")));
 
         PARAMETERS = builder
             .addIdentifier(IDENTIFIER)
@@ -53,7 +68,7 @@ public final class LambertConformalWest
                     LambertConformal1SP.LATITUDE_OF_ORIGIN,
                     LambertConformal1SP.CENTRAL_MERIDIAN,
                     LambertConformal1SP.SCALE_FACTOR,
-                    LambertConformal1SP.FALSE_EASTING,
+                    falseEasting,
                     LambertConformal1SP.FALSE_NORTHING);
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConformal.java
[UTF-8] Fri Jul 10 09:16:41 2015
@@ -92,6 +92,7 @@ public class LambertConformal extends No
      * @param  type One of {@link #SP1}, {@link #SP2}, {@link #WEST} or {@link #BELGIUM}
constants.
      * @return The roles map to give to super-class constructor.
      */
+    @SuppressWarnings("fallthrough")
     private static Map<ParameterRole, ParameterDescriptor<Double>> roles(final
byte type) {
         final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new
EnumMap<>(ParameterRole.class);
         /*
@@ -99,19 +100,27 @@ public class LambertConformal extends No
          * anyway for all Lambert projections since it may be used in some Well Known Text
(WKT).
          */
         roles.put(ParameterRole.SCALE_FACTOR, LambertConformal1SP.SCALE_FACTOR);
+        ParameterRole eastingDirection = ParameterRole.FALSE_EASTING;
         switch (type) {
-            case WEST:
+            case WEST: {
+                /*
+                 * For "Lambert Conic Conformal (West Orientated)" projection, the "false
easting" parameter is
+                 * effectively a "false westing" (Geomatics Guidance Note number 7, part
2 – April 2015, §1.3.1.3)
+                 */
+                eastingDirection = ParameterRole.FALSE_WESTING;
+                // Fallthrough
+            }
             case SP1: {
-                roles.put(ParameterRole.CENTRAL_MERIDIAN, LambertConformal1SP.CENTRAL_MERIDIAN);
-                roles.put(ParameterRole.FALSE_EASTING,    LambertConformal1SP.FALSE_EASTING);
+                roles.put(eastingDirection,               LambertConformal1SP.FALSE_EASTING);
                 roles.put(ParameterRole.FALSE_NORTHING,   LambertConformal1SP.FALSE_NORTHING);
+                roles.put(ParameterRole.CENTRAL_MERIDIAN, LambertConformal1SP.CENTRAL_MERIDIAN);
                 break;
             }
             case BELGIUM:
             case SP2: {
-                roles.put(ParameterRole.CENTRAL_MERIDIAN, LambertConformal2SP.LONGITUDE_OF_FALSE_ORIGIN);
-                roles.put(ParameterRole.FALSE_EASTING,    LambertConformal2SP.EASTING_AT_FALSE_ORIGIN);
+                roles.put(eastingDirection,               LambertConformal2SP.EASTING_AT_FALSE_ORIGIN);
                 roles.put(ParameterRole.FALSE_NORTHING,   LambertConformal2SP.NORTHING_AT_FALSE_ORIGIN);
+                roles.put(ParameterRole.CENTRAL_MERIDIAN, LambertConformal2SP.LONGITUDE_OF_FALSE_ORIGIN);
                 break;
             }
             default: throw new AssertionError(type);
@@ -214,16 +223,6 @@ public class LambertConformal extends No
         denormalize.convertBefore(0, F, null);
         F.negate();
         denormalize.convertBefore(1, F, ρ0);
-        /*
-         * EPSG:9826  —  Lambert Conic Conformal (1SP West Orientated)
-         *
-         * In this projection method positive x are oriented toward West. Reverse the sign
of 'x' before to apply
-         * the "false easting". As a consequence of this operation order, despite its name
the "false easting" is
-         * effectively a "false westing" (FW) parameter. This is confusing but the operation
is defined like that.
-         */
-        if (type == WEST) {
-            denormalize.convertBefore(0, new DoubleDouble(-1, 0), null);
-        }
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] Fri Jul 10 09:16:41 2015
@@ -281,6 +281,17 @@ public abstract class NormalizedProjecti
         FALSE_EASTING,
 
         /**
+         * Maps the <cite>false westing</cite> parameter (symbol: <var>FW</var>).
+         * This is the same <var>x</var> translation than {@link #FALSE_EASTING},
but of opposite sign.
+         *
+         * <p>Actually, there is usually no parameter named "false westing" in a map
projection.
+         * But some projections like <cite>"Lambert Conic Conformal (West Orientated)"</cite>
are
+         * defined in such a way that their "false easting" parameter is effectively a "false
westing".
+         * This enumeration value can be used for informing {@link NormalizedProjection}
about that fact.</p>
+         */
+        FALSE_WESTING,
+
+        /**
          * Maps the <cite>false northing</cite> parameter (symbol: <var>FN</var>).
          * This is a translation term for the <var>y</var> values obtained after
map projections.
          *
@@ -291,7 +302,18 @@ public abstract class NormalizedProjecti
          *   <li>Northing at projection centre</li>
          * </ul>
          */
-        FALSE_NORTHING
+        FALSE_NORTHING,
+
+        /**
+         * Maps the <cite>false southing</cite> parameter (symbol: <var>FS</var>).
+         * This is the same <var>y</var> translation than {@link #FALSE_NORTHING},
but of opposite sign.
+         *
+         * <p>Actually, there is usually no parameter named "false southing" in a map
projection.
+         * But some projections like <cite>"Transverse Mercator (South Orientated)"</cite>
are
+         * defined in such a way that their "false northing" parameter is effectively a "false
southing".
+         * This enumeration value can be used for informing {@link NormalizedProjection}
about that fact.</p>
+         */
+        FALSE_SOUTHING
     }
 
     /**
@@ -379,8 +401,10 @@ public abstract class NormalizedProjecti
               double a  = getAndStore(parameters, semiMajor);
         final double b  = getAndStore(parameters, semiMinor);
         final double λ0 = getAndStore(parameters, roles.get(ParameterRole.CENTRAL_MERIDIAN));
-        final double fe = getAndStore(parameters, roles.get(ParameterRole.FALSE_EASTING));
-        final double fn = getAndStore(parameters, roles.get(ParameterRole.FALSE_NORTHING));
+        final double fe = getAndStore(parameters, roles.get(ParameterRole.FALSE_EASTING))
+                        - getAndStore(parameters, roles.get(ParameterRole.FALSE_WESTING));
+        final double fn = getAndStore(parameters, roles.get(ParameterRole.FALSE_NORTHING))
+                        - getAndStore(parameters, roles.get(ParameterRole.FALSE_SOUTHING));
         final double rs = b / a;
         excentricitySquared = 1 - (rs * rs);
         excentricity = sqrt(excentricitySquared);

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java
[UTF-8] Fri Jul 10 09:16:41 2015
@@ -241,9 +241,17 @@ public final strictfp class LambertConfo
          *    the term FE retains its definition, i.e. in the Lambert Conic Conformal (West
Orientated)
          *    method it increases the Westing value at the natural origin.
          *    In this method it is effectively false westing (FW).
+         *
+         * So the conversion for this test case should be:     W = 400 - E
+         *
+         * However our map projection "kernel" implementation does not reverse the sign of
'x' values,
+         * because this reversal is the job of a separated method (CoordinateSystems.swapAndScaleAxes)
+         * which does is work by examining the axis directions. So we the values that we
expect are:
+         *
+         *     expected  =  -W  =  E - 400
          */
         for (int i=0; i<sources.length; i += 2) {
-            expected[i] = 400 - expected[i];
+            expected[i] -= 400;
         }
         tolerance = Formulas.LINEAR_TOLERANCE;
         verifyTransform(sources, expected);

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] Fri Jul 10 09:16:41 2015
@@ -119,6 +119,11 @@ public final class Messages extends Inde
         public static final short MismatchedEllipsoidAxisLength_3 = 9;
 
         /**
+         * Despite its name, this parameter is effectively “{0}”.
+         */
+        public static final short MisnamedParameter_1 = 18;
+
+        /**
          * Formatting of “{0}” is not conform to the format standard.
          */
         public static final short NonConformFormatting_1 = 15;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
[ISO-8859-1] Fri Jul 10 09:16:41 2015
@@ -28,6 +28,7 @@ LocalesDiscarded                = Text w
 OptionalModuleNotFound_1        = Optional module \u201c{0}\u201d requested but not found.
 PropertyHiddenBy_2              = Property \u201c{0}\u201d is hidden by \u201c{1}\u201d.
 MismatchedEllipsoidAxisLength_3 = The \u201c{1}\u201d parameter could have been omitted.
But it has been given a value of {2} which does not match the definition of the \u201c{0}\u201d
ellipsoid.
+MisnamedParameter_1             = Despite its name, this parameter is effectively \u201c{0}\u201d.
 NonConformFormatting_1          = Formatting of \u201c{0}\u201d is not conform to the format
standard.
 NotFormalProjectionParameter_1  = This parameter borrowed from the \u201c{0}\u201d projection
is not formally a parameter of this projection.
 UnknownElementsInText           = The text contains unknown elements:

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1690231&r1=1690230&r2=1690231&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] Fri Jul 10 09:16:41 2015
@@ -35,6 +35,7 @@ LocalesDiscarded                = Des te
 OptionalModuleNotFound_1        = Le module optionnel \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9
demand\u00e9 mais n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
 PropertyHiddenBy_2              = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb est
masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb.
 MismatchedEllipsoidAxisLength_3 = Le param\u00e8tre \u00ab\u202f{1}\u202f\u00bb aurait pu
\u00eatre omis. Mais il lui a \u00e9t\u00e9 donn\u00e9 la valeur {2} qui ne correspond pas
\u00e0 la d\u00e9finition de l\u2019ellipso\u00efde \u00ab\u202f{0}\u202f\u00bb.
+MisnamedParameter_1             = Malgr\u00e9 son nom, ce param\u00e8tre produit en r\u00e9alit\u00e9
l\u2019effet d\u2019un \u00ab\u202f{0}\u202f\u00bb.
 NonConformFormatting_1          = L\u2019\u00e9criture de \u00ab\u202f{0}\u202f\u00bb n\u2019est
pas conforme au format standard.
 NotFormalProjectionParameter_1  = Ce param\u00e8tre emprunt\u00e9 \u00e0 la projection \u00ab\u202f{0}\u202f\u00bb
n\u2019est pas formellement un param\u00e8tre de cette projection.
 UnknownElementsInText           = Le texte contient des \u00e9l\u00e9ments inconnus\u00a0:



Mime
View raw message