|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectTestCase
TransformTestCase
ParameterizedTransformTest
public class ParameterizedTransformTest
Tests parameterized math tranforms from the org.opengis.referencing.operation package.
Math transform instances are created using the factory given at construction time.
Tests and accuracy:
By default, every tests expect an accuracy of 1 centimetre. This accuracy matches the precision
of most example points given in the EPSG guidance notice. Implementors can modify the kind of
tests being executed and the tolerance threshold in different ways:
is<Operation>Supported fields to false.testFoo() method and set the tolerance field
before to invoke super.testFoo().normalize(DirectPosition, DirectPosition, CalculationType).assertMatrixEquals(String, Matrix, Matrix, Matrix).Example:
In order to specify their factory and run the tests in a JUnit framework, implementors can define
a subclass as in the example below. That example shows also how implementors can alter some tests
(here the tolerance value for the Lambert Azimuthal Equal Area projection) and add
more checks to be executed after every tests (here ensuring that the transform implements the MathTransform2D interface):
import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.opengis.test.referencing.ParameterizedTransformTest;
import static org.junit.Assert.*;
@RunWith(JUnit4.class)
public class MyTest extends ParameterizedTransformTest {
public MyTest() {
super(new MyMathTransformFactory());
}
@Test
@Override
public void testLambertAzimuthalEqualArea() throws FactoryException, TransformException {
tolerance = 0.1; // Increase the tolerance value to 10 cm.
super.testLambertAzimuthalEqualArea();
// If more tests specific to this projection are wanted, do them here.
// In this example, we replace the ellipsoid by a sphere and test again.
// Note that spherical formulas can have an error up to 30 km compared
// to ellipsoidal formulas, so we have to relax again the tolerance threshold.
parameters.parameter("semi-minor axis").setValue(parameters.parameter("semi-major axis").doubleValue());
tolerance = 30000; // Increase the tolerance value to 30 km.
super.testLambertAzimuthalEqualArea();
}
@After
public void ensureAllTransformAreMath2D() {
assertTrue(transform instanceof MathTransform2D);
}
}
AffineTransformTest,
AuthorityFactoryTest,
TestSuite| Field Summary | |
|---|---|
protected String |
description
A description of the test being run. |
protected MathTransformFactory |
mtFactory
The factory for creating MathTransform objects, or null if none. |
protected ParameterValueGroup |
parameters
The parameters of the math transform being tested. |
| Fields inherited from class TestCase |
|---|
configurationTip, listener, NO_FACTORY, validators |
| Constructor Summary | |
|---|---|
ParameterizedTransformTest(MathTransformFactory factory)
Creates a new test using the given factory. |
|
| Method Summary | |
|---|---|
protected void |
assertMatrixEquals(String message,
Matrix expected,
Matrix actual,
Matrix tolmat)
Asserts that a matrix of derivatives is equals to the expected ones within a positive delta. |
Configuration |
configuration()
Returns information about the configuration of the test which has been run. |
static List<Factory[]> |
factories()
Returns a default set of factories to use for running the tests. |
void |
testAbridgedMolodensky()
Tests the "Abridged Molodensky" (EPSG:9605) datum shift operation. |
void |
testCassiniSoldner()
Tests the "Cassini-Soldner" (EPSG:9806) projection method. |
void |
testHotineObliqueMercator()
Tests the "Hotine Oblique Mercator (variant B)" (EPSG:9815) projection method. |
void |
testKrovak()
Tests the "Krovak" (EPSG:9819) projection. |
void |
testLambertAzimuthalEqualArea()
Tests the "Lambert Azimuthal Equal Area" (EPSG:9820) projection method. |
void |
testLambertConicConformal1SP()
Tests the "Lambert Conic Conformal (1SP)" (EPSG:9801) projection method. |
void |
testLambertConicConformal2SP()
Tests the "Lambert Conic Conformal (2SP)" (EPSG:9802) projection method. |
void |
testLambertConicConformalBelgium()
Tests the "Lambert Conic Conformal (2SP Belgium)" (EPSG:9803) projection method. |
void |
testMercator1SP()
Tests the "Mercator (variant A)" (EPSG:9804) projection method. |
void |
testMercator2SP()
Tests the "Mercator (variant B)" (EPSG:9805) projection method. |
void |
testMiller()
Tests the "IGNF:MILLER" (EPSG:310642901) projection. |
void |
testObliqueStereographic()
Tests the "Oblique Stereographic" (EPSG:9809) projection method. |
void |
testPolarStereographicA()
Tests the "Polar Stereographic (variant A)" (EPSG:9810) projection method. |
void |
testPolarStereographicB()
Tests the "Polar Stereographic (variant B)" (EPSG:9829) projection method. |
void |
testPolyconic()
Tests the "American Polyconic" (EPSG:9818) projection. |
void |
testPseudoMercator()
Tests the "Mercator Popular Visualisation Pseudo Mercator" (EPSG:1024) projection method. |
void |
testTransverseMercator()
Tests the "Transverse Mercator" (EPSG:9807) projection method. |
| Methods inherited from class TestCase |
|---|
addTestListener, factories, factories, getEnabledFlags, removeTestListener |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final MathTransformFactory mtFactory
MathTransform objects, or null if none.
protected ParameterValueGroup parameters
transform field, after the execution of every testFoo() method
in this class.
If this field is non-null before a test is run, then those parameters will be used directly. This allow implementors to alter the parameters before to run the test one more time.
protected String description
ProjectedCRS when the transform
being tested is a map projection
| Constructor Detail |
|---|
public ParameterizedTransformTest(MathTransformFactory factory)
null,
then the tests will be skipped.
factory - Factory for creating MathTransform instances.| Method Detail |
|---|
public static List<Factory[]> factories()
TestCase.factories(Class[]) javadoc.
ParameterizedTransformTest constructor.public Configuration configuration()
Configuration.Key of the same name:
configuration in class TransformTestCaseImplementationDetails.configuration(Factory[])
public void testMercator1SP()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_3002()
public void testMercator2SP()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_3388()
public void testPseudoMercator()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_3857()
public void testMiller()
throws FactoryException,
TransformException
MathTransform result with the expected result. Next, this method
transforms a random set of points in the projection area of validity and ensures that the
inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testIGNF_MILLER()
public void testHotineObliqueMercator()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_29873()
public void testTransverseMercator()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
NOTE: The scale factor given in the EPSG guidance notes is 0.9996013, while the actual value in the EPSG database is 0.9996012717. This tiny difference shifts the expected results by 0.5 cm toward zero compared to the value documented in the EPSG guidance notes. The values used in this GeoAPI test have been adjusted accordingly.
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_27700()
public void testCassiniSoldner()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
1 link = 0.66 feet |
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_2314()
public void testLambertConicConformal1SP()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_24200()
public void testLambertConicConformal2SP()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
1 metre = 3.2808333… US feet |
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_32040()
public void testLambertConicConformalBelgium()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_31300()
public void testLambertAzimuthalEqualArea()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_3035()
public void testPolarStereographicA()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_5041(),
AuthorityFactoryTest.testEPSG_32661()
public void testPolarStereographicB()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_3032()
public void testObliqueStereographic()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_28992()
public void testPolyconic()
throws FactoryException,
TransformException
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.
public void testKrovak()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of points in the projection area of validity
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.AuthorityFactoryTest.testEPSG_2065()
public void testAbridgedMolodensky()
throws FactoryException,
TransformException
MathTransform result with the expected result.
Next, this method transforms a random set of geographic coordinates
and ensures that the inverse transform and the
derivatives are coherent.
The math transform parameters and the sample coordinates are:
|
|
FactoryException - If the math transform can not be created.
TransformException - If the example point can not be transformed.
protected void assertMatrixEquals(String message,
Matrix expected,
Matrix actual,
Matrix tolmat)
throws DerivativeFailure
assertMatrixEquals in class TransformTestCasemessage - The message to print in case of failure.expected - The expected matrix of derivative values, estimated by finite differences.actual - The actual matrix computed by the transform to be tested.tolmat - The tolerance value for each matrix elements, or null for a strict comparison.
DerivativeFailure - If at least one matrix element is not equal to the expected value.TransformTestCase.verifyDerivative(double[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||