@scoova/mgl 1.0.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/LICENSE.txt +116 -0
- package/README.md +174 -0
- package/build/banner.ts +12 -0
- package/build/bump-version-changelog.js +26 -0
- package/build/check-bundle-size.js +77 -0
- package/build/generate-dist-package.js +26 -0
- package/build/generate-doc-images.ts +78 -0
- package/build/generate-docs.ts +190 -0
- package/build/generate-shaders.ts +68 -0
- package/build/generate-struct-arrays.ts +438 -0
- package/build/generate-style-code.ts +283 -0
- package/build/readme.md +56 -0
- package/build/release-notes.js +45 -0
- package/build/rollup/bundle_prelude.js +29 -0
- package/build/rollup/maplibregl.js +22 -0
- package/build/rollup_plugins.ts +58 -0
- package/dist/LICENSE.txt +116 -0
- package/dist/maplibre-gl.css +1 -0
- package/dist/maplibre-gl.d.ts +13304 -0
- package/dist/maplibre-gl.js +59 -0
- package/dist/maplibre-gl.js.map +1 -0
- package/dist/package.json +1 -0
- package/package.json +192 -0
- package/src/css/maplibre-gl.css +854 -0
- package/src/css/svg/maplibregl-ctrl-attrib.svg +3 -0
- package/src/css/svg/maplibregl-ctrl-compass.svg +4 -0
- package/src/css/svg/maplibregl-ctrl-fullscreen.svg +3 -0
- package/src/css/svg/maplibregl-ctrl-geolocate.svg +5 -0
- package/src/css/svg/maplibregl-ctrl-logo.svg +11 -0
- package/src/css/svg/maplibregl-ctrl-shrink.svg +3 -0
- package/src/css/svg/maplibregl-ctrl-terrain.svg +3 -0
- package/src/css/svg/maplibregl-ctrl-zoom-in.svg +3 -0
- package/src/css/svg/maplibregl-ctrl-zoom-out.svg +3 -0
- package/src/data/array_types.g.ts +1130 -0
- package/src/data/bucket/circle_attributes.ts +8 -0
- package/src/data/bucket/circle_bucket.ts +197 -0
- package/src/data/bucket/fill_attributes.ts +8 -0
- package/src/data/bucket/fill_bucket.test.ts +95 -0
- package/src/data/bucket/fill_bucket.ts +228 -0
- package/src/data/bucket/fill_extrusion_attributes.ts +13 -0
- package/src/data/bucket/fill_extrusion_bucket.ts +305 -0
- package/src/data/bucket/heatmap_bucket.ts +12 -0
- package/src/data/bucket/line_attributes.ts +8 -0
- package/src/data/bucket/line_attributes_ext.ts +8 -0
- package/src/data/bucket/line_bucket.test.ts +142 -0
- package/src/data/bucket/line_bucket.ts +592 -0
- package/src/data/bucket/pattern_attributes.ts +9 -0
- package/src/data/bucket/pattern_bucket_features.ts +57 -0
- package/src/data/bucket/symbol_attributes.ts +122 -0
- package/src/data/bucket/symbol_bucket.test.ts +243 -0
- package/src/data/bucket/symbol_bucket.ts +975 -0
- package/src/data/bucket.ts +123 -0
- package/src/data/dem_data.test.ts +237 -0
- package/src/data/dem_data.ts +171 -0
- package/src/data/evaluation_feature.ts +18 -0
- package/src/data/extent.ts +13 -0
- package/src/data/feature_index.ts +337 -0
- package/src/data/feature_position_map.test.ts +33 -0
- package/src/data/feature_position_map.ts +126 -0
- package/src/data/index_array_type.ts +9 -0
- package/src/data/load_geometry.test.ts +49 -0
- package/src/data/load_geometry.ts +44 -0
- package/src/data/pos3d_attributes.ts +5 -0
- package/src/data/pos_attributes.ts +5 -0
- package/src/data/program_configuration.ts +735 -0
- package/src/data/raster_bounds_attributes.ts +6 -0
- package/src/data/segment.ts +89 -0
- package/src/geo/edge_insets.test.ts +83 -0
- package/src/geo/edge_insets.ts +146 -0
- package/src/geo/lng_lat.test.ts +65 -0
- package/src/geo/lng_lat.ts +169 -0
- package/src/geo/lng_lat_bounds.test.ts +357 -0
- package/src/geo/lng_lat_bounds.ts +356 -0
- package/src/geo/mercator_coordinate.test.ts +34 -0
- package/src/geo/mercator_coordinate.ts +157 -0
- package/src/geo/projection/projection.ts +72 -0
- package/src/geo/transform.test.ts +509 -0
- package/src/geo/transform.ts +1072 -0
- package/src/gl/color_mode.ts +31 -0
- package/src/gl/context.ts +321 -0
- package/src/gl/cull_face_mode.ts +22 -0
- package/src/gl/depth_mode.ts +26 -0
- package/src/gl/framebuffer.ts +48 -0
- package/src/gl/index_buffer.ts +55 -0
- package/src/gl/render_pool.test.ts +69 -0
- package/src/gl/render_pool.ts +93 -0
- package/src/gl/state.test.ts +125 -0
- package/src/gl/stencil_mode.ts +27 -0
- package/src/gl/types.ts +59 -0
- package/src/gl/value.ts +534 -0
- package/src/gl/vertex_buffer.test.ts +57 -0
- package/src/gl/vertex_buffer.ts +111 -0
- package/src/gl/webgl2.ts +12 -0
- package/src/index.test.ts +121 -0
- package/src/index.ts +250 -0
- package/src/render/draw_background.ts +53 -0
- package/src/render/draw_circle.ts +113 -0
- package/src/render/draw_collision_debug.ts +168 -0
- package/src/render/draw_custom.test.ts +73 -0
- package/src/render/draw_custom.ts +45 -0
- package/src/render/draw_debug.test.ts +122 -0
- package/src/render/draw_debug.ts +148 -0
- package/src/render/draw_fill.test.ts +137 -0
- package/src/render/draw_fill.ts +128 -0
- package/src/render/draw_fill_extrusion.ts +97 -0
- package/src/render/draw_heatmap.ts +228 -0
- package/src/render/draw_hillshade.ts +119 -0
- package/src/render/draw_line.ts +125 -0
- package/src/render/draw_raster.ts +133 -0
- package/src/render/draw_sky.ts +44 -0
- package/src/render/draw_symbol.test.ts +223 -0
- package/src/render/draw_symbol.ts +499 -0
- package/src/render/draw_terrain.ts +99 -0
- package/src/render/glyph_atlas.ts +83 -0
- package/src/render/glyph_manager.test.ts +147 -0
- package/src/render/glyph_manager.ts +198 -0
- package/src/render/image_atlas.ts +159 -0
- package/src/render/image_manager.ts +337 -0
- package/src/render/line_atlas.test.ts +38 -0
- package/src/render/line_atlas.ts +214 -0
- package/src/render/mesh.ts +25 -0
- package/src/render/painter.test.ts +51 -0
- package/src/render/painter.ts +666 -0
- package/src/render/program/background_program.ts +100 -0
- package/src/render/program/circle_program.ts +61 -0
- package/src/render/program/clipping_mask_program.ts +19 -0
- package/src/render/program/collision_program.ts +47 -0
- package/src/render/program/debug_program.ts +29 -0
- package/src/render/program/fill_extrusion_program.ts +120 -0
- package/src/render/program/fill_program.ts +121 -0
- package/src/render/program/heatmap_program.ts +76 -0
- package/src/render/program/hillshade_program.ts +116 -0
- package/src/render/program/line_program.ts +207 -0
- package/src/render/program/pattern.ts +102 -0
- package/src/render/program/program_uniforms.ts +46 -0
- package/src/render/program/raster_program.ts +88 -0
- package/src/render/program/sky_program.ts +28 -0
- package/src/render/program/symbol_program.ts +266 -0
- package/src/render/program/terrain_program.ts +116 -0
- package/src/render/program.ts +233 -0
- package/src/render/render_to_texture.test.ts +151 -0
- package/src/render/render_to_texture.ts +197 -0
- package/src/render/terrain.test.ts +322 -0
- package/src/render/terrain.ts +464 -0
- package/src/render/texture.ts +114 -0
- package/src/render/uniform_binding.test.ts +122 -0
- package/src/render/uniform_binding.ts +157 -0
- package/src/render/update_pattern_positions_in_program.test.ts +74 -0
- package/src/render/update_pattern_positions_in_program.ts +50 -0
- package/src/render/vertex_array_object.ts +163 -0
- package/src/shaders/README.md +42 -0
- package/src/shaders/_prelude.fragment.glsl +19 -0
- package/src/shaders/_prelude.fragment.glsl.g.ts +2 -0
- package/src/shaders/_prelude.vertex.glsl +148 -0
- package/src/shaders/_prelude.vertex.glsl.g.ts +2 -0
- package/src/shaders/background.fragment.glsl +10 -0
- package/src/shaders/background.fragment.glsl.g.ts +2 -0
- package/src/shaders/background.vertex.glsl +7 -0
- package/src/shaders/background.vertex.glsl.g.ts +2 -0
- package/src/shaders/background_pattern.fragment.glsl +28 -0
- package/src/shaders/background_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/background_pattern.vertex.glsl +19 -0
- package/src/shaders/background_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/circle.fragment.glsl +34 -0
- package/src/shaders/circle.fragment.glsl.g.ts +2 -0
- package/src/shaders/circle.vertex.glsl +68 -0
- package/src/shaders/circle.vertex.glsl.g.ts +2 -0
- package/src/shaders/clipping_mask.fragment.glsl +3 -0
- package/src/shaders/clipping_mask.fragment.glsl.g.ts +2 -0
- package/src/shaders/clipping_mask.vertex.glsl +7 -0
- package/src/shaders/clipping_mask.vertex.glsl.g.ts +2 -0
- package/src/shaders/collision_box.fragment.glsl +20 -0
- package/src/shaders/collision_box.fragment.glsl.g.ts +2 -0
- package/src/shaders/collision_box.vertex.glsl +27 -0
- package/src/shaders/collision_box.vertex.glsl.g.ts +2 -0
- package/src/shaders/collision_circle.fragment.glsl +17 -0
- package/src/shaders/collision_circle.fragment.glsl.g.ts +2 -0
- package/src/shaders/collision_circle.vertex.glsl +59 -0
- package/src/shaders/collision_circle.vertex.glsl.g.ts +2 -0
- package/src/shaders/debug.fragment.glsl +9 -0
- package/src/shaders/debug.fragment.glsl.g.ts +2 -0
- package/src/shaders/debug.vertex.glsl +12 -0
- package/src/shaders/debug.vertex.glsl.g.ts +2 -0
- package/src/shaders/encode_attribute.test.ts +11 -0
- package/src/shaders/encode_attribute.ts +13 -0
- package/src/shaders/fill.fragment.glsl +13 -0
- package/src/shaders/fill.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill.vertex.glsl +13 -0
- package/src/shaders/fill.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion.fragment.glsl +9 -0
- package/src/shaders/fill_extrusion.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion.vertex.glsl +84 -0
- package/src/shaders/fill_extrusion.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion_pattern.fragment.glsl +47 -0
- package/src/shaders/fill_extrusion_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion_pattern.vertex.glsl +96 -0
- package/src/shaders/fill_extrusion_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_outline.fragment.glsl +17 -0
- package/src/shaders/fill_outline.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_outline.vertex.glsl +17 -0
- package/src/shaders/fill_outline.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_outline_pattern.fragment.glsl +43 -0
- package/src/shaders/fill_outline_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_outline_pattern.vertex.glsl +44 -0
- package/src/shaders/fill_outline_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_pattern.fragment.glsl +39 -0
- package/src/shaders/fill_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_pattern.vertex.glsl +39 -0
- package/src/shaders/fill_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/heatmap.fragment.glsl +22 -0
- package/src/shaders/heatmap.fragment.glsl.g.ts +2 -0
- package/src/shaders/heatmap.vertex.glsl +54 -0
- package/src/shaders/heatmap.vertex.glsl.g.ts +2 -0
- package/src/shaders/heatmap_texture.fragment.glsl +15 -0
- package/src/shaders/heatmap_texture.fragment.glsl.g.ts +2 -0
- package/src/shaders/heatmap_texture.vertex.glsl +11 -0
- package/src/shaders/heatmap_texture.vertex.glsl.g.ts +2 -0
- package/src/shaders/hillshade.fragment.glsl +52 -0
- package/src/shaders/hillshade.fragment.glsl.g.ts +2 -0
- package/src/shaders/hillshade.vertex.glsl +11 -0
- package/src/shaders/hillshade.vertex.glsl.g.ts +2 -0
- package/src/shaders/hillshade_prepare.fragment.glsl +77 -0
- package/src/shaders/hillshade_prepare.fragment.glsl.g.ts +2 -0
- package/src/shaders/hillshade_prepare.vertex.glsl +15 -0
- package/src/shaders/hillshade_prepare.vertex.glsl.g.ts +2 -0
- package/src/shaders/line.fragment.glsl +30 -0
- package/src/shaders/line.fragment.glsl.g.ts +2 -0
- package/src/shaders/line.vertex.glsl +89 -0
- package/src/shaders/line.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_gradient.fragment.glsl +34 -0
- package/src/shaders/line_gradient.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_gradient.vertex.glsl +92 -0
- package/src/shaders/line_gradient.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_pattern.fragment.glsl +77 -0
- package/src/shaders/line_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_pattern.vertex.glsl +103 -0
- package/src/shaders/line_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_sdf.fragment.glsl +45 -0
- package/src/shaders/line_sdf.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_sdf.vertex.glsl +101 -0
- package/src/shaders/line_sdf.vertex.glsl.g.ts +2 -0
- package/src/shaders/raster.fragment.glsl +53 -0
- package/src/shaders/raster.fragment.glsl.g.ts +2 -0
- package/src/shaders/raster.vertex.glsl +21 -0
- package/src/shaders/raster.vertex.glsl.g.ts +2 -0
- package/src/shaders/shaders.ts +197 -0
- package/src/shaders/sky.fragment.glsl +17 -0
- package/src/shaders/sky.fragment.glsl.g.ts +2 -0
- package/src/shaders/sky.vertex.glsl +5 -0
- package/src/shaders/sky.vertex.glsl.g.ts +2 -0
- package/src/shaders/symbol_icon.fragment.glsl +17 -0
- package/src/shaders/symbol_icon.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_icon.vertex.glsl +117 -0
- package/src/shaders/symbol_icon.vertex.glsl.g.ts +2 -0
- package/src/shaders/symbol_sdf.fragment.glsl +58 -0
- package/src/shaders/symbol_sdf.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_sdf.vertex.glsl +142 -0
- package/src/shaders/symbol_sdf.vertex.glsl.g.ts +2 -0
- package/src/shaders/symbol_text_and_icon.fragment.glsl +68 -0
- package/src/shaders/symbol_text_and_icon.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_text_and_icon.vertex.glsl +140 -0
- package/src/shaders/symbol_text_and_icon.vertex.glsl.g.ts +2 -0
- package/src/shaders/terrain.fragment.glsl +32 -0
- package/src/shaders/terrain.fragment.glsl.g.ts +2 -0
- package/src/shaders/terrain.vertex.glsl +17 -0
- package/src/shaders/terrain.vertex.glsl.g.ts +2 -0
- package/src/shaders/terrain_coords.fragment.glsl +11 -0
- package/src/shaders/terrain_coords.fragment.glsl.g.ts +2 -0
- package/src/shaders/terrain_coords.vertex.glsl +13 -0
- package/src/shaders/terrain_coords.vertex.glsl.g.ts +2 -0
- package/src/shaders/terrain_depth.fragment.glsl +15 -0
- package/src/shaders/terrain_depth.fragment.glsl.g.ts +2 -0
- package/src/shaders/terrain_depth.vertex.glsl +13 -0
- package/src/shaders/terrain_depth.vertex.glsl.g.ts +2 -0
- package/src/source/canvas_source.test.ts +210 -0
- package/src/source/canvas_source.ts +227 -0
- package/src/source/geojson_source.test.ts +492 -0
- package/src/source/geojson_source.ts +431 -0
- package/src/source/geojson_source_diff.test.ts +364 -0
- package/src/source/geojson_source_diff.ts +172 -0
- package/src/source/geojson_worker_source.test.ts +399 -0
- package/src/source/geojson_worker_source.ts +303 -0
- package/src/source/geojson_wrapper.test.ts +32 -0
- package/src/source/geojson_wrapper.ts +81 -0
- package/src/source/image_source.test.ts +235 -0
- package/src/source/image_source.ts +338 -0
- package/src/source/load_tilejson.ts +47 -0
- package/src/source/pixels_to_tile_units.ts +25 -0
- package/src/source/protocol_crud.ts +48 -0
- package/src/source/query_features.test.ts +31 -0
- package/src/source/query_features.ts +252 -0
- package/src/source/raster_dem_tile_source.test.ts +158 -0
- package/src/source/raster_dem_tile_source.ts +166 -0
- package/src/source/raster_dem_tile_worker_source.test.ts +36 -0
- package/src/source/raster_dem_tile_worker_source.ts +38 -0
- package/src/source/raster_tile_source.test.ts +206 -0
- package/src/source/raster_tile_source.ts +227 -0
- package/src/source/rtl_text_plugin_main_thread.test.ts +170 -0
- package/src/source/rtl_text_plugin_main_thread.ts +89 -0
- package/src/source/rtl_text_plugin_status.ts +33 -0
- package/src/source/rtl_text_plugin_worker.ts +49 -0
- package/src/source/source.test.ts +41 -0
- package/src/source/source.ts +186 -0
- package/src/source/source_cache.test.ts +2069 -0
- package/src/source/source_cache.ts +1102 -0
- package/src/source/source_state.ts +157 -0
- package/src/source/terrain_source_cache.test.ts +105 -0
- package/src/source/terrain_source_cache.ts +204 -0
- package/src/source/tile.test.ts +290 -0
- package/src/source/tile.ts +478 -0
- package/src/source/tile_bounds.ts +34 -0
- package/src/source/tile_cache.test.ts +130 -0
- package/src/source/tile_cache.ts +208 -0
- package/src/source/tile_id.test.ts +112 -0
- package/src/source/tile_id.ts +221 -0
- package/src/source/vector_tile_source.test.ts +401 -0
- package/src/source/vector_tile_source.ts +283 -0
- package/src/source/vector_tile_worker_source.test.ts +396 -0
- package/src/source/vector_tile_worker_source.ts +199 -0
- package/src/source/video_source.test.ts +124 -0
- package/src/source/video_source.ts +204 -0
- package/src/source/worker.test.ts +233 -0
- package/src/source/worker.ts +301 -0
- package/src/source/worker_source.ts +117 -0
- package/src/source/worker_tile.test.ts +226 -0
- package/src/source/worker_tile.ts +208 -0
- package/src/style/create_style_layer.ts +39 -0
- package/src/style/evaluation_parameters.ts +62 -0
- package/src/style/format_section_override.test.ts +62 -0
- package/src/style/format_section_override.ts +50 -0
- package/src/style/light.test.ts +86 -0
- package/src/style/light.ts +135 -0
- package/src/style/load_glyph_range.test.ts +40 -0
- package/src/style/load_glyph_range.ts +32 -0
- package/src/style/load_sprite.test.ts +227 -0
- package/src/style/load_sprite.ts +71 -0
- package/src/style/parse_glyph_pbf.ts +42 -0
- package/src/style/pauseable_placement.ts +138 -0
- package/src/style/properties.ts +726 -0
- package/src/style/query_utils.test.ts +107 -0
- package/src/style/query_utils.ts +70 -0
- package/src/style/sky.ts +127 -0
- package/src/style/style.test.ts +2654 -0
- package/src/style/style.ts +1814 -0
- package/src/style/style_glyph.ts +25 -0
- package/src/style/style_image.ts +188 -0
- package/src/style/style_layer/background_style_layer.ts +17 -0
- package/src/style/style_layer/background_style_layer_properties.g.ts +40 -0
- package/src/style/style_layer/circle_style_layer.ts +98 -0
- package/src/style/style_layer/circle_style_layer_properties.g.ts +76 -0
- package/src/style/style_layer/custom_style_layer.ts +233 -0
- package/src/style/style_layer/fill_extrusion_style_layer.ts +224 -0
- package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +55 -0
- package/src/style/style_layer/fill_style_layer.test.ts +37 -0
- package/src/style/style_layer/fill_style_layer.ts +65 -0
- package/src/style/style_layer/fill_style_layer_properties.g.ts +64 -0
- package/src/style/style_layer/heatmap_style_layer.ts +74 -0
- package/src/style/style_layer/heatmap_style_layer_properties.g.ts +46 -0
- package/src/style/style_layer/hillshade_style_layer.ts +21 -0
- package/src/style/style_layer/hillshade_style_layer_properties.g.ts +49 -0
- package/src/style/style_layer/line_style_layer.test.ts +50 -0
- package/src/style/style_layer/line_style_layer.ts +131 -0
- package/src/style/style_layer/line_style_layer_properties.g.ts +88 -0
- package/src/style/style_layer/overlap_mode.test.ts +57 -0
- package/src/style/style_layer/overlap_mode.ts +25 -0
- package/src/style/style_layer/raster_style_layer.ts +17 -0
- package/src/style/style_layer/raster_style_layer_properties.g.ts +55 -0
- package/src/style/style_layer/symbol_style_layer.ts +195 -0
- package/src/style/style_layer/symbol_style_layer_properties.g.ts +218 -0
- package/src/style/style_layer/typed_style_layer.ts +9 -0
- package/src/style/style_layer/variable_text_anchor.test.ts +117 -0
- package/src/style/style_layer/variable_text_anchor.ts +163 -0
- package/src/style/style_layer.test.ts +372 -0
- package/src/style/style_layer.ts +287 -0
- package/src/style/style_layer_index.test.ts +99 -0
- package/src/style/style_layer_index.ts +78 -0
- package/src/style/validate_style.ts +53 -0
- package/src/style/zoom_history.ts +40 -0
- package/src/symbol/anchor.test.ts +14 -0
- package/src/symbol/anchor.ts +22 -0
- package/src/symbol/check_max_angle.test.ts +54 -0
- package/src/symbol/check_max_angle.ts +76 -0
- package/src/symbol/clip_line.test.ts +154 -0
- package/src/symbol/clip_line.ts +66 -0
- package/src/symbol/collision_feature.test.ts +98 -0
- package/src/symbol/collision_feature.ts +114 -0
- package/src/symbol/collision_index.test.ts +19 -0
- package/src/symbol/collision_index.ts +618 -0
- package/src/symbol/cross_tile_symbol_index.test.ts +260 -0
- package/src/symbol/cross_tile_symbol_index.ts +367 -0
- package/src/symbol/get_anchors.test.ts +113 -0
- package/src/symbol/get_anchors.ts +167 -0
- package/src/symbol/grid_index.test.ts +75 -0
- package/src/symbol/grid_index.ts +414 -0
- package/src/symbol/merge_lines.test.ts +30 -0
- package/src/symbol/merge_lines.ts +80 -0
- package/src/symbol/one_em.ts +3 -0
- package/src/symbol/opacity_state.ts +23 -0
- package/src/symbol/path_interpolator.test.ts +134 -0
- package/src/symbol/path_interpolator.ts +55 -0
- package/src/symbol/placement.ts +1371 -0
- package/src/symbol/projection.test.ts +171 -0
- package/src/symbol/projection.ts +833 -0
- package/src/symbol/quads.test.ts +157 -0
- package/src/symbol/quads.ts +349 -0
- package/src/symbol/shaping.test.ts +360 -0
- package/src/symbol/shaping.ts +911 -0
- package/src/symbol/symbol_layout.ts +739 -0
- package/src/symbol/symbol_size.ts +129 -0
- package/src/symbol/symbol_style_layer.test.ts +103 -0
- package/src/symbol/transform_text.ts +27 -0
- package/src/ui/anchor.ts +27 -0
- package/src/ui/camera.test.ts +2301 -0
- package/src/ui/camera.ts +1520 -0
- package/src/ui/control/attribution_control.test.ts +543 -0
- package/src/ui/control/attribution_control.ts +209 -0
- package/src/ui/control/control.ts +67 -0
- package/src/ui/control/fullscreen_control.test.ts +114 -0
- package/src/ui/control/fullscreen_control.ts +189 -0
- package/src/ui/control/geolocate_control.test.ts +619 -0
- package/src/ui/control/geolocate_control.ts +725 -0
- package/src/ui/control/logo_control.test.ts +88 -0
- package/src/ui/control/logo_control.ts +86 -0
- package/src/ui/control/navigation_control.test.ts +238 -0
- package/src/ui/control/navigation_control.ts +294 -0
- package/src/ui/control/scale_control.test.ts +52 -0
- package/src/ui/control/scale_control.ts +152 -0
- package/src/ui/control/terrain_control.test.ts +58 -0
- package/src/ui/control/terrain_control.ts +74 -0
- package/src/ui/default_locale.ts +25 -0
- package/src/ui/events.ts +758 -0
- package/src/ui/handler/box_zoom.test.ts +163 -0
- package/src/ui/handler/box_zoom.ts +171 -0
- package/src/ui/handler/click_zoom.ts +55 -0
- package/src/ui/handler/cooperative_gestures.test.ts +338 -0
- package/src/ui/handler/cooperative_gestures.ts +111 -0
- package/src/ui/handler/dblclick_zoom.test.ts +151 -0
- package/src/ui/handler/drag_handler.ts +174 -0
- package/src/ui/handler/drag_move_state_manager.ts +115 -0
- package/src/ui/handler/drag_pan.test.ts +487 -0
- package/src/ui/handler/drag_rotate.test.ts +859 -0
- package/src/ui/handler/handler_util.ts +10 -0
- package/src/ui/handler/keyboard.test.ts +235 -0
- package/src/ui/handler/keyboard.ts +212 -0
- package/src/ui/handler/map_event.test.ts +158 -0
- package/src/ui/handler/map_event.ts +161 -0
- package/src/ui/handler/mouse.ts +92 -0
- package/src/ui/handler/mouse_handler_interface.test.ts +111 -0
- package/src/ui/handler/mouse_rotate.test.ts +62 -0
- package/src/ui/handler/one_finger_touch_drag.ts +45 -0
- package/src/ui/handler/one_finger_touch_drag_handler_interface.test.ts +77 -0
- package/src/ui/handler/scroll_zoom.test.ts +382 -0
- package/src/ui/handler/scroll_zoom.ts +379 -0
- package/src/ui/handler/shim/dblclick_zoom.ts +64 -0
- package/src/ui/handler/shim/drag_pan.ts +104 -0
- package/src/ui/handler/shim/drag_rotate.ts +76 -0
- package/src/ui/handler/shim/two_fingers_touch.ts +112 -0
- package/src/ui/handler/tap_drag_zoom.test.ts +113 -0
- package/src/ui/handler/tap_drag_zoom.ts +112 -0
- package/src/ui/handler/tap_recognizer.ts +138 -0
- package/src/ui/handler/tap_zoom.ts +98 -0
- package/src/ui/handler/touch_pan.ts +115 -0
- package/src/ui/handler/transform-provider.ts +44 -0
- package/src/ui/handler/two_fingers_touch.test.ts +283 -0
- package/src/ui/handler/two_fingers_touch.ts +336 -0
- package/src/ui/handler_inertia.ts +157 -0
- package/src/ui/handler_manager.ts +637 -0
- package/src/ui/hash.test.ts +404 -0
- package/src/ui/hash.ts +153 -0
- package/src/ui/map.ts +3393 -0
- package/src/ui/map_tests/map_animation.test.ts +61 -0
- package/src/ui/map_tests/map_basic.test.ts +223 -0
- package/src/ui/map_tests/map_bounds.test.ts +123 -0
- package/src/ui/map_tests/map_calculate_camera_options.test.ts +113 -0
- package/src/ui/map_tests/map_canvas.test.ts +59 -0
- package/src/ui/map_tests/map_control.test.ts +61 -0
- package/src/ui/map_tests/map_disable_handlers.test.ts +38 -0
- package/src/ui/map_tests/map_events.test.ts +1001 -0
- package/src/ui/map_tests/map_feature_state.test.ts +421 -0
- package/src/ui/map_tests/map_images.test.ts +175 -0
- package/src/ui/map_tests/map_is_moving.test.ts +164 -0
- package/src/ui/map_tests/map_is_rotating.test.ts +62 -0
- package/src/ui/map_tests/map_is_zooming.test.ts +86 -0
- package/src/ui/map_tests/map_layer.test.ts +457 -0
- package/src/ui/map_tests/map_options.test.ts +64 -0
- package/src/ui/map_tests/map_pitch.test.ts +90 -0
- package/src/ui/map_tests/map_pixel_ratio.test.ts +75 -0
- package/src/ui/map_tests/map_query_rendered_features.test.ts +93 -0
- package/src/ui/map_tests/map_render.test.ts +90 -0
- package/src/ui/map_tests/map_request_render_frame.test.ts +51 -0
- package/src/ui/map_tests/map_resize.test.ts +120 -0
- package/src/ui/map_tests/map_style.test.ts +541 -0
- package/src/ui/map_tests/map_terrian.test.ts +104 -0
- package/src/ui/map_tests/map_webgl.test.ts +72 -0
- package/src/ui/map_tests/map_world_copies.test.ts +103 -0
- package/src/ui/map_tests/map_zoom.test.ts +95 -0
- package/src/ui/marker.test.ts +1149 -0
- package/src/ui/marker.ts +880 -0
- package/src/ui/popup.test.ts +827 -0
- package/src/ui/popup.ts +717 -0
- package/src/util/abort_error.ts +21 -0
- package/src/util/actor.test.ts +218 -0
- package/src/util/actor.ts +241 -0
- package/src/util/actor_messages.ts +149 -0
- package/src/util/ajax.test.ts +237 -0
- package/src/util/ajax.ts +297 -0
- package/src/util/browser.test.ts +23 -0
- package/src/util/browser.ts +63 -0
- package/src/util/color_ramp.test.ts +105 -0
- package/src/util/color_ramp.ts +56 -0
- package/src/util/config.ts +29 -0
- package/src/util/dictionary_coder.ts +23 -0
- package/src/util/dispatcher.test.ts +76 -0
- package/src/util/dispatcher.ts +78 -0
- package/src/util/dom.ts +135 -0
- package/src/util/evented.test.ts +231 -0
- package/src/util/evented.ts +178 -0
- package/src/util/find_pole_of_inaccessibility.test.ts +21 -0
- package/src/util/find_pole_of_inaccessibility.ts +130 -0
- package/src/util/geolocation_support.test.ts +43 -0
- package/src/util/geolocation_support.ts +23 -0
- package/src/util/global_worker_pool.ts +65 -0
- package/src/util/image.ts +150 -0
- package/src/util/image_request.test.ts +408 -0
- package/src/util/image_request.ts +246 -0
- package/src/util/intersection_tests.ts +206 -0
- package/src/util/is_char_in_unicode_block.test.ts +15 -0
- package/src/util/is_char_in_unicode_block.ts +345 -0
- package/src/util/offscreen_canvas_distorted.test.ts +13 -0
- package/src/util/offscreen_canvas_distorted.ts +39 -0
- package/src/util/offscreen_canvas_supported.ts +11 -0
- package/src/util/performance.ts +117 -0
- package/src/util/primitives.test.ts +140 -0
- package/src/util/primitives.ts +143 -0
- package/src/util/request_manager.ts +42 -0
- package/src/util/resolve_tokens.test.ts +45 -0
- package/src/util/resolve_tokens.ts +17 -0
- package/src/util/script_detection.test.ts +138 -0
- package/src/util/script_detection.ts +376 -0
- package/src/util/smart_wrap.test.ts +97 -0
- package/src/util/smart_wrap.ts +58 -0
- package/src/util/struct_array.test.ts +101 -0
- package/src/util/struct_array.ts +246 -0
- package/src/util/style.test.ts +34 -0
- package/src/util/style.ts +28 -0
- package/src/util/task_queue.test.ts +114 -0
- package/src/util/task_queue.ts +64 -0
- package/src/util/test/util.ts +185 -0
- package/src/util/throttle.test.ts +42 -0
- package/src/util/throttle.ts +28 -0
- package/src/util/throttled_invoker.ts +41 -0
- package/src/util/transferable_grid_index.test.ts +56 -0
- package/src/util/transferable_grid_index.ts +214 -0
- package/src/util/util.test.ts +414 -0
- package/src/util/util.ts +724 -0
- package/src/util/vectortile_to_geojson.ts +72 -0
- package/src/util/verticalize_punctuation.ts +110 -0
- package/src/util/web_worker.ts +16 -0
- package/src/util/web_worker_transfer.test.ts +153 -0
- package/src/util/web_worker_transfer.ts +254 -0
- package/src/util/webp_supported.ts +63 -0
- package/src/util/worker_pool.test.ts +43 -0
- package/src/util/worker_pool.ts +58 -0
- package/src/util/world_bounds.test.ts +59 -0
- package/src/util/world_bounds.ts +46 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import {StyleLayer} from '../style_layer';
|
|
2
|
+
|
|
3
|
+
import {FillExtrusionBucket} from '../../data/bucket/fill_extrusion_bucket';
|
|
4
|
+
import {polygonIntersectsPolygon, polygonIntersectsMultiPolygon} from '../../util/intersection_tests';
|
|
5
|
+
import {translateDistance, translate} from '../query_utils';
|
|
6
|
+
import properties, {FillExtrusionPaintPropsPossiblyEvaluated} from './fill_extrusion_style_layer_properties.g';
|
|
7
|
+
import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
|
|
8
|
+
import {mat4, vec4} from 'gl-matrix';
|
|
9
|
+
import Point from '@mapbox/point-geometry';
|
|
10
|
+
import type {FeatureState, LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
11
|
+
import type {BucketParameters} from '../../data/bucket';
|
|
12
|
+
import type {FillExtrusionPaintProps} from './fill_extrusion_style_layer_properties.g';
|
|
13
|
+
import type {Transform} from '../../geo/transform';
|
|
14
|
+
import type {VectorTileFeature} from '@mapbox/vector-tile';
|
|
15
|
+
|
|
16
|
+
export class Point3D extends Point {
|
|
17
|
+
z: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class FillExtrusionStyleLayer extends StyleLayer {
|
|
21
|
+
_transitionablePaint: Transitionable<FillExtrusionPaintProps>;
|
|
22
|
+
_transitioningPaint: Transitioning<FillExtrusionPaintProps>;
|
|
23
|
+
paint: PossiblyEvaluated<FillExtrusionPaintProps, FillExtrusionPaintPropsPossiblyEvaluated>;
|
|
24
|
+
|
|
25
|
+
constructor(layer: LayerSpecification) {
|
|
26
|
+
super(layer, properties);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
createBucket(parameters: BucketParameters<FillExtrusionStyleLayer>) {
|
|
30
|
+
return new FillExtrusionBucket(parameters);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
queryRadius(): number {
|
|
34
|
+
return translateDistance(this.paint.get('fill-extrusion-translate'));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
is3D(): boolean {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
queryIntersectsFeature(
|
|
42
|
+
queryGeometry: Array<Point>,
|
|
43
|
+
feature: VectorTileFeature,
|
|
44
|
+
featureState: FeatureState,
|
|
45
|
+
geometry: Array<Array<Point>>,
|
|
46
|
+
zoom: number,
|
|
47
|
+
transform: Transform,
|
|
48
|
+
pixelsToTileUnits: number,
|
|
49
|
+
pixelPosMatrix: mat4
|
|
50
|
+
): boolean | number {
|
|
51
|
+
|
|
52
|
+
const translatedPolygon = translate(queryGeometry,
|
|
53
|
+
this.paint.get('fill-extrusion-translate'),
|
|
54
|
+
this.paint.get('fill-extrusion-translate-anchor'),
|
|
55
|
+
transform.angle, pixelsToTileUnits);
|
|
56
|
+
|
|
57
|
+
const height = this.paint.get('fill-extrusion-height').evaluate(feature, featureState);
|
|
58
|
+
const base = this.paint.get('fill-extrusion-base').evaluate(feature, featureState);
|
|
59
|
+
|
|
60
|
+
const projectedQueryGeometry = projectQueryGeometry(translatedPolygon, pixelPosMatrix, transform, 0);
|
|
61
|
+
|
|
62
|
+
const projected = projectExtrusion(geometry, base, height, pixelPosMatrix);
|
|
63
|
+
const projectedBase = projected[0];
|
|
64
|
+
const projectedTop = projected[1];
|
|
65
|
+
return checkIntersection(projectedBase, projectedTop, projectedQueryGeometry);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function dot(a, b) {
|
|
70
|
+
return a.x * b.x + a.y * b.y;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getIntersectionDistance(projectedQueryGeometry: Array<Point3D>, projectedFace: Array<Point3D>) {
|
|
74
|
+
|
|
75
|
+
if (projectedQueryGeometry.length === 1) {
|
|
76
|
+
// For point queries calculate the z at which the point intersects the face
|
|
77
|
+
// using barycentric coordinates.
|
|
78
|
+
|
|
79
|
+
// Find the barycentric coordinates of the projected point within the first
|
|
80
|
+
// triangle of the face, using only the xy plane. It doesn't matter if the
|
|
81
|
+
// point is outside the first triangle because all the triangles in the face
|
|
82
|
+
// are in the same plane.
|
|
83
|
+
//
|
|
84
|
+
// Check whether points are coincident and use other points if they are.
|
|
85
|
+
let i = 0;
|
|
86
|
+
const a = projectedFace[i++];
|
|
87
|
+
let b;
|
|
88
|
+
while (!b || a.equals(b)) {
|
|
89
|
+
b = projectedFace[i++];
|
|
90
|
+
if (!b) return Infinity;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Loop until point `c` is not colinear with points `a` and `b`.
|
|
94
|
+
for (; i < projectedFace.length; i++) {
|
|
95
|
+
const c = projectedFace[i];
|
|
96
|
+
|
|
97
|
+
const p = projectedQueryGeometry[0];
|
|
98
|
+
|
|
99
|
+
const ab = b.sub(a);
|
|
100
|
+
const ac = c.sub(a);
|
|
101
|
+
const ap = p.sub(a);
|
|
102
|
+
|
|
103
|
+
const dotABAB = dot(ab, ab);
|
|
104
|
+
const dotABAC = dot(ab, ac);
|
|
105
|
+
const dotACAC = dot(ac, ac);
|
|
106
|
+
const dotAPAB = dot(ap, ab);
|
|
107
|
+
const dotAPAC = dot(ap, ac);
|
|
108
|
+
const denom = dotABAB * dotACAC - dotABAC * dotABAC;
|
|
109
|
+
|
|
110
|
+
const v = (dotACAC * dotAPAB - dotABAC * dotAPAC) / denom;
|
|
111
|
+
const w = (dotABAB * dotAPAC - dotABAC * dotAPAB) / denom;
|
|
112
|
+
const u = 1 - v - w;
|
|
113
|
+
|
|
114
|
+
// Use the barycentric weighting along with the original triangle z coordinates to get the point of intersection.
|
|
115
|
+
const distance = a.z * u + b.z * v + c.z * w;
|
|
116
|
+
|
|
117
|
+
if (isFinite(distance)) return distance;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return Infinity;
|
|
121
|
+
|
|
122
|
+
} else {
|
|
123
|
+
// The counts as closest is less clear when the query is a box. This
|
|
124
|
+
// returns the distance to the nearest point on the face, whether it is
|
|
125
|
+
// within the query or not. It could be more correct to return the
|
|
126
|
+
// distance to the closest point within the query box but this would be
|
|
127
|
+
// more complicated and expensive to calculate with little benefit.
|
|
128
|
+
let closestDistance = Infinity;
|
|
129
|
+
for (const p of projectedFace) {
|
|
130
|
+
closestDistance = Math.min(closestDistance, p.z);
|
|
131
|
+
}
|
|
132
|
+
return closestDistance;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function checkIntersection(projectedBase: Array<Array<Point3D>>, projectedTop: Array<Array<Point3D>>, projectedQueryGeometry: Array<Point3D>) {
|
|
137
|
+
let closestDistance = Infinity;
|
|
138
|
+
|
|
139
|
+
if (polygonIntersectsMultiPolygon(projectedQueryGeometry, projectedTop)) {
|
|
140
|
+
closestDistance = getIntersectionDistance(projectedQueryGeometry, projectedTop[0]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
for (let r = 0; r < projectedTop.length; r++) {
|
|
144
|
+
const ringTop = projectedTop[r];
|
|
145
|
+
const ringBase = projectedBase[r];
|
|
146
|
+
for (let p = 0; p < ringTop.length - 1; p++) {
|
|
147
|
+
const topA = ringTop[p];
|
|
148
|
+
const topB = ringTop[p + 1];
|
|
149
|
+
const baseA = ringBase[p];
|
|
150
|
+
const baseB = ringBase[p + 1];
|
|
151
|
+
const face = [topA, topB, baseB, baseA, topA];
|
|
152
|
+
if (polygonIntersectsPolygon(projectedQueryGeometry, face)) {
|
|
153
|
+
closestDistance = Math.min(closestDistance, getIntersectionDistance(projectedQueryGeometry, face));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return closestDistance === Infinity ? false : closestDistance;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
* Project the geometry using matrix `m`. This is essentially doing
|
|
163
|
+
* `vec4.transformMat4([], [p.x, p.y, z, 1], m)` but the multiplication
|
|
164
|
+
* is inlined so that parts of the projection that are the same across
|
|
165
|
+
* different points can only be done once. This produced a measurable
|
|
166
|
+
* performance improvement.
|
|
167
|
+
*/
|
|
168
|
+
function projectExtrusion(geometry: Array<Array<Point>>, zBase: number, zTop: number, m: mat4): [Array<Array<Point3D>>, Array<Array<Point3D>>] {
|
|
169
|
+
const projectedBase = [] as Array<Array<Point3D>>;
|
|
170
|
+
const projectedTop = [] as Array<Array<Point3D>>;
|
|
171
|
+
const baseXZ = m[8] * zBase;
|
|
172
|
+
const baseYZ = m[9] * zBase;
|
|
173
|
+
const baseZZ = m[10] * zBase;
|
|
174
|
+
const baseWZ = m[11] * zBase;
|
|
175
|
+
const topXZ = m[8] * zTop;
|
|
176
|
+
const topYZ = m[9] * zTop;
|
|
177
|
+
const topZZ = m[10] * zTop;
|
|
178
|
+
const topWZ = m[11] * zTop;
|
|
179
|
+
|
|
180
|
+
for (const r of geometry) {
|
|
181
|
+
const ringBase = [] as Array<Point3D>;
|
|
182
|
+
const ringTop = [] as Array<Point3D>;
|
|
183
|
+
for (const p of r) {
|
|
184
|
+
const x = p.x;
|
|
185
|
+
const y = p.y;
|
|
186
|
+
|
|
187
|
+
const sX = m[0] * x + m[4] * y + m[12];
|
|
188
|
+
const sY = m[1] * x + m[5] * y + m[13];
|
|
189
|
+
const sZ = m[2] * x + m[6] * y + m[14];
|
|
190
|
+
const sW = m[3] * x + m[7] * y + m[15];
|
|
191
|
+
|
|
192
|
+
const baseX = sX + baseXZ;
|
|
193
|
+
const baseY = sY + baseYZ;
|
|
194
|
+
const baseZ = sZ + baseZZ;
|
|
195
|
+
const baseW = sW + baseWZ;
|
|
196
|
+
|
|
197
|
+
const topX = sX + topXZ;
|
|
198
|
+
const topY = sY + topYZ;
|
|
199
|
+
const topZ = sZ + topZZ;
|
|
200
|
+
const topW = sW + topWZ;
|
|
201
|
+
|
|
202
|
+
const b = new Point(baseX / baseW, baseY / baseW) as Point3D;
|
|
203
|
+
b.z = baseZ / baseW;
|
|
204
|
+
ringBase.push(b);
|
|
205
|
+
|
|
206
|
+
const t = new Point(topX / topW, topY / topW) as Point3D;
|
|
207
|
+
t.z = topZ / topW;
|
|
208
|
+
ringTop.push(t);
|
|
209
|
+
}
|
|
210
|
+
projectedBase.push(ringBase);
|
|
211
|
+
projectedTop.push(ringTop);
|
|
212
|
+
}
|
|
213
|
+
return [projectedBase, projectedTop];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function projectQueryGeometry(queryGeometry: Array<Point>, pixelPosMatrix: mat4, transform: Transform, z: number) {
|
|
217
|
+
const projectedQueryGeometry = [];
|
|
218
|
+
for (const p of queryGeometry) {
|
|
219
|
+
const v = [p.x, p.y, z, 1] as vec4;
|
|
220
|
+
vec4.transformMat4(v, v, pixelPosMatrix);
|
|
221
|
+
projectedQueryGeometry.push(new Point(v[0] / v[3], v[1] / v[3]));
|
|
222
|
+
}
|
|
223
|
+
return projectedQueryGeometry;
|
|
224
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
import {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Properties,
|
|
8
|
+
DataConstantProperty,
|
|
9
|
+
DataDrivenProperty,
|
|
10
|
+
CrossFadedDataDrivenProperty,
|
|
11
|
+
CrossFadedProperty,
|
|
12
|
+
ColorRampProperty,
|
|
13
|
+
PossiblyEvaluatedPropertyValue,
|
|
14
|
+
CrossFaded
|
|
15
|
+
} from '../properties';
|
|
16
|
+
|
|
17
|
+
import type {Color, Formatted, Padding, ResolvedImage, VariableAnchorOffsetCollection} from '@maplibre/maplibre-gl-style-spec';
|
|
18
|
+
import {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export type FillExtrusionPaintProps = {
|
|
22
|
+
"fill-extrusion-opacity": DataConstantProperty<number>,
|
|
23
|
+
"fill-extrusion-color": DataDrivenProperty<Color>,
|
|
24
|
+
"fill-extrusion-translate": DataConstantProperty<[number, number]>,
|
|
25
|
+
"fill-extrusion-translate-anchor": DataConstantProperty<"map" | "viewport">,
|
|
26
|
+
"fill-extrusion-pattern": CrossFadedDataDrivenProperty<ResolvedImage>,
|
|
27
|
+
"fill-extrusion-height": DataDrivenProperty<number>,
|
|
28
|
+
"fill-extrusion-base": DataDrivenProperty<number>,
|
|
29
|
+
"fill-extrusion-vertical-gradient": DataConstantProperty<boolean>,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type FillExtrusionPaintPropsPossiblyEvaluated = {
|
|
33
|
+
"fill-extrusion-opacity": number,
|
|
34
|
+
"fill-extrusion-color": PossiblyEvaluatedPropertyValue<Color>,
|
|
35
|
+
"fill-extrusion-translate": [number, number],
|
|
36
|
+
"fill-extrusion-translate-anchor": "map" | "viewport",
|
|
37
|
+
"fill-extrusion-pattern": PossiblyEvaluatedPropertyValue<CrossFaded<ResolvedImage>>,
|
|
38
|
+
"fill-extrusion-height": PossiblyEvaluatedPropertyValue<number>,
|
|
39
|
+
"fill-extrusion-base": PossiblyEvaluatedPropertyValue<number>,
|
|
40
|
+
"fill-extrusion-vertical-gradient": boolean,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let paint: Properties<FillExtrusionPaintProps>;
|
|
44
|
+
const getPaint = () => paint = paint || new Properties({
|
|
45
|
+
"fill-extrusion-opacity": new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-opacity"] as any as StylePropertySpecification),
|
|
46
|
+
"fill-extrusion-color": new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-color"] as any as StylePropertySpecification),
|
|
47
|
+
"fill-extrusion-translate": new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-translate"] as any as StylePropertySpecification),
|
|
48
|
+
"fill-extrusion-translate-anchor": new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-translate-anchor"] as any as StylePropertySpecification),
|
|
49
|
+
"fill-extrusion-pattern": new CrossFadedDataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-pattern"] as any as StylePropertySpecification),
|
|
50
|
+
"fill-extrusion-height": new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-height"] as any as StylePropertySpecification),
|
|
51
|
+
"fill-extrusion-base": new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-base"] as any as StylePropertySpecification),
|
|
52
|
+
"fill-extrusion-vertical-gradient": new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"] as any as StylePropertySpecification),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export default ({ get paint() { return getPaint() } });
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {getIntersectionDistance, Point3D} from './fill_extrusion_style_layer';
|
|
2
|
+
|
|
3
|
+
describe('getIntersectionDistance', () => {
|
|
4
|
+
const queryPoint = [new Point3D(100, 100)];
|
|
5
|
+
const z = 3;
|
|
6
|
+
const a = new Point3D(100, -90);
|
|
7
|
+
const b = new Point3D(110, 110);
|
|
8
|
+
const c = new Point3D(-110, 110);
|
|
9
|
+
a.z = z;
|
|
10
|
+
b.z = z;
|
|
11
|
+
c.z = z;
|
|
12
|
+
|
|
13
|
+
test('one point', () => {
|
|
14
|
+
const projectedFace = [a, a];
|
|
15
|
+
expect(getIntersectionDistance(queryPoint, projectedFace)).toBe(Infinity);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('two points', () => {
|
|
19
|
+
const projectedFace = [a, b, a];
|
|
20
|
+
expect(getIntersectionDistance(queryPoint, projectedFace)).toBe(Infinity);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('two points coincident', () => {
|
|
24
|
+
const projectedFace = [a, a, a, b, b, b, b, a];
|
|
25
|
+
expect(getIntersectionDistance(queryPoint, projectedFace)).toBe(Infinity);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('three points', () => {
|
|
29
|
+
const projectedFace = [a, b, c, a];
|
|
30
|
+
expect(getIntersectionDistance(queryPoint, projectedFace)).toBe(z);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('three points coincident points', () => {
|
|
34
|
+
const projectedFace = [a, a, b, b, b, c, c, a];
|
|
35
|
+
expect(getIntersectionDistance(queryPoint, projectedFace)).toBe(z);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {StyleLayer} from '../style_layer';
|
|
2
|
+
|
|
3
|
+
import {FillBucket} from '../../data/bucket/fill_bucket';
|
|
4
|
+
import {polygonIntersectsMultiPolygon} from '../../util/intersection_tests';
|
|
5
|
+
import {translateDistance, translate} from '../query_utils';
|
|
6
|
+
import properties, {FillLayoutPropsPossiblyEvaluated, FillPaintPropsPossiblyEvaluated} from './fill_style_layer_properties.g';
|
|
7
|
+
import {Transitionable, Transitioning, Layout, PossiblyEvaluated} from '../properties';
|
|
8
|
+
|
|
9
|
+
import type {FeatureState, LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
10
|
+
import type {BucketParameters} from '../../data/bucket';
|
|
11
|
+
import type Point from '@mapbox/point-geometry';
|
|
12
|
+
import type {FillLayoutProps, FillPaintProps} from './fill_style_layer_properties.g';
|
|
13
|
+
import type {EvaluationParameters} from '../evaluation_parameters';
|
|
14
|
+
import type {Transform} from '../../geo/transform';
|
|
15
|
+
import type {VectorTileFeature} from '@mapbox/vector-tile';
|
|
16
|
+
|
|
17
|
+
export class FillStyleLayer extends StyleLayer {
|
|
18
|
+
_unevaluatedLayout: Layout<FillLayoutProps>;
|
|
19
|
+
layout: PossiblyEvaluated<FillLayoutProps, FillLayoutPropsPossiblyEvaluated>;
|
|
20
|
+
|
|
21
|
+
_transitionablePaint: Transitionable<FillPaintProps>;
|
|
22
|
+
_transitioningPaint: Transitioning<FillPaintProps>;
|
|
23
|
+
paint: PossiblyEvaluated<FillPaintProps, FillPaintPropsPossiblyEvaluated>;
|
|
24
|
+
|
|
25
|
+
constructor(layer: LayerSpecification) {
|
|
26
|
+
super(layer, properties);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
recalculate(parameters: EvaluationParameters, availableImages: Array<string>) {
|
|
30
|
+
super.recalculate(parameters, availableImages);
|
|
31
|
+
|
|
32
|
+
const outlineColor = this.paint._values['fill-outline-color'];
|
|
33
|
+
if (outlineColor.value.kind === 'constant' && outlineColor.value.value === undefined) {
|
|
34
|
+
this.paint._values['fill-outline-color'] = this.paint._values['fill-color'];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
createBucket(parameters: BucketParameters<any>) {
|
|
39
|
+
return new FillBucket(parameters);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
queryRadius(): number {
|
|
43
|
+
return translateDistance(this.paint.get('fill-translate'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
queryIntersectsFeature(
|
|
47
|
+
queryGeometry: Array<Point>,
|
|
48
|
+
feature: VectorTileFeature,
|
|
49
|
+
featureState: FeatureState,
|
|
50
|
+
geometry: Array<Array<Point>>,
|
|
51
|
+
zoom: number,
|
|
52
|
+
transform: Transform,
|
|
53
|
+
pixelsToTileUnits: number
|
|
54
|
+
): boolean {
|
|
55
|
+
const translatedPolygon = translate(queryGeometry,
|
|
56
|
+
this.paint.get('fill-translate'),
|
|
57
|
+
this.paint.get('fill-translate-anchor'),
|
|
58
|
+
transform.angle, pixelsToTileUnits);
|
|
59
|
+
return polygonIntersectsMultiPolygon(translatedPolygon, geometry);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
isTileClipped() {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
import {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Properties,
|
|
8
|
+
DataConstantProperty,
|
|
9
|
+
DataDrivenProperty,
|
|
10
|
+
CrossFadedDataDrivenProperty,
|
|
11
|
+
CrossFadedProperty,
|
|
12
|
+
ColorRampProperty,
|
|
13
|
+
PossiblyEvaluatedPropertyValue,
|
|
14
|
+
CrossFaded
|
|
15
|
+
} from '../properties';
|
|
16
|
+
|
|
17
|
+
import type {Color, Formatted, Padding, ResolvedImage, VariableAnchorOffsetCollection} from '@maplibre/maplibre-gl-style-spec';
|
|
18
|
+
import {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
19
|
+
|
|
20
|
+
export type FillLayoutProps = {
|
|
21
|
+
"fill-sort-key": DataDrivenProperty<number>,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type FillLayoutPropsPossiblyEvaluated = {
|
|
25
|
+
"fill-sort-key": PossiblyEvaluatedPropertyValue<number>,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
let layout: Properties<FillLayoutProps>;
|
|
29
|
+
const getLayout = () => layout = layout || new Properties({
|
|
30
|
+
"fill-sort-key": new DataDrivenProperty(styleSpec["layout_fill"]["fill-sort-key"] as any as StylePropertySpecification),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type FillPaintProps = {
|
|
34
|
+
"fill-antialias": DataConstantProperty<boolean>,
|
|
35
|
+
"fill-opacity": DataDrivenProperty<number>,
|
|
36
|
+
"fill-color": DataDrivenProperty<Color>,
|
|
37
|
+
"fill-outline-color": DataDrivenProperty<Color>,
|
|
38
|
+
"fill-translate": DataConstantProperty<[number, number]>,
|
|
39
|
+
"fill-translate-anchor": DataConstantProperty<"map" | "viewport">,
|
|
40
|
+
"fill-pattern": CrossFadedDataDrivenProperty<ResolvedImage>,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type FillPaintPropsPossiblyEvaluated = {
|
|
44
|
+
"fill-antialias": boolean,
|
|
45
|
+
"fill-opacity": PossiblyEvaluatedPropertyValue<number>,
|
|
46
|
+
"fill-color": PossiblyEvaluatedPropertyValue<Color>,
|
|
47
|
+
"fill-outline-color": PossiblyEvaluatedPropertyValue<Color>,
|
|
48
|
+
"fill-translate": [number, number],
|
|
49
|
+
"fill-translate-anchor": "map" | "viewport",
|
|
50
|
+
"fill-pattern": PossiblyEvaluatedPropertyValue<CrossFaded<ResolvedImage>>,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
let paint: Properties<FillPaintProps>;
|
|
54
|
+
const getPaint = () => paint = paint || new Properties({
|
|
55
|
+
"fill-antialias": new DataConstantProperty(styleSpec["paint_fill"]["fill-antialias"] as any as StylePropertySpecification),
|
|
56
|
+
"fill-opacity": new DataDrivenProperty(styleSpec["paint_fill"]["fill-opacity"] as any as StylePropertySpecification),
|
|
57
|
+
"fill-color": new DataDrivenProperty(styleSpec["paint_fill"]["fill-color"] as any as StylePropertySpecification),
|
|
58
|
+
"fill-outline-color": new DataDrivenProperty(styleSpec["paint_fill"]["fill-outline-color"] as any as StylePropertySpecification),
|
|
59
|
+
"fill-translate": new DataConstantProperty(styleSpec["paint_fill"]["fill-translate"] as any as StylePropertySpecification),
|
|
60
|
+
"fill-translate-anchor": new DataConstantProperty(styleSpec["paint_fill"]["fill-translate-anchor"] as any as StylePropertySpecification),
|
|
61
|
+
"fill-pattern": new CrossFadedDataDrivenProperty(styleSpec["paint_fill"]["fill-pattern"] as any as StylePropertySpecification),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export default ({ get paint() { return getPaint() }, get layout() { return getLayout() } });
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {StyleLayer} from '../style_layer';
|
|
2
|
+
|
|
3
|
+
import {HeatmapBucket} from '../../data/bucket/heatmap_bucket';
|
|
4
|
+
import {RGBAImage} from '../../util/image';
|
|
5
|
+
import properties, {HeatmapPaintPropsPossiblyEvaluated} from './heatmap_style_layer_properties.g';
|
|
6
|
+
import {renderColorRamp} from '../../util/color_ramp';
|
|
7
|
+
import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
|
|
8
|
+
|
|
9
|
+
import type {Texture} from '../../render/texture';
|
|
10
|
+
import type {Framebuffer} from '../../gl/framebuffer';
|
|
11
|
+
import type {HeatmapPaintProps} from './heatmap_style_layer_properties.g';
|
|
12
|
+
import type {LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
13
|
+
|
|
14
|
+
export const HEATMAP_FULL_RENDER_FBO_KEY = 'big-fb';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A style layer that defines a heatmap
|
|
18
|
+
*/
|
|
19
|
+
export class HeatmapStyleLayer extends StyleLayer {
|
|
20
|
+
|
|
21
|
+
heatmapFbos: Map<string, Framebuffer>;
|
|
22
|
+
colorRamp: RGBAImage;
|
|
23
|
+
colorRampTexture: Texture;
|
|
24
|
+
|
|
25
|
+
_transitionablePaint: Transitionable<HeatmapPaintProps>;
|
|
26
|
+
_transitioningPaint: Transitioning<HeatmapPaintProps>;
|
|
27
|
+
paint: PossiblyEvaluated<HeatmapPaintProps, HeatmapPaintPropsPossiblyEvaluated>;
|
|
28
|
+
|
|
29
|
+
createBucket(options: any) {
|
|
30
|
+
return new HeatmapBucket(options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
constructor(layer: LayerSpecification) {
|
|
34
|
+
super(layer, properties);
|
|
35
|
+
|
|
36
|
+
this.heatmapFbos = new Map();
|
|
37
|
+
// make sure color ramp texture is generated for default heatmap color too
|
|
38
|
+
this._updateColorRamp();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_handleSpecialPaintPropertyUpdate(name: string) {
|
|
42
|
+
if (name === 'heatmap-color') {
|
|
43
|
+
this._updateColorRamp();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_updateColorRamp() {
|
|
48
|
+
const expression = this._transitionablePaint._values['heatmap-color'].value.expression;
|
|
49
|
+
this.colorRamp = renderColorRamp({
|
|
50
|
+
expression,
|
|
51
|
+
evaluationKey: 'heatmapDensity',
|
|
52
|
+
image: this.colorRamp
|
|
53
|
+
});
|
|
54
|
+
this.colorRampTexture = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
resize() {
|
|
58
|
+
if (this.heatmapFbos.has(HEATMAP_FULL_RENDER_FBO_KEY)) {
|
|
59
|
+
this.heatmapFbos.delete(HEATMAP_FULL_RENDER_FBO_KEY);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
queryRadius(): number {
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
queryIntersectsFeature(): boolean {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
hasOffscreenPass() {
|
|
72
|
+
return this.paint.get('heatmap-opacity') !== 0 && this.visibility !== 'none';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
import {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Properties,
|
|
8
|
+
DataConstantProperty,
|
|
9
|
+
DataDrivenProperty,
|
|
10
|
+
CrossFadedDataDrivenProperty,
|
|
11
|
+
CrossFadedProperty,
|
|
12
|
+
ColorRampProperty,
|
|
13
|
+
PossiblyEvaluatedPropertyValue,
|
|
14
|
+
CrossFaded
|
|
15
|
+
} from '../properties';
|
|
16
|
+
|
|
17
|
+
import type {Color, Formatted, Padding, ResolvedImage, VariableAnchorOffsetCollection} from '@maplibre/maplibre-gl-style-spec';
|
|
18
|
+
import {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export type HeatmapPaintProps = {
|
|
22
|
+
"heatmap-radius": DataDrivenProperty<number>,
|
|
23
|
+
"heatmap-weight": DataDrivenProperty<number>,
|
|
24
|
+
"heatmap-intensity": DataConstantProperty<number>,
|
|
25
|
+
"heatmap-color": ColorRampProperty,
|
|
26
|
+
"heatmap-opacity": DataConstantProperty<number>,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type HeatmapPaintPropsPossiblyEvaluated = {
|
|
30
|
+
"heatmap-radius": PossiblyEvaluatedPropertyValue<number>,
|
|
31
|
+
"heatmap-weight": PossiblyEvaluatedPropertyValue<number>,
|
|
32
|
+
"heatmap-intensity": number,
|
|
33
|
+
"heatmap-color": ColorRampProperty,
|
|
34
|
+
"heatmap-opacity": number,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let paint: Properties<HeatmapPaintProps>;
|
|
38
|
+
const getPaint = () => paint = paint || new Properties({
|
|
39
|
+
"heatmap-radius": new DataDrivenProperty(styleSpec["paint_heatmap"]["heatmap-radius"] as any as StylePropertySpecification),
|
|
40
|
+
"heatmap-weight": new DataDrivenProperty(styleSpec["paint_heatmap"]["heatmap-weight"] as any as StylePropertySpecification),
|
|
41
|
+
"heatmap-intensity": new DataConstantProperty(styleSpec["paint_heatmap"]["heatmap-intensity"] as any as StylePropertySpecification),
|
|
42
|
+
"heatmap-color": new ColorRampProperty(styleSpec["paint_heatmap"]["heatmap-color"] as any as StylePropertySpecification),
|
|
43
|
+
"heatmap-opacity": new DataConstantProperty(styleSpec["paint_heatmap"]["heatmap-opacity"] as any as StylePropertySpecification),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export default ({ get paint() { return getPaint() } });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {StyleLayer} from '../style_layer';
|
|
2
|
+
|
|
3
|
+
import properties, {HillshadePaintPropsPossiblyEvaluated} from './hillshade_style_layer_properties.g';
|
|
4
|
+
import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
|
|
5
|
+
|
|
6
|
+
import type {HillshadePaintProps} from './hillshade_style_layer_properties.g';
|
|
7
|
+
import type {LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
8
|
+
|
|
9
|
+
export class HillshadeStyleLayer extends StyleLayer {
|
|
10
|
+
_transitionablePaint: Transitionable<HillshadePaintProps>;
|
|
11
|
+
_transitioningPaint: Transitioning<HillshadePaintProps>;
|
|
12
|
+
paint: PossiblyEvaluated<HillshadePaintProps, HillshadePaintPropsPossiblyEvaluated>;
|
|
13
|
+
|
|
14
|
+
constructor(layer: LayerSpecification) {
|
|
15
|
+
super(layer, properties);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
hasOffscreenPass() {
|
|
19
|
+
return this.paint.get('hillshade-exaggeration') !== 0 && this.visibility !== 'none';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// This file is generated. Edit build/generate-style-code.ts, then run 'npm run codegen'.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
import {latest as styleSpec} from '@maplibre/maplibre-gl-style-spec';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Properties,
|
|
8
|
+
DataConstantProperty,
|
|
9
|
+
DataDrivenProperty,
|
|
10
|
+
CrossFadedDataDrivenProperty,
|
|
11
|
+
CrossFadedProperty,
|
|
12
|
+
ColorRampProperty,
|
|
13
|
+
PossiblyEvaluatedPropertyValue,
|
|
14
|
+
CrossFaded
|
|
15
|
+
} from '../properties';
|
|
16
|
+
|
|
17
|
+
import type {Color, Formatted, Padding, ResolvedImage, VariableAnchorOffsetCollection} from '@maplibre/maplibre-gl-style-spec';
|
|
18
|
+
import {StylePropertySpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export type HillshadePaintProps = {
|
|
22
|
+
"hillshade-illumination-direction": DataConstantProperty<number>,
|
|
23
|
+
"hillshade-illumination-anchor": DataConstantProperty<"map" | "viewport">,
|
|
24
|
+
"hillshade-exaggeration": DataConstantProperty<number>,
|
|
25
|
+
"hillshade-shadow-color": DataConstantProperty<Color>,
|
|
26
|
+
"hillshade-highlight-color": DataConstantProperty<Color>,
|
|
27
|
+
"hillshade-accent-color": DataConstantProperty<Color>,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type HillshadePaintPropsPossiblyEvaluated = {
|
|
31
|
+
"hillshade-illumination-direction": number,
|
|
32
|
+
"hillshade-illumination-anchor": "map" | "viewport",
|
|
33
|
+
"hillshade-exaggeration": number,
|
|
34
|
+
"hillshade-shadow-color": Color,
|
|
35
|
+
"hillshade-highlight-color": Color,
|
|
36
|
+
"hillshade-accent-color": Color,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let paint: Properties<HillshadePaintProps>;
|
|
40
|
+
const getPaint = () => paint = paint || new Properties({
|
|
41
|
+
"hillshade-illumination-direction": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-illumination-direction"] as any as StylePropertySpecification),
|
|
42
|
+
"hillshade-illumination-anchor": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-illumination-anchor"] as any as StylePropertySpecification),
|
|
43
|
+
"hillshade-exaggeration": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-exaggeration"] as any as StylePropertySpecification),
|
|
44
|
+
"hillshade-shadow-color": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-shadow-color"] as any as StylePropertySpecification),
|
|
45
|
+
"hillshade-highlight-color": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-highlight-color"] as any as StylePropertySpecification),
|
|
46
|
+
"hillshade-accent-color": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-accent-color"] as any as StylePropertySpecification),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default ({ get paint() { return getPaint() } });
|