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


Java ReferencedEnvelope.expandBy方法代码示例

本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.expandBy方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.expandBy方法的具体用法?Java ReferencedEnvelope.expandBy怎么用?Java ReferencedEnvelope.expandBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.geometry.jts.ReferencedEnvelope的用法示例。


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

示例1: setExtend

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * sets the viewport of the map to the given extend.
 *
 * @param envelope the extend
 */
public void setExtend(ReferencedEnvelope envelope) {
    try {
        envelope = envelope.transform(this.mapContent.getViewport()
                .getCoordinateReferenceSystem(), true);
        double xLength = envelope.getSpan(0);
        xLength = xLength * TEN_PERCENT;
        double yLength = envelope.getSpan(1);
        yLength = yLength * TEN_PERCENT;
        envelope.expandBy(xLength, yLength);
        bboxAction.resetCoordinates();
        mapPane.deleteGraphics();
        mapPane.setDisplayArea(envelope);
    } catch (FactoryException | TransformException e) {
        log.log(Level.SEVERE, e.getMessage(), e);
    }
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:22,代码来源:WMSMapSwing.java

示例2: expandBounds

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * Expands inBounds by multiplying min of inBounds.getWidth and inBounds.getHeight times percent
 * 
 * @param inBounds
 * @param percent
 * @return
 */
public static Bounds expandBounds(Bounds inBounds, String inCRS, double percent) {

	try {
		double ulx = inBounds.getLeft();
		double uly = inBounds.getTop();
		double lrx = inBounds.getRight();
		double lry = inBounds.getBottom();

		CoordinateReferenceSystem theCRS = CRS.decode(inCRS);
		ReferencedEnvelope re = new ReferencedEnvelope(ulx, lrx, lry, uly, theCRS);
		double expandBy = Math.min(re.getHeight(), re.getWidth()) * percent;
		re.expandBy(expandBy);
		return getBounds(re.toBounds(theCRS));

	} catch (Exception e) {
	}

	return null;
}
 
开发者ID:lizardtechblog,项目名称:ExpressZip,代码行数:27,代码来源:MapModel.java

示例3: drawImage

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public void drawImage( Graphics2D g2d, ReferencedEnvelope ref, int imageWidth, int imageHeight, double buffer ) {
    checkMapContent();

    if (buffer > 0.0)
        ref.expandBy(buffer, buffer);

    Rectangle2D refRect = new Rectangle2D.Double(ref.getMinX(), ref.getMinY(), ref.getWidth(), ref.getHeight());
    Rectangle2D imageRect = new Rectangle2D.Double(0, 0, imageWidth, imageHeight);

    GeometryUtilities.scaleToRatio(imageRect, refRect, false);

    ReferencedEnvelope newRef = new ReferencedEnvelope(refRect, ref.getCoordinateReferenceSystem());

    Rectangle imageBounds = new Rectangle(0, 0, imageWidth, imageHeight);
    Color white = Color.white;
    g2d.setColor(new Color(white.getRed(), white.getGreen(), white.getBlue(), 0));
    g2d.fillRect(0, 0, imageWidth, imageHeight);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    synchronized (renderer) {
        content.getViewport().setBounds(newRef);
        renderer.paint(g2d, imageBounds, newRef);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:25,代码来源:ImageGenerator.java

示例4: zoomOut

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
@Override
public void zoomOut() {
	final ReferencedEnvelope env = pane.getDisplayArea();
	env.expandBy(env.getWidth() / 10, env.getHeight() / 10);
	pane.setDisplayArea(env);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:7,代码来源:GISFileViewer.java

示例5: calculateBounds

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * Calculate bounds.
 *
 * @return the referenced envelope
 */
private ReferencedEnvelope calculateBounds() {
    ReferencedEnvelope bounds = null;

    try {
        bounds = featureList.getBounds();

        if (bounds == null) {
            // It could be that the above call was too costly!
            bounds = featureList.getFeatures().getBounds();
        }

        if (bounds.getCoordinateReferenceSystem() == null) {
            // We need a coordinate reference system set otherwise
            // transformations fail to render
            bounds = ReferencedEnvelope.create(bounds, DefaultGeographicCRS.WGS84);
        }

        if (bounds != null) {
            Unit<?> unit = CRSUtilities
                    .getUnit(bounds.getCoordinateReferenceSystem().getCoordinateSystem());

            double width;
            double height;
            if (unit == NonSI.DEGREE_ANGLE) {
                width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
                        ? BOUNDINGBOX_BUFFER_MIN_ANGLE
                        : (bounds.getWidth() * BOUNDINGBOX_BUFFER_ANGLE);
                height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
                        ? BOUNDINGBOX_BUFFER_MIN_ANGLE
                        : (bounds.getHeight() * BOUNDINGBOX_BUFFER_ANGLE);
            } else {
                width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
                        ? BOUNDINGBOX_BUFFER_MIN_LINEAR
                        : (bounds.getWidth() * BOUNDINGBOX_BUFFER_LINEAR);
                height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
                        ? BOUNDINGBOX_BUFFER_MIN_LINEAR
                        : (bounds.getHeight() * BOUNDINGBOX_BUFFER_LINEAR);
            }

            bounds.expandBy(width, height);
        }
    } catch (IOException e) {
        ConsoleManager.getInstance().exception(this, e);
    }
    return bounds;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:52,代码来源:RenderPanelImpl.java

示例6: zoomIn

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
@Override
public void zoomIn() {
	final ReferencedEnvelope env = pane.getDisplayArea();
	env.expandBy(-env.getWidth() / 10, -env.getHeight() / 10);
	pane.setDisplayArea(env);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:7,代码来源:GISFileViewer.java


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