@antv/l7-layers 2.9.23 → 2.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/models/plane.d.ts +1 -0
- package/es/citybuliding/building.js +1 -1
- package/es/core/BaseLayer.js +10 -3
- package/es/core/interface.d.ts +26 -48
- package/es/core/interface.js +3 -0
- package/es/core/schema.d.ts +3 -3
- package/es/core/triangulation.d.ts +4 -3
- package/es/core/triangulation.js +54 -39
- package/es/heatmap/models/heatmap.js +1 -1
- package/es/image/models/image.js +7 -1
- package/es/line/index.js +4 -1
- package/es/line/models/arc.js +1 -1
- package/es/line/models/simpleLine.js +1 -1
- package/es/line/shaders/line_arc_vert.glsl +5 -3
- package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
- package/es/plugins/FeatureScalePlugin.js +0 -1
- package/es/point/index.js +3 -1
- package/es/point/models/fill.js +5 -2
- package/es/point/models/fillmage.js +9 -3
- package/es/point/models/image.js +8 -2
- package/es/point/models/radar.js +2 -3
- package/es/point/models/tile.js +1 -1
- package/es/point/shaders/fill_vert.glsl +13 -6
- package/es/point/shaders/image/fillImage_vert.glsl +13 -5
- package/es/point/shaders/image_vert.glsl +17 -8
- package/es/polygon/index.js +4 -1
- package/es/raster/index.js +3 -1
- package/es/tile/manager/tileLayerManager.d.ts +3 -2
- package/es/tile/manager/tileLayerManager.js +5 -2
- package/es/tile/models/tileModel.js +4 -3
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +32 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
- package/es/tile/tileFactory/vectorLayer.js +22 -1
- package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
- package/es/tile/tileLayer/baseTileLayer.js +3 -2
- package/es/tile/utils.d.ts +2 -0
- package/es/tile/utils.js +5 -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 -809
- 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 +412 -213
- 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 -123
- package/lib/image/models/index.js +15 -32
- package/lib/index.js +263 -97
- package/lib/line/index.js +131 -83
- 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/line/shaders/line_arc_vert.glsl +5 -3
- package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
- 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 -241
- 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 -148
- 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 -273
- package/lib/point/models/fillmage.js +365 -252
- package/lib/point/models/image.js +241 -164
- package/lib/point/models/index.js +46 -52
- package/lib/point/models/normal.js +183 -134
- package/lib/point/models/radar.js +304 -212
- 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/shaders/fill_vert.glsl +13 -6
- package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
- package/lib/point/shaders/image_vert.glsl +17 -8
- package/lib/point/shape/extrude.js +56 -52
- package/lib/polygon/index.js +154 -100
- 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 -74
- 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 +314 -227
- package/lib/tile/manager/tilePickerManager.js +192 -123
- package/lib/tile/models/tileModel.js +71 -51
- package/lib/tile/tileFactory/base.js +433 -292
- 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 +169 -95
- package/lib/tile/tileLayer/baseTileLayer.js +420 -220
- package/lib/tile/tmsTileLayer.js +110 -67
- package/lib/tile/utils.js +113 -87
- 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 +7 -6
package/lib/core/BaseModel.js
CHANGED
|
@@ -1,68 +1,83 @@
|
|
|
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
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
20
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
-
if (decorator = decorators[i])
|
|
22
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
23
|
-
if (kind && result)
|
|
24
|
-
__defProp(target, key, result);
|
|
25
|
-
return result;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// src/core/BaseModel.ts
|
|
29
|
-
var BaseModel_exports = {};
|
|
30
|
-
__export(BaseModel_exports, {
|
|
31
|
-
default: () => BaseModel
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
32
7
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
20
|
+
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
21
|
+
|
|
22
|
+
var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
|
|
23
|
+
|
|
24
|
+
var _l7Core = require("@antv/l7-core");
|
|
25
|
+
|
|
26
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
27
|
+
|
|
28
|
+
var _d3Color = require("d3-color");
|
|
29
|
+
|
|
30
|
+
var _lodash = require("lodash");
|
|
31
|
+
|
|
32
|
+
var _blend = require("../utils/blend");
|
|
33
|
+
|
|
34
|
+
var _dec, _class, _descriptor;
|
|
35
|
+
|
|
36
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
41
|
+
|
|
42
|
+
var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
43
|
+
// style texture data mapping
|
|
44
|
+
// 用于数据传递的数据纹理
|
|
45
|
+
// 默认有多少列(宽度)
|
|
46
|
+
// 计算得到的当前数据纹理有多少行(高度)
|
|
47
|
+
// 单个 cell 的长度
|
|
48
|
+
// 需要进行数据映射的属性集合
|
|
49
|
+
// style texture data mapping
|
|
50
|
+
function BaseModel(layer) {
|
|
51
|
+
(0, _classCallCheck2.default)(this, BaseModel);
|
|
52
|
+
(0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
|
|
41
53
|
this.layer = layer;
|
|
42
|
-
this.rendererService = layer.getContainer().get(
|
|
43
|
-
this.pickingService = layer.getContainer().get(
|
|
44
|
-
this.shaderModuleService = layer.getContainer().get(
|
|
45
|
-
this.styleAttributeService = layer.getContainer().get(
|
|
46
|
-
this.mapService = layer.getContainer().get(
|
|
47
|
-
this.iconService = layer.getContainer().get(
|
|
48
|
-
this.fontService = layer.getContainer().get(
|
|
49
|
-
this.cameraService = layer.getContainer().get(
|
|
50
|
-
this.layerService = layer.getContainer().get(
|
|
51
|
-
|
|
54
|
+
this.rendererService = layer.getContainer().get(_l7Core.TYPES.IRendererService);
|
|
55
|
+
this.pickingService = layer.getContainer().get(_l7Core.TYPES.IPickingService);
|
|
56
|
+
this.shaderModuleService = layer.getContainer().get(_l7Core.TYPES.IShaderModuleService);
|
|
57
|
+
this.styleAttributeService = layer.getContainer().get(_l7Core.TYPES.IStyleAttributeService);
|
|
58
|
+
this.mapService = layer.getContainer().get(_l7Core.TYPES.IMapService);
|
|
59
|
+
this.iconService = layer.getContainer().get(_l7Core.TYPES.IIconService);
|
|
60
|
+
this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
|
|
61
|
+
this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
|
|
62
|
+
this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService); // 注册 Attribute
|
|
63
|
+
|
|
64
|
+
this.registerBuiltinAttributes(); // 开启动画
|
|
65
|
+
|
|
52
66
|
this.startModelAnimate();
|
|
53
|
-
|
|
67
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
54
68
|
this.createTexture2D = createTexture2D;
|
|
55
|
-
this.DATA_TEXTURE_WIDTH = 1024;
|
|
69
|
+
this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
|
|
70
|
+
|
|
56
71
|
this.rowCount = 1;
|
|
57
72
|
this.cellLength = 0;
|
|
58
73
|
this.cellProperties = [];
|
|
59
74
|
this.cacheStyleProperties = {
|
|
60
|
-
thetaOffset:
|
|
61
|
-
opacity:
|
|
62
|
-
strokeOpacity:
|
|
63
|
-
strokeWidth:
|
|
64
|
-
stroke:
|
|
65
|
-
offsets:
|
|
75
|
+
thetaOffset: undefined,
|
|
76
|
+
opacity: undefined,
|
|
77
|
+
strokeOpacity: undefined,
|
|
78
|
+
strokeWidth: undefined,
|
|
79
|
+
stroke: undefined,
|
|
80
|
+
offsets: undefined
|
|
66
81
|
};
|
|
67
82
|
this.stylePropertyesExist = {
|
|
68
83
|
hasThetaOffset: 0,
|
|
@@ -72,254 +87,417 @@ var BaseModel = class {
|
|
|
72
87
|
hasStroke: 0,
|
|
73
88
|
hasOffsets: 0
|
|
74
89
|
};
|
|
75
|
-
this.dataTextureTest = this.layerService.getOESTextureFloat();
|
|
90
|
+
this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
|
|
91
|
+
|
|
76
92
|
if (!this.dataTextureTest) {
|
|
77
93
|
this.dataTexture = this.createTexture2D({
|
|
94
|
+
// data: new Uint8ClampedArray(4),
|
|
95
|
+
// 使用 Uint8ClampedArray 在 支付宝 环境中可能存在问题 UC 内核对格式有要求 L7 v2.7.18 版本发现
|
|
96
|
+
// Uint8ClampedArray 和 Uint8Array 没有实质性的区别
|
|
78
97
|
data: new Uint8Array(4),
|
|
79
|
-
mag:
|
|
80
|
-
min:
|
|
98
|
+
mag: _l7Core.gl.NEAREST,
|
|
99
|
+
min: _l7Core.gl.NEAREST,
|
|
81
100
|
width: 1,
|
|
82
101
|
height: 1
|
|
83
102
|
});
|
|
84
103
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
0,
|
|
104
|
-
0,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.stylePropertyesExist.hasStroke,
|
|
109
|
-
this.stylePropertyesExist.hasOffsets,
|
|
110
|
-
this.stylePropertyesExist.hasThetaOffset,
|
|
111
|
-
0,
|
|
112
|
-
0,
|
|
113
|
-
0,
|
|
114
|
-
0,
|
|
115
|
-
0,
|
|
116
|
-
1
|
|
117
|
-
];
|
|
118
|
-
} else {
|
|
119
|
-
return [
|
|
120
|
-
1,
|
|
121
|
-
1,
|
|
122
|
-
0,
|
|
123
|
-
0,
|
|
124
|
-
0,
|
|
125
|
-
0,
|
|
126
|
-
0,
|
|
127
|
-
0,
|
|
128
|
-
0,
|
|
129
|
-
0,
|
|
130
|
-
0,
|
|
131
|
-
0,
|
|
132
|
-
0,
|
|
133
|
-
0,
|
|
134
|
-
0,
|
|
135
|
-
-1
|
|
136
|
-
];
|
|
104
|
+
} // style datatexture mapping
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 清除上一次的计算结果 - 全量清除
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
(0, _createClass2.default)(BaseModel, [{
|
|
112
|
+
key: "clearLastCalRes",
|
|
113
|
+
value: function clearLastCalRes() {
|
|
114
|
+
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
|
|
115
|
+
|
|
116
|
+
this.cellLength = 0; // 清空上一次计算的 cell 的长度
|
|
117
|
+
|
|
118
|
+
this.stylePropertyesExist = {
|
|
119
|
+
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
|
|
120
|
+
hasThetaOffset: 0,
|
|
121
|
+
hasOpacity: 0,
|
|
122
|
+
hasStrokeOpacity: 0,
|
|
123
|
+
hasStrokeWidth: 0,
|
|
124
|
+
hasStroke: 0,
|
|
125
|
+
hasOffsets: 0
|
|
126
|
+
};
|
|
137
127
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
}, {
|
|
129
|
+
key: "getCellTypeLayout",
|
|
130
|
+
value: function getCellTypeLayout() {
|
|
131
|
+
if (this.dataTextureTest) {
|
|
132
|
+
return [// 0
|
|
133
|
+
this.rowCount, // 数据纹理有几行
|
|
134
|
+
this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
|
|
135
|
+
0.0, 0.0, // 1
|
|
136
|
+
this.stylePropertyesExist.hasOpacity, // cell 中是否存在 opacity
|
|
137
|
+
this.stylePropertyesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
|
|
138
|
+
this.stylePropertyesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
|
|
139
|
+
this.stylePropertyesExist.hasStroke, // cell 中是否存在 stroke
|
|
140
|
+
// 2
|
|
141
|
+
this.stylePropertyesExist.hasOffsets, // cell 中是否存在 offsets
|
|
142
|
+
this.stylePropertyesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
|
|
143
|
+
0.0, 0.0, // 3
|
|
144
|
+
0.0, 0.0, 0.0, 1.0];
|
|
145
|
+
} else {
|
|
146
|
+
return [1.0, // 数据纹理有几行
|
|
147
|
+
1.0, // 数据纹理有几列
|
|
148
|
+
0.0, 0.0, 0.0, // cell 中是否存在 opacity
|
|
149
|
+
0.0, // cell 中是否存在 strokeOpacity
|
|
150
|
+
0.0, // cell 中是否存在 strokeWidth
|
|
151
|
+
0.0, // cell 中是否存在 stroke
|
|
152
|
+
0.0, // cell 中是否存在 offsets
|
|
153
|
+
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
|
|
154
|
+
}
|
|
144
155
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
156
|
+
/**
|
|
157
|
+
* 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
|
|
158
|
+
* @param options
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
}, {
|
|
163
|
+
key: "dataTextureNeedUpdate",
|
|
164
|
+
value: function dataTextureNeedUpdate(options) {
|
|
165
|
+
var isUpdate = false;
|
|
166
|
+
|
|
167
|
+
if (!(0, _lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
|
|
168
|
+
isUpdate = true;
|
|
169
|
+
this.cacheStyleProperties.thetaOffset = options.thetaOffset;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!(0, _lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
|
|
173
|
+
isUpdate = true;
|
|
174
|
+
this.cacheStyleProperties.opacity = options.opacity;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (!(0, _lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
|
|
178
|
+
isUpdate = true;
|
|
179
|
+
this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!(0, _lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
|
|
183
|
+
isUpdate = true;
|
|
184
|
+
this.cacheStyleProperties.strokeWidth = options.strokeWidth;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (!(0, _lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
|
|
188
|
+
isUpdate = true;
|
|
189
|
+
this.cacheStyleProperties.stroke = options.stroke;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (!(0, _lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
|
|
193
|
+
isUpdate = true;
|
|
194
|
+
this.cacheStyleProperties.offsets = options.offsets;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (this.dataTexture === undefined) {
|
|
198
|
+
isUpdate = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return isUpdate;
|
|
148
202
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
203
|
+
/**
|
|
204
|
+
* 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
205
|
+
* @param options
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
}, {
|
|
209
|
+
key: "judgeStyleAttributes",
|
|
210
|
+
value: function judgeStyleAttributes(options) {
|
|
211
|
+
this.clearLastCalRes(); // 清除上一次的计算结果 - 全量清除
|
|
212
|
+
|
|
213
|
+
if (options.opacity !== undefined && !(0, _lodash.isNumber)(options.opacity)) {
|
|
214
|
+
// 数据映射
|
|
215
|
+
this.cellProperties.push({
|
|
216
|
+
attr: 'opacity',
|
|
217
|
+
count: 1
|
|
218
|
+
});
|
|
219
|
+
this.stylePropertyesExist.hasOpacity = 1;
|
|
220
|
+
this.cellLength += 1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (options.strokeOpacity !== undefined && !(0, _lodash.isNumber)(options.strokeOpacity)) {
|
|
224
|
+
// 数据映射
|
|
225
|
+
this.cellProperties.push({
|
|
226
|
+
attr: 'strokeOpacity',
|
|
227
|
+
count: 1
|
|
228
|
+
});
|
|
229
|
+
this.stylePropertyesExist.hasStrokeOpacity = 1;
|
|
230
|
+
this.cellLength += 1;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (options.strokeWidth !== undefined && !(0, _lodash.isNumber)(options.strokeWidth)) {
|
|
234
|
+
// 数据映射
|
|
235
|
+
this.cellProperties.push({
|
|
236
|
+
attr: 'strokeWidth',
|
|
237
|
+
count: 1
|
|
238
|
+
});
|
|
239
|
+
this.stylePropertyesExist.hasStrokeWidth = 1;
|
|
240
|
+
this.cellLength += 1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
|
|
244
|
+
// 数据映射
|
|
245
|
+
this.cellProperties.push({
|
|
246
|
+
attr: 'stroke',
|
|
247
|
+
count: 4
|
|
248
|
+
});
|
|
249
|
+
this.stylePropertyesExist.hasStroke = 1;
|
|
250
|
+
this.cellLength += 4;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
|
|
254
|
+
// 数据映射
|
|
255
|
+
this.cellProperties.push({
|
|
256
|
+
attr: 'offsets',
|
|
257
|
+
count: 2
|
|
258
|
+
});
|
|
259
|
+
this.stylePropertyesExist.hasOffsets = 1;
|
|
260
|
+
this.cellLength += 2;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (options.thetaOffset !== undefined && !(0, _lodash.isNumber)(options.thetaOffset)) {
|
|
264
|
+
// 数据映射
|
|
265
|
+
this.cellProperties.push({
|
|
266
|
+
attr: 'thetaOffset',
|
|
267
|
+
count: 1
|
|
268
|
+
});
|
|
269
|
+
this.stylePropertyesExist.hasThetaOffset = 1;
|
|
270
|
+
this.cellLength += 1;
|
|
271
|
+
} // console.log('this.cellLength', this.cellLength)
|
|
272
|
+
|
|
152
273
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
274
|
+
/**
|
|
275
|
+
* 判断变量 stroke 是否是常量值
|
|
276
|
+
* @param stroke
|
|
277
|
+
* @returns
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
}, {
|
|
281
|
+
key: "isStaticColor",
|
|
282
|
+
value: function isStaticColor(stroke) {
|
|
283
|
+
if ((0, _lodash.isString)(stroke)) {
|
|
284
|
+
if ((0, _d3Color.color)(stroke)) {
|
|
285
|
+
return true;
|
|
286
|
+
} else {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return false;
|
|
156
292
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
293
|
+
/**
|
|
294
|
+
* 获取 stroke 颜色并做兼容处理
|
|
295
|
+
* @param stroke
|
|
296
|
+
* @returns
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
}, {
|
|
300
|
+
key: "getStrokeColor",
|
|
301
|
+
value: function getStrokeColor(stroke) {
|
|
302
|
+
if (this.isStaticColor(stroke)) {
|
|
303
|
+
var strokeColor = (0, _l7Utils.rgb2arr)(stroke);
|
|
304
|
+
strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
|
|
305
|
+
strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
|
|
306
|
+
strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
|
|
307
|
+
strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
|
|
308
|
+
return strokeColor;
|
|
309
|
+
} else {
|
|
310
|
+
return [0, 0, 0, 0];
|
|
311
|
+
}
|
|
160
312
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
313
|
+
/**
|
|
314
|
+
* 判断 offsets 是否是常量
|
|
315
|
+
* @param offsets
|
|
316
|
+
* @returns
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
}, {
|
|
320
|
+
key: "isOffsetStatic",
|
|
321
|
+
value: function isOffsetStatic(offsets) {
|
|
322
|
+
if (Array.isArray(offsets) && offsets.length === 2 && (0, _lodash.isNumber)(offsets[0]) && (0, _lodash.isNumber)(offsets[1])) {
|
|
323
|
+
return true;
|
|
324
|
+
} else {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
164
327
|
}
|
|
165
|
-
|
|
166
|
-
|
|
328
|
+
/**
|
|
329
|
+
* 补空位
|
|
330
|
+
* @param d
|
|
331
|
+
* @param count
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
}, {
|
|
335
|
+
key: "patchMod",
|
|
336
|
+
value: function patchMod(d, count) {
|
|
337
|
+
for (var i = 0; i < count; i++) {
|
|
338
|
+
d.push(-1);
|
|
339
|
+
}
|
|
167
340
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
341
|
+
/**
|
|
342
|
+
* 根据映射的数据字段往推入数据
|
|
343
|
+
* @param d
|
|
344
|
+
* @param cellData
|
|
345
|
+
* @param cellPropertiesLayouts
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
}, {
|
|
349
|
+
key: "patchData",
|
|
350
|
+
value: function patchData(d, cellData, cellPropertiesLayouts) {
|
|
351
|
+
var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
|
|
352
|
+
_step;
|
|
353
|
+
|
|
354
|
+
try {
|
|
355
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
356
|
+
var layout = _step.value;
|
|
357
|
+
var attr = layout.attr,
|
|
358
|
+
count = layout.count;
|
|
359
|
+
var value = cellData[attr];
|
|
360
|
+
|
|
361
|
+
if (value !== undefined) {
|
|
362
|
+
// 数据中存在该属性
|
|
363
|
+
if (attr === 'stroke') {
|
|
364
|
+
d.push.apply(d, (0, _toConsumableArray2.default)((0, _l7Utils.rgb2arr)(value)));
|
|
365
|
+
} else if (attr === 'offsets') {
|
|
366
|
+
if (this.isOffsetStatic(value)) {
|
|
367
|
+
d.push(-value[0], value[1]);
|
|
368
|
+
} else {
|
|
369
|
+
d.push(0, 0);
|
|
370
|
+
}
|
|
371
|
+
} else {
|
|
372
|
+
d.push((0, _lodash.isNumber)(value) ? value : 1.0);
|
|
373
|
+
}
|
|
374
|
+
} else {
|
|
375
|
+
// 若不存在时则补位
|
|
376
|
+
this.patchMod(d, count);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
} catch (err) {
|
|
380
|
+
_iterator.e(err);
|
|
381
|
+
} finally {
|
|
382
|
+
_iterator.f();
|
|
383
|
+
}
|
|
176
384
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
385
|
+
/**
|
|
386
|
+
* 计算推入数据纹理的数据
|
|
387
|
+
* @param cellLength
|
|
388
|
+
* @param encodeData
|
|
389
|
+
* @param cellPropertiesLayouts
|
|
390
|
+
* @returns
|
|
391
|
+
*/
|
|
392
|
+
|
|
393
|
+
}, {
|
|
394
|
+
key: "calDataFrame",
|
|
395
|
+
value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
|
|
396
|
+
var encodeDatalength = encodeData.length;
|
|
397
|
+
var rowCount = Math.ceil(encodeDatalength * cellLength / this.DATA_TEXTURE_WIDTH); // 有多少行
|
|
398
|
+
|
|
399
|
+
var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
|
|
400
|
+
var d = [];
|
|
401
|
+
|
|
402
|
+
for (var i = 0; i < encodeDatalength; i++) {
|
|
403
|
+
// 根据 encodeData 数据推入数据
|
|
404
|
+
var cellData = encodeData[i];
|
|
405
|
+
this.patchData(d, cellData, cellPropertiesLayouts);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
for (var _i = d.length; _i < totalLength; _i++) {
|
|
409
|
+
// 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
|
|
410
|
+
d.push(-1);
|
|
411
|
+
} // console.log('data', d)
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
return {
|
|
415
|
+
data: d,
|
|
416
|
+
width: this.DATA_TEXTURE_WIDTH,
|
|
417
|
+
height: rowCount
|
|
418
|
+
};
|
|
419
|
+
} // style datatexture mapping
|
|
420
|
+
|
|
421
|
+
}, {
|
|
422
|
+
key: "getBlend",
|
|
423
|
+
value: function getBlend() {
|
|
424
|
+
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
425
|
+
_this$layer$getLayerC2 = _this$layer$getLayerC.blend,
|
|
426
|
+
blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
|
|
427
|
+
|
|
428
|
+
return _blend.BlendTypes[_l7Core.BlendType[blend]];
|
|
181
429
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
430
|
+
}, {
|
|
431
|
+
key: "getDefaultStyle",
|
|
432
|
+
value: function getDefaultStyle() {
|
|
433
|
+
return {};
|
|
186
434
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
435
|
+
}, {
|
|
436
|
+
key: "getUninforms",
|
|
437
|
+
value: function getUninforms() {
|
|
438
|
+
throw new Error('Method not implemented.');
|
|
191
439
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
440
|
+
}, {
|
|
441
|
+
key: "getAnimateUniforms",
|
|
442
|
+
value: function getAnimateUniforms() {
|
|
443
|
+
return {};
|
|
196
444
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
445
|
+
}, {
|
|
446
|
+
key: "needUpdate",
|
|
447
|
+
value: function needUpdate() {
|
|
448
|
+
return false;
|
|
201
449
|
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return true;
|
|
207
|
-
} else {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
450
|
+
}, {
|
|
451
|
+
key: "buildModels",
|
|
452
|
+
value: function buildModels(callbackModel) {
|
|
453
|
+
throw new Error('Method not implemented.');
|
|
210
454
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const strokeColor = (0, import_l7_utils.rgb2arr)(stroke);
|
|
216
|
-
strokeColor[0] = strokeColor[0] ? strokeColor[0] : 0;
|
|
217
|
-
strokeColor[1] = strokeColor[1] ? strokeColor[1] : 0;
|
|
218
|
-
strokeColor[2] = strokeColor[2] ? strokeColor[2] : 0;
|
|
219
|
-
strokeColor[3] = strokeColor[3] ? strokeColor[3] : 0;
|
|
220
|
-
return strokeColor;
|
|
221
|
-
} else {
|
|
222
|
-
return [0, 0, 0, 0];
|
|
455
|
+
}, {
|
|
456
|
+
key: "initModels",
|
|
457
|
+
value: function initModels(callbackModel) {
|
|
458
|
+
throw new Error('Method not implemented.');
|
|
223
459
|
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return
|
|
228
|
-
} else {
|
|
229
|
-
return false;
|
|
460
|
+
}, {
|
|
461
|
+
key: "clearModels",
|
|
462
|
+
value: function clearModels() {
|
|
463
|
+
return;
|
|
230
464
|
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
465
|
+
}, {
|
|
466
|
+
key: "getAttribute",
|
|
467
|
+
value: function getAttribute() {
|
|
468
|
+
throw new Error('Method not implemented.');
|
|
235
469
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const value = cellData[attr];
|
|
241
|
-
if (value !== void 0) {
|
|
242
|
-
if (attr === "stroke") {
|
|
243
|
-
d.push(...(0, import_l7_utils.rgb2arr)(value));
|
|
244
|
-
} else if (attr === "offsets") {
|
|
245
|
-
if (this.isOffsetStatic(value)) {
|
|
246
|
-
d.push(-value[0], value[1]);
|
|
247
|
-
} else {
|
|
248
|
-
d.push(0, 0);
|
|
249
|
-
}
|
|
250
|
-
} else {
|
|
251
|
-
d.push((0, import_lodash.isNumber)(value) ? value : 1);
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
this.patchMod(d, count);
|
|
255
|
-
}
|
|
470
|
+
}, {
|
|
471
|
+
key: "render",
|
|
472
|
+
value: function render() {
|
|
473
|
+
throw new Error('Method not implemented.');
|
|
256
474
|
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
|
|
262
|
-
const d = [];
|
|
263
|
-
for (let i = 0; i < encodeDatalength; i++) {
|
|
264
|
-
const cellData = encodeData[i];
|
|
265
|
-
this.patchData(d, cellData, cellPropertiesLayouts);
|
|
475
|
+
}, {
|
|
476
|
+
key: "registerBuiltinAttributes",
|
|
477
|
+
value: function registerBuiltinAttributes() {
|
|
478
|
+
throw new Error('Method not implemented.');
|
|
266
479
|
}
|
|
267
|
-
|
|
268
|
-
|
|
480
|
+
}, {
|
|
481
|
+
key: "animateOption2Array",
|
|
482
|
+
value: function animateOption2Array(option) {
|
|
483
|
+
return [option.enable ? 0 : 1.0, option.duration || 4.0, option.interval || 0.2, option.trailLength || 0.1];
|
|
269
484
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
getUninforms() {
|
|
280
|
-
throw new Error("Method not implemented.");
|
|
281
|
-
}
|
|
282
|
-
getAnimateUniforms() {
|
|
283
|
-
return {};
|
|
284
|
-
}
|
|
285
|
-
needUpdate() {
|
|
286
|
-
return false;
|
|
287
|
-
}
|
|
288
|
-
buildModels(callbackModel) {
|
|
289
|
-
throw new Error("Method not implemented.");
|
|
290
|
-
}
|
|
291
|
-
initModels(callbackModel) {
|
|
292
|
-
throw new Error("Method not implemented.");
|
|
293
|
-
}
|
|
294
|
-
clearModels() {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
getAttribute() {
|
|
298
|
-
throw new Error("Method not implemented.");
|
|
299
|
-
}
|
|
300
|
-
render() {
|
|
301
|
-
throw new Error("Method not implemented.");
|
|
302
|
-
}
|
|
303
|
-
registerBuiltinAttributes() {
|
|
304
|
-
throw new Error("Method not implemented.");
|
|
305
|
-
}
|
|
306
|
-
animateOption2Array(option) {
|
|
307
|
-
return [
|
|
308
|
-
option.enable ? 0 : 1,
|
|
309
|
-
option.duration || 4,
|
|
310
|
-
option.interval || 0.2,
|
|
311
|
-
option.trailLength || 0.1
|
|
312
|
-
];
|
|
313
|
-
}
|
|
314
|
-
startModelAnimate() {
|
|
315
|
-
const { animateOption } = this.layer.getLayerConfig();
|
|
316
|
-
if (animateOption.enable) {
|
|
317
|
-
this.layer.setAnimateStartTime();
|
|
485
|
+
}, {
|
|
486
|
+
key: "startModelAnimate",
|
|
487
|
+
value: function startModelAnimate() {
|
|
488
|
+
var _ref = this.layer.getLayerConfig(),
|
|
489
|
+
animateOption = _ref.animateOption;
|
|
490
|
+
|
|
491
|
+
if (animateOption.enable) {
|
|
492
|
+
this.layer.setAnimateStartTime();
|
|
493
|
+
}
|
|
318
494
|
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
495
|
+
}]);
|
|
496
|
+
return BaseModel;
|
|
497
|
+
}(), (_descriptor = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "configService", [_dec], {
|
|
498
|
+
configurable: true,
|
|
499
|
+
enumerable: true,
|
|
500
|
+
writable: true,
|
|
501
|
+
initializer: null
|
|
502
|
+
})), _class));
|
|
503
|
+
exports.default = BaseModel;
|