'ArcGIS 10.1 SP1を入れるとIDataStatistics::UniqueValueでメモリリーク エラーとなる。その場合の回避方法。 Sub test() Dim pMxDoc As IMxDocument, pFLayer As IFeatureLayer Dim pCursor As ICursor Set pMxDoc = ThisDocument Set pFLayer = pMxDoc.FocusMap.Layer(0) Set pCursor = pFLayer.Search(Nothing, False) Dim pUniqueValueRenderer As IUniqueValueRenderer Set pUniqueValueRenderer = New UniqueValueRenderer pUniqueValueRenderer.FieldCount = 1 pUniqueValueRenderer.Field(0) = "P_NUM" Dim pRow As IRow Set pRow = pCursor.NextRow Do Until pRow Is Nothing pUniqueValueRenderer.AddValue pRow.value(9), "", Nothing Set pRow = pCursor.NextRow Loop Debug.Print pUniqueValueRenderer.ValueCount Dim i As Long For i = 0 To pUniqueValueRenderer.ValueCount - 1 Debug.Print pUniqueValueRenderer.value(i) Next i End Sub
ArcObjects,VBA,esriCarto
2016/9/1 (木)