root / branches / F2 / extensions / extJCRS / src / org / gvsig / crs / gui / panels / TransformationManualPanel.java @ 10786
History | View | Annotate | Download (16.7 KB)
1 | 10301 | dguerrero | /* gvSIG. Sistema de Informaci?n Geogr?fica 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 Ib??ez, 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 | 10786 | lmfernandez | import java.awt.BorderLayout; |
44 | 10301 | dguerrero | import java.awt.Color; |
45 | import java.awt.Component; |
||
46 | import java.awt.Dimension; |
||
47 | import java.awt.GridLayout; |
||
48 | |||
49 | import javax.swing.BorderFactory; |
||
50 | import javax.swing.JLabel; |
||
51 | import javax.swing.JPanel; |
||
52 | import javax.swing.JTextArea; |
||
53 | import javax.swing.JTextField; |
||
54 | 10786 | lmfernandez | import javax.swing.border.EmptyBorder; |
55 | 10301 | dguerrero | |
56 | import org.gvsig.crs.CrsFactory; |
||
57 | import org.gvsig.crs.CrsWkt; |
||
58 | import org.gvsig.crs.ICrs; |
||
59 | |||
60 | import com.iver.andami.PluginServices; |
||
61 | |||
62 | /**
|
||
63 | * Clase que define el panel de tranformaciones manuales, as? como su
|
||
64 | * funcionamiento.
|
||
65 | *
|
||
66 | * @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com)
|
||
67 | 10786 | lmfernandez | * @author Luisa Marina Fern?ndez (luisam.fernandez@uclm.es)
|
68 | 10301 | dguerrero | *
|
69 | */
|
||
70 | public class TransformationManualPanel extends JPanel { |
||
71 | |||
72 | private static final long serialVersionUID = 1L; |
||
73 | |||
74 | private static boolean pressed = true; |
||
75 | |||
76 | private JLabel x_Translation; |
||
77 | private JLabel y_Translation; |
||
78 | private JLabel z_Translation; |
||
79 | private JLabel x_Rotation; |
||
80 | private JLabel y_Rotation; |
||
81 | private JLabel z_Rotation; |
||
82 | private JLabel scale; |
||
83 | |||
84 | private JTextField tx_Translation; |
||
85 | private JTextField ty_Translation; |
||
86 | private JTextField tz_Translation; |
||
87 | private JTextField tx_Rotation; |
||
88 | private JTextField ty_Rotation; |
||
89 | private JTextField tz_Rotation; |
||
90 | private JTextField tScale; |
||
91 | |||
92 | private JLabel domainTranslation; |
||
93 | private JLabel domainRotation; |
||
94 | private JLabel domainScale; |
||
95 | |||
96 | 10786 | lmfernandez | //private JLabel wkt;
|
97 | 10301 | dguerrero | private JTextArea info; |
98 | int codeEpsg;
|
||
99 | String targetAbrev = ""; |
||
100 | String sourceAbrev = ""; |
||
101 | String[] targetAuthority; |
||
102 | |||
103 | private String cadWKT = ""; |
||
104 | |||
105 | public TransformationManualPanel() {
|
||
106 | initialize(); |
||
107 | } |
||
108 | |||
109 | private void initialize(){ |
||
110 | 10786 | lmfernandez | JPanel p=new JPanel(); |
111 | p.setLayout(new GridLayout(7,3,10,10)); |
||
112 | |||
113 | p.add(getX_Translation()); |
||
114 | p.add(getTx_Translation()); |
||
115 | p.add(getDomainTranslation()); |
||
116 | |||
117 | p.add(getY_Translation()); |
||
118 | p.add(getTy_Translation()); |
||
119 | p.add(getDomainTranslation()); |
||
120 | |||
121 | p.add(getZ_Translation()); |
||
122 | p.add(getTz_Translation()); |
||
123 | p.add(getDomainTranslation()); |
||
124 | |||
125 | p.add(getX_Rotation()); |
||
126 | p.add(getTx_Rotation()); |
||
127 | p.add(getDomainRotation()); |
||
128 | |||
129 | p.add(getY_Rotation()); |
||
130 | p.add(getTy_Rotation()); |
||
131 | p.add(getDomainRotation()); |
||
132 | |||
133 | p.add(getZ_Rotation()); |
||
134 | p.add(getTz_Rotation()); |
||
135 | p.add(getDomainRotation()); |
||
136 | |||
137 | p.add(getScale()); |
||
138 | p.add(getTscale()); |
||
139 | p.add(getDomainScale()); |
||
140 | p.setBorder(new EmptyBorder(50,20,50,10)); |
||
141 | this.setLayout(new BorderLayout(1,30)); |
||
142 | this.setBorder(
|
||
143 | BorderFactory.createCompoundBorder(
|
||
144 | BorderFactory.createCompoundBorder(
|
||
145 | BorderFactory.createTitledBorder(PluginServices.getText(this,"transformacion_manual")), |
||
146 | BorderFactory.createEmptyBorder(2,2,2,2)), |
||
147 | getBorder())); |
||
148 | this.add(p,BorderLayout.CENTER); |
||
149 | 10301 | dguerrero | } |
150 | |||
151 | private JLabel getDomainTranslation(){ |
||
152 | domainTranslation = new JLabel(); |
||
153 | domainTranslation.setText("[-1000.0, 1000.0]");
|
||
154 | return domainTranslation;
|
||
155 | } |
||
156 | |||
157 | private JLabel getDomainRotation(){ |
||
158 | domainRotation = new JLabel(); |
||
159 | domainRotation.setText("[-60.0, 60.0]");
|
||
160 | return domainRotation;
|
||
161 | } |
||
162 | |||
163 | private JLabel getDomainScale(){ |
||
164 | domainScale = new JLabel(); |
||
165 | domainScale.setText("[-20.0, 20.0]");
|
||
166 | return domainScale;
|
||
167 | } |
||
168 | |||
169 | private JLabel getX_Translation() { |
||
170 | if(x_Translation == null ) { |
||
171 | x_Translation = new JLabel(); |
||
172 | //x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
||
173 | 10786 | lmfernandez | x_Translation.setText(PluginServices.getText(this,"x_Translation")+":"); |
174 | 10301 | dguerrero | } |
175 | return x_Translation;
|
||
176 | } |
||
177 | |||
178 | private JLabel getY_Translation() { |
||
179 | if(y_Translation == null ) { |
||
180 | y_Translation = new JLabel(); |
||
181 | //y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15));
|
||
182 | y_Translation.setText(PluginServices.getText(this,"y_Translation")+":"); |
||
183 | } |
||
184 | return y_Translation;
|
||
185 | } |
||
186 | |||
187 | private JLabel getZ_Translation() { |
||
188 | if(z_Translation == null ) { |
||
189 | z_Translation = new JLabel(); |
||
190 | //z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15));
|
||
191 | z_Translation.setText(PluginServices.getText(this,"z_Translation")+":"); |
||
192 | |||
193 | } |
||
194 | return z_Translation;
|
||
195 | } |
||
196 | |||
197 | private JLabel getX_Rotation() { |
||
198 | if(x_Rotation == null ) { |
||
199 | x_Rotation = new JLabel(); |
||
200 | //x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
||
201 | x_Rotation.setText(PluginServices.getText(this,"x_Rotation")+":"); |
||
202 | |||
203 | } |
||
204 | return x_Rotation;
|
||
205 | } |
||
206 | |||
207 | private JLabel getY_Rotation() { |
||
208 | if(y_Rotation == null ) { |
||
209 | y_Rotation = new JLabel(); |
||
210 | //y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
|
||
211 | y_Rotation.setText(PluginServices.getText(this,"y_Rotation")+":"); |
||
212 | |||
213 | } |
||
214 | return y_Rotation;
|
||
215 | } |
||
216 | |||
217 | private JLabel getZ_Rotation() { |
||
218 | if(z_Rotation == null ) { |
||
219 | z_Rotation = new JLabel(); |
||
220 | //z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15));
|
||
221 | z_Rotation.setText(PluginServices.getText(this,"z_Rotation")+":"); |
||
222 | |||
223 | } |
||
224 | return z_Rotation;
|
||
225 | } |
||
226 | |||
227 | private JLabel getScale() { |
||
228 | if(scale == null ) { |
||
229 | scale = new JLabel(); |
||
230 | //scale.setFont(new Font("scale:",Font.BOLD,15));
|
||
231 | scale.setText(PluginServices.getText(this,"scale")+":"); |
||
232 | |||
233 | } |
||
234 | return scale;
|
||
235 | } |
||
236 | |||
237 | public JTextField getTx_Translation() { |
||
238 | if(tx_Translation == null ) { |
||
239 | tx_Translation = new JTextField(); |
||
240 | //tx_Translation.setFont(new Font("",Font.ITALIC,10));
|
||
241 | tx_Translation.setText("0");
|
||
242 | tx_Translation.setEditable(true);
|
||
243 | //tx_Translation.addKeyListener(this);
|
||
244 | } |
||
245 | return tx_Translation;
|
||
246 | } |
||
247 | |||
248 | public JTextField getTy_Translation() { |
||
249 | if(ty_Translation == null ) { |
||
250 | ty_Translation = new JTextField(); |
||
251 | //ty_Translation.setFont(new Font("",Font.ITALIC,10));
|
||
252 | ty_Translation.setText("0");
|
||
253 | ty_Translation.setEditable(true);
|
||
254 | //ty_Translation.addKeyListener(this);
|
||
255 | } |
||
256 | return ty_Translation;
|
||
257 | } |
||
258 | |||
259 | public JTextField getTz_Translation() { |
||
260 | if(tz_Translation == null ) { |
||
261 | tz_Translation = new JTextField(); |
||
262 | //tz_Translation.setFont(new Font("",Font.ITALIC,10));
|
||
263 | tz_Translation.setText("0");
|
||
264 | tz_Translation.setEditable(true);
|
||
265 | //tz_Translation.addKeyListener(this);
|
||
266 | } |
||
267 | return tz_Translation;
|
||
268 | } |
||
269 | |||
270 | public JTextField getTx_Rotation() { |
||
271 | if(tx_Rotation == null ) { |
||
272 | tx_Rotation = new JTextField(); |
||
273 | //tx_Rotation.setFont(new Font("",Font.ITALIC,10));
|
||
274 | tx_Rotation.setText("0");
|
||
275 | tx_Rotation.setEditable(true);
|
||
276 | //tx_Rotation.addKeyListener(this);
|
||
277 | } |
||
278 | return tx_Rotation;
|
||
279 | } |
||
280 | |||
281 | public JTextField getTy_Rotation() { |
||
282 | if(ty_Rotation == null ) { |
||
283 | ty_Rotation = new JTextField(); |
||
284 | //ty_Rotation.setFont(new Font("",Font.ITALIC,10));
|
||
285 | ty_Rotation.setText("0");
|
||
286 | ty_Rotation.setEditable(true);
|
||
287 | //ty_Rotation.addKeyListener(this);
|
||
288 | } |
||
289 | return ty_Rotation;
|
||
290 | } |
||
291 | |||
292 | public JTextField getTz_Rotation() { |
||
293 | if(tz_Rotation == null ) { |
||
294 | tz_Rotation = new JTextField(); |
||
295 | //tz_Rotation.setFont(new Font("",Font.ITALIC,10));
|
||
296 | tz_Rotation.setText("0");
|
||
297 | tz_Rotation.setEditable(true);
|
||
298 | //tz_Rotation.addKeyListener(this);
|
||
299 | } |
||
300 | return tz_Rotation;
|
||
301 | } |
||
302 | |||
303 | public JTextField getTscale() { |
||
304 | if(tScale == null ) { |
||
305 | tScale = new JTextField(); |
||
306 | //tScale.setFont(new Font("",Font.ITALIC,10));
|
||
307 | tScale.setText("0");
|
||
308 | tScale.setEditable(true);
|
||
309 | //tScale.addKeyListener(this);
|
||
310 | } |
||
311 | return tScale;
|
||
312 | } |
||
313 | |||
314 | private Component getInfo() { |
||
315 | if (info == null){ |
||
316 | info = new JTextArea(); |
||
317 | info.setLineWrap(true);
|
||
318 | info.setWrapStyleWord(true);
|
||
319 | info.setPreferredSize(new Dimension(400, 240)); |
||
320 | info.setEditable(false);
|
||
321 | info.setText(getWKT()); |
||
322 | } |
||
323 | info.setText(getWKT()); |
||
324 | return info;
|
||
325 | } |
||
326 | |||
327 | /**
|
||
328 | *
|
||
329 | * @return
|
||
330 | */
|
||
331 | public ICrs getProjection() {
|
||
332 | if(tx_Translation.getText().equals("")){ |
||
333 | tx_Translation.setText("0");
|
||
334 | } |
||
335 | else if (ty_Translation.getText().equals("")){ |
||
336 | ty_Translation.setText("0");
|
||
337 | } |
||
338 | else if (tz_Translation.getText().equals("")){ |
||
339 | tz_Translation.setText("0");
|
||
340 | } |
||
341 | else if (tx_Rotation.getText().equals("")){ |
||
342 | tx_Rotation.setText("0");
|
||
343 | } |
||
344 | else if (ty_Rotation.getText().equals("")){ |
||
345 | ty_Rotation.setText("0");
|
||
346 | } |
||
347 | else if (tz_Rotation.getText().equals("")){ |
||
348 | tz_Rotation.setText("0");
|
||
349 | } |
||
350 | else if (tScale.getText().equals("")){ |
||
351 | tScale.setText("0");
|
||
352 | } |
||
353 | String param = "+towgs84="+ tx_Translation.getText()+","+ |
||
354 | ty_Translation.getText()+","+
|
||
355 | tz_Translation.getText()+","+
|
||
356 | tx_Rotation.getText()+","+
|
||
357 | ty_Rotation.getText()+","+
|
||
358 | tz_Rotation.getText()+","+
|
||
359 | tScale.getText() + " ";
|
||
360 | |||
361 | try {
|
||
362 | ICrs crs = new CrsFactory().getCRS(getCode(),
|
||
363 | getWKT(),param); |
||
364 | return crs;
|
||
365 | } catch (org.gvsig.crs.CrsException e) {
|
||
366 | e.printStackTrace(); |
||
367 | } |
||
368 | return null; |
||
369 | } |
||
370 | |||
371 | /**
|
||
372 | *
|
||
373 | * @param cod
|
||
374 | */
|
||
375 | public void setCode(int cod){ |
||
376 | codeEpsg = cod; |
||
377 | } |
||
378 | |||
379 | /**
|
||
380 | *
|
||
381 | * @return
|
||
382 | */
|
||
383 | public int getCode(){ |
||
384 | return codeEpsg;
|
||
385 | } |
||
386 | |||
387 | /**
|
||
388 | *
|
||
389 | * @param cad
|
||
390 | */
|
||
391 | public void setWKT(String cad){ |
||
392 | cadWKT = cad; |
||
393 | CrsWkt parser = new CrsWkt(cad);
|
||
394 | setSourceAbrev(parser.getAuthority()[0], parser.getAuthority()[1]); |
||
395 | getInfo(); |
||
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 n?merico 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 par?metros insertados. En caso
|
||
554 | * de que todos los par?metros sean 0, o haya par?metros sin valor
|
||
555 | * deshabilitar? el bot?n 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 | } |