/** * Returns the source CRS, which must be geographic or {@code null}. */ @Override public final GeographicCRS getSourceCRS() { return (GeographicCRS) super.getSourceCRS(); }
/** * Returns the source CRS, which must be geographic or {@code null}. */ @Override public final GeographicCRS getSourceCRS() { return (GeographicCRS) super.getSourceCRS(); }
/** * Creates a dummy derived CRS defined by a longitude rotation from Paris to Greenwich prime meridian, * and swapping the axis order. The result is equivalent to {@link HardCodedCRS#WGS84_φλ}, * which of course makes the returned {@code DerivedCRS} totally useless. * Its purpose is only to perform easy tests. */ private static DefaultDerivedCRS createLongitudeRotation() { final DefaultConversion conversion = DefaultConversionTest.createLongitudeRotation(false); return new DefaultDerivedCRS(Collections.singletonMap(DefaultDerivedCRS.NAME_KEY, conversion.getTargetCRS().getName()), (SingleCRS) conversion.getSourceCRS(), conversion, HardCodedCS.GEODETIC_φλ); }
assertSame(op, op.specialize(Conversion.class, op.getSourceCRS(), op.getTargetCRS(), factory)); op = op.specialize(DefaultConversion.class, op.getSourceCRS(), changeCS(op.getTargetCRS(), HardCodedCS.GEODETIC_φλ), factory); assertMatrixEquals("Longitude rotation of a two-dimensional CRS", Matrices.create(3, 4, new double[] {
assertNull("sourceCRS", definingConversion.getSourceCRS()); assertNull("targetCRS", definingConversion.getTargetCRS()); assertFalse(definingConversion.equals(reference)); changeCS(reference.getSourceCRS(), HardCodedCS.GEODETIC_φλ), reference.getTargetCRS(), DefaultFactories.forBuildin(MathTransformFactory.class));
assertNull("sourceCRS", c.getSourceCRS()); assertNull("targetCRS", c.getTargetCRS()); assertNull("interpolationCRS", c.getInterpolationCRS());
op.getSourceCRS(), // Keep the same source CRS.
/** * Asserts that at least some of the properties of the given {@code op} instance have the expected values * for an instance created by {@link #createLongitudeRotation(GeographicCRS, GeographicCRS, TemporalCRS)}. */ @SuppressWarnings("SuspiciousToArrayCall") private static void verifyProperties(final DefaultConversion op, final boolean swapSourceAxes) { assertEquals("name", "Paris to Greenwich", op.getName().getCode()); assertEquals("sourceCRS", "NTF (Paris)", op.getSourceCRS().getName().getCode()); assertEquals("targetCRS", "Back to Greenwich", op.getTargetCRS().getName().getCode()); assertEquals("method", "Longitude rotation", op.getMethod().getName().getCode()); assertEquals("parameters", "Longitude rotation", op.getParameterDescriptors().getName().getCode()); final ParameterValueGroup parameters = op.getParameterValues(); final ParameterValue<?>[] values = parameters.values().toArray(new ParameterValue<?>[1]); assertEquals("parameters", "Longitude rotation", parameters.getDescriptor().getName().getCode()); assertEquals("parameters[0]", "Longitude offset", values[0].getDescriptor().getName().getCode()); assertEquals("parameters[0]", OFFSET, values[0].doubleValue(), STRICT); assertEquals(1, values.length); final Matrix3 expected = new Matrix3(); expected.m02 = OFFSET; if (swapSourceAxes) { expected.m00 = expected.m11 = 0; expected.m01 = expected.m10 = 1; } assertMatrixEquals("Longitude rotation of a two-dimensional CRS", expected, MathTransforms.getMatrix(op.getMathTransform()), STRICT); }