root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / GeorefOptionsPanel.java @ 8269
History | View | Annotate | Download (11.3 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.panels; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.FlowLayout; |
23 |
import java.awt.GridBagConstraints; |
24 |
import java.awt.GridBagLayout; |
25 |
import java.awt.event.ActionListener; |
26 |
|
27 |
import javax.swing.JCheckBox; |
28 |
import javax.swing.JComboBox; |
29 |
import javax.swing.JLabel; |
30 |
import javax.swing.JPanel; |
31 |
|
32 |
import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog; |
33 |
|
34 |
import com.iver.andami.PluginServices; |
35 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
36 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
37 |
/**
|
38 |
* Panel que contiene opciones de georreferenciaci?n a elegir por
|
39 |
* el usuario. Esta clase no maneja eventos.
|
40 |
*
|
41 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
42 |
*
|
43 |
*/
|
44 |
public class GeorefOptionsPanel extends JPanel implements ActionListener{ |
45 |
|
46 |
private JPanel pGeneral = null; |
47 |
private JPanel pGrado = null; |
48 |
private GeoreferencingDialog grd = null; |
49 |
|
50 |
private JLabel lGrado = null; |
51 |
private JComboBox cbGrado = null; |
52 |
private JPanel pAlgoritmo = null; |
53 |
private JLabel lAlgoritmo = null; |
54 |
private JComboBox cbAlgoritmo = null; |
55 |
private JPanel jPanel = null; |
56 |
private JPanel jPanel1 = null; |
57 |
private JPanel jPanel11 = null; |
58 |
private JPanel jPanel12 = null; |
59 |
private JPanel jPanel13 = null; |
60 |
private JPanel jPanel14 = null; |
61 |
private JPanel jPanel15 = null; |
62 |
private JPanel jPanel16 = null; |
63 |
|
64 |
/**
|
65 |
* This is the default constructor
|
66 |
*/
|
67 |
public GeorefOptionsPanel(GeoreferencingDialog grd) {
|
68 |
super();
|
69 |
this.grd = grd;
|
70 |
initialize(); |
71 |
} |
72 |
|
73 |
/**
|
74 |
* This method initializes this
|
75 |
*
|
76 |
* @return void
|
77 |
*/
|
78 |
private void initialize() { |
79 |
this.setLayout(new BorderLayout()); |
80 |
this.setPreferredSize(new java.awt.Dimension(380,160)); |
81 |
this.setBounds(0, 0, 380, 160); |
82 |
this.add(getPGeneral(), java.awt.BorderLayout.CENTER);
|
83 |
} |
84 |
|
85 |
/**
|
86 |
* This method initializes jPanel
|
87 |
*
|
88 |
* @return javax.swing.JPanel
|
89 |
*/
|
90 |
private JPanel getPGeneral() { |
91 |
if (pGeneral == null) { |
92 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
93 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
94 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
95 |
pGeneral = new JPanel(); |
96 |
pGeneral.setLayout(new GridBagLayout()); |
97 |
pGeneral.setPreferredSize(new java.awt.Dimension(380,20)); |
98 |
gridBagConstraints5.gridx = 0;
|
99 |
gridBagConstraints5.gridy = 0;
|
100 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
101 |
gridBagConstraints5.gridheight = 1;
|
102 |
gridBagConstraints5.gridwidth = 1;
|
103 |
gridBagConstraints1.gridx = 0;
|
104 |
gridBagConstraints1.gridy = 1;
|
105 |
gridBagConstraints7.gridx = 0;
|
106 |
gridBagConstraints7.gridy = 2;
|
107 |
pGeneral.add(getPGrado(), gridBagConstraints5); |
108 |
pGeneral.add(getPAlgoritmo(), gridBagConstraints1); |
109 |
pGeneral.add(getJPanel(), gridBagConstraints7); |
110 |
} |
111 |
return pGeneral;
|
112 |
} |
113 |
/**
|
114 |
* This method initializes jPanel1
|
115 |
*
|
116 |
* @return javax.swing.JPanel
|
117 |
*/
|
118 |
private JPanel getPGrado() { |
119 |
if (pGrado == null) { |
120 |
lGrado = new JLabel(); |
121 |
FlowLayout flowLayout6 = new FlowLayout(); |
122 |
pGrado = new JPanel(); |
123 |
pGrado.setLayout(flowLayout6); |
124 |
pGrado.setPreferredSize(new java.awt.Dimension(370,30)); |
125 |
pGrado.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0)); |
126 |
flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
127 |
flowLayout6.setHgap(10);
|
128 |
flowLayout6.setVgap(3);
|
129 |
lGrado.setText(PluginServices.getText(this,"grado_polinomio")); |
130 |
pGrado.add(lGrado, null);
|
131 |
pGrado.add(getCbGrado(), null);
|
132 |
lGrado.setVisible(false);
|
133 |
getCbGrado().setVisible(false);
|
134 |
} |
135 |
return pGrado;
|
136 |
} |
137 |
|
138 |
/**
|
139 |
* This method initializes jComboBox
|
140 |
*
|
141 |
* @return javax.swing.JComboBox
|
142 |
*/
|
143 |
private JComboBox getCbGrado() { |
144 |
if (cbGrado == null) { |
145 |
cbGrado = new JComboBox(); |
146 |
} |
147 |
return cbGrado;
|
148 |
} |
149 |
/**
|
150 |
* This method initializes jPanel
|
151 |
*
|
152 |
* @return javax.swing.JPanel
|
153 |
*/
|
154 |
private JPanel getPAlgoritmo() { |
155 |
if (pAlgoritmo == null) { |
156 |
lAlgoritmo = new JLabel(); |
157 |
FlowLayout flowLayout2 = new FlowLayout(); |
158 |
pAlgoritmo = new JPanel(); |
159 |
pAlgoritmo.setLayout(flowLayout2); |
160 |
lAlgoritmo.setText(PluginServices.getText(this,"algoritmo")); |
161 |
pAlgoritmo.setPreferredSize(new java.awt.Dimension(370,30)); |
162 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
163 |
flowLayout2.setHgap(10);
|
164 |
flowLayout2.setVgap(3);
|
165 |
pAlgoritmo.add(lAlgoritmo, null);
|
166 |
pAlgoritmo.add(getCbAlgoritmo(), null);
|
167 |
pAlgoritmo.setVisible(false);
|
168 |
getCbAlgoritmo().setVisible(false);
|
169 |
} |
170 |
return pAlgoritmo;
|
171 |
} |
172 |
/**
|
173 |
* This method initializes jComboBox
|
174 |
*
|
175 |
* @return javax.swing.JComboBox
|
176 |
*/
|
177 |
private JComboBox getCbAlgoritmo() { |
178 |
if (cbAlgoritmo == null) { |
179 |
cbAlgoritmo = new JComboBox(); |
180 |
} |
181 |
return cbAlgoritmo;
|
182 |
} |
183 |
/**
|
184 |
* This method initializes jPanel
|
185 |
*
|
186 |
* @return javax.swing.JPanel
|
187 |
*/
|
188 |
private JPanel getJPanel() { |
189 |
if (jPanel == null) { |
190 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
191 |
gridBagConstraints2.gridx = 0;
|
192 |
gridBagConstraints2.gridy = 1;
|
193 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
194 |
gridBagConstraints.gridx = 0;
|
195 |
gridBagConstraints.gridy = 0;
|
196 |
GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
197 |
gridBagConstraints3.gridx = 0;
|
198 |
gridBagConstraints3.gridy = 2;
|
199 |
GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
200 |
gridBagConstraints4.gridx = 0;
|
201 |
gridBagConstraints4.gridy = 3;
|
202 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
203 |
gridBagConstraints5.gridx = 0;
|
204 |
gridBagConstraints5.gridy = 4;
|
205 |
GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); |
206 |
gridBagConstraints6.gridx = 0;
|
207 |
gridBagConstraints6.gridy = 5;
|
208 |
jPanel = new JPanel(); |
209 |
jPanel.setLayout(new GridBagLayout()); |
210 |
jPanel.setPreferredSize(new java.awt.Dimension(370,120)); |
211 |
jPanel.add(getJPanel11(), gridBagConstraints); |
212 |
jPanel.add(getJPanel12(), gridBagConstraints2); |
213 |
jPanel.add(getJPanel13(), gridBagConstraints3); |
214 |
jPanel.add(getJPanel14(), gridBagConstraints4); |
215 |
jPanel.add(getJPanel15(), gridBagConstraints5); |
216 |
jPanel.add(getJPanel16(), gridBagConstraints6); |
217 |
} |
218 |
return jPanel;
|
219 |
} |
220 |
|
221 |
/**
|
222 |
* Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
|
223 |
* <UL>
|
224 |
* <LI>Cambiamos el nombre a la capa georraster</LI>
|
225 |
* <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
|
226 |
* <LI>Cerramos la ventana</LI>
|
227 |
* </UL>
|
228 |
*/
|
229 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
230 |
if(e.getSource() instanceof JCheckBox){ |
231 |
if(((JCheckBox)e.getSource()).getName().equals("mostrar_puntos")){ |
232 |
FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints(); |
233 |
View theView = null; |
234 |
try{
|
235 |
theView = (View) PluginServices.getMDIManager().getActiveWindow();
|
236 |
}catch(ClassCastException exc){ |
237 |
return;
|
238 |
} |
239 |
|
240 |
if(((JCheckBox)e.getSource()).isSelected()){ //Mostramos el n?mero de punto |
241 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true);
|
242 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
243 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
244 |
theView.getMapControl().getMapContext().invalidate(); |
245 |
}else{ //Ocultamos el n?mero de punto |
246 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false);
|
247 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
248 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
249 |
theView.getMapControl().getMapContext().invalidate(); |
250 |
} |
251 |
} |
252 |
|
253 |
if(((JCheckBox)e.getSource()).getName().equals("crear_worldfile")){ |
254 |
if(((JCheckBox)e.getSource()).isSelected()) |
255 |
grd.setCreateWorldFile(true);
|
256 |
else
|
257 |
grd.setCreateWorldFile(false);
|
258 |
} |
259 |
|
260 |
if(((JCheckBox)e.getSource()).getName().equals("errores_csv")){ |
261 |
if(((JCheckBox)e.getSource()).isSelected()) |
262 |
grd.setErrorCSV(true);
|
263 |
else
|
264 |
grd.setErrorCSV(false);
|
265 |
} |
266 |
|
267 |
if(((JCheckBox)e.getSource()).getName().equals("desactivar_capa")){ |
268 |
if(((JCheckBox)e.getSource()).isSelected()) |
269 |
grd.setOffLayer(true);
|
270 |
else
|
271 |
grd.setOffLayer(false);
|
272 |
} |
273 |
|
274 |
if(((JCheckBox)e.getSource()).getName().equals("centrar_punto")){ |
275 |
if(((JCheckBox)e.getSource()).isSelected()) |
276 |
grd.setCenterPoint(true);
|
277 |
else
|
278 |
grd.setCenterPoint(false);
|
279 |
|
280 |
} |
281 |
|
282 |
if(((JCheckBox)e.getSource()).getName().equals("desactivar_puntos")){ |
283 |
if(((JCheckBox)e.getSource()).isSelected()) |
284 |
grd.setOffPoints(true);
|
285 |
else
|
286 |
grd.setOffPoints(false);
|
287 |
|
288 |
} |
289 |
} |
290 |
} |
291 |
|
292 |
/**
|
293 |
* This method initializes jPanel11
|
294 |
*
|
295 |
* @return javax.swing.JPanel
|
296 |
*/
|
297 |
private JPanel getJPanel11() { |
298 |
if (jPanel11 == null) { |
299 |
jPanel11 = new OptionsPanel(this.grd, "mostrar_puntos"); |
300 |
((OptionsPanel)jPanel11).getCbCheckBox().addActionListener(this);
|
301 |
} |
302 |
return jPanel11;
|
303 |
} |
304 |
|
305 |
/**
|
306 |
* This method initializes jPanel12
|
307 |
*
|
308 |
* @return javax.swing.JPanel
|
309 |
*/
|
310 |
private JPanel getJPanel12() { |
311 |
if (jPanel12 == null) { |
312 |
jPanel12 = new OptionsPanel(this.grd, "crear_worldfile"); |
313 |
((OptionsPanel)jPanel12).getCbCheckBox().setSelected(true);
|
314 |
((OptionsPanel)jPanel12).getCbCheckBox().addActionListener(this);
|
315 |
} |
316 |
return jPanel12;
|
317 |
} |
318 |
|
319 |
/**
|
320 |
* This method initializes jPanel13
|
321 |
*
|
322 |
* @return javax.swing.JPanel
|
323 |
*/
|
324 |
private JPanel getJPanel13() { |
325 |
if (jPanel13 == null) { |
326 |
jPanel13 = new OptionsPanel(this.grd, "errores_csv"); |
327 |
((OptionsPanel)jPanel13).getCbCheckBox().setSelected(true);
|
328 |
((OptionsPanel)jPanel13).getCbCheckBox().addActionListener(this);
|
329 |
} |
330 |
return jPanel13;
|
331 |
} |
332 |
|
333 |
/**
|
334 |
* This method initializes jPanel14
|
335 |
*
|
336 |
* @return javax.swing.JPanel
|
337 |
*/
|
338 |
private JPanel getJPanel14() { |
339 |
if (jPanel14 == null) { |
340 |
jPanel14 = new OptionsPanel(this.grd, "desactivar_capa"); |
341 |
((OptionsPanel)jPanel14).getCbCheckBox().setSelected(true);
|
342 |
((OptionsPanel)jPanel14).getCbCheckBox().addActionListener(this);
|
343 |
} |
344 |
return jPanel14;
|
345 |
} |
346 |
|
347 |
/**
|
348 |
* This method initializes jPanel15
|
349 |
*
|
350 |
* @return javax.swing.JPanel
|
351 |
*/
|
352 |
private JPanel getJPanel15() { |
353 |
if (jPanel15 == null) { |
354 |
jPanel15 = new OptionsPanel(this.grd, "centrar_punto"); |
355 |
((OptionsPanel)jPanel15).getCbCheckBox().setSelected(true);
|
356 |
((OptionsPanel)jPanel15).getCbCheckBox().addActionListener(this);
|
357 |
} |
358 |
return jPanel15;
|
359 |
} |
360 |
|
361 |
/**
|
362 |
* This method initializes jPanel16
|
363 |
*
|
364 |
* @return javax.swing.JPanel
|
365 |
*/
|
366 |
private JPanel getJPanel16() { |
367 |
if (jPanel16 == null) { |
368 |
jPanel16 = new OptionsPanel(this.grd, "desactivar_puntos"); |
369 |
((OptionsPanel)jPanel16).getCbCheckBox().setSelected(true);
|
370 |
((OptionsPanel)jPanel16).getCbCheckBox().addActionListener(this);
|
371 |
} |
372 |
return jPanel16;
|
373 |
} |
374 |
} |