sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1754380 [1/2] - in /sis/branches/JDK6: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/main/java/org/apache/sis/feature/builder/ core/sis-feature/src/test/java/org/apache/sis/feature/builder/ core/sis-referen...
Date Thu, 28 Jul 2016 09:41:05 GMT
Author: desruisseaux
Date: Thu Jul 28 09:41:04 2016
New Revision: 1754380

URL: http://svn.apache.org/viewvc?rev=1754380&view=rev
Log:
Merge the addition of AlbersEqualArea projection from JDK7 branch.

Added:
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AlbersEqualArea.java
      - copied unchanged from r1754378, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AlbersEqualArea.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java
      - copied, changed from r1754378, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java
      - copied unchanged from r1754378, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java
      - copied unchanged from r1754378, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/Benchmark.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
    sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java
    sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java
    sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java
    sis/branches/JDK6/core/sis-feature/src/test/java/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
    sis/branches/JDK6/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 28 09:41:04 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK7:1394913-1753262
-/sis/branches/JDK8:1584960-1753248
+/sis/branches/JDK7:1394913-1754378
+/sis/branches/JDK8:1584960-1753654
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -32,6 +32,7 @@ import org.opengis.util.InternationalStr
 import org.opengis.util.GenericName;
 import org.apache.sis.io.TableAppender;
 import org.apache.sis.io.TabularFormat;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
@@ -47,7 +48,6 @@ import org.opengis.feature.Feature;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.FeatureAssociationRole;
 import org.opengis.feature.Operation;
-import org.apache.sis.util.CharSequences;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AssociationRoleBuilder.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -18,6 +18,8 @@ package org.apache.sis.feature.builder;
 
 import org.opengis.util.GenericName;
 import org.apache.sis.feature.DefaultAssociationRole;
+
+// Branch-dependent imports
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;
 import org.opengis.feature.FeatureAssociationRole;

Modified: sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/AttributeTypeBuilder.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -32,7 +32,6 @@ import org.apache.sis.util.Classes;
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
 import org.opengis.feature.AttributeType;
-import org.opengis.feature.Feature;
 import org.opengis.feature.PropertyType;
 
 
@@ -254,9 +253,6 @@ public final class AttributeTypeBuilder<
      * @see #characteristics()
      */
     public <C> CharacteristicTypeBuilder<C> addCharacteristic(final Class<C> type) {
-        if (valueClass == Feature.class) {
-            throw new UnsupportedOperationException(errors().getString(Errors.Keys.IllegalOperationForValueClass_1, valueClass));
-        }
         ensureNonNull("type", type);
         final CharacteristicTypeBuilder<C> characteristic = new CharacteristicTypeBuilder<C>(this, type);
         characteristics.add(characteristic);

Modified: sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-feature/src/main/java/org/apache/sis/feature/builder/PropertyTypeBuilder.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -18,6 +18,8 @@ package org.apache.sis.feature.builder;
 
 import org.opengis.util.GenericName;
 import org.apache.sis.util.resources.Errors;
+
+// Branch-dependent imports
 import org.opengis.feature.AttributeType;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;

Modified: sis/branches/JDK6/core/sis-feature/src/test/java/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-feature/src/test/java/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-feature/src/test/java/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-feature/src/test/java/org/apache/sis/feature/builder/FeatureTypeBuilderTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -19,8 +19,11 @@ package org.apache.sis.feature.builder;
 import java.util.Iterator;
 import com.esri.core.geometry.Geometry;
 import com.esri.core.geometry.Point;
+import org.apache.sis.internal.feature.AttributeConvention;
+import org.apache.sis.feature.DefaultFeatureTypeTest;
 import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.test.DependsOnMethod;
+import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -30,9 +33,6 @@ import static org.junit.Assert.*;
 import org.opengis.feature.AttributeType;
 import org.opengis.feature.FeatureType;
 import org.opengis.feature.PropertyType;
-import org.apache.sis.feature.DefaultFeatureTypeTest;
-import org.apache.sis.internal.feature.AttributeConvention;
-import org.apache.sis.test.TestUtilities;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -39,6 +39,7 @@ import org.opengis.referencing.crs.Proje
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.EngineeringCRS;
+import org.opengis.referencing.operation.OperationNotFoundException;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.GeographicBoundingBox;
@@ -282,11 +283,17 @@ public final class CRS extends Static {
      *       for checking if the operation has sufficient accuracy for caller's purpose.</li>
      * </ul>
      *
+     * If the source and target CRS are equivalent, then this method returns an operation backed by an
+     * {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#isIdentity() identity}
+     * transform. If there is no known operation between the given pair of CRS, then this method throws an
+     * {@link OperationNotFoundException}.
+     *
      * @param  sourceCRS      the CRS of source coordinates.
      * @param  targetCRS      the CRS of target coordinates.
      * @param  areaOfInterest the area of interest, or {@code null} if none.
      * @return the mathematical operation from {@code sourceCRS} to {@code targetCRS}.
-     * @throws FactoryException if the operation can not be created.
+     * @throws OperationNotFoundException if no operation was found between the given pair of CRS.
+     * @throws FactoryException if the operation can not be created for another reason.
      *
      * @see DefaultCoordinateOperationFactory#createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem, CoordinateOperationContext)
      *

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -356,8 +356,12 @@ public class CoordinateOperationFinder e
         final CoordinateOperation step1;
         try {
             step1 = inverse(sourceCRS.getConversionFromBase());
+        } catch (OperationNotFoundException exception) {
+            throw exception;
+        } catch (FactoryException exception) {
+            throw new OperationNotFoundException(canNotInvert(sourceCRS), exception);
         } catch (NoninvertibleTransformException exception) {
-            throw new OperationNotFoundException(notFoundMessage(sourceCRS, targetCRS), exception);
+            throw new OperationNotFoundException(canNotInvert(sourceCRS), exception);
         }
         return concatenate(step1, step2);
     }
@@ -387,8 +391,12 @@ public class CoordinateOperationFinder e
         final CoordinateOperation step1;
         try {
             step1 = inverse(sourceCRS.getConversionFromBase());
+        } catch (OperationNotFoundException exception) {
+            throw exception;
+        } catch (FactoryException exception) {
+            throw new OperationNotFoundException(canNotInvert(sourceCRS), exception);
         } catch (NoninvertibleTransformException exception) {
-            throw new OperationNotFoundException(notFoundMessage(sourceCRS, targetCRS), exception);
+            throw new OperationNotFoundException(canNotInvert(sourceCRS), exception);
         }
         return concatenate(step1, step2, step3);
     }
@@ -1064,4 +1072,15 @@ public class CoordinateOperationFinder e
     private static String notFoundMessage(final IdentifiedObject source, final IdentifiedObject target) {
         return Errors.format(Errors.Keys.CoordinateOperationNotFound_2, CRSPair.label(source), CRSPair.label(target));
     }
+
+    /**
+     * Returns an error message for "Can not invert operation XYZ.".
+     * This is used for the construction of {@link OperationNotFoundException}.
+     *
+     * @param  crs  the CRS having a conversion that can not be inverted.
+     * @return A default error message.
+     */
+    private static String canNotInvert(final GeneralDerivedCRS crs) {
+        return Errors.format(Errors.Keys.NonInvertibleOperation_1, crs.getConversionFromBase().getName().getCode());
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -500,24 +500,52 @@ class CoordinateOperationRegistry {
 
     /**
      * Creates the inverse of the given single operation.
+     * If this operation succeed, then the returned coordinate operations has the following properties:
+     *
+     * <ul>
+     *   <li>Its {@code sourceCRS} is the {@code targetCRS} of the given operation.</li>
+     *   <li>Its {@code targetCRS} is the {@code sourceCRS} of the given operation.</li>
+     *   <li>Its {@code interpolationCRS} is {@code null}.</li>
+     *   <li>Its {@code MathTransform} is the
+     *       {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#inverse() inverse}
+     *       of the {@code MathTransform} of this operation.</li>
+     *   <li>Its domain of validity and accuracy is the same.</li>
+     * </ul>
+     *
+     * <div class="note"><b>Note:</b>
+     * in many cases, the inverse operation is numerically less accurate than the direct operation because it
+     * uses approximations like series expansions or iterative methods. However the numerical errors caused by
+     * those approximations are not of interest here, because they are usually much smaller than the inaccuracy
+     * due to the stochastic nature of coordinate transformations (not to be confused with coordinate conversions;
+     * see ISO 19111 for more information).</div>
      */
     final CoordinateOperation inverse(final SingleOperation op) throws NoninvertibleTransformException, FactoryException {
         final CoordinateReferenceSystem sourceCRS = op.getSourceCRS();
         final CoordinateReferenceSystem targetCRS = op.getTargetCRS();
         final MathTransform transform = op.getMathTransform().inverse();
+        final OperationMethod method = InverseOperationMethod.create(op.getMethod());
+        final Map<String,Object> properties = properties(INVERSE_OPERATION);
+        InverseOperationMethod.properties(op, properties);
+        /*
+         * Find a hint about whether the coordinate operation is a transformation or a conversion,
+         * but do not set any conversion subtype. In particular, do not specify a Projection type,
+         * because the inverse of a Projection does not implement the Projection interface.
+         */
         Class<? extends CoordinateOperation> type = null;
         if (op instanceof Transformation)  type = Transformation.class;
         else if (op instanceof Conversion) type = Conversion.class;
-        final Map<String,Object> properties = properties(INVERSE_OPERATION);
-        InverseOperationMethod.putMetadata(op, properties);
-        InverseOperationMethod.putParameters(op, properties);
-        return createFromMathTransform(properties, targetCRS, sourceCRS,
-                transform, InverseOperationMethod.create(op.getMethod()), null, type);
+        return createFromMathTransform(properties, targetCRS, sourceCRS, transform, method, null, type);
     }
 
     /**
      * Creates the inverse of the given operation, which may be single or compound.
      *
+     * <p><b>Design note:</b>
+     * we do not provide a {@code AbstractCoordinateOperation.inverse()} method. If the user wants an inverse method,
+     * he should invoke {@code CRS.findOperation(targetCRS, sourceCRS, null)} or something equivalent. This is because
+     * a new query of EPSG database may be necessary, and if no explicit definition is found there is too many arbitrary
+     * values to set in a default inverse operation for making that API public.</p>
+     *
      * @param  operation The operation to invert, or {@code null}.
      * @return The inverse of {@code operation}, or {@code null} if none.
      * @throws NoninvertibleTransformException if the operation is not invertible.

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -45,7 +45,7 @@ import org.apache.sis.util.Deprecable;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @XmlTransient
@@ -107,7 +107,15 @@ final class InverseOperationMethod exten
     }
 
     /**
-     * Copies accuracy and domain of validity metadata from the given operation into the given properties map.
+     * Infers the properties to give to an inverse coordinate operation.
+     * The returned map will contains three kind of information:
+     *
+     * <ul>
+     *   <li>Metadata (domain of validity, accuracy)</li>
+     *   <li>Parameter values, if possible</li>
+     * </ul>
+     *
+     * This method copies accuracy and domain of validity metadata from the given operation.
      * We presume that the inverse operation has the same accuracy than the direct operation.
      *
      * <div class="note"><b>Note:</b>
@@ -116,25 +124,25 @@ final class InverseOperationMethod exten
      * those approximations are not of interest here, because they are usually much smaller than the inaccuracy
      * due to the stochastic nature of coordinate transformations (not to be confused with coordinate conversions;
      * see ISO 19111 for more information).</div>
+     *
+     * If the inverse of the given operation can be represented by inverting the sign of all numerical
+     * parameter values, then this method copies also those parameters in a {@code "parameters"} entry.
+     *
+     * @param source  the operation for which to get the inverse parameters.
+     * @param target  where to store the inverse parameters.
      */
-    static void putMetadata(final SingleOperation source, final Map<String,Object> target) {
+    static void properties(final SingleOperation source, final Map<String,Object> target) {
         target.put(SingleOperation.DOMAIN_OF_VALIDITY_KEY, source.getDomainOfValidity());
         final Collection<PositionalAccuracy> accuracy = source.getCoordinateOperationAccuracy();
         if (!Containers.isNullOrEmpty(accuracy)) {
             target.put(SingleOperation.COORDINATE_OPERATION_ACCURACY_KEY,
                     accuracy.toArray(new PositionalAccuracy[accuracy.size()]));
         }
-    }
-
-    /**
-     * If the inverse of the given operation can be represented by inverting the sign of all numerical
-     * parameter values, copies those parameters in a {@code "parameters"} entry in the given map.
-     * Otherwise does nothing.
-     *
-     * @param source  the operation for which to get the inverse parameters.
-     * @param target  where to store the inverse parameters.
-     */
-    static void putParameters(final SingleOperation source, final Map<String,Object> target) {
+        /*
+         * If the inverse of the given operation can be represented by inverting the sign of all numerical
+         * parameter values, copies those parameters in a "parameters" entry in the properties map.
+         * Otherwise does nothing.
+         */
         final boolean isInvertible = isInvertible(source.getMethod());
         final ParameterValueGroup parameters = source.getParameterValues();
         final ParameterValueGroup copy = parameters.getDescriptor().createValue();

Copied: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java (from r1754378, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java?p2=sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java&p1=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java&r1=1754378&r2=1754380&rev=1754380&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -95,7 +95,8 @@ public class AlbersEqualArea extends Equ
     @SuppressWarnings("fallthrough")
     @Workaround(library="JDK", version="1.7")
     private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
-        final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
+        final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles =
+                new EnumMap<ParameterRole, ParameterDescriptor<Double>>(ParameterRole.class);
         roles.put(ParameterRole.FALSE_EASTING,    EASTING_AT_FALSE_ORIGIN);
         roles.put(ParameterRole.FALSE_NORTHING,   NORTHING_AT_FALSE_ORIGIN);
         roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_FALSE_ORIGIN);

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/CylindricalEqualArea.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -97,13 +97,6 @@ public class CylindricalEqualArea extend
     private final byte variant;
 
     /**
-     * Value of {@link #qm(double)} function (part of Snyder equation (3-12)) at pole (sinφ = 1).
-     *
-     * @see #computeCoefficients()
-     */
-    private transient double qmPolar;
-
-    /**
      * Creates a Cylindrical Equal Area projection from the given parameters.
      *
      * @param method     Description of the projection parameters.
@@ -177,16 +170,7 @@ public class CylindricalEqualArea extend
         ik.divide(k0);
         denormalize.convertAfter(0, k0, null);
         denormalize.convertAfter(1, ik, null);
-        computeCoefficients();
-    }
-
-    /**
-     * Invoked at construction time or on deserialization for computing the transient fields.
-     */
-    @Override
-    final void computeCoefficients() {
         super.computeCoefficients();
-        qmPolar = qm(1);
     }
 
     /**
@@ -195,7 +179,6 @@ public class CylindricalEqualArea extend
     CylindricalEqualArea(final CylindricalEqualArea other) {
         super(other);
         variant = other.variant;
-        qmPolar = other.qmPolar;
     }
 
     /**
@@ -236,8 +219,8 @@ public class CylindricalEqualArea extend
         final double φ    = srcPts[srcOff+1];
         final double sinφ = sin(φ);
         if (dstPts != null) {
-            dstPts[dstOff  ] = srcPts[srcOff];  // Multiplication by k₀ will be applied by the denormalization matrix.
-            dstPts[dstOff+1] = qm(sinφ);        // Multiplication by (1-ℯ²)/(2k₀) will be applied by the denormalization matrix.
+            dstPts[dstOff  ] = srcPts[srcOff];      // Multiplication by k₀ will be applied by the denormalization matrix.
+            dstPts[dstOff+1] = qm_ellipsoid(sinφ);  // Multiplication by (1-ℯ²)/(2k₀) will be applied by the denormalization matrix.
         }
         /*
          * End of map projection. Now compute the derivative, if requested.
@@ -266,7 +249,7 @@ public class CylindricalEqualArea extend
             dstOff--;
             while (--numPts >= 0) {
                 final double φ = dstPts[dstOff += 2];                   // Same as srcPts[srcOff + 1].
-                dstPts[dstOff] = qm(sin(φ));                            // Part of Synder equation (10-15)
+                dstPts[dstOff] = qm_ellipsoid(sin(φ));                  // Part of Synder equation (10-15)
             }
         }
     }
@@ -284,7 +267,7 @@ public class CylindricalEqualArea extend
     {
         final double y   = srcPts[srcOff+1];            // Must be before writing x.
         dstPts[dstOff  ] = srcPts[srcOff  ];            // Must be before writing y.
-        dstPts[dstOff+1] = φ(y / qmPolar);
+        dstPts[dstOff+1] = φ(y);
         /*
          * Equation 10-26 of Synder gives β = asin(2y⋅k₀/(a⋅qPolar)).
          * In our case it simplifies to sinβ = (y/qmPolar) because:

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/EqualAreaProjection.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -18,6 +18,7 @@ package org.apache.sis.referencing.opera
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import org.apache.sis.util.resources.Errors;
 
 import static java.lang.Math.*;
 import static org.apache.sis.math.MathFunctions.atanh;
@@ -50,6 +51,14 @@ abstract class EqualAreaProjection exten
      *
      * Note that since this boolean is static final, the compiler should exclude the code in the branch that is never
      * executed (no need to comment-out that code).
+     *
+     *
+     * <p><b>BENCHMARK AND ANALYSIS:</b>
+     * as of July 2016, benchmarking shows no benefit in using trigonometric identities for {@code EqualAreaProjection}
+     * (contrarily to {@link ConformalProjection} where we did measured a benefit). This may be because in this class,
+     * the series expansion is unconditionally followed by iterative method in order to reach the centimetric precision.
+     * We observe that the original series expansion allows convergence in only one iteration, while the formulas using
+     * trigonometric identifies often requires two iterations. Consequently we disallow those modifications for now.</p>
      */
     private static final boolean ALLOW_TRIGONOMETRIC_IDENTITIES = false;
 
@@ -70,6 +79,13 @@ abstract class EqualAreaProjection exten
     private transient double ci2, ci4, ci8;
 
     /**
+     * Value of {@link #qm(double)} function (part of Snyder equation (3-12)) at pole (sinφ = 1).
+     *
+     * @see #computeCoefficients()
+     */
+    private transient double qmPolar;
+
+    /**
      * Creates a new normalized projection from the parameters computed by the given initializer.
      *
      * @param initializer The initializer for computing map projection internal parameters.
@@ -84,8 +100,8 @@ abstract class EqualAreaProjection exten
      */
     void computeCoefficients() {
         final double e2 = eccentricitySquared;
-        final double e4 = e2 * e2;
-        final double e6 = e2 * e4;
+        final double e4  = e2 * e2;
+        final double e6  = e2 * e4;
         ci2  =  517/5040.  * e6  +  31/180. * e4  +  1/3. * e2;
         ci4  =  251/3780.  * e6  +  23/360. * e4;
         ci8  =  761/45360. * e6;
@@ -100,6 +116,7 @@ abstract class EqualAreaProjection exten
             ci4 *=  8;
             ci8 *= 64;
         }
+        qmPolar = qm(1);
     }
 
     /**
@@ -113,6 +130,7 @@ abstract class EqualAreaProjection exten
         ci2 = other.ci2;
         ci4 = other.ci4;
         ci8 = other.ci8;
+        qmPolar = other.qmPolar;
     }
 
     /**
@@ -120,6 +138,8 @@ abstract class EqualAreaProjection exten
      * In order to get the <var>q</var> function, this method output must be multiplied
      * by <code>(1 - {@linkplain #eccentricitySquared})</code>.
      *
+     * <p>The <var>q</var> variable is named <var>α</var> in EPSG guidance notes.</p>
+     *
      * <p>This equation has the following properties:</p>
      *
      * <ul>
@@ -130,13 +150,28 @@ abstract class EqualAreaProjection exten
      *   <li>q(0) = 0</li>
      * </ul>
      *
-     * In the spherical case, <var>q</var> = 2⋅sinφ. It is caller responsibility to ensure that this
-     * method is not invoked in the spherical case, since this implementation does not work in such case.
+     * In the spherical case, <var>q</var> = 2⋅sinφ.
      *
      * @param  sinφ sine of the latitude <var>q</var> is calculated for.
      * @return <var>q</var> from Snyder equation (3-12).
      */
     final double qm(final double sinφ) {
+        /*
+         * Check for zero eccentricity is required because qm_ellipsoid(sinφ) would
+         * simplify to sinφ + atanh(0) / 0 == sinφ + 0/0, thus producing NaN.
+         */
+        return (eccentricity == 0) ? 2*sinφ : qm_ellipsoid(sinφ);
+    }
+
+    /**
+     * Same as {@link #qm(double)} but without check about whether the map projection is a spherical case.
+     * It is caller responsibility to ensure that this method is not invoked in the spherical case, since
+     * this implementation does not work in such case.
+     *
+     * @param  sinφ sine of the latitude <var>q</var> is calculated for.
+     * @return <var>q</var> from Snyder equation (3-12).
+     */
+    final double qm_ellipsoid(final double sinφ) {
         final double ℯsinφ = eccentricity * sinφ;
         return sinφ / (1 - ℯsinφ*ℯsinφ) + atanh(ℯsinφ) / eccentricity;
     }
@@ -151,23 +186,29 @@ abstract class EqualAreaProjection exten
      * @return the {@code qm} derivative at the specified latitude.
      */
     final double dqm_dφ(final double sinφ, final double cosφ) {
-        final double ℯsinφ2 = eccentricitySquared * (sinφ*sinφ);
-        return (cosφ / (1 - ℯsinφ2)) * (1 + ((1 + ℯsinφ2) / (1 - ℯsinφ2)));
+        final double t = 1 - eccentricitySquared*(sinφ*sinφ);
+        return 2*cosφ / (t*t);
     }
 
     /**
-     * Computes the latitude using equation 3-18 from Synder.
+     * Computes the latitude using equation 3-18 from Synder, followed by iterative resolution of Synder 3-16.
+     * If theory, the series expansion given by equation 3-18 (φ ≈ c₂⋅sin(2β) + c₄⋅sin(4β) + c₈⋅sin(8β)) should
+     * be used in replacement of the iterative method. However in practice the series expansion seems to not
+     * have a sufficient amount of terms for achieving the centimetric precision, so we "finish" it by the
+     * iterative method. The series expansion is nevertheless useful for reducing the number of iterations.
      *
-     * @param  sinβ see Synder equation 10-26.
+     * @param  y in the cylindrical case, this is northing on the normalized ellipsoid.
      * @return the latitude in radians.
      */
-    final double φ(final double sinβ) {
+    final double φ(final double y) throws ProjectionException {
+        final double sinβ = y / qmPolar;
         final double β = asin(sinβ);
+        double φ;
         if (!ALLOW_TRIGONOMETRIC_IDENTITIES) {
-            return ci8 * sin(8*β)
-                 + ci4 * sin(4*β)
-                 + ci2 * sin(2*β)
-                 + β;                                                               // Synder 3-18
+            φ = ci8 * sin(8*β)
+              + ci4 * sin(4*β)
+              + ci2 * sin(2*β)
+              + β;                                                                  // Synder 3-18
         } else {
             /*
              * Same formula than above, but rewriten using trigonometric identities in order to avoid
@@ -179,24 +220,62 @@ abstract class EqualAreaProjection exten
             final double t4β = 0.5 - sin2_β;                                        // = sin(4β) / ( 4⋅sin(2β))
             final double t8β = (cos2_β - sin2_β)*(cos2_β*cos2_β - cos2_β + 1./8);   // = sin(8β) / (32⋅sin(2β))
 
-            assert identityEquals(t2β, sin(2*β) / ( 2      ));
-            assert identityEquals(t4β, sin(4*β) / ( 8 * t2β));
-            assert identityEquals(t8β, sin(8*β) / (64 * t2β));
+            assert ConformalProjection.identityEquals(t2β, sin(2*β) / ( 2      ));
+            assert ConformalProjection.identityEquals(t4β, sin(4*β) / ( 8 * t2β));
+            assert ConformalProjection.identityEquals(t8β, sin(8*β) / (64 * t2β));
 
-            return (ci8*t8β  +  ci4*t4β  +  ci2) * t2β  +  β;
+            φ = (ci8*t8β  +  ci4*t4β  +  ci2) * t2β  +  β;
         }
-    }
-
-    /**
-     * Verifies if a trigonometric identity produced the expected value. This method is used in assertions only.
-     * The tolerance threshold is approximatively 1.5E-12 (note that it still about 7000 time greater than
-     * {@code Math.ulp(1.0)}).
-     *
-     * @see #ALLOW_TRIGONOMETRIC_IDENTITIES
-     */
-    private static boolean identityEquals(final double actual, final double expected) {
-        // Use !(a > b) instead of (a <= b) in order to tolerate NaN.
-        return !(abs(actual - expected) > (ANGULAR_TOLERANCE / 1000));
+        /*
+         * At this point φ is close to the desired value, but may have an error of a few centimetres.
+         * Use the iterative method for reaching the last part of missing accuracy. Usually this loop
+         * will perform exactly one iteration, no more, because φ is already quite close to the result.
+         *
+         * Mathematical note: Synder 3-16 gives q/(1-ℯ²) instead of y in the calculation of Δφ below.
+         * For Cylindrical Equal Area projection, Synder 10-17 gives  q = (qPolar⋅sinβ), which simplifies
+         * as y.
+         *
+         * For Albers Equal Area projection, Synder 14-19 gives  q = (C - ρ²n²/a²)/n,  which we rewrite
+         * as  q = (C - ρ²)/n  (see comment in AlbersEqualArea.inverseTransform(…) for the mathematic).
+         * The y value given to this method is y = (C - ρ²) / (n⋅(1-ℯ²)) = q/(1-ℯ²), the desired value.
+         */
+        for (int i=0; i<MAXIMUM_ITERATIONS; i++) {
+            final double sinφ  = sin(φ);
+            final double cosφ  = cos(φ);
+            final double ℯsinφ = eccentricity * sinφ;
+            final double ome   = 1 - ℯsinφ*ℯsinφ;
+            final double Δφ    = ome*ome/(2*cosφ) * (y - sinφ/ome - atanh(ℯsinφ)/eccentricity);
+            φ += Δφ;
+            if (abs(Δφ) <= ITERATION_TOLERANCE) {
+                return φ;
+            }
+        }
+        /*
+         * In the Albers Equal Area discussion, Synder said that above algorithm does not converge if
+         *
+         *   q = ±(1 - (1-ℯ²)/(2ℯ) ⋅ ln((1-ℯ)/(1+ℯ)))
+         *
+         * which we rewrite as
+         *
+         *   q = ±(1 + (1-ℯ²)⋅atanh(ℯ)/ℯ)
+         *
+         * Given that y = q/(1-ℯ²)  (see above comment), we rewrite as
+         *
+         *   y  =  ±(1/(1-ℯ²) + atanh(ℯ)/ℯ)  =  ±qmPolar
+         *
+         * which implies  sinβ = ±1. This is consistent with Synder discussion of Cylndrical Equal Area
+         * projection, where he said exactly that about the same formula (that it does not converge for
+         * β = ±90°). In both case, Synder said that the result is φ = β, with the same sign.
+         */
+        final double as = abs(sinβ);
+        if (abs(as - 1) < ANGULAR_TOLERANCE) {
+            return copySign(PI/2, y);               // Value is at a pole.
+        }
+        if (as >= 1 || Double.isNaN(y)) {
+            return Double.NaN;                      // Value "after" the pole.
+        }
+        // Value should have converged but did not.
+        throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence));
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -295,7 +295,7 @@ final class Initializer {
      *
      * <blockquote>ν = 1 / √(1 - ℯ²⋅sin²φ)</blockquote>
      *
-     * This method returns 1/ν².
+     * This method returns 1/ν², which is the (1 - ℯ²⋅sin²φ) part of above equation.
      *
      * <div class="section">Relationship with Snyder</div>
      * This is related to functions (14-15) from Snyder (used for computation of scale factors

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -117,7 +117,7 @@ public class LambertConicConformal exten
     }
 
     /**
-     * Internal coefficients for computation, depending only on values of standards parallels.
+     * Internal coefficients for computation, depending only on eccentricity and values of standards parallels.
      * This is defined as {@literal n = (ln m₁ – ln m₂) / (ln t₁ – ln t₂)} in §1.3.1.1 of
      * IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, part 2 – April 2015.
      *
@@ -150,8 +150,8 @@ public class LambertConicConformal exten
      *   <li><cite>"Lambert Conic Conformal (2SP Michigan)"</cite>.</li>
      * </ul>
      *
-     * @param method     Description of the projection parameters.
-     * @param parameters The parameter values of the projection to create.
+     * @param method      description of the projection parameters.
+     * @param parameters  the parameter values of the projection to create.
      */
     public LambertConicConformal(final OperationMethod method, final Parameters parameters) {
         this(initializer(method, parameters));
@@ -275,11 +275,11 @@ public class LambertConicConformal exten
          * for reducing the amount of calls to the logarithmic function. Note that this equation
          * tends toward 0/0 if φ₁ ≈ φ₂, which force us to do a special check for the SP1 case.
          */
-        if (abs(φ1 - φ2) >= ANGULAR_TOLERANCE) {  // Should be 'true' for 2SP case.
+        if (abs(φ1 - φ2) >= ANGULAR_TOLERANCE) {                    // Should be 'true' for 2SP case.
             final double sinφ2 = sin(φ2);
             final double m2 = initializer.scaleAtφ(sinφ2, cos(φ2));
             final double t2 = expOfNorthing(φ2, eccentricity*sinφ2);
-            n = log(m1/m2) / log(t1/t2);    // Tend toward 0/0 if φ1 ≈ φ2.
+            n = log(m1/m2) / log(t1/t2);                            // Tend toward 0/0 if φ1 ≈ φ2.
         } else {
             n = -sinφ1;
         }
@@ -376,8 +376,8 @@ public class LambertConicConformal exten
      * <p>The non-linear part of the returned transform will be {@code this} transform, except if the ellipsoid
      * is spherical. In the later case, {@code this} transform will be replaced by a simplified implementation.</p>
      *
-     * @param  factory The factory to use for creating the transform.
-     * @return The map projection from (λ,φ) to (<var>x</var>,<var>y</var>) coordinates.
+     * @param  factory  the factory to use for creating the transform.
+     * @return the map projection from (λ,φ) to (<var>x</var>,<var>y</var>) coordinates.
      * @throws FactoryException if an error occurred while creating a transform.
      */
     @Override
@@ -561,7 +561,7 @@ public class LambertConicConformal exten
             double x = srcPts[srcOff  ];
             double y = srcPts[srcOff+1];
             final double ρ = hypot(x, y);
-            dstPts[dstOff  ] = atan2(x, y);  // Really (x,y), not (y,x);
+            dstPts[dstOff  ] = atan2(x, y);                     // Really (x,y), not (y,x);
             dstPts[dstOff+1] = PI/2 - 2*atan(pow(1/ρ, 1/n));
         }
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] Thu Jul 28 09:41:04 2016
@@ -27,13 +27,14 @@ org.apache.sis.internal.referencing.prov
 org.apache.sis.internal.referencing.provider.PseudoMercator
 org.apache.sis.internal.referencing.provider.RegionalMercator
 org.apache.sis.internal.referencing.provider.MillerCylindrical
-org.apache.sis.internal.referencing.provider.LambertCylindricalEqualArea
-org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical
 org.apache.sis.internal.referencing.provider.LambertConformal1SP
 org.apache.sis.internal.referencing.provider.LambertConformal2SP
 org.apache.sis.internal.referencing.provider.LambertConformalWest
 org.apache.sis.internal.referencing.provider.LambertConformalBelgium
 org.apache.sis.internal.referencing.provider.LambertConformalMichigan
+org.apache.sis.internal.referencing.provider.LambertCylindricalEqualArea
+org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical
+org.apache.sis.internal.referencing.provider.AlbersEqualArea
 org.apache.sis.internal.referencing.provider.TransverseMercator
 org.apache.sis.internal.referencing.provider.TransverseMercatorSouth
 org.apache.sis.internal.referencing.provider.PolarStereographicA

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -79,13 +79,14 @@ public final strictfp class ProvidersTes
             PseudoMercator.class,
             RegionalMercator.class,
             MillerCylindrical.class,
-            LambertCylindricalEqualArea.class,
-            LambertCylindricalEqualAreaSpherical.class,
             LambertConformal1SP.class,
             LambertConformal2SP.class,
             LambertConformalWest.class,
             LambertConformalBelgium.class,
             LambertConformalMichigan.class,
+            LambertCylindricalEqualArea.class,
+            LambertCylindricalEqualAreaSpherical.class,
+            AlbersEqualArea.class,
             TransverseMercator.class,
             TransverseMercatorSouth.class,
             PolarStereographicA.class,

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -178,7 +178,7 @@ public final strictfp class ConformalPro
     /**
      * Tests the {@link NormalizedProjection#dy_dφ(double, double)} method.
      *
-     * @throws TransformException Should never happen.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     @DependsOnMethod("testExpOfNorthing")
@@ -235,7 +235,7 @@ public final strictfp class ConformalPro
      * In theory only the [-90° … +90°] range needs to be tested. However the function is still
      * consistent in the [-90° … +270°] range so we test that range for tracking this fact.
      *
-     * @throws ProjectionException Should never happen.
+     * @throws ProjectionException if an error occurred while projecting a point.
      */
     @Test
     @DependsOnMethod("testExpOfNorthing")

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -22,10 +22,12 @@ import org.opengis.test.ToleranceModifie
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.referencing.provider.LambertCylindricalEqualArea;
 import org.apache.sis.internal.referencing.provider.LambertCylindricalEqualAreaSpherical;
+import org.apache.sis.referencing.operation.transform.CoordinateDomain;
 import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
 import static java.lang.StrictMath.*;
+import static java.lang.Double.NaN;
 
 
 /**
@@ -38,16 +40,6 @@ import static java.lang.StrictMath.*;
  */
 public final strictfp class CylindricalEqualAreaTest extends MapProjectionTestCase {
     /**
-     * Creates a map projection.
-     */
-    private void createCompleteProjection(final boolean ellipse,
-            final double centralMeridian, final double standardParallel) throws FactoryException
-    {
-        createCompleteProjection(new LambertCylindricalEqualArea(),
-                ellipse, centralMeridian, 0, standardParallel, 1, 0, 0);
-    }
-
-    /**
      * Tests the derivatives at a few points. This method compares the derivatives computed by
      * the projection with an estimation of derivatives computed by the finite differences method.
      *
@@ -69,7 +61,16 @@ public final strictfp class CylindricalE
      */
     @Test
     public void testEllipsoidal() throws FactoryException, TransformException {
-        createCompleteProjection(true, 0, 0);
+        createCompleteProjection(new LambertCylindricalEqualArea(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0,          // Central meridian
+                NaN,        // Latitude of origin
+                0,          // Standard parallel 1
+                NaN,        // Standard parallel 2
+                NaN,        // Scale factor (none)
+                0,          // False easting
+                0);         // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         toleranceModifier = ToleranceModifier.PROJECTION;
         final double λ = 2;
@@ -90,7 +91,16 @@ public final strictfp class CylindricalE
     @Test
     @DependsOnMethod("testEllipsoidal")
     public void testSpherical() throws FactoryException, TransformException {
-        createCompleteProjection(false, 0, 0);
+        createCompleteProjection(new LambertCylindricalEqualArea(),
+                6371007,    // Semi-major axis length
+                6371007,    // Semi-minor axis length
+                0,          // Central meridian
+                NaN,        // Latitude of origin
+                0,          // Standard parallel 1
+                NaN,        // Standard parallel 2
+                NaN,        // Scale factor (none)
+                0,          // False easting
+                0);         // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         toleranceModifier = ToleranceModifier.PROJECTION;
         final double λ = 2;
@@ -114,7 +124,16 @@ public final strictfp class CylindricalE
     @Test
     @DependsOnMethod("testSpherical")
     public void testSphericalWithConformalSphereRadius() throws FactoryException, TransformException {
-        createCompleteProjection(new LambertCylindricalEqualAreaSpherical(), true, 0, 0, 0, 1, 0, 0);
+        createCompleteProjection(new LambertCylindricalEqualAreaSpherical(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0,          // Central meridian
+                NaN,        // Latitude of origin
+                0,          // Standard parallel 1
+                NaN,        // Standard parallel 2
+                NaN,        // Scale factor (none)
+                0,          // False easting
+                0);         // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         toleranceModifier = ToleranceModifier.PROJECTION;
         final double λ = 2;
@@ -125,4 +144,32 @@ public final strictfp class CylindricalE
                         new double[] {x, y,  -x, y,  x, -y,  -x, -y});
         testDerivative();
     }
+
+    /**
+     * Tests conversion of random points with non-zero central meridian, standard parallel
+     * and false easting/northing.
+     *
+     * @throws FactoryException if an error occurred while creating the map projection.
+     * @throws TransformException if an error occurred while projecting a point.
+     */
+    @Test
+    public void testRandomPoints() throws FactoryException, TransformException {
+        createCompleteProjection(new LambertCylindricalEqualArea(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                12,         // Central meridian
+                NaN,        // Latitude of origin (none)
+                24,         // Standard parallel 1
+                NaN,        // Standard parallel 2
+                NaN,        // Scale factor (none)
+                300,        // False easting
+                200);       // False northing
+
+        tolerance = Formulas.LINEAR_TOLERANCE;
+        toleranceModifier = ToleranceModifier.PROJECTION;
+        derivativeDeltas = new double[] {100, 100};
+        final double delta = toRadians(100.0 / 60) / 1852;      // Approximatively 100 metres.
+        derivativeDeltas = new double[] {delta, delta};
+        verifyInDomain(CoordinateDomain.GEOGRAPHIC_SAFE, 0);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -27,6 +27,7 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.test.ReferencingAssert;
 import org.junit.Test;
 
+import static java.lang.Double.NaN;
 import static java.lang.StrictMath.toRadians;
 import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
 
@@ -38,7 +39,7 @@ import static org.apache.sis.internal.me
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.8
  * @module
  */
 public final strictfp class EquirectangularTest extends MapProjectionTestCase {
@@ -61,7 +62,7 @@ public final strictfp class Equirectangu
      * an affine transform, the WKT formatter should handle this projection in a special way and shows the
      * projection parameters instead than the affine transform parameters (except in "show internal" mode).
      *
-     * @throws FactoryException should never happen.
+     * @throws FactoryException if an error occurred while creating the map projection.
      */
     @Test
     public void testWKT() throws FactoryException {
@@ -90,19 +91,19 @@ public final strictfp class Equirectangu
     /**
      * Tests a simple transform on a sphere.
      *
-     * @throws FactoryException should never happen.
-     * @throws TransformException should never happen.
+     * @throws FactoryException if an error occurred while creating the map projection.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     public void testSimpleTransform() throws FactoryException, TransformException {
         createCompleteProjection();
         verifyTransform(
-                new double[] {  // (λ,φ) coordinates in degrees to project.
+                new double[] {          // (λ,φ) coordinates in degrees to project.
                     0, 0,
                     2, 0,
                     0, 3
                 },
-                new double[] {  // Expected (x,y) results in metres.
+                new double[] {          // Expected (x,y) results in metres.
                     0,                            0,
                     AUTHALIC_RADIUS*toRadians(2), 0,
                     0, AUTHALIC_RADIUS*toRadians(3)
@@ -113,18 +114,21 @@ public final strictfp class Equirectangu
      * Tests conversion of random points. This test is actually of limited interest since the Equirectangular
      * projection is implemented by an affine transform, which has been tested elsewhere.
      *
-     * @throws FactoryException should never happen.
-     * @throws TransformException should never happen.
+     * @throws FactoryException if an error occurred while creating the map projection.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     public void testRandomPoints() throws FactoryException, TransformException {
-        createCompleteProjection(new Equirectangular(), true,
-                  0.5,  // Central meridian
-                  0,    // Latitude of origin (none)
-                 20,    // Standard parallel
-                  1,    // Scale factor (none)
-                200,    // False easting
-                100);   // False northing
+        createCompleteProjection(new Equirectangular(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0.5,        // Central meridian
+                0,          // Latitude of origin (none)
+                20,         // Standard parallel 1
+                NaN,        // Standard parallel 2
+                NaN,        // Scale factor (none)
+                200,        // False easting
+                100);       // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;  // Not NORMALIZED_TOLERANCE since this is not a NormalizedProjection.
         derivativeDeltas = new double[] {100, 100};
         verifyInDomain(CoordinateDomain.GEOGRAPHIC, 0);

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -49,7 +49,7 @@ import static org.apache.sis.test.Assert
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Rémi Maréchal (Geomatys)
  * @since   0.6
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @DependsOn(ConformalProjectionTest.class)
@@ -112,12 +112,12 @@ public final strictfp class LambertConic
     /**
      * Tests the projection at some special latitudes (0, ±π/2, NaN and others).
      *
-     * @throws ProjectionException Should never happen.
+     * @throws ProjectionException if an error occurred while projecting a point.
      */
     @Test
     public void testSpecialLatitudes() throws ProjectionException {
-        if (transform == null) {    // May have been initialized by 'testSphericalCase'.
-            createNormalizedProjection(true, 40);  // Elliptical case
+        if (transform == null) {                        // May have been initialized by 'testSphericalCase'.
+            createNormalizedProjection(true, 40);       // Elliptical case
         }
         final double INF = POSITIVE_INFINITY;
         assertEquals ("Not a number",     NaN, transform(NaN),            NORMALIZED_TOLERANCE);
@@ -161,7 +161,7 @@ public final strictfp class LambertConic
      * Tests the derivatives at a few points. This method compares the derivatives computed by
      * the projection with an estimation of derivatives computed by the finite differences method.
      *
-     * @throws TransformException Should never happen.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     @DependsOnMethod("testSpecialLatitudes")
@@ -246,28 +246,34 @@ public final strictfp class LambertConic
     @Test
     @DependsOnMethod("testLambertConicConformal1SP")
     public void testLambertConicConformalWestOrientated() throws FactoryException, TransformException {
-        createCompleteProjection(new LambertConformal1SP(), false,
-                  0.5,    // Central meridian
-                 40,      // Latitude of origin
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new LambertConformal1SP(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0.5,        // Central meridian
+                40,         // Latitude of origin
+                NaN,        // Standard parallel 1
+                NaN,        // Standard parallel 2
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
         final MathTransform reference = transform;
 
-        createCompleteProjection(new LambertConformalWest(), false,
-                  0.5,    // Central meridian
-                 40,      // Latitude of origin
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new LambertConformalWest(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0.5,        // Central meridian
+                40,         // Latitude of origin
+                NaN,        // Standard parallel 1
+                NaN,        // Standard parallel 2
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
 
         final Random random = TestUtilities.createRandomNumberGenerator();
         final double[] sources = new double[20];
         for (int i=0; i<sources.length;) {
-            sources[i++] = 20 * random.nextDouble();      // Longitude
-            sources[i++] = 10 * random.nextDouble() + 35; // Latitude
+            sources[i++] = 20 * random.nextDouble();            // Longitude
+            sources[i++] = 10 * random.nextDouble() + 35;       // Latitude
         }
         final double[] expected = new double[sources.length];
         reference.transform(sources, 0, expected, 0, sources.length/2);
@@ -326,13 +332,16 @@ public final strictfp class LambertConic
     @Test
     @DependsOnMethod("testSphericalCase")
     public void compareEllipticalWithSpherical() throws FactoryException, TransformException {
-        createCompleteProjection(new LambertConformal1SP(), false,
-                  0.5,    // Central meridian
-                 40,      // Latitude of origin
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new LambertConformal1SP(),
+                6371007,    // Semi-major axis length
+                6371007,    // Semi-minor axis length
+                0.5,        // Central meridian
+                40,         // Latitude of origin
+                NaN,        // Standard parallel 1
+                NaN,        // Standard parallel 2
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         compareEllipticalWithSpherical(CoordinateDomain.GEOGRAPHIC_SAFE, 0);
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -16,9 +16,9 @@
  */
 package org.apache.sis.referencing.operation.projection;
 
-import javax.measure.unit.NonSI;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.test.referencing.ParameterizedTransformTest;
 import org.apache.sis.parameter.Parameters;
@@ -28,8 +28,10 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.referencing.operation.transform.CoordinateDomain;
 import org.apache.sis.referencing.operation.transform.MathTransformTestCase;
 import org.apache.sis.referencing.operation.transform.MathTransformFactoryMock;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.referencing.datum.GeodeticDatumMock;
 
+import static java.lang.Double.isNaN;
 import static java.lang.StrictMath.*;
 import static org.junit.Assert.*;
 
@@ -39,10 +41,20 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.8
  * @module
  */
-strictfp class MapProjectionTestCase extends MathTransformTestCase {
+abstract strictfp class MapProjectionTestCase extends MathTransformTestCase {
+    /**
+     * Semi-major axis length of WGS84 ellipsoid.
+     */
+    static final double WGS84_A = 6378137;
+
+    /**
+     * Semi-minor axis length of WGS84 ellipsoid.
+     */
+    static final double WGS84_B = 6356752.314245179;
+
     /**
      * Tolerance level for comparing formulas on the unitary sphere or ellipsoid.
      */
@@ -55,11 +67,22 @@ strictfp class MapProjectionTestCase ext
     }
 
     /**
+     * Instantiates the object to use for running GeoAPI test.
+     *
+     * @param  provider  the provider of the projection to test.
+     * @return the GeoAPI test class using the given provider.
+     */
+    static ParameterizedTransformTest createGeoApiTest(final MapProjection provider) {
+        return new ParameterizedTransformTest(new MathTransformFactoryMock(provider));
+    }
+
+    /**
      * Returns the parameters to use for instantiating the projection to test.
+     * The parameters are initialized with the ellipse semi-axis lengths.
      *
-     * @param  provider The provider of the projection to test.
-     * @param  ellipse {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
-     * @return The parameters to use for instantiating the projection.
+     * @param  provider  the provider of the projection to test.
+     * @param  ellipse   {@code false} for a sphere, or {@code true} for WGS84 ellipsoid.
+     * @return the parameters to use for instantiating the projection.
      */
     static Parameters parameters(final DefaultOperationMethod provider, final boolean ellipse) {
         final Parameters parameters = Parameters.castOrWrap(provider.getParameters().createValue());
@@ -73,45 +96,57 @@ strictfp class MapProjectionTestCase ext
     }
 
     /**
-     * Instantiates the object to use for running GeoAPI test.
-     *
-     * @param  provider The provider of the projection to test.
-     * @return The GeoAPI test class using the given provider.
-     */
-    static ParameterizedTransformTest createGeoApiTest(final MapProjection provider) {
-        return new ParameterizedTransformTest(new MathTransformFactoryMock(provider));
-    }
-
-    /**
      * Initializes a complete projection (including conversion from degrees to radians) for the given provider.
-     * This method uses arbitrary central meridian, scale factor, false easting and false northing for increasing
-     * the chances to detect a mismatch. The result is stored in the {@link #transform} field.
      */
-    final void createCompleteProjection(final DefaultOperationMethod provider, final boolean ellipse,
+    final void createCompleteProjection(final DefaultOperationMethod provider,
+            final double semiMajor,
+            final double semiMinor,
             final double centralMeridian,
             final double latitudeOfOrigin,
-            final double standardParallel,
+            final double standardParallel1,
+            final double standardParallel2,
             final double scaleFactor,
             final double falseEasting,
             final double falseNorthing) throws FactoryException
     {
-        final Parameters parameters = parameters(provider, ellipse);
-        if (centralMeridian  != 0) parameters.parameter(Constants.CENTRAL_MERIDIAN)   .setValue(centralMeridian, NonSI.DEGREE_ANGLE);
-        if (latitudeOfOrigin != 0) parameters.parameter(Constants.LATITUDE_OF_ORIGIN) .setValue(latitudeOfOrigin);
-        if (standardParallel != 0) parameters.parameter(Constants.STANDARD_PARALLEL_1).setValue(standardParallel);
-        if (scaleFactor      != 1) parameters.parameter(Constants.SCALE_FACTOR)       .setValue(scaleFactor);
-        if (falseEasting     != 0) parameters.parameter(Constants.FALSE_EASTING)      .setValue(falseEasting);
-        if (falseNorthing    != 0) parameters.parameter(Constants.FALSE_NORTHING)     .setValue(falseNorthing);
-        transform = new MathTransformFactoryMock(provider).createParameterizedTransform(parameters);
+        final Parameters values = Parameters.castOrWrap(provider.getParameters().createValue());
+        values.parameter(Constants.SEMI_MAJOR).setValue(semiMajor);
+        values.parameter(Constants.SEMI_MINOR).setValue(semiMinor);
+        if (semiMajor == WGS84_A && semiMinor == WGS84_B) {
+            values.parameter(Constants.INVERSE_FLATTENING).setValue(298.257223563);
+        }
+        if (!isNaN(centralMeridian))   values.parameter(Constants.CENTRAL_MERIDIAN)   .setValue(centralMeridian);
+        if (!isNaN(latitudeOfOrigin))  values.parameter(Constants.LATITUDE_OF_ORIGIN) .setValue(latitudeOfOrigin);
+        if (!isNaN(standardParallel1)) values.parameter(Constants.STANDARD_PARALLEL_1).setValue(standardParallel1);
+        if (!isNaN(standardParallel2)) values.parameter(Constants.STANDARD_PARALLEL_2).setValue(standardParallel2);
+        if (!isNaN(scaleFactor))       values.parameter(Constants.SCALE_FACTOR)       .setValue(scaleFactor);
+        if (!isNaN(falseEasting))      values.parameter(Constants.FALSE_EASTING)      .setValue(falseEasting);
+        if (!isNaN(falseNorthing))     values.parameter(Constants.FALSE_NORTHING)     .setValue(falseNorthing);
+        transform = new MathTransformFactoryMock(provider).createParameterizedTransform(values);
         validate();
     }
 
     /**
+     * Returns the {@code NormalizedProjection} component of the current transform.
+     */
+    final NormalizedProjection getKernel() {
+        NormalizedProjection kernel = null;
+        for (final MathTransform component : MathTransforms.getSteps(transform)) {
+            if (component instanceof NormalizedProjection) {
+                assertNull("Found more than one kernel.", kernel);
+                kernel = (NormalizedProjection) component;
+            }
+        }
+        assertNotNull("Kernel not found.", kernel);
+        return kernel;
+    }
+
+    /**
      * Projects the given latitude value. The longitude is fixed to zero.
      * This method is useful for testing the behavior close to poles in a simple case.
      *
-     * @param  φ The latitude.
-     * @return The northing.
+     * @param  φ  the latitude.
+     * @return the northing.
      * @throws ProjectionException if the projection failed.
      */
     final double transform(final double φ) throws ProjectionException {
@@ -119,7 +154,7 @@ strictfp class MapProjectionTestCase ext
         coordinate[1] = φ;
         ((NormalizedProjection) transform).transform(coordinate, 0, coordinate, 0, false);
         final double y = coordinate[1];
-        if (!Double.isNaN(y) && !Double.isInfinite(y)) {
+        if (!isNaN(y) && !Double.isInfinite(y)) {
             assertEquals(0, coordinate[0], tolerance);
         }
         return y;
@@ -129,8 +164,8 @@ strictfp class MapProjectionTestCase ext
      * Inverse projects the given northing value. The easting is fixed to zero.
      * This method is useful for testing the behavior close to poles in a simple case.
      *
-     * @param  y The northing.
-     * @return The latitude.
+     * @param  y  the northing.
+     * @return the latitude.
      * @throws ProjectionException if the projection failed.
      */
     final double inverseTransform(final double y) throws ProjectionException {
@@ -138,7 +173,7 @@ strictfp class MapProjectionTestCase ext
         coordinate[1] = y;
         ((NormalizedProjection) transform).inverseTransform(coordinate, 0, coordinate, 0);
         final double φ = coordinate[1];
-        if (!Double.isNaN(φ)) {
+        if (!isNaN(φ)) {
             /*
              * Opportunistically verify that the longitude is still zero. However the longitude value is meaningless
              * at poles. We can not always use coordinate[0] for testing if we are at a pole because its calculation
@@ -159,9 +194,9 @@ strictfp class MapProjectionTestCase ext
      * The spherical formulas are arbitrarily selected as the reference implementation because they are simpler,
      * so less bug-prone, than the elliptical formulas.
      *
-     * @param  domain The domain of the numbers to be generated.
-     * @param  randomSeed The seed for the random number generator, or 0 for choosing a random seed.
-     * @throws TransformException If a conversion, transformation or derivative failed.
+     * @param  domain      the domain of the numbers to be generated.
+     * @param  randomSeed  the seed for the random number generator, or 0 for choosing a random seed.
+     * @throws TransformException if a conversion, transformation or derivative failed.
      */
     final void compareEllipticalWithSpherical(final CoordinateDomain domain, final long randomSeed)
             throws TransformException

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -44,7 +44,7 @@ import static org.apache.sis.referencing
  * @author  Simon Reynard (Geomatys)
  * @author  Rémi Maréchal (Geomatys)
  * @since   0.6
- * @version 0.7
+ * @version 0.8
  * @module
  */
 @DependsOn(ConformalProjectionTest.class)
@@ -70,7 +70,7 @@ public final strictfp class MercatorTest
      * the ellipsoid eccentricity. We expect nothing else because all other parameters are used
      * by the (de)normalization affine transforms instead than the {@link Mercator} class itself.
      *
-     * @throws NoninvertibleTransformException should never happen.
+     * @throws NoninvertibleTransformException if the transform can not be inverted.
      *
      * @see LambertConicConformalTest#testNormalizedWKT()
      */
@@ -90,18 +90,21 @@ public final strictfp class MercatorTest
      * Tests WKT of a complete map projection.
      *
      * @throws FactoryException if an error occurred while creating the map projection.
-     * @throws NoninvertibleTransformException should never happen.
+     * @throws NoninvertibleTransformException if the transform can not be inverted.
      */
     @Test
     @DependsOnMethod("testNormalizedWKT")
     public void testCompleteWKT() throws FactoryException, NoninvertibleTransformException {
-        createCompleteProjection(new Mercator1SP(), true,
-                  0.5,    // Central meridian
-                  0,      // Latitude of origin (none)
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new Mercator1SP(),
+                WGS84_A,    // Semi-major axis length
+                WGS84_B,    // Semi-minor axis length
+                0.5,        // Central meridian
+                NaN,        // Latitude of origin (none)
+                NaN,        // Standard parallel 1 (none)
+                NaN,        // Standard parallel 2 (none)
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
 
         assertWktEquals("PARAM_MT[“Mercator_1SP”,\n" +
                         "  PARAMETER[“semi_major”, 6378137.0],\n" +
@@ -289,13 +292,16 @@ public final strictfp class MercatorTest
     @Test
     @DependsOnMethod("testSphericalCase")
     public void compareEllipticalWithSpherical() throws FactoryException, TransformException {
-        createCompleteProjection(new Mercator1SP(), false,
-                  0.5,    // Central meridian
-                  0,      // Latitude of origin (none)
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new Mercator1SP(),
+                6371007,    // Semi-major axis length
+                6371007,    // Semi-minor axis length
+                0.5,        // Central meridian
+                NaN,        // Latitude of origin (none)
+                NaN,        // Standard parallel 1 (none)
+                NaN,        // Standard parallel 2 (none)
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         compareEllipticalWithSpherical(CoordinateDomain.GEOGRAPHIC_SAFE, 0);
     }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/PolarStereographicTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -32,6 +32,7 @@ import org.apache.sis.test.DependsOnMeth
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
+import static java.lang.Double.NaN;
 import static java.lang.StrictMath.*;
 
 
@@ -40,7 +41,7 @@ import static java.lang.StrictMath.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.8
  * @module
  */
 @DependsOn(NormalizedProjectionTest.class)
@@ -169,11 +170,14 @@ public final strictfp class PolarStereog
     private void compareEllipticalWithSpherical(final CoordinateDomain domain, final double latitudeOfOrigin,
             final long randomSeed) throws FactoryException, TransformException
     {
-        createCompleteProjection(new PolarStereographicA(), false,
-                  0.5,              // Central meridian
-                 latitudeOfOrigin,  // Latitude of origin
-                  0,                // Standard parallel (none)
-                  0.994,            // Scale factor
+        createCompleteProjection(new PolarStereographicA(),
+                6371007,            // Semi-major axis length
+                6371007,            // Semi-minor axis length
+                0.5,                // Central meridian
+                latitudeOfOrigin,   // Latitude of origin
+                NaN,                // Standard parallel 1 (none)
+                NaN,                // Standard parallel 2 (none)
+                0.994,              // Scale factor
                 200,                // False easting
                 100);               // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java?rev=1754380&r1=1754379&r2=1754380&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java [UTF-8] Thu Jul 28 09:41:04 2016
@@ -27,6 +27,7 @@ import org.apache.sis.test.DependsOnMeth
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
+import static java.lang.Double.NaN;
 import static java.lang.StrictMath.toRadians;
 import static org.apache.sis.test.Assert.*;
 
@@ -96,13 +97,16 @@ public final strictfp class TransverseMe
     @Test
     @DependsOnMethod("testTransverseMercator")
     public void compareEllipticalWithSpherical() throws FactoryException, TransformException {
-        createCompleteProjection(new org.apache.sis.internal.referencing.provider.TransverseMercator(), false,
-                  0.5,    // Central meridian
-                  2.5,    // Latitude of origin
-                  0,      // Standard parallel (none)
-                  0.997,  // Scale factor
-                200,      // False easting
-                100);     // False northing
+        createCompleteProjection(new org.apache.sis.internal.referencing.provider.TransverseMercator(),
+                6371007,    // Semi-major axis length
+                6371007,    // Semi-minor axis length
+                0.5,        // Central meridian
+                2.5,        // Latitude of origin
+                NaN,        // Standard parallel 1 (none)
+                NaN,        // Standard parallel 1 (none)
+                0.997,      // Scale factor
+                200,        // False easting
+                100);       // False northing
         tolerance = Formulas.LINEAR_TOLERANCE;
         compareEllipticalWithSpherical(CoordinateDomain.RANGE_10, 0);
     }
@@ -110,7 +114,7 @@ public final strictfp class TransverseMe
     /**
      * Creates a projection and derivates a few points.
      *
-     * @throws TransformException Should never happen.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     public void testSphericalDerivative() throws TransformException {
@@ -127,7 +131,7 @@ public final strictfp class TransverseMe
     /**
      * Creates a projection and derivates a few points.
      *
-     * @throws TransformException Should never happen.
+     * @throws TransformException if an error occurred while projecting a point.
      */
     @Test
     public void testEllipsoidalDerivative() throws TransformException {




Mime
View raw message