Creating features |
#region 创建要素
IFeatureClass pFeatClass = pFeatLayer.FeatureClass;
IFeatureCursor pFeatureCursor = pFeatClass.Insert(true);
foreach (var id_car in m_dicCar_Obj)
{
foreach (var trace in id_car.Value.TraceList)
{
IFeatureBuffer pFeatureBuffer = pFeatClass.CreateFeatureBuffer();
IPoint pPoint = new ESRI.ArcGIS.Geometry.Point();
pPoint.X = trace._cp.Lng;
pPoint.Y = trace._cp.Lat;
pFeatureBuffer.Shape = pPoint;
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("车辆识别码"), id_car.Key);
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("GPS时间"), trace.GPSTime);
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("经度"), trace._cp.Lng);
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("纬度"), trace._cp.Lat);
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("方向"), trace.GPSDirection);
pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("里程仪速"), trace.GPSSpeed);
pFeatureCursor.InsertFeature(pFeatureBuffer);
featCount++;
}
}
pFeatureCursor.Flush();
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);