@antv/l7-layers 2.15.2 → 2.15.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 +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +320 -484
- package/es/core/BaseModel.js +97 -126
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +10 -31
- package/es/core/triangulation.js +54 -114
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +91 -146
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.js +197 -299
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/dataMappingStyle.js +8 -18
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +320 -478
- package/lib/core/BaseModel.js +97 -139
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +10 -54
- package/lib/core/triangulation.js +53 -153
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +91 -162
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +80 -128
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +197 -307
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +30 -57
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +28 -53
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/dataMappingStyle.js +8 -19
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/es/wind/models/wind.js
CHANGED
|
@@ -7,19 +7,14 @@ 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
|
-
|
|
11
10
|
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
|
-
|
|
13
11
|
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
|
-
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { FrequencyController } from '@antv/l7-utils';
|
|
17
14
|
import BaseModel from "../../core/BaseModel";
|
|
18
15
|
import { RasterImageTriangulation } from "../../core/triangulation";
|
|
19
|
-
|
|
20
16
|
/* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
|
|
21
17
|
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
|
-
|
|
23
18
|
/* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
|
|
24
19
|
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";
|
|
25
20
|
import { Wind } from "./windRender";
|
|
@@ -33,37 +28,26 @@ var defaultRampColors = {
|
|
|
33
28
|
0.6: '#f46d43',
|
|
34
29
|
1.0: '#d53e4f'
|
|
35
30
|
};
|
|
36
|
-
|
|
37
31
|
var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
38
32
|
_inherits(WindModel, _BaseModel);
|
|
39
|
-
|
|
40
33
|
var _super = _createSuper(WindModel);
|
|
41
|
-
|
|
42
34
|
function WindModel() {
|
|
43
35
|
var _this;
|
|
44
|
-
|
|
45
36
|
_classCallCheck(this, WindModel);
|
|
46
|
-
|
|
47
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
38
|
args[_key] = arguments[_key];
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
52
|
-
|
|
53
41
|
_defineProperty(_assertThisInitialized(_this), "sizeScale", 0.5);
|
|
54
|
-
|
|
55
42
|
_defineProperty(_assertThisInitialized(_this), "frequency", new FrequencyController(7.2));
|
|
56
|
-
|
|
57
43
|
return _this;
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
_createClass(WindModel, [{
|
|
61
46
|
key: "render",
|
|
62
47
|
value: function render(options) {
|
|
63
48
|
var _this2 = this;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
this.drawColorMode(options);
|
|
50
|
+
// Tip: 控制风场的平均更新频率
|
|
67
51
|
this.frequency.run(function () {
|
|
68
52
|
_this2.drawWind();
|
|
69
53
|
});
|
|
@@ -78,92 +62,80 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
78
62
|
value: function () {
|
|
79
63
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
80
64
|
var _source$data,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
_source$data2,
|
|
66
|
+
_source$data2$images,
|
|
67
|
+
_this3 = this;
|
|
85
68
|
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
|
-
|
|
87
69
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
88
|
-
while (1) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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]
|
|
97
107
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
}
|
|
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
|
|
148
112
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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();
|
|
159
133
|
}
|
|
160
134
|
}, _callee, this);
|
|
161
135
|
}));
|
|
162
|
-
|
|
163
136
|
function initModels() {
|
|
164
137
|
return _initModels.apply(this, arguments);
|
|
165
138
|
}
|
|
166
|
-
|
|
167
139
|
return initModels;
|
|
168
140
|
}()
|
|
169
141
|
}, {
|
|
@@ -183,30 +155,24 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
183
155
|
value: function () {
|
|
184
156
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
185
157
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
186
|
-
while (1) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
case "end":
|
|
193
|
-
return _context2.stop();
|
|
194
|
-
}
|
|
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();
|
|
195
164
|
}
|
|
196
165
|
}, _callee2, this);
|
|
197
166
|
}));
|
|
198
|
-
|
|
199
167
|
function buildModels() {
|
|
200
168
|
return _buildModels.apply(this, arguments);
|
|
201
169
|
}
|
|
202
|
-
|
|
203
170
|
return buildModels;
|
|
204
171
|
}()
|
|
205
172
|
}, {
|
|
206
173
|
key: "clearModels",
|
|
207
174
|
value: function clearModels() {
|
|
208
175
|
var _this$texture, _this$wind;
|
|
209
|
-
|
|
210
176
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
211
177
|
(_this$wind = this.wind) === null || _this$wind === void 0 ? void 0 : _this$wind.destroy();
|
|
212
178
|
}
|
|
@@ -242,45 +208,40 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
242
208
|
value: function drawWind() {
|
|
243
209
|
if (this.wind) {
|
|
244
210
|
var _ref2 = this.layer.getLayerConfig(),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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;
|
|
268
233
|
var newNumParticles = numParticles;
|
|
269
234
|
var currentZoom = Math.floor(this.mapService.getZoom());
|
|
270
|
-
|
|
271
235
|
if (typeof sizeScale === 'number' && sizeScale !== this.sizeScale || currentZoom !== this.cacheZoom) {
|
|
272
236
|
var zoomScale = this.getZoomScale();
|
|
273
237
|
this.sizeScale = sizeScale;
|
|
274
238
|
newNumParticles *= zoomScale;
|
|
275
|
-
|
|
276
239
|
var _this$getWindSize = this.getWindSize(),
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
240
|
+
imageWidth = _this$getWindSize.imageWidth,
|
|
241
|
+
imageHeight = _this$getWindSize.imageHeight;
|
|
280
242
|
this.wind.reSize(imageWidth, imageHeight);
|
|
281
243
|
this.cacheZoom = currentZoom;
|
|
282
244
|
}
|
|
283
|
-
|
|
284
245
|
this.wind.updateWindDir(uMin, uMax, vMin, vMax);
|
|
285
246
|
this.wind.updateParticelNum(newNumParticles);
|
|
286
247
|
this.wind.updateColorRampTexture(rampColors);
|
|
@@ -288,13 +249,11 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
288
249
|
this.wind.speedFactor = speedFactor;
|
|
289
250
|
this.wind.dropRate = dropRate;
|
|
290
251
|
this.wind.dropRateBump = dropRateBump;
|
|
291
|
-
|
|
292
252
|
var _this$wind$draw = this.wind.draw(),
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
253
|
+
d = _this$wind$draw.d,
|
|
254
|
+
w = _this$wind$draw.w,
|
|
255
|
+
h = _this$wind$draw.h;
|
|
256
|
+
// 恢复 L7 渲染流程中 gl 状态
|
|
298
257
|
this.rendererService.setBaseState();
|
|
299
258
|
this.texture.update({
|
|
300
259
|
data: d,
|
|
@@ -307,12 +266,9 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
307
266
|
key: "drawColorMode",
|
|
308
267
|
value: function drawColorMode() {
|
|
309
268
|
var _this$colorModel;
|
|
310
|
-
|
|
311
269
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
312
|
-
|
|
313
270
|
var _ref3 = this.layer.getLayerConfig(),
|
|
314
|
-
|
|
315
|
-
|
|
271
|
+
opacity = _ref3.opacity;
|
|
316
272
|
this.layerService.beforeRenderData(this.layer);
|
|
317
273
|
this.layer.hooks.beforeRender.call();
|
|
318
274
|
this.layerService.renderMask(this.layer.masks);
|
|
@@ -327,8 +283,6 @@ var WindModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
327
283
|
this.layer.hooks.afterRender.call();
|
|
328
284
|
}
|
|
329
285
|
}]);
|
|
330
|
-
|
|
331
286
|
return WindModel;
|
|
332
287
|
}(BaseModel);
|
|
333
|
-
|
|
334
288
|
export { WindModel as default };
|