@vitessce/ome-tiff 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-CYQTYSCB.js → deflate-CIM-SNpP.js} +1 -1
- package/dist/{index-B3DJFH7e.js → index-Ce6N3KSx.js} +703 -2323
- package/dist/index.js +1 -1
- package/dist/{jpeg-CHgZKG82.js → jpeg-DQ-CazxZ.js} +1 -1
- package/dist/{lerc-DVjQP6R8.js → lerc-BT_hx9Kh.js} +1 -1
- package/dist/{lzw-Dz4Jq-yH.js → lzw-C8NSAPvb.js} +1 -1
- package/dist/{packbits-CHn2islS.js → packbits-BZYNl97h.js} +1 -1
- package/dist/{raw-tUqt587l.js → raw-CbPBCrOb.js} +1 -1
- package/dist/{webimage-DVCltRg_.js → webimage-CsiyTZBP.js} +1 -1
- package/dist-tsc/OmeTiffLoader.d.ts.map +1 -1
- package/dist-tsc/OmeTiffLoader.js +5 -3
- package/dist-tsc/OmeTiffLoader.js.map +1 -1
- package/package.json +11 -11
- package/src/OmeTiffLoader.js +5 -2
|
@@ -1071,15 +1071,15 @@ function dirname(url) {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
const isBoolean$1 = (x) => typeof x === "boolean";
|
|
1073
1073
|
const isFunction$2 = (x) => typeof x === "function";
|
|
1074
|
-
const isObject$
|
|
1075
|
-
const isPureObject = (x) => isObject$
|
|
1074
|
+
const isObject$3 = (x) => x !== null && typeof x === "object";
|
|
1075
|
+
const isPureObject = (x) => isObject$3(x) && x.constructor === {}.constructor;
|
|
1076
1076
|
const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
|
|
1077
1077
|
const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
|
|
1078
1078
|
const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
|
|
1079
1079
|
const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
|
|
1080
1080
|
const isBuffer$1 = (x) => x && typeof x === "object" && x.isBuffer;
|
|
1081
|
-
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$
|
|
1082
|
-
const isReadableNodeStream = (x) => isObject$
|
|
1081
|
+
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$3(x) && isFunction$2(x.tee) && isFunction$2(x.cancel) && isFunction$2(x.getReader);
|
|
1082
|
+
const isReadableNodeStream = (x) => isObject$3(x) && isFunction$2(x.read) && isFunction$2(x.pipe) && isBoolean$1(x.readable);
|
|
1083
1083
|
const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
|
|
1084
1084
|
const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
|
|
1085
1085
|
const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
|
|
@@ -1878,7 +1878,7 @@ function getFetchFunction(options, context) {
|
|
|
1878
1878
|
if (typeof fetchOptions.fetch === "function") {
|
|
1879
1879
|
return fetchOptions.fetch;
|
|
1880
1880
|
}
|
|
1881
|
-
if (isObject$
|
|
1881
|
+
if (isObject$3(fetchOptions.fetch)) {
|
|
1882
1882
|
return (url) => fetchFile(url, fetchOptions);
|
|
1883
1883
|
}
|
|
1884
1884
|
if (context !== null && context !== void 0 && context.fetch) {
|
|
@@ -1899,7 +1899,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
|
|
|
1899
1899
|
const loaderName = id || "Top level";
|
|
1900
1900
|
const prefix = id ? "".concat(id, ".") : "";
|
|
1901
1901
|
for (const key in options) {
|
|
1902
|
-
const isSubOptions = !id && isObject$
|
|
1902
|
+
const isSubOptions = !id && isObject$3(options[key]);
|
|
1903
1903
|
const isBaseUriOption = key === "baseUri" && !id;
|
|
1904
1904
|
const isWorkerUrlOption = key === "workerUrl" && id;
|
|
1905
1905
|
if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
|
|
@@ -11442,10 +11442,10 @@ function normalize$4(out, a2) {
|
|
|
11442
11442
|
out[2] = a2[2] * len2;
|
|
11443
11443
|
return out;
|
|
11444
11444
|
}
|
|
11445
|
-
function dot$
|
|
11445
|
+
function dot$3(a2, b) {
|
|
11446
11446
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
11447
11447
|
}
|
|
11448
|
-
function cross
|
|
11448
|
+
function cross(out, a2, b) {
|
|
11449
11449
|
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
11450
11450
|
var bx = b[0], by = b[1], bz = b[2];
|
|
11451
11451
|
out[0] = ay * bz - az * by;
|
|
@@ -11534,8 +11534,8 @@ function rotateZ$2(out, a2, b, rad) {
|
|
|
11534
11534
|
out[2] = r2[2] + b[2];
|
|
11535
11535
|
return out;
|
|
11536
11536
|
}
|
|
11537
|
-
function angle$
|
|
11538
|
-
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$
|
|
11537
|
+
function angle$1(a2, b) {
|
|
11538
|
+
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;
|
|
11539
11539
|
return Math.acos(Math.min(Math.max(cosine2, -1), 1));
|
|
11540
11540
|
}
|
|
11541
11541
|
var sub$1 = subtract$1;
|
|
@@ -11634,10 +11634,10 @@ class Vector3 extends Vector {
|
|
|
11634
11634
|
this[2] = checkNumber(value);
|
|
11635
11635
|
}
|
|
11636
11636
|
angle(vector) {
|
|
11637
|
-
return angle$
|
|
11637
|
+
return angle$1(this, vector);
|
|
11638
11638
|
}
|
|
11639
11639
|
cross(vector) {
|
|
11640
|
-
cross
|
|
11640
|
+
cross(this, this, vector);
|
|
11641
11641
|
return this.check();
|
|
11642
11642
|
}
|
|
11643
11643
|
rotateX({
|
|
@@ -12754,7 +12754,7 @@ function normalize$3(out, a2) {
|
|
|
12754
12754
|
out[3] = w2 * len2;
|
|
12755
12755
|
return out;
|
|
12756
12756
|
}
|
|
12757
|
-
function dot$
|
|
12757
|
+
function dot$2(a2, b) {
|
|
12758
12758
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
|
|
12759
12759
|
}
|
|
12760
12760
|
function lerp$3(out, a2, b, t) {
|
|
@@ -13370,7 +13370,7 @@ function fromMat3(out, m) {
|
|
|
13370
13370
|
}
|
|
13371
13371
|
var add$3 = add$4;
|
|
13372
13372
|
var scale = scale$1;
|
|
13373
|
-
var dot$
|
|
13373
|
+
var dot$1 = dot$2;
|
|
13374
13374
|
var lerp$2 = lerp$3;
|
|
13375
13375
|
var length$2 = length$3;
|
|
13376
13376
|
var squaredLength = squaredLength$1;
|
|
@@ -13380,10 +13380,10 @@ var rotationTo = function() {
|
|
|
13380
13380
|
var xUnitVec3 = fromValues(1, 0, 0);
|
|
13381
13381
|
var yUnitVec3 = fromValues(0, 1, 0);
|
|
13382
13382
|
return function(out, a2, b) {
|
|
13383
|
-
var dot2 = dot$
|
|
13383
|
+
var dot2 = dot$3(a2, b);
|
|
13384
13384
|
if (dot2 < -0.999999) {
|
|
13385
|
-
cross
|
|
13386
|
-
if (len(tmpvec3) < 1e-6) cross
|
|
13385
|
+
cross(tmpvec3, xUnitVec3, a2);
|
|
13386
|
+
if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
|
|
13387
13387
|
normalize$4(tmpvec3, tmpvec3);
|
|
13388
13388
|
setAxisAngle(out, tmpvec3, Math.PI);
|
|
13389
13389
|
return out;
|
|
@@ -13394,7 +13394,7 @@ var rotationTo = function() {
|
|
|
13394
13394
|
out[3] = 1;
|
|
13395
13395
|
return out;
|
|
13396
13396
|
} else {
|
|
13397
|
-
cross
|
|
13397
|
+
cross(tmpvec3, a2, b);
|
|
13398
13398
|
out[0] = tmpvec3[0];
|
|
13399
13399
|
out[1] = tmpvec3[1];
|
|
13400
13400
|
out[2] = tmpvec3[2];
|
|
@@ -13508,7 +13508,7 @@ class Quaternion extends MathArray {
|
|
|
13508
13508
|
return squaredLength(this);
|
|
13509
13509
|
}
|
|
13510
13510
|
dot(a2) {
|
|
13511
|
-
return dot$
|
|
13511
|
+
return dot$1(this, a2);
|
|
13512
13512
|
}
|
|
13513
13513
|
rotationTo(vectorA, vectorB) {
|
|
13514
13514
|
rotationTo(this, vectorA, vectorB);
|
|
@@ -28716,7 +28716,7 @@ function getPropTypes(props) {
|
|
|
28716
28716
|
const ERR_NOT_OBJECT = "count(): argument not an object";
|
|
28717
28717
|
const ERR_NOT_CONTAINER = "count(): argument not a container";
|
|
28718
28718
|
function count(container) {
|
|
28719
|
-
if (!isObject$
|
|
28719
|
+
if (!isObject$2(container)) {
|
|
28720
28720
|
throw new Error(ERR_NOT_OBJECT);
|
|
28721
28721
|
}
|
|
28722
28722
|
if (typeof container.count === "function") {
|
|
@@ -28736,7 +28736,7 @@ function count(container) {
|
|
|
28736
28736
|
function isPlainObject$1(value) {
|
|
28737
28737
|
return value !== null && typeof value === "object" && value.constructor === Object;
|
|
28738
28738
|
}
|
|
28739
|
-
function isObject$
|
|
28739
|
+
function isObject$2(value) {
|
|
28740
28740
|
return value !== null && typeof value === "object";
|
|
28741
28741
|
}
|
|
28742
28742
|
function mergeShaders(target, source) {
|
|
@@ -33069,35 +33069,35 @@ function getPointAtIndex(positions, index2, size2, offset, out = []) {
|
|
|
33069
33069
|
}
|
|
33070
33070
|
return out;
|
|
33071
33071
|
}
|
|
33072
|
-
function intersect(a2, b, edge,
|
|
33072
|
+
function intersect(a2, b, edge, bbox, out = []) {
|
|
33073
33073
|
let t;
|
|
33074
33074
|
let snap;
|
|
33075
33075
|
if (edge & 8) {
|
|
33076
|
-
t = (
|
|
33076
|
+
t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
|
|
33077
33077
|
snap = 3;
|
|
33078
33078
|
} else if (edge & 4) {
|
|
33079
|
-
t = (
|
|
33079
|
+
t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
|
|
33080
33080
|
snap = 1;
|
|
33081
33081
|
} else if (edge & 2) {
|
|
33082
|
-
t = (
|
|
33082
|
+
t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
|
|
33083
33083
|
snap = 2;
|
|
33084
33084
|
} else if (edge & 1) {
|
|
33085
|
-
t = (
|
|
33085
|
+
t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
|
|
33086
33086
|
snap = 0;
|
|
33087
33087
|
} else {
|
|
33088
33088
|
return null;
|
|
33089
33089
|
}
|
|
33090
33090
|
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
33091
|
-
out[i2] = (snap & 1) === i2 ?
|
|
33091
|
+
out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
|
|
33092
33092
|
}
|
|
33093
33093
|
return out;
|
|
33094
33094
|
}
|
|
33095
|
-
function bitCode(p,
|
|
33095
|
+
function bitCode(p, bbox) {
|
|
33096
33096
|
let code = 0;
|
|
33097
|
-
if (p[0] <
|
|
33098
|
-
else if (p[0] >
|
|
33099
|
-
if (p[1] <
|
|
33100
|
-
else if (p[1] >
|
|
33097
|
+
if (p[0] < bbox[0]) code |= 1;
|
|
33098
|
+
else if (p[0] > bbox[2]) code |= 2;
|
|
33099
|
+
if (p[1] < bbox[1]) code |= 4;
|
|
33100
|
+
else if (p[1] > bbox[3]) code |= 8;
|
|
33101
33101
|
return code;
|
|
33102
33102
|
}
|
|
33103
33103
|
function cutPolylineByGrid(positions, options) {
|
|
@@ -33167,7 +33167,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
33167
33167
|
types: edgeTypes ? new Array(positions.length / size2).fill(TYPE_BORDER) : null,
|
|
33168
33168
|
holes: holeIndices || []
|
|
33169
33169
|
}];
|
|
33170
|
-
const
|
|
33170
|
+
const bbox = [[], []];
|
|
33171
33171
|
let cell = [];
|
|
33172
33172
|
while (queue.length) {
|
|
33173
33173
|
const {
|
|
@@ -33175,9 +33175,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
33175
33175
|
types,
|
|
33176
33176
|
holes
|
|
33177
33177
|
} = queue.shift();
|
|
33178
|
-
getBoundingBox$2(pos, size2, holes[0] || pos.length,
|
|
33179
|
-
cell = getGridCell(
|
|
33180
|
-
const code = bitCode(
|
|
33178
|
+
getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox);
|
|
33179
|
+
cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
|
|
33180
|
+
const code = bitCode(bbox[1], cell);
|
|
33181
33181
|
if (code) {
|
|
33182
33182
|
let parts = bisectPolygon(pos, types, size2, 0, holes[0] || pos.length, cell, code);
|
|
33183
33183
|
const polygonLow = {
|
|
@@ -33223,7 +33223,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
33223
33223
|
}
|
|
33224
33224
|
return result;
|
|
33225
33225
|
}
|
|
33226
|
-
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex,
|
|
33226
|
+
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox, edge) {
|
|
33227
33227
|
const numPoints = (endIndex - startIndex) / size2;
|
|
33228
33228
|
const resultLow = [];
|
|
33229
33229
|
const resultHigh = [];
|
|
@@ -33234,16 +33234,16 @@ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2,
|
|
|
33234
33234
|
let side;
|
|
33235
33235
|
let type;
|
|
33236
33236
|
const prev = getPointAtIndex(positions, numPoints - 1, size2, startIndex);
|
|
33237
|
-
let prevSide = Math.sign(edge & 8 ? prev[1] -
|
|
33237
|
+
let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
|
|
33238
33238
|
let prevType = edgeTypes && edgeTypes[numPoints - 1];
|
|
33239
33239
|
let lowPointCount = 0;
|
|
33240
33240
|
let highPointCount = 0;
|
|
33241
33241
|
for (let i2 = 0; i2 < numPoints; i2++) {
|
|
33242
33242
|
p = getPointAtIndex(positions, i2, size2, startIndex, p);
|
|
33243
|
-
side = Math.sign(edge & 8 ? p[1] -
|
|
33243
|
+
side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
|
|
33244
33244
|
type = edgeTypes && edgeTypes[startIndex / size2 + i2];
|
|
33245
33245
|
if (side && prevSide && prevSide !== side) {
|
|
33246
|
-
intersect(prev, p, edge,
|
|
33246
|
+
intersect(prev, p, edge, bbox, scratchPoint);
|
|
33247
33247
|
push(resultLow, scratchPoint) && typesLow.push(prevType);
|
|
33248
33248
|
push(resultHigh, scratchPoint) && typesHigh.push(prevType);
|
|
33249
33249
|
}
|
|
@@ -34375,7 +34375,7 @@ function requireEarcut() {
|
|
|
34375
34375
|
var p = start;
|
|
34376
34376
|
do {
|
|
34377
34377
|
var a2 = p.prev, b = p.next.next;
|
|
34378
|
-
if (!equals2(a2, b) &&
|
|
34378
|
+
if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
|
|
34379
34379
|
triangles.push(a2.i / dim | 0);
|
|
34380
34380
|
triangles.push(p.i / dim | 0);
|
|
34381
34381
|
triangles.push(b.i / dim | 0);
|
|
@@ -34550,7 +34550,7 @@ function requireEarcut() {
|
|
|
34550
34550
|
function equals2(p1, p2) {
|
|
34551
34551
|
return p1.x === p2.x && p1.y === p2.y;
|
|
34552
34552
|
}
|
|
34553
|
-
function
|
|
34553
|
+
function intersects(p1, q1, p2, q2) {
|
|
34554
34554
|
var o1 = sign2(area2(p1, q1, p2));
|
|
34555
34555
|
var o2 = sign2(area2(p1, q1, q2));
|
|
34556
34556
|
var o3 = sign2(area2(p2, q2, p1));
|
|
@@ -34571,7 +34571,7 @@ function requireEarcut() {
|
|
|
34571
34571
|
function intersectsPolygon(a2, b) {
|
|
34572
34572
|
var p = a2;
|
|
34573
34573
|
do {
|
|
34574
|
-
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i &&
|
|
34574
|
+
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;
|
|
34575
34575
|
p = p.next;
|
|
34576
34576
|
} while (p !== a2);
|
|
34577
34577
|
return false;
|
|
@@ -40610,7 +40610,7 @@ class Tile2DHeader {
|
|
|
40610
40610
|
const {
|
|
40611
40611
|
index: index2,
|
|
40612
40612
|
id,
|
|
40613
|
-
bbox
|
|
40613
|
+
bbox,
|
|
40614
40614
|
userData,
|
|
40615
40615
|
zoom
|
|
40616
40616
|
} = this;
|
|
@@ -40636,7 +40636,7 @@ class Tile2DHeader {
|
|
|
40636
40636
|
tileData = await getData({
|
|
40637
40637
|
index: index2,
|
|
40638
40638
|
id,
|
|
40639
|
-
bbox
|
|
40639
|
+
bbox,
|
|
40640
40640
|
userData,
|
|
40641
40641
|
zoom,
|
|
40642
40642
|
signal
|
|
@@ -41510,8 +41510,8 @@ const urlType = {
|
|
|
41510
41510
|
return true;
|
|
41511
41511
|
}
|
|
41512
41512
|
};
|
|
41513
|
-
function transformBox(
|
|
41514
|
-
const transformedCoords = [modelMatrix2.transformAsPoint([
|
|
41513
|
+
function transformBox(bbox, modelMatrix2) {
|
|
41514
|
+
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]])];
|
|
41515
41515
|
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]))];
|
|
41516
41516
|
return transformedBox;
|
|
41517
41517
|
}
|
|
@@ -41579,12 +41579,12 @@ function getCullBoundsInViewport(viewport, z, cullRect) {
|
|
|
41579
41579
|
const bounds1 = getCullBoundsInViewport(viewport, z[1], cullRect);
|
|
41580
41580
|
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])];
|
|
41581
41581
|
}
|
|
41582
|
-
function getIndexingCoords(
|
|
41582
|
+
function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
|
|
41583
41583
|
if (modelMatrixInverse) {
|
|
41584
|
-
const transformedTileIndex = transformBox(
|
|
41584
|
+
const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
41585
41585
|
return transformedTileIndex;
|
|
41586
41586
|
}
|
|
41587
|
-
return
|
|
41587
|
+
return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
41588
41588
|
}
|
|
41589
41589
|
function getScale(z, tileSize) {
|
|
41590
41590
|
return Math.pow(2, z) * TILE_SIZE$1 / tileSize;
|
|
@@ -41621,9 +41621,9 @@ function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE$1) {
|
|
|
41621
41621
|
};
|
|
41622
41622
|
}
|
|
41623
41623
|
function getIdentityTileIndices(viewport, z, tileSize, extent2, modelMatrixInverse) {
|
|
41624
|
-
const
|
|
41624
|
+
const bbox = getBoundingBox(viewport, null, extent2);
|
|
41625
41625
|
const scale2 = getScale(z, tileSize);
|
|
41626
|
-
const [minX, minY, maxX, maxY] = getIndexingCoords(
|
|
41626
|
+
const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
|
|
41627
41627
|
const indices = [];
|
|
41628
41628
|
for (let x = Math.floor(minX); x < maxX; x++) {
|
|
41629
41629
|
for (let y = Math.floor(minY); y < maxY; y++) {
|
|
@@ -41812,16 +41812,16 @@ class Tileset2D {
|
|
|
41812
41812
|
cullRect
|
|
41813
41813
|
});
|
|
41814
41814
|
const {
|
|
41815
|
-
bbox
|
|
41815
|
+
bbox
|
|
41816
41816
|
} = tile;
|
|
41817
41817
|
for (const [minX, minY, maxX, maxY] of boundsArr) {
|
|
41818
41818
|
let overlaps;
|
|
41819
|
-
if ("west" in
|
|
41820
|
-
overlaps =
|
|
41819
|
+
if ("west" in bbox) {
|
|
41820
|
+
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
41821
41821
|
} else {
|
|
41822
|
-
const y02 = Math.min(
|
|
41823
|
-
const y12 = Math.max(
|
|
41824
|
-
overlaps =
|
|
41822
|
+
const y02 = Math.min(bbox.top, bbox.bottom);
|
|
41823
|
+
const y12 = Math.max(bbox.top, bbox.bottom);
|
|
41824
|
+
overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
|
|
41825
41825
|
}
|
|
41826
41826
|
if (overlaps) {
|
|
41827
41827
|
return true;
|
|
@@ -59111,7 +59111,7 @@ class Ellipsoid {
|
|
|
59111
59111
|
h.copy(scratchCartesian).subtract(point2);
|
|
59112
59112
|
const longitude = Math.atan2(normal.y, normal.x);
|
|
59113
59113
|
const latitude = Math.asin(normal.z);
|
|
59114
|
-
const height = Math.sign(dot$
|
|
59114
|
+
const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
|
|
59115
59115
|
return toCartographicFromRadians([longitude, latitude, height], result);
|
|
59116
59116
|
}
|
|
59117
59117
|
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
|
|
@@ -63515,13 +63515,13 @@ class TerrainLayer extends CompositeLayer {
|
|
|
63515
63515
|
let bottomLeft = [0, 0];
|
|
63516
63516
|
let topRight = [0, 0];
|
|
63517
63517
|
if (viewport.isGeospatial) {
|
|
63518
|
-
const
|
|
63519
|
-
bottomLeft = viewport.projectFlat([
|
|
63520
|
-
topRight = viewport.projectFlat([
|
|
63518
|
+
const bbox = tile.bbox;
|
|
63519
|
+
bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
|
|
63520
|
+
topRight = viewport.projectFlat([bbox.east, bbox.north]);
|
|
63521
63521
|
} else {
|
|
63522
|
-
const
|
|
63523
|
-
bottomLeft = [
|
|
63524
|
-
topRight = [
|
|
63522
|
+
const bbox = tile.bbox;
|
|
63523
|
+
bottomLeft = [bbox.left, bbox.bottom];
|
|
63524
|
+
topRight = [bbox.right, bbox.top];
|
|
63525
63525
|
}
|
|
63526
63526
|
const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
|
|
63527
63527
|
const terrain = this.loadTerrain({
|
|
@@ -63892,27 +63892,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
|
|
|
63892
63892
|
const y = lerp$6(nw[1], se[1], pointY);
|
|
63893
63893
|
return viewport.unprojectFlat([x, y]);
|
|
63894
63894
|
}
|
|
63895
|
-
function getPoints(geometry2,
|
|
63896
|
-
return geometry2.map((g2) => Point(g2,
|
|
63895
|
+
function getPoints(geometry2, bbox, viewport) {
|
|
63896
|
+
return geometry2.map((g2) => Point(g2, bbox, viewport));
|
|
63897
63897
|
}
|
|
63898
|
-
function MultiPoint(multiPoint,
|
|
63899
|
-
return getPoints(multiPoint,
|
|
63898
|
+
function MultiPoint(multiPoint, bbox, viewport) {
|
|
63899
|
+
return getPoints(multiPoint, bbox, viewport);
|
|
63900
63900
|
}
|
|
63901
|
-
function LineString(line,
|
|
63902
|
-
return getPoints(line,
|
|
63901
|
+
function LineString(line, bbox, viewport) {
|
|
63902
|
+
return getPoints(line, bbox, viewport);
|
|
63903
63903
|
}
|
|
63904
|
-
function MultiLineString(multiLineString,
|
|
63905
|
-
return multiLineString.map((
|
|
63904
|
+
function MultiLineString(multiLineString, bbox, viewport) {
|
|
63905
|
+
return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
|
|
63906
63906
|
}
|
|
63907
|
-
function Polygon(polygon2,
|
|
63908
|
-
return polygon2.map((polygonRing) => getPoints(polygonRing,
|
|
63907
|
+
function Polygon(polygon2, bbox, viewport) {
|
|
63908
|
+
return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
|
|
63909
63909
|
}
|
|
63910
|
-
function MultiPolygon(multiPolygon2,
|
|
63911
|
-
return multiPolygon2.map((polygon2) => Polygon(polygon2,
|
|
63910
|
+
function MultiPolygon(multiPolygon2, bbox, viewport) {
|
|
63911
|
+
return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
|
|
63912
63912
|
}
|
|
63913
|
-
function transform$1(geometry2,
|
|
63914
|
-
const nw = viewport.projectFlat([
|
|
63915
|
-
const se = viewport.projectFlat([
|
|
63913
|
+
function transform$1(geometry2, bbox, viewport) {
|
|
63914
|
+
const nw = viewport.projectFlat([bbox.west, bbox.north]);
|
|
63915
|
+
const se = viewport.projectFlat([bbox.east, bbox.south]);
|
|
63916
63916
|
const projectedBbox = [nw, se];
|
|
63917
63917
|
return {
|
|
63918
63918
|
...geometry2,
|
|
@@ -64302,11 +64302,11 @@ class MVTLayer extends TileLayer {
|
|
|
64302
64302
|
return [];
|
|
64303
64303
|
}
|
|
64304
64304
|
const {
|
|
64305
|
-
bbox
|
|
64305
|
+
bbox
|
|
64306
64306
|
} = tile;
|
|
64307
|
-
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(
|
|
64307
|
+
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
|
|
64308
64308
|
const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
|
|
64309
|
-
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2,
|
|
64309
|
+
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
|
|
64310
64310
|
}
|
|
64311
64311
|
return tile._contentWGS84;
|
|
64312
64312
|
}
|
|
@@ -64333,7 +64333,7 @@ function getFeatureLayerName(feature2) {
|
|
|
64333
64333
|
function isFeatureIdDefined(value) {
|
|
64334
64334
|
return value !== void 0 && value !== null && value !== "";
|
|
64335
64335
|
}
|
|
64336
|
-
function transformTileCoordsToWGS84(object2,
|
|
64336
|
+
function transformTileCoordsToWGS84(object2, bbox, viewport) {
|
|
64337
64337
|
const feature2 = {
|
|
64338
64338
|
...object2,
|
|
64339
64339
|
geometry: {
|
|
@@ -64342,7 +64342,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
|
|
|
64342
64342
|
};
|
|
64343
64343
|
Object.defineProperty(feature2.geometry, "coordinates", {
|
|
64344
64344
|
get: () => {
|
|
64345
|
-
const wgs84Geom = transform$1(object2.geometry,
|
|
64345
|
+
const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
|
|
64346
64346
|
return wgs84Geom.coordinates;
|
|
64347
64347
|
}
|
|
64348
64348
|
});
|
|
@@ -64513,16 +64513,6 @@ function polygons(coordinates2, properties, options = {}) {
|
|
|
64513
64513
|
options
|
|
64514
64514
|
);
|
|
64515
64515
|
}
|
|
64516
|
-
function lineString(coordinates2, properties, options = {}) {
|
|
64517
|
-
if (coordinates2.length < 2) {
|
|
64518
|
-
throw new Error("coordinates must be an array of two or more positions");
|
|
64519
|
-
}
|
|
64520
|
-
const geom = {
|
|
64521
|
-
type: "LineString",
|
|
64522
|
-
coordinates: coordinates2
|
|
64523
|
-
};
|
|
64524
|
-
return feature$1(geom, properties, options);
|
|
64525
|
-
}
|
|
64526
64516
|
function featureCollection(features, options = {}) {
|
|
64527
64517
|
const fc = { type: "FeatureCollection" };
|
|
64528
64518
|
if (options.id) {
|
|
@@ -64548,10 +64538,6 @@ function radiansToLength(radians2, units = "kilometers") {
|
|
|
64548
64538
|
}
|
|
64549
64539
|
return radians2 * factor;
|
|
64550
64540
|
}
|
|
64551
|
-
function radiansToDegrees(radians2) {
|
|
64552
|
-
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
64553
|
-
return normalisedRadians * 180 / Math.PI;
|
|
64554
|
-
}
|
|
64555
64541
|
function degreesToRadians(degrees2) {
|
|
64556
64542
|
const normalisedDegrees = degrees2 % 360;
|
|
64557
64543
|
return normalisedDegrees * Math.PI / 180;
|
|
@@ -64559,428 +64545,6 @@ function degreesToRadians(degrees2) {
|
|
|
64559
64545
|
function isNumber$1(num) {
|
|
64560
64546
|
return !isNaN(num) && num !== null && !Array.isArray(num);
|
|
64561
64547
|
}
|
|
64562
|
-
function isObject$3(input) {
|
|
64563
|
-
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
64564
|
-
}
|
|
64565
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
64566
|
-
if (geojson === null) return;
|
|
64567
|
-
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;
|
|
64568
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
64569
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
64570
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
64571
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
64572
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
64573
|
-
var multiFeatureIndex = 0;
|
|
64574
|
-
var geometryIndex = 0;
|
|
64575
|
-
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
64576
|
-
if (geometry2 === null) continue;
|
|
64577
|
-
coords = geometry2.coordinates;
|
|
64578
|
-
var geomType = geometry2.type;
|
|
64579
|
-
wrapShrink = 0;
|
|
64580
|
-
switch (geomType) {
|
|
64581
|
-
case null:
|
|
64582
|
-
break;
|
|
64583
|
-
case "Point":
|
|
64584
|
-
if (callback(
|
|
64585
|
-
coords,
|
|
64586
|
-
coordIndex,
|
|
64587
|
-
featureIndex,
|
|
64588
|
-
multiFeatureIndex,
|
|
64589
|
-
geometryIndex
|
|
64590
|
-
) === false)
|
|
64591
|
-
return false;
|
|
64592
|
-
coordIndex++;
|
|
64593
|
-
multiFeatureIndex++;
|
|
64594
|
-
break;
|
|
64595
|
-
case "LineString":
|
|
64596
|
-
case "MultiPoint":
|
|
64597
|
-
for (j = 0; j < coords.length; j++) {
|
|
64598
|
-
if (callback(
|
|
64599
|
-
coords[j],
|
|
64600
|
-
coordIndex,
|
|
64601
|
-
featureIndex,
|
|
64602
|
-
multiFeatureIndex,
|
|
64603
|
-
geometryIndex
|
|
64604
|
-
) === false)
|
|
64605
|
-
return false;
|
|
64606
|
-
coordIndex++;
|
|
64607
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
64608
|
-
}
|
|
64609
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
64610
|
-
break;
|
|
64611
|
-
case "Polygon":
|
|
64612
|
-
case "MultiLineString":
|
|
64613
|
-
for (j = 0; j < coords.length; j++) {
|
|
64614
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
64615
|
-
if (callback(
|
|
64616
|
-
coords[j][k],
|
|
64617
|
-
coordIndex,
|
|
64618
|
-
featureIndex,
|
|
64619
|
-
multiFeatureIndex,
|
|
64620
|
-
geometryIndex
|
|
64621
|
-
) === false)
|
|
64622
|
-
return false;
|
|
64623
|
-
coordIndex++;
|
|
64624
|
-
}
|
|
64625
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
64626
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
64627
|
-
}
|
|
64628
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
64629
|
-
break;
|
|
64630
|
-
case "MultiPolygon":
|
|
64631
|
-
for (j = 0; j < coords.length; j++) {
|
|
64632
|
-
geometryIndex = 0;
|
|
64633
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
64634
|
-
for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
|
|
64635
|
-
if (callback(
|
|
64636
|
-
coords[j][k][l2],
|
|
64637
|
-
coordIndex,
|
|
64638
|
-
featureIndex,
|
|
64639
|
-
multiFeatureIndex,
|
|
64640
|
-
geometryIndex
|
|
64641
|
-
) === false)
|
|
64642
|
-
return false;
|
|
64643
|
-
coordIndex++;
|
|
64644
|
-
}
|
|
64645
|
-
geometryIndex++;
|
|
64646
|
-
}
|
|
64647
|
-
multiFeatureIndex++;
|
|
64648
|
-
}
|
|
64649
|
-
break;
|
|
64650
|
-
case "GeometryCollection":
|
|
64651
|
-
for (j = 0; j < geometry2.geometries.length; j++)
|
|
64652
|
-
if (coordEach(geometry2.geometries[j], callback) === false)
|
|
64653
|
-
return false;
|
|
64654
|
-
break;
|
|
64655
|
-
default:
|
|
64656
|
-
throw new Error("Unknown Geometry Type");
|
|
64657
|
-
}
|
|
64658
|
-
}
|
|
64659
|
-
}
|
|
64660
|
-
}
|
|
64661
|
-
function featureEach(geojson, callback) {
|
|
64662
|
-
if (geojson.type === "Feature") {
|
|
64663
|
-
callback(geojson, 0);
|
|
64664
|
-
} else if (geojson.type === "FeatureCollection") {
|
|
64665
|
-
for (var i2 = 0; i2 < geojson.features.length; i2++) {
|
|
64666
|
-
if (callback(geojson.features[i2], i2) === false) break;
|
|
64667
|
-
}
|
|
64668
|
-
}
|
|
64669
|
-
}
|
|
64670
|
-
function geomEach(geojson, callback) {
|
|
64671
|
-
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;
|
|
64672
|
-
for (i2 = 0; i2 < stop; i2++) {
|
|
64673
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
|
|
64674
|
-
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
|
|
64675
|
-
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
|
|
64676
|
-
featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
|
|
64677
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
64678
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
64679
|
-
for (g2 = 0; g2 < stopG; g2++) {
|
|
64680
|
-
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
|
|
64681
|
-
if (geometry2 === null) {
|
|
64682
|
-
if (callback(
|
|
64683
|
-
null,
|
|
64684
|
-
featureIndex,
|
|
64685
|
-
featureProperties,
|
|
64686
|
-
featureBBox,
|
|
64687
|
-
featureId2
|
|
64688
|
-
) === false)
|
|
64689
|
-
return false;
|
|
64690
|
-
continue;
|
|
64691
|
-
}
|
|
64692
|
-
switch (geometry2.type) {
|
|
64693
|
-
case "Point":
|
|
64694
|
-
case "LineString":
|
|
64695
|
-
case "MultiPoint":
|
|
64696
|
-
case "Polygon":
|
|
64697
|
-
case "MultiLineString":
|
|
64698
|
-
case "MultiPolygon": {
|
|
64699
|
-
if (callback(
|
|
64700
|
-
geometry2,
|
|
64701
|
-
featureIndex,
|
|
64702
|
-
featureProperties,
|
|
64703
|
-
featureBBox,
|
|
64704
|
-
featureId2
|
|
64705
|
-
) === false)
|
|
64706
|
-
return false;
|
|
64707
|
-
break;
|
|
64708
|
-
}
|
|
64709
|
-
case "GeometryCollection": {
|
|
64710
|
-
for (j = 0; j < geometry2.geometries.length; j++) {
|
|
64711
|
-
if (callback(
|
|
64712
|
-
geometry2.geometries[j],
|
|
64713
|
-
featureIndex,
|
|
64714
|
-
featureProperties,
|
|
64715
|
-
featureBBox,
|
|
64716
|
-
featureId2
|
|
64717
|
-
) === false)
|
|
64718
|
-
return false;
|
|
64719
|
-
}
|
|
64720
|
-
break;
|
|
64721
|
-
}
|
|
64722
|
-
default:
|
|
64723
|
-
throw new Error("Unknown Geometry Type");
|
|
64724
|
-
}
|
|
64725
|
-
}
|
|
64726
|
-
featureIndex++;
|
|
64727
|
-
}
|
|
64728
|
-
}
|
|
64729
|
-
function geomReduce(geojson, callback, initialValue) {
|
|
64730
|
-
var previousValue = initialValue;
|
|
64731
|
-
geomEach(
|
|
64732
|
-
geojson,
|
|
64733
|
-
function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
|
|
64734
|
-
previousValue = callback(
|
|
64735
|
-
previousValue,
|
|
64736
|
-
currentGeometry,
|
|
64737
|
-
featureIndex,
|
|
64738
|
-
featureProperties,
|
|
64739
|
-
featureBBox,
|
|
64740
|
-
featureId2
|
|
64741
|
-
);
|
|
64742
|
-
}
|
|
64743
|
-
);
|
|
64744
|
-
return previousValue;
|
|
64745
|
-
}
|
|
64746
|
-
function flattenEach(geojson, callback) {
|
|
64747
|
-
geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
|
|
64748
|
-
var type = geometry2 === null ? null : geometry2.type;
|
|
64749
|
-
switch (type) {
|
|
64750
|
-
case null:
|
|
64751
|
-
case "Point":
|
|
64752
|
-
case "LineString":
|
|
64753
|
-
case "Polygon":
|
|
64754
|
-
if (callback(
|
|
64755
|
-
feature$1(geometry2, properties, { bbox: bbox2, id }),
|
|
64756
|
-
featureIndex,
|
|
64757
|
-
0
|
|
64758
|
-
) === false)
|
|
64759
|
-
return false;
|
|
64760
|
-
return;
|
|
64761
|
-
}
|
|
64762
|
-
var geomType;
|
|
64763
|
-
switch (type) {
|
|
64764
|
-
case "MultiPoint":
|
|
64765
|
-
geomType = "Point";
|
|
64766
|
-
break;
|
|
64767
|
-
case "MultiLineString":
|
|
64768
|
-
geomType = "LineString";
|
|
64769
|
-
break;
|
|
64770
|
-
case "MultiPolygon":
|
|
64771
|
-
geomType = "Polygon";
|
|
64772
|
-
break;
|
|
64773
|
-
}
|
|
64774
|
-
for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
|
|
64775
|
-
var coordinate = geometry2.coordinates[multiFeatureIndex];
|
|
64776
|
-
var geom = {
|
|
64777
|
-
type: geomType,
|
|
64778
|
-
coordinates: coordinate
|
|
64779
|
-
};
|
|
64780
|
-
if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
|
|
64781
|
-
return false;
|
|
64782
|
-
}
|
|
64783
|
-
});
|
|
64784
|
-
}
|
|
64785
|
-
function flattenReduce(geojson, callback, initialValue) {
|
|
64786
|
-
var previousValue = initialValue;
|
|
64787
|
-
flattenEach(
|
|
64788
|
-
geojson,
|
|
64789
|
-
function(currentFeature, featureIndex, multiFeatureIndex) {
|
|
64790
|
-
if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
|
|
64791
|
-
previousValue = currentFeature;
|
|
64792
|
-
else
|
|
64793
|
-
previousValue = callback(
|
|
64794
|
-
previousValue,
|
|
64795
|
-
currentFeature,
|
|
64796
|
-
featureIndex,
|
|
64797
|
-
multiFeatureIndex
|
|
64798
|
-
);
|
|
64799
|
-
}
|
|
64800
|
-
);
|
|
64801
|
-
return previousValue;
|
|
64802
|
-
}
|
|
64803
|
-
function segmentEach(geojson, callback) {
|
|
64804
|
-
flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
64805
|
-
var segmentIndex = 0;
|
|
64806
|
-
if (!feature2.geometry) return;
|
|
64807
|
-
var type = feature2.geometry.type;
|
|
64808
|
-
if (type === "Point" || type === "MultiPoint") return;
|
|
64809
|
-
var previousCoords;
|
|
64810
|
-
var previousFeatureIndex = 0;
|
|
64811
|
-
var previousMultiIndex = 0;
|
|
64812
|
-
var prevGeomIndex = 0;
|
|
64813
|
-
if (coordEach(
|
|
64814
|
-
feature2,
|
|
64815
|
-
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
64816
|
-
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
64817
|
-
previousCoords = currentCoord;
|
|
64818
|
-
previousFeatureIndex = featureIndex;
|
|
64819
|
-
previousMultiIndex = multiPartIndexCoord;
|
|
64820
|
-
prevGeomIndex = geometryIndex;
|
|
64821
|
-
segmentIndex = 0;
|
|
64822
|
-
return;
|
|
64823
|
-
}
|
|
64824
|
-
var currentSegment = lineString(
|
|
64825
|
-
[previousCoords, currentCoord],
|
|
64826
|
-
feature2.properties
|
|
64827
|
-
);
|
|
64828
|
-
if (callback(
|
|
64829
|
-
currentSegment,
|
|
64830
|
-
featureIndex,
|
|
64831
|
-
multiFeatureIndex,
|
|
64832
|
-
geometryIndex,
|
|
64833
|
-
segmentIndex
|
|
64834
|
-
) === false)
|
|
64835
|
-
return false;
|
|
64836
|
-
segmentIndex++;
|
|
64837
|
-
previousCoords = currentCoord;
|
|
64838
|
-
}
|
|
64839
|
-
) === false)
|
|
64840
|
-
return false;
|
|
64841
|
-
});
|
|
64842
|
-
}
|
|
64843
|
-
function bbox$1(geojson, options = {}) {
|
|
64844
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
64845
|
-
return geojson.bbox;
|
|
64846
|
-
}
|
|
64847
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
64848
|
-
coordEach(geojson, (coord) => {
|
|
64849
|
-
if (result[0] > coord[0]) {
|
|
64850
|
-
result[0] = coord[0];
|
|
64851
|
-
}
|
|
64852
|
-
if (result[1] > coord[1]) {
|
|
64853
|
-
result[1] = coord[1];
|
|
64854
|
-
}
|
|
64855
|
-
if (result[2] < coord[0]) {
|
|
64856
|
-
result[2] = coord[0];
|
|
64857
|
-
}
|
|
64858
|
-
if (result[3] < coord[1]) {
|
|
64859
|
-
result[3] = coord[1];
|
|
64860
|
-
}
|
|
64861
|
-
});
|
|
64862
|
-
return result;
|
|
64863
|
-
}
|
|
64864
|
-
function getCoord(coord) {
|
|
64865
|
-
if (!coord) {
|
|
64866
|
-
throw new Error("coord is required");
|
|
64867
|
-
}
|
|
64868
|
-
if (!Array.isArray(coord)) {
|
|
64869
|
-
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
64870
|
-
return [...coord.geometry.coordinates];
|
|
64871
|
-
}
|
|
64872
|
-
if (coord.type === "Point") {
|
|
64873
|
-
return [...coord.coordinates];
|
|
64874
|
-
}
|
|
64875
|
-
}
|
|
64876
|
-
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
64877
|
-
return [...coord];
|
|
64878
|
-
}
|
|
64879
|
-
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
64880
|
-
}
|
|
64881
|
-
function getCoords(coords) {
|
|
64882
|
-
if (Array.isArray(coords)) {
|
|
64883
|
-
return coords;
|
|
64884
|
-
}
|
|
64885
|
-
if (coords.type === "Feature") {
|
|
64886
|
-
if (coords.geometry !== null) {
|
|
64887
|
-
return coords.geometry.coordinates;
|
|
64888
|
-
}
|
|
64889
|
-
} else {
|
|
64890
|
-
if (coords.coordinates) {
|
|
64891
|
-
return coords.coordinates;
|
|
64892
|
-
}
|
|
64893
|
-
}
|
|
64894
|
-
throw new Error(
|
|
64895
|
-
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
64896
|
-
);
|
|
64897
|
-
}
|
|
64898
|
-
function getGeom(geojson) {
|
|
64899
|
-
if (geojson.type === "Feature") {
|
|
64900
|
-
return geojson.geometry;
|
|
64901
|
-
}
|
|
64902
|
-
return geojson;
|
|
64903
|
-
}
|
|
64904
|
-
function booleanPointOnLine(pt, line, options = {}) {
|
|
64905
|
-
const ptCoords = getCoord(pt);
|
|
64906
|
-
const lineCoords = getCoords(line);
|
|
64907
|
-
for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
|
|
64908
|
-
let ignoreBoundary = false;
|
|
64909
|
-
if (options.ignoreEndVertices) {
|
|
64910
|
-
if (i2 === 0) {
|
|
64911
|
-
ignoreBoundary = "start";
|
|
64912
|
-
}
|
|
64913
|
-
if (i2 === lineCoords.length - 2) {
|
|
64914
|
-
ignoreBoundary = "end";
|
|
64915
|
-
}
|
|
64916
|
-
if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
|
|
64917
|
-
ignoreBoundary = "both";
|
|
64918
|
-
}
|
|
64919
|
-
}
|
|
64920
|
-
if (isPointOnLineSegment(
|
|
64921
|
-
lineCoords[i2],
|
|
64922
|
-
lineCoords[i2 + 1],
|
|
64923
|
-
ptCoords,
|
|
64924
|
-
ignoreBoundary,
|
|
64925
|
-
typeof options.epsilon === "undefined" ? null : options.epsilon
|
|
64926
|
-
)) {
|
|
64927
|
-
return true;
|
|
64928
|
-
}
|
|
64929
|
-
}
|
|
64930
|
-
return false;
|
|
64931
|
-
}
|
|
64932
|
-
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
|
|
64933
|
-
const x = pt[0];
|
|
64934
|
-
const y = pt[1];
|
|
64935
|
-
const x12 = lineSegmentStart[0];
|
|
64936
|
-
const y12 = lineSegmentStart[1];
|
|
64937
|
-
const x2 = lineSegmentEnd[0];
|
|
64938
|
-
const y2 = lineSegmentEnd[1];
|
|
64939
|
-
const dxc = pt[0] - x12;
|
|
64940
|
-
const dyc = pt[1] - y12;
|
|
64941
|
-
const dxl = x2 - x12;
|
|
64942
|
-
const dyl = y2 - y12;
|
|
64943
|
-
const cross2 = dxc * dyl - dyc * dxl;
|
|
64944
|
-
if (epsilon3 !== null) {
|
|
64945
|
-
if (Math.abs(cross2) > epsilon3) {
|
|
64946
|
-
return false;
|
|
64947
|
-
}
|
|
64948
|
-
} else if (cross2 !== 0) {
|
|
64949
|
-
return false;
|
|
64950
|
-
}
|
|
64951
|
-
if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
|
|
64952
|
-
if (excludeBoundary) {
|
|
64953
|
-
return false;
|
|
64954
|
-
}
|
|
64955
|
-
if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
|
|
64956
|
-
return true;
|
|
64957
|
-
} else {
|
|
64958
|
-
return false;
|
|
64959
|
-
}
|
|
64960
|
-
}
|
|
64961
|
-
if (!excludeBoundary) {
|
|
64962
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
64963
|
-
return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
|
|
64964
|
-
}
|
|
64965
|
-
return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
|
|
64966
|
-
} else if (excludeBoundary === "start") {
|
|
64967
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
64968
|
-
return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
|
|
64969
|
-
}
|
|
64970
|
-
return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
|
|
64971
|
-
} else if (excludeBoundary === "end") {
|
|
64972
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
64973
|
-
return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
|
|
64974
|
-
}
|
|
64975
|
-
return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
|
|
64976
|
-
} else if (excludeBoundary === "both") {
|
|
64977
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
64978
|
-
return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
|
|
64979
|
-
}
|
|
64980
|
-
return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
|
|
64981
|
-
}
|
|
64982
|
-
return false;
|
|
64983
|
-
}
|
|
64984
64548
|
const epsilon$1 = 11102230246251565e-32;
|
|
64985
64549
|
const splitter = 134217729;
|
|
64986
64550
|
const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
|
|
@@ -65277,6 +64841,29 @@ function pointInPolygon(p, polygon2) {
|
|
|
65277
64841
|
}
|
|
65278
64842
|
return true;
|
|
65279
64843
|
}
|
|
64844
|
+
function getCoord(coord) {
|
|
64845
|
+
if (!coord) {
|
|
64846
|
+
throw new Error("coord is required");
|
|
64847
|
+
}
|
|
64848
|
+
if (!Array.isArray(coord)) {
|
|
64849
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
64850
|
+
return [...coord.geometry.coordinates];
|
|
64851
|
+
}
|
|
64852
|
+
if (coord.type === "Point") {
|
|
64853
|
+
return [...coord.coordinates];
|
|
64854
|
+
}
|
|
64855
|
+
}
|
|
64856
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
64857
|
+
return [...coord];
|
|
64858
|
+
}
|
|
64859
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
64860
|
+
}
|
|
64861
|
+
function getGeom(geojson) {
|
|
64862
|
+
if (geojson.type === "Feature") {
|
|
64863
|
+
return geojson.geometry;
|
|
64864
|
+
}
|
|
64865
|
+
return geojson;
|
|
64866
|
+
}
|
|
65280
64867
|
function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
65281
64868
|
if (!point2) {
|
|
65282
64869
|
throw new Error("point is required");
|
|
@@ -65287,9 +64874,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
65287
64874
|
const pt = getCoord(point2);
|
|
65288
64875
|
const geom = getGeom(polygon2);
|
|
65289
64876
|
const type = geom.type;
|
|
65290
|
-
const
|
|
64877
|
+
const bbox = polygon2.bbox;
|
|
65291
64878
|
let polys = geom.coordinates;
|
|
65292
|
-
if (
|
|
64879
|
+
if (bbox && inBBox(pt, bbox) === false) {
|
|
65293
64880
|
return false;
|
|
65294
64881
|
}
|
|
65295
64882
|
if (type === "Polygon") {
|
|
@@ -65303,1607 +64890,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
65303
64890
|
}
|
|
65304
64891
|
return result;
|
|
65305
64892
|
}
|
|
65306
|
-
function inBBox(pt,
|
|
65307
|
-
return
|
|
65308
|
-
}
|
|
65309
|
-
function booleanWithin(feature1, feature2) {
|
|
65310
|
-
var geom1 = getGeom(feature1);
|
|
65311
|
-
var geom2 = getGeom(feature2);
|
|
65312
|
-
var type1 = geom1.type;
|
|
65313
|
-
var type2 = geom2.type;
|
|
65314
|
-
switch (type1) {
|
|
65315
|
-
case "Point":
|
|
65316
|
-
switch (type2) {
|
|
65317
|
-
case "MultiPoint":
|
|
65318
|
-
return isPointInMultiPoint$1(geom1, geom2);
|
|
65319
|
-
case "LineString":
|
|
65320
|
-
return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
|
|
65321
|
-
case "Polygon":
|
|
65322
|
-
case "MultiPolygon":
|
|
65323
|
-
return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
|
|
65324
|
-
default:
|
|
65325
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65326
|
-
}
|
|
65327
|
-
case "MultiPoint":
|
|
65328
|
-
switch (type2) {
|
|
65329
|
-
case "MultiPoint":
|
|
65330
|
-
return isMultiPointInMultiPoint$1(geom1, geom2);
|
|
65331
|
-
case "LineString":
|
|
65332
|
-
return isMultiPointOnLine$1(geom1, geom2);
|
|
65333
|
-
case "Polygon":
|
|
65334
|
-
case "MultiPolygon":
|
|
65335
|
-
return isMultiPointInPoly$1(geom1, geom2);
|
|
65336
|
-
default:
|
|
65337
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65338
|
-
}
|
|
65339
|
-
case "LineString":
|
|
65340
|
-
switch (type2) {
|
|
65341
|
-
case "LineString":
|
|
65342
|
-
return isLineOnLine$1(geom1, geom2);
|
|
65343
|
-
case "Polygon":
|
|
65344
|
-
case "MultiPolygon":
|
|
65345
|
-
return isLineInPoly$1(geom1, geom2);
|
|
65346
|
-
default:
|
|
65347
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65348
|
-
}
|
|
65349
|
-
case "Polygon":
|
|
65350
|
-
switch (type2) {
|
|
65351
|
-
case "Polygon":
|
|
65352
|
-
case "MultiPolygon":
|
|
65353
|
-
return isPolyInPoly$1(geom1, geom2);
|
|
65354
|
-
default:
|
|
65355
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65356
|
-
}
|
|
65357
|
-
default:
|
|
65358
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
65359
|
-
}
|
|
65360
|
-
}
|
|
65361
|
-
function isPointInMultiPoint$1(point2, multiPoint) {
|
|
65362
|
-
var i2;
|
|
65363
|
-
var output = false;
|
|
65364
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
65365
|
-
if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
|
|
65366
|
-
output = true;
|
|
65367
|
-
break;
|
|
65368
|
-
}
|
|
65369
|
-
}
|
|
65370
|
-
return output;
|
|
65371
|
-
}
|
|
65372
|
-
function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
|
|
65373
|
-
for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
|
|
65374
|
-
var anyMatch = false;
|
|
65375
|
-
for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
|
|
65376
|
-
if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
|
|
65377
|
-
anyMatch = true;
|
|
65378
|
-
}
|
|
65379
|
-
}
|
|
65380
|
-
if (!anyMatch) {
|
|
65381
|
-
return false;
|
|
65382
|
-
}
|
|
65383
|
-
}
|
|
65384
|
-
return true;
|
|
65385
|
-
}
|
|
65386
|
-
function isMultiPointOnLine$1(multiPoint, lineString2) {
|
|
65387
|
-
var foundInsidePoint = false;
|
|
65388
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
65389
|
-
if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
|
|
65390
|
-
return false;
|
|
65391
|
-
}
|
|
65392
|
-
if (!foundInsidePoint) {
|
|
65393
|
-
foundInsidePoint = booleanPointOnLine(
|
|
65394
|
-
multiPoint.coordinates[i2],
|
|
65395
|
-
lineString2,
|
|
65396
|
-
{ ignoreEndVertices: true }
|
|
65397
|
-
);
|
|
65398
|
-
}
|
|
65399
|
-
}
|
|
65400
|
-
return foundInsidePoint;
|
|
65401
|
-
}
|
|
65402
|
-
function isMultiPointInPoly$1(multiPoint, polygon2) {
|
|
65403
|
-
var output = true;
|
|
65404
|
-
var isInside = false;
|
|
65405
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
65406
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
|
|
65407
|
-
if (!isInside) {
|
|
65408
|
-
output = false;
|
|
65409
|
-
break;
|
|
65410
|
-
}
|
|
65411
|
-
{
|
|
65412
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
|
|
65413
|
-
ignoreBoundary: true
|
|
65414
|
-
});
|
|
65415
|
-
}
|
|
65416
|
-
}
|
|
65417
|
-
return output && isInside;
|
|
65418
|
-
}
|
|
65419
|
-
function isLineOnLine$1(lineString1, lineString2) {
|
|
65420
|
-
for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
|
|
65421
|
-
if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
|
|
65422
|
-
return false;
|
|
65423
|
-
}
|
|
65424
|
-
}
|
|
65425
|
-
return true;
|
|
65426
|
-
}
|
|
65427
|
-
function isLineInPoly$1(linestring, polygon2) {
|
|
65428
|
-
var polyBbox = bbox$1(polygon2);
|
|
65429
|
-
var lineBbox = bbox$1(linestring);
|
|
65430
|
-
if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
|
|
65431
|
-
return false;
|
|
65432
|
-
}
|
|
65433
|
-
var foundInsidePoint = false;
|
|
65434
|
-
for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
|
|
65435
|
-
if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
|
|
65436
|
-
return false;
|
|
65437
|
-
}
|
|
65438
|
-
if (!foundInsidePoint) {
|
|
65439
|
-
foundInsidePoint = booleanPointInPolygon(
|
|
65440
|
-
linestring.coordinates[i2],
|
|
65441
|
-
polygon2,
|
|
65442
|
-
{ ignoreBoundary: true }
|
|
65443
|
-
);
|
|
65444
|
-
}
|
|
65445
|
-
if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
|
|
65446
|
-
var midpoint = getMidpoint$1(
|
|
65447
|
-
linestring.coordinates[i2],
|
|
65448
|
-
linestring.coordinates[i2 + 1]
|
|
65449
|
-
);
|
|
65450
|
-
foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
|
|
65451
|
-
ignoreBoundary: true
|
|
65452
|
-
});
|
|
65453
|
-
}
|
|
65454
|
-
}
|
|
65455
|
-
return foundInsidePoint;
|
|
65456
|
-
}
|
|
65457
|
-
function isPolyInPoly$1(geometry1, geometry2) {
|
|
65458
|
-
var poly1Bbox = bbox$1(geometry1);
|
|
65459
|
-
var poly2Bbox = bbox$1(geometry2);
|
|
65460
|
-
if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
|
|
65461
|
-
return false;
|
|
65462
|
-
}
|
|
65463
|
-
for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
|
|
65464
|
-
if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
|
|
65465
|
-
return false;
|
|
65466
|
-
}
|
|
65467
|
-
}
|
|
65468
|
-
return true;
|
|
65469
|
-
}
|
|
65470
|
-
function doBBoxOverlap$1(bbox1, bbox2) {
|
|
65471
|
-
if (bbox1[0] > bbox2[0]) return false;
|
|
65472
|
-
if (bbox1[2] < bbox2[2]) return false;
|
|
65473
|
-
if (bbox1[1] > bbox2[1]) return false;
|
|
65474
|
-
if (bbox1[3] < bbox2[3]) return false;
|
|
65475
|
-
return true;
|
|
65476
|
-
}
|
|
65477
|
-
function compareCoords$1(pair1, pair2) {
|
|
65478
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
65479
|
-
}
|
|
65480
|
-
function getMidpoint$1(pair1, pair2) {
|
|
65481
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
65482
|
-
}
|
|
65483
|
-
function booleanContains(feature1, feature2) {
|
|
65484
|
-
const geom1 = getGeom(feature1);
|
|
65485
|
-
const geom2 = getGeom(feature2);
|
|
65486
|
-
const type1 = geom1.type;
|
|
65487
|
-
const type2 = geom2.type;
|
|
65488
|
-
const coords1 = geom1.coordinates;
|
|
65489
|
-
const coords2 = geom2.coordinates;
|
|
65490
|
-
switch (type1) {
|
|
65491
|
-
case "Point":
|
|
65492
|
-
switch (type2) {
|
|
65493
|
-
case "Point":
|
|
65494
|
-
return compareCoords(coords1, coords2);
|
|
65495
|
-
default:
|
|
65496
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65497
|
-
}
|
|
65498
|
-
case "MultiPoint":
|
|
65499
|
-
switch (type2) {
|
|
65500
|
-
case "Point":
|
|
65501
|
-
return isPointInMultiPoint(geom1, geom2);
|
|
65502
|
-
case "MultiPoint":
|
|
65503
|
-
return isMultiPointInMultiPoint(geom1, geom2);
|
|
65504
|
-
default:
|
|
65505
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65506
|
-
}
|
|
65507
|
-
case "LineString":
|
|
65508
|
-
switch (type2) {
|
|
65509
|
-
case "Point":
|
|
65510
|
-
return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
|
|
65511
|
-
case "LineString":
|
|
65512
|
-
return isLineOnLine(geom1, geom2);
|
|
65513
|
-
case "MultiPoint":
|
|
65514
|
-
return isMultiPointOnLine(geom1, geom2);
|
|
65515
|
-
default:
|
|
65516
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65517
|
-
}
|
|
65518
|
-
case "Polygon":
|
|
65519
|
-
switch (type2) {
|
|
65520
|
-
case "Point":
|
|
65521
|
-
return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
|
|
65522
|
-
case "LineString":
|
|
65523
|
-
return isLineInPoly(geom1, geom2);
|
|
65524
|
-
case "Polygon":
|
|
65525
|
-
return isPolyInPoly(geom1, geom2);
|
|
65526
|
-
case "MultiPoint":
|
|
65527
|
-
return isMultiPointInPoly(geom1, geom2);
|
|
65528
|
-
default:
|
|
65529
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65530
|
-
}
|
|
65531
|
-
case "MultiPolygon":
|
|
65532
|
-
switch (type2) {
|
|
65533
|
-
case "Polygon":
|
|
65534
|
-
return isPolygonInMultiPolygon(geom1, geom2);
|
|
65535
|
-
default:
|
|
65536
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
65537
|
-
}
|
|
65538
|
-
default:
|
|
65539
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
65540
|
-
}
|
|
65541
|
-
}
|
|
65542
|
-
function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
|
|
65543
|
-
return multiPolygon2.coordinates.some(
|
|
65544
|
-
(coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
|
|
65545
|
-
);
|
|
65546
|
-
}
|
|
65547
|
-
function isPointInMultiPoint(multiPoint, pt) {
|
|
65548
|
-
let i2;
|
|
65549
|
-
let output = false;
|
|
65550
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
65551
|
-
if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
|
|
65552
|
-
output = true;
|
|
65553
|
-
break;
|
|
65554
|
-
}
|
|
65555
|
-
}
|
|
65556
|
-
return output;
|
|
65557
|
-
}
|
|
65558
|
-
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
65559
|
-
for (const coord2 of multiPoint2.coordinates) {
|
|
65560
|
-
let matchFound = false;
|
|
65561
|
-
for (const coord1 of multiPoint1.coordinates) {
|
|
65562
|
-
if (compareCoords(coord2, coord1)) {
|
|
65563
|
-
matchFound = true;
|
|
65564
|
-
break;
|
|
65565
|
-
}
|
|
65566
|
-
}
|
|
65567
|
-
if (!matchFound) {
|
|
65568
|
-
return false;
|
|
65569
|
-
}
|
|
65570
|
-
}
|
|
65571
|
-
return true;
|
|
65572
|
-
}
|
|
65573
|
-
function isMultiPointOnLine(lineString2, multiPoint) {
|
|
65574
|
-
let haveFoundInteriorPoint = false;
|
|
65575
|
-
for (const coord of multiPoint.coordinates) {
|
|
65576
|
-
if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
|
|
65577
|
-
haveFoundInteriorPoint = true;
|
|
65578
|
-
}
|
|
65579
|
-
if (!booleanPointOnLine(coord, lineString2)) {
|
|
65580
|
-
return false;
|
|
65581
|
-
}
|
|
65582
|
-
}
|
|
65583
|
-
if (haveFoundInteriorPoint) {
|
|
65584
|
-
return true;
|
|
65585
|
-
}
|
|
65586
|
-
return false;
|
|
65587
|
-
}
|
|
65588
|
-
function isMultiPointInPoly(polygon2, multiPoint) {
|
|
65589
|
-
for (const coord of multiPoint.coordinates) {
|
|
65590
|
-
if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
|
|
65591
|
-
return false;
|
|
65592
|
-
}
|
|
65593
|
-
}
|
|
65594
|
-
return true;
|
|
65595
|
-
}
|
|
65596
|
-
function isLineOnLine(lineString1, lineString2) {
|
|
65597
|
-
let haveFoundInteriorPoint = false;
|
|
65598
|
-
for (const coords of lineString2.coordinates) {
|
|
65599
|
-
if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
65600
|
-
ignoreEndVertices: true
|
|
65601
|
-
})) {
|
|
65602
|
-
haveFoundInteriorPoint = true;
|
|
65603
|
-
}
|
|
65604
|
-
if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
65605
|
-
ignoreEndVertices: false
|
|
65606
|
-
})) {
|
|
65607
|
-
return false;
|
|
65608
|
-
}
|
|
65609
|
-
}
|
|
65610
|
-
return haveFoundInteriorPoint;
|
|
65611
|
-
}
|
|
65612
|
-
function isLineInPoly(polygon2, linestring) {
|
|
65613
|
-
let output = false;
|
|
65614
|
-
let i2 = 0;
|
|
65615
|
-
const polyBbox = bbox$1(polygon2);
|
|
65616
|
-
const lineBbox = bbox$1(linestring);
|
|
65617
|
-
if (!doBBoxOverlap(polyBbox, lineBbox)) {
|
|
65618
|
-
return false;
|
|
65619
|
-
}
|
|
65620
|
-
for (i2; i2 < linestring.coordinates.length - 1; i2++) {
|
|
65621
|
-
const midPoint = getMidpoint(
|
|
65622
|
-
linestring.coordinates[i2],
|
|
65623
|
-
linestring.coordinates[i2 + 1]
|
|
65624
|
-
);
|
|
65625
|
-
if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
|
|
65626
|
-
ignoreBoundary: true
|
|
65627
|
-
})) {
|
|
65628
|
-
output = true;
|
|
65629
|
-
break;
|
|
65630
|
-
}
|
|
65631
|
-
}
|
|
65632
|
-
return output;
|
|
65633
|
-
}
|
|
65634
|
-
function isPolyInPoly(feature1, feature2) {
|
|
65635
|
-
if (feature1.type === "Feature" && feature1.geometry === null) {
|
|
65636
|
-
return false;
|
|
65637
|
-
}
|
|
65638
|
-
if (feature2.type === "Feature" && feature2.geometry === null) {
|
|
65639
|
-
return false;
|
|
65640
|
-
}
|
|
65641
|
-
const poly1Bbox = bbox$1(feature1);
|
|
65642
|
-
const poly2Bbox = bbox$1(feature2);
|
|
65643
|
-
if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
|
|
65644
|
-
return false;
|
|
65645
|
-
}
|
|
65646
|
-
const coords = getGeom(feature2).coordinates;
|
|
65647
|
-
for (const ring of coords) {
|
|
65648
|
-
for (const coord of ring) {
|
|
65649
|
-
if (!booleanPointInPolygon(coord, feature1)) {
|
|
65650
|
-
return false;
|
|
65651
|
-
}
|
|
65652
|
-
}
|
|
65653
|
-
}
|
|
65654
|
-
return true;
|
|
65655
|
-
}
|
|
65656
|
-
function doBBoxOverlap(bbox1, bbox2) {
|
|
65657
|
-
if (bbox1[0] > bbox2[0]) {
|
|
65658
|
-
return false;
|
|
65659
|
-
}
|
|
65660
|
-
if (bbox1[2] < bbox2[2]) {
|
|
65661
|
-
return false;
|
|
65662
|
-
}
|
|
65663
|
-
if (bbox1[1] > bbox2[1]) {
|
|
65664
|
-
return false;
|
|
65665
|
-
}
|
|
65666
|
-
if (bbox1[3] < bbox2[3]) {
|
|
65667
|
-
return false;
|
|
65668
|
-
}
|
|
65669
|
-
return true;
|
|
65670
|
-
}
|
|
65671
|
-
function compareCoords(pair1, pair2) {
|
|
65672
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
65673
|
-
}
|
|
65674
|
-
function getMidpoint(pair1, pair2) {
|
|
65675
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
65676
|
-
}
|
|
65677
|
-
function quickselect(arr, k, left, right, compare2) {
|
|
65678
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
|
|
65679
|
-
}
|
|
65680
|
-
function quickselectStep(arr, k, left, right, compare2) {
|
|
65681
|
-
while (right > left) {
|
|
65682
|
-
if (right - left > 600) {
|
|
65683
|
-
var n3 = right - left + 1;
|
|
65684
|
-
var m = k - left + 1;
|
|
65685
|
-
var z = Math.log(n3);
|
|
65686
|
-
var s2 = 0.5 * Math.exp(2 * z / 3);
|
|
65687
|
-
var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
65688
|
-
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
65689
|
-
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
65690
|
-
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
65691
|
-
}
|
|
65692
|
-
var t = arr[k];
|
|
65693
|
-
var i2 = left;
|
|
65694
|
-
var j = right;
|
|
65695
|
-
swap(arr, left, k);
|
|
65696
|
-
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
65697
|
-
while (i2 < j) {
|
|
65698
|
-
swap(arr, i2, j);
|
|
65699
|
-
i2++;
|
|
65700
|
-
j--;
|
|
65701
|
-
while (compare2(arr[i2], t) < 0) i2++;
|
|
65702
|
-
while (compare2(arr[j], t) > 0) j--;
|
|
65703
|
-
}
|
|
65704
|
-
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
65705
|
-
else {
|
|
65706
|
-
j++;
|
|
65707
|
-
swap(arr, j, right);
|
|
65708
|
-
}
|
|
65709
|
-
if (j <= k) left = j + 1;
|
|
65710
|
-
if (k <= j) right = j - 1;
|
|
65711
|
-
}
|
|
65712
|
-
}
|
|
65713
|
-
function swap(arr, i2, j) {
|
|
65714
|
-
var tmp = arr[i2];
|
|
65715
|
-
arr[i2] = arr[j];
|
|
65716
|
-
arr[j] = tmp;
|
|
65717
|
-
}
|
|
65718
|
-
function defaultCompare$1(a2, b) {
|
|
65719
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
65720
|
-
}
|
|
65721
|
-
class RBush {
|
|
65722
|
-
constructor(maxEntries = 9) {
|
|
65723
|
-
this._maxEntries = Math.max(4, maxEntries);
|
|
65724
|
-
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
|
65725
|
-
this.clear();
|
|
65726
|
-
}
|
|
65727
|
-
all() {
|
|
65728
|
-
return this._all(this.data, []);
|
|
65729
|
-
}
|
|
65730
|
-
search(bbox2) {
|
|
65731
|
-
let node = this.data;
|
|
65732
|
-
const result = [];
|
|
65733
|
-
if (!intersects(bbox2, node)) return result;
|
|
65734
|
-
const toBBox = this.toBBox;
|
|
65735
|
-
const nodesToSearch = [];
|
|
65736
|
-
while (node) {
|
|
65737
|
-
for (let i2 = 0; i2 < node.children.length; i2++) {
|
|
65738
|
-
const child = node.children[i2];
|
|
65739
|
-
const childBBox = node.leaf ? toBBox(child) : child;
|
|
65740
|
-
if (intersects(bbox2, childBBox)) {
|
|
65741
|
-
if (node.leaf) result.push(child);
|
|
65742
|
-
else if (contains$1(bbox2, childBBox)) this._all(child, result);
|
|
65743
|
-
else nodesToSearch.push(child);
|
|
65744
|
-
}
|
|
65745
|
-
}
|
|
65746
|
-
node = nodesToSearch.pop();
|
|
65747
|
-
}
|
|
65748
|
-
return result;
|
|
65749
|
-
}
|
|
65750
|
-
collides(bbox2) {
|
|
65751
|
-
let node = this.data;
|
|
65752
|
-
if (!intersects(bbox2, node)) return false;
|
|
65753
|
-
const nodesToSearch = [];
|
|
65754
|
-
while (node) {
|
|
65755
|
-
for (let i2 = 0; i2 < node.children.length; i2++) {
|
|
65756
|
-
const child = node.children[i2];
|
|
65757
|
-
const childBBox = node.leaf ? this.toBBox(child) : child;
|
|
65758
|
-
if (intersects(bbox2, childBBox)) {
|
|
65759
|
-
if (node.leaf || contains$1(bbox2, childBBox)) return true;
|
|
65760
|
-
nodesToSearch.push(child);
|
|
65761
|
-
}
|
|
65762
|
-
}
|
|
65763
|
-
node = nodesToSearch.pop();
|
|
65764
|
-
}
|
|
65765
|
-
return false;
|
|
65766
|
-
}
|
|
65767
|
-
load(data) {
|
|
65768
|
-
if (!(data && data.length)) return this;
|
|
65769
|
-
if (data.length < this._minEntries) {
|
|
65770
|
-
for (let i2 = 0; i2 < data.length; i2++) {
|
|
65771
|
-
this.insert(data[i2]);
|
|
65772
|
-
}
|
|
65773
|
-
return this;
|
|
65774
|
-
}
|
|
65775
|
-
let node = this._build(data.slice(), 0, data.length - 1, 0);
|
|
65776
|
-
if (!this.data.children.length) {
|
|
65777
|
-
this.data = node;
|
|
65778
|
-
} else if (this.data.height === node.height) {
|
|
65779
|
-
this._splitRoot(this.data, node);
|
|
65780
|
-
} else {
|
|
65781
|
-
if (this.data.height < node.height) {
|
|
65782
|
-
const tmpNode = this.data;
|
|
65783
|
-
this.data = node;
|
|
65784
|
-
node = tmpNode;
|
|
65785
|
-
}
|
|
65786
|
-
this._insert(node, this.data.height - node.height - 1, true);
|
|
65787
|
-
}
|
|
65788
|
-
return this;
|
|
65789
|
-
}
|
|
65790
|
-
insert(item) {
|
|
65791
|
-
if (item) this._insert(item, this.data.height - 1);
|
|
65792
|
-
return this;
|
|
65793
|
-
}
|
|
65794
|
-
clear() {
|
|
65795
|
-
this.data = createNode([]);
|
|
65796
|
-
return this;
|
|
65797
|
-
}
|
|
65798
|
-
remove(item, equalsFn) {
|
|
65799
|
-
if (!item) return this;
|
|
65800
|
-
let node = this.data;
|
|
65801
|
-
const bbox2 = this.toBBox(item);
|
|
65802
|
-
const path = [];
|
|
65803
|
-
const indexes = [];
|
|
65804
|
-
let i2, parent, goingUp;
|
|
65805
|
-
while (node || path.length) {
|
|
65806
|
-
if (!node) {
|
|
65807
|
-
node = path.pop();
|
|
65808
|
-
parent = path[path.length - 1];
|
|
65809
|
-
i2 = indexes.pop();
|
|
65810
|
-
goingUp = true;
|
|
65811
|
-
}
|
|
65812
|
-
if (node.leaf) {
|
|
65813
|
-
const index2 = findItem(item, node.children, equalsFn);
|
|
65814
|
-
if (index2 !== -1) {
|
|
65815
|
-
node.children.splice(index2, 1);
|
|
65816
|
-
path.push(node);
|
|
65817
|
-
this._condense(path);
|
|
65818
|
-
return this;
|
|
65819
|
-
}
|
|
65820
|
-
}
|
|
65821
|
-
if (!goingUp && !node.leaf && contains$1(node, bbox2)) {
|
|
65822
|
-
path.push(node);
|
|
65823
|
-
indexes.push(i2);
|
|
65824
|
-
i2 = 0;
|
|
65825
|
-
parent = node;
|
|
65826
|
-
node = node.children[0];
|
|
65827
|
-
} else if (parent) {
|
|
65828
|
-
i2++;
|
|
65829
|
-
node = parent.children[i2];
|
|
65830
|
-
goingUp = false;
|
|
65831
|
-
} else node = null;
|
|
65832
|
-
}
|
|
65833
|
-
return this;
|
|
65834
|
-
}
|
|
65835
|
-
toBBox(item) {
|
|
65836
|
-
return item;
|
|
65837
|
-
}
|
|
65838
|
-
compareMinX(a2, b) {
|
|
65839
|
-
return a2.minX - b.minX;
|
|
65840
|
-
}
|
|
65841
|
-
compareMinY(a2, b) {
|
|
65842
|
-
return a2.minY - b.minY;
|
|
65843
|
-
}
|
|
65844
|
-
toJSON() {
|
|
65845
|
-
return this.data;
|
|
65846
|
-
}
|
|
65847
|
-
fromJSON(data) {
|
|
65848
|
-
this.data = data;
|
|
65849
|
-
return this;
|
|
65850
|
-
}
|
|
65851
|
-
_all(node, result) {
|
|
65852
|
-
const nodesToSearch = [];
|
|
65853
|
-
while (node) {
|
|
65854
|
-
if (node.leaf) result.push(...node.children);
|
|
65855
|
-
else nodesToSearch.push(...node.children);
|
|
65856
|
-
node = nodesToSearch.pop();
|
|
65857
|
-
}
|
|
65858
|
-
return result;
|
|
65859
|
-
}
|
|
65860
|
-
_build(items, left, right, height) {
|
|
65861
|
-
const N2 = right - left + 1;
|
|
65862
|
-
let M = this._maxEntries;
|
|
65863
|
-
let node;
|
|
65864
|
-
if (N2 <= M) {
|
|
65865
|
-
node = createNode(items.slice(left, right + 1));
|
|
65866
|
-
calcBBox(node, this.toBBox);
|
|
65867
|
-
return node;
|
|
65868
|
-
}
|
|
65869
|
-
if (!height) {
|
|
65870
|
-
height = Math.ceil(Math.log(N2) / Math.log(M));
|
|
65871
|
-
M = Math.ceil(N2 / Math.pow(M, height - 1));
|
|
65872
|
-
}
|
|
65873
|
-
node = createNode([]);
|
|
65874
|
-
node.leaf = false;
|
|
65875
|
-
node.height = height;
|
|
65876
|
-
const N22 = Math.ceil(N2 / M);
|
|
65877
|
-
const N1 = N22 * Math.ceil(Math.sqrt(M));
|
|
65878
|
-
multiSelect(items, left, right, N1, this.compareMinX);
|
|
65879
|
-
for (let i2 = left; i2 <= right; i2 += N1) {
|
|
65880
|
-
const right2 = Math.min(i2 + N1 - 1, right);
|
|
65881
|
-
multiSelect(items, i2, right2, N22, this.compareMinY);
|
|
65882
|
-
for (let j = i2; j <= right2; j += N22) {
|
|
65883
|
-
const right3 = Math.min(j + N22 - 1, right2);
|
|
65884
|
-
node.children.push(this._build(items, j, right3, height - 1));
|
|
65885
|
-
}
|
|
65886
|
-
}
|
|
65887
|
-
calcBBox(node, this.toBBox);
|
|
65888
|
-
return node;
|
|
65889
|
-
}
|
|
65890
|
-
_chooseSubtree(bbox2, node, level, path) {
|
|
65891
|
-
while (true) {
|
|
65892
|
-
path.push(node);
|
|
65893
|
-
if (node.leaf || path.length - 1 === level) break;
|
|
65894
|
-
let minArea = Infinity;
|
|
65895
|
-
let minEnlargement = Infinity;
|
|
65896
|
-
let targetNode;
|
|
65897
|
-
for (let i2 = 0; i2 < node.children.length; i2++) {
|
|
65898
|
-
const child = node.children[i2];
|
|
65899
|
-
const area2 = bboxArea(child);
|
|
65900
|
-
const enlargement = enlargedArea(bbox2, child) - area2;
|
|
65901
|
-
if (enlargement < minEnlargement) {
|
|
65902
|
-
minEnlargement = enlargement;
|
|
65903
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
65904
|
-
targetNode = child;
|
|
65905
|
-
} else if (enlargement === minEnlargement) {
|
|
65906
|
-
if (area2 < minArea) {
|
|
65907
|
-
minArea = area2;
|
|
65908
|
-
targetNode = child;
|
|
65909
|
-
}
|
|
65910
|
-
}
|
|
65911
|
-
}
|
|
65912
|
-
node = targetNode || node.children[0];
|
|
65913
|
-
}
|
|
65914
|
-
return node;
|
|
65915
|
-
}
|
|
65916
|
-
_insert(item, level, isNode2) {
|
|
65917
|
-
const bbox2 = isNode2 ? item : this.toBBox(item);
|
|
65918
|
-
const insertPath = [];
|
|
65919
|
-
const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
|
|
65920
|
-
node.children.push(item);
|
|
65921
|
-
extend$1(node, bbox2);
|
|
65922
|
-
while (level >= 0) {
|
|
65923
|
-
if (insertPath[level].children.length > this._maxEntries) {
|
|
65924
|
-
this._split(insertPath, level);
|
|
65925
|
-
level--;
|
|
65926
|
-
} else break;
|
|
65927
|
-
}
|
|
65928
|
-
this._adjustParentBBoxes(bbox2, insertPath, level);
|
|
65929
|
-
}
|
|
65930
|
-
// split overflowed node into two
|
|
65931
|
-
_split(insertPath, level) {
|
|
65932
|
-
const node = insertPath[level];
|
|
65933
|
-
const M = node.children.length;
|
|
65934
|
-
const m = this._minEntries;
|
|
65935
|
-
this._chooseSplitAxis(node, m, M);
|
|
65936
|
-
const splitIndex = this._chooseSplitIndex(node, m, M);
|
|
65937
|
-
const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
|
|
65938
|
-
newNode.height = node.height;
|
|
65939
|
-
newNode.leaf = node.leaf;
|
|
65940
|
-
calcBBox(node, this.toBBox);
|
|
65941
|
-
calcBBox(newNode, this.toBBox);
|
|
65942
|
-
if (level) insertPath[level - 1].children.push(newNode);
|
|
65943
|
-
else this._splitRoot(node, newNode);
|
|
65944
|
-
}
|
|
65945
|
-
_splitRoot(node, newNode) {
|
|
65946
|
-
this.data = createNode([node, newNode]);
|
|
65947
|
-
this.data.height = node.height + 1;
|
|
65948
|
-
this.data.leaf = false;
|
|
65949
|
-
calcBBox(this.data, this.toBBox);
|
|
65950
|
-
}
|
|
65951
|
-
_chooseSplitIndex(node, m, M) {
|
|
65952
|
-
let index2;
|
|
65953
|
-
let minOverlap = Infinity;
|
|
65954
|
-
let minArea = Infinity;
|
|
65955
|
-
for (let i2 = m; i2 <= M - m; i2++) {
|
|
65956
|
-
const bbox1 = distBBox(node, 0, i2, this.toBBox);
|
|
65957
|
-
const bbox2 = distBBox(node, i2, M, this.toBBox);
|
|
65958
|
-
const overlap = intersectionArea(bbox1, bbox2);
|
|
65959
|
-
const area2 = bboxArea(bbox1) + bboxArea(bbox2);
|
|
65960
|
-
if (overlap < minOverlap) {
|
|
65961
|
-
minOverlap = overlap;
|
|
65962
|
-
index2 = i2;
|
|
65963
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
65964
|
-
} else if (overlap === minOverlap) {
|
|
65965
|
-
if (area2 < minArea) {
|
|
65966
|
-
minArea = area2;
|
|
65967
|
-
index2 = i2;
|
|
65968
|
-
}
|
|
65969
|
-
}
|
|
65970
|
-
}
|
|
65971
|
-
return index2 || M - m;
|
|
65972
|
-
}
|
|
65973
|
-
// sorts node children by the best axis for split
|
|
65974
|
-
_chooseSplitAxis(node, m, M) {
|
|
65975
|
-
const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
|
|
65976
|
-
const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
|
|
65977
|
-
const xMargin = this._allDistMargin(node, m, M, compareMinX);
|
|
65978
|
-
const yMargin = this._allDistMargin(node, m, M, compareMinY);
|
|
65979
|
-
if (xMargin < yMargin) node.children.sort(compareMinX);
|
|
65980
|
-
}
|
|
65981
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
65982
|
-
_allDistMargin(node, m, M, compare2) {
|
|
65983
|
-
node.children.sort(compare2);
|
|
65984
|
-
const toBBox = this.toBBox;
|
|
65985
|
-
const leftBBox = distBBox(node, 0, m, toBBox);
|
|
65986
|
-
const rightBBox = distBBox(node, M - m, M, toBBox);
|
|
65987
|
-
let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
65988
|
-
for (let i2 = m; i2 < M - m; i2++) {
|
|
65989
|
-
const child = node.children[i2];
|
|
65990
|
-
extend$1(leftBBox, node.leaf ? toBBox(child) : child);
|
|
65991
|
-
margin += bboxMargin(leftBBox);
|
|
65992
|
-
}
|
|
65993
|
-
for (let i2 = M - m - 1; i2 >= m; i2--) {
|
|
65994
|
-
const child = node.children[i2];
|
|
65995
|
-
extend$1(rightBBox, node.leaf ? toBBox(child) : child);
|
|
65996
|
-
margin += bboxMargin(rightBBox);
|
|
65997
|
-
}
|
|
65998
|
-
return margin;
|
|
65999
|
-
}
|
|
66000
|
-
_adjustParentBBoxes(bbox2, path, level) {
|
|
66001
|
-
for (let i2 = level; i2 >= 0; i2--) {
|
|
66002
|
-
extend$1(path[i2], bbox2);
|
|
66003
|
-
}
|
|
66004
|
-
}
|
|
66005
|
-
_condense(path) {
|
|
66006
|
-
for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
|
|
66007
|
-
if (path[i2].children.length === 0) {
|
|
66008
|
-
if (i2 > 0) {
|
|
66009
|
-
siblings = path[i2 - 1].children;
|
|
66010
|
-
siblings.splice(siblings.indexOf(path[i2]), 1);
|
|
66011
|
-
} else this.clear();
|
|
66012
|
-
} else calcBBox(path[i2], this.toBBox);
|
|
66013
|
-
}
|
|
66014
|
-
}
|
|
66015
|
-
}
|
|
66016
|
-
function findItem(item, items, equalsFn) {
|
|
66017
|
-
if (!equalsFn) return items.indexOf(item);
|
|
66018
|
-
for (let i2 = 0; i2 < items.length; i2++) {
|
|
66019
|
-
if (equalsFn(item, items[i2])) return i2;
|
|
66020
|
-
}
|
|
66021
|
-
return -1;
|
|
66022
|
-
}
|
|
66023
|
-
function calcBBox(node, toBBox) {
|
|
66024
|
-
distBBox(node, 0, node.children.length, toBBox, node);
|
|
66025
|
-
}
|
|
66026
|
-
function distBBox(node, k, p, toBBox, destNode) {
|
|
66027
|
-
if (!destNode) destNode = createNode(null);
|
|
66028
|
-
destNode.minX = Infinity;
|
|
66029
|
-
destNode.minY = Infinity;
|
|
66030
|
-
destNode.maxX = -Infinity;
|
|
66031
|
-
destNode.maxY = -Infinity;
|
|
66032
|
-
for (let i2 = k; i2 < p; i2++) {
|
|
66033
|
-
const child = node.children[i2];
|
|
66034
|
-
extend$1(destNode, node.leaf ? toBBox(child) : child);
|
|
66035
|
-
}
|
|
66036
|
-
return destNode;
|
|
66037
|
-
}
|
|
66038
|
-
function extend$1(a2, b) {
|
|
66039
|
-
a2.minX = Math.min(a2.minX, b.minX);
|
|
66040
|
-
a2.minY = Math.min(a2.minY, b.minY);
|
|
66041
|
-
a2.maxX = Math.max(a2.maxX, b.maxX);
|
|
66042
|
-
a2.maxY = Math.max(a2.maxY, b.maxY);
|
|
66043
|
-
return a2;
|
|
66044
|
-
}
|
|
66045
|
-
function compareNodeMinX(a2, b) {
|
|
66046
|
-
return a2.minX - b.minX;
|
|
66047
|
-
}
|
|
66048
|
-
function compareNodeMinY(a2, b) {
|
|
66049
|
-
return a2.minY - b.minY;
|
|
66050
|
-
}
|
|
66051
|
-
function bboxArea(a2) {
|
|
66052
|
-
return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
|
|
66053
|
-
}
|
|
66054
|
-
function bboxMargin(a2) {
|
|
66055
|
-
return a2.maxX - a2.minX + (a2.maxY - a2.minY);
|
|
66056
|
-
}
|
|
66057
|
-
function enlargedArea(a2, b) {
|
|
66058
|
-
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));
|
|
66059
|
-
}
|
|
66060
|
-
function intersectionArea(a2, b) {
|
|
66061
|
-
const minX = Math.max(a2.minX, b.minX);
|
|
66062
|
-
const minY = Math.max(a2.minY, b.minY);
|
|
66063
|
-
const maxX = Math.min(a2.maxX, b.maxX);
|
|
66064
|
-
const maxY = Math.min(a2.maxY, b.maxY);
|
|
66065
|
-
return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
|
|
66066
|
-
}
|
|
66067
|
-
function contains$1(a2, b) {
|
|
66068
|
-
return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
|
|
66069
|
-
}
|
|
66070
|
-
function intersects(a2, b) {
|
|
66071
|
-
return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
|
|
66072
|
-
}
|
|
66073
|
-
function createNode(children) {
|
|
66074
|
-
return {
|
|
66075
|
-
children,
|
|
66076
|
-
height: 1,
|
|
66077
|
-
leaf: true,
|
|
66078
|
-
minX: Infinity,
|
|
66079
|
-
minY: Infinity,
|
|
66080
|
-
maxX: -Infinity,
|
|
66081
|
-
maxY: -Infinity
|
|
66082
|
-
};
|
|
66083
|
-
}
|
|
66084
|
-
function multiSelect(arr, left, right, n3, compare2) {
|
|
66085
|
-
const stack2 = [left, right];
|
|
66086
|
-
while (stack2.length) {
|
|
66087
|
-
right = stack2.pop();
|
|
66088
|
-
left = stack2.pop();
|
|
66089
|
-
if (right - left <= n3) continue;
|
|
66090
|
-
const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
|
|
66091
|
-
quickselect(arr, mid, left, right, compare2);
|
|
66092
|
-
stack2.push(left, mid, mid, right);
|
|
66093
|
-
}
|
|
66094
|
-
}
|
|
66095
|
-
function geojsonRbush(maxEntries) {
|
|
66096
|
-
var tree = new RBush(maxEntries);
|
|
66097
|
-
tree.insert = function(feature2) {
|
|
66098
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
66099
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
66100
|
-
return RBush.prototype.insert.call(this, feature2);
|
|
66101
|
-
};
|
|
66102
|
-
tree.load = function(features) {
|
|
66103
|
-
var load2 = [];
|
|
66104
|
-
if (Array.isArray(features)) {
|
|
66105
|
-
features.forEach(function(feature2) {
|
|
66106
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
66107
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
66108
|
-
load2.push(feature2);
|
|
66109
|
-
});
|
|
66110
|
-
} else {
|
|
66111
|
-
featureEach(features, function(feature2) {
|
|
66112
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
66113
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
66114
|
-
load2.push(feature2);
|
|
66115
|
-
});
|
|
66116
|
-
}
|
|
66117
|
-
return RBush.prototype.load.call(this, load2);
|
|
66118
|
-
};
|
|
66119
|
-
tree.remove = function(feature2, equals2) {
|
|
66120
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
66121
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
66122
|
-
return RBush.prototype.remove.call(this, feature2, equals2);
|
|
66123
|
-
};
|
|
66124
|
-
tree.clear = function() {
|
|
66125
|
-
return RBush.prototype.clear.call(this);
|
|
66126
|
-
};
|
|
66127
|
-
tree.search = function(geojson) {
|
|
66128
|
-
var features = RBush.prototype.search.call(this, this.toBBox(geojson));
|
|
66129
|
-
return featureCollection(features);
|
|
66130
|
-
};
|
|
66131
|
-
tree.collides = function(geojson) {
|
|
66132
|
-
return RBush.prototype.collides.call(this, this.toBBox(geojson));
|
|
66133
|
-
};
|
|
66134
|
-
tree.all = function() {
|
|
66135
|
-
var features = RBush.prototype.all.call(this);
|
|
66136
|
-
return featureCollection(features);
|
|
66137
|
-
};
|
|
66138
|
-
tree.toJSON = function() {
|
|
66139
|
-
return RBush.prototype.toJSON.call(this);
|
|
66140
|
-
};
|
|
66141
|
-
tree.fromJSON = function(json) {
|
|
66142
|
-
return RBush.prototype.fromJSON.call(this, json);
|
|
66143
|
-
};
|
|
66144
|
-
tree.toBBox = function(geojson) {
|
|
66145
|
-
var bbox2;
|
|
66146
|
-
if (geojson.bbox) bbox2 = geojson.bbox;
|
|
66147
|
-
else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
|
|
66148
|
-
else if (Array.isArray(geojson) && geojson.length === 6)
|
|
66149
|
-
bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
|
|
66150
|
-
else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
|
|
66151
|
-
else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
|
|
66152
|
-
else throw new Error("invalid geojson");
|
|
66153
|
-
return {
|
|
66154
|
-
minX: bbox2[0],
|
|
66155
|
-
minY: bbox2[1],
|
|
66156
|
-
maxX: bbox2[2],
|
|
66157
|
-
maxY: bbox2[3]
|
|
66158
|
-
};
|
|
66159
|
-
};
|
|
66160
|
-
return tree;
|
|
66161
|
-
}
|
|
66162
|
-
function lineSegment(geojson) {
|
|
66163
|
-
if (!geojson) {
|
|
66164
|
-
throw new Error("geojson is required");
|
|
66165
|
-
}
|
|
66166
|
-
const results = [];
|
|
66167
|
-
flattenEach(geojson, (feature2) => {
|
|
66168
|
-
lineSegmentFeature(feature2, results);
|
|
66169
|
-
});
|
|
66170
|
-
return featureCollection(results);
|
|
66171
|
-
}
|
|
66172
|
-
function lineSegmentFeature(geojson, results) {
|
|
66173
|
-
let coords = [];
|
|
66174
|
-
const geometry2 = geojson.geometry;
|
|
66175
|
-
if (geometry2 !== null) {
|
|
66176
|
-
switch (geometry2.type) {
|
|
66177
|
-
case "Polygon":
|
|
66178
|
-
coords = getCoords(geometry2);
|
|
66179
|
-
break;
|
|
66180
|
-
case "LineString":
|
|
66181
|
-
coords = [getCoords(geometry2)];
|
|
66182
|
-
}
|
|
66183
|
-
coords.forEach((coord) => {
|
|
66184
|
-
const segments = createSegments(coord, geojson.properties);
|
|
66185
|
-
segments.forEach((segment) => {
|
|
66186
|
-
segment.id = results.length;
|
|
66187
|
-
results.push(segment);
|
|
66188
|
-
});
|
|
66189
|
-
});
|
|
66190
|
-
}
|
|
66191
|
-
}
|
|
66192
|
-
function createSegments(coords, properties) {
|
|
66193
|
-
const segments = [];
|
|
66194
|
-
coords.reduce((previousCoords, currentCoords) => {
|
|
66195
|
-
const segment = lineString([previousCoords, currentCoords], properties);
|
|
66196
|
-
segment.bbox = bbox(previousCoords, currentCoords);
|
|
66197
|
-
segments.push(segment);
|
|
66198
|
-
return currentCoords;
|
|
66199
|
-
});
|
|
66200
|
-
return segments;
|
|
66201
|
-
}
|
|
66202
|
-
function bbox(coords1, coords2) {
|
|
66203
|
-
const x12 = coords1[0];
|
|
66204
|
-
const y12 = coords1[1];
|
|
66205
|
-
const x2 = coords2[0];
|
|
66206
|
-
const y2 = coords2[1];
|
|
66207
|
-
const west = x12 < x2 ? x12 : x2;
|
|
66208
|
-
const south = y12 < y2 ? y12 : y2;
|
|
66209
|
-
const east = x12 > x2 ? x12 : x2;
|
|
66210
|
-
const north = y12 > y2 ? y12 : y2;
|
|
66211
|
-
return [west, south, east, north];
|
|
66212
|
-
}
|
|
66213
|
-
function distance$1(from, to, options = {}) {
|
|
66214
|
-
var coordinates1 = getCoord(from);
|
|
66215
|
-
var coordinates2 = getCoord(to);
|
|
66216
|
-
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
66217
|
-
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
66218
|
-
var lat1 = degreesToRadians(coordinates1[1]);
|
|
66219
|
-
var lat2 = degreesToRadians(coordinates2[1]);
|
|
66220
|
-
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
66221
|
-
return radiansToLength(
|
|
66222
|
-
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
66223
|
-
options.units
|
|
66224
|
-
);
|
|
66225
|
-
}
|
|
66226
|
-
var __defProp$1 = Object.defineProperty;
|
|
66227
|
-
var __defProps = Object.defineProperties;
|
|
66228
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
66229
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
66230
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
66231
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
66232
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
66233
|
-
var __spreadValues = (a2, b) => {
|
|
66234
|
-
for (var prop in b || (b = {}))
|
|
66235
|
-
if (__hasOwnProp.call(b, prop))
|
|
66236
|
-
__defNormalProp(a2, prop, b[prop]);
|
|
66237
|
-
if (__getOwnPropSymbols)
|
|
66238
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
66239
|
-
if (__propIsEnum.call(b, prop))
|
|
66240
|
-
__defNormalProp(a2, prop, b[prop]);
|
|
66241
|
-
}
|
|
66242
|
-
return a2;
|
|
66243
|
-
};
|
|
66244
|
-
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
66245
|
-
function nearestPointOnLine(lines, pt, options = {}) {
|
|
66246
|
-
if (!lines || !pt) {
|
|
66247
|
-
throw new Error("lines and pt are required arguments");
|
|
66248
|
-
}
|
|
66249
|
-
const ptPos = getCoord(pt);
|
|
66250
|
-
let closestPt = point([Infinity, Infinity], {
|
|
66251
|
-
dist: Infinity,
|
|
66252
|
-
index: -1,
|
|
66253
|
-
multiFeatureIndex: -1,
|
|
66254
|
-
location: -1
|
|
66255
|
-
});
|
|
66256
|
-
let length2 = 0;
|
|
66257
|
-
flattenEach(
|
|
66258
|
-
lines,
|
|
66259
|
-
function(line, _featureIndex, multiFeatureIndex) {
|
|
66260
|
-
const coords = getCoords(line);
|
|
66261
|
-
for (let i2 = 0; i2 < coords.length - 1; i2++) {
|
|
66262
|
-
const start = point(coords[i2]);
|
|
66263
|
-
start.properties.dist = distance$1(pt, start, options);
|
|
66264
|
-
const startPos = getCoord(start);
|
|
66265
|
-
const stop = point(coords[i2 + 1]);
|
|
66266
|
-
stop.properties.dist = distance$1(pt, stop, options);
|
|
66267
|
-
const stopPos = getCoord(stop);
|
|
66268
|
-
const sectionLength = distance$1(start, stop, options);
|
|
66269
|
-
let intersectPos;
|
|
66270
|
-
let wasEnd;
|
|
66271
|
-
if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
|
|
66272
|
-
[intersectPos, , wasEnd] = [startPos, void 0, false];
|
|
66273
|
-
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
66274
|
-
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
66275
|
-
} else {
|
|
66276
|
-
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
66277
|
-
start.geometry.coordinates,
|
|
66278
|
-
stop.geometry.coordinates,
|
|
66279
|
-
getCoord(pt)
|
|
66280
|
-
);
|
|
66281
|
-
}
|
|
66282
|
-
let intersectPt;
|
|
66283
|
-
if (intersectPos) {
|
|
66284
|
-
intersectPt = point(intersectPos, {
|
|
66285
|
-
dist: distance$1(pt, intersectPos, options),
|
|
66286
|
-
multiFeatureIndex,
|
|
66287
|
-
location: length2 + distance$1(start, intersectPos, options)
|
|
66288
|
-
});
|
|
66289
|
-
}
|
|
66290
|
-
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
66291
|
-
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
66292
|
-
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
66293
|
-
// Legacy behaviour where index progresses to next segment # if we
|
|
66294
|
-
// went with the end point this iteration.
|
|
66295
|
-
index: wasEnd ? i2 + 1 : i2
|
|
66296
|
-
})
|
|
66297
|
-
});
|
|
66298
|
-
}
|
|
66299
|
-
length2 += sectionLength;
|
|
66300
|
-
}
|
|
66301
|
-
}
|
|
66302
|
-
);
|
|
66303
|
-
return closestPt;
|
|
66304
|
-
}
|
|
66305
|
-
function dot$1(v12, v2) {
|
|
66306
|
-
const [v1x, v1y, v1z] = v12;
|
|
66307
|
-
const [v2x, v2y, v2z] = v2;
|
|
66308
|
-
return v1x * v2x + v1y * v2y + v1z * v2z;
|
|
66309
|
-
}
|
|
66310
|
-
function cross(v12, v2) {
|
|
66311
|
-
const [v1x, v1y, v1z] = v12;
|
|
66312
|
-
const [v2x, v2y, v2z] = v2;
|
|
66313
|
-
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
66314
|
-
}
|
|
66315
|
-
function magnitude(v) {
|
|
66316
|
-
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
66317
|
-
}
|
|
66318
|
-
function angle$1(v12, v2) {
|
|
66319
|
-
const theta = dot$1(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
66320
|
-
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
66321
|
-
}
|
|
66322
|
-
function lngLatToVector(a2) {
|
|
66323
|
-
const lat = degreesToRadians(a2[1]);
|
|
66324
|
-
const lng = degreesToRadians(a2[0]);
|
|
66325
|
-
return [
|
|
66326
|
-
Math.cos(lat) * Math.cos(lng),
|
|
66327
|
-
Math.cos(lat) * Math.sin(lng),
|
|
66328
|
-
Math.sin(lat)
|
|
66329
|
-
];
|
|
66330
|
-
}
|
|
66331
|
-
function vectorToLngLat(v) {
|
|
66332
|
-
const [x, y, z] = v;
|
|
66333
|
-
const lat = radiansToDegrees(Math.asin(z));
|
|
66334
|
-
const lng = radiansToDegrees(Math.atan2(y, x));
|
|
66335
|
-
return [lng, lat];
|
|
66336
|
-
}
|
|
66337
|
-
function nearestPointOnSegment(posA, posB, posC) {
|
|
66338
|
-
const A2 = lngLatToVector(posA);
|
|
66339
|
-
const B2 = lngLatToVector(posB);
|
|
66340
|
-
const C3 = lngLatToVector(posC);
|
|
66341
|
-
const [Cx, Cy, Cz] = C3;
|
|
66342
|
-
const [D2, E2, F] = cross(A2, B2);
|
|
66343
|
-
const a2 = E2 * Cz - F * Cy;
|
|
66344
|
-
const b = F * Cx - D2 * Cz;
|
|
66345
|
-
const c = D2 * Cy - E2 * Cx;
|
|
66346
|
-
const f2 = c * E2 - b * F;
|
|
66347
|
-
const g2 = a2 * F - c * D2;
|
|
66348
|
-
const h = b * D2 - a2 * E2;
|
|
66349
|
-
const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
|
|
66350
|
-
const I1 = [f2 * t, g2 * t, h * t];
|
|
66351
|
-
const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
|
|
66352
|
-
const angleAB = angle$1(A2, B2);
|
|
66353
|
-
const angleAI1 = angle$1(A2, I1);
|
|
66354
|
-
const angleBI1 = angle$1(B2, I1);
|
|
66355
|
-
const angleAI2 = angle$1(A2, I2);
|
|
66356
|
-
const angleBI2 = angle$1(B2, I2);
|
|
66357
|
-
let I3;
|
|
66358
|
-
if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
|
|
66359
|
-
I3 = I1;
|
|
66360
|
-
} else {
|
|
66361
|
-
I3 = I2;
|
|
66362
|
-
}
|
|
66363
|
-
if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
|
|
66364
|
-
if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
66365
|
-
return [vectorToLngLat(A2), true, false];
|
|
66366
|
-
} else {
|
|
66367
|
-
return [vectorToLngLat(B2), false, true];
|
|
66368
|
-
}
|
|
66369
|
-
}
|
|
66370
|
-
return [vectorToLngLat(I3), false, false];
|
|
66371
|
-
}
|
|
66372
|
-
var fastDeepEqual;
|
|
66373
|
-
var hasRequiredFastDeepEqual;
|
|
66374
|
-
function requireFastDeepEqual() {
|
|
66375
|
-
if (hasRequiredFastDeepEqual) return fastDeepEqual;
|
|
66376
|
-
hasRequiredFastDeepEqual = 1;
|
|
66377
|
-
fastDeepEqual = function equal2(a2, b) {
|
|
66378
|
-
if (a2 === b) return true;
|
|
66379
|
-
if (a2 && b && typeof a2 == "object" && typeof b == "object") {
|
|
66380
|
-
if (a2.constructor !== b.constructor) return false;
|
|
66381
|
-
var length2, i2, keys2;
|
|
66382
|
-
if (Array.isArray(a2)) {
|
|
66383
|
-
length2 = a2.length;
|
|
66384
|
-
if (length2 != b.length) return false;
|
|
66385
|
-
for (i2 = length2; i2-- !== 0; )
|
|
66386
|
-
if (!equal2(a2[i2], b[i2])) return false;
|
|
66387
|
-
return true;
|
|
66388
|
-
}
|
|
66389
|
-
if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
|
|
66390
|
-
if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
|
|
66391
|
-
if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
|
|
66392
|
-
keys2 = Object.keys(a2);
|
|
66393
|
-
length2 = keys2.length;
|
|
66394
|
-
if (length2 !== Object.keys(b).length) return false;
|
|
66395
|
-
for (i2 = length2; i2-- !== 0; )
|
|
66396
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) return false;
|
|
66397
|
-
for (i2 = length2; i2-- !== 0; ) {
|
|
66398
|
-
var key = keys2[i2];
|
|
66399
|
-
if (!equal2(a2[key], b[key])) return false;
|
|
66400
|
-
}
|
|
66401
|
-
return true;
|
|
66402
|
-
}
|
|
66403
|
-
return a2 !== a2 && b !== b;
|
|
66404
|
-
};
|
|
66405
|
-
return fastDeepEqual;
|
|
66406
|
-
}
|
|
66407
|
-
var fastDeepEqualExports = requireFastDeepEqual();
|
|
66408
|
-
const equal$2 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
66409
|
-
function lineOverlap(line1, line2, options = {}) {
|
|
66410
|
-
options = options || {};
|
|
66411
|
-
if (!isObject$3(options)) throw new Error("options is invalid");
|
|
66412
|
-
var tolerance = options.tolerance || 0;
|
|
66413
|
-
var features = [];
|
|
66414
|
-
var tree = geojsonRbush();
|
|
66415
|
-
const line = lineSegment(line1);
|
|
66416
|
-
tree.load(line);
|
|
66417
|
-
var overlapSegment;
|
|
66418
|
-
let additionalSegments = [];
|
|
66419
|
-
segmentEach(line2, function(segment) {
|
|
66420
|
-
var doesOverlaps = false;
|
|
66421
|
-
if (!segment) {
|
|
66422
|
-
return;
|
|
66423
|
-
}
|
|
66424
|
-
featureEach(tree.search(segment), function(match) {
|
|
66425
|
-
if (doesOverlaps === false) {
|
|
66426
|
-
var coordsSegment = getCoords(segment).sort();
|
|
66427
|
-
var coordsMatch = getCoords(match).sort();
|
|
66428
|
-
if (equal$2(coordsSegment, coordsMatch)) {
|
|
66429
|
-
doesOverlaps = true;
|
|
66430
|
-
if (overlapSegment) {
|
|
66431
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
66432
|
-
} else overlapSegment = segment;
|
|
66433
|
-
} 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) {
|
|
66434
|
-
doesOverlaps = true;
|
|
66435
|
-
if (overlapSegment) {
|
|
66436
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
66437
|
-
} else overlapSegment = segment;
|
|
66438
|
-
} 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) {
|
|
66439
|
-
if (overlapSegment) {
|
|
66440
|
-
const combinedSegment = concatSegment(overlapSegment, match);
|
|
66441
|
-
if (combinedSegment) {
|
|
66442
|
-
overlapSegment = combinedSegment;
|
|
66443
|
-
} else {
|
|
66444
|
-
additionalSegments.push(match);
|
|
66445
|
-
}
|
|
66446
|
-
} else overlapSegment = match;
|
|
66447
|
-
}
|
|
66448
|
-
}
|
|
66449
|
-
});
|
|
66450
|
-
if (doesOverlaps === false && overlapSegment) {
|
|
66451
|
-
features.push(overlapSegment);
|
|
66452
|
-
if (additionalSegments.length) {
|
|
66453
|
-
features = features.concat(additionalSegments);
|
|
66454
|
-
additionalSegments = [];
|
|
66455
|
-
}
|
|
66456
|
-
overlapSegment = void 0;
|
|
66457
|
-
}
|
|
66458
|
-
});
|
|
66459
|
-
if (overlapSegment) features.push(overlapSegment);
|
|
66460
|
-
return featureCollection(features);
|
|
66461
|
-
}
|
|
66462
|
-
function concatSegment(line, segment) {
|
|
66463
|
-
var coords = getCoords(segment);
|
|
66464
|
-
var lineCoords = getCoords(line);
|
|
66465
|
-
var start = lineCoords[0];
|
|
66466
|
-
var end = lineCoords[lineCoords.length - 1];
|
|
66467
|
-
var geom = line.geometry.coordinates;
|
|
66468
|
-
if (equal$2(coords[0], start)) geom.unshift(coords[1]);
|
|
66469
|
-
else if (equal$2(coords[0], end)) geom.push(coords[1]);
|
|
66470
|
-
else if (equal$2(coords[1], start)) geom.unshift(coords[0]);
|
|
66471
|
-
else if (equal$2(coords[1], end)) geom.push(coords[0]);
|
|
66472
|
-
else return;
|
|
66473
|
-
return line;
|
|
66474
|
-
}
|
|
66475
|
-
class TinyQueue {
|
|
66476
|
-
constructor(data = [], compare2 = defaultCompare) {
|
|
66477
|
-
this.data = data;
|
|
66478
|
-
this.length = this.data.length;
|
|
66479
|
-
this.compare = compare2;
|
|
66480
|
-
if (this.length > 0) {
|
|
66481
|
-
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
66482
|
-
}
|
|
66483
|
-
}
|
|
66484
|
-
push(item) {
|
|
66485
|
-
this.data.push(item);
|
|
66486
|
-
this.length++;
|
|
66487
|
-
this._up(this.length - 1);
|
|
66488
|
-
}
|
|
66489
|
-
pop() {
|
|
66490
|
-
if (this.length === 0) return void 0;
|
|
66491
|
-
const top = this.data[0];
|
|
66492
|
-
const bottom = this.data.pop();
|
|
66493
|
-
this.length--;
|
|
66494
|
-
if (this.length > 0) {
|
|
66495
|
-
this.data[0] = bottom;
|
|
66496
|
-
this._down(0);
|
|
66497
|
-
}
|
|
66498
|
-
return top;
|
|
66499
|
-
}
|
|
66500
|
-
peek() {
|
|
66501
|
-
return this.data[0];
|
|
66502
|
-
}
|
|
66503
|
-
_up(pos) {
|
|
66504
|
-
const { data, compare: compare2 } = this;
|
|
66505
|
-
const item = data[pos];
|
|
66506
|
-
while (pos > 0) {
|
|
66507
|
-
const parent = pos - 1 >> 1;
|
|
66508
|
-
const current = data[parent];
|
|
66509
|
-
if (compare2(item, current) >= 0) break;
|
|
66510
|
-
data[pos] = current;
|
|
66511
|
-
pos = parent;
|
|
66512
|
-
}
|
|
66513
|
-
data[pos] = item;
|
|
66514
|
-
}
|
|
66515
|
-
_down(pos) {
|
|
66516
|
-
const { data, compare: compare2 } = this;
|
|
66517
|
-
const halfLength = this.length >> 1;
|
|
66518
|
-
const item = data[pos];
|
|
66519
|
-
while (pos < halfLength) {
|
|
66520
|
-
let left = (pos << 1) + 1;
|
|
66521
|
-
let best = data[left];
|
|
66522
|
-
const right = left + 1;
|
|
66523
|
-
if (right < this.length && compare2(data[right], best) < 0) {
|
|
66524
|
-
left = right;
|
|
66525
|
-
best = data[right];
|
|
66526
|
-
}
|
|
66527
|
-
if (compare2(best, item) >= 0) break;
|
|
66528
|
-
data[pos] = best;
|
|
66529
|
-
pos = left;
|
|
66530
|
-
}
|
|
66531
|
-
data[pos] = item;
|
|
66532
|
-
}
|
|
66533
|
-
}
|
|
66534
|
-
function defaultCompare(a2, b) {
|
|
66535
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
66536
|
-
}
|
|
66537
|
-
function checkWhichEventIsLeft(e1, e2) {
|
|
66538
|
-
if (e1.p.x > e2.p.x) return 1;
|
|
66539
|
-
if (e1.p.x < e2.p.x) return -1;
|
|
66540
|
-
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
66541
|
-
return 1;
|
|
66542
|
-
}
|
|
66543
|
-
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
66544
|
-
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
66545
|
-
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
66546
|
-
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
66547
|
-
return 1;
|
|
66548
|
-
}
|
|
66549
|
-
class Event {
|
|
66550
|
-
constructor(p, featureId2, ringId2, eventId2) {
|
|
66551
|
-
this.p = {
|
|
66552
|
-
x: p[0],
|
|
66553
|
-
y: p[1]
|
|
66554
|
-
};
|
|
66555
|
-
this.featureId = featureId2;
|
|
66556
|
-
this.ringId = ringId2;
|
|
66557
|
-
this.eventId = eventId2;
|
|
66558
|
-
this.otherEvent = null;
|
|
66559
|
-
this.isLeftEndpoint = null;
|
|
66560
|
-
}
|
|
66561
|
-
isSamePoint(eventToCheck) {
|
|
66562
|
-
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
66563
|
-
}
|
|
66564
|
-
}
|
|
66565
|
-
function fillEventQueue(geojson, eventQueue) {
|
|
66566
|
-
if (geojson.type === "FeatureCollection") {
|
|
66567
|
-
const features = geojson.features;
|
|
66568
|
-
for (let i2 = 0; i2 < features.length; i2++) {
|
|
66569
|
-
processFeature(features[i2], eventQueue);
|
|
66570
|
-
}
|
|
66571
|
-
} else {
|
|
66572
|
-
processFeature(geojson, eventQueue);
|
|
66573
|
-
}
|
|
66574
|
-
}
|
|
66575
|
-
let featureId = 0;
|
|
66576
|
-
let ringId = 0;
|
|
66577
|
-
let eventId = 0;
|
|
66578
|
-
function processFeature(featureOrGeometry, eventQueue) {
|
|
66579
|
-
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
66580
|
-
let coords = geom.coordinates;
|
|
66581
|
-
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
66582
|
-
if (geom.type === "LineString") coords = [[coords]];
|
|
66583
|
-
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
66584
|
-
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
66585
|
-
let currentP = coords[i2][ii][0];
|
|
66586
|
-
let nextP = null;
|
|
66587
|
-
ringId = ringId + 1;
|
|
66588
|
-
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
66589
|
-
nextP = coords[i2][ii][iii + 1];
|
|
66590
|
-
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
66591
|
-
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
66592
|
-
e1.otherEvent = e2;
|
|
66593
|
-
e2.otherEvent = e1;
|
|
66594
|
-
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
66595
|
-
e2.isLeftEndpoint = true;
|
|
66596
|
-
e1.isLeftEndpoint = false;
|
|
66597
|
-
} else {
|
|
66598
|
-
e1.isLeftEndpoint = true;
|
|
66599
|
-
e2.isLeftEndpoint = false;
|
|
66600
|
-
}
|
|
66601
|
-
eventQueue.push(e1);
|
|
66602
|
-
eventQueue.push(e2);
|
|
66603
|
-
currentP = nextP;
|
|
66604
|
-
eventId = eventId + 1;
|
|
66605
|
-
}
|
|
66606
|
-
}
|
|
66607
|
-
}
|
|
66608
|
-
featureId = featureId + 1;
|
|
66609
|
-
}
|
|
66610
|
-
let Segment$1 = class Segment {
|
|
66611
|
-
constructor(event) {
|
|
66612
|
-
this.leftSweepEvent = event;
|
|
66613
|
-
this.rightSweepEvent = event.otherEvent;
|
|
66614
|
-
}
|
|
66615
|
-
};
|
|
66616
|
-
function testSegmentIntersect(seg1, seg2) {
|
|
66617
|
-
if (seg1 === null || seg2 === null) return false;
|
|
66618
|
-
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;
|
|
66619
|
-
const x12 = seg1.leftSweepEvent.p.x;
|
|
66620
|
-
const y12 = seg1.leftSweepEvent.p.y;
|
|
66621
|
-
const x2 = seg1.rightSweepEvent.p.x;
|
|
66622
|
-
const y2 = seg1.rightSweepEvent.p.y;
|
|
66623
|
-
const x3 = seg2.leftSweepEvent.p.x;
|
|
66624
|
-
const y3 = seg2.leftSweepEvent.p.y;
|
|
66625
|
-
const x4 = seg2.rightSweepEvent.p.x;
|
|
66626
|
-
const y4 = seg2.rightSweepEvent.p.y;
|
|
66627
|
-
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
66628
|
-
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
66629
|
-
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
66630
|
-
if (denom === 0) {
|
|
66631
|
-
if (numeA === 0 && numeB === 0) return false;
|
|
66632
|
-
return false;
|
|
66633
|
-
}
|
|
66634
|
-
const uA = numeA / denom;
|
|
66635
|
-
const uB = numeB / denom;
|
|
66636
|
-
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
66637
|
-
const x = x12 + uA * (x2 - x12);
|
|
66638
|
-
const y = y12 + uA * (y2 - y12);
|
|
66639
|
-
return [x, y];
|
|
66640
|
-
}
|
|
66641
|
-
return false;
|
|
66642
|
-
}
|
|
66643
|
-
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
66644
|
-
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
66645
|
-
const intersectionPoints = [];
|
|
66646
|
-
const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
|
|
66647
|
-
while (eventQueue.length) {
|
|
66648
|
-
const event = eventQueue.pop();
|
|
66649
|
-
if (event.isLeftEndpoint) {
|
|
66650
|
-
const segment = new Segment$1(event);
|
|
66651
|
-
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
66652
|
-
const otherSeg = outQueue.data[i2];
|
|
66653
|
-
if (ignoreSelfIntersections) {
|
|
66654
|
-
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
66655
|
-
}
|
|
66656
|
-
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
66657
|
-
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
66658
|
-
}
|
|
66659
|
-
outQueue.push(segment);
|
|
66660
|
-
} else if (event.isLeftEndpoint === false) {
|
|
66661
|
-
outQueue.pop();
|
|
66662
|
-
}
|
|
66663
|
-
}
|
|
66664
|
-
return intersectionPoints;
|
|
66665
|
-
}
|
|
66666
|
-
function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
|
|
66667
|
-
const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
|
|
66668
|
-
fillEventQueue(geojson, eventQueue);
|
|
66669
|
-
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
66670
|
-
}
|
|
66671
|
-
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
66672
|
-
__proto__: null,
|
|
66673
|
-
default: sweeplineIntersections$1
|
|
66674
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
66675
|
-
var sweeplineIntersections = sweeplineIntersections$1;
|
|
66676
|
-
function lineIntersect(line1, line2, options = {}) {
|
|
66677
|
-
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
66678
|
-
let features = [];
|
|
66679
|
-
if (line1.type === "FeatureCollection")
|
|
66680
|
-
features = features.concat(line1.features);
|
|
66681
|
-
else if (line1.type === "Feature") features.push(line1);
|
|
66682
|
-
else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
|
|
66683
|
-
features.push(feature$1(line1));
|
|
66684
|
-
}
|
|
66685
|
-
if (line2.type === "FeatureCollection")
|
|
66686
|
-
features = features.concat(line2.features);
|
|
66687
|
-
else if (line2.type === "Feature") features.push(line2);
|
|
66688
|
-
else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
|
|
66689
|
-
features.push(feature$1(line2));
|
|
66690
|
-
}
|
|
66691
|
-
const intersections = sweeplineIntersections(
|
|
66692
|
-
featureCollection(features),
|
|
66693
|
-
ignoreSelfIntersections
|
|
66694
|
-
);
|
|
66695
|
-
let results = [];
|
|
66696
|
-
if (removeDuplicates) {
|
|
66697
|
-
const unique2 = {};
|
|
66698
|
-
intersections.forEach((intersection2) => {
|
|
66699
|
-
const key = intersection2.join(",");
|
|
66700
|
-
if (!unique2[key]) {
|
|
66701
|
-
unique2[key] = true;
|
|
66702
|
-
results.push(intersection2);
|
|
66703
|
-
}
|
|
66704
|
-
});
|
|
66705
|
-
} else {
|
|
66706
|
-
results = intersections;
|
|
66707
|
-
}
|
|
66708
|
-
return featureCollection(results.map((r2) => point(r2)));
|
|
66709
|
-
}
|
|
66710
|
-
var __defProp = Object.defineProperty;
|
|
66711
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
66712
|
-
var _GeojsonEquality = class _GeojsonEquality2 {
|
|
66713
|
-
constructor(opts) {
|
|
66714
|
-
this.direction = false;
|
|
66715
|
-
this.compareProperties = true;
|
|
66716
|
-
var _a2, _b, _c;
|
|
66717
|
-
this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
|
|
66718
|
-
this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
|
|
66719
|
-
this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
|
|
66720
|
-
}
|
|
66721
|
-
compare(g1, g2) {
|
|
66722
|
-
if (g1.type !== g2.type) {
|
|
66723
|
-
return false;
|
|
66724
|
-
}
|
|
66725
|
-
if (!sameLength(g1, g2)) {
|
|
66726
|
-
return false;
|
|
66727
|
-
}
|
|
66728
|
-
switch (g1.type) {
|
|
66729
|
-
case "Point":
|
|
66730
|
-
return this.compareCoord(g1.coordinates, g2.coordinates);
|
|
66731
|
-
case "LineString":
|
|
66732
|
-
return this.compareLine(g1.coordinates, g2.coordinates);
|
|
66733
|
-
case "Polygon":
|
|
66734
|
-
return this.comparePolygon(g1, g2);
|
|
66735
|
-
case "GeometryCollection":
|
|
66736
|
-
return this.compareGeometryCollection(g1, g2);
|
|
66737
|
-
case "Feature":
|
|
66738
|
-
return this.compareFeature(g1, g2);
|
|
66739
|
-
case "FeatureCollection":
|
|
66740
|
-
return this.compareFeatureCollection(g1, g2);
|
|
66741
|
-
default:
|
|
66742
|
-
if (g1.type.startsWith("Multi")) {
|
|
66743
|
-
const g1s = explode(g1);
|
|
66744
|
-
const g2s = explode(
|
|
66745
|
-
g2
|
|
66746
|
-
);
|
|
66747
|
-
return g1s.every(
|
|
66748
|
-
(g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
|
|
66749
|
-
);
|
|
66750
|
-
}
|
|
66751
|
-
}
|
|
66752
|
-
return false;
|
|
66753
|
-
}
|
|
66754
|
-
compareCoord(c1, c2) {
|
|
66755
|
-
return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
|
|
66756
|
-
}
|
|
66757
|
-
compareLine(path1, path2, ind = 0, isPoly = false) {
|
|
66758
|
-
if (!sameLength(path1, path2)) {
|
|
66759
|
-
return false;
|
|
66760
|
-
}
|
|
66761
|
-
const p1 = path1;
|
|
66762
|
-
let p2 = path2;
|
|
66763
|
-
if (isPoly && !this.compareCoord(p1[0], p2[0])) {
|
|
66764
|
-
const startIndex = this.fixStartIndex(p2, p1);
|
|
66765
|
-
if (!startIndex) {
|
|
66766
|
-
return false;
|
|
66767
|
-
} else {
|
|
66768
|
-
p2 = startIndex;
|
|
66769
|
-
}
|
|
66770
|
-
}
|
|
66771
|
-
const sameDirection = this.compareCoord(p1[ind], p2[ind]);
|
|
66772
|
-
if (this.direction || sameDirection) {
|
|
66773
|
-
return this.comparePath(p1, p2);
|
|
66774
|
-
} else {
|
|
66775
|
-
if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
|
|
66776
|
-
return this.comparePath(p1.slice().reverse(), p2);
|
|
66777
|
-
}
|
|
66778
|
-
return false;
|
|
66779
|
-
}
|
|
66780
|
-
}
|
|
66781
|
-
fixStartIndex(sourcePath, targetPath) {
|
|
66782
|
-
let correctPath, ind = -1;
|
|
66783
|
-
for (let i2 = 0; i2 < sourcePath.length; i2++) {
|
|
66784
|
-
if (this.compareCoord(sourcePath[i2], targetPath[0])) {
|
|
66785
|
-
ind = i2;
|
|
66786
|
-
break;
|
|
66787
|
-
}
|
|
66788
|
-
}
|
|
66789
|
-
if (ind >= 0) {
|
|
66790
|
-
correctPath = [].concat(
|
|
66791
|
-
sourcePath.slice(ind, sourcePath.length),
|
|
66792
|
-
sourcePath.slice(1, ind + 1)
|
|
66793
|
-
);
|
|
66794
|
-
}
|
|
66795
|
-
return correctPath;
|
|
66796
|
-
}
|
|
66797
|
-
comparePath(p1, p2) {
|
|
66798
|
-
return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
|
|
66799
|
-
}
|
|
66800
|
-
comparePolygon(g1, g2) {
|
|
66801
|
-
if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
|
|
66802
|
-
const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
|
|
66803
|
-
const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
|
|
66804
|
-
return holes1.every(
|
|
66805
|
-
(h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
|
|
66806
|
-
);
|
|
66807
|
-
}
|
|
66808
|
-
return false;
|
|
66809
|
-
}
|
|
66810
|
-
compareGeometryCollection(g1, g2) {
|
|
66811
|
-
return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
|
|
66812
|
-
}
|
|
66813
|
-
compareFeature(g1, g2) {
|
|
66814
|
-
return g1.id === g2.id && (this.compareProperties ? equal$1(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
|
|
66815
|
-
}
|
|
66816
|
-
compareFeatureCollection(g1, g2) {
|
|
66817
|
-
return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
|
|
66818
|
-
}
|
|
66819
|
-
compareBBox(g1, g2) {
|
|
66820
|
-
return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
|
|
66821
|
-
}
|
|
66822
|
-
};
|
|
66823
|
-
__name(_GeojsonEquality, "GeojsonEquality");
|
|
66824
|
-
var GeojsonEquality = _GeojsonEquality;
|
|
66825
|
-
function sameLength(g1, g2) {
|
|
66826
|
-
return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
|
|
66827
|
-
}
|
|
66828
|
-
__name(sameLength, "sameLength");
|
|
66829
|
-
function explode(g2) {
|
|
66830
|
-
return g2.coordinates.map((part) => ({
|
|
66831
|
-
type: g2.type.replace("Multi", ""),
|
|
66832
|
-
coordinates: part
|
|
66833
|
-
}));
|
|
66834
|
-
}
|
|
66835
|
-
__name(explode, "explode");
|
|
66836
|
-
function geojsonEquality(g1, g2, opts) {
|
|
66837
|
-
const eq2 = new GeojsonEquality(opts);
|
|
66838
|
-
return eq2.compare(g1, g2);
|
|
66839
|
-
}
|
|
66840
|
-
__name(geojsonEquality, "geojsonEquality");
|
|
66841
|
-
function equal$1(object1, object2) {
|
|
66842
|
-
if (object1 === null && object2 === null) {
|
|
66843
|
-
return true;
|
|
66844
|
-
}
|
|
66845
|
-
if (object1 === null || object2 === null) {
|
|
66846
|
-
return false;
|
|
66847
|
-
}
|
|
66848
|
-
const objKeys1 = Object.keys(object1);
|
|
66849
|
-
const objKeys2 = Object.keys(object2);
|
|
66850
|
-
if (objKeys1.length !== objKeys2.length) return false;
|
|
66851
|
-
for (var key of objKeys1) {
|
|
66852
|
-
const value1 = object1[key];
|
|
66853
|
-
const value2 = object2[key];
|
|
66854
|
-
const isObjects = isObject$2(value1) && isObject$2(value2);
|
|
66855
|
-
if (isObjects && !equal$1(value1, value2) || !isObjects && value1 !== value2) {
|
|
66856
|
-
return false;
|
|
66857
|
-
}
|
|
66858
|
-
}
|
|
66859
|
-
return true;
|
|
66860
|
-
}
|
|
66861
|
-
__name(equal$1, "equal");
|
|
66862
|
-
var isObject$2 = /* @__PURE__ */ __name((object2) => {
|
|
66863
|
-
return object2 != null && typeof object2 === "object";
|
|
66864
|
-
}, "isObject");
|
|
66865
|
-
function booleanOverlap(feature1, feature2) {
|
|
66866
|
-
const geom1 = getGeom(feature1);
|
|
66867
|
-
const geom2 = getGeom(feature2);
|
|
66868
|
-
const type1 = geom1.type;
|
|
66869
|
-
const type2 = geom2.type;
|
|
66870
|
-
if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
|
|
66871
|
-
throw new Error("features must be of the same type");
|
|
66872
|
-
}
|
|
66873
|
-
if (type1 === "Point") throw new Error("Point geometry not supported");
|
|
66874
|
-
if (geojsonEquality(feature1, feature2, { precision: 6 }))
|
|
66875
|
-
return false;
|
|
66876
|
-
let overlap = 0;
|
|
66877
|
-
switch (type1) {
|
|
66878
|
-
case "MultiPoint":
|
|
66879
|
-
for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
|
|
66880
|
-
for (var j = 0; j < geom2.coordinates.length; j++) {
|
|
66881
|
-
var coord1 = geom1.coordinates[i2];
|
|
66882
|
-
var coord2 = geom2.coordinates[j];
|
|
66883
|
-
if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
|
|
66884
|
-
return true;
|
|
66885
|
-
}
|
|
66886
|
-
}
|
|
66887
|
-
}
|
|
66888
|
-
return false;
|
|
66889
|
-
case "LineString":
|
|
66890
|
-
case "MultiLineString":
|
|
66891
|
-
segmentEach(feature1, (segment1) => {
|
|
66892
|
-
segmentEach(feature2, (segment2) => {
|
|
66893
|
-
if (lineOverlap(segment1, segment2).features.length) overlap++;
|
|
66894
|
-
});
|
|
66895
|
-
});
|
|
66896
|
-
break;
|
|
66897
|
-
case "Polygon":
|
|
66898
|
-
case "MultiPolygon":
|
|
66899
|
-
segmentEach(feature1, (segment1) => {
|
|
66900
|
-
segmentEach(feature2, (segment2) => {
|
|
66901
|
-
if (lineIntersect(segment1, segment2).features.length) overlap++;
|
|
66902
|
-
});
|
|
66903
|
-
});
|
|
66904
|
-
break;
|
|
66905
|
-
}
|
|
66906
|
-
return overlap > 0;
|
|
64893
|
+
function inBBox(pt, bbox) {
|
|
64894
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
66907
64895
|
}
|
|
66908
64896
|
var distEs6$2 = {};
|
|
66909
64897
|
var style$1 = {};
|
|
@@ -67000,7 +64988,7 @@ function requireCjs$f() {
|
|
|
67000
64988
|
case "Point":
|
|
67001
64989
|
return point2(coordinates2).geometry;
|
|
67002
64990
|
case "LineString":
|
|
67003
|
-
return
|
|
64991
|
+
return lineString(coordinates2).geometry;
|
|
67004
64992
|
case "Polygon":
|
|
67005
64993
|
return polygon2(coordinates2).geometry;
|
|
67006
64994
|
case "MultiPoint":
|
|
@@ -67070,7 +65058,7 @@ function requireCjs$f() {
|
|
|
67070
65058
|
options
|
|
67071
65059
|
);
|
|
67072
65060
|
}
|
|
67073
|
-
function
|
|
65061
|
+
function lineString(coordinates2, properties, options = {}) {
|
|
67074
65062
|
if (coordinates2.length < 2) {
|
|
67075
65063
|
throw new Error("coordinates must be an array of two or more positions");
|
|
67076
65064
|
}
|
|
@@ -67083,7 +65071,7 @@ function requireCjs$f() {
|
|
|
67083
65071
|
function lineStrings(coordinates2, properties, options = {}) {
|
|
67084
65072
|
return featureCollection2(
|
|
67085
65073
|
coordinates2.map((coords) => {
|
|
67086
|
-
return
|
|
65074
|
+
return lineString(coords, properties);
|
|
67087
65075
|
}),
|
|
67088
65076
|
options
|
|
67089
65077
|
);
|
|
@@ -67149,7 +65137,7 @@ function requireCjs$f() {
|
|
|
67149
65137
|
return distance2 / factor;
|
|
67150
65138
|
}
|
|
67151
65139
|
function lengthToDegrees(distance2, units) {
|
|
67152
|
-
return
|
|
65140
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
67153
65141
|
}
|
|
67154
65142
|
function bearingToAzimuth(bearing) {
|
|
67155
65143
|
let angle2 = bearing % 360;
|
|
@@ -67167,7 +65155,7 @@ function requireCjs$f() {
|
|
|
67167
65155
|
}
|
|
67168
65156
|
return angle2;
|
|
67169
65157
|
}
|
|
67170
|
-
function
|
|
65158
|
+
function radiansToDegrees(radians2) {
|
|
67171
65159
|
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
67172
65160
|
return normalisedRadians * 180 / Math.PI;
|
|
67173
65161
|
}
|
|
@@ -67201,17 +65189,17 @@ function requireCjs$f() {
|
|
|
67201
65189
|
function isObject2(input) {
|
|
67202
65190
|
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
67203
65191
|
}
|
|
67204
|
-
function validateBBox(
|
|
67205
|
-
if (!
|
|
65192
|
+
function validateBBox(bbox) {
|
|
65193
|
+
if (!bbox) {
|
|
67206
65194
|
throw new Error("bbox is required");
|
|
67207
65195
|
}
|
|
67208
|
-
if (!Array.isArray(
|
|
65196
|
+
if (!Array.isArray(bbox)) {
|
|
67209
65197
|
throw new Error("bbox must be an Array");
|
|
67210
65198
|
}
|
|
67211
|
-
if (
|
|
65199
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
67212
65200
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
67213
65201
|
}
|
|
67214
|
-
|
|
65202
|
+
bbox.forEach((num) => {
|
|
67215
65203
|
if (!isNumber2(num)) {
|
|
67216
65204
|
throw new Error("bbox must only contain numbers");
|
|
67217
65205
|
}
|
|
@@ -67241,7 +65229,7 @@ function requireCjs$f() {
|
|
|
67241
65229
|
cjs$f.isObject = isObject2;
|
|
67242
65230
|
cjs$f.lengthToDegrees = lengthToDegrees;
|
|
67243
65231
|
cjs$f.lengthToRadians = lengthToRadians;
|
|
67244
|
-
cjs$f.lineString =
|
|
65232
|
+
cjs$f.lineString = lineString;
|
|
67245
65233
|
cjs$f.lineStrings = lineStrings;
|
|
67246
65234
|
cjs$f.multiLineString = multiLineString;
|
|
67247
65235
|
cjs$f.multiPoint = multiPoint;
|
|
@@ -67250,7 +65238,7 @@ function requireCjs$f() {
|
|
|
67250
65238
|
cjs$f.points = points;
|
|
67251
65239
|
cjs$f.polygon = polygon2;
|
|
67252
65240
|
cjs$f.polygons = polygons2;
|
|
67253
|
-
cjs$f.radiansToDegrees =
|
|
65241
|
+
cjs$f.radiansToDegrees = radiansToDegrees;
|
|
67254
65242
|
cjs$f.radiansToLength = radiansToLength2;
|
|
67255
65243
|
cjs$f.round = round2;
|
|
67256
65244
|
cjs$f.validateBBox = validateBBox;
|
|
@@ -67265,7 +65253,7 @@ function requireCjs$e() {
|
|
|
67265
65253
|
hasRequiredCjs$e = 1;
|
|
67266
65254
|
Object.defineProperty(cjs$d, "__esModule", { value: true });
|
|
67267
65255
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
67268
|
-
function
|
|
65256
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
67269
65257
|
if (geojson === null) return;
|
|
67270
65258
|
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;
|
|
67271
65259
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -67352,7 +65340,7 @@ function requireCjs$e() {
|
|
|
67352
65340
|
break;
|
|
67353
65341
|
case "GeometryCollection":
|
|
67354
65342
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
67355
|
-
if (
|
|
65343
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
67356
65344
|
return false;
|
|
67357
65345
|
break;
|
|
67358
65346
|
default:
|
|
@@ -67363,7 +65351,7 @@ function requireCjs$e() {
|
|
|
67363
65351
|
}
|
|
67364
65352
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
67365
65353
|
var previousValue = initialValue;
|
|
67366
|
-
|
|
65354
|
+
coordEach(
|
|
67367
65355
|
geojson,
|
|
67368
65356
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
67369
65357
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -67405,7 +65393,7 @@ function requireCjs$e() {
|
|
|
67405
65393
|
});
|
|
67406
65394
|
return previousValue;
|
|
67407
65395
|
}
|
|
67408
|
-
function
|
|
65396
|
+
function featureEach(geojson, callback) {
|
|
67409
65397
|
if (geojson.type === "Feature") {
|
|
67410
65398
|
callback(geojson, 0);
|
|
67411
65399
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -67416,7 +65404,7 @@ function requireCjs$e() {
|
|
|
67416
65404
|
}
|
|
67417
65405
|
function featureReduce(geojson, callback, initialValue) {
|
|
67418
65406
|
var previousValue = initialValue;
|
|
67419
|
-
|
|
65407
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
67420
65408
|
if (featureIndex === 0 && initialValue === void 0)
|
|
67421
65409
|
previousValue = currentFeature;
|
|
67422
65410
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -67425,7 +65413,7 @@ function requireCjs$e() {
|
|
|
67425
65413
|
}
|
|
67426
65414
|
function coordAll(geojson) {
|
|
67427
65415
|
var coords = [];
|
|
67428
|
-
|
|
65416
|
+
coordEach(geojson, function(coord) {
|
|
67429
65417
|
coords.push(coord);
|
|
67430
65418
|
});
|
|
67431
65419
|
return coords;
|
|
@@ -67510,7 +65498,7 @@ function requireCjs$e() {
|
|
|
67510
65498
|
return previousValue;
|
|
67511
65499
|
}
|
|
67512
65500
|
function flattenEach2(geojson, callback) {
|
|
67513
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
65501
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
67514
65502
|
var type = geometry2 === null ? null : geometry2.type;
|
|
67515
65503
|
switch (type) {
|
|
67516
65504
|
case null:
|
|
@@ -67518,7 +65506,7 @@ function requireCjs$e() {
|
|
|
67518
65506
|
case "LineString":
|
|
67519
65507
|
case "Polygon":
|
|
67520
65508
|
if (callback(
|
|
67521
|
-
_helpers.feature.call(void 0, geometry2, properties, { bbox
|
|
65509
|
+
_helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
|
|
67522
65510
|
featureIndex,
|
|
67523
65511
|
0
|
|
67524
65512
|
) === false)
|
|
@@ -67566,7 +65554,7 @@ function requireCjs$e() {
|
|
|
67566
65554
|
);
|
|
67567
65555
|
return previousValue;
|
|
67568
65556
|
}
|
|
67569
|
-
function
|
|
65557
|
+
function segmentEach(geojson, callback) {
|
|
67570
65558
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
67571
65559
|
var segmentIndex = 0;
|
|
67572
65560
|
if (!feature2.geometry) return;
|
|
@@ -67576,7 +65564,7 @@ function requireCjs$e() {
|
|
|
67576
65564
|
var previousFeatureIndex = 0;
|
|
67577
65565
|
var previousMultiIndex = 0;
|
|
67578
65566
|
var prevGeomIndex = 0;
|
|
67579
|
-
if (
|
|
65567
|
+
if (coordEach(
|
|
67580
65568
|
feature2,
|
|
67581
65569
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
67582
65570
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -67610,7 +65598,7 @@ function requireCjs$e() {
|
|
|
67610
65598
|
function segmentReduce(geojson, callback, initialValue) {
|
|
67611
65599
|
var previousValue = initialValue;
|
|
67612
65600
|
var started = false;
|
|
67613
|
-
|
|
65601
|
+
segmentEach(
|
|
67614
65602
|
geojson,
|
|
67615
65603
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
67616
65604
|
if (started === false && initialValue === void 0)
|
|
@@ -67837,9 +65825,9 @@ function requireCjs$e() {
|
|
|
67837
65825
|
throw new Error("geojson is invalid");
|
|
67838
65826
|
}
|
|
67839
65827
|
cjs$d.coordAll = coordAll;
|
|
67840
|
-
cjs$d.coordEach =
|
|
65828
|
+
cjs$d.coordEach = coordEach;
|
|
67841
65829
|
cjs$d.coordReduce = coordReduce;
|
|
67842
|
-
cjs$d.featureEach =
|
|
65830
|
+
cjs$d.featureEach = featureEach;
|
|
67843
65831
|
cjs$d.featureReduce = featureReduce;
|
|
67844
65832
|
cjs$d.findPoint = findPoint;
|
|
67845
65833
|
cjs$d.findSegment = findSegment;
|
|
@@ -67851,7 +65839,7 @@ function requireCjs$e() {
|
|
|
67851
65839
|
cjs$d.lineReduce = lineReduce;
|
|
67852
65840
|
cjs$d.propEach = propEach;
|
|
67853
65841
|
cjs$d.propReduce = propReduce;
|
|
67854
|
-
cjs$d.segmentEach =
|
|
65842
|
+
cjs$d.segmentEach = segmentEach;
|
|
67855
65843
|
cjs$d.segmentReduce = segmentReduce;
|
|
67856
65844
|
return cjs$d;
|
|
67857
65845
|
}
|
|
@@ -67861,7 +65849,7 @@ function requireCjs$d() {
|
|
|
67861
65849
|
hasRequiredCjs$d = 1;
|
|
67862
65850
|
Object.defineProperty(cjs$e, "__esModule", { value: true });
|
|
67863
65851
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
67864
|
-
function
|
|
65852
|
+
function bbox(geojson, options = {}) {
|
|
67865
65853
|
if (geojson.bbox != null && true !== options.recompute) {
|
|
67866
65854
|
return geojson.bbox;
|
|
67867
65855
|
}
|
|
@@ -67882,8 +65870,8 @@ function requireCjs$d() {
|
|
|
67882
65870
|
});
|
|
67883
65871
|
return result;
|
|
67884
65872
|
}
|
|
67885
|
-
var turf_bbox_default =
|
|
67886
|
-
cjs$e.bbox =
|
|
65873
|
+
var turf_bbox_default = bbox;
|
|
65874
|
+
cjs$e.bbox = bbox;
|
|
67887
65875
|
cjs$e.default = turf_bbox_default;
|
|
67888
65876
|
return cjs$e;
|
|
67889
65877
|
}
|
|
@@ -67967,7 +65955,7 @@ function requireJs$p() {
|
|
|
67967
65955
|
case "Point":
|
|
67968
65956
|
return point2(coordinates2).geometry;
|
|
67969
65957
|
case "LineString":
|
|
67970
|
-
return
|
|
65958
|
+
return lineString(coordinates2).geometry;
|
|
67971
65959
|
case "Polygon":
|
|
67972
65960
|
return polygon2(coordinates2).geometry;
|
|
67973
65961
|
case "MultiPoint":
|
|
@@ -68044,7 +66032,7 @@ function requireJs$p() {
|
|
|
68044
66032
|
}), options);
|
|
68045
66033
|
}
|
|
68046
66034
|
exports2.polygons = polygons2;
|
|
68047
|
-
function
|
|
66035
|
+
function lineString(coordinates2, properties, options) {
|
|
68048
66036
|
if (options === void 0) {
|
|
68049
66037
|
options = {};
|
|
68050
66038
|
}
|
|
@@ -68057,13 +66045,13 @@ function requireJs$p() {
|
|
|
68057
66045
|
};
|
|
68058
66046
|
return feature2(geom, properties, options);
|
|
68059
66047
|
}
|
|
68060
|
-
exports2.lineString =
|
|
66048
|
+
exports2.lineString = lineString;
|
|
68061
66049
|
function lineStrings(coordinates2, properties, options) {
|
|
68062
66050
|
if (options === void 0) {
|
|
68063
66051
|
options = {};
|
|
68064
66052
|
}
|
|
68065
66053
|
return featureCollection2(coordinates2.map(function(coords) {
|
|
68066
|
-
return
|
|
66054
|
+
return lineString(coords, properties);
|
|
68067
66055
|
}), options);
|
|
68068
66056
|
}
|
|
68069
66057
|
exports2.lineStrings = lineStrings;
|
|
@@ -68160,7 +66148,7 @@ function requireJs$p() {
|
|
|
68160
66148
|
}
|
|
68161
66149
|
exports2.lengthToRadians = lengthToRadians;
|
|
68162
66150
|
function lengthToDegrees(distance2, units) {
|
|
68163
|
-
return
|
|
66151
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
68164
66152
|
}
|
|
68165
66153
|
exports2.lengthToDegrees = lengthToDegrees;
|
|
68166
66154
|
function bearingToAzimuth(bearing) {
|
|
@@ -68171,11 +66159,11 @@ function requireJs$p() {
|
|
|
68171
66159
|
return angle2;
|
|
68172
66160
|
}
|
|
68173
66161
|
exports2.bearingToAzimuth = bearingToAzimuth;
|
|
68174
|
-
function
|
|
66162
|
+
function radiansToDegrees(radians2) {
|
|
68175
66163
|
var degrees2 = radians2 % (2 * Math.PI);
|
|
68176
66164
|
return degrees2 * 180 / Math.PI;
|
|
68177
66165
|
}
|
|
68178
|
-
exports2.radiansToDegrees =
|
|
66166
|
+
exports2.radiansToDegrees = radiansToDegrees;
|
|
68179
66167
|
function degreesToRadians2(degrees2) {
|
|
68180
66168
|
var radians2 = degrees2 % 360;
|
|
68181
66169
|
return radians2 * Math.PI / 180;
|
|
@@ -68223,17 +66211,17 @@ function requireJs$p() {
|
|
|
68223
66211
|
return !!input && input.constructor === Object;
|
|
68224
66212
|
}
|
|
68225
66213
|
exports2.isObject = isObject2;
|
|
68226
|
-
function validateBBox(
|
|
68227
|
-
if (!
|
|
66214
|
+
function validateBBox(bbox) {
|
|
66215
|
+
if (!bbox) {
|
|
68228
66216
|
throw new Error("bbox is required");
|
|
68229
66217
|
}
|
|
68230
|
-
if (!Array.isArray(
|
|
66218
|
+
if (!Array.isArray(bbox)) {
|
|
68231
66219
|
throw new Error("bbox must be an Array");
|
|
68232
66220
|
}
|
|
68233
|
-
if (
|
|
66221
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
68234
66222
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
68235
66223
|
}
|
|
68236
|
-
|
|
66224
|
+
bbox.forEach(function(num) {
|
|
68237
66225
|
if (!isNumber2(num)) {
|
|
68238
66226
|
throw new Error("bbox must only contain numbers");
|
|
68239
66227
|
}
|
|
@@ -68258,22 +66246,22 @@ function requireJs$o() {
|
|
|
68258
66246
|
hasRequiredJs$o = 1;
|
|
68259
66247
|
Object.defineProperty(js$p, "__esModule", { value: true });
|
|
68260
66248
|
var helpers_1 = /* @__PURE__ */ requireJs$p();
|
|
68261
|
-
function bboxPolygon(
|
|
66249
|
+
function bboxPolygon(bbox, options) {
|
|
68262
66250
|
if (options === void 0) {
|
|
68263
66251
|
options = {};
|
|
68264
66252
|
}
|
|
68265
|
-
var west = Number(
|
|
68266
|
-
var south = Number(
|
|
68267
|
-
var east = Number(
|
|
68268
|
-
var north = Number(
|
|
68269
|
-
if (
|
|
66253
|
+
var west = Number(bbox[0]);
|
|
66254
|
+
var south = Number(bbox[1]);
|
|
66255
|
+
var east = Number(bbox[2]);
|
|
66256
|
+
var north = Number(bbox[3]);
|
|
66257
|
+
if (bbox.length === 6) {
|
|
68270
66258
|
throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
68271
66259
|
}
|
|
68272
66260
|
var lowLeft = [west, south];
|
|
68273
66261
|
var topLeft = [west, north];
|
|
68274
66262
|
var topRight = [east, north];
|
|
68275
66263
|
var lowRight = [east, south];
|
|
68276
|
-
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox
|
|
66264
|
+
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
|
|
68277
66265
|
}
|
|
68278
66266
|
js$p.default = bboxPolygon;
|
|
68279
66267
|
return js$p;
|
|
@@ -68288,7 +66276,7 @@ function requireJs$n() {
|
|
|
68288
66276
|
hasRequiredJs$n = 1;
|
|
68289
66277
|
Object.defineProperty(js$k, "__esModule", { value: true });
|
|
68290
66278
|
var helpers = /* @__PURE__ */ requireJs$p();
|
|
68291
|
-
function
|
|
66279
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
68292
66280
|
if (geojson === null) return;
|
|
68293
66281
|
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;
|
|
68294
66282
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -68375,7 +66363,7 @@ function requireJs$n() {
|
|
|
68375
66363
|
break;
|
|
68376
66364
|
case "GeometryCollection":
|
|
68377
66365
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
68378
|
-
if (
|
|
66366
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
68379
66367
|
return false;
|
|
68380
66368
|
break;
|
|
68381
66369
|
default:
|
|
@@ -68386,7 +66374,7 @@ function requireJs$n() {
|
|
|
68386
66374
|
}
|
|
68387
66375
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
68388
66376
|
var previousValue = initialValue;
|
|
68389
|
-
|
|
66377
|
+
coordEach(
|
|
68390
66378
|
geojson,
|
|
68391
66379
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
68392
66380
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -68428,7 +66416,7 @@ function requireJs$n() {
|
|
|
68428
66416
|
});
|
|
68429
66417
|
return previousValue;
|
|
68430
66418
|
}
|
|
68431
|
-
function
|
|
66419
|
+
function featureEach(geojson, callback) {
|
|
68432
66420
|
if (geojson.type === "Feature") {
|
|
68433
66421
|
callback(geojson, 0);
|
|
68434
66422
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -68439,7 +66427,7 @@ function requireJs$n() {
|
|
|
68439
66427
|
}
|
|
68440
66428
|
function featureReduce(geojson, callback, initialValue) {
|
|
68441
66429
|
var previousValue = initialValue;
|
|
68442
|
-
|
|
66430
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
68443
66431
|
if (featureIndex === 0 && initialValue === void 0)
|
|
68444
66432
|
previousValue = currentFeature;
|
|
68445
66433
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -68448,7 +66436,7 @@ function requireJs$n() {
|
|
|
68448
66436
|
}
|
|
68449
66437
|
function coordAll(geojson) {
|
|
68450
66438
|
var coords = [];
|
|
68451
|
-
|
|
66439
|
+
coordEach(geojson, function(coord) {
|
|
68452
66440
|
coords.push(coord);
|
|
68453
66441
|
});
|
|
68454
66442
|
return coords;
|
|
@@ -68533,7 +66521,7 @@ function requireJs$n() {
|
|
|
68533
66521
|
return previousValue;
|
|
68534
66522
|
}
|
|
68535
66523
|
function flattenEach2(geojson, callback) {
|
|
68536
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
66524
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
68537
66525
|
var type = geometry2 === null ? null : geometry2.type;
|
|
68538
66526
|
switch (type) {
|
|
68539
66527
|
case null:
|
|
@@ -68541,7 +66529,7 @@ function requireJs$n() {
|
|
|
68541
66529
|
case "LineString":
|
|
68542
66530
|
case "Polygon":
|
|
68543
66531
|
if (callback(
|
|
68544
|
-
helpers.feature(geometry2, properties, { bbox
|
|
66532
|
+
helpers.feature(geometry2, properties, { bbox, id }),
|
|
68545
66533
|
featureIndex,
|
|
68546
66534
|
0
|
|
68547
66535
|
) === false)
|
|
@@ -68589,7 +66577,7 @@ function requireJs$n() {
|
|
|
68589
66577
|
);
|
|
68590
66578
|
return previousValue;
|
|
68591
66579
|
}
|
|
68592
|
-
function
|
|
66580
|
+
function segmentEach(geojson, callback) {
|
|
68593
66581
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
68594
66582
|
var segmentIndex = 0;
|
|
68595
66583
|
if (!feature2.geometry) return;
|
|
@@ -68599,7 +66587,7 @@ function requireJs$n() {
|
|
|
68599
66587
|
var previousFeatureIndex = 0;
|
|
68600
66588
|
var previousMultiIndex = 0;
|
|
68601
66589
|
var prevGeomIndex = 0;
|
|
68602
|
-
if (
|
|
66590
|
+
if (coordEach(
|
|
68603
66591
|
feature2,
|
|
68604
66592
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
68605
66593
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -68632,7 +66620,7 @@ function requireJs$n() {
|
|
|
68632
66620
|
function segmentReduce(geojson, callback, initialValue) {
|
|
68633
66621
|
var previousValue = initialValue;
|
|
68634
66622
|
var started = false;
|
|
68635
|
-
|
|
66623
|
+
segmentEach(
|
|
68636
66624
|
geojson,
|
|
68637
66625
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
68638
66626
|
if (started === false && initialValue === void 0)
|
|
@@ -68854,9 +66842,9 @@ function requireJs$n() {
|
|
|
68854
66842
|
throw new Error("geojson is invalid");
|
|
68855
66843
|
}
|
|
68856
66844
|
js$k.coordAll = coordAll;
|
|
68857
|
-
js$k.coordEach =
|
|
66845
|
+
js$k.coordEach = coordEach;
|
|
68858
66846
|
js$k.coordReduce = coordReduce;
|
|
68859
|
-
js$k.featureEach =
|
|
66847
|
+
js$k.featureEach = featureEach;
|
|
68860
66848
|
js$k.featureReduce = featureReduce;
|
|
68861
66849
|
js$k.findPoint = findPoint;
|
|
68862
66850
|
js$k.findSegment = findSegment;
|
|
@@ -68868,7 +66856,7 @@ function requireJs$n() {
|
|
|
68868
66856
|
js$k.lineReduce = lineReduce;
|
|
68869
66857
|
js$k.propEach = propEach;
|
|
68870
66858
|
js$k.propReduce = propReduce;
|
|
68871
|
-
js$k.segmentEach =
|
|
66859
|
+
js$k.segmentEach = segmentEach;
|
|
68872
66860
|
js$k.segmentReduce = segmentReduce;
|
|
68873
66861
|
return js$k;
|
|
68874
66862
|
}
|
|
@@ -68878,7 +66866,7 @@ function requireJs$m() {
|
|
|
68878
66866
|
hasRequiredJs$m = 1;
|
|
68879
66867
|
Object.defineProperty(js$l, "__esModule", { value: true });
|
|
68880
66868
|
var meta_1 = /* @__PURE__ */ requireJs$n();
|
|
68881
|
-
function
|
|
66869
|
+
function bbox(geojson) {
|
|
68882
66870
|
var result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
68883
66871
|
meta_1.coordEach(geojson, function(coord) {
|
|
68884
66872
|
if (result[0] > coord[0]) {
|
|
@@ -68896,8 +66884,8 @@ function requireJs$m() {
|
|
|
68896
66884
|
});
|
|
68897
66885
|
return result;
|
|
68898
66886
|
}
|
|
68899
|
-
|
|
68900
|
-
js$l.default =
|
|
66887
|
+
bbox["default"] = bbox;
|
|
66888
|
+
js$l.default = bbox;
|
|
68901
66889
|
return js$l;
|
|
68902
66890
|
}
|
|
68903
66891
|
var hasRequiredJs$l;
|
|
@@ -79128,7 +77116,7 @@ function length$1(object2) {
|
|
|
79128
77116
|
return +lengthSum$1;
|
|
79129
77117
|
}
|
|
79130
77118
|
var coordinates = [null, null], object = { type: "LineString", coordinates };
|
|
79131
|
-
function distance(a2, b) {
|
|
77119
|
+
function distance$1(a2, b) {
|
|
79132
77120
|
coordinates[0] = a2;
|
|
79133
77121
|
coordinates[1] = b;
|
|
79134
77122
|
return length$1(object);
|
|
@@ -79181,10 +77169,10 @@ function containsGeometry(geometry2, point2) {
|
|
|
79181
77169
|
return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
|
|
79182
77170
|
}
|
|
79183
77171
|
function containsPoint(coordinates2, point2) {
|
|
79184
|
-
return distance(coordinates2, point2) === 0;
|
|
77172
|
+
return distance$1(coordinates2, point2) === 0;
|
|
79185
77173
|
}
|
|
79186
77174
|
function containsLine(coordinates2, point2) {
|
|
79187
|
-
var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
|
|
77175
|
+
var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
|
|
79188
77176
|
return ao + ob <= ab + epsilon;
|
|
79189
77177
|
}
|
|
79190
77178
|
function containsPolygon(coordinates2, point2) {
|
|
@@ -80401,7 +78389,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
80401
78389
|
geoConicEquidistant: conicEquidistant,
|
|
80402
78390
|
geoConicEquidistantRaw: conicEquidistantRaw,
|
|
80403
78391
|
geoContains: contains,
|
|
80404
|
-
geoDistance: distance,
|
|
78392
|
+
geoDistance: distance$1,
|
|
80405
78393
|
geoEquirectangular: equirectangular,
|
|
80406
78394
|
geoEquirectangularRaw: equirectangularRaw,
|
|
80407
78395
|
geoGnomonic: gnomonic,
|
|
@@ -81101,8 +79089,8 @@ function requirePolygonClipping_umd() {
|
|
|
81101
79089
|
sort(keys2, values2, left, j, compare2);
|
|
81102
79090
|
sort(keys2, values2, j + 1, right, compare2);
|
|
81103
79091
|
}
|
|
81104
|
-
var isInBbox2 = function isInBbox3(
|
|
81105
|
-
return
|
|
79092
|
+
var isInBbox2 = function isInBbox3(bbox, point2) {
|
|
79093
|
+
return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
|
|
81106
79094
|
};
|
|
81107
79095
|
var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
|
|
81108
79096
|
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;
|
|
@@ -81482,7 +79470,7 @@ function requirePolygonClipping_umd() {
|
|
|
81482
79470
|
}
|
|
81483
79471
|
}, {
|
|
81484
79472
|
key: "bbox",
|
|
81485
|
-
value: function
|
|
79473
|
+
value: function bbox() {
|
|
81486
79474
|
var y12 = this.leftSE.point.y;
|
|
81487
79475
|
var y2 = this.rightSE.point.y;
|
|
81488
79476
|
return {
|
|
@@ -82419,7 +80407,7 @@ function requireJs$j() {
|
|
|
82419
80407
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
82420
80408
|
}
|
|
82421
80409
|
js$i.getCoord = getCoord2;
|
|
82422
|
-
function
|
|
80410
|
+
function getCoords(coords) {
|
|
82423
80411
|
if (Array.isArray(coords)) {
|
|
82424
80412
|
return coords;
|
|
82425
80413
|
}
|
|
@@ -82434,7 +80422,7 @@ function requireJs$j() {
|
|
|
82434
80422
|
}
|
|
82435
80423
|
throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
|
|
82436
80424
|
}
|
|
82437
|
-
js$i.getCoords =
|
|
80425
|
+
js$i.getCoords = getCoords;
|
|
82438
80426
|
function containsNumber(coordinates2) {
|
|
82439
80427
|
if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
|
|
82440
80428
|
return true;
|
|
@@ -82564,7 +80552,7 @@ function requireCjs$c() {
|
|
|
82564
80552
|
}
|
|
82565
80553
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
82566
80554
|
}
|
|
82567
|
-
function
|
|
80555
|
+
function getCoords(coords) {
|
|
82568
80556
|
if (Array.isArray(coords)) {
|
|
82569
80557
|
return coords;
|
|
82570
80558
|
}
|
|
@@ -82666,7 +80654,7 @@ function requireCjs$c() {
|
|
|
82666
80654
|
cjs$b.featureOf = featureOf;
|
|
82667
80655
|
cjs$b.geojsonType = geojsonType;
|
|
82668
80656
|
cjs$b.getCoord = getCoord2;
|
|
82669
|
-
cjs$b.getCoords =
|
|
80657
|
+
cjs$b.getCoords = getCoords;
|
|
82670
80658
|
cjs$b.getGeom = getGeom2;
|
|
82671
80659
|
cjs$b.getType = getType;
|
|
82672
80660
|
return cjs$b;
|
|
@@ -83139,7 +81127,7 @@ function requireFeature() {
|
|
|
83139
81127
|
}
|
|
83140
81128
|
_createClass(Feature2, [{
|
|
83141
81129
|
key: "getCoords",
|
|
83142
|
-
value: function
|
|
81130
|
+
value: function getCoords() {
|
|
83143
81131
|
return this.geoJson.geometry.coordinates;
|
|
83144
81132
|
}
|
|
83145
81133
|
}]);
|
|
@@ -85317,23 +83305,23 @@ var hasRequiredCjs$a;
|
|
|
85317
83305
|
function requireCjs$a() {
|
|
85318
83306
|
if (hasRequiredCjs$a) return cjs$9;
|
|
85319
83307
|
hasRequiredCjs$a = 1;
|
|
85320
|
-
var
|
|
83308
|
+
var __defProp = Object.defineProperty;
|
|
85321
83309
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
85322
83310
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
85323
|
-
var
|
|
83311
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
85324
83312
|
var __export = (target, all) => {
|
|
85325
83313
|
for (var name2 in all)
|
|
85326
|
-
|
|
83314
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
85327
83315
|
};
|
|
85328
83316
|
var __copyProps = (to, from, except, desc) => {
|
|
85329
83317
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
85330
83318
|
for (let key of __getOwnPropNames(from))
|
|
85331
|
-
if (!
|
|
85332
|
-
|
|
83319
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
83320
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
85333
83321
|
}
|
|
85334
83322
|
return to;
|
|
85335
83323
|
};
|
|
85336
|
-
var __toCommonJS = (mod2) => __copyProps(
|
|
83324
|
+
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
85337
83325
|
var src_exports = {};
|
|
85338
83326
|
__export(src_exports, {
|
|
85339
83327
|
SplayTreeMap: () => SplayTreeMap,
|
|
@@ -86030,20 +84018,20 @@ function requireCjs$9() {
|
|
|
86030
84018
|
if (hasRequiredCjs$9) return cjs$8;
|
|
86031
84019
|
hasRequiredCjs$9 = 1;
|
|
86032
84020
|
var __create = Object.create;
|
|
86033
|
-
var
|
|
84021
|
+
var __defProp = Object.defineProperty;
|
|
86034
84022
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
86035
84023
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
86036
84024
|
var __getProtoOf = Object.getPrototypeOf;
|
|
86037
|
-
var
|
|
84025
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
86038
84026
|
var __export = (target, all) => {
|
|
86039
84027
|
for (var name2 in all)
|
|
86040
|
-
|
|
84028
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
86041
84029
|
};
|
|
86042
84030
|
var __copyProps = (to, from, except, desc) => {
|
|
86043
84031
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
86044
84032
|
for (let key of __getOwnPropNames(from))
|
|
86045
|
-
if (!
|
|
86046
|
-
|
|
84033
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
84034
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
86047
84035
|
}
|
|
86048
84036
|
return to;
|
|
86049
84037
|
};
|
|
@@ -86052,10 +84040,10 @@ function requireCjs$9() {
|
|
|
86052
84040
|
// file that has been converted to a CommonJS file using a Babel-
|
|
86053
84041
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
86054
84042
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
86055
|
-
|
|
84043
|
+
__defProp(target, "default", { value: mod2, enumerable: true }),
|
|
86056
84044
|
mod2
|
|
86057
84045
|
));
|
|
86058
|
-
var __toCommonJS = (mod2) => __copyProps(
|
|
84046
|
+
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
86059
84047
|
var src_exports = {};
|
|
86060
84048
|
__export(src_exports, {
|
|
86061
84049
|
difference: () => difference,
|
|
@@ -86124,8 +84112,8 @@ function requireCjs$9() {
|
|
|
86124
84112
|
};
|
|
86125
84113
|
};
|
|
86126
84114
|
var precision2 = set2();
|
|
86127
|
-
var isInBbox2 = (
|
|
86128
|
-
return
|
|
84115
|
+
var isInBbox2 = (bbox, point2) => {
|
|
84116
|
+
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);
|
|
86129
84117
|
};
|
|
86130
84118
|
var getBboxOverlap2 = (b1, b2) => {
|
|
86131
84119
|
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))
|
|
@@ -87700,7 +85688,7 @@ function requireUtils$2() {
|
|
|
87700
85688
|
utils$2.distance2d = distance2d;
|
|
87701
85689
|
utils$2.mix = mix;
|
|
87702
85690
|
utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
|
|
87703
|
-
utils$2.nearestPointOnLine =
|
|
85691
|
+
utils$2.nearestPointOnLine = nearestPointOnLine;
|
|
87704
85692
|
utils$2.getPickedEditHandle = getPickedEditHandle;
|
|
87705
85693
|
utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
|
|
87706
85694
|
utils$2.getNonGuidePicks = getNonGuidePicks;
|
|
@@ -87797,12 +85785,12 @@ function requireUtils$2() {
|
|
|
87797
85785
|
return false;
|
|
87798
85786
|
}
|
|
87799
85787
|
function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
|
|
87800
|
-
var
|
|
85788
|
+
var lineString = {
|
|
87801
85789
|
type: "LineString",
|
|
87802
85790
|
coordinates: [p1, p2]
|
|
87803
85791
|
};
|
|
87804
85792
|
var pt = (0, _helpers.point)(mapCoords);
|
|
87805
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
85793
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
87806
85794
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
87807
85795
|
var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
87808
85796
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -87868,7 +85856,7 @@ function requireUtils$2() {
|
|
|
87868
85856
|
}
|
|
87869
85857
|
};
|
|
87870
85858
|
}
|
|
87871
|
-
function
|
|
85859
|
+
function nearestPointOnLine(lines, inPoint, viewport) {
|
|
87872
85860
|
var _lines$geometry, _lines$geometry2;
|
|
87873
85861
|
var mercator2;
|
|
87874
85862
|
if (viewport) {
|
|
@@ -88388,8 +86376,8 @@ function requireImmutableFeatureCollection() {
|
|
|
88388
86376
|
}
|
|
88389
86377
|
function pruneMultiLineStringIfNecessary(geometry2) {
|
|
88390
86378
|
for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
|
|
88391
|
-
var
|
|
88392
|
-
if (
|
|
86379
|
+
var lineString = geometry2.coordinates[lineStringIndex];
|
|
86380
|
+
if (lineString.length === 1) {
|
|
88393
86381
|
geometry2.coordinates.splice(lineStringIndex, 1);
|
|
88394
86382
|
lineStringIndex--;
|
|
88395
86383
|
}
|
|
@@ -88978,8 +86966,8 @@ function requireModifyMode() {
|
|
|
88978
86966
|
var intermediatePoint = null;
|
|
88979
86967
|
var positionIndexPrefix = [];
|
|
88980
86968
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
88981
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
88982
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
86969
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
86970
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
88983
86971
|
var candidateIntermediatePoint = _this.getNearestPoint(
|
|
88984
86972
|
// @ts-ignore
|
|
88985
86973
|
lineStringFeature,
|
|
@@ -89154,30 +87142,30 @@ function requireCjs$6() {
|
|
|
89154
87142
|
if (hasRequiredCjs$6) return cjs$6;
|
|
89155
87143
|
hasRequiredCjs$6 = 1;
|
|
89156
87144
|
Object.defineProperty(cjs$6, "__esModule", { value: true });
|
|
89157
|
-
var
|
|
89158
|
-
var
|
|
89159
|
-
var
|
|
89160
|
-
var
|
|
89161
|
-
var
|
|
89162
|
-
var
|
|
89163
|
-
var
|
|
89164
|
-
var
|
|
87145
|
+
var __defProp = Object.defineProperty;
|
|
87146
|
+
var __defProps = Object.defineProperties;
|
|
87147
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
87148
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
87149
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
87150
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
87151
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
87152
|
+
var __spreadValues = (a2, b) => {
|
|
89165
87153
|
for (var prop in b || (b = {}))
|
|
89166
|
-
if (
|
|
89167
|
-
|
|
89168
|
-
if (
|
|
89169
|
-
for (var prop of
|
|
89170
|
-
if (
|
|
89171
|
-
|
|
87154
|
+
if (__hasOwnProp.call(b, prop))
|
|
87155
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
87156
|
+
if (__getOwnPropSymbols)
|
|
87157
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
87158
|
+
if (__propIsEnum.call(b, prop))
|
|
87159
|
+
__defNormalProp(a2, prop, b[prop]);
|
|
89172
87160
|
}
|
|
89173
87161
|
return a2;
|
|
89174
87162
|
};
|
|
89175
|
-
var
|
|
87163
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
89176
87164
|
var _distance = /* @__PURE__ */ requireCjs$b();
|
|
89177
87165
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
89178
87166
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
89179
87167
|
var _invariant = /* @__PURE__ */ requireCjs$c();
|
|
89180
|
-
function
|
|
87168
|
+
function nearestPointOnLine(lines, pt, options = {}) {
|
|
89181
87169
|
if (!lines || !pt) {
|
|
89182
87170
|
throw new Error("lines and pt are required arguments");
|
|
89183
87171
|
}
|
|
@@ -89209,7 +87197,7 @@ function requireCjs$6() {
|
|
|
89209
87197
|
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
89210
87198
|
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
89211
87199
|
} else {
|
|
89212
|
-
[intersectPos, , wasEnd] =
|
|
87200
|
+
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
89213
87201
|
start.geometry.coordinates,
|
|
89214
87202
|
stop.geometry.coordinates,
|
|
89215
87203
|
_invariant.getCoord.call(void 0, pt)
|
|
@@ -89224,8 +87212,8 @@ function requireCjs$6() {
|
|
|
89224
87212
|
});
|
|
89225
87213
|
}
|
|
89226
87214
|
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
89227
|
-
closestPt =
|
|
89228
|
-
properties:
|
|
87215
|
+
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
87216
|
+
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
89229
87217
|
// Legacy behaviour where index progresses to next segment # if we
|
|
89230
87218
|
// went with the end point this iteration.
|
|
89231
87219
|
index: wasEnd ? i2 + 1 : i2
|
|
@@ -89248,14 +87236,14 @@ function requireCjs$6() {
|
|
|
89248
87236
|
const [v2x, v2y, v2z] = v2;
|
|
89249
87237
|
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
89250
87238
|
}
|
|
89251
|
-
function
|
|
87239
|
+
function magnitude(v) {
|
|
89252
87240
|
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
89253
87241
|
}
|
|
89254
87242
|
function angle2(v12, v2) {
|
|
89255
|
-
const theta = dot2(v12, v2) / (
|
|
87243
|
+
const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
89256
87244
|
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
89257
87245
|
}
|
|
89258
|
-
function
|
|
87246
|
+
function lngLatToVector(a2) {
|
|
89259
87247
|
const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
|
|
89260
87248
|
const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
|
|
89261
87249
|
return [
|
|
@@ -89264,16 +87252,16 @@ function requireCjs$6() {
|
|
|
89264
87252
|
Math.sin(lat)
|
|
89265
87253
|
];
|
|
89266
87254
|
}
|
|
89267
|
-
function
|
|
87255
|
+
function vectorToLngLat(v) {
|
|
89268
87256
|
const [x, y, z] = v;
|
|
89269
87257
|
const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z));
|
|
89270
87258
|
const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
|
|
89271
87259
|
return [lng, lat];
|
|
89272
87260
|
}
|
|
89273
|
-
function
|
|
89274
|
-
const A2 =
|
|
89275
|
-
const B2 =
|
|
89276
|
-
const C3 =
|
|
87261
|
+
function nearestPointOnSegment(posA, posB, posC) {
|
|
87262
|
+
const A2 = lngLatToVector(posA);
|
|
87263
|
+
const B2 = lngLatToVector(posB);
|
|
87264
|
+
const C3 = lngLatToVector(posC);
|
|
89277
87265
|
const [Cx, Cy, Cz] = C3;
|
|
89278
87266
|
const [D2, E2, F] = cross2(A2, B2);
|
|
89279
87267
|
const a2 = E2 * Cz - F * Cy;
|
|
@@ -89297,17 +87285,17 @@ function requireCjs$6() {
|
|
|
89297
87285
|
I3 = I2;
|
|
89298
87286
|
}
|
|
89299
87287
|
if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
|
|
89300
|
-
if (_distance.distance.call(void 0,
|
|
89301
|
-
return [
|
|
87288
|
+
if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
87289
|
+
return [vectorToLngLat(A2), true, false];
|
|
89302
87290
|
} else {
|
|
89303
|
-
return [
|
|
87291
|
+
return [vectorToLngLat(B2), false, true];
|
|
89304
87292
|
}
|
|
89305
87293
|
}
|
|
89306
|
-
return [
|
|
87294
|
+
return [vectorToLngLat(I3), false, false];
|
|
89307
87295
|
}
|
|
89308
|
-
var turf_nearest_point_on_line_default =
|
|
87296
|
+
var turf_nearest_point_on_line_default = nearestPointOnLine;
|
|
89309
87297
|
cjs$6.default = turf_nearest_point_on_line_default;
|
|
89310
|
-
cjs$6.nearestPointOnLine =
|
|
87298
|
+
cjs$6.nearestPointOnLine = nearestPointOnLine;
|
|
89311
87299
|
return cjs$6;
|
|
89312
87300
|
}
|
|
89313
87301
|
var cjs$5 = {};
|
|
@@ -89507,8 +87495,8 @@ function requireResizeCircleMode() {
|
|
|
89507
87495
|
var intermediatePoint = null;
|
|
89508
87496
|
var positionIndexPrefix = [];
|
|
89509
87497
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
89510
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
89511
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
87498
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
87499
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
89512
87500
|
var candidateIntermediatePoint = _this2.getNearestPoint(
|
|
89513
87501
|
// @ts-ignore
|
|
89514
87502
|
lineStringFeature,
|
|
@@ -90146,11 +88134,11 @@ function requireJs$4() {
|
|
|
90146
88134
|
if (origin === void 0 || origin === null) origin = "centroid";
|
|
90147
88135
|
if (Array.isArray(origin) || typeof origin === "object")
|
|
90148
88136
|
return invariant.getCoord(origin);
|
|
90149
|
-
var
|
|
90150
|
-
var west =
|
|
90151
|
-
var south =
|
|
90152
|
-
var east =
|
|
90153
|
-
var north =
|
|
88137
|
+
var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
|
|
88138
|
+
var west = bbox[0];
|
|
88139
|
+
var south = bbox[1];
|
|
88140
|
+
var east = bbox[2];
|
|
88141
|
+
var north = bbox[3];
|
|
90154
88142
|
switch (origin) {
|
|
90155
88143
|
case "sw":
|
|
90156
88144
|
case "southwest":
|
|
@@ -91506,9 +89494,9 @@ function requireCjs$2() {
|
|
|
91506
89494
|
const pt = _invariant.getCoord.call(void 0, point2);
|
|
91507
89495
|
const geom = _invariant.getGeom.call(void 0, polygon2);
|
|
91508
89496
|
const type = geom.type;
|
|
91509
|
-
const
|
|
89497
|
+
const bbox = polygon2.bbox;
|
|
91510
89498
|
let polys = geom.coordinates;
|
|
91511
|
-
if (
|
|
89499
|
+
if (bbox && inBBox2(pt, bbox) === false) {
|
|
91512
89500
|
return false;
|
|
91513
89501
|
}
|
|
91514
89502
|
if (type === "Polygon") {
|
|
@@ -91522,8 +89510,8 @@ function requireCjs$2() {
|
|
|
91522
89510
|
}
|
|
91523
89511
|
return result;
|
|
91524
89512
|
}
|
|
91525
|
-
function inBBox2(pt,
|
|
91526
|
-
return
|
|
89513
|
+
function inBBox2(pt, bbox) {
|
|
89514
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
91527
89515
|
}
|
|
91528
89516
|
var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
|
|
91529
89517
|
cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
|
|
@@ -91531,6 +89519,206 @@ function requireCjs$2() {
|
|
|
91531
89519
|
return cjs$3;
|
|
91532
89520
|
}
|
|
91533
89521
|
var cjs$1 = {};
|
|
89522
|
+
class TinyQueue {
|
|
89523
|
+
constructor(data = [], compare2 = defaultCompare$1) {
|
|
89524
|
+
this.data = data;
|
|
89525
|
+
this.length = this.data.length;
|
|
89526
|
+
this.compare = compare2;
|
|
89527
|
+
if (this.length > 0) {
|
|
89528
|
+
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
89529
|
+
}
|
|
89530
|
+
}
|
|
89531
|
+
push(item) {
|
|
89532
|
+
this.data.push(item);
|
|
89533
|
+
this.length++;
|
|
89534
|
+
this._up(this.length - 1);
|
|
89535
|
+
}
|
|
89536
|
+
pop() {
|
|
89537
|
+
if (this.length === 0) return void 0;
|
|
89538
|
+
const top = this.data[0];
|
|
89539
|
+
const bottom = this.data.pop();
|
|
89540
|
+
this.length--;
|
|
89541
|
+
if (this.length > 0) {
|
|
89542
|
+
this.data[0] = bottom;
|
|
89543
|
+
this._down(0);
|
|
89544
|
+
}
|
|
89545
|
+
return top;
|
|
89546
|
+
}
|
|
89547
|
+
peek() {
|
|
89548
|
+
return this.data[0];
|
|
89549
|
+
}
|
|
89550
|
+
_up(pos) {
|
|
89551
|
+
const { data, compare: compare2 } = this;
|
|
89552
|
+
const item = data[pos];
|
|
89553
|
+
while (pos > 0) {
|
|
89554
|
+
const parent = pos - 1 >> 1;
|
|
89555
|
+
const current = data[parent];
|
|
89556
|
+
if (compare2(item, current) >= 0) break;
|
|
89557
|
+
data[pos] = current;
|
|
89558
|
+
pos = parent;
|
|
89559
|
+
}
|
|
89560
|
+
data[pos] = item;
|
|
89561
|
+
}
|
|
89562
|
+
_down(pos) {
|
|
89563
|
+
const { data, compare: compare2 } = this;
|
|
89564
|
+
const halfLength = this.length >> 1;
|
|
89565
|
+
const item = data[pos];
|
|
89566
|
+
while (pos < halfLength) {
|
|
89567
|
+
let left = (pos << 1) + 1;
|
|
89568
|
+
let best = data[left];
|
|
89569
|
+
const right = left + 1;
|
|
89570
|
+
if (right < this.length && compare2(data[right], best) < 0) {
|
|
89571
|
+
left = right;
|
|
89572
|
+
best = data[right];
|
|
89573
|
+
}
|
|
89574
|
+
if (compare2(best, item) >= 0) break;
|
|
89575
|
+
data[pos] = best;
|
|
89576
|
+
pos = left;
|
|
89577
|
+
}
|
|
89578
|
+
data[pos] = item;
|
|
89579
|
+
}
|
|
89580
|
+
}
|
|
89581
|
+
function defaultCompare$1(a2, b) {
|
|
89582
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
89583
|
+
}
|
|
89584
|
+
function checkWhichEventIsLeft(e1, e2) {
|
|
89585
|
+
if (e1.p.x > e2.p.x) return 1;
|
|
89586
|
+
if (e1.p.x < e2.p.x) return -1;
|
|
89587
|
+
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
89588
|
+
return 1;
|
|
89589
|
+
}
|
|
89590
|
+
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
89591
|
+
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
89592
|
+
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
89593
|
+
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
89594
|
+
return 1;
|
|
89595
|
+
}
|
|
89596
|
+
class Event {
|
|
89597
|
+
constructor(p, featureId2, ringId2, eventId2) {
|
|
89598
|
+
this.p = {
|
|
89599
|
+
x: p[0],
|
|
89600
|
+
y: p[1]
|
|
89601
|
+
};
|
|
89602
|
+
this.featureId = featureId2;
|
|
89603
|
+
this.ringId = ringId2;
|
|
89604
|
+
this.eventId = eventId2;
|
|
89605
|
+
this.otherEvent = null;
|
|
89606
|
+
this.isLeftEndpoint = null;
|
|
89607
|
+
}
|
|
89608
|
+
isSamePoint(eventToCheck) {
|
|
89609
|
+
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
89610
|
+
}
|
|
89611
|
+
}
|
|
89612
|
+
function fillEventQueue(geojson, eventQueue) {
|
|
89613
|
+
if (geojson.type === "FeatureCollection") {
|
|
89614
|
+
const features = geojson.features;
|
|
89615
|
+
for (let i2 = 0; i2 < features.length; i2++) {
|
|
89616
|
+
processFeature(features[i2], eventQueue);
|
|
89617
|
+
}
|
|
89618
|
+
} else {
|
|
89619
|
+
processFeature(geojson, eventQueue);
|
|
89620
|
+
}
|
|
89621
|
+
}
|
|
89622
|
+
let featureId = 0;
|
|
89623
|
+
let ringId = 0;
|
|
89624
|
+
let eventId = 0;
|
|
89625
|
+
function processFeature(featureOrGeometry, eventQueue) {
|
|
89626
|
+
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
89627
|
+
let coords = geom.coordinates;
|
|
89628
|
+
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
89629
|
+
if (geom.type === "LineString") coords = [[coords]];
|
|
89630
|
+
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
89631
|
+
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
89632
|
+
let currentP = coords[i2][ii][0];
|
|
89633
|
+
let nextP = null;
|
|
89634
|
+
ringId = ringId + 1;
|
|
89635
|
+
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
89636
|
+
nextP = coords[i2][ii][iii + 1];
|
|
89637
|
+
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
89638
|
+
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
89639
|
+
e1.otherEvent = e2;
|
|
89640
|
+
e2.otherEvent = e1;
|
|
89641
|
+
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
89642
|
+
e2.isLeftEndpoint = true;
|
|
89643
|
+
e1.isLeftEndpoint = false;
|
|
89644
|
+
} else {
|
|
89645
|
+
e1.isLeftEndpoint = true;
|
|
89646
|
+
e2.isLeftEndpoint = false;
|
|
89647
|
+
}
|
|
89648
|
+
eventQueue.push(e1);
|
|
89649
|
+
eventQueue.push(e2);
|
|
89650
|
+
currentP = nextP;
|
|
89651
|
+
eventId = eventId + 1;
|
|
89652
|
+
}
|
|
89653
|
+
}
|
|
89654
|
+
}
|
|
89655
|
+
featureId = featureId + 1;
|
|
89656
|
+
}
|
|
89657
|
+
let Segment$1 = class Segment {
|
|
89658
|
+
constructor(event) {
|
|
89659
|
+
this.leftSweepEvent = event;
|
|
89660
|
+
this.rightSweepEvent = event.otherEvent;
|
|
89661
|
+
}
|
|
89662
|
+
};
|
|
89663
|
+
function testSegmentIntersect(seg1, seg2) {
|
|
89664
|
+
if (seg1 === null || seg2 === null) return false;
|
|
89665
|
+
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;
|
|
89666
|
+
const x12 = seg1.leftSweepEvent.p.x;
|
|
89667
|
+
const y12 = seg1.leftSweepEvent.p.y;
|
|
89668
|
+
const x2 = seg1.rightSweepEvent.p.x;
|
|
89669
|
+
const y2 = seg1.rightSweepEvent.p.y;
|
|
89670
|
+
const x3 = seg2.leftSweepEvent.p.x;
|
|
89671
|
+
const y3 = seg2.leftSweepEvent.p.y;
|
|
89672
|
+
const x4 = seg2.rightSweepEvent.p.x;
|
|
89673
|
+
const y4 = seg2.rightSweepEvent.p.y;
|
|
89674
|
+
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
89675
|
+
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
89676
|
+
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
89677
|
+
if (denom === 0) {
|
|
89678
|
+
if (numeA === 0 && numeB === 0) return false;
|
|
89679
|
+
return false;
|
|
89680
|
+
}
|
|
89681
|
+
const uA = numeA / denom;
|
|
89682
|
+
const uB = numeB / denom;
|
|
89683
|
+
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
89684
|
+
const x = x12 + uA * (x2 - x12);
|
|
89685
|
+
const y = y12 + uA * (y2 - y12);
|
|
89686
|
+
return [x, y];
|
|
89687
|
+
}
|
|
89688
|
+
return false;
|
|
89689
|
+
}
|
|
89690
|
+
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
89691
|
+
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
89692
|
+
const intersectionPoints = [];
|
|
89693
|
+
const outQueue = new TinyQueue([], checkWhichSegmentHasRightEndpointFirst);
|
|
89694
|
+
while (eventQueue.length) {
|
|
89695
|
+
const event = eventQueue.pop();
|
|
89696
|
+
if (event.isLeftEndpoint) {
|
|
89697
|
+
const segment = new Segment$1(event);
|
|
89698
|
+
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
89699
|
+
const otherSeg = outQueue.data[i2];
|
|
89700
|
+
if (ignoreSelfIntersections) {
|
|
89701
|
+
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
89702
|
+
}
|
|
89703
|
+
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
89704
|
+
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
89705
|
+
}
|
|
89706
|
+
outQueue.push(segment);
|
|
89707
|
+
} else if (event.isLeftEndpoint === false) {
|
|
89708
|
+
outQueue.pop();
|
|
89709
|
+
}
|
|
89710
|
+
}
|
|
89711
|
+
return intersectionPoints;
|
|
89712
|
+
}
|
|
89713
|
+
function sweeplineIntersections(geojson, ignoreSelfIntersections) {
|
|
89714
|
+
const eventQueue = new TinyQueue([], checkWhichEventIsLeft);
|
|
89715
|
+
fillEventQueue(geojson, eventQueue);
|
|
89716
|
+
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
89717
|
+
}
|
|
89718
|
+
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
89719
|
+
__proto__: null,
|
|
89720
|
+
default: sweeplineIntersections
|
|
89721
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
91534
89722
|
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
|
|
91535
89723
|
var hasRequiredCjs$1;
|
|
91536
89724
|
function requireCjs$1() {
|
|
@@ -91544,7 +89732,7 @@ function requireCjs$1() {
|
|
|
91544
89732
|
var _sweeplineintersections = require$$1$1;
|
|
91545
89733
|
var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
|
|
91546
89734
|
var sweeplineIntersections2 = _sweeplineintersections2.default;
|
|
91547
|
-
function
|
|
89735
|
+
function lineIntersect(line1, line2, options = {}) {
|
|
91548
89736
|
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
91549
89737
|
let features = [];
|
|
91550
89738
|
if (line1.type === "FeatureCollection")
|
|
@@ -91578,9 +89766,9 @@ function requireCjs$1() {
|
|
|
91578
89766
|
}
|
|
91579
89767
|
return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
|
|
91580
89768
|
}
|
|
91581
|
-
var turf_line_intersect_default =
|
|
89769
|
+
var turf_line_intersect_default = lineIntersect;
|
|
91582
89770
|
cjs$1.default = turf_line_intersect_default;
|
|
91583
|
-
cjs$1.lineIntersect =
|
|
89771
|
+
cjs$1.lineIntersect = lineIntersect;
|
|
91584
89772
|
return cjs$1;
|
|
91585
89773
|
}
|
|
91586
89774
|
var hasRequiredSplitPolygonMode;
|
|
@@ -95444,8 +93632,8 @@ function requireDraw90degreePolygonMode() {
|
|
|
95444
93632
|
return;
|
|
95445
93633
|
}
|
|
95446
93634
|
if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
|
|
95447
|
-
var
|
|
95448
|
-
clickSequence[clickSequence.length - 1] =
|
|
93635
|
+
var lineString = tentativeFeature.geometry;
|
|
93636
|
+
clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
|
|
95449
93637
|
} else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
|
|
95450
93638
|
var polygon2 = tentativeFeature.geometry;
|
|
95451
93639
|
clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
|
|
@@ -101352,12 +99540,12 @@ function requireUtils$1() {
|
|
|
101352
99540
|
return false;
|
|
101353
99541
|
}
|
|
101354
99542
|
function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
|
|
101355
|
-
var
|
|
99543
|
+
var lineString = {
|
|
101356
99544
|
type: "LineString",
|
|
101357
99545
|
coordinates: [p1, p2]
|
|
101358
99546
|
};
|
|
101359
99547
|
var pt = (0, _helpers.point)(groundCoords);
|
|
101360
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
99548
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
101361
99549
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
101362
99550
|
var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
101363
99551
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -103026,31 +101214,35 @@ class SelectionLayer extends CompositeLayer {
|
|
|
103026
101214
|
const { flipY, obsLayers } = this.props;
|
|
103027
101215
|
const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
|
|
103028
101216
|
const selectedPolygon = polygon(flippedCoordinates);
|
|
101217
|
+
let minX = Infinity;
|
|
101218
|
+
let minY = Infinity;
|
|
101219
|
+
let maxX = -Infinity;
|
|
101220
|
+
let maxY = -Infinity;
|
|
101221
|
+
flippedCoordinates[0].forEach(([x, y]) => {
|
|
101222
|
+
minX = Math.min(minX, x);
|
|
101223
|
+
minY = Math.min(minY, y);
|
|
101224
|
+
maxX = Math.max(maxX, x);
|
|
101225
|
+
maxY = Math.max(maxY, y);
|
|
101226
|
+
});
|
|
103029
101227
|
obsLayers.forEach((obsLayer) => {
|
|
103030
101228
|
const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
|
|
103031
|
-
const
|
|
101229
|
+
const pickingIds = [];
|
|
103032
101230
|
obsQuadTree?.visit((node, x02, y02, x12, y12) => {
|
|
103033
|
-
|
|
103034
|
-
const nodePolygon = polygon(nodePoints);
|
|
103035
|
-
const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
|
|
103036
|
-
const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
|
|
103037
|
-
const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
|
|
103038
|
-
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
101231
|
+
if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
|
|
103039
101232
|
return true;
|
|
103040
101233
|
}
|
|
103041
|
-
if (node.
|
|
101234
|
+
if (!node.length) {
|
|
103042
101235
|
let current = node;
|
|
103043
101236
|
while (current) {
|
|
103044
|
-
const
|
|
103045
|
-
if (booleanPointInPolygon(
|
|
103046
|
-
|
|
101237
|
+
const [x, y] = getObsCoords(current.data);
|
|
101238
|
+
if (booleanPointInPolygon([x, y], selectedPolygon)) {
|
|
101239
|
+
pickingIds.push(obsIndex[current.data]);
|
|
103047
101240
|
}
|
|
103048
101241
|
current = current.next;
|
|
103049
101242
|
}
|
|
103050
101243
|
}
|
|
103051
101244
|
return false;
|
|
103052
101245
|
});
|
|
103053
|
-
const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
|
|
103054
101246
|
layerOnSelect(pickingIds);
|
|
103055
101247
|
});
|
|
103056
101248
|
}
|
|
@@ -104906,22 +103098,22 @@ async function getDecoder(fileDirectory) {
|
|
|
104906
103098
|
const Decoder = await importFn();
|
|
104907
103099
|
return new Decoder(fileDirectory);
|
|
104908
103100
|
}
|
|
104909
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
104910
|
-
addDecoder(5, () => import("./lzw-
|
|
103101
|
+
addDecoder([void 0, 1], () => import("./raw-CbPBCrOb.js").then((m) => m.default));
|
|
103102
|
+
addDecoder(5, () => import("./lzw-C8NSAPvb.js").then((m) => m.default));
|
|
104911
103103
|
addDecoder(6, () => {
|
|
104912
103104
|
throw new Error("old style JPEG compression is not supported.");
|
|
104913
103105
|
});
|
|
104914
|
-
addDecoder(7, () => import("./jpeg-
|
|
104915
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
104916
|
-
addDecoder(32773, () => import("./packbits-
|
|
103106
|
+
addDecoder(7, () => import("./jpeg-DQ-CazxZ.js").then((m) => m.default));
|
|
103107
|
+
addDecoder([8, 32946], () => import("./deflate-CIM-SNpP.js").then((m) => m.default));
|
|
103108
|
+
addDecoder(32773, () => import("./packbits-BZYNl97h.js").then((m) => m.default));
|
|
104917
103109
|
addDecoder(
|
|
104918
103110
|
34887,
|
|
104919
|
-
() => import("./lerc-
|
|
103111
|
+
() => import("./lerc-BT_hx9Kh.js").then(async (m) => {
|
|
104920
103112
|
await m.zstd.init();
|
|
104921
103113
|
return m;
|
|
104922
103114
|
}).then((m) => m.default)
|
|
104923
103115
|
);
|
|
104924
|
-
addDecoder(50001, () => import("./webimage-
|
|
103116
|
+
addDecoder(50001, () => import("./webimage-CsiyTZBP.js").then((m) => m.default));
|
|
104925
103117
|
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
104926
103118
|
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
104927
103119
|
}
|
|
@@ -107356,26 +105548,26 @@ class GeoTIFFBase {
|
|
|
107356
105548
|
*/
|
|
107357
105549
|
async readRasters(options = {}) {
|
|
107358
105550
|
const { window: imageWindow, width, height } = options;
|
|
107359
|
-
let { resX, resY, bbox
|
|
105551
|
+
let { resX, resY, bbox } = options;
|
|
107360
105552
|
const firstImage = await this.getImage();
|
|
107361
105553
|
let usedImage = firstImage;
|
|
107362
105554
|
const imageCount = await this.getImageCount();
|
|
107363
105555
|
const imgBBox = firstImage.getBoundingBox();
|
|
107364
|
-
if (imageWindow &&
|
|
105556
|
+
if (imageWindow && bbox) {
|
|
107365
105557
|
throw new Error('Both "bbox" and "window" passed.');
|
|
107366
105558
|
}
|
|
107367
105559
|
if (width || height) {
|
|
107368
105560
|
if (imageWindow) {
|
|
107369
105561
|
const [oX, oY] = firstImage.getOrigin();
|
|
107370
105562
|
const [rX, rY] = firstImage.getResolution();
|
|
107371
|
-
|
|
105563
|
+
bbox = [
|
|
107372
105564
|
oX + imageWindow[0] * rX,
|
|
107373
105565
|
oY + imageWindow[1] * rY,
|
|
107374
105566
|
oX + imageWindow[2] * rX,
|
|
107375
105567
|
oY + imageWindow[3] * rY
|
|
107376
105568
|
];
|
|
107377
105569
|
}
|
|
107378
|
-
const usedBBox =
|
|
105570
|
+
const usedBBox = bbox || imgBBox;
|
|
107379
105571
|
if (width) {
|
|
107380
105572
|
if (resX) {
|
|
107381
105573
|
throw new Error("Both width and resX passed");
|
|
@@ -107410,14 +105602,14 @@ class GeoTIFFBase {
|
|
|
107410
105602
|
}
|
|
107411
105603
|
}
|
|
107412
105604
|
let wnd = imageWindow;
|
|
107413
|
-
if (
|
|
105605
|
+
if (bbox) {
|
|
107414
105606
|
const [oX, oY] = firstImage.getOrigin();
|
|
107415
105607
|
const [imageResX, imageResY] = usedImage.getResolution(firstImage);
|
|
107416
105608
|
wnd = [
|
|
107417
|
-
Math.round((
|
|
107418
|
-
Math.round((
|
|
107419
|
-
Math.round((
|
|
107420
|
-
Math.round((
|
|
105609
|
+
Math.round((bbox[0] - oX) / imageResX),
|
|
105610
|
+
Math.round((bbox[1] - oY) / imageResY),
|
|
105611
|
+
Math.round((bbox[2] - oX) / imageResX),
|
|
105612
|
+
Math.round((bbox[3] - oY) / imageResY)
|
|
107421
105613
|
];
|
|
107422
105614
|
wnd = [
|
|
107423
105615
|
Math.min(wnd[0], wnd[2]),
|
|
@@ -107727,6 +105919,50 @@ async function N(A2, I2) {
|
|
|
107727
105919
|
if (0 === g2.length) throw Error("Failed to decode with LZW decoder.");
|
|
107728
105920
|
return g2;
|
|
107729
105921
|
}
|
|
105922
|
+
function quickselect(arr, k, left, right, compare2) {
|
|
105923
|
+
quickselectStep(arr, k, left || 0, right || arr.length - 1, defaultCompare);
|
|
105924
|
+
}
|
|
105925
|
+
function quickselectStep(arr, k, left, right, compare2) {
|
|
105926
|
+
while (right > left) {
|
|
105927
|
+
if (right - left > 600) {
|
|
105928
|
+
var n3 = right - left + 1;
|
|
105929
|
+
var m = k - left + 1;
|
|
105930
|
+
var z = Math.log(n3);
|
|
105931
|
+
var s2 = 0.5 * Math.exp(2 * z / 3);
|
|
105932
|
+
var sd = 0.5 * Math.sqrt(z * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
105933
|
+
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
105934
|
+
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
105935
|
+
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
105936
|
+
}
|
|
105937
|
+
var t = arr[k];
|
|
105938
|
+
var i2 = left;
|
|
105939
|
+
var j = right;
|
|
105940
|
+
swap(arr, left, k);
|
|
105941
|
+
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
105942
|
+
while (i2 < j) {
|
|
105943
|
+
swap(arr, i2, j);
|
|
105944
|
+
i2++;
|
|
105945
|
+
j--;
|
|
105946
|
+
while (compare2(arr[i2], t) < 0) i2++;
|
|
105947
|
+
while (compare2(arr[j], t) > 0) j--;
|
|
105948
|
+
}
|
|
105949
|
+
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
105950
|
+
else {
|
|
105951
|
+
j++;
|
|
105952
|
+
swap(arr, j, right);
|
|
105953
|
+
}
|
|
105954
|
+
if (j <= k) left = j + 1;
|
|
105955
|
+
if (k <= j) right = j - 1;
|
|
105956
|
+
}
|
|
105957
|
+
}
|
|
105958
|
+
function swap(arr, i2, j) {
|
|
105959
|
+
var tmp = arr[i2];
|
|
105960
|
+
arr[i2] = arr[j];
|
|
105961
|
+
arr[j] = tmp;
|
|
105962
|
+
}
|
|
105963
|
+
function defaultCompare(a2, b) {
|
|
105964
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
105965
|
+
}
|
|
107730
105966
|
var util;
|
|
107731
105967
|
(function(util2) {
|
|
107732
105968
|
util2.assertEqual = (val) => val;
|
|
@@ -119438,17 +117674,17 @@ function sizeToMeters(size2, unit2) {
|
|
|
119438
117674
|
throw new Error("Received unknown unit");
|
|
119439
117675
|
}
|
|
119440
117676
|
function snapValue(value) {
|
|
119441
|
-
let
|
|
117677
|
+
let magnitude = 0;
|
|
119442
117678
|
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
119443
|
-
|
|
117679
|
+
magnitude = Math.floor(Math.log10(value));
|
|
119444
117680
|
}
|
|
119445
117681
|
let snappedUnit = SI_PREFIXES.find(
|
|
119446
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
117682
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
119447
117683
|
);
|
|
119448
117684
|
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
119449
117685
|
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
119450
117686
|
snappedUnit = SI_PREFIXES.find(
|
|
119451
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
117687
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
119452
117688
|
);
|
|
119453
117689
|
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
119454
117690
|
}
|
|
@@ -123075,6 +121311,139 @@ class BitmaskLayer2 extends XRLayer {
|
|
|
123075
121311
|
}
|
|
123076
121312
|
BitmaskLayer2.layerName = "BitmaskLayer";
|
|
123077
121313
|
BitmaskLayer2.defaultProps = defaultProps$2;
|
|
121314
|
+
function geomEach(geojson, callback) {
|
|
121315
|
+
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;
|
|
121316
|
+
for (i2 = 0; i2 < stop; i2++) {
|
|
121317
|
+
geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
|
|
121318
|
+
featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
|
|
121319
|
+
featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
|
|
121320
|
+
featureId2 = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
|
|
121321
|
+
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
121322
|
+
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
121323
|
+
for (g2 = 0; g2 < stopG; g2++) {
|
|
121324
|
+
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g2] : geometryMaybeCollection;
|
|
121325
|
+
if (geometry2 === null) {
|
|
121326
|
+
if (callback(
|
|
121327
|
+
null,
|
|
121328
|
+
featureIndex,
|
|
121329
|
+
featureProperties,
|
|
121330
|
+
featureBBox,
|
|
121331
|
+
featureId2
|
|
121332
|
+
) === false)
|
|
121333
|
+
return false;
|
|
121334
|
+
continue;
|
|
121335
|
+
}
|
|
121336
|
+
switch (geometry2.type) {
|
|
121337
|
+
case "Point":
|
|
121338
|
+
case "LineString":
|
|
121339
|
+
case "MultiPoint":
|
|
121340
|
+
case "Polygon":
|
|
121341
|
+
case "MultiLineString":
|
|
121342
|
+
case "MultiPolygon": {
|
|
121343
|
+
if (callback(
|
|
121344
|
+
geometry2,
|
|
121345
|
+
featureIndex,
|
|
121346
|
+
featureProperties,
|
|
121347
|
+
featureBBox,
|
|
121348
|
+
featureId2
|
|
121349
|
+
) === false)
|
|
121350
|
+
return false;
|
|
121351
|
+
break;
|
|
121352
|
+
}
|
|
121353
|
+
case "GeometryCollection": {
|
|
121354
|
+
for (j = 0; j < geometry2.geometries.length; j++) {
|
|
121355
|
+
if (callback(
|
|
121356
|
+
geometry2.geometries[j],
|
|
121357
|
+
featureIndex,
|
|
121358
|
+
featureProperties,
|
|
121359
|
+
featureBBox,
|
|
121360
|
+
featureId2
|
|
121361
|
+
) === false)
|
|
121362
|
+
return false;
|
|
121363
|
+
}
|
|
121364
|
+
break;
|
|
121365
|
+
}
|
|
121366
|
+
default:
|
|
121367
|
+
throw new Error("Unknown Geometry Type");
|
|
121368
|
+
}
|
|
121369
|
+
}
|
|
121370
|
+
featureIndex++;
|
|
121371
|
+
}
|
|
121372
|
+
}
|
|
121373
|
+
function geomReduce(geojson, callback, initialValue) {
|
|
121374
|
+
var previousValue = initialValue;
|
|
121375
|
+
geomEach(
|
|
121376
|
+
geojson,
|
|
121377
|
+
function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId2) {
|
|
121378
|
+
previousValue = callback(
|
|
121379
|
+
previousValue,
|
|
121380
|
+
currentGeometry,
|
|
121381
|
+
featureIndex,
|
|
121382
|
+
featureProperties,
|
|
121383
|
+
featureBBox,
|
|
121384
|
+
featureId2
|
|
121385
|
+
);
|
|
121386
|
+
}
|
|
121387
|
+
);
|
|
121388
|
+
return previousValue;
|
|
121389
|
+
}
|
|
121390
|
+
function flattenEach(geojson, callback) {
|
|
121391
|
+
geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
121392
|
+
var type = geometry2 === null ? null : geometry2.type;
|
|
121393
|
+
switch (type) {
|
|
121394
|
+
case null:
|
|
121395
|
+
case "Point":
|
|
121396
|
+
case "LineString":
|
|
121397
|
+
case "Polygon":
|
|
121398
|
+
if (callback(
|
|
121399
|
+
feature$1(geometry2, properties, { bbox, id }),
|
|
121400
|
+
featureIndex,
|
|
121401
|
+
0
|
|
121402
|
+
) === false)
|
|
121403
|
+
return false;
|
|
121404
|
+
return;
|
|
121405
|
+
}
|
|
121406
|
+
var geomType;
|
|
121407
|
+
switch (type) {
|
|
121408
|
+
case "MultiPoint":
|
|
121409
|
+
geomType = "Point";
|
|
121410
|
+
break;
|
|
121411
|
+
case "MultiLineString":
|
|
121412
|
+
geomType = "LineString";
|
|
121413
|
+
break;
|
|
121414
|
+
case "MultiPolygon":
|
|
121415
|
+
geomType = "Polygon";
|
|
121416
|
+
break;
|
|
121417
|
+
}
|
|
121418
|
+
for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
|
|
121419
|
+
var coordinate = geometry2.coordinates[multiFeatureIndex];
|
|
121420
|
+
var geom = {
|
|
121421
|
+
type: geomType,
|
|
121422
|
+
coordinates: coordinate
|
|
121423
|
+
};
|
|
121424
|
+
if (callback(feature$1(geom, properties), featureIndex, multiFeatureIndex) === false)
|
|
121425
|
+
return false;
|
|
121426
|
+
}
|
|
121427
|
+
});
|
|
121428
|
+
}
|
|
121429
|
+
function flattenReduce(geojson, callback, initialValue) {
|
|
121430
|
+
var previousValue = initialValue;
|
|
121431
|
+
flattenEach(
|
|
121432
|
+
geojson,
|
|
121433
|
+
function(currentFeature, featureIndex, multiFeatureIndex) {
|
|
121434
|
+
if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
|
|
121435
|
+
previousValue = currentFeature;
|
|
121436
|
+
else
|
|
121437
|
+
previousValue = callback(
|
|
121438
|
+
previousValue,
|
|
121439
|
+
currentFeature,
|
|
121440
|
+
featureIndex,
|
|
121441
|
+
multiFeatureIndex
|
|
121442
|
+
);
|
|
121443
|
+
}
|
|
121444
|
+
);
|
|
121445
|
+
return previousValue;
|
|
121446
|
+
}
|
|
123078
121447
|
var isNumeric$1 = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor$1 = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE$1 = 1e14, LOG_BASE$1 = 14, MAX_SAFE_INTEGER$1 = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
|
|
123079
121448
|
function clone$2(configObject) {
|
|
123080
121449
|
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 = {
|
|
@@ -124915,8 +123284,8 @@ var set = (eps) => {
|
|
|
124915
123284
|
};
|
|
124916
123285
|
};
|
|
124917
123286
|
var precision = set();
|
|
124918
|
-
var isInBbox = (
|
|
124919
|
-
return
|
|
123287
|
+
var isInBbox = (bbox, point2) => {
|
|
123288
|
+
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);
|
|
124920
123289
|
};
|
|
124921
123290
|
var getBboxOverlap = (b1, b2) => {
|
|
124922
123291
|
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))
|
|
@@ -126016,6 +124385,19 @@ function ringArea(coords) {
|
|
|
126016
124385
|
}
|
|
126017
124386
|
return total * FACTOR;
|
|
126018
124387
|
}
|
|
124388
|
+
function distance(from, to, options = {}) {
|
|
124389
|
+
var coordinates1 = getCoord(from);
|
|
124390
|
+
var coordinates2 = getCoord(to);
|
|
124391
|
+
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
124392
|
+
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
124393
|
+
var lat1 = degreesToRadians(coordinates1[1]);
|
|
124394
|
+
var lat2 = degreesToRadians(coordinates2[1]);
|
|
124395
|
+
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
124396
|
+
return radiansToLength(
|
|
124397
|
+
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
124398
|
+
options.units
|
|
124399
|
+
);
|
|
124400
|
+
}
|
|
126019
124401
|
const DEFAULT_THRESHOLD = 1;
|
|
126020
124402
|
const defaultProps$1 = {
|
|
126021
124403
|
// for text
|
|
@@ -126112,7 +124494,7 @@ class ContourLayerWithText extends ContourLayer {
|
|
|
126112
124494
|
const circlePoint = point(circleCoord);
|
|
126113
124495
|
polygonVertices.forEach((polyCoord) => {
|
|
126114
124496
|
const polyPoint = point(polyCoord);
|
|
126115
|
-
const dist2 = distance
|
|
124497
|
+
const dist2 = distance(circlePoint, polyPoint);
|
|
126116
124498
|
if (dist2 < minDist) {
|
|
126117
124499
|
minDist = dist2;
|
|
126118
124500
|
minCirclePoint = circleCoord;
|
|
@@ -126602,10 +124984,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
126602
124984
|
getLineColor: strokeColor,
|
|
126603
124985
|
getLineWidth: strokeWidth,
|
|
126604
124986
|
lineWidthUnits: "pixels",
|
|
126605
|
-
|
|
126606
|
-
|
|
126607
|
-
getDashArray: dashArray
|
|
126608
|
-
} : {}
|
|
124987
|
+
extensions: dashExt,
|
|
124988
|
+
getDashArray: getDash
|
|
126609
124989
|
}));
|
|
126610
124990
|
if (shape.text && labelOpacity > 0) {
|
|
126611
124991
|
layers.push(new TextLayer({
|
|
@@ -126640,8 +125020,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
126640
125020
|
layers.push(new PathLayer({
|
|
126641
125021
|
...base,
|
|
126642
125022
|
id: `annotation-line-${uid2}-${i2}`,
|
|
126643
|
-
extensions:
|
|
126644
|
-
getDashArray:
|
|
125023
|
+
extensions: dashExt,
|
|
125024
|
+
getDashArray: getDash,
|
|
126645
125025
|
data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
|
|
126646
125026
|
getPath: (d) => d.path,
|
|
126647
125027
|
getColor: strokeColor,
|
|
@@ -126789,10 +125169,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
126789
125169
|
getLineColor: strokeColor,
|
|
126790
125170
|
getLineWidth: strokeWidth,
|
|
126791
125171
|
lineWidthUnits: "pixels",
|
|
126792
|
-
|
|
126793
|
-
|
|
126794
|
-
getDashArray: dashArray
|
|
126795
|
-
} : {}
|
|
125172
|
+
extensions: dashExt,
|
|
125173
|
+
getDashArray: getDash
|
|
126796
125174
|
}));
|
|
126797
125175
|
if (shape.text && labelOpacity > 0) {
|
|
126798
125176
|
layers.push(new TextLayer({
|
|
@@ -143528,6 +141906,7 @@ function requireFetchJsonp() {
|
|
|
143528
141906
|
requireFetchJsonp();
|
|
143529
141907
|
const OFFSETS_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#ome-tiff-offsets";
|
|
143530
141908
|
const PYRAMID_DOCS_URL = "https://vitessce.io/docs/data-troubleshooting/#multi-resolution-pyramidal-representation";
|
|
141909
|
+
const dtypeMaxMap = { uint8: 255, uint16: 65535, uint32: 4294967295, float32: 1 };
|
|
143531
141910
|
class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
143532
141911
|
async loadOffsets() {
|
|
143533
141912
|
const { offsetsUrl } = this.options || {};
|
|
@@ -143565,7 +141944,8 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
143565
141944
|
PhysicalSizeX,
|
|
143566
141945
|
PhysicalSizeXUnit,
|
|
143567
141946
|
PhysicalSizeY,
|
|
143568
|
-
PhysicalSizeYUnit
|
|
141947
|
+
PhysicalSizeYUnit,
|
|
141948
|
+
Type: dtype
|
|
143569
141949
|
}
|
|
143570
141950
|
} = loader.metadata;
|
|
143571
141951
|
const channels2 = Array.isArray(Channels) ? Channels.map((channel, i2) => channel.Name || `Channel ${i2}`) : [Channels.Name || `Channel ${0}`];
|
|
@@ -143590,12 +141970,12 @@ class OmeTiffLoader extends AbstractTwoStepLoader {
|
|
|
143590
141970
|
{ url, name: image.name }
|
|
143591
141971
|
];
|
|
143592
141972
|
const channelObjects = imageWrapper.getChannelObjects();
|
|
143593
|
-
const channelCoordination = channelObjects.slice(0,
|
|
141973
|
+
const channelCoordination = channelObjects.slice(0, 6).map((channelObj, i2) => ({
|
|
143594
141974
|
spatialTargetC: i2,
|
|
143595
141975
|
spatialChannelColor: (channelObj.defaultColor || channelObj.autoDefaultColor).slice(0, 3),
|
|
143596
141976
|
spatialChannelVisible: true,
|
|
143597
141977
|
spatialChannelOpacity: 1,
|
|
143598
|
-
spatialChannelWindow: channelObj.defaultWindow ||
|
|
141978
|
+
spatialChannelWindow: channelObj.defaultWindow || [0, dtypeMaxMap[dtype] ?? 255]
|
|
143599
141979
|
}));
|
|
143600
141980
|
const imagesWithLoaderCreators = [
|
|
143601
141981
|
{
|