This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditLayers Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that control information about layers in the edit session.
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 and Classes | Description |
---|---|
Editor | The Object Editor Extension. |
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 editor�s 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");
}
}
IDatasetEdit Interface | IDatasetEditInfo Interface | IEditSketch Interface | IEditTask.Activate Method | IEditor Interface | IEditTask.Deactivate Method | ISnapEnvironment Interface | IEditEvents2 Interface | IEditLayers Interface | IEditEvents Interface | IEditTask.Name Property | Editor Class | Editor Library | IEditTask.OnFinishSketch Method | IEditAttributeProperties Interface | IEditTask.OnDeleteSketch Method | IEditProperties Interface | IFeatureLayer Interface