root / org.gvsig.jcrs / extJCRS / src / org / gvsig / crs / gui / listeners / CRSSelectionDialogListener.java @ 40
History | View | Annotate | Download (22.7 KB)
1 |
/* gvSIG. Sistema de Informacin Geogrfica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ibez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
|
42 |
package org.gvsig.crs.gui.listeners; |
43 |
|
44 |
import java.awt.CardLayout; |
45 |
import java.awt.event.ActionEvent; |
46 |
import java.awt.event.ActionListener; |
47 |
import java.awt.event.ItemEvent; |
48 |
import java.awt.event.ItemListener; |
49 |
import java.awt.event.MouseEvent; |
50 |
import java.awt.event.MouseListener; |
51 |
|
52 |
import javax.swing.JOptionPane; |
53 |
import javax.swing.ListSelectionModel; |
54 |
import javax.swing.event.ListSelectionEvent; |
55 |
import javax.swing.event.ListSelectionListener; |
56 |
|
57 |
import org.gvsig.andami.PluginServices; |
58 |
import org.gvsig.crs.CrsException; |
59 |
import org.gvsig.crs.CrsWkt; |
60 |
import org.gvsig.crs.ICrs; |
61 |
import org.gvsig.crs.gui.CRSSelectionDialog; |
62 |
import org.gvsig.crs.persistence.CrsData; |
63 |
import org.gvsig.crs.persistence.RecentCRSsPersistence; |
64 |
|
65 |
|
66 |
/**
|
67 |
* Esta clase contiene los listeners necesarios para el manejo
|
68 |
* de los eventos del panel de eleccin de CRS de la vista principal.
|
69 |
*
|
70 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es)
|
71 |
* @author Jos Luis Gmez Martnez (jolugomar@gmail.com)
|
72 |
*
|
73 |
*/
|
74 |
|
75 |
public class CRSSelectionDialogListener implements ActionListener, |
76 |
ListSelectionListener, ItemListener, MouseListener { |
77 |
|
78 |
int[] valid_method_code = {9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9809, 9810, |
79 |
9811, 9812, 9813, 9814, 9815, 9602, 9659, 9818, 9819, 9820, 9821, 9822, 9823, |
80 |
9827, 9829}; |
81 |
|
82 |
CRSSelectionDialog dialog = null;
|
83 |
|
84 |
public CRSSelectionDialogListener(CRSSelectionDialog d) {
|
85 |
dialog = d; |
86 |
} |
87 |
|
88 |
/**
|
89 |
* Manejador de los eventos relacionados con los botones del panel
|
90 |
* de seleccin de CRS.
|
91 |
*/
|
92 |
public void actionPerformed(ActionEvent e) { |
93 |
if (e.getSource() == dialog.getCrsMainPanel().getJButtonAccept()){
|
94 |
ICrs crs = (ICrs) dialog.getProjection(); |
95 |
try {
|
96 |
crs.getProj4String(); |
97 |
} catch (CrsException e1) {
|
98 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
99 |
JOptionPane.WARNING_MESSAGE);
|
100 |
return;
|
101 |
} |
102 |
dialog.setLastProj(crs); |
103 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
104 |
if (dialog.getLastProj() != null){ |
105 |
/*
|
106 |
* Actualizar recientes...
|
107 |
*/
|
108 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
109 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
110 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
111 |
CrsData crsData = new CrsData(authority,code,name);
|
112 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
113 |
persistence.addCrsData(crsData); |
114 |
|
115 |
|
116 |
PluginServices.getMDIManager().closeWindow(dialog); |
117 |
dialog.setOkPressed(true);
|
118 |
} |
119 |
else {
|
120 |
dialog.setOkPressed(false);
|
121 |
} |
122 |
} |
123 |
|
124 |
if (e.getSource() == dialog.getCrsMainPanel().getJButtonCancel()){
|
125 |
dialog.setProjection(dialog.getLastProj()); |
126 |
PluginServices.getMDIManager().closeWindow(dialog); |
127 |
dialog.setOkPressed(false);
|
128 |
} |
129 |
|
130 |
} |
131 |
|
132 |
|
133 |
/**
|
134 |
* Maneja los eventos del combobox de eleccin de repositorio para
|
135 |
* la seleccin del CRS de la vista
|
136 |
*/
|
137 |
public void itemStateChanged(ItemEvent e) { |
138 |
CardLayout cl = (CardLayout)(dialog.getCrsMainPanel().getJPanelMain().getLayout()); |
139 |
String op = (String)e.getItem(); |
140 |
if (op.equals("EPSG")){ |
141 |
dialog.getCrsMainPanel().getEpsgPanel().connection(); |
142 |
if(dialog.getCrsMainPanel().getEpsgPanel().getJTable().getSelectedRowCount()>0) |
143 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
144 |
else
|
145 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
146 |
|
147 |
} else if (op.equals("IAU2000")) { |
148 |
dialog.getCrsMainPanel().getIauPanel().connection(); |
149 |
if(dialog.getCrsMainPanel().getIauPanel().getJTable().getSelectedRowCount()>0) |
150 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
151 |
else
|
152 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
153 |
}else if (op.equals("Recientes")) { |
154 |
//Comprobar de nuevo recientes por si hemos eliminado alguno de usuario
|
155 |
dialog.getCrsMainPanel().getRecentsPanel().loadRecents(); |
156 |
if(dialog.getCrsMainPanel().getRecentsPanel().getJTable().getSelectedRowCount()>0) |
157 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
158 |
else
|
159 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
160 |
} |
161 |
else if (op.equals("ESRI")) { |
162 |
dialog.getCrsMainPanel().getEsriPanel().connection(); |
163 |
if(dialog.getCrsMainPanel().getEsriPanel().getJTable().getSelectedRowCount()>0) |
164 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
165 |
else
|
166 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
167 |
}else if (op.equals(PluginServices.getText(this, "newCRS"))) { |
168 |
dialog.getCrsMainPanel().getNewCrsPanel().connection(); |
169 |
if(dialog.getCrsMainPanel().getNewCrsPanel().getJTable().getSelectedRowCount()>0) { |
170 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
171 |
if (dialog.getCrsMainPanel().getNewCrsPanel().getSearchTextField().getText().equals("")) |
172 |
dialog.getCrsMainPanel().getNewCrsPanel().initializeTable(); |
173 |
} |
174 |
else
|
175 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
176 |
} |
177 |
cl.show(dialog.getCrsMainPanel().getJPanelMain(), (String)e.getItem());
|
178 |
dialog.getCrsMainPanel().setDataSource((String)e.getItem());
|
179 |
} |
180 |
|
181 |
/**
|
182 |
* Maneja el evento de cambio de valor de las tablas existentes
|
183 |
* en cada uno de los distintos repositorios para la seleccin
|
184 |
* del CRS de la vista.
|
185 |
*/
|
186 |
public void valueChanged(ListSelectionEvent e) { |
187 |
if (e.getSource() == dialog.getCrsMainPanel().getRecentsPanel().getJTable().getSelectionModel()){
|
188 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
189 |
|
190 |
if (lsm.isSelectionEmpty()) {
|
191 |
dialog.getCrsMainPanel().getRecentsPanel().selectedRowTable = -1;
|
192 |
dialog.getCrsMainPanel().getRecentsPanel().setCodeCRS(-1);
|
193 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
194 |
dialog.getCrsMainPanel().getRecentsPanel().getInfoCrs().setEnabled(false);
|
195 |
dialog.setCode(0);
|
196 |
} |
197 |
else {
|
198 |
dialog.getCrsMainPanel().getRecentsPanel().initCrs(); |
199 |
dialog.setCode(dialog.getCrsMainPanel().getRecentsPanel().getCodeCRS()); |
200 |
dialog.getCrsMainPanel().getRecentsPanel().getInfoCrs().setEnabled(true);
|
201 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
202 |
} |
203 |
} |
204 |
|
205 |
if (e.getSource() == dialog.getCrsMainPanel().getIauPanel().getJTable().getSelectionModel()){
|
206 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
207 |
String[] not_soported = {"Oblique_Cylindrical_Equal_Area"}; |
208 |
boolean soported = true; |
209 |
if (lsm.isSelectionEmpty()) {
|
210 |
dialog.getCrsMainPanel().getIauPanel().selectedRowTable = -1;
|
211 |
dialog.getCrsMainPanel().getIauPanel().setCodeCRS(-1);
|
212 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
213 |
dialog.getCrsMainPanel().getIauPanel().getInfoCrs().setEnabled(false);
|
214 |
dialog.setCode(0);
|
215 |
|
216 |
} |
217 |
else {
|
218 |
|
219 |
dialog.getCrsMainPanel().getIauPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
220 |
dialog.getCrsMainPanel().getIauPanel().setCodeCRS(Integer.parseInt((String)dialog.getCrsMainPanel().getIauPanel().sorter.getValueAt(dialog.getCrsMainPanel().getIauPanel().selectedRowTable,0))); |
221 |
dialog.getCrsMainPanel().getIauPanel().setWKT(); |
222 |
CrsWkt crs = new CrsWkt(dialog.getCrsMainPanel().getIauPanel().getWKT());
|
223 |
String crs_kind = crs.getProjection();
|
224 |
for (int i = 0; i < not_soported.length; i++) { |
225 |
if (crs_kind.equals(not_soported[i]))
|
226 |
soported = false;
|
227 |
} |
228 |
if (soported){
|
229 |
dialog.setCode(dialog.getCrsMainPanel().getIauPanel().getCodeCRS()); |
230 |
dialog.getCrsMainPanel().getIauPanel().getInfoCrs().setEnabled(true);
|
231 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
232 |
} |
233 |
else {
|
234 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,"crs_not_soported"), "Warning...", |
235 |
JOptionPane.WARNING_MESSAGE);
|
236 |
dialog.getCrsMainPanel().getIauPanel().setCodeCRS(-1);
|
237 |
dialog.getCrsMainPanel().getIauPanel().setCodeCRS(0);
|
238 |
dialog.getCrsMainPanel().getIauPanel().getInfoCrs().setEnabled(false);
|
239 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
240 |
} |
241 |
} |
242 |
} |
243 |
|
244 |
if (e.getSource() == dialog.getCrsMainPanel().getEpsgPanel().getJTable().getSelectionModel()){
|
245 |
String[] not_soported = {"engineering", "vertical", "compound", "geocentric", "geographic 3D"}; |
246 |
|
247 |
String problem = ""; |
248 |
boolean soported = true; |
249 |
boolean soported2 = false; |
250 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
251 |
|
252 |
if (lsm.isSelectionEmpty()) {
|
253 |
dialog.getCrsMainPanel().getEpsgPanel().selectedRowTable = -1;
|
254 |
dialog.getCrsMainPanel().getEpsgPanel().setCodeCRS(-1);
|
255 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
256 |
dialog.getCrsMainPanel().getEpsgPanel().getInfoCrs().setEnabled(false);
|
257 |
dialog.setCode(0);
|
258 |
} |
259 |
else {
|
260 |
dialog.getCrsMainPanel().getEpsgPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
261 |
String crs_kind = (String)dialog.getCrsMainPanel().getEpsgPanel().sorter.getValueAt(dialog.getCrsMainPanel().getEpsgPanel().selectedRowTable,2); |
262 |
for (int i = 0; i < not_soported.length; i++) { |
263 |
if (crs_kind.equals(not_soported[i])){
|
264 |
soported = false;
|
265 |
problem = not_soported[i]; |
266 |
} |
267 |
} |
268 |
for (int i=0; i< valid_method_code.length;i++) { |
269 |
if (dialog.getCrsMainPanel().getEpsgPanel().getProjectionCode((String)dialog.getCrsMainPanel().getEpsgPanel().sorter.getValueAt(dialog.getCrsMainPanel().getEpsgPanel().selectedRowTable,0)) == valid_method_code[i]) { |
270 |
soported2 = true;
|
271 |
} |
272 |
} |
273 |
if (crs_kind.equals("geographic 2D")) { |
274 |
soported2 = true;
|
275 |
} |
276 |
if (soported && soported2){
|
277 |
dialog.getCrsMainPanel().getEpsgPanel().setCodeCRS(Integer.parseInt((String)dialog.getCrsMainPanel().getEpsgPanel().sorter.getValueAt(dialog.getCrsMainPanel().getEpsgPanel().selectedRowTable,0))); |
278 |
dialog.getCrsMainPanel().getEpsgPanel().setWKT(); |
279 |
dialog.setCode(dialog.getCrsMainPanel().getEpsgPanel().epsg_code); |
280 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
281 |
dialog.getCrsMainPanel().getEpsgPanel().getInfoCrs().setEnabled(true);
|
282 |
|
283 |
} |
284 |
else {
|
285 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,"crs_not_soported")+" "+PluginServices.getText(this,problem), "Warning...", |
286 |
JOptionPane.WARNING_MESSAGE);
|
287 |
dialog.getCrsMainPanel().getEpsgPanel().setCodeCRS(-1);
|
288 |
dialog.setCode(0);
|
289 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
290 |
dialog.getCrsMainPanel().getEpsgPanel().getInfoCrs().setEnabled(false);
|
291 |
} |
292 |
} |
293 |
} |
294 |
|
295 |
if (e.getSource() == dialog.getCrsMainPanel().getEsriPanel().getJTable().getSelectionModel()){
|
296 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
297 |
String[] not_soported = {"Oblique_Cylindrical_Equal_Area"}; |
298 |
boolean soported = true; |
299 |
if (lsm.isSelectionEmpty()) {
|
300 |
dialog.getCrsMainPanel().getEsriPanel().selectedRowTable = -1;
|
301 |
dialog.getCrsMainPanel().getEsriPanel().setCodeCRS(-1);
|
302 |
dialog.getCrsMainPanel().getEsriPanel().getInfoCrs().setEnabled(false);
|
303 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
304 |
dialog.setCode(0);
|
305 |
|
306 |
} |
307 |
else {
|
308 |
|
309 |
dialog.getCrsMainPanel().getEsriPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
310 |
dialog.getCrsMainPanel().getEsriPanel().setCodeCRS(Integer.parseInt((String)dialog.getCrsMainPanel().getEsriPanel().sorter.getValueAt(dialog.getCrsMainPanel().getEsriPanel().selectedRowTable,0))); |
311 |
dialog.getCrsMainPanel().getEsriPanel().setWKT(); |
312 |
CrsWkt crs = new CrsWkt(dialog.getCrsMainPanel().getEsriPanel().getWKT());
|
313 |
String crs_kind = crs.getProjection();
|
314 |
for (int i = 0; i < not_soported.length; i++) { |
315 |
if (crs_kind.equals(not_soported[i]))
|
316 |
soported = false;
|
317 |
} |
318 |
if (soported){
|
319 |
dialog.setCode(dialog.getCrsMainPanel().getEsriPanel().getCodeCRS()); |
320 |
dialog.getCrsMainPanel().getEsriPanel().getInfoCrs().setEnabled(true);
|
321 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
322 |
} |
323 |
else {
|
324 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,"crs_not_soported"), "Warning...", |
325 |
JOptionPane.WARNING_MESSAGE);
|
326 |
dialog.getCrsMainPanel().getEsriPanel().setCodeCRS(-1);
|
327 |
dialog.getCrsMainPanel().getEsriPanel().setCodeCRS(0);
|
328 |
dialog.getCrsMainPanel().getEsriPanel().getInfoCrs().setEnabled(false);
|
329 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
330 |
} |
331 |
} |
332 |
} |
333 |
|
334 |
if (e.getSource() == dialog.getCrsMainPanel().getNewCrsPanel().getJTable().getSelectionModel()){
|
335 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
336 |
if (lsm.isSelectionEmpty()) {
|
337 |
dialog.getCrsMainPanel().getNewCrsPanel().selectedRowTable = -1;
|
338 |
dialog.getCrsMainPanel().getNewCrsPanel().setCodeCRS(-1);
|
339 |
dialog.getCrsMainPanel().getNewCrsPanel().getInfoCrs().setEnabled(false);
|
340 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(false);
|
341 |
dialog.getCrsMainPanel().getNewCrsPanel().getBtnEliminar().setEnabled(false);
|
342 |
dialog.getCrsMainPanel().getNewCrsPanel().getBtnEditar().setEnabled(false);
|
343 |
dialog.setCode(0);
|
344 |
|
345 |
} |
346 |
else {
|
347 |
|
348 |
dialog.getCrsMainPanel().getNewCrsPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
349 |
dialog.getCrsMainPanel().getNewCrsPanel().setCodeCRS(Integer.parseInt((String)dialog.getCrsMainPanel().getNewCrsPanel().sorter.getValueAt(dialog.getCrsMainPanel().getNewCrsPanel().selectedRowTable,0))); |
350 |
dialog.getCrsMainPanel().getNewCrsPanel().setWKT(); |
351 |
dialog.getCrsMainPanel().getNewCrsPanel().getInfoCrs().setEnabled(true);
|
352 |
dialog.getCrsMainPanel().getJButtonAccept().setEnabled(true);
|
353 |
dialog.getCrsMainPanel().getNewCrsPanel().getBtnEliminar().setEnabled(true);
|
354 |
dialog.getCrsMainPanel().getNewCrsPanel().getBtnEditar().setEnabled(true);
|
355 |
} |
356 |
} |
357 |
} |
358 |
|
359 |
/**
|
360 |
* Controla los eventos relacionados con el doble click para
|
361 |
* la seleccin del CRS de la vista de las tablas del panel de
|
362 |
* seleccin de CRS
|
363 |
*/
|
364 |
public void mouseClicked(MouseEvent e) { |
365 |
|
366 |
if (e.getSource() == dialog.getCrsMainPanel().getRecentsPanel().getJTable()){
|
367 |
if (e.getClickCount() == 2){ |
368 |
ICrs crs = (ICrs) dialog.getProjection(); |
369 |
try {
|
370 |
crs.getProj4String(); |
371 |
} catch (CrsException e1) {
|
372 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
373 |
JOptionPane.WARNING_MESSAGE);
|
374 |
return;
|
375 |
} |
376 |
dialog.setLastProj(crs); |
377 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
378 |
if (dialog.getLastProj() != null){ |
379 |
/*
|
380 |
* Actualizar recientes...
|
381 |
*/
|
382 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
383 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
384 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
385 |
CrsData crsData = new CrsData(authority,code,name);
|
386 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
387 |
persistence.addCrsData(crsData); |
388 |
|
389 |
PluginServices.getMDIManager().closeWindow(dialog); |
390 |
dialog.setOkPressed(true);
|
391 |
} |
392 |
else dialog.setOkPressed(false); |
393 |
} |
394 |
} |
395 |
|
396 |
if (e.getSource() == dialog.getCrsMainPanel().getEpsgPanel().getJTable()){
|
397 |
if (e.getClickCount() == 2){ |
398 |
ICrs crs = (ICrs) dialog.getProjection(); |
399 |
try {
|
400 |
crs.getProj4String(); |
401 |
} catch (CrsException e1) {
|
402 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
403 |
JOptionPane.WARNING_MESSAGE);
|
404 |
return;
|
405 |
} |
406 |
dialog.setLastProj(dialog.getProjection()); |
407 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
408 |
if (dialog.getLastProj() != null){ |
409 |
/*
|
410 |
* Actualizar recientes...
|
411 |
*/
|
412 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
413 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
414 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
415 |
CrsData crsData = new CrsData(authority,code,name);
|
416 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
417 |
persistence.addCrsData(crsData); |
418 |
|
419 |
PluginServices.getMDIManager().closeWindow(dialog); |
420 |
dialog.setOkPressed(true);
|
421 |
} |
422 |
else dialog.setOkPressed(false); |
423 |
} |
424 |
} |
425 |
|
426 |
if (e.getSource() == dialog.getCrsMainPanel().getIauPanel().getJTable()){
|
427 |
if (e.getClickCount() == 2){ |
428 |
ICrs crs = (ICrs) dialog.getProjection(); |
429 |
try {
|
430 |
crs.getProj4String(); |
431 |
} catch (CrsException e1) {
|
432 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
433 |
JOptionPane.WARNING_MESSAGE);
|
434 |
return;
|
435 |
} |
436 |
dialog.setLastProj(dialog.getProjection()); |
437 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
438 |
if (dialog.getLastProj() != null){ |
439 |
/*
|
440 |
* Actualizar recientes...
|
441 |
*/
|
442 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
443 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
444 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
445 |
CrsData crsData = new CrsData(authority,code,name);
|
446 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
447 |
persistence.addCrsData(crsData); |
448 |
|
449 |
PluginServices.getMDIManager().closeWindow(dialog); |
450 |
dialog.setOkPressed(true);
|
451 |
} |
452 |
else dialog.setOkPressed(false); |
453 |
} |
454 |
} |
455 |
|
456 |
if (e.getSource() == dialog.getCrsMainPanel().getEsriPanel().getJTable()){
|
457 |
if (e.getClickCount() == 2){ |
458 |
ICrs crs = (ICrs) dialog.getProjection(); |
459 |
try {
|
460 |
crs.getProj4String(); |
461 |
} catch (CrsException e1) {
|
462 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
463 |
JOptionPane.WARNING_MESSAGE);
|
464 |
return;
|
465 |
} |
466 |
dialog.setLastProj(dialog.getProjection()); |
467 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
468 |
if (dialog.getLastProj() != null){ |
469 |
/*
|
470 |
* Actualizar recientes...
|
471 |
*/
|
472 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
473 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
474 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
475 |
CrsData crsData = new CrsData(authority,code,name);
|
476 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
477 |
persistence.addCrsData(crsData); |
478 |
|
479 |
PluginServices.getMDIManager().closeWindow(dialog); |
480 |
dialog.setOkPressed(true);
|
481 |
} |
482 |
else dialog.setOkPressed(false); |
483 |
} |
484 |
} |
485 |
|
486 |
if (e.getSource() == dialog.getCrsMainPanel().getNewCrsPanel().getJTable()){
|
487 |
if (e.getClickCount() == 2){ |
488 |
ICrs crs = (ICrs) dialog.getProjection(); |
489 |
try {
|
490 |
crs.getProj4String(); |
491 |
} catch (CrsException e1) {
|
492 |
JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,e1.getMessage()), "Warning...", |
493 |
JOptionPane.WARNING_MESSAGE);
|
494 |
return;
|
495 |
} |
496 |
dialog.setLastProj(dialog.getProjection()); |
497 |
dialog.setDataSource(dialog.getCrsMainPanel().getDataSource()); |
498 |
if (dialog.getLastProj() != null){ |
499 |
/*
|
500 |
* Actualizar recientes...
|
501 |
*/
|
502 |
String authority = ((ICrs)dialog.getLastProj()).getCrsWkt().getAuthority()[0]; |
503 |
String name = ((ICrs)dialog.getLastProj()).getCrsWkt().getName();
|
504 |
int code = ((ICrs)dialog.getLastProj()).getCode();
|
505 |
CrsData crsData = new CrsData(authority,code,name);
|
506 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
507 |
persistence.addCrsData(crsData); |
508 |
|
509 |
PluginServices.getMDIManager().closeWindow(dialog); |
510 |
dialog.setOkPressed(true);
|
511 |
} |
512 |
else dialog.setOkPressed(false); |
513 |
} |
514 |
} |
515 |
} |
516 |
|
517 |
public void mouseEntered(MouseEvent e) { |
518 |
// TODO Auto-generated method stub
|
519 |
|
520 |
} |
521 |
|
522 |
public void mouseExited(MouseEvent e) { |
523 |
// TODO Auto-generated method stub
|
524 |
|
525 |
} |
526 |
|
527 |
public void mousePressed(MouseEvent e) { |
528 |
// TODO Auto-generated method stub
|
529 |
|
530 |
} |
531 |
|
532 |
public void mouseReleased(MouseEvent e) { |
533 |
// TODO Auto-generated method stub
|
534 |
|
535 |
} |
536 |
|
537 |
} |