@dra2020/baseclient 1.0.106 → 1.0.109

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.
@@ -6,6 +6,11 @@ export declare type Topo = any;
6
6
  export declare function topoFromCollection(col: any): Topo;
7
7
  export declare function topoContiguity(topo: Topo): any;
8
8
  export declare function topoToFeature(topo: Topo, geoid: string): any;
9
+ export declare type TopoSpliceEntry = {
10
+ topology: Topo;
11
+ filterout?: any;
12
+ };
13
+ export declare function topoSplice(topoarray: TopoSpliceEntry[]): Topo;
9
14
  export declare function topoToCollection(topo: Topo): any;
10
15
  export interface SimplifyOptions {
11
16
  minArea?: number;
package/lib/geo/geo.ts CHANGED
@@ -480,7 +480,14 @@ export class GeoMultiCollection
480
480
  this.all.map = this.all.map || e.map;
481
481
  }
482
482
  else
483
- this.all.topo = geoCollectionToTopoNonNull(this.allCol());
483
+ {
484
+ // Old-style, goes through map (to filter hidden) and then collection
485
+ // this.all.topo = geoCollectionToTopoNonNull(this.allCol());
486
+ // New style, use splice on packed topologies
487
+ let topoarray = Object.values(this.entries).map((e: GeoEntry) =>
488
+ { return { topology: this._topo(e), filterout: this.hidden } });
489
+ this.all.topo = Poly.topoSplice(topoarray);
490
+ }
484
491
  }
485
492
  return this.all.topo;
486
493
  }
package/lib/poly/topo.ts CHANGED
@@ -96,6 +96,14 @@ export function topoToFeature(topo: Topo, geoid: string): any
96
96
  return correctGeometry(TopoClient.feature(topo, topo.objects[geoid]));
97
97
  }
98
98
 
99
+ export type TopoSpliceEntry = { topology: Topo, filterout?: any };
100
+
101
+ export function topoSplice(topoarray: TopoSpliceEntry[]): Topo
102
+ {
103
+ if (topoarray) topoarray.forEach(e => topoPack(e.topology));
104
+ return TopoClient.splice(topoarray);
105
+ }
106
+
99
107
  export function topoToCollection(topo: Topo): any
100
108
  {
101
109
  let col: any = { type: 'FeatureCollection', features: [] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dra2020/baseclient",
3
- "version": "1.0.106",
3
+ "version": "1.0.109",
4
4
  "description": "Utility functions for Javascript projects.",
5
5
  "main": "dist/baseclient.js",
6
6
  "types": "./dist/all/all.d.ts",
@@ -40,7 +40,7 @@
40
40
  "webpack-cli": "^4.9.1"
41
41
  },
42
42
  "dependencies": {
43
- "@dra2020/topojson-client": "^3.2.9",
43
+ "@dra2020/topojson-client": "^3.2.11",
44
44
  "@dra2020/topojson-server": "^3.0.103",
45
45
  "@dra2020/topojson-simplify": "^3.0.102",
46
46
  "diff-match-patch": "^1.0.5",