@deck.gl/carto 8.7.0-alpha.9 → 8.7.0-beta.1
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/dist.dev.js +218 -2825
- package/dist/es5/api/layer-map.js +16 -1
- package/dist/es5/api/layer-map.js.map +1 -1
- package/dist/es5/api/maps-v3-client.js +33 -26
- package/dist/es5/api/maps-v3-client.js.map +1 -1
- package/dist/es5/api/parseMap.js +24 -18
- package/dist/es5/api/parseMap.js.map +1 -1
- package/dist/es5/layers/carto-dynamic-tile-layer.js +1 -3
- package/dist/es5/layers/carto-dynamic-tile-layer.js.map +1 -1
- package/dist/es5/layers/carto-layer.js +5 -3
- package/dist/es5/layers/carto-layer.js.map +1 -1
- package/dist/esm/api/layer-map.js +8 -1
- package/dist/esm/api/layer-map.js.map +1 -1
- package/dist/esm/api/maps-v3-client.js +29 -17
- package/dist/esm/api/maps-v3-client.js.map +1 -1
- package/dist/esm/api/parseMap.js +31 -26
- package/dist/esm/api/parseMap.js.map +1 -1
- package/dist/esm/layers/carto-dynamic-tile-layer.js +2 -3
- package/dist/esm/layers/carto-dynamic-tile-layer.js.map +1 -1
- package/dist/esm/layers/carto-layer.js +3 -0
- package/dist/esm/layers/carto-layer.js.map +1 -1
- package/dist.min.js +14 -14
- package/package.json +7 -7
- package/src/api/layer-map.js +13 -1
- package/src/api/maps-v3-client.js +35 -18
- package/src/api/parseMap.js +23 -19
- package/src/layers/carto-dynamic-tile-layer.js +2 -3
- package/src/layers/carto-layer.js +5 -2
package/dist/dist.dev.js
CHANGED
|
@@ -10469,1421 +10469,6 @@ function deprecated(method, version) {
|
|
|
10469
10469
|
|
|
10470
10470
|
/***/ }),
|
|
10471
10471
|
|
|
10472
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/constants.js":
|
|
10473
|
-
/*!**************************************************************************************!*\
|
|
10474
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/constants.js ***!
|
|
10475
|
-
\**************************************************************************************/
|
|
10476
|
-
/*! exports provided: INTERSECTION */
|
|
10477
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10478
|
-
|
|
10479
|
-
"use strict";
|
|
10480
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10481
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INTERSECTION", function() { return INTERSECTION; });
|
|
10482
|
-
const INTERSECTION = Object.freeze({
|
|
10483
|
-
OUTSIDE: -1,
|
|
10484
|
-
INTERSECTING: 0,
|
|
10485
|
-
INSIDE: 1
|
|
10486
|
-
});
|
|
10487
|
-
//# sourceMappingURL=constants.js.map
|
|
10488
|
-
|
|
10489
|
-
/***/ }),
|
|
10490
|
-
|
|
10491
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/index.js":
|
|
10492
|
-
/*!**********************************************************************************!*\
|
|
10493
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/index.js ***!
|
|
10494
|
-
\**********************************************************************************/
|
|
10495
|
-
/*! exports provided: INTERSECTION, AxisAlignedBoundingBox, BoundingSphere, OrientedBoundingBox, CullingVolume, Plane, _PerspectiveOffCenterFrustum, _PerspectiveFrustum, makeBoundingSphereFromPoints, makeAxisAlignedBoundingBoxFromPoints, makeOrientedBoundingBoxFromPoints, computeEigenDecomposition, Intersect, INTERSECT */
|
|
10496
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10497
|
-
|
|
10498
|
-
"use strict";
|
|
10499
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10500
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "../../node_modules/@math.gl/culling/dist/esm/constants.js");
|
|
10501
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "INTERSECTION", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INTERSECTION"]; });
|
|
10502
|
-
|
|
10503
|
-
/* harmony import */ var _lib_bounding_volumes_axis_aligned_bounding_box__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/bounding-volumes/axis-aligned-bounding-box */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js");
|
|
10504
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AxisAlignedBoundingBox", function() { return _lib_bounding_volumes_axis_aligned_bounding_box__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
|
10505
|
-
|
|
10506
|
-
/* harmony import */ var _lib_bounding_volumes_bounding_sphere__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/bounding-volumes/bounding-sphere */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js");
|
|
10507
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoundingSphere", function() { return _lib_bounding_volumes_bounding_sphere__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
|
10508
|
-
|
|
10509
|
-
/* harmony import */ var _lib_bounding_volumes_oriented_bounding_box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/bounding-volumes/oriented-bounding-box */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js");
|
|
10510
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OrientedBoundingBox", function() { return _lib_bounding_volumes_oriented_bounding_box__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
|
10511
|
-
|
|
10512
|
-
/* harmony import */ var _lib_culling_volume__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/culling-volume */ "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js");
|
|
10513
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CullingVolume", function() { return _lib_culling_volume__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
10514
|
-
|
|
10515
|
-
/* harmony import */ var _lib_plane__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/plane */ "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js");
|
|
10516
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plane", function() { return _lib_plane__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
|
10517
|
-
|
|
10518
|
-
/* harmony import */ var _lib_perspective_off_center_frustum__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/perspective-off-center-frustum */ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js");
|
|
10519
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_PerspectiveOffCenterFrustum", function() { return _lib_perspective_off_center_frustum__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
|
10520
|
-
|
|
10521
|
-
/* harmony import */ var _lib_perspective_frustum__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/perspective-frustum */ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js");
|
|
10522
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_PerspectiveFrustum", function() { return _lib_perspective_frustum__WEBPACK_IMPORTED_MODULE_7__["default"]; });
|
|
10523
|
-
|
|
10524
|
-
/* harmony import */ var _lib_algorithms_bounding_sphere_from_points__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lib/algorithms/bounding-sphere-from-points */ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js");
|
|
10525
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeBoundingSphereFromPoints", function() { return _lib_algorithms_bounding_sphere_from_points__WEBPACK_IMPORTED_MODULE_8__["default"]; });
|
|
10526
|
-
|
|
10527
|
-
/* harmony import */ var _lib_algorithms_bounding_box_from_points__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./lib/algorithms/bounding-box-from-points */ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js");
|
|
10528
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeAxisAlignedBoundingBoxFromPoints", function() { return _lib_algorithms_bounding_box_from_points__WEBPACK_IMPORTED_MODULE_9__["makeAxisAlignedBoundingBoxFromPoints"]; });
|
|
10529
|
-
|
|
10530
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeOrientedBoundingBoxFromPoints", function() { return _lib_algorithms_bounding_box_from_points__WEBPACK_IMPORTED_MODULE_9__["makeOrientedBoundingBoxFromPoints"]; });
|
|
10531
|
-
|
|
10532
|
-
/* harmony import */ var _lib_algorithms_compute_eigen_decomposition__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./lib/algorithms/compute-eigen-decomposition */ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js");
|
|
10533
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "computeEigenDecomposition", function() { return _lib_algorithms_compute_eigen_decomposition__WEBPACK_IMPORTED_MODULE_10__["default"]; });
|
|
10534
|
-
|
|
10535
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Intersect", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INTERSECTION"]; });
|
|
10536
|
-
|
|
10537
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "INTERSECT", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INTERSECTION"]; });
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
//# sourceMappingURL=index.js.map
|
|
10553
|
-
|
|
10554
|
-
/***/ }),
|
|
10555
|
-
|
|
10556
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js":
|
|
10557
|
-
/*!********************************************************************************************************************!*\
|
|
10558
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js ***!
|
|
10559
|
-
\********************************************************************************************************************/
|
|
10560
|
-
/*! exports provided: makeOrientedBoundingBoxFromPoints, makeAxisAlignedBoundingBoxFromPoints */
|
|
10561
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10562
|
-
|
|
10563
|
-
"use strict";
|
|
10564
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10565
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeOrientedBoundingBoxFromPoints", function() { return makeOrientedBoundingBoxFromPoints; });
|
|
10566
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeAxisAlignedBoundingBoxFromPoints", function() { return makeAxisAlignedBoundingBoxFromPoints; });
|
|
10567
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
10568
|
-
/* harmony import */ var _compute_eigen_decomposition__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compute-eigen-decomposition */ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js");
|
|
10569
|
-
/* harmony import */ var _bounding_volumes_oriented_bounding_box__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../bounding-volumes/oriented-bounding-box */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js");
|
|
10570
|
-
/* harmony import */ var _bounding_volumes_axis_aligned_bounding_box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../bounding-volumes/axis-aligned-bounding-box */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js");
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
const scratchVector2 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10576
|
-
const scratchVector3 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10577
|
-
const scratchVector4 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10578
|
-
const scratchVector5 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10579
|
-
const scratchVector6 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10580
|
-
const scratchCovarianceResult = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10581
|
-
const scratchEigenResult = {
|
|
10582
|
-
diagonal: new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"](),
|
|
10583
|
-
unitary: new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]()
|
|
10584
|
-
};
|
|
10585
|
-
function makeOrientedBoundingBoxFromPoints(positions, result = new _bounding_volumes_oriented_bounding_box__WEBPACK_IMPORTED_MODULE_2__["default"]()) {
|
|
10586
|
-
if (!positions || positions.length === 0) {
|
|
10587
|
-
result.halfAxes = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]([0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
10588
|
-
result.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10589
|
-
return result;
|
|
10590
|
-
}
|
|
10591
|
-
|
|
10592
|
-
const length = positions.length;
|
|
10593
|
-
const meanPoint = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, 0, 0);
|
|
10594
|
-
|
|
10595
|
-
for (const position of positions) {
|
|
10596
|
-
meanPoint.add(position);
|
|
10597
|
-
}
|
|
10598
|
-
|
|
10599
|
-
const invLength = 1.0 / length;
|
|
10600
|
-
meanPoint.multiplyByScalar(invLength);
|
|
10601
|
-
let exx = 0.0;
|
|
10602
|
-
let exy = 0.0;
|
|
10603
|
-
let exz = 0.0;
|
|
10604
|
-
let eyy = 0.0;
|
|
10605
|
-
let eyz = 0.0;
|
|
10606
|
-
let ezz = 0.0;
|
|
10607
|
-
|
|
10608
|
-
for (const position of positions) {
|
|
10609
|
-
const p = scratchVector2.copy(position).subtract(meanPoint);
|
|
10610
|
-
exx += p.x * p.x;
|
|
10611
|
-
exy += p.x * p.y;
|
|
10612
|
-
exz += p.x * p.z;
|
|
10613
|
-
eyy += p.y * p.y;
|
|
10614
|
-
eyz += p.y * p.z;
|
|
10615
|
-
ezz += p.z * p.z;
|
|
10616
|
-
}
|
|
10617
|
-
|
|
10618
|
-
exx *= invLength;
|
|
10619
|
-
exy *= invLength;
|
|
10620
|
-
exz *= invLength;
|
|
10621
|
-
eyy *= invLength;
|
|
10622
|
-
eyz *= invLength;
|
|
10623
|
-
ezz *= invLength;
|
|
10624
|
-
const covarianceMatrix = scratchCovarianceResult;
|
|
10625
|
-
covarianceMatrix[0] = exx;
|
|
10626
|
-
covarianceMatrix[1] = exy;
|
|
10627
|
-
covarianceMatrix[2] = exz;
|
|
10628
|
-
covarianceMatrix[3] = exy;
|
|
10629
|
-
covarianceMatrix[4] = eyy;
|
|
10630
|
-
covarianceMatrix[5] = eyz;
|
|
10631
|
-
covarianceMatrix[6] = exz;
|
|
10632
|
-
covarianceMatrix[7] = eyz;
|
|
10633
|
-
covarianceMatrix[8] = ezz;
|
|
10634
|
-
const {
|
|
10635
|
-
unitary
|
|
10636
|
-
} = Object(_compute_eigen_decomposition__WEBPACK_IMPORTED_MODULE_1__["default"])(covarianceMatrix, scratchEigenResult);
|
|
10637
|
-
const rotation = result.halfAxes.copy(unitary);
|
|
10638
|
-
let v1 = rotation.getColumn(0, scratchVector4);
|
|
10639
|
-
let v2 = rotation.getColumn(1, scratchVector5);
|
|
10640
|
-
let v3 = rotation.getColumn(2, scratchVector6);
|
|
10641
|
-
let u1 = -Number.MAX_VALUE;
|
|
10642
|
-
let u2 = -Number.MAX_VALUE;
|
|
10643
|
-
let u3 = -Number.MAX_VALUE;
|
|
10644
|
-
let l1 = Number.MAX_VALUE;
|
|
10645
|
-
let l2 = Number.MAX_VALUE;
|
|
10646
|
-
let l3 = Number.MAX_VALUE;
|
|
10647
|
-
|
|
10648
|
-
for (const position of positions) {
|
|
10649
|
-
scratchVector2.copy(position);
|
|
10650
|
-
u1 = Math.max(scratchVector2.dot(v1), u1);
|
|
10651
|
-
u2 = Math.max(scratchVector2.dot(v2), u2);
|
|
10652
|
-
u3 = Math.max(scratchVector2.dot(v3), u3);
|
|
10653
|
-
l1 = Math.min(scratchVector2.dot(v1), l1);
|
|
10654
|
-
l2 = Math.min(scratchVector2.dot(v2), l2);
|
|
10655
|
-
l3 = Math.min(scratchVector2.dot(v3), l3);
|
|
10656
|
-
}
|
|
10657
|
-
|
|
10658
|
-
v1 = v1.multiplyByScalar(0.5 * (l1 + u1));
|
|
10659
|
-
v2 = v2.multiplyByScalar(0.5 * (l2 + u2));
|
|
10660
|
-
v3 = v3.multiplyByScalar(0.5 * (l3 + u3));
|
|
10661
|
-
result.center.copy(v1).add(v2).add(v3);
|
|
10662
|
-
const scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
|
|
10663
|
-
const scaleMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);
|
|
10664
|
-
result.halfAxes.multiplyRight(scaleMatrix);
|
|
10665
|
-
return result;
|
|
10666
|
-
}
|
|
10667
|
-
function makeAxisAlignedBoundingBoxFromPoints(positions, result = new _bounding_volumes_axis_aligned_bounding_box__WEBPACK_IMPORTED_MODULE_3__["default"]()) {
|
|
10668
|
-
if (!positions || positions.length === 0) {
|
|
10669
|
-
result.minimum.set(0, 0, 0);
|
|
10670
|
-
result.maximum.set(0, 0, 0);
|
|
10671
|
-
result.center.set(0, 0, 0);
|
|
10672
|
-
result.halfDiagonal.set(0, 0, 0);
|
|
10673
|
-
return result;
|
|
10674
|
-
}
|
|
10675
|
-
|
|
10676
|
-
let minimumX = positions[0][0];
|
|
10677
|
-
let minimumY = positions[0][1];
|
|
10678
|
-
let minimumZ = positions[0][2];
|
|
10679
|
-
let maximumX = positions[0][0];
|
|
10680
|
-
let maximumY = positions[0][1];
|
|
10681
|
-
let maximumZ = positions[0][2];
|
|
10682
|
-
|
|
10683
|
-
for (const p of positions) {
|
|
10684
|
-
const x = p[0];
|
|
10685
|
-
const y = p[1];
|
|
10686
|
-
const z = p[2];
|
|
10687
|
-
minimumX = Math.min(x, minimumX);
|
|
10688
|
-
maximumX = Math.max(x, maximumX);
|
|
10689
|
-
minimumY = Math.min(y, minimumY);
|
|
10690
|
-
maximumY = Math.max(y, maximumY);
|
|
10691
|
-
minimumZ = Math.min(z, minimumZ);
|
|
10692
|
-
maximumZ = Math.max(z, maximumZ);
|
|
10693
|
-
}
|
|
10694
|
-
|
|
10695
|
-
result.minimum.set(minimumX, minimumY, minimumZ);
|
|
10696
|
-
result.maximum.set(maximumX, maximumY, maximumZ);
|
|
10697
|
-
result.center.copy(result.minimum).add(result.maximum).scale(0.5);
|
|
10698
|
-
result.halfDiagonal.copy(result.maximum).subtract(result.center);
|
|
10699
|
-
return result;
|
|
10700
|
-
}
|
|
10701
|
-
//# sourceMappingURL=bounding-box-from-points.js.map
|
|
10702
|
-
|
|
10703
|
-
/***/ }),
|
|
10704
|
-
|
|
10705
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js":
|
|
10706
|
-
/*!***********************************************************************************************************************!*\
|
|
10707
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js ***!
|
|
10708
|
-
\***********************************************************************************************************************/
|
|
10709
|
-
/*! exports provided: default */
|
|
10710
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10711
|
-
|
|
10712
|
-
"use strict";
|
|
10713
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10714
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return makeBoundingSphereFromPoints; });
|
|
10715
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
10716
|
-
/* harmony import */ var _bounding_volumes_bounding_sphere__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../bounding-volumes/bounding-sphere */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js");
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
const fromPointsXMin = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10720
|
-
const fromPointsYMin = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10721
|
-
const fromPointsZMin = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10722
|
-
const fromPointsXMax = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10723
|
-
const fromPointsYMax = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10724
|
-
const fromPointsZMax = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10725
|
-
const fromPointsCurrentPos = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10726
|
-
const fromPointsScratch = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10727
|
-
const fromPointsRitterCenter = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10728
|
-
const fromPointsMinBoxPt = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10729
|
-
const fromPointsMaxBoxPt = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10730
|
-
const fromPointsNaiveCenterScratch = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10731
|
-
const volumeConstant = 4.0 / 3.0 * Math.PI;
|
|
10732
|
-
function makeBoundingSphereFromPoints(positions, result = new _bounding_volumes_bounding_sphere__WEBPACK_IMPORTED_MODULE_1__["default"]()) {
|
|
10733
|
-
if (!positions || positions.length === 0) {
|
|
10734
|
-
return result.fromCenterRadius([0, 0, 0], 0);
|
|
10735
|
-
}
|
|
10736
|
-
|
|
10737
|
-
const currentPos = fromPointsCurrentPos.copy(positions[0]);
|
|
10738
|
-
const xMin = fromPointsXMin.copy(currentPos);
|
|
10739
|
-
const yMin = fromPointsYMin.copy(currentPos);
|
|
10740
|
-
const zMin = fromPointsZMin.copy(currentPos);
|
|
10741
|
-
const xMax = fromPointsXMax.copy(currentPos);
|
|
10742
|
-
const yMax = fromPointsYMax.copy(currentPos);
|
|
10743
|
-
const zMax = fromPointsZMax.copy(currentPos);
|
|
10744
|
-
|
|
10745
|
-
for (const position of positions) {
|
|
10746
|
-
currentPos.copy(position);
|
|
10747
|
-
const x = currentPos.x;
|
|
10748
|
-
const y = currentPos.y;
|
|
10749
|
-
const z = currentPos.z;
|
|
10750
|
-
|
|
10751
|
-
if (x < xMin.x) {
|
|
10752
|
-
xMin.copy(currentPos);
|
|
10753
|
-
}
|
|
10754
|
-
|
|
10755
|
-
if (x > xMax.x) {
|
|
10756
|
-
xMax.copy(currentPos);
|
|
10757
|
-
}
|
|
10758
|
-
|
|
10759
|
-
if (y < yMin.y) {
|
|
10760
|
-
yMin.copy(currentPos);
|
|
10761
|
-
}
|
|
10762
|
-
|
|
10763
|
-
if (y > yMax.y) {
|
|
10764
|
-
yMax.copy(currentPos);
|
|
10765
|
-
}
|
|
10766
|
-
|
|
10767
|
-
if (z < zMin.z) {
|
|
10768
|
-
zMin.copy(currentPos);
|
|
10769
|
-
}
|
|
10770
|
-
|
|
10771
|
-
if (z > zMax.z) {
|
|
10772
|
-
zMax.copy(currentPos);
|
|
10773
|
-
}
|
|
10774
|
-
}
|
|
10775
|
-
|
|
10776
|
-
const xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();
|
|
10777
|
-
const ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();
|
|
10778
|
-
const zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();
|
|
10779
|
-
let diameter1 = xMin;
|
|
10780
|
-
let diameter2 = xMax;
|
|
10781
|
-
let maxSpan = xSpan;
|
|
10782
|
-
|
|
10783
|
-
if (ySpan > maxSpan) {
|
|
10784
|
-
maxSpan = ySpan;
|
|
10785
|
-
diameter1 = yMin;
|
|
10786
|
-
diameter2 = yMax;
|
|
10787
|
-
}
|
|
10788
|
-
|
|
10789
|
-
if (zSpan > maxSpan) {
|
|
10790
|
-
maxSpan = zSpan;
|
|
10791
|
-
diameter1 = zMin;
|
|
10792
|
-
diameter2 = zMax;
|
|
10793
|
-
}
|
|
10794
|
-
|
|
10795
|
-
const ritterCenter = fromPointsRitterCenter;
|
|
10796
|
-
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
|
|
10797
|
-
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
|
|
10798
|
-
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
|
|
10799
|
-
let radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();
|
|
10800
|
-
let ritterRadius = Math.sqrt(radiusSquared);
|
|
10801
|
-
const minBoxPt = fromPointsMinBoxPt;
|
|
10802
|
-
minBoxPt.x = xMin.x;
|
|
10803
|
-
minBoxPt.y = yMin.y;
|
|
10804
|
-
minBoxPt.z = zMin.z;
|
|
10805
|
-
const maxBoxPt = fromPointsMaxBoxPt;
|
|
10806
|
-
maxBoxPt.x = xMax.x;
|
|
10807
|
-
maxBoxPt.y = yMax.y;
|
|
10808
|
-
maxBoxPt.z = zMax.z;
|
|
10809
|
-
const naiveCenter = fromPointsNaiveCenterScratch.copy(minBoxPt).add(maxBoxPt).multiplyByScalar(0.5);
|
|
10810
|
-
let naiveRadius = 0;
|
|
10811
|
-
|
|
10812
|
-
for (const position of positions) {
|
|
10813
|
-
currentPos.copy(position);
|
|
10814
|
-
const r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();
|
|
10815
|
-
|
|
10816
|
-
if (r > naiveRadius) {
|
|
10817
|
-
naiveRadius = r;
|
|
10818
|
-
}
|
|
10819
|
-
|
|
10820
|
-
const oldCenterToPointSquared = fromPointsScratch.copy(currentPos).subtract(ritterCenter).magnitudeSquared();
|
|
10821
|
-
|
|
10822
|
-
if (oldCenterToPointSquared > radiusSquared) {
|
|
10823
|
-
const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
|
|
10824
|
-
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
|
|
10825
|
-
radiusSquared = ritterRadius * ritterRadius;
|
|
10826
|
-
const oldToNew = oldCenterToPoint - ritterRadius;
|
|
10827
|
-
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
|
|
10828
|
-
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
|
|
10829
|
-
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
|
|
10830
|
-
}
|
|
10831
|
-
}
|
|
10832
|
-
|
|
10833
|
-
if (ritterRadius < naiveRadius) {
|
|
10834
|
-
ritterCenter.to(result.center);
|
|
10835
|
-
result.radius = ritterRadius;
|
|
10836
|
-
} else {
|
|
10837
|
-
naiveCenter.to(result.center);
|
|
10838
|
-
result.radius = naiveRadius;
|
|
10839
|
-
}
|
|
10840
|
-
|
|
10841
|
-
return result;
|
|
10842
|
-
}
|
|
10843
|
-
//# sourceMappingURL=bounding-sphere-from-points.js.map
|
|
10844
|
-
|
|
10845
|
-
/***/ }),
|
|
10846
|
-
|
|
10847
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js":
|
|
10848
|
-
/*!***********************************************************************************************************************!*\
|
|
10849
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js ***!
|
|
10850
|
-
\***********************************************************************************************************************/
|
|
10851
|
-
/*! exports provided: default */
|
|
10852
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10853
|
-
|
|
10854
|
-
"use strict";
|
|
10855
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10856
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return computeEigenDecomposition; });
|
|
10857
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
10858
|
-
|
|
10859
|
-
const scratchMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10860
|
-
const scratchUnitary = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10861
|
-
const scratchDiagonal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10862
|
-
const jMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10863
|
-
const jMatrixTranspose = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]();
|
|
10864
|
-
function computeEigenDecomposition(matrix, result = {}) {
|
|
10865
|
-
const EIGEN_TOLERANCE = _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["_MathUtils"].EPSILON20;
|
|
10866
|
-
const EIGEN_MAX_SWEEPS = 10;
|
|
10867
|
-
let count = 0;
|
|
10868
|
-
let sweep = 0;
|
|
10869
|
-
const unitaryMatrix = scratchUnitary;
|
|
10870
|
-
const diagonalMatrix = scratchDiagonal;
|
|
10871
|
-
unitaryMatrix.identity();
|
|
10872
|
-
diagonalMatrix.copy(matrix);
|
|
10873
|
-
const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);
|
|
10874
|
-
|
|
10875
|
-
while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {
|
|
10876
|
-
shurDecomposition(diagonalMatrix, jMatrix);
|
|
10877
|
-
jMatrixTranspose.copy(jMatrix).transpose();
|
|
10878
|
-
diagonalMatrix.multiplyRight(jMatrix);
|
|
10879
|
-
diagonalMatrix.multiplyLeft(jMatrixTranspose);
|
|
10880
|
-
unitaryMatrix.multiplyRight(jMatrix);
|
|
10881
|
-
|
|
10882
|
-
if (++count > 2) {
|
|
10883
|
-
++sweep;
|
|
10884
|
-
count = 0;
|
|
10885
|
-
}
|
|
10886
|
-
}
|
|
10887
|
-
|
|
10888
|
-
result.unitary = unitaryMatrix.toTarget(result.unitary);
|
|
10889
|
-
result.diagonal = diagonalMatrix.toTarget(result.diagonal);
|
|
10890
|
-
return result;
|
|
10891
|
-
}
|
|
10892
|
-
|
|
10893
|
-
function computeFrobeniusNorm(matrix) {
|
|
10894
|
-
let norm = 0.0;
|
|
10895
|
-
|
|
10896
|
-
for (let i = 0; i < 9; ++i) {
|
|
10897
|
-
const temp = matrix[i];
|
|
10898
|
-
norm += temp * temp;
|
|
10899
|
-
}
|
|
10900
|
-
|
|
10901
|
-
return Math.sqrt(norm);
|
|
10902
|
-
}
|
|
10903
|
-
|
|
10904
|
-
const rowVal = [1, 0, 0];
|
|
10905
|
-
const colVal = [2, 2, 1];
|
|
10906
|
-
|
|
10907
|
-
function offDiagonalFrobeniusNorm(matrix) {
|
|
10908
|
-
let norm = 0.0;
|
|
10909
|
-
|
|
10910
|
-
for (let i = 0; i < 3; ++i) {
|
|
10911
|
-
const temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];
|
|
10912
|
-
norm += 2.0 * temp * temp;
|
|
10913
|
-
}
|
|
10914
|
-
|
|
10915
|
-
return Math.sqrt(norm);
|
|
10916
|
-
}
|
|
10917
|
-
|
|
10918
|
-
function shurDecomposition(matrix, result) {
|
|
10919
|
-
const tolerance = _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["_MathUtils"].EPSILON15;
|
|
10920
|
-
let maxDiagonal = 0.0;
|
|
10921
|
-
let rotAxis = 1;
|
|
10922
|
-
|
|
10923
|
-
for (let i = 0; i < 3; ++i) {
|
|
10924
|
-
const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);
|
|
10925
|
-
|
|
10926
|
-
if (temp > maxDiagonal) {
|
|
10927
|
-
rotAxis = i;
|
|
10928
|
-
maxDiagonal = temp;
|
|
10929
|
-
}
|
|
10930
|
-
}
|
|
10931
|
-
|
|
10932
|
-
const p = rowVal[rotAxis];
|
|
10933
|
-
const q = colVal[rotAxis];
|
|
10934
|
-
let c = 1.0;
|
|
10935
|
-
let s = 0.0;
|
|
10936
|
-
|
|
10937
|
-
if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p)]) > tolerance) {
|
|
10938
|
-
const qq = matrix[scratchMatrix.getElementIndex(q, q)];
|
|
10939
|
-
const pp = matrix[scratchMatrix.getElementIndex(p, p)];
|
|
10940
|
-
const qp = matrix[scratchMatrix.getElementIndex(q, p)];
|
|
10941
|
-
const tau = (qq - pp) / 2.0 / qp;
|
|
10942
|
-
let t;
|
|
10943
|
-
|
|
10944
|
-
if (tau < 0.0) {
|
|
10945
|
-
t = -1.0 / (-tau + Math.sqrt(1.0 + tau * tau));
|
|
10946
|
-
} else {
|
|
10947
|
-
t = 1.0 / (tau + Math.sqrt(1.0 + tau * tau));
|
|
10948
|
-
}
|
|
10949
|
-
|
|
10950
|
-
c = 1.0 / Math.sqrt(1.0 + t * t);
|
|
10951
|
-
s = t * c;
|
|
10952
|
-
}
|
|
10953
|
-
|
|
10954
|
-
_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"].IDENTITY.to(result);
|
|
10955
|
-
result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;
|
|
10956
|
-
result[scratchMatrix.getElementIndex(q, p)] = s;
|
|
10957
|
-
result[scratchMatrix.getElementIndex(p, q)] = -s;
|
|
10958
|
-
return result;
|
|
10959
|
-
}
|
|
10960
|
-
//# sourceMappingURL=compute-eigen-decomposition.js.map
|
|
10961
|
-
|
|
10962
|
-
/***/ }),
|
|
10963
|
-
|
|
10964
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js":
|
|
10965
|
-
/*!***************************************************************************************************************************!*\
|
|
10966
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js ***!
|
|
10967
|
-
\***************************************************************************************************************************/
|
|
10968
|
-
/*! exports provided: default */
|
|
10969
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10970
|
-
|
|
10971
|
-
"use strict";
|
|
10972
|
-
__webpack_require__.r(__webpack_exports__);
|
|
10973
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return AxisAlignedBoundingBox; });
|
|
10974
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
10975
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../constants */ "../../node_modules/@math.gl/culling/dist/esm/constants.js");
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
const scratchVector = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10979
|
-
const scratchNormal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
10980
|
-
class AxisAlignedBoundingBox {
|
|
10981
|
-
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center = null) {
|
|
10982
|
-
center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);
|
|
10983
|
-
this.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](center);
|
|
10984
|
-
this.halfDiagonal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](maximum).subtract(this.center);
|
|
10985
|
-
this.minimum = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](minimum);
|
|
10986
|
-
this.maximum = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](maximum);
|
|
10987
|
-
}
|
|
10988
|
-
|
|
10989
|
-
clone() {
|
|
10990
|
-
return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);
|
|
10991
|
-
}
|
|
10992
|
-
|
|
10993
|
-
equals(right) {
|
|
10994
|
-
return this === right || Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum);
|
|
10995
|
-
}
|
|
10996
|
-
|
|
10997
|
-
transform(transformation) {
|
|
10998
|
-
this.center.transformAsPoint(transformation);
|
|
10999
|
-
this.halfDiagonal.transform(transformation);
|
|
11000
|
-
this.minimum.transform(transformation);
|
|
11001
|
-
this.maximum.transform(transformation);
|
|
11002
|
-
return this;
|
|
11003
|
-
}
|
|
11004
|
-
|
|
11005
|
-
intersectPlane(plane) {
|
|
11006
|
-
const {
|
|
11007
|
-
halfDiagonal
|
|
11008
|
-
} = this;
|
|
11009
|
-
const normal = scratchNormal.from(plane.normal);
|
|
11010
|
-
const e = halfDiagonal.x * Math.abs(normal.x) + halfDiagonal.y * Math.abs(normal.y) + halfDiagonal.z * Math.abs(normal.z);
|
|
11011
|
-
const s = this.center.dot(normal) + plane.distance;
|
|
11012
|
-
|
|
11013
|
-
if (s - e > 0) {
|
|
11014
|
-
return _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INSIDE;
|
|
11015
|
-
}
|
|
11016
|
-
|
|
11017
|
-
if (s + e < 0) {
|
|
11018
|
-
return _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].OUTSIDE;
|
|
11019
|
-
}
|
|
11020
|
-
|
|
11021
|
-
return _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INTERSECTING;
|
|
11022
|
-
}
|
|
11023
|
-
|
|
11024
|
-
distanceTo(point) {
|
|
11025
|
-
return Math.sqrt(this.distanceSquaredTo(point));
|
|
11026
|
-
}
|
|
11027
|
-
|
|
11028
|
-
distanceSquaredTo(point) {
|
|
11029
|
-
const offset = scratchVector.from(point).subtract(this.center);
|
|
11030
|
-
const {
|
|
11031
|
-
halfDiagonal
|
|
11032
|
-
} = this;
|
|
11033
|
-
let distanceSquared = 0.0;
|
|
11034
|
-
let d;
|
|
11035
|
-
d = Math.abs(offset.x) - halfDiagonal.x;
|
|
11036
|
-
|
|
11037
|
-
if (d > 0) {
|
|
11038
|
-
distanceSquared += d * d;
|
|
11039
|
-
}
|
|
11040
|
-
|
|
11041
|
-
d = Math.abs(offset.y) - halfDiagonal.y;
|
|
11042
|
-
|
|
11043
|
-
if (d > 0) {
|
|
11044
|
-
distanceSquared += d * d;
|
|
11045
|
-
}
|
|
11046
|
-
|
|
11047
|
-
d = Math.abs(offset.z) - halfDiagonal.z;
|
|
11048
|
-
|
|
11049
|
-
if (d > 0) {
|
|
11050
|
-
distanceSquared += d * d;
|
|
11051
|
-
}
|
|
11052
|
-
|
|
11053
|
-
return distanceSquared;
|
|
11054
|
-
}
|
|
11055
|
-
|
|
11056
|
-
}
|
|
11057
|
-
//# sourceMappingURL=axis-aligned-bounding-box.js.map
|
|
11058
|
-
|
|
11059
|
-
/***/ }),
|
|
11060
|
-
|
|
11061
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js":
|
|
11062
|
-
/*!*****************************************************************************************************************!*\
|
|
11063
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js ***!
|
|
11064
|
-
\*****************************************************************************************************************/
|
|
11065
|
-
/*! exports provided: default */
|
|
11066
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11067
|
-
|
|
11068
|
-
"use strict";
|
|
11069
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11070
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return BoundingSphere; });
|
|
11071
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11072
|
-
/* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
|
|
11073
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../constants */ "../../node_modules/@math.gl/culling/dist/esm/constants.js");
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
const scratchVector = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11078
|
-
const scratchVector2 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11079
|
-
class BoundingSphere {
|
|
11080
|
-
constructor(center = [0, 0, 0], radius = 0.0) {
|
|
11081
|
-
this.radius = -0;
|
|
11082
|
-
this.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11083
|
-
this.fromCenterRadius(center, radius);
|
|
11084
|
-
}
|
|
11085
|
-
|
|
11086
|
-
fromCenterRadius(center, radius) {
|
|
11087
|
-
this.center.from(center);
|
|
11088
|
-
this.radius = radius;
|
|
11089
|
-
return this;
|
|
11090
|
-
}
|
|
11091
|
-
|
|
11092
|
-
fromCornerPoints(corner, oppositeCorner) {
|
|
11093
|
-
oppositeCorner = scratchVector.from(oppositeCorner);
|
|
11094
|
-
this.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]().from(corner).add(oppositeCorner).scale(0.5);
|
|
11095
|
-
this.radius = this.center.distance(oppositeCorner);
|
|
11096
|
-
return this;
|
|
11097
|
-
}
|
|
11098
|
-
|
|
11099
|
-
equals(right) {
|
|
11100
|
-
return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
|
|
11101
|
-
}
|
|
11102
|
-
|
|
11103
|
-
clone() {
|
|
11104
|
-
return new BoundingSphere(this.center, this.radius);
|
|
11105
|
-
}
|
|
11106
|
-
|
|
11107
|
-
union(boundingSphere) {
|
|
11108
|
-
const leftCenter = this.center;
|
|
11109
|
-
const leftRadius = this.radius;
|
|
11110
|
-
const rightCenter = boundingSphere.center;
|
|
11111
|
-
const rightRadius = boundingSphere.radius;
|
|
11112
|
-
const toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);
|
|
11113
|
-
const centerSeparation = toRightCenter.magnitude();
|
|
11114
|
-
|
|
11115
|
-
if (leftRadius >= centerSeparation + rightRadius) {
|
|
11116
|
-
return this.clone();
|
|
11117
|
-
}
|
|
11118
|
-
|
|
11119
|
-
if (rightRadius >= centerSeparation + leftRadius) {
|
|
11120
|
-
return boundingSphere.clone();
|
|
11121
|
-
}
|
|
11122
|
-
|
|
11123
|
-
const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
|
|
11124
|
-
scratchVector2.copy(toRightCenter).scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation).add(leftCenter);
|
|
11125
|
-
this.center.copy(scratchVector2);
|
|
11126
|
-
this.radius = halfDistanceBetweenTangentPoints;
|
|
11127
|
-
return this;
|
|
11128
|
-
}
|
|
11129
|
-
|
|
11130
|
-
expand(point) {
|
|
11131
|
-
point = scratchVector.from(point);
|
|
11132
|
-
const radius = point.subtract(this.center).magnitude();
|
|
11133
|
-
|
|
11134
|
-
if (radius > this.radius) {
|
|
11135
|
-
this.radius = radius;
|
|
11136
|
-
}
|
|
11137
|
-
|
|
11138
|
-
return this;
|
|
11139
|
-
}
|
|
11140
|
-
|
|
11141
|
-
transform(transform) {
|
|
11142
|
-
this.center.transform(transform);
|
|
11143
|
-
const scale = gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["getScaling"](scratchVector, transform);
|
|
11144
|
-
this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
|
|
11145
|
-
return this;
|
|
11146
|
-
}
|
|
11147
|
-
|
|
11148
|
-
distanceSquaredTo(point) {
|
|
11149
|
-
const d = this.distanceTo(point);
|
|
11150
|
-
return d * d;
|
|
11151
|
-
}
|
|
11152
|
-
|
|
11153
|
-
distanceTo(point) {
|
|
11154
|
-
point = scratchVector.from(point);
|
|
11155
|
-
const delta = point.subtract(this.center);
|
|
11156
|
-
return Math.max(0, delta.len() - this.radius);
|
|
11157
|
-
}
|
|
11158
|
-
|
|
11159
|
-
intersectPlane(plane) {
|
|
11160
|
-
const center = this.center;
|
|
11161
|
-
const radius = this.radius;
|
|
11162
|
-
const normal = plane.normal;
|
|
11163
|
-
const distanceToPlane = normal.dot(center) + plane.distance;
|
|
11164
|
-
|
|
11165
|
-
if (distanceToPlane < -radius) {
|
|
11166
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].OUTSIDE;
|
|
11167
|
-
}
|
|
11168
|
-
|
|
11169
|
-
if (distanceToPlane < radius) {
|
|
11170
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].INTERSECTING;
|
|
11171
|
-
}
|
|
11172
|
-
|
|
11173
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].INSIDE;
|
|
11174
|
-
}
|
|
11175
|
-
|
|
11176
|
-
}
|
|
11177
|
-
//# sourceMappingURL=bounding-sphere.js.map
|
|
11178
|
-
|
|
11179
|
-
/***/ }),
|
|
11180
|
-
|
|
11181
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js":
|
|
11182
|
-
/*!***********************************************************************************************************************!*\
|
|
11183
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js ***!
|
|
11184
|
-
\***********************************************************************************************************************/
|
|
11185
|
-
/*! exports provided: default */
|
|
11186
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11187
|
-
|
|
11188
|
-
"use strict";
|
|
11189
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11190
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return OrientedBoundingBox; });
|
|
11191
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11192
|
-
/* harmony import */ var _bounding_sphere__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bounding-sphere */ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js");
|
|
11193
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../constants */ "../../node_modules/@math.gl/culling/dist/esm/constants.js");
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
const scratchVector3 = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11198
|
-
const scratchOffset = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11199
|
-
const scratchVectorU = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11200
|
-
const scratchVectorV = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11201
|
-
const scratchVectorW = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11202
|
-
const scratchCorner = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11203
|
-
const scratchToCenter = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11204
|
-
const MATRIX3 = {
|
|
11205
|
-
COLUMN0ROW0: 0,
|
|
11206
|
-
COLUMN0ROW1: 1,
|
|
11207
|
-
COLUMN0ROW2: 2,
|
|
11208
|
-
COLUMN1ROW0: 3,
|
|
11209
|
-
COLUMN1ROW1: 4,
|
|
11210
|
-
COLUMN1ROW2: 5,
|
|
11211
|
-
COLUMN2ROW0: 6,
|
|
11212
|
-
COLUMN2ROW1: 7,
|
|
11213
|
-
COLUMN2ROW2: 8
|
|
11214
|
-
};
|
|
11215
|
-
class OrientedBoundingBox {
|
|
11216
|
-
constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
|
11217
|
-
this.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]().from(center);
|
|
11218
|
-
this.halfAxes = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"](halfAxes);
|
|
11219
|
-
}
|
|
11220
|
-
|
|
11221
|
-
get halfSize() {
|
|
11222
|
-
const xAxis = this.halfAxes.getColumn(0);
|
|
11223
|
-
const yAxis = this.halfAxes.getColumn(1);
|
|
11224
|
-
const zAxis = this.halfAxes.getColumn(2);
|
|
11225
|
-
return [new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](xAxis).len(), new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](yAxis).len(), new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](zAxis).len()];
|
|
11226
|
-
}
|
|
11227
|
-
|
|
11228
|
-
get quaternion() {
|
|
11229
|
-
const xAxis = this.halfAxes.getColumn(0);
|
|
11230
|
-
const yAxis = this.halfAxes.getColumn(1);
|
|
11231
|
-
const zAxis = this.halfAxes.getColumn(2);
|
|
11232
|
-
const normXAxis = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](xAxis).normalize();
|
|
11233
|
-
const normYAxis = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](yAxis).normalize();
|
|
11234
|
-
const normZAxis = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](zAxis).normalize();
|
|
11235
|
-
return new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Quaternion"]().fromMatrix3(new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]([...normXAxis, ...normYAxis, ...normZAxis]));
|
|
11236
|
-
}
|
|
11237
|
-
|
|
11238
|
-
fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
|
|
11239
|
-
const quaternionObject = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Quaternion"](quaternion);
|
|
11240
|
-
const directionsMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]().fromQuaternion(quaternionObject);
|
|
11241
|
-
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
|
|
11242
|
-
directionsMatrix[1] = directionsMatrix[1] * halfSize[0];
|
|
11243
|
-
directionsMatrix[2] = directionsMatrix[2] * halfSize[0];
|
|
11244
|
-
directionsMatrix[3] = directionsMatrix[3] * halfSize[1];
|
|
11245
|
-
directionsMatrix[4] = directionsMatrix[4] * halfSize[1];
|
|
11246
|
-
directionsMatrix[5] = directionsMatrix[5] * halfSize[1];
|
|
11247
|
-
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
|
|
11248
|
-
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
|
|
11249
|
-
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
|
|
11250
|
-
this.center = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]().from(center);
|
|
11251
|
-
this.halfAxes = directionsMatrix;
|
|
11252
|
-
return this;
|
|
11253
|
-
}
|
|
11254
|
-
|
|
11255
|
-
clone() {
|
|
11256
|
-
return new OrientedBoundingBox(this.center, this.halfAxes);
|
|
11257
|
-
}
|
|
11258
|
-
|
|
11259
|
-
equals(right) {
|
|
11260
|
-
return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
|
|
11261
|
-
}
|
|
11262
|
-
|
|
11263
|
-
getBoundingSphere(result = new _bounding_sphere__WEBPACK_IMPORTED_MODULE_1__["default"]()) {
|
|
11264
|
-
const halfAxes = this.halfAxes;
|
|
11265
|
-
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
11266
|
-
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
11267
|
-
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
11268
|
-
const cornerVector = scratchVector3.copy(u).add(v).add(w);
|
|
11269
|
-
result.center.copy(this.center);
|
|
11270
|
-
result.radius = cornerVector.magnitude();
|
|
11271
|
-
return result;
|
|
11272
|
-
}
|
|
11273
|
-
|
|
11274
|
-
intersectPlane(plane) {
|
|
11275
|
-
const center = this.center;
|
|
11276
|
-
const normal = plane.normal;
|
|
11277
|
-
const halfAxes = this.halfAxes;
|
|
11278
|
-
const normalX = normal.x;
|
|
11279
|
-
const normalY = normal.y;
|
|
11280
|
-
const normalZ = normal.z;
|
|
11281
|
-
const radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] + normalY * halfAxes[MATRIX3.COLUMN0ROW1] + normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] + normalY * halfAxes[MATRIX3.COLUMN1ROW1] + normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] + normalY * halfAxes[MATRIX3.COLUMN2ROW1] + normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);
|
|
11282
|
-
const distanceToPlane = normal.dot(center) + plane.distance;
|
|
11283
|
-
|
|
11284
|
-
if (distanceToPlane <= -radEffective) {
|
|
11285
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].OUTSIDE;
|
|
11286
|
-
} else if (distanceToPlane >= radEffective) {
|
|
11287
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].INSIDE;
|
|
11288
|
-
}
|
|
11289
|
-
|
|
11290
|
-
return _constants__WEBPACK_IMPORTED_MODULE_2__["INTERSECTION"].INTERSECTING;
|
|
11291
|
-
}
|
|
11292
|
-
|
|
11293
|
-
distanceTo(point) {
|
|
11294
|
-
return Math.sqrt(this.distanceSquaredTo(point));
|
|
11295
|
-
}
|
|
11296
|
-
|
|
11297
|
-
distanceSquaredTo(point) {
|
|
11298
|
-
const offset = scratchOffset.from(point).subtract(this.center);
|
|
11299
|
-
const halfAxes = this.halfAxes;
|
|
11300
|
-
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
11301
|
-
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
11302
|
-
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
11303
|
-
const uHalf = u.magnitude();
|
|
11304
|
-
const vHalf = v.magnitude();
|
|
11305
|
-
const wHalf = w.magnitude();
|
|
11306
|
-
u.normalize();
|
|
11307
|
-
v.normalize();
|
|
11308
|
-
w.normalize();
|
|
11309
|
-
let distanceSquared = 0.0;
|
|
11310
|
-
let d;
|
|
11311
|
-
d = Math.abs(offset.dot(u)) - uHalf;
|
|
11312
|
-
|
|
11313
|
-
if (d > 0) {
|
|
11314
|
-
distanceSquared += d * d;
|
|
11315
|
-
}
|
|
11316
|
-
|
|
11317
|
-
d = Math.abs(offset.dot(v)) - vHalf;
|
|
11318
|
-
|
|
11319
|
-
if (d > 0) {
|
|
11320
|
-
distanceSquared += d * d;
|
|
11321
|
-
}
|
|
11322
|
-
|
|
11323
|
-
d = Math.abs(offset.dot(w)) - wHalf;
|
|
11324
|
-
|
|
11325
|
-
if (d > 0) {
|
|
11326
|
-
distanceSquared += d * d;
|
|
11327
|
-
}
|
|
11328
|
-
|
|
11329
|
-
return distanceSquared;
|
|
11330
|
-
}
|
|
11331
|
-
|
|
11332
|
-
computePlaneDistances(position, direction, result = [-0, -0]) {
|
|
11333
|
-
let minDist = Number.POSITIVE_INFINITY;
|
|
11334
|
-
let maxDist = Number.NEGATIVE_INFINITY;
|
|
11335
|
-
const center = this.center;
|
|
11336
|
-
const halfAxes = this.halfAxes;
|
|
11337
|
-
const u = halfAxes.getColumn(0, scratchVectorU);
|
|
11338
|
-
const v = halfAxes.getColumn(1, scratchVectorV);
|
|
11339
|
-
const w = halfAxes.getColumn(2, scratchVectorW);
|
|
11340
|
-
const corner = scratchCorner.copy(u).add(v).add(w).add(center);
|
|
11341
|
-
const toCenter = scratchToCenter.copy(corner).subtract(position);
|
|
11342
|
-
let mag = direction.dot(toCenter);
|
|
11343
|
-
minDist = Math.min(mag, minDist);
|
|
11344
|
-
maxDist = Math.max(mag, maxDist);
|
|
11345
|
-
corner.copy(center).add(u).add(v).subtract(w);
|
|
11346
|
-
toCenter.copy(corner).subtract(position);
|
|
11347
|
-
mag = direction.dot(toCenter);
|
|
11348
|
-
minDist = Math.min(mag, minDist);
|
|
11349
|
-
maxDist = Math.max(mag, maxDist);
|
|
11350
|
-
corner.copy(center).add(u).subtract(v).add(w);
|
|
11351
|
-
toCenter.copy(corner).subtract(position);
|
|
11352
|
-
mag = direction.dot(toCenter);
|
|
11353
|
-
minDist = Math.min(mag, minDist);
|
|
11354
|
-
maxDist = Math.max(mag, maxDist);
|
|
11355
|
-
corner.copy(center).add(u).subtract(v).subtract(w);
|
|
11356
|
-
toCenter.copy(corner).subtract(position);
|
|
11357
|
-
mag = direction.dot(toCenter);
|
|
11358
|
-
minDist = Math.min(mag, minDist);
|
|
11359
|
-
maxDist = Math.max(mag, maxDist);
|
|
11360
|
-
center.copy(corner).subtract(u).add(v).add(w);
|
|
11361
|
-
toCenter.copy(corner).subtract(position);
|
|
11362
|
-
mag = direction.dot(toCenter);
|
|
11363
|
-
minDist = Math.min(mag, minDist);
|
|
11364
|
-
maxDist = Math.max(mag, maxDist);
|
|
11365
|
-
center.copy(corner).subtract(u).add(v).subtract(w);
|
|
11366
|
-
toCenter.copy(corner).subtract(position);
|
|
11367
|
-
mag = direction.dot(toCenter);
|
|
11368
|
-
minDist = Math.min(mag, minDist);
|
|
11369
|
-
maxDist = Math.max(mag, maxDist);
|
|
11370
|
-
center.copy(corner).subtract(u).subtract(v).add(w);
|
|
11371
|
-
toCenter.copy(corner).subtract(position);
|
|
11372
|
-
mag = direction.dot(toCenter);
|
|
11373
|
-
minDist = Math.min(mag, minDist);
|
|
11374
|
-
maxDist = Math.max(mag, maxDist);
|
|
11375
|
-
center.copy(corner).subtract(u).subtract(v).subtract(w);
|
|
11376
|
-
toCenter.copy(corner).subtract(position);
|
|
11377
|
-
mag = direction.dot(toCenter);
|
|
11378
|
-
minDist = Math.min(mag, minDist);
|
|
11379
|
-
maxDist = Math.max(mag, maxDist);
|
|
11380
|
-
result[0] = minDist;
|
|
11381
|
-
result[1] = maxDist;
|
|
11382
|
-
return result;
|
|
11383
|
-
}
|
|
11384
|
-
|
|
11385
|
-
transform(transformation) {
|
|
11386
|
-
this.center.transformAsPoint(transformation);
|
|
11387
|
-
const xAxis = this.halfAxes.getColumn(0, scratchVectorU);
|
|
11388
|
-
xAxis.transformAsPoint(transformation);
|
|
11389
|
-
const yAxis = this.halfAxes.getColumn(1, scratchVectorV);
|
|
11390
|
-
yAxis.transformAsPoint(transformation);
|
|
11391
|
-
const zAxis = this.halfAxes.getColumn(2, scratchVectorW);
|
|
11392
|
-
zAxis.transformAsPoint(transformation);
|
|
11393
|
-
this.halfAxes = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix3"]([...xAxis, ...yAxis, ...zAxis]);
|
|
11394
|
-
return this;
|
|
11395
|
-
}
|
|
11396
|
-
|
|
11397
|
-
getTransform() {
|
|
11398
|
-
throw new Error('not implemented');
|
|
11399
|
-
}
|
|
11400
|
-
|
|
11401
|
-
}
|
|
11402
|
-
//# sourceMappingURL=oriented-bounding-box.js.map
|
|
11403
|
-
|
|
11404
|
-
/***/ }),
|
|
11405
|
-
|
|
11406
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js":
|
|
11407
|
-
/*!***********************************************************************************************!*\
|
|
11408
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js ***!
|
|
11409
|
-
\***********************************************************************************************/
|
|
11410
|
-
/*! exports provided: default */
|
|
11411
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11412
|
-
|
|
11413
|
-
"use strict";
|
|
11414
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11415
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CullingVolume; });
|
|
11416
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11417
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "../../node_modules/@math.gl/culling/dist/esm/constants.js");
|
|
11418
|
-
/* harmony import */ var _plane__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./plane */ "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js");
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
const faces = [new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]([1, 0, 0]), new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]([0, 1, 0]), new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]([0, 0, 1])];
|
|
11423
|
-
const scratchPlaneCenter = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11424
|
-
const scratchPlaneNormal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11425
|
-
const scratchPlane = new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"](1.0, 0.0, 0.0), 0.0);
|
|
11426
|
-
class CullingVolume {
|
|
11427
|
-
static get MASK_OUTSIDE() {
|
|
11428
|
-
return 0xffffffff;
|
|
11429
|
-
}
|
|
11430
|
-
|
|
11431
|
-
static get MASK_INSIDE() {
|
|
11432
|
-
return 0x00000000;
|
|
11433
|
-
}
|
|
11434
|
-
|
|
11435
|
-
static get MASK_INDETERMINATE() {
|
|
11436
|
-
return 0x7fffffff;
|
|
11437
|
-
}
|
|
11438
|
-
|
|
11439
|
-
constructor(planes = []) {
|
|
11440
|
-
this.planes = planes;
|
|
11441
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(this.planes.every(plane => plane instanceof _plane__WEBPACK_IMPORTED_MODULE_2__["default"]));
|
|
11442
|
-
}
|
|
11443
|
-
|
|
11444
|
-
fromBoundingSphere(boundingSphere) {
|
|
11445
|
-
this.planes.length = 2 * faces.length;
|
|
11446
|
-
const center = boundingSphere.center;
|
|
11447
|
-
const radius = boundingSphere.radius;
|
|
11448
|
-
let planeIndex = 0;
|
|
11449
|
-
|
|
11450
|
-
for (const faceNormal of faces) {
|
|
11451
|
-
let plane0 = this.planes[planeIndex];
|
|
11452
|
-
let plane1 = this.planes[planeIndex + 1];
|
|
11453
|
-
|
|
11454
|
-
if (!plane0) {
|
|
11455
|
-
plane0 = this.planes[planeIndex] = new _plane__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
|
11456
|
-
}
|
|
11457
|
-
|
|
11458
|
-
if (!plane1) {
|
|
11459
|
-
plane1 = this.planes[planeIndex + 1] = new _plane__WEBPACK_IMPORTED_MODULE_2__["default"]();
|
|
11460
|
-
}
|
|
11461
|
-
|
|
11462
|
-
const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
|
|
11463
|
-
const plane0Distance = -faceNormal.dot(plane0Center);
|
|
11464
|
-
plane0.fromPointNormal(plane0Center, faceNormal);
|
|
11465
|
-
const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
|
|
11466
|
-
const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
|
|
11467
|
-
const plane1Distance = -negatedFaceNormal.dot(plane1Center);
|
|
11468
|
-
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
|
|
11469
|
-
planeIndex += 2;
|
|
11470
|
-
}
|
|
11471
|
-
|
|
11472
|
-
return this;
|
|
11473
|
-
}
|
|
11474
|
-
|
|
11475
|
-
computeVisibility(boundingVolume) {
|
|
11476
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(boundingVolume);
|
|
11477
|
-
let intersect = _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INSIDE;
|
|
11478
|
-
|
|
11479
|
-
for (const plane of this.planes) {
|
|
11480
|
-
const result = boundingVolume.intersectPlane(plane);
|
|
11481
|
-
|
|
11482
|
-
switch (result) {
|
|
11483
|
-
case _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].OUTSIDE:
|
|
11484
|
-
return _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].OUTSIDE;
|
|
11485
|
-
|
|
11486
|
-
case _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INTERSECTING:
|
|
11487
|
-
intersect = _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INTERSECTING;
|
|
11488
|
-
break;
|
|
11489
|
-
|
|
11490
|
-
default:
|
|
11491
|
-
}
|
|
11492
|
-
}
|
|
11493
|
-
|
|
11494
|
-
return intersect;
|
|
11495
|
-
}
|
|
11496
|
-
|
|
11497
|
-
computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
|
|
11498
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(boundingVolume, 'boundingVolume is required.');
|
|
11499
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');
|
|
11500
|
-
|
|
11501
|
-
if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
|
|
11502
|
-
return parentPlaneMask;
|
|
11503
|
-
}
|
|
11504
|
-
|
|
11505
|
-
let mask = CullingVolume.MASK_INSIDE;
|
|
11506
|
-
const planes = this.planes;
|
|
11507
|
-
|
|
11508
|
-
for (let k = 0; k < this.planes.length; ++k) {
|
|
11509
|
-
const flag = k < 31 ? 1 << k : 0;
|
|
11510
|
-
|
|
11511
|
-
if (k < 31 && (parentPlaneMask & flag) === 0) {
|
|
11512
|
-
continue;
|
|
11513
|
-
}
|
|
11514
|
-
|
|
11515
|
-
const plane = planes[k];
|
|
11516
|
-
const result = boundingVolume.intersectPlane(plane);
|
|
11517
|
-
|
|
11518
|
-
if (result === _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].OUTSIDE) {
|
|
11519
|
-
return CullingVolume.MASK_OUTSIDE;
|
|
11520
|
-
} else if (result === _constants__WEBPACK_IMPORTED_MODULE_1__["INTERSECTION"].INTERSECTING) {
|
|
11521
|
-
mask |= flag;
|
|
11522
|
-
}
|
|
11523
|
-
}
|
|
11524
|
-
|
|
11525
|
-
return mask;
|
|
11526
|
-
}
|
|
11527
|
-
|
|
11528
|
-
}
|
|
11529
|
-
//# sourceMappingURL=culling-volume.js.map
|
|
11530
|
-
|
|
11531
|
-
/***/ }),
|
|
11532
|
-
|
|
11533
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js":
|
|
11534
|
-
/*!****************************************************************************************************!*\
|
|
11535
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js ***!
|
|
11536
|
-
\****************************************************************************************************/
|
|
11537
|
-
/*! exports provided: default */
|
|
11538
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11539
|
-
|
|
11540
|
-
"use strict";
|
|
11541
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11542
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PerspectiveFrustum; });
|
|
11543
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11544
|
-
/* harmony import */ var _perspective_off_center_frustum__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./perspective-off-center-frustum */ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js");
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
const defined = val => val !== null && typeof val !== 'undefined';
|
|
11549
|
-
|
|
11550
|
-
class PerspectiveFrustum {
|
|
11551
|
-
constructor(options = {}) {
|
|
11552
|
-
options = {
|
|
11553
|
-
near: 1.0,
|
|
11554
|
-
far: 500000000.0,
|
|
11555
|
-
xOffset: 0.0,
|
|
11556
|
-
yOffset: 0.0,
|
|
11557
|
-
...options
|
|
11558
|
-
};
|
|
11559
|
-
this._offCenterFrustum = new _perspective_off_center_frustum__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
11560
|
-
this.fov = options.fov;
|
|
11561
|
-
this._fov = undefined;
|
|
11562
|
-
this._fovy = undefined;
|
|
11563
|
-
this._sseDenominator = undefined;
|
|
11564
|
-
this.aspectRatio = options.aspectRatio;
|
|
11565
|
-
this._aspectRatio = undefined;
|
|
11566
|
-
this.near = options.near;
|
|
11567
|
-
this._near = this.near;
|
|
11568
|
-
this.far = options.far;
|
|
11569
|
-
this._far = this.far;
|
|
11570
|
-
this.xOffset = options.xOffset;
|
|
11571
|
-
this._xOffset = this.xOffset;
|
|
11572
|
-
this.yOffset = options.yOffset;
|
|
11573
|
-
this._yOffset = this.yOffset;
|
|
11574
|
-
}
|
|
11575
|
-
|
|
11576
|
-
clone() {
|
|
11577
|
-
return new PerspectiveFrustum({
|
|
11578
|
-
aspectRatio: this.aspectRatio,
|
|
11579
|
-
fov: this.fov,
|
|
11580
|
-
near: this.near,
|
|
11581
|
-
far: this.far
|
|
11582
|
-
});
|
|
11583
|
-
}
|
|
11584
|
-
|
|
11585
|
-
equals(other) {
|
|
11586
|
-
if (!defined(other) || !(other instanceof PerspectiveFrustum)) {
|
|
11587
|
-
return false;
|
|
11588
|
-
}
|
|
11589
|
-
|
|
11590
|
-
update(this);
|
|
11591
|
-
update(other);
|
|
11592
|
-
return this.fov === other.fov && this.aspectRatio === other.aspectRatio && this.near === other.near && this.far === other.far && this._offCenterFrustum.equals(other._offCenterFrustum);
|
|
11593
|
-
}
|
|
11594
|
-
|
|
11595
|
-
get projectionMatrix() {
|
|
11596
|
-
update(this);
|
|
11597
|
-
return this._offCenterFrustum.projectionMatrix;
|
|
11598
|
-
}
|
|
11599
|
-
|
|
11600
|
-
get infiniteProjectionMatrix() {
|
|
11601
|
-
update(this);
|
|
11602
|
-
return this._offCenterFrustum.infiniteProjectionMatrix;
|
|
11603
|
-
}
|
|
11604
|
-
|
|
11605
|
-
get fovy() {
|
|
11606
|
-
update(this);
|
|
11607
|
-
return this._fovy;
|
|
11608
|
-
}
|
|
11609
|
-
|
|
11610
|
-
get sseDenominator() {
|
|
11611
|
-
update(this);
|
|
11612
|
-
return this._sseDenominator;
|
|
11613
|
-
}
|
|
11614
|
-
|
|
11615
|
-
computeCullingVolume(position, direction, up) {
|
|
11616
|
-
update(this);
|
|
11617
|
-
return this._offCenterFrustum.computeCullingVolume(position, direction, up);
|
|
11618
|
-
}
|
|
11619
|
-
|
|
11620
|
-
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
|
|
11621
|
-
update(this);
|
|
11622
|
-
return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result);
|
|
11623
|
-
}
|
|
11624
|
-
|
|
11625
|
-
}
|
|
11626
|
-
|
|
11627
|
-
function update(frustum) {
|
|
11628
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Number.isFinite(frustum.fov) && Number.isFinite(frustum.aspectRatio) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
|
|
11629
|
-
const f = frustum._offCenterFrustum;
|
|
11630
|
-
|
|
11631
|
-
if (frustum.fov !== frustum._fov || frustum.aspectRatio !== frustum._aspectRatio || frustum.near !== frustum._near || frustum.far !== frustum._far || frustum.xOffset !== frustum._xOffset || frustum.yOffset !== frustum._yOffset) {
|
|
11632
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(frustum.fov >= 0 && frustum.fov < Math.PI);
|
|
11633
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(frustum.aspectRatio > 0);
|
|
11634
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(frustum.near >= 0 && frustum.near < frustum.far);
|
|
11635
|
-
frustum._aspectRatio = frustum.aspectRatio;
|
|
11636
|
-
frustum._fov = frustum.fov;
|
|
11637
|
-
frustum._fovy = frustum.aspectRatio <= 1 ? frustum.fov : Math.atan(Math.tan(frustum.fov * 0.5) / frustum.aspectRatio) * 2.0;
|
|
11638
|
-
frustum._near = frustum.near;
|
|
11639
|
-
frustum._far = frustum.far;
|
|
11640
|
-
frustum._sseDenominator = 2.0 * Math.tan(0.5 * frustum._fovy);
|
|
11641
|
-
frustum._xOffset = frustum.xOffset;
|
|
11642
|
-
frustum._yOffset = frustum.yOffset;
|
|
11643
|
-
f.top = frustum.near * Math.tan(0.5 * frustum._fovy);
|
|
11644
|
-
f.bottom = -f.top;
|
|
11645
|
-
f.right = frustum.aspectRatio * f.top;
|
|
11646
|
-
f.left = -f.right;
|
|
11647
|
-
f.near = frustum.near;
|
|
11648
|
-
f.far = frustum.far;
|
|
11649
|
-
f.right += frustum.xOffset;
|
|
11650
|
-
f.left += frustum.xOffset;
|
|
11651
|
-
f.top += frustum.yOffset;
|
|
11652
|
-
f.bottom += frustum.yOffset;
|
|
11653
|
-
}
|
|
11654
|
-
}
|
|
11655
|
-
//# sourceMappingURL=perspective-frustum.js.map
|
|
11656
|
-
|
|
11657
|
-
/***/ }),
|
|
11658
|
-
|
|
11659
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js":
|
|
11660
|
-
/*!***************************************************************************************************************!*\
|
|
11661
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js ***!
|
|
11662
|
-
\***************************************************************************************************************/
|
|
11663
|
-
/*! exports provided: default */
|
|
11664
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11665
|
-
|
|
11666
|
-
"use strict";
|
|
11667
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11668
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PerspectiveOffCenterFrustum; });
|
|
11669
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11670
|
-
/* harmony import */ var _culling_volume__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./culling-volume */ "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js");
|
|
11671
|
-
/* harmony import */ var _plane__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./plane */ "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js");
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
const scratchPlaneUpVector = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11676
|
-
const scratchPlaneRightVector = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11677
|
-
const scratchPlaneNearCenter = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11678
|
-
const scratchPlaneFarCenter = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11679
|
-
const scratchPlaneNormal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11680
|
-
class PerspectiveOffCenterFrustum {
|
|
11681
|
-
constructor(options = {}) {
|
|
11682
|
-
options = {
|
|
11683
|
-
near: 1.0,
|
|
11684
|
-
far: 500000000.0,
|
|
11685
|
-
...options
|
|
11686
|
-
};
|
|
11687
|
-
this.left = options.left;
|
|
11688
|
-
this._left = undefined;
|
|
11689
|
-
this.right = options.right;
|
|
11690
|
-
this._right = undefined;
|
|
11691
|
-
this.top = options.top;
|
|
11692
|
-
this._top = undefined;
|
|
11693
|
-
this.bottom = options.bottom;
|
|
11694
|
-
this._bottom = undefined;
|
|
11695
|
-
this.near = options.near;
|
|
11696
|
-
this._near = this.near;
|
|
11697
|
-
this.far = options.far;
|
|
11698
|
-
this._far = this.far;
|
|
11699
|
-
this._cullingVolume = new _culling_volume__WEBPACK_IMPORTED_MODULE_1__["default"]([new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](), new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](), new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](), new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](), new _plane__WEBPACK_IMPORTED_MODULE_2__["default"](), new _plane__WEBPACK_IMPORTED_MODULE_2__["default"]()]);
|
|
11700
|
-
this._perspectiveMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix4"]();
|
|
11701
|
-
this._infinitePerspective = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix4"]();
|
|
11702
|
-
}
|
|
11703
|
-
|
|
11704
|
-
clone() {
|
|
11705
|
-
return new PerspectiveOffCenterFrustum({
|
|
11706
|
-
right: this.right,
|
|
11707
|
-
left: this.left,
|
|
11708
|
-
top: this.top,
|
|
11709
|
-
bottom: this.bottom,
|
|
11710
|
-
near: this.near,
|
|
11711
|
-
far: this.far
|
|
11712
|
-
});
|
|
11713
|
-
}
|
|
11714
|
-
|
|
11715
|
-
equals(other) {
|
|
11716
|
-
return other && other instanceof PerspectiveOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && this.bottom === other.bottom && this.near === other.near && this.far === other.far;
|
|
11717
|
-
}
|
|
11718
|
-
|
|
11719
|
-
get projectionMatrix() {
|
|
11720
|
-
update(this);
|
|
11721
|
-
return this._perspectiveMatrix;
|
|
11722
|
-
}
|
|
11723
|
-
|
|
11724
|
-
get infiniteProjectionMatrix() {
|
|
11725
|
-
update(this);
|
|
11726
|
-
return this._infinitePerspective;
|
|
11727
|
-
}
|
|
11728
|
-
|
|
11729
|
-
computeCullingVolume(position, direction, up) {
|
|
11730
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(position, 'position is required.');
|
|
11731
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(direction, 'direction is required.');
|
|
11732
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(up, 'up is required.');
|
|
11733
|
-
const planes = this._cullingVolume.planes;
|
|
11734
|
-
up = scratchPlaneUpVector.copy(up).normalize();
|
|
11735
|
-
const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();
|
|
11736
|
-
const nearCenter = scratchPlaneNearCenter.copy(direction).multiplyByScalar(this.near).add(position);
|
|
11737
|
-
const farCenter = scratchPlaneFarCenter.copy(direction).multiplyByScalar(this.far).add(position);
|
|
11738
|
-
let normal = scratchPlaneNormal;
|
|
11739
|
-
normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);
|
|
11740
|
-
planes[0].fromPointNormal(position, normal);
|
|
11741
|
-
normal.copy(right).multiplyByScalar(this.right).add(nearCenter).subtract(position).cross(up).negate();
|
|
11742
|
-
planes[1].fromPointNormal(position, normal);
|
|
11743
|
-
normal.copy(up).multiplyByScalar(this.bottom).add(nearCenter).subtract(position).cross(right).negate();
|
|
11744
|
-
planes[2].fromPointNormal(position, normal);
|
|
11745
|
-
normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);
|
|
11746
|
-
planes[3].fromPointNormal(position, normal);
|
|
11747
|
-
normal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]().copy(direction);
|
|
11748
|
-
planes[4].fromPointNormal(nearCenter, normal);
|
|
11749
|
-
normal.negate();
|
|
11750
|
-
planes[5].fromPointNormal(farCenter, normal);
|
|
11751
|
-
return this._cullingVolume;
|
|
11752
|
-
}
|
|
11753
|
-
|
|
11754
|
-
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
|
|
11755
|
-
update(this);
|
|
11756
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));
|
|
11757
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(drawingBufferWidth > 0);
|
|
11758
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(drawingBufferHeight > 0);
|
|
11759
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(distance > 0);
|
|
11760
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(result);
|
|
11761
|
-
const inverseNear = 1.0 / this.near;
|
|
11762
|
-
let tanTheta = this.top * inverseNear;
|
|
11763
|
-
const pixelHeight = 2.0 * distance * tanTheta / drawingBufferHeight;
|
|
11764
|
-
tanTheta = this.right * inverseNear;
|
|
11765
|
-
const pixelWidth = 2.0 * distance * tanTheta / drawingBufferWidth;
|
|
11766
|
-
result.x = pixelWidth;
|
|
11767
|
-
result.y = pixelHeight;
|
|
11768
|
-
return result;
|
|
11769
|
-
}
|
|
11770
|
-
|
|
11771
|
-
}
|
|
11772
|
-
|
|
11773
|
-
function update(frustum) {
|
|
11774
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Number.isFinite(frustum.right) && Number.isFinite(frustum.left) && Number.isFinite(frustum.top) && Number.isFinite(frustum.bottom) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
|
|
11775
|
-
const {
|
|
11776
|
-
top,
|
|
11777
|
-
bottom,
|
|
11778
|
-
right,
|
|
11779
|
-
left,
|
|
11780
|
-
near,
|
|
11781
|
-
far
|
|
11782
|
-
} = frustum;
|
|
11783
|
-
|
|
11784
|
-
if (top !== frustum._top || bottom !== frustum._bottom || left !== frustum._left || right !== frustum._right || near !== frustum._near || far !== frustum._far) {
|
|
11785
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(frustum.near > 0 && frustum.near < frustum.far, 'near must be greater than zero and less than far.');
|
|
11786
|
-
frustum._left = left;
|
|
11787
|
-
frustum._right = right;
|
|
11788
|
-
frustum._top = top;
|
|
11789
|
-
frustum._bottom = bottom;
|
|
11790
|
-
frustum._near = near;
|
|
11791
|
-
frustum._far = far;
|
|
11792
|
-
frustum._perspectiveMatrix = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix4"]().frustum({
|
|
11793
|
-
left,
|
|
11794
|
-
right,
|
|
11795
|
-
bottom,
|
|
11796
|
-
top,
|
|
11797
|
-
near,
|
|
11798
|
-
far
|
|
11799
|
-
});
|
|
11800
|
-
frustum._infinitePerspective = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Matrix4"]().frustum({
|
|
11801
|
-
left,
|
|
11802
|
-
right,
|
|
11803
|
-
bottom,
|
|
11804
|
-
top,
|
|
11805
|
-
near,
|
|
11806
|
-
far: Infinity
|
|
11807
|
-
});
|
|
11808
|
-
}
|
|
11809
|
-
}
|
|
11810
|
-
//# sourceMappingURL=perspective-off-center-frustum.js.map
|
|
11811
|
-
|
|
11812
|
-
/***/ }),
|
|
11813
|
-
|
|
11814
|
-
/***/ "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js":
|
|
11815
|
-
/*!**************************************************************************************!*\
|
|
11816
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/culling/dist/esm/lib/plane.js ***!
|
|
11817
|
-
\**************************************************************************************/
|
|
11818
|
-
/*! exports provided: default */
|
|
11819
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11820
|
-
|
|
11821
|
-
"use strict";
|
|
11822
|
-
__webpack_require__.r(__webpack_exports__);
|
|
11823
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Plane; });
|
|
11824
|
-
/* harmony import */ var _math_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/core */ "../../node_modules/@math.gl/core/dist/esm/index.js");
|
|
11825
|
-
|
|
11826
|
-
const scratchPosition = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11827
|
-
const scratchNormal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11828
|
-
class Plane {
|
|
11829
|
-
constructor(normal = [0, 0, 1], distance = 0) {
|
|
11830
|
-
this.normal = new _math_gl_core__WEBPACK_IMPORTED_MODULE_0__["Vector3"]();
|
|
11831
|
-
this.distance = -0;
|
|
11832
|
-
this.fromNormalDistance(normal, distance);
|
|
11833
|
-
}
|
|
11834
|
-
|
|
11835
|
-
fromNormalDistance(normal, distance) {
|
|
11836
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Number.isFinite(distance));
|
|
11837
|
-
this.normal.from(normal).normalize();
|
|
11838
|
-
this.distance = distance;
|
|
11839
|
-
return this;
|
|
11840
|
-
}
|
|
11841
|
-
|
|
11842
|
-
fromPointNormal(point, normal) {
|
|
11843
|
-
point = scratchPosition.from(point);
|
|
11844
|
-
this.normal.from(normal).normalize();
|
|
11845
|
-
const distance = -this.normal.dot(point);
|
|
11846
|
-
this.distance = distance;
|
|
11847
|
-
return this;
|
|
11848
|
-
}
|
|
11849
|
-
|
|
11850
|
-
fromCoefficients(a, b, c, d) {
|
|
11851
|
-
this.normal.set(a, b, c);
|
|
11852
|
-
Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["assert"])(Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["equals"])(this.normal.len(), 1));
|
|
11853
|
-
this.distance = d;
|
|
11854
|
-
return this;
|
|
11855
|
-
}
|
|
11856
|
-
|
|
11857
|
-
clone(plane) {
|
|
11858
|
-
return new Plane(this.normal, this.distance);
|
|
11859
|
-
}
|
|
11860
|
-
|
|
11861
|
-
equals(right) {
|
|
11862
|
-
return Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["equals"])(this.distance, right.distance) && Object(_math_gl_core__WEBPACK_IMPORTED_MODULE_0__["equals"])(this.normal, right.normal);
|
|
11863
|
-
}
|
|
11864
|
-
|
|
11865
|
-
getPointDistance(point) {
|
|
11866
|
-
return this.normal.dot(point) + this.distance;
|
|
11867
|
-
}
|
|
11868
|
-
|
|
11869
|
-
transform(matrix4) {
|
|
11870
|
-
const normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();
|
|
11871
|
-
const point = this.normal.scale(-this.distance).transform(matrix4);
|
|
11872
|
-
return this.fromPointNormal(point, normal);
|
|
11873
|
-
}
|
|
11874
|
-
|
|
11875
|
-
projectPointOntoPlane(point, result = [0, 0, 0]) {
|
|
11876
|
-
point = scratchPosition.from(point);
|
|
11877
|
-
const pointDistance = this.getPointDistance(point);
|
|
11878
|
-
const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);
|
|
11879
|
-
return point.subtract(scaledNormal).to(result);
|
|
11880
|
-
}
|
|
11881
|
-
|
|
11882
|
-
}
|
|
11883
|
-
//# sourceMappingURL=plane.js.map
|
|
11884
|
-
|
|
11885
|
-
/***/ }),
|
|
11886
|
-
|
|
11887
10472
|
/***/ "../../node_modules/@math.gl/polygon/dist/esm/cut-by-grid.js":
|
|
11888
10473
|
/*!****************************************************************************************!*\
|
|
11889
10474
|
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/polygon/dist/esm/cut-by-grid.js ***!
|
|
@@ -13316,921 +11901,6 @@ function getPointAtIndex(positions, index, size, offset, out = []) {
|
|
|
13316
11901
|
|
|
13317
11902
|
/***/ }),
|
|
13318
11903
|
|
|
13319
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js":
|
|
13320
|
-
/*!****************************************************************************************!*\
|
|
13321
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/assert.js ***!
|
|
13322
|
-
\****************************************************************************************/
|
|
13323
|
-
/*! exports provided: default */
|
|
13324
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13325
|
-
|
|
13326
|
-
"use strict";
|
|
13327
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13328
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assert; });
|
|
13329
|
-
function assert(condition, message) {
|
|
13330
|
-
if (!condition) {
|
|
13331
|
-
throw new Error(message || '@math.gl/web-mercator: assertion failed.');
|
|
13332
|
-
}
|
|
13333
|
-
}
|
|
13334
|
-
//# sourceMappingURL=assert.js.map
|
|
13335
|
-
|
|
13336
|
-
/***/ }),
|
|
13337
|
-
|
|
13338
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js":
|
|
13339
|
-
/*!********************************************************************************************!*\
|
|
13340
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js ***!
|
|
13341
|
-
\********************************************************************************************/
|
|
13342
|
-
/*! exports provided: default */
|
|
13343
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13344
|
-
|
|
13345
|
-
"use strict";
|
|
13346
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13347
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return fitBounds; });
|
|
13348
|
-
/* harmony import */ var _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-viewport */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js");
|
|
13349
|
-
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assert */ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js");
|
|
13350
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
function fitBounds({
|
|
13355
|
-
width,
|
|
13356
|
-
height,
|
|
13357
|
-
bounds,
|
|
13358
|
-
minExtent = 0,
|
|
13359
|
-
maxZoom = 24,
|
|
13360
|
-
padding = 0,
|
|
13361
|
-
offset = [0, 0]
|
|
13362
|
-
}) {
|
|
13363
|
-
const [[west, south], [east, north]] = bounds;
|
|
13364
|
-
|
|
13365
|
-
if (Number.isFinite(padding)) {
|
|
13366
|
-
const p = padding;
|
|
13367
|
-
padding = {
|
|
13368
|
-
top: p,
|
|
13369
|
-
bottom: p,
|
|
13370
|
-
left: p,
|
|
13371
|
-
right: p
|
|
13372
|
-
};
|
|
13373
|
-
} else {
|
|
13374
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["default"])(Number.isFinite(padding.top) && Number.isFinite(padding.bottom) && Number.isFinite(padding.left) && Number.isFinite(padding.right));
|
|
13375
|
-
}
|
|
13376
|
-
|
|
13377
|
-
const viewport = new _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
|
13378
|
-
width,
|
|
13379
|
-
height,
|
|
13380
|
-
longitude: 0,
|
|
13381
|
-
latitude: 0,
|
|
13382
|
-
zoom: 0
|
|
13383
|
-
});
|
|
13384
|
-
const nw = viewport.project([west, north]);
|
|
13385
|
-
const se = viewport.project([east, south]);
|
|
13386
|
-
const size = [Math.max(Math.abs(se[0] - nw[0]), minExtent), Math.max(Math.abs(se[1] - nw[1]), minExtent)];
|
|
13387
|
-
const targetSize = [width - padding.left - padding.right - Math.abs(offset[0]) * 2, height - padding.top - padding.bottom - Math.abs(offset[1]) * 2];
|
|
13388
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["default"])(targetSize[0] > 0 && targetSize[1] > 0);
|
|
13389
|
-
const scaleX = targetSize[0] / size[0];
|
|
13390
|
-
const scaleY = targetSize[1] / size[1];
|
|
13391
|
-
const offsetX = (padding.right - padding.left) / 2 / scaleX;
|
|
13392
|
-
const offsetY = (padding.bottom - padding.top) / 2 / scaleY;
|
|
13393
|
-
const center = [(se[0] + nw[0]) / 2 + offsetX, (se[1] + nw[1]) / 2 + offsetY];
|
|
13394
|
-
const centerLngLat = viewport.unproject(center);
|
|
13395
|
-
const zoom = Math.min(maxZoom, viewport.zoom + Object(_math_utils__WEBPACK_IMPORTED_MODULE_2__["log2"])(Math.abs(Math.min(scaleX, scaleY))));
|
|
13396
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_1__["default"])(Number.isFinite(zoom));
|
|
13397
|
-
return {
|
|
13398
|
-
longitude: centerLngLat[0],
|
|
13399
|
-
latitude: centerLngLat[1],
|
|
13400
|
-
zoom
|
|
13401
|
-
};
|
|
13402
|
-
}
|
|
13403
|
-
//# sourceMappingURL=fit-bounds.js.map
|
|
13404
|
-
|
|
13405
|
-
/***/ }),
|
|
13406
|
-
|
|
13407
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js":
|
|
13408
|
-
/*!*************************************************************************************************!*\
|
|
13409
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js ***!
|
|
13410
|
-
\*************************************************************************************************/
|
|
13411
|
-
/*! exports provided: default, getFlyToDuration */
|
|
13412
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13413
|
-
|
|
13414
|
-
"use strict";
|
|
13415
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13416
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return flyToViewport; });
|
|
13417
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFlyToDuration", function() { return getFlyToDuration; });
|
|
13418
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13419
|
-
/* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
|
|
13420
|
-
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
const EPSILON = 0.01;
|
|
13425
|
-
const VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom'];
|
|
13426
|
-
const DEFAULT_OPTS = {
|
|
13427
|
-
curve: 1.414,
|
|
13428
|
-
speed: 1.2
|
|
13429
|
-
};
|
|
13430
|
-
function flyToViewport(startProps, endProps, t, opts = {}) {
|
|
13431
|
-
const viewport = {};
|
|
13432
|
-
const {
|
|
13433
|
-
startZoom,
|
|
13434
|
-
startCenterXY,
|
|
13435
|
-
uDelta,
|
|
13436
|
-
w0,
|
|
13437
|
-
u1,
|
|
13438
|
-
S,
|
|
13439
|
-
rho,
|
|
13440
|
-
rho2,
|
|
13441
|
-
r0
|
|
13442
|
-
} = getFlyToTransitionParams(startProps, endProps, opts);
|
|
13443
|
-
|
|
13444
|
-
if (u1 < EPSILON) {
|
|
13445
|
-
for (const key of VIEWPORT_TRANSITION_PROPS) {
|
|
13446
|
-
const startValue = startProps[key];
|
|
13447
|
-
const endValue = endProps[key];
|
|
13448
|
-
viewport[key] = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["lerp"])(startValue, endValue, t);
|
|
13449
|
-
}
|
|
13450
|
-
|
|
13451
|
-
return viewport;
|
|
13452
|
-
}
|
|
13453
|
-
|
|
13454
|
-
const s = t * S;
|
|
13455
|
-
const w = Math.cosh(r0) / Math.cosh(r0 + rho * s);
|
|
13456
|
-
const u = w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2) / u1;
|
|
13457
|
-
const scaleIncrement = 1 / w;
|
|
13458
|
-
const newZoom = startZoom + Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["scaleToZoom"])(scaleIncrement);
|
|
13459
|
-
const newCenterWorld = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["scale"]([], uDelta, u);
|
|
13460
|
-
gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["add"](newCenterWorld, newCenterWorld, startCenterXY);
|
|
13461
|
-
const newCenter = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToLngLat"])(newCenterWorld);
|
|
13462
|
-
viewport.longitude = newCenter[0];
|
|
13463
|
-
viewport.latitude = newCenter[1];
|
|
13464
|
-
viewport.zoom = newZoom;
|
|
13465
|
-
return viewport;
|
|
13466
|
-
}
|
|
13467
|
-
function getFlyToDuration(startProps, endProps, opts = {}) {
|
|
13468
|
-
opts = Object.assign({}, DEFAULT_OPTS, opts);
|
|
13469
|
-
const {
|
|
13470
|
-
screenSpeed,
|
|
13471
|
-
speed,
|
|
13472
|
-
maxDuration
|
|
13473
|
-
} = opts;
|
|
13474
|
-
const {
|
|
13475
|
-
S,
|
|
13476
|
-
rho
|
|
13477
|
-
} = getFlyToTransitionParams(startProps, endProps, opts);
|
|
13478
|
-
const length = 1000 * S;
|
|
13479
|
-
let duration;
|
|
13480
|
-
|
|
13481
|
-
if (Number.isFinite(screenSpeed)) {
|
|
13482
|
-
duration = length / (screenSpeed / rho);
|
|
13483
|
-
} else {
|
|
13484
|
-
duration = length / speed;
|
|
13485
|
-
}
|
|
13486
|
-
|
|
13487
|
-
return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
|
|
13488
|
-
}
|
|
13489
|
-
|
|
13490
|
-
function getFlyToTransitionParams(startProps, endProps, opts) {
|
|
13491
|
-
opts = Object.assign({}, DEFAULT_OPTS, opts);
|
|
13492
|
-
const rho = opts.curve;
|
|
13493
|
-
const startZoom = startProps.zoom;
|
|
13494
|
-
const startCenter = [startProps.longitude, startProps.latitude];
|
|
13495
|
-
const startScale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["zoomToScale"])(startZoom);
|
|
13496
|
-
const endZoom = endProps.zoom;
|
|
13497
|
-
const endCenter = [endProps.longitude, endProps.latitude];
|
|
13498
|
-
const scale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["zoomToScale"])(endZoom - startZoom);
|
|
13499
|
-
const startCenterXY = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(startCenter);
|
|
13500
|
-
const endCenterXY = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(endCenter);
|
|
13501
|
-
const uDelta = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["sub"]([], endCenterXY, startCenterXY);
|
|
13502
|
-
const w0 = Math.max(startProps.width, startProps.height);
|
|
13503
|
-
const w1 = w0 / scale;
|
|
13504
|
-
const u1 = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["length"](uDelta) * startScale;
|
|
13505
|
-
|
|
13506
|
-
const _u1 = Math.max(u1, EPSILON);
|
|
13507
|
-
|
|
13508
|
-
const rho2 = rho * rho;
|
|
13509
|
-
const b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * _u1 * _u1) / (2 * w0 * rho2 * _u1);
|
|
13510
|
-
const b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * _u1 * _u1) / (2 * w1 * rho2 * _u1);
|
|
13511
|
-
const r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
|
|
13512
|
-
const r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
13513
|
-
const S = (r1 - r0) / rho;
|
|
13514
|
-
return {
|
|
13515
|
-
startZoom,
|
|
13516
|
-
startCenterXY,
|
|
13517
|
-
uDelta,
|
|
13518
|
-
w0,
|
|
13519
|
-
u1,
|
|
13520
|
-
S,
|
|
13521
|
-
rho,
|
|
13522
|
-
rho2,
|
|
13523
|
-
r0,
|
|
13524
|
-
r1
|
|
13525
|
-
};
|
|
13526
|
-
}
|
|
13527
|
-
//# sourceMappingURL=fly-to-viewport.js.map
|
|
13528
|
-
|
|
13529
|
-
/***/ }),
|
|
13530
|
-
|
|
13531
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js":
|
|
13532
|
-
/*!********************************************************************************************!*\
|
|
13533
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js ***!
|
|
13534
|
-
\********************************************************************************************/
|
|
13535
|
-
/*! exports provided: default */
|
|
13536
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13537
|
-
|
|
13538
|
-
"use strict";
|
|
13539
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13540
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getBounds; });
|
|
13541
|
-
/* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
|
|
13542
|
-
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
|
|
13543
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
const DEGREES_TO_RADIANS = Math.PI / 180;
|
|
13548
|
-
function getBounds(viewport, z = 0) {
|
|
13549
|
-
const {
|
|
13550
|
-
width,
|
|
13551
|
-
height,
|
|
13552
|
-
unproject
|
|
13553
|
-
} = viewport;
|
|
13554
|
-
const unprojectOps = {
|
|
13555
|
-
targetZ: z
|
|
13556
|
-
};
|
|
13557
|
-
const bottomLeft = unproject([0, height], unprojectOps);
|
|
13558
|
-
const bottomRight = unproject([width, height], unprojectOps);
|
|
13559
|
-
let topLeft;
|
|
13560
|
-
let topRight;
|
|
13561
|
-
const halfFov = viewport.fovy ? 0.5 * viewport.fovy * DEGREES_TO_RADIANS : Math.atan(0.5 / viewport.altitude);
|
|
13562
|
-
const angleToGround = (90 - viewport.pitch) * DEGREES_TO_RADIANS;
|
|
13563
|
-
|
|
13564
|
-
if (halfFov > angleToGround - 0.01) {
|
|
13565
|
-
topLeft = unprojectOnFarPlane(viewport, 0, z);
|
|
13566
|
-
topRight = unprojectOnFarPlane(viewport, width, z);
|
|
13567
|
-
} else {
|
|
13568
|
-
topLeft = unproject([0, 0], unprojectOps);
|
|
13569
|
-
topRight = unproject([width, 0], unprojectOps);
|
|
13570
|
-
}
|
|
13571
|
-
|
|
13572
|
-
return [bottomLeft, bottomRight, topRight, topLeft];
|
|
13573
|
-
}
|
|
13574
|
-
|
|
13575
|
-
function unprojectOnFarPlane(viewport, x, targetZ) {
|
|
13576
|
-
const {
|
|
13577
|
-
pixelUnprojectionMatrix
|
|
13578
|
-
} = viewport;
|
|
13579
|
-
const coord0 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_2__["transformVector"])(pixelUnprojectionMatrix, [x, 0, 1, 1]);
|
|
13580
|
-
const coord1 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_2__["transformVector"])(pixelUnprojectionMatrix, [x, viewport.height, 1, 1]);
|
|
13581
|
-
const z = targetZ * viewport.distanceScales.unitsPerMeter[2];
|
|
13582
|
-
const t = (z - coord0[2]) / (coord1[2] - coord0[2]);
|
|
13583
|
-
const coord = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_1__["lerp"]([], coord0, coord1, t);
|
|
13584
|
-
const result = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])(coord);
|
|
13585
|
-
result[2] = targetZ;
|
|
13586
|
-
return result;
|
|
13587
|
-
}
|
|
13588
|
-
//# sourceMappingURL=get-bounds.js.map
|
|
13589
|
-
|
|
13590
|
-
/***/ }),
|
|
13591
|
-
|
|
13592
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/index.js":
|
|
13593
|
-
/*!***************************************************************************************!*\
|
|
13594
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/index.js ***!
|
|
13595
|
-
\***************************************************************************************/
|
|
13596
|
-
/*! exports provided: default, WebMercatorViewport, getBounds, fitBounds, normalizeViewportProps, flyToViewport, getFlyToDuration, lngLatToWorld, worldToLngLat, worldToPixels, pixelsToWorld, zoomToScale, scaleToZoom, altitudeToFovy, fovyToAltitude, getMeterZoom, getDistanceScales, addMetersToLngLat, getViewMatrix, getProjectionMatrix, getProjectionParameters */
|
|
13597
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13598
|
-
|
|
13599
|
-
"use strict";
|
|
13600
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13601
|
-
/* harmony import */ var _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-viewport */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js");
|
|
13602
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
|
13603
|
-
|
|
13604
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebMercatorViewport", function() { return _web_mercator_viewport__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
|
13605
|
-
|
|
13606
|
-
/* harmony import */ var _get_bounds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./get-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js");
|
|
13607
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBounds", function() { return _get_bounds__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
|
13608
|
-
|
|
13609
|
-
/* harmony import */ var _fit_bounds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fit-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js");
|
|
13610
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fitBounds", function() { return _fit_bounds__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
|
13611
|
-
|
|
13612
|
-
/* harmony import */ var _normalize_viewport_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./normalize-viewport-props */ "../../node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js");
|
|
13613
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "normalizeViewportProps", function() { return _normalize_viewport_props__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
|
13614
|
-
|
|
13615
|
-
/* harmony import */ var _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fly-to-viewport */ "../../node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js");
|
|
13616
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flyToViewport", function() { return _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
13617
|
-
|
|
13618
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFlyToDuration", function() { return _fly_to_viewport__WEBPACK_IMPORTED_MODULE_4__["getFlyToDuration"]; });
|
|
13619
|
-
|
|
13620
|
-
/* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
|
|
13621
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lngLatToWorld", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["lngLatToWorld"]; });
|
|
13622
|
-
|
|
13623
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "worldToLngLat", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["worldToLngLat"]; });
|
|
13624
|
-
|
|
13625
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "worldToPixels", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["worldToPixels"]; });
|
|
13626
|
-
|
|
13627
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pixelsToWorld", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["pixelsToWorld"]; });
|
|
13628
|
-
|
|
13629
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zoomToScale", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["zoomToScale"]; });
|
|
13630
|
-
|
|
13631
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scaleToZoom", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["scaleToZoom"]; });
|
|
13632
|
-
|
|
13633
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "altitudeToFovy", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["altitudeToFovy"]; });
|
|
13634
|
-
|
|
13635
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fovyToAltitude", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["fovyToAltitude"]; });
|
|
13636
|
-
|
|
13637
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMeterZoom", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getMeterZoom"]; });
|
|
13638
|
-
|
|
13639
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDistanceScales", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getDistanceScales"]; });
|
|
13640
|
-
|
|
13641
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addMetersToLngLat", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["addMetersToLngLat"]; });
|
|
13642
|
-
|
|
13643
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getViewMatrix", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getViewMatrix"]; });
|
|
13644
|
-
|
|
13645
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectionMatrix", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getProjectionMatrix"]; });
|
|
13646
|
-
|
|
13647
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getProjectionParameters", function() { return _web_mercator_utils__WEBPACK_IMPORTED_MODULE_5__["getProjectionParameters"]; });
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
//# sourceMappingURL=index.js.map
|
|
13657
|
-
|
|
13658
|
-
/***/ }),
|
|
13659
|
-
|
|
13660
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js":
|
|
13661
|
-
/*!********************************************************************************************!*\
|
|
13662
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/math-utils.js ***!
|
|
13663
|
-
\********************************************************************************************/
|
|
13664
|
-
/*! exports provided: createMat4, transformVector, mod, lerp, log2 */
|
|
13665
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13666
|
-
|
|
13667
|
-
"use strict";
|
|
13668
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13669
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMat4", function() { return createMat4; });
|
|
13670
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformVector", function() { return transformVector; });
|
|
13671
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mod", function() { return mod; });
|
|
13672
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; });
|
|
13673
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log2", function() { return log2; });
|
|
13674
|
-
/* harmony import */ var gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! gl-matrix/vec4 */ "../../node_modules/gl-matrix/esm/vec4.js");
|
|
13675
|
-
|
|
13676
|
-
function createMat4() {
|
|
13677
|
-
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
13678
|
-
}
|
|
13679
|
-
function transformVector(matrix, vector) {
|
|
13680
|
-
const result = gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__["transformMat4"]([], vector, matrix);
|
|
13681
|
-
gl_matrix_vec4__WEBPACK_IMPORTED_MODULE_0__["scale"](result, result, 1 / result[3]);
|
|
13682
|
-
return result;
|
|
13683
|
-
}
|
|
13684
|
-
function mod(value, divisor) {
|
|
13685
|
-
const modulus = value % divisor;
|
|
13686
|
-
return modulus < 0 ? divisor + modulus : modulus;
|
|
13687
|
-
}
|
|
13688
|
-
function lerp(start, end, step) {
|
|
13689
|
-
return step * end + (1 - step) * start;
|
|
13690
|
-
}
|
|
13691
|
-
|
|
13692
|
-
function ieLog2(x) {
|
|
13693
|
-
return Math.log(x) * Math.LOG2E;
|
|
13694
|
-
}
|
|
13695
|
-
|
|
13696
|
-
const log2 = Math.log2 || ieLog2;
|
|
13697
|
-
//# sourceMappingURL=math-utils.js.map
|
|
13698
|
-
|
|
13699
|
-
/***/ }),
|
|
13700
|
-
|
|
13701
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js":
|
|
13702
|
-
/*!**********************************************************************************************************!*\
|
|
13703
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/normalize-viewport-props.js ***!
|
|
13704
|
-
\**********************************************************************************************************/
|
|
13705
|
-
/*! exports provided: default */
|
|
13706
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13707
|
-
|
|
13708
|
-
"use strict";
|
|
13709
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13710
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeViewportProps; });
|
|
13711
|
-
/* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
|
|
13712
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
const TILE_SIZE = 512;
|
|
13716
|
-
function normalizeViewportProps({
|
|
13717
|
-
width,
|
|
13718
|
-
height,
|
|
13719
|
-
longitude,
|
|
13720
|
-
latitude,
|
|
13721
|
-
zoom,
|
|
13722
|
-
pitch = 0,
|
|
13723
|
-
bearing = 0
|
|
13724
|
-
}) {
|
|
13725
|
-
if (longitude < -180 || longitude > 180) {
|
|
13726
|
-
longitude = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["mod"])(longitude + 180, 360) - 180;
|
|
13727
|
-
}
|
|
13728
|
-
|
|
13729
|
-
if (bearing < -180 || bearing > 180) {
|
|
13730
|
-
bearing = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["mod"])(bearing + 180, 360) - 180;
|
|
13731
|
-
}
|
|
13732
|
-
|
|
13733
|
-
const minZoom = Object(_math_utils__WEBPACK_IMPORTED_MODULE_1__["log2"])(height / TILE_SIZE);
|
|
13734
|
-
|
|
13735
|
-
if (zoom <= minZoom) {
|
|
13736
|
-
zoom = minZoom;
|
|
13737
|
-
latitude = 0;
|
|
13738
|
-
} else {
|
|
13739
|
-
const halfHeightPixels = height / 2 / Math.pow(2, zoom);
|
|
13740
|
-
const minLatitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])([0, halfHeightPixels])[1];
|
|
13741
|
-
|
|
13742
|
-
if (latitude < minLatitude) {
|
|
13743
|
-
latitude = minLatitude;
|
|
13744
|
-
} else {
|
|
13745
|
-
const maxLatitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_0__["worldToLngLat"])([0, TILE_SIZE - halfHeightPixels])[1];
|
|
13746
|
-
|
|
13747
|
-
if (latitude > maxLatitude) {
|
|
13748
|
-
latitude = maxLatitude;
|
|
13749
|
-
}
|
|
13750
|
-
}
|
|
13751
|
-
}
|
|
13752
|
-
|
|
13753
|
-
return {
|
|
13754
|
-
width,
|
|
13755
|
-
height,
|
|
13756
|
-
longitude,
|
|
13757
|
-
latitude,
|
|
13758
|
-
zoom,
|
|
13759
|
-
pitch,
|
|
13760
|
-
bearing
|
|
13761
|
-
};
|
|
13762
|
-
}
|
|
13763
|
-
//# sourceMappingURL=normalize-viewport-props.js.map
|
|
13764
|
-
|
|
13765
|
-
/***/ }),
|
|
13766
|
-
|
|
13767
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js":
|
|
13768
|
-
/*!****************************************************************************************************!*\
|
|
13769
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js ***!
|
|
13770
|
-
\****************************************************************************************************/
|
|
13771
|
-
/*! exports provided: DEFAULT_ALTITUDE, zoomToScale, scaleToZoom, lngLatToWorld, worldToLngLat, getMeterZoom, getDistanceScales, addMetersToLngLat, getViewMatrix, getProjectionParameters, getProjectionMatrix, altitudeToFovy, fovyToAltitude, worldToPixels, pixelsToWorld */
|
|
13772
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13773
|
-
|
|
13774
|
-
"use strict";
|
|
13775
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13776
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_ALTITUDE", function() { return DEFAULT_ALTITUDE; });
|
|
13777
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zoomToScale", function() { return zoomToScale; });
|
|
13778
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleToZoom", function() { return scaleToZoom; });
|
|
13779
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lngLatToWorld", function() { return lngLatToWorld; });
|
|
13780
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "worldToLngLat", function() { return worldToLngLat; });
|
|
13781
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMeterZoom", function() { return getMeterZoom; });
|
|
13782
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDistanceScales", function() { return getDistanceScales; });
|
|
13783
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMetersToLngLat", function() { return addMetersToLngLat; });
|
|
13784
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getViewMatrix", function() { return getViewMatrix; });
|
|
13785
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProjectionParameters", function() { return getProjectionParameters; });
|
|
13786
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProjectionMatrix", function() { return getProjectionMatrix; });
|
|
13787
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "altitudeToFovy", function() { return altitudeToFovy; });
|
|
13788
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fovyToAltitude", function() { return fovyToAltitude; });
|
|
13789
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "worldToPixels", function() { return worldToPixels; });
|
|
13790
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pixelsToWorld", function() { return pixelsToWorld; });
|
|
13791
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13792
|
-
/* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
|
|
13793
|
-
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
|
|
13794
|
-
/* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
|
|
13795
|
-
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./assert */ "../../node_modules/@math.gl/web-mercator/dist/esm/assert.js");
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
const PI = Math.PI;
|
|
13802
|
-
const PI_4 = PI / 4;
|
|
13803
|
-
const DEGREES_TO_RADIANS = PI / 180;
|
|
13804
|
-
const RADIANS_TO_DEGREES = 180 / PI;
|
|
13805
|
-
const TILE_SIZE = 512;
|
|
13806
|
-
const EARTH_CIRCUMFERENCE = 40.03e6;
|
|
13807
|
-
const DEFAULT_ALTITUDE = 1.5;
|
|
13808
|
-
function zoomToScale(zoom) {
|
|
13809
|
-
return Math.pow(2, zoom);
|
|
13810
|
-
}
|
|
13811
|
-
function scaleToZoom(scale) {
|
|
13812
|
-
return Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["log2"])(scale);
|
|
13813
|
-
}
|
|
13814
|
-
function lngLatToWorld([lng, lat]) {
|
|
13815
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(lng));
|
|
13816
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(lat) && lat >= -90 && lat <= 90, 'invalid latitude');
|
|
13817
|
-
const lambda2 = lng * DEGREES_TO_RADIANS;
|
|
13818
|
-
const phi2 = lat * DEGREES_TO_RADIANS;
|
|
13819
|
-
const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
|
|
13820
|
-
const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
|
|
13821
|
-
return [x, y];
|
|
13822
|
-
}
|
|
13823
|
-
function worldToLngLat([x, y]) {
|
|
13824
|
-
const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
|
|
13825
|
-
const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
|
|
13826
|
-
return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
|
|
13827
|
-
}
|
|
13828
|
-
function getMeterZoom({
|
|
13829
|
-
latitude
|
|
13830
|
-
}) {
|
|
13831
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(latitude));
|
|
13832
|
-
const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
|
|
13833
|
-
return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;
|
|
13834
|
-
}
|
|
13835
|
-
function getDistanceScales({
|
|
13836
|
-
latitude,
|
|
13837
|
-
longitude,
|
|
13838
|
-
highPrecision = false
|
|
13839
|
-
}) {
|
|
13840
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(latitude) && Number.isFinite(longitude));
|
|
13841
|
-
const result = {};
|
|
13842
|
-
const worldSize = TILE_SIZE;
|
|
13843
|
-
const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
|
|
13844
|
-
const unitsPerDegreeX = worldSize / 360;
|
|
13845
|
-
const unitsPerDegreeY = unitsPerDegreeX / latCosine;
|
|
13846
|
-
const altUnitsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine;
|
|
13847
|
-
result.unitsPerMeter = [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter];
|
|
13848
|
-
result.metersPerUnit = [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter];
|
|
13849
|
-
result.unitsPerDegree = [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter];
|
|
13850
|
-
result.degreesPerUnit = [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter];
|
|
13851
|
-
|
|
13852
|
-
if (highPrecision) {
|
|
13853
|
-
const latCosine2 = DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS) / latCosine;
|
|
13854
|
-
const unitsPerDegreeY2 = unitsPerDegreeX * latCosine2 / 2;
|
|
13855
|
-
const altUnitsPerDegree2 = worldSize / EARTH_CIRCUMFERENCE * latCosine2;
|
|
13856
|
-
const altUnitsPerMeter2 = altUnitsPerDegree2 / unitsPerDegreeY * altUnitsPerMeter;
|
|
13857
|
-
result.unitsPerDegree2 = [0, unitsPerDegreeY2, altUnitsPerDegree2];
|
|
13858
|
-
result.unitsPerMeter2 = [altUnitsPerMeter2, 0, altUnitsPerMeter2];
|
|
13859
|
-
}
|
|
13860
|
-
|
|
13861
|
-
return result;
|
|
13862
|
-
}
|
|
13863
|
-
function addMetersToLngLat(lngLatZ, xyz) {
|
|
13864
|
-
const [longitude, latitude, z0] = lngLatZ;
|
|
13865
|
-
const [x, y, z] = xyz;
|
|
13866
|
-
const {
|
|
13867
|
-
unitsPerMeter,
|
|
13868
|
-
unitsPerMeter2
|
|
13869
|
-
} = getDistanceScales({
|
|
13870
|
-
longitude,
|
|
13871
|
-
latitude,
|
|
13872
|
-
highPrecision: true
|
|
13873
|
-
});
|
|
13874
|
-
const worldspace = lngLatToWorld(lngLatZ);
|
|
13875
|
-
worldspace[0] += x * (unitsPerMeter[0] + unitsPerMeter2[0] * y);
|
|
13876
|
-
worldspace[1] += y * (unitsPerMeter[1] + unitsPerMeter2[1] * y);
|
|
13877
|
-
const newLngLat = worldToLngLat(worldspace);
|
|
13878
|
-
const newZ = (z0 || 0) + (z || 0);
|
|
13879
|
-
return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;
|
|
13880
|
-
}
|
|
13881
|
-
function getViewMatrix({
|
|
13882
|
-
height,
|
|
13883
|
-
pitch,
|
|
13884
|
-
bearing,
|
|
13885
|
-
altitude,
|
|
13886
|
-
scale,
|
|
13887
|
-
center = null
|
|
13888
|
-
}) {
|
|
13889
|
-
const vm = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["createMat4"])();
|
|
13890
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["translate"](vm, vm, [0, 0, -altitude]);
|
|
13891
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["rotateX"](vm, vm, -pitch * DEGREES_TO_RADIANS);
|
|
13892
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["rotateZ"](vm, vm, bearing * DEGREES_TO_RADIANS);
|
|
13893
|
-
scale /= height;
|
|
13894
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["scale"](vm, vm, [scale, scale, scale]);
|
|
13895
|
-
|
|
13896
|
-
if (center) {
|
|
13897
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["translate"](vm, vm, gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_3__["negate"]([], center));
|
|
13898
|
-
}
|
|
13899
|
-
|
|
13900
|
-
return vm;
|
|
13901
|
-
}
|
|
13902
|
-
function getProjectionParameters({
|
|
13903
|
-
width,
|
|
13904
|
-
height,
|
|
13905
|
-
fovy = altitudeToFovy(DEFAULT_ALTITUDE),
|
|
13906
|
-
altitude,
|
|
13907
|
-
pitch = 0,
|
|
13908
|
-
nearZMultiplier = 1,
|
|
13909
|
-
farZMultiplier = 1
|
|
13910
|
-
}) {
|
|
13911
|
-
if (altitude !== undefined) {
|
|
13912
|
-
fovy = altitudeToFovy(altitude);
|
|
13913
|
-
}
|
|
13914
|
-
|
|
13915
|
-
const halfFov = 0.5 * fovy * DEGREES_TO_RADIANS;
|
|
13916
|
-
const focalDistance = fovyToAltitude(fovy);
|
|
13917
|
-
const pitchRadians = pitch * DEGREES_TO_RADIANS;
|
|
13918
|
-
const topHalfSurfaceDistance = Math.sin(halfFov) * focalDistance / Math.sin(Math.min(Math.max(Math.PI / 2 - pitchRadians - halfFov, 0.01), Math.PI - 0.01));
|
|
13919
|
-
const farZ = Math.sin(pitchRadians) * topHalfSurfaceDistance + focalDistance;
|
|
13920
|
-
return {
|
|
13921
|
-
fov: 2 * halfFov,
|
|
13922
|
-
aspect: width / height,
|
|
13923
|
-
focalDistance,
|
|
13924
|
-
near: nearZMultiplier,
|
|
13925
|
-
far: farZ * farZMultiplier
|
|
13926
|
-
};
|
|
13927
|
-
}
|
|
13928
|
-
function getProjectionMatrix({
|
|
13929
|
-
width,
|
|
13930
|
-
height,
|
|
13931
|
-
pitch,
|
|
13932
|
-
altitude,
|
|
13933
|
-
fovy,
|
|
13934
|
-
nearZMultiplier,
|
|
13935
|
-
farZMultiplier
|
|
13936
|
-
}) {
|
|
13937
|
-
const {
|
|
13938
|
-
fov,
|
|
13939
|
-
aspect,
|
|
13940
|
-
near,
|
|
13941
|
-
far
|
|
13942
|
-
} = getProjectionParameters({
|
|
13943
|
-
width,
|
|
13944
|
-
height,
|
|
13945
|
-
altitude,
|
|
13946
|
-
fovy,
|
|
13947
|
-
pitch,
|
|
13948
|
-
nearZMultiplier,
|
|
13949
|
-
farZMultiplier
|
|
13950
|
-
});
|
|
13951
|
-
const projectionMatrix = gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_1__["perspective"]([], fov, aspect, near, far);
|
|
13952
|
-
return projectionMatrix;
|
|
13953
|
-
}
|
|
13954
|
-
function altitudeToFovy(altitude) {
|
|
13955
|
-
return 2 * Math.atan(0.5 / altitude) * RADIANS_TO_DEGREES;
|
|
13956
|
-
}
|
|
13957
|
-
function fovyToAltitude(fovy) {
|
|
13958
|
-
return 0.5 / Math.tan(0.5 * fovy * DEGREES_TO_RADIANS);
|
|
13959
|
-
}
|
|
13960
|
-
function worldToPixels(xyz, pixelProjectionMatrix) {
|
|
13961
|
-
const [x, y, z = 0] = xyz;
|
|
13962
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));
|
|
13963
|
-
return Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelProjectionMatrix, [x, y, z, 1]);
|
|
13964
|
-
}
|
|
13965
|
-
function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {
|
|
13966
|
-
const [x, y, z] = xyz;
|
|
13967
|
-
Object(_assert__WEBPACK_IMPORTED_MODULE_4__["default"])(Number.isFinite(x) && Number.isFinite(y), 'invalid pixel coordinate');
|
|
13968
|
-
|
|
13969
|
-
if (Number.isFinite(z)) {
|
|
13970
|
-
const coord = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, z, 1]);
|
|
13971
|
-
return coord;
|
|
13972
|
-
}
|
|
13973
|
-
|
|
13974
|
-
const coord0 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, 0, 1]);
|
|
13975
|
-
const coord1 = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["transformVector"])(pixelUnprojectionMatrix, [x, y, 1, 1]);
|
|
13976
|
-
const z0 = coord0[2];
|
|
13977
|
-
const z1 = coord1[2];
|
|
13978
|
-
const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);
|
|
13979
|
-
return gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_2__["lerp"]([], coord0, coord1, t);
|
|
13980
|
-
}
|
|
13981
|
-
//# sourceMappingURL=web-mercator-utils.js.map
|
|
13982
|
-
|
|
13983
|
-
/***/ }),
|
|
13984
|
-
|
|
13985
|
-
/***/ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js":
|
|
13986
|
-
/*!*******************************************************************************************************!*\
|
|
13987
|
-
!*** /Users/alasarr/dev/deck.gl/node_modules/@math.gl/web-mercator/dist/esm/web-mercator-viewport.js ***!
|
|
13988
|
-
\*******************************************************************************************************/
|
|
13989
|
-
/*! exports provided: default */
|
|
13990
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13991
|
-
|
|
13992
|
-
"use strict";
|
|
13993
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13994
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return WebMercatorViewport; });
|
|
13995
|
-
/* harmony import */ var _math_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/math-utils.js");
|
|
13996
|
-
/* harmony import */ var _web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./web-mercator-utils */ "../../node_modules/@math.gl/web-mercator/dist/esm/web-mercator-utils.js");
|
|
13997
|
-
/* harmony import */ var _fit_bounds__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fit-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/fit-bounds.js");
|
|
13998
|
-
/* harmony import */ var _get_bounds__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get-bounds */ "../../node_modules/@math.gl/web-mercator/dist/esm/get-bounds.js");
|
|
13999
|
-
/* harmony import */ var gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! gl-matrix/mat4 */ "../../node_modules/gl-matrix/esm/mat4.js");
|
|
14000
|
-
/* harmony import */ var gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! gl-matrix/vec2 */ "../../node_modules/gl-matrix/esm/vec2.js");
|
|
14001
|
-
/* harmony import */ var gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! gl-matrix/vec3 */ "../../node_modules/gl-matrix/esm/vec3.js");
|
|
14002
|
-
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
class WebMercatorViewport {
|
|
14010
|
-
constructor({
|
|
14011
|
-
width,
|
|
14012
|
-
height,
|
|
14013
|
-
latitude = 0,
|
|
14014
|
-
longitude = 0,
|
|
14015
|
-
zoom = 0,
|
|
14016
|
-
pitch = 0,
|
|
14017
|
-
bearing = 0,
|
|
14018
|
-
altitude = null,
|
|
14019
|
-
fovy = null,
|
|
14020
|
-
position = null,
|
|
14021
|
-
nearZMultiplier = 0.02,
|
|
14022
|
-
farZMultiplier = 1.01
|
|
14023
|
-
} = {
|
|
14024
|
-
width: 1,
|
|
14025
|
-
height: 1
|
|
14026
|
-
}) {
|
|
14027
|
-
width = width || 1;
|
|
14028
|
-
height = height || 1;
|
|
14029
|
-
|
|
14030
|
-
if (fovy === null && altitude === null) {
|
|
14031
|
-
altitude = _web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["DEFAULT_ALTITUDE"];
|
|
14032
|
-
fovy = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["altitudeToFovy"])(altitude);
|
|
14033
|
-
} else if (fovy === null) {
|
|
14034
|
-
fovy = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["altitudeToFovy"])(altitude);
|
|
14035
|
-
} else if (altitude === null) {
|
|
14036
|
-
altitude = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["fovyToAltitude"])(fovy);
|
|
14037
|
-
}
|
|
14038
|
-
|
|
14039
|
-
const scale = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["zoomToScale"])(zoom);
|
|
14040
|
-
altitude = Math.max(0.75, altitude);
|
|
14041
|
-
const distanceScales = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["getDistanceScales"])({
|
|
14042
|
-
longitude,
|
|
14043
|
-
latitude
|
|
14044
|
-
});
|
|
14045
|
-
const center = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])([longitude, latitude]);
|
|
14046
|
-
center[2] = 0;
|
|
14047
|
-
|
|
14048
|
-
if (position) {
|
|
14049
|
-
gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_6__["add"](center, center, gl_matrix_vec3__WEBPACK_IMPORTED_MODULE_6__["mul"]([], position, distanceScales.unitsPerMeter));
|
|
14050
|
-
}
|
|
14051
|
-
|
|
14052
|
-
this.projectionMatrix = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["getProjectionMatrix"])({
|
|
14053
|
-
width,
|
|
14054
|
-
height,
|
|
14055
|
-
pitch,
|
|
14056
|
-
fovy,
|
|
14057
|
-
nearZMultiplier,
|
|
14058
|
-
farZMultiplier
|
|
14059
|
-
});
|
|
14060
|
-
this.viewMatrix = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["getViewMatrix"])({
|
|
14061
|
-
height,
|
|
14062
|
-
scale,
|
|
14063
|
-
center,
|
|
14064
|
-
pitch,
|
|
14065
|
-
bearing,
|
|
14066
|
-
altitude
|
|
14067
|
-
});
|
|
14068
|
-
this.width = width;
|
|
14069
|
-
this.height = height;
|
|
14070
|
-
this.scale = scale;
|
|
14071
|
-
this.latitude = latitude;
|
|
14072
|
-
this.longitude = longitude;
|
|
14073
|
-
this.zoom = zoom;
|
|
14074
|
-
this.pitch = pitch;
|
|
14075
|
-
this.bearing = bearing;
|
|
14076
|
-
this.altitude = altitude;
|
|
14077
|
-
this.fovy = fovy;
|
|
14078
|
-
this.center = center;
|
|
14079
|
-
this.meterOffset = position || [0, 0, 0];
|
|
14080
|
-
this.distanceScales = distanceScales;
|
|
14081
|
-
|
|
14082
|
-
this._initMatrices();
|
|
14083
|
-
|
|
14084
|
-
this.equals = this.equals.bind(this);
|
|
14085
|
-
this.project = this.project.bind(this);
|
|
14086
|
-
this.unproject = this.unproject.bind(this);
|
|
14087
|
-
this.projectPosition = this.projectPosition.bind(this);
|
|
14088
|
-
this.unprojectPosition = this.unprojectPosition.bind(this);
|
|
14089
|
-
Object.freeze(this);
|
|
14090
|
-
}
|
|
14091
|
-
|
|
14092
|
-
_initMatrices() {
|
|
14093
|
-
const {
|
|
14094
|
-
width,
|
|
14095
|
-
height,
|
|
14096
|
-
projectionMatrix,
|
|
14097
|
-
viewMatrix
|
|
14098
|
-
} = this;
|
|
14099
|
-
const vpm = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["createMat4"])();
|
|
14100
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["multiply"](vpm, vpm, projectionMatrix);
|
|
14101
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["multiply"](vpm, vpm, viewMatrix);
|
|
14102
|
-
this.viewProjectionMatrix = vpm;
|
|
14103
|
-
const m = Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["createMat4"])();
|
|
14104
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["scale"](m, m, [width / 2, -height / 2, 1]);
|
|
14105
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["translate"](m, m, [1, -1, 0]);
|
|
14106
|
-
gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["multiply"](m, m, vpm);
|
|
14107
|
-
const mInverse = gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["invert"](Object(_math_utils__WEBPACK_IMPORTED_MODULE_0__["createMat4"])(), m);
|
|
14108
|
-
|
|
14109
|
-
if (!mInverse) {
|
|
14110
|
-
throw new Error('Pixel project matrix not invertible');
|
|
14111
|
-
}
|
|
14112
|
-
|
|
14113
|
-
this.pixelProjectionMatrix = m;
|
|
14114
|
-
this.pixelUnprojectionMatrix = mInverse;
|
|
14115
|
-
}
|
|
14116
|
-
|
|
14117
|
-
equals(viewport) {
|
|
14118
|
-
if (!(viewport instanceof WebMercatorViewport)) {
|
|
14119
|
-
return false;
|
|
14120
|
-
}
|
|
14121
|
-
|
|
14122
|
-
return viewport.width === this.width && viewport.height === this.height && gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["equals"](viewport.projectionMatrix, this.projectionMatrix) && gl_matrix_mat4__WEBPACK_IMPORTED_MODULE_4__["equals"](viewport.viewMatrix, this.viewMatrix);
|
|
14123
|
-
}
|
|
14124
|
-
|
|
14125
|
-
project(xyz, {
|
|
14126
|
-
topLeft = true
|
|
14127
|
-
} = {}) {
|
|
14128
|
-
const worldPosition = this.projectPosition(xyz);
|
|
14129
|
-
const coord = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToPixels"])(worldPosition, this.pixelProjectionMatrix);
|
|
14130
|
-
const [x, y] = coord;
|
|
14131
|
-
const y2 = topLeft ? y : this.height - y;
|
|
14132
|
-
return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]];
|
|
14133
|
-
}
|
|
14134
|
-
|
|
14135
|
-
unproject(xyz, {
|
|
14136
|
-
topLeft = true,
|
|
14137
|
-
targetZ = undefined
|
|
14138
|
-
} = {}) {
|
|
14139
|
-
const [x, y, z] = xyz;
|
|
14140
|
-
const y2 = topLeft ? y : this.height - y;
|
|
14141
|
-
const targetZWorld = targetZ && targetZ * this.distanceScales.unitsPerMeter[2];
|
|
14142
|
-
const coord = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["pixelsToWorld"])([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);
|
|
14143
|
-
const [X, Y, Z] = this.unprojectPosition(coord);
|
|
14144
|
-
|
|
14145
|
-
if (Number.isFinite(z)) {
|
|
14146
|
-
return [X, Y, Z];
|
|
14147
|
-
}
|
|
14148
|
-
|
|
14149
|
-
return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
|
|
14150
|
-
}
|
|
14151
|
-
|
|
14152
|
-
projectPosition(xyz) {
|
|
14153
|
-
const [X, Y] = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(xyz);
|
|
14154
|
-
const Z = (xyz[2] || 0) * this.distanceScales.unitsPerMeter[2];
|
|
14155
|
-
return [X, Y, Z];
|
|
14156
|
-
}
|
|
14157
|
-
|
|
14158
|
-
unprojectPosition(xyz) {
|
|
14159
|
-
const [X, Y] = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToLngLat"])(xyz);
|
|
14160
|
-
const Z = (xyz[2] || 0) * this.distanceScales.metersPerUnit[2];
|
|
14161
|
-
return [X, Y, Z];
|
|
14162
|
-
}
|
|
14163
|
-
|
|
14164
|
-
projectFlat(lngLat) {
|
|
14165
|
-
return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(lngLat);
|
|
14166
|
-
}
|
|
14167
|
-
|
|
14168
|
-
unprojectFlat(xy) {
|
|
14169
|
-
return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToLngLat"])(xy);
|
|
14170
|
-
}
|
|
14171
|
-
|
|
14172
|
-
getMapCenterByLngLatPosition({
|
|
14173
|
-
lngLat,
|
|
14174
|
-
pos
|
|
14175
|
-
}) {
|
|
14176
|
-
const fromLocation = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["pixelsToWorld"])(pos, this.pixelUnprojectionMatrix);
|
|
14177
|
-
const toLocation = Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])(lngLat);
|
|
14178
|
-
const translate = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_5__["add"]([], toLocation, gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_5__["negate"]([], fromLocation));
|
|
14179
|
-
const newCenter = gl_matrix_vec2__WEBPACK_IMPORTED_MODULE_5__["add"]([], this.center, translate);
|
|
14180
|
-
return Object(_web_mercator_utils__WEBPACK_IMPORTED_MODULE_1__["worldToLngLat"])(newCenter);
|
|
14181
|
-
}
|
|
14182
|
-
|
|
14183
|
-
getLocationAtPoint({
|
|
14184
|
-
lngLat,
|
|
14185
|
-
pos
|
|
14186
|
-
}) {
|
|
14187
|
-
return this.getMapCenterByLngLatPosition({
|
|
14188
|
-
lngLat,
|
|
14189
|
-
pos
|
|
14190
|
-
});
|
|
14191
|
-
}
|
|
14192
|
-
|
|
14193
|
-
fitBounds(bounds, options = {}) {
|
|
14194
|
-
const {
|
|
14195
|
-
width,
|
|
14196
|
-
height
|
|
14197
|
-
} = this;
|
|
14198
|
-
const {
|
|
14199
|
-
longitude,
|
|
14200
|
-
latitude,
|
|
14201
|
-
zoom
|
|
14202
|
-
} = Object(_fit_bounds__WEBPACK_IMPORTED_MODULE_2__["default"])(Object.assign({
|
|
14203
|
-
width,
|
|
14204
|
-
height,
|
|
14205
|
-
bounds
|
|
14206
|
-
}, options));
|
|
14207
|
-
return new WebMercatorViewport({
|
|
14208
|
-
width,
|
|
14209
|
-
height,
|
|
14210
|
-
longitude,
|
|
14211
|
-
latitude,
|
|
14212
|
-
zoom
|
|
14213
|
-
});
|
|
14214
|
-
}
|
|
14215
|
-
|
|
14216
|
-
getBounds(options) {
|
|
14217
|
-
const corners = this.getBoundingRegion(options);
|
|
14218
|
-
const west = Math.min(...corners.map(p => p[0]));
|
|
14219
|
-
const east = Math.max(...corners.map(p => p[0]));
|
|
14220
|
-
const south = Math.min(...corners.map(p => p[1]));
|
|
14221
|
-
const north = Math.max(...corners.map(p => p[1]));
|
|
14222
|
-
return [[west, south], [east, north]];
|
|
14223
|
-
}
|
|
14224
|
-
|
|
14225
|
-
getBoundingRegion(options = {}) {
|
|
14226
|
-
return Object(_get_bounds__WEBPACK_IMPORTED_MODULE_3__["default"])(this, options.z || 0);
|
|
14227
|
-
}
|
|
14228
|
-
|
|
14229
|
-
}
|
|
14230
|
-
//# sourceMappingURL=web-mercator-viewport.js.map
|
|
14231
|
-
|
|
14232
|
-
/***/ }),
|
|
14233
|
-
|
|
14234
11904
|
/***/ "../../node_modules/cartocolor/cartocolor.js":
|
|
14235
11905
|
/*!************************************************************************!*\
|
|
14236
11906
|
!*** /Users/alasarr/dev/deck.gl/node_modules/cartocolor/cartocolor.js ***!
|
|
@@ -53951,7 +51621,7 @@ function calculateUniforms({
|
|
|
53951
51621
|
/*!**********************************!*\
|
|
53952
51622
|
!*** ../extensions/src/index.ts ***!
|
|
53953
51623
|
\**********************************/
|
|
53954
|
-
/*! exports provided: BrushingExtension, DataFilterExtension, Fp64Extension, PathStyleExtension, FillStyleExtension, ClipExtension, project64 */
|
|
51624
|
+
/*! exports provided: BrushingExtension, DataFilterExtension, Fp64Extension, PathStyleExtension, FillStyleExtension, ClipExtension, MaskExtension, project64 */
|
|
53955
51625
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
53956
51626
|
|
|
53957
51627
|
"use strict";
|
|
@@ -53974,8 +51644,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53974
51644
|
/* harmony import */ var _clip_clip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./clip/clip */ "../extensions/src/clip/clip.js");
|
|
53975
51645
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ClipExtension", function() { return _clip_clip__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
|
53976
51646
|
|
|
53977
|
-
/* harmony import */ var
|
|
53978
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
51647
|
+
/* harmony import */ var _mask_mask__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./mask/mask */ "../extensions/src/mask/mask.js");
|
|
51648
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MaskExtension", function() { return _mask_mask__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
|
51649
|
+
|
|
51650
|
+
/* harmony import */ var _fp64_project64__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fp64/project64 */ "../extensions/src/fp64/project64.js");
|
|
51651
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "project64", function() { return _fp64_project64__WEBPACK_IMPORTED_MODULE_7__["default"]; });
|
|
51652
|
+
|
|
53979
51653
|
|
|
53980
51654
|
|
|
53981
51655
|
|
|
@@ -53986,6 +51660,142 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53986
51660
|
|
|
53987
51661
|
|
|
53988
51662
|
|
|
51663
|
+
/***/ }),
|
|
51664
|
+
|
|
51665
|
+
/***/ "../extensions/src/mask/mask.js":
|
|
51666
|
+
/*!**************************************!*\
|
|
51667
|
+
!*** ../extensions/src/mask/mask.js ***!
|
|
51668
|
+
\**************************************/
|
|
51669
|
+
/*! exports provided: default */
|
|
51670
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
51671
|
+
|
|
51672
|
+
"use strict";
|
|
51673
|
+
__webpack_require__.r(__webpack_exports__);
|
|
51674
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MaskExtension; });
|
|
51675
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
51676
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
51677
|
+
/* harmony import */ var _shader_module__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shader-module */ "../extensions/src/mask/shader-module.js");
|
|
51678
|
+
|
|
51679
|
+
|
|
51680
|
+
const defaultProps = {
|
|
51681
|
+
maskEnabled: true
|
|
51682
|
+
};
|
|
51683
|
+
class MaskExtension extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["LayerExtension"] {
|
|
51684
|
+
getShaders() {
|
|
51685
|
+
// Infer by geometry if 'maskByInstance' prop isn't explictly set
|
|
51686
|
+
let maskByInstance = ('instancePositions' in this.getAttributeManager().attributes); // Users can override by setting the `maskByInstance` prop
|
|
51687
|
+
|
|
51688
|
+
if ('maskByInstance' in this.props) {
|
|
51689
|
+
maskByInstance = this.props.maskByInstance;
|
|
51690
|
+
}
|
|
51691
|
+
|
|
51692
|
+
this.state.maskByInstance = maskByInstance;
|
|
51693
|
+
return {
|
|
51694
|
+
modules: [_shader_module__WEBPACK_IMPORTED_MODULE_1__["default"]]
|
|
51695
|
+
};
|
|
51696
|
+
}
|
|
51697
|
+
|
|
51698
|
+
draw({
|
|
51699
|
+
uniforms,
|
|
51700
|
+
moduleParameters
|
|
51701
|
+
}) {
|
|
51702
|
+
uniforms.mask_maskByInstance = this.state.maskByInstance;
|
|
51703
|
+
const {
|
|
51704
|
+
maskBounds
|
|
51705
|
+
} = moduleParameters;
|
|
51706
|
+
|
|
51707
|
+
if (maskBounds) {
|
|
51708
|
+
const bl = this.projectPosition([maskBounds[0], maskBounds[1], 0]);
|
|
51709
|
+
const tr = this.projectPosition([maskBounds[2], maskBounds[3], 0]);
|
|
51710
|
+
uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
|
|
51711
|
+
}
|
|
51712
|
+
}
|
|
51713
|
+
|
|
51714
|
+
}
|
|
51715
|
+
MaskExtension.extensionName = 'MaskExtension';
|
|
51716
|
+
MaskExtension.defaultProps = defaultProps;
|
|
51717
|
+
|
|
51718
|
+
/***/ }),
|
|
51719
|
+
|
|
51720
|
+
/***/ "../extensions/src/mask/shader-module.js":
|
|
51721
|
+
/*!***********************************************!*\
|
|
51722
|
+
!*** ../extensions/src/mask/shader-module.js ***!
|
|
51723
|
+
\***********************************************/
|
|
51724
|
+
/*! exports provided: default */
|
|
51725
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
51726
|
+
|
|
51727
|
+
"use strict";
|
|
51728
|
+
__webpack_require__.r(__webpack_exports__);
|
|
51729
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
51730
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
51731
|
+
|
|
51732
|
+
const vs = `
|
|
51733
|
+
uniform vec4 mask_bounds;
|
|
51734
|
+
uniform bool mask_maskByInstance;
|
|
51735
|
+
vec2 mask_getCoords(vec4 position) {
|
|
51736
|
+
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
51737
|
+
}
|
|
51738
|
+
`;
|
|
51739
|
+
const fs = `
|
|
51740
|
+
uniform sampler2D mask_texture;
|
|
51741
|
+
uniform bool mask_enabled;
|
|
51742
|
+
bool mask_isInBounds(vec2 texCoords) {
|
|
51743
|
+
if (!mask_enabled) {
|
|
51744
|
+
return true;
|
|
51745
|
+
}
|
|
51746
|
+
vec4 maskColor = texture2D(mask_texture, texCoords);
|
|
51747
|
+
return maskColor.a > 0.5;
|
|
51748
|
+
}
|
|
51749
|
+
`;
|
|
51750
|
+
const inject = {
|
|
51751
|
+
'vs:#decl': `
|
|
51752
|
+
varying vec2 mask_texCoords;
|
|
51753
|
+
`,
|
|
51754
|
+
'vs:#main-end': `
|
|
51755
|
+
vec4 mask_common_position;
|
|
51756
|
+
if (mask_maskByInstance) {
|
|
51757
|
+
mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
51758
|
+
} else {
|
|
51759
|
+
mask_common_position = geometry.position;
|
|
51760
|
+
}
|
|
51761
|
+
mask_texCoords = mask_getCoords(mask_common_position);
|
|
51762
|
+
`,
|
|
51763
|
+
'fs:#decl': `
|
|
51764
|
+
varying vec2 mask_texCoords;
|
|
51765
|
+
`,
|
|
51766
|
+
'fs:#main-start': `
|
|
51767
|
+
if (mask_enabled) {
|
|
51768
|
+
bool mask = mask_isInBounds(mask_texCoords);
|
|
51769
|
+
|
|
51770
|
+
// Debug: show extent of render target
|
|
51771
|
+
// gl_FragColor = vec4(mask_texCoords, 0.0, 1.0);
|
|
51772
|
+
gl_FragColor = texture2D(mask_texture, mask_texCoords);
|
|
51773
|
+
|
|
51774
|
+
if (!mask) discard;
|
|
51775
|
+
}
|
|
51776
|
+
`
|
|
51777
|
+
};
|
|
51778
|
+
|
|
51779
|
+
const getMaskUniforms = (opts = {}, context = {}) => {
|
|
51780
|
+
const uniforms = {};
|
|
51781
|
+
|
|
51782
|
+
if (opts.maskMap) {
|
|
51783
|
+
uniforms.mask_enabled = opts.maskEnabled !== false;
|
|
51784
|
+
uniforms.mask_texture = opts.maskMap;
|
|
51785
|
+
}
|
|
51786
|
+
|
|
51787
|
+
return uniforms;
|
|
51788
|
+
};
|
|
51789
|
+
|
|
51790
|
+
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
51791
|
+
name: 'mask',
|
|
51792
|
+
dependencies: [_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["project"]],
|
|
51793
|
+
vs,
|
|
51794
|
+
fs,
|
|
51795
|
+
inject,
|
|
51796
|
+
getUniforms: getMaskUniforms
|
|
51797
|
+
});
|
|
51798
|
+
|
|
53989
51799
|
/***/ }),
|
|
53990
51800
|
|
|
53991
51801
|
/***/ "../extensions/src/path-style/path-style.js":
|
|
@@ -54261,450 +52071,6 @@ attribute float instanceOffsets;
|
|
|
54261
52071
|
|
|
54262
52072
|
/***/ }),
|
|
54263
52073
|
|
|
54264
|
-
/***/ "../geo-layers/src/tile-layer/tile-2d-traversal.js":
|
|
54265
|
-
/*!*********************************************************!*\
|
|
54266
|
-
!*** ../geo-layers/src/tile-layer/tile-2d-traversal.js ***!
|
|
54267
|
-
\*********************************************************/
|
|
54268
|
-
/*! exports provided: getOSMTileIndices */
|
|
54269
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54270
|
-
|
|
54271
|
-
"use strict";
|
|
54272
|
-
__webpack_require__.r(__webpack_exports__);
|
|
54273
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOSMTileIndices", function() { return getOSMTileIndices; });
|
|
54274
|
-
/* harmony import */ var _math_gl_culling__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @math.gl/culling */ "../../node_modules/@math.gl/culling/dist/esm/index.js");
|
|
54275
|
-
/* harmony import */ var _math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @math.gl/web-mercator */ "../../node_modules/@math.gl/web-mercator/dist/esm/index.js");
|
|
54276
|
-
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "../geo-layers/src/tile-layer/utils.js");
|
|
54277
|
-
/* eslint-disable complexity */
|
|
54278
|
-
|
|
54279
|
-
|
|
54280
|
-
|
|
54281
|
-
const TILE_SIZE = 512; // number of world copies to check
|
|
54282
|
-
|
|
54283
|
-
const MAX_MAPS = 3; // for calculating bounding volume of a tile in a non-web-mercator viewport
|
|
54284
|
-
|
|
54285
|
-
const REF_POINTS_5 = [[0.5, 0.5], [0, 0], [0, 1], [1, 0], [1, 1]]; // 4 corners and center
|
|
54286
|
-
|
|
54287
|
-
const REF_POINTS_9 = REF_POINTS_5.concat([[0, 0.5], [0.5, 0], [1, 0.5], [0.5, 1]]); // 4 corners, center and 4 mid points
|
|
54288
|
-
|
|
54289
|
-
const REF_POINTS_11 = REF_POINTS_9.concat([[0.25, 0.5], [0.75, 0.5]]); // 2 additional points on equator for top tile
|
|
54290
|
-
|
|
54291
|
-
class OSMNode {
|
|
54292
|
-
constructor(x, y, z) {
|
|
54293
|
-
this.x = x;
|
|
54294
|
-
this.y = y;
|
|
54295
|
-
this.z = z;
|
|
54296
|
-
}
|
|
54297
|
-
|
|
54298
|
-
get children() {
|
|
54299
|
-
if (!this._children) {
|
|
54300
|
-
const x = this.x * 2;
|
|
54301
|
-
const y = this.y * 2;
|
|
54302
|
-
const z = this.z + 1;
|
|
54303
|
-
this._children = [new OSMNode(x, y, z), new OSMNode(x, y + 1, z), new OSMNode(x + 1, y, z), new OSMNode(x + 1, y + 1, z)];
|
|
54304
|
-
}
|
|
54305
|
-
|
|
54306
|
-
return this._children;
|
|
54307
|
-
}
|
|
54308
|
-
|
|
54309
|
-
update(params) {
|
|
54310
|
-
const {
|
|
54311
|
-
viewport,
|
|
54312
|
-
cullingVolume,
|
|
54313
|
-
elevationBounds,
|
|
54314
|
-
minZ,
|
|
54315
|
-
maxZ,
|
|
54316
|
-
bounds,
|
|
54317
|
-
offset,
|
|
54318
|
-
project
|
|
54319
|
-
} = params;
|
|
54320
|
-
const boundingVolume = this.getBoundingVolume(elevationBounds, offset, project); // First, check if this tile is visible
|
|
54321
|
-
|
|
54322
|
-
if (bounds && !this.insideBounds(bounds)) {
|
|
54323
|
-
return false;
|
|
54324
|
-
}
|
|
54325
|
-
|
|
54326
|
-
const isInside = cullingVolume.computeVisibility(boundingVolume);
|
|
54327
|
-
|
|
54328
|
-
if (isInside < 0) {
|
|
54329
|
-
return false;
|
|
54330
|
-
} // Avoid loading overlapping tiles - if a descendant is requested, do not request the ancester
|
|
54331
|
-
|
|
54332
|
-
|
|
54333
|
-
if (!this.childVisible) {
|
|
54334
|
-
let {
|
|
54335
|
-
z
|
|
54336
|
-
} = this;
|
|
54337
|
-
|
|
54338
|
-
if (z < maxZ && z >= minZ) {
|
|
54339
|
-
// Adjust LOD
|
|
54340
|
-
// If the tile is far enough from the camera, accept a lower zoom level
|
|
54341
|
-
const distance = boundingVolume.distanceTo(viewport.cameraPosition) * viewport.scale / viewport.height;
|
|
54342
|
-
z += Math.floor(Math.log2(distance));
|
|
54343
|
-
}
|
|
54344
|
-
|
|
54345
|
-
if (z >= maxZ) {
|
|
54346
|
-
// LOD is acceptable
|
|
54347
|
-
this.selected = true;
|
|
54348
|
-
return true;
|
|
54349
|
-
}
|
|
54350
|
-
} // LOD is not enough, recursively test child tiles
|
|
54351
|
-
|
|
54352
|
-
|
|
54353
|
-
this.selected = false;
|
|
54354
|
-
this.childVisible = true;
|
|
54355
|
-
|
|
54356
|
-
for (const child of this.children) {
|
|
54357
|
-
child.update(params);
|
|
54358
|
-
}
|
|
54359
|
-
|
|
54360
|
-
return true;
|
|
54361
|
-
}
|
|
54362
|
-
|
|
54363
|
-
getSelected(result = []) {
|
|
54364
|
-
if (this.selected) {
|
|
54365
|
-
result.push(this);
|
|
54366
|
-
}
|
|
54367
|
-
|
|
54368
|
-
if (this._children) {
|
|
54369
|
-
for (const node of this._children) {
|
|
54370
|
-
node.getSelected(result);
|
|
54371
|
-
}
|
|
54372
|
-
}
|
|
54373
|
-
|
|
54374
|
-
return result;
|
|
54375
|
-
}
|
|
54376
|
-
|
|
54377
|
-
insideBounds([minX, minY, maxX, maxY]) {
|
|
54378
|
-
const scale = Math.pow(2, this.z);
|
|
54379
|
-
const extent = TILE_SIZE / scale;
|
|
54380
|
-
return this.x * extent < maxX && this.y * extent < maxY && (this.x + 1) * extent > minX && (this.y + 1) * extent > minY;
|
|
54381
|
-
}
|
|
54382
|
-
|
|
54383
|
-
getBoundingVolume(zRange, worldOffset, project) {
|
|
54384
|
-
if (project) {
|
|
54385
|
-
// Custom projection
|
|
54386
|
-
// Estimate bounding box from sample points
|
|
54387
|
-
// At low zoom level we need more samples to calculate the bounding volume correctly
|
|
54388
|
-
const refPoints = this.z < 1 ? REF_POINTS_11 : this.z < 2 ? REF_POINTS_9 : REF_POINTS_5; // Convert from tile-relative coordinates to common space
|
|
54389
|
-
|
|
54390
|
-
const refPointPositions = [];
|
|
54391
|
-
|
|
54392
|
-
for (const p of refPoints) {
|
|
54393
|
-
const lngLat = Object(_utils__WEBPACK_IMPORTED_MODULE_2__["osmTile2lngLat"])(this.x + p[0], this.y + p[1], this.z);
|
|
54394
|
-
lngLat[2] = zRange[0];
|
|
54395
|
-
refPointPositions.push(project(lngLat));
|
|
54396
|
-
|
|
54397
|
-
if (zRange[0] !== zRange[1]) {
|
|
54398
|
-
// Account for the elevation volume
|
|
54399
|
-
lngLat[2] = zRange[1];
|
|
54400
|
-
refPointPositions.push(project(lngLat));
|
|
54401
|
-
}
|
|
54402
|
-
}
|
|
54403
|
-
|
|
54404
|
-
return Object(_math_gl_culling__WEBPACK_IMPORTED_MODULE_0__["makeOrientedBoundingBoxFromPoints"])(refPointPositions);
|
|
54405
|
-
} // Use WebMercator projection
|
|
54406
|
-
|
|
54407
|
-
|
|
54408
|
-
const scale = Math.pow(2, this.z);
|
|
54409
|
-
const extent = TILE_SIZE / scale;
|
|
54410
|
-
const originX = this.x * extent + worldOffset * TILE_SIZE; // deck's common space is y-flipped
|
|
54411
|
-
|
|
54412
|
-
const originY = TILE_SIZE - (this.y + 1) * extent;
|
|
54413
|
-
return new _math_gl_culling__WEBPACK_IMPORTED_MODULE_0__["AxisAlignedBoundingBox"]([originX, originY, zRange[0]], [originX + extent, originY + extent, zRange[1]]);
|
|
54414
|
-
}
|
|
54415
|
-
|
|
54416
|
-
}
|
|
54417
|
-
|
|
54418
|
-
function getOSMTileIndices(viewport, maxZ, zRange, bounds) {
|
|
54419
|
-
const project = viewport.resolution ? viewport.projectPosition : null; // Get the culling volume of the current camera
|
|
54420
|
-
|
|
54421
|
-
const planes = Object.values(viewport.getFrustumPlanes()).map(({
|
|
54422
|
-
normal,
|
|
54423
|
-
distance
|
|
54424
|
-
}) => new _math_gl_culling__WEBPACK_IMPORTED_MODULE_0__["Plane"](normal.clone().negate(), distance));
|
|
54425
|
-
const cullingVolume = new _math_gl_culling__WEBPACK_IMPORTED_MODULE_0__["CullingVolume"](planes); // Project zRange from meters to common space
|
|
54426
|
-
|
|
54427
|
-
const unitsPerMeter = viewport.distanceScales.unitsPerMeter[2];
|
|
54428
|
-
const elevationMin = zRange && zRange[0] * unitsPerMeter || 0;
|
|
54429
|
-
const elevationMax = zRange && zRange[1] * unitsPerMeter || 0; // Always load at the current zoom level if pitch is small
|
|
54430
|
-
|
|
54431
|
-
const minZ = viewport.pitch <= 60 ? maxZ : 0; // Map extent to OSM position
|
|
54432
|
-
|
|
54433
|
-
if (bounds) {
|
|
54434
|
-
const [minLng, minLat, maxLng, maxLat] = bounds;
|
|
54435
|
-
const topLeft = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])([minLng, maxLat]);
|
|
54436
|
-
const bottomRight = Object(_math_gl_web_mercator__WEBPACK_IMPORTED_MODULE_1__["lngLatToWorld"])([maxLng, minLat]);
|
|
54437
|
-
bounds = [topLeft[0], TILE_SIZE - topLeft[1], bottomRight[0], TILE_SIZE - bottomRight[1]];
|
|
54438
|
-
}
|
|
54439
|
-
|
|
54440
|
-
const root = new OSMNode(0, 0, 0);
|
|
54441
|
-
const traversalParams = {
|
|
54442
|
-
viewport,
|
|
54443
|
-
project,
|
|
54444
|
-
cullingVolume,
|
|
54445
|
-
elevationBounds: [elevationMin, elevationMax],
|
|
54446
|
-
minZ,
|
|
54447
|
-
maxZ,
|
|
54448
|
-
bounds,
|
|
54449
|
-
// num. of worlds from the center. For repeated maps
|
|
54450
|
-
offset: 0
|
|
54451
|
-
};
|
|
54452
|
-
root.update(traversalParams);
|
|
54453
|
-
|
|
54454
|
-
if (viewport.subViewports && viewport.subViewports.length > 1) {
|
|
54455
|
-
// Check worlds in repeated maps
|
|
54456
|
-
traversalParams.offset = -1;
|
|
54457
|
-
|
|
54458
|
-
while (root.update(traversalParams)) {
|
|
54459
|
-
if (--traversalParams.offset < -MAX_MAPS) {
|
|
54460
|
-
break;
|
|
54461
|
-
}
|
|
54462
|
-
}
|
|
54463
|
-
|
|
54464
|
-
traversalParams.offset = 1;
|
|
54465
|
-
|
|
54466
|
-
while (root.update(traversalParams)) {
|
|
54467
|
-
if (++traversalParams.offset > MAX_MAPS) {
|
|
54468
|
-
break;
|
|
54469
|
-
}
|
|
54470
|
-
}
|
|
54471
|
-
}
|
|
54472
|
-
|
|
54473
|
-
return root.getSelected();
|
|
54474
|
-
}
|
|
54475
|
-
|
|
54476
|
-
/***/ }),
|
|
54477
|
-
|
|
54478
|
-
/***/ "../geo-layers/src/tile-layer/utils.js":
|
|
54479
|
-
/*!*********************************************!*\
|
|
54480
|
-
!*** ../geo-layers/src/tile-layer/utils.js ***!
|
|
54481
|
-
\*********************************************/
|
|
54482
|
-
/*! exports provided: urlType, getURLFromTemplate, osmTile2lngLat, tileToBoundingBox, getTileIndices, isURLTemplate */
|
|
54483
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54484
|
-
|
|
54485
|
-
"use strict";
|
|
54486
|
-
__webpack_require__.r(__webpack_exports__);
|
|
54487
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "urlType", function() { return urlType; });
|
|
54488
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getURLFromTemplate", function() { return getURLFromTemplate; });
|
|
54489
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "osmTile2lngLat", function() { return osmTile2lngLat; });
|
|
54490
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tileToBoundingBox", function() { return tileToBoundingBox; });
|
|
54491
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTileIndices", function() { return getTileIndices; });
|
|
54492
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isURLTemplate", function() { return isURLTemplate; });
|
|
54493
|
-
/* harmony import */ var _tile_2d_traversal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tile-2d-traversal */ "../geo-layers/src/tile-layer/tile-2d-traversal.js");
|
|
54494
|
-
|
|
54495
|
-
const TILE_SIZE = 512;
|
|
54496
|
-
const DEFAULT_EXTENT = [-Infinity, -Infinity, Infinity, Infinity];
|
|
54497
|
-
const urlType = {
|
|
54498
|
-
type: 'url',
|
|
54499
|
-
value: null,
|
|
54500
|
-
validate: (value, propType) => propType.optional && value === null || typeof value === 'string' || Array.isArray(value) && value.every(url => typeof url === 'string'),
|
|
54501
|
-
equals: (value1, value2) => {
|
|
54502
|
-
if (value1 === value2) {
|
|
54503
|
-
return true;
|
|
54504
|
-
}
|
|
54505
|
-
|
|
54506
|
-
if (!Array.isArray(value1) || !Array.isArray(value2)) {
|
|
54507
|
-
return false;
|
|
54508
|
-
}
|
|
54509
|
-
|
|
54510
|
-
const len = value1.length;
|
|
54511
|
-
|
|
54512
|
-
if (len !== value2.length) {
|
|
54513
|
-
return false;
|
|
54514
|
-
}
|
|
54515
|
-
|
|
54516
|
-
for (let i = 0; i < len; i++) {
|
|
54517
|
-
if (value1[i] !== value2[i]) {
|
|
54518
|
-
return false;
|
|
54519
|
-
}
|
|
54520
|
-
}
|
|
54521
|
-
|
|
54522
|
-
return true;
|
|
54523
|
-
}
|
|
54524
|
-
};
|
|
54525
|
-
|
|
54526
|
-
function transformBox(bbox, modelMatrix) {
|
|
54527
|
-
const transformedCoords = [// top-left
|
|
54528
|
-
modelMatrix.transformPoint([bbox[0], bbox[1]]), // top-right
|
|
54529
|
-
modelMatrix.transformPoint([bbox[2], bbox[1]]), // bottom-left
|
|
54530
|
-
modelMatrix.transformPoint([bbox[0], bbox[3]]), // bottom-right
|
|
54531
|
-
modelMatrix.transformPoint([bbox[2], bbox[3]])];
|
|
54532
|
-
const transformedBox = [// Minimum x coord
|
|
54533
|
-
Math.min(...transformedCoords.map(i => i[0])), // Minimum y coord
|
|
54534
|
-
Math.min(...transformedCoords.map(i => i[1])), // Max x coord
|
|
54535
|
-
Math.max(...transformedCoords.map(i => i[0])), // Max y coord
|
|
54536
|
-
Math.max(...transformedCoords.map(i => i[1]))];
|
|
54537
|
-
return transformedBox;
|
|
54538
|
-
}
|
|
54539
|
-
|
|
54540
|
-
function getURLFromTemplate(template, properties) {
|
|
54541
|
-
if (!template || !template.length) {
|
|
54542
|
-
return null;
|
|
54543
|
-
}
|
|
54544
|
-
|
|
54545
|
-
if (Array.isArray(template)) {
|
|
54546
|
-
const index = Math.abs(properties.x + properties.y) % template.length;
|
|
54547
|
-
template = template[index];
|
|
54548
|
-
}
|
|
54549
|
-
|
|
54550
|
-
const {
|
|
54551
|
-
x,
|
|
54552
|
-
y,
|
|
54553
|
-
z
|
|
54554
|
-
} = properties;
|
|
54555
|
-
return template.replace('{x}', x).replace('{y}', y).replace('{z}', z).replace('{-y}', Math.pow(2, z) - y - 1);
|
|
54556
|
-
}
|
|
54557
|
-
/**
|
|
54558
|
-
* gets the bounding box of a viewport
|
|
54559
|
-
*/
|
|
54560
|
-
|
|
54561
|
-
function getBoundingBox(viewport, zRange, extent) {
|
|
54562
|
-
let bounds;
|
|
54563
|
-
|
|
54564
|
-
if (zRange && zRange.length === 2) {
|
|
54565
|
-
const [minZ, maxZ] = zRange;
|
|
54566
|
-
const bounds0 = viewport.getBounds({
|
|
54567
|
-
z: minZ
|
|
54568
|
-
});
|
|
54569
|
-
const bounds1 = viewport.getBounds({
|
|
54570
|
-
z: maxZ
|
|
54571
|
-
});
|
|
54572
|
-
bounds = [Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3])];
|
|
54573
|
-
} else {
|
|
54574
|
-
bounds = viewport.getBounds();
|
|
54575
|
-
}
|
|
54576
|
-
|
|
54577
|
-
if (!viewport.isGeospatial) {
|
|
54578
|
-
return [// Top corner should not be more then bottom corner in either direction
|
|
54579
|
-
Math.max(Math.min(bounds[0], extent[2]), extent[0]), Math.max(Math.min(bounds[1], extent[3]), extent[1]), // Bottom corner should not be less then top corner in either direction
|
|
54580
|
-
Math.min(Math.max(bounds[2], extent[0]), extent[2]), Math.min(Math.max(bounds[3], extent[1]), extent[3])];
|
|
54581
|
-
}
|
|
54582
|
-
|
|
54583
|
-
return [Math.max(bounds[0], extent[0]), Math.max(bounds[1], extent[1]), Math.min(bounds[2], extent[2]), Math.min(bounds[3], extent[3])];
|
|
54584
|
-
}
|
|
54585
|
-
|
|
54586
|
-
function getIndexingCoords(bbox, scale, modelMatrixInverse) {
|
|
54587
|
-
if (modelMatrixInverse) {
|
|
54588
|
-
const transformedTileIndex = transformBox(bbox, modelMatrixInverse).map(i => i * scale / TILE_SIZE);
|
|
54589
|
-
return transformedTileIndex;
|
|
54590
|
-
}
|
|
54591
|
-
|
|
54592
|
-
return bbox.map(i => i * scale / TILE_SIZE);
|
|
54593
|
-
}
|
|
54594
|
-
|
|
54595
|
-
function getScale(z, tileSize) {
|
|
54596
|
-
return Math.pow(2, z) * TILE_SIZE / tileSize;
|
|
54597
|
-
} // https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Lon..2Flat._to_tile_numbers_2
|
|
54598
|
-
|
|
54599
|
-
|
|
54600
|
-
function osmTile2lngLat(x, y, z) {
|
|
54601
|
-
const scale = getScale(z, TILE_SIZE);
|
|
54602
|
-
const lng = x / scale * 360 - 180;
|
|
54603
|
-
const n = Math.PI - 2 * Math.PI * y / scale;
|
|
54604
|
-
const lat = 180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));
|
|
54605
|
-
return [lng, lat];
|
|
54606
|
-
}
|
|
54607
|
-
|
|
54608
|
-
function tile2XY(x, y, z, tileSize) {
|
|
54609
|
-
const scale = getScale(z, tileSize);
|
|
54610
|
-
return [x / scale * TILE_SIZE, y / scale * TILE_SIZE];
|
|
54611
|
-
}
|
|
54612
|
-
|
|
54613
|
-
function tileToBoundingBox(viewport, x, y, z, tileSize = TILE_SIZE) {
|
|
54614
|
-
if (viewport.isGeospatial) {
|
|
54615
|
-
const [west, north] = osmTile2lngLat(x, y, z);
|
|
54616
|
-
const [east, south] = osmTile2lngLat(x + 1, y + 1, z);
|
|
54617
|
-
return {
|
|
54618
|
-
west,
|
|
54619
|
-
north,
|
|
54620
|
-
east,
|
|
54621
|
-
south
|
|
54622
|
-
};
|
|
54623
|
-
}
|
|
54624
|
-
|
|
54625
|
-
const [left, top] = tile2XY(x, y, z, tileSize);
|
|
54626
|
-
const [right, bottom] = tile2XY(x + 1, y + 1, z, tileSize);
|
|
54627
|
-
return {
|
|
54628
|
-
left,
|
|
54629
|
-
top,
|
|
54630
|
-
right,
|
|
54631
|
-
bottom
|
|
54632
|
-
};
|
|
54633
|
-
}
|
|
54634
|
-
|
|
54635
|
-
function getIdentityTileIndices(viewport, z, tileSize, extent, modelMatrixInverse) {
|
|
54636
|
-
const bbox = getBoundingBox(viewport, null, extent);
|
|
54637
|
-
const scale = getScale(z, tileSize);
|
|
54638
|
-
const [minX, minY, maxX, maxY] = getIndexingCoords(bbox, scale, modelMatrixInverse);
|
|
54639
|
-
const indices = [];
|
|
54640
|
-
/*
|
|
54641
|
-
| TILE | TILE | TILE |
|
|
54642
|
-
|(minX) |(maxX)
|
|
54643
|
-
*/
|
|
54644
|
-
|
|
54645
|
-
for (let x = Math.floor(minX); x < maxX; x++) {
|
|
54646
|
-
for (let y = Math.floor(minY); y < maxY; y++) {
|
|
54647
|
-
indices.push({
|
|
54648
|
-
x,
|
|
54649
|
-
y,
|
|
54650
|
-
z
|
|
54651
|
-
});
|
|
54652
|
-
}
|
|
54653
|
-
}
|
|
54654
|
-
|
|
54655
|
-
return indices;
|
|
54656
|
-
}
|
|
54657
|
-
/**
|
|
54658
|
-
* Returns all tile indices in the current viewport. If the current zoom level is smaller
|
|
54659
|
-
* than minZoom, return an empty array. If the current zoom level is greater than maxZoom,
|
|
54660
|
-
* return tiles that are on maxZoom.
|
|
54661
|
-
*/
|
|
54662
|
-
// eslint-disable-next-line complexity
|
|
54663
|
-
|
|
54664
|
-
|
|
54665
|
-
function getTileIndices({
|
|
54666
|
-
viewport,
|
|
54667
|
-
maxZoom,
|
|
54668
|
-
minZoom,
|
|
54669
|
-
zRange,
|
|
54670
|
-
extent,
|
|
54671
|
-
tileSize = TILE_SIZE,
|
|
54672
|
-
modelMatrix,
|
|
54673
|
-
modelMatrixInverse,
|
|
54674
|
-
zoomOffset = 0
|
|
54675
|
-
}) {
|
|
54676
|
-
let z = viewport.isGeospatial ? Math.round(viewport.zoom + Math.log2(TILE_SIZE / tileSize)) + zoomOffset : Math.ceil(viewport.zoom) + zoomOffset;
|
|
54677
|
-
|
|
54678
|
-
if (Number.isFinite(minZoom) && z < minZoom) {
|
|
54679
|
-
if (!extent) {
|
|
54680
|
-
return [];
|
|
54681
|
-
}
|
|
54682
|
-
|
|
54683
|
-
z = minZoom;
|
|
54684
|
-
}
|
|
54685
|
-
|
|
54686
|
-
if (Number.isFinite(maxZoom) && z > maxZoom) {
|
|
54687
|
-
z = maxZoom;
|
|
54688
|
-
}
|
|
54689
|
-
|
|
54690
|
-
let transformedExtent = extent;
|
|
54691
|
-
|
|
54692
|
-
if (modelMatrix && modelMatrixInverse && extent && !viewport.isGeospatial) {
|
|
54693
|
-
transformedExtent = transformBox(extent, modelMatrix);
|
|
54694
|
-
}
|
|
54695
|
-
|
|
54696
|
-
return viewport.isGeospatial ? Object(_tile_2d_traversal__WEBPACK_IMPORTED_MODULE_0__["getOSMTileIndices"])(viewport, z, zRange, extent) : getIdentityTileIndices(viewport, z, tileSize, transformedExtent || DEFAULT_EXTENT, modelMatrixInverse);
|
|
54697
|
-
}
|
|
54698
|
-
/**
|
|
54699
|
-
* Returns true if s is a valid URL template
|
|
54700
|
-
*/
|
|
54701
|
-
|
|
54702
|
-
function isURLTemplate(s) {
|
|
54703
|
-
return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(s);
|
|
54704
|
-
}
|
|
54705
|
-
|
|
54706
|
-
/***/ }),
|
|
54707
|
-
|
|
54708
52074
|
/***/ "./bundle.ts":
|
|
54709
52075
|
/*!*******************!*\
|
|
54710
52076
|
!*** ./bundle.ts ***!
|
|
@@ -54766,7 +52132,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54766
52132
|
/*!******************************!*\
|
|
54767
52133
|
!*** ./src/api/layer-map.js ***!
|
|
54768
52134
|
\******************************/
|
|
54769
|
-
/*! exports provided: LAYER_MAP, getColorAccessor, getSizeAccessor, getTextAccessor, getTextPixelOffsetAccessor */
|
|
52135
|
+
/*! exports provided: LAYER_MAP, getColorAccessor, getSizeAccessor, getTextAccessor, getTextPixelOffsetAccessor, _domainFromValues */
|
|
54770
52136
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54771
52137
|
|
|
54772
52138
|
"use strict";
|
|
@@ -54776,6 +52142,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54776
52142
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSizeAccessor", function() { return getSizeAccessor; });
|
|
54777
52143
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextAccessor", function() { return getTextAccessor; });
|
|
54778
52144
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextPixelOffsetAccessor", function() { return getTextPixelOffsetAccessor; });
|
|
52145
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_domainFromValues", function() { return domainFromValues; });
|
|
54779
52146
|
/* harmony import */ var d3_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-array */ "../../node_modules/d3-array/src/index.js");
|
|
54780
52147
|
/* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3-color */ "../../node_modules/d3-color/src/index.js");
|
|
54781
52148
|
/* harmony import */ var d3_scale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3-scale */ "../../node_modules/d3-scale/src/index.js");
|
|
@@ -54875,7 +52242,8 @@ const LAYER_MAP = {
|
|
|
54875
52242
|
propMap: sharedPropMap,
|
|
54876
52243
|
defaultProps: { ...defaultProps,
|
|
54877
52244
|
pointRadiusScale: 0.3,
|
|
54878
|
-
lineWidthScale: 2
|
|
52245
|
+
lineWidthScale: 2,
|
|
52246
|
+
uniqueIdProperty: 'geoid'
|
|
54879
52247
|
}
|
|
54880
52248
|
}
|
|
54881
52249
|
};
|
|
@@ -54899,6 +52267,11 @@ function domainFromAttribute(attribute, scaleType) {
|
|
|
54899
52267
|
function domainFromValues(values, scaleType) {
|
|
54900
52268
|
if (scaleType === 'ordinal') {
|
|
54901
52269
|
return [...new Set(values)].sort();
|
|
52270
|
+
} else if (scaleType === 'quantile') {
|
|
52271
|
+
return values.sort((a, b) => a - b);
|
|
52272
|
+
} else if (scaleType === 'log') {
|
|
52273
|
+
const [d0, d1] = Object(d3_array__WEBPACK_IMPORTED_MODULE_0__["extent"])(values);
|
|
52274
|
+
return [d0 === 0 ? 1e-5 : d0, d1];
|
|
54902
52275
|
}
|
|
54903
52276
|
|
|
54904
52277
|
return Object(d3_array__WEBPACK_IMPORTED_MODULE_0__["extent"])(values);
|
|
@@ -55008,6 +52381,7 @@ function getTextPixelOffsetAccessor({
|
|
|
55008
52381
|
} : calculateOffset(radius);
|
|
55009
52382
|
}
|
|
55010
52383
|
|
|
52384
|
+
|
|
55011
52385
|
/***/ }),
|
|
55012
52386
|
|
|
55013
52387
|
/***/ "./src/api/maps-api-common.js":
|
|
@@ -55282,6 +52656,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
55282
52656
|
|
|
55283
52657
|
|
|
55284
52658
|
const MAX_GET_LENGTH = 2048;
|
|
52659
|
+
const DEFAULT_CLIENT = 'deck-gl-carto';
|
|
55285
52660
|
/**
|
|
55286
52661
|
* Request against Maps API
|
|
55287
52662
|
*/
|
|
@@ -55365,9 +52740,10 @@ function getParameters({
|
|
|
55365
52740
|
source,
|
|
55366
52741
|
geoColumn,
|
|
55367
52742
|
columns,
|
|
55368
|
-
schema
|
|
52743
|
+
schema,
|
|
52744
|
+
clientId
|
|
55369
52745
|
}) {
|
|
55370
|
-
const parameters = [Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('client',
|
|
52746
|
+
const parameters = [Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('client', clientId || DEFAULT_CLIENT)];
|
|
55371
52747
|
|
|
55372
52748
|
if (schema) {
|
|
55373
52749
|
parameters.push(Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('schema', true));
|
|
@@ -55396,7 +52772,8 @@ async function mapInstantiation({
|
|
|
55396
52772
|
credentials,
|
|
55397
52773
|
geoColumn,
|
|
55398
52774
|
columns,
|
|
55399
|
-
schema
|
|
52775
|
+
schema,
|
|
52776
|
+
clientId
|
|
55400
52777
|
}) {
|
|
55401
52778
|
const baseUrl = `${credentials.mapsUrl}/${connection}/${type}`;
|
|
55402
52779
|
const url = `${baseUrl}?${getParameters({
|
|
@@ -55404,7 +52781,8 @@ async function mapInstantiation({
|
|
|
55404
52781
|
source,
|
|
55405
52782
|
geoColumn,
|
|
55406
52783
|
columns,
|
|
55407
|
-
schema
|
|
52784
|
+
schema,
|
|
52785
|
+
clientId
|
|
55408
52786
|
})}`;
|
|
55409
52787
|
const {
|
|
55410
52788
|
accessToken
|
|
@@ -55415,7 +52793,7 @@ async function mapInstantiation({
|
|
|
55415
52793
|
// need to be a POST request
|
|
55416
52794
|
const body = JSON.stringify({
|
|
55417
52795
|
q: source,
|
|
55418
|
-
client:
|
|
52796
|
+
client: clientId || DEFAULT_CLIENT
|
|
55419
52797
|
});
|
|
55420
52798
|
return await request({
|
|
55421
52799
|
method: 'POST',
|
|
@@ -55465,7 +52843,8 @@ async function fetchLayerData({
|
|
|
55465
52843
|
geoColumn,
|
|
55466
52844
|
columns,
|
|
55467
52845
|
format,
|
|
55468
|
-
schema
|
|
52846
|
+
schema,
|
|
52847
|
+
clientId
|
|
55469
52848
|
}) {
|
|
55470
52849
|
// Internally we split data fetching into two parts to allow us to
|
|
55471
52850
|
// conditionally fetch the actual data, depending on the metadata state
|
|
@@ -55482,7 +52861,8 @@ async function fetchLayerData({
|
|
|
55482
52861
|
geoColumn,
|
|
55483
52862
|
columns,
|
|
55484
52863
|
format,
|
|
55485
|
-
schema
|
|
52864
|
+
schema,
|
|
52865
|
+
clientId
|
|
55486
52866
|
});
|
|
55487
52867
|
const data = await request({
|
|
55488
52868
|
url,
|
|
@@ -55509,7 +52889,8 @@ async function _fetchDataUrl({
|
|
|
55509
52889
|
geoColumn,
|
|
55510
52890
|
columns,
|
|
55511
52891
|
format,
|
|
55512
|
-
schema
|
|
52892
|
+
schema,
|
|
52893
|
+
clientId
|
|
55513
52894
|
}) {
|
|
55514
52895
|
const defaultCredentials = Object(_config__WEBPACK_IMPORTED_MODULE_0__["getDefaultCredentials"])(); // Only pick up default credentials if they have been defined for
|
|
55515
52896
|
// correct API version
|
|
@@ -55535,7 +52916,8 @@ async function _fetchDataUrl({
|
|
|
55535
52916
|
credentials: localCreds,
|
|
55536
52917
|
geoColumn,
|
|
55537
52918
|
columns,
|
|
55538
|
-
schema
|
|
52919
|
+
schema,
|
|
52920
|
+
clientId
|
|
55539
52921
|
});
|
|
55540
52922
|
let url;
|
|
55541
52923
|
let mapFormat;
|
|
@@ -55576,7 +52958,8 @@ async function getData({
|
|
|
55576
52958
|
credentials,
|
|
55577
52959
|
geoColumn,
|
|
55578
52960
|
columns,
|
|
55579
|
-
format
|
|
52961
|
+
format,
|
|
52962
|
+
clientId
|
|
55580
52963
|
}) {
|
|
55581
52964
|
_deck_gl_core__WEBPACK_IMPORTED_MODULE_3__["log"].deprecated('getData', 'fetchLayerData')();
|
|
55582
52965
|
const layerData = await fetchLayerData({
|
|
@@ -55587,13 +52970,14 @@ async function getData({
|
|
|
55587
52970
|
geoColumn,
|
|
55588
52971
|
columns,
|
|
55589
52972
|
format,
|
|
55590
|
-
schema: false
|
|
52973
|
+
schema: false,
|
|
52974
|
+
clientId
|
|
55591
52975
|
});
|
|
55592
52976
|
return layerData.data;
|
|
55593
52977
|
}
|
|
55594
52978
|
/* global clearInterval, setInterval, URLSearchParams */
|
|
55595
52979
|
|
|
55596
|
-
async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
52980
|
+
async function _fetchMapDataset(dataset, accessToken, credentials, clientId) {
|
|
55597
52981
|
// First fetch metadata
|
|
55598
52982
|
const {
|
|
55599
52983
|
connectionName: connection,
|
|
@@ -55609,7 +52993,8 @@ async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
|
55609
52993
|
},
|
|
55610
52994
|
connection,
|
|
55611
52995
|
source,
|
|
55612
|
-
type
|
|
52996
|
+
type,
|
|
52997
|
+
clientId
|
|
55613
52998
|
}); // Extract the last time the data changed
|
|
55614
52999
|
|
|
55615
53000
|
const cache = parseInt(new URLSearchParams(url).get('cache'), 10);
|
|
@@ -55632,13 +53017,14 @@ async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
|
55632
53017
|
async function fillInMapDatasets({
|
|
55633
53018
|
datasets,
|
|
55634
53019
|
token
|
|
55635
|
-
}, credentials) {
|
|
55636
|
-
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials));
|
|
53020
|
+
}, clientId, credentials) {
|
|
53021
|
+
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId));
|
|
55637
53022
|
return await Promise.all(promises);
|
|
55638
53023
|
}
|
|
55639
53024
|
|
|
55640
53025
|
async function fetchMap({
|
|
55641
53026
|
cartoMapId,
|
|
53027
|
+
clientId,
|
|
55642
53028
|
credentials,
|
|
55643
53029
|
autoRefresh,
|
|
55644
53030
|
onNewData
|
|
@@ -55671,7 +53057,7 @@ async function fetchMap({
|
|
|
55671
53057
|
|
|
55672
53058
|
if (autoRefresh) {
|
|
55673
53059
|
const intervalId = setInterval(async () => {
|
|
55674
|
-
const changed = await fillInMapDatasets(map, credentials);
|
|
53060
|
+
const changed = await fillInMapDatasets(map, clientId, credentials);
|
|
55675
53061
|
|
|
55676
53062
|
if (changed.some(v => v === true)) {
|
|
55677
53063
|
onNewData(Object(_parseMap__WEBPACK_IMPORTED_MODULE_2__["parseMap"])(map));
|
|
@@ -55684,7 +53070,7 @@ async function fetchMap({
|
|
|
55684
53070
|
} // Mutates map.datasets so that dataset.data contains data
|
|
55685
53071
|
|
|
55686
53072
|
|
|
55687
|
-
await fillInMapDatasets(map, credentials);
|
|
53073
|
+
await fillInMapDatasets(map, clientId, credentials);
|
|
55688
53074
|
return { ...Object(_parseMap__WEBPACK_IMPORTED_MODULE_2__["parseMap"])(map),
|
|
55689
53075
|
...{
|
|
55690
53076
|
stopAutoRefresh
|
|
@@ -55740,31 +53126,36 @@ function parseMap(json) {
|
|
|
55740
53126
|
config,
|
|
55741
53127
|
visualChannels
|
|
55742
53128
|
}) => {
|
|
55743
|
-
|
|
55744
|
-
|
|
55745
|
-
|
|
55746
|
-
|
|
55747
|
-
|
|
55748
|
-
|
|
55749
|
-
|
|
55750
|
-
|
|
55751
|
-
|
|
55752
|
-
|
|
55753
|
-
|
|
55754
|
-
|
|
55755
|
-
|
|
55756
|
-
|
|
55757
|
-
|
|
55758
|
-
|
|
55759
|
-
|
|
55760
|
-
|
|
55761
|
-
|
|
55762
|
-
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
|
|
53129
|
+
try {
|
|
53130
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(type in _layer_map__WEBPACK_IMPORTED_MODULE_1__["LAYER_MAP"], `Unsupported layer type: ${type}`);
|
|
53131
|
+
const {
|
|
53132
|
+
Layer,
|
|
53133
|
+
propMap,
|
|
53134
|
+
defaultProps
|
|
53135
|
+
} = _layer_map__WEBPACK_IMPORTED_MODULE_1__["LAYER_MAP"][type];
|
|
53136
|
+
const {
|
|
53137
|
+
dataId
|
|
53138
|
+
} = config;
|
|
53139
|
+
const dataset = datasets.find(d => d.id === dataId);
|
|
53140
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(dataset, `No dataset matching dataId: ${dataId}`);
|
|
53141
|
+
const {
|
|
53142
|
+
data
|
|
53143
|
+
} = dataset;
|
|
53144
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(data, `No data loaded for dataId: ${dataId}`);
|
|
53145
|
+
return new Layer({
|
|
53146
|
+
id,
|
|
53147
|
+
data,
|
|
53148
|
+
...defaultProps,
|
|
53149
|
+
...createBlendingProps(layerBlending),
|
|
53150
|
+
...(!config.textLabel && createInteractionProps(interactionConfig)),
|
|
53151
|
+
...createStyleProps(config, propMap),
|
|
53152
|
+
...createChannelProps(visualChannels, type, config, data) // Must come after style
|
|
55766
53153
|
|
|
55767
|
-
|
|
53154
|
+
});
|
|
53155
|
+
} catch (e) {
|
|
53156
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].error(e.message)();
|
|
53157
|
+
return undefined;
|
|
53158
|
+
}
|
|
55768
53159
|
})
|
|
55769
53160
|
};
|
|
55770
53161
|
}
|
|
@@ -55890,8 +53281,8 @@ function createChannelProps(visualChannels, type, config, data) {
|
|
|
55890
53281
|
}
|
|
55891
53282
|
|
|
55892
53283
|
if (strokeColorField) {
|
|
55893
|
-
const opacity = visConfig.strokeOpacity !== undefined ? visConfig.strokeOpacity
|
|
55894
|
-
result.getLineColor = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getColorAccessor"])(strokeColorField, strokeColorScale, visConfig.
|
|
53284
|
+
const opacity = visConfig.strokeOpacity !== undefined ? visConfig.strokeOpacity : 1;
|
|
53285
|
+
result.getLineColor = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getColorAccessor"])(strokeColorField, strokeColorScale, visConfig.strokeColorRange, opacity, data);
|
|
55895
53286
|
}
|
|
55896
53287
|
|
|
55897
53288
|
if (heightField) {
|
|
@@ -56075,7 +53466,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56075
53466
|
/* harmony import */ var _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @deck.gl/extensions */ "../extensions/src/index.ts");
|
|
56076
53467
|
/* harmony import */ var _loaders_gl_gis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @loaders.gl/gis */ "../../node_modules/@loaders.gl/gis/dist/esm/index.js");
|
|
56077
53468
|
/* harmony import */ var _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../api/maps-api-common */ "./src/api/maps-api-common.js");
|
|
56078
|
-
/* harmony import */ var _deck_gl_geo_layers_tile_layer_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @deck.gl/geo-layers/tile-layer/utils */ "../geo-layers/src/tile-layer/utils.js");
|
|
56079
53469
|
/* global TextDecoder */
|
|
56080
53470
|
|
|
56081
53471
|
|
|
@@ -56084,7 +53474,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56084
53474
|
|
|
56085
53475
|
|
|
56086
53476
|
|
|
56087
|
-
|
|
56088
53477
|
function parseJSON(arrayBuffer) {
|
|
56089
53478
|
return JSON.parse(new TextDecoder().decode(arrayBuffer));
|
|
56090
53479
|
}
|
|
@@ -56114,7 +53503,7 @@ const CartoDynamicTileLoader = {
|
|
|
56114
53503
|
};
|
|
56115
53504
|
class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"] {
|
|
56116
53505
|
getTileData(tile) {
|
|
56117
|
-
let url = Object(
|
|
53506
|
+
let url = Object(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["_getURLFromTemplate"])(this.state.data, tile);
|
|
56118
53507
|
|
|
56119
53508
|
if (!url) {
|
|
56120
53509
|
return Promise.reject('Invalid URL');
|
|
@@ -56229,6 +53618,8 @@ const defaultProps = {
|
|
|
56229
53618
|
connection: null,
|
|
56230
53619
|
// (String, optional): format of data
|
|
56231
53620
|
format: null,
|
|
53621
|
+
// (String, optional): clientId identifier used for internal tracing, place here a string to identify the client who is doing the request.
|
|
53622
|
+
clientId: null,
|
|
56232
53623
|
// (String, optional): name of the `geo_column` in the CARTO platform. Use this override the default column ('geom'), from which the geometry information should be fetched.
|
|
56233
53624
|
geoColumn: null,
|
|
56234
53625
|
// (Array<String>, optional): names of columns to fetch. By default, all columns are fetched.
|
|
@@ -56309,6 +53700,7 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56309
53700
|
const {
|
|
56310
53701
|
type,
|
|
56311
53702
|
data: source,
|
|
53703
|
+
clientId,
|
|
56312
53704
|
credentials,
|
|
56313
53705
|
...rest
|
|
56314
53706
|
} = this.props;
|
|
@@ -56332,6 +53724,7 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56332
53724
|
result = await Object(_api__WEBPACK_IMPORTED_MODULE_2__["fetchLayerData"])({
|
|
56333
53725
|
type,
|
|
56334
53726
|
source,
|
|
53727
|
+
clientId,
|
|
56335
53728
|
credentials,
|
|
56336
53729
|
...rest
|
|
56337
53730
|
});
|