root / org.gvsig.jcrs / extJCRS / src / org / gvsig / crs / gui / listeners / TransformationCompuestaPanelListener.java @ 40
History | View | Annotate | Download (23.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 |
package org.gvsig.crs.gui.listeners; |
42 |
|
43 |
import java.awt.CardLayout; |
44 |
import java.awt.event.ActionEvent; |
45 |
import java.awt.event.ActionListener; |
46 |
import java.awt.event.ItemEvent; |
47 |
import java.awt.event.ItemListener; |
48 |
import java.awt.event.KeyEvent; |
49 |
import java.awt.event.KeyListener; |
50 |
import java.awt.event.MouseEvent; |
51 |
import java.awt.event.MouseListener; |
52 |
import java.sql.ResultSet; |
53 |
import java.sql.SQLException; |
54 |
|
55 |
import javax.swing.JComboBox; |
56 |
import javax.swing.ListSelectionModel; |
57 |
import javax.swing.event.ListSelectionEvent; |
58 |
import javax.swing.event.ListSelectionListener; |
59 |
|
60 |
import org.gvsig.andami.PluginServices; |
61 |
import org.gvsig.crs.gui.CRSMainTrPanel; |
62 |
import org.gvsig.crs.gui.panels.InfoCRSPanel; |
63 |
import org.gvsig.crs.gui.panels.InfoTransformationsRecentsPanel; |
64 |
import org.gvsig.crs.gui.panels.TransformationCapaPanel; |
65 |
import org.gvsig.crs.gui.panels.TransformationVistaPanel; |
66 |
import org.gvsig.crs.ogr.TransEPSG; |
67 |
|
68 |
|
69 |
import es.idr.teledeteccion.connection.Query; |
70 |
|
71 |
/**
|
72 |
* Esta clase contiene todos los listeners necesarios para el manejo
|
73 |
* de los eventos del panel de la definicion de una transformacion
|
74 |
* compuesta entre los crs de la vista y de la capa
|
75 |
*
|
76 |
* @author Jos Luis Gmez Martnez (jolugomar@gmail.com)
|
77 |
*
|
78 |
*/
|
79 |
|
80 |
public class TransformationCompuestaPanelListener implements ActionListener, |
81 |
ListSelectionListener, ItemListener, KeyListener { |
82 |
|
83 |
TransformationCapaPanel capa = null;
|
84 |
TransformationVistaPanel vista = null;
|
85 |
private CRSMainTrPanel panel = null; |
86 |
boolean condition = false; |
87 |
|
88 |
|
89 |
public TransformationCompuestaPanelListener(TransformationCapaPanel p, CRSMainTrPanel pa) {
|
90 |
capa = p; |
91 |
panel = pa; |
92 |
} |
93 |
|
94 |
public TransformationCompuestaPanelListener(TransformationVistaPanel p, CRSMainTrPanel pa) {
|
95 |
vista = p; |
96 |
panel = pa; |
97 |
} |
98 |
|
99 |
public void actionPerformed(ActionEvent e) { |
100 |
if (capa != null) { |
101 |
if( e.getSource() == capa.getRecentsTrPanel().getJButtonInfo()){
|
102 |
String[] data = new String[5]; |
103 |
data[0] = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,0); |
104 |
data[1] = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,1); |
105 |
data[2] = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,2); |
106 |
data[3] = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,3); |
107 |
data[4] = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,4); |
108 |
|
109 |
//Mostrar el panel de informacin de las transformaciones recientes
|
110 |
InfoCRSPanel info = new InfoCRSPanel(data[2].split(":")[0], Integer.parseInt(data[2].split(":")[1]) , data[0]+" <--> "+ data[4]); |
111 |
PluginServices.getMDIManager().addWindow(info); |
112 |
} |
113 |
//Al cambiar el item seleccionado del combo
|
114 |
if(e.getSource().equals(capa.getJComboOptions())){
|
115 |
CardLayout cl = (CardLayout)(capa.getPCenter().getLayout()); |
116 |
if(capa.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"recents_transformation"))){ |
117 |
//Mostrar el panel de transformacin reciente
|
118 |
cl.show(capa.getPCenter(), "recents");
|
119 |
if (capa.getRecentsTrPanel().selectedRowTable == -1) { |
120 |
capa.setSourceTransformation(null);
|
121 |
panel.getJButtonNext().setEnabled(false);
|
122 |
} else {
|
123 |
String[] transform = ((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
124 |
if (transform[0].equals("USR")){ |
125 |
capa.getRecentsTrPanel().setParamsManual((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,4)); |
126 |
capa.setSourceTransformation(capa.getRecentsTrPanel().getParams()); |
127 |
} |
128 |
if (transform[0].equals("EPSG")){ |
129 |
TransEPSG epsgParams = new TransEPSG(capa.getRecentsTrPanel().getTrCode(),capa.getEpsgTrPanel().connect, capa.getRecentsTrPanel().getInverseTransformation());
|
130 |
capa.getRecentsTrPanel().setParamsEPGS(epsgParams.getParamValue()); |
131 |
capa.setSourceTransformation(capa.getRecentsTrPanel().getParams()); |
132 |
} |
133 |
if (transform[0].equals("NADGR")){ |
134 |
String p = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,4); |
135 |
capa.setSourceTransformation(capa.getNadsParams(p)); |
136 |
} |
137 |
panel.getJButtonNext().setEnabled(true);
|
138 |
} |
139 |
} |
140 |
else if(capa.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"transformacion_epsg"))){ |
141 |
//mostrar el panel de transformacin epsg
|
142 |
cl.show(capa.getPCenter(), "epsg");
|
143 |
if (capa.getEpsgTrPanel().selectedRowTable == -1) { |
144 |
capa.setSourceTransformation(null);
|
145 |
panel.getJButtonNext().setEnabled(false);
|
146 |
} else {
|
147 |
TransEPSG epsgParams = new TransEPSG(capa.getEpsgTrPanel().getTransformation_code(),capa.getEpsgTrPanel().connect, capa.getEpsgTrPanel().inverseTranformation);
|
148 |
capa.getEpsgTrPanel().setValues(epsgParams.getParamValue()); |
149 |
capa.setSourceTransformation(capa.getParamsEpsg(capa.getEpsgTrPanel().getValues())); |
150 |
panel.getJButtonNext().setEnabled(true);
|
151 |
} |
152 |
} |
153 |
else if(capa.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"transformacion_manual"))){ |
154 |
//mostrar el panel de transformacin manual
|
155 |
cl.show(capa.getPCenter(), "manual");
|
156 |
if(!capa.getManualTrPanel().getStatus())
|
157 |
panel.getJButtonNext().setEnabled(false);
|
158 |
else {
|
159 |
panel.getJButtonNext().setEnabled(true);
|
160 |
capa.setSourceTransformation(capa.getManualParams()); |
161 |
} |
162 |
|
163 |
} |
164 |
else if(capa.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"nadgrids"))){ |
165 |
//mostrar el panel de nadgrids
|
166 |
cl.show(capa.getPCenter(), "nad");
|
167 |
if (capa.getNadsTrPanel().getJComboNadFile().getSelectedIndex()!=0) { |
168 |
capa.setSourceTransformation("+nadgrids="+capa.getNadsTrPanel().getNadFile());
|
169 |
panel.getJButtonNext().setEnabled(true);
|
170 |
} |
171 |
else {
|
172 |
capa.setSourceTransformation(null);
|
173 |
panel.getJButtonNext().setEnabled(false);
|
174 |
} |
175 |
} |
176 |
} |
177 |
} |
178 |
|
179 |
if (vista != null) { |
180 |
if( e.getSource() == vista.getRecentsTrPanel().getJButtonInfo()){
|
181 |
String[] data = new String[5]; |
182 |
data[0] = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,0); |
183 |
data[1] = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,1); |
184 |
data[2] = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,2); |
185 |
data[3] = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,3); |
186 |
data[4] = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,4); |
187 |
|
188 |
//Mostrar el panel de informacin de las transformaciones recientes
|
189 |
InfoCRSPanel info = new InfoCRSPanel(data[2].split(":")[0], Integer.parseInt(data[2].split(":")[1]) , data[0]+" <--> "+ data[4]); |
190 |
PluginServices.getMDIManager().addWindow(info); |
191 |
} |
192 |
//Al cambiar el item seleccionado del combo
|
193 |
if(e.getSource().equals(vista.getJComboOptions())){
|
194 |
CardLayout cl = (CardLayout)(vista.getPCenter().getLayout()); |
195 |
if(vista.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"recents_transformation"))){ |
196 |
//Mostrar el panel de transformacin reciente
|
197 |
cl.show(vista.getPCenter(), "recents");
|
198 |
if (vista.getRecentsTrPanel().selectedRowTable == -1) { |
199 |
vista.setTargetTransformation(null);
|
200 |
panel.getJButtonAccept().setEnabled(false);
|
201 |
} else {
|
202 |
String[] transform = ((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
203 |
if (transform[0].equals("USR")){ |
204 |
vista.getRecentsTrPanel().setParamsManual((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,4)); |
205 |
vista.setTargetTransformation(vista.getRecentsTrPanel().getParams()); |
206 |
} |
207 |
if (transform[0].equals("EPSG")){ |
208 |
TransEPSG epsgParams = new TransEPSG(vista.getRecentsTrPanel().getTrCode(),vista.getEpsgTrPanel().connect, vista.getRecentsTrPanel().getInverseTransformation());
|
209 |
vista.getRecentsTrPanel().setParamsEPGS(epsgParams.getParamValue()); |
210 |
vista.setTargetTransformation(vista.getRecentsTrPanel().getParams()); |
211 |
} |
212 |
if (transform[0].equals("NADGR")){ |
213 |
String p = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,4); |
214 |
vista.setTargetTransformation(vista.getNadsParams(p)); |
215 |
} |
216 |
panel.getJButtonAccept().setEnabled(true);
|
217 |
} |
218 |
} |
219 |
else if(vista.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"transformacion_epsg"))){ |
220 |
//mostrar el panel de transformacin epsg
|
221 |
cl.show(vista.getPCenter(), "epsg");
|
222 |
if (vista.getEpsgTrPanel().selectedRowTable == -1) { |
223 |
vista.setTargetTransformation(null);
|
224 |
panel.getJButtonAccept().setEnabled(false);
|
225 |
} else {
|
226 |
TransEPSG epsgParams = new TransEPSG(vista.getEpsgTrPanel().getTransformation_code(),vista.getEpsgTrPanel().connect, vista.getEpsgTrPanel().inverseTranformation);
|
227 |
vista.getEpsgTrPanel().setValues(epsgParams.getParamValue()); |
228 |
vista.setTargetTransformation(vista.getParamsEpsg(vista.getEpsgTrPanel().getValues())); |
229 |
panel.getJButtonAccept().setEnabled(true);
|
230 |
} |
231 |
|
232 |
} |
233 |
else if(vista.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"transformacion_manual"))){ |
234 |
//mostrar el panel de transformacin manual
|
235 |
cl.show(vista.getPCenter(), "manual");
|
236 |
if(!vista.getManualTrPanel().getStatus())
|
237 |
panel.getJButtonAccept().setEnabled(false);
|
238 |
else {
|
239 |
panel.getJButtonAccept().setEnabled(true);
|
240 |
vista.setTargetTransformation(vista.getManualParams()); |
241 |
} |
242 |
} |
243 |
else if(vista.getJComboOptions().getSelectedItem().equals(PluginServices.getText(this,"nadgrids"))){ |
244 |
//mostrar el panel de nadgrids
|
245 |
cl.show(vista.getPCenter(), "nad");
|
246 |
if (vista.getNadsTrPanel().getJComboNadFile().getSelectedIndex()!=0) { |
247 |
vista.setTargetTransformation("+nadgrids="+vista.getNadsTrPanel().getNadFile());
|
248 |
panel.getJButtonAccept().setEnabled(true);
|
249 |
} |
250 |
else {
|
251 |
vista.setTargetTransformation(null);
|
252 |
panel.getJButtonAccept().setEnabled(false);
|
253 |
} |
254 |
} |
255 |
} |
256 |
} |
257 |
} |
258 |
|
259 |
public void valueChanged(ListSelectionEvent e) { |
260 |
if (capa != null) { |
261 |
if (e.getSource() == capa.getEpsgTrPanel().getJTable().getSelectionModel()){
|
262 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
263 |
if (lsm.isSelectionEmpty()) {
|
264 |
capa.getEpsgTrPanel().selectedRowTable = -1;
|
265 |
panel.getJButtonNext().setEnabled(false);
|
266 |
if (panel.getJButtonAccept().isEnabled()) {
|
267 |
condition = true;
|
268 |
} |
269 |
panel.getJButtonAccept().setEnabled(false);
|
270 |
} |
271 |
else {
|
272 |
capa.getEpsgTrPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
273 |
capa.getEpsgTrPanel().setTrasformation_code(Integer.parseInt((String)capa.getEpsgTrPanel().sorter.getValueAt(capa.getEpsgTrPanel().selectedRowTable,0))); |
274 |
String sentence = "SELECT target_crs_code " + |
275 |
"FROM epsg_coordoperation " +
|
276 |
"WHERE coord_op_code = " + capa.getEpsgTrPanel().getTransformation_code() ;
|
277 |
ResultSet result = Query.select(sentence,capa.getEpsgTrPanel().connect.getConnection()); |
278 |
try {
|
279 |
result.next(); |
280 |
int tar = result.getInt("target_crs_code"); |
281 |
if (tar == capa.getEpsgTrPanel().crs_target)
|
282 |
capa.getEpsgTrPanel().inverseTranformation = false;
|
283 |
else capa.getEpsgTrPanel().inverseTranformation = true; |
284 |
} catch (SQLException e1) { |
285 |
e1.printStackTrace(); |
286 |
} |
287 |
|
288 |
TransEPSG epsgParams = new TransEPSG(capa.getEpsgTrPanel().getTransformation_code(),capa.getEpsgTrPanel().connect, capa.getEpsgTrPanel().inverseTranformation);
|
289 |
capa.getEpsgTrPanel().setValues(epsgParams.getParamValue()); |
290 |
capa.setSourceTransformation(capa.getParamsEpsg(capa.getEpsgTrPanel().getValues())); |
291 |
if (condition) {
|
292 |
panel.getJButtonAccept().setEnabled(true);
|
293 |
condition = false;
|
294 |
} |
295 |
panel.getJButtonNext().setEnabled(true);
|
296 |
} |
297 |
} |
298 |
|
299 |
/*
|
300 |
* una vez cambiamos la transformacion a elegir, habra que ver que parametros
|
301 |
* tenemos que definir para que cuando aceptemos hayan sido definidos
|
302 |
* anteriormente
|
303 |
*/
|
304 |
if (e.getSource() == capa.getRecentsTrPanel().getJTable().getSelectionModel()){
|
305 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
306 |
if (lsm.isSelectionEmpty()) {
|
307 |
capa.getRecentsTrPanel().selectedRowTable = -1;
|
308 |
capa.getRecentsTrPanel().setCode(0);
|
309 |
panel.getJButtonNext().setEnabled(false);
|
310 |
capa.getRecentsTrPanel().getJButtonInfo().setEnabled(false);
|
311 |
if (panel.getJButtonAccept().isEnabled()) {
|
312 |
condition = true;
|
313 |
} |
314 |
panel.getJButtonAccept().setEnabled(false);
|
315 |
} |
316 |
else {
|
317 |
capa.getRecentsTrPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
318 |
String[] cad = ((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,2)).split(":"); |
319 |
capa.getRecentsTrPanel().setCode(Integer.parseInt(cad[1])); |
320 |
String[] transformation = ((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
321 |
if (transformation[0].equals("EPSG")){ |
322 |
capa.getRecentsTrPanel().setTrCode(Integer.parseInt(transformation[1])); |
323 |
} |
324 |
capa.getRecentsTrPanel().getJButtonInfo().setEnabled(true);
|
325 |
|
326 |
String[] transform = ((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
327 |
if (transform[0].equals("USR")){ |
328 |
capa.getRecentsTrPanel().setParamsManual((String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,4)); |
329 |
capa.setSourceTransformation(capa.getRecentsTrPanel().getParams()); |
330 |
} |
331 |
if (transform[0].equals("EPSG")){ |
332 |
TransEPSG epsgParams = new TransEPSG(capa.getRecentsTrPanel().getTrCode(),capa.getEpsgTrPanel().connect, capa.getRecentsTrPanel().getInverseTransformation());
|
333 |
capa.getRecentsTrPanel().setParamsEPGS(epsgParams.getParamValue()); |
334 |
capa.setSourceTransformation(capa.getRecentsTrPanel().getParams()); |
335 |
} |
336 |
if (transform[0].equals("NADGR")){ |
337 |
String p = (String)capa.getRecentsTrPanel().sorter.getValueAt(capa.getRecentsTrPanel().selectedRowTable,4); |
338 |
capa.setSourceTransformation(capa.getNadsParams(p)); |
339 |
} |
340 |
panel.getJButtonNext().setEnabled(true);
|
341 |
if (condition = true) { |
342 |
panel.getJButtonAccept().setEnabled(true);
|
343 |
condition = false;
|
344 |
} |
345 |
} |
346 |
} |
347 |
} |
348 |
|
349 |
if (vista != null) { |
350 |
if (e.getSource() == vista.getEpsgTrPanel().getJTable().getSelectionModel()){
|
351 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
352 |
if (lsm.isSelectionEmpty()) {
|
353 |
vista.getEpsgTrPanel().selectedRowTable = -1;
|
354 |
panel.getJButtonAccept().setEnabled(false);
|
355 |
} |
356 |
else {
|
357 |
vista.getEpsgTrPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
358 |
vista.getEpsgTrPanel().setTrasformation_code(Integer.parseInt((String)vista.getEpsgTrPanel().sorter.getValueAt(vista.getEpsgTrPanel().selectedRowTable,0))); |
359 |
String sentence = "SELECT target_crs_code " + |
360 |
"FROM epsg_coordoperation " +
|
361 |
"WHERE coord_op_code = " + vista.getEpsgTrPanel().getTransformation_code() ;
|
362 |
ResultSet result = Query.select(sentence,vista.getEpsgTrPanel().connect.getConnection()); |
363 |
try {
|
364 |
result.next(); |
365 |
int tar = result.getInt("target_crs_code"); |
366 |
if (tar == vista.getEpsgTrPanel().crs_target)
|
367 |
vista.getEpsgTrPanel().inverseTranformation = false;
|
368 |
else vista.getEpsgTrPanel().inverseTranformation = true; |
369 |
} catch (SQLException e1) { |
370 |
e1.printStackTrace(); |
371 |
} |
372 |
|
373 |
/**
|
374 |
* revisar esto
|
375 |
*/
|
376 |
TransEPSG epsgParams = new TransEPSG(vista.getEpsgTrPanel().getTransformation_code(),vista.getEpsgTrPanel().connect, vista.getEpsgTrPanel().inverseTranformation);
|
377 |
vista.getEpsgTrPanel().setValues(epsgParams.getParamValue()); |
378 |
vista.setTargetTransformation(vista.getParamsEpsg(vista.getEpsgTrPanel().getValues())); |
379 |
panel.getJButtonAccept().setEnabled(true);
|
380 |
} |
381 |
} |
382 |
|
383 |
/*
|
384 |
* una vez cambiamos la transformacion a elegir, habra que ver que parametros
|
385 |
* tenemos que definir para que cuando aceptemos hayan sido definidos
|
386 |
* anteriormente
|
387 |
*/
|
388 |
if (e.getSource() == vista.getRecentsTrPanel().getJTable().getSelectionModel()){
|
389 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
390 |
if (lsm.isSelectionEmpty()) {
|
391 |
vista.getRecentsTrPanel().selectedRowTable = -1;
|
392 |
vista.getRecentsTrPanel().setCode(0);
|
393 |
panel.getJButtonAccept().setEnabled(false);
|
394 |
vista.getRecentsTrPanel().getJButtonInfo().setEnabled(false);
|
395 |
} |
396 |
else {
|
397 |
vista.getRecentsTrPanel().selectedRowTable = lsm.getMinSelectionIndex(); |
398 |
String[] cad = ((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,2)).split(":"); |
399 |
vista.getRecentsTrPanel().setCode(Integer.parseInt(cad[1])); |
400 |
String[] transformation = ((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
401 |
if (transformation[0].equals("EPSG")){ |
402 |
vista.getRecentsTrPanel().setTrCode(Integer.parseInt(transformation[1])); |
403 |
} |
404 |
vista.getRecentsTrPanel().getJButtonInfo().setEnabled(true);
|
405 |
|
406 |
/**
|
407 |
* revisar esto
|
408 |
*/
|
409 |
String[] transform = ((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,0)).split(":"); |
410 |
if (transform[0].equals("USR")){ |
411 |
vista.getRecentsTrPanel().setParamsManual((String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,4)); |
412 |
vista.setTargetTransformation(vista.getRecentsTrPanel().getParams()); |
413 |
} |
414 |
if (transform[0].equals("EPSG")){ |
415 |
TransEPSG epsgParams = new TransEPSG(vista.getRecentsTrPanel().getTrCode(),vista.getEpsgTrPanel().connect, vista.getRecentsTrPanel().getInverseTransformation());
|
416 |
vista.getRecentsTrPanel().setParamsEPGS(epsgParams.getParamValue()); |
417 |
vista.setTargetTransformation(vista.getRecentsTrPanel().getParams()); |
418 |
} |
419 |
if (transform[0].equals("NADGR")){ |
420 |
String p = (String)vista.getRecentsTrPanel().sorter.getValueAt(vista.getRecentsTrPanel().selectedRowTable,4); |
421 |
vista.setTargetTransformation(vista.getNadsParams(p)); |
422 |
} |
423 |
|
424 |
panel.getJButtonAccept().setEnabled(true);
|
425 |
} |
426 |
} |
427 |
} |
428 |
} |
429 |
|
430 |
public void itemStateChanged(ItemEvent e) { |
431 |
if (capa != null) { |
432 |
if (e.getSource() == capa.getNadsTrPanel().getJComboNadFile()){
|
433 |
if (capa.getNadsTrPanel().getJComboNadFile().getSelectedIndex()!=0){ |
434 |
capa.getNadsTrPanel().setNadFile(capa.getNadsTrPanel().getJComboNadFile().getSelectedItem().toString());//nadFile = getJComboNadFile().getSelectedItem().toString();
|
435 |
capa.getNadsTrPanel().getTreePanel().setRoot(PluginServices.getText(this,"grids_en")+": "+capa.getNadsTrPanel().getNadFile());//nadFile); |
436 |
capa.getNadsTrPanel().initializeTree(); |
437 |
// Guardar en persistencia nadFile:
|
438 |
capa.getNadsTrPanel().saveNadFileName(capa.getNadsTrPanel().getNadFile());//nadFile);
|
439 |
capa.setSourceTransformation("+nadgrids="+capa.getNadsTrPanel().getNadFile());
|
440 |
panel.getJButtonNext().setEnabled(true);
|
441 |
if(condition) {
|
442 |
panel.getJButtonAccept().setEnabled(true);
|
443 |
condition = false;
|
444 |
} |
445 |
} |
446 |
else{
|
447 |
capa.getNadsTrPanel().setNadFile(null);//nadFile = null; |
448 |
capa.getNadsTrPanel().getTreePanel().setRoot("");
|
449 |
capa.setSourceTransformation(null);
|
450 |
panel.getJButtonNext().setEnabled(false);
|
451 |
if (panel.getJButtonAccept().isEnabled())
|
452 |
condition = true;
|
453 |
panel.getJButtonAccept().setEnabled(false);
|
454 |
} |
455 |
|
456 |
} |
457 |
} |
458 |
|
459 |
if (vista != null) { |
460 |
if (e.getSource() == vista.getNadsTrPanel().getJComboNadFile()){
|
461 |
if (vista.getNadsTrPanel().getJComboNadFile().getSelectedIndex()!=0){ |
462 |
vista.getNadsTrPanel().setNadFile(vista.getNadsTrPanel().getJComboNadFile().getSelectedItem().toString());//nadFile = getJComboNadFile().getSelectedItem().toString();
|
463 |
vista.getNadsTrPanel().getTreePanel().setRoot(PluginServices.getText(this,"grids_en")+": "+vista.getNadsTrPanel().getNadFile());//nadFile); |
464 |
vista.getNadsTrPanel().initializeTree(); |
465 |
// Guardar en persistencia nadFile:
|
466 |
vista.getNadsTrPanel().saveNadFileName(vista.getNadsTrPanel().getNadFile());//nadFile);
|
467 |
vista.setTargetTransformation("+nadgrids="+vista.getNadsTrPanel().getNadFile());
|
468 |
panel.getJButtonAccept().setEnabled(true);
|
469 |
} |
470 |
else{
|
471 |
vista.getNadsTrPanel().setNadFile(null);//nadFile = null; |
472 |
vista.getNadsTrPanel().getTreePanel().setRoot("");
|
473 |
vista.setTargetTransformation(null);
|
474 |
panel.getJButtonAccept().setEnabled(false);
|
475 |
} |
476 |
|
477 |
} |
478 |
} |
479 |
} |
480 |
|
481 |
public void keyPressed(KeyEvent e) { |
482 |
// TODO Auto-generated method stub
|
483 |
|
484 |
} |
485 |
|
486 |
public void keyReleased(KeyEvent e) { |
487 |
if (capa != null) { |
488 |
if(!capa.getManualTrPanel().getStatus())
|
489 |
panel.getJButtonNext().setEnabled(false);
|
490 |
else {
|
491 |
panel.getJButtonNext().setEnabled(true);
|
492 |
capa.setSourceTransformation(capa.getManualParams()); |
493 |
} |
494 |
} |
495 |
|
496 |
if (vista != null) { |
497 |
if(!vista.getManualTrPanel().getStatus())
|
498 |
panel.getJButtonAccept().setEnabled(false);
|
499 |
else {
|
500 |
panel.getJButtonAccept().setEnabled(true);
|
501 |
vista.setTargetTransformation(vista.getManualParams()); |
502 |
} |
503 |
} |
504 |
} |
505 |
|
506 |
public void keyTyped(KeyEvent e) { |
507 |
// TODO Auto-generated method stub
|
508 |
|
509 |
} |
510 |
|
511 |
} |