博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【039】Geometry 总结
阅读量:5860 次
发布时间:2019-06-19

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

---------------------------------------------------------------------------------------------------------

●·● 目录:

A1 …………

A2 …………
A3 …………
A4 …………
A5 …………
A6 …………
A7 ………… A8 …………
A9 …………

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·Geometry 总结

  1. Polyline:是 Path 的集合,可以实现 IGeometryCollection 接口,用于添加几何图形!
  2. Path:由 Segment 组成,可以实现 ISegmentCollection 接口,用于添加 Segment!
  3. Polygon:是 Ring 的集合,可以实现 IGeometryCollection 接口,用于添加几何图形!
  4. Ring:由 Segment 组成,可以实现 ISegmentCollection 接口,用于添加 Segment!
  5. Segment:包括 Line、CircularArc、EllipticArc、BezierCurve 四个!

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 圆

  1. 构造圆心点,IPoint。
  2. 构造圆弧,IConstructCircularArc,通过此接口,利用圆心和半径来确定圆弧。
  3. 构造线段,ISegment,将圆弧转为线段接口,用于添加到下面的线段集合中。
  4. 构造线段集合,ISegmentCollection,将上面的线段添加进来。
  5. 构造环,IRing,将线段集合转为环接口,用于实现图形的 Close 。
  6. 构造几何图形集合:IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。

有填充颜色的:

IPoint pPoint = new PointClass();pPoint.X = 110;pPoint.Y = 40;//构建圆对象IConstructCircularArc pConstructCircularArc = new CircularArcClass();pConstructCircularArc.ConstructCircle(pPoint, 20, false);ICircularArc pArc = pConstructCircularArc as ICircularArc;  //不必要ISegment pSegment1 = pArc as ISegment;//通过ISegmentCollection构建Ring对象ISegmentCollection pSegCollection = new RingClass();object o = Type.Missing;//添加Segement对象即圆pSegCollection.AddSegment(pSegment1, ref o, ref o);//QI到IRing接口封闭Ring对象,使其有效IRing pRing = pSegCollection as IRing;pRing.Close();//通过Ring对象使用IGeometryCollection构建Polygon对象IGeometryCollection pGeometryColl = new PolygonClass();pGeometryColl.AddGeometry(pRing, ref o, ref o);//构建一个CircleElement对象IElement pElement = new CircleElementClass();pElement.Geometry = pGeometryColl as IGeometry;IGraphicsContainer pGC = this.axMapControl1.ActiveView.GraphicsContainer;pGC.AddElement(pElement, 0);this.axMapControl1.Refresh();

没有填充颜色的,只需加入下面一句,使其为透明颜色即可!

pColor.Transparency = 0;

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 椭圆

  1. 构造两个点,IPoint。
  2. 构造包络线也就是矩形,IEnvelope,通过上面的两个点。
  3. 构造圆弧,IConstructEllipticArc,通过此接口,利用矩形来确定椭圆弧。
  4. 构造线段,ISegment,将椭圆弧转为线段接口,用于添加到下面的线段集合中。
  5. 构造线段集合,ISegmentCollection,将上面的线段添加进来。
  6. 构造环,IRing,将线段集合转为环接口,用于实现图形的 Close 。
  7. 构造几何图形集合:IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。

有填充颜色的:

IPoint pPoint1 = new PointClass();pPoint1.PutCoords(80, 20);IPoint pPoint2 = new PointClass();pPoint2.PutCoords(130, 50);IEnvelope pEnvelope = new EnvelopeClass();pEnvelope.LowerLeft = pPoint1;pEnvelope.UpperRight = pPoint2;IConstructEllipticArc pConstructEllipticArc = new EllipticArcClass();pConstructEllipticArc.ConstructEnvelope(pEnvelope);IEllipticArc pEllipticArc = pConstructEllipticArc as IEllipticArc;  //不必要ISegment pSegment = pEllipticArc as ISegment;ISegmentCollection pSegmentCollection = new RingClass();object o = Type.Missing;pSegmentCollection.AddSegment(pSegment, ref o, ref o);IRing pRing = pSegmentCollection as IRing;pRing.Close();IGeometryCollection pGeometryColl = new PolygonClass();pGeometryColl.AddGeometry(pRing, ref o, ref o);ISimpleLineSymbol pSimpleLineSym = new SimpleLineSymbol();pSimpleLineSym.Color = GetColor(0, 0, 0);pSimpleLineSym.Width = 2;ISimpleFillSymbol pSimpleFillSym = new SimpleFillSymbol();IRgbColor pColor = new RgbColor();pColor.Red = 255;pColor.Green = 255;pSimpleFillSym.Color = pColor;pSimpleFillSym.Outline = pSimpleLineSym;IElement pElement = new EllipseElementClass();pElement.Geometry = pGeometryColl as IGeometry;IFillShapeElement pFillShapeElement = pElement as IFillShapeElement;pFillShapeElement.Symbol = pSimpleFillSym;IGraphicsContainer pGC = axMapControl1.ActiveView.GraphicsContainer;pGC.AddElement(pElement, 0);axMapControl1.Refresh();

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 圆弧

  1. 构造圆心点,IPoint。
  2. 构造圆弧,IConstructCircularArc,通过此接口,利用圆心、半径、起始角度,中心角来确定圆弧。
  3. 构造线段,ISegment,将圆弧转为线段接口,用于添加到下面的线段集合中。
  4. 构造线段集合,ISegmentCollection,将上面的线段添加进来。
  5. 构造环或者路径,IRing or IPath,将线段集合转为环接口或是路径接口 。
  6. 构造几何图形集合:IGeometryCollection,将上面的环添加到几何图形集合中,然后就可以用了。
IPoint pPoint = new PointClass();pPoint.X = 80;pPoint.Y = 40;IConstructCircularArc pConstructCircularArc = new CircularArcClass();pConstructCircularArc.ConstructBearingRadiusAngle(pPoint, 0, false, 20, Math.PI*4/3);ICircularArc pArc = pConstructCircularArc as ICircularArc;  //不必要ISegment pSegment1 = pArc as ISegment;ISegmentCollection pSegCollection = new RingClass();object o = Type.Missing;pSegCollection.AddSegment(pSegment1, ref o, ref o);IRing pRing = pSegCollection as IRing;//IPath pRing = pSegCollection as IPath;  //也可以的IGeometryCollection pGeometryColl = new PolygonClass();pGeometryColl.AddGeometry(pRing, ref o, ref o);ISimpleLineSymbol pSimpleLineSym = new SimpleLineSymbol();pSimpleLineSym.Color = GetColor(0, 0, 0);pSimpleLineSym.Width = 2;ISimpleFillSymbol pSimpleFillSym = new SimpleFillSymbol();IRgbColor pColor = new RgbColor();pColor.RGB = 255;//pColor.Transparency = 0;  //透明填充pSimpleFillSym.Color = pColor;pSimpleFillSym.Outline = pSimpleLineSym;IElement pElement = new CircleElementClass();IFillShapeElement pFillShapeEle = pElement as IFillShapeElement;pFillShapeEle.Symbol = pSimpleFillSym;pElement.Geometry = pGeometryColl as IGeometry;IGraphicsContainer pGC = this.axMapControl1.ActiveView.GraphicsContainer;pGC.AddElement(pElement, 0);this.axMapControl1.Refresh();

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 椭圆弧

1. 实现画¼圆弧:Construct an elliptic arc that starts at fromPoint, goes to toPoint, and spans an angle of pi/2. The rotation of the ellipse will be either 0 or pi/2.

IPoint pPoint1 = new PointClass();pPoint1.PutCoords(105, 20);IPoint pPoint2 = new PointClass();pPoint2.PutCoords(130, 35);IEnvelope pEnvelope = new EnvelopeClass();pEnvelope.LowerLeft = pPoint1;pEnvelope.UpperRight = pPoint2;IConstructEllipticArc pConstructEllipticArc = new EllipticArcClass();pConstructEllipticArc.ConstructQuarterEllipse(pPoint1, pPoint2, true);  //第三个参数决定顺逆时针!ISegment pSegment = pConstructEllipticArc as ISegment;ISegmentCollection pSegmentCollection = new RingClass();object o = Type.Missing;pSegmentCollection.AddSegment(pSegment, ref o, ref o);IRing pRing = pSegmentCollection as IRing;IGeometryCollection pGeometryColl = new PolygonClass();pGeometryColl.AddGeometry(pRing, ref o, ref o);ISimpleLineSymbol pSimpleLineSym = new SimpleLineSymbol();pSimpleLineSym.Color = GetColor(0, 0, 0);pSimpleLineSym.Width = 2;ISimpleFillSymbol pSimpleFillSym = new SimpleFillSymbol();IRgbColor pColor = new RgbColor();pColor.Red = 255;pSimpleFillSym.Color = pColor;pSimpleFillSym.Outline = pSimpleLineSym;IElement pElement = new EllipseElementClass();pElement.Geometry = pGeometryColl as IGeometry;IFillShapeElement pFillShapeElement = pElement as IFillShapeElement;pFillShapeElement.Symbol = pSimpleFillSym;IGraphicsContainer pGC = axMapControl1.ActiveView.GraphicsContainer;pGC.AddElement(pElement, 0);axMapControl1.Refresh();

2. 实现根据起始点,以及限制在一个矩形中:Construct an elliptic arc that starts at fromPoint, goes to toPoint, and tries to have the embedded ellipse inscribed in the suggestedEnvelope. The result will have rotation of 0 or pi/2.

IPoint pPoint1 = new PointClass();pPoint1.PutCoords(80, 20);IPoint pPoint2 = new PointClass();pPoint2.PutCoords(130, 50);IPoint pPoint3 = new PointClass();pPoint3.PutCoords(50, 20);IPoint pPoint4 = new PointClass();pPoint4.PutCoords(140, 60);IEnvelope pEnvelope = new EnvelopeClass();pEnvelope.LowerLeft = pPoint3;pEnvelope.UpperRight = pPoint4;IConstructEllipticArc pConstructEllipticArc = new EllipticArcClass();pConstructEllipticArc.ConstructTwoPointsEnvelope(pPoint1, pPoint2, pEnvelope, esriArcOrientation.esriArcMajor);ISegment pSegment = pConstructEllipticArc as ISegment;ISegmentCollection pSegmentCollection = new RingClass();object o = Type.Missing;pSegmentCollection.AddSegment(pSegment, ref o, ref o);IRing pRing = pSegmentCollection as IRing;IGeometryCollection pGeometryColl = new PolygonClass();pGeometryColl.AddGeometry(pRing, ref o, ref o);ISimpleLineSymbol pSimpleLineSym = new SimpleLineSymbol();pSimpleLineSym.Color = GetColor(0, 0, 0);pSimpleLineSym.Width = 2;ISimpleFillSymbol pSimpleFillSym = new SimpleFillSymbol();IRgbColor pColor = new RgbColor();pColor.Red = 255;pColor.Transparency = 0;pSimpleFillSym.Color = pColor;pSimpleFillSym.Outline = pSimpleLineSym;IElement pElement2 = new RectangleElementClass();pElement2.Geometry = pEnvelope;IFillShapeElement pFillShapeElement2 = pElement2 as IFillShapeElement;pFillShapeElement2.Symbol = pSimpleFillSym;IElement pElement = new EllipseElementClass();pElement.Geometry = pGeometryColl as IGeometry;IFillShapeElement pFillShapeElement = pElement as IFillShapeElement;pColor.Transparency = 1;pSimpleFillSym.Color = pColor;pFillShapeElement.Symbol = pSimpleFillSym;IGraphicsContainer pGC = axMapControl1.ActiveView.GraphicsContainer;pGC.AddElement(pElement, 0);pGC.AddElement(pElement2, 0);axMapControl1.Refresh();

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 椭圆

 

---------------------------------------------------------------------------------------------------------

            ╔════════╗

╠════╣        ╠══════════════════════════════════════════════════╣
            ╚════════╝

·绘制几何图形 —— 椭圆

 

 

转载于:https://www.cnblogs.com/alex-bn-lee/archive/2012/05/03/2480566.html

你可能感兴趣的文章
(16)Python练习题
查看>>
分布式系统中处理参数配置的 4 种方案
查看>>
建站篇-用户认证系统-自定义登录系统
查看>>
MongoDB基本用法
查看>>
小型机故障的基本定位方法
查看>>
PRId64的正确用法
查看>>
服务器入侵处理三则
查看>>
zabbix 监控数据库
查看>>
新手用Linux做代理服务器 三招搞定
查看>>
当客户问专利有什么用时,我们的回答是:专利是门生意……
查看>>
Ubuntu任务栏如何设置为底部?
查看>>
windows live MSN输入账号时反应很慢,且输入账号后登陆页失败,提示:8004888d
查看>>
netsh 命令详解
查看>>
关于vsftpd服务的安全设置
查看>>
《Windows Server 2012活动目录管理实践》 目录 1-14章
查看>>
【虚拟化实战】容灾设计之一设计方法
查看>>
SSH与TCP Wrapper 学习笔记
查看>>
【移动开发】Android中Fragment+ViewPager的配合使用
查看>>
[你必须知道的异步编程]——基于事件的异步编程模式
查看>>
总结关于登陆ECS的三种方式(Linux系统)
查看>>