IsSimple与IsKnownSimple

来源:互联网 发布:ubuntu amd驱动 编辑:程序博客网 时间:2024/06/10 09:59
第一次阅读总是忽略很多细节,当你明白怎么回事后再去读这段文字时发现原来已经说得很清楚了,下面就是一个例子:
ITopologicalOperator::IsSimple
Indicates whether this geometry is known (or assumed) to be topologically correct, after explicitly determining this if the geometry is not already known (or assumed) to be simple.
表示几何对象是否被认为(或假设)是拓扑正确的,进行显式判定如果几何对象不被认为(或假设)是简单的。

ITopologicalOperator2::put_IsKnownSimple

Indicates whether this geometry is known (or assumed) to be topologically correct.

表示几何对象是否被认为或假设是拓扑正确的。

Returns TRUE when the geometry is aware that it is Simple.  IsKnownSimple may return FALSE even if the geometry is simple as long as the geometry is not aware of its IsSimple state.  Calling either IsSimple or Simplify makes the IsSimple state known to the geometry.  Topologically altering the geometry makes the IsKnownSimple state FALSE until the IsSimple state is again checked.
返回TRUE如果几何对象知道是简单的。只要它不知道它的IsSimple状态,即便它是几何简单的,IsKnownSimple也可以返回FALSE。调用IsSimple或Simplify使几何对象知道IsSimple状态。几何对象的拓扑变化使得IsKnownSimple状态为FALSE直到IsSimple状态被再次检查。
而且在以下几种情况下,IsKnownSimple为TRUE
1、几何对象直接来自要素类(A geometry coming directly from a feature class)
2、空的几何对象
3、ITopologicalOperator接口方法的输出几何对象(Output geometry of any method on ITopologicalOperator)

大多数情况下我们会注意到IsSimple方法会影响IsKnownSimple,但是不会注意IsKnownSimple也会影响IsSimple方法。IsSimple方法说得很明白,如果几何对象知道自己是拓扑正确的,那么直接返回结果,否则就进行显式判定。根据什么来判断是否已经知道自己是拓扑正确的呢,IsKnownSimple方法,通过该方法了解几何对象是否知道自己的IsSimple状态。
        但是有些情况下,IsKnownSimple返回TRUE,但是几何对象的却拓扑不正确,因为IsKnownSimple为TRUE,所以IsSimple也不去做判定,这样一来IsSimple即便拓扑不正确也会返回TRUE。最常见的例子就是从Personal Geodatabase中读出来Feature的Geometry,因为PGDB保存时不检查拓扑是否正确,而直接从FeatureClass读出来Geometry,IsKnownSimple肯定为TRUE。还有Shapefile也有这样的问题,直接用IsSimple根本判断不出来是否拓扑正确。解决办法也非常简单调用IsSimple前把IsKnownSimple置为FALSE,强制它进行拓扑正确的判定。
       我是在ESRI的论坛上看到这个解决办法的,知道这个解决办法后回头再去看文档时,发现里面也提到了一星半点的只是我没有注意到而已。
原创粉丝点击