本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.translate方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.translate方法的具体用法?Java ReferencedEnvelope.translate怎么用?Java ReferencedEnvelope.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.geometry.jts.ReferencedEnvelope
的用法示例。
在下文中一共展示了ReferencedEnvelope.translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resizeSwingContent
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
* Resizes swing content and centers map.
* @param width The new content width.
*/
public void resizeSwingContent(double width) {
try {
if (width >= mapWidth) {
double oldWidth = mapPane.getWidth();
this.mapNode.resize(width - MAP_NODE_MARGIN, mapHeight);
double scale = mapPane.getWorldToScreenTransform().getScaleX();
ReferencedEnvelope bounds = mapPane.getDisplayArea();
double dXScreenCoord = (width - MAP_NODE_MARGIN - oldWidth) / 2;
double dXWorldCoord = dXScreenCoord / scale;
bounds.translate(-1 * dXWorldCoord , 0);
mapPane.setDisplayArea(bounds);
mapPane.deleteGraphics();
clearCoordinateDisplay();
}
} catch (NullPointerException e) { }
}
示例2: afterImageMove
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
* Called after the base image has been dragged. Sets the new map area and
* transforms
*
* @param env
* the display area (world coordinates) prior to the image being
* moved
* @param paintArea
* the current drawing area (screen units)
*/
private void afterImageMove() {
final ReferencedEnvelope env = content.getViewport().getBounds();
if (env == null)
return;
final int dx = imageOrigin.x;
final int dy = imageOrigin.y;
final DirectPosition2D newPos = new DirectPosition2D(dx, dy);
screenToWorld.transform(newPos, newPos);
env.translate(env.getMinimum(0) - newPos.x, env.getMaximum(1) - newPos.y);
doSetDisplayArea(env);
imageOrigin.setLocation(0, 0);
redrawBaseImage = true;
}