@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
|
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
14
|
import BaseTileLayer from "./tileLayer/baseMapTileLayer";
|
|
15
|
-
import {
|
|
15
|
+
import { updateTileVisible } from "./utils";
|
|
16
16
|
export var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
17
17
|
_inherits(TMSBaseMapTileLayer, _BaseTileLayer);
|
|
18
18
|
|
|
@@ -82,7 +82,7 @@ export var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
82
82
|
|
|
83
83
|
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
updateTileVisible(tile, _layers, _this2.layerService);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -91,28 +91,6 @@ export var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
91
91
|
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "emitTileVisibleEvent",
|
|
96
|
-
value: function emitTileVisibleEvent(tile, callback) {
|
|
97
|
-
if (tile.isVisible) {
|
|
98
|
-
callback();
|
|
99
|
-
} else {
|
|
100
|
-
tileAllLoad(tile, function () {
|
|
101
|
-
callback();
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
key: "updateTileVisible",
|
|
107
|
-
value: function updateTileVisible(tile, layers) {
|
|
108
|
-
var _this3 = this;
|
|
109
|
-
|
|
110
|
-
this.emitTileVisibleEvent(tile, function () {
|
|
111
|
-
_this3.tileLayerManager.updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
112
|
-
|
|
113
|
-
_this3.layerService.reRender();
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
94
|
}]);
|
|
117
95
|
|
|
118
96
|
return TMSBaseMapTileLayer;
|
package/es/tile/tmsTileLayer.js
CHANGED
|
@@ -12,7 +12,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
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; } }
|
|
13
13
|
|
|
14
14
|
import BaseTileLayer from "./tileLayer/baseTileLayer";
|
|
15
|
-
import {
|
|
15
|
+
import { updateTileVisible } from "./utils";
|
|
16
16
|
export var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
17
17
|
_inherits(TMSTileLayer, _BaseTileLayer);
|
|
18
18
|
|
|
@@ -84,7 +84,7 @@ export var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
84
84
|
|
|
85
85
|
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
updateTileVisible(tile, _layers, _this2.layerService);
|
|
88
88
|
|
|
89
89
|
_this2.setPickState(_layers);
|
|
90
90
|
}
|
|
@@ -95,28 +95,6 @@ export var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
|
95
95
|
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
}, {
|
|
99
|
-
key: "emitTileVisibleEvent",
|
|
100
|
-
value: function emitTileVisibleEvent(tile, callback) {
|
|
101
|
-
if (tile.isVisible) {
|
|
102
|
-
callback();
|
|
103
|
-
} else {
|
|
104
|
-
tileAllLoad(tile, function () {
|
|
105
|
-
callback();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}, {
|
|
110
|
-
key: "updateTileVisible",
|
|
111
|
-
value: function updateTileVisible(tile, layers) {
|
|
112
|
-
var _this3 = this;
|
|
113
|
-
|
|
114
|
-
this.emitTileVisibleEvent(tile, function () {
|
|
115
|
-
_this3.tileLayerManager.updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
116
|
-
|
|
117
|
-
_this3.layerService.reRender();
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
98
|
}]);
|
|
121
99
|
|
|
122
100
|
return TMSTileLayer;
|
package/es/tile/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILayer, IMapService, IRendererService } from '@antv/l7-core';
|
|
1
|
+
import { ILayer, IMapService, IRendererService, ILayerService } from '@antv/l7-core';
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
3
|
export declare const tileVectorParser: string[];
|
|
4
4
|
export declare function isVectorTile(parserType: string): boolean;
|
|
@@ -15,3 +15,5 @@ export declare function isTileLoaded(tile: Tile): boolean;
|
|
|
15
15
|
export declare function isTileChildLoaded(tile: Tile): boolean;
|
|
16
16
|
export declare function isTileParentLoaded(tile: Tile): boolean;
|
|
17
17
|
export declare function tileAllLoad(tile: Tile, callback: () => void): void;
|
|
18
|
+
export declare function updateLayersConfig(layers: ILayer[], key: string, value: any): void;
|
|
19
|
+
export declare function updateTileVisible(tile: Tile, layers: ILayer[], layerService: ILayerService): void;
|
package/es/tile/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import { createLayerContainer } from '@antv/l7-core';
|
|
3
4
|
import { DOM } from '@antv/l7-utils';
|
|
@@ -158,4 +159,51 @@ export function tileAllLoad(tile, callback) {
|
|
|
158
159
|
window.clearInterval(timer);
|
|
159
160
|
}
|
|
160
161
|
}, 36);
|
|
162
|
+
}
|
|
163
|
+
export function updateLayersConfig(layers, key, value) {
|
|
164
|
+
layers.map(function (layer) {
|
|
165
|
+
if (key === 'mask') {
|
|
166
|
+
// Tip: 栅格瓦片生效、设置全局的 mask、瓦片被全局的 mask 影响
|
|
167
|
+
layer.style({
|
|
168
|
+
mask: value
|
|
169
|
+
});
|
|
170
|
+
} else {
|
|
171
|
+
layer.updateLayerConfig(_defineProperty({}, key, value));
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function dispatchTileVisibleChange(tile, callback) {
|
|
177
|
+
if (tile.isVisible) {
|
|
178
|
+
callback();
|
|
179
|
+
} else {
|
|
180
|
+
tileAllLoad(tile, function () {
|
|
181
|
+
callback();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function updateImmediately(layers) {
|
|
187
|
+
var immediately = true;
|
|
188
|
+
layers.map(function (layer) {
|
|
189
|
+
if (layer.type !== 'PointLayer') {
|
|
190
|
+
immediately = false;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return immediately;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function updateTileVisible(tile, layers, layerService) {
|
|
197
|
+
if (layers.length === 0) return;
|
|
198
|
+
|
|
199
|
+
if (updateImmediately(layers)) {
|
|
200
|
+
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
201
|
+
layerService.reRender();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
dispatchTileVisibleChange(tile, function () {
|
|
206
|
+
updateLayersConfig(layers, 'visible', tile.isVisible);
|
|
207
|
+
layerService.reRender();
|
|
208
|
+
});
|
|
161
209
|
}
|
package/es/wind/index.js
CHANGED
|
@@ -42,11 +42,7 @@ var WindLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
42
42
|
var modelType = this.getModelType();
|
|
43
43
|
this.layerModel = new WindModels[modelType](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 WindLayer = /*#__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
|
}, {
|
package/lib/Geometry/index.js
CHANGED
|
@@ -69,11 +69,7 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
69
69
|
var modelType = this.getModelType();
|
|
70
70
|
this.layerModel = new _models.default[modelType](this);
|
|
71
71
|
this.layerModel.initModels(function (models) {
|
|
72
|
-
_this2.models
|
|
73
|
-
|
|
74
|
-
_this2.emit('modelLoaded', null);
|
|
75
|
-
|
|
76
|
-
_this2.layerService.throttleRenderLayers();
|
|
72
|
+
_this2.dispatchModelLoad(models);
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
}, {
|
|
@@ -82,9 +78,7 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
82
78
|
var _this3 = this;
|
|
83
79
|
|
|
84
80
|
this.layerModel.buildModels(function (models) {
|
|
85
|
-
_this3.models
|
|
86
|
-
|
|
87
|
-
_this3.emit('modelLoaded', null);
|
|
81
|
+
_this3.dispatchModelLoad(models);
|
|
88
82
|
});
|
|
89
83
|
}
|
|
90
84
|
}, {
|
package/lib/canvas/index.js
CHANGED
|
@@ -57,11 +57,7 @@ var CanvasLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
57
57
|
var modelType = this.getModelType();
|
|
58
58
|
this.layerModel = new _index.default[modelType](this);
|
|
59
59
|
this.layerModel.initModels(function (models) {
|
|
60
|
-
_this2.models
|
|
61
|
-
|
|
62
|
-
_this2.emit('modelLoaded', null);
|
|
63
|
-
|
|
64
|
-
_this2.layerService.throttleRenderLayers();
|
|
60
|
+
_this2.dispatchModelLoad(models);
|
|
65
61
|
});
|
|
66
62
|
}
|
|
67
63
|
}, {
|
|
@@ -70,9 +66,7 @@ var CanvasLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
70
66
|
var _this3 = this;
|
|
71
67
|
|
|
72
68
|
this.layerModel.buildModels(function (models) {
|
|
73
|
-
_this3.models
|
|
74
|
-
|
|
75
|
-
_this3.emit('modelLoaded', null);
|
|
69
|
+
_this3.dispatchModelLoad(models);
|
|
76
70
|
});
|
|
77
71
|
}
|
|
78
72
|
}, {
|
|
@@ -55,11 +55,7 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
55
55
|
|
|
56
56
|
this.layerModel = new _build.default(this);
|
|
57
57
|
this.layerModel.initModels(function (models) {
|
|
58
|
-
_this2.models
|
|
59
|
-
|
|
60
|
-
_this2.emit('modelLoaded', null);
|
|
61
|
-
|
|
62
|
-
_this2.layerService.throttleRenderLayers();
|
|
58
|
+
_this2.dispatchModelLoad(models);
|
|
63
59
|
});
|
|
64
60
|
}
|
|
65
61
|
}, {
|
|
@@ -68,9 +64,7 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
68
64
|
var _this3 = this;
|
|
69
65
|
|
|
70
66
|
this.layerModel.buildModels(function (models) {
|
|
71
|
-
_this3.models
|
|
72
|
-
|
|
73
|
-
_this3.emit('modelLoaded', null);
|
|
67
|
+
_this3.dispatchModelLoad(models);
|
|
74
68
|
});
|
|
75
69
|
}
|
|
76
70
|
}, {
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -139,6 +139,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
139
139
|
afterDestroy: new _asyncHook.SyncHook()
|
|
140
140
|
});
|
|
141
141
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "models", []);
|
|
142
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "modelLoaded", false);
|
|
142
143
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "layerChildren", []);
|
|
143
144
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "masks", []);
|
|
144
145
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isVector", false);
|
|
@@ -949,7 +950,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
949
950
|
}, {
|
|
950
951
|
key: "destroy",
|
|
951
952
|
value: function destroy() {
|
|
952
|
-
var _this$multiPassRender, _this$layerModel2;
|
|
953
|
+
var _this$multiPassRender, _this$layerModel2, _this$tileLayer;
|
|
953
954
|
|
|
954
955
|
var refresh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
955
956
|
|
|
@@ -977,6 +978,7 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
977
978
|
this.hooks.afterDestroy.call(); // Tip: 清除各个图层自定义的 models 资源
|
|
978
979
|
|
|
979
980
|
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
981
|
+
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
980
982
|
this.models = [];
|
|
981
983
|
this.layerService.cleanRemove(this, refresh);
|
|
982
984
|
this.emit('remove', {
|
|
@@ -1370,6 +1372,14 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1370
1372
|
value: function getDefaultConfig() {
|
|
1371
1373
|
return {};
|
|
1372
1374
|
}
|
|
1375
|
+
}, {
|
|
1376
|
+
key: "dispatchModelLoad",
|
|
1377
|
+
value: function dispatchModelLoad(models) {
|
|
1378
|
+
this.models = models;
|
|
1379
|
+
this.emit('modelLoaded', null);
|
|
1380
|
+
this.modelLoaded = true;
|
|
1381
|
+
this.layerService.throttleRenderLayers();
|
|
1382
|
+
}
|
|
1373
1383
|
}, {
|
|
1374
1384
|
key: "reRender",
|
|
1375
1385
|
value: function reRender() {
|
package/lib/earth/index.js
CHANGED
|
@@ -75,11 +75,7 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
75
75
|
var shape = this.getModelType();
|
|
76
76
|
this.layerModel = new EarthModels[shape](this);
|
|
77
77
|
this.layerModel.initModels(function (models) {
|
|
78
|
-
_this2.models
|
|
79
|
-
|
|
80
|
-
_this2.emit('modelLoaded', null);
|
|
81
|
-
|
|
82
|
-
_this2.layerService.throttleRenderLayers();
|
|
78
|
+
_this2.dispatchModelLoad(models);
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
/**
|
package/lib/heatmap/index.js
CHANGED
|
@@ -56,11 +56,7 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
56
56
|
var shape = this.getModelType();
|
|
57
57
|
this.layerModel = new _models.default[shape](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,9 +65,7 @@ var HeatMapLayer = /*#__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
|
}, {
|
package/lib/image/index.js
CHANGED
|
@@ -56,11 +56,7 @@ var ImageLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
56
56
|
var modelType = this.getModelType();
|
|
57
57
|
this.layerModel = new _index.default[modelType](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,9 +65,7 @@ var ImageLayer = /*#__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
|
}, {
|
package/lib/line/index.js
CHANGED
|
@@ -76,11 +76,7 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
76
76
|
var shape = this.getModelType();
|
|
77
77
|
this.layerModel = new _models.default[shape](this);
|
|
78
78
|
this.layerModel.initModels(function (models) {
|
|
79
|
-
_this2.models
|
|
80
|
-
|
|
81
|
-
_this2.emit('modelLoaded', null);
|
|
82
|
-
|
|
83
|
-
_this2.layerService.throttleRenderLayers();
|
|
79
|
+
_this2.dispatchModelLoad(models);
|
|
84
80
|
});
|
|
85
81
|
}
|
|
86
82
|
}, {
|
|
@@ -89,9 +85,7 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
89
85
|
var _this3 = this;
|
|
90
86
|
|
|
91
87
|
this.layerModel.buildModels(function (models) {
|
|
92
|
-
_this3.models
|
|
93
|
-
|
|
94
|
-
_this3.emit('modelLoaded', null);
|
|
88
|
+
_this3.dispatchModelLoad(models);
|
|
95
89
|
});
|
|
96
90
|
}
|
|
97
91
|
}, {
|
|
@@ -250,7 +250,7 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
250
250
|
type: _l7Core.gl.FLOAT
|
|
251
251
|
},
|
|
252
252
|
size: 1,
|
|
253
|
-
update: function update(feature) {
|
|
253
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
254
254
|
var _feature$size = feature.size,
|
|
255
255
|
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
256
256
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
@@ -269,7 +269,7 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
269
269
|
type: _l7Core.gl.FLOAT
|
|
270
270
|
},
|
|
271
271
|
size: 4,
|
|
272
|
-
update: function update(feature, featureIdx, vertex) {
|
|
272
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
273
273
|
return [vertex[3], vertex[4], vertex[5], vertex[6]];
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -286,10 +286,10 @@ var GreatCircleModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
286
286
|
type: _l7Core.gl.FLOAT
|
|
287
287
|
},
|
|
288
288
|
size: 2,
|
|
289
|
-
update: function update(feature) {
|
|
289
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
290
290
|
var iconMap = _this2.iconService.getIconMap();
|
|
291
291
|
|
|
292
|
-
var texture = feature.texture;
|
|
292
|
+
var texture = feature.texture; // console.log('icon feature', feature)
|
|
293
293
|
|
|
294
294
|
var _ref4 = iconMap[texture] || {
|
|
295
295
|
x: 0,
|
package/lib/mask/index.js
CHANGED
|
@@ -131,9 +131,7 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
131
131
|
var shape = this.getModelType();
|
|
132
132
|
this.layerModel = new _models.default[shape](this);
|
|
133
133
|
this.layerModel.initModels(function (models) {
|
|
134
|
-
_this3.models
|
|
135
|
-
|
|
136
|
-
_this3.emit('modelLoaded', null);
|
|
134
|
+
_this3.dispatchModelLoad(models);
|
|
137
135
|
});
|
|
138
136
|
}
|
|
139
137
|
}, {
|
|
@@ -142,9 +140,7 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
142
140
|
var _this4 = this;
|
|
143
141
|
|
|
144
142
|
this.layerModel.buildModels(function (models) {
|
|
145
|
-
_this4.models
|
|
146
|
-
|
|
147
|
-
_this4.emit('modelLoaded', null);
|
|
143
|
+
_this4.dispatchModelLoad(models);
|
|
148
144
|
});
|
|
149
145
|
}
|
|
150
146
|
}, {
|
|
@@ -84,6 +84,10 @@ var DataMappingPlugin = (_dec = (0, _inversify.injectable)(), _dec2 = (0, _inver
|
|
|
84
84
|
}); // remapping before render
|
|
85
85
|
|
|
86
86
|
layer.hooks.beforeRender.tap('DataMappingPlugin', function () {
|
|
87
|
+
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
88
|
+
usage = _layer$getLayerConfig.usage;
|
|
89
|
+
|
|
90
|
+
if (usage === 'basemap') return;
|
|
87
91
|
var source = layer.getSource();
|
|
88
92
|
|
|
89
93
|
if (layer.layerModelNeedUpdate || !source || !source.inited) {
|
|
@@ -102,7 +102,10 @@ var FeatureScalePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = /*#
|
|
|
102
102
|
return true;
|
|
103
103
|
});
|
|
104
104
|
layer.hooks.beforeRender.tap('FeatureScalePlugin', function () {
|
|
105
|
-
|
|
105
|
+
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
106
|
+
usage = _layer$getLayerConfig.usage;
|
|
107
|
+
|
|
108
|
+
if (layer.layerModelNeedUpdate || usage === 'basemap') {
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -52,6 +52,7 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
52
52
|
|
|
53
53
|
layer.hooks.init.tap('LayerModelPlugin', function () {
|
|
54
54
|
layer.inited = true;
|
|
55
|
+
layer.modelLoaded = false;
|
|
55
56
|
var source = layer.getSource();
|
|
56
57
|
|
|
57
58
|
if (source.inited) {
|
|
@@ -60,6 +61,7 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
60
61
|
});
|
|
61
62
|
layer.hooks.beforeRenderData.tap('DataSourcePlugin', function () {
|
|
62
63
|
var source = layer.getSource();
|
|
64
|
+
layer.modelLoaded = false;
|
|
63
65
|
|
|
64
66
|
if (source.inited) {
|
|
65
67
|
_this.prepareLayerModel(layer);
|
|
@@ -38,18 +38,21 @@ _dec = (0, _inversify.injectable)(), _dec(_class = /*#__PURE__*/function () {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
layer.hooks.beforeRender.tap('UpdateStyleAttributePlugin', function () {
|
|
41
|
-
|
|
41
|
+
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
42
|
+
usage = _layer$getLayerConfig.usage;
|
|
43
|
+
|
|
44
|
+
if (layer.layerModelNeedUpdate || layer.tileLayer || usage === 'basemap') {
|
|
42
45
|
return;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
_this.
|
|
48
|
+
layer.modelLoaded && _this.updateStyleAttribute(layer, {
|
|
46
49
|
styleAttributeService: styleAttributeService
|
|
47
50
|
});
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
}, {
|
|
51
|
-
key: "
|
|
52
|
-
value: function
|
|
54
|
+
key: "updateStyleAttribute",
|
|
55
|
+
value: function updateStyleAttribute(layer, _ref2) {
|
|
53
56
|
var styleAttributeService = _ref2.styleAttributeService;
|
|
54
57
|
var attributes = styleAttributeService.getLayerStyleAttributes() || [];
|
|
55
58
|
var filter = styleAttributeService.getLayerStyleAttribute('filter');
|
package/lib/point/index.js
CHANGED
|
@@ -74,13 +74,7 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
74
74
|
var modelType = this.getModelType();
|
|
75
75
|
this.layerModel = new _index.default[modelType](this);
|
|
76
76
|
this.layerModel.initModels(function (models) {
|
|
77
|
-
_this2.models
|
|
78
|
-
|
|
79
|
-
_this2.layerService.updateLayerRenderList();
|
|
80
|
-
|
|
81
|
-
_this2.emit('modelLoaded', null);
|
|
82
|
-
|
|
83
|
-
_this2.layerService.throttleRenderLayers();
|
|
77
|
+
_this2.dispatchModelLoad(models);
|
|
84
78
|
});
|
|
85
79
|
}
|
|
86
80
|
}, {
|
|
@@ -89,9 +83,7 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
89
83
|
var _this3 = this;
|
|
90
84
|
|
|
91
85
|
this.layerModel.buildModels(function (models) {
|
|
92
|
-
_this3.models
|
|
93
|
-
|
|
94
|
-
_this3.emit('modelLoaded', null);
|
|
86
|
+
_this3.dispatchModelLoad(models);
|
|
95
87
|
});
|
|
96
88
|
}
|
|
97
89
|
/**
|
package/lib/polygon/index.js
CHANGED
|
@@ -58,11 +58,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
58
58
|
var shape = this.getModelType();
|
|
59
59
|
this.layerModel = new _models.default[shape](this);
|
|
60
60
|
this.layerModel.initModels(function (models) {
|
|
61
|
-
_this2.models
|
|
62
|
-
|
|
63
|
-
_this2.emit('modelLoaded', null);
|
|
64
|
-
|
|
65
|
-
_this2.layerService.throttleRenderLayers();
|
|
61
|
+
_this2.dispatchModelLoad(models);
|
|
66
62
|
});
|
|
67
63
|
}
|
|
68
64
|
}, {
|
|
@@ -71,9 +67,7 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
71
67
|
var _this3 = this;
|
|
72
68
|
|
|
73
69
|
this.layerModel.buildModels(function (models) {
|
|
74
|
-
_this3.models
|
|
75
|
-
|
|
76
|
-
_this3.emit('modelLoaded', null);
|
|
70
|
+
_this3.dispatchModelLoad(models);
|
|
77
71
|
});
|
|
78
72
|
}
|
|
79
73
|
}, {
|
package/lib/raster/index.js
CHANGED
|
@@ -56,11 +56,7 @@ var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
56
56
|
var modelType = this.getModelType();
|
|
57
57
|
this.layerModel = new _index.default[modelType](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,9 +65,7 @@ var RaterLayer = /*#__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
|
}, {
|
|
@@ -113,8 +107,7 @@ var RaterLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
113
107
|
|
|
114
108
|
default:
|
|
115
109
|
return 'raster';
|
|
116
|
-
}
|
|
117
|
-
|
|
110
|
+
}
|
|
118
111
|
}
|
|
119
112
|
}]);
|
|
120
113
|
return RaterLayer;
|
|
@@ -32,10 +32,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
32
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
33
|
|
|
34
34
|
/* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
|
|
35
|
-
var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue)\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))\n gl_FragColor = vec4(0, 0, 0, 0);\n else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);\n vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n
|
|
35
|
+
var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue)\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))\n gl_FragColor = vec4(0, 0, 0, 0);\n else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);\n vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n }\n}\n";
|
|
36
36
|
|
|
37
37
|
/* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
|
|
38
|
-
var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n
|
|
38
|
+
var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
|
|
39
39
|
|
|
40
40
|
var RasterModel = /*#__PURE__*/function (_BaseModel) {
|
|
41
41
|
(0, _inherits2.default)(RasterModel, _BaseModel);
|