@antv/l7-layers 2.9.23 → 2.9.25

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 (166) hide show
  1. package/es/Geometry/models/plane.d.ts +1 -0
  2. package/es/citybuliding/building.js +1 -1
  3. package/es/core/BaseLayer.js +10 -3
  4. package/es/core/interface.d.ts +26 -48
  5. package/es/core/interface.js +3 -0
  6. package/es/core/schema.d.ts +3 -3
  7. package/es/core/triangulation.d.ts +4 -3
  8. package/es/core/triangulation.js +54 -39
  9. package/es/heatmap/models/heatmap.js +1 -1
  10. package/es/image/models/image.js +7 -1
  11. package/es/line/index.js +4 -1
  12. package/es/line/models/arc.js +1 -1
  13. package/es/line/models/simpleLine.js +1 -1
  14. package/es/line/shaders/line_arc_vert.glsl +5 -3
  15. package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
  16. package/es/plugins/FeatureScalePlugin.js +0 -1
  17. package/es/point/index.js +3 -1
  18. package/es/point/models/fill.js +5 -2
  19. package/es/point/models/fillmage.js +9 -3
  20. package/es/point/models/image.js +8 -2
  21. package/es/point/models/radar.js +2 -3
  22. package/es/point/models/tile.js +1 -1
  23. package/es/point/shaders/fill_vert.glsl +13 -6
  24. package/es/point/shaders/image/fillImage_vert.glsl +13 -5
  25. package/es/point/shaders/image_vert.glsl +17 -8
  26. package/es/polygon/index.js +4 -1
  27. package/es/raster/index.js +3 -1
  28. package/es/tile/manager/tileLayerManager.d.ts +3 -2
  29. package/es/tile/manager/tileLayerManager.js +5 -2
  30. package/es/tile/models/tileModel.js +4 -3
  31. package/es/tile/tileFactory/base.d.ts +1 -1
  32. package/es/tile/tileFactory/base.js +32 -5
  33. package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
  34. package/es/tile/tileFactory/vectorLayer.js +22 -1
  35. package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
  36. package/es/tile/tileLayer/baseTileLayer.js +3 -2
  37. package/es/tile/utils.d.ts +2 -0
  38. package/es/tile/utils.js +5 -1
  39. package/lib/Geometry/index.js +114 -77
  40. package/lib/Geometry/models/billboard.js +232 -181
  41. package/lib/Geometry/models/index.js +18 -34
  42. package/lib/Geometry/models/plane.js +407 -278
  43. package/lib/Geometry/models/sprite.js +291 -189
  44. package/lib/canvas/index.js +101 -66
  45. package/lib/canvas/models/canvas.js +207 -140
  46. package/lib/canvas/models/index.js +12 -30
  47. package/lib/citybuliding/building.js +98 -63
  48. package/lib/citybuliding/models/build.js +192 -146
  49. package/lib/core/BaseLayer.js +1331 -809
  50. package/lib/core/BaseModel.js +457 -279
  51. package/lib/core/interface.js +40 -53
  52. package/lib/core/schema.js +21 -39
  53. package/lib/core/shape/Path.js +67 -79
  54. package/lib/core/shape/extrude.js +132 -91
  55. package/lib/core/triangulation.js +412 -213
  56. package/lib/earth/index.js +100 -62
  57. package/lib/earth/models/atmosphere.js +146 -112
  58. package/lib/earth/models/base.js +210 -150
  59. package/lib/earth/models/bloomsphere.js +146 -112
  60. package/lib/earth/utils.js +111 -91
  61. package/lib/heatmap/index.js +149 -92
  62. package/lib/heatmap/models/grid.js +118 -91
  63. package/lib/heatmap/models/grid3d.js +155 -123
  64. package/lib/heatmap/models/heatmap.js +475 -338
  65. package/lib/heatmap/models/hexagon.js +121 -92
  66. package/lib/heatmap/models/index.js +22 -37
  67. package/lib/heatmap/triangulation.js +31 -47
  68. package/lib/image/index.js +111 -74
  69. package/lib/image/models/dataImage.js +232 -174
  70. package/lib/image/models/image.js +175 -123
  71. package/lib/image/models/index.js +15 -32
  72. package/lib/index.js +263 -97
  73. package/lib/line/index.js +131 -83
  74. package/lib/line/models/arc.js +352 -237
  75. package/lib/line/models/arc_3d.js +334 -228
  76. package/lib/line/models/earthArc_3d.js +336 -228
  77. package/lib/line/models/great_circle.js +291 -200
  78. package/lib/line/models/half.js +286 -201
  79. package/lib/line/models/index.js +42 -50
  80. package/lib/line/models/line.js +428 -299
  81. package/lib/line/models/linearline.js +277 -203
  82. package/lib/line/models/simpleLine.js +239 -175
  83. package/lib/line/models/tile.js +348 -237
  84. package/lib/line/models/wall.js +327 -235
  85. package/lib/line/shaders/line_arc_vert.glsl +5 -3
  86. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
  87. package/lib/mask/index.js +92 -59
  88. package/lib/mask/models/fill.js +134 -82
  89. package/lib/mask/models/index.js +12 -30
  90. package/lib/plugins/DataMappingPlugin.js +342 -224
  91. package/lib/plugins/DataSourcePlugin.js +102 -87
  92. package/lib/plugins/FeatureScalePlugin.js +330 -241
  93. package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
  94. package/lib/plugins/LayerModelPlugin.js +80 -73
  95. package/lib/plugins/LayerStylePlugin.js +48 -51
  96. package/lib/plugins/LightingPlugin.js +80 -68
  97. package/lib/plugins/MultiPassRendererPlugin.js +91 -65
  98. package/lib/plugins/PixelPickingPlugin.js +150 -109
  99. package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
  100. package/lib/plugins/ShaderUniformPlugin.js +118 -99
  101. package/lib/plugins/UpdateModelPlugin.js +40 -47
  102. package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
  103. package/lib/point/index.js +226 -148
  104. package/lib/point/models/earthExtrude.js +279 -201
  105. package/lib/point/models/earthFill.js +287 -202
  106. package/lib/point/models/extrude.js +299 -203
  107. package/lib/point/models/fill.js +406 -273
  108. package/lib/point/models/fillmage.js +365 -252
  109. package/lib/point/models/image.js +241 -164
  110. package/lib/point/models/index.js +46 -52
  111. package/lib/point/models/normal.js +183 -134
  112. package/lib/point/models/radar.js +304 -212
  113. package/lib/point/models/simplePoint.js +194 -142
  114. package/lib/point/models/text.js +608 -385
  115. package/lib/point/models/tile.js +314 -223
  116. package/lib/point/shaders/fill_vert.glsl +13 -6
  117. package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
  118. package/lib/point/shaders/image_vert.glsl +17 -8
  119. package/lib/point/shape/extrude.js +56 -52
  120. package/lib/polygon/index.js +154 -100
  121. package/lib/polygon/models/extrude.js +311 -223
  122. package/lib/polygon/models/fill.js +215 -153
  123. package/lib/polygon/models/index.js +46 -52
  124. package/lib/polygon/models/ocean.js +244 -173
  125. package/lib/polygon/models/tile.js +144 -100
  126. package/lib/polygon/models/water.js +222 -153
  127. package/lib/raster/buffers/triangulation.js +27 -40
  128. package/lib/raster/index.js +115 -74
  129. package/lib/raster/models/index.js +16 -33
  130. package/lib/raster/models/raster.js +178 -135
  131. package/lib/raster/raster.js +187 -132
  132. package/lib/tile/interface.js +4 -16
  133. package/lib/tile/manager/tileConfigManager.js +125 -86
  134. package/lib/tile/manager/tileLayerManager.js +314 -227
  135. package/lib/tile/manager/tilePickerManager.js +192 -123
  136. package/lib/tile/models/tileModel.js +71 -51
  137. package/lib/tile/tileFactory/base.js +433 -292
  138. package/lib/tile/tileFactory/index.js +51 -49
  139. package/lib/tile/tileFactory/line.js +65 -50
  140. package/lib/tile/tileFactory/point.js +65 -50
  141. package/lib/tile/tileFactory/polygon.js +65 -50
  142. package/lib/tile/tileFactory/raster.js +66 -54
  143. package/lib/tile/tileFactory/rasterData.js +88 -76
  144. package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
  145. package/lib/tile/tileFactory/vectorLayer.js +169 -95
  146. package/lib/tile/tileLayer/baseTileLayer.js +420 -220
  147. package/lib/tile/tmsTileLayer.js +110 -67
  148. package/lib/tile/utils.js +113 -87
  149. package/lib/utils/blend.js +59 -79
  150. package/lib/utils/collision-index.js +107 -64
  151. package/lib/utils/dataMappingStyle.js +105 -60
  152. package/lib/utils/extrude_polyline.js +600 -398
  153. package/lib/utils/grid-index.js +163 -111
  154. package/lib/utils/layerData.js +130 -99
  155. package/lib/utils/multiPassRender.js +49 -41
  156. package/lib/utils/polylineNormal.js +148 -96
  157. package/lib/utils/simpleLine.js +100 -85
  158. package/lib/utils/symbol-layout.js +219 -116
  159. package/lib/utils/updateShape.js +15 -41
  160. package/lib/wind/index.js +109 -71
  161. package/lib/wind/models/index.js +12 -30
  162. package/lib/wind/models/utils.js +144 -105
  163. package/lib/wind/models/wind.js +333 -224
  164. package/lib/wind/models/windRender.js +329 -218
  165. package/lib/wind/models/windShader.js +23 -181
  166. package/package.json +7 -6
@@ -1,350 +1,487 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var __decorateClass = (decorators, target, key, kind) => {
22
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
23
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
24
- if (decorator = decorators[i])
25
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
26
- if (kind && result)
27
- __defProp(target, key, result);
28
- return result;
29
- };
30
-
31
- // src/heatmap/models/heatmap.ts
32
- var heatmap_exports = {};
33
- __export(heatmap_exports, {
34
- default: () => HeatMapModel
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
35
7
  });
36
- module.exports = __toCommonJS(heatmap_exports);
37
- var import_l7_core = require("@antv/l7-core");
38
- var import_l7_utils = require("@antv/l7-utils");
39
- var import_gl_matrix = require("gl-matrix");
40
- var import_inversify = require("inversify");
41
- var import_reflect_metadata = require("reflect-metadata");
42
- var import_BaseModel = __toESM(require("../../core/BaseModel"));
43
- var import_triangulation = require("../../core/triangulation");
44
- var import_heatmap_3d_frag = __toESM(require("../shaders/heatmap_3d_frag.glsl"));
45
- var import_heatmap_3d_vert = __toESM(require("../shaders/heatmap_3d_vert.glsl"));
46
- var import_heatmap_frag = __toESM(require("../shaders/heatmap_frag.glsl"));
47
- var import_heatmap_vert = __toESM(require("../shaders/heatmap_vert.glsl"));
48
- var import_heatmap_framebuffer_frag = __toESM(require("../shaders/heatmap_framebuffer_frag.glsl"));
49
- var import_heatmap_framebuffer_vert = __toESM(require("../shaders/heatmap_framebuffer_vert.glsl"));
50
- var import_triangulation2 = require("../triangulation");
51
- var HeatMapModel = class extends import_BaseModel.default {
52
- render() {
53
- const { clear, useFramebuffer } = this.rendererService;
54
- useFramebuffer(this.heatmapFramerBuffer, () => {
55
- clear({
56
- color: [0, 0, 0, 0],
57
- depth: 1,
58
- stencil: 0,
59
- framebuffer: this.heatmapFramerBuffer
8
+ exports.default = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
15
+
16
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
+
18
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
19
+
20
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
21
+
22
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
+
24
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
+
26
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
+
28
+ var _l7Core = require("@antv/l7-core");
29
+
30
+ var _l7Utils = require("@antv/l7-utils");
31
+
32
+ var _glMatrix = require("gl-matrix");
33
+
34
+ var _inversify = require("inversify");
35
+
36
+ require("reflect-metadata");
37
+
38
+ var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
39
+
40
+ var _triangulation = require("../../core/triangulation");
41
+
42
+ var _triangulation2 = require("../triangulation");
43
+
44
+ var _dec, _class;
45
+
46
+ 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); }; }
47
+
48
+ 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; } }
49
+
50
+ /* babel-plugin-inline-import '../shaders/heatmap_3d_frag.glsl' */
51
+ var heatmap3DFrag = "uniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_opacity;\nvarying vec2 v_texCoord;\nvarying float v_intensity;\n\nvoid main(){\n \n float intensity = texture2D(u_texture, v_texCoord).r;\n vec4 color = texture2D(u_colorTexture,vec2(intensity, 0));\n gl_FragColor = color;\n // gl_FragColor.a = color.a * smoothstep(0.1,0.2,intensity)* u_opacity;\n gl_FragColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n}\n";
52
+
53
+ /* babel-plugin-inline-import '../shaders/heatmap_3d_vert.glsl' */
54
+ var heatmap3DVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_InverseViewProjectionMatrix;\nuniform mat4 u_ViewProjectionMatrixUncentered;\nvarying float v_intensity;\n\n\nvec2 toBezier(float t, vec2 P0, vec2 P1, vec2 P2, vec2 P3) {\n float t2 = t * t;\n float one_minus_t = 1.0 - t;\n float one_minus_t2 = one_minus_t * one_minus_t;\n return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t);\n}\nvec2 toBezier(float t, vec4 p){\n return toBezier(t, vec2(0.0, 0.0), vec2(p.x, p.y), vec2(p.z, p.w), vec2(1.0, 1.0));\n}\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n\n vec2 pos = a_Uv * vec2(2.0) - vec2(1.0); // \u5C06\u539F\u672C 0 -> 1 \u7684 uv \u8F6C\u6362\u4E3A -1 -> 1 \u7684\u6807\u51C6\u5750\u6807\u7A7A\u95F4\uFF08NDC\uFF09\n\n vec4 p1 = vec4(pos, 0.0, 1.0); // x/y \u5E73\u9762\u4E0A\u7684\u70B9\uFF08z == 0\uFF09\u53EF\u4EE5\u8BA4\u4E3A\u662F\u4E09\u7EF4\u4E0A\u7684\u70B9\u88AB\u6295\u5F71\u5230\u5E73\u9762\u540E\u7684\u70B9\n\tvec4 p2 = vec4(pos, 1.0, 1.0); // \u5E73\u884C\u4E8Ex/y\u5E73\u9762\u3001z==1 \u7684\u5E73\u9762\u4E0A\u7684\u70B9\n\n\tvec4 inverseP1 = u_InverseViewProjectionMatrix * p1; // \u6839\u636E\u89C6\u56FE\u6295\u5F71\u77E9\u9635\u7684\u9006\u77E9\u9635\u5E73\u9762\u4E0A\u7684\u53CD\u7B97\u51FA\u4E09\u7EF4\u7A7A\u95F4\u4E2D\u7684\u70B9\uFF08p1\u5E73\u9762\u4E0A\u7684\u70B9\uFF09\n\tvec4 inverseP2 = u_InverseViewProjectionMatrix * p2;\n\n inverseP1 = inverseP1 / inverseP1.w; // \u5F52\u4E00\u5316\u64CD\u4F5C\uFF08\u5F52\u4E00\u5316\u540E\u4E3A\u4E16\u754C\u5750\u6807\uFF09\n\tinverseP2 = inverseP2 / inverseP2.w;\n\n\tfloat zPos = (0.0 - inverseP1.z) / (inverseP2.z - inverseP1.z); // ??\n\tvec4 position = inverseP1 + zPos * (inverseP2 - inverseP1);\n\n vec4 b= vec4(0.5000, 0.0, 1.0, 0.5000);\n float fh;\n\n v_intensity = texture2D(u_texture, v_texCoord).r;\n fh = toBezier(v_intensity, b).y;\n gl_Position = u_ViewProjectionMatrixUncentered * vec4(position.xy, fh * project_pixel(50.), 1.0);\n \n}\n"; // 绘制平面热力的 shader
55
+
56
+ /* babel-plugin-inline-import '../shaders/heatmap_frag.glsl' */
57
+ var heatmapColorFrag = "uniform sampler2D u_texture; // \u70ED\u529B\u5F3A\u5EA6\u56FE\nuniform sampler2D u_colorTexture; // \u6839\u636E\u5F3A\u5EA6\u5206\u5E03\u7684\u8272\u5E26\nuniform float u_opacity;\nvarying vec2 v_texCoord;\n\nuniform vec2 u_ViewportSize;\n\nfloat getBlurIndusty() {\n float vW = 2.0/u_ViewportSize.x;\n float vH = 2.0/u_ViewportSize.y;\n vec2 vUv = v_texCoord;\n float i11 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i12 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y + 1.0 * vH) ).r;\n float i13 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y + 1.0 * vH) ).r;\n\n float i21 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y) ).r;\n float i22 = texture2D( u_texture, vec2( vUv.x , vUv.y) ).r;\n float i23 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y) ).r;\n\n float i31 = texture2D( u_texture, vec2( vUv.x - 1.0 * vW, vUv.y-1.0*vH) ).r;\n float i32 = texture2D( u_texture, vec2( vUv.x - 0.0 * vW, vUv.y-1.0*vH) ).r;\n float i33 = texture2D( u_texture, vec2( vUv.x + 1.0 * vW, vUv.y-1.0*vH) ).r;\n\n return(\n i11 + \n i12 + \n i13 + \n i21 + \n i21 + \n i22 + \n i23 + \n i31 + \n i32 + \n i33\n )/9.0;\n}\n\n\nvoid main(){\n // float intensity = texture2D(u_texture, v_texCoord).r;\n float intensity = getBlurIndusty();\n vec4 color = texture2D(u_colorTexture, vec2(intensity, 0.0));\n\n gl_FragColor =color;\n gl_FragColor.a = color.a * smoothstep(0.,0.1,intensity) * u_opacity;\n\n}\n";
58
+
59
+ /* babel-plugin-inline-import '../shaders/heatmap_vert.glsl' */
60
+ var heatmapColorVert = "precision highp float;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvoid main() {\n v_texCoord = a_Uv;\n\n gl_Position = vec4(a_Position.xy, 0, 1.);\n}\n";
61
+
62
+ /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_frag.glsl' */
63
+ var heatmapFramebufferFrag = "precision highp float;\nuniform float u_intensity;\nvarying float v_weight;\nvarying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(){\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = v_weight * u_intensity * GAUSS_COEF * exp(d);\n gl_FragColor = vec4(val, 1., 1., 1.);\n}\n";
64
+
65
+ /* babel-plugin-inline-import '../shaders/heatmap_framebuffer_vert.glsl' */
66
+ var heatmapFramebufferVert = "precision highp float;\nattribute vec3 a_Position;\nattribute float a_Size;\nattribute vec2 a_Dir;\nuniform float u_intensity;\nuniform float u_radius;\nvarying vec2 v_extrude;\nvarying float v_weight;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#define GAUSS_COEF 0.3989422804014327\n\n#pragma include \"projection\"\n\nvoid main(){\n v_weight = a_Size;\n float ZERO = 1.0 / 255.0 / 16.0;\n float extrude_x = a_Dir.x * 2.0 -1.0;\n float extrude_y = a_Dir.y * 2.0 -1.0;\n vec2 extrude_dir = normalize(vec2(extrude_x,extrude_y));\n float S = sqrt(-2.0 * log(ZERO / a_Size / u_intensity / GAUSS_COEF)) / 2.5;\n v_extrude = extrude_dir * S;\n\n vec2 offset = project_pixel(v_extrude * u_radius);\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n}\n";
67
+ var HeatMapModel = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function (_BaseModel) {
68
+ (0, _inherits2.default)(HeatMapModel, _BaseModel);
69
+
70
+ var _super = _createSuper(HeatMapModel);
71
+
72
+ function HeatMapModel() {
73
+ (0, _classCallCheck2.default)(this, HeatMapModel);
74
+ return _super.apply(this, arguments);
75
+ }
76
+
77
+ (0, _createClass2.default)(HeatMapModel, [{
78
+ key: "render",
79
+ value: function render() {
80
+ var _this = this;
81
+
82
+ var _this$rendererService = this.rendererService,
83
+ clear = _this$rendererService.clear,
84
+ useFramebuffer = _this$rendererService.useFramebuffer;
85
+ useFramebuffer(this.heatmapFramerBuffer, function () {
86
+ clear({
87
+ color: [0, 0, 0, 0],
88
+ depth: 1,
89
+ stencil: 0,
90
+ framebuffer: _this.heatmapFramerBuffer
91
+ });
92
+
93
+ _this.drawIntensityMode();
60
94
  });
61
- this.drawIntensityMode();
62
- });
63
- if (this.layer.styleNeedUpdate) {
64
- this.updateColorTexture();
95
+
96
+ if (this.layer.styleNeedUpdate) {
97
+ this.updateColorTexture();
98
+ }
99
+
100
+ this.shapeType === 'heatmap' ? this.drawColorMode() : this.draw3DHeatMap();
65
101
  }
66
- this.shapeType === "heatmap" ? this.drawColorMode() : this.draw3DHeatMap();
67
- }
68
- getUninforms() {
69
- throw new Error("Method not implemented.");
70
- }
71
- async initModels(callbackModel) {
72
- var _a;
73
- const {
74
- createFramebuffer,
75
- clear,
76
- getViewportSize,
77
- createTexture2D,
78
- useFramebuffer
79
- } = this.rendererService;
80
- const shapeAttr = this.styleAttributeService.getLayerStyleAttribute("shape");
81
- const shapeType = ((_a = shapeAttr == null ? void 0 : shapeAttr.scale) == null ? void 0 : _a.field) || "heatmap";
82
- this.shapeType = shapeType;
83
- this.intensityModel = await this.buildHeatMapIntensity();
84
- this.colorModel = shapeType === "heatmap" ? this.buildHeatmapColor() : this.build3dHeatMap();
85
- const { width, height } = getViewportSize();
86
- this.heatmapFramerBuffer = createFramebuffer({
87
- color: createTexture2D({
88
- width: Math.floor(width / 4),
89
- height: Math.floor(height / 4),
90
- wrapS: import_l7_core.gl.CLAMP_TO_EDGE,
91
- wrapT: import_l7_core.gl.CLAMP_TO_EDGE,
92
- min: import_l7_core.gl.LINEAR,
93
- mag: import_l7_core.gl.LINEAR
94
- }),
95
- depth: false
96
- });
97
- this.updateColorTexture();
98
- callbackModel([this.intensityModel, this.colorModel]);
99
- }
100
- buildModels(callbackModel) {
101
- this.initModels(callbackModel);
102
- }
103
- registerBuiltinAttributes() {
104
- this.styleAttributeService.registerStyleAttribute({
105
- name: "dir",
106
- type: import_l7_core.AttributeType.Attribute,
107
- descriptor: {
108
- name: "a_Dir",
109
- buffer: {
110
- usage: import_l7_core.gl.DYNAMIC_DRAW,
111
- data: [],
112
- type: import_l7_core.gl.FLOAT
113
- },
114
- size: 2,
115
- update: (feature, featureIdx, vertex, attributeIdx) => {
116
- return [vertex[3], vertex[4]];
117
- }
102
+ }, {
103
+ key: "getUninforms",
104
+ value: function getUninforms() {
105
+ throw new Error('Method not implemented.');
106
+ }
107
+ }, {
108
+ key: "initModels",
109
+ value: function () {
110
+ var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(callbackModel) {
111
+ var _shapeAttr$scale;
112
+
113
+ var _this$rendererService2, createFramebuffer, clear, getViewportSize, createTexture2D, useFramebuffer, shapeAttr, shapeType, _getViewportSize, width, height;
114
+
115
+ return _regenerator.default.wrap(function _callee$(_context) {
116
+ while (1) {
117
+ switch (_context.prev = _context.next) {
118
+ case 0:
119
+ _this$rendererService2 = this.rendererService, createFramebuffer = _this$rendererService2.createFramebuffer, clear = _this$rendererService2.clear, getViewportSize = _this$rendererService2.getViewportSize, createTexture2D = _this$rendererService2.createTexture2D, useFramebuffer = _this$rendererService2.useFramebuffer;
120
+ shapeAttr = this.styleAttributeService.getLayerStyleAttribute('shape');
121
+ shapeType = (shapeAttr === null || shapeAttr === void 0 ? void 0 : (_shapeAttr$scale = shapeAttr.scale) === null || _shapeAttr$scale === void 0 ? void 0 : _shapeAttr$scale.field) || 'heatmap';
122
+ this.shapeType = shapeType; // 生成热力图密度图
123
+
124
+ _context.next = 6;
125
+ return this.buildHeatMapIntensity();
126
+
127
+ case 6:
128
+ this.intensityModel = _context.sent;
129
+ // 渲染到屏幕
130
+ this.colorModel = shapeType === 'heatmap' ? this.buildHeatmapColor() // 2D
131
+ : this.build3dHeatMap(); // 3D
132
+
133
+ _getViewportSize = getViewportSize(), width = _getViewportSize.width, height = _getViewportSize.height; // 初始化密度图纹理
134
+
135
+ this.heatmapFramerBuffer = createFramebuffer({
136
+ color: createTexture2D({
137
+ width: Math.floor(width / 4),
138
+ height: Math.floor(height / 4),
139
+ wrapS: _l7Core.gl.CLAMP_TO_EDGE,
140
+ wrapT: _l7Core.gl.CLAMP_TO_EDGE,
141
+ min: _l7Core.gl.LINEAR,
142
+ mag: _l7Core.gl.LINEAR
143
+ }),
144
+ depth: false
145
+ });
146
+ this.updateColorTexture();
147
+ callbackModel([this.intensityModel, this.colorModel]);
148
+
149
+ case 12:
150
+ case "end":
151
+ return _context.stop();
152
+ }
153
+ }
154
+ }, _callee, this);
155
+ }));
156
+
157
+ function initModels(_x) {
158
+ return _initModels.apply(this, arguments);
118
159
  }
119
- });
120
- this.styleAttributeService.registerStyleAttribute({
121
- name: "size",
122
- type: import_l7_core.AttributeType.Attribute,
123
- descriptor: {
124
- name: "a_Size",
125
- buffer: {
126
- usage: import_l7_core.gl.DYNAMIC_DRAW,
127
- data: [],
128
- type: import_l7_core.gl.FLOAT
129
- },
130
- size: 1,
131
- update: (feature, featureIdx, vertex, attributeIdx) => {
132
- const { size = 1 } = feature;
133
- return [size];
160
+
161
+ return initModels;
162
+ }()
163
+ }, {
164
+ key: "buildModels",
165
+ value: function buildModels(callbackModel) {
166
+ this.initModels(callbackModel);
167
+ }
168
+ }, {
169
+ key: "registerBuiltinAttributes",
170
+ value: function registerBuiltinAttributes() {
171
+ this.styleAttributeService.registerStyleAttribute({
172
+ name: 'dir',
173
+ type: _l7Core.AttributeType.Attribute,
174
+ descriptor: {
175
+ name: 'a_Dir',
176
+ buffer: {
177
+ // give the WebGL driver a hint that this buffer may change
178
+ usage: _l7Core.gl.DYNAMIC_DRAW,
179
+ data: [],
180
+ type: _l7Core.gl.FLOAT
181
+ },
182
+ size: 2,
183
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
184
+ return [vertex[3], vertex[4]];
185
+ }
134
186
  }
135
- }
136
- });
137
- }
138
- async buildHeatMapIntensity() {
139
- this.layer.triangulation = import_triangulation.HeatmapTriangulation;
140
- const model = await this.layer.buildLayerModel({
141
- moduleName: "heatmapIntensity",
142
- vertexShader: import_heatmap_framebuffer_vert.default,
143
- fragmentShader: import_heatmap_framebuffer_frag.default,
144
- triangulation: import_triangulation.HeatmapTriangulation,
145
- depth: {
146
- enable: false
147
- },
148
- cull: {
149
- enable: true,
150
- face: (0, import_l7_utils.getCullFace)(this.mapService.version)
151
- },
152
- blend: {
153
- enable: true,
154
- func: {
155
- srcRGB: import_l7_core.gl.ONE,
156
- srcAlpha: 1,
157
- dstRGB: import_l7_core.gl.ONE,
158
- dstAlpha: 1
187
+ }); // point layer size;
188
+
189
+ this.styleAttributeService.registerStyleAttribute({
190
+ name: 'size',
191
+ type: _l7Core.AttributeType.Attribute,
192
+ descriptor: {
193
+ name: 'a_Size',
194
+ buffer: {
195
+ // give the WebGL driver a hint that this buffer may change
196
+ usage: _l7Core.gl.DYNAMIC_DRAW,
197
+ data: [],
198
+ type: _l7Core.gl.FLOAT
199
+ },
200
+ size: 1,
201
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
202
+ var _feature$size = feature.size,
203
+ size = _feature$size === void 0 ? 1 : _feature$size;
204
+ return [size];
205
+ }
159
206
  }
207
+ });
208
+ }
209
+ }, {
210
+ key: "buildHeatMapIntensity",
211
+ value: function () {
212
+ var _buildHeatMapIntensity = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
213
+ var model;
214
+ return _regenerator.default.wrap(function _callee2$(_context2) {
215
+ while (1) {
216
+ switch (_context2.prev = _context2.next) {
217
+ case 0:
218
+ this.layer.triangulation = _triangulation.HeatmapTriangulation;
219
+ _context2.next = 3;
220
+ return this.layer.buildLayerModel({
221
+ moduleName: 'heatmapIntensity',
222
+ vertexShader: heatmapFramebufferVert,
223
+ fragmentShader: heatmapFramebufferFrag,
224
+ triangulation: _triangulation.HeatmapTriangulation,
225
+ depth: {
226
+ enable: false
227
+ },
228
+ cull: {
229
+ enable: true,
230
+ face: (0, _l7Utils.getCullFace)(this.mapService.version)
231
+ },
232
+ blend: {
233
+ enable: true,
234
+ func: {
235
+ srcRGB: _l7Core.gl.ONE,
236
+ srcAlpha: 1,
237
+ dstRGB: _l7Core.gl.ONE,
238
+ dstAlpha: 1
239
+ }
240
+ }
241
+ });
242
+
243
+ case 3:
244
+ model = _context2.sent;
245
+ return _context2.abrupt("return", model);
246
+
247
+ case 5:
248
+ case "end":
249
+ return _context2.stop();
250
+ }
251
+ }
252
+ }, _callee2, this);
253
+ }));
254
+
255
+ function buildHeatMapIntensity() {
256
+ return _buildHeatMapIntensity.apply(this, arguments);
160
257
  }
161
- });
162
- return model;
163
- }
164
- buildHeatmapColor() {
165
- const {
166
- mask = false,
167
- maskInside = true
168
- } = this.layer.getLayerConfig();
169
- this.shaderModuleService.registerModule("heatmapColor", {
170
- vs: import_heatmap_vert.default,
171
- fs: import_heatmap_frag.default
172
- });
173
- const { vs, fs, uniforms } = this.shaderModuleService.getModule("heatmapColor");
174
- const {
175
- createAttribute,
176
- createElements,
177
- createBuffer,
178
- createModel
179
- } = this.rendererService;
180
- return createModel({
181
- vs,
182
- fs,
183
- attributes: {
184
- a_Position: createAttribute({
185
- buffer: createBuffer({
186
- data: [-1, 1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
187
- type: import_l7_core.gl.FLOAT
258
+
259
+ return buildHeatMapIntensity;
260
+ }()
261
+ }, {
262
+ key: "buildHeatmapColor",
263
+ value: function buildHeatmapColor() {
264
+ var _ref = this.layer.getLayerConfig(),
265
+ _ref$mask = _ref.mask,
266
+ mask = _ref$mask === void 0 ? false : _ref$mask,
267
+ _ref$maskInside = _ref.maskInside,
268
+ maskInside = _ref$maskInside === void 0 ? true : _ref$maskInside;
269
+
270
+ this.shaderModuleService.registerModule('heatmapColor', {
271
+ vs: heatmapColorVert,
272
+ fs: heatmapColorFrag
273
+ });
274
+
275
+ var _this$shaderModuleSer = this.shaderModuleService.getModule('heatmapColor'),
276
+ vs = _this$shaderModuleSer.vs,
277
+ fs = _this$shaderModuleSer.fs,
278
+ uniforms = _this$shaderModuleSer.uniforms;
279
+
280
+ var _this$rendererService3 = this.rendererService,
281
+ createAttribute = _this$rendererService3.createAttribute,
282
+ createElements = _this$rendererService3.createElements,
283
+ createBuffer = _this$rendererService3.createBuffer,
284
+ createModel = _this$rendererService3.createModel;
285
+ return createModel({
286
+ vs: vs,
287
+ fs: fs,
288
+ attributes: {
289
+ a_Position: createAttribute({
290
+ buffer: createBuffer({
291
+ data: [-1, 1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
292
+ type: _l7Core.gl.FLOAT
293
+ }),
294
+ size: 3
188
295
  }),
189
- size: 3
296
+ a_Uv: createAttribute({
297
+ buffer: createBuffer({
298
+ data: [0, 1, 1, 1, 0, 0, 1, 0],
299
+ type: _l7Core.gl.FLOAT
300
+ }),
301
+ size: 2
302
+ })
303
+ },
304
+ uniforms: (0, _objectSpread2.default)({}, uniforms),
305
+ depth: {
306
+ enable: false
307
+ },
308
+ blend: this.getBlend(),
309
+ // count: 6,
310
+ elements: createElements({
311
+ data: [0, 2, 1, 2, 3, 1],
312
+ type: _l7Core.gl.UNSIGNED_INT,
313
+ count: 6
190
314
  }),
191
- a_Uv: createAttribute({
192
- buffer: createBuffer({
193
- data: [0, 1, 1, 1, 0, 0, 1, 0],
194
- type: import_l7_core.gl.FLOAT
195
- }),
196
- size: 2
197
- })
198
- },
199
- uniforms: {
200
- ...uniforms
201
- },
202
- depth: {
203
- enable: false
204
- },
205
- blend: this.getBlend(),
206
- count: 6,
207
- elements: createElements({
208
- data: [0, 2, 1, 2, 3, 1],
209
- type: import_l7_core.gl.UNSIGNED_INT,
210
- count: 6
211
- }),
212
- stencil: (0, import_l7_utils.getMask)(mask, maskInside)
213
- });
214
- }
215
- drawIntensityMode() {
216
- var _a;
217
- const {
218
- opacity,
219
- intensity = 10,
220
- radius = 5
221
- } = this.layer.getLayerConfig();
222
- (_a = this.intensityModel) == null ? void 0 : _a.draw({
223
- uniforms: {
224
- u_opacity: opacity || 1,
225
- u_radius: radius,
226
- u_intensity: intensity
227
- }
228
- });
229
- }
230
- drawColorMode() {
231
- var _a;
232
- const {
233
- opacity
234
- } = this.layer.getLayerConfig();
235
- (_a = this.colorModel) == null ? void 0 : _a.draw({
236
- uniforms: {
237
- u_opacity: opacity || 1,
238
- u_colorTexture: this.colorTexture,
239
- u_texture: this.heatmapFramerBuffer
240
- }
241
- });
242
- }
243
- draw3DHeatMap() {
244
- var _a;
245
- const {
246
- opacity
247
- } = this.layer.getLayerConfig();
248
- const invert = import_gl_matrix.mat4.create();
249
- import_gl_matrix.mat4.invert(invert, this.cameraService.getViewProjectionMatrixUncentered());
250
- (_a = this.colorModel) == null ? void 0 : _a.draw({
251
- uniforms: {
252
- u_opacity: opacity || 1,
253
- u_colorTexture: this.colorTexture,
254
- u_texture: this.heatmapFramerBuffer,
255
- u_ViewProjectionMatrixUncentered: this.cameraService.getViewProjectionMatrixUncentered(),
256
- u_InverseViewProjectionMatrix: [...invert]
257
- }
258
- });
259
- }
260
- build3dHeatMap() {
261
- const {
262
- mask = false,
263
- maskInside = true
264
- } = this.layer.getLayerConfig();
265
- const { getViewportSize } = this.rendererService;
266
- const { width, height } = getViewportSize();
267
- const triangulation = (0, import_triangulation2.heatMap3DTriangulation)(width / 4, height / 4);
268
- this.shaderModuleService.registerModule("heatmap3dColor", {
269
- vs: import_heatmap_3d_vert.default,
270
- fs: import_heatmap_3d_frag.default
271
- });
272
- const { vs, fs, uniforms } = this.shaderModuleService.getModule("heatmap3dColor");
273
- const {
274
- createAttribute,
275
- createElements,
276
- createBuffer,
277
- createModel
278
- } = this.rendererService;
279
- return createModel({
280
- vs,
281
- fs,
282
- attributes: {
283
- a_Position: createAttribute({
284
- buffer: createBuffer({
285
- data: triangulation.vertices,
286
- type: import_l7_core.gl.FLOAT
315
+ stencil: (0, _l7Utils.getMask)(mask, maskInside)
316
+ });
317
+ }
318
+ }, {
319
+ key: "drawIntensityMode",
320
+ value: function drawIntensityMode() {
321
+ var _this$intensityModel;
322
+
323
+ var _ref2 = this.layer.getLayerConfig(),
324
+ opacity = _ref2.opacity,
325
+ _ref2$intensity = _ref2.intensity,
326
+ intensity = _ref2$intensity === void 0 ? 10 : _ref2$intensity,
327
+ _ref2$radius = _ref2.radius,
328
+ radius = _ref2$radius === void 0 ? 5 : _ref2$radius;
329
+
330
+ (_this$intensityModel = this.intensityModel) === null || _this$intensityModel === void 0 ? void 0 : _this$intensityModel.draw({
331
+ uniforms: {
332
+ u_opacity: opacity || 1.0,
333
+ u_radius: radius,
334
+ u_intensity: intensity
335
+ }
336
+ });
337
+ }
338
+ }, {
339
+ key: "drawColorMode",
340
+ value: function drawColorMode() {
341
+ var _this$colorModel;
342
+
343
+ var _ref3 = this.layer.getLayerConfig(),
344
+ opacity = _ref3.opacity;
345
+
346
+ (_this$colorModel = this.colorModel) === null || _this$colorModel === void 0 ? void 0 : _this$colorModel.draw({
347
+ uniforms: {
348
+ u_opacity: opacity || 1.0,
349
+ u_colorTexture: this.colorTexture,
350
+ u_texture: this.heatmapFramerBuffer
351
+ }
352
+ });
353
+ }
354
+ }, {
355
+ key: "draw3DHeatMap",
356
+ value: function draw3DHeatMap() {
357
+ var _this$colorModel2;
358
+
359
+ var _ref4 = this.layer.getLayerConfig(),
360
+ opacity = _ref4.opacity; // const invert = mat4.invert(
361
+ // mat4.create(),
362
+ // mat4.fromValues(
363
+ // // @ts-ignore
364
+ // ...this.cameraService.getViewProjectionMatrixUncentered(),
365
+ // ),
366
+ // ) as mat4;
367
+
368
+
369
+ var invert = _glMatrix.mat4.create();
370
+
371
+ _glMatrix.mat4.invert(invert, this.cameraService.getViewProjectionMatrixUncentered());
372
+
373
+ (_this$colorModel2 = this.colorModel) === null || _this$colorModel2 === void 0 ? void 0 : _this$colorModel2.draw({
374
+ uniforms: {
375
+ u_opacity: opacity || 1.0,
376
+ u_colorTexture: this.colorTexture,
377
+ u_texture: this.heatmapFramerBuffer,
378
+ u_ViewProjectionMatrixUncentered: this.cameraService.getViewProjectionMatrixUncentered(),
379
+ u_InverseViewProjectionMatrix: (0, _toConsumableArray2.default)(invert)
380
+ }
381
+ });
382
+ }
383
+ }, {
384
+ key: "build3dHeatMap",
385
+ value: function build3dHeatMap() {
386
+ var _ref5 = this.layer.getLayerConfig(),
387
+ _ref5$mask = _ref5.mask,
388
+ mask = _ref5$mask === void 0 ? false : _ref5$mask,
389
+ _ref5$maskInside = _ref5.maskInside,
390
+ maskInside = _ref5$maskInside === void 0 ? true : _ref5$maskInside;
391
+
392
+ var getViewportSize = this.rendererService.getViewportSize;
393
+
394
+ var _getViewportSize2 = getViewportSize(),
395
+ width = _getViewportSize2.width,
396
+ height = _getViewportSize2.height;
397
+
398
+ var triangulation = (0, _triangulation2.heatMap3DTriangulation)(width / 4.0, height / 4.0);
399
+ this.shaderModuleService.registerModule('heatmap3dColor', {
400
+ vs: heatmap3DVert,
401
+ fs: heatmap3DFrag
402
+ });
403
+
404
+ var _this$shaderModuleSer2 = this.shaderModuleService.getModule('heatmap3dColor'),
405
+ vs = _this$shaderModuleSer2.vs,
406
+ fs = _this$shaderModuleSer2.fs,
407
+ uniforms = _this$shaderModuleSer2.uniforms;
408
+
409
+ var _this$rendererService4 = this.rendererService,
410
+ createAttribute = _this$rendererService4.createAttribute,
411
+ createElements = _this$rendererService4.createElements,
412
+ createBuffer = _this$rendererService4.createBuffer,
413
+ createModel = _this$rendererService4.createModel;
414
+ return createModel({
415
+ vs: vs,
416
+ fs: fs,
417
+ attributes: {
418
+ a_Position: createAttribute({
419
+ buffer: createBuffer({
420
+ data: triangulation.vertices,
421
+ type: _l7Core.gl.FLOAT
422
+ }),
423
+ size: 3
287
424
  }),
288
- size: 3
425
+ a_Uv: createAttribute({
426
+ buffer: createBuffer({
427
+ data: triangulation.uvs,
428
+ type: _l7Core.gl.FLOAT
429
+ }),
430
+ size: 2
431
+ })
432
+ },
433
+ primitive: _l7Core.gl.TRIANGLES,
434
+ uniforms: (0, _objectSpread2.default)({}, uniforms),
435
+ depth: {
436
+ enable: true
437
+ },
438
+ blend: {
439
+ enable: true,
440
+ func: {
441
+ srcRGB: _l7Core.gl.SRC_ALPHA,
442
+ srcAlpha: 1,
443
+ dstRGB: _l7Core.gl.ONE_MINUS_SRC_ALPHA,
444
+ dstAlpha: 1
445
+ }
446
+ },
447
+ elements: createElements({
448
+ data: triangulation.indices,
449
+ type: _l7Core.gl.UNSIGNED_INT,
450
+ count: triangulation.indices.length
289
451
  }),
290
- a_Uv: createAttribute({
291
- buffer: createBuffer({
292
- data: triangulation.uvs,
293
- type: import_l7_core.gl.FLOAT
294
- }),
295
- size: 2
296
- })
297
- },
298
- primitive: import_l7_core.gl.TRIANGLES,
299
- uniforms: {
300
- ...uniforms
301
- },
302
- depth: {
303
- enable: true
304
- },
305
- blend: {
306
- enable: true,
307
- func: {
308
- srcRGB: import_l7_core.gl.SRC_ALPHA,
309
- srcAlpha: 1,
310
- dstRGB: import_l7_core.gl.ONE_MINUS_SRC_ALPHA,
311
- dstAlpha: 1
312
- }
313
- },
314
- elements: createElements({
315
- data: triangulation.indices,
316
- type: import_l7_core.gl.UNSIGNED_INT,
317
- count: triangulation.indices.length
318
- }),
319
- stencil: (0, import_l7_utils.getMask)(mask, maskInside)
320
- });
321
- }
322
- updateStyle() {
323
- this.updateColorTexture();
324
- }
325
- updateColorTexture() {
326
- const { createTexture2D } = this.rendererService;
327
- if (this.texture) {
328
- this.texture.destroy();
452
+ stencil: (0, _l7Utils.getMask)(mask, maskInside)
453
+ });
329
454
  }
330
- const {
331
- rampColors
332
- } = this.layer.getLayerConfig();
333
- const imageData = (0, import_l7_utils.generateColorRamp)(rampColors);
334
- this.colorTexture = createTexture2D({
335
- data: new Uint8Array(imageData.data),
336
- width: imageData.width,
337
- height: imageData.height,
338
- wrapS: import_l7_core.gl.CLAMP_TO_EDGE,
339
- wrapT: import_l7_core.gl.CLAMP_TO_EDGE,
340
- min: import_l7_core.gl.NEAREST,
341
- mag: import_l7_core.gl.NEAREST,
342
- flipY: false
343
- });
344
- }
345
- };
346
- HeatMapModel = __decorateClass([
347
- (0, import_inversify.injectable)()
348
- ], HeatMapModel);
349
- // Annotate the CommonJS export names for ESM import in node:
350
- 0 && (module.exports = {});
455
+ }, {
456
+ key: "updateStyle",
457
+ value: function updateStyle() {
458
+ this.updateColorTexture();
459
+ }
460
+ }, {
461
+ key: "updateColorTexture",
462
+ value: function updateColorTexture() {
463
+ var createTexture2D = this.rendererService.createTexture2D;
464
+
465
+ if (this.texture) {
466
+ this.texture.destroy();
467
+ }
468
+
469
+ var _ref6 = this.layer.getLayerConfig(),
470
+ rampColors = _ref6.rampColors;
471
+
472
+ var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
473
+ this.colorTexture = createTexture2D({
474
+ data: new Uint8Array(imageData.data),
475
+ width: imageData.width,
476
+ height: imageData.height,
477
+ wrapS: _l7Core.gl.CLAMP_TO_EDGE,
478
+ wrapT: _l7Core.gl.CLAMP_TO_EDGE,
479
+ min: _l7Core.gl.NEAREST,
480
+ mag: _l7Core.gl.NEAREST,
481
+ flipY: false
482
+ });
483
+ }
484
+ }]);
485
+ return HeatMapModel;
486
+ }(_BaseModel2.default)) || _class);
487
+ exports.default = HeatMapModel;