sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1558083 - in /sis/branches/JDK7/core: sis-referencing/src/main/java/org/apache/sis/referencing/cs/ sis-referencing/src/test/java/org/apache/sis/referencing/cs/ sis-referencing/src/test/java/org/apache/sis/test/suite/ sis-utility/src/main/j...
Date Tue, 14 Jan 2014 15:58:12 GMT
Author: desruisseaux
Date: Tue Jan 14 15:58:11 2014
New Revision: 1558083

URL: http://svn.apache.org/r1558083
Log:
First draft of AxesConvention.RIGHT_HANDED support.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
      - copied, changed from r1557278, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ComparableAxisWrapper.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
      - copied, changed from r1557278, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/ComparableAxisWrapperTest.java
Removed:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ComparableAxisWrapper.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/ComparableAxisWrapperTest.java
Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultUserDefinedCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/ElevationAngle.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -17,6 +17,7 @@
 package org.apache.sis.referencing.cs;
 
 import java.util.Map;
+import java.util.EnumMap;
 import java.util.Arrays;
 import javax.measure.unit.SI;
 import javax.measure.unit.Unit;
@@ -105,6 +106,14 @@ public class AbstractCS extends Abstract
     private final CoordinateSystemAxis[] axes;
 
     /**
+     * Other coordinate systems derived from this coordinate systems for other axes conventions.
+     * Created only when first needed.
+     *
+     * @see #forConvention(AxesConvention)
+     */
+    private transient Map<AxesConvention,AbstractCS> derived;
+
+    /**
      * Constructs a new object in which every attributes are set to a null or empty value.
      * <strong>This is not a valid object.</strong> This constructor is strictly reserved
      * to JAXB, which will assign values to the fields using reflexion.
@@ -274,6 +283,40 @@ public class AbstractCS extends Abstract
     }
 
     /**
+     * Returns a coordinate system equivalent to this one but with axes rearranged according the given convention.
+     * If this coordinate system is already compatible with the given convention, then this method returns
+     * {@code this}.
+     *
+     * @param  convention The axes convention for which a coordinate system is desired.
+     * @return A coordinate system compatible with the given convention (may be {@code this}).
+     */
+    public synchronized AbstractCS forConvention(final AxesConvention convention) {
+        ensureNonNull("convention", convention);
+        if (derived == null) {
+            derived = new EnumMap<>(AxesConvention.class);
+        }
+        AbstractCS cs = derived.get(convention);
+        if (cs == null) {
+            switch (convention) {
+                case NORMALIZED:     // TODO
+                case RIGHT_HANDED:   cs = Normalizer.normalize(this); break;
+                case POSITIVE_RANGE: cs = this; break; // TODO
+                default: throw new AssertionError(convention);
+            }
+            derived.put(convention, cs);
+        }
+        return cs;
+    }
+
+    /**
+     * Returns a coordinate system of the same this than this CS but with different axes.
+     * This method shall be overridden by all {@code AbstractCS} subclasses in this package.
+     */
+    AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new AbstractCS(properties, axes);
+    }
+
+    /**
      * Compares the specified object with this coordinate system for equality.
      *
      * @param  object The object to compare to {@code this}.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -46,7 +46,7 @@ import org.opengis.referencing.cs.Coordi
  * {@link org.apache.sis.referencing.CRS#forCode(String)} method. The actual axis order can be verified after the CRS
  * creation with {@code System.out.println(crs)}. If (<var>x</var>,<var>y</var>) axis order is wanted for compatibility
  * with older OGC specifications or other softwares, CRS forced to longitude first axis order can be created using the
- * {@link #RIGHT_HANDED} enumeration value.</p>
+ * {@link #NORMALIZED} enumeration value.</p>
  *
  * {@section Range of longitude values}
  * Most geographic CRS have a longitude axis defined in the [-180 … +180]° range. All map projections in Apache SIS are
@@ -60,17 +60,30 @@ import org.opengis.referencing.cs.Coordi
  * @since   0.4 (derived from geotk-3.20)
  * @version 0.4
  * @module
+ *
+ * @see AbstractCS#forConvention(AxesConvention)
  */
 public enum AxesConvention {
     /**
-     * Axis order and ranges are as specified by the authority. For ellipsoidal coordinate systems defined by
-     * EPSG database, this is often – but not always – (<var>latitude</var>, <var>longitude</var>) axis order
-     * with longitude values in the [-180 … +180]° range.
+     * Axes order, direction and units are forced to commonly used pre-defined values.
+     * This enum identifies the following changes.
+     *
+     * <ul>
+     *   <li>Any direction colinear with {@link AxisDirection#EAST EAST}, {@link AxisDirection#NORTH NORTH},
+     *       {@link AxisDirection#UP UP}, {@link AxisDirection#FUTURE FUTURE},
+     *       {@link AxisDirection#DISPLAY_RIGHT DISPLAY_RIGHT}, {@link AxisDirection#DISPLAY_DOWN DISPLAY_DOWN},
+     *       {@link AxisDirection#ROW_POSITIVE ROW_POSITIVE} and {@link AxisDirection#COLUMN_POSITIVE COLUMN_POSITIVE}
+     *       is replaced by the corresponding above-cited direction.</li>
+     *   <li>Axes with the new directions are reordered for a <cite>right-handed</cite> coordinate system.</li>
+     *   <li>Angular units are set to {@link javax.measure.unit.NonSI#DEGREE_ANGLE}.</li>
+     *   <li>Linear units are set to {@link javax.measure.unit.SI#METRE}.</li>
+     *   <li>Temporal units are set to {@link javax.measure.unit.NonSI#DAY}.</li>
+     * </ul>
      */
-    AS_SPECIFIED,
+    NORMALIZED,
 
     /**
-     * Axes are reordered for a <cite>right-handed</cite> coordinate system. Axis orientations and ranges are unchanged.
+     * Axes are reordered for a <cite>right-handed</cite> coordinate system. Directions, ranges and units are unchanged.
      * This enum is often used for deriving a coordinate system with the (<var>longitude</var>, <var>latitude</var>) or
      * (<var>x</var>,<var>y</var>) axis order. While it works in many cases, note that a right-handed coordinate system
      * does not guarantee that longitude or <var>x</var> axis will be first in every cases. The most notable exception

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -123,16 +123,16 @@ public final class CoordinateSystems ext
      * {@section Invariants}
      * For any non-null return value:
      * <ul>
-     *   <li>{@code angle(A, A) == 0°}</li>
-     *   <li>{@code angle(A, opposite(A)) == ±180°}</li>
-     *   <li>{@code angle(A, B) == -angle(B, A)}</li>
+     *   <li>{@code angle(A, A) = 0°}</li>
+     *   <li>{@code angle(A, opposite(A)) = ±180°}</li>
+     *   <li>{@code angle(A, B) = -angle(B, A)}</li>
      * </ul>
      *
      * @param  source The source axis direction.
      * @param  target The target axis direction.
      * @return The arithmetic angle (in degrees) of the rotation to apply on a line pointing toward
      *         the source direction in order to make it point toward the target direction, or
-     *         {@link Double#NaN} if this value can not be computed.
+     *         {@code null} if this value can not be computed.
      */
     public static Angle angle(final AxisDirection source, final AxisDirection target) {
         ensureNonNull("source", source);
@@ -153,15 +153,17 @@ public final class CoordinateSystems ext
             return new Angle(c * 90);
         }
         /*
-         * Check for DISPLAY_UP, DISPLAY_DOWN, etc.
+         * Check for DISPLAY_UP, DISPLAY_DOWN, etc. assuming a flat screen.
+         * Note that we do not check for grid directions (COLUMN_POSITIVE,
+         * ROW_POSITIVE, etc.) because the grid geometry may be anything.
          */
         c = AxisDirections.angleForDisplay(source, target);
         if (c != Integer.MIN_VALUE) {
             return new Angle(c * (360 / AxisDirections.DISPLAY_COUNT));
         }
         /*
-         * Check for "South along 90° East", etc. directions. We do this test last
-         * because it performs a relatively costly parsing of axis direction name.
+         * Check for "South along 90° East", etc. directions. Note that this
+         * check may perform a relatively costly parsing of axis direction name.
          */
         final DirectionAlongMeridian srcMeridian = DirectionAlongMeridian.parse(source);
         final DirectionAlongMeridian tgtMeridian = DirectionAlongMeridian.parse(target);
@@ -169,7 +171,8 @@ public final class CoordinateSystems ext
             return new Angle(srcMeridian.angle(tgtMeridian));
         }
         /*
-         * Check for UP and DOWN, with special case if one of the direction is a compass one.
+         * Check for UP and DOWN, with special case if one of the direction is horizontal
+         * (either a compass direction of a direction along a meridian).
          */
         final boolean srcVrt = AxisDirections.isVertical(source);
         final boolean tgtVrt = AxisDirections.isVertical(target);

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -208,4 +208,13 @@ public class DefaultAffineCS extends Abs
     public Class<? extends AffineCS> getInterface() {
         return AffineCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but 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);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -75,6 +75,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultCartesianCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a one-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -195,6 +204,11 @@ public class DefaultCartesianCS extends 
             for (int j=i; ++j<dimension;) {
                 final AxisDirection axis1 = getAxis(j).getDirection();
                 final Angle angle = CoordinateSystems.angle(axis0, axis1);
+                /*
+                 * The angle may be null for grid directions (COLUMN_POSITIVE, COLUMN_NEGATIVE,
+                 * ROW_POSITIVE, ROW_NEGATIVE). We conservatively accept those directions even if
+                 * they are not really for Cartesian CS because we do not know the grid geometry.
+                 */
                 if (angle != null && Math.abs(angle.degrees()) != 90) {
                     throw new IllegalArgumentException(Errors.format(
                             Errors.Keys.NonPerpendicularDirections_2, axis0, axis1));
@@ -217,4 +231,12 @@ public class DefaultCartesianCS extends 
     public Class<? extends CartesianCS> getInterface() {
         return CartesianCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultCartesianCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -18,11 +18,14 @@ package org.apache.sis.referencing.cs;
 
 import java.util.Map;
 import java.util.List;
+import javax.measure.unit.Unit;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.CharSequences;
 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.*;
@@ -111,27 +114,49 @@ public class DefaultCompoundCS extends A
      * @param components The set of coordinate system.
      */
     public DefaultCompoundCS(CoordinateSystem... components) {
-        super(singletonMap(NAME_KEY, nameFor(components = clone(components))), getAxes(components));
-        this.components = UnmodifiableArrayList.wrap(components);
+        this(components = clone(components), getAxes(components));
     }
 
     /**
-     * Constructs a name from a merge of the name of all coordinate systems.
      * This is a work around for RFE #4093999 in Sun's bug database
      * ("Relax constraint on placement of this()/super() call in constructors").
      *
      * @param components The coordinate systems.
      */
     @Workaround(library="JDK", version="1.7")
-    private static String nameFor(final CoordinateSystem[] components) {
-        final StringBuilder buffer = new StringBuilder();
-        for (int i=0; i<components.length; i++) {
-            if (buffer.length() != 0) {
-                buffer.append(" / ");
+    private DefaultCompoundCS(final CoordinateSystem[] components, final CoordinateSystemAxis[] axes) {
+        super(singletonMap(NAME_KEY, nameFor(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 nameFor(final StringBuilder buffer, final CoordinateSystemAxis[] axes) {
+        String separator = ": ";
+        for (final CoordinateSystemAxis axis : axes) {
+            buffer.append(separator).append(CharSequences.camelCaseToWords(Types.getCodeLabel(axis.getDirection()), false));
+            separator = ", ";
+            final Unit<?> unit = axis.getUnit();
+            if (unit != null) {
+                final String symbol = unit.toString();
+                if (!symbol.isEmpty()) {
+                    buffer.append(" (").append(symbol).append(')');
+                }
             }
-            buffer.append(components[i].getName().getCode());
         }
-        return buffer.toString();
+        return buffer.append('.').toString();
     }
 
     /**

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -69,6 +69,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultCylindricalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a three-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -178,4 +187,12 @@ public class DefaultCylindricalCS extend
     public Class<? extends CylindricalCS> getInterface() {
         return CylindricalCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultCylindricalCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -69,6 +69,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultEllipsoidalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a two-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -198,4 +207,12 @@ public class DefaultEllipsoidalCS extend
     public Class<? extends EllipsoidalCS> getInterface() {
         return EllipsoidalCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultEllipsoidalCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -68,6 +68,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultLinearCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -171,4 +180,12 @@ public class DefaultLinearCS extends Abs
     public Class<? extends LinearCS> getInterface() {
         return LinearCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultLinearCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -67,6 +67,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultPolarCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a two-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -174,4 +183,12 @@ public class DefaultPolarCS extends Abst
     public Class<? extends PolarCS> getInterface() {
         return PolarCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultPolarCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -71,6 +71,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultSphericalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a three-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -178,4 +187,12 @@ public class DefaultSphericalCS extends 
     public Class<? extends SphericalCS> getInterface() {
         return SphericalCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultSphericalCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -70,6 +70,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultTimeCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -171,4 +180,12 @@ public class DefaultTimeCS extends Abstr
     public Class<? extends TimeCS> getInterface() {
         return TimeCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultTimeCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -54,6 +54,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultUserDefinedCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a two-dimensional coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -160,4 +169,12 @@ public class DefaultUserDefinedCS extend
     public Class<? extends UserDefinedCS> getInterface() {
         return UserDefinedCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultUserDefinedCS(properties, axes);
+    }
 }

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=1558083&r1=1558082&r2=1558083&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] Tue Jan 14 15:58:11 2014
@@ -82,6 +82,15 @@ 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,
+     * because it does not verify the number of axes.
+     */
+    private DefaultVerticalCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        super(properties, axes);
+    }
+
+    /**
      * Constructs a coordinate system from a set of properties.
      * The properties map is given unchanged to the
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
@@ -183,4 +192,12 @@ public class DefaultVerticalCS extends A
     public Class<? extends VerticalCS> getInterface() {
         return VerticalCS.class;
     }
+
+    /**
+     * Returns a coordinate system of the same class than this CS but with different axes.
+     */
+    @Override
+    final AbstractCS createSameType(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new DefaultVerticalCS(properties, axes);
+    }
 }

Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java (from r1557278, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ComparableAxisWrapper.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java&p1=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ComparableAxisWrapper.java&r1=1557278&r2=1558083&rev=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ComparableAxisWrapper.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -21,55 +21,55 @@ import org.opengis.referencing.cs.AxisDi
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.internal.referencing.AxisDirections;
 
+import static java.util.Collections.singletonMap;
+import org.apache.sis.util.CharSequences;
+
 
 /**
- * Wraps a {@link CoordinateSystemAxis} for comparison purpose. The sorting order tries to favor
- * a right-handed system. Compass directions like North and East are first. Vertical or temporal
- * directions like Up or Down are last.
+ * Derives an coordinate system from an existing one for {@link AxesConvention}.
+ * The main usage for this class is to reorder the axes in some fixed order like
+ * (<var>x</var>, <var>y</var>, <var>z</var>) or (<var>longitude</var>, <var>latitude</var>).
+ *
+ * <p>This class implements {@link Comparable} for opportunist reasons.
+ * This should be considered as an implementation details.</p>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @since   0.4 (derived from geotk-2.4)
+ * @since   0.4 (derived from geotk-2.2)
  * @version 0.4
  * @module
  */
-final class ComparableAxisWrapper implements Comparable<ComparableAxisWrapper> {
+final class Normalizer implements Comparable<Normalizer> {
     /**
-     * The wrapped axis.
+     * The axis to be compared by {@link #compareTo(Normalizer)}.
      */
     private final CoordinateSystemAxis axis;
 
     /**
-     * The direction along meridian, or {@code null} if none.
+     * The direction along meridian, or {@code null} if none. This is inferred from {@link #axis}
+     * at construction time in order to compute it only once before to sort an array of axes.
      */
     private final DirectionAlongMeridian meridian;
 
     /**
-     * Creates a new wrapper for the given axis.
+     * For internal usage by {@link #sort(CoordinateSystemAxis[])} only.
      */
-    private ComparableAxisWrapper(final CoordinateSystemAxis axis) {
+    private Normalizer(final CoordinateSystemAxis axis) {
         this.axis = axis;
         meridian = DirectionAlongMeridian.parse(axis.getDirection());
     }
 
     /**
-     * Compares with the specified object. See class javadoc for a description of the sorting order.
+     * Compares two axis for an order that try to favor right-handed coordinate systems.
+     * Compass directions like North and East are first. Vertical directions like Up or Down are next.
      */
     @Override
-    public int compareTo(final ComparableAxisWrapper that) {
+    public int compareTo(final Normalizer that) {
         final AxisDirection d1 = this.axis.getDirection();
         final AxisDirection d2 = that.axis.getDirection();
         final int compass = AxisDirections.angleForCompass(d2, d1);
         if (compass != Integer.MIN_VALUE) {
             return compass;
         }
-        if (AxisDirections.isCompass(d1)) {
-            assert !AxisDirections.isCompass(d2) : d2;
-            return -1;
-        }
-        if (AxisDirections.isCompass(d2)) {
-            assert !AxisDirections.isCompass(d1) : d1;
-            return +1;
-        }
         if (meridian != null) {
             if (that.meridian != null) {
                 return meridian.compareTo(that.meridian);
@@ -78,18 +78,18 @@ final class ComparableAxisWrapper implem
         } else if (that.meridian != null) {
             return +1;
         }
-        return 0;
+        return d1.ordinal() - d2.ordinal();
     }
 
     /**
      * Sorts the specified axis in an attempt to create a right-handed system.
      * The sorting is performed in place. This method returns {@code true} if
-     * at least one axis moved.
+     * at least one axis moved as result of this method call.
      */
-    public static boolean sort(final CoordinateSystemAxis[] axis) {
-        final ComparableAxisWrapper[] wrappers = new ComparableAxisWrapper[axis.length];
+    static boolean sort(final CoordinateSystemAxis[] axis) {
+        final Normalizer[] wrappers = new Normalizer[axis.length];
         for (int i=0; i<axis.length; i++) {
-            wrappers[i] = new ComparableAxisWrapper(axis[i]);
+            wrappers[i] = new Normalizer(axis[i]);
         }
         Arrays.sort(wrappers);
         boolean changed = false;
@@ -100,4 +100,25 @@ final class ComparableAxisWrapper implem
         }
         return changed;
     }
+
+    /**
+     * Reorder the axes in an attempt to get a right-handed system.
+     * If no axis change is needed, then this method returns {@code cs} unchanged.
+     */
+    static AbstractCS normalize(final AbstractCS cs) {
+        final int dimension = cs.getDimension();
+        final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[dimension];
+        for (int i=0; i<dimension; i++) {
+            axes[i] = cs.getAxis(i);
+        }
+        /*
+         * Sorts the axis in an attempt to create a right-handed system
+         * and creates a new Coordinate System if at least one axis changed.
+         */
+        if (!sort(axes)) {
+            return cs;
+        }
+        final StringBuilder buffer = (StringBuilder) CharSequences.camelCaseToSentence(cs.getInterface().getSimpleName());
+        return cs.createSameType(singletonMap(AbstractCS.NAME_KEY, DefaultCompoundCS.nameFor(buffer, axes)), axes);
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.referencing.cs;
 
+import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -34,16 +35,47 @@ import static org.apache.sis.test.Assert
  * @module
  */
 @DependsOn({
+    org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
     DefaultCoordinateSystemAxisTest.class,
-    org.apache.sis.referencing.AbstractIdentifiedObjectTest.class
+    NormalizerTest.class
 })
 public final strictfp class AbstractCSTest extends TestCase {
     /**
+     * Gets a coordinate system for the given axes convention and compare against the expected values.
+     *
+     * @param convention The convention to use.
+     * @param cs The coordinate system to test.
+     * @param expected The expected axes, in order.
+     */
+    private static void verifyAxesConvention(final AxesConvention convention, final AbstractCS cs,
+            final CoordinateSystemAxis... expected)
+    {
+        final AbstractCS derived = cs.forConvention(convention);
+        assertNotSame("Expected a new instance.", cs, derived);
+        assertSame("Should be cached.", derived, cs.forConvention(convention));
+        assertEquals("dimension", expected.length, cs.getDimension());
+        for (int i=0; i<expected.length; i++) {
+            assertEquals(expected[i], derived.getAxis(i));
+        }
+    }
+
+    /**
+     * Tests {@link AbstractCS#forConvention(AxesConvention)}
+     * with a {@link AxesConvention#RIGHT_HANDED} argument.
+     */
+    @Test
+    public void testForRightHandedConvention() {
+        verifyAxesConvention(AxesConvention.RIGHT_HANDED, new AbstractCS(singletonMap(NAME_KEY, "Test"),
+            CommonAxes.LATITUDE, CommonAxes.TIME, CommonAxes.ALTITUDE, CommonAxes.LONGITUDE),
+            CommonAxes.LONGITUDE, CommonAxes.LATITUDE, CommonAxes.ALTITUDE, CommonAxes.TIME);
+    }
+
+    /**
      * Tests serialization.
      */
     @Test
     public void testSerialization() {
-        AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), CommonAxes.X, CommonAxes.Y);
-        cs = assertSerializedEquals(cs);
+        final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"), CommonAxes.X, CommonAxes.Y);
+        assertNotSame(cs, assertSerializedEquals(cs));
     }
 }

Copied: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java (from r1557278, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/ComparableAxisWrapperTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java?p2=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/ComparableAxisWrapperTest.java&r1=1557278&r2=1558083&rev=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/ComparableAxisWrapperTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -31,7 +31,7 @@ import static org.junit.Assert.*;
 
 
 /**
- * Tests the {@link ComparableAxisWrapper} class.
+ * Tests the {@link Normalizer} class.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.4)
@@ -42,7 +42,7 @@ import static org.junit.Assert.*;
     DirectionAlongMeridianTest.class,
     DefaultCoordinateSystemAxisTest.class
 })
-public final strictfp class ComparableAxisWrapperTest extends TestCase {
+public final strictfp class NormalizerTest extends TestCase {
     /**
      * Tests sorting of axes.
      */
@@ -89,8 +89,8 @@ public final strictfp class ComparableAx
         assertOrdered(new AxisDirection[] {
             AxisDirection.NORTH_EAST,        // Right handed-rule
             AxisDirection.NORTH_NORTH_WEST,  // Right handed-rule
-            AxisDirection.GEOCENTRIC_Y,
             AxisDirection.GEOCENTRIC_X,
+            AxisDirection.GEOCENTRIC_Y,
             AxisDirection.PAST
         }, new AxisDirection[] {
             AxisDirection.GEOCENTRIC_Y,
@@ -121,6 +121,17 @@ public final strictfp class ComparableAx
             AxisDirection.DOWN,
             AxisDirection.EAST
         });
+
+        // Legacy (WKT 1) geocentric axes.
+        assertOrdered(new AxisDirection[] {
+            AxisDirection.OTHER,
+            AxisDirection.EAST,
+            AxisDirection.NORTH
+        }, new AxisDirection[] {
+            AxisDirection.NORTH,
+            AxisDirection.OTHER,
+            AxisDirection.EAST
+        });
     }
 
     /**
@@ -130,7 +141,7 @@ public final strictfp class ComparableAx
                                       final CoordinateSystemAxis[] actual)
     {
         final boolean changeExpected = !Arrays.equals(actual, expected);
-        assertEquals(changeExpected, ComparableAxisWrapper.sort(actual));
+        assertEquals(changeExpected, Normalizer.sort(actual));
         assertArrayEquals(expected, actual);
     }
 
@@ -147,7 +158,7 @@ public final strictfp class ComparableAx
      * Creates axis from the specified directions.
      */
     private static CoordinateSystemAxis[] toAxes(final AxisDirection[] directions) {
-        final Map<String,?> properties = singletonMap(NAME_KEY, "Test");
+        final Map<String,?> properties = singletonMap(NAME_KEY, "Temporary axis");
         final CoordinateSystemAxis[] axis = new CoordinateSystemAxis[directions.length];
         for (int i=0; i<directions.length; i++) {
             axis[i] = new DefaultCoordinateSystemAxis(properties, "none", directions[i], SI.METRE);

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -63,7 +63,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class,
     org.apache.sis.referencing.cs.DirectionAlongMeridianTest.class,
     org.apache.sis.referencing.cs.DefaultCoordinateSystemAxisTest.class,
-    org.apache.sis.referencing.cs.ComparableAxisWrapperTest.class,
+    org.apache.sis.referencing.cs.NormalizerTest.class,
     org.apache.sis.referencing.cs.AbstractCSTest.class,
     org.apache.sis.referencing.cs.DefaultCartesianCSTest.class,
     org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -42,7 +42,7 @@ import static org.apache.sis.math.MathFu
  *   <li><cite>Bearing</cite> is also sometime used in navigation for an angle relative to the vessel forward direction.</li>
  *   <li><cite>Deflection angle</cite> is the angle between a line and the prolongation of a preceding line.</li>
  *   <li><cite>Interior angle</cite> is an angle measured between two lines of sight.</li>
- *   <li><cite>Elevation angle</cite> is the angular height from the horizontal plane to an object above the horizon.</li>
+ *   <li>{@linkplain ElevationAngle Elevation angle} is the angular height from the horizontal plane to an object above the horizon.</li>
  * </ul>
  *
  * {@section Formatting angles}

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/ElevationAngle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/ElevationAngle.java?rev=1558083&r1=1558082&r2=1558083&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/ElevationAngle.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/ElevationAngle.java [UTF-8] Tue Jan 14 15:58:11 2014
@@ -16,10 +16,13 @@
  */
 package org.apache.sis.measure;
 
+import org.opengis.referencing.cs.AxisDirection; // For javadoc
+
 
 /**
- * The angular height of an object measured from the horizontal.
- * For visible objects it is an angle between 0 and 90 degrees.
+ * The angular height of an object measured from the horizontal plane.
+ * The elevation angle is part of <cite>local topocentric coordinates</cite> together with azimuth and distance.
+ * For visible objects the elevation is an angle between 0° and 90°.
  *
  * {@note <cite>Elevation angle</cite> and <cite>altitude angle</cite> may be used interchangeably.
  *        Both <cite>altitude</cite> and <cite>elevation</cite> words are also used to describe the
@@ -32,6 +35,8 @@ package org.apache.sis.measure;
  * @since   0.4
  * @version 0.4
  * @module
+ *
+ * @see org.apache.sis.referencing.cs.CoordinateSystems#angle(AxisDirection, AxisDirection)
  */
 public final class ElevationAngle extends Angle {
     /**
@@ -54,10 +59,10 @@ public final class ElevationAngle extend
     /**
      * Constructs a new elevation angle with the specified angular value.
      *
-     * @param θ Elevation angle value in decimal degrees.
+     * @param ε Elevation angle value in decimal degrees.
      */
-    public ElevationAngle(final double θ) {
-        super(θ);
+    public ElevationAngle(final double ε) {
+        super(ε);
     }
 
     /**



Mime
View raw message