public static Point2D . Double snapToNextHigherInActiveRegionResolution ( double x , double y , Window activeWindow ) { double minx = activeWindow . getRectangle ( ) . getBounds2D ( ) . getMinX ( ) ; double ewres = activeWindow . getWEResolution ( ) ; double xsnap = minx + ( Math . ceil ( ( x - minx ) / ewres ) * ewres ) ; double miny = activeWindow . getRectangle ( ) . getBounds2D ( ) . getMinY ( ) ; double nsres = activeWindow . getNSResolution ( ) ; double ysnap = miny + ( Math . ceil ( ( y - miny ) / nsres ) * nsres ) ; return new Point2D . Double ( xsnap , ysnap ) ; }
Moves the point given by X and Y to be on the grid of the active region .