YouTube | Facebook | Twitter  Feed

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

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上級技術者、Esri認定インストラクター、測量士補、潜水士、元PADIダイブマスター、四アマ。GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、発言は個人の見解です。

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

© 2021 WINGFIELD since1981