@dra2020/baseclient 1.0.109 → 1.0.111
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 +31 -10
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +2 -0
- package/lib/geo/geo.ts +36 -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;
|
|
@@ -69,6 +70,7 @@ export declare class GeoMultiCollection {
|
|
|
69
70
|
allCol(): GeoFeatureCollection;
|
|
70
71
|
allMap(): GeoFeatureMap;
|
|
71
72
|
allTopo(): Poly.Topo;
|
|
73
|
+
allNewTopo(): Poly.Topo;
|
|
72
74
|
hideSetAll(hm: HideMap): void;
|
|
73
75
|
hide(id: any): void;
|
|
74
76
|
show(id: any): void;
|
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]); }
|
|
@@ -466,6 +475,29 @@ export class GeoMultiCollection
|
|
|
466
475
|
}
|
|
467
476
|
|
|
468
477
|
allTopo(): Poly.Topo
|
|
478
|
+
{
|
|
479
|
+
if (this.nEntries == 0) return null;
|
|
480
|
+
if (! this.all.topo)
|
|
481
|
+
{
|
|
482
|
+
// optimise case where one entry
|
|
483
|
+
let n = this.nEntries;
|
|
484
|
+
if (n == 1)
|
|
485
|
+
{
|
|
486
|
+
let e = this.nthEntry(0);
|
|
487
|
+
this.all.topo = this._topo(e);
|
|
488
|
+
this.all.col = this.all.col || e.col;
|
|
489
|
+
this.all.map = this.all.map || e.map;
|
|
490
|
+
}
|
|
491
|
+
else
|
|
492
|
+
{
|
|
493
|
+
// Old-style, goes through map (to filter hidden) and then collection
|
|
494
|
+
this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return this.all.topo;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
allNewTopo(): Poly.Topo
|
|
469
501
|
{
|
|
470
502
|
if (this.nEntries == 0) return null;
|
|
471
503
|
if (! this.all.topo)
|
|
@@ -484,9 +516,9 @@ export class GeoMultiCollection
|
|
|
484
516
|
// Old-style, goes through map (to filter hidden) and then collection
|
|
485
517
|
// this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
486
518
|
// 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);
|
|
519
|
+
let topoarray = Object.values(this.entries).filter((e: GeoEntry) => this._length(e) > 0)
|
|
520
|
+
.map((e: GeoEntry) => { return { topology: this._topo(e), filterout: this.hidden } });
|
|
521
|
+
this.all.topo = topoarray.length == 0 ? null : topoarray.length == 1 ? topoarray[0].topology : Poly.topoSplice(topoarray);
|
|
490
522
|
}
|
|
491
523
|
}
|
|
492
524
|
return this.all.topo;
|
|
@@ -552,14 +584,7 @@ export class GeoMultiCollection
|
|
|
552
584
|
get length(): number
|
|
553
585
|
{
|
|
554
586
|
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
|
-
});
|
|
587
|
+
this.forEachEntry(e => n += this._length(e));
|
|
563
588
|
return n;
|
|
564
589
|
}
|
|
565
590
|
|