@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
|
@@ -1,112 +1,47 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
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; } }
|
|
10
|
+
|
|
11
|
+
import { TileManager } from "./baseTileManager";
|
|
5
12
|
import { generateColorRamp } from '@antv/l7-utils';
|
|
6
|
-
import {
|
|
7
|
-
import { getLayerShape, getMaskValue } from "../utils";
|
|
13
|
+
import { getLayerShape, getMaskValue, updateLayersConfig } from "../utils";
|
|
8
14
|
import TileConfigManager from "./tileConfigManager";
|
|
9
15
|
import TilePickManager from "./tilePickerManager";
|
|
10
|
-
export var TileLayerManager = /*#__PURE__*/function () {
|
|
16
|
+
export var TileLayerManager = /*#__PURE__*/function (_TileManager) {
|
|
17
|
+
_inherits(TileLayerManager, _TileManager);
|
|
18
|
+
|
|
19
|
+
var _super = _createSuper(TileLayerManager);
|
|
20
|
+
|
|
11
21
|
function TileLayerManager(parent, mapService, rendererService, pickingService, transforms) {
|
|
22
|
+
var _this;
|
|
23
|
+
|
|
12
24
|
_classCallCheck(this, TileLayerManager);
|
|
13
25
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.setConfigListener();
|
|
23
|
-
this.initTileFactory();
|
|
24
|
-
}
|
|
26
|
+
_this = _super.call(this);
|
|
27
|
+
_this.parent = parent;
|
|
28
|
+
_this.children = parent.layerChildren;
|
|
29
|
+
_this.mapService = mapService;
|
|
30
|
+
_this.rendererService = rendererService;
|
|
31
|
+
_this.transforms = transforms;
|
|
32
|
+
_this.tilePickManager = new TilePickManager(parent, rendererService, pickingService, _this.children);
|
|
33
|
+
_this.tileConfigManager = new TileConfigManager();
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
key: "createTile",
|
|
28
|
-
value: function createTile(tile) {
|
|
29
|
-
return this.tileFactory.createTile(tile, this.initOptions);
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "updateLayersConfig",
|
|
33
|
-
value: function updateLayersConfig(layers, key, value) {
|
|
34
|
-
layers.map(function (layer) {
|
|
35
|
-
if (key === 'mask') {
|
|
36
|
-
// Tip: 栅格瓦片生效、设置全局的 mask、瓦片被全局的 mask 影响
|
|
37
|
-
layer.style({
|
|
38
|
-
mask: value
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
layer.updateLayerConfig(_defineProperty({}, key, value));
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}, {
|
|
46
|
-
key: "addChild",
|
|
47
|
-
value: function addChild(layer) {
|
|
48
|
-
this.children.push(layer);
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "addChilds",
|
|
52
|
-
value: function addChilds(layers) {
|
|
53
|
-
var _this$children;
|
|
35
|
+
_this.setSubLayerInitOption();
|
|
54
36
|
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
key: "removeChilds",
|
|
59
|
-
value: function removeChilds(layerIDList) {
|
|
60
|
-
var refresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
61
|
-
var remveLayerList = [];
|
|
62
|
-
var cacheLayerList = [];
|
|
63
|
-
this.children.filter(function (child) {
|
|
64
|
-
layerIDList.includes(child.id) ? remveLayerList.push(child) : cacheLayerList.push(child);
|
|
65
|
-
});
|
|
66
|
-
remveLayerList.map(function (layer) {
|
|
67
|
-
return layer.destroy(refresh);
|
|
68
|
-
});
|
|
69
|
-
this.children = cacheLayerList;
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "removeChild",
|
|
73
|
-
value: function removeChild(layer) {
|
|
74
|
-
var layerIndex = this.children.indexOf(layer);
|
|
37
|
+
_this.setConfigListener();
|
|
75
38
|
|
|
76
|
-
|
|
77
|
-
this.children.splice(layerIndex, 1);
|
|
78
|
-
}
|
|
39
|
+
_this.initTileFactory();
|
|
79
40
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
value: function getChilds(layerIDList) {
|
|
85
|
-
return this.children.filter(function (child) {
|
|
86
|
-
return layerIDList.includes(child.id);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}, {
|
|
90
|
-
key: "getChild",
|
|
91
|
-
value: function getChild(layerID) {
|
|
92
|
-
return this.children.filter(function (child) {
|
|
93
|
-
return child.id === layerID;
|
|
94
|
-
})[0];
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "clearChild",
|
|
98
|
-
value: function clearChild() {
|
|
99
|
-
this.children.forEach(function (layer) {
|
|
100
|
-
layer.destroy();
|
|
101
|
-
});
|
|
102
|
-
this.children.slice(0, this.children.length);
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
key: "hasChild",
|
|
106
|
-
value: function hasChild(layer) {
|
|
107
|
-
return this.children.includes(layer);
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_createClass(TileLayerManager, [{
|
|
110
45
|
key: "render",
|
|
111
46
|
value: function render() {
|
|
112
47
|
var _this$tileConfigManag, _this$tilePickManager;
|
|
@@ -122,8 +57,8 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
122
57
|
return (_this$tilePickManager2 = this.tilePickManager) === null || _this$tilePickManager2 === void 0 ? void 0 : _this$tilePickManager2.pickRender(this.children, target);
|
|
123
58
|
}
|
|
124
59
|
}, {
|
|
125
|
-
key: "
|
|
126
|
-
value: function
|
|
60
|
+
key: "setSubLayerInitOption",
|
|
61
|
+
value: function setSubLayerInitOption() {
|
|
127
62
|
var _source$data;
|
|
128
63
|
|
|
129
64
|
var _ref = this.parent.getLayerConfig(),
|
|
@@ -175,21 +110,6 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
175
110
|
|
|
176
111
|
var parentParserType = source.getParserType();
|
|
177
112
|
var layerShape = getLayerShape(this.parent.type, this.parent);
|
|
178
|
-
var colorTexture = undefined;
|
|
179
|
-
|
|
180
|
-
if (rampColors) {
|
|
181
|
-
// 构建统一的色带贴图
|
|
182
|
-
var createTexture2D = this.rendererService.createTexture2D;
|
|
183
|
-
this.rampColorsData = generateColorRamp(rampColors);
|
|
184
|
-
var imageData = generateColorRamp(rampColors);
|
|
185
|
-
colorTexture = createTexture2D({
|
|
186
|
-
data: this.rampColorsData.data,
|
|
187
|
-
width: imageData.width,
|
|
188
|
-
height: imageData.height,
|
|
189
|
-
flipY: false
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
113
|
this.initOptions = {
|
|
194
114
|
layerType: this.parent.type,
|
|
195
115
|
transforms: this.transforms,
|
|
@@ -210,8 +130,6 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
210
130
|
clampHigh: clampHigh,
|
|
211
131
|
domain: domain,
|
|
212
132
|
rampColors: rampColors,
|
|
213
|
-
rampColorsData: this.rampColorsData,
|
|
214
|
-
colorTexture: colorTexture,
|
|
215
133
|
// worker
|
|
216
134
|
workerEnabled: workerEnabled,
|
|
217
135
|
pixelConstant: pixelConstant,
|
|
@@ -220,22 +138,24 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
220
138
|
pixelConstantB: pixelConstantB,
|
|
221
139
|
pixelConstantRGB: pixelConstantRGB
|
|
222
140
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
141
|
+
|
|
142
|
+
if (rampColors) {
|
|
143
|
+
// 构建统一的色带贴图
|
|
144
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
145
|
+
var imageData = generateColorRamp(rampColors);
|
|
146
|
+
var colorTexture = createTexture2D({
|
|
147
|
+
data: imageData.data,
|
|
148
|
+
width: imageData.width,
|
|
149
|
+
height: imageData.height,
|
|
150
|
+
flipY: false
|
|
151
|
+
});
|
|
152
|
+
this.initOptions.colorTexture = colorTexture;
|
|
233
153
|
}
|
|
234
154
|
}
|
|
235
155
|
}, {
|
|
236
156
|
key: "setConfigListener",
|
|
237
157
|
value: function setConfigListener() {
|
|
238
|
-
var
|
|
158
|
+
var _this2 = this;
|
|
239
159
|
|
|
240
160
|
// RasterLayer PolygonLayer LineLayer PointLayer
|
|
241
161
|
// All Tile Layer Need Listen
|
|
@@ -268,7 +188,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
268
188
|
|
|
269
189
|
this.tileConfigManager.on('updateConfig', function (updateConfigs) {
|
|
270
190
|
updateConfigs.map(function (key) {
|
|
271
|
-
|
|
191
|
+
_this2.updateStyle(key);
|
|
272
192
|
|
|
273
193
|
return '';
|
|
274
194
|
});
|
|
@@ -277,7 +197,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
277
197
|
}, {
|
|
278
198
|
key: "updateStyle",
|
|
279
199
|
value: function updateStyle(style) {
|
|
280
|
-
var
|
|
200
|
+
var _this3 = this;
|
|
281
201
|
|
|
282
202
|
var updateValue = null;
|
|
283
203
|
|
|
@@ -292,7 +212,7 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
292
212
|
|
|
293
213
|
updateValue = scaleValue;
|
|
294
214
|
this.children.map(function (child) {
|
|
295
|
-
|
|
215
|
+
_this3.tileFactory.setStyleAttributeField(child, style, scaleValue);
|
|
296
216
|
|
|
297
217
|
return '';
|
|
298
218
|
});
|
|
@@ -306,10 +226,18 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
306
226
|
|
|
307
227
|
var config = layerConfig[style];
|
|
308
228
|
updateValue = config;
|
|
309
|
-
|
|
229
|
+
updateLayersConfig(this.children, style, config);
|
|
310
230
|
|
|
311
231
|
if (style === 'rampColors' && config) {
|
|
312
|
-
|
|
232
|
+
var createTexture2D = this.rendererService.createTexture2D;
|
|
233
|
+
var imageData = generateColorRamp(config);
|
|
234
|
+
this.initOptions.colorTexture = createTexture2D({
|
|
235
|
+
data: imageData.data,
|
|
236
|
+
width: imageData.width,
|
|
237
|
+
height: imageData.height,
|
|
238
|
+
flipY: false
|
|
239
|
+
});
|
|
240
|
+
updateLayersConfig(this.children, 'colorTexture', this.initOptions.colorTexture);
|
|
313
241
|
}
|
|
314
242
|
} // @ts-ignore
|
|
315
243
|
|
|
@@ -317,17 +245,11 @@ export var TileLayerManager = /*#__PURE__*/function () {
|
|
|
317
245
|
this.initOptions[style] = updateValue;
|
|
318
246
|
}
|
|
319
247
|
}, {
|
|
320
|
-
key: "
|
|
321
|
-
value: function
|
|
322
|
-
|
|
323
|
-
var TileFactory = getTileFactory(this.parent.type, source.parser);
|
|
324
|
-
this.tileFactory = new TileFactory({
|
|
325
|
-
parent: this.parent,
|
|
326
|
-
mapService: this.mapService,
|
|
327
|
-
rendererService: this.rendererService
|
|
328
|
-
});
|
|
248
|
+
key: "destroy",
|
|
249
|
+
value: function destroy() {
|
|
250
|
+
this.tilePickManager.destroy();
|
|
329
251
|
}
|
|
330
252
|
}]);
|
|
331
253
|
|
|
332
254
|
return TileLayerManager;
|
|
333
|
-
}();
|
|
255
|
+
}(TileManager);
|
|
@@ -181,6 +181,11 @@ var TilePickManager = /*#__PURE__*/function (_EventEmitter) {
|
|
|
181
181
|
layer.hooks.afterRender.call();
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "destroy",
|
|
186
|
+
value: function destroy() {
|
|
187
|
+
this.removeAllListeners();
|
|
188
|
+
}
|
|
184
189
|
}]);
|
|
185
190
|
|
|
186
191
|
return TilePickManager;
|
|
@@ -121,7 +121,9 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
121
121
|
tile = tileLayerOption.tile,
|
|
122
122
|
initOptions = tileLayerOption.initOptions,
|
|
123
123
|
vectorTileLayer = tileLayerOption.vectorTileLayer,
|
|
124
|
-
source = tileLayerOption.source
|
|
124
|
+
source = tileLayerOption.source,
|
|
125
|
+
_tileLayerOption$need = tileLayerOption.needListen,
|
|
126
|
+
needListen = _tileLayerOption$need === void 0 ? true : _tileLayerOption$need;
|
|
125
127
|
var mask = initOptions.mask,
|
|
126
128
|
color = initOptions.color,
|
|
127
129
|
layerType = initOptions.layerType,
|
|
@@ -134,7 +136,8 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
134
136
|
var layer = new FactoryTileLayer(_objectSpread({
|
|
135
137
|
visible: tile.isVisible,
|
|
136
138
|
tileOrigin: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileOrigin,
|
|
137
|
-
coord: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileCoord
|
|
139
|
+
coord: vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.l7TileCoord,
|
|
140
|
+
needListen: needListen
|
|
138
141
|
}, this.getLayerInitOption(initOptions)));
|
|
139
142
|
if (layerType) layer.type = layerType; // Tip: sign tile layer
|
|
140
143
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { rasterDataTypes } from '@antv/l7-source';
|
|
1
2
|
import VectorLineTile from "./line";
|
|
2
3
|
import VectorPointLayer from "./point";
|
|
3
4
|
import VectorPolygonTile from "./polygon";
|
|
@@ -19,7 +20,7 @@ export function getTileFactory(tileType, parser) {
|
|
|
19
20
|
return TestTile;
|
|
20
21
|
|
|
21
22
|
case 'RasterLayer':
|
|
22
|
-
if (parser.dataType
|
|
23
|
+
if (rasterDataTypes.includes(parser.dataType)) {
|
|
23
24
|
return RasterDataFactory;
|
|
24
25
|
} else {
|
|
25
26
|
return RasterTileFactory;
|
|
@@ -44,7 +44,8 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
44
44
|
tile: tile,
|
|
45
45
|
initOptions: initOptions,
|
|
46
46
|
vectorTileLayer: vectorTileLayer,
|
|
47
|
-
source: source
|
|
47
|
+
source: source,
|
|
48
|
+
needListen: false
|
|
48
49
|
});
|
|
49
50
|
layer.once('modelLoaded', function () {
|
|
50
51
|
tile.layerLoad();
|
|
@@ -30,16 +30,15 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
30
30
|
_createClass(RasterTiffTile, [{
|
|
31
31
|
key: "createTile",
|
|
32
32
|
value: function createTile(tile, initOptions) {
|
|
33
|
-
var
|
|
33
|
+
var colorTexture = initOptions.colorTexture,
|
|
34
|
+
opacity = initOptions.opacity,
|
|
34
35
|
domain = initOptions.domain,
|
|
35
36
|
clampHigh = initOptions.clampHigh,
|
|
36
37
|
clampLow = initOptions.clampLow,
|
|
37
|
-
rampColors = initOptions.rampColors,
|
|
38
|
-
rampColorsData = initOptions.rampColorsData,
|
|
39
38
|
mask = initOptions.mask;
|
|
40
|
-
var
|
|
39
|
+
var rasterData = tile.data;
|
|
41
40
|
|
|
42
|
-
if (!
|
|
41
|
+
if (!rasterData.data) {
|
|
43
42
|
console.warn('raster data not exist!');
|
|
44
43
|
return {
|
|
45
44
|
layers: [],
|
|
@@ -50,20 +49,19 @@ var RasterTiffTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
50
49
|
var layer = new RasterDataLayer({
|
|
51
50
|
visible: tile.isVisible,
|
|
52
51
|
mask: mask
|
|
53
|
-
}).source(
|
|
52
|
+
}).source(rasterData.data, {
|
|
54
53
|
parser: {
|
|
55
54
|
type: 'raster',
|
|
56
|
-
width:
|
|
57
|
-
height:
|
|
55
|
+
width: rasterData.width,
|
|
56
|
+
height: rasterData.height,
|
|
58
57
|
extent: tile.bboxPolygon.bbox
|
|
59
58
|
}
|
|
60
59
|
}).style({
|
|
60
|
+
colorTexture: colorTexture,
|
|
61
61
|
opacity: opacity,
|
|
62
62
|
domain: domain,
|
|
63
63
|
clampHigh: clampHigh,
|
|
64
|
-
clampLow: clampLow
|
|
65
|
-
rampColors: rampColors,
|
|
66
|
-
rampColorsData: rampColorsData
|
|
64
|
+
clampLow: clampLow
|
|
67
65
|
});
|
|
68
66
|
this.emitEvent([layer], false);
|
|
69
67
|
registerLayers(this.parentLayer, [layer]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseLayer from '../../core/BaseLayer';
|
|
2
2
|
import { IRasterLayerStyleOptions } from '../../core/interface';
|
|
3
|
-
import RasterModel from '../../raster/models/
|
|
3
|
+
import RasterModel from '../../raster/models/rasterTile';
|
|
4
4
|
export default class RasterTiffLayer extends BaseLayer<Partial<IRasterLayerStyleOptions>> {
|
|
5
5
|
type: string;
|
|
6
6
|
buildModels(): void;
|
|
@@ -11,7 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
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; } }
|
|
12
12
|
|
|
13
13
|
import BaseLayer from "../../core/BaseLayer";
|
|
14
|
-
import RasterModel from "../../raster/models/
|
|
14
|
+
import RasterModel from "../../raster/models/rasterTile";
|
|
15
15
|
|
|
16
16
|
var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
17
|
_inherits(RasterTiffLayer, _BaseLayer);
|
|
@@ -42,11 +42,7 @@ var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
42
42
|
var model = this.getModelType();
|
|
43
43
|
this.layerModel = new model(this);
|
|
44
44
|
this.layerModel.initModels(function (models) {
|
|
45
|
-
_this2.models
|
|
46
|
-
|
|
47
|
-
_this2.emit('modelLoaded', null);
|
|
48
|
-
|
|
49
|
-
_this2.layerService.throttleRenderLayers();
|
|
45
|
+
_this2.dispatchModelLoad(models);
|
|
50
46
|
});
|
|
51
47
|
}
|
|
52
48
|
}, {
|
|
@@ -55,9 +51,7 @@ var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
55
51
|
var _this3 = this;
|
|
56
52
|
|
|
57
53
|
this.layerModel.buildModels(function (models) {
|
|
58
|
-
_this3.models
|
|
59
|
-
|
|
60
|
-
_this3.emit('modelLoaded', null);
|
|
54
|
+
_this3.dispatchModelLoad(models);
|
|
61
55
|
});
|
|
62
56
|
}
|
|
63
57
|
}, {
|
|
@@ -52,7 +52,8 @@ var TestTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
52
52
|
var properties = features[0].properties;
|
|
53
53
|
var text = new VectorLayer({
|
|
54
54
|
layerType: 'PointLayer',
|
|
55
|
-
usage: 'basemap'
|
|
55
|
+
usage: 'basemap',
|
|
56
|
+
needListen: false
|
|
56
57
|
}).source([properties], {
|
|
57
58
|
parser: {
|
|
58
59
|
type: 'json',
|
|
@@ -68,7 +69,8 @@ var TestTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
68
69
|
});
|
|
69
70
|
var line = new VectorLayer({
|
|
70
71
|
layerType: 'LineLayer',
|
|
71
|
-
usage: 'basemap'
|
|
72
|
+
usage: 'basemap',
|
|
73
|
+
needListen: false
|
|
72
74
|
}).source({
|
|
73
75
|
type: 'FeatureCollection',
|
|
74
76
|
features: features
|
|
@@ -5,7 +5,10 @@ import lineSimpleModel from '../../line/models/simpleTileLine';
|
|
|
5
5
|
import pointTextModel from '../../point/models/tileText';
|
|
6
6
|
import pointFillModel from '../../point/models/tile';
|
|
7
7
|
import polygonFillModel from '../../polygon/models/tile';
|
|
8
|
-
export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOptions & ILineLayerStyleOptions & IPointLayerStyleOptions
|
|
8
|
+
export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOptions & ILineLayerStyleOptions & IPointLayerStyleOptions & {
|
|
9
|
+
needListen: boolean;
|
|
10
|
+
}>> {
|
|
11
|
+
needListen: boolean;
|
|
9
12
|
isVector: boolean;
|
|
10
13
|
type: string;
|
|
11
14
|
private pickedID;
|
|
@@ -41,6 +41,8 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
41
41
|
|
|
42
42
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
43
|
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "needListen", true);
|
|
45
|
+
|
|
44
46
|
_defineProperty(_assertThisInitialized(_this), "isVector", true);
|
|
45
47
|
|
|
46
48
|
_defineProperty(_assertThisInitialized(_this), "type", _this.layerType || 'vectorLayer');
|
|
@@ -159,11 +161,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
159
161
|
var model = this.getModelType();
|
|
160
162
|
this.layerModel = new model(this);
|
|
161
163
|
this.layerModel.initModels(function (models) {
|
|
162
|
-
_this4.models
|
|
163
|
-
|
|
164
|
-
_this4.emit('modelLoaded', null);
|
|
165
|
-
|
|
166
|
-
_this4.layerService.throttleRenderLayers();
|
|
164
|
+
_this4.dispatchModelLoad(models);
|
|
167
165
|
});
|
|
168
166
|
}
|
|
169
167
|
}, {
|
|
@@ -172,9 +170,7 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
172
170
|
var _this5 = this;
|
|
173
171
|
|
|
174
172
|
this.layerModel.buildModels(function (models) {
|
|
175
|
-
_this5.models
|
|
176
|
-
|
|
177
|
-
_this5.emit('modelLoaded', null);
|
|
173
|
+
_this5.dispatchModelLoad(models);
|
|
178
174
|
});
|
|
179
175
|
}
|
|
180
176
|
}, {
|
|
@@ -131,7 +131,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
131
131
|
zoom: zoom,
|
|
132
132
|
latLonBounds: latLonBounds
|
|
133
133
|
};
|
|
134
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.
|
|
134
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.throttleUpdate(zoom, latLonBounds);
|
|
135
135
|
}
|
|
136
136
|
}, {
|
|
137
137
|
key: "bindTilesetEvent",
|
|
@@ -180,6 +180,13 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
180
180
|
zoom: zoom
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "destroy",
|
|
185
|
+
value: function destroy() {
|
|
186
|
+
var _this$tilesetManager3;
|
|
187
|
+
|
|
188
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
189
|
+
}
|
|
183
190
|
}]);
|
|
184
191
|
|
|
185
192
|
return BaseTileLayer;
|
|
@@ -99,7 +99,8 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
99
99
|
key: "pickLayers",
|
|
100
100
|
value: function pickLayers(target) {
|
|
101
101
|
return this.tileLayerManager.pickLayers(target);
|
|
102
|
-
}
|
|
102
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
|
+
|
|
103
104
|
}, {
|
|
104
105
|
key: "tileLoaded",
|
|
105
106
|
value: function tileLoaded(tile) {//
|
|
@@ -353,7 +354,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
353
354
|
zoom: zoom,
|
|
354
355
|
latLonBounds: latLonBounds
|
|
355
356
|
};
|
|
356
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.
|
|
357
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.throttleUpdate(zoom, latLonBounds);
|
|
357
358
|
}
|
|
358
359
|
}, {
|
|
359
360
|
key: "bindTilesetEvent",
|
|
@@ -363,6 +364,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
363
364
|
if (!this.tilesetManager) {
|
|
364
365
|
return;
|
|
365
366
|
} // 瓦片数据加载成功
|
|
367
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
366
368
|
|
|
367
369
|
|
|
368
370
|
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
@@ -372,6 +374,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
372
374
|
// 将事件抛出,图层上可以监听使用
|
|
373
375
|
_this6.tileUnLoad(tile);
|
|
374
376
|
}); // 瓦片数据加载失败
|
|
377
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
375
378
|
|
|
376
379
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
377
380
|
// 将事件抛出,图层上可以监听使用
|
|
@@ -401,6 +404,14 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
401
404
|
zoom: zoom
|
|
402
405
|
};
|
|
403
406
|
}
|
|
407
|
+
}, {
|
|
408
|
+
key: "destroy",
|
|
409
|
+
value: function destroy() {
|
|
410
|
+
var _this$tilesetManager3;
|
|
411
|
+
|
|
412
|
+
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
413
|
+
this.tileLayerManager.destroy();
|
|
414
|
+
}
|
|
404
415
|
}]);
|
|
405
416
|
|
|
406
417
|
return BaseTileLayer;
|
package/es/tile/tileTest.js
CHANGED
|
@@ -51,9 +51,7 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
51
51
|
|
|
52
52
|
this.layerModel = new TileModel(this);
|
|
53
53
|
this.layerModel.initModels(function (models) {
|
|
54
|
-
_this2.models
|
|
55
|
-
|
|
56
|
-
_this2.emit('modelLoaded', null);
|
|
54
|
+
_this2.dispatchModelLoad(models);
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
}]);
|