@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/es/tile/manager/base.js
CHANGED
|
@@ -9,66 +9,50 @@ import { updateLayersConfig } from "../style/utils";
|
|
|
9
9
|
export var Base = /*#__PURE__*/function () {
|
|
10
10
|
function Base() {
|
|
11
11
|
_classCallCheck(this, Base);
|
|
12
|
-
|
|
13
12
|
_defineProperty(this, "tileCache", new Map());
|
|
14
|
-
|
|
15
13
|
_defineProperty(this, "tileLayerCache", new Map());
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
_createClass(Base, [{
|
|
19
16
|
key: "initTileLayers",
|
|
20
17
|
value: function () {
|
|
21
18
|
var _initTileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layers, tile) {
|
|
22
19
|
var _this = this;
|
|
23
|
-
|
|
24
20
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
25
|
-
while (1) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return function (_x3) {
|
|
56
|
-
return _ref.apply(this, arguments);
|
|
57
|
-
};
|
|
58
|
-
}())));
|
|
59
|
-
|
|
60
|
-
case 1:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context2.stop();
|
|
63
|
-
}
|
|
21
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
return _context2.abrupt("return", Promise.all(layers.map( /*#__PURE__*/function () {
|
|
24
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
25
|
+
var container;
|
|
26
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
|
+
while (1) switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
container = createLayerContainer(_this.parent.sceneContainer);
|
|
30
|
+
layer.setContainer(container, _this.parent.sceneContainer);
|
|
31
|
+
_context.next = 4;
|
|
32
|
+
return layer.init();
|
|
33
|
+
case 4:
|
|
34
|
+
_this.addChild(layer);
|
|
35
|
+
tile.layerLoad();
|
|
36
|
+
_this.render();
|
|
37
|
+
case 7:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
43
|
+
return function (_x3) {
|
|
44
|
+
return _ref.apply(this, arguments);
|
|
45
|
+
};
|
|
46
|
+
}())));
|
|
47
|
+
case 1:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context2.stop();
|
|
64
50
|
}
|
|
65
51
|
}, _callee2);
|
|
66
52
|
}));
|
|
67
|
-
|
|
68
53
|
function initTileLayers(_x, _x2) {
|
|
69
54
|
return _initTileLayers.apply(this, arguments);
|
|
70
55
|
}
|
|
71
|
-
|
|
72
56
|
return initTileLayers;
|
|
73
57
|
}()
|
|
74
58
|
}, {
|
|
@@ -80,55 +64,48 @@ export var Base = /*#__PURE__*/function () {
|
|
|
80
64
|
key: "hasTile",
|
|
81
65
|
value: function hasTile(tile) {
|
|
82
66
|
return this.tileCache.has(tile.key);
|
|
83
|
-
}
|
|
67
|
+
}
|
|
84
68
|
|
|
69
|
+
// 添加图层
|
|
85
70
|
}, {
|
|
86
71
|
key: "addTile",
|
|
87
72
|
value: function () {
|
|
88
73
|
var _addTile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(tile) {
|
|
89
74
|
var layerCollections;
|
|
90
75
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
91
|
-
while (1) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return _context3.abrupt("return", layerCollections);
|
|
119
|
-
|
|
120
|
-
case 8:
|
|
121
|
-
case "end":
|
|
122
|
-
return _context3.stop();
|
|
123
|
-
}
|
|
76
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
if (!this.hasTile(tile)) {
|
|
79
|
+
_context3.next = 2;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
return _context3.abrupt("return", {
|
|
83
|
+
layers: []
|
|
84
|
+
});
|
|
85
|
+
case 2:
|
|
86
|
+
// 存储当前 tile
|
|
87
|
+
this.tileCache.set(tile.key, tile);
|
|
88
|
+
|
|
89
|
+
// 创建 tile 对应的 layers
|
|
90
|
+
layerCollections = this.tileFactory.createTile(tile, this.initOptions); // // 初始化图层
|
|
91
|
+
_context3.next = 6;
|
|
92
|
+
return this.initTileLayers(layerCollections.layers, tile);
|
|
93
|
+
case 6:
|
|
94
|
+
this.tileLayerCache.set(tile.key, layerCollections.layers);
|
|
95
|
+
// const visible = tile.parent ? tile.parent.children.every(t=>this.tileLayerCache.has(t.key)) : true
|
|
96
|
+
// tile.parent?.children.forEach((t)=>{
|
|
97
|
+
// updateLayersConfig(this.getLayers(t),'visible',visible)
|
|
98
|
+
// })
|
|
99
|
+
return _context3.abrupt("return", layerCollections);
|
|
100
|
+
case 8:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context3.stop();
|
|
124
103
|
}
|
|
125
104
|
}, _callee3, this);
|
|
126
105
|
}));
|
|
127
|
-
|
|
128
106
|
function addTile(_x4) {
|
|
129
107
|
return _addTile.apply(this, arguments);
|
|
130
108
|
}
|
|
131
|
-
|
|
132
109
|
return addTile;
|
|
133
110
|
}()
|
|
134
111
|
}, {
|
|
@@ -148,7 +125,6 @@ export var Base = /*#__PURE__*/function () {
|
|
|
148
125
|
key: "addChildren",
|
|
149
126
|
value: function addChildren(layers) {
|
|
150
127
|
var _this$children;
|
|
151
|
-
|
|
152
128
|
(_this$children = this.children).push.apply(_this$children, _toConsumableArray(layers));
|
|
153
129
|
}
|
|
154
130
|
}, {
|
|
@@ -167,11 +143,9 @@ export var Base = /*#__PURE__*/function () {
|
|
|
167
143
|
key: "removeChild",
|
|
168
144
|
value: function removeChild(layer) {
|
|
169
145
|
var layerIndex = this.children.indexOf(layer);
|
|
170
|
-
|
|
171
146
|
if (layerIndex > -1) {
|
|
172
147
|
this.children.splice(layerIndex, 1);
|
|
173
148
|
}
|
|
174
|
-
|
|
175
149
|
layer.destroy();
|
|
176
150
|
}
|
|
177
151
|
}, {
|
|
@@ -180,7 +154,6 @@ export var Base = /*#__PURE__*/function () {
|
|
|
180
154
|
if (!tile) {
|
|
181
155
|
return [];
|
|
182
156
|
}
|
|
183
|
-
|
|
184
157
|
return this.tileLayerCache.get(tile.key) || [];
|
|
185
158
|
}
|
|
186
159
|
}, {
|
|
@@ -205,7 +178,8 @@ export var Base = /*#__PURE__*/function () {
|
|
|
205
178
|
}
|
|
206
179
|
}, {
|
|
207
180
|
key: "initTileFactory",
|
|
208
|
-
value: function initTileFactory() {
|
|
181
|
+
value: function initTileFactory() {
|
|
182
|
+
// this.tileFactory = new TileFactory({
|
|
209
183
|
// parent: this.parent,
|
|
210
184
|
// mapService: this.mapService,
|
|
211
185
|
// rendererService: this.rendererService,
|
|
@@ -226,11 +200,9 @@ export var Base = /*#__PURE__*/function () {
|
|
|
226
200
|
key: "updateTileVisible",
|
|
227
201
|
value: function updateTileVisible(tile, layerService) {
|
|
228
202
|
var layers = this.getLayers(tile);
|
|
229
|
-
|
|
230
203
|
if (layers.length === 0) {
|
|
231
204
|
return;
|
|
232
205
|
}
|
|
233
|
-
|
|
234
206
|
if (tile.isVisible) {
|
|
235
207
|
// 如果可见直接进行渲染,父级发
|
|
236
208
|
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
@@ -243,16 +215,16 @@ export var Base = /*#__PURE__*/function () {
|
|
|
243
215
|
// console.log(`${t.x}/${t.y}/${t.z}`)
|
|
244
216
|
// })
|
|
245
217
|
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
246
|
-
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// this.listenLoad(tile, () => {
|
|
247
221
|
// this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
248
222
|
// })
|
|
249
|
-
|
|
250
223
|
}
|
|
251
224
|
}, {
|
|
252
225
|
key: "listenLoad",
|
|
253
226
|
value: function listenLoad(tile, callback) {
|
|
254
227
|
var _tile$parent;
|
|
255
|
-
|
|
256
228
|
tile.once('layerLoaded', function () {
|
|
257
229
|
callback();
|
|
258
230
|
});
|
|
@@ -271,7 +243,6 @@ export var Base = /*#__PURE__*/function () {
|
|
|
271
243
|
if (tile.isLoad) {
|
|
272
244
|
return true;
|
|
273
245
|
}
|
|
274
|
-
|
|
275
246
|
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
276
247
|
tile.isLoad = isLoad;
|
|
277
248
|
return isLoad;
|
|
@@ -280,11 +251,9 @@ export var Base = /*#__PURE__*/function () {
|
|
|
280
251
|
key: "isTileChildLoaded",
|
|
281
252
|
value: function isTileChildLoaded(tile) {
|
|
282
253
|
var _this2 = this;
|
|
283
|
-
|
|
284
254
|
if (tile.isChildLoad) {
|
|
285
255
|
return true;
|
|
286
256
|
}
|
|
287
|
-
|
|
288
257
|
var children = tile.children;
|
|
289
258
|
var isLoad = children.filter(function (child) {
|
|
290
259
|
return _this2.isTileLoaded(child);
|
|
@@ -296,7 +265,6 @@ export var Base = /*#__PURE__*/function () {
|
|
|
296
265
|
key: "isTileParentLoaded",
|
|
297
266
|
value: function isTileParentLoaded(tile) {
|
|
298
267
|
var parent = tile.parent;
|
|
299
|
-
|
|
300
268
|
if (!parent) {
|
|
301
269
|
return true;
|
|
302
270
|
} else {
|
|
@@ -318,6 +286,5 @@ export var Base = /*#__PURE__*/function () {
|
|
|
318
286
|
this.tileLayerCache.clear();
|
|
319
287
|
}
|
|
320
288
|
}]);
|
|
321
|
-
|
|
322
289
|
return Base;
|
|
323
290
|
}();
|
|
@@ -9,22 +9,18 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
9
9
|
/**
|
|
10
10
|
* tileResource 用于存储瓦片的全局资源
|
|
11
11
|
*/
|
|
12
|
+
|
|
12
13
|
function TileLayerService(_ref) {
|
|
13
14
|
var rendererService = _ref.rendererService,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
layerService = _ref.layerService,
|
|
16
|
+
parent = _ref.parent;
|
|
17
17
|
_classCallCheck(this, TileLayerService);
|
|
18
|
-
|
|
19
18
|
_defineProperty(this, "tileResource", new Map());
|
|
20
|
-
|
|
21
19
|
_defineProperty(this, "layerTiles", []);
|
|
22
|
-
|
|
23
20
|
this.rendererService = rendererService;
|
|
24
21
|
this.layerService = layerService;
|
|
25
22
|
this.parent = parent;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
_createClass(TileLayerService, [{
|
|
29
25
|
key: "tiles",
|
|
30
26
|
get: function get() {
|
|
@@ -64,7 +60,6 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
64
60
|
return t.key === tileKey;
|
|
65
61
|
});
|
|
66
62
|
var tile = this.layerTiles.splice(index, 1);
|
|
67
|
-
|
|
68
63
|
if (tile[0]) {
|
|
69
64
|
tile[0].destroy();
|
|
70
65
|
}
|
|
@@ -72,7 +67,8 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
72
67
|
}, {
|
|
73
68
|
key: "updateTileVisible",
|
|
74
69
|
value: function updateTileVisible(sourceTile) {
|
|
75
|
-
var tile = this.getTile(sourceTile.key);
|
|
70
|
+
var tile = this.getTile(sourceTile.key);
|
|
71
|
+
// if(sourceTile.isVisible) {
|
|
76
72
|
// // 不可见 => 可见 兄弟节点加载完成
|
|
77
73
|
// if(sourceTile.parent) {
|
|
78
74
|
// const flag = this.isChildrenLoaded(sourceTile.parent)
|
|
@@ -80,6 +76,7 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
80
76
|
// } else {
|
|
81
77
|
// tile?.updateVisible(true);
|
|
82
78
|
// }
|
|
79
|
+
|
|
83
80
|
// } else {
|
|
84
81
|
// // 可见 => 不可见 兄弟节点加载完成
|
|
85
82
|
// if(sourceTile.parent) {
|
|
@@ -96,34 +93,26 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
96
93
|
key: "isParentLoaded",
|
|
97
94
|
value: function isParentLoaded(sourceTile) {
|
|
98
95
|
var parentTile = sourceTile.parent;
|
|
99
|
-
|
|
100
96
|
if (!parentTile) {
|
|
101
97
|
return true;
|
|
102
98
|
}
|
|
103
|
-
|
|
104
99
|
var tile = this.getTile(parentTile === null || parentTile === void 0 ? void 0 : parentTile.key);
|
|
105
|
-
|
|
106
100
|
if (tile !== null && tile !== void 0 && tile.isLoaded) {
|
|
107
101
|
// 递归父级
|
|
108
102
|
return true;
|
|
109
103
|
}
|
|
110
|
-
|
|
111
104
|
return false;
|
|
112
105
|
}
|
|
113
106
|
}, {
|
|
114
107
|
key: "isChildrenLoaded",
|
|
115
108
|
value: function isChildrenLoaded(sourceTile) {
|
|
116
109
|
var _this = this;
|
|
117
|
-
|
|
118
110
|
var childrenTile = sourceTile === null || sourceTile === void 0 ? void 0 : sourceTile.children;
|
|
119
|
-
|
|
120
111
|
if (childrenTile.length === 0) {
|
|
121
112
|
return true;
|
|
122
113
|
}
|
|
123
|
-
|
|
124
114
|
return childrenTile.some(function (tile) {
|
|
125
115
|
var tileLayer = _this.getTile(tile === null || tile === void 0 ? void 0 : tile.key);
|
|
126
|
-
|
|
127
116
|
return (tileLayer === null || tileLayer === void 0 ? void 0 : tileLayer.isLoaded) === false;
|
|
128
117
|
});
|
|
129
118
|
}
|
|
@@ -132,48 +121,38 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
132
121
|
value: function () {
|
|
133
122
|
var _render = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
134
123
|
var _this2 = this;
|
|
135
|
-
|
|
136
124
|
var layers, renders;
|
|
137
125
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
138
|
-
while (1) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}());
|
|
163
|
-
Promise.all(renders);
|
|
164
|
-
|
|
165
|
-
case 3:
|
|
166
|
-
case "end":
|
|
167
|
-
return _context2.stop();
|
|
168
|
-
}
|
|
126
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
127
|
+
case 0:
|
|
128
|
+
layers = this.getRenderLayers();
|
|
129
|
+
renders = layers.map( /*#__PURE__*/function () {
|
|
130
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
131
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
132
|
+
while (1) switch (_context.prev = _context.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
_context.next = 2;
|
|
135
|
+
return _this2.layerService.renderTileLayer(layer);
|
|
136
|
+
case 2:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context.stop();
|
|
139
|
+
}
|
|
140
|
+
}, _callee);
|
|
141
|
+
}));
|
|
142
|
+
return function (_x) {
|
|
143
|
+
return _ref2.apply(this, arguments);
|
|
144
|
+
};
|
|
145
|
+
}());
|
|
146
|
+
Promise.all(renders);
|
|
147
|
+
case 3:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context2.stop();
|
|
169
150
|
}
|
|
170
151
|
}, _callee2, this);
|
|
171
152
|
}));
|
|
172
|
-
|
|
173
153
|
function render() {
|
|
174
154
|
return _render.apply(this, arguments);
|
|
175
155
|
}
|
|
176
|
-
|
|
177
156
|
return render;
|
|
178
157
|
}()
|
|
179
158
|
}, {
|
|
@@ -214,6 +193,5 @@ export var TileLayerService = /*#__PURE__*/function () {
|
|
|
214
193
|
this.tileResource.clear();
|
|
215
194
|
}
|
|
216
195
|
}]);
|
|
217
|
-
|
|
218
196
|
return TileLayerService;
|
|
219
197
|
}();
|
|
@@ -11,25 +11,20 @@ var ACTIVE = 'active';
|
|
|
11
11
|
export var TilePickService = /*#__PURE__*/function () {
|
|
12
12
|
function TilePickService(_ref) {
|
|
13
13
|
var layerService = _ref.layerService,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
tileLayerService = _ref.tileLayerService,
|
|
15
|
+
parent = _ref.parent;
|
|
17
16
|
_classCallCheck(this, TilePickService);
|
|
18
|
-
|
|
19
17
|
_defineProperty(this, "tilePickID", new Map());
|
|
20
|
-
|
|
21
18
|
this.layerService = layerService;
|
|
22
19
|
this.tileLayerService = tileLayerService;
|
|
23
20
|
this.parent = parent;
|
|
24
21
|
this.tileSourceService = new TileSourceService();
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
_createClass(TilePickService, [{
|
|
28
24
|
key: "pickRender",
|
|
29
25
|
value: function pickRender(target) {
|
|
30
26
|
// 一个 TileLayer 有多个 Tile,但是会同时触发事件的只有一个 Tile
|
|
31
27
|
var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
32
|
-
|
|
33
28
|
if (tile) {
|
|
34
29
|
// TODO 多图层拾取
|
|
35
30
|
var pickLayer = tile.getMainLayer();
|
|
@@ -41,18 +36,14 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
41
36
|
value: function pick(layer, target) {
|
|
42
37
|
var container = this.parent.getContainer();
|
|
43
38
|
var pickingService = container.get(TYPES.IPickingService);
|
|
44
|
-
|
|
45
39
|
if (layer.type === 'RasterLayer') {
|
|
46
40
|
var tile = this.tileLayerService.getVisibleTileBylngLat(target.lngLat);
|
|
47
|
-
|
|
48
41
|
if (tile && tile.getMainLayer() !== undefined) {
|
|
49
42
|
var pickLayer = tile.getMainLayer();
|
|
50
43
|
return pickLayer.layerPickService.pickRasterLayer(pickLayer, target, this.parent);
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
return false;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
this.pickRender(target);
|
|
57
48
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
58
49
|
}
|
|
@@ -61,10 +52,9 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
61
52
|
value: function selectFeature(pickedColors) {
|
|
62
53
|
// @ts-ignore
|
|
63
54
|
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
r = _pickedColors[0],
|
|
56
|
+
g = _pickedColors[1],
|
|
57
|
+
b = _pickedColors[2];
|
|
68
58
|
var id = this.color2PickId(r, g, b);
|
|
69
59
|
this.tilePickID.set(SELECT, id);
|
|
70
60
|
this.updateHighLight(r, g, b, SELECT);
|
|
@@ -74,10 +64,9 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
74
64
|
value: function highlightPickedFeature(pickedColors) {
|
|
75
65
|
// @ts-ignore
|
|
76
66
|
var _pickedColors2 = _slicedToArray(pickedColors, 3),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
r = _pickedColors2[0],
|
|
68
|
+
g = _pickedColors2[1],
|
|
69
|
+
b = _pickedColors2[2];
|
|
81
70
|
var id = this.color2PickId(r, g, b);
|
|
82
71
|
this.tilePickID.set(ACTIVE, id);
|
|
83
72
|
this.updateHighLight(r, g, b, ACTIVE);
|
|
@@ -87,12 +76,10 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
87
76
|
value: function updateHighLight(r, g, b, type) {
|
|
88
77
|
this.tileLayerService.tiles.map(function (tile) {
|
|
89
78
|
var layer = tile.getMainLayer();
|
|
90
|
-
|
|
91
79
|
switch (type) {
|
|
92
80
|
case SELECT:
|
|
93
81
|
layer === null || layer === void 0 ? void 0 : layer.hooks.beforeSelect.call([r, g, b]);
|
|
94
82
|
break;
|
|
95
|
-
|
|
96
83
|
case ACTIVE:
|
|
97
84
|
layer === null || layer === void 0 ? void 0 : layer.hooks.beforeHighlight.call([r, g, b]);
|
|
98
85
|
break;
|
|
@@ -104,25 +91,21 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
104
91
|
value: function setPickState() {
|
|
105
92
|
var selectColor = this.tilePickID.get(SELECT);
|
|
106
93
|
var activeColor = this.tilePickID.get(ACTIVE);
|
|
107
|
-
|
|
108
94
|
if (selectColor) {
|
|
109
95
|
var _this$pickId2Color = this.pickId2Color(selectColor),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
96
|
+
_this$pickId2Color2 = _slicedToArray(_this$pickId2Color, 3),
|
|
97
|
+
r = _this$pickId2Color2[0],
|
|
98
|
+
g = _this$pickId2Color2[1],
|
|
99
|
+
b = _this$pickId2Color2[2];
|
|
115
100
|
this.updateHighLight(r, g, b, SELECT);
|
|
116
101
|
return;
|
|
117
102
|
}
|
|
118
|
-
|
|
119
103
|
if (activeColor) {
|
|
120
104
|
var _this$pickId2Color3 = this.pickId2Color(activeColor),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
105
|
+
_this$pickId2Color4 = _slicedToArray(_this$pickId2Color3, 3),
|
|
106
|
+
_r = _this$pickId2Color4[0],
|
|
107
|
+
_g = _this$pickId2Color4[1],
|
|
108
|
+
_b = _this$pickId2Color4[2];
|
|
126
109
|
this.updateHighLight(_r, _g, _b, ACTIVE);
|
|
127
110
|
return;
|
|
128
111
|
}
|
|
@@ -137,33 +120,36 @@ export var TilePickService = /*#__PURE__*/function () {
|
|
|
137
120
|
value: function pickId2Color(str) {
|
|
138
121
|
return encodePickingColor(str);
|
|
139
122
|
}
|
|
140
|
-
/** 从瓦片中根据数据 */
|
|
141
123
|
|
|
124
|
+
/** 从瓦片中根据数据 */
|
|
142
125
|
}, {
|
|
143
126
|
key: "getFeatureById",
|
|
144
127
|
value: function getFeatureById(pickedFeatureIdx) {
|
|
145
128
|
// 提取当前可见瓦片
|
|
146
129
|
var tiles = this.tileLayerService.getTiles().filter(function (tile) {
|
|
147
130
|
return tile.visible;
|
|
148
|
-
});
|
|
149
|
-
|
|
131
|
+
});
|
|
132
|
+
// 提取当前可见瓦片中匹配 ID 的 feature 列表
|
|
150
133
|
var features = [];
|
|
151
134
|
tiles.forEach(function (tile) {
|
|
152
135
|
features.push.apply(features, _toConsumableArray(tile.getFeatureById(pickedFeatureIdx)));
|
|
153
|
-
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// 将 feature 列表合并后返回
|
|
154
139
|
// 统一返回成 polygon 的格式 点、线、面可以通用
|
|
140
|
+
|
|
155
141
|
// const data = this.tileSourceService.getCombineFeature(features);
|
|
156
142
|
|
|
157
143
|
return features;
|
|
158
|
-
}
|
|
159
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
144
|
+
}
|
|
160
145
|
|
|
146
|
+
// Tip: for interface define
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
161
148
|
}, {
|
|
162
149
|
key: "pickRasterLayer",
|
|
163
150
|
value: function pickRasterLayer(layer, target, parent) {
|
|
164
151
|
return false;
|
|
165
152
|
}
|
|
166
153
|
}]);
|
|
167
|
-
|
|
168
154
|
return TilePickService;
|
|
169
155
|
}();
|
|
@@ -3,37 +3,33 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
4
|
import * as turf from '@turf/helpers';
|
|
5
5
|
import union from '@turf/union';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* 专门处理 Tile 数据相关
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
export var TileSourceService = /*#__PURE__*/function () {
|
|
11
11
|
function TileSourceService() {
|
|
12
12
|
_classCallCheck(this, TileSourceService);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
14
|
_createClass(TileSourceService, [{
|
|
16
15
|
key: "getCombineFeature",
|
|
17
16
|
value: function getCombineFeature(features) {
|
|
18
17
|
var p = null;
|
|
19
18
|
var properties = features[0];
|
|
20
19
|
features.map(function (feature) {
|
|
21
|
-
var polygon = turf.polygon(feature.coordinates);
|
|
22
|
-
|
|
20
|
+
var polygon = turf.polygon(feature.coordinates);
|
|
21
|
+
// tslint:disable-next-line: prefer-conditional-expression
|
|
23
22
|
if (p === null) {
|
|
24
23
|
p = polygon;
|
|
25
24
|
} else {
|
|
26
25
|
p = union(p, polygon);
|
|
27
26
|
}
|
|
28
27
|
});
|
|
29
|
-
|
|
30
28
|
if (properties) {
|
|
31
29
|
p.properties = _objectSpread({}, properties);
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
return p;
|
|
35
32
|
}
|
|
36
33
|
}]);
|
|
37
|
-
|
|
38
34
|
return TileSourceService;
|
|
39
35
|
}();
|