/**
* Zoom to the given coordinates with the given width and height.
*
* @param x
* upper left corner X coordinate
* @param y
* upper left corner Y coordinate
* @param widthOfNewView
* widht of the new view
* @param heightOfNewView
* height of the new view
* @throws NoninvertibleTransformException
* throws an exception when the transformation fails
*/
public final void zoom(final int x, final int y,
final double widthOfNewView, final double heightOfNewView)
throws NoninvertibleTransformException {
LayerViewPanel lvp = this.layerViewPanels.iterator().next();
double zoomFactor = Math.min(lvp.getWidth() / widthOfNewView,
lvp.getHeight() / heightOfNewView);
double realWidthOfNewView = lvp.getWidth() / zoomFactor;
double realHeightOfNewView = lvp.getHeight() / zoomFactor;
IEnvelope zoomEnvelope;
try {
zoomEnvelope = this.toModelEnvelope(x - Viewport.ZERO_POINT_FIVE
* realWidthOfNewView, x + Viewport.ZERO_POINT_FIVE
* realWidthOfNewView, y - Viewport.ZERO_POINT_FIVE
* realHeightOfNewView, y + Viewport.ZERO_POINT_FIVE
* realHeightOfNewView);
} catch (NoninvertibleTransformException ex) {
this.zoomToFullExtent();
return;
}
this.zoom(zoomEnvelope);
}
Viewport.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:geoxygene
作者:
评论列表
文章目录