sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1569010 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-metadata/src/main/java/org/apache/sis/metadata/iso/ sis-referencing/src/main/java/org/apache/sis/referencing/cs/ sis-referencing/src/main/java/org/...
Date Mon, 17 Feb 2014 14:24:13 GMT
Author: desruisseaux
Date: Mon Feb 17 14:24:12 2014
New Revision: 1569010

URL: http://svn.apache.org/r1569010
Log:
- Format "Anchor" element for all Datum.
- Documentation fixes in "@return The WKT element name, which is..." descriptions.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.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=1569010&r1=1569009&r2=1569010&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 14:24:12 2014
@@ -517,19 +517,21 @@ public class Formatter implements Locali
      * <ul>
      *   <li>Invoke <code>object.{@linkplain FormattableObject#formatTo(Formatter)
formatTo}(this)</code>.</li>
      *   <li>Prepend the keyword returned by the above method call (e.g. {@code "GEOCS"}).</li>
-     *   <li>If the given object is an instance of {@link IdentifiedObject}, then append
complementary information:
-     *     <ul>
-     *       <li>{@code SCOPE[…]} (WKT 2 only)</li>
-     *       <li>{@code AREA[…]}  (WKT 2 only)</li>
-     *       <li>{@code BBOX[…]}  (WKT 2 only)</li>
-     *       <li>{@code VERTICALEXTENT[…]} (WKT 2 only)</li>
-     *       <li>{@code TIMEEXTENT[…]} (WKT 2 only)</li>
-     *       <li>{@code ID[…]} (WKT 2) or {@code AUTHORITY[…]} (WKT 1)</li>
-     *       <li>{@code REMARKS[…]} ({@link ReferenceSystem} and {@link CoordinateOperation}
in WKT 2 only)</li>
-     *     </ul>
-     *   </li>
+     *   <li>If the given object is an instance of {@link IdentifiedObject}, then append
complementary information:</li>
      * </ul>
      *
+     * <blockquote><table class="sis">
+     *   <tr><th>WKT 2 element</th><th>WKT 1 element</th><th>For
types</th></tr>
+     *   <tr><td>{@code Anchor[…]}</td>        <td></td>
<td>{@link Datum}</td></tr>
+     *   <tr><td>{@code Scope[…]}</td>         <td></td>
<td>{@link ReferenceSystem}, {@link Datum}, {@link CoordinateOperation}</td></tr>
+     *   <tr><td>{@code Area[…]}</td>          <td></td>
<td>{@link ReferenceSystem}, {@link Datum}, {@link CoordinateOperation}</td></tr>
+     *   <tr><td>{@code BBox[…]}</td>          <td></td>
<td>{@link ReferenceSystem}, {@link Datum}, {@link CoordinateOperation}</td></tr>
+     *   <tr><td>{@code VerticalExtent[…]}</td><td></td>
<td>{@link ReferenceSystem}, {@link Datum}, {@link CoordinateOperation}</td></tr>
+     *   <tr><td>{@code TimeExtent[…]}</td>    <td></td>
<td>{@link ReferenceSystem}, {@link Datum}, {@link CoordinateOperation}</td></tr>
+     *   <tr><td>{@code Id[…]}</td><td>{@code Authority[…]}</td><td>{@link
IdentifiedObject}</td></tr>
+     *   <tr><td>{@code Remarks[…]}</td>       <td></td>
<td>{@link ReferenceSystem}, {@link CoordinateOperation}</td></tr>
+     * </table></blockquote>
+     *
      * @param object The formattable object to append to the WKT, or {@code null} if none.
      */
     public void append(final FormattableObject object) {
@@ -605,10 +607,11 @@ public class Formatter implements Locali
     }
 
     /**
-     * Appends the optional complementary attributes common to all {@link IdentifiedObject}s.
-     * Those attributes are {@code SCOPE}, {@code AREA}, {@code BBOX}, {@code VERTICALEXTENT},
{@code TIMEEXTENT},
-     * {@code ID} (previously known as {@code AUTHORITY}) and {@code REMARKS}, and have a
special treatment: they
-     * are written by {@link #append(FormattableObject))} after the {@code formatTo(Formatter)}
method returned.
+     * Appends the optional complementary attributes common to many {@link IdentifiedObject}
subtypes.
+     * Those attributes are {@code ANCHOR}, {@code SCOPE}, {@code AREA}, {@code BBOX}, {@code
VERTICALEXTENT},
+     * {@code TIMEEXTENT}, {@code ID} (previously known as {@code AUTHORITY}) and {@code
REMARKS},
+     * and have a special treatment: they are written by {@link #append(FormattableObject))}
+     * after the {@code formatTo(Formatter)} method returned.
      *
      * <p>The {@code ID[<name>,<code>,…]} element is written only for
the root element, unless the convention are
      * INTERNAL. If formatted, the ID element will be on the same line than the enclosing
one if no line separator
@@ -663,7 +666,7 @@ public class Formatter implements Locali
             }
         }
         if (showOthers) {
-            appendScopeAndArea(object);
+            appendForSubtypes(object);
         }
         if (showIDs) {
             Collection<ReferenceIdentifier> identifiers = object.getIdentifiers();
@@ -692,24 +695,28 @@ public class Formatter implements Locali
     }
 
     /**
-     * Appends the scope and domain of validity of the given object. Those information are
available
+     * Appends the anchor, scope and domain of validity of the given object. Those information
are available
      * only for {@link ReferenceSystem}, {@link Datum} and {@link CoordinateOperation} objects.
      */
-    private void appendScopeAndArea(final IdentifiedObject object) {
-        final InternationalString scope;
+    private void appendForSubtypes(final IdentifiedObject object) {
+        final InternationalString anchor, scope;
         final Extent area;
         if (object instanceof ReferenceSystem) {
-            scope = ((ReferenceSystem) object).getScope();
-            area  = ((ReferenceSystem) object).getDomainOfValidity();
+            anchor = null;
+            scope  = ((ReferenceSystem) object).getScope();
+            area   = ((ReferenceSystem) object).getDomainOfValidity();
         } else if (object instanceof Datum) {
-            scope = ((Datum) object).getScope();
-            area  = ((Datum) object).getDomainOfValidity();
+            anchor = ((Datum) object).getAnchorPoint();
+            scope  = ((Datum) object).getScope();
+            area   = ((Datum) object).getDomainOfValidity();
         } else if (object instanceof CoordinateOperation) {
-            scope = ((CoordinateOperation) object).getScope();
-            area  = ((CoordinateOperation) object).getDomainOfValidity();
+            anchor = null;
+            scope  = ((CoordinateOperation) object).getScope();
+            area   = ((CoordinateOperation) object).getDomainOfValidity();
         } else {
             return;
         }
+        appendOnNewLine("Anchor", anchor, null);
         appendOnNewLine("Scope", scope, ElementKind.SCOPE);
         if (area != null) {
             appendOnNewLine("Area", area.getDescription(), ElementKind.EXTENT);
@@ -856,50 +863,23 @@ public class Formatter implements Locali
     }
 
     /**
-     * Appends a code list.
-     *
-     * @param code The code list to append to the WKT, or {@code null} if none.
-     */
-    public void append(final CodeList<?> code) {
-        if (code != null) {
-            appendSeparator();
-            setColor(ElementKind.CODE_LIST);
-            buffer.append(convention.versionOfWKT() == 1 ? code.name() : Types.getCodeName(code));
-            resetColor();
-        }
-    }
-
-    /**
-     * Appends a character string between quotes.
-     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
text if needed.
-     *
-     * @param text The string to format to the WKT, or {@code null} if none.
-     * @param type The key of the colors to apply if syntax coloring is enabled.
-     */
-    public void append(final String text, final ElementKind type) {
-        if (text != null) {
-            appendSeparator();
-            setColor(type);
-            quote(text);
-            resetColor();
-        }
-    }
-
-    /**
      * Appends an international text in an element having the given keyword. Since this method
      * is typically invoked for long descriptions, the element will be written on its own
line.
      *
      * {@example
      *   <ul>
-     *     <li><code>SCOPE["Large scale topographic mapping and cadastre."]</code></li>
-     *     <li><code>AREA["Netherlands offshore."]</code></li>
+     *     <li><code>Scope["Large scale topographic mapping and cadastre."]</code></li>
+     *     <li><code>Area["Netherlands offshore."]</code></li>
      *   </ul>
      * }
      *
-     * @param keyword The keyword. Example: {@code "SCOPE"}, {@code "AREA"} or {@code "REMARKS"}.
+     * @param keyword The {@linkplain KeywordCase#CAMEL_CASE camel-case} keyword.
+     *                Example: {@code "Scope"}, {@code "Area"} or {@code "Remarks"}.
      * @param text The text, or {@code null} if none.
+     * @param type The key of the colors to apply if syntax coloring is enabled.
      */
     private void appendOnNewLine(final String keyword, final InternationalString text, final
ElementKind type) {
+        ArgumentChecks.ensureNonNull("keyword", keyword);
         if (text != null) {
             final String localized = CharSequences.trimWhitespaces(text.toString(locale));
             if (localized != null && !localized.isEmpty()) {
@@ -913,6 +893,22 @@ public class Formatter implements Locali
     }
 
     /**
+     * Appends a character string between quotes.
+     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
text if needed.
+     *
+     * @param text The string to format to the WKT, or {@code null} if none.
+     * @param type The key of the colors to apply if syntax coloring is enabled.
+     */
+    public void append(final String text, final ElementKind type) {
+        if (text != null) {
+            appendSeparator();
+            setColor(type);
+            quote(text);
+            resetColor();
+        }
+    }
+
+    /**
      * Appends the given string as a quoted text. If the given string contains the closing
quote character,
      * that character will be doubled (WKT 2) or deleted (WKT 1). We check for the closing
quote only because
      * it is the character that the parser will look for determining the text end.
@@ -948,6 +944,21 @@ public class Formatter implements Locali
     }
 
     /**
+     * Appends a code list.
+     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
code list if needed.
+     *
+     * @param code The code list to append to the WKT, or {@code null} if none.
+     */
+    public void append(final CodeList<?> code) {
+        if (code != null) {
+            appendSeparator();
+            setColor(ElementKind.CODE_LIST);
+            buffer.append(convention.versionOfWKT() == 1 ? code.name() : Types.getCodeName(code));
+            resetColor();
+        }
+    }
+
+    /**
      * Appends a date.
      * The {@linkplain Symbols#getSeparator() element separator} will be written before the
date if needed.
      *

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -545,7 +545,7 @@ public class ImmutableIdentifier extends
      * See class javadoc for more information on the WKT format.
      *
      * @param  formatter The formatter where to format the inner content of this WKT element.
-     * @return The WKT keyword: {@code "ID"} (WKT 2) or {@code "AUTHORITY"} (WKT 1).
+     * @return The WKT keyword, which is {@code "Id"} (WKT 2) or {@code "Authority"} (WKT
1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -748,7 +748,7 @@ public class DefaultCoordinateSystemAxis
      * </ul>
      *
      * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "AXIS"}.
+     * @return The WKT element name, which is {@code "Axis"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -627,7 +627,7 @@ public class BursaWolfParameters extends
      * is WGS 84. For other targets, the element name will be derived from the datum name.
      *
      * @param  formatter The formatter to use.
-     * @return The WKT element name, usually {@code "TOWGS84"}.
+     * @return The WKT element name, usually {@code "ToWGS84"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -756,7 +756,7 @@ public class DefaultEllipsoid extends Ab
      * 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 "SPHEROID"}.
+     * @return The WKT element name, which is {@code "Ellipsoid"} (WKT 2) or {@code "Spheroid"}
(WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -502,7 +502,7 @@ public class DefaultGeodeticDatum 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 "DATUM"}.
+     * @return The WKT element name, which is {@code "Datum"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -512,12 +512,14 @@ public class DefaultGeodeticDatum extend
         formatter.newLine();
         formatter.append(ellipsoid instanceof FormattableObject ? (FormattableObject) ellipsoid
:
                          DefaultEllipsoid.castOrCopy(ellipsoid));
-        if (bursaWolf != null) {
-            for (final BursaWolfParameters candidate : bursaWolf) {
-                if (candidate.isToWGS84()) {
-                    formatter.newLine();
-                    formatter.append(candidate);
-                    break;
+        if (formatter.getConvention().versionOfWKT() == 1) {
+            if (bursaWolf != null) {
+                for (final BursaWolfParameters candidate : bursaWolf) {
+                    if (candidate.isToWGS84()) {
+                        formatter.newLine();
+                        formatter.append(candidate);
+                        break;
+                    }
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -335,7 +335,7 @@ public class DefaultPrimeMeridian 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 "PRIMEM"}.
+     * @return The WKT element name, which is {@code "PrimeMeridian"} (WKT 2) or {@code "PrimeM"}
(WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1569010&r1=1569009&r2=1569010&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
[UTF-8] Mon Feb 17 14:24:12 2014
@@ -275,6 +275,7 @@ public final strictfp class DefaultGeode
                 "Datum[“World Geodetic System 1984”,\n" +
                 "  Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, Id[“EPSG”, 7030,
Citation[“OGP”]],\n" +
                 "    Remarks[“Defining parameters cited in EPSG database.”]],\n" +
+                "  Anchor[“Station coordinates changed by a few centimetres in 1994, 1997,
2002 and 2012.”],\n" +
                 "  Scope[“Satellite navigation.”],\n" +
                 "  Area[“World.”],\n" +
                 "  BBox[-90.00, -180.00, 90.00, 180.00],\n" +



Mime
View raw message