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