ArcGis相接面补节点c#

相接(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#

上一篇:Redis-数据特征和应用场景


下一篇:C# 微软官方教程