ArcGISEngine编辑-IWorkspaceEdit

IWorkspaceFactory pWsF = new ShapefileWorkspaceFactory();

创新互联建站不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的成都做网站、网站制作质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式营销型网站需求,让再小的品牌网站设计也能产生价值!

IFeatureWorkspace pFtWs = pWsF.OpenFromFile(@"E:\arcgis\Engine\数据", 0) as IFeatureWorkspace;

IFeatureClass pFtClass = pFtWs.OpenFeatureClass("edit");

IFeatureLayer pFt = new FeatureLayerClass();

pFt.FeatureClass = pFtClass;
pFt.Name = "画线";

axMapControl1.Map.AddLayer(pFt as ILayer);

axMapControl1.Refresh();

 

//为了进一步说明Idataset,我特意从下面的代码

IDataset pDataset = pFtClass as IDataset;

IWorkspace pWs = pDataset.Workspace;

pWsEdit = pWs as IWorkspaceEdit;

pWsEdit.StartEditing(true);


pWsEdit.StartEditOperation();


pBoolStart = pWsEdit.IsBeingEdited();

System.Diagnostics.Stopwatch TimeWatch = new System.Diagnostics.Stopwatch();

TimeWatch.Start();

IFeatureBuffer pFeatureBuffer = pFtClass.CreateFeatureBuffer();


IFeatureCursor pFtCusor = pFtClass.Insert(true);


ESRI.ArcGIS.Geometry.IPolyline polyline = new ESRI.ArcGIS.Geometry.PolylineClass();
ESRI.ArcGIS.Geometry.IPoint pPoint = new ESRI.ArcGIS.Geometry.PointClass();

ESRI.ArcGIS.Geometry.IPoint pPoint2 = new ESRI.ArcGIS.Geometry.PointClass();
for (int i = 0; i < 1000; i++)
{

pPoint.X = 48 + i * 102;

pPoint.Y = 65 + i * 10;

polyline.FromPoint = pPoint;

pPoint2.X = 480 + i * 10;

pPoint2.Y = 615 + i * 102;


polyline.ToPoint = pPoint2;

pFeatureBuffer.Shape = polyline;

pFeatureBuffer.set_Value(2, i);


object pFeatureOID = pFtCusor.InsertFeature(pFeatureBuffer);
}

pFtCusor.Flush();

pWsEdit.StopEditing(true);

axMapControl1.Refresh();
TimeWatch.Stop();

MessageBox.Show(TimeWatch.Elapsed.Milliseconds.ToString());


名称栏目:ArcGISEngine编辑-IWorkspaceEdit
浏览地址:http://pwwzsj.com/article/iepsdp.html