Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / dialogs / GeoreferencingDialog.java @ 4688

History | View | Annotate | Download (23.1 KB)

1
package com.iver.cit.gvsig.gui.dialogs;
2

    
3
import java.awt.BorderLayout;
4
import java.awt.Dimension;
5
import java.awt.FlowLayout;
6
import java.awt.event.ActionListener;
7
import java.awt.event.ComponentEvent;
8
import java.awt.event.ComponentListener;
9
import java.beans.PropertyVetoException;
10
import java.io.File;
11

    
12
import javax.swing.JButton;
13
import javax.swing.JFileChooser;
14
import javax.swing.JInternalFrame;
15
import javax.swing.JPanel;
16
import javax.swing.filechooser.FileFilter;
17
import javax.swing.table.DefaultTableModel;
18

    
19
import org.cresques.cts.IProjection;
20

    
21
import com.iver.andami.PluginServices;
22
import com.iver.cit.gvsig.fmap.MapControl;
23
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster;
24
import com.iver.cit.gvsig.fmap.layers.FLyrPoints;
25
import com.iver.cit.gvsig.fmap.tools.ZoomOutRightButtonListener;
26
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
27
import com.iver.cit.gvsig.fmap.tools.Behavior.DraggedBehavior;
28
import com.iver.cit.gvsig.fmap.tools.Behavior.GeoMoveBehavior;
29
import com.iver.cit.gvsig.fmap.tools.Behavior.GeoRedimBehavior;
30
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
31
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
32
import com.iver.cit.gvsig.gui.listeners.GeorefMovePointListener;
33
import com.iver.cit.gvsig.gui.listeners.GeorefPanListener;
34
import com.iver.cit.gvsig.gui.listeners.GeorefPointSelectorListener;
35
import com.iver.cit.gvsig.gui.listeners.ZoomGeorefListener;
36
import com.iver.cit.gvsig.gui.panels.ConectorPanel;
37
import com.iver.cit.gvsig.gui.panels.OptionsPanel;
38
import com.iver.cit.gvsig.gui.panels.ZoomControlPanel;
39
import com.iver.cit.gvsig.gui.pointsTable.TablePointsPanel.PointTable;
40
import com.iver.cit.gvsig.gui.selectPoints.SelectPointsPanel;
41
import com.iver.cit.gvsig.gui.toolListeners.StatusBarListener;
42
import com.iver.cit.gvsig.gui.wizards.WizardListener;
43
import com.iver.cit.gvsig.project.Project;
44

    
45
/**
46
 * Panel que contiene el Wizard de georeferenciaci?n con los tabs
47
 * interiores
48
 *
49
 * @author Nacho Brodin (brodin_ign@gva.es)
50
 */
51
public class GeoreferencingDialog extends JPanel implements ActionListener, ComponentListener {
52
        
53
        //**********************Vars**********************************
54
        static private IProjection                         proj = Project.getProjection();
55
        private JPanel                                                 pBotones = null;  //  @jve:decl-index=0:
56
        private JButton                                         bProcesar = null;  //  @jve:decl-index=0:
57
        private JButton                                         bCancelar = null;  //  @jve:decl-index=0:
58
        private WizardListener                                 wizardListener = new DialogWizardListener();
59
        private JButton                                         bLoadPoints = null;  //  @jve:decl-index=0:
60
        private GeoRedimBehavior                         rb = null;
61
        private GeoMoveBehavior                         mb = null;
62
        private boolean                                         loadTools = false;
63
        private JInternalFrame                                 frame = null;
64
        
65
        /**
66
         * Lista de formatos soportados
67
         */
68
        private String[]                                         fileFilters = {"grf"};
69
        /**
70
         * Recuerda la ?ltima ruta seleccionada por el usuario
71
         */
72
        private String                                                 lastPathLoad = "./";
73
        private String                                                 lastPathSave = "./";
74
        private ConectorPanel                                conectorPanel = null;
75
        
76
        private boolean                                         enlarge = false;
77
        private int                                                 normalWidth = 400;
78
        private int                                                 normalHeight = 263;
79
        private int                                                 enlargeHeight = 428;
80
        private int                                                 tmpWidth = normalWidth;
81
        
82
        private JButton                                         bAceptar = null;
83
        private JPanel                                                 pGeneral = null;
84
        
85
        private JButton                                         bSavePoints = null;
86
        private FLyrGeoRaster                                 lyrGeoRaster = null;
87
        //**********************End Vars******************************        
88
        
89
        //**********************Classes*******************************
90
        /**
91
         * Filtro para selecci?n de ficheros.
92
         * @author Nacho Brodin (brodin_ign@gva.es)
93
         */
94
        class SelectFileFilter extends javax.swing.filechooser.FileFilter {
95
                
96
                private JFileChooser chooser = null;
97
                private String file = null;
98
                
99
                public SelectFileFilter(JFileChooser ch, String file){
100
                        this.chooser = ch;
101
                        this.file = file;
102
                }
103
                
104
            public boolean accept(File f) {
105

    
106
                    return f.isDirectory() || f.getName().toLowerCase().endsWith("."+file);
107
            }
108
            
109
            public String getDescription() {
110
                    return file;
111
            }
112
            
113
        }
114
        
115
        /**
116
         * @author Nacho Brodin (brodin_ign@gva.es)
117
         */
118
        public class DialogWizardListener implements WizardListener {
119

    
120
                /**
121
                 * @see com.iver.cit.gvsig.gui.wms.WizardListener#error(java.lang.Exception)
122
                 */
123
                public void error(Exception e) {
124
                }
125

    
126
                /**
127
                 * @see com.iver.cit.gvsig.gui.wms.WizardListener#wizardStateChanged(boolean)
128
                 */
129
                public void wizardStateChanged(boolean finishable) {
130
                        getBProcesar().setEnabled(finishable);
131
                }
132
                
133
        }
134
        //**********************End Classes***************************
135
        
136
        //**********************Methods*******************************
137
    /**
138
     * Constructor.
139
     */
140
    public GeoreferencingDialog(JInternalFrame f, FLyrGeoRaster lyr) {
141
            frame = f;
142
            lyrGeoRaster = lyr;
143
            
144
            frame.addComponentListener(this);
145
            initialize();
146
    }
147
      
148
    /**
149
     * En la inicializaci?n de la ventana a?adimos los tags de est? y cargamos 
150
     * ls herramientas para manejar las imagenes a georeferenciar.
151
     */
152
    private void initialize() {
153
            //Cargamos las herramientas la primera vez que abrimos la ventana
154
        if(!loadTools){
155
                loadTools = true;
156
                com.iver.cit.gvsig.gui.View  vista = null;
157
                        try{
158
                                vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
159
                        }catch(ClassCastException exc){
160
                                return;
161
                        }
162
                MapControl mapCtrl = vista.getMapControl();
163

    
164
                        StatusBarListener sbl = new StatusBarListener(mapCtrl);
165
                        
166
                        ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(mapCtrl);
167
                        ZoomGeorefListener zigl = new ZoomGeorefListener(mapCtrl);
168
                        rb = new GeoRedimBehavior(zigl, this);
169
                        mapCtrl.addMapTool("geoZoom", new Behavior[]{rb,
170
                                                new PointBehavior(zoil), new MouseMovementBehavior(sbl)});
171
                                                        
172
                        GeorefPanListener pl = new GeorefPanListener(mapCtrl);
173
                        mb = new GeoMoveBehavior(pl, this);
174
                        mapCtrl.addMapTool("geoPan", new Behavior[]{mb, new MouseMovementBehavior(sbl)});
175
                        
176
                        //Seleccion de un punto sobre la vista
177
                GeorefPointSelectorListener psl = new GeorefPointSelectorListener(this);
178
                mapCtrl.addMapTool("pointLyrSelection", new Behavior[]{new PointBehavior(psl), new MouseMovementBehavior(sbl)});
179
                
180
                GeorefMovePointListener mpl = new GeorefMovePointListener(this);
181
                mapCtrl.addMapTool("geoMovePoint", new Behavior[]{new DraggedBehavior(mpl), new MouseMovementBehavior(sbl)});
182
                
183
        }
184
        
185
        this.setLayout(new BorderLayout());
186
        if(!enlarge){
187
                this.setPreferredSize(new java.awt.Dimension(normalWidth, normalHeight));
188
                this.setSize(new java.awt.Dimension(normalWidth, normalHeight));
189
                this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(false);
190
                this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(false);
191
        }else{
192
                this.setPreferredSize(new java.awt.Dimension(normalWidth, enlargeHeight));
193
                this.setSize(new java.awt.Dimension(normalWidth, enlargeHeight));
194
                this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(true);
195
                this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(true);
196
        }
197
        this.setLocation(new java.awt.Point(0,0));
198
        
199
        this.add(this.getPBotones(), BorderLayout.SOUTH);
200
        this.add(this.getConectorPanel(), BorderLayout.NORTH);        
201
    }
202
            
203
        /* (non-Javadoc)
204
         * @see com.iver.andami.ui.mdiManager.SingletonView#getViewModel()
205
         */
206
        /*public ViewInfo getViewInfo() {
207
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODELESSDIALOG |
208
                                ViewInfo.RESIZABLE);
209
                m_viewinfo.setWidth(this.getWidth());
210
                m_viewinfo.setHeight(this.getHeight());
211
                m_viewinfo.setTitle(PluginServices.getText(this,
212
                                "cargar_sin_georef"));
213

214
                return m_viewinfo;
215
        }*/
216
        
217
        /**
218
         * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
219
         */
220
        /*public Object getViewModel() {
221
                return "GeoreferencingDialog";
222
        }*/
223
        
224
                
225
        /**
226
         * This method initializes jButton        
227
         *         
228
         * @return javax.swing.JButton        
229
         */    
230
        private JButton getBAceptar() {
231
                if (bAceptar == null) {
232
                        bAceptar = new JButton();
233
                        bAceptar.setText(PluginServices.getText(this,"aceptar"));
234
                        bAceptar.addActionListener(this);
235
                }
236
                return bAceptar;
237
        }
238
                
239
        /**
240
         * Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
241
         * <UL>
242
         * <LI>Cambiamos el nombre a la capa georraster</LI>
243
         * <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
244
         * <LI>Cerramos la ventana</LI>
245
         * </UL>
246
         */
247
        public void actionPerformed(java.awt.event.ActionEvent e) {
248
                com.iver.cit.gvsig.gui.View  theView = null;
249
                try{
250
                        theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
251
                }catch(ClassCastException exc){
252
                        return;
253
                }
254
                
255
                //ACEPTAR 
256
                if(e.getSource() == bAceptar){
257
                        if(getLyrPoints() == null)
258
                                return;
259
                                                
260
                        if(lyrGeoRaster != null){
261
                                getLyrPoints().setVisible(false);
262
                                lyrGeoRaster.setName(lyrGeoRaster.getName().substring(1, lyrGeoRaster.getName().length()));
263
                                lyrGeoRaster.setActive(false);
264
                                theView.getMapControl().getMapContext().invalidate();
265
                        }
266
                        
267
                        try{
268
                                frame.setClosed(true);
269
                        }catch(PropertyVetoException exc){}
270
                }
271
                
272
                //CANCELAR
273
                if(e.getSource() == bCancelar){
274
                        if(getLyrPoints() == null)
275
                                return;
276
                                                
277
                        //Cerramos la ventana 
278
                        //(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener)
279
                        try{
280
                                frame.setClosed(true);
281
                        }catch(PropertyVetoException exc){}
282
                }
283
                
284
                //CARGAR PUNTOS
285
                if(e.getSource() == bLoadPoints){
286
                        JFileChooser chooser = new JFileChooser(lastPathLoad);
287
                        chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
288
                        FileFilter f = null;
289
                        for(int i=0; i<this.fileFilters.length;i++){
290
                                f = new SelectFileFilter(chooser, this.fileFilters[i]);
291
                                chooser.addChoosableFileFilter(f);
292
                        }
293
                        int returnVal = chooser.showOpenDialog(this);
294
                        if(returnVal == JFileChooser.APPROVE_OPTION){
295
                                 String fName = chooser.getSelectedFile().toString();
296
                                 FileFilter filter = chooser.getFileFilter();
297
                                 lastPathLoad = chooser.getCurrentDirectory().getAbsolutePath();
298
                        
299
                                 if(getLyrPoints() == null)
300
                                         return;
301

    
302
                                 lyrGeoRaster.getFLyrPoints().saveState();
303
                                 getLyrPoints().XML2PointList(fName);
304
                                 getLyrPoints().updateData(this);
305
                        }
306
                }
307
                
308
                //SALVAR PUNTOS
309
                if(e.getSource() == bSavePoints){
310
                        JFileChooser chooser = new JFileChooser(lastPathSave);
311
                        chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
312
                        
313
                        //File f = new File(lyrGeoRaster.getName().substring(0, lyrGeoRaster.getName().lastIndexOf("."))+".grf");
314
                        //chooser.setSelectedFile(f);
315
                        FileFilter f = null;
316
                        for(int i=0; i<this.fileFilters.length;i++){
317
                                f = new SelectFileFilter(chooser, this.fileFilters[i]);
318
                                chooser.addChoosableFileFilter(f);
319
                        }
320
                        int returnVal = chooser.showOpenDialog(this);
321
                        if(returnVal == JFileChooser.APPROVE_OPTION){
322
                                 String fName = chooser.getSelectedFile().toString();
323
                                 FileFilter filter = chooser.getFileFilter();
324
                                 lastPathSave = chooser.getCurrentDirectory().getAbsolutePath();
325

    
326
                                 if(getLyrPoints() != null)
327
                                         getLyrPoints().PointList2XML(fName);
328
                        }
329
                        
330
                }
331
        }
332
        
333
        /**
334
         * This method initializes bProcesar        
335
         *         
336
         * @return javax.swing.JButton        
337
         */    
338
        private JButton getBProcesar() {
339
                if (bProcesar == null) {
340
                        bProcesar = new JButton();
341
                        bProcesar.setText(PluginServices.getText(this,"procesar"));
342
                        bProcesar.setEnabled(false);
343
                        //bProcesar.setPreferredSize(new java.awt.Dimension(41,25));
344
                        bProcesar.addActionListener(new java.awt.event.ActionListener() { 
345
                                public void actionPerformed(java.awt.event.ActionEvent e) {
346
                    /*if (PluginServices.getMainFrame() == null) {
347
                        ((JDialog) (getParent().getParent().getParent()
348
                                .getParent())).dispose();
349
                    } else {
350
                        PluginServices.getMDIManager().closeView((com.iver.andami.ui.mdiManager.View) GeoreferencingDialog.this);
351
                    }*/
352
                                }
353
                        });
354
                }
355
                return bProcesar;
356
        }
357
        
358
        /**
359
         * El bot?n cancelar restaura el extent con el que se carg? la imagen a georreferenciar
360
         * y cierra la ventana.         
361
         *         
362
         * @return javax.swing.JButton        
363
         */    
364
        private JButton getBCancelar() {
365
                if (bCancelar == null) {
366
                        bCancelar = new JButton();
367
                        bCancelar.setText(PluginServices.getText(this,"cancelar"));
368
                        bCancelar.addActionListener(this);
369
                }
370
                return bCancelar;
371
        }
372
                
373
        /**
374
         * This method initializes jButton        
375
         *         
376
         * @return javax.swing.JButton        
377
         */
378
        private JButton getBLoadPoints() {
379
                if (bLoadPoints == null) {
380
                        bLoadPoints = new JButton();
381
                        bLoadPoints.setText(PluginServices.getText(this,"cargar"));
382
                        bLoadPoints.setEnabled(true);
383
                        bLoadPoints.addActionListener(this);
384
                }
385
                return bLoadPoints;
386
        }
387

    
388
        /**
389
         * Asigna a las textbox el valor de pixel pasado
390
         * @param x        valor x
391
         * @param y        valor y
392
         */
393
        public void setPixelText(double x, double y){
394
                getSelectPointsPanel().getDataPointPanel().getTX().setText(String.valueOf(x));
395
                getSelectPointsPanel().getDataPointPanel().getTY().setText(String.valueOf(y));
396
        }
397
        
398
        /**
399
         * Asigna a las textbox el valor de coordenadas pasado
400
         * @param x        valor x
401
         * @param y        valor y
402
         */
403
        public void setMapCoordText(double x, double y){
404
                getSelectPointsPanel().getDataPointPanel().getLongitud().setText(FLyrPoints.tailDecimal(String.valueOf(x)));
405
                getSelectPointsPanel().getDataPointPanel().getLatitud().setText(FLyrPoints.tailDecimal(String.valueOf(y)));
406
        }
407
        
408
        /**
409
         * Esta funci?n resetea los controles del panel de info de un punto.
410
         */
411
        public void resetControls(boolean active){
412
                getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().resetControls(active);                
413
                getConectorPanel().getAdjustGeorefPanel().getZoomLeft().clear();
414
                getConectorPanel().getAdjustGeorefPanel().getZoomRight().clear();
415
        }
416
        
417
        /* (non-Javadoc)
418
         * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
419
         */
420
        public void componentHidden(ComponentEvent arg0) {
421
                // TODO Auto-generated method stub
422

    
423
        }
424
        /* (non-Javadoc)
425
         * @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
426
         */
427
        public void componentMoved(ComponentEvent arg0) {
428
                // TODO Auto-generated method stub
429

    
430
        }
431
        /* (non-Javadoc)
432
         * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
433
         */
434
        public void componentResized(ComponentEvent ev) {
435
                
436
                if(frame.getWidth() <= this.normalWidth + 10)
437
                        frame.setSize(this.normalWidth, frame.getHeight());
438
                
439
                if(this.getConectorPanel().getDataPointsTabPanel().getTbPoints().getSelectedIndex() == 1){
440
                        tmpWidth = frame.getWidth();
441
                        this.newFrameSize(frame.getWidth(), frame.getHeight() - 10);
442
                }
443
        }
444
        /* (non-Javadoc)
445
         * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
446
         */
447
        public void componentShown(ComponentEvent arg0) {
448
                // TODO Auto-generated method stub
449

    
450
        }
451
        
452
    /**
453
     *Inicializa el tama?o del dialogo
454
     */
455
    public void resetSize(){
456
            if(!enlarge){
457
                    frame.setSize(this.normalWidth + 12, this.normalHeight + 10);
458
            }else{
459
                    frame.setSize(this.normalWidth + 12, this.enlargeHeight + 10);
460
            }
461
            newFrameSize((int)Math.round(this.normalWidth / 0.98), this.normalHeight);
462
    }
463
        
464
        /**
465
         * Calculo del nuevo tama?o a partir de un frame redimensionado
466
         * @param w Ancho del frame
467
         * @param h Alto del frame
468
         */
469
        public void newFrameSize(int w, int h){
470
                int newWidth = (int)Math.round(w * 0.98);
471
                                
472
        this.setSize(new java.awt.Dimension(newWidth, normalHeight ));
473
        this.setPreferredSize(new java.awt.Dimension(newWidth, normalHeight ));
474
        this.getConectorPanel().newFrameSize(newWidth, h);    
475
        }
476
        
477
        /**
478
         * Elimina un punto de la tabla de puntos
479
         * @param pos Posici?n del punto a eliminar
480
         */
481
        public void removeTableValueAt(int pos) throws ArrayIndexOutOfBoundsException{
482
                ((DefaultTableModel)this.getTable().getTable().getModel()).removeRow(pos);
483
        }
484
        
485

    
486
        //**********************End Methods***************************
487
        
488
        //**********************Setters & Getters*********************
489
        /**
490
         * Obtiene la tabla de puntos
491
         */
492
        public PointTable getTable(){
493
                return this.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getJTable();
494
        }
495
                
496
        /**
497
         * Asigna un valor a una posici?n de la tabla
498
         * @param value Valor a asignar
499
         * @param row        Fila en la que se asigna
500
         * @param col        Columna en la que se asigna
501
         */
502
        public void setTableValueAt(String value, int row, int col)throws ArrayIndexOutOfBoundsException{
503
                ((DefaultTableModel)this.getTable().getTable().getModel()).setValueAt(value, row, col);
504
        }
505
        
506
        /**
507
         * Obtiene el n?mero de filas de la tabla
508
         * @return N?mero de filas de la tabla
509
         */
510
        public int getTableRowCount(){
511
                return this.getTable().getTable().getRowCount();
512
        }
513
        
514
        /**
515
         * A?ade una nueva fila a la tabla de puntos
516
         */
517
        public void addTableNew(){
518
                this.getTable().getTableModel().addNew();
519
        }
520
        /**
521
         * @return Returns the tmpWidth.
522
         */
523
        public int getTmpWidth() {
524
                return tmpWidth;
525
        }
526
        /**
527
         * @param tmpWidth The tmpWidth to set.
528
         */
529
        public void setTmpWidth(int tmpWidth) {
530
                this.tmpWidth = tmpWidth;
531
        }
532
        /**
533
         * @return Returns the enlargeHeight.
534
         */
535
        public int getEnlargeHeight() {
536
                return enlargeHeight;
537
        }
538
        /**
539
         * @return Returns the normalHeight.
540
         */
541
        public int getNormalHeight() {
542
                return normalHeight;
543
        }
544

    
545
        /**
546
         * @return Returns the normalWidth.
547
         */
548
        public int getNormalWidth() {
549
                return normalWidth;
550
        }
551
        
552
        /**
553
         * This method initializes jButton        
554
         *         
555
         * @return javax.swing.JButton        
556
         */    
557
        private JButton getBSavePoints() {
558
                if (bSavePoints == null) {
559
                        bSavePoints = new JButton();
560
                        bSavePoints.setText(PluginServices.getText(this,"salvar"));
561
                        //bSavePoints.setPreferredSize(new java.awt.Dimension(41,25));
562
                        bSavePoints.addActionListener(this);
563
                }
564
                return bSavePoints;
565
        }
566
        
567
        /**
568
         * Asigna el valor del campo RMS
569
         * @param rms Cadena que representa el RMS
570
         */
571
        public void setRMS(String rms){
572
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTRMS().setText(rms);
573
        }
574
        
575
        /**
576
         * Asigna el valor del campo de residuo en X
577
         * @param rms Cadena que representa el RMS
578
         */
579
        public void setResX(String resX){
580
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResX().setText(resX);
581
        }
582
        
583
        /**
584
         * Asigna el valor del campo de residuo en Y
585
         * @param rms Cadena que representa el RMS
586
         */
587
        public void setResY(String resY){
588
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResY().setText(resY);
589
        }
590
        
591
        /**
592
         * Asigna el valor del campo RMS
593
         * @param rms Cadena que representa el RMS
594
         */
595
        public void setTotal(String total){
596
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTTotal().setText(total);
597
        }
598
        
599
        /**
600
         * @return Returns the lyrGeoRaster.
601
         */
602
        public FLyrGeoRaster getLyrGeoRaster() {
603
                return lyrGeoRaster;
604
        }
605

    
606
        /**
607
         * @return Returns the lyrPoints.
608
         */
609
        public FLyrPoints getLyrPoints() {
610
                try{
611
                        return lyrGeoRaster.getFLyrPoints();                                                
612
                }catch(ClassCastException exc){
613
                        return null;
614
                }
615
        }
616
        
617
        /**
618
         * Selecciona un tab del cuadro
619
         * @param index
620
         */
621
        public void setSelectedTab(int index){
622
                this.getConectorPanel().getDataPointsTabPanel().getTbPoints().setSelectedIndex(index);
623
        }
624
        
625
        /**
626
         * @param extended The extended to set.
627
         */
628
        public void setEnlarge(boolean enlarge) {
629
                this.enlarge = enlarge;
630
                if(!enlarge){
631
                        this.setPreferredSize(new Dimension(this.normalWidth, this.normalHeight));
632
                        this.setSize(new Dimension(this.normalWidth, this.normalHeight));
633
                        frame.setSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10));
634
                        frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10));
635
                        this.getConectorPanel().setCanvasVisible(false);
636
                }else{
637
                        this.setPreferredSize(new Dimension(this.normalWidth, this.enlargeHeight));
638
                        this.setSize(new Dimension(this.normalWidth, this.enlargeHeight));
639
                        frame.setSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10));
640
                        frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10));
641
                        this.getConectorPanel().setCanvasVisible(true);
642
                }
643
                frame.pack();
644
        }
645
        
646
        /**
647
         * @return Returns the extended.
648
         */
649
        public boolean isEnlarge() {
650
                return enlarge;
651
        }
652
        
653
        /**
654
     * Obtiene el panel conector
655
     * @return
656
     */
657
    public ConectorPanel getConectorPanel() {
658
            if (conectorPanel == null) {                            
659
                    conectorPanel = new ConectorPanel(this);
660
            }
661
        
662
            return conectorPanel;
663
    }
664
                 
665
        /**
666
         * This method initializes jPanel        
667
         *         
668
         * @return javax.swing.JPanel        
669
         */    
670
        private JPanel getPBotones() {
671
                if (pBotones == null) {
672
                        FlowLayout flowLayout1 = new FlowLayout();
673
                        pBotones = new JPanel();
674
                        pBotones.setLayout(flowLayout1);
675
                        flowLayout1.setHgap(10);
676
                        flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
677
                        pBotones.add(getBProcesar(), null);
678
                        //pBotones.add(getBLoadPoints(), null);
679
                        //pBotones.add(getBSavePoints(), null);
680
                        pBotones.add(getBAceptar(), null);
681
                        pBotones.add(getBCancelar(), null);
682
                }
683
                return pBotones;
684
        }
685
        
686
        public static IProjection getLastProjection() {
687
                return proj;
688
        }
689
        public static void setLastProjection(IProjection proj) {
690
                GeoreferencingDialog.proj = proj;
691
        }
692

    
693
        /**
694
         * @return Returns the GeoRedimBehavior.
695
         */
696
        public GeoRedimBehavior getGeoRedimBehavior() {
697
                return rb;
698
        }
699

    
700
        /**
701
         * @param rb The GeoRedimBehavior to set.
702
         */
703
        public void setGeoRedimBehavior(GeoRedimBehavior rb) {
704
                this.rb = rb;
705
        }
706
        
707
        /**
708
         * @return Returns the GeoMoveBehavior
709
         */
710
        public GeoMoveBehavior getGeoMoveBehavior() {
711
                return mb;
712
        }
713

    
714
        /**
715
         * @param mb The GeoMoveBehavior to set.
716
         */
717
        public void setGeoMoveBehavior(GeoMoveBehavior mb) {
718
                this.mb = mb;
719
        }
720
        
721

    
722
        /**
723
         * Obtiene el punto de la lista que ha sido seleccionado
724
         * @return
725
         */
726
        public int getSelectedPoint(){
727
                return getConectorPanel().getDataPointsTabPanel().
728
                        getSelectPointsPanel().getTableControlerPanel().getSelectedIndex();
729
        }
730
        
731
        /**
732
         * Obtiene el control de la mini imagen que tiene los botones a la izquierda
733
         * @return ZoomControlPanel
734
         */
735
        public ZoomControlPanel getZoomControlLeft(){
736
                return this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft();
737
        }
738
        
739
        /**
740
         * Obtiene el control de la mini imagen que tiene los botones a la derecha
741
         * @return ZoomControlPanel
742
         */
743
        public ZoomControlPanel getZoomControlRight(){
744
                return this.getConectorPanel().getAdjustGeorefPanel().getZoomRight();
745
        }
746
        
747
        /**
748
         * Obtiene el panel de selecci?n de puntos
749
         * @return Panel de selecci?n de puntos
750
         */
751
        public SelectPointsPanel getSelectPointsPanel(){
752
                return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel();
753
        }
754
        
755
        /**
756
         * Obtiene el panel de opciones
757
         * @return OptionPanel
758
         */
759
        public OptionsPanel getOptionsPanel(){
760
                return getConectorPanel().getAdjustGeorefPanel().getOptionsPanel();
761
        }
762
          
763
    /**
764
     * Asigna el frame
765
     * @param f
766
     */
767
    public void setFrame(JInternalFrame f){
768
            frame = f;
769
            frame.addComponentListener(this);
770
    }
771
    
772
    /**
773
     * Obtiene el frame
774
     * @return frame
775
     */
776
    public JInternalFrame getFrame(){
777
            return frame;
778
    }
779
        //**********************End Setters & Getters*****************
780
                
781
 }  //  @jve:decl-index=0:visual-constraint="10,10"
782
 //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
783
//  @jve:visual-info  decl-index=0 visual-constraint="10,10"