@vitessce/spatial-utils 4.0.9 → 4.1.0
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/{deflate-CNjgm89Q.js → deflate-7a1deX0W.js} +1 -1
- package/dist/{index-BpQ3fbd8.js → index-DgWO5osR.js} +691 -2313
- package/dist/index.js +1 -1
- package/dist/{jpeg-ISmJxKn1.js → jpeg-CFLEL8IV.js} +1 -1
- package/dist/{lerc-Bx1iViC_.js → lerc-CT-nNr9A.js} +1 -1
- package/dist/{lzw-D7u1eQSe.js → lzw-Dlr30Fct.js} +1 -1
- package/dist/{packbits-D4yNoB9e.js → packbits-C6ye2Wmf.js} +1 -1
- package/dist/{raw-taMYakY-.js → raw-ByPggEEh.js} +1 -1
- package/dist/{webimage-DjvdutBx.js → webimage-C8dSzGbX.js} +1 -1
- package/package.json +7 -7
|
@@ -112,7 +112,7 @@ var reTrimStart = /^\s+/;
|
|
|
112
112
|
function baseTrim(string) {
|
|
113
113
|
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
114
114
|
}
|
|
115
|
-
function isObject$
|
|
115
|
+
function isObject$3(value) {
|
|
116
116
|
var type = typeof value;
|
|
117
117
|
return value != null && (type == "object" || type == "function");
|
|
118
118
|
}
|
|
@@ -128,9 +128,9 @@ function toNumber(value) {
|
|
|
128
128
|
if (isSymbol(value)) {
|
|
129
129
|
return NAN;
|
|
130
130
|
}
|
|
131
|
-
if (isObject$
|
|
131
|
+
if (isObject$3(value)) {
|
|
132
132
|
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
133
|
-
value = isObject$
|
|
133
|
+
value = isObject$3(other) ? other + "" : other;
|
|
134
134
|
}
|
|
135
135
|
if (typeof value != "string") {
|
|
136
136
|
return value === 0 ? value : +value;
|
|
@@ -153,7 +153,7 @@ function toFinite$1(value) {
|
|
|
153
153
|
}
|
|
154
154
|
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
155
155
|
function isFunction$2(value) {
|
|
156
|
-
if (!isObject$
|
|
156
|
+
if (!isObject$3(value)) {
|
|
157
157
|
return false;
|
|
158
158
|
}
|
|
159
159
|
var tag2 = baseGetTag(value);
|
|
@@ -191,7 +191,7 @@ var reIsNative = RegExp(
|
|
|
191
191
|
"^" + funcToString.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
192
192
|
);
|
|
193
193
|
function baseIsNative(value) {
|
|
194
|
-
if (!isObject$
|
|
194
|
+
if (!isObject$3(value) || isMasked(value)) {
|
|
195
195
|
return false;
|
|
196
196
|
}
|
|
197
197
|
var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
|
|
@@ -223,7 +223,7 @@ function isArrayLike(value) {
|
|
|
223
223
|
return value != null && isLength(value.length) && !isFunction$2(value);
|
|
224
224
|
}
|
|
225
225
|
function isIterateeCall(value, index2, object2) {
|
|
226
|
-
if (!isObject$
|
|
226
|
+
if (!isObject$3(object2)) {
|
|
227
227
|
return false;
|
|
228
228
|
}
|
|
229
229
|
var type = typeof index2;
|
|
@@ -1620,10 +1620,10 @@ function normalize$4(out, a2) {
|
|
|
1620
1620
|
out[2] = a2[2] * len2;
|
|
1621
1621
|
return out;
|
|
1622
1622
|
}
|
|
1623
|
-
function dot$
|
|
1623
|
+
function dot$3(a2, b) {
|
|
1624
1624
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
1625
1625
|
}
|
|
1626
|
-
function cross
|
|
1626
|
+
function cross(out, a2, b) {
|
|
1627
1627
|
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
1628
1628
|
var bx = b[0], by = b[1], bz = b[2];
|
|
1629
1629
|
out[0] = ay * bz - az * by;
|
|
@@ -1712,8 +1712,8 @@ function rotateZ$2(out, a2, b, rad) {
|
|
|
1712
1712
|
out[2] = r2[2] + b[2];
|
|
1713
1713
|
return out;
|
|
1714
1714
|
}
|
|
1715
|
-
function angle$
|
|
1716
|
-
var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine2 = mag && dot$
|
|
1715
|
+
function angle$1(a2, b) {
|
|
1716
|
+
var ax = a2[0], ay = a2[1], az = a2[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine2 = mag && dot$3(a2, b) / mag;
|
|
1717
1717
|
return Math.acos(Math.min(Math.max(cosine2, -1), 1));
|
|
1718
1718
|
}
|
|
1719
1719
|
var sub$1 = subtract$1;
|
|
@@ -1812,10 +1812,10 @@ class Vector3 extends Vector {
|
|
|
1812
1812
|
this[2] = checkNumber(value);
|
|
1813
1813
|
}
|
|
1814
1814
|
angle(vector) {
|
|
1815
|
-
return angle$
|
|
1815
|
+
return angle$1(this, vector);
|
|
1816
1816
|
}
|
|
1817
1817
|
cross(vector) {
|
|
1818
|
-
cross
|
|
1818
|
+
cross(this, this, vector);
|
|
1819
1819
|
return this.check();
|
|
1820
1820
|
}
|
|
1821
1821
|
rotateX({
|
|
@@ -2932,7 +2932,7 @@ function normalize$3(out, a2) {
|
|
|
2932
2932
|
out[3] = w2 * len2;
|
|
2933
2933
|
return out;
|
|
2934
2934
|
}
|
|
2935
|
-
function dot$
|
|
2935
|
+
function dot$2(a2, b) {
|
|
2936
2936
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
|
|
2937
2937
|
}
|
|
2938
2938
|
function lerp$2(out, a2, b, t) {
|
|
@@ -3548,7 +3548,7 @@ function fromMat3(out, m) {
|
|
|
3548
3548
|
}
|
|
3549
3549
|
var add$3 = add$4;
|
|
3550
3550
|
var scale = scale$1;
|
|
3551
|
-
var dot$
|
|
3551
|
+
var dot$1 = dot$2;
|
|
3552
3552
|
var lerp$1 = lerp$2;
|
|
3553
3553
|
var length$2 = length$3;
|
|
3554
3554
|
var squaredLength = squaredLength$1;
|
|
@@ -3558,10 +3558,10 @@ var rotationTo = function() {
|
|
|
3558
3558
|
var xUnitVec3 = fromValues(1, 0, 0);
|
|
3559
3559
|
var yUnitVec3 = fromValues(0, 1, 0);
|
|
3560
3560
|
return function(out, a2, b) {
|
|
3561
|
-
var dot2 = dot$
|
|
3561
|
+
var dot2 = dot$3(a2, b);
|
|
3562
3562
|
if (dot2 < -0.999999) {
|
|
3563
|
-
cross
|
|
3564
|
-
if (len(tmpvec3) < 1e-6) cross
|
|
3563
|
+
cross(tmpvec3, xUnitVec3, a2);
|
|
3564
|
+
if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
|
|
3565
3565
|
normalize$4(tmpvec3, tmpvec3);
|
|
3566
3566
|
setAxisAngle(out, tmpvec3, Math.PI);
|
|
3567
3567
|
return out;
|
|
@@ -3572,7 +3572,7 @@ var rotationTo = function() {
|
|
|
3572
3572
|
out[3] = 1;
|
|
3573
3573
|
return out;
|
|
3574
3574
|
} else {
|
|
3575
|
-
cross
|
|
3575
|
+
cross(tmpvec3, a2, b);
|
|
3576
3576
|
out[0] = tmpvec3[0];
|
|
3577
3577
|
out[1] = tmpvec3[1];
|
|
3578
3578
|
out[2] = tmpvec3[2];
|
|
@@ -3686,7 +3686,7 @@ class Quaternion extends MathArray {
|
|
|
3686
3686
|
return squaredLength(this);
|
|
3687
3687
|
}
|
|
3688
3688
|
dot(a2) {
|
|
3689
|
-
return dot$
|
|
3689
|
+
return dot$1(this, a2);
|
|
3690
3690
|
}
|
|
3691
3691
|
rotationTo(vectorA, vectorB) {
|
|
3692
3692
|
rotationTo(this, vectorA, vectorB);
|
|
@@ -4610,7 +4610,7 @@ function isDate(x) {
|
|
|
4610
4610
|
function isRegExp(x) {
|
|
4611
4611
|
return x instanceof RegExp;
|
|
4612
4612
|
}
|
|
4613
|
-
function isObject$
|
|
4613
|
+
function isObject$2(x) {
|
|
4614
4614
|
return !!(x && typeof x === "object" && x.constructor === Object && !isComplex(x) && !isFraction(x));
|
|
4615
4615
|
}
|
|
4616
4616
|
function isNull(x) {
|
|
@@ -4717,7 +4717,7 @@ function mapObject(object2, callback) {
|
|
|
4717
4717
|
}
|
|
4718
4718
|
return clone2;
|
|
4719
4719
|
}
|
|
4720
|
-
function extend
|
|
4720
|
+
function extend(a2, b) {
|
|
4721
4721
|
for (var prop in b) {
|
|
4722
4722
|
if (hasOwnProperty$2(b, prop)) {
|
|
4723
4723
|
a2[prop] = b[prop];
|
|
@@ -6615,7 +6615,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies$Q, function crea
|
|
|
6615
6615
|
},
|
|
6616
6616
|
{
|
|
6617
6617
|
name: "Object",
|
|
6618
|
-
test: isObject$
|
|
6618
|
+
test: isObject$2
|
|
6619
6619
|
}
|
|
6620
6620
|
// order 'Object' last, it matches on other classes too
|
|
6621
6621
|
];
|
|
@@ -13690,7 +13690,7 @@ var createMultiply = /* @__PURE__ */ factory(name$v, dependencies$o, (_ref) => {
|
|
|
13690
13690
|
cptr[bcolumns] = cindex.length;
|
|
13691
13691
|
return c;
|
|
13692
13692
|
}
|
|
13693
|
-
return typed2(name$v, extend
|
|
13693
|
+
return typed2(name$v, extend({
|
|
13694
13694
|
// we extend the signatures of multiplyScalar with signatures dealing with matrices
|
|
13695
13695
|
"Array, Array": function ArrayArray(x, y) {
|
|
13696
13696
|
_validateMatrixDimensions(arraySize(x), arraySize(y));
|
|
@@ -19109,7 +19109,7 @@ var createDivide = /* @__PURE__ */ factory(name$7, dependencies, (_ref) => {
|
|
|
19109
19109
|
var algorithm14 = createAlgorithm14({
|
|
19110
19110
|
typed: typed2
|
|
19111
19111
|
});
|
|
19112
|
-
return typed2("divide", extend
|
|
19112
|
+
return typed2("divide", extend({
|
|
19113
19113
|
// we extend the signatures of divideScalar with signatures dealing with matrices
|
|
19114
19114
|
"Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(x, y) {
|
|
19115
19115
|
return multiply2(x, inv2(y));
|
|
@@ -19244,7 +19244,7 @@ var FibonacciHeap = /* @__PURE__ */ createFibonacciHeapClass({
|
|
|
19244
19244
|
larger,
|
|
19245
19245
|
smaller: smaller$1
|
|
19246
19246
|
});
|
|
19247
|
-
var dot
|
|
19247
|
+
var dot = /* @__PURE__ */ createDot({
|
|
19248
19248
|
addScalar,
|
|
19249
19249
|
conj,
|
|
19250
19250
|
multiplyScalar,
|
|
@@ -19260,7 +19260,7 @@ var floor = /* @__PURE__ */ createFloor({
|
|
|
19260
19260
|
});
|
|
19261
19261
|
var multiply = /* @__PURE__ */ createMultiply({
|
|
19262
19262
|
addScalar,
|
|
19263
|
-
dot
|
|
19263
|
+
dot,
|
|
19264
19264
|
equalScalar,
|
|
19265
19265
|
matrix,
|
|
19266
19266
|
multiplyScalar,
|
|
@@ -19293,7 +19293,7 @@ var subtract = /* @__PURE__ */ createSubtract({
|
|
|
19293
19293
|
typed,
|
|
19294
19294
|
unaryMinus
|
|
19295
19295
|
});
|
|
19296
|
-
var equal
|
|
19296
|
+
var equal = /* @__PURE__ */ createEqual({
|
|
19297
19297
|
DenseMatrix,
|
|
19298
19298
|
equalScalar,
|
|
19299
19299
|
matrix,
|
|
@@ -19372,7 +19372,7 @@ var Unit = /* @__PURE__ */ createUnitClass({
|
|
|
19372
19372
|
addScalar,
|
|
19373
19373
|
config: config$1,
|
|
19374
19374
|
divideScalar,
|
|
19375
|
-
equal
|
|
19375
|
+
equal,
|
|
19376
19376
|
fix,
|
|
19377
19377
|
format,
|
|
19378
19378
|
isNumeric: isNumeric$1,
|
|
@@ -21049,15 +21049,15 @@ function dirname(url) {
|
|
|
21049
21049
|
}
|
|
21050
21050
|
const isBoolean = (x) => typeof x === "boolean";
|
|
21051
21051
|
const isFunction = (x) => typeof x === "function";
|
|
21052
|
-
const isObject$
|
|
21053
|
-
const isPureObject = (x) => isObject$
|
|
21052
|
+
const isObject$1 = (x) => x !== null && typeof x === "object";
|
|
21053
|
+
const isPureObject = (x) => isObject$1(x) && x.constructor === {}.constructor;
|
|
21054
21054
|
const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
|
|
21055
21055
|
const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
|
|
21056
21056
|
const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
|
|
21057
21057
|
const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
|
|
21058
21058
|
const isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
|
|
21059
|
-
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$
|
|
21060
|
-
const isReadableNodeStream = (x) => isObject$
|
|
21059
|
+
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$1(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
|
|
21060
|
+
const isReadableNodeStream = (x) => isObject$1(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
|
|
21061
21061
|
const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
|
|
21062
21062
|
const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
|
|
21063
21063
|
const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
|
|
@@ -21856,7 +21856,7 @@ function getFetchFunction(options, context) {
|
|
|
21856
21856
|
if (typeof fetchOptions.fetch === "function") {
|
|
21857
21857
|
return fetchOptions.fetch;
|
|
21858
21858
|
}
|
|
21859
|
-
if (isObject$
|
|
21859
|
+
if (isObject$1(fetchOptions.fetch)) {
|
|
21860
21860
|
return (url) => fetchFile(url, fetchOptions);
|
|
21861
21861
|
}
|
|
21862
21862
|
if (context !== null && context !== void 0 && context.fetch) {
|
|
@@ -21877,7 +21877,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
|
|
|
21877
21877
|
const loaderName = id || "Top level";
|
|
21878
21878
|
const prefix = id ? "".concat(id, ".") : "";
|
|
21879
21879
|
for (const key in options) {
|
|
21880
|
-
const isSubOptions = !id && isObject$
|
|
21880
|
+
const isSubOptions = !id && isObject$1(options[key]);
|
|
21881
21881
|
const isBaseUriOption = key === "baseUri" && !id;
|
|
21882
21882
|
const isWorkerUrlOption = key === "workerUrl" && id;
|
|
21883
21883
|
if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
|
|
@@ -45057,7 +45057,7 @@ function getPropTypes(props) {
|
|
|
45057
45057
|
const ERR_NOT_OBJECT = "count(): argument not an object";
|
|
45058
45058
|
const ERR_NOT_CONTAINER = "count(): argument not a container";
|
|
45059
45059
|
function count(container) {
|
|
45060
|
-
if (!isObject
|
|
45060
|
+
if (!isObject(container)) {
|
|
45061
45061
|
throw new Error(ERR_NOT_OBJECT);
|
|
45062
45062
|
}
|
|
45063
45063
|
if (typeof container.count === "function") {
|
|
@@ -45077,7 +45077,7 @@ function count(container) {
|
|
|
45077
45077
|
function isPlainObject(value) {
|
|
45078
45078
|
return value !== null && typeof value === "object" && value.constructor === Object;
|
|
45079
45079
|
}
|
|
45080
|
-
function isObject
|
|
45080
|
+
function isObject(value) {
|
|
45081
45081
|
return value !== null && typeof value === "object";
|
|
45082
45082
|
}
|
|
45083
45083
|
function mergeShaders(target, source) {
|
|
@@ -49410,35 +49410,35 @@ function getPointAtIndex(positions, index2, size2, offset, out = []) {
|
|
|
49410
49410
|
}
|
|
49411
49411
|
return out;
|
|
49412
49412
|
}
|
|
49413
|
-
function intersect(a2, b, edge,
|
|
49413
|
+
function intersect(a2, b, edge, bbox, out = []) {
|
|
49414
49414
|
let t;
|
|
49415
49415
|
let snap;
|
|
49416
49416
|
if (edge & 8) {
|
|
49417
|
-
t = (
|
|
49417
|
+
t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
|
|
49418
49418
|
snap = 3;
|
|
49419
49419
|
} else if (edge & 4) {
|
|
49420
|
-
t = (
|
|
49420
|
+
t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
|
|
49421
49421
|
snap = 1;
|
|
49422
49422
|
} else if (edge & 2) {
|
|
49423
|
-
t = (
|
|
49423
|
+
t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
|
|
49424
49424
|
snap = 2;
|
|
49425
49425
|
} else if (edge & 1) {
|
|
49426
|
-
t = (
|
|
49426
|
+
t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
|
|
49427
49427
|
snap = 0;
|
|
49428
49428
|
} else {
|
|
49429
49429
|
return null;
|
|
49430
49430
|
}
|
|
49431
49431
|
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
49432
|
-
out[i2] = (snap & 1) === i2 ?
|
|
49432
|
+
out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
|
|
49433
49433
|
}
|
|
49434
49434
|
return out;
|
|
49435
49435
|
}
|
|
49436
|
-
function bitCode(p,
|
|
49436
|
+
function bitCode(p, bbox) {
|
|
49437
49437
|
let code = 0;
|
|
49438
|
-
if (p[0] <
|
|
49439
|
-
else if (p[0] >
|
|
49440
|
-
if (p[1] <
|
|
49441
|
-
else if (p[1] >
|
|
49438
|
+
if (p[0] < bbox[0]) code |= 1;
|
|
49439
|
+
else if (p[0] > bbox[2]) code |= 2;
|
|
49440
|
+
if (p[1] < bbox[1]) code |= 4;
|
|
49441
|
+
else if (p[1] > bbox[3]) code |= 8;
|
|
49442
49442
|
return code;
|
|
49443
49443
|
}
|
|
49444
49444
|
function cutPolylineByGrid(positions, options) {
|
|
@@ -49508,7 +49508,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
49508
49508
|
types: edgeTypes ? new Array(positions.length / size2).fill(TYPE_BORDER) : null,
|
|
49509
49509
|
holes: holeIndices || []
|
|
49510
49510
|
}];
|
|
49511
|
-
const
|
|
49511
|
+
const bbox = [[], []];
|
|
49512
49512
|
let cell = [];
|
|
49513
49513
|
while (queue.length) {
|
|
49514
49514
|
const {
|
|
@@ -49516,9 +49516,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
49516
49516
|
types,
|
|
49517
49517
|
holes
|
|
49518
49518
|
} = queue.shift();
|
|
49519
|
-
getBoundingBox$2(pos, size2, holes[0] || pos.length,
|
|
49520
|
-
cell = getGridCell(
|
|
49521
|
-
const code = bitCode(
|
|
49519
|
+
getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox);
|
|
49520
|
+
cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
|
|
49521
|
+
const code = bitCode(bbox[1], cell);
|
|
49522
49522
|
if (code) {
|
|
49523
49523
|
let parts = bisectPolygon(pos, types, size2, 0, holes[0] || pos.length, cell, code);
|
|
49524
49524
|
const polygonLow = {
|
|
@@ -49564,7 +49564,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
49564
49564
|
}
|
|
49565
49565
|
return result;
|
|
49566
49566
|
}
|
|
49567
|
-
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex,
|
|
49567
|
+
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox, edge) {
|
|
49568
49568
|
const numPoints = (endIndex - startIndex) / size2;
|
|
49569
49569
|
const resultLow = [];
|
|
49570
49570
|
const resultHigh = [];
|
|
@@ -49575,16 +49575,16 @@ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2,
|
|
|
49575
49575
|
let side;
|
|
49576
49576
|
let type;
|
|
49577
49577
|
const prev = getPointAtIndex(positions, numPoints - 1, size2, startIndex);
|
|
49578
|
-
let prevSide = Math.sign(edge & 8 ? prev[1] -
|
|
49578
|
+
let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
|
|
49579
49579
|
let prevType = edgeTypes && edgeTypes[numPoints - 1];
|
|
49580
49580
|
let lowPointCount = 0;
|
|
49581
49581
|
let highPointCount = 0;
|
|
49582
49582
|
for (let i2 = 0; i2 < numPoints; i2++) {
|
|
49583
49583
|
p = getPointAtIndex(positions, i2, size2, startIndex, p);
|
|
49584
|
-
side = Math.sign(edge & 8 ? p[1] -
|
|
49584
|
+
side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
|
|
49585
49585
|
type = edgeTypes && edgeTypes[startIndex / size2 + i2];
|
|
49586
49586
|
if (side && prevSide && prevSide !== side) {
|
|
49587
|
-
intersect(prev, p, edge,
|
|
49587
|
+
intersect(prev, p, edge, bbox, scratchPoint);
|
|
49588
49588
|
push(resultLow, scratchPoint) && typesLow.push(prevType);
|
|
49589
49589
|
push(resultHigh, scratchPoint) && typesHigh.push(prevType);
|
|
49590
49590
|
}
|
|
@@ -50716,7 +50716,7 @@ function requireEarcut() {
|
|
|
50716
50716
|
var p = start;
|
|
50717
50717
|
do {
|
|
50718
50718
|
var a2 = p.prev, b = p.next.next;
|
|
50719
|
-
if (!equals2(a2, b) &&
|
|
50719
|
+
if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
|
|
50720
50720
|
triangles.push(a2.i / dim | 0);
|
|
50721
50721
|
triangles.push(p.i / dim | 0);
|
|
50722
50722
|
triangles.push(b.i / dim | 0);
|
|
@@ -50891,7 +50891,7 @@ function requireEarcut() {
|
|
|
50891
50891
|
function equals2(p1, p2) {
|
|
50892
50892
|
return p1.x === p2.x && p1.y === p2.y;
|
|
50893
50893
|
}
|
|
50894
|
-
function
|
|
50894
|
+
function intersects(p1, q1, p2, q2) {
|
|
50895
50895
|
var o1 = sign2(area2(p1, q1, p2));
|
|
50896
50896
|
var o2 = sign2(area2(p1, q1, q2));
|
|
50897
50897
|
var o3 = sign2(area2(p2, q2, p1));
|
|
@@ -50912,7 +50912,7 @@ function requireEarcut() {
|
|
|
50912
50912
|
function intersectsPolygon(a2, b) {
|
|
50913
50913
|
var p = a2;
|
|
50914
50914
|
do {
|
|
50915
|
-
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i &&
|
|
50915
|
+
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a2, b)) return true;
|
|
50916
50916
|
p = p.next;
|
|
50917
50917
|
} while (p !== a2);
|
|
50918
50918
|
return false;
|
|
@@ -56948,7 +56948,7 @@ class Tile2DHeader {
|
|
|
56948
56948
|
const {
|
|
56949
56949
|
index: index2,
|
|
56950
56950
|
id,
|
|
56951
|
-
bbox
|
|
56951
|
+
bbox,
|
|
56952
56952
|
userData,
|
|
56953
56953
|
zoom
|
|
56954
56954
|
} = this;
|
|
@@ -56974,7 +56974,7 @@ class Tile2DHeader {
|
|
|
56974
56974
|
tileData = await getData({
|
|
56975
56975
|
index: index2,
|
|
56976
56976
|
id,
|
|
56977
|
-
bbox
|
|
56977
|
+
bbox,
|
|
56978
56978
|
userData,
|
|
56979
56979
|
zoom,
|
|
56980
56980
|
signal
|
|
@@ -57848,8 +57848,8 @@ const urlType = {
|
|
|
57848
57848
|
return true;
|
|
57849
57849
|
}
|
|
57850
57850
|
};
|
|
57851
|
-
function transformBox(
|
|
57852
|
-
const transformedCoords = [modelMatrix2.transformAsPoint([
|
|
57851
|
+
function transformBox(bbox, modelMatrix2) {
|
|
57852
|
+
const transformedCoords = [modelMatrix2.transformAsPoint([bbox[0], bbox[1]]), modelMatrix2.transformAsPoint([bbox[2], bbox[1]]), modelMatrix2.transformAsPoint([bbox[0], bbox[3]]), modelMatrix2.transformAsPoint([bbox[2], bbox[3]])];
|
|
57853
57853
|
const transformedBox = [Math.min(...transformedCoords.map((i2) => i2[0])), Math.min(...transformedCoords.map((i2) => i2[1])), Math.max(...transformedCoords.map((i2) => i2[0])), Math.max(...transformedCoords.map((i2) => i2[1]))];
|
|
57854
57854
|
return transformedBox;
|
|
57855
57855
|
}
|
|
@@ -57917,12 +57917,12 @@ function getCullBoundsInViewport(viewport, z, cullRect) {
|
|
|
57917
57917
|
const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
|
|
57918
57918
|
return [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
|
|
57919
57919
|
}
|
|
57920
|
-
function getIndexingCoords(
|
|
57920
|
+
function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
|
|
57921
57921
|
if (modelMatrixInverse) {
|
|
57922
|
-
const transformedTileIndex = transformBox(
|
|
57922
|
+
const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
57923
57923
|
return transformedTileIndex;
|
|
57924
57924
|
}
|
|
57925
|
-
return
|
|
57925
|
+
return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
57926
57926
|
}
|
|
57927
57927
|
function getScale(z, tileSize) {
|
|
57928
57928
|
return Math.pow(2, z) * TILE_SIZE$1 / tileSize;
|
|
@@ -57959,9 +57959,9 @@ function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE$1) {
|
|
|
57959
57959
|
};
|
|
57960
57960
|
}
|
|
57961
57961
|
function getIdentityTileIndices(viewport, z, tileSize, extent2, modelMatrixInverse) {
|
|
57962
|
-
const
|
|
57962
|
+
const bbox = getBoundingBox(viewport, null, extent2);
|
|
57963
57963
|
const scale2 = getScale(z, tileSize);
|
|
57964
|
-
const [minX, minY, maxX, maxY] = getIndexingCoords(
|
|
57964
|
+
const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
|
|
57965
57965
|
const indices = [];
|
|
57966
57966
|
for (let x = Math.floor(minX); x < maxX; x++) {
|
|
57967
57967
|
for (let y = Math.floor(minY); y < maxY; y++) {
|
|
@@ -58150,16 +58150,16 @@ class Tileset2D {
|
|
|
58150
58150
|
cullRect
|
|
58151
58151
|
});
|
|
58152
58152
|
const {
|
|
58153
|
-
bbox
|
|
58153
|
+
bbox
|
|
58154
58154
|
} = tile;
|
|
58155
58155
|
for (const [minX, minY, maxX, maxY] of boundsArr) {
|
|
58156
58156
|
let overlaps;
|
|
58157
|
-
if ("west" in
|
|
58158
|
-
overlaps =
|
|
58157
|
+
if ("west" in bbox) {
|
|
58158
|
+
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
58159
58159
|
} else {
|
|
58160
|
-
const y02 = Math.min(
|
|
58161
|
-
const y12 = Math.max(
|
|
58162
|
-
overlaps =
|
|
58160
|
+
const y02 = Math.min(bbox.top, bbox.bottom);
|
|
58161
|
+
const y12 = Math.max(bbox.top, bbox.bottom);
|
|
58162
|
+
overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
|
|
58163
58163
|
}
|
|
58164
58164
|
if (overlaps) {
|
|
58165
58165
|
return true;
|
|
@@ -75449,7 +75449,7 @@ class Ellipsoid {
|
|
|
75449
75449
|
h.copy(scratchCartesian).subtract(point2);
|
|
75450
75450
|
const longitude = Math.atan2(normal.y, normal.x);
|
|
75451
75451
|
const latitude = Math.asin(normal.z);
|
|
75452
|
-
const height = Math.sign(dot$
|
|
75452
|
+
const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
|
|
75453
75453
|
return toCartographicFromRadians([longitude, latitude, height], result);
|
|
75454
75454
|
}
|
|
75455
75455
|
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
|
|
@@ -79853,13 +79853,13 @@ class TerrainLayer extends CompositeLayer {
|
|
|
79853
79853
|
let bottomLeft = [0, 0];
|
|
79854
79854
|
let topRight = [0, 0];
|
|
79855
79855
|
if (viewport.isGeospatial) {
|
|
79856
|
-
const
|
|
79857
|
-
bottomLeft = viewport.projectFlat([
|
|
79858
|
-
topRight = viewport.projectFlat([
|
|
79856
|
+
const bbox = tile.bbox;
|
|
79857
|
+
bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
|
|
79858
|
+
topRight = viewport.projectFlat([bbox.east, bbox.north]);
|
|
79859
79859
|
} else {
|
|
79860
|
-
const
|
|
79861
|
-
bottomLeft = [
|
|
79862
|
-
topRight = [
|
|
79860
|
+
const bbox = tile.bbox;
|
|
79861
|
+
bottomLeft = [bbox.left, bbox.bottom];
|
|
79862
|
+
topRight = [bbox.right, bbox.top];
|
|
79863
79863
|
}
|
|
79864
79864
|
const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
|
|
79865
79865
|
const terrain = this.loadTerrain({
|
|
@@ -80230,27 +80230,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
|
|
|
80230
80230
|
const y = lerp$5(nw[1], se[1], pointY);
|
|
80231
80231
|
return viewport.unprojectFlat([x, y]);
|
|
80232
80232
|
}
|
|
80233
|
-
function getPoints(geometry2,
|
|
80234
|
-
return geometry2.map((g2) => Point(g2,
|
|
80233
|
+
function getPoints(geometry2, bbox, viewport) {
|
|
80234
|
+
return geometry2.map((g2) => Point(g2, bbox, viewport));
|
|
80235
80235
|
}
|
|
80236
|
-
function MultiPoint(multiPoint,
|
|
80237
|
-
return getPoints(multiPoint,
|
|
80236
|
+
function MultiPoint(multiPoint, bbox, viewport) {
|
|
80237
|
+
return getPoints(multiPoint, bbox, viewport);
|
|
80238
80238
|
}
|
|
80239
|
-
function LineString(line,
|
|
80240
|
-
return getPoints(line,
|
|
80239
|
+
function LineString(line, bbox, viewport) {
|
|
80240
|
+
return getPoints(line, bbox, viewport);
|
|
80241
80241
|
}
|
|
80242
|
-
function MultiLineString(multiLineString,
|
|
80243
|
-
return multiLineString.map((
|
|
80242
|
+
function MultiLineString(multiLineString, bbox, viewport) {
|
|
80243
|
+
return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
|
|
80244
80244
|
}
|
|
80245
|
-
function Polygon(polygon2,
|
|
80246
|
-
return polygon2.map((polygonRing) => getPoints(polygonRing,
|
|
80245
|
+
function Polygon(polygon2, bbox, viewport) {
|
|
80246
|
+
return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
|
|
80247
80247
|
}
|
|
80248
|
-
function MultiPolygon(multiPolygon2,
|
|
80249
|
-
return multiPolygon2.map((polygon2) => Polygon(polygon2,
|
|
80248
|
+
function MultiPolygon(multiPolygon2, bbox, viewport) {
|
|
80249
|
+
return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
|
|
80250
80250
|
}
|
|
80251
|
-
function transform$1(geometry2,
|
|
80252
|
-
const nw = viewport.projectFlat([
|
|
80253
|
-
const se = viewport.projectFlat([
|
|
80251
|
+
function transform$1(geometry2, bbox, viewport) {
|
|
80252
|
+
const nw = viewport.projectFlat([bbox.west, bbox.north]);
|
|
80253
|
+
const se = viewport.projectFlat([bbox.east, bbox.south]);
|
|
80254
80254
|
const projectedBbox = [nw, se];
|
|
80255
80255
|
return {
|
|
80256
80256
|
...geometry2,
|
|
@@ -80640,11 +80640,11 @@ class MVTLayer extends TileLayer {
|
|
|
80640
80640
|
return [];
|
|
80641
80641
|
}
|
|
80642
80642
|
const {
|
|
80643
|
-
bbox
|
|
80643
|
+
bbox
|
|
80644
80644
|
} = tile;
|
|
80645
|
-
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(
|
|
80645
|
+
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
|
|
80646
80646
|
const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
|
|
80647
|
-
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2,
|
|
80647
|
+
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
|
|
80648
80648
|
}
|
|
80649
80649
|
return tile._contentWGS84;
|
|
80650
80650
|
}
|
|
@@ -80671,7 +80671,7 @@ function getFeatureLayerName(feature2) {
|
|
|
80671
80671
|
function isFeatureIdDefined(value) {
|
|
80672
80672
|
return value !== void 0 && value !== null && value !== "";
|
|
80673
80673
|
}
|
|
80674
|
-
function transformTileCoordsToWGS84(object2,
|
|
80674
|
+
function transformTileCoordsToWGS84(object2, bbox, viewport) {
|
|
80675
80675
|
const feature2 = {
|
|
80676
80676
|
...object2,
|
|
80677
80677
|
geometry: {
|
|
@@ -80680,7 +80680,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
|
|
|
80680
80680
|
};
|
|
80681
80681
|
Object.defineProperty(feature2.geometry, "coordinates", {
|
|
80682
80682
|
get: () => {
|
|
80683
|
-
const wgs84Geom = transform$1(object2.geometry,
|
|
80683
|
+
const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
|
|
80684
80684
|
return wgs84Geom.coordinates;
|
|
80685
80685
|
}
|
|
80686
80686
|
});
|
|
@@ -80851,16 +80851,6 @@ function polygons(coordinates2, properties, options = {}) {
|
|
|
80851
80851
|
options
|
|
80852
80852
|
);
|
|
80853
80853
|
}
|
|
80854
|
-
function lineString(coordinates2, properties, options = {}) {
|
|
80855
|
-
if (coordinates2.length < 2) {
|
|
80856
|
-
throw new Error("coordinates must be an array of two or more positions");
|
|
80857
|
-
}
|
|
80858
|
-
const geom = {
|
|
80859
|
-
type: "LineString",
|
|
80860
|
-
coordinates: coordinates2
|
|
80861
|
-
};
|
|
80862
|
-
return feature$1(geom, properties, options);
|
|
80863
|
-
}
|
|
80864
80854
|
function featureCollection(features, options = {}) {
|
|
80865
80855
|
const fc = { type: "FeatureCollection" };
|
|
80866
80856
|
if (options.id) {
|
|
@@ -80886,10 +80876,6 @@ function radiansToLength(radians2, units = "kilometers") {
|
|
|
80886
80876
|
}
|
|
80887
80877
|
return radians2 * factor;
|
|
80888
80878
|
}
|
|
80889
|
-
function radiansToDegrees(radians2) {
|
|
80890
|
-
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
80891
|
-
return normalisedRadians * 180 / Math.PI;
|
|
80892
|
-
}
|
|
80893
80879
|
function degreesToRadians(degrees2) {
|
|
80894
80880
|
const normalisedDegrees = degrees2 % 360;
|
|
80895
80881
|
return normalisedDegrees * Math.PI / 180;
|
|
@@ -80897,428 +80883,6 @@ function degreesToRadians(degrees2) {
|
|
|
80897
80883
|
function isNumber(num) {
|
|
80898
80884
|
return !isNaN(num) && num !== null && !Array.isArray(num);
|
|
80899
80885
|
}
|
|
80900
|
-
function isObject$1(input) {
|
|
80901
|
-
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
80902
|
-
}
|
|
80903
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
80904
|
-
if (geojson === null) return;
|
|
80905
|
-
var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
80906
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
80907
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
80908
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
80909
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
80910
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
80911
|
-
var multiFeatureIndex = 0;
|
|
80912
|
-
var geometryIndex = 0;
|
|
80913
|
-
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
80914
|
-
if (geometry2 === null) continue;
|
|
80915
|
-
coords = geometry2.coordinates;
|
|
80916
|
-
var geomType = geometry2.type;
|
|
80917
|
-
wrapShrink = 0;
|
|
80918
|
-
switch (geomType) {
|
|
80919
|
-
case null:
|
|
80920
|
-
break;
|
|
80921
|
-
case "Point":
|
|
80922
|
-
if (callback(
|
|
80923
|
-
coords,
|
|
80924
|
-
coordIndex,
|
|
80925
|
-
featureIndex,
|
|
80926
|
-
multiFeatureIndex,
|
|
80927
|
-
geometryIndex
|
|
80928
|
-
) === false)
|
|
80929
|
-
return false;
|
|
80930
|
-
coordIndex++;
|
|
80931
|
-
multiFeatureIndex++;
|
|
80932
|
-
break;
|
|
80933
|
-
case "LineString":
|
|
80934
|
-
case "MultiPoint":
|
|
80935
|
-
for (j = 0; j < coords.length; j++) {
|
|
80936
|
-
if (callback(
|
|
80937
|
-
coords[j],
|
|
80938
|
-
coordIndex,
|
|
80939
|
-
featureIndex,
|
|
80940
|
-
multiFeatureIndex,
|
|
80941
|
-
geometryIndex
|
|
80942
|
-
) === false)
|
|
80943
|
-
return false;
|
|
80944
|
-
coordIndex++;
|
|
80945
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
80946
|
-
}
|
|
80947
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
80948
|
-
break;
|
|
80949
|
-
case "Polygon":
|
|
80950
|
-
case "MultiLineString":
|
|
80951
|
-
for (j = 0; j < coords.length; j++) {
|
|
80952
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
80953
|
-
if (callback(
|
|
80954
|
-
coords[j][k],
|
|
80955
|
-
coordIndex,
|
|
80956
|
-
featureIndex,
|
|
80957
|
-
multiFeatureIndex,
|
|
80958
|
-
geometryIndex
|
|
80959
|
-
) === false)
|
|
80960
|
-
return false;
|
|
80961
|
-
coordIndex++;
|
|
80962
|
-
}
|
|
80963
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
80964
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
80965
|
-
}
|
|
80966
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
80967
|
-
break;
|
|
80968
|
-
case "MultiPolygon":
|
|
80969
|
-
for (j = 0; j < coords.length; j++) {
|
|
80970
|
-
geometryIndex = 0;
|
|
80971
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
80972
|
-
for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
|
|
80973
|
-
if (callback(
|
|
80974
|
-
coords[j][k][l2],
|
|
80975
|
-
coordIndex,
|
|
80976
|
-
featureIndex,
|
|
80977
|
-
multiFeatureIndex,
|
|
80978
|
-
geometryIndex
|
|
80979
|
-
) === false)
|
|
80980
|
-
return false;
|
|
80981
|
-
coordIndex++;
|
|
80982
|
-
}
|
|
80983
|
-
geometryIndex++;
|
|
80984
|
-
}
|
|
80985
|
-
multiFeatureIndex++;
|
|
80986
|
-
}
|
|
80987
|
-
break;
|
|
80988
|
-
case "GeometryCollection":
|
|
80989
|
-
for (j = 0; j < geometry2.geometries.length; j++)
|
|
80990
|
-
if (coordEach(geometry2.geometries[j], callback) === false)
|
|
80991
|
-
return false;
|
|
80992
|
-
break;
|
|
80993
|
-
default:
|
|
80994
|
-
throw new Error("Unknown Geometry Type");
|
|
80995
|
-
}
|
|
80996
|
-
}
|
|
80997
|
-
}
|
|
80998
|
-
}
|
|
80999
|
-
function featureEach(geojson, callback) {
|
|
81000
|
-
if (geojson.type === "Feature") {
|
|
81001
|
-
callback(geojson, 0);
|
|
81002
|
-
} else if (geojson.type === "FeatureCollection") {
|
|
81003
|
-
for (var i2 = 0; i2 < geojson.features.length; i2++) {
|
|
81004
|
-
if (callback(geojson.features[i2], i2) === false) break;
|
|
81005
|
-
}
|
|
81006
|
-
}
|
|
81007
|
-
}
|
|
81008
|
-
function geomEach(geojson, callback) {
|
|
81009
|
-
var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
81010
|
-
for (i2 = 0; i2 < stop; i2++) {
|
|
81011
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
|
|
81012
|
-
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
|
|
81013
|
-
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
|
|
81014
|
-
featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
|
|
81015
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
81016
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
81017
|
-
for (g2 = 0; g2 < stopG; g2++) {
|
|
81018
|
-
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
|
|
81019
|
-
if (geometry2 === null) {
|
|
81020
|
-
if (callback(
|
|
81021
|
-
null,
|
|
81022
|
-
featureIndex,
|
|
81023
|
-
featureProperties,
|
|
81024
|
-
featureBBox,
|
|
81025
|
-
featureId2
|
|
81026
|
-
) === false)
|
|
81027
|
-
return false;
|
|
81028
|
-
continue;
|
|
81029
|
-
}
|
|
81030
|
-
switch (geometry2.type) {
|
|
81031
|
-
case "Point":
|
|
81032
|
-
case "LineString":
|
|
81033
|
-
case "MultiPoint":
|
|
81034
|
-
case "Polygon":
|
|
81035
|
-
case "MultiLineString":
|
|
81036
|
-
case "MultiPolygon": {
|
|
81037
|
-
if (callback(
|
|
81038
|
-
geometry2,
|
|
81039
|
-
featureIndex,
|
|
81040
|
-
featureProperties,
|
|
81041
|
-
featureBBox,
|
|
81042
|
-
featureId2
|
|
81043
|
-
) === false)
|
|
81044
|
-
return false;
|
|
81045
|
-
break;
|
|
81046
|
-
}
|
|
81047
|
-
case "GeometryCollection": {
|
|
81048
|
-
for (j = 0; j < geometry2.geometries.length; j++) {
|
|
81049
|
-
if (callback(
|
|
81050
|
-
geometry2.geometries[j],
|
|
81051
|
-
featureIndex,
|
|
81052
|
-
featureProperties,
|
|
81053
|
-
featureBBox,
|
|
81054
|
-
featureId2
|
|
81055
|
-
) === false)
|
|
81056
|
-
return false;
|
|
81057
|
-
}
|
|
81058
|
-
break;
|
|
81059
|
-
}
|
|
81060
|
-
default:
|
|
81061
|
-
throw new Error("Unknown Geometry Type");
|
|
81062
|
-
}
|
|
81063
|
-
}
|
|
81064
|
-
featureIndex++;
|
|
81065
|
-
}
|
|
81066
|
-
}
|
|
81067
|
-
function geomReduce(geojson, callback, initialValue) {
|
|
81068
|
-
var previousValue = initialValue;
|
|
81069
|
-
geomEach(
|
|
81070
|
-
geojson,
|
|
81071
|
-
function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
|
|
81072
|
-
previousValue = callback(
|
|
81073
|
-
previousValue,
|
|
81074
|
-
currentGeometry,
|
|
81075
|
-
featureIndex,
|
|
81076
|
-
featureProperties,
|
|
81077
|
-
featureBBox,
|
|
81078
|
-
featureId2
|
|
81079
|
-
);
|
|
81080
|
-
}
|
|
81081
|
-
);
|
|
81082
|
-
return previousValue;
|
|
81083
|
-
}
|
|
81084
|
-
function flattenEach(geojson, callback) {
|
|
81085
|
-
geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
|
|
81086
|
-
var type = geometry2 === null ? null : geometry2.type;
|
|
81087
|
-
switch (type) {
|
|
81088
|
-
case null:
|
|
81089
|
-
case "Point":
|
|
81090
|
-
case "LineString":
|
|
81091
|
-
case "Polygon":
|
|
81092
|
-
if (callback(
|
|
81093
|
-
feature$1(geometry2, properties, { bbox: bbox2, id }),
|
|
81094
|
-
featureIndex,
|
|
81095
|
-
0
|
|
81096
|
-
) === false)
|
|
81097
|
-
return false;
|
|
81098
|
-
return;
|
|
81099
|
-
}
|
|
81100
|
-
var geomType;
|
|
81101
|
-
switch (type) {
|
|
81102
|
-
case "MultiPoint":
|
|
81103
|
-
geomType = "Point";
|
|
81104
|
-
break;
|
|
81105
|
-
case "MultiLineString":
|
|
81106
|
-
geomType = "LineString";
|
|
81107
|
-
break;
|
|
81108
|
-
case "MultiPolygon":
|
|
81109
|
-
geomType = "Polygon";
|
|
81110
|
-
break;
|
|
81111
|
-
}
|
|
81112
|
-
for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
|
|
81113
|
-
var coordinate = geometry2.coordinates[multiFeatureIndex];
|
|
81114
|
-
var geom = {
|
|
81115
|
-
type: geomType,
|
|
81116
|
-
coordinates: coordinate
|
|
81117
|
-
};
|
|
81118
|
-
if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
|
|
81119
|
-
return false;
|
|
81120
|
-
}
|
|
81121
|
-
});
|
|
81122
|
-
}
|
|
81123
|
-
function flattenReduce(geojson, callback, initialValue) {
|
|
81124
|
-
var previousValue = initialValue;
|
|
81125
|
-
flattenEach(
|
|
81126
|
-
geojson,
|
|
81127
|
-
function(currentFeature, featureIndex, multiFeatureIndex) {
|
|
81128
|
-
if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
|
|
81129
|
-
previousValue = currentFeature;
|
|
81130
|
-
else
|
|
81131
|
-
previousValue = callback(
|
|
81132
|
-
previousValue,
|
|
81133
|
-
currentFeature,
|
|
81134
|
-
featureIndex,
|
|
81135
|
-
multiFeatureIndex
|
|
81136
|
-
);
|
|
81137
|
-
}
|
|
81138
|
-
);
|
|
81139
|
-
return previousValue;
|
|
81140
|
-
}
|
|
81141
|
-
function segmentEach(geojson, callback) {
|
|
81142
|
-
flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
81143
|
-
var segmentIndex = 0;
|
|
81144
|
-
if (!feature2.geometry) return;
|
|
81145
|
-
var type = feature2.geometry.type;
|
|
81146
|
-
if (type === "Point" || type === "MultiPoint") return;
|
|
81147
|
-
var previousCoords;
|
|
81148
|
-
var previousFeatureIndex = 0;
|
|
81149
|
-
var previousMultiIndex = 0;
|
|
81150
|
-
var prevGeomIndex = 0;
|
|
81151
|
-
if (coordEach(
|
|
81152
|
-
feature2,
|
|
81153
|
-
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
81154
|
-
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
81155
|
-
previousCoords = currentCoord;
|
|
81156
|
-
previousFeatureIndex = featureIndex;
|
|
81157
|
-
previousMultiIndex = multiPartIndexCoord;
|
|
81158
|
-
prevGeomIndex = geometryIndex;
|
|
81159
|
-
segmentIndex = 0;
|
|
81160
|
-
return;
|
|
81161
|
-
}
|
|
81162
|
-
var currentSegment = lineString(
|
|
81163
|
-
[previousCoords, currentCoord],
|
|
81164
|
-
feature2.properties
|
|
81165
|
-
);
|
|
81166
|
-
if (callback(
|
|
81167
|
-
currentSegment,
|
|
81168
|
-
featureIndex,
|
|
81169
|
-
multiFeatureIndex,
|
|
81170
|
-
geometryIndex,
|
|
81171
|
-
segmentIndex
|
|
81172
|
-
) === false)
|
|
81173
|
-
return false;
|
|
81174
|
-
segmentIndex++;
|
|
81175
|
-
previousCoords = currentCoord;
|
|
81176
|
-
}
|
|
81177
|
-
) === false)
|
|
81178
|
-
return false;
|
|
81179
|
-
});
|
|
81180
|
-
}
|
|
81181
|
-
function bbox$1(geojson, options = {}) {
|
|
81182
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
81183
|
-
return geojson.bbox;
|
|
81184
|
-
}
|
|
81185
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
81186
|
-
coordEach(geojson, (coord) => {
|
|
81187
|
-
if (result[0] > coord[0]) {
|
|
81188
|
-
result[0] = coord[0];
|
|
81189
|
-
}
|
|
81190
|
-
if (result[1] > coord[1]) {
|
|
81191
|
-
result[1] = coord[1];
|
|
81192
|
-
}
|
|
81193
|
-
if (result[2] < coord[0]) {
|
|
81194
|
-
result[2] = coord[0];
|
|
81195
|
-
}
|
|
81196
|
-
if (result[3] < coord[1]) {
|
|
81197
|
-
result[3] = coord[1];
|
|
81198
|
-
}
|
|
81199
|
-
});
|
|
81200
|
-
return result;
|
|
81201
|
-
}
|
|
81202
|
-
function getCoord(coord) {
|
|
81203
|
-
if (!coord) {
|
|
81204
|
-
throw new Error("coord is required");
|
|
81205
|
-
}
|
|
81206
|
-
if (!Array.isArray(coord)) {
|
|
81207
|
-
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
81208
|
-
return [...coord.geometry.coordinates];
|
|
81209
|
-
}
|
|
81210
|
-
if (coord.type === "Point") {
|
|
81211
|
-
return [...coord.coordinates];
|
|
81212
|
-
}
|
|
81213
|
-
}
|
|
81214
|
-
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
81215
|
-
return [...coord];
|
|
81216
|
-
}
|
|
81217
|
-
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
81218
|
-
}
|
|
81219
|
-
function getCoords(coords) {
|
|
81220
|
-
if (Array.isArray(coords)) {
|
|
81221
|
-
return coords;
|
|
81222
|
-
}
|
|
81223
|
-
if (coords.type === "Feature") {
|
|
81224
|
-
if (coords.geometry !== null) {
|
|
81225
|
-
return coords.geometry.coordinates;
|
|
81226
|
-
}
|
|
81227
|
-
} else {
|
|
81228
|
-
if (coords.coordinates) {
|
|
81229
|
-
return coords.coordinates;
|
|
81230
|
-
}
|
|
81231
|
-
}
|
|
81232
|
-
throw new Error(
|
|
81233
|
-
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
81234
|
-
);
|
|
81235
|
-
}
|
|
81236
|
-
function getGeom(geojson) {
|
|
81237
|
-
if (geojson.type === "Feature") {
|
|
81238
|
-
return geojson.geometry;
|
|
81239
|
-
}
|
|
81240
|
-
return geojson;
|
|
81241
|
-
}
|
|
81242
|
-
function booleanPointOnLine(pt, line, options = {}) {
|
|
81243
|
-
const ptCoords = getCoord(pt);
|
|
81244
|
-
const lineCoords = getCoords(line);
|
|
81245
|
-
for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
|
|
81246
|
-
let ignoreBoundary = false;
|
|
81247
|
-
if (options.ignoreEndVertices) {
|
|
81248
|
-
if (i2 === 0) {
|
|
81249
|
-
ignoreBoundary = "start";
|
|
81250
|
-
}
|
|
81251
|
-
if (i2 === lineCoords.length - 2) {
|
|
81252
|
-
ignoreBoundary = "end";
|
|
81253
|
-
}
|
|
81254
|
-
if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
|
|
81255
|
-
ignoreBoundary = "both";
|
|
81256
|
-
}
|
|
81257
|
-
}
|
|
81258
|
-
if (isPointOnLineSegment(
|
|
81259
|
-
lineCoords[i2],
|
|
81260
|
-
lineCoords[i2 + 1],
|
|
81261
|
-
ptCoords,
|
|
81262
|
-
ignoreBoundary,
|
|
81263
|
-
typeof options.epsilon === "undefined" ? null : options.epsilon
|
|
81264
|
-
)) {
|
|
81265
|
-
return true;
|
|
81266
|
-
}
|
|
81267
|
-
}
|
|
81268
|
-
return false;
|
|
81269
|
-
}
|
|
81270
|
-
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
|
|
81271
|
-
const x = pt[0];
|
|
81272
|
-
const y = pt[1];
|
|
81273
|
-
const x12 = lineSegmentStart[0];
|
|
81274
|
-
const y12 = lineSegmentStart[1];
|
|
81275
|
-
const x2 = lineSegmentEnd[0];
|
|
81276
|
-
const y2 = lineSegmentEnd[1];
|
|
81277
|
-
const dxc = pt[0] - x12;
|
|
81278
|
-
const dyc = pt[1] - y12;
|
|
81279
|
-
const dxl = x2 - x12;
|
|
81280
|
-
const dyl = y2 - y12;
|
|
81281
|
-
const cross2 = dxc * dyl - dyc * dxl;
|
|
81282
|
-
if (epsilon3 !== null) {
|
|
81283
|
-
if (Math.abs(cross2) > epsilon3) {
|
|
81284
|
-
return false;
|
|
81285
|
-
}
|
|
81286
|
-
} else if (cross2 !== 0) {
|
|
81287
|
-
return false;
|
|
81288
|
-
}
|
|
81289
|
-
if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
|
|
81290
|
-
if (excludeBoundary) {
|
|
81291
|
-
return false;
|
|
81292
|
-
}
|
|
81293
|
-
if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
|
|
81294
|
-
return true;
|
|
81295
|
-
} else {
|
|
81296
|
-
return false;
|
|
81297
|
-
}
|
|
81298
|
-
}
|
|
81299
|
-
if (!excludeBoundary) {
|
|
81300
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
81301
|
-
return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
|
|
81302
|
-
}
|
|
81303
|
-
return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
|
|
81304
|
-
} else if (excludeBoundary === "start") {
|
|
81305
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
81306
|
-
return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
|
|
81307
|
-
}
|
|
81308
|
-
return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
|
|
81309
|
-
} else if (excludeBoundary === "end") {
|
|
81310
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
81311
|
-
return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
|
|
81312
|
-
}
|
|
81313
|
-
return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
|
|
81314
|
-
} else if (excludeBoundary === "both") {
|
|
81315
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
81316
|
-
return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
|
|
81317
|
-
}
|
|
81318
|
-
return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
|
|
81319
|
-
}
|
|
81320
|
-
return false;
|
|
81321
|
-
}
|
|
81322
80886
|
const epsilon$1 = 11102230246251565e-32;
|
|
81323
80887
|
const splitter = 134217729;
|
|
81324
80888
|
const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
|
|
@@ -81615,6 +81179,29 @@ function pointInPolygon(p, polygon2) {
|
|
|
81615
81179
|
}
|
|
81616
81180
|
return true;
|
|
81617
81181
|
}
|
|
81182
|
+
function getCoord(coord) {
|
|
81183
|
+
if (!coord) {
|
|
81184
|
+
throw new Error("coord is required");
|
|
81185
|
+
}
|
|
81186
|
+
if (!Array.isArray(coord)) {
|
|
81187
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
81188
|
+
return [...coord.geometry.coordinates];
|
|
81189
|
+
}
|
|
81190
|
+
if (coord.type === "Point") {
|
|
81191
|
+
return [...coord.coordinates];
|
|
81192
|
+
}
|
|
81193
|
+
}
|
|
81194
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
81195
|
+
return [...coord];
|
|
81196
|
+
}
|
|
81197
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
81198
|
+
}
|
|
81199
|
+
function getGeom(geojson) {
|
|
81200
|
+
if (geojson.type === "Feature") {
|
|
81201
|
+
return geojson.geometry;
|
|
81202
|
+
}
|
|
81203
|
+
return geojson;
|
|
81204
|
+
}
|
|
81618
81205
|
function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
81619
81206
|
if (!point2) {
|
|
81620
81207
|
throw new Error("point is required");
|
|
@@ -81625,9 +81212,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
81625
81212
|
const pt = getCoord(point2);
|
|
81626
81213
|
const geom = getGeom(polygon2);
|
|
81627
81214
|
const type = geom.type;
|
|
81628
|
-
const
|
|
81215
|
+
const bbox = polygon2.bbox;
|
|
81629
81216
|
let polys = geom.coordinates;
|
|
81630
|
-
if (
|
|
81217
|
+
if (bbox && inBBox(pt, bbox) === false) {
|
|
81631
81218
|
return false;
|
|
81632
81219
|
}
|
|
81633
81220
|
if (type === "Polygon") {
|
|
@@ -81641,1607 +81228,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
81641
81228
|
}
|
|
81642
81229
|
return result;
|
|
81643
81230
|
}
|
|
81644
|
-
function inBBox(pt,
|
|
81645
|
-
return
|
|
81646
|
-
}
|
|
81647
|
-
function booleanWithin(feature1, feature2) {
|
|
81648
|
-
var geom1 = getGeom(feature1);
|
|
81649
|
-
var geom2 = getGeom(feature2);
|
|
81650
|
-
var type1 = geom1.type;
|
|
81651
|
-
var type2 = geom2.type;
|
|
81652
|
-
switch (type1) {
|
|
81653
|
-
case "Point":
|
|
81654
|
-
switch (type2) {
|
|
81655
|
-
case "MultiPoint":
|
|
81656
|
-
return isPointInMultiPoint$1(geom1, geom2);
|
|
81657
|
-
case "LineString":
|
|
81658
|
-
return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
|
|
81659
|
-
case "Polygon":
|
|
81660
|
-
case "MultiPolygon":
|
|
81661
|
-
return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
|
|
81662
|
-
default:
|
|
81663
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81664
|
-
}
|
|
81665
|
-
case "MultiPoint":
|
|
81666
|
-
switch (type2) {
|
|
81667
|
-
case "MultiPoint":
|
|
81668
|
-
return isMultiPointInMultiPoint$1(geom1, geom2);
|
|
81669
|
-
case "LineString":
|
|
81670
|
-
return isMultiPointOnLine$1(geom1, geom2);
|
|
81671
|
-
case "Polygon":
|
|
81672
|
-
case "MultiPolygon":
|
|
81673
|
-
return isMultiPointInPoly$1(geom1, geom2);
|
|
81674
|
-
default:
|
|
81675
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81676
|
-
}
|
|
81677
|
-
case "LineString":
|
|
81678
|
-
switch (type2) {
|
|
81679
|
-
case "LineString":
|
|
81680
|
-
return isLineOnLine$1(geom1, geom2);
|
|
81681
|
-
case "Polygon":
|
|
81682
|
-
case "MultiPolygon":
|
|
81683
|
-
return isLineInPoly$1(geom1, geom2);
|
|
81684
|
-
default:
|
|
81685
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81686
|
-
}
|
|
81687
|
-
case "Polygon":
|
|
81688
|
-
switch (type2) {
|
|
81689
|
-
case "Polygon":
|
|
81690
|
-
case "MultiPolygon":
|
|
81691
|
-
return isPolyInPoly$1(geom1, geom2);
|
|
81692
|
-
default:
|
|
81693
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81694
|
-
}
|
|
81695
|
-
default:
|
|
81696
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
81697
|
-
}
|
|
81698
|
-
}
|
|
81699
|
-
function isPointInMultiPoint$1(point2, multiPoint) {
|
|
81700
|
-
var i2;
|
|
81701
|
-
var output = false;
|
|
81702
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
81703
|
-
if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
|
|
81704
|
-
output = true;
|
|
81705
|
-
break;
|
|
81706
|
-
}
|
|
81707
|
-
}
|
|
81708
|
-
return output;
|
|
81709
|
-
}
|
|
81710
|
-
function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
|
|
81711
|
-
for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
|
|
81712
|
-
var anyMatch = false;
|
|
81713
|
-
for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
|
|
81714
|
-
if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
|
|
81715
|
-
anyMatch = true;
|
|
81716
|
-
}
|
|
81717
|
-
}
|
|
81718
|
-
if (!anyMatch) {
|
|
81719
|
-
return false;
|
|
81720
|
-
}
|
|
81721
|
-
}
|
|
81722
|
-
return true;
|
|
81723
|
-
}
|
|
81724
|
-
function isMultiPointOnLine$1(multiPoint, lineString2) {
|
|
81725
|
-
var foundInsidePoint = false;
|
|
81726
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
81727
|
-
if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
|
|
81728
|
-
return false;
|
|
81729
|
-
}
|
|
81730
|
-
if (!foundInsidePoint) {
|
|
81731
|
-
foundInsidePoint = booleanPointOnLine(
|
|
81732
|
-
multiPoint.coordinates[i2],
|
|
81733
|
-
lineString2,
|
|
81734
|
-
{ ignoreEndVertices: true }
|
|
81735
|
-
);
|
|
81736
|
-
}
|
|
81737
|
-
}
|
|
81738
|
-
return foundInsidePoint;
|
|
81739
|
-
}
|
|
81740
|
-
function isMultiPointInPoly$1(multiPoint, polygon2) {
|
|
81741
|
-
var output = true;
|
|
81742
|
-
var isInside = false;
|
|
81743
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
81744
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
|
|
81745
|
-
if (!isInside) {
|
|
81746
|
-
output = false;
|
|
81747
|
-
break;
|
|
81748
|
-
}
|
|
81749
|
-
{
|
|
81750
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
|
|
81751
|
-
ignoreBoundary: true
|
|
81752
|
-
});
|
|
81753
|
-
}
|
|
81754
|
-
}
|
|
81755
|
-
return output && isInside;
|
|
81756
|
-
}
|
|
81757
|
-
function isLineOnLine$1(lineString1, lineString2) {
|
|
81758
|
-
for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
|
|
81759
|
-
if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
|
|
81760
|
-
return false;
|
|
81761
|
-
}
|
|
81762
|
-
}
|
|
81763
|
-
return true;
|
|
81764
|
-
}
|
|
81765
|
-
function isLineInPoly$1(linestring, polygon2) {
|
|
81766
|
-
var polyBbox = bbox$1(polygon2);
|
|
81767
|
-
var lineBbox = bbox$1(linestring);
|
|
81768
|
-
if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
|
|
81769
|
-
return false;
|
|
81770
|
-
}
|
|
81771
|
-
var foundInsidePoint = false;
|
|
81772
|
-
for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
|
|
81773
|
-
if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
|
|
81774
|
-
return false;
|
|
81775
|
-
}
|
|
81776
|
-
if (!foundInsidePoint) {
|
|
81777
|
-
foundInsidePoint = booleanPointInPolygon(
|
|
81778
|
-
linestring.coordinates[i2],
|
|
81779
|
-
polygon2,
|
|
81780
|
-
{ ignoreBoundary: true }
|
|
81781
|
-
);
|
|
81782
|
-
}
|
|
81783
|
-
if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
|
|
81784
|
-
var midpoint = getMidpoint$1(
|
|
81785
|
-
linestring.coordinates[i2],
|
|
81786
|
-
linestring.coordinates[i2 + 1]
|
|
81787
|
-
);
|
|
81788
|
-
foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
|
|
81789
|
-
ignoreBoundary: true
|
|
81790
|
-
});
|
|
81791
|
-
}
|
|
81792
|
-
}
|
|
81793
|
-
return foundInsidePoint;
|
|
81794
|
-
}
|
|
81795
|
-
function isPolyInPoly$1(geometry1, geometry2) {
|
|
81796
|
-
var poly1Bbox = bbox$1(geometry1);
|
|
81797
|
-
var poly2Bbox = bbox$1(geometry2);
|
|
81798
|
-
if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
|
|
81799
|
-
return false;
|
|
81800
|
-
}
|
|
81801
|
-
for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
|
|
81802
|
-
if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
|
|
81803
|
-
return false;
|
|
81804
|
-
}
|
|
81805
|
-
}
|
|
81806
|
-
return true;
|
|
81807
|
-
}
|
|
81808
|
-
function doBBoxOverlap$1(bbox1, bbox2) {
|
|
81809
|
-
if (bbox1[0] > bbox2[0]) return false;
|
|
81810
|
-
if (bbox1[2] < bbox2[2]) return false;
|
|
81811
|
-
if (bbox1[1] > bbox2[1]) return false;
|
|
81812
|
-
if (bbox1[3] < bbox2[3]) return false;
|
|
81813
|
-
return true;
|
|
81814
|
-
}
|
|
81815
|
-
function compareCoords$1(pair1, pair2) {
|
|
81816
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
81817
|
-
}
|
|
81818
|
-
function getMidpoint$1(pair1, pair2) {
|
|
81819
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
81820
|
-
}
|
|
81821
|
-
function booleanContains(feature1, feature2) {
|
|
81822
|
-
const geom1 = getGeom(feature1);
|
|
81823
|
-
const geom2 = getGeom(feature2);
|
|
81824
|
-
const type1 = geom1.type;
|
|
81825
|
-
const type2 = geom2.type;
|
|
81826
|
-
const coords1 = geom1.coordinates;
|
|
81827
|
-
const coords2 = geom2.coordinates;
|
|
81828
|
-
switch (type1) {
|
|
81829
|
-
case "Point":
|
|
81830
|
-
switch (type2) {
|
|
81831
|
-
case "Point":
|
|
81832
|
-
return compareCoords(coords1, coords2);
|
|
81833
|
-
default:
|
|
81834
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81835
|
-
}
|
|
81836
|
-
case "MultiPoint":
|
|
81837
|
-
switch (type2) {
|
|
81838
|
-
case "Point":
|
|
81839
|
-
return isPointInMultiPoint(geom1, geom2);
|
|
81840
|
-
case "MultiPoint":
|
|
81841
|
-
return isMultiPointInMultiPoint(geom1, geom2);
|
|
81842
|
-
default:
|
|
81843
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81844
|
-
}
|
|
81845
|
-
case "LineString":
|
|
81846
|
-
switch (type2) {
|
|
81847
|
-
case "Point":
|
|
81848
|
-
return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
|
|
81849
|
-
case "LineString":
|
|
81850
|
-
return isLineOnLine(geom1, geom2);
|
|
81851
|
-
case "MultiPoint":
|
|
81852
|
-
return isMultiPointOnLine(geom1, geom2);
|
|
81853
|
-
default:
|
|
81854
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81855
|
-
}
|
|
81856
|
-
case "Polygon":
|
|
81857
|
-
switch (type2) {
|
|
81858
|
-
case "Point":
|
|
81859
|
-
return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
|
|
81860
|
-
case "LineString":
|
|
81861
|
-
return isLineInPoly(geom1, geom2);
|
|
81862
|
-
case "Polygon":
|
|
81863
|
-
return isPolyInPoly(geom1, geom2);
|
|
81864
|
-
case "MultiPoint":
|
|
81865
|
-
return isMultiPointInPoly(geom1, geom2);
|
|
81866
|
-
default:
|
|
81867
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81868
|
-
}
|
|
81869
|
-
case "MultiPolygon":
|
|
81870
|
-
switch (type2) {
|
|
81871
|
-
case "Polygon":
|
|
81872
|
-
return isPolygonInMultiPolygon(geom1, geom2);
|
|
81873
|
-
default:
|
|
81874
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
81875
|
-
}
|
|
81876
|
-
default:
|
|
81877
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
81878
|
-
}
|
|
81879
|
-
}
|
|
81880
|
-
function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
|
|
81881
|
-
return multiPolygon2.coordinates.some(
|
|
81882
|
-
(coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
|
|
81883
|
-
);
|
|
81884
|
-
}
|
|
81885
|
-
function isPointInMultiPoint(multiPoint, pt) {
|
|
81886
|
-
let i2;
|
|
81887
|
-
let output = false;
|
|
81888
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
81889
|
-
if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
|
|
81890
|
-
output = true;
|
|
81891
|
-
break;
|
|
81892
|
-
}
|
|
81893
|
-
}
|
|
81894
|
-
return output;
|
|
81895
|
-
}
|
|
81896
|
-
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
81897
|
-
for (const coord2 of multiPoint2.coordinates) {
|
|
81898
|
-
let matchFound = false;
|
|
81899
|
-
for (const coord1 of multiPoint1.coordinates) {
|
|
81900
|
-
if (compareCoords(coord2, coord1)) {
|
|
81901
|
-
matchFound = true;
|
|
81902
|
-
break;
|
|
81903
|
-
}
|
|
81904
|
-
}
|
|
81905
|
-
if (!matchFound) {
|
|
81906
|
-
return false;
|
|
81907
|
-
}
|
|
81908
|
-
}
|
|
81909
|
-
return true;
|
|
81910
|
-
}
|
|
81911
|
-
function isMultiPointOnLine(lineString2, multiPoint) {
|
|
81912
|
-
let haveFoundInteriorPoint = false;
|
|
81913
|
-
for (const coord of multiPoint.coordinates) {
|
|
81914
|
-
if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
|
|
81915
|
-
haveFoundInteriorPoint = true;
|
|
81916
|
-
}
|
|
81917
|
-
if (!booleanPointOnLine(coord, lineString2)) {
|
|
81918
|
-
return false;
|
|
81919
|
-
}
|
|
81920
|
-
}
|
|
81921
|
-
if (haveFoundInteriorPoint) {
|
|
81922
|
-
return true;
|
|
81923
|
-
}
|
|
81924
|
-
return false;
|
|
81925
|
-
}
|
|
81926
|
-
function isMultiPointInPoly(polygon2, multiPoint) {
|
|
81927
|
-
for (const coord of multiPoint.coordinates) {
|
|
81928
|
-
if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
|
|
81929
|
-
return false;
|
|
81930
|
-
}
|
|
81931
|
-
}
|
|
81932
|
-
return true;
|
|
81933
|
-
}
|
|
81934
|
-
function isLineOnLine(lineString1, lineString2) {
|
|
81935
|
-
let haveFoundInteriorPoint = false;
|
|
81936
|
-
for (const coords of lineString2.coordinates) {
|
|
81937
|
-
if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
81938
|
-
ignoreEndVertices: true
|
|
81939
|
-
})) {
|
|
81940
|
-
haveFoundInteriorPoint = true;
|
|
81941
|
-
}
|
|
81942
|
-
if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
81943
|
-
ignoreEndVertices: false
|
|
81944
|
-
})) {
|
|
81945
|
-
return false;
|
|
81946
|
-
}
|
|
81947
|
-
}
|
|
81948
|
-
return haveFoundInteriorPoint;
|
|
81949
|
-
}
|
|
81950
|
-
function isLineInPoly(polygon2, linestring) {
|
|
81951
|
-
let output = false;
|
|
81952
|
-
let i2 = 0;
|
|
81953
|
-
const polyBbox = bbox$1(polygon2);
|
|
81954
|
-
const lineBbox = bbox$1(linestring);
|
|
81955
|
-
if (!doBBoxOverlap(polyBbox, lineBbox)) {
|
|
81956
|
-
return false;
|
|
81957
|
-
}
|
|
81958
|
-
for (i2; i2 < linestring.coordinates.length - 1; i2++) {
|
|
81959
|
-
const midPoint = getMidpoint(
|
|
81960
|
-
linestring.coordinates[i2],
|
|
81961
|
-
linestring.coordinates[i2 + 1]
|
|
81962
|
-
);
|
|
81963
|
-
if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
|
|
81964
|
-
ignoreBoundary: true
|
|
81965
|
-
})) {
|
|
81966
|
-
output = true;
|
|
81967
|
-
break;
|
|
81968
|
-
}
|
|
81969
|
-
}
|
|
81970
|
-
return output;
|
|
81971
|
-
}
|
|
81972
|
-
function isPolyInPoly(feature1, feature2) {
|
|
81973
|
-
if (feature1.type === "Feature" && feature1.geometry === null) {
|
|
81974
|
-
return false;
|
|
81975
|
-
}
|
|
81976
|
-
if (feature2.type === "Feature" && feature2.geometry === null) {
|
|
81977
|
-
return false;
|
|
81978
|
-
}
|
|
81979
|
-
const poly1Bbox = bbox$1(feature1);
|
|
81980
|
-
const poly2Bbox = bbox$1(feature2);
|
|
81981
|
-
if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
|
|
81982
|
-
return false;
|
|
81983
|
-
}
|
|
81984
|
-
const coords = getGeom(feature2).coordinates;
|
|
81985
|
-
for (const ring of coords) {
|
|
81986
|
-
for (const coord of ring) {
|
|
81987
|
-
if (!booleanPointInPolygon(coord, feature1)) {
|
|
81988
|
-
return false;
|
|
81989
|
-
}
|
|
81990
|
-
}
|
|
81991
|
-
}
|
|
81992
|
-
return true;
|
|
81993
|
-
}
|
|
81994
|
-
function doBBoxOverlap(bbox1, bbox2) {
|
|
81995
|
-
if (bbox1[0] > bbox2[0]) {
|
|
81996
|
-
return false;
|
|
81997
|
-
}
|
|
81998
|
-
if (bbox1[2] < bbox2[2]) {
|
|
81999
|
-
return false;
|
|
82000
|
-
}
|
|
82001
|
-
if (bbox1[1] > bbox2[1]) {
|
|
82002
|
-
return false;
|
|
82003
|
-
}
|
|
82004
|
-
if (bbox1[3] < bbox2[3]) {
|
|
82005
|
-
return false;
|
|
82006
|
-
}
|
|
82007
|
-
return true;
|
|
82008
|
-
}
|
|
82009
|
-
function compareCoords(pair1, pair2) {
|
|
82010
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
82011
|
-
}
|
|
82012
|
-
function getMidpoint(pair1, pair2) {
|
|
82013
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
82014
|
-
}
|
|
82015
|
-
function quickselect(arr, k, left, right, compare2) {
|
|
82016
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
|
|
82017
|
-
}
|
|
82018
|
-
function quickselectStep(arr, k, left, right, compare2) {
|
|
82019
|
-
while (right > left) {
|
|
82020
|
-
if (right - left > 600) {
|
|
82021
|
-
var n3 = right - left + 1;
|
|
82022
|
-
var m = k - left + 1;
|
|
82023
|
-
var z = Math.log(n3);
|
|
82024
|
-
var s2 = 0.5 * Math.exp(2 * z / 3);
|
|
82025
|
-
var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
82026
|
-
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
82027
|
-
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
82028
|
-
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
82029
|
-
}
|
|
82030
|
-
var t = arr[k];
|
|
82031
|
-
var i2 = left;
|
|
82032
|
-
var j = right;
|
|
82033
|
-
swap(arr, left, k);
|
|
82034
|
-
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
82035
|
-
while (i2 < j) {
|
|
82036
|
-
swap(arr, i2, j);
|
|
82037
|
-
i2++;
|
|
82038
|
-
j--;
|
|
82039
|
-
while (compare2(arr[i2], t) < 0) i2++;
|
|
82040
|
-
while (compare2(arr[j], t) > 0) j--;
|
|
82041
|
-
}
|
|
82042
|
-
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
82043
|
-
else {
|
|
82044
|
-
j++;
|
|
82045
|
-
swap(arr, j, right);
|
|
82046
|
-
}
|
|
82047
|
-
if (j <= k) left = j + 1;
|
|
82048
|
-
if (k <= j) right = j - 1;
|
|
82049
|
-
}
|
|
82050
|
-
}
|
|
82051
|
-
function swap(arr, i2, j) {
|
|
82052
|
-
var tmp = arr[i2];
|
|
82053
|
-
arr[i2] = arr[j];
|
|
82054
|
-
arr[j] = tmp;
|
|
82055
|
-
}
|
|
82056
|
-
function defaultCompare$1(a2, b) {
|
|
82057
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
82058
|
-
}
|
|
82059
|
-
class RBush {
|
|
82060
|
-
constructor(maxEntries = 9) {
|
|
82061
|
-
this._maxEntries = Math.max(4, maxEntries);
|
|
82062
|
-
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
|
82063
|
-
this.clear();
|
|
82064
|
-
}
|
|
82065
|
-
all() {
|
|
82066
|
-
return this._all(this.data, []);
|
|
82067
|
-
}
|
|
82068
|
-
search(bbox2) {
|
|
82069
|
-
let node2 = this.data;
|
|
82070
|
-
const result = [];
|
|
82071
|
-
if (!intersects(bbox2, node2)) return result;
|
|
82072
|
-
const toBBox = this.toBBox;
|
|
82073
|
-
const nodesToSearch = [];
|
|
82074
|
-
while (node2) {
|
|
82075
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
82076
|
-
const child = node2.children[i2];
|
|
82077
|
-
const childBBox = node2.leaf ? toBBox(child) : child;
|
|
82078
|
-
if (intersects(bbox2, childBBox)) {
|
|
82079
|
-
if (node2.leaf) result.push(child);
|
|
82080
|
-
else if (contains$1(bbox2, childBBox)) this._all(child, result);
|
|
82081
|
-
else nodesToSearch.push(child);
|
|
82082
|
-
}
|
|
82083
|
-
}
|
|
82084
|
-
node2 = nodesToSearch.pop();
|
|
82085
|
-
}
|
|
82086
|
-
return result;
|
|
82087
|
-
}
|
|
82088
|
-
collides(bbox2) {
|
|
82089
|
-
let node2 = this.data;
|
|
82090
|
-
if (!intersects(bbox2, node2)) return false;
|
|
82091
|
-
const nodesToSearch = [];
|
|
82092
|
-
while (node2) {
|
|
82093
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
82094
|
-
const child = node2.children[i2];
|
|
82095
|
-
const childBBox = node2.leaf ? this.toBBox(child) : child;
|
|
82096
|
-
if (intersects(bbox2, childBBox)) {
|
|
82097
|
-
if (node2.leaf || contains$1(bbox2, childBBox)) return true;
|
|
82098
|
-
nodesToSearch.push(child);
|
|
82099
|
-
}
|
|
82100
|
-
}
|
|
82101
|
-
node2 = nodesToSearch.pop();
|
|
82102
|
-
}
|
|
82103
|
-
return false;
|
|
82104
|
-
}
|
|
82105
|
-
load(data) {
|
|
82106
|
-
if (!(data && data.length)) return this;
|
|
82107
|
-
if (data.length < this._minEntries) {
|
|
82108
|
-
for (let i2 = 0; i2 < data.length; i2++) {
|
|
82109
|
-
this.insert(data[i2]);
|
|
82110
|
-
}
|
|
82111
|
-
return this;
|
|
82112
|
-
}
|
|
82113
|
-
let node2 = this._build(data.slice(), 0, data.length - 1, 0);
|
|
82114
|
-
if (!this.data.children.length) {
|
|
82115
|
-
this.data = node2;
|
|
82116
|
-
} else if (this.data.height === node2.height) {
|
|
82117
|
-
this._splitRoot(this.data, node2);
|
|
82118
|
-
} else {
|
|
82119
|
-
if (this.data.height < node2.height) {
|
|
82120
|
-
const tmpNode = this.data;
|
|
82121
|
-
this.data = node2;
|
|
82122
|
-
node2 = tmpNode;
|
|
82123
|
-
}
|
|
82124
|
-
this._insert(node2, this.data.height - node2.height - 1, true);
|
|
82125
|
-
}
|
|
82126
|
-
return this;
|
|
82127
|
-
}
|
|
82128
|
-
insert(item) {
|
|
82129
|
-
if (item) this._insert(item, this.data.height - 1);
|
|
82130
|
-
return this;
|
|
82131
|
-
}
|
|
82132
|
-
clear() {
|
|
82133
|
-
this.data = createNode([]);
|
|
82134
|
-
return this;
|
|
82135
|
-
}
|
|
82136
|
-
remove(item, equalsFn) {
|
|
82137
|
-
if (!item) return this;
|
|
82138
|
-
let node2 = this.data;
|
|
82139
|
-
const bbox2 = this.toBBox(item);
|
|
82140
|
-
const path = [];
|
|
82141
|
-
const indexes = [];
|
|
82142
|
-
let i2, parent, goingUp;
|
|
82143
|
-
while (node2 || path.length) {
|
|
82144
|
-
if (!node2) {
|
|
82145
|
-
node2 = path.pop();
|
|
82146
|
-
parent = path[path.length - 1];
|
|
82147
|
-
i2 = indexes.pop();
|
|
82148
|
-
goingUp = true;
|
|
82149
|
-
}
|
|
82150
|
-
if (node2.leaf) {
|
|
82151
|
-
const index2 = findItem(item, node2.children, equalsFn);
|
|
82152
|
-
if (index2 !== -1) {
|
|
82153
|
-
node2.children.splice(index2, 1);
|
|
82154
|
-
path.push(node2);
|
|
82155
|
-
this._condense(path);
|
|
82156
|
-
return this;
|
|
82157
|
-
}
|
|
82158
|
-
}
|
|
82159
|
-
if (!goingUp && !node2.leaf && contains$1(node2, bbox2)) {
|
|
82160
|
-
path.push(node2);
|
|
82161
|
-
indexes.push(i2);
|
|
82162
|
-
i2 = 0;
|
|
82163
|
-
parent = node2;
|
|
82164
|
-
node2 = node2.children[0];
|
|
82165
|
-
} else if (parent) {
|
|
82166
|
-
i2++;
|
|
82167
|
-
node2 = parent.children[i2];
|
|
82168
|
-
goingUp = false;
|
|
82169
|
-
} else node2 = null;
|
|
82170
|
-
}
|
|
82171
|
-
return this;
|
|
82172
|
-
}
|
|
82173
|
-
toBBox(item) {
|
|
82174
|
-
return item;
|
|
82175
|
-
}
|
|
82176
|
-
compareMinX(a2, b) {
|
|
82177
|
-
return a2.minX - b.minX;
|
|
82178
|
-
}
|
|
82179
|
-
compareMinY(a2, b) {
|
|
82180
|
-
return a2.minY - b.minY;
|
|
82181
|
-
}
|
|
82182
|
-
toJSON() {
|
|
82183
|
-
return this.data;
|
|
82184
|
-
}
|
|
82185
|
-
fromJSON(data) {
|
|
82186
|
-
this.data = data;
|
|
82187
|
-
return this;
|
|
82188
|
-
}
|
|
82189
|
-
_all(node2, result) {
|
|
82190
|
-
const nodesToSearch = [];
|
|
82191
|
-
while (node2) {
|
|
82192
|
-
if (node2.leaf) result.push(...node2.children);
|
|
82193
|
-
else nodesToSearch.push(...node2.children);
|
|
82194
|
-
node2 = nodesToSearch.pop();
|
|
82195
|
-
}
|
|
82196
|
-
return result;
|
|
82197
|
-
}
|
|
82198
|
-
_build(items, left, right, height) {
|
|
82199
|
-
const N2 = right - left + 1;
|
|
82200
|
-
let M = this._maxEntries;
|
|
82201
|
-
let node2;
|
|
82202
|
-
if (N2 <= M) {
|
|
82203
|
-
node2 = createNode(items.slice(left, right + 1));
|
|
82204
|
-
calcBBox(node2, this.toBBox);
|
|
82205
|
-
return node2;
|
|
82206
|
-
}
|
|
82207
|
-
if (!height) {
|
|
82208
|
-
height = Math.ceil(Math.log(N2) / Math.log(M));
|
|
82209
|
-
M = Math.ceil(N2 / Math.pow(M, height - 1));
|
|
82210
|
-
}
|
|
82211
|
-
node2 = createNode([]);
|
|
82212
|
-
node2.leaf = false;
|
|
82213
|
-
node2.height = height;
|
|
82214
|
-
const N22 = Math.ceil(N2 / M);
|
|
82215
|
-
const N1 = N22 * Math.ceil(Math.sqrt(M));
|
|
82216
|
-
multiSelect(items, left, right, N1, this.compareMinX);
|
|
82217
|
-
for (let i2 = left; i2 <= right; i2 += N1) {
|
|
82218
|
-
const right2 = Math.min(i2 + N1 - 1, right);
|
|
82219
|
-
multiSelect(items, i2, right2, N22, this.compareMinY);
|
|
82220
|
-
for (let j = i2; j <= right2; j += N22) {
|
|
82221
|
-
const right3 = Math.min(j + N22 - 1, right2);
|
|
82222
|
-
node2.children.push(this._build(items, j, right3, height - 1));
|
|
82223
|
-
}
|
|
82224
|
-
}
|
|
82225
|
-
calcBBox(node2, this.toBBox);
|
|
82226
|
-
return node2;
|
|
82227
|
-
}
|
|
82228
|
-
_chooseSubtree(bbox2, node2, level, path) {
|
|
82229
|
-
while (true) {
|
|
82230
|
-
path.push(node2);
|
|
82231
|
-
if (node2.leaf || path.length - 1 === level) break;
|
|
82232
|
-
let minArea = Infinity;
|
|
82233
|
-
let minEnlargement = Infinity;
|
|
82234
|
-
let targetNode;
|
|
82235
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
82236
|
-
const child = node2.children[i2];
|
|
82237
|
-
const area2 = bboxArea(child);
|
|
82238
|
-
const enlargement = enlargedArea(bbox2, child) - area2;
|
|
82239
|
-
if (enlargement < minEnlargement) {
|
|
82240
|
-
minEnlargement = enlargement;
|
|
82241
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
82242
|
-
targetNode = child;
|
|
82243
|
-
} else if (enlargement === minEnlargement) {
|
|
82244
|
-
if (area2 < minArea) {
|
|
82245
|
-
minArea = area2;
|
|
82246
|
-
targetNode = child;
|
|
82247
|
-
}
|
|
82248
|
-
}
|
|
82249
|
-
}
|
|
82250
|
-
node2 = targetNode || node2.children[0];
|
|
82251
|
-
}
|
|
82252
|
-
return node2;
|
|
82253
|
-
}
|
|
82254
|
-
_insert(item, level, isNode2) {
|
|
82255
|
-
const bbox2 = isNode2 ? item : this.toBBox(item);
|
|
82256
|
-
const insertPath = [];
|
|
82257
|
-
const node2 = this._chooseSubtree(bbox2, this.data, level, insertPath);
|
|
82258
|
-
node2.children.push(item);
|
|
82259
|
-
extend(node2, bbox2);
|
|
82260
|
-
while (level >= 0) {
|
|
82261
|
-
if (insertPath[level].children.length > this._maxEntries) {
|
|
82262
|
-
this._split(insertPath, level);
|
|
82263
|
-
level--;
|
|
82264
|
-
} else break;
|
|
82265
|
-
}
|
|
82266
|
-
this._adjustParentBBoxes(bbox2, insertPath, level);
|
|
82267
|
-
}
|
|
82268
|
-
// split overflowed node into two
|
|
82269
|
-
_split(insertPath, level) {
|
|
82270
|
-
const node2 = insertPath[level];
|
|
82271
|
-
const M = node2.children.length;
|
|
82272
|
-
const m = this._minEntries;
|
|
82273
|
-
this._chooseSplitAxis(node2, m, M);
|
|
82274
|
-
const splitIndex = this._chooseSplitIndex(node2, m, M);
|
|
82275
|
-
const newNode = createNode(node2.children.splice(splitIndex, node2.children.length - splitIndex));
|
|
82276
|
-
newNode.height = node2.height;
|
|
82277
|
-
newNode.leaf = node2.leaf;
|
|
82278
|
-
calcBBox(node2, this.toBBox);
|
|
82279
|
-
calcBBox(newNode, this.toBBox);
|
|
82280
|
-
if (level) insertPath[level - 1].children.push(newNode);
|
|
82281
|
-
else this._splitRoot(node2, newNode);
|
|
82282
|
-
}
|
|
82283
|
-
_splitRoot(node2, newNode) {
|
|
82284
|
-
this.data = createNode([node2, newNode]);
|
|
82285
|
-
this.data.height = node2.height + 1;
|
|
82286
|
-
this.data.leaf = false;
|
|
82287
|
-
calcBBox(this.data, this.toBBox);
|
|
82288
|
-
}
|
|
82289
|
-
_chooseSplitIndex(node2, m, M) {
|
|
82290
|
-
let index2;
|
|
82291
|
-
let minOverlap = Infinity;
|
|
82292
|
-
let minArea = Infinity;
|
|
82293
|
-
for (let i2 = m; i2 <= M - m; i2++) {
|
|
82294
|
-
const bbox1 = distBBox(node2, 0, i2, this.toBBox);
|
|
82295
|
-
const bbox2 = distBBox(node2, i2, M, this.toBBox);
|
|
82296
|
-
const overlap = intersectionArea(bbox1, bbox2);
|
|
82297
|
-
const area2 = bboxArea(bbox1) + bboxArea(bbox2);
|
|
82298
|
-
if (overlap < minOverlap) {
|
|
82299
|
-
minOverlap = overlap;
|
|
82300
|
-
index2 = i2;
|
|
82301
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
82302
|
-
} else if (overlap === minOverlap) {
|
|
82303
|
-
if (area2 < minArea) {
|
|
82304
|
-
minArea = area2;
|
|
82305
|
-
index2 = i2;
|
|
82306
|
-
}
|
|
82307
|
-
}
|
|
82308
|
-
}
|
|
82309
|
-
return index2 || M - m;
|
|
82310
|
-
}
|
|
82311
|
-
// sorts node children by the best axis for split
|
|
82312
|
-
_chooseSplitAxis(node2, m, M) {
|
|
82313
|
-
const compareMinX = node2.leaf ? this.compareMinX : compareNodeMinX;
|
|
82314
|
-
const compareMinY = node2.leaf ? this.compareMinY : compareNodeMinY;
|
|
82315
|
-
const xMargin = this._allDistMargin(node2, m, M, compareMinX);
|
|
82316
|
-
const yMargin = this._allDistMargin(node2, m, M, compareMinY);
|
|
82317
|
-
if (xMargin < yMargin) node2.children.sort(compareMinX);
|
|
82318
|
-
}
|
|
82319
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
82320
|
-
_allDistMargin(node2, m, M, compare2) {
|
|
82321
|
-
node2.children.sort(compare2);
|
|
82322
|
-
const toBBox = this.toBBox;
|
|
82323
|
-
const leftBBox = distBBox(node2, 0, m, toBBox);
|
|
82324
|
-
const rightBBox = distBBox(node2, M - m, M, toBBox);
|
|
82325
|
-
let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
82326
|
-
for (let i2 = m; i2 < M - m; i2++) {
|
|
82327
|
-
const child = node2.children[i2];
|
|
82328
|
-
extend(leftBBox, node2.leaf ? toBBox(child) : child);
|
|
82329
|
-
margin += bboxMargin(leftBBox);
|
|
82330
|
-
}
|
|
82331
|
-
for (let i2 = M - m - 1; i2 >= m; i2--) {
|
|
82332
|
-
const child = node2.children[i2];
|
|
82333
|
-
extend(rightBBox, node2.leaf ? toBBox(child) : child);
|
|
82334
|
-
margin += bboxMargin(rightBBox);
|
|
82335
|
-
}
|
|
82336
|
-
return margin;
|
|
82337
|
-
}
|
|
82338
|
-
_adjustParentBBoxes(bbox2, path, level) {
|
|
82339
|
-
for (let i2 = level; i2 >= 0; i2--) {
|
|
82340
|
-
extend(path[i2], bbox2);
|
|
82341
|
-
}
|
|
82342
|
-
}
|
|
82343
|
-
_condense(path) {
|
|
82344
|
-
for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
|
|
82345
|
-
if (path[i2].children.length === 0) {
|
|
82346
|
-
if (i2 > 0) {
|
|
82347
|
-
siblings = path[i2 - 1].children;
|
|
82348
|
-
siblings.splice(siblings.indexOf(path[i2]), 1);
|
|
82349
|
-
} else this.clear();
|
|
82350
|
-
} else calcBBox(path[i2], this.toBBox);
|
|
82351
|
-
}
|
|
82352
|
-
}
|
|
82353
|
-
}
|
|
82354
|
-
function findItem(item, items, equalsFn) {
|
|
82355
|
-
if (!equalsFn) return items.indexOf(item);
|
|
82356
|
-
for (let i2 = 0; i2 < items.length; i2++) {
|
|
82357
|
-
if (equalsFn(item, items[i2])) return i2;
|
|
82358
|
-
}
|
|
82359
|
-
return -1;
|
|
82360
|
-
}
|
|
82361
|
-
function calcBBox(node2, toBBox) {
|
|
82362
|
-
distBBox(node2, 0, node2.children.length, toBBox, node2);
|
|
82363
|
-
}
|
|
82364
|
-
function distBBox(node2, k, p, toBBox, destNode) {
|
|
82365
|
-
if (!destNode) destNode = createNode(null);
|
|
82366
|
-
destNode.minX = Infinity;
|
|
82367
|
-
destNode.minY = Infinity;
|
|
82368
|
-
destNode.maxX = -Infinity;
|
|
82369
|
-
destNode.maxY = -Infinity;
|
|
82370
|
-
for (let i2 = k; i2 < p; i2++) {
|
|
82371
|
-
const child = node2.children[i2];
|
|
82372
|
-
extend(destNode, node2.leaf ? toBBox(child) : child);
|
|
82373
|
-
}
|
|
82374
|
-
return destNode;
|
|
82375
|
-
}
|
|
82376
|
-
function extend(a2, b) {
|
|
82377
|
-
a2.minX = Math.min(a2.minX, b.minX);
|
|
82378
|
-
a2.minY = Math.min(a2.minY, b.minY);
|
|
82379
|
-
a2.maxX = Math.max(a2.maxX, b.maxX);
|
|
82380
|
-
a2.maxY = Math.max(a2.maxY, b.maxY);
|
|
82381
|
-
return a2;
|
|
82382
|
-
}
|
|
82383
|
-
function compareNodeMinX(a2, b) {
|
|
82384
|
-
return a2.minX - b.minX;
|
|
82385
|
-
}
|
|
82386
|
-
function compareNodeMinY(a2, b) {
|
|
82387
|
-
return a2.minY - b.minY;
|
|
82388
|
-
}
|
|
82389
|
-
function bboxArea(a2) {
|
|
82390
|
-
return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
|
|
82391
|
-
}
|
|
82392
|
-
function bboxMargin(a2) {
|
|
82393
|
-
return a2.maxX - a2.minX + (a2.maxY - a2.minY);
|
|
82394
|
-
}
|
|
82395
|
-
function enlargedArea(a2, b) {
|
|
82396
|
-
return (Math.max(b.maxX, a2.maxX) - Math.min(b.minX, a2.minX)) * (Math.max(b.maxY, a2.maxY) - Math.min(b.minY, a2.minY));
|
|
82397
|
-
}
|
|
82398
|
-
function intersectionArea(a2, b) {
|
|
82399
|
-
const minX = Math.max(a2.minX, b.minX);
|
|
82400
|
-
const minY = Math.max(a2.minY, b.minY);
|
|
82401
|
-
const maxX = Math.min(a2.maxX, b.maxX);
|
|
82402
|
-
const maxY = Math.min(a2.maxY, b.maxY);
|
|
82403
|
-
return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
|
|
82404
|
-
}
|
|
82405
|
-
function contains$1(a2, b) {
|
|
82406
|
-
return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
|
|
82407
|
-
}
|
|
82408
|
-
function intersects(a2, b) {
|
|
82409
|
-
return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
|
|
82410
|
-
}
|
|
82411
|
-
function createNode(children) {
|
|
82412
|
-
return {
|
|
82413
|
-
children,
|
|
82414
|
-
height: 1,
|
|
82415
|
-
leaf: true,
|
|
82416
|
-
minX: Infinity,
|
|
82417
|
-
minY: Infinity,
|
|
82418
|
-
maxX: -Infinity,
|
|
82419
|
-
maxY: -Infinity
|
|
82420
|
-
};
|
|
82421
|
-
}
|
|
82422
|
-
function multiSelect(arr, left, right, n3, compare2) {
|
|
82423
|
-
const stack2 = [left, right];
|
|
82424
|
-
while (stack2.length) {
|
|
82425
|
-
right = stack2.pop();
|
|
82426
|
-
left = stack2.pop();
|
|
82427
|
-
if (right - left <= n3) continue;
|
|
82428
|
-
const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
|
|
82429
|
-
quickselect(arr, mid, left, right, compare2);
|
|
82430
|
-
stack2.push(left, mid, mid, right);
|
|
82431
|
-
}
|
|
82432
|
-
}
|
|
82433
|
-
function geojsonRbush(maxEntries) {
|
|
82434
|
-
var tree = new RBush(maxEntries);
|
|
82435
|
-
tree.insert = function(feature2) {
|
|
82436
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
82437
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
82438
|
-
return RBush.prototype.insert.call(this, feature2);
|
|
82439
|
-
};
|
|
82440
|
-
tree.load = function(features) {
|
|
82441
|
-
var load2 = [];
|
|
82442
|
-
if (Array.isArray(features)) {
|
|
82443
|
-
features.forEach(function(feature2) {
|
|
82444
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
82445
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
82446
|
-
load2.push(feature2);
|
|
82447
|
-
});
|
|
82448
|
-
} else {
|
|
82449
|
-
featureEach(features, function(feature2) {
|
|
82450
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
82451
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
82452
|
-
load2.push(feature2);
|
|
82453
|
-
});
|
|
82454
|
-
}
|
|
82455
|
-
return RBush.prototype.load.call(this, load2);
|
|
82456
|
-
};
|
|
82457
|
-
tree.remove = function(feature2, equals2) {
|
|
82458
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
82459
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
82460
|
-
return RBush.prototype.remove.call(this, feature2, equals2);
|
|
82461
|
-
};
|
|
82462
|
-
tree.clear = function() {
|
|
82463
|
-
return RBush.prototype.clear.call(this);
|
|
82464
|
-
};
|
|
82465
|
-
tree.search = function(geojson) {
|
|
82466
|
-
var features = RBush.prototype.search.call(this, this.toBBox(geojson));
|
|
82467
|
-
return featureCollection(features);
|
|
82468
|
-
};
|
|
82469
|
-
tree.collides = function(geojson) {
|
|
82470
|
-
return RBush.prototype.collides.call(this, this.toBBox(geojson));
|
|
82471
|
-
};
|
|
82472
|
-
tree.all = function() {
|
|
82473
|
-
var features = RBush.prototype.all.call(this);
|
|
82474
|
-
return featureCollection(features);
|
|
82475
|
-
};
|
|
82476
|
-
tree.toJSON = function() {
|
|
82477
|
-
return RBush.prototype.toJSON.call(this);
|
|
82478
|
-
};
|
|
82479
|
-
tree.fromJSON = function(json) {
|
|
82480
|
-
return RBush.prototype.fromJSON.call(this, json);
|
|
82481
|
-
};
|
|
82482
|
-
tree.toBBox = function(geojson) {
|
|
82483
|
-
var bbox2;
|
|
82484
|
-
if (geojson.bbox) bbox2 = geojson.bbox;
|
|
82485
|
-
else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
|
|
82486
|
-
else if (Array.isArray(geojson) && geojson.length === 6)
|
|
82487
|
-
bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
|
|
82488
|
-
else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
|
|
82489
|
-
else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
|
|
82490
|
-
else throw new Error("invalid geojson");
|
|
82491
|
-
return {
|
|
82492
|
-
minX: bbox2[0],
|
|
82493
|
-
minY: bbox2[1],
|
|
82494
|
-
maxX: bbox2[2],
|
|
82495
|
-
maxY: bbox2[3]
|
|
82496
|
-
};
|
|
82497
|
-
};
|
|
82498
|
-
return tree;
|
|
82499
|
-
}
|
|
82500
|
-
function lineSegment(geojson) {
|
|
82501
|
-
if (!geojson) {
|
|
82502
|
-
throw new Error("geojson is required");
|
|
82503
|
-
}
|
|
82504
|
-
const results = [];
|
|
82505
|
-
flattenEach(geojson, (feature2) => {
|
|
82506
|
-
lineSegmentFeature(feature2, results);
|
|
82507
|
-
});
|
|
82508
|
-
return featureCollection(results);
|
|
82509
|
-
}
|
|
82510
|
-
function lineSegmentFeature(geojson, results) {
|
|
82511
|
-
let coords = [];
|
|
82512
|
-
const geometry2 = geojson.geometry;
|
|
82513
|
-
if (geometry2 !== null) {
|
|
82514
|
-
switch (geometry2.type) {
|
|
82515
|
-
case "Polygon":
|
|
82516
|
-
coords = getCoords(geometry2);
|
|
82517
|
-
break;
|
|
82518
|
-
case "LineString":
|
|
82519
|
-
coords = [getCoords(geometry2)];
|
|
82520
|
-
}
|
|
82521
|
-
coords.forEach((coord) => {
|
|
82522
|
-
const segments = createSegments(coord, geojson.properties);
|
|
82523
|
-
segments.forEach((segment) => {
|
|
82524
|
-
segment.id = results.length;
|
|
82525
|
-
results.push(segment);
|
|
82526
|
-
});
|
|
82527
|
-
});
|
|
82528
|
-
}
|
|
82529
|
-
}
|
|
82530
|
-
function createSegments(coords, properties) {
|
|
82531
|
-
const segments = [];
|
|
82532
|
-
coords.reduce((previousCoords, currentCoords) => {
|
|
82533
|
-
const segment = lineString([previousCoords, currentCoords], properties);
|
|
82534
|
-
segment.bbox = bbox(previousCoords, currentCoords);
|
|
82535
|
-
segments.push(segment);
|
|
82536
|
-
return currentCoords;
|
|
82537
|
-
});
|
|
82538
|
-
return segments;
|
|
82539
|
-
}
|
|
82540
|
-
function bbox(coords1, coords2) {
|
|
82541
|
-
const x12 = coords1[0];
|
|
82542
|
-
const y12 = coords1[1];
|
|
82543
|
-
const x2 = coords2[0];
|
|
82544
|
-
const y2 = coords2[1];
|
|
82545
|
-
const west = x12 < x2 ? x12 : x2;
|
|
82546
|
-
const south = y12 < y2 ? y12 : y2;
|
|
82547
|
-
const east = x12 > x2 ? x12 : x2;
|
|
82548
|
-
const north = y12 > y2 ? y12 : y2;
|
|
82549
|
-
return [west, south, east, north];
|
|
82550
|
-
}
|
|
82551
|
-
function distance$1(from, to, options = {}) {
|
|
82552
|
-
var coordinates1 = getCoord(from);
|
|
82553
|
-
var coordinates2 = getCoord(to);
|
|
82554
|
-
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
82555
|
-
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
82556
|
-
var lat1 = degreesToRadians(coordinates1[1]);
|
|
82557
|
-
var lat2 = degreesToRadians(coordinates2[1]);
|
|
82558
|
-
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
82559
|
-
return radiansToLength(
|
|
82560
|
-
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
82561
|
-
options.units
|
|
82562
|
-
);
|
|
82563
|
-
}
|
|
82564
|
-
var __defProp$2 = Object.defineProperty;
|
|
82565
|
-
var __defProps = Object.defineProperties;
|
|
82566
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
82567
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
82568
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
82569
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
82570
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
82571
|
-
var __spreadValues = (a2, b) => {
|
|
82572
|
-
for (var prop in b || (b = {}))
|
|
82573
|
-
if (__hasOwnProp.call(b, prop))
|
|
82574
|
-
__defNormalProp$1(a2, prop, b[prop]);
|
|
82575
|
-
if (__getOwnPropSymbols)
|
|
82576
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
82577
|
-
if (__propIsEnum.call(b, prop))
|
|
82578
|
-
__defNormalProp$1(a2, prop, b[prop]);
|
|
82579
|
-
}
|
|
82580
|
-
return a2;
|
|
82581
|
-
};
|
|
82582
|
-
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
82583
|
-
function nearestPointOnLine(lines, pt, options = {}) {
|
|
82584
|
-
if (!lines || !pt) {
|
|
82585
|
-
throw new Error("lines and pt are required arguments");
|
|
82586
|
-
}
|
|
82587
|
-
const ptPos = getCoord(pt);
|
|
82588
|
-
let closestPt = point([Infinity, Infinity], {
|
|
82589
|
-
dist: Infinity,
|
|
82590
|
-
index: -1,
|
|
82591
|
-
multiFeatureIndex: -1,
|
|
82592
|
-
location: -1
|
|
82593
|
-
});
|
|
82594
|
-
let length2 = 0;
|
|
82595
|
-
flattenEach(
|
|
82596
|
-
lines,
|
|
82597
|
-
function(line, _featureIndex, multiFeatureIndex) {
|
|
82598
|
-
const coords = getCoords(line);
|
|
82599
|
-
for (let i2 = 0; i2 < coords.length - 1; i2++) {
|
|
82600
|
-
const start = point(coords[i2]);
|
|
82601
|
-
start.properties.dist = distance$1(pt, start, options);
|
|
82602
|
-
const startPos = getCoord(start);
|
|
82603
|
-
const stop = point(coords[i2 + 1]);
|
|
82604
|
-
stop.properties.dist = distance$1(pt, stop, options);
|
|
82605
|
-
const stopPos = getCoord(stop);
|
|
82606
|
-
const sectionLength = distance$1(start, stop, options);
|
|
82607
|
-
let intersectPos;
|
|
82608
|
-
let wasEnd;
|
|
82609
|
-
if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
|
|
82610
|
-
[intersectPos, , wasEnd] = [startPos, void 0, false];
|
|
82611
|
-
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
82612
|
-
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
82613
|
-
} else {
|
|
82614
|
-
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
82615
|
-
start.geometry.coordinates,
|
|
82616
|
-
stop.geometry.coordinates,
|
|
82617
|
-
getCoord(pt)
|
|
82618
|
-
);
|
|
82619
|
-
}
|
|
82620
|
-
let intersectPt;
|
|
82621
|
-
if (intersectPos) {
|
|
82622
|
-
intersectPt = point(intersectPos, {
|
|
82623
|
-
dist: distance$1(pt, intersectPos, options),
|
|
82624
|
-
multiFeatureIndex,
|
|
82625
|
-
location: length2 + distance$1(start, intersectPos, options)
|
|
82626
|
-
});
|
|
82627
|
-
}
|
|
82628
|
-
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
82629
|
-
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
82630
|
-
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
82631
|
-
// Legacy behaviour where index progresses to next segment # if we
|
|
82632
|
-
// went with the end point this iteration.
|
|
82633
|
-
index: wasEnd ? i2 + 1 : i2
|
|
82634
|
-
})
|
|
82635
|
-
});
|
|
82636
|
-
}
|
|
82637
|
-
length2 += sectionLength;
|
|
82638
|
-
}
|
|
82639
|
-
}
|
|
82640
|
-
);
|
|
82641
|
-
return closestPt;
|
|
82642
|
-
}
|
|
82643
|
-
function dot(v12, v2) {
|
|
82644
|
-
const [v1x, v1y, v1z] = v12;
|
|
82645
|
-
const [v2x, v2y, v2z] = v2;
|
|
82646
|
-
return v1x * v2x + v1y * v2y + v1z * v2z;
|
|
82647
|
-
}
|
|
82648
|
-
function cross(v12, v2) {
|
|
82649
|
-
const [v1x, v1y, v1z] = v12;
|
|
82650
|
-
const [v2x, v2y, v2z] = v2;
|
|
82651
|
-
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
82652
|
-
}
|
|
82653
|
-
function magnitude(v) {
|
|
82654
|
-
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
82655
|
-
}
|
|
82656
|
-
function angle$1(v12, v2) {
|
|
82657
|
-
const theta = dot(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
82658
|
-
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
82659
|
-
}
|
|
82660
|
-
function lngLatToVector(a2) {
|
|
82661
|
-
const lat = degreesToRadians(a2[1]);
|
|
82662
|
-
const lng = degreesToRadians(a2[0]);
|
|
82663
|
-
return [
|
|
82664
|
-
Math.cos(lat) * Math.cos(lng),
|
|
82665
|
-
Math.cos(lat) * Math.sin(lng),
|
|
82666
|
-
Math.sin(lat)
|
|
82667
|
-
];
|
|
82668
|
-
}
|
|
82669
|
-
function vectorToLngLat(v) {
|
|
82670
|
-
const [x, y, z] = v;
|
|
82671
|
-
const lat = radiansToDegrees(Math.asin(z));
|
|
82672
|
-
const lng = radiansToDegrees(Math.atan2(y, x));
|
|
82673
|
-
return [lng, lat];
|
|
82674
|
-
}
|
|
82675
|
-
function nearestPointOnSegment(posA, posB, posC) {
|
|
82676
|
-
const A2 = lngLatToVector(posA);
|
|
82677
|
-
const B2 = lngLatToVector(posB);
|
|
82678
|
-
const C3 = lngLatToVector(posC);
|
|
82679
|
-
const [Cx, Cy, Cz] = C3;
|
|
82680
|
-
const [D2, E2, F] = cross(A2, B2);
|
|
82681
|
-
const a2 = E2 * Cz - F * Cy;
|
|
82682
|
-
const b = F * Cx - D2 * Cz;
|
|
82683
|
-
const c = D2 * Cy - E2 * Cx;
|
|
82684
|
-
const f2 = c * E2 - b * F;
|
|
82685
|
-
const g2 = a2 * F - c * D2;
|
|
82686
|
-
const h = b * D2 - a2 * E2;
|
|
82687
|
-
const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
|
|
82688
|
-
const I1 = [f2 * t, g2 * t, h * t];
|
|
82689
|
-
const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
|
|
82690
|
-
const angleAB = angle$1(A2, B2);
|
|
82691
|
-
const angleAI1 = angle$1(A2, I1);
|
|
82692
|
-
const angleBI1 = angle$1(B2, I1);
|
|
82693
|
-
const angleAI2 = angle$1(A2, I2);
|
|
82694
|
-
const angleBI2 = angle$1(B2, I2);
|
|
82695
|
-
let I3;
|
|
82696
|
-
if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
|
|
82697
|
-
I3 = I1;
|
|
82698
|
-
} else {
|
|
82699
|
-
I3 = I2;
|
|
82700
|
-
}
|
|
82701
|
-
if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
|
|
82702
|
-
if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
82703
|
-
return [vectorToLngLat(A2), true, false];
|
|
82704
|
-
} else {
|
|
82705
|
-
return [vectorToLngLat(B2), false, true];
|
|
82706
|
-
}
|
|
82707
|
-
}
|
|
82708
|
-
return [vectorToLngLat(I3), false, false];
|
|
82709
|
-
}
|
|
82710
|
-
var fastDeepEqual;
|
|
82711
|
-
var hasRequiredFastDeepEqual;
|
|
82712
|
-
function requireFastDeepEqual() {
|
|
82713
|
-
if (hasRequiredFastDeepEqual) return fastDeepEqual;
|
|
82714
|
-
hasRequiredFastDeepEqual = 1;
|
|
82715
|
-
fastDeepEqual = function equal2(a2, b) {
|
|
82716
|
-
if (a2 === b) return true;
|
|
82717
|
-
if (a2 && b && typeof a2 == "object" && typeof b == "object") {
|
|
82718
|
-
if (a2.constructor !== b.constructor) return false;
|
|
82719
|
-
var length2, i2, keys2;
|
|
82720
|
-
if (Array.isArray(a2)) {
|
|
82721
|
-
length2 = a2.length;
|
|
82722
|
-
if (length2 != b.length) return false;
|
|
82723
|
-
for (i2 = length2; i2-- !== 0; )
|
|
82724
|
-
if (!equal2(a2[i2], b[i2])) return false;
|
|
82725
|
-
return true;
|
|
82726
|
-
}
|
|
82727
|
-
if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
|
|
82728
|
-
if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
|
|
82729
|
-
if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
|
|
82730
|
-
keys2 = Object.keys(a2);
|
|
82731
|
-
length2 = keys2.length;
|
|
82732
|
-
if (length2 !== Object.keys(b).length) return false;
|
|
82733
|
-
for (i2 = length2; i2-- !== 0; )
|
|
82734
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) return false;
|
|
82735
|
-
for (i2 = length2; i2-- !== 0; ) {
|
|
82736
|
-
var key = keys2[i2];
|
|
82737
|
-
if (!equal2(a2[key], b[key])) return false;
|
|
82738
|
-
}
|
|
82739
|
-
return true;
|
|
82740
|
-
}
|
|
82741
|
-
return a2 !== a2 && b !== b;
|
|
82742
|
-
};
|
|
82743
|
-
return fastDeepEqual;
|
|
82744
|
-
}
|
|
82745
|
-
var fastDeepEqualExports = requireFastDeepEqual();
|
|
82746
|
-
const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
82747
|
-
function lineOverlap(line1, line2, options = {}) {
|
|
82748
|
-
options = options || {};
|
|
82749
|
-
if (!isObject$1(options)) throw new Error("options is invalid");
|
|
82750
|
-
var tolerance = options.tolerance || 0;
|
|
82751
|
-
var features = [];
|
|
82752
|
-
var tree = geojsonRbush();
|
|
82753
|
-
const line = lineSegment(line1);
|
|
82754
|
-
tree.load(line);
|
|
82755
|
-
var overlapSegment;
|
|
82756
|
-
let additionalSegments = [];
|
|
82757
|
-
segmentEach(line2, function(segment) {
|
|
82758
|
-
var doesOverlaps = false;
|
|
82759
|
-
if (!segment) {
|
|
82760
|
-
return;
|
|
82761
|
-
}
|
|
82762
|
-
featureEach(tree.search(segment), function(match) {
|
|
82763
|
-
if (doesOverlaps === false) {
|
|
82764
|
-
var coordsSegment = getCoords(segment).sort();
|
|
82765
|
-
var coordsMatch = getCoords(match).sort();
|
|
82766
|
-
if (equal$1(coordsSegment, coordsMatch)) {
|
|
82767
|
-
doesOverlaps = true;
|
|
82768
|
-
if (overlapSegment) {
|
|
82769
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
82770
|
-
} else overlapSegment = segment;
|
|
82771
|
-
} else if (tolerance === 0 ? booleanPointOnLine(coordsSegment[0], match) && booleanPointOnLine(coordsSegment[1], match) : nearestPointOnLine(match, coordsSegment[0]).properties.dist <= tolerance && nearestPointOnLine(match, coordsSegment[1]).properties.dist <= tolerance) {
|
|
82772
|
-
doesOverlaps = true;
|
|
82773
|
-
if (overlapSegment) {
|
|
82774
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
82775
|
-
} else overlapSegment = segment;
|
|
82776
|
-
} else if (tolerance === 0 ? booleanPointOnLine(coordsMatch[0], segment) && booleanPointOnLine(coordsMatch[1], segment) : nearestPointOnLine(segment, coordsMatch[0]).properties.dist <= tolerance && nearestPointOnLine(segment, coordsMatch[1]).properties.dist <= tolerance) {
|
|
82777
|
-
if (overlapSegment) {
|
|
82778
|
-
const combinedSegment = concatSegment(overlapSegment, match);
|
|
82779
|
-
if (combinedSegment) {
|
|
82780
|
-
overlapSegment = combinedSegment;
|
|
82781
|
-
} else {
|
|
82782
|
-
additionalSegments.push(match);
|
|
82783
|
-
}
|
|
82784
|
-
} else overlapSegment = match;
|
|
82785
|
-
}
|
|
82786
|
-
}
|
|
82787
|
-
});
|
|
82788
|
-
if (doesOverlaps === false && overlapSegment) {
|
|
82789
|
-
features.push(overlapSegment);
|
|
82790
|
-
if (additionalSegments.length) {
|
|
82791
|
-
features = features.concat(additionalSegments);
|
|
82792
|
-
additionalSegments = [];
|
|
82793
|
-
}
|
|
82794
|
-
overlapSegment = void 0;
|
|
82795
|
-
}
|
|
82796
|
-
});
|
|
82797
|
-
if (overlapSegment) features.push(overlapSegment);
|
|
82798
|
-
return featureCollection(features);
|
|
82799
|
-
}
|
|
82800
|
-
function concatSegment(line, segment) {
|
|
82801
|
-
var coords = getCoords(segment);
|
|
82802
|
-
var lineCoords = getCoords(line);
|
|
82803
|
-
var start = lineCoords[0];
|
|
82804
|
-
var end = lineCoords[lineCoords.length - 1];
|
|
82805
|
-
var geom = line.geometry.coordinates;
|
|
82806
|
-
if (equal$1(coords[0], start)) geom.unshift(coords[1]);
|
|
82807
|
-
else if (equal$1(coords[0], end)) geom.push(coords[1]);
|
|
82808
|
-
else if (equal$1(coords[1], start)) geom.unshift(coords[0]);
|
|
82809
|
-
else if (equal$1(coords[1], end)) geom.push(coords[0]);
|
|
82810
|
-
else return;
|
|
82811
|
-
return line;
|
|
82812
|
-
}
|
|
82813
|
-
class TinyQueue {
|
|
82814
|
-
constructor(data = [], compare2 = defaultCompare) {
|
|
82815
|
-
this.data = data;
|
|
82816
|
-
this.length = this.data.length;
|
|
82817
|
-
this.compare = compare2;
|
|
82818
|
-
if (this.length > 0) {
|
|
82819
|
-
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
82820
|
-
}
|
|
82821
|
-
}
|
|
82822
|
-
push(item) {
|
|
82823
|
-
this.data.push(item);
|
|
82824
|
-
this.length++;
|
|
82825
|
-
this._up(this.length - 1);
|
|
82826
|
-
}
|
|
82827
|
-
pop() {
|
|
82828
|
-
if (this.length === 0) return void 0;
|
|
82829
|
-
const top = this.data[0];
|
|
82830
|
-
const bottom = this.data.pop();
|
|
82831
|
-
this.length--;
|
|
82832
|
-
if (this.length > 0) {
|
|
82833
|
-
this.data[0] = bottom;
|
|
82834
|
-
this._down(0);
|
|
82835
|
-
}
|
|
82836
|
-
return top;
|
|
82837
|
-
}
|
|
82838
|
-
peek() {
|
|
82839
|
-
return this.data[0];
|
|
82840
|
-
}
|
|
82841
|
-
_up(pos) {
|
|
82842
|
-
const { data, compare: compare2 } = this;
|
|
82843
|
-
const item = data[pos];
|
|
82844
|
-
while (pos > 0) {
|
|
82845
|
-
const parent = pos - 1 >> 1;
|
|
82846
|
-
const current = data[parent];
|
|
82847
|
-
if (compare2(item, current) >= 0) break;
|
|
82848
|
-
data[pos] = current;
|
|
82849
|
-
pos = parent;
|
|
82850
|
-
}
|
|
82851
|
-
data[pos] = item;
|
|
82852
|
-
}
|
|
82853
|
-
_down(pos) {
|
|
82854
|
-
const { data, compare: compare2 } = this;
|
|
82855
|
-
const halfLength = this.length >> 1;
|
|
82856
|
-
const item = data[pos];
|
|
82857
|
-
while (pos < halfLength) {
|
|
82858
|
-
let left = (pos << 1) + 1;
|
|
82859
|
-
let best = data[left];
|
|
82860
|
-
const right = left + 1;
|
|
82861
|
-
if (right < this.length && compare2(data[right], best) < 0) {
|
|
82862
|
-
left = right;
|
|
82863
|
-
best = data[right];
|
|
82864
|
-
}
|
|
82865
|
-
if (compare2(best, item) >= 0) break;
|
|
82866
|
-
data[pos] = best;
|
|
82867
|
-
pos = left;
|
|
82868
|
-
}
|
|
82869
|
-
data[pos] = item;
|
|
82870
|
-
}
|
|
82871
|
-
}
|
|
82872
|
-
function defaultCompare(a2, b) {
|
|
82873
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
82874
|
-
}
|
|
82875
|
-
function checkWhichEventIsLeft(e1, e2) {
|
|
82876
|
-
if (e1.p.x > e2.p.x) return 1;
|
|
82877
|
-
if (e1.p.x < e2.p.x) return -1;
|
|
82878
|
-
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
82879
|
-
return 1;
|
|
82880
|
-
}
|
|
82881
|
-
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
82882
|
-
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
82883
|
-
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
82884
|
-
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
82885
|
-
return 1;
|
|
82886
|
-
}
|
|
82887
|
-
class Event {
|
|
82888
|
-
constructor(p, featureId2, ringId2, eventId2) {
|
|
82889
|
-
this.p = {
|
|
82890
|
-
x: p[0],
|
|
82891
|
-
y: p[1]
|
|
82892
|
-
};
|
|
82893
|
-
this.featureId = featureId2;
|
|
82894
|
-
this.ringId = ringId2;
|
|
82895
|
-
this.eventId = eventId2;
|
|
82896
|
-
this.otherEvent = null;
|
|
82897
|
-
this.isLeftEndpoint = null;
|
|
82898
|
-
}
|
|
82899
|
-
isSamePoint(eventToCheck) {
|
|
82900
|
-
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
82901
|
-
}
|
|
82902
|
-
}
|
|
82903
|
-
function fillEventQueue(geojson, eventQueue) {
|
|
82904
|
-
if (geojson.type === "FeatureCollection") {
|
|
82905
|
-
const features = geojson.features;
|
|
82906
|
-
for (let i2 = 0; i2 < features.length; i2++) {
|
|
82907
|
-
processFeature(features[i2], eventQueue);
|
|
82908
|
-
}
|
|
82909
|
-
} else {
|
|
82910
|
-
processFeature(geojson, eventQueue);
|
|
82911
|
-
}
|
|
82912
|
-
}
|
|
82913
|
-
let featureId = 0;
|
|
82914
|
-
let ringId = 0;
|
|
82915
|
-
let eventId = 0;
|
|
82916
|
-
function processFeature(featureOrGeometry, eventQueue) {
|
|
82917
|
-
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
82918
|
-
let coords = geom.coordinates;
|
|
82919
|
-
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
82920
|
-
if (geom.type === "LineString") coords = [[coords]];
|
|
82921
|
-
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
82922
|
-
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
82923
|
-
let currentP = coords[i2][ii][0];
|
|
82924
|
-
let nextP = null;
|
|
82925
|
-
ringId = ringId + 1;
|
|
82926
|
-
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
82927
|
-
nextP = coords[i2][ii][iii + 1];
|
|
82928
|
-
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
82929
|
-
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
82930
|
-
e1.otherEvent = e2;
|
|
82931
|
-
e2.otherEvent = e1;
|
|
82932
|
-
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
82933
|
-
e2.isLeftEndpoint = true;
|
|
82934
|
-
e1.isLeftEndpoint = false;
|
|
82935
|
-
} else {
|
|
82936
|
-
e1.isLeftEndpoint = true;
|
|
82937
|
-
e2.isLeftEndpoint = false;
|
|
82938
|
-
}
|
|
82939
|
-
eventQueue.push(e1);
|
|
82940
|
-
eventQueue.push(e2);
|
|
82941
|
-
currentP = nextP;
|
|
82942
|
-
eventId = eventId + 1;
|
|
82943
|
-
}
|
|
82944
|
-
}
|
|
82945
|
-
}
|
|
82946
|
-
featureId = featureId + 1;
|
|
82947
|
-
}
|
|
82948
|
-
let Segment$1 = class Segment {
|
|
82949
|
-
constructor(event) {
|
|
82950
|
-
this.leftSweepEvent = event;
|
|
82951
|
-
this.rightSweepEvent = event.otherEvent;
|
|
82952
|
-
}
|
|
82953
|
-
};
|
|
82954
|
-
function testSegmentIntersect(seg1, seg2) {
|
|
82955
|
-
if (seg1 === null || seg2 === null) return false;
|
|
82956
|
-
if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
|
|
82957
|
-
const x12 = seg1.leftSweepEvent.p.x;
|
|
82958
|
-
const y12 = seg1.leftSweepEvent.p.y;
|
|
82959
|
-
const x2 = seg1.rightSweepEvent.p.x;
|
|
82960
|
-
const y2 = seg1.rightSweepEvent.p.y;
|
|
82961
|
-
const x3 = seg2.leftSweepEvent.p.x;
|
|
82962
|
-
const y3 = seg2.leftSweepEvent.p.y;
|
|
82963
|
-
const x4 = seg2.rightSweepEvent.p.x;
|
|
82964
|
-
const y4 = seg2.rightSweepEvent.p.y;
|
|
82965
|
-
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
82966
|
-
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
82967
|
-
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
82968
|
-
if (denom === 0) {
|
|
82969
|
-
if (numeA === 0 && numeB === 0) return false;
|
|
82970
|
-
return false;
|
|
82971
|
-
}
|
|
82972
|
-
const uA = numeA / denom;
|
|
82973
|
-
const uB = numeB / denom;
|
|
82974
|
-
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
82975
|
-
const x = x12 + uA * (x2 - x12);
|
|
82976
|
-
const y = y12 + uA * (y2 - y12);
|
|
82977
|
-
return [x, y];
|
|
82978
|
-
}
|
|
82979
|
-
return false;
|
|
82980
|
-
}
|
|
82981
|
-
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
82982
|
-
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
82983
|
-
const intersectionPoints = [];
|
|
82984
|
-
const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
|
|
82985
|
-
while (eventQueue.length) {
|
|
82986
|
-
const event = eventQueue.pop();
|
|
82987
|
-
if (event.isLeftEndpoint) {
|
|
82988
|
-
const segment = new Segment$1(event);
|
|
82989
|
-
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
82990
|
-
const otherSeg = outQueue.data[i2];
|
|
82991
|
-
if (ignoreSelfIntersections) {
|
|
82992
|
-
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
82993
|
-
}
|
|
82994
|
-
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
82995
|
-
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
82996
|
-
}
|
|
82997
|
-
outQueue.push(segment);
|
|
82998
|
-
} else if (event.isLeftEndpoint === false) {
|
|
82999
|
-
outQueue.pop();
|
|
83000
|
-
}
|
|
83001
|
-
}
|
|
83002
|
-
return intersectionPoints;
|
|
83003
|
-
}
|
|
83004
|
-
function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
|
|
83005
|
-
const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
|
|
83006
|
-
fillEventQueue(geojson, eventQueue);
|
|
83007
|
-
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
83008
|
-
}
|
|
83009
|
-
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
83010
|
-
__proto__: null,
|
|
83011
|
-
default: sweeplineIntersections$1
|
|
83012
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
83013
|
-
var sweeplineIntersections = sweeplineIntersections$1;
|
|
83014
|
-
function lineIntersect(line1, line2, options = {}) {
|
|
83015
|
-
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
83016
|
-
let features = [];
|
|
83017
|
-
if (line1.type === "FeatureCollection")
|
|
83018
|
-
features = features.concat(line1.features);
|
|
83019
|
-
else if (line1.type === "Feature") features.push(line1);
|
|
83020
|
-
else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
|
|
83021
|
-
features.push(feature$1(line1));
|
|
83022
|
-
}
|
|
83023
|
-
if (line2.type === "FeatureCollection")
|
|
83024
|
-
features = features.concat(line2.features);
|
|
83025
|
-
else if (line2.type === "Feature") features.push(line2);
|
|
83026
|
-
else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
|
|
83027
|
-
features.push(feature$1(line2));
|
|
83028
|
-
}
|
|
83029
|
-
const intersections = sweeplineIntersections(
|
|
83030
|
-
featureCollection(features),
|
|
83031
|
-
ignoreSelfIntersections
|
|
83032
|
-
);
|
|
83033
|
-
let results = [];
|
|
83034
|
-
if (removeDuplicates) {
|
|
83035
|
-
const unique2 = {};
|
|
83036
|
-
intersections.forEach((intersection2) => {
|
|
83037
|
-
const key = intersection2.join(",");
|
|
83038
|
-
if (!unique2[key]) {
|
|
83039
|
-
unique2[key] = true;
|
|
83040
|
-
results.push(intersection2);
|
|
83041
|
-
}
|
|
83042
|
-
});
|
|
83043
|
-
} else {
|
|
83044
|
-
results = intersections;
|
|
83045
|
-
}
|
|
83046
|
-
return featureCollection(results.map((r2) => point(r2)));
|
|
83047
|
-
}
|
|
83048
|
-
var __defProp$1 = Object.defineProperty;
|
|
83049
|
-
var __name = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
83050
|
-
var _GeojsonEquality = class _GeojsonEquality2 {
|
|
83051
|
-
constructor(opts) {
|
|
83052
|
-
this.direction = false;
|
|
83053
|
-
this.compareProperties = true;
|
|
83054
|
-
var _a2, _b, _c;
|
|
83055
|
-
this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
|
|
83056
|
-
this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
|
|
83057
|
-
this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
|
|
83058
|
-
}
|
|
83059
|
-
compare(g1, g2) {
|
|
83060
|
-
if (g1.type !== g2.type) {
|
|
83061
|
-
return false;
|
|
83062
|
-
}
|
|
83063
|
-
if (!sameLength(g1, g2)) {
|
|
83064
|
-
return false;
|
|
83065
|
-
}
|
|
83066
|
-
switch (g1.type) {
|
|
83067
|
-
case "Point":
|
|
83068
|
-
return this.compareCoord(g1.coordinates, g2.coordinates);
|
|
83069
|
-
case "LineString":
|
|
83070
|
-
return this.compareLine(g1.coordinates, g2.coordinates);
|
|
83071
|
-
case "Polygon":
|
|
83072
|
-
return this.comparePolygon(g1, g2);
|
|
83073
|
-
case "GeometryCollection":
|
|
83074
|
-
return this.compareGeometryCollection(g1, g2);
|
|
83075
|
-
case "Feature":
|
|
83076
|
-
return this.compareFeature(g1, g2);
|
|
83077
|
-
case "FeatureCollection":
|
|
83078
|
-
return this.compareFeatureCollection(g1, g2);
|
|
83079
|
-
default:
|
|
83080
|
-
if (g1.type.startsWith("Multi")) {
|
|
83081
|
-
const g1s = explode(g1);
|
|
83082
|
-
const g2s = explode(
|
|
83083
|
-
g2
|
|
83084
|
-
);
|
|
83085
|
-
return g1s.every(
|
|
83086
|
-
(g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
|
|
83087
|
-
);
|
|
83088
|
-
}
|
|
83089
|
-
}
|
|
83090
|
-
return false;
|
|
83091
|
-
}
|
|
83092
|
-
compareCoord(c1, c2) {
|
|
83093
|
-
return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
|
|
83094
|
-
}
|
|
83095
|
-
compareLine(path1, path2, ind = 0, isPoly = false) {
|
|
83096
|
-
if (!sameLength(path1, path2)) {
|
|
83097
|
-
return false;
|
|
83098
|
-
}
|
|
83099
|
-
const p1 = path1;
|
|
83100
|
-
let p2 = path2;
|
|
83101
|
-
if (isPoly && !this.compareCoord(p1[0], p2[0])) {
|
|
83102
|
-
const startIndex = this.fixStartIndex(p2, p1);
|
|
83103
|
-
if (!startIndex) {
|
|
83104
|
-
return false;
|
|
83105
|
-
} else {
|
|
83106
|
-
p2 = startIndex;
|
|
83107
|
-
}
|
|
83108
|
-
}
|
|
83109
|
-
const sameDirection = this.compareCoord(p1[ind], p2[ind]);
|
|
83110
|
-
if (this.direction || sameDirection) {
|
|
83111
|
-
return this.comparePath(p1, p2);
|
|
83112
|
-
} else {
|
|
83113
|
-
if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
|
|
83114
|
-
return this.comparePath(p1.slice().reverse(), p2);
|
|
83115
|
-
}
|
|
83116
|
-
return false;
|
|
83117
|
-
}
|
|
83118
|
-
}
|
|
83119
|
-
fixStartIndex(sourcePath, targetPath) {
|
|
83120
|
-
let correctPath, ind = -1;
|
|
83121
|
-
for (let i2 = 0; i2 < sourcePath.length; i2++) {
|
|
83122
|
-
if (this.compareCoord(sourcePath[i2], targetPath[0])) {
|
|
83123
|
-
ind = i2;
|
|
83124
|
-
break;
|
|
83125
|
-
}
|
|
83126
|
-
}
|
|
83127
|
-
if (ind >= 0) {
|
|
83128
|
-
correctPath = [].concat(
|
|
83129
|
-
sourcePath.slice(ind, sourcePath.length),
|
|
83130
|
-
sourcePath.slice(1, ind + 1)
|
|
83131
|
-
);
|
|
83132
|
-
}
|
|
83133
|
-
return correctPath;
|
|
83134
|
-
}
|
|
83135
|
-
comparePath(p1, p2) {
|
|
83136
|
-
return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
|
|
83137
|
-
}
|
|
83138
|
-
comparePolygon(g1, g2) {
|
|
83139
|
-
if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
|
|
83140
|
-
const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
|
|
83141
|
-
const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
|
|
83142
|
-
return holes1.every(
|
|
83143
|
-
(h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
|
|
83144
|
-
);
|
|
83145
|
-
}
|
|
83146
|
-
return false;
|
|
83147
|
-
}
|
|
83148
|
-
compareGeometryCollection(g1, g2) {
|
|
83149
|
-
return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
|
|
83150
|
-
}
|
|
83151
|
-
compareFeature(g1, g2) {
|
|
83152
|
-
return g1.id === g2.id && (this.compareProperties ? equal(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
|
|
83153
|
-
}
|
|
83154
|
-
compareFeatureCollection(g1, g2) {
|
|
83155
|
-
return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
|
|
83156
|
-
}
|
|
83157
|
-
compareBBox(g1, g2) {
|
|
83158
|
-
return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
|
|
83159
|
-
}
|
|
83160
|
-
};
|
|
83161
|
-
__name(_GeojsonEquality, "GeojsonEquality");
|
|
83162
|
-
var GeojsonEquality = _GeojsonEquality;
|
|
83163
|
-
function sameLength(g1, g2) {
|
|
83164
|
-
return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
|
|
83165
|
-
}
|
|
83166
|
-
__name(sameLength, "sameLength");
|
|
83167
|
-
function explode(g2) {
|
|
83168
|
-
return g2.coordinates.map((part) => ({
|
|
83169
|
-
type: g2.type.replace("Multi", ""),
|
|
83170
|
-
coordinates: part
|
|
83171
|
-
}));
|
|
83172
|
-
}
|
|
83173
|
-
__name(explode, "explode");
|
|
83174
|
-
function geojsonEquality(g1, g2, opts) {
|
|
83175
|
-
const eq2 = new GeojsonEquality(opts);
|
|
83176
|
-
return eq2.compare(g1, g2);
|
|
83177
|
-
}
|
|
83178
|
-
__name(geojsonEquality, "geojsonEquality");
|
|
83179
|
-
function equal(object1, object2) {
|
|
83180
|
-
if (object1 === null && object2 === null) {
|
|
83181
|
-
return true;
|
|
83182
|
-
}
|
|
83183
|
-
if (object1 === null || object2 === null) {
|
|
83184
|
-
return false;
|
|
83185
|
-
}
|
|
83186
|
-
const objKeys1 = Object.keys(object1);
|
|
83187
|
-
const objKeys2 = Object.keys(object2);
|
|
83188
|
-
if (objKeys1.length !== objKeys2.length) return false;
|
|
83189
|
-
for (var key of objKeys1) {
|
|
83190
|
-
const value1 = object1[key];
|
|
83191
|
-
const value2 = object2[key];
|
|
83192
|
-
const isObjects = isObject(value1) && isObject(value2);
|
|
83193
|
-
if (isObjects && !equal(value1, value2) || !isObjects && value1 !== value2) {
|
|
83194
|
-
return false;
|
|
83195
|
-
}
|
|
83196
|
-
}
|
|
83197
|
-
return true;
|
|
83198
|
-
}
|
|
83199
|
-
__name(equal, "equal");
|
|
83200
|
-
var isObject = /* @__PURE__ */ __name((object2) => {
|
|
83201
|
-
return object2 != null && typeof object2 === "object";
|
|
83202
|
-
}, "isObject");
|
|
83203
|
-
function booleanOverlap(feature1, feature2) {
|
|
83204
|
-
const geom1 = getGeom(feature1);
|
|
83205
|
-
const geom2 = getGeom(feature2);
|
|
83206
|
-
const type1 = geom1.type;
|
|
83207
|
-
const type2 = geom2.type;
|
|
83208
|
-
if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
|
|
83209
|
-
throw new Error("features must be of the same type");
|
|
83210
|
-
}
|
|
83211
|
-
if (type1 === "Point") throw new Error("Point geometry not supported");
|
|
83212
|
-
if (geojsonEquality(feature1, feature2, { precision: 6 }))
|
|
83213
|
-
return false;
|
|
83214
|
-
let overlap = 0;
|
|
83215
|
-
switch (type1) {
|
|
83216
|
-
case "MultiPoint":
|
|
83217
|
-
for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
|
|
83218
|
-
for (var j = 0; j < geom2.coordinates.length; j++) {
|
|
83219
|
-
var coord1 = geom1.coordinates[i2];
|
|
83220
|
-
var coord2 = geom2.coordinates[j];
|
|
83221
|
-
if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
|
|
83222
|
-
return true;
|
|
83223
|
-
}
|
|
83224
|
-
}
|
|
83225
|
-
}
|
|
83226
|
-
return false;
|
|
83227
|
-
case "LineString":
|
|
83228
|
-
case "MultiLineString":
|
|
83229
|
-
segmentEach(feature1, (segment1) => {
|
|
83230
|
-
segmentEach(feature2, (segment2) => {
|
|
83231
|
-
if (lineOverlap(segment1, segment2).features.length) overlap++;
|
|
83232
|
-
});
|
|
83233
|
-
});
|
|
83234
|
-
break;
|
|
83235
|
-
case "Polygon":
|
|
83236
|
-
case "MultiPolygon":
|
|
83237
|
-
segmentEach(feature1, (segment1) => {
|
|
83238
|
-
segmentEach(feature2, (segment2) => {
|
|
83239
|
-
if (lineIntersect(segment1, segment2).features.length) overlap++;
|
|
83240
|
-
});
|
|
83241
|
-
});
|
|
83242
|
-
break;
|
|
83243
|
-
}
|
|
83244
|
-
return overlap > 0;
|
|
81231
|
+
function inBBox(pt, bbox) {
|
|
81232
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
83245
81233
|
}
|
|
83246
81234
|
var distEs6$2 = {};
|
|
83247
81235
|
var style$1 = {};
|
|
@@ -83338,7 +81326,7 @@ function requireCjs$f() {
|
|
|
83338
81326
|
case "Point":
|
|
83339
81327
|
return point2(coordinates2).geometry;
|
|
83340
81328
|
case "LineString":
|
|
83341
|
-
return
|
|
81329
|
+
return lineString(coordinates2).geometry;
|
|
83342
81330
|
case "Polygon":
|
|
83343
81331
|
return polygon2(coordinates2).geometry;
|
|
83344
81332
|
case "MultiPoint":
|
|
@@ -83408,7 +81396,7 @@ function requireCjs$f() {
|
|
|
83408
81396
|
options
|
|
83409
81397
|
);
|
|
83410
81398
|
}
|
|
83411
|
-
function
|
|
81399
|
+
function lineString(coordinates2, properties, options = {}) {
|
|
83412
81400
|
if (coordinates2.length < 2) {
|
|
83413
81401
|
throw new Error("coordinates must be an array of two or more positions");
|
|
83414
81402
|
}
|
|
@@ -83421,7 +81409,7 @@ function requireCjs$f() {
|
|
|
83421
81409
|
function lineStrings(coordinates2, properties, options = {}) {
|
|
83422
81410
|
return featureCollection2(
|
|
83423
81411
|
coordinates2.map((coords) => {
|
|
83424
|
-
return
|
|
81412
|
+
return lineString(coords, properties);
|
|
83425
81413
|
}),
|
|
83426
81414
|
options
|
|
83427
81415
|
);
|
|
@@ -83487,7 +81475,7 @@ function requireCjs$f() {
|
|
|
83487
81475
|
return distance2 / factor;
|
|
83488
81476
|
}
|
|
83489
81477
|
function lengthToDegrees(distance2, units) {
|
|
83490
|
-
return
|
|
81478
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
83491
81479
|
}
|
|
83492
81480
|
function bearingToAzimuth(bearing) {
|
|
83493
81481
|
let angle2 = bearing % 360;
|
|
@@ -83505,7 +81493,7 @@ function requireCjs$f() {
|
|
|
83505
81493
|
}
|
|
83506
81494
|
return angle2;
|
|
83507
81495
|
}
|
|
83508
|
-
function
|
|
81496
|
+
function radiansToDegrees(radians2) {
|
|
83509
81497
|
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
83510
81498
|
return normalisedRadians * 180 / Math.PI;
|
|
83511
81499
|
}
|
|
@@ -83539,17 +81527,17 @@ function requireCjs$f() {
|
|
|
83539
81527
|
function isObject2(input) {
|
|
83540
81528
|
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
83541
81529
|
}
|
|
83542
|
-
function validateBBox(
|
|
83543
|
-
if (!
|
|
81530
|
+
function validateBBox(bbox) {
|
|
81531
|
+
if (!bbox) {
|
|
83544
81532
|
throw new Error("bbox is required");
|
|
83545
81533
|
}
|
|
83546
|
-
if (!Array.isArray(
|
|
81534
|
+
if (!Array.isArray(bbox)) {
|
|
83547
81535
|
throw new Error("bbox must be an Array");
|
|
83548
81536
|
}
|
|
83549
|
-
if (
|
|
81537
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
83550
81538
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
83551
81539
|
}
|
|
83552
|
-
|
|
81540
|
+
bbox.forEach((num) => {
|
|
83553
81541
|
if (!isNumber2(num)) {
|
|
83554
81542
|
throw new Error("bbox must only contain numbers");
|
|
83555
81543
|
}
|
|
@@ -83579,7 +81567,7 @@ function requireCjs$f() {
|
|
|
83579
81567
|
cjs$f.isObject = isObject2;
|
|
83580
81568
|
cjs$f.lengthToDegrees = lengthToDegrees;
|
|
83581
81569
|
cjs$f.lengthToRadians = lengthToRadians;
|
|
83582
|
-
cjs$f.lineString =
|
|
81570
|
+
cjs$f.lineString = lineString;
|
|
83583
81571
|
cjs$f.lineStrings = lineStrings;
|
|
83584
81572
|
cjs$f.multiLineString = multiLineString;
|
|
83585
81573
|
cjs$f.multiPoint = multiPoint;
|
|
@@ -83588,7 +81576,7 @@ function requireCjs$f() {
|
|
|
83588
81576
|
cjs$f.points = points;
|
|
83589
81577
|
cjs$f.polygon = polygon2;
|
|
83590
81578
|
cjs$f.polygons = polygons2;
|
|
83591
|
-
cjs$f.radiansToDegrees =
|
|
81579
|
+
cjs$f.radiansToDegrees = radiansToDegrees;
|
|
83592
81580
|
cjs$f.radiansToLength = radiansToLength2;
|
|
83593
81581
|
cjs$f.round = round2;
|
|
83594
81582
|
cjs$f.validateBBox = validateBBox;
|
|
@@ -83603,7 +81591,7 @@ function requireCjs$e() {
|
|
|
83603
81591
|
hasRequiredCjs$e = 1;
|
|
83604
81592
|
Object.defineProperty(cjs$d, "__esModule", { value: true });
|
|
83605
81593
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
83606
|
-
function
|
|
81594
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
83607
81595
|
if (geojson === null) return;
|
|
83608
81596
|
var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
83609
81597
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -83690,7 +81678,7 @@ function requireCjs$e() {
|
|
|
83690
81678
|
break;
|
|
83691
81679
|
case "GeometryCollection":
|
|
83692
81680
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
83693
|
-
if (
|
|
81681
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
83694
81682
|
return false;
|
|
83695
81683
|
break;
|
|
83696
81684
|
default:
|
|
@@ -83701,7 +81689,7 @@ function requireCjs$e() {
|
|
|
83701
81689
|
}
|
|
83702
81690
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
83703
81691
|
var previousValue = initialValue;
|
|
83704
|
-
|
|
81692
|
+
coordEach(
|
|
83705
81693
|
geojson,
|
|
83706
81694
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
83707
81695
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -83743,7 +81731,7 @@ function requireCjs$e() {
|
|
|
83743
81731
|
});
|
|
83744
81732
|
return previousValue;
|
|
83745
81733
|
}
|
|
83746
|
-
function
|
|
81734
|
+
function featureEach(geojson, callback) {
|
|
83747
81735
|
if (geojson.type === "Feature") {
|
|
83748
81736
|
callback(geojson, 0);
|
|
83749
81737
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -83754,7 +81742,7 @@ function requireCjs$e() {
|
|
|
83754
81742
|
}
|
|
83755
81743
|
function featureReduce(geojson, callback, initialValue) {
|
|
83756
81744
|
var previousValue = initialValue;
|
|
83757
|
-
|
|
81745
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
83758
81746
|
if (featureIndex === 0 && initialValue === void 0)
|
|
83759
81747
|
previousValue = currentFeature;
|
|
83760
81748
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -83763,7 +81751,7 @@ function requireCjs$e() {
|
|
|
83763
81751
|
}
|
|
83764
81752
|
function coordAll(geojson) {
|
|
83765
81753
|
var coords = [];
|
|
83766
|
-
|
|
81754
|
+
coordEach(geojson, function(coord) {
|
|
83767
81755
|
coords.push(coord);
|
|
83768
81756
|
});
|
|
83769
81757
|
return coords;
|
|
@@ -83848,7 +81836,7 @@ function requireCjs$e() {
|
|
|
83848
81836
|
return previousValue;
|
|
83849
81837
|
}
|
|
83850
81838
|
function flattenEach2(geojson, callback) {
|
|
83851
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
81839
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
83852
81840
|
var type = geometry2 === null ? null : geometry2.type;
|
|
83853
81841
|
switch (type) {
|
|
83854
81842
|
case null:
|
|
@@ -83856,7 +81844,7 @@ function requireCjs$e() {
|
|
|
83856
81844
|
case "LineString":
|
|
83857
81845
|
case "Polygon":
|
|
83858
81846
|
if (callback(
|
|
83859
|
-
_helpers.feature.call(void 0, geometry2, properties, { bbox
|
|
81847
|
+
_helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
|
|
83860
81848
|
featureIndex,
|
|
83861
81849
|
0
|
|
83862
81850
|
) === false)
|
|
@@ -83904,7 +81892,7 @@ function requireCjs$e() {
|
|
|
83904
81892
|
);
|
|
83905
81893
|
return previousValue;
|
|
83906
81894
|
}
|
|
83907
|
-
function
|
|
81895
|
+
function segmentEach(geojson, callback) {
|
|
83908
81896
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
83909
81897
|
var segmentIndex = 0;
|
|
83910
81898
|
if (!feature2.geometry) return;
|
|
@@ -83914,7 +81902,7 @@ function requireCjs$e() {
|
|
|
83914
81902
|
var previousFeatureIndex = 0;
|
|
83915
81903
|
var previousMultiIndex = 0;
|
|
83916
81904
|
var prevGeomIndex = 0;
|
|
83917
|
-
if (
|
|
81905
|
+
if (coordEach(
|
|
83918
81906
|
feature2,
|
|
83919
81907
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
83920
81908
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -83948,7 +81936,7 @@ function requireCjs$e() {
|
|
|
83948
81936
|
function segmentReduce(geojson, callback, initialValue) {
|
|
83949
81937
|
var previousValue = initialValue;
|
|
83950
81938
|
var started = false;
|
|
83951
|
-
|
|
81939
|
+
segmentEach(
|
|
83952
81940
|
geojson,
|
|
83953
81941
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
83954
81942
|
if (started === false && initialValue === void 0)
|
|
@@ -84175,9 +82163,9 @@ function requireCjs$e() {
|
|
|
84175
82163
|
throw new Error("geojson is invalid");
|
|
84176
82164
|
}
|
|
84177
82165
|
cjs$d.coordAll = coordAll;
|
|
84178
|
-
cjs$d.coordEach =
|
|
82166
|
+
cjs$d.coordEach = coordEach;
|
|
84179
82167
|
cjs$d.coordReduce = coordReduce;
|
|
84180
|
-
cjs$d.featureEach =
|
|
82168
|
+
cjs$d.featureEach = featureEach;
|
|
84181
82169
|
cjs$d.featureReduce = featureReduce;
|
|
84182
82170
|
cjs$d.findPoint = findPoint;
|
|
84183
82171
|
cjs$d.findSegment = findSegment;
|
|
@@ -84189,7 +82177,7 @@ function requireCjs$e() {
|
|
|
84189
82177
|
cjs$d.lineReduce = lineReduce;
|
|
84190
82178
|
cjs$d.propEach = propEach;
|
|
84191
82179
|
cjs$d.propReduce = propReduce;
|
|
84192
|
-
cjs$d.segmentEach =
|
|
82180
|
+
cjs$d.segmentEach = segmentEach;
|
|
84193
82181
|
cjs$d.segmentReduce = segmentReduce;
|
|
84194
82182
|
return cjs$d;
|
|
84195
82183
|
}
|
|
@@ -84199,7 +82187,7 @@ function requireCjs$d() {
|
|
|
84199
82187
|
hasRequiredCjs$d = 1;
|
|
84200
82188
|
Object.defineProperty(cjs$e, "__esModule", { value: true });
|
|
84201
82189
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
84202
|
-
function
|
|
82190
|
+
function bbox(geojson, options = {}) {
|
|
84203
82191
|
if (geojson.bbox != null && true !== options.recompute) {
|
|
84204
82192
|
return geojson.bbox;
|
|
84205
82193
|
}
|
|
@@ -84220,8 +82208,8 @@ function requireCjs$d() {
|
|
|
84220
82208
|
});
|
|
84221
82209
|
return result;
|
|
84222
82210
|
}
|
|
84223
|
-
var turf_bbox_default =
|
|
84224
|
-
cjs$e.bbox =
|
|
82211
|
+
var turf_bbox_default = bbox;
|
|
82212
|
+
cjs$e.bbox = bbox;
|
|
84225
82213
|
cjs$e.default = turf_bbox_default;
|
|
84226
82214
|
return cjs$e;
|
|
84227
82215
|
}
|
|
@@ -84305,7 +82293,7 @@ function requireJs$p() {
|
|
|
84305
82293
|
case "Point":
|
|
84306
82294
|
return point2(coordinates2).geometry;
|
|
84307
82295
|
case "LineString":
|
|
84308
|
-
return
|
|
82296
|
+
return lineString(coordinates2).geometry;
|
|
84309
82297
|
case "Polygon":
|
|
84310
82298
|
return polygon2(coordinates2).geometry;
|
|
84311
82299
|
case "MultiPoint":
|
|
@@ -84382,7 +82370,7 @@ function requireJs$p() {
|
|
|
84382
82370
|
}), options);
|
|
84383
82371
|
}
|
|
84384
82372
|
exports2.polygons = polygons2;
|
|
84385
|
-
function
|
|
82373
|
+
function lineString(coordinates2, properties, options) {
|
|
84386
82374
|
if (options === void 0) {
|
|
84387
82375
|
options = {};
|
|
84388
82376
|
}
|
|
@@ -84395,13 +82383,13 @@ function requireJs$p() {
|
|
|
84395
82383
|
};
|
|
84396
82384
|
return feature2(geom, properties, options);
|
|
84397
82385
|
}
|
|
84398
|
-
exports2.lineString =
|
|
82386
|
+
exports2.lineString = lineString;
|
|
84399
82387
|
function lineStrings(coordinates2, properties, options) {
|
|
84400
82388
|
if (options === void 0) {
|
|
84401
82389
|
options = {};
|
|
84402
82390
|
}
|
|
84403
82391
|
return featureCollection2(coordinates2.map(function(coords) {
|
|
84404
|
-
return
|
|
82392
|
+
return lineString(coords, properties);
|
|
84405
82393
|
}), options);
|
|
84406
82394
|
}
|
|
84407
82395
|
exports2.lineStrings = lineStrings;
|
|
@@ -84498,7 +82486,7 @@ function requireJs$p() {
|
|
|
84498
82486
|
}
|
|
84499
82487
|
exports2.lengthToRadians = lengthToRadians;
|
|
84500
82488
|
function lengthToDegrees(distance2, units) {
|
|
84501
|
-
return
|
|
82489
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
84502
82490
|
}
|
|
84503
82491
|
exports2.lengthToDegrees = lengthToDegrees;
|
|
84504
82492
|
function bearingToAzimuth(bearing) {
|
|
@@ -84509,11 +82497,11 @@ function requireJs$p() {
|
|
|
84509
82497
|
return angle2;
|
|
84510
82498
|
}
|
|
84511
82499
|
exports2.bearingToAzimuth = bearingToAzimuth;
|
|
84512
|
-
function
|
|
82500
|
+
function radiansToDegrees(radians2) {
|
|
84513
82501
|
var degrees2 = radians2 % (2 * Math.PI);
|
|
84514
82502
|
return degrees2 * 180 / Math.PI;
|
|
84515
82503
|
}
|
|
84516
|
-
exports2.radiansToDegrees =
|
|
82504
|
+
exports2.radiansToDegrees = radiansToDegrees;
|
|
84517
82505
|
function degreesToRadians2(degrees2) {
|
|
84518
82506
|
var radians2 = degrees2 % 360;
|
|
84519
82507
|
return radians2 * Math.PI / 180;
|
|
@@ -84561,17 +82549,17 @@ function requireJs$p() {
|
|
|
84561
82549
|
return !!input && input.constructor === Object;
|
|
84562
82550
|
}
|
|
84563
82551
|
exports2.isObject = isObject2;
|
|
84564
|
-
function validateBBox(
|
|
84565
|
-
if (!
|
|
82552
|
+
function validateBBox(bbox) {
|
|
82553
|
+
if (!bbox) {
|
|
84566
82554
|
throw new Error("bbox is required");
|
|
84567
82555
|
}
|
|
84568
|
-
if (!Array.isArray(
|
|
82556
|
+
if (!Array.isArray(bbox)) {
|
|
84569
82557
|
throw new Error("bbox must be an Array");
|
|
84570
82558
|
}
|
|
84571
|
-
if (
|
|
82559
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
84572
82560
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
84573
82561
|
}
|
|
84574
|
-
|
|
82562
|
+
bbox.forEach(function(num) {
|
|
84575
82563
|
if (!isNumber2(num)) {
|
|
84576
82564
|
throw new Error("bbox must only contain numbers");
|
|
84577
82565
|
}
|
|
@@ -84596,22 +82584,22 @@ function requireJs$o() {
|
|
|
84596
82584
|
hasRequiredJs$o = 1;
|
|
84597
82585
|
Object.defineProperty(js$p, "__esModule", { value: true });
|
|
84598
82586
|
var helpers_1 = /* @__PURE__ */ requireJs$p();
|
|
84599
|
-
function bboxPolygon(
|
|
82587
|
+
function bboxPolygon(bbox, options) {
|
|
84600
82588
|
if (options === void 0) {
|
|
84601
82589
|
options = {};
|
|
84602
82590
|
}
|
|
84603
|
-
var west = Number(
|
|
84604
|
-
var south = Number(
|
|
84605
|
-
var east = Number(
|
|
84606
|
-
var north = Number(
|
|
84607
|
-
if (
|
|
82591
|
+
var west = Number(bbox[0]);
|
|
82592
|
+
var south = Number(bbox[1]);
|
|
82593
|
+
var east = Number(bbox[2]);
|
|
82594
|
+
var north = Number(bbox[3]);
|
|
82595
|
+
if (bbox.length === 6) {
|
|
84608
82596
|
throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
84609
82597
|
}
|
|
84610
82598
|
var lowLeft = [west, south];
|
|
84611
82599
|
var topLeft = [west, north];
|
|
84612
82600
|
var topRight = [east, north];
|
|
84613
82601
|
var lowRight = [east, south];
|
|
84614
|
-
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox
|
|
82602
|
+
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
|
|
84615
82603
|
}
|
|
84616
82604
|
js$p.default = bboxPolygon;
|
|
84617
82605
|
return js$p;
|
|
@@ -84626,7 +82614,7 @@ function requireJs$n() {
|
|
|
84626
82614
|
hasRequiredJs$n = 1;
|
|
84627
82615
|
Object.defineProperty(js$k, "__esModule", { value: true });
|
|
84628
82616
|
var helpers = /* @__PURE__ */ requireJs$p();
|
|
84629
|
-
function
|
|
82617
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
84630
82618
|
if (geojson === null) return;
|
|
84631
82619
|
var j, k, l2, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
84632
82620
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -84713,7 +82701,7 @@ function requireJs$n() {
|
|
|
84713
82701
|
break;
|
|
84714
82702
|
case "GeometryCollection":
|
|
84715
82703
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
84716
|
-
if (
|
|
82704
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
84717
82705
|
return false;
|
|
84718
82706
|
break;
|
|
84719
82707
|
default:
|
|
@@ -84724,7 +82712,7 @@ function requireJs$n() {
|
|
|
84724
82712
|
}
|
|
84725
82713
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
84726
82714
|
var previousValue = initialValue;
|
|
84727
|
-
|
|
82715
|
+
coordEach(
|
|
84728
82716
|
geojson,
|
|
84729
82717
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
84730
82718
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -84766,7 +82754,7 @@ function requireJs$n() {
|
|
|
84766
82754
|
});
|
|
84767
82755
|
return previousValue;
|
|
84768
82756
|
}
|
|
84769
|
-
function
|
|
82757
|
+
function featureEach(geojson, callback) {
|
|
84770
82758
|
if (geojson.type === "Feature") {
|
|
84771
82759
|
callback(geojson, 0);
|
|
84772
82760
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -84777,7 +82765,7 @@ function requireJs$n() {
|
|
|
84777
82765
|
}
|
|
84778
82766
|
function featureReduce(geojson, callback, initialValue) {
|
|
84779
82767
|
var previousValue = initialValue;
|
|
84780
|
-
|
|
82768
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
84781
82769
|
if (featureIndex === 0 && initialValue === void 0)
|
|
84782
82770
|
previousValue = currentFeature;
|
|
84783
82771
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -84786,7 +82774,7 @@ function requireJs$n() {
|
|
|
84786
82774
|
}
|
|
84787
82775
|
function coordAll(geojson) {
|
|
84788
82776
|
var coords = [];
|
|
84789
|
-
|
|
82777
|
+
coordEach(geojson, function(coord) {
|
|
84790
82778
|
coords.push(coord);
|
|
84791
82779
|
});
|
|
84792
82780
|
return coords;
|
|
@@ -84871,7 +82859,7 @@ function requireJs$n() {
|
|
|
84871
82859
|
return previousValue;
|
|
84872
82860
|
}
|
|
84873
82861
|
function flattenEach2(geojson, callback) {
|
|
84874
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
82862
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
84875
82863
|
var type = geometry2 === null ? null : geometry2.type;
|
|
84876
82864
|
switch (type) {
|
|
84877
82865
|
case null:
|
|
@@ -84879,7 +82867,7 @@ function requireJs$n() {
|
|
|
84879
82867
|
case "LineString":
|
|
84880
82868
|
case "Polygon":
|
|
84881
82869
|
if (callback(
|
|
84882
|
-
helpers.feature(geometry2, properties, { bbox
|
|
82870
|
+
helpers.feature(geometry2, properties, { bbox, id }),
|
|
84883
82871
|
featureIndex,
|
|
84884
82872
|
0
|
|
84885
82873
|
) === false)
|
|
@@ -84927,7 +82915,7 @@ function requireJs$n() {
|
|
|
84927
82915
|
);
|
|
84928
82916
|
return previousValue;
|
|
84929
82917
|
}
|
|
84930
|
-
function
|
|
82918
|
+
function segmentEach(geojson, callback) {
|
|
84931
82919
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
84932
82920
|
var segmentIndex = 0;
|
|
84933
82921
|
if (!feature2.geometry) return;
|
|
@@ -84937,7 +82925,7 @@ function requireJs$n() {
|
|
|
84937
82925
|
var previousFeatureIndex = 0;
|
|
84938
82926
|
var previousMultiIndex = 0;
|
|
84939
82927
|
var prevGeomIndex = 0;
|
|
84940
|
-
if (
|
|
82928
|
+
if (coordEach(
|
|
84941
82929
|
feature2,
|
|
84942
82930
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
84943
82931
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -84970,7 +82958,7 @@ function requireJs$n() {
|
|
|
84970
82958
|
function segmentReduce(geojson, callback, initialValue) {
|
|
84971
82959
|
var previousValue = initialValue;
|
|
84972
82960
|
var started = false;
|
|
84973
|
-
|
|
82961
|
+
segmentEach(
|
|
84974
82962
|
geojson,
|
|
84975
82963
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
84976
82964
|
if (started === false && initialValue === void 0)
|
|
@@ -85192,9 +83180,9 @@ function requireJs$n() {
|
|
|
85192
83180
|
throw new Error("geojson is invalid");
|
|
85193
83181
|
}
|
|
85194
83182
|
js$k.coordAll = coordAll;
|
|
85195
|
-
js$k.coordEach =
|
|
83183
|
+
js$k.coordEach = coordEach;
|
|
85196
83184
|
js$k.coordReduce = coordReduce;
|
|
85197
|
-
js$k.featureEach =
|
|
83185
|
+
js$k.featureEach = featureEach;
|
|
85198
83186
|
js$k.featureReduce = featureReduce;
|
|
85199
83187
|
js$k.findPoint = findPoint;
|
|
85200
83188
|
js$k.findSegment = findSegment;
|
|
@@ -85206,7 +83194,7 @@ function requireJs$n() {
|
|
|
85206
83194
|
js$k.lineReduce = lineReduce;
|
|
85207
83195
|
js$k.propEach = propEach;
|
|
85208
83196
|
js$k.propReduce = propReduce;
|
|
85209
|
-
js$k.segmentEach =
|
|
83197
|
+
js$k.segmentEach = segmentEach;
|
|
85210
83198
|
js$k.segmentReduce = segmentReduce;
|
|
85211
83199
|
return js$k;
|
|
85212
83200
|
}
|
|
@@ -85216,7 +83204,7 @@ function requireJs$m() {
|
|
|
85216
83204
|
hasRequiredJs$m = 1;
|
|
85217
83205
|
Object.defineProperty(js$l, "__esModule", { value: true });
|
|
85218
83206
|
var meta_1 = /* @__PURE__ */ requireJs$n();
|
|
85219
|
-
function
|
|
83207
|
+
function bbox(geojson) {
|
|
85220
83208
|
var result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
85221
83209
|
meta_1.coordEach(geojson, function(coord) {
|
|
85222
83210
|
if (result[0] > coord[0]) {
|
|
@@ -85234,8 +83222,8 @@ function requireJs$m() {
|
|
|
85234
83222
|
});
|
|
85235
83223
|
return result;
|
|
85236
83224
|
}
|
|
85237
|
-
|
|
85238
|
-
js$l.default =
|
|
83225
|
+
bbox["default"] = bbox;
|
|
83226
|
+
js$l.default = bbox;
|
|
85239
83227
|
return js$l;
|
|
85240
83228
|
}
|
|
85241
83229
|
var hasRequiredJs$l;
|
|
@@ -95466,7 +93454,7 @@ function length$1(object2) {
|
|
|
95466
93454
|
return +lengthSum$1;
|
|
95467
93455
|
}
|
|
95468
93456
|
var coordinates = [null, null], object = { type: "LineString", coordinates };
|
|
95469
|
-
function distance(a2, b) {
|
|
93457
|
+
function distance$1(a2, b) {
|
|
95470
93458
|
coordinates[0] = a2;
|
|
95471
93459
|
coordinates[1] = b;
|
|
95472
93460
|
return length$1(object);
|
|
@@ -95519,10 +93507,10 @@ function containsGeometry(geometry2, point2) {
|
|
|
95519
93507
|
return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
|
|
95520
93508
|
}
|
|
95521
93509
|
function containsPoint(coordinates2, point2) {
|
|
95522
|
-
return distance(coordinates2, point2) === 0;
|
|
93510
|
+
return distance$1(coordinates2, point2) === 0;
|
|
95523
93511
|
}
|
|
95524
93512
|
function containsLine(coordinates2, point2) {
|
|
95525
|
-
var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
|
|
93513
|
+
var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
|
|
95526
93514
|
return ao + ob <= ab + epsilon;
|
|
95527
93515
|
}
|
|
95528
93516
|
function containsPolygon(coordinates2, point2) {
|
|
@@ -96739,7 +94727,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
96739
94727
|
geoConicEquidistant: conicEquidistant,
|
|
96740
94728
|
geoConicEquidistantRaw: conicEquidistantRaw,
|
|
96741
94729
|
geoContains: contains,
|
|
96742
|
-
geoDistance: distance,
|
|
94730
|
+
geoDistance: distance$1,
|
|
96743
94731
|
geoEquirectangular: equirectangular,
|
|
96744
94732
|
geoEquirectangularRaw: equirectangularRaw,
|
|
96745
94733
|
geoGnomonic: gnomonic,
|
|
@@ -97439,8 +95427,8 @@ function requirePolygonClipping_umd() {
|
|
|
97439
95427
|
sort(keys2, values, left, j, compare2);
|
|
97440
95428
|
sort(keys2, values, j + 1, right, compare2);
|
|
97441
95429
|
}
|
|
97442
|
-
var isInBbox2 = function isInBbox3(
|
|
97443
|
-
return
|
|
95430
|
+
var isInBbox2 = function isInBbox3(bbox, point2) {
|
|
95431
|
+
return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
|
|
97444
95432
|
};
|
|
97445
95433
|
var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
|
|
97446
95434
|
if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
|
|
@@ -97820,7 +95808,7 @@ function requirePolygonClipping_umd() {
|
|
|
97820
95808
|
}
|
|
97821
95809
|
}, {
|
|
97822
95810
|
key: "bbox",
|
|
97823
|
-
value: function
|
|
95811
|
+
value: function bbox() {
|
|
97824
95812
|
var y12 = this.leftSE.point.y;
|
|
97825
95813
|
var y2 = this.rightSE.point.y;
|
|
97826
95814
|
return {
|
|
@@ -98757,7 +96745,7 @@ function requireJs$j() {
|
|
|
98757
96745
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
98758
96746
|
}
|
|
98759
96747
|
js$i.getCoord = getCoord2;
|
|
98760
|
-
function
|
|
96748
|
+
function getCoords(coords) {
|
|
98761
96749
|
if (Array.isArray(coords)) {
|
|
98762
96750
|
return coords;
|
|
98763
96751
|
}
|
|
@@ -98772,7 +96760,7 @@ function requireJs$j() {
|
|
|
98772
96760
|
}
|
|
98773
96761
|
throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
|
|
98774
96762
|
}
|
|
98775
|
-
js$i.getCoords =
|
|
96763
|
+
js$i.getCoords = getCoords;
|
|
98776
96764
|
function containsNumber(coordinates2) {
|
|
98777
96765
|
if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
|
|
98778
96766
|
return true;
|
|
@@ -98902,7 +96890,7 @@ function requireCjs$c() {
|
|
|
98902
96890
|
}
|
|
98903
96891
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
98904
96892
|
}
|
|
98905
|
-
function
|
|
96893
|
+
function getCoords(coords) {
|
|
98906
96894
|
if (Array.isArray(coords)) {
|
|
98907
96895
|
return coords;
|
|
98908
96896
|
}
|
|
@@ -99004,7 +96992,7 @@ function requireCjs$c() {
|
|
|
99004
96992
|
cjs$b.featureOf = featureOf;
|
|
99005
96993
|
cjs$b.geojsonType = geojsonType;
|
|
99006
96994
|
cjs$b.getCoord = getCoord2;
|
|
99007
|
-
cjs$b.getCoords =
|
|
96995
|
+
cjs$b.getCoords = getCoords;
|
|
99008
96996
|
cjs$b.getGeom = getGeom2;
|
|
99009
96997
|
cjs$b.getType = getType;
|
|
99010
96998
|
return cjs$b;
|
|
@@ -99477,7 +97465,7 @@ function requireFeature() {
|
|
|
99477
97465
|
}
|
|
99478
97466
|
_createClass(Feature2, [{
|
|
99479
97467
|
key: "getCoords",
|
|
99480
|
-
value: function
|
|
97468
|
+
value: function getCoords() {
|
|
99481
97469
|
return this.geoJson.geometry.coordinates;
|
|
99482
97470
|
}
|
|
99483
97471
|
}]);
|
|
@@ -101658,7 +99646,7 @@ function requireCjs$a() {
|
|
|
101658
99646
|
var __defProp2 = Object.defineProperty;
|
|
101659
99647
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
101660
99648
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
101661
|
-
var
|
|
99649
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
101662
99650
|
var __export = (target, all) => {
|
|
101663
99651
|
for (var name2 in all)
|
|
101664
99652
|
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -101666,7 +99654,7 @@ function requireCjs$a() {
|
|
|
101666
99654
|
var __copyProps = (to, from, except, desc) => {
|
|
101667
99655
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
101668
99656
|
for (let key of __getOwnPropNames(from))
|
|
101669
|
-
if (!
|
|
99657
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
101670
99658
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
101671
99659
|
}
|
|
101672
99660
|
return to;
|
|
@@ -102372,7 +100360,7 @@ function requireCjs$9() {
|
|
|
102372
100360
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
102373
100361
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
102374
100362
|
var __getProtoOf = Object.getPrototypeOf;
|
|
102375
|
-
var
|
|
100363
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
102376
100364
|
var __export = (target, all) => {
|
|
102377
100365
|
for (var name2 in all)
|
|
102378
100366
|
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -102380,7 +100368,7 @@ function requireCjs$9() {
|
|
|
102380
100368
|
var __copyProps = (to, from, except, desc) => {
|
|
102381
100369
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
102382
100370
|
for (let key of __getOwnPropNames(from))
|
|
102383
|
-
if (!
|
|
100371
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
102384
100372
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
102385
100373
|
}
|
|
102386
100374
|
return to;
|
|
@@ -102462,8 +100450,8 @@ function requireCjs$9() {
|
|
|
102462
100450
|
};
|
|
102463
100451
|
};
|
|
102464
100452
|
var precision2 = set2();
|
|
102465
|
-
var isInBbox2 = (
|
|
102466
|
-
return
|
|
100453
|
+
var isInBbox2 = (bbox, point2) => {
|
|
100454
|
+
return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
|
|
102467
100455
|
};
|
|
102468
100456
|
var getBboxOverlap2 = (b1, b2) => {
|
|
102469
100457
|
if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
|
|
@@ -104038,7 +102026,7 @@ function requireUtils$2() {
|
|
|
104038
102026
|
utils$2.distance2d = distance2d;
|
|
104039
102027
|
utils$2.mix = mix;
|
|
104040
102028
|
utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
|
|
104041
|
-
utils$2.nearestPointOnLine =
|
|
102029
|
+
utils$2.nearestPointOnLine = nearestPointOnLine;
|
|
104042
102030
|
utils$2.getPickedEditHandle = getPickedEditHandle;
|
|
104043
102031
|
utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
|
|
104044
102032
|
utils$2.getNonGuidePicks = getNonGuidePicks;
|
|
@@ -104135,12 +102123,12 @@ function requireUtils$2() {
|
|
|
104135
102123
|
return false;
|
|
104136
102124
|
}
|
|
104137
102125
|
function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
|
|
104138
|
-
var
|
|
102126
|
+
var lineString = {
|
|
104139
102127
|
type: "LineString",
|
|
104140
102128
|
coordinates: [p1, p2]
|
|
104141
102129
|
};
|
|
104142
102130
|
var pt = (0, _helpers.point)(mapCoords);
|
|
104143
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
102131
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
104144
102132
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
104145
102133
|
var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
104146
102134
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -104206,7 +102194,7 @@ function requireUtils$2() {
|
|
|
104206
102194
|
}
|
|
104207
102195
|
};
|
|
104208
102196
|
}
|
|
104209
|
-
function
|
|
102197
|
+
function nearestPointOnLine(lines, inPoint, viewport) {
|
|
104210
102198
|
var _lines$geometry, _lines$geometry2;
|
|
104211
102199
|
var mercator2;
|
|
104212
102200
|
if (viewport) {
|
|
@@ -104726,8 +102714,8 @@ function requireImmutableFeatureCollection() {
|
|
|
104726
102714
|
}
|
|
104727
102715
|
function pruneMultiLineStringIfNecessary(geometry2) {
|
|
104728
102716
|
for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
|
|
104729
|
-
var
|
|
104730
|
-
if (
|
|
102717
|
+
var lineString = geometry2.coordinates[lineStringIndex];
|
|
102718
|
+
if (lineString.length === 1) {
|
|
104731
102719
|
geometry2.coordinates.splice(lineStringIndex, 1);
|
|
104732
102720
|
lineStringIndex--;
|
|
104733
102721
|
}
|
|
@@ -105316,8 +103304,8 @@ function requireModifyMode() {
|
|
|
105316
103304
|
var intermediatePoint = null;
|
|
105317
103305
|
var positionIndexPrefix = [];
|
|
105318
103306
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
105319
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
105320
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
103307
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
103308
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
105321
103309
|
var candidateIntermediatePoint = _this.getNearestPoint(
|
|
105322
103310
|
// @ts-ignore
|
|
105323
103311
|
lineStringFeature,
|
|
@@ -105493,29 +103481,29 @@ function requireCjs$6() {
|
|
|
105493
103481
|
hasRequiredCjs$6 = 1;
|
|
105494
103482
|
Object.defineProperty(cjs$6, "__esModule", { value: true });
|
|
105495
103483
|
var __defProp2 = Object.defineProperty;
|
|
105496
|
-
var
|
|
105497
|
-
var
|
|
105498
|
-
var
|
|
105499
|
-
var
|
|
105500
|
-
var
|
|
103484
|
+
var __defProps = Object.defineProperties;
|
|
103485
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
103486
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
103487
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
103488
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
105501
103489
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
105502
|
-
var
|
|
103490
|
+
var __spreadValues = (a2, b) => {
|
|
105503
103491
|
for (var prop in b || (b = {}))
|
|
105504
|
-
if (
|
|
103492
|
+
if (__hasOwnProp.call(b, prop))
|
|
105505
103493
|
__defNormalProp2(a2, prop, b[prop]);
|
|
105506
|
-
if (
|
|
105507
|
-
for (var prop of
|
|
105508
|
-
if (
|
|
103494
|
+
if (__getOwnPropSymbols)
|
|
103495
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
103496
|
+
if (__propIsEnum.call(b, prop))
|
|
105509
103497
|
__defNormalProp2(a2, prop, b[prop]);
|
|
105510
103498
|
}
|
|
105511
103499
|
return a2;
|
|
105512
103500
|
};
|
|
105513
|
-
var
|
|
103501
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
105514
103502
|
var _distance = /* @__PURE__ */ requireCjs$b();
|
|
105515
103503
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
105516
103504
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
105517
103505
|
var _invariant = /* @__PURE__ */ requireCjs$c();
|
|
105518
|
-
function
|
|
103506
|
+
function nearestPointOnLine(lines, pt, options = {}) {
|
|
105519
103507
|
if (!lines || !pt) {
|
|
105520
103508
|
throw new Error("lines and pt are required arguments");
|
|
105521
103509
|
}
|
|
@@ -105547,7 +103535,7 @@ function requireCjs$6() {
|
|
|
105547
103535
|
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
105548
103536
|
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
105549
103537
|
} else {
|
|
105550
|
-
[intersectPos, , wasEnd] =
|
|
103538
|
+
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
105551
103539
|
start.geometry.coordinates,
|
|
105552
103540
|
stop.geometry.coordinates,
|
|
105553
103541
|
_invariant.getCoord.call(void 0, pt)
|
|
@@ -105562,8 +103550,8 @@ function requireCjs$6() {
|
|
|
105562
103550
|
});
|
|
105563
103551
|
}
|
|
105564
103552
|
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
105565
|
-
closestPt =
|
|
105566
|
-
properties:
|
|
103553
|
+
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
103554
|
+
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
105567
103555
|
// Legacy behaviour where index progresses to next segment # if we
|
|
105568
103556
|
// went with the end point this iteration.
|
|
105569
103557
|
index: wasEnd ? i2 + 1 : i2
|
|
@@ -105586,14 +103574,14 @@ function requireCjs$6() {
|
|
|
105586
103574
|
const [v2x, v2y, v2z] = v2;
|
|
105587
103575
|
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
105588
103576
|
}
|
|
105589
|
-
function
|
|
103577
|
+
function magnitude(v) {
|
|
105590
103578
|
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
105591
103579
|
}
|
|
105592
103580
|
function angle2(v12, v2) {
|
|
105593
|
-
const theta = dot2(v12, v2) / (
|
|
103581
|
+
const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
105594
103582
|
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
105595
103583
|
}
|
|
105596
|
-
function
|
|
103584
|
+
function lngLatToVector(a2) {
|
|
105597
103585
|
const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
|
|
105598
103586
|
const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
|
|
105599
103587
|
return [
|
|
@@ -105602,16 +103590,16 @@ function requireCjs$6() {
|
|
|
105602
103590
|
Math.sin(lat)
|
|
105603
103591
|
];
|
|
105604
103592
|
}
|
|
105605
|
-
function
|
|
103593
|
+
function vectorToLngLat(v) {
|
|
105606
103594
|
const [x, y, z] = v;
|
|
105607
103595
|
const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z));
|
|
105608
103596
|
const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
|
|
105609
103597
|
return [lng, lat];
|
|
105610
103598
|
}
|
|
105611
|
-
function
|
|
105612
|
-
const A2 =
|
|
105613
|
-
const B2 =
|
|
105614
|
-
const C3 =
|
|
103599
|
+
function nearestPointOnSegment(posA, posB, posC) {
|
|
103600
|
+
const A2 = lngLatToVector(posA);
|
|
103601
|
+
const B2 = lngLatToVector(posB);
|
|
103602
|
+
const C3 = lngLatToVector(posC);
|
|
105615
103603
|
const [Cx, Cy, Cz] = C3;
|
|
105616
103604
|
const [D2, E2, F] = cross2(A2, B2);
|
|
105617
103605
|
const a2 = E2 * Cz - F * Cy;
|
|
@@ -105635,17 +103623,17 @@ function requireCjs$6() {
|
|
|
105635
103623
|
I3 = I2;
|
|
105636
103624
|
}
|
|
105637
103625
|
if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
|
|
105638
|
-
if (_distance.distance.call(void 0,
|
|
105639
|
-
return [
|
|
103626
|
+
if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
103627
|
+
return [vectorToLngLat(A2), true, false];
|
|
105640
103628
|
} else {
|
|
105641
|
-
return [
|
|
103629
|
+
return [vectorToLngLat(B2), false, true];
|
|
105642
103630
|
}
|
|
105643
103631
|
}
|
|
105644
|
-
return [
|
|
103632
|
+
return [vectorToLngLat(I3), false, false];
|
|
105645
103633
|
}
|
|
105646
|
-
var turf_nearest_point_on_line_default =
|
|
103634
|
+
var turf_nearest_point_on_line_default = nearestPointOnLine;
|
|
105647
103635
|
cjs$6.default = turf_nearest_point_on_line_default;
|
|
105648
|
-
cjs$6.nearestPointOnLine =
|
|
103636
|
+
cjs$6.nearestPointOnLine = nearestPointOnLine;
|
|
105649
103637
|
return cjs$6;
|
|
105650
103638
|
}
|
|
105651
103639
|
var cjs$5 = {};
|
|
@@ -105845,8 +103833,8 @@ function requireResizeCircleMode() {
|
|
|
105845
103833
|
var intermediatePoint = null;
|
|
105846
103834
|
var positionIndexPrefix = [];
|
|
105847
103835
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
105848
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
105849
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
103836
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
103837
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
105850
103838
|
var candidateIntermediatePoint = _this2.getNearestPoint(
|
|
105851
103839
|
// @ts-ignore
|
|
105852
103840
|
lineStringFeature,
|
|
@@ -106484,11 +104472,11 @@ function requireJs$4() {
|
|
|
106484
104472
|
if (origin === void 0 || origin === null) origin = "centroid";
|
|
106485
104473
|
if (Array.isArray(origin) || typeof origin === "object")
|
|
106486
104474
|
return invariant.getCoord(origin);
|
|
106487
|
-
var
|
|
106488
|
-
var west =
|
|
106489
|
-
var south =
|
|
106490
|
-
var east =
|
|
106491
|
-
var north =
|
|
104475
|
+
var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
|
|
104476
|
+
var west = bbox[0];
|
|
104477
|
+
var south = bbox[1];
|
|
104478
|
+
var east = bbox[2];
|
|
104479
|
+
var north = bbox[3];
|
|
106492
104480
|
switch (origin) {
|
|
106493
104481
|
case "sw":
|
|
106494
104482
|
case "southwest":
|
|
@@ -107844,9 +105832,9 @@ function requireCjs$2() {
|
|
|
107844
105832
|
const pt = _invariant.getCoord.call(void 0, point2);
|
|
107845
105833
|
const geom = _invariant.getGeom.call(void 0, polygon2);
|
|
107846
105834
|
const type = geom.type;
|
|
107847
|
-
const
|
|
105835
|
+
const bbox = polygon2.bbox;
|
|
107848
105836
|
let polys = geom.coordinates;
|
|
107849
|
-
if (
|
|
105837
|
+
if (bbox && inBBox2(pt, bbox) === false) {
|
|
107850
105838
|
return false;
|
|
107851
105839
|
}
|
|
107852
105840
|
if (type === "Polygon") {
|
|
@@ -107860,8 +105848,8 @@ function requireCjs$2() {
|
|
|
107860
105848
|
}
|
|
107861
105849
|
return result;
|
|
107862
105850
|
}
|
|
107863
|
-
function inBBox2(pt,
|
|
107864
|
-
return
|
|
105851
|
+
function inBBox2(pt, bbox) {
|
|
105852
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
107865
105853
|
}
|
|
107866
105854
|
var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
|
|
107867
105855
|
cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
|
|
@@ -107869,6 +105857,206 @@ function requireCjs$2() {
|
|
|
107869
105857
|
return cjs$3;
|
|
107870
105858
|
}
|
|
107871
105859
|
var cjs$1 = {};
|
|
105860
|
+
class TinyQueue {
|
|
105861
|
+
constructor(data = [], compare2 = defaultCompare$1) {
|
|
105862
|
+
this.data = data;
|
|
105863
|
+
this.length = this.data.length;
|
|
105864
|
+
this.compare = compare2;
|
|
105865
|
+
if (this.length > 0) {
|
|
105866
|
+
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
105867
|
+
}
|
|
105868
|
+
}
|
|
105869
|
+
push(item) {
|
|
105870
|
+
this.data.push(item);
|
|
105871
|
+
this.length++;
|
|
105872
|
+
this._up(this.length - 1);
|
|
105873
|
+
}
|
|
105874
|
+
pop() {
|
|
105875
|
+
if (this.length === 0) return void 0;
|
|
105876
|
+
const top = this.data[0];
|
|
105877
|
+
const bottom = this.data.pop();
|
|
105878
|
+
this.length--;
|
|
105879
|
+
if (this.length > 0) {
|
|
105880
|
+
this.data[0] = bottom;
|
|
105881
|
+
this._down(0);
|
|
105882
|
+
}
|
|
105883
|
+
return top;
|
|
105884
|
+
}
|
|
105885
|
+
peek() {
|
|
105886
|
+
return this.data[0];
|
|
105887
|
+
}
|
|
105888
|
+
_up(pos) {
|
|
105889
|
+
const { data, compare: compare2 } = this;
|
|
105890
|
+
const item = data[pos];
|
|
105891
|
+
while (pos > 0) {
|
|
105892
|
+
const parent = pos - 1 >> 1;
|
|
105893
|
+
const current = data[parent];
|
|
105894
|
+
if (compare2(item, current) >= 0) break;
|
|
105895
|
+
data[pos] = current;
|
|
105896
|
+
pos = parent;
|
|
105897
|
+
}
|
|
105898
|
+
data[pos] = item;
|
|
105899
|
+
}
|
|
105900
|
+
_down(pos) {
|
|
105901
|
+
const { data, compare: compare2 } = this;
|
|
105902
|
+
const halfLength = this.length >> 1;
|
|
105903
|
+
const item = data[pos];
|
|
105904
|
+
while (pos < halfLength) {
|
|
105905
|
+
let left = (pos << 1) + 1;
|
|
105906
|
+
let best = data[left];
|
|
105907
|
+
const right = left + 1;
|
|
105908
|
+
if (right < this.length && compare2(data[right], best) < 0) {
|
|
105909
|
+
left = right;
|
|
105910
|
+
best = data[right];
|
|
105911
|
+
}
|
|
105912
|
+
if (compare2(best, item) >= 0) break;
|
|
105913
|
+
data[pos] = best;
|
|
105914
|
+
pos = left;
|
|
105915
|
+
}
|
|
105916
|
+
data[pos] = item;
|
|
105917
|
+
}
|
|
105918
|
+
}
|
|
105919
|
+
function defaultCompare$1(a2, b) {
|
|
105920
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
105921
|
+
}
|
|
105922
|
+
function checkWhichEventIsLeft(e1, e2) {
|
|
105923
|
+
if (e1.p.x > e2.p.x) return 1;
|
|
105924
|
+
if (e1.p.x < e2.p.x) return -1;
|
|
105925
|
+
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
105926
|
+
return 1;
|
|
105927
|
+
}
|
|
105928
|
+
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
105929
|
+
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
105930
|
+
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
105931
|
+
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
105932
|
+
return 1;
|
|
105933
|
+
}
|
|
105934
|
+
class Event {
|
|
105935
|
+
constructor(p, featureId2, ringId2, eventId2) {
|
|
105936
|
+
this.p = {
|
|
105937
|
+
x: p[0],
|
|
105938
|
+
y: p[1]
|
|
105939
|
+
};
|
|
105940
|
+
this.featureId = featureId2;
|
|
105941
|
+
this.ringId = ringId2;
|
|
105942
|
+
this.eventId = eventId2;
|
|
105943
|
+
this.otherEvent = null;
|
|
105944
|
+
this.isLeftEndpoint = null;
|
|
105945
|
+
}
|
|
105946
|
+
isSamePoint(eventToCheck) {
|
|
105947
|
+
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
105948
|
+
}
|
|
105949
|
+
}
|
|
105950
|
+
function fillEventQueue(geojson, eventQueue) {
|
|
105951
|
+
if (geojson.type === "FeatureCollection") {
|
|
105952
|
+
const features = geojson.features;
|
|
105953
|
+
for (let i2 = 0; i2 < features.length; i2++) {
|
|
105954
|
+
processFeature(features[i2], eventQueue);
|
|
105955
|
+
}
|
|
105956
|
+
} else {
|
|
105957
|
+
processFeature(geojson, eventQueue);
|
|
105958
|
+
}
|
|
105959
|
+
}
|
|
105960
|
+
let featureId = 0;
|
|
105961
|
+
let ringId = 0;
|
|
105962
|
+
let eventId = 0;
|
|
105963
|
+
function processFeature(featureOrGeometry, eventQueue) {
|
|
105964
|
+
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
105965
|
+
let coords = geom.coordinates;
|
|
105966
|
+
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
105967
|
+
if (geom.type === "LineString") coords = [[coords]];
|
|
105968
|
+
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
105969
|
+
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
105970
|
+
let currentP = coords[i2][ii][0];
|
|
105971
|
+
let nextP = null;
|
|
105972
|
+
ringId = ringId + 1;
|
|
105973
|
+
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
105974
|
+
nextP = coords[i2][ii][iii + 1];
|
|
105975
|
+
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
105976
|
+
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
105977
|
+
e1.otherEvent = e2;
|
|
105978
|
+
e2.otherEvent = e1;
|
|
105979
|
+
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
105980
|
+
e2.isLeftEndpoint = true;
|
|
105981
|
+
e1.isLeftEndpoint = false;
|
|
105982
|
+
} else {
|
|
105983
|
+
e1.isLeftEndpoint = true;
|
|
105984
|
+
e2.isLeftEndpoint = false;
|
|
105985
|
+
}
|
|
105986
|
+
eventQueue.push(e1);
|
|
105987
|
+
eventQueue.push(e2);
|
|
105988
|
+
currentP = nextP;
|
|
105989
|
+
eventId = eventId + 1;
|
|
105990
|
+
}
|
|
105991
|
+
}
|
|
105992
|
+
}
|
|
105993
|
+
featureId = featureId + 1;
|
|
105994
|
+
}
|
|
105995
|
+
let Segment$1 = class Segment {
|
|
105996
|
+
constructor(event) {
|
|
105997
|
+
this.leftSweepEvent = event;
|
|
105998
|
+
this.rightSweepEvent = event.otherEvent;
|
|
105999
|
+
}
|
|
106000
|
+
};
|
|
106001
|
+
function testSegmentIntersect(seg1, seg2) {
|
|
106002
|
+
if (seg1 === null || seg2 === null) return false;
|
|
106003
|
+
if (seg1.leftSweepEvent.ringId === seg2.leftSweepEvent.ringId && (seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.rightSweepEvent.isSamePoint(seg2.rightSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.leftSweepEvent) || seg1.leftSweepEvent.isSamePoint(seg2.rightSweepEvent))) return false;
|
|
106004
|
+
const x12 = seg1.leftSweepEvent.p.x;
|
|
106005
|
+
const y12 = seg1.leftSweepEvent.p.y;
|
|
106006
|
+
const x2 = seg1.rightSweepEvent.p.x;
|
|
106007
|
+
const y2 = seg1.rightSweepEvent.p.y;
|
|
106008
|
+
const x3 = seg2.leftSweepEvent.p.x;
|
|
106009
|
+
const y3 = seg2.leftSweepEvent.p.y;
|
|
106010
|
+
const x4 = seg2.rightSweepEvent.p.x;
|
|
106011
|
+
const y4 = seg2.rightSweepEvent.p.y;
|
|
106012
|
+
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
106013
|
+
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
106014
|
+
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
106015
|
+
if (denom === 0) {
|
|
106016
|
+
if (numeA === 0 && numeB === 0) return false;
|
|
106017
|
+
return false;
|
|
106018
|
+
}
|
|
106019
|
+
const uA = numeA / denom;
|
|
106020
|
+
const uB = numeB / denom;
|
|
106021
|
+
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
106022
|
+
const x = x12 + uA * (x2 - x12);
|
|
106023
|
+
const y = y12 + uA * (y2 - y12);
|
|
106024
|
+
return [x, y];
|
|
106025
|
+
}
|
|
106026
|
+
return false;
|
|
106027
|
+
}
|
|
106028
|
+
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
106029
|
+
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
106030
|
+
const intersectionPoints = [];
|
|
106031
|
+
const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
|
|
106032
|
+
while (eventQueue.length) {
|
|
106033
|
+
const event = eventQueue.pop();
|
|
106034
|
+
if (event.isLeftEndpoint) {
|
|
106035
|
+
const segment = new Segment$1(event);
|
|
106036
|
+
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
106037
|
+
const otherSeg = outQueue.data[i2];
|
|
106038
|
+
if (ignoreSelfIntersections) {
|
|
106039
|
+
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
106040
|
+
}
|
|
106041
|
+
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
106042
|
+
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
106043
|
+
}
|
|
106044
|
+
outQueue.push(segment);
|
|
106045
|
+
} else if (event.isLeftEndpoint === false) {
|
|
106046
|
+
outQueue.pop();
|
|
106047
|
+
}
|
|
106048
|
+
}
|
|
106049
|
+
return intersectionPoints;
|
|
106050
|
+
}
|
|
106051
|
+
function sweeplineIntersections(geojson, ignoreSelfIntersections) {
|
|
106052
|
+
const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
|
|
106053
|
+
fillEventQueue(geojson, eventQueue);
|
|
106054
|
+
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
106055
|
+
}
|
|
106056
|
+
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
106057
|
+
__proto__: null,
|
|
106058
|
+
default: sweeplineIntersections
|
|
106059
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
107872
106060
|
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
|
|
107873
106061
|
var hasRequiredCjs$1;
|
|
107874
106062
|
function requireCjs$1() {
|
|
@@ -107882,7 +106070,7 @@ function requireCjs$1() {
|
|
|
107882
106070
|
var _sweeplineintersections = require$$1$1;
|
|
107883
106071
|
var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
|
|
107884
106072
|
var sweeplineIntersections2 = _sweeplineintersections2.default;
|
|
107885
|
-
function
|
|
106073
|
+
function lineIntersect(line1, line2, options = {}) {
|
|
107886
106074
|
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
107887
106075
|
let features = [];
|
|
107888
106076
|
if (line1.type === "FeatureCollection")
|
|
@@ -107916,9 +106104,9 @@ function requireCjs$1() {
|
|
|
107916
106104
|
}
|
|
107917
106105
|
return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
|
|
107918
106106
|
}
|
|
107919
|
-
var turf_line_intersect_default =
|
|
106107
|
+
var turf_line_intersect_default = lineIntersect;
|
|
107920
106108
|
cjs$1.default = turf_line_intersect_default;
|
|
107921
|
-
cjs$1.lineIntersect =
|
|
106109
|
+
cjs$1.lineIntersect = lineIntersect;
|
|
107922
106110
|
return cjs$1;
|
|
107923
106111
|
}
|
|
107924
106112
|
var hasRequiredSplitPolygonMode;
|
|
@@ -111782,8 +109970,8 @@ function requireDraw90degreePolygonMode() {
|
|
|
111782
109970
|
return;
|
|
111783
109971
|
}
|
|
111784
109972
|
if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
|
|
111785
|
-
var
|
|
111786
|
-
clickSequence[clickSequence.length - 1] =
|
|
109973
|
+
var lineString = tentativeFeature.geometry;
|
|
109974
|
+
clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
|
|
111787
109975
|
} else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
|
|
111788
109976
|
var polygon2 = tentativeFeature.geometry;
|
|
111789
109977
|
clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
|
|
@@ -117653,12 +115841,12 @@ function requireUtils$1() {
|
|
|
117653
115841
|
return false;
|
|
117654
115842
|
}
|
|
117655
115843
|
function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
|
|
117656
|
-
var
|
|
115844
|
+
var lineString = {
|
|
117657
115845
|
type: "LineString",
|
|
117658
115846
|
coordinates: [p1, p2]
|
|
117659
115847
|
};
|
|
117660
115848
|
var pt = (0, _helpers.point)(groundCoords);
|
|
117661
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
115849
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
117662
115850
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
117663
115851
|
var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
117664
115852
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -119326,31 +117514,35 @@ class SelectionLayer extends CompositeLayer {
|
|
|
119326
117514
|
const { flipY, obsLayers } = this.props;
|
|
119327
117515
|
const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
|
|
119328
117516
|
const selectedPolygon = polygon(flippedCoordinates);
|
|
117517
|
+
let minX = Infinity;
|
|
117518
|
+
let minY = Infinity;
|
|
117519
|
+
let maxX = -Infinity;
|
|
117520
|
+
let maxY = -Infinity;
|
|
117521
|
+
flippedCoordinates[0].forEach(([x, y]) => {
|
|
117522
|
+
minX = Math.min(minX, x);
|
|
117523
|
+
minY = Math.min(minY, y);
|
|
117524
|
+
maxX = Math.max(maxX, x);
|
|
117525
|
+
maxY = Math.max(maxY, y);
|
|
117526
|
+
});
|
|
119329
117527
|
obsLayers.forEach((obsLayer) => {
|
|
119330
117528
|
const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
|
|
119331
|
-
const
|
|
117529
|
+
const pickingIds = [];
|
|
119332
117530
|
obsQuadTree?.visit((node2, x02, y02, x12, y12) => {
|
|
119333
|
-
|
|
119334
|
-
const nodePolygon = polygon(nodePoints);
|
|
119335
|
-
const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
|
|
119336
|
-
const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
|
|
119337
|
-
const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
|
|
119338
|
-
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
117531
|
+
if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
|
|
119339
117532
|
return true;
|
|
119340
117533
|
}
|
|
119341
|
-
if (node2.
|
|
117534
|
+
if (!node2.length) {
|
|
119342
117535
|
let current = node2;
|
|
119343
117536
|
while (current) {
|
|
119344
|
-
const
|
|
119345
|
-
if (booleanPointInPolygon(
|
|
119346
|
-
|
|
117537
|
+
const [x, y] = getObsCoords(current.data);
|
|
117538
|
+
if (booleanPointInPolygon([x, y], selectedPolygon)) {
|
|
117539
|
+
pickingIds.push(obsIndex[current.data]);
|
|
119347
117540
|
}
|
|
119348
117541
|
current = current.next;
|
|
119349
117542
|
}
|
|
119350
117543
|
}
|
|
119351
117544
|
return false;
|
|
119352
117545
|
});
|
|
119353
|
-
const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
|
|
119354
117546
|
layerOnSelect(pickingIds);
|
|
119355
117547
|
});
|
|
119356
117548
|
}
|
|
@@ -120525,22 +118717,22 @@ function addDecoder(cases, importFn) {
|
|
|
120525
118717
|
}
|
|
120526
118718
|
cases.forEach((c) => registry$2.set(c, importFn));
|
|
120527
118719
|
}
|
|
120528
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
120529
|
-
addDecoder(5, () => import("./lzw-
|
|
118720
|
+
addDecoder([void 0, 1], () => import("./raw-ByPggEEh.js").then((m) => m.default));
|
|
118721
|
+
addDecoder(5, () => import("./lzw-Dlr30Fct.js").then((m) => m.default));
|
|
120530
118722
|
addDecoder(6, () => {
|
|
120531
118723
|
throw new Error("old style JPEG compression is not supported.");
|
|
120532
118724
|
});
|
|
120533
|
-
addDecoder(7, () => import("./jpeg-
|
|
120534
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
120535
|
-
addDecoder(32773, () => import("./packbits-
|
|
118725
|
+
addDecoder(7, () => import("./jpeg-CFLEL8IV.js").then((m) => m.default));
|
|
118726
|
+
addDecoder([8, 32946], () => import("./deflate-7a1deX0W.js").then((m) => m.default));
|
|
118727
|
+
addDecoder(32773, () => import("./packbits-C6ye2Wmf.js").then((m) => m.default));
|
|
120536
118728
|
addDecoder(
|
|
120537
118729
|
34887,
|
|
120538
|
-
() => import("./lerc-
|
|
118730
|
+
() => import("./lerc-CT-nNr9A.js").then(async (m) => {
|
|
120539
118731
|
await m.zstd.init();
|
|
120540
118732
|
return m;
|
|
120541
118733
|
}).then((m) => m.default)
|
|
120542
118734
|
);
|
|
120543
|
-
addDecoder(50001, () => import("./webimage-
|
|
118735
|
+
addDecoder(50001, () => import("./webimage-C8dSzGbX.js").then((m) => m.default));
|
|
120544
118736
|
function decodeRowAcc(row, stride) {
|
|
120545
118737
|
let length2 = row.length - stride;
|
|
120546
118738
|
let offset = 0;
|
|
@@ -120708,6 +118900,50 @@ async function N(A2, I2) {
|
|
|
120708
118900
|
if (0 === g2.length) throw Error("Failed to decode with LZW decoder.");
|
|
120709
118901
|
return g2;
|
|
120710
118902
|
}
|
|
118903
|
+
function quickselect(arr, k, left, right, compare2) {
|
|
118904
|
+
quickselectStep(arr, k, left || 0, right || arr.length - 1, defaultCompare);
|
|
118905
|
+
}
|
|
118906
|
+
function quickselectStep(arr, k, left, right, compare2) {
|
|
118907
|
+
while (right > left) {
|
|
118908
|
+
if (right - left > 600) {
|
|
118909
|
+
var n3 = right - left + 1;
|
|
118910
|
+
var m = k - left + 1;
|
|
118911
|
+
var z = Math.log(n3);
|
|
118912
|
+
var s2 = 0.5 * Math.exp(2 * z / 3);
|
|
118913
|
+
var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
118914
|
+
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
118915
|
+
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
118916
|
+
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
118917
|
+
}
|
|
118918
|
+
var t = arr[k];
|
|
118919
|
+
var i2 = left;
|
|
118920
|
+
var j = right;
|
|
118921
|
+
swap(arr, left, k);
|
|
118922
|
+
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
118923
|
+
while (i2 < j) {
|
|
118924
|
+
swap(arr, i2, j);
|
|
118925
|
+
i2++;
|
|
118926
|
+
j--;
|
|
118927
|
+
while (compare2(arr[i2], t) < 0) i2++;
|
|
118928
|
+
while (compare2(arr[j], t) > 0) j--;
|
|
118929
|
+
}
|
|
118930
|
+
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
118931
|
+
else {
|
|
118932
|
+
j++;
|
|
118933
|
+
swap(arr, j, right);
|
|
118934
|
+
}
|
|
118935
|
+
if (j <= k) left = j + 1;
|
|
118936
|
+
if (k <= j) right = j - 1;
|
|
118937
|
+
}
|
|
118938
|
+
}
|
|
118939
|
+
function swap(arr, i2, j) {
|
|
118940
|
+
var tmp = arr[i2];
|
|
118941
|
+
arr[i2] = arr[j];
|
|
118942
|
+
arr[j] = tmp;
|
|
118943
|
+
}
|
|
118944
|
+
function defaultCompare(a2, b) {
|
|
118945
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
118946
|
+
}
|
|
120711
118947
|
var util;
|
|
120712
118948
|
(function(util2) {
|
|
120713
118949
|
util2.assertEqual = (val) => val;
|
|
@@ -132074,17 +130310,17 @@ function sizeToMeters(size2, unit2) {
|
|
|
132074
130310
|
throw new Error("Received unknown unit");
|
|
132075
130311
|
}
|
|
132076
130312
|
function snapValue(value) {
|
|
132077
|
-
let
|
|
130313
|
+
let magnitude = 0;
|
|
132078
130314
|
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
132079
|
-
|
|
130315
|
+
magnitude = Math.floor(Math.log10(value));
|
|
132080
130316
|
}
|
|
132081
130317
|
let snappedUnit = SI_PREFIXES.find(
|
|
132082
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
130318
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
132083
130319
|
);
|
|
132084
130320
|
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
132085
130321
|
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
132086
130322
|
snappedUnit = SI_PREFIXES.find(
|
|
132087
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
130323
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
132088
130324
|
);
|
|
132089
130325
|
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
132090
130326
|
}
|
|
@@ -134636,6 +132872,139 @@ class BitmaskLayer2 extends XRLayer {
|
|
|
134636
132872
|
}
|
|
134637
132873
|
BitmaskLayer2.layerName = "BitmaskLayer";
|
|
134638
132874
|
BitmaskLayer2.defaultProps = defaultProps$2;
|
|
132875
|
+
function geomEach(geojson, callback) {
|
|
132876
|
+
var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
|
|
132877
|
+
for (i2 = 0; i2 < stop; i2++) {
|
|
132878
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
|
|
132879
|
+
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
|
|
132880
|
+
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
|
|
132881
|
+
featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
|
|
132882
|
+
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
132883
|
+
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
132884
|
+
for (g2 = 0; g2 < stopG; g2++) {
|
|
132885
|
+
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
|
|
132886
|
+
if (geometry2 === null) {
|
|
132887
|
+
if (callback(
|
|
132888
|
+
null,
|
|
132889
|
+
featureIndex,
|
|
132890
|
+
featureProperties,
|
|
132891
|
+
featureBBox,
|
|
132892
|
+
featureId2
|
|
132893
|
+
) === false)
|
|
132894
|
+
return false;
|
|
132895
|
+
continue;
|
|
132896
|
+
}
|
|
132897
|
+
switch (geometry2.type) {
|
|
132898
|
+
case "Point":
|
|
132899
|
+
case "LineString":
|
|
132900
|
+
case "MultiPoint":
|
|
132901
|
+
case "Polygon":
|
|
132902
|
+
case "MultiLineString":
|
|
132903
|
+
case "MultiPolygon": {
|
|
132904
|
+
if (callback(
|
|
132905
|
+
geometry2,
|
|
132906
|
+
featureIndex,
|
|
132907
|
+
featureProperties,
|
|
132908
|
+
featureBBox,
|
|
132909
|
+
featureId2
|
|
132910
|
+
) === false)
|
|
132911
|
+
return false;
|
|
132912
|
+
break;
|
|
132913
|
+
}
|
|
132914
|
+
case "GeometryCollection": {
|
|
132915
|
+
for (j = 0; j < geometry2.geometries.length; j++) {
|
|
132916
|
+
if (callback(
|
|
132917
|
+
geometry2.geometries[j],
|
|
132918
|
+
featureIndex,
|
|
132919
|
+
featureProperties,
|
|
132920
|
+
featureBBox,
|
|
132921
|
+
featureId2
|
|
132922
|
+
) === false)
|
|
132923
|
+
return false;
|
|
132924
|
+
}
|
|
132925
|
+
break;
|
|
132926
|
+
}
|
|
132927
|
+
default:
|
|
132928
|
+
throw new Error("Unknown Geometry Type");
|
|
132929
|
+
}
|
|
132930
|
+
}
|
|
132931
|
+
featureIndex++;
|
|
132932
|
+
}
|
|
132933
|
+
}
|
|
132934
|
+
function geomReduce(geojson, callback, initialValue) {
|
|
132935
|
+
var previousValue = initialValue;
|
|
132936
|
+
geomEach(
|
|
132937
|
+
geojson,
|
|
132938
|
+
function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
|
|
132939
|
+
previousValue = callback(
|
|
132940
|
+
previousValue,
|
|
132941
|
+
currentGeometry,
|
|
132942
|
+
featureIndex,
|
|
132943
|
+
featureProperties,
|
|
132944
|
+
featureBBox,
|
|
132945
|
+
featureId2
|
|
132946
|
+
);
|
|
132947
|
+
}
|
|
132948
|
+
);
|
|
132949
|
+
return previousValue;
|
|
132950
|
+
}
|
|
132951
|
+
function flattenEach(geojson, callback) {
|
|
132952
|
+
geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
132953
|
+
var type = geometry2 === null ? null : geometry2.type;
|
|
132954
|
+
switch (type) {
|
|
132955
|
+
case null:
|
|
132956
|
+
case "Point":
|
|
132957
|
+
case "LineString":
|
|
132958
|
+
case "Polygon":
|
|
132959
|
+
if (callback(
|
|
132960
|
+
feature$1(geometry2, properties, { bbox, id }),
|
|
132961
|
+
featureIndex,
|
|
132962
|
+
0
|
|
132963
|
+
) === false)
|
|
132964
|
+
return false;
|
|
132965
|
+
return;
|
|
132966
|
+
}
|
|
132967
|
+
var geomType;
|
|
132968
|
+
switch (type) {
|
|
132969
|
+
case "MultiPoint":
|
|
132970
|
+
geomType = "Point";
|
|
132971
|
+
break;
|
|
132972
|
+
case "MultiLineString":
|
|
132973
|
+
geomType = "LineString";
|
|
132974
|
+
break;
|
|
132975
|
+
case "MultiPolygon":
|
|
132976
|
+
geomType = "Polygon";
|
|
132977
|
+
break;
|
|
132978
|
+
}
|
|
132979
|
+
for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
|
|
132980
|
+
var coordinate = geometry2.coordinates[multiFeatureIndex];
|
|
132981
|
+
var geom = {
|
|
132982
|
+
type: geomType,
|
|
132983
|
+
coordinates: coordinate
|
|
132984
|
+
};
|
|
132985
|
+
if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
|
|
132986
|
+
return false;
|
|
132987
|
+
}
|
|
132988
|
+
});
|
|
132989
|
+
}
|
|
132990
|
+
function flattenReduce(geojson, callback, initialValue) {
|
|
132991
|
+
var previousValue = initialValue;
|
|
132992
|
+
flattenEach(
|
|
132993
|
+
geojson,
|
|
132994
|
+
function(currentFeature, featureIndex, multiFeatureIndex) {
|
|
132995
|
+
if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
|
|
132996
|
+
previousValue = currentFeature;
|
|
132997
|
+
else
|
|
132998
|
+
previousValue = callback(
|
|
132999
|
+
previousValue,
|
|
133000
|
+
currentFeature,
|
|
133001
|
+
featureIndex,
|
|
133002
|
+
multiFeatureIndex
|
|
133003
|
+
);
|
|
133004
|
+
}
|
|
133005
|
+
);
|
|
133006
|
+
return previousValue;
|
|
133007
|
+
}
|
|
134639
133008
|
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
|
|
134640
133009
|
function clone(configObject) {
|
|
134641
133010
|
var div2, convertBase2, parseNumeric, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
|
|
@@ -136476,8 +134845,8 @@ var set = (eps) => {
|
|
|
136476
134845
|
};
|
|
136477
134846
|
};
|
|
136478
134847
|
var precision = set();
|
|
136479
|
-
var isInBbox = (
|
|
136480
|
-
return
|
|
134848
|
+
var isInBbox = (bbox, point2) => {
|
|
134849
|
+
return bbox.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox.ur.x) && bbox.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox.ur.y);
|
|
136481
134850
|
};
|
|
136482
134851
|
var getBboxOverlap = (b1, b2) => {
|
|
136483
134852
|
if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
|
|
@@ -137577,6 +135946,19 @@ function ringArea(coords) {
|
|
|
137577
135946
|
}
|
|
137578
135947
|
return total * FACTOR;
|
|
137579
135948
|
}
|
|
135949
|
+
function distance(from, to, options = {}) {
|
|
135950
|
+
var coordinates1 = getCoord(from);
|
|
135951
|
+
var coordinates2 = getCoord(to);
|
|
135952
|
+
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
135953
|
+
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
135954
|
+
var lat1 = degreesToRadians(coordinates1[1]);
|
|
135955
|
+
var lat2 = degreesToRadians(coordinates2[1]);
|
|
135956
|
+
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
135957
|
+
return radiansToLength(
|
|
135958
|
+
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
135959
|
+
options.units
|
|
135960
|
+
);
|
|
135961
|
+
}
|
|
137580
135962
|
const DEFAULT_THRESHOLD = 1;
|
|
137581
135963
|
const defaultProps$1 = {
|
|
137582
135964
|
// for text
|
|
@@ -137673,7 +136055,7 @@ class ContourLayerWithText extends ContourLayer {
|
|
|
137673
136055
|
const circlePoint = point(circleCoord);
|
|
137674
136056
|
polygonVertices.forEach((polyCoord) => {
|
|
137675
136057
|
const polyPoint = point(polyCoord);
|
|
137676
|
-
const dist2 = distance
|
|
136058
|
+
const dist2 = distance(circlePoint, polyPoint);
|
|
137677
136059
|
if (dist2 < minDist) {
|
|
137678
136060
|
minDist = dist2;
|
|
137679
136061
|
minCirclePoint = circleCoord;
|
|
@@ -138146,10 +136528,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
138146
136528
|
getLineColor: strokeColor,
|
|
138147
136529
|
getLineWidth: strokeWidth,
|
|
138148
136530
|
lineWidthUnits: "pixels",
|
|
138149
|
-
|
|
138150
|
-
|
|
138151
|
-
getDashArray: dashArray
|
|
138152
|
-
} : {}
|
|
136531
|
+
extensions: dashExt,
|
|
136532
|
+
getDashArray: getDash
|
|
138153
136533
|
}));
|
|
138154
136534
|
if (shape.text && labelOpacity > 0) {
|
|
138155
136535
|
layers.push(new TextLayer({
|
|
@@ -138184,8 +136564,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
138184
136564
|
layers.push(new PathLayer({
|
|
138185
136565
|
...base,
|
|
138186
136566
|
id: `annotation-line-${uid2}-${i2}`,
|
|
138187
|
-
extensions:
|
|
138188
|
-
getDashArray:
|
|
136567
|
+
extensions: dashExt,
|
|
136568
|
+
getDashArray: getDash,
|
|
138189
136569
|
data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
|
|
138190
136570
|
getPath: (d) => d.path,
|
|
138191
136571
|
getColor: strokeColor,
|
|
@@ -138333,10 +136713,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
138333
136713
|
getLineColor: strokeColor,
|
|
138334
136714
|
getLineWidth: strokeWidth,
|
|
138335
136715
|
lineWidthUnits: "pixels",
|
|
138336
|
-
|
|
138337
|
-
|
|
138338
|
-
getDashArray: dashArray
|
|
138339
|
-
} : {}
|
|
136716
|
+
extensions: dashExt,
|
|
136717
|
+
getDashArray: getDash
|
|
138340
136718
|
}));
|
|
138341
136719
|
if (shape.text && labelOpacity > 0) {
|
|
138342
136720
|
layers.push(new TextLayer({
|