sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1701515 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/crs/ test/java/org/apache/sis/referencing/crs/ test/resources/org/apache/sis/referencing/crs/
Date Sun, 06 Sep 2015 19:01:57 GMT
Author: desruisseaux
Date: Sun Sep  6 19:01:57 2015
New Revision: 1701515

URL: http://svn.apache.org/r1701515
Log:
A little bit more tests.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1701515&r1=1701514&r2=1701515&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
[UTF-8] Sun Sep  6 19:01:57 2015
@@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.ValidationException;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.crs.SingleCRS;
@@ -34,7 +35,6 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.operation.DefaultConversion;
-import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.referencing.CC_Conversion;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.metadata.ReferencingServices;
@@ -320,7 +320,7 @@ abstract class AbstractDerivedCRS<C exte
      * coordinate system (CS). The CS information is required by {@code createConversionFromBase(…)}
      * in order to create a {@link MathTransform} with correct axis swapping and unit conversions.
      */
-    private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
+    private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) throws ValidationException
{
         String property = "conversion";
         if (conversionFromBase != null) {
             final SingleCRS baseCRS = CC_Conversion.setBaseCRS(conversionFromBase, null);
 // Clear the temporary value now.
@@ -338,7 +338,6 @@ abstract class AbstractDerivedCRS<C exte
          * and call to 'getConversionFromBase()' will throw a ClassCastException if this
instance is actually
          * a ProjectedCRS (because of the method overriding with return type covariance).
          */
-        Context.warningOccured(Context.current(), AbstractDerivedCRS.class, "afterUnmarshal",
-                Errors.class, Errors.Keys.MissingValueForProperty_1, property);
+        throw new ValidationException(Errors.format(Errors.Keys.MissingValueForProperty_1,
property));
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1701515&r1=1701514&r2=1701515&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] Sun Sep  6 19:01:57 2015
@@ -24,6 +24,8 @@ import org.opengis.util.FactoryException
 import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.operation.Projection;
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.test.Validators;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.referencing.cs.HardCodedCS;
@@ -409,9 +411,21 @@ public final strictfp class DefaultProje
         final DefaultProjectedCRS crs = unmarshalFile(DefaultProjectedCRS.class, XML_FILE);
         Validators.validate(crs);
         assertEpsgNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 27572, crs);
-        assertEpsgNameAndIdentifierEqual("Lambert zone II", 18082, crs.getConversionFromBase());
+        assertEpsgNameAndIdentifierEqual("NTF (Paris)", 4807, crs.getBaseCRS());
         assertEquals("scope", "Large and medium scale topographic mapping and engineering
survey.", crs.getScope().toString());
         assertAxisDirectionsEqual("baseCRS", crs.getBaseCRS().getCoordinateSystem(), AxisDirection.NORTH,
AxisDirection.EAST);
-        assertAxisDirectionsEqual("baseCRS", crs.getCoordinateSystem(), AxisDirection.EAST,
AxisDirection.NORTH);
+        assertAxisDirectionsEqual("coordinateSystem", crs.getCoordinateSystem(), AxisDirection.EAST,
AxisDirection.NORTH);
+
+        final Projection conversion = crs.getConversionFromBase();
+        final ParameterValueGroup pg = conversion.getParameterValues();
+        assertEpsgNameAndIdentifierEqual("Lambert zone II", 18082, conversion);
+        assertEpsgNameAndIdentifierEqual("Lambert Conic Conformal (1SP)", 9801, conversion.getMethod());
+        assertEquals("Latitude of natural origin",    52,          pg.parameter("Latitude
of natural origin")    .doubleValue(NonSI.GRADE), STRICT);
+        assertEquals("Longitude of natural origin",    0,          pg.parameter("Longitude
of natural origin")   .doubleValue(NonSI.GRADE), STRICT);
+        assertEquals("Scale factor at natural origin", 0.99987742, pg.parameter("Scale factor
at natural origin").doubleValue(),            STRICT);
+        assertEquals("False easting",             600000,          pg.parameter("False easting")
                .doubleValue(SI.METRE),    STRICT);
+        assertEquals("False northing",           2200000,          pg.parameter("False northing")
               .doubleValue(SI.METRE),    STRICT);
+
+        assertNotNull("conversion.mathTransform", conversion.getMathTransform());
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml?rev=1701515&r1=1701514&r2=1701515&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml
(original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/ProjectedCRS.xml
Sun Sep  6 19:01:57 2015
@@ -34,7 +34,7 @@
       <gml:method>
         <gml:OperationMethod gml:id="epsg-method-9801">
           <gml:identifier codeSpace="IOGP">urn:ogc:def:method:EPSG::9801</gml:identifier>
-          <gml:name>Lambert Conic Conformal (1SP)</gml:name>
+          <gml:name codeSpace="EPSG">Lambert Conic Conformal (1SP)</gml:name>
           <gml:formula>See EPSG Guidance Note #7-2.</gml:formula>
           <gml:sourceDimensions>2</gml:sourceDimensions>
           <gml:targetDimensions>2</gml:targetDimensions>
@@ -139,7 +139,7 @@
   <gml:baseGeodeticCRS>
     <gml:GeodeticCRS gml:id="epsg-crs-4807">
       <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4807</gml:identifier>
-      <gml:name>NTF (Paris)</gml:name>
+      <gml:name codeSpace="EPSG">NTF (Paris)</gml:name>
       <gml:scope>Geodetic survey.</gml:scope>
       <gml:ellipsoidalCS>
         <gml:EllipsoidalCS gml:id="epsg-cs-6422">



Mime
View raw message