zoukankan      html  css  js  c++  java
  • 按内环(孔洞)面积删除内环

     1 /// <summary>
     2 /// 按内环(孔洞)面积删除内环
     3 /// </summary>
     4 /// <param name="pPolygon"></param>
     5 /// <param name="Area">删除小于此值的内环,当值小于等于0时全部删除</param>
     6 /// <returns></returns>
     7 public IPolygon Delete_InteriorRingBag(IPolygon pPolygon,double Area)
     8 {
     9     IPolygon4 pPolygon4 = pPolygon as IPolygon4;
    10     //外环
    11     IGeometry pGeoExter = (pPolygon4.ExteriorRingBag as IGeometryCollection).get_Geometry(0);
    12 
    13 
    14     
    15     //内环
    16     IGeometryCollection pGeos = pPolygon4.get_InteriorRingBag(pGeoExter as IRing) as IGeometryCollection;
    17 
    18 
    19     for (int i = 0; i < pGeos.GeometryCount; i++)//遍历内环,对满足要求的内环Union至输入polygon
    20     {
    21         IGeometry pGeoInter = pGeos.get_Geometry(i);
    22 
    23         if (Math.Abs((pGeoInter as IArea).Area) > (Area<=0?double.MaxValue:Area))
    24         {
    25             ITopologicalOperator pTopo = pPolygon as ITopologicalOperator;
    26             IPointCollection pinterPoints = pGeoInter as IPointCollection;
    27 
    28             IPointCollection pPointsNew = new PolygonClass();
    29             pPointsNew.AddPointCollection(pinterPoints);                    
    30             IPolygon pU = pPointsNew as IPolygon;
    31 
    32             ITopologicalOperator pTopoSim = pU as ITopologicalOperator;
    33             pTopoSim.Simplify();
    34 
    35             pPolygon = pTopo.Union(pU) as IPolygon;
    36         }
    37     }
    38     return pPolygon;
    39 }
  • 相关阅读:
    数据访问技术系列课程 笔记(2) ADO.NET 连接方式进行数据访问
    Modern C# 系列课程笔记 第11节 深入委托和事件
    idea 将项目托管到 Git 报错:Can't finish Gitee sharing process
    ADO.Net
    WebService
    2013年了
    201301杂谈
    流程图
    出错列表
    杂谈4 2012年8月15日开
  • 原文地址:https://www.cnblogs.com/clgis/p/14771677.html
Copyright © 2011-2022 走看看