@antv/l7-layers 2.17.4 → 2.17.6
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 +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- 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 +27 -39
- package/es/core/triangulation.js +99 -136
- 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 +92 -149
- 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 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- 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 +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -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 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- 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 +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- 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/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 +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- 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 +27 -62
- package/lib/core/triangulation.js +98 -177
- 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 +92 -166
- 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 +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- 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 +78 -125
- 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 +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -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 +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- 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 +33 -60
- 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 +29 -54
- 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/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/lib/tile/manager/base.js
CHANGED
|
@@ -1,89 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Base = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _l7Core = require("@antv/l7-core");
|
|
23
|
-
|
|
24
15
|
var _utils = require("../style/utils");
|
|
25
|
-
|
|
26
16
|
var Base = /*#__PURE__*/function () {
|
|
27
17
|
function Base() {
|
|
28
18
|
(0, _classCallCheck2.default)(this, Base);
|
|
29
19
|
(0, _defineProperty2.default)(this, "tileCache", new Map());
|
|
30
20
|
(0, _defineProperty2.default)(this, "tileLayerCache", new Map());
|
|
31
21
|
}
|
|
32
|
-
|
|
33
22
|
(0, _createClass2.default)(Base, [{
|
|
34
23
|
key: "initTileLayers",
|
|
35
24
|
value: function () {
|
|
36
25
|
var _initTileLayers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layers, tile) {
|
|
37
26
|
var _this = this;
|
|
38
|
-
|
|
39
27
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
40
|
-
while (1) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return function (_x3) {
|
|
71
|
-
return _ref.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
}())));
|
|
74
|
-
|
|
75
|
-
case 1:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context2.stop();
|
|
78
|
-
}
|
|
28
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
|
|
31
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer) {
|
|
32
|
+
var container;
|
|
33
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
container = (0, _l7Core.createLayerContainer)(_this.parent.sceneContainer);
|
|
37
|
+
layer.setContainer(container, _this.parent.sceneContainer);
|
|
38
|
+
_context.next = 4;
|
|
39
|
+
return layer.init();
|
|
40
|
+
case 4:
|
|
41
|
+
_this.addChild(layer);
|
|
42
|
+
tile.layerLoad();
|
|
43
|
+
_this.render();
|
|
44
|
+
case 7:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee);
|
|
49
|
+
}));
|
|
50
|
+
return function (_x3) {
|
|
51
|
+
return _ref.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
}())));
|
|
54
|
+
case 1:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context2.stop();
|
|
79
57
|
}
|
|
80
58
|
}, _callee2);
|
|
81
59
|
}));
|
|
82
|
-
|
|
83
60
|
function initTileLayers(_x, _x2) {
|
|
84
61
|
return _initTileLayers.apply(this, arguments);
|
|
85
62
|
}
|
|
86
|
-
|
|
87
63
|
return initTileLayers;
|
|
88
64
|
}()
|
|
89
65
|
}, {
|
|
@@ -95,55 +71,48 @@ var Base = /*#__PURE__*/function () {
|
|
|
95
71
|
key: "hasTile",
|
|
96
72
|
value: function hasTile(tile) {
|
|
97
73
|
return this.tileCache.has(tile.key);
|
|
98
|
-
}
|
|
74
|
+
}
|
|
99
75
|
|
|
76
|
+
// 添加图层
|
|
100
77
|
}, {
|
|
101
78
|
key: "addTile",
|
|
102
79
|
value: function () {
|
|
103
80
|
var _addTile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tile) {
|
|
104
81
|
var layerCollections;
|
|
105
82
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
106
|
-
while (1) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return _context3.abrupt("return", layerCollections);
|
|
134
|
-
|
|
135
|
-
case 8:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
83
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
if (!this.hasTile(tile)) {
|
|
86
|
+
_context3.next = 2;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
return _context3.abrupt("return", {
|
|
90
|
+
layers: []
|
|
91
|
+
});
|
|
92
|
+
case 2:
|
|
93
|
+
// 存储当前 tile
|
|
94
|
+
this.tileCache.set(tile.key, tile);
|
|
95
|
+
|
|
96
|
+
// 创建 tile 对应的 layers
|
|
97
|
+
layerCollections = this.tileFactory.createTile(tile, this.initOptions); // // 初始化图层
|
|
98
|
+
_context3.next = 6;
|
|
99
|
+
return this.initTileLayers(layerCollections.layers, tile);
|
|
100
|
+
case 6:
|
|
101
|
+
this.tileLayerCache.set(tile.key, layerCollections.layers);
|
|
102
|
+
// const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
|
|
103
|
+
// tile.parent?.children.forEach((t)=>{
|
|
104
|
+
// updateLayersConfig(this.getLayers(t),'visible',visible)
|
|
105
|
+
// })
|
|
106
|
+
return _context3.abrupt("return", layerCollections);
|
|
107
|
+
case 8:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context3.stop();
|
|
139
110
|
}
|
|
140
111
|
}, _callee3, this);
|
|
141
112
|
}));
|
|
142
|
-
|
|
143
113
|
function addTile(_x4) {
|
|
144
114
|
return _addTile.apply(this, arguments);
|
|
145
115
|
}
|
|
146
|
-
|
|
147
116
|
return addTile;
|
|
148
117
|
}()
|
|
149
118
|
}, {
|
|
@@ -163,7 +132,6 @@ var Base = /*#__PURE__*/function () {
|
|
|
163
132
|
key: "addChildren",
|
|
164
133
|
value: function addChildren(layers) {
|
|
165
134
|
var _this$children;
|
|
166
|
-
|
|
167
135
|
(_this$children = this.children).push.apply(_this$children, (0, _toConsumableArray2.default)(layers));
|
|
168
136
|
}
|
|
169
137
|
}, {
|
|
@@ -182,11 +150,9 @@ var Base = /*#__PURE__*/function () {
|
|
|
182
150
|
key: "removeChild",
|
|
183
151
|
value: function removeChild(layer) {
|
|
184
152
|
var layerIndex = this.children.indexOf(layer);
|
|
185
|
-
|
|
186
153
|
if (layerIndex > -1) {
|
|
187
154
|
this.children.splice(layerIndex, 1);
|
|
188
155
|
}
|
|
189
|
-
|
|
190
156
|
layer.destroy();
|
|
191
157
|
}
|
|
192
158
|
}, {
|
|
@@ -195,7 +161,6 @@ var Base = /*#__PURE__*/function () {
|
|
|
195
161
|
if (!tile) {
|
|
196
162
|
return [];
|
|
197
163
|
}
|
|
198
|
-
|
|
199
164
|
return this.tileLayerCache.get(tile.key) || [];
|
|
200
165
|
}
|
|
201
166
|
}, {
|
|
@@ -220,7 +185,8 @@ var Base = /*#__PURE__*/function () {
|
|
|
220
185
|
}
|
|
221
186
|
}, {
|
|
222
187
|
key: "initTileFactory",
|
|
223
|
-
value: function initTileFactory() {
|
|
188
|
+
value: function initTileFactory() {
|
|
189
|
+
// this.tileFactory = new TileFactory({
|
|
224
190
|
// parent: this.parent,
|
|
225
191
|
// mapService: this.mapService,
|
|
226
192
|
// rendererService: this.rendererService,
|
|
@@ -241,11 +207,9 @@ var Base = /*#__PURE__*/function () {
|
|
|
241
207
|
key: "updateTileVisible",
|
|
242
208
|
value: function updateTileVisible(tile, layerService) {
|
|
243
209
|
var layers = this.getLayers(tile);
|
|
244
|
-
|
|
245
210
|
if (layers.length === 0) {
|
|
246
211
|
return;
|
|
247
212
|
}
|
|
248
|
-
|
|
249
213
|
if (tile.isVisible) {
|
|
250
214
|
// 如果可见直接进行渲染,父级发
|
|
251
215
|
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
@@ -258,16 +222,16 @@ var Base = /*#__PURE__*/function () {
|
|
|
258
222
|
// console.log(`${t.x}/${t.y}/${t.z}`)
|
|
259
223
|
// })
|
|
260
224
|
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
261
|
-
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// this.listenLoad(tile, () => {
|
|
262
228
|
// this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
263
229
|
// })
|
|
264
|
-
|
|
265
230
|
}
|
|
266
231
|
}, {
|
|
267
232
|
key: "listenLoad",
|
|
268
233
|
value: function listenLoad(tile, callback) {
|
|
269
234
|
var _tile$parent;
|
|
270
|
-
|
|
271
235
|
tile.once('layerLoaded', function () {
|
|
272
236
|
callback();
|
|
273
237
|
});
|
|
@@ -286,7 +250,6 @@ var Base = /*#__PURE__*/function () {
|
|
|
286
250
|
if (tile.isLoad) {
|
|
287
251
|
return true;
|
|
288
252
|
}
|
|
289
|
-
|
|
290
253
|
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
291
254
|
tile.isLoad = isLoad;
|
|
292
255
|
return isLoad;
|
|
@@ -295,11 +258,9 @@ var Base = /*#__PURE__*/function () {
|
|
|
295
258
|
key: "isTileChildLoaded",
|
|
296
259
|
value: function isTileChildLoaded(tile) {
|
|
297
260
|
var _this2 = this;
|
|
298
|
-
|
|
299
261
|
if (tile.isChildLoad) {
|
|
300
262
|
return true;
|
|
301
263
|
}
|
|
302
|
-
|
|
303
264
|
var children = tile.children;
|
|
304
265
|
var isLoad = children.filter(function (child) {
|
|
305
266
|
return _this2.isTileLoaded(child);
|
|
@@ -311,7 +272,6 @@ var Base = /*#__PURE__*/function () {
|
|
|
311
272
|
key: "isTileParentLoaded",
|
|
312
273
|
value: function isTileParentLoaded(tile) {
|
|
313
274
|
var parent = tile.parent;
|
|
314
|
-
|
|
315
275
|
if (!parent) {
|
|
316
276
|
return true;
|
|
317
277
|
} else {
|
|
@@ -335,5 +295,4 @@ var Base = /*#__PURE__*/function () {
|
|
|
335
295
|
}]);
|
|
336
296
|
return Base;
|
|
337
297
|
}();
|
|
338
|
-
|
|
339
298
|
exports.Base = Base;
|
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.TileLayerService = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
require("reflect-metadata");
|
|
23
|
-
|
|
24
15
|
var TileLayerService = /*#__PURE__*/function () {
|
|
25
16
|
/**
|
|
26
17
|
* tileResource 用于存储瓦片的全局资源
|
|
27
18
|
*/
|
|
19
|
+
|
|
28
20
|
function TileLayerService(_ref) {
|
|
29
21
|
var rendererService = _ref.rendererService,
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
layerService = _ref.layerService,
|
|
23
|
+
parent = _ref.parent;
|
|
32
24
|
(0, _classCallCheck2.default)(this, TileLayerService);
|
|
33
25
|
(0, _defineProperty2.default)(this, "tileResource", new Map());
|
|
34
26
|
(0, _defineProperty2.default)(this, "layerTiles", []);
|
|
@@ -36,7 +28,6 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
36
28
|
this.layerService = layerService;
|
|
37
29
|
this.parent = parent;
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
(0, _createClass2.default)(TileLayerService, [{
|
|
41
32
|
key: "tiles",
|
|
42
33
|
get: function get() {
|
|
@@ -76,7 +67,6 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
76
67
|
return t.key === tileKey;
|
|
77
68
|
});
|
|
78
69
|
var tile = this.layerTiles.splice(index, 1);
|
|
79
|
-
|
|
80
70
|
if (tile[0]) {
|
|
81
71
|
tile[0].destroy();
|
|
82
72
|
}
|
|
@@ -84,7 +74,8 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
84
74
|
}, {
|
|
85
75
|
key: "updateTileVisible",
|
|
86
76
|
value: function updateTileVisible(sourceTile) {
|
|
87
|
-
var tile = this.getTile(sourceTile.key);
|
|
77
|
+
var tile = this.getTile(sourceTile.key);
|
|
78
|
+
// if(sourceTile.isVisible) {
|
|
88
79
|
// // 不可见 => 可见 兄弟节点加载完成
|
|
89
80
|
// if(sourceTile.parent) {
|
|
90
81
|
// const flag = this.isChildrenLoaded(sourceTile.parent)
|
|
@@ -92,6 +83,7 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
92
83
|
// } else {
|
|
93
84
|
// tile?.updateVisible(true);
|
|
94
85
|
// }
|
|
86
|
+
|
|
95
87
|
// } else {
|
|
96
88
|
// // 可见 => 不可见 兄弟节点加载完成
|
|
97
89
|
// if(sourceTile.parent) {
|
|
@@ -101,8 +93,8 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
101
93
|
// tile?.updateVisible(false);
|
|
102
94
|
// }
|
|
103
95
|
// }
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
tile === null || tile === void 0 ? void 0 : tile.updateVisible(sourceTile.isVisible);
|
|
97
|
+
// if (sourceTile.isVisible) {
|
|
106
98
|
// tile?.updateVisible(sourceTile.isVisible);
|
|
107
99
|
// } else {
|
|
108
100
|
// this.removeTile(sourceTile.key);
|
|
@@ -112,34 +104,26 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
112
104
|
key: "isParentLoaded",
|
|
113
105
|
value: function isParentLoaded(sourceTile) {
|
|
114
106
|
var parentTile = sourceTile.parent;
|
|
115
|
-
|
|
116
107
|
if (!parentTile) {
|
|
117
108
|
return true;
|
|
118
109
|
}
|
|
119
|
-
|
|
120
110
|
var tile = this.getTile(parentTile === null || parentTile === void 0 ? void 0 : parentTile.key);
|
|
121
|
-
|
|
122
111
|
if (tile !== null && tile !== void 0 && tile.isLoaded) {
|
|
123
112
|
// 递归父级
|
|
124
113
|
return true;
|
|
125
114
|
}
|
|
126
|
-
|
|
127
115
|
return false;
|
|
128
116
|
}
|
|
129
117
|
}, {
|
|
130
118
|
key: "isChildrenLoaded",
|
|
131
119
|
value: function isChildrenLoaded(sourceTile) {
|
|
132
120
|
var _this = this;
|
|
133
|
-
|
|
134
121
|
var childrenTile = sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.children;
|
|
135
|
-
|
|
136
122
|
if (childrenTile.length === 0) {
|
|
137
123
|
return true;
|
|
138
124
|
}
|
|
139
|
-
|
|
140
125
|
return childrenTile.some(function (tile) {
|
|
141
126
|
var tileLayer = _this.getTile(tile === null || tile === void 0 ? void 0 : tile.key);
|
|
142
|
-
|
|
143
127
|
return (tileLayer === null || tileLayer === void 0 ? void 0 : tileLayer.isLoaded) === false;
|
|
144
128
|
});
|
|
145
129
|
}
|
|
@@ -148,49 +132,39 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
148
132
|
value: function () {
|
|
149
133
|
var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
150
134
|
var _this2 = this;
|
|
151
|
-
|
|
152
135
|
var layers, renders;
|
|
153
136
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
154
|
-
while (1) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
_context2.next = 4;
|
|
180
|
-
return Promise.all(renders);
|
|
181
|
-
|
|
182
|
-
case 4:
|
|
183
|
-
case "end":
|
|
184
|
-
return _context2.stop();
|
|
185
|
-
}
|
|
137
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
layers = this.getRenderLayers();
|
|
140
|
+
renders = layers.map( /*#__PURE__*/function () {
|
|
141
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer) {
|
|
142
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
143
|
+
while (1) switch (_context.prev = _context.next) {
|
|
144
|
+
case 0:
|
|
145
|
+
_context.next = 2;
|
|
146
|
+
return _this2.layerService.renderTileLayer(layer);
|
|
147
|
+
case 2:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context.stop();
|
|
150
|
+
}
|
|
151
|
+
}, _callee);
|
|
152
|
+
}));
|
|
153
|
+
return function (_x) {
|
|
154
|
+
return _ref2.apply(this, arguments);
|
|
155
|
+
};
|
|
156
|
+
}());
|
|
157
|
+
_context2.next = 4;
|
|
158
|
+
return Promise.all(renders);
|
|
159
|
+
case 4:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context2.stop();
|
|
186
162
|
}
|
|
187
163
|
}, _callee2, this);
|
|
188
164
|
}));
|
|
189
|
-
|
|
190
165
|
function render() {
|
|
191
166
|
return _render.apply(this, arguments);
|
|
192
167
|
}
|
|
193
|
-
|
|
194
168
|
return render;
|
|
195
169
|
}()
|
|
196
170
|
}, {
|
|
@@ -233,5 +207,4 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
233
207
|
}]);
|
|
234
208
|
return TileLayerService;
|
|
235
209
|
}();
|
|
236
|
-
|
|
237
210
|
exports.TileLayerService = TileLayerService;
|