Examples of AffineTransform2D


Examples of org.geotools.referencing.operation.transform.AffineTransform2D

                final double scaleY,
                final RasterLayout rasterLayout) {
            this.source=source;
            this.scaleX = scaleX;
            this.scaleY = scaleY;
            this.baseToLevelTransform = new AffineTransform2D(XAffineTransform.getScaleInstance(scaleX, scaleY, 0, 0));
            final AffineTransform gridToWorldTransform_ = new AffineTransform(baseToLevelTransform);
            gridToWorldTransform_.preConcatenate(CoverageUtilities.CENTER_TO_CORNER);
            gridToWorldTransform_.preConcatenate(baseGridToWorld);
            this.gridToWorldTransformCorner = new AffineTransform2D(gridToWorldTransform_);
            this.rasterDimensions = (RasterLayout) rasterLayout.clone();
        }
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

                    final GridCoverage2DReader reader = (GridCoverage2DReader) GRID_PROPERTY_NAME.evaluate(gridWrapper);
                    // don't read more than the native resolution (in case we are oversampling)
                    if(CRS.equalsIgnoreMetadata(reader.getCoordinateReferenceSystem(), gridGeometry.getCoordinateReferenceSystem())) {
                         MathTransform g2w = reader.getOriginalGridToWorld(PixelInCell.CELL_CENTER);
                         if(g2w instanceof AffineTransform2D && readGG.getGridToCRS2D() instanceof AffineTransform2D) {
                             AffineTransform2D atOriginal = (AffineTransform2D) g2w;
                             AffineTransform2D atMap = (AffineTransform2D) readGG.getGridToCRS2D();
                             if(XAffineTransform.getScale(atMap) < XAffineTransform.getScale(atOriginal)) {
                                 // we need to go trough some convoluted code to make sure the new grid geometry
                                 // has at least one pixel
                                
                                 org.opengis.geometry.Envelope worldEnvelope = gridGeometry.getEnvelope();
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

                Position p;
                while((p = ps.getNextPosition()) != null) {
                    at.setToTranslation(p.x, p.y);
                    at.rotate(Math.toRadians(p.rotation));
                    List<AffineTransform2D> transforms = new ArrayList<AffineTransform2D>();
                    AffineTransform2D at2d = new AffineTransform2D(at);
                    transforms.add(at2d);

                    // do we have to build the other 8 possibilities? Happens only if the
                    // symbol is crossing the bounds
                    Geometry transformed = JTS.transform(bounds, at2d);
                    if (tileBounds.intersects(transformed) && !tileBounds.contains(transformed)) {
                        for (int dx = -tileSize; dx <= tileSize; dx += tileSize) {
                            for (int dy = -tileSize; dy <= tileSize; dy += tileSize) {
                                if (dx == 0 && dy == 0) {
                                    continue;
                                }
                                int mx = p.x + dx;
                                int my = p.y + dy;
                                at.setToTranslation(mx, my);
                                at.rotate(Math.toRadians(p.rotation));
                                AffineTransform2D tx2d = new AffineTransform2D(at);
                                Geometry translatedBounds = JTS.transform(bounds, tx2d);
                                if (tileBounds.intersects(translatedBounds)
                                        || tileBounds.contains(translatedBounds)) {
                                    // System.out.println("Adding  " + translatedBounds);
                                    transforms.add(tx2d);
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

   */
  public static ROI prepareROI(Geometry roi, AffineTransform mt2d) throws ProcessException {
      // transform the geometry to raster space so that we can use it as a ROI source
      Geometry rasterSpaceGeometry;
    try {
      rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse()));
    } catch (MismatchedDimensionException e) {
      throw new ProcessException(e);
    } catch (TransformException e) {
      throw new ProcessException(e);
    } catch (NoninvertibleTransformException e) {
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

    }

    public Level(final double scaleX,final double scaleY,final int width,final int height) {
      this.scaleX = scaleX;
      this.scaleY = scaleY;
      this.baseToLevelTransform=new AffineTransform2D( XAffineTransform.getScaleInstance(scaleX,scaleY,0,0));
     
      final AffineTransform gridToWorldTransform_ = new AffineTransform(baseToLevelTransform);
      gridToWorldTransform_.preConcatenate(CoverageUtilities.CENTER_TO_CORNER);
      gridToWorldTransform_.preConcatenate(baseGridToWorld);
      this.gridToWorldTransform=new AffineTransform2D(gridToWorldTransform_);
      this.width = width;
      this.height = height;
      this.rasterDimensions= new Rectangle(0,0,width,height);
    }
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

                      // Getting the first level descriptor
                            final GranuleOverviewLevelDescriptor baseOverviewLevelDescriptor = granuleLevels.get(0);

                            // Variables initialization
          final int numberOfOvervies = reader.getNumImages(true) - 1;
          final AffineTransform2D baseG2W = baseOverviewLevelDescriptor.getGridToWorldTransform();
          final int width = baseOverviewLevelDescriptor.getWidth();
          final int height = baseOverviewLevelDescriptor.getHeight();
          final double resX = AffineTransform2D.getScaleX0(baseG2W);
          final double resY = AffineTransform2D.getScaleY0(baseG2W);
          final double[] highestRes = new double[]{resX, resY};
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

     
      // now create the crop grid to world which can be used to decide
      // which source area we need to crop in the selected level taking
      // into account the scale factors imposed by the selection of this
      // level together with the base level grid to world transformation
            AffineTransform2D cropWorldToGrid= new AffineTransform2D(selectedlevel.gridToWorldTransformCorner);
            cropWorldToGrid=(AffineTransform2D) cropWorldToGrid.inverse();
      // computing the crop source area which lives into the
      // selected level raster space, NOTICE that at the end we need to
      // take into account the fact that we might also decimate therefore
      // we cannot just use the crop grid to world but we need to correct
      // it.
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

    }

    public GranuleOverviewLevelDescriptor(final double scaleX,final double scaleY,final int width,final int height) {
      this.scaleX = scaleX;
      this.scaleY = scaleY;
      this.baseToLevelTransform=new AffineTransform2D( XAffineTransform.getScaleInstance(scaleX,scaleY,0,0));
     
      final AffineTransform gridToWorldTransform_ = new AffineTransform(baseToLevelTransform);
      gridToWorldTransform_.preConcatenate(CoverageUtilities.CENTER_TO_CORNER);
      gridToWorldTransform_.preConcatenate(baseGridToWorld);
      this.gridToWorldTransformCorner=new AffineTransform2D(gridToWorldTransform_);
      this.width = width;
      this.height = height;
      this.rasterDimensions= new Rectangle(0,0,width,height);
    }
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

      g2w.concatenate(CoverageUtilities.CENTER_TO_CORNER);
     
      //keep into account overviews and subsampling
      final OverviewLevel level = rasterManager.overviewsController.resolutionsLevels.get(imageChoice);
      final OverviewLevel baseLevel = rasterManager.overviewsController.resolutionsLevels.get(0);
      final AffineTransform2D adjustments = new AffineTransform2D(
          (level.resolutionX/baseLevel.resolutionX)*baseReadParameters.getSourceXSubsampling(),
          0,
          0,
          (level.resolutionY/baseLevel.resolutionY)*baseReadParameters.getSourceYSubsampling(),
          0,
          0);
      g2w.concatenate(adjustments);
      finalGridToWorldCorner = new AffineTransform2D(g2w);
      finalWorldToGridCorner = finalGridToWorldCorner.inverse();// compute raster bounds
      rasterBounds=new GeneralGridEnvelope(CRS.transform(finalWorldToGridCorner, bbox),PixelInCell.CELL_CORNER,false).toRectangle();
     
      // create Init the granuleWorker
      final GranuleWorker worker = new GranuleWorker();
View Full Code Here

Examples of org.geotools.referencing.operation.transform.AffineTransform2D

                        final AffineTransform targetWorldToGrid=targetGridToWorld.createInverse();
                        // final complete transformation
                        targetWorldToGrid.concatenate(sourceGridToWorld);
                       
                        //update final grid to world
                        finalGridToWorldCorner=new AffineTransform2D(targetGridToWorld);
                        //
                        // Check and see if the affine transform is doing a copy.
                        // If so call the copy operation.
                        //
                        // we are in raster space here, so 1E-3 is safe
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.