root / org.gvsig.projection.jcrs / trunk / org.gvsig.projection.jcrs / org.gvsig.projection.app.jcrs / org.gvsig.projection.app.jcrs.common / src / main / java / org / gvsig / crs / gui / panels / TransformationManualPanel.java @ 320
History | View | Annotate | Download (18.3 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.panels; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
import java.awt.Color; |
45 |
import java.awt.GridLayout; |
46 |
import java.util.ArrayList; |
47 |
|
48 |
import javax.swing.BorderFactory; |
49 |
import javax.swing.JLabel; |
50 |
import javax.swing.JPanel; |
51 |
import javax.swing.JTextArea; |
52 |
import javax.swing.JTextField; |
53 |
import javax.swing.border.EmptyBorder; |
54 |
|
55 |
import org.gvsig.andami.PluginServices; |
56 |
import org.gvsig.crs.CrsFactory; |
57 |
import org.gvsig.crs.CrsWkt; |
58 |
import org.gvsig.crs.ICrs; |
59 |
import org.gvsig.crs.persistence.RecentTrsPersistence; |
60 |
import org.gvsig.crs.persistence.TrData; |
61 |
import org.slf4j.Logger; |
62 |
import org.slf4j.LoggerFactory; |
63 |
|
64 |
|
65 |
/**
|
66 |
* Clase que define el panel de tranformaciones manuales, as como su
|
67 |
* funcionamiento.
|
68 |
*
|
69 |
* @author Jos Luis Gmez Martnez (jolugomar@gmail.com)
|
70 |
* @author Luisa Marina Fernndez (luisam.fernandez@uclm.es)
|
71 |
*
|
72 |
*/
|
73 |
public class TransformationManualPanel extends JPanel { |
74 |
public static final Logger logger = LoggerFactory.getLogger(TransformationManualPanel.class); |
75 |
|
76 |
private static final long serialVersionUID = 1L; |
77 |
|
78 |
private static boolean pressed = true; |
79 |
|
80 |
private JLabel x_Translation; |
81 |
private JLabel y_Translation; |
82 |
private JLabel z_Translation; |
83 |
private JLabel x_Rotation; |
84 |
private JLabel y_Rotation; |
85 |
private JLabel z_Rotation; |
86 |
private JLabel scale; |
87 |
|
88 |
private JTextField tx_Translation; |
89 |
private JTextField ty_Translation; |
90 |
private JTextField tz_Translation; |
91 |
private JTextField tx_Rotation; |
92 |
private JTextField ty_Rotation; |
93 |
private JTextField tz_Rotation; |
94 |
private JTextField tScale; |
95 |
|
96 |
private JLabel domainTranslation; |
97 |
private JLabel domainRotation; |
98 |
private JLabel domainScale; |
99 |
|
100 |
//private JLabel wkt;
|
101 |
private JTextArea info; |
102 |
int codeEpsg;
|
103 |
String targetAbrev = ""; |
104 |
String sourceAbrev = ""; |
105 |
String[] targetAuthority; |
106 |
|
107 |
private String cadWKT = ""; |
108 |
|
109 |
public TransformationManualPanel() {
|
110 |
initialize(); |
111 |
} |
112 |
|
113 |
private void initialize(){ |
114 |
JPanel p=new JPanel(); |
115 |
p.setLayout(new GridLayout(7,3,10,10)); |
116 |
|
117 |
p.add(getX_Translation()); |
118 |
p.add(getTx_Translation()); |
119 |
p.add(getDomainTranslation()); |
120 |
|
121 |
p.add(getY_Translation()); |
122 |
p.add(getTy_Translation()); |
123 |
p.add(getDomainTranslation()); |
124 |
|
125 |
p.add(getZ_Translation()); |
126 |
p.add(getTz_Translation()); |
127 |
p.add(getDomainTranslation()); |
128 |
|
129 |
p.add(getX_Rotation()); |
130 |
p.add(getTx_Rotation()); |
131 |
p.add(getDomainRotation()); |
132 |
|
133 |
p.add(getY_Rotation()); |
134 |
p.add(getTy_Rotation()); |
135 |
p.add(getDomainRotation()); |
136 |
|
137 |
p.add(getZ_Rotation()); |
138 |
p.add(getTz_Rotation()); |
139 |
p.add(getDomainRotation()); |
140 |
|
141 |
p.add(getScale()); |
142 |
p.add(getTscale()); |
143 |
p.add(getDomainScale()); |
144 |
p.setBorder(new EmptyBorder(50,20,50,10)); |
145 |
this.setLayout(new BorderLayout(1,30)); |
146 |
this.setBorder(
|
147 |
BorderFactory.createCompoundBorder(
|
148 |
BorderFactory.createCompoundBorder(
|
149 |
BorderFactory.createTitledBorder(PluginServices.getText(this,"transformacion_manual")), |
150 |
BorderFactory.createEmptyBorder(2,2,2,2)), |
151 |
getBorder())); |
152 |
this.add(p,BorderLayout.CENTER); |
153 |
} |
154 |
|
155 |
private JLabel getDomainTranslation(){ |
156 |
domainTranslation = new JLabel(); |
157 |
domainTranslation.setText("[-1000.0, 1000.0]");
|
158 |
return domainTranslation;
|
159 |
} |
160 |
|
161 |
private JLabel getDomainRotation(){ |
162 |
domainRotation = new JLabel(); |
163 |
domainRotation.setText("[-60.0, 60.0]");
|
164 |
return domainRotation;
|
165 |
} |
166 |
|
167 |
private JLabel getDomainScale(){ |
168 |
domainScale = new JLabel(); |
169 |
domainScale.setText("[-20.0, 20.0]");
|
170 |
return domainScale;
|
171 |
} |
172 |
|
173 |
private JLabel getX_Translation() { |
174 |
if(x_Translation == null ) { |
175 |
x_Translation = new JLabel(); |
176 |
//x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
177 |
x_Translation.setText(PluginServices.getText(this,"x_Translation")+":"); |
178 |
} |
179 |
return x_Translation;
|
180 |
} |
181 |
|
182 |
private JLabel getY_Translation() { |
183 |
if(y_Translation == null ) { |
184 |
y_Translation = new JLabel(); |
185 |
//y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15));
|
186 |
y_Translation.setText(PluginServices.getText(this,"y_Translation")+":"); |
187 |
} |
188 |
return y_Translation;
|
189 |
} |
190 |
|
191 |
private JLabel getZ_Translation() { |
192 |
if(z_Translation == null ) { |
193 |
z_Translation = new JLabel(); |
194 |
//z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15));
|
195 |
z_Translation.setText(PluginServices.getText(this,"z_Translation")+":"); |
196 |
|
197 |
} |
198 |
return z_Translation;
|
199 |
} |
200 |
|
201 |
private JLabel getX_Rotation() { |
202 |
if(x_Rotation == null ) { |
203 |
x_Rotation = new JLabel(); |
204 |
//x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
205 |
x_Rotation.setText(PluginServices.getText(this,"x_Rotation")+":"); |
206 |
|
207 |
} |
208 |
return x_Rotation;
|
209 |
} |
210 |
|
211 |
private JLabel getY_Rotation() { |
212 |
if(y_Rotation == null ) { |
213 |
y_Rotation = new JLabel(); |
214 |
//y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
215 |
y_Rotation.setText(PluginServices.getText(this,"y_Rotation")+":"); |
216 |
|
217 |
} |
218 |
return y_Rotation;
|
219 |
} |
220 |
|
221 |
private JLabel getZ_Rotation() { |
222 |
if(z_Rotation == null ) { |
223 |
z_Rotation = new JLabel(); |
224 |
//z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
225 |
z_Rotation.setText(PluginServices.getText(this,"z_Rotation")+":"); |
226 |
|
227 |
} |
228 |
return z_Rotation;
|
229 |
} |
230 |
|
231 |
private JLabel getScale() { |
232 |
if(scale == null ) { |
233 |
scale = new JLabel(); |
234 |
//scale.setFont(new Font("scale:",Font.BOLD,15));
|
235 |
scale.setText(PluginServices.getText(this,"scale_factor_ppm")+":"); |
236 |
|
237 |
} |
238 |
return scale;
|
239 |
} |
240 |
|
241 |
public JTextField getTx_Translation() { |
242 |
if(tx_Translation == null ) { |
243 |
tx_Translation = new JTextField(); |
244 |
//tx_Translation.setFont(new Font("",Font.ITALIC,10));
|
245 |
tx_Translation.setText("0");
|
246 |
tx_Translation.setEditable(true);
|
247 |
//tx_Translation.addKeyListener(this);
|
248 |
} |
249 |
return tx_Translation;
|
250 |
} |
251 |
|
252 |
public JTextField getTy_Translation() { |
253 |
if(ty_Translation == null ) { |
254 |
ty_Translation = new JTextField(); |
255 |
//ty_Translation.setFont(new Font("",Font.ITALIC,10));
|
256 |
ty_Translation.setText("0");
|
257 |
ty_Translation.setEditable(true);
|
258 |
//ty_Translation.addKeyListener(this);
|
259 |
} |
260 |
return ty_Translation;
|
261 |
} |
262 |
|
263 |
public JTextField getTz_Translation() { |
264 |
if(tz_Translation == null ) { |
265 |
tz_Translation = new JTextField(); |
266 |
//tz_Translation.setFont(new Font("",Font.ITALIC,10));
|
267 |
tz_Translation.setText("0");
|
268 |
tz_Translation.setEditable(true);
|
269 |
//tz_Translation.addKeyListener(this);
|
270 |
} |
271 |
return tz_Translation;
|
272 |
} |
273 |
|
274 |
public JTextField getTx_Rotation() { |
275 |
if(tx_Rotation == null ) { |
276 |
tx_Rotation = new JTextField(); |
277 |
//tx_Rotation.setFont(new Font("",Font.ITALIC,10));
|
278 |
tx_Rotation.setText("0");
|
279 |
tx_Rotation.setEditable(true);
|
280 |
//tx_Rotation.addKeyListener(this);
|
281 |
} |
282 |
return tx_Rotation;
|
283 |
} |
284 |
|
285 |
public JTextField getTy_Rotation() { |
286 |
if(ty_Rotation == null ) { |
287 |
ty_Rotation = new JTextField(); |
288 |
//ty_Rotation.setFont(new Font("",Font.ITALIC,10));
|
289 |
ty_Rotation.setText("0");
|
290 |
ty_Rotation.setEditable(true);
|
291 |
//ty_Rotation.addKeyListener(this);
|
292 |
} |
293 |
return ty_Rotation;
|
294 |
} |
295 |
|
296 |
public JTextField getTz_Rotation() { |
297 |
if(tz_Rotation == null ) { |
298 |
tz_Rotation = new JTextField(); |
299 |
//tz_Rotation.setFont(new Font("",Font.ITALIC,10));
|
300 |
tz_Rotation.setText("0");
|
301 |
tz_Rotation.setEditable(true);
|
302 |
//tz_Rotation.addKeyListener(this);
|
303 |
} |
304 |
return tz_Rotation;
|
305 |
} |
306 |
|
307 |
public JTextField getTscale() { |
308 |
if(tScale == null ) { |
309 |
tScale = new JTextField(); |
310 |
//tScale.setFont(new Font("",Font.ITALIC,10));
|
311 |
tScale.setText("0");
|
312 |
tScale.setEditable(true);
|
313 |
//tScale.addKeyListener(this);
|
314 |
} |
315 |
return tScale;
|
316 |
} |
317 |
|
318 |
/**
|
319 |
*
|
320 |
* @return
|
321 |
*/
|
322 |
public ICrs getProjection() {
|
323 |
if(tx_Translation.getText().equals("")){ |
324 |
tx_Translation.setText("0");
|
325 |
} |
326 |
else if (ty_Translation.getText().equals("")){ |
327 |
ty_Translation.setText("0");
|
328 |
} |
329 |
else if (tz_Translation.getText().equals("")){ |
330 |
tz_Translation.setText("0");
|
331 |
} |
332 |
else if (tx_Rotation.getText().equals("")){ |
333 |
tx_Rotation.setText("0");
|
334 |
} |
335 |
else if (ty_Rotation.getText().equals("")){ |
336 |
ty_Rotation.setText("0");
|
337 |
} |
338 |
else if (tz_Rotation.getText().equals("")){ |
339 |
tz_Rotation.setText("0");
|
340 |
} |
341 |
else if (tScale.getText().equals("")){ |
342 |
tScale.setText("0");
|
343 |
} |
344 |
String param = "+towgs84="+ tx_Translation.getText()+","+ |
345 |
ty_Translation.getText()+","+
|
346 |
tz_Translation.getText()+","+
|
347 |
tx_Rotation.getText()+","+
|
348 |
ty_Rotation.getText()+","+
|
349 |
tz_Rotation.getText()+","+
|
350 |
tScale.getText() + " ";
|
351 |
|
352 |
String[] sourceAuthority = getSourceAbrev().split(":"); |
353 |
try {
|
354 |
ICrs crs = new CrsFactory().getCRS(sourceAuthority[0]+":"+getCode(),param,null); |
355 |
return crs;
|
356 |
} catch (org.gvsig.crs.CrsException e) {
|
357 |
logger.info("Can't create CRS with authority '"+sourceAuthority[0]+"', code "+this.getCode()+" and transformation params '"+param+"'.",e); |
358 |
|
359 |
} |
360 |
return null; |
361 |
} |
362 |
|
363 |
/**
|
364 |
*
|
365 |
* @param cod
|
366 |
*/
|
367 |
public void setCode(int cod){ |
368 |
codeEpsg = cod; |
369 |
} |
370 |
|
371 |
/**
|
372 |
*
|
373 |
* @return
|
374 |
*/
|
375 |
public int getCode(){ |
376 |
return codeEpsg;
|
377 |
} |
378 |
|
379 |
/**
|
380 |
*
|
381 |
* @param cad
|
382 |
*/
|
383 |
public void setWKT(String cad){ |
384 |
cadWKT = cad; |
385 |
CrsWkt parser = new CrsWkt(cad);
|
386 |
setSourceAbrev(parser.getAuthority()[0], parser.getAuthority()[1]); |
387 |
} |
388 |
|
389 |
/**
|
390 |
*
|
391 |
* @param cad
|
392 |
*/
|
393 |
public void setWKT(ICrs crs){ |
394 |
cadWKT = crs.getWKT(); |
395 |
setSourceAbrev(crs.getCrsWkt().getAuthority()[0], crs.getCrsWkt().getAuthority()[1]); |
396 |
} |
397 |
|
398 |
/**
|
399 |
*
|
400 |
* @return
|
401 |
*/
|
402 |
public String getWKT(){ |
403 |
return cadWKT;
|
404 |
} |
405 |
|
406 |
/**
|
407 |
*
|
408 |
* @return
|
409 |
*/
|
410 |
public static boolean isPressed() { return pressed; } |
411 |
|
412 |
|
413 |
/**
|
414 |
* metodo para comprobar si los JTextfile estan escritos
|
415 |
* correctamente los campos de la transformacion manual
|
416 |
*/
|
417 |
public boolean correctJTextField(){ |
418 |
boolean correct = true; |
419 |
|
420 |
if ((tx_Translation.getText().length()==0) || (tx_Translation.getText().length()!=verify(tx_Translation.getText()).length())){ |
421 |
tx_Translation.setText("0");
|
422 |
tx_Translation.setBackground(new Color(255,204,204)); |
423 |
correct = false;
|
424 |
} |
425 |
else tx_Translation.setBackground(new Color(255,255,255)); |
426 |
if ((ty_Translation.getText().length()==0) || (ty_Translation.getText().length()!=verify(ty_Translation.getText()).length())){ |
427 |
ty_Translation.setText("0");
|
428 |
ty_Translation.setBackground(new Color(255,204,204)); |
429 |
correct = false;
|
430 |
} |
431 |
else ty_Translation.setBackground(new Color(255,255,255)); |
432 |
if ((tz_Translation.getText().length()==0) || (tz_Translation.getText().length()!=verify(tz_Translation.getText()).length())){ |
433 |
tz_Translation.setText("0");
|
434 |
tz_Translation.setBackground(new Color(255,204,204)); |
435 |
correct = false;
|
436 |
} |
437 |
else tz_Translation.setBackground(new Color(255,255,255)); |
438 |
if ((tx_Rotation.getText().length() == 0) || (tx_Rotation.getText().length()!=verify(tx_Rotation.getText()).length())){ |
439 |
tx_Rotation.setText("0");
|
440 |
tx_Rotation.setBackground(new Color(255,204,204)); |
441 |
correct = false;
|
442 |
} |
443 |
else tx_Rotation.setBackground(new Color(255,255,255)); |
444 |
if ((ty_Rotation.getText().length() == 0) || (ty_Rotation.getText().length()!=verify(ty_Rotation.getText()).length())){ |
445 |
ty_Rotation.setText("0");
|
446 |
ty_Rotation.setBackground(new Color(255,204,204)); |
447 |
correct = false;
|
448 |
} |
449 |
else ty_Rotation.setBackground(new Color(255,255,255)); |
450 |
if ((tz_Rotation.getText().length() == 0) || (tz_Rotation.getText().length()!=verify(tz_Rotation.getText()).length())){ |
451 |
tz_Rotation.setText("0");
|
452 |
tz_Rotation.setBackground(new Color(255,204,204)); |
453 |
correct = false;
|
454 |
} |
455 |
else tz_Rotation.setBackground(new Color(255,255,255)); |
456 |
if ((tScale.getText().length() == 0) || (tScale.getText().length()!=verify(tScale.getText()).length())){ |
457 |
tScale.setText("0");
|
458 |
tScale.setBackground(new Color(255,204,204)); |
459 |
correct = false;
|
460 |
} |
461 |
else tScale.setBackground(new Color(255,255,255)); |
462 |
return correct;
|
463 |
} |
464 |
|
465 |
/**
|
466 |
* Verifica que el valor insertado en el campo JTextField correspondiente
|
467 |
* se corresponde con un valor nmerico y de tipo double
|
468 |
*
|
469 |
* @param cad
|
470 |
* @return
|
471 |
*/
|
472 |
private String verify(String cad) { |
473 |
String num_cad = ""; |
474 |
int pto = 0; |
475 |
char[] nums = {'0','1','2','3','4','5','6','7','8','9'}; |
476 |
if (cad.startsWith("-")) num_cad += "-"; |
477 |
for (int i=0; i< cad.length(); i++){ |
478 |
if (cad.charAt(i) == '.'){ |
479 |
if (cad.startsWith(".") || cad.endsWith(".") || pto>0); |
480 |
else {
|
481 |
pto++; |
482 |
num_cad += cad.charAt(i); |
483 |
} |
484 |
} |
485 |
else
|
486 |
for (int j=0; j< nums.length; j++) |
487 |
if (cad.charAt(i) == nums[j])
|
488 |
num_cad += cad.charAt(i); |
489 |
} |
490 |
return num_cad;
|
491 |
} |
492 |
|
493 |
/**
|
494 |
* Mira si los JTextField tienen dominios correctos
|
495 |
* @return
|
496 |
*/
|
497 |
public boolean correctDomain(){ |
498 |
boolean correctDomain = true; |
499 |
double tx = Double.parseDouble(tx_Translation.getText()); |
500 |
double ty = Double.parseDouble(ty_Translation.getText()); |
501 |
double tz = Double.parseDouble(tz_Translation.getText()); |
502 |
double rx = Double.parseDouble(tx_Rotation.getText()); |
503 |
double ry = Double.parseDouble(ty_Rotation.getText()); |
504 |
double rz = Double.parseDouble(tz_Rotation.getText()); |
505 |
double sc = Double.parseDouble(tScale.getText()); |
506 |
|
507 |
if (tx < -1000.0 || tx > 1000.0) { |
508 |
tx_Translation.setText("0");
|
509 |
tx_Translation.setBackground(new Color(255,204,204)); |
510 |
correctDomain = false;
|
511 |
} |
512 |
else tx_Translation.setBackground(new Color(255,255,255)); |
513 |
if (ty < -1000.0 || ty > 1000.0) { |
514 |
ty_Translation.setText("0");
|
515 |
ty_Translation.setBackground(new Color(255,204,204)); |
516 |
correctDomain = false;
|
517 |
} |
518 |
else ty_Translation.setBackground(new Color(255,255,255)); |
519 |
if (tz < -1000.0 || tz > 1000.0) { |
520 |
tz_Translation.setText("0");
|
521 |
tz_Translation.setBackground(new Color(255,204,204)); |
522 |
correctDomain = false;
|
523 |
} |
524 |
else tz_Translation.setBackground(new Color(255,255,255)); |
525 |
if (rx < -60.0 || rx > 60.0) { |
526 |
tx_Rotation.setText("0");
|
527 |
tx_Rotation.setBackground(new Color(255,204,204)); |
528 |
correctDomain = false;
|
529 |
} |
530 |
else tx_Rotation.setBackground(new Color(255,255,255)); |
531 |
if (ry < -60.0 || ry > 60.0) { |
532 |
ty_Rotation.setText("0");
|
533 |
ty_Rotation.setBackground(new Color(255,204,204)); |
534 |
correctDomain = false;
|
535 |
} |
536 |
else ty_Rotation.setBackground(new Color(255,255,255)); |
537 |
if (rz < -60.0 || rz > 60.0) { |
538 |
tz_Rotation.setText("0");
|
539 |
tz_Rotation.setBackground(new Color(255,204,204)); |
540 |
correctDomain = false;
|
541 |
} |
542 |
else tz_Rotation.setBackground(new Color(255,255,255)); |
543 |
if (sc < -20.0 || sc > 20.0) { |
544 |
tScale.setText("0");
|
545 |
tScale.setBackground(new Color(255,204,204)); |
546 |
correctDomain = false;
|
547 |
} |
548 |
else tScale.setBackground(new Color(255,255,255)); |
549 |
return correctDomain;
|
550 |
} |
551 |
|
552 |
/**
|
553 |
* Consigue el estado actual de los parmetros insertados. En caso
|
554 |
* de que todos los parmetros sean 0, o haya parmetros sin valor
|
555 |
* deshabilitar el botn de aceptar
|
556 |
* @return
|
557 |
*/
|
558 |
public boolean getStatus() { |
559 |
if ((tx_Translation.getText().equals("0") || tx_Translation.getText().equals("")) && |
560 |
(ty_Translation.getText().equals("0") || ty_Translation.getText().equals(""))&& |
561 |
(tz_Translation.getText().equals("0") || tz_Translation.getText().equals(""))&& |
562 |
(tx_Rotation.getText().equals("0") || tx_Rotation.getText().equals(""))&& |
563 |
(ty_Rotation.getText().equals("0") || ty_Rotation.getText().equals(""))&& |
564 |
(tz_Rotation.getText().equals("0") || tz_Rotation.getText().equals(""))&& |
565 |
(tScale.getText().equals("0") || tScale.getText().equals(""))) |
566 |
return false; |
567 |
else if (tx_Translation.getText().equals("") || |
568 |
(ty_Translation.getText().equals(""))||
|
569 |
(tz_Translation.getText().equals(""))||
|
570 |
(tx_Rotation.getText().equals(""))||
|
571 |
(ty_Rotation.getText().equals(""))||
|
572 |
(tz_Rotation.getText().equals(""))||
|
573 |
(tScale.getText().equals("")))
|
574 |
return false; |
575 |
return true; |
576 |
} |
577 |
|
578 |
public void setTargetAuthority(String[] authority){ |
579 |
targetAuthority = authority; |
580 |
setTargetAbrev(targetAuthority[0], targetAuthority[1]); |
581 |
} |
582 |
|
583 |
public void setTargetAbrev(String fuente, String codigo){ |
584 |
targetAbrev = fuente + ":" + codigo;
|
585 |
} |
586 |
|
587 |
public String getTargetAbrev() { |
588 |
return targetAbrev;
|
589 |
} |
590 |
|
591 |
public void setSourceAbrev(String fuente, String codigo){ |
592 |
sourceAbrev = fuente + ":" + codigo;
|
593 |
} |
594 |
|
595 |
public String getSourceAbrev(){ |
596 |
return sourceAbrev;
|
597 |
} |
598 |
|
599 |
public String getValues(){ |
600 |
return "["+tx_Translation.getText()+","+ty_Translation.getText()+ |
601 |
","+tz_Translation.getText()+","+tx_Rotation.getText()+","+ty_Rotation.getText()+"," |
602 |
+tz_Rotation.getText()+","+tScale.getText()+"]"; |
603 |
} |
604 |
|
605 |
/**
|
606 |
* cuando utilizamos crs+transformacion, cargamos los paneles para que
|
607 |
* el usuario pueda consultar la transformacion utilizada...
|
608 |
* @param details
|
609 |
*/
|
610 |
public void fillData(String details) { |
611 |
RecentTrsPersistence trPersistence = new RecentTrsPersistence();
|
612 |
TrData crsTrDataArray[] = trPersistence.getArrayOfTrData();
|
613 |
|
614 |
for (int iRow = crsTrDataArray.length-1; iRow >= 0; iRow--) { |
615 |
if (details.equals(crsTrDataArray[iRow].getAuthority()+":"+crsTrDataArray[iRow].getCode()+" <--> "+crsTrDataArray[iRow].getDetails()) && crsTrDataArray[iRow].getAuthority().equals(PluginServices.getText(this, "USR"))) { |
616 |
String data = crsTrDataArray[iRow].getDetails();
|
617 |
data = data.trim().substring(1, data.length()-1); |
618 |
String values[] = data.split(","); |
619 |
tx_Translation.setText(values[0]);
|
620 |
ty_Translation.setText(values[1]);
|
621 |
tz_Translation.setText(values[2]);
|
622 |
tx_Rotation.setText(values[3]);
|
623 |
ty_Rotation.setText(values[4]);
|
624 |
tz_Rotation.setText(values[5]);
|
625 |
tScale.setText(values[6]);
|
626 |
break;
|
627 |
} |
628 |
} |
629 |
} |
630 |
|
631 |
/**
|
632 |
* metodo para eliminar la informacion previamente cargada
|
633 |
*
|
634 |
*/
|
635 |
public void resetData() { |
636 |
tx_Translation.setText("0");
|
637 |
ty_Translation.setText("0");
|
638 |
tz_Translation.setText("0");
|
639 |
tx_Rotation.setText("0");
|
640 |
ty_Rotation.setText("0");
|
641 |
tz_Rotation.setText("0");
|
642 |
tScale.setText("0");
|
643 |
} |
644 |
|
645 |
} |