Revision 3102
trunk/extensions/extGeoreferencing/config/config.xml | ||
---|---|---|
22 | 22 |
<selectable-tool icon="images/mas.png" action-command="GEO_ZOOM" tooltip="Zoom_Mas"/> |
23 | 23 |
<selectable-tool icon="images/clean.png" action-command="GEO_PAN" tooltip="Mover_geo"/> |
24 | 24 |
<selectable-tool icon="images/back.png" action-command="GEO_ZOOM_PREV" tooltip="Zoom_previo"/> |
25 |
<selectable-tool icon="images/selectfromview.png" action-command="GEO_MOVE_POINT" tooltip="Move_from_view"/>
|
|
25 |
<action-tool icon="images/selectfromview.png" action-command="GEO_MOVE_POINT" tooltip="Move_from_view"/>
|
|
26 | 26 |
</tool-bar> |
27 | 27 |
</extension> |
28 | 28 |
</extensions> |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/georeferencing/GeoreferencingModule.java | ||
---|---|---|
79 | 79 |
* El control est? activo siempre que haya una vista abierta |
80 | 80 |
*/ |
81 | 81 |
public boolean isEnabled() { |
82 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager().getActiveView(); |
|
82 |
com.iver.andami.ui.mdiManager.View f = null; |
|
83 |
try{ |
|
84 |
f = PluginServices.getMDIManager().getActiveView(); |
|
85 |
}catch(ClassCastException exc){ |
|
86 |
return false; |
|
87 |
} |
|
83 | 88 |
|
84 | 89 |
if (f == null) { |
85 | 90 |
return false; |
... | ... | |
92 | 97 |
* El control es visible siempre que haya una vista abierta |
93 | 98 |
*/ |
94 | 99 |
public boolean isVisible() { |
95 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
|
96 |
.getActiveView(); |
|
100 |
com.iver.andami.ui.mdiManager.View f = null; |
|
101 |
try{ |
|
102 |
f = PluginServices.getMDIManager().getActiveView(); |
|
103 |
}catch(ClassCastException exc){ |
|
104 |
return false; |
|
105 |
} |
|
106 |
|
|
97 | 107 |
if (f == null) { |
98 | 108 |
return false; |
99 | 109 |
} |
... | ... | |
108 | 118 |
public void execute(String s) { |
109 | 119 |
//GeoreferencingToolsModule.visible = true; |
110 | 120 |
PluginServices.getMainFrame().enableControls(); |
111 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
121 |
View vista = null; |
|
122 |
try{ |
|
123 |
vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
124 |
}catch(ClassCastException exc){ |
|
125 |
return; |
|
126 |
} |
|
112 | 127 |
MapControl mapCtrl = vista.getMapControl(); |
113 | 128 |
|
114 | 129 |
JInternalFrame panel = new JInternalFrame(); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/georeferencing/GeoreferencingToolsModule.java | ||
---|---|---|
79 | 79 |
* El control es visible siempre que haya una vista abierta |
80 | 80 |
*/ |
81 | 81 |
public boolean isVisible() { |
82 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
|
83 |
.getActiveView(); |
|
82 |
com.iver.andami.ui.mdiManager.View f = null; |
|
83 |
try{ |
|
84 |
f = PluginServices.getMDIManager().getActiveView(); |
|
85 |
}catch(ClassCastException exc){ |
|
86 |
return false; |
|
87 |
} |
|
84 | 88 |
|
85 | 89 |
if (f == null) { |
86 | 90 |
return false; |
87 | 91 |
} |
88 | 92 |
|
89 | 93 |
try{ |
90 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
91 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
92 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
|
94 |
for(int i=0;i<((View)f).getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
|
95 |
FLayer lyr = ((View)f).getMapControl().getMapContext().getLayers().getLayer(i); |
|
93 | 96 |
if( lyr instanceof FLyrGeoRaster && |
94 | 97 |
lyr.isActive() && |
95 | 98 |
lyr.getName().startsWith("*")) |
... | ... | |
107 | 110 |
* la que ha sido activada. |
108 | 111 |
*/ |
109 | 112 |
public void execute(String s) { |
110 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
111 |
MapControl mapCtrl = vista.getMapControl(); |
|
113 |
View theView = null; |
|
114 |
try{ |
|
115 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
116 |
}catch(ClassCastException exc){ |
|
117 |
return; |
|
118 |
} |
|
119 |
MapControl mapCtrl = theView.getMapControl(); |
|
112 | 120 |
|
113 | 121 |
if (s.compareTo("GEO_PAN") == 0) { |
114 | 122 |
mapCtrl.setTool("geoPan"); |
... | ... | |
119 | 127 |
FLyrGeoRaster lyrGeoRaster = null; |
120 | 128 |
|
121 | 129 |
//Obtenemos la capa |
122 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
123 | 130 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
124 | 131 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
125 | 132 |
if(lyr instanceof FLyrGeoRaster && lyr.getName().startsWith("*")) |
... | ... | |
129 | 136 |
//Asignamos el ?ltimo extent |
130 | 137 |
if(lyrGeoRaster != null){ |
131 | 138 |
lyrGeoRaster.setLastExtent(); |
132 |
vista.getMapControl().getMapContext().invalidate();
|
|
139 |
mapCtrl.getMapContext().invalidate();
|
|
133 | 140 |
} |
134 | 141 |
} else if (s.compareTo("GEO_MOVE_POINT") == 0) |
135 | 142 |
mapCtrl.setTool("geoMovePoint"); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/layers/FLyrGeoRaster.java | ||
---|---|---|
51 | 51 |
import com.iver.cit.gvsig.StackZoom; |
52 | 52 |
import com.iver.cit.gvsig.fmap.DriverException; |
53 | 53 |
import com.iver.cit.gvsig.fmap.ViewPort; |
54 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints.GeoPoint; |
|
54 | 55 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
55 | 56 |
import com.iver.cit.gvsig.gui.View; |
56 | 57 |
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog; |
57 |
import com.iver.cit.gvsig.gui.Panels.ZoomControlPanel; |
|
58 | 58 |
import com.iver.cit.gvsig.gui.Panels.TablePointsPanel.PointTable; |
59 | 59 |
|
60 | 60 |
|
... | ... | |
365 | 365 |
* crear? una. |
366 | 366 |
* @return Capa de puntos |
367 | 367 |
*/ |
368 |
public FLyrPoints getFLyrPoints(){ |
|
368 |
public FLyrPoints getFLyrPoints()throws ClassCastException{ |
|
369 |
|
|
369 | 370 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
370 |
|
|
371 |
|
|
371 | 372 |
//Si no existe una capa de puntos la creamos |
372 | 373 |
if(lyrPoints == null){ |
373 | 374 |
lyrPoints = new FLyrPoints(); |
... | ... | |
423 | 424 |
* dialogo y la tabla. |
424 | 425 |
* |
425 | 426 |
*/ |
426 |
public void updateData(int nPunto, Point2D pixel, Point2D map, GeoreferencingDialog dialog, View vista, FLyrPoints plyr){
|
|
427 |
if(dialog == null || vista == null || plyr == null)
|
|
427 |
public void updateData(int nPunto, Point2D pixel, Point2D map, GeoreferencingDialog dialog, View view, FLyrPoints plyr){
|
|
428 |
if(dialog == null || plyr == null) |
|
428 | 429 |
return; |
429 | 430 |
if(pixel == null && map == null) |
430 | 431 |
return; |
... | ... | |
432 | 433 |
//Actualizamos los textBox |
433 | 434 |
if(pixel != null){ |
434 | 435 |
dialog.setPixelText(pixel.getX(), pixel.getY()); |
435 |
dialog.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().lastTx = String.valueOf(pixel.getX());
|
|
436 |
dialog.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().lastTy = String.valueOf(pixel.getY());
|
|
436 |
dialog.getSelectPointsPanel().lastTx = String.valueOf(pixel.getX()); |
|
437 |
dialog.getSelectPointsPanel().lastTy = String.valueOf(pixel.getY()); |
|
437 | 438 |
} |
438 | 439 |
if(map != null){ |
439 | 440 |
dialog.setMapCoordText(map.getX(), map.getY()); |
440 |
dialog.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().lastLong = String.valueOf(map.getX());
|
|
441 |
dialog.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().lastLat = String.valueOf(map.getX());
|
|
441 |
dialog.getSelectPointsPanel().lastLong = String.valueOf(map.getX()); |
|
442 |
dialog.getSelectPointsPanel().lastLat = String.valueOf(map.getX()); |
|
442 | 443 |
} |
443 | 444 |
|
445 |
//El Checkbox de activaci?n |
|
446 |
dialog.getOptionsPanel().getCbActivePoint().setSelected(((GeoPoint)getFLyrPoints().getPoint(nPunto - 1)).active); |
|
447 |
|
|
444 | 448 |
//Actualizamos la tabla |
445 | 449 |
PointTable pointsTable = dialog.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getJTable(); |
446 |
if(pointsTable.getTable().getRowCount() < nPunto){
|
|
450 |
while(pointsTable.getTable().getRowCount() < nPunto)
|
|
447 | 451 |
pointsTable.getTableModel().addNew(); |
448 |
pointsTable.getTableModel().setValueAt(String.valueOf(nPunto - 1),nPunto - 1,0); |
|
449 |
} |
|
452 |
pointsTable.getTableModel().setValueAt(String.valueOf(nPunto - 1),nPunto - 1,0); |
|
453 |
|
|
454 |
//if(pointsTable.getTable().getRowCount() < nPunto){ |
|
455 |
//pointsTable.getTableModel().addNew(); |
|
456 |
//pointsTable.getTableModel().setValueAt(String.valueOf(nPunto - 1),nPunto - 1,0); |
|
457 |
//} |
|
450 | 458 |
if(pixel != null){ |
451 | 459 |
pointsTable.getTableModel().setValueAt(String.valueOf(pixel.getX()),nPunto - 1,1); |
452 | 460 |
pointsTable.getTableModel().setValueAt(String.valueOf(pixel.getY()),nPunto - 1,2); |
... | ... | |
457 | 465 |
} |
458 | 466 |
|
459 | 467 |
//Actualizamos la miniimagen |
460 |
ViewPort viewPort = vista.getMapControl().getMapContext().getViewPort(); |
|
461 |
if(pixel != null){ |
|
462 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setCenterPoint(this.img2World(pixel)); |
|
463 |
dialog.getConectorPanel().getAdjustGeorefPanel().setViewPort(viewPort); |
|
464 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
468 |
if(view != null){ |
|
469 |
ViewPort viewPort = view.getMapControl().getMapContext().getViewPort(); |
|
470 |
if(pixel != null){ |
|
471 |
dialog.getZoomControlLeft().setCenterPoint(this.img2World(pixel)); |
|
472 |
dialog.getConectorPanel().getAdjustGeorefPanel().setViewPort(viewPort); |
|
473 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
474 |
} |
|
475 |
|
|
476 |
if(map != null){ |
|
477 |
dialog.getZoomControlRight().setCenterPoint(map); |
|
478 |
dialog.getConectorPanel().getAdjustGeorefPanel().setViewPort(viewPort); |
|
479 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
|
480 |
} |
|
481 |
|
|
482 |
//Actualizamos la vista |
|
483 |
view.getMapControl().getMapContext().invalidate(); |
|
465 | 484 |
} |
466 |
|
|
467 |
if(map != null){ |
|
468 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setCenterPoint(map); |
|
469 |
dialog.getConectorPanel().getAdjustGeorefPanel().setViewPort(viewPort); |
|
470 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
|
471 |
} |
|
472 |
|
|
473 | 485 |
//Actualizamos la capa de puntos |
474 | 486 |
plyr.updatePoint(pixel, map, nPunto - 1); |
475 | 487 |
|
476 |
//Actualizamos la vista |
|
477 |
vista.getMapControl().getMapContext().invalidate(); |
|
478 | 488 |
} |
479 | 489 |
|
480 | 490 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/layers/FLyrPoints.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap.layers; |
42 | 42 |
|
43 | 43 |
import java.awt.Color; |
44 |
import java.awt.Dimension; |
|
44 | 45 |
import java.awt.Graphics2D; |
45 | 46 |
import java.awt.geom.Point2D; |
46 | 47 |
import java.awt.geom.Rectangle2D; |
... | ... | |
71 | 72 |
*/ |
72 | 73 |
public class FLyrPoints extends FLyrDefault { |
73 | 74 |
|
75 |
/** |
|
76 |
* Punto de la capa que representa una coordenada en pixeles de la imagen a |
|
77 |
* georreferenciar, una coordenada de la vista, el viewPort de las mini imagenes |
|
78 |
* ,el centro de estas y el flag activo que dice si el punto tiene que ser tomado en |
|
79 |
* cuenta o no. |
|
80 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
81 |
* |
|
82 |
*/ |
|
74 | 83 |
public class GeoPoint{ |
75 | 84 |
public Point2D pixelPoint = null; |
76 | 85 |
public Point2D mapPoint = null; |
77 | 86 |
public ViewPort leftViewPort = null, rightViewPort = null; |
78 | 87 |
public Point2D leftCenterPoint = null, rightCenterPoint = null; |
88 |
public boolean active = true; |
|
79 | 89 |
public GeoPoint(Point2D p, Point2D m){ |
80 | 90 |
this.pixelPoint = p; |
81 | 91 |
this.mapPoint = m; |
82 | 92 |
} |
93 |
|
|
94 |
/** |
|
95 |
* Hace una copia de la instancia del punto. |
|
96 |
* @return GeoPoint |
|
97 |
*/ |
|
98 |
public GeoPoint cloneGeoPoint(){ |
|
99 |
Point2D pixel = null; |
|
100 |
Point2D map = null; |
|
101 |
if(pixelPoint != null) |
|
102 |
pixel = (Point2D)pixelPoint.clone(); |
|
103 |
if(mapPoint != null) |
|
104 |
map = (Point2D)mapPoint.clone(); |
|
105 |
|
|
106 |
GeoPoint gp = new GeoPoint(pixel, map); |
|
107 |
|
|
108 |
if(leftViewPort != null){ |
|
109 |
gp.leftViewPort = new ViewPort(leftViewPort.getProjection()); |
|
110 |
gp.leftViewPort.setExtent((Rectangle2D)leftViewPort.getExtent().clone()); |
|
111 |
gp.leftViewPort.setImageSize((Dimension)leftViewPort.getImageSize().clone()); |
|
112 |
gp.leftViewPort.setScale(); |
|
113 |
} |
|
114 |
|
|
115 |
if(rightViewPort != null){ |
|
116 |
gp.rightViewPort = new ViewPort(rightViewPort.getProjection()); |
|
117 |
gp.rightViewPort.setExtent((Rectangle2D)rightViewPort.getExtent().clone()); |
|
118 |
gp.rightViewPort.setImageSize((Dimension)rightViewPort.getImageSize().clone()); |
|
119 |
gp.rightViewPort.setScale(); |
|
120 |
} |
|
121 |
|
|
122 |
if(leftCenterPoint != null) |
|
123 |
gp.leftCenterPoint = (Point2D)this.leftCenterPoint.clone(); |
|
124 |
if(rightCenterPoint != null) |
|
125 |
gp.rightCenterPoint = (Point2D)this.rightCenterPoint.clone(); |
|
126 |
gp.active = this.active; |
|
127 |
return gp; |
|
128 |
} |
|
83 | 129 |
|
84 | 130 |
} |
85 | 131 |
|
132 |
/** |
|
133 |
* Estado de la capa de puntos. |
|
134 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
135 |
* |
|
136 |
*/ |
|
137 |
public class FLyrPointsState{ |
|
138 |
public ArrayList pointList = new ArrayList(); |
|
139 |
public boolean showNumber = true; |
|
140 |
public String lastTool = "zoomIn"; |
|
141 |
} |
|
142 |
|
|
86 | 143 |
private ArrayList pointList = new ArrayList(); |
87 | 144 |
private final int DIAM_CIRCLE = 18; |
88 |
private String lastTool = null; |
|
145 |
private String lastTool = "zoomIn"; |
|
146 |
private boolean showNumber = true; |
|
147 |
private FLyrPointsState state = null; |
|
89 | 148 |
|
90 | 149 |
/** |
91 | 150 |
* Obtiene el array de puntos |
... | ... | |
96 | 155 |
} |
97 | 156 |
|
98 | 157 |
/** |
158 |
* Salva el estado actual de la capa de puntos. Podr? ser recuperado |
|
159 |
* este ?ltimo estado salvado con la funci?n recoveryState |
|
160 |
* |
|
161 |
*/ |
|
162 |
public void saveState(){ |
|
163 |
if(state == null) |
|
164 |
state = new FLyrPointsState(); |
|
165 |
else |
|
166 |
state.pointList.clear(); |
|
167 |
|
|
168 |
for(int i=0;i<pointList.size();i++) |
|
169 |
state.pointList.add(((GeoPoint)pointList.get(i)).cloneGeoPoint()); |
|
170 |
|
|
171 |
state.showNumber = showNumber; |
|
172 |
state.lastTool = lastTool; |
|
173 |
} |
|
174 |
|
|
175 |
/** |
|
176 |
* Recupera el estado de la capa de puntos desde la ?ltima vez que se |
|
177 |
* ejecut? la funci?n saveState. Si no hay ning?n estdo salvado es que |
|
178 |
* al principio estaba la capa vacia por lo que reiniciamos la capa de puntos. |
|
179 |
*/ |
|
180 |
public void recoveryState(){ |
|
181 |
if(state != null){ |
|
182 |
pointList.clear(); |
|
183 |
for(int i=0;i<state.pointList.size();i++) |
|
184 |
pointList.add(((GeoPoint)state.pointList.get(i)).cloneGeoPoint()); |
|
185 |
|
|
186 |
showNumber = state.showNumber; |
|
187 |
lastTool = state.lastTool; |
|
188 |
}else{ |
|
189 |
pointList = new ArrayList(); |
|
190 |
showNumber = true; |
|
191 |
lastTool = "zoomIn"; |
|
192 |
state = null; |
|
193 |
} |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
99 | 197 |
* Asigna el array de puntos |
100 | 198 |
* @param list |
101 | 199 |
*/ |
... | ... | |
109 | 207 |
*/ |
110 | 208 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, |
111 | 209 |
Cancellable cancel,double scale) throws DriverException { |
210 |
|
|
112 | 211 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
113 | 212 |
//BufferedImage img = theView.getMapControl().getImage(); |
114 | 213 |
//g.drawImage(img, 0, 0, null); |
... | ... | |
132 | 231 |
//Punto de la imagen |
133 | 232 |
pto = ((GeoPoint)pointList.get(i)).pixelPoint; |
134 | 233 |
|
135 |
if(pto != null){ |
|
136 |
Point2D p = lyrGeoRaster.img2World(pto); |
|
137 |
p = vp.fromMapPoint(p); |
|
138 |
drawPixelCrux(g, p); |
|
234 |
if(((GeoPoint)pointList.get(i)).active){ |
|
235 |
if(pto != null){ |
|
236 |
Point2D p = lyrGeoRaster.img2World(pto); |
|
237 |
p = vp.fromMapPoint(p); |
|
238 |
drawPixelCrux(g, p, i); |
|
239 |
|
|
240 |
} |
|
139 | 241 |
|
242 |
//Punto de la vista |
|
243 |
pto = ((GeoPoint)pointList.get(i)).mapPoint; |
|
244 |
if(pto != null){ |
|
245 |
Point2D p = vp.fromMapPoint(pto); |
|
246 |
drawMapCrux(g, p, i); |
|
247 |
} |
|
140 | 248 |
} |
141 |
|
|
142 |
//Punto de la vista |
|
143 |
pto = ((GeoPoint)pointList.get(i)).mapPoint; |
|
144 |
if(pto != null){ |
|
145 |
Point2D p = vp.fromMapPoint(pto); |
|
146 |
drawMapCrux(g, p); |
|
147 |
} |
|
148 | 249 |
} |
149 | 250 |
} |
150 | 251 |
} |
... | ... | |
154 | 255 |
* el pixel de la imagen. |
155 | 256 |
* @param g Graphics |
156 | 257 |
*/ |
157 |
private void drawPixelCrux(Graphics2D g, Point2D p){ |
|
258 |
private void drawPixelCrux(Graphics2D g, Point2D p, int pointNumber){
|
|
158 | 259 |
int dpto = (DIAM_CIRCLE >> 1); |
159 | 260 |
int incr = 5; |
160 | 261 |
g.setColor(Color.WHITE); |
... | ... | |
162 | 263 |
(int)p.getY() - dpto + 1, |
163 | 264 |
DIAM_CIRCLE - 2, |
164 | 265 |
DIAM_CIRCLE - 2); |
266 |
g.drawLine((int)p.getX() - incr, (int)p.getY() - 1, (int)p.getX() - 1, (int)p.getY() - 1); |
|
267 |
g.drawLine((int)p.getX() - incr, (int)p.getY() + 1, (int)p.getX() - 1, (int)p.getY() + 1); |
|
268 |
|
|
269 |
g.drawLine((int)p.getX() + incr, (int)p.getY() - 1, (int)p.getX() + 1, (int)p.getY() - 1); |
|
270 |
g.drawLine((int)p.getX() + incr, (int)p.getY() + 1, (int)p.getX() + 1, (int)p.getY() + 1); |
|
271 |
|
|
272 |
g.drawLine((int)p.getX() - 1, (int)p.getY() - incr, (int)p.getX() - 1, (int)p.getY() - 1); |
|
273 |
g.drawLine((int)p.getX() + 1, (int)p.getY() - incr, (int)p.getX() + 1, (int)p.getY() - 1); |
|
274 |
|
|
275 |
g.drawLine((int)p.getX() - 1, (int)p.getY() + incr, (int)p.getX() - 1, (int)p.getY() + 1); |
|
276 |
g.drawLine((int)p.getX() + 1, (int)p.getY() + incr, (int)p.getX() + 1, (int)p.getY() + 1); |
|
277 |
|
|
165 | 278 |
g.setColor(Color.red); |
166 | 279 |
g.drawOval( (int)p.getX() - dpto, |
167 | 280 |
(int)p.getY() - dpto, |
168 | 281 |
DIAM_CIRCLE, |
169 | 282 |
DIAM_CIRCLE); |
170 |
g.drawLine((int)p.getX() - dpto, (int)p.getY() - dpto , (int)p.getX() - dpto + DIAM_CIRCLE, (int)p.getY() - dpto + DIAM_CIRCLE); |
|
171 |
g.drawLine((int)p.getX() - dpto, (int)p.getY() - dpto + DIAM_CIRCLE, (int)p.getX() - dpto + DIAM_CIRCLE, (int)p.getY() - dpto); |
|
172 |
//g.drawLine((int)p.getX() - dpto, (int)p.getY() - dpto + 3, (int)p.getX() - dpto + DIAM_CIRCLE, (int)p.getY() - dpto + DIAM_CIRCLE - 3); |
|
173 |
//g.drawLine((int)p.getX() - dpto + 3, (int)p.getY() - dpto + DIAM_CIRCLE, (int)p.getX() - dpto + DIAM_CIRCLE - 3, (int)p.getY() - dpto); |
|
283 |
g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr); |
|
284 |
g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY()); |
|
285 |
//g.drawLine((int)p.getX() - dpto, (int)p.getY() - dpto , (int)p.getX() - dpto + DIAM_CIRCLE, (int)p.getY() - dpto + DIAM_CIRCLE); |
|
286 |
//g.drawLine((int)p.getX() - dpto, (int)p.getY() - dpto + DIAM_CIRCLE, (int)p.getX() - dpto + DIAM_CIRCLE, (int)p.getY() - dpto); |
|
287 |
|
|
288 |
if(showNumber){ |
|
289 |
g.setColor(Color.WHITE); |
|
290 |
g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 4), (int)(p.getY() - dpto - 4) ); |
|
291 |
g.setColor(Color.red); |
|
292 |
g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 1), (int)(p.getY() - dpto - 1) ); |
|
293 |
} |
|
174 | 294 |
} |
175 | 295 |
|
176 | 296 |
/** |
... | ... | |
178 | 298 |
* la coordenada de la vista. |
179 | 299 |
* @param g Graphics |
180 | 300 |
*/ |
181 |
private void drawMapCrux(Graphics2D g, Point2D p){ |
|
301 |
private void drawMapCrux(Graphics2D g, Point2D p, int pointNumber){
|
|
182 | 302 |
int dpto = (DIAM_CIRCLE >> 1); |
183 | 303 |
int incr = 5; |
184 | 304 |
g.setColor(Color.WHITE); |
... | ... | |
205 | 325 |
DIAM_CIRCLE); |
206 | 326 |
g.drawLine((int)p.getX(), (int)p.getY() - dpto - incr, (int)p.getX(), (int)p.getY() + dpto + incr); |
207 | 327 |
g.drawLine((int)p.getX() - dpto - incr, (int)p.getY(), (int)p.getX() + dpto + incr, (int)p.getY()); |
328 |
if(showNumber){ |
|
329 |
g.setColor(Color.WHITE); |
|
330 |
g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 4), (int)(p.getY() - dpto - 4) ); |
|
331 |
g.setColor(new Color(45, 8 , 165)); |
|
332 |
g.drawString(String.valueOf(pointNumber + 1), (int)(p.getX() + dpto + 1), (int)(p.getY() - dpto - 1) ); |
|
333 |
} |
|
208 | 334 |
} |
209 | 335 |
|
210 | 336 |
/* (non-Javadoc) |
... | ... | |
302 | 428 |
else |
303 | 429 |
return 0; |
304 | 430 |
} |
305 |
|
|
431 |
|
|
306 | 432 |
/** |
433 |
* Activa o desactiva el punto de una posici?n de la lista |
|
434 |
* @param n N?mero de punto |
|
435 |
* @param active true activo, false desactivo |
|
436 |
*/ |
|
437 |
public void setPointActive(int n, boolean active){ |
|
438 |
if(n < 0 || n >= this.length()) |
|
439 |
return; |
|
440 |
((GeoPoint)pointList.get(n)).active = active; |
|
441 |
} |
|
442 |
|
|
443 |
/** |
|
444 |
* Dice si un punto de la lista est? activo o no |
|
445 |
* @param n Posici?n del punto |
|
446 |
* @return true si est? activo y false si no lo est?. |
|
447 |
*/ |
|
448 |
public boolean isPointActive(int n){ |
|
449 |
if(n < 0 || n >= this.length()) |
|
450 |
return false; |
|
451 |
return ((GeoPoint)pointList.get(n)).active; |
|
452 |
} |
|
453 |
|
|
454 |
/** |
|
307 | 455 |
* Obtiene el extent de la capa |
308 | 456 |
* @return extent en Rectangle2D. |
309 | 457 |
*/ |
... | ... | |
389 | 537 |
* @param panel donde se carga la informaci?n |
390 | 538 |
*/ |
391 | 539 |
public void loadVisualPoint(int pos, GeoreferencingDialog dialog){ |
392 |
GeoPoint pto = this.getPoint(pos); |
|
540 |
GeoPoint pto = null; |
|
541 |
try{ |
|
542 |
pto = this.getPoint(pos); |
|
543 |
}catch(ArrayIndexOutOfBoundsException exc){ |
|
544 |
//Todavia no hay puntos por lo que no hacemos nada |
|
545 |
return; |
|
546 |
} |
|
393 | 547 |
DataPointPanel dpp = dialog.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getDataPointPanel(); |
548 |
|
|
549 |
//Llenamos los JTextField con los valores del punto |
|
394 | 550 |
if(pto.pixelPoint != null){ |
395 | 551 |
dpp.getTX().setText(""+pto.pixelPoint.getX()); |
396 | 552 |
dpp.getTY().setText(""+pto.pixelPoint.getY()); |
... | ... | |
400 | 556 |
dpp.getLongitud().setText(tailDecimal(""+pto.mapPoint.getX())); |
401 | 557 |
} |
402 | 558 |
|
559 |
//El Checkbox de activaci?n |
|
560 |
dialog.getOptionsPanel().getCbActivePoint().setSelected(pto.active); |
|
561 |
|
|
403 | 562 |
//Seleccionamos la fila de la tabla |
404 | 563 |
PointTable table = dialog.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getJTable(); |
405 |
table.getTable().setRowSelectionInterval(pos, pos); |
|
564 |
try{ |
|
565 |
table.getTable().setRowSelectionInterval(pos, pos); |
|
566 |
}catch(IllegalArgumentException exc){ |
|
567 |
System.err.println("Intervalo erroneo "+pos); |
|
568 |
} |
|
406 | 569 |
|
407 | 570 |
//Cargamos las mini imagenes |
408 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setCenterPoint(getCenterPoint(pos, false));
|
|
409 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().setNewViewPort(getMiniExtent(pos, false));
|
|
410 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw();
|
|
571 |
dialog.getZoomControlLeft().setCenterPoint(getCenterPoint(pos, false));
|
|
572 |
dialog.getZoomControlLeft().setNewViewPort(getMiniExtent(pos, false));
|
|
573 |
dialog.getZoomControlLeft().draw();
|
|
411 | 574 |
|
412 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setCenterPoint(getCenterPoint(pos, true));
|
|
413 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().setNewViewPort(getMiniExtent(pos, true));
|
|
414 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw();
|
|
575 |
dialog.getZoomControlRight().setCenterPoint(getCenterPoint(pos, true));
|
|
576 |
dialog.getZoomControlRight().setNewViewPort(getMiniExtent(pos, true));
|
|
577 |
dialog.getZoomControlRight().draw();
|
|
415 | 578 |
} |
416 | 579 |
|
417 | 580 |
/** |
... | ... | |
433 | 596 |
agp.getZoomRight().clear(); |
434 | 597 |
|
435 | 598 |
//Actualizamos la vista |
436 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
437 |
theView.getMapControl().getMapContext().invalidate(); |
|
599 |
View theView = null; |
|
600 |
try{ |
|
601 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
602 |
theView.getMapControl().getMapContext().invalidate(); |
|
603 |
}catch(ClassCastException exc){ |
|
604 |
return; |
|
605 |
} |
|
438 | 606 |
} |
439 | 607 |
|
440 | 608 |
/** |
... | ... | |
446 | 614 |
remove(pos); |
447 | 615 |
|
448 | 616 |
//Actualiza los controles de tabla y selector |
617 |
grd.getSelectPointsPanel().getTableControlerPanel().setNItems(this.length()); |
|
449 | 618 |
grd.getConectorPanel().getDataPointsTabPanel(). |
450 |
getSelectPointsPanel().getTableControlerPanel().setNItems(this.length()); |
|
451 |
grd.getConectorPanel().getDataPointsTabPanel(). |
|
452 | 619 |
getTablePointsPanel().getTableControlerPanel().setNItems(this.length()); |
453 | 620 |
|
454 | 621 |
//Elimina la fila de la tabla y renumera los puntos |
... | ... | |
461 | 628 |
|
462 | 629 |
//Carga los puntos |
463 | 630 |
if(pos == 0){ |
464 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getTableControlerPanel().setSelectedIndex(pos);
|
|
631 |
grd.getSelectPointsPanel().getTableControlerPanel().setSelectedIndex(pos); |
|
465 | 632 |
loadVisualPoint(pos, grd); |
466 | 633 |
}else{ |
467 | 634 |
grd.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().getTableControlerPanel().setSelectedIndex(pos - 1); |
... | ... | |
469 | 636 |
} |
470 | 637 |
|
471 | 638 |
//Redibujamos la vista |
472 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
473 |
theView.getMapControl().getMapContext().invalidate(); |
|
639 |
View theView = null; |
|
640 |
try{ |
|
641 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
642 |
theView.getMapControl().getMapContext().invalidate(); |
|
643 |
}catch(ClassCastException exc){ |
|
644 |
return; |
|
645 |
} |
|
474 | 646 |
} |
475 | 647 |
|
476 | 648 |
/** |
... | ... | |
488 | 660 |
System.out.println("PUNTO "+i+": NULL"); |
489 | 661 |
} |
490 | 662 |
} |
663 |
|
|
664 |
/** |
|
665 |
* @return Returns the showNumber. |
|
666 |
*/ |
|
667 |
public boolean isShowNumber() { |
|
668 |
return showNumber; |
|
669 |
} |
|
670 |
|
|
671 |
/** |
|
672 |
* @param showNumber The showNumber to set. |
|
673 |
*/ |
|
674 |
public void setShowNumber(boolean showNumber) { |
|
675 |
this.showNumber = showNumber; |
|
676 |
} |
|
491 | 677 |
} |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoRedimBehavior.java | ||
---|---|---|
136 | 136 |
/** |
137 | 137 |
* Funci?n que carga la capa si todav?a no lo est?. |
138 | 138 |
*/ |
139 |
private void loadLayer() throws InstantiationException{ |
|
139 |
private void loadLayer() throws InstantiationException, ClassCastException{
|
|
140 | 140 |
//Cargamos la capa |
141 | 141 |
|
142 | 142 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
... | ... | |
177 | 177 |
}catch(InstantiationException exc){ |
178 | 178 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
179 | 179 |
PluginServices.getText(this, "error_capa_puntos")); |
180 |
}catch(ClassCastException exc){ |
|
181 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
182 |
PluginServices.getText(this, "error_capa_puntos")); |
|
180 | 183 |
} |
184 |
|
|
181 | 185 |
} |
182 | 186 |
|
183 | 187 |
/** |
... | ... | |
196 | 200 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
197 | 201 |
PluginServices.getText(this, "error_capa_puntos")); |
198 | 202 |
return; |
203 |
}catch(ClassCastException exc){ |
|
204 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
205 |
PluginServices.getText(this, "error_capa_puntos")); |
|
206 |
return; |
|
199 | 207 |
} |
200 | 208 |
|
201 | 209 |
tmpUl = ul; |
... | ... | |
376 | 384 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
377 | 385 |
PluginServices.getText(this, "error_capa_puntos")); |
378 | 386 |
return; |
387 |
}catch(ClassCastException exc){ |
|
388 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
389 |
PluginServices.getText(this, "error_capa_puntos")); |
|
390 |
return; |
|
379 | 391 |
} |
380 | 392 |
|
381 | 393 |
double wcX = vp.toMapPoint(e.getX(), e.getY()).getX(); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoMoveBehavior.java | ||
---|---|---|
117 | 117 |
/** |
118 | 118 |
* Funci?n que carga la capa si todav?a no lo est?. |
119 | 119 |
*/ |
120 |
private void loadLayer() throws InstantiationException{ |
|
120 |
private void loadLayer() throws InstantiationException, ClassCastException{
|
|
121 | 121 |
//Cargamos la capa |
122 | 122 |
|
123 | 123 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
... | ... | |
164 | 164 |
}catch(InstantiationException exc){ |
165 | 165 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
166 | 166 |
PluginServices.getText(this, "error_capa_puntos")); |
167 |
}catch(ClassCastException exc){ |
|
168 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
169 |
PluginServices.getText(this, "error_capa_puntos")); |
|
167 | 170 |
} |
168 | 171 |
|
169 | 172 |
} |
... | ... | |
188 | 191 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
189 | 192 |
PluginServices.getText(this, "error_capa_puntos")); |
190 | 193 |
return; |
194 |
}catch(ClassCastException exc){ |
|
195 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
|
196 |
PluginServices.getText(this, "error_capa_puntos")); |
|
197 |
return; |
|
191 | 198 |
} |
192 | 199 |
|
193 | 200 |
ViewPort vp = getMapControl().getMapContext().getViewPort(); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toc/GeoRasterTocMenuEntry.java | ||
---|---|---|
55 | 55 |
import com.iver.cit.gvsig.gui.View; |
56 | 56 |
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog; |
57 | 57 |
import com.iver.cit.gvsig.gui.Panels.GeoRasterWizard; |
58 |
import com.iver.cit.gvsig.gui.wizards.WizardListenerSupport; |
|
58 | 59 |
|
59 | 60 |
/** |
60 | 61 |
* Cambia las propiedades de la conexi?n al servidor WCS. |
... | ... | |
64 | 65 |
public class GeoRasterTocMenuEntry extends TocMenuEntry{ |
65 | 66 |
private JMenuItem propsMenuItem; |
66 | 67 |
private FLayer lyr = null; |
67 |
|
|
68 |
|
|
68 |
|
|
69 | 69 |
public void initialize(FPopupMenu m) { |
70 | 70 |
super.initialize(m); |
71 | 71 |
|
... | ... | |
95 | 95 |
|
96 | 96 |
|
97 | 97 |
PluginServices.getMainFrame().enableControls(); |
98 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
99 |
MapControl mapCtrl = vista.getMapControl(); |
|
100 | 98 |
|
101 | 99 |
//Modificamos el nombre de la capa |
102 | 100 |
if ((lyr instanceof FLyrGeoRaster)){ |
... | ... | |
107 | 105 |
geoDialog.getSelectPointsPanel().resetControls(false); |
108 | 106 |
geoDialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().removeAllItems(); |
109 | 107 |
|
108 |
//Salvamos el estado actual de la capa por si se cancela. |
|
109 |
if(lyrGeoRaster.getFLyrPoints() != null) |
|
110 |
lyrGeoRaster.getFLyrPoints().saveState(); |
|
111 |
|
|
110 | 112 |
//Cargamos la capa de puntos y los puntos desde la capa en el cuadro. |
111 |
geoDialog.getSelectPointsPanel().loadFromLyrPoints(lyrGeoRaster.getFLyrPoints()); |
|
113 |
geoDialog.getSelectPointsPanel().loadFromLyrPoints(lyrGeoRaster.getFLyrPoints());
|
|
112 | 114 |
} |
113 | 115 |
|
114 | 116 |
//Lanzamos el dialogo |
... | ... | |
126 | 128 |
panel.pack(); |
127 | 129 |
panel.setSize(geoDialog.getWidth(), geoDialog.getHeight() + 10); |
128 | 130 |
panel.show(); |
129 |
|
|
131 |
|
|
132 |
PluginServices.getMainFrame().enableControls(); |
|
133 |
|
|
130 | 134 |
} |
135 |
|
|
136 |
|
|
131 | 137 |
} |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toolListeners/GeorefPointSelectorListener.java | ||
---|---|---|
106 | 106 |
public void point(PointEvent event) throws BehaviorException { |
107 | 107 |
super.point(event); |
108 | 108 |
|
109 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
109 |
try{ |
|
110 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
111 |
}catch(ClassCastException exc){ |
|
112 |
return; |
|
113 |
} |
|
110 | 114 |
//Obtenemos la capa de puntos y la capa de georaster |
111 | 115 |
|
112 | 116 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
... | ... | |
152 | 156 |
|
153 | 157 |
//Deseleccionamos la herramienta de marcado de puntos |
154 | 158 |
theView.getMapControl().setTool(lyrPoints.getLastTool()); |
159 |
|
|
155 | 160 |
|
156 | 161 |
int n = Integer.valueOf(dialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().getSelectedItem().toString()).intValue(); |
157 | 162 |
lyrGeoRaster.updateData(n, |
... | ... | |
160 | 165 |
dialog, |
161 | 166 |
theView, |
162 | 167 |
lyrPoints); |
168 |
dialog.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
163 | 169 |
firstPoint = true; |
164 | 170 |
} |
165 | 171 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toolListeners/GeoRasterFrameListener.java | ||
---|---|---|
72 | 72 |
|
73 | 73 |
//Anulamos todos los cambios cargando el extent de origen a la capa |
74 | 74 |
//Cambiamos el nombre a la capa de georreferenciaci?n y eliminamos la capa de puntos. |
75 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
75 |
View theView = null; |
|
76 |
try{ |
|
77 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
78 |
}catch(ClassCastException exc){ |
|
79 |
return; |
|
80 |
} |
|
76 | 81 |
|
77 | 82 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
78 | 83 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
... | ... | |
91 | 96 |
((FLyrGeoRaster)lyr).getGeoDialog().getSelectPointsPanel().clearList(); |
92 | 97 |
|
93 | 98 |
} |
94 |
System.out.println("ELIMINAR!!"); |
|
95 |
if( lyr instanceof FLyrPoints){ |
|
96 |
System.out.println("ELIMINANDO "+lyr.getName()); |
|
99 |
|
|
100 |
if( lyr instanceof FLyrPoints) |
|
97 | 101 |
theView.getMapControl().getMapContext().getLayers().removeLayer(i); |
98 |
} |
|
102 |
|
|
103 |
|
|
99 | 104 |
} |
100 | 105 |
|
101 | 106 |
PluginServices.getMainFrame().enableControls(); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/toolListeners/GeorefMovePointListener.java | ||
---|---|---|
103 | 103 |
*/ |
104 | 104 |
public void press(PointEvent event) throws BehaviorException { |
105 | 105 |
super.press(event); |
106 |
|
|
107 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
106 |
|
|
107 |
try{ |
|
108 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
109 |
}catch(ClassCastException exc){ |
|
110 |
return; |
|
111 |
} |
|
108 | 112 |
viewPort = theView.getMapControl().getMapContext().getViewPort(); |
109 | 113 |
FLayers flayers = theView.getMapControl().getMapContext().getLayers(); |
110 | 114 |
|
... | ... | |
123 | 127 |
//Hallamos el punto m?s cercano a donde hemos pinchado |
124 | 128 |
Point2D init = viewPort.toMapPoint(event.getPoint()); |
125 | 129 |
double distance = Double.MAX_VALUE; |
126 |
System.out.println("---"+distance+" "+lyrPoints.getCountPoints()+" "+lyrPoints.length()); |
|
130 |
|
|
127 | 131 |
for(int i=0;i<lyrPoints.length();i++){ |
128 | 132 |
Point2D pixel = lyrGeoRaster.img2World(lyrPoints.getPoint(i).pixelPoint); |
129 | 133 |
Point2D map = lyrPoints.getPoint(i).mapPoint; |
... | ... | |
152 | 156 |
* @throws BehaviorException Excepci?n lanzada cuando el Maptool. |
153 | 157 |
*/ |
154 | 158 |
public void release(PointEvent e) throws BehaviorException { |
155 |
System.out.println("--*-"+posPoint); |
|
159 |
|
|
156 | 160 |
if(posPoint != -1){ |
161 |
//Seleccionamos en el dialogo el punto que se est? moviendo |
|
162 |
lyrGeoRaster.getGeoDialog().getSelectPointsPanel().changePoint(true, posPoint); |
|
163 |
|
|
157 | 164 |
if(isPixel){ |
158 | 165 |
//Comprobamos que el punto siga dentro de la imagen |
159 | 166 |
Point2D pixelPoint = lyrGeoRaster.world2Img(viewPort.toMapPoint(e.getPoint())); |
... | ... | |
181 | 188 |
theView, |
182 | 189 |
lyrPoints); |
183 | 190 |
} |
191 |
|
|
192 |
|
|
184 | 193 |
} |
185 | 194 |
} |
186 | 195 |
} |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Dialogs/GeoreferencingDialog.java | ||
---|---|---|
27 | 27 |
import com.iver.cit.gvsig.fmap.tools.Behavior.GeoRedimBehavior; |
28 | 28 |
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior; |
29 | 29 |
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior; |
30 |
import com.iver.cit.gvsig.gui.View; |
|
31 | 30 |
import com.iver.cit.gvsig.gui.Panels.ConectorPanel; |
31 |
import com.iver.cit.gvsig.gui.Panels.OptionsPanel; |
|
32 | 32 |
import com.iver.cit.gvsig.gui.Panels.SelectPointsPanel; |
33 |
import com.iver.cit.gvsig.gui.Panels.ZoomControlPanel; |
|
33 | 34 |
import com.iver.cit.gvsig.gui.toolListeners.GeorefMovePointListener; |
34 | 35 |
import com.iver.cit.gvsig.gui.toolListeners.GeorefPanListener; |
35 | 36 |
import com.iver.cit.gvsig.gui.toolListeners.GeorefPointSelectorListener; |
... | ... | |
54 | 55 |
private JButton bSave = null; // @jve:decl-index=0: |
55 | 56 |
private GeoRedimBehavior rb = null; |
56 | 57 |
private GeoMoveBehavior mb = null; |
57 |
private static boolean loadTools = false;
|
|
58 |
private boolean loadTools = false; |
|
58 | 59 |
private JInternalFrame frame = null; |
59 | 60 |
|
60 | 61 |
private ConectorPanel conectorPanel = null; |
... | ... | |
100 | 101 |
private void initialize() { |
101 | 102 |
//Cargamos las herramientas la primera vez que abrimos la ventana |
102 | 103 |
if(!loadTools){ |
103 |
GeoreferencingDialog.loadTools = true; |
|
104 |
com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
|
104 |
loadTools = true; |
|
105 |
com.iver.cit.gvsig.gui.View vista = null; |
|
106 |
try{ |
|
107 |
vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
|
108 |
}catch(ClassCastException exc){ |
|
109 |
return; |
|
110 |
} |
|
105 | 111 |
MapControl mapCtrl = vista.getMapControl(); |
106 | 112 |
|
107 | 113 |
StatusBarListener sbl = new StatusBarListener(mapCtrl); |
... | ... | |
229 | 235 |
this.mb = mb; |
230 | 236 |
} |
231 | 237 |
|
238 |
/** |
|
239 |
* Obtiene el punto de la lista que ha sido seleccionado |
|
240 |
* @return |
|
241 |
*/ |
|
242 |
public int getSelectedPoint(){ |
|
243 |
return getConectorPanel().getDataPointsTabPanel(). |
|
244 |
getSelectPointsPanel().getTableControlerPanel().getSelectedIndex(); |
|
245 |
} |
|
232 | 246 |
|
247 |
/** |
|
248 |
* Obtiene el control de la mini imagen que tiene los botones a la izquierda |
|
249 |
* @return ZoomControlPanel |
|
250 |
*/ |
|
251 |
public ZoomControlPanel getZoomControlLeft(){ |
|
252 |
return this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft(); |
|
253 |
} |
|
254 |
|
|
255 |
/** |
|
256 |
* Obtiene el control de la mini imagen que tiene los botones a la derecha |
|
257 |
* @return ZoomControlPanel |
|
258 |
*/ |
|
259 |
public ZoomControlPanel getZoomControlRight(){ |
|
260 |
return this.getConectorPanel().getAdjustGeorefPanel().getZoomRight(); |
|
261 |
} |
|
262 |
|
|
263 |
/** |
|
264 |
* Obtiene el panel de selecci?n de puntos |
|
265 |
* @return Panel de selecci?n de puntos |
|
266 |
*/ |
|
267 |
public SelectPointsPanel getSelectPointsPanel(){ |
|
268 |
return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel(); |
|
269 |
} |
|
270 |
|
|
271 |
/** |
|
272 |
* Obtiene el panel de opciones |
|
273 |
* @return OptionPanel |
|
274 |
*/ |
|
275 |
public OptionsPanel getOptionsPanel(){ |
|
276 |
return getConectorPanel().getAdjustGeorefPanel().getOptionsPanel(); |
|
277 |
} |
|
278 |
|
|
233 | 279 |
/* (non-Javadoc) |
234 | 280 |
* @see com.iver.andami.ui.mdiManager.SingletonView#getViewModel() |
235 | 281 |
*/ |
... | ... | |
275 | 321 |
* </UL> |
276 | 322 |
*/ |
277 | 323 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
278 |
if(e.getSource() == bAceptar){ |
|
279 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
280 |
FLyrGeoRaster lyrGeoRaster = null; |
|
281 |
FLyrPoints lyrPoints = null; |
|
282 |
|
|
324 |
com.iver.cit.gvsig.gui.View theView = null; |
|
325 |
try{ |
|
326 |
theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView(); |
|
327 |
}catch(ClassCastException exc){ |
|
328 |
return; |
|
329 |
} |
|
330 |
FLyrPoints lyrPoints = null; |
|
331 |
FLyrGeoRaster lyrGeoRaster = null; |
|
332 |
|
|
333 |
if(e.getSource() == bAceptar || e.getSource() == bCancelar){ |
|
283 | 334 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
284 | 335 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
285 | 336 |
if( lyr instanceof FLyrGeoRaster && |
286 | 337 |
lyr.getName().startsWith("*") && |
287 | 338 |
lyr.isActive()){ |
288 |
|
|
289 |
//Campbiamos el nombre a la capa GeoRaster |
|
290 |
lyr.setName(lyr.getName().substring(1, lyr.getName().length())); |
|
291 |
lyr.setActive(false); |
|
339 |
|
|
292 | 340 |
lyrGeoRaster = (FLyrGeoRaster)lyr; |
293 |
lyrPoints = lyrGeoRaster.getFLyrPoints(); |
|
341 |
try{ |
|
342 |
lyrPoints = lyrGeoRaster.getFLyrPoints(); |
|
343 |
|
|
344 |
//Si cancelamos recuperamos el estado inicial de la capa de puntos |
|
345 |
if(e.getSource() == bCancelar) |
|
346 |
lyrPoints.recoveryState(); |
|
347 |
|
|
348 |
}catch(ClassCastException exc){ |
|
349 |
return; |
|
350 |
} |
|
351 |
|
|
352 |
if(e.getSource() == bAceptar){ |
|
353 |
//Campbiamos el nombre a la capa GeoRaster |
|
354 |
lyr.setName(lyr.getName().substring(1, lyr.getName().length())); |
|
355 |
lyr.setActive(false); |
|
356 |
} |
|
357 |
|
|
294 | 358 |
} |
295 |
} |
|
296 |
|
|
297 |
|
|
359 |
} |
|
298 | 360 |
theView.getMapControl().setTool("zoomIn"); |
299 |
|
|
300 |
//Cerramos la ventana |
|
361 |
|
|
362 |
//Cerramos la ventana
|
|
301 | 363 |
//(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener) |
302 | 364 |
try{ |
303 | 365 |
frame.setClosed(true); |
304 | 366 |
}catch(PropertyVetoException exc){} |
305 | 367 |
} |
306 | 368 |
|
369 |
|
|
307 | 370 |
} |
308 | 371 |
|
309 | 372 |
/** |
... | ... | |
341 | 404 |
if (bCancelar == null) { |
342 | 405 |
bCancelar = new JButton(); |
343 | 406 |
bCancelar.setText(PluginServices.getText(this,"cancelar")); |
344 |
bCancelar.addActionListener(new java.awt.event.ActionListener() { |
|
345 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
346 |
//Cerramos la ventana |
|
347 |
//(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener) |
|
348 |
try{ |
|
349 |
frame.setClosed(true); |
|
350 |
}catch(PropertyVetoException exc){} |
|
351 |
} |
|
352 |
}); |
|
407 |
bCancelar.addActionListener(this); |
|
353 | 408 |
} |
354 | 409 |
return bCancelar; |
355 | 410 |
} |
... | ... | |
414 | 469 |
this.getConectorPanel().setCanvasVisible(true); |
415 | 470 |
} |
416 | 471 |
frame.pack(); |
417 |
} |
|
472 |
}
|
|
418 | 473 |
|
419 |
public SelectPointsPanel getSelectPointsPanel(){ |
|
420 |
return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel(); |
|
421 |
} |
|
422 |
|
|
423 |
|
|
424 | 474 |
/* (non-Javadoc) |
425 | 475 |
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent) |
426 | 476 |
*/ |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/OptionsPanel.java | ||
---|---|---|
4 | 4 |
import java.awt.FlowLayout; |
5 | 5 |
import java.awt.GridBagConstraints; |
6 | 6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.event.ActionEvent; |
|
8 |
import java.awt.event.ActionListener; |
|
7 | 9 |
|
8 | 10 |
import javax.swing.JCheckBox; |
9 | 11 |
import javax.swing.JLabel; |
10 | 12 |
import javax.swing.JPanel; |
11 | 13 |
|
12 | 14 |
import com.iver.andami.PluginServices; |
15 |
import com.iver.cit.gvsig.fmap.layers.FLyrPoints; |
|
16 |
import com.iver.cit.gvsig.gui.View; |
|
17 |
import com.iver.cit.gvsig.gui.Dialogs.GeoreferencingDialog; |
|
13 | 18 |
/** |
14 | 19 |
* Panel que contiene opciones de georreferenciaci?n a elegir por |
15 | 20 |
* el usuario. Esta clase no maneja eventos. |
... | ... | |
17 | 22 |
* @author Nacho Brodin (brodin_ign@gva.es) |
18 | 23 |
* |
19 | 24 |
*/ |
20 |
public class OptionsPanel extends JPanel{ |
|
25 |
public class OptionsPanel extends JPanel implements ActionListener{
|
|
21 | 26 |
|
22 | 27 |
|
23 | 28 |
private JPanel pGeneral = null; |
24 |
private JPanel pCalcErrores = null;
|
|
25 |
private JCheckBox jCheckBox = null;
|
|
29 |
private JPanel pShowPoints = null;
|
|
30 |
private JCheckBox CbActivePoint = null;
|
|
26 | 31 |
private JLabel jLabel = null; |
32 |
private JCheckBox CbShowPoints = null; |
|
33 |
private JLabel jLabel1 = null; |
|
34 |
private GeoreferencingDialog grd = null; |
|
35 |
|
|
27 | 36 |
/** |
28 | 37 |
* This is the default constructor |
29 | 38 |
*/ |
30 |
public OptionsPanel() { |
|
39 |
public OptionsPanel(GeoreferencingDialog grd) {
|
|
31 | 40 |
super(); |
41 |
this.grd = grd; |
|
32 | 42 |
initialize(); |
33 | 43 |
} |
34 | 44 |
|
... | ... | |
61 | 71 |
gridBagConstraints5.anchor = java.awt.GridBagConstraints.CENTER; |
62 | 72 |
gridBagConstraints5.gridheight = 1; |
63 | 73 |
gridBagConstraints5.gridwidth = 1; |
64 |
pGeneral.add(getPCalcErrores(), gridBagConstraints5);
|
|
74 |
pGeneral.add(getPShowPoints(), gridBagConstraints5);
|
|
65 | 75 |
} |
66 | 76 |
return pGeneral; |
67 | 77 |
} |
... | ... | |
70 | 80 |
* |
71 | 81 |
* @return javax.swing.JPanel |
72 | 82 |
*/ |
73 |
private JPanel getPCalcErrores() { |
|
74 |
if (pCalcErrores == null) { |
|
83 |
private JPanel getPShowPoints() { |
|
84 |
if (pShowPoints == null) { |
|
85 |
jLabel1 = new JLabel(); |
|
86 |
jLabel1.setText(PluginServices.getText(this,"mostrar_puntos")); |
|
87 |
jLabel1.setPreferredSize(new java.awt.Dimension(130,15)); |
|
75 | 88 |
jLabel = new JLabel(); |
76 | 89 |
FlowLayout flowLayout6 = new FlowLayout(); |
77 |
pCalcErrores = new JPanel();
|
|
78 |
pCalcErrores.setLayout(flowLayout6);
|
|
79 |
pCalcErrores.setPreferredSize(new java.awt.Dimension(380,20));
|
|
90 |
pShowPoints = new JPanel();
|
|
91 |
pShowPoints.setLayout(flowLayout6);
|
|
92 |
pShowPoints.setPreferredSize(new java.awt.Dimension(380,20));
|
|
80 | 93 |
flowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
81 | 94 |
flowLayout6.setHgap(10); |
82 | 95 |
flowLayout6.setVgap(0); |
83 |
jLabel.setText(PluginServices.getText(this,"calcular_errores"));
|
|
84 |
jLabel.setPreferredSize(new java.awt.Dimension(250,15));
|
|
96 |
jLabel.setText(PluginServices.getText(this,"activo"));
|
|
97 |
jLabel.setPreferredSize(new java.awt.Dimension(150,15));
|
|
85 | 98 |
jLabel.setToolTipText(""); |
86 |
pCalcErrores.add(getJCheckBox(), null); |
|
87 |
pCalcErrores.add(jLabel, null); |
|
99 |
pShowPoints.add(getCbActivePoint(), null); |
|
100 |
pShowPoints.add(jLabel, null); |
|
101 |
pShowPoints.add(getCbShowPoints(), null); |
|
102 |
pShowPoints.add(jLabel1, null); |
|
88 | 103 |
} |
89 |
return pCalcErrores;
|
|
104 |
return pShowPoints;
|
|
90 | 105 |
} |
91 | 106 |
/** |
92 | 107 |
* This method initializes jCheckBox |
93 | 108 |
* |
94 | 109 |
* @return javax.swing.JCheckBox |
95 | 110 |
*/ |
96 |
private JCheckBox getJCheckBox() { |
|
97 |
if (jCheckBox == null) { |
|
98 |
jCheckBox = new JCheckBox(); |
|
99 |
jCheckBox.setVerticalAlignment(javax.swing.SwingConstants.CENTER); |
|
100 |
jCheckBox.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); |
|
111 |
public JCheckBox getCbActivePoint() { |
|
112 |
if (CbActivePoint == null) { |
|
113 |
CbActivePoint = new JCheckBox(); |
|
114 |
CbActivePoint.setVerticalAlignment(javax.swing.SwingConstants.CENTER); |
|
115 |
CbActivePoint.setSelected(true); |
|
116 |
CbActivePoint.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); |
|
117 |
CbActivePoint.addActionListener(this); |
|
101 | 118 |
} |
102 |
return jCheckBox;
|
|
119 |
return CbActivePoint;
|
|
103 | 120 |
} |
121 |
|
|
122 |
/** |
|
123 |
* This method initializes jCheckBox1 |
|
124 |
* |
|
125 |
* @return javax.swing.JCheckBox |
|
126 |
*/ |
|
127 |
public JCheckBox getCbShowPoints() { |
|
128 |
if (CbShowPoints == null) { |
|
129 |
CbShowPoints = new JCheckBox(); |
|
130 |
CbShowPoints.setSelected(true); |
|
131 |
CbShowPoints.addActionListener(this); |
|
132 |
} |
|
133 |
return CbShowPoints; |
|
134 |
} |
|
135 |
|
|
136 |
/* (non-Javadoc) |
|
137 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
138 |
*/ |
|
139 |
public void actionPerformed(ActionEvent e) { |
|
140 |
|
|
141 |
FLyrPoints lyrPoints = grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints(); |
|
142 |
View theView = null; |
|
143 |
try{ |
|
144 |
theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
145 |
}catch(ClassCastException exc){ |
|
146 |
return; |
|
147 |
} |
|
148 |
|
|
149 |
if(e.getSource() == getCbShowPoints()){ |
|
150 |
|
|
151 |
if(getCbShowPoints().isSelected()){ //Mostramos el n?mero de punto |
|
152 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(true); |
|
153 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
154 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
|
155 |
theView.getMapControl().getMapContext().invalidate(); |
|
156 |
}else{ //Ocultamos el n?mero de punto |
|
157 |
grd.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel().getLyrPoints().setShowNumber(false); |
|
158 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomLeft().draw(); |
|
159 |
grd.getConectorPanel().getAdjustGeorefPanel().getZoomRight().draw(); |
|
160 |
theView.getMapControl().getMapContext().invalidate(); |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
if(e.getSource() == getCbActivePoint()){ |
|
165 |
if(lyrPoints != null){ |
|
166 |
if(getCbActivePoint().isSelected()) |
|
167 |
lyrPoints.setPointActive(grd.getSelectedPoint(), true); |
|
168 |
else |
|
169 |
lyrPoints.setPointActive(grd.getSelectedPoint(), false); |
|
170 |
|
|
171 |
theView.getMapControl().getMapContext().invalidate(); |
|
172 |
grd.getZoomControlLeft().draw(); |
|
173 |
grd.getZoomControlRight().draw(); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
177 |
|
|
178 |
/*if(e.getSource() == this.){ |
|
179 |
|
|
180 |
}*/ |
|
104 | 181 |
} |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/GeoRasterWizard.java | ||
---|---|---|
285 | 285 |
File f, IProjection proj) throws DriverException { |
286 | 286 |
RasterAdapter adapter = new RasterFileAdapter(f); |
287 | 287 |
adapter.setDriver(d); |
288 |
FLyrGeoRaster capa = new FLyrGeoRaster();
|
|
289 |
if (capa != null) {
|
|
290 |
capa.setName(layerName);
|
|
291 |
capa.setSource(adapter);
|
|
292 |
capa.setProjection(proj);
|
|
293 |
capa.setImageDimension(widthPxImg, heightPxImg);
|
|
288 |
FLyrGeoRaster lyrGeoRaster = new FLyrGeoRaster();
|
|
289 |
if (lyrGeoRaster != null) {
|
|
290 |
lyrGeoRaster.setName(layerName);
|
|
291 |
lyrGeoRaster.setSource(adapter);
|
|
292 |
lyrGeoRaster.setProjection(proj);
|
|
293 |
lyrGeoRaster.setImageDimension(widthPxImg, heightPxImg);
|
|
294 | 294 |
try { |
295 |
capa.load();
|
|
295 |
lyrGeoRaster.load();
|
|
296 | 296 |
} catch (DriverIOException e) { |
297 | 297 |
throw new DriverException(e); |
298 | 298 |
} |
299 | 299 |
|
300 |
capa.setVisible(true);
|
|
300 |
lyrGeoRaster.setVisible(true);
|
|
301 | 301 |
}else |
302 | 302 |
return null; |
303 |
return capa;
|
|
303 |
return lyrGeoRaster;
|
|
304 | 304 |
} |
305 | 305 |
|
306 | 306 |
/** |
... | ... | |
378 | 378 |
//Creamos la capa y la cargamos |
379 | 379 |
IProjection proj = this.getPProyection().getCurProj(); |
380 | 380 |
try{ |
381 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
382 |
|
|
381 |
View theView = null; |
|
382 |
try{ |
|
383 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
384 |
}catch(ClassCastException exc){ |
|
385 |
return; |
|
386 |
} |
|
387 |
|
|
383 | 388 |
com.hardcode.driverManager.Driver driver = LayerFactory.getDM().getDriver("gvSIG Image Driver"); |
384 | 389 |
|
385 | 390 |
File fich = new File(fName); |
... | ... | |
399 | 404 |
|
400 | 405 |
|
401 | 406 |
if(lyrGeoRaster != null){ |
402 |
lyrGeoRaster.getStackZoom().setInitExtent(ext); |
|
403 | 407 |
lyrGeoRaster.setActive(true); |
404 | 408 |
} |
405 | 409 |
|
... | ... | |
428 | 432 |
*/ |
429 | 433 |
public void execute() { |
430 | 434 |
if(!this.getCbUseGeoref().isSelected()) |
431 |
lyrGeoRaster.setAssignExtent(ext); |
|
435 |
lyrGeoRaster.setAssignExtent(ext); |
|
436 |
|
|
437 |
lyrGeoRaster.getStackZoom().setInitExtent(lyrGeoRaster.getAssignExtent()); |
|
432 | 438 |
GeoreferencingDialog geoDialog = null; |
433 | 439 |
|
434 | 440 |
JInternalFrame panel = new JInternalFrame(); |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/SelectPointsPanel.java | ||
---|---|---|
271 | 271 |
* @param changeSelection Cambia la posici?n seleccionada del combo si es true |
272 | 272 |
* @param pos Posici?n a la que cambia el combo si el parametro chageSelection es true |
273 | 273 |
*/ |
274 |
private void changePoint(boolean changeSelection, int pos){
|
|
274 |
public void changePoint(boolean changeSelection, int pos){
|
|
275 | 275 |
disableEvent = true; |
276 | 276 |
try{ |
277 | 277 |
loadLyrPoint(); |
... | ... | |
298 | 298 |
public void clearList(){ |
299 | 299 |
try{ |
300 | 300 |
loadLyrPoint(); |
301 |
lyrPoints.clearVisualList(this, |
|
302 |
grd.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel(), |
|
303 |
grd.getConectorPanel().getAdjustGeorefPanel()); |
|
301 |
if(lyrPoints != null) |
|
302 |
lyrPoints.clearVisualList(this, |
|
303 |
grd.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel(), |
|
304 |
grd.getConectorPanel().getAdjustGeorefPanel()); |
|
304 | 305 |
}catch(InstantiationException e){ |
305 | 306 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
306 | 307 |
PluginServices.getText(this, "error_capa_puntos")); |
... | ... | |
321 | 322 |
if( lyr instanceof FLyrGeoRaster && |
322 | 323 |
lyr.getName().startsWith("*") && |
323 | 324 |
lyr.isActive()){ |
324 |
lyrPoints = ((FLyrGeoRaster)lyr).getFLyrPoints(); |
|
325 |
try{ |
|
326 |
lyrPoints = ((FLyrGeoRaster)lyr).getFLyrPoints(); |
|
327 |
}catch(ClassCastException exc){ |
|
328 |
throw new InstantiationException("No se ha podido obtener una capa de puntos"); |
|
329 |
} |
|
325 | 330 |
|
326 | 331 |
} |
327 | 332 |
} |
328 | 333 |
} |
329 | 334 |
|
330 |
if(lyrPoints == null) |
|
331 |
throw new InstantiationException("No se ha podido obtener una capa de puntos"); |
|
332 |
|
|
333 | 335 |
} |
334 | 336 |
|
335 | 337 |
|
... | ... | |
591 | 593 |
}else{ |
592 | 594 |
grd.setEnlarge(true); |
593 | 595 |
bExtended.setIcon(new ImageIcon(getClass().getResource("/com/iver/cit/gvsig/gui/Panels/images/up.png"))); |
594 |
lyrPoints.loadVisualPoint(tableControlerPanel.getSelectedIndex(), this.grd); |
|
596 |
if(lyrPoints != null) |
|
597 |
lyrPoints.loadVisualPoint(tableControlerPanel.getSelectedIndex(), this.grd); |
|
595 | 598 |
} |
596 | 599 |
} |
597 | 600 |
|
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/DataPointsTabPanel.java | ||
---|---|---|
128 | 128 |
Point2D map = new Point2D.Double(); |
129 | 129 |
map.setLocation(lon, lat); |
130 | 130 |
|
131 |
FLyrGeoRaster lyrGeoRaster = null; |
|
132 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
131 |
FLyrGeoRaster lyrGeoRaster = null; |
|
132 |
View theView = null; |
|
133 |
try{ |
|
134 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
135 |
}catch(ClassCastException exce){ |
|
136 |
return; |
|
137 |
} |
|
133 | 138 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
134 | 139 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
135 | 140 |
if( lyr instanceof FLyrGeoRaster && |
... | ... | |
148 | 153 |
}catch(ArrayIndexOutOfBoundsException ex){ |
149 | 154 |
//Si da una excepci?n de este tipo es que no hay cargado nin?n punto |
150 | 155 |
//por lo que no hacemos nada. |
156 |
}catch(ClassCastException ex){ |
|
157 |
//Si da una excepci?n de este tipo lo m?s probable es que no haya una |
|
158 |
//vista activa y no se pueda crear una capa de puntos. Tampoco se hace nada. |
|
151 | 159 |
} |
152 | 160 |
}else{ |
153 | 161 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/SelectFilePanel.java | ||
---|---|---|
314 | 314 |
//Creamos la capa y la cargamos |
315 | 315 |
IProjection proj = this.getPProyection().getCurProj(); |
316 | 316 |
try{ |
317 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
318 |
|
|
317 |
View theView = null; |
|
318 |
try{ |
|
319 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
320 |
}catch(ClassCastException exc){ |
|
321 |
return; |
|
322 |
} |
|
323 |
|
|
319 | 324 |
com.hardcode.driverManager.Driver driver = LayerFactory.getDM().getDriver("gvSIG Image Driver"); |
320 | 325 |
|
321 | 326 |
//Si la ventana que hemos abierto es Singleton necesitamos esto para recuperar la vista. |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/AdjustGeorefPanel.java | ||
---|---|---|
102 | 102 |
* |
103 | 103 |
* @return javax.swing.JPanel |
104 | 104 |
*/ |
105 |
private JPanel getPOptions() {
|
|
105 |
public JPanel getPOptions() {
|
|
106 | 106 |
if (pOptions == null) { |
107 | 107 |
pOptions = new JPanel(); |
108 | 108 |
BorderLayout bl = new BorderLayout(); |
109 | 109 |
pOptions.setLayout(bl); |
110 | 110 |
pOptions.setPreferredSize(new java.awt.Dimension(380,20)); |
111 | 111 |
if(optionsPanel == null) |
112 |
optionsPanel = new OptionsPanel(); |
|
112 |
optionsPanel = new OptionsPanel(this.grd);
|
|
113 | 113 |
optionsPanel.setPreferredSize(new java.awt.Dimension(380,20)); |
114 | 114 |
pOptions.add(optionsPanel, BorderLayout.CENTER); |
115 | 115 |
} |
... | ... | |
132 | 132 |
this.getZoomLeft().draw(); |
133 | 133 |
this.getZoomRight().draw(); |
134 | 134 |
} |
135 |
|
|
136 |
/** |
|
137 |
* @return Returns the optionsPanel. |
|
138 |
*/ |
|
139 |
public OptionsPanel getOptionsPanel() { |
|
140 |
return optionsPanel; |
|
141 |
} |
|
135 | 142 |
|
136 | 143 |
|
137 | 144 |
} |
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/TablePointsPanel.java | ||
---|---|---|
172 | 172 |
//Buscamos una capa FlyrPoint en la vista y si no la hay la creamos |
173 | 173 |
|
174 | 174 |
if(lyrPoints == null){ |
175 |
View theView = (View) PluginServices.getMDIManager().getActiveView(); |
|
175 |
View theView = null; |
|
176 |
try{ |
|
177 |
theView = (View)PluginServices.getMDIManager().getActiveView(); |
|
178 |
}catch(ClassCastException exc){ |
|
179 |
return; |
|
180 |
} |
|
176 | 181 |
for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){ |
177 | 182 |
FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i); |
178 | 183 |
if( lyr instanceof FLyrGeoRaster && |
179 | 184 |
lyr.getName().startsWith("*") && |
Also available in: Unified diff