sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1737072 [1/5] - in /sis/branches/JDK7: ./ application/sis-console/src/main/artifact/conf/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-referencing/src/mai...
Date Tue, 29 Mar 2016 22:51:41 GMT
Author: desruisseaux
Date: Tue Mar 29 22:51:40 2016
New Revision: 1737072

URL: http://svn.apache.org/viewvc?rev=1737072&view=rev
Log:
Merge from the JDK8 branch.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CoordinateOperations.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CRSPair.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CRSPair.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
      - copied, changed from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/InverseOperationMethod.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/MathTransformContext.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/MathTransformContext.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CartesianToPolar.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CartesianToPolar.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CartesianToSpherical.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CartesianToSpherical.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PolarToCartesian.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PolarToCartesian.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SphericalToCartesian.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/SphericalToCartesian.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCylindricalCSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultPolarCSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToPolarTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToPolarTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CartesianToSphericalTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java
      - copied, changed from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PolarToCartesianTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PolarToCartesianTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/SphericalToCartesianTest.java
      - copied unchanged from r1737071, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/SphericalToCartesianTest.java
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DataTransfer.java
      - copied unchanged from r1737071, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DataTransfer.java
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryDataTransfer.java
      - copied unchanged from r1737071, sis/branches/JDK8/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryDataTransfer.java
Removed:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/OperationPathFinder.java
Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/application/sis-console/src/main/artifact/conf/logging.properties
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Properties.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxisFilter.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/BursaWolfInfo.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Solver.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/UnmodifiableMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedMolodenskyTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/InterpolatedTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/BuilderTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/BursaWolfParametersTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransformResultComparator.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/ExceptionsTest.java
    sis/branches/JDK7/src/main/config/logging.properties
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelData.java
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java
    sis/branches/JDK7/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/HyperRectangleReader.java
    sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/HyperRectangleReaderTest.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 29 22:51:40 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1734539
+/sis/branches/JDK8:1584960-1737071
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/application/sis-console/src/main/artifact/conf/logging.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/artifact/conf/logging.properties?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/artifact/conf/logging.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/artifact/conf/logging.properties [ISO-8859-1] Tue Mar 29 22:51:40 2016
@@ -56,7 +56,7 @@ java.util.logging.ConsoleHandler.level =
 # source: If set, writes the source logger or the source class name.
 #         The argument specifies the type of source to display.
 #         Valid values are none, logger:short, logger:long,
-#         class:short and class:long.
+#         "class:short", "class:long" and "class.method".
 
 java.util.logging.ConsoleHandler.formatter = org.apache.sis.util.logging.MonolineFormatter
 org.apache.sis.util.logging.MonolineFormatter.source = logger:long

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -16,8 +16,11 @@
  */
 package org.apache.sis.internal.metadata;
 
+import java.util.Map;
+import java.util.HashMap;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Angle;
+import org.opengis.annotation.UML;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
@@ -28,6 +31,8 @@ import org.apache.sis.util.iso.Types;
 import org.apache.sis.measure.Units;
 
 import static org.opengis.referencing.cs.AxisDirection.*;
+import static org.opengis.annotation.Obligation.CONDITIONAL;
+import static org.opengis.annotation.Specification.ISO_19162;
 import static org.apache.sis.util.CharSequences.*;
 
 
@@ -36,7 +41,7 @@ import static org.apache.sis.util.CharSe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class AxisDirections extends Static {
@@ -59,40 +64,86 @@ public final class AxisDirections extend
     public static final int DISPLAY_COUNT = 4;
 
     /**
+     * Ordinal of the last element in the {@link AxisDirection} code list.
+     * This is used for differentiating the standard codes from the user-defined ones.
+     */
+    private static final int LAST_ORDINAL = DISPLAY_DOWN.ordinal();
+
+    /**
+     * Distance from the origin in a polar coordinate system.
+     * Specified in ISO 19162 but not yet in ISO 19111.
+     *
+     * @since 0.7
+     */
+    @UML(identifier="awayFrom", obligation=CONDITIONAL, specification=ISO_19162)
+    public static final AxisDirection AWAY_FROM = AxisDirection.valueOf("AWAY_FROM");
+
+    /**
+     * Direction of geographic angles (bearing).
+     * Specified in ISO 19162 but not yet in ISO 19111.
+     *
+     * @since 0.7
+     */
+    @UML(identifier="clockwise", obligation=CONDITIONAL, specification=ISO_19162)
+    public static final AxisDirection CLOCKWISE = AxisDirection.valueOf("CLOCKWISE");
+
+    /**
+     * Direction of arithmetic angles. Used in polar coordinate systems.
+     * Specified in ISO 19162 but not yet in ISO 19111.
+     *
+     * @since 0.7
+     */
+    @UML(identifier="counterClockwise", obligation=CONDITIONAL, specification=ISO_19162)
+    public static final AxisDirection COUNTER_CLOCKWISE = AxisDirection.valueOf("COUNTER_CLOCKWISE");
+
+    /**
      * For each direction, the opposite direction.
+     * This map shall be immutable after construction.
      */
-    private static final AxisDirection[] OPPOSITES = new AxisDirection[DISPLAY_DOWN.ordinal() + 1];
+    private static final Map<AxisDirection,AxisDirection> OPPOSITES = new HashMap<>(20);
     static {
-        put(OTHER,            OTHER);
-        put(NORTH,            SOUTH);
-        put(NORTH_NORTH_EAST, SOUTH_SOUTH_WEST);
-        put(NORTH_EAST,       SOUTH_WEST);
-        put(EAST_NORTH_EAST,  WEST_SOUTH_WEST);
-        put(EAST,             WEST);
-        put(EAST_SOUTH_EAST,  WEST_NORTH_WEST);
-        put(SOUTH_EAST,       NORTH_WEST);
-        put(SOUTH_SOUTH_EAST, NORTH_NORTH_WEST);
-        put(UP,               DOWN);
-        put(FUTURE,           PAST);
-        put(COLUMN_POSITIVE,  COLUMN_NEGATIVE);
-        put(ROW_POSITIVE,     ROW_NEGATIVE);
-        put(DISPLAY_RIGHT,    DISPLAY_LEFT);
-        put(DISPLAY_UP,       DISPLAY_DOWN);
+        put(OTHER,             OTHER);
+        put(NORTH,             SOUTH);
+        put(NORTH_NORTH_EAST,  SOUTH_SOUTH_WEST);
+        put(NORTH_EAST,        SOUTH_WEST);
+        put(EAST_NORTH_EAST,   WEST_SOUTH_WEST);
+        put(EAST,              WEST);
+        put(EAST_SOUTH_EAST,   WEST_NORTH_WEST);
+        put(SOUTH_EAST,        NORTH_WEST);
+        put(SOUTH_SOUTH_EAST,  NORTH_NORTH_WEST);
+        put(UP,                DOWN);
+        put(FUTURE,            PAST);
+        put(COLUMN_POSITIVE,   COLUMN_NEGATIVE);
+        put(ROW_POSITIVE,      ROW_NEGATIVE);
+        put(DISPLAY_RIGHT,     DISPLAY_LEFT);
+        put(DISPLAY_UP,        DISPLAY_DOWN);
+        put(COUNTER_CLOCKWISE, CLOCKWISE);
     }
 
     /**
      * Stores the given directions in the {@link #OPPOSITES} array.
      */
     private static void put(final AxisDirection dir, final AxisDirection opposite) {
-        OPPOSITES[dir.ordinal()] = opposite;
-        OPPOSITES[opposite.ordinal()] = dir;
+        OPPOSITES.put(dir, opposite);
+        OPPOSITES.put(opposite, dir);
     }
 
     /**
-     * Ordinal of the last element in the {@link AxisDirection} code list.
-     * This is used for differentiating the standard codes from the user-defined ones.
+     * Proposed abbreviations for some axis directions.
+     * This map shall be immutable after construction.
      */
-    private static final int LAST_ORDINAL = DISPLAY_DOWN.ordinal();
+    private static final Map<AxisDirection,String> ABBREVIATIONS = new HashMap<>(12);
+    static {
+        final Map<AxisDirection,String> m = ABBREVIATIONS;
+        m.put(FUTURE,            "t");
+        m.put(COLUMN_POSITIVE,   "i");
+        m.put(ROW_POSITIVE,      "j");
+        m.put(DISPLAY_RIGHT,     "x");
+        m.put(DISPLAY_UP,        "y");
+        m.put(OTHER,             "z");      // Arbitrary abbreviation, may change in any future SIS version.
+        m.put(AWAY_FROM,         "r");
+        m.put(COUNTER_CLOCKWISE, "θ");
+    }
 
     /**
      * Do not allow instantiation of this class.
@@ -114,24 +165,25 @@ public final class AxisDirections extend
      *     <th style="width: 50%">Direction</th>
      *     <th style="width: 50%">Absolute value</th>
      *   </tr>
-     *   <tr><td>{@code NORTH}</td> <td>{@code NORTH}</td> </tr>
-     *   <tr><td>{@code SOUTH}</td> <td>{@code NORTH}</td> </tr>
-     *   <tr><td>{@code EAST}</td>  <td>{@code EAST}</td>  </tr>
-     *   <tr><td>{@code WEST}</td>  <td>{@code EAST}</td>  </tr>
-     *   <tr><td>{@code UP}</td>    <td>{@code UP}</td>    </tr>
-     *   <tr><td>{@code DOWN}</td>  <td>{@code UP}</td>    </tr>
+     *   <tr><td>{@code NORTH}</td> <td>{@code NORTH}</td></tr>
+     *   <tr><td>{@code SOUTH}</td> <td>{@code NORTH}</td></tr>
+     *   <tr><td>{@code EAST}</td>  <td>{@code EAST}</td></tr>
+     *   <tr><td>{@code WEST}</td>  <td>{@code EAST}</td></tr>
+     *   <tr><td>{@code UP}</td>    <td>{@code UP}</td></tr>
+     *   <tr><td>{@code DOWN}</td>  <td>{@code UP}</td></tr>
      * </table></td>
      * <td><table class="sis" summary="Other directions">
      *   <tr>
      *     <th style="width: 50%">Direction</th>
      *     <th style="width: 50%">Absolute value</th>
      *   </tr>
-     *   <tr><td>{@code DISPLAY_RIGHT}</td> <td>{@code DISPLAY_RIGHT}</td> </tr>
-     *   <tr><td>{@code DISPLAY_LEFT}</td>  <td>{@code DISPLAY_RIGHT}</td> </tr>
-     *   <tr><td>{@code DISPLAY_UP}</td>    <td>{@code DISPLAY_UP}</td>    </tr>
-     *   <tr><td>{@code DISPLAY_DOWN}</td>  <td>{@code DISPLAY_UP}</td>    </tr>
-     *   <tr><td>{@code FUTURE}</td>        <td>{@code FUTURE}</td>        </tr>
-     *   <tr><td>{@code PAST}</td>          <td>{@code FUTURE}</td>        </tr>
+     *   <tr><td>{@code DISPLAY_RIGHT}</td> <td>{@code DISPLAY_RIGHT}</td></tr>
+     *   <tr><td>{@code DISPLAY_LEFT}</td>  <td>{@code DISPLAY_RIGHT}</td></tr>
+     *   <tr><td>{@code DISPLAY_UP}</td>    <td>{@code DISPLAY_UP}</td></tr>
+     *   <tr><td>{@code DISPLAY_DOWN}</td>  <td>{@code DISPLAY_UP}</td></tr>
+     *   <tr><td>{@code FUTURE}</td>        <td>{@code FUTURE}</td></tr>
+     *   <tr><td>{@code PAST}</td>          <td>{@code FUTURE}</td></tr>
+     *   <tr><td>{@code CLOCKWISE}</td>     <td>{@code COUNTERCLOCKWISE}</td></tr>
      * </table></td></tr>
      *   <tr align="center"><td>{@code OTHER}</td><td>{@code OTHER}</td></tr>
      * </table>
@@ -139,11 +191,16 @@ public final class AxisDirections extend
      * @param  dir The direction for which to return the absolute direction, or {@code null}.
      * @return The direction from the above table, or {@code null} if the given direction was null.
      */
-    public static AxisDirection absolute(final AxisDirection dir) {
+    public static AxisDirection absolute(AxisDirection dir) {
         final AxisDirection opposite = opposite(dir);
         if (opposite != null) {
             if (opposite.ordinal() < dir.ordinal()) {
-                return opposite;
+                dir = opposite;
+            }
+            // Below is a temporary patch pending integration of code list values into GeoAPI.
+            // We need this patch because we can not rely on ordinal() value for custom codes.
+            if (dir == CLOCKWISE) {
+                dir = COUNTER_CLOCKWISE;
             }
         }
         return dir;
@@ -159,13 +216,7 @@ public final class AxisDirections extend
      * @return The opposite direction, or {@code null} if none or unknown.
      */
     public static AxisDirection opposite(AxisDirection dir) {
-        if (dir != null) {
-            final int ordinal = dir.ordinal();
-            if (ordinal >= 0 && ordinal < OPPOSITES.length) {
-                dir = OPPOSITES[ordinal];
-            }
-        }
-        return dir;
+        return OPPOSITES.get(dir);
     }
 
     /**
@@ -291,7 +342,7 @@ public final class AxisDirections extend
             final int tgt = target.ordinal() - base;
             if (tgt >= 0 && tgt < GEOCENTRIC_COUNT) {
                 int n = (tgt - src);
-                n -= GEOCENTRIC_COUNT * (n/2); // If -2 add 3.  If +2 subtract 3.  Otherwise do nothing.
+                n -= GEOCENTRIC_COUNT * (n/2);      // If -2 add 3.  If +2 subtract 3.  Otherwise do nothing.
                 return n;
             }
         }
@@ -376,12 +427,12 @@ public final class AxisDirections extend
         if (cs != null) {
             for (int i = cs.getDimension(); --i>=0;) {
                 final CoordinateSystemAxis axis = cs.getAxis(i);
-                if (axis != null) {  // Paranoiac check.
+                if (axis != null) {                                                     // Paranoiac check.
                     final Unit<?> candidate = axis.getUnit();
                     if (Units.isAngular(candidate)) {
                         unit = candidate.asType(Angle.class);
                         if (AxisDirection.EAST.equals(absolute(axis.getDirection()))) {
-                            break; // Found the longitude axis.
+                            break;                                                      // Found the longitude axis.
                         }
                     }
                 }
@@ -434,7 +485,7 @@ public final class AxisDirections extend
             if (dim + i > cs.getDimension()) {
                 return -1;
             }
-            while (--i > 0) { // Intentionally exclude 0.
+            while (--i > 0) {               // Intentionally exclude 0.
                 if (!absolute(subCS.getAxis(i).getDirection()).equals(
                      absolute(cs.getAxis(i + dim).getDirection())))
                 {
@@ -505,12 +556,12 @@ public final class AxisDirections extend
                 int s = name.indexOf('/', d);
                 if (s < 0) {
                     if (equalsIgnoreCase(name, d, length, "north pole")) {
-                        return GEOCENTRIC_Z; // "Geocentre > north pole"
+                        return GEOCENTRIC_Z;                                // "Geocentre > north pole"
                     }
                 } else if (equalsIgnoreCase(name, d, skipTrailingWhitespaces(name, d, s), "equator")) {
                     s = skipLeadingWhitespaces(name, s+1, length);
                     if (equalsIgnoreCase(name, s, length, "PM")) {
-                        return GEOCENTRIC_X; // "Geocentre > equator/PM"
+                        return GEOCENTRIC_X;                                // "Geocentre > equator/PM"
                     }
                     /*
                      * At this point, the name may be "Geocentre > equator/0°E",
@@ -527,8 +578,8 @@ public final class AxisDirections extend
                             i = skipLeadingWhitespaces(name, i, length);
                             if (equalsIgnoreCase(name, i, length, "°E") || equalsIgnoreCase(name, i, length, "dE")) {
                                 switch (n) {
-                                    case  0: return GEOCENTRIC_X; // "Geocentre > equator/0°E"
-                                    case 90: return GEOCENTRIC_Y; // "Geocentre > equator/90°E"
+                                    case  0: return GEOCENTRIC_X;           // "Geocentre > equator/0°E"
+                                    case 90: return GEOCENTRIC_Y;           // "Geocentre > equator/90°E"
                                 }
                             }
                             break;
@@ -549,10 +600,14 @@ public final class AxisDirections extend
     }
 
     /**
-     * Returns {@code true} if the given name starts with the given keyword, ignoring case.
+     * Returns {@code true} if the given name starts or ends with the given keyword, ignoring case.
+     *
+     * @param start {@code false} if the given keyword is expected at the beggining of the name,
+     *        or {@code end} if expected at the end.
      */
-    private static boolean startsWith(final String name, final String keyword) {
-        return name.regionMatches(true, 0, keyword, 0, keyword.length());
+    private static boolean contains(final String name, final String keyword, final boolean end) {
+        final int length = keyword.length();
+        return name.regionMatches(true, end ? name.length() - length : 0, keyword, 0, length);
     }
 
     /**
@@ -569,7 +624,14 @@ public final class AxisDirections extend
      */
     public static String suggestAbbreviation(final String name, final AxisDirection direction, final Unit<?> unit) {
         if (name.length() == 1) {
-            return name;  // Most common cases are "x", "y", "z", "t", "i" and "j".
+            return name;                    // Most common cases are "x", "y", "z", "t", "i" and "j".
+        }
+        /*
+         * Direction may be both "compass" (e.g. North) or "non-compass" (e.g. away from).
+         * Even if the radius at θ = 0° is oriented toward North, but we do not want the "N" abbreviation.
+         */
+        if (contains(name, "radius", true)) {
+            return contains(name, "Geocentric", false) ? "R" : "r";
         }
         if (isCompass(direction)) {
             /*
@@ -578,7 +640,7 @@ public final class AxisDirections extend
              * a longitude or latitude axis. We detect those later cases by the unit of measurement.
              */
             if (!isIntercardinal(direction) && Units.isAngular(unit)) {
-                if (startsWith(name, "Spherical")) {
+                if (contains(name, "Spherical", false)) {
                     return NORTH.equals(absolute(direction)) ? "φ′" : "θ";
                 } else {
                     return NORTH.equals(absolute(direction)) ? "φ" : "λ";
@@ -592,27 +654,20 @@ public final class AxisDirections extend
              * use "h" as the fallback for unknown vertical axis.
              */
             if (UP.equals(direction)) {
-                return startsWith(name, "Gravity") ? "H" : startsWith(name, "Geocentric") ? "r": "h";
+                if (contains(name, "Gravity",    false)) return "H";
+                if (contains(name, "Elevation",  false)) return "φ";
+                if (contains(name, "Geocentric", false)) return "r";
+                return "h";
             } else if (DOWN.equals(direction)) {
-                return "D"; // "Depth"
+                return "D";                         // "Depth"
             } else if (isGeocentric(direction)) {
                 // For GEOCENTRIC_X, GEOCENTRIC_Y or GEOCENTRIC_Z, just take the last letter.
                 final String dir = direction.name();
                 return dir.substring(dir.length() - 1).trim();
             }
-            final AxisDirection a = absolute(direction);
-            if (FUTURE.equals(a)) {
-                return "t";
-            } else if (COLUMN_POSITIVE.equals(a)) {
-                return "i";
-            } else if (ROW_POSITIVE.equals(a)) {
-                return "j";
-            } else if (DISPLAY_RIGHT.equals(a)) {
-                return "x";
-            } else if (DISPLAY_UP.equals(a)) {
-                return "y";
-            } else if (OTHER.equals(a)) {
-                return "z";  // Arbitrary abbreviation, may change in any future SIS version.
+            final String abbreviation = ABBREVIATIONS.get(absolute(direction));
+            if (abbreviation != null) {
+                return abbreviation;
             }
         }
         final String id = direction.identifier();   // UML identifier, or null if none.

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -57,7 +57,8 @@ public final class AxisNames {
 
     /**
      * The ISO 19111 <cite>"spherical longitude"</cite> name. Abbreviation used by SIS is "θ" (theta)
-     * for consistency with the EPSG "long" abbreviation, but some other conventions use "φ" instead.
+     * for consistency with ISO 19162 <cite>Axis name and abbreviation</cite> section,
+     * but some other conventions use φ or Ω instead.
      * Direction in the EPSG database is "East", but "counterClockwise" may also be used.
      *
      * @see <a href="http://en.wikipedia.org/wiki/Spherical_coordinate_system">Spherical coordinate system on Wikipedia</a>
@@ -67,7 +68,8 @@ public final class AxisNames {
 
     /**
      * The ISO 19111 <cite>"spherical latitude"</cite> name. Abbreviation used by SIS is "φ′" (phi prime)
-     * for consistency with the EPSG "lat" abbreviation, but some other conventions use "θ" instead.
+     * for consistency with ISO 19162 <cite>Axis name and abbreviation</cite> section,
+     * but some other conventions use θ, Ω or Ψ instead.
      * Direction in the EPSG database is "North", but the "Up" direction may also be used with a similar
      * axis named "elevation".
      */
@@ -104,7 +106,11 @@ public final class AxisNames {
     public static final String GEOCENTRIC_Z = "Geocentric Z";
 
     /**
-     * The ISO 19111 <cite>"geocentric radius"</cite> name. Abbreviation is lower case <cite>"r"</cite>.
+     * The ISO 19111 <cite>"geocentric radius"</cite> name. Abbreviation is upper case <cite>"R"</cite>
+     * for consistency with EPSG database.
+     *
+     * <div class="note"><b>Note:</b>Lower case <cite>"r"</cite> is used for non-geocentric radius
+     * or axes named "distance" with "awayFrom" direction.</div>
      */
     public static final String GEOCENTRIC_RADIUS = "Geocentric radius";
 

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/AbstractParser.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -34,10 +34,13 @@ import javax.measure.unit.UnitFormat;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.LocalizedParseException;
 import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.ArgumentChecks;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
@@ -55,7 +58,7 @@ import static org.apache.sis.util.Argume
  * @author  Rémi Eve (IRD)
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 abstract class AbstractParser implements Parser {
@@ -227,6 +230,20 @@ abstract class AbstractParser implements
     }
 
     /**
+     * Returns the index after the end of the fragment name starting at the given index.
+     * Current implementation assumes that the fragment name is a Unicode identifier.
+     */
+    static int endOfFragmentName(final String text, int upper) {
+        final int length = text.length();
+        while (upper < length) {
+            final int c = text.codePointAt(upper);
+            if (!Character.isUnicodeIdentifierPart(c)) break;
+            upper += Character.charCount(c);
+        }
+        return upper;
+    }
+
+    /**
      * Parses a <cite>Well Know Text</cite> (WKT).
      *
      * @param  text The text to be parsed.
@@ -238,7 +255,22 @@ abstract class AbstractParser implements
         warnings = null;
         ignoredElements.clear();
         ArgumentChecks.ensureNonEmpty("text", text);
-        final Element element = new Element("<root>", new Element(this, text, position, null));
+        Element fragment;
+        int lower = CharSequences.skipLeadingWhitespaces(text, position.getIndex(), text.length());
+        if (lower < text.length() && text.charAt(lower) == Symbols.FRAGMENT_VALUE) {
+            final int upper = endOfFragmentName(text, ++lower);
+            final String id = text.substring(lower, upper);
+            fragment = fragments.get(id);
+            if (fragment == null) {
+                position.setErrorIndex(lower);
+                throw new LocalizedParseException(errorLocale, Errors.Keys.NoSuchValue_1, new Object[] {id}, lower);
+            }
+            position.setIndex(upper);
+            fragment = new Element(fragment);
+        } else {
+            fragment = new Element(this, text, position, null);
+        }
+        final Element element = new Element("<root>", fragment);
         final Object object = parseObject(element);
         element.close(ignoredElements);
         return object;

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Element.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -123,18 +123,18 @@ final class Element implements Serializa
         keyword = name;
         offset  = singleton.offset;
         locale  = singleton.locale;
-        list    = new LinkedList<>();   // Needs to be a modifiable list.
+        list    = new LinkedList<>();                           // Needs to be a modifiable list.
         list.add(singleton);
     }
 
     /**
      * Creates a modifiable copy of the given element.
      */
-    private Element(final Element toCopy) {
+    Element(final Element toCopy) {
         keyword = toCopy.keyword;
         offset  = toCopy.offset;
         locale  = toCopy.locale;
-        list    = new LinkedList<>(toCopy.list);   // Needs to be a modifiable list.
+        list    = new LinkedList<>(toCopy.list);                // Needs to be a modifiable list.
         final ListIterator<Object> it = list.listIterator();
         while (it.hasNext()) {
             final Object value = it.next();
@@ -229,12 +229,7 @@ final class Element implements Serializa
                  * to environment variables in Unix. If we find the "$" character, get the identifier behind "$"
                  * and insert the corresponding WKT fragment here.
                  */
-                int upper = ++lower;      // Increment of 1 is okay because FRAGMENT_VALUE is a 'char'.
-                while (upper < length) {
-                    final int c = text.codePointAt(upper);
-                    if (!Character.isUnicodeIdentifierPart(c)) break;
-                    upper += Character.charCount(c);
-                }
+                final int upper = AbstractParser.endOfFragmentName(text, ++lower);
                 final String id = text.substring(lower, upper);
                 Element fragment = parser.fragments.get(id);
                 if (fragment == null) {
@@ -271,7 +266,7 @@ final class Element implements Serializa
                      * parsed text.
                      */
                     final int n = Character.charCount(closingQuote);
-                    lower += Character.charCount(firstChar) - n;    // This will usually let 'lower' unchanged.
+                    lower += Character.charCount(firstChar) - n;        // This will usually let 'lower' unchanged.
                     CharSequence content = null;
                     do {
                         final int upper = text.indexOf(closingQuote, lower += n);
@@ -279,7 +274,7 @@ final class Element implements Serializa
                             throw missingCharacter(closingQuote, lower, position);
                         }
                         if (content == null) {
-                            content = text.substring(lower, upper);   // First text fragment, and usually the only one.
+                            content = text.substring(lower, upper);     // First text fragment, and usually the only one.
                         } else {
                             /*
                              * We will enter in this block only if we found at least one double quote.
@@ -312,7 +307,7 @@ final class Element implements Serializa
                     switch (valueType) {
                         case TEMPORAL: value = parser.parseDate  (text, position); break;
                         case NUMERIC:  value = parser.parseNumber(text, position); break;
-                        default: throw new AssertionError(valueType);  // Should never happen.
+                        default: throw new AssertionError(valueType);                       // Should never happen.
                     }
                     if (value == null) {
                         // Do not update the error index; it is already updated by NumberFormat.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -72,7 +72,7 @@ public final class ExtentSelector<T> {
      */
     public boolean evaluate(final Extent extent, final T object) {
         final double area = Extents.area(Extents.intersection(Extents.getGeographicBoundingBox(extent), areaOfInterest));
-        if (best != null && !(area > largestArea)) { // Use '!' for catching NaN.
+        if (best != null && !(area > largestArea)) {    // Use '!' for catching NaN.
             /*
              * At this point, the given extent is not greater than the previous one.
              * However if the previous object had no extent information at all (i.e.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -121,7 +121,7 @@ public final class Legacy implements Axi
     // -----------------------------------------------------------------
 
     /**
-     * The value to be returned by {@link #getUnitReplacement(Unit)},
+     * The value to be returned by {@link #getUnitReplacement(CoordinateSystemAxis, Unit)},
      * or {@code null} if no replacement should be done.
      */
     private final Unit<?> replacement;
@@ -133,14 +133,21 @@ public final class Legacy implements Axi
         replacement = unit;
     }
 
+    @Override
+    @Deprecated
+    public Unit<?> getUnitReplacement(Unit<?> unit) {
+        return getUnitReplacement(null, unit);
+    }
+
     /**
      * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
      *
+     * @param  axis ignored.
      * @param  unit ignored.
      * @return The unit of the new coordinate system.
      */
     @Override
-    public Unit<?> getUnitReplacement(final Unit<?> unit) {
+    public Unit<?> getUnitReplacement(CoordinateSystemAxis axis, final Unit<?> unit) {
         return replacement;
     }
 
@@ -156,7 +163,16 @@ public final class Legacy implements Axi
      * Returns the given direction unchanged.
      */
     @Override
+    @Deprecated
     public AxisDirection getDirectionReplacement(final AxisDirection direction) {
         return direction;
     }
+
+    /**
+     * Returns the given direction unchanged.
+     */
+    @Override
+    public AxisDirection getDirectionReplacement(CoordinateSystemAxis axis, final AxisDirection direction) {
+        return direction;
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -37,6 +37,7 @@ import org.apache.sis.referencing.Identi
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
+import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory.Context;
 
 import static java.util.Collections.singletonMap;
 
@@ -65,14 +66,16 @@ public final class ReferencingUtilities
      * This method provides the same functionality than {@link DefaultPrimeMeridian#getGreenwichLongitude(Unit)},
      * but on arbitrary implementation.
      *
-     * @param  primeMeridian The prime meridian from which to get the Greenwich longitude.
+     * @param  primeMeridian The prime meridian from which to get the Greenwich longitude, or {@code null}.
      * @param  unit The unit for the prime meridian to return.
-     * @return The prime meridian in the given units.
+     * @return The prime meridian in the given units, or {@code 0} if the given prime meridian was null.
      *
      * @see DefaultPrimeMeridian#getGreenwichLongitude(Unit)
      */
     public static double getGreenwichLongitude(final PrimeMeridian primeMeridian, final Unit<Angle> unit) {
-        if (primeMeridian instanceof DefaultPrimeMeridian) { // Maybe the user overrode some methods.
+        if (primeMeridian == null) {
+            return 0;
+        } else if (primeMeridian instanceof DefaultPrimeMeridian) {         // Maybe the user overrode some methods.
             return ((DefaultPrimeMeridian) primeMeridian).getGreenwichLongitude(unit);
         } else {
             return primeMeridian.getAngularUnit().getConverterTo(unit).convert(primeMeridian.getGreenwichLongitude());
@@ -319,4 +322,36 @@ public final class ReferencingUtilities
         }
         return null;
     }
+
+    /**
+     * Sets the source and target ellipsoids and coordinate systems to values inferred from the given CRS.
+     * The ellipsoids will be non-null only if the given CRS is geographic (not geocentric).
+     *
+     * @param sourceCRS The CRS from which to get the source coordinate system and ellipsoid.
+     * @param targetCRS The CRS from which to get the target coordinate system and ellipsoid.
+     * @param context   A pre-allocated context, or {@code null} for creating a new one.
+     * @return The given context if it was non-null, or a new context otherwise.
+     *
+     * @since 0.7
+     */
+    public static Context createTransformContext(final CoordinateReferenceSystem sourceCRS,
+            final CoordinateReferenceSystem targetCRS, Context context)
+    {
+        if (context == null) {
+            context = new Context();
+        }
+        final CoordinateSystem sourceCS = (sourceCRS != null) ? sourceCRS.getCoordinateSystem() : null;
+        final CoordinateSystem targetCS = (targetCRS != null) ? targetCRS.getCoordinateSystem() : null;
+        if (sourceCRS instanceof GeodeticCRS && sourceCS instanceof EllipsoidalCS) {
+            context.setSource((EllipsoidalCS) sourceCS, ((GeodeticCRS) sourceCRS).getDatum().getEllipsoid());
+        } else {
+            context.setSource(sourceCS);
+        }
+        if (targetCRS instanceof GeodeticCRS && targetCS instanceof EllipsoidalCS) {
+            context.setTarget((EllipsoidalCS) targetCS, ((GeodeticCRS) targetCRS).getDatum().getEllipsoid());
+        } else {
+            context.setTarget(targetCS);
+        }
+        return context;
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -312,7 +312,7 @@ public class AffineTransform2D extends I
                     final AffineTransform2D work = new AffineTransform2D(
                             ((ExtendedPrecisionMatrix) Matrices.inverse(matrix)).getExtendedElements());
                     work.inverse = this;
-                    inverse = work; // Set only on success.
+                    inverse = work;                 // Set only on success.
                 }
             }
         }
@@ -332,7 +332,7 @@ public class AffineTransform2D extends I
      */
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
-        if (object == this) { // Slight optimization
+        if (object == this) {                       // Slight optimization
             return true;
         }
         if (mode == ComparisonMode.STRICT) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -214,4 +214,14 @@ public abstract class AbstractProvider e
     public int getEllipsoidsMask() {
         return 0;
     }
+
+    /**
+     * Returns {@code true} if the inverse of this operation method is the same operation method with some parameter
+     * values changed (typically with sign inverted). The default implementation returns {@code false}.
+     *
+     * @return {@code true} if the inverse of this operation method can be described by the same operation method.
+     */
+    public boolean isInvertible() {
+        return false;
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -179,6 +179,16 @@ public final class Affine extends Abstra
      */
 
     /**
+     * The inverse of this operation can be described by the same operation with different parameter values.
+     *
+     * @return {@code true} for all {@code Affine}.
+     */
+    @Override
+    public final boolean isInvertible() {
+        return true;
+    }
+
+    /**
      * Creates a projective transform from the specified group of parameter values.
      *
      * @param  factory Ignored (can be null).

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -24,6 +24,10 @@ import org.opengis.util.FactoryException
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.referencing.cs.CartesianCS;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.Transformation;
@@ -67,6 +71,14 @@ public abstract class GeocentricAffine e
     private static final long serialVersionUID = 8291967302538661639L;
 
     /**
+     * The tolerance factor for comparing the {@link BursaWolfParameters} values.
+     * We use a tolerance of 1E-6 ({@value Formulas#LINEAR_TOLERANCE} / 10000) based on the knowledge
+     * that the translation terms are in metres and the rotation terms have the some order of magnitude.
+     * Actually we could use a value of zero, but we add a small tolerance for rounding errors.
+     */
+    private static final double BURSAWOLF_TOLERANCE = Formulas.LINEAR_TOLERANCE / 10000;
+
+    /**
      * The operation parameter descriptor for the <cite>X-axis translation</cite>
      * ({@linkplain BursaWolfParameters#tX tX}) parameter value. Valid values range
      * from negative to positive infinity. Units are {@linkplain SI#METRE metres}.
@@ -165,6 +177,16 @@ public abstract class GeocentricAffine e
     abstract int getType();
 
     /**
+     * The inverse of this operation is the same operation with parameter signs inverted.
+     *
+     * @return {@code true} for all {@code GeocentricAffine}.
+     */
+    @Override
+    public final boolean isInvertible() {
+        return true;
+    }
+
+    /**
      * Creates a math transform from the specified group of parameter values.
      * The default implementation creates an affine transform, but some subclasses
      * will wrap that affine operation into Geographic/Geocentric conversions.
@@ -200,6 +222,103 @@ public abstract class GeocentricAffine e
     }
 
     /**
+     * Creates parameter values for a Molodensky, Geocentric Translation or Position Vector transformation.
+     *
+     * @param  descriptor     The {@code PARAMETERS} constant of the subclass describing the operation to create.
+     * @param  parameters     Bursa-Wolf parameters from which to get the values.
+     * @param  isTranslation  {@code true} if the operation contains only translation terms.
+     * @return The operation parameters with their values initialized.
+     */
+    private static Parameters createParameters(final ParameterDescriptorGroup descriptor,
+            final BursaWolfParameters parameters, final boolean isTranslation)
+    {
+        final Parameters values = Parameters.castOrWrap(descriptor.createValue());
+        values.getOrCreate(TX).setValue(parameters.tX);
+        values.getOrCreate(TY).setValue(parameters.tY);
+        values.getOrCreate(TZ).setValue(parameters.tZ);
+        if (!isTranslation) {
+            values.getOrCreate(RX).setValue(parameters.rX);
+            values.getOrCreate(RY).setValue(parameters.rY);
+            values.getOrCreate(RZ).setValue(parameters.rZ);
+            values.getOrCreate(DS).setValue(parameters.dS);
+        }
+        return values;
+    }
+
+    /**
+     * Returns the parameters for creating a datum shift operation.
+     * The operation method will be one of the {@code GeocentricAffine} subclasses.
+     * If no single operation method can be used, then this method returns {@code null}.
+     *
+     * <p>This method does <strong>not</strong> change the coordinate system type.
+     * The source and target coordinate systems can be both {@code EllipsoidalCS} or both {@code CartesianCS}.
+     * Any other type or mix of types (e.g. a {@code EllipsoidalCS} source and {@code CartesianCS} target)
+     * will cause this method to return {@code null}. In such case, it is caller's responsibility to apply
+     * the datum shift itself in Cartesian geocentric coordinates.</p>
+     *
+     * @param sourceCS       The source coordinate system. Only the type and number of dimensions is checked.
+     * @param targetCS       The target coordinate system. Only the type and number of dimensions is checked.
+     * @param datumShift     The datum shift as a matrix.
+     * @param useMolodensky  {@code true} for allowing the use of Molodensky approximation, or {@code false}
+     *                       for using the transformation in geocentric space (which should be more accurate).
+     * @return The parameter values, or {@code null} if no single operation method can be found.
+     */
+    public static ParameterValueGroup createParameters(final CoordinateSystem sourceCS,
+            final CoordinateSystem targetCS, final Matrix datumShift, boolean useMolodensky)
+    {
+        final boolean isEllipsoidal = (sourceCS instanceof EllipsoidalCS);
+        if (!(isEllipsoidal ? targetCS instanceof EllipsoidalCS
+                            : targetCS instanceof CartesianCS && sourceCS instanceof CartesianCS))
+        {
+            return null;        // Coordinate systems are not two EllipsoidalCS or two CartesianCS.
+        }
+        @SuppressWarnings("null")
+        int dimension  = sourceCS.getDimension();
+        if (dimension != targetCS.getDimension()) {
+            dimension  = 0;                             // Sentinal value for mismatched dimensions.
+        }
+        /*
+         * Try to convert the matrix into (tX, tY, tZ, rX, rY, rZ, dS) parameters.
+         * The matrix may not be convertible, in which case we will let the callers
+         * uses the matrix directly in Cartesian geocentric coordinates.
+         */
+        final BursaWolfParameters parameters = new BursaWolfParameters(null, null);
+        try {
+            parameters.setPositionVectorTransformation(datumShift, BURSAWOLF_TOLERANCE);
+        } catch (IllegalArgumentException e) {
+            log(Loggers.COORDINATE_OPERATION, "createParameters", e);
+            return null;
+        }
+        final boolean isTranslation = parameters.isTranslation();
+        final ParameterDescriptorGroup descriptor;
+        /*
+         * Following "if" blocks are ordered from more accurate to less accurate datum shift method
+         * supported by GeocentricAffine subclasses.
+         */
+        if (!isEllipsoidal) {
+            useMolodensky = false;
+            descriptor = isTranslation ? GeocentricTranslation.PARAMETERS
+                                       : PositionVector7Param .PARAMETERS;
+        } else {
+            if (!isTranslation) {
+                useMolodensky = false;
+                descriptor = (dimension >= 3) ? PositionVector7Param3D.PARAMETERS
+                                              : PositionVector7Param2D.PARAMETERS;
+            } else if (!useMolodensky) {
+                descriptor = (dimension >= 3) ? GeocentricTranslation3D.PARAMETERS
+                                              : GeocentricTranslation2D.PARAMETERS;
+            } else {
+                descriptor = Molodensky.PARAMETERS;
+            }
+        }
+        final Parameters values = createParameters(descriptor, parameters, isTranslation);
+        if (useMolodensky && dimension != 0) {
+            values.getOrCreate(Molodensky.DIMENSION).setValue(dimension);
+        }
+        return values;
+    }
+
+    /**
      * Given a transformation chain, conditionally replaces the affine transform elements by an alternative object
      * showing the Bursa-Wolf parameters. The replacement is applied if and only if the affine transform is a scale,
      * translation or rotation in the geocentric domain.
@@ -211,7 +330,7 @@ public abstract class GeocentricAffine e
      *
      * @param transforms The full chain of concatenated transforms.
      */
-    public static void asDatumShift(final List<Object> transforms) throws IllegalArgumentException {
+    public static void asDatumShift(final List<Object> transforms) {
         for (int i=transforms.size() - 2; --i >= 0;) {
             if (isOperation(GeographicToGeocentric.NAME, transforms.get(i)) &&
                 isOperation(GeocentricToGeographic.NAME, transforms.get(i+2)))
@@ -220,31 +339,18 @@ public abstract class GeocentricAffine e
                 if (step instanceof LinearTransform) {
                     final BursaWolfParameters parameters = new BursaWolfParameters(null, null);
                     try {
-                        /*
-                         * We use a 0.01 metre tolerance (Formulas.LINEAR_TOLERANCE) based on the knowledge that the
-                         * translation terms are in metres and the rotation terms have the some order of magnitude.
-                         */
-                        parameters.setPositionVectorTransformation(((LinearTransform) step).getMatrix(), Formulas.LINEAR_TOLERANCE);
+                        parameters.setPositionVectorTransformation(((LinearTransform) step).getMatrix(), BURSAWOLF_TOLERANCE);
                     } catch (IllegalArgumentException e) {
                         /*
                          * Should not occur, except sometime on inverse transform of relatively complex datum shifts
                          * (more than just translation terms). We can fallback on formatting the full matrix.
                          */
-                        Logging.recoverableException(Logging.getLogger(Loggers.WKT), GeocentricAffine.class, "asDatumShift", e);
+                        log(Loggers.WKT, "asDatumShift", e);
                         continue;
                     }
                     final boolean isTranslation = parameters.isTranslation();
-                    final Parameters values = Parameters.castOrWrap(
-                            (isTranslation ? GeocentricTranslation.PARAMETERS : PositionVector7Param.PARAMETERS).createValue());
-                    values.getOrCreate(TX).setValue(parameters.tX);
-                    values.getOrCreate(TY).setValue(parameters.tY);
-                    values.getOrCreate(TZ).setValue(parameters.tZ);
-                    if (!isTranslation) {
-                        values.getOrCreate(RX).setValue(parameters.rX);
-                        values.getOrCreate(RY).setValue(parameters.rY);
-                        values.getOrCreate(RZ).setValue(parameters.rZ);
-                        values.getOrCreate(DS).setValue(parameters.dS);
-                    }
+                    final Parameters values = createParameters(isTranslation ? GeocentricTranslation.PARAMETERS
+                                            : PositionVector7Param.PARAMETERS, parameters, isTranslation);
                     transforms.set(i+1, new FormattableObject() {
                         @Override protected String formatTo(final Formatter formatter) {
                             WKTUtilities.appendParamMT(values, formatter);
@@ -263,4 +369,11 @@ public abstract class GeocentricAffine e
         return (actual instanceof Parameterized) &&
                IdentifiedObjects.isHeuristicMatchForName(((Parameterized) actual).getParameterDescriptors(), expected);
     }
+
+    /**
+     * Logs a warning about a failure to compute the Bursa-Wolf parameters.
+     */
+    private static void log(final String logger, final String method, final Exception e) {
+        Logging.recoverableException(Logging.getLogger(logger), GeocentricAffine.class, method, e);
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -40,7 +40,7 @@ public final class GeocentricTranslation
     /**
      * The group of all parameters expected by this coordinate operation.
      */
-    private static final ParameterDescriptorGroup PARAMETERS;
+    static final ParameterDescriptorGroup PARAMETERS;
     static {
         PARAMETERS = builder()
                 .addIdentifier("1035")

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -101,6 +101,16 @@ public class GeographicOffsets extends A
     }
 
     /**
+     * The inverse of this operation is the same operation with parameter signs inverted.
+     *
+     * @return {@code true} for all {@code GeocentricAffine}.
+     */
+    @Override
+    public final boolean isInvertible() {
+        return true;
+    }
+
+    /**
      * Creates a transform from the specified group of parameter values.
      * The parameter values are unconditionally converted to degrees and metres.
      *

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -679,7 +679,7 @@ public class TensorParameters<E> impleme
                 if (++indices[j] < actualSize[j]) {
                     break;
                 }
-                indices[j] = 0; // We have done a full turn at that dimension. Will increment next dimension.
+                indices[j] = 0;         // We have done a full turn at that dimension. Will increment next dimension.
             }
         }
         return parameters;
@@ -737,6 +737,8 @@ public class TensorParameters<E> impleme
      * @param  properties The properties to be given to the identified object.
      * @param  matrix The matrix to copy in the new parameter group.
      * @return A new parameter group initialized to the given matrix.
+     *
+     * @see #toMatrix(ParameterValueGroup)
      */
     public ParameterValueGroup createValueGroup(final Map<String,?> properties, final Matrix matrix) {
         if (rank() != 2) {
@@ -755,6 +757,8 @@ public class TensorParameters<E> impleme
      * @param  parameters The group of parameters.
      * @return A matrix constructed from the specified group of parameters.
      * @throws InvalidParameterNameException if a parameter name was not recognized.
+     *
+     * @see #createValueGroup(Map, Matrix)
      */
     public Matrix toMatrix(final ParameterValueGroup parameters) throws InvalidParameterNameException {
         if (rank() != 2) {
@@ -762,7 +766,7 @@ public class TensorParameters<E> impleme
         }
         ArgumentChecks.ensureNonNull("parameters", parameters);
         if (parameters instanceof TensorValues) {
-            return ((TensorValues) parameters).toMatrix(); // More efficient implementation
+            return ((TensorValues) parameters).toMatrix();              // More efficient implementation
         }
         // Fallback on the general case (others implementations)
         final ParameterValue<?> numRow = parameters.parameter(dimensions[0].getName().getCode());

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -110,7 +110,7 @@ final class AuthorityFactories<T extends
             if (factory == null) try {
                 factory = new EPSGFactory(null);
             } catch (FactoryException e) {
-                log(Level.CONFIG, e);
+                log(e, false);
                 factory = EPSGFactoryFallback.INSTANCE;
             }
             EPSG[0] = factory;
@@ -137,37 +137,42 @@ final class AuthorityFactories<T extends
                 EPSG[0] = factory;
             }
         }
-        log(Level.WARNING, e);
+        log(e, true);
         return factory;
     }
 
     /**
      * Notifies that a factory is unavailable, but without giving a fallback and without logging.
      * The caller is responsible for logging a warning and to provide its own fallback.
+     *
+     * @return {@code true} on success, or {@code false} if this method did nothing.
      */
-    static void failure(final UnavailableFactoryException e) {
+    static boolean failure(final UnavailableFactoryException e) {
         if (!(e.getCause() instanceof SQLTransientException)) {
             final AuthorityFactory unavailable = e.getUnavailableFactory();
             synchronized (EPSG) {
                 if (unavailable == EPSG[0]) {
                     ALL.reload();
                     EPSG[0] = EPSGFactoryFallback.INSTANCE;
+                    return true;
                 }
             }
         }
+        return false;
     }
 
     /**
      * Logs the given exception at the given level. This method pretends that the logging come from
      * {@link CRS#getAuthorityFactory(String)}, which is the public facade for {@link #EPSG()}.
      */
-    private static void log(final Level level, final Exception e) {
+    private static void log(final Exception e, final boolean isWarning) {
         String message = e.getLocalizedMessage();
         if (message == null) {
             message = e.toString();
         }
-        final LogRecord record = new LogRecord(level, message);
+        final LogRecord record = new LogRecord(isWarning ? Level.WARNING : Level.CONFIG, message);
         record.setLoggerName(Loggers.CRS_FACTORY);
+        if (isWarning) record.setThrown(e);
         Logging.log(CRS.class, "getAuthorityFactory", record);
     }
 

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1737072&r1=1737071&r2=1737072&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Tue Mar 29 22:51:40 2016
@@ -42,6 +42,7 @@ import org.opengis.referencing.crs.Engin
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.GeographicBoundingBox;
+import org.opengis.referencing.operation.CoordinateOperation;
 import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
@@ -50,8 +51,12 @@ import org.apache.sis.referencing.cs.Def
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
-import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.referencing.operation.CoordinateOperationContext;
+import org.apache.sis.referencing.operation.DefaultCoordinateOperationFactory;
 import org.apache.sis.referencing.factory.UnavailableFactoryException;
+import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Static;
@@ -591,4 +596,43 @@ check:  while (lower != 0 || upper != di
         }
         return AuthorityFactories.ALL.getAuthorityFactory(CRSAuthorityFactory.class, authority, null);
     }
+
+    /**
+     * Finds a mathematical operation that transforms or converts coordinates from the given source to the
+     * given target coordinate reference system. If an estimation of the geographic area containing the points
+     * to transform is known, it can be specified for helping this method to find a better suited operation.
+     *
+     * <p>Note that the area of interest is just one aspect that may affect the coordinate operation.
+     * Other aspects are the time of interest (because some coordinate operations take in account the
+     * plate tectonics movement) or the desired accuracy. For more control on the coordinate operation
+     * to create, see {@link CoordinateOperationContext}.</p>
+     *
+     * @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.
+     *
+     * @see DefaultCoordinateOperationFactory#createOperation(CoordinateReferenceSystem, CoordinateReferenceSystem, CoordinateOperationContext)
+     *
+     * @since 0.7
+     */
+    public static CoordinateOperation findOperation(final CoordinateReferenceSystem sourceCRS,
+                                                    final CoordinateReferenceSystem targetCRS,
+                                                    final GeographicBoundingBox areaOfInterest)
+            throws FactoryException
+    {
+        ArgumentChecks.ensureNonNull("sourceCRS", sourceCRS);
+        ArgumentChecks.ensureNonNull("targetCRS", targetCRS);
+        CoordinateOperationContext context = null;
+        if (areaOfInterest != null) {
+            final DefaultGeographicBoundingBox bbox = DefaultGeographicBoundingBox.castOrCopy(areaOfInterest);
+            if (bbox.isEmpty()) {
+                throw new IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "areaOfInterest"));
+            }
+            context = new CoordinateOperationContext();
+            context.setGeographicBoundingBox(bbox);
+        }
+        return CoordinateOperations.factory.createOperation(sourceCRS, targetCRS, context);
+    }
 }



Mime
View raw message