root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / wizards / GeoRasterWizard.java @ 8120
History | View | Annotate | Download (19.6 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.georeferencing.wizards; |
20 |
|
21 |
import java.awt.Component; |
22 |
import java.awt.FlowLayout; |
23 |
import java.awt.GridBagConstraints; |
24 |
import java.awt.GridBagLayout; |
25 |
import java.awt.event.ActionEvent; |
26 |
import java.awt.geom.Rectangle2D; |
27 |
import java.io.BufferedReader; |
28 |
import java.io.BufferedWriter; |
29 |
import java.io.File; |
30 |
import java.io.FileInputStream; |
31 |
import java.io.FileNotFoundException; |
32 |
import java.io.FileWriter; |
33 |
import java.io.IOException; |
34 |
import java.io.InputStreamReader; |
35 |
|
36 |
import javax.swing.JButton; |
37 |
import javax.swing.JCheckBox; |
38 |
import javax.swing.JDialog; |
39 |
import javax.swing.JFileChooser; |
40 |
import javax.swing.JLabel; |
41 |
import javax.swing.JOptionPane; |
42 |
import javax.swing.JPanel; |
43 |
import javax.swing.JTextField; |
44 |
import javax.swing.filechooser.FileFilter; |
45 |
|
46 |
import org.cresques.cts.IProjection; |
47 |
import org.cresques.io.GeoRasterFile; |
48 |
import org.cresques.px.Extent; |
49 |
import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog; |
50 |
import org.gvsig.georeferencing.utils.GeoLayerFactory; |
51 |
import org.gvsig.georeferencing.utils.GeoUtils; |
52 |
import org.gvsig.georeferencing.utils.PointManager; |
53 |
|
54 |
import com.hardcode.driverManager.DriverLoadException; |
55 |
import com.iver.andami.PluginServices; |
56 |
import com.iver.andami.messages.NotificationManager; |
57 |
import com.iver.cit.gvsig.fmap.DriverException; |
58 |
import com.iver.cit.gvsig.fmap.ViewPort; |
59 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
60 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
61 |
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster; |
62 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
63 |
import com.iver.cit.gvsig.gui.WizardPanel; |
64 |
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel; |
65 |
import com.iver.cit.gvsig.gui.wizards.WizardListener; |
66 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
67 |
import com.iver.cit.gvsig.project.documents.gui.FOpenDialog; |
68 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
69 |
|
70 |
/**
|
71 |
* Clase que implementa el Wizard para la georreferenciaci?n
|
72 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
73 |
*/
|
74 |
public class GeoRasterWizard extends WizardPanel{ |
75 |
|
76 |
//**********************Vars**********************************
|
77 |
private JPanel pGeneral = null; |
78 |
private JPanel pFileSelection = null; |
79 |
private JPanel pControls = null; |
80 |
private JTextField tFile = null; |
81 |
private JButton bSelectFile = null; |
82 |
private CRSSelectPanel pProyection = null; |
83 |
private WizardListenerSupport listenerSupport = new WizardListenerSupport(); |
84 |
/**
|
85 |
* Lista de formatos soportados
|
86 |
*/
|
87 |
private String[] fileFilters = {"tif", "tiff", "jpg", "jpeg", "png", "gif", "bmp"}; |
88 |
/**
|
89 |
* Nombre del fichero seleccionado
|
90 |
*/
|
91 |
private String fName = ""; |
92 |
|
93 |
/**
|
94 |
* Nombre de la capa
|
95 |
*/
|
96 |
private String lyrName = ""; |
97 |
/**
|
98 |
* Recuerda la ?ltima ruta seleccionada por el usuario
|
99 |
*/
|
100 |
//private String lastPath = "./";
|
101 |
private static String lastPath = null; |
102 |
private FLyrGeoRaster lyrGeoRaster = null; |
103 |
private JPanel pCheckUseGeoref = null; |
104 |
private JCheckBox cbUseGeoref = null; |
105 |
private JLabel lUseGeoref = null; |
106 |
private double widthPxImg, heightPxImg; |
107 |
/**
|
108 |
* Extent calculado a partir de la vista.
|
109 |
*/
|
110 |
private Extent ext = null; |
111 |
//**********************Vars**********************************
|
112 |
|
113 |
//**********************Classes*******************************
|
114 |
/**
|
115 |
* Filtro para los ficheros de georreferenciaci?n.
|
116 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
117 |
*/
|
118 |
public class DriverFileFilter extends FileFilter{ |
119 |
|
120 |
public DriverFileFilter(){}
|
121 |
|
122 |
/**
|
123 |
* @see javax.swing.filechooser.FileFilter#accept(java.io.File)
|
124 |
*/
|
125 |
public boolean accept(File f) { |
126 |
if (f.isDirectory()) return true; |
127 |
for(int i=0; i<fileFilters.length;i++){ |
128 |
if(f.getName().endsWith(fileFilters[i]))
|
129 |
return true; |
130 |
} |
131 |
return false; |
132 |
} |
133 |
|
134 |
/**
|
135 |
* @see javax.swing.filechooser.FileFilter#getDescription()
|
136 |
*/
|
137 |
public String getDescription() { |
138 |
return PluginServices.getText(this, "georef_file") + " ( tif, jpg, gif, png)"; |
139 |
} |
140 |
} |
141 |
//**********************End Classes***************************
|
142 |
|
143 |
//**********************Methods*******************************
|
144 |
/**
|
145 |
* This is the default constructor
|
146 |
*/
|
147 |
public GeoRasterWizard() {
|
148 |
super();
|
149 |
initialize(); |
150 |
} |
151 |
|
152 |
/**
|
153 |
* This method initializes this
|
154 |
*
|
155 |
* @return void
|
156 |
*/
|
157 |
private void initialize() { |
158 |
this.setPreferredSize(new java.awt.Dimension(750,320)); |
159 |
this.setSize(new java.awt.Dimension(510,311)); |
160 |
this.setLocation(new java.awt.Point(0,0)); |
161 |
this.add(getPGeneral(), null); |
162 |
this.getBSelectFile().addActionListener(new java.awt.event.ActionListener() { |
163 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
164 |
acceptButtonActionPerformed(evt); |
165 |
} |
166 |
}); |
167 |
} |
168 |
|
169 |
/**
|
170 |
* Calcula un extent posible para la imagen a partir del extent de la vista.
|
171 |
* En este caso centra la imagen en la vista para que cuando se cargue la imagen
|
172 |
* a georreferenciar nos quede centrada si elegimos la opci?n de no utilizar el
|
173 |
* extent de la imagen.
|
174 |
* @param w Ancho de la imagen
|
175 |
* @param h Alto de la imagen
|
176 |
* @return Extent para la imagen
|
177 |
*/
|
178 |
protected Extent calcTempExtent(String file, ViewPort vp, IProjection proj){ |
179 |
|
180 |
//Obtenemos el ancho y alto de la imagen y obtenemos un extent a partir
|
181 |
//del viewport.
|
182 |
Extent tempExtent = null;
|
183 |
GeoRasterFile grf = GeoRasterFile.openFile(proj, file); |
184 |
try{
|
185 |
widthPxImg = grf.getWidth(); |
186 |
heightPxImg = grf.getHeight(); |
187 |
}catch(NullPointerException exc){ |
188 |
System.err.println("FileName: "+file); |
189 |
exc.printStackTrace(); |
190 |
return null; |
191 |
} |
192 |
if(vp == null || vp.getAdjustedExtent() == null){ |
193 |
vp = new ViewPort(proj);
|
194 |
Rectangle2D r2d = new Rectangle2D.Double(0, 0, widthPxImg, heightPxImg); |
195 |
vp.setExtent(r2d); |
196 |
tempExtent = new Extent(0, 0, widthPxImg, heightPxImg); |
197 |
}else
|
198 |
tempExtent = new Extent(vp.getAdjustedExtent());
|
199 |
//grf.close();
|
200 |
|
201 |
double ulX = 0D, ulY = 0D, lrX = 0D, lrY = 0D; |
202 |
if(widthPxImg > heightPxImg){
|
203 |
double widthView = tempExtent.maxX() - tempExtent.minX();
|
204 |
ulX = tempExtent.minX() + (widthView / 4);
|
205 |
lrX = ulX + (widthView / 2);
|
206 |
double newAlto = ((heightPxImg * (widthView / 2)) / widthPxImg); |
207 |
double centroY = tempExtent.minY()+((tempExtent.maxY() - tempExtent.minY())/2); |
208 |
ulY = centroY - (newAlto / 2);
|
209 |
lrY = centroY + (newAlto / 2);
|
210 |
}else{
|
211 |
double heightView = tempExtent.maxY() - tempExtent.minY();
|
212 |
ulY = tempExtent.minY() + (heightView / 4);
|
213 |
lrY = ulY + (heightView / 2);
|
214 |
double newAncho = ((widthPxImg * (heightView / 2)) / heightPxImg); |
215 |
double centroX = tempExtent.minX()+((tempExtent.maxX() - tempExtent.minX())/2); |
216 |
ulX = centroX - (newAncho / 2);
|
217 |
lrX = centroX + (newAncho / 2);
|
218 |
} |
219 |
return new Extent(ulX, ulY, lrX, lrY); |
220 |
} |
221 |
|
222 |
/**
|
223 |
* Evento de pulsado del bot?n de seleccionar fichero
|
224 |
* @param e
|
225 |
*/
|
226 |
private void acceptButtonActionPerformed(ActionEvent e) { |
227 |
//Selector de Fichero que se quiere georeferenciar
|
228 |
|
229 |
if( e.getSource().equals(this.getBSelectFile())){ |
230 |
JFileChooser chooser = new JFileChooser(lastPath); |
231 |
chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero")); |
232 |
|
233 |
DriverFileFilter f = new DriverFileFilter();
|
234 |
chooser.addChoosableFileFilter(f); |
235 |
|
236 |
int returnVal = chooser.showOpenDialog(this); |
237 |
if(returnVal == JFileChooser.APPROVE_OPTION){ |
238 |
this.fName = chooser.getSelectedFile().toString();
|
239 |
FileFilter filter = chooser.getFileFilter();
|
240 |
this.getTFile().setText(fName);
|
241 |
lastPath = chooser.getCurrentDirectory().getAbsolutePath(); |
242 |
|
243 |
if (PluginServices.getMainFrame() == null) { |
244 |
((JDialog) (getParent().getParent().getParent()
|
245 |
.getParent())).dispose(); |
246 |
} else {
|
247 |
//Creamos la capa y la cargamos
|
248 |
IProjection proj = this.getPProyection().getCurProj();
|
249 |
try{
|
250 |
View theView = null; |
251 |
try{
|
252 |
theView = (View)PluginServices.getMDIManager().getActiveWindow();
|
253 |
}catch(ClassCastException exc){ |
254 |
return;
|
255 |
} |
256 |
|
257 |
com.hardcode.driverManager.Driver driver = LayerFactory.getDM().getDriver("gvSIG Image Driver");
|
258 |
|
259 |
File fich = new File(fName); |
260 |
|
261 |
ViewPort viewPort = theView.getMapControl().getMapContext().getViewPort(); |
262 |
|
263 |
//Calcula el extent para que la imagen que se carga quede centrada.
|
264 |
ext = calcTempExtent( fName, viewPort, proj); |
265 |
|
266 |
if(ext == null){ |
267 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
268 |
PluginServices.getText(this, "imagen_no_accesible")); |
269 |
return;
|
270 |
} |
271 |
|
272 |
//Asigna el nombre de la capa con el marcador *
|
273 |
this.setLyrName("*"+fName.substring(fName.lastIndexOf(File.separator)+1)); |
274 |
|
275 |
//Antes de crear la capa si tiene georreferenciaci?n por .rmf la reseteamos
|
276 |
if(!this.getCbUseGeoref().isSelected()) |
277 |
removeGeoref(fName); |
278 |
|
279 |
//Crea la capa
|
280 |
lyrGeoRaster = GeoLayerFactory.createLayer(getLyrName(), |
281 |
(RasterDriver) driver, |
282 |
fich, |
283 |
proj, |
284 |
widthPxImg, |
285 |
heightPxImg); |
286 |
//Pone activa la capa
|
287 |
if(lyrGeoRaster != null) |
288 |
lyrGeoRaster.setActive(true);
|
289 |
|
290 |
|
291 |
if( ext != null && fich != null && |
292 |
this.lyrGeoRaster != null && !getTFile().getText().equals("")) |
293 |
listenerSupport.callStateChanged(true);
|
294 |
|
295 |
}catch(DriverLoadException exc){
|
296 |
NotificationManager.addError("No se pudo acceder a los drivers", exc);
|
297 |
}catch(DriverException exc){
|
298 |
NotificationManager.addError("El driver ha producido un error", exc);
|
299 |
} |
300 |
|
301 |
} |
302 |
} |
303 |
} |
304 |
|
305 |
} |
306 |
|
307 |
/**
|
308 |
* Elimina la georrefenciaci?n externa de la imagen antes de comenzar a georreferenciar
|
309 |
* @param fName Nombre del fichero a georreferenciar.
|
310 |
*/
|
311 |
private void removeGeoref(String fName){ |
312 |
String rmf = fName.substring(0, fName.lastIndexOf(".")) + ".rmf"; |
313 |
File file = new File(rmf); |
314 |
String ext = fName.substring(fName.lastIndexOf(".") + 1, fName.length()); |
315 |
|
316 |
//Hacemos un backup del fichero RMF
|
317 |
String backupRmf = GeoUtils.fileBackup(rmf);
|
318 |
|
319 |
//Eliminamos el fichero rmf y lo volvemos a crear sin la informaci?n de georreferenciaci?n
|
320 |
if(file.exists()){
|
321 |
file.delete(); |
322 |
try{
|
323 |
file.createNewFile(); |
324 |
String encoding = GeoUtils.readFileEncoding(backupRmf);
|
325 |
|
326 |
FileInputStream fis = new FileInputStream(backupRmf); |
327 |
BufferedReader inReader = null; |
328 |
BufferedWriter outWriter = null; |
329 |
|
330 |
if(encoding != null) |
331 |
inReader = new BufferedReader(new InputStreamReader(fis, encoding)); |
332 |
else
|
333 |
inReader = new BufferedReader(new InputStreamReader(fis, "ISO-8859-15")); |
334 |
outWriter = new BufferedWriter(new FileWriter(file, false)); |
335 |
|
336 |
String line = null; |
337 |
boolean write = true; |
338 |
while((line = inReader.readLine()) != null) { |
339 |
if(line.startsWith("<FLyrGeoRaster ")) |
340 |
write = false;
|
341 |
if(write)
|
342 |
outWriter.write(line+"\n");
|
343 |
if(line.startsWith("</FLyrGeoRaster>")) |
344 |
write = true;
|
345 |
} |
346 |
inReader.close(); |
347 |
outWriter.close(); |
348 |
|
349 |
}catch(FileNotFoundException exc){ |
350 |
System.err.print("RMF Backup: File not found, "+fName); |
351 |
return;
|
352 |
}catch(IOException exc){ |
353 |
System.err.print("RMF Backup: IOException, "+fName); |
354 |
return;
|
355 |
} |
356 |
|
357 |
} |
358 |
|
359 |
//Si tiene worldfile lo renombramos
|
360 |
String georef = fName.substring(0, fName.lastIndexOf(".")) + GeoUtils.getWorldFileExtensionFromFileName(fName); |
361 |
File worldFile = new File(georef); |
362 |
if(worldFile.exists()){
|
363 |
GeoUtils.fileBackup(georef); |
364 |
worldFile.delete(); |
365 |
} |
366 |
|
367 |
} |
368 |
|
369 |
/**
|
370 |
* M?todo que se ejecuta al pulsar el bot?n de aceptar. En este caso asignamos el
|
371 |
* extent calculado desde la vista si el checkbox no est? marcado y lanzaremos el
|
372 |
* dialogo de georeferenciaci?n. El resto del trabajo lo realiza la clase AddLayer.
|
373 |
*/
|
374 |
public void execute() { |
375 |
if(!this.getCbUseGeoref().isSelected()) |
376 |
lyrGeoRaster.setAssignExtent(ext); |
377 |
|
378 |
PointManager.initWindow(lyrGeoRaster, true, this); |
379 |
} |
380 |
|
381 |
public void initWizard() { |
382 |
|
383 |
} |
384 |
|
385 |
/**
|
386 |
* Adds the gvSIG's wizard listener
|
387 |
*
|
388 |
* @param listener
|
389 |
*/
|
390 |
public void addWizardListener(WizardListener listener) { |
391 |
listenerSupport.addWizardListener(listener); |
392 |
} |
393 |
|
394 |
/* (non-Javadoc)
|
395 |
* @see com.iver.cit.gvsig.gui.WizardPanel#callError(java.lang.Exception)
|
396 |
*/
|
397 |
public void callError(Exception descripcion) { |
398 |
// TODO Auto-generated method stub
|
399 |
super.callError(descripcion);
|
400 |
} |
401 |
|
402 |
/* (non-Javadoc)
|
403 |
* @see com.iver.cit.gvsig.gui.WizardPanel#callStateChanged(boolean)
|
404 |
*/
|
405 |
public void callStateChanged(boolean finishable) { |
406 |
// TODO Auto-generated method stub
|
407 |
super.callStateChanged(finishable);
|
408 |
} |
409 |
|
410 |
/* (non-Javadoc)
|
411 |
* @see com.iver.cit.gvsig.gui.WizardPanel#removeWizardListener(com.iver.cit.gvsig.gui.wizards.WizardListener)
|
412 |
*/
|
413 |
public void removeWizardListener(WizardListener listener) { |
414 |
// TODO Auto-generated method stub
|
415 |
super.removeWizardListener(listener);
|
416 |
} |
417 |
//**********************End Methods***************************
|
418 |
|
419 |
//**********************Getters & Setters*********************
|
420 |
/* (non-Javadoc)
|
421 |
* @see com.iver.cit.gvsig.gui.WizardPanel#setTabName(java.lang.String)
|
422 |
*/
|
423 |
protected void setTabName(String name) { |
424 |
// TODO Auto-generated method stub
|
425 |
super.setTabName(name);
|
426 |
} |
427 |
|
428 |
/* (non-Javadoc)
|
429 |
* @see com.iver.cit.gvsig.gui.WizardPanel#getLayer()
|
430 |
*/
|
431 |
public FLayer getLayer() {
|
432 |
if(lyrGeoRaster != null) |
433 |
return lyrGeoRaster;
|
434 |
return null; |
435 |
} |
436 |
|
437 |
/* (non-Javadoc)
|
438 |
* @see com.iver.cit.gvsig.gui.WizardPanel#getTabName()
|
439 |
*/
|
440 |
public String getTabName() { |
441 |
return PluginServices.getText(this, "georef"); |
442 |
} |
443 |
|
444 |
/**
|
445 |
* @return Returns the fName.
|
446 |
*/
|
447 |
public String getLyrName() { |
448 |
return lyrName;
|
449 |
} |
450 |
|
451 |
/**
|
452 |
* @param name The fName to set.
|
453 |
*/
|
454 |
public void setLyrName(String name) { |
455 |
lyrName = name; |
456 |
} |
457 |
|
458 |
/**
|
459 |
* This method initializes jPanel
|
460 |
*
|
461 |
* @return javax.swing.JPanel
|
462 |
*/
|
463 |
private JPanel getPCheckUseGeoref() { |
464 |
if (pCheckUseGeoref == null) { |
465 |
FlowLayout flowLayout1 = new FlowLayout(); |
466 |
flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
467 |
lUseGeoref = new JLabel(); |
468 |
pCheckUseGeoref = new JPanel(); |
469 |
pCheckUseGeoref.setLayout(flowLayout1); |
470 |
pCheckUseGeoref.setPreferredSize(new java.awt.Dimension(370,31)); |
471 |
lUseGeoref.setText("Usar georeferenciaci?n de la imagen");
|
472 |
pCheckUseGeoref.add(getCbUseGeoref(), null);
|
473 |
pCheckUseGeoref.add(lUseGeoref, null);
|
474 |
} |
475 |
return pCheckUseGeoref;
|
476 |
} |
477 |
|
478 |
/**
|
479 |
* This method initializes jCheckBox
|
480 |
*
|
481 |
* @return javax.swing.JCheckBox
|
482 |
*/
|
483 |
private JCheckBox getCbUseGeoref() { |
484 |
if (cbUseGeoref == null) { |
485 |
cbUseGeoref = new JCheckBox(); |
486 |
cbUseGeoref.setSelected(false);
|
487 |
} |
488 |
return cbUseGeoref;
|
489 |
} |
490 |
|
491 |
/**
|
492 |
* @return Returns the lyrRaster.
|
493 |
*/
|
494 |
public FLyrGeoRaster getFLyrGeoRaster() {
|
495 |
return lyrGeoRaster;
|
496 |
} |
497 |
|
498 |
/**
|
499 |
* @param lyrRaster The lyrRaster to set.
|
500 |
*/
|
501 |
public void setFLyrGeoRaster(FLyrGeoRaster lyrGeoRaster) { |
502 |
this.lyrGeoRaster = lyrGeoRaster;
|
503 |
} |
504 |
|
505 |
/**
|
506 |
* This method initializes jPanel
|
507 |
*
|
508 |
* @return javax.swing.JPanel
|
509 |
*/
|
510 |
private JPanel getPGeneral() { |
511 |
if (pGeneral == null) { |
512 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
513 |
gridBagConstraints1.insets = new java.awt.Insets(5,0,0,0); |
514 |
gridBagConstraints1.gridy = 1;
|
515 |
gridBagConstraints1.gridx = 0;
|
516 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
517 |
gridBagConstraints.insets = new java.awt.Insets(0,0,2,0); |
518 |
gridBagConstraints.gridy = 0;
|
519 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; |
520 |
gridBagConstraints.gridx = 0;
|
521 |
pGeneral = new JPanel(); |
522 |
pGeneral.setLayout(new GridBagLayout()); |
523 |
pGeneral.setPreferredSize(new java.awt.Dimension(750,320)); |
524 |
gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTH; |
525 |
pGeneral.add(getPFileSelection(), gridBagConstraints); |
526 |
pGeneral.add(getPControls(), gridBagConstraints1); |
527 |
} |
528 |
return pGeneral;
|
529 |
} |
530 |
|
531 |
/**
|
532 |
* This method initializes jPanel
|
533 |
*
|
534 |
* @return javax.swing.JPanel
|
535 |
*/
|
536 |
private JPanel getPFileSelection() { |
537 |
if (pFileSelection == null) { |
538 |
FlowLayout flowLayout = new FlowLayout(); |
539 |
flowLayout.setVgap(10);
|
540 |
pFileSelection = new JPanel(); |
541 |
pFileSelection.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this,"cargar"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
542 |
pFileSelection.setLayout(flowLayout); |
543 |
pFileSelection.setPreferredSize(new java.awt.Dimension(475,70)); |
544 |
pFileSelection.add(getTFile(), null);
|
545 |
pFileSelection.add(getBSelectFile(), null);
|
546 |
} |
547 |
return pFileSelection;
|
548 |
} |
549 |
|
550 |
private JPanel getPControls() { |
551 |
if (pControls == null) { |
552 |
GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
553 |
GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
554 |
gridBagConstraints2.gridx = 0;
|
555 |
gridBagConstraints2.gridy = 1;
|
556 |
pControls = new JPanel(); |
557 |
pControls.setLayout(new GridBagLayout()); |
558 |
pControls.setPreferredSize(new java.awt.Dimension(475,200)); |
559 |
pControls.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
560 |
gridBagConstraints11.gridx = 0;
|
561 |
gridBagConstraints11.gridy = 0;
|
562 |
pControls.add(getPCheckUseGeoref(), gridBagConstraints11); |
563 |
pControls.add(getPProyection(), gridBagConstraints2); |
564 |
} |
565 |
return pControls;
|
566 |
} |
567 |
|
568 |
/**
|
569 |
* This method initializes jTextField
|
570 |
*
|
571 |
* @return javax.swing.JTextField
|
572 |
*/
|
573 |
private JTextField getTFile() { |
574 |
if (tFile == null) { |
575 |
tFile = new JTextField(); |
576 |
tFile.setPreferredSize(new java.awt.Dimension(350,25)); |
577 |
} |
578 |
return tFile;
|
579 |
} |
580 |
|
581 |
/**
|
582 |
* This method initializes jButton
|
583 |
*
|
584 |
* @return javax.swing.JButton
|
585 |
*/
|
586 |
private JButton getBSelectFile() { |
587 |
if (bSelectFile == null) { |
588 |
bSelectFile = new JButton(); |
589 |
bSelectFile.setText(PluginServices.getText(this, "cargar")); |
590 |
} |
591 |
return bSelectFile;
|
592 |
} |
593 |
|
594 |
/**
|
595 |
* This method initializes jPanel
|
596 |
*
|
597 |
* @return javax.swing.JPanel
|
598 |
*/
|
599 |
private CRSSelectPanel getPProyection() {
|
600 |
if (pProyection == null) { |
601 |
pProyection = CRSSelectPanel.getPanel(GeoreferencingDialog.getLastProjection()); |
602 |
pProyection.addActionListener(new java.awt.event.ActionListener() {
|
603 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
604 |
if (pProyection.isOkPressed()) {
|
605 |
FOpenDialog.setLastProjection(pProyection.getCurProj()); |
606 |
} |
607 |
} |
608 |
}); |
609 |
} |
610 |
return pProyection;
|
611 |
} |
612 |
//**********************End Getters & Setters*****************
|
613 |
} |
614 |
|