@mapwhit/tilerenderer 0.52.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/build/min/package.json +2 -1
- package/build/min/src/shaders/_prelude.fragment.glsl.js +2 -2
- package/build/min/src/shaders/_prelude.vertex.glsl.js +2 -2
- package/build/min/src/shaders/background.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background.vertex.glsl.js +1 -1
- package/build/min/src/shaders/background_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
- package/build/min/src/shaders/circle.fragment.glsl.js +2 -2
- package/build/min/src/shaders/circle.vertex.glsl.js +2 -2
- package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
- package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
- package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
- package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
- package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
- package/build/min/src/shaders/fill.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/fill_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap.vertex.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +2 -2
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +2 -2
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
- package/build/min/src/shaders/line.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_gradient.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_pattern.vertex.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/line_sdf.vertex.glsl.js +2 -2
- package/build/min/src/shaders/raster.fragment.glsl.js +2 -2
- package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
- package/build/min/src/shaders/symbol_icon.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_icon.vertex.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +2 -2
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +2 -2
- package/package.json +5 -4
- package/src/data/array_types.js +55 -117
- package/src/data/bucket/circle_attributes.js +2 -4
- package/src/data/bucket/circle_bucket.js +19 -16
- package/src/data/bucket/fill_attributes.js +2 -4
- package/src/data/bucket/fill_bucket.js +38 -27
- package/src/data/bucket/fill_extrusion_attributes.js +2 -4
- package/src/data/bucket/fill_extrusion_bucket.js +56 -37
- package/src/data/bucket/heatmap_bucket.js +2 -11
- package/src/data/bucket/line_attributes.js +2 -4
- package/src/data/bucket/line_bucket.js +208 -163
- package/src/data/bucket/pattern_attributes.js +2 -4
- package/src/data/bucket/pattern_bucket_features.js +7 -9
- package/src/data/bucket/symbol_attributes.js +12 -26
- package/src/data/bucket/symbol_bucket.js +174 -323
- package/src/data/bucket/symbol_buffers.js +62 -0
- package/src/data/bucket/symbol_collision_buffers.js +33 -0
- package/src/data/bucket.js +26 -25
- package/src/data/dem_data.js +11 -10
- package/src/data/extent.js +1 -1
- package/src/data/feature_index.js +38 -28
- package/src/data/index_array_type.js +1 -6
- package/src/data/load_geometry.js +6 -9
- package/src/data/pos_attributes.js +2 -3
- package/src/data/program_configuration.js +47 -38
- package/src/data/raster_bounds_attributes.js +2 -2
- package/src/data/segment.js +4 -7
- package/src/geo/coordinate.js +1 -1
- package/src/geo/lng_lat.js +3 -3
- package/src/geo/lng_lat_bounds.js +8 -4
- package/src/geo/transform.js +69 -30
- package/src/gl/color_mode.js +2 -2
- package/src/gl/context.js +28 -29
- package/src/gl/cull_face_mode.js +1 -1
- package/src/gl/depth_mode.js +1 -1
- package/src/gl/framebuffer.js +8 -4
- package/src/gl/index_buffer.js +2 -2
- package/src/gl/stencil_mode.js +1 -1
- package/src/gl/value.js +33 -68
- package/src/gl/vertex_buffer.js +2 -2
- package/src/index.js +49 -25
- package/src/render/draw_background.js +17 -12
- package/src/render/draw_circle.js +15 -12
- package/src/render/draw_collision_debug.js +11 -8
- package/src/render/draw_debug.js +16 -14
- package/src/render/draw_fill.js +27 -20
- package/src/render/draw_fill_extrusion.js +20 -17
- package/src/render/draw_heatmap.js +21 -16
- package/src/render/draw_hillshade.js +12 -9
- package/src/render/draw_line.js +36 -22
- package/src/render/draw_raster.js +22 -18
- package/src/render/draw_symbol.js +38 -33
- package/src/render/glyph_atlas.js +9 -8
- package/src/render/glyph_manager.js +2 -3
- package/src/render/image_atlas.js +4 -11
- package/src/render/image_manager.js +39 -28
- package/src/render/line_atlas.js +2 -2
- package/src/render/painter.js +78 -61
- package/src/render/program/background_program.js +6 -13
- package/src/render/program/circle_program.js +8 -10
- package/src/render/program/clipping_mask_program.js +3 -5
- package/src/render/program/collision_program.js +4 -6
- package/src/render/program/debug_program.js +3 -5
- package/src/render/program/fill_extrusion_program.js +9 -15
- package/src/render/program/fill_program.js +10 -21
- package/src/render/program/heatmap_program.js +9 -15
- package/src/render/program/hillshade_program.js +16 -22
- package/src/render/program/line_program.js +14 -25
- package/src/render/program/pattern.js +5 -7
- package/src/render/program/program_uniforms.js +13 -20
- package/src/render/program/raster_program.js +9 -11
- package/src/render/program/symbol_program.js +5 -7
- package/src/render/program.js +5 -6
- package/src/render/texture.js +1 -1
- package/src/render/tile_mask.js +6 -4
- package/src/render/uniform_binding.js +9 -20
- package/src/render/vertex_array_object.js +5 -3
- package/src/shaders/encode_attribute.js +2 -6
- package/src/shaders/index.js +103 -51
- package/src/source/geojson_source.js +25 -30
- package/src/source/geojson_worker_source.js +46 -74
- package/src/source/geojson_wrapper.js +13 -5
- package/src/source/image_source.js +17 -28
- package/src/source/load_tilejson.js +3 -3
- package/src/source/pixels_to_tile_units.js +3 -3
- package/src/source/query_features.js +17 -15
- package/src/source/raster_dem_tile_source.js +54 -71
- package/src/source/raster_tile_source.js +14 -15
- package/src/source/resources/glyphs.js +4 -5
- package/src/source/resources/index.js +4 -12
- package/src/source/rtl_text_plugin.js +62 -35
- package/src/source/source.js +14 -22
- package/src/source/source_cache.js +221 -179
- package/src/source/source_state.js +125 -13
- package/src/source/tile.js +67 -66
- package/src/source/tile_bounds.js +36 -29
- package/src/source/tile_cache.js +2 -2
- package/src/source/tile_id.js +30 -26
- package/src/source/vector_tile_source.js +23 -21
- package/src/source/vector_tile_worker_source.js +22 -26
- package/src/source/worker_tile.js +139 -134
- package/src/style/create_style_layer.js +11 -11
- package/src/style/evaluation_parameters.js +4 -6
- package/src/style/light.js +5 -5
- package/src/style/load_sprite.js +6 -6
- package/src/style/parse_glyph_pbf.js +21 -17
- package/src/style/pauseable_placement.js +7 -9
- package/src/style/properties.js +21 -51
- package/src/style/query_utils.js +7 -13
- package/src/style/style.js +314 -221
- package/src/style/style_layer/background_style_layer.js +3 -4
- package/src/style/style_layer/background_style_layer_properties.js +2 -2
- package/src/style/style_layer/circle_style_layer.js +25 -20
- package/src/style/style_layer/circle_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_extrusion_style_layer.js +55 -37
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +2 -2
- package/src/style/style_layer/fill_style_layer.js +11 -12
- package/src/style/style_layer/fill_style_layer_properties.js +2 -2
- package/src/style/style_layer/heatmap_style_layer.js +6 -7
- package/src/style/style_layer/heatmap_style_layer_properties.js +2 -2
- package/src/style/style_layer/hillshade_style_layer.js +4 -5
- package/src/style/style_layer/hillshade_style_layer_properties.js +2 -2
- package/src/style/style_layer/line_style_layer.js +33 -30
- package/src/style/style_layer/line_style_layer_properties.js +5 -5
- package/src/style/style_layer/raster_style_layer.js +3 -4
- package/src/style/style_layer/raster_style_layer_properties.js +2 -2
- package/src/style/style_layer/symbol_style_layer.js +20 -21
- package/src/style/style_layer/symbol_style_layer_properties.js +2 -2
- package/src/style/style_layer.js +66 -47
- package/src/style/style_layer_index.js +17 -42
- package/src/style/zoom_history.js +1 -1
- package/src/style-spec/error/parsing_error.js +1 -1
- package/src/style-spec/error/validation_error.js +5 -3
- package/src/style-spec/feature_filter/convert.js +17 -9
- package/src/style-spec/feature_filter/index.js +13 -9
- package/src/style-spec/util/eval_support.js +2 -2
- package/src/style-spec/util/ref_properties.js +1 -1
- package/src/symbol/anchor.js +2 -6
- package/src/symbol/check_max_angle.js +13 -5
- package/src/symbol/clip_line.js +2 -3
- package/src/symbol/collision_feature.js +8 -4
- package/src/symbol/collision_index.js +5 -7
- package/src/symbol/cross_tile_symbol_index.js +7 -10
- package/src/symbol/get_anchors.js +15 -8
- package/src/symbol/grid_index.js +5 -3
- package/src/symbol/mergelines.js +2 -2
- package/src/symbol/opacity_state.js +1 -5
- package/src/symbol/placement.js +28 -23
- package/src/symbol/projection.js +29 -28
- package/src/symbol/quads.js +14 -16
- package/src/symbol/shaping.js +27 -19
- package/src/symbol/symbol_layout.js +24 -28
- package/src/symbol/symbol_size.js +13 -12
- package/src/symbol/transform_text.js +4 -4
- package/src/ui/camera.js +34 -18
- package/src/ui/map.js +102 -44
- package/src/util/async.js +11 -5
- package/src/util/browser.js +1 -1
- package/src/util/callback.js +3 -9
- package/src/util/classify_rings.js +13 -8
- package/src/util/color_ramp.js +3 -3
- package/src/util/config.js +4 -4
- package/src/util/dictionary_coder.js +2 -3
- package/src/util/dom.js +7 -3
- package/src/util/find_pole_of_inaccessibility.js +29 -14
- package/src/util/group_layers.js +41 -0
- package/src/util/image.js +3 -13
- package/src/util/interpolate.js +1 -1
- package/src/util/intersection_tests.js +80 -42
- package/src/util/is_char_in_unicode_block.js +1 -1
- package/src/util/key.js +25 -0
- package/src/util/loader/image.js +1 -1
- package/src/util/object.js +33 -76
- package/src/util/script_detection.js +212 -91
- package/src/util/struct_array.js +8 -40
- package/src/util/task_queue.js +11 -7
- package/src/util/throttle.js +2 -2
- package/src/util/tile_cover.js +8 -5
- package/src/util/token.js +1 -1
- package/src/util/unique_id.js +2 -2
- package/src/util/util.js +21 -29
- package/src/util/vectortile_to_geojson.js +4 -2
- package/src/util/verticalize_punctuation.js +3 -7
- package/src/util/warn.js +4 -4
- package/src/util/web_worker.js +3 -3
- package/src/worker.js +1 -4
- package/src/source/resources/images.js +0 -68
- package/src/source/worker.js +0 -110
- package/src/source/worker_source.js +0 -14
- package/src/style-spec/deref.js +0 -51
- package/src/style-spec/group_by_layout.js +0 -46
- package/src/util/actor.js +0 -108
- package/src/util/dispatcher.js +0 -65
- package/src/util/global_worker_pool.js +0 -15
- package/src/util/transfer_registry.js +0 -168
- package/src/util/web_worker_transfer.js +0 -43
- package/src/util/worker_pool.js +0 -41
package/src/shaders/index.js
CHANGED
|
@@ -1,103 +1,155 @@
|
|
|
1
|
+
// Import all shader sources
|
|
2
|
+
import preludeFragmentSource from '../../build/min/src/shaders/_prelude.fragment.glsl.js';
|
|
3
|
+
import preludeVertexSource from '../../build/min/src/shaders/_prelude.vertex.glsl.js';
|
|
4
|
+
import backgroundFragmentSource from '../../build/min/src/shaders/background.fragment.glsl.js';
|
|
5
|
+
import backgroundVertexSource from '../../build/min/src/shaders/background.vertex.glsl.js';
|
|
6
|
+
import backgroundPatternFragmentSource from '../../build/min/src/shaders/background_pattern.fragment.glsl.js';
|
|
7
|
+
import backgroundPatternVertexSource from '../../build/min/src/shaders/background_pattern.vertex.glsl.js';
|
|
8
|
+
import circleFragmentSource from '../../build/min/src/shaders/circle.fragment.glsl.js';
|
|
9
|
+
import circleVertexSource from '../../build/min/src/shaders/circle.vertex.glsl.js';
|
|
10
|
+
import clippingMaskFragmentSource from '../../build/min/src/shaders/clipping_mask.fragment.glsl.js';
|
|
11
|
+
import clippingMaskVertexSource from '../../build/min/src/shaders/clipping_mask.vertex.glsl.js';
|
|
12
|
+
import collisionBoxFragmentSource from '../../build/min/src/shaders/collision_box.fragment.glsl.js';
|
|
13
|
+
import collisionBoxVertexSource from '../../build/min/src/shaders/collision_box.vertex.glsl.js';
|
|
14
|
+
import collisionCircleFragmentSource from '../../build/min/src/shaders/collision_circle.fragment.glsl.js';
|
|
15
|
+
import collisionCircleVertexSource from '../../build/min/src/shaders/collision_circle.vertex.glsl.js';
|
|
16
|
+
import debugFragmentSource from '../../build/min/src/shaders/debug.fragment.glsl.js';
|
|
17
|
+
import debugVertexSource from '../../build/min/src/shaders/debug.vertex.glsl.js';
|
|
18
|
+
import fillFragmentSource from '../../build/min/src/shaders/fill.fragment.glsl.js';
|
|
19
|
+
import fillVertexSource from '../../build/min/src/shaders/fill.vertex.glsl.js';
|
|
20
|
+
import fillExtrusionFragmentSource from '../../build/min/src/shaders/fill_extrusion.fragment.glsl.js';
|
|
21
|
+
import fillExtrusionVertexSource from '../../build/min/src/shaders/fill_extrusion.vertex.glsl.js';
|
|
22
|
+
import fillExtrusionPatternFragmentSource from '../../build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js';
|
|
23
|
+
import fillExtrusionPatternVertexSource from '../../build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js';
|
|
24
|
+
import fillOutlineFragmentSource from '../../build/min/src/shaders/fill_outline.fragment.glsl.js';
|
|
25
|
+
import fillOutlineVertexSource from '../../build/min/src/shaders/fill_outline.vertex.glsl.js';
|
|
26
|
+
import fillOutlinePatternFragmentSource from '../../build/min/src/shaders/fill_outline_pattern.fragment.glsl.js';
|
|
27
|
+
import fillOutlinePatternVertexSource from '../../build/min/src/shaders/fill_outline_pattern.vertex.glsl.js';
|
|
28
|
+
import fillPatternFragmentSource from '../../build/min/src/shaders/fill_pattern.fragment.glsl.js';
|
|
29
|
+
import fillPatternVertexSource from '../../build/min/src/shaders/fill_pattern.vertex.glsl.js';
|
|
30
|
+
import heatmapFragmentSource from '../../build/min/src/shaders/heatmap.fragment.glsl.js';
|
|
31
|
+
import heatmapVertexSource from '../../build/min/src/shaders/heatmap.vertex.glsl.js';
|
|
32
|
+
import heatmapTextureFragmentSource from '../../build/min/src/shaders/heatmap_texture.fragment.glsl.js';
|
|
33
|
+
import heatmapTextureVertexSource from '../../build/min/src/shaders/heatmap_texture.vertex.glsl.js';
|
|
34
|
+
import hillshadeFragmentSource from '../../build/min/src/shaders/hillshade.fragment.glsl.js';
|
|
35
|
+
import hillshadeVertexSource from '../../build/min/src/shaders/hillshade.vertex.glsl.js';
|
|
36
|
+
import hillshadePrepareFragmentSource from '../../build/min/src/shaders/hillshade_prepare.fragment.glsl.js';
|
|
37
|
+
import hillshadePrepareVertexSource from '../../build/min/src/shaders/hillshade_prepare.vertex.glsl.js';
|
|
38
|
+
import lineFragmentSource from '../../build/min/src/shaders/line.fragment.glsl.js';
|
|
39
|
+
import lineVertexSource from '../../build/min/src/shaders/line.vertex.glsl.js';
|
|
40
|
+
import lineGradientFragmentSource from '../../build/min/src/shaders/line_gradient.fragment.glsl.js';
|
|
41
|
+
import lineGradientVertexSource from '../../build/min/src/shaders/line_gradient.vertex.glsl.js';
|
|
42
|
+
import linePatternFragmentSource from '../../build/min/src/shaders/line_pattern.fragment.glsl.js';
|
|
43
|
+
import linePatternVertexSource from '../../build/min/src/shaders/line_pattern.vertex.glsl.js';
|
|
44
|
+
import lineSDFFragmentSource from '../../build/min/src/shaders/line_sdf.fragment.glsl.js';
|
|
45
|
+
import lineSDFVertexSource from '../../build/min/src/shaders/line_sdf.vertex.glsl.js';
|
|
46
|
+
import rasterFragmentSource from '../../build/min/src/shaders/raster.fragment.glsl.js';
|
|
47
|
+
import rasterVertexSource from '../../build/min/src/shaders/raster.vertex.glsl.js';
|
|
48
|
+
import symbolIconFragmentSource from '../../build/min/src/shaders/symbol_icon.fragment.glsl.js';
|
|
49
|
+
import symbolIconVertexSource from '../../build/min/src/shaders/symbol_icon.vertex.glsl.js';
|
|
50
|
+
import symbolSDFFragmentSource from '../../build/min/src/shaders/symbol_sdf.fragment.glsl.js';
|
|
51
|
+
import symbolSDFVertexSource from '../../build/min/src/shaders/symbol_sdf.vertex.glsl.js';
|
|
52
|
+
|
|
1
53
|
const shaders = {
|
|
2
54
|
prelude: {
|
|
3
|
-
fragmentSource:
|
|
4
|
-
vertexSource:
|
|
55
|
+
fragmentSource: preludeFragmentSource,
|
|
56
|
+
vertexSource: preludeVertexSource
|
|
5
57
|
},
|
|
6
58
|
background: {
|
|
7
|
-
fragmentSource:
|
|
8
|
-
vertexSource:
|
|
59
|
+
fragmentSource: backgroundFragmentSource,
|
|
60
|
+
vertexSource: backgroundVertexSource
|
|
9
61
|
},
|
|
10
62
|
backgroundPattern: {
|
|
11
|
-
fragmentSource:
|
|
12
|
-
vertexSource:
|
|
63
|
+
fragmentSource: backgroundPatternFragmentSource,
|
|
64
|
+
vertexSource: backgroundPatternVertexSource
|
|
13
65
|
},
|
|
14
66
|
circle: {
|
|
15
|
-
fragmentSource:
|
|
16
|
-
vertexSource:
|
|
67
|
+
fragmentSource: circleFragmentSource,
|
|
68
|
+
vertexSource: circleVertexSource
|
|
17
69
|
},
|
|
18
70
|
clippingMask: {
|
|
19
|
-
fragmentSource:
|
|
20
|
-
vertexSource:
|
|
71
|
+
fragmentSource: clippingMaskFragmentSource,
|
|
72
|
+
vertexSource: clippingMaskVertexSource
|
|
21
73
|
},
|
|
22
74
|
heatmap: {
|
|
23
|
-
fragmentSource:
|
|
24
|
-
vertexSource:
|
|
75
|
+
fragmentSource: heatmapFragmentSource,
|
|
76
|
+
vertexSource: heatmapVertexSource
|
|
25
77
|
},
|
|
26
78
|
heatmapTexture: {
|
|
27
|
-
fragmentSource:
|
|
28
|
-
vertexSource:
|
|
79
|
+
fragmentSource: heatmapTextureFragmentSource,
|
|
80
|
+
vertexSource: heatmapTextureVertexSource
|
|
29
81
|
},
|
|
30
82
|
collisionBox: {
|
|
31
|
-
fragmentSource:
|
|
32
|
-
vertexSource:
|
|
83
|
+
fragmentSource: collisionBoxFragmentSource,
|
|
84
|
+
vertexSource: collisionBoxVertexSource
|
|
33
85
|
},
|
|
34
86
|
collisionCircle: {
|
|
35
|
-
fragmentSource:
|
|
36
|
-
vertexSource:
|
|
87
|
+
fragmentSource: collisionCircleFragmentSource,
|
|
88
|
+
vertexSource: collisionCircleVertexSource
|
|
37
89
|
},
|
|
38
90
|
debug: {
|
|
39
|
-
fragmentSource:
|
|
40
|
-
vertexSource:
|
|
91
|
+
fragmentSource: debugFragmentSource,
|
|
92
|
+
vertexSource: debugVertexSource
|
|
41
93
|
},
|
|
42
94
|
fill: {
|
|
43
|
-
fragmentSource:
|
|
44
|
-
vertexSource:
|
|
95
|
+
fragmentSource: fillFragmentSource,
|
|
96
|
+
vertexSource: fillVertexSource
|
|
45
97
|
},
|
|
46
98
|
fillOutline: {
|
|
47
|
-
fragmentSource:
|
|
48
|
-
vertexSource:
|
|
99
|
+
fragmentSource: fillOutlineFragmentSource,
|
|
100
|
+
vertexSource: fillOutlineVertexSource
|
|
49
101
|
},
|
|
50
102
|
fillOutlinePattern: {
|
|
51
|
-
fragmentSource:
|
|
52
|
-
vertexSource:
|
|
103
|
+
fragmentSource: fillOutlinePatternFragmentSource,
|
|
104
|
+
vertexSource: fillOutlinePatternVertexSource
|
|
53
105
|
},
|
|
54
106
|
fillPattern: {
|
|
55
|
-
fragmentSource:
|
|
56
|
-
vertexSource:
|
|
107
|
+
fragmentSource: fillPatternFragmentSource,
|
|
108
|
+
vertexSource: fillPatternVertexSource
|
|
57
109
|
},
|
|
58
110
|
fillExtrusion: {
|
|
59
|
-
fragmentSource:
|
|
60
|
-
vertexSource:
|
|
111
|
+
fragmentSource: fillExtrusionFragmentSource,
|
|
112
|
+
vertexSource: fillExtrusionVertexSource
|
|
61
113
|
},
|
|
62
114
|
fillExtrusionPattern: {
|
|
63
|
-
fragmentSource:
|
|
64
|
-
vertexSource:
|
|
115
|
+
fragmentSource: fillExtrusionPatternFragmentSource,
|
|
116
|
+
vertexSource: fillExtrusionPatternVertexSource
|
|
65
117
|
},
|
|
66
118
|
hillshadePrepare: {
|
|
67
|
-
fragmentSource:
|
|
68
|
-
vertexSource:
|
|
119
|
+
fragmentSource: hillshadePrepareFragmentSource,
|
|
120
|
+
vertexSource: hillshadePrepareVertexSource
|
|
69
121
|
},
|
|
70
122
|
hillshade: {
|
|
71
|
-
fragmentSource:
|
|
72
|
-
vertexSource:
|
|
123
|
+
fragmentSource: hillshadeFragmentSource,
|
|
124
|
+
vertexSource: hillshadeVertexSource
|
|
73
125
|
},
|
|
74
126
|
line: {
|
|
75
|
-
fragmentSource:
|
|
76
|
-
vertexSource:
|
|
127
|
+
fragmentSource: lineFragmentSource,
|
|
128
|
+
vertexSource: lineVertexSource
|
|
77
129
|
},
|
|
78
130
|
lineGradient: {
|
|
79
|
-
fragmentSource:
|
|
80
|
-
vertexSource:
|
|
131
|
+
fragmentSource: lineGradientFragmentSource,
|
|
132
|
+
vertexSource: lineGradientVertexSource
|
|
81
133
|
},
|
|
82
134
|
linePattern: {
|
|
83
|
-
fragmentSource:
|
|
84
|
-
vertexSource:
|
|
135
|
+
fragmentSource: linePatternFragmentSource,
|
|
136
|
+
vertexSource: linePatternVertexSource
|
|
85
137
|
},
|
|
86
138
|
lineSDF: {
|
|
87
|
-
fragmentSource:
|
|
88
|
-
vertexSource:
|
|
139
|
+
fragmentSource: lineSDFFragmentSource,
|
|
140
|
+
vertexSource: lineSDFVertexSource
|
|
89
141
|
},
|
|
90
142
|
raster: {
|
|
91
|
-
fragmentSource:
|
|
92
|
-
vertexSource:
|
|
143
|
+
fragmentSource: rasterFragmentSource,
|
|
144
|
+
vertexSource: rasterVertexSource
|
|
93
145
|
},
|
|
94
146
|
symbolIcon: {
|
|
95
|
-
fragmentSource:
|
|
96
|
-
vertexSource:
|
|
147
|
+
fragmentSource: symbolIconFragmentSource,
|
|
148
|
+
vertexSource: symbolIconVertexSource
|
|
97
149
|
},
|
|
98
150
|
symbolSDF: {
|
|
99
|
-
fragmentSource:
|
|
100
|
-
vertexSource:
|
|
151
|
+
fragmentSource: symbolSDFFragmentSource,
|
|
152
|
+
vertexSource: symbolSDFVertexSource
|
|
101
153
|
}
|
|
102
154
|
};
|
|
103
155
|
|
|
@@ -191,4 +243,4 @@ ${precision} ${type} ${name} = u_${name};
|
|
|
191
243
|
});
|
|
192
244
|
}
|
|
193
245
|
|
|
194
|
-
|
|
246
|
+
export default shaders;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ErrorEvent, Event, Evented } from '@mapwhit/events';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
|
+
import browser from '../util/browser.js';
|
|
5
|
+
import GeoJSONWorkerSource from './geojson_worker_source.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A source containing GeoJSON.
|
|
@@ -52,8 +53,9 @@ class GeoJSONSource extends Evented {
|
|
|
52
53
|
#pendingDataEvents = new Set();
|
|
53
54
|
#newData = false;
|
|
54
55
|
#updateInProgress = false;
|
|
56
|
+
#worker;
|
|
55
57
|
|
|
56
|
-
constructor(id, options,
|
|
58
|
+
constructor(id, options, eventedParent, { resources, layerIndex }) {
|
|
57
59
|
super();
|
|
58
60
|
|
|
59
61
|
this.id = id;
|
|
@@ -69,14 +71,17 @@ class GeoJSONSource extends Evented {
|
|
|
69
71
|
this.reparseOverscaled = true;
|
|
70
72
|
this._removed = false;
|
|
71
73
|
|
|
72
|
-
this.dispatcher = dispatcher;
|
|
73
74
|
this.setEventedParent(eventedParent);
|
|
74
75
|
|
|
75
|
-
this.
|
|
76
|
+
this.data = options.data;
|
|
76
77
|
this._options = Object.assign({}, options);
|
|
77
78
|
|
|
78
|
-
if (options.maxzoom !== undefined)
|
|
79
|
-
|
|
79
|
+
if (options.maxzoom !== undefined) {
|
|
80
|
+
this.maxzoom = options.maxzoom;
|
|
81
|
+
}
|
|
82
|
+
if (options.type) {
|
|
83
|
+
this.type = options.type;
|
|
84
|
+
}
|
|
80
85
|
|
|
81
86
|
const scale = EXTENT / this.tileSize;
|
|
82
87
|
|
|
@@ -107,6 +112,7 @@ class GeoJSONSource extends Evented {
|
|
|
107
112
|
},
|
|
108
113
|
options.workerOptions
|
|
109
114
|
);
|
|
115
|
+
this.#worker = new GeoJSONWorkerSource(resources, layerIndex);
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
load() {
|
|
@@ -125,7 +131,7 @@ class GeoJSONSource extends Evented {
|
|
|
125
131
|
* @returns {GeoJSONSource} this
|
|
126
132
|
*/
|
|
127
133
|
setData(data) {
|
|
128
|
-
this.
|
|
134
|
+
this.data = data;
|
|
129
135
|
this.#updateData();
|
|
130
136
|
return this;
|
|
131
137
|
}
|
|
@@ -142,7 +148,7 @@ class GeoJSONSource extends Evented {
|
|
|
142
148
|
this.fire(new Event('dataloading', { dataType: 'source' }));
|
|
143
149
|
while (this.#newData) {
|
|
144
150
|
this.#newData = false;
|
|
145
|
-
await this._updateWorkerData(this.
|
|
151
|
+
await this._updateWorkerData(this.data);
|
|
146
152
|
}
|
|
147
153
|
this.#pendingDataEvents.forEach(sourceDataType =>
|
|
148
154
|
this.fire(new Event('data', { dataType: 'source', sourceDataType }))
|
|
@@ -165,13 +171,9 @@ class GeoJSONSource extends Evented {
|
|
|
165
171
|
if (!json) {
|
|
166
172
|
throw new Error('no GeoJSON data');
|
|
167
173
|
}
|
|
168
|
-
const options = { ...this.workerOptions, data:
|
|
169
|
-
this.workerID ??= this.dispatcher.nextWorkerId();
|
|
174
|
+
const options = { ...this.workerOptions, data: json };
|
|
170
175
|
|
|
171
|
-
|
|
172
|
-
// so that other geojson-like source types can easily reuse this
|
|
173
|
-
// implementation
|
|
174
|
-
await this.dispatcher.send(`${this.type}.loadData`, options, this.workerID);
|
|
176
|
+
return await this.#worker.loadData(options);
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
async loadTile(tile) {
|
|
@@ -185,14 +187,15 @@ class GeoJSONSource extends Evented {
|
|
|
185
187
|
source: this.id,
|
|
186
188
|
pixelRatio: browser.devicePixelRatio,
|
|
187
189
|
showCollisionBoxes: this.map.showCollisionBoxes,
|
|
188
|
-
globalState: this.map.getGlobalState()
|
|
190
|
+
globalState: this.map.getGlobalState(),
|
|
191
|
+
justReloaded: tile.workerID != null,
|
|
192
|
+
painter: this.map.painter
|
|
189
193
|
};
|
|
190
194
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const data = await this.dispatcher.send('loadTile', params, tile.workerID).finally(() => tile.unloadVectorData());
|
|
195
|
+
tile.workerID ??= true;
|
|
196
|
+
const data = await this.#worker.loadTile(params).finally(() => tile.unloadVectorData());
|
|
194
197
|
if (!tile.aborted) {
|
|
195
|
-
tile.loadVectorData(data, this.map.painter
|
|
198
|
+
tile.loadVectorData(data, this.map.painter);
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
|
|
@@ -206,14 +209,6 @@ class GeoJSONSource extends Evented {
|
|
|
206
209
|
|
|
207
210
|
onRemove() {
|
|
208
211
|
this._removed = true;
|
|
209
|
-
return this.dispatcher.send('removeSource', { type: this.type, source: this.id }, this.workerID);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
serialize() {
|
|
213
|
-
return Object.assign({}, this._options, {
|
|
214
|
-
type: this.type,
|
|
215
|
-
data: this._data
|
|
216
|
-
});
|
|
217
212
|
}
|
|
218
213
|
|
|
219
214
|
hasTransition() {
|
|
@@ -221,4 +216,4 @@ class GeoJSONSource extends Evented {
|
|
|
221
216
|
}
|
|
222
217
|
}
|
|
223
218
|
|
|
224
|
-
|
|
219
|
+
export default GeoJSONSource;
|
|
@@ -1,68 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const VectorTileWorkerSource = require('./vector_tile_worker_source');
|
|
7
|
-
|
|
8
|
-
function loadGeoJSONTile(params) {
|
|
9
|
-
if (!this._geoJSONIndex) {
|
|
10
|
-
if (!this._createGeoJSONIndex) {
|
|
11
|
-
return; // we couldn't load the file
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
this._geoJSONIndex = this._createGeoJSONIndex();
|
|
16
|
-
} finally {
|
|
17
|
-
this._createGeoJSONIndex = null;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const { z, x, y } = params.tileID.canonical;
|
|
22
|
-
const geoJSONTile = this._geoJSONIndex.getTile(z, x, y);
|
|
23
|
-
if (!geoJSONTile) {
|
|
24
|
-
return; // nothing in the given tile
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features);
|
|
28
|
-
|
|
29
|
-
// Encode the geojson-vt tile into binary vector tile form. This
|
|
30
|
-
// is a convenience that allows `FeatureIndex` to operate the same way
|
|
31
|
-
// across `VectorTileSource` and `GeoJSONSource` data.
|
|
32
|
-
let pbf = fromVectorTileJs(geojsonWrapper);
|
|
33
|
-
if (pbf.byteOffset !== 0 || pbf.byteLength !== pbf.buffer.byteLength) {
|
|
34
|
-
// Compatibility with node Buffer (https://github.com/mapbox/pbf/issues/35)
|
|
35
|
-
pbf = new Uint8Array(pbf);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
vectorTile: geojsonWrapper,
|
|
40
|
-
rawData: pbf.buffer
|
|
41
|
-
};
|
|
42
|
-
}
|
|
1
|
+
import rewind from '@mapwhit/geojson-rewind';
|
|
2
|
+
import geojsonvt from 'geojson-vt';
|
|
3
|
+
import Supercluster from 'supercluster';
|
|
4
|
+
import GeoJSONWrapper from './geojson_wrapper.js';
|
|
5
|
+
import VectorTileWorkerSource from './vector_tile_worker_source.js';
|
|
43
6
|
|
|
44
7
|
/**
|
|
45
8
|
* The {@link WorkerSource} implementation that supports {@link GeoJSONSource}.
|
|
46
|
-
* This class is designed to be easily reused to support custom source types
|
|
47
|
-
* for data formats that can be parsed/converted into an in-memory GeoJSON
|
|
48
|
-
* representation. To do so, create it with
|
|
49
|
-
* `new GeoJSONWorkerSource(resources, layerIndex, customLoadGeoJSONFunction)`.
|
|
50
|
-
* For a full example, see [mapbox-gl-topojson](https://github.com/developmentseed/mapbox-gl-topojson).
|
|
51
9
|
*
|
|
52
10
|
*/
|
|
53
11
|
class GeoJSONWorkerSource extends VectorTileWorkerSource {
|
|
54
|
-
/**
|
|
55
|
-
* @param [loadGeoJSON] Optional method for custom loading/parsing of
|
|
56
|
-
* GeoJSON based on parameters passed from the main-thread Source.
|
|
57
|
-
* See {@link GeoJSONWorkerSource#loadGeoJSON}.
|
|
58
|
-
*/
|
|
59
|
-
constructor(resources, layerIndex, loadGeoJSON) {
|
|
60
|
-
super(resources, layerIndex, loadGeoJSONTile);
|
|
61
|
-
if (loadGeoJSON) {
|
|
62
|
-
this.loadGeoJSON = loadGeoJSON;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
12
|
/**
|
|
67
13
|
* Fetches (if appropriate), parses, and index geojson data into tiles. This
|
|
68
14
|
* preparatory method must be called before {@link GeoJSONWorkerSource#loadTile}
|
|
@@ -76,7 +22,7 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
|
|
|
76
22
|
* @param callback
|
|
77
23
|
*/
|
|
78
24
|
loadData(params) {
|
|
79
|
-
const data =
|
|
25
|
+
const data = loadJSON(params.data);
|
|
80
26
|
this._geoJSONIndex = null;
|
|
81
27
|
this._createGeoJSONIndex = params.cluster
|
|
82
28
|
? () => {
|
|
@@ -89,21 +35,47 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource {
|
|
|
89
35
|
};
|
|
90
36
|
}
|
|
91
37
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
38
|
+
getTile(tileID) {
|
|
39
|
+
if (!this._geoJSONIndex) {
|
|
40
|
+
if (!this._createGeoJSONIndex) {
|
|
41
|
+
return; // we couldn't load the file
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
this._geoJSONIndex = this._createGeoJSONIndex();
|
|
46
|
+
} finally {
|
|
47
|
+
this._createGeoJSONIndex = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const { z, x, y } = tileID.canonical;
|
|
51
|
+
return this._geoJSONIndex.getTile(z, x, y);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
loadVectorData({ tileID }) {
|
|
55
|
+
const geoJSONTile = this.getTile(tileID);
|
|
56
|
+
if (!geoJSONTile) {
|
|
57
|
+
return; // nothing in the given tile
|
|
105
58
|
}
|
|
59
|
+
|
|
60
|
+
const vectorTile = new GeoJSONWrapper(geoJSONTile.features);
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
vectorTile
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Fetch and parse GeoJSON according to the given params.
|
|
70
|
+
*
|
|
71
|
+
* @param data Literal GeoJSON data. Must be provided.
|
|
72
|
+
*/
|
|
73
|
+
function loadJSON(data) {
|
|
74
|
+
try {
|
|
75
|
+
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
76
|
+
} catch {
|
|
77
|
+
throw new Error('Input data is not a valid GeoJSON object.');
|
|
106
78
|
}
|
|
107
79
|
}
|
|
108
80
|
|
|
109
|
-
|
|
81
|
+
export default GeoJSONWorkerSource;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Point from '@mapbox/point-geometry';
|
|
2
|
+
import { VectorTileFeature } from '@mapwhit/vector-tile';
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
4
|
|
|
5
5
|
const { toGeoJSON } = VectorTileFeature.prototype;
|
|
6
6
|
|
|
@@ -20,6 +20,14 @@ class FeatureWrapper {
|
|
|
20
20
|
if ('id' in feature && !isNaN(feature.id)) {
|
|
21
21
|
this.id = Number.parseInt(feature.id, 10);
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
// fix geometry - it has to be at least array of 2 points
|
|
25
|
+
if (typeof this._feature.geometry[0] === 'number') {
|
|
26
|
+
this._feature.geometry = [this._feature.geometry];
|
|
27
|
+
if (this._feature.geometry.length === 1) {
|
|
28
|
+
this._feature.geometry.push(this._feature.geometry[0]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
get type() {
|
|
@@ -27,7 +35,7 @@ class FeatureWrapper {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
get properties() {
|
|
30
|
-
return this._feature.tags;
|
|
38
|
+
return this._feature.tags ?? {};
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
get extent() {
|
|
@@ -68,7 +76,7 @@ class GeoJSONWrapper {
|
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
|
|
71
|
-
|
|
79
|
+
export default GeoJSONWrapper;
|
|
72
80
|
|
|
73
81
|
function makePoint(arr) {
|
|
74
82
|
return new Point(arr[0], arr[1]);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const SegmentVector = require('../data/segment');
|
|
12
|
-
const Texture = require('../render/texture');
|
|
1
|
+
import { ErrorEvent, Event, Evented } from '@mapwhit/events';
|
|
2
|
+
import { RasterBoundsArray } from '../data/array_types.js';
|
|
3
|
+
import EXTENT from '../data/extent.js';
|
|
4
|
+
import rasterBoundsAttributes from '../data/raster_bounds_attributes.js';
|
|
5
|
+
import SegmentVector from '../data/segment.js';
|
|
6
|
+
import LngLat from '../geo/lng_lat.js';
|
|
7
|
+
import Texture from '../render/texture.js';
|
|
8
|
+
import loadImage from '../util/loader/image.js';
|
|
9
|
+
import { getCoordinatesCenter } from '../util/util.js';
|
|
10
|
+
import { CanonicalTileID } from './tile_id.js';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* A data source containing an image.
|
|
@@ -44,10 +42,9 @@ class ImageSource extends Evented {
|
|
|
44
42
|
/**
|
|
45
43
|
* @private
|
|
46
44
|
*/
|
|
47
|
-
constructor(id, options,
|
|
45
|
+
constructor(id, options, eventedParent) {
|
|
48
46
|
super();
|
|
49
47
|
this.id = id;
|
|
50
|
-
this.dispatcher = dispatcher;
|
|
51
48
|
this.coordinates = options.coordinates;
|
|
52
49
|
|
|
53
50
|
this.type = 'image';
|
|
@@ -125,10 +122,10 @@ class ImageSource extends Evented {
|
|
|
125
122
|
// tile.
|
|
126
123
|
const tileCoords = cornerZ0Coords.map(coord => {
|
|
127
124
|
const zoomedCoord = coord.zoomTo(centerCoord.zoom);
|
|
128
|
-
return
|
|
129
|
-
Math.round((zoomedCoord.column - centerCoord.column) * EXTENT),
|
|
130
|
-
Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)
|
|
131
|
-
|
|
125
|
+
return {
|
|
126
|
+
x: Math.round((zoomedCoord.column - centerCoord.column) * EXTENT),
|
|
127
|
+
y: Math.round((zoomedCoord.row - centerCoord.row) * EXTENT)
|
|
128
|
+
};
|
|
132
129
|
});
|
|
133
130
|
|
|
134
131
|
this._boundsArray = new RasterBoundsArray();
|
|
@@ -185,24 +182,16 @@ class ImageSource extends Evented {
|
|
|
185
182
|
// single tile.
|
|
186
183
|
if (this.tileID?.equals(tile.tileID.canonical)) {
|
|
187
184
|
this.tiles[String(tile.tileID.wrap)] = tile;
|
|
188
|
-
tile.buckets =
|
|
185
|
+
tile.buckets = new Map();
|
|
189
186
|
} else {
|
|
190
187
|
tile.state = 'errored';
|
|
191
188
|
}
|
|
192
189
|
return Promise.resolve();
|
|
193
190
|
}
|
|
194
191
|
|
|
195
|
-
serialize() {
|
|
196
|
-
return {
|
|
197
|
-
type: 'image',
|
|
198
|
-
url: this.options.url,
|
|
199
|
-
coordinates: this.coordinates
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
192
|
hasTransition() {
|
|
204
193
|
return false;
|
|
205
194
|
}
|
|
206
195
|
}
|
|
207
196
|
|
|
208
|
-
|
|
197
|
+
export default ImageSource;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { pick } from '../util/object.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function (tileJSON) {
|
|
4
4
|
return tileJSON.resourceSets ? fromResourseSets(tileJSON) : fromTileJSON(tileJSON);
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
7
|
function fromTileJSON(tileJSON) {
|
|
8
8
|
const result = pick(tileJSON, ['tiles', 'minzoom', 'maxzoom', 'attribution', 'bounds']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import EXTENT from '../data/extent.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts a pixel value at a the given zoom level to tile units.
|
|
@@ -12,6 +12,6 @@ const EXTENT = require('../data/extent');
|
|
|
12
12
|
* @returns value in tile units
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
export default function (tile, pixelValue, z) {
|
|
16
16
|
return pixelValue * (EXTENT / (tile.tileSize * 2 ** (z - tile.tileID.overscaledZ)));
|
|
17
|
-
}
|
|
17
|
+
}
|