Revision 5770
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameView.java | ||
---|---|---|
317 | 317 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
318 | 318 |
BufferedImage imgBase) throws com.iver.cit.gvsig.fmap.DriverException { |
319 | 319 |
Rectangle2D.Double r = getBoundingBox(at); |
320 |
if (origin!=null && origin.equals(layout.getRectOrigin()) && layout!=null && layout.getAT().getScaleX()==scaleAnt && m_image!=null && !refresh){ |
|
321 |
g.translate(r.getX(),r.getY()); |
|
322 |
g.drawImage(m_image,0,0,layout); |
|
323 |
g.translate(-r.getX(),-r.getY()); |
|
324 |
scaleAnt=layout.getAT().getScaleX(); |
|
325 |
origin=(Point)layout.getRectOrigin().clone(); |
|
326 |
return; |
|
327 |
} |
|
328 | 320 |
if (getRotation()!=0) |
329 |
g.rotate(Math.toRadians(getRotation()), r.x + (r.width / 2), |
|
330 |
r.y + (r.height / 2)); |
|
331 |
|
|
332 |
if (intersects(rv, r)) { |
|
321 |
g.rotate(Math.toRadians(getRotation()), r.x + (r.width / 2), |
|
322 |
r.y + (r.height / 2)); |
|
323 |
if (intersects(rv, r)) { |
|
333 | 324 |
if (getFMap() == null) { |
334 | 325 |
drawEmpty(g); |
335 | 326 |
} else { |
... | ... | |
340 | 331 |
(int) r.getWidth(), (int) r.getHeight()); |
341 | 332 |
|
342 | 333 |
if (getQuality() == PRESENTACION) { |
343 |
if (rv.intersects(r)) { |
|
334 |
if (rv.intersects(r)) { |
|
335 |
if (origin!=null && origin.equals(layout.getRectOrigin()) && layout!=null && layout.getAT().getScaleX()==scaleAnt && m_image!=null && !refresh){ |
|
336 |
g.translate(r.getX(),r.getY()); |
|
337 |
g.drawImage(m_image,0,0,layout); |
|
338 |
g.translate(-r.getX(),-r.getY()); |
|
339 |
scaleAnt=layout.getAT().getScaleX(); |
|
340 |
origin=(Point)layout.getRectOrigin().clone(); |
|
341 |
if (getRotation()!=0) |
|
342 |
g.rotate(Math.toRadians(-getRotation()), r.x + (r.width / 2), |
|
343 |
r.y + (r.height / 2)); |
|
344 |
return; |
|
345 |
} |
|
344 | 346 |
ViewPort viewPort = this.getFMap().getViewPort(); |
345 | 347 |
Color theBackColor = viewPort.getBackColor(); |
346 | 348 |
|
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/dialogs/JPRotation.java | ||
---|---|---|
43 | 43 |
import javax.swing.JPanel; |
44 | 44 |
import java.awt.BorderLayout; |
45 | 45 |
import java.awt.Component; |
46 |
import java.awt.event.KeyEvent; |
|
47 | 46 |
|
48 | 47 |
import javax.swing.ImageIcon; |
49 | 48 |
import javax.swing.JButton; |
... | ... | |
62 | 61 |
private JButton bRight = null; |
63 | 62 |
public void setRotation(double rot){ |
64 | 63 |
getPRotationView().setRotation(rot); |
65 |
getTxtRotation().setText(String.valueOf(rot)); |
|
64 |
//getTxtRotation().setText(String.valueOf(rot)); |
|
65 |
setTextRotation(rot); |
|
66 | 66 |
} |
67 |
private void setTextRotation(double d) { |
|
68 |
String s=String.valueOf(d); |
|
69 |
if (s.endsWith(".0")) { |
|
70 |
txtRotation.setText(s.substring(0,s.length()-2)); |
|
71 |
}else { |
|
72 |
txtRotation.setText(s); |
|
73 |
} |
|
74 |
} |
|
67 | 75 |
public double getRotation(){ |
68 | 76 |
return getPRotationView().getRotation(); |
69 | 77 |
} |
70 | 78 |
/** |
71 |
* This method initializes pRotationView
|
|
72 |
*
|
|
73 |
* @return javax.swing.JPanel
|
|
74 |
*/
|
|
79 |
* This method initializes pRotationView |
|
80 |
* |
|
81 |
* @return javax.swing.JPanel |
|
82 |
*/ |
|
75 | 83 |
private JPRotationView getPRotationView() { |
76 | 84 |
if (pRotationView == null) { |
77 | 85 |
pRotationView = new JPRotationView(); |
... | ... | |
83 | 91 |
} |
84 | 92 |
|
85 | 93 |
/** |
86 |
* This method initializes pButtons
|
|
87 |
*
|
|
88 |
* @return javax.swing.JPanel
|
|
89 |
*/
|
|
94 |
* This method initializes pButtons |
|
95 |
* |
|
96 |
* @return javax.swing.JPanel |
|
97 |
*/ |
|
90 | 98 |
private JPanel getPButtons() { |
91 | 99 |
if (pButtons == null) { |
92 | 100 |
pButtons = new JPanel(); |
... | ... | |
98 | 106 |
} |
99 | 107 |
|
100 | 108 |
/** |
101 |
* This method initializes bLeft
|
|
102 |
*
|
|
103 |
* @return javax.swing.JButton
|
|
104 |
*/
|
|
109 |
* This method initializes bLeft |
|
110 |
* |
|
111 |
* @return javax.swing.JButton |
|
112 |
*/ |
|
105 | 113 |
private JButton getBLeft() { |
106 | 114 |
if (bLeft == null) { |
107 | 115 |
bLeft = new JButton(); |
108 | 116 |
bLeft.setPreferredSize(new java.awt.Dimension(24,24)); |
109 | 117 |
bLeft.setIcon(new ImageIcon(AddLayer.class.getClassLoader() |
110 | 118 |
.getResource("images/leftrotation.png"))); |
111 |
bLeft.addActionListener(new java.awt.event.ActionListener() {
|
|
112 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
119 |
bLeft.addActionListener(new java.awt.event.ActionListener() { |
|
120 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
113 | 121 |
setRotation(Double.parseDouble(txtRotation.getText())+1); |
114 | 122 |
getTxtRotation().setText(txtRotation.getText()); |
115 | 123 |
getPRotationView().repaint(); |
... | ... | |
120 | 128 |
} |
121 | 129 |
|
122 | 130 |
/** |
123 |
* This method initializes txtRotation
|
|
124 |
*
|
|
125 |
* @return javax.swing.JTextField
|
|
126 |
*/
|
|
131 |
* This method initializes txtRotation |
|
132 |
* |
|
133 |
* @return javax.swing.JTextField |
|
134 |
*/ |
|
127 | 135 |
private JTextField getTxtRotation() { |
128 | 136 |
if (txtRotation == null) { |
129 | 137 |
txtRotation = new JTextField(); |
130 | 138 |
txtRotation.setPreferredSize(new java.awt.Dimension(45,24)); |
131 |
txtRotation.addKeyListener(new java.awt.event.KeyAdapter() {
|
|
132 |
public void keyReleased(java.awt.event.KeyEvent e) {
|
|
139 |
txtRotation.addKeyListener(new java.awt.event.KeyAdapter() { |
|
140 |
public void keyReleased(java.awt.event.KeyEvent e) { |
|
133 | 141 |
//ensureDouble(txtRotation); |
134 |
if (e.getKeyCode()==KeyEvent.VK_ENTER){ |
|
142 |
//if (e.getKeyCode()==KeyEvent.VK_ENTER){ |
|
143 |
if (txtRotation.getText().endsWith(".")) { |
|
144 |
return; |
|
145 |
} |
|
135 | 146 |
try{ |
136 | 147 |
setRotation(Double.parseDouble(txtRotation.getText())); |
137 | 148 |
}catch (NumberFormatException e1) { |
138 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),"numero_incorrecto");
|
|
149 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"numero_incorrecto"));
|
|
139 | 150 |
} |
140 | 151 |
getPRotationView().repaint(); |
141 |
} |
|
152 |
//}
|
|
142 | 153 |
} |
143 | 154 |
}); |
144 |
txtRotation.setText(String.valueOf(getRotation())); |
|
155 |
//txtRotation.setText(String.valueOf(getRotation())); |
|
156 |
setTextRotation(getRotation()); |
|
145 | 157 |
} |
146 | 158 |
return txtRotation; |
147 | 159 |
} |
160 |
|
|
148 | 161 |
/** |
149 | 162 |
* Asegura cutremente que no se meten valores que no sean. |
150 | 163 |
* El funcionamiento consiste en si el ?ltimo car?cter escrito |
151 | 164 |
* no vale para formar un int entonces se elimina. |
152 |
*
|
|
165 |
* |
|
153 | 166 |
* enteros. |
154 | 167 |
* @param tf |
155 | 168 |
*/ |
... | ... | |
168 | 181 |
} |
169 | 182 |
}*/ |
170 | 183 |
/** |
171 |
* This method initializes bRight
|
|
172 |
*
|
|
173 |
* @return javax.swing.JButton
|
|
174 |
*/
|
|
184 |
* This method initializes bRight |
|
185 |
* |
|
186 |
* @return javax.swing.JButton |
|
187 |
*/ |
|
175 | 188 |
private JButton getBRight() { |
176 | 189 |
if (bRight == null) { |
177 | 190 |
bRight = new JButton(); |
178 | 191 |
bRight.setPreferredSize(new java.awt.Dimension(24,24)); |
179 | 192 |
bRight.setIcon(new ImageIcon(AddLayer.class.getClassLoader() |
180 | 193 |
.getResource("images/rightrotation.png"))); |
181 |
bRight.addActionListener(new java.awt.event.ActionListener() {
|
|
182 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
194 |
bRight.addActionListener(new java.awt.event.ActionListener() { |
|
195 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
183 | 196 |
setRotation(Double.parseDouble(txtRotation.getText())-1); |
184 | 197 |
getTxtRotation().setText(txtRotation.getText()); |
185 | 198 |
getPRotationView().repaint(); |
... | ... | |
206 | 219 |
|
207 | 220 |
/** |
208 | 221 |
* This method initializes this |
209 |
*
|
|
222 |
* |
|
210 | 223 |
* @return void |
211 | 224 |
*/ |
212 | 225 |
private void initialize() { |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/dialogs/FFrameViewDialog.java | ||
---|---|---|
447 | 447 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
448 | 448 |
fframeview.setBoundBox(FLayoutUtilities.toSheetRect( |
449 | 449 |
rect, m_layout.getAT())); |
450 |
|
|
450 |
fframeview.setRotation(getPRotation().getRotation()); |
|
451 | 451 |
if (m_projectView != null) { |
452 | 452 |
fframeview.setLinked(getChbEnlaceVivo().isSelected()); |
453 | 453 |
fframeview.setName(m_projectView.getName()); |
... | ... | |
467 | 467 |
.getSelectedIndex()); |
468 | 468 |
fframeview.setBoundBox(FLayoutUtilities.toSheetRect( |
469 | 469 |
rect, m_layout.getAT())); |
470 |
fframeview.setRotation(getPRotation().getRotation()); |
|
470 |
|
|
471 | 471 |
/* for (int i=0;i<m_layout.getFFrames().size();i++){ |
472 | 472 |
IFFrame fframe=(IFFrame)m_layout.getFFrames().get(i); |
473 | 473 |
if (fframe instanceof FFrameScaleBar){ |
Also available in: Unified diff