編集オペレーションとオペレーション スタックの連動

投稿日:2016/9/1 (木) 更新日:

Private Sub UIToolControl1_MouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long)
 
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
     
    Dim pFL As IFeatureLayer
    Set pFL = pMxDoc.FocusMap.Layer(0)
     
    Dim pFC As IFeatureClass
    Set pFC = pFL.FeatureClass
     
    Dim pFeature As IFeature
     
    Dim pUID As New UID
    pUID.Value = "esriEditor.Editor"
     
    Dim pEditor As IEditor
    Set pEditor = Application.FindExtensionByCLSID(pUID)
     
    pEditor.StartOperation
     
    Dim pPoint As IPoint
    Set pPoint = pMxDoc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)
     
    Set pFeature = pFC.CreateFeature
    Set pFeature.Shape = pPoint
     
    pFeature.Store
     
    pEditor.StopOperation "create"
     
    pMxDoc.ActiveView.Refresh
 
End Sub
 
 
Sub UndoEditOperation()
     
    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument
     
    Dim pOS As IOperationStack
    Set pOS = pMxDoc.OperationStack
     
    pOS.Undo
     
    pMxDoc.ActiveView.Refresh
 
End Sub

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂でエクストリーム スポーツに挑む GIS エンジニア。 GIS、IT、趣味に関して日々の出来事で学んだ記憶を記録するためにブログを書いています。同じ問題に出会った方の参考になっていただければ幸いです。GIS を使った自己紹介はこちら

-プログラミング, ArcGIS
-,

Copyright© WINGFIELD since1981 , 2019 All Rights Reserved.