@antv/l7-layers 2.16.0 → 2.16.2

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 (218) hide show
  1. package/es/core/BaseLayer.d.ts +3 -0
  2. package/es/core/BaseLayer.js +76 -80
  3. package/es/core/BaseModel.d.ts +9 -71
  4. package/es/core/BaseModel.js +75 -357
  5. package/es/core/CommonStyleAttribute.d.ts +2 -0
  6. package/es/core/CommonStyleAttribute.js +66 -0
  7. package/es/core/interface.d.ts +13 -3
  8. package/es/core/shape/extrude.js +18 -6
  9. package/es/core/triangulation.d.ts +12 -0
  10. package/es/core/triangulation.js +70 -0
  11. package/es/heatmap/models/grid.js +1 -1
  12. package/es/heatmap/models/grid3d.js +1 -1
  13. package/es/heatmap/models/heatmap.d.ts +1 -0
  14. package/es/heatmap/models/heatmap.js +17 -13
  15. package/es/heatmap/models/hexagon.js +1 -1
  16. package/es/heatmap/shaders/grid_vert.glsl +2 -2
  17. package/es/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  18. package/es/heatmap/shaders/hexagon_vert.glsl +2 -2
  19. package/es/line/index.d.ts +1 -0
  20. package/es/line/index.js +3 -2
  21. package/es/line/models/arc.js +9 -45
  22. package/es/line/models/arc_3d.js +12 -45
  23. package/es/line/models/earthArc_3d.js +6 -40
  24. package/es/line/models/{half.d.ts → flow.d.ts} +1 -11
  25. package/es/line/models/flow.js +167 -0
  26. package/es/line/models/great_circle.js +4 -38
  27. package/es/line/models/index.d.ts +1 -1
  28. package/es/line/models/index.js +3 -3
  29. package/es/line/models/line.js +7 -41
  30. package/es/line/models/linearline.js +4 -38
  31. package/es/line/models/simpleLine.d.ts +0 -1
  32. package/es/line/models/simpleLine.js +4 -43
  33. package/es/line/shaders/dash/arc_dash_frag.glsl +3 -6
  34. package/es/line/shaders/dash/arc_dash_vert.glsl +6 -46
  35. package/es/line/shaders/dash/line_dash_frag.glsl +4 -7
  36. package/es/line/shaders/dash/line_dash_vert.glsl +3 -33
  37. package/es/line/shaders/flow/flow_line_frag.glsl +13 -0
  38. package/es/line/shaders/flow/flow_line_vert.glsl +83 -0
  39. package/es/line/shaders/line_arc_3d_frag.glsl +6 -6
  40. package/es/line/shaders/line_arc_3d_vert.glsl +4 -34
  41. package/es/line/shaders/line_arc_frag.glsl +7 -11
  42. package/es/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  43. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  44. package/es/line/shaders/line_arc_vert.glsl +9 -45
  45. package/es/line/shaders/line_frag.glsl +15 -17
  46. package/es/line/shaders/line_vert.glsl +3 -34
  47. package/es/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  48. package/es/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  49. package/es/line/shaders/linear/arc_linear_frag.glsl +2 -30
  50. package/es/line/shaders/linear/arc_linear_vert.glsl +9 -45
  51. package/es/line/shaders/linear/line_linear_frag.glsl +5 -6
  52. package/es/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  53. package/es/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  54. package/es/line/shaders/simple/simpleline_frag.glsl +1 -5
  55. package/es/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  56. package/es/line/shaders/simple/simpleline_vert.glsl +7 -33
  57. package/es/plugins/DataMappingPlugin.js +20 -34
  58. package/es/plugins/LayerModelPlugin.js +13 -1
  59. package/es/plugins/ShaderUniformPlugin.js +3 -3
  60. package/es/point/index.d.ts +1 -0
  61. package/es/point/index.js +1 -0
  62. package/es/point/models/earthExtrude.d.ts +0 -3
  63. package/es/point/models/earthExtrude.js +2 -40
  64. package/es/point/models/earthFill.d.ts +0 -1
  65. package/es/point/models/earthFill.js +9 -60
  66. package/es/point/models/extrude.d.ts +0 -3
  67. package/es/point/models/extrude.js +3 -42
  68. package/es/point/models/fill.d.ts +0 -1
  69. package/es/point/models/fill.js +15 -76
  70. package/es/point/models/fillmage.js +6 -43
  71. package/es/point/models/image.js +7 -41
  72. package/es/point/models/normal.js +2 -2
  73. package/es/point/models/radar.d.ts +0 -1
  74. package/es/point/models/radar.js +4 -13
  75. package/es/point/models/simplePoint.d.ts +0 -1
  76. package/es/point/models/simplePoint.js +8 -49
  77. package/es/point/models/text.js +17 -47
  78. package/es/point/shaders/animate/wave_frag.glsl +1 -11
  79. package/es/point/shaders/earth/extrude_frag.glsl +5 -17
  80. package/es/point/shaders/earth/extrude_vert.glsl +14 -29
  81. package/es/point/shaders/earth/fill_frag.glsl +5 -14
  82. package/es/point/shaders/earth/fill_vert.glsl +1 -75
  83. package/es/point/shaders/extrude/extrude_frag.glsl +3 -29
  84. package/es/point/shaders/extrude/extrude_vert.glsl +27 -35
  85. package/es/point/shaders/fill_frag.glsl +9 -20
  86. package/es/point/shaders/fill_vert.glsl +16 -101
  87. package/es/point/shaders/image/fillImage_frag.glsl +2 -5
  88. package/es/point/shaders/image/fillImage_vert.glsl +4 -47
  89. package/es/point/shaders/image_frag.glsl +1 -5
  90. package/es/point/shaders/image_vert.glsl +1 -44
  91. package/es/point/shaders/normal_frag.glsl +0 -2
  92. package/es/point/shaders/normal_vert.glsl +2 -1
  93. package/es/point/shaders/radar/radar_vert.glsl +2 -2
  94. package/es/point/shaders/simplePoint_frag.glsl +0 -7
  95. package/es/point/shaders/simplePoint_vert.glsl +3 -45
  96. package/es/point/shaders/text_frag.glsl +6 -19
  97. package/es/point/shaders/text_vert.glsl +5 -66
  98. package/es/polygon/index.d.ts +1 -0
  99. package/es/polygon/index.js +1 -0
  100. package/es/polygon/models/extrude.d.ts +0 -3
  101. package/es/polygon/models/extrude.js +86 -82
  102. package/es/polygon/models/fill.d.ts +0 -4
  103. package/es/polygon/models/fill.js +8 -47
  104. package/es/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  105. package/es/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  106. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  107. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  108. package/es/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  109. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  110. package/es/polygon/shaders/polygon_frag.glsl +0 -5
  111. package/es/polygon/shaders/polygon_linear_frag.glsl +0 -8
  112. package/es/polygon/shaders/polygon_linear_vert.glsl +0 -32
  113. package/es/polygon/shaders/polygon_vert.glsl +1 -27
  114. package/es/utils/layerData.js +2 -2
  115. package/lib/core/BaseLayer.js +74 -78
  116. package/lib/core/BaseModel.js +74 -356
  117. package/lib/core/CommonStyleAttribute.js +72 -0
  118. package/lib/core/shape/extrude.js +18 -6
  119. package/lib/core/triangulation.js +72 -0
  120. package/lib/heatmap/models/grid.js +1 -1
  121. package/lib/heatmap/models/grid3d.js +1 -1
  122. package/lib/heatmap/models/heatmap.js +17 -13
  123. package/lib/heatmap/models/hexagon.js +1 -1
  124. package/lib/heatmap/shaders/grid_vert.glsl +2 -2
  125. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +2 -2
  126. package/lib/heatmap/shaders/hexagon_vert.glsl +2 -2
  127. package/lib/line/index.js +3 -2
  128. package/lib/line/models/arc.js +9 -45
  129. package/lib/line/models/arc_3d.js +12 -45
  130. package/lib/line/models/earthArc_3d.js +6 -40
  131. package/lib/line/models/flow.js +174 -0
  132. package/lib/line/models/great_circle.js +4 -38
  133. package/lib/line/models/index.js +3 -3
  134. package/lib/line/models/line.js +7 -41
  135. package/lib/line/models/linearline.js +4 -38
  136. package/lib/line/models/simpleLine.js +4 -43
  137. package/lib/line/shaders/dash/arc_dash_frag.glsl +3 -6
  138. package/lib/line/shaders/dash/arc_dash_vert.glsl +6 -46
  139. package/lib/line/shaders/dash/line_dash_frag.glsl +4 -7
  140. package/lib/line/shaders/dash/line_dash_vert.glsl +3 -33
  141. package/lib/line/shaders/flow/flow_line_frag.glsl +13 -0
  142. package/lib/line/shaders/flow/flow_line_vert.glsl +83 -0
  143. package/lib/line/shaders/line_arc_3d_frag.glsl +6 -6
  144. package/lib/line/shaders/line_arc_3d_vert.glsl +4 -34
  145. package/lib/line/shaders/line_arc_frag.glsl +7 -11
  146. package/lib/line/shaders/line_arc_great_circle_frag.glsl +5 -6
  147. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -32
  148. package/lib/line/shaders/line_arc_vert.glsl +9 -45
  149. package/lib/line/shaders/line_frag.glsl +15 -17
  150. package/lib/line/shaders/line_vert.glsl +3 -34
  151. package/lib/line/shaders/linear/arc3d_linear_frag.glsl +5 -19
  152. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +9 -48
  153. package/lib/line/shaders/linear/arc_linear_frag.glsl +2 -30
  154. package/lib/line/shaders/linear/arc_linear_vert.glsl +9 -45
  155. package/lib/line/shaders/linear/line_linear_frag.glsl +5 -6
  156. package/lib/line/shaders/linearLine/line_linear_frag.glsl +2 -14
  157. package/lib/line/shaders/linearLine/line_linear_vert.glsl +14 -32
  158. package/lib/line/shaders/simple/simpleline_frag.glsl +1 -5
  159. package/lib/line/shaders/simple/simpleline_linear_frag.glsl +2 -6
  160. package/lib/line/shaders/simple/simpleline_vert.glsl +7 -33
  161. package/lib/plugins/DataMappingPlugin.js +20 -34
  162. package/lib/plugins/LayerModelPlugin.js +13 -1
  163. package/lib/plugins/ShaderUniformPlugin.js +3 -3
  164. package/lib/point/index.js +1 -0
  165. package/lib/point/models/earthExtrude.js +2 -40
  166. package/lib/point/models/earthFill.js +9 -60
  167. package/lib/point/models/extrude.js +3 -42
  168. package/lib/point/models/fill.js +15 -76
  169. package/lib/point/models/fillmage.js +6 -43
  170. package/lib/point/models/image.js +7 -41
  171. package/lib/point/models/normal.js +2 -2
  172. package/lib/point/models/radar.js +4 -13
  173. package/lib/point/models/simplePoint.js +8 -49
  174. package/lib/point/models/text.js +15 -45
  175. package/lib/point/shaders/animate/wave_frag.glsl +1 -11
  176. package/lib/point/shaders/earth/extrude_frag.glsl +5 -17
  177. package/lib/point/shaders/earth/extrude_vert.glsl +14 -29
  178. package/lib/point/shaders/earth/fill_frag.glsl +5 -14
  179. package/lib/point/shaders/earth/fill_vert.glsl +1 -75
  180. package/lib/point/shaders/extrude/extrude_frag.glsl +3 -29
  181. package/lib/point/shaders/extrude/extrude_vert.glsl +27 -35
  182. package/lib/point/shaders/fill_frag.glsl +9 -20
  183. package/lib/point/shaders/fill_vert.glsl +16 -101
  184. package/lib/point/shaders/image/fillImage_frag.glsl +2 -5
  185. package/lib/point/shaders/image/fillImage_vert.glsl +4 -47
  186. package/lib/point/shaders/image_frag.glsl +1 -5
  187. package/lib/point/shaders/image_vert.glsl +1 -44
  188. package/lib/point/shaders/normal_frag.glsl +0 -2
  189. package/lib/point/shaders/normal_vert.glsl +2 -1
  190. package/lib/point/shaders/radar/radar_vert.glsl +2 -2
  191. package/lib/point/shaders/simplePoint_frag.glsl +0 -7
  192. package/lib/point/shaders/simplePoint_vert.glsl +3 -45
  193. package/lib/point/shaders/text_frag.glsl +6 -19
  194. package/lib/point/shaders/text_vert.glsl +5 -66
  195. package/lib/polygon/index.js +1 -0
  196. package/lib/polygon/models/extrude.js +86 -82
  197. package/lib/polygon/models/fill.js +8 -47
  198. package/lib/polygon/shaders/extrude/polygon_extrude_frag.glsl +2 -23
  199. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl +7 -5
  200. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +7 -32
  201. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +33 -38
  202. package/lib/polygon/shaders/extrude/polygon_extrudetex_frag.glsl +12 -9
  203. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +16 -44
  204. package/lib/polygon/shaders/polygon_frag.glsl +0 -5
  205. package/lib/polygon/shaders/polygon_linear_frag.glsl +0 -8
  206. package/lib/polygon/shaders/polygon_linear_vert.glsl +0 -32
  207. package/lib/polygon/shaders/polygon_vert.glsl +1 -27
  208. package/lib/utils/layerData.js +2 -2
  209. package/package.json +7 -7
  210. package/es/line/models/half.js +0 -267
  211. package/es/line/shaders/half/line_half_frag.glsl +0 -53
  212. package/es/line/shaders/half/line_half_vert.glsl +0 -169
  213. package/es/utils/dataMappingStyle.d.ts +0 -31
  214. package/es/utils/dataMappingStyle.js +0 -137
  215. package/lib/line/models/half.js +0 -274
  216. package/lib/line/shaders/half/line_half_frag.glsl +0 -53
  217. package/lib/line/shaders/half/line_half_vert.glsl +0 -169
  218. package/lib/utils/dataMappingStyle.js +0 -140
@@ -26,13 +26,12 @@ var _l7Utils = require("@antv/l7-utils");
26
26
  var _eventemitter = require("eventemitter3");
27
27
  var _lodash = require("lodash");
28
28
  var _blend = require("../utils/blend");
29
- var _dataMappingStyle = require("../utils/dataMappingStyle");
30
29
  var _layerData = require("../utils/layerData");
31
30
  var _multiPassRender = require("../utils/multiPassRender");
32
31
  var _LayerPickService = _interopRequireDefault(require("./LayerPickService"));
33
32
  var _TextureService = _interopRequireDefault(require("./TextureService"));
34
33
  var _excluded = ["passes"],
35
- _excluded2 = ["moduleName", "vertexShader", "fragmentShader", "triangulation", "segmentNumber", "workerEnabled", "workerOptions"];
34
+ _excluded2 = ["moduleName", "vertexShader", "fragmentShader", "inject", "triangulation", "segmentNumber"];
36
35
  var _dec, _class, _descriptor;
37
36
  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; } } }; }
38
37
  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); }
@@ -113,6 +112,8 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
113
112
  enable: false
114
113
  });
115
114
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "currentPickId", null);
115
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "encodeStyleAttribute", {});
116
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enableEncodeStyles", []);
116
117
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "pendingStyleAttributes", []);
117
118
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scaleOptions", {});
118
119
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "animateStatus", false);
@@ -132,7 +133,6 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
132
133
  _this.name = config.name || _this.id;
133
134
  _this.zIndex = config.zIndex || 0;
134
135
  _this.rawConfig = config;
135
- // this.parent = this;
136
136
  return _this;
137
137
  }
138
138
  (0, _createClass2.default)(BaseLayer, [{
@@ -205,7 +205,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
205
205
  } else {
206
206
  var sceneId = this.container.get(_l7Core.TYPES.SceneID);
207
207
  // @ts-ignore
208
- (0, _dataMappingStyle.styleDataMapping)(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
208
+ // styleDataMapping(configToUpdate, this); // 处理 style 中进行数据映射的属性字段
209
209
  this.configService.setLayerConfig(sceneId, this.id, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.configService.getLayerConfig(this.id)), this.needUpdateConfig), configToUpdate));
210
210
  this.needUpdateConfig = {};
211
211
  }
@@ -428,7 +428,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
428
428
  }, {
429
429
  key: "prepareBuildModel",
430
430
  value: function prepareBuildModel() {
431
- this.updateLayerConfig((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.getDefaultConfig()), this.rawConfig), this.needUpdateConfig));
431
+ if (Object.keys(this.needUpdateConfig || {}).length !== 0) {
432
+ this.updateLayerConfig({});
433
+ }
432
434
 
433
435
  // 启动动画
434
436
  var _this$getLayerConfig2 = this.getLayerConfig(),
@@ -565,21 +567,32 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
565
567
  }
566
568
  });
567
569
  }
568
- this.rawConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, this.rawConfig), rest);
569
- if (this.container) {
570
- this.updateLayerConfig(this.rawConfig);
571
- this.styleNeedUpdate = true;
572
- }
573
- // TODO style model 更新
574
- // @ts-ignore
575
- // if (lastConfig && lastConfig.mask === true && options.mask === false) {
576
- // this.clearModels();
577
- // this.layerModel.buildModels((models) => {
578
- // this.models = models;
579
- // });
580
- // }
570
+ this.encodeStyle(rest);
571
+ this.updateLayerConfig(rest);
581
572
  return this;
582
573
  }
574
+
575
+ // 参与数据映射的字段 encodeing
576
+ }, {
577
+ key: "encodeStyle",
578
+ value: function encodeStyle(options) {
579
+ var _this6 = this;
580
+ Object.keys(options).forEach(function (key) {
581
+ if (
582
+ // 需要数据映射
583
+ _this6.enableEncodeStyles.includes(key) && (0, _lodash.isPlainObject)(options[key]) && (options[key].field || options[key].values) && !(0, _lodash.isEqual)(_this6.encodeStyleAttribute[key], options[key]) // 防止计算属性重复计算
584
+ ) {
585
+ _this6.encodeStyleAttribute[key] = options[key];
586
+ _this6.updateStyleAttribute(key, options[key].field, options[key].values);
587
+ _this6.styleNeedUpdate = true;
588
+ } else {
589
+ // 不需要数据映射
590
+ if (_this6.encodeStyleAttribute[key]) {
591
+ delete _this6.encodeStyleAttribute[key]; // 删除已经存在的属性
592
+ }
593
+ }
594
+ });
595
+ }
583
596
  }, {
584
597
  key: "scale",
585
598
  value: function scale(field, cfg) {
@@ -689,7 +702,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
689
702
  }, {
690
703
  key: "setActive",
691
704
  value: function setActive(id, options) {
692
- var _this6 = this;
705
+ var _this7 = this;
693
706
  if ((0, _lodash.isObject)(id)) {
694
707
  var _id$x = id.x,
695
708
  x = _id$x === void 0 ? 0 : _id$x,
@@ -713,7 +726,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
713
726
  // @ts-ignore
714
727
  .then(function () {
715
728
  setTimeout(function () {
716
- _this6.reRender();
729
+ _this7.reRender();
717
730
  }, 1);
718
731
  });
719
732
  }
@@ -740,7 +753,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
740
753
  }, {
741
754
  key: "setSelect",
742
755
  value: function setSelect(id, options) {
743
- var _this7 = this;
756
+ var _this8 = this;
744
757
  if ((0, _lodash.isObject)(id)) {
745
758
  var _id$x2 = id.x,
746
759
  x = _id$x2 === void 0 ? 0 : _id$x2,
@@ -764,7 +777,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
764
777
  // @ts-ignore
765
778
  .then(function () {
766
779
  setTimeout(function () {
767
- _this7.reRender();
780
+ _this8.reRender();
768
781
  }, 1);
769
782
  });
770
783
  }
@@ -1015,7 +1028,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1015
1028
  }, {
1016
1029
  key: "setSource",
1017
1030
  value: function setSource(source) {
1018
- var _this8 = this;
1031
+ var _this9 = this;
1019
1032
  // 解除原 sources 事件
1020
1033
  if (this.layerSource) {
1021
1034
  this.layerSource.off('update', this.sourceEvent);
@@ -1034,22 +1047,22 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1034
1047
  // this.layerSource.inited 为 true update 事件不会再触发
1035
1048
  this.layerSource.on('update', function (_ref4) {
1036
1049
  var type = _ref4.type;
1037
- if (_this8.coordCenter === undefined) {
1038
- var _this8$mapService;
1039
- var layerCenter = _this8.layerSource.center;
1040
- _this8.coordCenter = layerCenter;
1041
- if ((_this8$mapService = _this8.mapService) !== null && _this8$mapService !== void 0 && _this8$mapService.setCoordCenter) {
1042
- _this8.mapService.setCoordCenter(layerCenter);
1050
+ if (_this9.coordCenter === undefined) {
1051
+ var _this9$mapService;
1052
+ var layerCenter = _this9.layerSource.center;
1053
+ _this9.coordCenter = layerCenter;
1054
+ if ((_this9$mapService = _this9.mapService) !== null && _this9$mapService !== void 0 && _this9$mapService.setCoordCenter) {
1055
+ _this9.mapService.setCoordCenter(layerCenter);
1043
1056
  }
1044
1057
  }
1045
1058
  if (type === 'update') {
1046
- if (_this8.tileLayer) {
1059
+ if (_this9.tileLayer) {
1047
1060
  // 瓦片图层独立更新
1048
- _this8.tileLayer.reload();
1061
+ _this9.tileLayer.reload();
1049
1062
  return;
1050
1063
  }
1051
1064
  // source 初始化不需要处理
1052
- _this8.sourceEvent();
1065
+ _this9.sourceEvent();
1053
1066
  }
1054
1067
  });
1055
1068
  }
@@ -1147,56 +1160,38 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1147
1160
  key: "buildLayerModel",
1148
1161
  value: function () {
1149
1162
  var _buildLayerModel = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(options) {
1150
- var _this9 = this;
1151
- var moduleName, vertexShader, fragmentShader, triangulation, segmentNumber, _options$workerEnable, workerEnabled, workerOptions, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
1163
+ var _this10 = this;
1164
+ var moduleName, vertexShader, fragmentShader, inject, triangulation, segmentNumber, rest, _this$shaderModuleSer, vs, fs, uniforms, createModel;
1152
1165
  return _regenerator.default.wrap(function _callee3$(_context3) {
1153
1166
  while (1) switch (_context3.prev = _context3.next) {
1154
1167
  case 0:
1155
- moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, triangulation = options.triangulation, segmentNumber = options.segmentNumber, _options$workerEnable = options.workerEnabled, workerEnabled = _options$workerEnable === void 0 ? false : _options$workerEnable, workerOptions = options.workerOptions, rest = (0, _objectWithoutProperties2.default)(options, _excluded2);
1168
+ moduleName = options.moduleName, vertexShader = options.vertexShader, fragmentShader = options.fragmentShader, inject = options.inject, triangulation = options.triangulation, segmentNumber = options.segmentNumber, rest = (0, _objectWithoutProperties2.default)(options, _excluded2);
1156
1169
  this.shaderModuleService.registerModule(moduleName, {
1157
1170
  vs: vertexShader,
1158
- fs: fragmentShader
1171
+ fs: fragmentShader,
1172
+ inject: inject
1159
1173
  });
1160
1174
  _this$shaderModuleSer = this.shaderModuleService.getModule(moduleName), vs = _this$shaderModuleSer.vs, fs = _this$shaderModuleSer.fs, uniforms = _this$shaderModuleSer.uniforms;
1161
1175
  createModel = this.rendererService.createModel;
1162
- return _context3.abrupt("return", new Promise(function (resolve, reject) {
1163
- // filter supported worker & worker enabled layer
1164
- if (workerOptions && workerOptions.modelType in _l7Utils.WorkerSourceMap && workerEnabled) {
1165
- _this9.styleAttributeService.createAttributesAndIndicesAscy(_this9.encodedData, segmentNumber, workerOptions).then(function (_ref9) {
1166
- var attributes = _ref9.attributes,
1167
- elements = _ref9.elements;
1168
- var m = createModel((0, _objectSpread2.default)({
1169
- attributes: attributes,
1170
- uniforms: uniforms,
1171
- fs: fs,
1172
- vs: vs,
1173
- elements: elements,
1174
- blend: _blend.BlendTypes[_l7Core.BlendType.normal]
1175
- }, rest));
1176
- resolve(m);
1177
- }).catch(function (err) {
1178
- return reject(err);
1179
- });
1180
- } else {
1181
- // console.log(this.encodedData)
1182
- var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
1183
- attributes = _this9$styleAttribute.attributes,
1184
- elements = _this9$styleAttribute.elements,
1185
- count = _this9$styleAttribute.count;
1186
- var modelOptions = (0, _objectSpread2.default)({
1187
- attributes: attributes,
1188
- uniforms: uniforms,
1189
- fs: fs,
1190
- vs: vs,
1191
- elements: elements,
1192
- blend: _blend.BlendTypes[_l7Core.BlendType.normal]
1193
- }, rest);
1194
- if (count) {
1195
- modelOptions.count = count;
1196
- }
1197
- var m = createModel(modelOptions);
1198
- resolve(m);
1176
+ return _context3.abrupt("return", new Promise(function (resolve) {
1177
+ // console.log(this.encodedData)
1178
+ var _this10$styleAttribut = _this10.styleAttributeService.createAttributesAndIndices(_this10.encodedData, triangulation, segmentNumber),
1179
+ attributes = _this10$styleAttribut.attributes,
1180
+ elements = _this10$styleAttribut.elements,
1181
+ count = _this10$styleAttribut.count;
1182
+ var modelOptions = (0, _objectSpread2.default)({
1183
+ attributes: attributes,
1184
+ uniforms: uniforms,
1185
+ fs: fs,
1186
+ vs: vs,
1187
+ elements: elements,
1188
+ blend: _blend.BlendTypes[_l7Core.BlendType.normal]
1189
+ }, rest);
1190
+ if (count) {
1191
+ modelOptions.count = count;
1199
1192
  }
1193
+ var m = createModel(modelOptions);
1194
+ resolve(m);
1200
1195
  }));
1201
1196
  case 5:
1202
1197
  case "end":
@@ -1326,7 +1321,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1326
1321
  }, {
1327
1322
  key: "renderModels",
1328
1323
  value: function renderModels() {
1329
- var _this10 = this;
1324
+ var _this11 = this;
1330
1325
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1331
1326
  // TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
1332
1327
  if (this.encodeDataLength <= 0 && !this.forceRender) {
@@ -1337,9 +1332,9 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1337
1332
  this.hooks.beforeRender.call();
1338
1333
  this.models.forEach(function (model) {
1339
1334
  model.draw({
1340
- uniforms: _this10.layerModel.getUninforms(),
1341
- blend: _this10.layerModel.getBlend(),
1342
- stencil: _this10.layerModel.getStencil(options)
1335
+ uniforms: _this11.layerModel.getUninforms(),
1336
+ blend: _this11.layerModel.getBlend(),
1337
+ stencil: _this11.layerModel.getStencil(options)
1343
1338
  }, (options === null || options === void 0 ? void 0 : options.ispick) || false);
1344
1339
  });
1345
1340
  this.hooks.afterRender.call();
@@ -1355,10 +1350,11 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
1355
1350
  field: field,
1356
1351
  values: values
1357
1352
  })) {
1353
+ // 检测是否发生更新
1358
1354
  return false;
1359
1355
  }
1360
1356
 
1361
- // 存储 Attribute
1357
+ // 存储 Attribute 瓦片图层使用
1362
1358
  if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
1363
1359
  this.configService.setAttributeConfig(this.id, (0, _defineProperty2.default)({}, type, {
1364
1360
  field: field,