You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/02/14 01:07:49 UTC
svn commit: r1568171 - 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-metadata/src/test/java/org/apache/sis/io/wkt/
sis-referencing/src/main/java/org/apache/sis/...
Author: desruisseaux
Date: Fri Feb 14 00:07:48 2014
New Revision: 1568171
URL: http://svn.apache.org/r1568171
Log:
Partial support of WKT2 formatting of AXIS elements.
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.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/crs/DefaultEngineeringCRS.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.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/datum/DefaultEllipsoid.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -169,12 +169,13 @@ public enum Convention {
}
/**
- * Returns {@code true} if this convention is one of the WKT 1 variants.
+ * Returns the version of the Well Known Text represented by this convention.
+ * In current Apache SIS implementation, this method can return only 1 or 2.
*
- * @return {@code true} if this convention is one of the WKT 1 variants.
+ * @return 1 if this convention is one of the WKT 1 variants, or 2 otherwise.
*/
- public boolean isWKT1() {
- return isWKT1;
+ public int versionOfWKT() {
+ return isWKT1 ? 1 : 2;
}
/**
@@ -207,7 +208,8 @@ public enum Convention {
}
/**
- * Returns the default authority to look for when fetching Map Projection parameter names.
+ * Returns the default authority to look for when fetching identified object names and identifiers.
+ * The difference between various authorities are most easily seen in projection and parameter names.
* The value returned by this method can be overwritten by {@link WKTFormat#setNameAuthority(Citation)}.
*
* {@example The following table shows the names given by various organizations or projects for the same projection:
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -617,7 +617,7 @@ public class Formatter implements Locali
} else {
showIDs = isRoot || (object instanceof OperationMethod) || (object instanceof GeneralParameterDescriptor);
}
- if (convention.isWKT1()) {
+ if (convention.versionOfWKT() == 1) {
filterID = true;
showOthers = false;
} else {
@@ -906,7 +906,7 @@ public class Formatter implements Locali
final String quote = symbols.getQuote();
while ((fromIndex = buffer.indexOf(quote, fromIndex)) >= 0) {
final int n = quote.length();
- if (convention.isWKT1()) {
+ if (convention.versionOfWKT() == 1) {
buffer.delete(fromIndex, fromIndex + n);
} else {
buffer.insert(fromIndex += n, quote);
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -266,7 +266,8 @@ public class WKTFormat extends CompoundF
}
/**
- * Returns the preferred authority for choosing the projection and parameter names.
+ * Returns the preferred authority to look for when fetching identified object names and identifiers.
+ * The difference between various authorities are most easily seen in projection and parameter names.
* If no authority has been {@link #setNameAuthority(Citation) explicitly set}, then this
* method returns the authority associated to the {@linkplain #getConvention() convention}.
*
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -549,25 +549,23 @@ public class ImmutableIdentifier extends
@Override
protected String formatTo(final Formatter formatter) {
String keyword = null;
- final String code = getCode();
if (code != null) {
- String citation = Citations.getIdentifier(getAuthority());
- String codeSpace = getCodeSpace();
- if (codeSpace == null) {
- codeSpace = citation;
+ String citation = Citations.getIdentifier(authority);
+ String cs = codeSpace;
+ if (cs == null) {
+ cs = citation;
citation = null;
}
- if (codeSpace != null) {
+ if (cs != null) {
final Convention convention = formatter.getConvention();
- if (convention.isWKT1()) {
+ if (convention.versionOfWKT() == 1) {
keyword = "AUTHORITY";
- formatter.append(codeSpace, null);
+ formatter.append(cs, null);
formatter.append(code, null);
} else {
keyword = "ID";
- formatter.append(codeSpace, null);
+ formatter.append(cs, null);
appendCode(formatter, code);
- final String version = getVersion();
if (version != null) {
appendCode(formatter, version);
formatter.append(citation, null);
@@ -579,10 +577,10 @@ public class ImmutableIdentifier extends
*/
if (convention != Convention.INTERNAL && formatter.getEnclosingElement(2) == null) {
final FormattableObject parent = formatter.getEnclosingElement(1);
- if (parent != null && ReferencingUtilities.usesURN(codeSpace)) {
+ if (parent != null && ReferencingUtilities.usesURN(cs)) {
final String type = ReferencingUtilities.toURNType(parent.getClass());
if (type != null) {
- formatter.append(new URI(type, codeSpace, version, code));
+ formatter.append(new URI(type, cs, version, code));
}
}
}
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ConventionTest.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -45,15 +45,15 @@ public final strictfp class ConventionTe
}
/**
- * Tests {@link Convention#isWKT1()}.
+ * Tests {@link Convention#versionOfWKT()}.
*/
@Test
- public void testIsWKT1() {
- assertFalse(Convention.WKT2.isWKT1());
- assertFalse(Convention.WKT2_SIMPLIFIED.isWKT1());
- assertTrue (Convention.WKT1.isWKT1());
- assertTrue (Convention.WKT1_COMMON_UNITS.isWKT1());
- assertFalse(Convention.INTERNAL.isWKT1());
+ public void testVersion() {
+ assertEquals(2, Convention.WKT2.versionOfWKT());
+ assertEquals(2, Convention.WKT2_SIMPLIFIED.versionOfWKT());
+ assertEquals(1, Convention.WKT1.versionOfWKT());
+ assertEquals(1, Convention.WKT1_COMMON_UNITS.versionOfWKT());
+ assertEquals(2, Convention.INTERNAL.versionOfWKT());
}
/**
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -696,20 +696,20 @@ public class DefaultParameterValue<T> ex
@Override
protected String formatTo(final Formatter formatter) {
WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER);
- final Unit<?> unit = formatter.toContextualUnit(descriptor.getUnit());
- if (unit != null) {
- double value;
+ final Unit<?> targetUnit = formatter.toContextualUnit(descriptor.getUnit());
+ if (targetUnit != null) {
+ double convertedValue;
try {
- value = doubleValue(unit);
+ convertedValue = doubleValue(targetUnit);
} catch (IllegalStateException exception) {
// May happen if a parameter is mandatory (e.g. "semi-major")
// but no value has been set for this parameter.
formatter.setInvalidWKT(descriptor, exception);
- value = Double.NaN;
+ convertedValue = Double.NaN;
}
- formatter.append(value);
+ formatter.append(convertedValue);
} else {
- formatter.appendAny(getValue());
+ formatter.appendAny(value);
}
return "PARAMETER";
}
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -46,14 +46,13 @@ import static org.apache.sis.util.Argume
* </ul>
*
* <p><b>Used with coordinate system types:</b>
- * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian},
* {@linkplain org.apache.sis.referencing.cs.DefaultAffineCS Affine},
- * {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS Ellipsoidal},
- * {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS Spherical},
+ * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian},
* {@linkplain org.apache.sis.referencing.cs.DefaultCylindricalCS Cylindrical},
- * {@linkplain org.apache.sis.referencing.cs.DefaultPolarCS Polar},
- * {@linkplain org.apache.sis.referencing.cs.DefaultVerticalCS Vertical} or
* {@linkplain org.apache.sis.referencing.cs.DefaultLinearCS Linear}.
+ * {@linkplain org.apache.sis.referencing.cs.DefaultPolarCS Polar},
+ * {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS Spherical} or
+ * {@linkplain org.apache.sis.referencing.cs.DefaultUserDefinedCS User Defined}.
* </p>
*
* {@section Immutability and thread safety}
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -229,7 +229,7 @@ public class DefaultGeocentricCRS extend
formatter.newLine();
formatter.append(unit);
CoordinateSystem cs = getCoordinateSystem();
- if (formatter.getConvention().isWKT1()) {
+ if (formatter.getConvention().versionOfWKT() == 1) {
if (cs instanceof CartesianCS) {
cs = Legacy.forGeocentricCRS((CartesianCS) cs, true);
} else {
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -439,7 +439,7 @@ public class AbstractCS extends Abstract
formatter.setInvalidWKT(this, null);
}
formatter.append(type, null);
- formatter.append(getDimension());
+ formatter.append(axes.length);
return "CS";
}
}
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlRoot
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.referencing.crs.GeodeticCRS;
+import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
@@ -45,11 +47,13 @@ import org.apache.sis.util.resources.Err
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.io.wkt.Convention;
+import org.apache.sis.io.wkt.ElementKind;
import static java.lang.Double.doubleToLongBits;
import static java.lang.Double.NEGATIVE_INFINITY;
import static java.lang.Double.POSITIVE_INFINITY;
-import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
+import static org.apache.sis.util.ArgumentChecks.*;
import static org.apache.sis.util.CharSequences.trimWhitespaces;
import static org.apache.sis.util.collection.Containers.property;
import static org.apache.sis.internal.metadata.MetadataUtilities.canSetProperty;
@@ -291,9 +295,9 @@ public class DefaultCoordinateSystemAxis
this.abbreviation = abbreviation;
this.direction = direction;
this.unit = unit;
- ensureNonNull("abbreviation", abbreviation);
- ensureNonNull("direction", direction);
- ensureNonNull("unit", unit);
+ ensureNonEmpty("abbreviation", abbreviation);
+ ensureNonNull ("direction", direction);
+ ensureNonNull ("unit", unit);
Number minimum = property(properties, MINIMUM_VALUE_KEY, Number.class);
Number maximum = property(properties, MAXIMUM_VALUE_KEY, Number.class);
RangeMeaning rm = property(properties, RANGE_MEANING_KEY, RangeMeaning.class);
@@ -714,14 +718,68 @@ public class DefaultCoordinateSystemAxis
}
/**
+ * Returns {@code true} if writing an axis in the given formatter should omit the axis name.
+ * From ISO 19162: For geodetic CRSs having a geocentric Cartesian coordinate system,
+ * the axis name should be omitted as it is given through the mandatory axis direction,
+ * but the axis abbreviation, respectively ‘X’, 'Y' and ‘Z’, shall be given.
+ */
+ private static boolean omitName(final Formatter formatter) {
+ if (formatter.getEnclosingElement(2) instanceof GeodeticCRS) {
+ if (formatter.getEnclosingElement(1) instanceof CartesianCS) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Formats the inner part of a <cite>Well Known Text</cite> (WKT) element.
*
+ * {@section Constraints for WKT validity}
+ * The ISO 19162 specification puts many constraints on axis names, abbreviations and directions allowed in WKT.
+ * Most of those constraints are inherited from ISO 19111 - see {@link CoordinateSystemAxis} javadoc for some of
+ * those. The current Apache SIS implementation does not verify whether this axis name and abbreviation are
+ * compliant; we assume that the user created a valid axis.
+ * The only exceptions are:
+ *
+ * <ul>
+ * <li>“<cite>Geodetic latitude</cite>” and “<cite>Geodetic longitude</cite>” name (case insensitive)
+ * are replaced 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"}.
*/
@Override
protected String formatTo(final Formatter formatter) {
- super.formatTo(formatter);
+ final Convention convention = formatter.getConvention();
+ final boolean isWKT1 = convention.versionOfWKT() == 1;
+ final boolean isInternal = (convention == Convention.INTERNAL);
+ String name = null;
+ if (isWKT1 || isInternal || !omitName(formatter)) {
+ name = IdentifiedObjects.getName(this, formatter.getNameAuthority());
+ if (name == null) {
+ name = IdentifiedObjects.getName(this, null);
+ }
+ if (!isInternal && name != null) {
+ if (name.equalsIgnoreCase("Geodetic latitude")) {
+ name = "Latitude";
+ } else if (name.equalsIgnoreCase("Geodetic longitude")) {
+ name = "Longitude";
+ }
+ }
+ }
+ /*
+ * ISO 19162 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
+ */
+ if (!isWKT1 && (name == null || !name.equals(abbreviation))) {
+ final StringBuilder buffer = new StringBuilder();
+ if (name != null) {
+ buffer.append(name).append(' ');
+ }
+ name = buffer.append('(').append(abbreviation).append(')').toString();
+ }
+ formatter.append(name, ElementKind.AXIS);
formatter.append(direction);
return "AXIS";
}
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -760,9 +760,8 @@ public class DefaultEllipsoid extends Ab
@Override
protected String formatTo(final Formatter formatter) {
super.formatTo(formatter);
- final double ivf = getInverseFlattening();
- formatter.append(getAxisUnit().getConverterTo(SI.METRE).convert(getSemiMajorAxis()));
- formatter.append(isInfinite(ivf) ? 0 : ivf);
+ formatter.append(unit.getConverterTo(SI.METRE).convert(semiMajorAxis));
+ formatter.append(isInfinite(inverseFlattening) ? 0 : inverseFlattening);
return "SPHEROID";
}
}
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=1568171&r1=1568170&r2=1568171&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] Fri Feb 14 00:07:48 2014
@@ -339,11 +339,11 @@ public class DefaultPrimeMeridian extend
@Override
protected String formatTo(final Formatter formatter) {
super.formatTo(formatter);
- Unit<Angle> unit = formatter.getContextualUnit(Angle.class);
- if (unit == null) {
- unit = NonSI.DEGREE_ANGLE;
+ Unit<Angle> targetUnit = formatter.getContextualUnit(Angle.class);
+ if (targetUnit == null) {
+ targetUnit = NonSI.DEGREE_ANGLE;
}
- formatter.append(getGreenwichLongitude(unit));
+ formatter.append(getGreenwichLongitude(targetUnit));
return "PRIMEM";
}
}
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRSTest.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -79,8 +79,8 @@ public final strictfp class HardCodedCRS
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
" PRIMEM[“Greenwich”, 0.0],\n" +
" UNIT[“degree”, 0.017453292519943295],\n" +
- " AXIS[“Geodetic longitude”, EAST],\n" +
- " AXIS[“Geodetic latitude”, NORTH]]",
+ " AXIS[“Longitude”, EAST],\n" +
+ " AXIS[“Latitude”, NORTH]]",
WGS84);
assertWktEquals(Convention.WKT2,
@@ -89,8 +89,8 @@ public final strictfp class HardCodedCRS
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
" PRIMEM[“Greenwich”, 0.0],\n" +
" ANGLEUNIT[“degree”, 0.017453292519943295],\n" +
- " AXIS[“Geodetic longitude”, EAST],\n" +
- " AXIS[“Geodetic latitude”, NORTH],\n" +
+ " AXIS[“Longitude (λ)”, EAST],\n" +
+ " AXIS[“Latitude (φ)”, NORTH],\n" +
" AREA[“World”],\n" +
" BBOX[-90.00, -180.00, 90.00, 180.00]]",
WGS84);
@@ -101,8 +101,8 @@ public final strictfp class HardCodedCRS
" SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
" PRIMEM[“Greenwich”, 0.0],\n" +
" UNIT[“degree”, 0.017453292519943295],\n" +
- " AXIS[“Geodetic longitude”, EAST],\n" +
- " AXIS[“Geodetic latitude”, NORTH],\n" +
+ " AXIS[“Longitude (λ)”, EAST],\n" +
+ " AXIS[“Latitude (φ)”, NORTH],\n" +
" AREA[“World”],\n" +
" BBOX[-90.00, -180.00, 90.00, 180.00]]",
WGS84);
@@ -114,8 +114,8 @@ public final strictfp class HardCodedCRS
" ID[“EPSG”, 6326]],\n" +
" PRIMEM[“Greenwich”, 0.0, ID[“EPSG”, 8901]],\n" +
" UNIT[“degree”, 0.017453292519943295],\n" +
- " AXIS[“Geodetic longitude”, EAST],\n" +
- " AXIS[“Geodetic latitude”, NORTH],\n" +
+ " AXIS[“Geodetic longitude (λ)”, EAST],\n" +
+ " AXIS[“Geodetic latitude (φ)”, NORTH],\n" +
" AREA[“World”],\n" +
" BBOX[-90.00, -180.00, 90.00, 180.00]]",
WGS84);
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1568171&r1=1568170&r2=1568171&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Fri Feb 14 00:07:48 2014
@@ -20,6 +20,7 @@ import javax.measure.unit.NonSI;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.RangeMeaning;
import org.opengis.test.Validators;
+import org.apache.sis.io.wkt.Convention;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
@@ -83,17 +84,22 @@ public final strictfp class DefaultCoord
*/
@Test
public void testWKT() {
- assertWktEquals("AXIS[“x”, EAST]", X);
- assertWktEquals("AXIS[“y”, NORTH]", Y);
- assertWktEquals("AXIS[“z”, UP]", Z);
- assertWktEquals("AXIS[“Longitude”, EAST]", LONGITUDE_gon);
- assertWktEquals("AXIS[“Latitude”, NORTH]", LATITUDE_gon);
- assertWktEquals("AXIS[“Altitude”, UP]", ALTITUDE);
- assertWktEquals("AXIS[“Time”, FUTURE]", TIME);
- assertWktEquals("AXIS[“Geodetic longitude”, EAST]", GEODETIC_LONGITUDE);
- assertWktEquals("AXIS[“Spherical longitude”, EAST]", SPHERICAL_LONGITUDE);
- assertWktEquals("AXIS[“Geodetic latitude”, NORTH]", GEODETIC_LATITUDE);
- assertWktEquals("AXIS[“Spherical latitude”, NORTH]", SPHERICAL_LATITUDE);
+ assertWktEquals("AXIS[“x”, EAST]", X);
+ assertWktEquals("AXIS[“y”, NORTH]", Y);
+ assertWktEquals("AXIS[“z”, UP]", Z);
+ assertWktEquals("AXIS[“Longitude (λ)”, EAST]", LONGITUDE_gon);
+ assertWktEquals("AXIS[“Latitude (φ)”, NORTH]", LATITUDE_gon);
+ assertWktEquals("AXIS[“Altitude (h)”, UP]", ALTITUDE);
+ assertWktEquals("AXIS[“Time (t)”, FUTURE]", TIME);
+ assertWktEquals("AXIS[“Longitude (λ)”, EAST]", GEODETIC_LONGITUDE);
+ assertWktEquals("AXIS[“Spherical longitude (Ω)”, EAST]", SPHERICAL_LONGITUDE);
+ assertWktEquals("AXIS[“Latitude (φ)”, NORTH]", GEODETIC_LATITUDE);
+ assertWktEquals("AXIS[“Spherical latitude (Θ)”, NORTH]", SPHERICAL_LATITUDE);
+
+ assertWktEquals(Convention.INTERNAL, "AXIS[“Geodetic longitude (λ)”, EAST]", GEODETIC_LONGITUDE);
+ assertWktEquals(Convention.INTERNAL, "AXIS[“Spherical longitude (Ω)”, EAST]", SPHERICAL_LONGITUDE);
+ assertWktEquals(Convention.INTERNAL, "AXIS[“Geodetic latitude (φ)”, NORTH]", GEODETIC_LATITUDE);
+ assertWktEquals(Convention.INTERNAL, "AXIS[“Spherical latitude (Θ)”, NORTH]", SPHERICAL_LATITUDE);
}
/**