@antv/l7-layers 2.9.27-alpha.2 → 2.9.27-alpha.3

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 (300) hide show
  1. package/es/Geometry/index.js +6 -2
  2. package/es/Geometry/models/billboard.js +1 -2
  3. package/es/Geometry/models/plane.js +2 -4
  4. package/es/Geometry/models/sprite.js +2 -4
  5. package/es/canvas/index.d.ts +4 -0
  6. package/es/canvas/index.js +38 -2
  7. package/es/citybuliding/building.js +6 -2
  8. package/es/citybuliding/models/build.js +2 -3
  9. package/es/core/BaseLayer.d.ts +15 -6
  10. package/es/core/BaseLayer.js +51 -69
  11. package/es/core/BaseModel.d.ts +1 -1
  12. package/es/core/BaseModel.js +7 -3
  13. package/es/core/interface.d.ts +18 -0
  14. package/es/core/triangulation.d.ts +6 -0
  15. package/es/core/triangulation.js +64 -2
  16. package/es/earth/index.js +3 -1
  17. package/es/earth/models/base.js +2 -4
  18. package/es/earth/shaders/atmosphere_frag.glsl +1 -1
  19. package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
  20. package/es/heatmap/index.js +6 -2
  21. package/es/heatmap/models/heatmap.js +5 -3
  22. package/es/image/index.js +6 -2
  23. package/es/image/models/dataImage.js +4 -7
  24. package/es/image/models/image.js +4 -7
  25. package/es/line/index.d.ts +1 -0
  26. package/es/line/index.js +8 -2
  27. package/es/line/models/arc.js +6 -5
  28. package/es/line/models/half.js +3 -4
  29. package/es/line/models/line.js +9 -8
  30. package/es/line/models/simpleLine.js +2 -1
  31. package/es/line/models/simpleTileLine.d.ts +9 -0
  32. package/es/line/models/simpleTileLine.js +100 -0
  33. package/es/line/models/tile.d.ts +1 -4
  34. package/es/line/models/tile.js +49 -222
  35. package/es/line/models/wall.js +10 -46
  36. package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
  37. package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
  38. package/es/line/shaders/line_arc2d_vert.glsl +1 -1
  39. package/es/line/shaders/line_arc_3d_frag.glsl +1 -1
  40. package/es/line/shaders/line_arc_3d_vert.glsl +3 -3
  41. package/es/line/shaders/line_arc_frag.glsl +1 -1
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  44. package/es/line/shaders/line_arc_vert.glsl +5 -3
  45. package/es/line/shaders/line_bezier_vert.glsl +1 -1
  46. package/es/line/shaders/line_frag.glsl +1 -2
  47. package/es/line/shaders/line_vert.glsl +1 -1
  48. package/es/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  49. package/es/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  50. package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
  51. package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  52. package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
  53. package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  54. package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
  55. package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  56. package/es/line/shaders/wall/wall_vert.glsl +77 -0
  57. package/es/mask/index.d.ts +1 -0
  58. package/es/mask/index.js +80 -5
  59. package/es/mask/models/fill.d.ts +2 -1
  60. package/es/mask/models/fill.js +13 -10
  61. package/es/mask/shaders/mask_vert.glsl +0 -6
  62. package/es/plugins/DataMappingPlugin.d.ts +4 -3
  63. package/es/plugins/DataMappingPlugin.js +129 -58
  64. package/es/plugins/DataSourcePlugin.js +3 -2
  65. package/es/plugins/FeatureScalePlugin.d.ts +0 -2
  66. package/es/plugins/FeatureScalePlugin.js +8 -51
  67. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
  68. package/es/plugins/LayerAnimateStylePlugin.js +7 -27
  69. package/es/plugins/LayerModelPlugin.js +2 -6
  70. package/es/plugins/LightingPlugin.js +1 -7
  71. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  72. package/es/plugins/MultiPassRendererPlugin.js +4 -16
  73. package/es/plugins/PixelPickingPlugin.d.ts +1 -1
  74. package/es/plugins/PixelPickingPlugin.js +8 -28
  75. package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
  76. package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
  77. package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
  78. package/es/point/index.js +6 -2
  79. package/es/point/models/fill.js +2 -2
  80. package/es/point/models/fillmage.js +1 -1
  81. package/es/point/models/image.js +1 -1
  82. package/es/point/models/normal.d.ts +0 -1
  83. package/es/point/models/normal.js +9 -60
  84. package/es/point/models/radar.js +4 -69
  85. package/es/point/models/simplePoint.d.ts +0 -1
  86. package/es/point/models/simplePoint.js +2 -11
  87. package/es/point/models/text.js +6 -7
  88. package/es/point/models/tile.d.ts +0 -7
  89. package/es/point/models/tile.js +22 -155
  90. package/es/point/models/tileText.d.ts +0 -4
  91. package/es/point/models/tileText.js +98 -185
  92. package/es/point/shaders/animate/wave_frag.glsl +3 -3
  93. package/es/point/shaders/earth/fill_vert.glsl +0 -1
  94. package/es/point/shaders/fill_vert.glsl +0 -1
  95. package/es/point/shaders/normal_frag.glsl +1 -10
  96. package/es/point/shaders/normal_vert.glsl +5 -60
  97. package/es/point/shaders/radar/radar_frag.glsl +4 -15
  98. package/es/point/shaders/radar/radar_vert.glsl +4 -54
  99. package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
  100. package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
  101. package/es/point/shaders/tile/text_frag.glsl +33 -0
  102. package/es/point/shaders/tile/text_map_frag.glsl +31 -0
  103. package/es/point/shaders/tile/text_map_vert.glsl +38 -0
  104. package/es/point/shaders/tile/text_vert.glsl +48 -0
  105. package/es/polygon/index.js +6 -2
  106. package/es/polygon/models/extrude.js +1 -3
  107. package/es/polygon/models/fill.js +3 -4
  108. package/es/polygon/models/ocean.d.ts +0 -2
  109. package/es/polygon/models/ocean.js +13 -47
  110. package/es/polygon/models/tile.d.ts +1 -4
  111. package/es/polygon/models/tile.js +25 -57
  112. package/es/polygon/models/water.d.ts +0 -2
  113. package/es/polygon/models/water.js +13 -47
  114. package/es/polygon/shaders/polygon_frag.glsl +2 -2
  115. package/es/polygon/shaders/polygon_vert.glsl +2 -2
  116. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  117. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  118. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  119. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  120. package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  121. package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  122. package/es/raster/buffers/triangulation.js +1 -4
  123. package/es/raster/index.js +6 -2
  124. package/es/raster/models/raster.js +3 -2
  125. package/es/shader/minify_frag.glsl +7 -0
  126. package/es/shader/minify_picking_frag.glsl +10 -0
  127. package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
  128. package/es/tile/manager/baseMapTileLayerManager.js +207 -0
  129. package/es/tile/manager/tileLayerManager.d.ts +2 -2
  130. package/es/tile/manager/tileLayerManager.js +2 -2
  131. package/es/tile/manager/tilePickerManager.d.ts +2 -3
  132. package/es/tile/manager/tilePickerManager.js +1 -2
  133. package/es/tile/models/tileModel.d.ts +1 -0
  134. package/es/tile/models/tileModel.js +18 -2
  135. package/es/tile/tileFactory/base.d.ts +1 -1
  136. package/es/tile/tileFactory/base.js +58 -33
  137. package/es/tile/tileFactory/line.js +3 -0
  138. package/es/tile/tileFactory/point.js +3 -0
  139. package/es/tile/tileFactory/polygon.js +3 -0
  140. package/es/tile/tileFactory/raster.js +3 -0
  141. package/es/tile/tileFactory/rasterData.js +3 -0
  142. package/es/tile/tileFactory/rasterDataLayer.js +6 -2
  143. package/es/tile/tileFactory/test.js +26 -5
  144. package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
  145. package/es/tile/tileFactory/vectorLayer.js +110 -7
  146. package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
  147. package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
  148. package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
  149. package/es/tile/tileLayer/baseTileLayer.js +46 -75
  150. package/es/tile/tileTest.d.ts +1 -0
  151. package/es/tile/tileTest.js +3 -2
  152. package/es/tile/tmsMapTileLayer.d.ts +9 -0
  153. package/es/tile/tmsMapTileLayer.js +119 -0
  154. package/es/tile/tmsTileLayer.d.ts +2 -0
  155. package/es/tile/tmsTileLayer.js +24 -2
  156. package/es/tile/utils.d.ts +4 -0
  157. package/es/tile/utils.js +30 -0
  158. package/es/utils/dataMappingStyle.js +3 -0
  159. package/es/utils/layerData.js +2 -2
  160. package/es/utils/updateShape.js +2 -2
  161. package/es/wind/index.js +6 -2
  162. package/es/wind/models/wind.js +8 -8
  163. package/es/wind/shaders/wind_vert.glsl +1 -1
  164. package/lib/Geometry/index.js +6 -2
  165. package/lib/Geometry/models/billboard.js +1 -2
  166. package/lib/Geometry/models/plane.js +2 -4
  167. package/lib/Geometry/models/sprite.js +2 -4
  168. package/lib/canvas/index.js +37 -2
  169. package/lib/citybuliding/building.js +6 -2
  170. package/lib/citybuliding/models/build.js +2 -3
  171. package/lib/core/BaseLayer.js +51 -69
  172. package/lib/core/BaseModel.js +7 -3
  173. package/lib/core/triangulation.js +66 -2
  174. package/lib/earth/index.js +3 -1
  175. package/lib/earth/models/base.js +2 -4
  176. package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
  177. package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
  178. package/lib/heatmap/index.js +6 -2
  179. package/lib/heatmap/models/heatmap.js +5 -3
  180. package/lib/image/index.js +6 -2
  181. package/lib/image/models/dataImage.js +4 -7
  182. package/lib/image/models/image.js +4 -7
  183. package/lib/line/index.js +7 -2
  184. package/lib/line/models/arc.js +6 -5
  185. package/lib/line/models/half.js +3 -4
  186. package/lib/line/models/line.js +9 -8
  187. package/lib/line/models/simpleLine.js +2 -1
  188. package/lib/line/models/simpleTileLine.js +115 -0
  189. package/lib/line/models/tile.js +49 -223
  190. package/lib/line/models/wall.js +10 -46
  191. package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
  192. package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
  193. package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
  194. package/lib/line/shaders/line_arc_3d_frag.glsl +1 -1
  195. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -3
  196. package/lib/line/shaders/line_arc_frag.glsl +1 -1
  197. package/lib/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  198. package/lib/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  199. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  200. package/lib/line/shaders/line_bezier_vert.glsl +1 -1
  201. package/lib/line/shaders/line_frag.glsl +1 -2
  202. package/lib/line/shaders/line_vert.glsl +1 -1
  203. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  204. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  205. package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
  206. package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  207. package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
  208. package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  209. package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
  210. package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  211. package/lib/line/shaders/wall/wall_vert.glsl +77 -0
  212. package/lib/mask/index.js +82 -5
  213. package/lib/mask/models/fill.js +14 -10
  214. package/lib/mask/shaders/mask_vert.glsl +0 -6
  215. package/lib/plugins/DataMappingPlugin.js +127 -57
  216. package/lib/plugins/DataSourcePlugin.js +3 -2
  217. package/lib/plugins/FeatureScalePlugin.js +6 -50
  218. package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
  219. package/lib/plugins/LayerModelPlugin.js +2 -6
  220. package/lib/plugins/LightingPlugin.js +1 -7
  221. package/lib/plugins/MultiPassRendererPlugin.js +3 -19
  222. package/lib/plugins/PixelPickingPlugin.js +8 -28
  223. package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
  224. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
  225. package/lib/point/index.js +6 -2
  226. package/lib/point/models/fill.js +2 -2
  227. package/lib/point/models/fillmage.js +1 -1
  228. package/lib/point/models/image.js +1 -1
  229. package/lib/point/models/normal.js +8 -59
  230. package/lib/point/models/radar.js +4 -69
  231. package/lib/point/models/simplePoint.js +1 -10
  232. package/lib/point/models/text.js +6 -7
  233. package/lib/point/models/tile.js +21 -156
  234. package/lib/point/models/tileText.js +97 -184
  235. package/lib/point/shaders/animate/wave_frag.glsl +3 -3
  236. package/lib/point/shaders/earth/fill_vert.glsl +0 -1
  237. package/lib/point/shaders/fill_vert.glsl +0 -1
  238. package/lib/point/shaders/normal_frag.glsl +1 -10
  239. package/lib/point/shaders/normal_vert.glsl +5 -60
  240. package/lib/point/shaders/radar/radar_frag.glsl +4 -15
  241. package/lib/point/shaders/radar/radar_vert.glsl +4 -54
  242. package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
  243. package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
  244. package/lib/point/shaders/tile/text_frag.glsl +33 -0
  245. package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
  246. package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
  247. package/lib/point/shaders/tile/text_vert.glsl +48 -0
  248. package/lib/polygon/index.js +6 -2
  249. package/lib/polygon/models/extrude.js +1 -3
  250. package/lib/polygon/models/fill.js +3 -4
  251. package/lib/polygon/models/ocean.js +14 -47
  252. package/lib/polygon/models/tile.js +24 -57
  253. package/lib/polygon/models/water.js +14 -47
  254. package/lib/polygon/shaders/polygon_frag.glsl +2 -2
  255. package/lib/polygon/shaders/polygon_vert.glsl +2 -2
  256. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  257. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  258. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  259. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  260. package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  261. package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  262. package/lib/raster/buffers/triangulation.js +1 -4
  263. package/lib/raster/index.js +6 -2
  264. package/lib/raster/models/raster.js +3 -2
  265. package/lib/shader/minify_frag.glsl +7 -0
  266. package/lib/shader/minify_picking_frag.glsl +10 -0
  267. package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
  268. package/lib/tile/manager/tileLayerManager.js +2 -2
  269. package/lib/tile/manager/tilePickerManager.js +1 -2
  270. package/lib/tile/models/tileModel.js +19 -2
  271. package/lib/tile/tileFactory/base.js +60 -33
  272. package/lib/tile/tileFactory/line.js +3 -0
  273. package/lib/tile/tileFactory/point.js +3 -0
  274. package/lib/tile/tileFactory/polygon.js +3 -0
  275. package/lib/tile/tileFactory/raster.js +3 -0
  276. package/lib/tile/tileFactory/rasterData.js +3 -0
  277. package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
  278. package/lib/tile/tileFactory/test.js +26 -5
  279. package/lib/tile/tileFactory/vectorLayer.js +112 -8
  280. package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
  281. package/lib/tile/tileLayer/baseTileLayer.js +46 -75
  282. package/lib/tile/tileTest.js +3 -2
  283. package/lib/tile/tmsMapTileLayer.js +136 -0
  284. package/lib/tile/tmsTileLayer.js +25 -2
  285. package/lib/tile/utils.js +38 -0
  286. package/lib/utils/dataMappingStyle.js +3 -0
  287. package/lib/utils/layerData.js +2 -2
  288. package/lib/utils/updateShape.js +2 -2
  289. package/lib/wind/index.js +6 -2
  290. package/lib/wind/models/wind.js +7 -7
  291. package/lib/wind/shaders/wind_vert.glsl +1 -1
  292. package/package.json +8 -7
  293. package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
  294. package/es/line/shaders/wall_vert.glsl +0 -111
  295. package/es/mask/shaders/mask_frag.glsl +0 -7
  296. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
  297. package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
  298. package/lib/line/shaders/wall_vert.glsl +0 -111
  299. package/lib/mask/shaders/mask_frag.glsl +0 -7
  300. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
@@ -33,10 +33,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
33
33
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
34
 
35
35
  /* babel-plugin-inline-import '../shaders/normal_frag.glsl' */
36
- var normalFrag = "\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\nvarying vec4 v_color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\nvoid main() {\n float opacity = styleMappingMat[0][0];\n\n gl_FragColor = v_color;\n // gl_FragColor.a =gl_FragColor.a * u_opacity;\n gl_FragColor.a =gl_FragColor.a * opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
36
+ var normalFrag = "uniform float u_opacity : 1;\nvarying vec4 v_color;\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n}\n";
37
37
 
38
38
  /* babel-plugin-inline-import '../shaders/normal_vert.glsl' */
39
- var normalVert = "\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute float a_Size;\nattribute vec4 a_Color;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n#pragma include \"project\"\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\nstyleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n \n // vec2 offset = project_pixel(u_offsets);\n vec2 offset = project_pixel(textrueOffsets);\n // vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n // gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));\\\n // \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // vec2 offset = project_pixel((u_offsets));\n gl_Position = u_Mvp * vec4(a_Position.xy + offset, a_Position.z, 1.0);\n } else { // else\n // vec2 offset = project_pixel(u_offsets);\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n setPickingColor(a_PickingColor);\n}\n";
39
+ var normalVert = "\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute float a_Size;\nattribute vec4 a_Color;\n\nvarying vec4 v_color;\n\n#pragma include \"projection\"\n#pragma include \"project\"\n\nvoid main() {\n v_color = a_Color;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(a_Position.xy, a_Position.z, 1.0);\n } else {\n vec4 project_pos = project_position(vec4(a_Position, 1.0)) + vec4(a_Size / 2.,-a_Size /2.,0.,0.);\n gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy),project_pos.z,project_pos.w));\n }\n\n gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;\n}\n";
40
40
 
41
41
  function PointTriangulation(feature) {
42
42
  var coordinates = feature.coordinates;
@@ -69,51 +69,10 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
69
69
  value: function getUninforms() {
70
70
  var _ref = this.layer.getLayerConfig(),
71
71
  _ref$opacity = _ref.opacity,
72
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
73
- _ref$offsets = _ref.offsets,
74
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets;
75
-
76
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
77
- opacity: opacity,
78
- offsets: offsets
79
- })) {
80
- // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
81
- this.judgeStyleAttributes({
82
- opacity: opacity,
83
- offsets: offsets
84
- });
85
- var encodeData = this.layer.getEncodedData();
86
-
87
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
88
- data = _this$calDataFrame.data,
89
- width = _this$calDataFrame.width,
90
- height = _this$calDataFrame.height;
91
-
92
- this.rowCount = height; // 当前数据纹理有多少行
93
-
94
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
95
- flipY: true,
96
- data: data,
97
- format: _l7Core.gl.LUMINANCE,
98
- type: _l7Core.gl.FLOAT,
99
- width: width,
100
- height: height
101
- }) : this.createTexture2D({
102
- flipY: true,
103
- data: [1],
104
- format: _l7Core.gl.LUMINANCE,
105
- type: _l7Core.gl.FLOAT,
106
- width: 1,
107
- height: 1
108
- });
109
- }
72
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity;
110
73
 
111
74
  return {
112
- u_dataTexture: this.dataTexture,
113
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
114
- u_cellTypeLayout: this.getCellTypeLayout(),
115
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
116
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
75
+ u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
117
76
  };
118
77
  }
119
78
  }, {
@@ -141,7 +100,8 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
141
100
  },
142
101
  primitive: _l7Core.gl.POINTS,
143
102
  blend: this.getBlend(),
144
- stencil: (0, _l7Utils.getMask)(mask, maskInside)
103
+ stencil: (0, _l7Utils.getMask)(mask, maskInside),
104
+ pick: false
145
105
  }).then(function (model) {
146
106
  callbackModel([model]);
147
107
  }).catch(function (err) {
@@ -151,11 +111,7 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
151
111
  }
152
112
  }, {
153
113
  key: "clearModels",
154
- value: function clearModels() {
155
- var _this$dataTexture;
156
-
157
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
158
- }
114
+ value: function clearModels() {}
159
115
  }, {
160
116
  key: "registerBuiltinAttributes",
161
117
  value: function registerBuiltinAttributes() {
@@ -172,7 +128,7 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
172
128
  type: _l7Core.gl.FLOAT
173
129
  },
174
130
  size: 1,
175
- update: function update(feature, featureIdx, vertex, attributeIdx) {
131
+ update: function update(feature) {
176
132
  var _feature$size = feature.size,
177
133
  size = _feature$size === void 0 ? 1 : _feature$size;
178
134
  return Array.isArray(size) ? [size[0]] : [size];
@@ -180,13 +136,6 @@ var NormalModel = /*#__PURE__*/function (_BaseModel) {
180
136
  }
181
137
  });
182
138
  }
183
- }, {
184
- key: "defaultStyleOptions",
185
- value: function defaultStyleOptions() {
186
- return {
187
- blend: _l7Core.BlendType.additive
188
- };
189
- }
190
139
  }]);
191
140
  return NormalModel;
192
141
  }(_BaseModel2.default);
@@ -40,10 +40,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
40
40
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
41
 
42
42
  /* babel-plugin-inline-import '../shaders/radar/radar_frag.glsl' */
43
- var pointFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = styleMappingMat[2].ba;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n // full circle\n // float rades = dot(dir, baseDir);\n // float flag = sign(dir.y);\n // float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;\n \n // half circle\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
43
+ var pointFillFrag = "\nuniform float u_additive;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df = sdCircle(v_data.xy, 1.0);\n float inner_df = sdCircle(v_data.xy, r);\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n } else {\n gl_FragColor.a *= opacity_t;\n }\n\n if(gl_FragColor.a > 0.0) {\n gl_FragColor = filterColor(gl_FragColor);\n }\n\n vec2 extrude = v_exteude;\n vec2 dir = normalize(extrude);\n vec2 baseDir = vec2(1.0, 0.0);\n float pi = 3.14159265359;\n // full circle\n // float rades = dot(dir, baseDir);\n // float flag = sign(dir.y);\n // float radar_v = (flag - 1.0) * -0.5 + flag * acos(rades)/pi/2.0;\n \n // half circle\n float flag = sign(dir.y);\n float rades = dot(dir, baseDir);\n float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;\n // simple AA\n if(radar_v > 0.99) {\n radar_v = 1.0 - (radar_v - 0.99)/0.01;\n }\n\n gl_FragColor.a *= radar_v;\n}\n";
44
44
 
45
45
  /* babel-plugin-inline-import '../shaders/radar/radar_vert.glsl' */
46
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - a_Extrude.x - a_Extrude.y\n 0.0, 0.0, 0.0, 0.0 // \n );\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n styleMappingMat[2].ba = rotateMatrix * a_Extrude.xy;\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> empty -> empty ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n vec2 offset = (extrude.xy * (newSize) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
46
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nuniform float u_speed: 1.0;\nuniform float u_time;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nvarying vec2 v_exteude;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float newSize = setPickingSize(a_Size);\n\n float time = u_time * u_speed;\n mat2 rotateMatrix = mat2( \n cos(time), sin(time), \n -sin(time), cos(time)\n );\n v_exteude = rotateMatrix * a_Extrude.xy;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n float blur = 0.0;\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);\n\n vec2 offset = (extrude.xy * (newSize));\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur, -1.0);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
47
47
 
48
48
  var RadarModel = /*#__PURE__*/function (_BaseModel) {
49
49
  (0, _inherits2.default)(RadarModel, _BaseModel);
@@ -71,56 +71,15 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
71
71
  var _ref = this.layer.getLayerConfig(),
72
72
  _ref$opacity = _ref.opacity,
73
73
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
74
- _ref$offsets = _ref.offsets,
75
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
76
74
  blend = _ref.blend,
77
75
  _ref$speed = _ref.speed,
78
76
  speed = _ref$speed === void 0 ? 1 : _ref$speed;
79
77
 
80
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
81
- opacity: opacity,
82
- offsets: offsets
83
- })) {
84
- // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
85
- this.judgeStyleAttributes({
86
- opacity: opacity,
87
- offsets: offsets
88
- });
89
- var encodeData = this.layer.getEncodedData();
90
-
91
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
92
- data = _this$calDataFrame.data,
93
- width = _this$calDataFrame.width,
94
- height = _this$calDataFrame.height;
95
-
96
- this.rowCount = height; // 当前数据纹理有多少行
97
-
98
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
99
- flipY: true,
100
- data: data,
101
- format: _l7Core.gl.LUMINANCE,
102
- type: _l7Core.gl.FLOAT,
103
- width: width,
104
- height: height
105
- }) : this.createTexture2D({
106
- flipY: true,
107
- data: [1],
108
- format: _l7Core.gl.LUMINANCE,
109
- type: _l7Core.gl.FLOAT,
110
- width: 1,
111
- height: 1
112
- });
113
- }
114
-
115
78
  return {
116
79
  u_isMeter: Number(this.isMeter),
117
80
  u_speed: speed,
118
81
  u_additive: blend === 'additive' ? 1.0 : 0.0,
119
- u_dataTexture: this.dataTexture,
120
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
121
- u_cellTypeLayout: this.getCellTypeLayout(),
122
- u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
123
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
82
+ u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0
124
83
  };
125
84
  }
126
85
  }, {
@@ -275,36 +234,12 @@ var RadarModel = /*#__PURE__*/function (_BaseModel) {
275
234
  type: _l7Core.gl.FLOAT
276
235
  },
277
236
  size: 1,
278
- update: function update(feature, featureIdx, vertex, attributeIdx) {
237
+ update: function update(feature) {
279
238
  var _feature$size = feature.size,
280
239
  size = _feature$size === void 0 ? 5 : _feature$size;
281
240
  return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
282
241
  }
283
242
  }
284
- }); // point layer size;
285
-
286
- this.styleAttributeService.registerStyleAttribute({
287
- name: 'shape',
288
- type: _l7Core.AttributeType.Attribute,
289
- descriptor: {
290
- name: 'a_Shape',
291
- buffer: {
292
- // give the WebGL driver a hint that this buffer may change
293
- usage: _l7Core.gl.DYNAMIC_DRAW,
294
- data: [],
295
- type: _l7Core.gl.FLOAT
296
- },
297
- size: 1,
298
- update: function update(feature, featureIdx, vertex, attributeIdx) {
299
- var _feature$shape = feature.shape,
300
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
301
-
302
- var shape2d = _this2.layer.getLayerConfig().shape2d;
303
-
304
- var shapeIndex = shape2d.indexOf(shape);
305
- return [shapeIndex];
306
- }
307
- }
308
243
  });
309
244
  }
310
245
  }]);
@@ -170,20 +170,18 @@ var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
170
170
  }, {
171
171
  key: "registerBuiltinAttributes",
172
172
  value: function registerBuiltinAttributes() {
173
- // point layer size;
174
173
  this.styleAttributeService.registerStyleAttribute({
175
174
  name: 'size',
176
175
  type: _l7Core.AttributeType.Attribute,
177
176
  descriptor: {
178
177
  name: 'a_Size',
179
178
  buffer: {
180
- // give the WebGL driver a hint that this buffer may change
181
179
  usage: _l7Core.gl.DYNAMIC_DRAW,
182
180
  data: [],
183
181
  type: _l7Core.gl.FLOAT
184
182
  },
185
183
  size: 1,
186
- update: function update(feature, featureIdx, vertex, attributeIdx) {
184
+ update: function update(feature) {
187
185
  var _feature$size = feature.size,
188
186
  size = _feature$size === void 0 ? 1 : _feature$size;
189
187
  return Array.isArray(size) ? [size[0]] : [size];
@@ -191,13 +189,6 @@ var SimplePointModel = /*#__PURE__*/function (_BaseModel) {
191
189
  }
192
190
  });
193
191
  }
194
- }, {
195
- key: "defaultStyleOptions",
196
- value: function defaultStyleOptions() {
197
- return {
198
- blend: _l7Core.BlendType.additive
199
- };
200
- }
201
192
  }]);
202
193
  return SimplePointModel;
203
194
  }(_BaseModel2.default);
@@ -305,7 +305,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
305
305
  type: _l7Core.gl.FLOAT
306
306
  },
307
307
  size: 1,
308
- update: function update(feature, featureIdx, vertex, attributeIdx) {
308
+ update: function update(feature) {
309
309
  var _feature$rotate = feature.rotate,
310
310
  rotate = _feature$rotate === void 0 ? 0 : _feature$rotate;
311
311
  return Array.isArray(rotate) ? [rotate[0]] : [rotate];
@@ -324,7 +324,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
324
324
  type: _l7Core.gl.FLOAT
325
325
  },
326
326
  size: 2,
327
- update: function update(feature, featureIdx, vertex, attributeIdx) {
327
+ update: function update(feature, featureIdx, vertex) {
328
328
  return [vertex[5], vertex[6]];
329
329
  }
330
330
  }
@@ -342,7 +342,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
342
342
  type: _l7Core.gl.FLOAT
343
343
  },
344
344
  size: 1,
345
- update: function update(feature, featureIdx, vertex, attributeIdx) {
345
+ update: function update(feature) {
346
346
  var _feature$size = feature.size,
347
347
  size = _feature$size === void 0 ? 12 : _feature$size;
348
348
  return Array.isArray(size) ? [size[0]] : [size];
@@ -362,7 +362,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
362
362
  type: _l7Core.gl.FLOAT
363
363
  },
364
364
  size: 2,
365
- update: function update(feature, featureIdx, vertex, attributeIdx) {
365
+ update: function update(feature, featureIdx, vertex) {
366
366
  return [vertex[3], vertex[4]];
367
367
  }
368
368
  }
@@ -459,7 +459,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
459
459
  value: function generateGlyphLayout(iconfont) {
460
460
  var _this2 = this;
461
461
 
462
- // TODO:更新文字布局
462
+ // 更新文字布局
463
463
  var mapping = this.fontService.mapping;
464
464
 
465
465
  var _ref8 = this.layer.getLayerConfig(),
@@ -547,7 +547,6 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
547
547
  box = _collisionIndex$place.box;
548
548
 
549
549
  if (box && box.length) {
550
- // TODO:featureIndex
551
550
  collisionIndex.insertCollisionBox(box, id);
552
551
  return true;
553
552
  } else {
@@ -624,7 +623,7 @@ var TextModel = /*#__PURE__*/function (_BaseModel) {
624
623
  }).then(function (model) {
625
624
  _this4.layer.models = [model];
626
625
 
627
- _this4.layer.renderLayers();
626
+ _this4.layerService.throttleRenderLayers();
628
627
  }).catch(function (err) {
629
628
  console.warn(err);
630
629
  _this4.layer.models = [];
@@ -7,22 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
11
 
14
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
13
 
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
15
 
20
16
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
17
 
22
18
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
19
 
24
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
20
  var _l7Core = require("@antv/l7-core");
27
21
 
28
22
  var _l7Utils = require("@antv/l7-utils");
@@ -31,17 +25,15 @@ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
31
25
 
32
26
  var _triangulation = require("../../core/triangulation");
33
27
 
34
- var _l7Maps = require("@antv/l7-maps");
35
-
36
28
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
37
29
 
38
30
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
31
 
40
32
  /* babel-plugin-inline-import '../shaders/tile/fill_tile_frag.glsl' */
41
- var point_tile_frag = "uniform float u_additive;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
33
+ var point_tile_frag = "uniform float u_additive;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
42
34
 
43
35
  /* babel-plugin-inline-import '../shaders/tile/fill_tile_vert.glsl' */
44
- var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n v_color = a_Color;\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n} else {\n gl_PointSize = 24.0;\n vec2 pointPos = a_Position.xy;\n vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n world.xy += offset;\n world.xy += pointOffset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n world.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n}\n\n \n setPickingColor(a_PickingColor);\n\n\n}\n";
36
+ var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping\n\n v_color = a_Color;\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, 0.0);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width));\n offset = project_pixel(offset);\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n\n// if(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n// } else {\n\n // vec2 pointPos = a_Position.xy;\n // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n // world.xy += offset;\n // world.xy += pointOffset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // world.w *= u_PixelsPerMeter.z;\n // }\n\n // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n// }\n\n \n setPickingColor(a_PickingColor);\n\n\n}\n";
45
37
 
46
38
  var FillModel = /*#__PURE__*/function (_BaseModel) {
47
39
  (0, _inherits2.default)(FillModel, _BaseModel);
@@ -49,18 +41,8 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
49
41
  var _super = _createSuper(FillModel);
50
42
 
51
43
  function FillModel() {
52
- var _this;
53
-
54
44
  (0, _classCallCheck2.default)(this, FillModel);
55
-
56
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57
- args[_key] = arguments[_key];
58
- }
59
-
60
- _this = _super.call.apply(_super, [this].concat(args));
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meter2coord", 1);
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMeter", false);
63
- return _this;
45
+ return _super.apply(this, arguments);
64
46
  }
65
47
 
66
48
  (0, _createClass2.default)(FillModel, [{
@@ -75,70 +57,16 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
75
57
  strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
76
58
  _ref$stroke = _ref.stroke,
77
59
  stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
78
- _ref$offsets = _ref.offsets,
79
- offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
80
- blend = _ref.blend,
81
- _ref$blur = _ref.blur,
82
- blur = _ref$blur === void 0 ? 0 : _ref$blur,
83
- _ref$coord = _ref.coord,
84
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
85
- tileOrigin = _ref.tileOrigin;
86
-
87
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
88
- opacity: opacity,
89
- strokeOpacity: strokeOpacity,
90
- strokeWidth: strokeWidth,
91
- stroke: stroke,
92
- offsets: offsets
93
- })) {
94
- // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
95
- this.judgeStyleAttributes({
96
- opacity: opacity,
97
- strokeOpacity: strokeOpacity,
98
- strokeWidth: strokeWidth,
99
- stroke: stroke,
100
- offsets: offsets
101
- });
102
- var encodeData = this.layer.getEncodedData();
103
-
104
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
105
- data = _this$calDataFrame.data,
106
- width = _this$calDataFrame.width,
107
- height = _this$calDataFrame.height;
108
-
109
- this.rowCount = height; // 当前数据纹理有多少行
110
-
111
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
112
- flipY: true,
113
- data: data,
114
- format: _l7Core.gl.LUMINANCE,
115
- type: _l7Core.gl.FLOAT,
116
- width: width,
117
- height: height
118
- }) : this.createTexture2D({
119
- flipY: true,
120
- data: [1],
121
- format: _l7Core.gl.LUMINANCE,
122
- type: _l7Core.gl.FLOAT,
123
- width: 1,
124
- height: 1
125
- });
126
- }
60
+ blend = _ref.blend;
127
61
 
128
62
  return {
129
- u_tileOrigin: tileOrigin || [0, 0],
130
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
131
- u_isMeter: Number(this.isMeter),
132
- u_blur: blur,
63
+ // u_tileOrigin: tileOrigin || [0, 0],
64
+ // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
133
65
  u_additive: blend === 'additive' ? 1.0 : 0.0,
134
- u_dataTexture: this.dataTexture,
135
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
136
- u_cellTypeLayout: this.getCellTypeLayout(),
137
66
  u_opacity: Number(opacity),
138
67
  u_stroke_opacity: Number(strokeOpacity),
139
68
  u_stroke_width: Number(strokeWidth),
140
- u_stroke_color: this.getStrokeColor(stroke),
141
- u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
69
+ u_stroke_color: this.getStrokeColor(stroke)
142
70
  };
143
71
  }
144
72
  }, {
@@ -149,74 +77,19 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
149
77
  }, {
150
78
  key: "initModels",
151
79
  value: function initModels(callbackModel) {
152
- var _ref2 = this.layer.getLayerConfig(),
153
- _ref2$unit = _ref2.unit,
154
- unit = _ref2$unit === void 0 ? 'l7size' : _ref2$unit;
155
-
156
- var version = this.mapService.version;
157
-
158
- if (unit === 'meter' && version !== _l7Maps.Version.L7MAP && version !== _l7Maps.Version.GLOBEL) {
159
- this.isMeter = true;
160
- this.calMeter2Coord();
161
- }
162
-
163
80
  this.buildModels(callbackModel);
164
81
  }
165
- /**
166
- * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
167
- * @returns
168
- */
169
-
170
- }, {
171
- key: "calMeter2Coord",
172
- value: function calMeter2Coord() {
173
- var _this$layer$getSource = (0, _slicedToArray2.default)(this.layer.getSource().extent, 4),
174
- minLng = _this$layer$getSource[0],
175
- minLat = _this$layer$getSource[1],
176
- maxLng = _this$layer$getSource[2],
177
- maxLat = _this$layer$getSource[3];
178
-
179
- var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
180
- var version = this.mapService.version;
181
-
182
- if (version === _l7Maps.Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {
183
- var coord = window.mapboxgl.MercatorCoordinate.fromLngLat({
184
- lng: center[0],
185
- lat: center[1]
186
- }, 0);
187
- var offsetInMeters = 1;
188
- var offsetInMercatorCoordinateUnits = offsetInMeters * coord.meterInMercatorCoordinateUnits();
189
- var westCoord = new window.mapboxgl.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
190
- var westLnglat = westCoord.toLngLat();
191
- this.meter2coord = center[0] - westLnglat.lng;
192
- return;
193
- } // @ts-ignore
194
-
195
-
196
- var m1 = this.mapService.meterToCoord(center, [minLng, minLat]); // @ts-ignore
197
-
198
- var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
199
- this.meter2coord = (m1 + m2) / 2;
200
-
201
- if (!this.meter2coord) {
202
- // Tip: 兼容单个数据导致的 m1、m2 为 NaN
203
- this.meter2coord = 7.70681090738883;
204
- }
205
- }
206
82
  }, {
207
83
  key: "buildModels",
208
84
  value: function buildModels(callbackModel) {
209
- var _ref3 = this.layer.getLayerConfig(),
210
- _ref3$mask = _ref3.mask,
211
- mask = _ref3$mask === void 0 ? false : _ref3$mask,
212
- _ref3$maskInside = _ref3.maskInside,
213
- maskInside = _ref3$maskInside === void 0 ? true : _ref3$maskInside,
214
- _ref3$workerEnabled = _ref3.workerEnabled,
215
- workerEnabled = _ref3$workerEnabled === void 0 ? false : _ref3$workerEnabled;
85
+ var _ref2 = this.layer.getLayerConfig(),
86
+ _ref2$workerEnabled = _ref2.workerEnabled,
87
+ workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled,
88
+ usage = _ref2.usage;
216
89
 
217
90
  this.layer.triangulation = _triangulation.PointFillTriangulation;
218
91
  this.layer.buildLayerModel({
219
- moduleName: 'pointTile',
92
+ moduleName: 'pointTile_' + usage,
220
93
  vertexShader: point_tile_vert,
221
94
  fragmentShader: point_tile_frag,
222
95
  triangulation: _triangulation.PointFillTriangulation,
@@ -228,11 +101,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
228
101
  face: (0, _l7Utils.getCullFace)(this.mapService.version)
229
102
  },
230
103
  blend: this.getBlend(),
231
- stencil: (0, _l7Utils.getMask)(mask, maskInside),
232
104
  workerEnabled: workerEnabled,
233
105
  workerOptions: {
234
106
  modelType: 'pointTile'
235
- }
107
+ },
108
+ pick: usage !== 'basemap'
236
109
  }).then(function (model) {
237
110
  callbackModel([model]);
238
111
  }).catch(function (err) {
@@ -242,16 +115,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
242
115
  }
243
116
  }, {
244
117
  key: "clearModels",
245
- value: function clearModels() {
246
- var _this$dataTexture;
247
-
248
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
249
- } // overwrite baseModel func
250
-
118
+ value: function clearModels() {}
251
119
  }, {
252
120
  key: "registerBuiltinAttributes",
253
121
  value: function registerBuiltinAttributes() {
254
- var _this2 = this;
122
+ var _this = this;
255
123
 
256
124
  this.styleAttributeService.registerStyleAttribute({
257
125
  name: 'extrude',
@@ -271,8 +139,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
271
139
  return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
272
140
  }
273
141
  }
274
- }); // point layer size;
275
-
142
+ });
276
143
  this.styleAttributeService.registerStyleAttribute({
277
144
  name: 'size',
278
145
  type: _l7Core.AttributeType.Attribute,
@@ -287,13 +154,11 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
287
154
  size: 1,
288
155
  update: function update(feature, featureIdx, vertex, attributeIdx) {
289
156
  var _feature$size = feature.size,
290
- size = _feature$size === void 0 ? 5 : _feature$size; // console.log('featureIdx', featureIdx, feature)
291
-
292
- return Array.isArray(size) ? [size[0] * _this2.meter2coord] : [size * _this2.meter2coord];
157
+ size = _feature$size === void 0 ? 5 : _feature$size;
158
+ return Array.isArray(size) ? [size[0]] : [size];
293
159
  }
294
160
  }
295
- }); // point layer size;
296
-
161
+ });
297
162
  this.styleAttributeService.registerStyleAttribute({
298
163
  name: 'shape',
299
164
  type: _l7Core.AttributeType.Attribute,
@@ -310,7 +175,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
310
175
  var _feature$shape = feature.shape,
311
176
  shape = _feature$shape === void 0 ? 2 : _feature$shape;
312
177
 
313
- var shape2d = _this2.layer.getLayerConfig().shape2d;
178
+ var shape2d = _this.layer.getLayerConfig().shape2d;
314
179
 
315
180
  var shapeIndex = shape2d.indexOf(shape);
316
181
  return [shapeIndex];