⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_selecttool.bas

📁 ArcEngine 这是基于AE组件的源代码
💻 BAS
字号:
Attribute VB_Name = "Mod_SelectTool"
'Public Sub DeleteSelectedFeatures()
'  Dim pDeleteSet As ISet
'  Dim pEditLayers As IEditLayers
'  Dim pEditor As IEditor
'  Dim pEnumLayer As IEnumLayer
'  Dim pFeature As iFeature
'  Dim pFeatureEdit As IFeatureEdit
'  Dim pFeatureCursor As IFeatureCursor
'  Dim pFeatureLayer As IFeatureLayer
'  Dim pFeatureSelection As IFeatureSelection
'  Dim pID As New UID
'  Dim pInvalidArea As IInvalidArea
'  Dim pSelectionSet As ISelectionSet
'  Dim bInOperation As Boolean
'  Dim DeletedFeatureCount As Integer
'  Dim LayerCount As Integer
'
'  On Error GoTo ErrorHandler
'
'  ''Get a handle to the Editor extension
'  pID = "esriEditor.Editor"
'  Set pEditor = Application.FindExtensionByCLSID(pID)
'  If Not pEditor.EditState = esriStateEditing Then Exit Sub
'  Set pEditLayers = pEditor
'
'  If pEditor.SelectionCount = 0 Then Exit Sub
'
'  'Set up the InvalidArea object
'  Set pInvalidArea = New InvalidArea
'  Set pInvalidArea.Display = pEditor.Display
'
'  'Loop through the selected features and delete them
'  pEditor.StartOperation
'  bInOperation = True
'
'  pID = "{40A9E885-5533-11D0-98BE-00805F7CED21}" 'IGeoFeatureLayer
'  Set pEnumLayer = pEditor.Map.Layers(pID, True)
'  pEnumLayer.Reset
'  Set pFeatureLayer = pEnumLayer.Next
'  Do While Not pFeatureLayer Is Nothing
'    'Check if feature layer is editable
'    If pEditLayers.IsEditable(pFeatureLayer) Then
'      Set pFeatureSelection = pFeatureLayer
'      Set pSelectionSet = pFeatureSelection.SelectionSet
'      ''Check if there is a selection
'      If Not pSelectionSet.count = 0 Then
'
'        'Add each feature to a Set
'        'and delete the set - need a Set incase there are related features
'          Set pDeleteSet = New esriSystem.Set
'          pSelectionSet.Search Nothing, False, pFeatureCursor
'          Set pFeature = pFeatureCursor.NextFeature
'          Do While Not pFeature Is Nothing
'            pInvalidArea.Add pFeature
'            pDeleteSet.Add pFeature
'            DeletedFeatureCount = DeletedFeatureCount + 1
'            Set pFeature = pFeatureCursor.NextFeature
'          Loop
'          pDeleteSet.Reset
'          Set pFeatureEdit = pDeleteSet.Next
'          Do While Not pFeatureEdit Is Nothing
'            pFeatureEdit.DeleteSet pDeleteSet
'            Set pFeatureEdit = pDeleteSet.Next
'          Loop
'
'      End If
'    End If
'    Set pFeatureLayer = pEnumLayer.Next
'  Loop
'
'  If DeletedFeatureCount = 0 Then
'    pEditor.AbortOperation
'  Else
'    pEditor.StopOperation ("Delete")
'    bInOperation = False
'  End If
'
'  'Clear the selection and refresh the display
'  pEditor.Map.ClearSelection
'  pInvalidArea.Invalidate esriAllScreenCaches
'
'  Exit Sub
'
'ErrorHandler:
'  If bInOperation Then
'    pEditor.AbortOperation
'  End If
'End Sub
'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -