Provides access to members that control information about layers in the edit session.
Product Availability
When To Use
Members
Description | ||
---|---|---|
CurrentLayer | Indicates the editor's target layer which new features are added to. | |
CurrentSubtype | The sub type for new features in the CurrentLayer. | |
IsEditable | Determines if a specific feature layer is editable. | |
SetCurrentLayer | The editor's target layer and subtype for new features. |
CoClasses that implement IEditLayers
CoClasses and Classes | Description |
---|---|
Editor | The Object Editor Extension. |
Remarks
The IEditLayers interface is used to access information about layers involved in an edit session. For example, use IEditLayers to determine if a particular layer involved in an edit session is editable or not; in addition,
use IEditLayers to check or set the editors current layer and current subtype.
The current layer (or target layer) determines which layer will receive newly created features. Edit tasks and commands that create new features use this property to determine to which layer to write out the new features.
private void SetCurrentLayer(String layerName,int subType)
{
//get editor extension
UID editorUID = new UIDClass();
editorUID.Value = "esriEditor.Editor";
IEditor editor = m_application.FindExtensionByCLSID(editorUID) as IEditor;
bool isLayerFound = false;
IEditLayers editLayers =editor as IEditLayers;
IMap map = editor.Map;
if (map != null)
{
//Loop through all of the maps layers to find the desired one
for (int count = 0; count < map.LayerCount; count++)
{
ILayer currentLayer = map.get_Layer(count);
if (currentLayer.Name == layerName)
{
isLayerFound = true;
//Make sure the layer is editable
if (editLayers.IsEditable(currentLayer as IFeatureLayer))
{
editLayers.SetCurrentLayer(currentLayer as IFeatureLayer, subType);
return;
}
else
{
System.Windows.Forms.MessageBox.Show("This layer is not editable");
}
}
}
if (isLayerFound == false)
{
System.Windows.Forms.MessageBox.Show("Layer " + layerName + " could not be found");
}
}
else
{
System.Windows.Forms.MessageBox.Show("Please start editing session");
}
}
See Also
IDatasetEdit Interface | IDatasetEditInfo Interface | Editor Class | IEditTask.OnFinishSketch Method | IEditor Interface | IEditTask.OnDeleteSketch Method | IEditTask.Activate Method | IEditTask.Deactivate Method | IEditSketch Interface | IEditAttributeProperties Interface | IEditLayers Interface | IEditEvents Interface | IEditTask.Name Property | IEditProperties Interface | IEditEvents2 Interface | ISnapEnvironment Interface | IFeatureLayer Interface