Author: desruisseaux Date: Sun Feb 16 21:04:14 2014 New Revision: 1568827 URL: http://svn.apache.org/r1568827 Log: Minor adjustment to GeodeticCRS WKT formatting.
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCSTest.java Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1568827&r1=1568826&r2=1568827&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Sun Feb 16 21:04:14 2014 @@ -233,7 +233,9 @@ public class DefaultGeographicCRS extend formatter.newLine(); formatter.append(unit); } - formatter.setContextualUnit(Angle.class, oldUnit); + if (unit != null) { // Really 'unit', not 'oldUnit'. + formatter.setContextualUnit(Angle.class, oldUnit); + } formatter.newLine(); // For writing the ID[…] element on its own line. return isWKT1 ? "GeogCS" : "GeodeticCRS"; } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java?rev=1568827&r1=1568826&r2=1568827&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] Sun Feb 16 21:04:14 2014 @@ -16,7 +16,6 @@ */ package org.apache.sis.referencing.cs; -import java.io.Serializable; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.measure.unit.NonSI; @@ -47,14 +46,7 @@ import org.apache.sis.io.wkt.Formatter; * @version 0.4 * @module */ -final class DirectionAlongMeridian extends FormattableObject - implements Comparable<DirectionAlongMeridian>, Serializable -{ - /** - * For cross-version compatibility. - */ - private static final long serialVersionUID = 1602711631943838328L; - +final class DirectionAlongMeridian extends FormattableObject implements Comparable<DirectionAlongMeridian> { /** * A parser for EPSG axis names. Examples: * @@ -250,7 +242,7 @@ final class DirectionAlongMeridian exten */ @Override public int hashCode() { - return Numerics.hashCode(serialVersionUID ^ (Double.doubleToLongBits(meridian) + baseDirection.hashCode())); + return Numerics.hashCode(Double.doubleToLongBits(meridian) + baseDirection.hashCode()); } /** 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=1568827&r1=1568826&r2=1568827&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] Sun Feb 16 21:04:14 2014 @@ -83,15 +83,17 @@ public final strictfp class HardCodedCS /** * A three-dimensional spherical CS with - * <var>{@linkplain HardCodedAxes#SPHERICAL_LONGITUDE longitude}</var>, * <var>{@linkplain HardCodedAxes#SPHERICAL_LATITUDE latitude}</var>, + * <var>{@linkplain HardCodedAxes#SPHERICAL_LONGITUDE longitude}</var>, * <var>{@linkplain HardCodedAxes#GEOCENTRIC_RADIUS radius}</var> * axes. + * This axis order is the one of EPSG:6404. + * Note that this is not a right-handed system. */ public static final DefaultSphericalCS SPHERICAL = new DefaultSphericalCS( singletonMap(NAME_KEY, "Spherical"), - HardCodedAxes.SPHERICAL_LONGITUDE, HardCodedAxes.SPHERICAL_LATITUDE, + HardCodedAxes.SPHERICAL_LONGITUDE, HardCodedAxes.GEOCENTRIC_RADIUS); /** Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCSTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCSTest.java?rev=1568827&r1=1568826&r2=1568827&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCSTest.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCSTest.java [UTF-8] Sun Feb 16 21:04:14 2014 @@ -16,9 +16,11 @@ */ package org.apache.sis.referencing.cs; +import java.util.Collections; import org.opengis.test.Validators; import org.apache.sis.test.TestCase; import org.apache.sis.test.DependsOn; +import org.apache.sis.test.DependsOnMethod; import org.junit.Test; import static org.apache.sis.test.Assert.*; @@ -91,7 +93,6 @@ public final strictfp class HardCodedCST public void testNormalized() { AbstractCS cs; cs = GRID; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); - cs = SPHERICAL; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); cs = GEOCENTRIC; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); cs = CARTESIAN_2D; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); cs = CARTESIAN_3D; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); @@ -101,4 +102,20 @@ public final strictfp class HardCodedCST cs = DAYS; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); cs = ELLIPSOIDAL_HEIGHT; assertSame(cs, cs.forConvention(AxesConvention.NORMALIZED)); } + + /** + * Tests the normalization of a coordinate system. + */ + @Test + @DependsOnMethod("testNormalized") + public void testNormalize() { + final AbstractCS normalized = SPHERICAL.forConvention(AxesConvention.NORMALIZED); + assertNotSame(SPHERICAL, normalized); + assertEquals(new DefaultSphericalCS( + Collections.singletonMap(AbstractCS.NAME_KEY, "Spherical CS: East (deg), North (deg), Up (m)."), + HardCodedAxes.SPHERICAL_LONGITUDE, + HardCodedAxes.SPHERICAL_LATITUDE, + HardCodedAxes.GEOCENTRIC_RADIUS + ), normalized); + } }