合并一个图层选择对象C# arcengine
2012-03-28 10:51
176 查看
ArcEngine实现Merge功能
private IGeometry GetGeo(IFeatureLayer pFlyr)
{
IEnumGeometry pGeos = new EnumFeatureGeometryClass();
IEnumGeometryBind pGeosBind = pGeos as IEnumGeometryBind;
IFeatureSelection pflyrSelection = pFlyr as IFeatureSelection;
pflyrSelection.SelectFeatures(null, esriSelectionResultEnum.esriSelectionResultNew, false); pGeosBind.BindGeometrySource(null, pflyrSelection.SelectionSet);
pGeos.Reset();
IPolygon sPoly = new PolygonClass();
ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
pTopo.ConstructUnion(pGeos);
pTopo.Simplify();
sPoly = pTopo as IPolygon;
pflyrSelection.Clear();
return sPoly;
}
执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos 里的图形个数为0,最后得到的spoly是空。
来自:http://program.ntwtsp.com/aspnet/18234.htm
private IGeometry GetGeo(IFeatureLayer pFlyr)
{
IEnumGeometry pGeos = new EnumFeatureGeometryClass();
IEnumGeometryBind pGeosBind = pGeos as IEnumGeometryBind;
IFeatureSelection pflyrSelection = pFlyr as IFeatureSelection;
pflyrSelection.SelectFeatures(null, esriSelectionResultEnum.esriSelectionResultNew, false); pGeosBind.BindGeometrySource(null, pflyrSelection.SelectionSet);
pGeos.Reset();
IPolygon sPoly = new PolygonClass();
ITopologicalOperator pTopo = sPoly as ITopologicalOperator;
pTopo.ConstructUnion(pGeos);
pTopo.Simplify();
sPoly = pTopo as IPolygon;
pflyrSelection.Clear();
return sPoly;
}
执行上面的代码段可以把图层上的所有实体合并。注意红色部分的那行代码,不写此行代码,pGeos 里的图形个数为0,最后得到的spoly是空。
来自:http://program.ntwtsp.com/aspnet/18234.htm
相关文章推荐
- C#将制定文件夹下的PDF文件合并成一个并输出至指定路径
- C#给JSON对象添加一个键值对
- unity lua C# 这边 new 了一个GameObject 对象并发给Lua那边, 这时C# 这边在通过GC释放掉这个对象;lua 那边会报错;遇到这种问题的解决方案
- C#这样给一个对象赋
- 3d Max中通过"附加(attach)"将多个对象合并为一个对象
- AE+C# 实现MERGE, AE实现相同结构图层的合并C#代码(转载)
- C#把多个Word文档合并成一个的方法
- C# 将一个对象转换为指定类型
- HQL多表联合查询,两个表的元素怎样组合并压入一个对象中
- c# 声明一个对象意味着什么
- 把C#程序(含多个Dll)合并成一个Exe的超简单方法
- C#将制定文件夹下的PDF文件合并成一个并输出至指定路径
- arcengine 经典代码(转) 空间查询 在一个图层上画一个polygon,根据该polygon查询出图层上与之相交的polygon并高亮显示出来
- C# 将多个Image 合成为一个,格式可选择
- MVC5中Model层开发数据注解 EF Code First Migrations数据库迁移 C# 常用对象的的修饰符 C# 静态构造函数 MSSQL2005数据库自动备份问题(到同一个局域网上的另一台电脑上) MVC 的HTTP请求
- [C#] 如何选择一个目录
- C#给JSON对象添加一个键值对
- 把C#程序(含多个Dll)合并成一个Exe的超简单方法
- C#+AE(ArcEngine)二次开发:通过点击选择面状要素并计算其面积
- 发布一个C#+ADOMD.NET实现查看分析服务数据库信息的类对象