Search in sources :

Example 1 with GeocentricTranslationTest

use of org.apache.sis.internal.referencing.provider.GeocentricTranslationTest in project sis by apache.

the class EllipsoidToCentricTransformTest method testConcatenate.

/**
 * Tests {@link EllipsoidToCentricTransform#tryConcatenate(boolean, MathTransform, MathTransformFactory)}.
 * The test creates <cite>"Geographic 3D to 2D conversion"</cite>, <cite>"Geographic/Geocentric conversions"</cite>
 * and <cite>"Geocentric translation"</cite> transforms, then concatenate them.
 *
 * <p>Because this test involves a lot of steps, this is more an integration test than a unit test:
 * a failure here may not be easy to debug.</p>
 *
 * @throws FactoryException if an error occurred while creating a transform.
 *
 * @see GeocentricTranslationTest#testWKT2D()
 */
@Test
public void testConcatenate() throws FactoryException {
    transform = GeocentricTranslationTest.createDatumShiftForGeographic2D(DefaultFactories.forBuildin(MathTransformFactory.class));
    final Iterator<MathTransform> it = MathTransforms.getSteps(transform).iterator();
    MathTransform step;
    assertInstanceOf("Degrees to radians", LinearTransform.class, step = it.next());
    assertEquals("sourceDimensions", 2, step.getSourceDimensions());
    assertEquals("tourceDimensions", 2, step.getTargetDimensions());
    assertInstanceOf("Ellipsoid to geocentric", EllipsoidToCentricTransform.class, step = it.next());
    assertEquals("sourceDimensions", 2, step.getSourceDimensions());
    assertEquals("tourceDimensions", 3, step.getTargetDimensions());
    assertInstanceOf("Datum shift", LinearTransform.class, step = it.next());
    assertEquals("sourceDimensions", 3, step.getSourceDimensions());
    assertEquals("tourceDimensions", 3, step.getTargetDimensions());
    assertInstanceOf("Geocentric to ellipsoid", AbstractMathTransform.Inverse.class, step = it.next());
    assertEquals("sourceDimensions", 3, step.getSourceDimensions());
    assertEquals("tourceDimensions", 2, step.getTargetDimensions());
    assertInstanceOf("Degrees to radians", LinearTransform.class, step = it.next());
    assertEquals("sourceDimensions", 2, step.getSourceDimensions());
    assertEquals("tourceDimensions", 2, step.getTargetDimensions());
}
Also used : MathTransform(org.opengis.referencing.operation.MathTransform) GeocentricTranslationTest(org.apache.sis.internal.referencing.provider.GeocentricTranslationTest) Test(org.junit.Test)

Aggregations

GeocentricTranslationTest (org.apache.sis.internal.referencing.provider.GeocentricTranslationTest)1 Test (org.junit.Test)1 MathTransform (org.opengis.referencing.operation.MathTransform)1