Skip to content

Commit b05ebb0

Browse files
update ugc function
1 parent 07413e9 commit b05ebb0

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎src/common/util/Geometry.js‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,31 @@ export const GeometryUtil = {
3838
const result = Module._UGCWasm_Geometrist_IsIdentical(ugFeature1, ugFeature2, tolerance);
3939
return result === 1;
4040
},
41-
union(geojson1, geojson2, tolerance) {
41+
union(geojson1, geojson2) {
4242
const ugFeature1 = geojson2UGGeometry(geojson1);
4343
const ugFeature2 = geojson2UGGeometry(geojson2);
44-
const result = Module._UGCWasm_Geometrist_Union(ugFeature1, ugFeature2, tolerance);
44+
const result = Module._UGCWasm_Geometrist_Union(ugFeature1, ugFeature2);
4545
return {
4646
type: "Feature",
4747
geometry: ugGeometry2Geojson(result)
4848
};
4949
},
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) {
5160
const ugFeature1 = geojson2UGGeometry(geojson1);
5261
const ugFeature2 = geojson2UGGeometry(geojson2);
5362
const result = Module._UGCWasm_Geometrist_IsDisjointed(ugFeature1, ugFeature2, tolerance);
5463
return result === 1;
5564
},
56-
hasIntersection(geojson1, geojson2, tolerance) {
65+
hasIntersection(geojson1, geojson2, tolerance = 1e-6) {
5766
const ugFeature1 = geojson2UGGeometry(geojson1);
5867
const ugFeature2 = geojson2UGGeometry(geojson2);
5968
const result = Module._UGCWasm_Geometrist_HasIntersection(ugFeature1, ugFeature2, tolerance);
@@ -237,6 +246,11 @@ export const GeometryUtil = {
237246
const result = Module._UGCWasm_Geometrist_IsLeft(px, py, spx, spy, epx, epy);
238247
return result === 1;
239248
},
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+
// },
240254
computeGeodesicArea(geojson, prjCoordSys) {
241255
const ugFeature = geojson2UGGeometry(geojson);
242256
return Module._UGCWasm_Geometrist_ComputeGeodesicArea(ugFeature, prjCoordSys);

0 commit comments

Comments
 (0)