maplibre-gl 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/readme.md +0 -2
- package/dist/maplibre-gl-dev.mjs +179 -190
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +869 -825
- package/dist/maplibre-gl-shared-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared.mjs +2 -2
- package/dist/maplibre-gl-shared.mjs.map +1 -1
- package/dist/maplibre-gl-worker-dev.mjs +14 -12
- package/dist/maplibre-gl-worker-dev.mjs.map +1 -1
- package/dist/maplibre-gl-worker.mjs +2 -2
- package/dist/maplibre-gl-worker.mjs.map +1 -1
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +24 -6
- package/dist/maplibre-gl.mjs +13 -13
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +10 -13
- package/src/data/bucket/fill_extrusion_bucket.test.ts +22 -0
- package/src/data/bucket/fill_extrusion_bucket.ts +16 -4
- package/src/data/bucket/round_polygon_corners.test.ts +159 -0
- package/src/data/bucket/round_polygon_corners.ts +121 -0
- package/src/data/bucket/symbol_bucket.test.ts +1 -1
- package/src/data/dem_data.test.ts +23 -23
- package/src/data/feature_position_map.test.ts +1 -1
- package/src/data/segment.test.ts +14 -14
- package/src/geo/bounds.test.ts +4 -4
- package/src/geo/lng_lat_bounds.test.ts +1 -1
- package/src/geo/projection/mercator_transform.test.ts +1 -1
- package/src/geo/projection/mercator_utils.test.ts +8 -8
- package/src/index.test.ts +7 -12
- package/src/render/glyph_manager.test.ts +6 -22
- package/src/render/painter.test.ts +2 -0
- package/src/render/painter.ts +7 -5
- package/src/render/subdivision.test.ts +22 -22
- package/src/render/terrain.test.ts +68 -34
- package/src/render/terrain.ts +69 -26
- package/src/source/canvas_source.test.ts +1 -1
- package/src/source/geojson_source.test.ts +5 -4
- package/src/source/geojson_source_diff.test.ts +2 -2
- package/src/source/geojson_worker_source.test.ts +9 -5
- package/src/source/image_source.test.ts +0 -3
- package/src/source/raster_dem_tile_source.test.ts +2 -2
- package/src/source/raster_tile_source.test.ts +15 -9
- package/src/source/rtl_text_plugin_main_thread.test.ts +14 -14
- package/src/source/source.test.ts +8 -8
- package/src/source/vector_tile_source.test.ts +1 -1
- package/src/source/vector_tile_worker_source.test.ts +7 -5
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker_tile.test.ts +4 -2
- package/src/style/load_glyph_range.test.ts +8 -8
- package/src/style/load_sprite.test.ts +1 -1
- package/src/style/style.test.ts +36 -34
- package/src/style/style_layer/color_relief_style_layer.test.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +6 -3
- package/src/style/style_layer/raster_style_layer.test.ts +2 -2
- package/src/style/style_layer.test.ts +3 -50
- package/src/symbol/collision_index.test.ts +1 -1
- package/src/symbol/grid_index.test.ts +1 -1
- package/src/tile/terrain_tile_manager.test.ts +2 -2
- package/src/tile/tile_id.test.ts +5 -5
- package/src/tile/tile_manager.test.ts +85 -72
- package/src/tile/tile_manager_in_view_tiles.test.ts +2 -2
- package/src/ui/camera.test.ts +137 -134
- package/src/ui/control/geolocate_control.test.ts +6 -29
- package/src/ui/handler/dblclick_zoom.test.ts +2 -2
- package/src/ui/handler/scroll_zoom.test.ts +2 -0
- package/src/ui/handler_manager.test.ts +7 -7
- package/src/ui/hash.test.ts +1 -0
- package/src/ui/map.ts +28 -18
- package/src/ui/map_tests/map_basic.test.ts +11 -23
- package/src/ui/map_tests/map_calculate_camera_options.test.ts +6 -6
- package/src/ui/map_tests/map_events.test.ts +5 -5
- package/src/ui/map_tests/map_global_state.test.ts +3 -3
- package/src/ui/map_tests/map_images.test.ts +3 -3
- package/src/ui/map_tests/map_is_moving.test.ts +1 -1
- package/src/ui/map_tests/map_is_rotating.test.ts +1 -1
- package/src/ui/map_tests/map_layer.test.ts +2 -1
- package/src/ui/map_tests/map_options.test.ts +1 -5
- package/src/ui/map_tests/map_pitch.test.ts +6 -6
- package/src/ui/map_tests/map_refresh_tiles.test.ts +2 -2
- package/src/ui/map_tests/map_render.test.ts +1 -1
- package/src/ui/map_tests/map_set_lod_params.test.ts +1 -1
- package/src/ui/map_tests/map_style.test.ts +9 -1
- package/src/ui/map_tests/map_terrain.test.ts +20 -0
- package/src/ui/map_tests/map_zoom.test.ts +15 -15
- package/src/ui/marker.test.ts +7 -13
- package/src/ui/popup.test.ts +3 -3
- package/src/util/actor.test.ts +6 -6
- package/src/util/ajax.test.ts +27 -39
- package/src/util/browser.test.ts +7 -9
- package/src/util/create_tile_mesh.test.ts +2 -2
- package/src/util/dispatcher.test.ts +1 -1
- package/src/util/evented.test.ts +4 -1
- package/src/util/fast_maths.test.ts +4 -4
- package/src/util/image_request.test.ts +6 -4
- package/src/util/struct_array.test.ts +2 -2
- package/src/util/task_queue.test.ts +1 -1
- package/src/util/test/util.ts +1 -0
- package/src/util/time_control.test.ts +2 -2
- package/src/util/transferable_grid_index.test.ts +1 -1
- package/src/util/util.test.ts +27 -13
- package/src/util/verticalize_punctuation.test.ts +4 -4
- package/src/util/web_worker_transfer.test.ts +5 -5
- package/src/webgl/draw/draw_custom.test.ts +13 -13
- package/src/webgl/draw/draw_debug.test.ts +1 -1
- package/src/webgl/draw/draw_fill.test.ts +12 -12
- package/src/webgl/draw/draw_symbol.test.ts +16 -16
- package/src/webgl/program.ts +2 -0
- package/src/webgl/render_to_texture.test.ts +5 -5
- package/src/webgl/state.test.ts +1 -1
- package/src/webgl/texture.test.ts +3 -3
- package/src/webgl/vertex_buffer.test.ts +1 -1
- package/build/rolldown_plugins.ts +0 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MapLibre GL JS
|
|
3
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.
|
|
3
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.2.0/LICENSE.txt
|
|
4
4
|
*/
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
6
|
var __create = Object.create;
|
|
@@ -20,7 +20,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
24
24
|
value: mod,
|
|
25
25
|
enumerable: true
|
|
26
26
|
}) : target, mod));
|
|
@@ -380,13 +380,13 @@ function isOffscreenCanvasDistorted() {
|
|
|
380
380
|
const size = 5;
|
|
381
381
|
const context = new OffscreenCanvas(size, size).getContext("2d", { willReadFrequently: true });
|
|
382
382
|
if (context) {
|
|
383
|
-
for (let i = 0; i <
|
|
383
|
+
for (let i = 0; i < 25; i++) {
|
|
384
384
|
const base = i * 4;
|
|
385
385
|
context.fillStyle = `rgb(${base},${base + 1},${base + 2})`;
|
|
386
386
|
context.fillRect(i % size, Math.floor(i / size), 1, 1);
|
|
387
387
|
}
|
|
388
388
|
const data = context.getImageData(0, 0, size, size).data;
|
|
389
|
-
for (let i = 0; i <
|
|
389
|
+
for (let i = 0; i < 100; i++) if (i % 4 !== 3 && data[i] !== i) {
|
|
390
390
|
offscreenCanvasDistorted = true;
|
|
391
391
|
break;
|
|
392
392
|
}
|
|
@@ -1778,6 +1778,18 @@ function create() {
|
|
|
1778
1778
|
return out;
|
|
1779
1779
|
}
|
|
1780
1780
|
/**
|
|
1781
|
+
* Creates a new vec2 initialized with values from an existing vector
|
|
1782
|
+
*
|
|
1783
|
+
* @param {ReadonlyVec2} a vector to clone
|
|
1784
|
+
* @returns {vec2} a new 2D vector
|
|
1785
|
+
*/
|
|
1786
|
+
function clone$1(a) {
|
|
1787
|
+
var out = new ARRAY_TYPE(2);
|
|
1788
|
+
out[0] = a[0];
|
|
1789
|
+
out[1] = a[1];
|
|
1790
|
+
return out;
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1781
1793
|
* Creates a new vec2 initialized with the given values
|
|
1782
1794
|
*
|
|
1783
1795
|
* @param {Number} x X component
|
|
@@ -1791,6 +1803,32 @@ function fromValues(x, y) {
|
|
|
1791
1803
|
return out;
|
|
1792
1804
|
}
|
|
1793
1805
|
/**
|
|
1806
|
+
* Adds two vec2's
|
|
1807
|
+
*
|
|
1808
|
+
* @param {vec2} out the receiving vector
|
|
1809
|
+
* @param {ReadonlyVec2} a the first operand
|
|
1810
|
+
* @param {ReadonlyVec2} b the second operand
|
|
1811
|
+
* @returns {vec2} out
|
|
1812
|
+
*/
|
|
1813
|
+
function add(out, a, b) {
|
|
1814
|
+
out[0] = a[0] + b[0];
|
|
1815
|
+
out[1] = a[1] + b[1];
|
|
1816
|
+
return out;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Subtracts vector b from vector a
|
|
1820
|
+
*
|
|
1821
|
+
* @param {vec2} out the receiving vector
|
|
1822
|
+
* @param {ReadonlyVec2} a the first operand
|
|
1823
|
+
* @param {ReadonlyVec2} b the second operand
|
|
1824
|
+
* @returns {vec2} out
|
|
1825
|
+
*/
|
|
1826
|
+
function subtract(out, a, b) {
|
|
1827
|
+
out[0] = a[0] - b[0];
|
|
1828
|
+
out[1] = a[1] - b[1];
|
|
1829
|
+
return out;
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1794
1832
|
* Scales a vec2 by a scalar number
|
|
1795
1833
|
*
|
|
1796
1834
|
* @param {vec2} out the receiving vector
|
|
@@ -1804,6 +1842,20 @@ function scale(out, a, b) {
|
|
|
1804
1842
|
return out;
|
|
1805
1843
|
}
|
|
1806
1844
|
/**
|
|
1845
|
+
* Adds two vec2's after scaling the second operand by a scalar value
|
|
1846
|
+
*
|
|
1847
|
+
* @param {vec2} out the receiving vector
|
|
1848
|
+
* @param {ReadonlyVec2} a the first operand
|
|
1849
|
+
* @param {ReadonlyVec2} b the second operand
|
|
1850
|
+
* @param {Number} scale the amount to scale b by before adding
|
|
1851
|
+
* @returns {vec2} out
|
|
1852
|
+
*/
|
|
1853
|
+
function scaleAndAdd(out, a, b, scale) {
|
|
1854
|
+
out[0] = a[0] + b[0] * scale;
|
|
1855
|
+
out[1] = a[1] + b[1] * scale;
|
|
1856
|
+
return out;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1807
1859
|
* Calculates the length of a vec2
|
|
1808
1860
|
*
|
|
1809
1861
|
* @param {ReadonlyVec2} a vector to calculate length of
|
|
@@ -1824,6 +1876,21 @@ function squaredLength(a) {
|
|
|
1824
1876
|
return x * x + y * y;
|
|
1825
1877
|
}
|
|
1826
1878
|
/**
|
|
1879
|
+
* Normalize a vec2
|
|
1880
|
+
*
|
|
1881
|
+
* @param {vec2} out the receiving vector
|
|
1882
|
+
* @param {ReadonlyVec2} a vector to normalize
|
|
1883
|
+
* @returns {vec2} out
|
|
1884
|
+
*/
|
|
1885
|
+
function normalize(out, a) {
|
|
1886
|
+
var x = a[0], y = a[1];
|
|
1887
|
+
var len = x * x + y * y;
|
|
1888
|
+
if (len > 0) len = 1 / Math.sqrt(len);
|
|
1889
|
+
out[0] = a[0] * len;
|
|
1890
|
+
out[1] = a[1] * len;
|
|
1891
|
+
return out;
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1827
1894
|
* Calculates the dot product of two vec2's
|
|
1828
1895
|
*
|
|
1829
1896
|
* @param {ReadonlyVec2} a the first operand
|
|
@@ -1834,23 +1901,30 @@ function dot$1(a, b) {
|
|
|
1834
1901
|
return a[0] * b[0] + a[1] * b[1];
|
|
1835
1902
|
}
|
|
1836
1903
|
/**
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1840
|
-
*
|
|
1841
|
-
* @param {
|
|
1842
|
-
* @param {ReadonlyVec2} a the vector to transform
|
|
1843
|
-
* @param {ReadonlyMat4} m matrix to transform with
|
|
1904
|
+
* Rotate a 2D vector
|
|
1905
|
+
* @param {vec2} out The receiving vec2
|
|
1906
|
+
* @param {ReadonlyVec2} a The vec2 point to rotate
|
|
1907
|
+
* @param {ReadonlyVec2} b The origin of the rotation
|
|
1908
|
+
* @param {Number} rad The angle of rotation in radians
|
|
1844
1909
|
* @returns {vec2} out
|
|
1845
1910
|
*/
|
|
1846
|
-
function
|
|
1847
|
-
var
|
|
1848
|
-
|
|
1849
|
-
out[
|
|
1850
|
-
out[1] = m[1] * x + m[5] * y + m[13];
|
|
1911
|
+
function rotate(out, a, b, rad) {
|
|
1912
|
+
var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad);
|
|
1913
|
+
out[0] = p0 * cosC - p1 * sinC + b[0];
|
|
1914
|
+
out[1] = p0 * sinC + p1 * cosC + b[1];
|
|
1851
1915
|
return out;
|
|
1852
1916
|
}
|
|
1853
1917
|
/**
|
|
1918
|
+
* Get the smallest angle between two 2D vectors
|
|
1919
|
+
* @param {ReadonlyVec2} a The first operand
|
|
1920
|
+
* @param {ReadonlyVec2} b The second operand
|
|
1921
|
+
* @returns {Number} The angle in radians
|
|
1922
|
+
*/
|
|
1923
|
+
function angle(a, b) {
|
|
1924
|
+
var ax = a[0], ay = a[1], bx = b[0], by = b[1];
|
|
1925
|
+
return Math.abs(Math.atan2(ay * bx - ax * by, ax * bx + ay * by));
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1854
1928
|
* Set the components of a vec2 to zero
|
|
1855
1929
|
*
|
|
1856
1930
|
* @param {vec2} out the receiving vector
|
|
@@ -1862,6 +1936,11 @@ function zero(out) {
|
|
|
1862
1936
|
return out;
|
|
1863
1937
|
}
|
|
1864
1938
|
/**
|
|
1939
|
+
* Alias for {@link vec2.subtract}
|
|
1940
|
+
* @function
|
|
1941
|
+
*/
|
|
1942
|
+
var sub = subtract;
|
|
1943
|
+
/**
|
|
1865
1944
|
* Alias for {@link vec2.squaredLength}
|
|
1866
1945
|
* @function
|
|
1867
1946
|
*/
|
|
@@ -7510,14 +7589,12 @@ var Padding = class Padding {
|
|
|
7510
7589
|
input[1]
|
|
7511
7590
|
];
|
|
7512
7591
|
break;
|
|
7513
|
-
case 3:
|
|
7514
|
-
input
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
];
|
|
7520
|
-
break;
|
|
7592
|
+
case 3: input = [
|
|
7593
|
+
input[0],
|
|
7594
|
+
input[1],
|
|
7595
|
+
input[2],
|
|
7596
|
+
input[1]
|
|
7597
|
+
];
|
|
7521
7598
|
}
|
|
7522
7599
|
return new Padding(input);
|
|
7523
7600
|
}
|
|
@@ -9513,8 +9590,7 @@ function calculateSignedArea(ring) {
|
|
|
9513
9590
|
return sum;
|
|
9514
9591
|
}
|
|
9515
9592
|
const RE = 6378.137;
|
|
9516
|
-
const
|
|
9517
|
-
const E2 = FE * (2 - FE);
|
|
9593
|
+
const E2 = .0066943799901413165;
|
|
9518
9594
|
const RAD = Math.PI / 180;
|
|
9519
9595
|
var CheapRuler = class {
|
|
9520
9596
|
constructor(lat) {
|
|
@@ -9523,7 +9599,7 @@ var CheapRuler = class {
|
|
|
9523
9599
|
const w2 = 1 / (1 - E2 * (1 - coslat * coslat));
|
|
9524
9600
|
const w = Math.sqrt(w2);
|
|
9525
9601
|
this.kx = m * w * coslat;
|
|
9526
|
-
this.ky = m * w * w2 *
|
|
9602
|
+
this.ky = m * w * w2 * .9933056200098587;
|
|
9527
9603
|
}
|
|
9528
9604
|
/**
|
|
9529
9605
|
* Given two points of the form [longitude, latitude], returns the distance.
|
|
@@ -9860,9 +9936,7 @@ function pointToGeometryDistance(ctx, geometries) {
|
|
|
9860
9936
|
case "LineString":
|
|
9861
9937
|
dist = Math.min(dist, pointSetToPointSetDistance(pointPosition, false, geometry.coordinates, true, ruler, dist));
|
|
9862
9938
|
break;
|
|
9863
|
-
case "Polygon":
|
|
9864
|
-
dist = Math.min(dist, pointsToPolygonDistance(pointPosition, false, geometry.coordinates, ruler, dist));
|
|
9865
|
-
break;
|
|
9939
|
+
case "Polygon": dist = Math.min(dist, pointsToPolygonDistance(pointPosition, false, geometry.coordinates, ruler, dist));
|
|
9866
9940
|
}
|
|
9867
9941
|
if (dist === 0) return dist;
|
|
9868
9942
|
}
|
|
@@ -9882,9 +9956,7 @@ function lineStringToGeometryDistance(ctx, geometries) {
|
|
|
9882
9956
|
case "LineString":
|
|
9883
9957
|
dist = Math.min(dist, pointSetToPointSetDistance(linePositions, true, geometry.coordinates, true, ruler, dist));
|
|
9884
9958
|
break;
|
|
9885
|
-
case "Polygon":
|
|
9886
|
-
dist = Math.min(dist, pointsToPolygonDistance(linePositions, true, geometry.coordinates, ruler, dist));
|
|
9887
|
-
break;
|
|
9959
|
+
case "Polygon": dist = Math.min(dist, pointsToPolygonDistance(linePositions, true, geometry.coordinates, ruler, dist));
|
|
9888
9960
|
}
|
|
9889
9961
|
if (dist === 0) return dist;
|
|
9890
9962
|
}
|
|
@@ -9908,9 +9980,7 @@ function polygonToGeometryDistance(ctx, geometries) {
|
|
|
9908
9980
|
case "LineString":
|
|
9909
9981
|
dist = Math.min(dist, pointsToPolygonDistance(geometry.coordinates, true, polygon, ruler, dist));
|
|
9910
9982
|
break;
|
|
9911
|
-
case "Polygon":
|
|
9912
|
-
dist = Math.min(dist, polygonToPolygonDistance(polygon, geometry.coordinates, ruler, dist));
|
|
9913
|
-
break;
|
|
9983
|
+
case "Polygon": dist = Math.min(dist, polygonToPolygonDistance(polygon, geometry.coordinates, ruler, dist));
|
|
9914
9984
|
}
|
|
9915
9985
|
if (dist === 0) return dist;
|
|
9916
9986
|
}
|
|
@@ -11227,12 +11297,10 @@ function findMixedLegacyFilter(filter, path = []) {
|
|
|
11227
11297
|
if (diagnostic) return diagnostic;
|
|
11228
11298
|
break;
|
|
11229
11299
|
}
|
|
11230
|
-
case "case":
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
}
|
|
11235
|
-
break;
|
|
11300
|
+
case "case": for (let i = 1; i < filter.length - 1; i += 2) {
|
|
11301
|
+
const diagnostic = checkChild(i, path, filter);
|
|
11302
|
+
if (diagnostic) return diagnostic;
|
|
11303
|
+
}
|
|
11236
11304
|
}
|
|
11237
11305
|
return null;
|
|
11238
11306
|
}
|
|
@@ -11336,148 +11404,6 @@ function convertHasOp$1(property) {
|
|
|
11336
11404
|
function convertNegation(filter) {
|
|
11337
11405
|
return ["!", filter];
|
|
11338
11406
|
}
|
|
11339
|
-
function convertFilter(filter, expectedTypes = {}) {
|
|
11340
|
-
if (isExpressionFilter(filter)) return filter;
|
|
11341
|
-
if (!filter) return true;
|
|
11342
|
-
const legacyFilter = filter;
|
|
11343
|
-
const legacyOp = legacyFilter[0];
|
|
11344
|
-
if (filter.length <= 1) return legacyOp !== "any";
|
|
11345
|
-
switch (legacyOp) {
|
|
11346
|
-
case "==":
|
|
11347
|
-
case "!=":
|
|
11348
|
-
case "<":
|
|
11349
|
-
case ">":
|
|
11350
|
-
case "<=":
|
|
11351
|
-
case ">=": {
|
|
11352
|
-
const [, property, value] = filter;
|
|
11353
|
-
return convertComparisonOp(property, value, legacyOp, expectedTypes);
|
|
11354
|
-
}
|
|
11355
|
-
case "any": {
|
|
11356
|
-
const [, ...conditions] = legacyFilter;
|
|
11357
|
-
return ["any", ...conditions.map((f) => {
|
|
11358
|
-
const types = {};
|
|
11359
|
-
const child = convertFilter(f, types);
|
|
11360
|
-
const typechecks = runtimeTypeChecks(types);
|
|
11361
|
-
return typechecks === true ? child : [
|
|
11362
|
-
"case",
|
|
11363
|
-
typechecks,
|
|
11364
|
-
child,
|
|
11365
|
-
false
|
|
11366
|
-
];
|
|
11367
|
-
})];
|
|
11368
|
-
}
|
|
11369
|
-
case "all": {
|
|
11370
|
-
const [, ...conditions] = legacyFilter;
|
|
11371
|
-
const children = conditions.map((f) => convertFilter(f, expectedTypes));
|
|
11372
|
-
return children.length > 1 ? ["all", ...children] : children[0];
|
|
11373
|
-
}
|
|
11374
|
-
case "none": {
|
|
11375
|
-
const [, ...conditions] = legacyFilter;
|
|
11376
|
-
return ["!", convertFilter(["any", ...conditions], {})];
|
|
11377
|
-
}
|
|
11378
|
-
case "in": {
|
|
11379
|
-
const [, property, ...values] = legacyFilter;
|
|
11380
|
-
return convertInOp(property, values);
|
|
11381
|
-
}
|
|
11382
|
-
case "!in": {
|
|
11383
|
-
const [, property, ...values] = legacyFilter;
|
|
11384
|
-
return convertInOp(property, values, true);
|
|
11385
|
-
}
|
|
11386
|
-
case "has": return convertHasOp(legacyFilter[1]);
|
|
11387
|
-
case "!has": return ["!", convertHasOp(legacyFilter[1])];
|
|
11388
|
-
default: return true;
|
|
11389
|
-
}
|
|
11390
|
-
}
|
|
11391
|
-
function runtimeTypeChecks(expectedTypes) {
|
|
11392
|
-
const conditions = [];
|
|
11393
|
-
for (const property in expectedTypes) {
|
|
11394
|
-
const get = property === "$id" ? ["id"] : ["get", property];
|
|
11395
|
-
conditions.push([
|
|
11396
|
-
"==",
|
|
11397
|
-
["typeof", get],
|
|
11398
|
-
expectedTypes[property]
|
|
11399
|
-
]);
|
|
11400
|
-
}
|
|
11401
|
-
if (conditions.length === 0) return true;
|
|
11402
|
-
if (conditions.length === 1) return conditions[0];
|
|
11403
|
-
return ["all", ...conditions];
|
|
11404
|
-
}
|
|
11405
|
-
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
11406
|
-
let get;
|
|
11407
|
-
if (property === "$type") return [
|
|
11408
|
-
op,
|
|
11409
|
-
["geometry-type"],
|
|
11410
|
-
value
|
|
11411
|
-
];
|
|
11412
|
-
else if (property === "$id") get = ["id"];
|
|
11413
|
-
else get = ["get", property];
|
|
11414
|
-
if (expectedTypes && value !== null) expectedTypes[property] = typeof value;
|
|
11415
|
-
if (op === "==" && property !== "$id" && value === null) return [
|
|
11416
|
-
"all",
|
|
11417
|
-
["has", property],
|
|
11418
|
-
[
|
|
11419
|
-
"==",
|
|
11420
|
-
get,
|
|
11421
|
-
null
|
|
11422
|
-
]
|
|
11423
|
-
];
|
|
11424
|
-
else if (op === "!=" && property !== "$id" && value === null) return [
|
|
11425
|
-
"any",
|
|
11426
|
-
["!", ["has", property]],
|
|
11427
|
-
[
|
|
11428
|
-
"!=",
|
|
11429
|
-
get,
|
|
11430
|
-
null
|
|
11431
|
-
]
|
|
11432
|
-
];
|
|
11433
|
-
return [
|
|
11434
|
-
op,
|
|
11435
|
-
get,
|
|
11436
|
-
value
|
|
11437
|
-
];
|
|
11438
|
-
}
|
|
11439
|
-
function convertInOp(property, values, negate = false) {
|
|
11440
|
-
if (values.length === 0) return negate;
|
|
11441
|
-
let get;
|
|
11442
|
-
if (property === "$type") get = ["geometry-type"];
|
|
11443
|
-
else if (property === "$id") get = ["id"];
|
|
11444
|
-
else get = ["get", property];
|
|
11445
|
-
let uniformTypes = true;
|
|
11446
|
-
const type = typeof values[0];
|
|
11447
|
-
for (const value of values) if (typeof value !== type) {
|
|
11448
|
-
uniformTypes = false;
|
|
11449
|
-
break;
|
|
11450
|
-
}
|
|
11451
|
-
if (uniformTypes && (type === "string" || type === "number")) {
|
|
11452
|
-
const uniqueValues = values.sort().filter((v, i) => i === 0 || values[i - 1] !== v);
|
|
11453
|
-
return [
|
|
11454
|
-
"match",
|
|
11455
|
-
get,
|
|
11456
|
-
uniqueValues,
|
|
11457
|
-
!negate,
|
|
11458
|
-
negate
|
|
11459
|
-
];
|
|
11460
|
-
}
|
|
11461
|
-
if (negate) return ["all", ...values.map((v) => [
|
|
11462
|
-
"!=",
|
|
11463
|
-
get,
|
|
11464
|
-
v
|
|
11465
|
-
])];
|
|
11466
|
-
else return ["any", ...values.map((v) => [
|
|
11467
|
-
"==",
|
|
11468
|
-
get,
|
|
11469
|
-
v
|
|
11470
|
-
])];
|
|
11471
|
-
}
|
|
11472
|
-
function convertHasOp(property) {
|
|
11473
|
-
if (property === "$type") return true;
|
|
11474
|
-
else if (property === "$id") return [
|
|
11475
|
-
"!=",
|
|
11476
|
-
["id"],
|
|
11477
|
-
null
|
|
11478
|
-
];
|
|
11479
|
-
else return ["has", property];
|
|
11480
|
-
}
|
|
11481
11407
|
function stringify$1(obj) {
|
|
11482
11408
|
const type = typeof obj;
|
|
11483
11409
|
if (type === "number" || type === "boolean" || type === "string" || obj === void 0 || obj === null) return JSON.stringify(obj);
|
|
@@ -11881,7 +11807,6 @@ function validateNonExpressionFilter(options) {
|
|
|
11881
11807
|
type = getType(value[1]);
|
|
11882
11808
|
if (value.length !== 2) errors.push(new ValidationError(key, value, `filter array for "${value[0]}" operator must have 2 elements`));
|
|
11883
11809
|
else if (type !== "string") errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));
|
|
11884
|
-
break;
|
|
11885
11810
|
}
|
|
11886
11811
|
return errors;
|
|
11887
11812
|
}
|
|
@@ -12597,10 +12522,6 @@ function wrapCleanErrors(inner) {
|
|
|
12597
12522
|
return sortErrors(inner.apply(this, args));
|
|
12598
12523
|
};
|
|
12599
12524
|
}
|
|
12600
|
-
function resolveConstant(style, value) {
|
|
12601
|
-
if (typeof value === "string" && value[0] === "@") return resolveConstant(style, style.constants[value]);
|
|
12602
|
-
else return value;
|
|
12603
|
-
}
|
|
12604
12525
|
const visibilitySpec = {
|
|
12605
12526
|
type: "enum",
|
|
12606
12527
|
"property-type": "data-constant",
|
|
@@ -15180,7 +15101,6 @@ var RasterBoundsArray = class extends StructArrayLayout4i8 {};
|
|
|
15180
15101
|
var CircleLayoutArray = class extends StructArrayLayout2i4 {};
|
|
15181
15102
|
var FillLayoutArray = class extends StructArrayLayout2i4 {};
|
|
15182
15103
|
var FillExtrusionLayoutArray = class extends StructArrayLayout2i4i12 {};
|
|
15183
|
-
(class extends StructArrayLayout2i4 {});
|
|
15184
15104
|
var LineLayoutArray = class extends StructArrayLayout2i4ub8 {};
|
|
15185
15105
|
var LineExtLayoutArray = class extends StructArrayLayout2f8 {};
|
|
15186
15106
|
var PatternLayoutArray = class extends StructArrayLayout10ui20 {};
|
|
@@ -17056,7 +16976,6 @@ var DEMData = class DEMData {
|
|
|
17056
16976
|
this.greenFactor = 25.6;
|
|
17057
16977
|
this.blueFactor = .1;
|
|
17058
16978
|
this.baseShift = 1e4;
|
|
17059
|
-
break;
|
|
17060
16979
|
}
|
|
17061
16980
|
for (let x = 0; x < dim; x++) {
|
|
17062
16981
|
this.data[this._idx(-1, x)] = this.data[this._idx(0, x)];
|
|
@@ -17129,17 +17048,13 @@ var DEMData = class DEMData {
|
|
|
17129
17048
|
case -1:
|
|
17130
17049
|
xMin = xMax - 1;
|
|
17131
17050
|
break;
|
|
17132
|
-
case 1:
|
|
17133
|
-
xMax = xMin + 1;
|
|
17134
|
-
break;
|
|
17051
|
+
case 1: xMax = xMin + 1;
|
|
17135
17052
|
}
|
|
17136
17053
|
switch (dy) {
|
|
17137
17054
|
case -1:
|
|
17138
17055
|
yMin = yMax - 1;
|
|
17139
17056
|
break;
|
|
17140
|
-
case 1:
|
|
17141
|
-
yMax = yMin + 1;
|
|
17142
|
-
break;
|
|
17057
|
+
case 1: yMax = yMin + 1;
|
|
17143
17058
|
}
|
|
17144
17059
|
const ox = -dx * this.dim;
|
|
17145
17060
|
const oy = -dy * this.dim;
|
|
@@ -18135,7 +18050,7 @@ var Subdivider = class {
|
|
|
18135
18050
|
for (let i = 0; i < flattened.length; i += 2) {
|
|
18136
18051
|
const vy = flattened[i + 1];
|
|
18137
18052
|
if (vy === -32768) flattened[i + 1] = -32767;
|
|
18138
|
-
if (vy === 32767) flattened[i + 1] =
|
|
18053
|
+
if (vy === 32767) flattened[i + 1] = 32766;
|
|
18139
18054
|
}
|
|
18140
18055
|
}
|
|
18141
18056
|
/**
|
|
@@ -19108,67 +19023,471 @@ var VectorTile = class {
|
|
|
19108
19023
|
}
|
|
19109
19024
|
};
|
|
19110
19025
|
//#endregion
|
|
19111
|
-
//#region src/
|
|
19112
|
-
const
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
index,
|
|
19144
|
-
geometry: needGeometry ? evaluationFeature.geometry : loadGeometry(feature),
|
|
19145
|
-
properties: feature.properties,
|
|
19146
|
-
type: feature.type,
|
|
19147
|
-
patterns: {}
|
|
19148
|
-
};
|
|
19149
|
-
if (this.hasDependencies) this.features.push(addPatternDependencies("fill-extrusion", this.layers, bucketFeature, { zoom: this.zoom }, options));
|
|
19150
|
-
else this.addFeature(bucketFeature, bucketFeature.geometry, index, canonical, {}, options.subdivisionGranularity);
|
|
19151
|
-
options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, true);
|
|
19152
|
-
}
|
|
19153
|
-
}
|
|
19154
|
-
addFeatures(options, canonical, imagePositions) {
|
|
19155
|
-
for (const feature of this.features) {
|
|
19156
|
-
const { geometry } = feature;
|
|
19157
|
-
this.addFeature(feature, geometry, feature.index, canonical, imagePositions, options.subdivisionGranularity);
|
|
19158
|
-
}
|
|
19026
|
+
//#region src/geo/lng_lat.ts
|
|
19027
|
+
const earthRadius = 6371008.8;
|
|
19028
|
+
/**
|
|
19029
|
+
* A `LngLat` object represents a given longitude and latitude coordinate, measured in degrees.
|
|
19030
|
+
* These coordinates are based on the [WGS84 (EPSG:4326) standard](https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84).
|
|
19031
|
+
*
|
|
19032
|
+
* MapLibre GL JS uses longitude, latitude coordinate order (as opposed to latitude, longitude) to match the
|
|
19033
|
+
* [GeoJSON specification](https://tools.ietf.org/html/rfc7946).
|
|
19034
|
+
*
|
|
19035
|
+
* Note that any MapLibre GL JS method that accepts a `LngLat` object as an argument or option
|
|
19036
|
+
* can also accept an `Array` of two numbers and will perform an implicit conversion.
|
|
19037
|
+
* This flexible type is documented as {@link LngLatLike}.
|
|
19038
|
+
*
|
|
19039
|
+
* @group Geography and Geometry
|
|
19040
|
+
*
|
|
19041
|
+
* @example
|
|
19042
|
+
* ```ts
|
|
19043
|
+
* let ll = new LngLat(-123.9749, 40.7736);
|
|
19044
|
+
* ll.lng; // = -123.9749
|
|
19045
|
+
* ```
|
|
19046
|
+
* @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)
|
|
19047
|
+
*/
|
|
19048
|
+
var LngLat = class LngLat {
|
|
19049
|
+
/**
|
|
19050
|
+
* @param lng - Longitude, measured in degrees.
|
|
19051
|
+
* @param lat - Latitude, measured in degrees.
|
|
19052
|
+
*/
|
|
19053
|
+
constructor(lng, lat) {
|
|
19054
|
+
if (isNaN(lng) || isNaN(lat)) throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
|
|
19055
|
+
this.lng = +lng;
|
|
19056
|
+
this.lat = +lat;
|
|
19057
|
+
if (this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
|
|
19159
19058
|
}
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19059
|
+
/**
|
|
19060
|
+
* Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).
|
|
19061
|
+
*
|
|
19062
|
+
* @returns The wrapped `LngLat` object.
|
|
19063
|
+
* @example
|
|
19064
|
+
* ```ts
|
|
19065
|
+
* let ll = new LngLat(286.0251, 40.7736);
|
|
19066
|
+
* let wrapped = ll.wrap();
|
|
19067
|
+
* wrapped.lng; // = -73.9749
|
|
19068
|
+
* ```
|
|
19069
|
+
*/
|
|
19070
|
+
wrap() {
|
|
19071
|
+
return new LngLat(wrap$1(this.lng, -180, 180), this.lat);
|
|
19163
19072
|
}
|
|
19164
|
-
|
|
19165
|
-
|
|
19073
|
+
/**
|
|
19074
|
+
* Returns the coordinates represented as an array of two numbers.
|
|
19075
|
+
*
|
|
19076
|
+
* @returns The coordinates represented as an array of longitude and latitude.
|
|
19077
|
+
* @example
|
|
19078
|
+
* ```ts
|
|
19079
|
+
* let ll = new LngLat(-73.9749, 40.7736);
|
|
19080
|
+
* ll.toArray(); // = [-73.9749, 40.7736]
|
|
19081
|
+
* ```
|
|
19082
|
+
*/
|
|
19083
|
+
toArray() {
|
|
19084
|
+
return [this.lng, this.lat];
|
|
19166
19085
|
}
|
|
19167
|
-
|
|
19168
|
-
|
|
19086
|
+
/**
|
|
19087
|
+
* Returns the coordinates represent as a string.
|
|
19088
|
+
*
|
|
19089
|
+
* @returns The coordinates represented as a string of the format `'LngLat(lng, lat)'`.
|
|
19090
|
+
* @example
|
|
19091
|
+
* ```ts
|
|
19092
|
+
* let ll = new LngLat(-73.9749, 40.7736);
|
|
19093
|
+
* ll.toString(); // = "LngLat(-73.9749, 40.7736)"
|
|
19094
|
+
* ```
|
|
19095
|
+
*/
|
|
19096
|
+
toString() {
|
|
19097
|
+
return `LngLat(${this.lng}, ${this.lat})`;
|
|
19169
19098
|
}
|
|
19170
|
-
|
|
19171
|
-
|
|
19099
|
+
/**
|
|
19100
|
+
* Returns the approximate distance between a pair of coordinates in meters
|
|
19101
|
+
* Uses the Haversine Formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
|
|
19102
|
+
*
|
|
19103
|
+
* @param lngLat - coordinates to compute the distance to
|
|
19104
|
+
* @returns Distance in meters between the two coordinates.
|
|
19105
|
+
* @example
|
|
19106
|
+
* ```ts
|
|
19107
|
+
* let new_york = new LngLat(-74.0060, 40.7128);
|
|
19108
|
+
* let los_angeles = new LngLat(-118.2437, 34.0522);
|
|
19109
|
+
* new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km
|
|
19110
|
+
* ```
|
|
19111
|
+
*/
|
|
19112
|
+
distanceTo(lngLat) {
|
|
19113
|
+
const rad = Math.PI / 180;
|
|
19114
|
+
const lat1 = this.lat * rad;
|
|
19115
|
+
const lat2 = lngLat.lat * rad;
|
|
19116
|
+
const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
19117
|
+
return earthRadius * Math.acos(Math.min(a, 1));
|
|
19118
|
+
}
|
|
19119
|
+
/**
|
|
19120
|
+
* Converts an array of two numbers or an object with `lng` and `lat` or `lon` and `lat` properties
|
|
19121
|
+
* to a `LngLat` object.
|
|
19122
|
+
*
|
|
19123
|
+
* If a `LngLat` object is passed in, the function returns it unchanged.
|
|
19124
|
+
*
|
|
19125
|
+
* @param input - An array of two numbers or object to convert, or a `LngLat` object to return.
|
|
19126
|
+
* @returns A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.
|
|
19127
|
+
* @example
|
|
19128
|
+
* ```ts
|
|
19129
|
+
* let arr = [-73.9749, 40.7736];
|
|
19130
|
+
* let ll = LngLat.convert(arr);
|
|
19131
|
+
* ll; // = LngLat {lng: -73.9749, lat: 40.7736}
|
|
19132
|
+
* ```
|
|
19133
|
+
*/
|
|
19134
|
+
static convert(input) {
|
|
19135
|
+
if (input instanceof LngLat) return input;
|
|
19136
|
+
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) return new LngLat(Number(input[0]), Number(input[1]));
|
|
19137
|
+
if (!Array.isArray(input) && typeof input === "object" && input !== null) return new LngLat(Number("lng" in input ? input.lng : input.lon), Number(input.lat));
|
|
19138
|
+
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]");
|
|
19139
|
+
}
|
|
19140
|
+
};
|
|
19141
|
+
//#endregion
|
|
19142
|
+
//#region src/geo/mercator_coordinate.ts
|
|
19143
|
+
const earthCircumference = 2 * Math.PI * earthRadius;
|
|
19144
|
+
function circumferenceAtLatitude(latitude) {
|
|
19145
|
+
return earthCircumference * Math.cos(latitude * Math.PI / 180);
|
|
19146
|
+
}
|
|
19147
|
+
function mercatorXfromLng(lng) {
|
|
19148
|
+
return (180 + lng) / 360;
|
|
19149
|
+
}
|
|
19150
|
+
function mercatorYfromLat(lat) {
|
|
19151
|
+
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;
|
|
19152
|
+
}
|
|
19153
|
+
function mercatorZfromAltitude(altitude, lat) {
|
|
19154
|
+
return altitude / circumferenceAtLatitude(lat);
|
|
19155
|
+
}
|
|
19156
|
+
function lngFromMercatorX(x) {
|
|
19157
|
+
return x * 360 - 180;
|
|
19158
|
+
}
|
|
19159
|
+
function latFromMercatorY(y) {
|
|
19160
|
+
const y2 = 180 - y * 360;
|
|
19161
|
+
return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
19162
|
+
}
|
|
19163
|
+
function altitudeFromMercatorZ(z, y) {
|
|
19164
|
+
return z * circumferenceAtLatitude(latFromMercatorY(y));
|
|
19165
|
+
}
|
|
19166
|
+
/**
|
|
19167
|
+
* Determine the Mercator scale factor for a given latitude, see
|
|
19168
|
+
* https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
|
|
19169
|
+
*
|
|
19170
|
+
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
19171
|
+
*
|
|
19172
|
+
* @param lat - Latitude
|
|
19173
|
+
* @returns scale factor
|
|
19174
|
+
*/
|
|
19175
|
+
function mercatorScale(lat) {
|
|
19176
|
+
return 1 / Math.cos(lat * Math.PI / 180);
|
|
19177
|
+
}
|
|
19178
|
+
/**
|
|
19179
|
+
* A `MercatorCoordinate` object represents a projected three dimensional position.
|
|
19180
|
+
*
|
|
19181
|
+
* `MercatorCoordinate` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
19182
|
+
*
|
|
19183
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
19184
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle
|
|
19185
|
+
*
|
|
19186
|
+
* For example, `MercatorCoordinate(0, 0, 0)` is the north-west corner of the mercator world and
|
|
19187
|
+
* `MercatorCoordinate(1, 1, 0)` is the south-east corner. If you are familiar with
|
|
19188
|
+
* [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
|
|
19189
|
+
* of the coordinate space as the `0/0/0` tile with an extent of `1`.
|
|
19190
|
+
*
|
|
19191
|
+
* The `z` dimension of `MercatorCoordinate` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
|
|
19192
|
+
*
|
|
19193
|
+
* @group Geography and Geometry
|
|
19194
|
+
*
|
|
19195
|
+
* @example
|
|
19196
|
+
* ```ts
|
|
19197
|
+
* let nullIsland = new MercatorCoordinate(0.5, 0.5, 0);
|
|
19198
|
+
* ```
|
|
19199
|
+
* @see [Add a custom style layer](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-custom-style-layer/)
|
|
19200
|
+
* @see [Add a 3D model using three.js](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-3d-model-using-threejs/)
|
|
19201
|
+
* @see [Add a simple custom layer on a globe](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-simple-custom-layer-on-a-globe/)
|
|
19202
|
+
*/
|
|
19203
|
+
var MercatorCoordinate = class MercatorCoordinate {
|
|
19204
|
+
/**
|
|
19205
|
+
* @param x - The x component of the position.
|
|
19206
|
+
* @param y - The y component of the position.
|
|
19207
|
+
* @param z - The z component of the position.
|
|
19208
|
+
*/
|
|
19209
|
+
constructor(x, y, z = 0) {
|
|
19210
|
+
this.x = +x;
|
|
19211
|
+
this.y = +y;
|
|
19212
|
+
this.z = +z;
|
|
19213
|
+
}
|
|
19214
|
+
/**
|
|
19215
|
+
* Project a `LngLat` to a `MercatorCoordinate`.
|
|
19216
|
+
*
|
|
19217
|
+
* @param lngLatLike - The location to project.
|
|
19218
|
+
* @param altitude - The altitude in meters of the position.
|
|
19219
|
+
* @returns The projected mercator coordinate.
|
|
19220
|
+
* @example
|
|
19221
|
+
* ```ts
|
|
19222
|
+
* let coord = MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);
|
|
19223
|
+
* coord; // MercatorCoordinate(0.5, 0.5, 0)
|
|
19224
|
+
* ```
|
|
19225
|
+
*/
|
|
19226
|
+
static fromLngLat(lngLatLike, altitude = 0) {
|
|
19227
|
+
const lngLat = LngLat.convert(lngLatLike);
|
|
19228
|
+
return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
19229
|
+
}
|
|
19230
|
+
/**
|
|
19231
|
+
* Returns the `LngLat` for the coordinate.
|
|
19232
|
+
*
|
|
19233
|
+
* @returns The `LngLat` object.
|
|
19234
|
+
* @example
|
|
19235
|
+
* ```ts
|
|
19236
|
+
* let coord = new MercatorCoordinate(0.5, 0.5, 0);
|
|
19237
|
+
* let lngLat = coord.toLngLat(); // LngLat(0, 0)
|
|
19238
|
+
* ```
|
|
19239
|
+
*/
|
|
19240
|
+
toLngLat() {
|
|
19241
|
+
return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
|
|
19242
|
+
}
|
|
19243
|
+
/**
|
|
19244
|
+
* Returns the altitude in meters of the coordinate.
|
|
19245
|
+
*
|
|
19246
|
+
* @returns The altitude in meters.
|
|
19247
|
+
* @example
|
|
19248
|
+
* ```ts
|
|
19249
|
+
* let coord = new MercatorCoordinate(0, 0, 0.02);
|
|
19250
|
+
* coord.toAltitude(); // 6914.281956295339
|
|
19251
|
+
* ```
|
|
19252
|
+
*/
|
|
19253
|
+
toAltitude() {
|
|
19254
|
+
return altitudeFromMercatorZ(this.z, this.y);
|
|
19255
|
+
}
|
|
19256
|
+
/**
|
|
19257
|
+
* Returns the distance of 1 meter in `MercatorCoordinate` units at this latitude.
|
|
19258
|
+
*
|
|
19259
|
+
* For coordinates in real world units using meters, this naturally provides the scale
|
|
19260
|
+
* to transform into `MercatorCoordinate`s.
|
|
19261
|
+
*
|
|
19262
|
+
* @returns Distance of 1 meter in `MercatorCoordinate` units.
|
|
19263
|
+
*/
|
|
19264
|
+
meterInMercatorCoordinateUnits() {
|
|
19265
|
+
return 1 / earthCircumference * mercatorScale(latFromMercatorY(this.y));
|
|
19266
|
+
}
|
|
19267
|
+
};
|
|
19268
|
+
//#endregion
|
|
19269
|
+
//#region src/geo/projection/mercator_utils.ts
|
|
19270
|
+
const maxMercatorHorizonAngle = 89.25;
|
|
19271
|
+
/**
|
|
19272
|
+
* Returns mercator coordinates in range 0..1 for given coordinates inside a specified tile.
|
|
19273
|
+
* @param inTileX - X coordinate in tile units - range [0..EXTENT].
|
|
19274
|
+
* @param inTileY - Y coordinate in tile units - range [0..EXTENT].
|
|
19275
|
+
* @param canonicalTileID - Tile canonical ID - mercator X, Y and zoom.
|
|
19276
|
+
* @returns Mercator coordinates of the specified point in range [0..1].
|
|
19277
|
+
*/
|
|
19278
|
+
function tileCoordinatesToMercatorCoordinates(inTileX, inTileY, canonicalTileID) {
|
|
19279
|
+
const scale = 1 / (1 << canonicalTileID.z);
|
|
19280
|
+
return new MercatorCoordinate(inTileX / EXTENT$1 * scale + canonicalTileID.x * scale, inTileY / EXTENT$1 * scale + canonicalTileID.y * scale);
|
|
19281
|
+
}
|
|
19282
|
+
/**
|
|
19283
|
+
* Returns LngLat for given in-tile coordinates and tile ID.
|
|
19284
|
+
* @param inTileX - X coordinate in tile units - range [0..EXTENT].
|
|
19285
|
+
* @param inTileY - Y coordinate in tile units - range [0..EXTENT].
|
|
19286
|
+
* @param canonicalTileID - Tile canonical ID - mercator X, Y and zoom.
|
|
19287
|
+
*/
|
|
19288
|
+
function tileCoordinatesToLocation(inTileX, inTileY, canonicalTileID) {
|
|
19289
|
+
return tileCoordinatesToMercatorCoordinates(inTileX, inTileY, canonicalTileID).toLngLat();
|
|
19290
|
+
}
|
|
19291
|
+
/**
|
|
19292
|
+
* Convert from LngLat to world coordinates (Mercator coordinates scaled by world size).
|
|
19293
|
+
* @param worldSize - Mercator world size computed from zoom level and tile size.
|
|
19294
|
+
* @param lnglat - The location to convert.
|
|
19295
|
+
* @returns Point
|
|
19296
|
+
*/
|
|
19297
|
+
function projectToWorldCoordinates(worldSize, lnglat) {
|
|
19298
|
+
const lat = clamp$2(lnglat.lat, -85.051129, MAX_VALID_LATITUDE);
|
|
19299
|
+
return new Point(mercatorXfromLng(lnglat.lng) * worldSize, mercatorYfromLat(lat) * worldSize);
|
|
19300
|
+
}
|
|
19301
|
+
/**
|
|
19302
|
+
* Convert from world coordinates (mercator coordinates scaled by world size) to LngLat.
|
|
19303
|
+
* @param worldSize - Mercator world size computed from zoom level and tile size.
|
|
19304
|
+
* @param point - World coordinate.
|
|
19305
|
+
* @returns LngLat
|
|
19306
|
+
*/
|
|
19307
|
+
function unprojectFromWorldCoordinates(worldSize, point) {
|
|
19308
|
+
return new MercatorCoordinate(point.x / worldSize, point.y / worldSize).toLngLat();
|
|
19309
|
+
}
|
|
19310
|
+
/**
|
|
19311
|
+
* Calculate pixel height of the visible horizon in relation to map-center (e.g. height/2),
|
|
19312
|
+
* multiplied by a static factor to simulate the earth-radius.
|
|
19313
|
+
* The calculated value is the horizontal line from the camera-height to sea-level.
|
|
19314
|
+
* @returns Horizon above center in pixels.
|
|
19315
|
+
*/
|
|
19316
|
+
function getMercatorHorizon(transform) {
|
|
19317
|
+
return transform.cameraToCenterDistance * Math.min(Math.tan(degreesToRadians(90 - transform.pitch)) * .85, Math.tan(degreesToRadians(maxMercatorHorizonAngle - transform.pitch)));
|
|
19318
|
+
}
|
|
19319
|
+
function calculateTileMatrix(unwrappedTileID, worldSize) {
|
|
19320
|
+
const canonical = unwrappedTileID.canonical;
|
|
19321
|
+
const scale = worldSize / zoomScale(canonical.z);
|
|
19322
|
+
const unwrappedX = canonical.x + Math.pow(2, canonical.z) * unwrappedTileID.wrap;
|
|
19323
|
+
const worldMatrix = /* @__PURE__ */ new Float64Array(16);
|
|
19324
|
+
identity$2(worldMatrix);
|
|
19325
|
+
translate$2(worldMatrix, worldMatrix, [
|
|
19326
|
+
unwrappedX * scale,
|
|
19327
|
+
canonical.y * scale,
|
|
19328
|
+
0
|
|
19329
|
+
]);
|
|
19330
|
+
scale$5(worldMatrix, worldMatrix, [
|
|
19331
|
+
scale / EXTENT$1,
|
|
19332
|
+
scale / EXTENT$1,
|
|
19333
|
+
1
|
|
19334
|
+
]);
|
|
19335
|
+
return worldMatrix;
|
|
19336
|
+
}
|
|
19337
|
+
function cameraMercatorCoordinateFromCenterAndRotation(center, elevation, pitch, bearing, distance) {
|
|
19338
|
+
const centerMercator = MercatorCoordinate.fromLngLat(center, elevation);
|
|
19339
|
+
const dMercator = distance * mercatorZfromAltitude(1, center.lat);
|
|
19340
|
+
const { x, y, z } = cameraDirectionFromPitchBearing(pitch, bearing);
|
|
19341
|
+
const dxMercator = dMercator * -x;
|
|
19342
|
+
const dyMercator = dMercator * -y;
|
|
19343
|
+
const dzMercator = dMercator * -z;
|
|
19344
|
+
return new MercatorCoordinate(centerMercator.x + dxMercator, centerMercator.y + dyMercator, centerMercator.z + dzMercator);
|
|
19345
|
+
}
|
|
19346
|
+
function cameraDirectionFromPitchBearing(pitch, bearing) {
|
|
19347
|
+
const pitchRadians = degreesToRadians(pitch);
|
|
19348
|
+
const bearingRadians = degreesToRadians(bearing);
|
|
19349
|
+
const z = Math.cos(-pitchRadians);
|
|
19350
|
+
const h = Math.sin(pitchRadians);
|
|
19351
|
+
return {
|
|
19352
|
+
x: h * Math.sin(bearingRadians),
|
|
19353
|
+
y: -h * Math.cos(bearingRadians),
|
|
19354
|
+
z
|
|
19355
|
+
};
|
|
19356
|
+
}
|
|
19357
|
+
//#endregion
|
|
19358
|
+
//#region src/data/bucket/round_polygon_corners.ts
|
|
19359
|
+
/**
|
|
19360
|
+
* Rounds polygon corners by calculating arc points at each corner vertex.
|
|
19361
|
+
* @param polygon - Collection of polygon rings (outer ring and hole rings)
|
|
19362
|
+
* @param distanceInMeters - Desired corner rounding distance in meters
|
|
19363
|
+
* @param canonical - Canonical tile ID used for meter to tile unit conversion
|
|
19364
|
+
*/
|
|
19365
|
+
function roundPolygonCorners(polygon, distanceInMeters, canonical) {
|
|
19366
|
+
if (distanceInMeters <= 0 || !polygon || polygon.length === 0) return polygon;
|
|
19367
|
+
const distanceInTileUnits = getTileUnitsForMeters(distanceInMeters, canonical);
|
|
19368
|
+
return polygon.map((ring) => roundRing(ring, distanceInTileUnits));
|
|
19369
|
+
}
|
|
19370
|
+
function getTileUnitsForMeters(distanceInMeters, canonical) {
|
|
19371
|
+
const centerLocation = tileCoordinatesToLocation(EXTENT$1 / 2, EXTENT$1 / 2, canonical);
|
|
19372
|
+
const meterInMercator = MercatorCoordinate.fromLngLat(centerLocation).meterInMercatorCoordinateUnits();
|
|
19373
|
+
const tileUnitsPerMercator = (1 << canonical.z) * EXTENT$1;
|
|
19374
|
+
return distanceInMeters * meterInMercator * tileUnitsPerMercator;
|
|
19375
|
+
}
|
|
19376
|
+
function roundRing(ring, distanceInTileUnits) {
|
|
19377
|
+
if (!ring || ring.length < 3) return ring;
|
|
19378
|
+
const isClosed = ring[0].x === ring[ring.length - 1].x && ring[0].y === ring[ring.length - 1].y;
|
|
19379
|
+
const vertexCount = isClosed ? ring.length - 1 : ring.length;
|
|
19380
|
+
if (vertexCount < 3) return ring;
|
|
19381
|
+
const vertices = ring.map((p) => fromValues(p.x, p.y));
|
|
19382
|
+
const newRing = [];
|
|
19383
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
19384
|
+
const prev = vertices[(i - 1 + vertexCount) % vertexCount];
|
|
19385
|
+
const current = vertices[i];
|
|
19386
|
+
const next = vertices[(i + 1) % vertexCount];
|
|
19387
|
+
appendRoundCorner(newRing, prev, current, next, distanceInTileUnits);
|
|
19388
|
+
}
|
|
19389
|
+
if (isClosed && newRing.length > 0) newRing.push(clone$1(newRing[0]));
|
|
19390
|
+
return newRing.map((p) => new Point(p[0], p[1]));
|
|
19391
|
+
}
|
|
19392
|
+
function appendRoundCorner(newRing, prev, current, next, distanceInTileUnits) {
|
|
19393
|
+
const ua = sub(create(), prev, current);
|
|
19394
|
+
const ub = sub(create(), next, current);
|
|
19395
|
+
const lenA = length(ua);
|
|
19396
|
+
const lenB = length(ub);
|
|
19397
|
+
if (lenA < 1e-6 || lenB < 1e-6) {
|
|
19398
|
+
newRing.push(clone$1(current));
|
|
19399
|
+
return;
|
|
19400
|
+
}
|
|
19401
|
+
scale(ua, ua, 1 / lenA);
|
|
19402
|
+
scale(ub, ub, 1 / lenB);
|
|
19403
|
+
const dot = dot$1(ua, ub);
|
|
19404
|
+
if (Math.abs(dot) > Math.cos(5 * Math.PI / 180)) {
|
|
19405
|
+
newRing.push(clone$1(current));
|
|
19406
|
+
return;
|
|
19407
|
+
}
|
|
19408
|
+
const maxEdgeLenPercent = .2;
|
|
19409
|
+
const r = Math.min(distanceInTileUnits, lenA * maxEdgeLenPercent, lenB * maxEdgeLenPercent);
|
|
19410
|
+
const tangentA = scaleAndAdd(create(), current, ua, r);
|
|
19411
|
+
const tangentB = scaleAndAdd(create(), current, ub, r);
|
|
19412
|
+
const bisector = add(create(), ua, ub);
|
|
19413
|
+
normalize(bisector, bisector);
|
|
19414
|
+
const cosHalfTheta = Math.sqrt((1 + dot) / 2);
|
|
19415
|
+
const center = scaleAndAdd(create(), current, bisector, r / cosHalfTheta);
|
|
19416
|
+
const radiusA = sub(create(), tangentA, center);
|
|
19417
|
+
const radiusB = sub(create(), tangentB, center);
|
|
19418
|
+
const sweepAngle = angle(radiusA, radiusB);
|
|
19419
|
+
const direction = Math.sign(radiusA[0] * radiusB[1] - radiusA[1] * radiusB[0]);
|
|
19420
|
+
const numSegments = Math.max(2, Math.ceil(sweepAngle / (Math.PI / 6) - 1e-6));
|
|
19421
|
+
for (let s = 0; s <= numSegments; s++) {
|
|
19422
|
+
const angle = direction * sweepAngle * (s / numSegments);
|
|
19423
|
+
newRing.push(rotate(create(), tangentA, center, angle));
|
|
19424
|
+
}
|
|
19425
|
+
}
|
|
19426
|
+
//#endregion
|
|
19427
|
+
//#region src/data/bucket/fill_extrusion_bucket.ts
|
|
19428
|
+
const EARCUT_MAX_RINGS = 500;
|
|
19429
|
+
const FACTOR = Math.pow(2, 13);
|
|
19430
|
+
function addVertex$1(vertexArray, x, y, nx, ny, nz, t, e) {
|
|
19431
|
+
vertexArray.emplaceBack(x, y, Math.floor(nx * FACTOR) * 2 + t, ny * FACTOR * 2, nz * FACTOR * 2, Math.round(e));
|
|
19432
|
+
}
|
|
19433
|
+
var FillExtrusionBucket = class {
|
|
19434
|
+
constructor(options) {
|
|
19435
|
+
this.zoom = options.zoom;
|
|
19436
|
+
this.overscaling = options.overscaling;
|
|
19437
|
+
this.layers = options.layers;
|
|
19438
|
+
this.layerIds = this.layers.map((layer) => layer.id);
|
|
19439
|
+
this.index = options.index;
|
|
19440
|
+
this.hasDependencies = false;
|
|
19441
|
+
this.layoutVertexArray = new FillExtrusionLayoutArray();
|
|
19442
|
+
this.centroidVertexArray = new PosArray();
|
|
19443
|
+
this.indexArray = new TriangleIndexArray();
|
|
19444
|
+
this.programConfigurations = new ProgramConfigurationSet(options.layers, options.zoom);
|
|
19445
|
+
this.segments = new SegmentVector();
|
|
19446
|
+
this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);
|
|
19447
|
+
}
|
|
19448
|
+
populate(features, options, canonical) {
|
|
19449
|
+
this.features = [];
|
|
19450
|
+
this.hasDependencies = hasPattern("fill-extrusion", this.layers, options);
|
|
19451
|
+
const globalProperties = new EvaluationParameters(this.zoom);
|
|
19452
|
+
const layer = this.layers[0];
|
|
19453
|
+
const roundedCornerDistance = layer.layout.get("fill-extrusion-rounded-corner-distance");
|
|
19454
|
+
const needGeometry = layer._featureFilter.needGeometry;
|
|
19455
|
+
for (const { feature, id, index, sourceLayerIndex } of features) {
|
|
19456
|
+
const evaluationFeature = toEvaluationFeature(feature, needGeometry);
|
|
19457
|
+
if (!layer._featureFilter.filter(globalProperties, evaluationFeature, canonical)) continue;
|
|
19458
|
+
const rawGeometry = needGeometry ? evaluationFeature.geometry : loadGeometry(feature);
|
|
19459
|
+
const bucketFeature = {
|
|
19460
|
+
id,
|
|
19461
|
+
sourceLayerIndex,
|
|
19462
|
+
index,
|
|
19463
|
+
geometry: roundedCornerDistance > 0 ? roundPolygonCorners(rawGeometry, roundedCornerDistance, canonical) : rawGeometry,
|
|
19464
|
+
properties: feature.properties,
|
|
19465
|
+
type: feature.type,
|
|
19466
|
+
patterns: {}
|
|
19467
|
+
};
|
|
19468
|
+
if (this.hasDependencies) this.features.push(addPatternDependencies("fill-extrusion", this.layers, bucketFeature, { zoom: this.zoom }, options));
|
|
19469
|
+
else this.addFeature(bucketFeature, bucketFeature.geometry, index, canonical, {}, options.subdivisionGranularity);
|
|
19470
|
+
options.featureIndex.insert(feature, bucketFeature.geometry, index, sourceLayerIndex, this.index, true);
|
|
19471
|
+
}
|
|
19472
|
+
}
|
|
19473
|
+
addFeatures(options, canonical, imagePositions) {
|
|
19474
|
+
for (const feature of this.features) {
|
|
19475
|
+
const { geometry } = feature;
|
|
19476
|
+
this.addFeature(feature, geometry, feature.index, canonical, imagePositions, options.subdivisionGranularity);
|
|
19477
|
+
}
|
|
19478
|
+
}
|
|
19479
|
+
update(states, vtLayer, imagePositions) {
|
|
19480
|
+
if (!this.stateDependentLayers.length) return;
|
|
19481
|
+
this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, { imagePositions });
|
|
19482
|
+
}
|
|
19483
|
+
isEmpty() {
|
|
19484
|
+
return this.layoutVertexArray.length === 0 && this.centroidVertexArray.length === 0;
|
|
19485
|
+
}
|
|
19486
|
+
uploadPending() {
|
|
19487
|
+
return !this.uploaded || this.programConfigurations.needsUpload;
|
|
19488
|
+
}
|
|
19489
|
+
upload(context) {
|
|
19490
|
+
if (!this.uploaded) {
|
|
19172
19491
|
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, members$2);
|
|
19173
19492
|
this.centroidVertexBuffer = context.createVertexBuffer(this.centroidVertexArray, centroidAttributes.members, true);
|
|
19174
19493
|
this.indexBuffer = context.createIndexBuffer(this.indexArray);
|
|
@@ -19185,7 +19504,10 @@ var FillExtrusionBucket = class {
|
|
|
19185
19504
|
this.centroidVertexBuffer.destroy();
|
|
19186
19505
|
}
|
|
19187
19506
|
addFeature(feature, geometry, index, canonical, imagePositions, subdivisionGranularity) {
|
|
19188
|
-
|
|
19507
|
+
const layer = this.layers[0];
|
|
19508
|
+
const roundedCornerDistance = layer.layout ? layer.layout.get("fill-extrusion-rounded-corner-distance") : 0;
|
|
19509
|
+
const processedGeometry = roundedCornerDistance > 0 ? roundPolygonCorners(geometry, roundedCornerDistance, canonical) : geometry;
|
|
19510
|
+
for (const polygon of classifyRings$1(processedGeometry, EARCUT_MAX_RINGS)) {
|
|
19189
19511
|
const centroid = {
|
|
19190
19512
|
x: 0,
|
|
19191
19513
|
y: 0,
|
|
@@ -19538,9 +19860,7 @@ function createFeature(id, type, geom, tags) {
|
|
|
19538
19860
|
case "MultiLineString":
|
|
19539
19861
|
for (const line of data.geom) calcLineBBox(feature, line.points);
|
|
19540
19862
|
break;
|
|
19541
|
-
case "MultiPolygon":
|
|
19542
|
-
for (const polygon of data.geom) calcLineBBox(feature, polygon[0].points);
|
|
19543
|
-
break;
|
|
19863
|
+
case "MultiPolygon": for (const polygon of data.geom) calcLineBBox(feature, polygon[0].points);
|
|
19544
19864
|
}
|
|
19545
19865
|
return feature;
|
|
19546
19866
|
}
|
|
@@ -20201,7 +20521,7 @@ var KDBush = class KDBush {
|
|
|
20201
20521
|
this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
20202
20522
|
this._pos = 0;
|
|
20203
20523
|
this._finished = false;
|
|
20204
|
-
new Uint8Array(data, 0, 2).set([219,
|
|
20524
|
+
new Uint8Array(data, 0, 2).set([219, 16 + arrayTypeIndex]);
|
|
20205
20525
|
new Uint16Array(data, 2, 1)[0] = nodeSize;
|
|
20206
20526
|
new Uint32Array(data, 4, 1)[0] = numItems;
|
|
20207
20527
|
}
|
|
@@ -21364,9 +21684,8 @@ const EXTRUDE_SCALE = 63;
|
|
|
21364
21684
|
const COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180));
|
|
21365
21685
|
const SHARP_CORNER_OFFSET = 15;
|
|
21366
21686
|
const DEG_PER_TRIANGLE = 20;
|
|
21367
|
-
const LINE_DISTANCE_BUFFER_BITS = 15;
|
|
21368
21687
|
const LINE_DISTANCE_SCALE = 1 / 2;
|
|
21369
|
-
const MAX_LINE_DISTANCE = Math.pow(2,
|
|
21688
|
+
const MAX_LINE_DISTANCE = Math.pow(2, 14) / LINE_DISTANCE_SCALE;
|
|
21370
21689
|
/**
|
|
21371
21690
|
* @internal
|
|
21372
21691
|
* Line bucket class
|
|
@@ -22528,7 +22847,7 @@ var TaggedString = class TaggedString {
|
|
|
22528
22847
|
};
|
|
22529
22848
|
//#endregion
|
|
22530
22849
|
//#region node_modules/pbf/index.js
|
|
22531
|
-
const SHIFT_LEFT_32 =
|
|
22850
|
+
const SHIFT_LEFT_32 = 4294967296;
|
|
22532
22851
|
const SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
|
|
22533
22852
|
const TEXT_DECODER_MIN_LENGTH$1 = 12;
|
|
22534
22853
|
const utf8TextDecoder$1 = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
|
|
@@ -23303,9 +23622,6 @@ function writeUtf8(buf, str, pos) {
|
|
|
23303
23622
|
}
|
|
23304
23623
|
return pos;
|
|
23305
23624
|
}
|
|
23306
|
-
//#endregion
|
|
23307
|
-
//#region src/style/parse_glyph_pbf.ts
|
|
23308
|
-
const border$1 = 3;
|
|
23309
23625
|
function readFontstacks(tag, glyphs, pbf) {
|
|
23310
23626
|
if (tag === 1) pbf.readMessage(readFontstack, glyphs);
|
|
23311
23627
|
}
|
|
@@ -23315,8 +23631,8 @@ function readFontstack(tag, glyphs, pbf) {
|
|
|
23315
23631
|
glyphs.push({
|
|
23316
23632
|
id,
|
|
23317
23633
|
bitmap: new AlphaImage({
|
|
23318
|
-
width: width +
|
|
23319
|
-
height: height +
|
|
23634
|
+
width: width + 6,
|
|
23635
|
+
height: height + 6
|
|
23320
23636
|
}, bitmap),
|
|
23321
23637
|
metrics: {
|
|
23322
23638
|
width,
|
|
@@ -23646,10 +23962,8 @@ function getAnchorAlignment(anchor) {
|
|
|
23646
23962
|
horizontalAlign = 1;
|
|
23647
23963
|
break;
|
|
23648
23964
|
case "left":
|
|
23649
|
-
case "top-left":
|
|
23650
|
-
case "bottom-left":
|
|
23651
|
-
horizontalAlign = 0;
|
|
23652
|
-
break;
|
|
23965
|
+
case "top-left":
|
|
23966
|
+
case "bottom-left": horizontalAlign = 0;
|
|
23653
23967
|
}
|
|
23654
23968
|
switch (anchor) {
|
|
23655
23969
|
case "bottom":
|
|
@@ -23659,9 +23973,7 @@ function getAnchorAlignment(anchor) {
|
|
|
23659
23973
|
break;
|
|
23660
23974
|
case "top":
|
|
23661
23975
|
case "top-right":
|
|
23662
|
-
case "top-left":
|
|
23663
|
-
verticalAlign = 0;
|
|
23664
|
-
break;
|
|
23976
|
+
case "top-left": verticalAlign = 0;
|
|
23665
23977
|
}
|
|
23666
23978
|
return {
|
|
23667
23979
|
horizontalAlign,
|
|
@@ -24719,502 +25031,259 @@ function getIconPadding(layout, feature, canonical, pixelRatio = 1) {
|
|
|
24719
25031
|
values[1] * pixelRatio,
|
|
24720
25032
|
values[2] * pixelRatio,
|
|
24721
25033
|
values[3] * pixelRatio
|
|
24722
|
-
];
|
|
24723
|
-
}
|
|
24724
|
-
//#endregion
|
|
24725
|
-
//#region src/style/style_layer/background_style_layer_properties.g.ts
|
|
24726
|
-
let paint;
|
|
24727
|
-
const getPaint = () => paint = paint || new Properties({
|
|
24728
|
-
"background-color": new DataConstantProperty(latest["paint_background"]["background-color"], "background-color"),
|
|
24729
|
-
"background-pattern": new CrossFadedProperty(latest["paint_background"]["background-pattern"], "background-pattern"),
|
|
24730
|
-
"background-opacity": new DataConstantProperty(latest["paint_background"]["background-opacity"], "background-opacity")
|
|
24731
|
-
});
|
|
24732
|
-
var background_style_layer_properties_g_default = { get paint() {
|
|
24733
|
-
return getPaint();
|
|
24734
|
-
} };
|
|
24735
|
-
//#endregion
|
|
24736
|
-
//#region src/style/style_layer/background_style_layer.ts
|
|
24737
|
-
const isBackgroundStyleLayer = (layer) => layer.type === "background";
|
|
24738
|
-
var BackgroundStyleLayer = class extends StyleLayer {
|
|
24739
|
-
constructor(layer, globalState) {
|
|
24740
|
-
super(layer, background_style_layer_properties_g_default, globalState);
|
|
24741
|
-
}
|
|
24742
|
-
};
|
|
24743
|
-
//#endregion
|
|
24744
|
-
//#region src/style/style_layer/custom_style_layer.ts
|
|
24745
|
-
function validateCustomStyleLayer(layerObject) {
|
|
24746
|
-
const errors = [];
|
|
24747
|
-
const id = layerObject.id;
|
|
24748
|
-
if (id === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required property \"id\""));
|
|
24749
|
-
if (layerObject.render === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required method \"render\""));
|
|
24750
|
-
if (layerObject.renderingMode && layerObject.renderingMode !== "2d" && layerObject.renderingMode !== "3d") errors.push(new ValidationError(`layers.${id}`, null, "property \"renderingMode\" must be either \"2d\" or \"3d\""));
|
|
24751
|
-
return errors;
|
|
24752
|
-
}
|
|
24753
|
-
const isCustomStyleLayer = (layer) => layer.type === "custom";
|
|
24754
|
-
var CustomStyleLayer = class extends StyleLayer {
|
|
24755
|
-
constructor(implementation, globalState) {
|
|
24756
|
-
super(implementation, {}, globalState);
|
|
24757
|
-
this.onAdd = (map) => {
|
|
24758
|
-
if (this.implementation.onAdd) this.implementation.onAdd(map, map.painter.context.gl);
|
|
24759
|
-
};
|
|
24760
|
-
this.onRemove = (map) => {
|
|
24761
|
-
if (this.implementation.onRemove) this.implementation.onRemove(map, map.painter.context.gl);
|
|
24762
|
-
};
|
|
24763
|
-
this.implementation = implementation;
|
|
24764
|
-
}
|
|
24765
|
-
is3D() {
|
|
24766
|
-
return this.implementation.renderingMode === "3d";
|
|
24767
|
-
}
|
|
24768
|
-
hasOffscreenPass() {
|
|
24769
|
-
return this.implementation.prerender !== void 0;
|
|
24770
|
-
}
|
|
24771
|
-
recalculate() {}
|
|
24772
|
-
updateTransitions() {}
|
|
24773
|
-
hasTransition() {
|
|
24774
|
-
return false;
|
|
24775
|
-
}
|
|
24776
|
-
serialize() {
|
|
24777
|
-
throw new Error("Custom layers cannot be serialized");
|
|
24778
|
-
}
|
|
24779
|
-
};
|
|
24780
|
-
//#endregion
|
|
24781
|
-
//#region src/style/create_style_layer.ts
|
|
24782
|
-
function createStyleLayer(layer, globalState) {
|
|
24783
|
-
if (layer.type === "custom") return new CustomStyleLayer(layer, globalState);
|
|
24784
|
-
switch (layer.type) {
|
|
24785
|
-
case "background": return new BackgroundStyleLayer(layer, globalState);
|
|
24786
|
-
case "circle": return new CircleStyleLayer(layer, globalState);
|
|
24787
|
-
case "color-relief": return new ColorReliefStyleLayer(layer, globalState);
|
|
24788
|
-
case "fill": return new FillStyleLayer(layer, globalState);
|
|
24789
|
-
case "fill-extrusion": return new FillExtrusionStyleLayer(layer, globalState);
|
|
24790
|
-
case "heatmap": return new HeatmapStyleLayer(layer, globalState);
|
|
24791
|
-
case "hillshade": return new HillshadeStyleLayer(layer, globalState);
|
|
24792
|
-
case "line": return new LineStyleLayer(layer, globalState);
|
|
24793
|
-
case "raster": return new RasterStyleLayer(layer, globalState);
|
|
24794
|
-
case "symbol": return new SymbolStyleLayer(layer, globalState);
|
|
24795
|
-
}
|
|
24796
|
-
}
|
|
24797
|
-
//#endregion
|
|
24798
|
-
//#region src/util/throttled_invoker.ts
|
|
24799
|
-
/**
|
|
24800
|
-
* Invokes the wrapped function in a non-blocking way when trigger() is called.
|
|
24801
|
-
* Invocation requests are ignored until the function was actually invoked.
|
|
24802
|
-
*/
|
|
24803
|
-
var ThrottledInvoker = class {
|
|
24804
|
-
constructor(methodToThrottle) {
|
|
24805
|
-
this._methodToThrottle = methodToThrottle;
|
|
24806
|
-
this._triggered = false;
|
|
24807
|
-
this._channel = new MessageChannel();
|
|
24808
|
-
this._channel.port2.onmessage = () => {
|
|
24809
|
-
this._triggered = false;
|
|
24810
|
-
this._methodToThrottle();
|
|
24811
|
-
};
|
|
24812
|
-
}
|
|
24813
|
-
trigger() {
|
|
24814
|
-
if (this._triggered) return;
|
|
24815
|
-
this._triggered = true;
|
|
24816
|
-
this._channel?.port1.postMessage(true);
|
|
24817
|
-
}
|
|
24818
|
-
remove() {
|
|
24819
|
-
delete this._channel;
|
|
24820
|
-
this._methodToThrottle = () => {};
|
|
24821
|
-
}
|
|
24822
|
-
};
|
|
24823
|
-
//#endregion
|
|
24824
|
-
//#region src/util/actor.ts
|
|
24825
|
-
const addEventDefaultOptions = { once: true };
|
|
24826
|
-
/**
|
|
24827
|
-
* An implementation of the [Actor design pattern](https://en.wikipedia.org/wiki/Actor_model)
|
|
24828
|
-
* that maintains the relationship between asynchronous tasks and the objects
|
|
24829
|
-
* that spin them off - in this case, tasks like parsing parts of styles,
|
|
24830
|
-
* owned by the styles
|
|
24831
|
-
*/
|
|
24832
|
-
var Actor = class {
|
|
24833
|
-
/**
|
|
24834
|
-
* @param target - The target
|
|
24835
|
-
* @param mapId - A unique identifier for the Map instance using this Actor.
|
|
24836
|
-
*/
|
|
24837
|
-
constructor(target, mapId) {
|
|
24838
|
-
this.target = target;
|
|
24839
|
-
this.mapId = mapId;
|
|
24840
|
-
this.resolveRejects = {};
|
|
24841
|
-
this.tasks = {};
|
|
24842
|
-
this.taskQueue = [];
|
|
24843
|
-
this.abortControllers = {};
|
|
24844
|
-
this.messageHandlers = {};
|
|
24845
|
-
this.invoker = new ThrottledInvoker(() => this.process());
|
|
24846
|
-
this.subscription = subscribe(this.target, "message", (message) => this.receive(message), false);
|
|
24847
|
-
this.globalScope = isWorker(self) ? target : window;
|
|
24848
|
-
}
|
|
24849
|
-
registerMessageHandler(type, handler) {
|
|
24850
|
-
this.messageHandlers[type] = handler;
|
|
24851
|
-
}
|
|
24852
|
-
unregisterMessageHandler(type) {
|
|
24853
|
-
delete this.messageHandlers[type];
|
|
24854
|
-
}
|
|
24855
|
-
/**
|
|
24856
|
-
* Sends a message from a main-thread map to a Worker or from a Worker back to
|
|
24857
|
-
* a main-thread map instance.
|
|
24858
|
-
* @param message - the message to send
|
|
24859
|
-
* @param abortController - an optional AbortController to abort the request
|
|
24860
|
-
* @returns a promise that will be resolved with the response data
|
|
24861
|
-
*/
|
|
24862
|
-
sendAsync(message, abortController) {
|
|
24863
|
-
return new Promise((resolve, reject) => {
|
|
24864
|
-
const id = Math.round(Math.random() * 0xde0b6b3a7640000).toString(36).substring(0, 10);
|
|
24865
|
-
const subscription = abortController ? subscribe(abortController.signal, "abort", () => {
|
|
24866
|
-
subscription?.unsubscribe();
|
|
24867
|
-
delete this.resolveRejects[id];
|
|
24868
|
-
const cancelMessage = {
|
|
24869
|
-
id,
|
|
24870
|
-
type: "<cancel>",
|
|
24871
|
-
origin: location.origin,
|
|
24872
|
-
targetMapId: message.targetMapId,
|
|
24873
|
-
sourceMapId: this.mapId
|
|
24874
|
-
};
|
|
24875
|
-
this.target.postMessage(cancelMessage);
|
|
24876
|
-
reject(new AbortError(abortController.signal.reason));
|
|
24877
|
-
}, addEventDefaultOptions) : null;
|
|
24878
|
-
this.resolveRejects[id] = {
|
|
24879
|
-
resolve: (value) => {
|
|
24880
|
-
subscription?.unsubscribe();
|
|
24881
|
-
resolve(value);
|
|
24882
|
-
},
|
|
24883
|
-
reject: (reason) => {
|
|
24884
|
-
subscription?.unsubscribe();
|
|
24885
|
-
reject(reason);
|
|
24886
|
-
}
|
|
24887
|
-
};
|
|
24888
|
-
const buffers = [];
|
|
24889
|
-
const messageToPost = {
|
|
24890
|
-
...message,
|
|
24891
|
-
id,
|
|
24892
|
-
sourceMapId: this.mapId,
|
|
24893
|
-
origin: location.origin,
|
|
24894
|
-
data: serialize(message.data, buffers)
|
|
24895
|
-
};
|
|
24896
|
-
this.target.postMessage(messageToPost, { transfer: buffers });
|
|
24897
|
-
});
|
|
24898
|
-
}
|
|
24899
|
-
receive(message) {
|
|
24900
|
-
const data = message.data;
|
|
24901
|
-
const id = data.id;
|
|
24902
|
-
const SPECIAL_ORIGINS = [
|
|
24903
|
-
"file://",
|
|
24904
|
-
"resource://android",
|
|
24905
|
-
"null"
|
|
24906
|
-
];
|
|
24907
|
-
const origins = [data.origin, location.origin];
|
|
24908
|
-
const isSameOrigin = data.origin === location.origin;
|
|
24909
|
-
const hasSpecialOrigin = origins.some((origin) => SPECIAL_ORIGINS.includes(origin));
|
|
24910
|
-
if (!isSameOrigin && !hasSpecialOrigin) return;
|
|
24911
|
-
if (data.targetMapId && this.mapId !== data.targetMapId) return;
|
|
24912
|
-
if (data.type === "<cancel>") {
|
|
24913
|
-
delete this.tasks[id];
|
|
24914
|
-
const abortController = this.abortControllers[id];
|
|
24915
|
-
delete this.abortControllers[id];
|
|
24916
|
-
if (abortController) abortController.abort();
|
|
24917
|
-
return;
|
|
24918
|
-
}
|
|
24919
|
-
if (isWorker(self) || data.mustQueue) {
|
|
24920
|
-
this.tasks[id] = data;
|
|
24921
|
-
this.taskQueue.push(id);
|
|
24922
|
-
this.invoker.trigger();
|
|
24923
|
-
return;
|
|
24924
|
-
}
|
|
24925
|
-
this.processTask(id, data);
|
|
24926
|
-
}
|
|
24927
|
-
process() {
|
|
24928
|
-
if (this.taskQueue.length === 0) return;
|
|
24929
|
-
const id = this.taskQueue.shift();
|
|
24930
|
-
const task = this.tasks[id];
|
|
24931
|
-
delete this.tasks[id];
|
|
24932
|
-
if (this.taskQueue.length > 0) this.invoker.trigger();
|
|
24933
|
-
if (!task) return;
|
|
24934
|
-
this.processTask(id, task);
|
|
24935
|
-
}
|
|
24936
|
-
async processTask(id, task) {
|
|
24937
|
-
if (task.type === "<response>") {
|
|
24938
|
-
const resolveReject = this.resolveRejects[id];
|
|
24939
|
-
delete this.resolveRejects[id];
|
|
24940
|
-
if (!resolveReject) return;
|
|
24941
|
-
if (task.error) resolveReject.reject(ensureError(deserialize(task.error)));
|
|
24942
|
-
else resolveReject.resolve(deserialize(task.data));
|
|
24943
|
-
return;
|
|
24944
|
-
}
|
|
24945
|
-
if (!this.messageHandlers[task.type]) {
|
|
24946
|
-
this.completeTask(id, null, null);
|
|
24947
|
-
return;
|
|
24948
|
-
}
|
|
24949
|
-
const params = deserialize(task.data);
|
|
24950
|
-
const abortController = new AbortController();
|
|
24951
|
-
this.abortControllers[id] = abortController;
|
|
24952
|
-
try {
|
|
24953
|
-
const data = await this.messageHandlers[task.type](task.sourceMapId, params, abortController);
|
|
24954
|
-
this.completeTask(id, null, data);
|
|
24955
|
-
} catch (err) {
|
|
24956
|
-
this.completeTask(id, ensureError(err));
|
|
24957
|
-
}
|
|
24958
|
-
}
|
|
24959
|
-
completeTask(id, err, data) {
|
|
24960
|
-
const buffers = [];
|
|
24961
|
-
delete this.abortControllers[id];
|
|
24962
|
-
const responseMessage = {
|
|
24963
|
-
id,
|
|
24964
|
-
type: "<response>",
|
|
24965
|
-
sourceMapId: this.mapId,
|
|
24966
|
-
origin: location.origin,
|
|
24967
|
-
error: err ? serialize(err) : null,
|
|
24968
|
-
data: serialize(data, buffers)
|
|
24969
|
-
};
|
|
24970
|
-
this.target.postMessage(responseMessage, { transfer: buffers });
|
|
24971
|
-
}
|
|
24972
|
-
remove() {
|
|
24973
|
-
this.invoker.remove();
|
|
24974
|
-
this.subscription.unsubscribe();
|
|
25034
|
+
];
|
|
25035
|
+
}
|
|
25036
|
+
//#endregion
|
|
25037
|
+
//#region src/style/style_layer/background_style_layer_properties.g.ts
|
|
25038
|
+
let paint;
|
|
25039
|
+
const getPaint = () => paint = paint || new Properties({
|
|
25040
|
+
"background-color": new DataConstantProperty(latest["paint_background"]["background-color"], "background-color"),
|
|
25041
|
+
"background-pattern": new CrossFadedProperty(latest["paint_background"]["background-pattern"], "background-pattern"),
|
|
25042
|
+
"background-opacity": new DataConstantProperty(latest["paint_background"]["background-opacity"], "background-opacity")
|
|
25043
|
+
});
|
|
25044
|
+
var background_style_layer_properties_g_default = { get paint() {
|
|
25045
|
+
return getPaint();
|
|
25046
|
+
} };
|
|
25047
|
+
//#endregion
|
|
25048
|
+
//#region src/style/style_layer/background_style_layer.ts
|
|
25049
|
+
const isBackgroundStyleLayer = (layer) => layer.type === "background";
|
|
25050
|
+
var BackgroundStyleLayer = class extends StyleLayer {
|
|
25051
|
+
constructor(layer, globalState) {
|
|
25052
|
+
super(layer, background_style_layer_properties_g_default, globalState);
|
|
24975
25053
|
}
|
|
24976
25054
|
};
|
|
24977
25055
|
//#endregion
|
|
24978
|
-
//#region src/
|
|
24979
|
-
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
|
|
24985
|
-
|
|
24986
|
-
|
|
24987
|
-
|
|
24988
|
-
|
|
24989
|
-
|
|
24990
|
-
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24997
|
-
|
|
24998
|
-
* @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)
|
|
24999
|
-
*/
|
|
25000
|
-
var LngLat = class LngLat {
|
|
25001
|
-
/**
|
|
25002
|
-
* @param lng - Longitude, measured in degrees.
|
|
25003
|
-
* @param lat - Latitude, measured in degrees.
|
|
25004
|
-
*/
|
|
25005
|
-
constructor(lng, lat) {
|
|
25006
|
-
if (isNaN(lng) || isNaN(lat)) throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
|
|
25007
|
-
this.lng = +lng;
|
|
25008
|
-
this.lat = +lat;
|
|
25009
|
-
if (this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
|
|
25010
|
-
}
|
|
25011
|
-
/**
|
|
25012
|
-
* Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).
|
|
25013
|
-
*
|
|
25014
|
-
* @returns The wrapped `LngLat` object.
|
|
25015
|
-
* @example
|
|
25016
|
-
* ```ts
|
|
25017
|
-
* let ll = new LngLat(286.0251, 40.7736);
|
|
25018
|
-
* let wrapped = ll.wrap();
|
|
25019
|
-
* wrapped.lng; // = -73.9749
|
|
25020
|
-
* ```
|
|
25021
|
-
*/
|
|
25022
|
-
wrap() {
|
|
25023
|
-
return new LngLat(wrap$1(this.lng, -180, 180), this.lat);
|
|
25056
|
+
//#region src/style/style_layer/custom_style_layer.ts
|
|
25057
|
+
function validateCustomStyleLayer(layerObject) {
|
|
25058
|
+
const errors = [];
|
|
25059
|
+
const id = layerObject.id;
|
|
25060
|
+
if (id === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required property \"id\""));
|
|
25061
|
+
if (layerObject.render === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required method \"render\""));
|
|
25062
|
+
if (layerObject.renderingMode && layerObject.renderingMode !== "2d" && layerObject.renderingMode !== "3d") errors.push(new ValidationError(`layers.${id}`, null, "property \"renderingMode\" must be either \"2d\" or \"3d\""));
|
|
25063
|
+
return errors;
|
|
25064
|
+
}
|
|
25065
|
+
const isCustomStyleLayer = (layer) => layer.type === "custom";
|
|
25066
|
+
var CustomStyleLayer = class extends StyleLayer {
|
|
25067
|
+
constructor(implementation, globalState) {
|
|
25068
|
+
super(implementation, {}, globalState);
|
|
25069
|
+
this.onAdd = (map) => {
|
|
25070
|
+
if (this.implementation.onAdd) this.implementation.onAdd(map, map.painter.context.gl);
|
|
25071
|
+
};
|
|
25072
|
+
this.onRemove = (map) => {
|
|
25073
|
+
if (this.implementation.onRemove) this.implementation.onRemove(map, map.painter.context.gl);
|
|
25074
|
+
};
|
|
25075
|
+
this.implementation = implementation;
|
|
25024
25076
|
}
|
|
25025
|
-
|
|
25026
|
-
|
|
25027
|
-
*
|
|
25028
|
-
* @returns The coordinates represented as an array of longitude and latitude.
|
|
25029
|
-
* @example
|
|
25030
|
-
* ```ts
|
|
25031
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
25032
|
-
* ll.toArray(); // = [-73.9749, 40.7736]
|
|
25033
|
-
* ```
|
|
25034
|
-
*/
|
|
25035
|
-
toArray() {
|
|
25036
|
-
return [this.lng, this.lat];
|
|
25077
|
+
is3D() {
|
|
25078
|
+
return this.implementation.renderingMode === "3d";
|
|
25037
25079
|
}
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
*
|
|
25041
|
-
* @returns The coordinates represented as a string of the format `'LngLat(lng, lat)'`.
|
|
25042
|
-
* @example
|
|
25043
|
-
* ```ts
|
|
25044
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
25045
|
-
* ll.toString(); // = "LngLat(-73.9749, 40.7736)"
|
|
25046
|
-
* ```
|
|
25047
|
-
*/
|
|
25048
|
-
toString() {
|
|
25049
|
-
return `LngLat(${this.lng}, ${this.lat})`;
|
|
25080
|
+
hasOffscreenPass() {
|
|
25081
|
+
return this.implementation.prerender !== void 0;
|
|
25050
25082
|
}
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
* @param lngLat - coordinates to compute the distance to
|
|
25056
|
-
* @returns Distance in meters between the two coordinates.
|
|
25057
|
-
* @example
|
|
25058
|
-
* ```ts
|
|
25059
|
-
* let new_york = new LngLat(-74.0060, 40.7128);
|
|
25060
|
-
* let los_angeles = new LngLat(-118.2437, 34.0522);
|
|
25061
|
-
* new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km
|
|
25062
|
-
* ```
|
|
25063
|
-
*/
|
|
25064
|
-
distanceTo(lngLat) {
|
|
25065
|
-
const rad = Math.PI / 180;
|
|
25066
|
-
const lat1 = this.lat * rad;
|
|
25067
|
-
const lat2 = lngLat.lat * rad;
|
|
25068
|
-
const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
25069
|
-
return earthRadius * Math.acos(Math.min(a, 1));
|
|
25083
|
+
recalculate() {}
|
|
25084
|
+
updateTransitions() {}
|
|
25085
|
+
hasTransition() {
|
|
25086
|
+
return false;
|
|
25070
25087
|
}
|
|
25071
|
-
|
|
25072
|
-
|
|
25073
|
-
* to a `LngLat` object.
|
|
25074
|
-
*
|
|
25075
|
-
* If a `LngLat` object is passed in, the function returns it unchanged.
|
|
25076
|
-
*
|
|
25077
|
-
* @param input - An array of two numbers or object to convert, or a `LngLat` object to return.
|
|
25078
|
-
* @returns A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.
|
|
25079
|
-
* @example
|
|
25080
|
-
* ```ts
|
|
25081
|
-
* let arr = [-73.9749, 40.7736];
|
|
25082
|
-
* let ll = LngLat.convert(arr);
|
|
25083
|
-
* ll; // = LngLat {lng: -73.9749, lat: 40.7736}
|
|
25084
|
-
* ```
|
|
25085
|
-
*/
|
|
25086
|
-
static convert(input) {
|
|
25087
|
-
if (input instanceof LngLat) return input;
|
|
25088
|
-
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) return new LngLat(Number(input[0]), Number(input[1]));
|
|
25089
|
-
if (!Array.isArray(input) && typeof input === "object" && input !== null) return new LngLat(Number("lng" in input ? input.lng : input.lon), Number(input.lat));
|
|
25090
|
-
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]");
|
|
25088
|
+
serialize() {
|
|
25089
|
+
throw new Error("Custom layers cannot be serialized");
|
|
25091
25090
|
}
|
|
25092
25091
|
};
|
|
25093
25092
|
//#endregion
|
|
25094
|
-
//#region src/
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
|
|
25103
|
-
|
|
25104
|
-
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
|
|
25108
|
-
|
|
25109
|
-
return x * 360 - 180;
|
|
25110
|
-
}
|
|
25111
|
-
function latFromMercatorY(y) {
|
|
25112
|
-
const y2 = 180 - y * 360;
|
|
25113
|
-
return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
25114
|
-
}
|
|
25115
|
-
function altitudeFromMercatorZ(z, y) {
|
|
25116
|
-
return z * circumferenceAtLatitude(latFromMercatorY(y));
|
|
25093
|
+
//#region src/style/create_style_layer.ts
|
|
25094
|
+
function createStyleLayer(layer, globalState) {
|
|
25095
|
+
if (layer.type === "custom") return new CustomStyleLayer(layer, globalState);
|
|
25096
|
+
switch (layer.type) {
|
|
25097
|
+
case "background": return new BackgroundStyleLayer(layer, globalState);
|
|
25098
|
+
case "circle": return new CircleStyleLayer(layer, globalState);
|
|
25099
|
+
case "color-relief": return new ColorReliefStyleLayer(layer, globalState);
|
|
25100
|
+
case "fill": return new FillStyleLayer(layer, globalState);
|
|
25101
|
+
case "fill-extrusion": return new FillExtrusionStyleLayer(layer, globalState);
|
|
25102
|
+
case "heatmap": return new HeatmapStyleLayer(layer, globalState);
|
|
25103
|
+
case "hillshade": return new HillshadeStyleLayer(layer, globalState);
|
|
25104
|
+
case "line": return new LineStyleLayer(layer, globalState);
|
|
25105
|
+
case "raster": return new RasterStyleLayer(layer, globalState);
|
|
25106
|
+
case "symbol": return new SymbolStyleLayer(layer, globalState);
|
|
25107
|
+
}
|
|
25117
25108
|
}
|
|
25109
|
+
//#endregion
|
|
25110
|
+
//#region src/util/throttled_invoker.ts
|
|
25118
25111
|
/**
|
|
25119
|
-
*
|
|
25120
|
-
*
|
|
25121
|
-
*
|
|
25122
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
25123
|
-
*
|
|
25124
|
-
* @param lat - Latitude
|
|
25125
|
-
* @returns scale factor
|
|
25112
|
+
* Invokes the wrapped function in a non-blocking way when trigger() is called.
|
|
25113
|
+
* Invocation requests are ignored until the function was actually invoked.
|
|
25126
25114
|
*/
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25135
|
-
|
|
25136
|
-
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
|
|
25140
|
-
|
|
25141
|
-
|
|
25142
|
-
|
|
25143
|
-
|
|
25144
|
-
|
|
25145
|
-
|
|
25146
|
-
|
|
25147
|
-
|
|
25148
|
-
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
*
|
|
25152
|
-
*
|
|
25153
|
-
*
|
|
25115
|
+
var ThrottledInvoker = class {
|
|
25116
|
+
constructor(methodToThrottle) {
|
|
25117
|
+
this._methodToThrottle = methodToThrottle;
|
|
25118
|
+
this._triggered = false;
|
|
25119
|
+
this._channel = new MessageChannel();
|
|
25120
|
+
this._channel.port2.onmessage = () => {
|
|
25121
|
+
this._triggered = false;
|
|
25122
|
+
this._methodToThrottle();
|
|
25123
|
+
};
|
|
25124
|
+
}
|
|
25125
|
+
trigger() {
|
|
25126
|
+
if (this._triggered) return;
|
|
25127
|
+
this._triggered = true;
|
|
25128
|
+
this._channel?.port1.postMessage(true);
|
|
25129
|
+
}
|
|
25130
|
+
remove() {
|
|
25131
|
+
delete this._channel;
|
|
25132
|
+
this._methodToThrottle = () => {};
|
|
25133
|
+
}
|
|
25134
|
+
};
|
|
25135
|
+
//#endregion
|
|
25136
|
+
//#region src/util/actor.ts
|
|
25137
|
+
const addEventDefaultOptions = { once: true };
|
|
25138
|
+
/**
|
|
25139
|
+
* An implementation of the [Actor design pattern](https://en.wikipedia.org/wiki/Actor_model)
|
|
25140
|
+
* that maintains the relationship between asynchronous tasks and the objects
|
|
25141
|
+
* that spin them off - in this case, tasks like parsing parts of styles,
|
|
25142
|
+
* owned by the styles
|
|
25154
25143
|
*/
|
|
25155
|
-
var
|
|
25144
|
+
var Actor = class {
|
|
25156
25145
|
/**
|
|
25157
|
-
* @param
|
|
25158
|
-
* @param
|
|
25159
|
-
* @param z - The z component of the position.
|
|
25146
|
+
* @param target - The target
|
|
25147
|
+
* @param mapId - A unique identifier for the Map instance using this Actor.
|
|
25160
25148
|
*/
|
|
25161
|
-
constructor(
|
|
25162
|
-
this.
|
|
25163
|
-
this.
|
|
25164
|
-
this.
|
|
25149
|
+
constructor(target, mapId) {
|
|
25150
|
+
this.target = target;
|
|
25151
|
+
this.mapId = mapId;
|
|
25152
|
+
this.resolveRejects = {};
|
|
25153
|
+
this.tasks = {};
|
|
25154
|
+
this.taskQueue = [];
|
|
25155
|
+
this.abortControllers = {};
|
|
25156
|
+
this.messageHandlers = {};
|
|
25157
|
+
this.invoker = new ThrottledInvoker(() => this.process());
|
|
25158
|
+
this.subscription = subscribe(this.target, "message", (message) => this.receive(message), false);
|
|
25159
|
+
this.globalScope = isWorker(self) ? target : window;
|
|
25165
25160
|
}
|
|
25166
|
-
|
|
25167
|
-
|
|
25168
|
-
*
|
|
25169
|
-
* @param lngLatLike - The location to project.
|
|
25170
|
-
* @param altitude - The altitude in meters of the position.
|
|
25171
|
-
* @returns The projected mercator coordinate.
|
|
25172
|
-
* @example
|
|
25173
|
-
* ```ts
|
|
25174
|
-
* let coord = MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);
|
|
25175
|
-
* coord; // MercatorCoordinate(0.5, 0.5, 0)
|
|
25176
|
-
* ```
|
|
25177
|
-
*/
|
|
25178
|
-
static fromLngLat(lngLatLike, altitude = 0) {
|
|
25179
|
-
const lngLat = LngLat.convert(lngLatLike);
|
|
25180
|
-
return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
25161
|
+
registerMessageHandler(type, handler) {
|
|
25162
|
+
this.messageHandlers[type] = handler;
|
|
25181
25163
|
}
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
*
|
|
25185
|
-
* @returns The `LngLat` object.
|
|
25186
|
-
* @example
|
|
25187
|
-
* ```ts
|
|
25188
|
-
* let coord = new MercatorCoordinate(0.5, 0.5, 0);
|
|
25189
|
-
* let lngLat = coord.toLngLat(); // LngLat(0, 0)
|
|
25190
|
-
* ```
|
|
25191
|
-
*/
|
|
25192
|
-
toLngLat() {
|
|
25193
|
-
return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
|
|
25164
|
+
unregisterMessageHandler(type) {
|
|
25165
|
+
delete this.messageHandlers[type];
|
|
25194
25166
|
}
|
|
25195
25167
|
/**
|
|
25196
|
-
*
|
|
25197
|
-
*
|
|
25198
|
-
* @
|
|
25199
|
-
* @
|
|
25200
|
-
*
|
|
25201
|
-
* let coord = new MercatorCoordinate(0, 0, 0.02);
|
|
25202
|
-
* coord.toAltitude(); // 6914.281956295339
|
|
25203
|
-
* ```
|
|
25168
|
+
* Sends a message from a main-thread map to a Worker or from a Worker back to
|
|
25169
|
+
* a main-thread map instance.
|
|
25170
|
+
* @param message - the message to send
|
|
25171
|
+
* @param abortController - an optional AbortController to abort the request
|
|
25172
|
+
* @returns a promise that will be resolved with the response data
|
|
25204
25173
|
*/
|
|
25205
|
-
|
|
25206
|
-
return
|
|
25174
|
+
sendAsync(message, abortController) {
|
|
25175
|
+
return new Promise((resolve, reject) => {
|
|
25176
|
+
const id = Math.round(Math.random() * 0xde0b6b3a7640000).toString(36).substring(0, 10);
|
|
25177
|
+
const subscription = abortController ? subscribe(abortController.signal, "abort", () => {
|
|
25178
|
+
subscription?.unsubscribe();
|
|
25179
|
+
delete this.resolveRejects[id];
|
|
25180
|
+
const cancelMessage = {
|
|
25181
|
+
id,
|
|
25182
|
+
type: "<cancel>",
|
|
25183
|
+
origin: location.origin,
|
|
25184
|
+
targetMapId: message.targetMapId,
|
|
25185
|
+
sourceMapId: this.mapId
|
|
25186
|
+
};
|
|
25187
|
+
this.target.postMessage(cancelMessage);
|
|
25188
|
+
reject(new AbortError(abortController.signal.reason));
|
|
25189
|
+
}, addEventDefaultOptions) : null;
|
|
25190
|
+
this.resolveRejects[id] = {
|
|
25191
|
+
resolve: (value) => {
|
|
25192
|
+
subscription?.unsubscribe();
|
|
25193
|
+
resolve(value);
|
|
25194
|
+
},
|
|
25195
|
+
reject: (reason) => {
|
|
25196
|
+
subscription?.unsubscribe();
|
|
25197
|
+
reject(reason);
|
|
25198
|
+
}
|
|
25199
|
+
};
|
|
25200
|
+
const buffers = [];
|
|
25201
|
+
const messageToPost = {
|
|
25202
|
+
...message,
|
|
25203
|
+
id,
|
|
25204
|
+
sourceMapId: this.mapId,
|
|
25205
|
+
origin: location.origin,
|
|
25206
|
+
data: serialize(message.data, buffers)
|
|
25207
|
+
};
|
|
25208
|
+
this.target.postMessage(messageToPost, { transfer: buffers });
|
|
25209
|
+
});
|
|
25207
25210
|
}
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25211
|
+
receive(message) {
|
|
25212
|
+
const data = message.data;
|
|
25213
|
+
const id = data.id;
|
|
25214
|
+
const SPECIAL_ORIGINS = [
|
|
25215
|
+
"file://",
|
|
25216
|
+
"resource://android",
|
|
25217
|
+
"null"
|
|
25218
|
+
];
|
|
25219
|
+
const origins = [data.origin, location.origin];
|
|
25220
|
+
const isSameOrigin = data.origin === location.origin;
|
|
25221
|
+
const hasSpecialOrigin = origins.some((origin) => SPECIAL_ORIGINS.includes(origin));
|
|
25222
|
+
if (!isSameOrigin && !hasSpecialOrigin) return;
|
|
25223
|
+
if (data.targetMapId && this.mapId !== data.targetMapId) return;
|
|
25224
|
+
if (data.type === "<cancel>") {
|
|
25225
|
+
delete this.tasks[id];
|
|
25226
|
+
const abortController = this.abortControllers[id];
|
|
25227
|
+
delete this.abortControllers[id];
|
|
25228
|
+
if (abortController) abortController.abort();
|
|
25229
|
+
return;
|
|
25230
|
+
}
|
|
25231
|
+
if (isWorker(self) || data.mustQueue) {
|
|
25232
|
+
this.tasks[id] = data;
|
|
25233
|
+
this.taskQueue.push(id);
|
|
25234
|
+
this.invoker.trigger();
|
|
25235
|
+
return;
|
|
25236
|
+
}
|
|
25237
|
+
this.processTask(id, data);
|
|
25238
|
+
}
|
|
25239
|
+
process() {
|
|
25240
|
+
if (this.taskQueue.length === 0) return;
|
|
25241
|
+
const id = this.taskQueue.shift();
|
|
25242
|
+
const task = this.tasks[id];
|
|
25243
|
+
delete this.tasks[id];
|
|
25244
|
+
if (this.taskQueue.length > 0) this.invoker.trigger();
|
|
25245
|
+
if (!task) return;
|
|
25246
|
+
this.processTask(id, task);
|
|
25247
|
+
}
|
|
25248
|
+
async processTask(id, task) {
|
|
25249
|
+
if (task.type === "<response>") {
|
|
25250
|
+
const resolveReject = this.resolveRejects[id];
|
|
25251
|
+
delete this.resolveRejects[id];
|
|
25252
|
+
if (!resolveReject) return;
|
|
25253
|
+
if (task.error) resolveReject.reject(ensureError(deserialize(task.error)));
|
|
25254
|
+
else resolveReject.resolve(deserialize(task.data));
|
|
25255
|
+
return;
|
|
25256
|
+
}
|
|
25257
|
+
if (!this.messageHandlers[task.type]) {
|
|
25258
|
+
this.completeTask(id, null, null);
|
|
25259
|
+
return;
|
|
25260
|
+
}
|
|
25261
|
+
const params = deserialize(task.data);
|
|
25262
|
+
const abortController = new AbortController();
|
|
25263
|
+
this.abortControllers[id] = abortController;
|
|
25264
|
+
try {
|
|
25265
|
+
const data = await this.messageHandlers[task.type](task.sourceMapId, params, abortController);
|
|
25266
|
+
this.completeTask(id, null, data);
|
|
25267
|
+
} catch (err) {
|
|
25268
|
+
this.completeTask(id, ensureError(err));
|
|
25269
|
+
}
|
|
25270
|
+
}
|
|
25271
|
+
completeTask(id, err, data) {
|
|
25272
|
+
const buffers = [];
|
|
25273
|
+
delete this.abortControllers[id];
|
|
25274
|
+
const responseMessage = {
|
|
25275
|
+
id,
|
|
25276
|
+
type: "<response>",
|
|
25277
|
+
sourceMapId: this.mapId,
|
|
25278
|
+
origin: location.origin,
|
|
25279
|
+
error: err ? serialize(err) : null,
|
|
25280
|
+
data: serialize(data, buffers)
|
|
25281
|
+
};
|
|
25282
|
+
this.target.postMessage(responseMessage, { transfer: buffers });
|
|
25283
|
+
}
|
|
25284
|
+
remove() {
|
|
25285
|
+
this.invoker.remove();
|
|
25286
|
+
this.subscription.unsubscribe();
|
|
25218
25287
|
}
|
|
25219
25288
|
};
|
|
25220
25289
|
//#endregion
|
|
@@ -27070,9 +27139,7 @@ function unpackBlock256(inValues, inPos, out, outPos, bitWidth) {
|
|
|
27070
27139
|
case 16:
|
|
27071
27140
|
fastUnpack256_16(inValues, inPos, out, outPos);
|
|
27072
27141
|
break;
|
|
27073
|
-
default:
|
|
27074
|
-
fastUnpack256_Generic(inValues, inPos, out, outPos, bitWidth);
|
|
27075
|
-
break;
|
|
27142
|
+
default: fastUnpack256_Generic(inValues, inPos, out, outPos, bitWidth);
|
|
27076
27143
|
}
|
|
27077
27144
|
return inPos + (bitWidth << 3) | 0;
|
|
27078
27145
|
}
|
|
@@ -27190,9 +27257,7 @@ function decodePageBlocks(inValues, pageStart, inPos, packedEnd, out, outPos, bl
|
|
|
27190
27257
|
for (let i = 0; i < 256; i = i + 1 | 0) out[blockOutPos + i | 0] = inValues[tmpInPos + i | 0] | 0;
|
|
27191
27258
|
tmpInPos = tmpInPos + 256 | 0;
|
|
27192
27259
|
break;
|
|
27193
|
-
default:
|
|
27194
|
-
tmpInPos = unpackBlock256(inValues, tmpInPos, out, blockOutPos, bitWidth);
|
|
27195
|
-
break;
|
|
27260
|
+
default: tmpInPos = unpackBlock256(inValues, tmpInPos, out, blockOutPos, bitWidth);
|
|
27196
27261
|
}
|
|
27197
27262
|
if (exceptionCount > 0) bytePosIn = applyBlockExceptions(out, blockOutPos, bitWidth, exceptionCount, byteContainer, byteContainerLen, bytePosIn, workspace, run);
|
|
27198
27263
|
}
|
|
@@ -27327,7 +27392,6 @@ function fastUnpack32(inValues, inPos, out, outPos, bitWidth) {
|
|
|
27327
27392
|
case 32:
|
|
27328
27393
|
for (let i = 0; i < 32; i = i + 1 | 0) out[outPos + i | 0] = inValues[inPos + i | 0] | 0;
|
|
27329
27394
|
return;
|
|
27330
|
-
default: break;
|
|
27331
27395
|
}
|
|
27332
27396
|
const valueMask = MASKS[bitWidth] >>> 0;
|
|
27333
27397
|
let inputWordIndex = inPos;
|
|
@@ -28028,9 +28092,7 @@ function decodeStreamMetadataInternal(tile, offset) {
|
|
|
28028
28092
|
case PhysicalStreamType.OFFSET:
|
|
28029
28093
|
logicalStreamType = { offsetType: OFFSET_TYPE_BY_ID[stream_type & 15] };
|
|
28030
28094
|
break;
|
|
28031
|
-
case PhysicalStreamType.LENGTH:
|
|
28032
|
-
logicalStreamType = { lengthType: LENGTH_TYPE_BY_ID[stream_type & 15] };
|
|
28033
|
-
break;
|
|
28095
|
+
case PhysicalStreamType.LENGTH: logicalStreamType = { lengthType: LENGTH_TYPE_BY_ID[stream_type & 15] };
|
|
28034
28096
|
}
|
|
28035
28097
|
offset.increment();
|
|
28036
28098
|
const encodings_header = tile[offset.get()];
|
|
@@ -28571,7 +28633,8 @@ function convertGeometryVector(geometryVector) {
|
|
|
28571
28633
|
lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
|
|
28572
28634
|
vertexBufferOffset += numVertices * 2;
|
|
28573
28635
|
} else {
|
|
28574
|
-
|
|
28636
|
+
const vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
|
|
28637
|
+
lineStrings[j] = vertices;
|
|
28575
28638
|
vertexOffsetsOffset += numVertices;
|
|
28576
28639
|
}
|
|
28577
28640
|
}
|
|
@@ -28808,30 +28871,28 @@ var GpuVector = class {
|
|
|
28808
28871
|
if (geometryOffsets) geometryOffsetsCounter++;
|
|
28809
28872
|
}
|
|
28810
28873
|
break;
|
|
28811
|
-
case GEOMETRY_TYPE.MULTIPOLYGON:
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
ring.push(new Point(x, y));
|
|
28827
|
-
}
|
|
28828
|
-
if (ring.length > 0) ring.push(ring[0]);
|
|
28829
|
-
allRings.push(ring);
|
|
28874
|
+
case GEOMETRY_TYPE.MULTIPOLYGON: {
|
|
28875
|
+
const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
|
|
28876
|
+
geometryOffsetsCounter++;
|
|
28877
|
+
const allRings = [];
|
|
28878
|
+
for (let p = 0; p < numPolygons; p++) {
|
|
28879
|
+
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
|
|
28880
|
+
partOffsetCounter++;
|
|
28881
|
+
for (let j = 0; j < numRings; j++) {
|
|
28882
|
+
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
|
|
28883
|
+
ringOffsetsCounter++;
|
|
28884
|
+
const ring = [];
|
|
28885
|
+
for (let k = 0; k < numVertices; k++) {
|
|
28886
|
+
const x = this._vertexBuffer[vertexBufferOffset++];
|
|
28887
|
+
const y = this._vertexBuffer[vertexBufferOffset++];
|
|
28888
|
+
ring.push(new Point(x, y));
|
|
28830
28889
|
}
|
|
28890
|
+
if (ring.length > 0) ring.push(ring[0]);
|
|
28891
|
+
allRings.push(ring);
|
|
28831
28892
|
}
|
|
28832
|
-
geometries[i] = allRings;
|
|
28833
28893
|
}
|
|
28834
|
-
|
|
28894
|
+
geometries[i] = allRings;
|
|
28895
|
+
}
|
|
28835
28896
|
}
|
|
28836
28897
|
return geometries;
|
|
28837
28898
|
}
|
|
@@ -28917,22 +28978,18 @@ function decodeGeometryColumn(tile, numStreams, offset, numFeatures, scalingData
|
|
|
28917
28978
|
case OffsetType.VERTEX:
|
|
28918
28979
|
vertexOffsets = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28919
28980
|
break;
|
|
28920
|
-
case OffsetType.INDEX:
|
|
28921
|
-
indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28922
|
-
break;
|
|
28923
|
-
}
|
|
28924
|
-
break;
|
|
28925
|
-
case PhysicalStreamType.DATA:
|
|
28926
|
-
if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28927
|
-
else {
|
|
28928
|
-
const mortonMetadata = geometryStreamMetadata;
|
|
28929
|
-
mortonSettings = {
|
|
28930
|
-
numBits: mortonMetadata.numBits,
|
|
28931
|
-
coordinateShift: mortonMetadata.coordinateShift
|
|
28932
|
-
};
|
|
28933
|
-
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28981
|
+
case OffsetType.INDEX: indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28934
28982
|
}
|
|
28935
28983
|
break;
|
|
28984
|
+
case PhysicalStreamType.DATA: if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28985
|
+
else {
|
|
28986
|
+
const mortonMetadata = geometryStreamMetadata;
|
|
28987
|
+
mortonSettings = {
|
|
28988
|
+
numBits: mortonMetadata.numBits,
|
|
28989
|
+
coordinateShift: mortonMetadata.coordinateShift
|
|
28990
|
+
};
|
|
28991
|
+
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28992
|
+
}
|
|
28936
28993
|
}
|
|
28937
28994
|
}
|
|
28938
28995
|
if (indexBuffer) {
|
|
@@ -28980,22 +29037,18 @@ function decodeGeometryColumn(tile, numStreams, offset, numFeatures, scalingData
|
|
|
28980
29037
|
case OffsetType.VERTEX:
|
|
28981
29038
|
vertexOffsets = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28982
29039
|
break;
|
|
28983
|
-
case OffsetType.INDEX:
|
|
28984
|
-
indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28985
|
-
break;
|
|
28986
|
-
}
|
|
28987
|
-
break;
|
|
28988
|
-
case PhysicalStreamType.DATA:
|
|
28989
|
-
if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28990
|
-
else {
|
|
28991
|
-
const mortonMetadata = geometryStreamMetadata;
|
|
28992
|
-
mortonSettings = {
|
|
28993
|
-
numBits: mortonMetadata.numBits,
|
|
28994
|
-
coordinateShift: mortonMetadata.coordinateShift
|
|
28995
|
-
};
|
|
28996
|
-
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
29040
|
+
case OffsetType.INDEX: indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28997
29041
|
}
|
|
28998
29042
|
break;
|
|
29043
|
+
case PhysicalStreamType.DATA: if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
29044
|
+
else {
|
|
29045
|
+
const mortonMetadata = geometryStreamMetadata;
|
|
29046
|
+
mortonSettings = {
|
|
29047
|
+
numBits: mortonMetadata.numBits,
|
|
29048
|
+
coordinateShift: mortonMetadata.coordinateShift
|
|
29049
|
+
};
|
|
29050
|
+
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
29051
|
+
}
|
|
28999
29052
|
}
|
|
29000
29053
|
}
|
|
29001
29054
|
let geometryOffsets;
|
|
@@ -29387,7 +29440,6 @@ function decodeSharedDictionary(data, offset, column, propertyColumnNames) {
|
|
|
29387
29440
|
dictionaryStreamDecoded = true;
|
|
29388
29441
|
} else symbolTableBuffer = data.subarray(offset.get(), offset.get() + streamMetadata.byteLength);
|
|
29389
29442
|
offset.add(streamMetadata.byteLength);
|
|
29390
|
-
break;
|
|
29391
29443
|
}
|
|
29392
29444
|
}
|
|
29393
29445
|
const childFields = column.complexType.children;
|
|
@@ -30526,8 +30578,8 @@ function getIconQuads(shapedIcon, iconRotate, isSDFIcon, hasIconTextFit) {
|
|
|
30526
30578
|
const quads = [];
|
|
30527
30579
|
const image = shapedIcon.image;
|
|
30528
30580
|
const pixelRatio = image.pixelRatio;
|
|
30529
|
-
const imageWidth = image.paddedRect.w - 2
|
|
30530
|
-
const imageHeight = image.paddedRect.h - 2
|
|
30581
|
+
const imageWidth = image.paddedRect.w - 2;
|
|
30582
|
+
const imageHeight = image.paddedRect.h - 2;
|
|
30531
30583
|
let icon = {
|
|
30532
30584
|
x1: shapedIcon.left,
|
|
30533
30585
|
y1: shapedIcon.top,
|
|
@@ -30995,9 +31047,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30995
31047
|
case "bottom":
|
|
30996
31048
|
y = -radialOffset + baselineOffset;
|
|
30997
31049
|
break;
|
|
30998
|
-
case "top":
|
|
30999
|
-
y = radialOffset - baselineOffset;
|
|
31000
|
-
break;
|
|
31050
|
+
case "top": y = radialOffset - baselineOffset;
|
|
31001
31051
|
}
|
|
31002
31052
|
switch (anchor) {
|
|
31003
31053
|
case "top-right":
|
|
@@ -31011,9 +31061,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
31011
31061
|
case "left":
|
|
31012
31062
|
x = radialOffset;
|
|
31013
31063
|
break;
|
|
31014
|
-
case "right":
|
|
31015
|
-
x = -radialOffset;
|
|
31016
|
-
break;
|
|
31064
|
+
case "right": x = -radialOffset;
|
|
31017
31065
|
}
|
|
31018
31066
|
return [x, y];
|
|
31019
31067
|
}
|
|
@@ -31029,9 +31077,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
31029
31077
|
break;
|
|
31030
31078
|
case "bottom-right":
|
|
31031
31079
|
case "bottom-left":
|
|
31032
|
-
case "bottom":
|
|
31033
|
-
y = -offsetY + baselineOffset;
|
|
31034
|
-
break;
|
|
31080
|
+
case "bottom": y = -offsetY + baselineOffset;
|
|
31035
31081
|
}
|
|
31036
31082
|
switch (anchor) {
|
|
31037
31083
|
case "top-right":
|
|
@@ -31041,9 +31087,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
31041
31087
|
break;
|
|
31042
31088
|
case "top-left":
|
|
31043
31089
|
case "bottom-left":
|
|
31044
|
-
case "left":
|
|
31045
|
-
x = offsetX;
|
|
31046
|
-
break;
|
|
31090
|
+
case "left": x = offsetX;
|
|
31047
31091
|
}
|
|
31048
31092
|
return [x, y];
|
|
31049
31093
|
}
|
|
@@ -31359,6 +31403,6 @@ function anchorIsTooClose(bucket, text, repeatDistance, anchor) {
|
|
|
31359
31403
|
return false;
|
|
31360
31404
|
}
|
|
31361
31405
|
//#endregion
|
|
31362
|
-
export {
|
|
31406
|
+
export { tileCoordinatesToMercatorCoordinates as $, degreesToRadians as $n, clone$5 as $r, EvaluationParameters as $t, getOverlapMode as A, scale$5 as Ai, sameOrigin as An, rollPitchBearingToQuat as Ar, Uniform1i as At, PbfReader as B, angleToRotateBetweenVectors2D as Bn, pixelsToTileUnits as Br, CollisionCircleLayoutArray as Bt, createStyleLayer as C, invert$2 as Ci, AJAXError as Cn, pick as Cr, renderColorRamp as Ct, isSymbolStyleLayer as D, rotateX$3 as Di, getReferrer as Dn, readImageUsingVideoFrame as Dr, polygonIntersectsPolygon as Dt, isBackgroundStyleLayer as E, perspective as Ei, getJSON as En, rayPlaneIntersection as Er, isCircleStyleLayer as Et, ImageAtlas as F, invert$5 as Fi, AbortError as Fn, translatePosition as Fr, UniformColorArray as Ft, isFillExtrusionStyleLayer as G, clone as Gn, sqrLen as Gr, RasterBoundsArray as Gt, isLineStyleLayer as H, arrayBufferToImageBitmap as Hn, create as Hr, Pos3dArray as Ht, ImagePosition as I, rotate$4 as Ii, isAbortError as In, uniqueId as Ir, UniformFloatArray as It, cameraDirectionFromPitchBearing as J, createMat4f64 as Jn, slerp as Jr, isRasterStyleLayer as Jt, FillExtrusionBucket as K, createIdentityMat4f32 as Kn, zero as Kr, TriangleIndexArray as Kt, potpack as L, isOffscreenCanvasDistorted as Li, throwIfAborted as Ln, warnOnce as Lr, UniformMatrix4f as Lt, evaluateSizeForZoom as M, create$6 as Mi, getProtocol as Mn, sphericalToCartesian as Mr, Uniform3f as Mt, WritingMode as N, fromRotation$2 as Ni, removeProtocol as Nn, subscribe as Nr, Uniform4f as Nt, SymbolBucket as O, rotateY$3 as Oi, getVideo as On, remapSaturate as Or, toEvaluationFeature as Ot, getAnchorAlignment as P, create$8 as Pi, config as Pn, threePlaneIntersection as Pr, UniformColor as Pt, projectToWorldCoordinates as Q, defaultEasing as Qn, add$4 as Qr, Transitionable as Qt, renderStyleImage as R, offscreenCanvasSupported as Ri, JSON_PREFIX as Rn, wrap$1 as Rr, SegmentVector as Rt, Actor as S, identity$2 as Si, Evented as Sn, parseCacheControl as Sr, isHeatmapStyleLayer as St, validateCustomStyleLayer as T, ortho as Ti, getArrayBuffer as Tn, radiansToDegrees as Tr, RGBAImage as Tt, LineBucket as U, bezier as Un, length as Ur, PosArray as Ut, collisionCircleLayout as V, arrayBufferToImage as Vn, EXTENT$1 as Vr, LineStripIndexArray as Vt, GeoJSONVT as W, clamp$2 as Wn, scale as Wr, QuadTriangleArray as Wt, getMercatorHorizon as X, createVec4f64 as Xn, scale$3 as Xr, Properties as Xt, cameraMercatorCoordinateFromCenterAndRotation as Y, createVec3f64 as Yn, mul$3 as Yr, DataConstantProperty as Yt, maxMercatorHorizonAngle as Z, deepEqual$1 as Zn, transformMat4$1 as Zr, TRANSITION_SUFFIX as Zt, OverscaledTileID as _, copy$5 as _i, groupByLayout as _n, isWorker as _r, isColorReliefStyleLayer as _t, clipLine as a, normalize$4 as ai, emitValidationErrors as an, filterObject as ar, mercatorXfromLng as at, compareTileId as b, exactEquals$5 as bi, ErrorEvent as bn, mod as br, isHillshadeStyleLayer as bt, FeatureIndex as c, rotateZ$2 as ci, validateStyleAndEmit as cn, getAngleDelta as cr, LngLat as ct, DictionaryCoder as d, sub$2 as di, ValidationError as dn, getRollPitchBearing as dr, isFillStyleLayer as dt, cross$2 as ei, rtlWorkerPlugin as en, differenceOfAnglesDegrees as er, unprojectFromWorldCoordinates as et, GEOJSON_TILE_LAYER_NAME as f, transformMat3$1 as fi, createExpression as fn, isImageBitmap as fr, FillBucket as ft, CanonicalTileID as g, clone$6 as gi, featureFilter as gn, isTouchableOrPointableType as gr, SubdivisionGranularitySetting as gt, Bounds as h, zero$2 as hi, emptyStyle as hn, isTouchableEvent as hr, SubdivisionGranularityExpression as ht, clipGeometry as i, negate$2 as ii, SPEC_SOURCE_TYPES as in, extend as ir, lngFromMercatorX as it, evaluateSizeForFeature as j, translate$2 as ji, addProtocol as jn, scaleZoom as jr, Uniform2f as jt, addDynamicAttributes as k, rotateZ$3 as ki, makeRequest as kn, rollPitchBearingEqual as kr, Uniform1f as kt, MLTVectorTile as l, scale$4 as li, Color as ln, getEdgeTiles as lr, earthRadius as lt, fromVectorTileJs as m, transformQuat$1 as mi, diff as mn, isSafari as mr, SOUTH_POLE_Y as mt, performSymbolLayout as n, len$4 as ni, ZoomHistory as nn, ensureError as nr, altitudeFromMercatorZ as nt, BoundedLRUCache as o, rotateX$2 as oi, validateAndEmit as on, findLineIntersection as or, mercatorYfromLat as ot, GeoJSONWrapper as p, transformMat4$2 as pi, derefLayers as pn, isPointableEvent as pr, NORTH_POLE_Y as pt, calculateTileMatrix as q, createIdentityMat4f64 as qn, fromEuler as qr, createLayout as qt, TextAnchorEnum as r, length$4 as ri, register as rn, evaluateZoomSnap as rr, latFromMercatorY as rt, TileCache as s, rotateY$2 as si, validateStyle as sn, getAABB as sr, mercatorZfromAltitude as st, getAnchorJustification as t, dot$5 as ti, codePointUsesLocalIdeographFontFamily as tn, distanceOfAnglesRadians as tr, MercatorCoordinate as tt, GeoJSONFeature as u, scaleAndAdd$2 as ui, ProjectionDefinition as un, getImageData as ur, VectorTile as ut, UnwrappedTileID as v, create$5 as vi, interpolateFactory as vn, lerp as vr, DEMData as vt, isCustomStyleLayer as w, multiply$5 as wi, GLOBAL_DISPATCHER_ID as wn, pointPlaneSignedDistance as wr, AlphaImage as wt, isInBoundsForZoomLngLat as x, fromScaling as xi, Event as xn, nextPowerOfTwo as xr, HEATMAP_FULL_RENDER_FBO_KEY as xt, calculateTileKey as y, equals$6 as yi, latest as yn, mapObject as yr, Texture as yt, parseGlyphPbf as z, Point as zi, MAX_VALID_LATITUDE as zn, zoomScale as zr, CollisionBoxArray as zt };
|
|
31363
31407
|
|
|
31364
31408
|
//# sourceMappingURL=maplibre-gl-shared-dev.mjs.map
|