29 |
29 |
import com.iver.andami.ui.mdiManager.IWindow;
|
30 |
30 |
import com.iver.andami.ui.mdiManager.WindowInfo;
|
31 |
31 |
|
32 |
|
public class TransformationManualPanel extends JPanel implements KeyListener{
|
|
32 |
public class TransformationManualPanel extends JPanel {
|
33 |
33 |
|
34 |
34 |
private static final long serialVersionUID = 1L;
|
35 |
35 |
|
... | ... | |
51 |
51 |
private JTextField tz_Rotation;
|
52 |
52 |
private JTextField tScale;
|
53 |
53 |
|
|
54 |
private JLabel domainTranslation;
|
|
55 |
private JLabel domainRotation;
|
|
56 |
private JLabel domainScale;
|
|
57 |
|
54 |
58 |
private JLabel wkt;
|
55 |
59 |
private JTextArea info;
|
56 |
60 |
int codeEpsg;
|
... | ... | |
71 |
75 |
public JPanel getJPanel(){
|
72 |
76 |
if (panel == null) {
|
73 |
77 |
panel = new JPanel();
|
74 |
|
panel.setLayout(new GridLayout(0,4));
|
|
78 |
panel.setLayout(new GridLayout(0,3));
|
75 |
79 |
panel.setLayout(new FlowLayout(FlowLayout.LEFT,10,20));
|
76 |
80 |
panel.setBorder(
|
77 |
81 |
BorderFactory.createCompoundBorder(
|
... | ... | |
82 |
86 |
panel.setPreferredSize(new Dimension(525,400));
|
83 |
87 |
panel.add(getX_Translation(),null);
|
84 |
88 |
panel.add(getTx_Translation(),null);
|
|
89 |
panel.add(getDomainTranslation(), null);
|
|
90 |
panel.add(getY_Translation(),null);
|
|
91 |
panel.add(getTy_Translation(),null);
|
|
92 |
panel.add(getDomainTranslation(), null);
|
|
93 |
panel.add(getZ_Translation(),null);
|
|
94 |
panel.add(getTz_Translation(),null);
|
|
95 |
panel.add(getDomainTranslation(), null);
|
85 |
96 |
panel.add(getX_Rotation(),null);
|
86 |
97 |
panel.add(getTx_Rotation(),null);
|
87 |
|
panel.add(getY_Translation(),null);
|
88 |
|
panel.add(getTy_Translation(),null);
|
|
98 |
panel.add(getDomainRotation(), null);
|
89 |
99 |
panel.add(getY_Rotation(),null);
|
90 |
100 |
panel.add(getTy_Rotation(),null);
|
91 |
|
panel.add(getZ_Translation(),null);
|
92 |
|
panel.add(getTz_Translation(),null);
|
|
101 |
panel.add(getDomainRotation(), null);
|
93 |
102 |
panel.add(getZ_Rotation(),null);
|
94 |
103 |
panel.add(getTz_Rotation(),null);
|
|
104 |
panel.add(getDomainRotation(), null);
|
95 |
105 |
panel.add(getScale(),null);
|
96 |
106 |
panel.add(getTscale(),null);
|
|
107 |
panel.add(getDomainScale(), null);
|
97 |
108 |
//panel.add(getJPanelParams(), null);
|
98 |
109 |
//panel.add(getButtonPane(), null);
|
99 |
110 |
}
|
100 |
111 |
return panel;
|
101 |
112 |
}
|
102 |
113 |
|
|
114 |
private JLabel getDomainTranslation(){
|
|
115 |
domainTranslation = new JLabel();
|
|
116 |
domainTranslation.setPreferredSize(new Dimension(150, 20));
|
|
117 |
domainTranslation.setText("[-1000.0, 1000.0]");
|
|
118 |
return domainTranslation;
|
|
119 |
}
|
|
120 |
|
|
121 |
private JLabel getDomainRotation(){
|
|
122 |
domainRotation = new JLabel();
|
|
123 |
domainRotation.setPreferredSize(new Dimension(150, 20));
|
|
124 |
domainRotation.setText("[-60.0, 60.0]");
|
|
125 |
return domainRotation;
|
|
126 |
}
|
|
127 |
|
|
128 |
private JLabel getDomainScale(){
|
|
129 |
domainScale = new JLabel();
|
|
130 |
domainScale.setPreferredSize(new Dimension(150, 20));
|
|
131 |
domainScale.setText("[-20.0, 20.0]");
|
|
132 |
return domainScale;
|
|
133 |
}
|
103 |
134 |
|
104 |
135 |
private JLabel getX_Translation() {
|
105 |
136 |
if(x_Translation == null ) {
|
... | ... | |
178 |
209 |
return scale;
|
179 |
210 |
}
|
180 |
211 |
|
181 |
|
private JTextField getTx_Translation() {
|
|
212 |
public JTextField getTx_Translation() {
|
182 |
213 |
if(tx_Translation == null ) {
|
183 |
214 |
tx_Translation = new JTextField();
|
184 |
215 |
tx_Translation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
190 |
221 |
return tx_Translation;
|
191 |
222 |
}
|
192 |
223 |
|
193 |
|
private JTextField getTy_Translation() {
|
|
224 |
public JTextField getTy_Translation() {
|
194 |
225 |
if(ty_Translation == null ) {
|
195 |
226 |
ty_Translation = new JTextField();
|
196 |
227 |
ty_Translation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
202 |
233 |
return ty_Translation;
|
203 |
234 |
}
|
204 |
235 |
|
205 |
|
private JTextField getTz_Translation() {
|
|
236 |
public JTextField getTz_Translation() {
|
206 |
237 |
if(tz_Translation == null ) {
|
207 |
238 |
tz_Translation = new JTextField();
|
208 |
239 |
tz_Translation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
214 |
245 |
return tz_Translation;
|
215 |
246 |
}
|
216 |
247 |
|
217 |
|
private JTextField getTx_Rotation() {
|
|
248 |
public JTextField getTx_Rotation() {
|
218 |
249 |
if(tx_Rotation == null ) {
|
219 |
250 |
tx_Rotation = new JTextField();
|
220 |
251 |
tx_Rotation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
226 |
257 |
return tx_Rotation;
|
227 |
258 |
}
|
228 |
259 |
|
229 |
|
private JTextField getTy_Rotation() {
|
|
260 |
public JTextField getTy_Rotation() {
|
230 |
261 |
if(ty_Rotation == null ) {
|
231 |
262 |
ty_Rotation = new JTextField();
|
232 |
263 |
ty_Rotation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
238 |
269 |
return ty_Rotation;
|
239 |
270 |
}
|
240 |
271 |
|
241 |
|
private JTextField getTz_Rotation() {
|
|
272 |
public JTextField getTz_Rotation() {
|
242 |
273 |
if(tz_Rotation == null ) {
|
243 |
274 |
tz_Rotation = new JTextField();
|
244 |
275 |
tz_Rotation.setPreferredSize(new Dimension(120,20));
|
... | ... | |
250 |
281 |
return tz_Rotation;
|
251 |
282 |
}
|
252 |
283 |
|
253 |
|
private JTextField getTscale() {
|
|
284 |
public JTextField getTscale() {
|
254 |
285 |
if(tScale == null ) {
|
255 |
286 |
tScale = new JTextField();
|
256 |
287 |
tScale.setPreferredSize(new Dimension(120,20));
|
... | ... | |
336 |
367 |
|
337 |
368 |
public void keyPressed(KeyEvent e) {
|
338 |
369 |
// TODO Auto-generated method stub
|
339 |
|
/*
|
340 |
|
* Comprobaremos si todos los campos son 0, para en ese caso poner el
|
341 |
|
* boton de finalizar deshabilitado...
|
342 |
|
*/
|
|
370 |
if (e.getSource() == getTx_Translation()) {
|
|
371 |
if (getTx_Translation().getText().equals("0"));
|
|
372 |
}
|
|
373 |
if (e.getSource() == getTy_Translation()) {
|
|
374 |
|
|
375 |
}
|
|
376 |
if (e.getSource() == getTz_Translation()) {
|
|
377 |
|
|
378 |
}
|
|
379 |
if (e.getSource() == getTx_Rotation()) {
|
|
380 |
|
|
381 |
}
|
|
382 |
if (e.getSource() == getTy_Rotation()) {
|
|
383 |
|
|
384 |
}
|
|
385 |
if (e.getSource() == getTz_Rotation()) {
|
|
386 |
|
|
387 |
}
|
|
388 |
if (e.getSource() == getScale()) {
|
|
389 |
|
|
390 |
}
|
343 |
391 |
}
|
344 |
392 |
|
345 |
393 |
public void keyReleased(KeyEvent e) {
|
... | ... | |
359 |
407 |
public boolean correctJTextField(){
|
360 |
408 |
boolean correct = true;
|
361 |
409 |
|
362 |
|
if ((tx_Translation.getText().length()!=verify(tx_Translation.getText()).length())){
|
|
410 |
if ((tx_Translation.getText().length()==0) || (tx_Translation.getText().length()!=verify(tx_Translation.getText()).length())){
|
363 |
411 |
tx_Translation.setText("0");
|
364 |
412 |
tx_Translation.setBackground(new Color(255,204,204));
|
365 |
413 |
correct = false;
|
366 |
414 |
}
|
367 |
415 |
else tx_Translation.setBackground(new Color(255,255,255));
|
368 |
|
if ((ty_Translation.getText().length()!=verify(ty_Translation.getText()).length())){
|
|
416 |
if ((ty_Translation.getText().length()==0) || (ty_Translation.getText().length()!=verify(ty_Translation.getText()).length())){
|
369 |
417 |
ty_Translation.setText("0");
|
370 |
418 |
ty_Translation.setBackground(new Color(255,204,204));
|
371 |
419 |
correct = false;
|
372 |
420 |
}
|
373 |
421 |
else ty_Translation.setBackground(new Color(255,255,255));
|
374 |
|
if ((tz_Translation.getText().length()!=verify(tz_Translation.getText()).length())){
|
|
422 |
if ((tz_Translation.getText().length()==0) || (tz_Translation.getText().length()!=verify(tz_Translation.getText()).length())){
|
375 |
423 |
tz_Translation.setText("0");
|
376 |
424 |
tz_Translation.setBackground(new Color(255,204,204));
|
377 |
425 |
correct = false;
|
378 |
426 |
}
|
379 |
427 |
else tz_Translation.setBackground(new Color(255,255,255));
|
380 |
|
if ((tx_Rotation.getText().length()!=verify(tx_Rotation.getText()).length())){
|
|
428 |
if ((tx_Rotation.getText().length() == 0) || (tx_Rotation.getText().length()!=verify(tx_Rotation.getText()).length())){
|
381 |
429 |
tx_Rotation.setText("0");
|
382 |
430 |
tx_Rotation.setBackground(new Color(255,204,204));
|
383 |
431 |
correct = false;
|
384 |
432 |
}
|
385 |
433 |
else tx_Rotation.setBackground(new Color(255,255,255));
|
386 |
|
if ((ty_Rotation.getText().length()!=verify(ty_Rotation.getText()).length())){
|
|
434 |
if ((ty_Rotation.getText().length() == 0) || (ty_Rotation.getText().length()!=verify(ty_Rotation.getText()).length())){
|
387 |
435 |
ty_Rotation.setText("0");
|
388 |
436 |
ty_Rotation.setBackground(new Color(255,204,204));
|
389 |
437 |
correct = false;
|
390 |
438 |
}
|
391 |
439 |
else ty_Rotation.setBackground(new Color(255,255,255));
|
392 |
|
if ((tz_Rotation.getText().length()!=verify(tz_Rotation.getText()).length())){
|
|
440 |
if ((tz_Rotation.getText().length() == 0) || (tz_Rotation.getText().length()!=verify(tz_Rotation.getText()).length())){
|
393 |
441 |
tz_Rotation.setText("0");
|
394 |
442 |
tz_Rotation.setBackground(new Color(255,204,204));
|
395 |
443 |
correct = false;
|
396 |
444 |
}
|
397 |
445 |
else tz_Rotation.setBackground(new Color(255,255,255));
|
398 |
|
if ((tScale.getText().length()!=verify(tScale.getText()).length())){
|
|
446 |
if ((tScale.getText().length() == 0) || (tScale.getText().length()!=verify(tScale.getText()).length())){
|
399 |
447 |
tScale.setText("0");
|
400 |
448 |
tScale.setBackground(new Color(255,204,204));
|
401 |
449 |
correct = false;
|
... | ... | |
425 |
473 |
return num_cad;
|
426 |
474 |
}
|
427 |
475 |
|
|
476 |
public boolean correctDomain(){
|
|
477 |
boolean correctDomain = true;
|
|
478 |
double tx = Double.parseDouble(tx_Translation.getText());
|
|
479 |
double ty = Double.parseDouble(ty_Translation.getText());
|
|
480 |
double tz = Double.parseDouble(tz_Translation.getText());
|
|
481 |
double rx = Double.parseDouble(tx_Rotation.getText());
|
|
482 |
double ry = Double.parseDouble(ty_Rotation.getText());
|
|
483 |
double rz = Double.parseDouble(tz_Rotation.getText());
|
|
484 |
double sc = Double.parseDouble(tScale.getText());
|
|
485 |
|
|
486 |
if (tx < -1000.0 || tx > 1000.0) {
|
|
487 |
tx_Translation.setText("0");
|
|
488 |
tx_Translation.setBackground(new Color(255,204,204));
|
|
489 |
correctDomain = false;
|
|
490 |
}
|
|
491 |
else tx_Translation.setBackground(new Color(255,255,255));
|
|
492 |
if (ty < -1000.0 || ty > 1000.0) {
|
|
493 |
ty_Translation.setText("0");
|
|
494 |
ty_Translation.setBackground(new Color(255,204,204));
|
|
495 |
correctDomain = false;
|
|
496 |
}
|
|
497 |
else ty_Translation.setBackground(new Color(255,255,255));
|
|
498 |
if (tz < -1000.0 || tz > 1000.0) {
|
|
499 |
tz_Translation.setText("0");
|
|
500 |
tz_Translation.setBackground(new Color(255,204,204));
|
|
501 |
correctDomain = false;
|
|
502 |
}
|
|
503 |
else tz_Translation.setBackground(new Color(255,255,255));
|
|
504 |
if (rx < -60.0 || rx > 60.0) {
|
|
505 |
tx_Rotation.setText("0");
|
|
506 |
tx_Rotation.setBackground(new Color(255,204,204));
|
|
507 |
correctDomain = false;
|
|
508 |
}
|
|
509 |
else tx_Rotation.setBackground(new Color(255,255,255));
|
|
510 |
if (ry < -60.0 || ry > 60.0) {
|
|
511 |
ty_Rotation.setText("0");
|
|
512 |
ty_Rotation.setBackground(new Color(255,204,204));
|
|
513 |
correctDomain = false;
|
|
514 |
}
|
|
515 |
else ty_Rotation.setBackground(new Color(255,255,255));
|
|
516 |
if (rz < -60.0 || rz > 60.0) {
|
|
517 |
tz_Rotation.setText("0");
|
|
518 |
tz_Rotation.setBackground(new Color(255,204,204));
|
|
519 |
correctDomain = false;
|
|
520 |
}
|
|
521 |
else tz_Rotation.setBackground(new Color(255,255,255));
|
|
522 |
if (sc < -20.0 || sc > 20.0) {
|
|
523 |
tScale.setText("0");
|
|
524 |
tScale.setBackground(new Color(255,204,204));
|
|
525 |
correctDomain = false;
|
|
526 |
}
|
|
527 |
else tScale.setBackground(new Color(255,255,255));
|
|
528 |
return correctDomain;
|
|
529 |
}
|
|
530 |
|
|
531 |
public boolean getStatus() {
|
|
532 |
if ((tx_Translation.getText().equals("0") || tx_Translation.getText().equals("")) &&
|
|
533 |
(ty_Translation.getText().equals("0") || ty_Translation.getText().equals(""))&&
|
|
534 |
(tz_Translation.getText().equals("0") || tz_Translation.getText().equals(""))&&
|
|
535 |
(tx_Rotation.getText().equals("0") || tx_Rotation.getText().equals(""))&&
|
|
536 |
(ty_Rotation.getText().equals("0") || ty_Rotation.getText().equals(""))&&
|
|
537 |
(tz_Rotation.getText().equals("0") || tz_Rotation.getText().equals(""))&&
|
|
538 |
(tScale.getText().equals("0") || tScale.getText().equals("")))
|
|
539 |
return false;
|
|
540 |
else if (tx_Translation.getText().equals("") ||
|
|
541 |
(ty_Translation.getText().equals(""))||
|
|
542 |
(tz_Translation.getText().equals(""))||
|
|
543 |
(tx_Rotation.getText().equals(""))||
|
|
544 |
(ty_Rotation.getText().equals(""))||
|
|
545 |
(tz_Rotation.getText().equals(""))||
|
|
546 |
(tScale.getText().equals("")))
|
|
547 |
return false;
|
|
548 |
return true;
|
|
549 |
}
|
|
550 |
|
428 |
551 |
|
429 |
552 |
}
|