判断要素位置关系
作者:互联网
public static bool DKContains(this IGeometry geometry1, IGeometry geometry2)
{
//使用IRelationalOperator的方法来判断空间位置关系
IRelationalOperator pRelOperator = geometry1 as IRelationalOperator;
if (!pRelOperator.Touches(geometry2) && !pRelOperator.Disjoint(geometry2))
{
return true;
}
else
{
return false;
}
}
public static bool Touches(this IGeometry geometry1, IGeometry geometry2)
{
//使用IRelationalOperator的方法来判断空间位置关系
IRelationalOperator pRelOperator = geometry1 as IRelationalOperator;
if (pRelOperator.Touches(geometry2))
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 判断前者是否在后者内部
/// </summary>
/// <param name="geo1"></param>
/// <param name="geo2"></param>
/// <returns></returns>
public static bool Within(this IGeometry geo1, IGeometry geo2)
{
//使用IRelationalOperator的方法来判断空间位置关系
IRelationalOperator pRelOperator = geo1 as IRelationalOperator;
return pRelOperator.Within(geo2);
}
标签:要素,判断,return,IGeometry,pRelOperator,位置,geometry1,IRelationalOperator,geometry2 来源: https://www.cnblogs.com/wzyong/p/16066462.html