svn-gvsig-desktop / tags / Root_v061 / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / DataInputSaveRaster.java @ 4812
History | View | Annotate | Download (16.3 KB)
1 |
/*
|
---|---|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications.
|
3 |
*
|
4 |
* Copyright (C) 2004-5.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* cresques@gmail.com
|
23 |
*/
|
24 |
package org.cresques.ui.raster; |
25 |
|
26 |
import java.awt.BorderLayout; |
27 |
import java.awt.FlowLayout; |
28 |
|
29 |
import javax.swing.DefaultComboBoxModel; |
30 |
import javax.swing.JButton; |
31 |
import javax.swing.JComboBox; |
32 |
import javax.swing.JLabel; |
33 |
import javax.swing.JPanel; |
34 |
import javax.swing.JTextField; |
35 |
import javax.swing.plaf.basic.BasicComboBoxEditor; |
36 |
|
37 |
import org.cresques.cts.IProjection; |
38 |
|
39 |
|
40 |
/**
|
41 |
* Panel que contiene los controles del dialogo de salvar a raster.
|
42 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
43 |
*/
|
44 |
public class DataInputSaveRaster extends JPanel { |
45 |
final private static long serialVersionUID = -3370601314380922368L; |
46 |
private JPanel jPanel = null; |
47 |
private JPanel coordenadas = null; |
48 |
private JPanel pSupIzq = null; |
49 |
private JPanel pInfDer = null; |
50 |
private double widthSelection = 0D, heightSelection = 0D; |
51 |
private IProjection proj = null; |
52 |
private int widthInPixelsGeodesicas = 0; |
53 |
private int heightInPixelsGeodesicas = 0; |
54 |
|
55 |
/**
|
56 |
* Control accesible para su traducci?n
|
57 |
*/
|
58 |
public JLabel lSupIzq = null; |
59 |
private JTextField tSupIzqX = null; |
60 |
private JTextField tSupIzqY = null; |
61 |
|
62 |
/**
|
63 |
* Control accesible para su traducci?n
|
64 |
*/
|
65 |
public JLabel lInfDer = null; |
66 |
|
67 |
/**
|
68 |
* Control accesible para su traducci?n
|
69 |
*/
|
70 |
public JLabel lY = null; |
71 |
private JTextField tInfDerX = null; |
72 |
private JTextField tInfDerY = null; |
73 |
private JPanel pDatosImagen = null; |
74 |
private JPanel pDatosFichero = null; |
75 |
private JPanel pEscalaRes = null; |
76 |
private JPanel pNombre = null; |
77 |
|
78 |
/**
|
79 |
* Control accesible para su traducci?n
|
80 |
*/
|
81 |
public JLabel lEscala = null; |
82 |
private JTextField tEscala = null; |
83 |
|
84 |
/**
|
85 |
* Control accesible para su traducci?n
|
86 |
*/
|
87 |
public JLabel lFile = null; |
88 |
|
89 |
/**
|
90 |
* Control accesible para su traducci?n
|
91 |
*/
|
92 |
public JLabel lResolucion = null; |
93 |
|
94 |
/**
|
95 |
* Control accesible para su traducci?n
|
96 |
*/
|
97 |
public JLabel lPpp = null; |
98 |
private DefaultComboBoxModel defaultComboBoxModel = null; |
99 |
private BasicComboBoxEditor basicComboBoxEditor = null; |
100 |
private String string = null; |
101 |
private JComboBox jComboBox = null; |
102 |
|
103 |
/**
|
104 |
* Control accesible para su traducci?n
|
105 |
*/
|
106 |
public JButton bSeleccion = null; |
107 |
private JPanel pAnchoAlto = null; |
108 |
|
109 |
/**
|
110 |
* Control accesible para su traducci?n
|
111 |
*/
|
112 |
public JLabel lAncho = null; |
113 |
|
114 |
/**
|
115 |
* Control accesible para su traducci?n
|
116 |
*/
|
117 |
public JLabel lAlto = null; |
118 |
private JTextField tAncho = null; |
119 |
private JTextField tAlto = null; |
120 |
|
121 |
/**
|
122 |
* Control accesible para su traducci?n
|
123 |
*/
|
124 |
public JButton bPropiedades = null; |
125 |
|
126 |
/**
|
127 |
* Constructor. Inicializa el panel.
|
128 |
*
|
129 |
*/
|
130 |
public DataInputSaveRaster() {
|
131 |
super();
|
132 |
initialize(); |
133 |
} |
134 |
|
135 |
/**
|
136 |
* Inicializa el panel.
|
137 |
*
|
138 |
*/
|
139 |
private void initialize() { |
140 |
this.setLayout(new BorderLayout()); |
141 |
this.setSize(350, 208); //AnchoxAlto panel interior |
142 |
this.add(getJPanel(), java.awt.BorderLayout.CENTER);
|
143 |
} |
144 |
|
145 |
/**
|
146 |
* This method initializes jPanel
|
147 |
*
|
148 |
* @return javax.swing.JPanel
|
149 |
*/
|
150 |
private JPanel getJPanel() { |
151 |
if (jPanel == null) { |
152 |
jPanel = new JPanel(); |
153 |
jPanel.setLayout(new BorderLayout()); |
154 |
jPanel.add(getCoordenadas(), java.awt.BorderLayout.NORTH); |
155 |
jPanel.add(getDatosImagen(), java.awt.BorderLayout.CENTER); |
156 |
jPanel.add(getDatosFichero(), java.awt.BorderLayout.SOUTH); |
157 |
} |
158 |
|
159 |
return jPanel;
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* This method initializes jPanel1
|
164 |
*
|
165 |
* @return javax.swing.JPanel
|
166 |
*/
|
167 |
private JPanel getCoordenadas() { |
168 |
if (coordenadas == null) { |
169 |
coordenadas = new JPanel(); |
170 |
coordenadas.setLayout(new BorderLayout()); |
171 |
coordenadas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
172 |
coordenadas.add(getPsup_izq(), java.awt.BorderLayout.NORTH); |
173 |
coordenadas.add(getPinf_der(), java.awt.BorderLayout.SOUTH); |
174 |
} |
175 |
|
176 |
return coordenadas;
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* This method initializes jPanel2
|
181 |
*
|
182 |
* @return javax.swing.JPanel
|
183 |
*/
|
184 |
private JPanel getPsup_izq() { |
185 |
if (pSupIzq == null) { |
186 |
lSupIzq = new JLabel(); |
187 |
lY = new JLabel(); |
188 |
pSupIzq = new JPanel(); |
189 |
|
190 |
FlowLayout flowLayout1 = new FlowLayout(); |
191 |
pSupIzq.setLayout(flowLayout1); |
192 |
lSupIzq.setText("Sup. izq. X:");
|
193 |
lY.setText(" Y:");
|
194 |
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
195 |
flowLayout1.setHgap(5);
|
196 |
pSupIzq.setAlignmentY(0.5F);
|
197 |
pSupIzq.add(lSupIzq, null);
|
198 |
pSupIzq.add(getTsup_izqX(), null);
|
199 |
pSupIzq.add(lY, null);
|
200 |
pSupIzq.add(getTsup_izqY(), null);
|
201 |
} |
202 |
|
203 |
return pSupIzq;
|
204 |
} |
205 |
|
206 |
/**
|
207 |
* This method initializes jPanel3
|
208 |
*
|
209 |
* @return javax.swing.JPanel
|
210 |
*/
|
211 |
private JPanel getPinf_der() { |
212 |
if (pInfDer == null) { |
213 |
lInfDer = new JLabel(); |
214 |
pInfDer = new JPanel(); |
215 |
lY= new JLabel(); |
216 |
|
217 |
FlowLayout flowLayout2 = new FlowLayout(); |
218 |
pInfDer.setLayout(flowLayout2); |
219 |
lY.setText(" Y:");
|
220 |
lInfDer.setText("Inf. der. X:");
|
221 |
flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
222 |
pInfDer.add(lInfDer, null);
|
223 |
pInfDer.add(getTinf_derX(), null);
|
224 |
pInfDer.add(lY, null);
|
225 |
pInfDer.add(getTinf_derY(), null);
|
226 |
} |
227 |
|
228 |
return pInfDer;
|
229 |
} |
230 |
|
231 |
/**
|
232 |
* This method initializes jTextField
|
233 |
*
|
234 |
* @return javax.swing.JTextField
|
235 |
*/
|
236 |
public JTextField getTsup_izqX() { |
237 |
if (tSupIzqX == null) { |
238 |
tSupIzqX = new JTextField(); |
239 |
tSupIzqX.setPreferredSize(new java.awt.Dimension(110, 19)); |
240 |
tSupIzqX.setText("0");
|
241 |
tSupIzqX.setMinimumSize(new java.awt.Dimension(110, 19)); |
242 |
} |
243 |
|
244 |
return tSupIzqX;
|
245 |
} |
246 |
|
247 |
/**
|
248 |
* This method initializes jTextField
|
249 |
*
|
250 |
* @return javax.swing.JTextField
|
251 |
*/
|
252 |
public JTextField getTsup_izqY() { |
253 |
if (tSupIzqY == null) { |
254 |
tSupIzqY = new JTextField(); |
255 |
tSupIzqY.setMinimumSize(new java.awt.Dimension(110, 19)); |
256 |
tSupIzqY.setPreferredSize(new java.awt.Dimension(110, 19)); |
257 |
tSupIzqY.setText("0");
|
258 |
} |
259 |
|
260 |
return tSupIzqY;
|
261 |
} |
262 |
|
263 |
/**
|
264 |
* This method initializes jTextField
|
265 |
*
|
266 |
* @return javax.swing.JTextField
|
267 |
*/
|
268 |
public JTextField getTinf_derX() { |
269 |
if (tInfDerX == null) { |
270 |
tInfDerX = new JTextField(); |
271 |
tInfDerX.setMinimumSize(new java.awt.Dimension(110, 19)); |
272 |
tInfDerX.setPreferredSize(new java.awt.Dimension(110, 19)); |
273 |
tInfDerX.setText("0");
|
274 |
} |
275 |
|
276 |
return tInfDerX;
|
277 |
} |
278 |
|
279 |
/**
|
280 |
* This method initializes jTextField1
|
281 |
*
|
282 |
* @return javax.swing.JTextField
|
283 |
*/
|
284 |
public JTextField getTinf_derY() { |
285 |
if (tInfDerY == null) { |
286 |
tInfDerY = new JTextField(); |
287 |
tInfDerY.setMinimumSize(new java.awt.Dimension(110, 19)); |
288 |
tInfDerY.setPreferredSize(new java.awt.Dimension(110, 19)); |
289 |
tInfDerY.setText("0");
|
290 |
} |
291 |
|
292 |
return tInfDerY;
|
293 |
} |
294 |
|
295 |
/**
|
296 |
* This method initializes jPanel1
|
297 |
*
|
298 |
* @return javax.swing.JPanel
|
299 |
*/
|
300 |
private JPanel getDatosImagen() { |
301 |
if (pDatosImagen == null) { |
302 |
BorderLayout borderLayout1 = new BorderLayout(); |
303 |
pDatosImagen = new JPanel(); |
304 |
pDatosImagen.setLayout(borderLayout1); |
305 |
pDatosImagen.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, |
306 |
1));
|
307 |
pDatosImagen.setAlignmentY(0.5F);
|
308 |
borderLayout1.setHgap(0);
|
309 |
borderLayout1.setVgap(0);
|
310 |
pDatosImagen.add(getPescalaRes(), java.awt.BorderLayout.NORTH); |
311 |
pDatosImagen.add(getPanchoAlto(), java.awt.BorderLayout.SOUTH); |
312 |
} |
313 |
|
314 |
return pDatosImagen;
|
315 |
} |
316 |
|
317 |
/**
|
318 |
* This method initializes jPanel2
|
319 |
*
|
320 |
* @return javax.swing.JPanel
|
321 |
*/
|
322 |
private JPanel getDatosFichero() { |
323 |
if (pDatosFichero == null) { |
324 |
pDatosFichero = new JPanel(); |
325 |
pDatosFichero.setLayout(new BorderLayout()); |
326 |
pDatosFichero.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
327 |
pDatosFichero.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
328 |
pDatosFichero.add(getPnombre(), java.awt.BorderLayout.CENTER); |
329 |
} |
330 |
|
331 |
return pDatosFichero;
|
332 |
} |
333 |
|
334 |
/**
|
335 |
* This method initializes jPanel1
|
336 |
*
|
337 |
* @return javax.swing.JPanel
|
338 |
*/
|
339 |
private JPanel getPescalaRes() { |
340 |
if (pEscalaRes == null) { |
341 |
lEscala = new JLabel(); |
342 |
lResolucion = new JLabel(); |
343 |
lPpp = new JLabel(); |
344 |
|
345 |
FlowLayout flowLayout3 = new FlowLayout(); |
346 |
pEscalaRes = new JPanel(); |
347 |
pEscalaRes.setLayout(flowLayout3); |
348 |
lEscala.setText("Escala 1:");
|
349 |
lResolucion.setText("Resoluci?n");
|
350 |
lPpp.setText("ppp");
|
351 |
lResolucion.setName("");
|
352 |
flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); |
353 |
flowLayout3.setVgap(20);
|
354 |
pEscalaRes.add(lEscala, null);
|
355 |
pEscalaRes.add(getTescala(), null);
|
356 |
pEscalaRes.add(lResolucion, null);
|
357 |
pEscalaRes.add(getJComboBox(), null);
|
358 |
pEscalaRes.add(lPpp, null);
|
359 |
} |
360 |
|
361 |
return pEscalaRes;
|
362 |
} |
363 |
|
364 |
/**
|
365 |
* This method initializes jPanel3
|
366 |
*
|
367 |
* @return javax.swing.JPanel
|
368 |
*/
|
369 |
private JPanel getPnombre() { |
370 |
if (pNombre == null) { |
371 |
lFile = new JLabel(); |
372 |
pNombre = new JPanel(); |
373 |
|
374 |
FlowLayout flowLayout4 = new FlowLayout(); |
375 |
pNombre.setLayout(flowLayout4); |
376 |
lFile.setText("Fichero");
|
377 |
flowLayout4.setAlignment(java.awt.FlowLayout.LEFT); |
378 |
pNombre.add(lFile, null);
|
379 |
pNombre.add(getBseleccion(), null);
|
380 |
pNombre.add(this.getBPropiedades(), null); |
381 |
this.getBPropiedades().setText("Propiedades GeoTiff"); |
382 |
} |
383 |
|
384 |
return pNombre;
|
385 |
} |
386 |
|
387 |
/**
|
388 |
* This method initializes jTextField
|
389 |
*
|
390 |
* @return javax.swing.JTextField
|
391 |
*/
|
392 |
public JTextField getTescala() { |
393 |
if (tEscala == null) { |
394 |
tEscala = new JTextField(); |
395 |
tEscala.setMinimumSize(new java.awt.Dimension(70, 19)); |
396 |
tEscala.setPreferredSize(new java.awt.Dimension(80, 19)); |
397 |
tEscala.setText("0");
|
398 |
} |
399 |
|
400 |
return tEscala;
|
401 |
} |
402 |
|
403 |
private Object makeObj(final String item) { |
404 |
return new Object() { |
405 |
public String toString() { |
406 |
return item;
|
407 |
} |
408 |
}; |
409 |
} |
410 |
|
411 |
/**
|
412 |
* This method initializes defaultComboBoxModel
|
413 |
*
|
414 |
* @return javax.swing.DefaultComboBoxModel
|
415 |
*/
|
416 |
private DefaultComboBoxModel getDefaultComboBoxModel() { |
417 |
if (defaultComboBoxModel == null) { |
418 |
defaultComboBoxModel = new DefaultComboBoxModel(); |
419 |
} |
420 |
|
421 |
return defaultComboBoxModel;
|
422 |
} |
423 |
|
424 |
/**
|
425 |
* This method initializes basicComboBoxEditor
|
426 |
*
|
427 |
* @return javax.swing.plaf.basic.BasicComboBoxEditor
|
428 |
*/
|
429 |
private BasicComboBoxEditor getBasicComboBoxEditor() { |
430 |
if (basicComboBoxEditor == null) { |
431 |
basicComboBoxEditor = new BasicComboBoxEditor(); |
432 |
basicComboBoxEditor.setItem(getString()); |
433 |
} |
434 |
|
435 |
return basicComboBoxEditor;
|
436 |
} |
437 |
|
438 |
/**
|
439 |
* This method initializes string
|
440 |
*
|
441 |
* @return java.lang.String
|
442 |
*/
|
443 |
private String getString() { |
444 |
if (string == null) { |
445 |
string = new String(); |
446 |
} |
447 |
|
448 |
return string;
|
449 |
} |
450 |
|
451 |
/**
|
452 |
* This method initializes jComboBox
|
453 |
*
|
454 |
* @return javax.swing.JComboBox
|
455 |
*/
|
456 |
public JComboBox getJComboBox() { |
457 |
if (jComboBox == null) { |
458 |
String[] lista = { "75", "150", "300" }; |
459 |
jComboBox = new JComboBox(lista); |
460 |
jComboBox.setPreferredSize(new java.awt.Dimension(70, 24)); |
461 |
} |
462 |
|
463 |
return jComboBox;
|
464 |
} |
465 |
|
466 |
/**
|
467 |
* This method initializes jComboBox
|
468 |
*
|
469 |
* @return javax.swing.JComboBox
|
470 |
*/
|
471 |
public JButton getBPropiedades() { |
472 |
if (bPropiedades == null) { |
473 |
bPropiedades = new JButton(); |
474 |
} |
475 |
|
476 |
return bPropiedades;
|
477 |
} |
478 |
|
479 |
/**
|
480 |
* This method initializes jButton
|
481 |
*
|
482 |
* @return javax.swing.JButton
|
483 |
*/
|
484 |
public JButton getBseleccion() { |
485 |
if (bSeleccion == null) { |
486 |
bSeleccion = new JButton(); |
487 |
bSeleccion.setText("Seleccionar");
|
488 |
} |
489 |
|
490 |
return bSeleccion;
|
491 |
} |
492 |
|
493 |
/**
|
494 |
* This method initializes jPanel1
|
495 |
*
|
496 |
* @return javax.swing.JPanel
|
497 |
*/
|
498 |
private JPanel getPanchoAlto() { |
499 |
if (pAnchoAlto == null) { |
500 |
lAlto = new JLabel(); |
501 |
lAncho = new JLabel(); |
502 |
|
503 |
FlowLayout flowLayout5 = new FlowLayout(); |
504 |
pAnchoAlto = new JPanel(); |
505 |
pAnchoAlto.setLayout(flowLayout5); |
506 |
lAncho.setText("Ancho.");
|
507 |
flowLayout5.setAlignment(java.awt.FlowLayout.LEFT); |
508 |
flowLayout5.setVgap(20);
|
509 |
lAlto.setText("Alto.");
|
510 |
pAnchoAlto.add(lAncho, null);
|
511 |
pAnchoAlto.add(getTancho(), null);
|
512 |
pAnchoAlto.add(lAlto, null);
|
513 |
pAnchoAlto.add(getTalto(), null);
|
514 |
} |
515 |
|
516 |
return pAnchoAlto;
|
517 |
} |
518 |
|
519 |
/**
|
520 |
* This method initializes jTextField
|
521 |
*
|
522 |
* @return javax.swing.JTextField
|
523 |
*/
|
524 |
public JTextField getTancho() { |
525 |
if (tAncho == null) { |
526 |
tAncho = new JTextField(); |
527 |
tAncho.setPreferredSize(new java.awt.Dimension(80, 19)); |
528 |
tAncho.setEditable(false);
|
529 |
tAncho.setText("0");
|
530 |
} |
531 |
|
532 |
return tAncho;
|
533 |
} |
534 |
|
535 |
/**
|
536 |
* This method initializes jTextField1
|
537 |
*
|
538 |
* @return javax.swing.JTextField
|
539 |
*/
|
540 |
public JTextField getTalto() { |
541 |
if (tAlto == null) { |
542 |
tAlto = new JTextField(); |
543 |
tAlto.setPreferredSize(new java.awt.Dimension(80, 19)); |
544 |
tAlto.setText("0");
|
545 |
tAlto.setEditable(false);
|
546 |
} |
547 |
|
548 |
return tAlto;
|
549 |
} |
550 |
|
551 |
/**
|
552 |
* Asigna el ancho y el alto en metros de la selecci?n hecha en la vista
|
553 |
* por el rectangulo de salvar a raster
|
554 |
*/
|
555 |
public void setSizeSelection(double w, double h){ |
556 |
this.widthSelection = w;
|
557 |
this.heightSelection = h;
|
558 |
} |
559 |
|
560 |
/**
|
561 |
* Obtiene el ancho de la selecci?n en metros
|
562 |
* @return
|
563 |
*/
|
564 |
public double getWidthSelection() { |
565 |
return widthSelection;
|
566 |
} |
567 |
|
568 |
/**
|
569 |
* Obtiene el alto de la selecci?n en metros
|
570 |
* @return
|
571 |
*/
|
572 |
public double getHeightSelection() { |
573 |
return heightSelection;
|
574 |
} |
575 |
|
576 |
/**
|
577 |
* Asigna la proyecci?n
|
578 |
* @param proj Interfaz IProjection
|
579 |
*/
|
580 |
public void setProjection(IProjection proj){ |
581 |
this.proj = proj;
|
582 |
} |
583 |
|
584 |
/**
|
585 |
* Obtiene la proyecci?n
|
586 |
* @return Interfaz IProjection
|
587 |
*/
|
588 |
public IProjection getProjection(){
|
589 |
return proj;
|
590 |
} |
591 |
|
592 |
/**
|
593 |
*
|
594 |
* @return
|
595 |
*/
|
596 |
public int getWidthInPixelsGeodesicas() { |
597 |
return widthInPixelsGeodesicas;
|
598 |
} |
599 |
|
600 |
/**
|
601 |
*
|
602 |
* @param widthInPixelsWG84
|
603 |
*/
|
604 |
public void setWidthInPixelsGeodesicas(int widthInPixelsGeodesicas) { |
605 |
this.widthInPixelsGeodesicas = widthInPixelsGeodesicas;
|
606 |
} |
607 |
|
608 |
/**
|
609 |
*
|
610 |
* @return
|
611 |
*/
|
612 |
public int getHeightInPixelsGeodesicas() { |
613 |
return heightInPixelsGeodesicas;
|
614 |
} |
615 |
|
616 |
/**
|
617 |
*
|
618 |
* @param widthInPixelsWG84
|
619 |
*/
|
620 |
public void setHeightInPixelsGeodesicas(int heightInPixelsGeodesicas) { |
621 |
this.heightInPixelsGeodesicas = heightInPixelsGeodesicas;
|
622 |
} |
623 |
|
624 |
} |