zoukankan      html  css  js  c++  java
  • Polygone对象

       Polylgon对象是由一个或多个Ring对象的有序集合,它可以是由单个Ring 对象构
    成,也可以使用多个Ring组成。Polygon通常用来代表有面积的多边形矢量对象,如行政
    区,建筑物等。

    组成Polygone的是Ring其中Ring可以分为Outer Ring(外环)和Inner  Ring(内环)
    之分。外环和内环都是有方向的,它们的区别是外环的方向是顺时针的,内环的方向是逆时
    针。

    以下代码片段演示如何构建一个Polygon:
       private  object pMissing = Type.Missing;


             public  IGeometry GetPolygonGeometry()
            {
                const double RingVertexCount = 360;
                const double RingDegrees = 360.0;
                const double pOutRingRadius = 100;
                const double pInRingRadius = 40;
     
                IGeometryCollection pGeometryCollection = new PolygonClass();
     
     
     
                    IPointCollection pOuterPointCollection = new RingClass();
                    IPointCollection pInnerPointCollection = new RingClass();
     
                  
                    
     
                    double pRotationAngleInRadians =
                           GetRadians(RingDegrees / RingVertexCount);
     
                    for (int j = 0; j < RingVertexCount; j++)
                    {
                                           pOuterPointCollection.AddPoint(ConstructPoint(pOutRingRadius
    *Math.Cos(j*pRotationAngleInRadians),pOutRingRadius *Math.Sin(j*pRotationAngleInRadians)), 
    ref pMissing, ref pMissing);
     
                        pOuterPointCollection.AddPoint(ConstructPoint (pInRingRadius * Math.Cos(j
    * pRotationAngleInRadians), pInRingRadius * Math.Sin(j * pRotationAngleInRadians)), ref pMissing,
    ref pMissing);
                               
                                      
                    }

     
         ITopologicalOperator pTopologicalOperator =
                pGeometryCollection as ITopologicalOperator;
         pTopologicalOperator.Simplify();
         return pGeometryCollection as IGeometry;

         }
     
        
         private  double GetRadians(double pDecimalDegrees)
         {
             return pDecimalDegrees * (Math.PI / 180);
         }

  • 相关阅读:
    Vue 从入门到进阶之路(十四)
    Vue 从入门到进阶之路(十三)
    Vue 从入门到进阶之路(十二)
    Vue 从入门到进阶之路(十一)
    vue-cli 3.x 开发插件并发布到 npm
    2018 年终总结 & 2019 年度计划
    帝都夜话
    移动端实现拖拽的两种方法
    前端面试(原生js篇)
    在前端获取图片宽高
  • 原文地址:https://www.cnblogs.com/qiushuixizhao/p/3248079.html
Copyright © 2011-2022 走看看