svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / saveraster / map / SaveRasterListenerImpl.java @ 11267
History | View | Annotate | Download (2.51 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.rastertools.saveraster.map; |
20 |
|
21 |
import java.awt.Cursor; |
22 |
import java.awt.Image; |
23 |
import java.awt.Point; |
24 |
import java.awt.Toolkit; |
25 |
import java.awt.geom.Rectangle2D; |
26 |
|
27 |
import javax.swing.ImageIcon; |
28 |
|
29 |
import com.iver.cit.gvsig.fmap.MapControl; |
30 |
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent; |
31 |
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener; |
32 |
|
33 |
|
34 |
/**
|
35 |
* Implementaci?n de la interfaz RectangleListener como herramienta para
|
36 |
* realizar un Salvado a Raster.
|
37 |
*
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
39 |
*/
|
40 |
public class SaveRasterListenerImpl implements RectangleListener { |
41 |
private final Image isaveraster = new ImageIcon(MapControl.class.getResource( |
42 |
"images/RectSelectCursor.gif")).getImage();
|
43 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(isaveraster, |
44 |
new Point(16, 16), ""); |
45 |
protected MapControl mapCtrl;
|
46 |
|
47 |
protected Rectangle2D pixelRect = null; |
48 |
protected Rectangle2D rect = null; |
49 |
|
50 |
/**
|
51 |
* Crea un nuevo RectangleListenerImpl.
|
52 |
*
|
53 |
* @param mapCtrl MapControl.
|
54 |
*/
|
55 |
public SaveRasterListenerImpl(MapControl mapCtrl) {
|
56 |
this.mapCtrl = mapCtrl;
|
57 |
} |
58 |
|
59 |
/**
|
60 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
|
61 |
*/
|
62 |
public void rectangle(RectangleEvent event) { |
63 |
rect = event.getWorldCoordRect(); |
64 |
pixelRect = event.getPixelCoordRect(); |
65 |
} |
66 |
|
67 |
/**
|
68 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
|
69 |
*/
|
70 |
public Cursor getCursor() { |
71 |
return cur;
|
72 |
} |
73 |
|
74 |
/**
|
75 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
|
76 |
*/
|
77 |
public boolean cancelDrawing() { |
78 |
System.out.println("cancelDrawing del SaveRasterListenerImpl"); |
79 |
return true; |
80 |
} |
81 |
} |