相接(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. 数据库(一)—— MySQL介绍

    目录 MySQL介绍 一.MySQL版本 1.mysql主流版本 2.版本选择 二.MySQL连接与实例 1.MySQL的C/S结构 2.MySQL实例 三.mysql三层结构 1.连接层(连接上数据 ...

  2. Fedora LVM磁盘大小调整

    umount /dev/fedora/swap e2fsck -f /dev/fedora/swap

  3. Spring Boot 2.1.6 发布了!

    Java技术栈 www.javastack.cn 优秀的Java技术公众号 最新消息: Spring Boot 2.1.6 昨天正式发布了,日常更新一些依赖和修复一些 BUG,没什么硬菜! 重点来了, ...

  4. Spring Cloud配置中心内容加密

    从配置获取的配置默认是明文的,有些像数据源这样的配置需要加密的话,需要对配置中心进行加密处理. 下面使用对称性加密来加密配置,需要配置一个密钥,当然也可以使用RSA非对称性加密,但对称加密比较方便也够 ...

  5. Spring整合Hibernate报错:annotatedClasses is not writable or has an invalid setter method

    Spring 整合Hibernate时报错: org.springframework.beans.factory.BeanCreationException: Error creating bean ...

  6. WPF非UI线程访问网络资源造成页面假死现象

    公司内部一个项目是用WPF作为GUI 访问web接口的形式获取数据, 但是由于数据量比较大,也没做分页,于是就需要一个loading的控件,网上查了很多资料但都比较浅.这里完成需求后,总结一下. 首先 ...

  7. bat批处理----set

    转载自    https://www.cnblogs.com/Braveliu/p/5081084.html [1]set命令简介 set,设置. [2]set命令使用 1. 打印系统环境变量.set ...

  8. HTTP权威指南读书笔记——第一章(HTTP概述)

    1.HTTP(Hypertext Transfer Protocol,超文本传输协议)是在万维网上进行通信时所使用的协议方案,HTTP是应用层协议,无需关心网络通信的细节,细节交给了传输层协议TCP/ ...

  9. 安装APK到android设备那些事儿

    APK是AndroidPackage的缩写,即Android系统的应用软件安装包(apk).APK是类似Symbian Sis或Sisx的文件格式.通过将APK文件直接传到Android模拟器或And ...

  10. window下Mysql 恢复Delete删除的数据

    转载:https://www.cnblogs.com/q149072205/p/11940591.html 本机用的Navicat连mysql测试DB又连了正式DB,因为本地与正式要频繁操作所以都打开 ...