I am using the FocusMap.FeatureSelection to return all the currently selected features.
I want to process only the currently editable features and leave the remainder alone.
How can I quickly programmatically tell which features are editable?
I know of the IEditLayers.IsEditable
method, but think that might be a little heavy handed to try and map from a feature back to the featurelayer and then test that for all selected features.
Is there another way, or is this all I have available to me?
2 Answers 2
Look at the EditWorkspace from the Editor extension. Compare the pointer from that workspace to the pointer of workspace of the FeatureLayer::FeatureClass. Remember that workspaces are always accesible from the IDataset interface (supported by the featureclass). If they are the same, then that workspace is being edited.
Another option is to simply look at the workspace of the layer's featureclass and use the IWorkspaceEdit interface to figure out if the IsBeingEdited property returns true
-
2Thank you. So, what I did was QI from feature.Class to IFeatureClass to IDataset. Then IDataset.Workspace to IEditWorkspace and then tested is IsBeingEdited before processing the feature.Troy Schmidt– Troy Schmidt2011年06月02日 18:04:56 +00:00Commented Jun 2, 2011 at 18:04
IEditor.EditSelection will return all the currently selected features that belong to editable layers.
-
Yes but I have the feature as the result of a cursor or other process and needed to know if I could edit it or not. I guess I could compare the lists to see if it is found in EditSelection, but being as that isn't an easily searchable grouping I found the QI'ing above to work well.Troy Schmidt– Troy Schmidt2011年07月28日 14:02:09 +00:00Commented Jul 28, 2011 at 14:02