相接(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. 时间同步服务器NTP

    NTP服务器        NTP(Network Time Protocol)[网络时间协议],它是用来同步网络中各个计算机的时间的协议,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒, ...

  2. Springboot+mybatis+dbcp+mysql简单集成

    1.添加依赖 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>m ...

  3. webservice的使用-axis1-01

    1.搭建axis服务器 1.1 下载axis-bin-1_4.zip文件并解压 1.2 拷贝\axis-1_4\webapps目录下的axis到tomcat目录下的webapps目录下并启动 1.3 ...

  4. 利用单选框的单选特性作tab切换

    <RadioGroup v-model="selectType" type="button" @onchange="selectTypeChan ...

  5. .sync 修饰符的理解

    正常 子组件: this.$emit('update:title', newTitle) 父组件: <text-document v-bind:title="doc.title&quo ...

  6. ReentrantLock的相关方法使用

    获取锁定 void lock():常用获取锁定的方法 void lockInterruptibly():如果当前线程未被中断,则获取锁定:如果当前线程被中断,则出现异常 boolean tryLock ...

  7. display: flex属性介绍

    参考文章: 阮大神的:Flexbox 布局的最简单表单(主要讲解项目item上的属性) 另一位大神的:布局神器display:flex(整体讲解的非常详细) 之前没有仔细看flex布局(弹性布局),设 ...

  8. Leetcode 200.岛屿的数量 - DFS、BFS

    Leetcode 200 岛屿的数量: DFS利用函数调用栈保证了检索顺序, BFS则需要自己建立队列,把待检索对象按规则入队. class Solution { // DFS解法,8ms/10.7M ...

  9. [python3]未配置locale的主机出现UnicodeDecodeError: 'ascii' codec can't decode byte 0x....的解决

    之前写的发邮件的程序部署到vps的时候出现了 UnicodeDecodeError: 'ascii' codec can't decode byte 0x.... 的错误. 按理说UnicodeDec ...

  10. Eclipse如何设置jsp文件默认UTF-8格式编码

    我使用的是Eclipse Jee Neon, Window->Preferences 具体设置如图所示: