@antv/l7-layers 2.9.27-alpha.4 → 2.9.28
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 +2 -8
- package/es/canvas/index.js +2 -8
- package/es/citybuliding/building.js +2 -8
- package/es/core/BaseLayer.d.ts +2 -0
- package/es/core/BaseLayer.js +12 -1
- package/es/core/interface.d.ts +1 -0
- package/es/earth/index.js +1 -5
- package/es/heatmap/index.js +2 -8
- package/es/image/index.js +2 -8
- package/es/line/index.js +2 -8
- package/es/line/models/great_circle.js +4 -4
- package/es/mask/index.js +2 -6
- package/es/plugins/DataMappingPlugin.js +4 -0
- package/es/plugins/FeatureScalePlugin.js +4 -1
- package/es/plugins/LayerModelPlugin.js +2 -0
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +1 -1
- package/es/plugins/UpdateStyleAttributePlugin.js +7 -4
- package/es/point/index.js +2 -10
- package/es/polygon/index.js +2 -8
- package/es/raster/index.js +3 -10
- package/es/raster/models/raster.js +2 -2
- package/es/raster/models/rasterTile.d.ts +18 -0
- package/es/raster/models/rasterTile.js +140 -0
- package/es/raster/shaders/raster_2d_frag.glsl +38 -2
- package/es/raster/shaders/raster_2d_vert.glsl +0 -1
- package/es/tile/interface.d.ts +1 -0
- package/es/tile/manager/baseMapTileLayerManager.d.ts +3 -25
- package/es/tile/manager/baseMapTileLayerManager.js +31 -119
- package/es/tile/manager/baseTileManager.d.ts +27 -0
- package/es/tile/manager/baseTileManager.js +107 -0
- package/es/tile/manager/tileLayerManager.d.ts +4 -26
- package/es/tile/manager/tileLayerManager.js +64 -142
- package/es/tile/manager/tilePickerManager.d.ts +1 -0
- package/es/tile/manager/tilePickerManager.js +5 -0
- package/es/tile/models/tileModel.d.ts +1 -0
- package/es/tile/models/tileModel.js +3 -0
- package/es/tile/tileFactory/base.js +5 -2
- package/es/tile/tileFactory/index.js +2 -1
- package/es/tile/tileFactory/point.js +2 -1
- package/es/tile/tileFactory/rasterData.js +9 -11
- package/es/tile/tileFactory/rasterDataLayer.d.ts +1 -1
- package/es/tile/tileFactory/rasterDataLayer.js +3 -9
- package/es/tile/tileFactory/test.js +4 -2
- package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
- package/es/tile/tileFactory/vectorLayer.js +4 -8
- package/es/tile/tileLayer/baseMapTileLayer.d.ts +1 -0
- package/es/tile/tileLayer/baseMapTileLayer.js +8 -1
- package/es/tile/tileLayer/baseTileLayer.d.ts +1 -0
- package/es/tile/tileLayer/baseTileLayer.js +13 -2
- package/es/tile/tileTest.js +1 -3
- package/es/tile/tmsMapTileLayer.d.ts +0 -2
- package/es/tile/tmsMapTileLayer.js +2 -24
- package/es/tile/tmsTileLayer.d.ts +0 -2
- package/es/tile/tmsTileLayer.js +2 -24
- package/es/tile/utils.d.ts +3 -1
- package/es/tile/utils.js +48 -0
- package/es/wind/index.js +2 -8
- package/lib/Geometry/index.js +2 -8
- package/lib/canvas/index.js +2 -8
- package/lib/citybuliding/building.js +2 -8
- package/lib/core/BaseLayer.js +11 -1
- package/lib/earth/index.js +1 -5
- package/lib/heatmap/index.js +2 -8
- package/lib/image/index.js +2 -8
- package/lib/line/index.js +2 -8
- package/lib/line/models/great_circle.js +4 -4
- package/lib/mask/index.js +2 -6
- package/lib/plugins/DataMappingPlugin.js +4 -0
- package/lib/plugins/FeatureScalePlugin.js +4 -1
- package/lib/plugins/LayerModelPlugin.js +2 -0
- package/lib/plugins/UpdateStyleAttributePlugin.js +7 -4
- package/lib/point/index.js +2 -10
- package/lib/polygon/index.js +2 -8
- package/lib/raster/index.js +3 -10
- package/lib/raster/models/raster.js +2 -2
- package/lib/raster/models/rasterTile.js +154 -0
- package/lib/raster/shaders/raster_2d_frag.glsl +38 -2
- package/lib/raster/shaders/raster_2d_vert.glsl +0 -1
- package/lib/tile/manager/baseMapTileLayerManager.js +33 -121
- package/lib/tile/manager/baseTileManager.js +121 -0
- package/lib/tile/manager/tileLayerManager.js +66 -144
- package/lib/tile/manager/tilePickerManager.js +5 -0
- package/lib/tile/models/tileModel.js +3 -0
- package/lib/tile/tileFactory/base.js +5 -2
- package/lib/tile/tileFactory/index.js +3 -1
- package/lib/tile/tileFactory/point.js +2 -1
- package/lib/tile/tileFactory/rasterData.js +9 -11
- package/lib/tile/tileFactory/rasterDataLayer.js +4 -10
- package/lib/tile/tileFactory/test.js +4 -2
- package/lib/tile/tileFactory/vectorLayer.js +3 -8
- package/lib/tile/tileLayer/baseMapTileLayer.js +8 -1
- package/lib/tile/tileLayer/baseTileLayer.js +13 -2
- package/lib/tile/tileTest.js +1 -3
- package/lib/tile/tmsMapTileLayer.js +1 -23
- package/lib/tile/tmsTileLayer.js +1 -23
- package/lib/tile/utils.js +52 -0
- package/lib/wind/index.js +2 -8
- package/package.json +6 -6
|
@@ -7,17 +7,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.TileLayerManager = void 0;
|
|
9
9
|
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
11
|
|
|
16
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _baseTileManager = require("./baseTileManager");
|
|
21
|
+
|
|
22
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
21
23
|
|
|
22
24
|
var _utils = require("../utils");
|
|
23
25
|
|
|
@@ -25,105 +27,38 @@ var _tileConfigManager = _interopRequireDefault(require("./tileConfigManager"));
|
|
|
25
27
|
|
|
26
28
|
var _tilePickerManager = _interopRequireDefault(require("./tilePickerManager"));
|
|
27
29
|
|
|
28
|
-
var
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
|
+
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
+
|
|
34
|
+
var TileLayerManager = /*#__PURE__*/function (_TileManager) {
|
|
35
|
+
(0, _inherits2.default)(TileLayerManager, _TileManager);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(TileLayerManager);
|
|
38
|
+
|
|
29
39
|
function TileLayerManager(parent, mapService, rendererService, pickingService, transforms) {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
30
42
|
(0, _classCallCheck2.default)(this, TileLayerManager);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.setConfigListener();
|
|
40
|
-
this.initTileFactory();
|
|
41
|
-
}
|
|
43
|
+
_this = _super.call(this);
|
|
44
|
+
_this.parent = parent;
|
|
45
|
+
_this.children = parent.layerChildren;
|
|
46
|
+
_this.mapService = mapService;
|
|
47
|
+
_this.rendererService = rendererService;
|
|
48
|
+
_this.transforms = transforms;
|
|
49
|
+
_this.tilePickManager = new _tilePickerManager.default(parent, rendererService, pickingService, _this.children);
|
|
50
|
+
_this.tileConfigManager = new _tileConfigManager.default();
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
key: "createTile",
|
|
45
|
-
value: function createTile(tile) {
|
|
46
|
-
return this.tileFactory.createTile(tile, this.initOptions);
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
|
-
key: "updateLayersConfig",
|
|
50
|
-
value: function updateLayersConfig(layers, key, value) {
|
|
51
|
-
layers.map(function (layer) {
|
|
52
|
-
if (key === 'mask') {
|
|
53
|
-
// Tip: 栅格瓦片生效、设置全局的 mask、瓦片被全局的 mask 影响
|
|
54
|
-
layer.style({
|
|
55
|
-
mask: value
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
layer.updateLayerConfig((0, _defineProperty2.default)({}, key, value));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "addChild",
|
|
64
|
-
value: function addChild(layer) {
|
|
65
|
-
this.children.push(layer);
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "addChilds",
|
|
69
|
-
value: function addChilds(layers) {
|
|
70
|
-
var _this$children;
|
|
52
|
+
_this.setSubLayerInitOption();
|
|
71
53
|
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "removeChilds",
|
|
76
|
-
value: function removeChilds(layerIDList) {
|
|
77
|
-
var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
78
|
-
var remveLayerList = [];
|
|
79
|
-
var cacheLayerList = [];
|
|
80
|
-
this.children.filter(function (child) {
|
|
81
|
-
layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
|
|
82
|
-
});
|
|
83
|
-
remveLayerList.map(function (layer) {
|
|
84
|
-
return layer.destroy(refresh);
|
|
85
|
-
});
|
|
86
|
-
this.children = cacheLayerList;
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
key: "removeChild",
|
|
90
|
-
value: function removeChild(layer) {
|
|
91
|
-
var layerIndex = this.children.indexOf(layer);
|
|
54
|
+
_this.setConfigListener();
|
|
92
55
|
|
|
93
|
-
|
|
94
|
-
this.children.splice(layerIndex, 1);
|
|
95
|
-
}
|
|
56
|
+
_this.initTileFactory();
|
|
96
57
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
value: function getChilds(layerIDList) {
|
|
102
|
-
return this.children.filter(function (child) {
|
|
103
|
-
return layerIDList.includes(child.id);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "getChild",
|
|
108
|
-
value: function getChild(layerID) {
|
|
109
|
-
return this.children.filter(function (child) {
|
|
110
|
-
return child.id === layerID;
|
|
111
|
-
})[0];
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "clearChild",
|
|
115
|
-
value: function clearChild() {
|
|
116
|
-
this.children.forEach(function (layer) {
|
|
117
|
-
layer.destroy();
|
|
118
|
-
});
|
|
119
|
-
this.children.slice(0, this.children.length);
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "hasChild",
|
|
123
|
-
value: function hasChild(layer) {
|
|
124
|
-
return this.children.includes(layer);
|
|
125
|
-
}
|
|
126
|
-
}, {
|
|
58
|
+
return _this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
(0, _createClass2.default)(TileLayerManager, [{
|
|
127
62
|
key: "render",
|
|
128
63
|
value: function render() {
|
|
129
64
|
var _this$tileConfigManag, _this$tilePickManager;
|
|
@@ -139,8 +74,8 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
139
74
|
return (_this$tilePickManager2 = this.tilePickManager) === null || _this$tilePickManager2 === void 0 ? void 0 : _this$tilePickManager2.pickRender(this.children, target);
|
|
140
75
|
}
|
|
141
76
|
}, {
|
|
142
|
-
key: "
|
|
143
|
-
value: function
|
|
77
|
+
key: "setSubLayerInitOption",
|
|
78
|
+
value: function setSubLayerInitOption() {
|
|
144
79
|
var _source$data;
|
|
145
80
|
|
|
146
81
|
var _ref = this.parent.getLayerConfig(),
|
|
@@ -192,21 +127,6 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
192
127
|
|
|
193
128
|
var parentParserType = source.getParserType();
|
|
194
129
|
var layerShape = (0, _utils.getLayerShape)(this.parent.type, this.parent);
|
|
195
|
-
var colorTexture = undefined;
|
|
196
|
-
|
|
197
|
-
if (rampColors) {
|
|
198
|
-
// 构建统一的色带贴图
|
|
199
|
-
var createTexture2D = this.rendererService.createTexture2D;
|
|
200
|
-
this.rampColorsData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
201
|
-
var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
202
|
-
colorTexture = createTexture2D({
|
|
203
|
-
data: this.rampColorsData.data,
|
|
204
|
-
width: imageData.width,
|
|
205
|
-
height: imageData.height,
|
|
206
|
-
flipY: false
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
130
|
this.initOptions = {
|
|
211
131
|
layerType: this.parent.type,
|
|
212
132
|
transforms: this.transforms,
|
|
@@ -227,8 +147,6 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
227
147
|
clampHigh: clampHigh,
|
|
228
148
|
domain: domain,
|
|
229
149
|
rampColors: rampColors,
|
|
230
|
-
rampColorsData: this.rampColorsData,
|
|
231
|
-
colorTexture: colorTexture,
|
|
232
150
|
// worker
|
|
233
151
|
workerEnabled: workerEnabled,
|
|
234
152
|
pixelConstant: pixelConstant,
|
|
@@ -237,22 +155,24 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
237
155
|
pixelConstantB: pixelConstantB,
|
|
238
156
|
pixelConstantRGB: pixelConstantRGB
|
|
239
157
|
};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
158
|
+
|
|
159
|
+
if (rampColors) {
|
|
160
|
+
// 构建统一的色带贴图
|
|
161
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
162
|
+
var imageData = (0, _l7Utils.generateColorRamp)(rampColors);
|
|
163
|
+
var colorTexture = createTexture2D({
|
|
164
|
+
data: imageData.data,
|
|
165
|
+
width: imageData.width,
|
|
166
|
+
height: imageData.height,
|
|
167
|
+
flipY: false
|
|
168
|
+
});
|
|
169
|
+
this.initOptions.colorTexture = colorTexture;
|
|
250
170
|
}
|
|
251
171
|
}
|
|
252
172
|
}, {
|
|
253
173
|
key: "setConfigListener",
|
|
254
174
|
value: function setConfigListener() {
|
|
255
|
-
var
|
|
175
|
+
var _this2 = this;
|
|
256
176
|
|
|
257
177
|
// RasterLayer PolygonLayer LineLayer PointLayer
|
|
258
178
|
// All Tile Layer Need Listen
|
|
@@ -285,7 +205,7 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
285
205
|
|
|
286
206
|
this.tileConfigManager.on('updateConfig', function (updateConfigs) {
|
|
287
207
|
updateConfigs.map(function (key) {
|
|
288
|
-
|
|
208
|
+
_this2.updateStyle(key);
|
|
289
209
|
|
|
290
210
|
return '';
|
|
291
211
|
});
|
|
@@ -294,7 +214,7 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
294
214
|
}, {
|
|
295
215
|
key: "updateStyle",
|
|
296
216
|
value: function updateStyle(style) {
|
|
297
|
-
var
|
|
217
|
+
var _this3 = this;
|
|
298
218
|
|
|
299
219
|
var updateValue = null;
|
|
300
220
|
|
|
@@ -309,7 +229,7 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
309
229
|
|
|
310
230
|
updateValue = scaleValue;
|
|
311
231
|
this.children.map(function (child) {
|
|
312
|
-
|
|
232
|
+
_this3.tileFactory.setStyleAttributeField(child, style, scaleValue);
|
|
313
233
|
|
|
314
234
|
return '';
|
|
315
235
|
});
|
|
@@ -323,10 +243,18 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
323
243
|
|
|
324
244
|
var config = layerConfig[style];
|
|
325
245
|
updateValue = config;
|
|
326
|
-
|
|
246
|
+
(0, _utils.updateLayersConfig)(this.children, style, config);
|
|
327
247
|
|
|
328
248
|
if (style === 'rampColors' && config) {
|
|
329
|
-
|
|
249
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
250
|
+
var imageData = (0, _l7Utils.generateColorRamp)(config);
|
|
251
|
+
this.initOptions.colorTexture = createTexture2D({
|
|
252
|
+
data: imageData.data,
|
|
253
|
+
width: imageData.width,
|
|
254
|
+
height: imageData.height,
|
|
255
|
+
flipY: false
|
|
256
|
+
});
|
|
257
|
+
(0, _utils.updateLayersConfig)(this.children, 'colorTexture', this.initOptions.colorTexture);
|
|
330
258
|
}
|
|
331
259
|
} // @ts-ignore
|
|
332
260
|
|
|
@@ -334,18 +262,12 @@ var TileLayerManager = /*#__PURE__*/function () {
|
|
|
334
262
|
this.initOptions[style] = updateValue;
|
|
335
263
|
}
|
|
336
264
|
}, {
|
|
337
|
-
key: "
|
|
338
|
-
value: function
|
|
339
|
-
|
|
340
|
-
var TileFactory = (0, _tileFactory.getTileFactory)(this.parent.type, source.parser);
|
|
341
|
-
this.tileFactory = new TileFactory({
|
|
342
|
-
parent: this.parent,
|
|
343
|
-
mapService: this.mapService,
|
|
344
|
-
rendererService: this.rendererService
|
|
345
|
-
});
|
|
265
|
+
key: "destroy",
|
|
266
|
+
value: function destroy() {
|
|
267
|
+
this.tilePickManager.destroy();
|
|
346
268
|
}
|
|
347
269
|
}]);
|
|
348
270
|
return TileLayerManager;
|
|
349
|
-
}();
|
|
271
|
+
}(_baseTileManager.TileManager);
|
|
350
272
|
|
|
351
273
|
exports.TileLayerManager = TileLayerManager;
|
|
@@ -193,6 +193,11 @@ var TilePickManager = /*#__PURE__*/function (_EventEmitter) {
|
|
|
193
193
|
layer.hooks.afterRender.call();
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
+
}, {
|
|
197
|
+
key: "destroy",
|
|
198
|
+
value: function destroy() {
|
|
199
|
+
this.removeAllListeners();
|
|
200
|
+
}
|
|
196
201
|
}]);
|
|
197
202
|
return TilePickManager;
|
|
198
203
|
}(_eventemitter.EventEmitter);
|
|
@@ -147,7 +147,9 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
147
147
|
tile = tileLayerOption.tile,
|
|
148
148
|
initOptions = tileLayerOption.initOptions,
|
|
149
149
|
vectorTileLayer = tileLayerOption.vectorTileLayer,
|
|
150
|
-
source = tileLayerOption.source
|
|
150
|
+
source = tileLayerOption.source,
|
|
151
|
+
_tileLayerOption$need = tileLayerOption.needListen,
|
|
152
|
+
needListen = _tileLayerOption$need === void 0 ? true : _tileLayerOption$need;
|
|
151
153
|
var mask = initOptions.mask,
|
|
152
154
|
color = initOptions.color,
|
|
153
155
|
layerType = initOptions.layerType,
|
|
@@ -160,7 +162,8 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
160
162
|
var layer = new FactoryTileLayer((0, _objectSpread2.default)({
|
|
161
163
|
visible: tile.isVisible,
|
|
162
164
|
tileOrigin: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileOrigin,
|
|
163
|
-
coord: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileCoord
|
|
165
|
+
coord: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileCoord,
|
|
166
|
+
needListen: needListen
|
|
164
167
|
}, this.getLayerInitOption(initOptions)));
|
|
165
168
|
if (layerType) layer.type = layerType; // Tip: sign tile layer
|
|
166
169
|
|
|
@@ -10,6 +10,8 @@ var _exportNames = {
|
|
|
10
10
|
};
|
|
11
11
|
exports.getTileFactory = getTileFactory;
|
|
12
12
|
|
|
13
|
+
var _l7Source = require("@antv/l7-source");
|
|
14
|
+
|
|
13
15
|
var _line = _interopRequireDefault(require("./line"));
|
|
14
16
|
|
|
15
17
|
var _point = _interopRequireDefault(require("./point"));
|
|
@@ -51,7 +53,7 @@ function getTileFactory(tileType, parser) {
|
|
|
51
53
|
return _test.default;
|
|
52
54
|
|
|
53
55
|
case 'RasterLayer':
|
|
54
|
-
if (parser.dataType
|
|
56
|
+
if (_l7Source.rasterDataTypes.includes(parser.dataType)) {
|
|
55
57
|
return _rasterData.default;
|
|
56
58
|
} else {
|
|
57
59
|
return _raster.default;
|
|
@@ -56,7 +56,8 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
56
56
|
tile: tile,
|
|
57
57
|
initOptions: initOptions,
|
|
58
58
|
vectorTileLayer: vectorTileLayer,
|
|
59
|
-
source: source
|
|
59
|
+
source: source,
|
|
60
|
+
needListen: false
|
|
60
61
|
});
|
|
61
62
|
layer.once('modelLoaded', function () {
|
|
62
63
|
tile.layerLoad();
|
|
@@ -44,16 +44,15 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
44
44
|
(0, _createClass2.default)(RasterTiffTile, [{
|
|
45
45
|
key: "createTile",
|
|
46
46
|
value: function createTile(tile, initOptions) {
|
|
47
|
-
var
|
|
47
|
+
var colorTexture = initOptions.colorTexture,
|
|
48
|
+
opacity = initOptions.opacity,
|
|
48
49
|
domain = initOptions.domain,
|
|
49
50
|
clampHigh = initOptions.clampHigh,
|
|
50
51
|
clampLow = initOptions.clampLow,
|
|
51
|
-
rampColors = initOptions.rampColors,
|
|
52
|
-
rampColorsData = initOptions.rampColorsData,
|
|
53
52
|
mask = initOptions.mask;
|
|
54
|
-
var
|
|
53
|
+
var rasterData = tile.data;
|
|
55
54
|
|
|
56
|
-
if (!
|
|
55
|
+
if (!rasterData.data) {
|
|
57
56
|
console.warn('raster data not exist!');
|
|
58
57
|
return {
|
|
59
58
|
layers: [],
|
|
@@ -64,20 +63,19 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
64
63
|
var layer = new _rasterDataLayer.default({
|
|
65
64
|
visible: tile.isVisible,
|
|
66
65
|
mask: mask
|
|
67
|
-
}).source(
|
|
66
|
+
}).source(rasterData.data, {
|
|
68
67
|
parser: {
|
|
69
68
|
type: 'raster',
|
|
70
|
-
width:
|
|
71
|
-
height:
|
|
69
|
+
width: rasterData.width,
|
|
70
|
+
height: rasterData.height,
|
|
72
71
|
extent: tile.bboxPolygon.bbox
|
|
73
72
|
}
|
|
74
73
|
}).style({
|
|
74
|
+
colorTexture: colorTexture,
|
|
75
75
|
opacity: opacity,
|
|
76
76
|
domain: domain,
|
|
77
77
|
clampHigh: clampHigh,
|
|
78
|
-
clampLow: clampLow
|
|
79
|
-
rampColors: rampColors,
|
|
80
|
-
rampColorsData: rampColorsData
|
|
78
|
+
clampLow: clampLow
|
|
81
79
|
});
|
|
82
80
|
this.emitEvent([layer], false);
|
|
83
81
|
(0, _utils.registerLayers)(this.parentLayer, [layer]);
|
|
@@ -23,7 +23,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
23
23
|
|
|
24
24
|
var _BaseLayer2 = _interopRequireDefault(require("../../core/BaseLayer"));
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _rasterTile = _interopRequireDefault(require("../../raster/models/rasterTile"));
|
|
27
27
|
|
|
28
28
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
29
29
|
|
|
@@ -56,11 +56,7 @@ var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
56
56
|
var model = this.getModelType();
|
|
57
57
|
this.layerModel = new model(this);
|
|
58
58
|
this.layerModel.initModels(function (models) {
|
|
59
|
-
_this2.models
|
|
60
|
-
|
|
61
|
-
_this2.emit('modelLoaded', null);
|
|
62
|
-
|
|
63
|
-
_this2.layerService.throttleRenderLayers();
|
|
59
|
+
_this2.dispatchModelLoad(models);
|
|
64
60
|
});
|
|
65
61
|
}
|
|
66
62
|
}, {
|
|
@@ -69,15 +65,13 @@ var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
69
65
|
var _this3 = this;
|
|
70
66
|
|
|
71
67
|
this.layerModel.buildModels(function (models) {
|
|
72
|
-
_this3.models
|
|
73
|
-
|
|
74
|
-
_this3.emit('modelLoaded', null);
|
|
68
|
+
_this3.dispatchModelLoad(models);
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
71
|
}, {
|
|
78
72
|
key: "getModelType",
|
|
79
73
|
value: function getModelType() {
|
|
80
|
-
return
|
|
74
|
+
return _rasterTile.default;
|
|
81
75
|
}
|
|
82
76
|
}, {
|
|
83
77
|
key: "getConfigSchema",
|
|
@@ -66,7 +66,8 @@ var TestTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
66
66
|
var properties = features[0].properties;
|
|
67
67
|
var text = new _vectorLayer.default({
|
|
68
68
|
layerType: 'PointLayer',
|
|
69
|
-
usage: 'basemap'
|
|
69
|
+
usage: 'basemap',
|
|
70
|
+
needListen: false
|
|
70
71
|
}).source([properties], {
|
|
71
72
|
parser: {
|
|
72
73
|
type: 'json',
|
|
@@ -82,7 +83,8 @@ var TestTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
82
83
|
});
|
|
83
84
|
var line = new _vectorLayer.default({
|
|
84
85
|
layerType: 'LineLayer',
|
|
85
|
-
usage: 'basemap'
|
|
86
|
+
usage: 'basemap',
|
|
87
|
+
needListen: false
|
|
86
88
|
}).source({
|
|
87
89
|
type: 'FeatureCollection',
|
|
88
90
|
features: features
|
|
@@ -62,6 +62,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "needListen", true);
|
|
65
66
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVector", true);
|
|
66
67
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", _this.layerType || 'vectorLayer');
|
|
67
68
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "pickedID", null);
|
|
@@ -176,11 +177,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
176
177
|
var model = this.getModelType();
|
|
177
178
|
this.layerModel = new model(this);
|
|
178
179
|
this.layerModel.initModels(function (models) {
|
|
179
|
-
_this4.models
|
|
180
|
-
|
|
181
|
-
_this4.emit('modelLoaded', null);
|
|
182
|
-
|
|
183
|
-
_this4.layerService.throttleRenderLayers();
|
|
180
|
+
_this4.dispatchModelLoad(models);
|
|
184
181
|
});
|
|
185
182
|
}
|
|
186
183
|
}, {
|
|
@@ -189,9 +186,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
189
186
|
var _this5 = this;
|
|
190
187
|
|
|
191
188
|
this.layerModel.buildModels(function (models) {
|
|
192
|
-
_this5.models
|
|
193
|
-
|
|
194
|
-
_this5.emit('modelLoaded', null);
|
|
189
|
+
_this5.dispatchModelLoad(models);
|
|
195
190
|
});
|
|
196
191
|
}
|
|
197
192
|
}, {
|
|
@@ -139,7 +139,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
139
139
|
zoom: zoom,
|
|
140
140
|
latLonBounds: latLonBounds
|
|
141
141
|
};
|
|
142
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.
|
|
142
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.throttleUpdate(zoom, latLonBounds);
|
|
143
143
|
}
|
|
144
144
|
}, {
|
|
145
145
|
key: "bindTilesetEvent",
|
|
@@ -188,6 +188,13 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
188
188
|
zoom: zoom
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
+
}, {
|
|
192
|
+
key: "destroy",
|
|
193
|
+
value: function destroy() {
|
|
194
|
+
var _this$tilesetManager3;
|
|
195
|
+
|
|
196
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
197
|
+
}
|
|
191
198
|
}]);
|
|
192
199
|
return BaseTileLayer;
|
|
193
200
|
}();
|
|
@@ -109,7 +109,8 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
109
109
|
key: "pickLayers",
|
|
110
110
|
value: function pickLayers(target) {
|
|
111
111
|
return this.tileLayerManager.pickLayers(target);
|
|
112
|
-
}
|
|
112
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
113
|
+
|
|
113
114
|
}, {
|
|
114
115
|
key: "tileLoaded",
|
|
115
116
|
value: function tileLoaded(tile) {//
|
|
@@ -363,7 +364,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
363
364
|
zoom: zoom,
|
|
364
365
|
latLonBounds: latLonBounds
|
|
365
366
|
};
|
|
366
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.
|
|
367
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.throttleUpdate(zoom, latLonBounds);
|
|
367
368
|
}
|
|
368
369
|
}, {
|
|
369
370
|
key: "bindTilesetEvent",
|
|
@@ -373,6 +374,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
373
374
|
if (!this.tilesetManager) {
|
|
374
375
|
return;
|
|
375
376
|
} // 瓦片数据加载成功
|
|
377
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
376
378
|
|
|
377
379
|
|
|
378
380
|
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
@@ -382,6 +384,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
382
384
|
// 将事件抛出,图层上可以监听使用
|
|
383
385
|
_this6.tileUnLoad(tile);
|
|
384
386
|
}); // 瓦片数据加载失败
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
385
388
|
|
|
386
389
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
387
390
|
// 将事件抛出,图层上可以监听使用
|
|
@@ -411,6 +414,14 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
411
414
|
zoom: zoom
|
|
412
415
|
};
|
|
413
416
|
}
|
|
417
|
+
}, {
|
|
418
|
+
key: "destroy",
|
|
419
|
+
value: function destroy() {
|
|
420
|
+
var _this$tilesetManager3;
|
|
421
|
+
|
|
422
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
423
|
+
this.tileLayerManager.destroy();
|
|
424
|
+
}
|
|
414
425
|
}]);
|
|
415
426
|
return BaseTileLayer;
|
|
416
427
|
}();
|
package/lib/tile/tileTest.js
CHANGED
|
@@ -64,9 +64,7 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
64
64
|
|
|
65
65
|
this.layerModel = new _tileModel.default(this);
|
|
66
66
|
this.layerModel.initModels(function (models) {
|
|
67
|
-
_this2.models
|
|
68
|
-
|
|
69
|
-
_this2.emit('modelLoaded', null);
|
|
67
|
+
_this2.dispatchModelLoad(models);
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
70
|
}]);
|
|
@@ -98,7 +98,7 @@ var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
98
98
|
|
|
99
99
|
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
(0, _utils.updateTileVisible)(tile, _layers, _this2.layerService);
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -107,28 +107,6 @@ var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
107
107
|
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
}, {
|
|
111
|
-
key: "emitTileVisibleEvent",
|
|
112
|
-
value: function emitTileVisibleEvent(tile, callback) {
|
|
113
|
-
if (tile.isVisible) {
|
|
114
|
-
callback();
|
|
115
|
-
} else {
|
|
116
|
-
(0, _utils.tileAllLoad)(tile, function () {
|
|
117
|
-
callback();
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, {
|
|
122
|
-
key: "updateTileVisible",
|
|
123
|
-
value: function updateTileVisible(tile, layers) {
|
|
124
|
-
var _this3 = this;
|
|
125
|
-
|
|
126
|
-
this.emitTileVisibleEvent(tile, function () {
|
|
127
|
-
_this3.tileLayerManager.updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
128
|
-
|
|
129
|
-
_this3.layerService.reRender();
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
110
|
}]);
|
|
133
111
|
return TMSBaseMapTileLayer;
|
|
134
112
|
}(_baseMapTileLayer.default);
|