Package org.opengis.coverage.grid

Examples of org.opengis.coverage.grid.GridEnvelope


        final int width = originalGridRange.getSpan(0);
        return width;
    }

    public int getImageHeight() {
        final GridEnvelope originalGridRange = getOriginalGridRange();
        final int height = originalGridRange.getSpan(1);
        return height;
    }
View Full Code Here


    }

    public MathTransform getRasterToModel(final int rasterIndex, final int pyramidLevel) {

        GeneralEnvelope levelEnvelope = getGridEnvelope(rasterIndex, pyramidLevel);
        GridEnvelope levelGridRange = getGridRange(rasterIndex, pyramidLevel);

        // create a raster to model transform, from this tile pixel space to the tile's geographic
        // extent
        GridToEnvelopeMapper geMapper = new GridToEnvelopeMapper(levelGridRange, levelEnvelope);
        geMapper.setPixelAnchor(PixelInCell.CELL_CORNER);
View Full Code Here

        return level.getSpatialExtent();
    }

    public GridEnvelope getGridRange(final int rasterIndex, final int pyramidLevel) {
        PyramidLevelInfo level = getLevel(rasterIndex, pyramidLevel);
        GridEnvelope levelRange = level.getGridEnvelope();
        return levelRange;
    }
View Full Code Here

        return matchingTiles;
    }

    private static GridEnvelope getTargetGridRange(final MathTransform modelToRaster,
            final Envelope requestedEnvelope) {
        GridEnvelope levelOverlappingPixels;
        int levelMinPixelX;
        int levelMaxPixelX;
        int levelMinPixelY;
        int levelMaxPixelY;
        {
View Full Code Here

        }

        for (RasterQueryInfo rasterResultInfo : results) {
            final GeneralEnvelope rasterResultEnvelope = rasterResultInfo.getResultEnvelope();

            final GridEnvelope targetRasterGridRange;
            targetRasterGridRange = getTargetGridRange(modelToRaster, rasterResultEnvelope);

            rasterResultInfo.setMosaicLocation(targetRasterGridRange);

            minx = Math.min(minx, targetRasterGridRange.getLow(0));
            miny = Math.min(miny, targetRasterGridRange.getLow(1));
            maxx = Math.max(maxx, targetRasterGridRange.getHigh(0));
            maxy = Math.max(maxy, targetRasterGridRange.getHigh(1));
        }

        final GridEnvelope2D mosaicDimension;
        mosaicDimension = new GridEnvelope2D(minx, miny, 1 + (maxx - minx), 1 + (maxy - miny));
        return mosaicDimension;
View Full Code Here

    }

    public static void fitRequestToRaster(final GeneralEnvelope requestedEnvelope,
            final RasterDatasetInfo rasterInfo, final RasterQueryInfo query) {

        GridEnvelope resultGridRange;
        GeneralEnvelope resultEnvelope;
        // GridEnvelope resultDimensionInsideTiledImage;
        GridEnvelope tiledImageGridRange;
        // GridEnvelope levelTileRange;
        GridEnvelope matchingTiles;

        int rasterIndex = query.getRasterIndex();
        int pyramidLevel = query.getPyramidLevel();
        MathTransform2D rasterToModel = (MathTransform2D) rasterInfo.getRasterToModel(rasterIndex,
                pyramidLevel);
        MathTransform2D modelToRaster;

        try {
            modelToRaster = (MathTransform2D) rasterToModel.inverse();
            final GeneralEnvelope adjustedGRange = CRS.transform(modelToRaster, requestedEnvelope);

            int xmin = (int) Math.floor(adjustedGRange.getMinimum(0));
            int ymin = (int) Math.floor(adjustedGRange.getMinimum(1));
            int xmax = (int) Math.ceil(adjustedGRange.getMaximum(0));
            int ymax = (int) Math.ceil(adjustedGRange.getMaximum(1));

            final GridEnvelope levelRange = rasterInfo.getGridRange(rasterIndex, pyramidLevel);

            xmin = Math.max(xmin, levelRange.getLow(0));
            ymin = Math.max(ymin, levelRange.getLow(1));
            xmax = Math.min(xmax, levelRange.getHigh(0) + 1);// 1+ because getHigh is inclusive
            ymax = Math.min(ymax, levelRange.getHigh(1) + 1);// 1+ because getHigh is inclusive

            int width = xmax - xmin;
            int height = ymax - ymin;

            resultGridRange = new GridEnvelope2D(xmin, ymin, width, height);
View Full Code Here

    private static GridEnvelope findMatchingTiles(RasterDatasetInfo rasterInfo, int rasterIndex,
            int pyramidLevel, GridEnvelope resultGridRange) {
        final Dimension tileSize = rasterInfo.getTileDimension(rasterIndex);
        final int numTilesWide = rasterInfo.getNumTilesWide(rasterIndex, pyramidLevel);
        final int numTilesHigh = rasterInfo.getNumTilesHigh(rasterIndex, pyramidLevel);
        GridEnvelope matchingTiles;
        matchingTiles = findMatchingTiles(tileSize, numTilesWide, numTilesHigh, resultGridRange);
        return matchingTiles;
    }
View Full Code Here

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLimits(GridEnvelope newLimits) {
    GridEnvelope oldLimits = limits;
    limits = newLimits;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, GmlPackage.GRID_TYPE__LIMITS, oldLimits, limits));
  }
View Full Code Here

             * with that envelope. The grid range of that grid geometry is the new image size.
             * Note that failure to transform the envelope is non-fatal (we will assume that the
             * target image should have the same size). Then create again a new grid geometry,
             * this time with the target envelope.
             */
            GridEnvelope gridRange;
            try {
                final GeneralEnvelope transformed;
                transformed = CRS.transform(CRS.getCoordinateOperationFactory(true)
                        .createOperation(targetCRS, reducedCRS), target);
                final Envelope reduced;
View Full Code Here

    // Check that we got everything correctly after the crop.
    //
    // /////////////////////////////////////////////////////////////////////
    // checking the ranges of the output image.
    final GridGeometry2D croppedGG = (GridGeometry2D) cropped.getGridGeometry();
    final GridEnvelope croppedGR = croppedGG.getGridRange();
    final MathTransform croppedG2W = croppedGG.getGridToCRS(PixelInCell.CELL_CENTER);
    final GeneralEnvelope croppedEnvelope = (GeneralEnvelope) cropped.getEnvelope();
    assertTrue("min x do not match after crop", 29 == croppedGR.getLow(0));
    assertTrue("min y do not match after crop", 30 == croppedGR.getLow(1));
    assertTrue("max x do not match after crop", 90 == croppedGR.getHigh(0)+1);
    assertTrue("max y do not match after crop", 91 == croppedGR.getHigh(1)+1);
    // check that the affine transform are the same thing
    assertTrue(
        "The Grdi2World tranformations of the original and the cropped covearage do not match",
        sourceG2W.equals(croppedG2W));
    // check that the envelope is correct
View Full Code Here

TOP

Related Classes of org.opengis.coverage.grid.GridEnvelope

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.