Author: desruisseaux
Date: Mon Sep 7 14:51:25 2015
New Revision: 1701632
URL: http://svn.apache.org/r1701632
Log:
Change default formatting of Convention.WKT2: follow ISO 19162 recommendations
regarding short versus long keywords and usage of upper-case keywords.
Users can still congigure WKTFormatter explicitely if they want another
formatting style.
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
(with props)
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ContextualParametersTest.java
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -70,13 +70,16 @@ public enum Convention {
*
* @see <a
href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2
specification</a>
*/
- WKT2(false, false),
+ WKT2(false, true, false),
/**
* The ISO 19162 format with omission of some optional elements. This
convention is identical
* to the {@link #WKT2} convention except for the following aspects:
*
* <ul>
+ * <li>By {@linkplain KeywordStyle#DEFAULT default} long keywords are
used instead of short ones
+ * (e.g. {@code "GeodeticCRS"} instead of {@code "GeodCRS"}) except
for the {@code "Unit"} keyword,
+ * because they match the class or interface names.</li>
* <li>{@code PrimeMeridian} element omitted if the meridian is
Greenwich.</li>
* <li>{@code Axis} element omits the {@code Order} sub-element.</li>
* <li>{@code Unit} elements are less verbose:<ul>
@@ -99,7 +102,7 @@ public enum Convention {
*
* <p>This is the default convention used by {@link
FormattableObject#toString()}.</p>
*/
- WKT2_SIMPLIFIED(false, false),
+ WKT2_SIMPLIFIED(false, false, false),
/**
* The OGC 01-009 format, also known as “WKT 1”.
@@ -139,7 +142,7 @@ public enum Convention {
*
* @see <a
href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy
WKT 1</a>
*/
- WKT1(true, false),
+ WKT1(true, true, false),
/**
* The <cite>Simple Feature</cite> format, also known as “WKT 1”.
@@ -156,7 +159,7 @@ public enum Convention {
* (e.g. <cite>"meter"</cite> instead than
<cite>"metre"</cite>).</li>
* </ul>
*/
- WKT1_COMMON_UNITS(true, true),
+ WKT1_COMMON_UNITS(true, true, true),
/**
* The <cite>Simple Feature</cite> format without parsing of axis elements.
@@ -173,7 +176,7 @@ public enum Convention {
*
* @since 0.6
*/
- WKT1_IGNORE_AXES(true, true),
+ WKT1_IGNORE_AXES(true, true, true),
/**
* A special convention for formatting objects as stored internally by
Apache SIS.
@@ -204,7 +207,7 @@ public enum Convention {
* @see
org.apache.sis.referencing.operation.projection.NormalizedProjection#getParameterValues()
*/
@Debug
- INTERNAL(false, false);
+ INTERNAL(false, false, false);
/**
* The default conventions.
@@ -217,6 +220,11 @@ public enum Convention {
private final boolean isWKT1;
/**
+ * {@code true} for using short upper-case keywords by {@linkplain
KeywordStyle#DEFAULT default}.
+ */
+ final boolean toUpperCase;
+
+ /**
* {@code true} for a frequently-used convention about units instead than
the standard one.
* <ul>
* <li>If {@code true}, forces {@code PRIMEM} and {@code PARAMETER}
angular units to degrees
@@ -232,8 +240,9 @@ public enum Convention {
/**
* Creates a new enumeration value.
*/
- private Convention(final boolean isWKT1, final boolean usesCommonUnits) {
- this.isWKT1 = isWKT1;
+ private Convention(final boolean isWKT1, final boolean toUpperCase, final
boolean usesCommonUnits) {
+ this.isWKT1 = isWKT1;
+ this.toUpperCase = toUpperCase;
this.usesCommonUnits = usesCommonUnits;
}
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -172,8 +172,14 @@ public abstract class FormattableObject
if (formatter == null) {
formatter = new Formatter();
}
+ /*
+ * Apply the same setting than in 'WKTFormat.updateFormatter(…)'
+ * when KeywordCase and KeywordStyle have their default values.
+ */
formatter.configure(convention, null, colorize ? Colors.DEFAULT : null,
- (convention.majorVersion() == 1) ? (byte) 1 : 0,
WKTFormat.DEFAULT_INDENTATION);
+ convention.toUpperCase ? (byte) +1 : 0,
+ (convention.majorVersion() == 1) ? (byte) -1 : 0,
+ WKTFormat.DEFAULT_INDENTATION);
if (!strict) {
formatter.transliterator = Transliterator.IDENTITY;
}
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -254,6 +254,11 @@ public class Formatter implements Locali
private byte toUpperCase;
/**
+ * {@code -1} for short keywords, {@code +1} for long keywords or 0 for
the default.
+ */
+ private byte longKeywords;
+
+ /**
* Incremented when {@link #setColor(ElementKind)} is invoked, and
decremented when {@link #resetColor()}
* is invoked. Used in order to prevent child elements to overwrite the
colors decided by enclosing elements.
*/
@@ -368,20 +373,22 @@ public class Formatter implements Locali
* Sets the convention, authority, colors and indentation to use for
formatting WKT elements.
* This method does not validate the argument — validation must be done by
the caller.
*
- * @param convention The convention, or {@code null} for the default
value.
- * @param authority The authority, or {@code null} for inferring it from
the convention.
- * @param colors The syntax coloring, or {@code null} if none.
- * @param toUpperCase Whether keywords shall be converted to upper cases.
- * @param indentation The amount of spaces to use in indentation for WKT
formatting,
- * or {@link WKTFormat#SINGLE_LINE}.
+ * @param convention The convention, or {@code null} for the default
value.
+ * @param authority The authority, or {@code null} for inferring it
from the convention.
+ * @param colors The syntax coloring, or {@code null} if none.
+ * @param toUpperCase Whether keywords shall be converted to upper cases.
+ * @param longKeywords {@code -1} for short keywords, {@code +1} for long
keywords or 0 for the default.
+ * @param indentation The amount of spaces to use in indentation for WKT
formatting,
+ * or {@link WKTFormat#SINGLE_LINE}.
*/
final void configure(Convention convention, final Citation authority,
final Colors colors,
- final byte toUpperCase, final byte indentation)
+ final byte toUpperCase, final byte longKeywords, final byte
indentation)
{
this.convention = convention;
this.authority = (authority != null) ? authority :
convention.getNameAuthority();
this.colors = colors;
this.toUpperCase = toUpperCase;
+ this.longKeywords = longKeywords;
this.indentation = indentation;
this.transliterator = (convention == Convention.INTERNAL) ?
Transliterator.IDENTITY : Transliterator.DEFAULT;
unitFormat.isLocaleUS = convention.usesCommonUnits;
@@ -509,6 +516,26 @@ public class Formatter implements Locali
}
/**
+ * Selects a short or long keyword depending on the {@link KeywordStyle}
value.
+ * This method can be used by {@link FormattableObject#formatTo(Formatter)}
+ * implementations for choosing the return value.
+ *
+ * @param shortKeyword The keyword to return if the style is {@link
KeywordStyle#SHORT}.
+ * @param longKeyword The keyword to return if the style is {@link
KeywordStyle#LONG}.
+ * @return The short or long keyword depending on the keyword style
setting.
+ *
+ * @see WKTFormat#setKeywordStyle(KeywordStyle)
+ *
+ * @since 0.6
+ */
+ public String shortOrLong(final String shortKeyword, final String
longKeyword) {
+ return (longKeywords != 0
+ ? longKeywords < 0 // If keyword style was
explicitely specified, use the setting.
+ : convention.toUpperCase) // Otherwise use the default
value determined by the convention.
+ ? shortKeyword : longKeyword;
+ }
+
+ /**
* Conditionally appends a separator to the {@linkplain #buffer}, if
needed.
* This method does nothing if there is currently no element at the buffer
end.
*/
@@ -1170,9 +1197,10 @@ public class Formatter implements Locali
}
/**
- * Appends a unit in a {@code UNIT[…]} element or one of the specialized
elements. Specialized elements are
- * {@code ANGLEUNIT}, {@code LENGTHUNIT}, {@code SCALEUNIT}, {@code
PARAMETRICUNIT} and {@code TIMEUNIT}.
- * Specialization is used in WKT 2 format except the <cite>simplified WKT
2</cite> one.
+ * Appends a unit in a {@code Unit[…]} element or one of the specialized
elements. Specialized elements are
+ * {@code AngleUnit}, {@code LengthUnit}, {@code ScaleUnit}, {@code
ParametricUnit} and {@code TimeUnit}.
+ * By {@linkplain KeywordStyle#DEFAULT default}, specialized unit keywords
are used with the
+ * {@linkplain Convention#WKT2 WKT 2 convention}.
*
* <div class="note"><b>Example:</b>
* {@code append(SI.KILOMETRE)} will append "{@code LengthUnit["km",
1000]}" to the WKT.</div>
@@ -1183,7 +1211,7 @@ public class Formatter implements Locali
*/
public void append(final Unit<?> unit) {
if (unit != null) {
- final boolean isSimplified = convention.isSimplified();
+ final boolean isSimplified = (longKeywords == 0) ?
convention.isSimplified() : (longKeywords < 0);
final boolean isWKT1 = convention.majorVersion() == 1;
final Unit<?> base = unit.toSI();
final String keyword;
Added:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java?rev=1701632&view=auto
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
(added)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.io.wkt;
+
+
+/**
+ * Whether to use short or long WKT keywords.
+ *
+ * <div class="note"><b>Note:</b>
+ * ISO 19162 recommends {@linkplain KeywordCase#UPPER_CASE upper case}
{@linkplain #SHORT short} keywords,
+ * but {@linkplain KeywordCase#CAMEL_CASE camel case} {@linkplain #LONG long}
keywords match more closely
+ * the programmatic interface names (e.g. {@link
org.opengis.referencing.crs.GeodeticCRS}, <i>etc</i>).
+ * </div>
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.6
+ * @version 0.6
+ * @module
+ */
+public enum KeywordStyle {
+ /**
+ * Short keywords.
+ *
+ * <div class="note"><b>Examples:</b>
+ * {@code "GeodCRS"}, {@code "VertCRS"}, {@code "Unit"}.
+ * </div>
+ */
+ SHORT,
+
+ /**
+ * Long keywords.
+ *
+ * <div class="note"><b>Examples:</b>
+ * {@code "GeodeticCRS"}, {@code "VerticalCRS"}, {@code "AngleUnit"}.
+ * </div>
+ */
+ LONG,
+
+ /**
+ * Keywords style is determined by the WKT {@linkplain Convention
convention}.
+ *
+ * <div class="note"><b>Examples:</b>
+ * <ul>
+ * <li>For {@link Convention#WKT2}: {@code "GeodCRS"}, {@code
"VertCRS"}, {@code "AngleUnit"}
+ * (keywords matching the ISO 19162 recommendations).</li>
+ * <li>For {@link Convention#WKT2_SIMPLIFIED}: {@code "GeodeticCRS"},
{@code "VerticalCRS"}, {@code "Unit"}
+ * (keywords matching the class or interface names).</li>
+ * </ul></div>
+ */
+ DEFAULT
+}
Propchange:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -162,6 +162,11 @@ public class WKTFormat extends CompoundF
private KeywordCase keywordCase;
/**
+ * Whether to use short or long WKT keywords.
+ */
+ private KeywordStyle keywordStyle;
+
+ /**
* {@link Transliterator#IDENTITY} for preserving non-ASCII characters.
The default value is
* {@link Transliterator#DEFAULT}, which causes replacements like "é" →
"e" in all elements
* except {@code REMARKS["…"]}. May also be a user-supplied transliterator.
@@ -232,15 +237,17 @@ public class WKTFormat extends CompoundF
*/
public WKTFormat(final Locale locale, final TimeZone timezone) {
super(locale, timezone);
- convention = Convention.DEFAULT;
- symbols = Symbols.getDefault();
- keywordCase = KeywordCase.DEFAULT;
- indentation = DEFAULT_INDENTATION;
+ convention = Convention.DEFAULT;
+ symbols = Symbols.getDefault();
+ keywordCase = KeywordCase.DEFAULT;
+ keywordStyle = KeywordStyle.DEFAULT;
+ indentation = DEFAULT_INDENTATION;
}
/**
* Returns the {@link #fragments} map, creating it when first needed.
*/
+ @SuppressWarnings("ReturnOfCollectionOrArrayField")
private Map<String,Element> fragments() {
if (fragments == null) {
fragments = new TreeMap<>();
@@ -251,6 +258,7 @@ public class WKTFormat extends CompoundF
/**
* Returns the {@link #factories} map, creating it when first needed.
*/
+ @SuppressWarnings("ReturnOfCollectionOrArrayField")
private Map<Class<?>,Factory> factories() {
if (factories == null) {
factories = new HashMap<>(8);
@@ -400,6 +408,30 @@ public class WKTFormat extends CompoundF
}
/**
+ * Returns whether to use short or long WKT keywords.
+ *
+ * @return The style used for formatting keywords.
+ *
+ * @since 0.6
+ */
+ public KeywordStyle getKeywordStyle() {
+ return keywordStyle;
+ }
+
+ /**
+ * Sets whether to use short or long WKT keywords.
+ *
+ * @param keywordStyle The style to use for formatting keywords.
+ *
+ * @since 0.6
+ */
+ public void setKeywordStyle(final KeywordStyle keywordStyle) {
+ ArgumentChecks.ensureNonNull("keywordStyle", keywordStyle);
+ this.keywordStyle = keywordStyle;
+ updateFormatter(formatter);
+ }
+
+ /**
* Returns the colors to use for syntax coloring, or {@code null} if none.
* By default there is no syntax coloring.
*
@@ -510,9 +542,15 @@ public class WKTFormat extends CompoundF
case LOWER_CASE: toUpperCase = -1; break;
case UPPER_CASE: toUpperCase = +1; break;
case CAMEL_CASE: toUpperCase = 0; break;
- default: toUpperCase = (convention.majorVersion() == 1) ?
(byte) 1 : 0; break;
+ default: toUpperCase = convention.toUpperCase ? (byte) +1 : 0;
break;
+ }
+ final byte longKeywords;
+ switch (keywordStyle) {
+ case SHORT: longKeywords = -1; break;
+ case LONG: longKeywords = +1; break;
+ default: longKeywords = (convention.majorVersion() == 1) ?
(byte) -1 : 0; break;
}
- formatter.configure(convention, authority, colors, toUpperCase,
indentation);
+ formatter.configure(convention, authority, colors, toUpperCase,
longKeywords, indentation);
if (transliterator != null) {
formatter.transliterator = transliterator;
}
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -76,7 +76,7 @@ public final strictfp class FormatterTes
*/
@Test
public void testAppendGeographicBoundingBox() {
- assertWktEquals(Convention.WKT2, "BBox[51.43, 2.54, 55.77, 6.40]",
+ assertWktEquals(Convention.WKT2_SIMPLIFIED, "BBox[51.43, 2.54, 55.77,
6.40]",
new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77));
assertWktEquals(Convention.WKT1, "BBOX[51.43, 2.54, 55.77, 6.40]",
new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77));
@@ -88,11 +88,12 @@ public final strictfp class FormatterTes
@Test
public void testAppendVerticalExtent() {
final DefaultVerticalExtent extent = new DefaultVerticalExtent(102,
108, VerticalCRSMock.HEIGHT_ft);
- assertWktEquals(Convention.WKT2, "VerticalExtent[102, 108,
LengthUnit[“ft”, 0.3048]]", extent);
+ assertWktEquals(Convention.WKT2_SIMPLIFIED, "VerticalExtent[102, 108,
Unit[“ft”, 0.3048]]", extent);
+ assertWktEquals(Convention.WKT2, "VERTICALEXTENT[102, 108,
LENGTHUNIT[“ft”, 0.3048]]", extent);
extent.setMinimumValue(100.2);
extent.setMaximumValue(100.8);
- assertWktEquals(Convention.WKT2, "VerticalExtent[100.2, 100.8,
LengthUnit[“ft”, 0.3048]]", extent);
+ assertWktEquals(Convention.WKT2, "VERTICALEXTENT[100.2, 100.8,
LENGTHUNIT[“ft”, 0.3048]]", extent);
}
/**
@@ -100,9 +101,9 @@ public final strictfp class FormatterTes
*/
@Test
public void testAppendUnit() {
- assertWktEquals("LengthUnit[“metre”, 1]", SI.METRE);
- assertWktEquals("AngleUnit[“degree”, 0.017453292519943295]",
NonSI.DEGREE_ANGLE);
- assertWktEquals("ScaleUnit[“parts per million”, 1.0E-6]", Units.PPM);
+ assertWktEquals(Convention.WKT2, "LENGTHUNIT[“metre”, 1]", SI.METRE);
+ assertWktEquals(Convention.WKT2, "ANGLEUNIT[“degree”,
0.017453292519943295]", NonSI.DEGREE_ANGLE);
+ assertWktEquals(Convention.WKT2, "SCALEUNIT[“parts per million”,
1.0E-6]", Units.PPM);
assertWktEquals(Convention.WKT1, "UNIT[“metre”, 1]", SI.METRE);
assertWktEquals(Convention.WKT1, "UNIT[“degree”,
0.017453292519943295]", NonSI.DEGREE_ANGLE);
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -180,14 +180,16 @@ public final strictfp class ImmutableIde
@Test
public void testWKT() {
ImmutableIdentifier id = new ImmutableIdentifier(Citations.EPSG,
"EPSG", "4326", "8.2", null);
- assertWktEquals(Convention.WKT2, "Id[“EPSG”, 4326, “8.2”]", id);
+ assertWktEquals(Convention.WKT2_SIMPLIFIED, "Id[“EPSG”, 4326, “8.2”]",
id);
+ assertWktEquals(Convention.WKT2, "ID[“EPSG”, 4326, “8.2”]", id);
assertWktEquals(Convention.WKT1, "AUTHORITY[“EPSG”, “4326”]", id);
/*
* Same identifier, but with an authority different than the EPSG one.
* The Citation element should then be visible in WKT 2.
*/
id = new ImmutableIdentifier(new SimpleCitation("IOGP"), "EPSG",
"4326", "8.2", null);
- assertWktEquals(Convention.WKT2, "Id[“EPSG”, 4326, “8.2”,
Citation[“IOGP”]]", id);
+ assertWktEquals(Convention.WKT2_SIMPLIFIED, "Id[“EPSG”, 4326, “8.2”,
Citation[“IOGP”]]", id);
+ assertWktEquals(Convention.WKT2, "ID[“EPSG”, 4326, “8.2”,
CITATION[“IOGP”]]", id);
assertWktEquals(Convention.WKT1, "AUTHORITY[“EPSG”, “4326”]", id);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -536,7 +536,7 @@ public class DefaultDerivedCRS extends A
final CoordinateSystem cs = getCoordinateSystem();
formatCS(formatter, cs, ReferencingUtilities.getUnit(cs),
isWKT1);
}
- return keyword();
+ return keyword(formatter);
}
}
@@ -545,8 +545,16 @@ public class DefaultDerivedCRS extends A
* Inner subclasses will override this method for returning a constant
value instead
* than trying to infer it from the components.
*/
- String keyword() {
- return getType(getBaseCRS(), getCoordinateSystem());
+ String keyword(final Formatter formatter) {
+ final String longKeyword = getType(getBaseCRS(),
getCoordinateSystem());
+ final String shortKeyword;
+ switch (longKeyword) {
+ case WKTKeywords.GeodeticCRS: shortKeyword =
WKTKeywords.GeodCRS; break;
+ case WKTKeywords.VerticalCRS: shortKeyword =
WKTKeywords.VertCRS; break;
+ case WKTKeywords.EngineeringCRS: shortKeyword =
WKTKeywords.EngCRS; break;
+ default: return longKeyword;
+ }
+ return formatter.shortOrLong(shortKeyword, longKeyword);
}
/**
@@ -631,8 +639,8 @@ public class DefaultDerivedCRS extends A
}
/** Returns the WKT keyword for this derived CRS type.*/
- @Override String keyword() {
- return WKTKeywords.GeodeticCRS;
+ @Override String keyword(final Formatter formatter) {
+ return formatter.shortOrLong(WKTKeywords.GeodCRS,
WKTKeywords.GeodeticCRS);
}
}
@@ -679,8 +687,8 @@ public class DefaultDerivedCRS extends A
}
/** Returns the WKT keyword for this derived CRS type.*/
- @Override String keyword() {
- return WKTKeywords.VerticalCRS;
+ @Override String keyword(final Formatter formatter) {
+ return formatter.shortOrLong(WKTKeywords.VertCRS,
WKTKeywords.VerticalCRS);
}
}
@@ -727,7 +735,7 @@ public class DefaultDerivedCRS extends A
}
/** Returns the WKT keyword for this derived CRS type.*/
- @Override String keyword() {
+ @Override String keyword(final Formatter formatter) {
return WKTKeywords.TimeCRS;
}
}
@@ -772,8 +780,8 @@ public class DefaultDerivedCRS extends A
}
/** Returns the WKT keyword for this derived CRS type.*/
- @Override String keyword() {
- return WKTKeywords.EngineeringCRS;
+ @Override String keyword(final Formatter formatter) {
+ return formatter.shortOrLong(WKTKeywords.EngCRS,
WKTKeywords.EngineeringCRS);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -241,7 +241,8 @@ public class DefaultEngineeringCRS exten
protected String formatTo(final Formatter formatter) {
super.formatTo(formatter);
return (formatter.getConvention().majorVersion() == 1) ?
WKTKeywords.Local_CS
- : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS :
WKTKeywords.EngineeringCRS;
+ : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS
+ : formatter.shortOrLong(WKTKeywords.EngCRS,
WKTKeywords.EngineeringCRS);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -226,7 +226,8 @@ class DefaultGeodeticCRS extends Abstrac
if (isWKT1) {
return (cs instanceof EllipsoidalCS) ? WKTKeywords.GeogCS :
WKTKeywords.GeocCS;
} else {
- return isBaseCRS ? WKTKeywords.BaseGeodCRS :
WKTKeywords.GeodeticCRS;
+ return isBaseCRS ? WKTKeywords.BaseGeodCRS
+ : formatter.shortOrLong(WKTKeywords.GeodCRS,
WKTKeywords.GeodeticCRS);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -405,7 +405,8 @@ public class DefaultProjectedCRS extends
}
formatter.restoreContextualUnit(lengthUnit, oldLength);
formatter.restoreContextualUnit(angularUnit, oldAngle);
- return isWKT1 ? WKTKeywords.ProjCS : isBaseCRS ?
WKTKeywords.BaseProjCRS : WKTKeywords.ProjectedCRS;
+ return isWKT1 ? WKTKeywords.ProjCS : isBaseCRS ?
WKTKeywords.BaseProjCRS
+ : formatter.shortOrLong(WKTKeywords.ProjCRS,
WKTKeywords.ProjectedCRS);
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -226,7 +226,8 @@ public class DefaultVerticalCRS extends
protected String formatTo(final Formatter formatter) {
super.formatTo(formatter);
return (formatter.getConvention().majorVersion() == 1) ?
WKTKeywords.Vert_CS
- : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS :
WKTKeywords.VerticalCRS;
+ : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS
+ : formatter.shortOrLong(WKTKeywords.VertCRS,
WKTKeywords.VerticalCRS);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -177,7 +177,7 @@ public class DefaultEngineeringDatum ext
formatter.append(0);
return WKTKeywords.Local_Datum;
}
- return WKTKeywords.EngineeringDatum;
+ return formatter.shortOrLong(WKTKeywords.EDatum,
WKTKeywords.EngineeringDatum);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -564,7 +564,7 @@ public class DefaultGeodeticDatum extend
* Datum appears in another context, then we will use
"GeodeticDatum" for clarity.
*/
if (!(formatter.getEnclosingElement(1) instanceof GeodeticCRS)) {
- return WKTKeywords.GeodeticDatum;
+ return formatter.shortOrLong(WKTKeywords.Datum,
WKTKeywords.GeodeticDatum);
}
}
return WKTKeywords.Datum;
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -243,7 +243,7 @@ public class DefaultImageDatum extends A
} else if (convention.majorVersion() == 1) {
formatter.setInvalidWKT(this, null);
}
- return WKTKeywords.ImageDatum;
+ return formatter.shortOrLong(WKTKeywords.IDatum,
WKTKeywords.ImageDatum);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -382,7 +382,7 @@ public class DefaultPrimeMeridian extend
if (!convention.isSimplified() || !contextualUnit.equals(unit) ||
beConservative(formatter, contextualUnit)) {
formatter.append(unit);
}
- return WKTKeywords.PrimeMeridian;
+ return formatter.shortOrLong(WKTKeywords.PrimeM,
WKTKeywords.PrimeMeridian);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -276,7 +276,7 @@ public class DefaultTemporalDatum extend
if (formatter.getConvention().majorVersion() == 1) {
formatter.setInvalidWKT(this, null);
}
- return WKTKeywords.TimeDatum;
+ return formatter.shortOrLong(WKTKeywords.TDatum,
WKTKeywords.TimeDatum);
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -301,7 +301,7 @@ public class DefaultVerticalDatum extend
formatter.append(VerticalDatumTypes.toLegacy(type().ordinal()));
return WKTKeywords.Vert_Datum;
}
- return WKTKeywords.VerticalDatum;
+ return formatter.shortOrLong(WKTKeywords.VDatum,
WKTKeywords.VerticalDatum);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -94,8 +94,8 @@ public final strictfp class AffineTest e
public void testWKT() {
final Matrix matrix = Matrices.createDiagonal(3, 3);
assertWktEquals(
- "ParameterGroup[“Affine parametric transformation”," +
- " Id[“EPSG”, 9624]]", Affine.parameters(matrix));
+ "PARAMETERGROUP[“Affine parametric transformation”," +
+ " ID[“EPSG”, 9624]]", Affine.parameters(matrix));
/*
* Try arbitrary values.
*/
@@ -103,23 +103,23 @@ public final strictfp class AffineTest e
matrix.setElement(1, 1, 0); // B1
matrix.setElement(1, 2, -1); // B2
assertWktEquals(
- "ParameterGroup[“Affine parametric transformation”,\n" +
- " Parameter[“A1”, 2.0, Id[“EPSG”, 8624]],\n" +
- " Parameter[“B1”, 0.0, Id[“EPSG”, 8640]],\n" +
- " Parameter[“B2”, -1.0, Id[“EPSG”, 8641]],\n" +
- " Id[“EPSG”, 9624]]", Affine.parameters(matrix));
+ "PARAMETERGROUP[“Affine parametric transformation”,\n" +
+ " PARAMETER[“A1”, 2.0, ID[“EPSG”, 8624]],\n" +
+ " PARAMETER[“B1”, 0.0, ID[“EPSG”, 8640]],\n" +
+ " PARAMETER[“B2”, -1.0, ID[“EPSG”, 8641]],\n" +
+ " ID[“EPSG”, 9624]]", Affine.parameters(matrix));
/*
* Setting a value on the last row make the matrix non-affine.
* So it should not be anymore EPSG:9624.
*/
matrix.setElement(2, 0, 3); // C0
assertWktEquals(
- "ParameterGroup[“Affine”,\n" +
- " Parameter[“num_row”, 3],\n" +
- " Parameter[“num_col”, 3],\n" +
- " Parameter[“elt_0_1”, 2.0],\n" +
- " Parameter[“elt_1_1”, 0.0],\n" +
- " Parameter[“elt_1_2”, -1.0],\n" +
- " Parameter[“elt_2_0”, 3.0]]", Affine.parameters(matrix));
+ "PARAMETERGROUP[“Affine”,\n" +
+ " PARAMETER[“num_row”, 3],\n" +
+ " PARAMETER[“num_col”, 3],\n" +
+ " PARAMETER[“elt_0_1”, 2.0],\n" +
+ " PARAMETER[“elt_1_1”, 0.0],\n" +
+ " PARAMETER[“elt_1_2”, -1.0],\n" +
+ " PARAMETER[“elt_2_0”, 3.0]]", Affine.parameters(matrix));
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -71,7 +71,7 @@ public final strictfp class LongitudeRot
final ParameterValueGroup p = provider.getParameters().createValue();
p.parameter(LongitudeRotation.NAME).setValue(2.5969213, NonSI.GRADE);
assertWktEquals(
- "Param_MT[“Affine parametric transformation”,\n" +
- " Parameter[“A2”, 2.33722917, Id[“EPSG”, 8625]]]",
provider.createMathTransform(null, p));
+ "PARAM_MT[“Affine parametric transformation”,\n" +
+ " PARAMETER[“A2”, 2.33722917, ID[“EPSG”, 8625]]]",
provider.createMathTransform(null, p));
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -247,7 +247,7 @@ public final strictfp class WKTFormatTes
final Warnings warnings = format.getWarnings();
assertNotNull("warnings", warnings);
assertEquals ("warnings.numMessages", 1, warnings.getNumMessages());
- assertEquals ("PrimeMeridian[\"Invalid \"\"$name\"\" here\", -10.0,
AngleUnit[\"degree\", 0.017453292519943295]]", wkt);
+ assertEquals ("PRIMEM[\"Invalid \"\"$name\"\" here\", -10.0,
ANGLEUNIT[\"degree\", 0.017453292519943295]]", wkt);
assertEquals ("The “$” character in “\"$name\"” is not permitted by
the “Well-Known Text” format.", warnings.getMessage(0));
assertNull (warnings.getException(0));
/*
@@ -283,13 +283,13 @@ public final strictfp class WKTFormatTes
final Object crs = format.parseObject("GEOGCS[“Tokyo”, $Tokyo, $Lat,
$Lon]");
final String wkt = format.format(crs);
assertMultilinesEquals(
- "GeodeticCRS[\"Tokyo\",\n" +
- " Datum[\"Tokyo\",\n" +
- " Ellipsoid[\"Bessel 1841\", 6377397.155, 299.1528128,
LengthUnit[\"metre\", 1]]],\n" +
- " PrimeMeridian[\"Greenwich\", 0.0, AngleUnit[\"degree\",
0.017453292519943295]],\n" +
+ "GEODCRS[\"Tokyo\",\n" +
+ " DATUM[\"Tokyo\",\n" +
+ " ELLIPSOID[\"Bessel 1841\", 6377397.155, 299.1528128,
LENGTHUNIT[\"metre\", 1]]],\n" +
+ " PRIMEM[\"Greenwich\", 0.0, ANGLEUNIT[\"degree\",
0.017453292519943295]],\n" +
" CS[ellipsoidal, 2],\n" +
- " Axis[\"Latitude (B)\", north, Order[1]],\n" +
- " Axis[\"Longitude (L)\", east, Order[2]],\n" +
- " AngleUnit[\"degree\", 0.017453292519943295]]", wkt);
+ " AXIS[\"Latitude (B)\", north, ORDER[1]],\n" +
+ " AXIS[\"Longitude (L)\", east, ORDER[2]],\n" +
+ " ANGLEUNIT[\"degree\", 0.017453292519943295]]", wkt);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -24,6 +24,7 @@ import org.opengis.parameter.ParameterDi
import org.opengis.parameter.GeneralParameterDescriptor;
import org.opengis.parameter.ParameterNotFoundException;
import org.apache.sis.internal.util.Constants;
+import org.apache.sis.io.wkt.Convention;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.TestCase;
@@ -180,7 +181,14 @@ public final strictfp class DefaultParam
*/
@Test
public void testWKT() {
- assertWktEquals(
+ assertWktEquals(Convention.WKT2,
+ "PARAMETERGROUP[“Test group”,\n" +
+ " PARAMETER[“Mandatory 1”, 10],\n" +
+ " PARAMETER[“Mandatory 2”, 10],\n" +
+ " PARAMETER[“Optional 3”, 10],\n" +
+ " PARAMETER[“Optional 4”, 10]]", M1_M1_O1_O2);
+
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"ParameterGroup[“Test group”,\n" +
" Parameter[“Mandatory 1”, 10],\n" +
" Parameter[“Mandatory 2”, 10],\n" +
@@ -203,7 +211,7 @@ public final strictfp class DefaultParam
* but is reproduced here for easier comparison with the test
following it.
*/
final DefaultParameterDescriptor<Double> descriptor =
DefaultParameterDescriptorTest.createEPSG("A0", Constants.EPSG_A0);
- assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623,
URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+ assertWktEquals("PARAMETER[“A0”, ID[“EPSG”, 8623,
URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
/*
* When the parameter is part of a larger element, we expect a
simplification.
* Here, the URI should be omitted because it is a long value which
does not
@@ -211,8 +219,8 @@ public final strictfp class DefaultParam
*/
final DefaultParameterDescriptorGroup group = new
DefaultParameterDescriptorGroup(
Collections.singletonMap(NAME_KEY, "Affine"), 1, 1,
descriptor);
- assertWktEquals("ParameterGroup[“Affine”,\n" +
- " Parameter[“A0”, Id[“EPSG”, 8623]]]", group);
+ assertWktEquals("PARAMETERGROUP[“Affine”,\n" +
+ " PARAMETER[“A0”, ID[“EPSG”, 8623]]]", group);
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -312,8 +312,8 @@ public final strictfp class DefaultParam
@Test
public void testWKT() {
final DefaultParameterDescriptor<Double> descriptor = create("Real
number", 4, 8, 5, SI.METRE);
- assertWktEquals("Parameter[“Integer param”, 5]", create("Integer
param", 4, 8, 5));
- assertWktEquals("Parameter[“Real number”, 5.0, LengthUnit[“metre”,
1]]", descriptor);
+ assertWktEquals("PARAMETER[“Integer param”, 5]", create("Integer
param", 4, 8, 5));
+ assertWktEquals("PARAMETER[“Real number”, 5.0, LENGTHUNIT[“metre”,
1]]", descriptor);
assertEquals("Parameter[\"Real number\", 5.0, Unit[\"metre\", 1]]",
descriptor.toString());
}
@@ -328,6 +328,6 @@ public final strictfp class DefaultParam
@DependsOnMethod("testWKT")
public void testIdentifiedParameterWKT() {
final DefaultParameterDescriptor<Double> descriptor = createEPSG("A0",
Constants.EPSG_A0);
- assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623,
URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+ assertWktEquals("PARAMETER[“A0”, ID[“EPSG”, 8623,
URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -593,8 +593,8 @@ public final strictfp class DefaultParam
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);
+ assertWktEquals(Convention.WKT2, "PARAMETER[“Count”, 4]", count);
+ assertWktEquals(Convention.WKT2, "PARAMETER[“Length”, 30.0,
LENGTHUNIT[“cm”, 0.01]]", length);
}
/**
@@ -609,7 +609,7 @@ public final strictfp class DefaultParam
public void testWKT_withUnformattableUnit() {
final DefaultParameterValue<Double> p = create("Angle", 10.3,
Units.valueOfEPSG(9111));
assertWktEquals(Convention.WKT1, "PARAMETER[“Angle”, 10.3]", p);
// 10.3 DM == 10.5°
- assertWktEquals(Convention.WKT2, "Parameter[“Angle”, 10.5,
AngleUnit[“degree”, 0.017453292519943295]]", p);
+ assertWktEquals(Convention.WKT2, "PARAMETER[“Angle”, 10.5,
ANGLEUNIT[“degree”, 0.017453292519943295]]", p);
assertWktEquals(Convention.INTERNAL, "Parameter[“Angle”, 10.3,
Unit[“D.M”, 0.017453292519943295, Id[“EPSG”, 9111]]]", p);
}
@@ -622,6 +622,6 @@ public final strictfp class DefaultParam
@DependsOnMethod("testWKT")
public void testIdentifiedParameterWKT() {
final Watcher<Double> parameter = new
Watcher<>(DefaultParameterDescriptorTest.createEPSG("A0", Constants.EPSG_A0));
- assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623]]", parameter);
+ assertWktEquals(Convention.WKT2, "PARAMETER[“A0”, null, ID[“EPSG”,
8623]]", parameter);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -321,12 +321,12 @@ public final strictfp class TensorValues
singletonMap(TensorValues.NAME_KEY, Constants.AFFINE), matrix);
validate(group);
assertWktEquals(
- "ParameterGroup[“Affine”,\n" +
- " Parameter[“num_row”, 3],\n" + // Shall be shown even
if equals to the default value.
- " Parameter[“num_col”, 3],\n" +
- " Parameter[“elt_0_2”, 4.0],\n" +
- " Parameter[“elt_1_0”, -2.0],\n" +
- " Parameter[“elt_2_2”, 7.0]]", group);
+ "PARAMETERGROUP[“Affine”,\n" +
+ " PARAMETER[“num_row”, 3],\n" + // Shall be shown even
if equals to the default value.
+ " PARAMETER[“num_col”, 3],\n" +
+ " PARAMETER[“elt_0_2”, 4.0],\n" +
+ " PARAMETER[“elt_1_0”, -2.0],\n" +
+ " PARAMETER[“elt_2_2”, 7.0]]", group);
}
/**
@@ -348,10 +348,10 @@ public final strictfp class TensorValues
singletonMap(TensorValues.NAME_KEY, Affine.NAME), matrix);
validate(group);
assertWktEquals(
- "ParameterGroup[“Affine parametric transformation”,\n" +
- " Parameter[“A2”, 4.0, Id[“EPSG”, 8625]],\n" +
- " Parameter[“B0”, -2.0, Id[“EPSG”, 8639]],\n" +
- " Parameter[“C2”, 7.0]]", group);
+ "PARAMETERGROUP[“Affine parametric transformation”,\n" +
+ " PARAMETER[“A2”, 4.0, ID[“EPSG”, 8625]],\n" +
+ " PARAMETER[“B0”, -2.0, ID[“EPSG”, 8639]],\n" +
+ " PARAMETER[“C2”, 7.0]]", group);
}
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -118,12 +118,12 @@ public final strictfp class AbstractRefe
assertWktEquals(Convention.WKT2,
"ReferenceSystem[“My \"object\".”,\n" + // Quotes replaced
- " 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]],\n" +
- " Id[“EPSG”, 4326, “8.2”,
URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
- " Remark[“注です。”]]",
+ " 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]],\n" +
+ " ID[“EPSG”, 4326, “8.2”,
URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
+ " REMARK[“注です。”]]",
object);
assertWktEquals(Convention.WKT2_SIMPLIFIED,
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -174,7 +174,7 @@ public final strictfp class DefaultCompo
" AXIS[“Gravity-related height”, UP],\n" +
" AUTHORITY[“EPSG”, “5714”]],\n" + // SIS includes
Identifier for component of CompoundCRS.
" TIMECRS[“Time”,\n" +
- " TIMEDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+ " TDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
" TIMEUNIT[“day”, 86400],\n" +
" AXIS[“Time”, FUTURE]]]",
HardCodedCRS.GEOID_4D);
@@ -187,25 +187,56 @@ public final strictfp class DefaultCompo
@DependsOnMethod("testWKT1")
public void testWKT2() {
assertWktEquals(Convention.WKT2,
+ "COMPOUNDCRS[“WGS 84 + height + time”,\n" +
+ " GEODCRS[“WGS 84”,\n" +
+ " DATUM[“World Geodetic System 1984”,\n" +
+ " ELLIPSOID[“WGS84”, 6378137.0, 298.257223563,
LENGTHUNIT[“metre”, 1]]],\n" +
+ " PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”,
0.017453292519943295]],\n" +
+ " CS[ellipsoidal, 2],\n" +
+ " AXIS[“Longitude (L)”, east, ORDER[1]],\n" +
+ " AXIS[“Latitude (B)”, north, ORDER[2]],\n" +
+ " ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+ " VERTCRS[“MSL height”,\n" +
+ " VDATUM[“Mean Sea Level”],\n" +
+ " CS[vertical, 1],\n" +
+ " AXIS[“Gravity-related height (H)”, up, ORDER[1]],\n" +
+ " LENGTHUNIT[“metre”, 1],\n" +
+ " ID[“EPSG”, 5714]],\n" + // SIS includes
Identifier for component of CompoundCRS.
+ " TIMECRS[“Time”,\n" +
+ " TDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+ " CS[temporal, 1],\n" +
+ " AXIS[“Time (t)”, future, ORDER[1]],\n" +
+ " TIMEUNIT[“day”, 86400]],\n" +
+ " AREA[“World”],\n" +
+ " BBOX[-90.00, -180.00, 90.00, 180.00]]",
+ HardCodedCRS.GEOID_4D);
+ }
+
+ /**
+ * Tests WKT 2 "simplified" formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Simplified() {
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"CompoundCRS[“WGS 84 + height + time”,\n" +
" GeodeticCRS[“WGS 84”,\n" +
" Datum[“World Geodetic System 1984”,\n" +
- " Ellipsoid[“WGS84”, 6378137.0, 298.257223563,
LengthUnit[“metre”, 1]]],\n" +
- " PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”,
0.017453292519943295]],\n" +
+ " Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
" CS[ellipsoidal, 2],\n" +
- " Axis[“Longitude (L)”, east, Order[1]],\n" +
- " Axis[“Latitude (B)”, north, Order[2]],\n" +
- " AngleUnit[“degree”, 0.017453292519943295]],\n" +
+ " Axis[“Longitude (L)”, east],\n" +
+ " Axis[“Latitude (B)”, north],\n" +
+ " Unit[“degree”, 0.017453292519943295]],\n" +
" VerticalCRS[“MSL height”,\n" +
" VerticalDatum[“Mean Sea Level”],\n" +
" CS[vertical, 1],\n" +
- " Axis[“Gravity-related height (H)”, up, Order[1]],\n" +
- " LengthUnit[“metre”, 1],\n" +
+ " Axis[“Gravity-related height (H)”, up],\n" +
+ " Unit[“metre”, 1],\n" +
" Id[“EPSG”, 5714]],\n" + // SIS includes
Identifier for component of CompoundCRS.
" TimeCRS[“Time”,\n" +
" TimeDatum[“Modified Julian”,
TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
" CS[temporal, 1],\n" +
- " Axis[“Time (t)”, future, Order[1]],\n" +
+ " Axis[“Time (t)”, future],\n" +
" TimeUnit[“day”, 86400]],\n" +
" Area[“World”],\n" +
" BBox[-90.00, -180.00, 90.00, 180.00]]",
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -166,19 +166,42 @@ public final strictfp class DefaultDeriv
@Test
@DependsOnMethod("testWKT1")
public void testWKT2() {
- assertWktEquals(
+ assertWktEquals(Convention.WKT2,
+ "GEODCRS[“Back to Greenwich”,\n" +
+ " BASEGEODCRS[“NTF (Paris)”,\n" +
+ " DATUM[“Nouvelle Triangulation Francaise”,\n" +
+ " ELLIPSOID[“NTF”, 6378249.2, 293.4660212936269,
LENGTHUNIT[“metre”, 1]]],\n" +
+ " PRIMEM[“Paris”, 2.5969213, ANGLEUNIT[“grade”,
0.015707963267948967]]],\n" +
+ " DERIVINGCONVERSION[“Paris to Greenwich”,\n" +
+ " METHOD[“Longitude rotation”, ID[“EPSG”, 9601]],\n" +
+ " PARAMETER[“Longitude offset”, 2.33722917, ID[“EPSG”,
8602]]],\n" +
+ " CS[ellipsoidal, 2],\n" +
+ " AXIS[“Latitude (B)”, north, ORDER[1]],\n" +
+ " AXIS[“Longitude (L)”, east, ORDER[2]],\n" +
+ " ANGLEUNIT[“degree”, 0.017453292519943295]]",
+ createLongitudeRotation());
+ }
+
+ /**
+ * Tests the WKT 2 "simplified" formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Simplified() {
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"GeodeticCRS[“Back to Greenwich”,\n" +
" BaseGeodCRS[“NTF (Paris)”,\n" +
" Datum[“Nouvelle Triangulation Francaise”,\n" +
- " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269,
LengthUnit[“metre”, 1]]],\n" +
- " PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”,
0.015707963267948967]]],\n" +
+ " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+ " PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”,
0.015707963267948967]],\n" +
+ " Unit[“degree”, 0.017453292519943295]],\n" +
" DerivingConversion[“Paris to Greenwich”,\n" +
- " Method[“Longitude rotation”, Id[“EPSG”, 9601]],\n" +
- " Parameter[“Longitude offset”, 2.33722917, Id[“EPSG”,
8602]]],\n" +
+ " Method[“Longitude rotation”],\n" +
+ " Parameter[“Longitude offset”, 2.33722917]],\n" +
" CS[ellipsoidal, 2],\n" +
- " Axis[“Latitude (B)”, north, Order[1]],\n" +
- " Axis[“Longitude (L)”, east, Order[2]],\n" +
- " AngleUnit[“degree”, 0.017453292519943295]]",
+ " Axis[“Latitude (B)”, north],\n" +
+ " Axis[“Longitude (L)”, east],\n" +
+ " Unit[“degree”, 0.017453292519943295]]",
createLongitudeRotation());
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -81,12 +81,28 @@ public final strictfp class DefaultEngin
public void testWKT2() {
final DefaultEngineeringCRS crs = createSpherical();
assertWktEquals(Convention.WKT2,
+ "ENGCRS[“A spherical CRS”,\n" +
+ " EDATUM[“Centre”],\n" +
+ " CS[spherical, 3],\n" +
+ " AXIS[“Spherical latitude (U)”, north, ORDER[1],
ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+ " AXIS[“Spherical longitude (V)”, east, ORDER[2],
ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+ " AXIS[“Geocentric radius (r)”, up, ORDER[3],
LENGTHUNIT[“metre”, 1]]]",
+ crs);
+ }
+
+ /**
+ * Tests WKT 2 "simplified" formatting.
+ */
+ @Test
+ public void testWKT2_Simplified() {
+ final DefaultEngineeringCRS crs = createSpherical();
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"EngineeringCRS[“A spherical CRS”,\n" +
" EngineeringDatum[“Centre”],\n" +
" CS[spherical, 3],\n" +
- " Axis[“Spherical latitude (U)”, north, Order[1],
AngleUnit[“degree”, 0.017453292519943295]],\n" +
- " Axis[“Spherical longitude (V)”, east, Order[2],
AngleUnit[“degree”, 0.017453292519943295]],\n" +
- " Axis[“Geocentric radius (r)”, up, Order[3],
LengthUnit[“metre”, 1]]]",
+ " Axis[“Spherical latitude (U)”, north, Unit[“degree”,
0.017453292519943295]],\n" +
+ " Axis[“Spherical longitude (V)”, east, Unit[“degree”,
0.017453292519943295]],\n" +
+ " Axis[“Geocentric radius (r)”, up, Unit[“metre”, 1]]]",
crs);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -96,15 +96,15 @@ public final strictfp class DefaultGeoce
@DependsOnMethod("testWKT1")
public void testWKT2() {
assertWktEquals(Convention.WKT2,
- "GeodeticCRS[“Geocentric”,\n" +
- " Datum[“World Geodetic System 1984”,\n" +
- " Ellipsoid[“WGS84”, 6378137.0, 298.257223563,
LengthUnit[“metre”, 1]]],\n" +
- " PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”,
0.017453292519943295]],\n" +
+ "GEODCRS[“Geocentric”,\n" +
+ " DATUM[“World Geodetic System 1984”,\n" +
+ " ELLIPSOID[“WGS84”, 6378137.0, 298.257223563,
LENGTHUNIT[“metre”, 1]]],\n" +
+ " PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”,
0.017453292519943295]],\n" +
" CS[Cartesian, 3],\n" +
- " Axis[“(X)”, geocentricX, Order[1]],\n" +
- " Axis[“(Y)”, geocentricY, Order[2]],\n" +
- " Axis[“(Z)”, geocentricZ, Order[3]],\n" +
- " LengthUnit[“metre”, 1]]",
+ " AXIS[“(X)”, geocentricX, ORDER[1]],\n" +
+ " AXIS[“(Y)”, geocentricY, ORDER[2]],\n" +
+ " AXIS[“(Z)”, geocentricZ, ORDER[3]],\n" +
+ " LENGTHUNIT[“metre”, 1]]",
HardCodedCRS.GEOCENTRIC);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -152,16 +152,16 @@ public final strictfp class DefaultGeogr
@DependsOnMethod("testWKT1")
public void testWKT2() {
assertWktEquals(Convention.WKT2,
- "GeodeticCRS[“WGS 84”,\n" +
- " Datum[“World Geodetic System 1984”,\n" +
- " Ellipsoid[“WGS84”, 6378137.0, 298.257223563,
LengthUnit[“metre”, 1]]],\n" +
- " PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”,
0.017453292519943295]],\n" +
+ "GEODCRS[“WGS 84”,\n" +
+ " DATUM[“World Geodetic System 1984”,\n" +
+ " ELLIPSOID[“WGS84”, 6378137.0, 298.257223563,
LENGTHUNIT[“metre”, 1]]],\n" +
+ " PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”,
0.017453292519943295]],\n" +
" CS[ellipsoidal, 2],\n" +
- " Axis[“Longitude (L)”, east, Order[1]],\n" +
- " Axis[“Latitude (B)”, north, Order[2]],\n" +
- " AngleUnit[“degree”, 0.017453292519943295],\n" +
- " Area[“World”],\n" +
- " BBox[-90.00, -180.00, 90.00, 180.00]]",
+ " AXIS[“Longitude (L)”, east, ORDER[1]],\n" +
+ " AXIS[“Latitude (B)”, north, ORDER[2]],\n" +
+ " ANGLEUNIT[“degree”, 0.017453292519943295],\n" +
+ " AREA[“World”],\n" +
+ " BBOX[-90.00, -180.00, 90.00, 180.00]]",
HardCodedCRS.WGS84);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -64,12 +64,21 @@ public final strictfp class DefaultImage
public void testWKT2() {
final DefaultImageCRS crs = create(true);
assertWktEquals(Convention.WKT2,
+ "IMAGECRS[“An image CRS”,\n" +
+ " IDATUM[“C1”],\n" +
+ " CS[Cartesian, 2],\n" +
+ " AXIS[“Column (i)”, columnPositive, ORDER[1]],\n" +
+ " AXIS[“Row (j)”, rowPositive, ORDER[2]],\n" +
+ " SCALEUNIT[“unity”, 1]]",
+ crs);
+
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"ImageCRS[“An image CRS”,\n" +
" ImageDatum[“C1”],\n" +
" CS[Cartesian, 2],\n" +
- " Axis[“Column (i)”, columnPositive, Order[1]],\n" +
- " Axis[“Row (j)”, rowPositive, Order[2]],\n" +
- " ScaleUnit[“unity”, 1]]",
+ " Axis[“Column (i)”, columnPositive],\n" +
+ " Axis[“Row (j)”, rowPositive],\n" +
+ " Unit[“unity”, 1]]",
crs);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -298,22 +298,43 @@ public final strictfp class DefaultProje
public void testWKT2_WithMixedUnits() throws FactoryException {
final ProjectedCRS crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
assertWktEquals(Convention.WKT2,
+ "PROJCRS[“NTF (Paris) / Lambert zone II”,\n" +
+ " BASEGEODCRS[“NTF (Paris)”,\n" +
+ " DATUM[“Nouvelle Triangulation Francaise”,\n" +
+ " ELLIPSOID[“NTF”, 6378249.2, 293.4660212936269,
LENGTHUNIT[“metre”, 1]]],\n" +
+ " PRIMEM[“Paris”, 2.5969213, ANGLEUNIT[“grade”,
0.015707963267948967]]],\n" +
+ " CONVERSION[“Lambert zone II”,\n" +
+ " METHOD[“Lambert Conic Conformal (1SP)”, ID[“EPSG”,
9801]],\n" +
+ " PARAMETER[“Latitude of natural origin”, 52.0,
ANGLEUNIT[“grade”, 0.015707963267948967], ID[“EPSG”, 8801]],\n" +
+ " PARAMETER[“Longitude of natural origin”, 0.0,
ANGLEUNIT[“degree”, 0.017453292519943295], ID[“EPSG”, 8802]],\n" +
+ " PARAMETER[“Scale factor at natural origin”, 0.99987742,
SCALEUNIT[“unity”, 1], ID[“EPSG”, 8805]],\n" +
+ " PARAMETER[“False easting”, 600000.0, LENGTHUNIT[“metre”,
1], ID[“EPSG”, 8806]],\n" +
+ " PARAMETER[“False northing”, 2200000.0,
LENGTHUNIT[“metre”, 1], ID[“EPSG”, 8807]]],\n" +
+ " CS[Cartesian, 2],\n" +
+ " AXIS[“Easting (E)”, east, ORDER[1]],\n" +
+ " AXIS[“Northing (N)”, north, ORDER[2]],\n" +
+ " LENGTHUNIT[“metre”, 1],\n" +
+ " ID[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]",
+ crs);
+
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" +
" BaseGeodCRS[“NTF (Paris)”,\n" +
" Datum[“Nouvelle Triangulation Francaise”,\n" +
- " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269,
LengthUnit[“metre”, 1]]],\n" +
- " PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”,
0.015707963267948967]]],\n" +
+ " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+ " PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”,
0.015707963267948967]],\n" +
+ " Unit[“degree”, 0.017453292519943295]],\n" +
" Conversion[“Lambert zone II”,\n" +
- " Method[“Lambert Conic Conformal (1SP)”, Id[“EPSG”,
9801]],\n" +
- " Parameter[“Latitude of natural origin”, 52.0,
AngleUnit[“grade”, 0.015707963267948967], Id[“EPSG”, 8801]],\n" +
- " Parameter[“Longitude of natural origin”, 0.0,
AngleUnit[“degree”, 0.017453292519943295], Id[“EPSG”, 8802]],\n" +
- " Parameter[“Scale factor at natural origin”, 0.99987742,
ScaleUnit[“unity”, 1], Id[“EPSG”, 8805]],\n" +
- " Parameter[“False easting”, 600000.0, LengthUnit[“metre”,
1], Id[“EPSG”, 8806]],\n" +
- " Parameter[“False northing”, 2200000.0,
LengthUnit[“metre”, 1], Id[“EPSG”, 8807]]],\n" +
+ " Method[“Lambert Conic Conformal (1SP)”],\n" +
+ " Parameter[“Latitude of natural origin”, 52.0,
Unit[“grade”, 0.015707963267948967]],\n" +
+ " Parameter[“Longitude of natural origin”, 0.0],\n" +
+ " Parameter[“Scale factor at natural origin”,
0.99987742],\n" +
+ " Parameter[“False easting”, 600000.0],\n" +
+ " Parameter[“False northing”, 2200000.0]],\n" +
" CS[Cartesian, 2],\n" +
- " Axis[“Easting (E)”, east, Order[1]],\n" +
- " Axis[“Northing (N)”, north, Order[2]],\n" +
- " LengthUnit[“metre”, 1],\n" +
+ " Axis[“Easting (E)”, east],\n" +
+ " Axis[“Northing (N)”, north],\n" +
+ " Unit[“metre”, 1],\n" +
" Id[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]",
crs);
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -40,7 +40,7 @@ public final strictfp class DefaultTempo
public void testWKT1() {
assertWktEquals(Convention.WKT1,
"TIMECRS[“Time”,\n" +
- " TIMEDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+ " TDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
" TIMEUNIT[“day”, 86400],\n" +
" AXIS[“Time”, FUTURE]]",
HardCodedCRS.TIME);
@@ -52,11 +52,25 @@ public final strictfp class DefaultTempo
@Test
public void testWKT2() {
assertWktEquals(Convention.WKT2,
+ "TIMECRS[“Time”,\n" +
+ " TDATUM[“Modified Julian”,
TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+ " CS[temporal, 1],\n" +
+ " AXIS[“Time (t)”, future, ORDER[1]],\n" +
+ " TIMEUNIT[“day”, 86400]]",
+ HardCodedCRS.TIME);
+ }
+
+ /**
+ * Tests WKT 2 "simplified" formatting.
+ */
+ @Test
+ public void testWKT2_Simplified() {
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"TimeCRS[“Time”,\n" +
" TimeDatum[“Modified Julian”,
TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
" CS[temporal, 1],\n" +
- " Axis[“Time (t)”, future, Order[1]],\n" +
- " TimeUnit[“day”, 86400]]",
+ " Axis[“Time (t)”, future],\n" +
+ " TimeUnit[“day”, 86400]]", // ISO 19162 does not
allow "Unit" keyword here.
HardCodedCRS.TIME);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java?rev=1701632&r1=1701631&r2=1701632&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
[UTF-8] Mon Sep 7 14:51:25 2015
@@ -53,11 +53,26 @@ public final strictfp class DefaultVerti
@DependsOnMethod("testWKT1")
public void testWKT2() {
assertWktEquals(Convention.WKT2,
+ "VERTCRS[“Depth”,\n" +
+ " VDATUM[“Mean Sea Level”],\n" +
+ " CS[vertical, 1],\n" +
+ " AXIS[“Depth (D)”, down, ORDER[1]],\n" +
+ " LENGTHUNIT[“metre”, 1]]",
+ HardCodedCRS.DEPTH);
+ }
+
+ /**
+ * Tests WKT 2 "simplified" formatting.
+ */
+ @Test
+ @DependsOnMethod("testWKT2")
+ public void testWKT2_Simplified() {
+ assertWktEquals(Convention.WKT2_SIMPLIFIED,
"VerticalCRS[“Depth”,\n" +
" VerticalDatum[“Mean Sea Level”],\n" +
" CS[vertical, 1],\n" +
- " Axis[“Depth (D)”, down, Order[1]],\n" +
- " LengthUnit[“metre”, 1]]",
+ " Axis[“Depth (D)”, down],\n" +
+ " Unit[“metre”, 1]]",
HardCodedCRS.DEPTH);
}
}