码迷,mamicode.com
首页 > Windows程序 > 详细

ArcGis相接面补节点c#

时间:2019-06-21 13:04:30      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:try   color   private   flush   lin   cts   执行   lint   div   

相接(Touch)面执行切割后 新面与原相接面会缺少公共节点。

 1  private void AddPointToTouchesPolygon(IFeatureCursor newFeatureCursor, IFeatureClass featureClass)
 2         {
 3             IFeature newFeature = newFeatureCursor.NextFeature();
 4             while (newFeature != null)
 5             {
 6                 IPointCollection pointCollectionNewFeature = newFeature.Shape as IPointCollection;
 7                 for (int i = 0; i < pointCollectionNewFeature.PointCount-1; i++)
 8                 {
 9                     ITopologicalOperator pTopologicalOperator = pointCollectionNewFeature.Point[i] as IGeometry as ITopologicalOperator;
10                     IGeometry pGeometryPointBuffer = pTopologicalOperator.Buffer(0.001);
11                     ISpatialFilter spatialFilter0 = Utils.FilterUtils.SpatialFilter(pGeometryPointBuffer, esriSpatialRelEnum.esriSpatialRelIntersects);
12                     IFeatureCursor featureCursor0 = featureClass.Update(spatialFilter0, false);
13                     IFeature feature0 = featureCursor0.NextFeature();
14                     while (feature0 != null)
15                     {
16                         IPointCollection pointCollection1 = feature0.Shape as IPointCollection;
17                         IPoint pointTemp = new PointClass();
18                         int count = 0;
19                         for (int k = 0; k < pointCollection1.PointCount-1; k++)
20                         {
21                             pointCollection1.QueryPoint(k, pointTemp);
22                             if (Math.Abs(pointTemp.X - pointCollectionNewFeature.Point[i].X) < 0.001 && Math.Abs(pointTemp.Y - pointCollectionNewFeature.Point[i].Y) < 0.001)
23                                 count++;
24                         }
25                         if (count == 0)
26                         {
27                             pointCollection1.AddPoint(pointCollectionNewFeature.Point[i]);
28                             ITopologicalOperator topologicalOperator = feature0.Shape as ITopologicalOperator;
29                             topologicalOperator.Simplify();
30                             featureCursor0.UpdateFeature(feature0);
31                             featureCursor0.Flush();
32                         }
33                         feature0 = featureCursor0.NextFeature();
34                     }
35                 }
36                 newFeature = newFeatureCursor.NextFeature();
37             }
38         }

欢迎提出改进意见、bug及其解决方案

 

ArcGis相接面补节点c#

标签:try   color   private   flush   lin   cts   执行   lint   div   

原文地址:https://www.cnblogs.com/yzhyingcool/p/11063758.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!