@dra2020/baseclient 1.0.17 → 1.0.20
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 +104 -16
- package/dist/baseclient.js.map +1 -1
- package/dist/geo/geo.d.ts +1 -0
- package/dist/poly/all.d.ts +1 -0
- package/dist/poly/pointinpoly.d.ts +1 -0
- package/dist/util/bintrie.d.ts +6 -2
- package/lib/geo/geo.ts +15 -0
- package/lib/poly/all.ts +1 -0
- package/lib/poly/pointinpoly.ts +29 -0
- package/lib/util/bintrie.ts +15 -4
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -1278,9 +1278,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
1278
1278
|
return result;
|
|
1279
1279
|
};
|
|
1280
1280
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1281
|
-
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollection = exports.geoCollectionToTopo = exports.geoMapToCollection = exports.geoCollectionToMap = void 0;
|
|
1281
|
+
exports.geoIntersect = exports.geoIntersectOptions = exports.GeoMultiCollection = exports.geoMapEqual = exports.geoEqual = exports.geoTopoToCollection = exports.geoCollectionToTopo = exports.geoMapToCollection = exports.geoCollectionToMap = exports.geoEnsureID = void 0;
|
|
1282
1282
|
const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
|
|
1283
1283
|
const Poly = __importStar(__webpack_require__(/*! ../poly/all */ "./lib/poly/all.ts"));
|
|
1284
|
+
function geoEnsureID(col) {
|
|
1285
|
+
let prop;
|
|
1286
|
+
const props = ['id', 'GEOID', 'GEOID10', 'GEOID20', 'GEOID30'];
|
|
1287
|
+
if (col && col.features && col.features.length > 0) {
|
|
1288
|
+
let f = col.features[0];
|
|
1289
|
+
if (f.properties.id !== undefined)
|
|
1290
|
+
return;
|
|
1291
|
+
props.forEach(p => { if (prop === undefined && f.properties[p] !== undefined)
|
|
1292
|
+
prop = p; });
|
|
1293
|
+
if (prop)
|
|
1294
|
+
col.features.forEach(f => { f.properties.id = f.properties[prop]; });
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
exports.geoEnsureID = geoEnsureID;
|
|
1284
1298
|
function geoCollectionToMap(col) {
|
|
1285
1299
|
if (col == null)
|
|
1286
1300
|
return null;
|
|
@@ -4573,6 +4587,7 @@ __exportStar(__webpack_require__(/*! ./polyround */ "./lib/poly/polyround.ts"),
|
|
|
4573
4587
|
__exportStar(__webpack_require__(/*! ./topo */ "./lib/poly/topo.ts"), exports);
|
|
4574
4588
|
__exportStar(__webpack_require__(/*! ./selfintersect */ "./lib/poly/selfintersect.ts"), exports);
|
|
4575
4589
|
__exportStar(__webpack_require__(/*! ./shamos */ "./lib/poly/shamos.ts"), exports);
|
|
4590
|
+
__exportStar(__webpack_require__(/*! ./pointinpoly */ "./lib/poly/pointinpoly.ts"), exports);
|
|
4576
4591
|
|
|
4577
4592
|
|
|
4578
4593
|
/***/ }),
|
|
@@ -5654,6 +5669,66 @@ export function minimumBoundingRectangle(poly: any): any
|
|
|
5654
5669
|
*/
|
|
5655
5670
|
|
|
5656
5671
|
|
|
5672
|
+
/***/ }),
|
|
5673
|
+
|
|
5674
|
+
/***/ "./lib/poly/pointinpoly.ts":
|
|
5675
|
+
/*!*********************************!*\
|
|
5676
|
+
!*** ./lib/poly/pointinpoly.ts ***!
|
|
5677
|
+
\*********************************/
|
|
5678
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5679
|
+
|
|
5680
|
+
|
|
5681
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5682
|
+
if (k2 === undefined) k2 = k;
|
|
5683
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5684
|
+
}) : (function(o, m, k, k2) {
|
|
5685
|
+
if (k2 === undefined) k2 = k;
|
|
5686
|
+
o[k2] = m[k];
|
|
5687
|
+
}));
|
|
5688
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
5689
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5690
|
+
}) : function(o, v) {
|
|
5691
|
+
o["default"] = v;
|
|
5692
|
+
});
|
|
5693
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
5694
|
+
if (mod && mod.__esModule) return mod;
|
|
5695
|
+
var result = {};
|
|
5696
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5697
|
+
__setModuleDefault(result, mod);
|
|
5698
|
+
return result;
|
|
5699
|
+
};
|
|
5700
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5701
|
+
exports.polyContainsPoint = void 0;
|
|
5702
|
+
const PP = __importStar(__webpack_require__(/*! ./polypack */ "./lib/poly/polypack.ts"));
|
|
5703
|
+
function polyContainsPoint(poly, x, y) {
|
|
5704
|
+
let pp = PP.polyPack(poly);
|
|
5705
|
+
if (pp == null)
|
|
5706
|
+
return false;
|
|
5707
|
+
let bFound = false;
|
|
5708
|
+
let bInside = false;
|
|
5709
|
+
PP.polyPackEachRing(pp, (b, iPoly, iRing, iOffset, nPoints) => {
|
|
5710
|
+
if (bFound)
|
|
5711
|
+
return;
|
|
5712
|
+
let inside = false;
|
|
5713
|
+
let iEnd = iOffset + (nPoints - 1) * 2;
|
|
5714
|
+
for (let i = iOffset, j = iEnd; i < iEnd; j = i, i += 2) {
|
|
5715
|
+
let xi = b[i], yi = b[i + 1];
|
|
5716
|
+
let xj = b[j], yj = b[j + 1];
|
|
5717
|
+
let intersect = ((yi > y) !== (yj > y))
|
|
5718
|
+
&& (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
|
|
5719
|
+
if (intersect)
|
|
5720
|
+
inside = !inside;
|
|
5721
|
+
}
|
|
5722
|
+
if (inside) {
|
|
5723
|
+
bFound = iRing > 0; // if inside a hole, don't need to process further
|
|
5724
|
+
bInside = iRing == 0; // not inside if inside a hole
|
|
5725
|
+
}
|
|
5726
|
+
});
|
|
5727
|
+
return bInside;
|
|
5728
|
+
}
|
|
5729
|
+
exports.polyContainsPoint = polyContainsPoint;
|
|
5730
|
+
|
|
5731
|
+
|
|
5657
5732
|
/***/ }),
|
|
5658
5733
|
|
|
5659
5734
|
/***/ "./lib/poly/poly.ts":
|
|
@@ -8751,21 +8826,31 @@ __exportStar(__webpack_require__(/*! ./bintrie */ "./lib/util/bintrie.ts"), expo
|
|
|
8751
8826
|
/*!*****************************!*\
|
|
8752
8827
|
!*** ./lib/util/bintrie.ts ***!
|
|
8753
8828
|
\*****************************/
|
|
8754
|
-
/***/ ((__unused_webpack_module, exports)
|
|
8829
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
8755
8830
|
|
|
8756
8831
|
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8832
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8833
|
+
if (k2 === undefined) k2 = k;
|
|
8834
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
8835
|
+
}) : (function(o, m, k, k2) {
|
|
8836
|
+
if (k2 === undefined) k2 = k;
|
|
8837
|
+
o[k2] = m[k];
|
|
8838
|
+
}));
|
|
8839
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
8840
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
8841
|
+
}) : function(o, v) {
|
|
8842
|
+
o["default"] = v;
|
|
8843
|
+
});
|
|
8844
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
8845
|
+
if (mod && mod.__esModule) return mod;
|
|
8846
|
+
var result = {};
|
|
8847
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
8848
|
+
__setModuleDefault(result, mod);
|
|
8849
|
+
return result;
|
|
8850
|
+
};
|
|
8767
8851
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8768
8852
|
exports.BinTrieBuilder = exports.BinTrie = exports.u82s = exports.s2u8 = void 0;
|
|
8853
|
+
const U = __importStar(__webpack_require__(/*! ./util */ "./lib/util/util.ts"));
|
|
8769
8854
|
/*
|
|
8770
8855
|
-- For Node
|
|
8771
8856
|
import * as u from 'util';
|
|
@@ -8977,9 +9062,11 @@ class BinTrie {
|
|
|
8977
9062
|
}
|
|
8978
9063
|
}
|
|
8979
9064
|
exports.BinTrie = BinTrie;
|
|
9065
|
+
let DefaultOptions = { dedup: true };
|
|
8980
9066
|
class BinTrieBuilder {
|
|
8981
|
-
constructor(coder) {
|
|
9067
|
+
constructor(coder, options) {
|
|
8982
9068
|
this.coder = coder;
|
|
9069
|
+
this.options = U.shallowAssignImmutable(DefaultOptions, options);
|
|
8983
9070
|
}
|
|
8984
9071
|
// Building
|
|
8985
9072
|
nodeCount(node) {
|
|
@@ -9128,8 +9215,8 @@ class BinTrieBuilder {
|
|
|
9128
9215
|
this.u8[k] = u8[j];
|
|
9129
9216
|
}
|
|
9130
9217
|
// Building
|
|
9131
|
-
static fromMap(coder, o) {
|
|
9132
|
-
let btb = new BinTrieBuilder(coder);
|
|
9218
|
+
static fromMap(coder, o, options) {
|
|
9219
|
+
let btb = new BinTrieBuilder(coder, options);
|
|
9133
9220
|
btb.vtb = ValueTableBuilder.fromStrings(coder, Object.values(o));
|
|
9134
9221
|
btb.vt = ValueTable.fromBuffer(coder, btb.vtb.ab, 0, btb.vtb.ab.byteLength);
|
|
9135
9222
|
let keys = Object.keys(o);
|
|
@@ -9144,7 +9231,8 @@ class BinTrieBuilder {
|
|
|
9144
9231
|
}
|
|
9145
9232
|
});
|
|
9146
9233
|
// dedup (collapse branches pointing to same value)
|
|
9147
|
-
btb.dedup
|
|
9234
|
+
if (btb.options.dedup)
|
|
9235
|
+
btb.dedup(btb.root);
|
|
9148
9236
|
// validate
|
|
9149
9237
|
keys.forEach(k => {
|
|
9150
9238
|
if (good && btb.getUnpacked(k) !== o[k]) {
|