ArcEngine画shapefile点,线,面

即使这是最简单的编辑操作,我也走了很多弯路。今天把找到的好用的东西贴出来与大家分享。

点编辑:

IPoint pt;
pt = axMapControl1.ToMapPoint(e.x, e.y);
IMarkerElement pMarkerElement;
pMarkerElement = new MarkerElementClass();
IElement pElement;
pElement = pMarkerElement as IElement;
pElement.Geometry = pt;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pMarkerElement, 0);
pActiveView.Refresh();

线编辑:

IGeometry polyline;
polyline = axMapControl1.TrackLine();
ILineElement pLineElement;
pLineElement = new LineElementClass();
IElement pElement;
pElement = pLineElement as IElement;
pElement.Geometry = polyline;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)pLineElement, 0);
pActiveView.Refresh();

面编辑:

IGeometry Polygon;
Polygon = axMapControl1.TrackPolygon();
IPolygonElement PolygonElement;
PolygonElement = new PolygonElementClass();
IElement pElement;
pElement = PolygonElement as IElement;
pElement.Geometry = Polygon;
pGraphicsContainer = pMap as IGraphicsContainer;
pGraphicsContainer.AddElement((IElement)PolygonElement, 0);
pActiveView.Refresh();

对于点编辑其实还有一种方法,稍后在下一篇中提到。

转载自:https://blog.csdn.net/Scarlett_OHara/article/details/51159162

You may also like...