ArcGIS Engine 编辑- IWorkspaceEdit

发布时间:2020-07-24 20:55:28 作者:刘朝样
来源:网络 阅读:1426

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());

推荐阅读:
  1. 「小程序JAVA实战」小程序视频组件与api介绍(51)
  2. ArcGIS Engine 编辑介绍

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

workedit ce workspace

上一篇:Spring Security五:Spring security原理

下一篇:loadrunner多场景的串行执行以及定时执行

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》