@dra2020/baseclient 1.0.162 → 1.0.163

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/all/all.d.ts CHANGED
@@ -28,3 +28,5 @@ import * as DataFlow from '../dataflow/all';
28
28
  export { DataFlow };
29
29
  import * as Detail from '../detail/all';
30
30
  export { Detail };
31
+ import * as Control from '../control/all';
32
+ export { Control };
@@ -53,7 +53,7 @@ var __importStar = (this && this.__importStar) || (function () {
53
53
  };
54
54
  })();
55
55
  Object.defineProperty(exports, "__esModule", ({ value: true }));
56
- exports.Detail = exports.DataFlow = exports.Colors = exports.CSV = exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
56
+ exports.Control = exports.Detail = exports.DataFlow = exports.Colors = exports.CSV = exports.Emit = exports.G = exports.FilterExpr = exports.OTE = exports.OT = exports.LogClient = exports.LogAbstract = exports.Poly = exports.FSM = exports.Context = exports.Util = void 0;
57
57
  // Client and Server
58
58
  const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
59
59
  exports.Util = Util;
@@ -85,6 +85,8 @@ const DataFlow = __importStar(__webpack_require__(/*! ../dataflow/all */ "./lib/
85
85
  exports.DataFlow = DataFlow;
86
86
  const Detail = __importStar(__webpack_require__(/*! ../detail/all */ "./lib/detail/all.ts"));
87
87
  exports.Detail = Detail;
88
+ const Control = __importStar(__webpack_require__(/*! ../control/all */ "./lib/control/all.ts"));
89
+ exports.Control = Control;
88
90
 
89
91
 
90
92
  /***/ }),
@@ -729,6 +731,45 @@ function create() {
729
731
  }
730
732
 
731
733
 
734
+ /***/ }),
735
+
736
+ /***/ "./lib/control/all.ts":
737
+ /*!****************************!*\
738
+ !*** ./lib/control/all.ts ***!
739
+ \****************************/
740
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
741
+
742
+
743
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
744
+ if (k2 === undefined) k2 = k;
745
+ var desc = Object.getOwnPropertyDescriptor(m, k);
746
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
747
+ desc = { enumerable: true, get: function() { return m[k]; } };
748
+ }
749
+ Object.defineProperty(o, k2, desc);
750
+ }) : (function(o, m, k, k2) {
751
+ if (k2 === undefined) k2 = k;
752
+ o[k2] = m[k];
753
+ }));
754
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
755
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
756
+ };
757
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
758
+ __exportStar(__webpack_require__(/*! ./control */ "./lib/control/control.ts"), exports);
759
+
760
+
761
+ /***/ }),
762
+
763
+ /***/ "./lib/control/control.ts":
764
+ /*!********************************!*\
765
+ !*** ./lib/control/control.ts ***!
766
+ \********************************/
767
+ /***/ ((__unused_webpack_module, exports) => {
768
+
769
+
770
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
771
+
772
+
732
773
  /***/ }),
733
774
 
734
775
  /***/ "./lib/csv/all.ts":
@@ -2702,16 +2743,20 @@ const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all
2702
2743
  const Poly = __importStar(__webpack_require__(/*! ../poly/all */ "./lib/poly/all.ts"));
2703
2744
  // Tracing/debugging aid
2704
2745
  let metrics = {};
2746
+ const MinRecordTotal = 500;
2705
2747
  function record(action, total) {
2706
- if (metrics[action] === undefined)
2707
- metrics[action] = { count: 0, total: 0 };
2708
- metrics[action].count++;
2709
- metrics[action].total += total;
2748
+ if (total > MinRecordTotal) {
2749
+ if (metrics[action] === undefined)
2750
+ metrics[action] = { count: 0, total: 0 };
2751
+ metrics[action].count++;
2752
+ metrics[action].total += total;
2753
+ }
2710
2754
  }
2711
2755
  function dumpMetrics() {
2712
2756
  Object.keys(metrics).forEach(action => {
2713
2757
  console.log(`G.${action}: count: ${metrics[action].count}, total: ${metrics[action].total}`);
2714
2758
  });
2759
+ metrics = {};
2715
2760
  }
2716
2761
  function hidemapConcat(...args) {
2717
2762
  let hm = {};
@@ -7488,14 +7533,19 @@ function setLabels(c) {
7488
7533
  //
7489
7534
  // The return value is an object that maps the block feature ids to the district feature id.
7490
7535
  //
7491
- function polyMapToByCentroid(districts, centroids) {
7536
+ function polyMapToByCentroid(districts, centroids, control) {
7492
7537
  let map = {};
7493
7538
  // Cache district boundboxes for quick containment exclusion
7494
7539
  let fs = districts.features;
7495
7540
  let bbDistricts = fs.map(f => BB.boundbox(f));
7496
7541
  let aDistricts = fs.map(f => P.polyArea(f));
7497
7542
  // Walk over blocks, mapping centroid to district
7498
- Object.keys(centroids).forEach(blockid => {
7543
+ let canceled = false;
7544
+ let keys = Object.keys(centroids);
7545
+ keys.forEach((blockid, k) => {
7546
+ canceled = canceled || (control === null || control === void 0 ? void 0 : control.isCanceled());
7547
+ if (canceled)
7548
+ return;
7499
7549
  let x = centroids[blockid].x;
7500
7550
  let y = centroids[blockid].y;
7501
7551
  let fIn = [];
@@ -7516,17 +7566,19 @@ function polyMapToByCentroid(districts, centroids) {
7516
7566
  iLow = fIn[i];
7517
7567
  map[blockid] = fs[iLow].properties.id;
7518
7568
  }
7569
+ if (control)
7570
+ control.statusUpdate(k, keys.length);
7519
7571
  });
7520
- return map;
7572
+ return canceled ? undefined : map;
7521
7573
  }
7522
- function polyMapTo(districts, blocks) {
7574
+ function polyMapTo(districts, blocks, control) {
7523
7575
  // Cache labelx, labely if necessary
7524
7576
  setLabels(blocks);
7525
7577
  let centroids = {};
7526
7578
  blocks.features.forEach(f => {
7527
7579
  centroids[f.properties.id] = { x: f.properties.labelx, y: f.properties.labely };
7528
7580
  });
7529
- return polyMapToByCentroid(districts, centroids);
7581
+ return polyMapToByCentroid(districts, centroids, control);
7530
7582
  }
7531
7583
 
7532
7584
 
@@ -12375,6 +12427,11 @@ class Elapsed {
12375
12427
  if (this.tDur)
12376
12428
  this.tDur = undefined;
12377
12429
  }
12430
+ restart() {
12431
+ if (this.tStart === undefined)
12432
+ this.start();
12433
+ delete this.tDur;
12434
+ }
12378
12435
  end() {
12379
12436
  if (this.tStart === undefined)
12380
12437
  this.start();
@@ -12391,6 +12448,11 @@ class Elapsed {
12391
12448
  else
12392
12449
  return this.tDur;
12393
12450
  }
12451
+ mscur() {
12452
+ let ms = this.ms();
12453
+ this.restart();
12454
+ return ms;
12455
+ }
12394
12456
  nano() {
12395
12457
  if (this.tDur === undefined)
12396
12458
  this.end();
@@ -12399,6 +12461,11 @@ class Elapsed {
12399
12461
  else
12400
12462
  return this.tDur * 1000000;
12401
12463
  }
12464
+ nanocur() {
12465
+ let nano = this.nano();
12466
+ this.restart();
12467
+ return nano;
12468
+ }
12402
12469
  }
12403
12470
  exports.Elapsed = Elapsed;
12404
12471
  class MultiTimer {