@dra2020/baseclient 1.0.22 → 1.0.25
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 +25 -17
- package/dist/baseclient.js.map +1 -1
- package/dist/ot-js/otsession.d.ts +2 -0
- package/dist/poly/boundbox.d.ts +1 -0
- package/dist/poly/quad.d.ts +3 -1
- package/lib/ot-js/otsession.ts +2 -0
- package/lib/poly/boundbox.ts +5 -0
- package/lib/poly/quad.ts +27 -18
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -4740,7 +4740,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
4740
4740
|
return result;
|
|
4741
4741
|
};
|
|
4742
4742
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4743
|
-
exports.boundboxIntersects = exports.boundboxArea = exports.boundboxPoly = exports.boundbox = exports.boundboxExtend = exports.clipLon = exports.boundboxCY = exports.boundboxCX = exports.boundboxHeight = exports.boundboxWidth = void 0;
|
|
4743
|
+
exports.boundboxContains = exports.boundboxIntersects = exports.boundboxArea = exports.boundboxPoly = exports.boundbox = exports.boundboxExtend = exports.clipLon = exports.boundboxCY = exports.boundboxCX = exports.boundboxHeight = exports.boundboxWidth = void 0;
|
|
4744
4744
|
const P = __importStar(__webpack_require__(/*! ./poly */ "./lib/poly/poly.ts"));
|
|
4745
4745
|
function boundboxWidth(bb) { return Math.abs(bb.right - bb.left); }
|
|
4746
4746
|
exports.boundboxWidth = boundboxWidth;
|
|
@@ -4815,6 +4815,10 @@ function boundboxIntersects(bb1, bb2) {
|
|
|
4815
4815
|
return !(bb1.left > bb2.right || bb1.right < bb2.left || bb1.top < bb2.bottom || bb1.bottom > bb2.top);
|
|
4816
4816
|
}
|
|
4817
4817
|
exports.boundboxIntersects = boundboxIntersects;
|
|
4818
|
+
function boundboxContains(bb, x, y) {
|
|
4819
|
+
return !(bb.left >= x || bb.right < x || bb.top >= y || bb.bottom < y);
|
|
4820
|
+
}
|
|
4821
|
+
exports.boundboxContains = boundboxContains;
|
|
4818
4822
|
|
|
4819
4823
|
|
|
4820
4824
|
/***/ }),
|
|
@@ -7445,6 +7449,7 @@ const Poly = __importStar(__webpack_require__(/*! ./poly */ "./lib/poly/poly.ts"
|
|
|
7445
7449
|
const PP = __importStar(__webpack_require__(/*! ./polypack */ "./lib/poly/polypack.ts"));
|
|
7446
7450
|
const BB = __importStar(__webpack_require__(/*! ./boundbox */ "./lib/poly/boundbox.ts"));
|
|
7447
7451
|
const PR = __importStar(__webpack_require__(/*! ./polyround */ "./lib/poly/polyround.ts"));
|
|
7452
|
+
const pointinpoly_1 = __webpack_require__(/*! ./pointinpoly */ "./lib/poly/pointinpoly.ts");
|
|
7448
7453
|
let _union = undefined;
|
|
7449
7454
|
let anyPC = PC;
|
|
7450
7455
|
if (anyPC.union)
|
|
@@ -7455,19 +7460,6 @@ if (_union === undefined)
|
|
|
7455
7460
|
throw 'Unable to load union function from polygon-clipping';
|
|
7456
7461
|
;
|
|
7457
7462
|
function featureCoords(feature) {
|
|
7458
|
-
/*
|
|
7459
|
-
if (feature.geometry !== undefined)
|
|
7460
|
-
{
|
|
7461
|
-
if (feature.geometry.packed !== undefined)
|
|
7462
|
-
return PP.polyUnpack(feature.geometry.packed);
|
|
7463
|
-
else
|
|
7464
|
-
return feature.geometry.coordinates;
|
|
7465
|
-
}
|
|
7466
|
-
else if (feature.offset !== undefined)
|
|
7467
|
-
return PP.polyUnpack(feature);
|
|
7468
|
-
else
|
|
7469
|
-
return feature;
|
|
7470
|
-
*/
|
|
7471
7463
|
if (feature.geometry !== undefined) {
|
|
7472
7464
|
if (feature.geometry.packed !== undefined)
|
|
7473
7465
|
return feature.geometry.packed;
|
|
@@ -7504,7 +7496,7 @@ class QuadLevel {
|
|
|
7504
7496
|
if (features.length <= options.maxLeafCount || this.level >= options.maxDepth) {
|
|
7505
7497
|
if (this.level >= options.maxDepth)
|
|
7506
7498
|
throw `QuadTree: maximum depth of ${options.maxDepth} exceeded`;
|
|
7507
|
-
this.features = features
|
|
7499
|
+
this.features = features;
|
|
7508
7500
|
this.children = null;
|
|
7509
7501
|
}
|
|
7510
7502
|
else {
|
|
@@ -7541,10 +7533,26 @@ class QuadLevel {
|
|
|
7541
7533
|
featureInBox(box, f) {
|
|
7542
7534
|
return BB.boundboxIntersects(box, f.box);
|
|
7543
7535
|
}
|
|
7536
|
+
featureUnderCoord(coord) {
|
|
7537
|
+
if (!BB.boundboxContains(this.box, coord[0], coord[1]))
|
|
7538
|
+
return null;
|
|
7539
|
+
if (this.features) {
|
|
7540
|
+
let wp = this.features.find(wp => pointinpoly_1.polyContainsPoint(wp.p, coord[0], coord[1]));
|
|
7541
|
+
return wp ? wp.f : null;
|
|
7542
|
+
}
|
|
7543
|
+
else {
|
|
7544
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
7545
|
+
let f = this.children[i].featureUnderCoord(coord);
|
|
7546
|
+
if (f)
|
|
7547
|
+
return f;
|
|
7548
|
+
}
|
|
7549
|
+
return null;
|
|
7550
|
+
}
|
|
7551
|
+
}
|
|
7544
7552
|
union() {
|
|
7545
7553
|
if (this.asyncUnion == null) {
|
|
7546
7554
|
if (this.children == null)
|
|
7547
|
-
this.asyncUnion = unionPolys(this.features);
|
|
7555
|
+
this.asyncUnion = unionPolys(this.features.map(f => f.p));
|
|
7548
7556
|
else
|
|
7549
7557
|
this.asyncUnion = unionPolys(this.children.map((q) => q.union()));
|
|
7550
7558
|
}
|
|
@@ -7589,7 +7597,7 @@ class FsmQuadTree extends FSM.Fsm {
|
|
|
7589
7597
|
this.work.nUnion = features.length;
|
|
7590
7598
|
this.isempty = features.length == 0;
|
|
7591
7599
|
// Compute BoundBox for each feature
|
|
7592
|
-
let wrapped = features.map((f) => { return { box: BB.boundbox(f), p: featureCoords(f) }; });
|
|
7600
|
+
let wrapped = features.map((f) => { return { f: f, box: BB.boundbox(f), p: featureCoords(f) }; });
|
|
7593
7601
|
let box = BB.boundbox(col);
|
|
7594
7602
|
this.quad = new QuadLevel(this.options, 0, box, wrapped);
|
|
7595
7603
|
}
|