Revision 4776

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrame.java
65 65
import java.awt.Graphics2D;
66 66
import java.awt.Image;
67 67
import java.awt.Rectangle;
68
import java.awt.event.MouseEvent;
68 69
import java.awt.geom.AffineTransform;
69 70
import java.awt.geom.Point2D;
70 71
import java.awt.geom.Rectangle2D;
......
83 84
 * @author Vicente Caballero Navarro
84 85
 */
85 86
public abstract class FFrame implements IFFrame {
86
    private static final int N = 1;
87
    private static final int NE = 2;
88
    private static final int E = 3;
89
    private static final int SE = 4;
90
    private static final int S = 5;
91
    private static final int SO = 6;
92
    private static final int O = 7;
93
    private static final int NO = 8;
94
    private static final int RECT = 9;
95 87
    protected String m_name = "FFrame";
96 88
    private Rectangle2D.Double m_BoundBox = new Rectangle2D.Double();
97 89
    private Rectangle2D.Double m_BoundingBox = new Rectangle2D.Double();
98 90
    protected int m_Selected = 0;
99
    private Rectangle n = new Rectangle();
100
    private Rectangle ne = new Rectangle();
101
    private Rectangle e = new Rectangle();
102
    private Rectangle se = new Rectangle();
103
    private Rectangle s = new Rectangle();
104
    private Rectangle so = new Rectangle();
105
    private Rectangle o = new Rectangle();
106
    private Rectangle no = new Rectangle();
91
    protected Rectangle n = new Rectangle();
92
    protected Rectangle ne = new Rectangle();
93
    protected Rectangle e = new Rectangle();
94
    protected Rectangle se = new Rectangle();
95
    protected Rectangle s = new Rectangle();
96
    protected Rectangle so = new Rectangle();
97
    protected Rectangle o = new Rectangle();
98
    protected Rectangle no = new Rectangle();
107 99
    private String tag = null;
108 100
    protected int num = 0;
109 101
    private double m_rotation = 0;
110 102
    private int level = -1;
103
	private Rectangle2D lastMoveRect;
111 104

  
112 105
    /**
113 106
     * Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
......
176 169
     * @param p punto sobre el que se debe de establecer si se selecciona o no
177 170
     *        el fframe.
178 171
     */
179
    public void setSelected(Point2D.Double p) {
172
    public void setSelected(Point2D.Double p,MouseEvent e) {
180 173
        m_Selected = getContains(p);
181 174
    }
182 175

  
......
209 202
        double w = 0;
210 203
        double h = 0;
211 204

  
212
        Rectangle2D.Double rectaux = new Rectangle2D.Double(this.getBoundingBox(
205
        lastMoveRect = new Rectangle2D.Double(this.getBoundingBox(
213 206
                    null).x, this.getBoundingBox(null).y,
214 207
                this.getBoundingBox(null).width,
215 208
                this.getBoundingBox(null).height);
216 209
        Rectangle2D.Double rec = this.getBoundingBox(null);
217 210
        int difn = 0;
218 211
        difn = difx;
219
        x = rectaux.x;
220
        y = rectaux.y;
221
        w = rectaux.width;
222
        h = rectaux.height;
212
        x = lastMoveRect.getX();
213
        y = lastMoveRect.getY();
214
        w = lastMoveRect.getWidth();
215
        h = lastMoveRect.getHeight();
223 216

  
224 217
        switch (this.getSelected()) {
225 218
            case (RECT):
226
                rectaux.setRect((x + difx), (y + dify), w, h);
219
                lastMoveRect.setRect((x + difx), (y + dify), w, h);
227 220

  
228 221
                break;
229 222

  
......
235 228
                    y = y + dify;
236 229
                }
237 230

  
238
                rectaux.setRect(x, y, w, Math.abs(h - dify));
231
                lastMoveRect.setRect(x, y, w, Math.abs(h - dify));
239 232

  
240 233
                break;
241 234

  
......
247 240
                    x = x + difx;
248 241
                }
249 242

  
250
                rectaux.setRect(x, y, Math.abs(w - difx), h);
243
                lastMoveRect.setRect(x, y, Math.abs(w - difx), h);
251 244

  
252 245
                break;
253 246

  
......
257 250
                    y = rec.getMaxY() + dify;
258 251
                }
259 252

  
260
                rectaux.setRect(x, y, w, Math.abs(h + dify));
253
                lastMoveRect.setRect(x, y, w, Math.abs(h + dify));
261 254

  
262 255
                break;
263 256

  
......
267 260
                    x = rec.getMaxX() + difx;
268 261
                }
269 262

  
270
                rectaux.setRect(x, y, Math.abs(w + difx), h);
263
                lastMoveRect.setRect(x, y, Math.abs(w + difx), h);
271 264

  
272 265
                break;
273 266

  
......
280 273
                    y = y - difn;
281 274
                }
282 275

  
283
                rectaux.setRect(x, y, Math.abs(w + difn), Math.abs(h + difn));
276
                lastMoveRect.setRect(x, y, Math.abs(w + difn), Math.abs(h + difn));
284 277

  
285 278
                break;
286 279

  
......
294 287
                    y = y + difn;
295 288
                }
296 289

  
297
                rectaux.setRect(x, y, Math.abs(w - difn), Math.abs(h - difn));
290
                lastMoveRect.setRect(x, y, Math.abs(w - difn), Math.abs(h - difn));
298 291

  
299 292
                break;
300 293

  
......
305 298
                    x = rec.getMaxX() + difn;
306 299
                }
307 300

  
308
                rectaux.setRect(x, y, Math.abs(w + difn), Math.abs(h + difn));
301
                lastMoveRect.setRect(x, y, Math.abs(w + difn), Math.abs(h + difn));
309 302

  
310 303
                break;
311 304

  
......
318 311
                    x = x + difn;
319 312
                }
320 313

  
321
                rectaux.setRect(x, y, Math.abs(w - difn), Math.abs(h - difn));
314
                lastMoveRect.setRect(x, y, Math.abs(w - difn), Math.abs(h - difn));
322 315

  
323 316
                break;
324 317

  
325 318
            default:
326
                rectaux.setRect((x), (y), w, h);
319
                lastMoveRect.setRect((x), (y), w, h);
327 320
        }
328 321

  
329
        return rectaux;
322
        return lastMoveRect;
330 323
    }
331

  
332 324
    /**
325
     * Devuelve el rect?ngulo que representa el ?ltimo generado al desplazar o modificar el tama?o del fframe.
326
     *
327
     * @return Rectangle2D
328
     *
329
     */
330
    public Rectangle2D getLastMoveRect(){
331
    	return lastMoveRect;
332
    }
333
    /**
333 334
     * Devuelve un entero que representa el tipo de selecci?n que se ha
334 335
     * realizado sobre el fframe.
335 336
     *
......
819 820

  
820 821
        return xml;
821 822
    }
822
    
823

  
823 824
}

Also available in: Unified diff