本文主要是介绍基于ArcGIS Server对ShapeFile文件的编辑功能实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
这是添加点的代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPointFeature 的摘要说明
/// </summary>
public class AddPointFeature : IMapServerToolAction
{
public AddPointFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
void IMapServerToolAction.ServerAction(ToolEventArgs args)
{
//Step1: 取到地图点击画的那个点
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PointEventArgs pea = (PointEventArgs)args;
System.Drawing.Point screen_point = pea.ScreenPoint;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesp = mapFunc.MapDescription;
ESRI.ArcGIS.ADF.Web.Geometry.Point adf_map_point = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_point, mapCtrl.Extent, mapFunc.DisplaySettings.ImageDescriptor.Width, mapFunc.DisplaySettings.ImageDescriptor.Height);
PointN ags_map_point = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(adf_map_point);
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点,第二个图层是线,第三个图层是面。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(0);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
IPoint pPoint;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pPoint =(IPoint) pSOC.CreateObject("esriGeometry.Point");
pPoint.X = ags_map_point.X;
pPoint.Y = ags_map_point.Y;
IGeometry pPointGeo = pPoint as IGeometry;
pFeature.Shape = pPointGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPointFeature 的摘要说明
/// </summary>
public class AddPointFeature : IMapServerToolAction
{
public AddPointFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
void IMapServerToolAction.ServerAction(ToolEventArgs args)
{
//Step1: 取到地图点击画的那个点
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PointEventArgs pea = (PointEventArgs)args;
System.Drawing.Point screen_point = pea.ScreenPoint;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesp = mapFunc.MapDescription;
ESRI.ArcGIS.ADF.Web.Geometry.Point adf_map_point = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_point, mapCtrl.Extent, mapFunc.DisplaySettings.ImageDescriptor.Width, mapFunc.DisplaySettings.ImageDescriptor.Height);
PointN ags_map_point = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.FromAdfPoint(adf_map_point);
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点,第二个图层是线,第三个图层是面。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(0);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
IPoint pPoint;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pPoint =(IPoint) pSOC.CreateObject("esriGeometry.Point");
pPoint.X = ags_map_point.X;
pPoint.Y = ags_map_point.Y;
IGeometry pPointGeo = pPoint as IGeometry;
pFeature.Shape = pPointGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
添加线的代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPolylineFeature 的摘要说明
/// </summary>
public class AddPolylineFeature : IMapServerToolAction
{
public AddPolylineFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
public void ServerAction(ToolEventArgs args)
{
//Step1:根据客户端定义的动作,将屏幕坐标点转换成地图坐标点
//并初始化一些常用的参数
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PolylineEventArgs peal = (PolylineEventArgs)args;
System.Drawing.Point[] screen_points = peal.Vectors;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
mapDesc = mapFunc.MapDescription;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
IPointCollection pPointColl;
pPointColl = (IPointCollection)pSOC.CreateObject("esriGeometry.Polyline");
for (int i = 0; i < screen_points.Length; i++)
{
IPoint pPoint;
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points , mapCtrl.Extent, (int)mapCtrl.Width.Value, (int)mapCtrl.Height.Value);
pPoint = (IPoint)pSOC.CreateObject("esriGeometry.Point");
pPoint.X = mappnt.X;
pPoint.Y = mappnt.Y;
object missingVal = System.Reflection.Missing.Value;
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
}
IGeometry pPolylineGeo = pPointColl as IGeometry;
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点(0),第二个图层是线(1),第三个图层是面(2)。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(1);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pFeature.Shape = pPolylineGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPolylineFeature 的摘要说明
/// </summary>
public class AddPolylineFeature : IMapServerToolAction
{
public AddPolylineFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
public void ServerAction(ToolEventArgs args)
{
//Step1:根据客户端定义的动作,将屏幕坐标点转换成地图坐标点
//并初始化一些常用的参数
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PolylineEventArgs peal = (PolylineEventArgs)args;
System.Drawing.Point[] screen_points = peal.Vectors;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
mapDesc = mapFunc.MapDescription;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
IPointCollection pPointColl;
pPointColl = (IPointCollection)pSOC.CreateObject("esriGeometry.Polyline");
for (int i = 0; i < screen_points.Length; i++)
{
IPoint pPoint;
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points , mapCtrl.Extent, (int)mapCtrl.Width.Value, (int)mapCtrl.Height.Value);
pPoint = (IPoint)pSOC.CreateObject("esriGeometry.Point");
pPoint.X = mappnt.X;
pPoint.Y = mappnt.Y;
object missingVal = System.Reflection.Missing.Value;
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
}
IGeometry pPolylineGeo = pPointColl as IGeometry;
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点(0),第二个图层是线(1),第三个图层是面(2)。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(1);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pFeature.Shape = pPolylineGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
编辑面的代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPolygonFeature 的摘要说明
/// </summary>
public class AddPolygonFeature : IMapServerToolAction
{
public AddPolygonFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
public void ServerAction(ToolEventArgs args)
{
//Step1:根据客户端定义的动作,将屏幕坐标点转换成地图坐标点
//并初始化一些常用的参数
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PolygonEventArgs peag = (PolygonEventArgs)args;
System.Drawing.Point[] screen_points = peag.Vectors;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
mapDesc = mapFunc.MapDescription;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
IPointCollection pPointColl;
pPointColl = (IPointCollection)pSOC.CreateObject("esriGeometry.Polygon");
for (int i = 0; i < screen_points.Length; i++)
{
IPoint pPoint;
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points , mapCtrl.Extent, (int)mapCtrl.Width.Value, (int)mapCtrl.Height.Value);
pPoint = (IPoint)pSOC.CreateObject("esriGeometry.Point");
pPoint.X = mappnt.X;
pPoint.Y = mappnt.Y;
object missingVal = System.Reflection.Missing.Value;
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
}
IGeometry pPolylineGeo = pPointColl as IGeometry;
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点(0),第二个图层是线(1),第三个图层是面(2)。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(2);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pFeature.Shape = pPolylineGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools;
using ESRI.ArcGIS.ADF.Web.UI.WebControls;
using ESRI.ArcGIS.ADF.ArcGISServer;
using ESRI.ArcGIS.Server;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using System.Collections;
using ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer;
using ESRI.ArcGIS.Geodatabase;
/// <summary>
/// AddPolygonFeature 的摘要说明
/// </summary>
public class AddPolygonFeature : IMapServerToolAction
{
public AddPolygonFeature()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region IMapServerToolAction 成员
public void ServerAction(ToolEventArgs args)
{
//Step1:根据客户端定义的动作,将屏幕坐标点转换成地图坐标点
//并初始化一些常用的参数
ESRI.ArcGIS.ADF.Web.UI.WebControls.Map mapCtrl;
mapCtrl = (ESRI.ArcGIS.ADF.Web.UI.WebControls.Map)args.Control;
PolygonEventArgs peag = (PolygonEventArgs)args;
System.Drawing.Point[] screen_points = peag.Vectors;
MapFunctionality mapFunc = (MapFunctionality)mapCtrl.GetFunctionality(0);
MapResourceLocal mapResLocal = mapFunc.Resource as MapResourceLocal;
ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDesc;
mapDesc = mapFunc.MapDescription;
IServerContext pSOC;
IMapServer pMapServer;
IMap pMap;
pSOC = mapResLocal.ServerContextInfo.ServerContext;
pMapServer = pSOC.ServerObject as IMapServer;
IMapServerObjects pMapServerObjs = pMapServer as IMapServerObjects;
pMap = pMapServerObjs.get_Map(pMapServer.DefaultMapName);
IPointCollection pPointColl;
pPointColl = (IPointCollection)pSOC.CreateObject("esriGeometry.Polygon");
for (int i = 0; i < screen_points.Length; i++)
{
IPoint pPoint;
ESRI.ArcGIS.ADF.Web.Geometry.Point mappnt = ESRI.ArcGIS.ADF.Web.Geometry.Point.ToMapPoint(screen_points , mapCtrl.Extent, (int)mapCtrl.Width.Value, (int)mapCtrl.Height.Value);
pPoint = (IPoint)pSOC.CreateObject("esriGeometry.Point");
pPoint.X = mappnt.X;
pPoint.Y = mappnt.Y;
object missingVal = System.Reflection.Missing.Value;
pPointColl.AddPoint(pPoint, ref missingVal, ref missingVal);
}
IGeometry pPolylineGeo = pPointColl as IGeometry;
//Step2:插入点到Shp文件中去。要打开WS
//第一个图层是点(0),第二个图层是线(1),第三个图层是面(2)。这里就不判断,主要在于功能的实现
ILayer pLayer = pMap.get_Layer(2);
IFeatureLayer pFeatureLyr = pLayer as IFeatureLayer;
IFeatureClass pFeatCls = pFeatureLyr.FeatureClass;
IDataset pDataset = pFeatCls as IDataset;
IWorkspace pWS = pDataset.Workspace;
IWorkspaceEdit pWorkspaceEdit = pWS as IWorkspaceEdit;
pWorkspaceEdit.StartEditing(false);
pWorkspaceEdit.StartEditOperation();
IFeatureBuffer pFeatureBuffer;
IFeatureCursor pFeatureCuror;
IFeature pFeature;
pFeatureBuffer = pFeatCls.CreateFeatureBuffer();
pFeatureCuror = pFeatCls.Insert(true);
pFeature = pFeatureBuffer as IFeature;
pFeature.Shape = pPolylineGeo;
pFeatureCuror.InsertFeature(pFeatureBuffer);
pWorkspaceEdit.StopEditOperation();
pWorkspaceEdit.StopEditing(true);
mapCtrl.Refresh();
}
#endregion
}
这篇关于基于ArcGIS Server对ShapeFile文件的编辑功能实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!