maplibre-gl 6.0.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 +433 -573
- package/dist/maplibre-gl-dev.mjs.map +1 -1
- package/dist/maplibre-gl-shared-dev.mjs +984 -850
- 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 +119 -42
- package/dist/maplibre-gl.mjs +22 -22
- package/dist/maplibre-gl.mjs.map +1 -1
- package/package.json +20 -22
- package/src/css/maplibre-gl.css +4 -0
- package/src/data/bucket/circle_bucket.ts +3 -2
- package/src/data/bucket/fill_bucket.ts +3 -2
- package/src/data/bucket/fill_extrusion_bucket.test.ts +22 -0
- package/src/data/bucket/fill_extrusion_bucket.ts +17 -4
- package/src/data/bucket/line_bucket.test.ts +5 -5
- package/src/data/bucket/line_bucket.ts +3 -2
- 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 +7 -7
- 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/covering_tiles.bench.ts +39 -0
- package/src/geo/projection/covering_tiles.test.ts +3 -7
- package/src/geo/projection/covering_tiles.ts +37 -2
- package/src/geo/projection/globe_covering_tiles_details_provider.ts +4 -4
- package/src/geo/projection/globe_projection.test.ts +2 -2
- package/src/geo/projection/globe_projection.ts +6 -15
- package/src/geo/projection/globe_transform.test.ts +3 -6
- package/src/geo/projection/globe_transform.ts +4 -7
- package/src/geo/projection/mercator_covering_tiles_details_provider.ts +4 -4
- package/src/geo/projection/mercator_projection.ts +1 -13
- package/src/geo/projection/mercator_transform.test.ts +1 -1
- package/src/geo/projection/mercator_transform.ts +2 -1
- package/src/geo/projection/mercator_utils.test.ts +8 -8
- package/src/geo/projection/projection.ts +0 -27
- package/src/geo/projection/projection_data.ts +8 -0
- package/src/geo/projection/projection_factory.ts +3 -3
- package/src/geo/projection/vertical_perspective_projection.ts +3 -60
- package/src/geo/projection/vertical_perspective_transform.ts +16 -23
- package/src/geo/transform_interface.ts +1 -2
- package/src/index.test.ts +7 -12
- package/src/index.ts +4 -2
- package/src/render/glyph_manager.test.ts +7 -22
- package/src/render/painter.test.ts +2 -0
- package/src/render/painter.ts +8 -11
- package/src/render/subdivision.bench.ts +39 -0
- package/src/render/subdivision.test.ts +22 -23
- package/src/render/subdivision.ts +46 -0
- package/src/render/terrain.test.ts +68 -34
- package/src/render/terrain.ts +69 -26
- package/src/shaders/glsl/_projection_globe.fragment.glsl +12 -0
- package/src/shaders/glsl/_projection_globe.fragment.glsl.g.ts +2 -0
- package/src/shaders/glsl/_projection_globe.vertex.glsl +29 -10
- package/src/shaders/glsl/_projection_globe.vertex.glsl.g.ts +1 -1
- package/src/shaders/glsl/_projection_mercator.fragment.glsl +4 -0
- package/src/shaders/glsl/_projection_mercator.fragment.glsl.g.ts +2 -0
- package/src/shaders/glsl/line.fragment.glsl +2 -0
- package/src/shaders/glsl/line.fragment.glsl.g.ts +1 -1
- package/src/shaders/glsl/line_gradient.fragment.glsl +2 -0
- package/src/shaders/glsl/line_gradient.fragment.glsl.g.ts +1 -1
- package/src/shaders/glsl/line_gradient_sdf.fragment.glsl +2 -0
- package/src/shaders/glsl/line_gradient_sdf.fragment.glsl.g.ts +1 -1
- package/src/shaders/glsl/line_pattern.fragment.glsl +2 -0
- package/src/shaders/glsl/line_pattern.fragment.glsl.g.ts +1 -1
- package/src/shaders/glsl/line_sdf.fragment.glsl +2 -0
- package/src/shaders/glsl/line_sdf.fragment.glsl.g.ts +1 -1
- package/src/shaders/shaders.ts +4 -6
- package/src/source/canvas_source.test.ts +1 -1
- package/src/source/geojson_source.test.ts +32 -4
- package/src/source/geojson_source.ts +41 -0
- 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 +137 -62
- package/src/source/image_source.ts +49 -12
- package/src/source/raster_dem_tile_source.test.ts +2 -2
- package/src/source/raster_tile_source.test.ts +64 -9
- package/src/source/raster_tile_source.ts +2 -1
- 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/video_source.test.ts +1 -1
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker_tile.test.ts +10 -8
- package/src/style/light.test.ts +9 -9
- package/src/style/light.ts +3 -3
- package/src/style/load_glyph_range.test.ts +8 -8
- package/src/style/load_sprite.test.ts +1 -1
- package/src/style/properties.test.ts +94 -2
- package/src/style/properties.ts +30 -1
- package/src/style/sky.test.ts +9 -9
- package/src/style/sky.ts +2 -2
- package/src/style/style.test.ts +38 -36
- package/src/style/style.ts +3 -3
- 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/fill_extrusion_style_layer_properties.g.ts +14 -1
- package/src/style/style_layer/raster_style_layer.test.ts +2 -2
- package/src/style/style_layer.test.ts +5 -51
- package/src/style/validate_style.test.ts +1 -1
- 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 +113 -72
- package/src/tile/tile_manager.ts +2 -2
- package/src/tile/tile_manager_in_view_tiles.test.ts +2 -2
- package/src/ui/camera.test.ts +138 -135
- package/src/ui/control/geolocate_control.test.ts +7 -30
- package/src/ui/handler/dblclick_zoom.test.ts +2 -2
- package/src/ui/handler/mouse.ts +15 -7
- package/src/ui/handler/mouse_handler_interface.test.ts +21 -1
- 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 +45 -20
- 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 -7
- package/src/ui/map_tests/map_global_state.test.ts +3 -3
- package/src/ui/map_tests/map_images.test.ts +4 -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 +41 -1
- package/src/ui/map_tests/map_zoom.test.ts +15 -15
- package/src/ui/marker.test.ts +71 -14
- package/src/ui/marker.ts +30 -6
- 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/primitives/bounding_volume_cache.ts +3 -1
- 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 +13 -12
- package/src/webgl/draw/draw_symbol.test.ts +17 -16
- package/src/webgl/program/program_uniforms.ts +0 -3
- package/src/webgl/program/projection_program.ts +12 -10
- package/src/webgl/program/terrain_program.test.ts +2 -2
- package/src/webgl/program.ts +6 -4
- 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
- package/src/geo/projection/globe_projection_error_measurement.ts +0 -229
- package/src/shaders/glsl/projection_error_measurement.fragment.glsl +0 -5
- package/src/shaders/glsl/projection_error_measurement.fragment.glsl.g.ts +0 -2
- package/src/shaders/glsl/projection_error_measurement.vertex.glsl +0 -22
- package/src/shaders/glsl/projection_error_measurement.vertex.glsl.g.ts +0 -2
- package/src/webgl/program/projection_error_measurement_program.ts +0 -23
|
@@ -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
|
*/
|
|
@@ -3573,19 +3652,28 @@ const latest = {
|
|
|
3573
3652
|
},
|
|
3574
3653
|
"property-type": "data-constant"
|
|
3575
3654
|
} },
|
|
3576
|
-
"layout_fill-extrusion": {
|
|
3577
|
-
"
|
|
3578
|
-
|
|
3579
|
-
"
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
"
|
|
3585
|
-
|
|
3655
|
+
"layout_fill-extrusion": {
|
|
3656
|
+
"visibility": {
|
|
3657
|
+
"type": "enum",
|
|
3658
|
+
"values": {
|
|
3659
|
+
"visible": {},
|
|
3660
|
+
"none": {}
|
|
3661
|
+
},
|
|
3662
|
+
"default": "visible",
|
|
3663
|
+
"expression": {
|
|
3664
|
+
"interpolated": false,
|
|
3665
|
+
"parameters": ["global-state"]
|
|
3666
|
+
},
|
|
3667
|
+
"property-type": "data-constant"
|
|
3586
3668
|
},
|
|
3587
|
-
"
|
|
3588
|
-
|
|
3669
|
+
"fill-extrusion-rounded-corner-distance": {
|
|
3670
|
+
"type": "number",
|
|
3671
|
+
"default": 0,
|
|
3672
|
+
"minimum": 0,
|
|
3673
|
+
"units": "meters",
|
|
3674
|
+
"property-type": "constant"
|
|
3675
|
+
}
|
|
3676
|
+
},
|
|
3589
3677
|
layout_line: {
|
|
3590
3678
|
"line-cap": {
|
|
3591
3679
|
"type": "enum",
|
|
@@ -7501,14 +7589,12 @@ var Padding = class Padding {
|
|
|
7501
7589
|
input[1]
|
|
7502
7590
|
];
|
|
7503
7591
|
break;
|
|
7504
|
-
case 3:
|
|
7505
|
-
input
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
];
|
|
7511
|
-
break;
|
|
7592
|
+
case 3: input = [
|
|
7593
|
+
input[0],
|
|
7594
|
+
input[1],
|
|
7595
|
+
input[2],
|
|
7596
|
+
input[1]
|
|
7597
|
+
];
|
|
7512
7598
|
}
|
|
7513
7599
|
return new Padding(input);
|
|
7514
7600
|
}
|
|
@@ -7937,7 +8023,11 @@ var Coercion = class Coercion {
|
|
|
7937
8023
|
}
|
|
7938
8024
|
case "formatted": return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));
|
|
7939
8025
|
case "resolvedImage": return ResolvedImage.fromString(valueToString(this.args[0].evaluate(ctx)));
|
|
7940
|
-
case "projectionDefinition":
|
|
8026
|
+
case "projectionDefinition": {
|
|
8027
|
+
const input = this.args[0].evaluate(ctx);
|
|
8028
|
+
if (ProjectionDefinition.parse(input)) return input;
|
|
8029
|
+
throw new RuntimeError(`Could not parse projectionDefinition from value '${typeof input === "string" ? input : JSON.stringify(input)}'`, this.key);
|
|
8030
|
+
}
|
|
7941
8031
|
default: return valueToString(this.args[0].evaluate(ctx));
|
|
7942
8032
|
}
|
|
7943
8033
|
}
|
|
@@ -8036,7 +8126,11 @@ var ParsingContext = class ParsingContext {
|
|
|
8036
8126
|
const expected = this.expectedType;
|
|
8037
8127
|
const actual = parsed.type;
|
|
8038
8128
|
if ((expected.kind === "string" || expected.kind === "number" || expected.kind === "boolean" || expected.kind === "object" || expected.kind === "array") && actual.kind === "value") parsed = annotate(parsed, expected, options.typeAnnotation || "assert");
|
|
8039
|
-
else if ("projectionDefinition" === expected.kind && [
|
|
8129
|
+
else if ("projectionDefinition" === expected.kind && [
|
|
8130
|
+
"string",
|
|
8131
|
+
"array",
|
|
8132
|
+
"value"
|
|
8133
|
+
].includes(actual.kind) || [
|
|
8040
8134
|
"color",
|
|
8041
8135
|
"formatted",
|
|
8042
8136
|
"resolvedImage"
|
|
@@ -9496,8 +9590,7 @@ function calculateSignedArea(ring) {
|
|
|
9496
9590
|
return sum;
|
|
9497
9591
|
}
|
|
9498
9592
|
const RE = 6378.137;
|
|
9499
|
-
const
|
|
9500
|
-
const E2 = FE * (2 - FE);
|
|
9593
|
+
const E2 = .0066943799901413165;
|
|
9501
9594
|
const RAD = Math.PI / 180;
|
|
9502
9595
|
var CheapRuler = class {
|
|
9503
9596
|
constructor(lat) {
|
|
@@ -9506,7 +9599,7 @@ var CheapRuler = class {
|
|
|
9506
9599
|
const w2 = 1 / (1 - E2 * (1 - coslat * coslat));
|
|
9507
9600
|
const w = Math.sqrt(w2);
|
|
9508
9601
|
this.kx = m * w * coslat;
|
|
9509
|
-
this.ky = m * w * w2 *
|
|
9602
|
+
this.ky = m * w * w2 * .9933056200098587;
|
|
9510
9603
|
}
|
|
9511
9604
|
/**
|
|
9512
9605
|
* Given two points of the form [longitude, latitude], returns the distance.
|
|
@@ -9843,9 +9936,7 @@ function pointToGeometryDistance(ctx, geometries) {
|
|
|
9843
9936
|
case "LineString":
|
|
9844
9937
|
dist = Math.min(dist, pointSetToPointSetDistance(pointPosition, false, geometry.coordinates, true, ruler, dist));
|
|
9845
9938
|
break;
|
|
9846
|
-
case "Polygon":
|
|
9847
|
-
dist = Math.min(dist, pointsToPolygonDistance(pointPosition, false, geometry.coordinates, ruler, dist));
|
|
9848
|
-
break;
|
|
9939
|
+
case "Polygon": dist = Math.min(dist, pointsToPolygonDistance(pointPosition, false, geometry.coordinates, ruler, dist));
|
|
9849
9940
|
}
|
|
9850
9941
|
if (dist === 0) return dist;
|
|
9851
9942
|
}
|
|
@@ -9865,9 +9956,7 @@ function lineStringToGeometryDistance(ctx, geometries) {
|
|
|
9865
9956
|
case "LineString":
|
|
9866
9957
|
dist = Math.min(dist, pointSetToPointSetDistance(linePositions, true, geometry.coordinates, true, ruler, dist));
|
|
9867
9958
|
break;
|
|
9868
|
-
case "Polygon":
|
|
9869
|
-
dist = Math.min(dist, pointsToPolygonDistance(linePositions, true, geometry.coordinates, ruler, dist));
|
|
9870
|
-
break;
|
|
9959
|
+
case "Polygon": dist = Math.min(dist, pointsToPolygonDistance(linePositions, true, geometry.coordinates, ruler, dist));
|
|
9871
9960
|
}
|
|
9872
9961
|
if (dist === 0) return dist;
|
|
9873
9962
|
}
|
|
@@ -9891,9 +9980,7 @@ function polygonToGeometryDistance(ctx, geometries) {
|
|
|
9891
9980
|
case "LineString":
|
|
9892
9981
|
dist = Math.min(dist, pointsToPolygonDistance(geometry.coordinates, true, polygon, ruler, dist));
|
|
9893
9982
|
break;
|
|
9894
|
-
case "Polygon":
|
|
9895
|
-
dist = Math.min(dist, polygonToPolygonDistance(polygon, geometry.coordinates, ruler, dist));
|
|
9896
|
-
break;
|
|
9983
|
+
case "Polygon": dist = Math.min(dist, polygonToPolygonDistance(polygon, geometry.coordinates, ruler, dist));
|
|
9897
9984
|
}
|
|
9898
9985
|
if (dist === 0) return dist;
|
|
9899
9986
|
}
|
|
@@ -11210,12 +11297,10 @@ function findMixedLegacyFilter(filter, path = []) {
|
|
|
11210
11297
|
if (diagnostic) return diagnostic;
|
|
11211
11298
|
break;
|
|
11212
11299
|
}
|
|
11213
|
-
case "case":
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
}
|
|
11218
|
-
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
|
+
}
|
|
11219
11304
|
}
|
|
11220
11305
|
return null;
|
|
11221
11306
|
}
|
|
@@ -11319,148 +11404,6 @@ function convertHasOp$1(property) {
|
|
|
11319
11404
|
function convertNegation(filter) {
|
|
11320
11405
|
return ["!", filter];
|
|
11321
11406
|
}
|
|
11322
|
-
function convertFilter(filter, expectedTypes = {}) {
|
|
11323
|
-
if (isExpressionFilter(filter)) return filter;
|
|
11324
|
-
if (!filter) return true;
|
|
11325
|
-
const legacyFilter = filter;
|
|
11326
|
-
const legacyOp = legacyFilter[0];
|
|
11327
|
-
if (filter.length <= 1) return legacyOp !== "any";
|
|
11328
|
-
switch (legacyOp) {
|
|
11329
|
-
case "==":
|
|
11330
|
-
case "!=":
|
|
11331
|
-
case "<":
|
|
11332
|
-
case ">":
|
|
11333
|
-
case "<=":
|
|
11334
|
-
case ">=": {
|
|
11335
|
-
const [, property, value] = filter;
|
|
11336
|
-
return convertComparisonOp(property, value, legacyOp, expectedTypes);
|
|
11337
|
-
}
|
|
11338
|
-
case "any": {
|
|
11339
|
-
const [, ...conditions] = legacyFilter;
|
|
11340
|
-
return ["any", ...conditions.map((f) => {
|
|
11341
|
-
const types = {};
|
|
11342
|
-
const child = convertFilter(f, types);
|
|
11343
|
-
const typechecks = runtimeTypeChecks(types);
|
|
11344
|
-
return typechecks === true ? child : [
|
|
11345
|
-
"case",
|
|
11346
|
-
typechecks,
|
|
11347
|
-
child,
|
|
11348
|
-
false
|
|
11349
|
-
];
|
|
11350
|
-
})];
|
|
11351
|
-
}
|
|
11352
|
-
case "all": {
|
|
11353
|
-
const [, ...conditions] = legacyFilter;
|
|
11354
|
-
const children = conditions.map((f) => convertFilter(f, expectedTypes));
|
|
11355
|
-
return children.length > 1 ? ["all", ...children] : children[0];
|
|
11356
|
-
}
|
|
11357
|
-
case "none": {
|
|
11358
|
-
const [, ...conditions] = legacyFilter;
|
|
11359
|
-
return ["!", convertFilter(["any", ...conditions], {})];
|
|
11360
|
-
}
|
|
11361
|
-
case "in": {
|
|
11362
|
-
const [, property, ...values] = legacyFilter;
|
|
11363
|
-
return convertInOp(property, values);
|
|
11364
|
-
}
|
|
11365
|
-
case "!in": {
|
|
11366
|
-
const [, property, ...values] = legacyFilter;
|
|
11367
|
-
return convertInOp(property, values, true);
|
|
11368
|
-
}
|
|
11369
|
-
case "has": return convertHasOp(legacyFilter[1]);
|
|
11370
|
-
case "!has": return ["!", convertHasOp(legacyFilter[1])];
|
|
11371
|
-
default: return true;
|
|
11372
|
-
}
|
|
11373
|
-
}
|
|
11374
|
-
function runtimeTypeChecks(expectedTypes) {
|
|
11375
|
-
const conditions = [];
|
|
11376
|
-
for (const property in expectedTypes) {
|
|
11377
|
-
const get = property === "$id" ? ["id"] : ["get", property];
|
|
11378
|
-
conditions.push([
|
|
11379
|
-
"==",
|
|
11380
|
-
["typeof", get],
|
|
11381
|
-
expectedTypes[property]
|
|
11382
|
-
]);
|
|
11383
|
-
}
|
|
11384
|
-
if (conditions.length === 0) return true;
|
|
11385
|
-
if (conditions.length === 1) return conditions[0];
|
|
11386
|
-
return ["all", ...conditions];
|
|
11387
|
-
}
|
|
11388
|
-
function convertComparisonOp(property, value, op, expectedTypes) {
|
|
11389
|
-
let get;
|
|
11390
|
-
if (property === "$type") return [
|
|
11391
|
-
op,
|
|
11392
|
-
["geometry-type"],
|
|
11393
|
-
value
|
|
11394
|
-
];
|
|
11395
|
-
else if (property === "$id") get = ["id"];
|
|
11396
|
-
else get = ["get", property];
|
|
11397
|
-
if (expectedTypes && value !== null) expectedTypes[property] = typeof value;
|
|
11398
|
-
if (op === "==" && property !== "$id" && value === null) return [
|
|
11399
|
-
"all",
|
|
11400
|
-
["has", property],
|
|
11401
|
-
[
|
|
11402
|
-
"==",
|
|
11403
|
-
get,
|
|
11404
|
-
null
|
|
11405
|
-
]
|
|
11406
|
-
];
|
|
11407
|
-
else if (op === "!=" && property !== "$id" && value === null) return [
|
|
11408
|
-
"any",
|
|
11409
|
-
["!", ["has", property]],
|
|
11410
|
-
[
|
|
11411
|
-
"!=",
|
|
11412
|
-
get,
|
|
11413
|
-
null
|
|
11414
|
-
]
|
|
11415
|
-
];
|
|
11416
|
-
return [
|
|
11417
|
-
op,
|
|
11418
|
-
get,
|
|
11419
|
-
value
|
|
11420
|
-
];
|
|
11421
|
-
}
|
|
11422
|
-
function convertInOp(property, values, negate = false) {
|
|
11423
|
-
if (values.length === 0) return negate;
|
|
11424
|
-
let get;
|
|
11425
|
-
if (property === "$type") get = ["geometry-type"];
|
|
11426
|
-
else if (property === "$id") get = ["id"];
|
|
11427
|
-
else get = ["get", property];
|
|
11428
|
-
let uniformTypes = true;
|
|
11429
|
-
const type = typeof values[0];
|
|
11430
|
-
for (const value of values) if (typeof value !== type) {
|
|
11431
|
-
uniformTypes = false;
|
|
11432
|
-
break;
|
|
11433
|
-
}
|
|
11434
|
-
if (uniformTypes && (type === "string" || type === "number")) {
|
|
11435
|
-
const uniqueValues = values.sort().filter((v, i) => i === 0 || values[i - 1] !== v);
|
|
11436
|
-
return [
|
|
11437
|
-
"match",
|
|
11438
|
-
get,
|
|
11439
|
-
uniqueValues,
|
|
11440
|
-
!negate,
|
|
11441
|
-
negate
|
|
11442
|
-
];
|
|
11443
|
-
}
|
|
11444
|
-
if (negate) return ["all", ...values.map((v) => [
|
|
11445
|
-
"!=",
|
|
11446
|
-
get,
|
|
11447
|
-
v
|
|
11448
|
-
])];
|
|
11449
|
-
else return ["any", ...values.map((v) => [
|
|
11450
|
-
"==",
|
|
11451
|
-
get,
|
|
11452
|
-
v
|
|
11453
|
-
])];
|
|
11454
|
-
}
|
|
11455
|
-
function convertHasOp(property) {
|
|
11456
|
-
if (property === "$type") return true;
|
|
11457
|
-
else if (property === "$id") return [
|
|
11458
|
-
"!=",
|
|
11459
|
-
["id"],
|
|
11460
|
-
null
|
|
11461
|
-
];
|
|
11462
|
-
else return ["has", property];
|
|
11463
|
-
}
|
|
11464
11407
|
function stringify$1(obj) {
|
|
11465
11408
|
const type = typeof obj;
|
|
11466
11409
|
if (type === "number" || type === "boolean" || type === "string" || obj === void 0 || obj === null) return JSON.stringify(obj);
|
|
@@ -11864,7 +11807,6 @@ function validateNonExpressionFilter(options) {
|
|
|
11864
11807
|
type = getType(value[1]);
|
|
11865
11808
|
if (value.length !== 2) errors.push(new ValidationError(key, value, `filter array for "${value[0]}" operator must have 2 elements`));
|
|
11866
11809
|
else if (type !== "string") errors.push(new ValidationError(`${key}[1]`, value[1], `string expected, ${type} found`));
|
|
11867
|
-
break;
|
|
11868
11810
|
}
|
|
11869
11811
|
return errors;
|
|
11870
11812
|
}
|
|
@@ -12580,10 +12522,6 @@ function wrapCleanErrors(inner) {
|
|
|
12580
12522
|
return sortErrors(inner.apply(this, args));
|
|
12581
12523
|
};
|
|
12582
12524
|
}
|
|
12583
|
-
function resolveConstant(style, value) {
|
|
12584
|
-
if (typeof value === "string" && value[0] === "@") return resolveConstant(style, style.constants[value]);
|
|
12585
|
-
else return value;
|
|
12586
|
-
}
|
|
12587
12525
|
const visibilitySpec = {
|
|
12588
12526
|
type: "enum",
|
|
12589
12527
|
"property-type": "data-constant",
|
|
@@ -13506,6 +13444,22 @@ var PossiblyEvaluated = class {
|
|
|
13506
13444
|
}
|
|
13507
13445
|
};
|
|
13508
13446
|
/**
|
|
13447
|
+
* Returns the length of the array value, or undefined if the value is not an array or a style spec array wrapper.
|
|
13448
|
+
*/
|
|
13449
|
+
function getArrayValueLength(value) {
|
|
13450
|
+
if (Array.isArray(value)) return value.length;
|
|
13451
|
+
const values = value?.values;
|
|
13452
|
+
return Array.isArray(values) ? values.length : void 0;
|
|
13453
|
+
}
|
|
13454
|
+
/**
|
|
13455
|
+
* Returns true if the two values are arrays of different length, either bare arrays or style spec array wrappers.
|
|
13456
|
+
*/
|
|
13457
|
+
function isNonInterpolableArrayChange(a, b) {
|
|
13458
|
+
const lengthA = getArrayValueLength(a);
|
|
13459
|
+
const lengthB = getArrayValueLength(b);
|
|
13460
|
+
return lengthA !== void 0 && lengthB !== void 0 && lengthA !== lengthB;
|
|
13461
|
+
}
|
|
13462
|
+
/**
|
|
13509
13463
|
* @internal
|
|
13510
13464
|
* An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.
|
|
13511
13465
|
* This restriction allows us to declare statically that the result of possibly evaluating this kind of property
|
|
@@ -13521,6 +13475,10 @@ var DataConstantProperty = class {
|
|
|
13521
13475
|
return value.expression.evaluate(parameters);
|
|
13522
13476
|
}
|
|
13523
13477
|
interpolate(a, b, t) {
|
|
13478
|
+
if (isNonInterpolableArrayChange(a, b)) {
|
|
13479
|
+
warnOnce(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`);
|
|
13480
|
+
return b;
|
|
13481
|
+
}
|
|
13524
13482
|
const interpolationType = this.specification.type;
|
|
13525
13483
|
const interpolationFn = interpolateFactory[interpolationType];
|
|
13526
13484
|
if (interpolationFn) return interpolationFn(a, b, t);
|
|
@@ -13552,6 +13510,10 @@ var DataDrivenProperty = class {
|
|
|
13552
13510
|
kind: "constant",
|
|
13553
13511
|
value: void 0
|
|
13554
13512
|
}, a.parameters);
|
|
13513
|
+
if (isNonInterpolableArrayChange(a.value.value, b.value.value)) {
|
|
13514
|
+
warnOnce(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`);
|
|
13515
|
+
return b;
|
|
13516
|
+
}
|
|
13555
13517
|
const interpolationType = this.specification.type;
|
|
13556
13518
|
const interpolationFn = interpolateFactory[interpolationType];
|
|
13557
13519
|
if (interpolationFn) {
|
|
@@ -15139,7 +15101,6 @@ var RasterBoundsArray = class extends StructArrayLayout4i8 {};
|
|
|
15139
15101
|
var CircleLayoutArray = class extends StructArrayLayout2i4 {};
|
|
15140
15102
|
var FillLayoutArray = class extends StructArrayLayout2i4 {};
|
|
15141
15103
|
var FillExtrusionLayoutArray = class extends StructArrayLayout2i4i12 {};
|
|
15142
|
-
(class extends StructArrayLayout2i4 {});
|
|
15143
15104
|
var LineLayoutArray = class extends StructArrayLayout2i4ub8 {};
|
|
15144
15105
|
var LineExtLayoutArray = class extends StructArrayLayout2f8 {};
|
|
15145
15106
|
var PatternLayoutArray = class extends StructArrayLayout10ui20 {};
|
|
@@ -15156,14 +15117,14 @@ var LineIndexArray = class extends StructArrayLayout2ui4 {};
|
|
|
15156
15117
|
var LineStripIndexArray = class extends StructArrayLayout1ui2 {};
|
|
15157
15118
|
//#endregion
|
|
15158
15119
|
//#region src/data/bucket/circle_attributes.ts
|
|
15159
|
-
const layout$
|
|
15120
|
+
const layout$7 = createLayout([{
|
|
15160
15121
|
name: "a_pos",
|
|
15161
15122
|
components: 2,
|
|
15162
15123
|
type: "Int16"
|
|
15163
15124
|
}], 4);
|
|
15164
|
-
const members$4 = layout$
|
|
15165
|
-
layout$
|
|
15166
|
-
layout$
|
|
15125
|
+
const members$4 = layout$7.members;
|
|
15126
|
+
layout$7.size;
|
|
15127
|
+
layout$7.alignment;
|
|
15167
15128
|
//#endregion
|
|
15168
15129
|
//#region src/data/segment.ts
|
|
15169
15130
|
/**
|
|
@@ -16184,10 +16145,11 @@ var CircleBucket = class {
|
|
|
16184
16145
|
subdivide ||= circleStyle.paint.get("circle-pitch-alignment") === "map";
|
|
16185
16146
|
}
|
|
16186
16147
|
const granularity = subdivide ? options.subdivisionGranularity.circle : 1;
|
|
16148
|
+
const globalProperties = new EvaluationParameters(this.zoom);
|
|
16149
|
+
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
16187
16150
|
for (const { feature, id, index, sourceLayerIndex } of features) {
|
|
16188
|
-
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
16189
16151
|
const evaluationFeature = toEvaluationFeature(feature, needGeometry);
|
|
16190
|
-
if (!this.layers[0]._featureFilter.filter(
|
|
16152
|
+
if (!this.layers[0]._featureFilter.filter(globalProperties, evaluationFeature, canonical)) continue;
|
|
16191
16153
|
const sortKey = sortFeaturesByKey ? circleSortKey.evaluate(evaluationFeature, {}, canonical) : void 0;
|
|
16192
16154
|
const bucketFeature = {
|
|
16193
16155
|
id,
|
|
@@ -16507,8 +16469,8 @@ function projectQueryGeometry$1(queryGeometry, transform, unwrappedTileID, getEl
|
|
|
16507
16469
|
}
|
|
16508
16470
|
//#endregion
|
|
16509
16471
|
//#region src/style/style_layer/circle_style_layer_properties.g.ts
|
|
16510
|
-
let layout$
|
|
16511
|
-
const getLayout$
|
|
16472
|
+
let layout$6;
|
|
16473
|
+
const getLayout$4 = () => layout$6 = layout$6 || new Properties({ "circle-sort-key": new DataDrivenProperty(latest["layout_circle"]["circle-sort-key"], "circle-sort-key") });
|
|
16512
16474
|
let paint$8;
|
|
16513
16475
|
const getPaint$8 = () => paint$8 = paint$8 || new Properties({
|
|
16514
16476
|
"circle-radius": new DataDrivenProperty(latest["paint_circle"]["circle-radius"], "circle-radius"),
|
|
@@ -16528,7 +16490,7 @@ var circle_style_layer_properties_g_default = {
|
|
|
16528
16490
|
return getPaint$8();
|
|
16529
16491
|
},
|
|
16530
16492
|
get layout() {
|
|
16531
|
-
return getLayout$
|
|
16493
|
+
return getLayout$4();
|
|
16532
16494
|
}
|
|
16533
16495
|
};
|
|
16534
16496
|
//#endregion
|
|
@@ -17014,7 +16976,6 @@ var DEMData = class DEMData {
|
|
|
17014
16976
|
this.greenFactor = 25.6;
|
|
17015
16977
|
this.blueFactor = .1;
|
|
17016
16978
|
this.baseShift = 1e4;
|
|
17017
|
-
break;
|
|
17018
16979
|
}
|
|
17019
16980
|
for (let x = 0; x < dim; x++) {
|
|
17020
16981
|
this.data[this._idx(-1, x)] = this.data[this._idx(0, x)];
|
|
@@ -17087,17 +17048,13 @@ var DEMData = class DEMData {
|
|
|
17087
17048
|
case -1:
|
|
17088
17049
|
xMin = xMax - 1;
|
|
17089
17050
|
break;
|
|
17090
|
-
case 1:
|
|
17091
|
-
xMax = xMin + 1;
|
|
17092
|
-
break;
|
|
17051
|
+
case 1: xMax = xMin + 1;
|
|
17093
17052
|
}
|
|
17094
17053
|
switch (dy) {
|
|
17095
17054
|
case -1:
|
|
17096
17055
|
yMin = yMax - 1;
|
|
17097
17056
|
break;
|
|
17098
|
-
case 1:
|
|
17099
|
-
yMax = yMin + 1;
|
|
17100
|
-
break;
|
|
17057
|
+
case 1: yMax = yMin + 1;
|
|
17101
17058
|
}
|
|
17102
17059
|
const ox = -dx * this.dim;
|
|
17103
17060
|
const oy = -dy * this.dim;
|
|
@@ -17210,14 +17167,14 @@ var ColorReliefStyleLayer = class extends StyleLayer {
|
|
|
17210
17167
|
};
|
|
17211
17168
|
//#endregion
|
|
17212
17169
|
//#region src/data/bucket/fill_attributes.ts
|
|
17213
|
-
const layout$
|
|
17170
|
+
const layout$5 = createLayout([{
|
|
17214
17171
|
name: "a_pos",
|
|
17215
17172
|
components: 2,
|
|
17216
17173
|
type: "Int16"
|
|
17217
17174
|
}], 4);
|
|
17218
|
-
const members$3 = layout$
|
|
17219
|
-
layout$
|
|
17220
|
-
layout$
|
|
17175
|
+
const members$3 = layout$5.members;
|
|
17176
|
+
layout$5.size;
|
|
17177
|
+
layout$5.alignment;
|
|
17221
17178
|
//#endregion
|
|
17222
17179
|
//#region src/data/bucket/pattern_bucket_features.ts
|
|
17223
17180
|
function hasPattern(type, layers, options) {
|
|
@@ -18093,7 +18050,7 @@ var Subdivider = class {
|
|
|
18093
18050
|
for (let i = 0; i < flattened.length; i += 2) {
|
|
18094
18051
|
const vy = flattened[i + 1];
|
|
18095
18052
|
if (vy === -32768) flattened[i + 1] = -32767;
|
|
18096
|
-
if (vy === 32767) flattened[i + 1] =
|
|
18053
|
+
if (vy === 32767) flattened[i + 1] = 32766;
|
|
18097
18054
|
}
|
|
18098
18055
|
}
|
|
18099
18056
|
/**
|
|
@@ -18190,12 +18147,50 @@ var Subdivider = class {
|
|
|
18190
18147
|
if (generateOutlineLines) subdividedLines = this._generateOutline(polygon);
|
|
18191
18148
|
this._ensureNoPoleVertices();
|
|
18192
18149
|
this._handlePoles(subdividedTriangles);
|
|
18150
|
+
if (this._granularity >= 2 && this._canonical?.z === 0) {
|
|
18151
|
+
subdividedTriangles = this._removeTrianglesOutsideTileX(subdividedTriangles);
|
|
18152
|
+
subdividedLines = subdividedLines.map((lines) => this._removeLinesOutsideTileX(lines));
|
|
18153
|
+
}
|
|
18193
18154
|
return {
|
|
18194
18155
|
verticesFlattened: this._vertexBuffer,
|
|
18195
18156
|
indicesTriangles: subdividedTriangles,
|
|
18196
18157
|
indicesLineList: subdividedLines
|
|
18197
18158
|
};
|
|
18198
18159
|
}
|
|
18160
|
+
_vertexOutsideTileX(index) {
|
|
18161
|
+
const x = this._vertexBuffer[index * 2];
|
|
18162
|
+
return x < 0 || x > 8192;
|
|
18163
|
+
}
|
|
18164
|
+
/**
|
|
18165
|
+
* Drops all triangles that reach beyond the tile's X extent.
|
|
18166
|
+
*
|
|
18167
|
+
* On globe the z0 tile's buffer wraps around the planet onto the tile itself, drawing buffered geometry twice.
|
|
18168
|
+
* Only globe uses subdivision (`granularity >= 2`), so mercator is never affected.
|
|
18169
|
+
* @param indices - Triangle indices into `this._vertexBuffer`.
|
|
18170
|
+
* @returns The indices with every triangle that has a vertex outside the tile's X extent removed.
|
|
18171
|
+
*/
|
|
18172
|
+
_removeTrianglesOutsideTileX(indices) {
|
|
18173
|
+
const filtered = [];
|
|
18174
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
18175
|
+
if (this._vertexOutsideTileX(indices[i]) || this._vertexOutsideTileX(indices[i + 1]) || this._vertexOutsideTileX(indices[i + 2])) continue;
|
|
18176
|
+
filtered.push(indices[i], indices[i + 1], indices[i + 2]);
|
|
18177
|
+
}
|
|
18178
|
+
return filtered;
|
|
18179
|
+
}
|
|
18180
|
+
/**
|
|
18181
|
+
* Drops all outline line segments that reach beyond the tile's X extent,
|
|
18182
|
+
* for the same reason as {@link Subdivider._removeTrianglesOutsideTileX}.
|
|
18183
|
+
* @param indices - Line segment indices into `this._vertexBuffer`.
|
|
18184
|
+
* @returns The indices with every segment that has a vertex outside the tile's X extent removed.
|
|
18185
|
+
*/
|
|
18186
|
+
_removeLinesOutsideTileX(indices) {
|
|
18187
|
+
const filtered = [];
|
|
18188
|
+
for (let i = 0; i < indices.length; i += 2) {
|
|
18189
|
+
if (this._vertexOutsideTileX(indices[i]) || this._vertexOutsideTileX(indices[i + 1])) continue;
|
|
18190
|
+
filtered.push(indices[i], indices[i + 1]);
|
|
18191
|
+
}
|
|
18192
|
+
return filtered;
|
|
18193
|
+
}
|
|
18199
18194
|
/**
|
|
18200
18195
|
* Sometimes the supplies vertex and index array has duplicate vertices - same coordinates that are referenced by multiple different indices.
|
|
18201
18196
|
* That is not allowed for purposes of subdivision, duplicates are removed in `this.initializeVertices`.
|
|
@@ -18599,10 +18594,11 @@ var FillBucket = class {
|
|
|
18599
18594
|
const fillSortKey = this.layers[0].layout.get("fill-sort-key");
|
|
18600
18595
|
const sortFeaturesByKey = !fillSortKey.isConstant();
|
|
18601
18596
|
const bucketFeatures = [];
|
|
18597
|
+
const globalProperties = new EvaluationParameters(this.zoom);
|
|
18598
|
+
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
18602
18599
|
for (const { feature, id, index, sourceLayerIndex } of features) {
|
|
18603
|
-
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
18604
18600
|
const evaluationFeature = toEvaluationFeature(feature, needGeometry);
|
|
18605
|
-
if (!this.layers[0]._featureFilter.filter(
|
|
18601
|
+
if (!this.layers[0]._featureFilter.filter(globalProperties, evaluationFeature, canonical)) continue;
|
|
18606
18602
|
const sortKey = sortFeaturesByKey ? fillSortKey.evaluate(evaluationFeature, {}, canonical, options.availableImages) : void 0;
|
|
18607
18603
|
const bucketFeature = {
|
|
18608
18604
|
id,
|
|
@@ -18675,8 +18671,8 @@ var FillBucket = class {
|
|
|
18675
18671
|
register("FillBucket", FillBucket, { omit: ["layers", "patternFeatures"] });
|
|
18676
18672
|
//#endregion
|
|
18677
18673
|
//#region src/style/style_layer/fill_style_layer_properties.g.ts
|
|
18678
|
-
let layout$
|
|
18679
|
-
const getLayout$
|
|
18674
|
+
let layout$4;
|
|
18675
|
+
const getLayout$3 = () => layout$4 = layout$4 || new Properties({ "fill-sort-key": new DataDrivenProperty(latest["layout_fill"]["fill-sort-key"], "fill-sort-key") });
|
|
18680
18676
|
let paint$4;
|
|
18681
18677
|
const getPaint$4 = () => paint$4 = paint$4 || new Properties({
|
|
18682
18678
|
"fill-antialias": new DataConstantProperty(latest["paint_fill"]["fill-antialias"], "fill-antialias"),
|
|
@@ -18693,7 +18689,7 @@ var fill_style_layer_properties_g_default = {
|
|
|
18693
18689
|
return getPaint$4();
|
|
18694
18690
|
},
|
|
18695
18691
|
get layout() {
|
|
18696
|
-
return getLayout$
|
|
18692
|
+
return getLayout$3();
|
|
18697
18693
|
}
|
|
18698
18694
|
};
|
|
18699
18695
|
//#endregion
|
|
@@ -18723,7 +18719,7 @@ var FillStyleLayer = class extends StyleLayer {
|
|
|
18723
18719
|
};
|
|
18724
18720
|
//#endregion
|
|
18725
18721
|
//#region src/data/bucket/fill_extrusion_attributes.ts
|
|
18726
|
-
const layout$
|
|
18722
|
+
const layout$3 = createLayout([{
|
|
18727
18723
|
name: "a_pos",
|
|
18728
18724
|
components: 2,
|
|
18729
18725
|
type: "Int16"
|
|
@@ -18737,9 +18733,9 @@ const centroidAttributes = createLayout([{
|
|
|
18737
18733
|
components: 2,
|
|
18738
18734
|
type: "Int16"
|
|
18739
18735
|
}], 4);
|
|
18740
|
-
const members$2 = layout$
|
|
18741
|
-
layout$
|
|
18742
|
-
layout$
|
|
18736
|
+
const members$2 = layout$3.members;
|
|
18737
|
+
layout$3.size;
|
|
18738
|
+
layout$3.alignment;
|
|
18743
18739
|
//#endregion
|
|
18744
18740
|
//#region node_modules/@mapbox/vector-tile/index.js
|
|
18745
18741
|
/** @import {PbfReader} from 'pbf' */
|
|
@@ -19027,47 +19023,452 @@ var VectorTile = class {
|
|
|
19027
19023
|
}
|
|
19028
19024
|
};
|
|
19029
19025
|
//#endregion
|
|
19030
|
-
//#region src/
|
|
19031
|
-
const
|
|
19032
|
-
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
19052
|
-
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
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");
|
|
19058
|
+
}
|
|
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);
|
|
19072
|
+
}
|
|
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];
|
|
19085
|
+
}
|
|
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})`;
|
|
19098
|
+
}
|
|
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
|
+
}
|
|
19071
19472
|
}
|
|
19072
19473
|
addFeatures(options, canonical, imagePositions) {
|
|
19073
19474
|
for (const feature of this.features) {
|
|
@@ -19103,7 +19504,10 @@ var FillExtrusionBucket = class {
|
|
|
19103
19504
|
this.centroidVertexBuffer.destroy();
|
|
19104
19505
|
}
|
|
19105
19506
|
addFeature(feature, geometry, index, canonical, imagePositions, subdivisionGranularity) {
|
|
19106
|
-
|
|
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)) {
|
|
19107
19511
|
const centroid = {
|
|
19108
19512
|
x: 0,
|
|
19109
19513
|
y: 0,
|
|
@@ -19193,6 +19597,8 @@ function isEntirelyOutside(ring) {
|
|
|
19193
19597
|
}
|
|
19194
19598
|
//#endregion
|
|
19195
19599
|
//#region src/style/style_layer/fill_extrusion_style_layer_properties.g.ts
|
|
19600
|
+
let layout$2;
|
|
19601
|
+
const getLayout$2 = () => layout$2 = layout$2 || new Properties({ "fill-extrusion-rounded-corner-distance": new DataConstantProperty(latest["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"], "fill-extrusion-rounded-corner-distance") });
|
|
19196
19602
|
let paint$3;
|
|
19197
19603
|
const getPaint$3 = () => paint$3 = paint$3 || new Properties({
|
|
19198
19604
|
"fill-extrusion-opacity": new DataConstantProperty(latest["paint_fill-extrusion"]["fill-extrusion-opacity"], "fill-extrusion-opacity"),
|
|
@@ -19204,9 +19610,14 @@ const getPaint$3 = () => paint$3 = paint$3 || new Properties({
|
|
|
19204
19610
|
"fill-extrusion-base": new DataDrivenProperty(latest["paint_fill-extrusion"]["fill-extrusion-base"], "fill-extrusion-base"),
|
|
19205
19611
|
"fill-extrusion-vertical-gradient": new DataConstantProperty(latest["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"], "fill-extrusion-vertical-gradient")
|
|
19206
19612
|
});
|
|
19207
|
-
var fill_extrusion_style_layer_properties_g_default = {
|
|
19208
|
-
|
|
19209
|
-
|
|
19613
|
+
var fill_extrusion_style_layer_properties_g_default = {
|
|
19614
|
+
get paint() {
|
|
19615
|
+
return getPaint$3();
|
|
19616
|
+
},
|
|
19617
|
+
get layout() {
|
|
19618
|
+
return getLayout$2();
|
|
19619
|
+
}
|
|
19620
|
+
};
|
|
19210
19621
|
const isFillExtrusionStyleLayer = (layer) => layer.type === "fill-extrusion";
|
|
19211
19622
|
var FillExtrusionStyleLayer = class extends StyleLayer {
|
|
19212
19623
|
constructor(layer, globalState) {
|
|
@@ -19449,9 +19860,7 @@ function createFeature(id, type, geom, tags) {
|
|
|
19449
19860
|
case "MultiLineString":
|
|
19450
19861
|
for (const line of data.geom) calcLineBBox(feature, line.points);
|
|
19451
19862
|
break;
|
|
19452
|
-
case "MultiPolygon":
|
|
19453
|
-
for (const polygon of data.geom) calcLineBBox(feature, polygon[0].points);
|
|
19454
|
-
break;
|
|
19863
|
+
case "MultiPolygon": for (const polygon of data.geom) calcLineBBox(feature, polygon[0].points);
|
|
19455
19864
|
}
|
|
19456
19865
|
return feature;
|
|
19457
19866
|
}
|
|
@@ -20112,7 +20521,7 @@ var KDBush = class KDBush {
|
|
|
20112
20521
|
this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
|
|
20113
20522
|
this._pos = 0;
|
|
20114
20523
|
this._finished = false;
|
|
20115
|
-
new Uint8Array(data, 0, 2).set([219,
|
|
20524
|
+
new Uint8Array(data, 0, 2).set([219, 16 + arrayTypeIndex]);
|
|
20116
20525
|
new Uint16Array(data, 2, 1)[0] = nodeSize;
|
|
20117
20526
|
new Uint32Array(data, 4, 1)[0] = numItems;
|
|
20118
20527
|
}
|
|
@@ -21275,9 +21684,8 @@ const EXTRUDE_SCALE = 63;
|
|
|
21275
21684
|
const COS_HALF_SHARP_CORNER = Math.cos(75 / 2 * (Math.PI / 180));
|
|
21276
21685
|
const SHARP_CORNER_OFFSET = 15;
|
|
21277
21686
|
const DEG_PER_TRIANGLE = 20;
|
|
21278
|
-
const LINE_DISTANCE_BUFFER_BITS = 15;
|
|
21279
21687
|
const LINE_DISTANCE_SCALE = 1 / 2;
|
|
21280
|
-
const MAX_LINE_DISTANCE = Math.pow(2,
|
|
21688
|
+
const MAX_LINE_DISTANCE = Math.pow(2, 14) / LINE_DISTANCE_SCALE;
|
|
21281
21689
|
/**
|
|
21282
21690
|
* @internal
|
|
21283
21691
|
* Line bucket class
|
|
@@ -21307,10 +21715,11 @@ var LineBucket = class {
|
|
|
21307
21715
|
const lineSortKey = this.layers[0].layout.get("line-sort-key");
|
|
21308
21716
|
const sortFeaturesByKey = !lineSortKey.isConstant();
|
|
21309
21717
|
const bucketFeatures = [];
|
|
21718
|
+
const globalProperties = new EvaluationParameters(this.zoom);
|
|
21719
|
+
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
21310
21720
|
for (const { feature, id, index, sourceLayerIndex } of features) {
|
|
21311
|
-
const needGeometry = this.layers[0]._featureFilter.needGeometry;
|
|
21312
21721
|
const evaluationFeature = toEvaluationFeature(feature, needGeometry);
|
|
21313
|
-
if (!this.layers[0]._featureFilter.filter(
|
|
21722
|
+
if (!this.layers[0]._featureFilter.filter(globalProperties, evaluationFeature, canonical)) continue;
|
|
21314
21723
|
const sortKey = sortFeaturesByKey ? lineSortKey.evaluate(evaluationFeature, {}, canonical) : void 0;
|
|
21315
21724
|
const bucketFeature = {
|
|
21316
21725
|
id,
|
|
@@ -22438,7 +22847,7 @@ var TaggedString = class TaggedString {
|
|
|
22438
22847
|
};
|
|
22439
22848
|
//#endregion
|
|
22440
22849
|
//#region node_modules/pbf/index.js
|
|
22441
|
-
const SHIFT_LEFT_32 =
|
|
22850
|
+
const SHIFT_LEFT_32 = 4294967296;
|
|
22442
22851
|
const SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
|
|
22443
22852
|
const TEXT_DECODER_MIN_LENGTH$1 = 12;
|
|
22444
22853
|
const utf8TextDecoder$1 = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
|
|
@@ -23213,9 +23622,6 @@ function writeUtf8(buf, str, pos) {
|
|
|
23213
23622
|
}
|
|
23214
23623
|
return pos;
|
|
23215
23624
|
}
|
|
23216
|
-
//#endregion
|
|
23217
|
-
//#region src/style/parse_glyph_pbf.ts
|
|
23218
|
-
const border$1 = 3;
|
|
23219
23625
|
function readFontstacks(tag, glyphs, pbf) {
|
|
23220
23626
|
if (tag === 1) pbf.readMessage(readFontstack, glyphs);
|
|
23221
23627
|
}
|
|
@@ -23225,8 +23631,8 @@ function readFontstack(tag, glyphs, pbf) {
|
|
|
23225
23631
|
glyphs.push({
|
|
23226
23632
|
id,
|
|
23227
23633
|
bitmap: new AlphaImage({
|
|
23228
|
-
width: width +
|
|
23229
|
-
height: height +
|
|
23634
|
+
width: width + 6,
|
|
23635
|
+
height: height + 6
|
|
23230
23636
|
}, bitmap),
|
|
23231
23637
|
metrics: {
|
|
23232
23638
|
width,
|
|
@@ -23556,10 +23962,8 @@ function getAnchorAlignment(anchor) {
|
|
|
23556
23962
|
horizontalAlign = 1;
|
|
23557
23963
|
break;
|
|
23558
23964
|
case "left":
|
|
23559
|
-
case "top-left":
|
|
23560
|
-
case "bottom-left":
|
|
23561
|
-
horizontalAlign = 0;
|
|
23562
|
-
break;
|
|
23965
|
+
case "top-left":
|
|
23966
|
+
case "bottom-left": horizontalAlign = 0;
|
|
23563
23967
|
}
|
|
23564
23968
|
switch (anchor) {
|
|
23565
23969
|
case "bottom":
|
|
@@ -23569,9 +23973,7 @@ function getAnchorAlignment(anchor) {
|
|
|
23569
23973
|
break;
|
|
23570
23974
|
case "top":
|
|
23571
23975
|
case "top-right":
|
|
23572
|
-
case "top-left":
|
|
23573
|
-
verticalAlign = 0;
|
|
23574
|
-
break;
|
|
23976
|
+
case "top-left": verticalAlign = 0;
|
|
23575
23977
|
}
|
|
23576
23978
|
return {
|
|
23577
23979
|
horizontalAlign,
|
|
@@ -24629,502 +25031,259 @@ function getIconPadding(layout, feature, canonical, pixelRatio = 1) {
|
|
|
24629
25031
|
values[1] * pixelRatio,
|
|
24630
25032
|
values[2] * pixelRatio,
|
|
24631
25033
|
values[3] * pixelRatio
|
|
24632
|
-
];
|
|
24633
|
-
}
|
|
24634
|
-
//#endregion
|
|
24635
|
-
//#region src/style/style_layer/background_style_layer_properties.g.ts
|
|
24636
|
-
let paint;
|
|
24637
|
-
const getPaint = () => paint = paint || new Properties({
|
|
24638
|
-
"background-color": new DataConstantProperty(latest["paint_background"]["background-color"], "background-color"),
|
|
24639
|
-
"background-pattern": new CrossFadedProperty(latest["paint_background"]["background-pattern"], "background-pattern"),
|
|
24640
|
-
"background-opacity": new DataConstantProperty(latest["paint_background"]["background-opacity"], "background-opacity")
|
|
24641
|
-
});
|
|
24642
|
-
var background_style_layer_properties_g_default = { get paint() {
|
|
24643
|
-
return getPaint();
|
|
24644
|
-
} };
|
|
24645
|
-
//#endregion
|
|
24646
|
-
//#region src/style/style_layer/background_style_layer.ts
|
|
24647
|
-
const isBackgroundStyleLayer = (layer) => layer.type === "background";
|
|
24648
|
-
var BackgroundStyleLayer = class extends StyleLayer {
|
|
24649
|
-
constructor(layer, globalState) {
|
|
24650
|
-
super(layer, background_style_layer_properties_g_default, globalState);
|
|
24651
|
-
}
|
|
24652
|
-
};
|
|
24653
|
-
//#endregion
|
|
24654
|
-
//#region src/style/style_layer/custom_style_layer.ts
|
|
24655
|
-
function validateCustomStyleLayer(layerObject) {
|
|
24656
|
-
const errors = [];
|
|
24657
|
-
const id = layerObject.id;
|
|
24658
|
-
if (id === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required property \"id\""));
|
|
24659
|
-
if (layerObject.render === void 0) errors.push(new ValidationError(`layers.${id}`, null, "missing required method \"render\""));
|
|
24660
|
-
if (layerObject.renderingMode && layerObject.renderingMode !== "2d" && layerObject.renderingMode !== "3d") errors.push(new ValidationError(`layers.${id}`, null, "property \"renderingMode\" must be either \"2d\" or \"3d\""));
|
|
24661
|
-
return errors;
|
|
24662
|
-
}
|
|
24663
|
-
const isCustomStyleLayer = (layer) => layer.type === "custom";
|
|
24664
|
-
var CustomStyleLayer = class extends StyleLayer {
|
|
24665
|
-
constructor(implementation, globalState) {
|
|
24666
|
-
super(implementation, {}, globalState);
|
|
24667
|
-
this.onAdd = (map) => {
|
|
24668
|
-
if (this.implementation.onAdd) this.implementation.onAdd(map, map.painter.context.gl);
|
|
24669
|
-
};
|
|
24670
|
-
this.onRemove = (map) => {
|
|
24671
|
-
if (this.implementation.onRemove) this.implementation.onRemove(map, map.painter.context.gl);
|
|
24672
|
-
};
|
|
24673
|
-
this.implementation = implementation;
|
|
24674
|
-
}
|
|
24675
|
-
is3D() {
|
|
24676
|
-
return this.implementation.renderingMode === "3d";
|
|
24677
|
-
}
|
|
24678
|
-
hasOffscreenPass() {
|
|
24679
|
-
return this.implementation.prerender !== void 0;
|
|
24680
|
-
}
|
|
24681
|
-
recalculate() {}
|
|
24682
|
-
updateTransitions() {}
|
|
24683
|
-
hasTransition() {
|
|
24684
|
-
return false;
|
|
24685
|
-
}
|
|
24686
|
-
serialize() {
|
|
24687
|
-
throw new Error("Custom layers cannot be serialized");
|
|
24688
|
-
}
|
|
24689
|
-
};
|
|
24690
|
-
//#endregion
|
|
24691
|
-
//#region src/style/create_style_layer.ts
|
|
24692
|
-
function createStyleLayer(layer, globalState) {
|
|
24693
|
-
if (layer.type === "custom") return new CustomStyleLayer(layer, globalState);
|
|
24694
|
-
switch (layer.type) {
|
|
24695
|
-
case "background": return new BackgroundStyleLayer(layer, globalState);
|
|
24696
|
-
case "circle": return new CircleStyleLayer(layer, globalState);
|
|
24697
|
-
case "color-relief": return new ColorReliefStyleLayer(layer, globalState);
|
|
24698
|
-
case "fill": return new FillStyleLayer(layer, globalState);
|
|
24699
|
-
case "fill-extrusion": return new FillExtrusionStyleLayer(layer, globalState);
|
|
24700
|
-
case "heatmap": return new HeatmapStyleLayer(layer, globalState);
|
|
24701
|
-
case "hillshade": return new HillshadeStyleLayer(layer, globalState);
|
|
24702
|
-
case "line": return new LineStyleLayer(layer, globalState);
|
|
24703
|
-
case "raster": return new RasterStyleLayer(layer, globalState);
|
|
24704
|
-
case "symbol": return new SymbolStyleLayer(layer, globalState);
|
|
24705
|
-
}
|
|
24706
|
-
}
|
|
24707
|
-
//#endregion
|
|
24708
|
-
//#region src/util/throttled_invoker.ts
|
|
24709
|
-
/**
|
|
24710
|
-
* Invokes the wrapped function in a non-blocking way when trigger() is called.
|
|
24711
|
-
* Invocation requests are ignored until the function was actually invoked.
|
|
24712
|
-
*/
|
|
24713
|
-
var ThrottledInvoker = class {
|
|
24714
|
-
constructor(methodToThrottle) {
|
|
24715
|
-
this._methodToThrottle = methodToThrottle;
|
|
24716
|
-
this._triggered = false;
|
|
24717
|
-
this._channel = new MessageChannel();
|
|
24718
|
-
this._channel.port2.onmessage = () => {
|
|
24719
|
-
this._triggered = false;
|
|
24720
|
-
this._methodToThrottle();
|
|
24721
|
-
};
|
|
24722
|
-
}
|
|
24723
|
-
trigger() {
|
|
24724
|
-
if (this._triggered) return;
|
|
24725
|
-
this._triggered = true;
|
|
24726
|
-
this._channel?.port1.postMessage(true);
|
|
24727
|
-
}
|
|
24728
|
-
remove() {
|
|
24729
|
-
delete this._channel;
|
|
24730
|
-
this._methodToThrottle = () => {};
|
|
24731
|
-
}
|
|
24732
|
-
};
|
|
24733
|
-
//#endregion
|
|
24734
|
-
//#region src/util/actor.ts
|
|
24735
|
-
const addEventDefaultOptions = { once: true };
|
|
24736
|
-
/**
|
|
24737
|
-
* An implementation of the [Actor design pattern](https://en.wikipedia.org/wiki/Actor_model)
|
|
24738
|
-
* that maintains the relationship between asynchronous tasks and the objects
|
|
24739
|
-
* that spin them off - in this case, tasks like parsing parts of styles,
|
|
24740
|
-
* owned by the styles
|
|
24741
|
-
*/
|
|
24742
|
-
var Actor = class {
|
|
24743
|
-
/**
|
|
24744
|
-
* @param target - The target
|
|
24745
|
-
* @param mapId - A unique identifier for the Map instance using this Actor.
|
|
24746
|
-
*/
|
|
24747
|
-
constructor(target, mapId) {
|
|
24748
|
-
this.target = target;
|
|
24749
|
-
this.mapId = mapId;
|
|
24750
|
-
this.resolveRejects = {};
|
|
24751
|
-
this.tasks = {};
|
|
24752
|
-
this.taskQueue = [];
|
|
24753
|
-
this.abortControllers = {};
|
|
24754
|
-
this.messageHandlers = {};
|
|
24755
|
-
this.invoker = new ThrottledInvoker(() => this.process());
|
|
24756
|
-
this.subscription = subscribe(this.target, "message", (message) => this.receive(message), false);
|
|
24757
|
-
this.globalScope = isWorker(self) ? target : window;
|
|
24758
|
-
}
|
|
24759
|
-
registerMessageHandler(type, handler) {
|
|
24760
|
-
this.messageHandlers[type] = handler;
|
|
24761
|
-
}
|
|
24762
|
-
unregisterMessageHandler(type) {
|
|
24763
|
-
delete this.messageHandlers[type];
|
|
24764
|
-
}
|
|
24765
|
-
/**
|
|
24766
|
-
* Sends a message from a main-thread map to a Worker or from a Worker back to
|
|
24767
|
-
* a main-thread map instance.
|
|
24768
|
-
* @param message - the message to send
|
|
24769
|
-
* @param abortController - an optional AbortController to abort the request
|
|
24770
|
-
* @returns a promise that will be resolved with the response data
|
|
24771
|
-
*/
|
|
24772
|
-
sendAsync(message, abortController) {
|
|
24773
|
-
return new Promise((resolve, reject) => {
|
|
24774
|
-
const id = Math.round(Math.random() * 0xde0b6b3a7640000).toString(36).substring(0, 10);
|
|
24775
|
-
const subscription = abortController ? subscribe(abortController.signal, "abort", () => {
|
|
24776
|
-
subscription?.unsubscribe();
|
|
24777
|
-
delete this.resolveRejects[id];
|
|
24778
|
-
const cancelMessage = {
|
|
24779
|
-
id,
|
|
24780
|
-
type: "<cancel>",
|
|
24781
|
-
origin: location.origin,
|
|
24782
|
-
targetMapId: message.targetMapId,
|
|
24783
|
-
sourceMapId: this.mapId
|
|
24784
|
-
};
|
|
24785
|
-
this.target.postMessage(cancelMessage);
|
|
24786
|
-
reject(new AbortError(abortController.signal.reason));
|
|
24787
|
-
}, addEventDefaultOptions) : null;
|
|
24788
|
-
this.resolveRejects[id] = {
|
|
24789
|
-
resolve: (value) => {
|
|
24790
|
-
subscription?.unsubscribe();
|
|
24791
|
-
resolve(value);
|
|
24792
|
-
},
|
|
24793
|
-
reject: (reason) => {
|
|
24794
|
-
subscription?.unsubscribe();
|
|
24795
|
-
reject(reason);
|
|
24796
|
-
}
|
|
24797
|
-
};
|
|
24798
|
-
const buffers = [];
|
|
24799
|
-
const messageToPost = {
|
|
24800
|
-
...message,
|
|
24801
|
-
id,
|
|
24802
|
-
sourceMapId: this.mapId,
|
|
24803
|
-
origin: location.origin,
|
|
24804
|
-
data: serialize(message.data, buffers)
|
|
24805
|
-
};
|
|
24806
|
-
this.target.postMessage(messageToPost, { transfer: buffers });
|
|
24807
|
-
});
|
|
24808
|
-
}
|
|
24809
|
-
receive(message) {
|
|
24810
|
-
const data = message.data;
|
|
24811
|
-
const id = data.id;
|
|
24812
|
-
const SPECIAL_ORIGINS = [
|
|
24813
|
-
"file://",
|
|
24814
|
-
"resource://android",
|
|
24815
|
-
"null"
|
|
24816
|
-
];
|
|
24817
|
-
const origins = [data.origin, location.origin];
|
|
24818
|
-
const isSameOrigin = data.origin === location.origin;
|
|
24819
|
-
const hasSpecialOrigin = origins.some((origin) => SPECIAL_ORIGINS.includes(origin));
|
|
24820
|
-
if (!isSameOrigin && !hasSpecialOrigin) return;
|
|
24821
|
-
if (data.targetMapId && this.mapId !== data.targetMapId) return;
|
|
24822
|
-
if (data.type === "<cancel>") {
|
|
24823
|
-
delete this.tasks[id];
|
|
24824
|
-
const abortController = this.abortControllers[id];
|
|
24825
|
-
delete this.abortControllers[id];
|
|
24826
|
-
if (abortController) abortController.abort();
|
|
24827
|
-
return;
|
|
24828
|
-
}
|
|
24829
|
-
if (isWorker(self) || data.mustQueue) {
|
|
24830
|
-
this.tasks[id] = data;
|
|
24831
|
-
this.taskQueue.push(id);
|
|
24832
|
-
this.invoker.trigger();
|
|
24833
|
-
return;
|
|
24834
|
-
}
|
|
24835
|
-
this.processTask(id, data);
|
|
24836
|
-
}
|
|
24837
|
-
process() {
|
|
24838
|
-
if (this.taskQueue.length === 0) return;
|
|
24839
|
-
const id = this.taskQueue.shift();
|
|
24840
|
-
const task = this.tasks[id];
|
|
24841
|
-
delete this.tasks[id];
|
|
24842
|
-
if (this.taskQueue.length > 0) this.invoker.trigger();
|
|
24843
|
-
if (!task) return;
|
|
24844
|
-
this.processTask(id, task);
|
|
24845
|
-
}
|
|
24846
|
-
async processTask(id, task) {
|
|
24847
|
-
if (task.type === "<response>") {
|
|
24848
|
-
const resolveReject = this.resolveRejects[id];
|
|
24849
|
-
delete this.resolveRejects[id];
|
|
24850
|
-
if (!resolveReject) return;
|
|
24851
|
-
if (task.error) resolveReject.reject(ensureError(deserialize(task.error)));
|
|
24852
|
-
else resolveReject.resolve(deserialize(task.data));
|
|
24853
|
-
return;
|
|
24854
|
-
}
|
|
24855
|
-
if (!this.messageHandlers[task.type]) {
|
|
24856
|
-
this.completeTask(id, null, null);
|
|
24857
|
-
return;
|
|
24858
|
-
}
|
|
24859
|
-
const params = deserialize(task.data);
|
|
24860
|
-
const abortController = new AbortController();
|
|
24861
|
-
this.abortControllers[id] = abortController;
|
|
24862
|
-
try {
|
|
24863
|
-
const data = await this.messageHandlers[task.type](task.sourceMapId, params, abortController);
|
|
24864
|
-
this.completeTask(id, null, data);
|
|
24865
|
-
} catch (err) {
|
|
24866
|
-
this.completeTask(id, ensureError(err));
|
|
24867
|
-
}
|
|
24868
|
-
}
|
|
24869
|
-
completeTask(id, err, data) {
|
|
24870
|
-
const buffers = [];
|
|
24871
|
-
delete this.abortControllers[id];
|
|
24872
|
-
const responseMessage = {
|
|
24873
|
-
id,
|
|
24874
|
-
type: "<response>",
|
|
24875
|
-
sourceMapId: this.mapId,
|
|
24876
|
-
origin: location.origin,
|
|
24877
|
-
error: err ? serialize(err) : null,
|
|
24878
|
-
data: serialize(data, buffers)
|
|
24879
|
-
};
|
|
24880
|
-
this.target.postMessage(responseMessage, { transfer: buffers });
|
|
24881
|
-
}
|
|
24882
|
-
remove() {
|
|
24883
|
-
this.invoker.remove();
|
|
24884
|
-
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);
|
|
24885
25053
|
}
|
|
24886
25054
|
};
|
|
24887
25055
|
//#endregion
|
|
24888
|
-
//#region src/
|
|
24889
|
-
|
|
24890
|
-
|
|
24891
|
-
|
|
24892
|
-
|
|
24893
|
-
|
|
24894
|
-
|
|
24895
|
-
|
|
24896
|
-
|
|
24897
|
-
|
|
24898
|
-
|
|
24899
|
-
|
|
24900
|
-
|
|
24901
|
-
|
|
24902
|
-
|
|
24903
|
-
|
|
24904
|
-
|
|
24905
|
-
|
|
24906
|
-
|
|
24907
|
-
|
|
24908
|
-
* @see [Get coordinates of the mouse pointer](https://maplibre.org/maplibre-gl-js/docs/examples/get-coordinates-of-the-mouse-pointer/)
|
|
24909
|
-
*/
|
|
24910
|
-
var LngLat = class LngLat {
|
|
24911
|
-
/**
|
|
24912
|
-
* @param lng - Longitude, measured in degrees.
|
|
24913
|
-
* @param lat - Latitude, measured in degrees.
|
|
24914
|
-
*/
|
|
24915
|
-
constructor(lng, lat) {
|
|
24916
|
-
if (isNaN(lng) || isNaN(lat)) throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
|
|
24917
|
-
this.lng = +lng;
|
|
24918
|
-
this.lat = +lat;
|
|
24919
|
-
if (this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90");
|
|
24920
|
-
}
|
|
24921
|
-
/**
|
|
24922
|
-
* Returns a new `LngLat` object whose longitude is wrapped to the range (-180, 180).
|
|
24923
|
-
*
|
|
24924
|
-
* @returns The wrapped `LngLat` object.
|
|
24925
|
-
* @example
|
|
24926
|
-
* ```ts
|
|
24927
|
-
* let ll = new LngLat(286.0251, 40.7736);
|
|
24928
|
-
* let wrapped = ll.wrap();
|
|
24929
|
-
* wrapped.lng; // = -73.9749
|
|
24930
|
-
* ```
|
|
24931
|
-
*/
|
|
24932
|
-
wrap() {
|
|
24933
|
-
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;
|
|
24934
25076
|
}
|
|
24935
|
-
|
|
24936
|
-
|
|
24937
|
-
*
|
|
24938
|
-
* @returns The coordinates represented as an array of longitude and latitude.
|
|
24939
|
-
* @example
|
|
24940
|
-
* ```ts
|
|
24941
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
24942
|
-
* ll.toArray(); // = [-73.9749, 40.7736]
|
|
24943
|
-
* ```
|
|
24944
|
-
*/
|
|
24945
|
-
toArray() {
|
|
24946
|
-
return [this.lng, this.lat];
|
|
25077
|
+
is3D() {
|
|
25078
|
+
return this.implementation.renderingMode === "3d";
|
|
24947
25079
|
}
|
|
24948
|
-
|
|
24949
|
-
|
|
24950
|
-
*
|
|
24951
|
-
* @returns The coordinates represented as a string of the format `'LngLat(lng, lat)'`.
|
|
24952
|
-
* @example
|
|
24953
|
-
* ```ts
|
|
24954
|
-
* let ll = new LngLat(-73.9749, 40.7736);
|
|
24955
|
-
* ll.toString(); // = "LngLat(-73.9749, 40.7736)"
|
|
24956
|
-
* ```
|
|
24957
|
-
*/
|
|
24958
|
-
toString() {
|
|
24959
|
-
return `LngLat(${this.lng}, ${this.lat})`;
|
|
25080
|
+
hasOffscreenPass() {
|
|
25081
|
+
return this.implementation.prerender !== void 0;
|
|
24960
25082
|
}
|
|
24961
|
-
|
|
24962
|
-
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
* @param lngLat - coordinates to compute the distance to
|
|
24966
|
-
* @returns Distance in meters between the two coordinates.
|
|
24967
|
-
* @example
|
|
24968
|
-
* ```ts
|
|
24969
|
-
* let new_york = new LngLat(-74.0060, 40.7128);
|
|
24970
|
-
* let los_angeles = new LngLat(-118.2437, 34.0522);
|
|
24971
|
-
* new_york.distanceTo(los_angeles); // = 3935751.690893987, "true distance" using a non-spherical approximation is ~3966km
|
|
24972
|
-
* ```
|
|
24973
|
-
*/
|
|
24974
|
-
distanceTo(lngLat) {
|
|
24975
|
-
const rad = Math.PI / 180;
|
|
24976
|
-
const lat1 = this.lat * rad;
|
|
24977
|
-
const lat2 = lngLat.lat * rad;
|
|
24978
|
-
const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
|
|
24979
|
-
return earthRadius * Math.acos(Math.min(a, 1));
|
|
25083
|
+
recalculate() {}
|
|
25084
|
+
updateTransitions() {}
|
|
25085
|
+
hasTransition() {
|
|
25086
|
+
return false;
|
|
24980
25087
|
}
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
* to a `LngLat` object.
|
|
24984
|
-
*
|
|
24985
|
-
* If a `LngLat` object is passed in, the function returns it unchanged.
|
|
24986
|
-
*
|
|
24987
|
-
* @param input - An array of two numbers or object to convert, or a `LngLat` object to return.
|
|
24988
|
-
* @returns A new `LngLat` object, if a conversion occurred, or the original `LngLat` object.
|
|
24989
|
-
* @example
|
|
24990
|
-
* ```ts
|
|
24991
|
-
* let arr = [-73.9749, 40.7736];
|
|
24992
|
-
* let ll = LngLat.convert(arr);
|
|
24993
|
-
* ll; // = LngLat {lng: -73.9749, lat: 40.7736}
|
|
24994
|
-
* ```
|
|
24995
|
-
*/
|
|
24996
|
-
static convert(input) {
|
|
24997
|
-
if (input instanceof LngLat) return input;
|
|
24998
|
-
if (Array.isArray(input) && (input.length === 2 || input.length === 3)) return new LngLat(Number(input[0]), Number(input[1]));
|
|
24999
|
-
if (!Array.isArray(input) && typeof input === "object" && input !== null) return new LngLat(Number("lng" in input ? input.lng : input.lon), Number(input.lat));
|
|
25000
|
-
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");
|
|
25001
25090
|
}
|
|
25002
25091
|
};
|
|
25003
25092
|
//#endregion
|
|
25004
|
-
//#region src/
|
|
25005
|
-
|
|
25006
|
-
|
|
25007
|
-
|
|
25008
|
-
|
|
25009
|
-
|
|
25010
|
-
|
|
25011
|
-
|
|
25012
|
-
|
|
25013
|
-
|
|
25014
|
-
|
|
25015
|
-
|
|
25016
|
-
|
|
25017
|
-
|
|
25018
|
-
|
|
25019
|
-
return x * 360 - 180;
|
|
25020
|
-
}
|
|
25021
|
-
function latFromMercatorY(y) {
|
|
25022
|
-
const y2 = 180 - y * 360;
|
|
25023
|
-
return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
25024
|
-
}
|
|
25025
|
-
function altitudeFromMercatorZ(z, y) {
|
|
25026
|
-
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
|
+
}
|
|
25027
25108
|
}
|
|
25109
|
+
//#endregion
|
|
25110
|
+
//#region src/util/throttled_invoker.ts
|
|
25028
25111
|
/**
|
|
25029
|
-
*
|
|
25030
|
-
*
|
|
25031
|
-
*
|
|
25032
|
-
* At the equator the scale factor will be 1, which increases at higher latitudes.
|
|
25033
|
-
*
|
|
25034
|
-
* @param lat - Latitude
|
|
25035
|
-
* @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.
|
|
25036
25114
|
*/
|
|
25037
|
-
|
|
25038
|
-
|
|
25039
|
-
|
|
25040
|
-
|
|
25041
|
-
|
|
25042
|
-
|
|
25043
|
-
|
|
25044
|
-
|
|
25045
|
-
|
|
25046
|
-
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
|
|
25051
|
-
|
|
25052
|
-
|
|
25053
|
-
|
|
25054
|
-
|
|
25055
|
-
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25059
|
-
|
|
25060
|
-
|
|
25061
|
-
*
|
|
25062
|
-
*
|
|
25063
|
-
*
|
|
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
|
|
25064
25143
|
*/
|
|
25065
|
-
var
|
|
25144
|
+
var Actor = class {
|
|
25066
25145
|
/**
|
|
25067
|
-
* @param
|
|
25068
|
-
* @param
|
|
25069
|
-
* @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.
|
|
25070
25148
|
*/
|
|
25071
|
-
constructor(
|
|
25072
|
-
this.
|
|
25073
|
-
this.
|
|
25074
|
-
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;
|
|
25075
25160
|
}
|
|
25076
|
-
|
|
25077
|
-
|
|
25078
|
-
*
|
|
25079
|
-
* @param lngLatLike - The location to project.
|
|
25080
|
-
* @param altitude - The altitude in meters of the position.
|
|
25081
|
-
* @returns The projected mercator coordinate.
|
|
25082
|
-
* @example
|
|
25083
|
-
* ```ts
|
|
25084
|
-
* let coord = MercatorCoordinate.fromLngLat({ lng: 0, lat: 0}, 0);
|
|
25085
|
-
* coord; // MercatorCoordinate(0.5, 0.5, 0)
|
|
25086
|
-
* ```
|
|
25087
|
-
*/
|
|
25088
|
-
static fromLngLat(lngLatLike, altitude = 0) {
|
|
25089
|
-
const lngLat = LngLat.convert(lngLatLike);
|
|
25090
|
-
return new MercatorCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
|
|
25161
|
+
registerMessageHandler(type, handler) {
|
|
25162
|
+
this.messageHandlers[type] = handler;
|
|
25091
25163
|
}
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
*
|
|
25095
|
-
* @returns The `LngLat` object.
|
|
25096
|
-
* @example
|
|
25097
|
-
* ```ts
|
|
25098
|
-
* let coord = new MercatorCoordinate(0.5, 0.5, 0);
|
|
25099
|
-
* let lngLat = coord.toLngLat(); // LngLat(0, 0)
|
|
25100
|
-
* ```
|
|
25101
|
-
*/
|
|
25102
|
-
toLngLat() {
|
|
25103
|
-
return new LngLat(lngFromMercatorX(this.x), latFromMercatorY(this.y));
|
|
25164
|
+
unregisterMessageHandler(type) {
|
|
25165
|
+
delete this.messageHandlers[type];
|
|
25104
25166
|
}
|
|
25105
25167
|
/**
|
|
25106
|
-
*
|
|
25107
|
-
*
|
|
25108
|
-
* @
|
|
25109
|
-
* @
|
|
25110
|
-
*
|
|
25111
|
-
* let coord = new MercatorCoordinate(0, 0, 0.02);
|
|
25112
|
-
* coord.toAltitude(); // 6914.281956295339
|
|
25113
|
-
* ```
|
|
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
|
|
25114
25173
|
*/
|
|
25115
|
-
|
|
25116
|
-
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
|
+
});
|
|
25117
25210
|
}
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25122
|
-
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
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();
|
|
25128
25287
|
}
|
|
25129
25288
|
};
|
|
25130
25289
|
//#endregion
|
|
@@ -26980,9 +27139,7 @@ function unpackBlock256(inValues, inPos, out, outPos, bitWidth) {
|
|
|
26980
27139
|
case 16:
|
|
26981
27140
|
fastUnpack256_16(inValues, inPos, out, outPos);
|
|
26982
27141
|
break;
|
|
26983
|
-
default:
|
|
26984
|
-
fastUnpack256_Generic(inValues, inPos, out, outPos, bitWidth);
|
|
26985
|
-
break;
|
|
27142
|
+
default: fastUnpack256_Generic(inValues, inPos, out, outPos, bitWidth);
|
|
26986
27143
|
}
|
|
26987
27144
|
return inPos + (bitWidth << 3) | 0;
|
|
26988
27145
|
}
|
|
@@ -27100,9 +27257,7 @@ function decodePageBlocks(inValues, pageStart, inPos, packedEnd, out, outPos, bl
|
|
|
27100
27257
|
for (let i = 0; i < 256; i = i + 1 | 0) out[blockOutPos + i | 0] = inValues[tmpInPos + i | 0] | 0;
|
|
27101
27258
|
tmpInPos = tmpInPos + 256 | 0;
|
|
27102
27259
|
break;
|
|
27103
|
-
default:
|
|
27104
|
-
tmpInPos = unpackBlock256(inValues, tmpInPos, out, blockOutPos, bitWidth);
|
|
27105
|
-
break;
|
|
27260
|
+
default: tmpInPos = unpackBlock256(inValues, tmpInPos, out, blockOutPos, bitWidth);
|
|
27106
27261
|
}
|
|
27107
27262
|
if (exceptionCount > 0) bytePosIn = applyBlockExceptions(out, blockOutPos, bitWidth, exceptionCount, byteContainer, byteContainerLen, bytePosIn, workspace, run);
|
|
27108
27263
|
}
|
|
@@ -27237,7 +27392,6 @@ function fastUnpack32(inValues, inPos, out, outPos, bitWidth) {
|
|
|
27237
27392
|
case 32:
|
|
27238
27393
|
for (let i = 0; i < 32; i = i + 1 | 0) out[outPos + i | 0] = inValues[inPos + i | 0] | 0;
|
|
27239
27394
|
return;
|
|
27240
|
-
default: break;
|
|
27241
27395
|
}
|
|
27242
27396
|
const valueMask = MASKS[bitWidth] >>> 0;
|
|
27243
27397
|
let inputWordIndex = inPos;
|
|
@@ -27938,9 +28092,7 @@ function decodeStreamMetadataInternal(tile, offset) {
|
|
|
27938
28092
|
case PhysicalStreamType.OFFSET:
|
|
27939
28093
|
logicalStreamType = { offsetType: OFFSET_TYPE_BY_ID[stream_type & 15] };
|
|
27940
28094
|
break;
|
|
27941
|
-
case PhysicalStreamType.LENGTH:
|
|
27942
|
-
logicalStreamType = { lengthType: LENGTH_TYPE_BY_ID[stream_type & 15] };
|
|
27943
|
-
break;
|
|
28095
|
+
case PhysicalStreamType.LENGTH: logicalStreamType = { lengthType: LENGTH_TYPE_BY_ID[stream_type & 15] };
|
|
27944
28096
|
}
|
|
27945
28097
|
offset.increment();
|
|
27946
28098
|
const encodings_header = tile[offset.get()];
|
|
@@ -28481,7 +28633,8 @@ function convertGeometryVector(geometryVector) {
|
|
|
28481
28633
|
lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
|
|
28482
28634
|
vertexBufferOffset += numVertices * 2;
|
|
28483
28635
|
} else {
|
|
28484
|
-
|
|
28636
|
+
const vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
|
|
28637
|
+
lineStrings[j] = vertices;
|
|
28485
28638
|
vertexOffsetsOffset += numVertices;
|
|
28486
28639
|
}
|
|
28487
28640
|
}
|
|
@@ -28718,30 +28871,28 @@ var GpuVector = class {
|
|
|
28718
28871
|
if (geometryOffsets) geometryOffsetsCounter++;
|
|
28719
28872
|
}
|
|
28720
28873
|
break;
|
|
28721
|
-
case GEOMETRY_TYPE.MULTIPOLYGON:
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
|
|
28727
|
-
|
|
28728
|
-
|
|
28729
|
-
|
|
28730
|
-
|
|
28731
|
-
|
|
28732
|
-
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
ring.push(new Point(x, y));
|
|
28737
|
-
}
|
|
28738
|
-
if (ring.length > 0) ring.push(ring[0]);
|
|
28739
|
-
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));
|
|
28740
28889
|
}
|
|
28890
|
+
if (ring.length > 0) ring.push(ring[0]);
|
|
28891
|
+
allRings.push(ring);
|
|
28741
28892
|
}
|
|
28742
|
-
geometries[i] = allRings;
|
|
28743
28893
|
}
|
|
28744
|
-
|
|
28894
|
+
geometries[i] = allRings;
|
|
28895
|
+
}
|
|
28745
28896
|
}
|
|
28746
28897
|
return geometries;
|
|
28747
28898
|
}
|
|
@@ -28827,22 +28978,18 @@ function decodeGeometryColumn(tile, numStreams, offset, numFeatures, scalingData
|
|
|
28827
28978
|
case OffsetType.VERTEX:
|
|
28828
28979
|
vertexOffsets = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28829
28980
|
break;
|
|
28830
|
-
case OffsetType.INDEX:
|
|
28831
|
-
indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28832
|
-
break;
|
|
28833
|
-
}
|
|
28834
|
-
break;
|
|
28835
|
-
case PhysicalStreamType.DATA:
|
|
28836
|
-
if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28837
|
-
else {
|
|
28838
|
-
const mortonMetadata = geometryStreamMetadata;
|
|
28839
|
-
mortonSettings = {
|
|
28840
|
-
numBits: mortonMetadata.numBits,
|
|
28841
|
-
coordinateShift: mortonMetadata.coordinateShift
|
|
28842
|
-
};
|
|
28843
|
-
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28981
|
+
case OffsetType.INDEX: indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28844
28982
|
}
|
|
28845
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
|
+
}
|
|
28846
28993
|
}
|
|
28847
28994
|
}
|
|
28848
28995
|
if (indexBuffer) {
|
|
@@ -28890,22 +29037,18 @@ function decodeGeometryColumn(tile, numStreams, offset, numFeatures, scalingData
|
|
|
28890
29037
|
case OffsetType.VERTEX:
|
|
28891
29038
|
vertexOffsets = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28892
29039
|
break;
|
|
28893
|
-
case OffsetType.INDEX:
|
|
28894
|
-
indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28895
|
-
break;
|
|
28896
|
-
}
|
|
28897
|
-
break;
|
|
28898
|
-
case PhysicalStreamType.DATA:
|
|
28899
|
-
if (DictionaryType.VERTEX === geometryStreamMetadata.logicalStreamType.dictionaryType) vertexBuffer = decodeSignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
28900
|
-
else {
|
|
28901
|
-
const mortonMetadata = geometryStreamMetadata;
|
|
28902
|
-
mortonSettings = {
|
|
28903
|
-
numBits: mortonMetadata.numBits,
|
|
28904
|
-
coordinateShift: mortonMetadata.coordinateShift
|
|
28905
|
-
};
|
|
28906
|
-
vertexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata, scalingData);
|
|
29040
|
+
case OffsetType.INDEX: indexBuffer = decodeUnsignedInt32Stream(tile, offset, geometryStreamMetadata);
|
|
28907
29041
|
}
|
|
28908
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
|
+
}
|
|
28909
29052
|
}
|
|
28910
29053
|
}
|
|
28911
29054
|
let geometryOffsets;
|
|
@@ -29297,7 +29440,6 @@ function decodeSharedDictionary(data, offset, column, propertyColumnNames) {
|
|
|
29297
29440
|
dictionaryStreamDecoded = true;
|
|
29298
29441
|
} else symbolTableBuffer = data.subarray(offset.get(), offset.get() + streamMetadata.byteLength);
|
|
29299
29442
|
offset.add(streamMetadata.byteLength);
|
|
29300
|
-
break;
|
|
29301
29443
|
}
|
|
29302
29444
|
}
|
|
29303
29445
|
const childFields = column.complexType.children;
|
|
@@ -30436,8 +30578,8 @@ function getIconQuads(shapedIcon, iconRotate, isSDFIcon, hasIconTextFit) {
|
|
|
30436
30578
|
const quads = [];
|
|
30437
30579
|
const image = shapedIcon.image;
|
|
30438
30580
|
const pixelRatio = image.pixelRatio;
|
|
30439
|
-
const imageWidth = image.paddedRect.w - 2
|
|
30440
|
-
const imageHeight = image.paddedRect.h - 2
|
|
30581
|
+
const imageWidth = image.paddedRect.w - 2;
|
|
30582
|
+
const imageHeight = image.paddedRect.h - 2;
|
|
30441
30583
|
let icon = {
|
|
30442
30584
|
x1: shapedIcon.left,
|
|
30443
30585
|
y1: shapedIcon.top,
|
|
@@ -30905,9 +31047,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30905
31047
|
case "bottom":
|
|
30906
31048
|
y = -radialOffset + baselineOffset;
|
|
30907
31049
|
break;
|
|
30908
|
-
case "top":
|
|
30909
|
-
y = radialOffset - baselineOffset;
|
|
30910
|
-
break;
|
|
31050
|
+
case "top": y = radialOffset - baselineOffset;
|
|
30911
31051
|
}
|
|
30912
31052
|
switch (anchor) {
|
|
30913
31053
|
case "top-right":
|
|
@@ -30921,9 +31061,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30921
31061
|
case "left":
|
|
30922
31062
|
x = radialOffset;
|
|
30923
31063
|
break;
|
|
30924
|
-
case "right":
|
|
30925
|
-
x = -radialOffset;
|
|
30926
|
-
break;
|
|
31064
|
+
case "right": x = -radialOffset;
|
|
30927
31065
|
}
|
|
30928
31066
|
return [x, y];
|
|
30929
31067
|
}
|
|
@@ -30939,9 +31077,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30939
31077
|
break;
|
|
30940
31078
|
case "bottom-right":
|
|
30941
31079
|
case "bottom-left":
|
|
30942
|
-
case "bottom":
|
|
30943
|
-
y = -offsetY + baselineOffset;
|
|
30944
|
-
break;
|
|
31080
|
+
case "bottom": y = -offsetY + baselineOffset;
|
|
30945
31081
|
}
|
|
30946
31082
|
switch (anchor) {
|
|
30947
31083
|
case "top-right":
|
|
@@ -30951,9 +31087,7 @@ function evaluateVariableOffset(anchor, offset) {
|
|
|
30951
31087
|
break;
|
|
30952
31088
|
case "top-left":
|
|
30953
31089
|
case "bottom-left":
|
|
30954
|
-
case "left":
|
|
30955
|
-
x = offsetX;
|
|
30956
|
-
break;
|
|
31090
|
+
case "left": x = offsetX;
|
|
30957
31091
|
}
|
|
30958
31092
|
return [x, y];
|
|
30959
31093
|
}
|
|
@@ -31269,6 +31403,6 @@ function anchorIsTooClose(bucket, text, repeatDistance, anchor) {
|
|
|
31269
31403
|
return false;
|
|
31270
31404
|
}
|
|
31271
31405
|
//#endregion
|
|
31272
|
-
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 };
|
|
31273
31407
|
|
|
31274
31408
|
//# sourceMappingURL=maplibre-gl-shared-dev.mjs.map
|