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


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

Get The Selected Schematic Features In A ILayer Snippet

Retrieve the schematic features currently selected in a ILayer

[C#]
        /// <summary>
        /// Retrieve the schematic features currently selected in a ILayer
        /// </summary>
        /// <param name="esriLayer">The ILayer where the schematic features are selected</param>
        /// <param name="OnlyVisible">If OnlyVisible is true, only the visible selected features are returned</param>
        /// <returns>The retrieved IEnumSchematicFeature</returns>
        public ESRI.ArcGIS.Schematic.IEnumSchematicFeature GetSelectedFeatureFromLayer(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;
                return schLayer.GetSchematicSelectedFeatures(OnlyVisible);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve the schematic features currently selected in a ILayer
        ''' </summary>
        ''' <param name="esriLayer">The ILayer where the schematic features are selected</param>
        ''' <param name="OnlyVisible">If OnlyVisible is true, only the visible selected features are returned</param>
        ''' <returns>The retrieved IEnumSchematicFeature</returns>
        Public Function GetSelectedFeatureFromLayer(ByVal esriLayer As ESRI.ArcGIS.Carto.ILayer, ByVal OnlyVisible As Boolean) As ESRI.ArcGIS.Schematic.IEnumSchematicFeature
                ' cast Layer into ISchematicLayer
                Dim schLayer As ESRI.ArcGIS.Schematic.ISchematicLayer=TryCast(esriLayer, ESRI.ArcGIS.Schematic.ISchematicLayer)

                If schLayer Is Nothing Then Return Nothing
                Return schLayer.GetSchematicSelectedFeatures(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