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 static bool CheckGeometryContain(IGeometry pGeometryA, IGeometry pGeometryB)
8 {
9 IRelationalOperator pRelOperator = pGeometryA as IRelationalOperator;
10 if (pRelOperator.Contains(pGeometryB))
11 {
12 return true;
13 }
14 else
15 {
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 }