/** * Tests {@link BursaWolfParameters#getValues()}. */ @Test public void testGetValues() { assertArrayEquals("Translation only", new double[] {-168, -60, 320}, createNTF_to_WGS84().getValues(), STRICT); assertArrayEquals("All 7 params", new double[] {-82.981, -99.719, -110.709, -0.5076, 0.1503, 0.3898, -0.3143}, createED87_to_WGS84().getValues(), STRICT); assertArrayEquals("Mixed", new double[] {0, 0, 4.5, 0, 0, 0.554, 0.219}, createWGS72_to_WGS84().getValues(), STRICT); }
/** * Tests {@link BursaWolfParameters#setValues(double[])}. */ @Test @DependsOnMethod("testGetValues") public void testSetValues() { final BursaWolfParameters actual = createWGS72_to_WGS84(); final BursaWolfParameters expected = createED87_to_WGS84(); final double[] values = expected.getValues(); assertFalse("equals(Object) before to set the values.", actual.equals(expected)); actual.setValues(values); assertArrayEquals("getValues() after setting the values.", values, actual.getValues(), STRICT); // Can not test assertEquals(expected, actual) because of different geographic extent. }
final BursaWolfParameters global = BursaWolfParametersTest.createWGS72_to_WGS84(); // Global area (World) assertNull(properties.put(DefaultGeodeticDatum.BURSA_WOLF_KEY, new BursaWolfParameters[] {local, global}));
/** * Tests {@link BursaWolfParameters#getPositionVectorTransformation(Date)}. * This test transform a point from WGS72 to WGS84, and conversely, * as documented in the example section of EPSG operation method 9606. * * @throws NoninvertibleMatrixException Should never happen. */ @Test public void testGetPositionVectorTransformation() throws NoninvertibleMatrixException { final BursaWolfParameters bursaWolf = createWGS72_to_WGS84(); final MatrixSIS toWGS84 = getPositionVectorTransformation(bursaWolf); final MatrixSIS toWGS72 = toWGS84.inverse(); final MatrixSIS source = Matrices.create(4, 1, new double[] {3657660.66, 255768.55, 5201382.11, 1}); final MatrixSIS target = Matrices.create(4, 1, new double[] {3657660.78, 255778.43, 5201387.75, 1}); assertMatrixEquals("toWGS84", target, toWGS84.multiply(source), 0.01); assertMatrixEquals("toWGS72", source, toWGS72.multiply(target), 0.01); /* * Tests the optimized path for translation-only parameters. * Matrices having only translation terms are much easier to predict. */ assertMatrixEquals("Translation only", new Matrix4( 1, 0, 0, -168, 0, 1, 0, -60, 0, 0, 1, 320, 0, 0, 0, 1), getPositionVectorTransformation(createNTF_to_WGS84()), 0); }