当前位置: 首页>>代码示例>>Java>>正文


Java Envelope类代码示例

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


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

示例1: parse

import org.opengis.geometry.Envelope; //导入依赖的package包/类
@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    Envelope envelope = (Envelope) super.parse(instance, node, value);

    // handle the box CRS
    CoordinateReferenceSystem crs = this.crs;
    if (node.hasAttribute("srsName")) {
        URI srs = (URI) node.getAttributeValue("srsName");
        crs = CRS.decode(srs.toString());
    }
    
    if(crs != null) {
        return ReferencedEnvelope.create(envelope, crs);
    } else {
        return envelope;
    }
}
 
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:18,代码来源:GMLBoxTypeBinding_ISO.java

示例2: getBoundaryProduct

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public Product getBoundaryProduct() throws FactoryException, TransformException {
    final CoordinateReferenceSystem mapCRS = getTargetCRS();
    if (mapCRS != null) {
        final ReferencedEnvelope envelope = getTargetEnvelope();
        final Envelope mapEnvelope = envelope.transform(mapCRS, true);

        final double pixelSizeX = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_X);
        final double pixelSizeY = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_Y);
        final int w = MathUtils.floorInt(mapEnvelope.getSpan(0) / pixelSizeX);
        final int h = MathUtils.floorInt(mapEnvelope.getSpan(1) / pixelSizeY);

        final Product product = new Product("mosaic", "MosaicBounds", w, h);
        final GeoCoding geoCoding = new CrsGeoCoding(mapCRS,
                                                     w, h,
                                                     mapEnvelope.getMinimum(0),
                                                     mapEnvelope.getMaximum(1),
                                                     pixelSizeX, pixelSizeY);
        product.setSceneGeoCoding(geoCoding);

        return product;
    }
    return null;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:24,代码来源:MosaicFormModel.java

示例3: setCrs

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public void setCrs(final CoordinateReferenceSystem crs) {
	try {
		// System.out.println(content.layers().size());
		final ReferencedEnvelope rEnv = getDisplayArea();
		// System.out.println(rEnv);

		final CoordinateReferenceSystem sourceCRS = rEnv.getCoordinateReferenceSystem();
		final CoordinateReferenceSystem targetCRS = crs;

		final MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
		final com.vividsolutions.jts.geom.Envelope newJtsEnv = JTS.transform(rEnv, transform);

		final ReferencedEnvelope newEnvelope = new ReferencedEnvelope(newJtsEnv, targetCRS);
		content.getViewport().setBounds(newEnvelope);
		fullExtent = null;
		doSetDisplayArea(newEnvelope);

		// ReferencedEnvelope displayArea =
		getDisplayArea();
		// System.out.println(displayArea);
	} catch (final Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:25,代码来源:SwtMapPane.java

示例4: getRegionArrayFromGridCoverage

import org.opengis.geometry.Envelope; //导入依赖的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

示例5: getReferenceEnvelope

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public static ReferencedEnvelope getReferenceEnvelope(
		final GridCoverage gridCoverage,
		final CoordinateReferenceSystem targetCrs ) {
	final CoordinateReferenceSystem sourceCrs = gridCoverage.getCoordinateReferenceSystem();
	final Envelope sampleEnvelope = gridCoverage.getEnvelope();

	final ReferencedEnvelope sampleReferencedEnvelope = new ReferencedEnvelope(
			new com.vividsolutions.jts.geom.Envelope(
					sampleEnvelope.getMinimum(0),
					sampleEnvelope.getMaximum(0),
					sampleEnvelope.getMinimum(1),
					sampleEnvelope.getMaximum(1)),
			gridCoverage.getCoordinateReferenceSystem());

	ReferencedEnvelope projectedReferenceEnvelope = sampleReferencedEnvelope;
	if ((targetCrs != null) && !targetCrs.equals(sourceCrs)) {
		try {
			projectedReferenceEnvelope = sampleReferencedEnvelope.transform(
					targetCrs,
					true);
		}
		catch (TransformException | FactoryException e) {
			LOGGER.warn(
					"Unable to transform envelope of grid coverage to " + targetCrs.getName(),
					e);
		}
	}
	return projectedReferenceEnvelope;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:RasterUtils.java

示例6: createWritableSerializer

import org.opengis.geometry.Envelope; //导入依赖的package包/类
@Override
public HadoopWritableSerializer<GridCoverage, GridCoverageWritable> createWritableSerializer() {
	return new HadoopWritableSerializer<GridCoverage, GridCoverageWritable>() {

		@Override
		public GridCoverageWritable toWritable(
				final GridCoverage entry ) {
			final Envelope env = entry.getEnvelope();
			final DataBuffer dataBuffer = entry.getRenderedImage().copyData(
					new InternalWritableRaster(
							sampleModel.createCompatibleSampleModel(
									tileSize,
									tileSize),
							new Point())).getDataBuffer();
			Persistable metadata = null;
			if (entry instanceof GridCoverage2D) {
				final Object metadataObj = ((GridCoverage2D) entry).getProperty(TILE_METADATA_PROPERTY_KEY);
				if ((metadataObj != null) && (metadataObj instanceof Persistable)) {
					metadata = (Persistable) metadataObj;
				}
			}
			return new GridCoverageWritable(
					new RasterTile(
							dataBuffer,
							metadata),
					env.getMinimum(0),
					env.getMaximum(0),
					env.getMinimum(1),
					env.getMaximum(1));
		}

		@Override
		public GridCoverage fromWritable(
				final GridCoverageWritable writable ) {
			final ReferencedEnvelope mapExtent = new ReferencedEnvelope(
					writable.getMinX(),
					writable.getMaxX(),
					writable.getMinY(),
					writable.getMaxY(),
					GeoWaveGTRasterFormat.DEFAULT_CRS);
			try {
				return prepareCoverage(
						writable.getRasterTile(),
						tileSize,
						mapExtent);
			}
			catch (final IOException e) {
				LOGGER.error(
						"Unable to read raster data",
						e);
			}
			return null;
		}
	};
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:56,代码来源:RasterDataAdapter.java

示例7: FitToIndexGridCoverage

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public FitToIndexGridCoverage(
		final GridCoverage gridCoverage,
		final ByteArrayId insertionId,
		final Resolution resolution,
		final Envelope originalEnvelope,
		final Geometry footprintWorldGeometry,
		final Geometry footprintScreenGeometry,
		final Map properties ) {
	this.gridCoverage = gridCoverage;
	this.insertionId = insertionId;
	this.resolution = resolution;
	this.originalEnvelope = originalEnvelope;
	this.footprintWorldGeometry = footprintWorldGeometry;
	this.footprintScreenGeometry = footprintScreenGeometry;
	this.properties = properties;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:17,代码来源:FitToIndexGridCoverage.java

示例8: createTileLoader

import org.opengis.geometry.Envelope; //导入依赖的package包/类
@Override
protected Callable<GridCoverage2D> createTileLoader(Coordinate coord) {
	// Get the tile prefix, eg 'w140n40'
	final String tile = getTileName(coord);
	final Envelope tileBounds = getTileEnvelope(coord);

	// file to fetch from ftp
	final String fileBase = tile + ".Bathymetry.srtm";

	// Download the data files asynchronously
	// Should take about 40s to download dem file
	try {
		cache.prefetch(fileBase+".dem", new URL(SMTP_PLUS_SERVER+fileBase) );
		cache.prefetch(fileBase+".ers", new URL(SMTP_PLUS_SERVER+fileBase+".ers") );

		// Create bogus GTopo30 files for the inflexible Reader
		createHDR(fileBase+".hdr",tileBounds);
		createPRJ(fileBase+".prj");
		createSTX(fileBase+".stx");
	} catch (MalformedURLException e) {
		throw new RuntimeException("[Bug] bad URL for downloading tile "+tile,e);
	}

	return new GridLoader(tile, fileBase);
}
 
开发者ID:sbliven,项目名称:earthcraft,代码行数:26,代码来源:SRTMPlusElevationProvider.java

示例9: FT_Coverage

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public FT_Coverage(GridCoverage2D coverage) {
  this.setCoverage(coverage);
  Envelope envelope = coverage.getEnvelope();
  this.setBox(new GM_Envelope(
      new DirectPosition(envelope.getUpperCorner().getCoordinate()),
      new DirectPosition(envelope.getLowerCorner().getCoordinate())));
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:8,代码来源:FT_Coverage.java

示例10: cropEnvelope

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public FT_Coverage cropEnvelope(Envelope env) {
  GridCoverage2D coverage = this.coverage();
  final CoverageProcessor processor = new CoverageProcessor();
  final ParameterValueGroup param = processor.getOperation("CoverageCrop")
      .getParameters();

  final GeneralEnvelope cropEnv = new GeneralEnvelope(env);
  param.parameter("Source").setValue(coverage);
  param.parameter("Envelope").setValue(cropEnv);
  GridCoverage2D cropped = (GridCoverage2D) processor.doOperation(param);
  return new FT_Coverage(cropped);

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:14,代码来源:FT_Coverage.java

示例11: bufferredImageToGridCovergade2D

import org.opengis.geometry.Envelope; //导入依赖的package包/类
public static GridCoverage2D bufferredImageToGridCovergade2D(
    BufferedImage image,
    IFeatureCollection<? extends IFeature> templateFeatColl) {

  Envelope env = ((FT_Coverage) templateFeatColl.get(0)).coverage()
      .getEnvelope();
  return bufferedImageToGridCoverage2D(image, env);
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:9,代码来源:ImageUtil.java

示例12: setValue

import org.opengis.geometry.Envelope; //导入依赖的package包/类
@Override
public void setValue(Object aValue) {
    this.value = null;
    this.expression = null;

    if (aValue instanceof Envelope) {
        this.value = (Envelope) aValue;
    } else if ((aValue instanceof AttributeExpressionImpl)
            || (aValue instanceof FunctionExpressionImpl)
            || (aValue instanceof LiteralExpressionImpl)
            || (aValue instanceof MathExpressionImpl)) {
        this.expression = (Expression) aValue;
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:15,代码来源:ReferencedEnvelopeValues.java

示例13: calculateBBox

import org.opengis.geometry.Envelope; //导入依赖的package包/类
/**
 * Calculates the bounds for 4 different text fields.
 * @param x1 tf with x1
 * @param x2 tf with x2
 * @param y1 tf with y1
 * @param y2 tf with y2
 * @param crs the CRS of the Bounding Box
 * @return the bounding box
 */
public static Envelope2D calculateBBox(TextField x1,
                                       TextField x2,
                                       TextField y1,
                                       TextField y2,
                                       CoordinateReferenceSystem crs) {
    if (x1 != null
    && x2 != null
    && y1 != null
    && y2 != null
    && !x1.getText().toString().isEmpty()
    && !x2.toString().isEmpty()
    && !y1.toString().isEmpty()
    && !y2.toString().isEmpty()) {
        Double x1Coordinate = Double.parseDouble(
                x1.getText().toString());
        Double x2Coordinate = Double.parseDouble(
                x2.getText().toString());
        Double y1Coordinate = Double.parseDouble(
                y1.getText().toString());
        Double y2Coordinate = Double.parseDouble(
                y2.getText().toString());
        Envelope env = new ReferencedEnvelope(
                x1Coordinate,
                x2Coordinate,
                y1Coordinate,
                y2Coordinate,
                crs);
        return new Envelope2D(env);
    }
    return null;
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:41,代码来源:WMSMapSwing.java

示例14: doSetDisplayArea

import org.opengis.geometry.Envelope; //导入依赖的package包/类
/**
 * Helper method for {@linkplain #setDisplayArea} which is also called by
 * other methods that want to set the display area without provoking
 * repainting of the display
 *
 * @param envelope
 *            requested display area
 */
private void doSetDisplayArea(final Envelope envelope) {
	assert content != null && curPaintArea != null && !curPaintArea.isEmpty();

	if (equalsFullExtent(envelope)) {
		setTransforms(fullExtent, curPaintArea);
	} else {
		setTransforms(envelope, curPaintArea);
	}
	final ReferencedEnvelope adjustedEnvelope = getDisplayArea();
	content.getViewport().setBounds(adjustedEnvelope);

	final MapPaneEvent ev = new MapPaneEvent(this, MapPaneEvent.Type.DISPLAY_AREA_CHANGED);
	publishEvent(ev);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:23,代码来源:SwtMapPane.java

示例15: equalsFullExtent

import org.opengis.geometry.Envelope; //导入依赖的package包/类
/**
 * Check if the envelope corresponds to full extent. It will probably not
 * equal the full extent envelope because of slack space in the display
 * area, so we check that at least one pair of opposite edges are equal to
 * the full extent envelope, allowing for slack space on the other two
 * sides.
 * <p>
 * Note: this method returns {@code false} if the full extent envelope is
 * wholly within the requested envelope (e.g. user has zoomed out from full
 * extent), only touches one edge, or touches two adjacent edges. In all
 * these cases we assume that the user wants to maintain the slack space in
 * the display.
 * <p>
 * This method is part of the work-around that the map pane needs because of
 * the differences in how raster and vector layers are treated by the
 * renderer classes.
 *
 * @param envelope
 *            a pending display envelope to compare to the full extent
 *            envelope
 *
 * @return true if the envelope is coincident with the full extent evenlope
 *         on at least two edges; false otherwise
 *
 * @todo My logic here seems overly complex - I'm sure there must be a
 *       simpler way for the map pane to handle this.
 */
private boolean equalsFullExtent(final Envelope envelope) {
	if (fullExtent == null || envelope == null) {
		return false;
	}

	final double TOL = 1.0e-6d * (fullExtent.getWidth() + fullExtent.getHeight());

	boolean touch = false;
	if (Math.abs(envelope.getMinimum(0) - fullExtent.getMinimum(0)) < TOL) {
		touch = true;
	}
	if (Math.abs(envelope.getMaximum(0) - fullExtent.getMaximum(0)) < TOL) {
		if (touch) {
			return true;
		}
	}
	if (Math.abs(envelope.getMinimum(1) - fullExtent.getMinimum(1)) < TOL) {
		touch = true;
	}
	if (Math.abs(envelope.getMaximum(1) - fullExtent.getMaximum(1)) < TOL) {
		if (touch) {
			return true;
		}
	}

	return false;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:55,代码来源:SwtMapPane.java


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