Revision 2893

View differences:

trunk/extensions/extGeoreferencing/config/config.xml
17 17
			active="true" 
18 18
			priority="1">
19 19
			<tool-bar name="GeoreferencingTools">
20
				<action-tool icon="images/mas.png" action-command="GEO_ZOOM_IN" tooltip="Zoom_Mas"/>
21
				<action-tool icon="images/menos.png" action-command="GEO_ZOOM_OUT"  tooltip="Zoom_Menos"/>
20
				<action-tool icon="images/mas.png" action-command="GEO_ZOOM" tooltip="Zoom_Mas"/>
22 21
				<action-tool icon="images/clean.png" action-command="GEO_PAN"  tooltip="Mover"/>
23 22
				<action-tool icon="images/back.png" action-command="GEO_ZOOM_PREV"  tooltip="Zoom_previo"/>
24 23
			</tool-bar>
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/georeferencing/GeoreferencingToolsModule.java
110 110
		
111 111
		if (s.compareTo("GEO_PAN") == 0) {
112 112
			mapCtrl.setTool("geoPan");
113
		} else if (s.compareTo("GEO_ZOOM_IN") == 0) {
114
			mapCtrl.setTool("geoZoomIn");
115
		} else if (s.compareTo("GEO_ZOOM_OUT") == 0) {
116
			mapCtrl.setTool("geoZoomOut");
113
		} else if (s.compareTo("GEO_ZOOM") == 0) {
114
			mapCtrl.setTool("geoZoom");
117 115
		} else if (s.compareTo("GEO_ZOOM_PREV") == 0) {
118 116
			System.out.println("-->GeoZoomPrevio");
119 117
		}
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/ZoomInGeorefListenerImpl.java
48 48

  
49 49
import javax.swing.ImageIcon;
50 50

  
51
import org.cresques.px.Extent;
52

  
53
import com.iver.andami.PluginServices;
54
import com.iver.cit.gvsig.fmap.DriverException;
55 51
import com.iver.cit.gvsig.fmap.MapControl;
56
import com.iver.cit.gvsig.fmap.ViewPort;
57
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
58
import com.iver.cit.gvsig.fmap.layers.FLyrRaster;
59 52
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent;
60 53
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener;
61
import com.iver.cit.gvsig.gui.View;
62
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel;
63 54

  
64 55

  
65 56
/**
......
69 60
 * @author Nacho Brodin (brodin_ign@gva.es)
70 61
 */
71 62
public class ZoomInGeorefListenerImpl implements RectangleListener {
72
	private final Image izoomin = new ImageIcon(MapControl.class.getResource(
63
	private static final Image izoomin = new ImageIcon(MapControl.class.getResource(
73 64
				"images/ZoomInCursor.gif")).getImage();
74
	private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(izoomin,
75
			new Point(16, 16), "");
65
	
66
	public static Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(izoomin, new Point(16, 16), "");
67
	
76 68
	private MapControl mapCtrl;
77 69

  
78 70
	/**
......
82 74
	 */
83 75
	public ZoomInGeorefListenerImpl(MapControl mapCtrl) {
84 76
		this.mapCtrl = mapCtrl;
85
		System.out.println("****ZOOMIN");
86

  
87
		
88
		/*((View)theView).addMouseMotionListener(new java.awt.event.MouseMotionListener() { 
89
			public void mouseMoved(java.awt.event.MouseEvent e) {
90
				System.out.println("-->Move");
91
			}
92
			public void mouseDragged(java.awt.event.MouseEvent e) {
93
				System.out.println("-->Dragg");
94
			}
95
		});*/
96 77
	}
97 78

  
98 79
	/**
......
101 82
	public void rectangle(RectangleEvent event) {
102 83
		Rectangle2D rect = event.getWorldCoordRect();
103 84
		Rectangle2D pixelRect = event.getPixelCoordRect();
104
		Rectangle2D.Double r = new Rectangle2D.Double();
105
		
106
		//Obtenemos la capa a georreferenciar a trav?s del nombre
107
		String fileName = SelectFilePanel.getLyrName();
108
		View theView = (View) PluginServices.getMDIManager().getActiveView();
109
		FLyrRaster lyrRaster = (FLyrRaster)theView.getMapControl().getMapContext().getLayers().getLayer(fileName);
110
		lyrRaster.setTempExtent(new Extent(rect));
111
		try {
112
			lyrRaster.load();
113
		} catch (DriverIOException e) {
114
			
115
		}
116
        
117
        lyrRaster.setVisible(true);
118
			
119
		//theView.getMapControl().getMapContext().invalidate();
120
		
121
		ViewPort vp = mapCtrl.getMapContext().getViewPort();
122
		vp.setExtent(vp.getExtent());
123
		/*if ((pixelRect.getWidth() < 3) && (pixelRect.getHeight() < 3))
124
		{
125
			if (vp.getExtent()!=null){
126
				double factor = 0.6;
127
				double nuevoX = rect.getMaxX() -
128
					((vp.getExtent().getWidth() * factor) / 2.0);
129
				double nuevoY = rect.getMaxY() -
130
					((vp.getExtent().getHeight() * factor) / 2.0);
131
				r.x = nuevoX;
132
				r.y = nuevoY;
133
				r.width = vp.getExtent().getWidth() * factor;
134
				r.height = vp.getExtent().getHeight() * factor;
135
				vp.setExtent(r);
136
			}
137
		}
138
		else
139
		{
140
		    vp.setExtent(event.getWorldCoordRect());
141
		}*/
142
		// mapCtrl.drawMap(false);
143
		
85
		Rectangle2D.Double r = new Rectangle2D.Double();	
144 86
	}
145 87

  
146 88
	/**
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/RedimBehavior.java
1
/* 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.Color;
44
import java.awt.Cursor;
45
import java.awt.Graphics;
46
import java.awt.Image;
47
import java.awt.Point;
48
import java.awt.Rectangle;
49
import java.awt.Toolkit;
50
import java.awt.event.MouseEvent;
51
import java.awt.geom.Point2D;
52
import java.awt.geom.Rectangle2D;
53
import java.awt.image.BufferedImage;
54
import java.io.File;
55

  
56
import javax.swing.ImageIcon;
57

  
58
import org.cresques.io.GeoRasterFile;
59
import org.cresques.px.Extent;
60

  
61
import com.hardcode.driverManager.DriverLoadException;
62
import com.iver.andami.messages.NotificationManager;
63
import com.iver.cit.gvsig.fmap.MapControl;
64
import com.iver.cit.gvsig.fmap.ViewPort;
65
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
66
import com.iver.cit.gvsig.fmap.layers.FLyrRaster;
67
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
68
import com.iver.cit.gvsig.fmap.layers.RasterAdapter;
69
import com.iver.cit.gvsig.fmap.layers.RasterFileAdapter;
70
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
71
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener;
72
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
73
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel;
74

  
75

  
76
/**
77
 * Behaviour que espera un listener de tipo RedimListener.
78
 * Nacho Brodin (brodin_ign@gva.es)
79
 *
80
 */
81
public class RedimBehavior extends Behavior {
82
	private RectangleListener listener;
83
	private Cursor cur = null;
84
	
85
	private final Image iconHoriz = new ImageIcon(MapControl.class.getResource(
86
	"images/FlechaHorizCursor.gif")).getImage();
87
	private final Image iconVert = new ImageIcon(MapControl.class.getResource(
88
	"images/FlechaVertCursor.gif")).getImage();
89
	private final Image iconInclDer = new ImageIcon(MapControl.class.getResource(
90
	"images/FlechaInclDerCursor.gif")).getImage();
91
	private final Image iconInclIzq = new ImageIcon(MapControl.class.getResource(
92
	"images/FlechaInclIzqCursor.gif")).getImage();
93
	private final Image defaultCursor = new ImageIcon(MapControl.class.getResource(
94
	"images/ZoomInCursor.gif")).getImage();
95
	
96
	private final int WIDTH_BORDER = 25; 
97
	private final int LONG_CORNER = 35;
98
	
99
	/**
100
	 * Cada elemento del vector corresponde a un tipo de icono que
101
	 * estar? a true si est? activo y a false si no lo est?.
102
	 * horizontal, vertical, inclinado derecha, inclinado izquierda
103
	 */
104
	private boolean[] iconActive = {false, false, false, false};
105
		
106
	private Point2D ul = null;
107
	private Point2D lr = null;
108
	private Point2D tmpUl = null;
109
	private Point2D tmpLr = null;
110
	
111
	/**
112
	 * Cada elemento corresponde a la acivaci?n de redimensionado en una
113
	 * direcci?n que estar? activa a true.
114
	 * vertical derecha, vertical izquierda, horizontal arriba, horizontal abajo,
115
	 * inclinado
116
	 */
117
	private boolean[] redimActive = new boolean[5];
118
	
119
	private Point2D pointInit = null;
120
	private Rectangle2D rectInit = null;
121
	
122
	private FLyrRaster lyrRaster = null;
123
	private String	pathToFile = null;
124
		
125
	/**
126
	 * Crea un nuevo RectangleBehavior.
127
	 *
128
	 * @param zili listener.
129
	 */
130
	public RedimBehavior(RectangleListener zili) {
131
		listener = zili;
132
		for(int i=0; i<redimActive.length;i++)
133
			redimActive[i] = false;
134
	}
135

  
136
	/**
137
	 * Cuando se produce un evento de pintado dibujamos el marco de la imagen para
138
	 * que el usuario pueda seleccionar y redimensionar.
139
	 */
140
	public void paintComponent(Graphics g) {
141
		
142
		BufferedImage img = getMapControl().getImage();
143
		g.drawImage(img, 0, 0, null);
144
		g.setColor(Color.red);
145
		ViewPort vp = getMapControl().getMapContext().getViewPort();
146

  
147
		Rectangle r = new Rectangle();
148
		
149
		if(tmpLr == null || tmpUl == null){
150
			ul = vp.fromMapPoint(this.lyrRaster.getMinX(), this.lyrRaster.getMinY());
151
			lr = vp.fromMapPoint(this.lyrRaster.getMaxX(), this.lyrRaster.getMaxY());
152
			r.setFrameFromDiagonal(ul, lr);
153
		}else
154
			r.setFrameFromDiagonal(tmpUl, tmpLr);
155
			
156
		g.drawRect(r.x, r.y, r.width, r.height);	
157
		
158
	}
159

  
160
	/**
161
	 * Reimplementaci?n del m?todo mousePressed de Behavior. Cuando se pulsa
162
	 * estando sobre el marco de la imagen activamos la posibilidad de arrastrar
163
	 * para redimensionar la imagen.
164
	 *
165
	 * @param e MouseEvent
166
	 */
167
	public void mousePressed(MouseEvent e) {
168
		if (e.getButton() == MouseEvent.BUTTON1) {
169
			tmpUl = ul;
170
			tmpLr = lr;
171
			if(iconActive[0]){//Estirar en horizontal activado
172
				if(e.getX() > (tmpLr.getX() - WIDTH_BORDER) && e.getX() < tmpLr.getX())
173
					redimActive[0] = true;
174
				if(e.getX() < (tmpUl.getX() + WIDTH_BORDER) && e.getX() > tmpUl.getX())
175
					redimActive[1] = true;
176
			}
177
			if(iconActive[1]){//Estirar en vertical activado
178
				if(e.getY() < (tmpLr.getY() + WIDTH_BORDER) && e.getY() > tmpLr.getY())
179
					redimActive[3] = true;
180
				if(e.getY() > (tmpUl.getY() - WIDTH_BORDER) && e.getY() < tmpUl.getY())
181
					redimActive[2] = true;
182
			}
183
			if(iconActive[2] || iconActive[3]){ //Estirar en oblicuo activado
184
				redimActive[4] = true;
185
				pointInit = e.getPoint();
186
				rectInit =  new Rectangle2D.Double(tmpUl.getX(), tmpUl.getY(), tmpLr.getX() - tmpUl.getX(), tmpLr.getY() - tmpUl.getY());
187
			}
188
			
189
		}
190

  
191
		if (listener.cancelDrawing()) {
192
			getMapControl().cancelDrawing();
193
		}
194

  
195
		getMapControl().repaint();
196
	}
197

  
198
	/**
199
	 * Reimplementaci?n del m?todo mouseReleased de Behavior. Desactivamos
200
	 * los flags de redimensionado y a partir de la selecci?n del usuario 
201
	 * creamos un nuevo extent para la imagen. Con este extent creamos una nueva
202
	 * capa que sustituir? a la anterior.
203
	 *
204
	 * @param e MouseEvent
205
	 *
206
	 * @throws BehaviorException Excepci?n lanzada cuando el Behavior.
207
	 */
208
	public void mouseReleased(MouseEvent e) throws BehaviorException {
209

  
210
		if (e.getButton() == MouseEvent.BUTTON1) {
211
			//Desactivamos los flags de redimensionado
212
			for(int i=0;i<redimActive.length;i++)
213
				redimActive[i] = false;
214
			//Asignamos el nuevo extent a la imagen
215
			ViewPort vp = getMapControl().getMapContext().getViewPort();
216
			Extent ext = new Extent(vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getX(),
217
									vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getY(),
218
									vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getX(),
219
									vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getY());
220
			
221
			if(this.pathToFile != null && this.lyrRaster != null){
222
				File fich = new File(this.pathToFile);
223
				RasterAdapter adapter = new RasterFileAdapter(fich);
224
				try{
225
					adapter.setDriver(LayerFactory.getDM().getDriver("gvSIG Image Driver"));
226
				}catch(DriverLoadException exc){
227
					NotificationManager.addError("No se pudo acceder a los drivers", exc);
228
				}
229
				FLyrRaster capa = new FLyrRaster();
230
				if (capa != null) {
231
					capa.setName(lyrRaster.getName());
232
					capa.setSource(adapter);
233
					capa.setProjection(lyrRaster.getProjection());
234
					capa.setTempExtent(ext);
235
					capa.setExtentFlag(GeoRasterFile.ASSIGNED_EXTENT);
236
					try {
237
						capa.load();
238
					} catch (DriverIOException exc) {
239
				
240
					}
241
			        capa.setVisible(true);
242
				}
243
				
244
				getMapControl().getMapContext().getLayers().removeLayer(lyrRaster.getName());
245
				lyrRaster = null;
246
				getMapControl().getMapContext().getLayers().addLayer(capa);
247
				this.setLyrRaster(capa);
248
				getMapControl().repaint();
249
				tmpUl = null;
250
				tmpLr = null;
251
			}
252
		}
253

  
254
		
255
	}
256

  
257
	/**
258
	 * Al arrastrar cuando se ha pulsado sobre el marco de la imagen recalculamos
259
	 * el marco de la imagen 
260
	 *
261
	 * @param e MouseEvent
262
	 */
263
	public void mouseDragged(MouseEvent e) {
264
		double longLadoLargo = Math.abs(tmpLr.getX() - tmpUl.getX());
265
		double longLadoCorto = Math.abs(tmpLr.getY() - tmpUl.getY());
266
		
267
		if(redimActive[0]){//vertical derecha
268
			double newLadoLargo = (e.getX() - tmpUl.getX());
269
			double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
270
			double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
271
			tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoCorto/2));
272
			tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));			
273
		}
274
		if(redimActive[1]){//vertical izquierda
275
			double newLadoLargo = (e.getX() - tmpLr.getX());
276
			double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
277
			double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
278
			tmpLr = new Point2D.Double(tmpLr.getX(), coordCentro + (newLadoCorto/2));
279
			tmpUl = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
280
		}
281
		if(redimActive[2]){//horizontal abajo
282
			double newLadoCorto = (e.getY() - tmpLr.getY());
283
			double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
284
			double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
285
			tmpLr = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpLr.getY());
286
			tmpUl = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
287
		}
288
		if(redimActive[3]){//horizontal arriba
289
			double newLadoCorto = (e.getY() - tmpUl.getY());
290
			double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
291
			double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
292
			tmpUl = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpUl.getY());
293
			tmpLr = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
294
		}
295
		if(redimActive[4]){//inclinado
296
			double distX = (e.getX() - pointInit.getX());
297
			double distY = (e.getY() - pointInit.getY());
298
			double incrLadoLargo = 0D, incrLadoCorto = 0D;
299
			incrLadoLargo = distX;
300
			//Calculamos la distancia que incrementaremos al lado corto
301
			boolean ejeXLargo = true; 
302
			if(longLadoCorto > longLadoLargo){
303
				double tmp = longLadoLargo;
304
				longLadoLargo = longLadoCorto;
305
				longLadoCorto = tmp;
306
				ejeXLargo = false;
307
			}	
308
			
309
			incrLadoCorto = (incrLadoLargo * longLadoCorto) / longLadoLargo;
310
			Point2D antUl = tmpUl;
311
			Point2D antLr = tmpLr;
312
			if(distX > 0 && e.getX() > lr.getX()){
313
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
314
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
315
			}else if(distX < 0 && e.getX() < ul.getX()){
316
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
317
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
318
			}else if(distX > 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
319
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
320
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
321
			}else if(distX < 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
322
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
323
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
324
			}
325
			//A partir de un tama?o m?nimo no reducimos m?s
326
			if((tmpLr.getX() - tmpUl.getX()) < 100 || (tmpUl.getY() - tmpLr.getY()) < 100){
327
				tmpUl = antUl;
328
				tmpLr = antLr;
329
			}
330
				
331
		}
332
		
333
		getMapControl().repaint();
334
	}
335

  
336
	/**
337
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener)
338
	 */
339
	public void setListener(ToolListener listener) {
340
		this.listener = (RectangleListener) listener;
341
	}
342

  
343
	/**
344
	 * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
345
	 */
346
	public ToolListener getListener() {
347
		return listener;
348
	}
349
	
350
	/**
351
	 * Cuando movemos el rat?n detecta si estamos en el marco de la 
352
	 * imagen y pone el icono del cursor del rat?n adecuado.
353
	 */
354
	public void mouseMoved(MouseEvent e) throws BehaviorException {
355
		ViewPort vp = getMapControl().getMapContext().getViewPort();
356
		double wcX = vp.toMapPoint(e.getX(), e.getY()).getX();
357
		double wcY = vp.toMapPoint(e.getX(), e.getY()).getY();
358
		int iconPosActive = -1;
359
		
360
		//Flecha horizontal
361
		if(	((wcX > lyrRaster.getMinX() && wcX < lyrRaster.getMinX() + WIDTH_BORDER) ||
362
			 (wcX < lyrRaster.getMaxX() && wcX > lyrRaster.getMaxX() - WIDTH_BORDER )) &&
363
			(wcY < (lyrRaster.getMaxY() - LONG_CORNER)) &&
364
			(wcY > (lyrRaster.getMinY() + LONG_CORNER))){	
365
			getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconHoriz,
366
					new Point(16, 16), ""));
367
			iconPosActive = 0;
368
						
369
		}else{
370
			//Flecha Vertical
371
			if(	((wcY > lyrRaster.getMinY() && wcY < lyrRaster.getMinY() + WIDTH_BORDER) ||
372
				 (wcY < lyrRaster.getMaxY() && wcY > lyrRaster.getMaxY() - WIDTH_BORDER )) &&
373
				(wcX < (lyrRaster.getMaxX() - LONG_CORNER)) &&
374
				(wcX > (lyrRaster.getMinX() + LONG_CORNER))){	
375
					getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconVert,
376
							new Point(16, 16), ""));
377
					iconPosActive = 1;
378
			}else{
379
				//Flecha oblicua derecha
380
				if((wcX > (lyrRaster.getMaxX() - LONG_CORNER) && wcX < lyrRaster.getMaxX() &&
381
					wcY < (lyrRaster.getMinY() + LONG_CORNER) && wcY > lyrRaster.getMinY()) ||
382
				   (wcX > lyrRaster.getMinX() && wcX < (lyrRaster.getMinX() + LONG_CORNER) &&
383
					wcY < lyrRaster.getMaxY() && wcY > (lyrRaster.getMaxY() - LONG_CORNER))){
384
					getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclIzq,
385
							new Point(16, 16), ""));
386
					iconPosActive = 2;
387
				}else{
388
					//Flecha oblicua izquierda
389
					if((wcX > lyrRaster.getMinX() && wcX < (lyrRaster.getMinX() + LONG_CORNER) &&
390
						wcY < (lyrRaster.getMinY() + LONG_CORNER) && wcY > lyrRaster.getMinY()) ||
391
					   (wcX > (lyrRaster.getMaxX() - LONG_CORNER) && wcX < lyrRaster.getMaxX() &&
392
						wcY > (lyrRaster.getMaxY() - LONG_CORNER) && wcY < lyrRaster.getMaxY())){
393
						getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclDer,
394
									new Point(16, 16), ""));
395
						iconPosActive = 3;
396
					}else{
397
						getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(defaultCursor,
398
								new Point(16, 16), ""));
399
						iconPosActive = -1;
400
					}
401
				}
402
			}
403
		}
404
		
405
		//Ponemos a true el incono activado y a false el resto
406
		for(int i=0;i<iconActive.length;i++){
407
			if(i==iconPosActive)
408
				iconActive[i] = true;
409
			else
410
				iconActive[i] = false;
411
		}			
412
		getMapControl().repaint();	
413
	}
414

  
415
	/**
416
	 * @return Returns the lyrRaster.
417
	 */
418
	public FLyrRaster getLyrRaster() {
419
		return lyrRaster;
420
	}
421

  
422
	/**
423
	 * @param lyrRaster The lyrRaster to set.
424
	 */
425
	public void setLyrRaster(FLyrRaster lyrRaster) {
426
		this.lyrRaster = lyrRaster;
427
	}
428

  
429
	/**
430
	 * @return Returns the pathToFile.
431
	 */
432
	public String getPathToFile() {
433
		return pathToFile;
434
	}
435

  
436
	/**
437
	 * @param pathToFile The pathToFile to set.
438
	 */
439
	public void setPathToFile(String pathToFile) {
440
		this.pathToFile = pathToFile;
441
	}
442
}
0 443

  
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toolListeners/ZoomInGeorefListener.java
43 43
import com.iver.andami.PluginServices;
44 44
import com.iver.cit.gvsig.fmap.MapControl;
45 45
import com.iver.cit.gvsig.fmap.tools.ZoomInGeorefListenerImpl;
46
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent;
47 46
import com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent;
48 47

  
49 48

  
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Dialogs/GeoreferencingDialog.java
22 22
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
23 23
import com.iver.cit.gvsig.fmap.tools.Behavior.MoveBehavior;
24 24
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
25
import com.iver.cit.gvsig.fmap.tools.Behavior.RectangleBehavior;
25
import com.iver.cit.gvsig.fmap.tools.Behavior.RedimBehavior;
26 26
import com.iver.cit.gvsig.gui.Panels.SelectFilePanel;
27 27
import com.iver.cit.gvsig.gui.Panels.SelectPointsPanel;
28 28
import com.iver.cit.gvsig.gui.toolListeners.GeorefPanListener;
......
49 49
	private JButton bCancelar = null;	
50 50
	private WizardListener wizardListener = new DialogWizardListener();
51 51
	private JButton bSave = null;
52
	private RedimBehavior rb = null;
52 53
	private static boolean loadTools = false;
53 54
	
54 55
    /**
......
60 61
    }
61 62

  
62 63
    /**
63
     * This method initializes this
64
     * En la inicializaci?n de la ventana a?adimos los tags de est? y cargamos 
65
     * ls herramientas para manejar las imagenes a georeferenciar.
64 66
     */
65 67
    private void initialize() {
66 68
        this.setLayout(new BorderLayout());
......
80 82

  
81 83
			StatusBarListener sbl = new StatusBarListener(mapCtrl);
82 84
			
83
			ZoomOutGeorefListener zogl = new ZoomOutGeorefListener(mapCtrl);
84
			mapCtrl.addMapTool("geoZoomOut", new Behavior[]{new PointBehavior(zogl), new MouseMovementBehavior(sbl)});
85
			
86 85
			ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(mapCtrl);
87 86
			ZoomInGeorefListener zigl = new ZoomInGeorefListener(mapCtrl);
88
			mapCtrl.addMapTool("geoZoomIn", new Behavior[]{new RectangleBehavior(zigl),
87
			rb = new RedimBehavior(zigl);
88
			mapCtrl.addMapTool("geoZoom", new Behavior[]{rb,
89 89
	        				new PointBehavior(zoil), new MouseMovementBehavior(sbl)});
90 90
							
91 91
			GeorefPanListener pl = new GeorefPanListener(mapCtrl);
......
236 236
		}
237 237
		return bSave;
238 238
	}
239

  
240
	/**
241
	 * @return Returns the rb.
242
	 */
243
	public RedimBehavior getRedimBehavior() {
244
		return rb;
245
	}
246

  
247
	/**
248
	 * @param rb The rb to set.
249
	 */
250
	public void setRedimBehavior(RedimBehavior rb) {
251
		this.rb = rb;
252
	}
239 253
   }  //  @jve:decl-index=0:visual-constraint="10,10"
240 254
 //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
241 255
//  @jve:visual-info  decl-index=0 visual-constraint="10,10"
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/SelectFilePanel.java
54 54
	/**
55 55
	 * Nombre de la capa
56 56
	 */
57
	private static String lyrName = "";
57
	private String lyrName = "";
58 58
	/**
59 59
	 * Recuerda la ?ltima ruta seleccionada por el usuario
60 60
	 */
......
323 323
                										viewPort, 
324 324
                										proj);
325 325
                		
326
                		SelectFilePanel.setLyrName("*"+fName.substring(fName.lastIndexOf("/")+1));
326
                		this.setLyrName("*"+fName.substring(fName.lastIndexOf("/")+1));
327 327
                		lyrRaster = this.createLayer("*"+fName.substring(fName.lastIndexOf("/")+1, fName.length()),
328 328
                            (RasterDriver) driver, fich, proj, ext);
329
                	      								
329
                	    
330
                		//Pasamos la capa al behavior
331
                		this.parent.getRedimBehavior().setLyrRaster(lyrRaster);
332
                		this.parent.getRedimBehavior().setPathToFile(fName);
333
                		
330 334
    					theView.getMapControl().getMapContext().getLayers()
331 335
    					   .addLayer(lyrRaster);  
332 336
	                	    					
......
385 389
	/**
386 390
	 * @return Returns the fName.
387 391
	 */
388
	public static String getLyrName() {
392
	public String getLyrName() {
389 393
		return lyrName;
390 394
	}
391 395
	/**
392 396
	 * @param name The fName to set.
393 397
	 */
394
	public static void setLyrName(String name) {
398
	public void setLyrName(String name) {
395 399
		lyrName = name;
396 400
	}
397 401
}
trunk/extensions/extGeoreferencing/build.xml
49 49
  		<fileset dir="images" includes="*"/>
50 50
 	</copy>
51 51
  	
52
  	<copy todir="${extensionDir}/${mainplugin}/images">
53
  	  		<fileset dir="images" includes="*Cursor.gif"/>
54
  	 </copy>
55
  	
52 56
  	<move todir="${extensionDir}/${mainplugin}/lib">
53 57
  		<fileset dir="${dist}" includes="${gvsiglibjar}.jar"/>
54 58
 		<fileset dir="${dist}" includes="${fmapjar}.jar"/>

Also available in: Unified diff