Author: desruisseaux
Date: Tue Mar  3 23:34:43 2015
New Revision: 1663830

URL: http://svn.apache.org/r1663830
Log:
Refactoring: moved MapProjectionParameter classes to org.apache.sis.parameter 
in the hope to make easier to find them.
Removed some complicated "UniversalParameter" code (we may remove more later); 
we will try to use ParameterBuilder instead.

Added:
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
   (with props)
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionDescriptor.java
      - copied, changed from r1663765, 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionDescriptor.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
      - copied, changed from r1663765, 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionParameters.java
Removed:
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionDescriptor.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionParameters.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/UniversalParameters.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
    
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
    
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
    
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java

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=1663830&r1=1663829&r2=1663830&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] Tue Mar  3 23:34:43 2015
@@ -26,6 +26,7 @@ import org.opengis.referencing.Identifie
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.operation.transform.MathTransformProvider;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.Workaround;
 
 
 /**
@@ -77,6 +78,7 @@ abstract class AbstractProvider extends
      * Work around for RFE #4093999 in Sun's bug database
      * ("Relax constraint on placement of this()/super() call in 
constructors").
      */
+    @Workaround(library="JDK", version="1.7")
     private static Map<String,Object> toMap(final IdentifiedObject parameters) 
{
         ArgumentChecks.ensureNonNull("parameters", parameters);
         final Map<String,Object> properties = new HashMap<>(4);

Added: 
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=1663830&view=auto
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
 (added)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -0,0 +1,111 @@
+/*
+ * 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 java.util.Map;
+import java.util.HashMap;
+import javax.measure.unit.SI;
+import org.opengis.util.GenericName;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.referencing.operation.Projection;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.measure.MeasurementRange;
+import org.apache.sis.referencing.NamedIdentifier;
+import org.apache.sis.parameter.DefaultParameterDescriptor;
+
+import static org.apache.sis.metadata.iso.citation.Citations.*;
+
+
+/**
+ * Base class for all map projection providers defined in this package.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.6
+ * @version 0.6
+ * @module
+ */
+public abstract class MapProjection extends AbstractProvider {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 6280666068007678702L;
+
+    /**
+     * All names known to Apache SIS for the
+     * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMajor
 semi-major}
+     * parameter. This parameter is mandatory and has no default value. The 
range of valid values is (0 … ∞).
+     *
+     * <p>Some names for this parameter are {@code "semi_major"}, {@code 
"SemiMajor"} and {@code "a"}.</p>
+     *
+     * @see 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMajor
+     */
+    public static final DefaultParameterDescriptor<Double> SEMI_MAJOR;
+
+    /**
+     * All names known to Apache SIS for the
+     * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMinor
 semi-minor}
+     * parameter. This parameter is mandatory and has no default value. The 
range of valid values is (0 … ∞).
+     *
+     * <p>Some names for this parameter are {@code "semi_minor"}, {@code 
"SemiMinor"} and {@code "b"}.</p>
+     *
+     * @see 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMinor
+     */
+    public static final DefaultParameterDescriptor<Double> SEMI_MINOR;
+    static {
+        final MeasurementRange<Double> valueDomain = 
MeasurementRange.createGreaterThan(0, SI.METRE);
+        final GenericName[] aliases = {
+            new NamedIdentifier(ESRI,    "Semi_Major"),
+            new NamedIdentifier(NETCDF,  "semi_major_axis"),
+            new NamedIdentifier(GEOTIFF, "SemiMajor"),
+            new NamedIdentifier(PROJ4,   "a")
+        };
+        final Map<String,Object> properties = new HashMap<>(4);
+        properties.put(NAME_KEY,  Constants.SEMI_MAJOR);
+        properties.put(ALIAS_KEY, aliases);
+        SEMI_MAJOR = new DefaultParameterDescriptor<>(properties, 1, 1, 
Double.class, valueDomain, null, null);
+        /*
+         * Change in-place the name and aliases (we do not need to create new 
objects)
+         * before to create the SEMI_MINOR descriptor.
+         */
+        properties.put(NAME_KEY, Constants.SEMI_MINOR);
+        aliases[0] = new NamedIdentifier(ESRI,    "Semi_Minor");
+        aliases[1] = new NamedIdentifier(NETCDF,  "semi_minor_axis");
+        aliases[2] = new NamedIdentifier(GEOTIFF, "SemiMinor");
+        aliases[3] = new NamedIdentifier(PROJ4,   "b");
+        SEMI_MINOR = new DefaultParameterDescriptor<>(properties, 1, 1, 
Double.class, valueDomain, null, null);
+    }
+
+    /**
+     * Constructs a math transform provider from a set of parameters. The 
provider
+     * {@linkplain #getIdentifiers() identifiers} will be the same than the 
parameter ones.
+     *
+     * @param parameters The set of parameters (never {@code null}).
+     */
+    protected MapProjection(final ParameterDescriptorGroup parameters) {
+        super(2, 2, parameters);
+    }
+
+    /**
+     * Returns the operation type for this map projection.
+     *
+     * @return {@code Projection.class} or a sub-type.
+     */
+    @Override
+    public Class<? extends Projection> getOperationType() {
+        return Projection.class;
+    }
+}

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

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

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/UniversalParameters.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/UniversalParameters.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/UniversalParameters.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/UniversalParameters.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -20,8 +20,6 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Arrays;
 import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import javax.measure.unit.Unit;
@@ -33,7 +31,6 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.apache.sis.parameter.DefaultParameterDescriptor;
-import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.NamedIdentifier;
@@ -78,8 +75,10 @@ import static org.apache.sis.metadata.is
  * @since   0.6
  * @version 0.6
  * @module
+ *
+ * @todo We should replace this class by usage of the EPSG "Alias" table.
  */
-public final class UniversalParameters extends 
DefaultParameterDescriptor<Double> {
+final class UniversalParameters extends DefaultParameterDescriptor<Double> {
     /**
      * For cross-version compatibility.
      */
@@ -87,58 +86,6 @@ public final class UniversalParameters e
 
     /**
      * All names known to Apache SIS for the
-     * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMajor
 semi-major}
-     * parameter. This parameter is mandatory and has no default value. The 
range of valid values is (0 … ∞).
-     *
-     * <p>Some names for this parameter are {@code "semi_major"}, {@code 
"SemiMajor"} and {@code "a"}.</p>
-     *
-     * @see 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMajor
-     */
-    public static final UniversalParameters SEMI_MAJOR = new 
UniversalParameters(new NamedIdentifier[] {
-            new NamedIdentifier(OGC,     Constants.SEMI_MAJOR),
-            new NamedIdentifier(ESRI,    "Semi_Major"),
-            new NamedIdentifier(NETCDF,  "semi_major_axis"),
-            new NamedIdentifier(GEOTIFF, "SemiMajor"),
-            new NamedIdentifier(PROJ4,   "a")
-        }, Double.NaN, 0, Double.POSITIVE_INFINITY, SI.METRE, true);
-
-    /**
-     * All names known to Apache SIS for the
-     * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMinor
 semi-minor}
-     * parameter. This parameter is mandatory and has no default value. The 
range of valid values is (0 … ∞).
-     *
-     * <p>Some names for this parameter are {@code "semi_minor"}, {@code 
"SemiMinor"} and {@code "b"}.</p>
-     *
-     * @see 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#semiMinor
-     */
-    public static final UniversalParameters SEMI_MINOR = new 
UniversalParameters(new NamedIdentifier[] {
-            new NamedIdentifier(OGC,     Constants.SEMI_MINOR),
-            new NamedIdentifier(ESRI,    "Semi_Minor"),
-            new NamedIdentifier(NETCDF,  "semi_minor_axis"),
-            new NamedIdentifier(GEOTIFF, "SemiMinor"),
-            new NamedIdentifier(PROJ4,   "b")
-        }, Double.NaN, 0, Double.POSITIVE_INFINITY, SI.METRE, true);
-
-    /**
-     * All names known to Apache SIS for the Earth radius parameter.
-     * This is used in some NetCDF files instead of {@link #SEMI_MAJOR} and 
{@link #SEMI_MINOR}.
-     * This is not a standard parameter.
-     */
-    static final ParameterDescriptor<Double> EARTH_RADIUS = 
createDescriptor(new NamedIdentifier[] {
-            new NamedIdentifier(NETCDF, MapProjectionDescriptor.EARTH_RADIUS)
-        }, Double.NaN, 0.0, Double.POSITIVE_INFINITY, SI.METRE, false);
-
-    /**
-     * All known names for the inverse flattening parameter.
-     * This is used in some NetCDF files instead of {@link #SEMI_MINOR}.
-     * This is not a standard parameter.
-     */
-    static final ParameterDescriptor<Double> INVERSE_FLATTENING = 
createDescriptor(new NamedIdentifier[] {
-            new NamedIdentifier(NETCDF, 
MapProjectionDescriptor.INVERSE_FLATTENING)
-        }, Double.NaN, 0.0, Double.POSITIVE_INFINITY, Unit.ONE, false);
-
-    /**
-     * All known names for the
      * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#centralMeridian
      * central meridian} parameter.
      * This parameter is mandatory - meaning that it appears in {@link 
ParameterValueGroup}
@@ -176,7 +123,7 @@ public final class UniversalParameters e
         }, 0, -180, 180, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the
+     * All names known to Apache SIS for the
      * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#latitudeOfOrigin
      * latitude of origin} parameter.
      * This parameter is mandatory - meaning that it appears in {@link 
ParameterValueGroup}
@@ -195,14 +142,7 @@ public final class UniversalParameters e
     public static final UniversalParameters LATITUDE_OF_ORIGIN;
 
     /**
-     * All known names for the standard parallels parameter, as an array of 1 
or 2 elements.
-     * This is used in some NetCDF files instead of {@link 
#STANDARD_PARALLEL_1} and
-     * {@link #STANDARD_PARALLEL_2}. This is not a standard parameter.
-     */
-    static final ParameterDescriptor<double[]> STANDARD_PARALLEL;
-
-    /**
-     * All known names for the standard parallel 1 parameter.
+     * All names known to Apache SIS for the standard parallel 1 parameter.
      * This parameter is optional. The range of valid values is [-90 … 90]°.
      *
      * <blockquote><b>EPSG description:</b> For a conic projection with two 
standard parallels,
@@ -224,7 +164,6 @@ public final class UniversalParameters e
     static {
         final NamedIdentifier esri = new NamedIdentifier(ESRI, 
"Standard_Parallel_1");
         final NamedIdentifier epsg = new NamedIdentifier(EPSG, "Latitude of 
1st standard parallel");
-        final NamedIdentifier nc   = new NamedIdentifier(NETCDF, 
MapProjectionDescriptor.STANDARD_PARALLEL);
 
         LATITUDE_OF_ORIGIN = new UniversalParameters(new NamedIdentifier[] {
             new NamedIdentifier(EPSG,    "Latitude of false origin"),
@@ -243,23 +182,20 @@ public final class UniversalParameters e
             new NamedIdentifier(PROJ4,   "lat_0")
         }, 0, -90, 90, NonSI.DEGREE_ANGLE, true);
 
-        STANDARD_PARALLEL = new 
DefaultParameterDescriptor<>(Collections.singletonMap(NAME_KEY, nc), 1, 1,
-            double[].class, null, null, null);
-
         STANDARD_PARALLEL_1 = new UniversalParameters(new NamedIdentifier[] {
             new NamedIdentifier(EPSG,    "Latitude of standard parallel"), 
epsg,
             new NamedIdentifier(EPSG,    "Latitude of pseudo standard 
parallel"),
-            new NamedIdentifier(OGC,     
MapProjectionDescriptor.STANDARD_PARALLEL_1),
+            new NamedIdentifier(OGC,     Constants.STANDARD_PARALLEL_1),
             new NamedIdentifier(OGC,     "pseudo_standard_parallel_1"),
             new NamedIdentifier(ESRI,    "Pseudo_Standard_Parallel_1"), esri,
-            new NamedIdentifier(NETCDF,  "standard_parallel[1]"), nc, // 
Because this parameter is an array.
+            new NamedIdentifier(NETCDF,  "standard_parallel[1]"), // Because 
this parameter is an array.
             new NamedIdentifier(GEOTIFF, "StdParallel1"),
             new NamedIdentifier(PROJ4,   "lat_1")
         }, Double.NaN, -90, 90, NonSI.DEGREE_ANGLE, false);
     }
 
     /**
-     * All known names for the standard parallel 2 parameter.
+     * All names known to Apache SIS for the standard parallel 2 parameter.
      * This parameter is optional. The range of valid values is [-90 … 90]°.
      *
      * <blockquote><b>EPSG description:</b> For a conic projection with two 
standard parallels,
@@ -271,7 +207,7 @@ public final class UniversalParameters e
      */
     public static final UniversalParameters STANDARD_PARALLEL_2 = new 
UniversalParameters(new NamedIdentifier[] {
             new NamedIdentifier(EPSG,    "Latitude of 2nd standard parallel"),
-            new NamedIdentifier(OGC,     
MapProjectionDescriptor.STANDARD_PARALLEL_2),
+            new NamedIdentifier(OGC,     Constants.STANDARD_PARALLEL_2),
             new NamedIdentifier(ESRI,    "Standard_Parallel_2"),
             new NamedIdentifier(NETCDF,  "standard_parallel[2]"),
             new NamedIdentifier(GEOTIFF, "StdParallel2"),
@@ -279,7 +215,7 @@ public final class UniversalParameters e
         }, Double.NaN, -90, 90, NonSI.DEGREE_ANGLE, false);
 
     /**
-     * All known names for the {@code latitudeOf1stPoint} parameter.
+     * All names known to Apache SIS for the {@code latitudeOf1stPoint} 
parameter.
      * This parameter is mandatory and has no default value.
      * The range of valid values is [-90 … 90]°.
      */
@@ -288,7 +224,7 @@ public final class UniversalParameters e
         }, Double.NaN, -90, 90, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the {@code longitudeOf1stPoint} parameter.
+     * All names known to Apache SIS for the {@code longitudeOf1stPoint} 
parameter.
      * This parameter is mandatory and has no default value.
      * The range of valid values is [-180 … 180]°.
      */
@@ -297,7 +233,7 @@ public final class UniversalParameters e
         }, Double.NaN, -180, 180, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the {@code latitudeOf2ndPoint} parameter.
+     * All names known to Apache SIS for the {@code latitudeOf2ndPoint} 
parameter.
      * This parameter is mandatory and has no default value.
      * The range of valid values is [-90 … 90]°.
      */
@@ -306,7 +242,7 @@ public final class UniversalParameters e
         }, Double.NaN, -90, 90, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the {@code longitudeOf2ndPoint} parameter.
+     * All names known to Apache SIS for the {@code longitudeOf2ndPoint} 
parameter.
      * This parameter is mandatory and has no default value.
      * The range of valid values is [-180 … 180]°.
      */
@@ -315,7 +251,7 @@ public final class UniversalParameters e
         }, Double.NaN, -180, 180, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the {@code azimuth} parameter.
+     * All names known to Apache SIS for the {@code azimuth} parameter.
      * This parameter is mandatory and has no default value.
      *
      * <blockquote><b>EPSG description:</b> The azimuthal direction (north 
zero, east of north being positive)
@@ -334,7 +270,7 @@ public final class UniversalParameters e
         }, Double.NaN, -360, 360, NonSI.DEGREE_ANGLE, true);
 
     /**
-     * All known names for the {@code rectifiedGridAngle} parameter.
+     * All names known to Apache SIS for the {@code rectifiedGridAngle} 
parameter.
      * This is an optional parameter with valid values ranging [-360 … 360]°.
      * The default value is the value of the {@linkplain #AZIMUTH azimuth} 
parameter.
      *
@@ -353,7 +289,7 @@ public final class UniversalParameters e
         }, Double.NaN, -360, 360, NonSI.DEGREE_ANGLE, false);
 
     /**
-     * All known names for the
+     * All names known to Apache SIS for the
      * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#scaleFactor
      * scale factor} parameter.
      * This parameter is mandatory - meaning that it appears in {@link 
ParameterValueGroup}
@@ -381,7 +317,7 @@ public final class UniversalParameters e
         }, 1, 0, Double.POSITIVE_INFINITY, Unit.ONE, true);
 
     /**
-     * All known names for the {@code "X_Scale"} parameter.
+     * All names known to Apache SIS for the {@code "X_Scale"} parameter.
      * This parameter is optional and its default value is 1.
      * The range of valid values is unrestricted (but value 0 is not 
recommended).
      * In particular, negative values can be used for reverting the axis 
orientation.
@@ -396,7 +332,7 @@ public final class UniversalParameters e
         }, 1, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Unit.ONE, 
false);
 
     /**
-     * All known names for the {@code "Y_Scale"} parameter.
+     * All names known to Apache SIS for the {@code "Y_Scale"} parameter.
      * This parameter is optional and its default value is 1.
      * The range of valid values is unrestricted (but value 0 is not 
recommended).
      * In particular, negative values can be used for reverting the axis 
orientation.
@@ -411,7 +347,7 @@ public final class UniversalParameters e
         }, 1, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Unit.ONE, 
false);
 
     /**
-     * All known names for the
+     * All names known to Apache SIS for the
      * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#falseEasting
      * false easting} parameter.
      * This parameter is mandatory - meaning that it appears in {@link 
ParameterValueGroup}
@@ -436,7 +372,7 @@ public final class UniversalParameters e
         }, 0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, 
true);
 
     /**
-     * All known names for the
+     * All names known to Apache SIS for the
      * {@linkplain 
org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#falseNorthing
      * false northing} parameter.
      * This parameter is mandatory - meaning that it appears in {@link 
ParameterValueGroup}
@@ -707,78 +643,6 @@ public final class UniversalParameters e
     }
 
     /**
-     * Constructs a parameter group from a set of alias. The parameter group is
-     * identified by codes provided by one or more authorities. Common 
authorities are
-     * {@link Citations#OGC OGC} and {@link Citations#EPSG EPSG} for example.
-     *
-     * <p>Special rules:</p>
-     * <ul>
-     *   <li>The first entry in the {@code identifiers} array is the
-     *       {@linkplain ParameterDescriptorGroup#getName() primary name}.</li>
-     *   <li>If an identifier does not implements the {@link GenericName} 
interface, it is
-     *       used as an {@linkplain ParameterDescriptorGroup#getIdentifiers 
identifiers}.</li>
-     *   <li>All others are {@linkplain ParameterDescriptorGroup#getAlias 
aliases}.</li>
-     * </ul>
-     *
-     * <b>Note:</b> This method may modify in-place the given parameters array.
-     * Do not pass a cached array.
-     *
-     * @param  identifiers  The operation identifiers. Must contains at least 
one entry.
-     * @param  excludes     The authorities to exclude from all parameters, or 
{@code null} if none.
-     * @param  parameters   The set of parameters, or {@code null} or an empty 
array if none.
-     * @param  dynamicParameters   Non-standard dynamic parameters to add as 
bitwise combination of
-     *                      {@link MapProjectionDescriptor}, or 0 if none.
-     * @return The descriptor for the given identifiers.
-     */
-    static ParameterDescriptorGroup createDescriptorGroup(final Identifier[] 
identifiers,
-            final Citation[] excludes, final DefaultParameterDescriptor<?>[] 
parameters, final int dynamicParameters)
-    {
-        if (excludes != null) {
-            final Map<String,Object> properties = new HashMap<>();
-            for (int i=0; i<parameters.length; i++) {
-                final DefaultParameterDescriptor<?> param = parameters[i];
-                if (param.getValueClass() != Double.class) {
-                    continue;
-                }
-                properties.putAll(IdentifiedObjects.getProperties(param));
-                boolean forAlias = false;
-                boolean modified = false;
-                Object[] aliases;
-                do { // Executed exactly twice: once for identifier, then once 
for aliases.
-                    final String key = forAlias ? ALIAS_KEY : IDENTIFIERS_KEY;
-                    aliases = (Object[]) properties.get(key);
-                    if (aliases != null) {
-                        int n = 0;
-                        for (final Object alias : aliases) {
-                            if (alias instanceof Identifier) {
-                                if (ArraysExt.contains(excludes, ((Identifier) 
alias).getAuthority())) {
-                                    continue;
-                                }
-                            }
-                            aliases[n++] = alias;
-                        }
-                        // If at least one alias or identifier has been 
removed, remember that we
-                        // will need to create a new parameter in replacement 
to the provided one.
-                        if (n != aliases.length) {
-                            properties.put(key, Arrays.copyOf(aliases, n));
-                            modified = true;
-                        }
-                    }
-                } while ((forAlias = !forAlias) == true);
-                if (modified) {
-                    properties.put(NAME_KEY, aliases[0]); // In case the 
primary name was one of the excluded names.
-                    parameters[i] = new 
DefaultParameterDescriptor<>(properties, param.getMinimumOccurs(), 1,
-                            Double.class, param.getValueDomain(), null, 
(Double) param.getDefaultValue());
-                }
-                properties.clear();
-            }
-        }
-        final Map<String,Object> properties = toMap(identifiers);
-        return (dynamicParameters == 0) ? new 
DefaultParameterDescriptorGroup(properties, 1, 1, parameters) :
-                new MapProjectionDescriptor(properties, parameters, 
dynamicParameters);
-    }
-
-    /**
      * Puts the identifiers into a properties map suitable for {@link 
ParameterDescriptorGroup} constructor.
      * The first identifier is used as the primary name. All other elements 
are aliases.
      */

Copied: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionDescriptor.java
 (from r1663765, 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionDescriptor.java)
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionDescriptor.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionDescriptor.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionDescriptor.java&r1=1663765&r2=1663830&rev=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionDescriptor.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionDescriptor.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -14,15 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.internal.referencing.provider;
+package org.apache.sis.parameter;
 
 import java.util.Map;
+import org.opengis.util.GenericName;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
-import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
+import org.apache.sis.internal.referencing.provider.MapProjection;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Characters;
+import org.apache.sis.util.Workaround;
 
 
 /**
@@ -33,10 +37,9 @@ import org.apache.sis.util.CharSequences
  * <p>The non-standard parameters are:</p>
  * <ul>
  *   <li>{@code "earth_radius"} and {@code "inverse_flattening"}, which are 
mapped to the
- *       {@link UniversalParameters#SEMI_MAJOR} and {@link 
UniversalParameters#SEMI_MINOR} parameters.</li>
+ *       {@code "semi_major"} and {@code "semi_minor"} parameters.</li>
  *   <li>{@code "standard_parallel"} with an array value of 1 or 2 elements, 
which is mapped to
- *       {@link UniversalParameters#STANDARD_PARALLEL_1} and
- *       {@link UniversalParameters#STANDARD_PARALLEL_2}</li>
+ *       {@code "standard_parallel_1"} and {@code "standard_parallel_2"}</li>
  * </ul>
  *
  * The main purpose of this class is to supported transparently the NetCDF 
ways to express some parameter values.
@@ -56,55 +59,81 @@ final class MapProjectionDescriptor exte
 
     /**
      * The NetCDF parameter name for the Earth radius.
+     *
+     * @see Constants#SEMI_MAJOR
+     * @see Constants#SEMI_MINOR
      */
     static final String EARTH_RADIUS = "earth_radius";
 
     /**
      * The NetCDF parameter name for inverse flattening.
+     *
+     * @see Constants#SEMI_MAJOR
+     * @see Constants#SEMI_MINOR
      */
     static final String INVERSE_FLATTENING = "inverse_flattening";
 
     /**
      * The NetCDF parameter name for the standard parallels.
+     *
+     * @see Constants#STANDARD_PARALLEL_1
+     * @see Constants#STANDARD_PARALLEL_2
      */
     static final String STANDARD_PARALLEL = "standard_parallel";
 
     /**
-     * The OGC parameter name for the standard parallels.
-     */
-    static final String STANDARD_PARALLEL_1 = "standard_parallel_1",
-                        STANDARD_PARALLEL_2 = "standard_parallel_2";
-
-    /**
-     * A constant for the {@linkplain 
UniversalParameters#createDescriptorGroup factory method}
-     * method which indicate that the {@link #EARTH_RADIUS} parameter needs to 
be added.
+     * {@code true} if the {@link #STANDARD_PARALLEL} parameter can be added.
      */
-    static final int ADD_EARTH_RADIUS = 1;
+    final boolean hasStandardParallels;
 
     /**
-     * A constant for the {@linkplain 
UniversalParameters#createDescriptorGroup factory method}
-     * method which indicate that the {@link #STANDARD_PARALLEL} parameter 
needs to be added.
+     * Creates a new parameter descriptor from the given properties and 
parameters.
+     *
+     * @param properties Names, aliases and identifiers of the parameter group.
+     * @param parameters The "real" parameters.
      */
-    static final int ADD_STANDARD_PARALLEL = 2;
+    MapProjectionDescriptor(final Map<String,?> properties, final 
ParameterDescriptor<?>[] parameters) {
+        super(properties, 1, 1, addAxisLength(parameters));
+        boolean hasP1 = false;
+        boolean hasP2 = false;
+        for (final ParameterDescriptor<?> param : parameters) {
+            switch (param.getName().getCode()) {
+                case Constants.STANDARD_PARALLEL_1: hasP1 = true; break;
+                case Constants.STANDARD_PARALLEL_2: hasP2 = true; break;
+                default: {
+                    for (final GenericName alias : param.getAlias()) {
+                        switch (alias.tip().toString()) {
+                            case Constants.STANDARD_PARALLEL_1: hasP1 = true; 
break;
+                            case Constants.STANDARD_PARALLEL_2: hasP2 = true; 
break;
+                        }
+                    }
+                }
+            }
+            if (hasP1 & hasP2) break;
+        }
+        hasStandardParallels = (hasP1 & hasP2);
+    }
 
     /**
-     * Bitwise combination of {@code ADD_*} constants indicating which dynamic 
parameters to add.
+     * Work around for RFE #4093999 in Sun's bug database
+     * ("Relax constraint on placement of this()/super() call in 
constructors").
      */
-    final int dynamicParameters;
+    @Workaround(library="JDK", version="1.7")
+    private static ParameterDescriptor<?>[] addAxisLength(final 
ParameterDescriptor<?>[] parameters) {
+        final ParameterDescriptor<?>[] ext = new 
ParameterDescriptor<?>[parameters.length + 2];
+        ext[0] = MapProjection.SEMI_MAJOR;
+        ext[1] = MapProjection.SEMI_MINOR;
+        System.arraycopy(parameters, 0, ext, 2, parameters.length);
+        return ext;
+    }
 
     /**
-     * Creates a new parameter descriptor from the given properties and 
parameters.
-     *
-     * @param properties Names, aliases and identifiers of the parameter group.
-     * @param parameters The "real" parameters.
-     * @param dynamicParameters Bitwise combination of {@code ADD_*} constants
-     *        indicating which dynamic parameters to add.
+     * Returns {@code true} if the given parameter names should be considered 
equals.
+     * The algorithm used here shall be basically the same than the one used 
(indirectly)
+     * by {@link DefaultParameterDescriptorGroup#descriptor(String)}.
      */
-    MapProjectionDescriptor(final Map<String,?> properties, final 
ParameterDescriptor<?>[] parameters,
-            final int dynamicParameters)
-    {
-        super(properties, 1, 1, parameters);
-        this.dynamicParameters = dynamicParameters;
+    static boolean isHeuristicMatchForName(final String n1, final String n2) {
+        return CharSequences.equalsFiltered(n1, n2, 
Characters.Filter.LETTERS_AND_DIGITS, true);
     }
 
     /**
@@ -116,19 +145,16 @@ final class MapProjectionDescriptor exte
      * @throws ParameterNotFoundException if there is no parameter for the 
given name.
      */
     @Override
-    public GeneralParameterDescriptor descriptor(String name) throws 
ParameterNotFoundException {
-        name = CharSequences.trimWhitespaces(name);
-        if ((dynamicParameters & ADD_EARTH_RADIUS) != 0) {
-            if (name.equalsIgnoreCase(EARTH_RADIUS)) {
-                return UniversalParameters.EARTH_RADIUS;
-            }
-            if (name.equalsIgnoreCase(INVERSE_FLATTENING)) {
-                return UniversalParameters.INVERSE_FLATTENING;
-            }
+    public GeneralParameterDescriptor descriptor(final String name) throws 
ParameterNotFoundException {
+        if (isHeuristicMatchForName(name, EARTH_RADIUS)) {
+            return MapProjectionParameters.EarthRadius.DESCRIPTOR;
+        }
+        if (isHeuristicMatchForName(name, INVERSE_FLATTENING)) {
+            return MapProjectionParameters.InverseFlattening.DESCRIPTOR;
         }
-        if ((dynamicParameters & ADD_STANDARD_PARALLEL) != 0) {
-            if (name.equalsIgnoreCase(STANDARD_PARALLEL)) {
-                return UniversalParameters.STANDARD_PARALLEL;
+        if (hasStandardParallels) {
+            if (isHeuristicMatchForName(name, STANDARD_PARALLEL)) {
+                return MapProjectionParameters.StandardParallel.DESCRIPTOR;
             }
         }
         return super.descriptor(name);

Copied: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
 (from r1663765, 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionParameters.java)
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionParameters.java&r1=1663765&r2=1663830&rev=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjectionParameters.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/MapProjectionParameters.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -14,19 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.internal.referencing.provider;
+package org.apache.sis.parameter;
 
+import java.util.Collections;
+import java.util.Map;
+import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
 import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
-import org.apache.sis.parameter.DefaultParameterValue;
-import org.apache.sis.parameter.DefaultParameterValueGroup;
+import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArraysExt;
 
+import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.metadata.iso.citation.Citations.NETCDF;
+
 
 /**
  * Map projection parameters, with special processing for alternative ways to 
express the ellipsoid axis length
@@ -45,13 +51,85 @@ final class MapProjectionParameters exte
     private static final long serialVersionUID = -6801091012335717139L;
 
     /**
+     * The {@link EarthRadius} parameter instance, created when first needed.
+     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
+     */
+    private transient ParameterValue<Double> earthRadius;
+
+    /**
+     * The {@link InverseFlattening} parameter instance, created when first 
needed.
+     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
+     */
+    private transient ParameterValue<Double> inverseFlattening;
+
+    /**
+     * The {@link StandardParallel} parameter instance, created when first 
needed.
+     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
+     */
+    private transient ParameterValue<double[]> standardParallel;
+
+    /**
+     * Creates a new parameter value group. An instance of {@link 
MapProjectionDescriptor}
+     * is mandatory, because some method in this class will need to cast the 
descriptor.
+     */
+    MapProjectionParameters(final MapProjectionDescriptor descriptor) {
+        super(descriptor);
+    }
+
+    /**
+     * 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.
+     *
+     * @param  name The case insensitive name of the parameter to search for.
+     * @return The parameter value for the given name.
+     * @throws ParameterNotFoundException if there is no parameter value for 
the given name.
+     */
+    @Override
+    public ParameterValue<?> parameter(final String name) throws 
ParameterNotFoundException {
+        if (MapProjectionDescriptor.isHeuristicMatchForName(name, 
MapProjectionDescriptor.EARTH_RADIUS)) {
+            ParameterValue<?> value = earthRadius;
+            if (value == null) {
+                value = earthRadius = new EarthRadius(
+                        parameter(Constants.SEMI_MAJOR),
+                        parameter(Constants.SEMI_MINOR));
+            }
+            return value;
+        }
+        if (MapProjectionDescriptor.isHeuristicMatchForName(name, 
MapProjectionDescriptor.INVERSE_FLATTENING)) {
+            ParameterValue<?> value = inverseFlattening;
+            if (value == null) {
+                value = inverseFlattening = new InverseFlattening(
+                        parameter(Constants.SEMI_MAJOR),
+                        parameter(Constants.SEMI_MINOR));
+            }
+            return value;
+        }
+        if (((MapProjectionDescriptor) getDescriptor()).hasStandardParallels) {
+            if (MapProjectionDescriptor.isHeuristicMatchForName(name, 
MapProjectionDescriptor.STANDARD_PARALLEL)) {
+                ParameterValue<?> value = standardParallel;
+                if (value == null) {
+                    value = standardParallel = new StandardParallel(
+                            parameter(Constants.STANDARD_PARALLEL_1),
+                            parameter(Constants.STANDARD_PARALLEL_2));
+                }
+                return value;
+            }
+        }
+        return super.parameter(name);
+    }
+
+
+
+
+    /**
      * The earth radius parameter. This parameter is computed automatically 
from the {@code "semi_major"}
      * and {@code "semi_minor"} parameters. When explicitely set, this 
parameter value is also assigned
      * to the {@code "semi_major"} and {@code "semi_minor"} axis lengths.
      *
      * @see 
org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius()
      */
-    private final class EarthRadius extends DefaultParameterValue<Double> {
+    static final class EarthRadius extends DefaultParameterValue<Double> {
         /**
          * For cross-version compatibility. Actually instances of this class
          * are not expected to be serialized, but we try to be a bit safer 
here.
@@ -59,10 +137,33 @@ final class MapProjectionParameters exte
         private static final long serialVersionUID = 5848432458976184182L;
 
         /**
+         * All names known to Apache SIS for the Earth radius parameter.
+         * This is used in some NetCDF files instead of {@code SEMI_MAJOR} and 
{@code SEMI_MINOR}.
+         * This is not a standard parameter.
+         */
+        static final ParameterDescriptor<Double> DESCRIPTOR = new 
DefaultParameterDescriptor<>(
+                toMap(MapProjectionDescriptor.EARTH_RADIUS), 0, 1, 
Double.class,
+                MeasurementRange.createGreaterThan(0.0, SI.METRE), null, null);
+
+        /**
+         * Helper method for {@link #DESCRIPTOR} constructions.
+         */
+        static Map<String,?> toMap(final String name) {
+            return Collections.singletonMap(NAME_KEY, new 
NamedIdentifier(NETCDF, name));
+        }
+
+        /**
+         * The parameters for the semi-major and semi-minor axis length.
+         */
+        private final ParameterValue<?> semiMajor, semiMinor;
+
+        /**
          * Creates a new parameter.
          */
-        EarthRadius() {
-            super(UniversalParameters.EARTH_RADIUS);
+        EarthRadius(final ParameterValue<?> semiMajor, final ParameterValue<?> 
semiMinor) {
+            super(DESCRIPTOR);
+            this.semiMajor = semiMajor;
+            this.semiMinor = semiMinor;
         }
 
         /**
@@ -72,8 +173,8 @@ final class MapProjectionParameters exte
         protected void setValue(final Object value, final Unit<?> unit) {
             super.setValue(value, unit);   // Perform argument check.
             final double r = (Double) value;
-            parameter(Constants.SEMI_MAJOR).setValue(r, unit);
-            parameter(Constants.SEMI_MINOR).setValue(r, unit);
+            semiMajor.setValue(r, unit);
+            semiMinor.setValue(r, unit);
         }
 
         /**
@@ -83,8 +184,6 @@ final class MapProjectionParameters exte
          */
         @Override
         public double doubleValue() {
-            final ParameterValue<?> semiMajor = 
parameter(Constants.SEMI_MAJOR);
-            final ParameterValue<?> semiMinor = 
parameter(Constants.SEMI_MINOR);
             double r = semiMajor.doubleValue();
             if (semiMinor.getValue() != null) {
                 // Compute in unit of the semi-major axis.
@@ -99,7 +198,7 @@ final class MapProjectionParameters exte
          */
         @Override
         public Unit<?> getUnit() {
-            return parameter(Constants.SEMI_MAJOR).getUnit();
+            return semiMajor.getUnit();
         }
 
         /**
@@ -111,6 +210,9 @@ final class MapProjectionParameters exte
         }
     }
 
+
+
+
     /**
      * The inverse flattening parameter. This parameter is computed 
automatically from the {@code "semi_major"}
      * and {@code "semi_minor"} parameters. When explicitly set, this 
parameter value is used for computing the
@@ -118,7 +220,7 @@ final class MapProjectionParameters exte
      *
      * @see 
org.apache.sis.referencing.datum.DefaultEllipsoid#getInverseFlattening()
      */
-    private final class InverseFlattening extends 
DefaultParameterValue<Double> {
+    static final class InverseFlattening extends DefaultParameterValue<Double> 
{
         /**
          * For cross-version compatibility. Actually instances of this class
          * are not expected to be serialized, but we try to be a bit safer 
here.
@@ -126,10 +228,26 @@ final class MapProjectionParameters exte
         private static final long serialVersionUID = 4490056024453509851L;
 
         /**
+         * All names known to Apache SIS for the inverse flattening parameter.
+         * This is used in some NetCDF files instead of {@code SEMI_MINOR}.
+         * This is not a standard parameter.
+         */
+        static final ParameterDescriptor<Double> DESCRIPTOR = new 
DefaultParameterDescriptor<>(
+                EarthRadius.toMap(MapProjectionDescriptor.INVERSE_FLATTENING), 
0, 1, Double.class,
+                MeasurementRange.createGreaterThan(0.0, Unit.ONE), null, null);
+
+        /**
+         * The parameters for the semi-major and semi-minor axis length.
+         */
+        private final ParameterValue<?> semiMajor, semiMinor;
+
+        /**
          * Creates a new parameter.
          */
-        InverseFlattening() {
-            super(UniversalParameters.INVERSE_FLATTENING);
+        InverseFlattening(final ParameterValue<?> semiMajor, final 
ParameterValue<?> semiMinor) {
+            super(DESCRIPTOR);
+            this.semiMajor = semiMajor;
+            this.semiMinor = semiMinor;
         }
 
         /**
@@ -141,8 +259,6 @@ final class MapProjectionParameters exte
             super.setValue(value, unit);   // Perform argument check.
             final double ivf = (Double) value;
             if (!Double.isNaN(ivf)) {
-                final ParameterValue<?> semiMajor = 
parameter(Constants.SEMI_MAJOR);
-                final ParameterValue<?> semiMinor = 
parameter(Constants.SEMI_MINOR);
                 final Double a = (Double) semiMajor.getValue();
                 if (a != null) {
                     semiMinor.setValue(a * (1 - 1/ivf), semiMajor.getUnit());
@@ -156,8 +272,6 @@ final class MapProjectionParameters exte
          */
         @Override
         public double doubleValue() {
-            final ParameterValue<?> semiMajor = 
parameter(Constants.SEMI_MAJOR);
-            final ParameterValue<?> semiMinor = 
parameter(Constants.SEMI_MINOR);
             final Double a = (Double) semiMajor.getValue();
             if (a != null && semiMinor.getValue() != null) {
                 final double b = semiMinor.doubleValue(semiMajor.getUnit());
@@ -175,12 +289,15 @@ final class MapProjectionParameters exte
         }
     }
 
+
+
+
     /**
      * The standard parallels parameter as an array of {@code double}. This 
parameter is computed automatically
      * from the {@code "standard_parallel_1"} and {@code 
"standard_parallel_1"} standard parameters. When this
      * non-standard parameter is explicitely set, the array elements are given 
to the above-cited standard parameters.
      */
-    private final class StandardParallel extends 
DefaultParameterValue<double[]> {
+    static final class StandardParallel extends 
DefaultParameterValue<double[]> {
         /**
          * For cross-version compatibility. Actually instances of this class
          * are not expected to be serialized, but we try to be a bit safer 
here.
@@ -188,10 +305,26 @@ final class MapProjectionParameters exte
         private static final long serialVersionUID = -1379566730374843040L;
 
         /**
+         * All names known to Apache SIS for the standard parallels parameter, 
as an array of 1 or 2 elements.
+         * This is used in some NetCDF files instead of {@link 
#STANDARD_PARALLEL_1} and
+         * {@link #STANDARD_PARALLEL_2}. This is not a standard parameter.
+         */
+        static final ParameterDescriptor<double[]> DESCRIPTOR = new 
DefaultParameterDescriptor<>(
+                EarthRadius.toMap(MapProjectionDescriptor.STANDARD_PARALLEL),
+                0, 1, double[].class, null, null, null);
+
+        /**
+         * The parameters for the standard parallels.
+         */
+        private final ParameterValue<?> standardParallel1, standardParallel2;
+
+        /**
          * Creates a new parameter.
          */
-        StandardParallel() {
-            super(UniversalParameters.STANDARD_PARALLEL);
+        StandardParallel(final ParameterValue<?> standardParallel1, final 
ParameterValue<?> standardParallel2) {
+            super(DESCRIPTOR);
+            this.standardParallel1 = standardParallel1;
+            this.standardParallel2 = standardParallel2;
         }
 
         /**
@@ -202,8 +335,8 @@ final class MapProjectionParameters exte
         @SuppressWarnings("fallthrough")
         protected void setValue(final Object value, final Unit<?> unit) {
             super.setValue(value, unit);   // Perform argument check.
-            double standardParallel1 = Double.NaN;
-            double standardParallel2 = Double.NaN;
+            double p1 = Double.NaN;
+            double p2 = Double.NaN;
             if (value != null) {
                 final double[] values = (double[]) value;
                 switch (values.length) {
@@ -211,13 +344,13 @@ final class MapProjectionParameters exte
                         throw new IllegalArgumentException(Errors.format(
                                 Errors.Keys.UnexpectedArrayLength_2, 2, 
values.length));
                     }
-                    case 2: standardParallel2 = values[1]; // Fallthrough
-                    case 1: standardParallel1 = values[0]; // Fallthrough
+                    case 2: p2 = values[1]; // Fallthrough
+                    case 1: p1 = values[0]; // Fallthrough
                     case 0: break;
                 }
             }
-            
parameter(MapProjectionDescriptor.STANDARD_PARALLEL_1).setValue(standardParallel1,
 unit);
-            
parameter(MapProjectionDescriptor.STANDARD_PARALLEL_2).setValue(standardParallel2,
 unit);
+            standardParallel1.setValue(p1, unit);
+            standardParallel2.setValue(p2, unit);
         }
 
         /**
@@ -226,82 +359,15 @@ final class MapProjectionParameters exte
          */
         @Override
         public double[] getValue() {
-            final Double standardParallel1 = (Double) 
parameter(MapProjectionDescriptor.STANDARD_PARALLEL_1).getValue();
-            final Double standardParallel2 = (Double) 
parameter(MapProjectionDescriptor.STANDARD_PARALLEL_2).getValue();
-            if (standardParallel2 == null) {
-                if (standardParallel1 == null) {
+            final Double p1 = (Double) standardParallel1.getValue();
+            final Double p2 = (Double) standardParallel2.getValue();
+            if (p2 == null) {
+                if (p1 == null) {
                     return ArraysExt.EMPTY_DOUBLE;
                 }
-                return new double[] {standardParallel1};
+                return new double[] {p1};
             }
-            return new double[] {(standardParallel1 != null) ? 
standardParallel1 : Double.NaN, standardParallel2};
+            return new double[] {(p1 != null) ? p1 : Double.NaN, p2};
         }
     }
-
-    /**
-     * The {@link EarthRadius} parameter instance, created when first needed.
-     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
-     */
-    private transient ParameterValue<Double> earthRadius;
-
-    /**
-     * The {@link InverseFlattening} parameter instance, created when first 
needed.
-     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
-     */
-    private transient ParameterValue<Double> inverseFlattening;
-
-    /**
-     * The {@link StandardParallel} parameter instance, created when first 
needed.
-     * This is an "invisible" parameter, never shown in the {@link #values()} 
list.
-     */
-    private transient ParameterValue<double[]> standardParallel;
-
-    /**
-     * Creates a new parameter value group. An instance of {@link 
MapProjectionDescriptor}
-     * is mandatory, because some method in this class will need to cast the 
descriptor.
-     */
-    MapProjectionParameters(final MapProjectionDescriptor descriptor) {
-        super(descriptor);
-    }
-
-    /**
-     * 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.
-     *
-     * @param  name The case insensitive name of the parameter to search for.
-     * @return The parameter value for the given name.
-     * @throws ParameterNotFoundException if there is no parameter value for 
the given name.
-     */
-    @Override
-    public ParameterValue<?> parameter(String name) throws 
ParameterNotFoundException {
-        name = CharSequences.trimWhitespaces(name);
-        final int dynamicParameters = ((MapProjectionDescriptor) 
getDescriptor()).dynamicParameters;
-        if ((dynamicParameters & MapProjectionDescriptor.ADD_EARTH_RADIUS) != 
0) {
-            if (name.equalsIgnoreCase(MapProjectionDescriptor.EARTH_RADIUS)) {
-                ParameterValue<?> value = earthRadius;
-                if (value == null) {
-                    value = earthRadius = new EarthRadius();
-                }
-                return value;
-            }
-            if 
(name.equalsIgnoreCase(MapProjectionDescriptor.INVERSE_FLATTENING)) {
-                ParameterValue<?> value = inverseFlattening;
-                if (value == null) {
-                    value = inverseFlattening = new InverseFlattening();
-                }
-                return value;
-            }
-        }
-        if ((dynamicParameters & 
MapProjectionDescriptor.ADD_STANDARD_PARALLEL) != 0) {
-            if 
(name.equalsIgnoreCase(MapProjectionDescriptor.STANDARD_PARALLEL)) {
-                ParameterValue<?> value = standardParallel;
-                if (value == null) {
-                    value = standardParallel = new StandardParallel();
-                }
-                return value;
-            }
-        }
-        return super.parameter(name);
-    }
 }

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -83,7 +83,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public class ParameterBuilder extends Builder<ParameterBuilder> {
@@ -160,7 +160,7 @@ public class ParameterBuilder extends Bu
     public ParameterDescriptor<Double> createStrictlyPositive(final double 
defaultValue, final Unit<?> unit) {
         final Range<Double> valueDomain;
         if (unit != null) {
-            valueDomain = MeasurementRange.create(0.0, false, 
Double.POSITIVE_INFINITY, false, unit);
+            valueDomain = MeasurementRange.createGreaterThan(0.0, unit);
         } else {
             valueDomain = NumberRange.create(0.0, false, 
Double.POSITIVE_INFINITY, false);
         }
@@ -285,6 +285,30 @@ public class ParameterBuilder extends Bu
     }
 
     /**
+     * Creates a descriptor group for the given cardinality and parameters.
+     *
+     * @param  minimumOccurs The {@linkplain 
DefaultParameterDescriptorGroup#getMinimumOccurs() minimum}
+     *                       number of times that values for this parameter 
group are required.
+     * @param  maximumOccurs The {@linkplain 
DefaultParameterDescriptorGroup#getMaximumOccurs() maximum}
+     *                       number of times that values for this parameter 
group are required.
+     * @param  parameters    The {@linkplain 
DefaultParameterDescriptorGroup#descriptors() parameter descriptors}
+     *                       for the group to create.
+     * @return The parameter descriptor group.
+     */
+    public ParameterDescriptorGroup createGroup(final int minimumOccurs, final 
int maximumOccurs,
+            final GeneralParameterDescriptor... parameters)
+    {
+        final ParameterDescriptorGroup group;
+        onCreate(false);
+        try {
+            group = new DefaultParameterDescriptorGroup(properties, 
minimumOccurs, maximumOccurs, parameters);
+        } finally {
+            onCreate(true);
+        }
+        return group;
+    }
+
+    /**
      * Creates a descriptor group for the given parameters. This is a 
convenience method for
      * {@link #createGroup(int, int, GeneralParameterDescriptor[])} with a 
cardinality of [0 … 1]
      * or [1 … 1] depending on the value given to the last call to {@link 
#setRequired(boolean)}.
@@ -298,23 +322,43 @@ public class ParameterBuilder extends Bu
     }
 
     /**
-     * Creates a descriptor group for the given cardinality and parameters.
+     * Creates a descriptor group for a map projection. This method 
automatically adds mandatory parameters
+     * for the <cite>semi-major</cite> and <cite>semi-minor axis 
length</cite>. Those parameters are usually
+     * not explicitely included in parameter definitions since the axis 
lengths can be inferred from the
+     * {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid}.
+     * However {@link 
org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory} 
needs them.
+     *
+     * <p>In addition, this method will also add hidden parameters for 
alternative ways to express some parameters.
+     * Those hidden parameters never appear in the {@linkplain 
DefaultParameterDescriptorGroup#descriptors() list
+     * of parameters}. However when one of those parameters is read or 
written, the work will be delegated to the
+     * standard parameters.</p>
+     *
+     * <table class="sis">
+     *   <caption>Parameters automatically added by this method</caption>
+     *   <tr><th>Name</th>                         <th>Visibility</th> 
<th>Comment</th></tr>
+     *   <tr><td>{@code "semi_major"}</td>         <td>Always</td>     
<td>Standard parameter in WKT 1.</td></tr>
+     *   <tr><td>{@code "semi_minor"}</td>         <td>Always</td>     
<td>Standard parameter in WKT 1.</td></tr>
+     *   <tr><td>{@code "earth_radius"}</td>       <td>Hidden</td>     
<td>Mapped to {@code "semi_major"} and {@code "semi_minor"} 
parameters.</td></tr>
+     *   <tr><td>{@code "inverse_flattening"}</td> <td>Hidden</td>     
<td>Mapped to {@code "semi_major"} and {@code "semi_minor"} 
parameters.</td></tr>
+     *   <tr><td>{@code "standard_parallel"}</td>  <td>Hidden</td>
+     *     <td>Array of 1 or 2 elements mapped to {@code 
"standard_parallel_1"} and {@code "standard_parallel_2"}.</td></tr>
+     * </table>
+     *
+     * Map projection parameter groups always have a {@linkplain 
DefaultParameterDescriptorGroup#getMinimumOccurs()
+     * minimum} and {@linkplain 
DefaultParameterDescriptorGroup#getMaximumOccurs() maximum occurrence} of 1,
+     * regardless the value given to {@link #setRequired(boolean)}.
      *
-     * @param  minimumOccurs The {@linkplain 
DefaultParameterDescriptorGroup#getMinimumOccurs() minimum}
-     *                       number of times that values for this parameter 
group are required.
-     * @param  maximumOccurs The {@linkplain 
DefaultParameterDescriptorGroup#getMaximumOccurs() maximum}
-     *                       number of times that values for this parameter 
group are required.
-     * @param  parameters    The {@linkplain 
DefaultParameterDescriptorGroup#descriptors() parameter descriptors}
-     *                       for the group to create.
-     * @return The parameter descriptor group.
+     * @param  parameters The {@linkplain 
DefaultParameterDescriptorGroup#descriptors() parameter descriptors}
+     *         for the group to create.
+     * @return The parameter descriptor group for a map projection.
+     *
+     * @since 0.6
      */
-    public ParameterDescriptorGroup createGroup(final int minimumOccurs, final 
int maximumOccurs,
-            final GeneralParameterDescriptor... parameters)
-    {
+    public ParameterDescriptorGroup createGroupForMapProjection(final 
ParameterDescriptor<?>... parameters) {
         final ParameterDescriptorGroup group;
         onCreate(false);
         try {
-            group = new DefaultParameterDescriptorGroup(properties, 
minimumOccurs, maximumOccurs, parameters);
+            group = new MapProjectionDescriptor(properties, parameters);
         } finally {
             onCreate(true);
         }

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -325,9 +325,8 @@ public abstract class Builder<B extends
      */
     public B addName(final CharSequence name) {
         ensureNonNull("name", name);
-        final Object old = properties.put(IdentifiedObject.NAME_KEY, 
name.toString());
-        if (old != null) {
-            properties.put(IdentifiedObject.NAME_KEY, old); // Restore 
previous value.
+        if (properties.putIfAbsent(IdentifiedObject.NAME_KEY, name.toString()) 
!= null) {
+            // A primary name is already present. Add the given name as an 
alias instead.
             aliases.add(name instanceof GenericName ? (GenericName) name : 
NAMES.createLocalName(namespace(), name));
         }
         return self();
@@ -369,9 +368,8 @@ public abstract class Builder<B extends
         } else {
             identifier = new NamedIdentifier(authority, name.toString());
         }
-        final Object old = properties.put(IdentifiedObject.NAME_KEY, 
identifier);
-        if (old != null) {
-            properties.put(IdentifiedObject.NAME_KEY, old); // Restore 
previous value.
+        if (properties.putIfAbsent(IdentifiedObject.NAME_KEY, identifier) != 
null) {
+            // A primary name is already present. Add the given name as an 
alias instead.
             aliases.add(identifier);
         }
         return self();
@@ -396,9 +394,8 @@ public abstract class Builder<B extends
      */
     public B addName(final Identifier name) {
         ensureNonNull("name", name);
-        final Object old = properties.put(IdentifiedObject.NAME_KEY, name);
-        if (old != null) {
-            properties.put(IdentifiedObject.NAME_KEY, old); // Restore 
previous value.
+        if (properties.putIfAbsent(IdentifiedObject.NAME_KEY, name) != null) {
+            // A primary name is already present. Add the given name as an 
alias instead.
             aliases.add(name instanceof GenericName ? (GenericName) name : new 
NamedIdentifier(name));
         }
         return self();
@@ -545,13 +542,20 @@ public abstract class Builder<B extends
      * @see #properties
      */
     protected void onCreate(final boolean cleanup) {
-        properties.put(IdentifiedObject.ALIAS_KEY,       cleanup ? null : 
aliases    .toArray(new GenericName[aliases    .size()]));
-        properties.put(IdentifiedObject.IDENTIFIERS_KEY, cleanup ? null : 
identifiers.toArray(new Identifier [identifiers.size()]));
+        final GenericName[] valueAlias;
+        final Identifier[]  valueIds;
         if (cleanup) {
             properties .put(IdentifiedObject.NAME_KEY, null);
             properties .remove(IdentifiedObject.REMARKS_KEY);
             aliases    .clear();
             identifiers.clear();
+            valueAlias = null;
+            valueIds   = null;
+        } else {
+            valueAlias = aliases    .toArray(new GenericName[aliases    
.size()]);
+            valueIds   = identifiers.toArray(new Identifier 
[identifiers.size()]);
         }
+        properties.put(IdentifiedObject.ALIAS_KEY,       valueAlias);
+        properties.put(IdentifiedObject.IDENTIFIERS_KEY, valueIds);
     }
 }

Modified: 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -28,6 +28,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.SingleOperation;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.util.Utilities;
+import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
@@ -243,6 +244,7 @@ public class DefaultOperationMethod exte
      * Work around for RFE #4093999 in Sun's bug database
      * ("Relax constraint on placement of this()/super() call in 
constructors").
      */
+    @Workaround(library="JDK", version="1.7")
     private static Map<String,?> getProperties(final MathTransform transform) {
         ensureNonNull("transform", transform);
         if (transform instanceof Parameterized) {

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -74,12 +74,20 @@ public final class Constants extends Sta
     /**
      * Name of the {@value} projection parameter, which is handled specially 
during WKT formatting.
      */
-    public static final String SEMI_MAJOR = "semi_major", SEMI_MINOR = 
"semi_minor";
+    public static final String SEMI_MAJOR = "semi_major",
+                               SEMI_MINOR = "semi_minor";
+
+    /**
+     * The OGC parameter name for the standard parallels.
+     */
+    public static final String STANDARD_PARALLEL_1 = "standard_parallel_1",
+                               STANDARD_PARALLEL_2 = "standard_parallel_2";
 
     /**
      * Name of the {@value} matrix parameters.
      */
-    public static final String NUM_ROW = "num_row", NUM_COL = "num_col";
+    public static final String NUM_ROW = "num_row",
+                               NUM_COL = "num_col";
 
     /**
      * The OGC name for <cite>"Affine parametric transformation"</cite>.

Modified: 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?rev=1663830&r1=1663829&r2=1663830&view=diff
==============================================================================
--- 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
 [UTF-8] (original)
+++ 
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
 [UTF-8] Tue Mar  3 23:34:43 2015
@@ -51,7 +51,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD)
  * @since   0.3
- * @version 0.5
+ * @version 0.6
  * @module
  *
  * @see RangeFormat
@@ -109,6 +109,22 @@ public class MeasurementRange<E extends
     }
 
     /**
+     * Constructs a range of {@code double} values greater than the given 
value.
+     * The {@code minValue} is often zero for creating a range of strictly 
positive values.
+     * This method may return a shared instance, at implementation choice.
+     *
+     * @param  minValue The minimal value (exclusive), or {@link 
Double#NEGATIVE_INFINITY} if none.
+     * @param  unit The unit of measurement, or {@code null} if unknown.
+     * @return The new range of numeric values greater than the given value.
+     *
+     * @since 0.6
+     */
+    public static MeasurementRange<Double> createGreaterThan(final double 
minValue, final Unit<?> unit) {
+        return unique(new MeasurementRange<>(Double.class,
+                valueOf("minValue", minValue, Double.NEGATIVE_INFINITY), 
false, null, false, unit));
+    }
+
+    /**
      * Constructs a range using the smallest type of {@link Number} that can 
hold the given values.
      * This method performs the same work than {@link NumberRange#createBestFit
      * NumberRange.createBestFit(…)} with an additional {@code unit} argument.
@@ -133,7 +149,7 @@ public class MeasurementRange<E extends
         if (type == null) {
             return null;
         }
-        return (MeasurementRange) unique(new MeasurementRange(type,
+        return unique(new MeasurementRange(type,
                 Numbers.cast(minValue, type), isMinIncluded,
                 Numbers.cast(maxValue, type), isMaxIncluded, unit));
     }


Reply via email to