svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSAreaPanel.java @ 9915
History | View | Annotate | Download (39.6 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.Color; |
4 |
import java.awt.Dimension; |
5 |
import java.awt.GridBagLayout; |
6 |
import java.awt.Rectangle; |
7 |
import java.awt.event.ActionEvent; |
8 |
import java.awt.event.ActionListener; |
9 |
import java.awt.event.FocusAdapter; |
10 |
import java.awt.event.FocusEvent; |
11 |
import java.awt.event.FocusListener; |
12 |
import java.awt.event.KeyAdapter; |
13 |
import java.awt.event.KeyEvent; |
14 |
import java.awt.event.KeyListener; |
15 |
import java.awt.geom.Rectangle2D; |
16 |
import java.beans.PropertyChangeEvent; |
17 |
import java.beans.PropertyChangeListener; |
18 |
import java.io.Serializable; |
19 |
|
20 |
import javax.swing.ImageIcon; |
21 |
import javax.swing.JComboBox; |
22 |
import javax.swing.JLabel; |
23 |
import javax.swing.JPanel; |
24 |
import javax.swing.JRadioButton; |
25 |
import javax.swing.JTextField; |
26 |
import javax.swing.SwingConstants; |
27 |
|
28 |
import com.iver.andami.PluginServices; |
29 |
import com.iver.cit.gvsig.fmap.MapControl; |
30 |
import com.iver.cit.gvsig.gui.wizards.WFSWizardData; |
31 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
32 |
import javax.swing.JButton; |
33 |
import javax.swing.event.CaretEvent; |
34 |
import javax.swing.event.CaretListener; |
35 |
|
36 |
import org.gvsig.gui.beans.swing.jTextField.JTextFieldWithSpecificCaretPosition; |
37 |
|
38 |
|
39 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
40 |
*
|
41 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
42 |
*
|
43 |
* This program is free software; you can redistribute it and/or
|
44 |
* modify it under the terms of the GNU General Public License
|
45 |
* as published by the Free Software Foundation; either version 2
|
46 |
* of the License, or (at your option) any later version.
|
47 |
*
|
48 |
* This program is distributed in the hope that it will be useful,
|
49 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
50 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
51 |
* GNU General Public License for more details.
|
52 |
*
|
53 |
* You should have received a copy of the GNU General Public License
|
54 |
* along with this program; if not, write to the Free Software
|
55 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
56 |
*
|
57 |
* For more information, contact:
|
58 |
*
|
59 |
* Generalitat Valenciana
|
60 |
* Conselleria d'Infraestructures i Transport
|
61 |
* Av. Blasco Ib??ez, 50
|
62 |
* 46010 VALENCIA
|
63 |
* SPAIN
|
64 |
*
|
65 |
* +34 963862235
|
66 |
* gvsig@gva.es
|
67 |
* www.gvsig.gva.es
|
68 |
*
|
69 |
* or
|
70 |
*
|
71 |
* IVER T.I. S.A
|
72 |
* Salamanca 50
|
73 |
* 46005 Valencia
|
74 |
* Spain
|
75 |
*
|
76 |
* +34 963163400
|
77 |
* dac@iver.es
|
78 |
*/
|
79 |
/* CVS MESSAGES:
|
80 |
*
|
81 |
* $Id: WFSAreaPanel.java 9915 2007-01-25 14:37:16Z ppiqueras $
|
82 |
* $Log$
|
83 |
* Revision 1.7 2007-01-25 14:37:16 ppiqueras
|
84 |
* Utiliza JTextFieldWithSpecificCaretPosition
|
85 |
*
|
86 |
* Revision 1.6 2007/01/25 09:31:09 ppiqueras
|
87 |
* Mejorada la interfaz.
|
88 |
*
|
89 |
* Revision 1.5 2007/01/19 14:24:30 ppiqueras
|
90 |
* + Avanzada.
|
91 |
*
|
92 |
* Revision 1.4 2007/01/12 13:09:41 jorpiell
|
93 |
* added searches by area
|
94 |
*
|
95 |
* Revision 1.3 2007/01/10 09:01:25 jorpiell
|
96 |
* The coordinates panel is opened with the view coordinates
|
97 |
*
|
98 |
* Revision 1.2 2006/12/22 11:45:53 jorpiell
|
99 |
* Actualizado el driver del WFS
|
100 |
*
|
101 |
* Revision 1.1 2006/10/10 12:55:06 jorpiell
|
102 |
* Se ha a?adido el soporte de features complejas
|
103 |
*
|
104 |
*
|
105 |
*/
|
106 |
/**
|
107 |
* This panel allows user to select the area he/she wants to get in the view.
|
108 |
* There are two options to do this:
|
109 |
* - Indicating the coordinates of the top-left and down-right corners
|
110 |
* - Selecting the area with the mouse
|
111 |
*
|
112 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
113 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
114 |
*/
|
115 |
public class WFSAreaPanel extends JPanel { |
116 |
private final Rectangle DEFAULT_BOUNDS = new Rectangle(10, 5, 490, 380); |
117 |
private final Rectangle DEFAULT_AREA_COORDINATES_PANEL_RECTANGLE = new Rectangle(8, 20, 481, 60); |
118 |
private final Rectangle DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE = new Rectangle(8, 115, 481, 265); |
119 |
|
120 |
// private final Rectangle DEFAULT_COORDENATES_CHECKBOX_RECTANGLE = new Rectangle(6, 19, 445, 20);
|
121 |
private final Rectangle DEFAULT_JCOMBOBOX_TOOL_SELECTION_RECTANGLE = new Rectangle(10, 87, 250, 21); |
122 |
private final Rectangle DEFAULT_PAN_ICON_BUTTON_RECTANGLE = new Rectangle(270, 85, 25, 25); |
123 |
private final Rectangle DEFAULT_ZOOMINANDOUT_COMBOBOX_RECTANGLE = new Rectangle(297, 85, 32 , 25); |
124 |
// private final Rectangle DEFAULT_ZOOMIN_ICON_BUTTON_RECTANGLE = new Rectangle(297,100,25,25);
|
125 |
// private final Rectangle DEFAULT_ZOOMOUT_ICON_BUTTON_RECTANGLE = new Rectangle(324,100,25,25);
|
126 |
private final Rectangle DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE = new Rectangle(331, 85, 25, 25); |
127 |
private final Rectangle DEFAULT_ZOOMPREVIOUS_ICON_BUTTON_RECTANGLE = new Rectangle(358, 85, 25, 25); |
128 |
private final Rectangle DEFAULT_ZOOMCOMPLETE_ICON_BUTTON_RECTANGLE = new Rectangle(385, 85, 25, 25); |
129 |
private final Rectangle DEFAULT_ZOOMINANDOUTVIEWCENTERED_COMBOBOX_RECTANGLE = new Rectangle(412, 85, 32, 25); |
130 |
// private final Rectangle DEFAULT_ZOOMINVIEWCENTERED_ICON_BUTTON_RECTANGLE = new Rectangle(378,100,25,25);
|
131 |
// private final Rectangle DEFAULT_ZOOMOUTVIEWCENTERED_ICON_BUTTON_RECTANGLE = new Rectangle(405,100,25,25);
|
132 |
private final Rectangle DEFAULT_INFO_ICON_BUTTON_RECTANGLE = new Rectangle(446, 85, 25, 25); |
133 |
// private final Rectangle DEFAULT_TOOLS_ICON_BUTTON_RECTANGLE = new Rectangle(459,100,25,25);
|
134 |
|
135 |
private final int DISABLED_OPERATION = 0; |
136 |
private final int SELECTION_BY_COORDENATES_OPERATION = 1; |
137 |
private final int SELECTION_BY_AREA_OPERATION = 2; |
138 |
|
139 |
private WFSWizardData data = null; |
140 |
private WFSParamsPanel parent = null; |
141 |
private AreaCoordinatesPanel coordinatesPanel = null; |
142 |
private AreaMapControlPanel areaMapControlPanel = null; |
143 |
private JComboBox jComboBoxToolSelection = null; |
144 |
private JButton jButtonPan = null; |
145 |
// private JButton jButtonZoomIn = null;
|
146 |
// private JButton jButtonZoomOut = null;
|
147 |
private JButton jButtonZoomRectangleSelection = null; |
148 |
private JButton jButtonZoomPrevious = null; |
149 |
private JButton jButtonZoomComplete = null; |
150 |
// private JButton jButtonZoomInViewCentered = null;
|
151 |
// private JButton jButtonZoomOutViewCentered = null;
|
152 |
private JButton jButtonInfo = null; |
153 |
// private JButton jButtonTools = null;
|
154 |
private JComboBox jComboBoxZoomInAndOut = null; |
155 |
private JComboBox jComboBoxZoomInAndOutViewCentered = null; |
156 |
|
157 |
/**
|
158 |
* This method initializes
|
159 |
*/
|
160 |
public WFSAreaPanel(WFSParamsPanel parent) {
|
161 |
super();
|
162 |
this.parent = parent;
|
163 |
initialize(); |
164 |
} |
165 |
|
166 |
/**
|
167 |
* This method initializes this
|
168 |
*/
|
169 |
private void initialize() { |
170 |
this.setLayout(null); |
171 |
this.setBounds(DEFAULT_BOUNDS);
|
172 |
this.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
173 |
null, PluginServices.getText(this, "select_by_area"), |
174 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
175 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
176 |
|
177 |
// Adds JPanel with the coordinates
|
178 |
this.add(getCoordinatesPanel(), null); |
179 |
|
180 |
// Adds JComboBox to select a part of the graphical interface
|
181 |
this.add(getJComboBoxToolSelection(), null); |
182 |
this.getJComboBoxToolSelection().setSelectedIndex(0); // By default select first element |
183 |
|
184 |
// Adds Icons
|
185 |
this.add(getJButtonPan(), null); |
186 |
// this.add(getJButtonZoomIn(), null);
|
187 |
// this.add(getJButtonZoomOut(), null);
|
188 |
this.add(getJComboBoxZoomInAndOut(), null); |
189 |
this.add(getJButtonZoomRectangleSelection(), null); |
190 |
this.add(getJButtonZoomPrevious(), null); |
191 |
this.add(getJButtonZoomComplete(), null); |
192 |
this.add(getJComboBoxZoomInAndOutViewCentered(), null); |
193 |
this.add(getJButtonInfo(), null); |
194 |
|
195 |
// Adds Jpanel with the view
|
196 |
this.add(getAreaMapControlPanel(), null); |
197 |
// this.add(get, null);
|
198 |
|
199 |
initCoordinates(); |
200 |
} |
201 |
|
202 |
/**
|
203 |
* Write the view coordinates into the coordinates panel
|
204 |
*/
|
205 |
private void initCoordinates(){ |
206 |
View activeView =
|
207 |
(View) PluginServices.getMDIManager().getActiveWindow();
|
208 |
Rectangle2D r2d= activeView.getMapControl().getViewPort().getAdjustedExtent();
|
209 |
if (r2d != null){ |
210 |
getCoordinatesPanel().setExtent(r2d); |
211 |
} |
212 |
} |
213 |
|
214 |
/**
|
215 |
* This method initializes coordinatesPanel
|
216 |
*
|
217 |
* @return javax.swing.JPanel
|
218 |
*/
|
219 |
private AreaCoordinatesPanel getCoordinatesPanel() {
|
220 |
if (coordinatesPanel == null) { |
221 |
coordinatesPanel = new AreaCoordinatesPanel();
|
222 |
} |
223 |
return coordinatesPanel;
|
224 |
} |
225 |
|
226 |
/**
|
227 |
* This method initializes jComboBoxToolSelection
|
228 |
*
|
229 |
* @return javax.swing.JComboBox
|
230 |
*/
|
231 |
private JComboBox getJComboBoxToolSelection() { |
232 |
if (jComboBoxToolSelection == null) { |
233 |
jComboBoxToolSelection = new JComboBox(); |
234 |
jComboBoxToolSelection.setBounds(DEFAULT_JCOMBOBOX_TOOL_SELECTION_RECTANGLE); |
235 |
jComboBoxToolSelection.setEditable(false);
|
236 |
jComboBoxToolSelection.addItem(new ItemOperation(PluginServices.getText(this, "disabled"), this.DISABLED_OPERATION)); |
237 |
jComboBoxToolSelection.addItem(new ItemOperation(PluginServices.getText(this, "define_absolute_coordenates"), this.SELECTION_BY_COORDENATES_OPERATION)); |
238 |
jComboBoxToolSelection.addItem(new ItemOperation(PluginServices.getText(this, "define_coordenates_using_view"), this.SELECTION_BY_AREA_OPERATION)); |
239 |
|
240 |
jComboBoxToolSelection.addActionListener(new ActionListener() { |
241 |
/*
|
242 |
* (non-Javadoc)
|
243 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
244 |
*/
|
245 |
public void actionPerformed(ActionEvent e) { |
246 |
JComboBox cb = (JComboBox)e.getSource(); |
247 |
switch(((ItemOperation)cb.getSelectedItem()).getOperation()) {
|
248 |
case DISABLED_OPERATION:
|
249 |
disableCoorderatesRegionOperation(); |
250 |
disableAreaRegionOperation(); |
251 |
getJButtonInfo().setEnabled(false);
|
252 |
break;
|
253 |
case SELECTION_BY_COORDENATES_OPERATION:
|
254 |
disableAreaRegionOperation(); |
255 |
enableCoorderatesRegionOperation(); |
256 |
getJButtonInfo().setEnabled(true);
|
257 |
break;
|
258 |
case SELECTION_BY_AREA_OPERATION:
|
259 |
disableCoorderatesRegionOperation(); |
260 |
enableAreaRegionOperation(); |
261 |
getJButtonInfo().setEnabled(true);
|
262 |
break;
|
263 |
} |
264 |
} |
265 |
}); |
266 |
} |
267 |
return jComboBoxToolSelection;
|
268 |
} |
269 |
|
270 |
/**
|
271 |
* Enables the components associated to the selection of area by coordinates
|
272 |
*/
|
273 |
private void enableCoorderatesRegionOperation() { |
274 |
getCoordinatesPanel().setAllTextFieldsEnabled(true);
|
275 |
} |
276 |
|
277 |
/**
|
278 |
* Enables the components associated to the selection of area by view
|
279 |
*/
|
280 |
private void enableAreaRegionOperation() { |
281 |
// Enables the icons
|
282 |
getJButtonPan().setEnabled(true);
|
283 |
getJComboBoxZoomInAndOut().setEnabled(true);
|
284 |
getJButtonZoomRectangleSelection().setEnabled(true);
|
285 |
getJButtonZoomPrevious().setEnabled(true);
|
286 |
getJButtonZoomComplete().setEnabled(true);
|
287 |
getJComboBoxZoomInAndOutViewCentered().setEnabled(true);
|
288 |
|
289 |
// Enables the MapControl area
|
290 |
getAreaMapControlPanel().setEnabled(true);
|
291 |
} |
292 |
|
293 |
/**
|
294 |
* Disables the components associated to the selection of area by coordinates
|
295 |
*/
|
296 |
private void disableCoorderatesRegionOperation() { |
297 |
getCoordinatesPanel().setAllTextFieldsEnabled(false);
|
298 |
} |
299 |
|
300 |
/**
|
301 |
* Disables the components associated to the selection of area by view
|
302 |
*/
|
303 |
private void disableAreaRegionOperation() { |
304 |
// Disables the icons
|
305 |
getJButtonPan().setEnabled(false);
|
306 |
getJComboBoxZoomInAndOut().setEnabled(false);
|
307 |
getJButtonZoomRectangleSelection().setEnabled(false);
|
308 |
getJButtonZoomPrevious().setEnabled(false);
|
309 |
getJButtonZoomComplete().setEnabled(false);
|
310 |
getJComboBoxZoomInAndOutViewCentered().setEnabled(false);
|
311 |
|
312 |
// Disables the MapControl area
|
313 |
getAreaMapControlPanel().setEnabled(false);
|
314 |
} |
315 |
|
316 |
/**
|
317 |
* This method initializes areaMapControlPanel
|
318 |
*
|
319 |
* @return A reference to an object of AreaMapControlPanel
|
320 |
*/
|
321 |
private AreaMapControlPanel getAreaMapControlPanel() {
|
322 |
if (areaMapControlPanel == null) { |
323 |
areaMapControlPanel = new AreaMapControlPanel();
|
324 |
} |
325 |
|
326 |
return areaMapControlPanel;
|
327 |
} |
328 |
|
329 |
/**
|
330 |
* This method initializes jButtonPan
|
331 |
*
|
332 |
* @return javax.swing.JButton
|
333 |
*/
|
334 |
private JButton getJButtonPan() { |
335 |
if (jButtonPan == null) { |
336 |
jButtonPan = new JButton(); |
337 |
jButtonPan.setBounds(DEFAULT_PAN_ICON_BUTTON_RECTANGLE); |
338 |
jButtonPan.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Pan.png"))); |
339 |
} |
340 |
return jButtonPan;
|
341 |
} |
342 |
|
343 |
/**
|
344 |
* This method initializes jComboBoxZoomInAndOut
|
345 |
*
|
346 |
* @return javax.swing.JComboBox
|
347 |
*/
|
348 |
private JComboBox getJComboBoxZoomInAndOut() { |
349 |
if (jComboBoxZoomInAndOut == null) { |
350 |
jComboBoxZoomInAndOut = new JComboBox(); |
351 |
jComboBoxZoomInAndOut.setBounds(DEFAULT_ZOOMINANDOUT_COMBOBOX_RECTANGLE); |
352 |
// jComboBoxZoomInAndOut.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Pan.png")));
|
353 |
} |
354 |
return jComboBoxZoomInAndOut;
|
355 |
} |
356 |
|
357 |
// /**
|
358 |
// * This method initializes jButtonZoomOut
|
359 |
// *
|
360 |
// * @return javax.swing.JButton
|
361 |
// */
|
362 |
// private JButton getJButtonZoomOut() {
|
363 |
// if (jButtonZoomOut == null) {
|
364 |
// jButtonZoomOut = new JButton();
|
365 |
// jButtonZoomOut.setBounds(DEFAULT_ZOOMOUT_ICON_BUTTON_RECTANGLE);
|
366 |
// jButtonZoomOut.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomOut.png")));
|
367 |
// }
|
368 |
// return jButtonZoomOut;
|
369 |
// }
|
370 |
//
|
371 |
// /**
|
372 |
// * This method initializes jButtonZoomIn
|
373 |
// *
|
374 |
// * @return javax.swing.JButton
|
375 |
// */
|
376 |
// private JButton getJButtonZoomIn() {
|
377 |
// if (jButtonZoomIn == null) {
|
378 |
// jButtonZoomIn = new JButton();
|
379 |
// jButtonZoomIn.setBounds(DEFAULT_ZOOMIN_ICON_BUTTON_RECTANGLE);
|
380 |
// jButtonZoomIn.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomIn.png")));
|
381 |
// }
|
382 |
// return jButtonZoomIn;
|
383 |
// }
|
384 |
|
385 |
/**
|
386 |
* This method initializes jButtonZoomRectangleSelection
|
387 |
*
|
388 |
* @return javax.swing.JButton
|
389 |
*/
|
390 |
private JButton getJButtonZoomRectangleSelection() { |
391 |
if (jButtonZoomRectangleSelection == null) { |
392 |
jButtonZoomRectangleSelection = new JButton(); |
393 |
jButtonZoomRectangleSelection.setBounds(DEFAULT_ZOOMRECTANGLESELECTION_ICON_BUTTON_RECTANGLE); |
394 |
jButtonZoomRectangleSelection.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomSeleccion.png"))); |
395 |
} |
396 |
return jButtonZoomRectangleSelection;
|
397 |
} |
398 |
|
399 |
/**
|
400 |
* This method initializes jButtonZoomPrevious
|
401 |
*
|
402 |
* @return javax.swing.JButton
|
403 |
*/
|
404 |
private JButton getJButtonZoomPrevious() { |
405 |
if (jButtonZoomPrevious == null) { |
406 |
jButtonZoomPrevious = new JButton(); |
407 |
jButtonZoomPrevious.setBounds(DEFAULT_ZOOMPREVIOUS_ICON_BUTTON_RECTANGLE); |
408 |
jButtonZoomPrevious.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomPrevio.png"))); |
409 |
} |
410 |
return jButtonZoomPrevious;
|
411 |
} |
412 |
|
413 |
/**
|
414 |
* This method initializes jButtonZoomComplete
|
415 |
*
|
416 |
* @return javax.swing.JButton
|
417 |
*/
|
418 |
private JButton getJButtonZoomComplete() { |
419 |
if (jButtonZoomComplete == null) { |
420 |
jButtonZoomComplete = new JButton(); |
421 |
jButtonZoomComplete.setBounds(DEFAULT_ZOOMCOMPLETE_ICON_BUTTON_RECTANGLE); |
422 |
jButtonZoomComplete.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/MapContents.png"))); |
423 |
} |
424 |
return jButtonZoomComplete;
|
425 |
} |
426 |
|
427 |
// /**
|
428 |
// * This method initializes jButtonZoomInViewCentered
|
429 |
// *
|
430 |
// * @return javax.swing.JButton
|
431 |
// */
|
432 |
// private JButton getJButtonZoomInViewCentered() {
|
433 |
// if (jButtonZoomInViewCentered == null) {
|
434 |
// jButtonZoomInViewCentered = new JButton();
|
435 |
// jButtonZoomInViewCentered.setBounds(DEFAULT_ZOOMINVIEWCENTERED_ICON_BUTTON_RECTANGLE);
|
436 |
// jButtonZoomInViewCentered.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/zoommas.png")));
|
437 |
// }
|
438 |
// return jButtonZoomInViewCentered;
|
439 |
// }
|
440 |
//
|
441 |
// /**
|
442 |
// * This method initializes jButtonZoomOutViewCentered
|
443 |
// *
|
444 |
// * @return javax.swing.JButton
|
445 |
// */
|
446 |
// private JButton getJButtonZoomOutViewCentered() {
|
447 |
// if (jButtonZoomOutViewCentered == null) {
|
448 |
// jButtonZoomOutViewCentered = new JButton();
|
449 |
// jButtonZoomOutViewCentered.setBounds(DEFAULT_ZOOMOUTVIEWCENTERED_ICON_BUTTON_RECTANGLE);
|
450 |
// jButtonZoomOutViewCentered.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/zoommenos.png")));
|
451 |
// }
|
452 |
// return jButtonZoomOutViewCentered;
|
453 |
// }
|
454 |
|
455 |
/**
|
456 |
* This method initializes jComboBoxZoomInAndOut
|
457 |
*
|
458 |
* @return javax.swing.JComboBox
|
459 |
*/
|
460 |
private JComboBox getJComboBoxZoomInAndOutViewCentered() { |
461 |
if (jComboBoxZoomInAndOutViewCentered == null) { |
462 |
jComboBoxZoomInAndOutViewCentered = new JComboBox(); |
463 |
jComboBoxZoomInAndOutViewCentered.setBounds(DEFAULT_ZOOMINANDOUTVIEWCENTERED_COMBOBOX_RECTANGLE); |
464 |
// jComboBoxZoomInAndOut.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Pan.png")));
|
465 |
} |
466 |
return jComboBoxZoomInAndOutViewCentered;
|
467 |
} |
468 |
|
469 |
/**
|
470 |
* This method initializes jButtonInfo
|
471 |
*
|
472 |
* @return javax.swing.JButton
|
473 |
*/
|
474 |
private JButton getJButtonInfo() { |
475 |
if (jButtonInfo == null) { |
476 |
jButtonInfo = new JButton(); |
477 |
jButtonInfo.setBounds(DEFAULT_INFO_ICON_BUTTON_RECTANGLE); |
478 |
jButtonInfo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/Identify.png"))); |
479 |
} |
480 |
return jButtonInfo;
|
481 |
} |
482 |
|
483 |
// /**
|
484 |
// * This method initializes jButtonTools
|
485 |
// *
|
486 |
// * @return javax.swing.JButton
|
487 |
// */
|
488 |
// private JButton getJButtonTools() {
|
489 |
// if (jButtonTools == null) {
|
490 |
// jButtonTools = new JButton();
|
491 |
// jButtonTools.setBounds(DEFAULT_TOOLS_ICON_BUTTON_RECTANGLE);
|
492 |
// jButtonTools.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/ZoomOut.png")));
|
493 |
// }
|
494 |
// return jButtonTools;
|
495 |
// }
|
496 |
|
497 |
/**
|
498 |
* Represents an object that stores the necessary information for know each operation of the 'jComboBoxToolSelection'
|
499 |
*
|
500 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
501 |
*/
|
502 |
private class ItemOperation { |
503 |
String _name;
|
504 |
int _operation;
|
505 |
|
506 |
/**
|
507 |
* Default constructor with two parameters
|
508 |
*
|
509 |
* @param name Name of the operation
|
510 |
* @param operation A code that identifies the operation
|
511 |
*/
|
512 |
public ItemOperation(String name, int operation) { |
513 |
_name = new String(name); |
514 |
_operation = operation; |
515 |
} |
516 |
|
517 |
/**
|
518 |
* Returns the name of the operation
|
519 |
*
|
520 |
* @return An String
|
521 |
*/
|
522 |
public String getName() { |
523 |
return _name;
|
524 |
} |
525 |
|
526 |
/**
|
527 |
* Returns the code that identifies the operation
|
528 |
*
|
529 |
* @return An integer value
|
530 |
*/
|
531 |
public int getOperation() { |
532 |
return _operation;
|
533 |
} |
534 |
|
535 |
/**
|
536 |
* The name of the operation that will use JComboBox
|
537 |
*/
|
538 |
public String toString() { |
539 |
return _name;
|
540 |
} |
541 |
} |
542 |
|
543 |
/**
|
544 |
* This class is a panel width four fields for indicate the coordenates of two points:
|
545 |
* One for the ritgh-up point and another for the left-down point of a rectangle area
|
546 |
*
|
547 |
* @author Pablo Piqueras Bartolom? (p_queras_pab@hotmail.com)
|
548 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
549 |
*/
|
550 |
private class AreaCoordinatesPanel extends JPanel implements Serializable { |
551 |
private final Rectangle DEFAULT_JRADIOBUTTON_GO_TO_AREA_RECTANGLE = new Rectangle(412, 5, 67, 50); // @jve:decl-index=0: |
552 |
private final int DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT = 20; |
553 |
private final int DEFAULT_COORDIANTE_LABEL_WIDTH = 20; |
554 |
private final int DEFAULT_TEXT_FIELDS_WIDTH = 132; |
555 |
private final int DEFAULT_X_LOCATION = 8; |
556 |
private final int DEFAULT_Y_LEFT_UP_CORNER_LOCATION = 6; |
557 |
private final int DEFAULT_COORDINATE_WIDTH = DEFAULT_COORDIANTE_LABEL_WIDTH + DEFAULT_TEXT_FIELDS_WIDTH + 10; |
558 |
private final int DEFAULT_COORDINATE_HEIGHT = 25; |
559 |
private final Dimension DEFAULT_JLABEL_VERTEX_DIMENSION = new Dimension(60, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT); // @jve:decl-index=0: |
560 |
private final int DEFAULT_XY_COORDINATES_WIDTH = 2 * DEFAULT_COORDINATE_WIDTH + DEFAULT_JLABEL_VERTEX_DIMENSION.width + 10 ; |
561 |
|
562 |
private JPanel jPanelVertex1 = null; |
563 |
private JPanel jPanelVertex2 = null; |
564 |
private JPanel jPanelVertex1X = null; |
565 |
private JPanel jPanelVertex1Y = null; |
566 |
private JPanel jPanelVertex2X = null; |
567 |
private JPanel jPanelVertex2Y = null; |
568 |
|
569 |
private JLabel jLabelVertex1 = null; |
570 |
private JLabel jLabelVertex2 = null; |
571 |
private JLabel jLabelVertex1X = null; |
572 |
private JLabel jLabelVertex1Y = null; |
573 |
private JLabel jLabelVertex2X = null; |
574 |
private JLabel jLabelVertex2Y = null; |
575 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex1X = null; |
576 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex1Y = null; |
577 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex2X = null; |
578 |
private JTextFieldWithSpecificCaretPosition jTextFieldVertex2Y = null; |
579 |
private JRadioButton jRadioButtonGoToArea = null; |
580 |
|
581 |
// private FocusAdapter focusAdapterForJTextFields = null;
|
582 |
|
583 |
/**
|
584 |
* This is the default constructor
|
585 |
*/
|
586 |
public AreaCoordinatesPanel() {
|
587 |
super();
|
588 |
initialize(); |
589 |
} |
590 |
|
591 |
/**
|
592 |
* This method initializes this
|
593 |
*
|
594 |
* @return void
|
595 |
*/
|
596 |
private void initialize() { |
597 |
this.setLayout(null); |
598 |
this.setBounds(DEFAULT_AREA_COORDINATES_PANEL_RECTANGLE);
|
599 |
this.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1)); |
600 |
this.setToolTipText(PluginServices.getText(this, "select_by_vertexes_coordenates")); |
601 |
// this.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
602 |
// null, PluginServices.getText(this, "select_by_vertexes_coordenates"),
|
603 |
// javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
|
604 |
// javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
|
605 |
this.add(getJPanelVertex1());
|
606 |
this.add(getJPanelVertex2());
|
607 |
this.add(getJRadioButtonGoToArea());
|
608 |
} |
609 |
|
610 |
/**
|
611 |
* Returns the default width of this component
|
612 |
*
|
613 |
* @return The default width
|
614 |
*/
|
615 |
public int getDefaultWidth() { |
616 |
return DEFAULT_COORDINATE_WIDTH * 2; |
617 |
} |
618 |
|
619 |
/**
|
620 |
* Returns the default height of this component
|
621 |
*
|
622 |
* @return The default height
|
623 |
*/
|
624 |
public int getDefaultHeight() { |
625 |
return DEFAULT_COORDINATE_HEIGHT * 2; |
626 |
} |
627 |
|
628 |
/**
|
629 |
* This method initializes jPanelVertex1
|
630 |
*
|
631 |
* @return javax.swing.JPanel
|
632 |
*/
|
633 |
private JPanel getJPanelVertex1() { |
634 |
if (jPanelVertex1 == null) { |
635 |
jPanelVertex1 = new JPanel(); |
636 |
jPanelVertex1.setBounds(DEFAULT_X_LOCATION, DEFAULT_Y_LEFT_UP_CORNER_LOCATION, DEFAULT_XY_COORDINATES_WIDTH, DEFAULT_COORDINATE_HEIGHT); |
637 |
jPanelVertex1.setLayout(new GridBagLayout()); |
638 |
jPanelVertex1.add(getJLabelVertex1(), null);
|
639 |
jPanelVertex1.add(getJPanelVertex1X(), null);
|
640 |
jPanelVertex1.add(getJPanelVertex1Y(), null);
|
641 |
} |
642 |
|
643 |
return jPanelVertex1;
|
644 |
} |
645 |
|
646 |
/**
|
647 |
* This method initializes jPanelVertex2
|
648 |
*
|
649 |
* @return javax.swing.JPanel
|
650 |
*/
|
651 |
private JPanel getJPanelVertex2() { |
652 |
if (jPanelVertex2 == null) { |
653 |
jPanelVertex2 = new JPanel(); |
654 |
jPanelVertex2.setBounds(DEFAULT_X_LOCATION, DEFAULT_Y_LEFT_UP_CORNER_LOCATION + DEFAULT_COORDINATE_HEIGHT, DEFAULT_XY_COORDINATES_WIDTH, DEFAULT_COORDINATE_HEIGHT); |
655 |
jPanelVertex2.setLayout(new GridBagLayout()); |
656 |
jPanelVertex2.add(getJLabelVertex2(), null);
|
657 |
jPanelVertex2.add(getJPanelVertex2X(), null);
|
658 |
jPanelVertex2.add(getJPanelVertex2Y(), null);
|
659 |
} |
660 |
|
661 |
return jPanelVertex2;
|
662 |
} |
663 |
|
664 |
/**
|
665 |
* This method initializes jLabelVertex1
|
666 |
*
|
667 |
* @return javax.swing.JPanel
|
668 |
*/
|
669 |
private JLabel getJLabelVertex1() { |
670 |
if (jLabelVertex1 == null) { |
671 |
jLabelVertex1 = new JLabel(); |
672 |
jLabelVertex1.setPreferredSize(DEFAULT_JLABEL_VERTEX_DIMENSION); |
673 |
jLabelVertex1.setToolTipText(PluginServices.getText(this, "coordinates_from_area_left_up_vertex")); |
674 |
jLabelVertex1.setText(PluginServices.getText(this, "vertex") + " 1:"); |
675 |
jLabelVertex1.setHorizontalAlignment(SwingConstants.LEFT);
|
676 |
jLabelVertex1.setVerticalAlignment(SwingConstants.CENTER);
|
677 |
jLabelVertex1.setForeground(new Color(0, 0, 255)); // Blue color for text |
678 |
} |
679 |
return jLabelVertex1;
|
680 |
} |
681 |
|
682 |
/**
|
683 |
* This method initializes jLabelVertex2
|
684 |
*
|
685 |
* @return javax.swing.JPanel
|
686 |
*/
|
687 |
private JLabel getJLabelVertex2() { |
688 |
if (jLabelVertex2 == null) { |
689 |
jLabelVertex2 = new JLabel(); |
690 |
jLabelVertex2.setPreferredSize(DEFAULT_JLABEL_VERTEX_DIMENSION); |
691 |
jLabelVertex2.setToolTipText(PluginServices.getText(this, "coordinates_from_area_right_bottom_vertex")); |
692 |
jLabelVertex2.setText(PluginServices.getText(this, "vertex") + " 2:"); |
693 |
jLabelVertex2.setHorizontalAlignment(SwingConstants.LEFT);
|
694 |
jLabelVertex2.setVerticalAlignment(SwingConstants.CENTER);
|
695 |
jLabelVertex2.setForeground(new Color(128, 64, 0)); // Brown color for text |
696 |
} |
697 |
return jLabelVertex2;
|
698 |
} |
699 |
|
700 |
/**
|
701 |
* This method initializes jPanelVertex1X
|
702 |
*
|
703 |
* @return javax.swing.JPanel
|
704 |
*/
|
705 |
private JPanel getJPanelVertex1X() { |
706 |
if (jPanelVertex1X == null) { |
707 |
jPanelVertex1X = new JPanel(); |
708 |
jPanelVertex1X.setPreferredSize(new Dimension(new Dimension(DEFAULT_COORDINATE_WIDTH, DEFAULT_COORDINATE_HEIGHT))); |
709 |
jPanelVertex1X.setLayout(new GridBagLayout()); |
710 |
jPanelVertex1X.add(getJLabelVertex1X(), null);
|
711 |
jPanelVertex1X.add(getJTextFieldVertex1X(), null);
|
712 |
} |
713 |
|
714 |
return jPanelVertex1X;
|
715 |
} |
716 |
|
717 |
/**
|
718 |
* This method initializes jPanelVertex1Y
|
719 |
*
|
720 |
* @return javax.swing.JPanel
|
721 |
*/
|
722 |
private JPanel getJPanelVertex1Y() { |
723 |
if (jPanelVertex1Y == null) { |
724 |
jPanelVertex1Y = new JPanel(); |
725 |
jPanelVertex1Y.setPreferredSize(new Dimension(new Dimension(DEFAULT_COORDINATE_WIDTH, DEFAULT_COORDINATE_HEIGHT))); |
726 |
jPanelVertex1Y.setLayout(new GridBagLayout()); |
727 |
jPanelVertex1Y.add(getJLabelVertex1Y(), null);
|
728 |
jPanelVertex1Y.add(getJTextFieldVertex1Y(), null);
|
729 |
} |
730 |
|
731 |
return jPanelVertex1Y;
|
732 |
} |
733 |
|
734 |
/**
|
735 |
* This method initializes jPanelVertex2X
|
736 |
*
|
737 |
* @return javax.swing.JPanel
|
738 |
*/
|
739 |
private JPanel getJPanelVertex2X() { |
740 |
if (jPanelVertex2X == null) { |
741 |
jPanelVertex2X = new JPanel(); |
742 |
jPanelVertex2X.setPreferredSize(new Dimension(new Dimension(DEFAULT_COORDINATE_WIDTH, DEFAULT_COORDINATE_HEIGHT))); |
743 |
jPanelVertex2X.setLayout(new GridBagLayout()); |
744 |
jPanelVertex2X.add(getJLabelVertex2X(), null);
|
745 |
jPanelVertex2X.add(getJTextFieldVertex2X(), null);
|
746 |
} |
747 |
|
748 |
return jPanelVertex2X;
|
749 |
} |
750 |
|
751 |
/**
|
752 |
* This method initializes jPanelVertex2Y
|
753 |
*
|
754 |
* @return javax.swing.JPanel
|
755 |
*/
|
756 |
private JPanel getJPanelVertex2Y() { |
757 |
if (jPanelVertex2Y == null) { |
758 |
jPanelVertex2Y = new JPanel(); |
759 |
jPanelVertex2Y.setPreferredSize(new Dimension(new Dimension(DEFAULT_COORDINATE_WIDTH, DEFAULT_COORDINATE_HEIGHT))); |
760 |
jPanelVertex2Y.setLayout(new GridBagLayout()); |
761 |
jPanelVertex2Y.add(getJLabelVertex2Y(), null);
|
762 |
jPanelVertex2Y.add(getJTextFieldVertex2Y(), null);
|
763 |
} |
764 |
|
765 |
return jPanelVertex2Y;
|
766 |
} |
767 |
|
768 |
/**
|
769 |
* This method initializes jLabelVertex1X
|
770 |
*
|
771 |
* @return javax.swing.JLabel
|
772 |
*/
|
773 |
private JLabel getJLabelVertex1X() { |
774 |
if (jLabelVertex1X == null) { |
775 |
jLabelVertex1X = new JLabel(); |
776 |
jLabelVertex1X.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT));
|
777 |
jLabelVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_up_vertex")); |
778 |
jLabelVertex1X.setText(PluginServices.getText(this, "x") + ":"); |
779 |
jLabelVertex1X.setHorizontalAlignment(SwingConstants.CENTER);
|
780 |
jLabelVertex1X.setVerticalAlignment(SwingConstants.CENTER);
|
781 |
jLabelVertex1X.setForeground(new Color(0, 0, 255)); // Blue color for text |
782 |
} |
783 |
|
784 |
return jLabelVertex1X;
|
785 |
} |
786 |
|
787 |
/**
|
788 |
* This method initializes jLabelVertex2X
|
789 |
*
|
790 |
* @return javax.swing.JLabel
|
791 |
*/
|
792 |
private JLabel getJLabelVertex2X() { |
793 |
if (jLabelVertex2X == null) { |
794 |
jLabelVertex2X = new JLabel(); |
795 |
jLabelVertex2X.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT));
|
796 |
jLabelVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_bottom_vertex")); |
797 |
jLabelVertex2X.setText(PluginServices.getText(this, "x") + ":"); |
798 |
jLabelVertex2X.setHorizontalAlignment(SwingConstants.CENTER);
|
799 |
jLabelVertex2X.setVerticalAlignment(SwingConstants.CENTER);
|
800 |
jLabelVertex2X.setForeground(new Color(128, 64, 0)); // Brown color for text |
801 |
} |
802 |
|
803 |
return jLabelVertex2X;
|
804 |
} |
805 |
|
806 |
/**
|
807 |
* This method initializes jLabelVertex1Y
|
808 |
*
|
809 |
* @return javax.swing.JLabel
|
810 |
*/
|
811 |
private JLabel getJLabelVertex1Y() { |
812 |
if (jLabelVertex1Y == null) { |
813 |
jLabelVertex1Y = new JLabel(); |
814 |
jLabelVertex1Y.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT));
|
815 |
jLabelVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_up_vertex")); |
816 |
jLabelVertex1Y.setText(PluginServices.getText(this, "y") + ":"); |
817 |
jLabelVertex1Y.setHorizontalAlignment(SwingConstants.CENTER);
|
818 |
jLabelVertex1Y.setVerticalAlignment(SwingConstants.CENTER);
|
819 |
jLabelVertex1Y.setForeground(new Color(0, 0, 255)); // Blue color for text |
820 |
} |
821 |
|
822 |
return jLabelVertex1Y;
|
823 |
} |
824 |
|
825 |
/**
|
826 |
* This method initializes jLabelVertex2Y
|
827 |
*
|
828 |
* @return javax.swing.JLabel
|
829 |
*/
|
830 |
private JLabel getJLabelVertex2Y() { |
831 |
if (jLabelVertex2Y == null) { |
832 |
jLabelVertex2Y = new JLabel(); |
833 |
jLabelVertex2Y.setPreferredSize(new java.awt.Dimension(DEFAULT_COORDIANTE_LABEL_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT));
|
834 |
jLabelVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_bottom_vertex")); |
835 |
jLabelVertex2Y.setText(PluginServices.getText(this, "y") + ":"); |
836 |
jLabelVertex2Y.setHorizontalAlignment(SwingConstants.CENTER);
|
837 |
jLabelVertex2Y.setVerticalAlignment(SwingConstants.CENTER);
|
838 |
jLabelVertex2Y.setForeground(new Color(128, 64, 0)); // Brown color for text |
839 |
} |
840 |
|
841 |
return jLabelVertex2Y;
|
842 |
} |
843 |
//
|
844 |
// /**
|
845 |
// * This method initializes a FocusAdapter event adapter, it's 'focusLost()' method for set the caret position of
|
846 |
// * the JTextField (source which generates the event of focusLost), to the first position.
|
847 |
// * This adapter is done for use only with the JTextFields of the coordenates
|
848 |
// *
|
849 |
// * @return java.awt.event.FocusAdapter
|
850 |
// */
|
851 |
// private FocusAdapter getJFocusAdapterForJTextFields() {
|
852 |
// if (focusAdapterForJTextFields == null) {
|
853 |
// focusAdapterForJTextFields = new FocusAdapter() {
|
854 |
// /*
|
855 |
// * (non-Javadoc)
|
856 |
// * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
|
857 |
// */
|
858 |
// public void focusLost(FocusEvent e) {
|
859 |
// ((JTextField)e.getSource()).setCaretPosition(0);
|
860 |
// }
|
861 |
// };
|
862 |
// }
|
863 |
// return focusAdapterForJTextFields;
|
864 |
// }
|
865 |
|
866 |
/**
|
867 |
* This method initializes jTextFieldVertex1X
|
868 |
*
|
869 |
* @return javax.swing.JTextField
|
870 |
*/
|
871 |
private JTextField getJTextFieldVertex1X() { |
872 |
if (jTextFieldVertex1X == null) { |
873 |
jTextFieldVertex1X = new JTextFieldWithSpecificCaretPosition();
|
874 |
jTextFieldVertex1X.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
875 |
jTextFieldVertex1X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_left_up_vertex")); |
876 |
} |
877 |
return jTextFieldVertex1X;
|
878 |
} |
879 |
|
880 |
/**
|
881 |
* This method initializes jTextFieldVertex1Y
|
882 |
*
|
883 |
* @return javax.swing.JTextField
|
884 |
*/
|
885 |
private JTextField getJTextFieldVertex1Y() { |
886 |
if (jTextFieldVertex1Y == null) { |
887 |
jTextFieldVertex1Y = new JTextFieldWithSpecificCaretPosition();
|
888 |
jTextFieldVertex1Y.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
889 |
jTextFieldVertex1Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_left_up_vertex")); |
890 |
} |
891 |
return jTextFieldVertex1Y;
|
892 |
} |
893 |
|
894 |
/**
|
895 |
* This method initializes jTextFieldVertex2X
|
896 |
*
|
897 |
* @return javax.swing.JTextField
|
898 |
*/
|
899 |
private JTextField getJTextFieldVertex2X() { |
900 |
if (jTextFieldVertex2X == null) { |
901 |
jTextFieldVertex2X = new JTextFieldWithSpecificCaretPosition();
|
902 |
jTextFieldVertex2X.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
903 |
jTextFieldVertex2X.setToolTipText(PluginServices.getText(this, "x_coordinate_from_area_right_bottom_vertex")); |
904 |
} |
905 |
return jTextFieldVertex2X;
|
906 |
} |
907 |
|
908 |
/**
|
909 |
* This method initializes jTextFieldVertex2Y
|
910 |
*
|
911 |
* @return javax.swing.JTextField
|
912 |
*/
|
913 |
private JTextField getJTextFieldVertex2Y() { |
914 |
if (jTextFieldVertex2Y == null) { |
915 |
jTextFieldVertex2Y = new JTextFieldWithSpecificCaretPosition();
|
916 |
jTextFieldVertex2Y.setPreferredSize(new Dimension(DEFAULT_TEXT_FIELDS_WIDTH, DEFAULT_LABELS_AND_TEXT_FIELDS_HEIGHT)); |
917 |
jTextFieldVertex2Y.setToolTipText(PluginServices.getText(this, "y_coordinate_from_area_right_bottom_vertex")); |
918 |
} |
919 |
return jTextFieldVertex2Y;
|
920 |
} |
921 |
|
922 |
/**
|
923 |
* This method initializes jbuttonGoToArea
|
924 |
*
|
925 |
* @return javax.swing.JRadioButton
|
926 |
*/
|
927 |
private JRadioButton getJRadioButtonGoToArea() { |
928 |
if (jRadioButtonGoToArea == null) { |
929 |
jRadioButtonGoToArea = new JRadioButton(); |
930 |
jRadioButtonGoToArea.setBounds(DEFAULT_JRADIOBUTTON_GO_TO_AREA_RECTANGLE); |
931 |
jRadioButtonGoToArea.setToolTipText(PluginServices.getText(this, "to_previsualize")); |
932 |
jRadioButtonGoToArea.setIcon(new ImageIcon(getClass().getClassLoader().getResource("images/to_previsualize_area.png"))); |
933 |
} |
934 |
return jRadioButtonGoToArea;
|
935 |
} |
936 |
|
937 |
/**
|
938 |
* Sets the extent
|
939 |
* @param extent
|
940 |
*/
|
941 |
public void setExtent(Rectangle2D extent){ |
942 |
getJTextFieldVertex1X().setText(String.valueOf(extent.getMaxX()));
|
943 |
getJTextFieldVertex1Y().setText(String.valueOf(extent.getMaxY()));
|
944 |
getJTextFieldVertex2X().setText(String.valueOf(extent.getMinX()));
|
945 |
getJTextFieldVertex2Y().setText(String.valueOf(extent.getMinY()));
|
946 |
} |
947 |
|
948 |
/**
|
949 |
* Gets the extent
|
950 |
* @return
|
951 |
*/
|
952 |
public Rectangle2D getExtent(){ |
953 |
if ((!getJTextFieldVertex1X().getText().equals("")) && |
954 |
(!getJTextFieldVertex1Y().getText().equals("")) &&
|
955 |
(!getJTextFieldVertex2X().getText().equals("")) &&
|
956 |
(!getJTextFieldVertex2Y().getText().equals(""))){
|
957 |
Rectangle2D r2d = new Rectangle2D.Double(new Double(getJTextFieldVertex1X().getText()).doubleValue(), |
958 |
new Double(getJTextFieldVertex1Y().getText()).doubleValue(), |
959 |
new Double(getJTextFieldVertex2X().getText()).doubleValue(), |
960 |
new Double(getJTextFieldVertex2Y().getText()).doubleValue()); |
961 |
return r2d;
|
962 |
} |
963 |
return null; |
964 |
} |
965 |
|
966 |
/**
|
967 |
* Enables or disables all inner JTextField
|
968 |
*
|
969 |
* @param b A boolean value
|
970 |
*/
|
971 |
public void setAllTextFieldsEnabled(boolean b) { |
972 |
getJTextFieldVertex1X().setEnabled(b); |
973 |
getJTextFieldVertex1Y().setEnabled(b); |
974 |
getJTextFieldVertex2X().setEnabled(b); |
975 |
getJTextFieldVertex2Y().setEnabled(b); |
976 |
} |
977 |
} |
978 |
|
979 |
/**
|
980 |
* DOCUMENTAR!!
|
981 |
*
|
982 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
|
983 |
*/
|
984 |
public class AreaMapControlPanel extends MapControl { |
985 |
// private final Rectangle DEFAULT_AREA_MAPCONTROL_RECTANGLE = new Rectangle(0, 0, DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE.width, DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE.height);
|
986 |
|
987 |
// private MapControl m_MapControl = null;
|
988 |
|
989 |
/**
|
990 |
* Default constructor
|
991 |
*/
|
992 |
public AreaMapControlPanel() {
|
993 |
this.initialize();
|
994 |
} |
995 |
|
996 |
/**
|
997 |
* This method initializes this
|
998 |
*/
|
999 |
private void initialize() { |
1000 |
this.setLayout(null); |
1001 |
this.setBounds(DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE);
|
1002 |
this.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1)); |
1003 |
// this.setBorder(javax.swing.BorderFactory.createTitledBorder(
|
1004 |
// null, PluginServices.getText(this, "select_by_graphical_area"),
|
1005 |
// javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
|
1006 |
// javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
|
1007 |
// this.add(this.getMapControl(DEFAULT_AREA_MAPCONTROL_PANEL_RECTANGLE.getSize()));
|
1008 |
} |
1009 |
|
1010 |
// /*
|
1011 |
// * (non-Javadoc)
|
1012 |
// * @see java.awt.Component#setEnabled(boolean)
|
1013 |
// */
|
1014 |
// public void setEnabled(boolean enabled) {
|
1015 |
// this.setEnabled(false);
|
1016 |
// this.getMapControl().setEnabled(false);
|
1017 |
// }
|
1018 |
|
1019 |
// /*
|
1020 |
// * (non-Javadoc)
|
1021 |
// * @see com.iver.cit.gvsig.project.documents.view.gui.IView#getMapControl()
|
1022 |
// */
|
1023 |
// public MapControl getMapControl() {
|
1024 |
// return this.m_MapControl;
|
1025 |
// }
|
1026 |
|
1027 |
|
1028 |
/**
|
1029 |
* Adds listeners to the inner MapControl of the inner area JPanel ??
|
1030 |
* (SOBRAR?N ALGUNOS)
|
1031 |
*/
|
1032 |
private void addListeneresToAreaPanel() { |
1033 |
// //Listener de eventos de movimiento que pone las coordenadas del rat?n en la barra de estado
|
1034 |
// StatusBarListener sbl = new StatusBarListener(this.areaMapControlPanel.getMapControl());
|
1035 |
//
|
1036 |
// // Zoom out (pinchas y el mapa se centra y te muestra m?s).
|
1037 |
// // No es dibujando un rect?ngulo, es solo pinchando.
|
1038 |
// ZoomOutListener zol = new ZoomOutListener(this.areaMapControlPanel.getMapControl());
|
1039 |
// this.areaMapControlPanel.getMapControl().addMapTool("zoomOut", new Behavior[]{new PointBehavior(zol), new MouseMovementBehavior(sbl)});
|
1040 |
//
|
1041 |
// // Pan
|
1042 |
// PanListener pl = new PanListener(this.areaMapControlPanel.getMapControl());
|
1043 |
// this.areaMapControlPanel.getMapControl().addMapTool("pan", new Behavior[]{new MoveBehavior(pl), new MouseMovementBehavior(sbl)});
|
1044 |
//
|
1045 |
// // Medir
|
1046 |
// MeasureListener mli = new MeasureListener(this.areaMapControlPanel.getMapControl());
|
1047 |
// this.areaMapControlPanel.getMapControl().addMapTool("medicion", new Behavior[]{new PolylineBehavior(mli), new MouseMovementBehavior(sbl)});
|
1048 |
//
|
1049 |
// // Area
|
1050 |
// AreaListener ali = new AreaListener(this.areaMapControlPanel.getMapControl());
|
1051 |
// this.areaMapControlPanel.getMapControl().addMapTool("area", new Behavior[]{new PolygonBehavior(ali), new MouseMovementBehavior(sbl)});
|
1052 |
//
|
1053 |
// // Seleccion por punto
|
1054 |
// PointSelectListener psl = new PointSelectListener(this.areaMapControlPanel.getMapControl());
|
1055 |
// this.areaMapControlPanel.getMapControl().addMapTool("pointSelection", new Behavior[]{new PointBehavior(psl), new MouseMovementBehavior(sbl)});
|
1056 |
//
|
1057 |
// // Info por punto
|
1058 |
// InfoListener il = new InfoListener(this.areaMapControlPanel.getMapControl());
|
1059 |
// this.areaMapControlPanel.getMapControl().addMapTool("info", new Behavior[]{new PointBehavior(il), new MouseMovementBehavior(sbl)});
|
1060 |
//
|
1061 |
// // Link por punto
|
1062 |
// LinkListener ll = new LinkListener(this.areaMapControlPanel.getMapControl());
|
1063 |
// this.areaMapControlPanel.getMapControl().addMapTool("link", new Behavior[]{new PointBehavior(ll), new MouseMovementBehavior(sbl)});
|
1064 |
//
|
1065 |
// // Selecci?n por rect?ngulo
|
1066 |
// RectangleSelectListener rsl = new RectangleSelectListener(this.areaMapControlPanel.getMapControl());
|
1067 |
// this.areaMapControlPanel.getMapControl().addMapTool("rectSelection", new Behavior[]{new RectangleBehavior(rsl), new MouseMovementBehavior(sbl)});
|
1068 |
//
|
1069 |
// // Selecci?n por pol?gono
|
1070 |
// PolygonSelectListener poligSel = new PolygonSelectListener(this.areaMapControlPanel.getMapControl());
|
1071 |
// this.areaMapControlPanel.getMapControl().addMapTool("polSelection", new Behavior[]{new PolygonBehavior(poligSel), new MouseMovementBehavior(sbl)});
|
1072 |
//
|
1073 |
// // Zoom por rect?ngulo
|
1074 |
// ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(this.areaMapControlPanel.getMapControl());
|
1075 |
// ZoomInListener zil = new ZoomInListener(this.areaMapControlPanel.getMapControl());
|
1076 |
// this.areaMapControlPanel.getMapControl().addMapTool("zoomIn", new Behavior[]{new RectangleBehavior(zil),
|
1077 |
// new PointBehavior(zoil), new MouseMovementBehavior(sbl)});
|
1078 |
//
|
1079 |
// SelectImageListener sil = new SelectImageListener(this.areaMapControlPanel.getMapControl());
|
1080 |
// this.areaMapControlPanel.getMapControl().addMapTool("selectImage", new Behavior[]{
|
1081 |
// new PointBehavior(sil), new MouseMovementBehavior(sbl)});
|
1082 |
//
|
1083 |
// ZoomPixelCursorListener zp = new ZoomPixelCursorListener(this.areaMapControlPanel.getMapControl());
|
1084 |
// this.areaMapControlPanel.getMapControl().addMapTool("zoom_pixel_cursor", new Behavior[]{new PointBehavior(zp), new MouseMovementBehavior(sbl)});
|
1085 |
//
|
1086 |
// this.areaMapControlPanel.getMapControl().setTool("zoomIn"); // Por defecto
|
1087 |
// // m_MapControl.setPaintEnabled(true);
|
1088 |
} |
1089 |
|
1090 |
// /**
|
1091 |
// * This method initializes m_MapControl
|
1092 |
// *
|
1093 |
// * @return com.iver.cit.gvsig.fmap.MapControl
|
1094 |
// */
|
1095 |
// private MapControl getMapControl(Dimension d) {
|
1096 |
// if (m_MapControl == null) {
|
1097 |
// m_MapControl = new MapControl(); // Default is paintEnabled = false.
|
1098 |
// m_MapControl.setBounds(DEFAULT_AREA_MAPCONTROL_RECTANGLE);
|
1099 |
// }
|
1100 |
//
|
1101 |
// return m_MapControl;
|
1102 |
// }
|
1103 |
|
1104 |
/**
|
1105 |
* @see MapControl#drawMap(boolean)
|
1106 |
*/
|
1107 |
public void repaintMap() { |
1108 |
this.drawMap(false); |
1109 |
} |
1110 |
//
|
1111 |
// /**
|
1112 |
// * @see MapControl#getImage()
|
1113 |
// */
|
1114 |
// public BufferedImage getImage() {
|
1115 |
// return getMapControl().getImage();
|
1116 |
// }
|
1117 |
//
|
1118 |
// /**
|
1119 |
// * @see MapControl#setProjection(IProjection)
|
1120 |
// */
|
1121 |
// public void setProjection(IProjection proj)
|
1122 |
// {
|
1123 |
// getMapControl().setProjection(proj);
|
1124 |
// }
|
1125 |
//
|
1126 |
// /**
|
1127 |
// * @see MapControl#getProjection()
|
1128 |
// */
|
1129 |
// public IProjection getProjection()
|
1130 |
// {
|
1131 |
// return getMapControl().getProjection();
|
1132 |
// }
|
1133 |
} |
1134 |
} |