@dra2020/baseclient 1.0.95 → 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/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
- this.all.col = this._col(this.nthEntry(0));
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,7 +432,12 @@ export class GeoMultiCollection
427
432
  // optimise case where one entry
428
433
  let n = this.nEntries;
429
434
  if (n == 1)
430
- this.all.map = this._map(this.nthEntry(0));
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 = {};
@@ -446,7 +456,12 @@ export class GeoMultiCollection
446
456
  // optimise case where one entry
447
457
  let n = this.nEntries;
448
458
  if (n == 1)
449
- this.all.topo = this._topo(this.nthEntry(0));
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
+ }
450
465
  else
451
466
  this.all.topo = geoCollectionToTopoNonNull(this.allCol());
452
467
  }
@@ -560,9 +575,12 @@ export class GeoMultiCollection
560
575
  forEach(cb: FeatureFunc): void
561
576
  {
562
577
  this.forEachEntry(e => {
563
- let col = this._col(e);
564
578
  if (e.col)
565
- e.col.features.forEach(f => { if (this.hidden[f.properties.id] === undefined) cb(f) })
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) });
566
584
  });
567
585
  }
568
586
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",