Revision 26435 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/ViewSelectionControls.java
ViewSelectionControls.java | ||
---|---|---|
96 | 96 |
package com.iver.cit.gvsig; |
97 | 97 |
|
98 | 98 |
import org.apache.log4j.Logger; |
99 |
import org.gvsig.fmap.dal.DataStore; |
|
100 |
import org.gvsig.fmap.dal.exception.DataException; |
|
101 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
102 | 99 |
import org.gvsig.fmap.mapcontext.MapContext; |
103 | 100 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
104 | 101 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
105 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer; |
|
106 | 102 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
107 | 103 |
import org.gvsig.fmap.mapcontrol.MapControl; |
108 | 104 |
|
109 | 105 |
import com.iver.andami.PluginServices; |
110 |
import com.iver.andami.messages.NotificationManager; |
|
111 | 106 |
import com.iver.andami.plugins.Extension; |
112 | 107 |
import com.iver.andami.ui.mdiManager.IWindow; |
113 |
import com.iver.cit.gvsig.gui.selectionByTheme.DefaultSelectionByThemeModel; |
|
114 |
import com.iver.cit.gvsig.gui.selectionByTheme.MySelectionByThemeListener; |
|
115 |
import com.iver.cit.gvsig.gui.selectionByTheme.SelectionByTheme; |
|
116 | 108 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
117 | 109 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
118 | 110 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
... | ... | |
157 | 149 |
} |
158 | 150 |
|
159 | 151 |
public void execute(String actionCommand) { |
160 |
IProjectView model = vista.getModel(); |
|
161 |
MapContext mapa = model.getMapContext(); |
|
162 | 152 |
MapControl mapCtrl = vista.getMapControl(); |
163 | 153 |
logger.debug("Comand : " + actionCommand); |
164 | 154 |
if (actionCommand.equals("SELRECT")) { |
... | ... | |
170 | 160 |
} else if (actionCommand.equals("SELPOL")) { |
171 | 161 |
mapCtrl.setTool("polSelection"); |
172 | 162 |
((ProjectDocument)vista.getModel()).setModified(true); |
173 |
} else if (actionCommand.equals("SELECTIONBYSHAPE")) { |
|
174 |
SelectionByTheme dlg = new SelectionByTheme(); |
|
175 |
// FLayer[] layers = mapa.getLayers().getActives(); |
|
176 |
// int count = 0; |
|
177 |
dlg.setModel(new DefaultSelectionByThemeModel()); |
|
178 |
dlg.addSelectionListener(new MySelectionByThemeListener()); |
|
179 |
PluginServices.getMDIManager().addWindow(dlg); |
|
180 |
((ProjectDocument)vista.getModel()).setModified(true); |
|
181 |
} else if (actionCommand.equals("INVERT_SELECTION")) { |
|
182 |
FLayer[] actives = mapa.getLayers().getActives(); |
|
183 |
for (int i = 0; i < actives.length; i++) { |
|
184 |
FLayer lyr = actives[i]; |
|
185 |
if (lyr.isAvailable() && lyr instanceof SingleLayer) { |
|
186 |
SingleLayer lyrSingle = (SingleLayer) lyr; |
|
187 |
DataStore ds = lyrSingle.getDataStore(); |
|
188 |
if (ds instanceof FeatureStore) { |
|
189 |
try { |
|
190 |
((FeatureStore) ds).getFeatureSelection().reverse(); |
|
191 |
((ProjectDocument) vista.getModel()) |
|
192 |
.setModified(true); |
|
193 |
} catch (DataException e) { |
|
194 |
e.printStackTrace(); |
|
195 |
NotificationManager.addError(e); |
|
196 |
} |
|
197 |
} else { |
|
198 |
// TODO Not supported yet |
|
199 |
} |
|
200 |
|
|
201 |
|
|
202 |
} |
|
203 |
} |
|
204 |
((ProjectDocument)vista.getModel()).setModified(true); |
|
205 | 163 |
} |
206 | 164 |
} |
207 | 165 |
|
Also available in: Unified diff