'ポリゴンの座標値を表示する方法 Sub subGetVertex() Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pFlayer As IFeatureLayer Set pFlayer = pMxDoc.FocusMap.Layer(0) Dim pFClass As IFeatureClass Set pFClass = pFlayer.FeatureClass Dim pFeature As IFeature Set pFeature = pFClass.GetFeature(1) 'フィーチャからジオメトリを取得 Dim pGeometry As IGeometry Set pGeometry = pFeature.Shape 'ポリゴンやポリラインはIPointCollectionをサポートしている Dim pPCollection As IPointCollection Set pPCollection = pGeometry '頂点取得用のPointオブジェクト Dim pPoint As IPoint Dim i As Long For i = 0 To pPCollection.PointCount - 1 Set pPoint = pPCollection.Point(i) Debug.Print pPoint.X, pPoint.Y Next i End Sub
ポリゴンのバーテックスを取得
2016/9/1 (木)