ITopologicalOperator Intersect

简介:

   /// <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;
            }
        }

分类:  ESRI

本文转自Lei Zhang的博客博客园博客,原文链接:http://www.cnblogs.com/threestone/archive/2010/08/19/1803174.html,如需转载请自行联系原作者
目录
相关文章
|
1月前
|
SQL
UNION
【11月更文挑战第08天】
25 2
|
4月前
|
SQL 存储 关系型数据库
|
算法 Java 计算机视觉
IoU(Intersection-over-Union)
交并比 (intersection over union)即为两个区域的交集与并集的比值。
231 0
Distinct
SQL 去重
157 0
|
关系型数据库 MySQL 数据库
数据库并集union、交集intersect、差集except
数据库并集union、交集intersect、差集except 6
342 0
数据库并集union、交集intersect、差集except