Java Code Examples for org.geotools.geometry.jts.ReferencedEnvelope#getMaxY()

The following examples show how to use org.geotools.geometry.jts.ReferencedEnvelope#getMaxY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseLasDataManager.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
@Override
public synchronized ReferencedEnvelope3D getEnvelope3D() throws Exception {
    if (referencedEnvelope3D == null) {
        checkOpen();

        List<LasSource> lasSources = LasSourcesTable.getLasSources(spatialDb);
        ReferencedEnvelope total = new ReferencedEnvelope(crs);
        double minZ = Double.POSITIVE_INFINITY;
        double maxZ = Double.NEGATIVE_INFINITY;
        for( LasSource lasSource : lasSources ) {
            Envelope envelopeInternal = lasSource.polygon.getEnvelopeInternal();
            total.expandToInclude(envelopeInternal);
            minZ = Math.min(minZ, lasSource.minElev);
            maxZ = Math.max(maxZ, lasSource.maxElev);
        }
        referencedEnvelope3D = new ReferencedEnvelope3D(total.getMinX(), total.getMaxX(), total.getMinY(), total.getMaxY(),
                minZ, maxZ, crs);
    }
    return referencedEnvelope3D;
}
 
Example 2
Source File: ImageMosaicNwwLayer.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public ImageMosaicNwwLayer( File imageMosaicShpFile, Integer tileSize, GeneralParameterValue[] gp,
        boolean removeSameColorImages ) throws Exception {
    super(makeLevels(imageMosaicShpFile, getRenderer(imageMosaicShpFile, gp), tileSize, removeSameColorImages));
    this.layerName = FileUtilities.getNameWithoutExtention(imageMosaicShpFile);

    ReferencedEnvelope envelope = OmsVectorReader.readEnvelope(imageMosaicShpFile.getAbsolutePath());
    ReferencedEnvelope envelopeLL = envelope.transform(DefaultGeographicCRS.WGS84, true);

    double w = envelopeLL.getMinX();
    double s = envelopeLL.getMinY();
    double e = envelopeLL.getMaxX();
    double n = envelopeLL.getMaxY();

    double centerX = w + (e - w) / 2.0;
    double centerY = s + (n - s) / 2.0;

    centerCoordinate = new Coordinate(centerX, centerY);

    this.setUseTransparentTextures(true);

}
 
Example 3
Source File: RasterDirectLayer.java    From geomajas-project-server with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void addImage(Graphics2D graphics, ImageResult imageResult, MapViewport viewport) throws IOException {
	Rectangle screenArea = viewport.getScreenArea();
	ReferencedEnvelope worldBounds = viewport.getBounds();
	// convert map bounds to application bounds
	double printScale = screenArea.getWidth() / worldBounds.getWidth();
	if (tileScale < 0) {
		tileScale = printScale;
	}
	Envelope applicationBounds = new Envelope((worldBounds.getMinX()) * printScale, (worldBounds.getMaxX())
			* printScale, -(worldBounds.getMinY()) * printScale, -(worldBounds.getMaxY()) * printScale);
	Bbox imageBounds = imageResult.getRasterImage().getBounds();
	// find transform between image bounds and application bounds
	double tx = (imageBounds.getX() * printScale / tileScale - applicationBounds.getMinX());
	double ty = (imageBounds.getY() * printScale / tileScale - applicationBounds.getMinY());
	BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageResult.getImage()));
	double scaleX = imageBounds.getWidth() / image.getWidth() * printScale / tileScale;
	double scaleY = imageBounds.getHeight() / image.getHeight() * printScale / tileScale;
	AffineTransform transform = new AffineTransform();
	transform.translate(tx, ty);
	transform.scale(scaleX, scaleY);
	if (log.isDebugEnabled()) {
		log.debug("adding image, width=" + image.getWidth() + ",height=" + image.getHeight() + ",x=" + tx + ",y="
				+ ty);
	}
	// opacity
	log.debug("before drawImage");
	// create a copy to apply transform
	Graphics2D g = (Graphics2D) graphics.create();
	// apply opacity to image off-graphics to avoid interference with whatever opacity model is used by graphics
	BufferedImage opaqueCopy = makeOpaque(image);
	g.drawImage(opaqueCopy, transform, null);
	log.debug("after drawImage");
}
 
Example 4
Source File: GeopaparazziMapsCreator.java    From hortonmachine with GNU General Public License v3.0 4 votes vote down vote up
@Execute
public void process() throws Exception {
    checkNull(inROI, outFolder);

    SimpleFeatureCollection boundsVector = OmsVectorReader.readVector(inROI);
    ReferencedEnvelope bounds = boundsVector.getBounds();
    // bounds.expandBy(50.0);

    OmsTmsGenerator gen = new OmsTmsGenerator();
    if (inRaster1 != null || inRaster2 != null) {
        List<String> inRasters = new ArrayList<String>();
        if (inRaster1 != null)
            inRasters.add(inRaster1);
        if (inRaster2 != null)
            inRasters.add(inRaster2);
        gen.inRasterFile = FileUtilities.stringListAsTmpFile(inRasters).getAbsolutePath();
    }
    if (inVector1 != null || inVector2 != null || inVector3 != null || inVector4 != null || inVector5 != null) {
        List<String> inVectors = new ArrayList<String>();
        if (inVector1 != null)
            inVectors.add(inVector1);
        if (inVector2 != null)
            inVectors.add(inVector2);
        if (inVector3 != null)
            inVectors.add(inVector3);
        if (inVector4 != null)
            inVectors.add(inVector4);
        if (inVector5 != null)
            inVectors.add(inVector5);
        gen.inVectorFile = FileUtilities.stringListAsTmpFile(inVectors).getAbsolutePath();
    }
    gen.pMinzoom = pMinZoom;
    gen.pMaxzoom = pMaxZoom;
    gen.pName = pName;
    gen.inPath = outFolder;
    gen.pWest = bounds.getMinX();
    gen.pEast = bounds.getMaxX();
    gen.pNorth = bounds.getMaxY();
    gen.pSouth = bounds.getMinY();
    // gen.pEpsg = "EPSG:32632";
    gen.dataCrs = bounds.getCoordinateReferenceSystem();
    gen.doMbtiles = true;

    gen.inZoomLimitVector = inZoomLimitROI;
    gen.pZoomLimit = pZoomLimit;

    switch( pImageType ) {
    case "jpg":
        gen.pImagetype = 1;
        break;
    case "png":
    default:
        gen.pImagetype = 0;
        break;
    }
    gen.pm = pm;
    gen.process();

}