sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1688838 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/test/resources/META-INF/services/ sis-utility/src/main/...
Date Thu, 02 Jul 2015 14:44:26 GMT
Author: desruisseaux
Date: Thu Jul  2 14:44:25 2015
New Revision: 1688838

URL: http://svn.apache.org/r1688838
Log:
WKT 2: fix parsing of Derived Engineering CRS from Projected CRS.
Add an other mock for running GeoAPI test.

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
      - copied, changed from r1688826, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1688838&r1=1688837&r2=1688838&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] Thu Jul  2 14:44:25 2015
@@ -1815,12 +1815,27 @@ final class GeodeticObjectParser extends
             throw new LocalizedParseException(errorLocale, Errors.Keys.IllegalCRSType_1,
                     new Object[] {geoCRS.getClass()}, element.offset);
         }
-        final Unit<Length> linearUnit = parseScaledUnit(element, WKTKeywords.LengthUnit,
SI.METRE);
+        /*
+         * Parse the projection parameters. If a default linear unit is specified, it will
apply to
+         * all parameters that do not specify explicitely a LengthUnit. If no such crs-wide
unit was
+         * specified, then the default will be the unit specified in the parameter descriptor.
+         */
+        Unit<Length> linearUnit = parseScaledUnit(element, WKTKeywords.LengthUnit,
SI.METRE);
         final boolean ignoreUnits = isWKT1 && usesCommonUnits;
         final Conversion conversion = parseDerivingConversion(MANDATORY, element,
                 isWKT1 ? null : WKTKeywords.Conversion, ignoreUnits ? SI.METRE : linearUnit,
                 ignoreUnits ? NonSI.DEGREE_ANGLE : geoCRS.getCoordinateSystem().getAxis(0).getUnit().asType(Angle.class));
-
+        /*
+         * Parse the coordinate system. The linear unit must be specified somewhere, either
explicitely in each axis
+         * or for the whole CRS with the above 'linearUnit' value. If 'linearUnit' is null,
then an exception will be
+         * thrown with a message like "A LengthUnit component is missing in ProjectedCRS".
+         *
+         * However we make an exception if we are parsing a BaseProjCRS, since the coordinate
system is unspecified
+         * in the WKT of base CRS. In this case only, we will default to metre.
+         */
+        if (linearUnit == null && isBaseCRS) {
+            linearUnit = SI.METRE;
+        }
         final CoordinateSystem cs;
         try {
             cs = parseCoordinateSystem(element, WKTKeywords.Cartesian, 2, isWKT1, linearUnit,
geoCRS.getDatum());

Copied: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
(from r1688826, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java&r1=1688826&r2=1688838&rev=1688838&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
[UTF-8] Thu Jul  2 14:44:25 2015
@@ -17,13 +17,15 @@
 package org.apache.sis.internal.referencing.provider;
 
 import javax.measure.unit.SI;
+import javax.measure.unit.NonSI;
+import javax.measure.unit.Unit;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.parameter.ParameterBuilder;
 
 
 /**
- * The provider for <cite>"Geographic/topocentric conversions"</cite> conversion
(EPSG:9837).
+ * The provider for <cite>"P6 (I = J-90°) seismic bin grid transformation"</cite>
transformation (EPSG:1049).
  *
  * This conversion is not yet implemented in Apache SIS, but we need to at least accept the
parameters
  * for a Well Known Text (WKT) parsing test in the {@link org.apache.sis.io.wkt.WKTParserTest}
class.
@@ -36,7 +38,7 @@ import org.apache.sis.parameter.Paramete
  * @module
  */
 @SuppressWarnings("serial")
-public final strictfp class TopocentricConversionMock extends MockProvider {
+public final strictfp class SeismicBinGridMock extends MockProvider {
     /**
      * The group of all parameters expected by this coordinate operation.
      */
@@ -44,20 +46,27 @@ public final strictfp class TopocentricC
     static {
         final ParameterBuilder builder = builder();
         final ParameterDescriptor<?>[] parameters = {
-            createLatitude (builder.addIdentifier("8834").addName("Latitude of topocentric
origin"), true),
-            createLongitude(builder.addIdentifier("8835").addName("Longitude of topocentric
origin")),
-                            builder.addIdentifier("8836").addName("Ellipsoidal height of
topocentric origin").create(Double.NaN, SI.METRE)
+            builder.addIdentifier("8733").addName("Bin grid origin I").create(Double.NaN,
Unit.ONE),
+            builder.addIdentifier("8734").addName("Bin grid origin J").create(Double.NaN,
Unit.ONE),
+            builder.addIdentifier("8735").addName("Bin grid origin Easting").create(Double.NaN,
SI.METRE),
+            builder.addIdentifier("8736").addName("Bin grid origin Northing").create(Double.NaN,
SI.METRE),
+            builder.addIdentifier("8737").addName("Scale factor of bin grid").create(Double.NaN,
Unit.ONE),
+            builder.addIdentifier("8738").addName("Bin width on I-axis").create(Double.NaN,
SI.METRE),
+            builder.addIdentifier("8739").addName("Bin width on J-axis").create(Double.NaN,
SI.METRE),
+            builder.addIdentifier("8740").addName("Map grid bearing of bin grid J-axis").create(Double.NaN,
NonSI.DEGREE_ANGLE),
+            builder.addIdentifier("8741").addName("Bin node increment on I-axis").create(Double.NaN,
Unit.ONE),
+            builder.addIdentifier("8742").addName("Bin node increment on J-axis").create(Double.NaN,
Unit.ONE)
         };
         PARAMETERS = builder
-                .addIdentifier("9837")
-                .addName("Geographic/topocentric conversions")
+                .addIdentifier("1049")
+                .addName("P6 (I = J-90°) seismic bin grid transformation")
                 .createGroup(parameters);
     }
 
     /**
      * Creates a new <cite>"Pole rotation"</cite> operation method.
      */
-    public TopocentricConversionMock() {
-        super(3, 3, PARAMETERS);
+    public SeismicBinGridMock() {
+        super(2, 2, PARAMETERS);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1688838&r1=1688837&r2=1688838&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
[UTF-8] Thu Jul  2 14:44:25 2015
@@ -1,3 +1,4 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.
 org.apache.sis.internal.referencing.provider.PoleRotationMock
 org.apache.sis.internal.referencing.provider.TopocentricConversionMock
+org.apache.sis.internal.referencing.provider.SeismicBinGridMock

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java?rev=1688838&r1=1688837&r2=1688838&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/PatchedUnitFormat.java
[UTF-8] Thu Jul  2 14:44:25 2015
@@ -174,6 +174,8 @@ public final class PatchedUnitFormat ext
             return toAppendTo.append("degree");
         } else if (SI.METRE.equals(unit)) {
             return toAppendTo.append(isLocaleUS ? "meter" : "metre");
+        } else if (NonSI.FOOT_SURVEY_US.equals(unit)) {
+            return toAppendTo.append("US survey foot");
         } else if (Units.PPM.equals(unit)) {
             return toAppendTo.append("parts per million");
         }



Mime
View raw message