@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-alpha.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.
- package/es/heatmap/models/heatmap.js +1 -1
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/utils.js +1 -1
- package/lib/Geometry/index.js +114 -77
- package/lib/Geometry/models/billboard.js +232 -181
- package/lib/Geometry/models/index.js +18 -34
- package/lib/Geometry/models/plane.js +407 -278
- package/lib/Geometry/models/sprite.js +291 -189
- package/lib/canvas/index.js +101 -66
- package/lib/canvas/models/canvas.js +207 -140
- package/lib/canvas/models/index.js +12 -30
- package/lib/citybuliding/building.js +98 -63
- package/lib/citybuliding/models/build.js +192 -146
- package/lib/core/BaseLayer.js +1331 -814
- package/lib/core/BaseModel.js +457 -279
- package/lib/core/interface.js +40 -53
- package/lib/core/schema.js +21 -39
- package/lib/core/shape/Path.js +67 -79
- package/lib/core/shape/extrude.js +132 -91
- package/lib/core/triangulation.js +378 -196
- package/lib/earth/index.js +100 -62
- package/lib/earth/models/atmosphere.js +146 -112
- package/lib/earth/models/base.js +210 -150
- package/lib/earth/models/bloomsphere.js +146 -112
- package/lib/earth/utils.js +111 -91
- package/lib/heatmap/index.js +149 -92
- package/lib/heatmap/models/grid.js +118 -91
- package/lib/heatmap/models/grid3d.js +155 -123
- package/lib/heatmap/models/heatmap.js +475 -338
- package/lib/heatmap/models/hexagon.js +121 -92
- package/lib/heatmap/models/index.js +22 -37
- package/lib/heatmap/triangulation.js +31 -47
- package/lib/image/index.js +111 -74
- package/lib/image/models/dataImage.js +232 -174
- package/lib/image/models/image.js +175 -128
- package/lib/image/models/index.js +15 -32
- package/lib/index.js +263 -97
- package/lib/line/index.js +131 -85
- package/lib/line/models/arc.js +352 -237
- package/lib/line/models/arc_3d.js +334 -228
- package/lib/line/models/earthArc_3d.js +336 -228
- package/lib/line/models/great_circle.js +291 -200
- package/lib/line/models/half.js +286 -201
- package/lib/line/models/index.js +42 -50
- package/lib/line/models/line.js +428 -299
- package/lib/line/models/linearline.js +277 -203
- package/lib/line/models/simpleLine.js +239 -175
- package/lib/line/models/tile.js +348 -237
- package/lib/line/models/wall.js +327 -235
- package/lib/mask/index.js +92 -59
- package/lib/mask/models/fill.js +134 -82
- package/lib/mask/models/index.js +12 -30
- package/lib/plugins/DataMappingPlugin.js +342 -224
- package/lib/plugins/DataSourcePlugin.js +102 -87
- package/lib/plugins/FeatureScalePlugin.js +330 -240
- package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
- package/lib/plugins/LayerModelPlugin.js +80 -73
- package/lib/plugins/LayerStylePlugin.js +48 -51
- package/lib/plugins/LightingPlugin.js +80 -68
- package/lib/plugins/MultiPassRendererPlugin.js +91 -65
- package/lib/plugins/PixelPickingPlugin.js +150 -109
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
- package/lib/plugins/ShaderUniformPlugin.js +118 -99
- package/lib/plugins/UpdateModelPlugin.js +40 -47
- package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
- package/lib/point/index.js +226 -150
- package/lib/point/models/earthExtrude.js +279 -201
- package/lib/point/models/earthFill.js +287 -202
- package/lib/point/models/extrude.js +299 -203
- package/lib/point/models/fill.js +406 -275
- package/lib/point/models/fillmage.js +365 -256
- package/lib/point/models/image.js +241 -168
- package/lib/point/models/index.js +46 -52
- package/lib/point/models/normal.js +183 -134
- package/lib/point/models/radar.js +304 -211
- package/lib/point/models/simplePoint.js +194 -142
- package/lib/point/models/text.js +608 -385
- package/lib/point/models/tile.js +314 -223
- package/lib/point/shape/extrude.js +56 -52
- package/lib/polygon/index.js +154 -102
- package/lib/polygon/models/extrude.js +311 -223
- package/lib/polygon/models/fill.js +215 -153
- package/lib/polygon/models/index.js +46 -52
- package/lib/polygon/models/ocean.js +244 -173
- package/lib/polygon/models/tile.js +144 -100
- package/lib/polygon/models/water.js +222 -153
- package/lib/raster/buffers/triangulation.js +27 -40
- package/lib/raster/index.js +115 -75
- package/lib/raster/models/index.js +16 -33
- package/lib/raster/models/raster.js +178 -135
- package/lib/raster/raster.js +187 -132
- package/lib/tile/interface.js +4 -16
- package/lib/tile/manager/tileConfigManager.js +125 -86
- package/lib/tile/manager/tileLayerManager.js +313 -229
- package/lib/tile/manager/tilePickerManager.js +192 -123
- package/lib/tile/models/tileModel.js +71 -52
- package/lib/tile/tileFactory/base.js +432 -309
- package/lib/tile/tileFactory/index.js +51 -49
- package/lib/tile/tileFactory/line.js +65 -50
- package/lib/tile/tileFactory/point.js +65 -50
- package/lib/tile/tileFactory/polygon.js +65 -50
- package/lib/tile/tileFactory/raster.js +66 -54
- package/lib/tile/tileFactory/rasterData.js +88 -76
- package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
- package/lib/tile/tileFactory/vectorLayer.js +168 -109
- package/lib/tile/tileLayer/baseTileLayer.js +420 -221
- package/lib/tile/tmsTileLayer.js +110 -67
- package/lib/tile/utils.js +110 -92
- package/lib/utils/blend.js +59 -79
- package/lib/utils/collision-index.js +107 -64
- package/lib/utils/dataMappingStyle.js +105 -60
- package/lib/utils/extrude_polyline.js +600 -398
- package/lib/utils/grid-index.js +163 -111
- package/lib/utils/layerData.js +130 -99
- package/lib/utils/multiPassRender.js +49 -41
- package/lib/utils/polylineNormal.js +148 -96
- package/lib/utils/simpleLine.js +100 -85
- package/lib/utils/symbol-layout.js +219 -116
- package/lib/utils/updateShape.js +15 -41
- package/lib/wind/index.js +109 -71
- package/lib/wind/models/index.js +12 -30
- package/lib/wind/models/utils.js +144 -105
- package/lib/wind/models/wind.js +333 -224
- package/lib/wind/models/windRender.js +329 -218
- package/lib/wind/models/windShader.js +23 -181
- package/package.json +6 -6
package/lib/earth/utils.js
CHANGED
|
@@ -1,116 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/earth/utils.ts
|
|
20
|
-
var utils_exports = {};
|
|
21
|
-
__export(utils_exports, {
|
|
22
|
-
EARTH_RADIUS: () => EARTH_RADIUS,
|
|
23
|
-
EARTH_RADIUS_OUTER: () => EARTH_RADIUS_OUTER,
|
|
24
|
-
EARTH_SEGMENTS: () => EARTH_SEGMENTS,
|
|
25
|
-
lglt2xyz: () => lglt2xyz,
|
|
26
|
-
primitiveSphere: () => primitiveSphere
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
27
7
|
});
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
exports.EARTH_SEGMENTS = exports.EARTH_RADIUS_OUTER = exports.EARTH_RADIUS = void 0;
|
|
9
|
+
exports.lglt2xyz = lglt2xyz;
|
|
10
|
+
exports.primitiveSphere = primitiveSphere;
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _glMatrix = require("gl-matrix");
|
|
15
|
+
|
|
16
|
+
// 该文件专门记录地球模式的数值
|
|
17
|
+
// 地球网格半径
|
|
30
18
|
var EARTH_RADIUS = 100;
|
|
19
|
+
exports.EARTH_RADIUS = EARTH_RADIUS;
|
|
31
20
|
var EARTH_SEGMENTS = 36;
|
|
21
|
+
exports.EARTH_SEGMENTS = EARTH_SEGMENTS;
|
|
32
22
|
var EARTH_RADIUS_OUTER = 40;
|
|
23
|
+
/**
|
|
24
|
+
* 角度转弧度
|
|
25
|
+
* @param deg
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
exports.EARTH_RADIUS_OUTER = EARTH_RADIUS_OUTER;
|
|
30
|
+
|
|
33
31
|
function torad(deg) {
|
|
34
32
|
return deg / 180 * Math.acos(-1);
|
|
35
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* 经纬度转xyz
|
|
36
|
+
* @param longitude 经度
|
|
37
|
+
* @param latitude 纬度
|
|
38
|
+
* @param radius 半径
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
|
|
36
42
|
function lglt2xyz(lnglat) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
// TODO: + Math.PI/2 是为了对齐坐标
|
|
44
|
+
var lng = torad(lnglat[0]) + Math.PI / 2;
|
|
45
|
+
var lat = torad(lnglat[1]); // TODO: 手动增加一些偏移,减轻面的冲突
|
|
46
|
+
|
|
47
|
+
var radius = EARTH_RADIUS + Math.random() * 0.4;
|
|
48
|
+
var z = radius * Math.cos(lat) * Math.cos(lng);
|
|
49
|
+
var x = radius * Math.cos(lat) * Math.sin(lng);
|
|
50
|
+
var y = radius * Math.sin(lat);
|
|
43
51
|
return [x, y, z];
|
|
44
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* 构建地球球体网格
|
|
55
|
+
* @param radius
|
|
56
|
+
* @param opt
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
45
61
|
function primitiveSphere(radius, opt) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
var matRotY = _glMatrix.mat4.create();
|
|
63
|
+
|
|
64
|
+
var matRotZ = _glMatrix.mat4.create();
|
|
65
|
+
|
|
66
|
+
var up = _glMatrix.vec3.fromValues(0, 1, 0);
|
|
67
|
+
|
|
68
|
+
var tmpVec3 = _glMatrix.vec3.fromValues(0, 0, 0);
|
|
69
|
+
|
|
50
70
|
opt = opt || {};
|
|
51
|
-
radius = typeof radius !==
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
radius = typeof radius !== 'undefined' ? radius : 1;
|
|
72
|
+
var segments = typeof opt.segments !== 'undefined' ? opt.segments : 32;
|
|
73
|
+
var totalZRotationSteps = 2 + segments;
|
|
74
|
+
var totalYRotationSteps = 2 * totalZRotationSteps;
|
|
75
|
+
var indices = [];
|
|
76
|
+
var indicesArr = [];
|
|
77
|
+
var positions = [];
|
|
78
|
+
var positionsArr = [];
|
|
79
|
+
var normalArr = [];
|
|
80
|
+
var uvs = [];
|
|
81
|
+
|
|
82
|
+
for (var zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {
|
|
83
|
+
var normalizedZ = zRotationStep / totalZRotationSteps;
|
|
84
|
+
var angleZ = normalizedZ * Math.PI;
|
|
85
|
+
|
|
86
|
+
for (var yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {
|
|
87
|
+
var normalizedY = yRotationStep / totalYRotationSteps;
|
|
88
|
+
var angleY = normalizedY * Math.PI * 2;
|
|
89
|
+
|
|
90
|
+
_glMatrix.mat4.identity(matRotZ);
|
|
91
|
+
|
|
92
|
+
_glMatrix.mat4.rotateZ(matRotZ, matRotZ, -angleZ);
|
|
93
|
+
|
|
94
|
+
_glMatrix.mat4.identity(matRotY);
|
|
95
|
+
|
|
96
|
+
_glMatrix.mat4.rotateY(matRotY, matRotY, angleY);
|
|
97
|
+
|
|
98
|
+
_glMatrix.vec3.transformMat4(tmpVec3, up, matRotZ);
|
|
99
|
+
|
|
100
|
+
_glMatrix.vec3.transformMat4(tmpVec3, tmpVec3, matRotY);
|
|
101
|
+
|
|
102
|
+
_glMatrix.vec3.scale(tmpVec3, tmpVec3, -radius);
|
|
103
|
+
|
|
74
104
|
positions.push(tmpVec3.slice());
|
|
75
|
-
positionsArr.push(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
105
|
+
positionsArr.push.apply(positionsArr, (0, _toConsumableArray2.default)(tmpVec3.slice()));
|
|
106
|
+
|
|
107
|
+
_glMatrix.vec3.normalize(tmpVec3, tmpVec3);
|
|
108
|
+
|
|
109
|
+
normalArr.push.apply(normalArr, (0, _toConsumableArray2.default)(tmpVec3.slice()));
|
|
110
|
+
uvs.push([normalizedY, 1 - normalizedZ]); // position 和 uv 一起存储
|
|
111
|
+
|
|
79
112
|
positionsArr.push(normalizedY, 1 - normalizedZ);
|
|
80
113
|
}
|
|
114
|
+
|
|
81
115
|
if (zRotationStep > 0) {
|
|
82
|
-
|
|
83
|
-
|
|
116
|
+
var verticesCount = positions.length;
|
|
117
|
+
var firstIndex = verticesCount - 2 * (totalYRotationSteps + 1);
|
|
118
|
+
|
|
84
119
|
for (; firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {
|
|
85
|
-
indices.push([
|
|
86
|
-
firstIndex,
|
|
87
|
-
firstIndex + 1,
|
|
88
|
-
firstIndex + totalYRotationSteps + 1
|
|
89
|
-
]);
|
|
120
|
+
indices.push([firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1]);
|
|
90
121
|
indicesArr.push(firstIndex, firstIndex + 1, firstIndex + totalYRotationSteps + 1);
|
|
91
|
-
indices.push([
|
|
92
|
-
firstIndex + totalYRotationSteps + 1,
|
|
93
|
-
firstIndex + 1,
|
|
94
|
-
firstIndex + totalYRotationSteps + 2
|
|
95
|
-
]);
|
|
122
|
+
indices.push([firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2]);
|
|
96
123
|
indicesArr.push(firstIndex + totalYRotationSteps + 1, firstIndex + 1, firstIndex + totalYRotationSteps + 2);
|
|
97
124
|
}
|
|
98
125
|
}
|
|
99
126
|
}
|
|
127
|
+
|
|
100
128
|
return {
|
|
101
129
|
cells: indices,
|
|
102
|
-
positions,
|
|
103
|
-
uvs,
|
|
104
|
-
positionsArr,
|
|
105
|
-
indicesArr,
|
|
106
|
-
normalArr
|
|
130
|
+
positions: positions,
|
|
131
|
+
uvs: uvs,
|
|
132
|
+
positionsArr: positionsArr,
|
|
133
|
+
indicesArr: indicesArr,
|
|
134
|
+
normalArr: normalArr
|
|
107
135
|
};
|
|
108
|
-
}
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
EARTH_RADIUS,
|
|
112
|
-
EARTH_RADIUS_OUTER,
|
|
113
|
-
EARTH_SEGMENTS,
|
|
114
|
-
lglt2xyz,
|
|
115
|
-
primitiveSphere
|
|
116
|
-
});
|
|
136
|
+
}
|
package/lib/heatmap/index.js
CHANGED
|
@@ -1,101 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
22
|
-
// src/heatmap/index.ts
|
|
23
|
-
var heatmap_exports = {};
|
|
24
|
-
__export(heatmap_exports, {
|
|
25
|
-
default: () => HeatMapLayer
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
26
7
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
25
|
+
|
|
26
|
+
var _models = _interopRequireDefault(require("./models"));
|
|
27
|
+
|
|
28
|
+
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); }; }
|
|
29
|
+
|
|
30
|
+
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; } }
|
|
31
|
+
|
|
32
|
+
var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
33
|
+
(0, _inherits2.default)(HeatMapLayer, _BaseLayer);
|
|
34
|
+
|
|
35
|
+
var _super = _createSuper(HeatMapLayer);
|
|
36
|
+
|
|
37
|
+
function HeatMapLayer() {
|
|
38
|
+
var _this;
|
|
39
|
+
|
|
40
|
+
(0, _classCallCheck2.default)(this, HeatMapLayer);
|
|
41
|
+
|
|
42
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
+
args[_key] = arguments[_key];
|
|
57
44
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
45
|
+
|
|
46
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'HeatMapLayer');
|
|
48
|
+
return _this;
|
|
62
49
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
|
|
51
|
+
(0, _createClass2.default)(HeatMapLayer, [{
|
|
52
|
+
key: "buildModels",
|
|
53
|
+
value: function buildModels() {
|
|
54
|
+
var _this2 = this;
|
|
55
|
+
|
|
56
|
+
var shape = this.getModelType();
|
|
57
|
+
this.layerModel = new _models.default[shape](this);
|
|
58
|
+
this.layerModel.initModels(function (models) {
|
|
59
|
+
_this2.models = models;
|
|
60
|
+
|
|
61
|
+
_this2.renderLayers();
|
|
62
|
+
});
|
|
68
63
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
}, {
|
|
65
|
+
key: "rebuildModels",
|
|
66
|
+
value: function rebuildModels() {
|
|
67
|
+
var _this3 = this;
|
|
68
|
+
|
|
69
|
+
this.layerModel.buildModels(function (models) {
|
|
70
|
+
return _this3.models = models;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "renderModels",
|
|
75
|
+
value: function renderModels() {
|
|
76
|
+
var _this4 = this;
|
|
77
|
+
|
|
78
|
+
var shape = this.getModelType();
|
|
79
|
+
|
|
80
|
+
if (shape === 'heatmap') {
|
|
81
|
+
if (this.layerModel) {
|
|
82
|
+
this.layerModel.render(); // 独立的渲染流程
|
|
77
83
|
}
|
|
84
|
+
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (this.layerModelNeedUpdate) {
|
|
89
|
+
this.layerModel.buildModels(function (models) {
|
|
90
|
+
return _this4.models = models;
|
|
91
|
+
}); // @ts-ignore
|
|
92
|
+
// this.models = this.layerModel.buildModels();
|
|
93
|
+
|
|
94
|
+
this.layerModelNeedUpdate = false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.models.forEach(function (model) {
|
|
98
|
+
return model.draw({
|
|
99
|
+
uniforms: _this4.layerModel.getUninforms()
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "updateModelData",
|
|
106
|
+
value: function updateModelData(data) {
|
|
107
|
+
if (data.attributes && data.elements) {
|
|
108
|
+
this.models[0].updateAttributesAndElements(data.attributes, data.elements);
|
|
109
|
+
} else {
|
|
110
|
+
console.warn('data error');
|
|
78
111
|
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
getModelType() {
|
|
82
|
-
var _a;
|
|
83
|
-
const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute("shape");
|
|
84
|
-
const { shape3d } = this.getLayerConfig();
|
|
85
|
-
const source = this.getSource();
|
|
86
|
-
const sourceType = source.data.type;
|
|
87
|
-
const shape = ((_a = shapeAttribute == null ? void 0 : shapeAttribute.scale) == null ? void 0 : _a.field) || "heatmap";
|
|
88
|
-
if (shape === "heatmap" || shape === "heatmap3d") {
|
|
89
|
-
return "heatmap";
|
|
90
112
|
}
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
}, {
|
|
114
|
+
key: "getConfigSchema",
|
|
115
|
+
value: function getConfigSchema() {
|
|
116
|
+
return {
|
|
117
|
+
properties: {
|
|
118
|
+
opacity: {
|
|
119
|
+
type: 'number',
|
|
120
|
+
minimum: 0,
|
|
121
|
+
maximum: 1
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
93
125
|
}
|
|
94
|
-
|
|
95
|
-
|
|
126
|
+
}, {
|
|
127
|
+
key: "getModelType",
|
|
128
|
+
value: function getModelType() {
|
|
129
|
+
var _shapeAttribute$scale;
|
|
130
|
+
|
|
131
|
+
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
132
|
+
|
|
133
|
+
var _this$getLayerConfig = this.getLayerConfig(),
|
|
134
|
+
shape3d = _this$getLayerConfig.shape3d;
|
|
135
|
+
|
|
136
|
+
var source = this.getSource();
|
|
137
|
+
var sourceType = source.data.type;
|
|
138
|
+
var shape = (shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'heatmap';
|
|
139
|
+
|
|
140
|
+
if (shape === 'heatmap' || shape === 'heatmap3d') {
|
|
141
|
+
return 'heatmap';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (sourceType === 'hexagon') {
|
|
145
|
+
return (shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) === -1 ? 'hexagon' : 'grid3d';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (sourceType === 'grid') {
|
|
149
|
+
return (shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) === -1 ? 'grid' : 'grid3d';
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return 'heatmap';
|
|
96
153
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
|
|
154
|
+
}]);
|
|
155
|
+
return HeatMapLayer;
|
|
156
|
+
}(_BaseLayer2.default);
|
|
157
|
+
|
|
158
|
+
exports.default = HeatMapLayer;
|