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