sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1568511 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/ sis-referencing/src/main/jav...
Date Fri, 14 Feb 2014 20:42:03 GMT
Author: desruisseaux
Date: Fri Feb 14 20:42:02 2014
New Revision: 1568511

URL: http://svn.apache.org/r1568511
Log:
Added formatting of MERIDIAN[...] element inside the AXIS[...] one.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.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/DefaultCoordinateSystemAxis.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/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/DirectionAlongMeridian.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/AxisDirectionsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -19,12 +19,12 @@ package org.apache.sis.io.wkt;
 
 /**
  * Whether WKT keywords shall be written with upper cases or camel cases.
- * The most common usage is to write WKT keywords with upper cases.
- * However with version 2 of Well Known Text, camel cases may be easier to read
+ * The most common usage for WKT keywords is upper case.
+ * However with version 2 of Well Known Text, camel case may be easier to read
  * because WKT 2 has more keywords made by combination of words. Examples:
  *
  * <table class="sis">
- *   <tr><td>Upper case</td>                 <td>Camel case</td></tr>
+ *   <tr><th>Upper case</th>                 <th>Camel case</th></tr>
  *   <tr><td>{@code TIMEEXTENT}</td>         <td>{@code TimeExtent}</td></td>
  *   <tr><td>{@code ANGLEUNIT}</td>          <td>{@code AngleUnit}</td></td>
  *   <tr><td>{@code BASEGEODCRS}</td>        <td>{@code BaseGeodCRS}</td></td>
@@ -59,7 +59,7 @@ public enum KeywordCase {
     CAMEL_CASE,
 
     /**
-     * Keywords are written with upper cases. This is the most usual case in WKT 1.
+     * Keywords are written with upper cases. This is the most usual case in WKT 1 strings.
      */
     UPPER_CASE
 }

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -77,7 +77,7 @@ import java.util.Objects;
  *
  * </li><li><p><b><cite>Well Known Text</cite> (WKT)
version 2</b></p>
  * The WKT 2 format contains the {@linkplain #getCodeSpace() code space}, the {@linkplain
#getCode() code},
- * the {@linkplain #getVersion() version} and the {@linkplain #getAuthority() authority}
title if available.
+ * the {@linkplain #getVersion() version} and the {@linkplain #getAuthority() authority}
citation if available.
  * The WKT can optionally provides a {@code URI} element, which expresses the same information
in a different way
  * (the URN syntax is described in the next item below).
  * Example:

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/AxisDirections.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -83,6 +83,12 @@ public final class AxisDirections extend
     }
 
     /**
+     * Ordinal of the last element in the {@link AxisDirection} code list.
+     * This is used for differentiating the standard codes from the user-defined ones.
+     */
+    private static final int LAST_ORDINAL = DISPLAY_DOWN.ordinal();
+
+    /**
      * Do not allow instantiation of this class.
      */
     private AxisDirections() {
@@ -222,13 +228,23 @@ public final class AxisDirections extend
      * @param  image {@code true} for accepting grid and image axis directions in addition
to spatial ones.
      * @return {@code true} if the given direction is presumed for spatial CS.
      */
-    public static boolean isSpatialOrCustom(final AxisDirection dir, final boolean image)
{
+    public static boolean isSpatialOrUserDefined(final AxisDirection dir, final boolean image)
{
         if (dir == null) return false;
         final int ordinal = dir.ordinal();
         return ordinal < FUTURE.ordinal() || ordinal > (image ? PAST : DISPLAY_DOWN).ordinal();
     }
 
     /**
+     * Returns {@code true} if the given direction is a user-defined direction (i.e. is not
defined by GeoAPI).
+     *
+     * @param  dir The direction to test, or {@code null}.
+     * @return {@code true} if the given direction is user-defined.
+     */
+    public static boolean isUserDefined(final AxisDirection dir) {
+        return (dir != null) && dir.ordinal() > LAST_ORDINAL;
+    }
+
+    /**
      * Returns {@code true} if the given direction is {@code COLUMN_POSITIVE}, {@code COLUMN_NEGATICE},
      * {@code ROW_POSITIVE} or {@code ROW_NEGATIVE}.
      *

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=1568511&r1=1568510&r2=1568511&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] Fri Feb 14 20:42:02 2014
@@ -112,10 +112,13 @@ public enum AxesConvention {
 
     /**
      * 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
+     * In the two-dimensional case, the handedness is defined from the point of view of an
observer above the plane of
+     * the system.
+     *
+     * <p>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
-     * is the (North, West) case.
+     * is the (North, West) case.</p>
      *
      * {@note We do not provide a "<cite>longitude or <var>x</var> axis
first</cite>" enumeration value because
      *        such criterion is hard to apply to inter-cardinal directions and has no meaning
for map projections

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=1568511&r1=1568510&r2=1568511&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] Fri Feb 14 20:42:02 2014
@@ -164,9 +164,12 @@ public final class CoordinateSystems ext
         /*
          * Check for "South along 90° East", etc. directions. Note that this
          * check may perform a relatively costly parsing of axis direction name.
+         * (NOTE: the check for 'isUserDefined' is performed outside DirectionAlongMeridian
for
+         * avoiding class initialization of the later in the common case where we do not
need it).
          */
-        final DirectionAlongMeridian srcMeridian = DirectionAlongMeridian.parse(source);
-        final DirectionAlongMeridian tgtMeridian = DirectionAlongMeridian.parse(target);
+        final DirectionAlongMeridian srcMeridian, tgtMeridian;
+        srcMeridian = AxisDirections.isUserDefined(source) ? DirectionAlongMeridian.parse(source)
: null;
+        tgtMeridian = AxisDirections.isUserDefined(target) ? DirectionAlongMeridian.parse(target)
: null;
         if (srcMeridian != null && tgtMeridian != null) {
             return new Angle(srcMeridian.angle(tgtMeridian));
         }

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -188,7 +188,7 @@ public class DefaultAffineCS extends Abs
      */
     @Override
     final int validateAxis(final AxisDirection direction, final Unit<?> unit) {
-        if (!AxisDirections.isSpatialOrCustom(direction, true)) {
+        if (!AxisDirections.isSpatialOrUserDefined(direction, true)) {
             return INVALID_DIRECTION;
         }
         if (!Units.isLinear(unit) && !Unit.ONE.equals(unit)) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -740,7 +740,7 @@ public class DefaultCoordinateSystemAxis
      * Most of those constraints are inherited from ISO 19111 — see {@link CoordinateSystemAxis}
javadoc for some of
      * those. The current Apache SIS implementation does not verify whether this axis name
and abbreviation are
      * compliant; we assume that the user created a valid axis.
-     * The only verifications performed by this method are:
+     * The only actions (derived from ISO 19162 rules) taken by this method are:
      *
      * <ul>
      *   <li>Replace “<cite>Geodetic latitude</cite>” and “<cite>Geodetic
longitude</cite>” names (case insensitive)
@@ -763,14 +763,14 @@ public class DefaultCoordinateSystemAxis
             }
             if (!isInternal && name != null) {
                 if (name.equalsIgnoreCase("Geodetic latitude")) {
-                    name = "Latitude";
+                    name = "Latitude"; // ISO 19162 §7.5.3(ii)
                 } else if (name.equalsIgnoreCase("Geodetic longitude")) {
                     name = "Longitude";
                 }
             }
         }
         /*
-         * ISO 19162 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
+         * ISO 19162 §7.5.3 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
          */
         if (!isWKT1 && (name == null || !name.equals(abbreviation))) {
             final StringBuilder buffer = new StringBuilder();
@@ -780,7 +780,20 @@ public class DefaultCoordinateSystemAxis
             name = buffer.append('(').append(abbreviation).append(')').toString();
         }
         formatter.append(name, ElementKind.AXIS);
-        formatter.append(direction);
+        /*
+         * Format the axis direction, optionally followed by a MERIDIAN[…] element
+         * if the direction is of the kind "South along 90°N" for instance.
+         */
+        AxisDirection dir = direction;
+        DirectionAlongMeridian meridian = null;
+        if (!isWKT1 && AxisDirections.isUserDefined(dir)) {
+            meridian = DirectionAlongMeridian.parse(dir);
+            if (meridian != null) {
+                dir = meridian.baseDirection;
+            }
+        }
+        formatter.append(dir);
+        formatter.append(meridian);
         return "Axis";
     }
 }

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -164,7 +164,7 @@ public class DefaultCylindricalCS extend
      */
     @Override
     final int validateAxis(final AxisDirection direction, final Unit<?> unit) {
-        if (!AxisDirections.isSpatialOrCustom(direction, false)) {
+        if (!AxisDirections.isSpatialOrUserDefined(direction, false)) {
             return INVALID_DIRECTION;
         }
         if (!Units.isLinear(unit)) {

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -157,7 +157,7 @@ public class DefaultLinearCS extends Abs
      */
     @Override
     final int validateAxis(final AxisDirection direction, final Unit<?> unit) {
-        if (!AxisDirections.isSpatialOrCustom(direction, false)) {
+        if (!AxisDirections.isSpatialOrUserDefined(direction, false)) {
             return INVALID_DIRECTION;
         }
         if (!Units.isLinear(unit)) {

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -160,7 +160,7 @@ public class DefaultPolarCS extends Abst
      */
     @Override
     final int validateAxis(final AxisDirection direction, final Unit<?> unit) {
-        if (!AxisDirections.isSpatialOrCustom(direction, false)) {
+        if (!AxisDirections.isSpatialOrUserDefined(direction, false)) {
             return INVALID_DIRECTION;
         }
         if (!Units.isLinear(unit) && !Units.isAngular(unit)) {

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -164,7 +164,7 @@ public class DefaultSphericalCS extends 
      */
     @Override
     final int validateAxis(final AxisDirection direction, final Unit<?> unit) {
-        if (!AxisDirections.isSpatialOrCustom(direction, false)) {
+        if (!AxisDirections.isSpatialOrUserDefined(direction, false)) {
             return INVALID_DIRECTION;
         }
         if (!Units.isAngular(unit) && !Units.isLinear(unit)) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -19,17 +19,26 @@ package org.apache.sis.referencing.cs;
 import java.io.Serializable;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import javax.measure.unit.NonSI;
 import org.opengis.referencing.cs.AxisDirection;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.io.wkt.Formatter;
 
 
 /**
  * Parses {@linkplain AxisDirection axis direction} of the kind "<cite>South along
90 deg East</cite>".
  * Those directions are used in the EPSG database for polar stereographic projections.
  *
+ * {@section Reference meridian}
+ * This class does not know whether the meridian is relative to Greenwich or any other reference
meridian.
+ * The reference meridian shall be inferred from the geodetic datum of the {@code GeographicCRS}
instance
+ * that contains (through its coordinate system) the axes having those directions. This is
consistent with
+ * ISO 19162 §7.5.4(iv) - WKT 2 formatting.
+ *
  * {@section Immutability and thread safety}
  * This final class is immutable and thus inherently thread-safe.
  *
@@ -38,7 +47,9 @@ import org.apache.sis.internal.referenci
  * @version 0.4
  * @module
  */
-final class DirectionAlongMeridian implements Comparable<DirectionAlongMeridian>, Serializable
{
+final class DirectionAlongMeridian extends FormattableObject
+        implements Comparable<DirectionAlongMeridian>, Serializable
+{
     /**
      * For cross-version compatibility.
      */
@@ -94,6 +105,9 @@ final class DirectionAlongMeridian imple
 
     /**
      * Returns the direction along meridian for the specified axis direction, or {@code null}
if none.
+     *
+     * <p>TIP: caller can check {@link AxisDirections#isUserDefined(AxisDirection)}
before to invoke this method
+     * for avoiding {@code DirectionAlongMeridian} initialization in the common case where
it is not needed.</p>
      */
     public static DirectionAlongMeridian parse(final AxisDirection direction) {
         final DirectionAlongMeridian candidate = parse(direction.name());
@@ -273,4 +287,15 @@ final class DirectionAlongMeridian imple
         assert EPSG.matcher(name).matches() : name;
         return name;
     }
+
+    /**
+     * Formats a {@code MERIDIAN[…]} element which contains the meridian value and the
unit of measurement.
+     * The unit is currently fixed to degrees, but this may change in any future implementation.
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        formatter.append(meridian);
+        formatter.append(NonSI.DEGREE_ANGLE);
+        return "Meridian";
+    }
 }

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -75,7 +75,8 @@ final class Normalizer implements Compar
      */
     private Normalizer(final CoordinateSystemAxis axis) {
         this.axis = axis;
-        meridian = DirectionAlongMeridian.parse(axis.getDirection());
+        final AxisDirection dir = axis.getDirection();
+        meridian = AxisDirections.isUserDefined(dir) ? DirectionAlongMeridian.parse(dir)
: null;
     }
 
     /**

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=1568511&r1=1568510&r2=1568511&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 Feb 14 20:42:02 2014
@@ -129,7 +129,7 @@ public final strictfp class AxisDirectio
     }
 
     /**
-     * Tests {@link AxisDirections#isSpatialOrCustom(AxisDirection, boolean)} and
+     * Tests {@link AxisDirections#isSpatialOrUserDefined(AxisDirection, boolean)} and
      * {@link AxisDirections#isGrid(AxisDirection)}.
      */
     @Test
@@ -161,7 +161,7 @@ public final strictfp class AxisDirectio
 
     /**
      * Asserts that
-     * {@link AxisDirections#isSpatialOrCustom(AxisDirection)},
+     * {@link AxisDirections#isSpatialOrUserDefined(AxisDirection, boolean)},
      * {@link AxisDirections#isCartesianOrCustom(AxisDirection)} and
      * {@link AxisDirections#isGrid(AxisDirection)}
      * returns the expected value for all the given axis directions.
@@ -172,8 +172,8 @@ public final strictfp class AxisDirectio
         for (final AxisDirection dir : directions) {
             final String name = dir.name();
             assertEquals(name, isGrid, AxisDirections.isGrid(dir));
-            assertEquals(name, isSpatial, AxisDirections.isSpatialOrCustom(dir, false));
-            assertEquals(name, isSpatial | isGrid | isDisplay, AxisDirections.isSpatialOrCustom(dir,
true));
+            assertEquals(name, isSpatial, AxisDirections.isSpatialOrUserDefined(dir, false));
+            assertEquals(name, isSpatial | isGrid | isDisplay, AxisDirections.isSpatialOrUserDefined(dir,
true));
         }
     }
 

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.referencing.cs;
 
+import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.RangeMeaning;
@@ -27,6 +28,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
+import static java.util.Collections.singletonMap;
 import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.referencing.cs.HardCodedAxes.*;
 import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
@@ -106,6 +108,17 @@ public final strictfp class DefaultCoord
     }
 
     /**
+     * Tests the WKT of axis of the kind "South along 90°W".
+     */
+    @Test
+    @DependsOnMethod("testWKT")
+    public void testMeridianWKT() {
+        assertWktEquals("Axis[“South along 90°W (x)”, south, Meridian[-90.0, AngleUnit[“degree”,
0.017453292519943295]]]",
+                new DefaultCoordinateSystemAxis(singletonMap(DefaultCoordinateSystemAxis.NAME_KEY,
"South along 90°W"),
+                        "x", DirectionAlongMeridian.parse("South along 90°W").getDirection(),
SI.METRE));
+    }
+
+    /**
      * Tests the {@link DefaultCoordinateSystemAxis#isHeuristicMatchForName(String)} method.
      */
     @Test

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java?rev=1568511&r1=1568510&r2=1568511&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
[UTF-8] Fri Feb 14 20:42:02 2014
@@ -21,7 +21,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**
@@ -105,4 +105,13 @@ public final strictfp class DirectionAlo
         assertEquals( +1, m2.compareTo(m1));
         assertFalse (m1.equals(m2));
     }
+
+    /**
+     * Test Well Known Text formatting.
+     */
+    @Test
+    public void testWKT() {
+        assertWktEquals("Meridian[-90.0, AngleUnit[“degree”, 0.017453292519943295]]",
+                DirectionAlongMeridian.parse("South along 90°W"));
+    }
 }



Mime
View raw message