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 2015/06/26 20:03:39 UTC
svn commit: r1687826 [3/3] - in /sis/trunk: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/t...
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -32,6 +32,7 @@ import org.opengis.referencing.datum.*;
import org.opengis.parameter.ParameterValue;
import org.opengis.parameter.ParameterValueGroup;
import org.apache.sis.internal.metadata.AxisNames;
+import org.apache.sis.referencing.cs.CoordinateSystems;
import org.apache.sis.referencing.datum.BursaWolfParameters;
import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
import org.apache.sis.test.DependsOnMethod;
@@ -58,7 +59,7 @@ import static org.apache.sis.test.Refere
org.apache.sis.referencing.crs.DefaultVerticalCRSTest.class,
org.apache.sis.referencing.crs.DefaultTemporalCRSTest.class,
org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
- org.apache.sis.internal.referencing.AxisDirectionsTest.class
+ org.apache.sis.referencing.cs.DirectionAlongMeridianTest.class
})
public final strictfp class GeodeticObjectParserTest extends TestCase {
/**
@@ -67,6 +68,13 @@ public final strictfp class GeodeticObje
private GeodeticObjectParser parser;
/**
+ * Instantiates the parser to test.
+ */
+ private void newParser(final Convention convention) {
+ parser = new GeodeticObjectParser(Symbols.getDefault(), null, null, null, convention, Transliterator.DEFAULT, null, null);
+ }
+
+ /**
* Parses the given text.
*
* @param type The expected object type.
@@ -76,7 +84,7 @@ public final strictfp class GeodeticObje
*/
private <T> T parse(final Class<T> type, final String text) throws ParseException {
if (parser == null) {
- parser = new GeodeticObjectParser();
+ newParser(Convention.DEFAULT);
}
final ParsePosition position = new ParsePosition(0);
final Object obj = parser.parseObject(text, position);
@@ -89,14 +97,6 @@ public final strictfp class GeodeticObje
}
/**
- * Uses a new parser for the given convention.
- */
- private void setConvention(final Convention convention) {
- final GeodeticObjectParser p = parser;
- parser = new GeodeticObjectParser(p.symbols, null, null, null, convention, p.errorLocale, null);
- }
-
- /**
* Asserts that the name and (optionally) the EPSG identifier of the given object
* are equal to the given strings.
*
@@ -137,13 +137,70 @@ public final strictfp class GeodeticObje
}
/**
- * Verifies that the axes of the coordinate system are those of a projected CRS,
- * with (East, North) axis directions.
+ * Tests the parsing of an axis.
+ *
+ * @throws ParseException if the parsing failed.
*/
- private static void verifyProjectedCS(final CartesianCS cs, final Unit<Length> unit) {
- assertEquals("dimension", 2, cs.getDimension());
- assertUnboundedAxisEquals("Easting", "E", AxisDirection.EAST, unit, cs.getAxis(0));
- assertUnboundedAxisEquals("Northing", "N", AxisDirection.NORTH, unit, cs.getAxis(1));
+ @Test
+ public void testAxis() throws ParseException {
+ CoordinateSystemAxis axis = parse(CoordinateSystemAxis.class, "AXIS[“(Y)”, geocentricY]");
+ assertEquals("name", "Y", axis.getName().getCode());
+ assertEquals("abbreviation", "Y", axis.getAbbreviation());
+ assertEquals("direction", AxisDirection.GEOCENTRIC_Y, axis.getDirection());
+ assertEquals("unit", SI.METRE, axis.getUnit());
+
+ axis = parse(CoordinateSystemAxis.class, "AXIS[“latitude”,north,ORDER[1],ANGLEUNIT[“degree”,0.0174532925199433]]");
+ assertEquals("name", "latitude", axis.getName().getCode());
+ assertEquals("abbreviation", "φ", axis.getAbbreviation());
+ assertEquals("direction", AxisDirection.NORTH, axis.getDirection());
+ assertEquals("unit", NonSI.DEGREE_ANGLE, axis.getUnit());
+
+ axis = parse(CoordinateSystemAxis.class, "AXIS[“longitude”,EAST,order[2],UNIT[“degree”,0.0174532925199433]]");
+ assertEquals("name", "longitude", axis.getName().getCode());
+ assertEquals("abbreviation", "λ", axis.getAbbreviation());
+ assertEquals("direction", AxisDirection.EAST, axis.getDirection());
+ assertEquals("unit", NonSI.DEGREE_ANGLE, axis.getUnit());
+
+ axis = parse(CoordinateSystemAxis.class, "AXIS[“ellipsoidal height (h)”,up,ORDER[3],LengthUnit[“kilometre”,1000]]");
+ assertEquals("name", "ellipsoidal height", axis.getName().getCode());
+ assertEquals("abbreviation", "h", axis.getAbbreviation());
+ assertEquals("direction", AxisDirection.UP, axis.getDirection());
+ assertEquals("unit", SI.KILOMETRE, axis.getUnit());
+
+ axis = parse(CoordinateSystemAxis.class, "AXIS[“time (t)”,future,TimeUnit[“hour”,3600]]");
+ assertEquals("name", "time", axis.getName().getCode());
+ assertEquals("abbreviation", "t", axis.getAbbreviation());
+ assertEquals("direction", AxisDirection.FUTURE, axis.getDirection());
+ assertEquals("unit", NonSI.HOUR, axis.getUnit());
+
+ axis = parse(CoordinateSystemAxis.class, "AXIS[“easting (X)”,south,MERIDIAN[90,UNIT[“degree”,0.0174532925199433]]]");
+ assertEquals("name", "easting", axis.getName().getCode());
+ assertEquals("abbreviation", "X", axis.getAbbreviation());
+ assertEquals("direction", CoordinateSystems.directionAlongMeridian(AxisDirection.SOUTH, 90), axis.getDirection());
+ assertEquals("unit", SI.METRE, axis.getUnit());
+ }
+
+ /**
+ * Tests the parsing of a geodetic datum from a WKT 2 string.
+ *
+ * @throws ParseException if the parsing failed.
+ */
+ @Test
+ public void testDatum() throws ParseException {
+ final GeodeticDatum datum = parse(GeodeticDatum.class,
+ "DATUM[“Tananarive 1925”,\n" +
+ " ELLIPSOID[“International 1924”, 6378.388, 297.0, LENGTHUNIT[“km”, 1000]],\n" +
+ " ANCHOR[“Tananarive observatory”]]");
+
+ assertNameAndIdentifierEqual("Tananarive 1925", 0, datum);
+ assertEquals("anchor", "Tananarive observatory", String.valueOf(datum.getAnchorPoint()));
+
+ final Ellipsoid ellipsoid = datum.getEllipsoid();
+ assertNameAndIdentifierEqual("International 1924", 0, ellipsoid);
+ assertEquals("unit", SI.KILOMETRE, ellipsoid.getAxisUnit());
+ assertEquals("semiMajor", 6378.388, ellipsoid.getSemiMajorAxis(), STRICT);
+ assertEquals("inverseFlattening", 297, ellipsoid.getInverseFlattening(), STRICT);
+ assertEquals("greenwichLongitude", 0, datum.getPrimeMeridian().getGreenwichLongitude(), STRICT);
}
/**
@@ -154,6 +211,7 @@ public final strictfp class GeodeticObje
* @throws ParseException if the parsing failed.
*/
@Test
+ @DependsOnMethod({"testAxis", "testDatum"})
public void testGeocentricCRS() throws ParseException {
final GeocentricCRS crs = parse(GeocentricCRS.class,
"GEOCCS[“Geocentric”,\n" +
@@ -191,6 +249,7 @@ public final strictfp class GeodeticObje
* @throws ParseException if the parsing failed.
*/
@Test
+ @DependsOnMethod({"testAxis", "testDatum"})
public void testGeographicCRS() throws ParseException {
verifyGeographicCRS(0, parse(GeographicCRS.class,
" GEOGCS[“WGS 84”,\n" +
@@ -263,6 +322,16 @@ public final strictfp class GeodeticObje
}
/**
+ * Verifies that the axes of the coordinate system are those of a projected CRS,
+ * with (East, North) axis directions.
+ */
+ private static void verifyProjectedCS(final CartesianCS cs, final Unit<Length> unit) {
+ assertEquals("dimension", 2, cs.getDimension());
+ assertUnboundedAxisEquals("Easting", "E", AxisDirection.EAST, unit, cs.getAxis(0));
+ assertUnboundedAxisEquals("Northing", "N", AxisDirection.NORTH, unit, cs.getAxis(1));
+ }
+
+ /**
* Tests the parsing of a projected CRS from a WKT 1 string.
*
* @throws ParseException if the parsing failed.
@@ -349,7 +418,7 @@ public final strictfp class GeodeticObje
* So we allow this interpretation in Convention.WKT1_COMMON_UNITS for compatibility reasons.
*/
wkt = wkt.replace("2.5969213", "2.33722917"); // Convert unit in prime meridian.
- setConvention(Convention.WKT1_IGNORE_AXES);
+ newParser(Convention.WKT1_IGNORE_AXES);
crs = parse(GeographicCRS.class, wkt);
assertNameAndIdentifierEqual("NTF (Paris)", 0, crs);
pm = verifyNTF(crs.getDatum(), false);
@@ -403,7 +472,7 @@ public final strictfp class GeodeticObje
wkt = wkt.replace("52.0", "46.8"); // Convert unit in “latitude_of_origin” parameter.
wkt = wkt.replace("600.0", "600000"); // Convert unit in “false_easting” parameter.
wkt = wkt.replace("2200.0", "2200000"); // Convert unit in “false_northing” parameter.
- setConvention(Convention.WKT1_IGNORE_AXES);
+ newParser(Convention.WKT1_IGNORE_AXES);
crs = parse(ProjectedCRS.class, wkt);
assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
@@ -635,7 +704,7 @@ public final strictfp class GeodeticObje
@Test
@DependsOnMethod("testWithImplicitAxes")
public void testWarnings() throws ParseException {
- parser = new GeodeticObjectParser();
+ newParser(Convention.DEFAULT);
final ParsePosition position = new ParsePosition(0);
final GeographicCRS crs = (GeographicCRS) parser.parseObject(
" GEOGCS[“WGS 84”,\n" +
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -49,14 +49,6 @@ public final strictfp class WKTFormatTes
private WKTFormat parser;
/**
- * Verifies the condition documented in {@link WKTFormat#SHORT_DATE_PATTERN} javadoc.
- */
- @Test
- public void testDatePatterns() {
- assertTrue(WKTFormat.DATE_PATTERN.startsWith(WKTFormat.SHORT_DATE_PATTERN));
- }
-
- /**
* Tests integration in {@link WKTFormat#parse(CharSequence, ParsePosition)}.
* This method tests only a simple WKT because it is not the purpose of this
* method to test the parser itself. We only want to tests its integration in
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CoordinateSystemsTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -52,7 +52,6 @@ import static org.apache.sis.test.Assert
* @module
*/
@DependsOn({
- org.apache.sis.internal.referencing.AxisDirectionsTest.class,
DirectionAlongMeridianTest.class,
NormalizerTest.class
})
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCompoundCSTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
* @version 0.6
* @module
*/
-@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
+@DependsOn(org.apache.sis.internal.metadata.AxisDirectionsTest.class)
public final strictfp class DefaultCompoundCSTest extends TestCase {
/**
* Tests {@link DefaultCompoundCS} construction.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -118,7 +118,7 @@ public final strictfp class DefaultCoord
public void testMeridianWKT() {
assertWktEquals("Axis[“South along 90°W (x)”, south, Meridian[-90.0, AngleUnit[“degree”, 0.017453292519943295]], LengthUnit[“metre”, 1]]",
new DefaultCoordinateSystemAxis(singletonMap(DefaultCoordinateSystemAxis.NAME_KEY, "South along 90°W"),
- "x", DirectionAlongMeridian.parse("South along 90°W").getDirection(), SI.METRE));
+ "x", new DirectionAlongMeridian(AxisDirection.SOUTH, -90).getDirection(), SI.METRE));
}
/**
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -32,7 +32,7 @@ import static org.apache.sis.test.Metada
* @version 0.4
* @module
*/
-@DependsOn(org.apache.sis.internal.referencing.AxisDirectionsTest.class)
+@DependsOn(org.apache.sis.internal.metadata.AxisDirectionsTest.class)
public final strictfp class DirectionAlongMeridianTest extends TestCase {
/**
* Tests the {@link DirectionAlongMeridian#parse(AxisDirection)} method.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -184,11 +184,17 @@ public final strictfp class HardCodedAxe
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
* The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "θ" (theta).
*
+ * <p>This axis is close to the definition found in the EPSG database, except for the "long" abbreviation which
+ * is replaced by "θ". Note that other conventions exist, in which the meaning of φ and θ are interchanged.</p>
+ *
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
*
* @see #GEODETIC_LONGITUDE
* @see #SPHERICAL_LATITUDE
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Spherical_coordinate_system">Spherical coordinate system on Wikipedia</a>
+ * @see <a href="http://mathworld.wolfram.com/SphericalCoordinates.html">Spherical coordinate system on MathWorld</a>
*/
public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create(AxisNames.SPHERICAL_LONGITUDE, "θ",
AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
@@ -200,6 +206,10 @@ public final strictfp class HardCodedAxe
* and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
* The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "φ′" (phi prime).
*
+ * <p>This axis is close to the definition found in the EPSG database, except for the "lat" abbreviation
+ * which is replaced by "φ′". Note that other conventions exist, in which the meaning of φ and θ are
+ * interchanged or in which this axis is named "elevation" and is oriented toward "Up".</p>
+ *
* <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
* {@link #GEOCENTRIC_RADIUS} set.</p>
*
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -184,7 +184,7 @@ public final strictfp class DefaultGeode
public void testToWKT() {
final DefaultGeodeticDatum datum = new DefaultGeodeticDatum(WGS84);
assertWktEquals(
- "Datum[“WGS84”,\n" +
+ "GeodeticDatum[“WGS84”,\n" +
" Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]]",
datum);
}
@@ -266,13 +266,13 @@ public final strictfp class DefaultGeode
datum);
assertWktEquals(Convention.WKT2,
- "Datum[“World Geodetic System 1984”,\n" +
+ "GeodeticDatum[“World Geodetic System 1984”,\n" +
" Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]],\n" +
" Id[“EPSG”, 6326, URI[“urn:ogc:def:datum:EPSG::6326”]]]",
datum);
assertWktEquals(Convention.INTERNAL,
- "Datum[“World Geodetic System 1984”,\n" +
+ "GeodeticDatum[“World Geodetic System 1984”,\n" +
" Ellipsoid[“WGS 84”, 6378137.0, 298.257223563, Id[“EPSG”, 7030],\n" +
" Remark[“Defining parameters cited in EPSG database.”]],\n" +
" Anchor[“Station coordinates changed by a few centimetres in 1994, 1997, 2002 and 2012.”],\n" +
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -30,9 +30,9 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
+ org.apache.sis.internal.metadata.AxisDirectionsTest.class,
org.apache.sis.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.j2d.ShapeUtilitiesTest.class,
- org.apache.sis.internal.referencing.AxisDirectionsTest.class,
org.apache.sis.internal.referencing.PositionalAccuracyConstantTest.class,
org.apache.sis.internal.referencing.ReferencingUtilitiesTest.class,
org.apache.sis.internal.jaxb.referencing.CodeTest.class,
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/CharSequenceAdapter.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -31,7 +31,7 @@ import org.apache.sis.internal.jaxb.gmd.
* for ISO-19139 compliance. A {@link CharSequenceAdapter} can handle the following types:
*
* <ul>
- * <li>{@link InternationalString}, which will be mapped to {@link PT_FreeText} elements.</li>
+ * <li>{@link InternationalString}, which may be mapped to {@link PT_FreeText} elements.</li>
* <li>{@link String} (actually any character sequences other than {@code InternationalString}).</li>
* <li>{@link Anchor}, which can be substituted to any of the above if the {@link ReferenceResolver}
* in the current marshalling context maps the given text to a {@code xlink}.</li>
@@ -41,7 +41,7 @@ import org.apache.sis.internal.jaxb.gmd.
* @author Guilhem Legal (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.6
* @module
*
* @see StringAdapter
@@ -98,7 +98,7 @@ public final class CharSequenceAdapter e
* </gmd:someElement>
*/
if (value instanceof InternationalString) {
- final PT_FreeText ft = PT_FreeText.create(Context.current(), (InternationalString) value);
+ final PT_FreeText ft = PT_FreeText.create((InternationalString) value);
if (ft != null) {
return ft;
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
+import org.opengis.util.InternationalString;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.internal.jaxb.Context;
import org.apache.sis.internal.jaxb.gmx.Anchor;
@@ -40,7 +41,7 @@ import org.apache.sis.util.resources.Mes
*
* @author Cédric Briançon (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.6
* @module
*
* @see org.apache.sis.internal.jaxb.gmd.PT_FreeText
@@ -158,6 +159,12 @@ public class GO_CharacterString {
if (type == 0) {
final CharSequence text = this.text;
if (text != null && !(text instanceof Anchor)) {
+ if (text instanceof InternationalString) {
+ final Context context = Context.current();
+ if (context != null) {
+ return ((InternationalString) text).toString(context.getLocale());
+ }
+ }
return text.toString();
}
}
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -57,7 +57,7 @@ import org.apache.sis.util.ArraysExt;
* @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.6
* @module
*
* @see <a href="http://jira.geotoolkit.org/browse/GEOTK-152">GEOTK-152</a>
@@ -106,14 +106,10 @@ public final class PT_FreeText extends G
* if it contains at least one non-root locale. Otherwise returns {@code null}, meaning that
* the simpler {@link GO_CharacterString} construct should be used instead.
*
- * @param context The current (un)marshalling context, or {@code null} if none.
- * @param text An international string which could have several translations
- * embedded for the same text.
- * @return A {@code PT_FreeText} instance if the given text has several translations,
- * or {@code null} otherwise.
+ * @param text An international string which could have several translations embedded for the same text.
+ * @return A {@code PT_FreeText} instance if the given text has several translations, or {@code null} otherwise.
*/
- @SuppressWarnings("fallthrough")
- public static PT_FreeText create(final Context context, final InternationalString text) {
+ public static PT_FreeText create(final InternationalString text) {
if (text instanceof DefaultInternationalString) {
final DefaultInternationalString df = (DefaultInternationalString) text;
final Set<Locale> locales = df.getLocales();
@@ -131,6 +127,7 @@ public final class PT_FreeText extends G
* default. It is usually safer to avoid null value, but in this particular case
* the implementation (DefaultInternationalString) is known to support null.
*/
+ final Context context = Context.current();
return new PT_FreeText(df.toString(context != null ? context.getLocale() : null),
ArraysExt.resize(textGroup, n));
}
@@ -168,6 +165,8 @@ public final class PT_FreeText extends G
/**
* Returns the content of this {@code <gco:CharacterString>} as an {@code InternationalString}.
+ *
+ * @return The character sequence for this {@code <gco:CharacterString>}.
*/
@Override
public CharSequence toCharSequence() {
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -932,7 +932,7 @@ search: for (; fromIndex <= toIndex;
* the replacement of Greek letters is a more complex task than what this method can do,
* since it depends on the context. For example if the Greek letters are abbreviations
* for coordinate system axes like φ and λ, then the replacements depend on the enclosing
- * coordinate system. See {@link org.apache.sis.io.wkt.CharEncoding} for more information.</div>
+ * coordinate system. See {@link org.apache.sis.io.wkt.Transliterator} for more information.</div>
*
* @param text The text to scan for Unicode characters to replace by ASCII characters,
* or {@code null}.
@@ -940,7 +940,7 @@ search: for (; fromIndex <= toIndex;
* has been applied, or {@code null} if the given text was null.
*
* @see StringBuilders#toASCII(StringBuilder)
- * @see org.apache.sis.io.wkt.CharEncoding#filter(String)
+ * @see org.apache.sis.io.wkt.Transliterator#filter(String)
*/
public static CharSequence toASCII(final CharSequence text) {
return StringBuilders.toASCII(text, null);
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -286,7 +286,7 @@ public final class Characters extends St
*
* @see java.lang.Character.Subset
* @see Character#getType(int)
- * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#139">WKT 2 specification</a>
+ * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#139">WKT 2 specification §B.5</a>
*/
public static class Filter extends Character.Subset {
/*
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -323,11 +323,21 @@ public final class Errors extends Indexe
public static final short IllegalBitsPattern_1 = 33;
/**
+ * Coordinate reference system can not be of type ‘{0}’.
+ */
+ public static final short IllegalCRSType_1 = 194;
+
+ /**
* Class ‘{1}’ is illegal. It must be ‘{0}’ or a derived class.
*/
public static final short IllegalClass_2 = 34;
/**
+ * Coordinate system can not be “{0}”.
+ */
+ public static final short IllegalCoordinateSystem_1 = 193;
+
+ /**
* The “{1}” pattern can not be applied to formating of objects of type ‘{0}’.
*/
public static final short IllegalFormatPatternForClass_2 = 35;
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Fri Jun 26 18:03:38 2015
@@ -75,6 +75,8 @@ IllegalArgumentValue_2 = Argu
IllegalAxisDirection_2 = Coordinate system of class \u2018{0}\u2019 can not have axis in the {1} direction.
IllegalBitsPattern_1 = Illegal bits pattern: {0}.
IllegalClass_2 = Class \u2018{1}\u2019 is illegal. It must be \u2018{0}\u2019 or a derived class.
+IllegalCoordinateSystem_1 = Coordinate system can not be \u201c{0}\u201d.
+IllegalCRSType_1 = Coordinate reference system can not be of type \u2018{0}\u2019.
IllegalFormatPatternForClass_2 = The \u201c{1}\u201d pattern can not be applied to formating of objects of type \u2018{0}\u2019.
IllegalLanguageCode_1 = The \u201c{0}\u201d language is not recognized.
IllegalMemberType_2 = Member \u201c{0}\u201d can not be associated to type \u201c{1}\u201d.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Fri Jun 26 18:03:38 2015
@@ -72,6 +72,8 @@ IllegalArgumentValue_2 = L\u2
IllegalAxisDirection_2 = Les syst\u00e8mes de coordonn\u00e9es de classe \u2018{0}\u2019 ne peuvent pas avoir d\u2019axe dans la direction \u00ab\u202f{1}\u202f\u00bb.
IllegalBitsPattern_1 = Pattern de bits invalide: {0}.
IllegalClass_2 = La classe \u2018{1}\u2019 est ill\u00e9gale. Il doit s\u2019agir d\u2019une classe \u2018{0}\u2019 ou d\u00e9riv\u00e9e.
+IllegalCoordinateSystem_1 = Le syst\u00e8me de coordonn\u00e9es ne peut pas \u00eatre \u00ab\u202f{0}\u202f\u00bb.
+IllegalCRSType_1 = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es ne peut pas \u00eatre de type \u2018{0}\u2019.
IllegalFormatPatternForClass_2 = Le mod\u00e8le \u00ab\u202f{1}\u202f\u00bb ne peut pas \u00eatre appliqu\u00e9 au formatage d\u2019objets de type \u2018{0}\u2019.
IllegalLanguageCode_1 = Le code de langue \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnu.
IllegalMemberType_2 = Le membre \u00ab\u202f{0}\u202f\u00bb ne peut pas \u00eatre associ\u00e9 au type \u00ab\u202f{1}\u202f\u00bb.
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -197,8 +197,7 @@ public final strictfp class TestUtilitie
}
/**
- * Parses the date for the given string using the {@code "yyyy-MM-dd HH:mm:ss"} pattern
- * in UTC timezone.
+ * Parses the date for the given string using the {@code "yyyy-MM-dd HH:mm:ss"} pattern in UTC timezone.
*
* @param date The date as a {@link String}.
* @return The date as a {@link Date}.
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -117,6 +117,7 @@ import org.junit.BeforeClass;
org.apache.sis.io.TableAppenderTest.class,
org.apache.sis.util.collection.TreeTableFormatTest.class,
org.apache.sis.util.collection.RangeSetTest.class,
+ org.apache.sis.internal.util.StandardDateFormatTest.class,
// Converters.
org.apache.sis.internal.converter.AngleConverterTest.class,
Modified: sis/trunk/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.properties?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Jun 26 18:03:38 2015
@@ -178,7 +178,7 @@ build.generated.dir
build.generated.sources.dir = ${build.dir}/generated-sources
build.test.classes.dir = ${build.dir}/test/classes
build.test.results.dir = ${build.dir}/test/results
-build.classes.excludes = **/*.java,**/*.form,**/*.bak,**/resources/*.properties,com/sun/xml/**
+build.classes.excludes = **/*.java,**/*.form,**/*.html,**/*.txt,**/*.png,**/*.bak,**/resources/*.properties
build.sysclasspath = ignore
dist.dir = dist
dist.jar = ${dist.dir}/SIS.jar