Revision 5598 trunk/extensions/extGeoreferencing/src/org/gvsig/georeferencing/utils/PointManager.java
PointManager.java | ||
---|---|---|
7 | 7 |
import javax.swing.JInternalFrame; |
8 | 8 |
import javax.swing.JLayeredPane; |
9 | 9 |
import javax.swing.JOptionPane; |
10 |
import javax.xml.transform.TransformerException; |
|
10 | 11 |
|
11 | 12 |
import org.gvsig.georeferencing.GeoOperations; |
12 | 13 |
import org.gvsig.georeferencing.GeoreferencingToolsModule; |
13 | 14 |
import org.gvsig.georeferencing.gui.dialogs.GeoreferencingDialog; |
14 | 15 |
import org.gvsig.georeferencing.gui.listeners.GeoRasterFrameListener; |
16 |
import org.gvsig.georeferencing.gui.listeners.GeorefPointSelectorListener; |
|
15 | 17 |
import org.gvsig.georeferencing.gui.panels.AdjustGeorefPanel; |
16 | 18 |
import org.gvsig.georeferencing.gui.panels.OptionsPanel; |
17 | 19 |
import org.gvsig.georeferencing.gui.panels.ZoomControlPanel; |
... | ... | |
132 | 134 |
return; |
133 | 135 |
|
134 | 136 |
//Actualizamos los textBox |
135 |
if(pixel != null){
|
|
137 |
if(pixel != null) |
|
136 | 138 |
dialog.setPixelText(pixel.getX(), pixel.getY()); |
137 |
dialog.getSelectPointsPanel().lastTx = String.valueOf(pixel.getX()); |
|
138 |
dialog.getSelectPointsPanel().lastTy = String.valueOf(pixel.getY()); |
|
139 |
} |
|
140 |
if(map != null){
|
|
139 |
//dialog.getSelectPointsPanel().lastTx = String.valueOf(pixel.getX());
|
|
140 |
//dialog.getSelectPointsPanel().lastTy = String.valueOf(pixel.getY());
|
|
141 |
|
|
142 |
if(map != null) |
|
141 | 143 |
dialog.setMapCoordText(map.getX(), map.getY()); |
142 |
dialog.getSelectPointsPanel().lastLong = String.valueOf(map.getX()); |
|
143 |
dialog.getSelectPointsPanel().lastLat = String.valueOf(map.getY()); |
|
144 |
} |
|
144 |
//dialog.getSelectPointsPanel().lastLong = String.valueOf(map.getX()); |
|
145 |
//dialog.getSelectPointsPanel().lastLat = String.valueOf(map.getY()); |
|
145 | 146 |
|
147 |
|
|
146 | 148 |
//El Checkbox de activaci?n |
147 | 149 |
GeoPoint gp = ((GeoPoint)lyrPoints.getPoint(nPunto - 1)); |
148 | 150 |
if(gp != null){ |
... | ... | |
502 | 504 |
} |
503 | 505 |
|
504 | 506 |
/** |
507 |
* Realiza las acciones necesarias cuando se ha seleccionado el primer punto de la georreferenciaci?n. |
|
508 |
* Este primer punto corresponde a las coordenadas en pixeles de la imagen. Los par?metros ya vienen |
|
509 |
* validados por quien llama. |
|
510 |
* @param tx Coordenada X en formato cadena |
|
511 |
* @param ty Coordenada Y en formato cadena |
|
512 |
* @throws TransformerException Es lanzada si el punto se encuentra fuera del marco de la imagen |
|
513 |
*/ |
|
514 |
public void selectFirstPoint(String tx, String ty){ |
|
515 |
//Obtenemos el punto seleccionado en coordenadas de la vista |
|
516 |
double x = Double.valueOf(tx).doubleValue(); |
|
517 |
double y = Double.valueOf(ty).doubleValue(); |
|
518 |
Point2D pixel = new Point2D.Double(); |
|
519 |
pixel.setLocation(x, y); |
|
520 |
selectFirstPoint(pixel); |
|
521 |
} |
|
522 |
|
|
523 |
/** |
|
524 |
* Realiza las acciones necesarias cuando se ha seleccionado el primer punto de la georreferenciaci?n. |
|
525 |
* Este primer punto corresponde a las coordenadas en pixeles de la imagen. Los par?metros ya vienen |
|
526 |
* validados por quien llama. |
|
527 |
* @param pixel Coordenada X, Y del punto |
|
528 |
* @throws TransformerException Es lanzada si el punto se encuentra fuera del marco de la imagen |
|
529 |
*/ |
|
530 |
public void selectFirstPoint(Point2D pixel){ |
|
531 |
restoreControlsValue(); |
|
532 |
|
|
533 |
View theView = null; |
|
534 |
try{ |
|
535 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
536 |
}catch(ClassCastException exc){ |
|
537 |
return; |
|
538 |
} |
|
539 |
|
|
540 |
//Obtenemos del dialogo el n? de pto seleccionado y lo actualizamos en la capa de ptos |
|
541 |
int n = Integer.valueOf(dialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().getSelectedItem().toString()).intValue(); |
|
542 |
dialog.getPointManager().updateData(n, pixel, null, dialog, theView); |
|
543 |
dialog.getConectorPanel().getAdjustGeorefPanel().setEnabled(false); |
|
544 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setEnabled(true); |
|
545 |
|
|
546 |
dialog.getPointManager().disableAllControls(); |
|
547 |
GeorefPointSelectorListener.firstPoint = false; |
|
548 |
} |
|
549 |
|
|
550 |
/** |
|
551 |
* Realiza las acciones necesarias cuando se ha seleccionado el segundo punto de la georreferenciaci?n. |
|
552 |
* Este segundo punto corresponde a las coordenadas en coordenadas del mundo. Los par?metros ya vienen |
|
553 |
* validados por quien llama. |
|
554 |
* @param tx Coordenada X en formato cadena |
|
555 |
* @param ty Coordenada Y en formato cadena |
|
556 |
* @throws TransformerException Es lanzada si el punto se encuentra fuera del marco de la imagen |
|
557 |
*/ |
|
558 |
public void selectSecondPoint(String tx, String ty){ |
|
559 |
//Obtenemos el punto seleccionado en coordenadas de la vista |
|
560 |
double x = Double.valueOf(tx).doubleValue(); |
|
561 |
double y = Double.valueOf(ty).doubleValue(); |
|
562 |
Point2D map = new Point2D.Double(); |
|
563 |
map.setLocation(x, y); |
|
564 |
selectSecondPoint(map); |
|
565 |
} |
|
566 |
|
|
567 |
/** |
|
568 |
* Realiza las acciones necesarias cuando se ha seleccionado el primer punto de la georreferenciaci?n. |
|
569 |
* Este primer punto corresponde a las coordenadas en pixeles de la imagen. Los par?metros ya vienen |
|
570 |
* validados por quien llama. |
|
571 |
* @param pixel Coordenada X, Y del punto |
|
572 |
* @throws TransformerException Es lanzada si el punto se encuentra fuera del marco de la imagen |
|
573 |
*/ |
|
574 |
public void selectSecondPoint(Point2D map){ |
|
575 |
View theView = null; |
|
576 |
try{ |
|
577 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
578 |
}catch(ClassCastException exc){ |
|
579 |
return; |
|
580 |
} |
|
581 |
|
|
582 |
//Deseleccionamos la herramienta de marcado de puntos |
|
583 |
theView.getMapControl().setTool(dialog.getLyrPoints().getLastTool()); |
|
584 |
|
|
585 |
//Volvemos a dejar los controles con su valor habitual |
|
586 |
dialog.getPointManager().restoreControlsValue(); |
|
587 |
|
|
588 |
//Obtenemos del dialogo el n? de pto seleccionado y lo actualizamos en la capa de ptos |
|
589 |
int n = Integer.valueOf(dialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().getSelectedItem().toString()).intValue(); |
|
590 |
dialog.getPointManager().updateData(n, null, map, dialog, theView); |
|
591 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
592 |
dialog.getConectorPanel().getAdjustGeorefPanel().setEnabled(true); |
|
593 |
dialog.getPointManager().setErrors(n - 1); |
|
594 |
|
|
595 |
GeorefPointSelectorListener.firstPoint = true; |
|
596 |
} |
|
597 |
|
|
598 |
/** |
|
505 | 599 |
* Obtiene la ventana flotante sobre la que ir? el dialogo (GeoreferencingDialog). |
506 | 600 |
* @param obj |
507 | 601 |
* @return JInternalFrame |
Also available in: Unified diff