Statistics
| Revision:

gvsig-raster / org.gvsig.raster.tools / trunk / org.gvsig.raster.tools / org.gvsig.raster.tools.app.basic / src / main / java / org / gvsig / raster / tools / app / basic / tool / selectrasterlayer / SelectImageListImpl.java @ 2480

History | View | Annotate | Download (3.3 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.tools.app.basic.tool.selectrasterlayer;
23

    
24
import java.awt.Cursor;
25
import java.awt.Image;
26
import java.awt.Point;
27
import java.awt.Toolkit;
28
import java.awt.geom.Point2D;
29

    
30
import org.gvsig.andami.IconThemeHelper;
31
import org.gvsig.fmap.mapcontrol.MapControl;
32
import org.gvsig.fmap.mapcontrol.tools.Events.PointEvent;
33
import org.gvsig.fmap.mapcontrol.tools.Listeners.PointListener;
34

    
35

    
36
/**
37
 * <p>Listener to select the upper layer with raster data, that has information in the associated <code>MapControl</code> object, down
38
 *  the position selected by the mouse.</p>
39
 *
40
 * @author Nacho Brodin (nachobrodin@gmail.com)
41
 */
42
public class SelectImageListImpl implements PointListener {
43
        /**
44
         * The image to display when the cursor is active.
45
         */
46
        /*private final Image isaveraster = new ImageIcon(MapControl.class.getResource(
47
                                "images/pointcursor-icon.png")).getImage();*/
48
        
49

    
50
        /**
51
         * The cursor used to work with this tool listener.
52
         * 
53
         * @see #getCursor()
54
         */
55
        private Cursor cur = null;
56

    
57
        /**
58
         * Reference to the <code>MapControl</code> object that uses.
59
         */
60
        protected MapControl mapCtrl;
61

    
62
        /**
63
         * World equivalent coordinates of the point 2D 
64
         */
65
        protected Point2D wcPoint = null;
66

    
67
        /**
68
         * <p>Creates a new <code>SelectImageListenerImpl</code> object.</p>
69
         * 
70
         * @param mapCtrl the <code>MapControl</code> where are stored the layers
71
         */
72
        public SelectImageListImpl(MapControl mapCtrl) {
73
                this.mapCtrl = mapCtrl;
74
        }
75

    
76
        /*
77
         * (non-Javadoc)
78
         * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
79
         */
80
        public void point(PointEvent event) {
81

    
82
        }
83

    
84
        /*
85
         * (non-Javadoc)
86
         * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
87
         */
88
        public Cursor getCursor() {
89
                if(cur == null) {
90
                        cur = Toolkit.getDefaultToolkit().createCustomCursor(getImageCursor(),
91
                                        new Point(16, 16), "");
92
                }
93
                return cur;
94
        }
95

    
96
        /*
97
         * (non-Javadoc)
98
         * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
99
         */
100
        public boolean cancelDrawing() {
101
                return true;
102
        }
103

    
104
        /*
105
         * (non-Javadoc)
106
         * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
107
         */
108
        public void pointDoubleClick(PointEvent event) {
109
        }
110

    
111
        /*
112
         * (non-Javadoc)
113
         * @see org.gvsig.fmap.mapcontrol.tools.Listeners.ToolListener#getImageCursor()
114
         */
115
        public Image getImageCursor() {
116
                return IconThemeHelper.getImage("zoom-pixel-cursor");
117
        }
118
}