sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1684689 - in /sis/branches/JDK6: ./ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ core/sis-referencing/...
Date Wed, 10 Jun 2015 14:56:57 GMT
Author: desruisseaux
Date: Wed Jun 10 14:56:57 2015
New Revision: 1684689

URL: http://svn.apache.org/r1684689
Log:
WKT: merged minor bug fixes from the JDK7 branch.

Added:
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
      - copied, changed from r1684688, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/CharEncoding.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 10 14:56:57 2015
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK7:1394913-1684479
-/sis/branches/JDK8:1584960-1684478
+/sis/branches/JDK7:1394913-1684688
+/sis/branches/JDK8:1584960-1684685
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/CharEncoding.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/CharEncoding.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/CharEncoding.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/CharEncoding.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -111,7 +111,7 @@ public abstract class CharEncoding imple
         if (a != null && !a.isEmpty() && a.length() <= 2) {
             switch (a.charAt(0)) {
                 /*
-                 * ISO 19162 §7.5.3 recommendations:
+                 * ISO 19162:2015 §7.5.3 recommendations:
                  *
                  *   a) For PolarCS using Greek letter θ for direction, the letter ‘U’ should be used in WKT.
                  *   b) For SphericalCS using φ and θ, the letter ‘U’ and ‘V’ respectively should be used in WKT.
@@ -122,7 +122,7 @@ public abstract class CharEncoding imple
                     break;
                 }
                 /*
-                 * ISO 19162 §7.5.3 requirement (ii) and recommendation (b):
+                 * ISO 19162:2015 §7.5.3 requirement (ii) and recommendation (b):
                  *
                  *  ii) Greek letters φ and λ for geodetic latitude and longitude must be replaced by Latin char.
                  *   b) For SphericalCS using φ and θ, the letter ‘U’ and ‘V’ respectively should be used in WKT.

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -65,6 +65,7 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Citations;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.simple.SimpleExtent;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.metadata.ReferencingServices;
@@ -218,7 +219,7 @@ public class Formatter implements Locali
     /**
      * The object to use for formatting unit symbols.
      */
-    private final UnitFormat unitFormat;
+    private final PatchedUnitFormat unitFormat;
 
     /**
      * Dummy field position.
@@ -337,7 +338,7 @@ public class Formatter implements Locali
         this.indentation   = (byte) indentation;
         this.numberFormat  = symbols.createNumberFormat();
         this.dateFormat    = new SimpleDateFormat(WKTFormat.DATE_PATTERN + "'Z'", symbols.getLocale());
-        this.unitFormat    = UnitFormat.getInstance(symbols.getLocale());
+        this.unitFormat    = new PatchedUnitFormat(UnitFormat.getInstance(symbols.getLocale()));
         this.buffer        = new StringBuffer();
         dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
     }
@@ -357,7 +358,7 @@ public class Formatter implements Locali
         this.indentation   = WKTFormat.DEFAULT_INDENTATION;
         this.numberFormat  = numberFormat; // No clone needed.
         this.dateFormat    = dateFormat;   // No clone needed.
-        this.unitFormat    = unitFormat;   // No clone needed.
+        this.unitFormat    = new PatchedUnitFormat(unitFormat);
         // Do not set the buffer. It will be set by WKTFormat.format(…).
     }
 

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -22,6 +22,8 @@ import java.util.Locale;
 import java.util.HashMap;
 import java.util.ArrayList;
 import java.util.Date;
+import java.text.DateFormat;
+import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.text.ParseException;
 import javax.measure.unit.Unit;
@@ -156,7 +158,7 @@ final class GeodeticObjectParser extends
      * Creates a parser using the default set of symbols and factories.
      */
     public GeodeticObjectParser() {
-        this(Symbols.getDefault(), Convention.DEFAULT, false, null, null);
+        this(Symbols.getDefault(), null, null, Convention.DEFAULT, false, null, null);
     }
 
     /**
@@ -176,7 +178,7 @@ final class GeodeticObjectParser extends
     public GeodeticObjectParser(final Map<String,?> defaultProperties,
             final ObjectFactory factories, final MathTransformFactory mtFactory)
     {
-        super(Symbols.getDefault(), mtFactory, (Locale) defaultProperties.get(Errors.LOCALE_KEY));
+        super(Symbols.getDefault(), null, null, mtFactory, (Locale) defaultProperties.get(Errors.LOCALE_KEY));
         crsFactory    = (CRSFactory)   factories;
         csFactory     = (CSFactory)    factories;
         datumFactory  = (DatumFactory) factories;
@@ -188,17 +190,21 @@ final class GeodeticObjectParser extends
 
     /**
      * Constructs a parser for the specified set of symbols using the specified set of factories.
+     * This constructor is for {@link WKTFormat} usage only.
      *
      * @param symbols       The set of symbols to use.
+     * @param numberFormat  The number format provided by {@link WKTFormat}, or {@code null} for a default format.
+     * @param dateFormat    The date format provided by {@link WKTFormat}, or {@code null} for a default format.
      * @param convention    The WKT convention to use.
      * @param isAxisIgnored {@code true} if {@code AXIS} elements should be ignored.
      * @param errorLocale   The locale for error messages (not for parsing), or {@code null} for the system default.
      * @param factories     On input, the factories to use. On output, the factories used. Can be null.
      */
-    GeodeticObjectParser(final Symbols symbols, final Convention convention, final boolean isAxisIgnored,
-            final Locale errorLocale, final Map<Class<?>,Factory> factories)
+    GeodeticObjectParser(final Symbols symbols, final NumberFormat numberFormat, final DateFormat dateFormat,
+            final Convention convention, final boolean isAxisIgnored, final Locale errorLocale,
+            final Map<Class<?>,Factory> factories)
     {
-        super(symbols, getFactory(MathTransformFactory.class, factories), errorLocale);
+        super(symbols, numberFormat, dateFormat, getFactory(MathTransformFactory.class, factories), errorLocale);
         crsFactory   = getFactory(CRSFactory.class,   factories);
         csFactory    = getFactory(CSFactory.class,    factories);
         datumFactory = getFactory(DatumFactory.class, factories);
@@ -411,8 +417,8 @@ final class GeodeticObjectParser extends
         String name = CharSequences.trimWhitespaces(element.pullString("name"));
         if (isGeographic) {
             /*
-             * The longitude and latitude axis names are explicitly fixed by ISO 19111 to "Geodetic longitude"
-             * and "Geodetic latitude". But ISO 19162 §7.5.3(ii) said that the "Geodetic" part in those names
+             * The longitude and latitude axis names are explicitly fixed by ISO 19111:2007 to "Geodetic longitude"
+             * and "Geodetic latitude". But ISO 19162:2015 §7.5.3(ii) said that the "Geodetic" part in those names
              * shall be omitted at WKT formatting time. SIS's DefaultCoordinateSystemAxis.formatTo(Formatter)
              * method performs this removal, so we apply the reverse operation here.
              */

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/MathTransformParser.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -17,6 +17,8 @@
 package org.apache.sis.io.wkt;
 
 import java.util.Locale;
+import java.text.DateFormat;
+import java.text.NumberFormat;
 import java.text.ParseException;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Angle;
@@ -92,18 +94,22 @@ class MathTransformParser extends Parser
      * @param mtFactory The factory to use to create {@link MathTransform} objects.
      */
     public MathTransformParser(final MathTransformFactory mtFactory) {
-        this(Symbols.getDefault(), mtFactory, null);
+        this(Symbols.getDefault(), null, null, mtFactory, null);
     }
 
     /**
      * Creates a parser using the specified set of symbols and factory.
      *
-     * @param symbols     The set of symbols to use.
-     * @param mtFactory   The factory to use to create {@link MathTransform} objects.
-     * @param errorLocale The locale for error messages (not for parsing), or {@code null} for the system default.
-     */
-    public MathTransformParser(final Symbols symbols, final MathTransformFactory mtFactory, final Locale errorLocale) {
-        super(symbols, errorLocale);
+     * @param symbols       The set of symbols to use.
+     * @param numberFormat  The number format provided by {@link WKTFormat}, or {@code null} for a default format.
+     * @param dateFormat    The date format provided by {@link WKTFormat}, or {@code null} for a default format.
+     * @param mtFactory     The factory to use to create {@link MathTransform} objects.
+     * @param errorLocale   The locale for error messages (not for parsing), or {@code null} for the system default.
+     */
+    MathTransformParser(final Symbols symbols, final NumberFormat numberFormat, final DateFormat dateFormat,
+            final MathTransformFactory mtFactory, final Locale errorLocale)
+    {
+        super(symbols, numberFormat, dateFormat, errorLocale);
         this.mtFactory = mtFactory;
         ensureNonNull("mtFactory", mtFactory);
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Parser.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -100,14 +100,20 @@ abstract class Parser implements WKTPars
     /**
      * Constructs a parser using the specified set of symbols.
      *
-     * @param symbols     The set of symbols to use.
-     * @param errorLocale The locale for error messages (not for parsing), or {@code null} for the system default.
+     * @param symbols       The set of symbols to use.
+     * @param numberFormat  The number format provided by {@link WKTFormat}, or {@code null} for a default format.
+     * @param dateFormat    The date format provided by {@link WKTFormat}, or {@code null} for a default format.
+     * @param errorLocale   The locale for error messages (not for parsing), or {@code null} for the system default.
      */
-    Parser(final Symbols symbols, final Locale errorLocale) {
-        this.errorLocale = errorLocale;
+    Parser(final Symbols symbols, NumberFormat numberFormat, final DateFormat dateFormat, final Locale errorLocale) {
         ensureNonNull("symbols", symbols);
-        this.symbols = symbols;
-        numberFormat = symbols.createNumberFormat();
+        if (numberFormat == null) {
+            numberFormat = symbols.createNumberFormat();
+        }
+        this.symbols      = symbols;
+        this.numberFormat = numberFormat;
+        this.dateFormat   = dateFormat;
+        this.errorLocale  = errorLocale;
         if (SCIENTIFIC_NOTATION && numberFormat instanceof DecimalFormat) {
             final DecimalFormat decimalFormat = (DecimalFormat) numberFormat;
             exponentSymbol = decimalFormat.getDecimalFormatSymbols().getExponentSeparator();

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -486,7 +486,10 @@ public class WKTFormat extends CompoundF
             if (factories == null) {
                 factories = new HashMap<Class<?>,Factory>();
             }
-            parser = new GeodeticObjectParser(symbols, convention, false, getLocale(), factories);
+            parser = new GeodeticObjectParser(symbols,
+                    (NumberFormat) getFormat(Number.class),
+                    (DateFormat)   getFormat(Date.class),
+                    convention, false, getLocale(), factories);
         }
         return parser.parseObject(text.toString(), pos);
     }

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ElementTest.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -40,7 +40,7 @@ public final strictfp class ElementTest
     /**
      * A dummy parser to be given to the {@link Element} constructor.
      */
-    private final Parser parser = new Parser(Symbols.SQUARE_BRACKETS, Locale.ENGLISH) {
+    private final Parser parser = new Parser(Symbols.SQUARE_BRACKETS, null, null, Locale.ENGLISH) {
         @Override Object parseObject(Element element) throws ParseException {
             throw new UnsupportedOperationException();
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -20,7 +20,7 @@ import javax.measure.unit.Unit;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.iso.Types;
@@ -611,7 +611,7 @@ public final class AxisDirections extend
         for (final CoordinateSystemAxis axis : axes) {
             buffer.append(separator).append(Types.getCodeLabel(axis.getDirection()));
             separator = ", ";
-            final String symbol = Utilities.toString(axis.getUnit());
+            final String symbol = PatchedUnitFormat.toString(axis.getUnit());
             if (symbol != null && !symbol.isEmpty()) {
                 buffer.append(" (").append(symbol).append(')');
             }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Legacy.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -17,12 +17,15 @@
 package org.apache.sis.internal.referencing;
 
 import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CartesianCS;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.cs.AxisFilter;
+import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.cs.DefaultCartesianCS;
 import org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis;
-import org.apache.sis.util.Static;
 
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
@@ -32,12 +35,15 @@ import static org.opengis.referencing.Id
  * Utilities related to version 1 of Well Known Text format.
  * Defined in a separated classes for reducing classes loading when not necessary.
  *
+ * <p>This class implements the {@link AxisFilter} interface for opportunistic reasons.
+ * Callers should ignore this implementation detail.</p>
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
-public final class Legacy extends Static {
+public final class Legacy implements AxisFilter {
     /**
      * A three-dimensional Cartesian CS with the legacy set of geocentric axes.
      * OGC 01-009 defines the default geocentric axes as:
@@ -56,16 +62,13 @@ public final class Legacy extends Static
             new DefaultCoordinateSystemAxis(singletonMap(NAME_KEY, "Z"), "Z", AxisDirection.NORTH, SI.METRE));
 
     /**
-     * Do not allow instantiation of this class.
-     */
-    private Legacy() {
-    }
-
-    /**
      * The standard three-dimensional Cartesian CS as defined by ISO 19111.
+     *
+     * @param  unit The linear unit of the desired coordinate system, or {@code null} for metres.
+     * @return The ISO 19111 coordinate system.
      */
-    private static CartesianCS standard() {
-        return (CartesianCS) CommonCRS.WGS84.geocentric().getCoordinateSystem();
+    public static CartesianCS standard(final Unit<?> unit) {
+        return replaceUnit((CartesianCS) CommonCRS.WGS84.geocentric().getCoordinateSystem(), unit);
     }
 
     /**
@@ -79,7 +82,7 @@ public final class Legacy extends Static
      *         or {@code cs} if the CS axes should be used as-is.
      */
     public static CartesianCS forGeocentricCRS(final CartesianCS cs, final boolean toLegacy) {
-        final CartesianCS check = toLegacy ? standard() : LEGACY;
+        final CartesianCS check = toLegacy ? standard(null) : LEGACY;
         final int dimension = check.getDimension();
         if (cs.getDimension() != dimension) {
             return cs;
@@ -89,6 +92,63 @@ public final class Legacy extends Static
                 return cs;
             }
         }
-        return toLegacy ? LEGACY : standard();
+        final Unit<?> unit = ReferencingUtilities.getUnit(cs);
+        return toLegacy ? replaceUnit(LEGACY, unit) : standard(unit);
+    }
+
+    /**
+     * Returns the coordinate system of a geocentric CRS using axes in the given unit of measurement.
+     * This method presume that the given {@code cs} uses {@link SI#METRE} (this is not verified).
+     *
+     * @param  cs The coordinate system for which to perform the unit replacement.
+     * @param  unit The unit of measurement for the geocentric CRS axes.
+     * @return The coordinate system for a geocentric CRS with axes using the given unit of measurement.
+     *
+     * @since 0.6
+     */
+    public static CartesianCS replaceUnit(CartesianCS cs, final Unit<?> unit) {
+        if (unit != null && !unit.equals(SI.METRE)) {
+            cs = (CartesianCS) CoordinateSystems.replaceAxes(cs, new Legacy(unit));
+        }
+        return cs;
+    }
+
+    /**
+     * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
+     */
+    private Legacy(final Unit<?> unit) {
+        this.unit = unit;
+    }
+
+    /**
+     * The value to be returned by {@link #getUnitReplacement(Unit)}.
+     */
+    private final Unit<?> unit;
+
+    /**
+     * For internal usage by {@link #replaceUnit(CartesianCS, Unit)} only.
+     *
+     * @param  unit ignored.
+     * @return The unit of the new coordinate system.
+     */
+    @Override
+    public Unit<?> getUnitReplacement(final Unit<?> unit) {
+        return this.unit;
+    }
+
+    /**
+     * Returns the given axis unchanged.
+     */
+    @Override
+    public boolean accept(final CoordinateSystemAxis axis) {
+        return true;
+    }
+
+    /**
+     * Returns the given direction unchanged.
+     */
+    @Override
+    public AxisDirection getDirectionReplacement(final AxisDirection direction) {
+        return direction;
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -20,7 +20,6 @@ import java.util.Map;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
-import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Length;
 
@@ -34,7 +33,6 @@ import org.opengis.referencing.crs.Tempo
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
@@ -58,8 +56,6 @@ import org.apache.sis.referencing.Common
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.cs.AbstractCS;
-import org.apache.sis.referencing.cs.AxisFilter;
-import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.crs.DefaultDerivedCRS;
 import org.apache.sis.referencing.crs.DefaultTemporalCRS;
 import org.apache.sis.referencing.datum.BursaWolfParameters;
@@ -471,23 +467,7 @@ public final class ServicesForMetadata e
      */
     @Override
     public CartesianCS getGeocentricCS(final Unit<Length> linearUnit) {
-        CartesianCS cs = (CartesianCS) CommonCRS.WGS84.geocentric().getCoordinateSystem();
-        if (!SI.METRE.equals(linearUnit)) {
-            cs = (CartesianCS) CoordinateSystems.replaceAxes(cs, new AxisFilter() {
-                @Override public boolean accept(final CoordinateSystemAxis axis) {
-                    return true;
-                }
-
-                @Override public Unit<?> getUnitReplacement(final Unit<?> unit) {
-                    return linearUnit;
-                }
-
-                @Override public AxisDirection getDirectionReplacement(final AxisDirection direction) {
-                    return direction;
-                }
-            });
-        }
-        return cs;
+        return Legacy.standard(linearUnit);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -802,7 +802,7 @@ public class DefaultCoordinateSystemAxis
             }
             if (name != null && !isInternal) {
                 if (name.equalsIgnoreCase(AxisNames.GEODETIC_LATITUDE)) {
-                    name = AxisNames.LATITUDE;    // ISO 19162 §7.5.3(ii)
+                    name = AxisNames.LATITUDE;    // ISO 19162:2015 §7.5.3(ii)
                 } else if (name.equalsIgnoreCase(AxisNames.GEODETIC_LONGITUDE)) {
                     name = AxisNames.LONGITUDE;
                 }
@@ -811,7 +811,7 @@ public class DefaultCoordinateSystemAxis
             }
         }
         /*
-         * ISO 19162 §7.5.3 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
+         * ISO 19162:2015 §7.5.3 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
          * The specification also suggests to write only the abbreviation (e.g. "(X)") in the
          * special case of Geocentric axis, and disallows Greek letters.
          */

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -37,7 +37,7 @@ import org.apache.sis.io.wkt.Formatter;
  * This class does not know whether the meridian is relative to Greenwich or any other reference meridian.
  * The reference meridian shall be inferred from the geodetic datum of the {@code GeographicCRS} instance
  * that contains (through its coordinate system) the axes having those directions. This is consistent with
- * ISO 19162 §7.5.4(iv) - WKT 2 formatting.
+ * ISO 19162:2015 §7.5.4(iv) - WKT 2 formatting.
  *
  * <div class="section">Immutability and thread safety</div>
  * This final class is immutable and thus inherently thread-safe.

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -53,7 +53,6 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
-import org.apache.sis.parameter.Parameters;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
@@ -677,7 +676,7 @@ public class DefaultMathTransformFactory
      * @see #getLastMethodUsed()
      */
     @Override
-    public MathTransform createParameterizedTransform(ParameterValueGroup parameters)
+    public MathTransform createParameterizedTransform(final ParameterValueGroup parameters)
             throws NoSuchIdentifierException, FactoryException
     {
         final String methodName = parameters.getDescriptor().getName().getCode();
@@ -688,26 +687,8 @@ public class DefaultMathTransformFactory
                 throw new NoSuchIdentifierException(Errors.format( // For now, handle like an unknown operation.
                         Errors.Keys.UnsupportedImplementation_1, Classes.getClass(method)), methodName);
             }
-            /*
-             * If the "official" parameter descriptor was used, that descriptor should have already
-             * enforced argument validity. Consequently, there is no need to performs the check and
-             * we will avoid it as a performance enhancement.
-             */
-            final ParameterDescriptorGroup expected = method.getParameters();
-            final boolean isConform = expected.equals(parameters.getDescriptor());
             MathTransform transform;
             try {
-                if (!isConform) {
-                    /*
-                     * Copies all values from the user-supplied group to the provider-supplied group.
-                     * The later should perform all needed checks. It is supplier's responsibility to
-                     * know about alias (e.g. OGC, EPSG, ESRI),  since the caller probably used names
-                     * from only one authority.
-                     */
-                    final ParameterValueGroup copy = expected.createValue();
-                    Parameters.copy(parameters, copy);
-                    parameters = copy;
-                }
                 transform  = ((MathTransformProvider) method).createMathTransform(this, parameters);
             } catch (IllegalArgumentException exception) {
                 /*

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -52,7 +52,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.6
  * @module
  *
  * @see MathTransformFactory
@@ -147,6 +147,52 @@ public final class MathTransforms extend
     }
 
     /**
+     * Puts together a list of independent math transforms, each of them operating on a subset of ordinate values.
+     * This method is often used for defining 4-dimensional (<var>x</var>,<var>y</var>,<var>z</var>,<var>t</var>)
+     * transform as an aggregation of 3 simpler transforms operating on (<var>x</var>,<var>y</var>), (<var>z</var>)
+     * and (<var>t</var>) values respectively.
+     *
+     * <p>Invariants:</p>
+     * <ul>
+     *   <li>The {@linkplain AbstractMathTransform#getSourceDimensions() source dimensions} of the returned transform
+     *       is equals to the sum of the source dimensions of all given transforms.</li>
+     *   <li>The {@linkplain AbstractMathTransform#getTargetDimensions() target dimensions} of the returned transform
+     *       is equals to the sum of the target dimensions of all given transforms.</li>
+     * </ul>
+     *
+     * @param  transforms The transforms to aggregate in a single transform, in the given order.
+     * @return The aggregation of all given transforms, or {@code null} if the given {@code transforms} array was empty.
+     *
+     * @see PassThroughTransform
+     * @see org.apache.sis.referencing.crs.DefaultCompoundCRS
+     *
+     * @since 0.6
+     */
+    public static MathTransform compound(final MathTransform... transforms) {
+        ensureNonNull("transforms", transforms);
+        int sum = 0;
+        final int[] dimensions = new int[transforms.length];
+        for (int i=0; i<transforms.length; i++) {
+            final MathTransform tr = transforms[i];
+            ensureNonNullElement("transforms", i, tr);
+            sum += (dimensions[i] = tr.getSourceDimensions());
+        }
+        MathTransform compound = null;
+        int firstAffectedOrdinate = 0;
+        for (int i=0; i<transforms.length; i++) {
+            MathTransform tr = transforms[i];
+            tr = PassThroughTransform.create(firstAffectedOrdinate, tr, sum - (firstAffectedOrdinate += dimensions[i]));
+            if (compound == null) {
+                compound = tr;
+            } else {
+                compound = ConcatenatedTransform.create(compound, tr);
+            }
+        }
+        assert isValid(getSteps(compound)) : compound;
+        return compound;
+    }
+
+    /**
      * Concatenates the two given transforms. The returned transform will implement
      * {@link MathTransform1D} or {@link MathTransform2D} if the dimensions of the
      * concatenated transform are equal to 1 or 2 respectively.

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -61,6 +61,8 @@ import static org.apache.sis.util.Argume
  * @since   0.5
  * @version 0.5
  * @module
+ *
+ * @see MathTransforms#compound(MathTransform...)
  */
 public class PassThroughTransform extends AbstractMathTransform implements Serializable {
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/CoordinateOperationMethodsHTML.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -34,7 +34,7 @@ import org.opengis.referencing.crs.Coord
 import org.opengis.referencing.crs.GeneralDerivedCRS;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.Constants;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
@@ -481,7 +481,7 @@ public final class CoordinateOperationMe
      * or an empty string (never {@code null}) if none.
      */
     private static String getUnit(final ParameterDescriptor<?> param) {
-        final String unit = Utilities.toString(param.getUnit());
+        final String unit = PatchedUnitFormat.toString(param.getUnit());
         if (unit != null && !unit.isEmpty()) {
             return " " + unit;
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -31,6 +31,8 @@ import org.opengis.referencing.datum.*;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.internal.metadata.AxisNames;
+import org.apache.sis.referencing.datum.BursaWolfParameters;
+import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -85,7 +87,7 @@ public final strictfp class GeodeticObje
      */
     private void setConvention(final Convention convention, final boolean isAxisIgnored) {
         final GeodeticObjectParser p = parser;
-        parser = new GeodeticObjectParser(p.symbols, convention, isAxisIgnored, p.errorLocale, null);
+        parser = new GeodeticObjectParser(p.symbols, null, null, convention, isAxisIgnored, p.errorLocale, null);
     }
 
     /**
@@ -322,7 +324,7 @@ public final strictfp class GeodeticObje
 
         GeographicCRS crs = parse(GeographicCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris)", 0, crs);
-        PrimeMeridian pm = verifyNTF(crs.getDatum());
+        PrimeMeridian pm = verifyNTF(crs.getDatum(), false);
         assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.5969213, pm.getGreenwichLongitude(), STRICT);
         EllipsoidalCS cs = crs.getCoordinateSystem();
@@ -344,7 +346,7 @@ public final strictfp class GeodeticObje
         setConvention(Convention.WKT1_COMMON_UNITS, true);
         crs = parse(GeographicCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris)", 0, crs);
-        pm = verifyNTF(crs.getDatum());
+        pm = verifyNTF(crs.getDatum(), false);
         assertEquals("angularUnit", NonSI.DEGREE_ANGLE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(), STRICT);
         cs = crs.getCoordinateSystem();
@@ -379,7 +381,7 @@ public final strictfp class GeodeticObje
         ProjectedCRS crs = parse(ProjectedCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
         verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
-        PrimeMeridian pm = verifyNTF(crs.getDatum());
+        PrimeMeridian pm = verifyNTF(crs.getDatum(), true);
         assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.5969213, pm.getGreenwichLongitude(), STRICT);
         ParameterValue<?> param = verifyNTF(crs.getConversionFromBase().getParameterValues());
@@ -399,7 +401,7 @@ public final strictfp class GeodeticObje
         crs = parse(ProjectedCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
         verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
-        pm = verifyNTF(crs.getDatum());
+        pm = verifyNTF(crs.getDatum(), true);
         assertEquals("angularUnit", NonSI.DEGREE_ANGLE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(), STRICT);
         param = verifyNTF(crs.getConversionFromBase().getParameterValues());
@@ -412,11 +414,19 @@ public final strictfp class GeodeticObje
      * This is used by the methods in this class which test a CRS using less frequently used units and prime
      * meridian.
      *
+     * @param  datum The datum to verify.
+     * @param  hasToWGS84 Whether the datum is expected to have a {@code TOWGS84[…]} element.
      * @return The prime meridian, to be verified by the caller because the unit of measurement depends on the test.
      */
-    private static PrimeMeridian verifyNTF(final GeodeticDatum datum) {
+    private static PrimeMeridian verifyNTF(final GeodeticDatum datum, final boolean hasToWGS84) {
         assertNameAndIdentifierEqual("Nouvelle Triangulation Française (Paris)", 0, datum);
 
+        final BursaWolfParameters[] bwp = ((DefaultGeodeticDatum) datum).getBursaWolfParameters();
+        assertEquals("BursaWolfParameters", hasToWGS84 ? 1 : 0, bwp.length);
+        if (hasToWGS84) {
+            assertArrayEquals("BursaWolfParameters", new double[] {-168, -60, 320}, bwp[0].getValues(), STRICT);
+        }
+
         final Ellipsoid ellipsoid = datum.getEllipsoid();
         assertNameAndIdentifierEqual("Clarke 1880 (IGN)", 0, ellipsoid);
         assertEquals("semiMajor", 6378249.2, ellipsoid.getSemiMajorAxis(), STRICT);
@@ -566,7 +576,7 @@ public final strictfp class GeodeticObje
         final ProjectedCRS crs = parse(ProjectedCRS.class,
                 "PROJCS[“FRANCE/NTF/Lambert III”," +
                 "GEOGCS[“”," + // Missing name (the purpose of this test).
-                "DATUM[“NTF=GR3DF97A”,TOWGS84[-168, -60, 320, 0, 0, 0, 0] ," + // Intentionally misplaced coma.
+                "DATUM[“NTF=GR3DF97A”,TOWGS84[-168, -60, 320] ," + // Intentionally misplaced coma.
                 "SPHEROID[“Clarke 1880 (IGN)”,6378249.2,293.4660212936269]]," +
                 "PRIMEM[“Greenwich”,0],UNIT[“Degrees”,0.0174532925199433]," +
                 "AXIS[“Long”,East],AXIS[“Lat”,North]]," +
@@ -587,6 +597,8 @@ public final strictfp class GeodeticObje
         final GeodeticDatum datum = geoCRS.getDatum();
         assertNameAndIdentifierEqual("NTF=GR3DF97A", 0, datum);
         assertNameAndIdentifierEqual("Greenwich", 0, datum.getPrimeMeridian());
+        assertArrayEquals("BursaWolfParameters", new double[] {-168, -60, 320},
+                ((DefaultGeodeticDatum) datum).getBursaWolfParameters()[0].getValues(), STRICT);
 
         final Ellipsoid ellipsoid = datum.getEllipsoid();
         assertNameAndIdentifierEqual("Clarke 1880 (IGN)", 0, ellipsoid);

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -16,7 +16,11 @@
  */
 package org.apache.sis.referencing.crs;
 
+import javax.measure.unit.SI;
+import org.opengis.referencing.cs.CartesianCS;
 import org.apache.sis.io.wkt.Convention;
+import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.internal.referencing.Legacy;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -30,7 +34,7 @@ import static org.apache.sis.test.Metada
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn({
@@ -57,6 +61,30 @@ public final strictfp class DefaultGeoce
     }
 
     /**
+     * Tests WKT 1 formatting using axes in kilometres. The intend of this test is to verify that
+     * the coordinate system replacement documented in {@link #testWKT1()} preserves the axis units.
+     *
+     * @since 0.6
+     */
+    @Test
+    @DependsOnMethod("testWKT1")
+    public void testWKT1_kilometres() {
+        DefaultGeocentricCRS crs = HardCodedCRS.GEOCENTRIC;
+        crs = new DefaultGeocentricCRS(IdentifiedObjects.getProperties(crs), crs.getDatum(),
+                Legacy.replaceUnit((CartesianCS) crs.getCoordinateSystem(), SI.KILOMETRE));
+        assertWktEquals(Convention.WKT1,
+                "GEOCCS[“Geocentric”,\n" +
+                "  DATUM[“World Geodetic System 1984”,\n" +
+                "    SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
+                "    PRIMEM[“Greenwich”, 0.0],\n" +
+                "  UNIT[“km”, 1000],\n" +
+                "  AXIS[“X”, OTHER],\n" +
+                "  AXIS[“Y”, EAST],\n" +
+                "  AXIS[“Z”, NORTH]]",
+                crs);
+    }
+
+    /**
      * Tests WKT 2 formatting.
      *
      * <div class="section">Note on axis names</div>

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformsTest.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -18,6 +18,9 @@ package org.apache.sis.referencing.opera
 
 import java.util.List;
 import org.opengis.referencing.operation.MathTransform;
+import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.referencing.operation.matrix.Matrix2;
+import org.apache.sis.referencing.operation.matrix.Matrix3;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -30,7 +33,7 @@ import static org.opengis.test.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final strictfp class MathTransformsTest extends TestCase {
@@ -86,4 +89,35 @@ public final strictfp class MathTransfor
         assertMatrixEquals("Step 3", swap,  MathTransforms.getMatrix(steps.get(2)), STRICT);
         assertInstanceOf  ("Step 2", PassThroughTransform.class, steps.get(1));
     }
+
+    /**
+     * Tests {@link MathTransforms#compound(MathTransform...)}.
+     * This test uses linear transforms because they are easy to test, but the
+     * {@code MathTransforms.compound(…)} method should work with any transforms.
+     */
+    @Test
+    public void testCompound() {
+        final MathTransform t1 = MathTransforms.linear(new Matrix2(
+            3, -1,   // Random numbers (no real meaning)
+            0,  1));
+        final MathTransform t2 = MathTransforms.linear(new Matrix4(
+            0,  8,  0,  9,
+            5,  0,  0, -7,
+            0,  0,  2,  0,
+            0,  0,  0,  1));
+        final MathTransform t3 = MathTransforms.linear(new Matrix3(
+            0, -5, -3,
+            7,  0, -9,
+            0,  0,  1));
+        final MathTransform r = MathTransforms.compound(t1, t2, t3);
+        assertMatrixEquals("compound", Matrices.create(7, 7, new double[] {
+            3,  0,  0,  0,  0,  0, -1,
+            0,  0,  8,  0,  0,  0,  9,
+            0,  5,  0,  0,  0,  0, -7,
+            0,  0,  0,  2,  0,  0,  0,
+            0,  0,  0,  0,  0, -5, -3,
+            0,  0,  0,  0,  7,  0, -9,
+            0,  0,  0,  0,  0,  0,  1
+        }), MathTransforms.getMatrix(r), STRICT);
+    }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.gco
 import javax.measure.unit.Unit;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.apache.sis.internal.jaxb.Context;
-import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 
 
 /**
@@ -55,7 +55,7 @@ public class UnitAdapter extends XmlAdap
      */
     @Override
     public String marshal(final Unit<?> value) {
-        return Utilities.toString(value);
+        return PatchedUnitFormat.toString(value);
     }
 
     /**

Copied: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java (from r1684688, sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java?p2=sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java&p1=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java&r1=1684688&r2=1684689&rev=1684689&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -59,7 +59,7 @@ public final class PatchedUnitFormat ext
      * @param entries The (unit, symbol) pairs.
      */
     public static void init(final Object... entries) {
-        final Map<Unit<?>,String> symbols = new HashMap<>(8);
+        final Map<Unit<?>,String> symbols = new HashMap<Unit<?>,String>(8);
         for (int i=0; i<entries.length; i++) {
             final String uom;
             if (symbols.put((Unit<?>) entries[i], uom = (String) entries[++i]) != null) {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -18,11 +18,9 @@ package org.apache.sis.internal.util;
 
 import java.util.Formatter;
 import java.util.FormattableFlags;
-import javax.measure.unit.Unit;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.Workaround;
 
 
 /**
@@ -41,31 +39,6 @@ public final class Utilities extends Sta
     }
 
     /**
-     * Returns the string representation of the given unit, or {@code null} if none.
-     * This method is used as a workaround for a bug in JSR-275, which sometime throws
-     * an exception in the {@link Unit#toString()} method.
-     *
-     * @param  unit The unit for which to get a string representation, or {@code null}.
-     * @return The string representation of the given string (may be an empty string), or {@code null}.
-     *
-     * @since 0.6
-     */
-    @Workaround(library="JSR-275", version="0.9.3")
-    public static String toString(final Unit<?> unit) {
-        if (unit != null) try {
-            String text = unit.toString();
-            if (text.equals("deg")) {
-                text = "°";
-            }
-            return text;
-        } catch (IllegalArgumentException e) {
-            // Workaround for JSR-275 implementation bug.
-            // Do nothing, we will return null below.
-        }
-        return null;
-    }
-
-    /**
      * Appends to the given buffer only the characters that are valid for a Unicode identifier.
      * The given separator character is append before the given {@code text} only if the buffer
      * is not empty and at least one {@code text} character is valid.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -24,6 +24,7 @@ import javax.measure.quantity.Angle;
 import javax.measure.converter.UnitConverter;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 
 import static org.apache.sis.math.MathFunctions.truncate;
 
@@ -43,7 +44,7 @@ import static org.apache.sis.math.MathFu
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.6
  * @module
  */
 class SexagesimalConverter extends UnitConverter { // Intentionally not final.
@@ -115,6 +116,13 @@ class SexagesimalConverter extends UnitC
     static final Unit<Angle> DMS_SCALED = NonSI.DEGREE_ANGLE.transform(
             new SexagesimalConverter(true, 1).inverse()).asType(Angle.class);//.alternate("DMS");
 
+    /*
+     * Declares the units that we were not able to declare in calls to Unit.alternate(String).
+     */
+    static {
+        PatchedUnitFormat.init(DM, "D.M", DMS, "D.MS", DMS_SCALED, "DMS");
+    }
+
     /**
      * {@code true} if the seconds field is present.
      */

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java?rev=1684689&r1=1684688&r2=1684689&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java [UTF-8] Wed Jun 10 14:56:57 2015
@@ -19,6 +19,7 @@ package org.apache.sis.measure;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Quantity;
 import javax.measure.converter.UnitConverter;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -32,7 +33,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final strictfp class SexagesimalConverterTest extends TestCase {
@@ -92,4 +93,15 @@ public final strictfp class SexagesimalC
         checkConversion(10.99,              DEGREE_ANGLE, 105924,     DMS_SCALED);
         checkConversion(44.505590277777777, DEGREE_ANGLE, 443020.125, DMS_SCALED);
     }
+
+    /**
+     * Tests {@link PatchedUnitFormat#toString(Unit)}.
+     * Tested here because it can be tested only after {@link SexagesimalConverter} initialization.
+     */
+    @Test
+    public void testPatchedUnitFormat() {
+        assertEquals("D.M",  PatchedUnitFormat.toString(DM));
+        assertEquals("D.MS", PatchedUnitFormat.toString(DMS));
+        assertEquals("DMS",  PatchedUnitFormat.toString(DMS_SCALED));
+    }
 }



Mime
View raw message