@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
@@ -0,0 +1,100 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+
9
+ 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; } }
10
+
11
+ import { gl } from '@antv/l7-core';
12
+ import { getMask, rgb2arr } from '@antv/l7-utils';
13
+ import { isNumber } from 'lodash';
14
+ import BaseModel from "../../core/BaseModel";
15
+ import { TileSimpleLineTriangulation } from "../../core/triangulation";
16
+
17
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
18
+ var simple_line_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
19
+
20
+ /* babel-plugin-inline-import '../shaders/tile/simpleline_vert.glsl' */
21
+ var simple_line_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\n\nvoid main() {\n v_color = a_Color; \n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n }\n}\n";
22
+
23
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
24
+ var simple_line_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
25
+
26
+ /* babel-plugin-inline-import '../shaders/tile/simpleline_map_vert.glsl' */
27
+ var simple_line_map_vert = "attribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n\nvoid main() {\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));\n }\n}";
28
+
29
+ var SimpleTileLineModel = /*#__PURE__*/function (_BaseModel) {
30
+ _inherits(SimpleTileLineModel, _BaseModel);
31
+
32
+ var _super = _createSuper(SimpleTileLineModel);
33
+
34
+ function SimpleTileLineModel() {
35
+ _classCallCheck(this, SimpleTileLineModel);
36
+
37
+ return _super.apply(this, arguments);
38
+ }
39
+
40
+ _createClass(SimpleTileLineModel, [{
41
+ key: "getUninforms",
42
+ value: function getUninforms() {
43
+ var _ref = this.layer.getLayerConfig(),
44
+ _ref$opacity = _ref.opacity,
45
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
46
+ usage = _ref.usage,
47
+ _ref$color = _ref.color,
48
+ color = _ref$color === void 0 ? '#fff' : _ref$color;
49
+
50
+ return {
51
+ u_opacity: isNumber(opacity) ? opacity : 1.0,
52
+ u_color: usage === 'basemap' ? rgb2arr(color) : [0, 0, 0, 0]
53
+ };
54
+ }
55
+ }, {
56
+ key: "initModels",
57
+ value: function initModels(callbackModel) {
58
+ this.buildModels(callbackModel);
59
+ }
60
+ }, {
61
+ key: "clearModels",
62
+ value: function clearModels() {}
63
+ }, {
64
+ key: "buildModels",
65
+ value: function buildModels(callbackModel) {
66
+ var _ref2 = this.layer.getLayerConfig(),
67
+ _ref2$mask = _ref2.mask,
68
+ mask = _ref2$mask === void 0 ? false : _ref2$mask,
69
+ _ref2$maskInside = _ref2.maskInside,
70
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
71
+ usage = _ref2.usage;
72
+
73
+ this.layer.buildLayerModel({
74
+ moduleName: 'lineTileSimpleNormal_' + usage,
75
+ vertexShader: usage === 'basemap' ? simple_line_map_vert : simple_line_vert,
76
+ fragmentShader: usage === 'basemap' ? simple_line_map_frag : simple_line_frag,
77
+ triangulation: TileSimpleLineTriangulation,
78
+ primitive: gl.LINES,
79
+ depth: {
80
+ enable: false
81
+ },
82
+ blend: this.getBlend(),
83
+ stencil: getMask(mask, maskInside),
84
+ pick: false
85
+ }).then(function (model) {
86
+ callbackModel([model]);
87
+ }).catch(function (err) {
88
+ console.warn(err);
89
+ callbackModel([]);
90
+ });
91
+ }
92
+ }, {
93
+ key: "registerBuiltinAttributes",
94
+ value: function registerBuiltinAttributes() {}
95
+ }]);
96
+
97
+ return SimpleTileLineModel;
98
+ }(BaseModel);
99
+
100
+ export { SimpleTileLineModel as default };
@@ -1,11 +1,8 @@
1
- import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
1
+ import { IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class LineModel extends BaseModel {
4
- protected texture: ITexture2D;
5
4
  getUninforms(): IModelUniform;
6
5
  initModels(callbackModel: (models: IModel[]) => void): void;
7
- clearModels(): void;
8
6
  buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
9
7
  protected registerBuiltinAttributes(): void;
10
- private updateTexture;
11
8
  }
@@ -1,11 +1,9 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
4
  import _inherits from "@babel/runtime/helpers/inherits";
6
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
8
 
11
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -17,11 +15,17 @@ import { getMask, rgb2arr } from '@antv/l7-utils';
17
15
  import BaseModel from "../../core/BaseModel";
18
16
  import { LineTriangulation } from "../../core/triangulation";
19
17
 
20
- /* babel-plugin-inline-import '../shaders/tile/line_tile_frag.glsl' */
21
- var line_tile_frag = "#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor += pattern;\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
18
+ /* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
19
+ var line_tile_frag = "uniform float u_opacity : 1.0;\nvarying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
22
20
 
23
21
  /* babel-plugin-inline-import '../shaders/tile/line_tile_vert.glsl' */
24
- var line_tile_vert = "\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform vec2 u_tileOrigin;\nuniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_icon_step: 100;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.0;\n\nuniform float u_opacity: 1.0;\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\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\n\nvoid main() {\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 // distance_ratio/distance/pixelLen/texV\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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\nif(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n} else {\n vec2 pointPos = a_Position.xy;\n vec4 tileWorld = 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 tileWorld.xy += pointOffset;\n\n tileWorld.xy += offset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n tileWorld.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n\n\n}\n";
22
+ var line_tile_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\nvoid main() {\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // if(u_coord > 0.0) { // \u4F7F\u7528\u7ECF\u7EAC\u5EA6\u5750\u6807\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 { // \u4F7F\u7528\u504F\u79FB\u5750\u6807\n // vec2 pointPos = a_Position.xy;\n // vec4 tileWorld = 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 // tileWorld.xy += pointOffset;\n\n // tileWorld.xy += offset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // tileWorld.w *= u_PixelsPerMeter.z;\n // }\n // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n // }\n\n setPickingColor(a_PickingColor);\n}\n";
23
+
24
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
25
+ var line_tile_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
26
+
27
+ /* babel-plugin-inline-import '../shaders/tile/line_tile_map_vert.glsl' */
28
+ var line_tile_map_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_size;\n\n#pragma include \"projection\"\n\nvoid main() {\n\n vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 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, 0.0, 1.0));\n }\n}\n";
25
29
 
26
30
  var LineModel = /*#__PURE__*/function (_BaseModel) {
27
31
  _inherits(LineModel, _BaseModel);
@@ -29,40 +33,9 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
29
33
  var _super = _createSuper(LineModel);
30
34
 
31
35
  function LineModel() {
32
- var _this;
33
-
34
36
  _classCallCheck(this, LineModel);
35
37
 
36
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
37
- args[_key] = arguments[_key];
38
- }
39
-
40
- _this = _super.call.apply(_super, [this].concat(args));
41
-
42
- _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
43
- var createTexture2D = _this.rendererService.createTexture2D;
44
-
45
- if (_this.texture) {
46
- _this.texture.update({
47
- data: _this.iconService.getCanvas()
48
- });
49
-
50
- _this.layer.render();
51
-
52
- return;
53
- }
54
-
55
- _this.texture = createTexture2D({
56
- data: _this.iconService.getCanvas(),
57
- mag: gl.NEAREST,
58
- min: gl.NEAREST,
59
- premultiplyAlpha: false,
60
- width: 1024,
61
- height: _this.iconService.canvasHeight || 128
62
- });
63
- });
64
-
65
- return _this;
38
+ return _super.apply(this, arguments);
66
39
  }
67
40
 
68
41
  _createClass(LineModel, [{
@@ -71,135 +44,48 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
71
44
  var _ref = this.layer.getLayerConfig(),
72
45
  _ref$opacity = _ref.opacity,
73
46
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
74
- _ref$textureBlend = _ref.textureBlend,
75
- textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
76
- _ref$lineTexture = _ref.lineTexture,
77
- lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
78
- _ref$iconStep = _ref.iconStep,
79
- iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
80
- _ref$vertexHeightScal = _ref.vertexHeightScale,
81
- vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
82
- _ref$borderWidth = _ref.borderWidth,
83
- borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
84
- _ref$borderColor = _ref.borderColor,
85
- borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor,
86
- _ref$heightfixed = _ref.heightfixed,
87
- heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
88
- _ref$arrow = _ref.arrow,
89
- arrow = _ref$arrow === void 0 ? {
90
- enable: false,
91
- arrowWidth: 2,
92
- arrowHeight: 3,
93
- tailWidth: 1
94
- } : _ref$arrow,
95
- _ref$coord = _ref.coord,
96
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
97
- tileOrigin = _ref.tileOrigin;
98
-
99
- if (this.rendererService.getDirty()) {
100
- this.texture.bind();
101
- }
102
-
103
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
104
- opacity: opacity
105
- })) {
106
- this.judgeStyleAttributes({
107
- opacity: opacity
108
- });
109
- var encodeData = this.layer.getEncodedData();
110
-
111
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
112
- data = _this$calDataFrame.data,
113
- width = _this$calDataFrame.width,
114
- height = _this$calDataFrame.height;
115
-
116
- this.rowCount = height; // 当前数据纹理有多少行
117
-
118
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
119
- flipY: true,
120
- data: data,
121
- format: gl.LUMINANCE,
122
- type: gl.FLOAT,
123
- width: width,
124
- height: height
125
- }) : this.createTexture2D({
126
- flipY: true,
127
- data: [1],
128
- format: gl.LUMINANCE,
129
- type: gl.FLOAT,
130
- width: 1,
131
- height: 1
132
- });
133
- }
47
+ usage = _ref.usage,
48
+ _ref$color = _ref.color,
49
+ color = _ref$color === void 0 ? '#fff' : _ref$color,
50
+ _ref$size = _ref.size,
51
+ size = _ref$size === void 0 ? 1 : _ref$size;
134
52
 
135
53
  return {
136
- u_tileOrigin: tileOrigin || [0, 0],
137
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
138
- u_dataTexture: this.dataTexture,
139
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
140
- u_cellTypeLayout: this.getCellTypeLayout(),
54
+ // u_tileOrigin: tileOrigin || [0, 0],
55
+ // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
141
56
  u_opacity: Number(opacity),
142
- u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
143
- // 纹理支持参数
144
- u_texture: this.texture,
145
- // 贴图
146
- u_line_texture: lineTexture ? 1.0 : 0.0,
147
- // 传入线的标识
148
- u_icon_step: iconStep,
149
- u_textSize: [1024, this.iconService.canvasHeight || 128],
150
- // line border 参数
151
- u_borderWidth: borderWidth,
152
- u_borderColor: rgb2arr(borderColor),
153
- // 是否固定高度
154
- u_heightfixed: Number(heightfixed),
155
- // 顶点高度 scale
156
- u_vertexScale: vertexHeightScale,
157
- // arrow
158
- u_arrow: Number(arrow.enable),
159
- u_arrowHeight: arrow.arrowHeight || 3,
160
- u_arrowWidth: arrow.arrowWidth || 2,
161
- u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
57
+ u_color: usage === 'basemap' ? rgb2arr(color) : [0, 0, 0, 0],
58
+ u_size: usage === 'basemap' ? size : 1
162
59
  };
163
60
  }
164
61
  }, {
165
62
  key: "initModels",
166
63
  value: function initModels(callbackModel) {
167
- this.updateTexture();
168
- this.iconService.on('imageUpdate', this.updateTexture);
169
64
  this.buildModels(callbackModel);
170
65
  }
171
- }, {
172
- key: "clearModels",
173
- value: function clearModels() {
174
- var _this$texture, _this$dataTexture;
175
-
176
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
177
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
178
- this.iconService.off('imageUpdate', this.updateTexture);
179
- }
180
66
  }, {
181
67
  key: "buildModels",
182
68
  value: function () {
183
69
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(callbackModel) {
184
- var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth;
70
+ var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth, usage;
185
71
 
186
72
  return _regeneratorRuntime.wrap(function _callee$(_context) {
187
73
  while (1) {
188
74
  switch (_context.prev = _context.next) {
189
75
  case 0:
190
- _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth;
76
+ _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth, usage = _ref2.usage;
191
77
  this.layer.triangulation = LineTriangulation;
192
78
  this.layer.buildLayerModel({
193
- moduleName: 'lineTile',
194
- vertexShader: line_tile_vert,
195
- fragmentShader: line_tile_frag,
79
+ moduleName: 'lineTile_' + usage,
80
+ vertexShader: usage === 'basemap' ? line_tile_map_vert : line_tile_vert,
81
+ fragmentShader: usage === 'basemap' ? line_tile_map_frag : line_tile_frag,
196
82
  triangulation: LineTriangulation,
197
83
  blend: this.getBlend(),
198
84
  depth: {
199
85
  enable: depth
200
86
  },
201
- // depth: { enable: true },
202
- stencil: getMask(mask, maskInside)
87
+ stencil: getMask(mask, maskInside),
88
+ pick: usage !== 'basemap'
203
89
  }).then(function (model) {
204
90
  callbackModel([model]);
205
91
  }).catch(function (err) {
@@ -224,61 +110,30 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
224
110
  }, {
225
111
  key: "registerBuiltinAttributes",
226
112
  value: function registerBuiltinAttributes() {
227
- var _this2 = this;
228
-
229
- this.styleAttributeService.registerStyleAttribute({
230
- name: 'distanceAndIndex',
231
- type: AttributeType.Attribute,
232
- descriptor: {
233
- name: 'a_DistanceAndIndex',
234
- buffer: {
235
- // give the WebGL driver a hint that this buffer may change
236
- usage: gl.STATIC_DRAW,
237
- data: [],
238
- type: gl.FLOAT
239
- },
240
- size: 2,
241
- update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
242
- return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
243
- }
244
- }
245
- });
246
- this.styleAttributeService.registerStyleAttribute({
247
- name: 'total_distance',
248
- type: AttributeType.Attribute,
249
- descriptor: {
250
- name: 'a_Total_Distance',
251
- buffer: {
252
- // give the WebGL driver a hint that this buffer may change
253
- usage: gl.STATIC_DRAW,
254
- data: [],
255
- type: gl.FLOAT
256
- },
257
- size: 1,
258
- update: function update(feature, featureIdx, vertex, attributeIdx) {
259
- return [vertex[5]];
260
- }
261
- }
262
- });
263
- this.styleAttributeService.registerStyleAttribute({
264
- name: 'size',
265
- type: AttributeType.Attribute,
266
- descriptor: {
267
- name: 'a_Size',
268
- buffer: {
269
- // give the WebGL driver a hint that this buffer may change
270
- usage: gl.DYNAMIC_DRAW,
271
- data: [],
272
- type: gl.FLOAT
273
- },
274
- size: 2,
275
- update: function update(feature, featureIdx, vertex, attributeIdx) {
276
- var _feature$size = feature.size,
277
- size = _feature$size === void 0 ? 1 : _feature$size;
278
- return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
113
+ var _this$layer$getLayerC = this.layer.getLayerConfig(),
114
+ usage = _this$layer$getLayerC.usage;
115
+
116
+ if (usage !== 'basemap') {
117
+ this.styleAttributeService.registerStyleAttribute({
118
+ name: 'size',
119
+ type: AttributeType.Attribute,
120
+ descriptor: {
121
+ name: 'a_Size',
122
+ buffer: {
123
+ // give the WebGL driver a hint that this buffer may change
124
+ usage: gl.DYNAMIC_DRAW,
125
+ data: [],
126
+ type: gl.FLOAT
127
+ },
128
+ size: 2,
129
+ update: function update(feature) {
130
+ var _feature$size = feature.size,
131
+ size = _feature$size === void 0 ? 1 : _feature$size;
132
+ return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
133
+ }
279
134
  }
280
- }
281
- }); // point layer size;
135
+ });
136
+ }
282
137
 
283
138
  this.styleAttributeService.registerStyleAttribute({
284
139
  name: 'normal',
@@ -314,34 +169,6 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
314
169
  }
315
170
  }
316
171
  });
317
- this.styleAttributeService.registerStyleAttribute({
318
- name: 'uv',
319
- type: AttributeType.Attribute,
320
- descriptor: {
321
- name: 'a_iconMapUV',
322
- buffer: {
323
- // give the WebGL driver a hint that this buffer may change
324
- usage: gl.DYNAMIC_DRAW,
325
- data: [],
326
- type: gl.FLOAT
327
- },
328
- size: 2,
329
- update: function update(feature, featureIdx, vertex, attributeIdx) {
330
- var iconMap = _this2.iconService.getIconMap();
331
-
332
- var texture = feature.texture;
333
-
334
- var _ref3 = iconMap[texture] || {
335
- x: 0,
336
- y: 0
337
- },
338
- x = _ref3.x,
339
- y = _ref3.y;
340
-
341
- return [x, y];
342
- }
343
- }
344
- });
345
172
  }
346
173
  }]);
347
174
 
@@ -16,11 +16,11 @@ import { isNumber } from 'lodash';
16
16
  import BaseModel from "../../core/BaseModel";
17
17
  import { LineTriangulation } from "../../core/triangulation";
18
18
 
19
- /* babel-plugin-inline-import '../shaders/wall_frag.glsl' */
20
- var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\n\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = styleMappingMat[3].a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
+ /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
20
+ var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\nuniform float u_time;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_color;\nvarying vec4 v_dataset;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = v_dataset.r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = v_dataset.a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = v_dataset.g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = v_dataset.b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = v_dataset.a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n }\n \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
21
21
 
22
- /* babel-plugin-inline-import '../shaders/wall_vert.glsl' */
23
- var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying float v_blur;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\nuniform float u_linearColor: 0;\n\nuniform float u_opacity: 1.0;\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 \"light\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\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 // distance_ratio/distance/pixelLen/texV\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 // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n // v_color = a_Color;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
22
+ /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
23
+ var line_vert = "#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\nuniform float u_linearColor: 0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\nvarying vec4 v_color;\nvarying float v_blur;\nvarying float v_radio;\nvarying vec4 v_dataset;\n\nvoid main() {\n\n\n float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n v_dataset[0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n v_dataset[1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n v_dataset[2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n v_dataset[3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_float_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_float_pixel(2.0) / originSize, 0.05);\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
24
24
 
25
25
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
26
26
  _inherits(LineWallModel, _BaseModel);
@@ -99,43 +99,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
99
99
  useLinearColor = 1;
100
100
  }
101
101
 
102
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
103
- opacity: opacity
104
- })) {
105
- this.judgeStyleAttributes({
106
- opacity: opacity
107
- });
108
- var encodeData = this.layer.getEncodedData();
109
-
110
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
111
- data = _this$calDataFrame.data,
112
- width = _this$calDataFrame.width,
113
- height = _this$calDataFrame.height;
114
-
115
- this.rowCount = height; // 当前数据纹理有多少行
116
-
117
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
118
- flipY: true,
119
- data: data,
120
- format: gl.LUMINANCE,
121
- type: gl.FLOAT,
122
- width: width,
123
- height: height
124
- }) : this.createTexture2D({
125
- flipY: true,
126
- data: [1],
127
- format: gl.LUMINANCE,
128
- type: gl.FLOAT,
129
- width: 1,
130
- height: 1
131
- });
132
- }
133
-
134
102
  return {
135
103
  u_heightfixed: Number(heightfixed),
136
- u_dataTexture: this.dataTexture,
137
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
138
- u_cellTypeLayout: this.getCellTypeLayout(),
139
104
  u_opacity: isNumber(opacity) ? opacity : 1.0,
140
105
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
141
106
  // 纹理支持参数
@@ -173,10 +138,9 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
173
138
  }, {
174
139
  key: "clearModels",
175
140
  value: function clearModels() {
176
- var _this$texture, _this$dataTexture;
141
+ var _this$texture;
177
142
 
178
143
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
179
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
180
144
  this.iconService.off('imageUpdate', this.updateTexture);
181
145
  }
182
146
  }, {
@@ -215,7 +179,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
215
179
  type: gl.FLOAT
216
180
  },
217
181
  size: 1,
218
- update: function update(feature, featureIdx, vertex, attributeIdx) {
182
+ update: function update(feature, featureIdx, vertex) {
219
183
  return [vertex[3]];
220
184
  }
221
185
  }
@@ -232,7 +196,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
232
196
  type: gl.FLOAT
233
197
  },
234
198
  size: 1,
235
- update: function update(feature, featureIdx, vertex, attributeIdx) {
199
+ update: function update(feature, featureIdx, vertex) {
236
200
  return [vertex[5]];
237
201
  }
238
202
  }
@@ -249,7 +213,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
249
213
  type: gl.FLOAT
250
214
  },
251
215
  size: 2,
252
- update: function update(feature, featureIdx, vertex, attributeIdx) {
216
+ update: function update(feature) {
253
217
  var _feature$size = feature.size,
254
218
  size = _feature$size === void 0 ? 1 : _feature$size;
255
219
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
@@ -287,7 +251,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
287
251
  type: gl.FLOAT
288
252
  },
289
253
  size: 1,
290
- update: function update(feature, featureIdx, vertex, attributeIdx) {
254
+ update: function update(feature, featureIdx, vertex) {
291
255
  return [vertex[4]];
292
256
  }
293
257
  }
@@ -304,7 +268,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
304
268
  type: gl.FLOAT
305
269
  },
306
270
  size: 2,
307
- update: function update(feature, featureIdx, vertex, attributeIdx) {
271
+ update: function update(feature) {
308
272
  var iconMap = _this2.iconService.getIconMap();
309
273
 
310
274
  var texture = feature.texture;
@@ -48,6 +48,8 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
48
48
  // return mid;
49
49
  }
50
50
  float getSegmentRatio(float index) {
51
+ // dash: index / (segmentNumber - 1.);
52
+ // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
51
53
  return index / (segmentNumber - 1.);
52
54
  }
53
55
  vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {