@dra2020/baseclient 1.0.90 → 1.0.92
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 +29 -2
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +1 -0
- package/lib/geo/geo.ts +30 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -2347,9 +2347,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
2347
2347
|
return result;
|
|
2348
2348
|
};
|
|
2349
2349
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2350
|
-
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollectionNonNull = exports.geoTopoToCollection = exports.geoCollectionToTopoNonNull = exports.geoCollectionToTopo = exports.geoMapToCollectionNonNull = exports.geoMapToCollection = exports.geoCollectionToMap = exports.geoNormalizeCollection = exports.geoNormalizeFeature = exports.geoEnsureID = void 0;
|
|
2350
|
+
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollectionNonNull = exports.geoTopoToCollection = exports.geoCollectionToTopoNonNull = exports.geoCollectionToTopo = exports.geoMapToCollectionNonNull = exports.geoMapToCollection = exports.geoCollectionToMap = exports.geoNormalizeCollection = exports.geoNormalizeFeature = exports.geoEnsureID = exports.dumpMetrics = void 0;
|
|
2351
2351
|
const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
|
|
2352
2352
|
const Poly = __importStar(__webpack_require__(/*! ../poly/all */ "./lib/poly/all.ts"));
|
|
2353
|
+
// Tracing/debugging aid
|
|
2354
|
+
let metrics = {};
|
|
2355
|
+
function record(action, total) {
|
|
2356
|
+
if (metrics[action] === undefined)
|
|
2357
|
+
metrics[action] = { count: 0, total: 0 };
|
|
2358
|
+
metrics[action].count++;
|
|
2359
|
+
metrics[action].total += total;
|
|
2360
|
+
}
|
|
2361
|
+
function dumpMetrics() {
|
|
2362
|
+
Object.keys(metrics).forEach(action => {
|
|
2363
|
+
console.log(`G.${action}: count: ${metrics[action].count}, total: ${metrics[action].total}`);
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
exports.dumpMetrics = dumpMetrics;
|
|
2353
2367
|
const NormalizeAll = { joinPolygons: true, checkRewind: true, ensureID: true };
|
|
2354
2368
|
// set the canonical 'id' property from the best property value.
|
|
2355
2369
|
// if joinPolygons is true, we do not enforce uniqueness.
|
|
@@ -2465,6 +2479,9 @@ exports.geoMapToCollectionNonNull = geoMapToCollectionNonNull;
|
|
|
2465
2479
|
function geoCollectionToTopo(col) {
|
|
2466
2480
|
let topo = Poly.topoFromCollection(col);
|
|
2467
2481
|
Poly.topoPack(topo);
|
|
2482
|
+
record('coltotopo', col.features.length);
|
|
2483
|
+
if (col.datasets)
|
|
2484
|
+
topo.datasets = col.datasets;
|
|
2468
2485
|
return topo;
|
|
2469
2486
|
}
|
|
2470
2487
|
exports.geoCollectionToTopo = geoCollectionToTopo;
|
|
@@ -2475,6 +2492,9 @@ exports.geoCollectionToTopoNonNull = geoCollectionToTopoNonNull;
|
|
|
2475
2492
|
function geoTopoToCollection(topo) {
|
|
2476
2493
|
let col = Poly.topoToCollection(topo);
|
|
2477
2494
|
Poly.featurePack(col);
|
|
2495
|
+
record('topotocol', col.features.length);
|
|
2496
|
+
if (topo.datasets)
|
|
2497
|
+
col.datasets = topo.datasets;
|
|
2478
2498
|
return col;
|
|
2479
2499
|
}
|
|
2480
2500
|
exports.geoTopoToCollection = geoTopoToCollection;
|
|
@@ -2617,9 +2637,16 @@ class GeoMultiCollection {
|
|
|
2617
2637
|
let n = this.nEntries;
|
|
2618
2638
|
if (n == 1)
|
|
2619
2639
|
this.all.col = this._col(this.nthEntry(0));
|
|
2620
|
-
else
|
|
2640
|
+
else {
|
|
2621
2641
|
// Going from map to collection guarantees that any duplicates are removed
|
|
2622
2642
|
this.all.col = geoMapToCollectionNonNull(this.allMap());
|
|
2643
|
+
this.forEachEntry(e => {
|
|
2644
|
+
if (e.col && e.col.datasets)
|
|
2645
|
+
this.all.col.datasets = e.col.datasets;
|
|
2646
|
+
if (e.topo && e.topo.datasets)
|
|
2647
|
+
this.all.col.datasets = e.topo.datasets;
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2623
2650
|
}
|
|
2624
2651
|
return this.all.col;
|
|
2625
2652
|
}
|