27 |
27 |
import java.awt.event.MouseEvent;
|
28 |
28 |
import java.awt.geom.Rectangle2D;
|
29 |
29 |
|
|
30 |
import org.gvsig.app.project.documents.layout.DefaultLayoutContext;
|
30 |
31 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
|
31 |
32 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap;
|
32 |
33 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutMoveListener;
|
33 |
34 |
import org.gvsig.app.project.documents.layout.tools.listener.LayoutToolListener;
|
34 |
35 |
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
|
35 |
36 |
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
|
|
37 |
import org.slf4j.Logger;
|
|
38 |
import org.slf4j.LoggerFactory;
|
36 |
39 |
|
37 |
40 |
/**
|
38 |
41 |
* Behaviour que espera un listener de tipo MoveListener.
|
... | ... | |
57 |
60 |
* @see org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior#paintComponent(java.awt.Graphics)
|
58 |
61 |
*/
|
59 |
62 |
public void paintComponent(Graphics g) {
|
|
63 |
// save original clip area
|
|
64 |
Rectangle2D origClip = g.getClipBounds();
|
|
65 |
// draw cached image
|
|
66 |
g.drawImage(getLayoutControl().getImage(), 0, 0,
|
|
67 |
getLayoutControl().getComponent());
|
|
68 |
|
60 |
69 |
IFFrameUseFMap[] fframes = getLayoutControl().getLayoutContext().getSelectedFFrames(IFFrameUseFMap.class);
|
61 |
70 |
for (int i = 0; i < fframes.length; i++) {
|
62 |
|
IFFrameUseFMap fframe = (IFFrameUseFMap) fframes[i];
|
|
71 |
IFFrameUseFMap fframe = fframes[i];
|
63 |
72 |
Rectangle2D.Double rec =
|
64 |
|
((IFFrame) fframe).getBoundingBox(getLayoutControl()
|
65 |
|
.getAT());
|
|
73 |
((IFFrame) fframe).getBoundingBox(getLayoutControl().getAT());
|
66 |
74 |
|
67 |
75 |
if (getLayoutControl().getImage() != null) {
|
68 |
|
rec =
|
69 |
|
(Rectangle2D.Double) rec
|
70 |
|
.createIntersection(getLayoutControl()
|
71 |
|
.getComponent().getVisibleRect());
|
|
76 |
rec = (Rectangle2D.Double) rec
|
|
77 |
.createIntersection(getLayoutControl()
|
|
78 |
.getComponent().getVisibleRect());
|
72 |
79 |
}
|
73 |
80 |
|
74 |
81 |
if (fframe.getBufferedImage() != null) {
|
75 |
|
getLayoutControl().getLayoutDraw().drawHandlers(
|
76 |
|
(Graphics2D) g, Color.black);
|
|
82 |
// clear the fframe rectangle
|
|
83 |
Color c = g.getColor();
|
|
84 |
g.setColor(fframe.getMapContext().getViewPort().getBackColor());
|
|
85 |
g.fillRect((int) rec.x, (int) rec.y, (int) rec.width,
|
|
86 |
(int) rec.height);
|
|
87 |
g.setColor(c);
|
|
88 |
|
|
89 |
// draw the cached image in the new position
|
77 |
90 |
g.clipRect((int) rec.x, (int) rec.y, (int) rec.width,
|
78 |
91 |
(int) rec.height);
|
79 |
92 |
|
... | ... | |
85 |
98 |
- getLayoutControl().getPointAnt().y,
|
86 |
99 |
getLayoutControl().getComponent());
|
87 |
100 |
|
|
101 |
// force a full fframe redrawn for the next drawing cycle
|
88 |
102 |
fframe.refresh();
|
89 |
103 |
}
|
90 |
104 |
}
|
91 |
|
|
92 |
|
// g.setClip(rClip);
|
|
105 |
// draw handlers and ruler
|
|
106 |
g.setClip(origClip);
|
93 |
107 |
getLayoutControl().getLayoutDraw().drawHandlers((Graphics2D) g,
|
94 |
108 |
Color.black);
|
95 |
109 |
g.drawImage(getLayoutControl().getImgRuler(), 0, 0, getLayoutControl()
|
96 |
110 |
.getComponent());
|
97 |
|
|
98 |
111 |
}
|
99 |
112 |
|
100 |
113 |
/**
|