@mapgis/mapbox-gl 16.0.1 → 16.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/dist/mapbox-gl.js +3 -3
- package/dist/mapbox-gl.js.map +1 -1
- package/package.json +1 -1
- package/.flowconfig +0 -61
- package/LICENSE.txt +0 -84
- package/README.md +0 -34
- package/build/banner.js +0 -4
- package/build/check-bundle-size.js +0 -140
- package/build/generate-access-token-script.js +0 -11
- package/build/generate-flow-typed-style-spec.js +0 -188
- package/build/generate-release-list.js +0 -21
- package/build/generate-struct-arrays.js +0 -237
- package/build/generate-style-code.js +0 -159
- package/build/mapbox-gl.js.flow +0 -3
- package/build/print-release-url.js +0 -6
- package/build/rollup_plugin_minify_style_spec.js +0 -20
- package/build/rollup_plugins.js +0 -80
- package/build/run-node +0 -3
- package/build/run-tap +0 -8
- package/build/test/build-tape.js +0 -19
- package/flow-typed/gl.js +0 -5
- package/flow-typed/jsdom.js +0 -18
- package/flow-typed/mapbox-gl-supported.js +0 -9
- package/flow-typed/mapbox-unitbezier.js +0 -14
- package/flow-typed/offscreen-canvas.js +0 -9
- package/flow-typed/pbf.js +0 -25
- package/flow-typed/point-geometry.js +0 -44
- package/flow-typed/potpack.js +0 -12
- package/flow-typed/sinon.js +0 -28
- package/flow-typed/vector-tile.js +0 -41
- package/src/css/mapbox-gl.css +0 -798
- package/src/css/svg/mapboxgl-ctrl-attrib.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-compass.svg +0 -4
- package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-geolocate.svg +0 -5
- package/src/css/svg/mapboxgl-ctrl-logo.svg +0 -20
- package/src/css/svg/mapboxgl-ctrl-shrink.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +0 -3
- package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +0 -3
- package/src/data/array_types.js +0 -1095
- package/src/data/bucket/circle_attributes.js +0 -9
- package/src/data/bucket/circle_bucket.js +0 -204
- package/src/data/bucket/fill_attributes.js +0 -9
- package/src/data/bucket/fill_bucket.js +0 -233
- package/src/data/bucket/fill_extrusion_attributes.js +0 -10
- package/src/data/bucket/fill_extrusion_bucket.js +0 -289
- package/src/data/bucket/heatmap_bucket.js +0 -17
- package/src/data/bucket/line_attributes.js +0 -10
- package/src/data/bucket/line_bucket.js +0 -556
- package/src/data/bucket/pattern_attributes.js +0 -10
- package/src/data/bucket/pattern_bucket_features.js +0 -60
- package/src/data/bucket/symbol_attributes.js +0 -117
- package/src/data/bucket/symbol_bucket.js +0 -972
- package/src/data/bucket.js +0 -123
- package/src/data/dem_data.js +0 -125
- package/src/data/extent.js +0 -18
- package/src/data/feature_index.js +0 -321
- package/src/data/feature_position_map.js +0 -125
- package/src/data/index_array_type.js +0 -16
- package/src/data/load_geometry.js +0 -48
- package/src/data/pos_attributes.js +0 -6
- package/src/data/program_configuration.js +0 -687
- package/src/data/raster_bounds_attributes.js +0 -7
- package/src/data/segment.js +0 -76
- package/src/geo/edge_insets.js +0 -102
- package/src/geo/lng_lat.js +0 -165
- package/src/geo/lng_lat_bounds.js +0 -267
- package/src/geo/mercator_coordinate.js +0 -153
- package/src/geo/transform.js +0 -864
- package/src/gl/color_mode.js +0 -34
- package/src/gl/context.js +0 -298
- package/src/gl/cull_face_mode.js +0 -26
- package/src/gl/depth_mode.js +0 -29
- package/src/gl/framebuffer.js +0 -44
- package/src/gl/index_buffer.js +0 -55
- package/src/gl/stencil_mode.js +0 -30
- package/src/gl/types.js +0 -84
- package/src/gl/value.js +0 -520
- package/src/gl/vertex_buffer.js +0 -119
- package/src/index.js +0 -201
- package/src/render/draw_background.js +0 -57
- package/src/render/draw_circle.js +0 -113
- package/src/render/draw_collision_debug.js +0 -49
- package/src/render/draw_custom.js +0 -49
- package/src/render/draw_debug.js +0 -127
- package/src/render/draw_fill.js +0 -126
- package/src/render/draw_fill_extrusion.js +0 -96
- package/src/render/draw_heatmap.js +0 -140
- package/src/render/draw_hillshade.js +0 -108
- package/src/render/draw_line.js +0 -98
- package/src/render/draw_raster.js +0 -125
- package/src/render/draw_symbol.js +0 -394
- package/src/render/glyph_atlas.js +0 -71
- package/src/render/glyph_manager.js +0 -182
- package/src/render/image_atlas.js +0 -149
- package/src/render/image_manager.js +0 -306
- package/src/render/line_atlas.js +0 -210
- package/src/render/painter.js +0 -653
- package/src/render/program/background_program.js +0 -103
- package/src/render/program/circle_program.js +0 -69
- package/src/render/program/clipping_mask_program.js +0 -20
- package/src/render/program/collision_program.js +0 -49
- package/src/render/program/debug_program.js +0 -35
- package/src/render/program/fill_extrusion_program.js +0 -122
- package/src/render/program/fill_program.js +0 -126
- package/src/render/program/heatmap_program.js +0 -83
- package/src/render/program/hillshade_program.js +0 -122
- package/src/render/program/line_program.js +0 -207
- package/src/render/program/pattern.js +0 -102
- package/src/render/program/program_uniforms.js +0 -42
- package/src/render/program/raster_program.js +0 -92
- package/src/render/program/symbol_program.js +0 -224
- package/src/render/program.js +0 -168
- package/src/render/texture.js +0 -122
- package/src/render/uniform_binding.js +0 -147
- package/src/render/vertex_array_object.js +0 -163
- package/src/shaders/README.md +0 -42
- package/src/shaders/_prelude.fragment.glsl +0 -17
- package/src/shaders/_prelude.vertex.glsl +0 -73
- package/src/shaders/background.fragment.glsl +0 -10
- package/src/shaders/background.vertex.glsl +0 -7
- package/src/shaders/background_pattern.fragment.glsl +0 -28
- package/src/shaders/background_pattern.vertex.glsl +0 -20
- package/src/shaders/circle.fragment.glsl +0 -39
- package/src/shaders/circle.vertex.glsl +0 -64
- package/src/shaders/clipping_mask.fragment.glsl +0 -3
- package/src/shaders/clipping_mask.vertex.glsl +0 -7
- package/src/shaders/collision_box.fragment.glsl +0 -21
- package/src/shaders/collision_box.vertex.glsl +0 -27
- package/src/shaders/collision_circle.fragment.glsl +0 -34
- package/src/shaders/collision_circle.vertex.glsl +0 -36
- package/src/shaders/debug.fragment.glsl +0 -9
- package/src/shaders/debug.vertex.glsl +0 -12
- package/src/shaders/encode_attribute.js +0 -17
- package/src/shaders/fill.fragment.glsl +0 -13
- package/src/shaders/fill.vertex.glsl +0 -13
- package/src/shaders/fill_extrusion.fragment.glsl +0 -9
- package/src/shaders/fill_extrusion.vertex.glsl +0 -66
- package/src/shaders/fill_extrusion_pattern.fragment.glsl +0 -45
- package/src/shaders/fill_extrusion_pattern.vertex.glsl +0 -79
- package/src/shaders/fill_outline.fragment.glsl +0 -17
- package/src/shaders/fill_outline.vertex.glsl +0 -17
- package/src/shaders/fill_outline_pattern.fragment.glsl +0 -43
- package/src/shaders/fill_outline_pattern.vertex.glsl +0 -44
- package/src/shaders/fill_pattern.fragment.glsl +0 -36
- package/src/shaders/fill_pattern.vertex.glsl +0 -39
- package/src/shaders/heatmap.fragment.glsl +0 -22
- package/src/shaders/heatmap.vertex.glsl +0 -54
- package/src/shaders/heatmap_texture.fragment.glsl +0 -14
- package/src/shaders/heatmap_texture.vertex.glsl +0 -11
- package/src/shaders/hillshade.fragment.glsl +0 -52
- package/src/shaders/hillshade.vertex.glsl +0 -11
- package/src/shaders/hillshade_prepare.fragment.glsl +0 -74
- package/src/shaders/hillshade_prepare.vertex.glsl +0 -15
- package/src/shaders/index.js +0 -20
- package/src/shaders/line.fragment.glsl +0 -30
- package/src/shaders/line.vertex.glsl +0 -85
- package/src/shaders/line_gradient.fragment.glsl +0 -34
- package/src/shaders/line_gradient.vertex.glsl +0 -87
- package/src/shaders/line_pattern.fragment.glsl +0 -74
- package/src/shaders/line_pattern.vertex.glsl +0 -99
- package/src/shaders/line_sdf.fragment.glsl +0 -45
- package/src/shaders/line_sdf.vertex.glsl +0 -98
- package/src/shaders/raster.fragment.glsl +0 -52
- package/src/shaders/raster.vertex.glsl +0 -21
- package/src/shaders/shaders.js +0 -180
- package/src/shaders/symbol_icon.fragment.glsl +0 -17
- package/src/shaders/symbol_icon.vertex.glsl +0 -94
- package/src/shaders/symbol_sdf.fragment.glsl +0 -52
- package/src/shaders/symbol_sdf.vertex.glsl +0 -115
- package/src/shaders/symbol_text_and_icon.fragment.glsl +0 -68
- package/src/shaders/symbol_text_and_icon.vertex.glsl +0 -116
- package/src/source/canvas_source.js +0 -238
- package/src/source/geojson_helper.js +0 -92
- package/src/source/geojson_source.js +0 -374
- package/src/source/geojson_worker_source.js +0 -357
- package/src/source/geojson_wrapper.js +0 -94
- package/src/source/image_source.js +0 -307
- package/src/source/load_tilejson.js +0 -39
- package/src/source/mbtiles_source.js +0 -115
- package/src/source/offline_database.js +0 -61
- package/src/source/offline_database_root.js +0 -62
- package/src/source/pixels_to_tile_units.js +0 -21
- package/src/source/query_features.js +0 -208
- package/src/source/raster_dem_tile_source.js +0 -138
- package/src/source/raster_dem_tile_worker_source.js +0 -62
- package/src/source/raster_tile_offline_source.js +0 -136
- package/src/source/raster_tile_source.js +0 -177
- package/src/source/rtl_text_plugin.js +0 -138
- package/src/source/source.js +0 -137
- package/src/source/source_cache.js +0 -957
- package/src/source/source_state.js +0 -159
- package/src/source/tile.js +0 -465
- package/src/source/tile_bounds.js +0 -38
- package/src/source/tile_cache.js +0 -212
- package/src/source/tile_id.js +0 -402
- package/src/source/vector_tile_source.js +0 -192
- package/src/source/vector_tile_worker_source.js +0 -216
- package/src/source/video_source.js +0 -203
- package/src/source/worker.js +0 -237
- package/src/source/worker_source.js +0 -106
- package/src/source/worker_tile.js +0 -224
- package/src/style/create_style_layer.js +0 -36
- package/src/style/evaluation_parameters.js +0 -62
- package/src/style/light.js +0 -130
- package/src/style/load_glyph_range.js +0 -38
- package/src/style/load_sprite.js +0 -67
- package/src/style/parse_glyph_pbf.js +0 -44
- package/src/style/pauseable_placement.js +0 -132
- package/src/style/properties.js +0 -753
- package/src/style/query_utils.js +0 -43
- package/src/style/style.js +0 -1361
- package/src/style/style_glyph.js +0 -17
- package/src/style/style_image.js +0 -137
- package/src/style/style_layer/background_style_layer.js +0 -21
- package/src/style/style_layer/background_style_layer_properties.js +0 -40
- package/src/style/style_layer/circle_style_layer.js +0 -98
- package/src/style/style_layer/circle_style_layer_properties.js +0 -63
- package/src/style/style_layer/custom_style_layer.js +0 -223
- package/src/style/style_layer/fill_extrusion_style_layer.js +0 -224
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +0 -50
- package/src/style/style_layer/fill_style_layer.js +0 -67
- package/src/style/style_layer/fill_style_layer_properties.js +0 -55
- package/src/style/style_layer/heatmap_style_layer.js +0 -69
- package/src/style/style_layer/heatmap_style_layer_properties.js +0 -44
- package/src/style/style_layer/hillshade_style_layer.js +0 -25
- package/src/style/style_layer/hillshade_style_layer_properties.js +0 -46
- package/src/style/style_layer/layer_properties.js.ejs +0 -69
- package/src/style/style_layer/line_style_layer.js +0 -151
- package/src/style/style_layer/line_style_layer_properties.js +0 -71
- package/src/style/style_layer/raster_style_layer.js +0 -21
- package/src/style/style_layer/raster_style_layer_properties.js +0 -50
- package/src/style/style_layer/symbol_style_layer.js +0 -190
- package/src/style/style_layer/symbol_style_layer_properties.js +0 -153
- package/src/style/style_layer/typed_style_layer.js +0 -17
- package/src/style/style_layer.js +0 -281
- package/src/style/style_layer_index.js +0 -80
- package/src/style/validate_style.js +0 -42
- package/src/style/zoom_history.js +0 -44
- package/src/style-spec/.eslintrc +0 -5
- package/src/style-spec/CHANGELOG.md +0 -438
- package/src/style-spec/README.md +0 -59
- package/src/style-spec/bin/gl-style-composite +0 -9
- package/src/style-spec/bin/gl-style-format +0 -22
- package/src/style-spec/bin/gl-style-migrate +0 -9
- package/src/style-spec/bin/gl-style-validate +0 -50
- package/src/style-spec/composite.js +0 -50
- package/src/style-spec/declass.js +0 -42
- package/src/style-spec/deref.js +0 -52
- package/src/style-spec/diff.js +0 -393
- package/src/style-spec/dist/.gitkeep +0 -0
- package/src/style-spec/empty.js +0 -29
- package/src/style-spec/error/parsing_error.js +0 -16
- package/src/style-spec/error/validation_error.js +0 -18
- package/src/style-spec/expression/compound_expression.js +0 -162
- package/src/style-spec/expression/definitions/assertion.js +0 -130
- package/src/style-spec/expression/definitions/at.js +0 -70
- package/src/style-spec/expression/definitions/case.js +0 -85
- package/src/style-spec/expression/definitions/coalesce.js +0 -93
- package/src/style-spec/expression/definitions/coercion.js +0 -133
- package/src/style-spec/expression/definitions/collator.js +0 -78
- package/src/style-spec/expression/definitions/comparison.js +0 -184
- package/src/style-spec/expression/definitions/format.js +0 -144
- package/src/style-spec/expression/definitions/format_section_override.js +0 -54
- package/src/style-spec/expression/definitions/image.js +0 -52
- package/src/style-spec/expression/definitions/in.js +0 -92
- package/src/style-spec/expression/definitions/index.js +0 -561
- package/src/style-spec/expression/definitions/interpolate.js +0 -267
- package/src/style-spec/expression/definitions/length.js +0 -61
- package/src/style-spec/expression/definitions/let.js +0 -72
- package/src/style-spec/expression/definitions/literal.js +0 -77
- package/src/style-spec/expression/definitions/match.js +0 -158
- package/src/style-spec/expression/definitions/number_format.js +0 -142
- package/src/style-spec/expression/definitions/step.js +0 -120
- package/src/style-spec/expression/definitions/var.js +0 -46
- package/src/style-spec/expression/definitions/within.js +0 -333
- package/src/style-spec/expression/evaluation_context.js +0 -59
- package/src/style-spec/expression/expression.js +0 -27
- package/src/style-spec/expression/index.js +0 -392
- package/src/style-spec/expression/is_constant.js +0 -59
- package/src/style-spec/expression/parsing_context.js +0 -233
- package/src/style-spec/expression/parsing_error.js +0 -13
- package/src/style-spec/expression/runtime_error.js +0 -17
- package/src/style-spec/expression/scope.js +0 -36
- package/src/style-spec/expression/stops.js +0 -39
- package/src/style-spec/expression/types/collator.js +0 -61
- package/src/style-spec/expression/types/formatted.js +0 -73
- package/src/style-spec/expression/types/resolved_image.js +0 -29
- package/src/style-spec/expression/types.js +0 -106
- package/src/style-spec/expression/values.js +0 -123
- package/src/style-spec/feature_filter/README.md +0 -55
- package/src/style-spec/feature_filter/convert.js +0 -208
- package/src/style-spec/feature_filter/index.js +0 -165
- package/src/style-spec/format.js +0 -51
- package/src/style-spec/function/convert.js +0 -254
- package/src/style-spec/function/index.js +0 -262
- package/src/style-spec/group_by_layout.js +0 -75
- package/src/style-spec/migrate/expressions.js +0 -39
- package/src/style-spec/migrate/v8.js +0 -203
- package/src/style-spec/migrate/v9.js +0 -26
- package/src/style-spec/migrate.js +0 -36
- package/src/style-spec/package.json +0 -41
- package/src/style-spec/read_style.js +0 -14
- package/src/style-spec/reference/latest.js +0 -3
- package/src/style-spec/reference/v8.json +0 -5808
- package/src/style-spec/rollup.config.js +0 -45
- package/src/style-spec/style-spec.js +0 -122
- package/src/style-spec/types.js +0 -438
- package/src/style-spec/util/color.js +0 -95
- package/src/style-spec/util/color_spaces.js +0 -139
- package/src/style-spec/util/deep_equal.js +0 -28
- package/src/style-spec/util/extend.js +0 -10
- package/src/style-spec/util/get_type.js +0 -17
- package/src/style-spec/util/interpolate.js +0 -22
- package/src/style-spec/util/properties.js +0 -15
- package/src/style-spec/util/ref_properties.js +0 -2
- package/src/style-spec/util/result.js +0 -19
- package/src/style-spec/util/unbundle_jsonlint.js +0 -24
- package/src/style-spec/validate/latest.js +0 -11
- package/src/style-spec/validate/validate.js +0 -75
- package/src/style-spec/validate/validate_array.js +0 -52
- package/src/style-spec/validate/validate_boolean.js +0 -15
- package/src/style-spec/validate/validate_color.js +0 -20
- package/src/style-spec/validate/validate_constants.js +0 -13
- package/src/style-spec/validate/validate_enum.js +0 -21
- package/src/style-spec/validate/validate_expression.js +0 -43
- package/src/style-spec/validate/validate_filter.js +0 -111
- package/src/style-spec/validate/validate_formatted.js +0 -11
- package/src/style-spec/validate/validate_function.js +0 -207
- package/src/style-spec/validate/validate_glyphs_url.js +0 -21
- package/src/style-spec/validate/validate_image.js +0 -11
- package/src/style-spec/validate/validate_layer.js +0 -134
- package/src/style-spec/validate/validate_layout_property.js +0 -6
- package/src/style-spec/validate/validate_light.js +0 -47
- package/src/style-spec/validate/validate_number.js +0 -29
- package/src/style-spec/validate/validate_object.js +0 -61
- package/src/style-spec/validate/validate_paint_property.js +0 -6
- package/src/style-spec/validate/validate_property.js +0 -64
- package/src/style-spec/validate/validate_source.js +0 -111
- package/src/style-spec/validate/validate_string.js +0 -15
- package/src/style-spec/validate_mapbox_api_supported.js +0 -171
- package/src/style-spec/validate_style.js +0 -39
- package/src/style-spec/validate_style.min.js +0 -78
- package/src/style-spec/visit.js +0 -77
- package/src/symbol/anchor.js +0 -26
- package/src/symbol/check_max_angle.js +0 -81
- package/src/symbol/clip_line.js +0 -71
- package/src/symbol/collision_feature.js +0 -217
- package/src/symbol/collision_index.js +0 -372
- package/src/symbol/cross_tile_symbol_index.js +0 -301
- package/src/symbol/get_anchors.js +0 -167
- package/src/symbol/grid_index.js +0 -335
- package/src/symbol/mergelines.js +0 -82
- package/src/symbol/one_em.js +0 -4
- package/src/symbol/opacity_state.js +0 -27
- package/src/symbol/placement.js +0 -1062
- package/src/symbol/projection.js +0 -450
- package/src/symbol/quads.js +0 -334
- package/src/symbol/shaping.js +0 -816
- package/src/symbol/symbol_layout.js +0 -772
- package/src/symbol/symbol_size.js +0 -113
- package/src/symbol/transform_text.js +0 -29
- package/src/types/callback.js +0 -17
- package/src/types/cancelable.js +0 -3
- package/src/types/tilejson.js +0 -17
- package/src/types/transferable.js +0 -3
- package/src/types/window.js +0 -172
- package/src/ui/anchor.js +0 -32
- package/src/ui/bind_handlers.js +0 -202
- package/src/ui/camera.js +0 -1152
- package/src/ui/control/attribution_control.js +0 -189
- package/src/ui/control/fps_control.js +0 -185
- package/src/ui/control/fullscreen_control.js +0 -147
- package/src/ui/control/geolocate_control.js +0 -594
- package/src/ui/control/logo_control.js +0 -92
- package/src/ui/control/navigation_control.js +0 -148
- package/src/ui/control/scale_control.js +0 -142
- package/src/ui/crs.js +0 -64
- package/src/ui/default_locale.js +0 -20
- package/src/ui/events.js +0 -806
- package/src/ui/handler/box_zoom.js +0 -175
- package/src/ui/handler/dblclick_zoom.js +0 -139
- package/src/ui/handler/drag_pan.js +0 -416
- package/src/ui/handler/drag_rotate.js +0 -378
- package/src/ui/handler/keyboard.js +0 -161
- package/src/ui/handler/scroll_zoom.js +0 -333
- package/src/ui/handler/touch_zoom_rotate.js +0 -293
- package/src/ui/hash.js +0 -147
- package/src/ui/map.js +0 -2883
- package/src/ui/marker.js +0 -607
- package/src/ui/offline_map.js +0 -91
- package/src/ui/popup.js +0 -530
- package/src/util/actor.js +0 -212
- package/src/util/ajax.js +0 -371
- package/src/util/browser/web_worker.js +0 -10
- package/src/util/browser/window.js +0 -5
- package/src/util/browser.js +0 -70
- package/src/util/classify_rings.js +0 -52
- package/src/util/color_ramp.js +0 -28
- package/src/util/config.js +0 -30
- package/src/util/debug.js +0 -12
- package/src/util/dictionary_coder.js +0 -30
- package/src/util/dispatcher.js +0 -70
- package/src/util/dom.js +0 -144
- package/src/util/evented.js +0 -174
- package/src/util/find_pole_of_inaccessibility.js +0 -129
- package/src/util/global_worker_pool.js +0 -17
- package/src/util/image.js +0 -142
- package/src/util/intersection_tests.js +0 -208
- package/src/util/is_char_in_unicode_block.js +0 -311
- package/src/util/mapbox.js +0 -486
- package/src/util/offscreen_canvas_supported.js +0 -14
- package/src/util/performance.js +0 -112
- package/src/util/primitives.js +0 -145
- package/src/util/resolve_tokens.js +0 -16
- package/src/util/script_detection.js +0 -328
- package/src/util/sku_token.js +0 -42
- package/src/util/smart_wrap.js +0 -55
- package/src/util/struct_array.js +0 -243
- package/src/util/struct_array.js.ejs +0 -112
- package/src/util/struct_array_layout.js.ejs +0 -98
- package/src/util/task_queue.js +0 -68
- package/src/util/throttle.js +0 -28
- package/src/util/throttled_invoker.js +0 -46
- package/src/util/tile_cover.js +0 -101
- package/src/util/tile_request_cache.js +0 -172
- package/src/util/util.js +0 -504
- package/src/util/vectortile_to_geojson.js +0 -54
- package/src/util/verticalize_punctuation.js +0 -114
- package/src/util/web_worker.js +0 -91
- package/src/util/web_worker_transfer.js +0 -266
- package/src/util/webp_supported.js +0 -69
- package/src/util/window.js +0 -102
- package/src/util/worker_pool.js +0 -47
package/src/index.js
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import assert from 'assert';
|
|
4
|
-
import supported from '@mapbox/mapbox-gl-supported';
|
|
5
|
-
|
|
6
|
-
import {version} from '../package.json';
|
|
7
|
-
import Map from './ui/map';
|
|
8
|
-
import OfflineMap from './ui/offline_map';
|
|
9
|
-
import NavigationControl from './ui/control/navigation_control';
|
|
10
|
-
import GeolocateControl from './ui/control/geolocate_control';
|
|
11
|
-
import AttributionControl from './ui/control/attribution_control';
|
|
12
|
-
import ScaleControl from './ui/control/scale_control';
|
|
13
|
-
import FpsControl from './ui/control/fps_control';
|
|
14
|
-
import FullscreenControl from './ui/control/fullscreen_control';
|
|
15
|
-
import Popup from './ui/popup';
|
|
16
|
-
import Marker from './ui/marker';
|
|
17
|
-
import Style from './style/style';
|
|
18
|
-
import LngLat from './geo/lng_lat';
|
|
19
|
-
import LngLatBounds from './geo/lng_lat_bounds';
|
|
20
|
-
import Point from '@mapbox/point-geometry';
|
|
21
|
-
|
|
22
|
-
import MercatorCoordinate from './geo/mercator_coordinate';
|
|
23
|
-
import CRS from './ui/crs';
|
|
24
|
-
import {CanonicalTileID} from './source/tile_id';
|
|
25
|
-
|
|
26
|
-
import {Evented} from './util/evented';
|
|
27
|
-
import config from './util/config';
|
|
28
|
-
import {Debug} from './util/debug';
|
|
29
|
-
import {isSafari} from './util/util';
|
|
30
|
-
import {setRTLTextPlugin, getRTLTextPluginStatus} from './source/rtl_text_plugin';
|
|
31
|
-
import WorkerPool from './util/worker_pool';
|
|
32
|
-
import {clearTileCache} from './util/tile_request_cache';
|
|
33
|
-
import {PerformanceUtils} from './util/performance';
|
|
34
|
-
|
|
35
|
-
const exported = {
|
|
36
|
-
version,
|
|
37
|
-
supported,
|
|
38
|
-
setRTLTextPlugin,
|
|
39
|
-
getRTLTextPluginStatus,
|
|
40
|
-
Map,
|
|
41
|
-
OfflineMap,
|
|
42
|
-
NavigationControl,
|
|
43
|
-
GeolocateControl,
|
|
44
|
-
AttributionControl,
|
|
45
|
-
ScaleControl,
|
|
46
|
-
FullscreenControl,
|
|
47
|
-
FpsControl,
|
|
48
|
-
Popup,
|
|
49
|
-
Marker,
|
|
50
|
-
Style,
|
|
51
|
-
LngLat,
|
|
52
|
-
LngLatBounds,
|
|
53
|
-
Point,
|
|
54
|
-
MercatorCoordinate,
|
|
55
|
-
CRS,
|
|
56
|
-
CanonicalTileID,
|
|
57
|
-
Evented,
|
|
58
|
-
config,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Gets and sets the map's [access token](https://www.mapbox.com/help/define-access-token/).
|
|
62
|
-
*
|
|
63
|
-
* @var {string} accessToken
|
|
64
|
-
* @returns {string} The currently set access token.
|
|
65
|
-
* @example
|
|
66
|
-
* mapboxgl.accessToken = myAccessToken;
|
|
67
|
-
* @see [Display a map](https://www.mapbox.com/mapbox-gl-js/examples/)
|
|
68
|
-
*/
|
|
69
|
-
get accessToken(): ?string {
|
|
70
|
-
return config.ACCESS_TOKEN;
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
set accessToken(token: string) {
|
|
74
|
-
config.ACCESS_TOKEN = token;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Gets and sets the map's default API URL for requesting tiles, styles, sprites, and glyphs
|
|
79
|
-
*
|
|
80
|
-
* @var {string} baseApiUrl
|
|
81
|
-
* @returns {string} The current base API URL.
|
|
82
|
-
* @example
|
|
83
|
-
* mapboxgl.baseApiUrl = 'https://api.mapbox.com';
|
|
84
|
-
*/
|
|
85
|
-
get baseApiUrl(): ?string {
|
|
86
|
-
return config.API_URL;
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
set baseApiUrl(url: string) {
|
|
90
|
-
config.API_URL = url;
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Gets and sets the number of web workers instantiated on a page with GL JS maps.
|
|
95
|
-
* By default, it is set to half the number of CPU cores (capped at 6).
|
|
96
|
-
* Make sure to set this property before creating any map instances for it to have effect.
|
|
97
|
-
*
|
|
98
|
-
* @var {string} workerCount
|
|
99
|
-
* @returns {number} Number of workers currently configured.
|
|
100
|
-
* @example
|
|
101
|
-
* mapboxgl.workerCount = 2;
|
|
102
|
-
*/
|
|
103
|
-
get workerCount(): number {
|
|
104
|
-
return WorkerPool.workerCount;
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
set workerCount(count: number) {
|
|
108
|
-
WorkerPool.workerCount = count;
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Gets and sets the maximum number of images (raster tiles, sprites, icons) to load in parallel,
|
|
113
|
-
* which affects performance in raster-heavy maps. 16 by default.
|
|
114
|
-
*
|
|
115
|
-
* @var {string} maxParallelImageRequests
|
|
116
|
-
* @returns {number} Number of parallel requests currently configured.
|
|
117
|
-
* @example
|
|
118
|
-
* mapboxgl.maxParallelImageRequests = 10;
|
|
119
|
-
*/
|
|
120
|
-
get maxParallelImageRequests(): number {
|
|
121
|
-
return config.MAX_PARALLEL_IMAGE_REQUESTS;
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
set maxParallelImageRequests(numRequests: number) {
|
|
125
|
-
config.MAX_PARALLEL_IMAGE_REQUESTS = numRequests;
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Clears browser storage used by this library. Using this method flushes the Mapbox tile
|
|
130
|
-
* cache that is managed by this library. Tiles may still be cached by the browser
|
|
131
|
-
* in some cases.
|
|
132
|
-
*
|
|
133
|
-
* This API is supported on browsers where the [`Cache` API](https://developer.mozilla.org/en-US/docs/Web/API/Cache)
|
|
134
|
-
* is supported and enabled. This includes all major browsers when pages are served over
|
|
135
|
-
* `https://`, except Internet Explorer and Edge Mobile.
|
|
136
|
-
*
|
|
137
|
-
* When called in unsupported browsers or environments (private or incognito mode), the
|
|
138
|
-
* callback will be called with an error argument.
|
|
139
|
-
*
|
|
140
|
-
* @function clearStorage
|
|
141
|
-
* @param {Function} callback Called with an error argument if there is an error.
|
|
142
|
-
*/
|
|
143
|
-
clearStorage(callback?: (err: ?Error) => void) {
|
|
144
|
-
clearTileCache(callback);
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
workerUrl: ''
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
//This gets automatically stripped out in production builds.
|
|
151
|
-
Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPerformanceMetrics});
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* The version of Mapbox GL JS in use as specified in `package.json`,
|
|
155
|
-
* `CHANGELOG.md`, and the GitHub release.
|
|
156
|
-
*
|
|
157
|
-
* @var {string} version
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Test whether the browser [supports Mapbox GL JS](https://www.mapbox.com/help/mapbox-browser-support/#mapbox-gl-js).
|
|
162
|
-
*
|
|
163
|
-
* @function supported
|
|
164
|
-
* @param {Object} [options]
|
|
165
|
-
* @param {boolean} [options.failIfMajorPerformanceCaveat=false] If `true`,
|
|
166
|
-
* the function will return `false` if the performance of Mapbox GL JS would
|
|
167
|
-
* be dramatically worse than expected (e.g. a software WebGL renderer would be used).
|
|
168
|
-
* @return {boolean}
|
|
169
|
-
* @example
|
|
170
|
-
* mapboxgl.supported() // = true
|
|
171
|
-
* @see [Check for browser support](https://www.mapbox.com/mapbox-gl-js/example/check-for-support/)
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Sets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text).
|
|
176
|
-
* Necessary for supporting the Arabic and Hebrew languages, which are written right-to-left. Mapbox Studio loads this plugin by default.
|
|
177
|
-
*
|
|
178
|
-
* @function setRTLTextPlugin
|
|
179
|
-
* @param {string} pluginURL URL pointing to the Mapbox RTL text plugin source.
|
|
180
|
-
* @param {Function} callback Called with an error argument if there is an error.
|
|
181
|
-
* @param {boolean} lazy If set to `true`, mapboxgl will defer loading the plugin until rtl text is encountered,
|
|
182
|
-
* rtl text will then be rendered only after the plugin finishes loading.
|
|
183
|
-
* @example
|
|
184
|
-
* mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
|
|
185
|
-
* @see [Add support for right-to-left scripts](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-rtl-text/)
|
|
186
|
-
*/
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Gets the map's [RTL text plugin](https://www.mapbox.com/mapbox-gl-js/plugins/#mapbox-gl-rtl-text) status.
|
|
190
|
-
* The status can be `unavailable` (i.e. not requested or removed), `loading`, `loaded` or `error`.
|
|
191
|
-
* If the status is `loaded` and the plugin is requested again, an error will be thrown.
|
|
192
|
-
*
|
|
193
|
-
* @function getRTLTextPluginStatus
|
|
194
|
-
* @example
|
|
195
|
-
* const pluginStatus = mapboxgl.getRTLTextPluginStatus();
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
export default exported;
|
|
199
|
-
|
|
200
|
-
// canary assert: used to confirm that asserts have been removed from production build
|
|
201
|
-
assert(true, 'canary assert');
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import StencilMode from '../gl/stencil_mode';
|
|
4
|
-
import DepthMode from '../gl/depth_mode';
|
|
5
|
-
import CullFaceMode from '../gl/cull_face_mode';
|
|
6
|
-
import {
|
|
7
|
-
backgroundUniformValues,
|
|
8
|
-
backgroundPatternUniformValues
|
|
9
|
-
} from './program/background_program';
|
|
10
|
-
|
|
11
|
-
import type Painter from './painter';
|
|
12
|
-
import type SourceCache from '../source/source_cache';
|
|
13
|
-
import type BackgroundStyleLayer from '../style/style_layer/background_style_layer';
|
|
14
|
-
|
|
15
|
-
export default drawBackground;
|
|
16
|
-
|
|
17
|
-
function drawBackground(painter: Painter, sourceCache: SourceCache, layer: BackgroundStyleLayer) {
|
|
18
|
-
const color = layer.paint.get('background-color');
|
|
19
|
-
const opacity = layer.paint.get('background-opacity');
|
|
20
|
-
|
|
21
|
-
if (opacity === 0) return;
|
|
22
|
-
|
|
23
|
-
const context = painter.context;
|
|
24
|
-
const gl = context.gl;
|
|
25
|
-
const transform = painter.transform;
|
|
26
|
-
const tileSize = transform.tileSize;
|
|
27
|
-
const image = layer.paint.get('background-pattern');
|
|
28
|
-
if (painter.isPatternMissing(image)) return;
|
|
29
|
-
|
|
30
|
-
const pass = (!image && color.a === 1 && opacity === 1 && painter.opaquePassEnabledForLayer()) ? 'opaque' : 'translucent';
|
|
31
|
-
if (painter.renderPass !== pass) return;
|
|
32
|
-
|
|
33
|
-
const stencilMode = StencilMode.disabled;
|
|
34
|
-
const depthMode = painter.depthModeForSublayer(0, pass === 'opaque' ? DepthMode.ReadWrite : DepthMode.ReadOnly);
|
|
35
|
-
const colorMode = painter.colorModeForRenderPass();
|
|
36
|
-
|
|
37
|
-
const program = painter.useProgram(image ? 'backgroundPattern' : 'background');
|
|
38
|
-
|
|
39
|
-
const tileIDs = transform.coveringTiles({tileSize});
|
|
40
|
-
|
|
41
|
-
if (image) {
|
|
42
|
-
context.activeTexture.set(gl.TEXTURE0);
|
|
43
|
-
painter.imageManager.bind(painter.context);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const crossfade = layer.getCrossfadeParameters();
|
|
47
|
-
for (const tileID of tileIDs) {
|
|
48
|
-
const matrix = painter.transform.calculatePosMatrix(tileID.toUnwrapped());
|
|
49
|
-
const uniformValues = image ?
|
|
50
|
-
backgroundPatternUniformValues(matrix, opacity, painter, image, {tileID, tileSize}, crossfade) :
|
|
51
|
-
backgroundUniformValues(matrix, opacity, color);
|
|
52
|
-
|
|
53
|
-
program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,
|
|
54
|
-
uniformValues, layer.id, painter.tileExtentBuffer,
|
|
55
|
-
painter.quadTriangleIndexBuffer, painter.tileExtentSegments);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import StencilMode from '../gl/stencil_mode';
|
|
4
|
-
import DepthMode from '../gl/depth_mode';
|
|
5
|
-
import CullFaceMode from '../gl/cull_face_mode';
|
|
6
|
-
import Program from './program';
|
|
7
|
-
import {circleUniformValues} from './program/circle_program';
|
|
8
|
-
import SegmentVector from '../data/segment';
|
|
9
|
-
import {OverscaledTileID} from '../source/tile_id';
|
|
10
|
-
|
|
11
|
-
import type Painter from './painter';
|
|
12
|
-
import type SourceCache from '../source/source_cache';
|
|
13
|
-
import type CircleStyleLayer from '../style/style_layer/circle_style_layer';
|
|
14
|
-
import type CircleBucket from '../data/bucket/circle_bucket';
|
|
15
|
-
import type ProgramConfiguration from '../data/program_configuration';
|
|
16
|
-
import type VertexBuffer from '../gl/vertex_buffer';
|
|
17
|
-
import type IndexBuffer from '../gl/index_buffer';
|
|
18
|
-
import type {UniformValues} from './uniform_binding';
|
|
19
|
-
import type {CircleUniformsType} from './program/circle_program';
|
|
20
|
-
|
|
21
|
-
export default drawCircles;
|
|
22
|
-
|
|
23
|
-
type TileRenderState = {
|
|
24
|
-
programConfiguration: ProgramConfiguration,
|
|
25
|
-
program: Program<*>,
|
|
26
|
-
layoutVertexBuffer: VertexBuffer,
|
|
27
|
-
indexBuffer: IndexBuffer,
|
|
28
|
-
uniformValues: UniformValues<CircleUniformsType>
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type SegmentsTileRenderState = {
|
|
32
|
-
segments: SegmentVector,
|
|
33
|
-
sortKey: number,
|
|
34
|
-
state: TileRenderState
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
function drawCircles(painter: Painter, sourceCache: SourceCache, layer: CircleStyleLayer, coords: Array<OverscaledTileID>) {
|
|
38
|
-
if (painter.renderPass !== 'translucent') return;
|
|
39
|
-
|
|
40
|
-
const opacity = layer.paint.get('circle-opacity');
|
|
41
|
-
const strokeWidth = layer.paint.get('circle-stroke-width');
|
|
42
|
-
const strokeOpacity = layer.paint.get('circle-stroke-opacity');
|
|
43
|
-
const sortFeaturesByKey = layer.layout.get('circle-sort-key').constantOr(1) !== undefined;
|
|
44
|
-
|
|
45
|
-
if (opacity.constantOr(1) === 0 && (strokeWidth.constantOr(1) === 0 || strokeOpacity.constantOr(1) === 0)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const context = painter.context;
|
|
50
|
-
const gl = context.gl;
|
|
51
|
-
|
|
52
|
-
const depthMode = painter.depthModeForSublayer(0, DepthMode.ReadOnly);
|
|
53
|
-
// Turn off stencil testing to allow circles to be drawn across boundaries,
|
|
54
|
-
// so that large circles are not clipped to tiles
|
|
55
|
-
const stencilMode = StencilMode.disabled;
|
|
56
|
-
const colorMode = painter.colorModeForRenderPass();
|
|
57
|
-
|
|
58
|
-
const segmentsRenderStates: Array<SegmentsTileRenderState> = [];
|
|
59
|
-
|
|
60
|
-
for (let i = 0; i < coords.length; i++) {
|
|
61
|
-
const coord = coords[i];
|
|
62
|
-
|
|
63
|
-
const tile = sourceCache.getTile(coord);
|
|
64
|
-
const bucket: ?CircleBucket<*> = (tile.getBucket(layer): any);
|
|
65
|
-
if (!bucket) continue;
|
|
66
|
-
|
|
67
|
-
const programConfiguration = bucket.programConfigurations.get(layer.id);
|
|
68
|
-
const program = painter.useProgram('circle', programConfiguration);
|
|
69
|
-
const layoutVertexBuffer = bucket.layoutVertexBuffer;
|
|
70
|
-
const indexBuffer = bucket.indexBuffer;
|
|
71
|
-
const uniformValues = circleUniformValues(painter, coord, tile, layer);
|
|
72
|
-
|
|
73
|
-
const state: TileRenderState = {
|
|
74
|
-
programConfiguration,
|
|
75
|
-
program,
|
|
76
|
-
layoutVertexBuffer,
|
|
77
|
-
indexBuffer,
|
|
78
|
-
uniformValues,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
if (sortFeaturesByKey) {
|
|
82
|
-
const oldSegments = bucket.segments.get();
|
|
83
|
-
for (const segment of oldSegments) {
|
|
84
|
-
segmentsRenderStates.push({
|
|
85
|
-
segments: new SegmentVector([segment]),
|
|
86
|
-
sortKey: ((segment.sortKey: any): number),
|
|
87
|
-
state
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
segmentsRenderStates.push({
|
|
92
|
-
segments: bucket.segments,
|
|
93
|
-
sortKey: 0,
|
|
94
|
-
state
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (sortFeaturesByKey) {
|
|
101
|
-
segmentsRenderStates.sort((a, b) => a.sortKey - b.sortKey);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const segmentsState of segmentsRenderStates) {
|
|
105
|
-
const {programConfiguration, program, layoutVertexBuffer, indexBuffer, uniformValues} = segmentsState.state;
|
|
106
|
-
const segments = segmentsState.segments;
|
|
107
|
-
|
|
108
|
-
program.draw(context, gl.TRIANGLES, depthMode, stencilMode, colorMode, CullFaceMode.disabled,
|
|
109
|
-
uniformValues, layer.id,
|
|
110
|
-
layoutVertexBuffer, indexBuffer, segments,
|
|
111
|
-
layer.paint, painter.transform.zoom, programConfiguration);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type Painter from './painter';
|
|
4
|
-
import type SourceCache from '../source/source_cache';
|
|
5
|
-
import type StyleLayer from '../style/style_layer';
|
|
6
|
-
import type {OverscaledTileID} from '../source/tile_id';
|
|
7
|
-
import type SymbolBucket from '../data/bucket/symbol_bucket';
|
|
8
|
-
import DepthMode from '../gl/depth_mode';
|
|
9
|
-
import StencilMode from '../gl/stencil_mode';
|
|
10
|
-
import CullFaceMode from '../gl/cull_face_mode';
|
|
11
|
-
import {collisionUniformValues} from './program/collision_program';
|
|
12
|
-
|
|
13
|
-
export default drawCollisionDebug;
|
|
14
|
-
|
|
15
|
-
function drawCollisionDebugGeometry(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array<OverscaledTileID>, drawCircles: boolean,
|
|
16
|
-
translate: [number, number], translateAnchor: 'map' | 'viewport', isText: boolean) {
|
|
17
|
-
const context = painter.context;
|
|
18
|
-
const gl = context.gl;
|
|
19
|
-
const program = drawCircles ? painter.useProgram('collisionCircle') : painter.useProgram('collisionBox');
|
|
20
|
-
|
|
21
|
-
for (let i = 0; i < coords.length; i++) {
|
|
22
|
-
const coord = coords[i];
|
|
23
|
-
const tile = sourceCache.getTile(coord);
|
|
24
|
-
const bucket: ?SymbolBucket = (tile.getBucket(layer): any);
|
|
25
|
-
if (!bucket) continue;
|
|
26
|
-
const buffers = drawCircles ? (isText ? bucket.textCollisionCircle : bucket.iconCollisionCircle) : (isText ? bucket.textCollisionBox : bucket.iconCollisionBox);
|
|
27
|
-
if (!buffers) continue;
|
|
28
|
-
let posMatrix = coord.posMatrix;
|
|
29
|
-
if (translate[0] !== 0 || translate[1] !== 0) {
|
|
30
|
-
posMatrix = painter.translatePosMatrix(coord.posMatrix, tile, translate, translateAnchor);
|
|
31
|
-
}
|
|
32
|
-
program.draw(context, drawCircles ? gl.TRIANGLES : gl.LINES,
|
|
33
|
-
DepthMode.disabled, StencilMode.disabled,
|
|
34
|
-
painter.colorModeForRenderPass(),
|
|
35
|
-
CullFaceMode.disabled,
|
|
36
|
-
collisionUniformValues(
|
|
37
|
-
posMatrix,
|
|
38
|
-
painter.transform,
|
|
39
|
-
tile),
|
|
40
|
-
layer.id, buffers.layoutVertexBuffer, buffers.indexBuffer,
|
|
41
|
-
buffers.segments, null, painter.transform.zoom, null, null,
|
|
42
|
-
buffers.collisionVertexBuffer);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function drawCollisionDebug(painter: Painter, sourceCache: SourceCache, layer: StyleLayer, coords: Array<OverscaledTileID>, translate: [number, number], translateAnchor: 'map' | 'viewport', isText: boolean) {
|
|
47
|
-
drawCollisionDebugGeometry(painter, sourceCache, layer, coords, false, translate, translateAnchor, isText);
|
|
48
|
-
drawCollisionDebugGeometry(painter, sourceCache, layer, coords, true, translate, translateAnchor, isText);
|
|
49
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
export default drawCustom;
|
|
4
|
-
|
|
5
|
-
import DepthMode from '../gl/depth_mode';
|
|
6
|
-
import StencilMode from '../gl/stencil_mode';
|
|
7
|
-
|
|
8
|
-
import type Painter from './painter';
|
|
9
|
-
import type SourceCache from '../source/source_cache';
|
|
10
|
-
import type CustomStyleLayer from '../style/style_layer/custom_style_layer';
|
|
11
|
-
|
|
12
|
-
function drawCustom(painter: Painter, sourceCache: SourceCache, layer: CustomStyleLayer) {
|
|
13
|
-
|
|
14
|
-
const context = painter.context;
|
|
15
|
-
const implementation = layer.implementation;
|
|
16
|
-
|
|
17
|
-
if (painter.renderPass === 'offscreen') {
|
|
18
|
-
|
|
19
|
-
const prerender = implementation.prerender;
|
|
20
|
-
if (prerender) {
|
|
21
|
-
painter.setCustomLayerDefaults();
|
|
22
|
-
context.setColorMode(painter.colorModeForRenderPass());
|
|
23
|
-
|
|
24
|
-
prerender.call(implementation, context.gl, painter.transform.customLayerMatrix());
|
|
25
|
-
|
|
26
|
-
context.setDirty();
|
|
27
|
-
painter.setBaseState();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
} else if (painter.renderPass === 'translucent') {
|
|
31
|
-
|
|
32
|
-
painter.setCustomLayerDefaults();
|
|
33
|
-
|
|
34
|
-
context.setColorMode(painter.colorModeForRenderPass());
|
|
35
|
-
context.setStencilMode(StencilMode.disabled);
|
|
36
|
-
|
|
37
|
-
const depthMode = implementation.renderingMode === '3d' ?
|
|
38
|
-
new DepthMode(painter.context.gl.LEQUAL, DepthMode.ReadWrite, painter.depthRangeFor3D) :
|
|
39
|
-
painter.depthModeForSublayer(0, DepthMode.ReadOnly);
|
|
40
|
-
|
|
41
|
-
context.setDepthMode(depthMode);
|
|
42
|
-
|
|
43
|
-
implementation.render(context.gl, painter.transform.customLayerMatrix());
|
|
44
|
-
|
|
45
|
-
context.setDirty();
|
|
46
|
-
painter.setBaseState();
|
|
47
|
-
context.bindFramebuffer.set(null);
|
|
48
|
-
}
|
|
49
|
-
}
|
package/src/render/draw_debug.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import DepthMode from '../gl/depth_mode';
|
|
4
|
-
import StencilMode from '../gl/stencil_mode';
|
|
5
|
-
import CullFaceMode from '../gl/cull_face_mode';
|
|
6
|
-
import {debugUniformValues} from './program/debug_program';
|
|
7
|
-
import Color from '../style-spec/util/color';
|
|
8
|
-
import ColorMode from '../gl/color_mode';
|
|
9
|
-
import browser from '../util/browser';
|
|
10
|
-
|
|
11
|
-
import type Painter from './painter';
|
|
12
|
-
import type SourceCache from '../source/source_cache';
|
|
13
|
-
import type {OverscaledTileID} from '../source/tile_id';
|
|
14
|
-
|
|
15
|
-
export default drawDebug;
|
|
16
|
-
|
|
17
|
-
const topColor = new Color(1, 0, 0, 1);
|
|
18
|
-
const btmColor = new Color(0, 1, 0, 1);
|
|
19
|
-
const leftColor = new Color(0, 0, 1, 1);
|
|
20
|
-
const rightColor = new Color(1, 0, 1, 1);
|
|
21
|
-
const centerColor = new Color(0, 1, 1, 1);
|
|
22
|
-
|
|
23
|
-
export function drawDebugPadding(painter: Painter) {
|
|
24
|
-
const padding = painter.transform.padding;
|
|
25
|
-
const lineWidth = 3;
|
|
26
|
-
// Top
|
|
27
|
-
drawHorizontalLine(painter, painter.transform.height - (padding.top || 0), lineWidth, topColor);
|
|
28
|
-
// Bottom
|
|
29
|
-
drawHorizontalLine(painter, padding.bottom || 0, lineWidth, btmColor);
|
|
30
|
-
// Left
|
|
31
|
-
drawVerticalLine(painter, padding.left || 0, lineWidth, leftColor);
|
|
32
|
-
// Right
|
|
33
|
-
drawVerticalLine(painter, painter.transform.width - (padding.right || 0), lineWidth, rightColor);
|
|
34
|
-
// Center
|
|
35
|
-
const center = painter.transform.centerPoint;
|
|
36
|
-
drawCrosshair(painter, center.x, painter.transform.height - center.y, centerColor);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function drawCrosshair(painter: Painter, x: number, y: number, color: Color) {
|
|
40
|
-
const size = 20;
|
|
41
|
-
const lineWidth = 2;
|
|
42
|
-
//Vertical line
|
|
43
|
-
drawDebugSSRect(painter, x - lineWidth / 2, y - size / 2, lineWidth, size, color);
|
|
44
|
-
//Horizontal line
|
|
45
|
-
drawDebugSSRect(painter, x - size / 2, y - lineWidth / 2, size, lineWidth, color);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function drawHorizontalLine(painter: Painter, y: number, lineWidth: number, color: Color) {
|
|
49
|
-
drawDebugSSRect(painter, 0, y + lineWidth / 2, painter.transform.width, lineWidth, color);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function drawVerticalLine(painter: Painter, x: number, lineWidth: number, color: Color) {
|
|
53
|
-
drawDebugSSRect(painter, x - lineWidth / 2, 0, lineWidth, painter.transform.height, color);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function drawDebugSSRect(painter: Painter, x: number, y: number, width: number, height: number, color: Color) {
|
|
57
|
-
const context = painter.context;
|
|
58
|
-
const gl = context.gl;
|
|
59
|
-
|
|
60
|
-
gl.enable(gl.SCISSOR_TEST);
|
|
61
|
-
gl.scissor(x * browser.devicePixelRatio, y * browser.devicePixelRatio, width * browser.devicePixelRatio, height * browser.devicePixelRatio);
|
|
62
|
-
context.clear({color});
|
|
63
|
-
gl.disable(gl.SCISSOR_TEST);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function drawDebug(painter: Painter, sourceCache: SourceCache, coords: Array<OverscaledTileID>) {
|
|
67
|
-
for (let i = 0; i < coords.length; i++) {
|
|
68
|
-
drawDebugTile(painter, sourceCache, coords[i]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function drawDebugTile(painter, sourceCache, coord: OverscaledTileID) {
|
|
73
|
-
const context = painter.context;
|
|
74
|
-
const gl = context.gl;
|
|
75
|
-
|
|
76
|
-
const posMatrix = coord.posMatrix;
|
|
77
|
-
const program = painter.useProgram('debug');
|
|
78
|
-
|
|
79
|
-
const depthMode = DepthMode.disabled;
|
|
80
|
-
const stencilMode = StencilMode.disabled;
|
|
81
|
-
const colorMode = painter.colorModeForRenderPass();
|
|
82
|
-
const id = '$debug';
|
|
83
|
-
|
|
84
|
-
context.activeTexture.set(gl.TEXTURE0);
|
|
85
|
-
// Bind the empty texture for drawing outlines
|
|
86
|
-
painter.emptyTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
|
|
87
|
-
|
|
88
|
-
program.draw(context, gl.LINE_STRIP, depthMode, stencilMode, colorMode, CullFaceMode.disabled,
|
|
89
|
-
debugUniformValues(posMatrix, Color.red), id,
|
|
90
|
-
painter.debugBuffer, painter.tileBorderIndexBuffer, painter.debugSegments);
|
|
91
|
-
|
|
92
|
-
const tileRawData = sourceCache.getTileByID(coord.key).latestRawTileData;
|
|
93
|
-
const tileByteLength = (tileRawData && tileRawData.byteLength) || 0;
|
|
94
|
-
const tileSizeKb = Math.floor(tileByteLength / 1024);
|
|
95
|
-
const tileSize = sourceCache.getTile(coord).tileSize;
|
|
96
|
-
const scaleRatio = (512 / Math.min(tileSize, 512) * (coord.overscaledZ / painter.transform.zoom)) * 0.5;
|
|
97
|
-
let tileIdText = coord.canonical.toString();
|
|
98
|
-
if (coord.overscaledZ !== coord.canonical.z) {
|
|
99
|
-
tileIdText += ` => ${coord.overscaledZ}`;
|
|
100
|
-
}
|
|
101
|
-
const tileLabel = `${tileIdText} ${tileSizeKb}kb`;
|
|
102
|
-
drawTextToOverlay(painter, tileLabel);
|
|
103
|
-
|
|
104
|
-
program.draw(context, gl.TRIANGLES, depthMode, stencilMode, ColorMode.alphaBlended, CullFaceMode.disabled,
|
|
105
|
-
debugUniformValues(posMatrix, Color.transparent, scaleRatio), id,
|
|
106
|
-
painter.debugBuffer, painter.quadTriangleIndexBuffer, painter.debugSegments);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function drawTextToOverlay(painter: Painter, text: string) {
|
|
110
|
-
painter.initDebugOverlayCanvas();
|
|
111
|
-
const canvas = painter.debugOverlayCanvas;
|
|
112
|
-
const gl = painter.context.gl;
|
|
113
|
-
const ctx2d = painter.debugOverlayCanvas.getContext('2d');
|
|
114
|
-
ctx2d.clearRect(0, 0, canvas.width, canvas.height);
|
|
115
|
-
|
|
116
|
-
ctx2d.shadowColor = 'white';
|
|
117
|
-
ctx2d.shadowBlur = 2;
|
|
118
|
-
ctx2d.lineWidth = 1.5;
|
|
119
|
-
ctx2d.strokeStyle = 'white';
|
|
120
|
-
ctx2d.textBaseline = 'top';
|
|
121
|
-
ctx2d.font = `bold ${36}px Open Sans, sans-serif`;
|
|
122
|
-
ctx2d.fillText(text, 5, 5);
|
|
123
|
-
ctx2d.strokeText(text, 5, 5);
|
|
124
|
-
|
|
125
|
-
painter.debugOverlayTexture.update(canvas);
|
|
126
|
-
painter.debugOverlayTexture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
|
|
127
|
-
}
|