sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1569492 - 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/parameter/ sis-referencing/src/main/java/org/apach...
Date Tue, 18 Feb 2014 19:25:37 GMT
Author: desruisseaux
Date: Tue Feb 18 19:25:36 2014
New Revision: 1569492

URL: http://svn.apache.org/r1569492
Log:
Javadoc, and add units in WKT 2 formatting of parameters.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.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/parameter/DefaultParameterDescriptor.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.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/DefaultGeographicCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.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/cs/AbstractCS.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/cs/DirectionAlongMeridian.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/DefaultEngineeringDatum.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/DefaultImageDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.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/parameter/DefaultParameterValueTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -194,13 +194,13 @@ public abstract class FormattableObject 
      * This method is automatically invoked by {@link WKTFormat} when a formattable element
is found.
      *
      * <p>Keywords, opening and closing brackets shall not be formatted here.
-     * For example if this formattable element is for a {@code ID[…]} element,
+     * For example if this formattable element is for a {@code GeodeticCRS[…]} element,
      * then this method shall write the content starting at the insertion point shown below:</p>
      *
      * {@preformat text
-     *        ID[ ]
-     *           ↑
-     *   (insertion point)
+     *   GeodeticCRS[ ]
+     *               ↑
+     *       (insertion point)
      * }
      *
      * {@section Formatting non-standard WKT}
@@ -211,11 +211,11 @@ public abstract class FormattableObject 
      *
      * <p>Alternatively, the implementation may also have no WKT keyword for this object.
      * This happen frequently when an abstract class defines a base implementation,
-     * but the keyword is defined by the concrete subclasses.
+     * while the keyword needs to be defined by the concrete subclasses.
      * In such case, the method in the abstract class shall return {@code null}.</p>
      *
      * @param  formatter The formatter where to format the inner content of this WKT element.
-     * @return The WKT element keyword, or {@code null} if none.
+     * @return The {@linkplain KeywordCase#CAMEL_CASE CamelCase} keyword for the WKT element,
or {@code null} if unknown.
      *
      * @see #toWKT()
      * @see #toString()

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordCase.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -18,9 +18,9 @@ package org.apache.sis.io.wkt;
 
 
 /**
- * Whether WKT keywords shall be written with upper cases or camel cases.
+ * Whether WKT keywords shall be written with upper case or CamelCase styles.
  * The most common usage for WKT keywords is upper case.
- * However with version 2 of Well Known Text, camel case may be easier to read
+ * However with version 2 of Well Known Text, CamelCase keywords may be easier to read
  * because WKT 2 has more keywords made by combination of words. Examples:
  *
  * <table class="sis">
@@ -53,13 +53,14 @@ public enum KeywordCase {
     DEFAULT,
 
     /**
-     * Keywords are written with camel cases. This is more useful in WKT 2 strings, which
+     * WKT formatting uses CamelCase keywords. This is more useful in WKT 2 strings, which
      * use longer keywords than WKT 1 did. Examples: {@code "TimeExtent"}, {@code "AngleUnit"}.
      */
     CAMEL_CASE,
 
     /**
-     * Keywords are written with upper cases. This is the most usual case in WKT 1 strings.
+     * WKT formatting uses upper case keywords.
+     * This is the most usual case in WKT 1 strings.
      */
     UPPER_CASE
 }

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -541,11 +541,11 @@ public class ImmutableIdentifier extends
     }
 
     /**
-     * Formats a <cite>Well Known Text</cite> representation of this identifier.
+     * Formats this identifier as a <cite>Well Known Text</cite> {@code Id[…]}
element.
      * 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, which is {@code "Id"} (WKT 2) or {@code "Authority"} (WKT
1).
+     * @return {@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/parameter/DefaultParameterDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -36,7 +36,6 @@ import org.apache.sis.util.collection.Co
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.io.wkt.Formatter;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.ArgumentChecks.ensureCanCast;
@@ -505,19 +504,6 @@ public class DefaultParameterDescriptor<
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
-     *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name.
-     *
-     * @todo Not yet implemented.
-     */
-    @Override
-    protected String formatTo(final Formatter formatter) {
-        return null;
-    }
-
-    /**
      * Returns a string representation of this descriptor. The string returned by this
      * method is for information purpose only and may change in future SIS version.
      */

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -31,6 +31,7 @@ import org.opengis.parameter.InvalidPara
 import org.opengis.parameter.InvalidParameterValueException;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.util.Numerics;
@@ -689,15 +690,26 @@ public class DefaultParameterValue<T> ex
     }
 
     /**
-     * Formats this parameter as a <cite>Well Known Text</cite>.
+     * Formats this parameter as a <cite>Well Known Text</cite> {@code Parameter[…]}
element.
+     * Example:
      *
-     * @return The {@code "PARAMETER"} keyword.
+     * {@preformat wkt
+     *   Parameter["False easting", 0.0, LengthUnit["metre", 1]]
+     * }
+     *
+     * {@note Version 1 of WKT format did not specified the parameter unit explicitely.
+     *        Instead, the unit was inherited from the enclosing element.}
+     *
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return {@code "Parameter"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER);
         final Unit<?> targetUnit = formatter.toContextualUnit(descriptor.getUnit());
-        if (targetUnit != null) {
+        final Convention convention = formatter.getConvention();
+        final boolean isWKT1 = convention.versionOfWKT() == 1;
+        if (isWKT1 && targetUnit != null) {
             double convertedValue;
             try {
                 convertedValue = doubleValue(targetUnit);
@@ -711,6 +723,9 @@ public class DefaultParameterValue<T> ex
         } else {
             formatter.appendAny(value);
         }
+        if (unit != null && !isWKT1 && (!convention.isSimplified() || !unit.equals(targetUnit)))
{
+            formatter.append(unit);
+        }
         return "Parameter";
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -948,7 +948,7 @@ public class AbstractIdentifiedObject ex
     }
 
     /**
-     * Formats the inner part of this <cite>Well Known Text</cite> (WKT) element
into the given formatter.
+     * Formats the inner part of this <cite>Well Known Text</cite> (WKT) object
into the given formatter.
      * The default implementation writes the following elements:
      *
      * <ul>
@@ -956,7 +956,7 @@ public class AbstractIdentifiedObject ex
      * </ul>
      *
      * Keywords and metadata (scope, extent, identifier and remarks) shall not be formatted
here.
-     * For example if this formattable element is for a {@code GEOGCS[…]} element,
+     * For example if this formattable element is for a {@code GeodeticCRS[…]} element,
      * then subclasses shall write the content starting at the insertion point shown below:
      *
      * <table class="compact">
@@ -965,15 +965,15 @@ public class AbstractIdentifiedObject ex
      *   <th>Java code example</th>
      * </tr><tr><td>
      * {@preformat text
-     *     GEOGCS["WGS 84", ID["EPSG", 4326]]
-     *                    ↑
-     *            (insertion point)
+     *   GeodeticCRS["WGS 84", ID["EPSG", 4326]]
+     *                       ↑
+     *               (insertion point)
      * }
      * </td><td>
      * {@preformat java
      *     super.formatTo(formatter);
      *     // ... write the elements at the insertion point ...
-     *     return "GEOGCS";
+     *     return "GeodeticCRS";
      * }
      * </td></tr></table>
      *
@@ -986,7 +986,8 @@ public class AbstractIdentifiedObject ex
      * In such case, this method shall return {@code null}.</p>
      *
      * @param  formatter The formatter where to format the inner content of this WKT element.
-     * @return The WKT element keyword, or {@code null} if none.
+     * @return The {@linkplain org.apache.sis.io.wkt.KeywordCase#CAMEL_CASE CamelCase} keyword
+     *         for the WKT element, or {@code null} if unknown.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -397,7 +397,7 @@ public class AbstractCRS extends Abstrac
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
+     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
CRS into the given formatter.
      * The default implementation writes the following elements:
      *
      * <ul>
@@ -408,8 +408,7 @@ public class AbstractCRS extends Abstrac
      *   <li>All {@linkplain #getCoordinateSystem() coordinate system}'s axis.</li>
      * </ul>
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type (e.g. {@code "GEOGCS"}).
+     * @return {@inheritDoc}
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -251,10 +251,9 @@ public class DefaultEngineeringCRS exten
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code EngineeringCRS[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "EngineeringCRS"} (WKT 2)
or {@code "Local_CS"} (WKT 1).
+     * @return {@code "EngineeringCRS"} (WKT 2) or {@code "Local_CS"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -193,10 +193,42 @@ public class DefaultGeographicCRS extend
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code GeodeticCRS[…]}
element.
+     * Examples:
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "GeodeticCRS"} (WKT 2) or
{@code "GeogCS"} (WKT 1).
+     * <table class="compact">
+     * <tr>
+     *   <th>WKT 2</th>
+     *   <th>WKT 1</th>
+     * </tr><tr><td>
+     * {@preformat wkt
+     *   GeodeticCRS["WGS 84",
+     *      Datum["World Geodetic System 1984",
+     *        Ellipsoid["WGS84", 6378137.0, 298.257223563, LengthUnit["metre", 1]]],
+     *      PrimeMeridian["Greenwich", 0.0, AngleUnit["degree", 0.017453292519943295]],
+     *      CS["ellipsoidal", 2],
+     *        Axis["Longitude", east],
+     *        Axis["Latitude", north],
+     *        AngleUnit["degree", 0.017453292519943295],
+     *      Area["World"],
+     *      BBox[-90.00, -180.00, 90.00, 180.00],
+     *      Scope["Used by GPS satellite navigation system."]
+     *      Id["EPSG", 4326, Citation["OGP"], URI["urn:ogc:def:crs:EPSG::4326"]]]
+     * }
+     * </td><td>
+     * {@preformat wkt
+     *   GEOGCS["WGS 84"
+     *      DATUM["World Geodetic System 1984"
+     *        SPHEROID["WGS84", 6378137.0, 298.257223563]]
+     *      PRIMEM["Greenwich", 0.0]
+     *      UNIT["degree", 0.017453292519943295]
+     *      AXIS["Longitude", EAST]
+     *      AXIS["Latitude", NORTH],
+     *      AUTHORITY["EPSG", "4326"]]
+     * }
+     * </td></tr></table>
+     *
+     * @return {@code "GeodeticCRS"} (WKT 2) or {@code "GeogCS"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -253,11 +253,11 @@ public class DefaultImageCRS extends Abs
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
-     * {@code ImageCRS} are defined in the WKT 2 specification only.
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code ImageCRS[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "ImageCRS"}.
+     * {@note <code>ImageCRS</code> are defined in the WKT 2 specification only.}
+     *
+     * @return {@code "ImageCRS"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -296,11 +296,11 @@ public class DefaultTemporalCRS extends 
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
-     * {@code TimeCRS} are defined in the WKT 2 specification only.
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code TimeCRS[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "TimeCRS"}.
+     * {@note <code>TimeCRS</code> is defined in the WKT 2 specification only.}
+     *
+     * @return {@code "TimeCRS"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -229,10 +229,9 @@ public class DefaultVerticalCRS extends 
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
+     * Formats this CRS as a <cite>Well Known Text</cite> {@code VerticalCRS[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is {@code "VerticalCRS"} (WKT 2) or
{@code "Vert_CS"} (WKT 1).
+     * @return {@code "VerticalCRS"} (WKT 2) or {@code "Vert_CS"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -414,23 +414,23 @@ public class AbstractCS extends Abstract
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats the inner part of this <cite>Well Known Text</cite> (WKT) CS into
the given formatter.
      * This method does <strong>not</strong> format the axes, because they shall
appear outside
      * the {@code CS[…]} element for historical reasons. Axes shall be formatted by the
enclosing
      * element (usually an {@link org.apache.sis.referencing.crs.AbstractCRS}).
      *
-     * {@example Well Known Text of a two-dimensional <code>EllipsoidalCS</code>
having (φ,λ) axes
-     *           in a unit defined by the enclosing CRS (usually degrees):
+     * <p><b>Example:</b> Well-Known Text of a two-dimensional {@code EllipsoidalCS}
having (φ,λ) axes
+     * in a unit defined by the enclosing CRS (usually degrees):</p>
      *
-     * <pre>CS[ellipsoidal, 2],
-     *  AXIS["latitude", north],
-     *  AXIS["longitude", east]</pre>
+     * {@preformat wkt
+     *   CS[ellipsoidal, 2],
+     *   Axis["latitude", north],
+     *   Axis["longitude", east]
      * }
      *
-     * This Well Known Text is valid only for version 2 of WKT.
+     * {@note <code>CS</code> is defined in the WKT 2 specification only.}
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "CS"}.
+     * @return {@code "CS"}.
      */
     @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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -733,7 +733,7 @@ public class DefaultCoordinateSystemAxis
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats this axis as a <cite>Well Known Text</cite> {@code Axis[…]}
element.
      *
      * {@section Constraints for WKT validity}
      * The ISO 19162 specification puts many constraints on axis names, abbreviations and
directions allowed in WKT.
@@ -747,8 +747,7 @@ public class DefaultCoordinateSystemAxis
      *       by “<cite>Latitude</cite>” and “<cite>Longitude</cite>”
respectively.</li>
      * </ul>
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "Axis"}.
+     * @return {@code "Axis"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -281,8 +281,14 @@ final class DirectionAlongMeridian exten
     }
 
     /**
-     * Formats a {@code MERIDIAN[…]} element which contains the meridian value and the
unit of measurement.
+     * Formats this object as a <cite>Well Known Text</cite> {@code Meridian[…]}
element.
+     * This element contains the meridian value and the unit of measurement.
      * The unit is currently fixed to degrees, but this may change in any future implementation.
+     *
+     * {@note <code>Meridian</code> is defined in the WKT 2 specification only.}
+     *
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return {@code "Meridian"}.
      */
     @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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -617,17 +617,20 @@ public class BursaWolfParameters extends
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
The WKT contains the
-     * parameters in <var>translation</var>, <var>rotation</var>,
<var>scale</var> order, like below:
+     * Formats this object as a <cite>Well Known Text</cite> {@code ToWGS84[…]}
element.
+     * The WKT contains the parameters in <var>translation</var>, <var>rotation</var>,
<var>scale</var> order,
+     * like below:
      *
      * <blockquote><code>TOWGS84[{@linkplain #tX}, {@linkplain #tY}, {@linkplain
#tZ}, {@linkplain #rX},
      * {@linkplain #rY}, {@linkplain #rZ}, {@linkplain #dS}]</code></blockquote>
      *
-     * The element name is {@code "TOWGS84"} in the common case where the {@linkplain #getTargetDatum()
target datum}
+     * {@note <code>TOWGS84</code> is defined in the WKT 1 specification only.}
+     *
+     * The element name is {@code "ToWGS84"} in the common case where the {@linkplain #getTargetDatum()
target datum}
      * 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"}.
+     * @param  formatter The formatter where to format the inner content of this WKT element.
+     * @return 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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -753,10 +753,9 @@ public class DefaultEllipsoid extends Ab
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats this ellipsoid as a <cite>Well Known Text</cite> {@code Ellipsoid[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "Ellipsoid"} (WKT 2) or {@code "Spheroid"}
(WKT 1).
+     * @return {@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/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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -163,11 +163,9 @@ public class DefaultEngineeringDatum ext
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT)</a>
element.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code EngineeringDatum[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The name of the WKT element type, which is
-     *         {@code "EngineeringDatum"} (WKT 2) or {@code "Local_Datum"} (WKT 1).
+     * @return {@code "EngineeringDatum"} (WKT 2) or {@code "Local_Datum"} (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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -497,10 +497,28 @@ public class DefaultGeodeticDatum extend
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code Datum[…]}
element.
+     * Examples:
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "Datum"}.
+     * <table class="compact">
+     * <tr>
+     *   <th>WKT 2</th>
+     *   <th>WKT 1</th>
+     * </tr><tr><td>
+     * {@preformat wkt
+     *      Datum["World Geodetic System 1984",
+     *        Ellipsoid["WGS84", 6378137.0, 298.257223563, LengthUnit["metre", 1]],
+     *      Id["EPSG", 6326, Citation["OGP"], URI["urn:ogc:def:datum:EPSG::6326"]]]
+     * }
+     * </td><td>
+     * {@preformat wkt
+     *      DATUM["World Geodetic System 1984"
+     *        SPHEROID["WGS84", 6378137.0, 298.257223563],
+     *      AUTHORITY["EPSG", "6326"]]
+     * }
+     * </td></tr></table>
+     *
+     * @return {@code "Datum"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -231,11 +231,11 @@ public class DefaultImageDatum extends A
     }
 
     /**
-     * Format the inner part of a <cite>Well Known Text</cite> (WKT) element.
-     * {@code ImageDatum} are defined in the WKT 2 specification only.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code ImageDatum[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "ImageDatum"}.
+     * {@note <code>ImageDatum</code> is defined in the WKT 2 specification only.}
+     *
+     * @return {@code "ImageDatum"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -332,10 +332,9 @@ public class DefaultPrimeMeridian extend
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats this prime meridian as a <cite>Well Known Text</cite> {@code PrimeMeridian[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "PrimeMeridian"} (WKT 2) or {@code "PrimeM"}
(WKT 1).
+     * @return {@code "PrimeMeridian"} (WKT 2) or {@code "PrimeM"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
Tue Feb 18 19:25:36 2014
@@ -275,11 +275,11 @@ public class DefaultTemporalDatum extend
     }
 
     /**
-     * Format the inner part of a <cite>Well Known Text</cite> (WKT) element.
-     * {@code TimeDatum} are defined in the WKT 2 specification only.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code TimeDatum[…]}
element.
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "TimeDatum"}.
+     * {@note <code>TimeDatum</code> is defined in the WKT 2 specification only.}
+     *
+     * @return {@code "TimeDatum"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1569492&r1=1569491&r2=1569492&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] Tue Feb 18 19:25:36 2014
@@ -306,15 +306,14 @@ public class DefaultVerticalDatum extend
     }
 
     /**
-     * Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
+     * Formats this datum as a <cite>Well Known Text</cite> {@code VerticalDatum[…]}
element.
      *
      * {@note OGC 01-009 defined numerical codes for various vertical datum types, for example
2005 for geoidal height
      *        and 2002 for ellipsoidal height. Such codes were formatted for all <code>Datum</code>
subtypes in WKT 1.
      *        Datum types became provided only for vertical datum in the ISO 19111:2003 specification,
then removed
      *        completely in ISO 19111:2007.}
      *
-     * @param  formatter The formatter to use.
-     * @return The WKT element name, which is {@code "VerticalDatum"} (WKT 2) or {@code "Vert_Datum"}
(WKT 1).
+     * @return {@code "VerticalDatum"} (WKT 2) or {@code "Vert_Datum"} (WKT 1).
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1569492&r1=1569491&r2=1569492&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
[UTF-8] Tue Feb 18 19:25:36 2014
@@ -25,6 +25,7 @@ import org.opengis.parameter.ParameterVa
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.InvalidParameterTypeException;
 import org.opengis.parameter.InvalidParameterValueException;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -516,7 +517,11 @@ public final strictfp class DefaultParam
      */
     @Test
     public void testWKT() {
-        assertWktEquals("Parameter[“WKT test”, 4]", createOptional("WKT test", 4));
-        assertWktEquals("Parameter[“WKT test”, 30.0]", create("WKT test", 30, SI.CENTIMETRE));
+        final DefaultParameterValue<Integer> count  = createOptional("Count", 4);
+        final DefaultParameterValue<Double>  length = create("Length", 30, SI.CENTIMETRE);
+        assertWktEquals(Convention.WKT1, "PARAMETER[“Count”, 4]", count);
+        assertWktEquals(Convention.WKT1, "PARAMETER[“Length”, 30.0]", length);
+        assertWktEquals(Convention.WKT2, "Parameter[“Count”, 4]", count);
+        assertWktEquals(Convention.WKT2, "Parameter[“Length”, 30.0, LengthUnit[“cm”,
0.01]]", length);
     }
 }



Mime
View raw message