Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform2D


     * @since 2.6
     */
    public final Envelope2D gridToWorld(final GridEnvelope2D gridEnv)
            throws TransformException {

        MathTransform2D mt = getGridToCRS2D();

        if (getGridRange2D().contains(gridEnv)) {
            GridCoordinates2D low = gridEnv.getLow();
            Point2D trLow = mt.transform(new Point2D.Double(low.x - 0.5, low.y - 0.5), null);

            GridCoordinates2D high = gridEnv.getHigh();
            Point2D trHigh = mt.transform(new Point2D.Double(high.x + 0.5, high.y + 0.5), null);

            return new Envelope2D(
                    new DirectPosition2D(crs2D, trLow.getX(), trLow.getY()),
                    new DirectPosition2D(crs2D, trHigh.getX(), trHigh.getY()));

View Full Code Here


             * coordinate reference systems axis unit.
             */
            double scaleMask1 = 1;
            double scaleMask2 = 1;
            if (sources.length != 0) {
                final MathTransform2D mtr;
                mtr = ((GridGeometry2D) sources[0].getGridGeometry()).getGridToCRS2D();
                if (mtr instanceof AffineTransform) {
                    final AffineTransform tr = (AffineTransform) mtr;
                    final double scaleX = XAffineTransform.getScaleX0(tr);
                    final double scaleY = XAffineTransform.getScaleY0(tr);
View Full Code Here

        }
        if (transforms == null) {
            transforms = new MathTransform2D[WarpTransform2D.MAX_DEGREE + 1];
        }
        if (transforms[degree] == null) {
            final MathTransform2D tr;
            switch (degree) {
                case 0: {
                    // NOTE: 'grid' is not cloned. This GridLocalization's grid will need to be
                    // cloned if a "set" method is invoked after the math transform creation.
                    tr = new LocalizationGridTransform2D(width, height, grid, getAffineTransform());
View Full Code Here

                    renderingEnvelope.getCoordinateReferenceSystem());
            if (targetEnvelope.isEmpty() || targetEnvelope.isNull()) {
                return null;
            }

            MathTransform2D mt = coverages.get(0).getGridGeometry().getCRSToGrid2D();
            Rectangle rasterSpaceEnvelope;
            rasterSpaceEnvelope = CRS.transform(mt, targetEnvelope).toRectangle2D().getBounds();
            GridEnvelope2D gridRange = new GridEnvelope2D(rasterSpaceEnvelope);
            GridGeometry2D gridGeometry = new GridGeometry2D(gridRange, targetEnvelope);
View Full Code Here

       * instead of creating a new identical one.
       */
      if (fallback!=null && fallback!=this) {
          this.toGrid = fallback.toGrid;
      } else try {
          final MathTransform2D transform = gridGeometry.getGridToCRS2D(PixelOrientation.UPPER_LEFT);
          toGrid = transform.inverse();
      } catch (NoninvertibleTransformException exception) {
          throw new IllegalArgumentException(exception);
      }
 
      final int left   = interpolation.getLeftPadding();
View Full Code Here

                            }
                        }
                    }
                }
                // -------- End of JAI bug workaround --------
                final MathTransform2D transform = (MathTransform2D) allSteps2D;
                final CharSequence name = sourceCoverage.getName();
                operation = "Warp";
                if (forceAdapter) {
                    warp = new WarpBuilder(0.0).buildWarp(transform, sourceBB);
                } else {
View Full Code Here

        if(tolerance == null) {
            tolerance = 0.333;
        }
        WarpBuilder wb = new WarpBuilder(tolerance);
       
        MathTransform2D transform = allSteps2D;
        Rectangle actualBB = null;
        int step = 0;
        do {
            /*
             * Following block is usually not executed, unless we detected after the Warp object
View Full Code Here

            if (WARP_REDUCTION_ENABLED && "Warp".equals(opName)
                    && mtProperty instanceof MathTransform2D
                    && sourceBoundsProperty instanceof Rectangle) {
                try {
                    // we can merge the affine into the warp
                    MathTransform2D originalTransform = (MathTransform2D) mtProperty;
                    MathTransformFactory factory = ReferencingFactoryFinder
                            .getMathTransformFactory(null);
                    MathTransform affineMT = factory
                            .createAffineTransform(new org.geotools.referencing.operation.matrix.AffineTransform2D(
                                    tx));
                    MathTransform2D chained = (MathTransform2D) factory
                            .createConcatenatedTransform(affineMT.inverse(), originalTransform);

                    // setup the warp builder
                    Double tolerance = (Double) getRenderingHint(Hints.RESAMPLE_TOLERANCE);
                    if (tolerance == null) {
View Full Code Here

    private void checkCollectionPoints(SimpleFeatureCollection collection, boolean hemisphere,
            Float scaleFactor, CoordinateReferenceSystem targetCRS)
            throws MismatchedDimensionException, TransformException {
        // World2Grid transform associated to the coverage
        MathTransform2D w2g = coverage.getGridGeometry()
                .getCRSToGrid2D(PixelOrientation.UPPER_LEFT);
        // Iterator on the FeatureCollection
        SimpleFeatureIterator it = collection.features();
        // Iterator on the input image
        RandomIter imageIterator = RandomIterFactory.create(coverage.getRenderedImage(), null);
View Full Code Here

        assertEqualImageDim(mergedImg, selected2.getRenderedImage());

        // Ensure equal images inside ROI. This requires cropping the images
       
        // World to grid transform for mapping the ROI in the Raster apsce
        MathTransform2D tr = coverage1.getGridGeometry().getCRSToGrid2D(PixelOrientation.UPPER_LEFT);
        // ROI object inthe Raster Space
        ROI roi = new ROIGeometry(JTS.transform(geo, tr));
        // This ROI is a Rectangle so we can get its bounds
        Rectangle roiBounds = roi.getBounds();
        // Crop the source image with the ROI Bounds
View Full Code Here

TOP

Related Classes of org.opengis.referencing.operation.MathTransform2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.