/** * Concatenates the two given transforms. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @return the concatenated transform. */ MathTransform concatenate(MathTransform tr1, MathTransform tr2) throws FactoryException { return MathTransforms.concatenate(tr1, tr2); }
/** * Concatenates the given two-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform)} and casting the * result to a {@link MathTransform2D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of the first transform * does not match the input dimension of the second transform. */ public static MathTransform2D concatenate(MathTransform2D tr1, MathTransform2D tr2) throws MismatchedDimensionException { return (MathTransform2D) concatenate((MathTransform) tr1, (MathTransform) tr2); }
/** * Concatenates the three given two-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform, MathTransform)} and * casting the result to a {@link MathTransform2D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @param tr3 the third math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of a transform * does not match the input dimension of next transform. */ public static MathTransform2D concatenate(MathTransform2D tr1, MathTransform2D tr2, MathTransform2D tr3) throws MismatchedDimensionException { return (MathTransform2D) concatenate((MathTransform) tr1, (MathTransform) tr2, (MathTransform) tr3); }
/** * Concatenates the given one-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform)} and casting the * result to a {@link MathTransform1D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of the first transform * does not match the input dimension of the second transform. */ public static MathTransform1D concatenate(MathTransform1D tr1, MathTransform1D tr2) throws MismatchedDimensionException { return (MathTransform1D) concatenate((MathTransform) tr1, (MathTransform) tr2); }
/** * Concatenates the given one-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform)} and casting the * result to a {@link MathTransform1D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of the first transform * does not match the input dimension of the second transform. */ public static MathTransform1D concatenate(MathTransform1D tr1, MathTransform1D tr2) throws MismatchedDimensionException { return (MathTransform1D) concatenate((MathTransform) tr1, (MathTransform) tr2); }
/** * Concatenates the three given two-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform, MathTransform)} and * casting the result to a {@link MathTransform2D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @param tr3 the third math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of a transform * does not match the input dimension of next transform. */ public static MathTransform2D concatenate(MathTransform2D tr1, MathTransform2D tr2, MathTransform2D tr3) throws MismatchedDimensionException { return (MathTransform2D) concatenate((MathTransform) tr1, (MathTransform) tr2, (MathTransform) tr3); }
/** * Concatenates the given two-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform)} and casting the * result to a {@link MathTransform2D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of the first transform * does not match the input dimension of the second transform. */ public static MathTransform2D concatenate(MathTransform2D tr1, MathTransform2D tr2) throws MismatchedDimensionException { return (MathTransform2D) concatenate((MathTransform) tr1, (MathTransform) tr2); }
/** * Concatenates the three given one-dimensional transforms. This is a convenience methods * delegating to {@link #concatenate(MathTransform, MathTransform, MathTransform)} and * casting the result to a {@link MathTransform1D} instance. * * @param tr1 the first math transform. * @param tr2 the second math transform. * @param tr3 the third math transform. * @return the concatenated transform. * @throws MismatchedDimensionException if the output dimension of a transform * does not match the input dimension of next transform. */ public static MathTransform1D concatenate(MathTransform1D tr1, MathTransform1D tr2, MathTransform1D tr3) throws MismatchedDimensionException { return (MathTransform1D) concatenate((MathTransform) tr1, (MathTransform) tr2, (MathTransform) tr3); }
/** * Delegates to {@link MathTransforms}. * * @param transform1 first transform to concatenate. * @param transform2 second transform to concatenate. * @return result of concatenation. */ @Override public MathTransform createConcatenatedTransform(MathTransform transform1, MathTransform transform2) { return MathTransforms.concatenate(transform1, transform2); }
/** * Returns the concatenation of the {@linkplain #projection} with the given affine transform. * * @param at The affine transform to concatenate, or {@code null} if none. */ private MathTransform2D concatenate(final AffineTransform at) { MathTransform2D concatenated = projection; if (at != null && !at.isIdentity()) { concatenated = MathTransforms.concatenate(concatenated, new AffineTransform2D(at)); } return concatenated; }
/** * {@inheritDoc } */ @Override public PathIterator getPathIterator(final AffineTransform at) { final MathTransform concat; if(at == null){ concat = transform; }else{ concat = MathTransforms.concatenate(transform,new AffineTransform2D(at)); } iterator.setTransform(concat); return iterator; }
/** * Transforms the given shape using the given projection, then apply a correction for fitting * the shape in the test viewer. This method also set the {@link #projection} to the resulting * concatenated transform. */ private Shape createReferenceShape(final Shape shape, MathTransform2D tr) throws TransformException { final Path2D path = transform(shape, tr); Rectangle2D bounds = path.getBounds2D(); final AffineTransform adjust = AffineTransform.getTranslateInstance(SHAPE_X, SHAPE_Y); adjust.scale(2*SHAPE_WIDTH / bounds.getWidth(), 2*SHAPE_HEIGHT / bounds.getHeight()); adjust.translate(-bounds.getX(), -bounds.getY()); path.transform(adjust); tr = MathTransforms.concatenate(tr, (MathTransform2D) org.geotoolkit.referencing.operation.MathTransforms.linear(adjust)); projection = tr; return path; }
/** * Implementation of {@link #testAffineConcatenations()} for the given base. */ private void testAffineConcatenations(final double base) throws TransformException { final LinearTransform1D linear = LinearTransform1D.create(C1, C0); transform = MathTransforms.concatenate(linear, ExponentialTransform1D.create(base, SCALE), linear); run(ConcatenatedTransformDirect1D.class, base, SCALE, true, true); }
/** * Implementation of {@link #testAffinePostConcatenation()} for the given base. */ private void testAffinePostConcatenation(final double base) throws TransformException { transform = MathTransforms.concatenate(LogarithmicTransform1D.create(base, OFFSET), LinearTransform1D.create(C1, C0)); run(ConcatenatedTransformDirect1D.class, base, OFFSET, false, true); }
/** * Implementation of {@link #testAffineConcatenations()} for the given base. */ private void testAffineConcatenations(final double base) throws TransformException { final MathTransform1D linear = LinearTransform1D.create(C1, C0); transform = MathTransforms.concatenate(linear, LogarithmicTransform1D.create(base, OFFSET), linear); run(ConcatenatedTransformDirect1D.class, base, OFFSET, true, true); }
/** * Implementation of {@link #testAffinePostConcatenation()} for the given base. */ private void testAffinePostConcatenation(final double base) throws TransformException { transform = MathTransforms.concatenate(ExponentialTransform1D.create(base, SCALE), LinearTransform1D.create(C1, C0)); run(ConcatenatedTransformDirect1D.class, base, SCALE, false, true); }
/** * Implementation of {@link #testAffinePreConcatenation()} for the given base. */ private void testAffinePreConcatenation(final double base) throws TransformException { transform = MathTransforms.concatenate(LinearTransform1D.create(C1, C0), LogarithmicTransform1D.create(base, OFFSET)); run(ConcatenatedTransformDirect1D.class, base, OFFSET, true, false); }
/** * Implementation of {@link #testAffinePreConcatenation()} for the given base. */ private void testAffinePreConcatenation(final double base) throws TransformException { transform = MathTransforms.concatenate(LinearTransform1D.create(C1, C0), ExponentialTransform1D.create(base, SCALE)); run(ExponentialTransform1D.class, base, SCALE, true, false); /* * Find back the original linear coefficients as documented in the ExponentialTransform1D class javadoc. */ final double offset = -log(SCALE) / log(base); final MathTransform1D log = LogarithmicTransform1D.create(base, offset); transform = (LinearTransform1D) MathTransforms.concatenate(transform, log); assertEquals("C1", C1, ((LinearTransform1D) transform).scale, EPS); assertEquals("C0", C0, ((LinearTransform1D) transform).offset, EPS); }
private static DirectPosition toSpherical(final DirectPosition source) throws FactoryException, TransformException { final CoordinateOperation toGeoCentric = CRS.findOperation(source.getCoordinateReferenceSystem(), CommonCRS.WGS84.geocentric(), null); final CoordinateOperation toSpheric = CRS.findOperation(CommonCRS.WGS84.geocentric(), CommonCRS.WGS84.spherical(), null); final DirectPosition spheric = new GeneralDirectPosition(CommonCRS.WGS84.spherical()); return MathTransforms.concatenate(toGeoCentric.getMathTransform(), toSpheric.getMathTransform()).transform(source, spheric); }
/** * Returns the conversion from {@code north} to {@code south}. */ private static Matrix conversion(final ProjectedCRS north, final ProjectedCRS south) throws NoninvertibleTransformException { final MathTransform transform = MathTransforms.concatenate( north.getConversionFromBase().getMathTransform().inverse(), south.getConversionFromBase().getMathTransform()); assertInstanceOf("North to South", LinearTransform.class, transform); return ((LinearTransform) transform).getMatrix(); }