@@ -38,22 +38,31 @@ export const GeometryUtil = {
38
38
const result = Module . _UGCWasm_Geometrist_IsIdentical ( ugFeature1 , ugFeature2 , tolerance ) ;
39
39
return result === 1 ;
40
40
} ,
41
- union ( geojson1 , geojson2 , tolerance ) {
41
+ union ( geojson1 , geojson2 ) {
42
42
const ugFeature1 = geojson2UGGeometry ( geojson1 ) ;
43
43
const ugFeature2 = geojson2UGGeometry ( geojson2 ) ;
44
- const result = Module . _UGCWasm_Geometrist_Union ( ugFeature1 , ugFeature2 , tolerance ) ;
44
+ const result = Module . _UGCWasm_Geometrist_Union ( ugFeature1 , ugFeature2 ) ;
45
45
return {
46
46
type : "Feature" ,
47
47
geometry : ugGeometry2Geojson ( result )
48
48
} ;
49
49
} ,
50
- isDisjointed ( geojson1 , geojson2 , tolerance ) {
50
+ union2 ( geojson1 , geojson2 , tolerance ) {
51
+ const ugFeature1 = geojson2UGGeometry ( geojson1 ) ;
52
+ const ugFeature2 = geojson2UGGeometry ( geojson2 ) ;
53
+ const result = Module . _UGCWasm_Geometrist_Union2 ( ugFeature1 , ugFeature2 , tolerance ) ;
54
+ return {
55
+ type : "Feature" ,
56
+ geometry : ugGeometry2Geojson ( result )
57
+ } ;
58
+ } ,
59
+ isDisjointed ( geojson1 , geojson2 , tolerance = 1e-6 ) {
51
60
const ugFeature1 = geojson2UGGeometry ( geojson1 ) ;
52
61
const ugFeature2 = geojson2UGGeometry ( geojson2 ) ;
53
62
const result = Module . _UGCWasm_Geometrist_IsDisjointed ( ugFeature1 , ugFeature2 , tolerance ) ;
54
63
return result === 1 ;
55
64
} ,
56
- hasIntersection ( geojson1 , geojson2 , tolerance ) {
65
+ hasIntersection ( geojson1 , geojson2 , tolerance = 1e-6 ) {
57
66
const ugFeature1 = geojson2UGGeometry ( geojson1 ) ;
58
67
const ugFeature2 = geojson2UGGeometry ( geojson2 ) ;
59
68
const result = Module . _UGCWasm_Geometrist_HasIntersection ( ugFeature1 , ugFeature2 , tolerance ) ;
@@ -237,6 +246,11 @@ export const GeometryUtil = {
237
246
const result = Module . _UGCWasm_Geometrist_IsLeft ( px , py , spx , spy , epx , epy ) ;
238
247
return result === 1 ;
239
248
} ,
249
+ // computeGeodesicArea(geojson, epsgCode) {
250
+ // const ugFeature = geojson2UGGeometry(geojson);
251
+ // const prjCoordSys = Module._UGCWasm_Geometry_NewUGPrjCoordSys(epsgCode);
252
+ // return Module._UGCWasm_Geometrist_ComputeGeodesicArea(ugFeature, prjCoordSys);
253
+ // },
240
254
computeGeodesicArea ( geojson , prjCoordSys ) {
241
255
const ugFeature = geojson2UGGeometry ( geojson ) ;
242
256
return Module . _UGCWasm_Geometrist_ComputeGeodesicArea ( ugFeature , prjCoordSys ) ;
0 commit comments