svn-gvsig-desktop / tags / v1_1_Build_1004 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / wizard / GeoProcessingOperationSelectorPanel.java @ 12319
History | View | Annotate | Download (12.1 KB)
1 |
/*
|
---|---|
2 |
* Created on 04-jul-2005
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
package com.iver.cit.gvsig.geoprocess.wizard; |
45 |
|
46 |
import java.net.URL; |
47 |
|
48 |
import javax.swing.BoxLayout; |
49 |
import javax.swing.ButtonGroup; |
50 |
import javax.swing.ImageIcon; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JPanel; |
53 |
import javax.swing.JRadioButton; |
54 |
import javax.swing.event.ChangeEvent; |
55 |
import javax.swing.event.ChangeListener; |
56 |
|
57 |
import com.iver.andami.PluginServices; |
58 |
|
59 |
/**
|
60 |
*
|
61 |
* This component is the first step of GeoProcessing Wizard. It allows user to
|
62 |
* select which geoprocessing operation want to do.
|
63 |
*
|
64 |
* @author jmorell, azabala
|
65 |
*/
|
66 |
public class GeoProcessingOperationSelectorPanel extends JPanel { |
67 |
private static final long serialVersionUID = 1L; |
68 |
|
69 |
private JLabel jLabel = null; |
70 |
|
71 |
private JRadioButton bufferRadioButton = null; |
72 |
|
73 |
private JRadioButton dissolveRadioButton = null; |
74 |
|
75 |
private JRadioButton mergeRadioButton = null; |
76 |
|
77 |
private JRadioButton intersectRadioButton = null; |
78 |
|
79 |
private JRadioButton unionRadioButton = null; |
80 |
|
81 |
private JRadioButton spatialJoinRadioButton = null; |
82 |
|
83 |
private JRadioButton clipRadioButton = null; |
84 |
|
85 |
private ButtonGroup buttonGroup = null; |
86 |
|
87 |
private JRadioButton convexHullRadioButton = null; |
88 |
|
89 |
private JRadioButton differenceRadioButton = null; |
90 |
|
91 |
private JPanel mainPanel = null; |
92 |
|
93 |
private JLabel imageLabel = null; |
94 |
|
95 |
private ImageIcon bufferDescIcon; |
96 |
|
97 |
private ImageIcon dissolveDescIcon; |
98 |
|
99 |
private ImageIcon mergeDescIcon; |
100 |
|
101 |
private ImageIcon intersectDescIcon; |
102 |
|
103 |
private ImageIcon unionDescIcon; |
104 |
|
105 |
private ImageIcon spatialJoinDescIcon; |
106 |
|
107 |
private ImageIcon clipDescIcon; |
108 |
|
109 |
private ImageIcon convexHullDescIcon; |
110 |
|
111 |
private ImageIcon differenceDescIcon; |
112 |
|
113 |
/**
|
114 |
* This is the default constructor
|
115 |
*/
|
116 |
public GeoProcessingOperationSelectorPanel() {
|
117 |
super();
|
118 |
initialize(); |
119 |
} |
120 |
|
121 |
public void changeSelection(){ |
122 |
if(isBufferSelected()){
|
123 |
imageLabel.setIcon(bufferDescIcon); |
124 |
}else if(isDissolveSelected()){ |
125 |
imageLabel.setIcon(dissolveDescIcon); |
126 |
}else if(isMergeSelected()){ |
127 |
imageLabel.setIcon(mergeDescIcon); |
128 |
}else if(isIntersectSelected()){ |
129 |
imageLabel.setIcon(intersectDescIcon); |
130 |
}else if(isUnionSelected()){ |
131 |
imageLabel.setIcon(unionDescIcon); |
132 |
}else if(isClipSelected()){ |
133 |
imageLabel.setIcon(clipDescIcon); |
134 |
}else if(isSpatialJoinSelected()){ |
135 |
imageLabel.setIcon(spatialJoinDescIcon); |
136 |
}else if(isDifferenceSelected()){ |
137 |
imageLabel.setIcon(differenceDescIcon); |
138 |
}else if(isConvexHullSelected()){ |
139 |
imageLabel.setIcon(convexHullDescIcon); |
140 |
} |
141 |
} |
142 |
|
143 |
public boolean isBufferSelected(){ |
144 |
return bufferRadioButton.isSelected();
|
145 |
} |
146 |
|
147 |
public boolean isDissolveSelected(){ |
148 |
return dissolveRadioButton.isSelected();
|
149 |
} |
150 |
|
151 |
public boolean isMergeSelected(){ |
152 |
return mergeRadioButton.isSelected();
|
153 |
} |
154 |
|
155 |
public boolean isIntersectSelected(){ |
156 |
return intersectRadioButton.isSelected();
|
157 |
} |
158 |
|
159 |
public boolean isUnionSelected(){ |
160 |
return unionRadioButton.isSelected();
|
161 |
} |
162 |
|
163 |
public boolean isClipSelected(){ |
164 |
return clipRadioButton.isSelected();
|
165 |
} |
166 |
|
167 |
public boolean isSpatialJoinSelected(){ |
168 |
return spatialJoinRadioButton.isSelected();
|
169 |
} |
170 |
|
171 |
public boolean isDifferenceSelected(){ |
172 |
return differenceRadioButton.isSelected();
|
173 |
} |
174 |
|
175 |
public boolean isConvexHullSelected(){ |
176 |
return convexHullRadioButton.isSelected();
|
177 |
} |
178 |
|
179 |
private void initializeImages(){ |
180 |
URL url = GeoProcessingExtension.class.
|
181 |
getClassLoader(). |
182 |
getResource("images/bufferdesc.png");
|
183 |
bufferDescIcon = |
184 |
new ImageIcon(url); |
185 |
url = GeoProcessingExtension.class. |
186 |
getClassLoader(). |
187 |
getResource("images/dissolvedesc.png");
|
188 |
dissolveDescIcon = |
189 |
new ImageIcon(url); |
190 |
url = GeoProcessingExtension.class. |
191 |
getClassLoader(). |
192 |
getResource("images/mergedesc.png");
|
193 |
mergeDescIcon = |
194 |
new ImageIcon(url); |
195 |
url = GeoProcessingExtension.class. |
196 |
getClassLoader(). |
197 |
getResource("images/intersectdesc.png");
|
198 |
intersectDescIcon = |
199 |
new ImageIcon(url); |
200 |
url = GeoProcessingExtension.class. |
201 |
getClassLoader(). |
202 |
getResource("images/uniondesc.png");
|
203 |
unionDescIcon = |
204 |
new ImageIcon(url); |
205 |
url = GeoProcessingExtension.class. |
206 |
getClassLoader(). |
207 |
getResource("images/spatialjoindesc.png");
|
208 |
spatialJoinDescIcon = |
209 |
new ImageIcon(url); |
210 |
url = GeoProcessingExtension.class. |
211 |
getClassLoader(). |
212 |
getResource("images/clipdesc.png");
|
213 |
clipDescIcon = |
214 |
new ImageIcon(url); |
215 |
url = GeoProcessingExtension.class. |
216 |
getClassLoader(). |
217 |
getResource("images/convexhulldesc.png");
|
218 |
convexHullDescIcon = |
219 |
new ImageIcon(url); |
220 |
url = GeoProcessingExtension.class. |
221 |
getClassLoader(). |
222 |
getResource("images/differencedesc.png");
|
223 |
differenceDescIcon = |
224 |
new ImageIcon(url); |
225 |
|
226 |
} |
227 |
|
228 |
/**
|
229 |
* This method initializes this
|
230 |
*
|
231 |
* @return void
|
232 |
*/
|
233 |
private void initialize() { |
234 |
|
235 |
initializeImages(); |
236 |
imageLabel = new JLabel(); |
237 |
imageLabel.setText("");
|
238 |
imageLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); |
239 |
imageLabel.setVerticalTextPosition(javax.swing.SwingConstants.TOP); |
240 |
imageLabel.setIcon(bufferDescIcon); |
241 |
imageLabel.setBounds(new java.awt.Rectangle(5,44,271,328)); |
242 |
jLabel = new JLabel(); |
243 |
this.setLayout(null); |
244 |
this.setBounds(new java.awt.Rectangle(0,0,486,377)); |
245 |
this.add(jLabel, null); |
246 |
this.add(imageLabel, null); |
247 |
jLabel.setText(PluginServices.getText(this,
|
248 |
"Elija_una_herramienta_de_analisis")
|
249 |
+ ":");
|
250 |
this.add(getMainPanel(), null); |
251 |
|
252 |
jLabel.setBounds(new java.awt.Rectangle(4,5,471,32)); |
253 |
confButtonGroup(); |
254 |
getBufferRadioButton().setSelected(true);
|
255 |
} |
256 |
|
257 |
private void confButtonGroup() { |
258 |
if (buttonGroup == null) { |
259 |
buttonGroup = new ButtonGroup(); |
260 |
buttonGroup.add(getBufferRadioButton()); |
261 |
buttonGroup.add(getDissolveRadioButton()); |
262 |
buttonGroup.add(getMergeRadioButton()); |
263 |
buttonGroup.add(getIntersectRadioButton()); |
264 |
buttonGroup.add(getUnionRadioButton()); |
265 |
buttonGroup.add(getSpatialJoinRadioButton()); |
266 |
buttonGroup.add(getClipRadioButton()); |
267 |
buttonGroup.add(getConvexHullRadioButton()); |
268 |
buttonGroup.add(getDifferenceRadioButton()); |
269 |
|
270 |
} |
271 |
} |
272 |
|
273 |
/**
|
274 |
* This method initializes bufferRadioButton
|
275 |
*
|
276 |
* @return javax.swing.JRadioButton
|
277 |
*/
|
278 |
private JRadioButton getBufferRadioButton() { |
279 |
if (bufferRadioButton == null) { |
280 |
bufferRadioButton = new JRadioButton(); |
281 |
bufferRadioButton.setText(PluginServices.getText(this,
|
282 |
"Area_de_influencia"));
|
283 |
bufferRadioButton.addChangeListener(new ChangeListener(){ |
284 |
public void stateChanged(ChangeEvent arg0) { |
285 |
changeSelection(); |
286 |
} |
287 |
|
288 |
}); |
289 |
} |
290 |
return bufferRadioButton;
|
291 |
} |
292 |
|
293 |
/**
|
294 |
* This method initializes clipRadioButton
|
295 |
*
|
296 |
* @return javax.swing.JRadioButton
|
297 |
*/
|
298 |
private JRadioButton getClipRadioButton() { |
299 |
if (clipRadioButton == null) { |
300 |
clipRadioButton = new JRadioButton(); |
301 |
clipRadioButton.setText(PluginServices.getText(this, "Recortar")); |
302 |
clipRadioButton.addChangeListener(new ChangeListener(){ |
303 |
public void stateChanged(ChangeEvent arg0) { |
304 |
changeSelection(); |
305 |
} |
306 |
}); |
307 |
} |
308 |
return clipRadioButton;
|
309 |
} |
310 |
|
311 |
/**
|
312 |
* This method initializes dissolveRadioButton
|
313 |
*
|
314 |
* @return javax.swing.JRadioButton
|
315 |
*/
|
316 |
private JRadioButton getDissolveRadioButton() { |
317 |
if (dissolveRadioButton == null) { |
318 |
dissolveRadioButton = new JRadioButton(); |
319 |
dissolveRadioButton.setText(PluginServices |
320 |
.getText(this, "Disolver")); |
321 |
dissolveRadioButton.addChangeListener(new ChangeListener(){ |
322 |
public void stateChanged(ChangeEvent arg0) { |
323 |
changeSelection(); |
324 |
} |
325 |
|
326 |
}); |
327 |
} |
328 |
return dissolveRadioButton;
|
329 |
} |
330 |
|
331 |
/**
|
332 |
* This method initializes mergeRadioButton
|
333 |
*
|
334 |
* @return javax.swing.JRadioButton
|
335 |
*/
|
336 |
private JRadioButton getMergeRadioButton() { |
337 |
if (mergeRadioButton == null) { |
338 |
mergeRadioButton = new JRadioButton(); |
339 |
mergeRadioButton.setText(PluginServices.getText(this, "Juntar")); |
340 |
mergeRadioButton.addChangeListener(new ChangeListener(){ |
341 |
public void stateChanged(ChangeEvent arg0) { |
342 |
changeSelection(); |
343 |
} |
344 |
|
345 |
}); |
346 |
} |
347 |
return mergeRadioButton;
|
348 |
} |
349 |
|
350 |
/**
|
351 |
* This method initializes intersectRadioButton
|
352 |
*
|
353 |
* @return javax.swing.JRadioButton
|
354 |
*/
|
355 |
private JRadioButton getIntersectRadioButton() { |
356 |
if (intersectRadioButton == null) { |
357 |
intersectRadioButton = new JRadioButton(); |
358 |
intersectRadioButton.setText(PluginServices.getText(this,
|
359 |
"Interseccion"));
|
360 |
intersectRadioButton.addChangeListener(new ChangeListener(){ |
361 |
public void stateChanged(ChangeEvent arg0) { |
362 |
changeSelection(); |
363 |
} |
364 |
|
365 |
}); |
366 |
} |
367 |
return intersectRadioButton;
|
368 |
} |
369 |
|
370 |
/**
|
371 |
* This method initializes unionRadioButton
|
372 |
*
|
373 |
* @return javax.swing.JRadioButton
|
374 |
*/
|
375 |
private JRadioButton getUnionRadioButton() { |
376 |
if (unionRadioButton == null) { |
377 |
unionRadioButton = new JRadioButton(); |
378 |
unionRadioButton.setText(PluginServices.getText(this, "Union")); |
379 |
unionRadioButton.addChangeListener(new ChangeListener(){ |
380 |
public void stateChanged(ChangeEvent arg0) { |
381 |
changeSelection(); |
382 |
} |
383 |
|
384 |
}); |
385 |
} |
386 |
return unionRadioButton;
|
387 |
} |
388 |
|
389 |
/**
|
390 |
* This method initializes spatialJoinRadioButton
|
391 |
*
|
392 |
* @return javax.swing.JRadioButton
|
393 |
*/
|
394 |
private JRadioButton getSpatialJoinRadioButton() { |
395 |
if (spatialJoinRadioButton == null) { |
396 |
spatialJoinRadioButton = new JRadioButton(); |
397 |
spatialJoinRadioButton.setText(PluginServices.getText(this,
|
398 |
"Enlace_espacial"));
|
399 |
spatialJoinRadioButton.addChangeListener(new ChangeListener(){ |
400 |
public void stateChanged(ChangeEvent arg0) { |
401 |
changeSelection(); |
402 |
} |
403 |
|
404 |
}); |
405 |
} |
406 |
return spatialJoinRadioButton;
|
407 |
} |
408 |
|
409 |
/**
|
410 |
* This method initializes convexHullRadioButton
|
411 |
*
|
412 |
* @return javax.swing.JRadioButton
|
413 |
*/
|
414 |
private JRadioButton getConvexHullRadioButton() { |
415 |
if (convexHullRadioButton == null) { |
416 |
convexHullRadioButton = new JRadioButton(); |
417 |
convexHullRadioButton.setText(PluginServices.getText(this,
|
418 |
"Convex_Hull"));
|
419 |
convexHullRadioButton.addChangeListener(new ChangeListener(){ |
420 |
public void stateChanged(ChangeEvent arg0) { |
421 |
changeSelection(); |
422 |
} |
423 |
|
424 |
}); |
425 |
} |
426 |
return convexHullRadioButton;
|
427 |
} |
428 |
|
429 |
/**
|
430 |
* This method initializes differenceRadioButton
|
431 |
*
|
432 |
* @return javax.swing.JRadioButton
|
433 |
*/
|
434 |
private JRadioButton getDifferenceRadioButton() { |
435 |
if (differenceRadioButton == null) { |
436 |
differenceRadioButton = new JRadioButton(); |
437 |
differenceRadioButton.setText(PluginServices.getText(this,
|
438 |
"Diferencia"));
|
439 |
differenceRadioButton.addChangeListener(new ChangeListener(){ |
440 |
public void stateChanged(ChangeEvent arg0) { |
441 |
changeSelection(); |
442 |
} |
443 |
|
444 |
}); |
445 |
} |
446 |
return differenceRadioButton;
|
447 |
} |
448 |
|
449 |
/**
|
450 |
* This method initializes mainPanel
|
451 |
*
|
452 |
* @return javax.swing.JPanel
|
453 |
*/
|
454 |
private JPanel getMainPanel() { |
455 |
if (mainPanel == null) { |
456 |
mainPanel = new JPanel(); |
457 |
mainPanel.setLayout(new BoxLayout(getMainPanel(), BoxLayout.Y_AXIS)); |
458 |
mainPanel.setBounds(new java.awt.Rectangle(283,44,192,328)); |
459 |
mainPanel.add(getBufferRadioButton(), null);
|
460 |
mainPanel.add(getDissolveRadioButton(), null);
|
461 |
mainPanel.add(getClipRadioButton(), null);
|
462 |
mainPanel.add(getIntersectRadioButton(), null);
|
463 |
mainPanel.add(getMergeRadioButton(), null);
|
464 |
mainPanel.add(getUnionRadioButton(), null);
|
465 |
mainPanel.add(getSpatialJoinRadioButton(), null);
|
466 |
mainPanel.add(getConvexHullRadioButton(), null);
|
467 |
mainPanel.add(getDifferenceRadioButton(), null);
|
468 |
} |
469 |
return mainPanel;
|
470 |
} |
471 |
} // @jve:decl-index=0:visual-constraint="24,7"
|