2017-05-31 12 views
-1

私はポイントフィーチャーを作成しました。しかし、データ属性テーブルを追加することはできません。ポイントフィーチャを作成して同時にアトリビュートテーブルにデータを追加する方法は?

IMxDocument pMxdoc = ArcMap.Application.Document as IMxDocument; 
IPoint pPoint = pMxdoc.ActivatedView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y); 
IFeatureLayer pFLayer = pMxdoc.FocusMap.Layer[3] as IFeatureLayer; 
IWorkspaceEdit pWSE = ((IDataset)(pFLayer.FeatureClass)).Workspace as IWorkspaceEdit; 
pWSE.StartEditing(false); 
pWSE.StartEditOperation(); 

IFeature pFeature = pFLayer.FeatureClass.CreateFeature(); 
pFeature.Shape = pPoint; 
pFeature.Store(); 

// I want to add data in table this here but how? 

pWSE.StopEditOperation(); 
pWSE.StopEditing(true); 

pMxdoc.ActivatedView.Refresh(); 

答えて

3

ジオメトリをフィーチャに割り当てるだけですが、追加の属性が必要な場合があります。したがって、現在の機能の属性値は、set_Value

int fieldIndex = myFeatureClass.FindField(attributeName); 
object newValue = "newValue"; 
IFeature pFeature = pFLayer.FeatureClass.CreateFeature(); 
pFeature.set_Value(fieldIndex, newValue); 
pFeature.Shape = pPoint; 
pFeature.Store(); 
+0

を使用して設定する必要があります。ありがとうHimBromBeere –

関連する問題