Revision 17503 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/geolocation/listener/GeoLocationPanelListener.java
GeoLocationPanelListener.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import java.awt.event.ActionEvent; |
22 | 22 |
import java.awt.event.ActionListener; |
23 |
import java.awt.event.KeyEvent; |
|
24 |
import java.awt.event.KeyListener; |
|
23 | 25 |
import java.awt.geom.AffineTransform; |
24 | 26 |
import java.awt.geom.Rectangle2D; |
25 | 27 |
import java.io.BufferedReader; |
... | ... | |
51 | 53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
52 | 54 |
* |
53 | 55 |
*/ |
54 |
public class GeoLocationPanelListener implements ActionListener, DataInputContainerListener { |
|
56 |
public class GeoLocationPanelListener implements ActionListener, DataInputContainerListener, KeyListener {
|
|
55 | 57 |
|
56 | 58 |
private GeolocationBaseClassPanel panel = null; |
57 | 59 |
private boolean enableValueChangeEvent = false; |
... | ... | |
90 | 92 |
double psy = Double.parseDouble(panel.getPsy().getValue()); |
91 | 93 |
double rotx = Double.parseDouble(panel.getRotx().getValue()); |
92 | 94 |
double roty = Double.parseDouble(panel.getRoty().getValue()); |
95 |
if(psx == 0 || psy == 0) |
|
96 |
return; |
|
93 | 97 |
AffineTransform at = new AffineTransform(psx, roty, rotx, psy, ulx, uly); |
94 | 98 |
panel.getLayer().setAffineTransform(at); |
95 | 99 |
if(panel.getMapCtrl() != null) |
... | ... | |
105 | 109 |
return; |
106 | 110 |
} |
107 | 111 |
} |
112 |
|
|
113 |
if(e.getSource() == panel.getCancelButton()) { |
|
114 |
PluginServices.getMDIManager().closeWindow(((GeoLocationOpeningRasterPanel)panel).getDialog()); |
|
115 |
} |
|
108 | 116 |
|
109 | 117 |
Historical hist = panel.getHistorical(); |
110 | 118 |
if(hist == null) |
... | ... | |
277 | 285 |
} |
278 | 286 |
return new AffineTransform(result[0], result[1], result[2], result[3], result[4], result[5]); |
279 | 287 |
} |
288 |
|
|
289 |
/* |
|
290 |
* (non-Javadoc) |
|
291 |
* @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) |
|
292 |
*/ |
|
293 |
public void keyPressed(KeyEvent e) { |
|
294 |
|
|
295 |
} |
|
296 |
|
|
297 |
/** |
|
298 |
* Capturamos el evento de pulsar la tecla Enter y cancel. Cuando pulsamos enter |
|
299 |
* ejecuta el evento del bot?n de aplicar y cuando pulsamos cancel cerramos el cuadro |
|
300 |
* y no hacemos nada. |
|
301 |
*/ |
|
302 |
public void keyReleased(KeyEvent e) { |
|
303 |
if(e.getKeyCode() == KeyEvent.VK_ENTER) { |
|
304 |
ActionEvent ev = new ActionEvent(panel.getApplyButton(), 0, null); |
|
305 |
actionPerformed(ev); |
|
306 |
} |
|
307 |
|
|
308 |
if(e.getKeyCode() == KeyEvent.VK_ESCAPE && panel.getCancelButton() != null) { |
|
309 |
ActionEvent ev = new ActionEvent(panel.getCancelButton(), 0, null); |
|
310 |
actionPerformed(ev); |
|
311 |
} |
|
312 |
} |
|
313 |
|
|
314 |
/* |
|
315 |
* (non-Javadoc) |
|
316 |
* @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) |
|
317 |
*/ |
|
318 |
public void keyTyped(KeyEvent e) { |
|
319 |
} |
|
280 | 320 |
} |
Also available in: Unified diff