@dra2020/baseclient 1.0.18 → 1.0.21
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 +91 -16
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/all.d.ts +1 -0
- package/dist/poly/pointinpoly.d.ts +1 -0
- package/dist/util/bintrie.d.ts +7 -2
- package/lib/poly/all.ts +1 -0
- package/lib/poly/pointinpoly.ts +29 -0
- package/lib/util/bintrie.ts +18 -5
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -4587,6 +4587,7 @@ __exportStar(__webpack_require__(/*! ./polyround */ "./lib/poly/polyround.ts"),
|
|
|
4587
4587
|
__exportStar(__webpack_require__(/*! ./topo */ "./lib/poly/topo.ts"), exports);
|
|
4588
4588
|
__exportStar(__webpack_require__(/*! ./selfintersect */ "./lib/poly/selfintersect.ts"), exports);
|
|
4589
4589
|
__exportStar(__webpack_require__(/*! ./shamos */ "./lib/poly/shamos.ts"), exports);
|
|
4590
|
+
__exportStar(__webpack_require__(/*! ./pointinpoly */ "./lib/poly/pointinpoly.ts"), exports);
|
|
4590
4591
|
|
|
4591
4592
|
|
|
4592
4593
|
/***/ }),
|
|
@@ -5668,6 +5669,66 @@ export function minimumBoundingRectangle(poly: any): any
|
|
|
5668
5669
|
*/
|
|
5669
5670
|
|
|
5670
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
|
+
|
|
5671
5732
|
/***/ }),
|
|
5672
5733
|
|
|
5673
5734
|
/***/ "./lib/poly/poly.ts":
|
|
@@ -8765,21 +8826,31 @@ __exportStar(__webpack_require__(/*! ./bintrie */ "./lib/util/bintrie.ts"), expo
|
|
|
8765
8826
|
/*!*****************************!*\
|
|
8766
8827
|
!*** ./lib/util/bintrie.ts ***!
|
|
8767
8828
|
\*****************************/
|
|
8768
|
-
/***/ ((__unused_webpack_module, exports)
|
|
8829
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
8769
8830
|
|
|
8770
8831
|
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
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
|
+
};
|
|
8781
8851
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8782
8852
|
exports.BinTrieBuilder = exports.BinTrie = exports.u82s = exports.s2u8 = void 0;
|
|
8853
|
+
const U = __importStar(__webpack_require__(/*! ./util */ "./lib/util/util.ts"));
|
|
8783
8854
|
/*
|
|
8784
8855
|
-- For Node
|
|
8785
8856
|
import * as u from 'util';
|
|
@@ -8991,9 +9062,11 @@ class BinTrie {
|
|
|
8991
9062
|
}
|
|
8992
9063
|
}
|
|
8993
9064
|
exports.BinTrie = BinTrie;
|
|
9065
|
+
let DefaultOptions = { dedup: true, verbose: false };
|
|
8994
9066
|
class BinTrieBuilder {
|
|
8995
|
-
constructor(coder) {
|
|
9067
|
+
constructor(coder, options) {
|
|
8996
9068
|
this.coder = coder;
|
|
9069
|
+
this.options = U.shallowAssignImmutable(DefaultOptions, options);
|
|
8997
9070
|
}
|
|
8998
9071
|
// Building
|
|
8999
9072
|
nodeCount(node) {
|
|
@@ -9142,8 +9215,8 @@ class BinTrieBuilder {
|
|
|
9142
9215
|
this.u8[k] = u8[j];
|
|
9143
9216
|
}
|
|
9144
9217
|
// Building
|
|
9145
|
-
static fromMap(coder, o) {
|
|
9146
|
-
let btb = new BinTrieBuilder(coder);
|
|
9218
|
+
static fromMap(coder, o, options) {
|
|
9219
|
+
let btb = new BinTrieBuilder(coder, options);
|
|
9147
9220
|
btb.vtb = ValueTableBuilder.fromStrings(coder, Object.values(o));
|
|
9148
9221
|
btb.vt = ValueTable.fromBuffer(coder, btb.vtb.ab, 0, btb.vtb.ab.byteLength);
|
|
9149
9222
|
let keys = Object.keys(o);
|
|
@@ -9158,7 +9231,8 @@ class BinTrieBuilder {
|
|
|
9158
9231
|
}
|
|
9159
9232
|
});
|
|
9160
9233
|
// dedup (collapse branches pointing to same value)
|
|
9161
|
-
btb.dedup
|
|
9234
|
+
if (btb.options.dedup)
|
|
9235
|
+
btb.dedup(btb.root);
|
|
9162
9236
|
// validate
|
|
9163
9237
|
keys.forEach(k => {
|
|
9164
9238
|
if (good && btb.getUnpacked(k) !== o[k]) {
|
|
@@ -9183,7 +9257,8 @@ class BinTrieBuilder {
|
|
|
9183
9257
|
good = false;
|
|
9184
9258
|
}
|
|
9185
9259
|
});
|
|
9186
|
-
|
|
9260
|
+
if (btb.options.verbose)
|
|
9261
|
+
console.log(`bintrie: total size: ${btb.u8.length}, value table size: ${btb.vtb.u8.length}`);
|
|
9187
9262
|
return bt;
|
|
9188
9263
|
}
|
|
9189
9264
|
}
|