ArcGis相接面补节点c#
相接(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#的更多相关文章
- 使用geoserver发布arcgis切片
arcgis map 版本:10.1,10.2,10.3均可 jre:7或者8 geoserver:2.8.2以上 切片:松散型,256*256 ,png 1:安装geoserver并独立部署geo ...
- ArcGIS多面体(multipatch)解析(一)
从几何学的角度来说,再复杂的三维形状都可以通过足够多,足够小的三角形组合起来表达.比如矩形可以表达成两个三角形,如下图: 圆柱形可以由多个三角形排列而成: 但ArcGIS中的多面体构成并没有采用这种“ ...
- 一例Ext4文件系统fsck后损坏的修复过程
1.故障发生背景 Ext4文件系统没有umount下来,之后做了fsck操作检查一致性,结果导致Ext4文件mount不上(有时也会表现为导致目录变成了文件). 报错提示信息:mount: wrong ...
- CodeForces 1228F One Node is Gone
洛谷题目页面传送门 & CodeForces题目页面传送门 给定一棵树\(T=(V,E),|V|=2^n-2,|E|=2^n-3\),输出所有的\(x\),使得存在一棵满二叉树\(T'\),将 ...
- LeetCode python实现题解(持续更新)
目录 LeetCode Python实现算法简介 0001 两数之和 0002 两数相加 0003 无重复字符的最长子串 0004 寻找两个有序数组的中位数 0005 最长回文子串 0006 Z字型变 ...
- Redis如何实现多可用区?
在如今的业务场景下,高可用性要求越来越高,核心业务跨可用区已然成为标配.腾讯云数据库高级工程师刘家文结合腾讯云数据库的内核实战经验,给大家分享Redis是如何实现多可用区,内容包含Redis主从版.集 ...
- 软件安装配置笔记(三)——ArcGIS系列产品安装与配置(补档)(附数据库连接及数据导入)
在前两篇安装配置笔记之后,就忘记把其他安装配置笔记迁移过来了,真是失误失误!趁现在其他文档需要赶紧补上. 目录: 一.ArcMap 二.ArcMap连接数据库并导入数据 三.Arcgis Pro 四. ...
- ArcGIS Mobile 自定义图层在绘制面时节点未绘制完全的问题
ArcGIS Mobile 自定义图层在绘制面时节点未绘制完全,如下图: 面的绘制代码如下: public void Draw(Display dis, Pen p1, Pen p2,Pen p3 , ...
- ArcGis基础——相接面制造指定距离的分隔带
回家,出发前夜,看完电影吃晚饭回到住处已近十一点,和同事扯了一会儿淡,正准备去睡觉,这哥们儿突然想起一个问题: 如何把相接的面搞出一个20cm的分隔带?因为两区划定项目数据质检要求不同的地块图斑间应有 ...
随机推荐
- Java异常处理教程
异常是在没有定义正常执行路径时在Java程序的执行期间可能出现的条件.Java通过将执行操作的代码与处理错误的代码分离来处理错误. 当发生异常时,Java会创建一个包含有关异常的所有信息的对象,并将其 ...
- Zabbix Server 和 Zabbix Agentd 开机自动运行
Zabbix Server 和 Zabbix Agentd 开机自动运行 请问:怎样 Zabbix Server 和 Zabbix Agentd 开机自动运行? 注:如果你的命令行写进了 /etc/r ...
- ZABBIX 忘记登录密码
ZABBIX 忘记登录密码 摘要 有些童鞋会忘记zabbix的登陆密码,今天给大家写一篇找回登陆密码~ ZABBIX 忘记登录密码 zabbix 刚刚在群里吹牛逼,由于账号比较多,脑子容易 ...
- 查看hive版本号
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/sheismylife/article/details/33378243 hive没有提供hive - ...
- 移动端mintUI mt-datetime-picker 组件使用详解
<mt-datetime-picker v-model="pickerVisible" //绑定的数据值 ref="pickerData" // 点击触发 ...
- ArcGis基础——设置图层可选状态
在ArcMap的图层列表上右键,可以设置“仅本图层可选”. 那么,如何设置回多个或者全部图层可选状态呢? 1.在ArcMap的菜单栏找到 自定义——自定义模式——选择——设置可选图层. 2.将“设置可 ...
- JavaScript中的对象-创建对象的7种模式
文章来源:http://blog.csdn.net/u014346301/article/details/52204967 ECMA-262把对象定义为:”无需属性的集合,其属性可以包含基本值.对象或 ...
- Redis Desktop Manager连接Redis 遇到的一系列问题
最近在做一个土地项目的后台,主要是一个信息采集调查系统,使用的框架是: * 核心框架:Spring Framework 4.2 * 日志管理:SLF4J 1.7.Log4j 1.2 * 视图框架:Sp ...
- redis 发布订阅(pub/sub )
- ANdroid手机屏幕反横向等参数设定
经过我一番百度和看Android文档,我才发现,Android对旋转屏,特别是只有横屏或者竖屏虽重力旋转的支持是到Android4.3.1才有完美支持的 unspecified - 默认值,由系统选择 ...