您的位置:首页 > 运维架构

ITopologicalOperator Intersect

2010-08-19 10:10 260 查看
/// <summary>
/// 判断2个几何图形是否相交
/// </summary>
/// <param name="oneGeometry"></param>
/// <param name="otherGeometry"></param>
/// <returns></returns>
public bool Intersect(IGeometry oneGeometry, IGeometry otherGeometry)
{
try
{
ISpatialReferenceFactory3 pSRF = new SpatialReferenceEnvironmentClass();
ISpatialReference pSR = pSRF.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_Beijing1954);
pSR.SetDomain(-400, -400, 400, 400);

oneGeometry.SpatialReference = pSR;
otherGeometry.SpatialReference = pSR;

ITopologicalOperator iTopoOperator = (ITopologicalOperator)oneGeometry;

IGeometry outGeometry = iTopoOperator.Intersect(otherGeometry, esriGeometryDimension.esriGeometryNoDimension);
if (!outGeometry.IsEmpty)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: