svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / tools / Behavior / GeoMoveBehavior.java @ 2894
History | View | Annotate | Download (5.97 KB)
1 | 2894 | nacho | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2004 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 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | * Av. Blasco Ib??ez, 50
|
||
24 | * 46010 VALENCIA
|
||
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | package com.iver.cit.gvsig.fmap.tools.Behavior; |
||
42 | |||
43 | import java.awt.Cursor; |
||
44 | import java.awt.Graphics; |
||
45 | import java.awt.Image; |
||
46 | import java.awt.Point; |
||
47 | import java.awt.Toolkit; |
||
48 | import java.awt.event.MouseEvent; |
||
49 | import java.awt.event.MouseWheelEvent; |
||
50 | import java.awt.geom.Point2D; |
||
51 | |||
52 | import javax.swing.ImageIcon; |
||
53 | |||
54 | import com.iver.cit.gvsig.fmap.MapControl; |
||
55 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
56 | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
||
57 | import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
||
58 | import com.iver.cit.gvsig.fmap.tools.Listeners.PanListener; |
||
59 | import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener; |
||
60 | |||
61 | |||
62 | /**
|
||
63 | * Behaviour que espera un listener de tipo GeoMoveListener.
|
||
64 | * Nacho Brodin (brodin_ign@gva.es)
|
||
65 | *
|
||
66 | */
|
||
67 | public class GeoMoveBehavior extends Behavior { |
||
68 | |||
69 | private PanListener listener;
|
||
70 | private Cursor cur = null; |
||
71 | |||
72 | private final Image defaultCursor = new ImageIcon(MapControl.class.getResource( |
||
73 | "images/CruxCursor.png")).getImage();
|
||
74 | private final Image handCursor = new ImageIcon(MapControl.class.getResource( |
||
75 | "images/Hand.gif")).getImage();
|
||
76 | |||
77 | private FLyrRaster lyrRaster = null; |
||
78 | private String pathToFile = null; |
||
79 | private boolean isMoveable = false; |
||
80 | |||
81 | /**
|
||
82 | * Crea un nuevo RectangleBehavior.
|
||
83 | *
|
||
84 | * @param zili listener.
|
||
85 | */
|
||
86 | public GeoMoveBehavior(PanListener zili) {
|
||
87 | listener = zili; |
||
88 | cur = zili.getCursor(); |
||
89 | } |
||
90 | |||
91 | /**
|
||
92 | * Coloca el cursor del rat?n con el icono adecuado cuando entra dentro de la
|
||
93 | * imagen.
|
||
94 | */
|
||
95 | public void mouseMoved(MouseEvent e) throws BehaviorException { |
||
96 | ViewPort vp = getMapControl().getMapContext().getViewPort(); |
||
97 | Point2D pto = vp.toMapPoint(e.getX(), e.getY());
|
||
98 | //System.out.println(pto);
|
||
99 | |||
100 | } |
||
101 | |||
102 | /**
|
||
103 | * Obtiene el cursor actual
|
||
104 | */
|
||
105 | public Cursor getCursor() { |
||
106 | return this.cur; |
||
107 | } |
||
108 | /* (non-Javadoc)
|
||
109 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
|
||
110 | */
|
||
111 | public ToolListener getListener() {
|
||
112 | // TODO Auto-generated method stub
|
||
113 | return null; |
||
114 | } |
||
115 | /* (non-Javadoc)
|
||
116 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getMapControl()
|
||
117 | */
|
||
118 | public MapControl getMapControl() {
|
||
119 | // TODO Auto-generated method stub
|
||
120 | return super.getMapControl(); |
||
121 | } |
||
122 | /* (non-Javadoc)
|
||
123 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseClicked(java.awt.event.MouseEvent)
|
||
124 | */
|
||
125 | public void mouseClicked(MouseEvent e) throws BehaviorException { |
||
126 | // TODO Auto-generated method stub
|
||
127 | super.mouseClicked(e);
|
||
128 | } |
||
129 | /* (non-Javadoc)
|
||
130 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseDragged(java.awt.event.MouseEvent)
|
||
131 | */
|
||
132 | public void mouseDragged(MouseEvent e) throws BehaviorException { |
||
133 | // TODO Auto-generated method stub
|
||
134 | super.mouseDragged(e);
|
||
135 | } |
||
136 | /* (non-Javadoc)
|
||
137 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseEntered(java.awt.event.MouseEvent)
|
||
138 | */
|
||
139 | public void mouseEntered(MouseEvent e) throws BehaviorException { |
||
140 | // TODO Auto-generated method stub
|
||
141 | super.mouseEntered(e);
|
||
142 | } |
||
143 | /* (non-Javadoc)
|
||
144 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseExited(java.awt.event.MouseEvent)
|
||
145 | */
|
||
146 | public void mouseExited(MouseEvent e) throws BehaviorException { |
||
147 | // TODO Auto-generated method stub
|
||
148 | super.mouseExited(e);
|
||
149 | } |
||
150 | |||
151 | /* (non-Javadoc)
|
||
152 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mousePressed(java.awt.event.MouseEvent)
|
||
153 | */
|
||
154 | public void mousePressed(MouseEvent e) throws BehaviorException { |
||
155 | // TODO Auto-generated method stub
|
||
156 | super.mousePressed(e);
|
||
157 | } |
||
158 | /* (non-Javadoc)
|
||
159 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseReleased(java.awt.event.MouseEvent)
|
||
160 | */
|
||
161 | public void mouseReleased(MouseEvent e) throws BehaviorException { |
||
162 | // TODO Auto-generated method stub
|
||
163 | super.mouseReleased(e);
|
||
164 | } |
||
165 | /* (non-Javadoc)
|
||
166 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#mouseWheelMoved(java.awt.event.MouseWheelEvent)
|
||
167 | */
|
||
168 | public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException { |
||
169 | // TODO Auto-generated method stub
|
||
170 | super.mouseWheelMoved(e);
|
||
171 | } |
||
172 | /* (non-Javadoc)
|
||
173 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics)
|
||
174 | */
|
||
175 | public void paintComponent(Graphics g) { |
||
176 | // TODO Auto-generated method stub
|
||
177 | super.paintComponent(g);
|
||
178 | } |
||
179 | /* (non-Javadoc)
|
||
180 | * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setMapControl(com.iver.cit.gvsig.fmap.MapControl)
|
||
181 | */
|
||
182 | public void setMapControl(MapControl mc) { |
||
183 | // TODO Auto-generated method stub
|
||
184 | super.setMapControl(mc);
|
||
185 | } |
||
186 | |||
187 | /**
|
||
188 | * @return Returns the lyrRaster.
|
||
189 | */
|
||
190 | public FLyrRaster getLyrRaster() {
|
||
191 | return lyrRaster;
|
||
192 | } |
||
193 | |||
194 | /**
|
||
195 | * @param lyrRaster The lyrRaster to set.
|
||
196 | */
|
||
197 | public void setLyrRaster(FLyrRaster lyrRaster) { |
||
198 | this.lyrRaster = lyrRaster;
|
||
199 | } |
||
200 | |||
201 | /**
|
||
202 | * @return Returns the pathToFile.
|
||
203 | */
|
||
204 | public String getPathToFile() { |
||
205 | return pathToFile;
|
||
206 | } |
||
207 | |||
208 | /**
|
||
209 | * @param pathToFile The pathToFile to set.
|
||
210 | */
|
||
211 | public void setPathToFile(String pathToFile) { |
||
212 | this.pathToFile = pathToFile;
|
||
213 | } |
||
214 | } |