sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1690239 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/operation/projection/ main/resources/META-INF/services/ test/java/org/apache/sis/referen...
Date Fri, 10 Jul 2015 10:51:16 GMT
Author: desruisseaux
Date: Fri Jul 10 10:51:16 2015
New Revision: 1690239

URL: http://svn.apache.org/r1690239
Log:
Add the "Lambert Conic Conformal (2SP Michigan)" (EPSG:1051) projection method.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
  (with props)
Modified:
    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/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConformalTest.java

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java?rev=1690239&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
(added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
[UTF-8] Fri Jul 10 10:51:16 2015
@@ -0,0 +1,80 @@
+/*
+ * 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 javax.measure.unit.Unit;
+import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.apache.sis.parameter.ParameterBuilder;
+
+
+/**
+ * The provider for <cite>"Lambert Conic Conformal (2SP Michigan)"</cite> projection
(EPSG:1051).
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.6
+ * @version 0.6
+ * @module
+ */
+public final class LambertConformalMichigan extends AbstractLambert {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = 877467775093107902L;
+
+    /**
+     * The EPSG identifier, to be preferred to the name when available.
+     */
+    public static final String IDENTIFIER = "1051";
+
+    /**
+     * The operation parameter descriptor for the <cite>Ellipsoid scaling factor</cite>
(EPSG:1038)
+     * parameter value. Valid values range is (0 … ∞) and there is no default value.
+     */
+    public static final ParameterDescriptor<Double> SCALE_FACTOR;
+
+    /**
+     * The group of all parameters expected by this coordinate operation.
+     */
+    static final ParameterDescriptorGroup PARAMETERS;
+    static {
+        final ParameterBuilder builder = builder();
+        SCALE_FACTOR = builder
+                .addIdentifier("1051")
+                .addName("Ellipsoid scaling factor")
+                .createStrictlyPositive(Double.NaN, Unit.ONE);
+
+        PARAMETERS = builder
+            .addIdentifier(IDENTIFIER)
+            .addName("Lambert Conic Conformal (2SP Michigan)")
+            .createGroupForMapProjection(
+                    LambertConformal2SP.LATITUDE_OF_FALSE_ORIGIN,
+                    LambertConformal2SP.LONGITUDE_OF_FALSE_ORIGIN,
+                    LambertConformal2SP.STANDARD_PARALLEL_1,
+                    LambertConformal2SP.STANDARD_PARALLEL_2,
+                    LambertConformal2SP.EASTING_AT_FALSE_ORIGIN,
+                    LambertConformal2SP.NORTHING_AT_FALSE_ORIGIN,
+                    SCALE_FACTOR);
+    }
+
+    /**
+     * Constructs a new provider.
+     */
+    public LambertConformalMichigan() {
+        super(PARAMETERS);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalMichigan.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

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=1690239&r1=1690238&r2=1690239&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 10:51:16 2015
@@ -31,6 +31,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.provider.LambertConformal2SP;
 import org.apache.sis.internal.referencing.provider.LambertConformalWest;
 import org.apache.sis.internal.referencing.provider.LambertConformalBelgium;
+import org.apache.sis.internal.referencing.provider.LambertConformalMichigan;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.util.Constants;
@@ -72,9 +73,13 @@ public class LambertConformal extends No
      * Codes for special kinds of Lambert projection. We do not provide such codes in public
API because
      * they duplicate the functionality of {@link OperationMethod} instances. We use them
only for convenience.
      *
+     * <p>Codes for SP1 case must be odd, and codes for SP2 case must be even.</p>
+     *
      * @see #getType(ParameterDescriptorGroup)
      */
-    static final byte SP1 = 1, SP2 = 2, WEST = 3, BELGIUM = 4;
+    private static final byte SP1  = 1,   SP2      = 2,
+                              WEST = 3,   BELGIUM  = 4,
+                                          MICHIGAN = 6;
 
     /**
      * Constant for the Belgium 2SP case. This is 29.2985 seconds, given here in radians.
@@ -89,7 +94,7 @@ public class LambertConformal extends No
     /**
      * Returns the (<var>role</var> → <var>parameter</var>) associations
for a Lambert projection of the given type.
      *
-     * @param  type One of {@link #SP1}, {@link #SP2}, {@link #WEST} or {@link #BELGIUM}
constants.
+     * @param  type One of {@link #SP1}, {@link #SP2}, {@link #WEST}, {@link #BELGIUM} and
{@link #MICHIGAN} constants.
      * @return The roles map to give to super-class constructor.
      */
     @SuppressWarnings("fallthrough")
@@ -99,7 +104,7 @@ public class LambertConformal extends No
          * "Scale factor" is not formally a "Lambert Conformal (2SP)" argument, but we accept
it
          * anyway for all Lambert projections since it may be used in some Well Known Text
(WKT).
          */
-        roles.put(ParameterRole.SCALE_FACTOR, LambertConformal1SP.SCALE_FACTOR);
+        ParameterDescriptor<Double> scaleFactor = LambertConformal1SP.SCALE_FACTOR;
         ParameterRole eastingDirection = ParameterRole.FALSE_EASTING;
         switch (type) {
             case WEST: {
@@ -116,6 +121,10 @@ public class LambertConformal extends No
                 roles.put(ParameterRole.CENTRAL_MERIDIAN, LambertConformal1SP.CENTRAL_MERIDIAN);
                 break;
             }
+            case MICHIGAN: {
+                scaleFactor = LambertConformalMichigan.SCALE_FACTOR;    // Ellipsoid scaling
factor (EPSG:1038)
+                // Fallthrough
+            }
             case BELGIUM:
             case SP2: {
                 roles.put(eastingDirection,               LambertConformal2SP.EASTING_AT_FALSE_ORIGIN);
@@ -125,6 +134,7 @@ public class LambertConformal extends No
             }
             default: throw new AssertionError(type);
         }
+        roles.put(ParameterRole.SCALE_FACTOR, scaleFactor);
         return roles;
     }
 
@@ -134,8 +144,10 @@ public class LambertConformal extends No
      *
      * <ul>
      *   <li><cite>"Lambert Conic Conformal (1SP)"</cite>.</li>
+     *   <li><cite>"Lambert Conic Conformal (West Orientated)"</cite>.</li>
      *   <li><cite>"Lambert Conic Conformal (2SP)"</cite>.</li>
      *   <li><cite>"Lambert Conic Conformal (2SP Belgium)"</cite>.</li>
+     *   <li><cite>"Lambert Conic Conformal (2SP Michigan)"</cite>.</li>
      * </ul>
      *
      * @param method     Description of the projection parameters.
@@ -152,7 +164,7 @@ public class LambertConformal extends No
     @Workaround(library="JDK", version="1.7")
     private LambertConformal(final OperationMethod method, final Parameters parameters, final
byte type) {
         super(method, parameters, roles(type));
-        double φ0 = getAndStore(parameters, (type == SP1 || type == WEST) ?
+        double φ0 = getAndStore(parameters, ((type & 1) != 0) ?  // Odd 'type' are SP1,
even 'type' are SP2.
                 LambertConformal1SP.LATITUDE_OF_ORIGIN : LambertConformal2SP.LATITUDE_OF_FALSE_ORIGIN);
         /*
          * Standard parallels (SP) are defined only for the 2SP case, but we look for them
unconditionally
@@ -238,10 +250,11 @@ public class LambertConformal extends No
      * If this method can not identify the type, then the parameters should be considered
as a 2SP case.
      */
     private static byte getType(final ParameterDescriptorGroup parameters) {
-        if (identMatch(parameters, "(?i).*\\bBelgium\\b.*", LambertConformalBelgium.IDENTIFIER))
return BELGIUM;
-        if (identMatch(parameters, "(?i).*\\bWest\\b.*",    LambertConformalWest   .IDENTIFIER))
return WEST;
-        if (identMatch(parameters, "(?i).*\\b2SP\\b.*",     LambertConformal2SP    .IDENTIFIER))
return SP2;
-        if (identMatch(parameters, "(?i).*\\b1SP\\b.*",     LambertConformal1SP    .IDENTIFIER))
return SP1;
+        if (identMatch(parameters, "(?i).*\\bBelgium\\b.*",  LambertConformalBelgium .IDENTIFIER))
return BELGIUM;
+        if (identMatch(parameters, "(?i).*\\bMichigan\\b.*", LambertConformalMichigan.IDENTIFIER))
return MICHIGAN;
+        if (identMatch(parameters, "(?i).*\\bWest\\b.*",     LambertConformalWest    .IDENTIFIER))
return WEST;
+        if (identMatch(parameters, "(?i).*\\b2SP\\b.*",      LambertConformal2SP     .IDENTIFIER))
return SP2;
+        if (identMatch(parameters, "(?i).*\\b1SP\\b.*",      LambertConformal1SP     .IDENTIFIER))
return SP1;
         return 0; // Unidentified case, to be considered as 2SP.
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1690239&r1=1690238&r2=1690239&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] Fri Jul 10 10:51:16 2015
@@ -13,3 +13,4 @@ org.apache.sis.internal.referencing.prov
 org.apache.sis.internal.referencing.provider.LambertConformal2SP
 org.apache.sis.internal.referencing.provider.LambertConformalWest
 org.apache.sis.internal.referencing.provider.LambertConformalBelgium
+org.apache.sis.internal.referencing.provider.LambertConformalMichigan

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=1690239&r1=1690238&r2=1690239&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 10:51:16 2015
@@ -25,6 +25,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.provider.LambertConformal2SP;
 import org.apache.sis.internal.referencing.provider.LambertConformalWest;
 import org.apache.sis.internal.referencing.provider.LambertConformalBelgium;
+import org.apache.sis.internal.referencing.provider.LambertConformalMichigan;
 import org.apache.sis.referencing.operation.transform.CoordinateDomain;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.test.DependsOnMethod;
@@ -198,6 +199,21 @@ public final strictfp class LambertConfo
     }
 
     /**
+     * Tests the <cite>"Lambert Conic Conformal (2SP Michigan)"</cite> case (EPSG:1051).
+     * 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#testLambertConicConformalMichigan()
+     */
+    @Test
+    @DependsOnMethod("testLambertConicConformal2SP")
+    public void testLambertConicConformalMichigan() throws FactoryException, TransformException
{
+        createGeoApiTest(new LambertConformalMichigan()).testLambertConicConformalMichigan();
+    }
+
+    /**
      * Tests the <cite>"Lambert Conic Conformal (1SP West Orientated)"</cite>
case (EPSG:9826)).
      *
      * @throws FactoryException if an error occurred while creating the map projection.



Mime
View raw message