• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java GridEnvelope2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.geotools.coverage.grid.GridEnvelope2D的典型用法代码示例。如果您正苦于以下问题:Java GridEnvelope2D类的具体用法?Java GridEnvelope2D怎么用?Java GridEnvelope2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GridEnvelope2D类属于org.geotools.coverage.grid包,在下文中一共展示了GridEnvelope2D类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: jiffleProcessExecution

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Private method used for executing the script operation on an input image with the selected GridGeometry2D.
 * 
 * @param input RenderedImage to process
 * @param jb jiffleBuilder object with the script to execute
 * @param destGridGeometry GridGeometry object associated to the output image
 * @return img output image generated from the script
 * @throws JiffleException
 */
private RenderedImage jiffleProcessExecution(RenderedImage input, JiffleBuilder jb,
        GridGeometry2D destGridGeometry) throws JiffleException {

    // Setting of the source
    jb.source("image", input, null, false);

    // Now we specify the tile dimensions of the final image
    int tileWidth = input.getTileWidth();
    int tileHeight = input.getTileHeight();
    // Creation of a SampleModel associated with the final image
    SampleModel sm = RasterFactory.createPixelInterleavedSampleModel(DataBuffer.TYPE_DOUBLE,
            tileWidth, tileHeight, 1);
    // Selection of the GridEnvelope associated to the input coverage
    final GridEnvelope2D gr2d = destGridGeometry.getGridRange2D();
    // Final image creation
    final WritableRenderedImage img = new TiledImage(gr2d.x, gr2d.y, gr2d.width, gr2d.height,
            0, 0, sm, PlanarImage.createColorModel(sm));
    // Setting of the final image
    jb.dest("dest", img);

    // Finally we run the script and retrieve the resulting image.
    jb.run();

    return img;
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:35,代码来源:JiffleScriptListProcess.java


示例2: getRegionArrayFromGridCoverage

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Get the array of region parameters covered by the {@link GridCoverage2D coverage}. 
 * 
 * @param gridCoverage the coverage.
 * @return the array of region parameters as [n, s, w, e, xres, yres, cols, rows]
 */
public static double[] getRegionArrayFromGridCoverage( GridCoverage2D gridCoverage ) {
    Envelope envelope = gridCoverage.getEnvelope();
    DirectPosition lowerCorner = envelope.getLowerCorner();
    double[] westSouth = lowerCorner.getCoordinate();
    DirectPosition upperCorner = envelope.getUpperCorner();
    double[] eastNorth = upperCorner.getCoordinate();

    GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
    GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
    int height = gridRange.height;
    int width = gridRange.width;

    AffineTransform gridToCRS = (AffineTransform) gridGeometry.getGridToCRS();
    double xRes = XAffineTransform.getScaleX0(gridToCRS);
    double yRes = XAffineTransform.getScaleY0(gridToCRS);

    double[] params = new double[]{eastNorth[1], westSouth[1], westSouth[0], eastNorth[0], xRes, yRes, width, height};

    return params;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:27,代码来源:CoverageUtilities.java


示例3: createRGBImageSymbol

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Creates the rgb image symbol.
 *
 * @param sym the sym
 * @param cov the cov
 * @param raster the raster
 */
private void createRGBImageSymbol(RasterSymbolizer sym, GridCoverage2D cov,
        WritableRaster raster) {
    double dest;
    List<Double> valueList = new ArrayList<Double>();

    GridEnvelope2D gridRange2D = cov.getGridGeometry().getGridRange2D();
    for (int x = 0; x < gridRange2D.getWidth(); x++) {
        for (int y = 0; y < gridRange2D.getHeight(); y++) {
            try {
                dest = raster.getSampleDouble(x, y, 0);

                if (!valueList.contains(dest)) {
                    valueList.add(dest);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    ColorMapImpl colourMap = new ColorMapImpl();

    // Sort the unique sample values in ascending order
    Collections.sort(valueList);

    // Create colour amp entries in the colour map for all the sample values
    for (Double value : valueList) {
        ColorMapEntry entry = new ColorMapEntryImpl();
        Literal colourExpression = ff
                .literal(ColourUtils.fromColour(ColourUtils.createRandomColour()));
        entry.setColor(colourExpression);
        entry.setQuantity(ff.literal(value.doubleValue()));

        colourMap.addColorMapEntry(entry);
    }

    colourMap.setType(ColorMap.TYPE_VALUES);
    sym.setColorMap(colourMap);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:47,代码来源:RasterReader.java


示例4: getOriginalGridRange

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
@Override
public GridEnvelope getOriginalGridRange(String name)
{
  log.fine("Getting Grid Range for: " + name);

  if (!checkName(name)) {
    throw new IllegalArgumentException("The specified coverage " + name + "is not found");
  }

  // get the pixel size of the base image
  try
  {
    MrsImageDataProvider dp = DataProviderFactory
        .getMrsImageDataProvider(name, DataProviderFactory.AccessMode.READ, providerProperties);
    MrsPyramidMetadata meta = dp.getMetadataReader().read();

    LongRectangle bounds = meta.getPixelBounds(meta.getMaxZoomLevel());

    log.fine("Grid Range for: " + name + " is " + bounds.toString());

    return new GridEnvelope2D((int)bounds.getMinX(), (int)bounds.getMinY(), (int)bounds.getMaxX(), (int)bounds.getMaxY());
  }
  catch (IOException e)
  {
    e.printStackTrace();
  }

  return null;

}
 
开发者ID:ngageoint,项目名称:mrgeo-geoserver-plugin,代码行数:31,代码来源:MrGeoReader.java


示例5: getOverviewGridEnvelope

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
@Override
public GridEnvelope getOverviewGridEnvelope(String name, int overviewIndex) throws IOException
{
  log.fine("Getting Overview Grid Range for: " + name);

  if (!checkName(name)) {
    throw new IllegalArgumentException("The specified coverage " + name + "is not found");
  }

  // get the pixel size of the base image
  try
  {
    MrsImageDataProvider dp = DataProviderFactory
        .getMrsImageDataProvider(name, DataProviderFactory.AccessMode.READ, providerProperties);
    MrsPyramidMetadata meta = dp.getMetadataReader().read();

    LongRectangle bounds = meta.getPixelBounds(overviewIndex);

    log.fine("Overview Grid Range for: " + name + " is " + bounds.toString());

    return new GridEnvelope2D((int)bounds.getMinX(), (int)bounds.getMinY(), (int)bounds.getMaxX(), (int)bounds.getMaxY());
  }
  catch (IOException e)
  {
    e.printStackTrace();
  }

  return null;
}
 
开发者ID:ngageoint,项目名称:mrgeo-geoserver-plugin,代码行数:30,代码来源:MrGeoReader.java


示例6: getRegionParamsFromGridCoverage

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Get the parameters of the region covered by the {@link GridCoverage2D coverage}. 
 * 
 * @param gridCoverage the coverage.
 * @return the {@link HashMap map} of parameters. ( {@link #NORTH} and the 
 *          other static vars can be used to retrieve them.
 */
public static RegionMap getRegionParamsFromGridCoverage( GridCoverage2D gridCoverage ) {
    RegionMap envelopeParams = new RegionMap();

    Envelope envelope = gridCoverage.getEnvelope();

    DirectPosition lowerCorner = envelope.getLowerCorner();
    double[] westSouth = lowerCorner.getCoordinate();
    DirectPosition upperCorner = envelope.getUpperCorner();
    double[] eastNorth = upperCorner.getCoordinate();

    GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
    GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
    int height = gridRange.height;
    int width = gridRange.width;

    AffineTransform gridToCRS = (AffineTransform) gridGeometry.getGridToCRS();
    double xRes = XAffineTransform.getScaleX0(gridToCRS);
    double yRes = XAffineTransform.getScaleY0(gridToCRS);

    envelopeParams.put(NORTH, eastNorth[1]);
    envelopeParams.put(SOUTH, westSouth[1]);
    envelopeParams.put(WEST, westSouth[0]);
    envelopeParams.put(EAST, eastNorth[0]);
    envelopeParams.put(XRES, xRes);
    envelopeParams.put(YRES, yRes);
    envelopeParams.put(ROWS, (double) height);
    envelopeParams.put(COLS, (double) width);

    return envelopeParams;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:38,代码来源:CoverageUtilities.java


示例7: getRegionParamsFromImageMosaicReader

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Get the parameters of the region covered by the {@link ImageMosaicReader}. 
 * 
 * @param reader the ImageMosaicReader.
 * @return the {@link HashMap map} of parameters. ( {@link #NORTH} and the 
 *          other static vars can be used to retrieve them.
 */
public static RegionMap getRegionParamsFromImageMosaicReader( ImageMosaicReader reader ) throws IOException {
    RegionMap envelopeParams = new RegionMap();

    Envelope envelope = reader.getOriginalEnvelope();

    DirectPosition lowerCorner = envelope.getLowerCorner();
    double[] westSouth = lowerCorner.getCoordinate();
    DirectPosition upperCorner = envelope.getUpperCorner();
    double[] eastNorth = upperCorner.getCoordinate();

    GridEnvelope2D gridRange = (GridEnvelope2D) reader.getOriginalGridRange();
    int height = gridRange.height;
    int width = gridRange.width;
    double[][] resolutionLevels = reader.getResolutionLevels();
    double xRes = resolutionLevels[0][0];
    double yRes = resolutionLevels[0][1];

    envelopeParams.put(NORTH, eastNorth[1]);
    envelopeParams.put(SOUTH, westSouth[1]);
    envelopeParams.put(WEST, westSouth[0]);
    envelopeParams.put(EAST, eastNorth[0]);
    envelopeParams.put(XRES, xRes);
    envelopeParams.put(YRES, yRes);
    envelopeParams.put(ROWS, (double) height);
    envelopeParams.put(COLS, (double) width);

    return envelopeParams;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:36,代码来源:CoverageUtilities.java


示例8: getRegionColsRows

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Get the array of rows and cols. 
 * 
 * @param gridCoverage the coverage.
 * @return the array as [cols, rows]
 */
public static int[] getRegionColsRows( GridCoverage2D gridCoverage ) {
    GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
    GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
    int height = gridRange.height;
    int width = gridRange.width;
    int[] params = new int[]{width, height};
    return params;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:15,代码来源:CoverageUtilities.java


示例9: getLoopColsRowsForSubregion

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Get the cols and rows ranges to use to loop the original gridcoverage.
 * 
 * @param gridCoverage the coverage.
 * @param subregion the sub region of the coverage to get the cols and rows to loop on.
 * @return the array of looping values in the form [minCol, maxCol, minRow, maxRow].
 * @throws Exception
 */
public static int[] getLoopColsRowsForSubregion( GridCoverage2D gridCoverage, Envelope2D subregion ) throws Exception {
    GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
    GridEnvelope2D subRegionGrid = gridGeometry.worldToGrid(subregion);
    int minCol = subRegionGrid.x;
    int maxCol = subRegionGrid.x + subRegionGrid.width;
    int minRow = subRegionGrid.y;
    int maxRow = subRegionGrid.y + subRegionGrid.height;
    return new int[]{minCol, maxCol, minRow, maxRow};
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:18,代码来源:CoverageUtilities.java


示例10: gridGeometry2RegionParamsMap

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
public static RegionMap gridGeometry2RegionParamsMap( GridGeometry2D gridGeometry ) {
    RegionMap envelopeParams = new RegionMap();

    Envelope envelope = gridGeometry.getEnvelope2D();
    DirectPosition lowerCorner = envelope.getLowerCorner();
    double[] westSouth = lowerCorner.getCoordinate();
    DirectPosition upperCorner = envelope.getUpperCorner();
    double[] eastNorth = upperCorner.getCoordinate();

    GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
    int height = gridRange.height;
    int width = gridRange.width;

    AffineTransform gridToCRS = (AffineTransform) gridGeometry.getGridToCRS();
    double xRes = XAffineTransform.getScaleX0(gridToCRS);
    double yRes = XAffineTransform.getScaleY0(gridToCRS);

    envelopeParams.put(NORTH, eastNorth[1]);
    envelopeParams.put(SOUTH, westSouth[1]);
    envelopeParams.put(WEST, westSouth[0]);
    envelopeParams.put(EAST, eastNorth[0]);
    envelopeParams.put(XRES, xRes);
    envelopeParams.put(YRES, yRes);
    envelopeParams.put(ROWS, (double) height);
    envelopeParams.put(COLS, (double) width);

    return envelopeParams;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:29,代码来源:CoverageUtilities.java


示例11: gridGeometryFromRegionValues

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
public static GridGeometry2D gridGeometryFromRegionValues( double north, double south, double east, double west, int cols,
        int rows, CoordinateReferenceSystem crs ) {
    Envelope envelope = new Envelope2D(crs, west, south, east - west, north - south);
    GridEnvelope2D gridRange = new GridEnvelope2D(0, 0, cols, rows);
    GridGeometry2D gridGeometry2D = new GridGeometry2D(gridRange, envelope);
    return gridGeometry2D;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:8,代码来源:CoverageUtilities.java


示例12: doProfile

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
/**
 * Calculates the profile of a raster map between given {@link Coordinate coordinates}.
 * 
 * <p>Note that novalues and points outside of the given raster region are 
 * added to the list with a {@link HMConstants#doubleNovalue novalue} elevation.
 * 
 * @param mapIter the {@link RandomIter map iterator}.
 * @param gridGeometry the gridgeometry of the map.
 * @param coordinates the {@link Coordinate}s to create the profile on.
 * @return the list of {@link ProfilePoint}s.
 * @throws TransformException
 */
public static List<ProfilePoint> doProfile( RandomIter mapIter, GridGeometry2D gridGeometry, Coordinate... coordinates )
        throws TransformException {
    List<ProfilePoint> profilePointsList = new ArrayList<ProfilePoint>();

    GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
    int rows = gridRange.height;
    int cols = gridRange.width;
    AffineTransform gridToCRS = (AffineTransform) gridGeometry.getGridToCRS();
    double xres = XAffineTransform.getScaleX0(gridToCRS);
    double yres = XAffineTransform.getScaleY0(gridToCRS);

    double step = Math.min(xres, yres);

    LineString line = GeometryUtilities.gf().createLineString(coordinates);
    double lineLength = line.getLength();
    LengthIndexedLine indexedLine = new LengthIndexedLine(line);

    double progressive = 0.0;
    GridCoordinates2D gridCoords;
    while( progressive < lineLength + step ) { // run over by a step to make sure we get the
                                               // last coord back from the extractor
        Coordinate c = indexedLine.extractPoint(progressive);
        gridCoords = gridGeometry.worldToGrid(new DirectPosition2D(c.x, c.y));
        double value = HMConstants.doubleNovalue;
        if (// envelope2d.contains(c.x, c.y) &&
        isInside(cols - 1, rows - 1, gridCoords)) {
            value = mapIter.getSampleDouble(gridCoords.x, gridCoords.y, 0);
        }
        ProfilePoint profilePoint = new ProfilePoint(progressive, value, c.x, c.y);
        profilePointsList.add(profilePoint);
        progressive = progressive + step;
    }
    return profilePointsList;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:47,代码来源:CoverageUtilities.java


示例13: getOriginalGridRange

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
@Override
public GridEnvelope getOriginalGridRange(
		final String coverageName ) {
	DataStatistics<?> statistics = geowaveStatisticsStore.getDataStatistics(
			new ByteArrayId(
					coverageName),
			BoundingBoxDataStatistics.STATS_TYPE,
			authorizationSPI.getAuthorizations());
	int width = 0;
	int height = 0;
	// try to use both the bounding box and the overview statistics to
	// determine the width and height at the highest resolution
	if (statistics instanceof BoundingBoxDataStatistics) {
		final BoundingBoxDataStatistics<?> bboxStats = (BoundingBoxDataStatistics<?>) statistics;
		statistics = geowaveStatisticsStore.getDataStatistics(
				new ByteArrayId(
						coverageName),
				OverviewStatistics.STATS_TYPE,
				authorizationSPI.getAuthorizations());
		if (statistics instanceof OverviewStatistics) {
			final OverviewStatistics overviewStats = (OverviewStatistics) statistics;
			width = (int) Math
					.ceil(((bboxStats.getMaxX() - bboxStats.getMinX()) / overviewStats.getResolutions()[0]
							.getResolution(0)));
			height = (int) Math
					.ceil(((bboxStats.getMaxY() - bboxStats.getMinY()) / overviewStats.getResolutions()[0]
							.getResolution(1)));
		}
	}

	return new GridEnvelope2D(
			0,
			0,
			width,
			height);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:37,代码来源:GeoWaveRasterReader.java


示例14: AreaOpImage

import org.geotools.coverage.grid.GridEnvelope2D; //导入依赖的package包/类
public AreaOpImage(RenderedImage source, ImageLayout layout, Map configuration,
        ReferencedEnvelope env, double multiplier, Set<Integer> validValues, ROI roi) {
    super(source, layoutHelper(source, layout), configuration, true);

    this.multi = multiplier;
    this.validCheck = validValues != null && !validValues.isEmpty();
    this.validValues = validValues;
    this.envelope = env;

    // Creation of a GridGeometry in order to calculate the gridToWorld transform
    GridEnvelope gridRange = new GridEnvelope2D(getBounds());
    GridGeometry2D gg = new GridGeometry2D(gridRange, env);
    g2w = gg.getGridToCRS2D(PixelOrientation.UPPER_LEFT);

    CoordinateReferenceSystem sourceCRS = envelope.getCoordinateReferenceSystem();

    try {
        CoordinateReferenceSystem targetCRS = CRS.parseWKT(TARGET_CRS_WKT);
        transform = CRS.findMathTransform(sourceCRS, targetCRS);
    } catch (FactoryException e) {
        LOGGER.log(Level.SEVERE, e.getMessage(), e);
        throw new IllegalArgumentException(e);
    }

    // Setting of the roi
    this.roiUsed = roi;
    if (roi != null) {
        // Setting a roi flag to true
        this.noROI = false;
        // check that the ROI contains the source image bounds
        final Rectangle sourceBounds = new Rectangle(source.getMinX(), source.getMinY(),
                source.getWidth(), source.getHeight());
        // Check if the ROI intersects the image bounds
        if (!roi.intersects(sourceBounds)) {
            throw new IllegalArgumentException(
                    "The bounds of the ROI must intersect the source image");
        }
        // massage roi
        roiUsed = roi.intersect(new ROIShape(sourceBounds));
    } else {
        this.noROI = true;
    }
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:44,代码来源:AreaOpImage.java



注:本文中的org.geotools.coverage.grid.GridEnvelope2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Describable类代码示例发布时间:2022-05-23
下一篇:
Java ExpandedNameTable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap