Author: desruisseaux
Date: Fri Mar 14 10:21:52 2014
New Revision: 1577473

URL: http://svn.apache.org/r1577473
Log:
Missing datum detection when SIS is used with non-SIS implementations.

Modified:
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1577473&r1=1577472&r2=1577473&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
 [UTF-8] Fri Mar 14 10:21:52 2014
@@ -244,7 +244,9 @@ public class AbstractCRS extends Abstrac
      * will override this method with public access and more specific return 
type.
      */
     Datum getDatum() {
-        return null;
+        // User could provide his own CRS implementation outside this SIS 
package, so we have
+        // to check for SingleCRS interface. But all SIS classes override this 
implementation.
+        return (this instanceof SingleCRS) ? ((SingleCRS) this).getDatum() : 
null;
     }
 
     /**

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1577473&r1=1577472&r2=1577473&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
 [UTF-8] Fri Mar 14 10:21:52 2014
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.CompoundCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -269,6 +270,14 @@ public class DefaultCompoundCRS extends 
     }
 
     /**
+     * Compound CRS do not have datum.
+     */
+    @Override
+    final Datum getDatum() {
+        return null;
+    }
+
+    /**
      * Returns the ordered list of coordinate reference systems.
      * This is the list of CRS given at construction time.
      * This list may contains other {@code CompoundCRS} instances, as 
described in class Javadoc.


Reply via email to