File tree Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,21 @@ export class GeometryAnalysis extends Events {
71
71
const ugFeature2 = geojson2UGGeometry ( compareFeature ) ;
72
72
const result = this . module . _UGCWasm_Geometrist_IsIdentical ( ugFeature1 , ugFeature2 , tolerance ) ;
73
73
return result === 1 ;
74
+ }
75
+ /**
76
+ * @function GeometryAnalysis.prototype.hasIntersection
77
+ * @version 11.2.0
78
+ * @description 几何对象是否相交分析。
79
+ * @param {GeoJSONFeature } feature - geojson 要素。
80
+ * @param {GeoJSONFeature } compareFeature - geojson 对比要素。
81
+ * @param {number } [tolerance=1e-6] - 容限。
82
+ * @returns {boolean } 要素是否相交。
83
+ */
84
+ hasIntersection ( feature , compareFeature , tolerance = 1e-6 ) {
85
+ const ugFeature1 = geojson2UGGeometry ( feature ) ;
86
+ const ugFeature2 = geojson2UGGeometry ( compareFeature ) ;
87
+ const result = this . module . _UGCWasm_Geometrist_HasIntersection ( ugFeature1 , ugFeature2 , tolerance ) ;
88
+ return result === 1 ;
74
89
}
75
90
/**
76
91
* @function GeometryAnalysis.prototype.hasTouch
Original file line number Diff line number Diff line change @@ -58,6 +58,74 @@ describe('GeometryAnalysis', () => {
58
58
expect ( result ) . toBeTruthy ( ) ;
59
59
} ) ;
60
60
61
+ it ( 'hasIntersection' , ( ) => {
62
+ const poly1 = {
63
+ "type" : "Feature" ,
64
+ "properties" : { } ,
65
+ "geometry" : {
66
+ "coordinates" : [
67
+ [
68
+ [
69
+ 69.05078125000003 ,
70
+ 64.94452997268957
71
+ ] ,
72
+ [
73
+ 69.05078125000003 ,
74
+ 52.72637398699237
75
+ ] ,
76
+ [
77
+ 90.14453124999983 ,
78
+ 52.72637398699237
79
+ ] ,
80
+ [
81
+ 90.14453124999983 ,
82
+ 64.94452997268957
83
+ ] ,
84
+ [
85
+ 69.05078125000003 ,
86
+ 64.94452997268957
87
+ ]
88
+ ]
89
+ ] ,
90
+ "type" : "Polygon"
91
+ } ,
92
+ "id" : 0
93
+ } ;
94
+ const poly2 = {
95
+ "type" : "Feature" ,
96
+ "properties" : { } ,
97
+ "geometry" : {
98
+ "coordinates" : [
99
+ [
100
+ [
101
+ 80.87563161140378 ,
102
+ 57.45030784568206
103
+ ] ,
104
+ [
105
+ 80.87563161140378 ,
106
+ 43.6194265865916
107
+ ] ,
108
+ [
109
+ 110.40688161140469 ,
110
+ 43.6194265865916
111
+ ] ,
112
+ [
113
+ 110.40688161140469 ,
114
+ 57.45030784568206
115
+ ] ,
116
+ [
117
+ 80.87563161140378 ,
118
+ 57.45030784568206
119
+ ]
120
+ ]
121
+ ] ,
122
+ "type" : "Polygon"
123
+ }
124
+ } ;
125
+ const result = instance . hasIntersection ( poly1 , poly2 ) ;
126
+ expect ( result ) . toBeTruthy ( ) ;
127
+ } ) ;
128
+
61
129
62
130
it ( 'isIdentical multilinestring' , ( ) => {
63
131
const line1 = {
You can’t perform that action at this time.
0 commit comments