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/03/31 23:30:10 UTC
svn commit: r1670485 [8/12] - in /sis/branches/JDK6: ./
application/sis-console/src/main/java/org/apache/sis/console/
application/sis-webapp/src/main/java/org/apache/sis/services/
core/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/ core...
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomain.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -20,6 +20,7 @@ import java.util.Random;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Longitude;
import static java.lang.StrictMath.*;
+import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
// Test imports
import org.apache.sis.test.mock.GeodeticDatumMock;
@@ -31,14 +32,29 @@ import org.apache.sis.test.mock.Geodetic
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*/
-public strictfp enum CoordinateDomain {
+public strictfp class CoordinateDomain {
+ /**
+ * Latitude of the Article circle, which is 66°33′45.7″ as of March 30, 2015
+ * Note that this value fluctuate by 2° over 40,000-year periods.
+ */
+ private static final double ARTICLE_CIRCLE = 66 + (33 + 45.7 / 60) / 60;
+
+ /**
+ * Maximum altitude to be used in this class, in metres.
+ */
+ private static final double HEIGHT = 10000;
+
/**
* Geocentric input coordinates. The input dimension must be 3.
*/
- GEOCENTRIC {
+ public static final CoordinateDomain GEOCENTRIC = new CoordinateDomain(
+ -(AUTHALIC_RADIUS + HEIGHT), (AUTHALIC_RADIUS + HEIGHT),
+ -(AUTHALIC_RADIUS + HEIGHT), (AUTHALIC_RADIUS + HEIGHT),
+ -(AUTHALIC_RADIUS + HEIGHT), (AUTHALIC_RADIUS + HEIGHT))
+ {
@Override
public double[] generateRandomInput(final Random random, final int dimension, final int numPts) {
if (dimension != 3) {
@@ -57,211 +73,141 @@ public strictfp enum CoordinateDomain {
}
return ordinates;
}
- },
+ };
/**
* Geographic input coordinates with angles in decimal degrees.
* Ordinates are in (<var>longitude</var>, <var>latitude</var>, <var>height</var>) order.
*/
- GEOGRAPHIC {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = Longitude.MAX_VALUE; break; // Full longitude range.
- case 1: range = Latitude.MAX_VALUE; break; // Full latitude range.
- case 2: range = 10000; break; // Ellipsoidal height.
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC = new CoordinateDomain(
+ Longitude.MIN_VALUE, Longitude.MAX_VALUE,
+ Latitude .MIN_VALUE, Latitude .MAX_VALUE,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates avoiding poles and anti-meridian.
* Ordinates are in (<var>longitude</var>, <var>latitude</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_SAFE {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = Longitude.MAX_VALUE - 1; break; // Longitude, avoiding anti-meridian.
- case 1: range = Latitude.MAX_VALUE - 20; break; // Latitude, avoiding pole.
- case 2: range = 5000; break; // Ellipsoidal height.
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_SAFE = new CoordinateDomain(
+ Longitude.MIN_VALUE + 1, Longitude.MAX_VALUE - 1,
+ -ARTICLE_CIRCLE, +ARTICLE_CIRCLE,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates close to the poles.
* Ordinates are in (<var>longitude</var>, <var>latitude</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_POLES {
+ public static final CoordinateDomain GEOGRAPHIC_POLES = new CoordinateDomain(
+ Longitude.MIN_VALUE, Longitude.MAX_VALUE,
+ Latitude .MIN_VALUE, Latitude .MAX_VALUE,
+ -0*5 * HEIGHT, 0.5 * HEIGHT)
+ {
@Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = Longitude.MAX_VALUE; break;
- case 1: range = 20; break;
- case 2: range = 5000; break;
- default: return super.generate(random, dimension);
- }
- double value = random.nextDouble() * (2*range) - range;
- if (dimension == 1) {
- if (value <= 0) {
- value += Latitude.MAX_VALUE;
- } else {
- value += Latitude.MIN_VALUE;
+ public double[] generateRandomInput(final Random random, final int dimension, final int numPts) {
+ final double[] ordinates = super.generateRandomInput(random, dimension, numPts);
+ for (int i=1; i < ordinates.length; i += dimension) {
+ final double φ = ordinates[i];
+ double a = abs(φ);
+ if (a < ARTICLE_CIRCLE) {
+ a -= floor(a / (Latitude.MAX_VALUE - ARTICLE_CIRCLE)) * (Latitude.MAX_VALUE - ARTICLE_CIRCLE);
+ a = (Latitude.MAX_VALUE - a);
+ ordinates[i] = copySign(a, φ);
}
}
- return value;
+ return ordinates;
}
- },
+ };
/**
* Geographic input coordinates with angles in radians.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = PI; break; // Longitude.
- case 1: range = PI/2; break; // Latitude.
- case 2: range = 10000; break; // Ellipsoidal height.
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS = new CoordinateDomain(
+ -PI, PI,
+ -PI/2, PI/2,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates with angles in radians and only half of the longitude range.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS_HALF_λ {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = PI/2; break; // Longitude.
- case 1: range = PI/2; break; // Latitude.
- case 2: range = 10000; break; // Ellipsoidal height.
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS_HALF_λ = new CoordinateDomain(
+ -PI/2, PI/2,
+ -PI/2, PI/2,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates with angles in radians in the North hemisphere only.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS_NORTH {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = PI; break;
- case 1: return +PI/2*random.nextDouble();
- case 2: range = 10000; break;
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS_NORTH = new CoordinateDomain(
+ -PI, PI,
+ 0, PI/2,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates with angles in radians in the South hemisphere only.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS_SOUTH {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = PI; break;
- case 1: return -PI/2*random.nextDouble();
- case 2: range = 10000; break;
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS_SOUTH = new CoordinateDomain(
+ -PI, PI,
+ -PI/2, 0,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates with angles in radians in the East hemisphere only.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS_EAST {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: return +PI*random.nextDouble();
- case 1: range = PI/2; break;
- case 2: range = 10000; break;
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS_EAST = new CoordinateDomain(
+ 0, PI,
+ -PI/2, PI/2,
+ -HEIGHT, HEIGHT);
/**
* Geographic input coordinates with angles in radians in the West hemisphere only.
* Ordinates are in (<var>lambda</var>, <var>phi</var>, <var>height</var>) order.
*/
- GEOGRAPHIC_RADIANS_WEST {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: return -PI*random.nextDouble();
- case 1: range = PI/2; break;
- case 2: range = 10000; break;
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain GEOGRAPHIC_RADIANS_WEST = new CoordinateDomain(
+ -PI, 0,
+ -PI/2, PI/2,
+ -HEIGHT, HEIGHT);
/**
* Projected input coordinates in a range suitable for UTM projections.
* Ordinates are in (<var>easting</var>, <var>northing</var>, <var>height</var>) order.
*/
- PROJECTED {
- @Override
- double generate(final Random random, final int dimension) {
- final double range;
- switch (dimension) {
- case 0: range = 350000; break; // Easting.
- case 1: range = 8000000; break; // Northing.
- case 2: range = 10000; break; // Ellipsoidal height.
- default: return super.generate(random, dimension);
- }
- return random.nextDouble() * (2*range) - range;
- }
- },
+ public static final CoordinateDomain PROJECTED = new CoordinateDomain(
+ -350000, 350000, // Easting
+ -8000000, 8000000, // Northing
+ -HEIGHT, HEIGHT); // Ellipsoidal height
/**
- * Values in the -10 to 10 range.
+ * Values in the -10 to 10 range in all dimensions.
*/
- RANGE_10 {
- @Override
- double generate(final Random random, final int dimension) {
- return random.nextDouble() * 20 - 10;
- }
- },
+ public static final CoordinateDomain RANGE_10 = new CoordinateDomain(
+ -10, 10,
+ -10, 10,
+ -10, 10);
/**
- * Gaussian distribution. Numbers can be positives or negatives, mostly close to zero but some
- * numbers can be arbitrarily large.
+ * The domain of the coordinates to test.
*/
- GAUSSIAN;
+ final double xmin, xmax, ymin, ymax, zmin, zmax;
+
+ /**
+ * Creates a new domain with the given bounding box.
+ */
+ private CoordinateDomain(final double xmin, final double xmax,
+ final double ymin, final double ymax,
+ final double zmin, final double zmax)
+ {
+ this.xmin = xmin;
+ this.xmax = xmax;
+ this.ymin = ymin;
+ this.ymax = ymax;
+ this.zmin = zmin;
+ this.zmax = zmax;
+ }
/**
* Generates random input coordinates.
@@ -273,20 +219,24 @@ public strictfp enum CoordinateDomain {
*/
public double[] generateRandomInput(final Random random, final int dimension, final int numPts) {
final double[] ordinates = new double[numPts * dimension];
- for (int i=0; i<ordinates.length; i++) {
- ordinates[i] = generate(random, i % dimension);
+ for (int j=0; j<dimension; j++) {
+ final double min, max;
+ switch (j) {
+ case 0: min = xmin; max = xmax; break;
+ case 1: min = ymin; max = ymax; break;
+ case 2: min = zmin; max = zmax; break;
+ default: {
+ for (int i=j; i<ordinates.length; i += dimension) {
+ ordinates[i] = random.nextGaussian();
+ }
+ continue;
+ }
+ }
+ final double range = max - min;
+ for (int i=j; i<ordinates.length; i += dimension) {
+ ordinates[i] = min + range * random.nextDouble();
+ }
}
return ordinates;
}
-
- /**
- * Generates a random number for the given dimension.
- *
- * @param random The random number generator to use.
- * @param dimension The dimension for which to generate a random number.
- * @return A random number suitable for the given dimension.
- */
- double generate(final Random random, final int dimension) {
- return random.nextGaussian();
- }
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -31,7 +31,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*/
public class CoordinateDomainTest extends TestCase {
@@ -47,14 +47,26 @@ public class CoordinateDomainTest extend
public void testGeocentric() {
assertArrayEquals(new double[] {
// ………………X ………………………Y ……………………Z
- -1277391.5, -6002208.9, 1732520.1,
- 74602.9, -589190.3, 6337303.4,
- -4761978.5, -1597877.1, -3914795.3,
- -4580863.2, 4167915.7, -1530203.8,
- -5088029.0, 1419280.2, 3574467.8
+ -790009.4, -3712097.2, -5115300.9,
+ 876346.5, 537685.1, -6296051.5,
+ -790310.7, 4969804.0, -3922073.1,
+ 729581.8, -5762010.5, -2627726.9,
+ -2261070.0, 427543.0, 5948444.0
}, CoordinateDomain.GEOCENTRIC.generateRandomInput(new Random(6711701980687388701L), 3, 5), TOLERANCE);
}
+/*
+ TIP: If the values need to be regenerated after a change in CoordinateDomain implementation,
+ one can use the following code:
+
+ public static void main(String[] args) {
+ double[] ordinates = CoordinateDomain.GEOGRAPHIC.generateRandomInput(new Random(9157324015136982593L), 3, 5));
+ for (int i=0; i<ordinates.length;) {
+ System.out.format(java.util.Locale.US, " %6.1f, %6.1f, %8.1f,%n", ordinates[i++], ordinates[i++], ordinates[i++]);
+ }
+ }
+*/
+
/**
* Tests {@link CoordinateDomain#GEOGRAPHIC}.
* Latitude values shall be in the [-90 … +90]° range.
@@ -63,44 +75,44 @@ public class CoordinateDomainTest extend
public void testGeographic() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- 83.5, 82.2, -7586.1,
- -87.6, -88.4, 231.1,
- -123.5, 18.3, 5601.5,
- 87.7, -14.1, 8710.9,
- 52.4, -68.4, -4706.3
+ 83.5, 2.1, -1566.8,
+ 164.3, -61.8, 8710.9,
+ -136.6, 18.3, 2910.8,
+ -87.6, 50.4, -7603.3,
+ -176.8, 43.9, -4706.3
}, CoordinateDomain.GEOGRAPHIC.generateRandomInput(new Random(9157324015136982593L), 3, 5), TOLERANCE);
}
/**
* Tests {@link CoordinateDomain#GEOGRAPHIC_SAFE}.
- * Latitude values shall be in the [-70 … +70]° range.
+ * Latitude values shall be in the [-66 … +66]° range approximatively.
*/
@Test
public void testGeographicSafe() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- -18.4, -35.6, -3804.6,
- 152.4, 3.5, 3166.6,
- -28.7, 14.7, 2820.3,
- -38.9, -36.0, -1568.6,
- 161.0, 46.2, 2492.8
+ -18.4, 42.2, -5144.4,
+ -91.0, -10.7, -3137.2,
+ -136.2, 14.0, 8993.6,
+ 152.4, 37.5, 6593.3,
+ 9.0, -14.5, 4985.6
}, CoordinateDomain.GEOGRAPHIC_SAFE.generateRandomInput(new Random(8378805665450590968L), 3, 5), TOLERANCE);
}
/**
* Tests {@link CoordinateDomain#GEOGRAPHIC_POLES}.
- * Latitude values shall be in the [-90 … -70]° or [70 … 90]° range.
+ * Latitude values shall be in the [-90 … -66]° or [66 … 90]° range approximatively.
*/
@Test
public void testGeographicPole() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- -136.4, 87.3, -1490.4,
- -97.8, 71.1, -4503.6,
- -45.3, 75.7, -3179.1,
- -45.1, -79.6, -3440.5,
- 11.1, -83.6, 2017.0
- }, CoordinateDomain.GEOGRAPHIC_POLES.generateRandomInput(new Random(6784869539382621962L), 3, 5), TOLERANCE);
+ -136.6, -74.3, 2467.5,
+ -17.9, 74.7, 2338.4,
+ 98.2, 66.9, 2078.0,
+ 151.9, 73.8, 2799.3,
+ -90.5, -86.4, 585.3
+ }, CoordinateDomain.GEOGRAPHIC_POLES.generateRandomInput(new Random(6784869539382621964L), 3, 5), TOLERANCE);
}
/**
@@ -110,11 +122,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadians() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- -144.2, 66.4, -3970.0,
- -3.1, -8.0, 6627.9,
- -20.4, 37.0, -9071.7,
- 151.2, -43.0, -8346.5,
- -121.7, 33.8, -5843.4
+ -144.2, 59.7, -4779.9,
+ 132.7, -10.2, -8346.5,
+ -71.5, 37.0, -6761.6,
+ -3.1, -81.6, 3751.3,
+ -16.0, 75.6, -5843.4
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS.generateRandomInput(new Random(8149671419063258264L), 3, 5)), TOLERANCE);
}
@@ -126,11 +138,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadiansHalfλ() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- -38.4, -42.3, -6357.0,
- 36.7, 18.2, -2924.6,
- -41.9, 2.4, -9840.4,
- 69.7, 31.2, 1866.3,
- 15.4, -89.1, 3977.3
+ -38.4, -26.3, 3464.7,
+ -42.3, -41.9, 1866.3,
+ -57.2, 2.4, 1713.4,
+ 36.7, -88.6, -9903.1,
+ 18.2, 69.7, 3977.3
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS_HALF_λ.generateRandomInput(new Random(544370108347649978L), 3, 5)), TOLERANCE);
}
@@ -141,11 +153,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadiansNorth() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- 70.2, 0.3, -2152.7,
- -142.0, 21.1, -6983.9,
- -30.1, 20.5, 6443.0,
- 48.8, 35.1, 4712.3,
- 7.4, 16.6, -7030.0
+ 70.2, 13.6, -2197.0,
+ -178.8, 37.5, 4712.3,
+ -38.7, 20.5, 413.2,
+ -142.0, 74.0, -6309.6,
+ -95.8, 57.2, -7030.0
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS_NORTH.generateRandomInput(new Random(2332709146110987009L), 3, 5)), TOLERANCE);
}
@@ -156,11 +168,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadiansSouth() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- 11.8, -29.7, -3783.7,
- -140.4, -62.1, -8471.8,
- 64.2, -2.5, -1100.3,
- -41.0, -86.7, 4986.0,
- -174.4, -84.5, 5615.6
+ 11.8, -83.1, 9272.3,
+ -61.2, -29.0, 4986.0,
+ -68.1, -87.5, -9688.0,
+ -140.4, -50.0, 8784.8,
+ 68.5, -55.3, 5615.6
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS_SOUTH.generateRandomInput(new Random(3024333515949168349L), 3, 5)), TOLERANCE);
}
@@ -171,11 +183,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadiansEast() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- 53.0, 22.9, -1166.6,
- 86.1, 12.1, -255.3,
- 142.9, 8.1, -3782.4,
- 138.1, 3.4, 1172.8,
- 146.4, -33.8, -4487.7
+ 53.0, -2.3, 373.2,
+ 112.9, 52.9, 1172.8,
+ 79.5, 8.1, 6267.0,
+ 86.1, -34.0, -3750.7,
+ 102.1, 48.1, -4487.7
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS_EAST.generateRandomInput(new Random(3351157046773088704L), 3, 5)), TOLERANCE);
}
@@ -186,11 +198,11 @@ public class CoordinateDomainTest extend
public void testGeographicRadiansWest() {
assertArrayEquals(new double[] {
// ……λ …………φ ………………H
- -175.6, 74.1, 8059.1,
- -173.9, 81.9, -6712.6,
- -11.3, 74.8, 4056.4,
- -81.4, -1.4, -9255.1,
- -133.4, -50.5, -2251.5
+ -4.4, -60.4, -153.3,
+ -15.9, -78.7, -9255.1,
+ -17.5, 74.8, 4824.4,
+ -6.1, 36.5, -5616.2,
+ -8.1, -8.6, -2251.5
}, toDegrees(CoordinateDomain.GEOGRAPHIC_RADIANS_WEST.generateRandomInput(new Random(7320025557405586859L), 3, 5)), TOLERANCE);
}
@@ -201,11 +213,11 @@ public class CoordinateDomainTest extend
public void testProjected() {
assertArrayEquals(new double[] {
// ………………x ……………………………y ………………h
- 11376932.6, -212881715.5, -5712.7,
- 7918069.3, -142014756.3, -2917.9,
- -1243860.7, -209994389.7, -893.4,
- 16373202.6, 414305247.8, -6783.9,
- -7715982.4, -20958213.4, -1625.9
+ 11376932.6, -133745096.2, 9038.7,
+ -9313575.1, -28431102.7, -6783.9,
+ -11455966.3, -209994389.7, -3847.7,
+ 7918069.3, -40952573.2, -457.2,
+ -6213145.6, 374244630.7, -1625.9
}, toDegrees(CoordinateDomain.PROJECTED.generateRandomInput(new Random(4961499932406116863L), 3, 5)), TOLERANCE);
}
@@ -224,20 +236,6 @@ public class CoordinateDomainTest extend
}
/**
- * Tests {@link CoordinateDomain#GAUSSIAN}.
- */
- @Test
- public void testGaussian() {
- assertArrayEquals(new double[] {
- -0.916,
- 1.777,
- -0.896,
- 0.093,
- 0.428
- }, CoordinateDomain.GAUSSIAN.generateRandomInput(new Random(7679314270394487033L), 1, 5), 0.0005);
- }
-
- /**
* Converts longitude and latitude values from radians to degrees, for easier reading of test methods.
*/
private static double[] toDegrees(final double[] coordinates) {
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -23,13 +23,15 @@ import org.apache.sis.internal.referenci
import org.junit.Test;
import org.apache.sis.test.DependsOn;
+import static org.apache.sis.test.ReferencingAssert.*;
+
/**
* Tests the {@link CopyTransform} class.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*/
@DependsOn({
@@ -52,16 +54,25 @@ public final strictfp class CopyTransfor
}
/**
+ * Initializes the {@link #transform} field to a {@link CopyTransform} instance created
+ * from the given argument. Then verifies that the matrix is consistent with the transform.
+ */
+ private void create(final int srcDim, final int... indices) {
+ transform = new CopyTransform(srcDim, indices);
+ assertEquals(transform, CopyTransform.create(((LinearTransform) transform).getMatrix()));
+ validate();
+ }
+
+ /**
* Tests an identity transform.
*
* @throws TransformException should never happen.
*/
@Test
public void testIdentity() throws TransformException {
- transform = new CopyTransform(3, 0, 1, 2);
- validate();
- verifyParameters(Affine.getProvider(3, 3, true).getParameters(), null);
- verifyIsIdentity(true);
+ create(3, 0, 1, 2);
+ assertIsIdentity(transform);
+ assertParameterEquals(Affine.getProvider(3, 3, true).getParameters(), null);
final double[] source = generateRandomCoordinates();
final double[] target = source.clone();
@@ -78,9 +89,8 @@ public final strictfp class CopyTransfor
*/
@Test
public void test3D() throws TransformException {
- transform = new CopyTransform(3, 2, 1, 0);
- validate();
- verifyIsIdentity(false);
+ create(3, 2, 1, 0);
+ assertIsNotIdentity(transform);
final double[] source = generateRandomCoordinates();
final double[] target = new double[source.length];
@@ -102,10 +112,9 @@ public final strictfp class CopyTransfor
*/
@Test
public void test3Dto2D() throws TransformException {
- transform = new CopyTransform(3, 0, 1);
isInverseTransformSupported = false;
- validate();
- verifyIsIdentity(false);
+ create(3, 0, 1);
+ assertIsNotIdentity(transform);
final double[] source = generateRandomCoordinates();
final double[] target = new double[source.length * 2/3];
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -22,13 +22,14 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.Projection;
import org.opengis.referencing.operation.SingleOperation;
import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.MathTransformFactory;
import org.apache.sis.internal.referencing.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Mercator1SP;
+import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
import static org.opengis.test.Assert.*;
@@ -50,24 +51,16 @@ import static org.opengis.test.Assert.*;
})
public final strictfp class DefaultMathTransformFactoryTest extends TestCase {
/**
- * The factory being tested.
- */
- private static DefaultMathTransformFactory factory;
-
- /**
- * Creates the factory to be tested.
- */
- @BeforeClass
- public static void createFactory() {
- factory = new DefaultMathTransformFactory();
- }
-
- /**
- * Releases the factory used for the tests.
+ * Returns the factory to use for the tests.
+ *
+ * @return The factory to use for the tests.
*/
- @AfterClass
- public static void releaseFactory() {
- factory = null;
+ static DefaultMathTransformFactory factory() {
+ final MathTransformFactory factory = DefaultFactories.forClass(MathTransformFactory.class);
+ assertNotNull("No Apache SIS implementation of MathTransformFactory found in “META-INF/services”.", factory);
+ assertEquals("Expected the default implementation of MathTransformFactory to be first in “META-INF/services”.",
+ DefaultMathTransformFactory.class, factory.getClass());
+ return (DefaultMathTransformFactory) factory;
}
/**
@@ -77,12 +70,17 @@ public final strictfp class DefaultMathT
*/
@Test
public void testGetOperationMethod() throws NoSuchIdentifierException {
- // A conversion which is not a projection.
- OperationMethod method = factory.getOperationMethod(Constants.AFFINE);
- assertInstanceOf("Affine", Affine.class, method);
-
- // Same than above, using EPSG code.
- assertSame("EPSG:9624", method, factory.getOperationMethod("EPSG:9624"));
+ final DefaultMathTransformFactory factory = factory();
+ final OperationMethod affine = factory.getOperationMethod(Constants.AFFINE);
+ final OperationMethod mercator = factory.getOperationMethod("Mercator (variant A)");
+
+ assertInstanceOf("Affine", Affine.class, affine);
+ assertInstanceOf("Mercator (variant A)", Mercator1SP.class, mercator);
+
+ // Same than above, using EPSG code and alias.
+ assertSame("EPSG:9624", affine, factory.getOperationMethod("EPSG:9624"));
+ assertSame("EPSG:9804", mercator, factory.getOperationMethod("EPSG:9804"));
+ assertSame("Mercator_1SP", mercator, factory.getOperationMethod("Mercator_1SP"));
}
/**
@@ -91,6 +89,7 @@ public final strictfp class DefaultMathT
@Test
@DependsOnMethod("testGetOperationMethod")
public void testNonExistentCode() {
+ final DefaultMathTransformFactory factory = factory();
try {
factory.getOperationMethod("EPXX:9624");
fail("Expected NoSuchIdentifierException");
@@ -108,6 +107,7 @@ public final strictfp class DefaultMathT
@Test
@DependsOnMethod("testGetOperationMethod")
public void testGetAvailableMethods() throws NoSuchIdentifierException {
+ final DefaultMathTransformFactory factory = factory();
final Set<OperationMethod> transforms = factory.getAvailableMethods(SingleOperation.class);
final Set<OperationMethod> conversions = factory.getAvailableMethods(Conversion.class);
final Set<OperationMethod> projections = factory.getAvailableMethods(Projection.class);
@@ -116,7 +116,7 @@ public final strictfp class DefaultMathT
*/
assertFalse(transforms .isEmpty());
assertFalse(conversions.isEmpty());
- assertTrue (projections.isEmpty());
+ assertFalse(projections.isEmpty());
assertTrue (conversions.contains(factory.getOperationMethod(Constants.AFFINE)));
/*
* Following tests will force instantiation of all remaining OperationMethod.
@@ -124,4 +124,28 @@ public final strictfp class DefaultMathT
assertTrue("Conversions should be a subset of transforms.", transforms .containsAll(conversions));
assertTrue("Projections should be a subset of conversions.", conversions.containsAll(projections));
}
+
+ /**
+ * Asks for names which are known to be duplicated. One of the duplicated elements is deprecated.
+ * However Apache SIS uses the same implementation.
+ *
+ * @throws NoSuchIdentifierException Should never happen.
+ */
+ @Test
+ @org.junit.Ignore("Pending port of Equidistant Cylindrical")
+ public void testDuplicatedNames() throws NoSuchIdentifierException {
+ final DefaultMathTransformFactory factory = factory();
+ final OperationMethod ellipsoidal = factory.getOperationMethod("EPSG:1028");
+ final OperationMethod spherical = factory.getOperationMethod("EPSG:1029");
+ final OperationMethod deprecated = factory.getOperationMethod("EPSG:9823");
+ assertSame(spherical, factory.getOperationMethod("Equidistant Cylindrical (Spherical)"));
+ assertSame("EPSG:1028 and 1029 are implemented by the same class.", ellipsoidal, spherical);
+ assertSame("Should share the non-deprecated implementation.", ellipsoidal, deprecated);
+
+// assertFalse(isDeprecated(ellipsoidal, "Equidistant Cylindrical"));
+// assertFalse(isDeprecated(spherical, "Equidistant Cylindrical (Spherical)"));
+
+ assertSame(spherical, factory.getOperationMethod("Equidistant Cylindrical (Spherical)"));
+ assertSame(ellipsoidal, factory.getOperationMethod("Equidistant Cylindrical"));
+ }
}
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=1670485&r1=1670484&r2=1670485&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] Tue Mar 31 21:30:06 2015
@@ -25,7 +25,7 @@ import static java.lang.StrictMath.*;
import org.junit.Test;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
// Branch-dependent imports
import org.opengis.test.CalculationType;
@@ -87,7 +87,7 @@ public final strictfp class ExponentialT
final boolean preAffine, final boolean postAffine) throws TransformException
{
assertInstanceOf("Expected the use of mathematical identities.", expectedType, transform);
- assertFalse(transform.isIdentity());
+ assertIsNotIdentity(transform);
validate();
final double[] values = generateRandomCoordinates(CoordinateDomain.RANGE_10, 0);
@@ -168,12 +168,9 @@ public final strictfp class ExponentialT
*/
@Test
public void testSingle() throws TransformException {
- 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);
+ testSingle( 10, 1); // Exponential transform in base 10
+ testSingle( E, 1); // Exponential transform in base E
+ testSingle(8.4, 1); // Exponential transform in base 8.4 (arbitrary base)
}
/**
@@ -184,12 +181,9 @@ public final strictfp class ExponentialT
@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);
+ testSingle( 10, SCALE); // Exponential transform in base 10
+ testSingle( E, SCALE); // Exponential transform in base E
+ testSingle(8.4, SCALE); // Exponential transform in base 8.4 (arbitrary base)
}
/**
@@ -202,12 +196,9 @@ public final strictfp class ExponentialT
@Test
@DependsOnMethod("testSingleWithScale")
public void testAffinePreConcatenation() throws TransformException {
- 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);
+ testAffinePreConcatenation( 10); // Affine + exponential transform in base 10
+ testAffinePreConcatenation( E); // Affine + exponential transform in base E
+ testAffinePreConcatenation(8.4); // Affine + exponential transform in base 8.4 (arbitrary base)
}
/**
@@ -218,12 +209,9 @@ public final strictfp class ExponentialT
@Test
@DependsOnMethod("testSingleWithScale")
public void testAffinePostConcatenation() throws TransformException {
- 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);
+ testAffinePostConcatenation( 10); // Exponential transform in base 10 + affine
+ testAffinePostConcatenation( E); // Exponential transform in base E + affine
+ testAffinePostConcatenation(8.4); // Exponential transform in base 8.4 + affine (arbitrary base)
}
/**
@@ -237,11 +225,8 @@ public final strictfp class ExponentialT
"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);
+ testAffineConcatenations( 10); // Affine + exponential transform in base 10 + affine
+ testAffineConcatenations( E); // Affine + exponential transform in base E + affine
+ testAffineConcatenations(8.4); // Affine + exponential transform in base 8.4 + affine (arbitrary base)
}
}
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1DTest.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1DTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LogarithmicTransform1DTest.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -24,7 +24,7 @@ import static java.lang.StrictMath.*;
import org.junit.Test;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.DependsOnMethod;
-import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.ReferencingAssert.*;
// Branch-dependent imports
import org.opengis.test.ToleranceModifier;
@@ -36,7 +36,7 @@ import org.opengis.test.ToleranceModifie
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*/
@DependsOn(ExponentialTransform1DTest.class)
@@ -76,7 +76,7 @@ public final strictfp class LogarithmicT
final boolean preAffine, final boolean postAffine) throws TransformException
{
assertInstanceOf("Expected the use of mathematical identities.", expectedType, transform);
- assertFalse(transform.isIdentity());
+ assertIsNotIdentity(transform);
validate();
final double[] values = generateRandomCoordinates(CoordinateDomain.RANGE_10, 0);
@@ -142,12 +142,9 @@ public final strictfp class LogarithmicT
*/
@Test
public void testSingle() throws TransformException {
- messageOnFailure = "Logarithmic transform in base 10";
- testSingle(10, 0, LogarithmicTransform1D.class);
- messageOnFailure = "Logarithmic transform in base E";
- testSingle(E, 0, LogarithmicTransform1D.class);
- messageOnFailure = "Logarithmic transform in base 8.4"; // Arbitrary base.
- testSingle(8.4, 0, ConcatenatedTransformDirect1D.class);
+ testSingle( 10, 0, LogarithmicTransform1D.class); // Logarithmic transform in base 10
+ testSingle( E, 0, LogarithmicTransform1D.class); // Logarithmic transform in base E
+ testSingle(8.4, 0, ConcatenatedTransformDirect1D.class); // Logarithmic transform in base 8.4 (arbitrary base)
}
/**
@@ -158,12 +155,9 @@ public final strictfp class LogarithmicT
@Test
@DependsOnMethod("testSingle")
public void testSingleWithOffset() throws TransformException {
- messageOnFailure = "Logarithmic transform in base 10";
- testSingle(10, 0.25, LogarithmicTransform1D.class);
- messageOnFailure = "Logarithmic transform in base E";
- testSingle(E, 0.25, ConcatenatedTransformDirect1D.class);
- messageOnFailure = "Logarithmic transform in base 8.4"; // Arbitrary base.
- testSingle(8.4, 0.25, ConcatenatedTransformDirect1D.class);
+ testSingle( 10, 0.25, LogarithmicTransform1D.class); // Logarithmic transform in base 10
+ testSingle( E, 0.25, ConcatenatedTransformDirect1D.class); // Logarithmic transform in base E
+ testSingle(8.4, 0.25, ConcatenatedTransformDirect1D.class); // Logarithmic transform in base 8.4 (arbitrary base)
}
/**
@@ -174,12 +168,9 @@ public final strictfp class LogarithmicT
@Test
@DependsOnMethod("testSingleWithOffset")
public void testAffinePreConcatenation() throws TransformException {
- messageOnFailure = "Affine + logarithmic transform in base 10";
- testAffinePreConcatenation(10);
- messageOnFailure = "Affine + logarithmic transform in base E";
- testAffinePreConcatenation(E);
- messageOnFailure = "Affine + logarithmic transform in base 8.4"; // Arbitrary base.
- testAffinePreConcatenation(8.4);
+ testAffinePreConcatenation(10); // Affine + logarithmic transform in base 10
+ testAffinePreConcatenation(E); // Affine + logarithmic transform in base E
+ testAffinePreConcatenation(8.4); // Affine + logarithmic transform in base 8.4 (arbitrary base)
}
/**
@@ -190,12 +181,9 @@ public final strictfp class LogarithmicT
@Test
@DependsOnMethod("testSingleWithOffset")
public void testAffinePostConcatenation() throws TransformException {
- messageOnFailure = "Logarithmic transform in base 10 + affine";
- testAffinePostConcatenation(10);
- messageOnFailure = "Logarithmic transform in base E + affine";
- testAffinePostConcatenation(E);
- messageOnFailure = "Logarithmic transform in base 8.4 + affine"; // Arbitrary base.
- testAffinePostConcatenation(8.4);
+ testAffinePostConcatenation(10); // Logarithmic transform in base 10 + affine
+ testAffinePostConcatenation(E); // Logarithmic transform in base E + affine
+ testAffinePostConcatenation(8.4); // Logarithmic transform in base 8.4 + affine (arbitrary base)
}
/**
@@ -209,12 +197,9 @@ public final strictfp class LogarithmicT
"testAffinePostConcatenation"
})
public void testAffineConcatenations() throws TransformException {
- messageOnFailure = "Affine + logarithmic transform in base 10 + affine";
- testAffineConcatenations(10);
- messageOnFailure = "Affine + logarithmic transform in base E + affine";
- testAffineConcatenations(E);
- messageOnFailure = "Affine + logarithmic transform in base 8.4 + affine"; // Arbitrary base.
- testAffineConcatenations(8.4);
+ testAffineConcatenations(10); // Affine + logarithmic transform in base 10 + affine
+ testAffineConcatenations(E); // Affine + logarithmic transform in base E + affine
+ testAffineConcatenations(8.4); // Affine + logarithmic transform in base 8.4 + affine
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -18,7 +18,7 @@ package org.apache.sis.referencing.opera
import java.util.Random;
import java.io.IOException;
-import org.opengis.referencing.operation.Matrix;
+import org.opengis.util.Factory;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransform1D;
import org.opengis.referencing.operation.MathTransform2D;
@@ -28,6 +28,7 @@ import org.opengis.parameter.ParameterVa
import org.opengis.geometry.DirectPosition;
import org.opengis.metadata.Identifier;
import org.apache.sis.parameter.Parameterized;
+import org.apache.sis.measure.Longitude;
import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
import org.apache.sis.io.TableAppender;
@@ -40,21 +41,38 @@ import static java.lang.StrictMath.*;
import org.opengis.test.Validators;
import org.opengis.test.referencing.TransformTestCase;
import org.apache.sis.test.TestUtilities;
-import static org.apache.sis.test.ReferencingAssert.*;
+import org.apache.sis.test.ReferencingAssert;
+import static org.opengis.test.Assert.*;
// Branch-dependent imports
import org.opengis.test.CalculationType;
import org.opengis.test.ToleranceModifier;
-import org.apache.sis.internal.jdk7.JDK7;
/**
* Base class for tests of {@link AbstractMathTransform} implementations.
- * This base class inherits the convenience methods defined in GeoAPI and adds a few {@code verifyFoo} methods.
+ * This base class provides the following methods, some of them inherited from GeoAPI:
+ *
+ * <p>Various assertion methods:</p>
+ * <ul>
+ * <li>{@link #assertCoordinateEquals assertCoordinateEquals(…)} — from GeoAPI</li>
+ * <li>{@link #assertMatrixEquals assertMatrixEquals(…)} — from GeoAPI</li>
+ * <li>{@link #assertParameterEquals assertParameterEquals(…)} — from Apache SIS</li>
+ * <li>{@link #assertWktEquals assertWktEquals(…)} — from Apache SIS</li>
+ * </ul>
+ *
+ * <p>Various test methods:</p>
+ * <ul>
+ * <li>{@link #verifyConsistency(float...)} — from GeoAPI</li>
+ * <li>{@link #verifyInverse(double...)} — from GeoAPI</li>
+ * <li>{@link #verifyDerivative(double...)} — from GeoAPI</li>
+ * <li>{@link #verifyInDomain verifyInDomain(…)} — from GeoAPI</li>
+ * <li>{@link #verifyTransform(double[], double[])} — from GeoAPI and Apache SIS</li>
+ * </ul>
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.5
- * @version 0.5
+ * @version 0.6
* @module
*/
public abstract strictfp class MathTransformTestCase extends TransformTestCase {
@@ -92,16 +110,21 @@ public abstract strictfp class MathTrans
protected double zTolerance;
/**
- * An optional message to pre-concatenate to the error message if one of the {@code assert}
- * methods fail. This field shall contain information about the test configuration that may
- * be useful in determining the cause of a test failure.
+ * Creates a new test case.
*/
- protected String messageOnFailure;
+ protected MathTransformTestCase() {
+ this(NO_FACTORY);
+ }
/**
- * Creates a new test case.
+ * Creates a new test case which will use the given factories. Those factories will be given to
+ * {@link org.opengis.test.ImplementationDetails#configuration(Factory[])} in order to decide
+ * which tests should be enabled.
+ *
+ * @param factories The factories to be used by the test.
*/
- protected MathTransformTestCase() {
+ protected MathTransformTestCase(final Factory... factories) {
+ super(factories);
/*
* Use 'zTolerance' threshold instead of 'tolerance' when comparing vertical coordinate values.
*/
@@ -123,7 +146,7 @@ public abstract strictfp class MathTrans
* given comparison mode, or -1 if none.
*/
@SuppressWarnings("fallthrough")
- static int forComparison(final int[] config, final CalculationType mode) {
+ private static int forComparison(final int[] config, final CalculationType mode) {
if (config != null) {
switch (mode) {
case INVERSE_TRANSFORM: if (config.length >= 2) return config[1]; // Intentional fallthrough.
@@ -134,7 +157,7 @@ public abstract strictfp class MathTrans
}
/**
- * Invoked by all {@code assertCoordinateEqual(…)} methods before two positions are compared.
+ * Invoked by all {@code assertCoordinateEquals(…)} methods before two positions are compared.
* The SIS implementation ensures that longitude values are contained in the ±180° range,
* applying 360° shifts if needed.
*
@@ -147,9 +170,8 @@ public abstract strictfp class MathTrans
protected final void normalize(final DirectPosition expected, final DirectPosition actual, final CalculationType mode) {
final int i = forComparison(λDimension, mode);
if (i >= 0) {
- double e;
- e = expected.getOrdinate(i); e -= 360*floor(e/360); expected.setOrdinate(i, e);
- e = actual.getOrdinate(i); e -= 360*floor(e/360); actual.setOrdinate(i, e);
+ expected.setOrdinate(i, Longitude.normalize(expected.getOrdinate(i)));
+ actual .setOrdinate(i, Longitude.normalize(actual .getOrdinate(i)));
}
}
@@ -177,18 +199,6 @@ public abstract strictfp class MathTrans
}
/**
- * Completes the error message by pre-concatenating {@link #messageOnFailure} if non-null.
- */
- private String completeMessage(final String message) {
- if (messageOnFailure == null) {
- return message;
- }
- final String lineSeparator = JDK7.lineSeparator();
- // Note: JUnit message will begin with a space.
- return messageOnFailure + lineSeparator + message + lineSeparator + "JUnit message:";
- }
-
- /**
* Validates the current {@linkplain #transform transform}. This method verifies that
* the transform implements {@link MathTransform1D} or {@link MathTransform2D} if the
* transform dimension suggests that it should. In addition, all Apache SIS transforms
@@ -201,51 +211,13 @@ public abstract strictfp class MathTrans
Validators.validate(transform);
final int dimension = transform.getSourceDimensions();
if (transform.getTargetDimensions() == dimension) {
- assertEquals(completeMessage("MathTransform1D"), dimension == 1, (transform instanceof MathTransform1D));
- assertEquals(completeMessage("MathTransform2D"), dimension == 2, (transform instanceof MathTransform2D));
+ assertEquals("transform instanceof MathTransform1D:", (transform instanceof MathTransform1D), dimension == 1);
+ assertEquals("transform instanceof MathTransform2D:", (transform instanceof MathTransform2D), dimension == 2);
} else {
- assertFalse(completeMessage("MathTransform1D"), transform instanceof MathTransform1D);
- assertFalse(completeMessage("MathTransform2D"), transform instanceof MathTransform2D);
- }
- assertInstanceOf(completeMessage("Parameterized"), Parameterized.class, transform);
- }
-
- /**
- * Asserts that the parameters of current {@linkplain #transform transform} are equal to the given ones.
- * This method can check the descriptor separately, for easier isolation of mismatch in case of failure.
- *
- * @param descriptor
- * The expected parameter descriptor, or {@code null} for bypassing this check.
- * The descriptor is required to be strictly the same instance, since Apache SIS
- * implementation returns constant values.
- * @param values
- * The expected parameter values, or {@code null} for bypassing this check.
- * Floating points values are compared in the units of the expected value,
- * tolerating a difference up to the {@linkplain #tolerance(double) tolerance threshold}.
- */
- protected final void verifyParameters(final ParameterDescriptorGroup descriptor, final ParameterValueGroup values) {
- assertInstanceOf(completeMessage("TransformTestCase.transform"), Parameterized.class, transform);
- if (descriptor != null) {
- assertSame("ParameterDescriptor", descriptor, ((Parameterized) transform).getParameterDescriptors());
- }
- if (values != null) {
- assertSame(descriptor, values.getDescriptor());
- assertParameterEquals(values, ((Parameterized) transform).getParameterValues(), tolerance);
- }
- }
-
- /**
- * Verifies if {@link MathTransform#isIdentity()} on the current {@linkplain #transform transform}.
- * If the current transform is linear, then this method will also verifies {@link Matrix#isIdentity()}.
- *
- * @param expected The expected return value of {@code isIdentit()} methods.
- */
- protected final void verifyIsIdentity(final boolean expected) {
- assertEquals(completeMessage("isIdentity()"), expected, transform.isIdentity());
- if (transform instanceof LinearTransform) {
- assertEquals(completeMessage("getMatrix().isIdentity()"), expected,
- ((LinearTransform) transform).getMatrix().isIdentity());
+ assertFalse("transform instanceof MathTransform1D:", transform instanceof MathTransform1D);
+ assertFalse("transform instanceof MathTransform2D:", transform instanceof MathTransform2D);
}
+ assertInstanceOf("The transform does not implement all expected interfaces.", Parameterized.class, transform);
}
/**
@@ -276,9 +248,8 @@ public abstract strictfp class MathTrans
*/
final float[] asFloats = Numerics.copyAsFloats(coordinates);
final float[] result = verifyConsistency(asFloats);
- final String message = completeMessage("Detected change in source coordinates.");
for (int i=0; i<coordinates.length; i++) {
- assertEquals(message, (float) coordinates[i], asFloats[i], 0f); // Paranoiac check.
+ assertEquals("Detected change in source coordinates.", (float) coordinates[i], asFloats[i], 0f); // Paranoiac check.
}
/*
* The comparison below needs a higher tolerance threshold, because we converted the source
@@ -301,14 +272,55 @@ public abstract strictfp class MathTrans
}
/**
+ * Stress the current {@linkplain #transform transform} using random ordinates in the given domain.
+ * First, this method creates a grid of regularly spaced points along all dimensions in the given domain.
+ * Next, this method adds small random displacements to every points and shuffle the coordinates in random order.
+ * Finally this method delegates the resulting array of coordinates to the following methods:
+ *
+ * <ul>
+ * <li>{@link #verifyConsistency(float[])}</li>
+ * <li>{@link #verifyInverse(float[])}</li>
+ * <li>{@link #verifyDerivative(double[])}</li>
+ * </ul>
+ *
+ * This method does not {@linkplain #validate() validate} the transform; it is caller responsibility
+ * to validate if desired.
+ *
+ * @param domain The domain of the numbers to be generated.
+ * @param randomSeed The seed for the random number generator, or 0 for choosing a random seed.
+ * @throws TransformException If a conversion, transformation or derivative failed.
+ *
+ * @since 0.6
+ */
+ @SuppressWarnings("fallthrough")
+ protected final void verifyInDomain(final CoordinateDomain domain, final long randomSeed) throws TransformException {
+ final int dimension = transform.getSourceDimensions();
+ final double[] minOrdinates = new double[dimension];
+ final double[] maxOrdinates = new double[dimension];
+ final int[] numOrdinates = new int [dimension];
+ switch (dimension) {
+ default: throw new UnsupportedOperationException("Too many dimensions.");
+ case 3: minOrdinates[2] = domain.zmin; maxOrdinates[2] = domain.zmax; numOrdinates[2] = 3; // Fall through
+ case 2: minOrdinates[1] = domain.ymin; maxOrdinates[1] = domain.ymax; numOrdinates[1] = 8; // Fall through
+ case 1: minOrdinates[0] = domain.xmin; maxOrdinates[0] = domain.xmax; numOrdinates[0] = 8; // Fall through
+ case 0: break;
+ }
+ final Random random = (randomSeed == 0)
+ ? TestUtilities.createRandomNumberGenerator()
+ : TestUtilities.createRandomNumberGenerator(randomSeed);
+
+ verifyInDomain(minOrdinates, maxOrdinates, numOrdinates, random);
+ }
+
+ /**
* Generates random numbers that can be used for the current transform.
*
* @param domain The domain of the numbers to be generated.
* @param propNaN Approximative percentage of NaN values as a fraction between 0 and 1, or 0 if none.
* @return Random coordinates in the given domain.
*/
- protected final double[] generateRandomCoordinates(final CoordinateDomain domain, final float propNaN) {
- assertNotNull("Transform field must be assigned a value.", transform);
+ final double[] generateRandomCoordinates(final CoordinateDomain domain, final float propNaN) {
+ assertNotNull("The 'transform' field shall be assigned a value.", transform);
final int dimension = transform.getSourceDimensions();
final int numPts = ORDINATE_COUNT / dimension;
final Random random = TestUtilities.createRandomNumberGenerator();
@@ -320,16 +332,41 @@ public abstract strictfp class MathTrans
}
/**
+ * Asserts that the parameters of current {@linkplain #transform transform} are equal to the given ones.
+ * This method can check the descriptor separately, for easier isolation of mismatch in case of failure.
+ *
+ * @param descriptor
+ * The expected parameter descriptor, or {@code null} for bypassing this check.
+ * The descriptor is required to be strictly the same instance, since Apache SIS
+ * implementation returns constant values.
+ * @param values
+ * The expected parameter values, or {@code null} for bypassing this check.
+ * Floating points values are compared in the units of the expected value,
+ * tolerating a difference up to the {@linkplain #tolerance(double) tolerance threshold}.
+ */
+ protected final void assertParameterEquals(final ParameterDescriptorGroup descriptor, final ParameterValueGroup values) {
+ assertInstanceOf("The transform does not implement all expected interfaces.", Parameterized.class, transform);
+ if (descriptor != null) {
+ assertSame("transform.getParameterDescriptors():", descriptor,
+ ((Parameterized) transform).getParameterDescriptors());
+ }
+ if (values != null) {
+ assertSame(descriptor, values.getDescriptor());
+ ReferencingAssert.assertParameterEquals(values,
+ ((Parameterized) transform).getParameterValues(), tolerance);
+ }
+ }
+
+ /**
* Asserts that the current {@linkplain #transform transform} produces the given WKT.
*
* @param expected The expected WKT.
*
* @see #printInternalWKT()
*/
- protected final void verifyWKT(final String expected) {
- assertNotNull("Transform field must be assigned a value.", transform);
- assertEquals("WKT comparison with tolerance not yet implemented.", 0.0, tolerance, 0.0);
- assertWktEquals(Convention.WKT1, expected, transform);
+ protected final void assertWktEquals(final String expected) {
+ assertNotNull("The 'transform' field shall be assigned a value.", transform);
+ ReferencingAssert.assertWktEquals(Convention.WKT1, expected, transform);
}
/**
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -29,6 +29,7 @@ import org.opengis.parameter.ParameterVa
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.operation.Matrix;
+import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.RangeMeaning;
@@ -37,6 +38,7 @@ import org.apache.sis.geometry.AbstractE
import org.apache.sis.geometry.GeneralDirectPosition;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.referencing.operation.transform.LinearTransform;
import org.apache.sis.util.iso.DefaultNameSpace;
import static java.lang.StrictMath.*;
@@ -77,7 +79,7 @@ public strictfp class ReferencingAssert
public static void assertOgcIdentifierEquals(final String expected, final Identifier actual) {
assertNotNull(actual);
assertSame("Authority", Citations.OGC, actual.getAuthority());
- Assert.assertIdentifierEquals(null, "OGC", "OGC", null, expected, actual);
+ assertIdentifierEquals(null, "OGC", "OGC", null, expected, actual);
}
/**
@@ -390,4 +392,34 @@ public strictfp class ReferencingAssert
assertFalse("e1.contains(" + pos + ')', e1.contains(pos));
}
}
+
+ /**
+ * Tests if the given transform is the identity transform.
+ * If the current transform is linear, then this method will also verifies {@link Matrix#isIdentity()}.
+ *
+ * @param transform The transform to test.
+ *
+ * @since 0.6
+ */
+ public static void assertIsIdentity(final MathTransform transform) {
+ assertTrue("isIdentity()", transform.isIdentity());
+ if (transform instanceof LinearTransform) {
+ assertTrue("getMatrix().isIdentity()", ((LinearTransform) transform).getMatrix().isIdentity());
+ }
+ }
+
+ /**
+ * Tests if the given transform is <strong>not</strong> the identity transform.
+ * If the current transform is linear, then this method will also verifies {@link Matrix#isIdentity()}.
+ *
+ * @param transform The transform to test.
+ *
+ * @since 0.6
+ */
+ public static void assertIsNotIdentity(final MathTransform transform) {
+ assertFalse("isIdentity()", transform.isIdentity());
+ if (transform instanceof LinearTransform) {
+ assertFalse("getMatrix().isIdentity()", ((LinearTransform) transform).getMatrix().isIdentity());
+ }
+ }
}
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=1670485&r1=1670484&r2=1670485&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] Tue Mar 31 21:30:06 2015
@@ -25,6 +25,7 @@ import org.opengis.metadata.extent.Exten
import org.opengis.referencing.datum.Ellipsoid;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.datum.PrimeMeridian;
+import org.apache.sis.internal.metadata.ReferencingServices;
/**
@@ -69,7 +70,8 @@ public final strictfp class GeodeticDatu
/**
* The sphere based on the GRS 1980 Authalic sphere.
*/
- public static final GeodeticDatum SPHERE = new GeodeticDatumMock("SPHERE", 6371007, 6371007, Double.POSITIVE_INFINITY, false);
+ public static final GeodeticDatum SPHERE = new GeodeticDatumMock("SPHERE", ReferencingServices.AUTHALIC_RADIUS,
+ ReferencingServices.AUTHALIC_RADIUS, Double.POSITIVE_INFINITY, false);
/**
* The equatorial radius.
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=1670485&r1=1670484&r2=1670485&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] Tue Mar 31 21:30:06 2015
@@ -32,8 +32,21 @@ import org.junit.BeforeClass;
@Suite.SuiteClasses({
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.VerticalDatumTypesTest.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,
+
+ // Identification of objects, needed by large parts of sis-referencing.
+ org.apache.sis.referencing.NamedIdentifierTest.class,
+ org.apache.sis.referencing.IdentifiedObjectsTest.class,
+ org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
+ org.apache.sis.referencing.AbstractReferenceSystemTest.class,
+ org.apache.sis.referencing.BuilderTest.class,
- // Test matrix early because they may be used in about every SIS corners.
+ // Test matrices 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,
@@ -43,34 +56,13 @@ import org.junit.BeforeClass;
org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class, // Expected to be last MatrixTestCase - see javadoc.
org.apache.sis.referencing.operation.matrix.MatricesTest.class,
org.apache.sis.referencing.operation.matrix.AffineTransforms2DTest.class,
- org.apache.sis.referencing.operation.transform.CoordinateDomainTest.class,
- org.apache.sis.referencing.operation.transform.IterationStrategyTest.class,
- org.apache.sis.referencing.operation.transform.AbstractMathTransformTest.class,
- 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.referencing.operation.transform.MathTransformsTest.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,
- org.apache.sis.referencing.NamedIdentifierTest.class,
- org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
- org.apache.sis.referencing.AbstractReferenceSystemTest.class,
- org.apache.sis.referencing.BuilderTest.class,
+ // Parameter are needed for math transforms and map projections.
org.apache.sis.parameter.DefaultParameterDescriptorTest.class,
org.apache.sis.parameter.DefaultParameterDescriptorGroupTest.class,
org.apache.sis.parameter.DefaultParameterValueTest.class,
org.apache.sis.parameter.DefaultParameterValueGroupTest.class,
+ org.apache.sis.parameter.UnmodifiableParameterValueTest.class,
org.apache.sis.parameter.ParametersTest.class,
org.apache.sis.parameter.ParameterBuilderTest.class,
org.apache.sis.parameter.ParameterFormatTest.class,
@@ -80,16 +72,37 @@ import org.junit.BeforeClass;
org.apache.sis.parameter.TensorValuesTest.class,
org.apache.sis.parameter.MapProjectionParametersTest.class,
+ // Test transforms other than map projections.
+ org.apache.sis.referencing.operation.transform.CoordinateDomainTest.class,
+ org.apache.sis.referencing.operation.transform.IterationStrategyTest.class,
+ org.apache.sis.referencing.operation.transform.AbstractMathTransformTest.class,
+ 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.referencing.operation.transform.MathTransformsTest.class,
+ org.apache.sis.referencing.operation.transform.ContextualParametersTest.class,
+
+ // Registration of map projections and other math transforms.
org.apache.sis.referencing.operation.DefaultFormulaTest.class,
org.apache.sis.referencing.operation.DefaultOperationMethodTest.class,
+ org.apache.sis.referencing.operation.transform.OperationMethodSetTest.class,
+ org.apache.sis.internal.referencing.OperationMethodsTest.class,
org.apache.sis.internal.referencing.provider.AffineTest.class,
org.apache.sis.internal.referencing.provider.LongitudeRotationTest.class,
org.apache.sis.internal.referencing.provider.MapProjectionTest.class,
org.apache.sis.internal.referencing.provider.AllProvidersTest.class,
- org.apache.sis.referencing.operation.transform.OperationMethodSetTest.class,
org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class,
- org.apache.sis.internal.referencing.OperationMethodsTest.class,
+ // Test map projections. Those tests need the providers tested above.
+ org.apache.sis.referencing.operation.projection.NormalizedProjectionTest.class,
+ org.apache.sis.referencing.operation.projection.MercatorTest.class,
+
+ // Coordinate Reference System components.
org.apache.sis.referencing.datum.BursaWolfParametersTest.class,
org.apache.sis.referencing.datum.TimeDependentBWPTest.class,
org.apache.sis.referencing.datum.DefaultEllipsoidTest.class,
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/AngleConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -25,7 +25,7 @@ import org.apache.sis.math.FunctionPrope
/**
* Handles conversions between {@link Angle} and {@link Double}.
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This class is immutable and thus inherently thread-safe.
* The same {@link #INSTANCE} can be passed between threads without synchronization.
*
@@ -70,7 +70,7 @@ public final class AngleConverter extend
/**
* The inverse of {@link AngleConverter}.
*
- * {@section Thread safety}
+ * <div class="section">Thread safety</div>
* This class is immutable, and thus inherently thread-safe.
*/
public static final class Inverse extends SystemConverter<Double,Angle> {
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ArrayConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ArrayConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ArrayConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ArrayConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -31,7 +31,7 @@ import org.apache.sis.util.Unconvertible
* the source and target types of the element converter shall be {@code <? super S>} and {@code <? extends T>}
* respectively.
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This class is immutable, and thus inherently thread-safe,
* if the converter given to the constructor is also immutable.
*
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CharSequenceConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -32,7 +32,7 @@ import org.apache.sis.util.Unconvertible
* <p>The main purpose of this class is to support the conversion of
* {@link org.opengis.util.InternationalString}.</p>
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This class is immutable, and thus inherently thread-safe,
* if the converter given to the constructor is also immutable.
*
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ClassPair.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -29,7 +29,7 @@ import org.apache.sis.util.Debug;
* <strong>No other direct subtype shall exist</strong>.
* See {@link #equals(Object)} for an explanation.</p>
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This base class is immutable and thus inherently thread-safe. {@code ClassPair} immutability is necessary
* for {@link ConverterRegistry}. Subclasses should also be immutable, but this requirement is not as strong
* as for {@code ClassPair} (because subclasses are not used as keys in hash map).
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/CollectionConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -28,7 +28,7 @@ import org.apache.sis.math.FunctionPrope
* The source class is fixed to {@code Collection}. The target class is determined
* by the inner class which extends this {@code CollectionConverter} class.
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This base class is immutable, and thus inherently thread-safe. Subclasses should be immutable
* and thread-safe too if they are intended to be cached in {@link ConverterRegistry}.
*
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/ConverterRegistry.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -39,12 +39,12 @@ import org.apache.sis.util.resources.Err
* explicitly {@linkplain #register(ObjectConverter) registered}. However a system-wide registry
* initialized with default converters is provided by the {@link SystemRegistry#INSTANCE} constant.</p>
*
- * {@section Note about conversions from interfaces}
+ * <div class="section">Note about conversions from interfaces</div>
* {@code ConverterRegistry} is primarily designed for handling converters from classes to other classes.
* Handling of interfaces are not prohibited (and actually sometime supported), but their behavior may be
* more ambiguous than in the case of classes because of multi-inheritance in interface hierarchy.
*
- * {@section Thread safety}
+ * <div class="section">Thread safety</div>
* This base class is thread-safe. Subclasses shall make sure that any overridden methods remain safe to call
* from multiple threads.
*
@@ -65,7 +65,7 @@ public class ConverterRegistry {
* then the key and the value may be the same instance (in order to save object
* allocations).</p>
*
- * {@section Synchronization note}
+ * <div class="section">Synchronization note</div>
* Synchronization if performed by {@code synchronized(converters)} statements. We tried
* {@code ReadWriteLock}, but this is not very convenient because read operations may be
* followed by write operations at any time if the requested converter is not in the cache.
@@ -211,7 +211,7 @@ public class ConverterRegistry {
* For example a converter producing {@link Double} can be used for clients that just ask
* for a {@link Number}.</p>
*
- * {@section Which super-classes of the target class are registered}
+ * <div class="section">Which super-classes of the target class are registered</div>
* Consider a converter from class {@code S} to class {@code T} where the two classes
* are related in a hierarchy as below:
*
@@ -234,7 +234,7 @@ public class ConverterRegistry {
* No {@code S} → {@code C2} or {@code S} → {@code C1} converter will be registered,
* because an identity converter would be sufficient for those cases.
*
- * {@section Which sub-classes of the source class are registered}
+ * <div class="section">Which sub-classes of the source class are registered</div>
* Sub-classes of the source class will be registered on a case-by-case basis when the
* {@link #find(Class, Class)} is invoked, because we can not know the set of all
* sub-classes in advance (and would not necessarily want to register all of them anyway).
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/DateConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/DateConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/DateConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/DateConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -26,15 +26,15 @@ import org.apache.sis.math.FunctionPrope
/**
* Handles conversions from {@link Date} to various objects.
*
- * {@section String representation}
+ * <div class="section">String representation</div>
* There is currently no converter between {@link String} and {@link java.util.Date} because the
* date format is not yet defined (we are considering the ISO format for a future SIS version).
*
- * {@section Special cases}
+ * <div class="section">Special cases</div>
* The converter from dates to timestamps is not injective, because the same date could be mapped
* to many timestamps since timestamps have an additional nanoseconds field.
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This base class and all inner classes are immutable, and thus inherently thread-safe.
*
* @author Martin Desruisseaux (Geomatys)
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java?rev=1670485&r1=1670484&r2=1670485&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/FallbackConverter.java [UTF-8] Tue Mar 31 21:30:06 2015
@@ -47,7 +47,7 @@ import org.apache.sis.util.Debug;
* It is invoked when a new converter is {@linkplain ConverterRegistry#register(ObjectConverter)
* registered} for the same source and target class than an existing converter.</p>
*
- * {@section Immutability and thread safety}
+ * <div class="section">Immutability and thread safety</div>
* This class is immutable, and thus inherently thread-safe,
* if the converters given to the static factory method are also immutable.
*