@antv/l7-layers 2.16.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +485 -321
- package/es/core/BaseModel.js +126 -97
- 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 +31 -10
- package/es/core/triangulation.js +114 -54
- 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 +146 -91
- 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 +34 -9
- package/es/line/models/arc.js +118 -66
- package/es/line/models/arc_3d.js +108 -60
- package/es/line/models/earthArc_3d.js +111 -63
- package/es/line/models/great_circle.js +100 -56
- package/es/line/models/half.js +77 -46
- package/es/line/models/line.js +148 -94
- package/es/line/models/linearline.js +80 -45
- package/es/line/models/simpleLine.js +74 -41
- 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 +117 -80
- 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 +104 -67
- 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 +77 -26
- package/es/point/models/earthExtrude.js +102 -61
- package/es/point/models/earthFill.js +87 -57
- package/es/point/models/extrude.js +101 -60
- package/es/point/models/fill.js +100 -70
- package/es/point/models/fillmage.js +107 -63
- package/es/point/models/image.js +88 -48
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +64 -40
- package/es/point/models/simplePoint.js +69 -41
- package/es/point/models/text.js +301 -198
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +40 -11
- package/es/polygon/models/extrude.js +92 -48
- package/es/polygon/models/fill.js +88 -54
- 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/dataMappingStyle.js +18 -8
- 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 +479 -321
- package/lib/core/BaseModel.js +139 -97
- 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 +54 -10
- package/lib/core/triangulation.js +153 -53
- 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 +162 -91
- 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 +128 -64
- package/lib/line/models/arc_3d.js +119 -58
- package/lib/line/models/earthArc_3d.js +122 -61
- package/lib/line/models/great_circle.js +111 -56
- package/lib/line/models/half.js +87 -46
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +156 -92
- package/lib/line/models/linearline.js +92 -45
- package/lib/line/models/simpleLine.js +84 -41
- 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 +128 -80
- 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 +113 -68
- 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 +113 -61
- package/lib/point/models/earthFill.js +117 -57
- package/lib/point/models/extrude.js +111 -60
- package/lib/point/models/fill.js +109 -68
- package/lib/point/models/fillmage.js +115 -61
- package/lib/point/models/image.js +98 -48
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +74 -40
- package/lib/point/models/simplePoint.js +79 -41
- package/lib/point/models/text.js +309 -198
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +103 -48
- package/lib/polygon/models/fill.js +98 -54
- 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/dataMappingStyle.js +19 -8
- 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/core/BaseModel.js
CHANGED
|
@@ -1,43 +1,61 @@
|
|
|
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 _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
15
|
+
|
|
11
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
|
|
12
18
|
var _initializerDefineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerDefineProperty"));
|
|
19
|
+
|
|
13
20
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
+
|
|
14
22
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
+
|
|
15
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
16
26
|
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime/helpers/applyDecoratedDescriptor"));
|
|
27
|
+
|
|
17
28
|
var _initializerWarningHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/initializerWarningHelper"));
|
|
29
|
+
|
|
18
30
|
var _l7Core = require("@antv/l7-core");
|
|
31
|
+
|
|
19
32
|
var _l7Utils = require("@antv/l7-utils");
|
|
33
|
+
|
|
20
34
|
var _d3Color = require("d3-color");
|
|
35
|
+
|
|
21
36
|
var _lodash = require("lodash");
|
|
37
|
+
|
|
22
38
|
var _blend = require("../utils/blend");
|
|
39
|
+
|
|
23
40
|
var _stencil = require("../utils/stencil");
|
|
41
|
+
|
|
24
42
|
var _dec, _class, _descriptor;
|
|
43
|
+
|
|
25
44
|
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; } } }; }
|
|
45
|
+
|
|
26
46
|
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); }
|
|
27
|
-
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
28
50
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
51
|
var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
30
52
|
// style texture data mapping
|
|
31
|
-
|
|
32
53
|
// 用于数据传递的数据纹理
|
|
33
54
|
// 默认有多少列(宽度)
|
|
34
55
|
// 计算得到的当前数据纹理有多少行(高度)
|
|
35
|
-
|
|
36
56
|
// 单个 cell 的长度
|
|
37
57
|
// 需要进行数据映射的属性集合
|
|
38
|
-
|
|
39
58
|
// style texture data mapping
|
|
40
|
-
|
|
41
59
|
function BaseModel(layer) {
|
|
42
60
|
(0, _classCallCheck2.default)(this, BaseModel);
|
|
43
61
|
(0, _initializerDefineProperty2.default)(this, "configService", _descriptor, this);
|
|
@@ -50,15 +68,15 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
50
68
|
this.iconService = layer.getContainer().get(_l7Core.TYPES.IIconService);
|
|
51
69
|
this.fontService = layer.getContainer().get(_l7Core.TYPES.IFontService);
|
|
52
70
|
this.cameraService = layer.getContainer().get(_l7Core.TYPES.ICameraService);
|
|
53
|
-
this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService);
|
|
71
|
+
this.layerService = layer.getContainer().get(_l7Core.TYPES.ILayerService); // 注册 Attribute
|
|
72
|
+
|
|
73
|
+
this.registerBuiltinAttributes(); // 开启动画
|
|
54
74
|
|
|
55
|
-
// 注册 Attribute
|
|
56
|
-
this.registerBuiltinAttributes();
|
|
57
|
-
// 开启动画
|
|
58
75
|
this.startModelAnimate();
|
|
59
76
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
60
77
|
this.createTexture2D = createTexture2D;
|
|
61
78
|
this.DATA_TEXTURE_WIDTH = 1024; // 数据纹理固定宽度
|
|
79
|
+
|
|
62
80
|
this.rowCount = 1;
|
|
63
81
|
this.cellLength = 0;
|
|
64
82
|
this.cellProperties = [];
|
|
@@ -78,8 +96,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
78
96
|
hasStroke: 0,
|
|
79
97
|
hasOffsets: 0
|
|
80
98
|
};
|
|
81
|
-
this.dataTextureTest = this.layerService.getOESTextureFloat();
|
|
82
|
-
|
|
99
|
+
this.dataTextureTest = this.layerService.getOESTextureFloat(); // 只有在不支持数据纹理的情况下进行赋值
|
|
100
|
+
|
|
83
101
|
if (!this.dataTextureTest) {
|
|
84
102
|
this.dataTexture = this.createTexture2D({
|
|
85
103
|
// data: new Uint8ClampedArray(4),
|
|
@@ -92,18 +110,20 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
92
110
|
height: 1
|
|
93
111
|
});
|
|
94
112
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// style datatexture mapping
|
|
113
|
+
} // style datatexture mapping
|
|
98
114
|
|
|
99
115
|
/**
|
|
100
116
|
* 清除上一次的计算结果 - 全量清除
|
|
101
117
|
*/
|
|
118
|
+
|
|
119
|
+
|
|
102
120
|
(0, _createClass2.default)(BaseModel, [{
|
|
103
121
|
key: "clearLastCalRes",
|
|
104
122
|
value: function clearLastCalRes() {
|
|
105
123
|
this.cellProperties = []; // 清空上一次计算的需要进行数据映射的属性集合
|
|
124
|
+
|
|
106
125
|
this.cellLength = 0; // 清空上一次计算的 cell 的长度
|
|
126
|
+
|
|
107
127
|
this.stylePropertiesExist = {
|
|
108
128
|
// 全量清空上一次是否需要对 style 属性进行数据映射的判断
|
|
109
129
|
hasThetaOffset: 0,
|
|
@@ -118,91 +138,82 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
118
138
|
key: "getCellTypeLayout",
|
|
119
139
|
value: function getCellTypeLayout() {
|
|
120
140
|
if (this.dataTextureTest) {
|
|
121
|
-
return [
|
|
122
|
-
//
|
|
123
|
-
this.
|
|
124
|
-
//
|
|
125
|
-
this.
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
this.stylePropertiesExist.hasOpacity,
|
|
130
|
-
// cell 中是否存在 opacity
|
|
131
|
-
this.stylePropertiesExist.hasStrokeOpacity,
|
|
132
|
-
// cell 中是否存在 strokeOpacity
|
|
133
|
-
this.stylePropertiesExist.hasStrokeWidth,
|
|
134
|
-
// cell 中是否存在 strokeWidth
|
|
135
|
-
this.stylePropertiesExist.hasStroke,
|
|
136
|
-
// cell 中是否存在 stroke
|
|
141
|
+
return [// 0
|
|
142
|
+
this.rowCount, // 数据纹理有几行
|
|
143
|
+
this.DATA_TEXTURE_WIDTH, // 数据纹理有几列
|
|
144
|
+
0.0, 0.0, // 1
|
|
145
|
+
this.stylePropertiesExist.hasOpacity, // cell 中是否存在 opacity
|
|
146
|
+
this.stylePropertiesExist.hasStrokeOpacity, // cell 中是否存在 strokeOpacity
|
|
147
|
+
this.stylePropertiesExist.hasStrokeWidth, // cell 中是否存在 strokeWidth
|
|
148
|
+
this.stylePropertiesExist.hasStroke, // cell 中是否存在 stroke
|
|
137
149
|
// 2
|
|
138
|
-
this.stylePropertiesExist.hasOffsets,
|
|
139
|
-
// cell 中是否存在
|
|
140
|
-
|
|
141
|
-
// cell 中是否存在 thetaOffset
|
|
142
|
-
0.0, 0.0,
|
|
143
|
-
// 3
|
|
150
|
+
this.stylePropertiesExist.hasOffsets, // cell 中是否存在 offsets
|
|
151
|
+
this.stylePropertiesExist.hasThetaOffset, // cell 中是否存在 thetaOffset
|
|
152
|
+
0.0, 0.0, // 3
|
|
144
153
|
0.0, 0.0, 0.0, 1.0];
|
|
145
154
|
} else {
|
|
146
|
-
return [1.0,
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
0.0,
|
|
151
|
-
// cell 中是否存在
|
|
152
|
-
0.0,
|
|
153
|
-
// cell 中是否存在 strokeOpacity
|
|
154
|
-
0.0,
|
|
155
|
-
// cell 中是否存在 strokeWidth
|
|
156
|
-
0.0,
|
|
157
|
-
// cell 中是否存在 stroke
|
|
158
|
-
0.0,
|
|
159
|
-
// cell 中是否存在 offsets
|
|
155
|
+
return [1.0, // 数据纹理有几行
|
|
156
|
+
1.0, // 数据纹理有几列
|
|
157
|
+
0.0, 0.0, 0.0, // cell 中是否存在 opacity
|
|
158
|
+
0.0, // cell 中是否存在 strokeOpacity
|
|
159
|
+
0.0, // cell 中是否存在 strokeWidth
|
|
160
|
+
0.0, // cell 中是否存在 stroke
|
|
161
|
+
0.0, // cell 中是否存在 offsets
|
|
160
162
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0];
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
|
-
|
|
164
165
|
/**
|
|
165
166
|
* 判断数据纹理是否需要重新计算 - 根据传入的值进行判断
|
|
166
167
|
* @param options
|
|
167
168
|
* @returns
|
|
168
169
|
*/
|
|
170
|
+
|
|
169
171
|
}, {
|
|
170
172
|
key: "dataTextureNeedUpdate",
|
|
171
173
|
value: function dataTextureNeedUpdate(options) {
|
|
172
174
|
var isUpdate = false;
|
|
175
|
+
|
|
173
176
|
if (!(0, _lodash.isEqual)(options.thetaOffset, this.cacheStyleProperties.thetaOffset)) {
|
|
174
177
|
isUpdate = true;
|
|
175
178
|
this.cacheStyleProperties.thetaOffset = options.thetaOffset;
|
|
176
179
|
}
|
|
180
|
+
|
|
177
181
|
if (!(0, _lodash.isEqual)(options.opacity, this.cacheStyleProperties.opacity)) {
|
|
178
182
|
isUpdate = true;
|
|
179
183
|
this.cacheStyleProperties.opacity = options.opacity;
|
|
180
184
|
}
|
|
185
|
+
|
|
181
186
|
if (!(0, _lodash.isEqual)(options.strokeOpacity, this.cacheStyleProperties.strokeOpacity)) {
|
|
182
187
|
isUpdate = true;
|
|
183
188
|
this.cacheStyleProperties.strokeOpacity = options.strokeOpacity;
|
|
184
189
|
}
|
|
190
|
+
|
|
185
191
|
if (!(0, _lodash.isEqual)(options.strokeWidth, this.cacheStyleProperties.strokeWidth)) {
|
|
186
192
|
isUpdate = true;
|
|
187
193
|
this.cacheStyleProperties.strokeWidth = options.strokeWidth;
|
|
188
194
|
}
|
|
195
|
+
|
|
189
196
|
if (!(0, _lodash.isEqual)(options.stroke, this.cacheStyleProperties.stroke)) {
|
|
190
197
|
isUpdate = true;
|
|
191
198
|
this.cacheStyleProperties.stroke = options.stroke;
|
|
192
199
|
}
|
|
200
|
+
|
|
193
201
|
if (!(0, _lodash.isEqual)(options.offsets, this.cacheStyleProperties.offsets)) {
|
|
194
202
|
isUpdate = true;
|
|
195
203
|
this.cacheStyleProperties.offsets = options.offsets;
|
|
196
204
|
}
|
|
205
|
+
|
|
197
206
|
if (this.dataTexture === undefined) {
|
|
198
207
|
isUpdate = true;
|
|
199
208
|
}
|
|
209
|
+
|
|
200
210
|
return isUpdate;
|
|
201
211
|
}
|
|
202
212
|
/**
|
|
203
213
|
* 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量
|
|
204
214
|
* @param options
|
|
205
215
|
*/
|
|
216
|
+
|
|
206
217
|
}, {
|
|
207
218
|
key: "judgeStyleAttributes",
|
|
208
219
|
value: function judgeStyleAttributes(options) {
|
|
@@ -217,6 +228,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
217
228
|
this.stylePropertiesExist.hasOpacity = 1;
|
|
218
229
|
this.cellLength += 1;
|
|
219
230
|
}
|
|
231
|
+
|
|
220
232
|
if (options.strokeOpacity !== undefined && !(0, _lodash.isNumber)(options.strokeOpacity)) {
|
|
221
233
|
// 数据映射
|
|
222
234
|
this.cellProperties.push({
|
|
@@ -226,6 +238,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
226
238
|
this.stylePropertiesExist.hasStrokeOpacity = 1;
|
|
227
239
|
this.cellLength += 1;
|
|
228
240
|
}
|
|
241
|
+
|
|
229
242
|
if (options.strokeWidth !== undefined && !(0, _lodash.isNumber)(options.strokeWidth)) {
|
|
230
243
|
// 数据映射
|
|
231
244
|
this.cellProperties.push({
|
|
@@ -235,6 +248,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
235
248
|
this.stylePropertiesExist.hasStrokeWidth = 1;
|
|
236
249
|
this.cellLength += 1;
|
|
237
250
|
}
|
|
251
|
+
|
|
238
252
|
if (options.stroke !== undefined && !this.isStaticColor(options.stroke)) {
|
|
239
253
|
// 数据映射
|
|
240
254
|
this.cellProperties.push({
|
|
@@ -244,6 +258,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
244
258
|
this.stylePropertiesExist.hasStroke = 1;
|
|
245
259
|
this.cellLength += 4;
|
|
246
260
|
}
|
|
261
|
+
|
|
247
262
|
if (options.offsets !== undefined && !this.isOffsetStatic(options.offsets)) {
|
|
248
263
|
// 数据映射
|
|
249
264
|
this.cellProperties.push({
|
|
@@ -253,6 +268,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
253
268
|
this.stylePropertiesExist.hasOffsets = 1;
|
|
254
269
|
this.cellLength += 2;
|
|
255
270
|
}
|
|
271
|
+
|
|
256
272
|
if (options.thetaOffset !== undefined && !(0, _lodash.isNumber)(options.thetaOffset)) {
|
|
257
273
|
// 数据映射
|
|
258
274
|
this.cellProperties.push({
|
|
@@ -263,12 +279,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
263
279
|
this.cellLength += 1;
|
|
264
280
|
}
|
|
265
281
|
}
|
|
266
|
-
|
|
267
282
|
/**
|
|
268
283
|
* 判断变量 stroke 是否是常量值
|
|
269
284
|
* @param stroke
|
|
270
285
|
* @returns
|
|
271
286
|
*/
|
|
287
|
+
|
|
272
288
|
}, {
|
|
273
289
|
key: "isStaticColor",
|
|
274
290
|
value: function isStaticColor(stroke) {
|
|
@@ -279,6 +295,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
279
295
|
return false;
|
|
280
296
|
}
|
|
281
297
|
}
|
|
298
|
+
|
|
282
299
|
return false;
|
|
283
300
|
}
|
|
284
301
|
/**
|
|
@@ -286,6 +303,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
286
303
|
* @param stroke
|
|
287
304
|
* @returns
|
|
288
305
|
*/
|
|
306
|
+
|
|
289
307
|
}, {
|
|
290
308
|
key: "getStrokeColor",
|
|
291
309
|
value: function getStrokeColor(stroke) {
|
|
@@ -300,12 +318,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
300
318
|
return [0, 0, 0, 0];
|
|
301
319
|
}
|
|
302
320
|
}
|
|
303
|
-
|
|
304
321
|
/**
|
|
305
322
|
* 判断 offsets 是否是常量
|
|
306
323
|
* @param offsets
|
|
307
324
|
* @returns
|
|
308
325
|
*/
|
|
326
|
+
|
|
309
327
|
}, {
|
|
310
328
|
key: "isOffsetStatic",
|
|
311
329
|
value: function isOffsetStatic(offsets) {
|
|
@@ -315,12 +333,12 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
315
333
|
return false;
|
|
316
334
|
}
|
|
317
335
|
}
|
|
318
|
-
|
|
319
336
|
/**
|
|
320
337
|
* 补空位
|
|
321
338
|
* @param d
|
|
322
339
|
* @param count
|
|
323
340
|
*/
|
|
341
|
+
|
|
324
342
|
}, {
|
|
325
343
|
key: "patchMod",
|
|
326
344
|
value: function patchMod(d, count) {
|
|
@@ -328,24 +346,26 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
328
346
|
d.push(-1);
|
|
329
347
|
}
|
|
330
348
|
}
|
|
331
|
-
|
|
332
349
|
/**
|
|
333
350
|
* 根据映射的数据字段往推入数据
|
|
334
351
|
* @param d
|
|
335
352
|
* @param cellData
|
|
336
353
|
* @param cellPropertiesLayouts
|
|
337
354
|
*/
|
|
355
|
+
|
|
338
356
|
}, {
|
|
339
357
|
key: "patchData",
|
|
340
358
|
value: function patchData(d, cellData, cellPropertiesLayouts) {
|
|
341
359
|
var _iterator = _createForOfIteratorHelper(cellPropertiesLayouts),
|
|
342
|
-
|
|
360
|
+
_step;
|
|
361
|
+
|
|
343
362
|
try {
|
|
344
363
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
345
364
|
var layout = _step.value;
|
|
346
365
|
var attr = layout.attr,
|
|
347
|
-
|
|
366
|
+
count = layout.count;
|
|
348
367
|
var value = cellData[attr];
|
|
368
|
+
|
|
349
369
|
if (value !== undefined) {
|
|
350
370
|
// 数据中存在该属性
|
|
351
371
|
if (attr === 'stroke') {
|
|
@@ -370,7 +390,6 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
370
390
|
_iterator.f();
|
|
371
391
|
}
|
|
372
392
|
}
|
|
373
|
-
|
|
374
393
|
/**
|
|
375
394
|
* 计算推入数据纹理的数据
|
|
376
395
|
* @param cellLength
|
|
@@ -378,6 +397,7 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
378
397
|
* @param cellPropertiesLayouts
|
|
379
398
|
* @returns
|
|
380
399
|
*/
|
|
400
|
+
|
|
381
401
|
}, {
|
|
382
402
|
key: "calDataFrame",
|
|
383
403
|
value: function calDataFrame(cellLength, encodeData, cellPropertiesLayouts) {
|
|
@@ -386,44 +406,48 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
386
406
|
|
|
387
407
|
var totalLength = rowCount * this.DATA_TEXTURE_WIDTH;
|
|
388
408
|
var d = [];
|
|
409
|
+
|
|
389
410
|
for (var i = 0; i < encodeDatalength; i++) {
|
|
390
411
|
// 根据 encodeData 数据推入数据
|
|
391
412
|
var cellData = encodeData[i];
|
|
392
413
|
this.patchData(d, cellData, cellPropertiesLayouts);
|
|
393
414
|
}
|
|
415
|
+
|
|
394
416
|
for (var _i = d.length; _i < totalLength; _i++) {
|
|
395
417
|
// 每行不足的部分用 -1 补足(数据纹理时 width * height 的矩形数据集合)
|
|
396
418
|
d.push(-1);
|
|
397
|
-
}
|
|
398
|
-
|
|
419
|
+
} // console.log('data', d)
|
|
420
|
+
|
|
421
|
+
|
|
399
422
|
return {
|
|
400
423
|
data: d,
|
|
401
424
|
width: this.DATA_TEXTURE_WIDTH,
|
|
402
425
|
height: rowCount
|
|
403
426
|
};
|
|
404
|
-
}
|
|
427
|
+
} // style datatexture mapping
|
|
405
428
|
|
|
406
|
-
// style datatexture mapping
|
|
407
429
|
}, {
|
|
408
430
|
key: "getBlend",
|
|
409
431
|
value: function getBlend() {
|
|
410
432
|
var _this$layer$getLayerC = this.layer.getLayerConfig(),
|
|
411
|
-
|
|
412
|
-
|
|
433
|
+
_this$layer$getLayerC2 = _this$layer$getLayerC.blend,
|
|
434
|
+
blend = _this$layer$getLayerC2 === void 0 ? 'normal' : _this$layer$getLayerC2;
|
|
435
|
+
|
|
413
436
|
return _blend.BlendTypes[_l7Core.BlendType[blend]];
|
|
414
437
|
}
|
|
415
438
|
}, {
|
|
416
439
|
key: "getStencil",
|
|
417
440
|
value: function getStencil(option) {
|
|
418
441
|
var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
442
|
+
_this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
|
|
443
|
+
mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
|
|
444
|
+
_this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
|
|
445
|
+
maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
|
|
446
|
+
enableMask = _this$layer$getLayerC3.enableMask,
|
|
447
|
+
_this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
|
|
448
|
+
maskOperation = _this$layer$getLayerC6 === void 0 ? _l7Core.MaskOperation.AND : _this$layer$getLayerC6; // TODO 临时处理,后期移除MaskLayer
|
|
449
|
+
|
|
450
|
+
|
|
427
451
|
if (this.layer.type === 'MaskLayer') {
|
|
428
452
|
return (0, _stencil.getStencilMask)({
|
|
429
453
|
isStencil: true,
|
|
@@ -437,12 +461,11 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
437
461
|
})); // 用于遮罩的stencil 参数
|
|
438
462
|
}
|
|
439
463
|
|
|
440
|
-
var maskflag = mask ||
|
|
441
|
-
//
|
|
442
|
-
enableMask && this.layer.masks.length !== 0 ||
|
|
443
|
-
// 外部图层的mask
|
|
464
|
+
var maskflag = mask || // mask 兼容历史写法
|
|
465
|
+
enableMask && this.layer.masks.length !== 0 || // 外部图层的mask
|
|
444
466
|
this.layer.tileMask !== undefined; // 瓦片图层
|
|
445
467
|
// !!(mask || enableMask || this.layer.tileMask);
|
|
468
|
+
|
|
446
469
|
return (0, _stencil.getStencil)(maskflag, maskInside);
|
|
447
470
|
}
|
|
448
471
|
}, {
|
|
@@ -465,58 +488,76 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
465
488
|
value: function () {
|
|
466
489
|
var _needUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
467
490
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
468
|
-
while (1)
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
491
|
+
while (1) {
|
|
492
|
+
switch (_context.prev = _context.next) {
|
|
493
|
+
case 0:
|
|
494
|
+
return _context.abrupt("return", false);
|
|
495
|
+
|
|
496
|
+
case 1:
|
|
497
|
+
case "end":
|
|
498
|
+
return _context.stop();
|
|
499
|
+
}
|
|
474
500
|
}
|
|
475
501
|
}, _callee);
|
|
476
502
|
}));
|
|
503
|
+
|
|
477
504
|
function needUpdate() {
|
|
478
505
|
return _needUpdate.apply(this, arguments);
|
|
479
506
|
}
|
|
507
|
+
|
|
480
508
|
return needUpdate;
|
|
481
509
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
510
|
+
|
|
482
511
|
}, {
|
|
483
512
|
key: "buildModels",
|
|
484
513
|
value: function () {
|
|
485
514
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
486
515
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
487
|
-
while (1)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
516
|
+
while (1) {
|
|
517
|
+
switch (_context2.prev = _context2.next) {
|
|
518
|
+
case 0:
|
|
519
|
+
throw new Error('Method not implemented.');
|
|
520
|
+
|
|
521
|
+
case 1:
|
|
522
|
+
case "end":
|
|
523
|
+
return _context2.stop();
|
|
524
|
+
}
|
|
493
525
|
}
|
|
494
526
|
}, _callee2);
|
|
495
527
|
}));
|
|
528
|
+
|
|
496
529
|
function buildModels() {
|
|
497
530
|
return _buildModels.apply(this, arguments);
|
|
498
531
|
}
|
|
532
|
+
|
|
499
533
|
return buildModels;
|
|
500
534
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
535
|
+
|
|
501
536
|
}, {
|
|
502
537
|
key: "initModels",
|
|
503
538
|
value: function () {
|
|
504
539
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
505
540
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
506
|
-
while (1)
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
541
|
+
while (1) {
|
|
542
|
+
switch (_context3.prev = _context3.next) {
|
|
543
|
+
case 0:
|
|
544
|
+
throw new Error('Method not implemented.');
|
|
545
|
+
|
|
546
|
+
case 1:
|
|
547
|
+
case "end":
|
|
548
|
+
return _context3.stop();
|
|
549
|
+
}
|
|
512
550
|
}
|
|
513
551
|
}, _callee3);
|
|
514
552
|
}));
|
|
553
|
+
|
|
515
554
|
function initModels() {
|
|
516
555
|
return _initModels.apply(this, arguments);
|
|
517
556
|
}
|
|
557
|
+
|
|
518
558
|
return initModels;
|
|
519
559
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
560
|
+
|
|
520
561
|
}, {
|
|
521
562
|
key: "clearModels",
|
|
522
563
|
value: function clearModels() {
|
|
@@ -527,8 +568,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
527
568
|
key: "getAttribute",
|
|
528
569
|
value: function getAttribute() {
|
|
529
570
|
throw new Error('Method not implemented.');
|
|
530
|
-
}
|
|
531
|
-
|
|
571
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
572
|
+
|
|
532
573
|
}, {
|
|
533
574
|
key: "render",
|
|
534
575
|
value: function render(renderOptions) {
|
|
@@ -548,7 +589,8 @@ var BaseModel = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
548
589
|
key: "startModelAnimate",
|
|
549
590
|
value: function startModelAnimate() {
|
|
550
591
|
var _ref = this.layer.getLayerConfig(),
|
|
551
|
-
|
|
592
|
+
animateOption = _ref.animateOption;
|
|
593
|
+
|
|
552
594
|
if (animateOption.enable) {
|
|
553
595
|
this.layer.setAnimateStartTime();
|
|
554
596
|
}
|