sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1569045 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/main/java/org/apache/sis/referencing/crs/ sis-referencing/src/main/java/org/apache/sis/referencing/datum/ sis-referencing/src/test/...
Date Mon, 17 Feb 2014 16:28:31 GMT
Author: desruisseaux
Date: Mon Feb 17 16:28:31 2014
New Revision: 1569045

URL: http://svn.apache.org/r1569045
Log:
WKT 2 keywords for VerticalCRS and EngineeringCRS.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -378,7 +378,7 @@ public class Formatter implements Locali
      * @see WKTFormat#setConvention(Convention)
      * @see FormattableObject#toString(Convention)
      */
-    public Convention getConvention() {
+    public final Convention getConvention() {
         return convention;
     }
 
@@ -397,7 +397,7 @@ public class Formatter implements Locali
      * @see WKTFormat#getNameAuthority()
      * @see org.apache.sis.referencing.IdentifiedObjects#getName(IdentifiedObject, Citation)
      */
-    public Citation getNameAuthority() {
+    public final Citation getNameAuthority() {
         return authority;
     }
 
@@ -408,7 +408,7 @@ public class Formatter implements Locali
      * @return The locale to use for localizing international strings.
      */
     @Override
-    public Locale getLocale() {
+    public final Locale getLocale() {
         return locale;
     }
 

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -254,11 +254,11 @@ public class DefaultEngineeringCRS exten
      * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
      *
      * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "LOCAL_CS"}.
+     * @return The name of the WKT element type, which is {@code "EngineeringCRS"} (WKT 2)
or {@code "Local_CS"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return "Local_CS";
+        return (formatter.getConvention().versionOfWKT() == 1) ? "Local_CS" : "EngineeringCRS";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -232,11 +232,11 @@ public class DefaultVerticalCRS extends 
      * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
      *
      * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "VERT_CS"}.
+     * @return The name of the WKT element type, which is {@code "VerticalCRS"} (WKT 2) or
{@code "Vert_CS"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return "Vert_CS";
+        return (formatter.getConvention().versionOfWKT() == 1) ? "Vert_CS" : "VerticalCRS";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -335,10 +335,9 @@ public class AbstractDatum extends Abstr
 
     /**
      * Gets the type of the datum as an enumerated code. Datum type was provided for all
kind of datum
-     * in the legacy OGC 01-009 specification. In the new OGC 03-73 (ISO 19111) specification,
-     * datum type is provided only for vertical datum. Nevertheless, we keep this method
around
-     * since it is needed for WKT formatting. Note that we return the datum type ordinal
value,
-     * not the code list object.
+     * in the legacy OGC 01-009 specification. Datum types became provided only for vertical
datum in
+     * the ISO 19111:2003 specification, then removed completely in the ISO 19111:2007 revision.
+     * We keep this method around only for WKT 1 formatting.
      */
     int getLegacyDatumType() {
         return 0;
@@ -440,17 +439,15 @@ public class AbstractDatum extends Abstr
     /**
      * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
      *
-     * {@note All subclasses will override this method, but only <code>DefaultGeodeticDatum</code>
-     *        will <strong>not</strong> invoke this parent method, because horizontal
datum do not
-     *        write the datum type.}
-     *
      * @param  formatter The formatter to use.
      * @return The WKT element name.
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         final String keyword = super.formatTo(formatter);
-        formatter.append(getLegacyDatumType());
+        if (formatter.getConvention().versionOfWKT() == 1) {
+            formatter.append(getLegacyDatumType());
+        }
         return keyword;
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -164,14 +164,14 @@ public class DefaultEngineeringDatum ext
 
     /**
      * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
-     * The keyword is "{@code LOCAL_DATUM}" in WKT 1.
      *
      * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "LOCAL_DATUM"}.
+     * @return The name of the WKT element type, which is
+     *         {@code "EngineeringDatum"} (WKT 2) or {@code "Local_Datum"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return "Local_Datum";
+        return (formatter.getConvention().versionOfWKT() == 1) ? "Local_Datum" : "EngineeringDatum";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -247,7 +247,9 @@ public class DefaultVerticalDatum extend
     }
 
     /**
-     * Returns the legacy code for the datum type, or 0 if none.
+     * Gets the type of the datum as an enumerated code. Datum type was provided for all
kind of datum
+     * in the legacy OGC 01-009 specification. Datum type became provided only for vertical
datum in
+     * the ISO 19111:2003 specification, then removed completely in ISO 19111:2007.
      *
      * @see #getVerticalDatumType()
      */
@@ -319,11 +321,11 @@ public class DefaultVerticalDatum extend
      * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
      *
      * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "VERT_DATUM"}.
+     * @return The WKT element name, which is {@code "VerticalDatum"} (WKT 2) or {@code "Vert_Datum"}
(WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return "Vert_Datum";
+        return (formatter.getConvention().versionOfWKT() == 1) ? "Vert_Datum" : "VerticalDatum";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java?rev=1569045&r1=1569044&r2=1569045&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] Mon Feb 17 16:28:31 2014
@@ -23,6 +23,7 @@ import javax.xml.bind.JAXBException;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.Version;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.MarshallerPool;
@@ -89,10 +90,12 @@ public final strictfp class DefaultVerti
     public void testToWKT() {
         DefaultVerticalDatum datum;
         datum = new DefaultVerticalDatum(singletonMap(DefaultVerticalDatum.NAME_KEY, "Geoidal"),
VerticalDatumType.GEOIDAL);
-        assertWktEquals("Vert_Datum[“Geoidal”, 2005]", datum);
+        assertWktEquals(Convention.WKT1, "VERT_DATUM[“Geoidal”, 2005]", datum);
+        assertWktEquals(Convention.WKT2, "VerticalDatum[“Geoidal”]", datum);
 
         datum = new DefaultVerticalDatum(singletonMap(DefaultVerticalDatum.NAME_KEY, "Ellipsoidal"),
VerticalDatumTypes.ELLIPSOIDAL);
-        assertWktEquals("Vert_Datum[“Ellipsoidal”, 2002]", datum);
+        assertWktEquals(Convention.WKT1, "VERT_DATUM[“Ellipsoidal”, 2002]", datum);
+        assertWktEquals(Convention.WKT2, "VerticalDatum[“Ellipsoidal”]", datum);
     }
 
     /**



Mime
View raw message