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


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

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

Retrieve all the in-memory schematic features currently selected in a ISchematicLayer. The schematic layer needs to be loaded in memory

[C#]
        /// <summary>
        /// Retrieve all the in-memory schematic features currently selected in a ISchematicLayer
        /// </summary>
        /// <param name="schemLayer">The ISchematicLayer where the in-memory schematic features are selected</param>
        /// <param name="OnlyVisible">If OnlyVisible is true, only the visible selected features are returned</param>
        /// <returns>The retrieved IEnumSchematicInMemoryFeature</returns>
        public IEnumSchematicInMemoryFeature GetSelectedInMemoryFeatureFromSchematicLayer(ESRI.ArcGIS.Schematic.ISchematicLayer schemLayer, bool OnlyVisible)
        {
                // cast SchematicLayer into ISchematicLayerEditHelper - the schematic layer needs to be loaded in memory
                ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper shemLayerHelper=(ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper)schemLayer;

                return shemLayerHelper.GetSchematicInMemorySelectedFeatures(OnlyVisible);
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Retrieve all the in-memory schematic features currently selected in a ISchematicLayer
        ''' </summary>
        ''' <param name="schemLayer">The ISchematicLayer where the in-memory schematic features are selected</param>
        ''' <param name="OnlyVisible">If OnlyVisible is true, only the visible selected features are returned</param>
        ''' <returns>The retrieved IEnumSchematicInMemoryFeature</returns>
        Public Function GetSelectedInMemoryFeatureFromSchematicLayer(ByVal schemLayer As ESRI.ArcGIS.Schematic.ISchematicLayer, ByVal OnlyVisible As Boolean) As ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature

                ' cast SchematicLayer into ISchematicLayerEditHelper - the schematic layer needs to be loaded in memory
                Dim schemLayerHelper As ESRI.ArcGIS.Schematic.ISchematicLayerEditHelper=TryCast(schemLayer, 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.Schematic