@mapwhit/tilerenderer 0.52.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +7 -0
  2. package/build/min/package.json +1 -1
  3. package/build/min/src/shaders/_prelude.fragment.glsl.js +2 -2
  4. package/build/min/src/shaders/_prelude.vertex.glsl.js +2 -2
  5. package/build/min/src/shaders/background.fragment.glsl.js +2 -2
  6. package/build/min/src/shaders/background.vertex.glsl.js +1 -1
  7. package/build/min/src/shaders/background_pattern.fragment.glsl.js +2 -2
  8. package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -1
  9. package/build/min/src/shaders/circle.fragment.glsl.js +2 -2
  10. package/build/min/src/shaders/circle.vertex.glsl.js +2 -2
  11. package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -1
  12. package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -1
  13. package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -1
  14. package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -1
  15. package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -1
  16. package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -1
  17. package/build/min/src/shaders/debug.fragment.glsl.js +1 -1
  18. package/build/min/src/shaders/debug.vertex.glsl.js +1 -1
  19. package/build/min/src/shaders/fill.fragment.glsl.js +2 -2
  20. package/build/min/src/shaders/fill.vertex.glsl.js +2 -2
  21. package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +2 -2
  22. package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +2 -2
  23. package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +2 -2
  24. package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +2 -2
  25. package/build/min/src/shaders/fill_outline.fragment.glsl.js +2 -2
  26. package/build/min/src/shaders/fill_outline.vertex.glsl.js +2 -2
  27. package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +2 -2
  28. package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +2 -2
  29. package/build/min/src/shaders/fill_pattern.fragment.glsl.js +2 -2
  30. package/build/min/src/shaders/fill_pattern.vertex.glsl.js +2 -2
  31. package/build/min/src/shaders/heatmap.fragment.glsl.js +2 -2
  32. package/build/min/src/shaders/heatmap.vertex.glsl.js +2 -2
  33. package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +2 -2
  34. package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -1
  35. package/build/min/src/shaders/hillshade.fragment.glsl.js +2 -2
  36. package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -1
  37. package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +2 -2
  38. package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -1
  39. package/build/min/src/shaders/line.fragment.glsl.js +2 -2
  40. package/build/min/src/shaders/line.vertex.glsl.js +2 -2
  41. package/build/min/src/shaders/line_gradient.fragment.glsl.js +2 -2
  42. package/build/min/src/shaders/line_gradient.vertex.glsl.js +2 -2
  43. package/build/min/src/shaders/line_pattern.fragment.glsl.js +2 -2
  44. package/build/min/src/shaders/line_pattern.vertex.glsl.js +2 -2
  45. package/build/min/src/shaders/line_sdf.fragment.glsl.js +2 -2
  46. package/build/min/src/shaders/line_sdf.vertex.glsl.js +2 -2
  47. package/build/min/src/shaders/raster.fragment.glsl.js +2 -2
  48. package/build/min/src/shaders/raster.vertex.glsl.js +1 -1
  49. package/build/min/src/shaders/symbol_icon.fragment.glsl.js +2 -2
  50. package/build/min/src/shaders/symbol_icon.vertex.glsl.js +2 -2
  51. package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +2 -2
  52. package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +2 -2
  53. package/package.json +3 -3
  54. package/src/data/array_types.js +1 -36
  55. package/src/data/bucket/circle_bucket.js +0 -3
  56. package/src/data/bucket/fill_bucket.js +0 -3
  57. package/src/data/bucket/fill_extrusion_bucket.js +0 -3
  58. package/src/data/bucket/heatmap_bucket.js +0 -4
  59. package/src/data/bucket/line_bucket.js +1 -4
  60. package/src/data/bucket/pattern_bucket_features.js +2 -2
  61. package/src/data/bucket/symbol_bucket.js +87 -126
  62. package/src/data/bucket.js +26 -21
  63. package/src/data/dem_data.js +0 -3
  64. package/src/data/feature_index.js +3 -8
  65. package/src/data/program_configuration.js +3 -12
  66. package/src/data/segment.js +0 -4
  67. package/src/render/draw_background.js +3 -3
  68. package/src/render/draw_circle.js +4 -4
  69. package/src/render/draw_fill.js +8 -8
  70. package/src/render/draw_fill_extrusion.js +8 -8
  71. package/src/render/draw_heatmap.js +4 -4
  72. package/src/render/draw_line.js +6 -6
  73. package/src/render/draw_raster.js +6 -6
  74. package/src/render/draw_symbol.js +16 -16
  75. package/src/render/glyph_atlas.js +0 -3
  76. package/src/render/glyph_manager.js +1 -2
  77. package/src/render/image_atlas.js +0 -4
  78. package/src/render/image_manager.js +33 -19
  79. package/src/render/painter.js +13 -14
  80. package/src/render/program/circle_program.js +4 -4
  81. package/src/render/program/fill_extrusion_program.js +1 -1
  82. package/src/render/program/heatmap_program.js +1 -1
  83. package/src/render/program/hillshade_program.js +6 -6
  84. package/src/render/program/line_program.js +3 -3
  85. package/src/render/program/raster_program.js +6 -6
  86. package/src/source/geojson_source.js +15 -24
  87. package/src/source/geojson_worker_source.js +40 -68
  88. package/src/source/geojson_wrapper.js +9 -1
  89. package/src/source/image_source.js +6 -16
  90. package/src/source/query_features.js +4 -5
  91. package/src/source/raster_dem_tile_source.js +45 -64
  92. package/src/source/raster_tile_source.js +1 -6
  93. package/src/source/resources/glyphs.js +2 -2
  94. package/src/source/resources/index.js +3 -9
  95. package/src/source/rtl_text_plugin.js +58 -31
  96. package/src/source/source.js +11 -13
  97. package/src/source/source_cache.js +135 -151
  98. package/src/source/source_state.js +101 -12
  99. package/src/source/tile.js +32 -46
  100. package/src/source/tile_bounds.js +26 -26
  101. package/src/source/tile_id.js +2 -5
  102. package/src/source/vector_tile_source.js +14 -14
  103. package/src/source/vector_tile_worker_source.js +19 -23
  104. package/src/source/worker_tile.js +120 -117
  105. package/src/style/create_style_layer.js +1 -1
  106. package/src/style/pauseable_placement.js +4 -5
  107. package/src/style/properties.js +1 -8
  108. package/src/style/query_utils.js +3 -3
  109. package/src/style/style.js +263 -195
  110. package/src/style/style_layer/circle_style_layer.js +13 -11
  111. package/src/style/style_layer/fill_extrusion_style_layer.js +42 -27
  112. package/src/style/style_layer/fill_style_layer.js +5 -5
  113. package/src/style/style_layer/heatmap_style_layer.js +1 -1
  114. package/src/style/style_layer/hillshade_style_layer.js +1 -1
  115. package/src/style/style_layer/line_style_layer.js +23 -19
  116. package/src/style/style_layer/symbol_style_layer.js +13 -13
  117. package/src/style/style_layer.js +48 -30
  118. package/src/style/style_layer_index.js +16 -41
  119. package/src/symbol/anchor.js +0 -4
  120. package/src/symbol/cross_tile_symbol_index.js +2 -5
  121. package/src/symbol/opacity_state.js +0 -4
  122. package/src/symbol/placement.js +3 -3
  123. package/src/symbol/quads.js +4 -4
  124. package/src/symbol/symbol_layout.js +7 -7
  125. package/src/symbol/transform_text.js +1 -1
  126. package/src/ui/map.js +49 -11
  127. package/src/util/group_layers.js +41 -0
  128. package/src/util/image.js +0 -5
  129. package/src/util/key.js +21 -0
  130. package/src/util/object.js +8 -53
  131. package/src/worker.js +1 -4
  132. package/src/source/resources/images.js +0 -68
  133. package/src/source/worker.js +0 -110
  134. package/src/source/worker_source.js +0 -14
  135. package/src/style-spec/deref.js +0 -51
  136. package/src/style-spec/group_by_layout.js +0 -46
  137. package/src/util/actor.js +0 -108
  138. package/src/util/dispatcher.js +0 -65
  139. package/src/util/global_worker_pool.js +0 -15
  140. package/src/util/transfer_registry.js +0 -168
  141. package/src/util/web_worker_transfer.js +0 -43
  142. package/src/util/worker_pool.js +0 -41
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mapwhit/tilerenderer",
3
3
  "description": "A WebGL interactive maps library",
4
- "version": "0.52.1",
4
+ "version": "1.0.0",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
7
7
  "./worker": "./src/worker.js"
@@ -21,9 +21,9 @@
21
21
  "@mapwhit/pbf": "^1.0.0",
22
22
  "@mapwhit/style-expressions": "^1.1.0",
23
23
  "@mapwhit/vector-tile": "^2.0.1",
24
- "@mapwhit/vt-pbf": "^2.0.0",
25
24
  "@pirxpilot/nanoassert": "~1",
26
25
  "csscolorparser": "^1.0.3",
26
+ "dynload": "^1.0.2",
27
27
  "earcut": "^3.0.1",
28
28
  "geojson-vt": "^4.0.2",
29
29
  "grid-index": "^1.1.0",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "scripts": {
41
41
  "test": "make check",
42
- "prepublish": "make prebuild"
42
+ "prepare": "make prebuild"
43
43
  },
44
44
  "files": [
45
45
  "src",
@@ -2,8 +2,6 @@
2
2
 
3
3
  const assert = require('assert');
4
4
  const { Struct, StructArray } = require('../util/struct_array');
5
- const { register } = require('../util/transfer_registry');
6
- const { default: Point } = require('@mapbox/point-geometry');
7
5
 
8
6
  /**
9
7
  * Implementation of the StructArray layout:
@@ -35,7 +33,6 @@ class StructArrayLayout2i4 extends StructArray {
35
33
  }
36
34
 
37
35
  StructArrayLayout2i4.prototype.bytesPerElement = 4;
38
- register('StructArrayLayout2i4', StructArrayLayout2i4);
39
36
 
40
37
  /**
41
38
  * Implementation of the StructArray layout:
@@ -71,7 +68,6 @@ class StructArrayLayout4i8 extends StructArray {
71
68
  }
72
69
 
73
70
  StructArrayLayout4i8.prototype.bytesPerElement = 8;
74
- register('StructArrayLayout4i8', StructArrayLayout4i8);
75
71
 
76
72
  /**
77
73
  * Implementation of the StructArray layout:
@@ -112,7 +108,6 @@ class StructArrayLayout2i4i12 extends StructArray {
112
108
  }
113
109
 
114
110
  StructArrayLayout2i4i12.prototype.bytesPerElement = 12;
115
- register('StructArrayLayout2i4i12', StructArrayLayout2i4i12);
116
111
 
117
112
  /**
118
113
  * Implementation of the StructArray layout:
@@ -159,7 +154,6 @@ class StructArrayLayout4i4ub12 extends StructArray {
159
154
  }
160
155
 
161
156
  StructArrayLayout4i4ub12.prototype.bytesPerElement = 12;
162
- register('StructArrayLayout4i4ub12', StructArrayLayout4i4ub12);
163
157
 
164
158
  /**
165
159
  * Implementation of the StructArray layout:
@@ -203,7 +197,6 @@ class StructArrayLayout8ui16 extends StructArray {
203
197
  }
204
198
 
205
199
  StructArrayLayout8ui16.prototype.bytesPerElement = 16;
206
- register('StructArrayLayout8ui16', StructArrayLayout8ui16);
207
200
 
208
201
  /**
209
202
  * Implementation of the StructArray layout:
@@ -249,7 +242,6 @@ class StructArrayLayout4i4ui16 extends StructArray {
249
242
  }
250
243
 
251
244
  StructArrayLayout4i4ui16.prototype.bytesPerElement = 16;
252
- register('StructArrayLayout4i4ui16', StructArrayLayout4i4ui16);
253
245
 
254
246
  /**
255
247
  * Implementation of the StructArray layout:
@@ -283,7 +275,6 @@ class StructArrayLayout3f12 extends StructArray {
283
275
  }
284
276
 
285
277
  StructArrayLayout3f12.prototype.bytesPerElement = 12;
286
- register('StructArrayLayout3f12', StructArrayLayout3f12);
287
278
 
288
279
  /**
289
280
  * Implementation of the StructArray layout:
@@ -313,7 +304,6 @@ class StructArrayLayout1ul4 extends StructArray {
313
304
  }
314
305
 
315
306
  StructArrayLayout1ul4.prototype.bytesPerElement = 4;
316
- register('StructArrayLayout1ul4', StructArrayLayout1ul4);
317
307
 
318
308
  /**
319
309
  * Implementation of the StructArray layout:
@@ -370,7 +360,6 @@ class StructArrayLayout6i1ul2ui2i24 extends StructArray {
370
360
  }
371
361
 
372
362
  StructArrayLayout6i1ul2ui2i24.prototype.bytesPerElement = 24;
373
- register('StructArrayLayout6i1ul2ui2i24', StructArrayLayout6i1ul2ui2i24);
374
363
 
375
364
  /**
376
365
  * Implementation of the StructArray layout:
@@ -412,7 +401,6 @@ class StructArrayLayout2i2i2i12 extends StructArray {
412
401
  }
413
402
 
414
403
  StructArrayLayout2i2i2i12.prototype.bytesPerElement = 12;
415
- register('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12);
416
404
 
417
405
  /**
418
406
  * Implementation of the StructArray layout:
@@ -443,7 +431,6 @@ class StructArrayLayout2ub4 extends StructArray {
443
431
  }
444
432
 
445
433
  StructArrayLayout2ub4.prototype.bytesPerElement = 4;
446
- register('StructArrayLayout2ub4', StructArrayLayout2ub4);
447
434
 
448
435
  /**
449
436
  * Implementation of the StructArray layout:
@@ -511,7 +498,6 @@ class StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray {
511
498
  }
512
499
 
513
500
  StructArrayLayout2i2ui3ul3ui2f2ub40.prototype.bytesPerElement = 40;
514
- register('StructArrayLayout2i2ui3ul3ui2f2ub40', StructArrayLayout2i2ui3ul3ui2f2ub40);
515
501
 
516
502
  /**
517
503
  * Implementation of the StructArray layout:
@@ -573,7 +559,6 @@ class StructArrayLayout4i9ui1ul32 extends StructArray {
573
559
  }
574
560
 
575
561
  StructArrayLayout4i9ui1ul32.prototype.bytesPerElement = 32;
576
- register('StructArrayLayout4i9ui1ul32', StructArrayLayout4i9ui1ul32);
577
562
 
578
563
  /**
579
564
  * Implementation of the StructArray layout:
@@ -603,7 +588,6 @@ class StructArrayLayout1f4 extends StructArray {
603
588
  }
604
589
 
605
590
  StructArrayLayout1f4.prototype.bytesPerElement = 4;
606
- register('StructArrayLayout1f4', StructArrayLayout1f4);
607
591
 
608
592
  /**
609
593
  * Implementation of the StructArray layout:
@@ -637,7 +621,6 @@ class StructArrayLayout3i6 extends StructArray {
637
621
  }
638
622
 
639
623
  StructArrayLayout3i6.prototype.bytesPerElement = 6;
640
- register('StructArrayLayout3i6', StructArrayLayout3i6);
641
624
 
642
625
  /**
643
626
  * Implementation of the StructArray layout:
@@ -675,7 +658,6 @@ class StructArrayLayout1ul2ui8 extends StructArray {
675
658
  }
676
659
 
677
660
  StructArrayLayout1ul2ui8.prototype.bytesPerElement = 8;
678
- register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8);
679
661
 
680
662
  /**
681
663
  * Implementation of the StructArray layout:
@@ -709,7 +691,6 @@ class StructArrayLayout3ui6 extends StructArray {
709
691
  }
710
692
 
711
693
  StructArrayLayout3ui6.prototype.bytesPerElement = 6;
712
- register('StructArrayLayout3ui6', StructArrayLayout3ui6);
713
694
 
714
695
  /**
715
696
  * Implementation of the StructArray layout:
@@ -741,7 +722,6 @@ class StructArrayLayout2ui4 extends StructArray {
741
722
  }
742
723
 
743
724
  StructArrayLayout2ui4.prototype.bytesPerElement = 4;
744
- register('StructArrayLayout2ui4', StructArrayLayout2ui4);
745
725
 
746
726
  /**
747
727
  * Implementation of the StructArray layout:
@@ -771,7 +751,6 @@ class StructArrayLayout1ui2 extends StructArray {
771
751
  }
772
752
 
773
753
  StructArrayLayout1ui2.prototype.bytesPerElement = 2;
774
- register('StructArrayLayout1ui2', StructArrayLayout1ui2);
775
754
 
776
755
  /**
777
756
  * Implementation of the StructArray layout:
@@ -803,7 +782,6 @@ class StructArrayLayout2f8 extends StructArray {
803
782
  }
804
783
 
805
784
  StructArrayLayout2f8.prototype.bytesPerElement = 8;
806
- register('StructArrayLayout2f8', StructArrayLayout2f8);
807
785
 
808
786
  /**
809
787
  * Implementation of the StructArray layout:
@@ -839,7 +817,6 @@ class StructArrayLayout4f16 extends StructArray {
839
817
  }
840
818
 
841
819
  StructArrayLayout4f16.prototype.bytesPerElement = 16;
842
- register('StructArrayLayout4f16', StructArrayLayout4f16);
843
820
 
844
821
  class CollisionBoxStruct extends Struct {
845
822
  get anchorPointX() {
@@ -909,7 +886,7 @@ class CollisionBoxStruct extends Struct {
909
886
  this._structArray.int16[this._pos2 + 11] = x;
910
887
  }
911
888
  get anchorPoint() {
912
- return new Point(this.anchorPointX, this.anchorPointY);
889
+ return { x: this.anchorPointX, y: this.anchorPointY };
913
890
  }
914
891
  }
915
892
 
@@ -929,8 +906,6 @@ class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 {
929
906
  }
930
907
  }
931
908
 
932
- register('CollisionBoxArray', CollisionBoxArray);
933
-
934
909
  class PlacedSymbolStruct extends Struct {
935
910
  get anchorX() {
936
911
  return this._structArray.int16[this._pos2 + 0];
@@ -1034,8 +1009,6 @@ class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 {
1034
1009
  }
1035
1010
  }
1036
1011
 
1037
- register('PlacedSymbolArray', PlacedSymbolArray);
1038
-
1039
1012
  class SymbolInstanceStruct extends Struct {
1040
1013
  get anchorX() {
1041
1014
  return this._structArray.int16[this._pos2 + 0];
@@ -1139,8 +1112,6 @@ class SymbolInstanceArray extends StructArrayLayout4i9ui1ul32 {
1139
1112
  }
1140
1113
  }
1141
1114
 
1142
- register('SymbolInstanceArray', SymbolInstanceArray);
1143
-
1144
1115
  class GlyphOffsetStruct extends Struct {
1145
1116
  get offsetX() {
1146
1117
  return this._structArray.float32[this._pos4 + 0];
@@ -1169,8 +1140,6 @@ class GlyphOffsetArray extends StructArrayLayout1f4 {
1169
1140
  }
1170
1141
  }
1171
1142
 
1172
- register('GlyphOffsetArray', GlyphOffsetArray);
1173
-
1174
1143
  class SymbolLineVertexStruct extends Struct {
1175
1144
  get x() {
1176
1145
  return this._structArray.int16[this._pos2 + 0];
@@ -1217,8 +1186,6 @@ class SymbolLineVertexArray extends StructArrayLayout3i6 {
1217
1186
  }
1218
1187
  }
1219
1188
 
1220
- register('SymbolLineVertexArray', SymbolLineVertexArray);
1221
-
1222
1189
  class FeatureIndexStruct extends Struct {
1223
1190
  get featureIndex() {
1224
1191
  return this._structArray.uint32[this._pos4 + 0];
@@ -1256,8 +1223,6 @@ class FeatureIndexArray extends StructArrayLayout1ul2ui8 {
1256
1223
  }
1257
1224
  }
1258
1225
 
1259
- register('FeatureIndexArray', FeatureIndexArray);
1260
-
1261
1226
  module.exports = {
1262
1227
  StructArrayLayout2i4,
1263
1228
  StructArrayLayout4i8,
@@ -6,7 +6,6 @@ const { ProgramConfigurationSet } = require('../program_configuration');
6
6
  const { TriangleIndexArray } = require('../index_array_type');
7
7
  const loadGeometry = require('../load_geometry');
8
8
  const EXTENT = require('../extent');
9
- const { register } = require('../../util/transfer_registry');
10
9
  const EvaluationParameters = require('../../style/evaluation_parameters');
11
10
 
12
11
  function addCircleVertex(layoutVertexArray, x, y, extrudeX, extrudeY) {
@@ -122,6 +121,4 @@ class CircleBucket {
122
121
  }
123
122
  }
124
123
 
125
- register('CircleBucket', CircleBucket, { omit: ['layers'] });
126
-
127
124
  module.exports = CircleBucket;
@@ -8,7 +8,6 @@ const { default: earcut } = require('earcut');
8
8
  const classifyRings = require('../../util/classify_rings');
9
9
  const assert = require('assert');
10
10
  const EARCUT_MAX_RINGS = 500;
11
- const { register } = require('../../util/transfer_registry');
12
11
  const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
13
12
  const loadGeometry = require('../load_geometry');
14
13
  const EvaluationParameters = require('../../style/evaluation_parameters');
@@ -171,6 +170,4 @@ class FillBucket {
171
170
  }
172
171
  }
173
172
 
174
- register('FillBucket', FillBucket, { omit: ['layers', 'features'] });
175
-
176
173
  module.exports = FillBucket;
@@ -12,7 +12,6 @@ const {
12
12
  const classifyRings = require('../../util/classify_rings');
13
13
  const assert = require('assert');
14
14
  const EARCUT_MAX_RINGS = 500;
15
- const { register } = require('../../util/transfer_registry');
16
15
  const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
17
16
  const loadGeometry = require('../load_geometry');
18
17
  const EvaluationParameters = require('../../style/evaluation_parameters');
@@ -239,8 +238,6 @@ class FillExtrusionBucket {
239
238
  }
240
239
  }
241
240
 
242
- register('FillExtrusionBucket', FillExtrusionBucket, { omit: ['layers', 'features'] });
243
-
244
241
  module.exports = FillExtrusionBucket;
245
242
 
246
243
  function isBoundaryEdge(p1, p2) {
@@ -1,12 +1,8 @@
1
1
  const CircleBucket = require('./circle_bucket');
2
2
 
3
- const { register } = require('../../util/transfer_registry');
4
-
5
3
  class HeatmapBucket extends CircleBucket {
6
4
  // Needed for flow to accept omit: ['layers'] below, due to
7
5
  // https://github.com/facebook/flow/issues/4262
8
6
  }
9
7
 
10
- register('HeatmapBucket', HeatmapBucket, { omit: ['layers'] });
11
-
12
8
  module.exports = HeatmapBucket;
@@ -7,7 +7,6 @@ const { TriangleIndexArray } = require('../index_array_type');
7
7
  const EXTENT = require('../extent');
8
8
  const mvt = require('@mapwhit/vector-tile');
9
9
  const vectorTileFeatureTypes = mvt.VectorTileFeature.types;
10
- const { register } = require('../../util/transfer_registry');
11
10
  const { hasPattern, addPatternDependencies } = require('./pattern_bucket_features');
12
11
  const loadGeometry = require('../load_geometry');
13
12
  const EvaluationParameters = require('../../style/evaluation_parameters');
@@ -162,7 +161,7 @@ class LineBucket {
162
161
  }
163
162
 
164
163
  addFeature(feature, geometry, index, imagePositions) {
165
- const layout = this.layers[0].layout;
164
+ const layout = this.layers[0]._layout;
166
165
  const join = layout.get('line-join').evaluate(feature, {});
167
166
  const cap = layout.get('line-cap');
168
167
  const miterLimit = layout.get('line-miter-limit');
@@ -630,6 +629,4 @@ function calculateFullDistance(vertices, first, len) {
630
629
  return total;
631
630
  }
632
631
 
633
- register('LineBucket', LineBucket, { omit: ['layers', 'features'] });
634
-
635
632
  module.exports = LineBucket;
@@ -3,7 +3,7 @@ function hasPattern(type, layers, options) {
3
3
  let hasPattern = false;
4
4
 
5
5
  for (const layer of layers) {
6
- const patternProperty = layer.paint.get(`${type}-pattern`);
6
+ const patternProperty = layer._paint.get(`${type}-pattern`);
7
7
  if (!patternProperty.isConstant()) {
8
8
  hasPattern = true;
9
9
  }
@@ -22,7 +22,7 @@ function hasPattern(type, layers, options) {
22
22
  function addPatternDependencies(type, layers, patternFeature, zoom, options) {
23
23
  const patterns = options.patternDependencies;
24
24
  for (const layer of layers) {
25
- const patternProperty = layer.paint.get(`${type}-pattern`);
25
+ const patternProperty = layer._paint.get(`${type}-pattern`);
26
26
 
27
27
  const patternPropertyValue = patternProperty.value;
28
28
  if (patternPropertyValue.kind !== 'constant') {
@@ -18,7 +18,6 @@ const {
18
18
  GlyphOffsetArray,
19
19
  SymbolLineVertexArray
20
20
  } = require('../array_types');
21
- const { default: Point } = require('@mapbox/point-geometry');
22
21
  const SegmentVector = require('../segment');
23
22
  const { ProgramConfigurationSet } = require('../program_configuration');
24
23
  const { TriangleIndexArray, LineIndexArray } = require('../index_array_type');
@@ -30,7 +29,6 @@ const mvt = require('@mapwhit/vector-tile');
30
29
  const vectorTileFeatureTypes = mvt.VectorTileFeature.types;
31
30
  const { verticalizedCharacterMap } = require('../../util/verticalize_punctuation');
32
31
  const { getSizeData } = require('../../symbol/symbol_size');
33
- const { register } = require('../../util/transfer_registry');
34
32
  const EvaluationParameters = require('../../style/evaluation_parameters');
35
33
  const { Formatted } = require('@mapwhit/style-expressions');
36
34
 
@@ -108,8 +106,6 @@ class SymbolBuffers {
108
106
  }
109
107
  }
110
108
 
111
- register('SymbolBuffers', SymbolBuffers);
112
-
113
109
  class CollisionBuffers {
114
110
  constructor(LayoutArray, layoutAttributes, IndexArray) {
115
111
  this.layoutVertexArray = new LayoutArray();
@@ -138,8 +134,6 @@ class CollisionBuffers {
138
134
  }
139
135
  }
140
136
 
141
- register('CollisionBuffers', CollisionBuffers);
142
-
143
137
  /**
144
138
  * Unlike other buckets, which simply implement #addFeature with type-specific
145
139
  * logic for (essentially) triangulating feature geometries, SymbolBucket
@@ -191,7 +185,7 @@ class SymbolBucket {
191
185
  this.textSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['text-size']);
192
186
  this.iconSizeData = getSizeData(this.zoom, unevaluatedLayoutValues['icon-size']);
193
187
 
194
- const layout = this.layers[0].layout;
188
+ const layout = this.layers[0]._layout;
195
189
  const zOrderByViewportY = layout.get('symbol-z-order') === 'viewport-y';
196
190
  this.sortFeaturesByY =
197
191
  zOrderByViewportY &&
@@ -241,7 +235,7 @@ class SymbolBucket {
241
235
 
242
236
  populate(features, options) {
243
237
  const layer = this.layers[0];
244
- const layout = layer.layout;
238
+ const layout = layer._layout;
245
239
 
246
240
  const textFont = layout.get('text-font');
247
241
  const textField = layout.get('text-field');
@@ -470,73 +464,25 @@ class SymbolBucket {
470
464
  });
471
465
  }
472
466
 
473
- _addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, point, anchorX, anchorY, extrude) {
474
- collisionVertexArray.emplaceBack(0, 0);
475
- return layoutVertexArray.emplaceBack(
476
- // pos
477
- point.x,
478
- point.y,
479
- // a_anchor_pos
480
- anchorX,
481
- anchorY,
482
- // extrude
483
- Math.round(extrude.x),
484
- Math.round(extrude.y)
485
- );
486
- }
487
-
488
467
  addCollisionDebugVertices(x1, y1, x2, y2, arrays, boxAnchorPoint, symbolInstance, isCircle) {
489
- const segment = arrays.segments.prepareSegment(4, arrays.layoutVertexArray, arrays.indexArray);
468
+ const { layoutVertexArray, collisionVertexArray, indexArray } = arrays;
469
+ const { anchorX, anchorY } = symbolInstance;
470
+
471
+ const segment = arrays.segments.prepareSegment(4, layoutVertexArray, indexArray);
490
472
  const index = segment.vertexLength;
491
473
 
492
- const layoutVertexArray = arrays.layoutVertexArray;
493
- const collisionVertexArray = arrays.collisionVertexArray;
494
-
495
- const anchorX = symbolInstance.anchorX;
496
- const anchorY = symbolInstance.anchorY;
497
-
498
- this._addCollisionDebugVertex(
499
- layoutVertexArray,
500
- collisionVertexArray,
501
- boxAnchorPoint,
502
- anchorX,
503
- anchorY,
504
- new Point(x1, y1)
505
- );
506
- this._addCollisionDebugVertex(
507
- layoutVertexArray,
508
- collisionVertexArray,
509
- boxAnchorPoint,
510
- anchorX,
511
- anchorY,
512
- new Point(x2, y1)
513
- );
514
- this._addCollisionDebugVertex(
515
- layoutVertexArray,
516
- collisionVertexArray,
517
- boxAnchorPoint,
518
- anchorX,
519
- anchorY,
520
- new Point(x2, y2)
521
- );
522
- this._addCollisionDebugVertex(
523
- layoutVertexArray,
524
- collisionVertexArray,
525
- boxAnchorPoint,
526
- anchorX,
527
- anchorY,
528
- new Point(x1, y2)
529
- );
474
+ addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, x1, y1);
475
+ addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, x2, y1);
476
+ addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, x2, y2);
477
+ addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, boxAnchorPoint, anchorX, anchorY, x1, y2);
530
478
 
531
479
  segment.vertexLength += 4;
532
480
  if (isCircle) {
533
- const indexArray = arrays.indexArray;
534
481
  indexArray.emplaceBack(index, index + 1, index + 2);
535
482
  indexArray.emplaceBack(index, index + 2, index + 3);
536
483
 
537
484
  segment.primitiveLength += 2;
538
485
  } else {
539
- const indexArray = arrays.indexArray;
540
486
  indexArray.emplaceBack(index, index + 1);
541
487
  indexArray.emplaceBack(index + 1, index + 2);
542
488
  indexArray.emplaceBack(index + 2, index + 3);
@@ -578,68 +524,16 @@ class SymbolBucket {
578
524
  }
579
525
  }
580
526
 
581
- // These flat arrays are meant to be quicker to iterate over than the source
582
- // CollisionBoxArray
583
- _deserializeCollisionBoxesForSymbol(collisionBoxArray, textStartIndex, textEndIndex, iconStartIndex, iconEndIndex) {
584
- const collisionArrays = {};
585
- for (let k = textStartIndex; k < textEndIndex; k++) {
586
- const box = collisionBoxArray.get(k);
587
- if (box.radius === 0) {
588
- collisionArrays.textBox = {
589
- x1: box.x1,
590
- y1: box.y1,
591
- x2: box.x2,
592
- y2: box.y2,
593
- anchorPointX: box.anchorPointX,
594
- anchorPointY: box.anchorPointY
595
- };
596
- collisionArrays.textFeatureIndex = box.featureIndex;
597
- break; // Only one box allowed per instance
598
- }
599
- if (!collisionArrays.textCircles) {
600
- collisionArrays.textCircles = [];
601
- collisionArrays.textFeatureIndex = box.featureIndex;
602
- }
603
- const used = 1; // May be updated at collision detection time
604
- collisionArrays.textCircles.push(
605
- box.anchorPointX,
606
- box.anchorPointY,
607
- box.radius,
608
- box.signedDistanceFromAnchor,
609
- used
610
- );
611
- }
612
- for (let k = iconStartIndex; k < iconEndIndex; k++) {
613
- // An icon can only have one box now, so this indexing is a bit vestigial...
614
- const box = collisionBoxArray.get(k);
615
- if (box.radius === 0) {
616
- collisionArrays.iconBox = {
617
- x1: box.x1,
618
- y1: box.y1,
619
- x2: box.x2,
620
- y2: box.y2,
621
- anchorPointX: box.anchorPointX,
622
- anchorPointY: box.anchorPointY
623
- };
624
- collisionArrays.iconFeatureIndex = box.featureIndex;
625
- break; // Only one box allowed per instance
626
- }
627
- }
628
- return collisionArrays;
629
- }
630
-
631
527
  deserializeCollisionBoxes(collisionBoxArray) {
632
- this.collisionArrays = [];
528
+ this.collisionArrays = new Array(this.symbolInstances.length);
633
529
  for (let i = 0; i < this.symbolInstances.length; i++) {
634
530
  const symbolInstance = this.symbolInstances.get(i);
635
- this.collisionArrays.push(
636
- this._deserializeCollisionBoxesForSymbol(
637
- collisionBoxArray,
638
- symbolInstance.textBoxStartIndex,
639
- symbolInstance.textBoxEndIndex,
640
- symbolInstance.iconBoxStartIndex,
641
- symbolInstance.iconBoxEndIndex
642
- )
531
+ this.collisionArrays[i] = deserializeCollisionBoxesForSymbol(
532
+ collisionBoxArray,
533
+ symbolInstance.textBoxStartIndex,
534
+ symbolInstance.textBoxEndIndex,
535
+ symbolInstance.iconBoxStartIndex,
536
+ symbolInstance.iconBoxEndIndex
643
537
  );
644
538
  }
645
539
  }
@@ -734,9 +628,76 @@ class SymbolBucket {
734
628
  }
735
629
  }
736
630
 
737
- register('SymbolBucket', SymbolBucket, {
738
- omit: ['layers', 'collisionBoxArray', 'features', 'compareText']
739
- });
631
+ function addCollisionDebugVertex(layoutVertexArray, collisionVertexArray, point, anchorX, anchorY, extrudeX, extrudeY) {
632
+ collisionVertexArray.emplaceBack(0, 0);
633
+ return layoutVertexArray.emplaceBack(
634
+ // pos
635
+ point.x,
636
+ point.y,
637
+ // a_anchor_pos
638
+ anchorX,
639
+ anchorY,
640
+ // extrude
641
+ Math.round(extrudeX),
642
+ Math.round(extrudeY)
643
+ );
644
+ }
645
+
646
+ // These flat arrays are meant to be quicker to iterate over than the source
647
+ // CollisionBoxArray
648
+ function deserializeCollisionBoxesForSymbol(
649
+ collisionBoxArray,
650
+ textStartIndex,
651
+ textEndIndex,
652
+ iconStartIndex,
653
+ iconEndIndex
654
+ ) {
655
+ const collisionArrays = {};
656
+ for (let k = textStartIndex; k < textEndIndex; k++) {
657
+ const box = collisionBoxArray.get(k);
658
+ if (box.radius === 0) {
659
+ collisionArrays.textBox = {
660
+ x1: box.x1,
661
+ y1: box.y1,
662
+ x2: box.x2,
663
+ y2: box.y2,
664
+ anchorPointX: box.anchorPointX,
665
+ anchorPointY: box.anchorPointY
666
+ };
667
+ collisionArrays.textFeatureIndex = box.featureIndex;
668
+ break; // Only one box allowed per instance
669
+ }
670
+ if (!collisionArrays.textCircles) {
671
+ collisionArrays.textCircles = [];
672
+ collisionArrays.textFeatureIndex = box.featureIndex;
673
+ }
674
+ const used = 1; // May be updated at collision detection time
675
+ collisionArrays.textCircles.push(
676
+ box.anchorPointX,
677
+ box.anchorPointY,
678
+ box.radius,
679
+ box.signedDistanceFromAnchor,
680
+ used
681
+ );
682
+ }
683
+ for (let k = iconStartIndex; k < iconEndIndex; k++) {
684
+ // An icon can only have one box now, so this indexing is a bit vestigial...
685
+ const box = collisionBoxArray.get(k);
686
+ if (box.radius === 0) {
687
+ collisionArrays.iconBox = {
688
+ x1: box.x1,
689
+ y1: box.y1,
690
+ x2: box.x2,
691
+ y2: box.y2,
692
+ anchorPointX: box.anchorPointX,
693
+ anchorPointY: box.anchorPointY
694
+ };
695
+ collisionArrays.iconFeatureIndex = box.featureIndex;
696
+ break; // Only one box allowed per instance
697
+ }
698
+ }
699
+ return collisionArrays;
700
+ }
740
701
 
741
702
  // this constant is based on the size of StructArray indexes used in a symbol
742
703
  // bucket--namely, glyphOffsetArrayStart