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