77 |
77 |
* @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics)
|
78 |
78 |
*/
|
79 |
79 |
public void paintComponent(Graphics 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 |
// VolatileImage image = createVolatileImage();
|
|
81 |
// Graphics gh = image.createGraphics();
|
|
82 |
// gh.setColor(getLayoutControl().getBackground());
|
|
83 |
// gh.fillRect(0, 0, image.getWidth(), image.getHeight());
|
|
84 |
//
|
|
85 |
// getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) gh);
|
|
86 |
// gh.drawImage(getLayoutControl().getImgRuler(),0,0,null);
|
|
87 |
// gh.drawImage(getLayoutControl().getImage(),0,0,null);
|
|
88 |
// getLayoutControl().getLayoutDraw().drawGrid((Graphics2D) gh);
|
|
89 |
//
|
|
90 |
// getLayoutControl().getLayoutDraw().drawHandlers((Graphics2D)gh, Color.black);
|
|
91 |
// gh.setColor(Color.black);
|
|
92 |
// gh.setXORMode(Color.white);
|
84 |
93 |
|
85 |
|
getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) gh);
|
86 |
|
gh.drawImage(getLayoutControl().getImgRuler(),0,0,null);
|
87 |
|
gh.drawImage(getLayoutControl().getImage(),0,0,null);
|
88 |
|
getLayoutControl().getLayoutDraw().drawGrid((Graphics2D) gh);
|
|
94 |
if (getLayoutControl().getImage() != null)
|
|
95 |
{
|
|
96 |
g.setColor(getLayoutControl().getBackground());
|
|
97 |
g.fillRect(0, 0, getLayoutControl().getImage().getWidth(), getLayoutControl().getImage().getHeight());
|
|
98 |
|
|
99 |
getLayoutControl().getLayoutDraw().drawRectangle((Graphics2D) g);
|
|
100 |
|
|
101 |
g.setColor(Color.black);
|
|
102 |
|
|
103 |
g.drawImage(getLayoutControl().getImage(),0,0,null);
|
|
104 |
g.drawImage(getLayoutControl().getImgRuler(), 0,0,null);
|
|
105 |
}
|
89 |
106 |
|
90 |
|
getLayoutControl().getLayoutDraw().drawHandlers((Graphics2D)gh, Color.black);
|
91 |
|
gh.setColor(Color.black);
|
92 |
|
gh.setXORMode(Color.white);
|
|
107 |
g.setColor(Color.black);
|
|
108 |
g.setXORMode(Color.white);
|
93 |
109 |
|
|
110 |
|
94 |
111 |
if (getLayoutControl().isReSel()) {
|
95 |
112 |
Rectangle reSel=getLayoutControl().getReSel();
|
96 |
113 |
reSel=new Rectangle();
|
97 |
114 |
reSel.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), getLayoutControl().getLastPoint());
|
98 |
|
gh.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
|
115 |
// gh.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
|
116 |
g.drawRect(reSel.x, reSel.y, reSel.width, reSel.height);
|
99 |
117 |
}
|
100 |
118 |
IFFrame[] frames = getLayoutControl().getLayoutContext().getFFrameSelected();
|
101 |
119 |
for (int i = 0; i < frames.length; i++) {
|
102 |
|
gh.setColor(Color.black);
|
|
120 |
// gh.setColor(Color.black);
|
103 |
121 |
frames[i].drawHandlers((Graphics2D) g);
|
104 |
122 |
int difx = (getLayoutControl().getLastPoint().x - getLayoutControl().getFirstPoint().x);
|
105 |
123 |
int dify = (getLayoutControl().getLastPoint().y - getLayoutControl().getFirstPoint().y);
|
... | ... | |
107 |
125 |
Rectangle2D rectangle = frames[i].getMovieRect(difx, dify);
|
108 |
126 |
if (rectangle == null)
|
109 |
127 |
return;
|
110 |
|
((Graphics2D) gh).rotate(Math.toRadians(frames[i]
|
|
128 |
((Graphics2D) g).rotate(Math.toRadians(frames[i]
|
111 |
129 |
.getRotation()), rectangle.getX()
|
112 |
130 |
+ (rectangle.getWidth() / 2), rectangle.getY()
|
113 |
131 |
+ (rectangle.getHeight() / 2));
|
114 |
132 |
|
115 |
133 |
if (rectangle != null && dragged && !getLayoutControl().isReSel()) {
|
116 |
|
gh.drawRect((int) rectangle.getMinX(), (int) rectangle
|
|
134 |
g.drawRect((int) rectangle.getMinX(), (int) rectangle
|
117 |
135 |
.getMinY(), (int) rectangle.getWidth(),
|
118 |
136 |
(int) rectangle.getHeight());
|
119 |
137 |
}
|
120 |
138 |
|
121 |
|
((Graphics2D) gh).rotate(Math.toRadians(-frames[i]
|
|
139 |
((Graphics2D) g).rotate(Math.toRadians(-frames[i]
|
122 |
140 |
.getRotation()), rectangle.getX()
|
123 |
141 |
+ (rectangle.getWidth() / 2), rectangle.getY()
|
124 |
142 |
+ (rectangle.getHeight() / 2));
|
... | ... | |
127 |
145 |
}
|
128 |
146 |
|
129 |
147 |
// long t2 = System.currentTimeMillis();
|
130 |
|
gh.setPaintMode();
|
|
148 |
g.setPaintMode();
|
131 |
149 |
// getLayoutControl().getLayoutDraw().drawRuler((Graphics2D) gh, Color.black);
|
132 |
|
g.drawImage(image,0,0,null);
|
|
150 |
// g.drawImage(image,0,0,null);
|
133 |
151 |
|
134 |
152 |
|
135 |
153 |
|