svn-gvsig-desktop / tags / v1_0_2_Build_904 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / dialog / GeoreferencingDialog.java @ 10724
History | View | Annotate | Download (43.6 KB)
1 | 5818 | nacho | /* 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.gui.dialog; |
||
20 | |||
21 | import java.awt.BorderLayout; |
||
22 | import java.awt.Component; |
||
23 | import java.awt.Dimension; |
||
24 | import java.awt.FlowLayout; |
||
25 | import java.awt.event.ActionListener; |
||
26 | import java.awt.event.ComponentEvent; |
||
27 | import java.awt.event.ComponentListener; |
||
28 | import java.awt.geom.Point2D; |
||
29 | import java.awt.geom.Rectangle2D; |
||
30 | import java.beans.PropertyVetoException; |
||
31 | import java.io.File; |
||
32 | |||
33 | import javax.swing.JButton; |
||
34 | import javax.swing.JCheckBox; |
||
35 | import javax.swing.JFileChooser; |
||
36 | import javax.swing.JInternalFrame; |
||
37 | import javax.swing.JOptionPane; |
||
38 | import javax.swing.JPanel; |
||
39 | 6214 | nacho | import javax.swing.JToggleButton; |
40 | 5818 | nacho | import javax.swing.filechooser.FileFilter; |
41 | import javax.swing.table.DefaultTableModel; |
||
42 | |||
43 | import org.cresques.cts.IProjection; |
||
44 | import org.cresques.px.Extent; |
||
45 | import org.gvsig.georeferencing.GeoOperations; |
||
46 | import org.gvsig.georeferencing.gui.listeners.GeoRasterFrameListener; |
||
47 | import org.gvsig.georeferencing.gui.listeners.GeorefMovePointListener; |
||
48 | import org.gvsig.georeferencing.gui.listeners.GeorefPanListener; |
||
49 | import org.gvsig.georeferencing.gui.listeners.GeorefPointSelectorListener; |
||
50 | import org.gvsig.georeferencing.gui.listeners.ZoomGeorefListener; |
||
51 | import org.gvsig.georeferencing.gui.panels.ConectorPanel; |
||
52 | import org.gvsig.georeferencing.gui.panels.OptionsPanel; |
||
53 | import org.gvsig.georeferencing.gui.panels.ZoomControlPanel; |
||
54 | import org.gvsig.georeferencing.gui.pointsTable.TablePointsPanel; |
||
55 | import org.gvsig.georeferencing.gui.pointsTable.TablePointsPanel.PointTable; |
||
56 | import org.gvsig.georeferencing.gui.selectPoints.SelectPointsPanel; |
||
57 | import org.gvsig.georeferencing.toc.GeoRasterTocMenuEntry; |
||
58 | import org.gvsig.georeferencing.utils.GeoLayerFactory; |
||
59 | import org.gvsig.georeferencing.utils.GeoPointPersistence; |
||
60 | import org.gvsig.georeferencing.utils.GeoUtils; |
||
61 | import org.gvsig.georeferencing.utils.PointManager; |
||
62 | import org.gvsig.georeferencing.utils.StackZoom; |
||
63 | |||
64 | import com.iver.andami.PluginServices; |
||
65 | import com.iver.cit.gvsig.fmap.DriverException; |
||
66 | import com.iver.cit.gvsig.fmap.MapControl; |
||
67 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
68 | import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
||
69 | import com.iver.cit.gvsig.fmap.layers.FLayers; |
||
70 | import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster; |
||
71 | import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
||
72 | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
||
73 | import com.iver.cit.gvsig.fmap.layers.IGeoUi; |
||
74 | import com.iver.cit.gvsig.fmap.layers.RasterFileAdapter; |
||
75 | import com.iver.cit.gvsig.fmap.tools.ZoomOutRightButtonListener; |
||
76 | import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior; |
||
77 | import com.iver.cit.gvsig.fmap.tools.Behavior.DraggedBehavior; |
||
78 | import com.iver.cit.gvsig.fmap.tools.Behavior.GeoMoveBehavior; |
||
79 | import com.iver.cit.gvsig.fmap.tools.Behavior.GeoRedimBehavior; |
||
80 | import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
||
81 | import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
||
82 | import com.iver.cit.gvsig.gui.wizards.WizardListener; |
||
83 | import com.iver.cit.gvsig.project.Project; |
||
84 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.documents.view.gui.View; |
85 | import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener; |
||
86 | 5818 | nacho | |
87 | /**
|
||
88 | * Panel que contiene el Wizard de georeferenciaci?n con los tabs
|
||
89 | * interiores
|
||
90 | *
|
||
91 | * @author Nacho Brodin (brodin_ign@gva.es)
|
||
92 | */
|
||
93 | public class GeoreferencingDialog extends JPanel implements IGeoUi, ActionListener, ComponentListener { |
||
94 | 6641 | caballero | |
95 | 5818 | nacho | //**********************Vars**********************************
|
96 | 8765 | jjdelcerro | static private IProjection proj = Project.getDefaultProjection(); |
97 | 5818 | nacho | private JPanel pBotones = null; // @jve:decl-index=0: |
98 | private JButton bProcesar = null; // @jve:decl-index=0: |
||
99 | private JButton bCancelar = null; // @jve:decl-index=0: |
||
100 | private WizardListener wizardListener = new DialogWizardListener(); |
||
101 | private GeoRedimBehavior rb = null; |
||
102 | private GeoMoveBehavior mb = null; |
||
103 | private boolean loadTools = false; |
||
104 | private JInternalFrame frame = null; |
||
105 | /**
|
||
106 | * Lista de formatos soportados
|
||
107 | */
|
||
108 | private String[] fileFilters = {"csv"}; |
||
109 | /**
|
||
110 | * Recuerda la ?ltima ruta seleccionada por el usuario
|
||
111 | */
|
||
112 | private String lastPathLoad = "./"; |
||
113 | private String lastPathSave = "./"; |
||
114 | private ConectorPanel conectorPanel = null; |
||
115 | 6641 | caballero | |
116 | 5818 | nacho | private boolean enlarge = false; |
117 | private int normalWidth = 400; |
||
118 | private int normalHeight = 273; |
||
119 | 7091 | nacho | private int enlargeHeight = 448; |
120 | 5818 | nacho | private int tmpWidth = normalWidth; |
121 | 6641 | caballero | |
122 | 5818 | nacho | private JButton bAceptar = null; |
123 | 6641 | caballero | |
124 | 5818 | nacho | private FLyrGeoRaster lyrGeoRaster = null; |
125 | private TablePointsPanel tablePointsPanel = null; |
||
126 | private PointManager pointManager = null; |
||
127 | /**
|
||
128 | * True si ha de crearse un fichero de georreferenciaci?n
|
||
129 | */
|
||
130 | 8765 | jjdelcerro | private boolean createWorldFile = true; |
131 | 5818 | nacho | /**
|
132 | * True si los errores han de incluirse en el fichero csv
|
||
133 | */
|
||
134 | private boolean errorCSV = true; |
||
135 | /**
|
||
136 | * Estado de los botones cuando se ejecuta disableAllControls
|
||
137 | */
|
||
138 | private boolean[] buttonsState = new boolean[7]; |
||
139 | /**
|
||
140 | * DisableAllControls ha sido ejecutada si est? a true esta variabled
|
||
141 | */
|
||
142 | private boolean disableAllControls = false; |
||
143 | /**
|
||
144 | * Variable que controla si la capa de georreferenciaci?n se ha de desactivar
|
||
145 | * despu?s del primer punto.
|
||
146 | */
|
||
147 | private boolean offLayer = true; |
||
148 | /**
|
||
149 | * Variable que controla si la vista ha de centrarse sobre el punto seleccionado
|
||
150 | * o no
|
||
151 | */
|
||
152 | private boolean centerPoint = true; |
||
153 | /**
|
||
154 | * Variable que controla si la capa de puntos se ha de desactivar
|
||
155 | * despu?s del primer punto.
|
||
156 | */
|
||
157 | private boolean offPoints = true; |
||
158 | /**
|
||
159 | * Panel que contiene los botones de la barra inferior
|
||
160 | */
|
||
161 | private DialogButtons dialogButtons = null; |
||
162 | 6641 | caballero | //**********************End Vars******************************
|
163 | |||
164 | 5818 | nacho | //**********************Classes*******************************
|
165 | /**
|
||
166 | * Filtro para selecci?n de ficheros.
|
||
167 | * @author Nacho Brodin (brodin_ign@gva.es)
|
||
168 | */
|
||
169 | class SelectFileFilter extends javax.swing.filechooser.FileFilter { |
||
170 | 6641 | caballero | |
171 | 5818 | nacho | private JFileChooser chooser = null; |
172 | private String file = null; |
||
173 | 6641 | caballero | |
174 | 5818 | nacho | public SelectFileFilter(JFileChooser ch, String file){ |
175 | this.chooser = ch;
|
||
176 | this.file = file;
|
||
177 | } |
||
178 | 6641 | caballero | |
179 | 5818 | nacho | public boolean accept(File f) { |
180 | |||
181 | return f.isDirectory() || f.getName().toLowerCase().endsWith("."+file); |
||
182 | } |
||
183 | 6641 | caballero | |
184 | 5818 | nacho | public String getDescription() { |
185 | return file;
|
||
186 | } |
||
187 | 6641 | caballero | |
188 | 5818 | nacho | } |
189 | 6641 | caballero | |
190 | 5818 | nacho | /**
|
191 | * @author Nacho Brodin (brodin_ign@gva.es)
|
||
192 | */
|
||
193 | public class DialogWizardListener implements WizardListener { |
||
194 | |||
195 | /**
|
||
196 | * @see org.gvsig.georeferencing.gui.wms.WizardListener#error(java.lang.Exception)
|
||
197 | */
|
||
198 | public void error(Exception e) { |
||
199 | } |
||
200 | |||
201 | /**
|
||
202 | * @see org.gvsig.georeferencing.gui.wms.WizardListener#wizardStateChanged(boolean)
|
||
203 | */
|
||
204 | public void wizardStateChanged(boolean finishable) { |
||
205 | getBProcess().setEnabled(finishable); |
||
206 | } |
||
207 | 6641 | caballero | |
208 | 5818 | nacho | } |
209 | //**********************End Classes***************************
|
||
210 | 6641 | caballero | |
211 | 5818 | nacho | //**********************Methods*******************************
|
212 | /**
|
||
213 | * Constructor.
|
||
214 | */
|
||
215 | public GeoreferencingDialog(JInternalFrame f, FLyrGeoRaster lyr) { |
||
216 | frame = f; |
||
217 | lyrGeoRaster = lyr; |
||
218 | 6641 | caballero | |
219 | 5818 | nacho | frame.addComponentListener(this);
|
220 | initialize(); |
||
221 | 6641 | caballero | |
222 | 5818 | nacho | //Creamos el pointManager y lo asignamos a la capa de puntos
|
223 | pointManager = new PointManager(this, lyrGeoRaster.getFLyrPoints()); |
||
224 | this.lyrGeoRaster.getFLyrPoints().setPointManager(pointManager);
|
||
225 | 6641 | caballero | |
226 | 5818 | nacho | //En estos casos entra cuando la capa se crea al abrir un proyecto
|
227 | if(lyrGeoRaster.getPersistence() == null){ |
||
228 | lyrGeoRaster.setPersistence(new GeoPointPersistence(lyrGeoRaster.getFLyrPoints()));
|
||
229 | f.addInternalFrameListener(new GeoRasterFrameListener());
|
||
230 | GeoRasterTocMenuEntry.isOpen = true;
|
||
231 | } |
||
232 | if(lyrGeoRaster.getStackZoom() == null) |
||
233 | lyrGeoRaster.setZoom(new StackZoom());
|
||
234 | 6641 | caballero | |
235 | 5818 | nacho | } |
236 | 6641 | caballero | |
237 | 5818 | nacho | /**
|
238 | 6641 | caballero | * En la inicializaci?n de la ventana a?adimos los tags de est? y cargamos
|
239 | 5818 | nacho | * ls herramientas para manejar las imagenes a georeferenciar.
|
240 | */
|
||
241 | private void initialize() { |
||
242 | //Cargamos las herramientas la primera vez que abrimos la ventana
|
||
243 | if(!loadTools){
|
||
244 | 8765 | jjdelcerro | com.iver.cit.gvsig.project.documents.view.gui.View vista = null;
|
245 | 5818 | nacho | try{
|
246 | 8765 | jjdelcerro | vista = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow(); |
247 | 5818 | nacho | }catch(ClassCastException exc){ |
248 | return;
|
||
249 | } |
||
250 | 6641 | caballero | |
251 | 5818 | nacho | MapControl mapCtrl = null;
|
252 | if(vista != null) |
||
253 | mapCtrl = vista.getMapControl(); |
||
254 | |||
255 | if(mapCtrl != null){ |
||
256 | loadTools = true;
|
||
257 | StatusBarListener sbl = new StatusBarListener(mapCtrl);
|
||
258 | 6641 | caballero | |
259 | 5818 | nacho | ZoomOutRightButtonListener zoil = new ZoomOutRightButtonListener(mapCtrl);
|
260 | ZoomGeorefListener zigl = new ZoomGeorefListener(mapCtrl);
|
||
261 | rb = new GeoRedimBehavior(zigl);
|
||
262 | mapCtrl.addMapTool("geoZoom", new Behavior[]{rb, |
||
263 | new PointBehavior(zoil), new MouseMovementBehavior(sbl)}); |
||
264 | 6641 | caballero | |
265 | 5818 | nacho | GeorefPanListener pl = new GeorefPanListener(mapCtrl);
|
266 | mb = new GeoMoveBehavior(pl);
|
||
267 | mapCtrl.addMapTool("geoPan", new Behavior[]{mb, new MouseMovementBehavior(sbl)}); |
||
268 | 6641 | caballero | |
269 | 5818 | nacho | //Seleccion de un punto sobre la vista
|
270 | GeorefPointSelectorListener psl = new GeorefPointSelectorListener(this); |
||
271 | mapCtrl.addMapTool("pointLyrSelection", new Behavior[]{new PointBehavior(psl), new MouseMovementBehavior(sbl)}); |
||
272 | 6641 | caballero | |
273 | 5818 | nacho | GeorefMovePointListener mpl = new GeorefMovePointListener(this); |
274 | mapCtrl.addMapTool("geoMovePoint", new Behavior[]{new DraggedBehavior(mpl), new MouseMovementBehavior(sbl)}); |
||
275 | } |
||
276 | } |
||
277 | 6641 | caballero | |
278 | 5818 | nacho | this.setLayout(new BorderLayout()); |
279 | if(!enlarge){
|
||
280 | this.setPreferredSize(new java.awt.Dimension(normalWidth, normalHeight)); |
||
281 | 7091 | nacho | this.setSize(new java.awt.Dimension(normalWidth, normalHeight)); |
282 | 5818 | nacho | this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(false); |
283 | this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(false); |
||
284 | }else{
|
||
285 | this.setPreferredSize(new java.awt.Dimension(normalWidth, enlargeHeight)); |
||
286 | this.setSize(new java.awt.Dimension(normalWidth, enlargeHeight)); |
||
287 | this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setVisible(true); |
||
288 | this.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setVisible(true); |
||
289 | } |
||
290 | this.setLocation(new java.awt.Point(0,0)); |
||
291 | 6641 | caballero | |
292 | 5818 | nacho | this.add(this.getPBotones(), BorderLayout.SOUTH); |
293 | 6641 | caballero | this.add(this.getConectorPanel(), BorderLayout.NORTH); |
294 | |||
295 | 5818 | nacho | //A?adimos los listener de los botones de la tabla
|
296 | //Los botones de borrado los gestiona SelectPointsPanel
|
||
297 | //Los botones de cargar y exportar los gestiona GeoreferencigDialog
|
||
298 | 6641 | caballero | tablePointsPanel = getConectorPanel().getDataPointsTabPanel().getTablePointsPanel(); |
299 | 5818 | nacho | tablePointsPanel.getTableControlerPanel().getBClear().addActionListener(this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel());
|
300 | tablePointsPanel.getTableControlerPanel().getBDelPoint().addActionListener(this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel());
|
||
301 | 6641 | caballero | |
302 | 5818 | nacho | getDialogButtons().getBExportToCSV().addActionListener(this);
|
303 | getDialogButtons().getBImportFromCSV().addActionListener(this);
|
||
304 | getDialogButtons().getBLoad().addActionListener(this);
|
||
305 | getDialogButtons().getBSave().addActionListener(this);
|
||
306 | 6641 | caballero | |
307 | 5818 | nacho | conectorPanel.getDataPointsTabPanel().getSelectPointsPanel().getDataPointPanel().getCbActive().addActionListener(this);
|
308 | getBInsertPointOfTablePoints().addActionListener(conectorPanel.getDataPointsTabPanel().getSelectPointsPanel()); |
||
309 | getBNewPointOfTablePoints().addActionListener(conectorPanel.getDataPointsTabPanel().getSelectPointsPanel()); |
||
310 | } |
||
311 | 6641 | caballero | |
312 | 5818 | nacho | /**
|
313 | * Comprueba si existe el fichero pasado por par?metro existe solicitando confirmaci?n
|
||
314 | * de sobreescritura. Si el usuario acepta devolver? true y si no acepta devuelve false.
|
||
315 | 6641 | caballero | * Si se acepta la sobreescritura el fichero es borrado.
|
316 | 5818 | nacho | * @param file Cadena con el nombre del fichero a comprobar su existencia.
|
317 | * @return Devuelve true si el fichero existe y va a ser sobreescrito
|
||
318 | */
|
||
319 | public boolean checkFileExists(String file, boolean delete){ |
||
320 | File f = new File(file); |
||
321 | if(f.exists()){
|
||
322 | 6641 | caballero | if (messageBoxYesOrNot("file_exists")){ |
323 | 5818 | nacho | if(delete)
|
324 | f.delete(); |
||
325 | return true; |
||
326 | }else
|
||
327 | return false; |
||
328 | } |
||
329 | return true; |
||
330 | } |
||
331 | 6641 | caballero | |
332 | 5818 | nacho | /**
|
333 | * MessageBox con dos botones (OK y Cancel) que mostrar? el mensaje pasado por
|
||
334 | 6641 | caballero | * par?metro
|
335 | 5818 | nacho | * @param msg Mensaje a mostrar
|
336 | * @return true si el usuario pulsa Ok y false si pulsa Cancel
|
||
337 | */
|
||
338 | public boolean messageBoxYesOrNot(String msg){ |
||
339 | String string1 = PluginServices.getText(this, "yes"); |
||
340 | String string2 = PluginServices.getText(this, "no"); |
||
341 | Object[] options = {string1, string2}; |
||
342 | int n = JOptionPane.showOptionDialog((Component)PluginServices.getMainFrame(), |
||
343 | PluginServices.getText(this, msg),
|
||
344 | PluginServices.getText(this, "confirmacion"), |
||
345 | JOptionPane.YES_NO_OPTION,
|
||
346 | JOptionPane.QUESTION_MESSAGE,
|
||
347 | 6641 | caballero | null,
|
348 | options, |
||
349 | string1); |
||
350 | if (n == JOptionPane.YES_OPTION) |
||
351 | 5818 | nacho | return true; |
352 | else
|
||
353 | return false; |
||
354 | } |
||
355 | 6641 | caballero | |
356 | 5818 | nacho | /**
|
357 | * Acci?n cuando se pulsa el bot?n de aceptar en el dialogo.
|
||
358 | * <UL>
|
||
359 | * <LI>Cambiamos el nombre a la capa georraster</LI>
|
||
360 | * <LI>A la capa Georraster le asignamos la capa de puntos para poder recuperarla</LI>
|
||
361 | * <LI>Cerramos la ventana</LI>
|
||
362 | * </UL>
|
||
363 | */
|
||
364 | public void actionPerformed(java.awt.event.ActionEvent e) { |
||
365 | 8765 | jjdelcerro | com.iver.cit.gvsig.project.documents.view.gui.View theView = null;
|
366 | 5818 | nacho | try{
|
367 | 8765 | jjdelcerro | theView = (com.iver.cit.gvsig.project.documents.view.gui.View) PluginServices.getMDIManager().getActiveWindow(); |
368 | 5818 | nacho | }catch(ClassCastException exc){ |
369 | return;
|
||
370 | } |
||
371 | |||
372 | try{
|
||
373 | 6641 | caballero | //ACEPTAR
|
374 | 5818 | nacho | if(e.getSource() == bAceptar)
|
375 | 6641 | caballero | accept(theView); |
376 | |||
377 | 5818 | nacho | //CANCELAR
|
378 | if(e.getSource() == bCancelar)
|
||
379 | cancel(theView); |
||
380 | 6641 | caballero | |
381 | 5818 | nacho | //CARGAR PUNTOS
|
382 | if(e.getSource() == getDialogButtons().getBLoad())
|
||
383 | loadPoints(theView); |
||
384 | 6641 | caballero | |
385 | 5818 | nacho | //SALVAR PUNTOS
|
386 | if(e.getSource() == getDialogButtons().getBSave())
|
||
387 | 6641 | caballero | savePoints(); |
388 | |||
389 | 5818 | nacho | //EXPORTAR A CSV
|
390 | if(e.getSource() == getDialogButtons().getBExportToCSV())
|
||
391 | 6641 | caballero | exportToCSV(theView); |
392 | |||
393 | 5818 | nacho | //IMPORTAR DESDE CSV
|
394 | if(e.getSource() == getDialogButtons().getBImportFromCSV())
|
||
395 | importFromCSV(theView); |
||
396 | 6641 | caballero | |
397 | 5818 | nacho | //DESACTIVAR PANELES
|
398 | JCheckBox cb = this.conectorPanel.getDataPointsTabPanel().getSelectPointsPanel().getDataPointPanel().getCbActive(); |
||
399 | if(e.getSource() == cb)
|
||
400 | deactivatePanel(theView, cb); |
||
401 | 6641 | caballero | |
402 | 5818 | nacho | //PROCESAR
|
403 | if(e.getSource() == this.getBProcess()) |
||
404 | process(theView); |
||
405 | }catch(Exception exc){ |
||
406 | exc.printStackTrace(); |
||
407 | 6641 | caballero | return;
|
408 | } |
||
409 | 5818 | nacho | } |
410 | 6641 | caballero | |
411 | 5818 | nacho | /**
|
412 | * Cierra el dialogo
|
||
413 | */
|
||
414 | public void close(){ |
||
415 | try{
|
||
416 | frame.setClosed(true);
|
||
417 | }catch(PropertyVetoException exc){} |
||
418 | } |
||
419 | 6641 | caballero | |
420 | 5818 | nacho | /**
|
421 | * Funci?n que se ejecuta al pulsar el bot?n procesar. Este procesamiento calcula a partir de
|
||
422 | * los puntos de control la georreferenciaci?n de la imagen y la asigna como extent temporal de
|
||
423 | * la capa FLyrGeoRaster. Cuando termina actualiza la visualizaci?n.
|
||
424 | * @param theView
|
||
425 | */
|
||
426 | private void process(View theView)throws Exception{ |
||
427 | if(getLyrPoints() == null) |
||
428 | throw new Exception("LyrPoints not loaded."); |
||
429 | 6641 | caballero | |
430 | 5818 | nacho | if(this.getLyrPoints().getCountPoints() > 0){ |
431 | 6641 | caballero | |
432 | 5818 | nacho | //Salvamos los centros
|
433 | Point2D[] oldCenter = new Point2D.Double[lyrGeoRaster.getFLyrPoints().getCountPoints()]; |
||
434 | for(int i=0; i<lyrGeoRaster.getFLyrPoints().getCountPoints(); i++) |
||
435 | oldCenter[i] = lyrGeoRaster.img2World(lyrGeoRaster.getFLyrPoints().getPoint(i).pixelPoint); |
||
436 | 6641 | caballero | |
437 | 5818 | nacho | //Calculamos las coordenadas de georreferenciaci?n
|
438 | GeoOperations go = new GeoOperations(getLyrPoints());
|
||
439 | 8765 | jjdelcerro | |
440 | 5818 | nacho | double[] begin = go.transformPoint(0, 0, go.getAffine()); |
441 | double[] end = go.transformPoint((int)lyrGeoRaster.getImageWidth(), (int)lyrGeoRaster.getImageHeight(), go.getAffine()); |
||
442 | Extent ext = new Extent(begin[0], begin[1], end[0], end[1]); |
||
443 | 6641 | caballero | |
444 | 5818 | nacho | //Asignamos el extent temporal a la capa de georreferenciaci?n
|
445 | ViewPort vp = theView.getMapControl().getMapContext().getViewPort(); |
||
446 | ((FLyrGeoRaster)theView.getMapControl().getMapContext().getLayers().getLayer(lyrGeoRaster.getName())).setAssignExtent(ext); |
||
447 | 6641 | caballero | |
448 | //Si la capa tiene puntos de control hacemos un update de estos
|
||
449 | 5818 | nacho | //a su posici?n para que se actualicen los controles
|
450 | 6641 | caballero | |
451 | 5818 | nacho | for(int i=0; i<lyrGeoRaster.getFLyrPoints().getCountPoints(); i++){ |
452 | Point2D center = lyrGeoRaster.img2World(lyrGeoRaster.getFLyrPoints().getPoint(i).pixelPoint);
|
||
453 | lyrGeoRaster.getFLyrPoints().setMiniExtent( i, |
||
454 | center, |
||
455 | GeoUtils.shiftExtent(oldCenter[i], center, getLyrPoints().getMiniExtent(i, false)),
|
||
456 | false);
|
||
457 | if(i == getSelectedPoint())
|
||
458 | updateData(i + 1, lyrGeoRaster.getFLyrPoints().getPoint(i).pixelPoint, null, null); |
||
459 | } |
||
460 | theView.getMapControl().getMapContext().invalidate(); |
||
461 | } |
||
462 | } |
||
463 | 6641 | caballero | |
464 | 5818 | nacho | /**
|
465 | * Funci?n que se ejecuta al pulsar el bot?n aceptar. Este procesamiento calcula a partir de
|
||
466 | * los puntos de control la georreferenciaci?n de la imagen, crear el fichero .rmf de georreferenciaci?n
|
||
467 | * y descarga la capa del TOC. A continuaci?n vuelve a cargar la capa como FLyrRaster dando
|
||
468 | 6641 | caballero | * por finalizada la georreferenciaci?n.
|
469 | 5818 | nacho | * @param theView
|
470 | */
|
||
471 | private void accept(View theView)throws Exception{ |
||
472 | if(getLyrPoints() == null) |
||
473 | throw new Exception("LyrPoints not loaded."); |
||
474 | 6641 | caballero | |
475 | 5818 | nacho | if(this.getLyrPoints().getCountPoints() > 0){ |
476 | savePoints(); |
||
477 | 6641 | caballero | |
478 | 5818 | nacho | //Creamos el fichero de georreferenciaci?n
|
479 | GeoOperations go = new GeoOperations(getLyrPoints());
|
||
480 | go.setCreateWorldFile(this.createWorldFile);
|
||
481 | 6641 | caballero | go.createGeorefFile( (int)getLyrGeoRaster().getImageWidth(),
|
482 | 5818 | nacho | (int)getLyrGeoRaster().getImageHeight(),
|
483 | getLyrGeoRaster().getSource().getFiles()[0].getName());
|
||
484 | 6641 | caballero | |
485 | FLayers lyrs = this.getLyrGeoRaster().getParentLayer();
|
||
486 | |||
487 | 5818 | nacho | for(int i = 0; i < lyrs.getLayersCount();i++){ |
488 | if(this.getLyrGeoRaster().getName().equals(lyrs.getLayer(i).getName())){ |
||
489 | 6641 | caballero | |
490 | 5818 | nacho | //Eliminamos la capa
|
491 | lyrs.removeLayer(i); |
||
492 | File fich = new File(getLyrGeoRaster().getSource().getFiles()[0].getName()); |
||
493 | try{
|
||
494 | 6641 | caballero | //Creamos la nueva capa GeoRaster y la a?adimos al TOC.
|
495 | 5818 | nacho | FLyrRaster lyrRaster = GeoLayerFactory.createLayer(getLyrGeoRaster().getName().substring(1, getLyrGeoRaster().getName().length()),
|
496 | 6641 | caballero | (RasterDriver)getLyrGeoRaster().getSource().getDriver(), |
497 | 5818 | nacho | fich, |
498 | getLyrGeoRaster().getProjection()); |
||
499 | lyrs.addLayer(lyrRaster); |
||
500 | theView.getMapControl().getMapContext().invalidate(); |
||
501 | }catch(DriverException exc){
|
||
502 | 6641 | caballero | |
503 | 5818 | nacho | } |
504 | break;
|
||
505 | } |
||
506 | } |
||
507 | } |
||
508 | //Cerramos la ventana
|
||
509 | try{
|
||
510 | frame.setClosed(true);
|
||
511 | }catch(PropertyVetoException exc){} |
||
512 | 6641 | caballero | |
513 | 5818 | nacho | } |
514 | 6641 | caballero | |
515 | 5818 | nacho | /**
|
516 | * Funci?n que se ejecuta al pulsar el bot?n cancelar
|
||
517 | * @param theView
|
||
518 | */
|
||
519 | private void cancel(View theView)throws Exception{ |
||
520 | if(getLyrPoints() == null) |
||
521 | throw new Exception("LyrPoints not loaded."); |
||
522 | 6641 | caballero | |
523 | //Cerramos la ventana
|
||
524 | 5818 | nacho | //(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener)
|
525 | try{
|
||
526 | frame.setClosed(true);
|
||
527 | theView.getMapControl().getMapContext().invalidate(); |
||
528 | }catch(PropertyVetoException exc){} |
||
529 | } |
||
530 | 6641 | caballero | |
531 | 5818 | nacho | /**
|
532 | 6641 | caballero | * Funci?n que se ejecuta al pulsar el bot?n de cargar puntos
|
533 | 5818 | nacho | * @param theView
|
534 | */
|
||
535 | 6641 | caballero | private void loadPoints(View theView)throws Exception{ |
536 | 5818 | nacho | if(getLyrPoints() == null) |
537 | throw new Exception("LyrPoints not loaded."); |
||
538 | 6641 | caballero | |
539 | 5818 | nacho | if(messageBoxYesOrNot("cargar_puntos")){ |
540 | String name = lyrGeoRaster.getName().substring(lyrGeoRaster.getName().indexOf("*") + 1, lyrGeoRaster.getName().lastIndexOf(".")); |
||
541 | String path = ((RasterFileAdapter)lyrGeoRaster.getSource()).getFile().getAbsolutePath();
|
||
542 | String nameRmf = path.substring(0, path.lastIndexOf(File.separator) + 1) + name + ".rmf"; |
||
543 | 6641 | caballero | |
544 | //Antes de cargar puntos plegamos el cuadro
|
||
545 | 5818 | nacho | getSelectPointsPanel().setEnlarge(true);
|
546 | 6641 | caballero | |
547 | 5818 | nacho | getLyrPoints().saveState(); |
548 | getLyrPoints().XML2PointList(nameRmf); |
||
549 | 6641 | caballero | |
550 | //Esto es por si el panel ha sido estirado cuando cargamos los puntos
|
||
551 | 5818 | nacho | frame.pack(); |
552 | frame.show(); |
||
553 | 6641 | caballero | |
554 | 5818 | nacho | //Por problemas con repaint e hilos concurrentes tenemos que poner esto explicitamente
|
555 | //ya que es posible que se haga un paint de las miniimagenes antes de que cleanCanvas vuelva a valer false
|
||
556 | this.getZoomControlLeft().getCanvas().setCleanCanvas(false); |
||
557 | this.getZoomControlRight().getCanvas().setCleanCanvas(false); |
||
558 | 6641 | caballero | |
559 | 5818 | nacho | if(getLyrPoints().getCountPoints() > 0) |
560 | setEnableSaveButtons(true);
|
||
561 | } |
||
562 | } |
||
563 | 6641 | caballero | |
564 | 5818 | nacho | /**
|
565 | * Funci?n usada para salvar puntos
|
||
566 | * @param theView
|
||
567 | */
|
||
568 | public void savePoints()throws Exception{ |
||
569 | if(getLyrPoints() == null) |
||
570 | throw new Exception("LyrPoints not loaded."); |
||
571 | String name = lyrGeoRaster.getName().substring(lyrGeoRaster.getName().indexOf("*") + 1, lyrGeoRaster.getName().lastIndexOf(".")); |
||
572 | String path = ((RasterFileAdapter)lyrGeoRaster.getSource()).getFile().getAbsolutePath();
|
||
573 | String nameRmf = path.substring(0, path.lastIndexOf(File.separator) + 1) + name + ".rmf"; |
||
574 | 6641 | caballero | |
575 | 5818 | nacho | File f = new File(nameRmf); |
576 | if(f.exists()){
|
||
577 | 8765 | jjdelcerro | if (messageBoxYesOrNot(PluginServices.getText(this, "gcps_exist"))){ |
578 | 5818 | nacho | if(getLyrPoints() != null) |
579 | getLyrPoints().PointList2XML( path.substring(0, path.lastIndexOf(File.separator) + 1) + name + ".grf"); |
||
580 | } |
||
581 | }else
|
||
582 | 6641 | caballero | getLyrPoints().PointList2XML( path.substring(0, path.lastIndexOf(File.separator) + 1) + name + ".grf"); |
583 | 5818 | nacho | } |
584 | 6641 | caballero | |
585 | 5818 | nacho | /**
|
586 | * Funci?n que se ejecuta al pulsar el bot?n de export a ascii
|
||
587 | * @param theView
|
||
588 | */
|
||
589 | private void exportToCSV(View theView)throws Exception{ |
||
590 | if(getLyrPoints() == null) |
||
591 | throw new Exception("LyrPoints not loaded."); |
||
592 | 6641 | caballero | |
593 | 5818 | nacho | JFileChooser chooser = new JFileChooser(lastPathSave); |
594 | chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero")); |
||
595 | 6641 | caballero | |
596 | 5818 | nacho | FileFilter f = null; |
597 | for(int i=0; i<this.fileFilters.length;i++){ |
||
598 | f = new SelectFileFilter(chooser, this.fileFilters[i]); |
||
599 | chooser.addChoosableFileFilter(f); |
||
600 | } |
||
601 | int returnVal = chooser.showOpenDialog(this); |
||
602 | if(returnVal == JFileChooser.APPROVE_OPTION){ |
||
603 | String fName = chooser.getSelectedFile().toString();
|
||
604 | 6069 | nacho | if(!fName.endsWith(".csv")) |
605 | fName = fName + ".csv";
|
||
606 | 5818 | nacho | lastPathSave = chooser.getCurrentDirectory().getAbsolutePath(); |
607 | if(checkFileExists(fName, true)){ |
||
608 | if(getLyrPoints() != null) |
||
609 | getLyrPoints().PointList2CSV(fName); |
||
610 | } |
||
611 | 6641 | caballero | } |
612 | 5818 | nacho | } |
613 | 6641 | caballero | |
614 | 5818 | nacho | /**
|
615 | * Funci?n que se ejecuta al pulsar el bot?n de importar desde CSV
|
||
616 | * @param theView
|
||
617 | */
|
||
618 | private void importFromCSV(View theView)throws Exception{ |
||
619 | if(getLyrPoints() == null) |
||
620 | throw new Exception("LyrPoints not loaded."); |
||
621 | 6641 | caballero | |
622 | 5818 | nacho | JFileChooser chooser = new JFileChooser(lastPathSave); |
623 | chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero")); |
||
624 | 6641 | caballero | |
625 | 5818 | nacho | FileFilter f = null; |
626 | for(int i=0; i<this.fileFilters.length;i++){ |
||
627 | f = new SelectFileFilter(chooser, this.fileFilters[i]); |
||
628 | chooser.addChoosableFileFilter(f); |
||
629 | } |
||
630 | int returnVal = chooser.showOpenDialog(this); |
||
631 | if(returnVal == JFileChooser.APPROVE_OPTION){ |
||
632 | String fName = chooser.getSelectedFile().toString();
|
||
633 | lastPathSave = chooser.getCurrentDirectory().getAbsolutePath(); |
||
634 | getLyrPoints().PointListFromCSV(fName); |
||
635 | 6641 | caballero | |
636 | //Antes de cargar puntos plegamos el cuadro
|
||
637 | 5818 | nacho | getSelectPointsPanel().setEnlarge(true);
|
638 | 6641 | caballero | |
639 | 5818 | nacho | //Por problemas con repaint e hilos concurrentes tenemos que poner esto explicitamente
|
640 | //ya que es posible que se haga un paint de las miniimagenes antes de que cleanCanvas vuelva a valer false
|
||
641 | this.getZoomControlLeft().getCanvas().setCleanCanvas(false); |
||
642 | this.getZoomControlRight().getCanvas().setCleanCanvas(false); |
||
643 | 6641 | caballero | |
644 | //Si se han cargado puntos desde el CSV se activan los controles
|
||
645 | 5818 | nacho | if(getLyrPoints().getCountPoints() > 0) |
646 | setEnableSaveButtons(true);
|
||
647 | 6641 | caballero | } |
648 | 5818 | nacho | } |
649 | 6641 | caballero | |
650 | 5818 | nacho | /**
|
651 | * Funci?n que se ejecuta al pulsar el bot?n desactivar panel
|
||
652 | * @param theView
|
||
653 | */
|
||
654 | public void deactivatePanel(View theView, JCheckBox cb)throws Exception{ |
||
655 | if(getLyrPoints() == null) |
||
656 | throw new Exception("LyrPoints not loaded."); |
||
657 | 6641 | caballero | |
658 | 5818 | nacho | //Sincronizamos con el checkBox de la tabla
|
659 | 6641 | caballero | tablePointsPanel.getJTable().getTableModel().setValueAt(new Boolean(cb.isSelected()), |
660 | 5818 | nacho | tablePointsPanel.getJTable().getTable().getSelectedRow(), |
661 | 0);
|
||
662 | 6641 | caballero | |
663 | 5818 | nacho | if(cb.isSelected()){
|
664 | this.setEnabled(true); |
||
665 | getLyrPoints().setPointActive(getSelectedPoint(), true);
|
||
666 | }else{
|
||
667 | this.setEnabled(false); |
||
668 | getLyrPoints().setPointActive(getSelectedPoint(), false);
|
||
669 | } |
||
670 | 6641 | caballero | |
671 | 5818 | nacho | //Al activar y desactivar tenemos que recalcular errores
|
672 | this.getPointManager().setErrors(getSelectedPoint());
|
||
673 | 6641 | caballero | |
674 | 5818 | nacho | theView.getMapControl().getMapContext().invalidate(); |
675 | getZoomControlLeft().draw(); |
||
676 | 6641 | caballero | getZoomControlRight().draw(); |
677 | 5818 | nacho | } |
678 | 6641 | caballero | |
679 | 5818 | nacho | /**
|
680 | * Recalcula el extent de la mini-imagen que corresponde a los puntos en coordenadas
|
||
681 | * pixel.Para esto calcula el nuevo centro a partir de la capa y con la distancia entre
|
||
682 | * el nuevo centro y el viejo desplaza el extent completo de la mini-imagen.
|
||
683 | * @param theView
|
||
684 | */
|
||
685 | private void calcNewMiniExtent(View theView){ |
||
686 | |||
687 | ViewPort viewPort = theView.getMapControl().getMapContext().getViewPort(); |
||
688 | for(int j = 0; j < getLyrPoints().getCountPoints(); j++){ |
||
689 | //Calculamos el nuevo centro
|
||
690 | Point2D oldCenter = getLyrPoints().getPoint(j).leftCenterPoint;
|
||
691 | Point2D newCenter = new Point2D.Double(); |
||
692 | newCenter.setLocation( lyrGeoRaster.img2World(getLyrPoints().getPoint(j).pixelPoint)); |
||
693 | 6641 | caballero | |
694 | 5818 | nacho | double diffX = oldCenter.getX() - newCenter.getX();
|
695 | double diffY = oldCenter.getY() - newCenter.getY();
|
||
696 | 6641 | caballero | |
697 | getLyrPoints().getPoint(j).leftCenterPoint = newCenter; |
||
698 | |||
699 | ViewPort vpOld = getLyrPoints().getPoint(j).leftViewPort; |
||
700 | Rectangle2D newExtent = new Rectangle2D.Double( vpOld.getExtent().getMinX() - diffX, |
||
701 | vpOld.getExtent().getMinY() - diffY, |
||
702 | vpOld.getExtent().getWidth(), |
||
703 | 5818 | nacho | vpOld.getExtent().getHeight() ); |
704 | ViewPort vpNew = new ViewPort(vpOld.getProjection());
|
||
705 | vpNew.setExtent(newExtent); |
||
706 | vpNew.setImageSize(vpOld.getImageSize()); |
||
707 | 6641 | caballero | vpNew.refreshExtent(); |
708 | 5818 | nacho | getLyrPoints().getPoint(j).leftViewPort = vpNew; |
709 | } |
||
710 | } |
||
711 | 6641 | caballero | |
712 | 5818 | nacho | /**
|
713 | 6641 | caballero | * This method initializes jButton
|
714 | *
|
||
715 | * @return javax.swing.JButton
|
||
716 | */
|
||
717 | 5818 | nacho | public JButton getBAccept() { |
718 | if (bAceptar == null) { |
||
719 | bAceptar = new JButton(); |
||
720 | bAceptar.setText(PluginServices.getText(this,"aceptar")); |
||
721 | bAceptar.setToolTipText(PluginServices.getText(this,"accept_tip")); |
||
722 | bAceptar.addActionListener(this);
|
||
723 | } |
||
724 | return bAceptar;
|
||
725 | } |
||
726 | 6641 | caballero | |
727 | 5818 | nacho | /**
|
728 | 6641 | caballero | * This method initializes bProcesar
|
729 | *
|
||
730 | * @return javax.swing.JButton
|
||
731 | */
|
||
732 | 5818 | nacho | public JButton getBProcess() { |
733 | if (bProcesar == null) { |
||
734 | bProcesar = new JButton(); |
||
735 | bProcesar.setText(PluginServices.getText(this,"procesar")); |
||
736 | bProcesar.setToolTipText(PluginServices.getText(this,"process_tip")); |
||
737 | bProcesar.setEnabled(true);
|
||
738 | bProcesar.addActionListener(this);
|
||
739 | 8765 | jjdelcerro | |
740 | //TODO: Descomentar cuando se pueda procesar al vuelo la imagen
|
||
741 | bProcesar.setVisible(false);
|
||
742 | 5818 | nacho | } |
743 | return bProcesar;
|
||
744 | } |
||
745 | 6641 | caballero | |
746 | 5818 | nacho | /**
|
747 | * El bot?n cancelar restaura el extent con el que se carg? la imagen a georreferenciar
|
||
748 | 6641 | caballero | * y cierra la ventana.
|
749 | *
|
||
750 | * @return javax.swing.JButton
|
||
751 | */
|
||
752 | 5818 | nacho | public JButton getBCancel() { |
753 | if (bCancelar == null) { |
||
754 | bCancelar = new JButton(); |
||
755 | bCancelar.setText(PluginServices.getText(this,"cancelar")); |
||
756 | bCancelar.setToolTipText(PluginServices.getText(this,"cancel_tip")); |
||
757 | bCancelar.addActionListener(this);
|
||
758 | } |
||
759 | return bCancelar;
|
||
760 | } |
||
761 | 6641 | caballero | |
762 | 5818 | nacho | /**
|
763 | * Asigna a las textbox el valor de pixel pasado
|
||
764 | * @param x valor x
|
||
765 | * @param y valor y
|
||
766 | */
|
||
767 | public void setPixelText(double x, double y){ |
||
768 | getSelectPointsPanel().getDataPointPanel().getTX().setText(String.valueOf(x));
|
||
769 | getSelectPointsPanel().getDataPointPanel().getTY().setText(String.valueOf(y));
|
||
770 | } |
||
771 | 6641 | caballero | |
772 | 5818 | nacho | /**
|
773 | * Asigna a las textbox el valor de coordenadas pasado
|
||
774 | * @param x valor x
|
||
775 | * @param y valor y
|
||
776 | */
|
||
777 | public void setMapCoordText(double x, double y){ |
||
778 | getSelectPointsPanel().getDataPointPanel().getLongitud().setText(GeoUtils.tailDecimals(String.valueOf(x), 5)); |
||
779 | getSelectPointsPanel().getDataPointPanel().getLatitud().setText(GeoUtils.tailDecimals(String.valueOf(y), 5)); |
||
780 | } |
||
781 | 6641 | caballero | |
782 | 5818 | nacho | /**
|
783 | * Esta funci?n resetea los controles del panel de info de un punto.
|
||
784 | */
|
||
785 | public void resetControls(boolean active){ |
||
786 | getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().setSaveToDisk(active); |
||
787 | 6641 | caballero | getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().resetControls(active); |
788 | 5818 | nacho | getConectorPanel().getAdjustGeorefPanel().getZoomLeft().clear(); |
789 | getConectorPanel().getAdjustGeorefPanel().getZoomRight().clear(); |
||
790 | setEnabled(active); |
||
791 | } |
||
792 | 6641 | caballero | |
793 | 5818 | nacho | /* (non-Javadoc)
|
794 | * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
||
795 | */
|
||
796 | public void componentHidden(ComponentEvent arg0) { |
||
797 | |||
798 | } |
||
799 | /* (non-Javadoc)
|
||
800 | * @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
||
801 | */
|
||
802 | public void componentMoved(ComponentEvent arg0) { |
||
803 | |||
804 | } |
||
805 | /* (non-Javadoc)
|
||
806 | * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
||
807 | */
|
||
808 | public void componentResized(ComponentEvent ev) { |
||
809 | 6641 | caballero | |
810 | 5818 | nacho | if(frame.getWidth() <= this.normalWidth + 10) |
811 | frame.setSize(this.normalWidth, frame.getHeight());
|
||
812 | 6641 | caballero | |
813 | 5818 | nacho | if(this.getConectorPanel().getDataPointsTabPanel().getTbPoints().getSelectedIndex() == 1){ |
814 | tmpWidth = frame.getWidth(); |
||
815 | this.newFrameSize(frame.getWidth(), frame.getHeight() - 10); |
||
816 | } |
||
817 | } |
||
818 | /* (non-Javadoc)
|
||
819 | * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
||
820 | */
|
||
821 | public void componentShown(ComponentEvent arg0) { |
||
822 | |||
823 | } |
||
824 | 6641 | caballero | |
825 | 5818 | nacho | /**
|
826 | *Inicializa el tama?o del dialogo
|
||
827 | */
|
||
828 | public void resetSize(){ |
||
829 | if(!enlarge){
|
||
830 | frame.setSize(this.normalWidth + 12, this.normalHeight + 10); |
||
831 | }else{
|
||
832 | frame.setSize(this.normalWidth + 12, this.enlargeHeight + 10); |
||
833 | } |
||
834 | newFrameSize((int)Math.round(this.normalWidth / 0.98), this.normalHeight); |
||
835 | } |
||
836 | 6641 | caballero | |
837 | 5818 | nacho | /**
|
838 | * Calculo del nuevo tama?o a partir de un frame redimensionado
|
||
839 | * @param w Ancho del frame
|
||
840 | * @param h Alto del frame
|
||
841 | */
|
||
842 | public void newFrameSize(int w, int h){ |
||
843 | int newWidth = (int)Math.round(w * 0.98); |
||
844 | 6641 | caballero | |
845 | 5818 | nacho | this.setSize(new java.awt.Dimension(newWidth, normalHeight )); |
846 | this.setPreferredSize(new java.awt.Dimension(newWidth, normalHeight )); |
||
847 | 6641 | caballero | this.getConectorPanel().newFrameSize(newWidth, h);
|
848 | 5818 | nacho | } |
849 | 6641 | caballero | |
850 | 5818 | nacho | /**
|
851 | * Elimina un punto de la tabla de puntos
|
||
852 | * @param pos Posici?n del punto a eliminar
|
||
853 | */
|
||
854 | public void removeTableValueAt(int pos) throws ArrayIndexOutOfBoundsException{ |
||
855 | ((DefaultTableModel)getTable().getTable().getModel()).removeRow(pos);
|
||
856 | } |
||
857 | 6641 | caballero | |
858 | 5818 | nacho | /**
|
859 | * A partir de nuevas coordenadas actualiza la vista, minimagen, capa de puntos el
|
||
860 | * dialogo y la tabla.
|
||
861 | *
|
||
862 | */
|
||
863 | public void updateData(int nPunto, Point2D pixel, Point2D map, View view){ |
||
864 | getPointManager().updateData(nPunto, pixel, map, this, view);
|
||
865 | 6641 | caballero | } |
866 | |||
867 | 5818 | nacho | /**
|
868 | * Esta funci?n deshabilita todos los controles y guarda sus valores
|
||
869 | * de habilitado o deshabilitado para que cuando se ejecute restoreControlsValue
|
||
870 | * se vuelvan a quedar como estaba
|
||
871 | */
|
||
872 | public void disableAllControls(){ |
||
873 | if(!disableAllControls){
|
||
874 | disableAllControls = true;
|
||
875 | 6641 | caballero | |
876 | 5818 | nacho | //Salvamos los estados
|
877 | buttonsState[0] = getBProcess().isEnabled();
|
||
878 | buttonsState[1] = getBAccept().isEnabled();
|
||
879 | buttonsState[2] = getBCancel().isEnabled();
|
||
880 | buttonsState[3] = getDialogButtons().getBExportToCSV().isEnabled();
|
||
881 | buttonsState[4] = getDialogButtons().getBImportFromCSV().isEnabled();
|
||
882 | buttonsState[5] = getDialogButtons().getBLoad().isEnabled();
|
||
883 | buttonsState[6] = getDialogButtons().getBSave().isEnabled();
|
||
884 | 6641 | caballero | |
885 | 5818 | nacho | //Desactivamos controles
|
886 | getBProcess().setEnabled(false);
|
||
887 | getBAccept().setEnabled(false);
|
||
888 | getBCancel().setEnabled(false);
|
||
889 | 6641 | caballero | |
890 | 5818 | nacho | getDialogButtons().getBExportToCSV().setEnabled(false);
|
891 | getDialogButtons().getBImportFromCSV().setEnabled(false);
|
||
892 | getDialogButtons().getBLoad().setEnabled(false);
|
||
893 | getDialogButtons().getBSave().setEnabled(false);
|
||
894 | } |
||
895 | } |
||
896 | 6641 | caballero | |
897 | 5818 | nacho | /**
|
898 | 6641 | caballero | * Esta funci?n deja los controles como estaban al ejecutar la funci?n
|
899 | 5818 | nacho | * disableAllControls
|
900 | */
|
||
901 | public void restoreControlsValue(){ |
||
902 | if(disableAllControls){
|
||
903 | disableAllControls = false;
|
||
904 | getBProcess().setEnabled(buttonsState[0]);
|
||
905 | getBAccept().setEnabled(buttonsState[1]);
|
||
906 | getBCancel().setEnabled(buttonsState[2]);
|
||
907 | getDialogButtons().getBExportToCSV().setEnabled(buttonsState[3]);
|
||
908 | getDialogButtons().getBImportFromCSV().setEnabled(buttonsState[4]);
|
||
909 | getDialogButtons().getBLoad().setEnabled(buttonsState[5]);
|
||
910 | getDialogButtons().getBSave().setEnabled(buttonsState[6]);
|
||
911 | } |
||
912 | } |
||
913 | //**********************End Methods***************************
|
||
914 | 6641 | caballero | |
915 | 5818 | nacho | //**********************Setters & Getters*********************
|
916 | /**
|
||
917 | * Obtiene la tabla de puntos
|
||
918 | */
|
||
919 | public PointTable getTable(){
|
||
920 | return this.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getJTable(); |
||
921 | } |
||
922 | 6641 | caballero | |
923 | 5818 | nacho | /**
|
924 | * Asigna un valor a una posici?n de la tabla
|
||
925 | * @param value Valor a asignar
|
||
926 | * @param row Fila en la que se asigna
|
||
927 | * @param col Columna en la que se asigna
|
||
928 | */
|
||
929 | public void setTableValueAt(String value, int row, int col)throws ArrayIndexOutOfBoundsException{ |
||
930 | ((DefaultTableModel)getTable().getTable().getModel()).setValueAt(value, row, col);
|
||
931 | } |
||
932 | 6641 | caballero | |
933 | 5818 | nacho | /**
|
934 | * Asigna un valor del checkBox para una fila de la tabla
|
||
935 | * @param row Fila en la que se asigna
|
||
936 | */
|
||
937 | public void setCheckValueAt(Boolean value, int row)throws ArrayIndexOutOfBoundsException{ |
||
938 | ((DefaultTableModel)getTable().getTable().getModel()).setValueAt(value, row, 0); |
||
939 | } |
||
940 | 6641 | caballero | |
941 | 5818 | nacho | /**
|
942 | * Obtiene el n?mero de filas de la tabla
|
||
943 | * @return N?mero de filas de la tabla
|
||
944 | */
|
||
945 | public int getTableRowCount(){ |
||
946 | return getTable().getTable().getRowCount();
|
||
947 | } |
||
948 | 6641 | caballero | |
949 | 5818 | nacho | /**
|
950 | * A?ade una nueva fila a la tabla de puntos
|
||
951 | */
|
||
952 | public void addTableNew(){ |
||
953 | getTable().getTableModel().addNew(); |
||
954 | } |
||
955 | /**
|
||
956 | * @return Returns the tmpWidth.
|
||
957 | */
|
||
958 | public int getTmpWidth() { |
||
959 | return tmpWidth;
|
||
960 | } |
||
961 | /**
|
||
962 | * @param tmpWidth The tmpWidth to set.
|
||
963 | */
|
||
964 | public void setTmpWidth(int tmpWidth) { |
||
965 | this.tmpWidth = tmpWidth;
|
||
966 | } |
||
967 | /**
|
||
968 | * @return Returns the enlargeHeight.
|
||
969 | */
|
||
970 | public int getEnlargeHeight() { |
||
971 | return enlargeHeight;
|
||
972 | } |
||
973 | /**
|
||
974 | * @return Returns the normalHeight.
|
||
975 | */
|
||
976 | public int getNormalHeight() { |
||
977 | return normalHeight;
|
||
978 | } |
||
979 | |||
980 | /**
|
||
981 | * @return Returns the normalWidth.
|
||
982 | */
|
||
983 | public int getNormalWidth() { |
||
984 | return normalWidth;
|
||
985 | } |
||
986 | 6641 | caballero | |
987 | 5818 | nacho | /**
|
988 | * Asigna el valor del campo RMS
|
||
989 | * @param rms Cadena que representa el RMS
|
||
990 | */
|
||
991 | public void setRMS(String rms){ |
||
992 | this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTRMS().setText(rms);
|
||
993 | } |
||
994 | 6641 | caballero | |
995 | 5818 | nacho | /**
|
996 | * Asigna el valor del campo de residuo en X
|
||
997 | * @param rms Cadena que representa el RMS
|
||
998 | */
|
||
999 | public void setResX(String resX){ |
||
1000 | this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResX().setText(resX);
|
||
1001 | } |
||
1002 | 6641 | caballero | |
1003 | 5818 | nacho | /**
|
1004 | * Asigna el valor del campo de residuo en Y
|
||
1005 | * @param rms Cadena que representa el RMS
|
||
1006 | */
|
||
1007 | public void setResY(String resY){ |
||
1008 | this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTResY().setText(resY);
|
||
1009 | } |
||
1010 | 6641 | caballero | |
1011 | 5818 | nacho | /**
|
1012 | * Asigna el valor del campo RMS
|
||
1013 | * @param rms Cadena que representa el RMS
|
||
1014 | */
|
||
1015 | public void setTotal(String total){ |
||
1016 | this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getErrorPointPanel().getTTotal().setText(total);
|
||
1017 | } |
||
1018 | 6641 | caballero | |
1019 | 5818 | nacho | /**
|
1020 | * @return Returns the lyrGeoRaster.
|
||
1021 | */
|
||
1022 | public FLyrGeoRaster getLyrGeoRaster() {
|
||
1023 | return lyrGeoRaster;
|
||
1024 | } |
||
1025 | |||
1026 | /**
|
||
1027 | * @return Returns the lyrPoints.
|
||
1028 | */
|
||
1029 | public FLyrPoints getLyrPoints() {
|
||
1030 | try{
|
||
1031 | 6641 | caballero | return lyrGeoRaster.getFLyrPoints();
|
1032 | 5818 | nacho | }catch(ClassCastException exc){ |
1033 | return null; |
||
1034 | } |
||
1035 | } |
||
1036 | 6641 | caballero | |
1037 | 5818 | nacho | /**
|
1038 | * Selecciona un tab del cuadro
|
||
1039 | * @param index
|
||
1040 | */
|
||
1041 | public void setSelectedTab(int index){ |
||
1042 | try{
|
||
1043 | this.getConectorPanel().getDataPointsTabPanel().getTbPoints().setSelectedIndex(index);
|
||
1044 | }catch(IllegalArgumentException ex){ |
||
1045 | //Si peta al seleccionar un tab, pues nada.
|
||
1046 | } |
||
1047 | } |
||
1048 | 6641 | caballero | |
1049 | 5818 | nacho | /**
|
1050 | * @param extended The extended to set.
|
||
1051 | */
|
||
1052 | public void setEnlarge(boolean enlarge) { |
||
1053 | this.enlarge = enlarge;
|
||
1054 | if(!enlarge){
|
||
1055 | frame.setSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10)); |
||
1056 | frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.normalHeight + 10)); |
||
1057 | this.setPreferredSize(new Dimension(this.normalWidth, this.normalHeight)); |
||
1058 | this.setSize(new Dimension(this.normalWidth, this.normalHeight)); |
||
1059 | this.getConectorPanel().setCanvasVisible(false); |
||
1060 | }else{
|
||
1061 | frame.setSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10)); |
||
1062 | frame.setPreferredSize(new Dimension(this.normalWidth + 12, this.enlargeHeight + 10)); |
||
1063 | this.setPreferredSize(new Dimension(this.normalWidth, this.enlargeHeight)); |
||
1064 | this.setSize(new Dimension(this.normalWidth, this.enlargeHeight)); |
||
1065 | 6641 | caballero | this.getConectorPanel().setCanvasVisible(true); |
1066 | 5818 | nacho | } |
1067 | frame.pack(); |
||
1068 | } |
||
1069 | 6641 | caballero | |
1070 | 5818 | nacho | /**
|
1071 | * @return Returns the extended.
|
||
1072 | */
|
||
1073 | public boolean isEnlarge() { |
||
1074 | return enlarge;
|
||
1075 | } |
||
1076 | 6641 | caballero | |
1077 | 5818 | nacho | /**
|
1078 | * Obtiene el panel conector
|
||
1079 | * @return
|
||
1080 | */
|
||
1081 | public ConectorPanel getConectorPanel() {
|
||
1082 | 6641 | caballero | if (conectorPanel == null) { |
1083 | 5818 | nacho | conectorPanel = new ConectorPanel(this); |
1084 | } |
||
1085 | 6641 | caballero | |
1086 | 5818 | nacho | return conectorPanel;
|
1087 | } |
||
1088 | 6641 | caballero | |
1089 | 5818 | nacho | /**
|
1090 | 6641 | caballero | * This method initializes jPanel
|
1091 | *
|
||
1092 | * @return javax.swing.JPanel
|
||
1093 | */
|
||
1094 | 5818 | nacho | private JPanel getPBotones() { |
1095 | if (pBotones == null) { |
||
1096 | FlowLayout flowLayout1 = new FlowLayout(); |
||
1097 | pBotones = new JPanel(); |
||
1098 | pBotones.setLayout(flowLayout1); |
||
1099 | flowLayout1.setHgap(2);
|
||
1100 | flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT); |
||
1101 | pBotones.add(getDialogButtons(), null);
|
||
1102 | pBotones.add(getBProcess(), null);
|
||
1103 | pBotones.add(getBAccept(), null);
|
||
1104 | pBotones.add(getBCancel(), null);
|
||
1105 | } |
||
1106 | return pBotones;
|
||
1107 | } |
||
1108 | 6641 | caballero | |
1109 | 5818 | nacho | public static IProjection getLastProjection() { |
1110 | return proj;
|
||
1111 | } |
||
1112 | public static void setLastProjection(IProjection proj) { |
||
1113 | GeoreferencingDialog.proj = proj; |
||
1114 | } |
||
1115 | |||
1116 | /**
|
||
1117 | * @return Returns the GeoRedimBehavior.
|
||
1118 | */
|
||
1119 | public GeoRedimBehavior getGeoRedimBehavior() {
|
||
1120 | return rb;
|
||
1121 | } |
||
1122 | |||
1123 | /**
|
||
1124 | * @param rb The GeoRedimBehavior to set.
|
||
1125 | */
|
||
1126 | public void setGeoRedimBehavior(GeoRedimBehavior rb) { |
||
1127 | this.rb = rb;
|
||
1128 | } |
||
1129 | 6641 | caballero | |
1130 | 5818 | nacho | /**
|
1131 | * @return Returns the GeoMoveBehavior
|
||
1132 | */
|
||
1133 | public GeoMoveBehavior getGeoMoveBehavior() {
|
||
1134 | return mb;
|
||
1135 | } |
||
1136 | |||
1137 | /**
|
||
1138 | * @param mb The GeoMoveBehavior to set.
|
||
1139 | */
|
||
1140 | public void setGeoMoveBehavior(GeoMoveBehavior mb) { |
||
1141 | this.mb = mb;
|
||
1142 | } |
||
1143 | |||
1144 | 6641 | caballero | |
1145 | 5818 | nacho | /**
|
1146 | * Obtiene el punto de la lista que ha sido seleccionado
|
||
1147 | * @return
|
||
1148 | */
|
||
1149 | public int getSelectedPoint(){ |
||
1150 | return getConectorPanel().getDataPointsTabPanel().
|
||
1151 | getSelectPointsPanel().getTableControlerPanel().getSelectedIndex(); |
||
1152 | } |
||
1153 | 6641 | caballero | |
1154 | 5818 | nacho | /**
|
1155 | * Obtiene el control de la mini imagen que tiene los botones a la izquierda
|
||
1156 | * @return ZoomControlPanel
|
||
1157 | */
|
||
1158 | public ZoomControlPanel getZoomControlLeft(){
|
||
1159 | return this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft(); |
||
1160 | } |
||
1161 | 6641 | caballero | |
1162 | 5818 | nacho | /**
|
1163 | * Obtiene el control de la mini imagen que tiene los botones a la derecha
|
||
1164 | * @return ZoomControlPanel
|
||
1165 | */
|
||
1166 | public ZoomControlPanel getZoomControlRight(){
|
||
1167 | return this.getConectorPanel().getAdjustGeorefPanel().getZoomRight(); |
||
1168 | } |
||
1169 | 6641 | caballero | |
1170 | 5818 | nacho | /**
|
1171 | * Obtiene el panel de selecci?n de puntos
|
||
1172 | * @return Panel de selecci?n de puntos
|
||
1173 | */
|
||
1174 | public SelectPointsPanel getSelectPointsPanel(){
|
||
1175 | return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel(); |
||
1176 | } |
||
1177 | 6641 | caballero | |
1178 | 5818 | nacho | /**
|
1179 | * Obtiene el panel de opciones
|
||
1180 | * @return OptionPanel
|
||
1181 | */
|
||
1182 | public OptionsPanel getOptionsPanel(){
|
||
1183 | return getConectorPanel().getAdjustGeorefPanel().getOptionsPanel();
|
||
1184 | } |
||
1185 | 6641 | caballero | |
1186 | 5818 | nacho | /**
|
1187 | * Asigna el frame
|
||
1188 | * @param f
|
||
1189 | */
|
||
1190 | public void setFrame(JInternalFrame f){ |
||
1191 | frame = f; |
||
1192 | frame.addComponentListener(this);
|
||
1193 | } |
||
1194 | 6641 | caballero | |
1195 | 5818 | nacho | /**
|
1196 | * Obtiene el frame
|
||
1197 | * @return frame
|
||
1198 | */
|
||
1199 | public JInternalFrame getFrame(){ |
||
1200 | return frame;
|
||
1201 | } |
||
1202 | 6641 | caballero | |
1203 | 5818 | nacho | /**
|
1204 | * Obtiene el gestor de puntos
|
||
1205 | * @return PointManager
|
||
1206 | */
|
||
1207 | public PointManager getPointManager() {
|
||
1208 | return pointManager;
|
||
1209 | } |
||
1210 | 6641 | caballero | |
1211 | 5818 | nacho | /**
|
1212 | * Activa o desactiva este panel y todos los que lo componen
|
||
1213 | * @param enabled variable booleana para la activaci?n y/o desactivaci?n
|
||
1214 | */
|
||
1215 | public void setEnabled(boolean enabled){ |
||
1216 | conectorPanel.getDataPointsTabPanel().getSelectPointsPanel().setEnabled(enabled); |
||
1217 | conectorPanel.getAdjustGeorefPanel().setEnabled(enabled); |
||
1218 | } |
||
1219 | 6641 | caballero | |
1220 | 5818 | nacho | /**
|
1221 | 6641 | caballero | * M?todo para notificar si se desea crear o no el fichero de coordenadas .tfw, .wld .jpgw ,...
|
1222 | 5818 | nacho | * @param createWorldFile
|
1223 | */
|
||
1224 | public void setCreateWorldFile(boolean createWorldFile) { |
||
1225 | this.createWorldFile = createWorldFile;
|
||
1226 | } |
||
1227 | 6641 | caballero | |
1228 | 5818 | nacho | /**
|
1229 | 6641 | caballero | *
|
1230 | 5818 | nacho | */
|
1231 | public ViewPort getLeftInitViewport(ViewPort vp, Point2D center, ViewPort initVp, double zoom){ |
||
1232 | return getZoomControlLeft().getCanvas().initViewPort(vp, center, initVp, zoom);
|
||
1233 | } |
||
1234 | 6641 | caballero | |
1235 | 5818 | nacho | /**
|
1236 | 6641 | caballero | * Consulta si se desea incluir los errores cuando se exporta a fichero .csv
|
1237 | 5818 | nacho | * @param errorCVS true si se incluyen los errores dentro del fichero y false si no se incluyen
|
1238 | */
|
||
1239 | public boolean isErrorCSV() { |
||
1240 | return errorCSV;
|
||
1241 | } |
||
1242 | |||
1243 | /**
|
||
1244 | 6641 | caballero | * M?todo para notificar si se desea incluir los errores cuando se exporta a fichero .csv
|
1245 | 5818 | nacho | * @param errorCVS true si se incluyen los errores dentro del fichero y false si no se incluyen
|
1246 | */
|
||
1247 | public void setErrorCSV(boolean errorCSV) { |
||
1248 | this.errorCSV = errorCSV;
|
||
1249 | } |
||
1250 | 6641 | caballero | |
1251 | 5818 | nacho | /**
|
1252 | * Obtiene los errores en una matriz de Nx3 en la que cada fila es un punto y la
|
||
1253 | 6641 | caballero | * columna 0 es el error en X, la columna 1 es el error en Y y la columna 2 es el error RMS.
|
1254 | 5818 | nacho | * @return matriz de errores
|
1255 | */
|
||
1256 | public double[][] getErrors(){ |
||
1257 | return pointManager.getErrors();
|
||
1258 | } |
||
1259 | 6641 | caballero | |
1260 | 5818 | nacho | /**
|
1261 | 6641 | caballero | * Pregunta si la capa a georreferenciar se desactiva cuando se introduce el
|
1262 | 5818 | nacho | * primer punto y devuelve true si lo hace.
|
1263 | 6641 | caballero | * @return true o false
|
1264 | 5818 | nacho | */
|
1265 | public boolean isOffLayer() { |
||
1266 | return offLayer;
|
||
1267 | } |
||
1268 | |||
1269 | /**
|
||
1270 | 6641 | caballero | * Asigna el flag que dice si la capa a georreferenciar se desactiva cuando se introduce el
|
1271 | 5818 | nacho | * primer punto
|
1272 | * @param offLayer true para desactivar la capa
|
||
1273 | */
|
||
1274 | public void setOffLayer(boolean offLayer) { |
||
1275 | this.offLayer = offLayer;
|
||
1276 | } |
||
1277 | 6641 | caballero | |
1278 | 5818 | nacho | /**
|
1279 | * Consulta si la vista ha de centrarse sobre el punto seleccionado o no.
|
||
1280 | 6641 | caballero | * @return true o false
|
1281 | 5818 | nacho | */
|
1282 | public boolean isCenterPoint() { |
||
1283 | return centerPoint;
|
||
1284 | } |
||
1285 | |||
1286 | /**
|
||
1287 | * Asigna el flag que dice si vista ha centrarse sobre el punto seleccionado o no
|
||
1288 | * @param centerPoint true para centrar la vista y false no.
|
||
1289 | */
|
||
1290 | public void setCenterPoint(boolean centerPoint) { |
||
1291 | this.centerPoint = centerPoint;
|
||
1292 | } |
||
1293 | 6641 | caballero | |
1294 | 5818 | nacho | /**
|
1295 | 6641 | caballero | * Pregunta si la capa de puntos se desactiva cuando se introduce el
|
1296 | 5818 | nacho | * primer punto y devuelve true si lo hace.
|
1297 | 6641 | caballero | * @return true o false
|
1298 | 5818 | nacho | */
|
1299 | public boolean isOffPoints() { |
||
1300 | return offPoints;
|
||
1301 | } |
||
1302 | |||
1303 | /**
|
||
1304 | 6641 | caballero | * Asigna el flag que dice si la capa de puntos se desactiva cuando se introduce el
|
1305 | 5818 | nacho | * primer punto
|
1306 | * @param offPoints true para desactivar la capa
|
||
1307 | */
|
||
1308 | public void setOffPoints(boolean offPoints) { |
||
1309 | this.offPoints = offPoints;
|
||
1310 | } |
||
1311 | 6641 | caballero | |
1312 | 5818 | nacho | /**
|
1313 | * Obtiene el bot?n de activar/desactivar la inserci?n de punto del panel del control de
|
||
1314 | 6641 | caballero | * tabla
|
1315 | 5818 | nacho | * @return JToggleButton
|
1316 | */
|
||
1317 | public JToggleButton getBInsertPointOfTablePoints(){ |
||
1318 | return tablePointsPanel.getPTablePanelButtons().getBInsertPoint();
|
||
1319 | } |
||
1320 | 6641 | caballero | |
1321 | 5818 | nacho | /**
|
1322 | * Obtiene el bot?n de activar/desactivar la inserci?n de punto del panel del control de
|
||
1323 | 6641 | caballero | * tabla
|
1324 | 5818 | nacho | * @return JToggleButton
|
1325 | */
|
||
1326 | public JButton getBNewPointOfTablePoints(){ |
||
1327 | return tablePointsPanel.getTableControlerPanel().getBNew();
|
||
1328 | } |
||
1329 | 6641 | caballero | |
1330 | 5818 | nacho | /**
|
1331 | 6641 | caballero | * This method initializes jPanel
|
1332 | *
|
||
1333 | * @return javax.swing.JPanel
|
||
1334 | 5818 | nacho | */
|
1335 | public DialogButtons getDialogButtons() {
|
||
1336 | if (dialogButtons == null) { |
||
1337 | dialogButtons = new DialogButtons();
|
||
1338 | } |
||
1339 | return dialogButtons;
|
||
1340 | } |
||
1341 | 6641 | caballero | |
1342 | 5818 | nacho | /**
|
1343 | * Activa/desactiva los botones de la barra correspondientes al salvado
|
||
1344 | 6641 | caballero | * de datos a disco.
|
1345 | 5818 | nacho | * @param active true activa los controles y false los desactiva.
|
1346 | */
|
||
1347 | public void setEnableSaveButtons(boolean active){ |
||
1348 | getDialogButtons().getBSave().setEnabled(active); |
||
1349 | getDialogButtons().getBExportToCSV().setEnabled(active); |
||
1350 | } |
||
1351 | //**********************End Setters & Getters*****************
|
||
1352 | 6641 | caballero | |
1353 | 5818 | nacho | } // @jve:decl-index=0:visual-constraint="10,10"
|
1354 | // @jve:visual-info decl-index=0 visual-constraint="10,10"
|
||
1355 | // @jve:visual-info decl-index=0 visual-constraint="10,10" |