@dra2020/baseclient 1.0.109 → 1.0.110
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 +12 -10
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +1 -0
- package/lib/geo/geo.ts +13 -11
- package/package.json +1 -1
package/dist/geo/geo.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare class GeoMultiCollection {
|
|
|
62
62
|
_col(e: GeoEntry): GeoFeatureCollection;
|
|
63
63
|
_map(e: GeoEntry): GeoFeatureMap;
|
|
64
64
|
_topo(e: GeoEntry): Poly.Topo;
|
|
65
|
+
_length(e: GeoEntry): number;
|
|
65
66
|
colOf(tag: string): GeoFeatureCollection;
|
|
66
67
|
mapOf(tag: string): GeoFeatureMap;
|
|
67
68
|
topoOf(tag: string): Poly.Topo;
|
package/lib/geo/geo.ts
CHANGED
|
@@ -396,6 +396,15 @@ export class GeoMultiCollection
|
|
|
396
396
|
return e.topo;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
_length(e: GeoEntry): number
|
|
400
|
+
{
|
|
401
|
+
if (e == null) return 0;
|
|
402
|
+
return e.col ? e.col.features.length
|
|
403
|
+
: e.map ? Util.countKeys(e.map)
|
|
404
|
+
: e.topo ? Util.countKeys(e.topo.objects)
|
|
405
|
+
: 0;
|
|
406
|
+
}
|
|
407
|
+
|
|
399
408
|
colOf(tag: string): GeoFeatureCollection { return this._col(this.entries[tag]); }
|
|
400
409
|
mapOf(tag: string): GeoFeatureMap { return this._map(this.entries[tag]); }
|
|
401
410
|
topoOf(tag: string): Poly.Topo { return this._topo(this.entries[tag]); }
|
|
@@ -484,9 +493,9 @@ export class GeoMultiCollection
|
|
|
484
493
|
// Old-style, goes through map (to filter hidden) and then collection
|
|
485
494
|
// this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
486
495
|
// New style, use splice on packed topologies
|
|
487
|
-
let topoarray = Object.values(this.entries).
|
|
488
|
-
{ return { topology: this._topo(e), filterout: this.hidden } });
|
|
489
|
-
this.all.topo = Poly.topoSplice(topoarray);
|
|
496
|
+
let topoarray = Object.values(this.entries).filter((e: GeoEntry) => this._length(e) > 0)
|
|
497
|
+
.map((e: GeoEntry) => { return { topology: this._topo(e), filterout: this.hidden } });
|
|
498
|
+
this.all.topo = topoarray.length == 0 ? null : topoarray.length == 1 ? topoarray[0].topology : Poly.topoSplice(topoarray);
|
|
490
499
|
}
|
|
491
500
|
}
|
|
492
501
|
return this.all.topo;
|
|
@@ -552,14 +561,7 @@ export class GeoMultiCollection
|
|
|
552
561
|
get length(): number
|
|
553
562
|
{
|
|
554
563
|
let n = 0;
|
|
555
|
-
this.forEachEntry(e =>
|
|
556
|
-
if (e.col)
|
|
557
|
-
n += e.col.features.length;
|
|
558
|
-
else if (e.map)
|
|
559
|
-
n += Util.countKeys(e.map);
|
|
560
|
-
else if (e.topo)
|
|
561
|
-
n += Util.countKeys(e.topo.objects);
|
|
562
|
-
});
|
|
564
|
+
this.forEachEntry(e => n += this._length(e));
|
|
563
565
|
return n;
|
|
564
566
|
}
|
|
565
567
|
|