use of org.opengis.referencing.crs.CompoundCRS in project sis by apache.
the class CoordinateOperationFinderTest method testGeographic4D_to_2D.
// ////////////////////////////////////////////////////////////////////////////////
// ////////// ////////////
// ////////// Tests that change the number of dimensions ////////////
// ////////// ////////////
// ////////////////////////////////////////////////////////////////////////////////
/**
* Tests the conversion from a four-dimensional geographic CRS to a two-dimensional geographic CRS.
* The vertical and temporal dimensions are simply dropped.
*
* @throws FactoryException if the operation can not be created.
* @throws TransformException if an error occurred while converting the test points.
*/
@Test
@DependsOnMethod("testGeographic3D_to_2D")
public void testGeographic4D_to_2D() throws FactoryException, TransformException {
// NOTE: make sure that the 'sourceCRS' below is not equal to any other 'sourceCRS' created in this class.
final CompoundCRS sourceCRS = compound("Test4D", CommonCRS.WGS84.geographic3D(), CommonCRS.Temporal.UNIX.crs());
final GeographicCRS targetCRS = CommonCRS.WGS84.geographic();
final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
assertSame("targetCRS", targetCRS, operation.getTargetCRS());
transform = operation.getMathTransform();
assertInstanceOf("transform", LinearTransform.class, transform);
assertEquals("sourceDimensions", 4, transform.getSourceDimensions());
assertEquals("targetDimensions", 2, transform.getTargetDimensions());
Assert.assertMatrixEquals("transform.matrix", Matrices.create(3, 5, new double[] { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 }), ((LinearTransform) transform).getMatrix(), STRICT);
isInverseTransformSupported = false;
verifyTransform(new double[] { 30, 10, 20, 1000, 20, 30, -10, 3000 }, new double[] { 30, 10, 20, 30 });
validate();
}
Aggregations