@deck.gl/carto 8.7.0-alpha.9 → 8.7.0-beta.4
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 +1373 -2897
- package/dist/es5/api/index.js +6 -0
- package/dist/es5/api/index.js.map +1 -1
- package/dist/es5/api/layer-map.js +67 -42
- package/dist/es5/api/layer-map.js.map +1 -1
- package/dist/es5/api/maps-api-common.js +7 -1
- package/dist/es5/api/maps-api-common.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 +23 -18
- package/dist/es5/api/parseMap.js.map +1 -1
- package/dist/es5/index.js +14 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/layers/carto-dynamic-tile-layer.js +56 -13
- package/dist/es5/layers/carto-dynamic-tile-layer.js.map +1 -1
- package/dist/es5/layers/carto-layer.js +13 -5
- package/dist/es5/layers/carto-layer.js.map +1 -1
- package/dist/es5/layers/schema/carto-dynamic-tile.js +197 -0
- package/dist/es5/layers/schema/carto-dynamic-tile.js.map +1 -0
- package/dist/esm/api/index.js +1 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/layer-map.js +50 -35
- package/dist/esm/api/layer-map.js.map +1 -1
- package/dist/esm/api/maps-api-common.js +5 -0
- package/dist/esm/api/maps-api-common.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 -27
- package/dist/esm/api/parseMap.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layers/carto-dynamic-tile-layer.js +51 -10
- package/dist/esm/layers/carto-dynamic-tile-layer.js.map +1 -1
- package/dist/esm/layers/carto-layer.js +11 -2
- package/dist/esm/layers/carto-layer.js.map +1 -1
- package/dist/esm/layers/schema/carto-dynamic-tile.js +190 -0
- package/dist/esm/layers/schema/carto-dynamic-tile.js.map +1 -0
- package/dist.min.js +14 -14
- package/package.json +10 -9
- package/src/api/index.js +1 -1
- package/src/api/layer-map.js +47 -26
- package/src/api/maps-api-common.js +7 -0
- package/src/api/maps-v3-client.js +35 -18
- package/src/api/parseMap.js +23 -21
- package/src/index.js +2 -0
- package/src/layers/carto-dynamic-tile-layer.js +41 -11
- package/src/layers/carto-layer.js +22 -6
- package/src/layers/schema/carto-dynamic-tile.js +195 -0
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 ***!
|
|
@@ -29992,6 +27662,101 @@ var forEach = function () {
|
|
|
29992
27662
|
};
|
|
29993
27663
|
}();
|
|
29994
27664
|
|
|
27665
|
+
/***/ }),
|
|
27666
|
+
|
|
27667
|
+
/***/ "../../node_modules/ieee754/index.js":
|
|
27668
|
+
/*!****************************************************************!*\
|
|
27669
|
+
!*** /Users/alasarr/dev/deck.gl/node_modules/ieee754/index.js ***!
|
|
27670
|
+
\****************************************************************/
|
|
27671
|
+
/*! no static exports found */
|
|
27672
|
+
/***/ (function(module, exports) {
|
|
27673
|
+
|
|
27674
|
+
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
27675
|
+
var e, m
|
|
27676
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
27677
|
+
var eMax = (1 << eLen) - 1
|
|
27678
|
+
var eBias = eMax >> 1
|
|
27679
|
+
var nBits = -7
|
|
27680
|
+
var i = isLE ? (nBytes - 1) : 0
|
|
27681
|
+
var d = isLE ? -1 : 1
|
|
27682
|
+
var s = buffer[offset + i]
|
|
27683
|
+
|
|
27684
|
+
i += d
|
|
27685
|
+
|
|
27686
|
+
e = s & ((1 << (-nBits)) - 1)
|
|
27687
|
+
s >>= (-nBits)
|
|
27688
|
+
nBits += eLen
|
|
27689
|
+
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
27690
|
+
|
|
27691
|
+
m = e & ((1 << (-nBits)) - 1)
|
|
27692
|
+
e >>= (-nBits)
|
|
27693
|
+
nBits += mLen
|
|
27694
|
+
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
|
|
27695
|
+
|
|
27696
|
+
if (e === 0) {
|
|
27697
|
+
e = 1 - eBias
|
|
27698
|
+
} else if (e === eMax) {
|
|
27699
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
27700
|
+
} else {
|
|
27701
|
+
m = m + Math.pow(2, mLen)
|
|
27702
|
+
e = e - eBias
|
|
27703
|
+
}
|
|
27704
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
27705
|
+
}
|
|
27706
|
+
|
|
27707
|
+
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
27708
|
+
var e, m, c
|
|
27709
|
+
var eLen = (nBytes * 8) - mLen - 1
|
|
27710
|
+
var eMax = (1 << eLen) - 1
|
|
27711
|
+
var eBias = eMax >> 1
|
|
27712
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
|
|
27713
|
+
var i = isLE ? 0 : (nBytes - 1)
|
|
27714
|
+
var d = isLE ? 1 : -1
|
|
27715
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
|
|
27716
|
+
|
|
27717
|
+
value = Math.abs(value)
|
|
27718
|
+
|
|
27719
|
+
if (isNaN(value) || value === Infinity) {
|
|
27720
|
+
m = isNaN(value) ? 1 : 0
|
|
27721
|
+
e = eMax
|
|
27722
|
+
} else {
|
|
27723
|
+
e = Math.floor(Math.log(value) / Math.LN2)
|
|
27724
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
27725
|
+
e--
|
|
27726
|
+
c *= 2
|
|
27727
|
+
}
|
|
27728
|
+
if (e + eBias >= 1) {
|
|
27729
|
+
value += rt / c
|
|
27730
|
+
} else {
|
|
27731
|
+
value += rt * Math.pow(2, 1 - eBias)
|
|
27732
|
+
}
|
|
27733
|
+
if (value * c >= 2) {
|
|
27734
|
+
e++
|
|
27735
|
+
c /= 2
|
|
27736
|
+
}
|
|
27737
|
+
|
|
27738
|
+
if (e + eBias >= eMax) {
|
|
27739
|
+
m = 0
|
|
27740
|
+
e = eMax
|
|
27741
|
+
} else if (e + eBias >= 1) {
|
|
27742
|
+
m = ((value * c) - 1) * Math.pow(2, mLen)
|
|
27743
|
+
e = e + eBias
|
|
27744
|
+
} else {
|
|
27745
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
|
|
27746
|
+
e = 0
|
|
27747
|
+
}
|
|
27748
|
+
}
|
|
27749
|
+
|
|
27750
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
27751
|
+
|
|
27752
|
+
e = (e << mLen) | m
|
|
27753
|
+
eLen += mLen
|
|
27754
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
27755
|
+
|
|
27756
|
+
buffer[offset + i - d] |= s * 128
|
|
27757
|
+
}
|
|
27758
|
+
|
|
27759
|
+
|
|
29995
27760
|
/***/ }),
|
|
29996
27761
|
|
|
29997
27762
|
/***/ "../../node_modules/internmap/src/index.js":
|
|
@@ -52408,6 +50173,660 @@ webpackContext.id = "../../node_modules/moment/locale sync recursive ^\\.\\/.*$"
|
|
|
52408
50173
|
|
|
52409
50174
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "../../node_modules/webpack/buildin/module.js")(module)))
|
|
52410
50175
|
|
|
50176
|
+
/***/ }),
|
|
50177
|
+
|
|
50178
|
+
/***/ "../../node_modules/pbf/index.js":
|
|
50179
|
+
/*!************************************************************!*\
|
|
50180
|
+
!*** /Users/alasarr/dev/deck.gl/node_modules/pbf/index.js ***!
|
|
50181
|
+
\************************************************************/
|
|
50182
|
+
/*! no static exports found */
|
|
50183
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
50184
|
+
|
|
50185
|
+
"use strict";
|
|
50186
|
+
|
|
50187
|
+
|
|
50188
|
+
module.exports = Pbf;
|
|
50189
|
+
|
|
50190
|
+
var ieee754 = __webpack_require__(/*! ieee754 */ "../../node_modules/ieee754/index.js");
|
|
50191
|
+
|
|
50192
|
+
function Pbf(buf) {
|
|
50193
|
+
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
|
|
50194
|
+
this.pos = 0;
|
|
50195
|
+
this.type = 0;
|
|
50196
|
+
this.length = this.buf.length;
|
|
50197
|
+
}
|
|
50198
|
+
|
|
50199
|
+
Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
|
|
50200
|
+
Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
|
|
50201
|
+
Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
|
|
50202
|
+
Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
|
|
50203
|
+
|
|
50204
|
+
var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
|
|
50205
|
+
SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
|
|
50206
|
+
|
|
50207
|
+
// Threshold chosen based on both benchmarking and knowledge about browser string
|
|
50208
|
+
// data structures (which currently switch structure types at 12 bytes or more)
|
|
50209
|
+
var TEXT_DECODER_MIN_LENGTH = 12;
|
|
50210
|
+
var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
|
|
50211
|
+
|
|
50212
|
+
Pbf.prototype = {
|
|
50213
|
+
|
|
50214
|
+
destroy: function() {
|
|
50215
|
+
this.buf = null;
|
|
50216
|
+
},
|
|
50217
|
+
|
|
50218
|
+
// === READING =================================================================
|
|
50219
|
+
|
|
50220
|
+
readFields: function(readField, result, end) {
|
|
50221
|
+
end = end || this.length;
|
|
50222
|
+
|
|
50223
|
+
while (this.pos < end) {
|
|
50224
|
+
var val = this.readVarint(),
|
|
50225
|
+
tag = val >> 3,
|
|
50226
|
+
startPos = this.pos;
|
|
50227
|
+
|
|
50228
|
+
this.type = val & 0x7;
|
|
50229
|
+
readField(tag, result, this);
|
|
50230
|
+
|
|
50231
|
+
if (this.pos === startPos) this.skip(val);
|
|
50232
|
+
}
|
|
50233
|
+
return result;
|
|
50234
|
+
},
|
|
50235
|
+
|
|
50236
|
+
readMessage: function(readField, result) {
|
|
50237
|
+
return this.readFields(readField, result, this.readVarint() + this.pos);
|
|
50238
|
+
},
|
|
50239
|
+
|
|
50240
|
+
readFixed32: function() {
|
|
50241
|
+
var val = readUInt32(this.buf, this.pos);
|
|
50242
|
+
this.pos += 4;
|
|
50243
|
+
return val;
|
|
50244
|
+
},
|
|
50245
|
+
|
|
50246
|
+
readSFixed32: function() {
|
|
50247
|
+
var val = readInt32(this.buf, this.pos);
|
|
50248
|
+
this.pos += 4;
|
|
50249
|
+
return val;
|
|
50250
|
+
},
|
|
50251
|
+
|
|
50252
|
+
// 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
|
|
50253
|
+
|
|
50254
|
+
readFixed64: function() {
|
|
50255
|
+
var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
|
|
50256
|
+
this.pos += 8;
|
|
50257
|
+
return val;
|
|
50258
|
+
},
|
|
50259
|
+
|
|
50260
|
+
readSFixed64: function() {
|
|
50261
|
+
var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
|
|
50262
|
+
this.pos += 8;
|
|
50263
|
+
return val;
|
|
50264
|
+
},
|
|
50265
|
+
|
|
50266
|
+
readFloat: function() {
|
|
50267
|
+
var val = ieee754.read(this.buf, this.pos, true, 23, 4);
|
|
50268
|
+
this.pos += 4;
|
|
50269
|
+
return val;
|
|
50270
|
+
},
|
|
50271
|
+
|
|
50272
|
+
readDouble: function() {
|
|
50273
|
+
var val = ieee754.read(this.buf, this.pos, true, 52, 8);
|
|
50274
|
+
this.pos += 8;
|
|
50275
|
+
return val;
|
|
50276
|
+
},
|
|
50277
|
+
|
|
50278
|
+
readVarint: function(isSigned) {
|
|
50279
|
+
var buf = this.buf,
|
|
50280
|
+
val, b;
|
|
50281
|
+
|
|
50282
|
+
b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
|
|
50283
|
+
b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
|
|
50284
|
+
b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
|
|
50285
|
+
b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
|
|
50286
|
+
b = buf[this.pos]; val |= (b & 0x0f) << 28;
|
|
50287
|
+
|
|
50288
|
+
return readVarintRemainder(val, isSigned, this);
|
|
50289
|
+
},
|
|
50290
|
+
|
|
50291
|
+
readVarint64: function() { // for compatibility with v2.0.1
|
|
50292
|
+
return this.readVarint(true);
|
|
50293
|
+
},
|
|
50294
|
+
|
|
50295
|
+
readSVarint: function() {
|
|
50296
|
+
var num = this.readVarint();
|
|
50297
|
+
return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
|
|
50298
|
+
},
|
|
50299
|
+
|
|
50300
|
+
readBoolean: function() {
|
|
50301
|
+
return Boolean(this.readVarint());
|
|
50302
|
+
},
|
|
50303
|
+
|
|
50304
|
+
readString: function() {
|
|
50305
|
+
var end = this.readVarint() + this.pos;
|
|
50306
|
+
var pos = this.pos;
|
|
50307
|
+
this.pos = end;
|
|
50308
|
+
|
|
50309
|
+
if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
|
|
50310
|
+
// longer strings are fast with the built-in browser TextDecoder API
|
|
50311
|
+
return readUtf8TextDecoder(this.buf, pos, end);
|
|
50312
|
+
}
|
|
50313
|
+
// short strings are fast with our custom implementation
|
|
50314
|
+
return readUtf8(this.buf, pos, end);
|
|
50315
|
+
},
|
|
50316
|
+
|
|
50317
|
+
readBytes: function() {
|
|
50318
|
+
var end = this.readVarint() + this.pos,
|
|
50319
|
+
buffer = this.buf.subarray(this.pos, end);
|
|
50320
|
+
this.pos = end;
|
|
50321
|
+
return buffer;
|
|
50322
|
+
},
|
|
50323
|
+
|
|
50324
|
+
// verbose for performance reasons; doesn't affect gzipped size
|
|
50325
|
+
|
|
50326
|
+
readPackedVarint: function(arr, isSigned) {
|
|
50327
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
|
|
50328
|
+
var end = readPackedEnd(this);
|
|
50329
|
+
arr = arr || [];
|
|
50330
|
+
while (this.pos < end) arr.push(this.readVarint(isSigned));
|
|
50331
|
+
return arr;
|
|
50332
|
+
},
|
|
50333
|
+
readPackedSVarint: function(arr) {
|
|
50334
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
|
|
50335
|
+
var end = readPackedEnd(this);
|
|
50336
|
+
arr = arr || [];
|
|
50337
|
+
while (this.pos < end) arr.push(this.readSVarint());
|
|
50338
|
+
return arr;
|
|
50339
|
+
},
|
|
50340
|
+
readPackedBoolean: function(arr) {
|
|
50341
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
|
|
50342
|
+
var end = readPackedEnd(this);
|
|
50343
|
+
arr = arr || [];
|
|
50344
|
+
while (this.pos < end) arr.push(this.readBoolean());
|
|
50345
|
+
return arr;
|
|
50346
|
+
},
|
|
50347
|
+
readPackedFloat: function(arr) {
|
|
50348
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
|
|
50349
|
+
var end = readPackedEnd(this);
|
|
50350
|
+
arr = arr || [];
|
|
50351
|
+
while (this.pos < end) arr.push(this.readFloat());
|
|
50352
|
+
return arr;
|
|
50353
|
+
},
|
|
50354
|
+
readPackedDouble: function(arr) {
|
|
50355
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
|
|
50356
|
+
var end = readPackedEnd(this);
|
|
50357
|
+
arr = arr || [];
|
|
50358
|
+
while (this.pos < end) arr.push(this.readDouble());
|
|
50359
|
+
return arr;
|
|
50360
|
+
},
|
|
50361
|
+
readPackedFixed32: function(arr) {
|
|
50362
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
|
|
50363
|
+
var end = readPackedEnd(this);
|
|
50364
|
+
arr = arr || [];
|
|
50365
|
+
while (this.pos < end) arr.push(this.readFixed32());
|
|
50366
|
+
return arr;
|
|
50367
|
+
},
|
|
50368
|
+
readPackedSFixed32: function(arr) {
|
|
50369
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
|
|
50370
|
+
var end = readPackedEnd(this);
|
|
50371
|
+
arr = arr || [];
|
|
50372
|
+
while (this.pos < end) arr.push(this.readSFixed32());
|
|
50373
|
+
return arr;
|
|
50374
|
+
},
|
|
50375
|
+
readPackedFixed64: function(arr) {
|
|
50376
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
|
|
50377
|
+
var end = readPackedEnd(this);
|
|
50378
|
+
arr = arr || [];
|
|
50379
|
+
while (this.pos < end) arr.push(this.readFixed64());
|
|
50380
|
+
return arr;
|
|
50381
|
+
},
|
|
50382
|
+
readPackedSFixed64: function(arr) {
|
|
50383
|
+
if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
|
|
50384
|
+
var end = readPackedEnd(this);
|
|
50385
|
+
arr = arr || [];
|
|
50386
|
+
while (this.pos < end) arr.push(this.readSFixed64());
|
|
50387
|
+
return arr;
|
|
50388
|
+
},
|
|
50389
|
+
|
|
50390
|
+
skip: function(val) {
|
|
50391
|
+
var type = val & 0x7;
|
|
50392
|
+
if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
|
|
50393
|
+
else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
|
|
50394
|
+
else if (type === Pbf.Fixed32) this.pos += 4;
|
|
50395
|
+
else if (type === Pbf.Fixed64) this.pos += 8;
|
|
50396
|
+
else throw new Error('Unimplemented type: ' + type);
|
|
50397
|
+
},
|
|
50398
|
+
|
|
50399
|
+
// === WRITING =================================================================
|
|
50400
|
+
|
|
50401
|
+
writeTag: function(tag, type) {
|
|
50402
|
+
this.writeVarint((tag << 3) | type);
|
|
50403
|
+
},
|
|
50404
|
+
|
|
50405
|
+
realloc: function(min) {
|
|
50406
|
+
var length = this.length || 16;
|
|
50407
|
+
|
|
50408
|
+
while (length < this.pos + min) length *= 2;
|
|
50409
|
+
|
|
50410
|
+
if (length !== this.length) {
|
|
50411
|
+
var buf = new Uint8Array(length);
|
|
50412
|
+
buf.set(this.buf);
|
|
50413
|
+
this.buf = buf;
|
|
50414
|
+
this.length = length;
|
|
50415
|
+
}
|
|
50416
|
+
},
|
|
50417
|
+
|
|
50418
|
+
finish: function() {
|
|
50419
|
+
this.length = this.pos;
|
|
50420
|
+
this.pos = 0;
|
|
50421
|
+
return this.buf.subarray(0, this.length);
|
|
50422
|
+
},
|
|
50423
|
+
|
|
50424
|
+
writeFixed32: function(val) {
|
|
50425
|
+
this.realloc(4);
|
|
50426
|
+
writeInt32(this.buf, val, this.pos);
|
|
50427
|
+
this.pos += 4;
|
|
50428
|
+
},
|
|
50429
|
+
|
|
50430
|
+
writeSFixed32: function(val) {
|
|
50431
|
+
this.realloc(4);
|
|
50432
|
+
writeInt32(this.buf, val, this.pos);
|
|
50433
|
+
this.pos += 4;
|
|
50434
|
+
},
|
|
50435
|
+
|
|
50436
|
+
writeFixed64: function(val) {
|
|
50437
|
+
this.realloc(8);
|
|
50438
|
+
writeInt32(this.buf, val & -1, this.pos);
|
|
50439
|
+
writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
|
|
50440
|
+
this.pos += 8;
|
|
50441
|
+
},
|
|
50442
|
+
|
|
50443
|
+
writeSFixed64: function(val) {
|
|
50444
|
+
this.realloc(8);
|
|
50445
|
+
writeInt32(this.buf, val & -1, this.pos);
|
|
50446
|
+
writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
|
|
50447
|
+
this.pos += 8;
|
|
50448
|
+
},
|
|
50449
|
+
|
|
50450
|
+
writeVarint: function(val) {
|
|
50451
|
+
val = +val || 0;
|
|
50452
|
+
|
|
50453
|
+
if (val > 0xfffffff || val < 0) {
|
|
50454
|
+
writeBigVarint(val, this);
|
|
50455
|
+
return;
|
|
50456
|
+
}
|
|
50457
|
+
|
|
50458
|
+
this.realloc(4);
|
|
50459
|
+
|
|
50460
|
+
this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
|
|
50461
|
+
this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
|
|
50462
|
+
this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
|
|
50463
|
+
this.buf[this.pos++] = (val >>> 7) & 0x7f;
|
|
50464
|
+
},
|
|
50465
|
+
|
|
50466
|
+
writeSVarint: function(val) {
|
|
50467
|
+
this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
|
|
50468
|
+
},
|
|
50469
|
+
|
|
50470
|
+
writeBoolean: function(val) {
|
|
50471
|
+
this.writeVarint(Boolean(val));
|
|
50472
|
+
},
|
|
50473
|
+
|
|
50474
|
+
writeString: function(str) {
|
|
50475
|
+
str = String(str);
|
|
50476
|
+
this.realloc(str.length * 4);
|
|
50477
|
+
|
|
50478
|
+
this.pos++; // reserve 1 byte for short string length
|
|
50479
|
+
|
|
50480
|
+
var startPos = this.pos;
|
|
50481
|
+
// write the string directly to the buffer and see how much was written
|
|
50482
|
+
this.pos = writeUtf8(this.buf, str, this.pos);
|
|
50483
|
+
var len = this.pos - startPos;
|
|
50484
|
+
|
|
50485
|
+
if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
|
|
50486
|
+
|
|
50487
|
+
// finally, write the message length in the reserved place and restore the position
|
|
50488
|
+
this.pos = startPos - 1;
|
|
50489
|
+
this.writeVarint(len);
|
|
50490
|
+
this.pos += len;
|
|
50491
|
+
},
|
|
50492
|
+
|
|
50493
|
+
writeFloat: function(val) {
|
|
50494
|
+
this.realloc(4);
|
|
50495
|
+
ieee754.write(this.buf, val, this.pos, true, 23, 4);
|
|
50496
|
+
this.pos += 4;
|
|
50497
|
+
},
|
|
50498
|
+
|
|
50499
|
+
writeDouble: function(val) {
|
|
50500
|
+
this.realloc(8);
|
|
50501
|
+
ieee754.write(this.buf, val, this.pos, true, 52, 8);
|
|
50502
|
+
this.pos += 8;
|
|
50503
|
+
},
|
|
50504
|
+
|
|
50505
|
+
writeBytes: function(buffer) {
|
|
50506
|
+
var len = buffer.length;
|
|
50507
|
+
this.writeVarint(len);
|
|
50508
|
+
this.realloc(len);
|
|
50509
|
+
for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
|
|
50510
|
+
},
|
|
50511
|
+
|
|
50512
|
+
writeRawMessage: function(fn, obj) {
|
|
50513
|
+
this.pos++; // reserve 1 byte for short message length
|
|
50514
|
+
|
|
50515
|
+
// write the message directly to the buffer and see how much was written
|
|
50516
|
+
var startPos = this.pos;
|
|
50517
|
+
fn(obj, this);
|
|
50518
|
+
var len = this.pos - startPos;
|
|
50519
|
+
|
|
50520
|
+
if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
|
|
50521
|
+
|
|
50522
|
+
// finally, write the message length in the reserved place and restore the position
|
|
50523
|
+
this.pos = startPos - 1;
|
|
50524
|
+
this.writeVarint(len);
|
|
50525
|
+
this.pos += len;
|
|
50526
|
+
},
|
|
50527
|
+
|
|
50528
|
+
writeMessage: function(tag, fn, obj) {
|
|
50529
|
+
this.writeTag(tag, Pbf.Bytes);
|
|
50530
|
+
this.writeRawMessage(fn, obj);
|
|
50531
|
+
},
|
|
50532
|
+
|
|
50533
|
+
writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
|
|
50534
|
+
writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
|
|
50535
|
+
writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
|
|
50536
|
+
writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
|
|
50537
|
+
writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
|
|
50538
|
+
writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
|
|
50539
|
+
writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
|
|
50540
|
+
writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
|
|
50541
|
+
writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
|
|
50542
|
+
|
|
50543
|
+
writeBytesField: function(tag, buffer) {
|
|
50544
|
+
this.writeTag(tag, Pbf.Bytes);
|
|
50545
|
+
this.writeBytes(buffer);
|
|
50546
|
+
},
|
|
50547
|
+
writeFixed32Field: function(tag, val) {
|
|
50548
|
+
this.writeTag(tag, Pbf.Fixed32);
|
|
50549
|
+
this.writeFixed32(val);
|
|
50550
|
+
},
|
|
50551
|
+
writeSFixed32Field: function(tag, val) {
|
|
50552
|
+
this.writeTag(tag, Pbf.Fixed32);
|
|
50553
|
+
this.writeSFixed32(val);
|
|
50554
|
+
},
|
|
50555
|
+
writeFixed64Field: function(tag, val) {
|
|
50556
|
+
this.writeTag(tag, Pbf.Fixed64);
|
|
50557
|
+
this.writeFixed64(val);
|
|
50558
|
+
},
|
|
50559
|
+
writeSFixed64Field: function(tag, val) {
|
|
50560
|
+
this.writeTag(tag, Pbf.Fixed64);
|
|
50561
|
+
this.writeSFixed64(val);
|
|
50562
|
+
},
|
|
50563
|
+
writeVarintField: function(tag, val) {
|
|
50564
|
+
this.writeTag(tag, Pbf.Varint);
|
|
50565
|
+
this.writeVarint(val);
|
|
50566
|
+
},
|
|
50567
|
+
writeSVarintField: function(tag, val) {
|
|
50568
|
+
this.writeTag(tag, Pbf.Varint);
|
|
50569
|
+
this.writeSVarint(val);
|
|
50570
|
+
},
|
|
50571
|
+
writeStringField: function(tag, str) {
|
|
50572
|
+
this.writeTag(tag, Pbf.Bytes);
|
|
50573
|
+
this.writeString(str);
|
|
50574
|
+
},
|
|
50575
|
+
writeFloatField: function(tag, val) {
|
|
50576
|
+
this.writeTag(tag, Pbf.Fixed32);
|
|
50577
|
+
this.writeFloat(val);
|
|
50578
|
+
},
|
|
50579
|
+
writeDoubleField: function(tag, val) {
|
|
50580
|
+
this.writeTag(tag, Pbf.Fixed64);
|
|
50581
|
+
this.writeDouble(val);
|
|
50582
|
+
},
|
|
50583
|
+
writeBooleanField: function(tag, val) {
|
|
50584
|
+
this.writeVarintField(tag, Boolean(val));
|
|
50585
|
+
}
|
|
50586
|
+
};
|
|
50587
|
+
|
|
50588
|
+
function readVarintRemainder(l, s, p) {
|
|
50589
|
+
var buf = p.buf,
|
|
50590
|
+
h, b;
|
|
50591
|
+
|
|
50592
|
+
b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
|
|
50593
|
+
b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
|
|
50594
|
+
b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
|
|
50595
|
+
b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
|
|
50596
|
+
b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
|
|
50597
|
+
b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
|
|
50598
|
+
|
|
50599
|
+
throw new Error('Expected varint not more than 10 bytes');
|
|
50600
|
+
}
|
|
50601
|
+
|
|
50602
|
+
function readPackedEnd(pbf) {
|
|
50603
|
+
return pbf.type === Pbf.Bytes ?
|
|
50604
|
+
pbf.readVarint() + pbf.pos : pbf.pos + 1;
|
|
50605
|
+
}
|
|
50606
|
+
|
|
50607
|
+
function toNum(low, high, isSigned) {
|
|
50608
|
+
if (isSigned) {
|
|
50609
|
+
return high * 0x100000000 + (low >>> 0);
|
|
50610
|
+
}
|
|
50611
|
+
|
|
50612
|
+
return ((high >>> 0) * 0x100000000) + (low >>> 0);
|
|
50613
|
+
}
|
|
50614
|
+
|
|
50615
|
+
function writeBigVarint(val, pbf) {
|
|
50616
|
+
var low, high;
|
|
50617
|
+
|
|
50618
|
+
if (val >= 0) {
|
|
50619
|
+
low = (val % 0x100000000) | 0;
|
|
50620
|
+
high = (val / 0x100000000) | 0;
|
|
50621
|
+
} else {
|
|
50622
|
+
low = ~(-val % 0x100000000);
|
|
50623
|
+
high = ~(-val / 0x100000000);
|
|
50624
|
+
|
|
50625
|
+
if (low ^ 0xffffffff) {
|
|
50626
|
+
low = (low + 1) | 0;
|
|
50627
|
+
} else {
|
|
50628
|
+
low = 0;
|
|
50629
|
+
high = (high + 1) | 0;
|
|
50630
|
+
}
|
|
50631
|
+
}
|
|
50632
|
+
|
|
50633
|
+
if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
|
|
50634
|
+
throw new Error('Given varint doesn\'t fit into 10 bytes');
|
|
50635
|
+
}
|
|
50636
|
+
|
|
50637
|
+
pbf.realloc(10);
|
|
50638
|
+
|
|
50639
|
+
writeBigVarintLow(low, high, pbf);
|
|
50640
|
+
writeBigVarintHigh(high, pbf);
|
|
50641
|
+
}
|
|
50642
|
+
|
|
50643
|
+
function writeBigVarintLow(low, high, pbf) {
|
|
50644
|
+
pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
|
|
50645
|
+
pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
|
|
50646
|
+
pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
|
|
50647
|
+
pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
|
|
50648
|
+
pbf.buf[pbf.pos] = low & 0x7f;
|
|
50649
|
+
}
|
|
50650
|
+
|
|
50651
|
+
function writeBigVarintHigh(high, pbf) {
|
|
50652
|
+
var lsb = (high & 0x07) << 4;
|
|
50653
|
+
|
|
50654
|
+
pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
|
|
50655
|
+
pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
|
|
50656
|
+
pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
|
|
50657
|
+
pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
|
|
50658
|
+
pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
|
|
50659
|
+
pbf.buf[pbf.pos++] = high & 0x7f;
|
|
50660
|
+
}
|
|
50661
|
+
|
|
50662
|
+
function makeRoomForExtraLength(startPos, len, pbf) {
|
|
50663
|
+
var extraLen =
|
|
50664
|
+
len <= 0x3fff ? 1 :
|
|
50665
|
+
len <= 0x1fffff ? 2 :
|
|
50666
|
+
len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
|
|
50667
|
+
|
|
50668
|
+
// if 1 byte isn't enough for encoding message length, shift the data to the right
|
|
50669
|
+
pbf.realloc(extraLen);
|
|
50670
|
+
for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
|
|
50671
|
+
}
|
|
50672
|
+
|
|
50673
|
+
function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
|
|
50674
|
+
function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
|
|
50675
|
+
function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
|
|
50676
|
+
function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
|
|
50677
|
+
function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
|
|
50678
|
+
function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
|
|
50679
|
+
function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
|
|
50680
|
+
function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
|
|
50681
|
+
function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
|
|
50682
|
+
|
|
50683
|
+
// Buffer code below from https://github.com/feross/buffer, MIT-licensed
|
|
50684
|
+
|
|
50685
|
+
function readUInt32(buf, pos) {
|
|
50686
|
+
return ((buf[pos]) |
|
|
50687
|
+
(buf[pos + 1] << 8) |
|
|
50688
|
+
(buf[pos + 2] << 16)) +
|
|
50689
|
+
(buf[pos + 3] * 0x1000000);
|
|
50690
|
+
}
|
|
50691
|
+
|
|
50692
|
+
function writeInt32(buf, val, pos) {
|
|
50693
|
+
buf[pos] = val;
|
|
50694
|
+
buf[pos + 1] = (val >>> 8);
|
|
50695
|
+
buf[pos + 2] = (val >>> 16);
|
|
50696
|
+
buf[pos + 3] = (val >>> 24);
|
|
50697
|
+
}
|
|
50698
|
+
|
|
50699
|
+
function readInt32(buf, pos) {
|
|
50700
|
+
return ((buf[pos]) |
|
|
50701
|
+
(buf[pos + 1] << 8) |
|
|
50702
|
+
(buf[pos + 2] << 16)) +
|
|
50703
|
+
(buf[pos + 3] << 24);
|
|
50704
|
+
}
|
|
50705
|
+
|
|
50706
|
+
function readUtf8(buf, pos, end) {
|
|
50707
|
+
var str = '';
|
|
50708
|
+
var i = pos;
|
|
50709
|
+
|
|
50710
|
+
while (i < end) {
|
|
50711
|
+
var b0 = buf[i];
|
|
50712
|
+
var c = null; // codepoint
|
|
50713
|
+
var bytesPerSequence =
|
|
50714
|
+
b0 > 0xEF ? 4 :
|
|
50715
|
+
b0 > 0xDF ? 3 :
|
|
50716
|
+
b0 > 0xBF ? 2 : 1;
|
|
50717
|
+
|
|
50718
|
+
if (i + bytesPerSequence > end) break;
|
|
50719
|
+
|
|
50720
|
+
var b1, b2, b3;
|
|
50721
|
+
|
|
50722
|
+
if (bytesPerSequence === 1) {
|
|
50723
|
+
if (b0 < 0x80) {
|
|
50724
|
+
c = b0;
|
|
50725
|
+
}
|
|
50726
|
+
} else if (bytesPerSequence === 2) {
|
|
50727
|
+
b1 = buf[i + 1];
|
|
50728
|
+
if ((b1 & 0xC0) === 0x80) {
|
|
50729
|
+
c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
|
|
50730
|
+
if (c <= 0x7F) {
|
|
50731
|
+
c = null;
|
|
50732
|
+
}
|
|
50733
|
+
}
|
|
50734
|
+
} else if (bytesPerSequence === 3) {
|
|
50735
|
+
b1 = buf[i + 1];
|
|
50736
|
+
b2 = buf[i + 2];
|
|
50737
|
+
if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
|
|
50738
|
+
c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
|
|
50739
|
+
if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
|
|
50740
|
+
c = null;
|
|
50741
|
+
}
|
|
50742
|
+
}
|
|
50743
|
+
} else if (bytesPerSequence === 4) {
|
|
50744
|
+
b1 = buf[i + 1];
|
|
50745
|
+
b2 = buf[i + 2];
|
|
50746
|
+
b3 = buf[i + 3];
|
|
50747
|
+
if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
|
|
50748
|
+
c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
|
|
50749
|
+
if (c <= 0xFFFF || c >= 0x110000) {
|
|
50750
|
+
c = null;
|
|
50751
|
+
}
|
|
50752
|
+
}
|
|
50753
|
+
}
|
|
50754
|
+
|
|
50755
|
+
if (c === null) {
|
|
50756
|
+
c = 0xFFFD;
|
|
50757
|
+
bytesPerSequence = 1;
|
|
50758
|
+
|
|
50759
|
+
} else if (c > 0xFFFF) {
|
|
50760
|
+
c -= 0x10000;
|
|
50761
|
+
str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
|
|
50762
|
+
c = 0xDC00 | c & 0x3FF;
|
|
50763
|
+
}
|
|
50764
|
+
|
|
50765
|
+
str += String.fromCharCode(c);
|
|
50766
|
+
i += bytesPerSequence;
|
|
50767
|
+
}
|
|
50768
|
+
|
|
50769
|
+
return str;
|
|
50770
|
+
}
|
|
50771
|
+
|
|
50772
|
+
function readUtf8TextDecoder(buf, pos, end) {
|
|
50773
|
+
return utf8TextDecoder.decode(buf.subarray(pos, end));
|
|
50774
|
+
}
|
|
50775
|
+
|
|
50776
|
+
function writeUtf8(buf, str, pos) {
|
|
50777
|
+
for (var i = 0, c, lead; i < str.length; i++) {
|
|
50778
|
+
c = str.charCodeAt(i); // code point
|
|
50779
|
+
|
|
50780
|
+
if (c > 0xD7FF && c < 0xE000) {
|
|
50781
|
+
if (lead) {
|
|
50782
|
+
if (c < 0xDC00) {
|
|
50783
|
+
buf[pos++] = 0xEF;
|
|
50784
|
+
buf[pos++] = 0xBF;
|
|
50785
|
+
buf[pos++] = 0xBD;
|
|
50786
|
+
lead = c;
|
|
50787
|
+
continue;
|
|
50788
|
+
} else {
|
|
50789
|
+
c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
|
|
50790
|
+
lead = null;
|
|
50791
|
+
}
|
|
50792
|
+
} else {
|
|
50793
|
+
if (c > 0xDBFF || (i + 1 === str.length)) {
|
|
50794
|
+
buf[pos++] = 0xEF;
|
|
50795
|
+
buf[pos++] = 0xBF;
|
|
50796
|
+
buf[pos++] = 0xBD;
|
|
50797
|
+
} else {
|
|
50798
|
+
lead = c;
|
|
50799
|
+
}
|
|
50800
|
+
continue;
|
|
50801
|
+
}
|
|
50802
|
+
} else if (lead) {
|
|
50803
|
+
buf[pos++] = 0xEF;
|
|
50804
|
+
buf[pos++] = 0xBF;
|
|
50805
|
+
buf[pos++] = 0xBD;
|
|
50806
|
+
lead = null;
|
|
50807
|
+
}
|
|
50808
|
+
|
|
50809
|
+
if (c < 0x80) {
|
|
50810
|
+
buf[pos++] = c;
|
|
50811
|
+
} else {
|
|
50812
|
+
if (c < 0x800) {
|
|
50813
|
+
buf[pos++] = c >> 0x6 | 0xC0;
|
|
50814
|
+
} else {
|
|
50815
|
+
if (c < 0x10000) {
|
|
50816
|
+
buf[pos++] = c >> 0xC | 0xE0;
|
|
50817
|
+
} else {
|
|
50818
|
+
buf[pos++] = c >> 0x12 | 0xF0;
|
|
50819
|
+
buf[pos++] = c >> 0xC & 0x3F | 0x80;
|
|
50820
|
+
}
|
|
50821
|
+
buf[pos++] = c >> 0x6 & 0x3F | 0x80;
|
|
50822
|
+
}
|
|
50823
|
+
buf[pos++] = c & 0x3F | 0x80;
|
|
50824
|
+
}
|
|
50825
|
+
}
|
|
50826
|
+
return pos;
|
|
50827
|
+
}
|
|
50828
|
+
|
|
50829
|
+
|
|
52411
50830
|
/***/ }),
|
|
52412
50831
|
|
|
52413
50832
|
/***/ "../../node_modules/webpack/buildin/module.js":
|
|
@@ -53951,7 +52370,7 @@ function calculateUniforms({
|
|
|
53951
52370
|
/*!**********************************!*\
|
|
53952
52371
|
!*** ../extensions/src/index.ts ***!
|
|
53953
52372
|
\**********************************/
|
|
53954
|
-
/*! exports provided: BrushingExtension, DataFilterExtension, Fp64Extension, PathStyleExtension, FillStyleExtension, ClipExtension, project64 */
|
|
52373
|
+
/*! exports provided: BrushingExtension, DataFilterExtension, Fp64Extension, PathStyleExtension, FillStyleExtension, ClipExtension, MaskExtension, project64 */
|
|
53955
52374
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
53956
52375
|
|
|
53957
52376
|
"use strict";
|
|
@@ -53974,8 +52393,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53974
52393
|
/* harmony import */ var _clip_clip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./clip/clip */ "../extensions/src/clip/clip.js");
|
|
53975
52394
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ClipExtension", function() { return _clip_clip__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
|
53976
52395
|
|
|
53977
|
-
/* harmony import */ var
|
|
53978
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
52396
|
+
/* harmony import */ var _mask_mask__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./mask/mask */ "../extensions/src/mask/mask.js");
|
|
52397
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MaskExtension", function() { return _mask_mask__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
|
52398
|
+
|
|
52399
|
+
/* harmony import */ var _fp64_project64__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fp64/project64 */ "../extensions/src/fp64/project64.js");
|
|
52400
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "project64", function() { return _fp64_project64__WEBPACK_IMPORTED_MODULE_7__["default"]; });
|
|
52401
|
+
|
|
53979
52402
|
|
|
53980
52403
|
|
|
53981
52404
|
|
|
@@ -53986,6 +52409,185 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
53986
52409
|
|
|
53987
52410
|
|
|
53988
52411
|
|
|
52412
|
+
/***/ }),
|
|
52413
|
+
|
|
52414
|
+
/***/ "../extensions/src/mask/mask.js":
|
|
52415
|
+
/*!**************************************!*\
|
|
52416
|
+
!*** ../extensions/src/mask/mask.js ***!
|
|
52417
|
+
\**************************************/
|
|
52418
|
+
/*! exports provided: default */
|
|
52419
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
52420
|
+
|
|
52421
|
+
"use strict";
|
|
52422
|
+
__webpack_require__.r(__webpack_exports__);
|
|
52423
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MaskExtension; });
|
|
52424
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
52425
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
52426
|
+
/* harmony import */ var _shader_module__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shader-module */ "../extensions/src/mask/shader-module.js");
|
|
52427
|
+
|
|
52428
|
+
|
|
52429
|
+
const defaultProps = {
|
|
52430
|
+
maskId: ''
|
|
52431
|
+
};
|
|
52432
|
+
class MaskExtension extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["LayerExtension"] {
|
|
52433
|
+
getShaders() {
|
|
52434
|
+
// Infer by geometry if 'maskByInstance' prop isn't explictly set
|
|
52435
|
+
let maskByInstance = ('instancePositions' in this.getAttributeManager().attributes); // Users can override by setting the `maskByInstance` prop
|
|
52436
|
+
|
|
52437
|
+
if ('maskByInstance' in this.props) {
|
|
52438
|
+
maskByInstance = this.props.maskByInstance;
|
|
52439
|
+
}
|
|
52440
|
+
|
|
52441
|
+
this.state.maskByInstance = maskByInstance;
|
|
52442
|
+
return {
|
|
52443
|
+
modules: [_shader_module__WEBPACK_IMPORTED_MODULE_1__["default"]]
|
|
52444
|
+
};
|
|
52445
|
+
}
|
|
52446
|
+
|
|
52447
|
+
draw({
|
|
52448
|
+
uniforms,
|
|
52449
|
+
context,
|
|
52450
|
+
moduleParameters
|
|
52451
|
+
}) {
|
|
52452
|
+
uniforms.mask_maskByInstance = this.state.maskByInstance;
|
|
52453
|
+
const {
|
|
52454
|
+
maskId
|
|
52455
|
+
} = this.props;
|
|
52456
|
+
const {
|
|
52457
|
+
maskChannels
|
|
52458
|
+
} = moduleParameters;
|
|
52459
|
+
const {
|
|
52460
|
+
viewport
|
|
52461
|
+
} = context;
|
|
52462
|
+
|
|
52463
|
+
if (maskChannels && maskChannels[maskId]) {
|
|
52464
|
+
const {
|
|
52465
|
+
index,
|
|
52466
|
+
bounds,
|
|
52467
|
+
coordinateOrigin: fromCoordinateOrigin
|
|
52468
|
+
} = maskChannels[maskId];
|
|
52469
|
+
let {
|
|
52470
|
+
coordinateSystem: fromCoordinateSystem
|
|
52471
|
+
} = maskChannels[maskId];
|
|
52472
|
+
uniforms.mask_enabled = true;
|
|
52473
|
+
uniforms.mask_channel = index;
|
|
52474
|
+
|
|
52475
|
+
if (fromCoordinateSystem === _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].DEFAULT) {
|
|
52476
|
+
fromCoordinateSystem = viewport.isGeospatial ? _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].LNGLAT : _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["COORDINATE_SYSTEM"].CARTESIAN;
|
|
52477
|
+
}
|
|
52478
|
+
|
|
52479
|
+
const opts = {
|
|
52480
|
+
modelMatrix: null,
|
|
52481
|
+
fromCoordinateOrigin,
|
|
52482
|
+
fromCoordinateSystem
|
|
52483
|
+
};
|
|
52484
|
+
const bl = this.projectPosition([bounds[0], bounds[1], 0], opts);
|
|
52485
|
+
const tr = this.projectPosition([bounds[2], bounds[3], 0], opts);
|
|
52486
|
+
uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]];
|
|
52487
|
+
} else {
|
|
52488
|
+
if (maskId) {
|
|
52489
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["log"].warn(`Could not find a mask layer with id: ${maskId}`)();
|
|
52490
|
+
}
|
|
52491
|
+
|
|
52492
|
+
uniforms.mask_enabled = false;
|
|
52493
|
+
}
|
|
52494
|
+
}
|
|
52495
|
+
|
|
52496
|
+
}
|
|
52497
|
+
MaskExtension.extensionName = 'MaskExtension';
|
|
52498
|
+
MaskExtension.defaultProps = defaultProps;
|
|
52499
|
+
|
|
52500
|
+
/***/ }),
|
|
52501
|
+
|
|
52502
|
+
/***/ "../extensions/src/mask/shader-module.js":
|
|
52503
|
+
/*!***********************************************!*\
|
|
52504
|
+
!*** ../extensions/src/mask/shader-module.js ***!
|
|
52505
|
+
\***********************************************/
|
|
52506
|
+
/*! exports provided: default */
|
|
52507
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
52508
|
+
|
|
52509
|
+
"use strict";
|
|
52510
|
+
__webpack_require__.r(__webpack_exports__);
|
|
52511
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
52512
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
52513
|
+
|
|
52514
|
+
const vs = `
|
|
52515
|
+
uniform vec4 mask_bounds;
|
|
52516
|
+
uniform bool mask_maskByInstance;
|
|
52517
|
+
vec2 mask_getCoords(vec4 position) {
|
|
52518
|
+
return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy);
|
|
52519
|
+
}
|
|
52520
|
+
`;
|
|
52521
|
+
const fs = `
|
|
52522
|
+
uniform sampler2D mask_texture;
|
|
52523
|
+
uniform int mask_channel;
|
|
52524
|
+
uniform bool mask_enabled;
|
|
52525
|
+
bool mask_isInBounds(vec2 texCoords) {
|
|
52526
|
+
if (!mask_enabled) {
|
|
52527
|
+
return true;
|
|
52528
|
+
}
|
|
52529
|
+
vec4 maskColor = texture2D(mask_texture, texCoords);
|
|
52530
|
+
float maskValue = 1.0;
|
|
52531
|
+
if (mask_channel == 0) {
|
|
52532
|
+
maskValue = maskColor.r;
|
|
52533
|
+
} else if (mask_channel == 1) {
|
|
52534
|
+
maskValue = maskColor.g;
|
|
52535
|
+
} else if (mask_channel == 2) {
|
|
52536
|
+
maskValue = maskColor.b;
|
|
52537
|
+
} else if (mask_channel == 3) {
|
|
52538
|
+
maskValue = maskColor.a;
|
|
52539
|
+
}
|
|
52540
|
+
return maskValue < 0.5;
|
|
52541
|
+
}
|
|
52542
|
+
`;
|
|
52543
|
+
const inject = {
|
|
52544
|
+
'vs:#decl': `
|
|
52545
|
+
varying vec2 mask_texCoords;
|
|
52546
|
+
`,
|
|
52547
|
+
'vs:#main-end': `
|
|
52548
|
+
vec4 mask_common_position;
|
|
52549
|
+
if (mask_maskByInstance) {
|
|
52550
|
+
mask_common_position = project_position(vec4(geometry.worldPosition, 1.0));
|
|
52551
|
+
} else {
|
|
52552
|
+
mask_common_position = geometry.position;
|
|
52553
|
+
}
|
|
52554
|
+
mask_texCoords = mask_getCoords(mask_common_position);
|
|
52555
|
+
`,
|
|
52556
|
+
'fs:#decl': `
|
|
52557
|
+
varying vec2 mask_texCoords;
|
|
52558
|
+
`,
|
|
52559
|
+
'fs:#main-start': `
|
|
52560
|
+
if (mask_enabled) {
|
|
52561
|
+
bool mask = mask_isInBounds(mask_texCoords);
|
|
52562
|
+
|
|
52563
|
+
// Debug: show extent of render target
|
|
52564
|
+
// gl_FragColor = vec4(mask_texCoords, 0.0, 1.0);
|
|
52565
|
+
gl_FragColor = texture2D(mask_texture, mask_texCoords);
|
|
52566
|
+
|
|
52567
|
+
if (!mask) discard;
|
|
52568
|
+
}
|
|
52569
|
+
`
|
|
52570
|
+
};
|
|
52571
|
+
|
|
52572
|
+
const getMaskUniforms = (opts = {}) => {
|
|
52573
|
+
const uniforms = {};
|
|
52574
|
+
|
|
52575
|
+
if (opts.maskMap) {
|
|
52576
|
+
uniforms.mask_texture = opts.maskMap;
|
|
52577
|
+
}
|
|
52578
|
+
|
|
52579
|
+
return uniforms;
|
|
52580
|
+
};
|
|
52581
|
+
|
|
52582
|
+
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
52583
|
+
name: 'mask',
|
|
52584
|
+
dependencies: [_deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["project"]],
|
|
52585
|
+
vs,
|
|
52586
|
+
fs,
|
|
52587
|
+
inject,
|
|
52588
|
+
getUniforms: getMaskUniforms
|
|
52589
|
+
});
|
|
52590
|
+
|
|
53989
52591
|
/***/ }),
|
|
53990
52592
|
|
|
53991
52593
|
/***/ "../extensions/src/path-style/path-style.js":
|
|
@@ -54261,450 +52863,6 @@ attribute float instanceOffsets;
|
|
|
54261
52863
|
|
|
54262
52864
|
/***/ }),
|
|
54263
52865
|
|
|
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
52866
|
/***/ "./bundle.ts":
|
|
54709
52867
|
/*!*******************!*\
|
|
54710
52868
|
!*** ./bundle.ts ***!
|
|
@@ -54730,7 +52888,7 @@ module.exports = Object.assign(deck, {
|
|
|
54730
52888
|
/*!**************************!*\
|
|
54731
52889
|
!*** ./src/api/index.js ***!
|
|
54732
52890
|
\**************************/
|
|
54733
|
-
/*! exports provided: FORMATS, MAP_TYPES, API_VERSIONS, getDataV2, CONNECTIONS, fetchLayerData, fetchMap, getData, mapInstantiation */
|
|
52891
|
+
/*! exports provided: FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, getDataV2, CONNECTIONS, fetchLayerData, fetchMap, getData, mapInstantiation */
|
|
54734
52892
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54735
52893
|
|
|
54736
52894
|
"use strict";
|
|
@@ -54738,6 +52896,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54738
52896
|
/* harmony import */ var _maps_api_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./maps-api-common */ "./src/api/maps-api-common.js");
|
|
54739
52897
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["FORMATS"]; });
|
|
54740
52898
|
|
|
52899
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["TILE_FORMATS"]; });
|
|
52900
|
+
|
|
54741
52901
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["MAP_TYPES"]; });
|
|
54742
52902
|
|
|
54743
52903
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _maps_api_common__WEBPACK_IMPORTED_MODULE_0__["API_VERSIONS"]; });
|
|
@@ -54766,24 +52926,26 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
54766
52926
|
/*!******************************!*\
|
|
54767
52927
|
!*** ./src/api/layer-map.js ***!
|
|
54768
52928
|
\******************************/
|
|
54769
|
-
/*! exports provided:
|
|
52929
|
+
/*! exports provided: getLayer, getColorAccessor, getSizeAccessor, getTextAccessor, getTextPixelOffsetAccessor, _domainFromValues */
|
|
54770
52930
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54771
52931
|
|
|
54772
52932
|
"use strict";
|
|
54773
52933
|
__webpack_require__.r(__webpack_exports__);
|
|
54774
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "
|
|
52934
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLayer", function() { return getLayer; });
|
|
54775
52935
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getColorAccessor", function() { return getColorAccessor; });
|
|
54776
52936
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSizeAccessor", function() { return getSizeAccessor; });
|
|
54777
52937
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextAccessor", function() { return getTextAccessor; });
|
|
54778
52938
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTextPixelOffsetAccessor", function() { return getTextPixelOffsetAccessor; });
|
|
52939
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_domainFromValues", function() { return domainFromValues; });
|
|
54779
52940
|
/* harmony import */ var d3_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3-array */ "../../node_modules/d3-array/src/index.js");
|
|
54780
52941
|
/* harmony import */ var d3_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3-color */ "../../node_modules/d3-color/src/index.js");
|
|
54781
52942
|
/* harmony import */ var d3_scale__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! d3-scale */ "../../node_modules/d3-scale/src/index.js");
|
|
54782
52943
|
/* harmony import */ var d3_format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! d3-format */ "../../node_modules/d3-format/src/index.js");
|
|
54783
52944
|
/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! moment-timezone */ "../../node_modules/moment-timezone/index.js");
|
|
54784
52945
|
/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_4__);
|
|
54785
|
-
/* harmony import */ var
|
|
54786
|
-
/* harmony import */ var
|
|
52946
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
52947
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_5__);
|
|
52948
|
+
|
|
54787
52949
|
|
|
54788
52950
|
|
|
54789
52951
|
|
|
@@ -54841,44 +53003,50 @@ function mergePropMaps(a, b) {
|
|
|
54841
53003
|
};
|
|
54842
53004
|
}
|
|
54843
53005
|
|
|
54844
|
-
|
|
54845
|
-
|
|
54846
|
-
|
|
54847
|
-
|
|
54848
|
-
|
|
54849
|
-
|
|
53006
|
+
function getLayer(type, config) {
|
|
53007
|
+
const hexagonId = config.columns?.hex_id;
|
|
53008
|
+
const layer = {
|
|
53009
|
+
point: {
|
|
53010
|
+
Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
|
|
53011
|
+
propMap: mergePropMaps(sharedPropMap, {
|
|
53012
|
+
visConfig: {
|
|
53013
|
+
outline: 'stroked'
|
|
53014
|
+
}
|
|
53015
|
+
}),
|
|
53016
|
+
defaultProps
|
|
53017
|
+
},
|
|
53018
|
+
geojson: {
|
|
53019
|
+
Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["GeoJsonLayer"],
|
|
53020
|
+
propMap: sharedPropMap,
|
|
53021
|
+
defaultProps: { ...defaultProps,
|
|
53022
|
+
lineWidthScale: 2
|
|
54850
53023
|
}
|
|
54851
|
-
}
|
|
54852
|
-
|
|
54853
|
-
|
|
54854
|
-
|
|
54855
|
-
|
|
54856
|
-
|
|
54857
|
-
|
|
54858
|
-
|
|
54859
|
-
|
|
54860
|
-
|
|
54861
|
-
|
|
54862
|
-
|
|
54863
|
-
|
|
54864
|
-
|
|
54865
|
-
|
|
54866
|
-
|
|
53024
|
+
},
|
|
53025
|
+
hexagonId: {
|
|
53026
|
+
Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["H3HexagonLayer"],
|
|
53027
|
+
propMap: mergePropMaps(sharedPropMap, {
|
|
53028
|
+
visConfig: {
|
|
53029
|
+
coverage: 'coverage',
|
|
53030
|
+
elevationScale: 'elevationScale'
|
|
53031
|
+
}
|
|
53032
|
+
}),
|
|
53033
|
+
defaultProps: { ...defaultProps,
|
|
53034
|
+
getHexagon: d => d[hexagonId]
|
|
53035
|
+
}
|
|
53036
|
+
},
|
|
53037
|
+
mvt: {
|
|
53038
|
+
Layer: _deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["MVTLayer"],
|
|
53039
|
+
propMap: sharedPropMap,
|
|
53040
|
+
defaultProps: { ...defaultProps,
|
|
53041
|
+
pointRadiusScale: 0.3,
|
|
53042
|
+
lineWidthScale: 2,
|
|
53043
|
+
uniqueIdProperty: 'geoid'
|
|
54867
53044
|
}
|
|
54868
|
-
}),
|
|
54869
|
-
defaultProps: { ...defaultProps,
|
|
54870
|
-
getHexagon: d => d.h3
|
|
54871
|
-
}
|
|
54872
|
-
},
|
|
54873
|
-
mvt: {
|
|
54874
|
-
Layer: _deck_gl_geo_layers__WEBPACK_IMPORTED_MODULE_5__["MVTLayer"],
|
|
54875
|
-
propMap: sharedPropMap,
|
|
54876
|
-
defaultProps: { ...defaultProps,
|
|
54877
|
-
pointRadiusScale: 0.3,
|
|
54878
|
-
lineWidthScale: 2
|
|
54879
53045
|
}
|
|
54880
|
-
}
|
|
54881
|
-
};
|
|
53046
|
+
}[type];
|
|
53047
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_5__["log"].assert(layer, `Unsupported layer type: ${type}`);
|
|
53048
|
+
return layer;
|
|
53049
|
+
}
|
|
54882
53050
|
|
|
54883
53051
|
function domainFromAttribute(attribute, scaleType) {
|
|
54884
53052
|
if (scaleType === 'ordinal' || scaleType === 'point') {
|
|
@@ -54899,6 +53067,11 @@ function domainFromAttribute(attribute, scaleType) {
|
|
|
54899
53067
|
function domainFromValues(values, scaleType) {
|
|
54900
53068
|
if (scaleType === 'ordinal') {
|
|
54901
53069
|
return [...new Set(values)].sort();
|
|
53070
|
+
} else if (scaleType === 'quantile') {
|
|
53071
|
+
return values.sort((a, b) => a - b);
|
|
53072
|
+
} else if (scaleType === 'log') {
|
|
53073
|
+
const [d0, d1] = Object(d3_array__WEBPACK_IMPORTED_MODULE_0__["extent"])(values);
|
|
53074
|
+
return [d0 === 0 ? 1e-5 : d0, d1];
|
|
54902
53075
|
}
|
|
54903
53076
|
|
|
54904
53077
|
return Object(d3_array__WEBPACK_IMPORTED_MODULE_0__["extent"])(values);
|
|
@@ -55008,13 +53181,14 @@ function getTextPixelOffsetAccessor({
|
|
|
55008
53181
|
} : calculateOffset(radius);
|
|
55009
53182
|
}
|
|
55010
53183
|
|
|
53184
|
+
|
|
55011
53185
|
/***/ }),
|
|
55012
53186
|
|
|
55013
53187
|
/***/ "./src/api/maps-api-common.js":
|
|
55014
53188
|
/*!************************************!*\
|
|
55015
53189
|
!*** ./src/api/maps-api-common.js ***!
|
|
55016
53190
|
\************************************/
|
|
55017
|
-
/*! exports provided: DEFAULT_USER_COMPONENT_IN_URL, DEFAULT_REGION_COMPONENT_IN_URL, API_VERSIONS, DEFAULT_MAPS_URL_FORMAT, MAP_TYPES, FORMATS, encodeParameter */
|
|
53191
|
+
/*! exports provided: DEFAULT_USER_COMPONENT_IN_URL, DEFAULT_REGION_COMPONENT_IN_URL, API_VERSIONS, DEFAULT_MAPS_URL_FORMAT, MAP_TYPES, FORMATS, TILE_FORMATS, encodeParameter */
|
|
55018
53192
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
55019
53193
|
|
|
55020
53194
|
"use strict";
|
|
@@ -55025,6 +53199,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
55025
53199
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAPS_URL_FORMAT", function() { return DEFAULT_MAPS_URL_FORMAT; });
|
|
55026
53200
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return MAP_TYPES; });
|
|
55027
53201
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return FORMATS; });
|
|
53202
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return TILE_FORMATS; });
|
|
55028
53203
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeParameter", function() { return encodeParameter; });
|
|
55029
53204
|
const DEFAULT_USER_COMPONENT_IN_URL = '{user}';
|
|
55030
53205
|
const DEFAULT_REGION_COMPONENT_IN_URL = '{region}';
|
|
@@ -55048,6 +53223,12 @@ const FORMATS = {
|
|
|
55048
53223
|
NDJSON: 'ndjson',
|
|
55049
53224
|
TILEJSON: 'tilejson',
|
|
55050
53225
|
JSON: 'json'
|
|
53226
|
+
}; // AVAILABLE FORMATS FOR TILES
|
|
53227
|
+
|
|
53228
|
+
const TILE_FORMATS = {
|
|
53229
|
+
MVT: 'mvt',
|
|
53230
|
+
GEOJSON: 'geojson',
|
|
53231
|
+
BINARY: 'binary'
|
|
55051
53232
|
};
|
|
55052
53233
|
/**
|
|
55053
53234
|
* Simple encode parameter
|
|
@@ -55282,6 +53463,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
55282
53463
|
|
|
55283
53464
|
|
|
55284
53465
|
const MAX_GET_LENGTH = 2048;
|
|
53466
|
+
const DEFAULT_CLIENT = 'deck-gl-carto';
|
|
55285
53467
|
/**
|
|
55286
53468
|
* Request against Maps API
|
|
55287
53469
|
*/
|
|
@@ -55365,9 +53547,10 @@ function getParameters({
|
|
|
55365
53547
|
source,
|
|
55366
53548
|
geoColumn,
|
|
55367
53549
|
columns,
|
|
55368
|
-
schema
|
|
53550
|
+
schema,
|
|
53551
|
+
clientId
|
|
55369
53552
|
}) {
|
|
55370
|
-
const parameters = [Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('client',
|
|
53553
|
+
const parameters = [Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('client', clientId || DEFAULT_CLIENT)];
|
|
55371
53554
|
|
|
55372
53555
|
if (schema) {
|
|
55373
53556
|
parameters.push(Object(_maps_api_common__WEBPACK_IMPORTED_MODULE_1__["encodeParameter"])('schema', true));
|
|
@@ -55396,7 +53579,8 @@ async function mapInstantiation({
|
|
|
55396
53579
|
credentials,
|
|
55397
53580
|
geoColumn,
|
|
55398
53581
|
columns,
|
|
55399
|
-
schema
|
|
53582
|
+
schema,
|
|
53583
|
+
clientId
|
|
55400
53584
|
}) {
|
|
55401
53585
|
const baseUrl = `${credentials.mapsUrl}/${connection}/${type}`;
|
|
55402
53586
|
const url = `${baseUrl}?${getParameters({
|
|
@@ -55404,7 +53588,8 @@ async function mapInstantiation({
|
|
|
55404
53588
|
source,
|
|
55405
53589
|
geoColumn,
|
|
55406
53590
|
columns,
|
|
55407
|
-
schema
|
|
53591
|
+
schema,
|
|
53592
|
+
clientId
|
|
55408
53593
|
})}`;
|
|
55409
53594
|
const {
|
|
55410
53595
|
accessToken
|
|
@@ -55415,7 +53600,7 @@ async function mapInstantiation({
|
|
|
55415
53600
|
// need to be a POST request
|
|
55416
53601
|
const body = JSON.stringify({
|
|
55417
53602
|
q: source,
|
|
55418
|
-
client:
|
|
53603
|
+
client: clientId || DEFAULT_CLIENT
|
|
55419
53604
|
});
|
|
55420
53605
|
return await request({
|
|
55421
53606
|
method: 'POST',
|
|
@@ -55465,7 +53650,8 @@ async function fetchLayerData({
|
|
|
55465
53650
|
geoColumn,
|
|
55466
53651
|
columns,
|
|
55467
53652
|
format,
|
|
55468
|
-
schema
|
|
53653
|
+
schema,
|
|
53654
|
+
clientId
|
|
55469
53655
|
}) {
|
|
55470
53656
|
// Internally we split data fetching into two parts to allow us to
|
|
55471
53657
|
// conditionally fetch the actual data, depending on the metadata state
|
|
@@ -55482,7 +53668,8 @@ async function fetchLayerData({
|
|
|
55482
53668
|
geoColumn,
|
|
55483
53669
|
columns,
|
|
55484
53670
|
format,
|
|
55485
|
-
schema
|
|
53671
|
+
schema,
|
|
53672
|
+
clientId
|
|
55486
53673
|
});
|
|
55487
53674
|
const data = await request({
|
|
55488
53675
|
url,
|
|
@@ -55509,7 +53696,8 @@ async function _fetchDataUrl({
|
|
|
55509
53696
|
geoColumn,
|
|
55510
53697
|
columns,
|
|
55511
53698
|
format,
|
|
55512
|
-
schema
|
|
53699
|
+
schema,
|
|
53700
|
+
clientId
|
|
55513
53701
|
}) {
|
|
55514
53702
|
const defaultCredentials = Object(_config__WEBPACK_IMPORTED_MODULE_0__["getDefaultCredentials"])(); // Only pick up default credentials if they have been defined for
|
|
55515
53703
|
// correct API version
|
|
@@ -55535,7 +53723,8 @@ async function _fetchDataUrl({
|
|
|
55535
53723
|
credentials: localCreds,
|
|
55536
53724
|
geoColumn,
|
|
55537
53725
|
columns,
|
|
55538
|
-
schema
|
|
53726
|
+
schema,
|
|
53727
|
+
clientId
|
|
55539
53728
|
});
|
|
55540
53729
|
let url;
|
|
55541
53730
|
let mapFormat;
|
|
@@ -55576,7 +53765,8 @@ async function getData({
|
|
|
55576
53765
|
credentials,
|
|
55577
53766
|
geoColumn,
|
|
55578
53767
|
columns,
|
|
55579
|
-
format
|
|
53768
|
+
format,
|
|
53769
|
+
clientId
|
|
55580
53770
|
}) {
|
|
55581
53771
|
_deck_gl_core__WEBPACK_IMPORTED_MODULE_3__["log"].deprecated('getData', 'fetchLayerData')();
|
|
55582
53772
|
const layerData = await fetchLayerData({
|
|
@@ -55587,13 +53777,14 @@ async function getData({
|
|
|
55587
53777
|
geoColumn,
|
|
55588
53778
|
columns,
|
|
55589
53779
|
format,
|
|
55590
|
-
schema: false
|
|
53780
|
+
schema: false,
|
|
53781
|
+
clientId
|
|
55591
53782
|
});
|
|
55592
53783
|
return layerData.data;
|
|
55593
53784
|
}
|
|
55594
53785
|
/* global clearInterval, setInterval, URLSearchParams */
|
|
55595
53786
|
|
|
55596
|
-
async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
53787
|
+
async function _fetchMapDataset(dataset, accessToken, credentials, clientId) {
|
|
55597
53788
|
// First fetch metadata
|
|
55598
53789
|
const {
|
|
55599
53790
|
connectionName: connection,
|
|
@@ -55609,7 +53800,8 @@ async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
|
55609
53800
|
},
|
|
55610
53801
|
connection,
|
|
55611
53802
|
source,
|
|
55612
|
-
type
|
|
53803
|
+
type,
|
|
53804
|
+
clientId
|
|
55613
53805
|
}); // Extract the last time the data changed
|
|
55614
53806
|
|
|
55615
53807
|
const cache = parseInt(new URLSearchParams(url).get('cache'), 10);
|
|
@@ -55632,13 +53824,14 @@ async function _fetchMapDataset(dataset, accessToken, credentials) {
|
|
|
55632
53824
|
async function fillInMapDatasets({
|
|
55633
53825
|
datasets,
|
|
55634
53826
|
token
|
|
55635
|
-
}, credentials) {
|
|
55636
|
-
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials));
|
|
53827
|
+
}, clientId, credentials) {
|
|
53828
|
+
const promises = datasets.map(dataset => _fetchMapDataset(dataset, token, credentials, clientId));
|
|
55637
53829
|
return await Promise.all(promises);
|
|
55638
53830
|
}
|
|
55639
53831
|
|
|
55640
53832
|
async function fetchMap({
|
|
55641
53833
|
cartoMapId,
|
|
53834
|
+
clientId,
|
|
55642
53835
|
credentials,
|
|
55643
53836
|
autoRefresh,
|
|
55644
53837
|
onNewData
|
|
@@ -55671,7 +53864,7 @@ async function fetchMap({
|
|
|
55671
53864
|
|
|
55672
53865
|
if (autoRefresh) {
|
|
55673
53866
|
const intervalId = setInterval(async () => {
|
|
55674
|
-
const changed = await fillInMapDatasets(map, credentials);
|
|
53867
|
+
const changed = await fillInMapDatasets(map, clientId, credentials);
|
|
55675
53868
|
|
|
55676
53869
|
if (changed.some(v => v === true)) {
|
|
55677
53870
|
onNewData(Object(_parseMap__WEBPACK_IMPORTED_MODULE_2__["parseMap"])(map));
|
|
@@ -55684,7 +53877,7 @@ async function fetchMap({
|
|
|
55684
53877
|
} // Mutates map.datasets so that dataset.data contains data
|
|
55685
53878
|
|
|
55686
53879
|
|
|
55687
|
-
await fillInMapDatasets(map, credentials);
|
|
53880
|
+
await fillInMapDatasets(map, clientId, credentials);
|
|
55688
53881
|
return { ...Object(_parseMap__WEBPACK_IMPORTED_MODULE_2__["parseMap"])(map),
|
|
55689
53882
|
...{
|
|
55690
53883
|
stopAutoRefresh
|
|
@@ -55740,31 +53933,35 @@ function parseMap(json) {
|
|
|
55740
53933
|
config,
|
|
55741
53934
|
visualChannels
|
|
55742
53935
|
}) => {
|
|
55743
|
-
|
|
55744
|
-
|
|
55745
|
-
|
|
55746
|
-
|
|
55747
|
-
|
|
55748
|
-
|
|
55749
|
-
|
|
55750
|
-
|
|
55751
|
-
|
|
55752
|
-
|
|
55753
|
-
|
|
55754
|
-
|
|
55755
|
-
|
|
55756
|
-
|
|
55757
|
-
|
|
55758
|
-
|
|
55759
|
-
|
|
55760
|
-
|
|
55761
|
-
|
|
55762
|
-
|
|
55763
|
-
|
|
55764
|
-
|
|
55765
|
-
|
|
53936
|
+
try {
|
|
53937
|
+
const {
|
|
53938
|
+
Layer,
|
|
53939
|
+
propMap,
|
|
53940
|
+
defaultProps
|
|
53941
|
+
} = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getLayer"])(type, config);
|
|
53942
|
+
const {
|
|
53943
|
+
dataId
|
|
53944
|
+
} = config;
|
|
53945
|
+
const dataset = datasets.find(d => d.id === dataId);
|
|
53946
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(dataset, `No dataset matching dataId: ${dataId}`);
|
|
53947
|
+
const {
|
|
53948
|
+
data
|
|
53949
|
+
} = dataset;
|
|
53950
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].assert(data, `No data loaded for dataId: ${dataId}`);
|
|
53951
|
+
return new Layer({
|
|
53952
|
+
id,
|
|
53953
|
+
data,
|
|
53954
|
+
...defaultProps,
|
|
53955
|
+
...createBlendingProps(layerBlending),
|
|
53956
|
+
...(!config.textLabel && createInteractionProps(interactionConfig)),
|
|
53957
|
+
...createStyleProps(config, propMap),
|
|
53958
|
+
...createChannelProps(visualChannels, type, config, data) // Must come after style
|
|
55766
53959
|
|
|
55767
|
-
|
|
53960
|
+
});
|
|
53961
|
+
} catch (e) {
|
|
53962
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_2__["log"].error(e.message)();
|
|
53963
|
+
return undefined;
|
|
53964
|
+
}
|
|
55768
53965
|
})
|
|
55769
53966
|
};
|
|
55770
53967
|
}
|
|
@@ -55890,8 +54087,8 @@ function createChannelProps(visualChannels, type, config, data) {
|
|
|
55890
54087
|
}
|
|
55891
54088
|
|
|
55892
54089
|
if (strokeColorField) {
|
|
55893
|
-
const opacity = visConfig.strokeOpacity !== undefined ? visConfig.strokeOpacity
|
|
55894
|
-
result.getLineColor = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getColorAccessor"])(strokeColorField, strokeColorScale, visConfig.
|
|
54090
|
+
const opacity = visConfig.strokeOpacity !== undefined ? visConfig.strokeOpacity : 1;
|
|
54091
|
+
result.getLineColor = Object(_layer_map__WEBPACK_IMPORTED_MODULE_1__["getColorAccessor"])(strokeColorField, strokeColorScale, visConfig.strokeColorRange, opacity, data);
|
|
55895
54092
|
}
|
|
55896
54093
|
|
|
55897
54094
|
if (heightField) {
|
|
@@ -56008,7 +54205,7 @@ function buildMapsUrlFromBase(apiBaseUrl) {
|
|
|
56008
54205
|
/*!**********************!*\
|
|
56009
54206
|
!*** ./src/index.js ***!
|
|
56010
54207
|
\**********************/
|
|
56011
|
-
/*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, getData, _mapInstantiation */
|
|
54208
|
+
/*! exports provided: getDefaultCredentials, setDefaultCredentials, CartoLayer, _CartoDynamicTileLayer, BASEMAP, colorBins, colorCategories, colorContinuous, FORMATS, TILE_FORMATS, MAP_TYPES, API_VERSIONS, fetchLayerData, fetchMap, _getDataV2, getData, _mapInstantiation */
|
|
56012
54209
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
56013
54210
|
|
|
56014
54211
|
"use strict";
|
|
@@ -56021,34 +54218,40 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56021
54218
|
/* harmony import */ var _layers_carto_layer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./layers/carto-layer */ "./src/layers/carto-layer.js");
|
|
56022
54219
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CartoLayer", function() { return _layers_carto_layer__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
|
56023
54220
|
|
|
56024
|
-
/* harmony import */ var
|
|
56025
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54221
|
+
/* harmony import */ var _layers_carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./layers/carto-dynamic-tile-layer */ "./src/layers/carto-dynamic-tile-layer.js");
|
|
54222
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_CartoDynamicTileLayer", function() { return _layers_carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
|
54223
|
+
|
|
54224
|
+
/* harmony import */ var _basemap__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./basemap */ "./src/basemap.js");
|
|
54225
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BASEMAP", function() { return _basemap__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
|
56026
54226
|
|
|
56027
|
-
/* harmony import */ var
|
|
56028
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return
|
|
54227
|
+
/* harmony import */ var _style_color_bins_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style/color-bins-style */ "./src/style/color-bins-style.js");
|
|
54228
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorBins", function() { return _style_color_bins_style__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
56029
54229
|
|
|
56030
|
-
/* harmony import */ var
|
|
56031
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return
|
|
54230
|
+
/* harmony import */ var _style_color_categories_style__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style/color-categories-style */ "./src/style/color-categories-style.js");
|
|
54231
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorCategories", function() { return _style_color_categories_style__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
|
56032
54232
|
|
|
56033
|
-
/* harmony import */ var
|
|
56034
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return
|
|
54233
|
+
/* harmony import */ var _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style/color-continuous-style */ "./src/style/color-continuous-style.js");
|
|
54234
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorContinuous", function() { return _style_color_continuous_style__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
|
56035
54235
|
|
|
56036
|
-
/* harmony import */ var
|
|
56037
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return
|
|
54236
|
+
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./api */ "./src/api/index.js");
|
|
54237
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["FORMATS"]; });
|
|
56038
54238
|
|
|
56039
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54239
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TILE_FORMATS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["TILE_FORMATS"]; });
|
|
56040
54240
|
|
|
56041
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54241
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAP_TYPES", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["MAP_TYPES"]; });
|
|
56042
54242
|
|
|
56043
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54243
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "API_VERSIONS", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["API_VERSIONS"]; });
|
|
56044
54244
|
|
|
56045
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54245
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchLayerData", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["fetchLayerData"]; });
|
|
56046
54246
|
|
|
56047
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54247
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchMap", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["fetchMap"]; });
|
|
56048
54248
|
|
|
56049
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "
|
|
54249
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_getDataV2", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["getDataV2"]; });
|
|
54250
|
+
|
|
54251
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getData", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["getData"]; });
|
|
54252
|
+
|
|
54253
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_7__["mapInstantiation"]; });
|
|
56050
54254
|
|
|
56051
|
-
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_mapInstantiation", function() { return _api__WEBPACK_IMPORTED_MODULE_6__["mapInstantiation"]; });
|
|
56052
54255
|
|
|
56053
54256
|
|
|
56054
54257
|
|
|
@@ -56070,12 +54273,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56070
54273
|
"use strict";
|
|
56071
54274
|
__webpack_require__.r(__webpack_exports__);
|
|
56072
54275
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return CartoDynamicTileLayer; });
|
|
56073
|
-
/* harmony import */ var
|
|
56074
|
-
/* harmony import */ var
|
|
56075
|
-
/* harmony import */ var
|
|
56076
|
-
/* harmony import */ var
|
|
56077
|
-
/* harmony import */ var
|
|
56078
|
-
/* harmony import */ var
|
|
54276
|
+
/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! pbf */ "../../node_modules/pbf/index.js");
|
|
54277
|
+
/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(pbf__WEBPACK_IMPORTED_MODULE_0__);
|
|
54278
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @deck.gl/core */ "@deck.gl/core");
|
|
54279
|
+
/* harmony import */ var _deck_gl_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_deck_gl_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
54280
|
+
/* harmony import */ var _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @deck.gl/extensions */ "../extensions/src/index.ts");
|
|
54281
|
+
/* harmony import */ var _loaders_gl_gis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @loaders.gl/gis */ "../../node_modules/@loaders.gl/gis/dist/esm/index.js");
|
|
54282
|
+
/* harmony import */ var _schema_carto_dynamic_tile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./schema/carto-dynamic-tile */ "./src/layers/schema/carto-dynamic-tile.js");
|
|
54283
|
+
/* harmony import */ var _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../api/maps-api-common */ "./src/api/maps-api-common.js");
|
|
56079
54284
|
/* global TextDecoder */
|
|
56080
54285
|
|
|
56081
54286
|
|
|
@@ -56085,15 +54290,56 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
56085
54290
|
|
|
56086
54291
|
|
|
56087
54292
|
|
|
54293
|
+
|
|
56088
54294
|
function parseJSON(arrayBuffer) {
|
|
56089
54295
|
return JSON.parse(new TextDecoder().decode(arrayBuffer));
|
|
56090
54296
|
}
|
|
56091
54297
|
|
|
54298
|
+
function parsePbf(buffer) {
|
|
54299
|
+
const pbf = new pbf__WEBPACK_IMPORTED_MODULE_0___default.a(buffer);
|
|
54300
|
+
const tile = _schema_carto_dynamic_tile__WEBPACK_IMPORTED_MODULE_4__["Tile"].read(pbf);
|
|
54301
|
+
return tile;
|
|
54302
|
+
}
|
|
54303
|
+
|
|
54304
|
+
function unpackProperties(properties) {
|
|
54305
|
+
if (!properties || !properties.length) {
|
|
54306
|
+
return [];
|
|
54307
|
+
}
|
|
54308
|
+
|
|
54309
|
+
return properties.map(item => {
|
|
54310
|
+
const currentRecord = {};
|
|
54311
|
+
item.data.forEach(({
|
|
54312
|
+
key,
|
|
54313
|
+
value
|
|
54314
|
+
}) => {
|
|
54315
|
+
currentRecord[key] = value;
|
|
54316
|
+
});
|
|
54317
|
+
return currentRecord;
|
|
54318
|
+
});
|
|
54319
|
+
}
|
|
54320
|
+
|
|
56092
54321
|
function parseCartoDynamicTile(arrayBuffer, options) {
|
|
56093
54322
|
if (!arrayBuffer) return null;
|
|
56094
54323
|
const formatTiles = options && options.cartoDynamicTile && options.cartoDynamicTile.formatTiles;
|
|
56095
|
-
if (formatTiles ===
|
|
56096
|
-
|
|
54324
|
+
if (formatTiles === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"].GEOJSON) return Object(_loaders_gl_gis__WEBPACK_IMPORTED_MODULE_3__["geojsonToBinary"])(parseJSON(arrayBuffer).features);
|
|
54325
|
+
const tile = parsePbf(arrayBuffer);
|
|
54326
|
+
const {
|
|
54327
|
+
points,
|
|
54328
|
+
lines,
|
|
54329
|
+
polygons
|
|
54330
|
+
} = tile;
|
|
54331
|
+
const data = {
|
|
54332
|
+
points: { ...points,
|
|
54333
|
+
properties: unpackProperties(points.properties)
|
|
54334
|
+
},
|
|
54335
|
+
lines: { ...lines,
|
|
54336
|
+
properties: unpackProperties(lines.properties)
|
|
54337
|
+
},
|
|
54338
|
+
polygons: { ...polygons,
|
|
54339
|
+
properties: unpackProperties(polygons.properties)
|
|
54340
|
+
}
|
|
54341
|
+
};
|
|
54342
|
+
return data;
|
|
56097
54343
|
}
|
|
56098
54344
|
|
|
56099
54345
|
const CartoDynamicTileLoader = {
|
|
@@ -56108,13 +54354,13 @@ const CartoDynamicTileLoader = {
|
|
|
56108
54354
|
parseSync: parseCartoDynamicTile,
|
|
56109
54355
|
options: {
|
|
56110
54356
|
cartoDynamicTile: {
|
|
56111
|
-
formatTiles:
|
|
54357
|
+
formatTiles: _api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"].BINARY
|
|
56112
54358
|
}
|
|
56113
54359
|
}
|
|
56114
54360
|
};
|
|
56115
|
-
class CartoDynamicTileLayer extends
|
|
54361
|
+
class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["MVTLayer"] {
|
|
56116
54362
|
getTileData(tile) {
|
|
56117
|
-
let url = Object(
|
|
54363
|
+
let url = Object(_deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["_getURLFromTemplate"])(this.state.data, tile);
|
|
56118
54364
|
|
|
56119
54365
|
if (!url) {
|
|
56120
54366
|
return Promise.reject('Invalid URL');
|
|
@@ -56133,9 +54379,9 @@ class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
56133
54379
|
};
|
|
56134
54380
|
|
|
56135
54381
|
if (formatTiles) {
|
|
56136
|
-
|
|
56137
|
-
url += `&${Object(
|
|
56138
|
-
loadOptions.
|
|
54382
|
+
_deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["log"].assert(Object.values(_api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["TILE_FORMATS"]).includes(formatTiles), `Invalid value for formatTiles: ${formatTiles}. Use value from TILE_FORMATS`);
|
|
54383
|
+
url += `&${Object(_api_maps_api_common__WEBPACK_IMPORTED_MODULE_5__["encodeParameter"])('formatTiles', formatTiles)}`;
|
|
54384
|
+
loadOptions.cartoDynamicTile = {
|
|
56139
54385
|
formatTiles
|
|
56140
54386
|
};
|
|
56141
54387
|
}
|
|
@@ -56162,16 +54408,16 @@ class CartoDynamicTileLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["
|
|
|
56162
54408
|
north
|
|
56163
54409
|
}
|
|
56164
54410
|
} = props.tile;
|
|
56165
|
-
props.extensions = [new
|
|
54411
|
+
props.extensions = [new _deck_gl_extensions__WEBPACK_IMPORTED_MODULE_2__["ClipExtension"](), ...props.extensions];
|
|
56166
54412
|
props.clipBounds = [west, south, east, north];
|
|
56167
|
-
const subLayer = new
|
|
54413
|
+
const subLayer = new _deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["GeoJsonLayer"]({ ...props
|
|
56168
54414
|
});
|
|
56169
54415
|
return subLayer;
|
|
56170
54416
|
}
|
|
56171
54417
|
|
|
56172
54418
|
}
|
|
56173
54419
|
CartoDynamicTileLayer.layerName = 'CartoDynamicTileLayer';
|
|
56174
|
-
CartoDynamicTileLayer.defaultProps = { ...
|
|
54420
|
+
CartoDynamicTileLayer.defaultProps = { ..._deck_gl_core__WEBPACK_IMPORTED_MODULE_1__["MVTLayer"].defaultProps,
|
|
56175
54421
|
loaders: [CartoDynamicTileLoader]
|
|
56176
54422
|
};
|
|
56177
54423
|
|
|
@@ -56229,6 +54475,11 @@ const defaultProps = {
|
|
|
56229
54475
|
connection: null,
|
|
56230
54476
|
// (String, optional): format of data
|
|
56231
54477
|
format: null,
|
|
54478
|
+
// (String, optional): format of data
|
|
54479
|
+
formatTiles: _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["TILE_FORMATS"].GEOJSON,
|
|
54480
|
+
// TODO: for 8.7 release switch to BINARY
|
|
54481
|
+
// (String, optional): clientId identifier used for internal tracing, place here a string to identify the client who is doing the request.
|
|
54482
|
+
clientId: null,
|
|
56232
54483
|
// (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
54484
|
geoColumn: null,
|
|
56234
54485
|
// (Array<String>, optional): names of columns to fetch. By default, all columns are fetched.
|
|
@@ -56309,6 +54560,7 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56309
54560
|
const {
|
|
56310
54561
|
type,
|
|
56311
54562
|
data: source,
|
|
54563
|
+
clientId,
|
|
56312
54564
|
credentials,
|
|
56313
54565
|
...rest
|
|
56314
54566
|
} = this.props;
|
|
@@ -56332,6 +54584,7 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56332
54584
|
result = await Object(_api__WEBPACK_IMPORTED_MODULE_2__["fetchLayerData"])({
|
|
56333
54585
|
type,
|
|
56334
54586
|
source,
|
|
54587
|
+
clientId,
|
|
56335
54588
|
credentials,
|
|
56336
54589
|
...rest
|
|
56337
54590
|
});
|
|
@@ -56362,8 +54615,13 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56362
54615
|
updateTriggers
|
|
56363
54616
|
} = this.props;
|
|
56364
54617
|
let layer;
|
|
54618
|
+
/* global URLSearchParams */
|
|
54619
|
+
|
|
54620
|
+
const tilesFormat = apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V3 && format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON && new URLSearchParams(data.tiles[0]).get('format');
|
|
54621
|
+
const nonMvtTiles = tilesFormat && tilesFormat !== _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["TILE_FORMATS"].MVT;
|
|
54622
|
+
const dynamicTiles = apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V3 && type === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["MAP_TYPES"].TABLE && format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON;
|
|
56365
54623
|
|
|
56366
|
-
if (
|
|
54624
|
+
if (nonMvtTiles || dynamicTiles) {
|
|
56367
54625
|
layer = _carto_dynamic_tile_layer__WEBPACK_IMPORTED_MODULE_1__["default"];
|
|
56368
54626
|
} else if (apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V1 || apiVersion === _api__WEBPACK_IMPORTED_MODULE_2__["API_VERSIONS"].V2 || format === _api_maps_api_common__WEBPACK_IMPORTED_MODULE_3__["FORMATS"].TILEJSON) {
|
|
56369
54627
|
layer = _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["MVTLayer"];
|
|
@@ -56372,9 +54630,11 @@ class CartoLayer extends _deck_gl_core__WEBPACK_IMPORTED_MODULE_0__["CompositeLa
|
|
|
56372
54630
|
}
|
|
56373
54631
|
|
|
56374
54632
|
const {
|
|
54633
|
+
formatTiles,
|
|
56375
54634
|
uniqueIdProperty
|
|
56376
54635
|
} = defaultProps;
|
|
56377
54636
|
const props = {
|
|
54637
|
+
formatTiles,
|
|
56378
54638
|
uniqueIdProperty,
|
|
56379
54639
|
...this.props
|
|
56380
54640
|
};
|
|
@@ -56393,6 +54653,222 @@ CartoLayer.defaultProps = defaultProps;
|
|
|
56393
54653
|
|
|
56394
54654
|
/***/ }),
|
|
56395
54655
|
|
|
54656
|
+
/***/ "./src/layers/schema/carto-dynamic-tile.js":
|
|
54657
|
+
/*!*************************************************!*\
|
|
54658
|
+
!*** ./src/layers/schema/carto-dynamic-tile.js ***!
|
|
54659
|
+
\*************************************************/
|
|
54660
|
+
/*! exports provided: Tile */
|
|
54661
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
54662
|
+
|
|
54663
|
+
"use strict";
|
|
54664
|
+
__webpack_require__.r(__webpack_exports__);
|
|
54665
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return Tile; });
|
|
54666
|
+
// KeyValueObject ========================================
|
|
54667
|
+
const KeyValueObject = {};
|
|
54668
|
+
|
|
54669
|
+
KeyValueObject.read = function (pbf, end) {
|
|
54670
|
+
return pbf.readFields(KeyValueObject._readField, {
|
|
54671
|
+
key: '',
|
|
54672
|
+
value: ''
|
|
54673
|
+
}, end);
|
|
54674
|
+
};
|
|
54675
|
+
|
|
54676
|
+
KeyValueObject._readField = function (tag, obj, pbf) {
|
|
54677
|
+
if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = pbf.readString();
|
|
54678
|
+
}; // Properties ========================================
|
|
54679
|
+
|
|
54680
|
+
|
|
54681
|
+
const Properties = {};
|
|
54682
|
+
|
|
54683
|
+
Properties.read = function (pbf, end) {
|
|
54684
|
+
return pbf.readFields(Properties._readField, {
|
|
54685
|
+
data: []
|
|
54686
|
+
}, end);
|
|
54687
|
+
};
|
|
54688
|
+
|
|
54689
|
+
Properties._readField = function (tag, obj, pbf) {
|
|
54690
|
+
if (tag === 1) obj.data.push(KeyValueObject.read(pbf, pbf.readVarint() + pbf.pos));
|
|
54691
|
+
}; // Doubles ========================================
|
|
54692
|
+
|
|
54693
|
+
|
|
54694
|
+
const Doubles = {};
|
|
54695
|
+
|
|
54696
|
+
Doubles.read = function (pbf, end) {
|
|
54697
|
+
// TODO perhaps we can do better and directly map from the source
|
|
54698
|
+
// ArrayBuffer using ArrayBuffer.slice()
|
|
54699
|
+
const {
|
|
54700
|
+
value,
|
|
54701
|
+
size
|
|
54702
|
+
} = pbf.readFields(Doubles._readField, {
|
|
54703
|
+
value: [],
|
|
54704
|
+
size: 0
|
|
54705
|
+
}, end);
|
|
54706
|
+
return {
|
|
54707
|
+
value: new Float32Array(value),
|
|
54708
|
+
size
|
|
54709
|
+
};
|
|
54710
|
+
};
|
|
54711
|
+
|
|
54712
|
+
Doubles._readField = function (tag, obj, pbf) {
|
|
54713
|
+
if (tag === 1) pbf.readPackedDouble(obj.value);else if (tag === 2) obj.size = pbf.readVarint(true);
|
|
54714
|
+
}; // Ints ========================================
|
|
54715
|
+
|
|
54716
|
+
|
|
54717
|
+
const Ints = {};
|
|
54718
|
+
|
|
54719
|
+
Ints.read = function (pbf, end) {
|
|
54720
|
+
const {
|
|
54721
|
+
value,
|
|
54722
|
+
size
|
|
54723
|
+
} = pbf.readFields(Ints._readField, {
|
|
54724
|
+
value: [],
|
|
54725
|
+
size: 0
|
|
54726
|
+
}, end);
|
|
54727
|
+
return {
|
|
54728
|
+
value: new Uint32Array(value),
|
|
54729
|
+
size
|
|
54730
|
+
};
|
|
54731
|
+
};
|
|
54732
|
+
|
|
54733
|
+
Ints._readField = function (tag, obj, pbf) {
|
|
54734
|
+
if (tag === 1) pbf.readPackedVarint(obj.value);else if (tag === 2) obj.size = pbf.readVarint(true);
|
|
54735
|
+
}; // NumericProp ========================================
|
|
54736
|
+
|
|
54737
|
+
|
|
54738
|
+
const NumericProp = {};
|
|
54739
|
+
|
|
54740
|
+
NumericProp.read = function (pbf, end) {
|
|
54741
|
+
return pbf.readFields(NumericProp._readField, {
|
|
54742
|
+
value: []
|
|
54743
|
+
}, end);
|
|
54744
|
+
};
|
|
54745
|
+
|
|
54746
|
+
NumericProp._readField = function (tag, obj, pbf) {
|
|
54747
|
+
if (tag === 1) pbf.readPackedDouble(obj.value);
|
|
54748
|
+
}; // NumericPropKeyValue ========================================
|
|
54749
|
+
|
|
54750
|
+
|
|
54751
|
+
const NumericPropKeyValue = {};
|
|
54752
|
+
|
|
54753
|
+
NumericPropKeyValue.read = function (pbf, end) {
|
|
54754
|
+
return pbf.readFields(NumericPropKeyValue._readField, {
|
|
54755
|
+
key: '',
|
|
54756
|
+
value: null
|
|
54757
|
+
}, end);
|
|
54758
|
+
};
|
|
54759
|
+
|
|
54760
|
+
NumericPropKeyValue._readField = function (tag, obj, pbf) {
|
|
54761
|
+
if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = NumericProp.read(pbf, pbf.readVarint() + pbf.pos);
|
|
54762
|
+
}; // NumericProp._FieldEntry1 ========================================
|
|
54763
|
+
|
|
54764
|
+
|
|
54765
|
+
NumericProp._FieldEntry1 = {};
|
|
54766
|
+
|
|
54767
|
+
NumericProp._FieldEntry1.read = function (pbf, end) {
|
|
54768
|
+
return pbf.readFields(NumericProp._FieldEntry1._readField, {
|
|
54769
|
+
key: '',
|
|
54770
|
+
value: 0
|
|
54771
|
+
}, end);
|
|
54772
|
+
};
|
|
54773
|
+
|
|
54774
|
+
NumericProp._FieldEntry1._readField = function (tag, obj, pbf) {
|
|
54775
|
+
if (tag === 1) obj.key = pbf.readString();else if (tag === 2) obj.value = pbf.readDouble();
|
|
54776
|
+
}; // StringProp ========================================
|
|
54777
|
+
|
|
54778
|
+
|
|
54779
|
+
const StringProp = {};
|
|
54780
|
+
|
|
54781
|
+
StringProp.read = function (pbf, end) {
|
|
54782
|
+
return pbf.readFields(StringProp._readField, {
|
|
54783
|
+
value: []
|
|
54784
|
+
}, end);
|
|
54785
|
+
};
|
|
54786
|
+
|
|
54787
|
+
StringProp._readField = function (tag, obj, pbf) {
|
|
54788
|
+
if (tag === 1) obj.value.push(pbf.readString());
|
|
54789
|
+
}; // Points ========================================
|
|
54790
|
+
|
|
54791
|
+
|
|
54792
|
+
const Points = {};
|
|
54793
|
+
|
|
54794
|
+
Points.read = function (pbf, end) {
|
|
54795
|
+
return pbf.readFields(Points._readField, {
|
|
54796
|
+
positions: null,
|
|
54797
|
+
globalFeatureIds: null,
|
|
54798
|
+
featureIds: null,
|
|
54799
|
+
properties: [],
|
|
54800
|
+
numericProps: {}
|
|
54801
|
+
}, end);
|
|
54802
|
+
};
|
|
54803
|
+
|
|
54804
|
+
Points._readField = function (tag, obj, pbf) {
|
|
54805
|
+
if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 5) {
|
|
54806
|
+
const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
|
|
54807
|
+
obj.numericProps[entry.key] = entry.value;
|
|
54808
|
+
}
|
|
54809
|
+
}; // Lines ========================================
|
|
54810
|
+
|
|
54811
|
+
|
|
54812
|
+
const Lines = {};
|
|
54813
|
+
|
|
54814
|
+
Lines.read = function (pbf, end) {
|
|
54815
|
+
return pbf.readFields(Lines._readField, {
|
|
54816
|
+
positions: null,
|
|
54817
|
+
pathIndices: null,
|
|
54818
|
+
globalFeatureIds: null,
|
|
54819
|
+
featureIds: null,
|
|
54820
|
+
properties: [],
|
|
54821
|
+
numericProps: {}
|
|
54822
|
+
}, end);
|
|
54823
|
+
};
|
|
54824
|
+
|
|
54825
|
+
Lines._readField = function (tag, obj, pbf) {
|
|
54826
|
+
if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.pathIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 5) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 6) {
|
|
54827
|
+
const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
|
|
54828
|
+
obj.numericProps[entry.key] = entry.value;
|
|
54829
|
+
}
|
|
54830
|
+
}; // Polygons ========================================
|
|
54831
|
+
|
|
54832
|
+
|
|
54833
|
+
const Polygons = {};
|
|
54834
|
+
|
|
54835
|
+
Polygons.read = function (pbf, end) {
|
|
54836
|
+
return pbf.readFields(Polygons._readField, {
|
|
54837
|
+
positions: null,
|
|
54838
|
+
polygonIndices: null,
|
|
54839
|
+
globalFeatureIds: null,
|
|
54840
|
+
featureIds: null,
|
|
54841
|
+
primitivePolygonIndices: null,
|
|
54842
|
+
triangles: null,
|
|
54843
|
+
properties: [],
|
|
54844
|
+
numericProps: {}
|
|
54845
|
+
}, end);
|
|
54846
|
+
};
|
|
54847
|
+
|
|
54848
|
+
Polygons._readField = function (tag, obj, pbf) {
|
|
54849
|
+
if (tag === 1) obj.positions = Doubles.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.polygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.globalFeatureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 4) obj.featureIds = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 5) obj.primitivePolygonIndices = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 6) obj.triangles = Ints.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 7) obj.properties.push(Properties.read(pbf, pbf.readVarint() + pbf.pos));else if (tag === 8) {
|
|
54850
|
+
const entry = NumericPropKeyValue.read(pbf, pbf.readVarint() + pbf.pos);
|
|
54851
|
+
obj.numericProps[entry.key] = entry.value;
|
|
54852
|
+
}
|
|
54853
|
+
}; // Tile ========================================
|
|
54854
|
+
|
|
54855
|
+
|
|
54856
|
+
const Tile = {};
|
|
54857
|
+
|
|
54858
|
+
Tile.read = function (pbf, end) {
|
|
54859
|
+
return pbf.readFields(Tile._readField, {
|
|
54860
|
+
points: null,
|
|
54861
|
+
lines: null,
|
|
54862
|
+
polygons: null
|
|
54863
|
+
}, end);
|
|
54864
|
+
};
|
|
54865
|
+
|
|
54866
|
+
Tile._readField = function (tag, obj, pbf) {
|
|
54867
|
+
if (tag === 1) obj.points = Points.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 2) obj.lines = Lines.read(pbf, pbf.readVarint() + pbf.pos);else if (tag === 3) obj.polygons = Polygons.read(pbf, pbf.readVarint() + pbf.pos);
|
|
54868
|
+
};
|
|
54869
|
+
|
|
54870
|
+
/***/ }),
|
|
54871
|
+
|
|
56396
54872
|
/***/ "./src/style/color-bins-style.js":
|
|
56397
54873
|
/*!***************************************!*\
|
|
56398
54874
|
!*** ./src/style/color-bins-style.js ***!
|