/** * Sets the parameters to the given values. The given array can have any length. The first array elements will be * assigned to the {@link #tX tX}, {@link #tY tY}, {@link #tZ tZ}, {@link #rX rX}, {@link #rY rY}, {@link #rZ rZ}, * {@link #dS dS}, {@link #dtX}, {@link #dtY}, {@link #dtZ}, {@link #drX}, {@link #drY}, {@link #drZ} and * {@link #ddS} fields in that order. * * @param elements the new parameter values, as an array of any length. * * @since 0.6 */ @Override @SuppressWarnings("fallthrough") public void setValues(final double... elements) { if (elements.length >= 8) { switch (elements.length) { default: ddS = elements[13]; // Fallthrough everywhere. case 13: drZ = elements[12]; case 12: drY = elements[11]; case 11: drX = elements[10]; case 10: dtZ = elements[ 9]; case 9: dtY = elements[ 8]; case 8: dtX = elements[ 7]; } } super.setValues(elements); }
/** * Sets the parameters to the given values. The given array can have any length. The first array elements will be * assigned to the {@link #tX tX}, {@link #tY tY}, {@link #tZ tZ}, {@link #rX rX}, {@link #rY rY}, {@link #rZ rZ}, * {@link #dS dS}, {@link #dtX}, {@link #dtY}, {@link #dtZ}, {@link #drX}, {@link #drY}, {@link #drZ} and * {@link #ddS} fields in that order. * * @param elements the new parameter values, as an array of any length. * * @since 0.6 */ @Override @SuppressWarnings("fallthrough") public void setValues(final double... elements) { if (elements.length >= 8) { switch (elements.length) { default: ddS = elements[13]; // Fallthrough everywhere. case 13: drZ = elements[12]; case 12: drY = elements[11]; case 11: drX = elements[10]; case 10: dtZ = elements[ 9]; case 9: dtY = elements[ 8]; case 8: dtX = elements[ 7]; } } super.setValues(elements); }
/** * Inverts in-place the transformation by inverting the sign of all numerical parameters. * The {@linkplain #getPositionVectorTransformation(Date) position vector transformation} matrix * created from inverted Bursa-Wolf parameters will be <strong>approximately</strong> equals * to the {@linkplain org.apache.sis.referencing.operation.matrix.MatrixSIS#inverse() inverse} * of the matrix created from the original parameters. The equality holds approximately only * because the parameter values are very small (parts per millions and arc-seconds). */ public void invert() { final double[] values = getValues(); for (int i=0; i<values.length; i++) { values[i] = -values[i]; } setValues(values); }
/** * Inverts in-place the transformation by inverting the sign of all numerical parameters. * The {@linkplain #getPositionVectorTransformation(Date) position vector transformation} matrix * created from inverted Bursa-Wolf parameters will be <strong>approximatively</strong> equals * to the {@linkplain org.apache.sis.referencing.operation.matrix.MatrixSIS#inverse() inverse} * of the matrix created from the original parameters. The equality holds approximatively only * because the parameter values are very small (parts per millions and arc-seconds). */ public void invert() { final double[] values = getValues(); for (int i=0; i<values.length; i++) { values[i] = -values[i]; } setValues(values); }
/** * Creates the {@code TOWGS84} element during parsing of a WKT version 1. * * @param values the 7 Bursa-Wolf parameter values. * @return the {@link BursaWolfParameters}. * * @since 0.6 */ @Override public Object createToWGS84(final double[] values) { final BursaWolfParameters info = new BursaWolfParameters(CommonCRS.WGS84.datum(), null); info.setValues(values); return info; }
/** * Creates the {@code TOWGS84} element during parsing of a WKT version 1. * * @param values the 7 Bursa-Wolf parameter values. * @return the {@link BursaWolfParameters}. * * @since 0.6 */ @Override public Object createToWGS84(final double[] values) { final BursaWolfParameters info = new BursaWolfParameters(CommonCRS.WGS84.datum(), null); info.setValues(values); return info; }
/** * 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. }