@dra2020/baseclient 1.0.155 → 1.0.157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/baseclient.js +41 -6
- package/dist/baseclient.js.map +1 -1
- package/lib/poly/union.ts +19 -6
- package/lib/util/util.ts +29 -0
- package/package.json +1 -1
package/lib/poly/union.ts
CHANGED
|
@@ -49,9 +49,16 @@ export function polyIntersects(p1: any, p2: any): boolean
|
|
|
49
49
|
if (iRing2 == 0)
|
|
50
50
|
{
|
|
51
51
|
let c2 = unpackCoords(buffer2, iOffset2, nPoints2);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
try
|
|
53
|
+
{
|
|
54
|
+
let result = _intersection(c1, c2);
|
|
55
|
+
if (result && result.length > 0)
|
|
56
|
+
bIntersects = true;
|
|
57
|
+
}
|
|
58
|
+
catch (err)
|
|
59
|
+
{
|
|
60
|
+
// Ignore, treat badly formed as non-intersecting
|
|
61
|
+
}
|
|
55
62
|
}
|
|
56
63
|
});
|
|
57
64
|
}
|
|
@@ -69,9 +76,15 @@ export function polyIntersectArea(p1: any, p2: any): number
|
|
|
69
76
|
let c1 = unpackCoords(buffer1, iOffset1, nPoints1);
|
|
70
77
|
PP.polyPackEachRing(pp2, (buffer2: Float64Array, iPoly2: number, iRing2: number, iOffset2: number, nPoints2: number) => {
|
|
71
78
|
let c2 = unpackCoords(buffer2, iOffset2, nPoints2);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
try
|
|
80
|
+
{
|
|
81
|
+
let result = _intersection(c1, c2);
|
|
82
|
+
if (result && result.length > 0)
|
|
83
|
+
area += Poly.polyArea(result) * ((!iRing1 == !iRing2) ? 1 : -1);
|
|
84
|
+
}
|
|
85
|
+
catch (err)
|
|
86
|
+
{
|
|
87
|
+
}
|
|
75
88
|
});
|
|
76
89
|
});
|
|
77
90
|
return area;
|
package/lib/util/util.ts
CHANGED
|
@@ -310,6 +310,35 @@ export function deepEqual(o1: any, o2: any, options?: EqOptions): boolean
|
|
|
310
310
|
if (typeof o1 !== 'object' || o1 == null) return false;
|
|
311
311
|
if (typeof o2 !== 'object' || o2 == null) return false;
|
|
312
312
|
|
|
313
|
+
// Special case Set
|
|
314
|
+
if (o1 instanceof Set && o2 instanceof Set)
|
|
315
|
+
{
|
|
316
|
+
if (o1.size !== o2.size) return false;
|
|
317
|
+
let eq = true;
|
|
318
|
+
o1.forEach((k: any) => { if (! o2.has(k)) eq = false });
|
|
319
|
+
return eq;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Special case Map
|
|
323
|
+
if (o1 instanceof Map && o2 instanceof Map)
|
|
324
|
+
{
|
|
325
|
+
if (o1.size !== o2.size) return false;
|
|
326
|
+
let eq = true;
|
|
327
|
+
o1.forEach((v1: any, k1: any) => {
|
|
328
|
+
if (eq)
|
|
329
|
+
{
|
|
330
|
+
if (! o2.has(k1))
|
|
331
|
+
eq = false;
|
|
332
|
+
else
|
|
333
|
+
{
|
|
334
|
+
let v2 = o2.get(k1);
|
|
335
|
+
eq = deepEqual(v1, v2, options);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
return eq;
|
|
340
|
+
}
|
|
341
|
+
|
|
313
342
|
// Special case array
|
|
314
343
|
if (Array.isArray(o1))
|
|
315
344
|
{
|