TIN の作成

Sub CreateTIN()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMxDocument.FocusMap.Layer(0)
    
    Dim pFeatureClass As IFeatureClass
    Set pFeatureClass = pFeatureLayer.FeatureClass
    
    Dim pGeoDataset As IGeoDataset
    Set pGeoDataset = pFeatureClass
    
    Dim sType As esriTinSurfaceType
    sType = esriTinMassPoint
    
    Dim pHeightField As IField
    Set pHeightField = pFeatureClass.Fields.Field(pFeatureClass.FindField("HYOKO"))
    
    'TINの作成
    Dim pTinEdit As ITinEdit
    Set pTinEdit = New Tin  'オブジェクトのインスタンス化
    
    pTinEdit.InitNew pGeoDataset.Extent 'TINの作成
    pTinEdit.SaveAs "D:\Workspace\NEC\Sample\TIN\sampleTin2" 'ファイル保存
    
    pTinEdit.StartEditing   'TINの編集開始
    
    pTinEdit.AddFromFeatureClass _
        pFeatureClass, Nothing, pHeightField, Nothing, sType
        '第1引数:IFeatureClass         フィーチャクラス
        '第2引数:IQueryFilter          条件抽出
        '第3引数:IField                Z値フィールド
        '第4引数:IField                タグ値フィールド
        '第5引数:esriTinSurfaceType    定数(標高点)
    
    pTinEdit.StopEditing True   'TINの編集終了(保存)

End Sub