@mapwhit/tilerenderer 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +87 -0
- package/README.md +25 -0
- package/build/min/.dir +0 -0
- package/build/min/package.json +3 -0
- package/build/min/src/shaders/_prelude.fragment.glsl.txt +13 -0
- package/build/min/src/shaders/_prelude.vertex.glsl.txt +14 -0
- package/build/min/src/shaders/background.fragment.glsl.txt +5 -0
- package/build/min/src/shaders/background.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/background_pattern.fragment.glsl.txt +5 -0
- package/build/min/src/shaders/background_pattern.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/circle.fragment.glsl.txt +20 -0
- package/build/min/src/shaders/circle.vertex.glsl.txt +17 -0
- package/build/min/src/shaders/clipping_mask.fragment.glsl.txt +1 -0
- package/build/min/src/shaders/clipping_mask.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/collision_box.fragment.glsl.txt +1 -0
- package/build/min/src/shaders/collision_box.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/collision_circle.fragment.glsl.txt +1 -0
- package/build/min/src/shaders/collision_circle.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/debug.fragment.glsl.txt +1 -0
- package/build/min/src/shaders/debug.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/fill.fragment.glsl.txt +10 -0
- package/build/min/src/shaders/fill.vertex.glsl.txt +7 -0
- package/build/min/src/shaders/fill_extrusion.fragment.glsl.txt +13 -0
- package/build/min/src/shaders/fill_extrusion.vertex.glsl.txt +9 -0
- package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.txt +15 -0
- package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.txt +11 -0
- package/build/min/src/shaders/fill_outline.fragment.glsl.txt +10 -0
- package/build/min/src/shaders/fill_outline.vertex.glsl.txt +7 -0
- package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.txt +13 -0
- package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.txt +9 -0
- package/build/min/src/shaders/fill_pattern.fragment.glsl.txt +13 -0
- package/build/min/src/shaders/fill_pattern.vertex.glsl.txt +9 -0
- package/build/min/src/shaders/heatmap.fragment.glsl.txt +10 -0
- package/build/min/src/shaders/heatmap.vertex.glsl.txt +8 -0
- package/build/min/src/shaders/heatmap_texture.fragment.glsl.txt +5 -0
- package/build/min/src/shaders/heatmap_texture.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/hillshade.fragment.glsl.txt +7 -0
- package/build/min/src/shaders/hillshade.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/hillshade_prepare.fragment.glsl.txt +8 -0
- package/build/min/src/shaders/hillshade_prepare.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/line.fragment.glsl.txt +12 -0
- package/build/min/src/shaders/line.vertex.glsl.txt +17 -0
- package/build/min/src/shaders/line_gradient.fragment.glsl.txt +10 -0
- package/build/min/src/shaders/line_gradient.vertex.glsl.txt +16 -0
- package/build/min/src/shaders/line_pattern.fragment.glsl.txt +15 -0
- package/build/min/src/shaders/line_pattern.vertex.glsl.txt +20 -0
- package/build/min/src/shaders/line_sdf.fragment.glsl.txt +17 -0
- package/build/min/src/shaders/line_sdf.vertex.glsl.txt +20 -0
- package/build/min/src/shaders/raster.fragment.glsl.txt +5 -0
- package/build/min/src/shaders/raster.vertex.glsl.txt +1 -0
- package/build/min/src/shaders/symbol_icon.fragment.glsl.txt +9 -0
- package/build/min/src/shaders/symbol_icon.vertex.glsl.txt +5 -0
- package/build/min/src/shaders/symbol_sdf.fragment.glsl.txt +19 -0
- package/build/min/src/shaders/symbol_sdf.vertex.glsl.txt +13 -0
- package/package.json +44 -0
- package/src/css/mapbox-gl.css +506 -0
- package/src/css/svg/mapboxgl-ctrl-attrib.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-compass.svg +4 -0
- package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-geolocate-background.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-geolocate.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-logo-compact.svg +2 -0
- package/src/css/svg/mapboxgl-ctrl-logo.svg +1 -0
- package/src/css/svg/mapboxgl-ctrl-shrink.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +3 -0
- package/src/data/array_types.js +1138 -0
- package/src/data/bucket/circle_attributes.js +5 -0
- package/src/data/bucket/circle_bucket.js +118 -0
- package/src/data/bucket/fill_attributes.js +5 -0
- package/src/data/bucket/fill_bucket.js +166 -0
- package/src/data/bucket/fill_extrusion_attributes.js +11 -0
- package/src/data/bucket/fill_extrusion_bucket.js +247 -0
- package/src/data/bucket/heatmap_bucket.js +12 -0
- package/src/data/bucket/line_attributes.js +11 -0
- package/src/data/bucket/line_bucket.js +625 -0
- package/src/data/bucket/pattern_attributes.js +9 -0
- package/src/data/bucket/pattern_bucket_features.js +44 -0
- package/src/data/bucket/symbol_attributes.js +95 -0
- package/src/data/bucket/symbol_bucket.js +697 -0
- package/src/data/bucket.js +53 -0
- package/src/data/dem_data.js +126 -0
- package/src/data/extent.js +17 -0
- package/src/data/feature_index.js +254 -0
- package/src/data/index_array_type.js +14 -0
- package/src/data/load_geometry.js +42 -0
- package/src/data/pos_attributes.js +3 -0
- package/src/data/program_configuration.js +782 -0
- package/src/data/raster_bounds_attributes.js +6 -0
- package/src/data/segment.js +63 -0
- package/src/geo/coordinate.js +78 -0
- package/src/geo/lng_lat.js +129 -0
- package/src/geo/lng_lat_bounds.js +253 -0
- package/src/geo/transform.js +605 -0
- package/src/gl/color_mode.js +21 -0
- package/src/gl/context.js +193 -0
- package/src/gl/cull_face_mode.js +22 -0
- package/src/gl/depth_mode.js +18 -0
- package/src/gl/framebuffer.js +28 -0
- package/src/gl/index_buffer.js +52 -0
- package/src/gl/stencil_mode.js +17 -0
- package/src/gl/types.js +0 -0
- package/src/gl/value.js +676 -0
- package/src/gl/vertex_buffer.js +101 -0
- package/src/index.js +50 -0
- package/src/render/draw_background.js +60 -0
- package/src/render/draw_circle.js +55 -0
- package/src/render/draw_collision_debug.js +45 -0
- package/src/render/draw_debug.js +429 -0
- package/src/render/draw_fill.js +143 -0
- package/src/render/draw_fill_extrusion.js +101 -0
- package/src/render/draw_heatmap.js +159 -0
- package/src/render/draw_hillshade.js +144 -0
- package/src/render/draw_line.js +99 -0
- package/src/render/draw_raster.js +151 -0
- package/src/render/draw_symbol.js +231 -0
- package/src/render/glyph_atlas.js +55 -0
- package/src/render/glyph_manager.js +145 -0
- package/src/render/image_atlas.js +97 -0
- package/src/render/image_manager.js +183 -0
- package/src/render/line_atlas.js +139 -0
- package/src/render/painter.js +483 -0
- package/src/render/program/background_program.js +46 -0
- package/src/render/program/circle_program.js +40 -0
- package/src/render/program/clipping_mask_program.js +11 -0
- package/src/render/program/collision_program.js +28 -0
- package/src/render/program/debug_program.js +13 -0
- package/src/render/program/fill_extrusion_program.js +76 -0
- package/src/render/program/fill_program.js +60 -0
- package/src/render/program/heatmap_program.js +46 -0
- package/src/render/program/hillshade_program.js +77 -0
- package/src/render/program/line_program.js +119 -0
- package/src/render/program/pattern.js +57 -0
- package/src/render/program/program_uniforms.js +46 -0
- package/src/render/program/raster_program.js +50 -0
- package/src/render/program/symbol_program.js +112 -0
- package/src/render/program.js +133 -0
- package/src/render/texture.js +88 -0
- package/src/render/tile_mask.js +108 -0
- package/src/render/uniform_binding.js +129 -0
- package/src/render/vertex_array_object.js +155 -0
- package/src/shaders/README.md +42 -0
- package/src/shaders/_prelude.fragment.glsl +17 -0
- package/src/shaders/_prelude.vertex.glsl +73 -0
- package/src/shaders/background.fragment.glsl +10 -0
- package/src/shaders/background.vertex.glsl +7 -0
- package/src/shaders/background_pattern.fragment.glsl +28 -0
- package/src/shaders/background_pattern.vertex.glsl +20 -0
- package/src/shaders/circle.fragment.glsl +39 -0
- package/src/shaders/circle.vertex.glsl +63 -0
- package/src/shaders/clipping_mask.fragment.glsl +3 -0
- package/src/shaders/clipping_mask.vertex.glsl +7 -0
- package/src/shaders/collision_box.fragment.glsl +21 -0
- package/src/shaders/collision_box.vertex.glsl +26 -0
- package/src/shaders/collision_circle.fragment.glsl +34 -0
- package/src/shaders/collision_circle.vertex.glsl +36 -0
- package/src/shaders/debug.fragment.glsl +5 -0
- package/src/shaders/debug.vertex.glsl +7 -0
- package/src/shaders/encode_attribute.js +19 -0
- package/src/shaders/fill.fragment.glsl +13 -0
- package/src/shaders/fill.vertex.glsl +13 -0
- package/src/shaders/fill_extrusion.fragment.glsl +16 -0
- package/src/shaders/fill_extrusion.vertex.glsl +66 -0
- package/src/shaders/fill_extrusion_pattern.fragment.glsl +41 -0
- package/src/shaders/fill_extrusion_pattern.vertex.glsl +76 -0
- package/src/shaders/fill_outline.fragment.glsl +17 -0
- package/src/shaders/fill_outline.vertex.glsl +17 -0
- package/src/shaders/fill_outline_pattern.fragment.glsl +43 -0
- package/src/shaders/fill_outline_pattern.vertex.glsl +41 -0
- package/src/shaders/fill_pattern.fragment.glsl +36 -0
- package/src/shaders/fill_pattern.vertex.glsl +36 -0
- package/src/shaders/heatmap.fragment.glsl +21 -0
- package/src/shaders/heatmap.vertex.glsl +53 -0
- package/src/shaders/heatmap_texture.fragment.glsl +14 -0
- package/src/shaders/heatmap_texture.vertex.glsl +11 -0
- package/src/shaders/hillshade.fragment.glsl +52 -0
- package/src/shaders/hillshade.vertex.glsl +11 -0
- package/src/shaders/hillshade_prepare.fragment.glsl +72 -0
- package/src/shaders/hillshade_prepare.vertex.glsl +15 -0
- package/src/shaders/index.js +194 -0
- package/src/shaders/line.fragment.glsl +28 -0
- package/src/shaders/line.vertex.glsl +84 -0
- package/src/shaders/line_gradient.fragment.glsl +34 -0
- package/src/shaders/line_gradient.vertex.glsl +84 -0
- package/src/shaders/line_pattern.fragment.glsl +69 -0
- package/src/shaders/line_pattern.vertex.glsl +88 -0
- package/src/shaders/line_sdf.fragment.glsl +44 -0
- package/src/shaders/line_sdf.vertex.glsl +95 -0
- package/src/shaders/raster.fragment.glsl +52 -0
- package/src/shaders/raster.vertex.glsl +21 -0
- package/src/shaders/symbol_icon.fragment.glsl +17 -0
- package/src/shaders/symbol_icon.vertex.glsl +91 -0
- package/src/shaders/symbol_sdf.fragment.glsl +50 -0
- package/src/shaders/symbol_sdf.vertex.glsl +117 -0
- package/src/source/geojson_source.js +267 -0
- package/src/source/geojson_worker_source.js +210 -0
- package/src/source/geojson_wrapper.js +67 -0
- package/src/source/image_source.js +213 -0
- package/src/source/load_tilejson.js +40 -0
- package/src/source/pixels_to_tile_units.js +17 -0
- package/src/source/query_features.js +198 -0
- package/src/source/raster_dem_tile_source.js +140 -0
- package/src/source/raster_dem_tile_worker_source.js +26 -0
- package/src/source/raster_tile_source.js +126 -0
- package/src/source/rtl_text_plugin.js +63 -0
- package/src/source/source.js +75 -0
- package/src/source/source_cache.js +794 -0
- package/src/source/source_state.js +55 -0
- package/src/source/tile.js +332 -0
- package/src/source/tile_bounds.js +40 -0
- package/src/source/tile_cache.js +122 -0
- package/src/source/tile_id.js +150 -0
- package/src/source/vector_tile_source.js +144 -0
- package/src/source/vector_tile_worker_source.js +126 -0
- package/src/source/worker.js +175 -0
- package/src/source/worker_source.js +14 -0
- package/src/source/worker_tile.js +199 -0
- package/src/style/create_style_layer.js +25 -0
- package/src/style/evaluation_parameters.js +45 -0
- package/src/style/light.js +112 -0
- package/src/style/load_glyph_range.js +17 -0
- package/src/style/load_sprite.js +26 -0
- package/src/style/parse_glyph_pbf.js +45 -0
- package/src/style/pauseable_placement.js +88 -0
- package/src/style/properties.js +691 -0
- package/src/style/query_utils.js +39 -0
- package/src/style/style.js +955 -0
- package/src/style/style_layer/background_style_layer.js +11 -0
- package/src/style/style_layer/background_style_layer_properties.js +25 -0
- package/src/style/style_layer/circle_style_layer.js +93 -0
- package/src/style/style_layer/circle_style_layer_properties.js +76 -0
- package/src/style/style_layer/fill_extrusion_style_layer.js +194 -0
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +56 -0
- package/src/style/style_layer/fill_style_layer.js +46 -0
- package/src/style/style_layer/fill_style_layer_properties.js +45 -0
- package/src/style/style_layer/heatmap_style_layer.js +51 -0
- package/src/style/style_layer/heatmap_style_layer_properties.js +52 -0
- package/src/style/style_layer/hillshade_style_layer.js +15 -0
- package/src/style/style_layer/hillshade_style_layer_properties.js +43 -0
- package/src/style/style_layer/line_style_layer.js +129 -0
- package/src/style/style_layer/line_style_layer_properties.js +104 -0
- package/src/style/style_layer/raster_style_layer.js +11 -0
- package/src/style/style_layer/raster_style_layer_properties.js +55 -0
- package/src/style/style_layer/symbol_style_layer.js +66 -0
- package/src/style/style_layer/symbol_style_layer_properties.js +288 -0
- package/src/style/style_layer.js +183 -0
- package/src/style/style_layer_index.js +61 -0
- package/src/style/zoom_history.js +36 -0
- package/src/style-spec/deref.js +51 -0
- package/src/style-spec/error/parsing_error.js +8 -0
- package/src/style-spec/error/validation_error.js +10 -0
- package/src/style-spec/expression/compound_expression.js +118 -0
- package/src/style-spec/expression/definitions/array.js +82 -0
- package/src/style-spec/expression/definitions/assertion.js +69 -0
- package/src/style-spec/expression/definitions/at.js +57 -0
- package/src/style-spec/expression/definitions/case.js +73 -0
- package/src/style-spec/expression/definitions/coalesce.js +68 -0
- package/src/style-spec/expression/definitions/coercion.js +96 -0
- package/src/style-spec/expression/definitions/collator.js +102 -0
- package/src/style-spec/expression/definitions/equals.js +93 -0
- package/src/style-spec/expression/definitions/index.js +407 -0
- package/src/style-spec/expression/definitions/interpolate.js +235 -0
- package/src/style-spec/expression/definitions/length.js +54 -0
- package/src/style-spec/expression/definitions/let.js +60 -0
- package/src/style-spec/expression/definitions/literal.js +64 -0
- package/src/style-spec/expression/definitions/match.js +142 -0
- package/src/style-spec/expression/definitions/step.js +116 -0
- package/src/style-spec/expression/definitions/var.js +38 -0
- package/src/style-spec/expression/evaluation_context.js +35 -0
- package/src/style-spec/expression/index.js +329 -0
- package/src/style-spec/expression/is_constant.js +63 -0
- package/src/style-spec/expression/parsing_context.js +213 -0
- package/src/style-spec/expression/parsing_error.js +9 -0
- package/src/style-spec/expression/runtime_error.js +12 -0
- package/src/style-spec/expression/scope.js +34 -0
- package/src/style-spec/expression/stops.js +37 -0
- package/src/style-spec/expression/types.js +77 -0
- package/src/style-spec/expression/values.js +126 -0
- package/src/style-spec/feature_filter/README.md +55 -0
- package/src/style-spec/feature_filter/index.js +158 -0
- package/src/style-spec/function/convert.js +256 -0
- package/src/style-spec/function/index.js +299 -0
- package/src/style-spec/group_by_layout.js +68 -0
- package/src/style-spec/reference/v8.json +5356 -0
- package/src/style-spec/util/color.js +73 -0
- package/src/style-spec/util/color_spaces.js +128 -0
- package/src/style-spec/util/eval_support.js +8 -0
- package/src/style-spec/util/get_type.js +18 -0
- package/src/style-spec/util/interpolate.js +21 -0
- package/src/style-spec/util/properties.js +17 -0
- package/src/style-spec/util/ref_properties.js +1 -0
- package/src/style-spec/util/result.js +19 -0
- package/src/symbol/anchor.js +21 -0
- package/src/symbol/check_max_angle.js +75 -0
- package/src/symbol/clip_line.js +73 -0
- package/src/symbol/collision_feature.js +230 -0
- package/src/symbol/collision_index.js +379 -0
- package/src/symbol/cross_tile_symbol_index.js +270 -0
- package/src/symbol/get_anchors.js +177 -0
- package/src/symbol/grid_index.js +318 -0
- package/src/symbol/mergelines.js +75 -0
- package/src/symbol/opacity_state.js +21 -0
- package/src/symbol/placement.js +563 -0
- package/src/symbol/projection.js +601 -0
- package/src/symbol/quads.js +173 -0
- package/src/symbol/shaping.js +347 -0
- package/src/symbol/symbol_layout.js +519 -0
- package/src/symbol/symbol_size.js +110 -0
- package/src/symbol/transform_text.js +16 -0
- package/src/ui/anchor.js +24 -0
- package/src/ui/bind_handlers.js +199 -0
- package/src/ui/camera.js +954 -0
- package/src/ui/events.js +210 -0
- package/src/ui/handler/box_zoom.js +151 -0
- package/src/ui/handler/dblclick_zoom.js +91 -0
- package/src/ui/handler/drag_pan.js +285 -0
- package/src/ui/handler/drag_rotate.js +290 -0
- package/src/ui/handler/frame.js +28 -0
- package/src/ui/handler/inertia.js +45 -0
- package/src/ui/handler/keyboard.js +148 -0
- package/src/ui/handler/scroll_zoom.js +284 -0
- package/src/ui/handler/touch_zoom_rotate.js +263 -0
- package/src/ui/map.js +1645 -0
- package/src/util/actor.js +104 -0
- package/src/util/async.js +23 -0
- package/src/util/browser.js +61 -0
- package/src/util/callback.js +26 -0
- package/src/util/classify_rings.js +43 -0
- package/src/util/color_ramp.js +24 -0
- package/src/util/config.js +24 -0
- package/src/util/dictionary_coder.js +25 -0
- package/src/util/dispatcher.js +68 -0
- package/src/util/dom.js +102 -0
- package/src/util/evented.js +182 -0
- package/src/util/find_pole_of_inaccessibility.js +129 -0
- package/src/util/global_worker_pool.js +15 -0
- package/src/util/image.js +124 -0
- package/src/util/interpolate.js +5 -0
- package/src/util/intersection_tests.js +207 -0
- package/src/util/is_char_in_unicode_block.js +287 -0
- package/src/util/loader/image.js +32 -0
- package/src/util/object.js +178 -0
- package/src/util/script_detection.js +337 -0
- package/src/util/struct_array.js +197 -0
- package/src/util/task_queue.js +57 -0
- package/src/util/throttle.js +26 -0
- package/src/util/tile_cover.js +114 -0
- package/src/util/token.js +13 -0
- package/src/util/unique_id.js +12 -0
- package/src/util/util.js +192 -0
- package/src/util/vectortile_to_geojson.js +44 -0
- package/src/util/verticalize_punctuation.js +112 -0
- package/src/util/warn.js +21 -0
- package/src/util/web_worker.js +5 -0
- package/src/util/web_worker_transfer.js +228 -0
- package/src/util/worker_pool.js +41 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const { CircleLayoutArray } = require('../array_types');
|
|
2
|
+
|
|
3
|
+
const { members: layoutAttributes } = require('./circle_attributes');
|
|
4
|
+
const SegmentVector = require('../segment');
|
|
5
|
+
const { ProgramConfigurationSet } = require('../program_configuration');
|
|
6
|
+
const { TriangleIndexArray } = require('../index_array_type');
|
|
7
|
+
const loadGeometry = require('../load_geometry');
|
|
8
|
+
const EXTENT = require('../extent');
|
|
9
|
+
const { register } = require('../../util/web_worker_transfer');
|
|
10
|
+
const EvaluationParameters = require('../../style/evaluation_parameters');
|
|
11
|
+
|
|
12
|
+
function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
|
|
13
|
+
layoutVertexArray.emplaceBack(x * 2 + (extrudeX + 1) / 2, y * 2 + (extrudeY + 1) / 2);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Circles are represented by two triangles.
|
|
18
|
+
*
|
|
19
|
+
* Each corner has a pos that is the center of the circle and an extrusion
|
|
20
|
+
* vector that is where it points.
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
class CircleBucket {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this.zoom = options.zoom;
|
|
26
|
+
this.overscaling = options.overscaling;
|
|
27
|
+
this.layers = options.layers;
|
|
28
|
+
this.layerIds = this.layers.map(layer => layer.id);
|
|
29
|
+
this.index = options.index;
|
|
30
|
+
this.hasPattern = false;
|
|
31
|
+
|
|
32
|
+
this.layoutVertexArray = new CircleLayoutArray();
|
|
33
|
+
this.indexArray = new TriangleIndexArray();
|
|
34
|
+
this.segments = new SegmentVector();
|
|
35
|
+
this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
populate(features, options) {
|
|
39
|
+
for (const { feature, index, sourceLayerIndex } of features) {
|
|
40
|
+
if (this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) {
|
|
41
|
+
const geometry = loadGeometry(feature);
|
|
42
|
+
this.addFeature(feature, geometry, index);
|
|
43
|
+
options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
update(states, vtLayer, imagePositions) {
|
|
49
|
+
if (!this.stateDependentLayers.length) return;
|
|
50
|
+
this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
isEmpty() {
|
|
54
|
+
return this.layoutVertexArray.length === 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
uploadPending() {
|
|
58
|
+
return !this.uploaded || this.programConfigurations.needsUpload;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
upload(context) {
|
|
62
|
+
if (!this.uploaded) {
|
|
63
|
+
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);
|
|
64
|
+
this.indexBuffer = context.createIndexBuffer(this.indexArray);
|
|
65
|
+
}
|
|
66
|
+
this.programConfigurations.upload(context);
|
|
67
|
+
this.uploaded = true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
destroy() {
|
|
71
|
+
if (!this.layoutVertexBuffer) return;
|
|
72
|
+
this.layoutVertexBuffer.destroy();
|
|
73
|
+
this.indexBuffer.destroy();
|
|
74
|
+
this.programConfigurations.destroy();
|
|
75
|
+
this.segments.destroy();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
addFeature(feature, geometry, index) {
|
|
79
|
+
for (const ring of geometry) {
|
|
80
|
+
for (const point of ring) {
|
|
81
|
+
const x = point.x;
|
|
82
|
+
const y = point.y;
|
|
83
|
+
|
|
84
|
+
// Do not include points that are outside the tile boundaries.
|
|
85
|
+
if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;
|
|
86
|
+
|
|
87
|
+
// this geometry will be of the Point type, and we'll derive
|
|
88
|
+
// two triangles from it.
|
|
89
|
+
//
|
|
90
|
+
// ┌─────────┐
|
|
91
|
+
// │ 3 2 │
|
|
92
|
+
// │ │
|
|
93
|
+
// │ 0 1 │
|
|
94
|
+
// └─────────┘
|
|
95
|
+
|
|
96
|
+
const segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
|
|
97
|
+
const index = segment.vertexLength;
|
|
98
|
+
|
|
99
|
+
addCircleVertex(this.layoutVertexArray, x, y, -1, -1);
|
|
100
|
+
addCircleVertex(this.layoutVertexArray, x, y, 1, -1);
|
|
101
|
+
addCircleVertex(this.layoutVertexArray, x, y, 1, 1);
|
|
102
|
+
addCircleVertex(this.layoutVertexArray, x, y, -1, 1);
|
|
103
|
+
|
|
104
|
+
this.indexArray.emplaceBack(index, index + 1, index + 2);
|
|
105
|
+
this.indexArray.emplaceBack(index, index + 3, index + 2);
|
|
106
|
+
|
|
107
|
+
segment.vertexLength += 4;
|
|
108
|
+
segment.primitiveLength += 2;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, {});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
register('CircleBucket', CircleBucket, { omit: ['layers'] });
|
|
117
|
+
|
|
118
|
+
module.exports = CircleBucket;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const { FillLayoutArray } = require('../array_types');
|
|
2
|
+
|
|
3
|
+
const { members: layoutAttributes } = require('./fill_attributes');
|
|
4
|
+
const SegmentVector = require('../segment');
|
|
5
|
+
const { ProgramConfigurationSet } = require('../program_configuration');
|
|
6
|
+
const { LineIndexArray, TriangleIndexArray } = require('../index_array_type');
|
|
7
|
+
const earcut = require('earcut');
|
|
8
|
+
const classifyRings = require('../../util/classify_rings');
|
|
9
|
+
const assert = require('assert');
|
|
10
|
+
const EARCUT_MAX_RINGS = 500;
|
|
11
|
+
const { register } = require('../../util/web_worker_transfer');
|
|
12
|
+
const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
|
|
13
|
+
const loadGeometry = require('../load_geometry');
|
|
14
|
+
const EvaluationParameters = require('../../style/evaluation_parameters');
|
|
15
|
+
|
|
16
|
+
class FillBucket {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.zoom = options.zoom;
|
|
19
|
+
this.overscaling = options.overscaling;
|
|
20
|
+
this.layers = options.layers;
|
|
21
|
+
this.layerIds = this.layers.map(layer => layer.id);
|
|
22
|
+
this.index = options.index;
|
|
23
|
+
this.hasPattern = false;
|
|
24
|
+
|
|
25
|
+
this.layoutVertexArray = new FillLayoutArray();
|
|
26
|
+
this.indexArray = new TriangleIndexArray();
|
|
27
|
+
this.indexArray2 = new LineIndexArray();
|
|
28
|
+
this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);
|
|
29
|
+
this.segments = new SegmentVector();
|
|
30
|
+
this.segments2 = new SegmentVector();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
populate(features, options) {
|
|
34
|
+
this.features = [];
|
|
35
|
+
this.hasPattern = hasPattern('fill', this.layers, options);
|
|
36
|
+
|
|
37
|
+
for (const { feature, index, sourceLayerIndex } of features) {
|
|
38
|
+
if (!this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) continue;
|
|
39
|
+
|
|
40
|
+
const geometry = loadGeometry(feature);
|
|
41
|
+
|
|
42
|
+
const patternFeature = {
|
|
43
|
+
sourceLayerIndex,
|
|
44
|
+
index,
|
|
45
|
+
geometry,
|
|
46
|
+
properties: feature.properties,
|
|
47
|
+
type: feature.type,
|
|
48
|
+
patterns: {}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (typeof feature.id !== 'undefined') {
|
|
52
|
+
patternFeature.id = feature.id;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this.hasPattern) {
|
|
56
|
+
this.features.push(addPatternDependencies('fill', this.layers, patternFeature, this.zoom, options));
|
|
57
|
+
} else {
|
|
58
|
+
this.addFeature(patternFeature, geometry, index, {});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
update(states, vtLayer, imagePositions) {
|
|
66
|
+
if (!this.stateDependentLayers.length) return;
|
|
67
|
+
this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
addFeatures(options, imagePositions) {
|
|
71
|
+
for (const feature of this.features) {
|
|
72
|
+
const { geometry } = feature;
|
|
73
|
+
this.addFeature(feature, geometry, feature.index, imagePositions);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
isEmpty() {
|
|
78
|
+
return this.layoutVertexArray.length === 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
uploadPending() {
|
|
82
|
+
return !this.uploaded || this.programConfigurations.needsUpload;
|
|
83
|
+
}
|
|
84
|
+
upload(context) {
|
|
85
|
+
if (!this.uploaded) {
|
|
86
|
+
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);
|
|
87
|
+
this.indexBuffer = context.createIndexBuffer(this.indexArray);
|
|
88
|
+
this.indexBuffer2 = context.createIndexBuffer(this.indexArray2);
|
|
89
|
+
}
|
|
90
|
+
this.programConfigurations.upload(context);
|
|
91
|
+
this.uploaded = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
destroy() {
|
|
95
|
+
if (!this.layoutVertexBuffer) return;
|
|
96
|
+
this.layoutVertexBuffer.destroy();
|
|
97
|
+
this.indexBuffer.destroy();
|
|
98
|
+
this.indexBuffer2.destroy();
|
|
99
|
+
this.programConfigurations.destroy();
|
|
100
|
+
this.segments.destroy();
|
|
101
|
+
this.segments2.destroy();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
addFeature(feature, geometry, index, imagePositions) {
|
|
105
|
+
for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {
|
|
106
|
+
let numVertices = 0;
|
|
107
|
+
for (const ring of polygon) {
|
|
108
|
+
numVertices += ring.length;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const triangleSegment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);
|
|
112
|
+
const triangleIndex = triangleSegment.vertexLength;
|
|
113
|
+
|
|
114
|
+
const flattened = [];
|
|
115
|
+
const holeIndices = [];
|
|
116
|
+
|
|
117
|
+
for (const ring of polygon) {
|
|
118
|
+
if (ring.length === 0) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (ring !== polygon[0]) {
|
|
123
|
+
holeIndices.push(flattened.length / 2);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const lineSegment = this.segments2.prepareSegment(ring.length, this.layoutVertexArray, this.indexArray2);
|
|
127
|
+
const lineIndex = lineSegment.vertexLength;
|
|
128
|
+
|
|
129
|
+
this.layoutVertexArray.emplaceBack(ring[0].x, ring[0].y);
|
|
130
|
+
this.indexArray2.emplaceBack(lineIndex + ring.length - 1, lineIndex);
|
|
131
|
+
flattened.push(ring[0].x);
|
|
132
|
+
flattened.push(ring[0].y);
|
|
133
|
+
|
|
134
|
+
for (let i = 1; i < ring.length; i++) {
|
|
135
|
+
this.layoutVertexArray.emplaceBack(ring[i].x, ring[i].y);
|
|
136
|
+
this.indexArray2.emplaceBack(lineIndex + i - 1, lineIndex + i);
|
|
137
|
+
flattened.push(ring[i].x);
|
|
138
|
+
flattened.push(ring[i].y);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
lineSegment.vertexLength += ring.length;
|
|
142
|
+
lineSegment.primitiveLength += ring.length;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const indices = earcut(flattened, holeIndices);
|
|
146
|
+
assert(indices.length % 3 === 0);
|
|
147
|
+
|
|
148
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
149
|
+
this.indexArray.emplaceBack(
|
|
150
|
+
triangleIndex + indices[i],
|
|
151
|
+
triangleIndex + indices[i + 1],
|
|
152
|
+
triangleIndex + indices[i + 2]
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
triangleSegment.vertexLength += numVertices;
|
|
157
|
+
triangleSegment.primitiveLength += indices.length / 3;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
register('FillBucket', FillBucket, { omit: ['layers', 'features'] });
|
|
165
|
+
|
|
166
|
+
module.exports = FillBucket;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
const { FillExtrusionLayoutArray } = require('../array_types');
|
|
2
|
+
|
|
3
|
+
const { members: layoutAttributes } = require('./fill_extrusion_attributes');
|
|
4
|
+
const SegmentVector = require('../segment');
|
|
5
|
+
const { ProgramConfigurationSet } = require('../program_configuration');
|
|
6
|
+
const { TriangleIndexArray } = require('../index_array_type');
|
|
7
|
+
const EXTENT = require('../extent');
|
|
8
|
+
const earcut = require('earcut');
|
|
9
|
+
const {
|
|
10
|
+
VectorTileFeature: { types: vectorTileFeatureTypes }
|
|
11
|
+
} = require('@mapbox/vector-tile');
|
|
12
|
+
const classifyRings = require('../../util/classify_rings');
|
|
13
|
+
const assert = require('assert');
|
|
14
|
+
const EARCUT_MAX_RINGS = 500;
|
|
15
|
+
const { register } = require('../../util/web_worker_transfer');
|
|
16
|
+
const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
|
|
17
|
+
const loadGeometry = require('../load_geometry');
|
|
18
|
+
const EvaluationParameters = require('../../style/evaluation_parameters');
|
|
19
|
+
|
|
20
|
+
const FACTOR = 2 ** 13;
|
|
21
|
+
|
|
22
|
+
function addVertex(vertexArray, x, y, nx, ny, nz, t, e) {
|
|
23
|
+
vertexArray.emplaceBack(
|
|
24
|
+
// a_pos
|
|
25
|
+
x,
|
|
26
|
+
y,
|
|
27
|
+
// a_normal_ed: 3-component normal and 1-component edgedistance
|
|
28
|
+
Math.floor(nx * FACTOR) * 2 + t,
|
|
29
|
+
ny * FACTOR * 2,
|
|
30
|
+
nz * FACTOR * 2,
|
|
31
|
+
// edgedistance (used for wrapping patterns around extrusion sides)
|
|
32
|
+
Math.round(e)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class FillExtrusionBucket {
|
|
37
|
+
constructor(options) {
|
|
38
|
+
this.zoom = options.zoom;
|
|
39
|
+
this.overscaling = options.overscaling;
|
|
40
|
+
this.layers = options.layers;
|
|
41
|
+
this.layerIds = this.layers.map(layer => layer.id);
|
|
42
|
+
this.index = options.index;
|
|
43
|
+
this.hasPattern = false;
|
|
44
|
+
|
|
45
|
+
this.layoutVertexArray = new FillExtrusionLayoutArray();
|
|
46
|
+
this.indexArray = new TriangleIndexArray();
|
|
47
|
+
this.programConfigurations = new ProgramConfigurationSet(layoutAttributes, options.layers, options.zoom);
|
|
48
|
+
this.segments = new SegmentVector();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
populate(features, options) {
|
|
52
|
+
this.features = [];
|
|
53
|
+
this.hasPattern = hasPattern('fill-extrusion', this.layers, options);
|
|
54
|
+
|
|
55
|
+
for (const { feature, index, sourceLayerIndex } of features) {
|
|
56
|
+
if (!this.layers[0]._featureFilter(new EvaluationParameters(this.zoom), feature)) continue;
|
|
57
|
+
|
|
58
|
+
const geometry = loadGeometry(feature);
|
|
59
|
+
|
|
60
|
+
const patternFeature = {
|
|
61
|
+
sourceLayerIndex,
|
|
62
|
+
index,
|
|
63
|
+
geometry,
|
|
64
|
+
properties: feature.properties,
|
|
65
|
+
type: feature.type,
|
|
66
|
+
patterns: {}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (typeof feature.id !== 'undefined') {
|
|
70
|
+
patternFeature.id = feature.id;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (this.hasPattern) {
|
|
74
|
+
this.features.push(addPatternDependencies('fill-extrusion', this.layers, patternFeature, this.zoom, options));
|
|
75
|
+
} else {
|
|
76
|
+
this.addFeature(patternFeature, geometry, index, {});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
options.featureIndex.insert(feature, geometry, index, sourceLayerIndex, this.index, true);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
addFeatures(options, imagePositions) {
|
|
84
|
+
for (const feature of this.features) {
|
|
85
|
+
const { geometry } = feature;
|
|
86
|
+
this.addFeature(feature, geometry, feature.index, imagePositions);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
update(states, vtLayer, imagePositions) {
|
|
91
|
+
if (!this.stateDependentLayers.length) return;
|
|
92
|
+
this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
isEmpty() {
|
|
96
|
+
return this.layoutVertexArray.length === 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
uploadPending() {
|
|
100
|
+
return !this.uploaded || this.programConfigurations.needsUpload;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
upload(context) {
|
|
104
|
+
if (!this.uploaded) {
|
|
105
|
+
this.layoutVertexBuffer = context.createVertexBuffer(this.layoutVertexArray, layoutAttributes);
|
|
106
|
+
this.indexBuffer = context.createIndexBuffer(this.indexArray);
|
|
107
|
+
}
|
|
108
|
+
this.programConfigurations.upload(context);
|
|
109
|
+
this.uploaded = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
destroy() {
|
|
113
|
+
if (!this.layoutVertexBuffer) return;
|
|
114
|
+
this.layoutVertexBuffer.destroy();
|
|
115
|
+
this.indexBuffer.destroy();
|
|
116
|
+
this.programConfigurations.destroy();
|
|
117
|
+
this.segments.destroy();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
addFeature(feature, geometry, index, imagePositions) {
|
|
121
|
+
for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) {
|
|
122
|
+
let numVertices = 0;
|
|
123
|
+
for (const ring of polygon) {
|
|
124
|
+
numVertices += ring.length;
|
|
125
|
+
}
|
|
126
|
+
let segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
|
|
127
|
+
|
|
128
|
+
for (const ring of polygon) {
|
|
129
|
+
if (ring.length === 0) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (isEntirelyOutside(ring)) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let edgeDistance = 0;
|
|
138
|
+
|
|
139
|
+
for (let p = 0; p < ring.length; p++) {
|
|
140
|
+
const p1 = ring[p];
|
|
141
|
+
|
|
142
|
+
if (p >= 1) {
|
|
143
|
+
const p2 = ring[p - 1];
|
|
144
|
+
|
|
145
|
+
if (!isBoundaryEdge(p1, p2)) {
|
|
146
|
+
if (segment.vertexLength + 4 > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {
|
|
147
|
+
segment = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const perp = p1.sub(p2)._perp()._unit();
|
|
151
|
+
const dist = p2.dist(p1);
|
|
152
|
+
if (edgeDistance + dist > 32768) edgeDistance = 0;
|
|
153
|
+
|
|
154
|
+
addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 0, edgeDistance);
|
|
155
|
+
addVertex(this.layoutVertexArray, p1.x, p1.y, perp.x, perp.y, 0, 1, edgeDistance);
|
|
156
|
+
|
|
157
|
+
edgeDistance += dist;
|
|
158
|
+
|
|
159
|
+
addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 0, edgeDistance);
|
|
160
|
+
addVertex(this.layoutVertexArray, p2.x, p2.y, perp.x, perp.y, 0, 1, edgeDistance);
|
|
161
|
+
|
|
162
|
+
const bottomRight = segment.vertexLength;
|
|
163
|
+
|
|
164
|
+
// ┌──────┐
|
|
165
|
+
// │ 0 1 │ Counter-clockwise winding order.
|
|
166
|
+
// │ │ Triangle 1: 0 => 2 => 1
|
|
167
|
+
// │ 2 3 │ Triangle 2: 1 => 2 => 3
|
|
168
|
+
// └──────┘
|
|
169
|
+
this.indexArray.emplaceBack(bottomRight, bottomRight + 2, bottomRight + 1);
|
|
170
|
+
this.indexArray.emplaceBack(bottomRight + 1, bottomRight + 2, bottomRight + 3);
|
|
171
|
+
|
|
172
|
+
segment.vertexLength += 4;
|
|
173
|
+
segment.primitiveLength += 2;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (segment.vertexLength + numVertices > SegmentVector.MAX_VERTEX_ARRAY_LENGTH) {
|
|
180
|
+
segment = this.segments.prepareSegment(numVertices, this.layoutVertexArray, this.indexArray);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
//Only triangulate and draw the area of the feature if it is a polygon
|
|
184
|
+
//Other feature types (e.g. LineString) do not have area, so triangulation is pointless / undefined
|
|
185
|
+
if (vectorTileFeatureTypes[feature.type] !== 'Polygon') {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const flattened = [];
|
|
190
|
+
const holeIndices = [];
|
|
191
|
+
const triangleIndex = segment.vertexLength;
|
|
192
|
+
|
|
193
|
+
for (const ring of polygon) {
|
|
194
|
+
if (ring.length === 0) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (ring !== polygon[0]) {
|
|
199
|
+
holeIndices.push(flattened.length / 2);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
for (let i = 0; i < ring.length; i++) {
|
|
203
|
+
const p = ring[i];
|
|
204
|
+
|
|
205
|
+
addVertex(this.layoutVertexArray, p.x, p.y, 0, 0, 1, 1, 0);
|
|
206
|
+
|
|
207
|
+
flattened.push(p.x);
|
|
208
|
+
flattened.push(p.y);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const indices = earcut(flattened, holeIndices);
|
|
213
|
+
assert(indices.length % 3 === 0);
|
|
214
|
+
|
|
215
|
+
for (let j = 0; j < indices.length; j += 3) {
|
|
216
|
+
// Counter-clockwise winding order.
|
|
217
|
+
this.indexArray.emplaceBack(
|
|
218
|
+
triangleIndex + indices[j],
|
|
219
|
+
triangleIndex + indices[j + 2],
|
|
220
|
+
triangleIndex + indices[j + 1]
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
segment.primitiveLength += indices.length / 3;
|
|
225
|
+
segment.vertexLength += numVertices;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, feature, index, imagePositions);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
register('FillExtrusionBucket', FillExtrusionBucket, { omit: ['layers', 'features'] });
|
|
233
|
+
|
|
234
|
+
module.exports = FillExtrusionBucket;
|
|
235
|
+
|
|
236
|
+
function isBoundaryEdge(p1, p2) {
|
|
237
|
+
return (p1.x === p2.x && (p1.x < 0 || p1.x > EXTENT)) || (p1.y === p2.y && (p1.y < 0 || p1.y > EXTENT));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function isEntirelyOutside(ring) {
|
|
241
|
+
return (
|
|
242
|
+
ring.every(p => p.x < 0) ||
|
|
243
|
+
ring.every(p => p.x > EXTENT) ||
|
|
244
|
+
ring.every(p => p.y < 0) ||
|
|
245
|
+
ring.every(p => p.y > EXTENT)
|
|
246
|
+
);
|
|
247
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const CircleBucket = require('./circle_bucket');
|
|
2
|
+
|
|
3
|
+
const { register } = require('../../util/web_worker_transfer');
|
|
4
|
+
|
|
5
|
+
class HeatmapBucket extends CircleBucket {
|
|
6
|
+
// Needed for flow to accept omit: ['layers'] below, due to
|
|
7
|
+
// https://github.com/facebook/flow/issues/4262
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
register('HeatmapBucket', HeatmapBucket, { omit: ['layers'] });
|
|
11
|
+
|
|
12
|
+
module.exports = HeatmapBucket;
|