@vitessce/json 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-B9yQXNA5.js → deflate-gERuHO_1.js} +1 -1
- package/dist/{index-B31MphL5.js → index-BObeaAM4.js} +595 -2210
- package/dist/index.js +1 -1
- package/dist/{jpeg-DYOBxHhT.js → jpeg-DMmjuxic.js} +1 -1
- package/dist/{lerc-CXBCb2wB.js → lerc-Ci4fZASZ.js} +1 -1
- package/dist/{lzw-Cn4MHMg0.js → lzw-DCsRKzgn.js} +1 -1
- package/dist/{packbits-3K31MqMe.js → packbits-BIDoTj9B.js} +1 -1
- package/dist/{raw-DrKGleEE.js → raw-C8mBC_hQ.js} +1 -1
- package/dist/{webimage-MBv_oDxF.js → webimage-9kP0E89I.js} +1 -1
- package/package.json +12 -12
|
@@ -309,6 +309,7 @@ const CoordinationType$1 = {
|
|
|
309
309
|
SPATIAL_ROTATION_ORBIT: "spatialRotationOrbit",
|
|
310
310
|
SPATIAL_ORBIT_AXIS: "spatialOrbitAxis",
|
|
311
311
|
SPATIAL_AXIS_FIXED: "spatialAxisFixed",
|
|
312
|
+
SPATIAL_CAMERA_SNAPSHOT: "spatialCameraSnapshot",
|
|
312
313
|
HEATMAP_ZOOM_X: "heatmapZoomX",
|
|
313
314
|
HEATMAP_ZOOM_Y: "heatmapZoomY",
|
|
314
315
|
HEATMAP_TARGET_X: "heatmapTargetX",
|
|
@@ -360,6 +361,7 @@ const CoordinationType$1 = {
|
|
|
360
361
|
SPATIAL_TARGET_C: "spatialTargetC",
|
|
361
362
|
SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
|
|
362
363
|
SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
|
|
364
|
+
SPATIAL_LAYER_OPACITY_UNSELECTED: "spatialLayerOpacityUnselected",
|
|
363
365
|
SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
|
|
364
366
|
SPATIAL_LAYER_LABEL: "spatialLayerLabel",
|
|
365
367
|
SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
|
|
@@ -725,6 +727,7 @@ const CoordinationType$1 = {
|
|
|
725
727
|
CoordinationType$1.SPATIAL_ROTATION_ORBIT,
|
|
726
728
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
727
729
|
CoordinationType$1.SPATIAL_ZOOM,
|
|
730
|
+
CoordinationType$1.SPATIAL_CAMERA_SNAPSHOT,
|
|
728
731
|
CoordinationType$1.OBS_FILTER,
|
|
729
732
|
CoordinationType$1.OBS_HIGHLIGHT,
|
|
730
733
|
CoordinationType$1.OBS_SET_SELECTION,
|
|
@@ -750,6 +753,7 @@ const CoordinationType$1 = {
|
|
|
750
753
|
CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
|
|
751
754
|
CoordinationType$1.SPATIAL_LAYER_COLOR,
|
|
752
755
|
CoordinationType$1.SPATIAL_LAYER_OPACITY,
|
|
756
|
+
CoordinationType$1.SPATIAL_LAYER_OPACITY_UNSELECTED,
|
|
753
757
|
CoordinationType$1.SPATIAL_LAYER_VISIBLE,
|
|
754
758
|
CoordinationType$1.SPATIAL_LAYER_LABEL,
|
|
755
759
|
CoordinationType$1.SPATIAL_CHANNEL_COLOR,
|
|
@@ -954,6 +958,7 @@ const CoordinationType$1 = {
|
|
|
954
958
|
CoordinationType$1.SPATIAL_ROTATION_ORBIT,
|
|
955
959
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
956
960
|
CoordinationType$1.SPATIAL_AXIS_FIXED,
|
|
961
|
+
CoordinationType$1.SPATIAL_CAMERA_SNAPSHOT,
|
|
957
962
|
CoordinationType$1.OBS_FILTER,
|
|
958
963
|
CoordinationType$1.OBS_HIGHLIGHT,
|
|
959
964
|
CoordinationType$1.OBS_SET_SELECTION,
|
|
@@ -975,6 +980,7 @@ const CoordinationType$1 = {
|
|
|
975
980
|
CoordinationType$1.SPATIAL_TARGET_C,
|
|
976
981
|
CoordinationType$1.SPATIAL_LAYER_VISIBLE,
|
|
977
982
|
CoordinationType$1.SPATIAL_LAYER_OPACITY,
|
|
983
|
+
CoordinationType$1.SPATIAL_LAYER_OPACITY_UNSELECTED,
|
|
978
984
|
CoordinationType$1.SPATIAL_LAYER_COLORMAP,
|
|
979
985
|
CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
|
|
980
986
|
CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
|
|
@@ -1170,6 +1176,7 @@ const CoordinationType$1 = {
|
|
|
1170
1176
|
CoordinationType$1.SPATIAL_LAYER_VISIBLE,
|
|
1171
1177
|
CoordinationType$1.SPATIAL_LAYER_LABEL,
|
|
1172
1178
|
CoordinationType$1.SPATIAL_LAYER_OPACITY,
|
|
1179
|
+
CoordinationType$1.SPATIAL_LAYER_OPACITY_UNSELECTED,
|
|
1173
1180
|
CoordinationType$1.SPATIAL_LAYER_COLORMAP,
|
|
1174
1181
|
CoordinationType$1.SPATIAL_LAYER_TRANSPARENT_COLOR,
|
|
1175
1182
|
CoordinationType$1.SPATIAL_LAYER_MODEL_MATRIX,
|
|
@@ -6307,7 +6314,7 @@ var reTrimStart = /^\s+/;
|
|
|
6307
6314
|
function baseTrim(string) {
|
|
6308
6315
|
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
6309
6316
|
}
|
|
6310
|
-
function isObject$
|
|
6317
|
+
function isObject$3(value) {
|
|
6311
6318
|
var type = typeof value;
|
|
6312
6319
|
return value != null && (type == "object" || type == "function");
|
|
6313
6320
|
}
|
|
@@ -6323,9 +6330,9 @@ function toNumber(value) {
|
|
|
6323
6330
|
if (isSymbol(value)) {
|
|
6324
6331
|
return NAN;
|
|
6325
6332
|
}
|
|
6326
|
-
if (isObject$
|
|
6333
|
+
if (isObject$3(value)) {
|
|
6327
6334
|
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
6328
|
-
value = isObject$
|
|
6335
|
+
value = isObject$3(other) ? other + "" : other;
|
|
6329
6336
|
}
|
|
6330
6337
|
if (typeof value != "string") {
|
|
6331
6338
|
return value === 0 ? value : +value;
|
|
@@ -6351,7 +6358,7 @@ function identity$6(value) {
|
|
|
6351
6358
|
}
|
|
6352
6359
|
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
6353
6360
|
function isFunction$2(value) {
|
|
6354
|
-
if (!isObject$
|
|
6361
|
+
if (!isObject$3(value)) {
|
|
6355
6362
|
return false;
|
|
6356
6363
|
}
|
|
6357
6364
|
var tag2 = baseGetTag(value);
|
|
@@ -6389,7 +6396,7 @@ var reIsNative = RegExp(
|
|
|
6389
6396
|
"^" + funcToString.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
6390
6397
|
);
|
|
6391
6398
|
function baseIsNative(value) {
|
|
6392
|
-
if (!isObject$
|
|
6399
|
+
if (!isObject$3(value) || isMasked(value)) {
|
|
6393
6400
|
return false;
|
|
6394
6401
|
}
|
|
6395
6402
|
var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
|
|
@@ -6408,7 +6415,7 @@ var baseCreate = /* @__PURE__ */ function() {
|
|
|
6408
6415
|
function object2() {
|
|
6409
6416
|
}
|
|
6410
6417
|
return function(proto) {
|
|
6411
|
-
if (!isObject$
|
|
6418
|
+
if (!isObject$3(proto)) {
|
|
6412
6419
|
return {};
|
|
6413
6420
|
}
|
|
6414
6421
|
if (objectCreate) {
|
|
@@ -6475,7 +6482,7 @@ function isArrayLike(value) {
|
|
|
6475
6482
|
return value != null && isLength(value.length) && !isFunction$2(value);
|
|
6476
6483
|
}
|
|
6477
6484
|
function isIterateeCall(value, index2, object2) {
|
|
6478
|
-
if (!isObject$
|
|
6485
|
+
if (!isObject$3(object2)) {
|
|
6479
6486
|
return false;
|
|
6480
6487
|
}
|
|
6481
6488
|
var type = typeof index2;
|
|
@@ -6948,7 +6955,7 @@ function baseClone(value, bitmask, customizer, key, object2, stack2) {
|
|
|
6948
6955
|
if (result !== void 0) {
|
|
6949
6956
|
return result;
|
|
6950
6957
|
}
|
|
6951
|
-
if (!isObject$
|
|
6958
|
+
if (!isObject$3(value)) {
|
|
6952
6959
|
return value;
|
|
6953
6960
|
}
|
|
6954
6961
|
var isArr = isArray$4(value);
|
|
@@ -9417,12 +9424,12 @@ function requireIntersects() {
|
|
|
9417
9424
|
if (hasRequiredIntersects) return intersects_1;
|
|
9418
9425
|
hasRequiredIntersects = 1;
|
|
9419
9426
|
const Range = requireRange();
|
|
9420
|
-
const
|
|
9427
|
+
const intersects = (r1, r2, options) => {
|
|
9421
9428
|
r1 = new Range(r1, options);
|
|
9422
9429
|
r2 = new Range(r2, options);
|
|
9423
9430
|
return r1.intersects(r2, options);
|
|
9424
9431
|
};
|
|
9425
|
-
intersects_1 =
|
|
9432
|
+
intersects_1 = intersects;
|
|
9426
9433
|
return intersects_1;
|
|
9427
9434
|
}
|
|
9428
9435
|
var simplify;
|
|
@@ -9680,7 +9687,7 @@ function requireSemver() {
|
|
|
9680
9687
|
const outside = requireOutside();
|
|
9681
9688
|
const gtr = requireGtr();
|
|
9682
9689
|
const ltr = requireLtr();
|
|
9683
|
-
const
|
|
9690
|
+
const intersects = requireIntersects();
|
|
9684
9691
|
const simplifyRange = requireSimplify();
|
|
9685
9692
|
const subset = requireSubset();
|
|
9686
9693
|
semver = {
|
|
@@ -9718,7 +9725,7 @@ function requireSemver() {
|
|
|
9718
9725
|
outside,
|
|
9719
9726
|
gtr,
|
|
9720
9727
|
ltr,
|
|
9721
|
-
intersects
|
|
9728
|
+
intersects,
|
|
9722
9729
|
simplifyRange,
|
|
9723
9730
|
subset,
|
|
9724
9731
|
SemVer,
|
|
@@ -13440,16 +13447,6 @@ function polygons(coordinates2, properties, options = {}) {
|
|
|
13440
13447
|
options
|
|
13441
13448
|
);
|
|
13442
13449
|
}
|
|
13443
|
-
function lineString(coordinates2, properties, options = {}) {
|
|
13444
|
-
if (coordinates2.length < 2) {
|
|
13445
|
-
throw new Error("coordinates must be an array of two or more positions");
|
|
13446
|
-
}
|
|
13447
|
-
const geom = {
|
|
13448
|
-
type: "LineString",
|
|
13449
|
-
coordinates: coordinates2
|
|
13450
|
-
};
|
|
13451
|
-
return feature$1(geom, properties, options);
|
|
13452
|
-
}
|
|
13453
13450
|
function featureCollection(features, options = {}) {
|
|
13454
13451
|
const fc = { type: "FeatureCollection" };
|
|
13455
13452
|
if (options.id) {
|
|
@@ -13475,10 +13472,6 @@ function radiansToLength(radians2, units = "kilometers") {
|
|
|
13475
13472
|
}
|
|
13476
13473
|
return radians2 * factor;
|
|
13477
13474
|
}
|
|
13478
|
-
function radiansToDegrees(radians2) {
|
|
13479
|
-
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
13480
|
-
return normalisedRadians * 180 / Math.PI;
|
|
13481
|
-
}
|
|
13482
13475
|
function degreesToRadians(degrees2) {
|
|
13483
13476
|
const normalisedDegrees = degrees2 % 360;
|
|
13484
13477
|
return normalisedDegrees * Math.PI / 180;
|
|
@@ -13486,114 +13479,6 @@ function degreesToRadians(degrees2) {
|
|
|
13486
13479
|
function isNumber$1(num) {
|
|
13487
13480
|
return !isNaN(num) && num !== null && !Array.isArray(num);
|
|
13488
13481
|
}
|
|
13489
|
-
function isObject$4(input) {
|
|
13490
|
-
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
13491
|
-
}
|
|
13492
|
-
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
13493
|
-
if (geojson === null) return;
|
|
13494
|
-
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;
|
|
13495
|
-
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
13496
|
-
geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
|
|
13497
|
-
isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
|
|
13498
|
-
stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
|
|
13499
|
-
for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
|
|
13500
|
-
var multiFeatureIndex = 0;
|
|
13501
|
-
var geometryIndex = 0;
|
|
13502
|
-
geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
|
|
13503
|
-
if (geometry2 === null) continue;
|
|
13504
|
-
coords = geometry2.coordinates;
|
|
13505
|
-
var geomType = geometry2.type;
|
|
13506
|
-
wrapShrink = 0;
|
|
13507
|
-
switch (geomType) {
|
|
13508
|
-
case null:
|
|
13509
|
-
break;
|
|
13510
|
-
case "Point":
|
|
13511
|
-
if (callback(
|
|
13512
|
-
coords,
|
|
13513
|
-
coordIndex,
|
|
13514
|
-
featureIndex,
|
|
13515
|
-
multiFeatureIndex,
|
|
13516
|
-
geometryIndex
|
|
13517
|
-
) === false)
|
|
13518
|
-
return false;
|
|
13519
|
-
coordIndex++;
|
|
13520
|
-
multiFeatureIndex++;
|
|
13521
|
-
break;
|
|
13522
|
-
case "LineString":
|
|
13523
|
-
case "MultiPoint":
|
|
13524
|
-
for (j = 0; j < coords.length; j++) {
|
|
13525
|
-
if (callback(
|
|
13526
|
-
coords[j],
|
|
13527
|
-
coordIndex,
|
|
13528
|
-
featureIndex,
|
|
13529
|
-
multiFeatureIndex,
|
|
13530
|
-
geometryIndex
|
|
13531
|
-
) === false)
|
|
13532
|
-
return false;
|
|
13533
|
-
coordIndex++;
|
|
13534
|
-
if (geomType === "MultiPoint") multiFeatureIndex++;
|
|
13535
|
-
}
|
|
13536
|
-
if (geomType === "LineString") multiFeatureIndex++;
|
|
13537
|
-
break;
|
|
13538
|
-
case "Polygon":
|
|
13539
|
-
case "MultiLineString":
|
|
13540
|
-
for (j = 0; j < coords.length; j++) {
|
|
13541
|
-
for (k = 0; k < coords[j].length - wrapShrink; k++) {
|
|
13542
|
-
if (callback(
|
|
13543
|
-
coords[j][k],
|
|
13544
|
-
coordIndex,
|
|
13545
|
-
featureIndex,
|
|
13546
|
-
multiFeatureIndex,
|
|
13547
|
-
geometryIndex
|
|
13548
|
-
) === false)
|
|
13549
|
-
return false;
|
|
13550
|
-
coordIndex++;
|
|
13551
|
-
}
|
|
13552
|
-
if (geomType === "MultiLineString") multiFeatureIndex++;
|
|
13553
|
-
if (geomType === "Polygon") geometryIndex++;
|
|
13554
|
-
}
|
|
13555
|
-
if (geomType === "Polygon") multiFeatureIndex++;
|
|
13556
|
-
break;
|
|
13557
|
-
case "MultiPolygon":
|
|
13558
|
-
for (j = 0; j < coords.length; j++) {
|
|
13559
|
-
geometryIndex = 0;
|
|
13560
|
-
for (k = 0; k < coords[j].length; k++) {
|
|
13561
|
-
for (l2 = 0; l2 < coords[j][k].length - wrapShrink; l2++) {
|
|
13562
|
-
if (callback(
|
|
13563
|
-
coords[j][k][l2],
|
|
13564
|
-
coordIndex,
|
|
13565
|
-
featureIndex,
|
|
13566
|
-
multiFeatureIndex,
|
|
13567
|
-
geometryIndex
|
|
13568
|
-
) === false)
|
|
13569
|
-
return false;
|
|
13570
|
-
coordIndex++;
|
|
13571
|
-
}
|
|
13572
|
-
geometryIndex++;
|
|
13573
|
-
}
|
|
13574
|
-
multiFeatureIndex++;
|
|
13575
|
-
}
|
|
13576
|
-
break;
|
|
13577
|
-
case "GeometryCollection":
|
|
13578
|
-
for (j = 0; j < geometry2.geometries.length; j++)
|
|
13579
|
-
if (coordEach(geometry2.geometries[j], callback) === false)
|
|
13580
|
-
return false;
|
|
13581
|
-
break;
|
|
13582
|
-
default:
|
|
13583
|
-
throw new Error("Unknown Geometry Type");
|
|
13584
|
-
}
|
|
13585
|
-
}
|
|
13586
|
-
}
|
|
13587
|
-
}
|
|
13588
|
-
function featureEach(geojson, callback) {
|
|
13589
|
-
if (geojson.type === "Feature") {
|
|
13590
|
-
callback(geojson, 0);
|
|
13591
|
-
} else if (geojson.type === "FeatureCollection") {
|
|
13592
|
-
for (var i2 = 0; i2 < geojson.features.length; i2++) {
|
|
13593
|
-
if (callback(geojson.features[i2], i2) === false) break;
|
|
13594
|
-
}
|
|
13595
|
-
}
|
|
13596
|
-
}
|
|
13597
13482
|
function geomEach(geojson, callback) {
|
|
13598
13483
|
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;
|
|
13599
13484
|
for (i2 = 0; i2 < stop; i2++) {
|
|
@@ -13671,7 +13556,7 @@ function geomReduce(geojson, callback, initialValue) {
|
|
|
13671
13556
|
return previousValue;
|
|
13672
13557
|
}
|
|
13673
13558
|
function flattenEach(geojson, callback) {
|
|
13674
|
-
geomEach(geojson, function(geometry2, featureIndex, properties,
|
|
13559
|
+
geomEach(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
13675
13560
|
var type = geometry2 === null ? null : geometry2.type;
|
|
13676
13561
|
switch (type) {
|
|
13677
13562
|
case null:
|
|
@@ -13679,7 +13564,7 @@ function flattenEach(geojson, callback) {
|
|
|
13679
13564
|
case "LineString":
|
|
13680
13565
|
case "Polygon":
|
|
13681
13566
|
if (callback(
|
|
13682
|
-
feature$1(geometry2, properties, { bbox
|
|
13567
|
+
feature$1(geometry2, properties, { bbox, id }),
|
|
13683
13568
|
featureIndex,
|
|
13684
13569
|
0
|
|
13685
13570
|
) === false)
|
|
@@ -13727,46 +13612,6 @@ function flattenReduce(geojson, callback, initialValue) {
|
|
|
13727
13612
|
);
|
|
13728
13613
|
return previousValue;
|
|
13729
13614
|
}
|
|
13730
|
-
function segmentEach(geojson, callback) {
|
|
13731
|
-
flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
13732
|
-
var segmentIndex = 0;
|
|
13733
|
-
if (!feature2.geometry) return;
|
|
13734
|
-
var type = feature2.geometry.type;
|
|
13735
|
-
if (type === "Point" || type === "MultiPoint") return;
|
|
13736
|
-
var previousCoords;
|
|
13737
|
-
var previousFeatureIndex = 0;
|
|
13738
|
-
var previousMultiIndex = 0;
|
|
13739
|
-
var prevGeomIndex = 0;
|
|
13740
|
-
if (coordEach(
|
|
13741
|
-
feature2,
|
|
13742
|
-
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
13743
|
-
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
13744
|
-
previousCoords = currentCoord;
|
|
13745
|
-
previousFeatureIndex = featureIndex;
|
|
13746
|
-
previousMultiIndex = multiPartIndexCoord;
|
|
13747
|
-
prevGeomIndex = geometryIndex;
|
|
13748
|
-
segmentIndex = 0;
|
|
13749
|
-
return;
|
|
13750
|
-
}
|
|
13751
|
-
var currentSegment = lineString(
|
|
13752
|
-
[previousCoords, currentCoord],
|
|
13753
|
-
feature2.properties
|
|
13754
|
-
);
|
|
13755
|
-
if (callback(
|
|
13756
|
-
currentSegment,
|
|
13757
|
-
featureIndex,
|
|
13758
|
-
multiFeatureIndex,
|
|
13759
|
-
geometryIndex,
|
|
13760
|
-
segmentIndex
|
|
13761
|
-
) === false)
|
|
13762
|
-
return false;
|
|
13763
|
-
segmentIndex++;
|
|
13764
|
-
previousCoords = currentCoord;
|
|
13765
|
-
}
|
|
13766
|
-
) === false)
|
|
13767
|
-
return false;
|
|
13768
|
-
});
|
|
13769
|
-
}
|
|
13770
13615
|
var concaveman = { exports: {} };
|
|
13771
13616
|
var rbush_min$1 = { exports: {} };
|
|
13772
13617
|
var rbush_min = rbush_min$1.exports;
|
|
@@ -14172,7 +14017,7 @@ var hasRequiredConcaveman;
|
|
|
14172
14017
|
function requireConcaveman() {
|
|
14173
14018
|
if (hasRequiredConcaveman) return concaveman.exports;
|
|
14174
14019
|
hasRequiredConcaveman = 1;
|
|
14175
|
-
var
|
|
14020
|
+
var RBush = requireRbush_min();
|
|
14176
14021
|
var Queue = require$$1$3;
|
|
14177
14022
|
var pointInPolygon2 = requirePointInPolygon();
|
|
14178
14023
|
var orient = requireOrient2d_min().orient2d;
|
|
@@ -14185,7 +14030,7 @@ function requireConcaveman() {
|
|
|
14185
14030
|
concavity = Math.max(0, concavity === void 0 ? 2 : concavity);
|
|
14186
14031
|
lengthThreshold = lengthThreshold || 0;
|
|
14187
14032
|
var hull = fastConvexHull(points);
|
|
14188
|
-
var tree = new
|
|
14033
|
+
var tree = new RBush(16);
|
|
14189
14034
|
tree.toBBox = function(a3) {
|
|
14190
14035
|
return {
|
|
14191
14036
|
minX: a3[0],
|
|
@@ -14208,7 +14053,7 @@ function requireConcaveman() {
|
|
|
14208
14053
|
last = insertNode(p, last);
|
|
14209
14054
|
queue.push(last);
|
|
14210
14055
|
}
|
|
14211
|
-
var segTree = new
|
|
14056
|
+
var segTree = new RBush(16);
|
|
14212
14057
|
for (i2 = 0; i2 < queue.length; i2++) segTree.insert(updateBBox(queue[i2]));
|
|
14213
14058
|
var sqConcavity = concavity * concavity;
|
|
14214
14059
|
var sqLenThreshold = lengthThreshold * lengthThreshold;
|
|
@@ -14266,20 +14111,20 @@ function requireConcaveman() {
|
|
|
14266
14111
|
function compareDist(a2, b) {
|
|
14267
14112
|
return a2.dist - b.dist;
|
|
14268
14113
|
}
|
|
14269
|
-
function sqSegBoxDist(a2, b,
|
|
14270
|
-
if (inside(a2,
|
|
14271
|
-
var d1 = sqSegSegDist(a2[0], a2[1], b[0], b[1],
|
|
14114
|
+
function sqSegBoxDist(a2, b, bbox) {
|
|
14115
|
+
if (inside(a2, bbox) || inside(b, bbox)) return 0;
|
|
14116
|
+
var d1 = sqSegSegDist(a2[0], a2[1], b[0], b[1], bbox.minX, bbox.minY, bbox.maxX, bbox.minY);
|
|
14272
14117
|
if (d1 === 0) return 0;
|
|
14273
|
-
var d2 = sqSegSegDist(a2[0], a2[1], b[0], b[1],
|
|
14118
|
+
var d2 = sqSegSegDist(a2[0], a2[1], b[0], b[1], bbox.minX, bbox.minY, bbox.minX, bbox.maxY);
|
|
14274
14119
|
if (d2 === 0) return 0;
|
|
14275
|
-
var d3 = sqSegSegDist(a2[0], a2[1], b[0], b[1],
|
|
14120
|
+
var d3 = sqSegSegDist(a2[0], a2[1], b[0], b[1], bbox.maxX, bbox.minY, bbox.maxX, bbox.maxY);
|
|
14276
14121
|
if (d3 === 0) return 0;
|
|
14277
|
-
var d4 = sqSegSegDist(a2[0], a2[1], b[0], b[1],
|
|
14122
|
+
var d4 = sqSegSegDist(a2[0], a2[1], b[0], b[1], bbox.minX, bbox.maxY, bbox.maxX, bbox.maxY);
|
|
14278
14123
|
if (d4 === 0) return 0;
|
|
14279
14124
|
return Math.min(d1, d2, d3, d4);
|
|
14280
14125
|
}
|
|
14281
|
-
function inside(a2,
|
|
14282
|
-
return a2[0] >=
|
|
14126
|
+
function inside(a2, bbox) {
|
|
14127
|
+
return a2[0] >= bbox.minX && a2[0] <= bbox.maxX && a2[1] >= bbox.minY && a2[1] <= bbox.maxY;
|
|
14283
14128
|
}
|
|
14284
14129
|
function noIntersections(a2, b, segTree) {
|
|
14285
14130
|
var minX = Math.min(a2[0], b[0]);
|
|
@@ -14288,14 +14133,14 @@ function requireConcaveman() {
|
|
|
14288
14133
|
var maxY = Math.max(a2[1], b[1]);
|
|
14289
14134
|
var edges = segTree.search({ minX, minY, maxX, maxY });
|
|
14290
14135
|
for (var i2 = 0; i2 < edges.length; i2++) {
|
|
14291
|
-
if (
|
|
14136
|
+
if (intersects(edges[i2].p, edges[i2].next.p, a2, b)) return false;
|
|
14292
14137
|
}
|
|
14293
14138
|
return true;
|
|
14294
14139
|
}
|
|
14295
14140
|
function cross2(p1, p2, p3) {
|
|
14296
14141
|
return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
|
|
14297
14142
|
}
|
|
14298
|
-
function
|
|
14143
|
+
function intersects(p1, q1, p2, q2) {
|
|
14299
14144
|
return p1 !== q2 && q1 !== p2 && cross2(p1, q1, p2) > 0 !== cross2(p1, q1, q2) > 0 && cross2(p2, q2, p1) > 0 !== cross2(p2, q2, q1) > 0;
|
|
14300
14145
|
}
|
|
14301
14146
|
function updateBBox(node2) {
|
|
@@ -16760,10 +16605,10 @@ function normalize$4(out, a2) {
|
|
|
16760
16605
|
out[2] = a2[2] * len2;
|
|
16761
16606
|
return out;
|
|
16762
16607
|
}
|
|
16763
|
-
function dot$
|
|
16608
|
+
function dot$3(a2, b) {
|
|
16764
16609
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2];
|
|
16765
16610
|
}
|
|
16766
|
-
function cross
|
|
16611
|
+
function cross(out, a2, b) {
|
|
16767
16612
|
var ax = a2[0], ay = a2[1], az = a2[2];
|
|
16768
16613
|
var bx = b[0], by = b[1], bz = b[2];
|
|
16769
16614
|
out[0] = ay * bz - az * by;
|
|
@@ -16852,8 +16697,8 @@ function rotateZ$2(out, a2, b, rad) {
|
|
|
16852
16697
|
out[2] = r2[2] + b[2];
|
|
16853
16698
|
return out;
|
|
16854
16699
|
}
|
|
16855
|
-
function angle$
|
|
16856
|
-
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$
|
|
16700
|
+
function angle$1(a2, b) {
|
|
16701
|
+
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;
|
|
16857
16702
|
return Math.acos(Math.min(Math.max(cosine2, -1), 1));
|
|
16858
16703
|
}
|
|
16859
16704
|
var sub$1 = subtract$1;
|
|
@@ -16952,10 +16797,10 @@ class Vector3 extends Vector {
|
|
|
16952
16797
|
this[2] = checkNumber(value);
|
|
16953
16798
|
}
|
|
16954
16799
|
angle(vector) {
|
|
16955
|
-
return angle$
|
|
16800
|
+
return angle$1(this, vector);
|
|
16956
16801
|
}
|
|
16957
16802
|
cross(vector) {
|
|
16958
|
-
cross
|
|
16803
|
+
cross(this, this, vector);
|
|
16959
16804
|
return this.check();
|
|
16960
16805
|
}
|
|
16961
16806
|
rotateX({
|
|
@@ -18072,7 +17917,7 @@ function normalize$3(out, a2) {
|
|
|
18072
17917
|
out[3] = w2 * len2;
|
|
18073
17918
|
return out;
|
|
18074
17919
|
}
|
|
18075
|
-
function dot$
|
|
17920
|
+
function dot$2(a2, b) {
|
|
18076
17921
|
return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2] + a2[3] * b[3];
|
|
18077
17922
|
}
|
|
18078
17923
|
function lerp$3(out, a2, b, t) {
|
|
@@ -18688,7 +18533,7 @@ function fromMat3(out, m) {
|
|
|
18688
18533
|
}
|
|
18689
18534
|
var add$3 = add$4;
|
|
18690
18535
|
var scale = scale$1;
|
|
18691
|
-
var dot$
|
|
18536
|
+
var dot$1 = dot$2;
|
|
18692
18537
|
var lerp$2 = lerp$3;
|
|
18693
18538
|
var length$2 = length$3;
|
|
18694
18539
|
var squaredLength = squaredLength$1;
|
|
@@ -18698,10 +18543,10 @@ var rotationTo = function() {
|
|
|
18698
18543
|
var xUnitVec3 = fromValues(1, 0, 0);
|
|
18699
18544
|
var yUnitVec3 = fromValues(0, 1, 0);
|
|
18700
18545
|
return function(out, a2, b) {
|
|
18701
|
-
var dot2 = dot$
|
|
18546
|
+
var dot2 = dot$3(a2, b);
|
|
18702
18547
|
if (dot2 < -0.999999) {
|
|
18703
|
-
cross
|
|
18704
|
-
if (len(tmpvec3) < 1e-6) cross
|
|
18548
|
+
cross(tmpvec3, xUnitVec3, a2);
|
|
18549
|
+
if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2);
|
|
18705
18550
|
normalize$4(tmpvec3, tmpvec3);
|
|
18706
18551
|
setAxisAngle(out, tmpvec3, Math.PI);
|
|
18707
18552
|
return out;
|
|
@@ -18712,7 +18557,7 @@ var rotationTo = function() {
|
|
|
18712
18557
|
out[3] = 1;
|
|
18713
18558
|
return out;
|
|
18714
18559
|
} else {
|
|
18715
|
-
cross
|
|
18560
|
+
cross(tmpvec3, a2, b);
|
|
18716
18561
|
out[0] = tmpvec3[0];
|
|
18717
18562
|
out[1] = tmpvec3[1];
|
|
18718
18563
|
out[2] = tmpvec3[2];
|
|
@@ -18826,7 +18671,7 @@ class Quaternion extends MathArray {
|
|
|
18826
18671
|
return squaredLength(this);
|
|
18827
18672
|
}
|
|
18828
18673
|
dot(a2) {
|
|
18829
|
-
return dot$
|
|
18674
|
+
return dot$1(this, a2);
|
|
18830
18675
|
}
|
|
18831
18676
|
rotationTo(vectorA, vectorB) {
|
|
18832
18677
|
rotationTo(this, vectorA, vectorB);
|
|
@@ -19750,7 +19595,7 @@ function isDate(x) {
|
|
|
19750
19595
|
function isRegExp(x) {
|
|
19751
19596
|
return x instanceof RegExp;
|
|
19752
19597
|
}
|
|
19753
|
-
function isObject$
|
|
19598
|
+
function isObject$2(x) {
|
|
19754
19599
|
return !!(x && typeof x === "object" && x.constructor === Object && !isComplex(x) && !isFraction(x));
|
|
19755
19600
|
}
|
|
19756
19601
|
function isNull(x) {
|
|
@@ -19857,7 +19702,7 @@ function mapObject(object2, callback) {
|
|
|
19857
19702
|
}
|
|
19858
19703
|
return clone2;
|
|
19859
19704
|
}
|
|
19860
|
-
function extend
|
|
19705
|
+
function extend(a2, b) {
|
|
19861
19706
|
for (var prop in b) {
|
|
19862
19707
|
if (hasOwnProperty$2(b, prop)) {
|
|
19863
19708
|
a2[prop] = b[prop];
|
|
@@ -21722,7 +21567,7 @@ var createTyped = /* @__PURE__ */ factory("typed", dependencies$Q, function crea
|
|
|
21722
21567
|
},
|
|
21723
21568
|
{
|
|
21724
21569
|
name: "Object",
|
|
21725
|
-
test: isObject$
|
|
21570
|
+
test: isObject$2
|
|
21726
21571
|
}
|
|
21727
21572
|
// order 'Object' last, it matches on other classes too
|
|
21728
21573
|
];
|
|
@@ -28797,7 +28642,7 @@ var createMultiply = /* @__PURE__ */ factory(name$v, dependencies$o, (_ref) => {
|
|
|
28797
28642
|
cptr[bcolumns] = cindex.length;
|
|
28798
28643
|
return c;
|
|
28799
28644
|
}
|
|
28800
|
-
return typed2(name$v, extend
|
|
28645
|
+
return typed2(name$v, extend({
|
|
28801
28646
|
// we extend the signatures of multiplyScalar with signatures dealing with matrices
|
|
28802
28647
|
"Array, Array": function ArrayArray(x, y) {
|
|
28803
28648
|
_validateMatrixDimensions(arraySize(x), arraySize(y));
|
|
@@ -34216,7 +34061,7 @@ var createDivide = /* @__PURE__ */ factory(name$7, dependencies, (_ref) => {
|
|
|
34216
34061
|
var algorithm14 = createAlgorithm14({
|
|
34217
34062
|
typed: typed2
|
|
34218
34063
|
});
|
|
34219
|
-
return typed2("divide", extend
|
|
34064
|
+
return typed2("divide", extend({
|
|
34220
34065
|
// we extend the signatures of divideScalar with signatures dealing with matrices
|
|
34221
34066
|
"Array | Matrix, Array | Matrix": function ArrayMatrixArrayMatrix(x, y) {
|
|
34222
34067
|
return multiply2(x, inv2(y));
|
|
@@ -34351,7 +34196,7 @@ var FibonacciHeap = /* @__PURE__ */ createFibonacciHeapClass({
|
|
|
34351
34196
|
larger,
|
|
34352
34197
|
smaller: smaller$1
|
|
34353
34198
|
});
|
|
34354
|
-
var dot
|
|
34199
|
+
var dot = /* @__PURE__ */ createDot({
|
|
34355
34200
|
addScalar,
|
|
34356
34201
|
conj,
|
|
34357
34202
|
multiplyScalar,
|
|
@@ -34367,7 +34212,7 @@ var floor = /* @__PURE__ */ createFloor({
|
|
|
34367
34212
|
});
|
|
34368
34213
|
var multiply = /* @__PURE__ */ createMultiply({
|
|
34369
34214
|
addScalar,
|
|
34370
|
-
dot
|
|
34215
|
+
dot,
|
|
34371
34216
|
equalScalar,
|
|
34372
34217
|
matrix,
|
|
34373
34218
|
multiplyScalar,
|
|
@@ -34400,7 +34245,7 @@ var subtract = /* @__PURE__ */ createSubtract({
|
|
|
34400
34245
|
typed,
|
|
34401
34246
|
unaryMinus
|
|
34402
34247
|
});
|
|
34403
|
-
var equal
|
|
34248
|
+
var equal = /* @__PURE__ */ createEqual({
|
|
34404
34249
|
DenseMatrix,
|
|
34405
34250
|
equalScalar,
|
|
34406
34251
|
matrix,
|
|
@@ -34479,7 +34324,7 @@ var Unit = /* @__PURE__ */ createUnitClass({
|
|
|
34479
34324
|
addScalar,
|
|
34480
34325
|
config: config$1,
|
|
34481
34326
|
divideScalar,
|
|
34482
|
-
equal
|
|
34327
|
+
equal,
|
|
34483
34328
|
fix,
|
|
34484
34329
|
format,
|
|
34485
34330
|
isNumeric: isNumeric$1,
|
|
@@ -35505,15 +35350,15 @@ function dirname(url) {
|
|
|
35505
35350
|
}
|
|
35506
35351
|
const isBoolean = (x) => typeof x === "boolean";
|
|
35507
35352
|
const isFunction = (x) => typeof x === "function";
|
|
35508
|
-
const isObject$
|
|
35509
|
-
const isPureObject = (x) => isObject$
|
|
35353
|
+
const isObject$1 = (x) => x !== null && typeof x === "object";
|
|
35354
|
+
const isPureObject = (x) => isObject$1(x) && x.constructor === {}.constructor;
|
|
35510
35355
|
const isIterable = (x) => x && typeof x[Symbol.iterator] === "function";
|
|
35511
35356
|
const isAsyncIterable$1 = (x) => x && typeof x[Symbol.asyncIterator] === "function";
|
|
35512
35357
|
const isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
|
|
35513
35358
|
const isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
|
|
35514
35359
|
const isBuffer = (x) => x && typeof x === "object" && x.isBuffer;
|
|
35515
|
-
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$
|
|
35516
|
-
const isReadableNodeStream = (x) => isObject$
|
|
35360
|
+
const isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject$1(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
|
|
35361
|
+
const isReadableNodeStream = (x) => isObject$1(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
|
|
35517
35362
|
const isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
|
|
35518
35363
|
const DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
|
|
35519
35364
|
const MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
|
|
@@ -36312,7 +36157,7 @@ function getFetchFunction(options, context) {
|
|
|
36312
36157
|
if (typeof fetchOptions.fetch === "function") {
|
|
36313
36158
|
return fetchOptions.fetch;
|
|
36314
36159
|
}
|
|
36315
|
-
if (isObject$
|
|
36160
|
+
if (isObject$1(fetchOptions.fetch)) {
|
|
36316
36161
|
return (url) => fetchFile(url, fetchOptions);
|
|
36317
36162
|
}
|
|
36318
36163
|
if (context !== null && context !== void 0 && context.fetch) {
|
|
@@ -36333,7 +36178,7 @@ function validateOptionsObject(options, id, defaultOptions, deprecatedOptions, l
|
|
|
36333
36178
|
const loaderName = id || "Top level";
|
|
36334
36179
|
const prefix = id ? "".concat(id, ".") : "";
|
|
36335
36180
|
for (const key in options) {
|
|
36336
|
-
const isSubOptions = !id && isObject$
|
|
36181
|
+
const isSubOptions = !id && isObject$1(options[key]);
|
|
36337
36182
|
const isBaseUriOption = key === "baseUri" && !id;
|
|
36338
36183
|
const isWorkerUrlOption = key === "workerUrl" && id;
|
|
36339
36184
|
if (!(key in defaultOptions) && !isBaseUriOption && !isWorkerUrlOption) {
|
|
@@ -59513,7 +59358,7 @@ function getPropTypes(props) {
|
|
|
59513
59358
|
const ERR_NOT_OBJECT = "count(): argument not an object";
|
|
59514
59359
|
const ERR_NOT_CONTAINER = "count(): argument not a container";
|
|
59515
59360
|
function count(container) {
|
|
59516
|
-
if (!isObject
|
|
59361
|
+
if (!isObject(container)) {
|
|
59517
59362
|
throw new Error(ERR_NOT_OBJECT);
|
|
59518
59363
|
}
|
|
59519
59364
|
if (typeof container.count === "function") {
|
|
@@ -59533,7 +59378,7 @@ function count(container) {
|
|
|
59533
59378
|
function isPlainObject(value) {
|
|
59534
59379
|
return value !== null && typeof value === "object" && value.constructor === Object;
|
|
59535
59380
|
}
|
|
59536
|
-
function isObject
|
|
59381
|
+
function isObject(value) {
|
|
59537
59382
|
return value !== null && typeof value === "object";
|
|
59538
59383
|
}
|
|
59539
59384
|
function mergeShaders(target, source) {
|
|
@@ -63866,35 +63711,35 @@ function getPointAtIndex(positions, index2, size2, offset, out = []) {
|
|
|
63866
63711
|
}
|
|
63867
63712
|
return out;
|
|
63868
63713
|
}
|
|
63869
|
-
function intersect(a2, b, edge,
|
|
63714
|
+
function intersect(a2, b, edge, bbox, out = []) {
|
|
63870
63715
|
let t;
|
|
63871
63716
|
let snap;
|
|
63872
63717
|
if (edge & 8) {
|
|
63873
|
-
t = (
|
|
63718
|
+
t = (bbox[3] - a2[1]) / (b[1] - a2[1]);
|
|
63874
63719
|
snap = 3;
|
|
63875
63720
|
} else if (edge & 4) {
|
|
63876
|
-
t = (
|
|
63721
|
+
t = (bbox[1] - a2[1]) / (b[1] - a2[1]);
|
|
63877
63722
|
snap = 1;
|
|
63878
63723
|
} else if (edge & 2) {
|
|
63879
|
-
t = (
|
|
63724
|
+
t = (bbox[2] - a2[0]) / (b[0] - a2[0]);
|
|
63880
63725
|
snap = 2;
|
|
63881
63726
|
} else if (edge & 1) {
|
|
63882
|
-
t = (
|
|
63727
|
+
t = (bbox[0] - a2[0]) / (b[0] - a2[0]);
|
|
63883
63728
|
snap = 0;
|
|
63884
63729
|
} else {
|
|
63885
63730
|
return null;
|
|
63886
63731
|
}
|
|
63887
63732
|
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
63888
|
-
out[i2] = (snap & 1) === i2 ?
|
|
63733
|
+
out[i2] = (snap & 1) === i2 ? bbox[snap] : t * (b[i2] - a2[i2]) + a2[i2];
|
|
63889
63734
|
}
|
|
63890
63735
|
return out;
|
|
63891
63736
|
}
|
|
63892
|
-
function bitCode(p,
|
|
63737
|
+
function bitCode(p, bbox) {
|
|
63893
63738
|
let code = 0;
|
|
63894
|
-
if (p[0] <
|
|
63895
|
-
else if (p[0] >
|
|
63896
|
-
if (p[1] <
|
|
63897
|
-
else if (p[1] >
|
|
63739
|
+
if (p[0] < bbox[0]) code |= 1;
|
|
63740
|
+
else if (p[0] > bbox[2]) code |= 2;
|
|
63741
|
+
if (p[1] < bbox[1]) code |= 4;
|
|
63742
|
+
else if (p[1] > bbox[3]) code |= 8;
|
|
63898
63743
|
return code;
|
|
63899
63744
|
}
|
|
63900
63745
|
function cutPolylineByGrid(positions, options) {
|
|
@@ -63964,7 +63809,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
63964
63809
|
types: edgeTypes ? new Array(positions.length / size2).fill(TYPE_BORDER) : null,
|
|
63965
63810
|
holes: holeIndices || []
|
|
63966
63811
|
}];
|
|
63967
|
-
const
|
|
63812
|
+
const bbox = [[], []];
|
|
63968
63813
|
let cell = [];
|
|
63969
63814
|
while (queue.length) {
|
|
63970
63815
|
const {
|
|
@@ -63972,9 +63817,9 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
63972
63817
|
types,
|
|
63973
63818
|
holes
|
|
63974
63819
|
} = queue.shift();
|
|
63975
|
-
getBoundingBox$2(pos, size2, holes[0] || pos.length,
|
|
63976
|
-
cell = getGridCell(
|
|
63977
|
-
const code = bitCode(
|
|
63820
|
+
getBoundingBox$2(pos, size2, holes[0] || pos.length, bbox);
|
|
63821
|
+
cell = getGridCell(bbox[0], gridResolution, gridOffset, cell);
|
|
63822
|
+
const code = bitCode(bbox[1], cell);
|
|
63978
63823
|
if (code) {
|
|
63979
63824
|
let parts = bisectPolygon(pos, types, size2, 0, holes[0] || pos.length, cell, code);
|
|
63980
63825
|
const polygonLow = {
|
|
@@ -64020,7 +63865,7 @@ function cutPolygonByGrid(positions, holeIndices = null, options) {
|
|
|
64020
63865
|
}
|
|
64021
63866
|
return result;
|
|
64022
63867
|
}
|
|
64023
|
-
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex,
|
|
63868
|
+
function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox, edge) {
|
|
64024
63869
|
const numPoints = (endIndex - startIndex) / size2;
|
|
64025
63870
|
const resultLow = [];
|
|
64026
63871
|
const resultHigh = [];
|
|
@@ -64031,16 +63876,16 @@ function bisectPolygon(positions, edgeTypes, size2, startIndex, endIndex, bbox2,
|
|
|
64031
63876
|
let side;
|
|
64032
63877
|
let type;
|
|
64033
63878
|
const prev = getPointAtIndex(positions, numPoints - 1, size2, startIndex);
|
|
64034
|
-
let prevSide = Math.sign(edge & 8 ? prev[1] -
|
|
63879
|
+
let prevSide = Math.sign(edge & 8 ? prev[1] - bbox[3] : prev[0] - bbox[2]);
|
|
64035
63880
|
let prevType = edgeTypes && edgeTypes[numPoints - 1];
|
|
64036
63881
|
let lowPointCount = 0;
|
|
64037
63882
|
let highPointCount = 0;
|
|
64038
63883
|
for (let i2 = 0; i2 < numPoints; i2++) {
|
|
64039
63884
|
p = getPointAtIndex(positions, i2, size2, startIndex, p);
|
|
64040
|
-
side = Math.sign(edge & 8 ? p[1] -
|
|
63885
|
+
side = Math.sign(edge & 8 ? p[1] - bbox[3] : p[0] - bbox[2]);
|
|
64041
63886
|
type = edgeTypes && edgeTypes[startIndex / size2 + i2];
|
|
64042
63887
|
if (side && prevSide && prevSide !== side) {
|
|
64043
|
-
intersect(prev, p, edge,
|
|
63888
|
+
intersect(prev, p, edge, bbox, scratchPoint);
|
|
64044
63889
|
push(resultLow, scratchPoint) && typesLow.push(prevType);
|
|
64045
63890
|
push(resultHigh, scratchPoint) && typesHigh.push(prevType);
|
|
64046
63891
|
}
|
|
@@ -65172,7 +65017,7 @@ function requireEarcut() {
|
|
|
65172
65017
|
var p = start;
|
|
65173
65018
|
do {
|
|
65174
65019
|
var a2 = p.prev, b = p.next.next;
|
|
65175
|
-
if (!equals2(a2, b) &&
|
|
65020
|
+
if (!equals2(a2, b) && intersects(a2, p, p.next, b) && locallyInside(a2, b) && locallyInside(b, a2)) {
|
|
65176
65021
|
triangles.push(a2.i / dim | 0);
|
|
65177
65022
|
triangles.push(p.i / dim | 0);
|
|
65178
65023
|
triangles.push(b.i / dim | 0);
|
|
@@ -65347,7 +65192,7 @@ function requireEarcut() {
|
|
|
65347
65192
|
function equals2(p1, p2) {
|
|
65348
65193
|
return p1.x === p2.x && p1.y === p2.y;
|
|
65349
65194
|
}
|
|
65350
|
-
function
|
|
65195
|
+
function intersects(p1, q1, p2, q2) {
|
|
65351
65196
|
var o1 = sign2(area2(p1, q1, p2));
|
|
65352
65197
|
var o2 = sign2(area2(p1, q1, q2));
|
|
65353
65198
|
var o3 = sign2(area2(p2, q2, p1));
|
|
@@ -65368,7 +65213,7 @@ function requireEarcut() {
|
|
|
65368
65213
|
function intersectsPolygon(a2, b) {
|
|
65369
65214
|
var p = a2;
|
|
65370
65215
|
do {
|
|
65371
|
-
if (p.i !== a2.i && p.next.i !== a2.i && p.i !== b.i && p.next.i !== b.i &&
|
|
65216
|
+
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;
|
|
65372
65217
|
p = p.next;
|
|
65373
65218
|
} while (p !== a2);
|
|
65374
65219
|
return false;
|
|
@@ -71404,7 +71249,7 @@ class Tile2DHeader {
|
|
|
71404
71249
|
const {
|
|
71405
71250
|
index: index2,
|
|
71406
71251
|
id,
|
|
71407
|
-
bbox
|
|
71252
|
+
bbox,
|
|
71408
71253
|
userData,
|
|
71409
71254
|
zoom
|
|
71410
71255
|
} = this;
|
|
@@ -71430,7 +71275,7 @@ class Tile2DHeader {
|
|
|
71430
71275
|
tileData = await getData({
|
|
71431
71276
|
index: index2,
|
|
71432
71277
|
id,
|
|
71433
|
-
bbox
|
|
71278
|
+
bbox,
|
|
71434
71279
|
userData,
|
|
71435
71280
|
zoom,
|
|
71436
71281
|
signal
|
|
@@ -72304,8 +72149,8 @@ const urlType = {
|
|
|
72304
72149
|
return true;
|
|
72305
72150
|
}
|
|
72306
72151
|
};
|
|
72307
|
-
function transformBox(
|
|
72308
|
-
const transformedCoords = [modelMatrix2.transformAsPoint([
|
|
72152
|
+
function transformBox(bbox, modelMatrix2) {
|
|
72153
|
+
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]])];
|
|
72309
72154
|
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]))];
|
|
72310
72155
|
return transformedBox;
|
|
72311
72156
|
}
|
|
@@ -72373,12 +72218,12 @@ function getCullBoundsInViewport(viewport, z2, cullRect) {
|
|
|
72373
72218
|
const bounds1 = getCullBoundsInViewport(viewport, z2[1], cullRect);
|
|
72374
72219
|
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])];
|
|
72375
72220
|
}
|
|
72376
|
-
function getIndexingCoords(
|
|
72221
|
+
function getIndexingCoords(bbox, scale2, modelMatrixInverse) {
|
|
72377
72222
|
if (modelMatrixInverse) {
|
|
72378
|
-
const transformedTileIndex = transformBox(
|
|
72223
|
+
const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
72379
72224
|
return transformedTileIndex;
|
|
72380
72225
|
}
|
|
72381
|
-
return
|
|
72226
|
+
return bbox.map((i2) => i2 * scale2 / TILE_SIZE$1);
|
|
72382
72227
|
}
|
|
72383
72228
|
function getScale(z2, tileSize) {
|
|
72384
72229
|
return Math.pow(2, z2) * TILE_SIZE$1 / tileSize;
|
|
@@ -72415,9 +72260,9 @@ function tileToBoundingBox(viewport, x, y, z2, tileSize = TILE_SIZE$1) {
|
|
|
72415
72260
|
};
|
|
72416
72261
|
}
|
|
72417
72262
|
function getIdentityTileIndices(viewport, z2, tileSize, extent2, modelMatrixInverse) {
|
|
72418
|
-
const
|
|
72263
|
+
const bbox = getBoundingBox(viewport, null, extent2);
|
|
72419
72264
|
const scale2 = getScale(z2, tileSize);
|
|
72420
|
-
const [minX, minY, maxX, maxY] = getIndexingCoords(
|
|
72265
|
+
const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale2, modelMatrixInverse);
|
|
72421
72266
|
const indices = [];
|
|
72422
72267
|
for (let x = Math.floor(minX); x < maxX; x++) {
|
|
72423
72268
|
for (let y = Math.floor(minY); y < maxY; y++) {
|
|
@@ -72606,16 +72451,16 @@ class Tileset2D {
|
|
|
72606
72451
|
cullRect
|
|
72607
72452
|
});
|
|
72608
72453
|
const {
|
|
72609
|
-
bbox
|
|
72454
|
+
bbox
|
|
72610
72455
|
} = tile;
|
|
72611
72456
|
for (const [minX, minY, maxX, maxY] of boundsArr) {
|
|
72612
72457
|
let overlaps;
|
|
72613
|
-
if ("west" in
|
|
72614
|
-
overlaps =
|
|
72458
|
+
if ("west" in bbox) {
|
|
72459
|
+
overlaps = bbox.west < maxX && bbox.east > minX && bbox.south < maxY && bbox.north > minY;
|
|
72615
72460
|
} else {
|
|
72616
|
-
const y02 = Math.min(
|
|
72617
|
-
const y12 = Math.max(
|
|
72618
|
-
overlaps =
|
|
72461
|
+
const y02 = Math.min(bbox.top, bbox.bottom);
|
|
72462
|
+
const y12 = Math.max(bbox.top, bbox.bottom);
|
|
72463
|
+
overlaps = bbox.left < maxX && bbox.right > minX && y02 < maxY && y12 > minY;
|
|
72619
72464
|
}
|
|
72620
72465
|
if (overlaps) {
|
|
72621
72466
|
return true;
|
|
@@ -89905,7 +89750,7 @@ class Ellipsoid {
|
|
|
89905
89750
|
h.copy(scratchCartesian).subtract(point2);
|
|
89906
89751
|
const longitude = Math.atan2(normal.y, normal.x);
|
|
89907
89752
|
const latitude = Math.asin(normal.z);
|
|
89908
|
-
const height = Math.sign(dot$
|
|
89753
|
+
const height = Math.sign(dot$3(h, scratchCartesian)) * length$4(h);
|
|
89909
89754
|
return toCartographicFromRadians([longitude, latitude, height], result);
|
|
89910
89755
|
}
|
|
89911
89756
|
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
|
|
@@ -94309,13 +94154,13 @@ class TerrainLayer extends CompositeLayer {
|
|
|
94309
94154
|
let bottomLeft = [0, 0];
|
|
94310
94155
|
let topRight = [0, 0];
|
|
94311
94156
|
if (viewport.isGeospatial) {
|
|
94312
|
-
const
|
|
94313
|
-
bottomLeft = viewport.projectFlat([
|
|
94314
|
-
topRight = viewport.projectFlat([
|
|
94157
|
+
const bbox = tile.bbox;
|
|
94158
|
+
bottomLeft = viewport.projectFlat([bbox.west, bbox.south]);
|
|
94159
|
+
topRight = viewport.projectFlat([bbox.east, bbox.north]);
|
|
94315
94160
|
} else {
|
|
94316
|
-
const
|
|
94317
|
-
bottomLeft = [
|
|
94318
|
-
topRight = [
|
|
94161
|
+
const bbox = tile.bbox;
|
|
94162
|
+
bottomLeft = [bbox.left, bbox.bottom];
|
|
94163
|
+
topRight = [bbox.right, bbox.top];
|
|
94319
94164
|
}
|
|
94320
94165
|
const bounds2 = [bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]];
|
|
94321
94166
|
const terrain = this.loadTerrain({
|
|
@@ -94686,27 +94531,27 @@ function Point([pointX, pointY], [nw, se], viewport) {
|
|
|
94686
94531
|
const y = lerp$6(nw[1], se[1], pointY);
|
|
94687
94532
|
return viewport.unprojectFlat([x, y]);
|
|
94688
94533
|
}
|
|
94689
|
-
function getPoints(geometry2,
|
|
94690
|
-
return geometry2.map((g2) => Point(g2,
|
|
94534
|
+
function getPoints(geometry2, bbox, viewport) {
|
|
94535
|
+
return geometry2.map((g2) => Point(g2, bbox, viewport));
|
|
94691
94536
|
}
|
|
94692
|
-
function MultiPoint(multiPoint,
|
|
94693
|
-
return getPoints(multiPoint,
|
|
94537
|
+
function MultiPoint(multiPoint, bbox, viewport) {
|
|
94538
|
+
return getPoints(multiPoint, bbox, viewport);
|
|
94694
94539
|
}
|
|
94695
|
-
function LineString(line,
|
|
94696
|
-
return getPoints(line,
|
|
94540
|
+
function LineString(line, bbox, viewport) {
|
|
94541
|
+
return getPoints(line, bbox, viewport);
|
|
94697
94542
|
}
|
|
94698
|
-
function MultiLineString(multiLineString,
|
|
94699
|
-
return multiLineString.map((
|
|
94543
|
+
function MultiLineString(multiLineString, bbox, viewport) {
|
|
94544
|
+
return multiLineString.map((lineString) => LineString(lineString, bbox, viewport));
|
|
94700
94545
|
}
|
|
94701
|
-
function Polygon(polygon2,
|
|
94702
|
-
return polygon2.map((polygonRing) => getPoints(polygonRing,
|
|
94546
|
+
function Polygon(polygon2, bbox, viewport) {
|
|
94547
|
+
return polygon2.map((polygonRing) => getPoints(polygonRing, bbox, viewport));
|
|
94703
94548
|
}
|
|
94704
|
-
function MultiPolygon(multiPolygon2,
|
|
94705
|
-
return multiPolygon2.map((polygon2) => Polygon(polygon2,
|
|
94549
|
+
function MultiPolygon(multiPolygon2, bbox, viewport) {
|
|
94550
|
+
return multiPolygon2.map((polygon2) => Polygon(polygon2, bbox, viewport));
|
|
94706
94551
|
}
|
|
94707
|
-
function transform$1(geometry2,
|
|
94708
|
-
const nw = viewport.projectFlat([
|
|
94709
|
-
const se = viewport.projectFlat([
|
|
94552
|
+
function transform$1(geometry2, bbox, viewport) {
|
|
94553
|
+
const nw = viewport.projectFlat([bbox.west, bbox.north]);
|
|
94554
|
+
const se = viewport.projectFlat([bbox.east, bbox.south]);
|
|
94710
94555
|
const projectedBbox = [nw, se];
|
|
94711
94556
|
return {
|
|
94712
94557
|
...geometry2,
|
|
@@ -95096,11 +94941,11 @@ class MVTLayer extends TileLayer {
|
|
|
95096
94941
|
return [];
|
|
95097
94942
|
}
|
|
95098
94943
|
const {
|
|
95099
|
-
bbox
|
|
94944
|
+
bbox
|
|
95100
94945
|
} = tile;
|
|
95101
|
-
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(
|
|
94946
|
+
if (tile._contentWGS84 === void 0 && isGeoBoundingBox(bbox)) {
|
|
95102
94947
|
const content = this.state.binary ? binaryToGeojson(tile.content) : tile.content;
|
|
95103
|
-
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2,
|
|
94948
|
+
tile._contentWGS84 = content.map((feature2) => transformTileCoordsToWGS84(feature2, bbox, this.context.viewport));
|
|
95104
94949
|
}
|
|
95105
94950
|
return tile._contentWGS84;
|
|
95106
94951
|
}
|
|
@@ -95127,7 +94972,7 @@ function getFeatureLayerName(feature2) {
|
|
|
95127
94972
|
function isFeatureIdDefined(value) {
|
|
95128
94973
|
return value !== void 0 && value !== null && value !== "";
|
|
95129
94974
|
}
|
|
95130
|
-
function transformTileCoordsToWGS84(object2,
|
|
94975
|
+
function transformTileCoordsToWGS84(object2, bbox, viewport) {
|
|
95131
94976
|
const feature2 = {
|
|
95132
94977
|
...object2,
|
|
95133
94978
|
geometry: {
|
|
@@ -95136,7 +94981,7 @@ function transformTileCoordsToWGS84(object2, bbox2, viewport) {
|
|
|
95136
94981
|
};
|
|
95137
94982
|
Object.defineProperty(feature2.geometry, "coordinates", {
|
|
95138
94983
|
get: () => {
|
|
95139
|
-
const wgs84Geom = transform$1(object2.geometry,
|
|
94984
|
+
const wgs84Geom = transform$1(object2.geometry, bbox, viewport);
|
|
95140
94985
|
return wgs84Geom.coordinates;
|
|
95141
94986
|
}
|
|
95142
94987
|
});
|
|
@@ -95228,147 +95073,6 @@ const esm$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
95228
95073
|
_Tileset2D: Tileset2D,
|
|
95229
95074
|
_getURLFromTemplate: getURLFromTemplate
|
|
95230
95075
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
95231
|
-
function bbox$1(geojson, options = {}) {
|
|
95232
|
-
if (geojson.bbox != null && true !== options.recompute) {
|
|
95233
|
-
return geojson.bbox;
|
|
95234
|
-
}
|
|
95235
|
-
const result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
95236
|
-
coordEach(geojson, (coord) => {
|
|
95237
|
-
if (result[0] > coord[0]) {
|
|
95238
|
-
result[0] = coord[0];
|
|
95239
|
-
}
|
|
95240
|
-
if (result[1] > coord[1]) {
|
|
95241
|
-
result[1] = coord[1];
|
|
95242
|
-
}
|
|
95243
|
-
if (result[2] < coord[0]) {
|
|
95244
|
-
result[2] = coord[0];
|
|
95245
|
-
}
|
|
95246
|
-
if (result[3] < coord[1]) {
|
|
95247
|
-
result[3] = coord[1];
|
|
95248
|
-
}
|
|
95249
|
-
});
|
|
95250
|
-
return result;
|
|
95251
|
-
}
|
|
95252
|
-
function getCoord(coord) {
|
|
95253
|
-
if (!coord) {
|
|
95254
|
-
throw new Error("coord is required");
|
|
95255
|
-
}
|
|
95256
|
-
if (!Array.isArray(coord)) {
|
|
95257
|
-
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
95258
|
-
return [...coord.geometry.coordinates];
|
|
95259
|
-
}
|
|
95260
|
-
if (coord.type === "Point") {
|
|
95261
|
-
return [...coord.coordinates];
|
|
95262
|
-
}
|
|
95263
|
-
}
|
|
95264
|
-
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
95265
|
-
return [...coord];
|
|
95266
|
-
}
|
|
95267
|
-
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
95268
|
-
}
|
|
95269
|
-
function getCoords(coords) {
|
|
95270
|
-
if (Array.isArray(coords)) {
|
|
95271
|
-
return coords;
|
|
95272
|
-
}
|
|
95273
|
-
if (coords.type === "Feature") {
|
|
95274
|
-
if (coords.geometry !== null) {
|
|
95275
|
-
return coords.geometry.coordinates;
|
|
95276
|
-
}
|
|
95277
|
-
} else {
|
|
95278
|
-
if (coords.coordinates) {
|
|
95279
|
-
return coords.coordinates;
|
|
95280
|
-
}
|
|
95281
|
-
}
|
|
95282
|
-
throw new Error(
|
|
95283
|
-
"coords must be GeoJSON Feature, Geometry Object or an Array"
|
|
95284
|
-
);
|
|
95285
|
-
}
|
|
95286
|
-
function getGeom(geojson) {
|
|
95287
|
-
if (geojson.type === "Feature") {
|
|
95288
|
-
return geojson.geometry;
|
|
95289
|
-
}
|
|
95290
|
-
return geojson;
|
|
95291
|
-
}
|
|
95292
|
-
function booleanPointOnLine(pt, line, options = {}) {
|
|
95293
|
-
const ptCoords = getCoord(pt);
|
|
95294
|
-
const lineCoords = getCoords(line);
|
|
95295
|
-
for (let i2 = 0; i2 < lineCoords.length - 1; i2++) {
|
|
95296
|
-
let ignoreBoundary = false;
|
|
95297
|
-
if (options.ignoreEndVertices) {
|
|
95298
|
-
if (i2 === 0) {
|
|
95299
|
-
ignoreBoundary = "start";
|
|
95300
|
-
}
|
|
95301
|
-
if (i2 === lineCoords.length - 2) {
|
|
95302
|
-
ignoreBoundary = "end";
|
|
95303
|
-
}
|
|
95304
|
-
if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
|
|
95305
|
-
ignoreBoundary = "both";
|
|
95306
|
-
}
|
|
95307
|
-
}
|
|
95308
|
-
if (isPointOnLineSegment(
|
|
95309
|
-
lineCoords[i2],
|
|
95310
|
-
lineCoords[i2 + 1],
|
|
95311
|
-
ptCoords,
|
|
95312
|
-
ignoreBoundary,
|
|
95313
|
-
typeof options.epsilon === "undefined" ? null : options.epsilon
|
|
95314
|
-
)) {
|
|
95315
|
-
return true;
|
|
95316
|
-
}
|
|
95317
|
-
}
|
|
95318
|
-
return false;
|
|
95319
|
-
}
|
|
95320
|
-
function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt, excludeBoundary, epsilon3) {
|
|
95321
|
-
const x = pt[0];
|
|
95322
|
-
const y = pt[1];
|
|
95323
|
-
const x12 = lineSegmentStart[0];
|
|
95324
|
-
const y12 = lineSegmentStart[1];
|
|
95325
|
-
const x2 = lineSegmentEnd[0];
|
|
95326
|
-
const y2 = lineSegmentEnd[1];
|
|
95327
|
-
const dxc = pt[0] - x12;
|
|
95328
|
-
const dyc = pt[1] - y12;
|
|
95329
|
-
const dxl = x2 - x12;
|
|
95330
|
-
const dyl = y2 - y12;
|
|
95331
|
-
const cross2 = dxc * dyl - dyc * dxl;
|
|
95332
|
-
if (epsilon3 !== null) {
|
|
95333
|
-
if (Math.abs(cross2) > epsilon3) {
|
|
95334
|
-
return false;
|
|
95335
|
-
}
|
|
95336
|
-
} else if (cross2 !== 0) {
|
|
95337
|
-
return false;
|
|
95338
|
-
}
|
|
95339
|
-
if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
|
|
95340
|
-
if (excludeBoundary) {
|
|
95341
|
-
return false;
|
|
95342
|
-
}
|
|
95343
|
-
if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
|
|
95344
|
-
return true;
|
|
95345
|
-
} else {
|
|
95346
|
-
return false;
|
|
95347
|
-
}
|
|
95348
|
-
}
|
|
95349
|
-
if (!excludeBoundary) {
|
|
95350
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
95351
|
-
return dxl > 0 ? x12 <= x && x <= x2 : x2 <= x && x <= x12;
|
|
95352
|
-
}
|
|
95353
|
-
return dyl > 0 ? y12 <= y && y <= y2 : y2 <= y && y <= y12;
|
|
95354
|
-
} else if (excludeBoundary === "start") {
|
|
95355
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
95356
|
-
return dxl > 0 ? x12 < x && x <= x2 : x2 <= x && x < x12;
|
|
95357
|
-
}
|
|
95358
|
-
return dyl > 0 ? y12 < y && y <= y2 : y2 <= y && y < y12;
|
|
95359
|
-
} else if (excludeBoundary === "end") {
|
|
95360
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
95361
|
-
return dxl > 0 ? x12 <= x && x < x2 : x2 < x && x <= x12;
|
|
95362
|
-
}
|
|
95363
|
-
return dyl > 0 ? y12 <= y && y < y2 : y2 < y && y <= y12;
|
|
95364
|
-
} else if (excludeBoundary === "both") {
|
|
95365
|
-
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
|
95366
|
-
return dxl > 0 ? x12 < x && x < x2 : x2 < x && x < x12;
|
|
95367
|
-
}
|
|
95368
|
-
return dyl > 0 ? y12 < y && y < y2 : y2 < y && y < y12;
|
|
95369
|
-
}
|
|
95370
|
-
return false;
|
|
95371
|
-
}
|
|
95372
95076
|
const epsilon$1 = 11102230246251565e-32;
|
|
95373
95077
|
const splitter = 134217729;
|
|
95374
95078
|
const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1;
|
|
@@ -95665,6 +95369,29 @@ function pointInPolygon(p, polygon2) {
|
|
|
95665
95369
|
}
|
|
95666
95370
|
return true;
|
|
95667
95371
|
}
|
|
95372
|
+
function getCoord(coord) {
|
|
95373
|
+
if (!coord) {
|
|
95374
|
+
throw new Error("coord is required");
|
|
95375
|
+
}
|
|
95376
|
+
if (!Array.isArray(coord)) {
|
|
95377
|
+
if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
|
|
95378
|
+
return [...coord.geometry.coordinates];
|
|
95379
|
+
}
|
|
95380
|
+
if (coord.type === "Point") {
|
|
95381
|
+
return [...coord.coordinates];
|
|
95382
|
+
}
|
|
95383
|
+
}
|
|
95384
|
+
if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
|
|
95385
|
+
return [...coord];
|
|
95386
|
+
}
|
|
95387
|
+
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
95388
|
+
}
|
|
95389
|
+
function getGeom(geojson) {
|
|
95390
|
+
if (geojson.type === "Feature") {
|
|
95391
|
+
return geojson.geometry;
|
|
95392
|
+
}
|
|
95393
|
+
return geojson;
|
|
95394
|
+
}
|
|
95668
95395
|
function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
95669
95396
|
if (!point2) {
|
|
95670
95397
|
throw new Error("point is required");
|
|
@@ -95675,9 +95402,9 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
95675
95402
|
const pt = getCoord(point2);
|
|
95676
95403
|
const geom = getGeom(polygon2);
|
|
95677
95404
|
const type = geom.type;
|
|
95678
|
-
const
|
|
95405
|
+
const bbox = polygon2.bbox;
|
|
95679
95406
|
let polys = geom.coordinates;
|
|
95680
|
-
if (
|
|
95407
|
+
if (bbox && inBBox(pt, bbox) === false) {
|
|
95681
95408
|
return false;
|
|
95682
95409
|
}
|
|
95683
95410
|
if (type === "Polygon") {
|
|
@@ -95691,1607 +95418,8 @@ function booleanPointInPolygon(point2, polygon2, options = {}) {
|
|
|
95691
95418
|
}
|
|
95692
95419
|
return result;
|
|
95693
95420
|
}
|
|
95694
|
-
function inBBox(pt,
|
|
95695
|
-
return
|
|
95696
|
-
}
|
|
95697
|
-
function booleanWithin(feature1, feature2) {
|
|
95698
|
-
var geom1 = getGeom(feature1);
|
|
95699
|
-
var geom2 = getGeom(feature2);
|
|
95700
|
-
var type1 = geom1.type;
|
|
95701
|
-
var type2 = geom2.type;
|
|
95702
|
-
switch (type1) {
|
|
95703
|
-
case "Point":
|
|
95704
|
-
switch (type2) {
|
|
95705
|
-
case "MultiPoint":
|
|
95706
|
-
return isPointInMultiPoint$1(geom1, geom2);
|
|
95707
|
-
case "LineString":
|
|
95708
|
-
return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
|
|
95709
|
-
case "Polygon":
|
|
95710
|
-
case "MultiPolygon":
|
|
95711
|
-
return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
|
|
95712
|
-
default:
|
|
95713
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95714
|
-
}
|
|
95715
|
-
case "MultiPoint":
|
|
95716
|
-
switch (type2) {
|
|
95717
|
-
case "MultiPoint":
|
|
95718
|
-
return isMultiPointInMultiPoint$1(geom1, geom2);
|
|
95719
|
-
case "LineString":
|
|
95720
|
-
return isMultiPointOnLine$1(geom1, geom2);
|
|
95721
|
-
case "Polygon":
|
|
95722
|
-
case "MultiPolygon":
|
|
95723
|
-
return isMultiPointInPoly$1(geom1, geom2);
|
|
95724
|
-
default:
|
|
95725
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95726
|
-
}
|
|
95727
|
-
case "LineString":
|
|
95728
|
-
switch (type2) {
|
|
95729
|
-
case "LineString":
|
|
95730
|
-
return isLineOnLine$1(geom1, geom2);
|
|
95731
|
-
case "Polygon":
|
|
95732
|
-
case "MultiPolygon":
|
|
95733
|
-
return isLineInPoly$1(geom1, geom2);
|
|
95734
|
-
default:
|
|
95735
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95736
|
-
}
|
|
95737
|
-
case "Polygon":
|
|
95738
|
-
switch (type2) {
|
|
95739
|
-
case "Polygon":
|
|
95740
|
-
case "MultiPolygon":
|
|
95741
|
-
return isPolyInPoly$1(geom1, geom2);
|
|
95742
|
-
default:
|
|
95743
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95744
|
-
}
|
|
95745
|
-
default:
|
|
95746
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
95747
|
-
}
|
|
95748
|
-
}
|
|
95749
|
-
function isPointInMultiPoint$1(point2, multiPoint) {
|
|
95750
|
-
var i2;
|
|
95751
|
-
var output = false;
|
|
95752
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
95753
|
-
if (compareCoords$1(multiPoint.coordinates[i2], point2.coordinates)) {
|
|
95754
|
-
output = true;
|
|
95755
|
-
break;
|
|
95756
|
-
}
|
|
95757
|
-
}
|
|
95758
|
-
return output;
|
|
95759
|
-
}
|
|
95760
|
-
function isMultiPointInMultiPoint$1(multiPoint1, multiPoint2) {
|
|
95761
|
-
for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
|
|
95762
|
-
var anyMatch = false;
|
|
95763
|
-
for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
|
|
95764
|
-
if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
|
|
95765
|
-
anyMatch = true;
|
|
95766
|
-
}
|
|
95767
|
-
}
|
|
95768
|
-
if (!anyMatch) {
|
|
95769
|
-
return false;
|
|
95770
|
-
}
|
|
95771
|
-
}
|
|
95772
|
-
return true;
|
|
95773
|
-
}
|
|
95774
|
-
function isMultiPointOnLine$1(multiPoint, lineString2) {
|
|
95775
|
-
var foundInsidePoint = false;
|
|
95776
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
95777
|
-
if (!booleanPointOnLine(multiPoint.coordinates[i2], lineString2)) {
|
|
95778
|
-
return false;
|
|
95779
|
-
}
|
|
95780
|
-
if (!foundInsidePoint) {
|
|
95781
|
-
foundInsidePoint = booleanPointOnLine(
|
|
95782
|
-
multiPoint.coordinates[i2],
|
|
95783
|
-
lineString2,
|
|
95784
|
-
{ ignoreEndVertices: true }
|
|
95785
|
-
);
|
|
95786
|
-
}
|
|
95787
|
-
}
|
|
95788
|
-
return foundInsidePoint;
|
|
95789
|
-
}
|
|
95790
|
-
function isMultiPointInPoly$1(multiPoint, polygon2) {
|
|
95791
|
-
var output = true;
|
|
95792
|
-
var isInside = false;
|
|
95793
|
-
for (var i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
95794
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2);
|
|
95795
|
-
if (!isInside) {
|
|
95796
|
-
output = false;
|
|
95797
|
-
break;
|
|
95798
|
-
}
|
|
95799
|
-
{
|
|
95800
|
-
isInside = booleanPointInPolygon(multiPoint.coordinates[i2], polygon2, {
|
|
95801
|
-
ignoreBoundary: true
|
|
95802
|
-
});
|
|
95803
|
-
}
|
|
95804
|
-
}
|
|
95805
|
-
return output && isInside;
|
|
95806
|
-
}
|
|
95807
|
-
function isLineOnLine$1(lineString1, lineString2) {
|
|
95808
|
-
for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
|
|
95809
|
-
if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
|
|
95810
|
-
return false;
|
|
95811
|
-
}
|
|
95812
|
-
}
|
|
95813
|
-
return true;
|
|
95814
|
-
}
|
|
95815
|
-
function isLineInPoly$1(linestring, polygon2) {
|
|
95816
|
-
var polyBbox = bbox$1(polygon2);
|
|
95817
|
-
var lineBbox = bbox$1(linestring);
|
|
95818
|
-
if (!doBBoxOverlap$1(polyBbox, lineBbox)) {
|
|
95819
|
-
return false;
|
|
95820
|
-
}
|
|
95821
|
-
var foundInsidePoint = false;
|
|
95822
|
-
for (var i2 = 0; i2 < linestring.coordinates.length; i2++) {
|
|
95823
|
-
if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
|
|
95824
|
-
return false;
|
|
95825
|
-
}
|
|
95826
|
-
if (!foundInsidePoint) {
|
|
95827
|
-
foundInsidePoint = booleanPointInPolygon(
|
|
95828
|
-
linestring.coordinates[i2],
|
|
95829
|
-
polygon2,
|
|
95830
|
-
{ ignoreBoundary: true }
|
|
95831
|
-
);
|
|
95832
|
-
}
|
|
95833
|
-
if (!foundInsidePoint && i2 < linestring.coordinates.length - 1) {
|
|
95834
|
-
var midpoint = getMidpoint$1(
|
|
95835
|
-
linestring.coordinates[i2],
|
|
95836
|
-
linestring.coordinates[i2 + 1]
|
|
95837
|
-
);
|
|
95838
|
-
foundInsidePoint = booleanPointInPolygon(midpoint, polygon2, {
|
|
95839
|
-
ignoreBoundary: true
|
|
95840
|
-
});
|
|
95841
|
-
}
|
|
95842
|
-
}
|
|
95843
|
-
return foundInsidePoint;
|
|
95844
|
-
}
|
|
95845
|
-
function isPolyInPoly$1(geometry1, geometry2) {
|
|
95846
|
-
var poly1Bbox = bbox$1(geometry1);
|
|
95847
|
-
var poly2Bbox = bbox$1(geometry2);
|
|
95848
|
-
if (!doBBoxOverlap$1(poly2Bbox, poly1Bbox)) {
|
|
95849
|
-
return false;
|
|
95850
|
-
}
|
|
95851
|
-
for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
|
|
95852
|
-
if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
|
|
95853
|
-
return false;
|
|
95854
|
-
}
|
|
95855
|
-
}
|
|
95856
|
-
return true;
|
|
95857
|
-
}
|
|
95858
|
-
function doBBoxOverlap$1(bbox1, bbox2) {
|
|
95859
|
-
if (bbox1[0] > bbox2[0]) return false;
|
|
95860
|
-
if (bbox1[2] < bbox2[2]) return false;
|
|
95861
|
-
if (bbox1[1] > bbox2[1]) return false;
|
|
95862
|
-
if (bbox1[3] < bbox2[3]) return false;
|
|
95863
|
-
return true;
|
|
95864
|
-
}
|
|
95865
|
-
function compareCoords$1(pair1, pair2) {
|
|
95866
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
95867
|
-
}
|
|
95868
|
-
function getMidpoint$1(pair1, pair2) {
|
|
95869
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
95870
|
-
}
|
|
95871
|
-
function booleanContains(feature1, feature2) {
|
|
95872
|
-
const geom1 = getGeom(feature1);
|
|
95873
|
-
const geom2 = getGeom(feature2);
|
|
95874
|
-
const type1 = geom1.type;
|
|
95875
|
-
const type2 = geom2.type;
|
|
95876
|
-
const coords1 = geom1.coordinates;
|
|
95877
|
-
const coords2 = geom2.coordinates;
|
|
95878
|
-
switch (type1) {
|
|
95879
|
-
case "Point":
|
|
95880
|
-
switch (type2) {
|
|
95881
|
-
case "Point":
|
|
95882
|
-
return compareCoords(coords1, coords2);
|
|
95883
|
-
default:
|
|
95884
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95885
|
-
}
|
|
95886
|
-
case "MultiPoint":
|
|
95887
|
-
switch (type2) {
|
|
95888
|
-
case "Point":
|
|
95889
|
-
return isPointInMultiPoint(geom1, geom2);
|
|
95890
|
-
case "MultiPoint":
|
|
95891
|
-
return isMultiPointInMultiPoint(geom1, geom2);
|
|
95892
|
-
default:
|
|
95893
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95894
|
-
}
|
|
95895
|
-
case "LineString":
|
|
95896
|
-
switch (type2) {
|
|
95897
|
-
case "Point":
|
|
95898
|
-
return booleanPointOnLine(geom2, geom1, { ignoreEndVertices: true });
|
|
95899
|
-
case "LineString":
|
|
95900
|
-
return isLineOnLine(geom1, geom2);
|
|
95901
|
-
case "MultiPoint":
|
|
95902
|
-
return isMultiPointOnLine(geom1, geom2);
|
|
95903
|
-
default:
|
|
95904
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95905
|
-
}
|
|
95906
|
-
case "Polygon":
|
|
95907
|
-
switch (type2) {
|
|
95908
|
-
case "Point":
|
|
95909
|
-
return booleanPointInPolygon(geom2, geom1, { ignoreBoundary: true });
|
|
95910
|
-
case "LineString":
|
|
95911
|
-
return isLineInPoly(geom1, geom2);
|
|
95912
|
-
case "Polygon":
|
|
95913
|
-
return isPolyInPoly(geom1, geom2);
|
|
95914
|
-
case "MultiPoint":
|
|
95915
|
-
return isMultiPointInPoly(geom1, geom2);
|
|
95916
|
-
default:
|
|
95917
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95918
|
-
}
|
|
95919
|
-
case "MultiPolygon":
|
|
95920
|
-
switch (type2) {
|
|
95921
|
-
case "Polygon":
|
|
95922
|
-
return isPolygonInMultiPolygon(geom1, geom2);
|
|
95923
|
-
default:
|
|
95924
|
-
throw new Error("feature2 " + type2 + " geometry not supported");
|
|
95925
|
-
}
|
|
95926
|
-
default:
|
|
95927
|
-
throw new Error("feature1 " + type1 + " geometry not supported");
|
|
95928
|
-
}
|
|
95929
|
-
}
|
|
95930
|
-
function isPolygonInMultiPolygon(multiPolygon2, polygon2) {
|
|
95931
|
-
return multiPolygon2.coordinates.some(
|
|
95932
|
-
(coords) => isPolyInPoly({ type: "Polygon", coordinates: coords }, polygon2)
|
|
95933
|
-
);
|
|
95934
|
-
}
|
|
95935
|
-
function isPointInMultiPoint(multiPoint, pt) {
|
|
95936
|
-
let i2;
|
|
95937
|
-
let output = false;
|
|
95938
|
-
for (i2 = 0; i2 < multiPoint.coordinates.length; i2++) {
|
|
95939
|
-
if (compareCoords(multiPoint.coordinates[i2], pt.coordinates)) {
|
|
95940
|
-
output = true;
|
|
95941
|
-
break;
|
|
95942
|
-
}
|
|
95943
|
-
}
|
|
95944
|
-
return output;
|
|
95945
|
-
}
|
|
95946
|
-
function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
|
|
95947
|
-
for (const coord2 of multiPoint2.coordinates) {
|
|
95948
|
-
let matchFound = false;
|
|
95949
|
-
for (const coord1 of multiPoint1.coordinates) {
|
|
95950
|
-
if (compareCoords(coord2, coord1)) {
|
|
95951
|
-
matchFound = true;
|
|
95952
|
-
break;
|
|
95953
|
-
}
|
|
95954
|
-
}
|
|
95955
|
-
if (!matchFound) {
|
|
95956
|
-
return false;
|
|
95957
|
-
}
|
|
95958
|
-
}
|
|
95959
|
-
return true;
|
|
95960
|
-
}
|
|
95961
|
-
function isMultiPointOnLine(lineString2, multiPoint) {
|
|
95962
|
-
let haveFoundInteriorPoint = false;
|
|
95963
|
-
for (const coord of multiPoint.coordinates) {
|
|
95964
|
-
if (booleanPointOnLine(coord, lineString2, { ignoreEndVertices: true })) {
|
|
95965
|
-
haveFoundInteriorPoint = true;
|
|
95966
|
-
}
|
|
95967
|
-
if (!booleanPointOnLine(coord, lineString2)) {
|
|
95968
|
-
return false;
|
|
95969
|
-
}
|
|
95970
|
-
}
|
|
95971
|
-
if (haveFoundInteriorPoint) {
|
|
95972
|
-
return true;
|
|
95973
|
-
}
|
|
95974
|
-
return false;
|
|
95975
|
-
}
|
|
95976
|
-
function isMultiPointInPoly(polygon2, multiPoint) {
|
|
95977
|
-
for (const coord of multiPoint.coordinates) {
|
|
95978
|
-
if (!booleanPointInPolygon(coord, polygon2, { ignoreBoundary: true })) {
|
|
95979
|
-
return false;
|
|
95980
|
-
}
|
|
95981
|
-
}
|
|
95982
|
-
return true;
|
|
95983
|
-
}
|
|
95984
|
-
function isLineOnLine(lineString1, lineString2) {
|
|
95985
|
-
let haveFoundInteriorPoint = false;
|
|
95986
|
-
for (const coords of lineString2.coordinates) {
|
|
95987
|
-
if (booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
95988
|
-
ignoreEndVertices: true
|
|
95989
|
-
})) {
|
|
95990
|
-
haveFoundInteriorPoint = true;
|
|
95991
|
-
}
|
|
95992
|
-
if (!booleanPointOnLine({ type: "Point", coordinates: coords }, lineString1, {
|
|
95993
|
-
ignoreEndVertices: false
|
|
95994
|
-
})) {
|
|
95995
|
-
return false;
|
|
95996
|
-
}
|
|
95997
|
-
}
|
|
95998
|
-
return haveFoundInteriorPoint;
|
|
95999
|
-
}
|
|
96000
|
-
function isLineInPoly(polygon2, linestring) {
|
|
96001
|
-
let output = false;
|
|
96002
|
-
let i2 = 0;
|
|
96003
|
-
const polyBbox = bbox$1(polygon2);
|
|
96004
|
-
const lineBbox = bbox$1(linestring);
|
|
96005
|
-
if (!doBBoxOverlap(polyBbox, lineBbox)) {
|
|
96006
|
-
return false;
|
|
96007
|
-
}
|
|
96008
|
-
for (i2; i2 < linestring.coordinates.length - 1; i2++) {
|
|
96009
|
-
const midPoint = getMidpoint(
|
|
96010
|
-
linestring.coordinates[i2],
|
|
96011
|
-
linestring.coordinates[i2 + 1]
|
|
96012
|
-
);
|
|
96013
|
-
if (booleanPointInPolygon({ type: "Point", coordinates: midPoint }, polygon2, {
|
|
96014
|
-
ignoreBoundary: true
|
|
96015
|
-
})) {
|
|
96016
|
-
output = true;
|
|
96017
|
-
break;
|
|
96018
|
-
}
|
|
96019
|
-
}
|
|
96020
|
-
return output;
|
|
96021
|
-
}
|
|
96022
|
-
function isPolyInPoly(feature1, feature2) {
|
|
96023
|
-
if (feature1.type === "Feature" && feature1.geometry === null) {
|
|
96024
|
-
return false;
|
|
96025
|
-
}
|
|
96026
|
-
if (feature2.type === "Feature" && feature2.geometry === null) {
|
|
96027
|
-
return false;
|
|
96028
|
-
}
|
|
96029
|
-
const poly1Bbox = bbox$1(feature1);
|
|
96030
|
-
const poly2Bbox = bbox$1(feature2);
|
|
96031
|
-
if (!doBBoxOverlap(poly1Bbox, poly2Bbox)) {
|
|
96032
|
-
return false;
|
|
96033
|
-
}
|
|
96034
|
-
const coords = getGeom(feature2).coordinates;
|
|
96035
|
-
for (const ring of coords) {
|
|
96036
|
-
for (const coord of ring) {
|
|
96037
|
-
if (!booleanPointInPolygon(coord, feature1)) {
|
|
96038
|
-
return false;
|
|
96039
|
-
}
|
|
96040
|
-
}
|
|
96041
|
-
}
|
|
96042
|
-
return true;
|
|
96043
|
-
}
|
|
96044
|
-
function doBBoxOverlap(bbox1, bbox2) {
|
|
96045
|
-
if (bbox1[0] > bbox2[0]) {
|
|
96046
|
-
return false;
|
|
96047
|
-
}
|
|
96048
|
-
if (bbox1[2] < bbox2[2]) {
|
|
96049
|
-
return false;
|
|
96050
|
-
}
|
|
96051
|
-
if (bbox1[1] > bbox2[1]) {
|
|
96052
|
-
return false;
|
|
96053
|
-
}
|
|
96054
|
-
if (bbox1[3] < bbox2[3]) {
|
|
96055
|
-
return false;
|
|
96056
|
-
}
|
|
96057
|
-
return true;
|
|
96058
|
-
}
|
|
96059
|
-
function compareCoords(pair1, pair2) {
|
|
96060
|
-
return pair1[0] === pair2[0] && pair1[1] === pair2[1];
|
|
96061
|
-
}
|
|
96062
|
-
function getMidpoint(pair1, pair2) {
|
|
96063
|
-
return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
|
|
96064
|
-
}
|
|
96065
|
-
function quickselect(arr, k, left, right, compare2) {
|
|
96066
|
-
quickselectStep(arr, k, left || 0, right || arr.length - 1, compare2 || defaultCompare$1);
|
|
96067
|
-
}
|
|
96068
|
-
function quickselectStep(arr, k, left, right, compare2) {
|
|
96069
|
-
while (right > left) {
|
|
96070
|
-
if (right - left > 600) {
|
|
96071
|
-
var n3 = right - left + 1;
|
|
96072
|
-
var m = k - left + 1;
|
|
96073
|
-
var z2 = Math.log(n3);
|
|
96074
|
-
var s2 = 0.5 * Math.exp(2 * z2 / 3);
|
|
96075
|
-
var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
96076
|
-
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
96077
|
-
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
96078
|
-
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
96079
|
-
}
|
|
96080
|
-
var t = arr[k];
|
|
96081
|
-
var i2 = left;
|
|
96082
|
-
var j = right;
|
|
96083
|
-
swap(arr, left, k);
|
|
96084
|
-
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
96085
|
-
while (i2 < j) {
|
|
96086
|
-
swap(arr, i2, j);
|
|
96087
|
-
i2++;
|
|
96088
|
-
j--;
|
|
96089
|
-
while (compare2(arr[i2], t) < 0) i2++;
|
|
96090
|
-
while (compare2(arr[j], t) > 0) j--;
|
|
96091
|
-
}
|
|
96092
|
-
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
96093
|
-
else {
|
|
96094
|
-
j++;
|
|
96095
|
-
swap(arr, j, right);
|
|
96096
|
-
}
|
|
96097
|
-
if (j <= k) left = j + 1;
|
|
96098
|
-
if (k <= j) right = j - 1;
|
|
96099
|
-
}
|
|
96100
|
-
}
|
|
96101
|
-
function swap(arr, i2, j) {
|
|
96102
|
-
var tmp = arr[i2];
|
|
96103
|
-
arr[i2] = arr[j];
|
|
96104
|
-
arr[j] = tmp;
|
|
96105
|
-
}
|
|
96106
|
-
function defaultCompare$1(a2, b) {
|
|
96107
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
96108
|
-
}
|
|
96109
|
-
class RBush {
|
|
96110
|
-
constructor(maxEntries = 9) {
|
|
96111
|
-
this._maxEntries = Math.max(4, maxEntries);
|
|
96112
|
-
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
|
96113
|
-
this.clear();
|
|
96114
|
-
}
|
|
96115
|
-
all() {
|
|
96116
|
-
return this._all(this.data, []);
|
|
96117
|
-
}
|
|
96118
|
-
search(bbox2) {
|
|
96119
|
-
let node2 = this.data;
|
|
96120
|
-
const result = [];
|
|
96121
|
-
if (!intersects(bbox2, node2)) return result;
|
|
96122
|
-
const toBBox = this.toBBox;
|
|
96123
|
-
const nodesToSearch = [];
|
|
96124
|
-
while (node2) {
|
|
96125
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
96126
|
-
const child = node2.children[i2];
|
|
96127
|
-
const childBBox = node2.leaf ? toBBox(child) : child;
|
|
96128
|
-
if (intersects(bbox2, childBBox)) {
|
|
96129
|
-
if (node2.leaf) result.push(child);
|
|
96130
|
-
else if (contains$1(bbox2, childBBox)) this._all(child, result);
|
|
96131
|
-
else nodesToSearch.push(child);
|
|
96132
|
-
}
|
|
96133
|
-
}
|
|
96134
|
-
node2 = nodesToSearch.pop();
|
|
96135
|
-
}
|
|
96136
|
-
return result;
|
|
96137
|
-
}
|
|
96138
|
-
collides(bbox2) {
|
|
96139
|
-
let node2 = this.data;
|
|
96140
|
-
if (!intersects(bbox2, node2)) return false;
|
|
96141
|
-
const nodesToSearch = [];
|
|
96142
|
-
while (node2) {
|
|
96143
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
96144
|
-
const child = node2.children[i2];
|
|
96145
|
-
const childBBox = node2.leaf ? this.toBBox(child) : child;
|
|
96146
|
-
if (intersects(bbox2, childBBox)) {
|
|
96147
|
-
if (node2.leaf || contains$1(bbox2, childBBox)) return true;
|
|
96148
|
-
nodesToSearch.push(child);
|
|
96149
|
-
}
|
|
96150
|
-
}
|
|
96151
|
-
node2 = nodesToSearch.pop();
|
|
96152
|
-
}
|
|
96153
|
-
return false;
|
|
96154
|
-
}
|
|
96155
|
-
load(data) {
|
|
96156
|
-
if (!(data && data.length)) return this;
|
|
96157
|
-
if (data.length < this._minEntries) {
|
|
96158
|
-
for (let i2 = 0; i2 < data.length; i2++) {
|
|
96159
|
-
this.insert(data[i2]);
|
|
96160
|
-
}
|
|
96161
|
-
return this;
|
|
96162
|
-
}
|
|
96163
|
-
let node2 = this._build(data.slice(), 0, data.length - 1, 0);
|
|
96164
|
-
if (!this.data.children.length) {
|
|
96165
|
-
this.data = node2;
|
|
96166
|
-
} else if (this.data.height === node2.height) {
|
|
96167
|
-
this._splitRoot(this.data, node2);
|
|
96168
|
-
} else {
|
|
96169
|
-
if (this.data.height < node2.height) {
|
|
96170
|
-
const tmpNode = this.data;
|
|
96171
|
-
this.data = node2;
|
|
96172
|
-
node2 = tmpNode;
|
|
96173
|
-
}
|
|
96174
|
-
this._insert(node2, this.data.height - node2.height - 1, true);
|
|
96175
|
-
}
|
|
96176
|
-
return this;
|
|
96177
|
-
}
|
|
96178
|
-
insert(item) {
|
|
96179
|
-
if (item) this._insert(item, this.data.height - 1);
|
|
96180
|
-
return this;
|
|
96181
|
-
}
|
|
96182
|
-
clear() {
|
|
96183
|
-
this.data = createNode([]);
|
|
96184
|
-
return this;
|
|
96185
|
-
}
|
|
96186
|
-
remove(item, equalsFn) {
|
|
96187
|
-
if (!item) return this;
|
|
96188
|
-
let node2 = this.data;
|
|
96189
|
-
const bbox2 = this.toBBox(item);
|
|
96190
|
-
const path = [];
|
|
96191
|
-
const indexes = [];
|
|
96192
|
-
let i2, parent, goingUp;
|
|
96193
|
-
while (node2 || path.length) {
|
|
96194
|
-
if (!node2) {
|
|
96195
|
-
node2 = path.pop();
|
|
96196
|
-
parent = path[path.length - 1];
|
|
96197
|
-
i2 = indexes.pop();
|
|
96198
|
-
goingUp = true;
|
|
96199
|
-
}
|
|
96200
|
-
if (node2.leaf) {
|
|
96201
|
-
const index2 = findItem(item, node2.children, equalsFn);
|
|
96202
|
-
if (index2 !== -1) {
|
|
96203
|
-
node2.children.splice(index2, 1);
|
|
96204
|
-
path.push(node2);
|
|
96205
|
-
this._condense(path);
|
|
96206
|
-
return this;
|
|
96207
|
-
}
|
|
96208
|
-
}
|
|
96209
|
-
if (!goingUp && !node2.leaf && contains$1(node2, bbox2)) {
|
|
96210
|
-
path.push(node2);
|
|
96211
|
-
indexes.push(i2);
|
|
96212
|
-
i2 = 0;
|
|
96213
|
-
parent = node2;
|
|
96214
|
-
node2 = node2.children[0];
|
|
96215
|
-
} else if (parent) {
|
|
96216
|
-
i2++;
|
|
96217
|
-
node2 = parent.children[i2];
|
|
96218
|
-
goingUp = false;
|
|
96219
|
-
} else node2 = null;
|
|
96220
|
-
}
|
|
96221
|
-
return this;
|
|
96222
|
-
}
|
|
96223
|
-
toBBox(item) {
|
|
96224
|
-
return item;
|
|
96225
|
-
}
|
|
96226
|
-
compareMinX(a2, b) {
|
|
96227
|
-
return a2.minX - b.minX;
|
|
96228
|
-
}
|
|
96229
|
-
compareMinY(a2, b) {
|
|
96230
|
-
return a2.minY - b.minY;
|
|
96231
|
-
}
|
|
96232
|
-
toJSON() {
|
|
96233
|
-
return this.data;
|
|
96234
|
-
}
|
|
96235
|
-
fromJSON(data) {
|
|
96236
|
-
this.data = data;
|
|
96237
|
-
return this;
|
|
96238
|
-
}
|
|
96239
|
-
_all(node2, result) {
|
|
96240
|
-
const nodesToSearch = [];
|
|
96241
|
-
while (node2) {
|
|
96242
|
-
if (node2.leaf) result.push(...node2.children);
|
|
96243
|
-
else nodesToSearch.push(...node2.children);
|
|
96244
|
-
node2 = nodesToSearch.pop();
|
|
96245
|
-
}
|
|
96246
|
-
return result;
|
|
96247
|
-
}
|
|
96248
|
-
_build(items, left, right, height) {
|
|
96249
|
-
const N2 = right - left + 1;
|
|
96250
|
-
let M = this._maxEntries;
|
|
96251
|
-
let node2;
|
|
96252
|
-
if (N2 <= M) {
|
|
96253
|
-
node2 = createNode(items.slice(left, right + 1));
|
|
96254
|
-
calcBBox(node2, this.toBBox);
|
|
96255
|
-
return node2;
|
|
96256
|
-
}
|
|
96257
|
-
if (!height) {
|
|
96258
|
-
height = Math.ceil(Math.log(N2) / Math.log(M));
|
|
96259
|
-
M = Math.ceil(N2 / Math.pow(M, height - 1));
|
|
96260
|
-
}
|
|
96261
|
-
node2 = createNode([]);
|
|
96262
|
-
node2.leaf = false;
|
|
96263
|
-
node2.height = height;
|
|
96264
|
-
const N22 = Math.ceil(N2 / M);
|
|
96265
|
-
const N1 = N22 * Math.ceil(Math.sqrt(M));
|
|
96266
|
-
multiSelect(items, left, right, N1, this.compareMinX);
|
|
96267
|
-
for (let i2 = left; i2 <= right; i2 += N1) {
|
|
96268
|
-
const right2 = Math.min(i2 + N1 - 1, right);
|
|
96269
|
-
multiSelect(items, i2, right2, N22, this.compareMinY);
|
|
96270
|
-
for (let j = i2; j <= right2; j += N22) {
|
|
96271
|
-
const right3 = Math.min(j + N22 - 1, right2);
|
|
96272
|
-
node2.children.push(this._build(items, j, right3, height - 1));
|
|
96273
|
-
}
|
|
96274
|
-
}
|
|
96275
|
-
calcBBox(node2, this.toBBox);
|
|
96276
|
-
return node2;
|
|
96277
|
-
}
|
|
96278
|
-
_chooseSubtree(bbox2, node2, level, path) {
|
|
96279
|
-
while (true) {
|
|
96280
|
-
path.push(node2);
|
|
96281
|
-
if (node2.leaf || path.length - 1 === level) break;
|
|
96282
|
-
let minArea = Infinity;
|
|
96283
|
-
let minEnlargement = Infinity;
|
|
96284
|
-
let targetNode;
|
|
96285
|
-
for (let i2 = 0; i2 < node2.children.length; i2++) {
|
|
96286
|
-
const child = node2.children[i2];
|
|
96287
|
-
const area2 = bboxArea(child);
|
|
96288
|
-
const enlargement = enlargedArea(bbox2, child) - area2;
|
|
96289
|
-
if (enlargement < minEnlargement) {
|
|
96290
|
-
minEnlargement = enlargement;
|
|
96291
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
96292
|
-
targetNode = child;
|
|
96293
|
-
} else if (enlargement === minEnlargement) {
|
|
96294
|
-
if (area2 < minArea) {
|
|
96295
|
-
minArea = area2;
|
|
96296
|
-
targetNode = child;
|
|
96297
|
-
}
|
|
96298
|
-
}
|
|
96299
|
-
}
|
|
96300
|
-
node2 = targetNode || node2.children[0];
|
|
96301
|
-
}
|
|
96302
|
-
return node2;
|
|
96303
|
-
}
|
|
96304
|
-
_insert(item, level, isNode2) {
|
|
96305
|
-
const bbox2 = isNode2 ? item : this.toBBox(item);
|
|
96306
|
-
const insertPath = [];
|
|
96307
|
-
const node2 = this._chooseSubtree(bbox2, this.data, level, insertPath);
|
|
96308
|
-
node2.children.push(item);
|
|
96309
|
-
extend(node2, bbox2);
|
|
96310
|
-
while (level >= 0) {
|
|
96311
|
-
if (insertPath[level].children.length > this._maxEntries) {
|
|
96312
|
-
this._split(insertPath, level);
|
|
96313
|
-
level--;
|
|
96314
|
-
} else break;
|
|
96315
|
-
}
|
|
96316
|
-
this._adjustParentBBoxes(bbox2, insertPath, level);
|
|
96317
|
-
}
|
|
96318
|
-
// split overflowed node into two
|
|
96319
|
-
_split(insertPath, level) {
|
|
96320
|
-
const node2 = insertPath[level];
|
|
96321
|
-
const M = node2.children.length;
|
|
96322
|
-
const m = this._minEntries;
|
|
96323
|
-
this._chooseSplitAxis(node2, m, M);
|
|
96324
|
-
const splitIndex = this._chooseSplitIndex(node2, m, M);
|
|
96325
|
-
const newNode = createNode(node2.children.splice(splitIndex, node2.children.length - splitIndex));
|
|
96326
|
-
newNode.height = node2.height;
|
|
96327
|
-
newNode.leaf = node2.leaf;
|
|
96328
|
-
calcBBox(node2, this.toBBox);
|
|
96329
|
-
calcBBox(newNode, this.toBBox);
|
|
96330
|
-
if (level) insertPath[level - 1].children.push(newNode);
|
|
96331
|
-
else this._splitRoot(node2, newNode);
|
|
96332
|
-
}
|
|
96333
|
-
_splitRoot(node2, newNode) {
|
|
96334
|
-
this.data = createNode([node2, newNode]);
|
|
96335
|
-
this.data.height = node2.height + 1;
|
|
96336
|
-
this.data.leaf = false;
|
|
96337
|
-
calcBBox(this.data, this.toBBox);
|
|
96338
|
-
}
|
|
96339
|
-
_chooseSplitIndex(node2, m, M) {
|
|
96340
|
-
let index2;
|
|
96341
|
-
let minOverlap = Infinity;
|
|
96342
|
-
let minArea = Infinity;
|
|
96343
|
-
for (let i2 = m; i2 <= M - m; i2++) {
|
|
96344
|
-
const bbox1 = distBBox(node2, 0, i2, this.toBBox);
|
|
96345
|
-
const bbox2 = distBBox(node2, i2, M, this.toBBox);
|
|
96346
|
-
const overlap = intersectionArea(bbox1, bbox2);
|
|
96347
|
-
const area2 = bboxArea(bbox1) + bboxArea(bbox2);
|
|
96348
|
-
if (overlap < minOverlap) {
|
|
96349
|
-
minOverlap = overlap;
|
|
96350
|
-
index2 = i2;
|
|
96351
|
-
minArea = area2 < minArea ? area2 : minArea;
|
|
96352
|
-
} else if (overlap === minOverlap) {
|
|
96353
|
-
if (area2 < minArea) {
|
|
96354
|
-
minArea = area2;
|
|
96355
|
-
index2 = i2;
|
|
96356
|
-
}
|
|
96357
|
-
}
|
|
96358
|
-
}
|
|
96359
|
-
return index2 || M - m;
|
|
96360
|
-
}
|
|
96361
|
-
// sorts node children by the best axis for split
|
|
96362
|
-
_chooseSplitAxis(node2, m, M) {
|
|
96363
|
-
const compareMinX = node2.leaf ? this.compareMinX : compareNodeMinX;
|
|
96364
|
-
const compareMinY = node2.leaf ? this.compareMinY : compareNodeMinY;
|
|
96365
|
-
const xMargin = this._allDistMargin(node2, m, M, compareMinX);
|
|
96366
|
-
const yMargin = this._allDistMargin(node2, m, M, compareMinY);
|
|
96367
|
-
if (xMargin < yMargin) node2.children.sort(compareMinX);
|
|
96368
|
-
}
|
|
96369
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
96370
|
-
_allDistMargin(node2, m, M, compare2) {
|
|
96371
|
-
node2.children.sort(compare2);
|
|
96372
|
-
const toBBox = this.toBBox;
|
|
96373
|
-
const leftBBox = distBBox(node2, 0, m, toBBox);
|
|
96374
|
-
const rightBBox = distBBox(node2, M - m, M, toBBox);
|
|
96375
|
-
let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
96376
|
-
for (let i2 = m; i2 < M - m; i2++) {
|
|
96377
|
-
const child = node2.children[i2];
|
|
96378
|
-
extend(leftBBox, node2.leaf ? toBBox(child) : child);
|
|
96379
|
-
margin += bboxMargin(leftBBox);
|
|
96380
|
-
}
|
|
96381
|
-
for (let i2 = M - m - 1; i2 >= m; i2--) {
|
|
96382
|
-
const child = node2.children[i2];
|
|
96383
|
-
extend(rightBBox, node2.leaf ? toBBox(child) : child);
|
|
96384
|
-
margin += bboxMargin(rightBBox);
|
|
96385
|
-
}
|
|
96386
|
-
return margin;
|
|
96387
|
-
}
|
|
96388
|
-
_adjustParentBBoxes(bbox2, path, level) {
|
|
96389
|
-
for (let i2 = level; i2 >= 0; i2--) {
|
|
96390
|
-
extend(path[i2], bbox2);
|
|
96391
|
-
}
|
|
96392
|
-
}
|
|
96393
|
-
_condense(path) {
|
|
96394
|
-
for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
|
|
96395
|
-
if (path[i2].children.length === 0) {
|
|
96396
|
-
if (i2 > 0) {
|
|
96397
|
-
siblings = path[i2 - 1].children;
|
|
96398
|
-
siblings.splice(siblings.indexOf(path[i2]), 1);
|
|
96399
|
-
} else this.clear();
|
|
96400
|
-
} else calcBBox(path[i2], this.toBBox);
|
|
96401
|
-
}
|
|
96402
|
-
}
|
|
96403
|
-
}
|
|
96404
|
-
function findItem(item, items, equalsFn) {
|
|
96405
|
-
if (!equalsFn) return items.indexOf(item);
|
|
96406
|
-
for (let i2 = 0; i2 < items.length; i2++) {
|
|
96407
|
-
if (equalsFn(item, items[i2])) return i2;
|
|
96408
|
-
}
|
|
96409
|
-
return -1;
|
|
96410
|
-
}
|
|
96411
|
-
function calcBBox(node2, toBBox) {
|
|
96412
|
-
distBBox(node2, 0, node2.children.length, toBBox, node2);
|
|
96413
|
-
}
|
|
96414
|
-
function distBBox(node2, k, p, toBBox, destNode) {
|
|
96415
|
-
if (!destNode) destNode = createNode(null);
|
|
96416
|
-
destNode.minX = Infinity;
|
|
96417
|
-
destNode.minY = Infinity;
|
|
96418
|
-
destNode.maxX = -Infinity;
|
|
96419
|
-
destNode.maxY = -Infinity;
|
|
96420
|
-
for (let i2 = k; i2 < p; i2++) {
|
|
96421
|
-
const child = node2.children[i2];
|
|
96422
|
-
extend(destNode, node2.leaf ? toBBox(child) : child);
|
|
96423
|
-
}
|
|
96424
|
-
return destNode;
|
|
96425
|
-
}
|
|
96426
|
-
function extend(a2, b) {
|
|
96427
|
-
a2.minX = Math.min(a2.minX, b.minX);
|
|
96428
|
-
a2.minY = Math.min(a2.minY, b.minY);
|
|
96429
|
-
a2.maxX = Math.max(a2.maxX, b.maxX);
|
|
96430
|
-
a2.maxY = Math.max(a2.maxY, b.maxY);
|
|
96431
|
-
return a2;
|
|
96432
|
-
}
|
|
96433
|
-
function compareNodeMinX(a2, b) {
|
|
96434
|
-
return a2.minX - b.minX;
|
|
96435
|
-
}
|
|
96436
|
-
function compareNodeMinY(a2, b) {
|
|
96437
|
-
return a2.minY - b.minY;
|
|
96438
|
-
}
|
|
96439
|
-
function bboxArea(a2) {
|
|
96440
|
-
return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
|
|
96441
|
-
}
|
|
96442
|
-
function bboxMargin(a2) {
|
|
96443
|
-
return a2.maxX - a2.minX + (a2.maxY - a2.minY);
|
|
96444
|
-
}
|
|
96445
|
-
function enlargedArea(a2, b) {
|
|
96446
|
-
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));
|
|
96447
|
-
}
|
|
96448
|
-
function intersectionArea(a2, b) {
|
|
96449
|
-
const minX = Math.max(a2.minX, b.minX);
|
|
96450
|
-
const minY = Math.max(a2.minY, b.minY);
|
|
96451
|
-
const maxX = Math.min(a2.maxX, b.maxX);
|
|
96452
|
-
const maxY = Math.min(a2.maxY, b.maxY);
|
|
96453
|
-
return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
|
|
96454
|
-
}
|
|
96455
|
-
function contains$1(a2, b) {
|
|
96456
|
-
return a2.minX <= b.minX && a2.minY <= b.minY && b.maxX <= a2.maxX && b.maxY <= a2.maxY;
|
|
96457
|
-
}
|
|
96458
|
-
function intersects(a2, b) {
|
|
96459
|
-
return b.minX <= a2.maxX && b.minY <= a2.maxY && b.maxX >= a2.minX && b.maxY >= a2.minY;
|
|
96460
|
-
}
|
|
96461
|
-
function createNode(children) {
|
|
96462
|
-
return {
|
|
96463
|
-
children,
|
|
96464
|
-
height: 1,
|
|
96465
|
-
leaf: true,
|
|
96466
|
-
minX: Infinity,
|
|
96467
|
-
minY: Infinity,
|
|
96468
|
-
maxX: -Infinity,
|
|
96469
|
-
maxY: -Infinity
|
|
96470
|
-
};
|
|
96471
|
-
}
|
|
96472
|
-
function multiSelect(arr, left, right, n3, compare2) {
|
|
96473
|
-
const stack2 = [left, right];
|
|
96474
|
-
while (stack2.length) {
|
|
96475
|
-
right = stack2.pop();
|
|
96476
|
-
left = stack2.pop();
|
|
96477
|
-
if (right - left <= n3) continue;
|
|
96478
|
-
const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
|
|
96479
|
-
quickselect(arr, mid, left, right, compare2);
|
|
96480
|
-
stack2.push(left, mid, mid, right);
|
|
96481
|
-
}
|
|
96482
|
-
}
|
|
96483
|
-
function geojsonRbush(maxEntries) {
|
|
96484
|
-
var tree = new RBush(maxEntries);
|
|
96485
|
-
tree.insert = function(feature2) {
|
|
96486
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
96487
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
96488
|
-
return RBush.prototype.insert.call(this, feature2);
|
|
96489
|
-
};
|
|
96490
|
-
tree.load = function(features) {
|
|
96491
|
-
var load2 = [];
|
|
96492
|
-
if (Array.isArray(features)) {
|
|
96493
|
-
features.forEach(function(feature2) {
|
|
96494
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
96495
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
96496
|
-
load2.push(feature2);
|
|
96497
|
-
});
|
|
96498
|
-
} else {
|
|
96499
|
-
featureEach(features, function(feature2) {
|
|
96500
|
-
if (feature2.type !== "Feature") throw new Error("invalid features");
|
|
96501
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
96502
|
-
load2.push(feature2);
|
|
96503
|
-
});
|
|
96504
|
-
}
|
|
96505
|
-
return RBush.prototype.load.call(this, load2);
|
|
96506
|
-
};
|
|
96507
|
-
tree.remove = function(feature2, equals2) {
|
|
96508
|
-
if (feature2.type !== "Feature") throw new Error("invalid feature");
|
|
96509
|
-
feature2.bbox = feature2.bbox ? feature2.bbox : bbox$1(feature2);
|
|
96510
|
-
return RBush.prototype.remove.call(this, feature2, equals2);
|
|
96511
|
-
};
|
|
96512
|
-
tree.clear = function() {
|
|
96513
|
-
return RBush.prototype.clear.call(this);
|
|
96514
|
-
};
|
|
96515
|
-
tree.search = function(geojson) {
|
|
96516
|
-
var features = RBush.prototype.search.call(this, this.toBBox(geojson));
|
|
96517
|
-
return featureCollection(features);
|
|
96518
|
-
};
|
|
96519
|
-
tree.collides = function(geojson) {
|
|
96520
|
-
return RBush.prototype.collides.call(this, this.toBBox(geojson));
|
|
96521
|
-
};
|
|
96522
|
-
tree.all = function() {
|
|
96523
|
-
var features = RBush.prototype.all.call(this);
|
|
96524
|
-
return featureCollection(features);
|
|
96525
|
-
};
|
|
96526
|
-
tree.toJSON = function() {
|
|
96527
|
-
return RBush.prototype.toJSON.call(this);
|
|
96528
|
-
};
|
|
96529
|
-
tree.fromJSON = function(json) {
|
|
96530
|
-
return RBush.prototype.fromJSON.call(this, json);
|
|
96531
|
-
};
|
|
96532
|
-
tree.toBBox = function(geojson) {
|
|
96533
|
-
var bbox2;
|
|
96534
|
-
if (geojson.bbox) bbox2 = geojson.bbox;
|
|
96535
|
-
else if (Array.isArray(geojson) && geojson.length === 4) bbox2 = geojson;
|
|
96536
|
-
else if (Array.isArray(geojson) && geojson.length === 6)
|
|
96537
|
-
bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
|
|
96538
|
-
else if (geojson.type === "Feature") bbox2 = bbox$1(geojson);
|
|
96539
|
-
else if (geojson.type === "FeatureCollection") bbox2 = bbox$1(geojson);
|
|
96540
|
-
else throw new Error("invalid geojson");
|
|
96541
|
-
return {
|
|
96542
|
-
minX: bbox2[0],
|
|
96543
|
-
minY: bbox2[1],
|
|
96544
|
-
maxX: bbox2[2],
|
|
96545
|
-
maxY: bbox2[3]
|
|
96546
|
-
};
|
|
96547
|
-
};
|
|
96548
|
-
return tree;
|
|
96549
|
-
}
|
|
96550
|
-
function lineSegment(geojson) {
|
|
96551
|
-
if (!geojson) {
|
|
96552
|
-
throw new Error("geojson is required");
|
|
96553
|
-
}
|
|
96554
|
-
const results = [];
|
|
96555
|
-
flattenEach(geojson, (feature2) => {
|
|
96556
|
-
lineSegmentFeature(feature2, results);
|
|
96557
|
-
});
|
|
96558
|
-
return featureCollection(results);
|
|
96559
|
-
}
|
|
96560
|
-
function lineSegmentFeature(geojson, results) {
|
|
96561
|
-
let coords = [];
|
|
96562
|
-
const geometry2 = geojson.geometry;
|
|
96563
|
-
if (geometry2 !== null) {
|
|
96564
|
-
switch (geometry2.type) {
|
|
96565
|
-
case "Polygon":
|
|
96566
|
-
coords = getCoords(geometry2);
|
|
96567
|
-
break;
|
|
96568
|
-
case "LineString":
|
|
96569
|
-
coords = [getCoords(geometry2)];
|
|
96570
|
-
}
|
|
96571
|
-
coords.forEach((coord) => {
|
|
96572
|
-
const segments = createSegments(coord, geojson.properties);
|
|
96573
|
-
segments.forEach((segment) => {
|
|
96574
|
-
segment.id = results.length;
|
|
96575
|
-
results.push(segment);
|
|
96576
|
-
});
|
|
96577
|
-
});
|
|
96578
|
-
}
|
|
96579
|
-
}
|
|
96580
|
-
function createSegments(coords, properties) {
|
|
96581
|
-
const segments = [];
|
|
96582
|
-
coords.reduce((previousCoords, currentCoords) => {
|
|
96583
|
-
const segment = lineString([previousCoords, currentCoords], properties);
|
|
96584
|
-
segment.bbox = bbox(previousCoords, currentCoords);
|
|
96585
|
-
segments.push(segment);
|
|
96586
|
-
return currentCoords;
|
|
96587
|
-
});
|
|
96588
|
-
return segments;
|
|
96589
|
-
}
|
|
96590
|
-
function bbox(coords1, coords2) {
|
|
96591
|
-
const x12 = coords1[0];
|
|
96592
|
-
const y12 = coords1[1];
|
|
96593
|
-
const x2 = coords2[0];
|
|
96594
|
-
const y2 = coords2[1];
|
|
96595
|
-
const west = x12 < x2 ? x12 : x2;
|
|
96596
|
-
const south = y12 < y2 ? y12 : y2;
|
|
96597
|
-
const east = x12 > x2 ? x12 : x2;
|
|
96598
|
-
const north = y12 > y2 ? y12 : y2;
|
|
96599
|
-
return [west, south, east, north];
|
|
96600
|
-
}
|
|
96601
|
-
function distance$1(from, to, options = {}) {
|
|
96602
|
-
var coordinates1 = getCoord(from);
|
|
96603
|
-
var coordinates2 = getCoord(to);
|
|
96604
|
-
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
96605
|
-
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
96606
|
-
var lat1 = degreesToRadians(coordinates1[1]);
|
|
96607
|
-
var lat2 = degreesToRadians(coordinates2[1]);
|
|
96608
|
-
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
96609
|
-
return radiansToLength(
|
|
96610
|
-
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
96611
|
-
options.units
|
|
96612
|
-
);
|
|
96613
|
-
}
|
|
96614
|
-
var __defProp$4 = Object.defineProperty;
|
|
96615
|
-
var __defProps = Object.defineProperties;
|
|
96616
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
96617
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
96618
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
96619
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
96620
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
96621
|
-
var __spreadValues = (a2, b) => {
|
|
96622
|
-
for (var prop in b || (b = {}))
|
|
96623
|
-
if (__hasOwnProp.call(b, prop))
|
|
96624
|
-
__defNormalProp$1(a2, prop, b[prop]);
|
|
96625
|
-
if (__getOwnPropSymbols)
|
|
96626
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
96627
|
-
if (__propIsEnum.call(b, prop))
|
|
96628
|
-
__defNormalProp$1(a2, prop, b[prop]);
|
|
96629
|
-
}
|
|
96630
|
-
return a2;
|
|
96631
|
-
};
|
|
96632
|
-
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
96633
|
-
function nearestPointOnLine(lines, pt, options = {}) {
|
|
96634
|
-
if (!lines || !pt) {
|
|
96635
|
-
throw new Error("lines and pt are required arguments");
|
|
96636
|
-
}
|
|
96637
|
-
const ptPos = getCoord(pt);
|
|
96638
|
-
let closestPt = point([Infinity, Infinity], {
|
|
96639
|
-
dist: Infinity,
|
|
96640
|
-
index: -1,
|
|
96641
|
-
multiFeatureIndex: -1,
|
|
96642
|
-
location: -1
|
|
96643
|
-
});
|
|
96644
|
-
let length2 = 0;
|
|
96645
|
-
flattenEach(
|
|
96646
|
-
lines,
|
|
96647
|
-
function(line, _featureIndex, multiFeatureIndex) {
|
|
96648
|
-
const coords = getCoords(line);
|
|
96649
|
-
for (let i2 = 0; i2 < coords.length - 1; i2++) {
|
|
96650
|
-
const start = point(coords[i2]);
|
|
96651
|
-
start.properties.dist = distance$1(pt, start, options);
|
|
96652
|
-
const startPos = getCoord(start);
|
|
96653
|
-
const stop = point(coords[i2 + 1]);
|
|
96654
|
-
stop.properties.dist = distance$1(pt, stop, options);
|
|
96655
|
-
const stopPos = getCoord(stop);
|
|
96656
|
-
const sectionLength = distance$1(start, stop, options);
|
|
96657
|
-
let intersectPos;
|
|
96658
|
-
let wasEnd;
|
|
96659
|
-
if (startPos[0] === ptPos[0] && startPos[1] === ptPos[1]) {
|
|
96660
|
-
[intersectPos, , wasEnd] = [startPos, void 0, false];
|
|
96661
|
-
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
96662
|
-
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
96663
|
-
} else {
|
|
96664
|
-
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
96665
|
-
start.geometry.coordinates,
|
|
96666
|
-
stop.geometry.coordinates,
|
|
96667
|
-
getCoord(pt)
|
|
96668
|
-
);
|
|
96669
|
-
}
|
|
96670
|
-
let intersectPt;
|
|
96671
|
-
if (intersectPos) {
|
|
96672
|
-
intersectPt = point(intersectPos, {
|
|
96673
|
-
dist: distance$1(pt, intersectPos, options),
|
|
96674
|
-
multiFeatureIndex,
|
|
96675
|
-
location: length2 + distance$1(start, intersectPos, options)
|
|
96676
|
-
});
|
|
96677
|
-
}
|
|
96678
|
-
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
96679
|
-
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
96680
|
-
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
96681
|
-
// Legacy behaviour where index progresses to next segment # if we
|
|
96682
|
-
// went with the end point this iteration.
|
|
96683
|
-
index: wasEnd ? i2 + 1 : i2
|
|
96684
|
-
})
|
|
96685
|
-
});
|
|
96686
|
-
}
|
|
96687
|
-
length2 += sectionLength;
|
|
96688
|
-
}
|
|
96689
|
-
}
|
|
96690
|
-
);
|
|
96691
|
-
return closestPt;
|
|
96692
|
-
}
|
|
96693
|
-
function dot(v12, v2) {
|
|
96694
|
-
const [v1x, v1y, v1z] = v12;
|
|
96695
|
-
const [v2x, v2y, v2z] = v2;
|
|
96696
|
-
return v1x * v2x + v1y * v2y + v1z * v2z;
|
|
96697
|
-
}
|
|
96698
|
-
function cross(v12, v2) {
|
|
96699
|
-
const [v1x, v1y, v1z] = v12;
|
|
96700
|
-
const [v2x, v2y, v2z] = v2;
|
|
96701
|
-
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
96702
|
-
}
|
|
96703
|
-
function magnitude(v) {
|
|
96704
|
-
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
96705
|
-
}
|
|
96706
|
-
function angle$1(v12, v2) {
|
|
96707
|
-
const theta = dot(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
96708
|
-
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
96709
|
-
}
|
|
96710
|
-
function lngLatToVector(a2) {
|
|
96711
|
-
const lat = degreesToRadians(a2[1]);
|
|
96712
|
-
const lng = degreesToRadians(a2[0]);
|
|
96713
|
-
return [
|
|
96714
|
-
Math.cos(lat) * Math.cos(lng),
|
|
96715
|
-
Math.cos(lat) * Math.sin(lng),
|
|
96716
|
-
Math.sin(lat)
|
|
96717
|
-
];
|
|
96718
|
-
}
|
|
96719
|
-
function vectorToLngLat(v) {
|
|
96720
|
-
const [x, y, z2] = v;
|
|
96721
|
-
const lat = radiansToDegrees(Math.asin(z2));
|
|
96722
|
-
const lng = radiansToDegrees(Math.atan2(y, x));
|
|
96723
|
-
return [lng, lat];
|
|
96724
|
-
}
|
|
96725
|
-
function nearestPointOnSegment(posA, posB, posC) {
|
|
96726
|
-
const A2 = lngLatToVector(posA);
|
|
96727
|
-
const B2 = lngLatToVector(posB);
|
|
96728
|
-
const C3 = lngLatToVector(posC);
|
|
96729
|
-
const [Cx, Cy, Cz] = C3;
|
|
96730
|
-
const [D2, E2, F] = cross(A2, B2);
|
|
96731
|
-
const a2 = E2 * Cz - F * Cy;
|
|
96732
|
-
const b = F * Cx - D2 * Cz;
|
|
96733
|
-
const c = D2 * Cy - E2 * Cx;
|
|
96734
|
-
const f2 = c * E2 - b * F;
|
|
96735
|
-
const g2 = a2 * F - c * D2;
|
|
96736
|
-
const h = b * D2 - a2 * E2;
|
|
96737
|
-
const t = 1 / Math.sqrt(Math.pow(f2, 2) + Math.pow(g2, 2) + Math.pow(h, 2));
|
|
96738
|
-
const I1 = [f2 * t, g2 * t, h * t];
|
|
96739
|
-
const I2 = [-1 * f2 * t, -1 * g2 * t, -1 * h * t];
|
|
96740
|
-
const angleAB = angle$1(A2, B2);
|
|
96741
|
-
const angleAI1 = angle$1(A2, I1);
|
|
96742
|
-
const angleBI1 = angle$1(B2, I1);
|
|
96743
|
-
const angleAI2 = angle$1(A2, I2);
|
|
96744
|
-
const angleBI2 = angle$1(B2, I2);
|
|
96745
|
-
let I3;
|
|
96746
|
-
if (angleAI1 < angleAI2 && angleAI1 < angleBI2 || angleBI1 < angleAI2 && angleBI1 < angleBI2) {
|
|
96747
|
-
I3 = I1;
|
|
96748
|
-
} else {
|
|
96749
|
-
I3 = I2;
|
|
96750
|
-
}
|
|
96751
|
-
if (angle$1(A2, I3) > angleAB || angle$1(B2, I3) > angleAB) {
|
|
96752
|
-
if (distance$1(vectorToLngLat(I3), vectorToLngLat(A2)) <= distance$1(vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
96753
|
-
return [vectorToLngLat(A2), true, false];
|
|
96754
|
-
} else {
|
|
96755
|
-
return [vectorToLngLat(B2), false, true];
|
|
96756
|
-
}
|
|
96757
|
-
}
|
|
96758
|
-
return [vectorToLngLat(I3), false, false];
|
|
96759
|
-
}
|
|
96760
|
-
var fastDeepEqual;
|
|
96761
|
-
var hasRequiredFastDeepEqual;
|
|
96762
|
-
function requireFastDeepEqual() {
|
|
96763
|
-
if (hasRequiredFastDeepEqual) return fastDeepEqual;
|
|
96764
|
-
hasRequiredFastDeepEqual = 1;
|
|
96765
|
-
fastDeepEqual = function equal2(a2, b) {
|
|
96766
|
-
if (a2 === b) return true;
|
|
96767
|
-
if (a2 && b && typeof a2 == "object" && typeof b == "object") {
|
|
96768
|
-
if (a2.constructor !== b.constructor) return false;
|
|
96769
|
-
var length2, i2, keys2;
|
|
96770
|
-
if (Array.isArray(a2)) {
|
|
96771
|
-
length2 = a2.length;
|
|
96772
|
-
if (length2 != b.length) return false;
|
|
96773
|
-
for (i2 = length2; i2-- !== 0; )
|
|
96774
|
-
if (!equal2(a2[i2], b[i2])) return false;
|
|
96775
|
-
return true;
|
|
96776
|
-
}
|
|
96777
|
-
if (a2.constructor === RegExp) return a2.source === b.source && a2.flags === b.flags;
|
|
96778
|
-
if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b.valueOf();
|
|
96779
|
-
if (a2.toString !== Object.prototype.toString) return a2.toString() === b.toString();
|
|
96780
|
-
keys2 = Object.keys(a2);
|
|
96781
|
-
length2 = keys2.length;
|
|
96782
|
-
if (length2 !== Object.keys(b).length) return false;
|
|
96783
|
-
for (i2 = length2; i2-- !== 0; )
|
|
96784
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys2[i2])) return false;
|
|
96785
|
-
for (i2 = length2; i2-- !== 0; ) {
|
|
96786
|
-
var key = keys2[i2];
|
|
96787
|
-
if (!equal2(a2[key], b[key])) return false;
|
|
96788
|
-
}
|
|
96789
|
-
return true;
|
|
96790
|
-
}
|
|
96791
|
-
return a2 !== a2 && b !== b;
|
|
96792
|
-
};
|
|
96793
|
-
return fastDeepEqual;
|
|
96794
|
-
}
|
|
96795
|
-
var fastDeepEqualExports = requireFastDeepEqual();
|
|
96796
|
-
const equal$1 = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
96797
|
-
function lineOverlap(line1, line2, options = {}) {
|
|
96798
|
-
options = options || {};
|
|
96799
|
-
if (!isObject$4(options)) throw new Error("options is invalid");
|
|
96800
|
-
var tolerance = options.tolerance || 0;
|
|
96801
|
-
var features = [];
|
|
96802
|
-
var tree = geojsonRbush();
|
|
96803
|
-
const line = lineSegment(line1);
|
|
96804
|
-
tree.load(line);
|
|
96805
|
-
var overlapSegment;
|
|
96806
|
-
let additionalSegments = [];
|
|
96807
|
-
segmentEach(line2, function(segment) {
|
|
96808
|
-
var doesOverlaps = false;
|
|
96809
|
-
if (!segment) {
|
|
96810
|
-
return;
|
|
96811
|
-
}
|
|
96812
|
-
featureEach(tree.search(segment), function(match) {
|
|
96813
|
-
if (doesOverlaps === false) {
|
|
96814
|
-
var coordsSegment = getCoords(segment).sort();
|
|
96815
|
-
var coordsMatch = getCoords(match).sort();
|
|
96816
|
-
if (equal$1(coordsSegment, coordsMatch)) {
|
|
96817
|
-
doesOverlaps = true;
|
|
96818
|
-
if (overlapSegment) {
|
|
96819
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
96820
|
-
} else overlapSegment = segment;
|
|
96821
|
-
} 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) {
|
|
96822
|
-
doesOverlaps = true;
|
|
96823
|
-
if (overlapSegment) {
|
|
96824
|
-
overlapSegment = concatSegment(overlapSegment, segment) || overlapSegment;
|
|
96825
|
-
} else overlapSegment = segment;
|
|
96826
|
-
} 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) {
|
|
96827
|
-
if (overlapSegment) {
|
|
96828
|
-
const combinedSegment = concatSegment(overlapSegment, match);
|
|
96829
|
-
if (combinedSegment) {
|
|
96830
|
-
overlapSegment = combinedSegment;
|
|
96831
|
-
} else {
|
|
96832
|
-
additionalSegments.push(match);
|
|
96833
|
-
}
|
|
96834
|
-
} else overlapSegment = match;
|
|
96835
|
-
}
|
|
96836
|
-
}
|
|
96837
|
-
});
|
|
96838
|
-
if (doesOverlaps === false && overlapSegment) {
|
|
96839
|
-
features.push(overlapSegment);
|
|
96840
|
-
if (additionalSegments.length) {
|
|
96841
|
-
features = features.concat(additionalSegments);
|
|
96842
|
-
additionalSegments = [];
|
|
96843
|
-
}
|
|
96844
|
-
overlapSegment = void 0;
|
|
96845
|
-
}
|
|
96846
|
-
});
|
|
96847
|
-
if (overlapSegment) features.push(overlapSegment);
|
|
96848
|
-
return featureCollection(features);
|
|
96849
|
-
}
|
|
96850
|
-
function concatSegment(line, segment) {
|
|
96851
|
-
var coords = getCoords(segment);
|
|
96852
|
-
var lineCoords = getCoords(line);
|
|
96853
|
-
var start = lineCoords[0];
|
|
96854
|
-
var end = lineCoords[lineCoords.length - 1];
|
|
96855
|
-
var geom = line.geometry.coordinates;
|
|
96856
|
-
if (equal$1(coords[0], start)) geom.unshift(coords[1]);
|
|
96857
|
-
else if (equal$1(coords[0], end)) geom.push(coords[1]);
|
|
96858
|
-
else if (equal$1(coords[1], start)) geom.unshift(coords[0]);
|
|
96859
|
-
else if (equal$1(coords[1], end)) geom.push(coords[0]);
|
|
96860
|
-
else return;
|
|
96861
|
-
return line;
|
|
96862
|
-
}
|
|
96863
|
-
class TinyQueue2 {
|
|
96864
|
-
constructor(data = [], compare2 = defaultCompare) {
|
|
96865
|
-
this.data = data;
|
|
96866
|
-
this.length = this.data.length;
|
|
96867
|
-
this.compare = compare2;
|
|
96868
|
-
if (this.length > 0) {
|
|
96869
|
-
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
96870
|
-
}
|
|
96871
|
-
}
|
|
96872
|
-
push(item) {
|
|
96873
|
-
this.data.push(item);
|
|
96874
|
-
this.length++;
|
|
96875
|
-
this._up(this.length - 1);
|
|
96876
|
-
}
|
|
96877
|
-
pop() {
|
|
96878
|
-
if (this.length === 0) return void 0;
|
|
96879
|
-
const top = this.data[0];
|
|
96880
|
-
const bottom = this.data.pop();
|
|
96881
|
-
this.length--;
|
|
96882
|
-
if (this.length > 0) {
|
|
96883
|
-
this.data[0] = bottom;
|
|
96884
|
-
this._down(0);
|
|
96885
|
-
}
|
|
96886
|
-
return top;
|
|
96887
|
-
}
|
|
96888
|
-
peek() {
|
|
96889
|
-
return this.data[0];
|
|
96890
|
-
}
|
|
96891
|
-
_up(pos) {
|
|
96892
|
-
const { data, compare: compare2 } = this;
|
|
96893
|
-
const item = data[pos];
|
|
96894
|
-
while (pos > 0) {
|
|
96895
|
-
const parent = pos - 1 >> 1;
|
|
96896
|
-
const current = data[parent];
|
|
96897
|
-
if (compare2(item, current) >= 0) break;
|
|
96898
|
-
data[pos] = current;
|
|
96899
|
-
pos = parent;
|
|
96900
|
-
}
|
|
96901
|
-
data[pos] = item;
|
|
96902
|
-
}
|
|
96903
|
-
_down(pos) {
|
|
96904
|
-
const { data, compare: compare2 } = this;
|
|
96905
|
-
const halfLength = this.length >> 1;
|
|
96906
|
-
const item = data[pos];
|
|
96907
|
-
while (pos < halfLength) {
|
|
96908
|
-
let left = (pos << 1) + 1;
|
|
96909
|
-
let best = data[left];
|
|
96910
|
-
const right = left + 1;
|
|
96911
|
-
if (right < this.length && compare2(data[right], best) < 0) {
|
|
96912
|
-
left = right;
|
|
96913
|
-
best = data[right];
|
|
96914
|
-
}
|
|
96915
|
-
if (compare2(best, item) >= 0) break;
|
|
96916
|
-
data[pos] = best;
|
|
96917
|
-
pos = left;
|
|
96918
|
-
}
|
|
96919
|
-
data[pos] = item;
|
|
96920
|
-
}
|
|
96921
|
-
}
|
|
96922
|
-
function defaultCompare(a2, b) {
|
|
96923
|
-
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
96924
|
-
}
|
|
96925
|
-
function checkWhichEventIsLeft(e1, e2) {
|
|
96926
|
-
if (e1.p.x > e2.p.x) return 1;
|
|
96927
|
-
if (e1.p.x < e2.p.x) return -1;
|
|
96928
|
-
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
96929
|
-
return 1;
|
|
96930
|
-
}
|
|
96931
|
-
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
96932
|
-
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
96933
|
-
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
96934
|
-
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
96935
|
-
return 1;
|
|
96936
|
-
}
|
|
96937
|
-
class Event {
|
|
96938
|
-
constructor(p, featureId2, ringId2, eventId2) {
|
|
96939
|
-
this.p = {
|
|
96940
|
-
x: p[0],
|
|
96941
|
-
y: p[1]
|
|
96942
|
-
};
|
|
96943
|
-
this.featureId = featureId2;
|
|
96944
|
-
this.ringId = ringId2;
|
|
96945
|
-
this.eventId = eventId2;
|
|
96946
|
-
this.otherEvent = null;
|
|
96947
|
-
this.isLeftEndpoint = null;
|
|
96948
|
-
}
|
|
96949
|
-
isSamePoint(eventToCheck) {
|
|
96950
|
-
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
96951
|
-
}
|
|
96952
|
-
}
|
|
96953
|
-
function fillEventQueue(geojson, eventQueue) {
|
|
96954
|
-
if (geojson.type === "FeatureCollection") {
|
|
96955
|
-
const features = geojson.features;
|
|
96956
|
-
for (let i2 = 0; i2 < features.length; i2++) {
|
|
96957
|
-
processFeature(features[i2], eventQueue);
|
|
96958
|
-
}
|
|
96959
|
-
} else {
|
|
96960
|
-
processFeature(geojson, eventQueue);
|
|
96961
|
-
}
|
|
96962
|
-
}
|
|
96963
|
-
let featureId = 0;
|
|
96964
|
-
let ringId = 0;
|
|
96965
|
-
let eventId = 0;
|
|
96966
|
-
function processFeature(featureOrGeometry, eventQueue) {
|
|
96967
|
-
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
96968
|
-
let coords = geom.coordinates;
|
|
96969
|
-
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
96970
|
-
if (geom.type === "LineString") coords = [[coords]];
|
|
96971
|
-
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
96972
|
-
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
96973
|
-
let currentP = coords[i2][ii][0];
|
|
96974
|
-
let nextP = null;
|
|
96975
|
-
ringId = ringId + 1;
|
|
96976
|
-
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
96977
|
-
nextP = coords[i2][ii][iii + 1];
|
|
96978
|
-
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
96979
|
-
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
96980
|
-
e1.otherEvent = e2;
|
|
96981
|
-
e2.otherEvent = e1;
|
|
96982
|
-
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
96983
|
-
e2.isLeftEndpoint = true;
|
|
96984
|
-
e1.isLeftEndpoint = false;
|
|
96985
|
-
} else {
|
|
96986
|
-
e1.isLeftEndpoint = true;
|
|
96987
|
-
e2.isLeftEndpoint = false;
|
|
96988
|
-
}
|
|
96989
|
-
eventQueue.push(e1);
|
|
96990
|
-
eventQueue.push(e2);
|
|
96991
|
-
currentP = nextP;
|
|
96992
|
-
eventId = eventId + 1;
|
|
96993
|
-
}
|
|
96994
|
-
}
|
|
96995
|
-
}
|
|
96996
|
-
featureId = featureId + 1;
|
|
96997
|
-
}
|
|
96998
|
-
let Segment$1 = class Segment {
|
|
96999
|
-
constructor(event) {
|
|
97000
|
-
this.leftSweepEvent = event;
|
|
97001
|
-
this.rightSweepEvent = event.otherEvent;
|
|
97002
|
-
}
|
|
97003
|
-
};
|
|
97004
|
-
function testSegmentIntersect(seg1, seg2) {
|
|
97005
|
-
if (seg1 === null || seg2 === null) return false;
|
|
97006
|
-
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;
|
|
97007
|
-
const x12 = seg1.leftSweepEvent.p.x;
|
|
97008
|
-
const y12 = seg1.leftSweepEvent.p.y;
|
|
97009
|
-
const x2 = seg1.rightSweepEvent.p.x;
|
|
97010
|
-
const y2 = seg1.rightSweepEvent.p.y;
|
|
97011
|
-
const x3 = seg2.leftSweepEvent.p.x;
|
|
97012
|
-
const y3 = seg2.leftSweepEvent.p.y;
|
|
97013
|
-
const x4 = seg2.rightSweepEvent.p.x;
|
|
97014
|
-
const y4 = seg2.rightSweepEvent.p.y;
|
|
97015
|
-
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
97016
|
-
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
97017
|
-
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
97018
|
-
if (denom === 0) {
|
|
97019
|
-
if (numeA === 0 && numeB === 0) return false;
|
|
97020
|
-
return false;
|
|
97021
|
-
}
|
|
97022
|
-
const uA = numeA / denom;
|
|
97023
|
-
const uB = numeB / denom;
|
|
97024
|
-
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
97025
|
-
const x = x12 + uA * (x2 - x12);
|
|
97026
|
-
const y = y12 + uA * (y2 - y12);
|
|
97027
|
-
return [x, y];
|
|
97028
|
-
}
|
|
97029
|
-
return false;
|
|
97030
|
-
}
|
|
97031
|
-
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
97032
|
-
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
97033
|
-
const intersectionPoints = [];
|
|
97034
|
-
const outQueue = new TinyQueue2([], checkWhichSegmentHasRightEndpointFirst);
|
|
97035
|
-
while (eventQueue.length) {
|
|
97036
|
-
const event = eventQueue.pop();
|
|
97037
|
-
if (event.isLeftEndpoint) {
|
|
97038
|
-
const segment = new Segment$1(event);
|
|
97039
|
-
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
97040
|
-
const otherSeg = outQueue.data[i2];
|
|
97041
|
-
if (ignoreSelfIntersections) {
|
|
97042
|
-
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
97043
|
-
}
|
|
97044
|
-
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
97045
|
-
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
97046
|
-
}
|
|
97047
|
-
outQueue.push(segment);
|
|
97048
|
-
} else if (event.isLeftEndpoint === false) {
|
|
97049
|
-
outQueue.pop();
|
|
97050
|
-
}
|
|
97051
|
-
}
|
|
97052
|
-
return intersectionPoints;
|
|
97053
|
-
}
|
|
97054
|
-
function sweeplineIntersections$1(geojson, ignoreSelfIntersections) {
|
|
97055
|
-
const eventQueue = new TinyQueue2([], checkWhichEventIsLeft);
|
|
97056
|
-
fillEventQueue(geojson, eventQueue);
|
|
97057
|
-
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
97058
|
-
}
|
|
97059
|
-
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
97060
|
-
__proto__: null,
|
|
97061
|
-
default: sweeplineIntersections$1
|
|
97062
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
97063
|
-
var sweeplineIntersections = sweeplineIntersections$1;
|
|
97064
|
-
function lineIntersect(line1, line2, options = {}) {
|
|
97065
|
-
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
97066
|
-
let features = [];
|
|
97067
|
-
if (line1.type === "FeatureCollection")
|
|
97068
|
-
features = features.concat(line1.features);
|
|
97069
|
-
else if (line1.type === "Feature") features.push(line1);
|
|
97070
|
-
else if (line1.type === "LineString" || line1.type === "Polygon" || line1.type === "MultiLineString" || line1.type === "MultiPolygon") {
|
|
97071
|
-
features.push(feature$1(line1));
|
|
97072
|
-
}
|
|
97073
|
-
if (line2.type === "FeatureCollection")
|
|
97074
|
-
features = features.concat(line2.features);
|
|
97075
|
-
else if (line2.type === "Feature") features.push(line2);
|
|
97076
|
-
else if (line2.type === "LineString" || line2.type === "Polygon" || line2.type === "MultiLineString" || line2.type === "MultiPolygon") {
|
|
97077
|
-
features.push(feature$1(line2));
|
|
97078
|
-
}
|
|
97079
|
-
const intersections = sweeplineIntersections(
|
|
97080
|
-
featureCollection(features),
|
|
97081
|
-
ignoreSelfIntersections
|
|
97082
|
-
);
|
|
97083
|
-
let results = [];
|
|
97084
|
-
if (removeDuplicates) {
|
|
97085
|
-
const unique2 = {};
|
|
97086
|
-
intersections.forEach((intersection2) => {
|
|
97087
|
-
const key = intersection2.join(",");
|
|
97088
|
-
if (!unique2[key]) {
|
|
97089
|
-
unique2[key] = true;
|
|
97090
|
-
results.push(intersection2);
|
|
97091
|
-
}
|
|
97092
|
-
});
|
|
97093
|
-
} else {
|
|
97094
|
-
results = intersections;
|
|
97095
|
-
}
|
|
97096
|
-
return featureCollection(results.map((r2) => point(r2)));
|
|
97097
|
-
}
|
|
97098
|
-
var __defProp$1 = Object.defineProperty;
|
|
97099
|
-
var __name = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
97100
|
-
var _GeojsonEquality = class _GeojsonEquality2 {
|
|
97101
|
-
constructor(opts) {
|
|
97102
|
-
this.direction = false;
|
|
97103
|
-
this.compareProperties = true;
|
|
97104
|
-
var _a2, _b, _c;
|
|
97105
|
-
this.precision = 10 ** -((_a2 = opts == null ? void 0 : opts.precision) != null ? _a2 : 17);
|
|
97106
|
-
this.direction = (_b = opts == null ? void 0 : opts.direction) != null ? _b : false;
|
|
97107
|
-
this.compareProperties = (_c = opts == null ? void 0 : opts.compareProperties) != null ? _c : true;
|
|
97108
|
-
}
|
|
97109
|
-
compare(g1, g2) {
|
|
97110
|
-
if (g1.type !== g2.type) {
|
|
97111
|
-
return false;
|
|
97112
|
-
}
|
|
97113
|
-
if (!sameLength(g1, g2)) {
|
|
97114
|
-
return false;
|
|
97115
|
-
}
|
|
97116
|
-
switch (g1.type) {
|
|
97117
|
-
case "Point":
|
|
97118
|
-
return this.compareCoord(g1.coordinates, g2.coordinates);
|
|
97119
|
-
case "LineString":
|
|
97120
|
-
return this.compareLine(g1.coordinates, g2.coordinates);
|
|
97121
|
-
case "Polygon":
|
|
97122
|
-
return this.comparePolygon(g1, g2);
|
|
97123
|
-
case "GeometryCollection":
|
|
97124
|
-
return this.compareGeometryCollection(g1, g2);
|
|
97125
|
-
case "Feature":
|
|
97126
|
-
return this.compareFeature(g1, g2);
|
|
97127
|
-
case "FeatureCollection":
|
|
97128
|
-
return this.compareFeatureCollection(g1, g2);
|
|
97129
|
-
default:
|
|
97130
|
-
if (g1.type.startsWith("Multi")) {
|
|
97131
|
-
const g1s = explode(g1);
|
|
97132
|
-
const g2s = explode(
|
|
97133
|
-
g2
|
|
97134
|
-
);
|
|
97135
|
-
return g1s.every(
|
|
97136
|
-
(g1part) => g2s.some((g2part) => this.compare(g1part, g2part))
|
|
97137
|
-
);
|
|
97138
|
-
}
|
|
97139
|
-
}
|
|
97140
|
-
return false;
|
|
97141
|
-
}
|
|
97142
|
-
compareCoord(c1, c2) {
|
|
97143
|
-
return c1.length === c2.length && c1.every((c, i2) => Math.abs(c - c2[i2]) < this.precision);
|
|
97144
|
-
}
|
|
97145
|
-
compareLine(path1, path2, ind = 0, isPoly = false) {
|
|
97146
|
-
if (!sameLength(path1, path2)) {
|
|
97147
|
-
return false;
|
|
97148
|
-
}
|
|
97149
|
-
const p1 = path1;
|
|
97150
|
-
let p2 = path2;
|
|
97151
|
-
if (isPoly && !this.compareCoord(p1[0], p2[0])) {
|
|
97152
|
-
const startIndex = this.fixStartIndex(p2, p1);
|
|
97153
|
-
if (!startIndex) {
|
|
97154
|
-
return false;
|
|
97155
|
-
} else {
|
|
97156
|
-
p2 = startIndex;
|
|
97157
|
-
}
|
|
97158
|
-
}
|
|
97159
|
-
const sameDirection = this.compareCoord(p1[ind], p2[ind]);
|
|
97160
|
-
if (this.direction || sameDirection) {
|
|
97161
|
-
return this.comparePath(p1, p2);
|
|
97162
|
-
} else {
|
|
97163
|
-
if (this.compareCoord(p1[ind], p2[p2.length - (1 + ind)])) {
|
|
97164
|
-
return this.comparePath(p1.slice().reverse(), p2);
|
|
97165
|
-
}
|
|
97166
|
-
return false;
|
|
97167
|
-
}
|
|
97168
|
-
}
|
|
97169
|
-
fixStartIndex(sourcePath, targetPath) {
|
|
97170
|
-
let correctPath, ind = -1;
|
|
97171
|
-
for (let i2 = 0; i2 < sourcePath.length; i2++) {
|
|
97172
|
-
if (this.compareCoord(sourcePath[i2], targetPath[0])) {
|
|
97173
|
-
ind = i2;
|
|
97174
|
-
break;
|
|
97175
|
-
}
|
|
97176
|
-
}
|
|
97177
|
-
if (ind >= 0) {
|
|
97178
|
-
correctPath = [].concat(
|
|
97179
|
-
sourcePath.slice(ind, sourcePath.length),
|
|
97180
|
-
sourcePath.slice(1, ind + 1)
|
|
97181
|
-
);
|
|
97182
|
-
}
|
|
97183
|
-
return correctPath;
|
|
97184
|
-
}
|
|
97185
|
-
comparePath(p1, p2) {
|
|
97186
|
-
return p1.every((c, i2) => this.compareCoord(c, p2[i2]));
|
|
97187
|
-
}
|
|
97188
|
-
comparePolygon(g1, g2) {
|
|
97189
|
-
if (this.compareLine(g1.coordinates[0], g2.coordinates[0], 1, true)) {
|
|
97190
|
-
const holes1 = g1.coordinates.slice(1, g1.coordinates.length);
|
|
97191
|
-
const holes2 = g2.coordinates.slice(1, g2.coordinates.length);
|
|
97192
|
-
return holes1.every(
|
|
97193
|
-
(h1) => holes2.some((h2) => this.compareLine(h1, h2, 1, true))
|
|
97194
|
-
);
|
|
97195
|
-
}
|
|
97196
|
-
return false;
|
|
97197
|
-
}
|
|
97198
|
-
compareGeometryCollection(g1, g2) {
|
|
97199
|
-
return sameLength(g1.geometries, g2.geometries) && this.compareBBox(g1, g2) && g1.geometries.every((g3, i2) => this.compare(g3, g2.geometries[i2]));
|
|
97200
|
-
}
|
|
97201
|
-
compareFeature(g1, g2) {
|
|
97202
|
-
return g1.id === g2.id && (this.compareProperties ? equal(g1.properties, g2.properties) : true) && this.compareBBox(g1, g2) && this.compare(g1.geometry, g2.geometry);
|
|
97203
|
-
}
|
|
97204
|
-
compareFeatureCollection(g1, g2) {
|
|
97205
|
-
return sameLength(g1.features, g2.features) && this.compareBBox(g1, g2) && g1.features.every((f2, i2) => this.compare(f2, g2.features[i2]));
|
|
97206
|
-
}
|
|
97207
|
-
compareBBox(g1, g2) {
|
|
97208
|
-
return Boolean(!g1.bbox && !g2.bbox) || (g1.bbox && g2.bbox ? this.compareCoord(g1.bbox, g2.bbox) : false);
|
|
97209
|
-
}
|
|
97210
|
-
};
|
|
97211
|
-
__name(_GeojsonEquality, "GeojsonEquality");
|
|
97212
|
-
var GeojsonEquality = _GeojsonEquality;
|
|
97213
|
-
function sameLength(g1, g2) {
|
|
97214
|
-
return g1.coordinates ? g1.coordinates.length === g2.coordinates.length : g1.length === g2.length;
|
|
97215
|
-
}
|
|
97216
|
-
__name(sameLength, "sameLength");
|
|
97217
|
-
function explode(g2) {
|
|
97218
|
-
return g2.coordinates.map((part) => ({
|
|
97219
|
-
type: g2.type.replace("Multi", ""),
|
|
97220
|
-
coordinates: part
|
|
97221
|
-
}));
|
|
97222
|
-
}
|
|
97223
|
-
__name(explode, "explode");
|
|
97224
|
-
function geojsonEquality(g1, g2, opts) {
|
|
97225
|
-
const eq2 = new GeojsonEquality(opts);
|
|
97226
|
-
return eq2.compare(g1, g2);
|
|
97227
|
-
}
|
|
97228
|
-
__name(geojsonEquality, "geojsonEquality");
|
|
97229
|
-
function equal(object1, object2) {
|
|
97230
|
-
if (object1 === null && object2 === null) {
|
|
97231
|
-
return true;
|
|
97232
|
-
}
|
|
97233
|
-
if (object1 === null || object2 === null) {
|
|
97234
|
-
return false;
|
|
97235
|
-
}
|
|
97236
|
-
const objKeys1 = Object.keys(object1);
|
|
97237
|
-
const objKeys2 = Object.keys(object2);
|
|
97238
|
-
if (objKeys1.length !== objKeys2.length) return false;
|
|
97239
|
-
for (var key of objKeys1) {
|
|
97240
|
-
const value1 = object1[key];
|
|
97241
|
-
const value2 = object2[key];
|
|
97242
|
-
const isObjects = isObject(value1) && isObject(value2);
|
|
97243
|
-
if (isObjects && !equal(value1, value2) || !isObjects && value1 !== value2) {
|
|
97244
|
-
return false;
|
|
97245
|
-
}
|
|
97246
|
-
}
|
|
97247
|
-
return true;
|
|
97248
|
-
}
|
|
97249
|
-
__name(equal, "equal");
|
|
97250
|
-
var isObject = /* @__PURE__ */ __name((object2) => {
|
|
97251
|
-
return object2 != null && typeof object2 === "object";
|
|
97252
|
-
}, "isObject");
|
|
97253
|
-
function booleanOverlap(feature1, feature2) {
|
|
97254
|
-
const geom1 = getGeom(feature1);
|
|
97255
|
-
const geom2 = getGeom(feature2);
|
|
97256
|
-
const type1 = geom1.type;
|
|
97257
|
-
const type2 = geom2.type;
|
|
97258
|
-
if (type1 === "MultiPoint" && type2 !== "MultiPoint" || (type1 === "LineString" || type1 === "MultiLineString") && type2 !== "LineString" && type2 !== "MultiLineString" || (type1 === "Polygon" || type1 === "MultiPolygon") && type2 !== "Polygon" && type2 !== "MultiPolygon") {
|
|
97259
|
-
throw new Error("features must be of the same type");
|
|
97260
|
-
}
|
|
97261
|
-
if (type1 === "Point") throw new Error("Point geometry not supported");
|
|
97262
|
-
if (geojsonEquality(feature1, feature2, { precision: 6 }))
|
|
97263
|
-
return false;
|
|
97264
|
-
let overlap = 0;
|
|
97265
|
-
switch (type1) {
|
|
97266
|
-
case "MultiPoint":
|
|
97267
|
-
for (var i2 = 0; i2 < geom1.coordinates.length; i2++) {
|
|
97268
|
-
for (var j = 0; j < geom2.coordinates.length; j++) {
|
|
97269
|
-
var coord1 = geom1.coordinates[i2];
|
|
97270
|
-
var coord2 = geom2.coordinates[j];
|
|
97271
|
-
if (coord1[0] === coord2[0] && coord1[1] === coord2[1]) {
|
|
97272
|
-
return true;
|
|
97273
|
-
}
|
|
97274
|
-
}
|
|
97275
|
-
}
|
|
97276
|
-
return false;
|
|
97277
|
-
case "LineString":
|
|
97278
|
-
case "MultiLineString":
|
|
97279
|
-
segmentEach(feature1, (segment1) => {
|
|
97280
|
-
segmentEach(feature2, (segment2) => {
|
|
97281
|
-
if (lineOverlap(segment1, segment2).features.length) overlap++;
|
|
97282
|
-
});
|
|
97283
|
-
});
|
|
97284
|
-
break;
|
|
97285
|
-
case "Polygon":
|
|
97286
|
-
case "MultiPolygon":
|
|
97287
|
-
segmentEach(feature1, (segment1) => {
|
|
97288
|
-
segmentEach(feature2, (segment2) => {
|
|
97289
|
-
if (lineIntersect(segment1, segment2).features.length) overlap++;
|
|
97290
|
-
});
|
|
97291
|
-
});
|
|
97292
|
-
break;
|
|
97293
|
-
}
|
|
97294
|
-
return overlap > 0;
|
|
95421
|
+
function inBBox(pt, bbox) {
|
|
95422
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
97295
95423
|
}
|
|
97296
95424
|
var distEs6$2 = {};
|
|
97297
95425
|
var style$1 = {};
|
|
@@ -97388,7 +95516,7 @@ function requireCjs$f() {
|
|
|
97388
95516
|
case "Point":
|
|
97389
95517
|
return point2(coordinates2).geometry;
|
|
97390
95518
|
case "LineString":
|
|
97391
|
-
return
|
|
95519
|
+
return lineString(coordinates2).geometry;
|
|
97392
95520
|
case "Polygon":
|
|
97393
95521
|
return polygon2(coordinates2).geometry;
|
|
97394
95522
|
case "MultiPoint":
|
|
@@ -97458,7 +95586,7 @@ function requireCjs$f() {
|
|
|
97458
95586
|
options
|
|
97459
95587
|
);
|
|
97460
95588
|
}
|
|
97461
|
-
function
|
|
95589
|
+
function lineString(coordinates2, properties, options = {}) {
|
|
97462
95590
|
if (coordinates2.length < 2) {
|
|
97463
95591
|
throw new Error("coordinates must be an array of two or more positions");
|
|
97464
95592
|
}
|
|
@@ -97471,7 +95599,7 @@ function requireCjs$f() {
|
|
|
97471
95599
|
function lineStrings(coordinates2, properties, options = {}) {
|
|
97472
95600
|
return featureCollection2(
|
|
97473
95601
|
coordinates2.map((coords) => {
|
|
97474
|
-
return
|
|
95602
|
+
return lineString(coords, properties);
|
|
97475
95603
|
}),
|
|
97476
95604
|
options
|
|
97477
95605
|
);
|
|
@@ -97537,7 +95665,7 @@ function requireCjs$f() {
|
|
|
97537
95665
|
return distance2 / factor;
|
|
97538
95666
|
}
|
|
97539
95667
|
function lengthToDegrees(distance2, units) {
|
|
97540
|
-
return
|
|
95668
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
97541
95669
|
}
|
|
97542
95670
|
function bearingToAzimuth(bearing) {
|
|
97543
95671
|
let angle2 = bearing % 360;
|
|
@@ -97555,7 +95683,7 @@ function requireCjs$f() {
|
|
|
97555
95683
|
}
|
|
97556
95684
|
return angle2;
|
|
97557
95685
|
}
|
|
97558
|
-
function
|
|
95686
|
+
function radiansToDegrees(radians2) {
|
|
97559
95687
|
const normalisedRadians = radians2 % (2 * Math.PI);
|
|
97560
95688
|
return normalisedRadians * 180 / Math.PI;
|
|
97561
95689
|
}
|
|
@@ -97589,17 +95717,17 @@ function requireCjs$f() {
|
|
|
97589
95717
|
function isObject2(input) {
|
|
97590
95718
|
return input !== null && typeof input === "object" && !Array.isArray(input);
|
|
97591
95719
|
}
|
|
97592
|
-
function validateBBox(
|
|
97593
|
-
if (!
|
|
95720
|
+
function validateBBox(bbox) {
|
|
95721
|
+
if (!bbox) {
|
|
97594
95722
|
throw new Error("bbox is required");
|
|
97595
95723
|
}
|
|
97596
|
-
if (!Array.isArray(
|
|
95724
|
+
if (!Array.isArray(bbox)) {
|
|
97597
95725
|
throw new Error("bbox must be an Array");
|
|
97598
95726
|
}
|
|
97599
|
-
if (
|
|
95727
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
97600
95728
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
97601
95729
|
}
|
|
97602
|
-
|
|
95730
|
+
bbox.forEach((num) => {
|
|
97603
95731
|
if (!isNumber2(num)) {
|
|
97604
95732
|
throw new Error("bbox must only contain numbers");
|
|
97605
95733
|
}
|
|
@@ -97629,7 +95757,7 @@ function requireCjs$f() {
|
|
|
97629
95757
|
cjs$f.isObject = isObject2;
|
|
97630
95758
|
cjs$f.lengthToDegrees = lengthToDegrees;
|
|
97631
95759
|
cjs$f.lengthToRadians = lengthToRadians;
|
|
97632
|
-
cjs$f.lineString =
|
|
95760
|
+
cjs$f.lineString = lineString;
|
|
97633
95761
|
cjs$f.lineStrings = lineStrings;
|
|
97634
95762
|
cjs$f.multiLineString = multiLineString;
|
|
97635
95763
|
cjs$f.multiPoint = multiPoint;
|
|
@@ -97638,7 +95766,7 @@ function requireCjs$f() {
|
|
|
97638
95766
|
cjs$f.points = points;
|
|
97639
95767
|
cjs$f.polygon = polygon2;
|
|
97640
95768
|
cjs$f.polygons = polygons2;
|
|
97641
|
-
cjs$f.radiansToDegrees =
|
|
95769
|
+
cjs$f.radiansToDegrees = radiansToDegrees;
|
|
97642
95770
|
cjs$f.radiansToLength = radiansToLength2;
|
|
97643
95771
|
cjs$f.round = round2;
|
|
97644
95772
|
cjs$f.validateBBox = validateBBox;
|
|
@@ -97653,7 +95781,7 @@ function requireCjs$e() {
|
|
|
97653
95781
|
hasRequiredCjs$e = 1;
|
|
97654
95782
|
Object.defineProperty(cjs$d, "__esModule", { value: true });
|
|
97655
95783
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
97656
|
-
function
|
|
95784
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
97657
95785
|
if (geojson === null) return;
|
|
97658
95786
|
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;
|
|
97659
95787
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -97740,7 +95868,7 @@ function requireCjs$e() {
|
|
|
97740
95868
|
break;
|
|
97741
95869
|
case "GeometryCollection":
|
|
97742
95870
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
97743
|
-
if (
|
|
95871
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
97744
95872
|
return false;
|
|
97745
95873
|
break;
|
|
97746
95874
|
default:
|
|
@@ -97751,7 +95879,7 @@ function requireCjs$e() {
|
|
|
97751
95879
|
}
|
|
97752
95880
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
97753
95881
|
var previousValue = initialValue;
|
|
97754
|
-
|
|
95882
|
+
coordEach(
|
|
97755
95883
|
geojson,
|
|
97756
95884
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
97757
95885
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -97793,7 +95921,7 @@ function requireCjs$e() {
|
|
|
97793
95921
|
});
|
|
97794
95922
|
return previousValue;
|
|
97795
95923
|
}
|
|
97796
|
-
function
|
|
95924
|
+
function featureEach(geojson, callback) {
|
|
97797
95925
|
if (geojson.type === "Feature") {
|
|
97798
95926
|
callback(geojson, 0);
|
|
97799
95927
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -97804,7 +95932,7 @@ function requireCjs$e() {
|
|
|
97804
95932
|
}
|
|
97805
95933
|
function featureReduce(geojson, callback, initialValue) {
|
|
97806
95934
|
var previousValue = initialValue;
|
|
97807
|
-
|
|
95935
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
97808
95936
|
if (featureIndex === 0 && initialValue === void 0)
|
|
97809
95937
|
previousValue = currentFeature;
|
|
97810
95938
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -97813,7 +95941,7 @@ function requireCjs$e() {
|
|
|
97813
95941
|
}
|
|
97814
95942
|
function coordAll(geojson) {
|
|
97815
95943
|
var coords = [];
|
|
97816
|
-
|
|
95944
|
+
coordEach(geojson, function(coord) {
|
|
97817
95945
|
coords.push(coord);
|
|
97818
95946
|
});
|
|
97819
95947
|
return coords;
|
|
@@ -97898,7 +96026,7 @@ function requireCjs$e() {
|
|
|
97898
96026
|
return previousValue;
|
|
97899
96027
|
}
|
|
97900
96028
|
function flattenEach2(geojson, callback) {
|
|
97901
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
96029
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
97902
96030
|
var type = geometry2 === null ? null : geometry2.type;
|
|
97903
96031
|
switch (type) {
|
|
97904
96032
|
case null:
|
|
@@ -97906,7 +96034,7 @@ function requireCjs$e() {
|
|
|
97906
96034
|
case "LineString":
|
|
97907
96035
|
case "Polygon":
|
|
97908
96036
|
if (callback(
|
|
97909
|
-
_helpers.feature.call(void 0, geometry2, properties, { bbox
|
|
96037
|
+
_helpers.feature.call(void 0, geometry2, properties, { bbox, id }),
|
|
97910
96038
|
featureIndex,
|
|
97911
96039
|
0
|
|
97912
96040
|
) === false)
|
|
@@ -97954,7 +96082,7 @@ function requireCjs$e() {
|
|
|
97954
96082
|
);
|
|
97955
96083
|
return previousValue;
|
|
97956
96084
|
}
|
|
97957
|
-
function
|
|
96085
|
+
function segmentEach(geojson, callback) {
|
|
97958
96086
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
97959
96087
|
var segmentIndex = 0;
|
|
97960
96088
|
if (!feature2.geometry) return;
|
|
@@ -97964,7 +96092,7 @@ function requireCjs$e() {
|
|
|
97964
96092
|
var previousFeatureIndex = 0;
|
|
97965
96093
|
var previousMultiIndex = 0;
|
|
97966
96094
|
var prevGeomIndex = 0;
|
|
97967
|
-
if (
|
|
96095
|
+
if (coordEach(
|
|
97968
96096
|
feature2,
|
|
97969
96097
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
97970
96098
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -97998,7 +96126,7 @@ function requireCjs$e() {
|
|
|
97998
96126
|
function segmentReduce(geojson, callback, initialValue) {
|
|
97999
96127
|
var previousValue = initialValue;
|
|
98000
96128
|
var started = false;
|
|
98001
|
-
|
|
96129
|
+
segmentEach(
|
|
98002
96130
|
geojson,
|
|
98003
96131
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
98004
96132
|
if (started === false && initialValue === void 0)
|
|
@@ -98225,9 +96353,9 @@ function requireCjs$e() {
|
|
|
98225
96353
|
throw new Error("geojson is invalid");
|
|
98226
96354
|
}
|
|
98227
96355
|
cjs$d.coordAll = coordAll;
|
|
98228
|
-
cjs$d.coordEach =
|
|
96356
|
+
cjs$d.coordEach = coordEach;
|
|
98229
96357
|
cjs$d.coordReduce = coordReduce;
|
|
98230
|
-
cjs$d.featureEach =
|
|
96358
|
+
cjs$d.featureEach = featureEach;
|
|
98231
96359
|
cjs$d.featureReduce = featureReduce;
|
|
98232
96360
|
cjs$d.findPoint = findPoint;
|
|
98233
96361
|
cjs$d.findSegment = findSegment;
|
|
@@ -98239,7 +96367,7 @@ function requireCjs$e() {
|
|
|
98239
96367
|
cjs$d.lineReduce = lineReduce;
|
|
98240
96368
|
cjs$d.propEach = propEach;
|
|
98241
96369
|
cjs$d.propReduce = propReduce;
|
|
98242
|
-
cjs$d.segmentEach =
|
|
96370
|
+
cjs$d.segmentEach = segmentEach;
|
|
98243
96371
|
cjs$d.segmentReduce = segmentReduce;
|
|
98244
96372
|
return cjs$d;
|
|
98245
96373
|
}
|
|
@@ -98249,7 +96377,7 @@ function requireCjs$d() {
|
|
|
98249
96377
|
hasRequiredCjs$d = 1;
|
|
98250
96378
|
Object.defineProperty(cjs$e, "__esModule", { value: true });
|
|
98251
96379
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
98252
|
-
function
|
|
96380
|
+
function bbox(geojson, options = {}) {
|
|
98253
96381
|
if (geojson.bbox != null && true !== options.recompute) {
|
|
98254
96382
|
return geojson.bbox;
|
|
98255
96383
|
}
|
|
@@ -98270,8 +96398,8 @@ function requireCjs$d() {
|
|
|
98270
96398
|
});
|
|
98271
96399
|
return result;
|
|
98272
96400
|
}
|
|
98273
|
-
var turf_bbox_default =
|
|
98274
|
-
cjs$e.bbox =
|
|
96401
|
+
var turf_bbox_default = bbox;
|
|
96402
|
+
cjs$e.bbox = bbox;
|
|
98275
96403
|
cjs$e.default = turf_bbox_default;
|
|
98276
96404
|
return cjs$e;
|
|
98277
96405
|
}
|
|
@@ -98355,7 +96483,7 @@ function requireJs$p() {
|
|
|
98355
96483
|
case "Point":
|
|
98356
96484
|
return point2(coordinates2).geometry;
|
|
98357
96485
|
case "LineString":
|
|
98358
|
-
return
|
|
96486
|
+
return lineString(coordinates2).geometry;
|
|
98359
96487
|
case "Polygon":
|
|
98360
96488
|
return polygon2(coordinates2).geometry;
|
|
98361
96489
|
case "MultiPoint":
|
|
@@ -98432,7 +96560,7 @@ function requireJs$p() {
|
|
|
98432
96560
|
}), options);
|
|
98433
96561
|
}
|
|
98434
96562
|
exports2.polygons = polygons2;
|
|
98435
|
-
function
|
|
96563
|
+
function lineString(coordinates2, properties, options) {
|
|
98436
96564
|
if (options === void 0) {
|
|
98437
96565
|
options = {};
|
|
98438
96566
|
}
|
|
@@ -98445,13 +96573,13 @@ function requireJs$p() {
|
|
|
98445
96573
|
};
|
|
98446
96574
|
return feature2(geom, properties, options);
|
|
98447
96575
|
}
|
|
98448
|
-
exports2.lineString =
|
|
96576
|
+
exports2.lineString = lineString;
|
|
98449
96577
|
function lineStrings(coordinates2, properties, options) {
|
|
98450
96578
|
if (options === void 0) {
|
|
98451
96579
|
options = {};
|
|
98452
96580
|
}
|
|
98453
96581
|
return featureCollection2(coordinates2.map(function(coords) {
|
|
98454
|
-
return
|
|
96582
|
+
return lineString(coords, properties);
|
|
98455
96583
|
}), options);
|
|
98456
96584
|
}
|
|
98457
96585
|
exports2.lineStrings = lineStrings;
|
|
@@ -98548,7 +96676,7 @@ function requireJs$p() {
|
|
|
98548
96676
|
}
|
|
98549
96677
|
exports2.lengthToRadians = lengthToRadians;
|
|
98550
96678
|
function lengthToDegrees(distance2, units) {
|
|
98551
|
-
return
|
|
96679
|
+
return radiansToDegrees(lengthToRadians(distance2, units));
|
|
98552
96680
|
}
|
|
98553
96681
|
exports2.lengthToDegrees = lengthToDegrees;
|
|
98554
96682
|
function bearingToAzimuth(bearing) {
|
|
@@ -98559,11 +96687,11 @@ function requireJs$p() {
|
|
|
98559
96687
|
return angle2;
|
|
98560
96688
|
}
|
|
98561
96689
|
exports2.bearingToAzimuth = bearingToAzimuth;
|
|
98562
|
-
function
|
|
96690
|
+
function radiansToDegrees(radians2) {
|
|
98563
96691
|
var degrees2 = radians2 % (2 * Math.PI);
|
|
98564
96692
|
return degrees2 * 180 / Math.PI;
|
|
98565
96693
|
}
|
|
98566
|
-
exports2.radiansToDegrees =
|
|
96694
|
+
exports2.radiansToDegrees = radiansToDegrees;
|
|
98567
96695
|
function degreesToRadians2(degrees2) {
|
|
98568
96696
|
var radians2 = degrees2 % 360;
|
|
98569
96697
|
return radians2 * Math.PI / 180;
|
|
@@ -98611,17 +96739,17 @@ function requireJs$p() {
|
|
|
98611
96739
|
return !!input && input.constructor === Object;
|
|
98612
96740
|
}
|
|
98613
96741
|
exports2.isObject = isObject2;
|
|
98614
|
-
function validateBBox(
|
|
98615
|
-
if (!
|
|
96742
|
+
function validateBBox(bbox) {
|
|
96743
|
+
if (!bbox) {
|
|
98616
96744
|
throw new Error("bbox is required");
|
|
98617
96745
|
}
|
|
98618
|
-
if (!Array.isArray(
|
|
96746
|
+
if (!Array.isArray(bbox)) {
|
|
98619
96747
|
throw new Error("bbox must be an Array");
|
|
98620
96748
|
}
|
|
98621
|
-
if (
|
|
96749
|
+
if (bbox.length !== 4 && bbox.length !== 6) {
|
|
98622
96750
|
throw new Error("bbox must be an Array of 4 or 6 numbers");
|
|
98623
96751
|
}
|
|
98624
|
-
|
|
96752
|
+
bbox.forEach(function(num) {
|
|
98625
96753
|
if (!isNumber2(num)) {
|
|
98626
96754
|
throw new Error("bbox must only contain numbers");
|
|
98627
96755
|
}
|
|
@@ -98646,22 +96774,22 @@ function requireJs$o() {
|
|
|
98646
96774
|
hasRequiredJs$o = 1;
|
|
98647
96775
|
Object.defineProperty(js$p, "__esModule", { value: true });
|
|
98648
96776
|
var helpers_1 = /* @__PURE__ */ requireJs$p();
|
|
98649
|
-
function bboxPolygon(
|
|
96777
|
+
function bboxPolygon(bbox, options) {
|
|
98650
96778
|
if (options === void 0) {
|
|
98651
96779
|
options = {};
|
|
98652
96780
|
}
|
|
98653
|
-
var west = Number(
|
|
98654
|
-
var south = Number(
|
|
98655
|
-
var east = Number(
|
|
98656
|
-
var north = Number(
|
|
98657
|
-
if (
|
|
96781
|
+
var west = Number(bbox[0]);
|
|
96782
|
+
var south = Number(bbox[1]);
|
|
96783
|
+
var east = Number(bbox[2]);
|
|
96784
|
+
var north = Number(bbox[3]);
|
|
96785
|
+
if (bbox.length === 6) {
|
|
98658
96786
|
throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
|
|
98659
96787
|
}
|
|
98660
96788
|
var lowLeft = [west, south];
|
|
98661
96789
|
var topLeft = [west, north];
|
|
98662
96790
|
var topRight = [east, north];
|
|
98663
96791
|
var lowRight = [east, south];
|
|
98664
|
-
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox
|
|
96792
|
+
return helpers_1.polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options.properties, { bbox, id: options.id });
|
|
98665
96793
|
}
|
|
98666
96794
|
js$p.default = bboxPolygon;
|
|
98667
96795
|
return js$p;
|
|
@@ -98676,7 +96804,7 @@ function requireJs$n() {
|
|
|
98676
96804
|
hasRequiredJs$n = 1;
|
|
98677
96805
|
Object.defineProperty(js$k, "__esModule", { value: true });
|
|
98678
96806
|
var helpers = /* @__PURE__ */ requireJs$p();
|
|
98679
|
-
function
|
|
96807
|
+
function coordEach(geojson, callback, excludeWrapCoord) {
|
|
98680
96808
|
if (geojson === null) return;
|
|
98681
96809
|
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;
|
|
98682
96810
|
for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
|
|
@@ -98763,7 +96891,7 @@ function requireJs$n() {
|
|
|
98763
96891
|
break;
|
|
98764
96892
|
case "GeometryCollection":
|
|
98765
96893
|
for (j = 0; j < geometry2.geometries.length; j++)
|
|
98766
|
-
if (
|
|
96894
|
+
if (coordEach(geometry2.geometries[j], callback, excludeWrapCoord) === false)
|
|
98767
96895
|
return false;
|
|
98768
96896
|
break;
|
|
98769
96897
|
default:
|
|
@@ -98774,7 +96902,7 @@ function requireJs$n() {
|
|
|
98774
96902
|
}
|
|
98775
96903
|
function coordReduce(geojson, callback, initialValue, excludeWrapCoord) {
|
|
98776
96904
|
var previousValue = initialValue;
|
|
98777
|
-
|
|
96905
|
+
coordEach(
|
|
98778
96906
|
geojson,
|
|
98779
96907
|
function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
|
|
98780
96908
|
if (coordIndex === 0 && initialValue === void 0)
|
|
@@ -98816,7 +96944,7 @@ function requireJs$n() {
|
|
|
98816
96944
|
});
|
|
98817
96945
|
return previousValue;
|
|
98818
96946
|
}
|
|
98819
|
-
function
|
|
96947
|
+
function featureEach(geojson, callback) {
|
|
98820
96948
|
if (geojson.type === "Feature") {
|
|
98821
96949
|
callback(geojson, 0);
|
|
98822
96950
|
} else if (geojson.type === "FeatureCollection") {
|
|
@@ -98827,7 +96955,7 @@ function requireJs$n() {
|
|
|
98827
96955
|
}
|
|
98828
96956
|
function featureReduce(geojson, callback, initialValue) {
|
|
98829
96957
|
var previousValue = initialValue;
|
|
98830
|
-
|
|
96958
|
+
featureEach(geojson, function(currentFeature, featureIndex) {
|
|
98831
96959
|
if (featureIndex === 0 && initialValue === void 0)
|
|
98832
96960
|
previousValue = currentFeature;
|
|
98833
96961
|
else previousValue = callback(previousValue, currentFeature, featureIndex);
|
|
@@ -98836,7 +96964,7 @@ function requireJs$n() {
|
|
|
98836
96964
|
}
|
|
98837
96965
|
function coordAll(geojson) {
|
|
98838
96966
|
var coords = [];
|
|
98839
|
-
|
|
96967
|
+
coordEach(geojson, function(coord) {
|
|
98840
96968
|
coords.push(coord);
|
|
98841
96969
|
});
|
|
98842
96970
|
return coords;
|
|
@@ -98921,7 +97049,7 @@ function requireJs$n() {
|
|
|
98921
97049
|
return previousValue;
|
|
98922
97050
|
}
|
|
98923
97051
|
function flattenEach2(geojson, callback) {
|
|
98924
|
-
geomEach2(geojson, function(geometry2, featureIndex, properties,
|
|
97052
|
+
geomEach2(geojson, function(geometry2, featureIndex, properties, bbox, id) {
|
|
98925
97053
|
var type = geometry2 === null ? null : geometry2.type;
|
|
98926
97054
|
switch (type) {
|
|
98927
97055
|
case null:
|
|
@@ -98929,7 +97057,7 @@ function requireJs$n() {
|
|
|
98929
97057
|
case "LineString":
|
|
98930
97058
|
case "Polygon":
|
|
98931
97059
|
if (callback(
|
|
98932
|
-
helpers.feature(geometry2, properties, { bbox
|
|
97060
|
+
helpers.feature(geometry2, properties, { bbox, id }),
|
|
98933
97061
|
featureIndex,
|
|
98934
97062
|
0
|
|
98935
97063
|
) === false)
|
|
@@ -98977,7 +97105,7 @@ function requireJs$n() {
|
|
|
98977
97105
|
);
|
|
98978
97106
|
return previousValue;
|
|
98979
97107
|
}
|
|
98980
|
-
function
|
|
97108
|
+
function segmentEach(geojson, callback) {
|
|
98981
97109
|
flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) {
|
|
98982
97110
|
var segmentIndex = 0;
|
|
98983
97111
|
if (!feature2.geometry) return;
|
|
@@ -98987,7 +97115,7 @@ function requireJs$n() {
|
|
|
98987
97115
|
var previousFeatureIndex = 0;
|
|
98988
97116
|
var previousMultiIndex = 0;
|
|
98989
97117
|
var prevGeomIndex = 0;
|
|
98990
|
-
if (
|
|
97118
|
+
if (coordEach(
|
|
98991
97119
|
feature2,
|
|
98992
97120
|
function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
|
|
98993
97121
|
if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
|
|
@@ -99020,7 +97148,7 @@ function requireJs$n() {
|
|
|
99020
97148
|
function segmentReduce(geojson, callback, initialValue) {
|
|
99021
97149
|
var previousValue = initialValue;
|
|
99022
97150
|
var started = false;
|
|
99023
|
-
|
|
97151
|
+
segmentEach(
|
|
99024
97152
|
geojson,
|
|
99025
97153
|
function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
|
|
99026
97154
|
if (started === false && initialValue === void 0)
|
|
@@ -99242,9 +97370,9 @@ function requireJs$n() {
|
|
|
99242
97370
|
throw new Error("geojson is invalid");
|
|
99243
97371
|
}
|
|
99244
97372
|
js$k.coordAll = coordAll;
|
|
99245
|
-
js$k.coordEach =
|
|
97373
|
+
js$k.coordEach = coordEach;
|
|
99246
97374
|
js$k.coordReduce = coordReduce;
|
|
99247
|
-
js$k.featureEach =
|
|
97375
|
+
js$k.featureEach = featureEach;
|
|
99248
97376
|
js$k.featureReduce = featureReduce;
|
|
99249
97377
|
js$k.findPoint = findPoint;
|
|
99250
97378
|
js$k.findSegment = findSegment;
|
|
@@ -99256,7 +97384,7 @@ function requireJs$n() {
|
|
|
99256
97384
|
js$k.lineReduce = lineReduce;
|
|
99257
97385
|
js$k.propEach = propEach;
|
|
99258
97386
|
js$k.propReduce = propReduce;
|
|
99259
|
-
js$k.segmentEach =
|
|
97387
|
+
js$k.segmentEach = segmentEach;
|
|
99260
97388
|
js$k.segmentReduce = segmentReduce;
|
|
99261
97389
|
return js$k;
|
|
99262
97390
|
}
|
|
@@ -99266,7 +97394,7 @@ function requireJs$m() {
|
|
|
99266
97394
|
hasRequiredJs$m = 1;
|
|
99267
97395
|
Object.defineProperty(js$l, "__esModule", { value: true });
|
|
99268
97396
|
var meta_1 = /* @__PURE__ */ requireJs$n();
|
|
99269
|
-
function
|
|
97397
|
+
function bbox(geojson) {
|
|
99270
97398
|
var result = [Infinity, Infinity, -Infinity, -Infinity];
|
|
99271
97399
|
meta_1.coordEach(geojson, function(coord) {
|
|
99272
97400
|
if (result[0] > coord[0]) {
|
|
@@ -99284,8 +97412,8 @@ function requireJs$m() {
|
|
|
99284
97412
|
});
|
|
99285
97413
|
return result;
|
|
99286
97414
|
}
|
|
99287
|
-
|
|
99288
|
-
js$l.default =
|
|
97415
|
+
bbox["default"] = bbox;
|
|
97416
|
+
js$l.default = bbox;
|
|
99289
97417
|
return js$l;
|
|
99290
97418
|
}
|
|
99291
97419
|
var hasRequiredJs$l;
|
|
@@ -109516,7 +107644,7 @@ function length$1(object2) {
|
|
|
109516
107644
|
return +lengthSum$1;
|
|
109517
107645
|
}
|
|
109518
107646
|
var coordinates = [null, null], object = { type: "LineString", coordinates };
|
|
109519
|
-
function distance(a2, b) {
|
|
107647
|
+
function distance$1(a2, b) {
|
|
109520
107648
|
coordinates[0] = a2;
|
|
109521
107649
|
coordinates[1] = b;
|
|
109522
107650
|
return length$1(object);
|
|
@@ -109569,10 +107697,10 @@ function containsGeometry(geometry2, point2) {
|
|
|
109569
107697
|
return geometry2 && containsGeometryType.hasOwnProperty(geometry2.type) ? containsGeometryType[geometry2.type](geometry2, point2) : false;
|
|
109570
107698
|
}
|
|
109571
107699
|
function containsPoint(coordinates2, point2) {
|
|
109572
|
-
return distance(coordinates2, point2) === 0;
|
|
107700
|
+
return distance$1(coordinates2, point2) === 0;
|
|
109573
107701
|
}
|
|
109574
107702
|
function containsLine(coordinates2, point2) {
|
|
109575
|
-
var ab = distance(coordinates2[0], coordinates2[1]), ao = distance(coordinates2[0], point2), ob = distance(point2, coordinates2[1]);
|
|
107703
|
+
var ab = distance$1(coordinates2[0], coordinates2[1]), ao = distance$1(coordinates2[0], point2), ob = distance$1(point2, coordinates2[1]);
|
|
109576
107704
|
return ao + ob <= ab + epsilon;
|
|
109577
107705
|
}
|
|
109578
107706
|
function containsPolygon(coordinates2, point2) {
|
|
@@ -110789,7 +108917,7 @@ const d3Geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
110789
108917
|
geoConicEquidistant: conicEquidistant,
|
|
110790
108918
|
geoConicEquidistantRaw: conicEquidistantRaw,
|
|
110791
108919
|
geoContains: contains,
|
|
110792
|
-
geoDistance: distance,
|
|
108920
|
+
geoDistance: distance$1,
|
|
110793
108921
|
geoEquirectangular: equirectangular,
|
|
110794
108922
|
geoEquirectangularRaw: equirectangularRaw,
|
|
110795
108923
|
geoGnomonic: gnomonic,
|
|
@@ -111489,8 +109617,8 @@ function requirePolygonClipping_umd() {
|
|
|
111489
109617
|
sort(keys2, values2, left, j, compare2);
|
|
111490
109618
|
sort(keys2, values2, j + 1, right, compare2);
|
|
111491
109619
|
}
|
|
111492
|
-
var isInBbox2 = function isInBbox3(
|
|
111493
|
-
return
|
|
109620
|
+
var isInBbox2 = function isInBbox3(bbox, point2) {
|
|
109621
|
+
return bbox.ll.x <= point2.x && point2.x <= bbox.ur.x && bbox.ll.y <= point2.y && point2.y <= bbox.ur.y;
|
|
111494
109622
|
};
|
|
111495
109623
|
var getBboxOverlap2 = function getBboxOverlap3(b1, b2) {
|
|
111496
109624
|
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;
|
|
@@ -111870,7 +109998,7 @@ function requirePolygonClipping_umd() {
|
|
|
111870
109998
|
}
|
|
111871
109999
|
}, {
|
|
111872
110000
|
key: "bbox",
|
|
111873
|
-
value: function
|
|
110001
|
+
value: function bbox() {
|
|
111874
110002
|
var y12 = this.leftSE.point.y;
|
|
111875
110003
|
var y2 = this.rightSE.point.y;
|
|
111876
110004
|
return {
|
|
@@ -112807,7 +110935,7 @@ function requireJs$j() {
|
|
|
112807
110935
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
112808
110936
|
}
|
|
112809
110937
|
js$i.getCoord = getCoord2;
|
|
112810
|
-
function
|
|
110938
|
+
function getCoords(coords) {
|
|
112811
110939
|
if (Array.isArray(coords)) {
|
|
112812
110940
|
return coords;
|
|
112813
110941
|
}
|
|
@@ -112822,7 +110950,7 @@ function requireJs$j() {
|
|
|
112822
110950
|
}
|
|
112823
110951
|
throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
|
|
112824
110952
|
}
|
|
112825
|
-
js$i.getCoords =
|
|
110953
|
+
js$i.getCoords = getCoords;
|
|
112826
110954
|
function containsNumber(coordinates2) {
|
|
112827
110955
|
if (coordinates2.length > 1 && helpers_1.isNumber(coordinates2[0]) && helpers_1.isNumber(coordinates2[1])) {
|
|
112828
110956
|
return true;
|
|
@@ -112952,7 +111080,7 @@ function requireCjs$c() {
|
|
|
112952
111080
|
}
|
|
112953
111081
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
112954
111082
|
}
|
|
112955
|
-
function
|
|
111083
|
+
function getCoords(coords) {
|
|
112956
111084
|
if (Array.isArray(coords)) {
|
|
112957
111085
|
return coords;
|
|
112958
111086
|
}
|
|
@@ -113054,7 +111182,7 @@ function requireCjs$c() {
|
|
|
113054
111182
|
cjs$b.featureOf = featureOf;
|
|
113055
111183
|
cjs$b.geojsonType = geojsonType;
|
|
113056
111184
|
cjs$b.getCoord = getCoord2;
|
|
113057
|
-
cjs$b.getCoords =
|
|
111185
|
+
cjs$b.getCoords = getCoords;
|
|
113058
111186
|
cjs$b.getGeom = getGeom2;
|
|
113059
111187
|
cjs$b.getType = getType;
|
|
113060
111188
|
return cjs$b;
|
|
@@ -113527,7 +111655,7 @@ function requireFeature() {
|
|
|
113527
111655
|
}
|
|
113528
111656
|
_createClass(Feature2, [{
|
|
113529
111657
|
key: "getCoords",
|
|
113530
|
-
value: function
|
|
111658
|
+
value: function getCoords() {
|
|
113531
111659
|
return this.geoJson.geometry.coordinates;
|
|
113532
111660
|
}
|
|
113533
111661
|
}]);
|
|
@@ -115708,7 +113836,7 @@ function requireCjs$a() {
|
|
|
115708
113836
|
var __defProp2 = Object.defineProperty;
|
|
115709
113837
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
115710
113838
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
115711
|
-
var
|
|
113839
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
115712
113840
|
var __export = (target, all) => {
|
|
115713
113841
|
for (var name2 in all)
|
|
115714
113842
|
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -115716,7 +113844,7 @@ function requireCjs$a() {
|
|
|
115716
113844
|
var __copyProps = (to, from, except, desc) => {
|
|
115717
113845
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
115718
113846
|
for (let key of __getOwnPropNames(from))
|
|
115719
|
-
if (!
|
|
113847
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
115720
113848
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
115721
113849
|
}
|
|
115722
113850
|
return to;
|
|
@@ -116422,7 +114550,7 @@ function requireCjs$9() {
|
|
|
116422
114550
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
116423
114551
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
116424
114552
|
var __getProtoOf = Object.getPrototypeOf;
|
|
116425
|
-
var
|
|
114553
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
116426
114554
|
var __export = (target, all) => {
|
|
116427
114555
|
for (var name2 in all)
|
|
116428
114556
|
__defProp2(target, name2, { get: all[name2], enumerable: true });
|
|
@@ -116430,7 +114558,7 @@ function requireCjs$9() {
|
|
|
116430
114558
|
var __copyProps = (to, from, except, desc) => {
|
|
116431
114559
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
116432
114560
|
for (let key of __getOwnPropNames(from))
|
|
116433
|
-
if (!
|
|
114561
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
116434
114562
|
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
116435
114563
|
}
|
|
116436
114564
|
return to;
|
|
@@ -116512,8 +114640,8 @@ function requireCjs$9() {
|
|
|
116512
114640
|
};
|
|
116513
114641
|
};
|
|
116514
114642
|
var precision2 = set2();
|
|
116515
|
-
var isInBbox2 = (
|
|
116516
|
-
return
|
|
114643
|
+
var isInBbox2 = (bbox, point2) => {
|
|
114644
|
+
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);
|
|
116517
114645
|
};
|
|
116518
114646
|
var getBboxOverlap2 = (b1, b2) => {
|
|
116519
114647
|
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))
|
|
@@ -118088,7 +116216,7 @@ function requireUtils$2() {
|
|
|
118088
116216
|
utils$2.distance2d = distance2d;
|
|
118089
116217
|
utils$2.mix = mix;
|
|
118090
116218
|
utils$2.nearestPointOnProjectedLine = nearestPointOnProjectedLine;
|
|
118091
|
-
utils$2.nearestPointOnLine =
|
|
116219
|
+
utils$2.nearestPointOnLine = nearestPointOnLine;
|
|
118092
116220
|
utils$2.getPickedEditHandle = getPickedEditHandle;
|
|
118093
116221
|
utils$2.getPickedSnapSourceEditHandle = getPickedSnapSourceEditHandle;
|
|
118094
116222
|
utils$2.getNonGuidePicks = getNonGuidePicks;
|
|
@@ -118185,12 +116313,12 @@ function requireUtils$2() {
|
|
|
118185
116313
|
return false;
|
|
118186
116314
|
}
|
|
118187
116315
|
function generatePointsParallelToLinePoints(p1, p2, mapCoords) {
|
|
118188
|
-
var
|
|
116316
|
+
var lineString = {
|
|
118189
116317
|
type: "LineString",
|
|
118190
116318
|
coordinates: [p1, p2]
|
|
118191
116319
|
};
|
|
118192
116320
|
var pt = (0, _helpers.point)(mapCoords);
|
|
118193
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
116321
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
118194
116322
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
118195
116323
|
var isPointToLeftOfLine = (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
118196
116324
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -118256,7 +116384,7 @@ function requireUtils$2() {
|
|
|
118256
116384
|
}
|
|
118257
116385
|
};
|
|
118258
116386
|
}
|
|
118259
|
-
function
|
|
116387
|
+
function nearestPointOnLine(lines, inPoint, viewport) {
|
|
118260
116388
|
var _lines$geometry, _lines$geometry2;
|
|
118261
116389
|
var mercator2;
|
|
118262
116390
|
if (viewport) {
|
|
@@ -118776,8 +116904,8 @@ function requireImmutableFeatureCollection() {
|
|
|
118776
116904
|
}
|
|
118777
116905
|
function pruneMultiLineStringIfNecessary(geometry2) {
|
|
118778
116906
|
for (var lineStringIndex = 0; lineStringIndex < geometry2.coordinates.length; lineStringIndex++) {
|
|
118779
|
-
var
|
|
118780
|
-
if (
|
|
116907
|
+
var lineString = geometry2.coordinates[lineStringIndex];
|
|
116908
|
+
if (lineString.length === 1) {
|
|
118781
116909
|
geometry2.coordinates.splice(lineStringIndex, 1);
|
|
118782
116910
|
lineStringIndex--;
|
|
118783
116911
|
}
|
|
@@ -119366,8 +117494,8 @@ function requireModifyMode() {
|
|
|
119366
117494
|
var intermediatePoint = null;
|
|
119367
117495
|
var positionIndexPrefix = [];
|
|
119368
117496
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
119369
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
119370
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
117497
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
117498
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
119371
117499
|
var candidateIntermediatePoint = _this.getNearestPoint(
|
|
119372
117500
|
// @ts-ignore
|
|
119373
117501
|
lineStringFeature,
|
|
@@ -119543,29 +117671,29 @@ function requireCjs$6() {
|
|
|
119543
117671
|
hasRequiredCjs$6 = 1;
|
|
119544
117672
|
Object.defineProperty(cjs$6, "__esModule", { value: true });
|
|
119545
117673
|
var __defProp2 = Object.defineProperty;
|
|
119546
|
-
var
|
|
119547
|
-
var
|
|
119548
|
-
var
|
|
119549
|
-
var
|
|
119550
|
-
var
|
|
117674
|
+
var __defProps = Object.defineProperties;
|
|
117675
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
117676
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
117677
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
117678
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
119551
117679
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
119552
|
-
var
|
|
117680
|
+
var __spreadValues = (a2, b) => {
|
|
119553
117681
|
for (var prop in b || (b = {}))
|
|
119554
|
-
if (
|
|
117682
|
+
if (__hasOwnProp.call(b, prop))
|
|
119555
117683
|
__defNormalProp2(a2, prop, b[prop]);
|
|
119556
|
-
if (
|
|
119557
|
-
for (var prop of
|
|
119558
|
-
if (
|
|
117684
|
+
if (__getOwnPropSymbols)
|
|
117685
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
117686
|
+
if (__propIsEnum.call(b, prop))
|
|
119559
117687
|
__defNormalProp2(a2, prop, b[prop]);
|
|
119560
117688
|
}
|
|
119561
117689
|
return a2;
|
|
119562
117690
|
};
|
|
119563
|
-
var
|
|
117691
|
+
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
119564
117692
|
var _distance = /* @__PURE__ */ requireCjs$b();
|
|
119565
117693
|
var _meta = /* @__PURE__ */ requireCjs$e();
|
|
119566
117694
|
var _helpers = /* @__PURE__ */ requireCjs$f();
|
|
119567
117695
|
var _invariant = /* @__PURE__ */ requireCjs$c();
|
|
119568
|
-
function
|
|
117696
|
+
function nearestPointOnLine(lines, pt, options = {}) {
|
|
119569
117697
|
if (!lines || !pt) {
|
|
119570
117698
|
throw new Error("lines and pt are required arguments");
|
|
119571
117699
|
}
|
|
@@ -119597,7 +117725,7 @@ function requireCjs$6() {
|
|
|
119597
117725
|
} else if (stopPos[0] === ptPos[0] && stopPos[1] === ptPos[1]) {
|
|
119598
117726
|
[intersectPos, , wasEnd] = [stopPos, void 0, true];
|
|
119599
117727
|
} else {
|
|
119600
|
-
[intersectPos, , wasEnd] =
|
|
117728
|
+
[intersectPos, , wasEnd] = nearestPointOnSegment(
|
|
119601
117729
|
start.geometry.coordinates,
|
|
119602
117730
|
stop.geometry.coordinates,
|
|
119603
117731
|
_invariant.getCoord.call(void 0, pt)
|
|
@@ -119612,8 +117740,8 @@ function requireCjs$6() {
|
|
|
119612
117740
|
});
|
|
119613
117741
|
}
|
|
119614
117742
|
if (intersectPt && intersectPt.properties.dist < closestPt.properties.dist) {
|
|
119615
|
-
closestPt =
|
|
119616
|
-
properties:
|
|
117743
|
+
closestPt = __spreadProps(__spreadValues({}, intersectPt), {
|
|
117744
|
+
properties: __spreadProps(__spreadValues({}, intersectPt.properties), {
|
|
119617
117745
|
// Legacy behaviour where index progresses to next segment # if we
|
|
119618
117746
|
// went with the end point this iteration.
|
|
119619
117747
|
index: wasEnd ? i2 + 1 : i2
|
|
@@ -119636,14 +117764,14 @@ function requireCjs$6() {
|
|
|
119636
117764
|
const [v2x, v2y, v2z] = v2;
|
|
119637
117765
|
return [v1y * v2z - v1z * v2y, v1z * v2x - v1x * v2z, v1x * v2y - v1y * v2x];
|
|
119638
117766
|
}
|
|
119639
|
-
function
|
|
117767
|
+
function magnitude(v) {
|
|
119640
117768
|
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2) + Math.pow(v[2], 2));
|
|
119641
117769
|
}
|
|
119642
117770
|
function angle2(v12, v2) {
|
|
119643
|
-
const theta = dot2(v12, v2) / (
|
|
117771
|
+
const theta = dot2(v12, v2) / (magnitude(v12) * magnitude(v2));
|
|
119644
117772
|
return Math.acos(Math.min(Math.max(theta, -1), 1));
|
|
119645
117773
|
}
|
|
119646
|
-
function
|
|
117774
|
+
function lngLatToVector(a2) {
|
|
119647
117775
|
const lat = _helpers.degreesToRadians.call(void 0, a2[1]);
|
|
119648
117776
|
const lng = _helpers.degreesToRadians.call(void 0, a2[0]);
|
|
119649
117777
|
return [
|
|
@@ -119652,16 +117780,16 @@ function requireCjs$6() {
|
|
|
119652
117780
|
Math.sin(lat)
|
|
119653
117781
|
];
|
|
119654
117782
|
}
|
|
119655
|
-
function
|
|
117783
|
+
function vectorToLngLat(v) {
|
|
119656
117784
|
const [x, y, z2] = v;
|
|
119657
117785
|
const lat = _helpers.radiansToDegrees.call(void 0, Math.asin(z2));
|
|
119658
117786
|
const lng = _helpers.radiansToDegrees.call(void 0, Math.atan2(y, x));
|
|
119659
117787
|
return [lng, lat];
|
|
119660
117788
|
}
|
|
119661
|
-
function
|
|
119662
|
-
const A2 =
|
|
119663
|
-
const B2 =
|
|
119664
|
-
const C3 =
|
|
117789
|
+
function nearestPointOnSegment(posA, posB, posC) {
|
|
117790
|
+
const A2 = lngLatToVector(posA);
|
|
117791
|
+
const B2 = lngLatToVector(posB);
|
|
117792
|
+
const C3 = lngLatToVector(posC);
|
|
119665
117793
|
const [Cx, Cy, Cz] = C3;
|
|
119666
117794
|
const [D2, E2, F] = cross2(A2, B2);
|
|
119667
117795
|
const a2 = E2 * Cz - F * Cy;
|
|
@@ -119685,17 +117813,17 @@ function requireCjs$6() {
|
|
|
119685
117813
|
I3 = I2;
|
|
119686
117814
|
}
|
|
119687
117815
|
if (angle2(A2, I3) > angleAB || angle2(B2, I3) > angleAB) {
|
|
119688
|
-
if (_distance.distance.call(void 0,
|
|
119689
|
-
return [
|
|
117816
|
+
if (_distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(A2)) <= _distance.distance.call(void 0, vectorToLngLat(I3), vectorToLngLat(B2))) {
|
|
117817
|
+
return [vectorToLngLat(A2), true, false];
|
|
119690
117818
|
} else {
|
|
119691
|
-
return [
|
|
117819
|
+
return [vectorToLngLat(B2), false, true];
|
|
119692
117820
|
}
|
|
119693
117821
|
}
|
|
119694
|
-
return [
|
|
117822
|
+
return [vectorToLngLat(I3), false, false];
|
|
119695
117823
|
}
|
|
119696
|
-
var turf_nearest_point_on_line_default =
|
|
117824
|
+
var turf_nearest_point_on_line_default = nearestPointOnLine;
|
|
119697
117825
|
cjs$6.default = turf_nearest_point_on_line_default;
|
|
119698
|
-
cjs$6.nearestPointOnLine =
|
|
117826
|
+
cjs$6.nearestPointOnLine = nearestPointOnLine;
|
|
119699
117827
|
return cjs$6;
|
|
119700
117828
|
}
|
|
119701
117829
|
var cjs$5 = {};
|
|
@@ -119895,8 +118023,8 @@ function requireResizeCircleMode() {
|
|
|
119895
118023
|
var intermediatePoint = null;
|
|
119896
118024
|
var positionIndexPrefix = [];
|
|
119897
118025
|
var referencePoint = (0, _helpers.point)(mapCoords);
|
|
119898
|
-
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(
|
|
119899
|
-
var lineStringFeature = (0, _helpers.lineString)(
|
|
118026
|
+
(0, _utils.recursivelyTraverseNestedArrays)(featureAsPick.object.geometry.coordinates, [], function(lineString, prefix) {
|
|
118027
|
+
var lineStringFeature = (0, _helpers.lineString)(lineString);
|
|
119900
118028
|
var candidateIntermediatePoint = _this2.getNearestPoint(
|
|
119901
118029
|
// @ts-ignore
|
|
119902
118030
|
lineStringFeature,
|
|
@@ -120534,11 +118662,11 @@ function requireJs$4() {
|
|
|
120534
118662
|
if (origin === void 0 || origin === null) origin = "centroid";
|
|
120535
118663
|
if (Array.isArray(origin) || typeof origin === "object")
|
|
120536
118664
|
return invariant.getCoord(origin);
|
|
120537
|
-
var
|
|
120538
|
-
var west =
|
|
120539
|
-
var south =
|
|
120540
|
-
var east =
|
|
120541
|
-
var north =
|
|
118665
|
+
var bbox = geojson.bbox ? geojson.bbox : turfBBox__default["default"](geojson);
|
|
118666
|
+
var west = bbox[0];
|
|
118667
|
+
var south = bbox[1];
|
|
118668
|
+
var east = bbox[2];
|
|
118669
|
+
var north = bbox[3];
|
|
120542
118670
|
switch (origin) {
|
|
120543
118671
|
case "sw":
|
|
120544
118672
|
case "southwest":
|
|
@@ -121894,9 +120022,9 @@ function requireCjs$2() {
|
|
|
121894
120022
|
const pt = _invariant.getCoord.call(void 0, point2);
|
|
121895
120023
|
const geom = _invariant.getGeom.call(void 0, polygon2);
|
|
121896
120024
|
const type = geom.type;
|
|
121897
|
-
const
|
|
120025
|
+
const bbox = polygon2.bbox;
|
|
121898
120026
|
let polys = geom.coordinates;
|
|
121899
|
-
if (
|
|
120027
|
+
if (bbox && inBBox2(pt, bbox) === false) {
|
|
121900
120028
|
return false;
|
|
121901
120029
|
}
|
|
121902
120030
|
if (type === "Polygon") {
|
|
@@ -121910,8 +120038,8 @@ function requireCjs$2() {
|
|
|
121910
120038
|
}
|
|
121911
120039
|
return result;
|
|
121912
120040
|
}
|
|
121913
|
-
function inBBox2(pt,
|
|
121914
|
-
return
|
|
120041
|
+
function inBBox2(pt, bbox) {
|
|
120042
|
+
return bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1];
|
|
121915
120043
|
}
|
|
121916
120044
|
var turf_boolean_point_in_polygon_default = booleanPointInPolygon2;
|
|
121917
120045
|
cjs$3.booleanPointInPolygon = booleanPointInPolygon2;
|
|
@@ -121919,6 +120047,206 @@ function requireCjs$2() {
|
|
|
121919
120047
|
return cjs$3;
|
|
121920
120048
|
}
|
|
121921
120049
|
var cjs$1 = {};
|
|
120050
|
+
class TinyQueue2 {
|
|
120051
|
+
constructor(data = [], compare2 = defaultCompare$1) {
|
|
120052
|
+
this.data = data;
|
|
120053
|
+
this.length = this.data.length;
|
|
120054
|
+
this.compare = compare2;
|
|
120055
|
+
if (this.length > 0) {
|
|
120056
|
+
for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
|
|
120057
|
+
}
|
|
120058
|
+
}
|
|
120059
|
+
push(item) {
|
|
120060
|
+
this.data.push(item);
|
|
120061
|
+
this.length++;
|
|
120062
|
+
this._up(this.length - 1);
|
|
120063
|
+
}
|
|
120064
|
+
pop() {
|
|
120065
|
+
if (this.length === 0) return void 0;
|
|
120066
|
+
const top = this.data[0];
|
|
120067
|
+
const bottom = this.data.pop();
|
|
120068
|
+
this.length--;
|
|
120069
|
+
if (this.length > 0) {
|
|
120070
|
+
this.data[0] = bottom;
|
|
120071
|
+
this._down(0);
|
|
120072
|
+
}
|
|
120073
|
+
return top;
|
|
120074
|
+
}
|
|
120075
|
+
peek() {
|
|
120076
|
+
return this.data[0];
|
|
120077
|
+
}
|
|
120078
|
+
_up(pos) {
|
|
120079
|
+
const { data, compare: compare2 } = this;
|
|
120080
|
+
const item = data[pos];
|
|
120081
|
+
while (pos > 0) {
|
|
120082
|
+
const parent = pos - 1 >> 1;
|
|
120083
|
+
const current = data[parent];
|
|
120084
|
+
if (compare2(item, current) >= 0) break;
|
|
120085
|
+
data[pos] = current;
|
|
120086
|
+
pos = parent;
|
|
120087
|
+
}
|
|
120088
|
+
data[pos] = item;
|
|
120089
|
+
}
|
|
120090
|
+
_down(pos) {
|
|
120091
|
+
const { data, compare: compare2 } = this;
|
|
120092
|
+
const halfLength = this.length >> 1;
|
|
120093
|
+
const item = data[pos];
|
|
120094
|
+
while (pos < halfLength) {
|
|
120095
|
+
let left = (pos << 1) + 1;
|
|
120096
|
+
let best = data[left];
|
|
120097
|
+
const right = left + 1;
|
|
120098
|
+
if (right < this.length && compare2(data[right], best) < 0) {
|
|
120099
|
+
left = right;
|
|
120100
|
+
best = data[right];
|
|
120101
|
+
}
|
|
120102
|
+
if (compare2(best, item) >= 0) break;
|
|
120103
|
+
data[pos] = best;
|
|
120104
|
+
pos = left;
|
|
120105
|
+
}
|
|
120106
|
+
data[pos] = item;
|
|
120107
|
+
}
|
|
120108
|
+
}
|
|
120109
|
+
function defaultCompare$1(a2, b) {
|
|
120110
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
120111
|
+
}
|
|
120112
|
+
function checkWhichEventIsLeft(e1, e2) {
|
|
120113
|
+
if (e1.p.x > e2.p.x) return 1;
|
|
120114
|
+
if (e1.p.x < e2.p.x) return -1;
|
|
120115
|
+
if (e1.p.y !== e2.p.y) return e1.p.y > e2.p.y ? 1 : -1;
|
|
120116
|
+
return 1;
|
|
120117
|
+
}
|
|
120118
|
+
function checkWhichSegmentHasRightEndpointFirst(seg1, seg2) {
|
|
120119
|
+
if (seg1.rightSweepEvent.p.x > seg2.rightSweepEvent.p.x) return 1;
|
|
120120
|
+
if (seg1.rightSweepEvent.p.x < seg2.rightSweepEvent.p.x) return -1;
|
|
120121
|
+
if (seg1.rightSweepEvent.p.y !== seg2.rightSweepEvent.p.y) return seg1.rightSweepEvent.p.y < seg2.rightSweepEvent.p.y ? 1 : -1;
|
|
120122
|
+
return 1;
|
|
120123
|
+
}
|
|
120124
|
+
class Event {
|
|
120125
|
+
constructor(p, featureId2, ringId2, eventId2) {
|
|
120126
|
+
this.p = {
|
|
120127
|
+
x: p[0],
|
|
120128
|
+
y: p[1]
|
|
120129
|
+
};
|
|
120130
|
+
this.featureId = featureId2;
|
|
120131
|
+
this.ringId = ringId2;
|
|
120132
|
+
this.eventId = eventId2;
|
|
120133
|
+
this.otherEvent = null;
|
|
120134
|
+
this.isLeftEndpoint = null;
|
|
120135
|
+
}
|
|
120136
|
+
isSamePoint(eventToCheck) {
|
|
120137
|
+
return this.p.x === eventToCheck.p.x && this.p.y === eventToCheck.p.y;
|
|
120138
|
+
}
|
|
120139
|
+
}
|
|
120140
|
+
function fillEventQueue(geojson, eventQueue) {
|
|
120141
|
+
if (geojson.type === "FeatureCollection") {
|
|
120142
|
+
const features = geojson.features;
|
|
120143
|
+
for (let i2 = 0; i2 < features.length; i2++) {
|
|
120144
|
+
processFeature(features[i2], eventQueue);
|
|
120145
|
+
}
|
|
120146
|
+
} else {
|
|
120147
|
+
processFeature(geojson, eventQueue);
|
|
120148
|
+
}
|
|
120149
|
+
}
|
|
120150
|
+
let featureId = 0;
|
|
120151
|
+
let ringId = 0;
|
|
120152
|
+
let eventId = 0;
|
|
120153
|
+
function processFeature(featureOrGeometry, eventQueue) {
|
|
120154
|
+
const geom = featureOrGeometry.type === "Feature" ? featureOrGeometry.geometry : featureOrGeometry;
|
|
120155
|
+
let coords = geom.coordinates;
|
|
120156
|
+
if (geom.type === "Polygon" || geom.type === "MultiLineString") coords = [coords];
|
|
120157
|
+
if (geom.type === "LineString") coords = [[coords]];
|
|
120158
|
+
for (let i2 = 0; i2 < coords.length; i2++) {
|
|
120159
|
+
for (let ii = 0; ii < coords[i2].length; ii++) {
|
|
120160
|
+
let currentP = coords[i2][ii][0];
|
|
120161
|
+
let nextP = null;
|
|
120162
|
+
ringId = ringId + 1;
|
|
120163
|
+
for (let iii = 0; iii < coords[i2][ii].length - 1; iii++) {
|
|
120164
|
+
nextP = coords[i2][ii][iii + 1];
|
|
120165
|
+
const e1 = new Event(currentP, featureId, ringId, eventId);
|
|
120166
|
+
const e2 = new Event(nextP, featureId, ringId, eventId + 1);
|
|
120167
|
+
e1.otherEvent = e2;
|
|
120168
|
+
e2.otherEvent = e1;
|
|
120169
|
+
if (checkWhichEventIsLeft(e1, e2) > 0) {
|
|
120170
|
+
e2.isLeftEndpoint = true;
|
|
120171
|
+
e1.isLeftEndpoint = false;
|
|
120172
|
+
} else {
|
|
120173
|
+
e1.isLeftEndpoint = true;
|
|
120174
|
+
e2.isLeftEndpoint = false;
|
|
120175
|
+
}
|
|
120176
|
+
eventQueue.push(e1);
|
|
120177
|
+
eventQueue.push(e2);
|
|
120178
|
+
currentP = nextP;
|
|
120179
|
+
eventId = eventId + 1;
|
|
120180
|
+
}
|
|
120181
|
+
}
|
|
120182
|
+
}
|
|
120183
|
+
featureId = featureId + 1;
|
|
120184
|
+
}
|
|
120185
|
+
let Segment$1 = class Segment {
|
|
120186
|
+
constructor(event) {
|
|
120187
|
+
this.leftSweepEvent = event;
|
|
120188
|
+
this.rightSweepEvent = event.otherEvent;
|
|
120189
|
+
}
|
|
120190
|
+
};
|
|
120191
|
+
function testSegmentIntersect(seg1, seg2) {
|
|
120192
|
+
if (seg1 === null || seg2 === null) return false;
|
|
120193
|
+
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;
|
|
120194
|
+
const x12 = seg1.leftSweepEvent.p.x;
|
|
120195
|
+
const y12 = seg1.leftSweepEvent.p.y;
|
|
120196
|
+
const x2 = seg1.rightSweepEvent.p.x;
|
|
120197
|
+
const y2 = seg1.rightSweepEvent.p.y;
|
|
120198
|
+
const x3 = seg2.leftSweepEvent.p.x;
|
|
120199
|
+
const y3 = seg2.leftSweepEvent.p.y;
|
|
120200
|
+
const x4 = seg2.rightSweepEvent.p.x;
|
|
120201
|
+
const y4 = seg2.rightSweepEvent.p.y;
|
|
120202
|
+
const denom = (y4 - y3) * (x2 - x12) - (x4 - x3) * (y2 - y12);
|
|
120203
|
+
const numeA = (x4 - x3) * (y12 - y3) - (y4 - y3) * (x12 - x3);
|
|
120204
|
+
const numeB = (x2 - x12) * (y12 - y3) - (y2 - y12) * (x12 - x3);
|
|
120205
|
+
if (denom === 0) {
|
|
120206
|
+
if (numeA === 0 && numeB === 0) return false;
|
|
120207
|
+
return false;
|
|
120208
|
+
}
|
|
120209
|
+
const uA = numeA / denom;
|
|
120210
|
+
const uB = numeB / denom;
|
|
120211
|
+
if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
|
|
120212
|
+
const x = x12 + uA * (x2 - x12);
|
|
120213
|
+
const y = y12 + uA * (y2 - y12);
|
|
120214
|
+
return [x, y];
|
|
120215
|
+
}
|
|
120216
|
+
return false;
|
|
120217
|
+
}
|
|
120218
|
+
function runCheck(eventQueue, ignoreSelfIntersections) {
|
|
120219
|
+
ignoreSelfIntersections = ignoreSelfIntersections ? ignoreSelfIntersections : false;
|
|
120220
|
+
const intersectionPoints = [];
|
|
120221
|
+
const outQueue = new TinyQueue2([], checkWhichSegmentHasRightEndpointFirst);
|
|
120222
|
+
while (eventQueue.length) {
|
|
120223
|
+
const event = eventQueue.pop();
|
|
120224
|
+
if (event.isLeftEndpoint) {
|
|
120225
|
+
const segment = new Segment$1(event);
|
|
120226
|
+
for (let i2 = 0; i2 < outQueue.data.length; i2++) {
|
|
120227
|
+
const otherSeg = outQueue.data[i2];
|
|
120228
|
+
if (ignoreSelfIntersections) {
|
|
120229
|
+
if (otherSeg.leftSweepEvent.featureId === event.featureId) continue;
|
|
120230
|
+
}
|
|
120231
|
+
const intersection2 = testSegmentIntersect(segment, otherSeg);
|
|
120232
|
+
if (intersection2 !== false) intersectionPoints.push(intersection2);
|
|
120233
|
+
}
|
|
120234
|
+
outQueue.push(segment);
|
|
120235
|
+
} else if (event.isLeftEndpoint === false) {
|
|
120236
|
+
outQueue.pop();
|
|
120237
|
+
}
|
|
120238
|
+
}
|
|
120239
|
+
return intersectionPoints;
|
|
120240
|
+
}
|
|
120241
|
+
function sweeplineIntersections(geojson, ignoreSelfIntersections) {
|
|
120242
|
+
const eventQueue = new TinyQueue2([], checkWhichEventIsLeft);
|
|
120243
|
+
fillEventQueue(geojson, eventQueue);
|
|
120244
|
+
return runCheck(eventQueue, ignoreSelfIntersections);
|
|
120245
|
+
}
|
|
120246
|
+
const sweeplineIntersections_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
120247
|
+
__proto__: null,
|
|
120248
|
+
default: sweeplineIntersections
|
|
120249
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
121922
120250
|
const require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(sweeplineIntersections_esm);
|
|
121923
120251
|
var hasRequiredCjs$1;
|
|
121924
120252
|
function requireCjs$1() {
|
|
@@ -121932,7 +120260,7 @@ function requireCjs$1() {
|
|
|
121932
120260
|
var _sweeplineintersections = require$$1$1;
|
|
121933
120261
|
var _sweeplineintersections2 = _interopRequireDefault(_sweeplineintersections);
|
|
121934
120262
|
var sweeplineIntersections2 = _sweeplineintersections2.default;
|
|
121935
|
-
function
|
|
120263
|
+
function lineIntersect(line1, line2, options = {}) {
|
|
121936
120264
|
const { removeDuplicates = true, ignoreSelfIntersections = true } = options;
|
|
121937
120265
|
let features = [];
|
|
121938
120266
|
if (line1.type === "FeatureCollection")
|
|
@@ -121966,9 +120294,9 @@ function requireCjs$1() {
|
|
|
121966
120294
|
}
|
|
121967
120295
|
return _helpers.featureCollection.call(void 0, results.map((r2) => _helpers.point.call(void 0, r2)));
|
|
121968
120296
|
}
|
|
121969
|
-
var turf_line_intersect_default =
|
|
120297
|
+
var turf_line_intersect_default = lineIntersect;
|
|
121970
120298
|
cjs$1.default = turf_line_intersect_default;
|
|
121971
|
-
cjs$1.lineIntersect =
|
|
120299
|
+
cjs$1.lineIntersect = lineIntersect;
|
|
121972
120300
|
return cjs$1;
|
|
121973
120301
|
}
|
|
121974
120302
|
var hasRequiredSplitPolygonMode;
|
|
@@ -125832,8 +124160,8 @@ function requireDraw90degreePolygonMode() {
|
|
|
125832
124160
|
return;
|
|
125833
124161
|
}
|
|
125834
124162
|
if (clickSequence.length === 3 && tentativeFeature.geometry.type === "LineString") {
|
|
125835
|
-
var
|
|
125836
|
-
clickSequence[clickSequence.length - 1] =
|
|
124163
|
+
var lineString = tentativeFeature.geometry;
|
|
124164
|
+
clickSequence[clickSequence.length - 1] = lineString.coordinates[lineString.coordinates.length - 1];
|
|
125837
124165
|
} else if (clickSequence.length > 3 && tentativeFeature.geometry.type === "Polygon") {
|
|
125838
124166
|
var polygon2 = tentativeFeature.geometry;
|
|
125839
124167
|
clickSequence[clickSequence.length - 1] = polygon2.coordinates[0][polygon2.coordinates[0].length - 2];
|
|
@@ -131703,12 +130031,12 @@ function requireUtils$1() {
|
|
|
131703
130031
|
return false;
|
|
131704
130032
|
}
|
|
131705
130033
|
function generatePointsParallelToLinePoints(p1, p2, groundCoords) {
|
|
131706
|
-
var
|
|
130034
|
+
var lineString = {
|
|
131707
130035
|
type: "LineString",
|
|
131708
130036
|
coordinates: [p1, p2]
|
|
131709
130037
|
};
|
|
131710
130038
|
var pt = (0, _helpers.point)(groundCoords);
|
|
131711
|
-
var ddistance = (0, _pointToLineDistance["default"])(pt,
|
|
130039
|
+
var ddistance = (0, _pointToLineDistance["default"])(pt, lineString);
|
|
131712
130040
|
var lineBearing = (0, _bearing["default"])(p1, p2);
|
|
131713
130041
|
var isPointToLeftOfLine = (groundCoords[0] - p1[0]) * (p2[1] - p1[1]) - (groundCoords[1] - p1[1]) * (p2[0] - p1[0]);
|
|
131714
130042
|
var orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;
|
|
@@ -133376,31 +131704,35 @@ class SelectionLayer extends CompositeLayer {
|
|
|
133376
131704
|
const { flipY, obsLayers } = this.props;
|
|
133377
131705
|
const flippedCoordinates = flipY ? coordinates2.map((poly) => poly.map((p) => [p[0], -p[1]])) : coordinates2;
|
|
133378
131706
|
const selectedPolygon = polygon(flippedCoordinates);
|
|
131707
|
+
let minX = Infinity;
|
|
131708
|
+
let minY = Infinity;
|
|
131709
|
+
let maxX = -Infinity;
|
|
131710
|
+
let maxY = -Infinity;
|
|
131711
|
+
flippedCoordinates[0].forEach(([x, y]) => {
|
|
131712
|
+
minX = Math.min(minX, x);
|
|
131713
|
+
minY = Math.min(minY, y);
|
|
131714
|
+
maxX = Math.max(maxX, x);
|
|
131715
|
+
maxY = Math.max(maxY, y);
|
|
131716
|
+
});
|
|
133379
131717
|
obsLayers.forEach((obsLayer) => {
|
|
133380
131718
|
const { getObsCoords, obsQuadTree, obsIndex, onSelect: layerOnSelect } = obsLayer;
|
|
133381
|
-
const
|
|
131719
|
+
const pickingIds = [];
|
|
133382
131720
|
obsQuadTree?.visit((node2, x02, y02, x12, y12) => {
|
|
133383
|
-
|
|
133384
|
-
const nodePolygon = polygon(nodePoints);
|
|
133385
|
-
const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);
|
|
133386
|
-
const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);
|
|
133387
|
-
const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);
|
|
133388
|
-
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
131721
|
+
if (x02 > maxX || y02 > maxY || x12 < minX || y12 < minY) {
|
|
133389
131722
|
return true;
|
|
133390
131723
|
}
|
|
133391
|
-
if (node2.
|
|
131724
|
+
if (!node2.length) {
|
|
133392
131725
|
let current = node2;
|
|
133393
131726
|
while (current) {
|
|
133394
|
-
const
|
|
133395
|
-
if (booleanPointInPolygon(
|
|
133396
|
-
|
|
131727
|
+
const [x, y] = getObsCoords(current.data);
|
|
131728
|
+
if (booleanPointInPolygon([x, y], selectedPolygon)) {
|
|
131729
|
+
pickingIds.push(obsIndex[current.data]);
|
|
133397
131730
|
}
|
|
133398
131731
|
current = current.next;
|
|
133399
131732
|
}
|
|
133400
131733
|
}
|
|
133401
131734
|
return false;
|
|
133402
131735
|
});
|
|
133403
|
-
const pickingIds = pickingInfos.map((obsI) => obsIndex[obsI]);
|
|
133404
131736
|
layerOnSelect(pickingIds);
|
|
133405
131737
|
});
|
|
133406
131738
|
}
|
|
@@ -135256,22 +133588,22 @@ async function getDecoder(fileDirectory) {
|
|
|
135256
133588
|
const Decoder = await importFn();
|
|
135257
133589
|
return new Decoder(fileDirectory);
|
|
135258
133590
|
}
|
|
135259
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
135260
|
-
addDecoder(5, () => import("./lzw-
|
|
133591
|
+
addDecoder([void 0, 1], () => import("./raw-C8mBC_hQ.js").then((m) => m.default));
|
|
133592
|
+
addDecoder(5, () => import("./lzw-DCsRKzgn.js").then((m) => m.default));
|
|
135261
133593
|
addDecoder(6, () => {
|
|
135262
133594
|
throw new Error("old style JPEG compression is not supported.");
|
|
135263
133595
|
});
|
|
135264
|
-
addDecoder(7, () => import("./jpeg-
|
|
135265
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
135266
|
-
addDecoder(32773, () => import("./packbits-
|
|
133596
|
+
addDecoder(7, () => import("./jpeg-DMmjuxic.js").then((m) => m.default));
|
|
133597
|
+
addDecoder([8, 32946], () => import("./deflate-gERuHO_1.js").then((m) => m.default));
|
|
133598
|
+
addDecoder(32773, () => import("./packbits-BIDoTj9B.js").then((m) => m.default));
|
|
135267
133599
|
addDecoder(
|
|
135268
133600
|
34887,
|
|
135269
|
-
() => import("./lerc-
|
|
133601
|
+
() => import("./lerc-Ci4fZASZ.js").then(async (m) => {
|
|
135270
133602
|
await m.zstd.init();
|
|
135271
133603
|
return m;
|
|
135272
133604
|
}).then((m) => m.default)
|
|
135273
133605
|
);
|
|
135274
|
-
addDecoder(50001, () => import("./webimage-
|
|
133606
|
+
addDecoder(50001, () => import("./webimage-9kP0E89I.js").then((m) => m.default));
|
|
135275
133607
|
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
135276
133608
|
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
135277
133609
|
}
|
|
@@ -137706,26 +136038,26 @@ class GeoTIFFBase {
|
|
|
137706
136038
|
*/
|
|
137707
136039
|
async readRasters(options = {}) {
|
|
137708
136040
|
const { window: imageWindow, width, height } = options;
|
|
137709
|
-
let { resX, resY, bbox
|
|
136041
|
+
let { resX, resY, bbox } = options;
|
|
137710
136042
|
const firstImage = await this.getImage();
|
|
137711
136043
|
let usedImage = firstImage;
|
|
137712
136044
|
const imageCount = await this.getImageCount();
|
|
137713
136045
|
const imgBBox = firstImage.getBoundingBox();
|
|
137714
|
-
if (imageWindow &&
|
|
136046
|
+
if (imageWindow && bbox) {
|
|
137715
136047
|
throw new Error('Both "bbox" and "window" passed.');
|
|
137716
136048
|
}
|
|
137717
136049
|
if (width || height) {
|
|
137718
136050
|
if (imageWindow) {
|
|
137719
136051
|
const [oX, oY] = firstImage.getOrigin();
|
|
137720
136052
|
const [rX, rY] = firstImage.getResolution();
|
|
137721
|
-
|
|
136053
|
+
bbox = [
|
|
137722
136054
|
oX + imageWindow[0] * rX,
|
|
137723
136055
|
oY + imageWindow[1] * rY,
|
|
137724
136056
|
oX + imageWindow[2] * rX,
|
|
137725
136057
|
oY + imageWindow[3] * rY
|
|
137726
136058
|
];
|
|
137727
136059
|
}
|
|
137728
|
-
const usedBBox =
|
|
136060
|
+
const usedBBox = bbox || imgBBox;
|
|
137729
136061
|
if (width) {
|
|
137730
136062
|
if (resX) {
|
|
137731
136063
|
throw new Error("Both width and resX passed");
|
|
@@ -137760,14 +136092,14 @@ class GeoTIFFBase {
|
|
|
137760
136092
|
}
|
|
137761
136093
|
}
|
|
137762
136094
|
let wnd = imageWindow;
|
|
137763
|
-
if (
|
|
136095
|
+
if (bbox) {
|
|
137764
136096
|
const [oX, oY] = firstImage.getOrigin();
|
|
137765
136097
|
const [imageResX, imageResY] = usedImage.getResolution(firstImage);
|
|
137766
136098
|
wnd = [
|
|
137767
|
-
Math.round((
|
|
137768
|
-
Math.round((
|
|
137769
|
-
Math.round((
|
|
137770
|
-
Math.round((
|
|
136099
|
+
Math.round((bbox[0] - oX) / imageResX),
|
|
136100
|
+
Math.round((bbox[1] - oY) / imageResY),
|
|
136101
|
+
Math.round((bbox[2] - oX) / imageResX),
|
|
136102
|
+
Math.round((bbox[3] - oY) / imageResY)
|
|
137771
136103
|
];
|
|
137772
136104
|
wnd = [
|
|
137773
136105
|
Math.min(wnd[0], wnd[2]),
|
|
@@ -138077,6 +136409,50 @@ async function N(A2, I2) {
|
|
|
138077
136409
|
if (0 === g2.length) throw Error("Failed to decode with LZW decoder.");
|
|
138078
136410
|
return g2;
|
|
138079
136411
|
}
|
|
136412
|
+
function quickselect(arr, k, left, right, compare2) {
|
|
136413
|
+
quickselectStep(arr, k, left || 0, right || arr.length - 1, defaultCompare);
|
|
136414
|
+
}
|
|
136415
|
+
function quickselectStep(arr, k, left, right, compare2) {
|
|
136416
|
+
while (right > left) {
|
|
136417
|
+
if (right - left > 600) {
|
|
136418
|
+
var n3 = right - left + 1;
|
|
136419
|
+
var m = k - left + 1;
|
|
136420
|
+
var z2 = Math.log(n3);
|
|
136421
|
+
var s2 = 0.5 * Math.exp(2 * z2 / 3);
|
|
136422
|
+
var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m - n3 / 2 < 0 ? -1 : 1);
|
|
136423
|
+
var newLeft = Math.max(left, Math.floor(k - m * s2 / n3 + sd));
|
|
136424
|
+
var newRight = Math.min(right, Math.floor(k + (n3 - m) * s2 / n3 + sd));
|
|
136425
|
+
quickselectStep(arr, k, newLeft, newRight, compare2);
|
|
136426
|
+
}
|
|
136427
|
+
var t = arr[k];
|
|
136428
|
+
var i2 = left;
|
|
136429
|
+
var j = right;
|
|
136430
|
+
swap(arr, left, k);
|
|
136431
|
+
if (compare2(arr[right], t) > 0) swap(arr, left, right);
|
|
136432
|
+
while (i2 < j) {
|
|
136433
|
+
swap(arr, i2, j);
|
|
136434
|
+
i2++;
|
|
136435
|
+
j--;
|
|
136436
|
+
while (compare2(arr[i2], t) < 0) i2++;
|
|
136437
|
+
while (compare2(arr[j], t) > 0) j--;
|
|
136438
|
+
}
|
|
136439
|
+
if (compare2(arr[left], t) === 0) swap(arr, left, j);
|
|
136440
|
+
else {
|
|
136441
|
+
j++;
|
|
136442
|
+
swap(arr, j, right);
|
|
136443
|
+
}
|
|
136444
|
+
if (j <= k) left = j + 1;
|
|
136445
|
+
if (k <= j) right = j - 1;
|
|
136446
|
+
}
|
|
136447
|
+
}
|
|
136448
|
+
function swap(arr, i2, j) {
|
|
136449
|
+
var tmp = arr[i2];
|
|
136450
|
+
arr[i2] = arr[j];
|
|
136451
|
+
arr[j] = tmp;
|
|
136452
|
+
}
|
|
136453
|
+
function defaultCompare(a2, b) {
|
|
136454
|
+
return a2 < b ? -1 : a2 > b ? 1 : 0;
|
|
136455
|
+
}
|
|
138080
136456
|
const registry = /* @__PURE__ */ new Map();
|
|
138081
136457
|
function addCodec(id, importFn) {
|
|
138082
136458
|
registry.set(id, importFn);
|
|
@@ -146328,17 +144704,17 @@ function sizeToMeters(size2, unit2) {
|
|
|
146328
144704
|
throw new Error("Received unknown unit");
|
|
146329
144705
|
}
|
|
146330
144706
|
function snapValue(value) {
|
|
146331
|
-
let
|
|
144707
|
+
let magnitude = 0;
|
|
146332
144708
|
if (value < MIN_TARGET || value > MAX_TARGET) {
|
|
146333
|
-
|
|
144709
|
+
magnitude = Math.floor(Math.log10(value));
|
|
146334
144710
|
}
|
|
146335
144711
|
let snappedUnit = SI_PREFIXES.find(
|
|
146336
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
144712
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude
|
|
146337
144713
|
);
|
|
146338
144714
|
let adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
146339
144715
|
if (adjustedValue > 500 && adjustedValue <= 1e3) {
|
|
146340
144716
|
snappedUnit = SI_PREFIXES.find(
|
|
146341
|
-
(p) => p.exponent % 3 === 0 && p.exponent <=
|
|
144717
|
+
(p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
|
|
146342
144718
|
);
|
|
146343
144719
|
adjustedValue = value / 10 ** snappedUnit.exponent;
|
|
146344
144720
|
}
|
|
@@ -150730,8 +149106,8 @@ var set = (eps) => {
|
|
|
150730
149106
|
};
|
|
150731
149107
|
};
|
|
150732
149108
|
var precision = set();
|
|
150733
|
-
var isInBbox = (
|
|
150734
|
-
return
|
|
149109
|
+
var isInBbox = (bbox, point2) => {
|
|
149110
|
+
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);
|
|
150735
149111
|
};
|
|
150736
149112
|
var getBboxOverlap = (b1, b2) => {
|
|
150737
149113
|
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))
|
|
@@ -151831,6 +150207,19 @@ function ringArea(coords) {
|
|
|
151831
150207
|
}
|
|
151832
150208
|
return total * FACTOR;
|
|
151833
150209
|
}
|
|
150210
|
+
function distance(from, to, options = {}) {
|
|
150211
|
+
var coordinates1 = getCoord(from);
|
|
150212
|
+
var coordinates2 = getCoord(to);
|
|
150213
|
+
var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
|
|
150214
|
+
var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
|
|
150215
|
+
var lat1 = degreesToRadians(coordinates1[1]);
|
|
150216
|
+
var lat2 = degreesToRadians(coordinates2[1]);
|
|
150217
|
+
var a2 = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
|
|
150218
|
+
return radiansToLength(
|
|
150219
|
+
2 * Math.atan2(Math.sqrt(a2), Math.sqrt(1 - a2)),
|
|
150220
|
+
options.units
|
|
150221
|
+
);
|
|
150222
|
+
}
|
|
151834
150223
|
const DEFAULT_THRESHOLD = 1;
|
|
151835
150224
|
const defaultProps$1 = {
|
|
151836
150225
|
// for text
|
|
@@ -151927,7 +150316,7 @@ class ContourLayerWithText extends ContourLayer {
|
|
|
151927
150316
|
const circlePoint = point(circleCoord);
|
|
151928
150317
|
polygonVertices.forEach((polyCoord) => {
|
|
151929
150318
|
const polyPoint = point(polyCoord);
|
|
151930
|
-
const dist2 = distance
|
|
150319
|
+
const dist2 = distance(circlePoint, polyPoint);
|
|
151931
150320
|
if (dist2 < minDist) {
|
|
151932
150321
|
minDist = dist2;
|
|
151933
150322
|
minCirclePoint = circleCoord;
|
|
@@ -152400,10 +150789,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
152400
150789
|
getLineColor: strokeColor,
|
|
152401
150790
|
getLineWidth: strokeWidth,
|
|
152402
150791
|
lineWidthUnits: "pixels",
|
|
152403
|
-
|
|
152404
|
-
|
|
152405
|
-
getDashArray: dashArray
|
|
152406
|
-
} : {}
|
|
150792
|
+
extensions: dashExt,
|
|
150793
|
+
getDashArray: getDash
|
|
152407
150794
|
}));
|
|
152408
150795
|
if (shape.text && labelOpacity > 0) {
|
|
152409
150796
|
layers.push(new TextLayer({
|
|
@@ -152438,8 +150825,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
152438
150825
|
layers.push(new PathLayer({
|
|
152439
150826
|
...base,
|
|
152440
150827
|
id: `annotation-line-${uid2}-${i2}`,
|
|
152441
|
-
extensions:
|
|
152442
|
-
getDashArray:
|
|
150828
|
+
extensions: dashExt,
|
|
150829
|
+
getDashArray: getDash,
|
|
152443
150830
|
data: [{ path: [[srcX, srcY], [tgtX, tgtY]] }],
|
|
152444
150831
|
getPath: (d) => d.path,
|
|
152445
150832
|
getColor: strokeColor,
|
|
@@ -152587,10 +150974,8 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
|
|
|
152587
150974
|
getLineColor: strokeColor,
|
|
152588
150975
|
getLineWidth: strokeWidth,
|
|
152589
150976
|
lineWidthUnits: "pixels",
|
|
152590
|
-
|
|
152591
|
-
|
|
152592
|
-
getDashArray: dashArray
|
|
152593
|
-
} : {}
|
|
150977
|
+
extensions: dashExt,
|
|
150978
|
+
getDashArray: getDash
|
|
152594
150979
|
}));
|
|
152595
150980
|
if (shape.text && labelOpacity > 0) {
|
|
152596
150981
|
layers.push(new TextLayer({
|