Package org.geotools.imageio.metadataold

Examples of org.geotools.imageio.metadataold.RectifiedGrid


  }

  @Override
    protected void setRectifiedGridElement(SpatioTemporalImageReader reader) {
      init(reader);
        final RectifiedGrid rg = getRectifiedGrid();
        getAttributesMap(reader);
        final int imageIndex = getImageIndex();
        int width;
        int height;
        String startX,startY,deltaX,deltaY,axisX,axisY;
        startX=startY=deltaX=deltaY=axisX=axisY = null;
        AffineTransform tempTransform = null;
    try {
        HDF4ImageReader hdf4ImageReader = (HDF4ImageReader) reader;
      width = hdf4ImageReader.getWidth(imageIndex);
      height = hdf4ImageReader.getHeight(imageIndex);
            rg.setLow(new int[] { 0, 0 });
            rg.setHigh(new int[] { width, height });
            switch (hdf4_type){
            case APS:
              if (transform == null){
                 final GridToEnvelopeMapper geMapper = new GridToEnvelopeMapper();
                     geMapper.setEnvelope(envelope);
                     geMapper.setGridRange(new GridEnvelope2D(gridRange));
                     geMapper.setPixelAnchor(PixelInCell.CELL_CORNER);
                     transform = (AffineTransform) geMapper.createTransform();
              }
              tempTransform = (AffineTransform) transform.clone();
              break;
            case TeraScan:
              if (transform == null){
                final String projToImageTransformation = attributesMap.get(HDF4TeraScanProperties.ProjAttribs.PROJECT_TO_IMAGE_AFFINE);
                transform = CRSUtilities.createAffineTransform(projToImageTransformation);
              }
              if (transform != null){
                tempTransform = (AffineTransform) transform.clone();
              final double tr = -PixelTranslation.getPixelTranslation(PixelInCell.CELL_CORNER);
              tempTransform.translate(tr, tr);
             
              }
              break;
            }
            startX = Double.toString(tempTransform.getTranslateX());
      startY = Double.toString(tempTransform.getTranslateY());
      deltaX = Double.toString(tempTransform.getScaleX());
      deltaY = Double.toString(tempTransform.getScaleY());
      axisX = "Easting";
      axisY = "Northing";
           
      rg.setCoordinates(new double[] {Double.parseDouble(startX), Double.parseDouble(startY)});
            rg.addOffsetVector(new double[] {Double.parseDouble(deltaX), 0d});
            rg.addOffsetVector(new double[] {0d, Double.parseDouble(deltaY)});

            rg.addAxisName(axisX);
            rg.addAxisName(axisY);
    } catch (IOException e) {

    }

    }
View Full Code Here


            // //
            //
            // Getting the rectifiedGrid node
            //
            // //
            final RectifiedGrid rg = metadata.getRectifiedGrid();
            final AffineTransform at = Utilities.getAffineTransform(rg);
            final GridEnvelope gridRange = Utilities.getGridRange(rg);
            final MathTransform raster2Model = ProjectiveTransform.create(at);
            raster2ModelMap.put(coverageName, raster2Model);
            final double[] highestRes = CoverageUtilities.getResolution((AffineTransform) raster2Model);
View Full Code Here

TOP

Related Classes of org.geotools.imageio.metadataold.RectifiedGrid

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.