@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
@@ -8,7 +8,6 @@ exports.default = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
11
  var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
13
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
14
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -17,29 +16,20 @@ var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/
17
16
  var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
18
17
  var _l7Core = require("@antv/l7-core");
19
18
  var _l7Utils = require("@antv/l7-utils");
20
- var _d3Color = require("d3-color");
21
- var _lodash = require("lodash");
22
19
  var _blend = require("../utils/blend");
23
20
  var _stencil = require("../utils/stencil");
21
+ var _CommonStyleAttribute = require("./CommonStyleAttribute");
24
22
  var _dec, _class, _descriptor;
25
- 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; } } }; }
26
- 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); }
27
- 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; }
28
23
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
24
  var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
30
25
  // style texture data mapping
31
26
 
32
- // 用于数据传递的数据纹理
33
- // 默认有多少列(宽度)
34
- // 计算得到的当前数据纹理有多少行(高度)
35
-
36
- // 单个 cell 的长度
37
- // 需要进行数据映射的属性集合
38
-
39
27
  // style texture data mapping
40
28
 
41
29
  function BaseModel(layer) {
42
30
  (0, _classCallCheck2.default)(this, BaseModel);
31
+ (0, _defineProperty2.default)(this, "preStyleAttribute", {});
32
+ (0, _defineProperty2.default)(this, "encodeStyleAttribute", {});
43
33
  (0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
44
34
  this.layer = layer;
45
35
  this.rendererService = layer.getContainer().get(_l7Core.TYPES.IRendererService);
@@ -51,360 +41,19 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
51
41
  this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
52
42
  this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
53
43
  this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService);
44
+ // 初始化支持数据映射的 Style 属性
54
45
 
46
+ this.registerStyleAttribute();
55
47
  // 注册 Attribute
56
48
  this.registerBuiltinAttributes();
57
49
  // 开启动画
58
50
  this.startModelAnimate();
59
51
  var createTexture2D = this.rendererService.createTexture2D;
60
52
  this.createTexture2D = createTexture2D;
61
- this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
62
- this.rowCount = 1;
63
- this.cellLength = 0;
64
- this.cellProperties = [];
65
- this.cacheStyleProperties = {
66
- thetaOffset: undefined,
67
- opacity: undefined,
68
- strokeOpacity: undefined,
69
- strokeWidth: undefined,
70
- stroke: undefined,
71
- offsets: undefined
72
- };
73
- this.stylePropertiesExist = {
74
- hasThetaOffset: 0,
75
- hasOpacity: 0,
76
- hasStrokeOpacity: 0,
77
- hasStrokeWidth: 0,
78
- hasStroke: 0,
79
- hasOffsets: 0
80
- };
81
- this.dataTextureTest = this.layerService.getOESTextureFloat();
82
- // 只有在不支持数据纹理的情况下进行赋值
83
- if (!this.dataTextureTest) {
84
- this.dataTexture = this.createTexture2D({
85
- // data: new Uint8ClampedArray(4),
86
- // 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现
87
- // Uint8ClampedArray 和 Uint8Array 没有实质性的区别
88
- data: new Uint8Array(4),
89
- mag: _l7Core.gl.NEAREST,
90
- min: _l7Core.gl.NEAREST,
91
- width: 1,
92
- height: 1
93
- });
94
- }
95
53
  }
96
54
 
97
55
  // style datatexture mapping
98
-
99
- /**
100
- * 清除上一次的计算结果 - 全量清除
101
- */
102
56
  (0, _createClass2.default)(BaseModel, [{
103
- key: "clearLastCalRes",
104
- value: function clearLastCalRes() {
105
- this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
106
- this.cellLength = 0; // 清空上一次计算的 cell 的长度
107
- this.stylePropertiesExist = {
108
- // 全量清空上一次是否需要对 style 属性进行数据映射的判断
109
- hasThetaOffset: 0,
110
- hasOpacity: 0,
111
- hasStrokeOpacity: 0,
112
- hasStrokeWidth: 0,
113
- hasStroke: 0,
114
- hasOffsets: 0
115
- };
116
- }
117
- }, {
118
- key: "getCellTypeLayout",
119
- value: function getCellTypeLayout() {
120
- if (this.dataTextureTest) {
121
- return [
122
- // 0
123
- this.rowCount,
124
- // 数据纹理有几行
125
- this.DATA_TEXTURE_WIDTH,
126
- // 数据纹理有几列
127
- 0.0, 0.0,
128
- // 1
129
- this.stylePropertiesExist.hasOpacity,
130
- // cell 中是否存在 opacity
131
- this.stylePropertiesExist.hasStrokeOpacity,
132
- // cell 中是否存在 strokeOpacity
133
- this.stylePropertiesExist.hasStrokeWidth,
134
- // cell 中是否存在 strokeWidth
135
- this.stylePropertiesExist.hasStroke,
136
- // cell 中是否存在 stroke
137
- // 2
138
- this.stylePropertiesExist.hasOffsets,
139
- // cell 中是否存在 offsets
140
- this.stylePropertiesExist.hasThetaOffset,
141
- // cell 中是否存在 thetaOffset
142
- 0.0, 0.0,
143
- // 3
144
- 0.0, 0.0, 0.0, 1.0];
145
- } else {
146
- return [1.0,
147
- // 数据纹理有几行
148
- 1.0,
149
- // 数据纹理有几列
150
- 0.0, 0.0, 0.0,
151
- // cell 中是否存在 opacity
152
- 0.0,
153
- // cell 中是否存在 strokeOpacity
154
- 0.0,
155
- // cell 中是否存在 strokeWidth
156
- 0.0,
157
- // cell 中是否存在 stroke
158
- 0.0,
159
- // cell 中是否存在 offsets
160
- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
161
- }
162
- }
163
-
164
- /**
165
- * 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
166
- * @param options
167
- * @returns
168
- */
169
- }, {
170
- key: "dataTextureNeedUpdate",
171
- value: function dataTextureNeedUpdate(options) {
172
- var isUpdate = false;
173
- if (!(0, _lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
174
- isUpdate = true;
175
- this.cacheStyleProperties.thetaOffset = options.thetaOffset;
176
- }
177
- if (!(0, _lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
178
- isUpdate = true;
179
- this.cacheStyleProperties.opacity = options.opacity;
180
- }
181
- if (!(0, _lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
182
- isUpdate = true;
183
- this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
184
- }
185
- if (!(0, _lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
186
- isUpdate = true;
187
- this.cacheStyleProperties.strokeWidth = options.strokeWidth;
188
- }
189
- if (!(0, _lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
190
- isUpdate = true;
191
- this.cacheStyleProperties.stroke = options.stroke;
192
- }
193
- if (!(0, _lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
194
- isUpdate = true;
195
- this.cacheStyleProperties.offsets = options.offsets;
196
- }
197
- if (this.dataTexture === undefined) {
198
- isUpdate = true;
199
- }
200
- return isUpdate;
201
- }
202
- /**
203
- * 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
204
- * @param options
205
- */
206
- }, {
207
- key: "judgeStyleAttributes",
208
- value: function judgeStyleAttributes(options) {
209
- this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除
210
-
211
- if (options.opacity !== undefined && !(0, _lodash.isNumber)(options.opacity)) {
212
- // 数据映射
213
- this.cellProperties.push({
214
- attr: 'opacity',
215
- count: 1
216
- });
217
- this.stylePropertiesExist.hasOpacity = 1;
218
- this.cellLength += 1;
219
- }
220
- if (options.strokeOpacity !== undefined && !(0, _lodash.isNumber)(options.strokeOpacity)) {
221
- // 数据映射
222
- this.cellProperties.push({
223
- attr: 'strokeOpacity',
224
- count: 1
225
- });
226
- this.stylePropertiesExist.hasStrokeOpacity = 1;
227
- this.cellLength += 1;
228
- }
229
- if (options.strokeWidth !== undefined && !(0, _lodash.isNumber)(options.strokeWidth)) {
230
- // 数据映射
231
- this.cellProperties.push({
232
- attr: 'strokeWidth',
233
- count: 1
234
- });
235
- this.stylePropertiesExist.hasStrokeWidth = 1;
236
- this.cellLength += 1;
237
- }
238
- if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
239
- // 数据映射
240
- this.cellProperties.push({
241
- attr: 'stroke',
242
- count: 4
243
- });
244
- this.stylePropertiesExist.hasStroke = 1;
245
- this.cellLength += 4;
246
- }
247
- if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
248
- // 数据映射
249
- this.cellProperties.push({
250
- attr: 'offsets',
251
- count: 2
252
- });
253
- this.stylePropertiesExist.hasOffsets = 1;
254
- this.cellLength += 2;
255
- }
256
- if (options.thetaOffset !== undefined && !(0, _lodash.isNumber)(options.thetaOffset)) {
257
- // 数据映射
258
- this.cellProperties.push({
259
- attr: 'thetaOffset',
260
- count: 1
261
- });
262
- this.stylePropertiesExist.hasThetaOffset = 1;
263
- this.cellLength += 1;
264
- }
265
- }
266
-
267
- /**
268
- * 判断变量 stroke 是否是常量值
269
- * @param stroke
270
- * @returns
271
- */
272
- }, {
273
- key: "isStaticColor",
274
- value: function isStaticColor(stroke) {
275
- if ((0, _lodash.isString)(stroke)) {
276
- if ((0, _d3Color.color)(stroke)) {
277
- return true;
278
- } else {
279
- return false;
280
- }
281
- }
282
- return false;
283
- }
284
- /**
285
- * 获取 stroke 颜色并做兼容处理
286
- * @param stroke
287
- * @returns
288
- */
289
- }, {
290
- key: "getStrokeColor",
291
- value: function getStrokeColor(stroke) {
292
- if (this.isStaticColor(stroke)) {
293
- var strokeColor = (0, _l7Utils.rgb2arr)(stroke);
294
- strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
295
- strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
296
- strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
297
- strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
298
- return strokeColor;
299
- } else {
300
- return [0, 0, 0, 0];
301
- }
302
- }
303
-
304
- /**
305
- * 判断 offsets 是否是常量
306
- * @param offsets
307
- * @returns
308
- */
309
- }, {
310
- key: "isOffsetStatic",
311
- value: function isOffsetStatic(offsets) {
312
- if (Array.isArray(offsets) && offsets.length === 2 && (0, _lodash.isNumber)(offsets[0]) && (0, _lodash.isNumber)(offsets[1])) {
313
- return true;
314
- } else {
315
- return false;
316
- }
317
- }
318
-
319
- /**
320
- * 补空位
321
- * @param d
322
- * @param count
323
- */
324
- }, {
325
- key: "patchMod",
326
- value: function patchMod(d, count) {
327
- for (var i = 0; i < count; i++) {
328
- d.push(-1);
329
- }
330
- }
331
-
332
- /**
333
- * 根据映射的数据字段往推入数据
334
- * @param d
335
- * @param cellData
336
- * @param cellPropertiesLayouts
337
- */
338
- }, {
339
- key: "patchData",
340
- value: function patchData(d, cellData, cellPropertiesLayouts) {
341
- var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
342
- _step;
343
- try {
344
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
345
- var layout = _step.value;
346
- var attr = layout.attr,
347
- count = layout.count;
348
- var value = cellData[attr];
349
- if (value !== undefined) {
350
- // 数据中存在该属性
351
- if (attr === 'stroke') {
352
- d.push.apply(d, (0, _toConsumableArray2.default)((0, _l7Utils.rgb2arr)(value)));
353
- } else if (attr === 'offsets') {
354
- if (this.isOffsetStatic(value)) {
355
- d.push(-value[0], value[1]);
356
- } else {
357
- d.push(0, 0);
358
- }
359
- } else {
360
- d.push((0, _lodash.isNumber)(value) ? value : 1.0);
361
- }
362
- } else {
363
- // 若不存在时则补位
364
- this.patchMod(d, count);
365
- }
366
- }
367
- } catch (err) {
368
- _iterator.e(err);
369
- } finally {
370
- _iterator.f();
371
- }
372
- }
373
-
374
- /**
375
- * 计算推入数据纹理的数据
376
- * @param cellLength
377
- * @param encodeData
378
- * @param cellPropertiesLayouts
379
- * @returns
380
- */
381
- }, {
382
- key: "calDataFrame",
383
- value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
384
- var encodeDatalength = encodeData.length;
385
- var rowCount = Math.ceil(encodeDatalength * cellLength / this.DATA_TEXTURE_WIDTH); // 有多少行
386
-
387
- var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
388
- var d = [];
389
- for (var i = 0; i < encodeDatalength; i++) {
390
- // 根据 encodeData 数据推入数据
391
- var cellData = encodeData[i];
392
- this.patchData(d, cellData, cellPropertiesLayouts);
393
- }
394
- for (var _i = d.length; _i < totalLength; _i++) {
395
- // 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
396
- d.push(-1);
397
- }
398
- // console.log('data', d)
399
- return {
400
- data: d,
401
- width: this.DATA_TEXTURE_WIDTH,
402
- height: rowCount
403
- };
404
- }
405
-
406
- // style datatexture mapping
407
- }, {
408
57
  key: "getBlend",
409
58
  value: function getBlend() {
410
59
  var _this$layer$getLayerC = this.layer.getLayerConfig(),
@@ -553,6 +202,75 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
553
202
  this.layer.setAnimateStartTime();
554
203
  }
555
204
  }
205
+ }, {
206
+ key: "getInject",
207
+ value: function getInject() {
208
+ var encodeStyleAttribute = this.layer.encodeStyleAttribute;
209
+ var str = '';
210
+ var attrType = {
211
+ opacity: 'float',
212
+ stroke: 'vec4',
213
+ offsets: 'vec2',
214
+ textOffset: 'vec2'
215
+ };
216
+ this.layer.enableEncodeStyles.forEach(function (key) {
217
+ if (encodeStyleAttribute[key]) {
218
+ str += "#define USE_ATTRIBUTE_".concat(key.toUpperCase(), " 0.0; \n\n");
219
+ }
220
+ str += "\n #ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n attribute ").concat(attrType[key], " a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n uniform ").concat(attrType[key], " u_").concat(key, ";\n#endif\n\n");
221
+ });
222
+ var innerStr = '';
223
+ this.layer.enableEncodeStyles.forEach(function (key) {
224
+ innerStr += "\n\n#ifdef USE_ATTRIBUTE_".concat(key.toUpperCase(), "\n ").concat(attrType[key], " ").concat(key, " = a_").concat(key.charAt(0).toUpperCase() + key.slice(1), ";\n#else\n ").concat(attrType[key], " ").concat(key, " = u_").concat(key, ";\n#endif\n\n");
225
+ });
226
+ return {
227
+ 'vs:#decl': str,
228
+ 'vs:#main-start': innerStr
229
+ };
230
+ }
231
+
232
+ // 获取数据映射样式
233
+ }, {
234
+ key: "getStyleAttribute",
235
+ value: function getStyleAttribute() {
236
+ var _this = this;
237
+ var options = {};
238
+ // TODO: 优化
239
+
240
+ var defualtValue = {
241
+ opacity: 1,
242
+ stroke: [1, 0, 0, 1],
243
+ offsets: [0, 0]
244
+ };
245
+ this.layer.enableEncodeStyles.forEach(function (key) {
246
+ if (!_this.layer.encodeStyleAttribute[key]) {
247
+ // @ts-ignore
248
+ var value = _this.layer.getLayerConfig()[key] || defualtValue[key];
249
+ if (key === 'stroke') {
250
+ value = (0, _l7Utils.rgb2arr)(value);
251
+ }
252
+ options['u_' + key] = value;
253
+ }
254
+ });
255
+ return options;
256
+ }
257
+ // 注册数据映射样式
258
+ }, {
259
+ key: "registerStyleAttribute",
260
+ value: function registerStyleAttribute() {
261
+ var _this2 = this;
262
+ Object.keys(this.layer.encodeStyleAttribute).forEach(function (key) {
263
+ var options = (0, _CommonStyleAttribute.getCommonStyleAttributeOptions)(key);
264
+ if (options) {
265
+ _this2.styleAttributeService.registerStyleAttribute(options);
266
+ }
267
+ });
268
+ }
269
+ }, {
270
+ key: "updateEncodeAttribute",
271
+ value: function updateEncodeAttribute(type, flag) {
272
+ this.encodeStyleAttribute[type] = flag;
273
+ }
556
274
  }]);
557
275
  return BaseModel;
558
276
  }(), (_descriptor = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "configService", [_dec], {
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCommonStyleAttributeOptions = getCommonStyleAttributeOptions;
7
+ var _l7Core = require("@antv/l7-core");
8
+ function getCommonStyleAttributeOptions(name) {
9
+ switch (name) {
10
+ case 'stroke':
11
+ return {
12
+ name: 'stroke',
13
+ type: _l7Core.AttributeType.Attribute,
14
+ descriptor: {
15
+ name: 'a_Stroke',
16
+ buffer: {
17
+ // give the WebGL driver a hint that this buffer may change
18
+ usage: _l7Core.gl.DYNAMIC_DRAW,
19
+ data: [],
20
+ type: _l7Core.gl.FLOAT
21
+ },
22
+ size: 4,
23
+ update: function update(feature) {
24
+ var _feature$stroke = feature.stroke,
25
+ stroke = _feature$stroke === void 0 ? [1, 1, 1, 1] : _feature$stroke;
26
+ return stroke;
27
+ }
28
+ }
29
+ };
30
+ case 'opacity':
31
+ return {
32
+ name: 'opacity',
33
+ type: _l7Core.AttributeType.Attribute,
34
+ descriptor: {
35
+ name: 'a_Opacity',
36
+ buffer: {
37
+ // give the WebGL driver a hint that this buffer may change
38
+ usage: _l7Core.gl.STATIC_DRAW,
39
+ data: [],
40
+ type: _l7Core.gl.FLOAT
41
+ },
42
+ size: 1,
43
+ update: function update(feature) {
44
+ var _feature$opacity = feature.opacity,
45
+ op = _feature$opacity === void 0 ? 1 : _feature$opacity;
46
+ return [op];
47
+ }
48
+ }
49
+ };
50
+ case 'offsets':
51
+ return {
52
+ name: 'offsets',
53
+ type: _l7Core.AttributeType.Attribute,
54
+ descriptor: {
55
+ name: 'a_Offsets',
56
+ buffer: {
57
+ // give the WebGL driver a hint that this buffer may change
58
+ usage: _l7Core.gl.STATIC_DRAW,
59
+ data: [],
60
+ type: _l7Core.gl.FLOAT
61
+ },
62
+ size: 2,
63
+ update: function update(feature) {
64
+ var epo = feature.offsets;
65
+ return epo;
66
+ }
67
+ }
68
+ };
69
+ default:
70
+ return undefined;
71
+ }
72
+ }
@@ -82,15 +82,22 @@ function extrude_PolygonNormal(path) {
82
82
  var normals = [];
83
83
  // 设置顶部z值 position uv
84
84
  for (var j = 0; j < vertices.length / dimensions; j++) {
85
- if (dimensions === 2) {
86
- positions.push(vertices[j * 2], vertices[j * 2 + 1], 1, -1, -1);
87
- } else {
88
- positions.push(vertices[j * 3], vertices[j * 3 + 1], 1, -1, -1);
89
- }
85
+ positions.push(vertices[j * dimensions],
86
+ // x
87
+ vertices[j * dimensions + 1],
88
+ // y
89
+ 1,
90
+ // z
91
+ -1,
92
+ // 顶部uv
93
+ -1 // 顶部uv
94
+ );
95
+
90
96
  normals.push(0, 0, 1);
91
97
  }
92
98
  var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
93
99
  indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)(triangles));
100
+ // 设置侧面
94
101
  var _loop2 = function _loop2() {
95
102
  var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
96
103
  var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
@@ -98,7 +105,12 @@ function extrude_PolygonNormal(path) {
98
105
  nextPoint = flattengeo.vertices.slice(0, dimensions);
99
106
  }
100
107
  var indexOffset = positions.length / 5;
101
- positions.push(prePoint[0], prePoint[1], 1, 0, 0, nextPoint[0], nextPoint[1], 1, 0.1, 0, prePoint[0], prePoint[1], 0, 0, 0.8, nextPoint[0], nextPoint[1], 0, 0.1, 0.8);
108
+ // 侧面四顶点
109
+ positions.push(prePoint[0], prePoint[1], 1, 0, 0, nextPoint[0], nextPoint[1], 1, 0.1,
110
+ // 侧面 低uv
111
+ 0,
112
+ // 侧面低 uv
113
+ prePoint[0], prePoint[1], 0, 0, 0.8, nextPoint[0], nextPoint[1], 0, 0.1, 0.8);
102
114
  var normal = computeVertexNormals([nextPoint[0], nextPoint[1], 1], [prePoint[0], prePoint[1], 0], [prePoint[0], prePoint[1], 1], needFlat);
103
115
  normals.push.apply(normals, (0, _toConsumableArray2.default)(normal).concat((0, _toConsumableArray2.default)(normal), (0, _toConsumableArray2.default)(normal), (0, _toConsumableArray2.default)(normal)));
104
116
  indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([1, 2, 0, 3, 2, 1].map(function (v) {
@@ -5,6 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.FlowLineFillTriangulation = FlowLineFillTriangulation;
9
+ exports.FlowLineStrokeTriangulation = FlowLineStrokeTriangulation;
8
10
  exports.GlobelPointFillTriangulation = GlobelPointFillTriangulation;
9
11
  exports.HeatmapGridTriangulation = HeatmapGridTriangulation;
10
12
  exports.HeatmapTriangulation = HeatmapTriangulation;
@@ -149,6 +151,76 @@ function LineTriangulation(feature) {
149
151
  size: 6
150
152
  };
151
153
  }
154
+ function FlowLineFillTriangulation(feature) {
155
+ // @ts-ignore
156
+ var coord = feature.coordinates.flat();
157
+ var tin = 1;
158
+ var tout = 1.0;
159
+ return {
160
+ vertices: [1, 0, 0].concat((0, _toConsumableArray2.default)(coord), [
161
+ // 0
162
+ 1, 2, -3], (0, _toConsumableArray2.default)(coord), [
163
+ // 1
164
+ 1, 1, -3], (0, _toConsumableArray2.default)(coord), [
165
+ // 2
166
+ 0, 1, 0], (0, _toConsumableArray2.default)(coord), [
167
+ // 3
168
+ 0, 0, 0], (0, _toConsumableArray2.default)(coord), [
169
+ // 4
170
+ 1, 0, 0], (0, _toConsumableArray2.default)(coord), [
171
+ // 0
172
+ 1, 2, -3], (0, _toConsumableArray2.default)(coord), [
173
+ // 1
174
+ 1, 1, -3], (0, _toConsumableArray2.default)(coord), [
175
+ // 2
176
+ 0, 1, 0], (0, _toConsumableArray2.default)(coord), [
177
+ // 3
178
+ 0, 0, 0], (0, _toConsumableArray2.default)(coord)),
179
+ normals: [-tin, 2 * tout, 1,
180
+ // 0
181
+ 2 * tout, -tout, 1,
182
+ // 1
183
+ tout, -tout, 1,
184
+ // 2
185
+ tout, -tout, 1,
186
+ // 3
187
+ -tin, -tout, 1,
188
+ // 4
189
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
190
+ indices: [0, 1, 2, 0, 2, 3, 0, 3, 4, 5, 6, 7, 5, 7, 8, 5, 8, 9],
191
+ size: 7
192
+ };
193
+ }
194
+ function FlowLineStrokeTriangulation(feature) {
195
+ // @ts-ignore
196
+ var coord = feature.coordinates.flat();
197
+ var tin = 1;
198
+ var tout = 1;
199
+ return {
200
+ vertices: [1, 0, 0].concat((0, _toConsumableArray2.default)(coord), [
201
+ // 0
202
+ 1, 2, -3], (0, _toConsumableArray2.default)(coord), [
203
+ // 1
204
+ 1, 1, -3], (0, _toConsumableArray2.default)(coord), [
205
+ // 2
206
+ 0, 1, 0], (0, _toConsumableArray2.default)(coord), [
207
+ // 3
208
+ 0, 0, 0], (0, _toConsumableArray2.default)(coord)),
209
+ normals: [-tin, 2 * tout, 1,
210
+ // 0
211
+ 2 * tout, -tout, 1,
212
+ // 1
213
+ tout, -tout, 1,
214
+ // 2
215
+ tout, -tout, 1,
216
+ // 3
217
+ -tin, -tout, 1 // 4
218
+ ],
219
+
220
+ indices: [0, 1, 1, 2, 2, 3, 3, 4, 4, 0],
221
+ size: 7
222
+ };
223
+ }
152
224
  function SimpleLineTriangulation(feature) {
153
225
  var coordinates = feature.coordinates;
154
226
  var pos = [];
@@ -18,7 +18,7 @@ var _triangulation = require("../../core/triangulation");
18
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
19
  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; } }
20
20
  /* babel-plugin-inline-import '../shaders/grid_vert.glsl' */
21
- var heatmapGridVert = "precision highp float;\r\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\r\nattribute vec3 a_Position;\r\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\r\nattribute vec3 a_Pos;\r\nattribute float a_Size;\r\nattribute vec4 a_Color;\r\nuniform vec2 u_radius;\r\nuniform float u_coverage: 0.9;\r\nuniform float u_angle: 0;\r\nuniform mat4 u_ModelMatrix;\r\nuniform mat4 u_Mvp;\r\nvarying vec4 v_color;\r\n\r\nuniform vec2 u_SceneCenterMKT;\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_SceneCenterMKT; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
21
+ var heatmapGridVert = "precision highp float;\r\n// \u591A\u8FB9\u5F62\u9876\u70B9\u5750\u6807\r\nattribute vec3 a_Position;\r\n// \u591A\u8FB9\u5F62\u7ECF\u7EAC\u5EA6\u5750\u6807\r\nattribute vec3 a_Pos;\r\nattribute float a_Size;\r\nattribute vec4 a_Color;\r\nuniform vec2 u_radius;\r\nuniform float u_coverage: 0.9;\r\nuniform float u_angle: 0;\r\nuniform mat4 u_ModelMatrix;\r\nuniform mat4 u_Mvp;\r\nvarying vec4 v_color;\r\n\r\nuniform vec2 u_sceneCenterMercator;\r\n\r\n#pragma include \"projection\"\r\n#pragma include \"project\"\r\n#pragma include \"picking\"\r\n\r\nvoid main() {\r\n v_color = a_Color;\r\n\r\n mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle));\r\n vec2 offset = a_Position.xy * u_radius * rotationMatrix * u_coverage ;\r\n // vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n // vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n // gl_Position = project_common_position_to_clipspace(project_pos);\r\n\r\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec2 customLnglat = customProject(lnglat) - u_sceneCenterMercator; // \u5C06\u7ECF\u7EAC\u5EA6\u8F6C\u6362\u4E3A\u9AD8\u5FB72.0\u9700\u8981\u7684\u5E73\u9762\u5750\u6807\r\n vec4 project_pos = project_position(vec4(customLnglat, 0, 1.0));\r\n gl_Position = u_Mvp * (project_pos);\r\n } else {\r\n vec2 lnglat = unProjectFlat(a_Pos.xy + offset);\r\n vec4 project_pos = project_position(vec4(lnglat, 0, 1.0));\r\n gl_Position = project_common_position_to_clipspace(project_pos);\r\n }\r\n\r\n setPickingColor(a_PickingColor);\r\n}\r\n";
22
22
  /* babel-plugin-inline-import '../shaders/hexagon_frag.glsl' */
23
23
  var heatmapGridFrag = "precision highp float;\nvarying vec4 v_color;\nuniform float u_opacity: 1;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  var GridModel = /*#__PURE__*/function (_BaseModel) {