Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / layers / FLyrPoints.java @ 4734

History | View | Annotate | Download (19.1 KB)

1 2958 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
package com.iver.cit.gvsig.fmap.layers;
20
21
import java.awt.Color;
22
import java.awt.Graphics2D;
23
import java.awt.geom.Point2D;
24
import java.awt.geom.Rectangle2D;
25
import java.awt.image.BufferedImage;
26
import java.util.ArrayList;
27 2998 nacho
import java.util.Iterator;
28 2958 nacho
29
import com.iver.andami.PluginServices;
30
import com.iver.cit.gvsig.fmap.DriverException;
31
import com.iver.cit.gvsig.fmap.ViewPort;
32
import com.iver.cit.gvsig.fmap.operations.Cancellable;
33
import com.iver.cit.gvsig.gui.View;
34 4686 nacho
import com.iver.cit.gvsig.gui.dialogs.GeoreferencingDialog;
35 4700 nacho
import com.iver.cit.gvsig.utils.GeoPointPersistence;
36
import com.iver.cit.gvsig.utils.PointManager;
37 2958 nacho
38
39
/**
40
 * Clase de capa de marcado de puntos sobre una vista. Dibuja un puntero sobre
41 4704 nacho
 * cada punto en la vista. Esta capa hereda de GraphicLayer que es una capa que est?
42
 * metida de forma fija en FMap. Con esto conseguimos que nuestra capa de puntos
43
 * no aparezca en el TOC y siempre se dibuje por encima de todas las capas. Tiene
44
 * el inconveniente de que est? en FMap y si hacemos un dibujado de las capas
45
 * sobre un panel que no sea la vista de gvSIG este GraphicLayer no aparece.
46
 * Si queremos hacer este tipo de dibujados tendremos que dibujar todas las capas
47
 * con el draw de FLayers y al final llamar al draw de FLyrPoints.
48 2958 nacho
 *
49
 * @author Nacho Brodin (brodin_ign@gva.es)
50
 */
51 4704 nacho
public class FLyrPoints extends GraphicLayer {
52 2958 nacho
53 4729 nacho
        //**********************Params********************************
54 3102 nacho
        /**
55 4644 nacho
         * Diametro del centro de la cruz
56
         */
57
        private final int                                 DIAM_CIRCLE = 18;
58
        /**
59
         * ?ltima herramienta seleccionada. Despu?s de marcar el segundo punto en la vista ser? la
60
         * herramienta por defecto.
61
         */
62
        private String                                         lastTool = "zoomIn";
63 4729 nacho
        //**********************End Params****************************
64 4644 nacho
65
        //**********************Vars**********************************
66
        private ArrayList                                 pointList = new ArrayList();
67
        private boolean                                 showNumber = true;
68
        private FLyrPointsState                 state = null;
69 4699 nacho
        private GeoPointPersistence         geoPointPersistence = null;
70 4644 nacho
        private FLyrGeoRaster                         lyrGeoRaster = null;
71
        public static boolean                        isDrawing = false;
72 4700 nacho
        private        PointManager                        pointManager = null;
73 4704 nacho
        private        boolean                                        lyrVisible = true;
74 4644 nacho
        //**********************End Vars**********************************
75
76 4729 nacho
        //**********************Classes***********************************
77 3102 nacho
        /**
78
         * Estado de la capa de puntos.
79
         * @author Nacho Brodin (brodin_ign@gva.es)
80
         */
81
        public class FLyrPointsState{
82
                public ArrayList pointList = new ArrayList();
83
                public boolean showNumber = true;
84
                public String lastTool = "zoomIn";
85
        }
86 4729 nacho
        //**********************End Classes*******************************
87 4644 nacho
88 4729 nacho
        //**********************Methods***********************************
89 2993 nacho
        /**
90 3230 nacho
         * Constructor
91
         * @param flyGeoRaster
92
         */
93
        public FLyrPoints(FLyrGeoRaster lyGeoRaster){
94
                this.lyrGeoRaster = lyGeoRaster;
95 4699 nacho
                geoPointPersistence = new GeoPointPersistence(this);
96 3230 nacho
        }
97 4644 nacho
98 3230 nacho
        /**
99 3102 nacho
         * Salva el estado actual de la capa de puntos. Podr? ser recuperado
100
         * este ?ltimo estado salvado con la funci?n recoveryState
101
         *
102
         */
103
        public void saveState(){
104
                if(state == null)
105
                        state = new FLyrPointsState();
106
                else
107
                        state.pointList.clear();
108
109 3112 nacho
                for(int i=0;i<this.length();i++)
110 3102 nacho
                        state.pointList.add(((GeoPoint)pointList.get(i)).cloneGeoPoint());
111
112
                state.showNumber = showNumber;
113
                state.lastTool = lastTool;
114
        }
115
116
        /**
117
         * Recupera el estado de la capa de puntos desde la ?ltima vez que se
118
         * ejecut? la funci?n saveState. Si no hay ning?n estdo salvado es que
119
         * al principio estaba la capa vacia por lo que reiniciamos la capa de puntos.
120
         */
121
        public void recoveryState(){
122
                if(state != null){
123
                        pointList.clear();
124
                        for(int i=0;i<state.pointList.size();i++)
125
                                pointList.add(((GeoPoint)state.pointList.get(i)).cloneGeoPoint());
126
127
                        showNumber = state.showNumber;
128 3112 nacho
                        lastTool = state.lastTool;
129 3102 nacho
                }
130
        }
131
132
        /**
133 2993 nacho
         * Asigna el array de puntos
134
         * @param list
135
         */
136
        public void setListPoint(ArrayList list){
137
                pointList = list;
138
        }
139
140
        /**
141 2958 nacho
         * Dibujado de la capa de raster georeferenciado aplicando la
142
         * transformaci?n del viewPort.
143
         */
144
        public void draw(BufferedImage image, Graphics2D g, ViewPort vp,
145
                        Cancellable cancel,double scale) throws DriverException {
146 4621 nacho
147 2977 nacho
                Point2D pto = null;
148
149 4704 nacho
                if(lyrVisible && lyrGeoRaster != null){
150 3230 nacho
                        //vp = lyrGeoRaster.toImageCoord(vp);
151 4644 nacho
                        synchronized (this) {
152
                                for(int i=0; i<pointList.size();i++){
153
                                        //Punto de la imagen
154
                                        if(((GeoPoint)pointList.get(i)).active){
155
                                                pto = ((GeoPoint)pointList.get(i)).pixelPoint;
156
                                                if(pto != null){
157
                                                        Point2D p = lyrGeoRaster.img2World(pto);
158 4666 nacho
                                                        p = vp.fromMapPoint(p);
159 4644 nacho
                                                        drawPixelCrux(g, p, i);
160
                                                }
161
162
                                                //Punto de la vista
163
                                                pto = ((GeoPoint)pointList.get(i)).mapPoint;
164
                                                if(pto != null){
165
                                                        Point2D p = null;
166 4666 nacho
                                                        p = vp.fromMapPoint(pto);
167 4644 nacho
                                                        drawMapCrux(g, p, i);
168
                                                }
169 3102 nacho
                                        }
170 3011 nacho
                                }
171 2977 nacho
                        }
172 4621 nacho
                }
173 2958 nacho
        }
174
175 3064 nacho
        /**
176
         * Dibuja sobre el graphics pasado la cruz del punto que marca
177
         * el pixel de la imagen.
178
         * @param g Graphics
179
         */
180 3102 nacho
        private void drawPixelCrux(Graphics2D g, Point2D p, int pointNumber){
181 3064 nacho
                int dpto = (DIAM_CIRCLE >> 1);
182
                int incr = 5;
183 3072 nacho
                g.setColor(Color.WHITE);
184
                g.drawOval(        (int)p.getX() - dpto + 1,
185
                                        (int)p.getY() - dpto + 1,
186
                                        DIAM_CIRCLE - 2,
187
                                        DIAM_CIRCLE - 2);
188 3102 nacho
                g.drawLine((int)p.getX() - incr, (int)p.getY() - 1, (int)p.getX() - 1, (int)p.getY() - 1);
189
                g.drawLine((int)p.getX() - incr, (int)p.getY() + 1, (int)p.getX() - 1, (int)p.getY() + 1);
190
191
                g.drawLine((int)p.getX() + incr, (int)p.getY() - 1, (int)p.getX() + 1, (int)p.getY() - 1);
192
                g.drawLine((int)p.getX() + incr, (int)p.getY() + 1, (int)p.getX() + 1, (int)p.getY() + 1);
193
194
                g.drawLine((int)p.getX() - 1, (int)p.getY() - incr, (int)p.getX() - 1, (int)p.getY() - 1);
195
                g.drawLine((int)p.getX() + 1, (int)p.getY() - incr, (int)p.getX() + 1, (int)p.getY() - 1);
196
197
                g.drawLine((int)p.getX() - 1, (int)p.getY() + incr, (int)p.getX() - 1, (int)p.getY() + 1);
198
                g.drawLine((int)p.getX() + 1, (int)p.getY() + incr, (int)p.getX() + 1, (int)p.getY() + 1);
199
200 3064 nacho
                g.setColor(Color.red);
201
                g.drawOval(        (int)p.getX() - dpto,
202
                                        (int)p.getY() - dpto,
203
                                        DIAM_CIRCLE,
204
                                        DIAM_CIRCLE);
205 3102 nacho
                g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr);
206
                g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY());
207 4699 nacho
208 3102 nacho
                if(showNumber){
209
                        g.setColor(Color.WHITE);
210
                        g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 4), (int)(p.getY() - dpto - 4) );
211
                        g.setColor(Color.red);
212
                        g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 1), (int)(p.getY() - dpto - 1) );
213
                }
214 3064 nacho
        }
215
216
        /**
217
         * Dibuja sobre el graphics pasado la cruz del punto que marca
218
         * la coordenada de la vista.
219
         * @param g Graphics
220
         */
221 3102 nacho
        private void drawMapCrux(Graphics2D g, Point2D p, int pointNumber){
222 3064 nacho
                int dpto = (DIAM_CIRCLE >> 1);
223
                int incr = 5;
224 3072 nacho
                g.setColor(Color.WHITE);
225
                g.drawRect(        (int)p.getX() - dpto + 1,
226
                                        (int)p.getY() - dpto + 1,
227
                                        DIAM_CIRCLE - 2,
228
                                        DIAM_CIRCLE - 2);
229 3091 nacho
                g.drawLine((int)p.getX() - incr, (int)p.getY() - 1, (int)p.getX() - 1, (int)p.getY() - 1);
230
                g.drawLine((int)p.getX() - incr, (int)p.getY() + 1, (int)p.getX() - 1, (int)p.getY() + 1);
231
232
                g.drawLine((int)p.getX() + incr, (int)p.getY() - 1, (int)p.getX() + 1, (int)p.getY() - 1);
233
                g.drawLine((int)p.getX() + incr, (int)p.getY() + 1, (int)p.getX() + 1, (int)p.getY() + 1);
234
235
                g.drawLine((int)p.getX() - 1, (int)p.getY() - incr, (int)p.getX() - 1, (int)p.getY() - 1);
236
                g.drawLine((int)p.getX() + 1, (int)p.getY() - incr, (int)p.getX() + 1, (int)p.getY() - 1);
237
238
                g.drawLine((int)p.getX() - 1, (int)p.getY() + incr, (int)p.getX() - 1, (int)p.getY() + 1);
239
                g.drawLine((int)p.getX() + 1, (int)p.getY() + incr, (int)p.getX() + 1, (int)p.getY() + 1);
240
241 3064 nacho
                g.setColor(new Color(45, 8 , 165));
242
                g.drawRect(        (int)p.getX() - dpto,
243
                                        (int)p.getY() - dpto,
244
                                        DIAM_CIRCLE,
245
                                        DIAM_CIRCLE);
246
                g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr);
247
                g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY());
248 3102 nacho
                if(showNumber){
249
                        g.setColor(Color.WHITE);
250
                        g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 4), (int)(p.getY() - dpto - 4) );
251
                        g.setColor(new Color(45, 8 , 165));
252
                        g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 1), (int)(p.getY() - dpto - 1) );
253
                }
254 3064 nacho
        }
255
256 2958 nacho
        /* (non-Javadoc)
257
         * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.operations.Cancellable, double)
258
         */
259
        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
260
                        double scale) throws DriverException {
261
                // TODO Auto-generated method stub
262
263
        }
264
265
        /**
266 2998 nacho
         * Elimina los puntos de la lista que no tiene las dos coordenadas asignadas.
267
         */
268
        public void clean(){
269
                Iterator iter = pointList.iterator();
270
                while (iter.hasNext()) {
271
                        GeoPoint gp = (GeoPoint) iter.next();
272
                        if(gp.mapPoint == null || gp.pixelPoint == null)
273
                                iter.remove();
274
                }
275
        }
276
        /**
277 2958 nacho
         * A?ade un punto a la lista
278
         * @param point punto para la lista
279
         */
280 2962 nacho
        public void addPoint(Point2D pixel, Point2D map){
281
                pointList.add(new GeoPoint(pixel, map));
282 2958 nacho
        }
283
284
        /**
285 2963 nacho
         * Obtiene el punto de la posici?n pos
286
         */
287
        public GeoPoint getPoint(int pos){
288 4610 nacho
                try{
289
                        return (GeoPoint)pointList.get(pos);
290
                }catch(IndexOutOfBoundsException exc){
291
                        return null;
292
                }
293 2963 nacho
        }
294
295
        /**
296
         * Elimina la lista de puntos almacenada
297
         */
298
        public void clear(){
299
                pointList = new ArrayList();
300
        }
301
302
        /**
303
         * Elimina el punto de la posici?n indicada por el par?metro pos
304
         * @param pos        Posici?n del punto a eliminar
305
         */
306
        public void remove(int pos){
307
                pointList.remove(pos);
308
        }
309
310
        /**
311
         *Elimina el ?ltimo punto de la lista.
312
         */
313
        public void delLastPoint(){
314
                pointList.remove(pointList.size() - 1);
315
        }
316 4734 nacho
317 2963 nacho
        /**
318 4734 nacho
         * Funci?n que obtiene si un punto es nuevo o no. Un punto es nuevo si todavia
319
         * no han sido asignadas todas sus coordenadas.
320
         * @param n N?mero de punto a obtener si es nuevo
321
         * @return        true si es nuevo o false si no lo es
322
         */
323
        public boolean isNewPoint(int n){
324
                if(this.getPoint(n) == null)
325
                        return false;
326
                if(this.getPoint(n).pixelPoint == null || this.getPoint(n).mapPoint == null)
327
                        return true;
328
                return false;
329
        }
330
331
        /**
332 2963 nacho
         * Devuelve el n?mero de puntos de la capa
333 4608 nacho
         * @return entero que representa el n?mero de puntos de la capa
334 2963 nacho
         */
335
        public int length(){
336
                return pointList.size();
337
        }
338
339
        /**
340 2962 nacho
         * Actualiza un punto de la lista de una posici?n determinada
341
         * @param point punto para la lista
342
         */
343
        public void updatePoint(Point2D pixel, Point2D map, int pos){
344
                GeoPoint gp = (GeoPoint)pointList.get(pos);
345
                if(pixel != null)
346
                        gp.pixelPoint = pixel;
347
                if(map != null)
348
                        gp.mapPoint = map;
349
        }
350 4700 nacho
351 2962 nacho
        /**
352 3142 nacho
         * Calcula el RMS para el punto de la posici?n pos
353
         * @param pos        Posici?n
354
         * @return        RMS en forma de String
355
         */
356
        public String calcRMS(int pos){
357
                return "0";
358
        }
359
360
        /**
361
         * Calcula el residuo en X para el punto de la posici?n pos
362
         * @param pos        Posici?n
363
         * @return        residuo Y en forma de String
364
         */
365
        public String calcResX(int pos){
366 3230 nacho
                /*double resX = 0D;
367 3142 nacho
                GeoPoint gp = this.getPoint(pos);
368
                resX = Math.sqrt((gp.mapPoint.getX() - gp.pixelPoint.getX()) * (gp.mapPoint.getX() - gp.pixelPoint.getX()));
369 3230 nacho
                return String.valueOf(resX);*/
370
                return "0";
371 3142 nacho
        }
372
373
        /**
374
         * Calcula el residuo en Y para el punto de la posici?n pos
375
         * @param pos        Posici?n
376
         * @return        residuo Y en forma de String
377
         */
378
        public String calcResY(int pos){
379
                return "0";
380
        }
381
382
        /**
383
         *
384
         * @return
385
         */
386
        public String calcTotal(){
387
                return "0";
388
        }
389
390
        /**
391 2963 nacho
         * Muestra en consola los puntos de la capa
392
         */
393
        public void showPoints(){
394
                for(int i=0;i<pointList.size();i++){
395
                        if(((GeoPoint)pointList.get(i)).pixelPoint != null && ((GeoPoint)pointList.get(i)).mapPoint != null){
396
                                System.out.println("PUNTO "+i+": ");
397
                                System.out.println("pix->"+((GeoPoint)pointList.get(i)).pixelPoint.getX()+" "+((GeoPoint)pointList.get(i)).pixelPoint.getY());
398
                                System.out.println("map->"+((GeoPoint)pointList.get(i)).mapPoint.getX()+" "+((GeoPoint)pointList.get(i)).mapPoint.getY());
399 3058 nacho
                                System.out.println("extRight->"+((GeoPoint)pointList.get(i)).rightViewPort.getExtent());
400
                                System.out.println("extLeft->"+((GeoPoint)pointList.get(i)).leftViewPort.getExtent());
401 2963 nacho
                        }else
402
                                System.out.println("PUNTO "+i+": NULL");
403
                }
404
        }
405 3102 nacho
406
        /**
407 4644 nacho
         * Salva la lista de puntos sobre el fichero que se la pasa por
408
         * par?metro
409
         * @param file Nombre del fichero
410
         */
411
        public void PointList2XML(String file){;
412
                geoPointPersistence.savePointList(file);
413
        }
414
415
        /**
416
         * Recupera una lista de puntos desde un fichero XML
417
         * @param file Nombre del fichero
418
         */
419
        public void XML2PointList(String file){
420
                geoPointPersistence.loadPointList(file);
421
        }
422
423
        /**
424 4698 nacho
         * Salva la lista de puntos en forma tabular sobre el fichero que se la pasa por
425
         * par?metro
426
         * @param file Nombre del fichero
427
         */
428
        public void PointList2Ascii(String file){;
429
                geoPointPersistence.saveAsciiPointList(file);
430
        }
431 4729 nacho
        //**********************End Methods********************************
432 4644 nacho
433 4729 nacho
        //**********************Setters & Getters**************************
434 4644 nacho
        /**
435
         * Asigna el viewPort de la mini imagen de la derecha en
436
         * el punto de la posici?n que se le pasa por par?metro
437
         * @param pos Posici?n del punto
438
         * @param vp ViewPort asignado
439
         */
440
        public void setRightViewPort(int pos, ViewPort vp){
441
                getPoint(pos).rightViewPort = vp;
442
        }
443
        /**
444 3102 nacho
         * @return Returns the showNumber.
445
         */
446
        public boolean isShowNumber() {
447
                return showNumber;
448
        }
449
450
        /**
451
         * @param showNumber The showNumber to set.
452
         */
453
        public void setShowNumber(boolean showNumber) {
454
                this.showNumber = showNumber;
455
        }
456 3133 nacho
457 3134 nacho
        /**
458
         * Asigna el punto central de la mini imagen de la izquierda
459
         * en el punto de la posici?n que se le pasa por par?metro
460
         * @param pos Posici?n del punto
461
         * @param p Punto asignado
462
         */
463
        public void setLeftCenterPoint(int pos, Point2D p){
464
                getPoint(pos).leftCenterPoint = p;
465 3133 nacho
        }
466
467 3134 nacho
        /**
468
         * Asigna el punto central de la mini imagen de la derecha
469
         * en el punto de la posici?n que se le pasa por par?metro
470
         * @param pos Posici?n del punto
471
         * @param p Punto asignado
472
         */
473
        public void setRightCenterPoint(int pos, Point2D p){
474
                getPoint(pos).rightCenterPoint = p;
475
        }
476
477
        /**
478
         * Asigna el viewPort de la mini imagen de la izquierda en
479
         * el punto de la posici?n que se le pasa por par?metro
480
         * @param pos Posici?n del punto
481
         * @param vp ViewPort asignado
482
         */
483
        public void setLeftViewPort(int pos, ViewPort vp){
484
                getPoint(pos).leftViewPort = vp;
485
        }
486
487
        /**
488 4644 nacho
         * Devuelve el n?mero de puntos de la lista
489
         * @return entero que representa el n?mero de puntos
490 3134 nacho
         */
491 4644 nacho
        public int getCountPoints(){
492
                if(pointList != null)
493
                        return pointList.size();
494
                else
495
                        return 0;
496 3134 nacho
        }
497
498
        /**
499 4644 nacho
         * Activa o desactiva el punto de una posici?n de la lista
500
         * @param n        N?mero de punto
501
         * @param active        true activo, false desactivo
502 3134 nacho
         */
503 4644 nacho
        public void setPointActive(int n, boolean active){
504
                if(n < 0 || n >= this.length())
505
                        return;
506
                ((GeoPoint)pointList.get(n)).active = active;
507 3134 nacho
        }
508
509
        /**
510 4644 nacho
         * Dice si un punto de la lista est? activo o no
511
         * @param n        Posici?n del punto
512
         * @return        true si est? activo y false si no lo est?.
513
         */
514
        public boolean isPointActive(int n){
515
                if(n < 0 || n >= this.length())
516
                        return false;
517
                return ((GeoPoint)pointList.get(n)).active;
518 3134 nacho
        }
519
520
        /**
521 4644 nacho
         * Obtiene el extent de la capa
522
         * @return extent en Rectangle2D.
523 3134 nacho
         */
524 4644 nacho
        public Rectangle2D getFullExtent()throws DriverException {
525
                View theView = (View) PluginServices.getMDIManager().getActiveView();
526
                return theView.getMapControl().getMapContext().getViewPort().getExtent();
527 3134 nacho
        }
528 4644 nacho
529 4621 nacho
        /**
530 4644 nacho
         * @return Returns the lastTool.
531 4621 nacho
         */
532 4644 nacho
        public String getLastTool() {
533
                return lastTool;
534 4621 nacho
        }
535 3134 nacho
536 4644 nacho
        /**
537
         * @param lastTool The lastTool to set.
538
         */
539
        public void setLastTool(String lastTool) {
540
                this.lastTool = lastTool;
541
        }
542
543
        /**
544
         *Asigna el extent para las mini imagenes. Estas deben ser recuperadas cuando se selecciona
545
         *un punto
546
         */
547
        public void setMiniExtent(int nPoint, Point2D centerPoint, ViewPort vp, boolean isRight){
548
                if(isRight){
549
                        ((GeoPoint)pointList.get(nPoint)).rightCenterPoint = centerPoint;
550
                        ((GeoPoint)pointList.get(nPoint)).rightViewPort = vp;
551
                }else{
552
                        ((GeoPoint)pointList.get(nPoint)).leftCenterPoint = centerPoint;
553
                        ((GeoPoint)pointList.get(nPoint)).leftViewPort = vp;
554
                }
555
        }
556
557
        /**
558
         * Obtiene el extent de la mini imagen
559
         * @param nPoint Punto de la lista
560
         * @return
561
         */
562
        public ViewPort getMiniExtent(int nPoint, boolean isRight){
563
                if(isRight)
564
                        return ((GeoPoint)pointList.get(nPoint)).rightViewPort;
565
                else
566
                        return ((GeoPoint)pointList.get(nPoint)).leftViewPort;
567
568
        }
569
570
        /**
571
         * Obtiene el punto central de la mini imagen
572
         * @param nPoint Punto de la lista
573
         * @return
574
         */
575
        public Point2D getCenterPoint(int nPoint, boolean isRight){
576
                if(isRight)
577
                        return ((GeoPoint)pointList.get(nPoint)).rightCenterPoint;
578
                else
579
                        return ((GeoPoint)pointList.get(nPoint)).leftCenterPoint;
580
        }
581
582
        /**
583
         * Obtiene le ?ltimo punto de la lista
584
         * @return El ?ltimo punto georreferenciado de la lista
585
         */
586
        public GeoPoint getLastPoint(){
587
                return (GeoPoint)pointList.get(pointList.size());
588
        }
589
590
        /**
591
         * Obtiene el array de puntos
592
         * @return
593
         */
594
        public ArrayList getListPoint(){
595
                return pointList;
596
        }
597 4700 nacho
598
        /**
599
     * Obtiene el gestor de puntos
600
     * @return PointManager
601
     */
602
    public PointManager getPointManager() {
603
                return pointManager;
604
        }
605
606
    /**
607
     * Asigna el gestor de puntos
608
     * @param PointManager
609
     */
610
    public void setPointManager(PointManager pointManager) {
611
                this.pointManager = pointManager;
612
        }
613
614
    /**
615
     * Obtiene la capa de la imagen a georreferenciar
616
     * @return FLyrGeoRaster
617
     */
618
    public FLyrGeoRaster getLyrGeoRaster() {
619
                return lyrGeoRaster;
620
        }
621
622
    /**
623
         * Asigna la capa de la imagen a georreferenciar
624
         * @param flyGeoRaster
625
         */
626
        public void setLyrGeoRaster(FLyrGeoRaster lyGeoRaster){
627
                this.lyrGeoRaster = lyGeoRaster;
628
                if(geoPointPersistence == null)
629
                        geoPointPersistence = new GeoPointPersistence(this);
630
        }
631 4704 nacho
632
        /**
633
         * Asigna el flag de visibilidad a true o false. Si est? a true la capa
634
         * es visible normalmente y si est? a false no se mostrar?
635
         * @param visible flag de visibilidad
636
         */
637
        public void setVisible(boolean visible){
638
                this.lyrVisible = visible;
639
        }
640
641
        /**
642
         * Obtiene el flag de visibilidad true o false. Si est? a true la capa
643
         * es visible normalmente y si est? a false no se muestra
644
         * @return flag de visibilidad
645
         */
646
        public boolean isVisible(){
647
                return this.lyrVisible;
648
        }
649 4729 nacho
        //**********************End Setters & Getters*********************
650 2958 nacho
}