ArcEngine的拓扑分析之ITopologicalOperator
先来看看ITopologicalOperator的成员:截图来自帮助文档:
简要介绍下各个成员的汉语翻译:
1、Boundary,边界,获取一个Geometry的边界;
用法:
ITopologicalOperator pTopologBoundary = pGeo as ITopologicalOperator; IGeometry pGeometry = pTopologBoundary.Boundary;(1)多边形Polygon的边界获取的是Polyline
(2)Polyline获得的是IPiontColletion点集;(3)点没有边界
2、Buffer,缓冲区,可以为点、线、面做缓冲区,参数为缓冲区范围的大小,大于0向外做缓冲区,小于0向内做缓冲区;
用法:
ITopologicalOperator pTopologBoundary = pGeo as ITopologicalOperator; IGeometry pGeometry = pTopologBoundary.Buffer(2);
3、Clip,叠加裁剪,从源图层中裁剪掉分割图层后的图形;参数类型为IEnvelope类型
用法:
ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; pTopologBoundary.Clip(pClipGeometry.Envelope as IEnvelope);
4、Cut,分割,将一个Geometry分割为两部分。
用法:
IGeometry pSourceGeometry = null, pClipGeometry = null; IGeometry pLeftGeo,pRightGo; IPolyline pPolyline=null; ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; pTopologBoundary.Cut(pPolyline, out pLeftGeo, out pRightGo);
5、Difference,区别,保留下源图层与操作图层中不同的部分。
用法:
IGeometry pSourceGeometry = null, pDifGeometry = null; ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; IGeometry pResultGeo= pTopologBoundary.Difference(pDifGeometry);
6、Intersect,相交,求两个图层相交,返回IGeometry对象
用法:
ITopologicalOperator pTopological = (pSubFeature.Shape) as ITopologicalOperator; IGeometry pGeoIntersect=pTopological.Intersect(pFeature.Shape, esriGeometryDimension.esriGeometry2Dimension);
7、IsSimple,是否拓扑闭合
用法:
ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; bool bIsSimple = pTopologBoundary.IsSimple;8、Simplify,使一个Geometry拓扑闭合;
用法:
ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; pTopologBoundary.Simplify();
9、Union,使Geometry组合起来
用法:
<pre name="code" class="csharp">IGeometry pSourceGeometry = null, pUnionGeometry = null; ITopologicalOperator pTopologBoundary = pSourceGeometry as ITopologicalOperator; IGeometry pUnionGeo=pTopologBoundary.Union(pUnionGeometry);