1.ArcGis幾何圖形之幾何計算
阿新 • • 發佈:2017-07-23
nal contain pre true 包含 geo summary relation sta
1 /// <summary> 2 /// 檢測幾何圖形A是否包含幾何圖形B 3 /// </summary> 4 /// <param name="pGeometryA">幾何圖形A</param> 5 /// <param name="pGeometryB">幾何圖形B</param> 6 /// <returns>True為包含,False為不包含</returns> 7 public staticbool CheckGeometryContain(IGeometry pGeometryA, IGeometry pGeometryB) 8 { 9 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 10 if (pRelOperator.Contains(pGeometryB)) 11 { 12 return true; 13 } 14 else15 { 16 return false; 17 } 18 } 19 20 /// <summary> 21 /// 用於檢測幾何圖形A,幾何圖形B幾何圖形是否相交 22 /// </summary> 23 /// <param name="pGeometryA">幾何圖形A</param> 24 /// <param name="pGeometryB">幾何圖形B</param>25 /// <returns>True為相交,False為不相交</returns> 26 public static bool CheckGeometryCrosses(IGeometry pGeometryA, IGeometry pGeometryB) 27 { 28 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 29 if (pRelOperator.Crosses(pGeometryB)) 30 { 31 return true; 32 } 33 else 34 { 35 return false; 36 } 37 } 38 /// <summary> 39 /// 用於檢測幾何圖形A,幾何圖形B幾何圖形是否相連 40 /// </summary> 41 /// <param name="pGeometryA">幾何圖形A</param> 42 /// <param name="pGeometryB">幾何圖形B</param> 43 /// <returns>True為相連,False為不相連</returns> 44 public static bool CheckGeometryTouches(IGeometry pGeometryA, IGeometry pGeometryB) 45 { 46 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 47 if (pRelOperator.Touches(pGeometryB)) 48 { 49 return true; 50 } 51 else 52 { 53 return false; 54 } 55 } 56 /// <summary> 57 /// 用於檢測幾何圖形A,幾何圖形B幾何圖形是否不相交 58 /// </summary> 59 /// <param name="pGeometryA">幾何圖形A</param> 60 /// <param name="pGeometryB">幾何圖形B</param> 61 /// <returns>True為不相交,False為相交</returns> 62 public static bool CheckGeometryDisjoint(IGeometry pGeometryA, IGeometry pGeometryB) 63 { 64 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 65 if (pRelOperator.Disjoint(pGeometryB)) 66 { 67 return true; 68 } 69 else 70 { 71 return false; 72 } 73 } 74 /// <summary> 75 /// 用於檢測幾何圖形A,幾何圖形B幾何圖形是否有重疊 76 /// </summary> 77 /// <param name="pGeometryA">幾何圖形A</param> 78 /// <param name="pGeometryB">幾何圖形B</param> 79 /// <returns>True為有重疊,False為無重疊</returns> 80 public static bool CheckGeometryOverlaps(IGeometry pGeometryA, IGeometry pGeometryB) 81 { 82 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 83 if (pRelOperator.Overlaps(pGeometryB)) 84 { 85 return true; 86 } 87 else 88 { 89 return false; 90 } 91 } 92 /// <summary> 93 /// 用於檢測幾何圖形A是否被包含於幾何圖形B幾何圖形 94 /// </summary> 95 /// <param name="pGeometryA">幾何圖形A</param> 96 /// <param name="pGeometryB">幾何圖形B</param> 97 /// <returns>True為包含,False為不包含</returns> 98 public static bool CheckGeometryWithin(IGeometry pGeometryA, IGeometry pGeometryB) 99 { 100 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator; 101 if (pRelOperator.Within(pGeometryB)) 102 { 103 return true; 104 } 105 else 106 { 107 return false; 108 } 109 }
1.ArcGis幾何圖形之幾何計算