@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
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import Point from '@mapbox/point-geometry';
|
|
4
|
-
|
|
5
|
-
import StyleLayer from '../style_layer';
|
|
6
|
-
import LineBucket from '../../data/bucket/line_bucket';
|
|
7
|
-
import {RGBAImage} from '../../util/image';
|
|
8
|
-
import {polygonIntersectsBufferedMultiLine} from '../../util/intersection_tests';
|
|
9
|
-
import {getMaximumPaintValue, translateDistance, translate} from '../query_utils';
|
|
10
|
-
import properties from './line_style_layer_properties';
|
|
11
|
-
import {extend} from '../../util/util';
|
|
12
|
-
import EvaluationParameters from '../evaluation_parameters';
|
|
13
|
-
import renderColorRamp from '../../util/color_ramp';
|
|
14
|
-
import {Transitionable, Transitioning, Layout, PossiblyEvaluated, DataDrivenProperty} from '../properties';
|
|
15
|
-
|
|
16
|
-
import type {FeatureState} from '../../style-spec/expression';
|
|
17
|
-
import type {Bucket, BucketParameters} from '../../data/bucket';
|
|
18
|
-
import type {LayoutProps, PaintProps} from './line_style_layer_properties';
|
|
19
|
-
import type Transform from '../../geo/transform';
|
|
20
|
-
import type Texture from '../../render/texture';
|
|
21
|
-
import type {LayerSpecification} from '../../style-spec/types';
|
|
22
|
-
|
|
23
|
-
class LineFloorwidthProperty extends DataDrivenProperty<number> {
|
|
24
|
-
useIntegerZoom: true;
|
|
25
|
-
|
|
26
|
-
possiblyEvaluate(value, parameters) {
|
|
27
|
-
parameters = new EvaluationParameters(Math.floor(parameters.zoom), {
|
|
28
|
-
now: parameters.now,
|
|
29
|
-
fadeDuration: parameters.fadeDuration,
|
|
30
|
-
zoomHistory: parameters.zoomHistory,
|
|
31
|
-
transition: parameters.transition
|
|
32
|
-
});
|
|
33
|
-
return super.possiblyEvaluate(value, parameters);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
evaluate(value, globals, feature, featureState) {
|
|
37
|
-
globals = extend({}, globals, {zoom: Math.floor(globals.zoom)});
|
|
38
|
-
return super.evaluate(value, globals, feature, featureState);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const lineFloorwidthProperty = new LineFloorwidthProperty(properties.paint.properties['line-width'].specification);
|
|
43
|
-
lineFloorwidthProperty.useIntegerZoom = true;
|
|
44
|
-
|
|
45
|
-
class LineStyleLayer extends StyleLayer {
|
|
46
|
-
_unevaluatedLayout: Layout<LayoutProps>;
|
|
47
|
-
layout: PossiblyEvaluated<LayoutProps>;
|
|
48
|
-
|
|
49
|
-
gradient: ?RGBAImage;
|
|
50
|
-
gradientTexture: ?Texture;
|
|
51
|
-
|
|
52
|
-
_transitionablePaint: Transitionable<PaintProps>;
|
|
53
|
-
_transitioningPaint: Transitioning<PaintProps>;
|
|
54
|
-
paint: PossiblyEvaluated<PaintProps>;
|
|
55
|
-
|
|
56
|
-
constructor(layer: LayerSpecification) {
|
|
57
|
-
super(layer, properties);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
_handleSpecialPaintPropertyUpdate(name: string) {
|
|
61
|
-
if (name === 'line-gradient') {
|
|
62
|
-
this._updateGradient();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
_updateGradient() {
|
|
67
|
-
const expression = this._transitionablePaint._values['line-gradient'].value.expression;
|
|
68
|
-
this.gradient = renderColorRamp(expression, 'lineProgress');
|
|
69
|
-
this.gradientTexture = null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
recalculate(parameters: EvaluationParameters, availableImages: Array<string>) {
|
|
73
|
-
super.recalculate(parameters, availableImages);
|
|
74
|
-
|
|
75
|
-
(this.paint._values: any)['line-floorwidth'] =
|
|
76
|
-
lineFloorwidthProperty.possiblyEvaluate(this._transitioningPaint._values['line-width'].value, parameters);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
createBucket(parameters: BucketParameters<*>) {
|
|
80
|
-
return new LineBucket(parameters);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
queryRadius(bucket: Bucket): number {
|
|
84
|
-
const lineBucket: LineBucket = (bucket: any);
|
|
85
|
-
const width = getLineWidth(
|
|
86
|
-
getMaximumPaintValue('line-width', this, lineBucket),
|
|
87
|
-
getMaximumPaintValue('line-gap-width', this, lineBucket));
|
|
88
|
-
const offset = getMaximumPaintValue('line-offset', this, lineBucket);
|
|
89
|
-
return width / 2 + Math.abs(offset) + translateDistance(this.paint.get('line-translate'));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
queryIntersectsFeature(queryGeometry: Array<Point>,
|
|
93
|
-
feature: VectorTileFeature,
|
|
94
|
-
featureState: FeatureState,
|
|
95
|
-
geometry: Array<Array<Point>>,
|
|
96
|
-
zoom: number,
|
|
97
|
-
transform: Transform,
|
|
98
|
-
pixelsToTileUnits: number): boolean {
|
|
99
|
-
const translatedPolygon = translate(queryGeometry,
|
|
100
|
-
this.paint.get('line-translate'),
|
|
101
|
-
this.paint.get('line-translate-anchor'),
|
|
102
|
-
transform.angle, pixelsToTileUnits);
|
|
103
|
-
const halfWidth = pixelsToTileUnits / 2 * getLineWidth(
|
|
104
|
-
this.paint.get('line-width').evaluate(feature, featureState),
|
|
105
|
-
this.paint.get('line-gap-width').evaluate(feature, featureState));
|
|
106
|
-
const lineOffset = this.paint.get('line-offset').evaluate(feature, featureState);
|
|
107
|
-
if (lineOffset) {
|
|
108
|
-
geometry = offsetLine(geometry, lineOffset * pixelsToTileUnits);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return polygonIntersectsBufferedMultiLine(translatedPolygon, geometry, halfWidth);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
isTileClipped() {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export default LineStyleLayer;
|
|
120
|
-
|
|
121
|
-
function getLineWidth(lineWidth, lineGapWidth) {
|
|
122
|
-
if (lineGapWidth > 0) {
|
|
123
|
-
return lineGapWidth + 2 * lineWidth;
|
|
124
|
-
} else {
|
|
125
|
-
return lineWidth;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function offsetLine(rings, offset) {
|
|
130
|
-
const newRings = [];
|
|
131
|
-
const zero = new Point(0, 0);
|
|
132
|
-
for (let k = 0; k < rings.length; k++) {
|
|
133
|
-
const ring = rings[k];
|
|
134
|
-
const newRing = [];
|
|
135
|
-
for (let i = 0; i < ring.length; i++) {
|
|
136
|
-
const a = ring[i - 1];
|
|
137
|
-
const b = ring[i];
|
|
138
|
-
const c = ring[i + 1];
|
|
139
|
-
const aToB = i === 0 ? zero : b.sub(a)._unit()._perp();
|
|
140
|
-
const bToC = i === ring.length - 1 ? zero : c.sub(b)._unit()._perp();
|
|
141
|
-
const extrude = aToB._add(bToC)._unit();
|
|
142
|
-
|
|
143
|
-
const cosHalfAngle = extrude.x * bToC.x + extrude.y * bToC.y;
|
|
144
|
-
extrude._mult(1 / cosHalfAngle);
|
|
145
|
-
|
|
146
|
-
newRing.push(extrude._mult(offset)._add(b));
|
|
147
|
-
}
|
|
148
|
-
newRings.push(newRing);
|
|
149
|
-
}
|
|
150
|
-
return newRings;
|
|
151
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.
|
|
2
|
-
// @flow
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
import styleSpec from '../../style-spec/reference/latest';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Properties,
|
|
9
|
-
DataConstantProperty,
|
|
10
|
-
DataDrivenProperty,
|
|
11
|
-
CrossFadedDataDrivenProperty,
|
|
12
|
-
CrossFadedProperty,
|
|
13
|
-
ColorRampProperty
|
|
14
|
-
} from '../properties';
|
|
15
|
-
|
|
16
|
-
import type Color from '../../style-spec/util/color';
|
|
17
|
-
|
|
18
|
-
import type Formatted from '../../style-spec/expression/types/formatted';
|
|
19
|
-
|
|
20
|
-
import type ResolvedImage from '../../style-spec/expression/types/resolved_image';
|
|
21
|
-
|
|
22
|
-
export type LayoutProps = {|
|
|
23
|
-
"line-cap": DataConstantProperty<"butt" | "round" | "square">,
|
|
24
|
-
"line-join": DataDrivenProperty<"bevel" | "round" | "miter">,
|
|
25
|
-
"line-miter-limit": DataConstantProperty<number>,
|
|
26
|
-
"line-round-limit": DataConstantProperty<number>,
|
|
27
|
-
"line-sort-key": DataDrivenProperty<number>,
|
|
28
|
-
|};
|
|
29
|
-
|
|
30
|
-
const layout: Properties<LayoutProps> = new Properties({
|
|
31
|
-
"line-cap": new DataConstantProperty(styleSpec["layout_line"]["line-cap"]),
|
|
32
|
-
"line-join": new DataDrivenProperty(styleSpec["layout_line"]["line-join"]),
|
|
33
|
-
"line-miter-limit": new DataConstantProperty(styleSpec["layout_line"]["line-miter-limit"]),
|
|
34
|
-
"line-round-limit": new DataConstantProperty(styleSpec["layout_line"]["line-round-limit"]),
|
|
35
|
-
"line-sort-key": new DataDrivenProperty(styleSpec["layout_line"]["line-sort-key"]),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export type PaintProps = {|
|
|
39
|
-
"line-opacity": DataDrivenProperty<number>,
|
|
40
|
-
"line-color": DataDrivenProperty<Color>,
|
|
41
|
-
"line-translate": DataConstantProperty<[number, number]>,
|
|
42
|
-
"line-translate-anchor": DataConstantProperty<"map" | "viewport">,
|
|
43
|
-
"line-width": DataDrivenProperty<number>,
|
|
44
|
-
"line-gap-width": DataDrivenProperty<number>,
|
|
45
|
-
"line-offset": DataDrivenProperty<number>,
|
|
46
|
-
"line-blur": DataDrivenProperty<number>,
|
|
47
|
-
"line-dasharray": CrossFadedProperty<Array<number>>,
|
|
48
|
-
"line-pattern": CrossFadedDataDrivenProperty<ResolvedImage>,
|
|
49
|
-
"line-gradient": ColorRampProperty,
|
|
50
|
-
|};
|
|
51
|
-
|
|
52
|
-
const paint: Properties<PaintProps> = new Properties({
|
|
53
|
-
"line-opacity": new DataDrivenProperty(styleSpec["paint_line"]["line-opacity"]),
|
|
54
|
-
"line-color": new DataDrivenProperty(styleSpec["paint_line"]["line-color"]),
|
|
55
|
-
"line-translate": new DataConstantProperty(styleSpec["paint_line"]["line-translate"]),
|
|
56
|
-
"line-translate-anchor": new DataConstantProperty(styleSpec["paint_line"]["line-translate-anchor"]),
|
|
57
|
-
"line-width": new DataDrivenProperty(styleSpec["paint_line"]["line-width"]),
|
|
58
|
-
"line-gap-width": new DataDrivenProperty(styleSpec["paint_line"]["line-gap-width"]),
|
|
59
|
-
"line-offset": new DataDrivenProperty(styleSpec["paint_line"]["line-offset"]),
|
|
60
|
-
"line-blur": new DataDrivenProperty(styleSpec["paint_line"]["line-blur"]),
|
|
61
|
-
"line-dasharray": new CrossFadedProperty(styleSpec["paint_line"]["line-dasharray"]),
|
|
62
|
-
"line-pattern": new CrossFadedDataDrivenProperty(styleSpec["paint_line"]["line-pattern"]),
|
|
63
|
-
"line-gradient": new ColorRampProperty(styleSpec["paint_line"]["line-gradient"]),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Note: without adding the explicit type annotation, Flow infers weaker types
|
|
67
|
-
// for these objects from their use in the constructor to StyleLayer, as
|
|
68
|
-
// {layout?: Properties<...>, paint: Properties<...>}
|
|
69
|
-
export default ({ paint, layout }: $Exact<{
|
|
70
|
-
paint: Properties<PaintProps>, layout: Properties<LayoutProps>
|
|
71
|
-
}>);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import StyleLayer from '../style_layer';
|
|
4
|
-
|
|
5
|
-
import properties from './raster_style_layer_properties';
|
|
6
|
-
import {Transitionable, Transitioning, PossiblyEvaluated} from '../properties';
|
|
7
|
-
|
|
8
|
-
import type {PaintProps} from './raster_style_layer_properties';
|
|
9
|
-
import type {LayerSpecification} from '../../style-spec/types';
|
|
10
|
-
|
|
11
|
-
class RasterStyleLayer extends StyleLayer {
|
|
12
|
-
_transitionablePaint: Transitionable<PaintProps>;
|
|
13
|
-
_transitioningPaint: Transitioning<PaintProps>;
|
|
14
|
-
paint: PossiblyEvaluated<PaintProps>;
|
|
15
|
-
|
|
16
|
-
constructor(layer: LayerSpecification) {
|
|
17
|
-
super(layer, properties);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default RasterStyleLayer;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.
|
|
2
|
-
// @flow
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
import styleSpec from '../../style-spec/reference/latest';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Properties,
|
|
9
|
-
DataConstantProperty,
|
|
10
|
-
DataDrivenProperty,
|
|
11
|
-
CrossFadedDataDrivenProperty,
|
|
12
|
-
CrossFadedProperty,
|
|
13
|
-
ColorRampProperty
|
|
14
|
-
} from '../properties';
|
|
15
|
-
|
|
16
|
-
import type Color from '../../style-spec/util/color';
|
|
17
|
-
|
|
18
|
-
import type Formatted from '../../style-spec/expression/types/formatted';
|
|
19
|
-
|
|
20
|
-
import type ResolvedImage from '../../style-spec/expression/types/resolved_image';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export type PaintProps = {|
|
|
24
|
-
"raster-opacity": DataConstantProperty<number>,
|
|
25
|
-
"raster-hue-rotate": DataConstantProperty<number>,
|
|
26
|
-
"raster-brightness-min": DataConstantProperty<number>,
|
|
27
|
-
"raster-brightness-max": DataConstantProperty<number>,
|
|
28
|
-
"raster-saturation": DataConstantProperty<number>,
|
|
29
|
-
"raster-contrast": DataConstantProperty<number>,
|
|
30
|
-
"raster-resampling": DataConstantProperty<"linear" | "nearest">,
|
|
31
|
-
"raster-fade-duration": DataConstantProperty<number>,
|
|
32
|
-
|};
|
|
33
|
-
|
|
34
|
-
const paint: Properties<PaintProps> = new Properties({
|
|
35
|
-
"raster-opacity": new DataConstantProperty(styleSpec["paint_raster"]["raster-opacity"]),
|
|
36
|
-
"raster-hue-rotate": new DataConstantProperty(styleSpec["paint_raster"]["raster-hue-rotate"]),
|
|
37
|
-
"raster-brightness-min": new DataConstantProperty(styleSpec["paint_raster"]["raster-brightness-min"]),
|
|
38
|
-
"raster-brightness-max": new DataConstantProperty(styleSpec["paint_raster"]["raster-brightness-max"]),
|
|
39
|
-
"raster-saturation": new DataConstantProperty(styleSpec["paint_raster"]["raster-saturation"]),
|
|
40
|
-
"raster-contrast": new DataConstantProperty(styleSpec["paint_raster"]["raster-contrast"]),
|
|
41
|
-
"raster-resampling": new DataConstantProperty(styleSpec["paint_raster"]["raster-resampling"]),
|
|
42
|
-
"raster-fade-duration": new DataConstantProperty(styleSpec["paint_raster"]["raster-fade-duration"]),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Note: without adding the explicit type annotation, Flow infers weaker types
|
|
46
|
-
// for these objects from their use in the constructor to StyleLayer, as
|
|
47
|
-
// {layout?: Properties<...>, paint: Properties<...>}
|
|
48
|
-
export default ({ paint }: $Exact<{
|
|
49
|
-
paint: Properties<PaintProps>
|
|
50
|
-
}>);
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import StyleLayer from '../style_layer';
|
|
4
|
-
|
|
5
|
-
import assert from 'assert';
|
|
6
|
-
import SymbolBucket from '../../data/bucket/symbol_bucket';
|
|
7
|
-
import resolveTokens from '../../util/resolve_tokens';
|
|
8
|
-
import properties from './symbol_style_layer_properties';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
Transitionable,
|
|
12
|
-
Transitioning,
|
|
13
|
-
Layout,
|
|
14
|
-
PossiblyEvaluated,
|
|
15
|
-
PossiblyEvaluatedPropertyValue,
|
|
16
|
-
PropertyValue
|
|
17
|
-
} from '../properties';
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
isExpression,
|
|
21
|
-
StyleExpression,
|
|
22
|
-
ZoomConstantExpression,
|
|
23
|
-
ZoomDependentExpression
|
|
24
|
-
} from '../../style-spec/expression';
|
|
25
|
-
|
|
26
|
-
import type {BucketParameters} from '../../data/bucket';
|
|
27
|
-
import type {LayoutProps, PaintProps} from './symbol_style_layer_properties';
|
|
28
|
-
import type EvaluationParameters from '../evaluation_parameters';
|
|
29
|
-
import type {LayerSpecification} from '../../style-spec/types';
|
|
30
|
-
import type {Feature, SourceExpression, CompositeExpression} from '../../style-spec/expression';
|
|
31
|
-
import type {Expression} from '../../style-spec/expression/expression';
|
|
32
|
-
import type {CanonicalTileID} from '../../source/tile_id';
|
|
33
|
-
import {FormattedType} from '../../style-spec/expression/types';
|
|
34
|
-
import {typeOf} from '../../style-spec/expression/values';
|
|
35
|
-
import Formatted from '../../style-spec/expression/types/formatted';
|
|
36
|
-
import FormatSectionOverride from '../../style-spec/expression/definitions/format_section_override';
|
|
37
|
-
import FormatExpression from '../../style-spec/expression/definitions/format';
|
|
38
|
-
import Literal from '../../style-spec/expression/definitions/literal';
|
|
39
|
-
|
|
40
|
-
class SymbolStyleLayer extends StyleLayer {
|
|
41
|
-
_unevaluatedLayout: Layout<LayoutProps>;
|
|
42
|
-
layout: PossiblyEvaluated<LayoutProps>;
|
|
43
|
-
|
|
44
|
-
_transitionablePaint: Transitionable<PaintProps>;
|
|
45
|
-
_transitioningPaint: Transitioning<PaintProps>;
|
|
46
|
-
paint: PossiblyEvaluated<PaintProps>;
|
|
47
|
-
|
|
48
|
-
constructor(layer: LayerSpecification) {
|
|
49
|
-
super(layer, properties);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
recalculate(parameters: EvaluationParameters, availableImages: Array<string>) {
|
|
53
|
-
super.recalculate(parameters, availableImages);
|
|
54
|
-
|
|
55
|
-
if (this.layout.get('icon-rotation-alignment') === 'auto') {
|
|
56
|
-
if (this.layout.get('symbol-placement') !== 'point') {
|
|
57
|
-
this.layout._values['icon-rotation-alignment'] = 'map';
|
|
58
|
-
} else {
|
|
59
|
-
this.layout._values['icon-rotation-alignment'] = 'viewport';
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (this.layout.get('text-rotation-alignment') === 'auto') {
|
|
64
|
-
if (this.layout.get('symbol-placement') !== 'point') {
|
|
65
|
-
this.layout._values['text-rotation-alignment'] = 'map';
|
|
66
|
-
} else {
|
|
67
|
-
this.layout._values['text-rotation-alignment'] = 'viewport';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// If unspecified, `*-pitch-alignment` inherits `*-rotation-alignment`
|
|
72
|
-
if (this.layout.get('text-pitch-alignment') === 'auto') {
|
|
73
|
-
this.layout._values['text-pitch-alignment'] = this.layout.get('text-rotation-alignment');
|
|
74
|
-
}
|
|
75
|
-
if (this.layout.get('icon-pitch-alignment') === 'auto') {
|
|
76
|
-
this.layout._values['icon-pitch-alignment'] = this.layout.get('icon-rotation-alignment');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (this.layout.get('symbol-placement') === 'point') {
|
|
80
|
-
const writingModes = this.layout.get('text-writing-mode');
|
|
81
|
-
if (writingModes) {
|
|
82
|
-
// remove duplicates, preserving order
|
|
83
|
-
const deduped = [];
|
|
84
|
-
for (const m of writingModes) {
|
|
85
|
-
if (deduped.indexOf(m) < 0) deduped.push(m);
|
|
86
|
-
}
|
|
87
|
-
this.layout._values['text-writing-mode'] = deduped;
|
|
88
|
-
} else {
|
|
89
|
-
this.layout._values['text-writing-mode'] = ['horizontal'];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this._setPaintOverrides();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
getValueAndResolveTokens(name: *, feature: Feature, canonical: CanonicalTileID, availableImages: Array<string>) {
|
|
97
|
-
const value = this.layout.get(name).evaluate(feature, {}, canonical, availableImages);
|
|
98
|
-
const unevaluated = this._unevaluatedLayout._values[name];
|
|
99
|
-
if (!unevaluated.isDataDriven() && !isExpression(unevaluated.value) && value) {
|
|
100
|
-
return resolveTokens(feature.properties, value);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return value;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
createBucket(parameters: BucketParameters<*>) {
|
|
107
|
-
return new SymbolBucket(parameters);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
queryRadius(): number {
|
|
111
|
-
return 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
queryIntersectsFeature(): boolean {
|
|
115
|
-
assert(false); // Should take a different path in FeatureIndex
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
_setPaintOverrides() {
|
|
120
|
-
for (const overridable of properties.paint.overridableProperties) {
|
|
121
|
-
if (!SymbolStyleLayer.hasPaintOverride(this.layout, overridable)) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
const overriden = this.paint.get(overridable);
|
|
125
|
-
const override = new FormatSectionOverride(overriden);
|
|
126
|
-
const styleExpression = new StyleExpression(override, overriden.property.specification);
|
|
127
|
-
let expression = null;
|
|
128
|
-
if (overriden.value.kind === 'constant' || overriden.value.kind === 'source') {
|
|
129
|
-
expression = (new ZoomConstantExpression('source', styleExpression): SourceExpression);
|
|
130
|
-
} else {
|
|
131
|
-
expression = (new ZoomDependentExpression('composite',
|
|
132
|
-
styleExpression,
|
|
133
|
-
overriden.value.zoomStops,
|
|
134
|
-
overriden.value._interpolationType): CompositeExpression);
|
|
135
|
-
}
|
|
136
|
-
this.paint._values[overridable] = new PossiblyEvaluatedPropertyValue(overriden.property,
|
|
137
|
-
expression,
|
|
138
|
-
overriden.parameters);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
_handleOverridablePaintPropertyUpdate<T, R>(name: string, oldValue: PropertyValue<T, R>, newValue: PropertyValue<T, R>): boolean {
|
|
143
|
-
if (!this.layout || oldValue.isDataDriven() || newValue.isDataDriven()) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
return SymbolStyleLayer.hasPaintOverride(this.layout, name);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
static hasPaintOverride(layout: PossiblyEvaluated<LayoutProps>, propertyName: string): boolean {
|
|
150
|
-
const textField = layout.get('text-field');
|
|
151
|
-
const property = properties.paint.properties[propertyName];
|
|
152
|
-
let hasOverrides = false;
|
|
153
|
-
|
|
154
|
-
const checkSections = (sections) => {
|
|
155
|
-
for (const section of sections) {
|
|
156
|
-
if (property.overrides && property.overrides.hasOverride(section)) {
|
|
157
|
-
hasOverrides = true;
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
if (textField.value.kind === 'constant' && textField.value.value instanceof Formatted) {
|
|
164
|
-
checkSections(textField.value.value.sections);
|
|
165
|
-
} else if (textField.value.kind === 'source') {
|
|
166
|
-
|
|
167
|
-
const checkExpression = (expression: Expression) => {
|
|
168
|
-
if (hasOverrides) return;
|
|
169
|
-
|
|
170
|
-
if (expression instanceof Literal && typeOf(expression.value) === FormattedType) {
|
|
171
|
-
const formatted: Formatted = ((expression.value): any);
|
|
172
|
-
checkSections(formatted.sections);
|
|
173
|
-
} else if (expression instanceof FormatExpression) {
|
|
174
|
-
checkSections(expression.sections);
|
|
175
|
-
} else {
|
|
176
|
-
expression.eachChild(checkExpression);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const expr: ZoomConstantExpression<'source'> = ((textField.value): any);
|
|
181
|
-
if (expr._styleExpression) {
|
|
182
|
-
checkExpression(expr._styleExpression.expression);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return hasOverrides;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export default SymbolStyleLayer;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// This file is generated. Edit build/generate-style-code.js, then run `yarn run codegen`.
|
|
2
|
-
// @flow
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
import styleSpec from '../../style-spec/reference/latest';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
Properties,
|
|
9
|
-
DataConstantProperty,
|
|
10
|
-
DataDrivenProperty,
|
|
11
|
-
CrossFadedDataDrivenProperty,
|
|
12
|
-
CrossFadedProperty,
|
|
13
|
-
ColorRampProperty
|
|
14
|
-
} from '../properties';
|
|
15
|
-
|
|
16
|
-
import type Color from '../../style-spec/util/color';
|
|
17
|
-
|
|
18
|
-
import type Formatted from '../../style-spec/expression/types/formatted';
|
|
19
|
-
|
|
20
|
-
import type ResolvedImage from '../../style-spec/expression/types/resolved_image';
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
ColorType
|
|
24
|
-
} from '../../style-spec/expression/types';
|
|
25
|
-
|
|
26
|
-
export type LayoutProps = {|
|
|
27
|
-
"symbol-placement": DataConstantProperty<"point" | "line" | "line-center">,
|
|
28
|
-
"symbol-spacing": DataConstantProperty<number>,
|
|
29
|
-
"symbol-avoid-edges": DataConstantProperty<boolean>,
|
|
30
|
-
"symbol-sort-key": DataDrivenProperty<number>,
|
|
31
|
-
"symbol-z-order": DataConstantProperty<"auto" | "viewport-y" | "source">,
|
|
32
|
-
"icon-allow-overlap": DataConstantProperty<boolean>,
|
|
33
|
-
"icon-ignore-placement": DataConstantProperty<boolean>,
|
|
34
|
-
"icon-optional": DataConstantProperty<boolean>,
|
|
35
|
-
"icon-rotation-alignment": DataConstantProperty<"map" | "viewport" | "auto">,
|
|
36
|
-
"icon-size": DataDrivenProperty<number>,
|
|
37
|
-
"icon-text-fit": DataConstantProperty<"none" | "width" | "height" | "both">,
|
|
38
|
-
"icon-text-fit-padding": DataConstantProperty<[number, number, number, number]>,
|
|
39
|
-
"icon-image": DataDrivenProperty<ResolvedImage>,
|
|
40
|
-
"icon-rotate": DataDrivenProperty<number>,
|
|
41
|
-
"icon-padding": DataConstantProperty<number>,
|
|
42
|
-
"icon-keep-upright": DataConstantProperty<boolean>,
|
|
43
|
-
"icon-offset": DataDrivenProperty<[number, number]>,
|
|
44
|
-
"icon-anchor": DataDrivenProperty<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">,
|
|
45
|
-
"icon-pitch-alignment": DataConstantProperty<"map" | "viewport" | "auto">,
|
|
46
|
-
"text-pitch-alignment": DataConstantProperty<"map" | "viewport" | "auto">,
|
|
47
|
-
"text-rotation-alignment": DataConstantProperty<"map" | "viewport" | "auto">,
|
|
48
|
-
"text-field": DataDrivenProperty<Formatted>,
|
|
49
|
-
"text-font": DataDrivenProperty<Array<string>>,
|
|
50
|
-
"text-size": DataDrivenProperty<number>,
|
|
51
|
-
"text-max-width": DataDrivenProperty<number>,
|
|
52
|
-
"text-line-height": DataConstantProperty<number>,
|
|
53
|
-
"text-letter-spacing": DataDrivenProperty<number>,
|
|
54
|
-
"text-justify": DataDrivenProperty<"auto" | "left" | "center" | "right">,
|
|
55
|
-
"text-radial-offset": DataDrivenProperty<number>,
|
|
56
|
-
"text-variable-anchor": DataConstantProperty<Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">>,
|
|
57
|
-
"text-anchor": DataDrivenProperty<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">,
|
|
58
|
-
"text-max-angle": DataConstantProperty<number>,
|
|
59
|
-
"text-writing-mode": DataConstantProperty<Array<"horizontal" | "vertical">>,
|
|
60
|
-
"text-rotate": DataDrivenProperty<number>,
|
|
61
|
-
"text-padding": DataConstantProperty<number>,
|
|
62
|
-
"text-keep-upright": DataConstantProperty<boolean>,
|
|
63
|
-
"text-transform": DataDrivenProperty<"none" | "uppercase" | "lowercase">,
|
|
64
|
-
"text-offset": DataDrivenProperty<[number, number]>,
|
|
65
|
-
"text-allow-overlap": DataConstantProperty<boolean>,
|
|
66
|
-
"text-ignore-placement": DataConstantProperty<boolean>,
|
|
67
|
-
"text-optional": DataConstantProperty<boolean>,
|
|
68
|
-
|};
|
|
69
|
-
|
|
70
|
-
const layout: Properties<LayoutProps> = new Properties({
|
|
71
|
-
"symbol-placement": new DataConstantProperty(styleSpec["layout_symbol"]["symbol-placement"]),
|
|
72
|
-
"symbol-spacing": new DataConstantProperty(styleSpec["layout_symbol"]["symbol-spacing"]),
|
|
73
|
-
"symbol-avoid-edges": new DataConstantProperty(styleSpec["layout_symbol"]["symbol-avoid-edges"]),
|
|
74
|
-
"symbol-sort-key": new DataDrivenProperty(styleSpec["layout_symbol"]["symbol-sort-key"]),
|
|
75
|
-
"symbol-z-order": new DataConstantProperty(styleSpec["layout_symbol"]["symbol-z-order"]),
|
|
76
|
-
"icon-allow-overlap": new DataConstantProperty(styleSpec["layout_symbol"]["icon-allow-overlap"]),
|
|
77
|
-
"icon-ignore-placement": new DataConstantProperty(styleSpec["layout_symbol"]["icon-ignore-placement"]),
|
|
78
|
-
"icon-optional": new DataConstantProperty(styleSpec["layout_symbol"]["icon-optional"]),
|
|
79
|
-
"icon-rotation-alignment": new DataConstantProperty(styleSpec["layout_symbol"]["icon-rotation-alignment"]),
|
|
80
|
-
"icon-size": new DataDrivenProperty(styleSpec["layout_symbol"]["icon-size"]),
|
|
81
|
-
"icon-text-fit": new DataConstantProperty(styleSpec["layout_symbol"]["icon-text-fit"]),
|
|
82
|
-
"icon-text-fit-padding": new DataConstantProperty(styleSpec["layout_symbol"]["icon-text-fit-padding"]),
|
|
83
|
-
"icon-image": new DataDrivenProperty(styleSpec["layout_symbol"]["icon-image"]),
|
|
84
|
-
"icon-rotate": new DataDrivenProperty(styleSpec["layout_symbol"]["icon-rotate"]),
|
|
85
|
-
"icon-padding": new DataConstantProperty(styleSpec["layout_symbol"]["icon-padding"]),
|
|
86
|
-
"icon-keep-upright": new DataConstantProperty(styleSpec["layout_symbol"]["icon-keep-upright"]),
|
|
87
|
-
"icon-offset": new DataDrivenProperty(styleSpec["layout_symbol"]["icon-offset"]),
|
|
88
|
-
"icon-anchor": new DataDrivenProperty(styleSpec["layout_symbol"]["icon-anchor"]),
|
|
89
|
-
"icon-pitch-alignment": new DataConstantProperty(styleSpec["layout_symbol"]["icon-pitch-alignment"]),
|
|
90
|
-
"text-pitch-alignment": new DataConstantProperty(styleSpec["layout_symbol"]["text-pitch-alignment"]),
|
|
91
|
-
"text-rotation-alignment": new DataConstantProperty(styleSpec["layout_symbol"]["text-rotation-alignment"]),
|
|
92
|
-
"text-field": new DataDrivenProperty(styleSpec["layout_symbol"]["text-field"]),
|
|
93
|
-
"text-font": new DataDrivenProperty(styleSpec["layout_symbol"]["text-font"]),
|
|
94
|
-
"text-size": new DataDrivenProperty(styleSpec["layout_symbol"]["text-size"]),
|
|
95
|
-
"text-max-width": new DataDrivenProperty(styleSpec["layout_symbol"]["text-max-width"]),
|
|
96
|
-
"text-line-height": new DataConstantProperty(styleSpec["layout_symbol"]["text-line-height"]),
|
|
97
|
-
"text-letter-spacing": new DataDrivenProperty(styleSpec["layout_symbol"]["text-letter-spacing"]),
|
|
98
|
-
"text-justify": new DataDrivenProperty(styleSpec["layout_symbol"]["text-justify"]),
|
|
99
|
-
"text-radial-offset": new DataDrivenProperty(styleSpec["layout_symbol"]["text-radial-offset"]),
|
|
100
|
-
"text-variable-anchor": new DataConstantProperty(styleSpec["layout_symbol"]["text-variable-anchor"]),
|
|
101
|
-
"text-anchor": new DataDrivenProperty(styleSpec["layout_symbol"]["text-anchor"]),
|
|
102
|
-
"text-max-angle": new DataConstantProperty(styleSpec["layout_symbol"]["text-max-angle"]),
|
|
103
|
-
"text-writing-mode": new DataConstantProperty(styleSpec["layout_symbol"]["text-writing-mode"]),
|
|
104
|
-
"text-rotate": new DataDrivenProperty(styleSpec["layout_symbol"]["text-rotate"]),
|
|
105
|
-
"text-padding": new DataConstantProperty(styleSpec["layout_symbol"]["text-padding"]),
|
|
106
|
-
"text-keep-upright": new DataConstantProperty(styleSpec["layout_symbol"]["text-keep-upright"]),
|
|
107
|
-
"text-transform": new DataDrivenProperty(styleSpec["layout_symbol"]["text-transform"]),
|
|
108
|
-
"text-offset": new DataDrivenProperty(styleSpec["layout_symbol"]["text-offset"]),
|
|
109
|
-
"text-allow-overlap": new DataConstantProperty(styleSpec["layout_symbol"]["text-allow-overlap"]),
|
|
110
|
-
"text-ignore-placement": new DataConstantProperty(styleSpec["layout_symbol"]["text-ignore-placement"]),
|
|
111
|
-
"text-optional": new DataConstantProperty(styleSpec["layout_symbol"]["text-optional"]),
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
export type PaintProps = {|
|
|
115
|
-
"icon-opacity": DataDrivenProperty<number>,
|
|
116
|
-
"icon-color": DataDrivenProperty<Color>,
|
|
117
|
-
"icon-halo-color": DataDrivenProperty<Color>,
|
|
118
|
-
"icon-halo-width": DataDrivenProperty<number>,
|
|
119
|
-
"icon-halo-blur": DataDrivenProperty<number>,
|
|
120
|
-
"icon-translate": DataConstantProperty<[number, number]>,
|
|
121
|
-
"icon-translate-anchor": DataConstantProperty<"map" | "viewport">,
|
|
122
|
-
"text-opacity": DataDrivenProperty<number>,
|
|
123
|
-
"text-color": DataDrivenProperty<Color>,
|
|
124
|
-
"text-halo-color": DataDrivenProperty<Color>,
|
|
125
|
-
"text-halo-width": DataDrivenProperty<number>,
|
|
126
|
-
"text-halo-blur": DataDrivenProperty<number>,
|
|
127
|
-
"text-translate": DataConstantProperty<[number, number]>,
|
|
128
|
-
"text-translate-anchor": DataConstantProperty<"map" | "viewport">,
|
|
129
|
-
|};
|
|
130
|
-
|
|
131
|
-
const paint: Properties<PaintProps> = new Properties({
|
|
132
|
-
"icon-opacity": new DataDrivenProperty(styleSpec["paint_symbol"]["icon-opacity"]),
|
|
133
|
-
"icon-color": new DataDrivenProperty(styleSpec["paint_symbol"]["icon-color"]),
|
|
134
|
-
"icon-halo-color": new DataDrivenProperty(styleSpec["paint_symbol"]["icon-halo-color"]),
|
|
135
|
-
"icon-halo-width": new DataDrivenProperty(styleSpec["paint_symbol"]["icon-halo-width"]),
|
|
136
|
-
"icon-halo-blur": new DataDrivenProperty(styleSpec["paint_symbol"]["icon-halo-blur"]),
|
|
137
|
-
"icon-translate": new DataConstantProperty(styleSpec["paint_symbol"]["icon-translate"]),
|
|
138
|
-
"icon-translate-anchor": new DataConstantProperty(styleSpec["paint_symbol"]["icon-translate-anchor"]),
|
|
139
|
-
"text-opacity": new DataDrivenProperty(styleSpec["paint_symbol"]["text-opacity"]),
|
|
140
|
-
"text-color": new DataDrivenProperty(styleSpec["paint_symbol"]["text-color"], { runtimeType: ColorType, getOverride: (o) => o.textColor, hasOverride: (o) => !!o.textColor }),
|
|
141
|
-
"text-halo-color": new DataDrivenProperty(styleSpec["paint_symbol"]["text-halo-color"]),
|
|
142
|
-
"text-halo-width": new DataDrivenProperty(styleSpec["paint_symbol"]["text-halo-width"]),
|
|
143
|
-
"text-halo-blur": new DataDrivenProperty(styleSpec["paint_symbol"]["text-halo-blur"]),
|
|
144
|
-
"text-translate": new DataConstantProperty(styleSpec["paint_symbol"]["text-translate"]),
|
|
145
|
-
"text-translate-anchor": new DataConstantProperty(styleSpec["paint_symbol"]["text-translate-anchor"]),
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Note: without adding the explicit type annotation, Flow infers weaker types
|
|
149
|
-
// for these objects from their use in the constructor to StyleLayer, as
|
|
150
|
-
// {layout?: Properties<...>, paint: Properties<...>}
|
|
151
|
-
export default ({ paint, layout }: $Exact<{
|
|
152
|
-
paint: Properties<PaintProps>, layout: Properties<LayoutProps>
|
|
153
|
-
}>);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import type CircleStyleLayer from './circle_style_layer';
|
|
4
|
-
import type FillStyleLayer from './fill_style_layer';
|
|
5
|
-
import type FillExtrusionStyleLayer from './fill_extrusion_style_layer';
|
|
6
|
-
import type HeatmapStyleLayer from './heatmap_style_layer';
|
|
7
|
-
import type HillshadeStyleLayer from './hillshade_style_layer';
|
|
8
|
-
import type LineStyleLayer from './line_style_layer';
|
|
9
|
-
import type SymbolStyleLayer from './symbol_style_layer';
|
|
10
|
-
|
|
11
|
-
export type TypedStyleLayer = CircleStyleLayer |
|
|
12
|
-
FillStyleLayer |
|
|
13
|
-
FillExtrusionStyleLayer |
|
|
14
|
-
HeatmapStyleLayer |
|
|
15
|
-
HillshadeStyleLayer |
|
|
16
|
-
LineStyleLayer |
|
|
17
|
-
SymbolStyleLayer;
|