@antv/l7-layers 2.19.2 → 2.19.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/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/line/models/simpleLine.js +2 -2
- package/es/line/shaders/simple/simpleline_linear_frag.glsl +3 -2
- package/es/line/shaders/simple/simpleline_vert.glsl +0 -2
- package/es/plugins/LayerModelPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +1 -1
- package/es/polygon/models/fill.js +12 -18
- package/es/tile/{tileLayer → core}/BaseLayer.js +6 -5
- package/es/tile/{tileFactory/layers → core}/TileDebugLayer.d.ts +2 -2
- package/es/tile/{tileFactory/layers → core}/TileDebugLayer.js +1 -1
- package/es/tile/service/TileLayerService.js +22 -26
- package/es/tile/{tileFactory → tile}/Tile.d.ts +3 -1
- package/es/tile/{tileFactory → tile}/Tile.js +29 -15
- package/es/tile/{tileFactory → tile}/VectorTile.js +10 -8
- package/lib/index.js +1 -1
- package/lib/line/models/simpleLine.js +2 -2
- package/lib/line/shaders/simple/simpleline_linear_frag.glsl +3 -2
- package/lib/line/shaders/simple/simpleline_vert.glsl +0 -2
- package/lib/plugins/LayerModelPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +1 -1
- package/lib/polygon/models/fill.js +12 -18
- package/lib/tile/{tileLayer → core}/BaseLayer.js +7 -6
- package/lib/tile/{tileFactory/layers → core}/TileDebugLayer.js +1 -1
- package/lib/tile/service/TileLayerService.js +22 -26
- package/lib/tile/{tileFactory → tile}/Tile.js +29 -15
- package/lib/tile/{tileFactory → tile}/VectorTile.js +10 -8
- package/package.json +7 -7
- package/es/tile/manager/base.d.ts +0 -35
- package/es/tile/manager/base.js +0 -290
- package/es/tile/style/utils.d.ts +0 -2
- package/es/tile/style/utils.js +0 -13
- package/lib/tile/manager/base.js +0 -298
- package/lib/tile/style/utils.js +0 -20
- /package/es/tile/{tileLayer → core}/BaseLayer.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/DebugTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/DebugTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/ImageTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/ImageTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/MaskTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/MaskTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/RasterRGBTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/RasterRGBTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/RasterTerrainRGBTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/RasterTerrainRGBTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/RasterTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/RasterTile.js +0 -0
- /package/es/tile/{tileFactory → tile}/VectorTile.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/index.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/index.js +0 -0
- /package/es/tile/{tileFactory → tile}/util.d.ts +0 -0
- /package/es/tile/{tileFactory → tile}/util.js +0 -0
- /package/es/tile/{style → utils}/constants.d.ts +0 -0
- /package/es/tile/{style → utils}/constants.js +0 -0
- /package/es/tile/{utils.d.ts → utils/utils.d.ts} +0 -0
- /package/es/tile/{utils.js → utils/utils.js} +0 -0
- /package/lib/tile/{tileFactory → tile}/DebugTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/ImageTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/MaskTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/RasterRGBTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/RasterTerrainRGBTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/RasterTile.js +0 -0
- /package/lib/tile/{tileFactory → tile}/index.js +0 -0
- /package/lib/tile/{tileFactory → tile}/util.js +0 -0
- /package/lib/tile/{style → utils}/constants.js +0 -0
- /package/lib/tile/{utils.js → utils/utils.js} +0 -0
package/lib/tile/manager/base.js
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.Base = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
var _l7Core = require("@antv/l7-core");
|
|
15
|
-
var _utils = require("../style/utils");
|
|
16
|
-
var Base = /*#__PURE__*/function () {
|
|
17
|
-
function Base() {
|
|
18
|
-
(0, _classCallCheck2.default)(this, Base);
|
|
19
|
-
(0, _defineProperty2.default)(this, "tileCache", new Map());
|
|
20
|
-
(0, _defineProperty2.default)(this, "tileLayerCache", new Map());
|
|
21
|
-
}
|
|
22
|
-
(0, _createClass2.default)(Base, [{
|
|
23
|
-
key: "initTileLayers",
|
|
24
|
-
value: function () {
|
|
25
|
-
var _initTileLayers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(layers, tile) {
|
|
26
|
-
var _this = this;
|
|
27
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
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();
|
|
57
|
-
}
|
|
58
|
-
}, _callee2);
|
|
59
|
-
}));
|
|
60
|
-
function initTileLayers(_x, _x2) {
|
|
61
|
-
return _initTileLayers.apply(this, arguments);
|
|
62
|
-
}
|
|
63
|
-
return initTileLayers;
|
|
64
|
-
}()
|
|
65
|
-
}, {
|
|
66
|
-
key: "render",
|
|
67
|
-
value: function render() {
|
|
68
|
-
this.parent.renderLayers();
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "hasTile",
|
|
72
|
-
value: function hasTile(tile) {
|
|
73
|
-
return this.tileCache.has(tile.key);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 添加图层
|
|
77
|
-
}, {
|
|
78
|
-
key: "addTile",
|
|
79
|
-
value: function () {
|
|
80
|
-
var _addTile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(tile) {
|
|
81
|
-
var layerCollections;
|
|
82
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
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();
|
|
110
|
-
}
|
|
111
|
-
}, _callee3, this);
|
|
112
|
-
}));
|
|
113
|
-
function addTile(_x4) {
|
|
114
|
-
return _addTile.apply(this, arguments);
|
|
115
|
-
}
|
|
116
|
-
return addTile;
|
|
117
|
-
}()
|
|
118
|
-
}, {
|
|
119
|
-
key: "removeTile",
|
|
120
|
-
value: function removeTile(tile) {
|
|
121
|
-
this.tileCache.delete(tile.key);
|
|
122
|
-
var layers = this.tileLayerCache.get(tile.key);
|
|
123
|
-
this.tileLayerCache.delete(tile.key);
|
|
124
|
-
this.removeLayers(layers, false);
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
127
|
-
key: "addChild",
|
|
128
|
-
value: function addChild(layer) {
|
|
129
|
-
this.children.push(layer);
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
key: "addChildren",
|
|
133
|
-
value: function addChildren(layers) {
|
|
134
|
-
var _this$children;
|
|
135
|
-
(_this$children = this.children).push.apply(_this$children, (0, _toConsumableArray2.default)(layers));
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "removeLayers",
|
|
139
|
-
value: function removeLayers() {
|
|
140
|
-
var layers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
141
|
-
var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
142
|
-
this.children = this.children.filter(function (child) {
|
|
143
|
-
return !layers.includes(child);
|
|
144
|
-
});
|
|
145
|
-
layers.map(function (layer) {
|
|
146
|
-
return layer.destroy(refresh);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "removeChild",
|
|
151
|
-
value: function removeChild(layer) {
|
|
152
|
-
var layerIndex = this.children.indexOf(layer);
|
|
153
|
-
if (layerIndex > -1) {
|
|
154
|
-
this.children.splice(layerIndex, 1);
|
|
155
|
-
}
|
|
156
|
-
layer.destroy();
|
|
157
|
-
}
|
|
158
|
-
}, {
|
|
159
|
-
key: "getLayers",
|
|
160
|
-
value: function getLayers(tile) {
|
|
161
|
-
if (!tile) {
|
|
162
|
-
return [];
|
|
163
|
-
}
|
|
164
|
-
return this.tileLayerCache.get(tile.key) || [];
|
|
165
|
-
}
|
|
166
|
-
}, {
|
|
167
|
-
key: "getChild",
|
|
168
|
-
value: function getChild(layerID) {
|
|
169
|
-
return this.children.filter(function (child) {
|
|
170
|
-
return child.id === layerID;
|
|
171
|
-
})[0];
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
|
-
key: "clearChild",
|
|
175
|
-
value: function clearChild() {
|
|
176
|
-
this.children.forEach(function (layer) {
|
|
177
|
-
layer.destroy();
|
|
178
|
-
});
|
|
179
|
-
this.children.slice(0, this.children.length);
|
|
180
|
-
}
|
|
181
|
-
}, {
|
|
182
|
-
key: "hasChild",
|
|
183
|
-
value: function hasChild(layer) {
|
|
184
|
-
return this.children.includes(layer);
|
|
185
|
-
}
|
|
186
|
-
}, {
|
|
187
|
-
key: "initTileFactory",
|
|
188
|
-
value: function initTileFactory() {
|
|
189
|
-
// this.tileFactory = new TileFactory({
|
|
190
|
-
// parent: this.parent,
|
|
191
|
-
// mapService: this.mapService,
|
|
192
|
-
// rendererService: this.rendererService,
|
|
193
|
-
// });
|
|
194
|
-
}
|
|
195
|
-
}, {
|
|
196
|
-
key: "getSourceLayer",
|
|
197
|
-
value: function getSourceLayer(parentParserType, sourceLayer) {
|
|
198
|
-
if (parentParserType === 'geojsonvt') {
|
|
199
|
-
return 'geojsonvt';
|
|
200
|
-
} else if (parentParserType === 'testTile') {
|
|
201
|
-
return 'testTile';
|
|
202
|
-
} else {
|
|
203
|
-
return sourceLayer;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "updateTileVisible",
|
|
208
|
-
value: function updateTileVisible(tile, layerService) {
|
|
209
|
-
var layers = this.getLayers(tile);
|
|
210
|
-
if (layers.length === 0) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
if (tile.isVisible) {
|
|
214
|
-
// 如果可见直接进行渲染,父级发
|
|
215
|
-
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
216
|
-
} else {
|
|
217
|
-
// 如果不可见,放大,等到子瓦片渲染完成,缩小:父级渲染成功
|
|
218
|
-
// console.log('updateTileVisible',`${tile.x}_${tile.y}_${tile.z}`,tile.isVisible)
|
|
219
|
-
// console.log(tile);
|
|
220
|
-
// console.log(`子瓦片${tile.x}/${tile.y}/${tile.z}`,tile.children.length)
|
|
221
|
-
// tile.children.forEach((t)=>{
|
|
222
|
-
// console.log(`${t.x}/${t.y}/${t.z}`)
|
|
223
|
-
// })
|
|
224
|
-
(0, _utils.updateLayersConfig)(layers, 'visible', tile.isVisible);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// this.listenLoad(tile, () => {
|
|
228
|
-
// this.isTileAllLoad(tile) && updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
229
|
-
// })
|
|
230
|
-
}
|
|
231
|
-
}, {
|
|
232
|
-
key: "listenLoad",
|
|
233
|
-
value: function listenLoad(tile, callback) {
|
|
234
|
-
var _tile$parent;
|
|
235
|
-
tile.once('layerLoaded', function () {
|
|
236
|
-
callback();
|
|
237
|
-
});
|
|
238
|
-
tile.children.map(function (childTile) {
|
|
239
|
-
childTile.once('layerLoaded', function () {
|
|
240
|
-
callback();
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
(_tile$parent = tile.parent) === null || _tile$parent === void 0 ? void 0 : _tile$parent.once('layerLoaded', function () {
|
|
244
|
-
callback();
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}, {
|
|
248
|
-
key: "isTileLoaded",
|
|
249
|
-
value: function isTileLoaded(tile) {
|
|
250
|
-
if (tile.isLoad) {
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
var isLoad = this.getLayers(tile).length === tile.loadedLayers;
|
|
254
|
-
tile.isLoad = isLoad;
|
|
255
|
-
return isLoad;
|
|
256
|
-
}
|
|
257
|
-
}, {
|
|
258
|
-
key: "isTileChildLoaded",
|
|
259
|
-
value: function isTileChildLoaded(tile) {
|
|
260
|
-
var _this2 = this;
|
|
261
|
-
if (tile.isChildLoad) {
|
|
262
|
-
return true;
|
|
263
|
-
}
|
|
264
|
-
var children = tile.children;
|
|
265
|
-
var isLoad = children.filter(function (child) {
|
|
266
|
-
return _this2.isTileLoaded(child);
|
|
267
|
-
}).length === children.length;
|
|
268
|
-
tile.isChildLoad = isLoad;
|
|
269
|
-
return isLoad;
|
|
270
|
-
}
|
|
271
|
-
}, {
|
|
272
|
-
key: "isTileParentLoaded",
|
|
273
|
-
value: function isTileParentLoaded(tile) {
|
|
274
|
-
var parent = tile.parent;
|
|
275
|
-
if (!parent) {
|
|
276
|
-
return true;
|
|
277
|
-
} else {
|
|
278
|
-
return this.isTileLoaded(parent);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}, {
|
|
282
|
-
key: "isTileAllLoad",
|
|
283
|
-
value: function isTileAllLoad(tile) {
|
|
284
|
-
var tileLoaded = this.isTileLoaded(tile);
|
|
285
|
-
var tileChildLoaded = this.isTileChildLoaded(tile);
|
|
286
|
-
var tileParentLoaded = this.isTileParentLoaded(tile);
|
|
287
|
-
return tileLoaded && tileChildLoaded && tileParentLoaded;
|
|
288
|
-
}
|
|
289
|
-
}, {
|
|
290
|
-
key: "destroy",
|
|
291
|
-
value: function destroy() {
|
|
292
|
-
this.tileCache.clear();
|
|
293
|
-
this.tileLayerCache.clear();
|
|
294
|
-
}
|
|
295
|
-
}]);
|
|
296
|
-
return Base;
|
|
297
|
-
}();
|
|
298
|
-
exports.Base = Base;
|
package/lib/tile/style/utils.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.updateLayersConfig = updateLayersConfig;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
function updateLayersConfig(layers, key, value) {
|
|
10
|
-
layers.map(function (layer) {
|
|
11
|
-
if (key === 'mask') {
|
|
12
|
-
// Tip: 栅格瓦片生效、设置全局的 mask、瓦片被全局的 mask 影响
|
|
13
|
-
layer.style({
|
|
14
|
-
mask: value
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
layer.updateLayerConfig((0, _defineProperty2.default)({}, key, value));
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|