@dra2020/baseclient 1.0.95 → 1.0.97
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 +29 -9
- package/dist/baseclient.js.map +1 -1
- package/lib/geo/geo.ts +27 -6
- package/package.json +1 -1
package/lib/geo/geo.ts
CHANGED
|
@@ -403,7 +403,12 @@ export class GeoMultiCollection
|
|
|
403
403
|
// optimise case where one entry
|
|
404
404
|
let n = this.nEntries;
|
|
405
405
|
if (n == 1)
|
|
406
|
-
|
|
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
|
+
}
|
|
407
412
|
else
|
|
408
413
|
{
|
|
409
414
|
// Going from map to collection guarantees that any duplicates are removed
|
|
@@ -427,12 +432,20 @@ export class GeoMultiCollection
|
|
|
427
432
|
// optimise case where one entry
|
|
428
433
|
let n = this.nEntries;
|
|
429
434
|
if (n == 1)
|
|
430
|
-
|
|
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
|
+
}
|
|
431
441
|
else
|
|
432
442
|
{
|
|
433
443
|
let map: GeoFeatureMap = {};
|
|
434
444
|
this.all.map = map;
|
|
435
|
-
this.
|
|
445
|
+
this.forEachEntry(e => {
|
|
446
|
+
let col = this._col(e); // this ensures we convert feature geometry from topo to polygon
|
|
447
|
+
col.features.forEach(f => { map[String(f.properties.id)] = f });
|
|
448
|
+
});
|
|
436
449
|
}
|
|
437
450
|
}
|
|
438
451
|
return this.all.map;
|
|
@@ -446,7 +459,12 @@ export class GeoMultiCollection
|
|
|
446
459
|
// optimise case where one entry
|
|
447
460
|
let n = this.nEntries;
|
|
448
461
|
if (n == 1)
|
|
449
|
-
|
|
462
|
+
{
|
|
463
|
+
let e = this.nthEntry(0);
|
|
464
|
+
this.all.topo = this._topo(e);
|
|
465
|
+
this.all.col = this.all.col || e.col;
|
|
466
|
+
this.all.map = this.all.map || e.map;
|
|
467
|
+
}
|
|
450
468
|
else
|
|
451
469
|
this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
452
470
|
}
|
|
@@ -560,9 +578,12 @@ export class GeoMultiCollection
|
|
|
560
578
|
forEach(cb: FeatureFunc): void
|
|
561
579
|
{
|
|
562
580
|
this.forEachEntry(e => {
|
|
563
|
-
let col = this._col(e);
|
|
564
581
|
if (e.col)
|
|
565
|
-
e.col.features.forEach(f => { if (this.hidden[f.properties.id]
|
|
582
|
+
e.col.features.forEach(f => { if (! this.hidden[f.properties.id]) cb(f) })
|
|
583
|
+
else if (e.topo)
|
|
584
|
+
Object.values(e.topo.objects).forEach((f: GeoFeature) => { if (! this.hidden[f.properties.id]) cb(f) });
|
|
585
|
+
else if (e.map)
|
|
586
|
+
Object.values(e.map).forEach(f => { if (! this.hidden[f.properties.id]) cb(f) });
|
|
566
587
|
});
|
|
567
588
|
}
|
|
568
589
|
|