Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / tools / Behavior / GeoRedimBehavior.java @ 4621

History | View | Annotate | Download (17.6 KB)

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.Component;
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

    
55
import javax.swing.ImageIcon;
56
import javax.swing.JOptionPane;
57

    
58
import org.cresques.px.Extent;
59

    
60
import com.iver.andami.PluginServices;
61
import com.iver.cit.gvsig.fmap.MapControl;
62
import com.iver.cit.gvsig.fmap.ViewPort;
63
import com.iver.cit.gvsig.fmap.layers.FLayer;
64
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster;
65
import com.iver.cit.gvsig.fmap.layers.FLyrPoints.GeoPoint;
66
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
67
import com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener;
68
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
69
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog;
70

    
71

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

    
131
        /**
132
         * Funci?n que carga la capa si todav?a no lo est?.
133
         */
134
        private void loadLayer() throws InstantiationException, ClassCastException{
135
                //Cargamos la capa
136
                
137
                theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
138
                for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){
139
                        FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i);
140
                        if(        lyr instanceof FLyrGeoRaster && 
141
                                lyr.getName().startsWith("*"))
142
                                this.lyrGeoRaster = (FLyrGeoRaster)lyr;
143
                }
144
                if(lyrGeoRaster == null)
145
                        throw new InstantiationException("No se ha podido cargar la capa de georreferenciaci?n");
146
        }
147

    
148
        
149
        /**
150
         * Cuando se produce un evento de pintado dibujamos el marco de la imagen para
151
         * que el usuario pueda seleccionar y redimensionar.
152
         */
153
        public void paintComponent(Graphics g) {
154
                
155
                BufferedImage img = getMapControl().getImage();
156
                g.drawImage(img, 0, 0, null);
157
                g.setColor(Color.red);
158
                ViewPort vp = getMapControl().getMapContext().getViewPort();
159
                try{
160
                        loadLayer();
161
                        Rectangle r = new Rectangle();
162
                        
163
                        if(tmpLr == null || tmpUl == null){
164
                                ul = vp.fromMapPoint(lyrGeoRaster.getAssignExtent().getMin().getX(), lyrGeoRaster.getAssignExtent().getMin().getY());
165
                                lr = vp.fromMapPoint(lyrGeoRaster.getAssignExtent().getMax().getX(), lyrGeoRaster.getAssignExtent().getMax().getY());
166
                                r.setFrameFromDiagonal(ul, lr);
167
                        }else
168
                                r.setFrameFromDiagonal(tmpUl, tmpLr);
169
                                
170
                                g.drawRect(r.x, r.y, r.width, r.height);
171
                }catch(InstantiationException exc){
172
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
173
                                        PluginServices.getText(this, "error_capa_puntos"));
174
                }catch(ClassCastException exc){
175
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
176
                                        PluginServices.getText(this, "error_capa_puntos"));
177
                }
178
                
179
        }
180

    
181
        /**
182
         * Reimplementaci?n del m?todo mousePressed de Behavior. Cuando se pulsa
183
         * estando sobre el marco de la imagen activamos la posibilidad de arrastrar
184
         * para redimensionar la imagen.
185
         *
186
         * @param e MouseEvent
187
         */
188
        public void mousePressed(MouseEvent e) {
189
                if (e.getButton() == MouseEvent.BUTTON1) {
190
                        
191
                        try{
192
                                loadLayer();
193
                        }catch(InstantiationException exc){
194
                                JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
195
                                                PluginServices.getText(this, "error_capa_puntos"));
196
                                return;
197
                        }catch(ClassCastException exc){
198
                                JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
199
                                                PluginServices.getText(this, "error_capa_puntos"));
200
                                return;
201
                        }
202
                        
203
                        tmpUl = ul;
204
                        tmpLr = lr;
205
                        
206
                        ViewPort vp = getMapControl().getMapContext().getViewPort();
207
                        double wcX = vp.toMapPoint(e.getX(), e.getY()).getX();
208
                        double wcY = vp.toMapPoint(e.getX(), e.getY()).getY();
209
                        
210
                        double minX = lyrGeoRaster.getAssignExtent().getMin().getX();
211
                        double minY = lyrGeoRaster.getAssignExtent().getMin().getY();
212
                        double maxX = lyrGeoRaster.getAssignExtent().getMax().getX();
213
                        double maxY = lyrGeoRaster.getAssignExtent().getMax().getY();
214
                        
215
                        
216
                        if(iconActive[0]){//Estirar en horizontal activado
217
                                if(wcX > (maxX - WIDTH_BORDER) && wcX < maxX)
218
                                        redimActive[0] = true;
219
                                if(wcX < (minX + WIDTH_BORDER) && wcX > minX)
220
                                        redimActive[1] = true;
221
                        }
222
                        if(iconActive[1]){//Estirar en vertical activado
223
                                if(wcY > (maxY - WIDTH_BORDER) && wcY < maxY)
224
                                        redimActive[3] = true;
225
                                if(wcY < (minY + WIDTH_BORDER) && wcY > minY)
226
                                        redimActive[2] = true;
227
                        }
228
                        if(iconActive[2] || iconActive[3]){ //Estirar en oblicuo activado
229
                                redimActive[4] = true;
230
                                pointInit = e.getPoint();
231
                                rectInit =  new Rectangle2D.Double(tmpUl.getX(), tmpUl.getY(), tmpLr.getX() - tmpUl.getX(), tmpLr.getY() - tmpUl.getY());
232
                        }
233
                        
234
                }
235

    
236
                if (listener.cancelDrawing()) {
237
                        getMapControl().cancelDrawing();
238
                }
239

    
240
                //getMapControl().repaint();
241
                //getMapControl().drawMap(true);
242
        }
243

    
244
        /**
245
         * Reimplementaci?n del m?todo mouseReleased de Behavior. Desactivamos
246
         * los flags de redimensionado y a partir de la selecci?n del usuario 
247
         * creamos un nuevo extent para la imagen. Con este extent creamos una nueva
248
         * capa que sustituir? a la anterior.
249
         *
250
         * @param e MouseEvent
251
         *
252
         * @throws BehaviorException Excepci?n lanzada cuando el Behavior.
253
         */
254
        public void mouseReleased(MouseEvent e) throws BehaviorException {
255
                
256
                if (e.getButton() == MouseEvent.BUTTON1) {
257
                        //Desactivamos los flags de redimensionado
258
                        for(int i=0;i<redimActive.length;i++)
259
                                redimActive[i] = false;
260
                        //Asignamos el nuevo extent a la imagen
261
                        ViewPort vp = getMapControl().getMapContext().getViewPort();
262
                        Extent ext = new Extent(vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getX(),
263
                                                                        vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getY(),
264
                                                                        vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getX(),
265
                                                                        vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getY());
266
                        
267
                                                
268
                        if(this.lyrGeoRaster != null){
269
                                
270
                                ((FLyrGeoRaster)getMapControl().getMapContext().getLayers().getLayer(lyrGeoRaster.getName())).setAssignExtent(ext);
271
                                
272
                                //Si la capa tiene puntos de control hacemos un update de estos 
273
                                //a su posici?n para que se actualicen los controles
274
                                for(int i=0; i<lyrGeoRaster.getFLyrPoints().getCountPoints(); i++){
275
                                                        
276
                                        Point2D center = lyrGeoRaster.img2World(lyrGeoRaster.getFLyrPoints().getPoint(i).pixelPoint);
277
                                        lyrGeoRaster.getFLyrPoints().setMiniExtent(        i,
278
                                                                                                                                center,
279
                                                                                                                                lyrGeoRaster.getGeoDialog().getZoomControlLeft().getCanvas().initViewPort(vp, center, lyrGeoRaster.getFLyrPoints().getPoint(i).leftViewPort),
280
                                                                                                                                false);
281
                                }
282
                                
283
                                //Repintamos la vista y las mini im?genes
284
                                int selection = lyrGeoRaster.getGeoDialog().getSelectedPoint();
285
                                GeoPoint gp = lyrGeoRaster.getFLyrPoints().getPoint(selection);
286
                                Point2D px = null; 
287
                                Point2D map = null;
288
                                if(gp != null){
289
                                        px = gp.pixelPoint;
290
                                        map = gp.mapPoint;
291
                                }
292
                                
293
                                lyrGeoRaster.updateData(selection + 1, px, map, lyrGeoRaster.getGeoDialog(), theView);
294
                                if(px == null && map == null)
295
                                        theView.getMapControl().getMapContext().invalidate();
296
                                
297
                                tmpUl = null;
298
                                tmpLr = null;
299
                        }
300
                }
301
        }
302

    
303
        /**
304
         * Al arrastrar cuando se ha pulsado sobre el marco de la imagen recalculamos
305
         * el marco de la imagen 
306
         *
307
         * @param e MouseEvent
308
         */
309
        public void mouseDragged(MouseEvent e) {
310
                double longLadoLargo = Math.abs(tmpLr.getX() - tmpUl.getX());
311
                double longLadoCorto = Math.abs(tmpLr.getY() - tmpUl.getY());
312
                
313
                if(redimActive[0]){//vertical derecha
314
                        double newLadoLargo = (e.getX() - tmpUl.getX());
315
                        double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
316
                        double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
317
                        tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoCorto/2));
318
                        tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
319
                }
320
                if(redimActive[1]){//vertical izquierda
321
                        double newLadoLargo = (e.getX() - tmpLr.getX());
322
                        double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
323
                        double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
324
                        tmpLr = new Point2D.Double(tmpLr.getX(), coordCentro + (newLadoCorto/2));
325
                        tmpUl = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
326
                }
327
                if(redimActive[2]){//horizontal abajo
328
                        double newLadoCorto = (e.getY() - tmpLr.getY());
329
                        double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
330
                        double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
331
                        tmpLr = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpLr.getY());
332
                        tmpUl = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
333
                }
334
                if(redimActive[3]){//horizontal arriba
335
                        double newLadoCorto = (e.getY() - tmpUl.getY());
336
                        double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
337
                        double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
338
                        tmpUl = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpUl.getY());
339
                        tmpLr = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
340
                }
341
                if(redimActive[4]){//inclinado
342
                        double distX = (e.getX() - pointInit.getX());
343
                        double distY = (e.getY() - pointInit.getY());
344
                        double incrLadoLargo = 0D, incrLadoCorto = 0D;
345
                        incrLadoLargo = distX;
346
                        //Calculamos la distancia que incrementaremos al lado corto
347
                        boolean ejeXLargo = true; 
348
                        if(longLadoCorto > longLadoLargo){
349
                                double tmp = longLadoLargo;
350
                                longLadoLargo = longLadoCorto;
351
                                longLadoCorto = tmp;
352
                                ejeXLargo = false;
353
                        }        
354
                        
355
                        incrLadoCorto = (incrLadoLargo * longLadoCorto) / longLadoLargo;
356
                        Point2D antUl = tmpUl;
357
                        Point2D antLr = tmpLr;
358
                        if(distX > 0 && e.getX() > lr.getX()){
359
                                tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
360
                                tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
361
                        }else if(distX < 0 && e.getX() < ul.getX()){
362
                                tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
363
                                tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
364
                        }else if(distX > 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
365
                                tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
366
                                tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
367
                        }else if(distX < 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
368
                                tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
369
                                tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
370
                        }
371
                        //A partir de un tama?o m?nimo no reducimos m?s
372
                        if((tmpLr.getX() - tmpUl.getX()) < 100 || (tmpUl.getY() - tmpLr.getY()) < 100){
373
                                tmpUl = antUl;
374
                                tmpLr = antLr;
375
                        }
376
                                
377
                }
378
                
379
                getMapControl().repaint();
380
        }
381

    
382
        /**
383
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#setListener(com.iver.cit.gvsig.fmap.tools.ToolListener)
384
         */
385
        public void setListener(ToolListener listener) {
386
                this.listener = (RectangleListener) listener;
387
        }
388

    
389
        /**
390
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
391
         */
392
        public ToolListener getListener() {
393
                return listener;
394
        }
395
        
396
        /**
397
         * Cuando movemos el rat?n detecta si estamos en el marco de la 
398
         * imagen y pone el icono del cursor del rat?n adecuado.
399
         */
400
        public void mouseMoved(MouseEvent e) throws BehaviorException {
401
                ViewPort vp = getMapControl().getMapContext().getViewPort();
402
                
403
                try{
404
                        loadLayer();
405
                }catch(InstantiationException exc){
406
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
407
                                        PluginServices.getText(this, "error_capa_puntos"));
408
                        return;
409
                }catch(ClassCastException exc){
410
                        JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
411
                                        PluginServices.getText(this, "error_capa_puntos"));
412
                        return;
413
                }
414
                
415
                double wcX = vp.toMapPoint(e.getX(), e.getY()).getX();
416
                double wcY = vp.toMapPoint(e.getX(), e.getY()).getY();
417
                
418
                double minX = lyrGeoRaster.getAssignExtent().getMin().getX();
419
                double minY = lyrGeoRaster.getAssignExtent().getMin().getY();
420
                double maxX = lyrGeoRaster.getAssignExtent().getMax().getX();
421
                double maxY = lyrGeoRaster.getAssignExtent().getMax().getY();
422
                
423
                //Calculamos el borde sobre el cual cambiar? el puntero del rat?n y la longitud de la esquina
424
                
425
                WIDTH_BORDER = (int)Math.round((maxX - minX) * 0.02);
426
                LONG_CORNER = (int)Math.round((maxX - minX) * 0.03);
427
                if(WIDTH_BORDER < 15)
428
                        WIDTH_BORDER = 15;
429
                if(LONG_CORNER < 20)
430
                        LONG_CORNER = 20;
431
                                
432
                int iconPosActive = -1;
433
                
434
                //Flecha horizontal
435
                if(        ((wcX > minX && wcX < minX + WIDTH_BORDER) ||
436
                         (wcX < maxX && wcX > maxX - WIDTH_BORDER )) &&
437
                        (wcY < (maxY - LONG_CORNER)) &&
438
                        (wcY > (minY + LONG_CORNER))){        
439
                        getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconHoriz,
440
                                        new Point(16, 16), ""));
441
                        iconPosActive = 0;
442
                                                
443
                }else{
444
                        //Flecha Vertical
445
                        if(        ((wcY > minY && wcY < minY + WIDTH_BORDER) ||
446
                                 (wcY < maxY && wcY > maxY - WIDTH_BORDER )) &&
447
                                (wcX < (maxX - LONG_CORNER)) &&
448
                                (wcX > (minX + LONG_CORNER))){        
449
                                        getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconVert,
450
                                                        new Point(16, 16), ""));
451
                                        iconPosActive = 1;
452
                        }else{
453
                                //Flecha oblicua derecha
454
                                if((wcX > (maxX - LONG_CORNER) && wcX < maxX &&
455
                                        wcY < (minY + LONG_CORNER) && wcY > minY) ||
456
                                   (wcX > minX && wcX < (minX + LONG_CORNER) &&
457
                                        wcY < maxY && wcY > (maxY - LONG_CORNER))){
458
                                        getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclIzq,
459
                                                        new Point(16, 16), ""));
460
                                        iconPosActive = 2;
461
                                }else{
462
                                        //Flecha oblicua izquierda
463
                                        if((wcX > minX && wcX < (minX + LONG_CORNER) &&
464
                                                wcY < (minY + LONG_CORNER) && wcY > minY) ||
465
                                           (wcX > (maxX - LONG_CORNER) && wcX < maxX &&
466
                                                wcY > (maxY - LONG_CORNER) && wcY < maxY)){
467
                                                getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(iconInclDer,
468
                                                                        new Point(16, 16), ""));
469
                                                iconPosActive = 3;
470
                                        }else{
471
                                                getMapControl().setCursor(Toolkit.getDefaultToolkit().createCustomCursor(defaultCursor,
472
                                                                new Point(16, 16), ""));
473
                                                iconPosActive = -1;
474
                                        }
475
                                }
476
                        }
477
                }
478
                
479
                //Ponemos a true el incono activado y a false el resto
480
                for(int i=0;i<iconActive.length;i++){
481
                        if(i==iconPosActive)
482
                                iconActive[i] = true;
483
                        else
484
                                iconActive[i] = false;
485
                }                        
486
                getMapControl().repaint();        
487
        }
488

    
489
}