Revision 18264 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/view/ViewDialog.java

View differences:

ViewDialog.java
198 198
		Rectangle2D r = getZoomCursorGraphicLayer().getCursorViewCoordinates();
199 199

  
200 200
		double x = r.getX(), y = r.getY(), w = r.getWidth(), h = r.getHeight();
201
		if(r.getWidth() >= r.getHeight()) { //La X y la W no varian
202
			h = (hWindow * r.getWidth()) / wWindow;
203
			y = r.getCenterY() - (h / 2);
204
		} else { //La Y y la H no varian
205
			w = (wWindow * r.getHeight()) / hWindow;
206
			x = r.getCenterX() - (r.getWidth() / 2);
201
		if(wWindow < hWindow) { //Si la de destino es m?s alta que ancha
202
			if((r.getWidth() / r.getHeight()) >= (wWindow / hWindow)) {
203
				h = (hWindow * r.getWidth()) / wWindow;
204
				y = r.getCenterY() - (h / 2);
205
			} else {
206
				w = (wWindow * r.getHeight()) / hWindow;
207
				x = r.getCenterX() - (w / 2);
208
			}
209
		} else { //Si la de destino es m?s ancha que alta
210
			if((r.getWidth() / r.getHeight()) <= (wWindow / hWindow)) {
211
				w = (wWindow * r.getHeight()) / hWindow;
212
				x = r.getCenterX() - (w / 2);
213
			} else {
214
				h = (hWindow * r.getWidth()) / wWindow;
215
				y = r.getCenterY() - (h / 2);
216
			}
207 217
		}
208
		r = new Rectangle2D.Double(x, y, w, h);
218
		r = new Rectangle2D.Double(x, y + h, w, h);
209 219
		Point2D p1 = zoomPixelControl.getCanvas().viewCoordsToWorld(new Point2D.Double(r.getX(), r.getY()));
210 220
		Point2D p2 = zoomPixelControl.getCanvas().viewCoordsToWorld(new Point2D.Double(r.getX() + r.getWidth(), r.getY() + r.getHeight()));
211 221
		return new Rectangle2D.Double(	Math.min(p1.getX(), p2.getX()), 

Also available in: Unified diff