全体表示コマンドの全体範囲を指定する方法

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

Sub setFullExtent()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
    Dim pMap As IMap
    Set pMap = pMxDocument.FocusMap
     
    Dim pActiveView As IActiveView
    Set pActiveView = pMap
     
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMap.Layer(0)
     
    Dim pFeatureClass As IFeatureClass
    Set pFeatureClass = pFeatureLayer.FeatureClass
     
    Dim pFeature As IFeature
    Set pFeature = pFeatureClass.GetFeature(1)
     
    Dim pEnvelope As IEnvelope
    Set pEnvelope = pFeature.Shape.Envelope
     
    '全体表示コマンドの全体範囲
    pMap.AreaOfInterest = Nothing   'すべてのレイヤのデータ範囲(デフォルト)
    pMap.AreaOfInterest = pEnvelope 'その他(表示範囲の指定はEnvelopeで設定)
 
    '現在の全体表示範囲を取得
    Dim pFullExtent As IEnvelope
    Set pFullExtent = pActiveView.FullExtent
 
End Sub

関連記事

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

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.