svn-gvsig-desktop / tags / v1_1_Build_1001 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / wizard / GeoProcessingPanel.java @ 11984
History | View | Annotate | Download (20.1 KB)
1 | 5412 | azabala | /*
|
---|---|---|---|
2 | * Created on 01-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.awt.CardLayout; |
||
47 | import java.awt.Component; |
||
48 | import java.awt.Container; |
||
49 | 6139 | jaume | import java.awt.FlowLayout; |
50 | 5412 | azabala | import java.awt.Window; |
51 | |||
52 | import javax.swing.JPanel; |
||
53 | |||
54 | import org.cresques.cts.IProjection; |
||
55 | 6139 | jaume | import org.gvsig.gui.beans.swing.JButton; |
56 | 5412 | azabala | |
57 | import com.iver.andami.PluginServices; |
||
58 | 6877 | cesar | import com.iver.andami.ui.mdiManager.IWindow; |
59 | 6880 | cesar | import com.iver.andami.ui.mdiManager.WindowInfo; |
60 | 5412 | azabala | import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition; |
61 | import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter; |
||
62 | import com.iver.cit.gvsig.fmap.layers.FLayers; |
||
63 | import com.iver.cit.gvsig.geoprocess.core.gui.GeoProcessingOverlayPanel; |
||
64 | 5919 | azabala | import com.iver.cit.gvsig.geoprocess.impl.buffer.BufferGeoprocessController; |
65 | import com.iver.cit.gvsig.geoprocess.impl.buffer.gui.GeoProcessingBufferPanel; |
||
66 | import com.iver.cit.gvsig.geoprocess.impl.clip.ClipGeoprocessController; |
||
67 | import com.iver.cit.gvsig.geoprocess.impl.convexhull.ConvexHullGeoprocessController; |
||
68 | import com.iver.cit.gvsig.geoprocess.impl.convexhull.gui.GeoProcessingConvexHullPanel; |
||
69 | import com.iver.cit.gvsig.geoprocess.impl.difference.DifferenceGeoprocessController; |
||
70 | import com.iver.cit.gvsig.geoprocess.impl.dissolve.DissolveGeoprocessController; |
||
71 | import com.iver.cit.gvsig.geoprocess.impl.dissolve.gui.GeoProcessingDissolvePanel; |
||
72 | import com.iver.cit.gvsig.geoprocess.impl.intersection.IntersectionGeoprocessController; |
||
73 | import com.iver.cit.gvsig.geoprocess.impl.merge.MergeGeoprocessController; |
||
74 | import com.iver.cit.gvsig.geoprocess.impl.merge.gui.GeoProcessingMergePanel; |
||
75 | import com.iver.cit.gvsig.geoprocess.impl.spatialjoin.SpatialJoinGeoprocessController; |
||
76 | import com.iver.cit.gvsig.geoprocess.impl.spatialjoin.gui.GeoProcessingSpatialjoinPanel; |
||
77 | import com.iver.cit.gvsig.geoprocess.impl.union.UnionGeoprocessController; |
||
78 | 5412 | azabala | |
79 | /**
|
||
80 | * Container component panel of the Geoprocessing Wizard. It contains all
|
||
81 | * spetialized panels to do geoprocessing. It is an Andami's View (it is added
|
||
82 | * to ANDAMI like a JInternalFrame)
|
||
83 | 6139 | jaume | *
|
84 | 5412 | azabala | * @author jmorell, azabala
|
85 | */
|
||
86 | 6877 | cesar | public class GeoProcessingPanel extends JPanel implements IWindow, |
87 | 5412 | azabala | GeoProcessingWizardIF, GeoProcessingIF { |
88 | |||
89 | /*
|
||
90 | * AZABALA Inicialmente queria usar el API Wizard de la libreria IVER
|
||
91 | * UTILES. No obstante, ese API es para construir Wizards est?ticos, donde
|
||
92 | * todas las fases/pantallas son las mismas: 1->2->3->...->FIN.
|
||
93 | 6139 | jaume | *
|
94 | 5412 | azabala | * El componente de GeoprocessingWizard est? pensado para que la pantalla 2
|
95 | * sea distinta, en funci?n de la selecci?n que haya hecho el usuario en la
|
||
96 | * pantalla 1.
|
||
97 | 6139 | jaume | *
|
98 | 5412 | azabala | * A falta de construir un API gen?rica de Wizards (que contemple
|
99 | * bifurcaciones) conservamos la concepci?n original.
|
||
100 | */
|
||
101 | |||
102 | private static final long serialVersionUID = 1L; |
||
103 | |||
104 | 6880 | cesar | private WindowInfo viewInfo = null; |
105 | 5412 | azabala | |
106 | private GeoProcessingOperationSelectorPanel geoProcessingOperationSelectorPanel = null; |
||
107 | |||
108 | private GeoProcessingBufferPanel geoProcessingBufferPanel = null; |
||
109 | |||
110 | // FIXME podriamos reutilizar el mismo panel para todos los
|
||
111 | // geoprocesos
|
||
112 | private GeoProcessingOverlayPanel geoProcessingClipPanel = null; |
||
113 | |||
114 | private GeoProcessingDissolvePanel geoProcessingDissolvePanel = null; |
||
115 | |||
116 | private GeoProcessingMergePanel geoProcessingMergePanel = null; |
||
117 | |||
118 | private GeoProcessingOverlayPanel geoProcessingIntersectPanel = null; |
||
119 | |||
120 | private GeoProcessingOverlayPanel geoProcessingUnionPanel = null; |
||
121 | |||
122 | private GeoProcessingOverlayPanel geoProcessingDifferencePanel = null; |
||
123 | |||
124 | private GeoProcessingSpatialjoinPanel geoProcessingSpatialjoinPanel = null; |
||
125 | |||
126 | private GeoProcessingConvexHullPanel geoProcessingConvexHullPanel = null; |
||
127 | |||
128 | private JPanel buttonsPanel = null; |
||
129 | |||
130 | private JButton closeButton = null; |
||
131 | |||
132 | private JButton previousButton = null; |
||
133 | |||
134 | private JButton nextButton = null; |
||
135 | |||
136 | private FLayers layers = null; |
||
137 | /**
|
||
138 | * FIXME No se esta utilizando. Revisar si es necesario
|
||
139 | */
|
||
140 | private IProjection proj;
|
||
141 | |||
142 | private JPanel mainPanel = null; |
||
143 | 6139 | jaume | |
144 | 5412 | azabala | /**
|
145 | * These String constants are used to tells to CardLayout which
|
||
146 | * panel it must show, in response to user selection of radio button
|
||
147 | * panel.
|
||
148 | */
|
||
149 | private final static String CONVEX_HULL = "convex"; |
||
150 | private final static String SPATIAL_JOIN = "spt_join"; |
||
151 | private final static String UNION = "union"; |
||
152 | private final static String INTERSECT = "intersect"; |
||
153 | private final static String DIFFERENCE = "diff"; |
||
154 | private final static String MERGE = "merge"; |
||
155 | private final static String DISSOLVE = "dissolve"; |
||
156 | private final static String CLIP = "clip"; |
||
157 | private final static String BUFFER = "buffer"; |
||
158 | private final static String OP_SELECT = "opselect"; |
||
159 | 6139 | jaume | |
160 | 5412 | azabala | /**
|
161 | * Constructor
|
||
162 | * @param layers
|
||
163 | * @param proj
|
||
164 | */
|
||
165 | public GeoProcessingPanel(FLayers layers, IProjection proj) {
|
||
166 | super();
|
||
167 | this.layers = layers;
|
||
168 | this.proj = proj;
|
||
169 | initialize(); |
||
170 | } |
||
171 | |||
172 | // Methods that models public behabiour of wizard component
|
||
173 | /**
|
||
174 | * It closes geoprocessing wizard dialog
|
||
175 | */
|
||
176 | public void closeDialog() { |
||
177 | if (PluginServices.getMainFrame() == null) { |
||
178 | Container container = getParent();
|
||
179 | Container parentOfContainer = null; |
||
180 | //TODO This code is used in many classes
|
||
181 | //Reuse it
|
||
182 | while(! (container instanceof Window)){ |
||
183 | parentOfContainer = container.getParent(); |
||
184 | container = parentOfContainer; |
||
185 | } |
||
186 | 6139 | jaume | ((Window)container).dispose();
|
187 | 5412 | azabala | } else {
|
188 | 6880 | cesar | PluginServices.getMDIManager().closeWindow(GeoProcessingPanel.this); |
189 | 5412 | azabala | } |
190 | } |
||
191 | |||
192 | /**
|
||
193 | * Shows previous wizard step
|
||
194 | */
|
||
195 | public void previousStep() { |
||
196 | showOptionSelectionPanel(); |
||
197 | previousButton.setEnabled(false);
|
||
198 | nextButton.setText(PluginServices.getText(this, "Siguiente")); |
||
199 | |||
200 | } |
||
201 | |||
202 | private void showBufferPanel() { |
||
203 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, BUFFER);
|
||
204 | } |
||
205 | |||
206 | private void showClipPanel() { |
||
207 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, CLIP);
|
||
208 | } |
||
209 | |||
210 | private void showDissolvePanel() { |
||
211 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, DISSOLVE);
|
||
212 | } |
||
213 | |||
214 | private void showMergePanel() { |
||
215 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, MERGE);
|
||
216 | } |
||
217 | |||
218 | private void showIntersectPanel() { |
||
219 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, INTERSECT);
|
||
220 | } |
||
221 | |||
222 | private void showUnionPanel() { |
||
223 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, UNION);
|
||
224 | } |
||
225 | |||
226 | private void showSpatialJoinPanel() { |
||
227 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, SPATIAL_JOIN);
|
||
228 | } |
||
229 | |||
230 | private void showDifferencePanel() { |
||
231 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, DIFFERENCE);
|
||
232 | } |
||
233 | |||
234 | private void showOptionSelectionPanel() { |
||
235 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, OP_SELECT);
|
||
236 | } |
||
237 | |||
238 | public void nextStep() { |
||
239 | // 2? FASE DEL ASISTENTE
|
||
240 | /*
|
||
241 | * TODO No me gusta como esta planteado, a base de muchos if-else
|
||
242 | * anidados. REVISAR
|
||
243 | */
|
||
244 | if (nextButton.getText().equals(
|
||
245 | PluginServices.getText(this, "Siguiente"))) { |
||
246 | if (geoProcessingOperationSelectorPanel.isBufferSelected()) {// BUFFER |
||
247 | showBufferPanel(); |
||
248 | } else if (geoProcessingOperationSelectorPanel.isClipSelected()) {// CLIP |
||
249 | showClipPanel(); |
||
250 | } else if (geoProcessingOperationSelectorPanel.isDissolveSelected()) { |
||
251 | showDissolvePanel(); |
||
252 | } else if (geoProcessingOperationSelectorPanel.isMergeSelected()) { |
||
253 | showMergePanel(); |
||
254 | } else if (geoProcessingOperationSelectorPanel |
||
255 | .isIntersectSelected()) { |
||
256 | showIntersectPanel(); |
||
257 | } else if (geoProcessingOperationSelectorPanel.isUnionSelected()) { |
||
258 | showUnionPanel(); |
||
259 | } else if (geoProcessingOperationSelectorPanel |
||
260 | .isSpatialJoinSelected()) { |
||
261 | showSpatialJoinPanel(); |
||
262 | } else if (geoProcessingOperationSelectorPanel |
||
263 | .isDifferenceSelected()) { |
||
264 | showDifferencePanel(); |
||
265 | } else if (geoProcessingOperationSelectorPanel |
||
266 | .isConvexHullSelected()) { |
||
267 | showConvexHullPanel(); |
||
268 | } else {
|
||
269 | previousStep(); |
||
270 | return;
|
||
271 | } |
||
272 | previousButton.setEnabled(true);
|
||
273 | nextButton.setText(PluginServices.getText(this, "Terminar")); |
||
274 | |||
275 | } else if (nextButton.getText().equals( |
||
276 | PluginServices.getText(this, "Terminar"))) { |
||
277 | boolean closeDialog = false; |
||
278 | if (geoProcessingOperationSelectorPanel.isBufferSelected()) {
|
||
279 | closeDialog = doBuffer(); |
||
280 | } else if (geoProcessingOperationSelectorPanel.isClipSelected()) { |
||
281 | closeDialog = doClip(); |
||
282 | } else if (geoProcessingOperationSelectorPanel.isDissolveSelected()) { |
||
283 | closeDialog = doDissolve(); |
||
284 | } else if (geoProcessingOperationSelectorPanel.isMergeSelected()) { |
||
285 | closeDialog = doMerge(); |
||
286 | } else if (geoProcessingOperationSelectorPanel |
||
287 | .isIntersectSelected()) { |
||
288 | closeDialog = doIntersect(); |
||
289 | } else if (geoProcessingOperationSelectorPanel.isUnionSelected()) { |
||
290 | closeDialog = doUnion(); |
||
291 | } else if (geoProcessingOperationSelectorPanel |
||
292 | .isSpatialJoinSelected()) { |
||
293 | closeDialog = doSpatialJoin(); |
||
294 | } else if (geoProcessingOperationSelectorPanel |
||
295 | .isConvexHullSelected()) { |
||
296 | closeDialog = doConvexHull(); |
||
297 | } else if (geoProcessingOperationSelectorPanel |
||
298 | .isDifferenceSelected()) { |
||
299 | closeDialog = doDifference(); |
||
300 | } |
||
301 | if(closeDialog)
|
||
302 | closeDialog(); |
||
303 | } |
||
304 | } |
||
305 | |||
306 | private void showConvexHullPanel() { |
||
307 | ((CardLayout)mainPanel.getLayout()).show(mainPanel, CONVEX_HULL);
|
||
308 | } |
||
309 | |||
310 | private Component getGeoProcessingConvexHullPanel() { |
||
311 | if (geoProcessingConvexHullPanel == null) { |
||
312 | geoProcessingConvexHullPanel = new GeoProcessingConvexHullPanel(
|
||
313 | layers); |
||
314 | geoProcessingConvexHullPanel |
||
315 | .setName("geoProcessingConvexHullPanel");
|
||
316 | geoProcessingConvexHullPanel |
||
317 | .setPreferredSize(new java.awt.Dimension(300, 300)); |
||
318 | } |
||
319 | return geoProcessingConvexHullPanel;
|
||
320 | } |
||
321 | |||
322 | /**
|
||
323 | * This method initializes this
|
||
324 | 6139 | jaume | *
|
325 | 5412 | azabala | * @return void
|
326 | */
|
||
327 | private void initialize() { |
||
328 | this.setLayout(null); |
||
329 | this.setSize(500, 400); |
||
330 | this.add(getButtonsPanel(), null); |
||
331 | this.add(getMainPanel(), null); |
||
332 | showOptionSelectionPanel(); |
||
333 | previousButton.setEnabled(false);
|
||
334 | } |
||
335 | |||
336 | private Component getGeoProcessingDifferencePanel() { |
||
337 | if (geoProcessingDifferencePanel == null) { |
||
338 | String titleText = PluginServices.getText(this, |
||
339 | "Diferencia_Introduccion_de_datos");
|
||
340 | geoProcessingDifferencePanel = new GeoProcessingOverlayPanel(
|
||
341 | layers, titleText); |
||
342 | geoProcessingDifferencePanel |
||
343 | .setName("geoProcessingDifferencePanel");
|
||
344 | } |
||
345 | return geoProcessingDifferencePanel;
|
||
346 | } |
||
347 | |||
348 | 6880 | cesar | public WindowInfo getWindowInfo() {
|
349 | 5412 | azabala | if (viewInfo == null) { |
350 | 6880 | cesar | viewInfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
351 | 5412 | azabala | viewInfo.setTitle(PluginServices.getText(this,
|
352 | "Herramientas_de_analisis"));
|
||
353 | } |
||
354 | return viewInfo;
|
||
355 | } |
||
356 | |||
357 | /**
|
||
358 | * This method initializes geoProcessingOperationSelectorPanel
|
||
359 | 6139 | jaume | *
|
360 | 5412 | azabala | * @return javax.swing.JPanel
|
361 | */
|
||
362 | private JPanel getGeoProcessingOperationSelectorPanel() { |
||
363 | if (geoProcessingOperationSelectorPanel == null) { |
||
364 | geoProcessingOperationSelectorPanel = new GeoProcessingOperationSelectorPanel();
|
||
365 | geoProcessingOperationSelectorPanel |
||
366 | .setName("geoProcessingOperationSelectorPanel");
|
||
367 | } |
||
368 | return geoProcessingOperationSelectorPanel;
|
||
369 | } |
||
370 | |||
371 | /**
|
||
372 | * This method initializes geoProcessingBufferPanel
|
||
373 | 6139 | jaume | *
|
374 | 5412 | azabala | * @return javax.swing.JPanel
|
375 | */
|
||
376 | private JPanel getGeoProcessingBufferPanel() { |
||
377 | if (geoProcessingBufferPanel == null) { |
||
378 | geoProcessingBufferPanel = new GeoProcessingBufferPanel(layers);
|
||
379 | geoProcessingBufferPanel.setName("geoProcessingBufferPanel");
|
||
380 | } |
||
381 | return geoProcessingBufferPanel;
|
||
382 | } |
||
383 | |||
384 | /**
|
||
385 | * This method initializes geoProcessingClipPanel
|
||
386 | 6139 | jaume | *
|
387 | 5412 | azabala | * @return javax.swing.JPanel
|
388 | */
|
||
389 | private JPanel getGeoProcessingClipPanel() { |
||
390 | if (geoProcessingClipPanel == null) { |
||
391 | String titleText = PluginServices.getText(this, |
||
392 | "Recortar._Introduccion_de_datos")
|
||
393 | + ":";
|
||
394 | geoProcessingClipPanel = new GeoProcessingOverlayPanel(layers,
|
||
395 | titleText); |
||
396 | geoProcessingClipPanel.setName("geoProcessingClipPanel");
|
||
397 | // Si no le meto esta l?nea, no se visualiza el men?. Ver que puede
|
||
398 | // estar pasando ...
|
||
399 | geoProcessingClipPanel.setPreferredSize(new java.awt.Dimension(300, |
||
400 | 300));
|
||
401 | } |
||
402 | return geoProcessingClipPanel;
|
||
403 | } |
||
404 | |||
405 | /**
|
||
406 | * This method initializes geoProcessingDissolvePanel
|
||
407 | 6139 | jaume | *
|
408 | 5412 | azabala | * @return javax.swing.JPanel
|
409 | */
|
||
410 | private JPanel getGeoProcessingDissolvePanel() { |
||
411 | if (geoProcessingDissolvePanel == null) { |
||
412 | geoProcessingDissolvePanel = new GeoProcessingDissolvePanel(layers);
|
||
413 | geoProcessingDissolvePanel.setName("geoProcessingDissolvePanel");
|
||
414 | } |
||
415 | return geoProcessingDissolvePanel;
|
||
416 | } |
||
417 | |||
418 | /**
|
||
419 | * This method initializes geoProcessingMergePanel
|
||
420 | 6139 | jaume | *
|
421 | 5412 | azabala | * @return javax.swing.JPanel
|
422 | */
|
||
423 | private JPanel getGeoProcessingMergePanel() { |
||
424 | if (geoProcessingMergePanel == null) { |
||
425 | geoProcessingMergePanel = new GeoProcessingMergePanel(layers);
|
||
426 | geoProcessingMergePanel.setName("geoProcessingMergePanel");
|
||
427 | } |
||
428 | return geoProcessingMergePanel;
|
||
429 | } |
||
430 | |||
431 | /**
|
||
432 | * This method initializes geoProcessingIntersectPanel
|
||
433 | 6139 | jaume | *
|
434 | 5412 | azabala | * @return javax.swing.JPanel
|
435 | */
|
||
436 | private JPanel getGeoProcessingIntersectPanel() { |
||
437 | if (geoProcessingIntersectPanel == null) { |
||
438 | String titleText = PluginServices.getText(this, |
||
439 | "Interseccion._Introduccion_de_datos");
|
||
440 | geoProcessingIntersectPanel = new GeoProcessingOverlayPanel(layers,
|
||
441 | titleText); |
||
442 | geoProcessingIntersectPanel.setName("geoProcessingIntersectPanel");
|
||
443 | } |
||
444 | return geoProcessingIntersectPanel;
|
||
445 | } |
||
446 | |||
447 | /**
|
||
448 | * This method initializes geoProcessingUnionPanel
|
||
449 | 6139 | jaume | *
|
450 | 5412 | azabala | * @return javax.swing.JPanel
|
451 | */
|
||
452 | private JPanel getGeoProcessingUnionPanel() { |
||
453 | if (geoProcessingUnionPanel == null) { |
||
454 | String titleText = PluginServices.getText(this, |
||
455 | "Union._Introduccion_de_datos");
|
||
456 | geoProcessingUnionPanel = new GeoProcessingOverlayPanel(layers,
|
||
457 | titleText); |
||
458 | geoProcessingUnionPanel.setName("geoProcessingUnionPanel");
|
||
459 | } |
||
460 | return geoProcessingUnionPanel;
|
||
461 | } |
||
462 | |||
463 | /**
|
||
464 | * This method initializes geoProcessingSpatialjoinPanel
|
||
465 | 6139 | jaume | *
|
466 | 5412 | azabala | * @return javax.swing.JPanel
|
467 | */
|
||
468 | private JPanel getGeoProcessingSpatialjoinPanel() { |
||
469 | if (geoProcessingSpatialjoinPanel == null) { |
||
470 | geoProcessingSpatialjoinPanel = new GeoProcessingSpatialjoinPanel(
|
||
471 | layers); |
||
472 | geoProcessingSpatialjoinPanel |
||
473 | .setName("geoProcessingSpatialjoinPanel");
|
||
474 | // Si no le meto esta l?nea, no se visualiza el men?. Ver que puede
|
||
475 | // estar pasando ...
|
||
476 | geoProcessingSpatialjoinPanel |
||
477 | .setPreferredSize(new java.awt.Dimension(300, 300)); |
||
478 | } |
||
479 | return geoProcessingSpatialjoinPanel;
|
||
480 | } |
||
481 | |||
482 | /**
|
||
483 | * This method initializes buttonsPanel
|
||
484 | 6139 | jaume | *
|
485 | 5412 | azabala | * @return javax.swing.JPanel
|
486 | */
|
||
487 | private JPanel getButtonsPanel() { |
||
488 | if (buttonsPanel == null) { |
||
489 | 6139 | jaume | buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); |
490 | 5412 | azabala | buttonsPanel.setName("buttonsPanel");
|
491 | 6139 | jaume | |
492 | |||
493 | 5412 | azabala | // esto tambi?n lo cambiaria...JButton, JButton1, JButton2 no
|
494 | buttonsPanel.setBounds(new java.awt.Rectangle(14,353,466,40)); |
||
495 | // dan claridad al codigo
|
||
496 | buttonsPanel.add(getCloseButton(), null);
|
||
497 | 6139 | jaume | buttonsPanel.add(new JPanel(),null); //just a separator; |
498 | 5412 | azabala | buttonsPanel.add(getPreviousButton(), null);
|
499 | buttonsPanel.add(getNextButton(), null);
|
||
500 | } |
||
501 | return buttonsPanel;
|
||
502 | } |
||
503 | |||
504 | /**
|
||
505 | * This method initializes closeButton
|
||
506 | 6139 | jaume | *
|
507 | * @return JButton
|
||
508 | 5412 | azabala | */
|
509 | private JButton getCloseButton() { |
||
510 | if (closeButton == null) { |
||
511 | closeButton = new JButton(); |
||
512 | closeButton.setText(PluginServices.getText(this, "Cerrar")); |
||
513 | closeButton.addActionListener(new java.awt.event.ActionListener() {
|
||
514 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
515 | closeDialog(); |
||
516 | } |
||
517 | }); |
||
518 | } |
||
519 | return closeButton;
|
||
520 | } |
||
521 | |||
522 | /**
|
||
523 | * This method initializes previousButton
|
||
524 | 6139 | jaume | *
|
525 | * @return JButton
|
||
526 | 5412 | azabala | */
|
527 | private JButton getPreviousButton() { |
||
528 | if (previousButton == null) { |
||
529 | previousButton = new JButton(); |
||
530 | previousButton.setText(PluginServices.getText(this, "Anterior")); |
||
531 | previousButton |
||
532 | .addActionListener(new java.awt.event.ActionListener() {
|
||
533 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
534 | previousStep(); |
||
535 | } |
||
536 | }); |
||
537 | } |
||
538 | return previousButton;
|
||
539 | } |
||
540 | |||
541 | /**
|
||
542 | * This method initializes nextButton
|
||
543 | 6139 | jaume | *
|
544 | * @return JButton
|
||
545 | 5412 | azabala | */
|
546 | private JButton getNextButton() { |
||
547 | if (nextButton == null) { |
||
548 | nextButton = new JButton(); |
||
549 | nextButton.setText(PluginServices.getText(this, "Siguiente")); |
||
550 | nextButton.addActionListener(new java.awt.event.ActionListener() {
|
||
551 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
552 | nextStep(); |
||
553 | } |
||
554 | }); |
||
555 | } |
||
556 | return nextButton;
|
||
557 | } |
||
558 | |||
559 | public boolean doBuffer() { |
||
560 | BufferGeoprocessController controller = |
||
561 | new BufferGeoprocessController();
|
||
562 | controller.setView(geoProcessingBufferPanel); |
||
563 | return controller.launchGeoprocess();
|
||
564 | } |
||
565 | |||
566 | private ShpWriter getShpWriter(SHPLayerDefinition definition) throws Exception { |
||
567 | ShpWriter writer = new ShpWriter();
|
||
568 | writer.setFile(definition.getFile()); |
||
569 | writer.initialize(definition); |
||
570 | return writer;
|
||
571 | } |
||
572 | |||
573 | public boolean doMerge() { |
||
574 | MergeGeoprocessController controller = |
||
575 | new MergeGeoprocessController();
|
||
576 | controller.setView(geoProcessingMergePanel); |
||
577 | return controller.launchGeoprocess();
|
||
578 | } |
||
579 | |||
580 | public boolean doDissolve() { |
||
581 | DissolveGeoprocessController controller = |
||
582 | new DissolveGeoprocessController();
|
||
583 | controller.setView(geoProcessingDissolvePanel); |
||
584 | return controller.launchGeoprocess();
|
||
585 | } |
||
586 | |||
587 | public boolean doSpatialJoin() { |
||
588 | SpatialJoinGeoprocessController controller = |
||
589 | new SpatialJoinGeoprocessController();
|
||
590 | controller.setView(geoProcessingSpatialjoinPanel); |
||
591 | return controller.launchGeoprocess();
|
||
592 | |||
593 | } |
||
594 | |||
595 | public boolean doClip() { |
||
596 | ClipGeoprocessController controller = |
||
597 | new ClipGeoprocessController();
|
||
598 | controller.setView(geoProcessingClipPanel); |
||
599 | return controller.launchGeoprocess();
|
||
600 | } |
||
601 | 6139 | jaume | |
602 | 5412 | azabala | // Spatial join con Intersect
|
603 | public boolean doIntersect() { |
||
604 | IntersectionGeoprocessController controller = |
||
605 | new IntersectionGeoprocessController();
|
||
606 | controller.setView(geoProcessingIntersectPanel); |
||
607 | return controller.launchGeoprocess();
|
||
608 | } |
||
609 | |||
610 | public boolean doUnion() { |
||
611 | UnionGeoprocessController controller = |
||
612 | new UnionGeoprocessController();
|
||
613 | controller.setView(geoProcessingUnionPanel); |
||
614 | return controller.launchGeoprocess();
|
||
615 | } |
||
616 | |||
617 | 6139 | jaume | |
618 | 5412 | azabala | public boolean doConvexHull() { |
619 | ConvexHullGeoprocessController controller = |
||
620 | new ConvexHullGeoprocessController();
|
||
621 | controller.setView(geoProcessingConvexHullPanel); |
||
622 | return controller.launchGeoprocess();
|
||
623 | } |
||
624 | |||
625 | public boolean doDifference() { |
||
626 | DifferenceGeoprocessController controller = |
||
627 | new DifferenceGeoprocessController();
|
||
628 | controller.setView(geoProcessingDifferencePanel); |
||
629 | return controller.launchGeoprocess();
|
||
630 | } |
||
631 | |||
632 | |||
633 | 6139 | jaume | |
634 | 5412 | azabala | /**
|
635 | 6139 | jaume | * This method initializes mainPanel
|
636 | *
|
||
637 | * @return javax.swing.JPanel
|
||
638 | 5412 | azabala | */
|
639 | private JPanel getMainPanel() { |
||
640 | if (mainPanel == null) { |
||
641 | mainPanel = new JPanel(); |
||
642 | mainPanel.setLayout(new CardLayout()); |
||
643 | mainPanel.setBounds(new java.awt.Rectangle(12,8,469,339)); |
||
644 | 6139 | jaume | mainPanel.setBorder(javax.swing.BorderFactory |
645 | .createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED)); |
||
646 | 5412 | azabala | mainPanel.add(getGeoProcessingOperationSelectorPanel(), OP_SELECT); |
647 | mainPanel.add(getGeoProcessingConvexHullPanel(), CONVEX_HULL); |
||
648 | mainPanel.add(getGeoProcessingSpatialjoinPanel(), SPATIAL_JOIN); |
||
649 | mainPanel.add(getGeoProcessingUnionPanel(), UNION); |
||
650 | mainPanel.add(getGeoProcessingIntersectPanel(), INTERSECT); |
||
651 | mainPanel.add(getGeoProcessingDifferencePanel(), DIFFERENCE); |
||
652 | mainPanel.add(getGeoProcessingMergePanel(), MERGE); |
||
653 | mainPanel.add(getGeoProcessingDissolvePanel(), DISSOLVE); |
||
654 | mainPanel.add(getGeoProcessingClipPanel(), CLIP); |
||
655 | mainPanel.add(getGeoProcessingBufferPanel(), BUFFER); |
||
656 | } |
||
657 | return mainPanel;
|
||
658 | } |
||
659 | |||
660 | } // @jve:decl-index=0:visual-constraint="70,7" |