sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1709037 [3/3] - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ core...
Date Fri, 16 Oct 2015 15:25:19 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -21,6 +21,7 @@ import java.util.Set;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedHashSet;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
@@ -344,6 +345,7 @@ final class DefaultConcatenatedOperation
      * reserved to JAXB, which will assign values to the fields using reflexion.
      */
     private DefaultConcatenatedOperation() {
+        operations = Collections.emptyList();
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultConversion.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -256,6 +256,8 @@ public class DefaultConversion extends A
              * ProjectedCRS), then DefaultMathTransformFactory has a specialized createBaseToDerived(…)
              * method for this job.
              */
+            final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+            final CoordinateReferenceSystem targetCRS = super.getTargetCRS();
             if (sourceCRS == null && targetCRS == null && factory instanceof
DefaultMathTransformFactory) {
                 transform = ((DefaultMathTransformFactory) factory).createBaseToDerived(
                         source.getCoordinateSystem(), transform,

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -118,7 +118,7 @@ import java.util.Objects;
  * {@link org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory}.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.6
+ * @version 0.7
  * @since   0.5
  * @module
  *
@@ -126,7 +126,7 @@ import java.util.Objects;
  * @see DefaultTransformation
  * @see org.apache.sis.referencing.operation.transform.MathTransformProvider
  */
-@XmlType(name="OperationMethodType", propOrder = {
+@XmlType(name = "OperationMethodType", propOrder = {
     "formulaCitation",
     "formulaDescription",
     "sourceDimensions",
@@ -161,19 +161,25 @@ public class DefaultOperationMethod exte
      * Number of dimensions in the source CRS of this operation method.
      * May be {@code null} if this method can work with any number of
      * source dimensions (e.g. <cite>Affine Transform</cite>).
+     *
+     * <p><b>Consider this field as final!</b>
+     * This field is modified only at unmarshalling time by {@link #setSourceDimensions(Integer)}</p>
+     *
+     * @see #getSourceDimensions()
      */
-    @XmlElement
-    @XmlSchemaType(name = "positiveInteger")
-    private final Integer sourceDimensions;
+    private Integer sourceDimensions;
 
     /**
      * Number of dimensions in the target CRS of this operation method.
      * May be {@code null} if this method can work with any number of
      * target dimensions (e.g. <cite>Affine Transform</cite>).
+     *
+     * <p><b>Consider this field as final!</b>
+     * This field is modified only at unmarshalling time by {@link #setTargetDimensions(Integer)}</p>
+     *
+     * @see #getTargetDimensions()
      */
-    @XmlElement
-    @XmlSchemaType(name = "positiveInteger")
-    private final Integer targetDimensions;
+    private Integer targetDimensions;
 
     /**
      * The set of parameters, or {@code null} if none.
@@ -564,6 +570,8 @@ public class DefaultOperationMethod exte
      * @see org.apache.sis.referencing.operation.transform.AbstractMathTransform#getSourceDimensions()
      */
     @Override
+    @XmlElement(name = "sourceDimensions")
+    @XmlSchemaType(name = "positiveInteger")
     public Integer getSourceDimensions() {
         return sourceDimensions;
     }
@@ -577,6 +585,8 @@ public class DefaultOperationMethod exte
      * @see org.apache.sis.referencing.operation.transform.AbstractMathTransform#getTargetDimensions()
      */
     @Override
+    @XmlElement(name = "targetDimensions")
+    @XmlSchemaType(name = "positiveInteger")
     public Integer getTargetDimensions() {
         return targetDimensions;
     }
@@ -777,8 +787,32 @@ public class DefaultOperationMethod exte
      */
     private DefaultOperationMethod() {
         super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE);
-        sourceDimensions = null;
-        targetDimensions = null;
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time.
+     *
+     * @see #getSourceDimensions()
+     */
+    private void setSourceDimensions(final Integer value) {
+        if (sourceDimensions == null) {
+            sourceDimensions = value;
+        } else {
+            ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class, "setSourceDimensions",
"sourceDimensions");
+        }
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time.
+     *
+     * @see #getTargetDimensions()
+     */
+    private void setTargetDimensions(final Integer value) {
+        if (targetDimensions == null) {
+            targetDimensions = value;
+        } else {
+            ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class, "setTargetDimensions",
"targetDimensions");
+        }
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -17,14 +17,21 @@
 package org.apache.sis.referencing.operation;
 
 import java.util.Map;
+import java.util.Arrays;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.PassThroughOperation;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.CompoundCRS;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.util.UnsupportedImplementationException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.Utilities.deepEquals;
 
@@ -37,10 +44,14 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
-// Missing JAXB annotation. See http://issues.apache.org/jira/browse/SIS-293
+@XmlType(name = "PassThroughOperationType", propOrder = {
+    "indices",
+    "operation"
+})
+@XmlRootElement(name = "PassThroughOperation")
 public class DefaultPassThroughOperation extends AbstractCoordinateOperation implements PassThroughOperation
{
     /**
      * Serial number for inter-operability with different versions.
@@ -49,8 +60,13 @@ public class DefaultPassThroughOperation
 
     /**
      * The operation to apply on the subset of a coordinate tuple.
+     *
+     * <p><b>Consider this field as final!</b>
+     * This field is modified only at unmarshalling time by {@link #setOperation(CoordinateOperation)}</p>
+     *
+     * @see #getOperation()
      */
-    private final CoordinateOperation operation;
+    private CoordinateOperation operation;
 
     /**
      * Constructs a single operation from a set of properties.
@@ -155,6 +171,7 @@ public class DefaultPassThroughOperation
      * @see PassThroughTransform#getSubTransform()
      */
     @Override
+    @XmlElement(name = "coordOperation", required = true)
     public CoordinateOperation getOperation() {
         return operation;
     }
@@ -163,7 +180,7 @@ public class DefaultPassThroughOperation
      * Returns the ordered sequence of indices in a source coordinate tuple of the coordinates
      * affected by this pass-through operation.
      *
-     * @return Indices of the modified source coordinates.
+     * @return Zero-based indices of the modified source coordinates.
      *
      * @see PassThroughTransform#getModifiedCoordinates()
      */
@@ -173,7 +190,27 @@ public class DefaultPassThroughOperation
         if (transform instanceof PassThroughTransform) {
             return ((PassThroughTransform) transform).getModifiedCoordinates();
         } else {
-            // Should not happen since the constructor created the transform itself.
+            /*
+             * Should not happen with objects created by public methods since the constructor
created the transform
+             * itself. However may happen with operations parsed from GML. As a fallback,
search in the components
+             * of CompoundCRS. This is not a universal fallback, but work for the most straightforward
cases.
+             */
+            final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+            if (sourceCRS instanceof CompoundCRS) {
+                int firstAffectedOrdinate = 0;
+                final CoordinateReferenceSystem search = operation.getSourceCRS();
+                for (final CoordinateReferenceSystem c : ((CompoundCRS) sourceCRS).getComponents())
{
+                    final int dim = ReferencingUtilities.getDimension(c);
+                    if (c == search) {
+                        final int[] indices = new int[dim];
+                        for (int i=0; i<dim; i++) {
+                            indices[i] = firstAffectedOrdinate + i;
+                        }
+                        return indices;
+                    }
+                    firstAffectedOrdinate += dim;
+                }
+            }
             throw new UnsupportedImplementationException(transform.getClass());
         }
     }
@@ -210,4 +247,87 @@ public class DefaultPassThroughOperation
     protected long computeHashCode() {
         return super.computeHashCode() + 31 * operation.hashCode();
     }
+
+
+
+
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                            
     ////////
+    ////////                               XML support with JAXB                        
     ////////
+    ////////                                                                            
     ////////
+    ////////        The following methods are invoked by JAXB using reflection (even if 
     ////////
+    ////////        they are private) or are helpers for other methods invoked by JAXB. 
     ////////
+    ////////        Those methods can be safely removed if Geographic Markup Language   
     ////////
+    ////////        (GML) support is not needed.                                        
     ////////
+    ////////                                                                            
     ////////
+    //////////////////////////////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructs a new object in which every attributes are set to a null 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.
+     */
+    private DefaultPassThroughOperation() {
+        /*
+         * A sub-operation is mandatory for SIS working. We do not verify its presence here
because the verification
+         * would have to be done in an 'afterMarshal(…)' method and throwing an exception
in that method causes the
+         * whole unmarshalling to fail. But the CC_CoordinateOperation adapter does some
verifications.
+         */
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time for setting the coordinate operation
+     * applied on the subset of a coordinate tuple.
+     *
+     * @see #getOperation()
+     */
+    private void setOperation(final CoordinateOperation op) {
+        if (operation == null) {
+            operation = op;
+        } else {
+            ReferencingUtilities.propertyAlreadySet(DefaultPassThroughOperation.class, "setOperation",
"coordOperation");
+        }
+    }
+
+    /**
+     * Invoked by JAXB at marshalling time for getting the modified coordinates.
+     * This method converts the zero-based indices to 1-based indices.
+     *
+     * @see #getModifiedCoordinates()
+     */
+    @XmlElement(name = "modifiedCoordinate", required = true)
+    private int[] getIndices() {
+        final int[] indices = getModifiedCoordinates();
+        for (int i=0; i<indices.length; i++) {
+            indices[i]++;
+        }
+        return indices;
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time for setting the modified coordinates.
+     */
+    private void setIndices(final int[] ordinates) {
+        String missing = "sourceCRS";
+        final CoordinateReferenceSystem sourceCRS = super.getSourceCRS();
+        if (sourceCRS != null) {
+            missing = "modifiedCoordinate";
+            if (ordinates != null && ordinates.length != 0) {
+                missing = "coordOperation";
+                if (operation != null) {
+                    for (int i=1; i<ordinates.length; i++) {
+                        final int previous = ordinates[i-1];
+                        if (previous < 1 || ordinates[i] != previous + 1) {
+                            throw new IllegalArgumentException(Errors.format(
+                                    Errors.Keys.CanNotAssign_2, missing, Arrays.toString(ordinates)));
+                        }
+                    }
+                    transform = PassThroughTransform.create(ordinates[0] - 1, operation.getMathTransform(),
+                            ReferencingUtilities.getDimension(sourceCRS) - ordinates[ordinates.length
- 1]);
+                    return;
+                }
+            }
+        }
+        throw new IllegalStateException(Errors.format(Errors.Keys.MissingComponentInElement_2,
missing, "PassThroughOperation"));
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -58,7 +58,9 @@
  * @since   0.6
  * @module
  */
-@XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/coordinateOperations.xsd",
+           elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
+{
     @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
     @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
 })

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -55,8 +55,9 @@ import static org.apache.sis.internal.ut
  * in some relatively rare scenarios like 1 ± x where <var>x</var> is much smaller
than 1.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
+ * @author  Rémi Marechal (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 final class Initializer {
@@ -304,6 +305,29 @@ final class Initializer {
     }
 
     /**
+     * Returns the radius of the conformal sphere at a given latitude.
+     * The radius of conformal sphere is computed from ρ, which is the radius of curvature
in
+     * the meridian at latitude φ, and ν which is the radius of curvature in the prime
vertical,
+     * as below:
+     *
+     * <blockquote>Rc = √(ρ⋅ν) = √(1 – ℯ²) / (1 – ℯ²sin²φ)</blockquote>
+     *
+     * This is a function of latitude and therefore not constant. When used for spherical
projections
+     * the use of φ₀ (or φ₁ as relevant to method) for φ is suggested, except if the
projection is
+     * equal area when the radius of authalic sphere should be used.
+     *
+     * @param  sinφ The sine of the φ latitude.
+     * @return Radius of the conformal sphere at latitude φ.
+     */
+    final double radiusOfConformalSphere(final double sinφ) {
+        final DoubleDouble Rc = verbatim(1);
+        Rc.subtract(excentricitySquared);   //-- 1 - ℯ²
+        Rc.sqrt();                          //-- √(1 - ℯ²)
+        Rc.divide(rν2(sinφ));               //-- √(1 - ℯ²) / (1 - ℯ²sin²φ)
+        return Rc.value;
+    }
+
+    /**
      * Returns the scale factor at latitude φ. This is computed as:
      *
      * <blockquote>cosφ / sqrt(rν2(sinφ))</blockquote>

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -160,7 +160,7 @@
  * @author  Rémi Maréchal (Geomatys)
  * @author  Adrian Custer (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see <a href="http://www.remotesensing.org/geotiff/proj_list">Projections list on
RemoteSensing.org</a>

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -268,7 +268,7 @@ public class PassThroughTransform extend
      * used" fields public in order to keep the flexibility to replace them by a {@code modifiedCoordinates}
      * array in a future SIS version.</div>
      *
-     * @return Indices of the modified source coordinates.
+     * @return Zero-based indices of the modified source coordinates.
      *
      * @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getModifiedCoordinates()
      */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -67,15 +67,18 @@
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
-@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
{
+@XmlSchema(location = "http://schemas.opengis.net/gml/3.2.1/referenceSystems.xsd",
+           elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
+{
     @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
     @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD)
 })
 @XmlAccessorType(XmlAccessType.NONE)
 @XmlJavaTypeAdapters({
+    @XmlJavaTypeAdapter(EX_Extent.class),
     @XmlJavaTypeAdapter(CI_Citation.class),
     @XmlJavaTypeAdapter(RS_Identifier.class),
     @XmlJavaTypeAdapter(StringAdapter.class),

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
[UTF-8] Fri Oct 16 15:25:18 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;
@@ -40,7 +41,7 @@ import static org.apache.sis.test.TestUt
     DefaultTransformationTest.class,
     SingleOperationMarshallingTest.class
 })
-public class DefaultConcatenatedOperationTest extends XMLTestCase {
+public strictfp final class DefaultConcatenatedOperationTest extends XMLTestCase {
     /**
      * An XML file in this package containing a projected CRS definition.
      */
@@ -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.
          */

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=1709037&r1=1709036&r2=1709037&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] Fri Oct 16 15:25:18 2015
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @Suite.SuiteClasses({
@@ -102,6 +102,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class,
 
     // Test map projections. Those tests need the providers tested above.
+    org.apache.sis.referencing.operation.projection.InitializerTest.class,
     org.apache.sis.referencing.operation.projection.NormalizedProjectionTest.class,
     org.apache.sis.referencing.operation.projection.EquirectangularTest.class,
     org.apache.sis.referencing.operation.projection.ConformalProjectionTest.class,
@@ -109,6 +110,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.projection.LambertConicConformalTest.class,
     org.apache.sis.referencing.operation.projection.TransverseMercatorTest.class,
     org.apache.sis.referencing.operation.projection.PolarStereographicTest.class,
+    org.apache.sis.referencing.operation.projection.ObliqueStereographicTest.class,
 
     // Coordinate Reference System components.
     org.apache.sis.referencing.datum.BursaWolfParametersTest.class,
@@ -139,6 +141,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.DefaultTransformationTest.class,
     org.apache.sis.referencing.operation.DefaultConversionTest.class,
     org.apache.sis.referencing.operation.SingleOperationMarshallingTest.class,
+    org.apache.sis.referencing.operation.DefaultPassThroughOperationTest.class,
     org.apache.sis.referencing.operation.DefaultConcatenatedOperationTest.class,
     org.apache.sis.referencing.crs.DefaultProjectedCRSTest.class,
     org.apache.sis.referencing.crs.DefaultDerivedCRSTest.class,

Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/ConcatenatedOperation.xml
Fri Oct 16 15:25:18 2015
@@ -20,8 +20,6 @@
 
 <gml:ConcatenatedOperation xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/datums.xsd"
                            xmlns:gml          = "http://www.opengis.net/gml/3.2"
-                           xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
-                           xmlns:gco          = "http://www.isotc211.org/2005/gco"
                            xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                            xmlns:xlink        = "http://www.w3.org/1999/xlink"
                            gml:id             = "test-coordinateOperation-concatenated">

Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
Fri Oct 16 15:25:18 2015
@@ -114,12 +114,6 @@
     <gmd:MD_ReferenceSystem>
       <gmd:referenceSystemIdentifier>
         <gmd:RS_Identifier>
-          <gmd:code>
-            <gmx:Anchor xlink:href="SDN:L101:2:4326">EPSG:4326</gmx:Anchor>
-          </gmd:code>
-          <gmd:codeSpace>
-            <gco:CharacterString>L101</gco:CharacterString>
-          </gmd:codeSpace>
           <gmd:authority>
             <gmd:CI_Citation>
               <gmd:title>
@@ -140,6 +134,12 @@
               </gmd:identifier>
             </gmd:CI_Citation>
           </gmd:authority>
+          <gmd:code>
+            <gmx:Anchor xlink:href="SDN:L101:2:4326">EPSG:4326</gmx:Anchor>
+          </gmd:code>
+          <gmd:codeSpace>
+            <gco:CharacterString>L101</gco:CharacterString>
+          </gmd:codeSpace>
         </gmd:RS_Identifier>
       </gmd:referenceSystemIdentifier>
     </gmd:MD_ReferenceSystem>

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -47,10 +47,9 @@ package org.apache.sis.internal.jaxb;
  */
 public final class Schemas {
     /**
-     * The root directory of OGC metadata schemas.
-     * This is the schema used by default in Apache SIS.
+     * The XSD definition for Geographic Markup Language (GML) objects.
      */
-    public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/";
+    public static final String GML_XSD = "http://schemas.opengis.net/gml/3.2.1/gml.xsd";
 
     /**
      * The XSD definition for metadata objects.
@@ -58,6 +57,12 @@ public final class Schemas {
     public static final String METADATA_XSD = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
 
     /**
+     * The root directory of OGC metadata schemas.
+     * This is the schema used by default in Apache SIS.
+     */
+    public static final String METADATA_ROOT = "http://schemas.opengis.net/iso/19139/20070417/";
+
+    /**
      * The root directory of ISO metadata schemas.
      * This is sometime used as an alternative to {@link #METADATA_ROOT}.
      */

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -33,6 +33,7 @@ import org.apache.sis.xml.ReferenceResol
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.PrimitiveTypeProperties;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
@@ -601,6 +602,21 @@ public abstract class PropertyType<Value
         return metadata;
     }
 
+    /**
+     * Invoked by subclasses when the unmarshalled object is missing a component.
+     * This method is invoked when the missing component is essential to SIS working.
+     * This method is not invoked if the missing component is flagged as mandatory by GML,
+     * but is not mandatory for SIS working.
+     *
+     * @param  missing The name of the missing XML component.
+     * @throws IllegalArgumentException Always thrown.
+     *
+     * @since 0.7
+     */
+    protected final void incomplete(final String missing) throws IllegalArgumentException
{
+        throw new IllegalArgumentException(Errors.format(Errors.Keys.MissingComponentInElement_2,
getBoundType(), missing));
+    }
+
     /*
      * Do not provide the following method here:
      *

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -36,7 +36,7 @@ import org.apache.sis.util.iso.Types;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.5
+ * @version 0.6
  * @module
  */
 public abstract class EnumAdapter<ValueType extends EnumAdapter<ValueType,BoundType>,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/SC_VerticalCRS.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -21,6 +21,7 @@ import org.opengis.referencing.crs.Verti
 import org.apache.sis.internal.jaxb.gco.PropertyType;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.Classes;
 
 
 /**
@@ -61,7 +62,7 @@ import org.apache.sis.util.resources.Err
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  *
  * @see org.apache.sis.internal.jaxb.AdapterReplacement
@@ -126,11 +127,16 @@ public class SC_VerticalCRS extends Prop
      * of {@link VerticalCRS}, then this method assigns that value to the {@link #metadata}
field.
      * Otherwise this method does nothing.
      *
-     * @param metadata The unmarshalled metadata.
+     * @param crs The unmarshalled metadata.
      */
-    public final void setElement(final Object metadata) {
-        if (metadata instanceof VerticalCRS) {
-            this.metadata = (VerticalCRS) metadata;
+    public final void setElement(final Object crs) {
+        if (crs instanceof VerticalCRS) {
+            metadata = (VerticalCRS) crs;
+            if (metadata.getCoordinateSystem() == null) incomplete("coordinateSystem");
+            if (metadata.getDatum()            == null) incomplete("verticalDatum");
+        } else {
+            Context.warningOccured(Context.current(), SC_VerticalCRS.class, "setElement",
Errors.class,
+                    Errors.Keys.UnexpectedValueInElement_2, "verticalCRS", Classes.getShortClassName(crs));
         }
     }
 }

Modified: sis/branches/JDK7/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml
(original)
+++ sis/branches/JDK7/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml
Fri Oct 16 15:25:18 2015
@@ -33,9 +33,6 @@
     <fra:FRA_DirectReferenceSystem>
       <gmd:referenceSystemIdentifier>
         <gmd:RS_Identifier>
-          <gmd:code>
-            <gco:CharacterString>4326</gco:CharacterString>
-          </gmd:code>
           <gmd:authority>
             <gmd:CI_Citation>
               <gmd:title>
@@ -67,6 +64,9 @@
               </gmd:citedResponsibleParty>
             </gmd:CI_Citation>
           </gmd:authority>
+          <gmd:code>
+            <gco:CharacterString>4326</gco:CharacterString>
+          </gmd:code>
         </gmd:RS_Identifier>
       </gmd:referenceSystemIdentifier>
     </fra:FRA_DirectReferenceSystem>

Modified: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1709037&r1=1709036&r2=1709037&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
[UTF-8] Fri Oct 16 15:25:18 2015
@@ -38,7 +38,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -108,9 +108,9 @@ public final strictfp class MetadataRead
             "  │   │   │   ├─Date………………………………………………………………………
2005-09-22 00:00:00\n" +
             "  │   │   │   └─Date type…………………………………………………………
Creation\n" +
             "  │   │   ├─Identifier\n" +
-            "  │   │   │   ├─Code………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
-            "  │   │   │   └─Authority\n" +
-            "  │   │   │       └─Title…………………………………………………………
edu.ucar.unidata\n" +
+            "  │   │   │   ├─Authority\n" +
+            "  │   │   │   │   └─Title…………………………………………………………
edu.ucar.unidata\n" +
+            "  │   │   │   └─Code………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
             "  │   │   └─Cited responsible party\n" +
             "  │   │       ├─Party\n" +
             "  │   │       │   └─Name……………………………………………………………
NOAA/NWS/NCEP\n" +
@@ -151,9 +151,9 @@ public final strictfp class MetadataRead
             "  ├─Metadata scope\n" +
             "  │   └─Resource scope…………………………………………………………………
Dataset\n" +
             "  ├─Metadata identifier\n" +
-            "  │   ├─Code……………………………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
-            "  │   └─Authority\n" +
-            "  │       └─Title………………………………………………………………………………
edu.ucar.unidata\n" +
+            "  │   ├─Authority\n" +
+            "  │   │   └─Title………………………………………………………………………………
edu.ucar.unidata\n" +
+            "  │   └─Code……………………………………………………………………………………………
NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
             "  ├─Metadata standard (1 of 2)\n" +
             "  │   ├─Title…………………………………………………………………………………………
Geographic Information — Metadata Part 1: Fundamentals\n" +
             "  │   ├─Cited responsible party\n" +




Mime
View raw message