Revision 28283 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/tools/behavior/LayoutSelectBehavior.java
LayoutSelectBehavior.java | ||
---|---|---|
46 | 46 |
import java.awt.Rectangle; |
47 | 47 |
import java.awt.event.MouseEvent; |
48 | 48 |
import java.awt.geom.Rectangle2D; |
49 |
import java.awt.image.VolatileImage; |
|
49 | 50 |
|
50 | 51 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
51 | 52 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
... | ... | |
76 | 77 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics) |
77 | 78 |
*/ |
78 | 79 |
public void paintComponent(Graphics g) { |
79 |
getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) g); |
|
80 |
VolatileImage image = createVolatileImage(); |
|
81 |
Graphics gh = image.createGraphics(); |
|
82 |
gh.setColor(getLayoutControl().getBackground()); |
|
83 |
gh.fillRect(0, 0, image.getWidth(), image.getHeight()); |
|
80 | 84 |
|
81 |
g.drawImage(getLayoutControl().getImage(), 0, 0, getLayoutControl()); |
|
85 |
getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) gh); |
|
86 |
getLayoutControl().getLayoutDraw().drawGrid((Graphics2D) gh); |
|
87 |
gh.drawImage(getLayoutControl().getImgRuler(),0,0,null); |
|
88 |
gh.drawImage(getLayoutControl().getImage(),0,0,null); |
|
89 |
getLayoutControl().getLayoutDraw().drawHandlers((Graphics2D)gh, Color.black); |
|
90 |
gh.setColor(Color.black); |
|
91 |
gh.setXORMode(Color.white); |
|
82 | 92 |
|
83 |
//getLayout().getLayoutDraw().drawHandlers((Graphics2D) g, Color.black); |
|
84 |
if (getLayoutControl().isReSel()) { |
|
93 |
if (getLayoutControl().isReSel()) { |
|
85 | 94 |
Rectangle reSel=getLayoutControl().getReSel(); |
86 | 95 |
reSel=new Rectangle(); |
87 | 96 |
reSel.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), getLayoutControl().getLastPoint()); |
88 |
g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height); |
|
97 |
gh.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
|
89 | 98 |
} |
90 | 99 |
IFFrame[] frames = getLayoutControl().getLayoutContext().getFFrameSelected(); |
91 | 100 |
for (int i = 0; i < frames.length; i++) { |
92 |
g.setColor(Color.black); |
|
101 |
gh.setColor(Color.black);
|
|
93 | 102 |
frames[i].drawHandlers((Graphics2D) g); |
94 | 103 |
int difx = (getLayoutControl().getLastPoint().x - getLayoutControl().getFirstPoint().x); |
95 | 104 |
int dify = (getLayoutControl().getLastPoint().y - getLayoutControl().getFirstPoint().y); |
... | ... | |
97 | 106 |
Rectangle2D rectangle = frames[i].getMovieRect(difx, dify); |
98 | 107 |
if (rectangle == null) |
99 | 108 |
return; |
100 |
((Graphics2D) g).rotate(Math.toRadians(frames[i] |
|
109 |
((Graphics2D) gh).rotate(Math.toRadians(frames[i]
|
|
101 | 110 |
.getRotation()), rectangle.getX() |
102 | 111 |
+ (rectangle.getWidth() / 2), rectangle.getY() |
103 | 112 |
+ (rectangle.getHeight() / 2)); |
104 | 113 |
|
105 | 114 |
if (rectangle != null && dragged && !getLayoutControl().isReSel()) { |
106 |
g.drawRect((int) rectangle.getMinX(), (int) rectangle |
|
115 |
gh.drawRect((int) rectangle.getMinX(), (int) rectangle
|
|
107 | 116 |
.getMinY(), (int) rectangle.getWidth(), |
108 | 117 |
(int) rectangle.getHeight()); |
109 | 118 |
} |
110 | 119 |
|
111 |
((Graphics2D) g).rotate(Math.toRadians(-frames[i] |
|
120 |
((Graphics2D) gh).rotate(Math.toRadians(-frames[i]
|
|
112 | 121 |
.getRotation()), rectangle.getX() |
113 | 122 |
+ (rectangle.getWidth() / 2), rectangle.getY() |
114 | 123 |
+ (rectangle.getHeight() / 2)); |
... | ... | |
116 | 125 |
} |
117 | 126 |
} |
118 | 127 |
|
119 |
//g.setClip(rClip); |
|
120 |
g.drawImage(getLayoutControl().getImgRuler(), 0, 0, getLayoutControl()); |
|
128 |
// long t2 = System.currentTimeMillis(); |
|
129 |
gh.setPaintMode(); |
|
130 |
// getLayoutControl().getLayoutDraw().drawRuler((Graphics2D) gh, Color.black); |
|
131 |
g.drawImage(image,0,0,null); |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
// getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) g); |
|
139 |
|
|
140 |
// g.drawImage(getLayoutControl().getImage(), 0, 0, getLayoutControl()); |
|
141 |
|
|
142 |
//getLayout().getLayoutDraw().drawHandlers((Graphics2D) g, Color.black); |
|
143 |
// if (getLayoutControl().isReSel()) { |
|
144 |
// Rectangle reSel=getLayoutControl().getReSel(); |
|
145 |
// reSel=new Rectangle(); |
|
146 |
// reSel.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), getLayoutControl().getLastPoint()); |
|
147 |
// g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height); |
|
148 |
// } |
|
149 |
// IFFrame[] frames = getLayoutControl().getLayoutContext().getFFrameSelected(); |
|
150 |
// for (int i = 0; i < frames.length; i++) { |
|
151 |
// g.setColor(Color.black); |
|
152 |
// frames[i].drawHandlers((Graphics2D) g); |
|
153 |
// int difx = (getLayoutControl().getLastPoint().x - getLayoutControl().getFirstPoint().x); |
|
154 |
// int dify = (getLayoutControl().getLastPoint().y - getLayoutControl().getFirstPoint().y); |
|
155 |
// if ((Math.abs(difx) > 3) || (Math.abs(dify) > 3)) { |
|
156 |
// Rectangle2D rectangle = frames[i].getMovieRect(difx, dify); |
|
157 |
// if (rectangle == null) |
|
158 |
// return; |
|
159 |
// ((Graphics2D) g).rotate(Math.toRadians(frames[i] |
|
160 |
// .getRotation()), rectangle.getX() |
|
161 |
// + (rectangle.getWidth() / 2), rectangle.getY() |
|
162 |
// + (rectangle.getHeight() / 2)); |
|
163 |
// |
|
164 |
// if (rectangle != null && dragged && !getLayoutControl().isReSel()) { |
|
165 |
// g.drawRect((int) rectangle.getMinX(), (int) rectangle |
|
166 |
// .getMinY(), (int) rectangle.getWidth(), |
|
167 |
// (int) rectangle.getHeight()); |
|
168 |
// } |
|
169 |
// |
|
170 |
// ((Graphics2D) g).rotate(Math.toRadians(-frames[i] |
|
171 |
// .getRotation()), rectangle.getX() |
|
172 |
// + (rectangle.getWidth() / 2), rectangle.getY() |
|
173 |
// + (rectangle.getHeight() / 2)); |
|
174 |
// |
|
175 |
// } |
|
176 |
// } |
|
177 |
// |
|
178 |
// //g.setClip(rClip); |
|
179 |
// g.drawImage(getLayoutControl().getImgRuler(), 0, 0, getLayoutControl()); |
|
121 | 180 |
} |
122 | 181 |
|
123 | 182 |
/** |
Also available in: Unified diff