sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1671213 [1/2] - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/main/java/org/apache/sis/parameter/ sis-referencing/src/main/java/org/apache/sis/referencing/operat...
Date Fri, 03 Apr 2015 23:01:16 GMT
Author: desruisseaux
Date: Fri Apr  3 23:01:15 2015
New Revision: 1671213

URL: http://svn.apache.org/r1671213
Log:
Referencing: added parameters for "Mercator (Variant C)" and "Mercator (Cylindrical)".
As a side effect of those new parameter groups, try again to re-organize the way we manage parameters
in an effort to make easier to find which OperationMethod use which parameters, and which parameters
are defined by EPSG and which are extensions found in GDAL.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java
      - copied, changed from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java
      - copied, changed from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java
      - copied, changed from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/EquidistantCylindrical.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.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/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MapProjectionTest.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

Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java (from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java&r1=1671016&r2=1671213&rev=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractMercator.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -16,65 +16,29 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
+import java.util.List;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.referencing.operation.CylindricalProjection;
 import org.apache.sis.parameter.Parameters;
-import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.operation.projection.Mercator;
 import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
- * The provider for "<cite>Mercator (variant B)</cite>" projection (EPSG:9805).
+ * Base class of providers for all Mercator projections, and for Mercator-like projections.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @author  Rueben Schulz (UBC)
  * @since   0.6
  * @version 0.6
  * @module
- *
- * @see <a href="http://www.remotesensing.org/geotiff/proj_list/mercator_2sp.html">Mercator 2SP on RemoteSensing.org</a>
  */
-public final class Mercator2SP extends MapProjection {
+public class AbstractMercator extends MapProjection {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = 6356028352681135786L;
-
-    /**
-     * The operation parameter descriptor for the <cite>Latitude of 1st standard parallel</cite> (φ₁) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
-     */
-    public static final ParameterDescriptor<Double> STANDARD_PARALLEL;
-
-    /**
-     * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
-     *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
-     *
-     * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.</p>
-     */
-    public static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
-     * Valid values range is [-180 … 180]° and default value is 0°.
-     */
-    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Scale factor at natural origin</cite> (k₀) parameter value.
-     * Valid values range is (0 … ∞) and default value is 1.
-     *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
-     */
-    public static final ParameterDescriptor<Double> SCALE_FACTOR;
+    private static final long serialVersionUID = 4478846770971053309L;
 
     /**
      * The operation parameter descriptor for the <cite>False easting</cite> (FE) parameter value.
@@ -89,64 +53,22 @@ public final class Mercator2SP extends M
     public static final ParameterDescriptor<Double> FALSE_NORTHING = EquidistantCylindrical.FALSE_NORTHING;
 
     /**
-     * The group of all parameters expected by this coordinate operation.
+     * Returns the given descriptor as an array, excluding the two first elements which are assumed
+     * to be the axis lengths.This method assumes that all elements in the given list are instances
+     * of {@link ParameterDescriptor}.
+     *
+     * @throws ArrayStoreException if a {@code descriptors} element is not an instance of {@link ParameterDescriptor}.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
-    static {
-        final ParameterBuilder builder = builder();
-
-        STANDARD_PARALLEL = createLatitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.STANDARD_PARALLEL)
-                .rename(Citations.GEOTIFF, "StdParallel1")
-                .rename(Citations.PROJ4,   "lat_1"), false);
-
-        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.CENTRAL_MERIDIAN)
-                .rename(Citations.GEOTIFF, "NatOriginLong"));
-
-        /*
-         * "Latitude of natural origin" and "Scale factor" are not formally parameters
-         * of the "Mercator (variant B)" projection according EPSG. But we declare them
-         * as optional parameters because they are sometime used.
-         */
-        builder.setRequired(false); // Will apply to all remaining parameters.
-        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(EquidistantCylindrical.LATITUDE_OF_ORIGIN)
-                .rename(Citations.GEOTIFF, "NatOriginLat")
-                .setRemarks(EquidistantCylindrical.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
-        SCALE_FACTOR = createScale(builder
-                .addIdentifier("8805")
-                .addName("Scale factor at natural origin")
-                .addName(Citations.OGC,     "scale_factor")
-                .addName(Citations.ESRI,    "Scale_Factor")
-                .addName(Citations.NETCDF,  "scale_factor_at_projection_origin")
-                .addName(Citations.GEOTIFF, "ScaleAtNatOrigin")
-                .addName(Citations.PROJ4,   "k")
-                .setRemarks(notFormalParameter(Mercator1SP.NAME, "Mercator (variant B)")));
-
-        PARAMETERS = builder
-            .addIdentifier(             "9805")
-            .addName(                   "Mercator (variant B)")     // Starting from EPSG version 7.6
-            .addName(                   "Mercator (2SP)")           // Prior to EPSG version 7.6
-            .addName(Citations.OGC,     "Mercator_2SP")
-            .addName(Citations.ESRI,    "Mercator")
-            .addName(Citations.NETCDF,  "Mercator")
-            .addName(Citations.GEOTIFF, "CT_Mercator")
-            .addName(Citations.PROJ4,   "merc")
-            .addIdentifier(Citations.MAP_INFO, "26")    // MapInfo names this projection "Regional Mercator".
-            .addIdentifier(Citations.S57,       "8")
-            .createGroupForMapProjection(
-                    STANDARD_PARALLEL,
-                    LATITUDE_OF_ORIGIN,
-                    CENTRAL_MERIDIAN,
-                    SCALE_FACTOR,
-                    FALSE_EASTING,
-                    FALSE_NORTHING);
+    static ParameterDescriptor<?>[] toArray(List<GeneralParameterDescriptor> descriptors) {
+        descriptors = descriptors.subList(2, descriptors.size());
+        return descriptors.toArray(new ParameterDescriptor<?>[descriptors.size()]);  // Intentional array subtype.
     }
 
     /**
-     * Constructs a new provider.
+     * For subclass constructors only.
      */
-    public Mercator2SP() {
-        super(PARAMETERS);
+    AbstractMercator(final ParameterDescriptorGroup parameters) {
+        super(parameters);
     }
 
     /**
@@ -155,7 +77,7 @@ public final class Mercator2SP extends M
      * @return {@code CylindricalProjection.class}
      */
     @Override
-    public Class<CylindricalProjection> getOperationType() {
+    public final Class<CylindricalProjection> getOperationType() {
         return CylindricalProjection.class;
     }
 
@@ -165,7 +87,7 @@ public final class Mercator2SP extends M
      * @return The map projection created from the given parameter values.
      */
     @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
+    protected final NormalizedProjection createProjection(final Parameters parameters) {
         return new Mercator(this, parameters);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -121,7 +121,7 @@ abstract class AbstractProvider extends
     }
 
     /**
-     * Creates a descriptor for a latitude parameter in degrees.
+     * Creates a descriptor for a latitude parameter in degrees with a default value of 0°.
      */
     static ParameterDescriptor<Double> createLatitude(final ParameterBuilder builder, final boolean includePoles) {
         return builder.createBounded(MeasurementRange.create(
@@ -131,7 +131,7 @@ abstract class AbstractProvider extends
     }
 
     /**
-     * Creates a descriptor for a longitude parameter in degrees.
+     * Creates a descriptor for a longitude parameter in degrees with a default value of 0°.
      */
     static ParameterDescriptor<Double> createLongitude(final ParameterBuilder builder) {
         return builder.createBounded(MeasurementRange.create(

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/EquidistantCylindrical.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/EquidistantCylindrical.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/EquidistantCylindrical.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/EquidistantCylindrical.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -29,8 +29,8 @@ import org.apache.sis.util.resources.Mes
 
 
 /**
- * The provider for "<cite>Equidistant Cylindrical</cite>" projection (EPSG:1028, EPSG:1029,
- * <span class="deprecated">EPSG:9842</span>, <span class="deprecated">EPSG:9823</span>).
+ * The provider for "<cite>Equidistant Cylindrical (Spherical)</cite>" projection
+ * (EPSG:1029, <span class="deprecated">EPSG:9823</span>).
  *
  * <div class="note"><b>Note:</b>
  * EPSG defines two codes for this projection, 1029 being the spherical case and 1028 the ellipsoidal case.
@@ -39,7 +39,7 @@ import org.apache.sis.util.resources.Mes
  *
  * <div class="note"><b>Note:</b>
  * EPSG:1028 and 1029 are the current codes, while EPSG:9842 and 9823 are deprecated codes.
- * The new and deprecated definitions differ only by their names. In the Apache SIS implementation,
+ * The new and deprecated definitions differ only by their parameters. In the Apache SIS implementation,
  * both current and legacy definitions are known, but the legacy names are marked as deprecated.</div>
  *
  * @author  John Grange
@@ -56,6 +56,11 @@ public final class EquidistantCylindrica
      */
     private static final long serialVersionUID = -278288251842178001L;
 
+    /*
+     * ACCESS POLICY: Only formal EPSG parameters shall be public.
+     * Parameters that we add ourselves should be package-privated.
+     */
+
     /**
      * The operation parameter descriptor for the <cite>Latitude of 1st standard parallel</cite> (φ₁) parameter value.
      * Valid values range is (-90 … 90)° and default value is 0°.
@@ -67,9 +72,9 @@ public final class EquidistantCylindrica
      * Valid values range is (-90 … 90)° and default value is 0°.
      *
      * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included for completeness in CRS labelling only.</p>
+     * This parameter is included for completeness in CRS labelling only, and is declared optional.</p>
      */
-    public static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
+    static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
 
     /**
      * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
@@ -92,7 +97,7 @@ public final class EquidistantCylindrica
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
 
@@ -112,9 +117,7 @@ public final class EquidistantCylindrica
                 .addName(Citations.ESRI,    "Central_Meridian")
                 .addName(Citations.NETCDF,  "longitude_of_projection_origin")
                 .addName(Citations.GEOTIFF, "ProjCenterLong")
-                .addName(Citations.PROJ4,   "lon_0")
-                .addDeprecatedIdentifier("8822", "8802")    // Was used by EPSG:9842 only.
-                .addDeprecatedName("Longitude of false origin", "Longitude of natural origin"));
+                .addName(Citations.PROJ4,   "lon_0"));
 
         FALSE_EASTING = createShift(builder
                 .addIdentifier("8806")
@@ -134,11 +137,13 @@ public final class EquidistantCylindrica
                 .addName(Citations.GEOTIFF, "FalseNorthing")
                 .addName(Citations.PROJ4,   "y_0"));
         /*
-         * "Latitude of natural origin" and "Scale factor" are not formally parameters
-         * of the "Equidistant Cylindrical" projection according EPSG.  But we declare
-         * them as optional parameters because they are sometime used.
+         * "Latitude of natural origin" is not formally parameters of the "Equidistant Cylindrical (Spherical)"
+         * projection according EPSG:1029.  But we declare it anyway (as an optional parameter) because it was
+         * part of the now deprecated EPSG:9823 definition (and also EPSG:9842, the ellipsoidal case),  and we
+         * still see it in use sometime. However, taking inspiration from the practice done in "Mercator (1SP)"
+         * projection, we require that the parameter value must be zero.
          */
-        LATITUDE_OF_ORIGIN = createConstant(builder     // Was used by EPSG:9842 and 9823.
+        LATITUDE_OF_ORIGIN = createConstant(builder     // Was used by EPSG:9823 (also EPSG:9842).
                 .addIdentifier("8801")
                 .addName("Latitude of natural origin")
                 .addName(Citations.OGC,     "latitude_of_origin")
@@ -150,11 +155,8 @@ public final class EquidistantCylindrica
                 .setRequired(false), 0.0);
 
         PARAMETERS = builder
-            .addIdentifier(             "1028")                     // The ellipsoidal case
-            .addIdentifier(             "1029")                     // The spherical case
-            .addDeprecatedIdentifier(   "9842", "1028")             // Using deprecated parameter names
-            .addDeprecatedIdentifier(   "9823", "1029")             // Using deprecated parameter names
-            .addName(                   "Equidistant Cylindrical")
+            .addIdentifier(             "1029")
+            .addDeprecatedIdentifier(   "9823", "1029")  // Using deprecated parameter names
             .addName(                   "Equidistant Cylindrical (Spherical)")
             .addName(Citations.OGC,     "Equirectangular")
             .addName(Citations.ESRI,    "Equidistant_Cylindrical")

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -172,14 +172,6 @@ public abstract class MapProjection exte
     }
 
     /**
-     * Copies the EPSG name and identifier from the given parameter into the builder.
-     * The EPSG objects are presumed the first name and identifier (this is not verified).
-     */
-    static ParameterBuilder onlyEPSG(final ParameterDescriptor<?> source, final ParameterBuilder builder) {
-        return builder.addIdentifier(source.getIdentifiers().iterator().next()).addName(source.getName());
-    }
-
-    /**
      * Copies all names except the EPSG one from the given parameter into the builder.
      * The EPSG name is presumed the first name and identifier (this is not verified).
      */
@@ -194,9 +186,8 @@ public abstract class MapProjection exte
      * Creates a remarks for parameters that are not formally EPSG parameter.
      *
      * @param origin The name of the projection for where the parameter is formally used.
-     * @param usedIn The name of the projection where we also use that parameter.
      */
-    static InternationalString notFormalParameter(final String origin, final String usedIn) {
-        return Messages.formatInternational(Messages.Keys.NotFormalProjectionParameter_2, origin, usedIn);
+    static InternationalString notFormalParameter(final String origin) {
+        return Messages.formatInternational(Messages.Keys.NotFormalProjectionParameter_1, origin);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -18,20 +18,13 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
- * The provider for <cite>"Mercator (variant A)"</cite> projection
- * (EPSG:9804, EPSG:1026, <span class="deprecated">EPSG:9841</span>).
- * EPSG defines two codes for this projection, 1026 being the spherical case and 9804 the ellipsoidal case.
- *
- * <p>This provider reuses many of the parameters defined in {@link Mercator2SP}.</p>
+ * The provider for <cite>"Mercator (variant A)"</cite> projection (EPSG:9804).
+ * EPSG defines two projections with the same parameters, 1026 being the spherical case and 9804 the ellipsoidal case.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Rueben Schulz (UBC)
@@ -41,89 +34,65 @@ import org.apache.sis.referencing.operat
  *
  * @see <a href="http://www.remotesensing.org/geotiff/proj_list/mercator_1sp.html">Mercator 1SP on RemoteSensing.org</a>
  */
-public final class Mercator1SP extends MapProjection {
+public final class Mercator1SP extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
     private static final long serialVersionUID = -5886510621481710072L;
 
-    /**
-     * The name of this projection method.
+    /*
+     * ACCESS POLICY: Only formal EPSG parameters shall be public.
+     * Parameters that we add ourselves should be package-privated.
      */
-    static final String NAME = "Mercator (variant A)";
 
     /**
      * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
-     *
-     * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.</p>
+     * In theory, this parameter should not be used and its value should be 0 in all cases.
+     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.
      */
-    static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
+    public static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
 
     /**
      * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
      * Valid values range is [-180 … 180]° and default value is 0°.
      */
-    static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
+    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
 
     /**
      * The operation parameter descriptor for the <cite>Scale factor at natural origin</cite> (k₀) parameter value.
      * Valid values range is (0 … ∞) and default value is 1.
      */
-    static final ParameterDescriptor<Double> SCALE_FACTOR;
-
-    /**
-     * The operation parameter descriptor for the <cite>False easting</cite> (FE) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
-     */
-    static final ParameterDescriptor<Double> FALSE_EASTING;
-
-    /**
-     * The operation parameter descriptor for the <cite>False northing</cite> (FN) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
-     */
-    static final ParameterDescriptor<Double> FALSE_NORTHING;
+    public static final ParameterDescriptor<Double> SCALE_FACTOR;
 
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-
-        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(Mercator2SP.LATITUDE_OF_ORIGIN)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null)
-                .setRemarks(Mercator2SP.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
-        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(Mercator2SP.CENTRAL_MERIDIAN)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        SCALE_FACTOR = createScale(builder.addNamesAndIdentifiers(Mercator2SP.SCALE_FACTOR)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        FALSE_EASTING = createShift(builder.addNamesAndIdentifiers(Mercator2SP.FALSE_EASTING)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        FALSE_NORTHING = createShift(builder.addNamesAndIdentifiers(Mercator2SP.FALSE_NORTHING)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
+        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(EquidistantCylindrical.LATITUDE_OF_ORIGIN)
+                .rename(Citations.GEOTIFF, "NatOriginLat")
+                .setRemarks(EquidistantCylindrical.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
+
+        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.CENTRAL_MERIDIAN)
+                .rename(Citations.GEOTIFF, "NatOriginLong"));
+
+        SCALE_FACTOR = createScale(builder
+                .addIdentifier("8805")
+                .addName("Scale factor at natural origin")
+                .addName(Citations.OGC,     "scale_factor")
+                .addName(Citations.ESRI,    "Scale_Factor")
+                .addName(Citations.NETCDF,  "scale_factor_at_projection_origin")
+                .addName(Citations.GEOTIFF, "ScaleAtNatOrigin")
+                .addName(Citations.PROJ4,   "k"));
 
         PARAMETERS = builder
-            .addIdentifier(             "9804")                                                   // The ellipsoidal case
-            .addIdentifier(             "1026")                                                   // The spherical case
-            .addDeprecatedIdentifier(   "9841", "1026")                                           // The spherical (1SP) case
-            .addName(NAME            /* "Mercator (variant A)" */)                                // Starting from EPSG version 7.6
-            .addName(                   "Mercator (Spherical)")                                   // Starting from EPSG version 7.6
-            .addName(                   "Mercator (1SP)")                                         // Prior to EPSG version 7.6
-            .addDeprecatedName(         "Mercator (1SP) (Spherical)", "Mercator (Spherical)")     // Prior to EPSG version 7.6
-            .addName(Citations.OGC,     "Mercator_1SP")
-            .addName(sameNameAs(Citations.GEOTIFF, Mercator2SP.PARAMETERS))
-            .addName(sameNameAs(Citations.PROJ4,   Mercator2SP.PARAMETERS))
+            .addIdentifier(              "9804")                        // The ellipsoidal case
+            .addName(                    "Mercator (variant A)")        // Starting from EPSG version 7.6
+            .addName(                    "Mercator (1SP)")              // Prior to EPSG version 7.6
+            .addName(Citations.OGC,      "Mercator_1SP")
+            .addName(Citations.GEOTIFF,  "CT_Mercator")
+            .addName(Citations.PROJ4,    "merc")
             .addIdentifier(Citations.GEOTIFF,   "7")
             .addIdentifier(Citations.MAP_INFO, "10")    // MapInfo names this projection "Mercator".
             .createGroupForMapProjection(
@@ -140,24 +109,4 @@ public final class Mercator1SP extends M
     public Mercator1SP() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -18,17 +18,15 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
  * The provider for "<cite>Mercator (variant B)</cite>" projection (EPSG:9805).
  *
+ * <p>This provider reuses some of the parameters defined in {@link Mercator2SP}.</p>
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Rueben Schulz (UBC)
  * @since   0.6
@@ -37,12 +35,17 @@ import org.apache.sis.referencing.operat
  *
  * @see <a href="http://www.remotesensing.org/geotiff/proj_list/mercator_2sp.html">Mercator 2SP on RemoteSensing.org</a>
  */
-public final class Mercator2SP extends MapProjection {
+public final class Mercator2SP extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
     private static final long serialVersionUID = 6356028352681135786L;
 
+    /*
+     * ACCESS POLICY: Only formal EPSG parameters shall be public.
+     * Parameters that we add ourselves should be package-privated.
+     */
+
     /**
      * The operation parameter descriptor for the <cite>Latitude of 1st standard parallel</cite> (φ₁) parameter value.
      * Valid values range is (-90 … 90)° and default value is 0°.
@@ -51,76 +54,54 @@ public final class Mercator2SP extends M
 
     /**
      * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
+     * In theory, this parameter should not be used and its value should be 0 in all cases.
+     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.
      *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
-     *
-     * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.</p>
+     * <p>This parameter is used by {@link Mercator1SP} and is not formally a parameter of {@link Mercator2SP}
+     * projections. Nevertheless we declare it is as an optional parameter because it is sometime used in Well
+     * Known Text (WKT).</p>
      */
-    public static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
+    static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
 
     /**
      * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
      * Valid values range is [-180 … 180]° and default value is 0°.
      */
-    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
+    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN = Mercator1SP.CENTRAL_MERIDIAN;
 
     /**
-     * The operation parameter descriptor for the <cite>Scale factor at natural origin</cite> (k₀) parameter value.
-     * Valid values range is (0 … ∞) and default value is 1.
+     * The operation parameter descriptor for the <cite>Scale factor</cite> (not necessarily at natural origin)
+     * parameter value. Valid values range is (0 … ∞) and default value is 1.
      *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
+     * <p>This parameter is used by {@link Mercator1SP} and is not formally a parameter of {@link Mercator2SP}
+     * projections. Nevertheless we declare it is as an optional parameter because it is sometime used in Well
+     * Known Text (WKT). However it shall be interpreted as a <cite>Scale factor at the standard parallel</cite>
+     * rather than at the natural origin.</p>
      */
-    public static final ParameterDescriptor<Double> SCALE_FACTOR;
-
-    /**
-     * The operation parameter descriptor for the <cite>False easting</cite> (FE) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
-     */
-    public static final ParameterDescriptor<Double> FALSE_EASTING = EquidistantCylindrical.FALSE_EASTING;
-
-    /**
-     * The operation parameter descriptor for the <cite>False northing</cite> (FN) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
-     */
-    public static final ParameterDescriptor<Double> FALSE_NORTHING = EquidistantCylindrical.FALSE_NORTHING;
+    static final ParameterDescriptor<Double> SCALE_FACTOR;
 
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-
         STANDARD_PARALLEL = createLatitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.STANDARD_PARALLEL)
                 .rename(Citations.GEOTIFF, "StdParallel1")
                 .rename(Citations.PROJ4,   "lat_1"), false);
-
-        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.CENTRAL_MERIDIAN)
-                .rename(Citations.GEOTIFF, "NatOriginLong"));
-
         /*
-         * "Latitude of natural origin" and "Scale factor" are not formally parameters
-         * of the "Mercator (variant B)" projection according EPSG. But we declare them
-         * as optional parameters because they are sometime used.
+         * "Latitude of natural origin" and "Scale factor" are not formally parameters of the "Mercator (variant B)"
+         * projection according EPSG. But we declare them as optional parameters because they are sometime used.
+         * However we remove the EPSG name and identifier at least for the scale factor, because its meaning does
+         * not fit well in this context. The EPSG name is "Scale factor at natural origin" while actually the scale
+         * factor applied here would rather at the standard parallel.
          */
         builder.setRequired(false); // Will apply to all remaining parameters.
-        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(EquidistantCylindrical.LATITUDE_OF_ORIGIN)
-                .rename(Citations.GEOTIFF, "NatOriginLat")
-                .setRemarks(EquidistantCylindrical.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
-        SCALE_FACTOR = createScale(builder
-                .addIdentifier("8805")
-                .addName("Scale factor at natural origin")
-                .addName(Citations.OGC,     "scale_factor")
-                .addName(Citations.ESRI,    "Scale_Factor")
-                .addName(Citations.NETCDF,  "scale_factor_at_projection_origin")
-                .addName(Citations.GEOTIFF, "ScaleAtNatOrigin")
-                .addName(Citations.PROJ4,   "k")
-                .setRemarks(notFormalParameter(Mercator1SP.NAME, "Mercator (variant B)")));
+        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(Mercator1SP.LATITUDE_OF_ORIGIN)
+                .setRemarks(Mercator1SP.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
+
+        SCALE_FACTOR = createScale(exceptEPSG(Mercator1SP.SCALE_FACTOR, builder)
+                .setRemarks(notFormalParameter("Mercator (variant A)")));
 
         PARAMETERS = builder
             .addIdentifier(             "9805")
@@ -129,15 +110,14 @@ public final class Mercator2SP extends M
             .addName(Citations.OGC,     "Mercator_2SP")
             .addName(Citations.ESRI,    "Mercator")
             .addName(Citations.NETCDF,  "Mercator")
-            .addName(Citations.GEOTIFF, "CT_Mercator")
-            .addName(Citations.PROJ4,   "merc")
+            .addName(sameNameAs(Citations.PROJ4, Mercator1SP.PARAMETERS))
             .addIdentifier(Citations.MAP_INFO, "26")    // MapInfo names this projection "Regional Mercator".
             .addIdentifier(Citations.S57,       "8")
             .createGroupForMapProjection(
                     STANDARD_PARALLEL,
-                    LATITUDE_OF_ORIGIN,
+                    LATITUDE_OF_ORIGIN,     // Not formally a Mercator2SP parameter.
                     CENTRAL_MERIDIAN,
-                    SCALE_FACTOR,
+                    SCALE_FACTOR,           // Not formally a Mercator2SP parameter.
                     FALSE_EASTING,
                     FALSE_NORTHING);
     }
@@ -148,24 +128,4 @@ public final class Mercator2SP extends M
     public Mercator2SP() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java (from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java&r1=1671016&r2=1671213&rev=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator1SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MercatorSpherical.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -18,118 +18,61 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
- * The provider for <cite>"Mercator (variant A)"</cite> projection
- * (EPSG:9804, EPSG:1026, <span class="deprecated">EPSG:9841</span>).
- * EPSG defines two codes for this projection, 1026 being the spherical case and 9804 the ellipsoidal case.
- *
- * <p>This provider reuses many of the parameters defined in {@link Mercator2SP}.</p>
+ * The provider for <cite>"Mercator (Spherical)"</cite> projection (EPSG:1026, <span class="deprecated">EPSG:9841</span>).
+ * This provider reuses all parameters defined in {@link Mercator2SP}, except that the standard parallel is made optional
+ * since it is not formally a parameter of this projection.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Rueben Schulz (UBC)
  * @since   0.6
  * @version 0.6
  * @module
- *
- * @see <a href="http://www.remotesensing.org/geotiff/proj_list/mercator_1sp.html">Mercator 1SP on RemoteSensing.org</a>
  */
-public final class Mercator1SP extends MapProjection {
+public final class MercatorSpherical extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -5886510621481710072L;
+    private static final long serialVersionUID = 4761755206841656129L;
 
     /**
      * The name of this projection method.
      */
-    static final String NAME = "Mercator (variant A)";
-
-    /**
-     * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
-     *
-     * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.</p>
-     */
-    static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
-     * Valid values range is [-180 … 180]° and default value is 0°.
-     */
-    static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Scale factor at natural origin</cite> (k₀) parameter value.
-     * Valid values range is (0 … ∞) and default value is 1.
-     */
-    static final ParameterDescriptor<Double> SCALE_FACTOR;
+    public static final String NAME = "Mercator (Spherical)";
 
     /**
-     * The operation parameter descriptor for the <cite>False easting</cite> (FE) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
+     * The EPSG identifier, to be preferred to the name when available.
      */
-    static final ParameterDescriptor<Double> FALSE_EASTING;
-
-    /**
-     * The operation parameter descriptor for the <cite>False northing</cite> (FN) parameter value.
-     * Valid values range is unrestricted and default value is 0 metre.
-     */
-    static final ParameterDescriptor<Double> FALSE_NORTHING;
+    public static final String IDENTIFIER = "1026";
 
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-
-        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(Mercator2SP.LATITUDE_OF_ORIGIN)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null)
-                .setRemarks(Mercator2SP.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
-        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(Mercator2SP.CENTRAL_MERIDIAN)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        SCALE_FACTOR = createScale(builder.addNamesAndIdentifiers(Mercator2SP.SCALE_FACTOR)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        FALSE_EASTING = createShift(builder.addNamesAndIdentifiers(Mercator2SP.FALSE_EASTING)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
-
-        FALSE_NORTHING = createShift(builder.addNamesAndIdentifiers(Mercator2SP.FALSE_NORTHING)
-                .rename(Citations.ESRI,   (String[]) null)
-                .rename(Citations.NETCDF, (String[]) null));
+        /*
+         * The "Scale factor at natural origin" is not formally a parameter for this map projection.
+         * But we declare it (as an optional parameter) for compatibility with those who still use it.
+         */
+        final ParameterDescriptor<?> standardParallel = createLatitude(builder
+                .addNamesAndIdentifiers(Mercator2SP.STANDARD_PARALLEL)
+                .setRemarks(notFormalParameter("Mercator (variant B)"))
+                .setRequired(false), false);
 
         PARAMETERS = builder
-            .addIdentifier(             "9804")                                                   // The ellipsoidal case
-            .addIdentifier(             "1026")                                                   // The spherical case
-            .addDeprecatedIdentifier(   "9841", "1026")                                           // The spherical (1SP) case
-            .addName(NAME            /* "Mercator (variant A)" */)                                // Starting from EPSG version 7.6
-            .addName(                   "Mercator (Spherical)")                                   // Starting from EPSG version 7.6
-            .addName(                   "Mercator (1SP)")                                         // Prior to EPSG version 7.6
-            .addDeprecatedName(         "Mercator (1SP) (Spherical)", "Mercator (Spherical)")     // Prior to EPSG version 7.6
-            .addName(Citations.OGC,     "Mercator_1SP")
-            .addName(sameNameAs(Citations.GEOTIFF, Mercator2SP.PARAMETERS))
-            .addName(sameNameAs(Citations.PROJ4,   Mercator2SP.PARAMETERS))
-            .addIdentifier(Citations.GEOTIFF,   "7")
-            .addIdentifier(Citations.MAP_INFO, "10")    // MapInfo names this projection "Mercator".
+            .addIdentifier(IDENTIFIER)
+            .addDeprecatedIdentifier("9841", IDENTIFIER)
+            .addName(NAME)                                          // Starting from EPSG version 7.6
+            .addDeprecatedName("Mercator (1SP) (Spherical)", NAME)  // Prior to EPSG version 7.6
             .createGroupForMapProjection(
-                    LATITUDE_OF_ORIGIN,
-                    CENTRAL_MERIDIAN,
-                    SCALE_FACTOR,
+                    standardParallel,                   // Not formally a Mercator Spherical parameter.
+                    Mercator1SP.LATITUDE_OF_ORIGIN,
+                    Mercator1SP.CENTRAL_MERIDIAN,
+                    Mercator2SP.SCALE_FACTOR,           // Not formally a Mercator Spherical parameter.
                     FALSE_EASTING,
                     FALSE_NORTHING);
     }
@@ -137,27 +80,7 @@ public final class Mercator1SP extends M
     /**
      * Constructs a new provider.
      */
-    public Mercator1SP() {
+    public MercatorSpherical() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MillerCylindrical.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -16,16 +16,10 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import org.opengis.util.InternationalString;
-import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
@@ -57,7 +51,7 @@ import org.apache.sis.referencing.operat
  *
  * @see <a href="http://www.remotesensing.org/geotiff/proj_list/miller_cylindrical.html">Miller Cylindrical on RemoteSensing.org</a>
  */
-public final class MillerCylindrical extends MapProjection {
+public final class MillerCylindrical extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
@@ -71,47 +65,16 @@ public final class MillerCylindrical ext
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    private static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder().setCodeSpace(Citations.OGC, Constants.OGC);
-        /*
-         * The remotesensing.org web page said that OGC parameter name should be "longitude_of_center" and
-         * GeoTIFF parameter name should be "ProjCenterLong", but the common practice that we found with a
-         * quick search on the web seems to be the same parameter name than other Mercator projections. So
-         * we keep the later for now. Same argument apply to the latitude of origin parameter.
-         */
-        final ParameterDescriptor<?> centralMeridian = createLongitude(
-                exceptEPSG(Mercator1SP.CENTRAL_MERIDIAN, builder));
-
-        final ParameterDescriptor<?> falseEasting = createShift(
-                exceptEPSG(Mercator1SP.FALSE_EASTING, builder));
-
-        final ParameterDescriptor<?> falseNorthing = createShift(exceptEPSG(
-                Mercator1SP.FALSE_NORTHING, builder));
-        /*
-         * The "latitude of origin" and the "scale factor" are not formally a parameter of the "Miller Cylindrical"
-         * projection. But we declare them as an optional parameters because they are sometime used.
-         */
-        builder.setRequired(false); // Will apply to all remaining parameters.
-        final InternationalString remarks = notFormalParameter(Mercator1SP.NAME, "Miller Cylindrical");
-        final ParameterDescriptor<?> scaleFactor = createScale(
-                exceptEPSG(Mercator1SP.SCALE_FACTOR, builder).setRemarks(remarks));
-
-        final ParameterDescriptor<?> latitudeOfOrigin = createLatitude(
-                exceptEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder).setRemarks(remarks), false);
-
         PARAMETERS = builder
             .addName      (NAME)
             .addName      (Citations.GEOTIFF,  "CT_MillerCylindrical")
             .addIdentifier(Citations.GEOTIFF,  "20")
             .addName      (Citations.PROJ4,    "mill")
             .addIdentifier(Citations.MAP_INFO, "11")
-            .createGroupForMapProjection(
-                    latitudeOfOrigin,
-                    centralMeridian,
-                    scaleFactor, // Not an official parameter, provided for compatibility with those who still use it.
-                    falseEasting,
-                    falseNorthing);
+            .createGroupForMapProjection(toArray(MercatorSpherical.PARAMETERS.descriptors()));
     }
 
     /**
@@ -120,24 +83,4 @@ public final class MillerCylindrical ext
     public MillerCylindrical() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PseudoMercator.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -16,14 +16,8 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import org.opengis.util.InternationalString;
-import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
@@ -36,7 +30,7 @@ import org.apache.sis.referencing.operat
  * @version 0.6
  * @module
  */
-public final class PseudoMercator extends MapProjection {
+public final class PseudoMercator extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
@@ -48,40 +42,20 @@ public final class PseudoMercator extend
     public static final String NAME = "Popular Visualisation Pseudo Mercator";
 
     /**
+     * The EPSG identifier, to be preferred to the name when available.
+     */
+    public static final String IDENTIFIER = "1024";
+
+    /**
      * The group of all parameters expected by this coordinate operation.
      */
     public static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-
-        final ParameterDescriptor<?> latitudeOfOrigin = createLatitude(
-                onlyEPSG(Mercator1SP.LATITUDE_OF_ORIGIN, builder), false);
-
-        final ParameterDescriptor<?> centralMeridian = createLongitude(
-                onlyEPSG(Mercator1SP.CENTRAL_MERIDIAN, builder));
-
-        final ParameterDescriptor<?> falseEasting = createShift(
-                onlyEPSG(Mercator1SP.FALSE_EASTING, builder));
-
-        final ParameterDescriptor<?> falseNorthing = createShift(
-                onlyEPSG(Mercator1SP.FALSE_NORTHING, builder));
-        /*
-         * The scale factor is not formally a parameter of the "Popular Visualisation Pseudo Mercator" projection
-         * according EPSG. But we declare it as an optional parameters because it is sometime used.
-         */
-        final InternationalString remarks = notFormalParameter(Mercator1SP.NAME, "Pseudo Mercator");
-        final ParameterDescriptor<?> scaleFactor = createScale(onlyEPSG(Mercator1SP.SCALE_FACTOR, builder)
-                .setRemarks(remarks).setRequired(false));
-
         PARAMETERS = builder
-            .addIdentifier("1024")
+            .addIdentifier(IDENTIFIER)
             .addName(NAME)
-            .createGroupForMapProjection(
-                    latitudeOfOrigin,
-                    centralMeridian,
-                    scaleFactor, // Not an official parameter, provided for compatibility with those who still use it.
-                    falseEasting,
-                    falseNorthing);
+            .createGroupForMapProjection(toArray(MercatorSpherical.PARAMETERS.descriptors()));
     }
 
     /**
@@ -90,24 +64,4 @@ public final class PseudoMercator extend
     public PseudoMercator() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java (from r1671016, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java&r1=1671016&r2=1671213&rev=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/RegionalMercator.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -18,154 +18,85 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
-import org.opengis.referencing.operation.CylindricalProjection;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.referencing.operation.projection.Mercator;
-import org.apache.sis.referencing.operation.projection.NormalizedProjection;
 
 
 /**
- * The provider for "<cite>Mercator (variant B)</cite>" projection (EPSG:9805).
+ * The provider for "<cite>Mercator (variant C)</cite>" projection (EPSG:1044).
  *
- * @author  Martin Desruisseaux (IRD, Geomatys)
- * @author  Rueben Schulz (UBC)
+ * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
  * @version 0.6
  * @module
- *
- * @see <a href="http://www.remotesensing.org/geotiff/proj_list/mercator_2sp.html">Mercator 2SP on RemoteSensing.org</a>
  */
-public final class Mercator2SP extends MapProjection {
+public class RegionalMercator extends AbstractMercator {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = 6356028352681135786L;
+    private static final long serialVersionUID = 5957081563587752477L;
 
     /**
-     * The operation parameter descriptor for the <cite>Latitude of 1st standard parallel</cite> (φ₁) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
+     * The name of this projection method.
      */
-    public static final ParameterDescriptor<Double> STANDARD_PARALLEL;
+    public static final String NAME = "Mercator (variant C)";
 
     /**
-     * The operation parameter descriptor for the <cite>Latitude of natural origin</cite> (φ₀) parameter value.
-     * Valid values range is (-90 … 90)° and default value is 0°.
-     *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
-     *
-     * <p>In theory, this parameter should not be used and its value should be 0 in all cases.
-     * This parameter is included in the EPSG dataset for completeness in CRS labelling only.</p>
+     * The EPSG identifier, to be preferred to the name when available.
      */
-    public static final ParameterDescriptor<Double> LATITUDE_OF_ORIGIN;
+    public static final String IDENTIFIER = "1044";
 
     /**
-     * The operation parameter descriptor for the <cite>Longitude of natural origin</cite> (λ₀) parameter value.
-     * Valid values range is [-180 … 180]° and default value is 0°.
-     */
-    public static final ParameterDescriptor<Double> CENTRAL_MERIDIAN;
-
-    /**
-     * The operation parameter descriptor for the <cite>Scale factor at natural origin</cite> (k₀) parameter value.
-     * Valid values range is (0 … ∞) and default value is 1.
-     *
-     * <p>This parameter is taken from {@link Mercator1SP}. It is not formally a parameter from the {@code Mercator2SP}
-     * projection. Nevertheless we take is as an optional parameter because it is sometime used in Well Known Text.</p>
+     * The operation parameter descriptor for the <cite>Latitude of false origin</cite> parameter value.
+     * Valid values range is (-90 … 90)° and default value is 0°.
      */
-    public static final ParameterDescriptor<Double> SCALE_FACTOR;
+    public static final ParameterDescriptor<Double> LATITUDE_OF_FALSE_ORIGIN;
 
     /**
-     * The operation parameter descriptor for the <cite>False easting</cite> (FE) parameter value.
+     * The operation parameter descriptor for the <cite>Easting at false origin</cite> (Ef) parameter value.
      * Valid values range is unrestricted and default value is 0 metre.
      */
-    public static final ParameterDescriptor<Double> FALSE_EASTING = EquidistantCylindrical.FALSE_EASTING;
+    public static final ParameterDescriptor<Double> EASTING_AT_FALSE_ORIGIN;
 
     /**
-     * The operation parameter descriptor for the <cite>False northing</cite> (FN) parameter value.
+     * The operation parameter descriptor for the <cite>Northing at false origin</cite> (Nf) parameter value.
      * Valid values range is unrestricted and default value is 0 metre.
      */
-    public static final ParameterDescriptor<Double> FALSE_NORTHING = EquidistantCylindrical.FALSE_NORTHING;
+    public static final ParameterDescriptor<Double> NORTHING_AT_FALSE_ORIGIN;
 
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    public static final ParameterDescriptorGroup PARAMETERS;
+    private static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
 
-        STANDARD_PARALLEL = createLatitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.STANDARD_PARALLEL)
-                .rename(Citations.GEOTIFF, "StdParallel1")
-                .rename(Citations.PROJ4,   "lat_1"), false);
-
-        CENTRAL_MERIDIAN = createLongitude(builder.addNamesAndIdentifiers(EquidistantCylindrical.CENTRAL_MERIDIAN)
-                .rename(Citations.GEOTIFF, "NatOriginLong"));
-
-        /*
-         * "Latitude of natural origin" and "Scale factor" are not formally parameters
-         * of the "Mercator (variant B)" projection according EPSG. But we declare them
-         * as optional parameters because they are sometime used.
-         */
-        builder.setRequired(false); // Will apply to all remaining parameters.
-        LATITUDE_OF_ORIGIN = createConstant(builder.addNamesAndIdentifiers(EquidistantCylindrical.LATITUDE_OF_ORIGIN)
-                .rename(Citations.GEOTIFF, "NatOriginLat")
-                .setRemarks(EquidistantCylindrical.LATITUDE_OF_ORIGIN.getRemarks()), 0.0);
-
-        SCALE_FACTOR = createScale(builder
-                .addIdentifier("8805")
-                .addName("Scale factor at natural origin")
-                .addName(Citations.OGC,     "scale_factor")
-                .addName(Citations.ESRI,    "Scale_Factor")
-                .addName(Citations.NETCDF,  "scale_factor_at_projection_origin")
-                .addName(Citations.GEOTIFF, "ScaleAtNatOrigin")
-                .addName(Citations.PROJ4,   "k")
-                .setRemarks(notFormalParameter(Mercator1SP.NAME, "Mercator (variant B)")));
+        LATITUDE_OF_FALSE_ORIGIN = createLatitude(builder
+                .addIdentifier("8821")
+                .addName("Latitude of false origin"), false);
+
+        EASTING_AT_FALSE_ORIGIN = createShift(builder
+                .addIdentifier("8826")
+                .addName("Easting at false origin"));
+
+        NORTHING_AT_FALSE_ORIGIN = createShift(builder
+                .addIdentifier("8827")
+                .addName("Northing at false origin"));
 
         PARAMETERS = builder
-            .addIdentifier(             "9805")
-            .addName(                   "Mercator (variant B)")     // Starting from EPSG version 7.6
-            .addName(                   "Mercator (2SP)")           // Prior to EPSG version 7.6
-            .addName(Citations.OGC,     "Mercator_2SP")
-            .addName(Citations.ESRI,    "Mercator")
-            .addName(Citations.NETCDF,  "Mercator")
-            .addName(Citations.GEOTIFF, "CT_Mercator")
-            .addName(Citations.PROJ4,   "merc")
-            .addIdentifier(Citations.MAP_INFO, "26")    // MapInfo names this projection "Regional Mercator".
-            .addIdentifier(Citations.S57,       "8")
+            .addIdentifier(IDENTIFIER)
+            .addName(NAME)
             .createGroupForMapProjection(
-                    STANDARD_PARALLEL,
-                    LATITUDE_OF_ORIGIN,
-                    CENTRAL_MERIDIAN,
-                    SCALE_FACTOR,
-                    FALSE_EASTING,
-                    FALSE_NORTHING);
+                    Mercator2SP.STANDARD_PARALLEL,
+                    Mercator2SP.CENTRAL_MERIDIAN,
+                    LATITUDE_OF_FALSE_ORIGIN,
+                    EASTING_AT_FALSE_ORIGIN,
+                    NORTHING_AT_FALSE_ORIGIN);
     }
 
     /**
      * Constructs a new provider.
      */
-    public Mercator2SP() {
+    public RegionalMercator() {
         super(PARAMETERS);
     }
-
-    /**
-     * Returns the operation type for this map projection.
-     *
-     * @return {@code CylindricalProjection.class}
-     */
-    @Override
-    public Class<CylindricalProjection> getOperationType() {
-        return CylindricalProjection.class;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return The map projection created from the given parameter values.
-     */
-    @Override
-    protected NormalizedProjection createProjection(final Parameters parameters) {
-        return new Mercator(this, parameters);
-    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -131,6 +131,16 @@ public class DefaultParameterValueGroup
     }
 
     /**
+     * Conservatively returns {@code false} if this instance is for a subclass, because we do not know if the
+     * subclass overrides {@link #parameter(String)} in a way incompatible with {@link #parameterIfExist(String)}.
+     * (note: using {@code Class.getMethod(…).getDeclaringClass()} is presumed not worth the cost.
+     */
+    @Override
+    boolean isKnownImplementation() {
+        return getClass() == DefaultParameterValueGroup.class;
+    }
+
+    /**
      * Returns the abstract definition of this group of parameters.
      *
      * @return The abstract definition of this group of parameters.
@@ -202,6 +212,7 @@ public class DefaultParameterValueGroup
      */
     @Override
     public ParameterValue<?> parameter(final String name) throws ParameterNotFoundException {
+        ArgumentChecks.ensureNonNull("name", name);
         ParameterValue<?> value = parameterIfExist(name);
         if (value == null) {
             /*
@@ -229,10 +240,11 @@ public class DefaultParameterValueGroup
     /**
      * Returns the value in this group for the specified name if it exists, or {@code null} if none.
      * This method does not create any new {@code ParameterValue} instance.
+     *
+     * @see #isKnownImplementation()
      */
     @Override
-    final ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException {
-        ArgumentChecks.ensureNonNull("name", name);
+    ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException {
         final ParameterValueList values = this.values; // Protect against accidental changes.
         /*
          * Quick search for an exact match. By invoking 'descriptor(i)' instead of 'get(i)',

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -77,6 +77,16 @@ final class MapProjectionParameters exte
     }
 
     /**
+     * Returns {@code true} since the {@link #parameterIfExist(String)} method below is compatible with
+     * {@link #parameter(String)}. Note that we would need to revisit this condition if this class was
+     * no longer final.
+     */
+    @Override
+    boolean isKnownImplementation() {
+        return true;
+    }
+
+    /**
      * Returns the value in this group for the specified name. If the given name is one of the
      * "invisible" parameters, returns a dynamic parameter view without adding it to the list
      * of real parameter values.
@@ -86,7 +96,7 @@ final class MapProjectionParameters exte
      * @throws ParameterNotFoundException if there is no parameter value for the given name.
      */
     @Override
-    public ParameterValue<?> parameter(final String name) throws ParameterNotFoundException {
+    ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException {
         if (MapProjectionDescriptor.isHeuristicMatchForName(name, MapProjectionDescriptor.EARTH_RADIUS)) {
             ParameterValue<?> value = earthRadius;
             if (value == null) {
@@ -116,7 +126,7 @@ final class MapProjectionParameters exte
                 return value;
             }
         }
-        return super.parameter(name);
+        return super.parameterIfExist(name);
     }
 
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1671213&r1=1671212&r2=1671213&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Fri Apr  3 23:01:15 2015
@@ -343,23 +343,32 @@ public abstract class Parameters impleme
          * was created from an EPSG database, then we want to use the EPSG names instead than the OGC names.
          */
         final String name = getName(parameter);
-        if (parameter.getMinimumOccurs() == 0) {
-            /*
-             * The parameter is optional. We do not want to invoke 'parameter(name)' because we do not want
-             * to create a new parameter if the user did not supplied one.  We search the parameter ourself
-             * (so we don't create any) and return null if we do not find any.
-             *
-             * If we find a parameter,  we can return it directly only if this object is an instance of a known
-             * implementation (currently DefaultParameterValueGroup only), otherwise we do not know if the user
-             * overrode the 'parameter' method  (we do not use Class.getMethod(...).getDeclaringClass() because
-             * it is presumed not worth the cost).  In case of doubt, we delegate to 'parameter(name)'.
-             */
-            final ParameterValue<?> value = parameterIfExist(name);
-            if (value == null || getClass() == DefaultParameterValueGroup.class) {
-                return value;
-            }
+        /*
+         * We do not want to invoke 'parameter(name)' because we do not want to create a new parameter
+         * if the user did not supplied one.  We search the parameter ourself (so we don't create any)
+         * and return null if we do not find any.
+         *
+         * If we find a parameter, we can return it directly only if this object is an instance of a known
+         * implementation (currently DefaultParameterValueGroup and MapProjectionParameters), otherwise we
+         * do not know if the user overrode the 'parameter' method in a way incompatible with this method.
+         * We do not use Class.getMethod(…).getDeclaringClass() because it is presumed not worth the cost.
+         * In case of doubt, we delegate to 'parameter(name)'.
+         */
+        final ParameterValue<?> value = parameterIfExist(name);
+        if (value == null || isKnownImplementation()) {
+            return value;
+        } else {
+            return parameter(name);
         }
-        return parameter(name);
+    }
+
+    /**
+     * Returns {@code true} if this class is an implementation of an instance which is known to not override
+     * {@link #parameter(String)} in a way incompatible with {@link #parameterIfExist(String)}.
+     * The {@link DefaultParameterValueGroup} class needs to override this method.
+     */
+    boolean isKnownImplementation() {
+        return false;
     }
 
     /**



Mime
View raw message