Package org.geotools.referencing.operation.transform

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


           
            if ( reader.hasMoreChildren() ) {
                reader.moveDown(); //transform or crs
            }
           
            AffineTransform2D gridToCRS = null;
            if ( "transform".equals( reader.getNodeName() ) ) {
                double sx,sy,shx,shy,tx,ty;
               
                reader.moveDown(); //scaleX
                sx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //scaleY
                sy = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
               
                reader.moveDown(); //shearX
                shx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //shearY
                shy = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //translateX
                tx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //translateY
                ty = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
               

                // set tranform
                gridToCRS = new AffineTransform2D(sx, shx, shy, sy, tx, ty);
                reader.moveUp();
                if ( reader.hasMoreChildren() ) {
                    reader.moveDown(); //crs
                }
            }
View Full Code Here


   */
  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

        mapExtent,
        new Rectangle(
            tileSize,
            tileSize));
    try {
      final AffineTransform2D gridToCRS = new AffineTransform2D(
          worldToScreenTransform.createInverse());
      final GridCoverageFactory gcf = CoverageFactoryFinder.getGridCoverageFactory(null);
      return gcf.create(
          coverageName,
          image,
View Full Code Here

              new Rectangle(
                  tileSize,
                  tileSize));
          GridGeometry2D insertionIdGeometry;
          try {
            final AffineTransform2D gridToCRS = new AffineTransform2D(
                worldToScreenTransform.createInverse());
            insertionIdGeometry = new GridGeometry2D(
                new GridEnvelope2D(
                    new Rectangle(
                        tileSize,
                        tileSize)),
                PixelInCell.CELL_CORNER,
                gridToCRS,
                GeoWaveGTRasterFormat.DEFAULT_CRS,
                null);

            final double[] tileRes = pyramidLevel.getIndexStrategy().getHighestPrecisionIdRangePerDimension();
            final double[] pixelRes = new double[tileRes.length];
            for (int d = 0; d < tileRes.length; d++) {
              pixelRes[d] = tileRes[d] / tileSize;
            }
            Geometry footprintWithinTileWorldGeom = null;
            Geometry footprintWithinTileScreenGeom = null;
            try {
              final Geometry wholeFootprintScreenGeom = JTS.transform(
                  footprint,
                  new AffineTransform2D(
                      worldToScreenTransform));
              final GeometryClipper tileClipper = new GeometryClipper(
                  new com.vividsolutions.jts.geom.Envelope(
                      0,
                      tileSize,
View Full Code Here

           
            if ( reader.hasMoreChildren() ) {
                reader.moveDown(); //transform or crs
            }
           
            AffineTransform2D gridToCRS = null;
            if ( "transform".equals( reader.getNodeName() ) ) {
                double sx,sy,shx,shy,tx,ty;
               
                reader.moveDown(); //scaleX
                sx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //scaleY
                sy = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
               
                reader.moveDown(); //shearX
                shx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //shearY
                shy = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //translateX
                tx = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
                reader.moveDown(); //translateY
                ty = Double.parseDouble( reader.getValue() );
                reader.moveUp();
               
               

                // set tranform
                gridToCRS = new AffineTransform2D(sx, shx, shy, sy, tx, ty);
                reader.moveUp();
                if ( reader.hasMoreChildren() ) {
                    reader.moveDown(); //crs
                }
            }
View Full Code Here

                        }
                    }
                }
                pixelSizeX = Math.abs(tx.getScaleX());
                pixelSizeY = Math.abs(tx.getScaleY());
                gridToCRS = new AffineTransform2D(tx);
            } else {
                Double[] offsets = estimateOffsets(reader, gridCRS, gridToCRS,
                        intersectionEnvelope, reprojectionNeeded);
                if (offsets.length == 2) {
                    pixelSizeX = Math.abs(offsets[0]);
                    pixelSizeY = Math.abs(offsets[1]);
                    AffineTransform tx = new AffineTransform(offsets[0], 0, 0, offsets[1], 0, 0);
                    gridToCRS = new AffineTransform2D(tx);
                } else {
                    AffineTransform tx = new AffineTransform(offsets[0], offsets[1], offsets[3],
                            offsets[4], 0, 0);
                    pixelSizeX = Math.abs(XAffineTransform.getScaleX0(tx));
                    pixelSizeY = Math.abs(XAffineTransform.getScaleY0(tx));
                    gridToCRS = new AffineTransform2D(tx);
                }
            }

            /**
             * Reproject
 
View Full Code Here

                                    GridType.GT2dGridIn2dCrs.getXmlConstant()))
                        offsets = new Double[] { 1.0, -1.0 };
                    else
                        offsets = new Double[] { 1.0, 0.0, 0.0, 0.0, -1.0, 0.0 };
                } else {
                    AffineTransform2D affine = (AffineTransform2D) gridToCRS;
                    if (gridCRS.getGridType().equals(GridType.GT2dSimpleGrid.getXmlConstant())
                            || gridCRS.getGridType().equals(
                                    GridType.GT2dGridIn2dCrs.getXmlConstant()))
                        offsets = new Double[] { affine.getScaleX(), affine.getScaleY() };
                    else
                        offsets = new Double[] { affine.getScaleX(), affine.getShearX(),
                                affine.getShearY(), affine.getScaleY() };
                }
            } else {
                AffineTransform2D at = (AffineTransform2D) gridToCRS;
                offsets = new Double[] { at.getScaleX(), at.getShearX(), 0d, at.getShearY(),
                        at.getScaleY(), 0d };
            }
        } else {
            // the input resolution is going to be completed unrelated to the output one
            // make an estimate assuming we want to keep the output raster with roughly
            // the same size as the input one
View Full Code Here

            final MathTransform2D transform = gg2D.getGridToCRS2D(PixelOrientation.CENTER);
            if (!(transform instanceof AffineTransform2D)) {
                throw new IllegalStateException("Invalid grid to worl provided:"
                        + transform.toString());
            }
            final AffineTransform2D g2W = (AffineTransform2D) transform;

            // Origin
            // we use ULC as per our G2W transformation
            final AttributesImpl pointAttr = new AttributesImpl();
            pointAttr.addAttribute("", "gml:id", "gml:id", "", "p00_" + gcName);
            pointAttr.addAttribute("", "srsName", "srsName", "", srsName);
            start("gml:origin");
            start("gml:Point", pointAttr);
            element("gml:pos",
                    axesSwap ? g2W.getTranslateY() + " " + g2W.getTranslateX() : g2W
                            .getTranslateX() + " " + g2W.getTranslateY());
            end("gml:Point");
            end("gml:origin");

            // Offsets
            final AttributesImpl offsetAttr = new AttributesImpl();
            offsetAttr.addAttribute("", "srsName", "srsName", "", srsName);

            // notice the orientation of the transformation I create. The origin of the coordinates
            // in this grid is not at UPPER LEFT like in our grid to world but at LOWER LEFT !!!
            element("gml:offsetVector",
                    Double.valueOf(axesSwap ? g2W.getShearX() : g2W.getScaleX()) + " "
                            + Double.valueOf(axesSwap ? g2W.getScaleX() : g2W.getShearX()),
                    offsetAttr);
            element("gml:offsetVector",
                    Double.valueOf(axesSwap ? g2W.getScaleY() : g2W.getShearY()) + " "
                            + Double.valueOf(axesSwap ? g2W.getShearY() : g2W.getScaleY()),
                    offsetAttr);
            end("gml:RectifiedGrid");
            end("gml:domainSet");
        }
View Full Code Here

            if(radius < buffer) {
                radius = buffer;
            }
            Envelope targetRasterSpace = new Envelope(params.getX() - radius, params.getX() + radius,
                    params.getY() - radius, params.getY() + radius);
            Envelope targetModelSpace = JTS.transform(targetRasterSpace, new AffineTransform2D(screenToWorld));
           
            // prepare the image we are going to check rendering against
            int paintAreaSize = radius * 2 + 1;
            final BufferedImage image = ImageTypeSpecifier.createFromBufferedImageType(
                    BufferedImage.TYPE_INT_ARGB).createBufferedImage(paintAreaSize,
View Full Code Here

            // or direct proportionalities we could just compute the max value of the fields
            // involved
            FeatureSource<?, ?> fs = layer.getFeatureSource();
            Envelope targetRasterSpace = new Envelope(-estimatedRadius, params.getWidth() + estimatedRadius,
                    - estimatedRadius, params.getWidth() + estimatedRadius);
            Envelope expanded = JTS.transform(targetRasterSpace, new AffineTransform2D(screenToWorld));
            ReferencedEnvelope renderingBBOX = new ReferencedEnvelope(expanded, getMap.getCrs());
            ReferencedEnvelope queryBBOX = renderingBBOX.transform(fs.getSchema().getCoordinateReferenceSystem(), true);
           
            // setup the query
            Query query = layer.getQuery();
View Full Code Here

TOP

Related Classes of org.geotools.referencing.operation.transform.AffineTransform2D

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.