@dra2020/baseclient 1.0.161 → 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 +2 -0
- package/dist/baseclient.js +82 -12
- package/dist/baseclient.js.map +1 -1
- package/dist/colors/colors.d.ts +2 -0
- package/dist/colors/colortable.d.ts +1 -0
- package/dist/control/all.d.ts +1 -0
- package/dist/control/control.d.ts +4 -0
- package/dist/poly/mapto.d.ts +3 -2
- package/dist/util/util.d.ts +3 -0
- package/lib/all/all.ts +2 -0
- package/lib/colors/colors.ts +2 -1
- package/lib/colors/colortable.ts +2 -0
- package/lib/control/all.ts +1 -0
- package/lib/control/control.ts +4 -0
- package/lib/geo/geo.ts +9 -4
- package/lib/poly/mapto.ts +12 -5
- package/lib/util/util.ts +20 -0
- package/package.json +1 -1
- package/dist/colors/colortable-test.d.ts +0 -3
- package/dist/colors/colortable-test2.d.ts +0 -3
- package/dist/stats.json +0 -1
package/dist/all/all.d.ts
CHANGED
package/dist/baseclient.js
CHANGED
|
@@ -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
|
/***/ }),
|
|
@@ -97,7 +99,7 @@ exports.Detail = Detail;
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
100
|
-
exports.BigPalettes = exports.defaultDistrictsPalette = exports.EthnicBackgroundColor = exports.PartisanDistrictClassicColors = exports.PartisanPrecinctClassicColors = exports.EthnicFewClassicColors = exports.ColorValues = exports.DefaultColorNames = exports.MaxClassicColors = exports.MaxColors = exports.MaxOrderedColors = void 0;
|
|
102
|
+
exports.BigPalettes = exports.defaultDistrictsPalette = exports.EthnicBackgroundColor = exports.PartisanDistrictClassicColors = exports.PartisanPrecinctClassicColors = exports.EthnicFewClassicColors = exports.ColorValues = exports.DefaultColorNames = exports.MaxClassicColors = exports.MaxColors = exports.MaxOrderedColors = exports.ColorBrewerSchemeNames = exports.ColorTable = void 0;
|
|
101
103
|
exports.genColor = genColor;
|
|
102
104
|
exports.orderedColors = orderedColors;
|
|
103
105
|
exports.getPalette = getPalette;
|
|
@@ -107,6 +109,8 @@ exports.getPalette = getPalette;
|
|
|
107
109
|
// Pastel2, PiYG, PuBu, PuBuGn, PuOr, PuRd, Purples, RdBu, RdGy, RdPu, RdYlBu, RdYlGn, Reds, Set1, Set2, Set3, Spectral,
|
|
108
110
|
// Wistia, YlGn, YlGnBu, YlOrBr, YlOrRd)
|
|
109
111
|
const colortable_1 = __webpack_require__(/*! ./colortable */ "./lib/colors/colortable.ts");
|
|
112
|
+
Object.defineProperty(exports, "ColorTable", ({ enumerable: true, get: function () { return colortable_1.ColorTable; } }));
|
|
113
|
+
Object.defineProperty(exports, "ColorBrewerSchemeNames", ({ enumerable: true, get: function () { return colortable_1.ColorBrewerSchemeNames; } }));
|
|
110
114
|
exports.MaxOrderedColors = 50;
|
|
111
115
|
exports.MaxColors = exports.MaxOrderedColors * 3; // Tied to orderedColors()
|
|
112
116
|
exports.MaxClassicColors = 55;
|
|
@@ -563,7 +567,8 @@ if (name.endsWith('_r')) {
|
|
|
563
567
|
|
|
564
568
|
|
|
565
569
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
566
|
-
exports.ColorTable = void 0;
|
|
570
|
+
exports.ColorTable = exports.ColorBrewerSchemeNames = void 0;
|
|
571
|
+
exports.ColorBrewerSchemeNames = ["Accent", "Dark2", "Paired", "Pastel1", "Pastel2", "Set1", "Set2", "Set3", "Blues", "Greens", "Oranges", "Reds", "Purples", "Greys1", "BuGn", "BuPu", "GnBu", "OrRd", "PuBuGn", "YlGn", "Spectral", "RdYlBu", "PiYG", "PRGn", "RdYlGn", "RdGy", "RdBu", "BrBG", "PuOr"];
|
|
567
572
|
exports.ColorTable = {
|
|
568
573
|
"Greys": ["#ffffff", "#fefefe", "#fdfdfd", "#fcfcfc", "#fbfbfb", "#fbfbfb", "#fafafa", "#f9f9f9", "#f8f8f8", "#f7f7f7", "#f7f7f7", "#f6f6f6", "#f5f5f5", "#f4f4f4", "#f3f3f3", "#f3f3f3", "#f2f2f2", "#f1f1f1", "#f0f0f0", "#efefef", "#eeeeee", "#ededed", "#ebebeb", "#eaeaea", "#e9e9e9", "#e8e8e8", "#e6e6e6", "#e5e5e5", "#e4e4e4", "#e3e3e3", "#e2e2e2", "#e0e0e0", "#dfdfdf", "#dedede", "#dddddd", "#dbdbdb", "#dadada", "#d9d9d9", "#d7d7d7", "#d6d6d6", "#d5d5d5", "#d3d3d3", "#d1d1d1", "#d0d0d0", "#cfcfcf", "#cdcdcd", "#cbcbcb", "#cacaca", "#c9c9c9", "#c7c7c7", "#c6c6c6", "#c4c4c4", "#c2c2c2", "#c2c2c2", "#c0c0c0", "#bebebe", "#bcbcbc", "#bbbbbb", "#b8b8b8", "#b6b6b6", "#b5b5b5", "#b2b2b2", "#b0b0b0", "#aeaeae", "#acacac", "#aaaaaa", "#a7a7a7", "#a6a6a6", "#a3a3a3", "#a1a1a1", "#a0a0a0", "#9d9d9d", "#9b9b9b", "#9a9a9a", "#979797", "#959595", "#939393", "#929292", "#8f8f8f", "#8d8d8d", "#8c8c8c", "#8a8a8a", "#888888", "#878787", "#848484", "#828282", "#808080", "#7f7f7f", "#7d7d7d", "#7b7b7b", "#797979", "#777777", "#757575", "#747474", "#727272", "#707070", "#6e6e6e", "#6d6d6d", "#6b6b6b", "#696969", "#676767", "#656565", "#636363", "#626262", "#606060", "#5e5e5e", "#5c5c5c", "#5b5b5b", "#595959", "#575757", "#565656", "#545454", "#525252", "#505050", "#4d4d4d", "#4b4b4b", "#484848", "#464646", "#444444", "#414141", "#3f3f3f", "#3c3c3c", "#3a3a3a", "#383838", "#353535", "#333333", "#303030", "#2e2e2e", "#2c2c2c", "#292929", "#272727", "#252525", "#222222", "#212121", "#1f1f1f", "#1c1c1c", "#1a1a1a", "#191919", "#171717", "#141414", "#131313", "#111111", "#0f0f0f", "#0d0d0d", "#0b0b0b", "#090909", "#060606", "#050505", "#030303", "#010101"],
|
|
569
574
|
"bone": ["#000001", "#020203", "#040405", "#050507", "#070709", "#08080c", "#0a0a0e", "#0b0b0f", "#0d0d12", "#0e0e14", "#0f0f15", "#111118", "#13131a", "#14141b", "#15151e", "#171720", "#191923", "#1a1a24", "#1c1c26", "#1d1d29", "#1e1e2a", "#20202c", "#22222f", "#232330", "#242433", "#262635", "#282837", "#292939", "#2a2a3b", "#2c2c3d", "#2d2d3f", "#2f2f41", "#313144", "#313145", "#333347", "#35354a", "#37374c", "#38384d", "#393950", "#3b3b52", "#3c3c53", "#3e3e56", "#3f3f58", "#404059", "#42425c", "#44445e", "#464661", "#464662", "#484864", "#4a4a67", "#4b4b68", "#4d4d6b", "#4e4e6d", "#4f4f6e", "#515171", "#535373", "#545674", "#555775", "#575977", "#595c79", "#5a5d7a", "#5b5f7b", "#5d627d", "#5e637e", "#606580", "#626881", "#636a83", "#646b84", "#666e86", "#687088", "#697188", "#6a748a", "#6c768c", "#6d778d", "#6f7a8f", "#707c90", "#727e92", "#738093", "#758295", "#778496", "#778697", "#798899", "#7b8a9b", "#7c8c9c", "#7e8e9d", "#7f919f", "#8193a1", "#8294a2", "#8497a4", "#8599a5", "#869aa6", "#889da8", "#8a9faa", "#8ba0ab", "#8ca3ac", "#8ea5ae", "#90a7b0", "#91a9b1", "#93abb2", "#94adb4", "#95afb5", "#97b1b7", "#99b3b9", "#9ab5b9", "#9bb7bb", "#9db9bd", "#9fbcbf", "#a0bdc0", "#a1bfc1", "#a3c2c3", "#a4c3c4", "#a6c5c6", "#a8c7c7", "#aac8c8", "#accaca", "#afcccc", "#b2cece", "#b3cece", "#b6d0d0", "#b9d2d2", "#bad3d3", "#bdd5d5", "#bfd6d6", "#c1d7d7", "#c4d9d9", "#c6dbdb", "#c9dcdc", "#cadddd", "#cddfdf", "#d0e1e1", "#d1e2e2", "#d4e3e3", "#d7e5e5", "#d8e6e6", "#dbe8e8", "#deeaea", "#e0ebeb", "#e2ecec", "#e4eeee", "#e7f0f0", "#e8f1f1", "#ebf2f2", "#eef4f4", "#eff5f5", "#f2f7f7", "#f5f8f8", "#f7fafa", "#f9fbfb", "#fcfdfd", "#feffff"],
|
|
@@ -726,6 +731,45 @@ function create() {
|
|
|
726
731
|
}
|
|
727
732
|
|
|
728
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
|
+
|
|
729
773
|
/***/ }),
|
|
730
774
|
|
|
731
775
|
/***/ "./lib/csv/all.ts":
|
|
@@ -2699,16 +2743,20 @@ const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all
|
|
|
2699
2743
|
const Poly = __importStar(__webpack_require__(/*! ../poly/all */ "./lib/poly/all.ts"));
|
|
2700
2744
|
// Tracing/debugging aid
|
|
2701
2745
|
let metrics = {};
|
|
2746
|
+
const MinRecordTotal = 500;
|
|
2702
2747
|
function record(action, total) {
|
|
2703
|
-
if (
|
|
2704
|
-
metrics[action]
|
|
2705
|
-
|
|
2706
|
-
|
|
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
|
+
}
|
|
2707
2754
|
}
|
|
2708
2755
|
function dumpMetrics() {
|
|
2709
2756
|
Object.keys(metrics).forEach(action => {
|
|
2710
2757
|
console.log(`G.${action}: count: ${metrics[action].count}, total: ${metrics[action].total}`);
|
|
2711
2758
|
});
|
|
2759
|
+
metrics = {};
|
|
2712
2760
|
}
|
|
2713
2761
|
function hidemapConcat(...args) {
|
|
2714
2762
|
let hm = {};
|
|
@@ -7485,14 +7533,19 @@ function setLabels(c) {
|
|
|
7485
7533
|
//
|
|
7486
7534
|
// The return value is an object that maps the block feature ids to the district feature id.
|
|
7487
7535
|
//
|
|
7488
|
-
function polyMapToByCentroid(districts, centroids) {
|
|
7536
|
+
function polyMapToByCentroid(districts, centroids, control) {
|
|
7489
7537
|
let map = {};
|
|
7490
7538
|
// Cache district boundboxes for quick containment exclusion
|
|
7491
7539
|
let fs = districts.features;
|
|
7492
7540
|
let bbDistricts = fs.map(f => BB.boundbox(f));
|
|
7493
7541
|
let aDistricts = fs.map(f => P.polyArea(f));
|
|
7494
7542
|
// Walk over blocks, mapping centroid to district
|
|
7495
|
-
|
|
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;
|
|
7496
7549
|
let x = centroids[blockid].x;
|
|
7497
7550
|
let y = centroids[blockid].y;
|
|
7498
7551
|
let fIn = [];
|
|
@@ -7513,17 +7566,19 @@ function polyMapToByCentroid(districts, centroids) {
|
|
|
7513
7566
|
iLow = fIn[i];
|
|
7514
7567
|
map[blockid] = fs[iLow].properties.id;
|
|
7515
7568
|
}
|
|
7569
|
+
if (control)
|
|
7570
|
+
control.statusUpdate(k, keys.length);
|
|
7516
7571
|
});
|
|
7517
|
-
return map;
|
|
7572
|
+
return canceled ? undefined : map;
|
|
7518
7573
|
}
|
|
7519
|
-
function polyMapTo(districts, blocks) {
|
|
7574
|
+
function polyMapTo(districts, blocks, control) {
|
|
7520
7575
|
// Cache labelx, labely if necessary
|
|
7521
7576
|
setLabels(blocks);
|
|
7522
7577
|
let centroids = {};
|
|
7523
7578
|
blocks.features.forEach(f => {
|
|
7524
7579
|
centroids[f.properties.id] = { x: f.properties.labelx, y: f.properties.labely };
|
|
7525
7580
|
});
|
|
7526
|
-
return polyMapToByCentroid(districts, centroids);
|
|
7581
|
+
return polyMapToByCentroid(districts, centroids, control);
|
|
7527
7582
|
}
|
|
7528
7583
|
|
|
7529
7584
|
|
|
@@ -12372,6 +12427,11 @@ class Elapsed {
|
|
|
12372
12427
|
if (this.tDur)
|
|
12373
12428
|
this.tDur = undefined;
|
|
12374
12429
|
}
|
|
12430
|
+
restart() {
|
|
12431
|
+
if (this.tStart === undefined)
|
|
12432
|
+
this.start();
|
|
12433
|
+
delete this.tDur;
|
|
12434
|
+
}
|
|
12375
12435
|
end() {
|
|
12376
12436
|
if (this.tStart === undefined)
|
|
12377
12437
|
this.start();
|
|
@@ -12388,6 +12448,11 @@ class Elapsed {
|
|
|
12388
12448
|
else
|
|
12389
12449
|
return this.tDur;
|
|
12390
12450
|
}
|
|
12451
|
+
mscur() {
|
|
12452
|
+
let ms = this.ms();
|
|
12453
|
+
this.restart();
|
|
12454
|
+
return ms;
|
|
12455
|
+
}
|
|
12391
12456
|
nano() {
|
|
12392
12457
|
if (this.tDur === undefined)
|
|
12393
12458
|
this.end();
|
|
@@ -12396,6 +12461,11 @@ class Elapsed {
|
|
|
12396
12461
|
else
|
|
12397
12462
|
return this.tDur * 1000000;
|
|
12398
12463
|
}
|
|
12464
|
+
nanocur() {
|
|
12465
|
+
let nano = this.nano();
|
|
12466
|
+
this.restart();
|
|
12467
|
+
return nano;
|
|
12468
|
+
}
|
|
12399
12469
|
}
|
|
12400
12470
|
exports.Elapsed = Elapsed;
|
|
12401
12471
|
class MultiTimer {
|