Revision 9529 branches/piloto3d/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/FLayoutUtilities.java

View differences:

FLayoutUtilities.java
44 44
 */
45 45
package com.iver.cit.gvsig.project.documents.layout;
46 46

  
47
import java.awt.Point;
48 47
import java.awt.geom.AffineTransform;
49 48
import java.awt.geom.NoninvertibleTransformException;
50 49
import java.awt.geom.Point2D;
......
54 53
import org.cresques.cts.IProjection;
55 54

  
56 55
import com.iver.cit.gvsig.fmap.ViewPort;
56
import com.iver.cit.gvsig.gui.layout.Attributes;
57 57

  
58 58

  
59 59
/**
......
222 222
	}
223 223

  
224 224
	/**
225
	 * Obtiene el punto ajustado al grid del layout.
225
	 * Obtiene el rect?ngulo ajustado al grid del layout.
226 226
	 *
227
	 * @param p Punto a ajustar.
227
	 * @param re Rect?ngulo a ajustar.
228 228
	 * @param distX Distancia m?nima en pixels de X.
229 229
	 * @param distY Distancia m?nima en pixels de Y.
230 230
	 * @param at Matriz de transformaci?n.
231 231
	 */
232
	public static Point getPointGrid(Point p, double distX, double distY,
233
			AffineTransform at) {
234

  
232
	public static void setRectGrid(Rectangle2D re, double distX, double distY,
233
		AffineTransform at) {
235 234
		Point2D.Double auxp = FLayoutUtilities.fromSheetPoint(new Point2D.Double(
236
						0, 0), at);
237
		int x = (int)(((p.getX() - distX) % distX) - ((auxp.x) % distX));
238
		int y = (int)(((p.getY() - distY) % distY) - ((auxp.y) % distY));
239
		return new Point((int)(p.getX()-x),(int)(p.getY()-y));
235
					0, 0), at);
236
		double x = ((re.getMinX() - distX) % distX) - ((auxp.x) % distX);
237
		double y = ((re.getMinY() - distY) % distY) - ((auxp.y) % distY);
238
		double w = (((re.getWidth() + (distX / 2)) % distX));
239
		double h = (((re.getHeight() + (distY / 2)) % distY));
240
		re.setRect(re.getMinX() - (x), re.getMinY() - (y),
241
			(re.getWidth() + (distX / 2)) - (w),
242
			(re.getHeight() + (distY / 2)) - (h));
240 243
	}
241 244

  
242 245
	/**
......
288 291
	public static long getScaleView(ViewPort viewPort,double wcm,double wpixels) {
289 292
		double dpi = wpixels/wcm*2.54;
290 293
		IProjection proj = viewPort.getProjection();
291

  
294
		
292 295
		//if (viewPort.getImageSize() == null)
293 296
		//    return -1;
294 297
		if (viewPort.getAdjustedExtent() == null) {

Also available in: Unified diff