@antv/l7-layers 2.16.0 → 2.16.1

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 (242) hide show
  1. package/es/Geometry/index.js +31 -9
  2. package/es/Geometry/models/billboard.js +89 -51
  3. package/es/Geometry/models/plane.js +143 -81
  4. package/es/Geometry/models/sprite.js +118 -60
  5. package/es/canvas/index.js +33 -10
  6. package/es/canvas/models/canvas.js +97 -41
  7. package/es/citybuliding/building.js +27 -8
  8. package/es/citybuliding/models/build.js +82 -57
  9. package/es/core/BaseLayer.js +485 -321
  10. package/es/core/BaseModel.js +126 -97
  11. package/es/core/LayerPickService.js +32 -21
  12. package/es/core/TextureService.js +13 -0
  13. package/es/core/interface.js +24 -17
  14. package/es/core/shape/Path.js +20 -13
  15. package/es/core/shape/extrude.js +31 -10
  16. package/es/core/triangulation.js +114 -54
  17. package/es/earth/index.js +33 -9
  18. package/es/earth/models/atmosphere.js +54 -30
  19. package/es/earth/models/base.js +85 -47
  20. package/es/earth/models/bloomsphere.js +54 -30
  21. package/es/earth/utils.js +13 -9
  22. package/es/heatmap/index.js +40 -10
  23. package/es/heatmap/models/grid.js +52 -28
  24. package/es/heatmap/models/grid3d.js +52 -28
  25. package/es/heatmap/models/heatmap.js +146 -91
  26. package/es/heatmap/models/hexagon.js +52 -28
  27. package/es/heatmap/triangulation.js +4 -0
  28. package/es/image/index.js +28 -9
  29. package/es/image/models/image.js +100 -66
  30. package/es/index.js +17 -9
  31. package/es/line/index.js +34 -9
  32. package/es/line/models/arc.js +118 -66
  33. package/es/line/models/arc_3d.js +108 -60
  34. package/es/line/models/earthArc_3d.js +111 -63
  35. package/es/line/models/great_circle.js +100 -56
  36. package/es/line/models/half.js +77 -46
  37. package/es/line/models/line.js +148 -94
  38. package/es/line/models/linearline.js +80 -45
  39. package/es/line/models/simpleLine.js +74 -41
  40. package/es/line/models/wall.js +92 -52
  41. package/es/mask/index.js +28 -9
  42. package/es/mask/models/fill.js +54 -29
  43. package/es/plugins/DataMappingPlugin.js +117 -80
  44. package/es/plugins/DataSourcePlugin.js +68 -45
  45. package/es/plugins/FeatureScalePlugin.js +122 -67
  46. package/es/plugins/LayerAnimateStylePlugin.js +5 -0
  47. package/es/plugins/LayerMaskPlugin.js +11 -3
  48. package/es/plugins/LayerModelPlugin.js +104 -67
  49. package/es/plugins/LayerStylePlugin.js +9 -3
  50. package/es/plugins/LightingPlugin.js +18 -12
  51. package/es/plugins/MultiPassRendererPlugin.js +16 -11
  52. package/es/plugins/PixelPickingPlugin.js +21 -12
  53. package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
  54. package/es/plugins/ShaderUniformPlugin.js +27 -13
  55. package/es/plugins/UpdateModelPlugin.js +5 -0
  56. package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
  57. package/es/point/index.js +77 -26
  58. package/es/point/models/earthExtrude.js +102 -61
  59. package/es/point/models/earthFill.js +87 -57
  60. package/es/point/models/extrude.js +101 -60
  61. package/es/point/models/fill.js +100 -70
  62. package/es/point/models/fillmage.js +107 -63
  63. package/es/point/models/image.js +88 -48
  64. package/es/point/models/index.js +2 -2
  65. package/es/point/models/normal.js +54 -30
  66. package/es/point/models/radar.js +64 -40
  67. package/es/point/models/simplePoint.js +69 -41
  68. package/es/point/models/text.js +301 -198
  69. package/es/point/shape/extrude.js +13 -4
  70. package/es/polygon/index.js +40 -11
  71. package/es/polygon/models/extrude.js +92 -48
  72. package/es/polygon/models/fill.js +88 -54
  73. package/es/polygon/models/index.js +2 -3
  74. package/es/polygon/models/ocean.js +76 -42
  75. package/es/polygon/models/water.js +71 -37
  76. package/es/raster/buffers/triangulation.js +4 -2
  77. package/es/raster/index.js +32 -9
  78. package/es/raster/models/raster.js +116 -80
  79. package/es/raster/models/rasterRgb.js +127 -84
  80. package/es/raster/models/rasterTerrainRgb.js +84 -56
  81. package/es/tile/interaction/getRasterData.js +20 -14
  82. package/es/tile/interaction/utils.js +9 -7
  83. package/es/tile/manager/base.js +96 -63
  84. package/es/tile/service/TileLayerService.js +55 -33
  85. package/es/tile/service/TilePickService.js +40 -26
  86. package/es/tile/service/TileSourceService.js +7 -3
  87. package/es/tile/tileFactory/DebugTile.js +46 -29
  88. package/es/tile/tileFactory/ImageTile.js +38 -20
  89. package/es/tile/tileFactory/MaskTile.js +43 -22
  90. package/es/tile/tileFactory/RasterRGBTile.js +42 -22
  91. package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
  92. package/es/tile/tileFactory/RasterTile.js +53 -30
  93. package/es/tile/tileFactory/Tile.js +97 -63
  94. package/es/tile/tileFactory/VectorTile.js +68 -41
  95. package/es/tile/tileFactory/index.js +11 -0
  96. package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
  97. package/es/tile/tileFactory/util.js +3 -0
  98. package/es/tile/tileLayer/BaseLayer.js +146 -105
  99. package/es/tile/utils.js +1 -1
  100. package/es/utils/blend.js +2 -0
  101. package/es/utils/collision-index.js +16 -9
  102. package/es/utils/dataMappingStyle.js +18 -8
  103. package/es/utils/extrude_polyline.js +149 -101
  104. package/es/utils/grid-index.js +27 -2
  105. package/es/utils/identityScale.js +8 -0
  106. package/es/utils/layerData.js +44 -30
  107. package/es/utils/multiPassRender.js +13 -11
  108. package/es/utils/polylineNormal.js +37 -31
  109. package/es/utils/simpleLine.js +16 -2
  110. package/es/utils/stencil.js +3 -2
  111. package/es/utils/symbol-layout.js +53 -27
  112. package/es/wind/index.js +29 -9
  113. package/es/wind/models/utils.js +51 -26
  114. package/es/wind/models/wind.js +147 -101
  115. package/es/wind/models/windRender.js +66 -53
  116. package/lib/Geometry/index.js +38 -9
  117. package/lib/Geometry/models/billboard.js +97 -51
  118. package/lib/Geometry/models/index.js +5 -0
  119. package/lib/Geometry/models/plane.js +151 -79
  120. package/lib/Geometry/models/sprite.js +127 -60
  121. package/lib/canvas/index.js +40 -10
  122. package/lib/canvas/models/canvas.js +101 -41
  123. package/lib/canvas/models/index.js +3 -0
  124. package/lib/citybuliding/building.js +35 -8
  125. package/lib/citybuliding/models/build.js +92 -57
  126. package/lib/core/BaseLayer.js +479 -321
  127. package/lib/core/BaseModel.js +139 -97
  128. package/lib/core/LayerPickService.js +37 -21
  129. package/lib/core/TextureService.js +16 -0
  130. package/lib/core/interface.js +31 -21
  131. package/lib/core/schema.js +1 -0
  132. package/lib/core/shape/Path.js +31 -14
  133. package/lib/core/shape/extrude.js +54 -10
  134. package/lib/core/triangulation.js +153 -53
  135. package/lib/earth/index.js +43 -9
  136. package/lib/earth/models/atmosphere.js +63 -30
  137. package/lib/earth/models/base.js +90 -47
  138. package/lib/earth/models/bloomsphere.js +63 -30
  139. package/lib/earth/utils.js +31 -7
  140. package/lib/heatmap/index.js +48 -10
  141. package/lib/heatmap/models/grid.js +60 -28
  142. package/lib/heatmap/models/grid3d.js +60 -28
  143. package/lib/heatmap/models/heatmap.js +162 -91
  144. package/lib/heatmap/models/hexagon.js +60 -28
  145. package/lib/heatmap/models/index.js +6 -0
  146. package/lib/heatmap/triangulation.js +5 -0
  147. package/lib/image/index.js +36 -9
  148. package/lib/image/models/image.js +109 -66
  149. package/lib/image/models/index.js +3 -0
  150. package/lib/index.js +61 -7
  151. package/lib/line/index.js +40 -9
  152. package/lib/line/models/arc.js +128 -64
  153. package/lib/line/models/arc_3d.js +119 -58
  154. package/lib/line/models/earthArc_3d.js +122 -61
  155. package/lib/line/models/great_circle.js +111 -56
  156. package/lib/line/models/half.js +87 -46
  157. package/lib/line/models/index.js +11 -0
  158. package/lib/line/models/line.js +156 -92
  159. package/lib/line/models/linearline.js +92 -45
  160. package/lib/line/models/simpleLine.js +84 -41
  161. package/lib/line/models/wall.js +103 -52
  162. package/lib/mask/index.js +36 -9
  163. package/lib/mask/models/fill.js +63 -29
  164. package/lib/mask/models/index.js +3 -0
  165. package/lib/plugins/DataMappingPlugin.js +128 -80
  166. package/lib/plugins/DataSourcePlugin.js +76 -45
  167. package/lib/plugins/FeatureScalePlugin.js +138 -67
  168. package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
  169. package/lib/plugins/LayerMaskPlugin.js +17 -4
  170. package/lib/plugins/LayerModelPlugin.js +113 -68
  171. package/lib/plugins/LayerStylePlugin.js +14 -4
  172. package/lib/plugins/LightingPlugin.js +25 -12
  173. package/lib/plugins/MultiPassRendererPlugin.js +22 -11
  174. package/lib/plugins/PixelPickingPlugin.js +27 -12
  175. package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
  176. package/lib/plugins/ShaderUniformPlugin.js +34 -13
  177. package/lib/plugins/UpdateModelPlugin.js +10 -1
  178. package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
  179. package/lib/point/index.js +83 -26
  180. package/lib/point/models/earthExtrude.js +113 -61
  181. package/lib/point/models/earthFill.js +117 -57
  182. package/lib/point/models/extrude.js +111 -60
  183. package/lib/point/models/fill.js +109 -68
  184. package/lib/point/models/fillmage.js +115 -61
  185. package/lib/point/models/image.js +98 -48
  186. package/lib/point/models/index.js +12 -1
  187. package/lib/point/models/normal.js +64 -30
  188. package/lib/point/models/radar.js +74 -40
  189. package/lib/point/models/simplePoint.js +79 -41
  190. package/lib/point/models/text.js +309 -198
  191. package/lib/point/shape/extrude.js +20 -4
  192. package/lib/polygon/index.js +48 -11
  193. package/lib/polygon/models/extrude.js +103 -48
  194. package/lib/polygon/models/fill.js +98 -54
  195. package/lib/polygon/models/index.js +14 -2
  196. package/lib/polygon/models/ocean.js +88 -42
  197. package/lib/polygon/models/water.js +82 -37
  198. package/lib/raster/buffers/triangulation.js +7 -3
  199. package/lib/raster/index.js +40 -9
  200. package/lib/raster/models/index.js +5 -0
  201. package/lib/raster/models/raster.js +125 -80
  202. package/lib/raster/models/rasterRgb.js +139 -84
  203. package/lib/raster/models/rasterTerrainRgb.js +93 -56
  204. package/lib/tile/interaction/getRasterData.js +25 -14
  205. package/lib/tile/interaction/utils.js +19 -7
  206. package/lib/tile/manager/base.js +104 -63
  207. package/lib/tile/service/TileLayerService.js +60 -33
  208. package/lib/tile/service/TilePickService.js +48 -26
  209. package/lib/tile/service/TileSourceService.js +16 -2
  210. package/lib/tile/style/utils.js +3 -0
  211. package/lib/tile/tileFactory/DebugTile.js +54 -29
  212. package/lib/tile/tileFactory/ImageTile.js +46 -20
  213. package/lib/tile/tileFactory/MaskTile.js +51 -22
  214. package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
  215. package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
  216. package/lib/tile/tileFactory/RasterTile.js +63 -30
  217. package/lib/tile/tileFactory/Tile.js +102 -63
  218. package/lib/tile/tileFactory/VectorTile.js +76 -41
  219. package/lib/tile/tileFactory/index.js +25 -0
  220. package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
  221. package/lib/tile/tileFactory/util.js +9 -0
  222. package/lib/tile/tileLayer/BaseLayer.js +153 -105
  223. package/lib/tile/utils.js +5 -1
  224. package/lib/utils/blend.js +5 -0
  225. package/lib/utils/collision-index.js +25 -9
  226. package/lib/utils/dataMappingStyle.js +19 -8
  227. package/lib/utils/extrude_polyline.js +181 -101
  228. package/lib/utils/grid-index.js +28 -2
  229. package/lib/utils/identityScale.js +9 -0
  230. package/lib/utils/layerData.js +49 -30
  231. package/lib/utils/multiPassRender.js +16 -11
  232. package/lib/utils/polylineNormal.js +66 -31
  233. package/lib/utils/simpleLine.js +21 -2
  234. package/lib/utils/stencil.js +4 -0
  235. package/lib/utils/symbol-layout.js +55 -27
  236. package/lib/wind/index.js +37 -9
  237. package/lib/wind/models/index.js +3 -0
  238. package/lib/wind/models/utils.js +62 -26
  239. package/lib/wind/models/wind.js +157 -101
  240. package/lib/wind/models/windRender.js +71 -53
  241. package/lib/wind/models/windShader.js +1 -0
  242. package/package.json +7 -7
@@ -7,14 +7,19 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
9
  import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+
10
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
11
13
  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; } }
14
+
12
15
  import { AttributeType, gl } from '@antv/l7-core';
13
16
  import { FrequencyController } from '@antv/l7-utils';
14
17
  import BaseModel from "../../core/BaseModel";
15
18
  import { RasterImageTriangulation } from "../../core/triangulation";
19
+
16
20
  /* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
17
21
  var WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
22
+
18
23
  /* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
19
24
  var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
20
25
  import { Wind } from "./windRender";
@@ -28,26 +33,37 @@ var defaultRampColors = {
28
33
  0.6: '#f46d43',
29
34
  1.0: '#d53e4f'
30
35
  };
36
+
31
37
  var WindModel = /*#__PURE__*/function (_BaseModel) {
32
38
  _inherits(WindModel, _BaseModel);
39
+
33
40
  var _super = _createSuper(WindModel);
41
+
34
42
  function WindModel() {
35
43
  var _this;
44
+
36
45
  _classCallCheck(this, WindModel);
46
+
37
47
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
48
  args[_key] = arguments[_key];
39
49
  }
50
+
40
51
  _this = _super.call.apply(_super, [this].concat(args));
52
+
41
53
  _defineProperty(_assertThisInitialized(_this), "sizeScale", 0.5);
54
+
42
55
  _defineProperty(_assertThisInitialized(_this), "frequency", new FrequencyController(7.2));
56
+
43
57
  return _this;
44
58
  }
59
+
45
60
  _createClass(WindModel, [{
46
61
  key: "render",
47
62
  value: function render(options) {
48
63
  var _this2 = this;
49
- this.drawColorMode(options);
50
- // Tip: 控制风场的平均更新频率
64
+
65
+ this.drawColorMode(options); // Tip: 控制风场的平均更新频率
66
+
51
67
  this.frequency.run(function () {
52
68
  _this2.drawWind();
53
69
  });
@@ -62,80 +78,92 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
62
78
  value: function () {
63
79
  var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
64
80
  var _source$data,
65
- _source$data2,
66
- _source$data2$images,
67
- _this3 = this;
81
+ _source$data2,
82
+ _source$data2$images,
83
+ _this3 = this;
84
+
68
85
  var _ref, _ref$uMin, uMin, _ref$uMax, uMax, _ref$vMin, vMin, _ref$vMax, vMax, _ref$fadeOpacity, fadeOpacity, _ref$speedFactor, speedFactor, _ref$dropRate, dropRate, _ref$dropRateBump, dropRateBump, _ref$rampColors, rampColors, _ref$sizeScale, sizeScale, createTexture2D, source, glContext, model;
86
+
69
87
  return _regeneratorRuntime.wrap(function _callee$(_context) {
70
- while (1) switch (_context.prev = _context.next) {
71
- case 0:
72
- _ref = this.layer.getLayerConfig(), _ref$uMin = _ref.uMin, uMin = _ref$uMin === void 0 ? -21.32 : _ref$uMin, _ref$uMax = _ref.uMax, uMax = _ref$uMax === void 0 ? 26.8 : _ref$uMax, _ref$vMin = _ref.vMin, vMin = _ref$vMin === void 0 ? -21.57 : _ref$vMin, _ref$vMax = _ref.vMax, vMax = _ref$vMax === void 0 ? 21.42 : _ref$vMax, _ref$fadeOpacity = _ref.fadeOpacity, fadeOpacity = _ref$fadeOpacity === void 0 ? 0.996 : _ref$fadeOpacity, _ref$speedFactor = _ref.speedFactor, speedFactor = _ref$speedFactor === void 0 ? 0.25 : _ref$speedFactor, _ref$dropRate = _ref.dropRate, dropRate = _ref$dropRate === void 0 ? 0.003 : _ref$dropRate, _ref$dropRateBump = _ref.dropRateBump, dropRateBump = _ref$dropRateBump === void 0 ? 0.01 : _ref$dropRateBump, _ref$rampColors = _ref.rampColors, rampColors = _ref$rampColors === void 0 ? defaultRampColors : _ref$rampColors, _ref$sizeScale = _ref.sizeScale, sizeScale = _ref$sizeScale === void 0 ? 0.5 : _ref$sizeScale;
73
- createTexture2D = this.rendererService.createTexture2D;
74
- source = this.layer.getSource();
75
- this.texture = createTexture2D({
76
- height: 0,
77
- width: 0
78
- });
79
- this.cacheZoom = Math.floor(this.mapService.getZoom());
80
- glContext = this.rendererService.getGLContext();
81
- this.imageCoords = (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.dataArray[0].coordinates;
82
- (_source$data2 = source.data) === null || _source$data2 === void 0 ? void 0 : (_source$data2$images = _source$data2.images) === null || _source$data2$images === void 0 ? void 0 : _source$data2$images.then(function (imageData) {
83
- var _this3$texture;
84
- _this3.sizeScale = sizeScale * _this3.getZoomScale();
85
- var _this3$getWindSize = _this3.getWindSize(),
86
- imageWidth = _this3$getWindSize.imageWidth,
87
- imageHeight = _this3$getWindSize.imageHeight;
88
- var options = {
89
- glContext: glContext,
90
- imageWidth: imageWidth,
91
- imageHeight: imageHeight,
92
- fadeOpacity: fadeOpacity,
93
- speedFactor: speedFactor,
94
- dropRate: dropRate,
95
- dropRateBump: dropRateBump,
96
- rampColors: rampColors
97
- };
98
- _this3.wind = new Wind(options);
99
-
100
- // imageData[0] 风场图
101
- _this3.wind.setWind({
102
- uMin: uMin,
103
- uMax: uMax,
104
- vMin: vMin,
105
- vMax: vMax,
106
- image: imageData[0]
88
+ while (1) {
89
+ switch (_context.prev = _context.next) {
90
+ case 0:
91
+ _ref = this.layer.getLayerConfig(), _ref$uMin = _ref.uMin, uMin = _ref$uMin === void 0 ? -21.32 : _ref$uMin, _ref$uMax = _ref.uMax, uMax = _ref$uMax === void 0 ? 26.8 : _ref$uMax, _ref$vMin = _ref.vMin, vMin = _ref$vMin === void 0 ? -21.57 : _ref$vMin, _ref$vMax = _ref.vMax, vMax = _ref$vMax === void 0 ? 21.42 : _ref$vMax, _ref$fadeOpacity = _ref.fadeOpacity, fadeOpacity = _ref$fadeOpacity === void 0 ? 0.996 : _ref$fadeOpacity, _ref$speedFactor = _ref.speedFactor, speedFactor = _ref$speedFactor === void 0 ? 0.25 : _ref$speedFactor, _ref$dropRate = _ref.dropRate, dropRate = _ref$dropRate === void 0 ? 0.003 : _ref$dropRate, _ref$dropRateBump = _ref.dropRateBump, dropRateBump = _ref$dropRateBump === void 0 ? 0.01 : _ref$dropRateBump, _ref$rampColors = _ref.rampColors, rampColors = _ref$rampColors === void 0 ? defaultRampColors : _ref$rampColors, _ref$sizeScale = _ref.sizeScale, sizeScale = _ref$sizeScale === void 0 ? 0.5 : _ref$sizeScale;
92
+ createTexture2D = this.rendererService.createTexture2D;
93
+ source = this.layer.getSource();
94
+ this.texture = createTexture2D({
95
+ height: 0,
96
+ width: 0
107
97
  });
108
- (_this3$texture = _this3.texture) === null || _this3$texture === void 0 ? void 0 : _this3$texture.destroy();
109
- _this3.texture = createTexture2D({
110
- width: imageWidth,
111
- height: imageHeight
98
+ this.cacheZoom = Math.floor(this.mapService.getZoom());
99
+ glContext = this.rendererService.getGLContext();
100
+ this.imageCoords = (_source$data = source.data) === null || _source$data === void 0 ? void 0 : _source$data.dataArray[0].coordinates;
101
+ (_source$data2 = source.data) === null || _source$data2 === void 0 ? void 0 : (_source$data2$images = _source$data2.images) === null || _source$data2$images === void 0 ? void 0 : _source$data2$images.then(function (imageData) {
102
+ var _this3$texture;
103
+
104
+ _this3.sizeScale = sizeScale * _this3.getZoomScale();
105
+
106
+ var _this3$getWindSize = _this3.getWindSize(),
107
+ imageWidth = _this3$getWindSize.imageWidth,
108
+ imageHeight = _this3$getWindSize.imageHeight;
109
+
110
+ var options = {
111
+ glContext: glContext,
112
+ imageWidth: imageWidth,
113
+ imageHeight: imageHeight,
114
+ fadeOpacity: fadeOpacity,
115
+ speedFactor: speedFactor,
116
+ dropRate: dropRate,
117
+ dropRateBump: dropRateBump,
118
+ rampColors: rampColors
119
+ };
120
+ _this3.wind = new Wind(options); // imageData[0] 风场图
121
+
122
+ _this3.wind.setWind({
123
+ uMin: uMin,
124
+ uMax: uMax,
125
+ vMin: vMin,
126
+ vMax: vMax,
127
+ image: imageData[0]
128
+ });
129
+
130
+ (_this3$texture = _this3.texture) === null || _this3$texture === void 0 ? void 0 : _this3$texture.destroy();
131
+ _this3.texture = createTexture2D({
132
+ width: imageWidth,
133
+ height: imageHeight
134
+ });
135
+
136
+ _this3.layerService.reRender();
137
+ });
138
+ _context.next = 10;
139
+ return this.layer.buildLayerModel({
140
+ moduleName: 'wind',
141
+ vertexShader: WindVert,
142
+ fragmentShader: WindFrag,
143
+ triangulation: RasterImageTriangulation,
144
+ primitive: gl.TRIANGLES,
145
+ depth: {
146
+ enable: false
147
+ }
112
148
  });
113
- _this3.layerService.reRender();
114
- });
115
- _context.next = 10;
116
- return this.layer.buildLayerModel({
117
- moduleName: 'wind',
118
- vertexShader: WindVert,
119
- fragmentShader: WindFrag,
120
- triangulation: RasterImageTriangulation,
121
- primitive: gl.TRIANGLES,
122
- depth: {
123
- enable: false
124
- }
125
- });
126
- case 10:
127
- model = _context.sent;
128
- this.colorModel = model;
129
- return _context.abrupt("return", [model]);
130
- case 13:
131
- case "end":
132
- return _context.stop();
149
+
150
+ case 10:
151
+ model = _context.sent;
152
+ this.colorModel = model;
153
+ return _context.abrupt("return", [model]);
154
+
155
+ case 13:
156
+ case "end":
157
+ return _context.stop();
158
+ }
133
159
  }
134
160
  }, _callee, this);
135
161
  }));
162
+
136
163
  function initModels() {
137
164
  return _initModels.apply(this, arguments);
138
165
  }
166
+
139
167
  return initModels;
140
168
  }()
141
169
  }, {
@@ -155,24 +183,30 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
155
183
  value: function () {
156
184
  var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
157
185
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
158
- while (1) switch (_context2.prev = _context2.next) {
159
- case 0:
160
- return _context2.abrupt("return", this.initModels());
161
- case 1:
162
- case "end":
163
- return _context2.stop();
186
+ while (1) {
187
+ switch (_context2.prev = _context2.next) {
188
+ case 0:
189
+ return _context2.abrupt("return", this.initModels());
190
+
191
+ case 1:
192
+ case "end":
193
+ return _context2.stop();
194
+ }
164
195
  }
165
196
  }, _callee2, this);
166
197
  }));
198
+
167
199
  function buildModels() {
168
200
  return _buildModels.apply(this, arguments);
169
201
  }
202
+
170
203
  return buildModels;
171
204
  }()
172
205
  }, {
173
206
  key: "clearModels",
174
207
  value: function clearModels() {
175
208
  var _this$texture, _this$wind;
209
+
176
210
  (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
177
211
  (_this$wind = this.wind) === null || _this$wind === void 0 ? void 0 : _this$wind.destroy();
178
212
  }
@@ -208,40 +242,45 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
208
242
  value: function drawWind() {
209
243
  if (this.wind) {
210
244
  var _ref2 = this.layer.getLayerConfig(),
211
- _ref2$uMin = _ref2.uMin,
212
- uMin = _ref2$uMin === void 0 ? -21.32 : _ref2$uMin,
213
- _ref2$uMax = _ref2.uMax,
214
- uMax = _ref2$uMax === void 0 ? 26.8 : _ref2$uMax,
215
- _ref2$vMin = _ref2.vMin,
216
- vMin = _ref2$vMin === void 0 ? -21.57 : _ref2$vMin,
217
- _ref2$vMax = _ref2.vMax,
218
- vMax = _ref2$vMax === void 0 ? 21.42 : _ref2$vMax,
219
- _ref2$numParticles = _ref2.numParticles,
220
- numParticles = _ref2$numParticles === void 0 ? 65535 : _ref2$numParticles,
221
- _ref2$fadeOpacity = _ref2.fadeOpacity,
222
- fadeOpacity = _ref2$fadeOpacity === void 0 ? 0.996 : _ref2$fadeOpacity,
223
- _ref2$speedFactor = _ref2.speedFactor,
224
- speedFactor = _ref2$speedFactor === void 0 ? 0.25 : _ref2$speedFactor,
225
- _ref2$dropRate = _ref2.dropRate,
226
- dropRate = _ref2$dropRate === void 0 ? 0.003 : _ref2$dropRate,
227
- _ref2$dropRateBump = _ref2.dropRateBump,
228
- dropRateBump = _ref2$dropRateBump === void 0 ? 0.01 : _ref2$dropRateBump,
229
- _ref2$rampColors = _ref2.rampColors,
230
- rampColors = _ref2$rampColors === void 0 ? defaultRampColors : _ref2$rampColors,
231
- _ref2$sizeScale = _ref2.sizeScale,
232
- sizeScale = _ref2$sizeScale === void 0 ? 0.5 : _ref2$sizeScale;
245
+ _ref2$uMin = _ref2.uMin,
246
+ uMin = _ref2$uMin === void 0 ? -21.32 : _ref2$uMin,
247
+ _ref2$uMax = _ref2.uMax,
248
+ uMax = _ref2$uMax === void 0 ? 26.8 : _ref2$uMax,
249
+ _ref2$vMin = _ref2.vMin,
250
+ vMin = _ref2$vMin === void 0 ? -21.57 : _ref2$vMin,
251
+ _ref2$vMax = _ref2.vMax,
252
+ vMax = _ref2$vMax === void 0 ? 21.42 : _ref2$vMax,
253
+ _ref2$numParticles = _ref2.numParticles,
254
+ numParticles = _ref2$numParticles === void 0 ? 65535 : _ref2$numParticles,
255
+ _ref2$fadeOpacity = _ref2.fadeOpacity,
256
+ fadeOpacity = _ref2$fadeOpacity === void 0 ? 0.996 : _ref2$fadeOpacity,
257
+ _ref2$speedFactor = _ref2.speedFactor,
258
+ speedFactor = _ref2$speedFactor === void 0 ? 0.25 : _ref2$speedFactor,
259
+ _ref2$dropRate = _ref2.dropRate,
260
+ dropRate = _ref2$dropRate === void 0 ? 0.003 : _ref2$dropRate,
261
+ _ref2$dropRateBump = _ref2.dropRateBump,
262
+ dropRateBump = _ref2$dropRateBump === void 0 ? 0.01 : _ref2$dropRateBump,
263
+ _ref2$rampColors = _ref2.rampColors,
264
+ rampColors = _ref2$rampColors === void 0 ? defaultRampColors : _ref2$rampColors,
265
+ _ref2$sizeScale = _ref2.sizeScale,
266
+ sizeScale = _ref2$sizeScale === void 0 ? 0.5 : _ref2$sizeScale;
267
+
233
268
  var newNumParticles = numParticles;
234
269
  var currentZoom = Math.floor(this.mapService.getZoom());
270
+
235
271
  if (typeof sizeScale === 'number' && sizeScale !== this.sizeScale || currentZoom !== this.cacheZoom) {
236
272
  var zoomScale = this.getZoomScale();
237
273
  this.sizeScale = sizeScale;
238
274
  newNumParticles *= zoomScale;
275
+
239
276
  var _this$getWindSize = this.getWindSize(),
240
- imageWidth = _this$getWindSize.imageWidth,
241
- imageHeight = _this$getWindSize.imageHeight;
277
+ imageWidth = _this$getWindSize.imageWidth,
278
+ imageHeight = _this$getWindSize.imageHeight;
279
+
242
280
  this.wind.reSize(imageWidth, imageHeight);
243
281
  this.cacheZoom = currentZoom;
244
282
  }
283
+
245
284
  this.wind.updateWindDir(uMin, uMax, vMin, vMax);
246
285
  this.wind.updateParticelNum(newNumParticles);
247
286
  this.wind.updateColorRampTexture(rampColors);
@@ -249,11 +288,13 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
249
288
  this.wind.speedFactor = speedFactor;
250
289
  this.wind.dropRate = dropRate;
251
290
  this.wind.dropRateBump = dropRateBump;
291
+
252
292
  var _this$wind$draw = this.wind.draw(),
253
- d = _this$wind$draw.d,
254
- w = _this$wind$draw.w,
255
- h = _this$wind$draw.h;
256
- // 恢复 L7 渲染流程中 gl 状态
293
+ d = _this$wind$draw.d,
294
+ w = _this$wind$draw.w,
295
+ h = _this$wind$draw.h; // 恢复 L7 渲染流程中 gl 状态
296
+
297
+
257
298
  this.rendererService.setBaseState();
258
299
  this.texture.update({
259
300
  data: d,
@@ -266,9 +307,12 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
266
307
  key: "drawColorMode",
267
308
  value: function drawColorMode() {
268
309
  var _this$colorModel;
310
+
269
311
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
312
+
270
313
  var _ref3 = this.layer.getLayerConfig(),
271
- opacity = _ref3.opacity;
314
+ opacity = _ref3.opacity;
315
+
272
316
  this.layerService.beforeRenderData(this.layer);
273
317
  this.layer.hooks.beforeRender.call();
274
318
  this.layerService.renderMask(this.layer.masks);
@@ -283,6 +327,8 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
283
327
  this.layer.hooks.afterRender.call();
284
328
  }
285
329
  }]);
330
+
286
331
  return WindModel;
287
332
  }(BaseModel);
333
+
288
334
  export { WindModel as default };