基于AE删除选择的要素

                          基于AE删除选择的要素- -

                                      

 ' //Deletes all features selected on the current layer
    Public Sub DeleteAllSelectedFeatures(ByVal pFeatureCursor As IFeatureCursor, ByVal GeometryTypeStr As String)
        Dim pWorkspaceEdit As IWorkspaceEdit
        Dim pFeature As IFeature
        ' If there are no features currently selected then nothing to do
        If pFeatureCursor Is Nothing Then Exit Sub
        Try
            Dim bResponse As DialogResult
            bResponse = MsgBox("您确定删除所有" & GeometryTypeStr & "要素吗?", MessageBoxButtons.YesNo)
            If bResponse = Windows.Forms.DialogResult.Yes Then
                ' Loop over the selected features deleting each in turn
                pWorkspaceEdit = pSdeWorkspace
                pWorkspaceEdit.StartEditing(True)
                pWorkspaceEdit.StartEditOperation()
                pFeature = pFeatureCursor.NextFeature
                While Not pFeature Is Nothing
                    pFeature.Delete()
                    pFeature = pFeatureCursor.NextFeature
                End While
                pWorkspaceEdit.StopEditOperation()
                pWorkspaceEdit.StopEditing(True)
            End If
            mainForm1.AxMapControl1.ActiveView.Refresh()
            Exit Sub
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

posted on 2007-05-22 15:26  GIS云中飞鹏  阅读(1837)  评论(0编辑  收藏  举报

导航