@antv/l7-layers 2.15.2 → 2.15.4
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 +320 -484
- package/es/core/BaseModel.js +97 -126
- 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 +10 -31
- package/es/core/triangulation.js +54 -114
- 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 +91 -146
- 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 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- 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 +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -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 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.js +197 -299
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- 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 +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- 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/dataMappingStyle.js +8 -18
- 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 +320 -478
- package/lib/core/BaseModel.js +97 -139
- 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 +10 -54
- package/lib/core/triangulation.js +53 -153
- 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 +91 -162
- 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 +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- 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 +80 -128
- 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 +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -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 +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +197 -307
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- 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 +30 -57
- 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 +28 -53
- 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/dataMappingStyle.js +8 -19
- 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) {
|
|
@@ -108,34 +100,26 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
108
100
|
key: "isParentLoaded",
|
|
109
101
|
value: function isParentLoaded(sourceTile) {
|
|
110
102
|
var parentTile = sourceTile.parent;
|
|
111
|
-
|
|
112
103
|
if (!parentTile) {
|
|
113
104
|
return true;
|
|
114
105
|
}
|
|
115
|
-
|
|
116
106
|
var tile = this.getTile(parentTile === null || parentTile === void 0 ? void 0 : parentTile.key);
|
|
117
|
-
|
|
118
107
|
if (tile !== null && tile !== void 0 && tile.isLoaded) {
|
|
119
108
|
// 递归父级
|
|
120
109
|
return true;
|
|
121
110
|
}
|
|
122
|
-
|
|
123
111
|
return false;
|
|
124
112
|
}
|
|
125
113
|
}, {
|
|
126
114
|
key: "isChildrenLoaded",
|
|
127
115
|
value: function isChildrenLoaded(sourceTile) {
|
|
128
116
|
var _this = this;
|
|
129
|
-
|
|
130
117
|
var childrenTile = sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.children;
|
|
131
|
-
|
|
132
118
|
if (childrenTile.length === 0) {
|
|
133
119
|
return true;
|
|
134
120
|
}
|
|
135
|
-
|
|
136
121
|
return childrenTile.some(function (tile) {
|
|
137
122
|
var tileLayer = _this.getTile(tile === null || tile === void 0 ? void 0 : tile.key);
|
|
138
|
-
|
|
139
123
|
return (tileLayer === null || tileLayer === void 0 ? void 0 : tileLayer.isLoaded) === false;
|
|
140
124
|
});
|
|
141
125
|
}
|
|
@@ -144,48 +128,38 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
144
128
|
value: function () {
|
|
145
129
|
var _render = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
146
130
|
var _this2 = this;
|
|
147
|
-
|
|
148
131
|
var layers, renders;
|
|
149
132
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
150
|
-
while (1) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}());
|
|
175
|
-
Promise.all(renders);
|
|
176
|
-
|
|
177
|
-
case 3:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context2.stop();
|
|
180
|
-
}
|
|
133
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
layers = this.getRenderLayers();
|
|
136
|
+
renders = layers.map( /*#__PURE__*/function () {
|
|
137
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(layer) {
|
|
138
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
139
|
+
while (1) switch (_context.prev = _context.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
_context.next = 2;
|
|
142
|
+
return _this2.layerService.renderTileLayer(layer);
|
|
143
|
+
case 2:
|
|
144
|
+
case "end":
|
|
145
|
+
return _context.stop();
|
|
146
|
+
}
|
|
147
|
+
}, _callee);
|
|
148
|
+
}));
|
|
149
|
+
return function (_x) {
|
|
150
|
+
return _ref2.apply(this, arguments);
|
|
151
|
+
};
|
|
152
|
+
}());
|
|
153
|
+
Promise.all(renders);
|
|
154
|
+
case 3:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
181
157
|
}
|
|
182
158
|
}, _callee2, this);
|
|
183
159
|
}));
|
|
184
|
-
|
|
185
160
|
function render() {
|
|
186
161
|
return _render.apply(this, arguments);
|
|
187
162
|
}
|
|
188
|
-
|
|
189
163
|
return render;
|
|
190
164
|
}()
|
|
191
165
|
}, {
|
|
@@ -228,5 +202,4 @@ var TileLayerService = /*#__PURE__*/function () {
|
|
|
228
202
|
}]);
|
|
229
203
|
return TileLayerService;
|
|
230
204
|
}();
|
|
231
|
-
|
|
232
205
|
exports.TileLayerService = TileLayerService;
|
|
@@ -1,36 +1,25 @@
|
|
|
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.TilePickService = void 0;
|
|
9
|
-
|
|
10
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
13
|
var _l7Core = require("@antv/l7-core");
|
|
21
|
-
|
|
22
14
|
var _l7Utils = require("@antv/l7-utils");
|
|
23
|
-
|
|
24
15
|
var _TileSourceService = require("./TileSourceService");
|
|
25
|
-
|
|
26
16
|
var SELECT = 'select';
|
|
27
17
|
var ACTIVE = 'active';
|
|
28
|
-
|
|
29
18
|
var TilePickService = /*#__PURE__*/function () {
|
|
30
19
|
function TilePickService(_ref) {
|
|
31
20
|
var layerService = _ref.layerService,
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
tileLayerService = _ref.tileLayerService,
|
|
22
|
+
parent = _ref.parent;
|
|
34
23
|
(0, _classCallCheck2.default)(this, TilePickService);
|
|
35
24
|
(0, _defineProperty2.default)(this, "tilePickID", new Map());
|
|
36
25
|
this.layerService = layerService;
|
|
@@ -38,13 +27,11 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
38
27
|
this.parent = parent;
|
|
39
28
|
this.tileSourceService = new _TileSourceService.TileSourceService();
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
(0, _createClass2.default)(TilePickService, [{
|
|
43
31
|
key: "pickRender",
|
|
44
32
|
value: function pickRender(target) {
|
|
45
33
|
// 一个 TileLayer 有多个 Tile,但是会同时触发事件的只有一个 Tile
|
|
46
34
|
var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
47
|
-
|
|
48
35
|
if (tile) {
|
|
49
36
|
// TODO 多图层拾取
|
|
50
37
|
var pickLayer = tile.getMainLayer();
|
|
@@ -56,18 +43,14 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
56
43
|
value: function pick(layer, target) {
|
|
57
44
|
var container = this.parent.getContainer();
|
|
58
45
|
var pickingService = container.get(_l7Core.TYPES.IPickingService);
|
|
59
|
-
|
|
60
46
|
if (layer.type === 'RasterLayer') {
|
|
61
47
|
var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
62
|
-
|
|
63
48
|
if (tile && tile.getMainLayer() !== undefined) {
|
|
64
49
|
var pickLayer = tile.getMainLayer();
|
|
65
50
|
return pickLayer.layerPickService.pickRasterLayer(pickLayer, target, this.parent);
|
|
66
51
|
}
|
|
67
|
-
|
|
68
52
|
return false;
|
|
69
53
|
}
|
|
70
|
-
|
|
71
54
|
this.pickRender(target);
|
|
72
55
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
73
56
|
}
|
|
@@ -76,10 +59,9 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
76
59
|
value: function selectFeature(pickedColors) {
|
|
77
60
|
// @ts-ignore
|
|
78
61
|
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
r = _pickedColors[0],
|
|
63
|
+
g = _pickedColors[1],
|
|
64
|
+
b = _pickedColors[2];
|
|
83
65
|
var id = this.color2PickId(r, g, b);
|
|
84
66
|
this.tilePickID.set(SELECT, id);
|
|
85
67
|
this.updateHighLight(r, g, b, SELECT);
|
|
@@ -89,10 +71,9 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
89
71
|
value: function highlightPickedFeature(pickedColors) {
|
|
90
72
|
// @ts-ignore
|
|
91
73
|
var _pickedColors2 = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
74
|
+
r = _pickedColors2[0],
|
|
75
|
+
g = _pickedColors2[1],
|
|
76
|
+
b = _pickedColors2[2];
|
|
96
77
|
var id = this.color2PickId(r, g, b);
|
|
97
78
|
this.tilePickID.set(ACTIVE, id);
|
|
98
79
|
this.updateHighLight(r, g, b, ACTIVE);
|
|
@@ -102,12 +83,10 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
102
83
|
value: function updateHighLight(r, g, b, type) {
|
|
103
84
|
this.tileLayerService.tiles.map(function (tile) {
|
|
104
85
|
var layer = tile.getMainLayer();
|
|
105
|
-
|
|
106
86
|
switch (type) {
|
|
107
87
|
case SELECT:
|
|
108
88
|
layer === null || layer === void 0 ? void 0 : layer.hooks.beforeSelect.call([r, g, b]);
|
|
109
89
|
break;
|
|
110
|
-
|
|
111
90
|
case ACTIVE:
|
|
112
91
|
layer === null || layer === void 0 ? void 0 : layer.hooks.beforeHighlight.call([r, g, b]);
|
|
113
92
|
break;
|
|
@@ -119,25 +98,21 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
119
98
|
value: function setPickState() {
|
|
120
99
|
var selectColor = this.tilePickID.get(SELECT);
|
|
121
100
|
var activeColor = this.tilePickID.get(ACTIVE);
|
|
122
|
-
|
|
123
101
|
if (selectColor) {
|
|
124
102
|
var _this$pickId2Color = this.pickId2Color(selectColor),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
103
|
+
_this$pickId2Color2 = (0, _slicedToArray2.default)(_this$pickId2Color, 3),
|
|
104
|
+
r = _this$pickId2Color2[0],
|
|
105
|
+
g = _this$pickId2Color2[1],
|
|
106
|
+
b = _this$pickId2Color2[2];
|
|
130
107
|
this.updateHighLight(r, g, b, SELECT);
|
|
131
108
|
return;
|
|
132
109
|
}
|
|
133
|
-
|
|
134
110
|
if (activeColor) {
|
|
135
111
|
var _this$pickId2Color3 = this.pickId2Color(activeColor),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
112
|
+
_this$pickId2Color4 = (0, _slicedToArray2.default)(_this$pickId2Color3, 3),
|
|
113
|
+
_r = _this$pickId2Color4[0],
|
|
114
|
+
_g = _this$pickId2Color4[1],
|
|
115
|
+
_b = _this$pickId2Color4[2];
|
|
141
116
|
this.updateHighLight(_r, _g, _b, ACTIVE);
|
|
142
117
|
return;
|
|
143
118
|
}
|
|
@@ -152,27 +127,31 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
152
127
|
value: function pickId2Color(str) {
|
|
153
128
|
return (0, _l7Utils.encodePickingColor)(str);
|
|
154
129
|
}
|
|
155
|
-
/** 从瓦片中根据数据 */
|
|
156
130
|
|
|
131
|
+
/** 从瓦片中根据数据 */
|
|
157
132
|
}, {
|
|
158
133
|
key: "getFeatureById",
|
|
159
134
|
value: function getFeatureById(pickedFeatureIdx) {
|
|
160
135
|
// 提取当前可见瓦片
|
|
161
136
|
var tiles = this.tileLayerService.getTiles().filter(function (tile) {
|
|
162
137
|
return tile.visible;
|
|
163
|
-
});
|
|
164
|
-
|
|
138
|
+
});
|
|
139
|
+
// 提取当前可见瓦片中匹配 ID 的 feature 列表
|
|
165
140
|
var features = [];
|
|
166
141
|
tiles.forEach(function (tile) {
|
|
167
142
|
features.push.apply(features, (0, _toConsumableArray2.default)(tile.getFeatureById(pickedFeatureIdx)));
|
|
168
|
-
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// 将 feature 列表合并后返回
|
|
169
146
|
// 统一返回成 polygon 的格式 点、线、面可以通用
|
|
147
|
+
|
|
170
148
|
// const data = this.tileSourceService.getCombineFeature(features);
|
|
171
149
|
|
|
172
150
|
return features;
|
|
173
|
-
}
|
|
174
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
151
|
+
}
|
|
175
152
|
|
|
153
|
+
// Tip: for interface define
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
176
155
|
}, {
|
|
177
156
|
key: "pickRasterLayer",
|
|
178
157
|
value: function pickRasterLayer(layer, target, parent) {
|
|
@@ -181,5 +160,4 @@ var TilePickService = /*#__PURE__*/function () {
|
|
|
181
160
|
}]);
|
|
182
161
|
return TilePickService;
|
|
183
162
|
}();
|
|
184
|
-
|
|
185
163
|
exports.TilePickService = TilePickService;
|