Revision 1711 org.gvsig.raster.georeferencing/trunk/org.gvsig.raster.georeferencing/org.gvsig.raster.georeferencing.app/org.gvsig.raster.georeferencing.app.georeferencingclient/src/main/java/org/gvsig/raster/georeferencing/app/georeferencingclient/Georeferencing.java
Georeferencing.java | ||
---|---|---|
34 | 34 |
import org.gvsig.app.project.documents.Document; |
35 | 35 |
import org.gvsig.app.project.documents.view.ViewDocument; |
36 | 36 |
import org.gvsig.app.project.documents.view.gui.IView; |
37 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
38 | 37 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
39 |
import org.gvsig.fmap.mapcontext.layers.FLayers;
|
|
38 |
import org.gvsig.fmap.geom.primitive.Envelope;
|
|
40 | 39 |
import org.gvsig.fmap.mapcontrol.MapControl; |
41 | 40 |
import org.gvsig.i18n.Messages; |
42 | 41 |
import org.gvsig.raster.georeferencing.app.georeferencingclient.gui.CheckBoxColumnEditor; |
... | ... | |
67 | 66 |
import org.gvsig.raster.swing.RasterSwingManager; |
68 | 67 |
import org.gvsig.raster.swing.pagedtable.ModelLoader; |
69 | 68 |
import org.gvsig.raster.swing.pagedtable.PagedTable; |
70 |
import org.jdesktop.swingx.renderer.MappedValue; |
|
71 | 69 |
|
72 | 70 |
/** |
73 | 71 |
* Clase principal para la georreferenciaci?n. Se encarga de la inicializaci?n |
... | ... | |
124 | 122 |
private GeoreferencingOptionsDataModel |
125 | 123 |
optionsDataModel = null; |
126 | 124 |
private MapControl mapCtrl = null; |
125 |
private GeoreferencingOptionsDataModel |
|
126 |
dataModel = null; |
|
127 | 127 |
|
128 | 128 |
//private LayersPointManager layersPointManager = null; |
129 | 129 |
//private ViewsManager viewsManager = null; |
... | ... | |
196 | 196 |
return null; |
197 | 197 |
}*/ |
198 | 198 |
|
199 |
private MapControl getMapCtrl(String viewName) {
|
|
199 |
private MapControl getMapCtrl() { |
|
200 | 200 |
if(mapCtrl == null) { |
201 | 201 |
IWindow[] windowList = PluginServices.getMDIManager().getAllWindows(); |
202 | 202 |
for (int i = 0; i < windowList.length; i++) { |
203 | 203 |
if(windowList[i] instanceof IView) { |
204 | 204 |
String name = ((IView)windowList[i]).getViewDocument().getName(); |
205 |
if(name.equals(viewName)) {
|
|
205 |
if(name.equals(dataModel.getSelectedView())) {
|
|
206 | 206 |
mapCtrl = ((IView)windowList[i]).getMapControl(); |
207 | 207 |
} |
208 | 208 |
} |
... | ... | |
211 | 211 |
return mapCtrl; |
212 | 212 |
} |
213 | 213 |
|
214 |
public void endLauncherDialog(GeoreferencingOptionsDataModel dataModel) { |
|
215 |
this.dataModel = dataModel; |
|
216 |
if(dataModel.getType() == Georeferencing.WITH_MAP) |
|
217 |
initWindowsWithMap(dataModel); |
|
218 |
if(dataModel.getType() == Georeferencing.WITHOUT_MAP) |
|
219 |
initWindowsWithoutMap(dataModel); |
|
220 |
} |
|
221 |
|
|
214 | 222 |
/** |
215 | 223 |
* Colocaci?n inicial de las ventanas del espacio de trabajo. Carga la configuraci?n |
216 | 224 |
* de ventanas con cartograf?a de referencia. |
217 | 225 |
*/ |
218 |
public void initWindowsWithoutMap(GeoreferencingOptionsDataModel dataModel) {
|
|
226 |
private void initWindowsWithoutMap(GeoreferencingOptionsDataModel dataModel) {
|
|
219 | 227 |
RasterDataStore store = dataModel.getDataStore(); |
220 | 228 |
|
221 | 229 |
getOptions().setType(WITHOUT_MAP); |
... | ... | |
262 | 270 |
Rectangle2D ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomRaster.getCanvasWidth(), zoomRaster.getCanvasHeight()); |
263 | 271 |
zoomRasterRequestManager.initRequest(dataModel.getDataStore().getExtent().toRectangle2D()); |
264 | 272 |
zoomRasterRequestManager.request(ext); |
265 |
|
|
266 |
// layersPointManager.createGCPPIxelLayer(viewRaster, viewRasterRequestManager, zoomRasterRequestManager); |
|
267 |
// |
|
273 |
|
|
268 | 274 |
} catch (InvalidRequestException e1) { |
269 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", this, e1);
|
|
275 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", null, e1);
|
|
270 | 276 |
fManager.closeAllWindows(); |
271 | 277 |
}catch (Exception e1) { |
272 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", this, e1);
|
|
278 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", null, e1);
|
|
273 | 279 |
fManager.closeAllWindows(); |
274 | 280 |
} |
275 | 281 |
} |
... | ... | |
305 | 311 |
* Colocaci?n inicial de las ventanas del espacio de trabajo. Carga la configuraci?n |
306 | 312 |
* de ventanas con cartograf?a de referencia. |
307 | 313 |
*/ |
308 |
public void initWindowsWithMap(GeoreferencingOptionsDataModel dataModel) {
|
|
314 |
private void initWindowsWithMap(GeoreferencingOptionsDataModel dataModel) {
|
|
309 | 315 |
RasterDataStore store = dataModel.getDataStore(); |
310 | 316 |
|
311 | 317 |
getOptions().setType(WITH_MAP); |
... | ... | |
350 | 356 |
layoutEnv.setControlBar(georefControlPanel.getComponent()); |
351 | 357 |
|
352 | 358 |
fManager.createLayout(layoutEnv); |
353 |
SynchronizedViews syncViews = sManager.createSyncViews(null, viewRaster, null, zoomRaster, table, this);
|
|
359 |
SynchronizedViews syncViews = sManager.createSyncViews(viewMap, viewRaster, zoomMap, zoomRaster, table, this);
|
|
354 | 360 |
|
355 |
|
|
356 | 361 |
getOptions().setType(WITH_MAP); |
357 | 362 |
// |
358 |
// //Si hay ventanas de georreferenciaci?n abiertas las cerramos |
|
359 |
// closeAllWindows(); |
|
360 |
// |
|
361 |
// MapControl mapControl = null; |
|
362 |
// IWindow[] windowList = PluginServices.getMDIManager().getAllWindows(); |
|
363 |
// for (int i = 0; i < windowList.length; i++) { |
|
364 |
// if(windowList[i] instanceof IView && windowList[i].getWindowInfo().getTitle().endsWith(": " + selectedView)) |
|
365 |
// mapControl = ((IView)windowList[i]).getMapControl(); |
|
366 |
// } |
|
367 |
// |
|
368 |
// if(mapControl == null) { |
|
369 |
// RasterToolsUtil.messageBoxError("error_lookingfor_view", this); |
|
370 |
// return; |
|
371 |
// } |
|
372 |
// |
|
373 |
// //Inicializamos el control de tabla |
|
374 |
// table = new GCPTablePanelImpl(smallWindowsWidth, posYViews, tableWidth, smallWindowsHeight, this); |
|
375 |
// buttonsListener = new TableControlListener(table, this); |
|
376 |
// table.initialize(buttonsListener); |
|
377 |
// |
|
378 |
// //Inicializaci?n de la ventana con la vista mapa |
|
379 |
// viewMap = new ViewPanelImpl(0, 0, wViews, hViews, this); |
|
380 |
// viewMap.setViewListener(this); |
|
381 |
// viewMap.setShowInfo(true); |
|
382 |
// ViewMapRequestManager viewMapRequestManager = new ViewMapRequestManager(viewMap, mapControl); |
|
383 |
// viewMap.setExtensionRequest(viewMapRequestManager); |
|
384 |
// viewMapSelectPointTool = new SelectPointTool(viewMap.getCanvas(), this); |
|
385 |
// |
|
386 |
// //Inicializaci?n de la ventana con la vista raster |
|
387 |
// viewRaster = new ViewPanelImpl(wViews, 0, wViews, hViews, this); |
|
388 |
// viewRaster.setViewListener(this); |
|
389 |
// viewRaster.setMinxMaxyUL(false); |
|
390 |
// viewRaster.setShowInfo(true); |
|
391 |
// ViewRasterRequestManager viewRasterRequestManager = new ViewRasterRequestManager(viewRaster, lyrToGeoref); |
|
392 |
// viewRaster.setExtensionRequest(viewRasterRequestManager); |
|
393 |
// viewRasterSelectPointTool = new SelectPointTool(viewRaster.getCanvas(), this); |
|
394 |
// |
|
395 |
// //Inicializaci?n de la ventana del zoom de la vista raster |
|
396 |
// zoomRaster = new ZoomPanelImpl(smallWindowsWidth + tableWidth, posYViews, smallWindowsWidth, smallWindowsHeight); |
|
397 |
// zoomRaster.setMinxMaxyUL(false); |
|
398 |
// zoomRaster.setShowInfo(true); |
|
399 |
// ViewRasterRequestManager zoomRasterRequestManager = new ViewRasterRequestManager(zoomRaster, lyrToGeoref); |
|
400 |
// zoomRaster.setExtensionRequest(zoomRasterRequestManager); |
|
401 |
// zoomRasterSelectPointTool = new SelectPointTool(zoomRaster.getCanvas(), this); |
|
402 |
// |
|
403 |
// //Inicializaci?n de la ventana del zoom de la vista de referencia |
|
404 |
// zoomMap = new ZoomPanelImpl(0, posYViews, smallWindowsWidth, smallWindowsHeight); |
|
405 |
// zoomMap.setShowInfo(true); |
|
406 |
// ViewMapRequestManager zoomMapRequestManager = new ViewMapRequestManager(zoomMap, mapControl); |
|
407 |
// zoomMap.setExtensionRequest(zoomMapRequestManager); |
|
408 |
// zoomMapSelectPointTool = new SelectPointTool(zoomMap.getCanvas(), this); |
|
409 |
// |
|
410 |
// //A?adimos las ventanas a gvSIG |
|
411 |
// PluginServices.getMDIManager().addWindow(viewRaster); |
|
412 |
// PluginServices.getMDIManager().addWindow(viewMap); |
|
413 |
// PluginServices.getMDIManager().addWindow(table); |
|
414 |
// PluginServices.getMDIManager().addWindow(zoomMap); |
|
415 |
// PluginServices.getMDIManager().addWindow(zoomRaster); |
|
416 |
// |
|
417 |
// layersPointManager.setViews(viewRaster, viewMap, zoomRaster, zoomMap); |
|
418 |
// layersPointManager.setTools(viewRasterSelectPointTool, viewMapSelectPointTool, zoomRasterSelectPointTool, zoomMapSelectPointTool); |
|
419 |
// layersPointManager.registerPointToolListener(); |
|
420 |
// |
|
421 | 363 |
// viewsManager.setViews(viewRaster, viewMap, zoomRaster, zoomMap); |
422 | 364 |
// viewsManager.setRequestsManager(viewRasterRequestManager, viewMapRequestManager, zoomRasterRequestManager, zoomMapRequestManager); |
423 | 365 |
// viewsManager.setTablePanel(table); |
424 | 366 |
// |
425 |
// try { |
|
426 |
// viewMap.setCursorSize(zoomMap.getCanvasWidth() / ZOOM_RATIO, zoomMap.getCanvasHeight() / ZOOM_RATIO); |
|
427 |
// viewRaster.setCursorSize(zoomRaster.getCanvasWidth() / ZOOM_RATIO, zoomRaster.getCanvasHeight() / ZOOM_RATIO); |
|
428 |
// viewMap.setCursorPosition(viewMap.getCanvasWidth() / 2, viewMap.getCanvasHeight() / 2); |
|
429 |
// viewRaster.setCursorPosition(viewRaster.getCanvasWidth() / 2, viewRaster.getCanvasHeight() / 2); |
|
430 |
// |
|
431 |
// if(mapControl.getMapContext().getLayers().getFullExtent() == null) |
|
432 |
// RasterToolsUtil.messageBoxError("error_setview_preview", this); |
|
433 |
// |
|
434 |
// //Inicializamos la vista de mapa |
|
435 |
// viewMapRequestManager.initRequest(mapControl.getMapContext().getLayers().getFullExtent()); |
|
436 |
// |
|
437 |
// //Inicializamos la vista de raster |
|
438 |
// viewRasterRequestManager.initRequest(lyrToGeoref.getFullExtent()); |
|
439 |
// |
|
440 |
// //Inicializamos el zoom de mapa |
|
441 |
// Rectangle2D ext = viewMap.getCursorAdjustedWorldCoordinates(zoomMap.getCanvasWidth(), zoomMap.getCanvasHeight()); |
|
442 |
// zoomMapRequestManager.initRequest(ext); |
|
443 |
// |
|
444 |
// //Inicializamos el zoom de raster |
|
445 |
// ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomRaster.getCanvasWidth(), zoomRaster.getCanvasHeight()); |
|
446 |
// zoomRasterRequestManager.initRequest(lyrToGeoref.getFullExtent()); |
|
447 |
// zoomRasterRequestManager.request(ext); |
|
448 |
// |
|
367 |
try { |
|
368 |
viewMap.setCursorSize(zoomMap.getCanvasWidth() / ZOOM_RATIO, zoomMap.getCanvasHeight() / ZOOM_RATIO); |
|
369 |
viewRaster.setCursorSize(zoomRaster.getCanvasWidth() / ZOOM_RATIO, zoomRaster.getCanvasHeight() / ZOOM_RATIO); |
|
370 |
viewMap.setCursorPosition(viewMap.getCanvasWidth() / 2, viewMap.getCanvasHeight() / 2); |
|
371 |
viewRaster.setCursorPosition(viewRaster.getCanvasWidth() / 2, viewRaster.getCanvasHeight() / 2); |
|
372 |
|
|
373 |
if(getMapCtrl().getMapContext().getLayers().getFullEnvelope() == null) |
|
374 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", null); |
|
375 |
|
|
376 |
//Inicializamos la vista de mapa |
|
377 |
Envelope e = getMapCtrl().getMapContext().getLayers().getFullEnvelope(); |
|
378 |
Rectangle2D r = new Rectangle2D.Double(e.getMinimum(0), e.getMinimum(1), e.getLength(0), e.getLength(1)); |
|
379 |
viewMapRequestManager.initRequest(r); |
|
380 |
|
|
381 |
//Inicializamos la vista de raster |
|
382 |
viewRasterRequestManager.initRequest(store.getExtent().toRectangle2D()); |
|
383 |
|
|
384 |
//Inicializamos el zoom de mapa |
|
385 |
Rectangle2D ext = viewMap.getCursorAdjustedWorldCoordinates(zoomMap.getCanvasWidth(), zoomMap.getCanvasHeight()); |
|
386 |
zoomMapRequestManager.initRequest(ext); |
|
387 |
|
|
388 |
//Inicializamos el zoom de raster |
|
389 |
ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomRaster.getCanvasWidth(), zoomRaster.getCanvasHeight()); |
|
390 |
zoomRasterRequestManager.initRequest(store.getExtent().toRectangle2D()); |
|
391 |
zoomRasterRequestManager.request(ext); |
|
392 |
|
|
449 | 393 |
// layersPointManager.createGCPPIxelLayer(viewRaster, viewRasterRequestManager, zoomRasterRequestManager); |
450 | 394 |
// layersPointManager.createGCPMapLayer(viewMap, viewMapRequestManager, zoomMapRequestManager); |
451 | 395 |
// |
452 |
// } catch (InvalidRequestException e1) {
|
|
453 |
// RasterToolsUtil.messageBoxError("error_setview_preview", this, e1);
|
|
454 |
// closeAllWindows();
|
|
455 |
// }catch (Exception e1) {
|
|
456 |
// RasterToolsUtil.messageBoxError("error_setview_preview", this, e1);
|
|
457 |
// closeAllWindows();
|
|
458 |
// }
|
|
396 |
} catch (InvalidRequestException e1) { |
|
397 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", this, e1);
|
|
398 |
fManager.closeAllWindows();
|
|
399 |
}catch (Exception e1) { |
|
400 |
GeoreferencingSwingImplLibrary.messageBoxError("error_setview_preview", this, e1);
|
|
401 |
fManager.closeAllWindows();
|
|
402 |
} |
|
459 | 403 |
} |
460 | 404 |
|
461 | 405 |
/** |
Also available in: Unified diff