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

  private void AddPointToTouchesPolygon(IFeatureCursor newFeatureCursor, IFeatureClass featureClass)
{
IFeature newFeature = newFeatureCursor.NextFeature();
while (newFeature != null)
{
IPointCollection pointCollectionNewFeature = newFeature.Shape as IPointCollection;
for (int i = ; i < pointCollectionNewFeature.PointCount-; i++)
{
ITopologicalOperator pTopologicalOperator = pointCollectionNewFeature.Point[i] as IGeometry as ITopologicalOperator;
IGeometry pGeometryPointBuffer = pTopologicalOperator.Buffer(0.001);
ISpatialFilter spatialFilter0 = Utils.FilterUtils.SpatialFilter(pGeometryPointBuffer, esriSpatialRelEnum.esriSpatialRelIntersects);
IFeatureCursor featureCursor0 = featureClass.Update(spatialFilter0, false);
IFeature feature0 = featureCursor0.NextFeature();
while (feature0 != null)
{
IPointCollection pointCollection1 = feature0.Shape as IPointCollection;
IPoint pointTemp = new PointClass();
int count = ;
for (int k = ; k < pointCollection1.PointCount-; k++)
{
pointCollection1.QueryPoint(k, pointTemp);
if (Math.Abs(pointTemp.X - pointCollectionNewFeature.Point[i].X) < 0.001 && Math.Abs(pointTemp.Y - pointCollectionNewFeature.Point[i].Y) < 0.001)
count++;
}
if (count == )
{
pointCollection1.AddPoint(pointCollectionNewFeature.Point[i]);
ITopologicalOperator topologicalOperator = feature0.Shape as ITopologicalOperator;
topologicalOperator.Simplify();
featureCursor0.UpdateFeature(feature0);
featureCursor0.Flush();
}
feature0 = featureCursor0.NextFeature();
}
}
newFeature = newFeatureCursor.NextFeature();
}
}

该方法只适用于规则的多边形,欢迎提出改进意见、bug及其解决

=============================================================================================================

更新方法:

      private void AddPointToTouchesPolygon(IFeatureCursor newFeatureCursor, IFeatureClass featureClass)
{
IFeature newFeature = newFeatureCursor.NextFeature();
IFeatureCursor featureCursor0 = null;
try
{
while (newFeature != null)
{
IPointCollection pointCollectionNewFeature = newFeature.Shape as IPointCollection;
for (int i = ; i < pointCollectionNewFeature.PointCount - ; i++)
{
ITopologicalOperator pTopologicalOperator = pointCollectionNewFeature.Point[i] as IGeometry as ITopologicalOperator;
IGeometry pGeometryPointBuffer = pTopologicalOperator.Buffer(0.001);
ISpatialFilter spatialFilter0 = Utils.FilterUtils.SpatialFilter(pGeometryPointBuffer, esriSpatialRelEnum.esriSpatialRelIntersects);
featureCursor0 = featureClass.Update(spatialFilter0, false);
IFeature adjoinFeature = featureCursor0.NextFeature();
while (adjoinFeature != null)
{
IPointCollection pointCollectionAdjoinFeature = adjoinFeature.Shape as IPointCollection;
IPointCollection pointCollectionAdjoinFeatureCpoy = adjoinFeature.ShapeCopy as IPointCollection;
int count = ;
for (int k = ; k < pointCollectionAdjoinFeature.PointCount - ; k++)
{
if (Math.Abs(pointCollectionAdjoinFeature.Point[k].X - pointCollectionNewFeature.Point[i].X) < 0.001 && Math.Abs(pointCollectionAdjoinFeature.Point[k].Y - pointCollectionNewFeature.Point[i].Y) < 0.001)
{
count++;
break;
}
}
if (count == )
{
for (int j = ; j < pointCollectionAdjoinFeatureCpoy.PointCount - ; j++)
{
if(IsPointOnSegment(pointCollectionNewFeature.Point[i], pointCollectionAdjoinFeatureCpoy.Point[j], pointCollectionAdjoinFeatureCpoy.Point[j + ]))
{
//before 在这个索引之前加
pointCollectionAdjoinFeature.AddPoint(pointCollectionNewFeature.Point[i], j + , Type.Missing);
break;
}
}
ITopologicalOperator topologicalOperator = adjoinFeature.Shape as ITopologicalOperator;
topologicalOperator.Simplify();
featureCursor0.UpdateFeature(adjoinFeature);
featureCursor0.Flush();
}
adjoinFeature = featureCursor0.NextFeature();
}
}
newFeature = newFeatureCursor.NextFeature();
}
}
catch (Exception exp)
{
throw new Exception("添加公共节点时发生错误!" + "\r\n" + exp.Message + "\r\n" + exp.StackTrace);
}
}

ArcGis相接面补节点c#的更多相关文章

  1. 使用geoserver发布arcgis切片

    arcgis map 版本:10.1,10.2,10.3均可 jre:7或者8 geoserver:2.8.2以上 切片:松散型,256*256  ,png 1:安装geoserver并独立部署geo ...

  2. ArcGIS多面体(multipatch)解析(一)

    从几何学的角度来说,再复杂的三维形状都可以通过足够多,足够小的三角形组合起来表达.比如矩形可以表达成两个三角形,如下图: 圆柱形可以由多个三角形排列而成: 但ArcGIS中的多面体构成并没有采用这种“ ...

  3. 一例Ext4文件系统fsck后损坏的修复过程

    1.故障发生背景 Ext4文件系统没有umount下来,之后做了fsck操作检查一致性,结果导致Ext4文件mount不上(有时也会表现为导致目录变成了文件). 报错提示信息:mount: wrong ...

  4. CodeForces 1228F One Node is Gone

    洛谷题目页面传送门 & CodeForces题目页面传送门 给定一棵树\(T=(V,E),|V|=2^n-2,|E|=2^n-3\),输出所有的\(x\),使得存在一棵满二叉树\(T'\),将 ...

  5. LeetCode python实现题解(持续更新)

    目录 LeetCode Python实现算法简介 0001 两数之和 0002 两数相加 0003 无重复字符的最长子串 0004 寻找两个有序数组的中位数 0005 最长回文子串 0006 Z字型变 ...

  6. Redis如何实现多可用区?

    在如今的业务场景下,高可用性要求越来越高,核心业务跨可用区已然成为标配.腾讯云数据库高级工程师刘家文结合腾讯云数据库的内核实战经验,给大家分享Redis是如何实现多可用区,内容包含Redis主从版.集 ...

  7. 软件安装配置笔记(三)——ArcGIS系列产品安装与配置(补档)(附数据库连接及数据导入)

    在前两篇安装配置笔记之后,就忘记把其他安装配置笔记迁移过来了,真是失误失误!趁现在其他文档需要赶紧补上. 目录: 一.ArcMap 二.ArcMap连接数据库并导入数据 三.Arcgis Pro 四. ...

  8. ArcGIS Mobile 自定义图层在绘制面时节点未绘制完全的问题

    ArcGIS Mobile 自定义图层在绘制面时节点未绘制完全,如下图: 面的绘制代码如下: public void Draw(Display dis, Pen p1, Pen p2,Pen p3 , ...

  9. ArcGis基础——相接面制造指定距离的分隔带

    回家,出发前夜,看完电影吃晚饭回到住处已近十一点,和同事扯了一会儿淡,正准备去睡觉,这哥们儿突然想起一个问题: 如何把相接的面搞出一个20cm的分隔带?因为两区划定项目数据质检要求不同的地块图斑间应有 ...

随机推荐

  1. python 包管理工具 pip 的配置

    近几年来,python的包管理系统pip 越来越完善, 尤其是对于 windows场景下,pip大大改善了python的易用性. https://www.cnblogs.com/yvivid/p/pi ...

  2. CF1215D

    CF1215D 两个整数的和是偶数,他们的差也是偶数 博弈好难啊qaq 我好zz啊qaq 如果M放最后一个M胜 现在和比较大的一边如果空位还多的话M胜 M可以通过在大的那边放9来消掉那边所有的空 由于 ...

  3. USACO Wifi Setup /// 贪心

    题目大意: 若在x处防止一个覆盖范围为r的wifi基站 可以覆盖 x-r 到 x+r 范围 花费为 A+B*r 给定n 给定n个奶牛的位置 求覆盖所有奶牛的最小费用 (可设置任意多个wifi基站) 贪 ...

  4. C语言printf函数

    #include<stdio.h> //int float double short char long int main() { //int printf(const char *for ...

  5. 微信小程序の模板

    一.什么是模板 模板顾名思义就是可以复用的代码块.减少编码工作量. 二.例子 <template name="templateTest"> <view>th ...

  6. Centos7上MariaDB数据库启动问题解决

    安装MariaDB数据库后出现服务启动失败问题, 解决办法:卸载再安装!(确定无3306端口占用) 一.卸载数据库: [root@localhost logs]# yum -y remove mari ...

  7. nginx proxy_pass设置

    NGINX服务器的反向代理PROXY_PASS配置方法讲解 https://www.cnblogs.com/lianxuan1768/p/8383804.html Nginx配置proxy_pass转 ...

  8. View Triggers Function Procedure

    check view total number select count(VIEW_NAME) from USER_VIEWS; check trigger total number select C ...

  9. 【Luogu】【关卡2-8】广度优先搜索(2017年10月)

    任务说明:广度优先搜索可以用来找有关“最短步数”的问题.恩,也可以用来“地毯式搜索”.

  10. AtomicInteger 、Synchronized 和 volatile 之间的区别?

    AtomicInteger:无锁的线程安全整数??? Synchronized:同步 volatile:挥发性??? 参考文档: