博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Arcengine将圆形、矩形转换为多边形 ;ICircularArc、IEnvelope转化为IPolygon
阅读量:5236 次
发布时间:2019-06-14

本文共 1737 字,大约阅读时间需要 5 分钟。

1、将ICircularArc转化为IPolygon

1: ICircularArc pCircularArc = null;
2: IRubberBand pRubberBand = new RubberCircleClass();
3: pCircularArc = pRubberBand.TrackNew(axMapControl_Main.ActiveView.ScreenDisplay, null) as ICircularArc;
4: if (pCircularArc == null)
5:     return;
6: object missing = Type.Missing;
7: ISegmentCollection pSegmentColl = new RingClass();
8: pSegmentColl.AddSegment((ISegment)pCircularArc, ref missing, ref missing);
9: IRing pRing = (IRing)pSegmentColl;
10: pRing.Close(); //得到闭合的环
11: IGeometryCollection pGeometryCollection = new PolygonClass();
12: pGeometryCollection.AddGeometry(pRing, ref missing, ref missing); //环转面
13: IPolygon pPolygon = (IPolygon)pGeometryCollection;

2、将IEnvelope转化为IPolygon

1: IEnvelope pEnvelope = null;
2: IRubberBand pRubberBand = new RubberEnvelopeClass();
3: pEnvelope = pRubberBand.TrackNew(axMapControl_Main.ActiveView.ScreenDisplay, null) as IEnvelope;
4: if (pEnvelope == null)
5:     return;
6: IPoint p1 = new PointClass();
7: IPoint p2 = new PointClass();
8: IPoint p3 = new PointClass();
9: IPoint p4 = new PointClass();
10: p1 = pEnvelope.UpperLeft;
11: p2 = pEnvelope.LowerLeft;
12: p3 = pEnvelope.LowerRight;
13: p4 = pEnvelope.UpperRight;
14: IPointCollection pPointCollection = new PolygonClass();
15: object missing = Type.Missing;
16: pPointCollection.AddPoint(p1, ref missing, ref missing);
17: pPointCollection.AddPoint(p2, ref missing, ref missing);
18: pPointCollection.AddPoint(p3, ref missing, ref missing);
19: pPointCollection.AddPoint(p4, ref missing, ref missing);
20: IPolygon pPolygon = (IPolygon)pPointCollection;

注意:在给IPointCollection添加点的时候要按照一定的顺序添加(按照顺时针或者逆时针的顺序选取起点进行添加,否则会使得图形发生变化)

转载于:https://www.cnblogs.com/Jingkunliu/archive/2012/10/17/2727415.html

你可能感兴趣的文章
C# .NET 使用第三方类库DotNetZip解压/压缩Zip文件
查看>>
关于Github Pages
查看>>
程序员练级之路 (作者:陈皓)
查看>>
win7下virtualbox遇到的问题
查看>>
iOS开发数据库SQLite的使用
查看>>
(转)一次被黑经历与反思
查看>>
【WebService】WebService学习笔记
查看>>
The FIrst Blog
查看>>
LightOJ1038 Race to 1 Again
查看>>
Redis 安装与配置
查看>>
倒计时IE6+
查看>>
easyui webapi
查看>>
状态模式
查看>>
日期正则
查看>>
树莓派kali开启arp【arpspoof,urlsnarf】
查看>>
Quartz 多个触发器
查看>>
Java基础
查看>>
ArcPy 创建图层空间索引
查看>>
bzoj 2732: [HNOI2012]射箭
查看>>
学习笔记 第八周 第二篇(修改版)
查看>>