@antv/l7-layers 2.9.27-alpha.1 → 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 (302) hide show
  1. package/es/Geometry/index.d.ts +13 -0
  2. package/es/Geometry/index.js +20 -2
  3. package/es/Geometry/models/billboard.js +1 -2
  4. package/es/Geometry/models/plane.js +2 -4
  5. package/es/Geometry/models/sprite.js +2 -4
  6. package/es/canvas/index.d.ts +4 -0
  7. package/es/canvas/index.js +38 -2
  8. package/es/citybuliding/building.js +6 -2
  9. package/es/citybuliding/models/build.js +2 -3
  10. package/es/core/BaseLayer.d.ts +17 -6
  11. package/es/core/BaseLayer.js +89 -94
  12. package/es/core/BaseModel.d.ts +1 -1
  13. package/es/core/BaseModel.js +7 -3
  14. package/es/core/interface.d.ts +18 -0
  15. package/es/core/triangulation.d.ts +6 -0
  16. package/es/core/triangulation.js +64 -2
  17. package/es/earth/index.d.ts +5 -0
  18. package/es/earth/index.js +12 -1
  19. package/es/earth/models/base.js +2 -4
  20. package/es/earth/shaders/atmosphere_frag.glsl +1 -1
  21. package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
  22. package/es/heatmap/index.js +6 -2
  23. package/es/heatmap/models/heatmap.js +5 -3
  24. package/es/image/index.js +6 -2
  25. package/es/image/models/dataImage.js +4 -7
  26. package/es/image/models/image.js +4 -7
  27. package/es/line/index.d.ts +1 -0
  28. package/es/line/index.js +8 -2
  29. package/es/line/models/arc.js +6 -5
  30. package/es/line/models/half.js +3 -4
  31. package/es/line/models/line.js +9 -8
  32. package/es/line/models/simpleLine.js +2 -1
  33. package/es/line/models/simpleTileLine.d.ts +9 -0
  34. package/es/line/models/simpleTileLine.js +100 -0
  35. package/es/line/models/tile.d.ts +1 -4
  36. package/es/line/models/tile.js +49 -222
  37. package/es/line/models/wall.js +10 -46
  38. package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
  39. package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
  40. package/es/line/shaders/line_arc2d_vert.glsl +1 -1
  41. package/es/line/shaders/line_arc_3d_frag.glsl +1 -1
  42. package/es/line/shaders/line_arc_3d_vert.glsl +3 -3
  43. package/es/line/shaders/line_arc_frag.glsl +1 -1
  44. package/es/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  45. package/es/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  46. package/es/line/shaders/line_arc_vert.glsl +5 -3
  47. package/es/line/shaders/line_bezier_vert.glsl +1 -1
  48. package/es/line/shaders/line_frag.glsl +1 -2
  49. package/es/line/shaders/line_vert.glsl +1 -1
  50. package/es/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  51. package/es/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  52. package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
  53. package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  54. package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
  55. package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  56. package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
  57. package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  58. package/es/line/shaders/wall/wall_vert.glsl +77 -0
  59. package/es/mask/index.d.ts +1 -0
  60. package/es/mask/index.js +80 -5
  61. package/es/mask/models/fill.d.ts +2 -1
  62. package/es/mask/models/fill.js +13 -10
  63. package/es/mask/shaders/mask_vert.glsl +0 -6
  64. package/es/plugins/DataMappingPlugin.d.ts +4 -3
  65. package/es/plugins/DataMappingPlugin.js +129 -58
  66. package/es/plugins/DataSourcePlugin.js +3 -2
  67. package/es/plugins/FeatureScalePlugin.d.ts +0 -2
  68. package/es/plugins/FeatureScalePlugin.js +8 -51
  69. package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
  70. package/es/plugins/LayerAnimateStylePlugin.js +7 -27
  71. package/es/plugins/LayerModelPlugin.js +2 -6
  72. package/es/plugins/LightingPlugin.js +1 -7
  73. package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
  74. package/es/plugins/MultiPassRendererPlugin.js +4 -16
  75. package/es/plugins/PixelPickingPlugin.d.ts +1 -1
  76. package/es/plugins/PixelPickingPlugin.js +8 -28
  77. package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
  78. package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
  79. package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
  80. package/es/point/index.js +6 -2
  81. package/es/point/models/fill.js +2 -2
  82. package/es/point/models/fillmage.js +1 -1
  83. package/es/point/models/image.js +1 -1
  84. package/es/point/models/normal.d.ts +0 -1
  85. package/es/point/models/normal.js +9 -60
  86. package/es/point/models/radar.js +4 -69
  87. package/es/point/models/simplePoint.d.ts +0 -1
  88. package/es/point/models/simplePoint.js +2 -11
  89. package/es/point/models/text.js +6 -7
  90. package/es/point/models/tile.d.ts +0 -7
  91. package/es/point/models/tile.js +22 -155
  92. package/es/point/models/tileText.d.ts +0 -4
  93. package/es/point/models/tileText.js +98 -185
  94. package/es/point/shaders/animate/wave_frag.glsl +3 -3
  95. package/es/point/shaders/earth/fill_vert.glsl +0 -1
  96. package/es/point/shaders/fill_vert.glsl +0 -1
  97. package/es/point/shaders/normal_frag.glsl +1 -10
  98. package/es/point/shaders/normal_vert.glsl +5 -60
  99. package/es/point/shaders/radar/radar_frag.glsl +4 -15
  100. package/es/point/shaders/radar/radar_vert.glsl +4 -54
  101. package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
  102. package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
  103. package/es/point/shaders/tile/text_frag.glsl +33 -0
  104. package/es/point/shaders/tile/text_map_frag.glsl +31 -0
  105. package/es/point/shaders/tile/text_map_vert.glsl +38 -0
  106. package/es/point/shaders/tile/text_vert.glsl +48 -0
  107. package/es/polygon/index.js +6 -2
  108. package/es/polygon/models/extrude.js +1 -3
  109. package/es/polygon/models/fill.js +3 -4
  110. package/es/polygon/models/ocean.d.ts +0 -2
  111. package/es/polygon/models/ocean.js +13 -47
  112. package/es/polygon/models/tile.d.ts +1 -4
  113. package/es/polygon/models/tile.js +25 -57
  114. package/es/polygon/models/water.d.ts +0 -2
  115. package/es/polygon/models/water.js +13 -47
  116. package/es/polygon/shaders/polygon_frag.glsl +2 -2
  117. package/es/polygon/shaders/polygon_vert.glsl +2 -2
  118. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  119. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  120. package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  121. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  122. package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  123. package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  124. package/es/raster/buffers/triangulation.js +1 -4
  125. package/es/raster/index.js +6 -2
  126. package/es/raster/models/raster.js +3 -2
  127. package/es/shader/minify_frag.glsl +7 -0
  128. package/es/shader/minify_picking_frag.glsl +10 -0
  129. package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
  130. package/es/tile/manager/baseMapTileLayerManager.js +207 -0
  131. package/es/tile/manager/tileLayerManager.d.ts +2 -2
  132. package/es/tile/manager/tileLayerManager.js +2 -2
  133. package/es/tile/manager/tilePickerManager.d.ts +2 -3
  134. package/es/tile/manager/tilePickerManager.js +1 -2
  135. package/es/tile/models/tileModel.d.ts +1 -0
  136. package/es/tile/models/tileModel.js +18 -2
  137. package/es/tile/tileFactory/base.d.ts +1 -1
  138. package/es/tile/tileFactory/base.js +58 -33
  139. package/es/tile/tileFactory/line.js +3 -0
  140. package/es/tile/tileFactory/point.js +3 -0
  141. package/es/tile/tileFactory/polygon.js +3 -0
  142. package/es/tile/tileFactory/raster.js +3 -0
  143. package/es/tile/tileFactory/rasterData.js +3 -0
  144. package/es/tile/tileFactory/rasterDataLayer.js +6 -2
  145. package/es/tile/tileFactory/test.js +26 -5
  146. package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
  147. package/es/tile/tileFactory/vectorLayer.js +110 -7
  148. package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
  149. package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
  150. package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
  151. package/es/tile/tileLayer/baseTileLayer.js +46 -75
  152. package/es/tile/tileTest.d.ts +1 -0
  153. package/es/tile/tileTest.js +3 -2
  154. package/es/tile/tmsMapTileLayer.d.ts +9 -0
  155. package/es/tile/tmsMapTileLayer.js +119 -0
  156. package/es/tile/tmsTileLayer.d.ts +2 -0
  157. package/es/tile/tmsTileLayer.js +24 -2
  158. package/es/tile/utils.d.ts +4 -0
  159. package/es/tile/utils.js +30 -0
  160. package/es/utils/dataMappingStyle.js +3 -0
  161. package/es/utils/layerData.js +2 -2
  162. package/es/utils/updateShape.js +2 -2
  163. package/es/wind/index.js +6 -2
  164. package/es/wind/models/wind.js +8 -8
  165. package/es/wind/shaders/wind_vert.glsl +1 -1
  166. package/lib/Geometry/index.js +19 -2
  167. package/lib/Geometry/models/billboard.js +1 -2
  168. package/lib/Geometry/models/plane.js +2 -4
  169. package/lib/Geometry/models/sprite.js +2 -4
  170. package/lib/canvas/index.js +37 -2
  171. package/lib/citybuliding/building.js +6 -2
  172. package/lib/citybuliding/models/build.js +2 -3
  173. package/lib/core/BaseLayer.js +86 -94
  174. package/lib/core/BaseModel.js +7 -3
  175. package/lib/core/triangulation.js +66 -2
  176. package/lib/earth/index.js +11 -1
  177. package/lib/earth/models/base.js +2 -4
  178. package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
  179. package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
  180. package/lib/heatmap/index.js +6 -2
  181. package/lib/heatmap/models/heatmap.js +5 -3
  182. package/lib/image/index.js +6 -2
  183. package/lib/image/models/dataImage.js +4 -7
  184. package/lib/image/models/image.js +4 -7
  185. package/lib/line/index.js +7 -2
  186. package/lib/line/models/arc.js +6 -5
  187. package/lib/line/models/half.js +3 -4
  188. package/lib/line/models/line.js +9 -8
  189. package/lib/line/models/simpleLine.js +2 -1
  190. package/lib/line/models/simpleTileLine.js +115 -0
  191. package/lib/line/models/tile.js +49 -223
  192. package/lib/line/models/wall.js +10 -46
  193. package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
  194. package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
  195. package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
  196. package/lib/line/shaders/line_arc_3d_frag.glsl +1 -1
  197. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -3
  198. package/lib/line/shaders/line_arc_frag.glsl +1 -1
  199. package/lib/line/shaders/line_arc_great_circle_frag.glsl +1 -1
  200. package/lib/line/shaders/line_arc_great_circle_vert.glsl +1 -1
  201. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  202. package/lib/line/shaders/line_bezier_vert.glsl +1 -1
  203. package/lib/line/shaders/line_frag.glsl +1 -2
  204. package/lib/line/shaders/line_vert.glsl +1 -1
  205. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
  206. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
  207. package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
  208. package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
  209. package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
  210. package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
  211. package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
  212. package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
  213. package/lib/line/shaders/wall/wall_vert.glsl +77 -0
  214. package/lib/mask/index.js +82 -5
  215. package/lib/mask/models/fill.js +14 -10
  216. package/lib/mask/shaders/mask_vert.glsl +0 -6
  217. package/lib/plugins/DataMappingPlugin.js +127 -57
  218. package/lib/plugins/DataSourcePlugin.js +3 -2
  219. package/lib/plugins/FeatureScalePlugin.js +6 -50
  220. package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
  221. package/lib/plugins/LayerModelPlugin.js +2 -6
  222. package/lib/plugins/LightingPlugin.js +1 -7
  223. package/lib/plugins/MultiPassRendererPlugin.js +3 -19
  224. package/lib/plugins/PixelPickingPlugin.js +8 -28
  225. package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
  226. package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
  227. package/lib/point/index.js +6 -2
  228. package/lib/point/models/fill.js +2 -2
  229. package/lib/point/models/fillmage.js +1 -1
  230. package/lib/point/models/image.js +1 -1
  231. package/lib/point/models/normal.js +8 -59
  232. package/lib/point/models/radar.js +4 -69
  233. package/lib/point/models/simplePoint.js +1 -10
  234. package/lib/point/models/text.js +6 -7
  235. package/lib/point/models/tile.js +21 -156
  236. package/lib/point/models/tileText.js +97 -184
  237. package/lib/point/shaders/animate/wave_frag.glsl +3 -3
  238. package/lib/point/shaders/earth/fill_vert.glsl +0 -1
  239. package/lib/point/shaders/fill_vert.glsl +0 -1
  240. package/lib/point/shaders/normal_frag.glsl +1 -10
  241. package/lib/point/shaders/normal_vert.glsl +5 -60
  242. package/lib/point/shaders/radar/radar_frag.glsl +4 -15
  243. package/lib/point/shaders/radar/radar_vert.glsl +4 -54
  244. package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
  245. package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
  246. package/lib/point/shaders/tile/text_frag.glsl +33 -0
  247. package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
  248. package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
  249. package/lib/point/shaders/tile/text_vert.glsl +48 -0
  250. package/lib/polygon/index.js +6 -2
  251. package/lib/polygon/models/extrude.js +1 -3
  252. package/lib/polygon/models/fill.js +3 -4
  253. package/lib/polygon/models/ocean.js +14 -47
  254. package/lib/polygon/models/tile.js +24 -57
  255. package/lib/polygon/models/water.js +14 -47
  256. package/lib/polygon/shaders/polygon_frag.glsl +2 -2
  257. package/lib/polygon/shaders/polygon_vert.glsl +2 -2
  258. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
  259. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
  260. package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
  261. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
  262. package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
  263. package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
  264. package/lib/raster/buffers/triangulation.js +1 -4
  265. package/lib/raster/index.js +6 -2
  266. package/lib/raster/models/raster.js +3 -2
  267. package/lib/shader/minify_frag.glsl +7 -0
  268. package/lib/shader/minify_picking_frag.glsl +10 -0
  269. package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
  270. package/lib/tile/manager/tileLayerManager.js +2 -2
  271. package/lib/tile/manager/tilePickerManager.js +1 -2
  272. package/lib/tile/models/tileModel.js +19 -2
  273. package/lib/tile/tileFactory/base.js +60 -33
  274. package/lib/tile/tileFactory/line.js +3 -0
  275. package/lib/tile/tileFactory/point.js +3 -0
  276. package/lib/tile/tileFactory/polygon.js +3 -0
  277. package/lib/tile/tileFactory/raster.js +3 -0
  278. package/lib/tile/tileFactory/rasterData.js +3 -0
  279. package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
  280. package/lib/tile/tileFactory/test.js +26 -5
  281. package/lib/tile/tileFactory/vectorLayer.js +112 -8
  282. package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
  283. package/lib/tile/tileLayer/baseTileLayer.js +46 -75
  284. package/lib/tile/tileTest.js +3 -2
  285. package/lib/tile/tmsMapTileLayer.js +136 -0
  286. package/lib/tile/tmsTileLayer.js +25 -2
  287. package/lib/tile/utils.js +38 -0
  288. package/lib/utils/dataMappingStyle.js +3 -0
  289. package/lib/utils/layerData.js +2 -2
  290. package/lib/utils/updateShape.js +2 -2
  291. package/lib/wind/index.js +6 -2
  292. package/lib/wind/models/wind.js +7 -7
  293. package/lib/wind/shaders/wind_vert.glsl +1 -1
  294. package/package.json +8 -7
  295. package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
  296. package/es/line/shaders/wall_vert.glsl +0 -111
  297. package/es/mask/shaders/mask_frag.glsl +0 -7
  298. package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
  299. package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
  300. package/lib/line/shaders/wall_vert.glsl +0 -111
  301. package/lib/mask/shaders/mask_frag.glsl +0 -7
  302. package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
@@ -15,16 +15,12 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
15
15
 
16
16
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
17
 
18
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
-
20
18
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
19
 
22
20
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
21
 
24
22
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
23
 
26
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
24
  var _l7Core = require("@antv/l7-core");
29
25
 
30
26
  var _l7Utils = require("@antv/l7-utils");
@@ -37,11 +33,17 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
37
33
 
38
34
  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
35
 
40
- /* babel-plugin-inline-import '../shaders/tile/line_tile_frag.glsl' */
41
- 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";
36
+ /* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
37
+ 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";
42
38
 
43
39
  /* babel-plugin-inline-import '../shaders/tile/line_tile_vert.glsl' */
44
- 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";
40
+ 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";
41
+
42
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
43
+ 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";
44
+
45
+ /* babel-plugin-inline-import '../shaders/tile/line_tile_map_vert.glsl' */
46
+ 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";
45
47
 
46
48
  var LineModel = /*#__PURE__*/function (_BaseModel) {
47
49
  (0, _inherits2.default)(LineModel, _BaseModel);
@@ -49,38 +51,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
49
51
  var _super = _createSuper(LineModel);
50
52
 
51
53
  function LineModel() {
52
- var _this;
53
-
54
54
  (0, _classCallCheck2.default)(this, LineModel);
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), "updateTexture", function () {
62
- var createTexture2D = _this.rendererService.createTexture2D;
63
-
64
- if (_this.texture) {
65
- _this.texture.update({
66
- data: _this.iconService.getCanvas()
67
- });
68
-
69
- _this.layer.render();
70
-
71
- return;
72
- }
73
-
74
- _this.texture = createTexture2D({
75
- data: _this.iconService.getCanvas(),
76
- mag: _l7Core.gl.NEAREST,
77
- min: _l7Core.gl.NEAREST,
78
- premultiplyAlpha: false,
79
- width: 1024,
80
- height: _this.iconService.canvasHeight || 128
81
- });
82
- });
83
- return _this;
55
+ return _super.apply(this, arguments);
84
56
  }
85
57
 
86
58
  (0, _createClass2.default)(LineModel, [{
@@ -89,135 +61,48 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
89
61
  var _ref = this.layer.getLayerConfig(),
90
62
  _ref$opacity = _ref.opacity,
91
63
  opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
92
- _ref$textureBlend = _ref.textureBlend,
93
- textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
94
- _ref$lineTexture = _ref.lineTexture,
95
- lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
96
- _ref$iconStep = _ref.iconStep,
97
- iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
98
- _ref$vertexHeightScal = _ref.vertexHeightScale,
99
- vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
100
- _ref$borderWidth = _ref.borderWidth,
101
- borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
102
- _ref$borderColor = _ref.borderColor,
103
- borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor,
104
- _ref$heightfixed = _ref.heightfixed,
105
- heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
106
- _ref$arrow = _ref.arrow,
107
- arrow = _ref$arrow === void 0 ? {
108
- enable: false,
109
- arrowWidth: 2,
110
- arrowHeight: 3,
111
- tailWidth: 1
112
- } : _ref$arrow,
113
- _ref$coord = _ref.coord,
114
- coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
115
- tileOrigin = _ref.tileOrigin;
116
-
117
- if (this.rendererService.getDirty()) {
118
- this.texture.bind();
119
- }
120
-
121
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
122
- opacity: opacity
123
- })) {
124
- this.judgeStyleAttributes({
125
- opacity: opacity
126
- });
127
- var encodeData = this.layer.getEncodedData();
128
-
129
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
130
- data = _this$calDataFrame.data,
131
- width = _this$calDataFrame.width,
132
- height = _this$calDataFrame.height;
133
-
134
- this.rowCount = height; // 当前数据纹理有多少行
135
-
136
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
137
- flipY: true,
138
- data: data,
139
- format: _l7Core.gl.LUMINANCE,
140
- type: _l7Core.gl.FLOAT,
141
- width: width,
142
- height: height
143
- }) : this.createTexture2D({
144
- flipY: true,
145
- data: [1],
146
- format: _l7Core.gl.LUMINANCE,
147
- type: _l7Core.gl.FLOAT,
148
- width: 1,
149
- height: 1
150
- });
151
- }
64
+ usage = _ref.usage,
65
+ _ref$color = _ref.color,
66
+ color = _ref$color === void 0 ? '#fff' : _ref$color,
67
+ _ref$size = _ref.size,
68
+ size = _ref$size === void 0 ? 1 : _ref$size;
152
69
 
153
70
  return {
154
- u_tileOrigin: tileOrigin || [0, 0],
155
- u_coord: coord === 'lnglat' ? 1.0 : 0.0,
156
- u_dataTexture: this.dataTexture,
157
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
158
- u_cellTypeLayout: this.getCellTypeLayout(),
71
+ // u_tileOrigin: tileOrigin || [0, 0],
72
+ // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
159
73
  u_opacity: Number(opacity),
160
- u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
161
- // 纹理支持参数
162
- u_texture: this.texture,
163
- // 贴图
164
- u_line_texture: lineTexture ? 1.0 : 0.0,
165
- // 传入线的标识
166
- u_icon_step: iconStep,
167
- u_textSize: [1024, this.iconService.canvasHeight || 128],
168
- // line border 参数
169
- u_borderWidth: borderWidth,
170
- u_borderColor: (0, _l7Utils.rgb2arr)(borderColor),
171
- // 是否固定高度
172
- u_heightfixed: Number(heightfixed),
173
- // 顶点高度 scale
174
- u_vertexScale: vertexHeightScale,
175
- // arrow
176
- u_arrow: Number(arrow.enable),
177
- u_arrowHeight: arrow.arrowHeight || 3,
178
- u_arrowWidth: arrow.arrowWidth || 2,
179
- u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
74
+ u_color: usage === 'basemap' ? (0, _l7Utils.rgb2arr)(color) : [0, 0, 0, 0],
75
+ u_size: usage === 'basemap' ? size : 1
180
76
  };
181
77
  }
182
78
  }, {
183
79
  key: "initModels",
184
80
  value: function initModels(callbackModel) {
185
- this.updateTexture();
186
- this.iconService.on('imageUpdate', this.updateTexture);
187
81
  this.buildModels(callbackModel);
188
82
  }
189
- }, {
190
- key: "clearModels",
191
- value: function clearModels() {
192
- var _this$texture, _this$dataTexture;
193
-
194
- (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
195
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
196
- this.iconService.off('imageUpdate', this.updateTexture);
197
- }
198
83
  }, {
199
84
  key: "buildModels",
200
85
  value: function () {
201
86
  var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(callbackModel) {
202
- var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth;
87
+ var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth, usage;
203
88
 
204
89
  return _regenerator.default.wrap(function _callee$(_context) {
205
90
  while (1) {
206
91
  switch (_context.prev = _context.next) {
207
92
  case 0:
208
- _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;
93
+ _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;
209
94
  this.layer.triangulation = _triangulation.LineTriangulation;
210
95
  this.layer.buildLayerModel({
211
- moduleName: 'lineTile',
212
- vertexShader: line_tile_vert,
213
- fragmentShader: line_tile_frag,
96
+ moduleName: 'lineTile_' + usage,
97
+ vertexShader: usage === 'basemap' ? line_tile_map_vert : line_tile_vert,
98
+ fragmentShader: usage === 'basemap' ? line_tile_map_frag : line_tile_frag,
214
99
  triangulation: _triangulation.LineTriangulation,
215
100
  blend: this.getBlend(),
216
101
  depth: {
217
102
  enable: depth
218
103
  },
219
- // depth: { enable: true },
220
- stencil: (0, _l7Utils.getMask)(mask, maskInside)
104
+ stencil: (0, _l7Utils.getMask)(mask, maskInside),
105
+ pick: usage !== 'basemap'
221
106
  }).then(function (model) {
222
107
  callbackModel([model]);
223
108
  }).catch(function (err) {
@@ -242,61 +127,30 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
242
127
  }, {
243
128
  key: "registerBuiltinAttributes",
244
129
  value: function registerBuiltinAttributes() {
245
- var _this2 = this;
246
-
247
- this.styleAttributeService.registerStyleAttribute({
248
- name: 'distanceAndIndex',
249
- type: _l7Core.AttributeType.Attribute,
250
- descriptor: {
251
- name: 'a_DistanceAndIndex',
252
- buffer: {
253
- // give the WebGL driver a hint that this buffer may change
254
- usage: _l7Core.gl.STATIC_DRAW,
255
- data: [],
256
- type: _l7Core.gl.FLOAT
257
- },
258
- size: 2,
259
- update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
260
- return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
261
- }
262
- }
263
- });
264
- this.styleAttributeService.registerStyleAttribute({
265
- name: 'total_distance',
266
- type: _l7Core.AttributeType.Attribute,
267
- descriptor: {
268
- name: 'a_Total_Distance',
269
- buffer: {
270
- // give the WebGL driver a hint that this buffer may change
271
- usage: _l7Core.gl.STATIC_DRAW,
272
- data: [],
273
- type: _l7Core.gl.FLOAT
274
- },
275
- size: 1,
276
- update: function update(feature, featureIdx, vertex, attributeIdx) {
277
- return [vertex[5]];
278
- }
279
- }
280
- });
281
- this.styleAttributeService.registerStyleAttribute({
282
- name: 'size',
283
- type: _l7Core.AttributeType.Attribute,
284
- descriptor: {
285
- name: 'a_Size',
286
- buffer: {
287
- // give the WebGL driver a hint that this buffer may change
288
- usage: _l7Core.gl.DYNAMIC_DRAW,
289
- data: [],
290
- type: _l7Core.gl.FLOAT
291
- },
292
- size: 2,
293
- update: function update(feature, featureIdx, vertex, attributeIdx) {
294
- var _feature$size = feature.size,
295
- size = _feature$size === void 0 ? 1 : _feature$size;
296
- return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
130
+ var _this$layer$getLayerC = this.layer.getLayerConfig(),
131
+ usage = _this$layer$getLayerC.usage;
132
+
133
+ if (usage !== 'basemap') {
134
+ this.styleAttributeService.registerStyleAttribute({
135
+ name: 'size',
136
+ type: _l7Core.AttributeType.Attribute,
137
+ descriptor: {
138
+ name: 'a_Size',
139
+ buffer: {
140
+ // give the WebGL driver a hint that this buffer may change
141
+ usage: _l7Core.gl.DYNAMIC_DRAW,
142
+ data: [],
143
+ type: _l7Core.gl.FLOAT
144
+ },
145
+ size: 2,
146
+ update: function update(feature) {
147
+ var _feature$size = feature.size,
148
+ size = _feature$size === void 0 ? 1 : _feature$size;
149
+ return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
150
+ }
297
151
  }
298
- }
299
- }); // point layer size;
152
+ });
153
+ }
300
154
 
301
155
  this.styleAttributeService.registerStyleAttribute({
302
156
  name: 'normal',
@@ -332,34 +186,6 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
332
186
  }
333
187
  }
334
188
  });
335
- this.styleAttributeService.registerStyleAttribute({
336
- name: 'uv',
337
- type: _l7Core.AttributeType.Attribute,
338
- descriptor: {
339
- name: 'a_iconMapUV',
340
- buffer: {
341
- // give the WebGL driver a hint that this buffer may change
342
- usage: _l7Core.gl.DYNAMIC_DRAW,
343
- data: [],
344
- type: _l7Core.gl.FLOAT
345
- },
346
- size: 2,
347
- update: function update(feature, featureIdx, vertex, attributeIdx) {
348
- var iconMap = _this2.iconService.getIconMap();
349
-
350
- var texture = feature.texture;
351
-
352
- var _ref3 = iconMap[texture] || {
353
- x: 0,
354
- y: 0
355
- },
356
- x = _ref3.x,
357
- y = _ref3.y;
358
-
359
- return [x, y];
360
- }
361
- }
362
- });
363
189
  }
364
190
  }]);
365
191
  return LineModel;
@@ -35,11 +35,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
35
35
 
36
36
  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; } }
37
37
 
38
- /* babel-plugin-inline-import '../shaders/wall_frag.glsl' */
39
- 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";
38
+ /* babel-plugin-inline-import '../shaders/wall/wall_frag.glsl' */
39
+ 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";
40
40
 
41
- /* babel-plugin-inline-import '../shaders/wall_vert.glsl' */
42
- 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";
41
+ /* babel-plugin-inline-import '../shaders/wall/wall_vert.glsl' */
42
+ 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";
43
43
 
44
44
  var LineWallModel = /*#__PURE__*/function (_BaseModel) {
45
45
  (0, _inherits2.default)(LineWallModel, _BaseModel);
@@ -116,43 +116,8 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
116
116
  useLinearColor = 1;
117
117
  }
118
118
 
119
- if (this.dataTextureTest && this.dataTextureNeedUpdate({
120
- opacity: opacity
121
- })) {
122
- this.judgeStyleAttributes({
123
- opacity: opacity
124
- });
125
- var encodeData = this.layer.getEncodedData();
126
-
127
- var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
128
- data = _this$calDataFrame.data,
129
- width = _this$calDataFrame.width,
130
- height = _this$calDataFrame.height;
131
-
132
- this.rowCount = height; // 当前数据纹理有多少行
133
-
134
- this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
135
- flipY: true,
136
- data: data,
137
- format: _l7Core.gl.LUMINANCE,
138
- type: _l7Core.gl.FLOAT,
139
- width: width,
140
- height: height
141
- }) : this.createTexture2D({
142
- flipY: true,
143
- data: [1],
144
- format: _l7Core.gl.LUMINANCE,
145
- type: _l7Core.gl.FLOAT,
146
- width: 1,
147
- height: 1
148
- });
149
- }
150
-
151
119
  return {
152
120
  u_heightfixed: Number(heightfixed),
153
- u_dataTexture: this.dataTexture,
154
- // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]
155
- u_cellTypeLayout: this.getCellTypeLayout(),
156
121
  u_opacity: (0, _lodash.isNumber)(opacity) ? opacity : 1.0,
157
122
  u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
158
123
  // 纹理支持参数
@@ -190,10 +155,9 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
190
155
  }, {
191
156
  key: "clearModels",
192
157
  value: function clearModels() {
193
- var _this$texture, _this$dataTexture;
158
+ var _this$texture;
194
159
 
195
160
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
196
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
197
161
  this.iconService.off('imageUpdate', this.updateTexture);
198
162
  }
199
163
  }, {
@@ -232,7 +196,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
232
196
  type: _l7Core.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[3]];
237
201
  }
238
202
  }
@@ -249,7 +213,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
249
213
  type: _l7Core.gl.FLOAT
250
214
  },
251
215
  size: 1,
252
- update: function update(feature, featureIdx, vertex, attributeIdx) {
216
+ update: function update(feature, featureIdx, vertex) {
253
217
  return [vertex[5]];
254
218
  }
255
219
  }
@@ -266,7 +230,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
266
230
  type: _l7Core.gl.FLOAT
267
231
  },
268
232
  size: 2,
269
- update: function update(feature, featureIdx, vertex, attributeIdx) {
233
+ update: function update(feature) {
270
234
  var _feature$size = feature.size,
271
235
  size = _feature$size === void 0 ? 1 : _feature$size;
272
236
  return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
@@ -304,7 +268,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
304
268
  type: _l7Core.gl.FLOAT
305
269
  },
306
270
  size: 1,
307
- update: function update(feature, featureIdx, vertex, attributeIdx) {
271
+ update: function update(feature, featureIdx, vertex) {
308
272
  return [vertex[4]];
309
273
  }
310
274
  }
@@ -321,7 +285,7 @@ var LineWallModel = /*#__PURE__*/function (_BaseModel) {
321
285
  type: _l7Core.gl.FLOAT
322
286
  },
323
287
  size: 2,
324
- update: function update(feature, featureIdx, vertex, attributeIdx) {
288
+ update: function update(feature) {
325
289
  var iconMap = _this2.iconService.getIconMap();
326
290
 
327
291
  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) {
@@ -9,7 +9,7 @@ varying vec4 v_dash_array;
9
9
  #pragma include "picking"
10
10
 
11
11
  uniform float u_time;
12
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // 控制运动
12
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ]; // 控制运动
13
13
 
14
14
  varying mat4 styleMappingMat;
15
15
  // [animate, duration, interval, trailLength],
@@ -7,7 +7,7 @@ attribute vec4 a_Instance;
7
7
  attribute float a_Size;
8
8
  uniform mat4 u_ModelMatrix;
9
9
  uniform float segmentNumber;
10
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
10
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
11
11
  varying vec4 v_color;
12
12
  varying vec2 v_normal;
13
13
 
@@ -20,7 +20,7 @@ uniform float segmentNumber;
20
20
  varying vec2 v_iconMapUV;
21
21
 
22
22
  uniform float u_time;
23
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
23
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
24
24
 
25
25
  varying mat4 styleMappingMat;
26
26
 
@@ -13,7 +13,7 @@ uniform float u_global_height: 10;
13
13
  uniform mat4 u_ModelMatrix;
14
14
  uniform mat4 u_Mvp;
15
15
  uniform float segmentNumber;
16
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
17
17
  varying vec4 v_color;
18
18
  // varying vec2 v_normal;
19
19
  uniform float u_line_type: 0.0;
@@ -85,11 +85,11 @@ float torad(float deg) {
85
85
 
86
86
  vec3 lglt2xyz(vec2 lnglat) {
87
87
  float pi = 3.1415926;
88
- // TODO: + Math.PI/2 是为了对齐坐标
88
+ // + Math.PI/2 是为了对齐坐标
89
89
  float lng = torad(lnglat.x) + pi / 2.0;
90
90
  float lat = torad(lnglat.y);
91
91
 
92
- // TODO: 手动增加一些偏移,减轻面的冲突
92
+ // 手动增加一些偏移,减轻面的冲突
93
93
  float radius = u_globel_radius;
94
94
 
95
95
  float z = radius * cos(lat) * cos(lng);
@@ -11,7 +11,7 @@ varying vec4 v_dash_array;
11
11
  varying vec4 v_color;
12
12
 
13
13
  uniform float u_time;
14
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
14
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
15
15
 
16
16
  uniform float u_line_texture;
17
17
  uniform sampler2D u_texture;
@@ -13,7 +13,7 @@ varying float v_distance_ratio;
13
13
  varying vec4 v_color;
14
14
 
15
15
  uniform float u_time;
16
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
16
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
17
17
 
18
18
  uniform float u_line_texture: 0.0;
19
19
  uniform sampler2D u_texture;
@@ -10,7 +10,7 @@ attribute float a_Size;
10
10
  uniform mat4 u_ModelMatrix;
11
11
  uniform mat4 u_Mvp;
12
12
  uniform float segmentNumber;
13
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
13
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
14
14
  varying vec4 v_color;
15
15
  // varying vec2 v_normal;
16
16
 
@@ -8,7 +8,7 @@ attribute float a_Size;
8
8
  uniform mat4 u_ModelMatrix;
9
9
  uniform mat4 u_Mvp;
10
10
  uniform float segmentNumber;
11
- uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
11
+ uniform vec4 u_aimate: [ 1., 2., 1.0, 0.2 ];
12
12
  varying vec4 v_color;
13
13
 
14
14
  uniform float u_lineDir: 1.0;
@@ -52,8 +52,10 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
52
52
  // return mid;
53
53
  }
54
54
  float getSegmentRatio(float index) {
55
- // return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
56
- return index / (segmentNumber - 1.);
55
+ // dash: index / (segmentNumber - 1.);
56
+ // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
57
+ return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
58
+ // return index / (segmentNumber - 1.);
57
59
  }
58
60
  vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {
59
61
  // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation