sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683756 [4/6] - in /sis/branches/JDK7: ./ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metad...
Date Fri, 05 Jun 2015 13:53:59 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -223,11 +223,15 @@ public class DefaultAffineCS extends Abs
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      * This method shall be overridden by all {@code AffineCS} subclasses in this package.
      */
     @Override
-    AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultAffineCS(properties, axes);
+    AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: // Fall through
+            case 3: return new DefaultAffineCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -78,7 +78,7 @@ public class DefaultCartesianCS extends
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultCartesianCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -232,10 +232,14 @@ public class DefaultCartesianCS extends
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultCartesianCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: // Fall through
+            case 3: return new DefaultCartesianCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -20,11 +20,10 @@ import java.util.Map;
 import java.util.List;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.internal.referencing.AxisDirections;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
-import org.apache.sis.internal.util.Utilities;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Workaround;
-import org.apache.sis.util.iso.Types;
 
 import static java.util.Collections.singletonMap;
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -52,7 +51,7 @@ import static org.apache.sis.util.Utilit
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public class DefaultCompoundCS extends AbstractCS {
@@ -127,38 +126,11 @@ public class DefaultCompoundCS extends A
      */
     @Workaround(library="JDK", version="1.7")
     private DefaultCompoundCS(final CoordinateSystem[] components, final CoordinateSystemAxis[] axes) {
-        super(singletonMap(NAME_KEY, createName(new StringBuilder(60).append("Compound CS"), axes)), axes);
+        super(singletonMap(NAME_KEY, AxisDirections.appendTo(new StringBuilder(60).append("Compound CS"), axes)), axes);
         this.components = UnmodifiableArrayList.wrap(components);
     }
 
     /**
-     * Returns a name for a coordinate system.
-     * Examples:
-     *
-     * <ul>
-     *   <li>Ellipsoidal CS: North (°), East (°).</li>
-     *   <li>Cartesian CS: East (km), North (km).</li>
-     *   <li>Compound CS: East (km), North (km), Up (m).</li>
-     * </ul>
-     *
-     * @param  buffer A buffer filled with the name header.
-     * @param  axes The axes.
-     * @return A name for the given coordinate system type and axes.
-     */
-    static String createName(final StringBuilder buffer, final CoordinateSystemAxis[] axes) {
-        String separator = ": ";
-        for (final CoordinateSystemAxis axis : axes) {
-            buffer.append(separator).append(Types.getCodeLabel(axis.getDirection()));
-            separator = ", ";
-            final String symbol = Utilities.toString(axis.getUnit());
-            if (symbol != null && !symbol.isEmpty()) {
-                buffer.append(" (").append(symbol).append(')');
-            }
-        }
-        return buffer.append('.').toString();
-    }
-
-    /**
      * Returns a clone of the given array, making sure that it contains only non-null elements.
      */
     private static CoordinateSystem[] clone(CoordinateSystem[] components) {
@@ -200,7 +172,7 @@ public class DefaultCompoundCS extends A
     }
 
     /*
-     * Do not override createSameType(…) and forConvention(…) because we can not create a new DefaultCompoundCS
+     * Do not override createForAxes(…) and forConvention(…) because we can not create a new DefaultCompoundCS
      * without knownledge of the CoordinateSystem components to give to it. It would be possible to recursively
      * invoke components[i].forConvention(…), but it would be useless to perform such decomposition here because
      * DefaultCompoundCRS will need to perform its own decomposition anyway.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -72,7 +72,7 @@ public class DefaultCylindricalCS extend
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultCylindricalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -203,10 +203,14 @@ public class DefaultCylindricalCS extend
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultCylindricalCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: return new DefaultPolarCS(properties, axes);
+            case 3: return new DefaultCylindricalCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -70,11 +70,12 @@ public class DefaultEllipsoidalCS extend
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultEllipsoidalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
         super(properties, axes);
+        validateAxes(properties);
     }
 
     /**
@@ -121,13 +122,7 @@ public class DefaultEllipsoidalCS extend
                                 final CoordinateSystemAxis axis1)
     {
         super(properties, axis0, axis1);
-        for (int i=0; i<2; i++) {
-            final AxisDirection direction = super.getAxis(i).getDirection();
-            if (AxisDirections.isVertical(direction)) {
-                throw new IllegalArgumentException(Errors.getResources(properties).getString(
-                        Errors.Keys.IllegalAxisDirection_2, "EllipdoicalCS (2D)", direction));
-            }
-        }
+        validateAxes(properties);
     }
 
     /**
@@ -146,6 +141,7 @@ public class DefaultEllipsoidalCS extend
                                 final CoordinateSystemAxis axis2)
     {
         super(properties, axis0, axis1, axis2);
+        validateAxes(properties);
     }
 
     /**
@@ -202,6 +198,23 @@ public class DefaultEllipsoidalCS extend
     }
 
     /**
+     * Validates the set of axes after the validation of each individual axis.
+     *
+     * @param properties The properties given at construction time.
+     */
+    private void validateAxes(final Map<String,?> properties) {
+        int i = super.getDimension();
+        int n = i - 2; // Number of vertical axes allowed.
+        while (--i >= 0) {
+            final AxisDirection direction = super.getAxis(i).getDirection();
+            if (AxisDirections.isVertical(direction) && --n < 0) {
+                throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                        Errors.Keys.IllegalAxisDirection_2, EllipsoidalCS.class, direction));
+            }
+        }
+    }
+
+    /**
      * Returns the GeoAPI interface implemented by this class.
      * The SIS implementation returns {@code EllipsoidalCS.class}.
      *
@@ -228,10 +241,15 @@ public class DefaultEllipsoidalCS extend
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultEllipsoidalCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 1: return new DefaultVerticalCS(properties, axes);
+            case 2: // Fall through
+            case 3: return new DefaultEllipsoidalCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 1);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -71,7 +71,7 @@ public class DefaultLinearCS extends Abs
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultLinearCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -196,10 +196,13 @@ public class DefaultLinearCS extends Abs
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultLinearCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 1: return new DefaultLinearCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 1);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -70,10 +70,10 @@ public class DefaultPolarCS extends Abst
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
-    private DefaultPolarCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+    DefaultPolarCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
         super(properties, axes);
     }
 
@@ -199,10 +199,13 @@ public class DefaultPolarCS extends Abst
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultPolarCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: return new DefaultPolarCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -74,7 +74,7 @@ public class DefaultSphericalCS extends
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultSphericalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -203,10 +203,14 @@ public class DefaultSphericalCS extends
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultSphericalCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: return new DefaultPolarCS(properties, axes);
+            case 3: return new DefaultSphericalCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -73,7 +73,7 @@ public class DefaultTimeCS extends Abstr
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultTimeCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -196,10 +196,13 @@ public class DefaultTimeCS extends Abstr
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultTimeCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 1: return new DefaultTimeCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 1);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -65,7 +65,7 @@ public class DefaultUserDefinedCS extend
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
     private DefaultUserDefinedCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
@@ -193,10 +193,14 @@ public class DefaultUserDefinedCS extend
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultUserDefinedCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 2: // Fall through
+            case 3: return new DefaultUserDefinedCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 2);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -83,10 +83,10 @@ public class DefaultVerticalCS extends A
 
     /**
      * Creates a new coordinate system from an arbitrary number of axes. This constructor is for
-     * implementations of the {@link #createSameType(Map, CoordinateSystemAxis[])} method only,
+     * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only,
      * because it does not verify the number of axes.
      */
-    private DefaultVerticalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+    DefaultVerticalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
         super(properties, axes);
     }
 
@@ -211,10 +211,13 @@ public class DefaultVerticalCS extends A
     }
 
     /**
-     * Returns a coordinate system of the same class than this CS but with different axes.
+     * Returns a coordinate system with different axes.
      */
     @Override
-    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
-        return new DefaultVerticalCS(properties, axes);
+    final AbstractCS createForAxes(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        switch (axes.length) {
+            case 1: return new DefaultVerticalCS(properties, axes);
+            default: throw unexpectedDimension(properties, axes, 1);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -20,8 +20,6 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.Arrays;
 import javax.measure.unit.Unit;
-import javax.measure.unit.SI;
-import javax.measure.unit.NonSI;
 import javax.measure.converter.UnitConverter;
 import javax.measure.converter.ConversionException;
 import org.opengis.referencing.cs.RangeMeaning;
@@ -32,7 +30,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.CharSequences;
-import org.apache.sis.measure.Units;
+import org.apache.sis.util.ArraysExt;
 
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
@@ -127,44 +125,22 @@ final class Normalizer implements Compar
      * Returns a new axis with the same properties (except identifiers) than given axis,
      * but with normalized axis direction and unit of measurement.
      *
-     * @param  axis The axis to normalize.
-     * @param  normalizeUnits {@code true} for normalizing units.
-     * @return An axis using normalized direction unit, or {@code axis} if the given axis already uses the given unit.
+     * @param  axis    The axis to normalize.
+     * @param  changes The change to apply on axis direction and units.
+     * @return An axis using normalized direction and units, or {@code axis} if there is no change.
      */
-    static CoordinateSystemAxis normalize(final CoordinateSystemAxis axis, final boolean normalizeUnits) {
-        /*
-         * Normalize the axis direction. For now we do not touch to inter-cardinal directions (e.g. "North-East")
-         * because it is not clear which normalization policy would match common usage.
-         */
+    static CoordinateSystemAxis normalize(final CoordinateSystemAxis axis, final AxisFilter changes) {
+        final Unit<?>       unit      = axis.getUnit();
         final AxisDirection direction = axis.getDirection();
-        AxisDirection newDir = direction;
-        if (!AxisDirections.isIntercardinal(direction)) {
-            newDir = AxisDirections.absolute(direction);
-        }
-        final boolean sameDirection = newDir.equals(direction);
-        /*
-         * Normalize unit of measurement.
-         */
-        final Unit<?> unit = axis.getUnit(), newUnit;
-        if (normalizeUnits) {
-            if (Units.isLinear(unit)) {
-                newUnit = SI.METRE;
-            } else if (Units.isAngular(unit)) {
-                newUnit = NonSI.DEGREE_ANGLE;
-            } else if (Units.isTemporal(unit)) {
-                newUnit = NonSI.DAY;
-            } else {
-                newUnit = unit;
-            }
-        } else {
-            newUnit = unit;
-        }
+        final Unit<?>       newUnit   = changes.getUnitReplacement(unit);
+        final AxisDirection newDir    = changes.getDirectionReplacement(direction);
         /*
          * Reuse some properties (name, remarks, etc.) from the existing axis. If the direction changed,
          * then the axis name may need change too (e.g. "Westing" → "Easting"). The new axis name may be
          * set to "Unnamed", but the caller will hopefully be able to replace the returned instance by
          * an instance from the EPSG database with appropriate name.
          */
+        final boolean sameDirection = newDir.equals(direction);
         if (sameDirection && newUnit.equals(unit)) {
             return axis;
         }
@@ -208,71 +184,47 @@ final class Normalizer implements Compar
     }
 
     /**
-     * Reorders the axes in an attempt to get a right-handed system.
-     * If no axis change is needed, then this method returns {@code cs} unchanged.
+     * Optionally normalizes and reorders the axes in an attempt to get a right-handed system.
+     * If no axis change is needed, then this method returns {@code null}.
      *
-     * @param  cs The coordinate system to normalize.
-     * @return The normalized coordinate system.
+     * @param  cs      The coordinate system to normalize.
+     * @param  changes The change to apply on axis direction and units.
+     * @param  reorder {@code true} for reordering the axis for a right-handed coordinate system.
+     * @return The normalized coordinate system, or {@code null} if no normalization is needed.
      */
-    static CoordinateSystem normalize(final CoordinateSystem cs) {
-        final CoordinateSystemAxis[] axes = normalizeAxes(cs, true, true);
-        return (axes != null) ? createSameType(AbstractCS.castOrCopy(cs), axes) : cs;
-    }
-
-    /**
-     * Reorders the axes in an attempt to get a right-handed system.
-     * If no axis change is needed, then this method returns {@code cs} unchanged.
-     *
-     * @param  cs The coordinate system to normalize.
-     * @param  normalizeAxes  {@code true} for normalizing axis directions.
-     * @param  normalizeUnits {@code true} for normalizing units (currently ignored if {@code normalizeAxes} is {@code false}).
-     * @return The normalized coordinate system.
-     */
-    static AbstractCS normalize(final AbstractCS cs, final boolean normalizeAxes, final boolean normalizeUnits) {
-        final CoordinateSystemAxis[] axes = normalizeAxes(cs, normalizeAxes, normalizeUnits);
-        return (axes != null) ? createSameType(cs, axes) : cs;
-    }
-
-    /**
-     * Returns the normalized set of axes for the given coordinate system,
-     * or {@code null} if its axes were already normalized.
-     *
-     * @param  cs The coordinate system to normalize.
-     * @param  normalizeAxes  {@code true} for normalizing axis directions.
-     * @param  normalizeUnits {@code true} for normalizing units (currently ignored if {@code normalizeAxes} is {@code false}).
-     * @return The normalized set of coordinate system axes.
-     */
-    private static CoordinateSystemAxis[] normalizeAxes(final CoordinateSystem cs,
-            final boolean normalizeAxes, final boolean normalizeUnits)
-    {
+    static AbstractCS normalize(final CoordinateSystem cs, final AxisFilter changes, final boolean reorder) {
         boolean changed = false;
         final int dimension = cs.getDimension();
-        final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[dimension];
+        CoordinateSystemAxis[] axes = new CoordinateSystemAxis[dimension];
+        int n = 0;
         for (int i=0; i<dimension; i++) {
             CoordinateSystemAxis axis = cs.getAxis(i);
-            if (normalizeAxes) {
-                changed |= (axis != (axis = normalize(axis, normalizeUnits)));
+            if (changes != null) {
+                if (!changes.accept(axis)) {
+                    continue;
+                }
+                changed |= (axis != (axis = normalize(axis, changes)));
             }
-            axes[i] = axis;
+            axes[n++] = axis;
         }
+        axes = ArraysExt.resize(axes, n);
         /*
-         * Sorts the axis in an attempt to create a right-handed system.
-         * Caller will create a new Coordinate System only if at least one axis changed.
+         * Sort the axes in an attempt to create a right-handed system.
+         * If nothing changed, return the given Coordinate System as-is.
          */
-        changed |= sort(axes);
-        return changed ? axes : null;
-    }
-
-    /**
-     * Creates a new coordinate system of the same type than the given one, but with the given axes.
-     *
-     * @param  cs   The coordinate system to copy.
-     * @param  axes The set of axes to give to the new coordinate system.
-     * @return A new coordinate system of the same type than {@code cs}, but using the given axes.
-     */
-    private static AbstractCS createSameType(final AbstractCS cs, final CoordinateSystemAxis[] axes) {
-        final StringBuilder buffer = (StringBuilder) CharSequences.camelCaseToSentence(cs.getInterface().getSimpleName());
-        return cs.createSameType(singletonMap(AbstractCS.NAME_KEY, DefaultCompoundCS.createName(buffer, axes)), axes);
+        if (reorder) {
+            changed |= sort(axes);
+        }
+        if (!changed && n == dimension) {
+            return null;
+        }
+        /*
+         * Create a new coordinate system of the same type than the given one, but with the given axes.
+         * We need to change the Coordinate System name, since it is likely to not be valid anymore.
+         */
+        final AbstractCS impl = castOrCopy(cs);
+        final StringBuilder buffer = (StringBuilder) CharSequences.camelCaseToSentence(impl.getInterface().getSimpleName());
+        return impl.createForAxes(singletonMap(AbstractCS.NAME_KEY, AxisDirections.appendTo(buffer, axes)), axes);
     }
 
     /**
@@ -286,9 +238,9 @@ final class Normalizer implements Compar
      * of -60° still locate the same point in the old and the new coordinate system. But the preferred way
      * to locate that point become the 300° value if the longitude range has been shifted to positive values.</p>
      *
-     * @return A coordinate system using the given kind of longitude range (may be {@code axis}).
+     * @return A coordinate system using the given kind of longitude range, or {@code null} if no change is needed.
      */
-    static AbstractCS shiftAxisRange(final AbstractCS cs) {
+    private static AbstractCS shiftAxisRange(final CoordinateSystem cs) {
         boolean changed = false;
         final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[cs.getDimension()];
         for (int i=0; i<axes.length; i++) {
@@ -317,8 +269,37 @@ final class Normalizer implements Compar
             axes[i] = axis;
         }
         if (!changed) {
-            return cs;
+            return null;
+        }
+        return castOrCopy(cs).createForAxes(IdentifiedObjects.getProperties(cs, EXCLUDES), axes);
+    }
+
+    /**
+     * Returns the given coordinate system as an {@code AbstractCS} instance. This method performs an
+     * {@code instanceof} check before to delegate to {@link AbstractCS#castOrCopy(CoordinateSystem)}
+     * because there is no need to check for all interfaces before the implementation class here.
+     * Checking the implementation class first is usually more efficient in this particular case.
+     */
+    private static AbstractCS castOrCopy(final CoordinateSystem cs) {
+        return (cs instanceof AbstractCS) ? (AbstractCS) cs : AbstractCS.castOrCopy(cs);
+    }
+
+    /**
+     * Returns a coordinate system equivalent to the given one but with axes rearranged according the given convention.
+     * If the given coordinate system is already compatible with the given convention, then returns {@code null}.
+     *
+     * @param  convention The axes convention for which a coordinate system is desired.
+     * @return A coordinate system compatible with the given convention, or {@code null} if no change is needed.
+     *
+     * @see AbstractCS#forConvention(AxesConvention)
+     */
+    static AbstractCS forConvention(final CoordinateSystem cs, final AxesConvention convention) {
+        switch (convention) {
+            case NORMALIZED:              // Fall through
+            case CONVENTIONALLY_ORIENTED: return normalize(cs, convention, true);
+            case RIGHT_HANDED:            return normalize(cs, null, true);
+            case POSITIVE_RANGE:          return shiftAxisRange(cs);
+            default: throw new AssertionError(convention);
         }
-        return cs.createSameType(IdentifiedObjects.getProperties(cs, EXCLUDES), axes);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/package-info.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/package-info.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -28,9 +28,13 @@
  *   <li>{@link org.apache.sis.referencing.cs.AbstractCS#forConvention AbstractCS.forConvention(AxesConvention)}</li>
  * </ul>
  *
+ * This package provides also a {@link org.apache.sis.referencing.cs.CoordinateSystems} utility class
+ * with static methods for estimating an angle between two axes, determining the change of axis directions
+ * and units between two coordinate systems, or filtering axes.
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -27,7 +27,6 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -124,7 +123,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  *
  * @see DefaultGeodeticDatum#getBursaWolfParameters()
@@ -226,7 +225,7 @@ public class BursaWolfParameters extends
     }
 
     /**
-     * Verifies parameters validity after initialization.
+     * Verifies parameters validity after initialization of {@link DefaultGeodeticDatum}.
      */
     void verify() {
         ensureFinite("tX", tX);
@@ -252,6 +251,74 @@ public class BursaWolfParameters extends
     }
 
     /**
+     * Returns the parameter values. The length of the returned array depends on the values:
+     *
+     * <ul>
+     *   <li>If this instance is an {@link TimeDependentBWP}, then the array length will be 14.</li>
+     *   <li>Otherwise if this instance contains a non-zero {@link #dS} value, then the array length will be 7 with
+     *       {@link #tX}, {@link #tY}, {@link #tZ}, {@link #rX}, {@link #rY}, {@link #rZ} and {@link #dS} values
+     *       in that order.</li>
+     *   <li>Otherwise if this instance contains non-zero rotation terms,
+     *       then this method returns the first 6 of the above-cited values.</li>
+     *   <li>Otherwise (i.e. this instance {@linkplain #isTranslation() is a translation}),
+     *       this method returns only the first 3 of the above-cited values.</li>
+     * </ul>
+     *
+     * <div class="note"><b>Note:</b>
+     * the rules about the arrays of length 3, 6 or 7 are derived from the <cite>Well Known Text</cite> (WKT)
+     * version 1 specification. The rule about the array of length 14 is an extension.</div>
+     *
+     * @return The parameter values as an array of length 3, 6, 7 or 14.
+     *
+     * @since 0.6
+     */
+    @SuppressWarnings("fallthrough")
+    public double[] getValues() {
+        final double[] elements = new double[(dS != 0) ? 7 : (rZ != 0 || rY != 0 || rX != 0) ? 6 : 3];
+        switch (elements.length) {
+            default: elements[6] = dS;  // Fallthrough everywhere.
+            case 6:  elements[5] = rZ;
+                     elements[4] = rY;
+                     elements[3] = rX;
+            case 3:  elements[2] = tZ;
+                     elements[1] = tY;
+                     elements[0] = tX;
+        }
+        return elements;
+    }
+
+    /**
+     * Sets the parameters to the given values. The given array can have any length. The first array elements will be
+     * assigned to the {@link #tX}, {@link #tY}, {@link #tZ}, {@link #rX}, {@link #rY}, {@link #rZ} and {@link #dS}
+     * fields in that order.
+     *
+     * <ul>
+     *   <li>If the length of the given array is not sufficient for assigning a value to every fields,
+     *       then the remaining fields are left unchanged (they are <strong>not</strong> reset to zero,
+     *       but this is not a problem if this {@code BursaWolfParameters} is a new instance).</li>
+     *   <li>If the length of the given array is greater than necessary, then extra elements are ignored by this base
+     *       class. Note however that those extra elements may be used by subclasses like {@link TimeDependentBWP}.</li>
+     * </ul>
+     *
+     * @param elements The new parameter values, as an array of any length.
+     *
+     * @since 0.6
+     */
+    @SuppressWarnings("fallthrough")
+    public void setValues(final double... elements) {
+        switch (elements.length) {
+            default: dS = elements[6];  // Fallthrough everywhere.
+            case 6:  rZ = elements[5];
+            case 5:  rY = elements[4];
+            case 4:  rX = elements[3];
+            case 3:  tZ = elements[2];
+            case 2:  tY = elements[1];
+            case 1:  tX = elements[0];
+            case 0:  break;
+         }
+    }
+
+    /**
      * Returns {@code true} if the {@linkplain #targetDatum target datum} is equals (at least on computation purpose)
      * to the WGS84 datum. If the datum is unspecified, then this method returns {@code true} since WGS84 is the only
      * datum supported by the WKT 1 format, and is what users often mean.
@@ -302,13 +369,11 @@ public class BursaWolfParameters extends
      * because the parameter values are very small (parts per millions and arc-seconds).
      */
     public void invert() {
-        tX = -tX;
-        tY = -tY;
-        tZ = -tZ;
-        rX = -rX;
-        rY = -rY;
-        rZ = -rZ;
-        dS = -dS;
+        final double[] values = getValues();
+        for (int i=0; i<values.length; i++) {
+            values[i] = -values[i];
+        }
+        setValues(values);
     }
 
     /**
@@ -556,15 +621,9 @@ public class BursaWolfParameters extends
     public boolean equals(final Object object) {
         if (object != null && object.getClass() == getClass()) {
             final BursaWolfParameters that = (BursaWolfParameters) object;
-            return Numerics.equals(this.tX, that.tX) &&
-                   Numerics.equals(this.tY, that.tY) &&
-                   Numerics.equals(this.tZ, that.tZ) &&
-                   Numerics.equals(this.rX, that.rX) &&
-                   Numerics.equals(this.rY, that.rY) &&
-                   Numerics.equals(this.rZ, that.rZ) &&
-                   Numerics.equals(this.dS, that.dS) &&
-                    Objects.equals(this.targetDatum, that.targetDatum) &&
-                    Objects.equals(this.domainOfValidity, that.domainOfValidity);
+            return Arrays.equals(this.getValues(),      that.getValues()) &&
+                  Objects.equals(this.targetDatum,      that.targetDatum) &&
+                  Objects.equals(this.domainOfValidity, that.domainOfValidity);
         }
         return false;
     }
@@ -572,12 +631,11 @@ public class BursaWolfParameters extends
     /**
      * Returns a hash value for this object.
      *
-     * @return The hash code value. This value doesn't need to be the same
-     *         in past or future versions of this class.
+     * @return The hash code value. This value does not need to be the same in past or future versions of this class.
      */
     @Override
     public int hashCode() {
-        return Arrays.hashCode(new double[] {tX, tY, tZ, rX, rY, rZ, dS}) ^ (int) serialVersionUID;
+        return Arrays.hashCode(getValues()) ^ (int) serialVersionUID;
     }
 
     /**
@@ -599,14 +657,14 @@ public class BursaWolfParameters extends
      */
     @Override
     protected String formatTo(final Formatter formatter) {
-        formatter.append(tX);
-        formatter.append(tY);
-        formatter.append(tZ);
-        formatter.append(rX);
-        formatter.append(rY);
-        formatter.append(rZ);
-        formatter.append(dS);
+        final double[] values = getValues();
+        for (final double value : values) {
+            formatter.append(value);
+        }
         if (isToWGS84()) {
+            if (values.length > 7) {
+                formatter.setInvalidWKT(BursaWolfParameters.class, null);
+            }
             return WKTKeywords.ToWGS84;
         }
         formatter.setInvalidWKT(BursaWolfParameters.class, null);

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -34,6 +34,7 @@ import org.apache.sis.referencing.operat
 import org.apache.sis.referencing.operation.matrix.NoninvertibleMatrixException;
 import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.ExtentSelector;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.util.logging.Logging;
@@ -141,7 +142,7 @@ public class DefaultGeodeticDatum extend
      * The <code>{@value #BURSA_WOLF_KEY}</code> property for
      * {@linkplain #getBursaWolfParameters() Bursa-Wolf parameters}.
      */
-    public static final String BURSA_WOLF_KEY = "bursaWolf";
+    public static final String BURSA_WOLF_KEY = ReferencingServices.BURSA_WOLF_KEY;
 
     /**
      * The array to be returned by {@link #getBursaWolfParameters()} when there is no Bursa-Wolf parameters.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -30,7 +30,7 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.referencing.VerticalDatumTypes;
+import org.apache.sis.internal.metadata.VerticalDatumTypes;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/TimeDependentBWP.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -17,7 +17,6 @@
 package org.apache.sis.referencing.datum;
 
 import java.util.Date;
-import java.util.Arrays;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.apache.sis.internal.util.Numerics;
@@ -60,7 +59,7 @@ import static org.apache.sis.internal.re
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public class TimeDependentBWP extends BursaWolfParameters {
@@ -201,7 +200,50 @@ public class TimeDependentBWP extends Bu
     }
 
     /**
+     * Returns the parameter values. The first 14 elements are always {@link #tX tX}, {@link #tY tY}, {@link #tZ tZ},
+     * {@link #rX rX}, {@link #rY rY}, {@link #rZ rZ}, {@link #dS dS}, {@link #dtX}, {@link #dtY}, {@link #dtZ},
+     * {@link #drX}, {@link #drY}, {@link #drZ} and {@link #ddS} in that order.
+     *
+     * @return The parameter values as an array of length 14.
+     *
+     * @since 0.6
+     */
+    @Override
+    public double[] getValues() {
+        return new double[] {tX, tY, tZ, rX, rY, rZ, dS, dtX, dtY, dtZ, drX, drY, drZ, ddS};
+    }
+
+    /**
+     * Sets the parameters to the given values. The given array can have any length. The first array elements will be
+     * assigned to the {@link #tX tX}, {@link #tY tY}, {@link #tZ tZ}, {@link #rX rX}, {@link #rY rY}, {@link #rZ rZ},
+     * {@link #dS dS}, {@link #dtX}, {@link #dtY}, {@link #dtZ}, {@link #drX}, {@link #drY}, {@link #drZ} and
+     * {@link #ddS} fields in that order.
+     *
+     * @param elements The new parameter values, as an array of any length.
+     *
+     * @since 0.6
+     */
+    @Override
+    @SuppressWarnings("fallthrough")
+    public void setValues(final double... elements) {
+        if (elements.length >= 8) {
+            switch (elements.length) {
+                default:  ddS = elements[13];  // Fallthrough everywhere.
+                case 13:  drZ = elements[12];
+                case 12:  drY = elements[11];
+                case 11:  drX = elements[10];
+                case 10:  dtZ = elements[ 9];
+                case  9:  dtY = elements[ 8];
+                case  8:  dtX = elements[ 7];
+            }
+        }
+        super.setValues(elements);
+    }
+
+    /**
      * {@inheritDoc}
+     *
+     * @return {@code true} if the parameters describe no operation.
      */
     @Override
     public boolean isIdentity() {
@@ -210,6 +252,8 @@ public class TimeDependentBWP extends Bu
 
     /**
      * {@inheritDoc}
+     *
+     * @return {@code true} if the parameters describe a translation only.
      */
     @Override
     public boolean isTranslation() {
@@ -232,45 +276,21 @@ public class TimeDependentBWP extends Bu
 
     /**
      * {@inheritDoc}
-     */
-    @Override
-    public void invert() {
-        super.invert();
-        dtX = -dtX;
-        dtY = -dtY;
-        dtZ = -dtZ;
-        drX = -drX;
-        drY = -drY;
-        drZ = -drZ;
-        ddS = -ddS;
-    }
-
-    /**
-     * {@inheritDoc}
+     *
+     * @return {@code true} if the given object is equal to this {@code TimeDependentBWP}.
      */
     @Override
     public boolean equals(final Object object) {
-        if (super.equals(object)) {
-            final TimeDependentBWP that = (TimeDependentBWP) object;
-            return timeReference == that.timeReference &&
-                   Numerics.equals(this.dtX, that.dtX) &&
-                   Numerics.equals(this.dtY, that.dtY) &&
-                   Numerics.equals(this.dtZ, that.dtZ) &&
-                   Numerics.equals(this.drX, that.drX) &&
-                   Numerics.equals(this.drY, that.drY) &&
-                   Numerics.equals(this.drZ, that.drZ) &&
-                   Numerics.equals(this.ddS, that.ddS);
-        }
-        return false;
+        return super.equals(object) && timeReference == ((TimeDependentBWP) object).timeReference;
     }
 
     /**
      * {@inheritDoc}
+     *
+     * @return The hash code value. This value does not need to be the same in past or future versions of this class.
      */
     @Override
     public int hashCode() {
-        return ((int) serialVersionUID) ^ Arrays.hashCode(new double[] {
-            tX, tY, tZ, rX, rY, rZ, dS, dtX, dtY, dtZ, drX, drY, drZ, ddS, timeReference
-        });
+        return super.hashCode() ^ Numerics.hashCode(timeReference);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -40,7 +40,7 @@ import org.opengis.referencing.operation
 import org.apache.sis.referencing.cs.*;
 import org.apache.sis.referencing.crs.*;
 import org.apache.sis.referencing.datum.*;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.MergedProperties;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.metadata.WKTParser;
@@ -263,7 +263,7 @@ public class GeodeticObjectFactory exten
              */
             @Override
             protected Object invisibleEntry(final Object key) {
-                if (OperationMethods.MT_FACTORY.equals(key)) {
+                if (ReferencingServices.MT_FACTORY.equals(key)) {
                     return getMathTransformFactory();
                 } else {
                     return super.invisibleEntry(key);

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -45,8 +45,8 @@ import org.apache.sis.util.collection.Co
 import org.apache.sis.util.UnsupportedImplementationException;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
+import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.referencing.OperationMethods;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.util.CollectionsExt;
@@ -533,7 +533,7 @@ check:      for (int isTarget=0; ; isTar
      * @return The accuracy estimation (always in meters), or NaN if unknown.
      */
     public double getLinearAccuracy() {
-        return OperationMethods.getLinearAccuracy(this);
+        return PositionalAccuracyConstant.getLinearAccuracy(this);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -32,7 +32,7 @@ import org.apache.sis.referencing.Identi
 import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.resources.Errors;
@@ -108,7 +108,7 @@ class AbstractSingleOperation extends Ab
          * However there is a few cases, for example the Molodenski transform, where we can not infer the
          * parameters easily because the operation is implemented by a concatenation of math transforms.
          */
-        parameters = Containers.property(properties, OperationMethods.PARAMETERS_KEY, ParameterValueGroup.class);
+        parameters = Containers.property(properties, ReferencingServices.PARAMETERS_KEY, ParameterValueGroup.class);
         // No clone since this is a SIS internal property and SIS does not modify those values after construction.
     }
 

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -27,7 +27,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.internal.referencing.MergedProperties;
-import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
@@ -176,7 +176,7 @@ public class DefaultCoordinateOperationF
         }
         name = CharSequences.trimWhitespaces(name);
         ArgumentChecks.ensureNonEmpty("name", name);
-        final OperationMethod method = OperationMethods.getOperationMethod(
+        final OperationMethod method = ReferencingServices.getInstance().getOperationMethod(
                 mtFactory.getAvailableMethods(SingleOperation.class), name);
         if (method != null) {
             return method;
@@ -371,7 +371,7 @@ public class DefaultCoordinateOperationF
                                                final OperationMethod method)
             throws FactoryException
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return delegate().createOperation(sourceCRS, targetCRS, method);
     }
 
     /**
@@ -388,6 +388,26 @@ public class DefaultCoordinateOperationF
                                                final CoordinateReferenceSystem targetCRS)
             throws OperationNotFoundException, FactoryException
     {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return delegate().createOperation(sourceCRS, targetCRS);
     }
+
+    /**
+     * Temporarily returns a third-party factory for operation not yet implemented by this class.
+     * This method will be removed when the missing implementation will have been ported to SIS.
+     */
+    private synchronized CoordinateOperationFactory delegate() throws FactoryException {
+        if (delegate != null) {
+            return delegate;
+        }
+        for (final CoordinateOperationFactory factory : java.util.ServiceLoader.load(CoordinateOperationFactory.class)) {
+            if (!factory.getClass().getName().startsWith("org.apache.sis.")) {
+                delegate = factory;
+                return factory;
+            }
+        }
+        throw new FactoryException(Errors.format(Errors.Keys.MissingRequiredModule_1, "geotk-referencing")); // This is temporary.
+    }
+
+    /** Temporary, to be deleted in a future SIS version. */
+    private transient CoordinateOperationFactory delegate;
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -50,10 +50,11 @@ import org.apache.sis.internal.util.Lazy
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.metadata.WKTParser;
 import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.referencing.OperationMethods;
+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;
 import org.apache.sis.referencing.operation.matrix.Matrices;
@@ -373,7 +374,7 @@ public class DefaultMathTransformFactory
         ArgumentChecks.ensureNonEmpty("identifier", identifier);
         OperationMethod method = methodsByName.get(identifier);
         if (method == null) {
-            method = OperationMethods.getOperationMethod(methods, identifier);
+            method = ReferencingServices.getInstance().getOperationMethod(methods, identifier);
             if (method == null) {
                 throw new NoSuchIdentifierException(Errors.format(Errors.Keys.NoSuchOperationMethod_1, identifier), identifier);
             }
@@ -591,8 +592,8 @@ public class DefaultMathTransformFactory
          */
         final Matrix swap1, swap3;
         try {
-            swap1 = CoordinateSystems.swapAndScaleAxes(baseCS, CoordinateSystems.normalize(baseCS));
-            swap3 = CoordinateSystems.swapAndScaleAxes(CoordinateSystems.normalize(derivedCS), derivedCS);
+            swap1 = CoordinateSystems.swapAndScaleAxes(baseCS, CoordinateSystems.replaceAxes(baseCS, AxesConvention.NORMALIZED));
+            swap3 = CoordinateSystems.swapAndScaleAxes(CoordinateSystems.replaceAxes(derivedCS, AxesConvention.NORMALIZED), derivedCS);
         } catch (IllegalArgumentException | ConversionException cause) {
             throw new FactoryException(cause);
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CodeTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -20,9 +20,10 @@ import java.util.Collections;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.metadata.Identifier;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -35,16 +36,20 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final strictfp class CodeTest extends TestCase {
     /**
      * Tests the {@link Code#Code(Identifier)} constructor with {@code "EPSG:4326"} identifier.
+     * This test intentionally uses an identifier with the {@code IOGP} authority instead than
+     * EPSG in order to make sure that the {@code codeSpace} attribute is set from
+     * {@link Identifier#getCodeSpace()}, not from {@link Identifier#getAuthority()}.
      */
     @Test
     public void testSimple() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326");
+        final SimpleCitation IOGP = new SimpleCitation("IOGP");
+        final Identifier id = new ImmutableIdentifier(IOGP, "EPSG", "4326");  // See above javadoc.
         final Code value = new Code(id);
         assertEquals("codeSpace", "EPSG", value.codeSpace);
         assertEquals("code",      "4326", value.code);
@@ -61,11 +66,14 @@ public final strictfp class CodeTest ext
 
     /**
      * Tests the {@link Code#Code(Identifier)} constructor with {@code "EPSG:8.3:4326"} identifier.
+     * This test intentionally uses an identifier with the {@code IOGP} authority instead than EPSG
+     * for the same reason than {@link #testSimple()}.
      */
     @Test
     @DependsOnMethod("testSimple")
     public void testWithVersion() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326", "8.2", null);
+        final SimpleCitation IOGP = new SimpleCitation("IOGP");
+        final Identifier id = new ImmutableIdentifier(IOGP, "EPSG", "4326", "8.2", null);  // See above javadoc.
         final Code value = new Code(id);
         assertEquals("codeSpace", "EPSG:8.2", value.codeSpace);
         assertEquals("code",      "4326",     value.code);
@@ -86,7 +94,7 @@ public final strictfp class CodeTest ext
     @Test
     @DependsOnMethod("testWithVersion")
     public void testForIdentifiedObject() {
-        final Identifier id = new ImmutableIdentifier(HardCodedCitations.IOGP, "EPSG", "4326", "8.2", null);
+        final Identifier id = new ImmutableIdentifier(Citations.EPSG, "EPSG", "4326", "8.2", null);
         final Code value = Code.forIdentifiedObject(GeographicCRS.class, Collections.singleton(id));
         assertNotNull(value);
         assertEquals("codeSpace", Constants.IOGP, value.codeSpace);
@@ -94,9 +102,26 @@ public final strictfp class CodeTest ext
     }
 
     /**
+     * Tests {@link Code#forIdentifiedObject(Class, Iterable)} with the legacy "OGP" codespace
+     * (instead of "IOGP").
+     */
+    @Test
+    @DependsOnMethod("testForIdentifiedObject")
+    public void testLegacyCodeSpace() {
+        final DefaultCitation authority = new DefaultCitation("EPSG");
+        authority.getIdentifiers().add(new ImmutableIdentifier(null, "OGP", "EPSG"));
+
+        final Identifier id = new ImmutableIdentifier(authority, "EPSG", "4326", "8.2", null);
+        final Code value = Code.forIdentifiedObject(GeographicCRS.class, Collections.singleton(id));
+        assertNotNull(value);
+        assertEquals("codeSpace", "OGP", value.codeSpace);
+        assertEquals("code", "urn:ogc:def:crs:EPSG:8.2:4326", value.code);
+    }
+
+    /**
      * Tests {@link Code#getIdentifier()} with {@code "urn:ogc:def:crs:EPSG:8.2:4326"}.
-     * This test simulate the {@code Code} object state that we get after
-     * XML unmarshalling of an object from the EPSG registry.
+     * This test simulates the {@code Code} object state that we get after XML unmarshalling
+     * of an object from the EPSG registry.
      */
     @Test
     @DependsOnMethod("testForIdentifiedObject")
@@ -105,7 +130,7 @@ public final strictfp class CodeTest ext
         value.codeSpace = "OGP";
         value.code = "urn:ogc:def:crs:EPSG:8.2:4326";
         final Identifier actual = value.getIdentifier();
-        assertSame  ("authority",  Citations.OGP, actual.getAuthority());
+        assertSame  ("authority",  Citations.EPSG, actual.getAuthority());
         assertEquals("codeSpace", "EPSG", actual.getCodeSpace());
         assertEquals("version",   "8.2",  actual.getVersion());
         assertEquals("code",      "4326", actual.getCode());

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -18,6 +18,8 @@ package org.apache.sis.internal.referenc
 
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.referencing.cs.HardCodedAxes;
 import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -33,7 +35,7 @@ import static org.opengis.referencing.cs
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public final strictfp class AxisDirectionsTest extends TestCase {
@@ -357,4 +359,18 @@ public final strictfp class AxisDirectio
                 HardCodedCS.GEODETIC_3D,
                 HardCodedCS.DAYS));
     }
+
+    /**
+     * Tests {@link AxisDirections#appendTo(StringBuilder, CoordinateSystemAxis[])}.
+     *
+     * @since 0.6
+     */
+    @Test
+    public void testAppendTo() {
+        final StringBuilder buffer = new StringBuilder("Compound CS");
+        final String name = AxisDirections.appendTo(buffer, new CoordinateSystemAxis[] {
+            HardCodedAxes.EASTING, HardCodedAxes.NORTHING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME
+        });
+        assertEquals("Compound CS: East (m), North (m), Up (cm), Future (d).", name);
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -83,7 +83,7 @@ public final strictfp class AffineTest e
         final Matrix matrix = Matrices.createDiagonal(3, 3);
         assertWktEquals(
                 "ParameterGroup[“Affine parametric transformation”," +
-                " Id[“EPSG”, 9624, Citation[“IOGP”]]]", Affine.parameters(matrix));
+                " Id[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Try arbitrary values.
          */
@@ -95,7 +95,7 @@ public final strictfp class AffineTest e
                 "  Parameter[“A1”, 2.0, Id[“EPSG”, 8624]],\n"  +
                 "  Parameter[“B1”, 0.0, Id[“EPSG”, 8640]],\n" +
                 "  Parameter[“B2”, -1.0, Id[“EPSG”, 8641]],\n" +
-                "  Id[“EPSG”, 9624, Citation[“IOGP”]]]", Affine.parameters(matrix));
+                "  Id[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Setting a value on the last row make the matrix non-affine.
          * So it should not be anymore EPSG:9624.

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -203,7 +203,7 @@ public final strictfp class DefaultParam
          * but is reproduced here for easier comparison with the test following it.
          */
         final DefaultParameterDescriptor<Double> descriptor = DefaultParameterDescriptorTest.createEPSG("A0", Constants.A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”], URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
         /*
          * When the parameter is part of a larger element, we expect a simplification.
          * Here, the URI should be omitted because it is a long value which does not
@@ -212,7 +212,7 @@ public final strictfp class DefaultParam
         final DefaultParameterDescriptorGroup group = new DefaultParameterDescriptorGroup(
                 Collections.singletonMap(NAME_KEY, "Affine"), 1, 1, descriptor);
         assertWktEquals("ParameterGroup[“Affine”,\n" +
-                        "  Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”]]]]", group);
+                        "  Parameter[“A0”, Id[“EPSG”, 8623]]]", group);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -26,7 +26,7 @@ import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -147,7 +147,7 @@ public final strictfp class DefaultParam
     public static DefaultParameterDescriptor<Double> createEPSG(final String name, final short code) {
         final Map<String, Object> properties = properties(name);
         assertNull(properties.put(DefaultParameterDescriptor.IDENTIFIERS_KEY,
-                new ImmutableIdentifier(HardCodedCitations.IOGP, Constants.EPSG, Short.toString(code))));
+                new ImmutableIdentifier(Citations.EPSG, Constants.EPSG, Short.toString(code))));
         return new DefaultParameterDescriptor<>(properties, 0, 1, Double.class, null, null, null);
     }
 
@@ -323,6 +323,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final DefaultParameterDescriptor<Double> descriptor = createEPSG("A0", Constants.A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, Citation[“IOGP”], URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -604,6 +604,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final Watcher<Double> parameter = new Watcher<>(DefaultParameterDescriptorTest.createEPSG("A0", Constants.A0));
-        assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623, Citation[“IOGP”]]]", parameter);
+        assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623]]", parameter);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -21,7 +21,7 @@ import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.util.GenericName;
 import org.opengis.parameter.ParameterDescriptor;
-import org.apache.sis.metadata.iso.citation.HardCodedCitations;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -79,11 +79,11 @@ public final strictfp class ParameterBui
     @DependsOnMethod("testCreate")
     public void testMercatorProjection() {
         final ParameterBuilder builder = new ParameterBuilder();
-        builder.setCodeSpace(HardCodedCitations.IOGP, "EPSG").setRequired(true);
+        builder.setCodeSpace(Citations.EPSG, "EPSG").setRequired(true);
         final ParameterDescriptor<?>[] parameters = {
             builder.addName("Longitude of natural origin")
-                   .addName(HardCodedCitations.OGC, "central_meridian")
-                   .addName(HardCodedCitations.GEOTIFF, "NatOriginLong")
+                   .addName(Citations.OGC, "central_meridian")
+                   .addName(Citations.GEOTIFF, "NatOriginLong")
                    .setRemarks("Some remarks.")               .createBounded(-180, +180, 0, NonSI.DEGREE_ANGLE),
             builder.addName("Latitude of natural origin")     .createBounded( -80,  +84, 0, NonSI.DEGREE_ANGLE),
             builder.addName("Scale factor at natural origin") .createStrictlyPositive(1, Unit.ONE),

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java?rev=1683756&r1=1683755&r2=1683756&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] Fri Jun  5 13:53:58 2015
@@ -35,8 +35,8 @@ import org.junit.AfterClass;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.OGC;
-import static org.apache.sis.metadata.iso.citation.HardCodedCitations.IOGP;
+import static org.apache.sis.metadata.iso.citation.Citations.OGC;
+import static org.apache.sis.metadata.iso.citation.Citations.EPSG;
 
 
 /**
@@ -62,7 +62,7 @@ public final strictfp class ParameterFor
     @BeforeClass
     public static void createParameterDescriptor() {
         ParameterBuilder builder = new ParameterBuilder();
-        builder.setCodeSpace(IOGP, "EPSG").setRequired(true);
+        builder.setCodeSpace(EPSG, "EPSG").setRequired(true);
         ParameterDescriptor<?>[] parameters = {
             builder.addName("Latitude of natural origin")      .addName(OGC, "latitude_of_origin").createBounded( -80,  +84,  40, NonSI.DEGREE_ANGLE),
             builder.addName("Longitude of natural origin")     .addName(OGC, "central_meridian")  .createBounded(-180, +180, -60, NonSI.DEGREE_ANGLE),



Mime
View raw message