sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1684221 [2/2] - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ core/sis-metadata/src...
Date Mon, 08 Jun 2015 16:56:56 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -30,6 +30,7 @@ import org.opengis.referencing.cs.Ellips
 import org.opengis.referencing.datum.TemporalDatum;
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
+import org.apache.sis.internal.metadata.AxisNames;
 import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.test.DependsOnMethod;
@@ -142,11 +143,11 @@ public final strictfp class CommonCRSTes
             final VerticalDatumType datumType;
             final String axisName, datumName;
             switch (e) {
-                case BAROMETRIC:     axisName = "Barometric altitude";    datumName = "Constant
pressure surface"; datumType = VerticalDatumType. BAROMETRIC;    break;
-                case MEAN_SEA_LEVEL: axisName = "Gravity-related height"; datumName = "Mean
Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case DEPTH:          axisName = "Depth";                  datumName = "Mean
Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case ELLIPSOIDAL:    axisName = "Ellipsoidal height";     datumName = "Ellipsoid";
                datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
-                case OTHER_SURFACE:  axisName = "Height";                 datumName = "Other
surface";             datumType = VerticalDatumType. OTHER_SURFACE; break;
+                case BAROMETRIC:     axisName = "Barometric altitude";            datumName
= "Constant pressure surface"; datumType = VerticalDatumType. BAROMETRIC;    break;
+                case MEAN_SEA_LEVEL: axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName
= "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
+                case DEPTH:          axisName = AxisNames.DEPTH;                  datumName
= "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
+                case ELLIPSOIDAL:    axisName = AxisNames.ELLIPSOIDAL_HEIGHT;     datumName
= "Ellipsoid";                 datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
+                case OTHER_SURFACE:  axisName = "Height";                         datumName
= "Other surface";             datumType = VerticalDatumType. OTHER_SURFACE; break;
                 default: throw new AssertionError(e);
             }
             final String        name  = e.name();

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -33,6 +33,7 @@ import org.opengis.referencing.cs.Cartes
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.RangeMeaning;
 import org.opengis.referencing.crs.GeodeticCRS;
+import org.apache.sis.internal.metadata.AxisNames;
 
 import static org.apache.sis.test.Assert.*;
 
@@ -308,8 +309,8 @@ public final strictfp class GeodeticObje
         final CoordinateSystemAxis N = cs.getAxis(1);
         assertNotNull("axis", E);
         assertNotNull("axis", N);
-        assertEquals("axis[0].name",         "Easting",           E.getName().getCode());
-        assertEquals("axis[1].name",         "Northing",          N.getName().getCode());
+        assertEquals("axis[0].name",         AxisNames.EASTING,   E.getName().getCode());
+        assertEquals("axis[1].name",         AxisNames.NORTHING,  N.getName().getCode());
         assertEquals("axis[0].abbreviation", "E",                 E.getAbbreviation());
         assertEquals("axis[1].abbreviation", "N",                 N.getAbbreviation());
         assertEquals("axis[0].direction",    AxisDirection.EAST,  E.getDirection());
@@ -363,14 +364,14 @@ public final strictfp class GeodeticObje
         final CoordinateSystemAxis longitude = cs.getAxis(1);
         assertNotNull("axis", latitude);
         assertNotNull("axis", longitude);
-        assertEquals("axis[0].name",      "Geodetic latitude",  latitude .getName().getCode());
-        assertEquals("axis[1].name",      "Geodetic longitude", longitude.getName().getCode());
-        assertEquals("axis[0].direction", AxisDirection.NORTH,  latitude .getDirection());
-        assertEquals("axis[1].direction", AxisDirection.EAST,   longitude.getDirection());
-        assertEquals("axis[0].unit",      NonSI.DEGREE_ANGLE,   latitude .getUnit());
-        assertEquals("axis[1].unit",      NonSI.DEGREE_ANGLE,   longitude.getUnit());
-        verifyRange(latitude,   -90,  +90, RangeMeaning.EXACT, isRangeMandatory);
-        verifyRange(longitude, -180, +180, RangeMeaning.WRAPAROUND, isRangeMandatory);
+        assertEquals("axis[0].name",       AxisNames.GEODETIC_LATITUDE,  latitude .getName().getCode());
+        assertEquals("axis[1].name",       AxisNames.GEODETIC_LONGITUDE, longitude.getName().getCode());
+        assertEquals("axis[0].direction",  AxisDirection.NORTH,          latitude .getDirection());
+        assertEquals("axis[1].direction",  AxisDirection.EAST,           longitude.getDirection());
+        assertEquals("axis[0].unit",       NonSI.DEGREE_ANGLE,           latitude .getUnit());
+        assertEquals("axis[1].unit",       NonSI.DEGREE_ANGLE,           longitude.getUnit());
+        verifyRange(latitude,   -90,  +90, RangeMeaning.EXACT,           isRangeMandatory);
+        verifyRange(longitude, -180, +180, RangeMeaning.WRAPAROUND,      isRangeMandatory);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -38,7 +38,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.6
  * @module
  */
 @DependsOn({
@@ -205,4 +205,44 @@ public final strictfp class DefaultGeogr
                 "  BBox[-90.00, -180.00, 90.00, 180.00]]",
                 HardCodedCRS.WGS84);
     }
+
+    /**
+     * Tests WKT 2 formatting on a CRS using a prime meridian other than Greenwich.
+     *
+     * <p>This CRS used in this test is equivalent to {@code EPSG:4807} except for
axis order,
+     * since EPSG defines (<var>latitude</var>, <var>longitude</var>)
in grades.</p>
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_ForNonGreenwich() {
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
+                "GeodeticCRS[“NTF (Paris)”,\n" +
+                "  Datum[“Nouvelle Triangulation Francaise”,\n" +           // Formatter
should replace "ç" by "c".
+                "    Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+                "    PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”, 0.015707963267948967]],\n"
+
+                "  CS[“ellipsoidal”, 2],\n" +
+                "    Axis[“Longitude (L)”, east],\n" +                      // See method
javadoc.
+                "    Axis[“Latitude (B)”, north],\n" +
+                "    Unit[“grade”, 0.015707963267948967]]",
+                HardCodedCRS.NTF);
+    }
+
+    /**
+     * Tests WKT 1 formatting using {@link Convention#WKT1_COMMON_UNITS}. That convention
ignores the unit of
+     * measurement in {@code PRIMEM} element, and rather unconditionally interpret the angle
unit as degrees.
+     * This is a violation of OGC 01-009 and ISO 19162 standards, but is required for compatibility
with GDAL.
+     */
+    @Test
+    @DependsOnMethod("testWKT2_ForNonGreenwich")
+    public void testWKT1_WithCommonUnits() {
+        assertWktEquals(Convention.WKT1_COMMON_UNITS,
+                "GEOGCS[“NTF (Paris)”,\n" +
+                "  DATUM[“Nouvelle Triangulation Francaise”,\n" +   // Formatter should
replace "ç" by "c".
+                "    SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+                "    PRIMEM[“Paris”, 2.33722917],\n" +              // Would be 2.5969213
in standard-compliant WKT.
+                "  UNIT[“grade”, 0.015707963267948967],\n" +
+                "  AXIS[“Longitude”, EAST],\n" +
+                "  AXIS[“Latitude”, NORTH]]",
+                HardCodedCRS.NTF);
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -22,6 +22,7 @@ import javax.measure.unit.Unit;
 import javax.xml.bind.JAXBException;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.test.Validators;
 import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.referencing.GeodeticObjectBuilder;
@@ -55,11 +56,13 @@ public final strictfp class DefaultProje
     private static final String XML_FILE = "NTF.xml";
 
     /**
-     * Creates the "NTF (Paris) / Lambert zone II" CRS.
+     * Creates the "NTF (Paris) / Lambert zone II" CRS. The prime meridian is always in grades,
+     * but the axes can be in degrees or in grades depending if the {@code baseCRS} argument
is
+     * {@link HardCodedCRS.NTF_NORMALIZED_AXES} or {@link HardCodedCRS.NTF} respectively.
      *
      * @see HardCodedCRS#NTF
      */
-    private static ProjectedCRS create() throws FactoryException {
+    private static ProjectedCRS create(final GeographicCRS baseCRS) throws FactoryException
{
         return new GeodeticObjectBuilder()
                 .setConversionMethod("Lambert Conic Conformal (1SP)")
                 .setConversionName("Lambert zone II")
@@ -70,7 +73,7 @@ public final strictfp class DefaultProje
                 .setCodeSpace(Citations.EPSG, Constants.EPSG)
                 .addName("NTF (Paris) / Lambert zone II")
                 .addIdentifier("27572")
-                .createProjectedCRS(HardCodedCRS.NTF, HardCodedCS.PROJECTED);
+                .createProjectedCRS(baseCRS, HardCodedCS.PROJECTED);
     }
 
     /**
@@ -80,7 +83,40 @@ public final strictfp class DefaultProje
      */
     @Test
     public void testWKT1() throws FactoryException {
-        final ProjectedCRS crs = create();
+        final ProjectedCRS crs = create(HardCodedCRS.NTF);
+        assertWktEquals(Convention.WKT1,
+                "PROJCS[“NTF (Paris) / Lambert zone II”,\n" +
+                "  GEOGCS[“NTF (Paris)”,\n" +
+                "    DATUM[“Nouvelle Triangulation Francaise”,\n" +
+                "      SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+                "      PRIMEM[“Paris”, 2.5969213],\n" +
+                "    UNIT[“grade”, 0.015707963267948967],\n" +
+                "    AXIS[“Longitude”, EAST],\n" +
+                "    AXIS[“Latitude”, NORTH]],\n" +
+                "  PROJECTION[“Lambert_Conformal_Conic_1SP”, AUTHORITY[“EPSG”, “9801”]],\n"
+
+                "  PARAMETER[“latitude_of_origin”, 52.0],\n" +
+                "  PARAMETER[“central_meridian”, 0.0],\n" +
+                "  PARAMETER[“scale_factor”, 0.99987742],\n" +
+                "  PARAMETER[“false_easting”, 600000.0],\n" +
+                "  PARAMETER[“false_northing”, 2200000.0],\n" +
+                "  UNIT[“metre”, 1],\n" +
+                "  AXIS[“Easting”, EAST],\n" +
+                "  AXIS[“Northing”, NORTH],\n" +
+                "  AUTHORITY[“EPSG”, “27572”]]",
+                crs);
+    }
+
+    /**
+     * Tests WKT 1 formatting with a somewhat convolved case where the units of the prime
meridian is not
+     * the same than the unit of axes. Since the axis units is what we write in the {@code
UNIT[…]} element,
+     * the WKT formatter need to convert the unit of prime meridian and all parameter angular
values.
+     *
+     * @throws FactoryException if the CRS creation failed.
+     */
+    @Test
+    @DependsOnMethod("testWKT1")
+    public void testWKT1_WithMixedUnits() throws FactoryException {
+        final ProjectedCRS crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
         Validators.validate(crs);   // Opportunist check.
         assertWktEquals(Convention.WKT1,
                 "PROJCS[“NTF (Paris) / Lambert zone II”,\n" +
@@ -105,14 +141,15 @@ public final strictfp class DefaultProje
     }
 
     /**
-     * Tests WKT 2 formatting.
+     * Tests WKT 2 formatting. Contrarily to the WKT 1 formatting, in this case it does not
matter
+     * if we mix the units of measurement because the unit is declared for each parameter
and axis.
      *
      * @throws FactoryException if the CRS creation failed.
      */
     @Test
     @DependsOnMethod("testWKT1")
     public void testWKT2() throws FactoryException {
-        final ProjectedCRS crs = create();
+        final ProjectedCRS crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
         assertWktEquals(Convention.WKT2,
                 "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" +
                 "  BaseGeodCRS[“NTF (Paris)”,\n" +
@@ -134,6 +171,85 @@ public final strictfp class DefaultProje
                 crs);
     }
 
+    /**
+     * Tests WKT 1 formatting of a pseudo-projection with explicit {@code "semi-major"} and
{@code "semi-minor"}
+     * parameter values. This was a way to define the Google pseudo-projection using standard
projection method
+     * name before EPSG introduced the <cite>"Popular Visualisation Pseudo Mercator"</cite>
projection method.
+     * The approach tested in this method is now deprecated at least for the Google projection
(while it may
+     * still be useful for other projections), but we still test it for compatibility reasons.
+     *
+     * @throws FactoryException if the CRS creation failed.
+     */
+    @Test
+    @DependsOnMethod("testWKT1")
+    public void testWKT1_WithExplicitAxisLength() throws FactoryException {
+        final ProjectedCRS crs = new GeodeticObjectBuilder()
+                .setConversionMethod("Mercator (variant A)")
+                .setConversionName("Popular Visualisation Pseudo-Mercator")
+                .setParameter("semi-major", 6378137, SI.METRE)
+                .setParameter("semi-minor", 6378137, SI.METRE)
+                .addName("WGS 84 / Pseudo-Mercator")
+                .createProjectedCRS(HardCodedCRS.WGS84, HardCodedCS.PROJECTED);
+
+        assertWktEquals(Convention.WKT1,
+                "PROJCS[“WGS 84 / Pseudo-Mercator”,\n" +
+                "  GEOGCS[“WGS 84”,\n" +
+                "    DATUM[“World Geodetic System 1984”,\n" +
+                "      SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
+                "      PRIMEM[“Greenwich”, 0.0],\n" +
+                "    UNIT[“degree”, 0.017453292519943295],\n" +
+                "    AXIS[“Longitude”, EAST],\n" +
+                "    AXIS[“Latitude”, NORTH]],\n" +
+                "  PROJECTION[“Mercator_1SP”, AUTHORITY[“EPSG”, “9804”]],\n"
+
+                "  PARAMETER[“semi_minor”, 6378137.0],\n" +     // Non-standard: appears
because its value is different than the ellipsoid value.
+                "  PARAMETER[“latitude_of_origin”, 0.0],\n" +
+                "  PARAMETER[“central_meridian”, 0.0],\n" +
+                "  PARAMETER[“scale_factor”, 1.0],\n" +
+                "  PARAMETER[“false_easting”, 0.0],\n" +
+                "  PARAMETER[“false_northing”, 0.0],\n" +
+                "  UNIT[“metre”, 1],\n" +
+                "  AXIS[“Easting”, EAST],\n" +
+                "  AXIS[“Northing”, NORTH]]",
+                crs);
+    }
+
+    /**
+     * Tests formatting of “Equidistant Cylindrical (Spherical)” projected CRS. This
one is a special case
+     * because it is simplified to an affine transform. The referencing module should be
able to find the
+     * original projection parameters.
+     *
+     * @throws FactoryException if the CRS creation failed.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_ForEquirectangular() throws FactoryException {
+        final ProjectedCRS crs = new GeodeticObjectBuilder()
+                .setConversionMethod("Equirectangular")
+                .setConversionName("Equidistant Cylindrical (Spherical)")
+                .setParameter("False easting",  1000, SI.METRE)
+                .setParameter("False northing", 2000, SI.METRE)
+                .addName("Equidistant Cylindrical (Spherical)")
+                .createProjectedCRS(HardCodedCRS.WGS84, HardCodedCS.PROJECTED);
+
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
+                "ProjectedCRS[“Equidistant Cylindrical (Spherical)”,\n" +
+                "  BaseGeodCRS[“WGS 84”,\n" +
+                "    Datum[“World Geodetic System 1984”,\n" +
+                "      Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
+                "    Unit[“degree”, 0.017453292519943295]],\n" +
+                "  Conversion[“Equidistant Cylindrical (Spherical)”,\n" +
+                "    Method[“Equidistant Cylindrical (Spherical)”],\n" +
+                "    Parameter[“Latitude of 1st standard parallel”, 0.0],\n" +
+                "    Parameter[“Longitude of natural origin”, 0.0],\n" +
+                "    Parameter[“False easting”, 1000.0, Unit[“metre”, 1]],\n" +
+                "    Parameter[“False northing”, 2000.0, Unit[“metre”, 1]]],\n" +
+                "  CS[“Cartesian”, 2],\n" +
+                "    Axis[“Easting (E)”, east],\n" +
+                "    Axis[“Northing (N)”, north],\n" +
+                "    Unit[“metre”, 1]]",
+                crs);
+    }
+
     /**
      * Tests (un)marshalling of a projected coordinate reference system.
      *

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -77,17 +77,33 @@ public final strictfp class HardCodedCRS
      * A two-dimensional geographic coordinate reference system using the Paris prime meridian.
      * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
      * increasing towards the East and latitude values increasing towards the North.
+     * The angular units for the prime meridian and the axes are grades.
+     *
+     * <p>This CRS is equivalent to {@code EPSG:4807} except for axis order, since
EPSG defines
+     * (<var>latitude</var>, <var>longitude</var>).</p>
+     *
+     * @since 0.6
+     */
+    public static final DefaultGeographicCRS NTF = new DefaultGeographicCRS(
+            Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, "NTF (Paris)"),
+            HardCodedDatum.NTF, HardCodedCS.ELLIPSOIDAL_gon);
+
+    /**
+     * A two-dimensional geographic coordinate reference system using the Paris prime meridian.
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
+     * increasing towards the East and latitude values increasing towards the North.
      * The angular units are decimal degrees except for the prime meridian (Paris),
      * which is measured in grades.
      *
      * <p>This CRS is equivalent to {@code EPSG:4807} except for axis order and units
of measurement,
      * since EPSG defines (<var>latitude</var>, <var>longitude</var>)
in grades. The main purpose of
-     * this CRS is to test operations between CRS having different prime meridian.</p>
+     * this CRS is to test the convolved case where the unit of prime meridian is different
than the
+     * axis units.</p>
      *
-     * @since 0.5
+     * @since 0.6
      */
-    public static final DefaultGeographicCRS NTF = new DefaultGeographicCRS(
-            Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, "NTF (Paris)"),
+    public static final DefaultGeographicCRS NTF_NORMALIZED_AXES = new DefaultGeographicCRS(
+            Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, NTF.getName()),
             HardCodedDatum.NTF, HardCodedCS.GEODETIC_2D);
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -23,6 +23,7 @@ import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.RangeMeaning;
+import org.apache.sis.internal.metadata.AxisNames;
 
 
 /**
@@ -46,7 +47,7 @@ public final strictfp class HardCodedAxe
      * @see #SPHERICAL_LONGITUDE
      * @see #GEODETIC_LATITUDE
      */
-    public static final DefaultCoordinateSystemAxis GEODETIC_LONGITUDE = create("Geodetic
longitude", "λ",
+    public static final DefaultCoordinateSystemAxis GEODETIC_LONGITUDE = create(AxisNames.GEODETIC_LONGITUDE,
"λ",
             AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
 
     /**
@@ -61,37 +62,37 @@ public final strictfp class HardCodedAxe
      * @see #SPHERICAL_LATITUDE
      * @see #GEODETIC_LONGITUDE
      */
-    public static final DefaultCoordinateSystemAxis GEODETIC_LATITUDE = create("Geodetic
latitude", "φ",
+    public static final DefaultCoordinateSystemAxis GEODETIC_LATITUDE = create(AxisNames.GEODETIC_LATITUDE,
"φ",
             AxisDirection.NORTH, NonSI.DEGREE_ANGLE, -90, 90, RangeMeaning.EXACT);
 
     /**
      * Identical to {@link #GEODETIC_LONGITUDE} except for the range of longitude values.
      */
-    public static final DefaultCoordinateSystemAxis SHIFTED_LONGITUDE = create("Geodetic
longitude", "λ",
+    public static final DefaultCoordinateSystemAxis SHIFTED_LONGITUDE = create(AxisNames.GEODETIC_LONGITUDE,
"λ",
             AxisDirection.EAST, NonSI.DEGREE_ANGLE, 0, 360, RangeMeaning.WRAPAROUND);
 
     /**
      * Axis for longitudes in gradian units.
-     * The axis name is {@code "Longitude"} (the {@code "Geodetic" } prefix is omitted for
testing purpose).
+     * The axis name is {@code "Longitude"} (the {@code "Geodetic"} prefix is omitted for
testing purpose).
      * Increasing ordinates values go {@linkplain AxisDirection#EAST East} and units are
{@link NonSI#GRADE}.
      * The abbreviation is "λ" (lambda). The unit symbol is "gon".
      *
      * @see #GEODETIC_LONGITUDE
      * @see #SPHERICAL_LONGITUDE
      */
-    public static final DefaultCoordinateSystemAxis LONGITUDE_gon = create("Longitude", "λ",
+    public static final DefaultCoordinateSystemAxis LONGITUDE_gon = create(AxisNames.LONGITUDE,
"λ",
             AxisDirection.EAST, NonSI.GRADE, -200, 200, RangeMeaning.WRAPAROUND);
 
     /**
      * Axis for latitudes in gradian units.
-     * The axis name is {@code "Latitude"} (the {@code "Geodetic" } prefix is omitted for
testing purpose).
+     * The axis name is {@code "Latitude"} (the {@code "Geodetic"} prefix is omitted for
testing purpose).
      * Increasing ordinates values go {@linkplain AxisDirection#NORTH North} and units are
{@link NonSI#GRADE}.
      * The abbreviation is "φ" (phi). The unit symbol is "gon".
      *
      * @see #GEODETIC_LATITUDE
      * @see #SPHERICAL_LATITUDE
      */
-    public static final DefaultCoordinateSystemAxis LATITUDE_gon = create("Latitude", "φ",
+    public static final DefaultCoordinateSystemAxis LATITUDE_gon = create(AxisNames.LATITUDE,
"φ",
             AxisDirection.NORTH, NonSI.GRADE, -100, 100, RangeMeaning.EXACT);
 
     /**
@@ -108,7 +109,7 @@ public final strictfp class HardCodedAxe
      * @see #GRAVITY_RELATED_HEIGHT
      * @see #DEPTH
      */
-    public static final DefaultCoordinateSystemAxis ELLIPSOIDAL_HEIGHT = create("Ellipsoidal
height", "h",
+    public static final DefaultCoordinateSystemAxis ELLIPSOIDAL_HEIGHT = create(AxisNames.ELLIPSOIDAL_HEIGHT,
"h",
             AxisDirection.UP, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -121,7 +122,7 @@ public final strictfp class HardCodedAxe
      * @see #GEOCENTRIC_RADIUS
      * @see #DEPTH
      */
-    public static final DefaultCoordinateSystemAxis GRAVITY_RELATED_HEIGHT = create("Gravity-related
height", "H",
+    public static final DefaultCoordinateSystemAxis GRAVITY_RELATED_HEIGHT = create(AxisNames.GRAVITY_RELATED_HEIGHT,
"H",
             AxisDirection.UP, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -156,7 +157,7 @@ public final strictfp class HardCodedAxe
      * @see #GEOCENTRIC_RADIUS
      * @see #GRAVITY_RELATED_HEIGHT
      */
-    public static final DefaultCoordinateSystemAxis DEPTH = create("Depth", "D",
+    public static final DefaultCoordinateSystemAxis DEPTH = create(AxisNames.DEPTH, "D",
             AxisDirection.DOWN, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -173,7 +174,7 @@ public final strictfp class HardCodedAxe
      * @see #GRAVITY_RELATED_HEIGHT
      * @see #DEPTH
      */
-    public static final DefaultCoordinateSystemAxis GEOCENTRIC_RADIUS = create("Geocentric
radius", "r",
+    public static final DefaultCoordinateSystemAxis GEOCENTRIC_RADIUS = create(AxisNames.GEOCENTRIC_RADIUS,
"r",
             AxisDirection.UP, SI.METRE, 0, Double.POSITIVE_INFINITY, RangeMeaning.EXACT);
 
     /**
@@ -189,7 +190,7 @@ public final strictfp class HardCodedAxe
      * @see #GEODETIC_LONGITUDE
      * @see #SPHERICAL_LATITUDE
      */
-    public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create("Spherical
longitude", "θ",
+    public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create(AxisNames.SPHERICAL_LONGITUDE,
"θ",
             AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
 
     /**
@@ -197,7 +198,7 @@ public final strictfp class HardCodedAxe
      * using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
      * Increasing ordinates values go {@linkplain AxisDirection#NORTH North}
      * and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
-     * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation
is "φ′" (phi).
+     * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation
is "φ′" (phi prime).
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
      * {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -205,7 +206,7 @@ public final strictfp class HardCodedAxe
      * @see #GEODETIC_LATITUDE
      * @see #SPHERICAL_LONGITUDE
      */
-    public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create("Spherical
latitude", "φ′",
+    public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create(AxisNames.SPHERICAL_LATITUDE,
"φ′",
             AxisDirection.NORTH, NonSI.DEGREE_ANGLE, -90, 90, RangeMeaning.EXACT);
 
     /**
@@ -262,7 +263,7 @@ public final strictfp class HardCodedAxe
      *
      * <p>This axis is usually part of a {@link #GEOCENTRIC_X}, {@link #GEOCENTRIC_Y},
{@link #GEOCENTRIC_Z} set.</p>
      */
-    public static final DefaultCoordinateSystemAxis GEOCENTRIC_X = create("Geocentric X",
"X",
+    public static final DefaultCoordinateSystemAxis GEOCENTRIC_X = create(AxisNames.GEOCENTRIC_X,
"X",
             AxisDirection.GEOCENTRIC_X, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -277,7 +278,7 @@ public final strictfp class HardCodedAxe
      *
      * <p>This axis is usually part of a {@link #GEOCENTRIC_X}, {@link #GEOCENTRIC_Y},
{@link #GEOCENTRIC_Z} set.</p>
      */
-    public static final DefaultCoordinateSystemAxis GEOCENTRIC_Y = create("Geocentric Y",
"Y",
+    public static final DefaultCoordinateSystemAxis GEOCENTRIC_Y = create(AxisNames.GEOCENTRIC_Y,
"Y",
             AxisDirection.GEOCENTRIC_Y, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -292,7 +293,7 @@ public final strictfp class HardCodedAxe
      *
      * <p>This axis is usually part of a {@link #GEOCENTRIC_X}, {@link #GEOCENTRIC_Y},
{@link #GEOCENTRIC_Z} set.</p>
      */
-    public static final DefaultCoordinateSystemAxis GEOCENTRIC_Z = create("Geocentric Z",
"Z",
+    public static final DefaultCoordinateSystemAxis GEOCENTRIC_Z = create(AxisNames.GEOCENTRIC_Z,
"Z",
             AxisDirection.GEOCENTRIC_Z, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -306,7 +307,7 @@ public final strictfp class HardCodedAxe
      * @see #EASTING
      * @see #WESTING
      */
-    public static final DefaultCoordinateSystemAxis EASTING = create("Easting", "E",
+    public static final DefaultCoordinateSystemAxis EASTING = create(AxisNames.EASTING, "E",
             AxisDirection.EAST, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -318,7 +319,7 @@ public final strictfp class HardCodedAxe
      * @see #EASTING
      * @see #WESTING
      */
-    public static final DefaultCoordinateSystemAxis WESTING = create("Westing", "W",
+    public static final DefaultCoordinateSystemAxis WESTING = create(AxisNames.WESTING, "W",
             AxisDirection.WEST, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -332,7 +333,7 @@ public final strictfp class HardCodedAxe
      * @see #NORTHING
      * @see #SOUTHING
      */
-    public static final DefaultCoordinateSystemAxis NORTHING = create("Northing", "N",
+    public static final DefaultCoordinateSystemAxis NORTHING = create(AxisNames.NORTHING,
"N",
             AxisDirection.NORTH, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -344,7 +345,7 @@ public final strictfp class HardCodedAxe
      * @see #NORTHING
      * @see #SOUTHING
      */
-    public static final DefaultCoordinateSystemAxis SOUTHING = create("Southing", "S",
+    public static final DefaultCoordinateSystemAxis SOUTHING = create(AxisNames.SOUTHING,
"S",
             AxisDirection.SOUTH, SI.METRE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**
@@ -404,7 +405,7 @@ public final strictfp class HardCodedAxe
      * and the unit is dimensionless. This constant is sometime used as a placeholder
      * for axes that were not properly defined.
      */
-    public static final DefaultCoordinateSystemAxis UNDEFINED = create("Undefined", "?",
+    public static final DefaultCoordinateSystemAxis UNDEFINED = create("Undefined", "z",
             AxisDirection.OTHER, Unit.ONE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
null);
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -75,6 +75,8 @@ public final strictfp class HardCodedCS
      * <var>{@linkplain HardCodedAxes#LONGITUDE_gon longitude}</var>,
      * <var>{@linkplain HardCodedAxes#LATITUDE_gon latitude}</var>
      * axes (without "Geodetic" prefix) in gradians.
+     *
+     * <p>This coordinate system is used for testing unit conversions without axes
swapping.</p>
      */
     public static final DefaultEllipsoidalCS ELLIPSOIDAL_gon = new DefaultEllipsoidalCS(
             singletonMap(NAME_KEY, "Ellipsoidal (gon)"),

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConversionTest.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -114,7 +114,7 @@ public final strictfp class DefaultConve
      * @return A pseudo-conversion performing a longitude rotation.
      */
     public static DefaultConversion createLongitudeRotation(final boolean useGreenwich) {
-        return createLongitudeRotation(HardCodedCRS.NTF,
+        return createLongitudeRotation(HardCodedCRS.NTF_NORMALIZED_AXES,
                 createParisCRS(false, HardCodedCS.GEODETIC_2D, useGreenwich), null);
     }
 
@@ -303,7 +303,7 @@ public final strictfp class DefaultConve
     @Test
     @DependsOnMethod("testDefiningConversion")
     public void testWithInterpolationCRS() throws FactoryException {
-        DefaultConversion op = createLongitudeRotation(HardCodedCRS.NTF,
+        DefaultConversion op = createLongitudeRotation(HardCodedCRS.NTF_NORMALIZED_AXES,
                 createParisCRS(false, HardCodedCS.GEODETIC_2D, true), HardCodedCRS.TIME);
         assertMatrixEquals("Longitude rotation of a time-varying CRS", new Matrix4(
                 1, 0, 0, 0,
@@ -334,7 +334,7 @@ public final strictfp class DefaultConve
         final MathTransformFactory factory = DefaultFactories.forBuildin(MathTransformFactory.class);
         final DefaultConversion op = createLongitudeRotation(true);
         try {
-            op.specialize(Conversion.class, HardCodedCRS.WGS84, HardCodedCRS.NTF, factory);
+            op.specialize(Conversion.class, HardCodedCRS.WGS84, HardCodedCRS.NTF_NORMALIZED_AXES,
factory);
             fail("Should not have accepted to change the geodetic datum.");
         } catch (IllegalArgumentException e) {
             final String message = e.getMessage();
@@ -342,7 +342,7 @@ public final strictfp class DefaultConve
             assertTrue(message, message.contains("Nouvelle Triangulation Française"));
         }
         try {
-            op.specialize(Conversion.class, HardCodedCRS.NTF, HardCodedCRS.WGS84, factory);
+            op.specialize(Conversion.class, HardCodedCRS.NTF_NORMALIZED_AXES, HardCodedCRS.WGS84,
factory);
             fail("Should not have accepted to change the geodetic datum.");
         } catch (IllegalArgumentException e) {
             final String message = e.getMessage();

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=1684221&r1=1684220&r2=1684221&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] Mon Jun  8 16:56:55 2015
@@ -142,6 +142,7 @@ import org.junit.BeforeClass;
 
     org.apache.sis.io.wkt.MathTransformParserTest.class,
     org.apache.sis.io.wkt.GeodeticObjectParserTest.class,
+    org.apache.sis.io.wkt.WKTFormatTest.class,
 
     org.apache.sis.geometry.AbstractDirectPositionTest.class,
     org.apache.sis.geometry.GeneralDirectPositionTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -1351,8 +1351,8 @@ searchWordBreak:    while (true) {
                     wantChar = true;
                 } else if (Character.isUpperCase(c)) {
                     // Test for mixed-case (e.g. "northEast").
-                    // Note that the buffer is guaranteed to contain at least 1 character.
-                    if (isLowerCase(buffer.codePointBefore(buffer.length()))) {
+                    // Note that i is guaranteed to be greater than 0 here.
+                    if (!Character.isUpperCase(Character.codePointBefore(text, i))) {
                         buffer.appendCodePoint(c);
                     }
                 }

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1684221&r1=1684220&r2=1684221&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
[UTF-8] Mon Jun  8 16:56:55 2015
@@ -318,6 +318,7 @@ public final strictfp class CharSequence
         assertEquals("NE",  camelCaseToAcronym("North-East").toString());
         assertEquals("NE",  camelCaseToAcronym("NORTH_EAST").toString());
         assertEquals("NE",  camelCaseToAcronym("northEast").toString());
+        assertEquals("SSE", camelCaseToAcronym("southSouthEast").toString());
         assertNull(camelCaseToAcronym(null));
     }
 



Mime
View raw message