sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1564542 - in /sis/branches/JDK7/core: sis-referencing/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/test/java/org/apache/sis/io/wkt/ sis-referencing/src/test/java/org/apache/sis/referencing/ sis-referencing/src/test/java/org/apa...
Date Tue, 04 Feb 2014 22:37:46 GMT
Author: desruisseaux
Date: Tue Feb  4 22:37:45 2014
New Revision: 1564542

URL: http://svn.apache.org/r1564542
Log:
Initial implementation of ID[...], except for the URI inner element.

Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -198,7 +198,7 @@ public class FormattableObject {
      * then this method shall write the content starting at the insertion point shows below:</p>
      *
      * {@preformat text
-     *     GEOGCS["WGS 84", AUTHORITY["EPSG","4326"]]
+     *     GEOGCS["WGS 84", ID["EPSG", 4326]]
      *                    ↑
      *            (insertion point)
      * }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -90,9 +90,9 @@ import org.apache.sis.referencing.operat
  */
 public class Formatter {
     /**
-     * Do not format an {@code "AUTHORITY"} element for instance of this class.
+     * Do not format an {@code ID[…]} element for instance of this class.
      */
-    private static final Class<? extends IdentifiedObject> AUTHORITY_EXCLUDE = CoordinateSystemAxis.class;
+    private static final Class<? extends IdentifiedObject> ID_EXCLUDE = CoordinateSystemAxis.class;
 
     /**
      * Accuracy of geographic bounding boxes, in number of fraction digits.
@@ -231,7 +231,7 @@ public class Formatter {
 
     /**
      * {@code true} if a new line were requested during the execution of {@link #append(FormattableObject)}.
-     * This is used to determine if the next {@code UNIT} and {@code AUTHORITY} elements
shall appear on a new line.
+     * This is used to determine if the next {@code UNIT} and {@code ID} elements shall appear
on a new line.
      */
     private boolean requestNewLine;
 
@@ -453,7 +453,7 @@ public class Formatter {
                 return; // We are the first item inside a new keyword.
             }
             length -= Character.charCount(c);
-        } while (Character.isWhitespace(c));
+        } while (Character.isSpaceChar(c) || c < 32); // c < 32 is for ignoring all
control characters.
         buffer.append(symbols.getSeparator());
         if (newLine && indentation > WKTFormat.SINGLE_LINE) {
             buffer.append(System.lineSeparator()).append(CharSequences.spaces(margin));
@@ -552,39 +552,17 @@ public class Formatter {
             appendScopeAndArea(object);
         }
         /*
-         * Formats the AUTHORITY[<name>,<code>] entity, if there is one. The
entity
-         * will be on the same line than the enclosing one if no line separator were
-         * added (e.g. SPHEROID["Clarke 1866", ..., AUTHORITY["EPSG","7008"]]), or on
-         * a new line otherwise. After this block, the result looks like the following:
+         * Formats the ID[<name>,<code>,…] element. The element will be on
the same line than the enclosing
+         * one if no line separator were requested (e.g. SPHEROID["Clarke 1866", …, ID["EPSG",
7008]]), or
+         * on a new line otherwise. Example:
          *
-         *         <previous text>,
          *           PROJCS["NAD27 / Idaho Central",
          *             GEOGCS[...etc...],
          *             ...etc...
-         *             AUTHORITY["EPSG","26769"]]
+         *             ID["EPSG", 26769]]
          */
-        final Identifier identifier = getIdentifier(info);
-        if (identifier != null && !AUTHORITY_EXCLUDE.isInstance(info)) {
-            String codeSpace = null;
-            if (identifier instanceof ReferenceIdentifier) {
-                codeSpace = ((ReferenceIdentifier) identifier).getCodeSpace();
-            }
-            if (codeSpace == null) {
-                final Citation authority = identifier.getAuthority();
-                if (authority != null) {
-                    codeSpace = Citations.getIdentifier(authority);
-                }
-            }
-            if (codeSpace != null) {
-                openElement("AUTHORITY");
-                quote(codeSpace);
-                final String code = identifier.getCode();
-                if (code != null) {
-                    buffer.append(symbols.getSeparator());
-                    quote(code);
-                }
-                closeElement();
-            }
+        if (!ID_EXCLUDE.isInstance(info)) {
+            append(getIdentifier(info));
         }
         /*
          * Format remarks if any, and close the element.
@@ -637,6 +615,7 @@ public class Formatter {
                 }
                 resetColor();
                 closeElement();
+                requestNewLine = true;
             }
             final Range<Date> timeRange = Extents.getTimeRange(area);
             if (timeRange != null) {
@@ -646,6 +625,7 @@ public class Formatter {
                 append(timeRange.getMaxValue());
                 resetColor();
                 closeElement();
+                requestNewLine = true;
             }
         }
     }
@@ -666,6 +646,58 @@ public class Formatter {
     }
 
     /**
+     * Appends the given identifier in an {@code ID[…]} (WKT 2) or {@code AUTHORITY[…]}
(WKT 1) element.
+     * The identifier may be added on the same line then the previous element or in a new
line depending
+     * on the enclosing element.
+     *
+     * {@example Identifier added on the same line:
+     * <blockquote><pre>SPHEROID["Clarke 1866", …, <b>ID["EPSG", 7008]</b>]</pre></blockquote>}
+     *
+     * {@example Identifier added on a new line:
+     * <blockquote><pre>PROJCS["NAD27 / Idaho Central",
+     *   GEOGCS[...etc...],
+     *   ...etc...
+     *   <b>ID["EPSG", 26769]</b>]</pre></blockquote>}
+     *
+     * @param identifier The identifier to append to the WKT, or {@code null} if none.
+     */
+    public void append(final Identifier identifier) {
+        if (identifier != null) {
+            final String code = identifier.getCode();
+            if (code != null) {
+                String citation  = Citations.getIdentifier(identifier.getAuthority());
+                String codeSpace = null;
+                if (identifier instanceof ReferenceIdentifier) {
+                    codeSpace = ((ReferenceIdentifier) identifier).getCodeSpace();
+                }
+                if (codeSpace == null) {
+                    codeSpace = citation;
+                    citation  = null;
+                }
+                if (codeSpace != null) {
+                    if (convention.isWKT1()) {
+                        openElement("AUTHORITY");
+                        append(codeSpace);
+                        append(code);
+                    } else {
+                        openElement("ID");
+                        append(codeSpace);
+                        appendIntegerOrText(code);
+                        if (identifier instanceof ReferenceIdentifier) {
+                            final String version = ((ReferenceIdentifier) identifier).getVersion();
+                            if (version != null) {
+                                appendIntegerOrText(version);
+                                append(citation);
+                            }
+                        }
+                    }
+                    closeElement();
+                }
+            }
+        }
+    }
+
+    /**
      * Appends the given geographic bounding box in a {@code BBOX[…]} element.
      * Longitude and latitude values will be formatted in decimal degrees.
      * Longitudes are relative to the Greenwich meridian, with values increasing toward East.
@@ -733,17 +765,14 @@ public class Formatter {
         }
         final int numRow = matrix.getNumRow();
         final int numCol = matrix.getNumCol();
-        final int openQuote    = symbols.getOpeningQuote(0);
-        final int closeQuote   = symbols.getClosingQuote(0);
-        final String separator = symbols.getSeparator();
-        final StringBuffer buffer = this.buffer;
+        final int openQuote  = symbols.getOpeningQuote(0);
+        final int closeQuote = symbols.getClosingQuote(0);
         boolean columns = false;
         requestNewLine = true;
         do {
             openElement("PARAMETER");
             quote(columns ? "num_col" : "num_row");
-            buffer.append(separator);
-            format(columns ? numCol : numRow);
+            append(columns ? numCol : numRow);
             closeElement();
         } while ((columns = !columns) == true);
         for (int j=0; j<numRow; j++) {
@@ -755,8 +784,7 @@ public class Formatter {
                     buffer.appendCodePoint(openQuote).append("elt_").append(j)
                             .append('_').append(i).appendCodePoint(closeQuote);
                     resetColor();
-                    buffer.append(separator);
-                    format(element);
+                    append(element);
                     closeElement();
                 }
             }
@@ -797,7 +825,6 @@ public class Formatter {
             setColor(ElementKind.PARAMETER);
             quote(getName(descriptor));
             resetColor();
-            buffer.append(symbols.getSeparator());
             if (unit != null) {
                 double value;
                 try {
@@ -815,7 +842,7 @@ public class Formatter {
                     errorCause = exception;
                     value = Double.NaN;
                 }
-                format(value);
+                append(value);
             } else {
                 appendObject(param.getValue());
             }
@@ -829,16 +856,14 @@ public class Formatter {
      * array elements are appended recursively (i.e. the array may contains sub-array).
      */
     private void appendObject(final Object value) {
-        final StringBuffer buffer = this.buffer;
         if (value == null) {
+            appendSeparator(false);
             buffer.append("null");
         } else if (value.getClass().isArray()) {
+            appendSeparator(false);
             buffer.appendCodePoint(symbols.getOpenSequence());
             final int length = Array.getLength(value);
             for (int i=0; i<length; i++) {
-                if (i != 0) {
-                    buffer.append(symbols.getSeparator());
-                }
                 appendObject(Array.get(value, i));
             }
             buffer.appendCodePoint(symbols.getCloseSequence());
@@ -847,14 +872,15 @@ public class Formatter {
         } else if (value instanceof Number) {
             final Number number = (Number) value;
             if (Numbers.isInteger(number.getClass())) {
-                format(number.longValue());
+                append(number.longValue());
             } else {
-                format(number.doubleValue());
+                append(number.doubleValue());
             }
         } else if (value instanceof Boolean) {
-            buffer.append(((Boolean) value).booleanValue() ? "TRUE" : "FALSE");
+            append(((Boolean) value).booleanValue());
         } else {
-            quote(value.toString());
+            append((value instanceof InternationalString) ?
+                    ((InternationalString) value).toString(locale) : value.toString());
         }
     }
 
@@ -915,8 +941,8 @@ public class Formatter {
 
     /**
      * Appends the given string as a quoted text. If the given string contains the closing
quote character,
-     * that character will be doubled. We check for the closing quote only because it is
the character that
-     * the parser will look for determining the text end.
+     * 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.
      */
     private void quote(final String text) {
         final int base = buffer.appendCodePoint(symbols.getOpeningQuote(0)).length();
@@ -925,20 +951,49 @@ public class Formatter {
     }
 
     /**
-     * Double any closing quote character that may appear at or after the given index,
-     * then append the closing quote character.
+     * Double or delete any closing quote character that may appear at or after the given
index,
+     * then append the closing quote character. The action taken for the quote character
depends
+     * on the WKT version:
+     *
+     * <ul>
+     *   <li>For WKT 2, double the quote as specified in the standard.</li>
+     *   <li>For WKT 1, conservatively delete the quote because the standard does not
said what to do.</li>
+     * </ul>
      */
     private void closeQuote(int fromIndex) {
         final String quote = symbols.getQuote();
         while ((fromIndex = buffer.indexOf(quote, fromIndex)) >= 0) {
             final int n = quote.length();
-            buffer.insert(fromIndex += n, quote);
-            fromIndex += n;
+            if (convention.isWKT1()) {
+                buffer.delete(fromIndex, fromIndex + n);
+            } else {
+                buffer.insert(fromIndex += n, quote);
+                fromIndex += n;
+            }
         }
         buffer.append(quote);
     }
 
     /**
+     * Appends the given text as an integer if possible, or as a text otherwise.
+     *
+     * {@note ISO 19162 specifies "number or text". In Apache SIS, we restrict the numbers
to integers
+     *        because handling version numbers like "8.2" as floating point numbers can be
confusing.}
+     */
+    private void appendIntegerOrText(final String text) {
+        if (text != null) {
+            final long n;
+            try {
+                n = Long.parseLong(text);
+            } catch (NumberFormatException e) {
+                append(text);
+                return;
+            }
+            append(n);
+        }
+    }
+
+    /**
      * Appends a date.
      * The {@linkplain Symbols#getSeparator() element separator} will be written before the
date if needed.
      *
@@ -952,31 +1007,24 @@ public class Formatter {
     }
 
     /**
-     * Appends an integer value.
-     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
number if needed.
+     * Appends a boolean value.
+     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
boolean if needed.
      *
-     * @param number The integer to append to the WKT.
+     * @param value The boolean to append to the WKT.
      */
-    public void append(final long number) {
+    public void append(final boolean value) {
         appendSeparator(false);
-        format(number);
+        buffer.append(value ? "TRUE" : "FALSE");
     }
 
     /**
-     * Appends an floating point value.
+     * Appends an integer value.
      * The {@linkplain Symbols#getSeparator() element separator} will be written before the
number if needed.
      *
-     * @param number The floating point value to append to the WKT.
+     * @param number The integer to append to the WKT.
      */
-    public void append(final double number) {
+    public void append(final long number) {
         appendSeparator(false);
-        format(number);
-    }
-
-    /**
-     * Formats an integer number.
-     */
-    private void format(final long number) {
         setColor(ElementKind.INTEGER);
         numberFormat.setMaximumFractionDigits(0);
         numberFormat.format(number, buffer, dummy);
@@ -984,9 +1032,13 @@ public class Formatter {
     }
 
     /**
-     * Formats a floating point number.
+     * Appends an floating point value.
+     * The {@linkplain Symbols#getSeparator() element separator} will be written before the
number if needed.
+     *
+     * @param number The floating point value to append to the WKT.
      */
-    private void format(double number) {
+    public void append(final double number) {
+        appendSeparator(false);
         setColor(ElementKind.NUMBER);
         /*
          * The 2 below is for using two less fraction digits than the expected number accuracy.

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -18,11 +18,14 @@ package org.apache.sis.io.wkt;
 
 import java.util.Map;
 import java.util.HashMap;
+import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.extent.DefaultExtent;
 import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
 import org.apache.sis.referencing.crs.HardCodedCRS;
@@ -65,18 +68,38 @@ public final strictfp class FormatterTes
         assertNull(properties.put(NAME_KEY, "My “object”."));
         assertNull(properties.put(SCOPE_KEY, "Large scale topographic mapping and cadastre."));
         assertNull(properties.put(REMARKS_KEY, "注です。"));
+        assertNull(properties.put(IDENTIFIERS_KEY, new ImmutableIdentifier(
+                HardCodedCitations.OGP, "EPSG", "4326", "8.2", null)));
         assertNull(properties.put(DOMAIN_OF_VALIDITY_KEY, new DefaultExtent("Netherlands
offshore.",
                 new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77),
                 new DefaultVerticalExtent(10, 1000, HardCodedCRS.DEPTH),
                 new DefaultTemporalExtent()))); // TODO: needs sis-temporal module for testing
that one.
-        assertWktEquals(
+        final IdentifiedObject object = new AbstractReferenceSystem(properties);
+
+        assertWktEquals(Convention.WKT1,
+                // Closing quote conservatively omitted for WKT 1.
+                "ReferenceSystem[“My “object.”, AUTHORITY[“EPSG”, “4326”]]",
+                object);
+
+        assertWktEquals(Convention.WKT2,
                 "ReferenceSystem[“My “object””.”,\n" +
                 "  SCOPE[“Large scale topographic mapping and cadastre.”],\n" +
                 "  AREA[“Netherlands offshore.”],\n" +
                 "  BBOX[51.43, 2.54, 55.77, 6.40],\n" +
                 "  VERTICALEXTENT[-1000, -10, LENGTHUNIT[“metre”, 1.0]],\n" +
+                "  ID[“EPSG”, 4326, “8.2”, “OGP”],\n" +
+                "  REMARKS[“注です。”]]",
+                object);
+
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
+                "ReferenceSystem[“My “object””.”,\n" +
+                "  SCOPE[“Large scale topographic mapping and cadastre.”],\n" +
+                "  AREA[“Netherlands offshore.”],\n" +
+                "  BBOX[51.43, 2.54, 55.77, 6.40],\n" +
+                "  VERTICALEXTENT[-1000, -10],\n" +
+                "  ID[“EPSG”, 4326, “8.2”, “OGP”],\n" +
                 "  REMARKS[“注です。”]]",
-                new AbstractReferenceSystem(properties));
+                object);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/Assert.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -32,6 +32,7 @@ import org.opengis.referencing.cs.Coordi
 import org.opengis.referencing.cs.RangeMeaning;
 import org.apache.sis.io.wkt.Symbols;
 import org.apache.sis.io.wkt.WKTFormat;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.geometry.AbstractEnvelope;
 import org.apache.sis.geometry.GeneralDirectPosition;
 
@@ -332,7 +333,7 @@ public strictfp class Assert extends org
     }
 
     /**
-     * Asserts that the WKT of the given object is equal to the expected one.
+     * Asserts that the WKT 2 of the given object is equal to the expected one.
      * This method expected the {@code “…”} quotation marks instead of {@code "…"}
      * for easier readability of {@link String} constants in Java code.
      *
@@ -340,12 +341,26 @@ public strictfp class Assert extends org
      * @param object The object to format in <cite>Well Known Text</cite> format,
or {@code null}.
      */
     public static void assertWktEquals(final String expected, final Object object) {
+        assertWktEquals(Convention.WKT2, expected, object);
+    }
+
+    /**
+     * Asserts that the WKT of the given object according the given convention is equal to
the expected one.
+     * This method expected the {@code “…”} quotation marks instead of {@code "…"}
for easier readability of
+     * {@link String} constants in Java code.
+     *
+     * @param convention The WKT convention to use.
+     * @param expected   The expected text, or {@code null} if {@code object} is expected
to be null.
+     * @param object     The object to format in <cite>Well Known Text</cite>
format, or {@code null}.
+     */
+    public static void assertWktEquals(final Convention convention, final String expected,
final Object object) {
         if (expected == null) {
             assertNull(object);
         } else {
             assertNotNull(object);
             final String wkt;
             synchronized (WKT_FORMAT) {
+                WKT_FORMAT.setConvention(convention);
                 wkt = WKT_FORMAT.format(object);
             }
             assertMultilinesEquals((object instanceof IdentifiedObject) ?

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -76,8 +76,8 @@ public final strictfp class HardCodedCRS
                 "GEOGCS[“WGS 84”,\n" +
                 "  DATUM[“World Geodetic System 1984”,\n" +
                 "    SPHEROID[“WGS84”, 6378137.0, 298.257223563],\n" +
-                "    AUTHORITY[“EPSG”, “6326”]],\n" +
-                "  PRIMEM[“Greenwich”, 0.0, AUTHORITY[“EPSG”, “8901”]],\n" +
+                "    ID[“EPSG”, 6326]],\n" +
+                "  PRIMEM[“Greenwich”, 0.0, ID[“EPSG”, 8901]],\n" +
                 "  ANGLEUNIT[“degree”, 0.017453292519943295],\n" +
                 "  AXIS[“Geodetic longitude”, EAST],\n" +
                 "  AXIS[“Geodetic latitude”, NORTH],\n" +

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -147,7 +147,7 @@ public final strictfp class DefaultPrime
         assertEquals("Equivalent to 2°20′14.025″.", pm.getRemarks().toString());
         assertNull("name.codeSpace", pm.getName().getCodeSpace());
         assertWktEquals(
-                "PRIMEM[“Paris”, 2.33722917, AUTHORITY[“EPSG”, “8903”],\n" +
+                "PRIMEM[“Paris”, 2.33722917, ID[“EPSG”, 8903],\n" +
                 "REMARKS[“Equivalent to 2°20′14.025″.”]]", pm);
         assertXmlEquals(
                 "<gml:PrimeMeridian xmlns:gml=\"" + Namespaces.GML + "\">\n" +

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -229,9 +229,9 @@ public class SimpleIdentifiedObject impl
      * Returns a pseudo-WKT representation.
      *
      * @param  type       The WKT heading text.
-     * @param  authority  The authority to write in the {@code "AUTHORITY"} element.
+     * @param  authority  The authority to write in the {@code "ID"} element.
      * @param  codespace  Usually an abbreviation of the authority name.
-     * @param  code       The code to write in the {@code "AUTHORITY"} element, or {@code
null} if none.
+     * @param  code       The code to write in the {@code "ID"} element, or {@code null}
if none.
      * @param  deprecated {@code true} if the object to format is deprecated.
      * @return The pseudo-WKT.
      */
@@ -244,7 +244,7 @@ public class SimpleIdentifiedObject impl
         }
         buffer.append(code).append('"');
         if (authority != null) {
-            buffer.append(", AUTHORITY[\"").append(Citations.getIdentifier(authority)).append("\"]");
+            buffer.append(", ID[\"").append(Citations.getIdentifier(authority)).append("\"]");
         }
         if (deprecated) {
             buffer.append(", DEPRECATED");

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleReferenceIdentifier.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -207,9 +207,9 @@ public class SimpleReferenceIdentifier i
      * @return Pseudo Well Known Text for this identifier.
      */
     public String toWKT() {
-        final StringBuilder buffer = new StringBuilder(40).append("AUTHORITY[");
+        final StringBuilder buffer = new StringBuilder(40).append("ID[");
         append(buffer, Citations.getIdentifier(authority)); // Do not invoke getCodeSpace().
-        append(buffer.append(','), code);
+        append(buffer.append(", "), code);
         return buffer.append(']').toString();
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java?rev=1564542&r1=1564541&r2=1564542&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java
[UTF-8] Tue Feb  4 22:37:45 2014
@@ -49,9 +49,9 @@ public final strictfp class SimpleRefere
     @Test
     public void testToWKT() {
         final SimpleCitation authority = new SimpleCitation("EPSG");
-        assertEquals("AUTHORITY[\"EPSG\",\"4326\"]", new SimpleReferenceIdentifier(authority,
"4326").toWKT());
-        assertEquals("AUTHORITY[\"EPSG\",null]",     new SimpleReferenceIdentifier(authority,
 null ).toWKT());
-        assertEquals("AUTHORITY[null,\"4326\"]",     new SimpleReferenceIdentifier(null,
     "4326").toWKT());
-        assertEquals("AUTHORITY[null,null]",         new SimpleReferenceIdentifier(null,
      null ).toWKT());
+        assertEquals("ID[\"EPSG\", \"4326\"]", new SimpleReferenceIdentifier(authority, "4326").toWKT());
+        assertEquals("ID[\"EPSG\", null]",     new SimpleReferenceIdentifier(authority, 
null ).toWKT());
+        assertEquals("ID[null, \"4326\"]",     new SimpleReferenceIdentifier(null,      "4326").toWKT());
+        assertEquals("ID[null, null]",         new SimpleReferenceIdentifier(null,      
null ).toWKT());
     }
 }



Mime
View raw message