Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1002 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / options / GeorefTableOptionsPanel.java @ 12070

History | View | Annotate | Download (7.01 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 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 org.gvsig.georeferencing.gui.options;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.GridBagConstraints;
23
import java.awt.GridBagLayout;
24
import java.awt.event.ActionListener;
25

    
26
import javax.swing.JCheckBox;
27
import javax.swing.JPanel;
28
import javax.swing.JTable;
29

    
30
import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog;
31
import org.gvsig.georeferencing.gui.options.TableOptions.TableModelPoint;
32

    
33
import com.iver.andami.PluginServices;
34
import com.iver.cit.gvsig.fmap.layers.FLyrPoints;
35
import com.iver.cit.gvsig.project.documents.view.gui.View;
36

    
37
import java.awt.FlowLayout;
38

    
39
/**
40
 * Panel que contiene opciones de georreferenciaci?n a elegir por
41
 * el usuario. Esta clase no maneja eventos.
42
 * 
43
 * @author Nacho Brodin (brodin_ign@gva.es)
44
 *
45
 */
46
public class GeorefTableOptionsPanel extends JPanel implements ActionListener{
47

    
48
        private GeoreferencingDialog grd = null;
49
        
50
        private JPanel                                 jPanel = null;
51
        private TableOptions         tableOptions = null;
52
        
53
        /**
54
         * This is the default constructor
55
         */
56
        public GeorefTableOptionsPanel(GeoreferencingDialog grd) {
57
                super();
58
                this.grd = grd;
59
                initialize();
60
        }
61

    
62
        /**
63
         * This method initializes this
64
         * 
65
         * @return void
66
         */
67
        private void initialize() {
68
        this.setLayout(new FlowLayout());
69
        this.setPreferredSize(new java.awt.Dimension(380,160));
70
        this.setBounds(0, 0, 380, 160);
71
        this.add(getJTableOptions(), java.awt.BorderLayout.NORTH);
72
        }
73

    
74
                
75
        public TableOptions getJTableOptions(){
76
                if(tableOptions == null){
77
                        tableOptions = new TableOptions();
78
                        tableOptions.setPreferredSize(new java.awt.Dimension(380,160));
79
                        tableOptions.setEntry(true, PluginServices.getText(null, "mostrar_puntos"));
80
                        tableOptions.setEntry(true, PluginServices.getText(null, "crear_worldfile"));
81
                        tableOptions.setEntry(true, PluginServices.getText(null, "errores_csv"));
82
                        tableOptions.setEntry(true, PluginServices.getText(null, "desactivar_capa"));
83
                        tableOptions.setEntry(true, PluginServices.getText(null, "centrar_punto"));
84
                        tableOptions.setEntry(true, PluginServices.getText(null, "desactivar_puntos"));
85
                }
86
                return tableOptions;
87
        }
88
        
89
        /**
90
         * Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
91
         * <UL>
92
         * <LI>Cambiamos el nombre a la capa georraster</LI>
93
         * <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
94
         * <LI>Cerramos la ventana</LI>
95
         * </UL>
96
         */
97
        public void actionPerformed(java.awt.event.ActionEvent e) {
98
                if(e.getSource() instanceof JCheckBox){
99
                        if(((JCheckBox)e.getSource()).getName().equals("mostrar_puntos")){
100
                                FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints();
101
                                View theView = null;
102
                                try{
103
                                        theView = (View) PluginServices.getMDIManager().getActiveWindow();
104
                                }catch(ClassCastException exc){
105
                                        return;
106
                                }
107
                                                                
108
                                if(((JCheckBox)e.getSource()).isSelected()){ //Mostramos el n?mero de punto
109
                                        grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true);
110
                                        grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw();
111
                                        grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw();
112
                                        theView.getMapControl().getMapContext().invalidate();
113
                                }else{ //Ocultamos el n?mero de punto
114
                                        grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false);
115
                                        grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw();
116
                                        grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw();
117
                                        theView.getMapControl().getMapContext().invalidate();
118
                                }
119
                        }
120
                        
121
                        if(((JCheckBox)e.getSource()).getName().equals("crear_worldfile")){
122
                                if(((JCheckBox)e.getSource()).isSelected())
123
                                        grd.setCreateWorldFile(true);
124
                                else
125
                                        grd.setCreateWorldFile(false);
126
                        }
127
                        
128
                        if(((JCheckBox)e.getSource()).getName().equals("errores_csv")){
129
                                if(((JCheckBox)e.getSource()).isSelected())
130
                                        grd.setErrorCSV(true);
131
                                else
132
                                        grd.setErrorCSV(false);
133
                        }
134
                        
135
                        if(((JCheckBox)e.getSource()).getName().equals("desactivar_capa")){
136
                                if(((JCheckBox)e.getSource()).isSelected())
137
                                        grd.setOffLayer(true);
138
                                else
139
                                        grd.setOffLayer(false);
140
                        }
141
                        
142
                        if(((JCheckBox)e.getSource()).getName().equals("centrar_punto")){
143
                                if(((JCheckBox)e.getSource()).isSelected())
144
                                        grd.setCenterPoint(true);
145
                                else
146
                                        grd.setCenterPoint(false);
147
                                        
148
                        }
149
                        
150
                        if(((JCheckBox)e.getSource()).getName().equals("desactivar_puntos")){
151
                                if(((JCheckBox)e.getSource()).isSelected())
152
                                        grd.setOffPoints(true);
153
                                else
154
                                        grd.setOffPoints(false);
155
                                        
156
                        }
157
                }
158
        }
159

    
160
        
161
        /*private JPanel getJPanel11() {
162
                if (jPanel11 == null) {
163
                        jPanel11 =  new TableOptionsPanel(this.grd, "mostrar_puntos");
164
                        ((TableOptionsPanel)jPanel11).getCbCheckBox().addActionListener(this);
165
                }
166
                return jPanel11;
167
        }
168

169
        private JPanel getJPanel12() {
170
                if (jPanel12 == null) {
171
                        jPanel12 =  new TableOptionsPanel(this.grd, "crear_worldfile");
172
                        ((TableOptionsPanel)jPanel12).getCbCheckBox().setSelected(false);
173
                        ((TableOptionsPanel)jPanel12).getCbCheckBox().addActionListener(this);
174
                }
175
                return jPanel12;
176
        }
177

178
        private JPanel getJPanel13() {
179
                if (jPanel13 == null) {
180
                        jPanel13 =  new TableOptionsPanel(this.grd, "errores_csv");
181
                        ((TableOptionsPanel)jPanel13).getCbCheckBox().setSelected(true);
182
                        ((TableOptionsPanel)jPanel13).getCbCheckBox().addActionListener(this);
183
                }
184
                return jPanel13;
185
        }
186

187
        private JPanel getJPanel14() {
188
                if (jPanel14 == null) {
189
                        jPanel14 =  new TableOptionsPanel(this.grd, "desactivar_capa");
190
                        ((TableOptionsPanel)jPanel14).getCbCheckBox().setSelected(true);
191
                        ((TableOptionsPanel)jPanel14).getCbCheckBox().addActionListener(this);
192
                }
193
                return jPanel14;
194
        }
195
        
196
        private JPanel getJPanel15() {
197
                if (jPanel15 == null) {
198
                        jPanel15 =  new TableOptionsPanel(this.grd, "centrar_punto");
199
                        ((TableOptionsPanel)jPanel15).getCbCheckBox().setSelected(true);
200
                        ((TableOptionsPanel)jPanel15).getCbCheckBox().addActionListener(this);
201
                }
202
                return jPanel15;
203
        }
204
        
205
        private JPanel getJPanel16() {
206
                if (jPanel16 == null) {
207
                        jPanel16 =  new TableOptionsPanel(this.grd, "desactivar_puntos");
208
                        ((TableOptionsPanel)jPanel16).getCbCheckBox().setSelected(true);
209
                        ((TableOptionsPanel)jPanel16).getCbCheckBox().addActionListener(this);
210
                }
211
                return jPanel16;
212
        }*/
213
 }