@dra2020/baseclient 1.0.98 → 1.0.99
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 +21 -1
- package/dist/baseclient.js.map +1 -1
- package/dist/poly/union.d.ts +1 -0
- package/lib/poly/union.ts +24 -0
- package/package.json +1 -1
package/dist/baseclient.js
CHANGED
|
@@ -10167,7 +10167,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
10167
10167
|
return result;
|
|
10168
10168
|
};
|
|
10169
10169
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10170
|
-
exports.FsmUnion = exports.polyDifference = exports.polyIntersects = void 0;
|
|
10170
|
+
exports.FsmUnion = exports.polyDifference = exports.polyIntersectArea = exports.polyIntersects = void 0;
|
|
10171
10171
|
const PC = __importStar(__webpack_require__(/*! polygon-clipping */ "polygon-clipping"));
|
|
10172
10172
|
const Util = __importStar(__webpack_require__(/*! ../util/all */ "./lib/util/all.ts"));
|
|
10173
10173
|
const FSM = __importStar(__webpack_require__(/*! ../fsm/all */ "./lib/fsm/all.ts"));
|
|
@@ -10226,6 +10226,26 @@ function polyIntersects(p1, p2) {
|
|
|
10226
10226
|
return bIntersects;
|
|
10227
10227
|
}
|
|
10228
10228
|
exports.polyIntersects = polyIntersects;
|
|
10229
|
+
function polyIntersectArea(p1, p2) {
|
|
10230
|
+
let pp1 = Poly.polyNormalize(p1);
|
|
10231
|
+
let pp2 = Poly.polyNormalize(p2);
|
|
10232
|
+
let area = 0;
|
|
10233
|
+
PP.polyPackEachRing(pp1, (buffer1, iPoly1, iRing1, iOffset1, nPoints1) => {
|
|
10234
|
+
if (iRing1 == 0) {
|
|
10235
|
+
let c1 = unpackCoords(buffer1, iOffset1, nPoints1);
|
|
10236
|
+
PP.polyPackEachRing(pp2, (buffer2, iPoly2, iRing2, iOffset2, nPoints2) => {
|
|
10237
|
+
if (iRing2 == 0) {
|
|
10238
|
+
let c2 = unpackCoords(buffer2, iOffset2, nPoints2);
|
|
10239
|
+
let result = _intersection(c1, c2);
|
|
10240
|
+
if (result && result.length > 0)
|
|
10241
|
+
area += Poly.polyArea(result);
|
|
10242
|
+
}
|
|
10243
|
+
});
|
|
10244
|
+
}
|
|
10245
|
+
});
|
|
10246
|
+
return area;
|
|
10247
|
+
}
|
|
10248
|
+
exports.polyIntersectArea = polyIntersectArea;
|
|
10229
10249
|
function polyDifference(main, parts) {
|
|
10230
10250
|
main = PP.polyUnpack(coords(main));
|
|
10231
10251
|
// need to explode multipolygon so that "exploded" is a valid multipolygon input to underlying difference routine
|