This document is archived and information here might be outdated.  Recommended version.


IEditLayers Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditLayers Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Editor)  

IEditLayers Interface

Provides access to members that control information about layers in the edit session.

Product Availability

Available with ArcGIS Desktop.

When To Use

The IEditLayers interface exposes members for setting and getting the editor's current layer and current subtype. The current layer (or target layer) determines which layer will contain newly created features. For instance, if you set the target layer to 'Buildings', any new features created will be part of the Buildings layer. Edit tasks and commands that create new features use this property to determine which layer to write out the new features to. For example, the 'Create New Features' task and the 'Union' command both create new features in the target layer.

Members

Name Description
Read-only property CurrentLayer Indicates the editor's target layer which new features are added to.
Read-only property CurrentSubtype The sub type for new features in the CurrentLayer.
Method IsEditable Determines if a specific feature layer is editable.
Method 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 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.

[C#]

 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 | 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

.NET Snippets

Flip Line Direction

.NET Samples

ViperPin tool (Code Files: ViperPinForm)

.NET Related Topics

Working with the editor snap environment