Revision 31496 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/ViewControls.java
ViewControls.java | ||
---|---|---|
53 | 53 |
import org.gvsig.app.gui.preferencespage.GridPage; |
54 | 54 |
import org.gvsig.app.gui.preferencespage.ViewPage; |
55 | 55 |
import org.gvsig.app.project.Project; |
56 |
import org.gvsig.app.project.documents.ProjectDocument;
|
|
56 |
import org.gvsig.app.project.documents.AbstractDocument;
|
|
57 | 57 |
import org.gvsig.app.project.documents.view.Encuadrator; |
58 |
import org.gvsig.app.project.documents.view.IProjectView;
|
|
58 |
import org.gvsig.app.project.documents.view.ViewDocument;
|
|
59 | 59 |
import org.gvsig.app.project.documents.view.gui.ExtentListSelectorModel; |
60 | 60 |
import org.gvsig.app.project.documents.view.gui.FPanelExtentSelector; |
61 | 61 |
import org.gvsig.app.project.documents.view.gui.FPanelLocConfig; |
62 |
import org.gvsig.app.project.documents.view.gui.View;
|
|
62 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
|
|
63 | 63 |
import org.gvsig.app.project.documents.view.toc.gui.FPopupMenu; |
64 | 64 |
import org.gvsig.app.project.documents.view.toolListeners.snapping.Snapping; |
65 | 65 |
import org.gvsig.fmap.mapcontext.MapContext; |
... | ... | |
85 | 85 |
.getLogger(ViewInvertSelection.class); |
86 | 86 |
|
87 | 87 |
private static ViewPage viewPropertiesPage = new ViewPage(); |
88 |
private View vista;
|
|
88 |
private DefaultViewPanel vista;
|
|
89 | 89 |
/** |
90 | 90 |
* @see com.iver.mdiApp.plugins.IExtension#updateUI(java.lang.String) |
91 | 91 |
*/ |
92 | 92 |
public void execute(String s) { |
93 |
IProjectView model = vista.getModel();
|
|
93 |
ViewDocument model = vista.getModel();
|
|
94 | 94 |
MapContext mapa = model.getMapContext(); |
95 | 95 |
MapControl mapCtrl = vista.getMapControl(); |
96 | 96 |
logger.debug("Comand : " + s); |
... | ... | |
98 | 98 |
if (s.equals("FULL") ) { |
99 | 99 |
// mapa.beginAtomicEvent(); |
100 | 100 |
mapa.getViewPort().setEnvelope(mapa.getLayers().getFullEnvelope()); |
101 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
101 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
102 | 102 |
// mapa.endAtomicEvent(); |
103 | 103 |
} else if (s.equals("ENCUADRE") ) { |
104 | 104 |
FPanelExtentSelector l = new FPanelExtentSelector(); |
... | ... | |
110 | 110 |
project.addPropertyChangeListener(modelo); |
111 | 111 |
l.setModel(modelo); |
112 | 112 |
l.addSelectionListener(new Encuadrator(project, mapa, vista)); |
113 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
113 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
114 | 114 |
PluginServices.getMDIManager().addWindow(l); |
115 | 115 |
} else if (s.equals("CONFIG_LOCATOR") ) { |
116 | 116 |
//Set up the map overview |
117 | 117 |
FPanelLocConfig m_panelLoc = new FPanelLocConfig(vista.getMapOverview()); |
118 | 118 |
PluginServices.getMDIManager().addWindow(m_panelLoc); |
119 | 119 |
m_panelLoc.setPreferredSize(m_panelLoc.getSize()); |
120 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
120 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
121 | 121 |
} else if (s.equals("PAN") ) { |
122 | 122 |
mapCtrl.setTool("pan"); |
123 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
123 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
124 | 124 |
} else if (s.equals("ZOOM_IN") ) { |
125 | 125 |
mapCtrl.setTool("zoomIn"); |
126 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
126 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
127 | 127 |
} else if (s.equals("ZOOM_OUT") ) { |
128 | 128 |
mapCtrl.setTool("zoomOut"); |
129 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
129 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
130 | 130 |
} else if (s.equals("CAPAS_VISIBLES") ) { |
131 | 131 |
setVisibles(true, mapa.getLayers()); |
132 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
132 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
133 | 133 |
} else if (s.equals("CAPAS_NOVISIBLES") ) { |
134 | 134 |
setVisibles(false, mapa.getLayers()); |
135 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
135 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
136 | 136 |
} else if (s.equals("CAPAS_ACTIVAS") ) { |
137 | 137 |
setActives(true, mapa.getLayers()); |
138 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
138 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
139 | 139 |
} else if (s.equals("CAPAS_NOACTIVAS") ) { |
140 | 140 |
setActives(false, mapa.getLayers()); |
141 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
141 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
142 | 142 |
} else if (s.equals("SAVERASTER") ) { |
143 | 143 |
mapCtrl.setTool("saveRaster"); |
144 | 144 |
} else if (s.equals("SELECTIMAGE") ) { |
145 | 145 |
mapCtrl.setTool("selectImage"); |
146 | 146 |
} else if (s.equals("ACTION_ZOOM_IN") ) { |
147 | 147 |
mapCtrl.zoomIn(); |
148 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
148 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
149 | 149 |
} else if (s.equals("ACTION_ZOOM_OUT") ) { |
150 | 150 |
mapCtrl.zoomOut(); |
151 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
151 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
152 | 152 |
} else if (s.startsWith("CHANGE_SCALE_")){ |
153 | 153 |
String scl=s.replaceAll("CHANGE_SCALE_",""); |
154 | 154 |
long scale=Long.parseLong(scl); |
155 | 155 |
mapa.setScaleView(scale); |
156 |
((ProjectDocument)vista.getModel()).setModified(true);
|
|
156 |
((AbstractDocument)vista.getModel()).setModified(true);
|
|
157 | 157 |
} |
158 | 158 |
} |
159 | 159 |
|
... | ... | |
197 | 197 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
198 | 198 |
.getActiveWindow(); |
199 | 199 |
|
200 |
if (f!=null && f instanceof View) {
|
|
201 |
vista = (View) f;
|
|
202 |
IProjectView model = vista.getModel();
|
|
200 |
if (f!=null && f instanceof DefaultViewPanel) {
|
|
201 |
vista = (DefaultViewPanel) f;
|
|
202 |
ViewDocument model = vista.getModel();
|
|
203 | 203 |
MapContext mapa = model.getMapContext(); |
204 | 204 |
|
205 | 205 |
return mapa.getLayers().getLayersCount() > 0; |
... | ... | |
273 | 273 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled() |
274 | 274 |
*/ |
275 | 275 |
public boolean isEnabled() { |
276 |
IProjectView model = vista.getModel();
|
|
276 |
ViewDocument model = vista.getModel();
|
|
277 | 277 |
MapContext mapa = model.getMapContext(); |
278 | 278 |
|
279 | 279 |
FLayers layers = mapa.getLayers(); |
Also available in: Unified diff