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/01/14 10:53:55 UTC
svn commit: r1651610 [4/6] - in /sis/branches/JDK6: ./
application/sis-webapp/src/main/java/org/apache/sis/index/tree/
core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/
core/sis-build-helper/src/main/java/org/apache/sis/util/resources...
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -33,7 +33,7 @@ import static org.apache.sis.referencing
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.5
* @module
*/
public final strictfp class HardCodedCRS {
@@ -73,6 +73,22 @@ public final strictfp class HardCodedCRS
properties("WGS 84 (3D)"), HardCodedDatum.WGS84, HardCodedCS.GEODETIC_3D);
/**
+ * A two-dimensional geographic coordinate reference system using the Paris prime meridian.
+ * This CRS uses (<var>longitude</var>, <var>latitude</var>) ordinates with longitude values
+ * increasing towards the East and latitude values increasing towards the North.
+ * The angular units are decimal degrees except for the prime meridian (Paris),
+ * which is measured in grades.
+ *
+ * <p>This CRS is equivalent to {@code EPSG:4807} except for axis order and units of measurement,
+ * since EPSG defines (<var>latitude</var>, <var>longitude</var>) in grades. The main purpose of
+ * this CRS is to test operations between CRS having different prime meridian.</p>
+ *
+ * @since 0.5
+ */
+ public static final DefaultGeographicCRS NTF = new DefaultGeographicCRS(
+ properties("NTF (Paris)"), HardCodedDatum.NTF, HardCodedCS.GEODETIC_2D);
+
+ /**
* A two-dimensional geographic coordinate reference system using a spherical datum.
* This CRS uses (<var>longitude</var>, <var>latitude</var>) ordinates with longitude values
* increasing towards the East and latitude values increasing towards the North.
@@ -143,7 +159,14 @@ public final strictfp class HardCodedCRS
getProperties(HardCodedCS.DAYS), HardCodedDatum.MODIFIED_JULIAN, HardCodedCS.DAYS);
/**
- * A (λ,φ,h,t) CRS where <var>h</var> is the {@link #GRAVITY_RELATED_HEIGHT}.
+ * A (λ,φ,H) CRS where <var>H</var> is the {@link #GRAVITY_RELATED_HEIGHT}.
+ * This constant uses the "geoid" term as an approximation for the gravity related height.
+ */
+ public static final DefaultCompoundCRS GEOID_3D = new DefaultCompoundCRS(
+ properties("WGS 84 + height"), WGS84, GRAVITY_RELATED_HEIGHT);
+
+ /**
+ * A (λ,φ,H,t) CRS where <var>H</var> is the {@link #GRAVITY_RELATED_HEIGHT} and <var>t</var> is {@link #TIME}.
* This constant uses the "geoid" term as an approximation for the gravity related height.
*/
public static final DefaultCompoundCRS GEOID_4D = new DefaultCompoundCRS(
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -36,7 +36,7 @@ import static org.apache.sis.test.Assert
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.5
* @module
*/
@DependsOn({
@@ -72,10 +72,19 @@ public final strictfp class AbstractCSTe
@Test
public void testForRightHandedConvention() {
final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"),
- HardCodedAxes.GEODETIC_LATITUDE, HardCodedAxes.TIME, HardCodedAxes.ALTITUDE, HardCodedAxes.GEODETIC_LONGITUDE);
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.TIME,
+ HardCodedAxes.ALTITUDE,
+ HardCodedAxes.GEODETIC_LONGITUDE);
verifyAxesConvention(AxesConvention.RIGHT_HANDED, cs,
- HardCodedAxes.GEODETIC_LONGITUDE, HardCodedAxes.GEODETIC_LATITUDE, HardCodedAxes.ALTITUDE, HardCodedAxes.TIME);
- assertSame("Right-handed CS shall be same as normalized.",
+ HardCodedAxes.GEODETIC_LONGITUDE,
+ HardCodedAxes.GEODETIC_LATITUDE,
+ HardCodedAxes.ALTITUDE,
+ HardCodedAxes.TIME);
+ assertSame("Right-handed CS shall be same as conventionally oriented for this test.",
+ cs.forConvention(AxesConvention.RIGHT_HANDED),
+ cs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED));
+ assertSame("Right-handed CS shall be same as normalized for this test.",
cs.forConvention(AxesConvention.RIGHT_HANDED),
cs.forConvention(AxesConvention.NORMALIZED));
}
@@ -89,14 +98,13 @@ public final strictfp class AbstractCSTe
public void testForNormalizedConvention() {
/*
* Some expected axes, identical to the ones in HardCodedAxes except for name or units.
+ * We verify the properties inferred by the constructor as a matter of principle, even
+ * if it is not really the purpose of this test.
*/
final DefaultCoordinateSystemAxis EASTING = new DefaultCoordinateSystemAxis(
singletonMap(NAME_KEY, Vocabulary.format(Vocabulary.Keys.Unnamed)), "E", AxisDirection.EAST, SI.METRE);
final DefaultCoordinateSystemAxis HEIGHT = new DefaultCoordinateSystemAxis(
singletonMap(NAME_KEY, "Height"), "h", AxisDirection.UP, SI.METRE);
- /*
- * Verifies the properties inferred by the constructor.
- */
assertEquals("minimumValue", Double.NEGATIVE_INFINITY, EASTING.getMinimumValue(), STRICT);
assertEquals("maximumValue", Double.POSITIVE_INFINITY, EASTING.getMaximumValue(), STRICT);
assertNull ("rangeMeaning", EASTING.getRangeMeaning());
@@ -104,14 +112,29 @@ public final strictfp class AbstractCSTe
assertEquals("maximumValue", Double.POSITIVE_INFINITY, HEIGHT.getMaximumValue(), STRICT);
assertNull ("rangeMeaning", HEIGHT.getRangeMeaning());
/*
- * Test RIGHT_HANDED as a matter of principle before to test NORMALIZED.
+ * Now the actual test. First we opportunistically test RIGHT_HANDED and CONVENTIONALLY_ORIENTED
+ * before to test NORMALIZED, in order to test in increasing complexity.
*/
final AbstractCS cs = new AbstractCS(singletonMap(NAME_KEY, "Test"),
- HardCodedAxes.TIME, HardCodedAxes.NORTHING, HardCodedAxes.WESTING, HardCodedAxes.HEIGHT_cm);
+ HardCodedAxes.TIME,
+ HardCodedAxes.NORTHING,
+ HardCodedAxes.WESTING,
+ HardCodedAxes.HEIGHT_cm);
verifyAxesConvention(AxesConvention.RIGHT_HANDED, cs,
- HardCodedAxes.NORTHING, HardCodedAxes.WESTING, HardCodedAxes.HEIGHT_cm, HardCodedAxes.TIME);
+ HardCodedAxes.NORTHING,
+ HardCodedAxes.WESTING,
+ HardCodedAxes.HEIGHT_cm,
+ HardCodedAxes.TIME);
+ verifyAxesConvention(AxesConvention.CONVENTIONALLY_ORIENTED, cs,
+ EASTING,
+ HardCodedAxes.NORTHING,
+ HardCodedAxes.HEIGHT_cm,
+ HardCodedAxes.TIME);
verifyAxesConvention(AxesConvention.NORMALIZED, cs,
- EASTING, HardCodedAxes.NORTHING, HEIGHT, HardCodedAxes.TIME);
+ EASTING,
+ HardCodedAxes.NORTHING,
+ HEIGHT,
+ HardCodedAxes.TIME);
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -39,7 +39,7 @@ import static org.apache.sis.test.TestUt
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.2)
- * @version 0.4
+ * @version 0.5
* @module
*/
@DependsOn({
@@ -148,52 +148,53 @@ public final strictfp class DefaultCarte
}
/**
- * Creates a Cartesian CS using the provided test axis, invoke {@link AbstractCS#standard}
- * with it and compare with the expected axis.
+ * Creates a Cartesian CS using the provided test axis, invokes {@link AbstractCS#forConvention(AxesConvention)}
+ * on it and compares with the expected axes.
*
* @param expectedX The name of the expected {@link AxisDirection} of x axis after normalization.
* @param expectedY The name of the expected {@link AxisDirection} of y axis after normalization.
* @param toTestX The name of the {@link AxisDirection} value for the x axis of the CS to normalize.
* @param toTestY The name of the {@link AxisDirection} value for the y axis of the CS to normalize.
*/
- private static void assertNormalizationEquals(
+ private static void assertConventionallyOrientedEquals(
final String expectedX, final String expectedY,
final String toTestX, final String toTestY)
{
DefaultCartesianCS cs = createCS(toTestX, toTestY);
- cs = cs.forConvention(AxesConvention.NORMALIZED);
+ cs = cs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
assertEqualsIgnoreMetadata(createCS(expectedX, expectedY), cs);
}
/**
- * Asserts that the coordinate system made of the given axes is normalized.
- * This method also ensures that swapping the axes and normalizing give back the original CS.
+ * Asserts that the coordinate system made of the given axes has conventional orientation.
+ * Then ensures that swapping the axes and applying conventional orientation gives back the original CS.
*/
- private static void assertNormalized(final String x, final String y) {
- assertNormalizationEquals(x, y, x, y); // Expect no-op.
- assertNormalizationEquals(x, y, y, x); // Expect normalization.
+ private static void testConventionalOrientation(final String x, final String y) {
+ assertConventionallyOrientedEquals(x, y, x, y); // Expect no-op.
+ assertConventionallyOrientedEquals(x, y, y, x); // Expect normalization.
}
/**
- * Tests {@link DefaultCartesianCS#forConvention(AxesConvention)} with {@link AxesConvention#NORMALIZED}.
+ * Tests {@link DefaultCartesianCS#forConvention(AxesConvention)} with
+ * {@link AxesConvention#CONVENTIONALLY_ORIENTED}.
*/
@Test
@DependsOnMethod("testConstructor")
- public void testNormalization() {
- // ----------- Axis to test ------ Expected axis --
- assertNormalizationEquals("East", "North", "East", "North");
- assertNormalizationEquals("East", "North", "North", "East");
- assertNormalizationEquals("East", "North", "South", "East");
- assertNormalizationEquals("East", "North", "South", "West");
-
- assertNormalized("East", "North");
- assertNormalized("South-East", "North-East");
- assertNormalized("North along 90 deg East", "North along 0 deg");
- assertNormalized("North along 90 deg East", "North along 0 deg");
- assertNormalized("North along 75 deg West", "North along 165 deg West");
- assertNormalized("South along 90 deg West", "South along 0 deg");
- assertNormalized("South along 180 deg", "South along 90 deg West");
- assertNormalized("North along 130 deg West", "North along 140 deg East");
+ public void testConventionalOrientation() {
+ // -------------------------------- Axes to test ------ Expected axes --
+ assertConventionallyOrientedEquals("East", "North", "East", "North");
+ assertConventionallyOrientedEquals("East", "North", "North", "East");
+ assertConventionallyOrientedEquals("East", "North", "South", "East");
+ assertConventionallyOrientedEquals("East", "North", "South", "West");
+
+ testConventionalOrientation("East", "North");
+ testConventionalOrientation("South-East", "North-East");
+ testConventionalOrientation("North along 90 deg East", "North along 0 deg");
+ testConventionalOrientation("North along 90 deg East", "North along 0 deg");
+ testConventionalOrientation("North along 75 deg West", "North along 165 deg West");
+ testConventionalOrientation("South along 90 deg West", "South along 0 deg");
+ testConventionalOrientation("South along 180 deg", "South along 90 deg West");
+ testConventionalOrientation("North along 130 deg West", "North along 140 deg East");
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -30,17 +30,17 @@ import static org.apache.sis.referencing
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.5
* @module
*/
@DependsOn(AbstractCSTest.class)
public final strictfp class DefaultSphericalCSTest extends TestCase {
/**
- * Tests the normalization of a coordinate system.
+ * Tests the conventional orientation of a coordinate system.
*/
@Test
- public void testNormalize() {
- final AbstractCS normalized = SPHERICAL.forConvention(AxesConvention.NORMALIZED);
+ public void testConventionalOrientation() {
+ final AbstractCS normalized = SPHERICAL.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
assertNotSame(SPHERICAL, normalized);
assertEquals(new DefaultSphericalCS(
Collections.singletonMap(AbstractCS.NAME_KEY, "Spherical CS: East (deg), North (deg), Up (m)."),
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/NormalizerTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -36,7 +36,7 @@ import static org.apache.sis.test.Refere
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4 (derived from geotk-2.4)
- * @version 0.4
+ * @version 0.5
* @module
*/
@DependsOn({
@@ -166,23 +166,27 @@ public final strictfp class NormalizerTe
*/
@Test
public void testNormalizeAxis() {
- assertSame(HardCodedAxes.GEODETIC_LATITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LATITUDE));
- assertSame(HardCodedAxes.GEODETIC_LONGITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LONGITUDE));
- assertSame(HardCodedAxes.EASTING, Normalizer.normalize(HardCodedAxes.EASTING));
- assertSame(HardCodedAxes.NORTHING, Normalizer.normalize(HardCodedAxes.NORTHING));
- assertSame(HardCodedAxes.ALTITUDE, Normalizer.normalize(HardCodedAxes.ALTITUDE));
- assertSame(HardCodedAxes.TIME, Normalizer.normalize(HardCodedAxes.TIME));
+ boolean normalizeUnits = false;
+ do { // Executed twice, first without units normalization, then with units normalization.
+ assertSame(HardCodedAxes.GEODETIC_LATITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LATITUDE, normalizeUnits));
+ assertSame(HardCodedAxes.GEODETIC_LONGITUDE, Normalizer.normalize(HardCodedAxes.GEODETIC_LONGITUDE, normalizeUnits));
+ assertSame(HardCodedAxes.EASTING, Normalizer.normalize(HardCodedAxes.EASTING, normalizeUnits));
+ assertSame(HardCodedAxes.NORTHING, Normalizer.normalize(HardCodedAxes.NORTHING, normalizeUnits));
+ assertSame(HardCodedAxes.ALTITUDE, Normalizer.normalize(HardCodedAxes.ALTITUDE, normalizeUnits));
+ assertSame(HardCodedAxes.TIME, Normalizer.normalize(HardCodedAxes.TIME, normalizeUnits));
+ } while ((normalizeUnits = !normalizeUnits) == true);
/*
* Test a change of unit from centimetre to metre.
*/
+ assertSame(HardCodedAxes.HEIGHT_cm, Normalizer.normalize(HardCodedAxes.HEIGHT_cm, false));
assertAxisEquals("Height", "h", AxisDirection.UP,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, null,
- Normalizer.normalize(HardCodedAxes.HEIGHT_cm));
+ Normalizer.normalize(HardCodedAxes.HEIGHT_cm, true));
/*
* Test a change of direction from West to East.
*/
assertAxisEquals(Vocabulary.format(Vocabulary.Keys.Unnamed), "E",
AxisDirection.EAST, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, SI.METRE, null,
- Normalizer.normalize(HardCodedAxes.WESTING));
+ Normalizer.normalize(HardCodedAxes.WESTING, true));
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -35,7 +35,7 @@ import static org.opengis.referencing.Id
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.5
* @module
*/
public final strictfp class HardCodedDatum {
@@ -43,7 +43,27 @@ public final strictfp class HardCodedDat
* Greenwich meridian (EPSG:8901), with angular measurements in decimal degrees.
*/
public static final DefaultPrimeMeridian GREENWICH = new DefaultPrimeMeridian(
- properties("Greenwich", "8901"), 0, NonSI.DEGREE_ANGLE);;
+ properties("Greenwich", "8901"), 0, NonSI.DEGREE_ANGLE);
+
+ /**
+ * Paris meridian (EPSG:8903), with angular measurements in grad.
+ *
+ * @since 0.5
+ */
+ public static final DefaultPrimeMeridian PARIS = new DefaultPrimeMeridian(
+ properties("Paris", "8903"), 2.5969213, NonSI.GRADE);
+
+ /**
+ * Old Paris meridian (EPSG:8914) defined as 2°20'13.95"E.
+ * Equivalent to 2.596898 grad (value given by EPSG).
+ *
+ * <p>When used together with {@link #PARIS}, this prime meridian is useful for testing
+ * two real-world prime meridians that are very close together but still different.</p>
+ *
+ * @since 0.5
+ */
+ public static final DefaultPrimeMeridian PARIS_RGS = new DefaultPrimeMeridian(
+ properties("Paris RGS", "8914"), 2 + (20 + 13.95/60)/60, NonSI.DEGREE_ANGLE);
/**
* WGS 1984 datum (EPSG:6326). Prime meridian is Greenwich.
@@ -64,6 +84,15 @@ public final strictfp class HardCodedDat
new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
/**
+ * Nouvelle Triangulation Française datum (EPSG:6807). Prime meridian is Paris.
+ *
+ * @since 0.5
+ */
+ public static final DefaultGeodeticDatum NTF = new DefaultGeodeticDatum(
+ properties("Nouvelle Triangulation Française", "6807"),
+ new DefaultEllipsoid(GeodeticDatumMock.NTF.getEllipsoid()), PARIS);
+
+ /**
* Spherical datum based on GRS 1980 Authalic Sphere (EPSG:6047). Prime meridian is Greenwich.
*/
public static final DefaultGeodeticDatum SPHERE = new DefaultGeodeticDatum(
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ExponentialTransform1DTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -34,9 +34,8 @@ import org.opengis.test.ToleranceModifie
/**
- * Tests the {@link ExponentialTransform1D} class. This test case will also tests
- * indirectly the {@link LogarithmicTransform1D} class since it is the inverse of
- * the exponential transform.
+ * Tests the {@link ExponentialTransform1D} class. Note that this is closely related to
+ * {@link LogarithmicTransform1DTest}, since one transform is the inverse of the other.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5 (derived from geotk-3.17)
@@ -49,9 +48,9 @@ import org.opengis.test.ToleranceModifie
})
public final strictfp class ExponentialTransform1DTest extends MathTransformTestCase {
/**
- * Arbitrary parameters of the exponential transform to be tested.
+ * Arbitrary parameter of the exponential transform to be tested.
*/
- private static final double BASE = 10, SCALE = 2;
+ static final double SCALE = 2;
/**
* Arbitrary coefficients of a linear transform to be concatenated to the exponential transform.
@@ -59,79 +58,156 @@ public final strictfp class ExponentialT
private static final double C0 = -3, C1 = 0.25;
/**
- * The random values to use as input, and the expected transformed values.
+ * Tolerance factor for comparison of coefficients (not coordinates).
*/
- private double[] values, expected;
+ private static final double EPS = 1E-12;
/**
- * Generates random values for input coordinates, and allocates (but do not compute values)
- * array for the expected transformed coordinates.
- *
- * @param mt The math transform which will be tested.
+ * Creates a new test case.
*/
- private void initialize(final MathTransform1D mt) {
- transform = mt; // Must be set before generateRandomCoordinates(…).
+ public ExponentialTransform1DTest() {
tolerance = 1E-14;
toleranceModifier = ToleranceModifier.RELATIVE;
derivativeDeltas = new double[] {0.001};
- values = generateRandomCoordinates(CoordinateDomain.RANGE_10, 0);
- expected = new double[values.length];
}
/**
- * Tests the current transform using the {@link #values} as input points, and comparing with
- * the {@link #expected} values.
- */
- private void run(final Class<? extends MathTransform1D> expectedType) throws TransformException {
+ * Tests the current transform using random values as input points, and
+ * comparing with the expected values computed using the given coefficients.
+ *
+ * The {@link #transform} field must be set before to invoke this method.
+ *
+ * @param expectedType The expected base type of the math transform.
+ * @param base The exponent base given to the {@link ExponentialTransform1D} constructor.
+ * @param scale The scale factor given to the {@link ExponentialTransform1D} constructor.
+ * @param preAffine {@code true} for applying an additional affine transform before the transform.
+ * @param postAffine {@code true} for applying an additional affine transform after the transform.
+ */
+ private void run(final Class<? extends MathTransform1D> expectedType, final double base, final double scale,
+ final boolean preAffine, final boolean postAffine) throws TransformException
+ {
assertInstanceOf("Expected the use of mathematical identities.", expectedType, transform);
assertFalse(transform.isIdentity());
validate();
+
+ final double[] values = generateRandomCoordinates(CoordinateDomain.RANGE_10, 0);
+ final double[] expected = new double[values.length];
+ for (int i=0; i<values.length; i++) {
+ double value = values[i];
+ if (preAffine) {
+ value = C0 + C1*value;
+ }
+ value = scale * pow(base, value);
+ if (postAffine) {
+ value = C0 + C1*value;
+ }
+ expected[i] = value;
+ }
verifyTransform(values, expected);
verifyDerivative(2.5); // Test at a hard-coded point.
}
/**
- * A single (non-concatenated) test case.
+ * Implementation of {@link #testSingle()} and {@link #testSingleWithScale()} for the given base.
+ */
+ private void testSingle(final double base, final double scale) throws TransformException {
+ transform = ExponentialTransform1D.create(base, scale);
+ run(ExponentialTransform1D.class, base, scale, false, false);
+ }
+
+ /**
+ * Implementation of {@link #testAffinePreConcatenation()} for the given base.
+ */
+ private void testAffinePreConcatenation(final double base) throws TransformException {
+ transform = MathTransforms.concatenate(LinearTransform1D.create(C1, C0),
+ ExponentialTransform1D.create(base, SCALE));
+ run(ExponentialTransform1D.class, base, SCALE, true, false);
+ /*
+ * Find back the original linear coefficients as documented in the ExponentialTransform1D class javadoc.
+ */
+ final double offset = -log(SCALE) / log(base);
+ final MathTransform1D log = LogarithmicTransform1D.create(base, offset);
+ transform = (LinearTransform1D) MathTransforms.concatenate(transform, log);
+ assertEquals("C1", C1, ((LinearTransform1D) transform).scale, EPS);
+ assertEquals("C0", C0, ((LinearTransform1D) transform).offset, EPS);
+ }
+
+ /**
+ * Implementation of {@link #testAffinePostConcatenation()} for the given base.
+ */
+ private void testAffinePostConcatenation(final double base) throws TransformException {
+ transform = MathTransforms.concatenate(ExponentialTransform1D.create(base, SCALE),
+ LinearTransform1D.create(C1, C0));
+ /*
+ * The inverse transforms in this test case have high rounding errors.
+ * Those errors are low for values close to zero, and increase fast for higher values.
+ * We scale the default tolerance (1E-14) by 1E+8, which give us a tolerance of 1E-6.
+ */
+ toleranceModifier = ToleranceModifiers.concatenate(toleranceModifier,
+ ToleranceModifiers.scale(EnumSet.of(CalculationType.INVERSE_TRANSFORM), 1E+8));
+ run(ConcatenatedTransformDirect1D.class, base, SCALE, false, true);
+ }
+
+ /**
+ * Implementation of {@link #testAffineConcatenations()} for the given base.
+ */
+ private void testAffineConcatenations(final double base) throws TransformException {
+ final LinearTransform1D linear = LinearTransform1D.create(C1, C0);
+ transform = MathTransforms.concatenate(linear, ExponentialTransform1D.create(base, SCALE), linear);
+
+ // See testAffinePostConcatenation for an explanation about why we relax tolerance.
+ toleranceModifier = ToleranceModifiers.concatenate(toleranceModifier,
+ ToleranceModifiers.scale(EnumSet.of(CalculationType.INVERSE_TRANSFORM), 1E+8));
+ run(ConcatenatedTransformDirect1D.class, base, SCALE, true, true);
+ }
+
+ /**
+ * A single (non-concatenated) test case without scale.
*
* @throws TransformException should never happen.
*/
@Test
public void testSingle() throws TransformException {
- initialize(ExponentialTransform1D.create(BASE, SCALE));
- for (int i=0; i<values.length; i++) {
- expected[i] = SCALE * pow(BASE, values[i]);
- }
- run(ExponentialTransform1D.class);
+ messageOnFailure = "Exponential transform in base 10";
+ testSingle(10, 1);
+ messageOnFailure = "Exponential transform in base E";
+ testSingle(E, 1);
+ messageOnFailure = "Exponential transform in base 8.4"; // Arbitrary base.
+ testSingle(8.4, 1);
}
/**
- * Tests the concatenation of a linear operation before the exponential one.
+ * A single (non-concatenated) test case with a scale.
*
* @throws TransformException should never happen.
*/
@Test
@DependsOnMethod("testSingle")
+ public void testSingleWithScale() throws TransformException {
+ messageOnFailure = "Exponential transform in base 10";
+ testSingle(10, SCALE);
+ messageOnFailure = "Exponential transform in base E";
+ testSingle(E, SCALE);
+ messageOnFailure = "Exponential transform in base 8.4"; // Arbitrary base.
+ testSingle(8.4, SCALE);
+ }
+
+ /**
+ * Tests the concatenation of a linear operation before the exponential one. This test also
+ * opportunistically verifies that the technic documented in {@link ExponentialTransform1D}
+ * javadoc for finding back the original coefficients works.
+ *
+ * @throws TransformException should never happen.
+ */
+ @Test
+ @DependsOnMethod("testSingleWithScale")
public void testAffinePreConcatenation() throws TransformException {
- initialize(MathTransforms.concatenate(
- LinearTransform1D.create(C1, C0),
- ExponentialTransform1D.create(BASE, SCALE)));
- for (int i=0; i<values.length; i++) {
- expected[i] = SCALE * pow(BASE, C0 + C1 * values[i]);
- }
- run(ExponentialTransform1D.class);
- /*
- * Find back the original linear coefficients as documented in the ExponentialTransform1D class javadoc.
- */
- final double lnBase = log(BASE);
- final double offset = -log(SCALE) / lnBase;
- final MathTransform1D log = LogarithmicTransform1D.create(BASE, offset);
- for (int i=0; i<values.length; i++) {
- expected[i] = log(expected[i]) / lnBase + offset;
- }
- transform = (LinearTransform1D) MathTransforms.concatenate(transform, log);
- run(LinearTransform1D.class);
- assertEquals(C1, ((LinearTransform1D) transform).scale, 1E-12);
- assertEquals(C0, ((LinearTransform1D) transform).offset, 1E-12);
+ messageOnFailure = "Affine + exponential transform in base 10";
+ testAffinePreConcatenation(10);
+ messageOnFailure = "Affine + exponential transform in base E";
+ testAffinePreConcatenation(E);
+ messageOnFailure = "Affine + exponential transform in base 8.4"; // Arbitrary base.
+ testAffinePreConcatenation(8.4);
}
/**
@@ -140,41 +216,32 @@ public final strictfp class ExponentialT
* @throws TransformException should never happen.
*/
@Test
- @DependsOnMethod("testSingle")
+ @DependsOnMethod("testSingleWithScale")
public void testAffinePostConcatenation() throws TransformException {
- initialize(MathTransforms.concatenate(
- ExponentialTransform1D.create(BASE, SCALE),
- LinearTransform1D.create(C1, C0)));
- for (int i=0; i<values.length; i++) {
- expected[i] = C0 + C1 * (SCALE * pow(BASE, values[i]));
- }
- /*
- * The inverse transforms in this test case have high rounding errors.
- * Those errors are low for values close to zero, and increase fast for higher values.
- * We scale the default tolerance (1E-14) by 1E+8, which give us a tolerance of 1E-6.
- */
- toleranceModifier = ToleranceModifiers.concatenate(toleranceModifier,
- ToleranceModifiers.scale(EnumSet.of(CalculationType.INVERSE_TRANSFORM), 1E+8));
- run(ConcatenatedTransformDirect1D.class);
+ messageOnFailure = "Exponential transform in base 10 + affine";
+ testAffinePostConcatenation(10);
+ messageOnFailure = "Exponential transform in base E + affine";
+ testAffinePostConcatenation(E);
+ messageOnFailure = "Exponential transform in base 8.4 + affine"; // Arbitrary base.
+ testAffinePostConcatenation(8.4);
}
/**
- * Tests the concatenation of a logarithmic operation with the exponential one.
+ * Tests the concatenation of a linear operation before and after the exponential one.
*
* @throws TransformException should never happen.
*/
@Test
- @DependsOnMethod("testSingle")
- public void testLogarithmicConcatenation() throws TransformException {
- final double base = 8; // Must be different than BASE.
- final double lnBase = log(base);
- initialize(MathTransforms.concatenate(
- LogarithmicTransform1D.create(base, C0),
- ExponentialTransform1D.create(BASE, SCALE)));
- for (int i=0; i<values.length; i++) {
- values[i] = abs(values[i]) + 0.001;
- expected[i] = SCALE * pow(BASE, log(values[i]) / lnBase + C0);
- }
- run(ConcatenatedTransformDirect1D.class);
+ @DependsOnMethod({
+ "testAffinePreConcatenation",
+ "testAffinePostConcatenation"
+ })
+ public void testAffineConcatenations() throws TransformException {
+ messageOnFailure = "Affine + exponential transform in base 10 + affine";
+ testAffineConcatenations(10);
+ messageOnFailure = "Affine + exponential transform in base E + affine";
+ testAffineConcatenations(E);
+ messageOnFailure = "Affine + exponential transform in base 8.4 + affine"; // Arbitrary base.
+ testAffineConcatenations(8.4);
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -108,7 +108,7 @@ public strictfp class DefaultMetadataTes
metadata.setLanguages(singleton(Locale.ENGLISH));
metadata.setCharacterSets(singleton(StandardCharsets.UTF_8));
metadata.setMetadataScopes(singleton(new DefaultMetadataScope(ScopeCode.DATASET, "Common Data Index record")));
- metadata.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2009-01-01 04:00:00"), DateType.CREATION)));
+ metadata.setDateInfo(singleton(new DefaultCitationDate(TestUtilities.date("2009-01-01 04:00:00"), DateType.CREATION)));
/*
* Contact information for the author. The same party will be used for custodian and distributor,
* with only the role changed. Note that we need to create an instance of the deprecated class,
@@ -220,7 +220,7 @@ public strictfp class DefaultMetadataTes
name.setDates(singleton(new DefaultCitationDate(TestUtilities.date("1990-06-04 22:00:00"), DateType.REVISION)));
aggregateInfo.setName(name);
aggregateInfo.setInitiativeType(InitiativeType.CAMPAIGN);
- aggregateInfo.setAssociationType(AssociationType.LARGER_WORD_CITATION);
+ aggregateInfo.setAssociationType(AssociationType.LARGER_WORK_CITATION);
identification.setAssociatedResources(singleton(aggregateInfo));
}
/*
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -82,7 +82,7 @@ public final strictfp class ReferencingI
assertEquals("fileIdentifier", "20090901", metadata.getMetadataIdentifier().getCode());
assertEquals("language", Locale.ENGLISH, getSingleton(metadata.getLanguages()));
assertEquals("characterSet", StandardCharsets.UTF_8, getSingleton(metadata.getCharacterSets()));
- assertEquals("dateStamp", xmlDate("2014-01-04 00:00:00"), getSingleton(metadata.getDates()).getDate());
+ assertEquals("dateStamp", xmlDate("2014-01-04 00:00:00"), getSingleton(metadata.getDateInfo()).getDate());
/*
* <gmd:contact>
* <gmd:CI_ResponsibleParty>
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/GeodeticDatumMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/GeodeticDatumMock.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/GeodeticDatumMock.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/GeodeticDatumMock.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -32,7 +32,7 @@ import org.opengis.referencing.datum.Pri
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.4
+ * @version 0.5
* @module
*/
@SuppressWarnings("serial")
@@ -58,6 +58,15 @@ public final strictfp class GeodeticDatu
public static final GeodeticDatum NAD27 = new GeodeticDatumMock("NAD27", 6378206.4, 6356583.8, 294.97869821390583, false);
/**
+ * The "Nouvelle Triangulation Française" (EPSG:6807) datum with "Clarke 1880 (IGN)" ellipsoid.
+ * This is the same datum than "Nouvelle Triangulation Française (Paris)" (EPSG:6275) except
+ * for the prime meridian, which is Greenwich instead of Paris.
+ *
+ * @since 0.5
+ */
+ public static final GeodeticDatum NTF = new GeodeticDatumMock("NTF", 6378249.2, 6356515, 293.4660212936269, false);
+
+ /**
* The sphere based on the GRS 1980 Authalic sphere.
*/
public static final GeodeticDatum SPHERE = new GeodeticDatumMock("SPHERE", 6371007, 6371007, Double.POSITIVE_INFINITY, false);
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/PrimeMeridianMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/PrimeMeridianMock.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/PrimeMeridianMock.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/mock/PrimeMeridianMock.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -19,7 +19,6 @@ package org.apache.sis.test.mock;
import javax.measure.unit.Unit;
import javax.measure.unit.NonSI;
import javax.measure.quantity.Angle;
-import org.apache.sis.test.mock.IdentifiedObjectMock;
import org.opengis.referencing.datum.PrimeMeridian;
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -30,7 +30,10 @@ import org.junit.BeforeClass;
* @module
*/
@Suite.SuiteClasses({
- // Test matrix first because they may be used in about every SIS corners.
+ org.apache.sis.internal.referencing.FormulasTest.class,
+ org.apache.sis.internal.referencing.j2d.ShapeUtilitiesTest.class,
+
+ // Test matrix early because they may be used in about every SIS corners.
org.apache.sis.referencing.operation.matrix.GeneralMatrixTest.class,
org.apache.sis.referencing.operation.matrix.SolverTest.class,
org.apache.sis.referencing.operation.matrix.Matrix1Test.class,
@@ -46,15 +49,16 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.transform.ProjectiveTransformTest.class,
org.apache.sis.referencing.operation.transform.LinearTransformTest.class,
org.apache.sis.referencing.operation.transform.ExponentialTransform1DTest.class,
+ org.apache.sis.referencing.operation.transform.LogarithmicTransform1DTest.class,
org.apache.sis.referencing.operation.transform.CopyTransformTest.class,
org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
org.apache.sis.referencing.operation.transform.ConcatenatedTransformTest.class,
org.apache.sis.referencing.operation.transform.TransferFunctionTest.class,
- org.apache.sis.internal.referencing.FormulasTest.class,
org.apache.sis.internal.referencing.VerticalDatumTypesTest.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,
org.apache.sis.internal.jaxb.referencing.SecondDefiningParameterTest.class,
org.apache.sis.referencing.IdentifiedObjectsTest.class,
@@ -111,10 +115,12 @@ import org.junit.BeforeClass;
org.apache.sis.geometry.SubEnvelopeTest.class,
org.apache.sis.geometry.ImmutableEnvelopeTest.class,
org.apache.sis.geometry.Envelope2DTest.class,
+ org.apache.sis.geometry.CurveExtremumTest.class,
org.apache.sis.geometry.EnvelopesTest.class,
org.apache.sis.distance.LatLonPointRadiusTest.class, // Pending refactoring in a geometry package.
+ org.apache.sis.internal.referencing.ServicesForMetadataTest.class,
org.apache.sis.test.integration.ReferencingInMetadataTest.class,
org.apache.sis.test.integration.DefaultMetadataTest.class
})
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -544,9 +544,9 @@ public class IdentifierMapAdapter extend
@Debug
@Override
public String toString() {
- final StringBuilder buffer = new StringBuilder(50).append('{');
- for (final Entry<Citation,String> entry : entrySet()) {
- if (buffer.length() != 1) {
+ final StringBuilder buffer = new StringBuilder(50).append('{');
+ for (final Entry<Citation,String> entry : entrySet()) {
+ if (buffer.length() != 1) {
buffer.append(", ");
}
SpecializedIdentifier.format(buffer, entry.getKey(), entry.getValue());
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -49,7 +49,9 @@ import static org.apache.sis.internal.ut
* <li>an arbitrary amount of {@linkplain #parameters}</li>
* </ul>
*
- * The <cite>object type</cite> can be:
+ * The <cite>object type</cite> can be one of the following name.
+ * Mapping between those names and GeoAPI interfaces is provided by the
+ * {@link org.apache.sis.internal.metadata.NameMeaning} class.
* <table class="sis">
* <caption>Recognized object types in URN</caption>
* <tr><th>Object type</th> <th>Meaning</th></tr>
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -55,7 +55,7 @@ public final class Units extends Static
* Suffix at even index are for axes having the standard geometric direction,
* while suffix at odd index are for axes having the reverse direction.
*/
- private static final String[] DEGREE_SUFFIXES = {"east", "west", "north", "south"};
+ private static final String[] CARDINAL_DIRECTIONS = {"east", "west", "north", "south"};
/**
* Do not allows instantiation of this class.
@@ -374,15 +374,21 @@ public final class Units extends Static
* Those suffixes are ignored.
*/
if (uom.regionMatches(true, 0, "deg", 0, 3)) {
- if (length == 3) {
- return NonSI.DEGREE_ANGLE; // Exactly "deg"
+ switch (length) {
+ case 3: return NonSI.DEGREE_ANGLE; // Exactly "deg"
+ case 4: {
+ if (uom.charAt(3) == 'K') {
+ return SI.KELVIN; // Exactly "degK".
+ }
+ break;
+ }
}
String prefix = uom;
boolean isTemperature = false;
final int s = Math.max(uom.lastIndexOf(' '), uom.lastIndexOf('_'));
if (s >= 1) {
final String suffix = (String) trimWhitespaces(uom, s+1, length);
- if (ArraysExt.containsIgnoreCase(DEGREE_SUFFIXES, suffix) || (isTemperature = isCelsius(suffix))) {
+ if (ArraysExt.containsIgnoreCase(CARDINAL_DIRECTIONS, suffix) || (isTemperature = isCelsius(suffix))) {
prefix = (String) trimWhitespaces(uom, 0, s); // Remove the suffix only if we recognized it.
}
}
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -435,9 +435,9 @@ public final class Types extends Static
* Note that the size of the returned array may growth between different invocations of this method,
* since users can add their own codes to an existing list.
*
- * {@note This method works with both <code>Enum</code> and <code>CodeList</code>. However if the type
- * is known to be an <code>Enum</code>, then the standard <code>Class.getEnumConstants()</code>
- * method is more efficient.}
+ * <div class="note"><b>Note:</b>
+ * This method works with both {@link Enum} and {@link CodeList}. However if the type is known to be an
+ * {@code Enum}, then the standard {@link Class#getEnumConstants()} method is more efficient.</div>
*
* @param <T> The compile-time type given as the {@code codeType} parameter.
* @param codeType The type of code list or enumeration.
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -81,6 +81,11 @@ public final class Errors extends Indexe
public static final short CanNotAddToExclusiveSet_2 = 0;
/**
+ * Can not assign units “{1}” to dimension “{0}”.
+ */
+ public static final short CanNotAssignUnitToDimension_2 = 168;
+
+ /**
* Can not assign “{1}” to “{0}”.
*/
public static final short CanNotAssign_2 = 167;
@@ -146,6 +151,16 @@ public final class Errors extends Indexe
public static final short CanNotSetPropertyValue_1 = 11;
/**
+ * Can not transform envelope.
+ */
+ public static final short CanNotTransformEnvelope = 176;
+
+ /**
+ * Can not transform envelope to a geodetic CRS.
+ */
+ public static final short CanNotTransformEnvelopeToGeodetic = 174;
+
+ /**
* Circular reference.
*/
public static final short CircularReference = 52;
@@ -236,6 +251,11 @@ public final class Errors extends Indexe
public static final short ExcessiveListSize_2 = 25;
/**
+ * For this algorithm, {0} is an excessive number of dimensions.
+ */
+ public static final short ExcessiveNumberOfDimensions_1 = 177;
+
+ /**
* The character string is too long.
*/
public static final short ExcessiveStringSize = 153;
@@ -414,6 +434,11 @@ public final class Errors extends Indexe
public static final short InfiniteArgumentValue_1 = 51;
/**
+ * Inseparable transform.
+ */
+ public static final short InseparableTransform = 175;
+
+ /**
* Argument ‘{0}’ shall contain at least {1} elements. A number of {2} is insufficient.
*/
public static final short InsufficientArgumentSize_3 = 53;
@@ -474,6 +499,11 @@ public final class Errors extends Indexe
public static final short MissingAuthority_1 = 135;
/**
+ * No horizontal dimension found in “{0}”.
+ */
+ public static final short MissingHorizontalDimension_1 = 169;
+
+ /**
* “{0}” has no namespace.
*/
public static final short MissingNamespace_1 = 163;
@@ -489,6 +519,16 @@ public final class Errors extends Indexe
public static final short MissingSchemeInURI = 62;
/**
+ * No spatial or temporal dimension found in “{0}”
+ */
+ public static final short MissingSpatioTemporalDimension_1 = 170;
+
+ /**
+ * No temporal dimension found in “{0}”
+ */
+ public static final short MissingTemporalDimension_1 = 171;
+
+ /**
* Missing value for “{0}” option.
*/
public static final short MissingValueForOption_1 = 63;
@@ -509,6 +549,11 @@ public final class Errors extends Indexe
public static final short MissingValueInColumn_1 = 65;
/**
+ * No vertical dimension found in “{0}”
+ */
+ public static final short MissingVerticalDimension_1 = 172;
+
+ /**
* Options “{0}” and “{1}” are mutually exclusive.
*/
public static final short MutuallyExclusiveOptions_2 = 66;
@@ -869,6 +914,11 @@ public final class Errors extends Indexe
public static final short UnresolvedFeatureName_1 = 164;
/**
+ * Coordinate reference system is unspecified.
+ */
+ public static final short UnspecifiedCRS = 173;
+
+ /**
* No format is specified for objects of class ‘{0}’.
*/
public static final short UnspecifiedFormatForClass_1 = 126;
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Jan 14 09:53:53 2015
@@ -28,6 +28,7 @@ AbstractType_1 = Type
AmbiguousName_3 = Name \u201c{2}\u201d is ambiguous because it can be understood as either \u201c{0}\u201d or \u201c{1}\u201d.
CanNotAddToExclusiveSet_2 = No element can be added to this set because properties \u2018{0}\u2019 and \u2018{1}\u2019 are mutually exclusive.
CanNotAssign_2 = Can not assign \u201c{1}\u201d to \u201c{0}\u201d.
+CanNotAssignUnitToDimension_2 = Can not assign units \u201c{1}\u201d to dimension \u201c{0}\u201d.
CanNotConcatenateTransforms_2 = Can not concatenate transforms \u201c{0}\u201d and \u201c{1}\u201d.
CanNotConnectTo_1 = Can not connect to \u201c{0}\u201d.
CanNotConvertFromType_2 = Can not convert from type \u2018{0}\u2019 to type \u2018{1}\u2019.
@@ -40,6 +41,8 @@ CanNotParseFile_2 = Can
CanNotRead_1 = Can not read \u201c{0}\u201d.
CanNotRepresentInFormat_2 = Can not represent \u201c{1}\u201d in the {0} format.
CanNotSetPropertyValue_1 = Can not set a value for property \u201c{0}\u201d.
+CanNotTransformEnvelope = Can not transform envelope.
+CanNotTransformEnvelopeToGeodetic = Can not transform envelope to a geodetic CRS.
CircularReference = Circular reference.
ClassNotFinal_1 = Class \u2018{0}\u2019 is not final.
CloneNotSupported_1 = Can not clone an object of type \u2018{0}\u2019.
@@ -58,6 +61,7 @@ EmptyEnvelope2D = Enve
EmptyProperty_1 = Property named \u201c{0}\u201d shall not be empty.
ExcessiveArgumentSize_3 = Argument \u2018{0}\u2019 shall not contain more than {1} elements. A number of {2} is excessive.
ExcessiveListSize_2 = A size of {1} elements is excessive for the \u201c{0}\u201d list.
+ExcessiveNumberOfDimensions_1 = For this algorithm, {0} is an excessive number of dimensions.
ExcessiveStringSize = The character string is too long.
FileNotFound_1 = File \u201c{0}\u201d has not been found.
ForbiddenAttribute_2 = Attribute \u201c{0}\u201d is not allowed for an object of type \u2018{1}\u2019.
@@ -93,6 +97,7 @@ IdentifierAlreadyBound_1 = Iden
IndexOutOfBounds_1 = Index {0} is out of bounds.
IndicesOutOfBounds_2 = Indices ({0}, {1}) are out of bounds.
InfiniteArgumentValue_1 = Argument \u2018{0}\u2019 can not take an infinite value.
+InseparableTransform = Inseparable transform.
InsufficientArgumentSize_3 = Argument \u2018{0}\u2019 shall contain at least {1} elements. A number of {2} is insufficient.
KeyCollision_1 = A different value is already associated to the \u201c{0}\u201d key.
MandatoryAttribute_2 = Attribute \u201c{0}\u201d is mandatory for an object of type \u2018{1}\u2019.
@@ -112,6 +117,10 @@ MissingValueForOption_1 = Miss
MissingValueForParameter_1 = Missing value for \u201c{0}\u201d parameter.
MissingValueForProperty_1 = Missing value for \u201c{0}\u201d property.
MissingValueInColumn_1 = Missing value in the \u201c{0}\u201d column.
+MissingHorizontalDimension_1 = No horizontal dimension found in \u201c{0}\u201d.
+MissingVerticalDimension_1 = No vertical dimension found in \u201c{0}\u201d
+MissingTemporalDimension_1 = No temporal dimension found in \u201c{0}\u201d
+MissingSpatioTemporalDimension_1 = No spatial or temporal dimension found in \u201c{0}\u201d
MutuallyExclusiveOptions_2 = Options \u201c{0}\u201d and \u201c{1}\u201d are mutually exclusive.
NegativeArgument_2 = Argument \u2018{0}\u2019 shall not be negative. The given value was {1}.
NegativeArrayLength_1 = Can not create a \u201c{0}\u201d array of negative length.
@@ -185,6 +194,7 @@ UnmodifiableObject_1 = Obje
UnparsableStringForClass_2 = Text \u201c{1}\u201d can not be parsed as an object of type \u2018{0}\u2019.
UnparsableStringForClass_3 = Text \u201c{1}\u201d can not be parsed as an object of type \u2018{0}\u2019, because of the \u201c{2}\u201d characters.
UnresolvedFeatureName_1 = Feature named \u201c{0}\u201d has not yet been resolved.
+UnspecifiedCRS = Coordinate reference system is unspecified.
UnspecifiedFormatForClass_1 = No format is specified for objects of class \u2018{0}\u2019.
UnsupportedImplementation_1 = Can not handle instances of \u2018{0}\u2019 because arbitrary implementations are not yet supported.
UnsupportedOperation_1 = The \u2018{0}\u2019 operation is unsupported.
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Jan 14 09:53:53 2015
@@ -18,6 +18,7 @@ AbstractType_1 = Le t
AmbiguousName_3 = Le nom \u00ab\u202f{2}\u202f\u00bb est ambigu\u00eb car il peut \u00eatre interpr\u00e9t\u00e9 comme \u00ab\u202f{0}\u202f\u00bb ou \u00ab\u202f{1}\u202f\u00bb.
CanNotAddToExclusiveSet_2 = Aucun \u00e9l\u00e9ment ne peut \u00eatre ajout\u00e9 \u00e0 cet ensemble car les propri\u00e9t\u00e9s \u2018{0}\u2019 et \u2018{1}\u2019 sont mutuellement exclusives.
CanNotAssign_2 = Ne peut pas assigner \u00ab\u202f{1}\u202f\u00bb \u00e0 \u00ab\u202f{0}\u202f\u00bb.
+CanNotAssignUnitToDimension_2 = Ne peut pas assigner les unit\u00e9s \u00ab\u202f{1}\u202f\u00bb \u00e0 la dimension \u00ab\u202f{0}\u202f\u00bb.
CanNotConcatenateTransforms_2 = Les transformations \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb ne peuvent pas \u00eatre combin\u00e9es.
CanNotConnectTo_1 = Ne peut pas se connecter \u00e0 \u00ab\u202f{0}\u202f\u00bb.
CanNotConvertFromType_2 = Ne peut pas convertir du type \u2018{0}\u2019 vers le type \u2018{1}\u2019.
@@ -30,6 +31,8 @@ CanNotParseFile_2 = Ne p
CanNotRead_1 = Ne peut pas lire \u00ab\u202f{0}\u202f\u00bb.
CanNotRepresentInFormat_2 = Ne peut pas repr\u00e9senter \u00ab\u202f{1}\u202f\u00bb dans le format {0}.
CanNotSetPropertyValue_1 = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
+CanNotTransformEnvelope = Ne peut pas transformer l\u2019enveloppe.
+CanNotTransformEnvelopeToGeodetic = Ne peut pas transformer l\u2019enveloppe vers un syst\u00e8me g\u00e9od\u00e9sique.
CircularReference = R\u00e9f\u00e9rence circulaire.
ClassNotFinal_1 = La classe \u2018{0}\u2019 n\u2019est pas finale.
CloneNotSupported_1 = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre clon\u00e9.
@@ -48,6 +51,7 @@ EmptyEnvelope2D = L\u2
EmptyProperty_1 = La propri\u00e9t\u00e9 nomm\u00e9e \u00ab\u202f{0}\u202f\u00bb ne doit pas \u00eatre vide.
ExcessiveArgumentSize_3 = L\u2019argument \u2018{0}\u2019 ne peut pas contenir plus de {1} \u00e9l\u00e9ments. Un nombre de {2} est excessif.
ExcessiveListSize_2 = Une taille de {1} \u00e9l\u00e9ments est excessive pour la liste \u00ab\u202f{0}\u202f\u00bb.
+ExcessiveNumberOfDimensions_1 = Pour cet algorithme, {0} est un trop grand nombre de dimensions.
ExcessiveStringSize = La cha\u00eene de caract\u00e8res est trop longue.
FileNotFound_1 = Le fichier \u00ab\u202f{0}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
ForbiddenAttribute_2 = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb n\u2019est pas autoris\u00e9 pour un objet de type \u2018{1}\u2019.
@@ -83,6 +87,7 @@ IdentifierAlreadyBound_1 = L\u2
IndexOutOfBounds_1 = L\u2019index {0} est en dehors des limites permises.
IndicesOutOfBounds_2 = Les index ({0}, {1}) sont en dehors des limites permises.
InfiniteArgumentValue_1 = L\u2019argument \u2018{0}\u2019 ne peut pas prendre une valeur infinie.
+InseparableTransform = La transformation n\u2019est pas s\u00e9parable.
InsufficientArgumentSize_3 = L\u2019argument \u2018{0}\u2019 doit contenir au moins {1} \u00e9l\u00e9ments. Un nombre de {2} est insuffisant.
KeyCollision_1 = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e \u00e0 la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
MandatoryAttribute_2 = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire pour un objet de type \u2018{1}\u2019.
@@ -102,6 +107,10 @@ MissingValueForOption_1 = Aucu
MissingValueForParameter_1 = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb.
MissingValueForProperty_1 = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
MissingValueInColumn_1 = Il manque une valeur dans la colonne \u00ab\u202f{0}\u202f\u00bb.
+MissingHorizontalDimension_1 = Aucune dimension horizontale n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
+MissingVerticalDimension_1 = Aucune dimension verticale n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
+MissingTemporalDimension_1 = Aucune dimension temporelle n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
+MissingSpatioTemporalDimension_1 = Aucune dimension spatiale ou temporelle n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u00ab\u202f{0}\u202f\u00bb.
MutuallyExclusiveOptions_2 = Les options \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb sont mutuellement exclusives.
NegativeArgument_2 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre n\u00e9gatif. La valeur donn\u00e9e \u00e9tait {1}.
NegativeArrayLength_1 = Ne peut pas cr\u00e9er un tableau \u00ab\u202f{0}\u202f\u00bb de longueur n\u00e9gative.
@@ -171,6 +180,7 @@ UnmodifiableCellValue_2 = La c
UnmodifiableGeometry = Cette g\u00e9om\u00e9trie n\u2019est pas modifiable.
UnmodifiableMetadata = Cette m\u00e9ta-donn\u00e9e n\u2019est pas modifiable.
UnmodifiableObject_1 = L\u2019objet \u2018{0}\u2019 n\u2019est pas modifiable.
+UnspecifiedCRS = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es n\u2019a pas \u00e9t\u00e9 sp\u00e9cifi\u00e9.
UnspecifiedFormatForClass_1 = Aucun format n\u2019est sp\u00e9cifi\u00e9 pour les objets de classe \u2018{0}\u2019.
UnparsableStringForClass_2 = Le texte \u00ab\u202f{1}\u202f\u00bb n\u2019est pas reconnu comme un objet de type \u2018{0}\u2019.
UnparsableStringForClass_3 = Le texte \u00ab\u202f{1}\u202f\u00bb n\u2019est pas reconnu comme un objet de type \u2018{0}\u2019, \u00e0 cause des caract\u00e8res \u00ab\u202f{2}\u202f\u00bb.
Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/SystemRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/SystemRegistryTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/SystemRegistryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/SystemRegistryTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -49,7 +49,22 @@ public final strictfp class SystemRegist
* Tests the creation of {@link StringConverter}.
*/
@Test
- public void testStringFile() {
+ public void testStringAndInteger() {
+ final ObjectConverter<String,Integer> c1 = INSTANCE.findExact(String.class, Integer.class);
+ final ObjectConverter<Integer,String> c2 = INSTANCE.findExact(Integer.class, String.class);
+ assertInstanceOf("Integer ← String", StringConverter.Integer.class, c1);
+ assertInstanceOf("String ← Integer", ObjectToString.class, c2);
+ assertSame("inverse()", c2, c1.inverse());
+ assertSame("inverse()", c1, c2.inverse());
+ assertSame(c1, assertSerializedEquals(c1));
+ assertSame(c2, assertSerializedEquals(c2));
+ }
+
+ /**
+ * Tests the creation of {@link StringConverter}.
+ */
+ @Test
+ public void testStringAndFile() {
final ObjectConverter<String,File> c1 = INSTANCE.findExact(String.class, File.class);
final ObjectConverter<File,String> c2 = INSTANCE.findExact(File.class, String.class);
assertInstanceOf("File ← String", StringConverter.File.class, c1);
@@ -64,7 +79,7 @@ public final strictfp class SystemRegist
* Tests the creation of code list converter.
*/
@Test
- public void testStringCodeList() {
+ public void testStringAndCodeList() {
final ObjectConverter<String, OnLineFunction> c1 = INSTANCE.findExact(String.class, OnLineFunction.class);
final ObjectConverter<OnLineFunction, String> c2 = INSTANCE.findExact(OnLineFunction.class, String.class);
assertInstanceOf("OnLineFunction ← String", StringConverter.CodeList.class, c1);
@@ -81,7 +96,7 @@ public final strictfp class SystemRegist
* @since 0.5
*/
@Test
- public void testStringEnum() {
+ public void testStringAndEnum() {
final ObjectConverter<String, ElementType> c1 = INSTANCE.findExact(String.class, ElementType.class);
final ObjectConverter<ElementType, String> c2 = INSTANCE.findExact(ElementType.class, String.class);
assertInstanceOf("ElementType ← String", StringConverter.Enum.class, c1);
@@ -96,7 +111,7 @@ public final strictfp class SystemRegist
* Tests the creation of {@link NumberConverter}.
*/
@Test
- public void testFloatDouble() {
+ public void testFloatAndDouble() {
final ObjectConverter<Float,Double> c1 = INSTANCE.findExact(Float.class, Double.class);
final ObjectConverter<Double,Float> c2 = INSTANCE.findExact(Double.class, Float.class);
assertInstanceOf("Double ← Float", NumberConverter.class, c1);
@@ -111,7 +126,7 @@ public final strictfp class SystemRegist
* Tests the creation of {@link DateConverter}.
*/
@Test
- public void testDateLong() {
+ public void testDateAndLong() {
final ObjectConverter<Date,Long> c1 = INSTANCE.findExact(Date.class, Long.class);
final ObjectConverter<Long,Date> c2 = INSTANCE.findExact(Long.class, Date.class);
assertInstanceOf("Long ← Date", DateConverter.Long.class, c1);
@@ -127,7 +142,7 @@ public final strictfp class SystemRegist
* to {@code java.sql.Date}. The inverse converter is an identity converter.
*/
@Test
- public void testDateSQL() {
+ public void testDateAndSQL() {
final ObjectConverter<Date, java.sql.Date> c1 = INSTANCE.findExact(Date.class, java.sql.Date.class);
final ObjectConverter<java.sql.Date, Date> c2 = INSTANCE.findExact(java.sql.Date.class, Date.class);
assertInstanceOf("sql.Date ← Date", DateConverter.SQL.class, c1);
@@ -142,7 +157,7 @@ public final strictfp class SystemRegist
* Tests the creation of {@link PathConverter}.
*/
@Test
- public void testFileURI() {
+ public void testFileAndURI() {
final ObjectConverter<File,URI> c1 = INSTANCE.findExact(File.class, URI.class);
final ObjectConverter<URI,File> c2 = INSTANCE.findExact(URI.class, File.class);
assertInstanceOf("URI ← File", PathConverter.FileURI.class, c1);
Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -256,6 +256,7 @@ public final strictfp class UnitsTest ex
assertSame(KILOMETRE, valueOf("kilomètres"));
assertSame(KILOMETRE, valueOf("kilometers"));
assertSame(KELVIN, valueOf("K"));
+ assertSame(KELVIN, valueOf("degK"));
assertSame(CELSIUS, valueOf("Celsius"));
assertSame(CELSIUS, valueOf("degree Celsius"));
assertSame(CELSIUS, valueOf("degree_Celcius"));
Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -339,10 +339,10 @@ public strictfp class Assert extends org
}
/**
- * Serializes the given object in memory, deserialize it and ensures that the deserialized
- * object is equals to the original one. This method doesn't write anything to the disk.
+ * Serializes the given object in memory, deserializes it and ensures that the deserialized
+ * object is equals to the original one. This method does not write anything to the disk.
*
- * <p>If the serialization fails, then this method thrown an {@link AssertionError}
+ * <p>If the serialization fails, then this method throws an {@link AssertionError}
* as do the other JUnit assertion methods.</p>
*
* @param <T> The type of the object to serialize.
Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -215,7 +215,7 @@ public final strictfp class MetadataMock
* @return {@code null}.
*/
@Override
- public Collection<? extends CitationDate> getDates() {
+ public Collection<? extends CitationDate> getDateInfo() {
return null;
}
Modified: sis/branches/JDK6/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/ide-project/NetBeans/build.xml?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK6/ide-project/NetBeans/build.xml Wed Jan 14 09:53:53 2015
@@ -37,11 +37,13 @@
<include name="*.utf"/>
</fileset>
</copy>
+ <!-- Pending discussion about how to handle resources in the Shapefile module.
<copy todir="${build.classes.dir}/org/apache/sis/internal/shapefile/jdbc">
<fileset dir="${project.root}/storage/sis-shapefile/target/generated-resources/org/apache/sis/internal/shapefile/jdbc">
<include name="*.utf"/>
</fileset>
</copy>
+ -->
<!-- Following are classical properties resources files. -->
<copy todir="${build.classes.dir}">
Modified: sis/branches/JDK6/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/pom.xml?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/pom.xml (original)
+++ sis/branches/JDK6/pom.xml Wed Jan 14 09:53:53 2015
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>15</version>
+ <version>16</version>
</parent>
@@ -341,7 +341,7 @@ Apache SIS is a free software, Java lang
<dependency>
<groupId>com.esri.geometry</groupId>
<artifactId>esri-geometry-api</artifactId>
- <version>1.1.1</version>
+ <version>1.2</version>
</dependency>
<dependency>
<groupId>gov.nist.math</groupId>
@@ -357,7 +357,7 @@ Apache SIS is a free software, Java lang
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
- <version>1.8</version>
+ <version>1.9</version>
</dependency>
<!-- Optional dependencies -->
@@ -516,10 +516,43 @@ Apache SIS is a free software, Java lang
</configuration>
</plugin>
+ <!-- Checkstype configuration
+ Legal note: Checkstyle is under LGPL license, but it is okay to use it only for
+ the build if it is downloaded by Maven (not included in Apache SIS distribution).
+ See http://www.apache.org/legal/resolved.html#prohibited
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.13</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <configuration>
+ <skip>${skipTests}</skip> <!-- When skipping tests, skip also checkstyle verification. -->
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <consoleOutput>true</consoleOutput>
+ <checkstyleRules>
+ <module name="Checker">
+ <module name="FileTabCharacter"/> <!-- Checks that there are no tab characters in the file. -->
+<!-- <module name="NewlineAtEndOfFile"/> <!- Checks that there is a newline at the end of each file. ->
+ <module name="TreeWalker">
+ <module name="RedundantImport"/> <!- Checks for redundant import statements. ->
+ <module name="GenericWhitespace"/> <!- Checks that the whitespace around the Generic tokens follow the typical convention. ->
+ </module> -->
+ </module>
+ </checkstyleRules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- JavaDoc configuration. -->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
+ <version>2.10.1</version>
<configuration>
<source>${maven.compile.source}</source> <!-- Enables javadoc to handle language constructs present in target JDK. -->
<encoding>${project.build.sourceEncoding}</encoding> <!-- Encoding of Java source file. -->
@@ -533,8 +566,7 @@ Apache SIS is a free software, Java lang
<quiet>true</quiet> <!-- Shuts off non-error and non-warning messages. -->
<keywords>true</keywords> <!-- Adds HTML meta keyword tags to the generated files. -->
<breakiterator>true</breakiterator> <!-- Better boundary detection when determining the end of the first sentence. -->
- <stylesheetfile>src/main/javadoc/stylesheet.css</stylesheetfile>
- <validateLinks>true</validateLinks>
+ <validateLinks>true</validateLinks> <!-- Validates content of package-list resources. -->
<links>
<link>http://www.geoapi.org/snapshot/pending</link>
</links>
@@ -646,7 +678,7 @@ Apache SIS is a free software, Java lang
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
+ <version>1.9.1</version>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -28,7 +28,7 @@ import org.apache.sis.util.Debug;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.5
* @module
*/
public abstract class Variable {
@@ -68,6 +68,13 @@ public abstract class Variable {
public abstract String getDescription();
/**
+ * Returns the unit of measurement as a string, or {@code null} if none.
+ *
+ * @return The unit of measurement, or {@code null}.
+ */
+ public abstract String getUnitsString();
+
+ /**
* Returns the variable data type, as a primitive type if possible.
*
* @return The variable data type, or {@code null} if unknown.
Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Attribute.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Attribute.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Attribute.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/Attribute.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -52,11 +52,17 @@ final class Attribute {
/**
* The value, either as a {@link String} or as an array of primitive type.
* Never {@code null} and never an empty string or empty array.
+ *
+ * <p>If the value is a {@code String}, then leading and trailing spaces and control characters
+ * have been trimmed by {@link String#trim()}.</p>
*/
final Object value;
/**
* Creates a new attribute of the given name and value.
+ *
+ * @param name The attribute name (can not be null).
+ * @param value The value (trimmed if a {@code String}).
*/
Attribute(final String name, final Object value) {
this.name = name;
Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -329,10 +329,9 @@ public final class ChannelDecoder extend
if (length < 0) {
throw malformedHeader();
}
- final ByteBuffer buffer = input.buffer;
final int size = ensureBufferContains(length, 1, "<name>");
final String text = input.readString(length, NAME_ENCODING);
- buffer.position(buffer.position() + (size - length));
+ input.buffer.position(input.buffer.position() + (size - length));
return text;
}
@@ -341,6 +340,9 @@ public final class ChannelDecoder extend
* as a {@link String}. Otherwise this method returns the value as an array of the corresponding primitive type
* and the given length.
*
+ * <p>If the value is a {@code String}, then leading and trailing spaces and control characters have been trimmed
+ * by {@link String#trim()}.</p>
+ *
* @return The value, or {@code null} if it was an empty string or an empty array.
*/
private Object readValues(final String name, final int type, final int length) throws IOException, DataStoreException {
@@ -433,6 +435,9 @@ public final class ChannelDecoder extend
* <li>The actual values as a variable length list (use {@link #readValues(String,int,int)})</li>
* </ul>
*
+ * If the value is a {@code String}, then leading and trailing spaces and control characters
+ * have been trimmed by {@link String#trim()}.
+ *
* @param nelems The number of attributes to read.
*/
private Attribute[] readAttributes(final int nelems) throws IOException, DataStoreException {
Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -33,7 +33,7 @@ import org.apache.sis.util.resources.Err
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.5
* @module
*/
final class VariableInfo extends Variable {
@@ -162,13 +162,25 @@ final class VariableInfo extends Variabl
@Override
public String getDescription() {
for (final String attributeName : DESCRIPTION_ATTRIBUTES) {
- Attribute attribute = attributes.get(attributeName);
+ final Attribute attribute = attributes.get(attributeName);
if (attribute != null && attribute.value instanceof String) {
return (String) attribute.value;
}
}
return null;
}
+
+ /**
+ * Returns the unit of measurement as a string, or {@code null} if none.
+ */
+ @Override
+ public String getUnitsString() {
+ final Attribute attribute = attributes.get(CDM.UNITS);
+ if (attribute != null && attribute.value instanceof String) {
+ return (String) attribute.value;
+ }
+ return null;
+ }
/**
* Returns the type of data as a Java primitive type if possible,
Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java?rev=1651610&r1=1651609&r2=1651610&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] Wed Jan 14 09:53:53 2015
@@ -30,7 +30,7 @@ import org.apache.sis.internal.netcdf.Va
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.3
+ * @version 0.5
* @module
*/
final class VariableWrapper extends Variable {
@@ -69,6 +69,14 @@ final class VariableWrapper extends Vari
}
/**
+ * Returns the unit of measurement as a string, or {@code null} if none.
+ */
+ @Override
+ public String getUnitsString() {
+ return variable.getUnitsString();
+ }
+
+ /**
* Returns the variable data type, as a primitive type if possible.
* This method may return {@code null} (UCAR code seems to allow that).
*/