0005-Get-the-view-from-the-context-instead-as-the-active-.patch
| extensions/extWFS2/src/com/iver/cit/gvsig/fmap/layers/FLyrWFSFactory.java | ||
|---|---|---|
| 112 | 112 |
adapter.setDriver((VectorialDriver) driver); |
| 113 | 113 |
wfsLayer.setSource(adapter); |
| 114 | 114 |
wfsLayer.setOnlineResource(onlineResource); |
| 115 |
BaseView activeView = |
|
| 116 |
(BaseView) PluginServices.getMDIManager().getActiveWindow(); |
|
| 117 | 115 |
//The SRS original |
| 118 | 116 |
IProjection projection = CRSFactory.getCRS(getSRS(wfsLayer.getSrs())); |
| 119 | 117 |
wfsLayer.setProjection(projection); |
| extensions/extWFS2/src/com/iver/cit/gvsig/gui/dialogs/WFSPropertiesDialogListener.java | ||
|---|---|---|
| 139 | 139 |
dialog.updateReference(newLayer); |
| 140 | 140 |
|
| 141 | 141 |
// Replace the old layer entry at the TOC with the new one |
| 142 |
BaseView activeView = (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
|
| 143 |
MapControl mapCtrl = activeView.getMapControl(); |
|
| 142 |
MapControl mapCtrl = dialog.getWizardData().getMapCtrl(); |
|
| 144 | 143 |
mapCtrl.getMapContext().getLayers().replaceLayer(oldLayerName, newLayer); |
| 145 | 144 |
//mapCtrl.getMapContext().zoomToExtent(newLayer.getFullExtent()); |
| 146 | 145 | |
| extensions/extWFS2/src/com/iver/cit/gvsig/gui/panels/WFSAreaPanel.java | ||
|---|---|---|
| 281 | 281 |
* Write the view coordinates into the coordinates panel |
| 282 | 282 |
*/ |
| 283 | 283 |
private void initCoordinates(){
|
| 284 |
BaseView activeView = (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
|
| 285 | 284 |
// We will use the adjusted extent because increases the usability |
| 286 |
Rectangle2D r2d = activeView.getMapControl().getViewPort().getAdjustedExtent(); |
|
| 287 |
// Rectangle2D r2d = activeView.getMapControl().getViewPort().getExtent(); |
|
| 285 |
Rectangle2D r2d = data.getMapCtrl().getViewPort().getAdjustedExtent(); |
|
| 288 | 286 |
|
| 289 | 287 |
if (r2d != null){
|
| 290 | 288 |
previousExtentValids.put(r2d); |
| ... | ... | |
| 456 | 454 |
|
| 457 | 455 |
getCoordinatesPanel().setAllTextFieldsEnabled(true); |
| 458 | 456 |
|
| 459 |
// If the current active view has layers -> set the area in the fields: |
|
| 460 |
// Adds the extent of the viewport of the current active view |
|
| 461 |
BaseView view = (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
|
| 462 |
ViewPort vP = view.getMapControl().getMapContext().getViewPort(); |
|
| 463 |
|
|
| 464 |
// Update extent (we will use the adjusted extent because increases the usability) |
|
| 465 |
Rectangle2D r2D = vP.getAdjustedExtent(); |
|
| 466 |
// Rectangle2D r2D = vP.getExtent(); |
|
| 457 |
Rectangle2D r2D = data.getMapCtrl().getViewPort().getAdjustedExtent(); |
|
| 467 | 458 |
|
| 468 | 459 |
if (r2D != null) {
|
| 469 | 460 |
// getJToggleButtonMove().setEnabled(false); |
| ... | ... | |
| 732 | 723 |
*/ |
| 733 | 724 |
public void mouseClicked(MouseEvent e) {
|
| 734 | 725 |
getSelectableMapAreaPanel().getViewPort().setExtent(getSelectableMapAreaPanel().getMapContext().getLayers().getFullExtent()); |
| 735 |
BaseView view =((BaseView)PluginServices.getMDIManager().getActiveWindow()); |
|
| 736 |
view.repaintMap(); |
|
| 726 |
data.getMapCtrl().drawMap(false); |
|
| 737 | 727 |
} |
| 738 | 728 |
}); |
| 739 | 729 |
} |
| ... | ... | |
| 929 | 919 |
mapContext.getLayers().removeLayer(i); |
| 930 | 920 |
} |
| 931 | 921 |
PluginServices.getMainFrame().enableControls(); |
| 932 |
// Adds the extent of the viewport of the current active view |
|
| 933 |
BaseView view = (BaseView) PluginServices.getMDIManager().getActiveWindow(); |
|
| 934 |
ViewPort vP = view.getMapControl().getMapContext().getViewPort(); |
|
| 935 | 922 |
|
| 936 |
// Update extent (we will use the adjusted extent because increases the usability) |
|
| 937 |
Rectangle2D r2D = vP.getAdjustedExtent(); |
|
| 938 |
// Rectangle2D r2D = vP.getExtent(); |
|
| 923 |
Rectangle2D r2D = data.getMapCtrl().getViewPort() |
|
| 924 |
.getAdjustedExtent(); |
|
| 939 | 925 |
|
| 940 | 926 |
if (r2D == null) {
|
| 941 | 927 |
// End To prevent that events that take place(are produced) could be a nuisance to the load of the layers |
| ... | ... | |
| 951 | 937 |
mapContext.getViewPort().setExtent(r2D); |
| 952 | 938 |
|
| 953 | 939 |
// Adds the active layers of the current active view |
| 954 |
MapContext mC = view.getMapControl().getMapContext();
|
|
| 940 |
MapContext mC = data.getMapCtrl().getMapContext();
|
|
| 955 | 941 |
|
| 956 | 942 |
numberOfLayers = mC.getLayers().getLayersCount(); |
| 957 | 943 |
|
| ... | ... | |
| 2597 | 2583 |
|
| 2598 | 2584 |
/* Sets a clone of the current active view map context to this MapControl */ |
| 2599 | 2585 |
try {
|
| 2600 |
MapContext mp = ((BaseView) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext();
|
|
| 2586 |
MapContext mp = data.getMapCtrl().getMapContext();
|
|
| 2601 | 2587 |
|
| 2602 | 2588 |
this.setMapContext(mp.cloneFMap()); |
| 2603 | 2589 |
ViewPort vP = this.getViewPort(); |
| ... | ... | |
| 2626 | 2612 |
*/ |
| 2627 | 2613 |
public void refreshWithTheActiveView() {
|
| 2628 | 2614 |
try {
|
| 2629 |
MapContext mp = ((BaseView) PluginServices.getMDIManager().getActiveWindow()).getMapControl().getMapContext();
|
|
| 2615 |
MapContext mp = data.getMapCtrl().getMapContext();
|
|
| 2630 | 2616 |
this.setMapContext(mp.cloneFMap()); |
| 2631 | 2617 |
ViewPort vP = this.getViewPort(); |
| 2632 | 2618 |
|
| extensions/extWFS2/src/com/iver/cit/gvsig/gui/wizards/WFSWizard.java | ||
|---|---|---|
| 672 | 672 |
*/ |
| 673 | 673 |
public void setDataSource(WFSWizardData source) {
|
| 674 | 674 |
dataSource = source; |
| 675 |
dataSource.setMapCtrl(getMapCtrl()); |
|
| 675 | 676 |
} |
| 676 | 677 |
|
| 677 | 678 |
/** |
| extensions/extWFS2/src/com/iver/cit/gvsig/gui/wizards/WFSWizardData.java | ||
|---|---|---|
| 10 | 10 |
import com.iver.andami.messages.NotificationManager; |
| 11 | 11 |
import com.iver.cit.gvsig.exceptions.layers.ConnectionErrorLayerException; |
| 12 | 12 |
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException; |
| 13 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
| 13 | 14 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriver; |
| 14 | 15 |
import com.iver.cit.gvsig.fmap.drivers.wfs.FMapWFSDriverFactory; |
| 15 | 16 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
| ... | ... | |
| 113 | 114 |
private int buffer = 0; |
| 114 | 115 |
private int timeOut = 0; |
| 115 | 116 |
private String UserName = null; |
| 117 |
private MapControl mapCtrl; |
|
| 118 |
|
|
| 119 |
public MapControl getMapCtrl() {
|
|
| 120 |
return mapCtrl; |
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
/** |
|
| 124 |
* @param mapCtrl |
|
| 125 |
* The mapCtrl to set. |
|
| 126 |
*/ |
|
| 127 |
public void setMapCtrl(MapControl mapCtrl) {
|
|
| 128 |
this.mapCtrl = mapCtrl; |
|
| 129 |
} |
|
| 116 | 130 |
|
| 117 | 131 |
/** |
| 118 | 132 |
* Gets the online resource of the WFS driver. |
| 119 |
- |
|