溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

ArcGIS Engine 編輯- IWorkspaceEdit

發(fā)布時間:2020-07-24 20:55:28 來源:網(wǎng)絡(luò) 閱讀:1419 作者:劉朝樣 欄目:編程語言

IWorkspaceFactory pWsF = new ShapefileWorkspaceFactory();

IFeatureWorkspace pFtWs = pWsF.OpenFromFile(@"E:\arcgis\Engine\數(shù)據(jù)", 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();

 

//為了進(jìn)一步說明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());

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI