@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
package/es/mask/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -6,12 +7,19 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
9
 
10
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
+
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
+
9
16
  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); }; }
10
17
 
11
18
  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; } }
12
19
 
13
20
  import BaseLayer from "../core/BaseLayer";
14
21
  import MaskModels from "./models";
22
+ import { TYPES } from '@antv/l7-core';
15
23
 
16
24
  var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
17
25
  _inherits(MaskLayer, _BaseLayer);
@@ -35,25 +43,92 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
35
43
  }
36
44
 
37
45
  _createClass(MaskLayer, [{
46
+ key: "init",
47
+ value: function init() {
48
+ var _this2 = this;
49
+
50
+ // 设置配置项
51
+ var sceneId = this.container.get(TYPES.SceneID);
52
+ this.configService.setLayerConfig(sceneId, this.id, this.rawConfig);
53
+ this.layerType = this.rawConfig.layerType;
54
+ this.rendererService = this.container.get(TYPES.IRendererService);
55
+ this.layerService = this.container.get(TYPES.ILayerService);
56
+ this.mapService = this.container.get(TYPES.IMapService);
57
+ this.cameraService = this.container.get(TYPES.ICameraService);
58
+ this.coordinateService = this.container.get(TYPES.ICoordinateSystemService);
59
+ this.shaderModuleService = this.container.get(TYPES.IShaderModuleService);
60
+ this.postProcessingPassFactory = this.container.get(TYPES.IFactoryPostProcessingPass);
61
+ this.normalPassFactory = this.container.get(TYPES.IFactoryNormalPass); // 图层容器服务
62
+
63
+ this.styleAttributeService = this.container.get(TYPES.IStyleAttributeService); // 完成样式服务注册完成前添加的属性
64
+
65
+ this.pendingStyleAttributes.forEach(function (_ref) {
66
+ var attributeName = _ref.attributeName,
67
+ attributeField = _ref.attributeField,
68
+ attributeValues = _ref.attributeValues,
69
+ updateOptions = _ref.updateOptions;
70
+
71
+ _this2.styleAttributeService.updateStyleAttribute(attributeName, {
72
+ // @ts-ignore
73
+ scale: _objectSpread({
74
+ field: attributeField
75
+ }, _this2.splitValuesAndCallbackInAttribute( // @ts-ignore
76
+ attributeValues, // @ts-ignore
77
+ _this2.getLayerConfig()[attributeName]))
78
+ }, // @ts-ignore
79
+ updateOptions);
80
+ });
81
+ this.pendingStyleAttributes = []; // 获取插件集
82
+
83
+ this.plugins = this.container.getAll(TYPES.ILayerPlugin); // 完成插件注册,传入场景和图层容器内的服务
84
+
85
+ var _iterator = _createForOfIteratorHelper(this.plugins),
86
+ _step;
87
+
88
+ try {
89
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
90
+ var plugin = _step.value;
91
+ plugin.apply(this, {
92
+ rendererService: this.rendererService,
93
+ mapService: this.mapService,
94
+ styleAttributeService: this.styleAttributeService,
95
+ normalPassFactory: this.normalPassFactory,
96
+ postProcessingPassFactory: this.postProcessingPassFactory
97
+ });
98
+ } // 触发 init 生命周期插件
99
+
100
+ } catch (err) {
101
+ _iterator.e(err);
102
+ } finally {
103
+ _iterator.f();
104
+ }
105
+
106
+ this.hooks.init.call();
107
+ this.hooks.afterInit.call();
108
+ return this;
109
+ }
110
+ }, {
38
111
  key: "buildModels",
39
112
  value: function buildModels() {
40
- var _this2 = this;
113
+ var _this3 = this;
41
114
 
42
115
  var shape = this.getModelType();
43
116
  this.layerModel = new MaskModels[shape](this);
44
117
  this.layerModel.initModels(function (models) {
45
- _this2.models = models;
118
+ _this3.models = models;
46
119
 
47
- _this2.renderLayers();
120
+ _this3.emit('modelLoaded', null);
48
121
  });
49
122
  }
50
123
  }, {
51
124
  key: "rebuildModels",
52
125
  value: function rebuildModels() {
53
- var _this3 = this;
126
+ var _this4 = this;
54
127
 
55
128
  this.layerModel.buildModels(function (models) {
56
- return _this3.models = models;
129
+ _this4.models = models;
130
+
131
+ _this4.emit('modelLoaded', null);
57
132
  });
58
133
  }
59
134
  }, {
@@ -3,9 +3,10 @@ import BaseModel from '../../core/BaseModel';
3
3
  export default class MaskModel extends BaseModel {
4
4
  getUninforms(): {
5
5
  u_opacity: number;
6
+ u_color: number[];
6
7
  };
7
8
  initModels(callbackModel: (models: IModel[]) => void): void;
8
9
  buildModels(callbackModel: (models: IModel[]) => void): Promise<void>;
9
- clearModels(): void;
10
+ clearModels(refresh?: boolean): void;
10
11
  protected registerBuiltinAttributes(): string;
11
12
  }
@@ -11,15 +11,16 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  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; } }
12
12
 
13
13
  import { gl } from '@antv/l7-core';
14
+ import { rgb2arr } from '@antv/l7-utils';
14
15
  import { isNumber } from 'lodash';
15
16
  import BaseModel from "../../core/BaseModel";
16
17
  import { polygonTriangulation } from "../../core/triangulation";
17
18
 
18
- /* babel-plugin-inline-import '../shaders/mask_frag.glsl' */
19
- var mask_frag = "uniform float u_opacity;\nvarying vec4 v_Color;\n\nvoid main() {\n gl_FragColor = v_Color;\n gl_FragColor.a *= u_opacity;\n}\n";
19
+ /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
20
+ var mask_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";
20
21
 
21
22
  /* babel-plugin-inline-import '../shaders/mask_vert.glsl' */
22
- var mask_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n\nvoid main() {\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
23
+ var mask_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, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
23
24
 
24
25
  var MaskModel = /*#__PURE__*/function (_BaseModel) {
25
26
  _inherits(MaskModel, _BaseModel);
@@ -37,10 +38,13 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
37
38
  value: function getUninforms() {
38
39
  var _ref = this.layer.getLayerConfig(),
39
40
  _ref$opacity = _ref.opacity,
40
- opacity = _ref$opacity === void 0 ? 0 : _ref$opacity;
41
+ opacity = _ref$opacity === void 0 ? 0 : _ref$opacity,
42
+ _ref$color = _ref.color,
43
+ color = _ref$color === void 0 ? '#000' : _ref$color;
41
44
 
42
45
  return {
43
- u_opacity: isNumber(opacity) ? opacity : 0.0
46
+ u_opacity: isNumber(opacity) ? opacity : 0.0,
47
+ u_color: rgb2arr(color)
44
48
  };
45
49
  }
46
50
  }, {
@@ -78,7 +82,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
78
82
  zfail: gl.REPLACE,
79
83
  zpass: gl.REPLACE
80
84
  }
81
- }
85
+ },
86
+ pick: false
82
87
  }).then(function (model) {
83
88
  callbackModel([model]);
84
89
  }).catch(function (err) {
@@ -103,10 +108,8 @@ var MaskModel = /*#__PURE__*/function (_BaseModel) {
103
108
  }, {
104
109
  key: "clearModels",
105
110
  value: function clearModels() {
106
- var _this$dataTexture;
107
-
108
- (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
109
- this.layerService.clear();
111
+ var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
112
+ refresh && this.layerService.clear();
110
113
  }
111
114
  }, {
112
115
  key: "registerBuiltinAttributes",
@@ -1,17 +1,11 @@
1
- attribute vec4 a_Color;
2
1
  attribute vec3 a_Position;
3
2
  uniform mat4 u_ModelMatrix;
4
3
  uniform mat4 u_Mvp;
5
4
 
6
- varying vec4 v_Color;
7
-
8
5
  #pragma include "projection"
9
6
 
10
7
  void main() {
11
-
12
- v_Color = a_Color;
13
8
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
14
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
15
9
 
16
10
  if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
11
  gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
@@ -1,18 +1,19 @@
1
1
  import { ILayer, ILayerPlugin, IStyleAttributeService } from '@antv/l7-core';
2
2
  import 'reflect-metadata';
3
3
  export default class DataMappingPlugin implements ILayerPlugin {
4
- private readonly configService;
5
4
  private readonly mapService;
6
5
  private readonly fontService;
7
6
  apply(layer: ILayer, { styleAttributeService, }: {
8
7
  styleAttributeService: IStyleAttributeService;
9
8
  }): void;
10
9
  private generateMaping;
11
- private getArrowPoints;
12
10
  private mapping;
11
+ private mapLayerMapping;
13
12
  private adjustData2Amap2Coordinates;
14
- private getLayerCenter;
15
13
  private adjustData2SimpleCoordinates;
14
+ private getLayerCenter;
16
15
  private unProjectCoordinates;
17
16
  private applyAttributeMapping;
17
+ private applyMapLayerAttributeMapping;
18
+ private getArrowPoints;
18
19
  }
@@ -6,7 +6,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
6
  import _applyDecoratedDescriptor from "@babel/runtime/helpers/applyDecoratedDescriptor";
7
7
  import _initializerWarningHelper from "@babel/runtime/helpers/initializerWarningHelper";
8
8
 
9
- var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3;
9
+ var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
10
10
 
11
11
  import { TYPES } from '@antv/l7-core';
12
12
  import { Version } from '@antv/l7-maps';
@@ -14,15 +14,13 @@ import { isColor, normalize, rgb2arr } from '@antv/l7-utils';
14
14
  import { inject, injectable } from 'inversify';
15
15
  import { cloneDeep } from 'lodash';
16
16
  import 'reflect-metadata';
17
- var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfigService), _dec3 = inject(TYPES.IMapService), _dec4 = inject(TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
17
+ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService), _dec3 = inject(TYPES.IFontService), _dec(_class = (_class2 = /*#__PURE__*/function () {
18
18
  function DataMappingPlugin() {
19
19
  _classCallCheck(this, DataMappingPlugin);
20
20
 
21
- _initializerDefineProperty(this, "configService", _descriptor, this);
21
+ _initializerDefineProperty(this, "mapService", _descriptor, this);
22
22
 
23
- _initializerDefineProperty(this, "mapService", _descriptor2, this);
24
-
25
- _initializerDefineProperty(this, "fontService", _descriptor3, this);
23
+ _initializerDefineProperty(this, "fontService", _descriptor2, this);
26
24
  }
27
25
 
28
26
  _createClass(DataMappingPlugin, [{
@@ -45,8 +43,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
45
43
  styleAttributeService: styleAttributeService
46
44
  });
47
45
  });
48
- } // this.generateMaping(layer, { styleAttributeService });
49
-
46
+ }
50
47
  });
51
48
  layer.hooks.beforeRenderData.tap('DataMappingPlugin', function () {
52
49
  layer.dataState.dataMappingNeedUpdate = false;
@@ -62,8 +59,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
62
59
  styleAttributeService: styleAttributeService
63
60
  });
64
61
  });
65
- } // this.generateMaping(layer, { styleAttributeService });
66
-
62
+ }
67
63
 
68
64
  return true;
69
65
  }); // remapping before render
@@ -94,10 +90,14 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
94
90
  if (attributesToRemapping.length) {
95
91
  // 过滤数据
96
92
  if (filter !== null && filter !== void 0 && filter.needRemapping) {
97
- layer.setEncodedData(_this.mapping(layer, attributes, filterData, undefined, bottomColor));
93
+ var encodeData = _this.mapping(layer, attributes, filterData, undefined, bottomColor);
94
+
95
+ layer.setEncodedData(encodeData);
98
96
  filter.needRemapping = false;
99
97
  } else {
100
- layer.setEncodedData(_this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData(), bottomColor));
98
+ var _encodeData = _this.mapping(layer, attributesToRemapping, filterData, layer.getEncodedData(), bottomColor);
99
+
100
+ layer.setEncodedData(_encodeData);
101
101
  } // 处理文本更新
102
102
 
103
103
 
@@ -123,18 +123,11 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
123
123
  });
124
124
  }
125
125
 
126
- layer.setEncodedData(this.mapping(layer, attributes, filterData, undefined, bottomColor)); // 对外暴露事件
126
+ var encodeData = this.mapping(layer, attributes, filterData, undefined, bottomColor);
127
+ layer.setEncodedData(encodeData); // 对外暴露事件
127
128
 
128
129
  layer.emit('dataUpdate', null);
129
130
  }
130
- }, {
131
- key: "getArrowPoints",
132
- value: function getArrowPoints(p1, p2) {
133
- var dir = [p2[0] - p1[0], p2[1] - p1[1]];
134
- var normalizeDir = normalize(dir);
135
- var arrowPoint = [p1[0] + normalizeDir[0] * 0.0001, p1[1] + normalizeDir[1] * 0.0001];
136
- return arrowPoint;
137
- }
138
131
  }, {
139
132
  key: "mapping",
140
133
  value: function mapping(layer, attributes, data, predata, minimumColor) {
@@ -144,8 +137,16 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
144
137
  _ref3$arrow = _ref3.arrow,
145
138
  arrow = _ref3$arrow === void 0 ? {
146
139
  enable: false
147
- } : _ref3$arrow;
140
+ } : _ref3$arrow,
141
+ usage = _ref3.usage;
148
142
 
143
+ if (usage === 'basemap') {
144
+ return this.mapLayerMapping(layer, attributes, data, predata);
145
+ }
146
+
147
+ var usedAttributes = attributes.filter(function (attribute) {
148
+ return attribute.scale !== undefined;
149
+ });
149
150
  var mappedData = data.map(function (record, i) {
150
151
  var preRecord = predata ? predata[i] : {};
151
152
 
@@ -154,17 +155,12 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
154
155
  coordinates: record.coordinates
155
156
  }, preRecord);
156
157
 
157
- attributes.filter(function (attribute) {
158
- return attribute.scale !== undefined;
159
- }).forEach(function (attribute) {
160
- // console.log('record', record)
161
- var values = _this3.applyAttributeMapping(attribute, record, minimumColor); // console.log('values', values)
162
-
158
+ usedAttributes.forEach(function (attribute) {
159
+ var values = _this3.applyAttributeMapping(attribute, record, minimumColor);
163
160
 
164
161
  attribute.needRemapping = false; // TODO: 支持每个属性配置 postprocess
165
162
 
166
163
  if (attribute.name === 'color') {
167
- // console.log('attribute', attribute)
168
164
  values = values.map(function (c) {
169
165
  return rgb2arr(c);
170
166
  });
@@ -180,26 +176,77 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
180
176
 
181
177
  if (arrow.enable && (encodeRecord.shape === 'line' || encodeRecord.shape === 'halfLine')) {
182
178
  // 只有在线图层且支持配置箭头的时候进行插入顶点的处理
183
- var coords = encodeRecord.coordinates;
179
+ var coords = encodeRecord.coordinates; // @ts-ignore
180
+
181
+ if (layer.arrowInsertCount < layer.encodeDataLength) {
182
+ // Tip: arrowInsert 的判断用于确保每一条线数据 arrow 的属性点只会被植入一次
183
+ var arrowPoint = _this3.getArrowPoints(coords[0], coords[1]);
184
184
 
185
- var arrowPoint = _this3.getArrowPoints(coords[0], coords[1]);
185
+ encodeRecord.coordinates.splice(1, 0, arrowPoint, arrowPoint); // @ts-ignore
186
186
 
187
- encodeRecord.coordinates.splice(1, 0, arrowPoint, arrowPoint);
187
+ layer.arrowInsertCount++;
188
+ }
188
189
  }
189
190
 
190
191
  return encodeRecord;
191
- }); // console.log('mappedData', mappedData)
192
- // 调整数据兼容 Amap2.0
192
+ }); // 调整数据兼容 Amap2.0
193
193
 
194
194
  this.adjustData2Amap2Coordinates(mappedData, layer); // 调整数据兼容 SimpleCoordinates
195
195
 
196
196
  this.adjustData2SimpleCoordinates(mappedData);
197
197
  return mappedData;
198
198
  }
199
+ }, {
200
+ key: "mapLayerMapping",
201
+ value: function mapLayerMapping(layer, attributes, data, predata) {
202
+ var _this4 = this;
203
+
204
+ var usedAttributes = attributes.filter(function (attribute) {
205
+ return attribute.scale !== undefined;
206
+ });
207
+ var mappedData = data.map(function (record, i) {
208
+ var preRecord = predata ? predata[i] : {};
209
+
210
+ var encodeRecord = _objectSpread({
211
+ id: record._id,
212
+ coordinates: record.coordinates
213
+ }, preRecord);
214
+
215
+ usedAttributes.forEach(function (attribute) {
216
+ var _layer$shapeOption;
217
+
218
+ if (attribute.name === 'shape' && // @ts-ignore
219
+ ((_layer$shapeOption = layer.shapeOption) === null || _layer$shapeOption === void 0 ? void 0 : _layer$shapeOption.field) === 'simple') {
220
+ encodeRecord[attribute.name] = 'simple';
221
+ attribute.needRemapping = false;
222
+ } else {
223
+ var values = _this4.applyMapLayerAttributeMapping(attribute, record);
224
+
225
+ attribute.needRemapping = false; // @ts-ignore
226
+
227
+ encodeRecord[attribute.name] = Array.isArray(values) && values.length === 1 ? values[0] : values; // 增加对 layer/text/iconfont unicode 映射的解析
228
+
229
+ if (attribute.name === 'shape') {
230
+ encodeRecord.shape = _this4.fontService.getIconFontKey(encodeRecord[attribute.name]);
231
+ }
232
+ }
233
+ });
234
+
235
+ if (encodeRecord.size === undefined) {
236
+ // in case not set size
237
+ encodeRecord.size = 1;
238
+ }
239
+
240
+ return encodeRecord;
241
+ }); // 调整数据兼容 Amap2.0
242
+
243
+ this.adjustData2Amap2Coordinates(mappedData, layer);
244
+ return mappedData;
245
+ }
199
246
  }, {
200
247
  key: "adjustData2Amap2Coordinates",
201
248
  value: function adjustData2Amap2Coordinates(mappedData, layer) {
202
- var _this4 = this;
249
+ var _this5 = this;
203
250
 
204
251
  // 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
205
252
  if (mappedData.length > 0 && this.mapService.version === Version['GAODE2.x']) {
@@ -218,7 +265,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
218
265
  // @ts-ignore
219
266
  // d.coordinates = this.mapService.lngLatToCoord(d.coordinates);
220
267
 
221
- d.coordinates = _this4.mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
268
+ d.coordinates = _this5.mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
222
269
  });
223
270
  } else {
224
271
  // 连续的线、面数据
@@ -233,35 +280,35 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
233
280
  // @ts-ignore
234
281
  // d.coordinates = this.mapService.lngLatToCoords(d.coordinates);
235
282
 
236
- d.coordinates = _this4.mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
283
+ d.coordinates = _this5.mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
237
284
  });
238
285
  }
239
286
  }
240
287
  }
241
- }, {
242
- key: "getLayerCenter",
243
- value: function getLayerCenter(layer) {
244
- var source = layer.getSource();
245
- return source.center;
246
- }
247
288
  }, {
248
289
  key: "adjustData2SimpleCoordinates",
249
290
  value: function adjustData2SimpleCoordinates(mappedData) {
250
- var _this5 = this;
291
+ var _this6 = this;
251
292
 
252
293
  if (mappedData.length > 0 && this.mapService.version === Version.SIMPLE) {
253
294
  mappedData.map(function (d) {
254
295
  if (!d.simpleCoordinate) {
255
- d.coordinates = _this5.unProjectCoordinates(d.coordinates);
296
+ d.coordinates = _this6.unProjectCoordinates(d.coordinates);
256
297
  d.simpleCoordinate = true;
257
298
  }
258
299
  });
259
300
  }
260
301
  }
302
+ }, {
303
+ key: "getLayerCenter",
304
+ value: function getLayerCenter(layer) {
305
+ var source = layer.getSource();
306
+ return source.center;
307
+ }
261
308
  }, {
262
309
  key: "unProjectCoordinates",
263
310
  value: function unProjectCoordinates(coordinates) {
264
- var _this6 = this;
311
+ var _this7 = this;
265
312
 
266
313
  if (typeof coordinates[0] === 'number') {
267
314
  return this.mapService.simpleMapCoord.unproject(coordinates);
@@ -274,7 +321,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
274
321
  // @ts-ignore
275
322
  var c1 = [];
276
323
  coord.map(function (co) {
277
- c1.push(_this6.mapService.simpleMapCoord.unproject(co));
324
+ c1.push(_this7.mapService.simpleMapCoord.unproject(co));
278
325
  }); // @ts-ignore
279
326
 
280
327
  coords.push(c1);
@@ -286,7 +333,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
286
333
  var _coords = []; // @ts-ignore
287
334
 
288
335
  coordinates.map(function (coord) {
289
- _coords.push(_this6.mapService.simpleMapCoord.unproject(coord));
336
+ _coords.push(_this7.mapService.simpleMapCoord.unproject(coord));
290
337
  }); // @ts-ignore
291
338
 
292
339
  return _coords;
@@ -312,9 +359,7 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
312
359
  // TODO:多字段,常量
313
360
  params.push(record[field]);
314
361
  }
315
- }); // console.log('params', params)
316
- // console.log('attribute', attribute)
317
-
362
+ });
318
363
  var mappingResult = attribute.mapping ? attribute.mapping(params) : [];
319
364
 
320
365
  if (attribute.name === 'color' && !isColor(mappingResult[0])) {
@@ -323,20 +368,46 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfig
323
368
 
324
369
  return mappingResult; // return attribute.mapping ? attribute.mapping(params) : [];
325
370
  }
371
+ }, {
372
+ key: "applyMapLayerAttributeMapping",
373
+ value: function applyMapLayerAttributeMapping(attribute, record) {
374
+ var _attribute$scale3;
375
+
376
+ if (!attribute.scale) {
377
+ return [];
378
+ }
379
+
380
+ var scalers = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale3 = attribute.scale) === null || _attribute$scale3 === void 0 ? void 0 : _attribute$scale3.scalers) || [];
381
+ var params = [];
382
+ scalers.forEach(function (_ref5) {
383
+ var _attribute$scale4;
384
+
385
+ var field = _ref5.field;
386
+
387
+ if (record.hasOwnProperty(field) || ((_attribute$scale4 = attribute.scale) === null || _attribute$scale4 === void 0 ? void 0 : _attribute$scale4.type) === 'variable') {
388
+ params.push(record[field]);
389
+ }
390
+ });
391
+ var mappingResult = attribute.mapping ? attribute.mapping(params) : [];
392
+ return mappingResult;
393
+ }
394
+ }, {
395
+ key: "getArrowPoints",
396
+ value: function getArrowPoints(p1, p2) {
397
+ var dir = [p2[0] - p1[0], p2[1] - p1[1]];
398
+ var normalizeDir = normalize(dir);
399
+ var arrowPoint = [p1[0] + normalizeDir[0] * 0.0001, p1[1] + normalizeDir[1] * 0.0001];
400
+ return arrowPoint;
401
+ }
326
402
  }]);
327
403
 
328
404
  return DataMappingPlugin;
329
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "configService", [_dec2], {
330
- configurable: true,
331
- enumerable: true,
332
- writable: true,
333
- initializer: null
334
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "mapService", [_dec3], {
405
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "mapService", [_dec2], {
335
406
  configurable: true,
336
407
  enumerable: true,
337
408
  writable: true,
338
409
  initializer: null
339
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "fontService", [_dec4], {
410
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "fontService", [_dec3], {
340
411
  configurable: true,
341
412
  enumerable: true,
342
413
  writable: true,
@@ -37,8 +37,7 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
37
37
  source.once('sourceUpdate', function () {
38
38
  _this.updateClusterData(layer);
39
39
  });
40
- } // this.updateClusterData(layer);
41
-
40
+ }
42
41
  }); // 检测数据是否需要更新
43
42
 
44
43
  layer.hooks.beforeRenderData.tap('DataSourcePlugin', function () {
@@ -52,6 +51,8 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
52
51
  }, {
53
52
  key: "updateClusterData",
54
53
  value: function updateClusterData(layer) {
54
+ // Tip: 矢量瓦片不需要进行聚合操作
55
+ if (layer.isTileLayer || layer.tileLayer) return false;
55
56
  var source = layer.getSource();
56
57
  var cluster = source.cluster;
57
58
  var _source$clusterOption = source.clusterOptions.zoom,
@@ -4,8 +4,6 @@ import 'reflect-metadata';
4
4
  * 根据 Source 原始数据为指定字段创建 Scale,保存在 StyleAttribute 上,供下游插件使用
5
5
  */
6
6
  export default class FeatureScalePlugin implements ILayerPlugin {
7
- private readonly configService;
8
- private scaleCache;
9
7
  private scaleOptions;
10
8
  private getSourceData;
11
9
  apply(layer: ILayer, { styleAttributeService, }: {