Author: desruisseaux
Date: Tue Jan 14 08:48:24 2014
New Revision: 1557975

URL: http://svn.apache.org/r1557975
Log:
More conservative check for perpendicular axis: accept grid coordinate systems.

Modified:
    
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/DefaultCartesianCS.java

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=1557975&r1=1557974&r2=1557975&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] Tue Jan 14 08:48:24 2014
@@ -195,18 +195,6 @@ public final class AxisDirections extend
     }
 
     /**
-     * Returns {@code true} if the given direction is {@code OTHER} or a 
user-defined direction.
-     *
-     * @param  dir The direction to test, or {@code null}.
-     * @return {@code true} if the given direction is {@code OTHER} or a 
user-defined direction.
-     */
-    public static boolean isCustom(final AxisDirection dir) {
-        if (dir == null) return false;
-        final int ordinal = dir.ordinal();
-        return ordinal <= OTHER.ordinal() || ordinal > DISPLAY_DOWN.ordinal();
-    }
-
-    /**
      * Returns {@code true} if the given direction is a spatial axis direction 
(including vertical and geocentric axes).
      * The current implementation conservatively returns {@code true} for 
every non-null directions except a hard-coded
      * set of directions which are known to be non-spatial. We conservatively 
accept unknown axis directions because

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=1557975&r1=1557974&r2=1557975&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 08:48:24 2014
@@ -22,7 +22,6 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.measure.Angle;
 
@@ -196,15 +195,10 @@ public class DefaultCartesianCS extends 
             for (int j=i; ++j<dimension;) {
                 final AxisDirection axis1 = getAxis(j).getDirection();
                 final Angle angle = CoordinateSystems.angle(axis0, axis1);
-                if (angle != null) {
-                    if (Math.abs(angle.degrees()) == 90) {
-                        continue; // Axes are perpendicular.
-                    }
-                } else if (AxisDirections.isCustom(axis0) || 
AxisDirections.isCustom(axis1)) {
-                    continue; // If we do not recognize an axis, assume that 
the user know what he is doing.
+                if (angle != null && Math.abs(angle.degrees()) != 90) {
+                    throw new IllegalArgumentException(Errors.format(
+                            Errors.Keys.NonPerpendicularDirections_2, axis0, 
axis1));
                 }
-                throw new IllegalArgumentException(Errors.format(
-                        Errors.Keys.NonPerpendicularDirections_2, axis0, 
axis1));
             }
         }
     }


Reply via email to