svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / GeorefOptionsPanel.java @ 5217
History | View | Annotate | Download (7.41 KB)
1 |
package org.gvsig.georeferencing.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.FlowLayout; |
5 |
import java.awt.GridBagConstraints; |
6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.event.ActionListener; |
8 |
|
9 |
import javax.swing.JCheckBox; |
10 |
import javax.swing.JComboBox; |
11 |
import javax.swing.JLabel; |
12 |
import javax.swing.JPanel; |
13 |
|
14 |
import org.gvsig.georeferencing.gui.dialogs.GeoreferencingDialog; |
15 |
import org.gvsig.georeferencing.layers.FLyrPoints; |
16 |
|
17 |
import com.iver.andami.PluginServices; |
18 |
import com.iver.cit.gvsig.gui.View; |
19 |
/**
|
20 |
* Panel que contiene opciones de georreferenciaci?n a elegir por
|
21 |
* el usuario. Esta clase no maneja eventos.
|
22 |
*
|
23 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
24 |
*
|
25 |
*/
|
26 |
public class GeorefOptionsPanel extends JPanel implements ActionListener{ |
27 |
|
28 |
private JPanel pGeneral = null; |
29 |
private JPanel pGrado = null; |
30 |
private GeoreferencingDialog grd = null; |
31 |
|
32 |
private JLabel lGrado = null; |
33 |
private JComboBox cbGrado = null; |
34 |
private JPanel pAlgoritmo = null; |
35 |
private JLabel lAlgoritmo = null; |
36 |
private JComboBox cbAlgoritmo = null; |
37 |
private JPanel jPanel = null; |
38 |
private JPanel jPanel1 = null; |
39 |
private JPanel jPanel11 = null; |
40 |
private JPanel jPanel12 = null; |
41 |
|
42 |
/**
|
43 |
* This is the default constructor
|
44 |
*/
|
45 |
public GeorefOptionsPanel(GeoreferencingDialog grd) {
|
46 |
super();
|
47 |
this.grd = grd;
|
48 |
initialize(); |
49 |
} |
50 |
|
51 |
/**
|
52 |
* This method initializes this
|
53 |
*
|
54 |
* @return void
|
55 |
*/
|
56 |
private void initialize() { |
57 |
this.setLayout(new BorderLayout()); |
58 |
this.setPreferredSize(new java.awt.Dimension(380,160)); |
59 |
this.setBounds(0, 0, 380, 160); |
60 |
this.add(getPGeneral(), java.awt.BorderLayout.CENTER);
|
61 |
} |
62 |
|
63 |
/**
|
64 |
* This method initializes jPanel
|
65 |
*
|
66 |
* @return javax.swing.JPanel
|
67 |
*/
|
68 |
private JPanel getPGeneral() { |
69 |
if (pGeneral == null) { |
70 |
GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); |
71 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
72 |
GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); |
73 |
pGeneral = new JPanel(); |
74 |
pGeneral.setLayout(new GridBagLayout()); |
75 |
pGeneral.setPreferredSize(new java.awt.Dimension(380,20)); |
76 |
gridBagConstraints5.gridx = 0;
|
77 |
gridBagConstraints5.gridy = 0;
|
78 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
79 |
gridBagConstraints5.gridheight = 1;
|
80 |
gridBagConstraints5.gridwidth = 1;
|
81 |
gridBagConstraints1.gridx = 0;
|
82 |
gridBagConstraints1.gridy = 1;
|
83 |
gridBagConstraints7.gridx = 0;
|
84 |
gridBagConstraints7.gridy = 2;
|
85 |
pGeneral.add(getPGrado(), gridBagConstraints5); |
86 |
pGeneral.add(getPAlgoritmo(), gridBagConstraints1); |
87 |
pGeneral.add(getJPanel(), gridBagConstraints7); |
88 |
} |
89 |
return pGeneral;
|
90 |
} |
91 |
/**
|
92 |
* This method initializes jPanel1
|
93 |
*
|
94 |
* @return javax.swing.JPanel
|
95 |
*/
|
96 |
private JPanel getPGrado() { |
97 |
if (pGrado == null) { |
98 |
lGrado = new JLabel(); |
99 |
FlowLayout flowLayout6 = new FlowLayout(); |
100 |
pGrado = new JPanel(); |
101 |
pGrado.setLayout(flowLayout6); |
102 |
pGrado.setPreferredSize(new java.awt.Dimension(370,30)); |
103 |
pGrado.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0)); |
104 |
flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
105 |
flowLayout6.setHgap(10);
|
106 |
flowLayout6.setVgap(3);
|
107 |
lGrado.setText(PluginServices.getText(this,"grado_polinomio")); |
108 |
pGrado.add(lGrado, null);
|
109 |
pGrado.add(getCbGrado(), null);
|
110 |
lGrado.setVisible(false);
|
111 |
getCbGrado().setVisible(false);
|
112 |
} |
113 |
return pGrado;
|
114 |
} |
115 |
|
116 |
/**
|
117 |
* This method initializes jComboBox
|
118 |
*
|
119 |
* @return javax.swing.JComboBox
|
120 |
*/
|
121 |
private JComboBox getCbGrado() { |
122 |
if (cbGrado == null) { |
123 |
cbGrado = new JComboBox(); |
124 |
} |
125 |
return cbGrado;
|
126 |
} |
127 |
/**
|
128 |
* This method initializes jPanel
|
129 |
*
|
130 |
* @return javax.swing.JPanel
|
131 |
*/
|
132 |
private JPanel getPAlgoritmo() { |
133 |
if (pAlgoritmo == null) { |
134 |
lAlgoritmo = new JLabel(); |
135 |
FlowLayout flowLayout2 = new FlowLayout(); |
136 |
pAlgoritmo = new JPanel(); |
137 |
pAlgoritmo.setLayout(flowLayout2); |
138 |
lAlgoritmo.setText(PluginServices.getText(this,"algoritmo")); |
139 |
pAlgoritmo.setPreferredSize(new java.awt.Dimension(370,30)); |
140 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
141 |
flowLayout2.setHgap(10);
|
142 |
flowLayout2.setVgap(3);
|
143 |
pAlgoritmo.add(lAlgoritmo, null);
|
144 |
pAlgoritmo.add(getCbAlgoritmo(), null);
|
145 |
pAlgoritmo.setVisible(false);
|
146 |
getCbAlgoritmo().setVisible(false);
|
147 |
} |
148 |
return pAlgoritmo;
|
149 |
} |
150 |
/**
|
151 |
* This method initializes jComboBox
|
152 |
*
|
153 |
* @return javax.swing.JComboBox
|
154 |
*/
|
155 |
private JComboBox getCbAlgoritmo() { |
156 |
if (cbAlgoritmo == null) { |
157 |
cbAlgoritmo = new JComboBox(); |
158 |
} |
159 |
return cbAlgoritmo;
|
160 |
} |
161 |
/**
|
162 |
* This method initializes jPanel
|
163 |
*
|
164 |
* @return javax.swing.JPanel
|
165 |
*/
|
166 |
private JPanel getJPanel() { |
167 |
if (jPanel == null) { |
168 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
169 |
gridBagConstraints2.gridx = 0;
|
170 |
gridBagConstraints2.gridy = 1;
|
171 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
172 |
gridBagConstraints.gridx = 0;
|
173 |
gridBagConstraints.gridy = 0;
|
174 |
jPanel = new JPanel(); |
175 |
jPanel.setLayout(new GridBagLayout()); |
176 |
jPanel.setPreferredSize(new java.awt.Dimension(370,75)); |
177 |
jPanel.add(getJPanel11(), gridBagConstraints); |
178 |
jPanel.add(getJPanel12(), gridBagConstraints2); |
179 |
} |
180 |
return jPanel;
|
181 |
} |
182 |
|
183 |
/**
|
184 |
* Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
|
185 |
* <UL>
|
186 |
* <LI>Cambiamos el nombre a la capa georraster</LI>
|
187 |
* <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
|
188 |
* <LI>Cerramos la ventana</LI>
|
189 |
* </UL>
|
190 |
*/
|
191 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
192 |
if(e.getSource() instanceof JCheckBox){ |
193 |
if(((JCheckBox)e.getSource()).getName().equals("mostrar_puntos")){ |
194 |
FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints(); |
195 |
View theView = null; |
196 |
try{
|
197 |
theView = (View) PluginServices.getMDIManager().getActiveView();
|
198 |
}catch(ClassCastException exc){ |
199 |
return;
|
200 |
} |
201 |
|
202 |
if(((JCheckBox)e.getSource()).isSelected()){ //Mostramos el n?mero de punto |
203 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true);
|
204 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
205 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
206 |
theView.getMapControl().getMapContext().invalidate(); |
207 |
}else{ //Ocultamos el n?mero de punto |
208 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false);
|
209 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
210 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
211 |
theView.getMapControl().getMapContext().invalidate(); |
212 |
} |
213 |
} |
214 |
|
215 |
if(((JCheckBox)e.getSource()).getName().equals("crear_worldfile")){ |
216 |
if(((JCheckBox)e.getSource()).isSelected()) |
217 |
grd.setCreateWorldFile(true);
|
218 |
else
|
219 |
grd.setCreateWorldFile(false);
|
220 |
} |
221 |
} |
222 |
} |
223 |
|
224 |
/**
|
225 |
* This method initializes jPanel11
|
226 |
*
|
227 |
* @return javax.swing.JPanel
|
228 |
*/
|
229 |
private JPanel getJPanel11() { |
230 |
if (jPanel11 == null) { |
231 |
jPanel11 = new OptionsPanel(this.grd, "mostrar_puntos"); |
232 |
((OptionsPanel)jPanel11).getCbCheckBox().addActionListener(this);
|
233 |
} |
234 |
return jPanel11;
|
235 |
} |
236 |
|
237 |
/**
|
238 |
* This method initializes jPanel12
|
239 |
*
|
240 |
* @return javax.swing.JPanel
|
241 |
*/
|
242 |
private JPanel getJPanel12() { |
243 |
if (jPanel12 == null) { |
244 |
jPanel12 = new OptionsPanel(this.grd, "crear_worldfile"); |
245 |
((OptionsPanel)jPanel12).getCbCheckBox().setSelected(false);
|
246 |
((OptionsPanel)jPanel12).getCbCheckBox().addActionListener(this);
|
247 |
} |
248 |
return jPanel12;
|
249 |
} |
250 |
|
251 |
} |