@dra2020/baseclient 1.0.106 → 1.0.108
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 +16 -3
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/topo.d.ts +5 -0
- package/lib/geo/geo.ts +10 -1
- package/lib/poly/topo.ts +8 -0
- package/package.json +2 -2
package/dist/poly/topo.d.ts
CHANGED
|
@@ -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
|
@@ -390,6 +390,7 @@ export class GeoMultiCollection
|
|
|
390
390
|
else if (e.map)
|
|
391
391
|
{
|
|
392
392
|
e.col = geoMapToCollectionNonNull(e.map);
|
|
393
|
+
console.log(`toposplice: constructing topology for ${e.col.features.length} features`);
|
|
393
394
|
e.topo = geoCollectionToTopoNonNull(e.col);
|
|
394
395
|
}
|
|
395
396
|
}
|
|
@@ -480,7 +481,15 @@ export class GeoMultiCollection
|
|
|
480
481
|
this.all.map = this.all.map || e.map;
|
|
481
482
|
}
|
|
482
483
|
else
|
|
483
|
-
|
|
484
|
+
{
|
|
485
|
+
// Old-style, goes through map (to filter hidden) and then collection
|
|
486
|
+
// this.all.topo = geoCollectionToTopoNonNull(this.allCol());
|
|
487
|
+
// New style, use splice on packed topologies
|
|
488
|
+
console.log(`toposplice: splicing ${this.nEntries} topologies`);
|
|
489
|
+
let topoarray = Object.values(this.entries).map((e: GeoEntry) =>
|
|
490
|
+
{ return { topology: this._topo(e), filterout: this.hidden } });
|
|
491
|
+
this.all.topo = Poly.topoSplice(topoarray);
|
|
492
|
+
}
|
|
484
493
|
}
|
|
485
494
|
return this.all.topo;
|
|
486
495
|
}
|
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.
|
|
3
|
+
"version": "1.0.108",
|
|
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.
|
|
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",
|