sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1708564 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/jaxb/referencing/ main/java/org/apache/sis/referencing/crs/ main/java/org/apache/sis/referencing/operation/ test/java/org/apache/sis/referencing/op...
Date Wed, 14 Oct 2015 09:04:33 GMT
Author: desruisseaux
Date: Wed Oct 14 09:04:32 2015
New Revision: 1708564

URL: http://svn.apache.org/viewvc?rev=1708564&view=rev
Log:
More documentation explaining the reason for the (object instanceof DefaultGeodeticCRS) check
(side-effect of the work on ConcatenatedOperation GML support).

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_SingleCRS.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java?rev=1708564&r1=1708563&r2=1708564&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_CRS.java
[UTF-8] Wed Oct 14 09:04:32 2015
@@ -84,6 +84,13 @@ public final class SC_CRS extends Proper
     /**
      * Invoked by JAXB at unmarshalling time for storing the result temporarily.
      *
+     * <div class="note"><b>Note:</b>
+     * the unmarshalled CRS may be of {@code GeodeticCRS} type, which is not the most specific
GeoAPI type.
+     * But the {@code GeographicCRS} and {@code GeocentricCRS} sub-types are currently not
part of ISO 19111.
+     * We could substitute the CRS by a more specific type here, but this would break the
references specified
+     * by {@code xlink:href} attributes. For now we live with the {@code GeodeticCRS} as-is
— most of Apache SIS
+     * should be able to work with that.</div>
+     *
      * @param crs The unmarshalled element.
      */
     public void setElement(final AbstractCRS crs) {

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_SingleCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_SingleCRS.java?rev=1708564&r1=1708563&r2=1708564&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_SingleCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/SC_SingleCRS.java
[UTF-8] Wed Oct 14 09:04:32 2015
@@ -86,6 +86,10 @@ public final class SC_SingleCRS extends
     /**
      * Invoked by JAXB at unmarshalling time for storing the result temporarily.
      *
+     * <div class="note"><b>Note:</b>
+     * the unmarshalled CRS may be of {@code GeodeticCRS} type, which is not the most specific
GeoAPI type.
+     * See {@link SC_CRS#setElement(AbstractCRS)} for more discussion.</div>
+     *
      * @param crs The unmarshalled element.
      * @throws IllegalArgumentException if the unmarshalled CRS is not a single CRS.
      */

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java?rev=1708564&r1=1708563&r2=1708564&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
[UTF-8] Wed Oct 14 09:04:32 2015
@@ -119,15 +119,19 @@ final class SubTypes implements Comparat
             if (object instanceof GeocentricCRS) {
                 return DefaultGeocentricCRS.castOrCopy((GeocentricCRS) object);
             }
-            if (object instanceof DefaultGeodeticCRS) {     // Result of XML unmarshalling
- keep as-is.
-                return (DefaultGeodeticCRS) object;
-            }
             /*
              * The GeographicCRS and GeocentricCRS types are not part of ISO 19111.
              * ISO uses a single type, GeodeticCRS, for both of them and infer the
              * geographic or geocentric type from the coordinate system. We do this
-             * check here for instantiating the most appropriate SIS type.
+             * check here for instantiating the most appropriate SIS type, but only
+             * if we need to create a new object anyway (see below for rational).
              */
+            if (object instanceof DefaultGeodeticCRS) {
+                // Result of XML unmarshalling — keep as-is. We avoid creating a new object
because it
+                // would break object identities specified in GML document by the xlink:href
attribute.
+                // However we may revisit this policy in the future. See SC_CRS.setElement(AbstractCRS).
+                return (DefaultGeodeticCRS) object;
+            }
             final Map<String,?> properties = IdentifiedObjects.getProperties(object);
             final GeodeticDatum datum = ((GeodeticCRS) object).getDatum();
             final CoordinateSystem cs = object.getCoordinateSystem();

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1708564&r1=1708563&r2=1708564&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] Wed Oct 14 09:04:32 2015
@@ -180,7 +180,7 @@ public class AbstractCoordinateOperation
      *
      * <p><b>Consider this field as final!</b>
      * This field is non-final only for the convenience of constructors and for initialization
-     * at XML unmarshalling time by {@link #afterUnmarshal(Unmarshaller, Object)}</p>
+     * at XML unmarshalling time by {@link AbstractSingleOperation#afterUnmarshal(Unmarshaller,
Object)}</p>
      */
     MathTransform transform;
 

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1708564&r1=1708563&r2=1708564&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
[UTF-8] Wed Oct 14 09:04:32 2015
@@ -16,8 +16,9 @@
  */
 package org.apache.sis.referencing.operation;
 
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import javax.xml.bind.JAXBException;
+import org.opengis.referencing.crs.GeodeticCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.test.Validators;
 import org.apache.sis.test.DependsOn;
@@ -66,9 +67,11 @@ public class DefaultConcatenatedOperatio
         assertIdentifierEquals("targetCRS.identifier", "test", "test", null, "target",  
    getSingleton(targetCRS.getIdentifiers()));
         assertIdentifierEquals(    "step1.identifier", "test", "test", null, "step-1",  
    getSingleton(step1    .getIdentifiers()));
         assertIdentifierEquals(    "step2.identifier", "test", "test", null, "step-2",  
    getSingleton(step2    .getIdentifiers()));
-        assertSame("tmp CRS",   step1.getTargetCRS(), step2.getSourceCRS());
+        assertInstanceOf("sourceCRS", GeodeticCRS.class, sourceCRS);
+        assertInstanceOf("targetCRS", GeodeticCRS.class, targetCRS);
         assertSame("sourceCRS", step1.getSourceCRS(), sourceCRS);
         assertSame("targetCRS", step2.getTargetCRS(), targetCRS);
+        assertSame("tmp CRS",   step1.getTargetCRS(), step2.getSourceCRS());
         /*
          * Test marshalling and compare with the original file.
          */



Mime
View raw message