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