maplibre-gl 3.1.0 → 3.2.0-pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/build/generate-doc-images.ts +73 -0
- package/build/generate-docs.ts +100 -0
- package/build/generate-struct-arrays.ts +9 -12
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +3303 -3398
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +3899 -3531
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +28 -25
- package/src/data/array_types.g.ts +14 -48
- package/src/data/bucket/circle_bucket.ts +11 -14
- package/src/data/bucket/fill_bucket.test.ts +6 -6
- package/src/data/bucket/fill_bucket.ts +10 -12
- package/src/data/bucket/fill_extrusion_bucket.ts +11 -13
- package/src/data/bucket/heatmap_bucket.ts +3 -6
- package/src/data/bucket/line_attributes.ts +1 -2
- package/src/data/bucket/line_attributes_ext.ts +1 -2
- package/src/data/bucket/line_bucket.test.ts +5 -5
- package/src/data/bucket/line_bucket.ts +18 -21
- package/src/data/bucket/pattern_attributes.ts +1 -3
- package/src/data/bucket/pattern_bucket_features.ts +3 -3
- package/src/data/bucket/symbol_bucket.test.ts +5 -5
- package/src/data/bucket/symbol_bucket.ts +12 -15
- package/src/data/bucket.ts +7 -11
- package/src/data/dem_data.test.ts +1 -1
- package/src/data/dem_data.ts +1 -1
- package/src/data/evaluation_feature.ts +4 -5
- package/src/data/extent.ts +1 -4
- package/src/data/feature_index.ts +14 -13
- package/src/data/feature_position_map.test.ts +4 -4
- package/src/data/feature_position_map.ts +1 -1
- package/src/data/index_array_type.ts +0 -1
- package/src/data/load_geometry.test.ts +1 -1
- package/src/data/load_geometry.ts +3 -4
- package/src/data/program_configuration.ts +6 -11
- package/src/data/segment.ts +9 -6
- package/src/geo/edge_insets.test.ts +1 -1
- package/src/geo/edge_insets.ts +36 -26
- package/src/geo/lng_lat.test.ts +1 -1
- package/src/geo/lng_lat.ts +61 -44
- package/src/geo/lng_lat_bounds.test.ts +2 -2
- package/src/geo/lng_lat_bounds.ts +88 -68
- package/src/geo/mercator_coordinate.test.ts +2 -2
- package/src/geo/mercator_coordinate.ts +34 -27
- package/src/geo/transform.test.ts +3 -3
- package/src/geo/transform.ts +58 -79
- package/src/gl/color_mode.ts +1 -3
- package/src/gl/context.ts +12 -11
- package/src/gl/cull_face_mode.ts +1 -3
- package/src/gl/depth_mode.ts +1 -3
- package/src/gl/framebuffer.ts +5 -4
- package/src/gl/index_buffer.ts +5 -4
- package/src/gl/render_pool.test.ts +2 -2
- package/src/gl/render_pool.ts +5 -5
- package/src/gl/state.test.ts +1 -1
- package/src/gl/stencil_mode.ts +1 -3
- package/src/gl/value.ts +1 -1
- package/src/gl/vertex_buffer.test.ts +2 -2
- package/src/gl/vertex_buffer.ts +8 -14
- package/src/index.test.ts +2 -2
- package/src/index.ts +121 -113
- package/src/render/draw_background.ts +7 -9
- package/src/render/draw_circle.ts +13 -15
- package/src/render/draw_collision_debug.ts +11 -13
- package/src/render/draw_custom.ts +6 -8
- package/src/render/draw_debug.test.ts +4 -4
- package/src/render/draw_debug.ts +8 -10
- package/src/render/draw_fill.test.ts +13 -13
- package/src/render/draw_fill.ts +9 -11
- package/src/render/draw_fill_extrusion.ts +10 -12
- package/src/render/draw_heatmap.ts +12 -14
- package/src/render/draw_hillshade.ts +10 -12
- package/src/render/draw_line.ts +9 -9
- package/src/render/draw_raster.ts +9 -11
- package/src/render/draw_symbol.test.ts +16 -16
- package/src/render/draw_symbol.ts +15 -16
- package/src/render/draw_terrain.ts +11 -11
- package/src/render/glyph_atlas.ts +10 -1
- package/src/render/glyph_manager.test.ts +3 -3
- package/src/render/glyph_manager.ts +7 -7
- package/src/render/image_atlas.ts +6 -3
- package/src/render/image_manager.ts +3 -5
- package/src/render/line_atlas.test.ts +1 -1
- package/src/render/line_atlas.ts +19 -14
- package/src/render/painter.ts +85 -65
- package/src/render/program/background_program.ts +2 -2
- package/src/render/program/circle_program.ts +5 -5
- package/src/render/program/clipping_mask_program.ts +1 -1
- package/src/render/program/collision_program.ts +4 -4
- package/src/render/program/debug_program.ts +1 -1
- package/src/render/program/fill_extrusion_program.ts +3 -3
- package/src/render/program/fill_program.ts +3 -3
- package/src/render/program/heatmap_program.ts +5 -5
- package/src/render/program/hillshade_program.ts +7 -7
- package/src/render/program/line_program.ts +6 -6
- package/src/render/program/pattern.ts +3 -3
- package/src/render/program/raster_program.ts +2 -2
- package/src/render/program/symbol_program.ts +2 -2
- package/src/render/program/terrain_program.ts +1 -1
- package/src/render/program.ts +18 -16
- package/src/render/render_to_texture.test.ts +15 -15
- package/src/render/render_to_texture.ts +10 -10
- package/src/render/terrain.test.ts +38 -7
- package/src/render/terrain.ts +103 -67
- package/src/render/texture.ts +5 -4
- package/src/render/uniform_binding.test.ts +1 -1
- package/src/render/uniform_binding.ts +7 -1
- package/src/render/update_pattern_positions_in_program.ts +5 -5
- package/src/render/vertex_array_object.ts +9 -8
- package/src/shaders/encode_attribute.ts +0 -2
- package/src/shaders/shaders.ts +1 -3
- package/src/source/canvas_source.test.ts +6 -6
- package/src/source/canvas_source.ts +46 -60
- package/src/source/geojson_source.test.ts +5 -5
- package/src/source/geojson_source.ts +75 -59
- package/src/source/geojson_source_diff.ts +39 -2
- package/src/source/geojson_worker_source.test.ts +3 -3
- package/src/source/geojson_worker_source.ts +20 -26
- package/src/source/geojson_wrapper.test.ts +3 -3
- package/src/source/geojson_wrapper.ts +2 -4
- package/src/source/image_source.test.ts +9 -8
- package/src/source/image_source.ts +49 -35
- package/src/source/load_tilejson.ts +2 -2
- package/src/source/pixels_to_tile_units.ts +2 -3
- package/src/source/query_features.test.ts +3 -3
- package/src/source/query_features.ts +50 -19
- package/src/source/raster_dem_tile_source.test.ts +3 -3
- package/src/source/raster_dem_tile_source.ts +23 -10
- package/src/source/raster_dem_tile_worker_source.test.ts +2 -2
- package/src/source/raster_dem_tile_worker_source.ts +3 -5
- package/src/source/raster_tile_source.test.ts +3 -3
- package/src/source/raster_tile_source.ts +38 -11
- package/src/source/rtl_text_plugin.ts +4 -1
- package/src/source/source.ts +67 -59
- package/src/source/source_cache.test.ts +7 -7
- package/src/source/source_cache.ts +17 -38
- package/src/source/source_state.ts +2 -5
- package/src/source/terrain_source_cache.test.ts +8 -8
- package/src/source/terrain_source_cache.ts +42 -27
- package/src/source/tile.test.ts +3 -3
- package/src/source/tile.ts +32 -38
- package/src/source/tile_bounds.ts +2 -4
- package/src/source/tile_cache.test.ts +2 -2
- package/src/source/tile_cache.ts +20 -30
- package/src/source/tile_id.ts +11 -2
- package/src/source/vector_tile_source.test.ts +3 -3
- package/src/source/vector_tile_source.ts +34 -24
- package/src/source/vector_tile_worker_source.test.ts +4 -4
- package/src/source/vector_tile_worker_source.ts +11 -23
- package/src/source/video_source.test.ts +5 -5
- package/src/source/video_source.ts +21 -28
- package/src/source/worker.ts +6 -8
- package/src/source/worker_source.ts +6 -8
- package/src/source/worker_tile.test.ts +5 -5
- package/src/source/worker_tile.ts +13 -16
- package/src/style/create_style_layer.ts +31 -26
- package/src/style/evaluation_parameters.ts +5 -4
- package/src/style/format_section_override.test.ts +2 -2
- package/src/style/format_section_override.ts +1 -1
- package/src/style/light.test.ts +2 -2
- package/src/style/light.ts +3 -5
- package/src/style/load_glyph_range.test.ts +1 -1
- package/src/style/load_glyph_range.ts +3 -3
- package/src/style/load_sprite.test.ts +1 -1
- package/src/style/load_sprite.ts +3 -3
- package/src/style/parse_glyph_pbf.ts +1 -1
- package/src/style/pauseable_placement.ts +7 -9
- package/src/style/properties.ts +4 -53
- package/src/style/query_utils.ts +3 -3
- package/src/style/style.test.ts +22 -19
- package/src/style/style.ts +118 -84
- package/src/style/style_glyph.ts +6 -0
- package/src/style/style_image.ts +39 -33
- package/src/style/style_layer/background_style_layer.ts +2 -4
- package/src/style/style_layer/circle_style_layer.ts +7 -6
- package/src/style/style_layer/custom_style_layer.ts +23 -48
- package/src/style/style_layer/fill_extrusion_style_layer.ts +4 -6
- package/src/style/style_layer/fill_style_layer.ts +5 -7
- package/src/style/style_layer/heatmap_style_layer.ts +8 -7
- package/src/style/style_layer/hillshade_style_layer.ts +2 -4
- package/src/style/style_layer/line_style_layer.ts +6 -8
- package/src/style/style_layer/overlap_mode.test.ts +3 -3
- package/src/style/style_layer/overlap_mode.ts +3 -0
- package/src/style/style_layer/raster_style_layer.ts +2 -4
- package/src/style/style_layer/symbol_style_layer.ts +6 -8
- package/src/style/style_layer/typed_style_layer.ts +7 -7
- package/src/style/style_layer.test.ts +5 -5
- package/src/style/style_layer.ts +7 -6
- package/src/style/style_layer_index.test.ts +1 -1
- package/src/style/style_layer_index.ts +3 -5
- package/src/style/zoom_history.ts +1 -3
- package/src/symbol/anchor.test.ts +1 -1
- package/src/symbol/anchor.ts +1 -3
- package/src/symbol/check_max_angle.test.ts +8 -2
- package/src/symbol/check_max_angle.ts +10 -13
- package/src/symbol/clip_line.test.ts +1 -1
- package/src/symbol/clip_line.ts +6 -9
- package/src/symbol/collision_feature.test.ts +2 -2
- package/src/symbol/collision_feature.ts +7 -12
- package/src/symbol/collision_index.test.ts +2 -2
- package/src/symbol/collision_index.ts +5 -11
- package/src/symbol/cross_tile_symbol_index.test.ts +2 -2
- package/src/symbol/cross_tile_symbol_index.ts +5 -7
- package/src/symbol/get_anchors.ts +2 -2
- package/src/symbol/grid_index.test.ts +1 -1
- package/src/symbol/grid_index.ts +4 -5
- package/src/symbol/merge_lines.test.ts +1 -1
- package/src/symbol/merge_lines.ts +1 -1
- package/src/symbol/opacity_state.ts +1 -3
- package/src/symbol/path_interpolator.test.ts +1 -1
- package/src/symbol/path_interpolator.ts +1 -3
- package/src/symbol/placement.ts +9 -9
- package/src/symbol/projection.ts +61 -34
- package/src/symbol/quads.ts +7 -11
- package/src/symbol/shaping.ts +1 -1
- package/src/symbol/symbol_layout.ts +9 -12
- package/src/symbol/symbol_size.ts +1 -1
- package/src/symbol/symbol_style_layer.test.ts +4 -4
- package/src/symbol/transform_text.ts +2 -2
- package/src/types/callback.ts +14 -14
- package/src/types/cancelable.ts +3 -0
- package/src/types/transferable.ts +3 -0
- package/src/ui/anchor.ts +4 -0
- package/src/ui/camera.test.ts +6 -6
- package/src/ui/camera.ts +392 -361
- package/src/ui/control/attribution_control.test.ts +1 -1
- package/src/ui/control/attribution_control.ts +34 -30
- package/src/ui/control/control.ts +14 -20
- package/src/ui/control/fullscreen_control.test.ts +1 -1
- package/src/ui/control/fullscreen_control.ts +21 -26
- package/src/ui/control/geolocate_control.test.ts +5 -5
- package/src/ui/control/geolocate_control.ts +181 -194
- package/src/ui/control/logo_control.ts +20 -16
- package/src/ui/control/navigation_control.test.ts +1 -1
- package/src/ui/control/navigation_control.ts +46 -42
- package/src/ui/control/scale_control.test.ts +1 -1
- package/src/ui/control/scale_control.ts +30 -21
- package/src/ui/control/terrain_control.test.ts +1 -1
- package/src/ui/control/terrain_control.ts +14 -18
- package/src/ui/default_locale.ts +1 -3
- package/src/ui/events.ts +570 -1281
- package/src/ui/handler/box_zoom.test.ts +2 -2
- package/src/ui/handler/box_zoom.ts +16 -11
- package/src/ui/handler/click_zoom.ts +11 -3
- package/src/ui/handler/cooperative_gestures.test.ts +3 -3
- package/src/ui/handler/dblclick_zoom.test.ts +1 -1
- package/src/ui/handler/drag_handler.ts +30 -22
- package/src/ui/handler/drag_move_state_manager.ts +1 -1
- package/src/ui/handler/drag_pan.test.ts +2 -2
- package/src/ui/handler/drag_rotate.test.ts +3 -3
- package/src/ui/handler/keyboard.test.ts +2 -2
- package/src/ui/handler/keyboard.ts +22 -13
- package/src/ui/handler/map_event.test.ts +2 -2
- package/src/ui/handler/map_event.ts +1 -1
- package/src/ui/handler/mouse.ts +1 -1
- package/src/ui/handler/mouse_rotate.test.ts +3 -3
- package/src/ui/handler/scroll_zoom.test.ts +3 -3
- package/src/ui/handler/scroll_zoom.ts +45 -52
- package/src/ui/handler/shim/dblclick_zoom.ts +12 -6
- package/src/ui/handler/shim/drag_pan.ts +34 -14
- package/src/ui/handler/shim/drag_rotate.ts +20 -12
- package/src/ui/handler/shim/two_fingers_touch.ts +24 -18
- package/src/ui/handler/tap_drag_zoom.test.ts +113 -0
- package/src/ui/handler/tap_drag_zoom.ts +18 -10
- package/src/ui/handler/tap_recognizer.ts +1 -1
- package/src/ui/handler/tap_zoom.ts +4 -3
- package/src/ui/handler/touch_pan.ts +3 -2
- package/src/ui/handler/transform-provider.ts +4 -6
- package/src/ui/handler/two_fingers_touch.test.ts +3 -3
- package/src/ui/handler/two_fingers_touch.ts +64 -47
- package/src/ui/handler_inertia.ts +4 -4
- package/src/ui/handler_manager.ts +86 -52
- package/src/ui/hash.test.ts +1 -1
- package/src/ui/hash.ts +21 -28
- package/src/ui/map/isMoving.test.ts +3 -3
- package/src/ui/map/isRotating.test.ts +3 -3
- package/src/ui/map/isZooming.test.ts +3 -3
- package/src/ui/map.test.ts +97 -8
- package/src/ui/map.ts +856 -702
- package/src/ui/map_events.test.ts +1 -1
- package/src/ui/marker.test.ts +35 -15
- package/src/ui/marker.ts +220 -141
- package/src/ui/popup.test.ts +2 -2
- package/src/ui/popup.ts +179 -147
- package/src/util/actor.test.ts +7 -7
- package/src/util/actor.ts +25 -22
- package/src/util/ajax.ts +37 -17
- package/src/util/browser.test.ts +1 -1
- package/src/util/browser.ts +2 -6
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/classify_rings.ts +1 -1
- package/src/util/color_ramp.ts +0 -2
- package/src/util/config.ts +6 -3
- package/src/util/debug.ts +0 -2
- package/src/util/dictionary_coder.ts +1 -4
- package/src/util/dispatcher.test.ts +3 -3
- package/src/util/dispatcher.ts +4 -9
- package/src/util/dom.ts +1 -1
- package/src/util/evented.ts +23 -18
- package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +4 -5
- package/src/util/global_worker_pool.ts +2 -3
- package/src/util/image.ts +10 -4
- package/src/util/image_request.test.ts +3 -3
- package/src/util/image_request.ts +15 -14
- package/src/util/is_char_in_unicode_block.ts +1 -3
- package/src/util/offscreen_canvas_supported.ts +1 -1
- package/src/util/performance.ts +1 -2
- package/src/util/request_manager.ts +4 -0
- package/src/util/resolve_tokens.test.ts +1 -1
- package/src/util/resolve_tokens.ts +3 -6
- package/src/util/script_detection.ts +1 -4
- package/src/util/smart_wrap.ts +3 -5
- package/src/util/struct_array.ts +18 -14
- package/src/util/style.ts +2 -2
- package/src/util/task_queue.test.ts +1 -1
- package/src/util/task_queue.ts +1 -3
- package/src/util/test/mock_webgl.ts +6 -0
- package/src/util/test/util.ts +2 -2
- package/src/util/throttle.test.ts +1 -1
- package/src/util/throttle.ts +1 -2
- package/src/util/throttled_invoker.ts +1 -5
- package/src/util/transferable_grid_index.test.ts +1 -1
- package/src/util/transferable_grid_index.ts +1 -3
- package/src/util/util.test.ts +1 -14
- package/src/util/util.ts +44 -107
- package/src/util/vectortile_to_geojson.ts +13 -3
- package/src/util/verticalize_punctuation.ts +1 -1
- package/src/util/web_worker.ts +2 -2
- package/src/util/web_worker_transfer.ts +11 -8
- package/src/util/webp_supported.ts +2 -4
- package/src/util/worker_pool.test.ts +1 -1
- package/src/util/worker_pool.ts +4 -5
|
@@ -3,11 +3,11 @@ import path from 'path';
|
|
|
3
3
|
import Protobuf from 'pbf';
|
|
4
4
|
import {VectorTile} from '@mapbox/vector-tile';
|
|
5
5
|
import Point from '@mapbox/point-geometry';
|
|
6
|
-
import
|
|
7
|
-
import LineBucket from './line_bucket';
|
|
8
|
-
import LineStyleLayer from '../../style/style_layer/line_style_layer';
|
|
6
|
+
import {SegmentVector} from '../segment';
|
|
7
|
+
import {LineBucket} from './line_bucket';
|
|
8
|
+
import {LineStyleLayer} from '../../style/style_layer/line_style_layer';
|
|
9
9
|
import {LayerSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
10
|
-
import EvaluationParameters from '../../style/evaluation_parameters';
|
|
10
|
+
import {EvaluationParameters} from '../../style/evaluation_parameters';
|
|
11
11
|
import {BucketFeature, BucketParameters} from '../bucket';
|
|
12
12
|
|
|
13
13
|
// Load a line feature from fixture tile.
|
|
@@ -105,7 +105,7 @@ describe('LineBucket', () => {
|
|
|
105
105
|
|
|
106
106
|
// Stub MAX_VERTEX_ARRAY_LENGTH so we can test features
|
|
107
107
|
// breaking across array groups without tests taking a _long_ time.
|
|
108
|
-
|
|
108
|
+
SegmentVector.MAX_VERTEX_ARRAY_LENGTH = 256;
|
|
109
109
|
|
|
110
110
|
const layer = new LineStyleLayer({id: 'test', type: 'line'} as LayerSpecification);
|
|
111
111
|
layer.recalculate({zoom: 0, zoomHistory: {}} as EvaluationParameters, undefined);
|
|
@@ -2,17 +2,17 @@ import {LineLayoutArray, LineExtLayoutArray} from '../array_types.g';
|
|
|
2
2
|
|
|
3
3
|
import {members as layoutAttributes} from './line_attributes';
|
|
4
4
|
import {members as layoutAttributesExt} from './line_attributes_ext';
|
|
5
|
-
import SegmentVector from '../segment';
|
|
5
|
+
import {SegmentVector} from '../segment';
|
|
6
6
|
import {ProgramConfigurationSet} from '../program_configuration';
|
|
7
7
|
import {TriangleIndexArray} from '../index_array_type';
|
|
8
|
-
import EXTENT from '../extent';
|
|
8
|
+
import {EXTENT} from '../extent';
|
|
9
9
|
import mvt from '@mapbox/vector-tile';
|
|
10
10
|
const vectorTileFeatureTypes = mvt.VectorTileFeature.types;
|
|
11
11
|
import {register} from '../../util/web_worker_transfer';
|
|
12
12
|
import {hasPattern, addPatternDependencies} from './pattern_bucket_features';
|
|
13
|
-
import loadGeometry from '../load_geometry';
|
|
14
|
-
import toEvaluationFeature from '../evaluation_feature';
|
|
15
|
-
import EvaluationParameters from '../../style/evaluation_parameters';
|
|
13
|
+
import {loadGeometry} from '../load_geometry';
|
|
14
|
+
import {toEvaluationFeature} from '../evaluation_feature';
|
|
15
|
+
import {EvaluationParameters} from '../../style/evaluation_parameters';
|
|
16
16
|
|
|
17
17
|
import type {CanonicalTileID} from '../../source/tile_id';
|
|
18
18
|
import type {
|
|
@@ -22,14 +22,14 @@ import type {
|
|
|
22
22
|
IndexedFeature,
|
|
23
23
|
PopulateParameters
|
|
24
24
|
} from '../bucket';
|
|
25
|
-
import type LineStyleLayer from '../../style/style_layer/line_style_layer';
|
|
25
|
+
import type {LineStyleLayer} from '../../style/style_layer/line_style_layer';
|
|
26
26
|
import type Point from '@mapbox/point-geometry';
|
|
27
27
|
import type {Segment} from '../segment';
|
|
28
28
|
import {RGBAImage} from '../../util/image';
|
|
29
|
-
import type Context from '../../gl/context';
|
|
30
|
-
import type Texture from '../../render/texture';
|
|
31
|
-
import type IndexBuffer from '../../gl/index_buffer';
|
|
32
|
-
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
29
|
+
import type {Context} from '../../gl/context';
|
|
30
|
+
import type {Texture} from '../../render/texture';
|
|
31
|
+
import type {IndexBuffer} from '../../gl/index_buffer';
|
|
32
|
+
import type {VertexBuffer} from '../../gl/vertex_buffer';
|
|
33
33
|
import type {FeatureStates} from '../../source/source_state';
|
|
34
34
|
import type {ImagePosition} from '../../render/image_atlas';
|
|
35
35
|
import type {VectorTileLayer} from '@mapbox/vector-tile';
|
|
@@ -82,9 +82,9 @@ type GradientTexture = {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* Line bucket class
|
|
86
86
|
*/
|
|
87
|
-
class LineBucket implements Bucket {
|
|
87
|
+
export class LineBucket implements Bucket {
|
|
88
88
|
distance: number;
|
|
89
89
|
totalDistance: number;
|
|
90
90
|
maxLineLength: number;
|
|
@@ -503,13 +503,12 @@ class LineBucket implements Bucket {
|
|
|
503
503
|
/**
|
|
504
504
|
* Add two vertices to the buffers.
|
|
505
505
|
*
|
|
506
|
-
* @param p the line vertex to add buffer vertices for
|
|
507
|
-
* @param normal vertex normal
|
|
508
|
-
* @param endLeft extrude to shift the left vertex along the line
|
|
509
|
-
* @param endRight extrude to shift the left vertex along the line
|
|
510
|
-
* @param segment the segment object to add the vertex to
|
|
511
|
-
* @param round whether this is a round cap
|
|
512
|
-
* @private
|
|
506
|
+
* @param p - the line vertex to add buffer vertices for
|
|
507
|
+
* @param normal - vertex normal
|
|
508
|
+
* @param endLeft - extrude to shift the left vertex along the line
|
|
509
|
+
* @param endRight - extrude to shift the left vertex along the line
|
|
510
|
+
* @param segment - the segment object to add the vertex to
|
|
511
|
+
* @param round - whether this is a round cap
|
|
513
512
|
*/
|
|
514
513
|
addCurrentVertex(p: Point, normal: Point, endLeft: number, endRight: number, segment: Segment, round: boolean = false) {
|
|
515
514
|
// left and right extrude vectors, perpendicularly shifted by endLeft/endRight
|
|
@@ -590,5 +589,3 @@ class LineBucket implements Bucket {
|
|
|
590
589
|
}
|
|
591
590
|
|
|
592
591
|
register('LineBucket', LineBucket, {omit: ['layers', 'patternFeatures']});
|
|
593
|
-
|
|
594
|
-
export default LineBucket;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {createLayout} from '../../util/struct_array';
|
|
2
2
|
|
|
3
|
-
const patternAttributes = createLayout([
|
|
3
|
+
export const patternAttributes = createLayout([
|
|
4
4
|
// [tl.x, tl.y, br.x, br.y]
|
|
5
5
|
{name: 'a_pattern_from', components: 4, type: 'Uint16'},
|
|
6
6
|
{name: 'a_pattern_to', components: 4, type: 'Uint16'},
|
|
7
7
|
{name: 'a_pixel_ratio_from', components: 1, type: 'Uint16'},
|
|
8
8
|
{name: 'a_pixel_ratio_to', components: 1, type: 'Uint16'},
|
|
9
9
|
]);
|
|
10
|
-
|
|
11
|
-
export default patternAttributes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type FillStyleLayer from '../../style/style_layer/fill_style_layer';
|
|
2
|
-
import type FillExtrusionStyleLayer from '../../style/style_layer/fill_extrusion_style_layer';
|
|
3
|
-
import type LineStyleLayer from '../../style/style_layer/line_style_layer';
|
|
1
|
+
import type {FillStyleLayer} from '../../style/style_layer/fill_style_layer';
|
|
2
|
+
import type {FillExtrusionStyleLayer} from '../../style/style_layer/fill_extrusion_style_layer';
|
|
3
|
+
import type {LineStyleLayer} from '../../style/style_layer/line_style_layer';
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
BucketFeature,
|
|
@@ -2,15 +2,15 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import Protobuf from 'pbf';
|
|
4
4
|
import {VectorTile} from '@mapbox/vector-tile';
|
|
5
|
-
import SymbolBucket from './symbol_bucket';
|
|
5
|
+
import {SymbolBucket} from './symbol_bucket';
|
|
6
6
|
import {CollisionBoxArray} from '../../data/array_types.g';
|
|
7
7
|
import {performSymbolLayout} from '../../symbol/symbol_layout';
|
|
8
8
|
import {Placement} from '../../symbol/placement';
|
|
9
|
-
import Transform from '../../geo/transform';
|
|
9
|
+
import {Transform} from '../../geo/transform';
|
|
10
10
|
import {CanonicalTileID, OverscaledTileID} from '../../source/tile_id';
|
|
11
|
-
import Tile from '../../source/tile';
|
|
12
|
-
import CrossTileSymbolIndex from '../../symbol/cross_tile_symbol_index';
|
|
13
|
-
import FeatureIndex from '../../data/feature_index';
|
|
11
|
+
import {Tile} from '../../source/tile';
|
|
12
|
+
import {CrossTileSymbolIndex} from '../../symbol/cross_tile_symbol_index';
|
|
13
|
+
import {FeatureIndex} from '../../data/feature_index';
|
|
14
14
|
import {createSymbolBucket, createSymbolIconBucket} from '../../../test/unit/lib/create_symbol_layer';
|
|
15
15
|
import {RGBAImage} from '../../util/image';
|
|
16
16
|
import {ImagePosition} from '../../render/image_atlas';
|
|
@@ -17,23 +17,23 @@ import {SymbolLayoutArray,
|
|
|
17
17
|
} from '../array_types.g';
|
|
18
18
|
|
|
19
19
|
import Point from '@mapbox/point-geometry';
|
|
20
|
-
import SegmentVector from '../segment';
|
|
20
|
+
import {SegmentVector} from '../segment';
|
|
21
21
|
import {ProgramConfigurationSet} from '../program_configuration';
|
|
22
22
|
import {TriangleIndexArray, LineIndexArray} from '../index_array_type';
|
|
23
|
-
import transformText from '../../symbol/transform_text';
|
|
24
|
-
import mergeLines from '../../symbol/merge_lines';
|
|
23
|
+
import {transformText} from '../../symbol/transform_text';
|
|
24
|
+
import {mergeLines} from '../../symbol/merge_lines';
|
|
25
25
|
import {allowsVerticalWritingMode, stringContainsRTLText} from '../../util/script_detection';
|
|
26
26
|
import {WritingMode} from '../../symbol/shaping';
|
|
27
|
-
import loadGeometry from '../load_geometry';
|
|
28
|
-
import toEvaluationFeature from '../evaluation_feature';
|
|
27
|
+
import {loadGeometry} from '../load_geometry';
|
|
28
|
+
import {toEvaluationFeature} from '../evaluation_feature';
|
|
29
29
|
import mvt from '@mapbox/vector-tile';
|
|
30
30
|
const vectorTileFeatureTypes = mvt.VectorTileFeature.types;
|
|
31
31
|
import {verticalizedCharacterMap} from '../../util/verticalize_punctuation';
|
|
32
|
-
import Anchor from '../../symbol/anchor';
|
|
32
|
+
import {Anchor} from '../../symbol/anchor';
|
|
33
33
|
import {getSizeData, MAX_PACKED_SIZE} from '../../symbol/symbol_size';
|
|
34
34
|
|
|
35
35
|
import {register} from '../../util/web_worker_transfer';
|
|
36
|
-
import EvaluationParameters from '../../style/evaluation_parameters';
|
|
36
|
+
import {EvaluationParameters} from '../../style/evaluation_parameters';
|
|
37
37
|
import {Formatted, ResolvedImage} from '@maplibre/maplibre-gl-style-spec';
|
|
38
38
|
import {plugin as globalRTLTextPlugin, getRTLTextPluginStatus} from '../../source/rtl_text_plugin';
|
|
39
39
|
import {mat4} from 'gl-matrix';
|
|
@@ -47,10 +47,10 @@ import type {
|
|
|
47
47
|
} from '../bucket';
|
|
48
48
|
import type {CollisionBoxArray, CollisionBox, SymbolInstance} from '../array_types.g';
|
|
49
49
|
import type {StructArray, StructArrayMember, ViewType} from '../../util/struct_array';
|
|
50
|
-
import type SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';
|
|
51
|
-
import type Context from '../../gl/context';
|
|
52
|
-
import type IndexBuffer from '../../gl/index_buffer';
|
|
53
|
-
import type VertexBuffer from '../../gl/vertex_buffer';
|
|
50
|
+
import type {SymbolStyleLayer} from '../../style/style_layer/symbol_style_layer';
|
|
51
|
+
import type {Context} from '../../gl/context';
|
|
52
|
+
import type {IndexBuffer} from '../../gl/index_buffer';
|
|
53
|
+
import type {VertexBuffer} from '../../gl/vertex_buffer';
|
|
54
54
|
import type {SymbolQuad} from '../../symbol/quads';
|
|
55
55
|
import type {SizeData} from '../../symbol/symbol_size';
|
|
56
56
|
import type {FeatureStates} from '../../source/source_state';
|
|
@@ -304,10 +304,8 @@ register('CollisionBuffers', CollisionBuffers);
|
|
|
304
304
|
* and uses the CollisionIndex along with current camera settings to determine
|
|
305
305
|
* which symbols can actually show on the map. Collided symbols are hidden
|
|
306
306
|
* using a dynamic "OpacityVertexArray".
|
|
307
|
-
*
|
|
308
|
-
* @private
|
|
309
307
|
*/
|
|
310
|
-
class SymbolBucket implements Bucket {
|
|
308
|
+
export class SymbolBucket implements Bucket {
|
|
311
309
|
static MAX_GLYPHS: number;
|
|
312
310
|
static addDynamicAttributes: typeof addDynamicAttributes;
|
|
313
311
|
|
|
@@ -964,5 +962,4 @@ SymbolBucket.MAX_GLYPHS = 65535;
|
|
|
964
962
|
|
|
965
963
|
SymbolBucket.addDynamicAttributes = addDynamicAttributes;
|
|
966
964
|
|
|
967
|
-
export default SymbolBucket;
|
|
968
965
|
export {addDynamicAttributes};
|
package/src/data/bucket.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {CollisionBoxArray} from './array_types.g';
|
|
2
|
-
import type Style from '../style/style';
|
|
2
|
+
import type {Style} from '../style/style';
|
|
3
3
|
import type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';
|
|
4
|
-
import type FeatureIndex from './feature_index';
|
|
5
|
-
import type Context from '../gl/context';
|
|
4
|
+
import type {FeatureIndex} from './feature_index';
|
|
5
|
+
import type {Context} from '../gl/context';
|
|
6
6
|
import type {FeatureStates} from '../source/source_state';
|
|
7
7
|
import type {ImagePosition} from '../render/image_atlas';
|
|
8
8
|
import type {CanonicalTileID} from '../source/tile_id';
|
|
@@ -67,13 +67,11 @@ export type BucketFeature = {
|
|
|
67
67
|
*
|
|
68
68
|
* Buckets are designed to be built on a worker thread and then serialized and
|
|
69
69
|
* transferred back to the main thread for rendering. On the worker side, a
|
|
70
|
-
* bucket's vertex, index, and attribute data is stored in `bucket.arrays:
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* the array data now stored in `bucket.buffers: BufferGroup`.
|
|
70
|
+
* bucket's vertex, index, and attribute data is stored in `bucket.arrays: ArrayGroup`.
|
|
71
|
+
* When a bucket's data is serialized and sent back to the main thread,
|
|
72
|
+
* is gets deserialized (using `new Bucket(serializedBucketData)`, with
|
|
73
|
+
* the array data now stored in `bucket.buffers: BufferGroup`. BufferGroups
|
|
74
74
|
* hold the same data as ArrayGroups, but are tuned for consumption by WebGL.
|
|
75
|
-
*
|
|
76
|
-
* @private
|
|
77
75
|
*/
|
|
78
76
|
export interface Bucket {
|
|
79
77
|
layerIds: Array<string>;
|
|
@@ -90,8 +88,6 @@ export interface Bucket {
|
|
|
90
88
|
* Release the WebGL resources associated with the buffers. Note that because
|
|
91
89
|
* buckets are shared between layers having the same layout properties, they
|
|
92
90
|
* must be destroyed in groups (all buckets for a tile, or all symbol buckets).
|
|
93
|
-
*
|
|
94
|
-
* @private
|
|
95
91
|
*/
|
|
96
92
|
destroy(): void;
|
|
97
93
|
}
|
package/src/data/dem_data.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {register} from '../util/web_worker_transfer';
|
|
|
13
13
|
// surrounding pixel values to compute the slope at that pixel, and we cannot accurately calculate the slope at pixels on a
|
|
14
14
|
// tile's edge without backfilling from neighboring tiles.
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export class DEMData {
|
|
17
17
|
uid: string;
|
|
18
18
|
data: Uint32Array;
|
|
19
19
|
stride: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import loadGeometry from './load_geometry';
|
|
1
|
+
import {loadGeometry} from './load_geometry';
|
|
2
2
|
import type Point from '@mapbox/point-geometry';
|
|
3
3
|
import type {VectorTileFeature} from '@mapbox/vector-tile';
|
|
4
4
|
|
|
@@ -19,11 +19,10 @@ type EvaluationFeature = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Construct a new feature based on a VectorTileFeature for expression evaluation, the geometry of which
|
|
21
21
|
* will be loaded based on necessity.
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @private
|
|
22
|
+
* @param feature - the feature to evaluate
|
|
23
|
+
* @param needGeometry - if set to true this will load the geometry
|
|
25
24
|
*/
|
|
26
|
-
export
|
|
25
|
+
export function toEvaluationFeature(feature: VectorTileFeature, needGeometry: boolean): EvaluationFeature {
|
|
27
26
|
return {type: feature.type,
|
|
28
27
|
id: feature.id,
|
|
29
28
|
properties: feature.properties,
|
package/src/data/extent.ts
CHANGED
|
@@ -9,8 +9,5 @@
|
|
|
9
9
|
* * One bit is lost because the line vertex buffer used to pack 1 bit of other data into the int.
|
|
10
10
|
* * One bit is lost to support features extending past the extent on the right edge of the tile.
|
|
11
11
|
* * This leaves us with 2^13 = 8192
|
|
12
|
-
*
|
|
13
|
-
* @private
|
|
14
|
-
* @readonly
|
|
15
12
|
*/
|
|
16
|
-
export
|
|
13
|
+
export const EXTENT = 8192;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import Point from '@mapbox/point-geometry';
|
|
2
|
-
import loadGeometry from './load_geometry';
|
|
3
|
-
import toEvaluationFeature from './evaluation_feature';
|
|
4
|
-
import EXTENT from './extent';
|
|
2
|
+
import {loadGeometry} from './load_geometry';
|
|
3
|
+
import {toEvaluationFeature} from './evaluation_feature';
|
|
4
|
+
import {EXTENT} from './extent';
|
|
5
5
|
import {featureFilter} from '@maplibre/maplibre-gl-style-spec';
|
|
6
|
-
import TransferableGridIndex from '../util/transferable_grid_index';
|
|
7
|
-
import DictionaryCoder from '../util/dictionary_coder';
|
|
6
|
+
import {TransferableGridIndex} from '../util/transferable_grid_index';
|
|
7
|
+
import {DictionaryCoder} from '../util/dictionary_coder';
|
|
8
8
|
import vt from '@mapbox/vector-tile';
|
|
9
9
|
import Protobuf from 'pbf';
|
|
10
|
-
import GeoJSONFeature from '../util/vectortile_to_geojson';
|
|
10
|
+
import {GeoJSONFeature} from '../util/vectortile_to_geojson';
|
|
11
11
|
import type {MapGeoJSONFeature} from '../util/vectortile_to_geojson';
|
|
12
12
|
import {arraysIntersect, mapObject, extend} from '../util/util';
|
|
13
13
|
import {OverscaledTileID} from '../source/tile_id';
|
|
14
14
|
import {register} from '../util/web_worker_transfer';
|
|
15
|
-
import EvaluationParameters from '../style/evaluation_parameters';
|
|
16
|
-
import SourceFeatureState from '../source/source_state';
|
|
15
|
+
import {EvaluationParameters} from '../style/evaluation_parameters';
|
|
16
|
+
import {SourceFeatureState} from '../source/source_state';
|
|
17
17
|
import {polygonIntersectsBox} from '../util/intersection_tests';
|
|
18
18
|
import {PossiblyEvaluated} from '../style/properties';
|
|
19
19
|
import {FeatureIndexArray} from './array_types.g';
|
|
20
20
|
import {mat4} from 'gl-matrix';
|
|
21
21
|
|
|
22
|
-
import type StyleLayer from '../style/style_layer';
|
|
22
|
+
import type {StyleLayer} from '../style/style_layer';
|
|
23
23
|
import type {FeatureFilter, FeatureState, FilterSpecification, PromoteIdSpecification} from '@maplibre/maplibre-gl-style-spec';
|
|
24
|
-
import type Transform from '../geo/transform';
|
|
24
|
+
import type {Transform} from '../geo/transform';
|
|
25
25
|
import type {VectorTileFeature, VectorTileLayer} from '@mapbox/vector-tile';
|
|
26
26
|
|
|
27
27
|
type QueryParameters = {
|
|
@@ -39,7 +39,10 @@ type QueryParameters = {
|
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* An in memory index class to allow fast interaction with features
|
|
44
|
+
*/
|
|
45
|
+
export class FeatureIndex {
|
|
43
46
|
tileID: OverscaledTileID;
|
|
44
47
|
x: number;
|
|
45
48
|
y: number;
|
|
@@ -308,8 +311,6 @@ register(
|
|
|
308
311
|
{omit: ['rawTileData', 'sourceLayerCoder']}
|
|
309
312
|
);
|
|
310
313
|
|
|
311
|
-
export default FeatureIndex;
|
|
312
|
-
|
|
313
314
|
function evaluateProperties(serializedProperties, styleLayerProperties, feature, featureState, availableImages) {
|
|
314
315
|
return mapObject(serializedProperties, (property, key) => {
|
|
315
316
|
const prop = styleLayerProperties instanceof PossiblyEvaluated ? styleLayerProperties.get(key) : null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {FeaturePositionMap} from './feature_position_map';
|
|
2
2
|
import {serialize, deserialize} from '../util/web_worker_transfer';
|
|
3
3
|
|
|
4
4
|
describe('FeaturePositionMap', () => {
|
|
5
5
|
test('Can be queried after serialization/deserialization', () => {
|
|
6
|
-
const featureMap = new
|
|
6
|
+
const featureMap = new FeaturePositionMap();
|
|
7
7
|
featureMap.add(7, 1, 0, 1);
|
|
8
8
|
featureMap.add(3, 2, 1, 2);
|
|
9
9
|
featureMap.add(7, 3, 2, 3);
|
|
@@ -11,7 +11,7 @@ describe('FeaturePositionMap', () => {
|
|
|
11
11
|
featureMap.add(2, 5, 4, 5);
|
|
12
12
|
featureMap.add(7, 6, 5, 7);
|
|
13
13
|
|
|
14
|
-
const featureMap2 = deserialize(serialize(featureMap, [])) as
|
|
14
|
+
const featureMap2 = deserialize(serialize(featureMap, [])) as FeaturePositionMap;
|
|
15
15
|
|
|
16
16
|
const compareIndex = (a, b) => a.index - b.index;
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ describe('FeaturePositionMap', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('Can not be queried before serialization/deserialization', () => {
|
|
26
|
-
const featureMap = new
|
|
26
|
+
const featureMap = new FeaturePositionMap();
|
|
27
27
|
featureMap.add(0, 1, 2, 3);
|
|
28
28
|
|
|
29
29
|
expect(() => {
|
|
@@ -13,7 +13,7 @@ type FeaturePosition = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
// A transferable data structure that maps feature ids to their indices and buffer offsets
|
|
16
|
-
export
|
|
16
|
+
export class FeaturePositionMap {
|
|
17
17
|
ids: Array<number>;
|
|
18
18
|
positions: Array<number>;
|
|
19
19
|
indexed: boolean;
|
|
@@ -5,6 +5,5 @@ import {LineIndexArray, TriangleIndexArray, LineStripIndexArray} from './array_t
|
|
|
5
5
|
* three kinds of index arrays: arrays storing groups of three indices, forming triangles;
|
|
6
6
|
* arrays storing pairs of indices, forming line segments; and arrays storing single indices,
|
|
7
7
|
* forming a line strip.
|
|
8
|
-
* @private
|
|
9
8
|
*/
|
|
10
9
|
export {LineIndexArray, TriangleIndexArray, LineStripIndexArray};
|
|
@@ -2,7 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import Protobuf from 'pbf';
|
|
4
4
|
import {VectorTile} from '@mapbox/vector-tile';
|
|
5
|
-
import loadGeometry from './load_geometry';
|
|
5
|
+
import {loadGeometry} from './load_geometry';
|
|
6
6
|
|
|
7
7
|
// Load a line feature from fixture tile.
|
|
8
8
|
const vt = new VectorTile(new Protobuf(fs.readFileSync(path.resolve(__dirname, '../../test/unit/assets/mbsv5-6-18-23.vector.pbf'))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {warnOnce, clamp} from '../util/util';
|
|
2
2
|
|
|
3
|
-
import EXTENT from './extent';
|
|
3
|
+
import {EXTENT} from './extent';
|
|
4
4
|
|
|
5
5
|
import type Point from '@mapbox/point-geometry';
|
|
6
6
|
import type {VectorTileFeature} from '@mapbox/vector-tile';
|
|
@@ -16,10 +16,9 @@ const MIN = -MAX - 1;
|
|
|
16
16
|
/**
|
|
17
17
|
* Loads a geometry from a VectorTileFeature and scales it to the common extent
|
|
18
18
|
* used internally.
|
|
19
|
-
* @param
|
|
20
|
-
* @private
|
|
19
|
+
* @param feature - the vector tile feature to load
|
|
21
20
|
*/
|
|
22
|
-
export
|
|
21
|
+
export function loadGeometry(feature: VectorTileFeature): Array<Array<Point>> {
|
|
23
22
|
const scale = EXTENT / feature.extent;
|
|
24
23
|
const geometry = feature.loadGeometry();
|
|
25
24
|
for (let r = 0; r < geometry.length; r++) {
|
|
@@ -4,19 +4,19 @@ import {register} from '../util/web_worker_transfer';
|
|
|
4
4
|
import {PossiblyEvaluatedPropertyValue} from '../style/properties';
|
|
5
5
|
import {StructArrayLayout1f4, StructArrayLayout2f8, StructArrayLayout4f16, PatternLayoutArray} from './array_types.g';
|
|
6
6
|
import {clamp} from '../util/util';
|
|
7
|
-
import patternAttributes from './bucket/pattern_attributes';
|
|
8
|
-
import EvaluationParameters from '../style/evaluation_parameters';
|
|
9
|
-
import FeaturePositionMap from './feature_position_map';
|
|
7
|
+
import {patternAttributes} from './bucket/pattern_attributes';
|
|
8
|
+
import {EvaluationParameters} from '../style/evaluation_parameters';
|
|
9
|
+
import {FeaturePositionMap} from './feature_position_map';
|
|
10
10
|
import {Uniform, Uniform1f, UniformColor, Uniform4f} from '../render/uniform_binding';
|
|
11
11
|
|
|
12
12
|
import type {UniformLocations} from '../render/uniform_binding';
|
|
13
13
|
|
|
14
14
|
import type {CanonicalTileID} from '../source/tile_id';
|
|
15
|
-
import type Context from '../gl/context';
|
|
15
|
+
import type {Context} from '../gl/context';
|
|
16
16
|
import type {TypedStyleLayer} from '../style/style_layer/typed_style_layer';
|
|
17
17
|
import type {CrossfadeParameters} from '../style/evaluation_parameters';
|
|
18
18
|
import type {StructArray, StructArrayMember} from '../util/struct_array';
|
|
19
|
-
import type VertexBuffer from '../gl/vertex_buffer';
|
|
19
|
+
import type {VertexBuffer} from '../gl/vertex_buffer';
|
|
20
20
|
import type {ImagePosition} from '../render/image_atlas';
|
|
21
21
|
import type {
|
|
22
22
|
Feature,
|
|
@@ -66,10 +66,7 @@ function packColor(color: Color): [number, number] {
|
|
|
66
66
|
*
|
|
67
67
|
* Note that the shader source varies depending on whether we're using a uniform or
|
|
68
68
|
* attribute. We dynamically compile shaders at runtime to accommodate this.
|
|
69
|
-
*
|
|
70
|
-
* @private
|
|
71
69
|
*/
|
|
72
|
-
|
|
73
70
|
interface AttributeBinder {
|
|
74
71
|
populatePaintArray(
|
|
75
72
|
length: number,
|
|
@@ -412,10 +409,8 @@ class CrossFadedCompositeBinder implements AttributeBinder {
|
|
|
412
409
|
* When a vector tile is parsed, this same configuration information is used to
|
|
413
410
|
* populate the attribute buffers needed for data-driven styling using the zoom
|
|
414
411
|
* level and feature property data.
|
|
415
|
-
*
|
|
416
|
-
* @private
|
|
417
412
|
*/
|
|
418
|
-
export
|
|
413
|
+
export class ProgramConfiguration {
|
|
419
414
|
binders: {[_: string]: AttributeBinder | UniformBinder};
|
|
420
415
|
cacheKey: string;
|
|
421
416
|
|
package/src/data/segment.ts
CHANGED
|
@@ -2,9 +2,12 @@ import {warnOnce} from '../util/util';
|
|
|
2
2
|
|
|
3
3
|
import {register} from '../util/web_worker_transfer';
|
|
4
4
|
|
|
5
|
-
import type VertexArrayObject from '../render/vertex_array_object';
|
|
5
|
+
import type {VertexArrayObject} from '../render/vertex_array_object';
|
|
6
6
|
import type {StructArray} from '../util/struct_array';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A single segment of a vector
|
|
10
|
+
*/
|
|
8
11
|
export type Segment = {
|
|
9
12
|
sortKey?: number;
|
|
10
13
|
vertexOffset: number;
|
|
@@ -14,7 +17,10 @@ export type Segment = {
|
|
|
14
17
|
vaos: {[_: string]: VertexArrayObject};
|
|
15
18
|
};
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Used for calculations on vector segments
|
|
22
|
+
*/
|
|
23
|
+
export class SegmentVector {
|
|
18
24
|
static MAX_VERTEX_ARRAY_LENGTH: number;
|
|
19
25
|
segments: Array<Segment>;
|
|
20
26
|
|
|
@@ -72,13 +78,10 @@ class SegmentVector {
|
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
/**
|
|
76
82
|
* The maximum size of a vertex array. This limit is imposed by WebGL's 16 bit
|
|
77
83
|
* addressing of vertex buffers.
|
|
78
|
-
* @private
|
|
79
|
-
* @readonly
|
|
80
84
|
*/
|
|
81
85
|
SegmentVector.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1;
|
|
82
86
|
|
|
83
87
|
register('SegmentVector', SegmentVector);
|
|
84
|
-
export default SegmentVector;
|