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


Get The Selected In-Memory Schematic Features In A ILayer Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Get The Selected In-Memory Schematic Features In A ILayer Snippet

Retrieve the in-memory schematic features currently selected in a ILayer

[C#]
        /// <summary>
        /// Retrieve the in-memory schematic features currently selected in a ILayer
        /// </summary>
        /// <param name="esriLayer">The ILayer where the in-memory schematic features are selected</param>
        /// <param name="OnlyVisible">If OnlyVisible is true, only the visible selected in-memory features are returned</param>
        /// <returns>The retrieved IEnumSchematicInMemoryFeatur</returns>
        public ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature GetSelectedInMemoryFeatureFromLayer(ESRI.ArcGIS.Carto.ILayer esriLayer, bool OnlyVisible)
        {
                // cast Layer into ISchematicLayer
                ESRI.ArcGIS.Schematic.ISchematicLayer schLayer=(ESRI.ArcGIS.Schematic.ISchematicLayer)esriLayer;
                if (schLayer == null) return null;

                // cast SchematicLayer into ISchematicLayerEditHelper
                ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper schemLayerHelper=(ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper)schLayer;
                if (schemLayerHelper == null) return null;

                return schemLayerHelper.GetSchematicInMemorySelectedFeatures(OnlyVisible);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve the in-memory schematic features currently selected in a ILayer
        ''' </summary>
        ''' <param name="esriLayer">The ILayer where the in-memory schematic features are selected</param>
        ''' <param name="OnlyVisible">If OnlyVisible is true, only the visible selected in-memory features are returned</param>
        ''' <returns>The retrieved IEnumSchematicInMemoryFeature</returns>
        ''' <remarks></remarks>
        Public Function GetSelectedInMemoryFeatureFromLayer(ByVal esriLayer As ESRI.ArcGIS.Carto.ILayer, ByVal OnlyVisible As Boolean) As ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature
        ' cast Layer into ISchematicLayer
                Dim schLayer As ESRI.ArcGIS.Schematic.ISchematicLayer=TryCast(esriLayer, ESRI.ArcGIS.Schematic.ISchematicLayer)
                If schLayer Is Nothing Then Return Nothing

                ' cast SchematicLayer into ISchematicLayerEditHelper
                Dim schemLayerHelper As ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper=TryCast(schLayer, ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper)
                If schemLayerHelper Is Nothing Then Return Nothing

                Return schemLayerHelper.GetSchematicInMemorySelectedFeatures(OnlyVisible)
        End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.Schematic