@dra2020/baseclient 1.0.94 → 1.0.96
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 +42 -21
- package/dist/baseclient.js.map +1 -1
- package/lib/geo/geo.ts +41 -18
- package/package.json +1 -1
package/lib/geo/geo.ts
CHANGED
|
@@ -297,24 +297,29 @@ export class GeoMultiCollection
|
|
|
297
297
|
// Add the "all" collection from the passed in multi, but do not force compute of any things not computed yet.
|
|
298
298
|
addAll(tag: string, multi: GeoMultiCollection): void
|
|
299
299
|
{
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
if (multi == null || Util.isEmpty(multi.entries))
|
|
301
|
+
this.remove(tag);
|
|
302
|
+
else
|
|
302
303
|
{
|
|
303
|
-
|
|
304
|
-
if (
|
|
304
|
+
let nEntries = Util.countKeys(multi.entries);
|
|
305
|
+
if (nEntries)
|
|
305
306
|
{
|
|
306
|
-
//
|
|
307
|
-
if (
|
|
308
|
-
multi.allCol();
|
|
309
|
-
else
|
|
307
|
+
// Make sure all collection is created
|
|
308
|
+
if (!multi.all.topo && !multi.all.col && !multi.all.map)
|
|
310
309
|
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
// Create cheapest one (collection if I need to create, otherwise copy from single entry)
|
|
311
|
+
if (nEntries > 1)
|
|
312
|
+
multi.allCol();
|
|
313
|
+
else
|
|
314
|
+
{
|
|
315
|
+
let e = multi.nthEntry(0);
|
|
316
|
+
multi.all.topo = e.topo;
|
|
317
|
+
multi.all.col = e.col;
|
|
318
|
+
multi.all.map = e.map;
|
|
319
|
+
}
|
|
315
320
|
}
|
|
321
|
+
this.add(tag, multi.all.topo, multi.all.col, multi.all.map);
|
|
316
322
|
}
|
|
317
|
-
this.add(tag, multi.all.topo, multi.all.col, multi.all.map);
|
|
318
323
|
}
|
|
319
324
|
}
|
|
320
325
|
|
|
@@ -398,7 +403,12 @@ export class GeoMultiCollection
|
|
|
398
403
|
// optimise case where one entry
|
|
399
404
|
let n = this.nEntries;
|
|
400
405
|
if (n == 1)
|
|
401
|
-
|
|
406
|
+
{
|
|
407
|
+
let e = this.nthEntry(0);
|
|
408
|
+
this.all.col = this._col(e);
|
|
409
|
+
this.all.topo = this.all.topo || e.topo;
|
|
410
|
+
this.all.map = this.all.map || e.map;
|
|
411
|
+
}
|
|
402
412
|
else
|
|
403
413
|
{
|
|
404
414
|
// Going from map to collection guarantees that any duplicates are removed
|
|
@@ -422,7 +432,12 @@ export class GeoMultiCollection
|
|
|
422
432
|
// optimise case where one entry
|
|
423
433
|
let n = this.nEntries;
|
|
424
434
|
if (n == 1)
|
|
425
|
-
|
|
435
|
+
{
|
|
436
|
+
let e = this.nthEntry(0);
|
|
437
|
+
this.all.map = this._map(e);
|
|
438
|
+
this.all.topo = this.all.topo || e.topo;
|
|
439
|
+
this.all.col = this.all.col || e.col;
|
|
440
|
+
}
|
|
426
441
|
else
|
|
427
442
|
{
|
|
428
443
|
let map: GeoFeatureMap = {};
|
|
@@ -441,7 +456,12 @@ export class GeoMultiCollection
|
|
|
441
456
|
// optimise case where one entry
|
|
442
457
|
let n = this.nEntries;
|
|
443
458
|
if (n == 1)
|
|
444
|
-
|
|
459
|
+
{
|
|
460
|
+
let e = this.nthEntry(0);
|
|
461
|
+
this.all.topo = this._topo(e);
|
|
462
|
+
this.all.col = this.all.col || e.col;
|
|
463
|
+
this.all.map = this.all.map || e.map;
|
|
464
|
+
}
|
|
445
465
|
else
|
|
446
466
|
this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
447
467
|
}
|
|
@@ -555,9 +575,12 @@ export class GeoMultiCollection
|
|
|
555
575
|
forEach(cb: FeatureFunc): void
|
|
556
576
|
{
|
|
557
577
|
this.forEachEntry(e => {
|
|
558
|
-
let col = this._col(e);
|
|
559
578
|
if (e.col)
|
|
560
|
-
e.col.features.forEach(f => { if (this.hidden[f.properties.id]
|
|
579
|
+
e.col.features.forEach(f => { if (! this.hidden[f.properties.id]) cb(f) })
|
|
580
|
+
else if (e.topo)
|
|
581
|
+
Object.values(e.topo.objects).forEach((f: GeoFeature) => { if (! this.hidden[f.properties.id]) cb(f) });
|
|
582
|
+
else if (e.map)
|
|
583
|
+
Object.values(e.map).forEach(f => { if (! this.hidden[f.properties.id]) cb(f) });
|
|
561
584
|
});
|
|
562
585
|
}
|
|
563
586
|
|