Revision 1822 branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrame.java
FFrame.java | ||
---|---|---|
53 | 53 |
import com.iver.cit.gvsig.gui.layout.Layout; |
54 | 54 |
import com.iver.cit.gvsig.gui.layout.dialogs.Tag; |
55 | 55 |
import com.iver.cit.gvsig.project.Project; |
56 |
import com.iver.cit.gvsig.project.ProjectMap; |
|
56 | 57 |
|
57 | 58 |
import com.iver.utiles.XMLEntity; |
58 | 59 |
|
... | ... | |
80 | 81 |
* @author Vicente Caballero Navarro |
81 | 82 |
*/ |
82 | 83 |
public abstract class FFrame implements IFFrame { |
83 |
private static final int N = 1; |
|
84 |
private static final int NE = 2; |
|
85 |
private static final int E = 3; |
|
86 |
private static final int SE = 4; |
|
87 |
private static final int S = 5; |
|
88 |
private static final int SO = 6; |
|
89 |
private static final int O = 7; |
|
90 |
private static final int NO = 8; |
|
91 |
private static final int RECT = 9; |
|
92 |
|
|
93 |
/** FFrame no selecccionado. */ |
|
94 |
public static final int NOSELECT = 0; |
|
84 |
|
|
95 | 85 |
protected String m_name = "FFrame"; |
96 | 86 |
private Rectangle2D.Double m_BoundBox = new Rectangle2D.Double(); |
97 | 87 |
private Rectangle2D.Double m_BoundingBox = new Rectangle2D.Double(); |
... | ... | |
107 | 97 |
private String tag = null; |
108 | 98 |
protected int num = 0; |
109 | 99 |
|
100 |
public void refreshHandlers(AffineTransform at){ |
|
101 |
int size = 10; |
|
102 |
Rectangle2D.Double r = getBoundingBox(at); |
|
103 |
no.setRect((int) r.x - size, (int) r.y - size, size, size); |
|
104 |
ne.setRect((int) r.getMaxX(), (int) r.y - size, size, size); |
|
105 |
so.setRect((int) r.x - size, (int) r.getMaxY(), size, size); |
|
106 |
se.setRect((int) r.getMaxX(), (int) r.getMaxY(), size, size); |
|
107 |
n.setRect((int) r.getCenterX() - (size / 2), (int) r.y - size, size, size); |
|
108 |
s.setRect((int) r.getCenterX() - (size / 2), (int) r.getMaxY(), size, size); |
|
109 |
o.setRect((int) r.x - size, (int) r.getCenterY() - (size / 2), size, size); |
|
110 |
e.setRect((int) r.getMaxX(), (int) r.getCenterY() - (size / 2), size, size); |
|
111 |
} |
|
110 | 112 |
/** |
111 | 113 |
* Dibuja los handlers sobre el boundingBox en el graphics que se pasa como |
112 | 114 |
* par?metro. |
... | ... | |
114 | 116 |
* @param g Graphics sobre el que dibujar. |
115 | 117 |
*/ |
116 | 118 |
public void drawHandlers(Graphics2D g) { |
117 |
int size = 10; |
|
118 |
Rectangle2D.Double r = getBoundingBox(null); |
|
119 |
|
|
120 |
//g.drawRect((int) r.x, (int) r.y, (int) r.width, (int) r.height); |
|
121 |
g.fillRect((int) r.x - size, (int) r.y - size, size, size); |
|
122 |
no.setRect((int) r.x - size, (int) r.y - size, size, size); |
|
123 |
g.fillRect((int) r.getMaxX(), (int) r.y - size, size, size); |
|
124 |
ne.setRect((int) r.getMaxX(), (int) r.y - size, size, size); |
|
125 |
g.fillRect((int) r.x - size, (int) r.getMaxY(), size, size); |
|
126 |
so.setRect((int) r.x - size, (int) r.getMaxY(), size, size); |
|
127 |
g.fillRect((int) r.getMaxX(), (int) r.getMaxY(), size, size); |
|
128 |
se.setRect((int) r.getMaxX(), (int) r.getMaxY(), size, size); |
|
129 |
g.fillRect((int) r.getCenterX() - (size / 2), (int) r.y - size, size, |
|
130 |
size); |
|
131 |
n.setRect((int) r.getCenterX() - (size / 2), (int) r.y - size, size, |
|
132 |
size); |
|
133 |
g.fillRect((int) r.getCenterX() - (size / 2), (int) r.getMaxY(), size, |
|
134 |
size); |
|
135 |
s.setRect((int) r.getCenterX() - (size / 2), (int) r.getMaxY(), size, |
|
136 |
size); |
|
137 |
g.fillRect((int) r.x - size, (int) r.getCenterY() - (size / 2), size, |
|
138 |
size); |
|
139 |
o.setRect((int) r.x - size, (int) r.getCenterY() - (size / 2), size, |
|
140 |
size); |
|
141 |
g.fillRect((int) r.getMaxX(), (int) r.getCenterY() - (size / 2), size, |
|
142 |
size); |
|
143 |
e.setRect((int) r.getMaxX(), (int) r.getCenterY() - (size / 2), size, |
|
144 |
size); |
|
119 |
refreshHandlers(null); |
|
120 |
g.fillRect((int) no.x, (int) no.y , no.width, no.height); |
|
121 |
g.fillRect((int) ne.x, (int) ne.y , ne.width, ne.height); |
|
122 |
g.fillRect((int) so.x, (int) so.y , so.width, so.height); |
|
123 |
g.fillRect((int) se.x, (int) se.y , se.width, se.height); |
|
124 |
g.fillRect((int) n.x, (int) n.y , n.width, n.height); |
|
125 |
g.fillRect((int) s.x, (int) s.y , s.width, s.height); |
|
126 |
g.fillRect((int) o.x, (int) o.y , o.width, o.height); |
|
127 |
g.fillRect((int) e.x, (int) e.y , e.width, e.height); |
|
145 | 128 |
} |
146 | 129 |
|
147 | 130 |
/** |
... | ... | |
333 | 316 |
* |
334 | 317 |
* @return entero que representa como esta contenido el punto. |
335 | 318 |
*/ |
336 |
public int getContains(Point2D.Double p) {
|
|
337 |
if (n.contains(p.x, p.y)) {
|
|
319 |
public int getContains(Point2D p) { |
|
320 |
if (n.contains(p.getX(), p.getY())) {
|
|
338 | 321 |
return N; |
339 |
} else if (ne.contains(p.x, p.y)) {
|
|
322 |
} else if (ne.contains(p.getX(), p.getY())) {
|
|
340 | 323 |
return NE; |
341 |
} else if (e.contains(p.x, p.y)) {
|
|
324 |
} else if (e.contains(p.getX(), p.getY())) {
|
|
342 | 325 |
return E; |
343 |
} else if (e.contains(p.x, p.y)) {
|
|
326 |
} else if (e.contains(p.getX(), p.getY())) {
|
|
344 | 327 |
return E; |
345 |
} else if (se.contains(p.x, p.y)) {
|
|
328 |
} else if (se.contains(p.getX(), p.getY())) {
|
|
346 | 329 |
return SE; |
347 |
} else if (s.contains(p.x, p.y)) {
|
|
330 |
} else if (s.contains(p.getX(), p.getY())) {
|
|
348 | 331 |
return S; |
349 |
} else if (so.contains(p.x, p.y)) {
|
|
332 |
} else if (so.contains(p.getX(), p.getY())) {
|
|
350 | 333 |
return SO; |
351 |
} else if (o.contains(p.x, p.y)) {
|
|
334 |
} else if (o.contains(p.getX(), p.getY())) {
|
|
352 | 335 |
return O; |
353 |
} else if (no.contains(p.x, p.y)) {
|
|
336 |
} else if (no.contains(p.getX(), p.getY())) {
|
|
354 | 337 |
return NO; |
355 |
} else if (getBoundingBox(null).contains(p.x, p.y)) {
|
|
338 |
} else if (getBoundingBox(null).contains(p.getX(), p.getY())) {
|
|
356 | 339 |
return RECT; |
357 | 340 |
} |
358 | 341 |
|
... | ... | |
465 | 448 |
* |
466 | 449 |
* @param r Rect?ngulo en cent?metros. |
467 | 450 |
*/ |
468 |
public void setBoundBox(Rectangle2D.Double r) {
|
|
451 |
public void setBoundBox(Rectangle2D r) { |
|
469 | 452 |
m_BoundBox.setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); |
470 | 453 |
} |
471 | 454 |
|
... | ... | |
636 | 619 |
} catch (NullPointerException npe) { |
637 | 620 |
} |
638 | 621 |
} |
639 |
public IFFrame cloneFFrame(Layout l,Project p){
|
|
640 |
return createFFrame(this.getXMLEntity(),l,p);
|
|
622 |
public IFFrame cloneFFrame(Layout l){ |
|
623 |
return createFFrame(this.getXMLEntity(),l,((ProjectMap)l.getViewModel()).getProject());
|
|
641 | 624 |
} |
642 | 625 |
} |
Also available in: Unified diff