223 |
223 |
* @param crsCode
|
224 |
224 |
*/
|
225 |
225 |
private void callTransformation(int crsCode){
|
226 |
|
int numRow = dtm.getRowCount();
|
227 |
|
|
228 |
|
while (numRow != 0) {
|
229 |
|
numRow = numRow - 1;
|
230 |
|
dtm.removeRow(numRow);
|
231 |
|
}
|
232 |
226 |
|
|
227 |
|
233 |
228 |
String sentence = "SELECT source_geogcrs_code " +
|
234 |
229 |
"FROM epsg_coordinatereferencesystem " +
|
235 |
230 |
"WHERE coord_ref_sys_code = "+ crsCode ;
|
... | ... | |
487 |
482 |
* directas e inversas que pueda tener
|
488 |
483 |
* @param code
|
489 |
484 |
*/
|
490 |
|
public void setSource(int code){
|
|
485 |
public void setSource(String fuente, int code){
|
491 |
486 |
connect = new EpsgConnection();
|
492 |
487 |
connect.setConnectionEPSG();
|
493 |
488 |
inverseTranformation = false;
|
494 |
489 |
crs_source_code = code;
|
495 |
|
callTransformation(crs_source_code);
|
|
490 |
int numRow = dtm.getRowCount();
|
496 |
491 |
|
497 |
|
int new_target = crs_target;
|
498 |
|
int base_target = code;
|
499 |
|
String sentence = "SELECT source_geogcrs_code, coord_ref_sys_kind " +
|
500 |
|
"FROM epsg_coordinatereferencesystem " +
|
501 |
|
"WHERE coord_ref_sys_code = "+ code;
|
502 |
|
ResultSet result = Query.select(sentence,connect.getConnection());
|
503 |
|
try {
|
504 |
|
result.next();
|
505 |
|
String kind = result.getString("coord_ref_sys_kind");
|
506 |
|
if (kind.equals("projected"))
|
507 |
|
base_target = result.getInt("source_geogcrs_code");
|
508 |
|
} catch (SQLException e1) {
|
509 |
|
e1.printStackTrace();
|
510 |
|
}
|
511 |
|
crs_target = base_target;
|
512 |
|
|
513 |
|
crs_source_code = new_target;
|
514 |
|
callInverseTransformation(crs_source_code);
|
515 |
|
crs_target = new_target;
|
516 |
|
crs_source_code = code;
|
517 |
|
|
518 |
|
int numr = dtm.getRowCount();
|
519 |
|
if (numr > 0 ){
|
520 |
|
this.getJTable().setRowSelectionInterval(0,0);
|
|
492 |
while (numRow != 0) {
|
|
493 |
numRow = numRow - 1;
|
|
494 |
dtm.removeRow(numRow);
|
521 |
495 |
}
|
|
496 |
if (PluginServices.getText(this, fuente).equals(PluginServices.getText(this, "EPSG"))) {
|
|
497 |
callTransformation(crs_source_code);
|
|
498 |
|
|
499 |
int new_target = crs_target;
|
|
500 |
int base_target = code;
|
|
501 |
String sentence = "SELECT source_geogcrs_code, coord_ref_sys_kind " +
|
|
502 |
"FROM epsg_coordinatereferencesystem " +
|
|
503 |
"WHERE coord_ref_sys_code = "+ code;
|
|
504 |
ResultSet result = Query.select(sentence,connect.getConnection());
|
|
505 |
try {
|
|
506 |
result.next();
|
|
507 |
String kind = result.getString("coord_ref_sys_kind");
|
|
508 |
if (kind.equals("projected"))
|
|
509 |
base_target = result.getInt("source_geogcrs_code");
|
|
510 |
} catch (SQLException e1) {
|
|
511 |
e1.printStackTrace();
|
|
512 |
}
|
|
513 |
crs_target = base_target;
|
|
514 |
|
|
515 |
crs_source_code = new_target;
|
|
516 |
callInverseTransformation(crs_source_code);
|
|
517 |
crs_target = new_target;
|
|
518 |
crs_source_code = code;
|
|
519 |
|
|
520 |
int numr = dtm.getRowCount();
|
|
521 |
if (numr > 0 ){
|
|
522 |
this.getJTable().setRowSelectionInterval(0,0);
|
|
523 |
}
|
|
524 |
}
|
522 |
525 |
}
|
523 |
526 |
|
524 |
527 |
/**
|
... | ... | |
530 |
533 |
connect = new EpsgConnection();
|
531 |
534 |
connect.setConnectionEPSG();
|
532 |
535 |
inverseTranformation = false;
|
533 |
|
int code = Integer.parseInt(aut.split(":")[1]);
|
|
536 |
String[] authority = aut.split(":");
|
|
537 |
int code = Integer.parseInt(authority[1]);
|
534 |
538 |
crs_source_code = code;
|
535 |
|
callTransformationCompuesta(crs_source_code);
|
536 |
|
|
537 |
|
int new_target = crs_target;
|
538 |
|
int base_target = code;
|
539 |
|
String sentence = "SELECT source_geogcrs_code, coord_ref_sys_kind " +
|
540 |
|
"FROM epsg_coordinatereferencesystem " +
|
541 |
|
"WHERE coord_ref_sys_code = "+ code;
|
542 |
|
ResultSet result = Query.select(sentence,connect.getConnection());
|
543 |
|
try {
|
544 |
|
result.next();
|
545 |
|
String kind = result.getString("coord_ref_sys_kind");
|
546 |
|
if (kind.equals("projected"))
|
547 |
|
base_target = result.getInt("source_geogcrs_code");
|
548 |
|
} catch (SQLException e1) {
|
549 |
|
e1.printStackTrace();
|
550 |
|
}
|
551 |
|
crs_target = base_target;
|
552 |
|
|
553 |
|
crs_source_code = new_target;
|
554 |
|
callInverseTransformation(crs_source_code);
|
555 |
|
crs_target = new_target;
|
556 |
|
crs_source_code = code;
|
557 |
|
|
558 |
|
int numr = dtm.getRowCount();
|
559 |
|
if (numr > 0 ){
|
560 |
|
this.getJTable().setRowSelectionInterval(0,0);
|
|
539 |
if (PluginServices.getText(this,authority[0]).equals(PluginServices.getText(this, "EPSG"))) {
|
|
540 |
callTransformationCompuesta(crs_source_code);
|
|
541 |
|
|
542 |
int new_target = crs_target;
|
|
543 |
int base_target = code;
|
|
544 |
String sentence = "SELECT source_geogcrs_code, coord_ref_sys_kind " +
|
|
545 |
"FROM epsg_coordinatereferencesystem " +
|
|
546 |
"WHERE coord_ref_sys_code = "+ code;
|
|
547 |
ResultSet result = Query.select(sentence,connect.getConnection());
|
|
548 |
try {
|
|
549 |
result.next();
|
|
550 |
String kind = result.getString("coord_ref_sys_kind");
|
|
551 |
if (kind.equals("projected"))
|
|
552 |
base_target = result.getInt("source_geogcrs_code");
|
|
553 |
} catch (SQLException e1) {
|
|
554 |
e1.printStackTrace();
|
|
555 |
}
|
|
556 |
crs_target = base_target;
|
|
557 |
|
|
558 |
crs_source_code = new_target;
|
|
559 |
callInverseTransformation(crs_source_code);
|
|
560 |
crs_target = new_target;
|
|
561 |
crs_source_code = code;
|
|
562 |
|
|
563 |
int numr = dtm.getRowCount();
|
|
564 |
if (numr > 0 ){
|
|
565 |
this.getJTable().setRowSelectionInterval(0,0);
|
|
566 |
}
|
561 |
567 |
}
|
562 |
568 |
}
|
563 |
569 |
|