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();
查看全文
相关阅读:
关于android中透明、半透明、百分比转换
详解 RestTemplate 操作
springboot No Identifier specified for entity的解决办法
Java-Spring-获取Request,Response对象
java 如何判断操作系统是Linux还是Windows
Spring中使用Ehcache的方法和注意事项
Protostuff序列化
如何使用apache自带的ab压力测试工具
java 调用 wsdl形式的webservice 示例
web service 异常
原文地址:https://www.cnblogs.com/renji/p/978029.html
最新文章
hdfs入门
深度学习----现今主流GAN原理总结及对比
PDFCrop裁剪PDF文档使用方法
平均精度均值(mAP)——目标检测模型性能统计量
latexdiff中的大坑:字符编码问题
VS2017 -error LNK1104: 无法打开文件“msvcprtd.lib”
VS Code 中的LaTeX自动保存问题
标量量化和矢量量化
VS 2017 VC++项目出现 LNK1104 无法打开文件"libcmtd.lib" 的解决方法
Win10卸载预装应用
热门文章
Windows10无法打开NVIDA控制面板
Android接听、挂断电话
Android 通过联系人姓名查询联系人号码
AnimationDrawable写贞动画,播放完毕停止在第一或最后一帧
实现textview竖排文字效果
客户端同步服务器端时间方案
从MediaStorehe和sd中删除媒体文件
多款Android播放器源码集锦
Android 按下home键,程序在后台运行,在设置中点击程序的启动时,会再次打开启动页的解决办法
Android widget中的一个TextView中的字体设置不同大小
Copyright © 2011-2022 走看看