フィーチャクラスから個別値一覧を取得

 2016/9/1 (木)    

Dim pMxDoc As IMxDocument, pFLayer As IFeatureLayer, pData As IDataStatistics
Dim pCursor As ICursor, pStatResults As IStatisticsResults
Set pMxDoc = ThisDocument
Set pFLayer = pMxDoc.FocusMap.Layer(0)
Set pCursor = pFLayer.Search(Nothing, False)
 
Set pData = New DataStatistics
pData.Field = "Pop2000"
'個別値一覧を取得するフィールド名
Set pData.Cursor = pCursor
 
Dim pEnumVar As IEnumVariantSimple, value As Variant
Set pEnumVar = pData.UniqueValues
value = pEnumVar.Next
Do Until IsEmpty(value)
  Debug.Print "value - " & value
  value = pEnumVar.Next
Loop
 
Set pCursor = pFLayer.Search(Nothing, False)
Set pData.Cursor = pCursor
Set pStatResults = pData.Statistics
Debug.Print "mean - " & pStatResults.Mean

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.