zoukankan
html css js c++ java
如何调用ITopologicalOperator.Union方法成功地merge polygon
为什么题目要加个“成功地”,因为
ITopologicalOperator
的方法是bug非常多的,在90%的情况下能够按照你预想的工作,但是在10%的情况下,既不报错也不工作。这个merge的操作,成功地折磨了我两天。终于找到了解决的方法。
ICursor pCursor;
featureSelect.SelectionSet.Search(
null
,
false
,
out
pCursor);
IFeatureCursor pFeatureCursor
=
pCursor
as
IFeatureCursor;
IFeature pFeatureFirst
=
pFeatureCursor.NextFeature();
//
开始一个编辑操作,以能够撤销
m_EditWorkspace.StartEditOperation();
IGeometry pGeometryFirst
=
pFeatureFirst.Shape;
ITopologicalOperator2 topo_oper
=
(ITopologicalOperator2)pGeometryFirst;
//
ITopologicalOperator的操作是bug很多的,先强制的检查下面三个步骤,再进行操作
//
成功的可能性大一些
topo_oper.IsKnownSimple_2
=
false
;
topo_oper.Simplify();
pGeometryFirst.SnapToSpatialReference();
//
这是准备合并的图斑使用的
ITopologicalOperator2 topo_oper2;
IGeometry pGeometryNext;
IFeature pFeatureNext
=
pFeatureCursor.NextFeature();
while
(pFeatureNext
!=
null
)
{
pGeometryNext
=
pFeatureNext.ShapeCopy;
//
与上面的同理
topo_oper2
=
pGeometryNext
as
ITopologicalOperator2;
topo_oper2.IsKnownSimple_2
=
false
;
topo_oper2.Simplify();
pGeometryNext.SnapToSpatialReference();
//
这才是合并图斑的关键
pGeometryFirst
=
topo_oper.Union(pGeometryNext);
pFeatureNext.Delete();
pFeatureNext
=
pFeatureCursor.NextFeature();
}
topo_oper.IsKnownSimple_2
=
false
;
topo_oper.Simplify();
pFeatureFirst.Shape
=
pGeometryFirst;
pFeatureFirst.Store();
m_EditWorkspace.StopEditOperation();
查看全文
相关阅读:
mongodb单机搭建
zeus部署
hive单机部署
datax部署
hadoop/hbase/hive单机扩增slave
读取Jar中的json文件
Mybatis 一对多 简单映射配置
java/kotlin 读取文件、写入文件
ES6中Json、String、Map、Object之间的转换
java 客户端发起http请求2
原文地址:https://www.cnblogs.com/renji/p/978029.html
最新文章
python 明明安装模块,却导入不了 no module name all
redhat系统6.5,rrdtool命令安装成功但是python无法导入rrdtool
HTTP协议进化之路
.NET、C#和.NET.Code之间的区别
堆(大顶堆,小顶堆),中序遍历,前序遍历,后续遍历序列
Bootstrap Table 选中当前行 click-row.bs.table 和 onClickRow ,支持单选,多选
Ajax请求成功但是一直进入error 之 序列化类型为“System.Reflection.RuntimeModule”的对象时检测到循环引用。解决方案
Bootstrap 使用技巧
前驱图
软考资料网址
热门文章
postman报InvalidArgumentException
Monkey 稳定性测试
使用Fiddler模拟弱网络环境测试
python 请求测试环境的https接口地址报SSL错误验证,访问不了
码云(Gitee)帮助文件链接地址
springboot同时支持访问html5和jsp时,导致后台ResponseBody返回中文乱码
easyui tree选中指定节点,点击指定节点
java8 stream().map().collect()用法
mongodb性能优化
mongodb常用命令
Copyright © 2011-2022 走看看