裁切后得到有宽度环的类型确定

问题:

使用ITopologicalOperator.SymmetricDifference()对相互覆盖的两个面A和B(A>B)进行拓扑运算,得到一个有宽度的环C(如下图所示)。但是

(1)C的几何类型不知如何确定。

(2)由于(1)的不确定导致不知该用什么类型的集合管理环C这种类型对象。使用ITopologicalOperator.SymmetricDifference()得到的是一个IGeometry类型的对象K,但使用IGeometryCollection pGeoCollection = new PolygonClass()集合无法加载这个IGeometry类型的对象K(参数类型错误)。

解决思路:

(1)这个有宽度的环C类型应为面即IPolygon。

(2)当使用PolygonClass实现的IGeometryCollection 去加载要素时,要素对象应为IRing类型(在arcgis的在线帮助文档中有如下介绍Use the IGeometryCollection and ISegmentCollection interfaces to access rings and segments directly.)所以加载对象K时会报错(K为更高层次的IPolygon)。如果非要用IGeometryCollection 去加载,则需使用其AddGeometryCollection(IPolygon as IGeometryCollection)方法,但这样会导致将对象K拆散为两个环,从而丢失K这个整体。最后使用 List<IPolygon> polygonList = new List<IPolygon>()进行管理,可以满足需求。

原文地址:https://www.cnblogs.com/lettet/p/4562878.html