Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / Dialogs / GeoreferencingDialog.java @ 4633

History | View | Annotate | Download (22.3 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.Panels.ConectorPanel;
33
import com.iver.cit.gvsig.gui.Panels.OptionsPanel;
34
import com.iver.cit.gvsig.gui.Panels.SelectPointsPanel;
35
import com.iver.cit.gvsig.gui.Panels.ZoomControlPanel;
36
import com.iver.cit.gvsig.gui.Panels.TablePointsPanel.PointTable;
37
import com.iver.cit.gvsig.gui.toolListeners.GeorefMovePointListener;
38
import com.iver.cit.gvsig.gui.toolListeners.GeorefPanListener;
39
import com.iver.cit.gvsig.gui.toolListeners.GeorefPointSelectorListener;
40
import com.iver.cit.gvsig.gui.toolListeners.StatusBarListener;
41
import com.iver.cit.gvsig.gui.toolListeners.ZoomGeorefListener;
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
        static private IProjection proj = Project.getProjection();
53
    private JFileChooser fileChooser;
54
        private JPanel pBotones = null;  //  @jve:decl-index=0:
55
        private JButton bProcesar = null;  //  @jve:decl-index=0:
56
        private JButton bCancelar = null;  //  @jve:decl-index=0:
57
        private WizardListener wizardListener = new DialogWizardListener();
58
        private JButton bLoadPoints = null;  //  @jve:decl-index=0:
59
        private GeoRedimBehavior rb = null;
60
        private GeoMoveBehavior mb = null;
61
        private boolean loadTools = false;
62
        private JInternalFrame frame = null;
63
        
64
        /**
65
         * Lista de formatos soportados
66
         */
67
        private String[] fileFilters = {"grf"};
68
        /**
69
         * Recuerda la ?ltima ruta seleccionada por el usuario
70
         */
71
        private String lastPathLoad = "./";
72
        private String lastPathSave = "./";
73
        private ConectorPanel        conectorPanel = null;
74
        
75
        private boolean enlarge = false;
76
        private int normalWidth = 395;
77
        private int normalHeight = 255;
78
        private int enlargeHeight = 422;
79
        private int tmpWidth = normalWidth;
80
        
81
        private JButton bAceptar = null;
82
        private JPanel pGeneral = null;
83
        
84
        private JButton bSavePoints = null;
85
        private FLyrGeoRaster lyrGeoRaster = null;
86
                
87
    /**
88
     * Constructor.
89
     */
90
    public GeoreferencingDialog(JInternalFrame f, FLyrGeoRaster lyr) {
91
            frame = f;
92
            lyrGeoRaster = lyr;
93
            
94
            frame.addComponentListener(this);
95
            initialize();
96
    }
97
    
98
    /**
99
     * Asigna el frame
100
     * @param f
101
     */
102
    public void setFrame(JInternalFrame f){
103
            frame = f;
104
            frame.addComponentListener(this);
105
    }
106
    
107
    /**
108
     * Obtiene el frame
109
     * @return frame
110
     */
111
    public JInternalFrame getFrame(){
112
            return frame;
113
    }
114
    
115
    /**
116
     * En la inicializaci?n de la ventana a?adimos los tags de est? y cargamos 
117
     * ls herramientas para manejar las imagenes a georeferenciar.
118
     */
119
    private void initialize() {
120
            //Cargamos las herramientas la primera vez que abrimos la ventana
121
        if(!loadTools){
122
                loadTools = true;
123
                com.iver.cit.gvsig.gui.View  vista = null;
124
                        try{
125
                                vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
126
                        }catch(ClassCastException exc){
127
                                return;
128
                        }
129
                MapControl mapCtrl = vista.getMapControl();
130

    
131
                        StatusBarListener sbl = new StatusBarListener(mapCtrl);
132
                        
133
                        ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(mapCtrl);
134
                        ZoomGeorefListener zigl = new ZoomGeorefListener(mapCtrl);
135
                        rb = new GeoRedimBehavior(zigl, this);
136
                        mapCtrl.addMapTool("geoZoom", new Behavior[]{rb,
137
                                                new PointBehavior(zoil), new MouseMovementBehavior(sbl)});
138
                                                        
139
                        GeorefPanListener pl = new GeorefPanListener(mapCtrl);
140
                        mb = new GeoMoveBehavior(pl, this);
141
                        mapCtrl.addMapTool("geoPan", new Behavior[]{mb, new MouseMovementBehavior(sbl)});
142
                        
143
                        //Seleccion de un punto sobre la vista
144
                GeorefPointSelectorListener psl = new GeorefPointSelectorListener(this);
145
                mapCtrl.addMapTool("pointLyrSelection", new Behavior[]{new PointBehavior(psl), new MouseMovementBehavior(sbl)});
146
                
147
                GeorefMovePointListener mpl = new GeorefMovePointListener(this);
148
                mapCtrl.addMapTool("geoMovePoint", new Behavior[]{new DraggedBehavior(mpl), new MouseMovementBehavior(sbl)});
149
                
150
        }
151
        
152
        this.setLayout(new BorderLayout());
153
        if(!enlarge){
154
                this.setPreferredSize(new java.awt.Dimension(normalWidth, normalHeight));
155
                this.setSize(new java.awt.Dimension(normalWidth, normalHeight));
156
                this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(false);
157
                this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(false);
158
        }else{
159
                this.setPreferredSize(new java.awt.Dimension(normalWidth, enlargeHeight));
160
                this.setSize(new java.awt.Dimension(normalWidth, enlargeHeight));
161
                this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(true);
162
                this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(true);
163
        }
164
        this.setLocation(new java.awt.Point(0,0));
165
        
166
        this.add(this.getPBotones(), BorderLayout.SOUTH);
167
        this.add(this.getConectorPanel(), BorderLayout.NORTH);        
168
    }
169
    
170
    
171
    public ConectorPanel getConectorPanel() {
172
            if (conectorPanel == null) {                            
173
                    conectorPanel = new ConectorPanel(this);
174
            }
175
        
176
            return conectorPanel;
177
    }
178
                 
179
        /**
180
         * This method initializes jPanel        
181
         *         
182
         * @return javax.swing.JPanel        
183
         */    
184
        private JPanel getPBotones() {
185
                if (pBotones == null) {
186
                        FlowLayout flowLayout1 = new FlowLayout();
187
                        pBotones = new JPanel();
188
                        pBotones.setLayout(flowLayout1);
189
                        flowLayout1.setHgap(10);
190
                        pBotones.add(getBProcesar(), null);
191
                        pBotones.add(getBLoadPoints(), null);
192
                        pBotones.add(getBSavePoints(), null);
193
                        pBotones.add(getBAceptar(), null);
194
                        pBotones.add(getBCancelar(), null);
195
                }
196
                return pBotones;
197
        }
198
        
199
        
200
        
201
        public class DialogWizardListener implements WizardListener {
202

    
203
                /**
204
                 * @see com.iver.cit.gvsig.gui.wms.WizardListener#error(java.lang.Exception)
205
                 */
206
                public void error(Exception e) {
207
                }
208

    
209
                /**
210
                 * @see com.iver.cit.gvsig.gui.wms.WizardListener#wizardStateChanged(boolean)
211
                 */
212
                public void wizardStateChanged(boolean finishable) {
213
                        getBProcesar().setEnabled(finishable);
214
                }
215
                
216
        }
217
        public static IProjection getLastProjection() {
218
                return proj;
219
        }
220
        public static void setLastProjection(IProjection proj) {
221
                GeoreferencingDialog.proj = proj;
222
        }
223

    
224

    
225

    
226
        /**
227
         * @return Returns the GeoRedimBehavior.
228
         */
229
        public GeoRedimBehavior getGeoRedimBehavior() {
230
                return rb;
231
        }
232

    
233
        /**
234
         * @param rb The GeoRedimBehavior to set.
235
         */
236
        public void setGeoRedimBehavior(GeoRedimBehavior rb) {
237
                this.rb = rb;
238
        }
239
        
240
        /**
241
         * @return Returns the GeoMoveBehavior
242
         */
243
        public GeoMoveBehavior getGeoMoveBehavior() {
244
                return mb;
245
        }
246

    
247
        /**
248
         * @param mb The GeoMoveBehavior to set.
249
         */
250
        public void setGeoMoveBehavior(GeoMoveBehavior mb) {
251
                this.mb = mb;
252
        }
253
        
254

    
255
        /**
256
         * Obtiene el punto de la lista que ha sido seleccionado
257
         * @return
258
         */
259
        public int getSelectedPoint(){
260
                return getConectorPanel().getDataPointsTabPanel().
261
                        getSelectPointsPanel().getTableControlerPanel().getSelectedIndex();
262
        }
263
        
264
        /**
265
         * Obtiene el control de la mini imagen que tiene los botones a la izquierda
266
         * @return ZoomControlPanel
267
         */
268
        public ZoomControlPanel getZoomControlLeft(){
269
                return this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft();
270
        }
271
        
272
        /**
273
         * Obtiene el control de la mini imagen que tiene los botones a la derecha
274
         * @return ZoomControlPanel
275
         */
276
        public ZoomControlPanel getZoomControlRight(){
277
                return this.getConectorPanel().getAdjustGeorefPanel().getZoomRight();
278
        }
279
        
280
        /**
281
         * Obtiene el panel de selecci?n de puntos
282
         * @return Panel de selecci?n de puntos
283
         */
284
        public SelectPointsPanel getSelectPointsPanel(){
285
                return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel();
286
        }
287
        
288
        /**
289
         * Obtiene el panel de opciones
290
         * @return OptionPanel
291
         */
292
        public OptionsPanel getOptionsPanel(){
293
                return getConectorPanel().getAdjustGeorefPanel().getOptionsPanel();
294
        }
295
        
296
        /* (non-Javadoc)
297
         * @see com.iver.andami.ui.mdiManager.SingletonView#getViewModel()
298
         */
299
        /*public ViewInfo getViewInfo() {
300
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODELESSDIALOG |
301
                                ViewInfo.RESIZABLE);
302
                m_viewinfo.setWidth(this.getWidth());
303
                m_viewinfo.setHeight(this.getHeight());
304
                m_viewinfo.setTitle(PluginServices.getText(this,
305
                                "cargar_sin_georef"));
306

307
                return m_viewinfo;
308
        }*/
309
        
310
        /**
311
         * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
312
         */
313
        /*public Object getViewModel() {
314
                return "GeoreferencingDialog";
315
        }*/
316
        
317
                
318
        /**
319
         * This method initializes jButton        
320
         *         
321
         * @return javax.swing.JButton        
322
         */    
323
        private JButton getBAceptar() {
324
                if (bAceptar == null) {
325
                        bAceptar = new JButton();
326
                        bAceptar.setText("aceptar");
327
                        bAceptar.addActionListener(this);
328
                }
329
                return bAceptar;
330
        }
331
                
332
        /**
333
         * Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
334
         * <UL>
335
         * <LI>Cambiamos el nombre a la capa georraster</LI>
336
         * <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
337
         * <LI>Cerramos la ventana</LI>
338
         * </UL>
339
         */
340
        public void actionPerformed(java.awt.event.ActionEvent e) {
341
                com.iver.cit.gvsig.gui.View  theView = null;
342
                try{
343
                        theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
344
                }catch(ClassCastException exc){
345
                        return;
346
                }
347
                
348
                //ACEPTAR 
349
                if(e.getSource() == bAceptar){
350
                        if(getLyrPoints() == null)
351
                                return;
352
                                                
353
                        if(lyrGeoRaster != null){
354
                                getLyrPoints().setVisible(false);
355
                                lyrGeoRaster.setName(lyrGeoRaster.getName().substring(1, lyrGeoRaster.getName().length()));
356
                                lyrGeoRaster.setActive(false);
357
                                theView.getMapControl().getMapContext().invalidate();
358
                        }
359
                        
360
                        try{
361
                                frame.setClosed(true);
362
                        }catch(PropertyVetoException exc){}
363
                }
364
                
365
                //CANCELAR
366
                if(e.getSource() == bCancelar){
367
                        if(getLyrPoints() == null)
368
                                return;
369
                                                
370
                        //Cerramos la ventana 
371
                        //(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener)
372
                        try{
373
                                frame.setClosed(true);
374
                        }catch(PropertyVetoException exc){}
375
                }
376
                
377
                //CARGAR PUNTOS
378
                if(e.getSource() == bLoadPoints){
379
                        JFileChooser chooser = new JFileChooser(lastPathLoad);
380
                        chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
381
                        FileFilter f = null;
382
                        for(int i=0; i<this.fileFilters.length;i++){
383
                                f = new SelectFileFilter(chooser, this.fileFilters[i]);
384
                                chooser.addChoosableFileFilter(f);
385
                        }
386
                        int returnVal = chooser.showOpenDialog(this);
387
                        if(returnVal == JFileChooser.APPROVE_OPTION){
388
                                 String fName = chooser.getSelectedFile().toString();
389
                                 FileFilter filter = chooser.getFileFilter();
390
                                 lastPathLoad = chooser.getCurrentDirectory().getAbsolutePath();
391
                        
392
                                 if(getLyrPoints() == null)
393
                                         return;
394

    
395
                                 lyrGeoRaster.getFLyrPoints().saveState();
396
                                 getLyrPoints().XML2PointList(fName);
397
                                 getLyrPoints().updateData(this);
398
                        }
399
                }
400
                
401
                //SALVAR PUNTOS
402
                if(e.getSource() == bSavePoints){
403
                        JFileChooser chooser = new JFileChooser(lastPathSave);
404
                        chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
405
                        
406
                        //File f = new File(lyrGeoRaster.getName().substring(0, lyrGeoRaster.getName().lastIndexOf("."))+".grf");
407
                        //chooser.setSelectedFile(f);
408
                        FileFilter f = null;
409
                        for(int i=0; i<this.fileFilters.length;i++){
410
                                f = new SelectFileFilter(chooser, this.fileFilters[i]);
411
                                chooser.addChoosableFileFilter(f);
412
                        }
413
                        int returnVal = chooser.showOpenDialog(this);
414
                        if(returnVal == JFileChooser.APPROVE_OPTION){
415
                                 String fName = chooser.getSelectedFile().toString();
416
                                 FileFilter filter = chooser.getFileFilter();
417
                                 lastPathSave = chooser.getCurrentDirectory().getAbsolutePath();
418

    
419
                                 if(getLyrPoints() != null)
420
                                         getLyrPoints().PointList2XML(fName);
421
                        }
422
                        
423
                }
424
        }
425
        
426
        /**
427
         * This method initializes bProcesar        
428
         *         
429
         * @return javax.swing.JButton        
430
         */    
431
        private JButton getBProcesar() {
432
                if (bProcesar == null) {
433
                        bProcesar = new JButton();
434
                        bProcesar.setText("P");
435
                        bProcesar.setEnabled(false);
436
                        bProcesar.setPreferredSize(new java.awt.Dimension(41,25));
437
                        bProcesar.addActionListener(new java.awt.event.ActionListener() { 
438
                                public void actionPerformed(java.awt.event.ActionEvent e) {
439
                    /*if (PluginServices.getMainFrame() == null) {
440
                        ((JDialog) (getParent().getParent().getParent()
441
                                .getParent())).dispose();
442
                    } else {
443
                        PluginServices.getMDIManager().closeView((com.iver.andami.ui.mdiManager.View) GeoreferencingDialog.this);
444
                    }*/
445
                                }
446
                        });
447
                }
448
                return bProcesar;
449
        }
450
        
451
        /**
452
         * El bot?n cancelar restaura el extent con el que se carg? la imagen a georreferenciar
453
         * y cierra la ventana.         
454
         *         
455
         * @return javax.swing.JButton        
456
         */    
457
        private JButton getBCancelar() {
458
                if (bCancelar == null) {
459
                        bCancelar = new JButton();
460
                        bCancelar.setText(PluginServices.getText(this,"cancelar"));
461
                        bCancelar.addActionListener(this);
462
                }
463
                return bCancelar;
464
        }
465
                
466
        /**
467
         * This method initializes jButton        
468
         *         
469
         * @return javax.swing.JButton        
470
         */
471
        private JButton getBLoadPoints() {
472
                if (bLoadPoints == null) {
473
                        bLoadPoints = new JButton();
474
                        bLoadPoints.setText("L");
475
                        bLoadPoints.setEnabled(true);
476
                        bLoadPoints.addActionListener(this);
477
                }
478
                return bLoadPoints;
479
        }
480

    
481
        /**
482
         * Asigna a las textbox el valor de pixel pasado
483
         * @param x        valor x
484
         * @param y        valor y
485
         */
486
        public void setPixelText(double x, double y){
487
                getSelectPointsPanel().getDataPointPanel().getTX().setText(String.valueOf(x));
488
                getSelectPointsPanel().getDataPointPanel().getTY().setText(String.valueOf(y));
489
        }
490
        
491
        /**
492
         * Asigna a las textbox el valor de coordenadas pasado
493
         * @param x        valor x
494
         * @param y        valor y
495
         */
496
        public void setMapCoordText(double x, double y){
497
                getSelectPointsPanel().getDataPointPanel().getLongitud().setText(FLyrPoints.tailDecimal(String.valueOf(x)));
498
                getSelectPointsPanel().getDataPointPanel().getLatitud().setText(FLyrPoints.tailDecimal(String.valueOf(y)));
499
        }
500
        
501
        /**
502
         * Esta funci?n resetea los controles del panel de info de un punto.
503
         */
504
        public void resetControls(boolean active){
505
                getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().resetControls(active);
506
                //getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getTableControlerPanel().resetControls();                
507
                getConectorPanel().getAdjustGeorefPanel().getZoomLeft().clear();
508
                getConectorPanel().getAdjustGeorefPanel().getZoomRight().clear();
509
        }
510
        
511
        /**
512
         * @return Returns the extended.
513
         */
514
        public boolean isEnlarge() {
515
                return enlarge;
516
        }
517

    
518
        /**
519
         * @param extended The extended to set.
520
         */
521
        public void setEnlarge(boolean enlarge) {
522
                this.enlarge = enlarge;
523
                if(!enlarge){
524
                        this.setPreferredSize(new Dimension(this.normalWidth, this.normalHeight));
525
                        this.setSize(new Dimension(this.normalWidth, this.normalHeight));
526
                        frame.setSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10));
527
                        frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10));
528
                        this.getConectorPanel().setCanvasVisible(false);
529
                }else{
530
                        this.setPreferredSize(new Dimension(this.normalWidth, this.enlargeHeight));
531
                        this.setSize(new Dimension(this.normalWidth, this.enlargeHeight));
532
                        frame.setSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10));
533
                        frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10));
534
                        this.getConectorPanel().setCanvasVisible(true);
535
                }
536
                frame.pack();
537
        }        
538

    
539
        /* (non-Javadoc)
540
         * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
541
         */
542
        public void componentHidden(ComponentEvent arg0) {
543
                // TODO Auto-generated method stub
544

    
545
        }
546
        /* (non-Javadoc)
547
         * @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
548
         */
549
        public void componentMoved(ComponentEvent arg0) {
550
                // TODO Auto-generated method stub
551

    
552
        }
553
        /* (non-Javadoc)
554
         * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
555
         */
556
        public void componentResized(ComponentEvent ev) {
557
                
558
                if(frame.getWidth() <= this.normalWidth + 10)
559
                        frame.setSize(this.normalWidth, frame.getHeight());
560
                
561
                if(this.getConectorPanel().getDataPointsTabPanel().getTbPoints().getSelectedIndex() == 1){
562
                        tmpWidth = frame.getWidth();
563
                        this.newFrameSize(frame.getWidth(), frame.getHeight() - 10);
564
                }
565
        }
566
        /* (non-Javadoc)
567
         * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
568
         */
569
        public void componentShown(ComponentEvent arg0) {
570
                // TODO Auto-generated method stub
571

    
572
        }
573
        
574
    /**
575
     *Inicializa el tama?o del dialogo
576
     */
577
    public void resetSize(){
578
            if(!enlarge){
579
                    frame.setSize(this.normalWidth + 12, this.normalHeight + 10);
580
            }else{
581
                    frame.setSize(this.normalWidth + 12, this.enlargeHeight + 10);
582
            }
583
            newFrameSize((int)Math.round(this.normalWidth / 0.98), this.normalHeight);
584
    }
585
        
586
        /**
587
         * Calculo del nuevo tama?o a partir de un frame redimensionado
588
         * @param w Ancho del frame
589
         * @param h Alto del frame
590
         */
591
        public void newFrameSize(int w, int h){
592
                int newWidth = (int)Math.round(w * 0.98);
593
                                
594
        this.setSize(new java.awt.Dimension(newWidth, normalHeight));
595
        this.setPreferredSize(new java.awt.Dimension(newWidth, normalHeight));
596
        this.getConectorPanel().newFrameSize(newWidth, h);    
597
        }
598

    
599
        /**
600
         * @return Returns the tmpWidth.
601
         */
602
        public int getTmpWidth() {
603
                return tmpWidth;
604
        }
605
        /**
606
         * @param tmpWidth The tmpWidth to set.
607
         */
608
        public void setTmpWidth(int tmpWidth) {
609
                this.tmpWidth = tmpWidth;
610
        }
611
        /**
612
         * @return Returns the enlargeHeight.
613
         */
614
        public int getEnlargeHeight() {
615
                return enlargeHeight;
616
        }
617
        /**
618
         * @return Returns the normalHeight.
619
         */
620
        public int getNormalHeight() {
621
                return normalHeight;
622
        }
623

    
624
        /**
625
         * @return Returns the normalWidth.
626
         */
627
        public int getNormalWidth() {
628
                return normalWidth;
629
        }
630
        /**
631
         * This method initializes jButton        
632
         *         
633
         * @return javax.swing.JButton        
634
         */    
635
        private JButton getBSavePoints() {
636
                if (bSavePoints == null) {
637
                        bSavePoints = new JButton();
638
                        bSavePoints.setText("S");
639
                        bSavePoints.setPreferredSize(new java.awt.Dimension(41,25));
640
                        bSavePoints.addActionListener(this);
641
                }
642
                return bSavePoints;
643
        }
644
        
645
        /**
646
         * Asigna el valor del campo RMS
647
         * @param rms Cadena que representa el RMS
648
         */
649
        public void setRMS(String rms){
650
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTRMS().setText(rms);
651
        }
652
        
653
        /**
654
         * Asigna el valor del campo de residuo en X
655
         * @param rms Cadena que representa el RMS
656
         */
657
        public void setResX(String resX){
658
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResX().setText(resX);
659
        }
660
        
661
        /**
662
         * Asigna el valor del campo de residuo en Y
663
         * @param rms Cadena que representa el RMS
664
         */
665
        public void setResY(String resY){
666
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResY().setText(resY);
667
        }
668
        
669
        /**
670
         * Asigna el valor del campo RMS
671
         * @param rms Cadena que representa el RMS
672
         */
673
        public void setTotal(String total){
674
                this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTTotal().setText(total);
675
        }
676
        /**
677
         * @author Nacho Brodin (brodin_ign@gva.es)
678
         */
679
        class SelectFileFilter extends javax.swing.filechooser.FileFilter {
680
                
681
                private JFileChooser chooser = null;
682
                private String file = null;
683
                
684
                public SelectFileFilter(JFileChooser ch, String file){
685
                        this.chooser = ch;
686
                        this.file = file;
687
                }
688
                
689
            public boolean accept(File f) {
690

    
691
                    return f.isDirectory() || f.getName().toLowerCase().endsWith("."+file);
692
            }
693
            
694
            public String getDescription() {
695
                    return file;
696
            }
697
            
698
        }
699
        /**
700
         * @return Returns the lyrGeoRaster.
701
         */
702
        public FLyrGeoRaster getLyrGeoRaster() {
703
                return lyrGeoRaster;
704
        }
705

    
706
        /**
707
         * @return Returns the lyrPoints.
708
         */
709
        public FLyrPoints getLyrPoints() {
710
                try{
711
                        return lyrGeoRaster.getFLyrPoints();                                                
712
                }catch(ClassCastException exc){
713
                        return null;
714
                }
715
        }
716
        
717
        /**
718
         * Selecciona un tab del cuadro
719
         * @param index
720
         */
721
        public void setSelectedTab(int index){
722
                this.getConectorPanel().getDataPointsTabPanel().getTbPoints().setSelectedIndex(index);
723
        }
724
        
725
        //INTERFAZ PARA EL CONTROL DE TABLA
726
        
727
        public PointTable getTable(){
728
                return this.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getJTable();
729
        }
730
        
731
        /**
732
         * Elimina un punto de la tabla de puntos
733
         * @param pos Posici?n del punto a eliminar
734
         */
735
        public void removeTableValueAt(int pos) throws ArrayIndexOutOfBoundsException{
736
                ((DefaultTableModel)this.getTable().getTable().getModel()).removeRow(pos);
737
        }
738
        
739
        /**
740
         * Asigna un valor a una posici?n de la tabla
741
         * @param value Valor a asignar
742
         * @param row        Fila en la que se asigna
743
         * @param col        Columna en la que se asigna
744
         */
745
        public void setTableValueAt(String value, int row, int col)throws ArrayIndexOutOfBoundsException{
746
                ((DefaultTableModel)this.getTable().getTable().getModel()).setValueAt(value, row, col);
747
        }
748
        
749
        /**
750
         * Obtiene el n?mero de filas de la tabla
751
         * @return N?mero de filas de la tabla
752
         */
753
        public int getTableRowCount(){
754
                return this.getTable().getTable().getRowCount();
755
        }
756
        
757
        /**
758
         * A?ade una nueva fila a la tabla de puntos
759
         */
760
        public void addTableNew(){
761
                this.getTable().getTableModel().addNew();
762
        }
763
                
764
 }  //  @jve:decl-index=0:visual-constraint="10,10"
765
 //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
766
//  @jve:visual-info  decl-index=0 visual-constraint="10,10"