本文整理汇总了Java中org.geotools.geometry.DirectPosition2D.getX方法的典型用法代码示例。如果您正苦于以下问题:Java DirectPosition2D.getX方法的具体用法?Java DirectPosition2D.getX怎么用?Java DirectPosition2D.getX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.geometry.DirectPosition2D
的用法示例。
在下文中一共展示了DirectPosition2D.getX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMouseClicked
import org.geotools.geometry.DirectPosition2D; //导入方法依赖的package包/类
/**
* Zoom out by the currently set increment, with the map
* centred at the location (in world coords) of the mouse
* click
*
* @param ev the mouse event
*/
@Override
public void onMouseClicked(final MapMouseEvent ev) {
if ( !isTriggerMouseButton(ev) ) { return; }
final Rectangle paneArea = getMapPane().getBounds();
final DirectPosition2D mapPos = ev.getMapPosition();
final double scale = getMapPane().getWorldToScreenTransform().getScaleX();
final double newScale = scale / zoom;
final DirectPosition2D corner = new DirectPosition2D(mapPos.getX() - 0.5d * paneArea.width / newScale,
mapPos.getY() + 0.5d * paneArea.height / newScale);
final Envelope2D newMapArea = new Envelope2D();
newMapArea.setFrameFromCenter(mapPos, corner);
getMapPane().setDisplayArea(newMapArea);
}
示例2: getWorldCoordinates
import org.geotools.geometry.DirectPosition2D; //导入方法依赖的package包/类
private static Coordinate[] getWorldCoordinates(
final double minX,
final double minY,
final double maxX,
final double maxY,
final int numPointsPerSegment,
final MathTransform gridToCRS )
throws MismatchedDimensionException,
TransformException {
final Point2D[] gridCoordinates = getGridCoordinates(
minX,
minY,
maxX,
maxY,
numPointsPerSegment);
final Coordinate[] worldCoordinates = new Coordinate[gridCoordinates.length];
for (int i = 0; i < gridCoordinates.length; i++) {
final DirectPosition2D worldPt = new DirectPosition2D();
final DirectPosition2D dp = new DirectPosition2D(
gridCoordinates[i]);
gridToCRS.transform(
dp,
worldPt);
worldCoordinates[i] = new Coordinate(
worldPt.getX(),
worldPt.getY());
}
return worldCoordinates;
}