相接(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. sql语句(删除重复数据只保留一条)

    用SQL语句,删除掉重复项只保留一条 在几千条记录里,存在着些相同的记录,如何能用SQL语句,删除掉重复的呢 1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select ...

  2. Excel_PoweQuery——条件计数、条件求和

    岁月不居,时节如流. 时光荏苒,岁月如梭. 前面两段充分体现了博主深厚的文学素养,别和博主争,博主说啥就是啥. 其实,对于大量数据的处理,这几年微软Office做的不单单是2007的时候把Excel的 ...

  3. js中构造函数的原型添加成员的两种方式

    首先,js中给原型对象添加属性和方法. 方式一:对象的动态特效 给原型对象添加成员 语法:构造函数.prototype.方法名=function (){ } 方式二:替换原型对象(不是覆盖,而是替换, ...

  4. css3属性 -webkit-filter

    css3属性 -webkit-filter -webkit-filter是css3的一个属性,Webkit率先支持了这几个功能,感觉效果很不错.下面咱们就学习一下filter这个属性吧. 现在规范中支 ...

  5. 案例- CSS 三角加强

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Red5文件结构简介

    Red5文件结构简介 Red5 是 支持Windows,Linux等多平台的RTMP流媒体服务器,最早属于谷歌下的开源项目,先已移植到Github,地址为https://github.com/Red5 ...

  7. Java中date和calendar的用法

    获取现在系统的时间和日期看起来是一件非常神奇的事情,但是当使用date和calendar之后发现仍然非常神奇. 1.date 使用date日期之前需要导入包: import java.text.Sim ...

  8. word2vec 原理浅析 及高效训练方法

    1. https://www.cnblogs.com/cymx66688/p/11185824.html (word2vec中的CBOW 和skip-gram 模型 浅析) 2. https://ww ...

  9. bash命令根据历史记录补全

    用zsh比较方便的一个功能是在找之前用过的命令时可以先输入一部分命令作为过滤条件, 比如,想找 docker run 开头的历史命令,只需要键入 docker run 然后按 ↑ 进行选择. 但是在用 ...

  10. 通过list中值得名称查询索引号

    >>> a = ['www','iplaypython','com']>>> a.index('iplaypython')