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

関連記事

  • この記事を書いた人

羽田 康祐

Esri認定インストラクター、GIS上級技術者、測量士補、潜水士。GISy / GISc とその関連分野である地理学・地図学について日々の出来事で学んだ記憶を記録するためにブログを書いています。行動原理は伊達と酔狂。好きな地形は圏谷。好きな地図投影法はパースクインカンシャル図法。呉市生まれ広島市出身。GIS を使った自己紹介はこちら

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

© 2020 WINGFIELD since1981