@antv/l7-layers 2.17.2 → 2.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +114 -64
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +138 -86
- package/es/line/models/linearline.js +76 -43
- package/es/line/models/simpleLine.js +69 -39
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +124 -62
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +146 -84
- package/lib/line/models/linearline.js +88 -43
- package/lib/line/models/simpleLine.js +79 -39
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.getTileLayer = getTileLayer;
|
|
8
9
|
exports.isNeedMask = isNeedMask;
|
|
10
|
+
|
|
9
11
|
var _line = _interopRequireDefault(require("../../line"));
|
|
12
|
+
|
|
10
13
|
var _index = _interopRequireDefault(require("../../point/index"));
|
|
14
|
+
|
|
11
15
|
var _polygon = _interopRequireDefault(require("../../polygon"));
|
|
16
|
+
|
|
12
17
|
function getTileLayer(type) {
|
|
13
18
|
if (type === 'PolygonLayer') {
|
|
14
19
|
return _polygon.default;
|
|
15
20
|
}
|
|
21
|
+
|
|
16
22
|
if (type === 'LineLayer') {
|
|
17
23
|
return _line.default;
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
if (type === 'PointLayer') {
|
|
20
27
|
return _index.default;
|
|
21
28
|
}
|
|
29
|
+
|
|
22
30
|
return _index.default;
|
|
23
31
|
}
|
|
32
|
+
|
|
24
33
|
function isNeedMask(type) {
|
|
25
34
|
return ['PolygonLayer', 'LineLayer'].indexOf(type) !== -1;
|
|
26
35
|
}
|
|
@@ -1,51 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
11
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
12
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
13
20
|
var _l7Core = require("@antv/l7-core");
|
|
21
|
+
|
|
14
22
|
var _lodash = require("lodash");
|
|
23
|
+
|
|
15
24
|
var _TileLayerService = require("../service/TileLayerService");
|
|
25
|
+
|
|
16
26
|
var _TilePickService = require("../service/TilePickService");
|
|
27
|
+
|
|
17
28
|
var _constants = require("../style/constants");
|
|
29
|
+
|
|
18
30
|
var _tileFactory = require("../tileFactory");
|
|
31
|
+
|
|
19
32
|
var BaseTileLayer = /*#__PURE__*/function () {
|
|
20
33
|
// 瓦片数据管理器
|
|
21
|
-
|
|
22
34
|
function BaseTileLayer(parent) {
|
|
23
35
|
var _this = this;
|
|
36
|
+
|
|
24
37
|
(0, _classCallCheck2.default)(this, BaseTileLayer);
|
|
25
38
|
(0, _defineProperty2.default)(this, "initedTileset", false);
|
|
26
39
|
(0, _defineProperty2.default)(this, "mapchange", function () {
|
|
27
40
|
var _this$tilesetManager;
|
|
41
|
+
|
|
28
42
|
var _this$getCurrentView = _this.getCurrentView(),
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
44
|
+
zoom = _this$getCurrentView.zoom;
|
|
45
|
+
|
|
31
46
|
if (_this.mapService.version === 'GAODE1.x') {
|
|
32
47
|
var _this$parent$getLayer = _this.parent.getLayerConfig(),
|
|
33
|
-
|
|
48
|
+
visible = _this$parent$getLayer.visible;
|
|
49
|
+
|
|
34
50
|
if (zoom < 2 && visible) {
|
|
35
51
|
_this.parent.updateLayerConfig({
|
|
36
52
|
visible: false
|
|
37
53
|
});
|
|
54
|
+
|
|
38
55
|
_this.layerService.reRender();
|
|
39
56
|
} else if (zoom >= 2 && !visible) {
|
|
40
57
|
_this.parent.updateLayerConfig({
|
|
41
58
|
visible: true
|
|
42
59
|
});
|
|
60
|
+
|
|
43
61
|
_this.layerService.reRender();
|
|
44
62
|
}
|
|
45
63
|
}
|
|
64
|
+
|
|
46
65
|
if (_this.lastViewStates && _this.lastViewStates.zoom === zoom && _this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
47
66
|
return;
|
|
48
67
|
}
|
|
68
|
+
|
|
49
69
|
_this.lastViewStates = {
|
|
50
70
|
zoom: zoom,
|
|
51
71
|
latLonBounds: latLonBounds
|
|
@@ -58,39 +78,42 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
58
78
|
this.rendererService = container.get(_l7Core.TYPES.IRendererService);
|
|
59
79
|
this.layerService = container.get(_l7Core.TYPES.ILayerService);
|
|
60
80
|
this.mapService = container.get(_l7Core.TYPES.IMapService);
|
|
61
|
-
this.pickingService = container.get(_l7Core.TYPES.IPickingService);
|
|
81
|
+
this.pickingService = container.get(_l7Core.TYPES.IPickingService); // 初始化瓦片管理服务
|
|
62
82
|
|
|
63
|
-
// 初始化瓦片管理服务
|
|
64
83
|
this.tileLayerService = new _TileLayerService.TileLayerService({
|
|
65
84
|
rendererService: this.rendererService,
|
|
66
85
|
layerService: this.layerService,
|
|
67
86
|
parent: parent
|
|
68
|
-
});
|
|
69
|
-
|
|
87
|
+
}); // 初始化拾取服务
|
|
88
|
+
|
|
70
89
|
this.tilePickService = new _TilePickService.TilePickService({
|
|
71
90
|
tileLayerService: this.tileLayerService,
|
|
72
91
|
layerService: this.layerService,
|
|
73
92
|
parent: parent
|
|
74
|
-
});
|
|
93
|
+
}); // 重置
|
|
75
94
|
|
|
76
|
-
// 重置
|
|
77
95
|
this.parent.setLayerPickService(this.tilePickService);
|
|
78
96
|
this.proxy(parent);
|
|
79
97
|
this.initTileSetManager();
|
|
80
98
|
}
|
|
99
|
+
|
|
81
100
|
(0, _createClass2.default)(BaseTileLayer, [{
|
|
82
101
|
key: "initTileSetManager",
|
|
83
102
|
value: function initTileSetManager() {
|
|
84
103
|
var _this$tilesetManager2;
|
|
104
|
+
|
|
85
105
|
var source = this.parent.getSource();
|
|
86
106
|
this.tilesetManager = source.tileset;
|
|
107
|
+
|
|
87
108
|
if (!this.initedTileset) {
|
|
88
109
|
this.bindTilesetEvent();
|
|
89
110
|
this.initedTileset = true;
|
|
90
111
|
}
|
|
112
|
+
|
|
91
113
|
var _this$getCurrentView2 = this.getCurrentView(),
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
115
|
+
zoom = _this$getCurrentView2.zoom;
|
|
116
|
+
|
|
94
117
|
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
95
118
|
}
|
|
96
119
|
}, {
|
|
@@ -108,31 +131,27 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
108
131
|
key: "bindTilesetEvent",
|
|
109
132
|
value: function bindTilesetEvent() {
|
|
110
133
|
var _this2 = this;
|
|
134
|
+
|
|
111
135
|
// 瓦片数据加载成功
|
|
112
136
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
113
|
-
this.tilesetManager.on('tile-loaded', function (tile) {
|
|
114
|
-
|
|
115
|
-
});
|
|
137
|
+
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
138
|
+
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
116
139
|
|
|
117
|
-
// 瓦片数据从缓存删除或被执行重新加载
|
|
118
140
|
this.tilesetManager.on('tile-unload', function (tile) {
|
|
119
141
|
// 将事件抛出,图层上可以监听使用
|
|
120
142
|
_this2.tileUnLoad(tile);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// 瓦片数据加载失败
|
|
143
|
+
}); // 瓦片数据加载失败
|
|
124
144
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
145
|
+
|
|
125
146
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
126
147
|
// 将事件抛出,图层上可以监听使用
|
|
127
148
|
_this2.tileError(error);
|
|
128
|
-
});
|
|
149
|
+
}); // 瓦片显隐状态更新
|
|
129
150
|
|
|
130
|
-
// 瓦片显隐状态更新
|
|
131
151
|
this.tilesetManager.on('tile-update', function () {
|
|
132
152
|
_this2.tileUpdate();
|
|
133
|
-
});
|
|
153
|
+
}); // 地图视野发生改变
|
|
134
154
|
|
|
135
|
-
// 地图视野发生改变
|
|
136
155
|
this.mapService.on('zoomend', this.mapchange);
|
|
137
156
|
this.mapService.on('moveend', this.viewchange);
|
|
138
157
|
}
|
|
@@ -155,15 +174,12 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
155
174
|
key: "getTile",
|
|
156
175
|
value: function getTile(key) {
|
|
157
176
|
return this.tileLayerService.getTile(key);
|
|
158
|
-
}
|
|
177
|
+
} // 防抖操作
|
|
159
178
|
|
|
160
|
-
// 防抖操作
|
|
161
179
|
}, {
|
|
162
180
|
key: "tileLoaded",
|
|
163
|
-
value:
|
|
164
|
-
|
|
165
|
-
function tileLoaded(tile) {
|
|
166
|
-
//
|
|
181
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
182
|
+
function tileLoaded(tile) {//
|
|
167
183
|
}
|
|
168
184
|
}, {
|
|
169
185
|
key: "tileError",
|
|
@@ -174,21 +190,25 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
174
190
|
key: "destroy",
|
|
175
191
|
value: function destroy() {
|
|
176
192
|
var _this$tilesetManager3;
|
|
193
|
+
|
|
177
194
|
this.mapService.off('zoomend', this.mapchange);
|
|
178
195
|
this.mapService.off('moveend', this.viewchange);
|
|
179
196
|
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
180
197
|
this.tileLayerService.destroy();
|
|
181
|
-
}
|
|
182
|
-
|
|
198
|
+
} // 重新加载
|
|
199
|
+
|
|
183
200
|
}, {
|
|
184
201
|
key: "reload",
|
|
185
202
|
value: function reload() {
|
|
186
203
|
var _this$tilesetManager4;
|
|
204
|
+
|
|
187
205
|
// 瓦片重新加载
|
|
188
206
|
this.tilesetManager.clear();
|
|
207
|
+
|
|
189
208
|
var _this$getCurrentView3 = this.getCurrentView(),
|
|
190
|
-
|
|
191
|
-
|
|
209
|
+
latLonBounds = _this$getCurrentView3.latLonBounds,
|
|
210
|
+
zoom = _this$getCurrentView3.zoom;
|
|
211
|
+
|
|
192
212
|
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 ? void 0 : _this$tilesetManager4.update(zoom, latLonBounds);
|
|
193
213
|
}
|
|
194
214
|
}, {
|
|
@@ -201,84 +221,106 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
201
221
|
value: function () {
|
|
202
222
|
var _tileUpdate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
203
223
|
var _this3 = this;
|
|
224
|
+
|
|
204
225
|
var minZoom, maxZoom;
|
|
205
226
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
206
|
-
while (1)
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
227
|
+
while (1) {
|
|
228
|
+
switch (_context2.prev = _context2.next) {
|
|
229
|
+
case 0:
|
|
230
|
+
if (this.tilesetManager) {
|
|
231
|
+
_context2.next = 2;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return _context2.abrupt("return");
|
|
236
|
+
|
|
237
|
+
case 2:
|
|
238
|
+
minZoom = this.parent.getMinZoom();
|
|
239
|
+
maxZoom = this.parent.getMaxZoom();
|
|
240
|
+
_context2.next = 6;
|
|
241
|
+
return Promise.all(this.tilesetManager.tiles.filter(function (tile) {
|
|
242
|
+
return tile.isLoaded;
|
|
243
|
+
}) // 过滤未加载完成的
|
|
244
|
+
.filter(function (tile) {
|
|
245
|
+
return tile.isVisibleChange;
|
|
246
|
+
}) // 过滤未发生变化的
|
|
247
|
+
.filter(function (tile) {
|
|
248
|
+
return tile.data;
|
|
249
|
+
}).filter(function (tile) {
|
|
250
|
+
return tile.z >= minZoom && tile.z < maxZoom;
|
|
251
|
+
}).map( /*#__PURE__*/function () {
|
|
252
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(tile) {
|
|
253
|
+
var tileInstance, tileLayer;
|
|
254
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
255
|
+
while (1) {
|
|
256
|
+
switch (_context.prev = _context.next) {
|
|
257
|
+
case 0:
|
|
258
|
+
if (_this3.tileLayerService.hasTile(tile.key)) {
|
|
259
|
+
_context.next = 9;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
tileInstance = (0, _tileFactory.getTileFactory)(_this3.parent);
|
|
264
|
+
tileLayer = new tileInstance(tile, _this3.parent);
|
|
265
|
+
_context.next = 5;
|
|
266
|
+
return tileLayer.initTileLayer();
|
|
267
|
+
|
|
268
|
+
case 5:
|
|
269
|
+
_this3.tilePickService.setPickState();
|
|
270
|
+
|
|
271
|
+
if (tileLayer.getLayers().length !== 0) {
|
|
272
|
+
_this3.tileLayerService.addTile(tileLayer);
|
|
273
|
+
|
|
274
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
275
|
+
|
|
276
|
+
_this3.layerService.reRender();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
_context.next = 12;
|
|
280
|
+
break;
|
|
281
|
+
|
|
282
|
+
case 9:
|
|
283
|
+
// 已加载瓦片
|
|
284
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
285
|
+
|
|
286
|
+
_this3.tilePickService.setPickState();
|
|
287
|
+
|
|
288
|
+
_this3.layerService.reRender();
|
|
289
|
+
|
|
290
|
+
case 12:
|
|
291
|
+
case "end":
|
|
292
|
+
return _context.stop();
|
|
247
293
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (this.tilesetManager.isLoaded) {
|
|
268
|
-
// 将事件抛出,图层上可以使用瓦片
|
|
269
|
-
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
270
|
-
}
|
|
271
|
-
case 7:
|
|
272
|
-
case "end":
|
|
273
|
-
return _context2.stop();
|
|
294
|
+
}
|
|
295
|
+
}, _callee);
|
|
296
|
+
}));
|
|
297
|
+
|
|
298
|
+
return function (_x) {
|
|
299
|
+
return _ref.apply(this, arguments);
|
|
300
|
+
};
|
|
301
|
+
}()));
|
|
302
|
+
|
|
303
|
+
case 6:
|
|
304
|
+
if (this.tilesetManager.isLoaded) {
|
|
305
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
306
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
case 7:
|
|
310
|
+
case "end":
|
|
311
|
+
return _context2.stop();
|
|
312
|
+
}
|
|
274
313
|
}
|
|
275
314
|
}, _callee2, this);
|
|
276
315
|
}));
|
|
316
|
+
|
|
277
317
|
function tileUpdate() {
|
|
278
318
|
return _tileUpdate.apply(this, arguments);
|
|
279
319
|
}
|
|
320
|
+
|
|
280
321
|
return tileUpdate;
|
|
281
322
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
323
|
+
|
|
282
324
|
}, {
|
|
283
325
|
key: "setPickState",
|
|
284
326
|
value: function setPickState(layers) {
|
|
@@ -299,34 +341,39 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
299
341
|
value: function highlightPickedFeature(pickedColors) {
|
|
300
342
|
this.tilePickService.highlightPickedFeature(pickedColors);
|
|
301
343
|
}
|
|
302
|
-
|
|
303
344
|
/**
|
|
304
345
|
* 实现 TileLayer 对子图层方法的代理
|
|
305
346
|
* @param parent
|
|
306
347
|
*/
|
|
348
|
+
|
|
307
349
|
}, {
|
|
308
350
|
key: "proxy",
|
|
309
351
|
value: function proxy(parent) {
|
|
310
352
|
var _this4 = this;
|
|
353
|
+
|
|
311
354
|
_constants.ProxyFuncs.forEach(function (func) {
|
|
312
355
|
// @ts-ignore
|
|
313
|
-
var oldStyleFunc = parent[func].bind(parent);
|
|
314
|
-
|
|
356
|
+
var oldStyleFunc = parent[func].bind(parent); // @ts-ignore
|
|
357
|
+
|
|
315
358
|
parent[func] = function () {
|
|
316
359
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
317
360
|
args[_key] = arguments[_key];
|
|
318
361
|
}
|
|
362
|
+
|
|
319
363
|
oldStyleFunc.apply(void 0, args);
|
|
364
|
+
|
|
320
365
|
_this4.getLayers().map(function (child) {
|
|
321
366
|
// @ts-ignore
|
|
322
367
|
child[func].apply(child, args);
|
|
323
|
-
});
|
|
324
|
-
|
|
368
|
+
}); // Tip: 目前在更新 RasterData 的 colorTexture 的时候需要额外优化
|
|
369
|
+
|
|
370
|
+
|
|
325
371
|
if (func === 'style') {
|
|
326
372
|
_this4.getTiles().forEach(function (tile) {
|
|
327
373
|
return tile.styleUpdate.apply(tile, args);
|
|
328
374
|
});
|
|
329
375
|
}
|
|
376
|
+
|
|
330
377
|
return parent;
|
|
331
378
|
};
|
|
332
379
|
});
|
|
@@ -334,4 +381,5 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
334
381
|
}]);
|
|
335
382
|
return BaseTileLayer;
|
|
336
383
|
}();
|
|
384
|
+
|
|
337
385
|
exports.default = BaseTileLayer;
|
package/lib/tile/utils.js
CHANGED
|
@@ -6,19 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getContainerSize = getContainerSize;
|
|
7
7
|
exports.isTileGroup = isTileGroup;
|
|
8
8
|
exports.tileVectorParser = void 0;
|
|
9
|
+
|
|
9
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
10
|
-
var tileVectorParser = ['mvt', 'geojsonvt', 'testTile'];
|
|
11
11
|
|
|
12
|
+
var tileVectorParser = ['mvt', 'geojsonvt', 'testTile'];
|
|
12
13
|
/**
|
|
13
14
|
* 判断当前图层是否是瓦片图层
|
|
14
15
|
* @param layer
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
18
|
+
|
|
17
19
|
exports.tileVectorParser = tileVectorParser;
|
|
20
|
+
|
|
18
21
|
function isTileGroup(layer) {
|
|
19
22
|
var source = layer.getSource();
|
|
20
23
|
return tileVectorParser.includes(source.parser.type);
|
|
21
24
|
}
|
|
25
|
+
|
|
22
26
|
function getContainerSize(container) {
|
|
23
27
|
if (container.getContext) {
|
|
24
28
|
return {
|
package/lib/utils/blend.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.BlendTypes = void 0;
|
|
9
|
+
|
|
8
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
9
12
|
var _l7Core = require("@antv/l7-core");
|
|
13
|
+
|
|
10
14
|
var _BlendTypes;
|
|
15
|
+
|
|
11
16
|
var BlendTypes = (_BlendTypes = {}, (0, _defineProperty2.default)(_BlendTypes, _l7Core.BlendType.additive, {
|
|
12
17
|
enable: true,
|
|
13
18
|
func: {
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
9
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
10
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
11
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
|
|
12
18
|
var _glMatrix = require("gl-matrix");
|
|
19
|
+
|
|
13
20
|
var _gridIndex = _interopRequireDefault(require("./grid-index"));
|
|
21
|
+
|
|
14
22
|
// @mapbox/grid-index 并没有类似 hitTest 的单纯获取碰撞检测结果的方法,query 将导致计算大量多余的包围盒结果,因此使用改良版
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
* 基于网格实现文本避让,大幅提升包围盒碰撞检测效率
|
|
17
26
|
* @see https://zhuanlan.zhihu.com/p/74373214
|
|
@@ -22,14 +31,15 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
22
31
|
(0, _defineProperty2.default)(this, "viewportPadding", 100);
|
|
23
32
|
this.width = width;
|
|
24
33
|
this.height = height;
|
|
25
|
-
this.viewportPadding = Math.max(width, height);
|
|
26
|
-
|
|
34
|
+
this.viewportPadding = Math.max(width, height); // 创建网格索引
|
|
35
|
+
|
|
27
36
|
this.grid = new _gridIndex.default(width + this.viewportPadding, height + this.viewportPadding, 25);
|
|
28
37
|
this.screenRightBoundary = width + this.viewportPadding;
|
|
29
38
|
this.screenBottomBoundary = height + this.viewportPadding;
|
|
30
39
|
this.gridRightBoundary = width + 2 * this.viewportPadding;
|
|
31
40
|
this.gridBottomBoundary = height + 2 * this.viewportPadding;
|
|
32
41
|
}
|
|
42
|
+
|
|
33
43
|
(0, _createClass2.default)(CollisionIndex, [{
|
|
34
44
|
key: "placeCollisionBox",
|
|
35
45
|
value: function placeCollisionBox(collisionBox) {
|
|
@@ -38,16 +48,17 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
38
48
|
// collisionBox.anchorPointX,
|
|
39
49
|
// collisionBox.anchorPointY,
|
|
40
50
|
// );
|
|
41
|
-
|
|
42
51
|
var tlX = collisionBox.x1 + collisionBox.anchorPointX + this.viewportPadding;
|
|
43
52
|
var tlY = collisionBox.y1 + collisionBox.anchorPointY + this.viewportPadding;
|
|
44
53
|
var brX = collisionBox.x2 + collisionBox.anchorPointX + this.viewportPadding;
|
|
45
54
|
var brY = collisionBox.y2 + collisionBox.anchorPointY + this.viewportPadding;
|
|
55
|
+
|
|
46
56
|
if (!this.isInsideGrid(tlX, tlY, brX, brY) || this.grid.hitTest(tlX, tlY, brX, brY)) {
|
|
47
57
|
return {
|
|
48
58
|
box: []
|
|
49
59
|
};
|
|
50
60
|
}
|
|
61
|
+
|
|
51
62
|
return {
|
|
52
63
|
box: [tlX, tlY, brX, brY]
|
|
53
64
|
};
|
|
@@ -60,7 +71,6 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
60
71
|
};
|
|
61
72
|
this.grid.insert(key, box[0], box[1], box[2], box[3]);
|
|
62
73
|
}
|
|
63
|
-
|
|
64
74
|
/**
|
|
65
75
|
* 后续碰撞检测都需要投影到 viewport 坐标系
|
|
66
76
|
* @param {THREE.Matrix4} mvpMatrix mvp矩阵
|
|
@@ -68,21 +78,25 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
68
78
|
* @param {number} y P20 平面坐标Y
|
|
69
79
|
* @return {Point} projectedPoint
|
|
70
80
|
*/
|
|
81
|
+
|
|
71
82
|
}, {
|
|
72
83
|
key: "project",
|
|
73
84
|
value: function project(mvpMatrix, x, y) {
|
|
74
85
|
var point = _glMatrix.vec4.fromValues(x, y, 0, 1);
|
|
75
|
-
|
|
76
|
-
// @ts-ignore
|
|
86
|
+
|
|
87
|
+
var out = _glMatrix.vec4.create(); // @ts-ignore
|
|
88
|
+
|
|
89
|
+
|
|
77
90
|
var mat = _glMatrix.mat4.fromValues.apply(_glMatrix.mat4, (0, _toConsumableArray2.default)(mvpMatrix));
|
|
78
|
-
|
|
79
|
-
// GL 坐标系[-1, 1] -> viewport 坐标系[width, height]
|
|
91
|
+
|
|
92
|
+
_glMatrix.vec4.transformMat4(out, point, mat); // GL 坐标系[-1, 1] -> viewport 坐标系[width, height]
|
|
93
|
+
|
|
94
|
+
|
|
80
95
|
return {
|
|
81
96
|
x: (out[0] / out[3] + 1) / 2 * this.width + this.viewportPadding,
|
|
82
97
|
y: (-out[1] / out[3] + 1) / 2 * this.height + this.viewportPadding
|
|
83
98
|
};
|
|
84
99
|
}
|
|
85
|
-
|
|
86
100
|
/**
|
|
87
101
|
* 判断包围盒是否在整个网格内,需要加上 buffer
|
|
88
102
|
* @param {number} x1 x1
|
|
@@ -91,6 +105,7 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
91
105
|
* @param {number} y2 y2
|
|
92
106
|
* @return {Point} isInside
|
|
93
107
|
*/
|
|
108
|
+
|
|
94
109
|
}, {
|
|
95
110
|
key: "isInsideGrid",
|
|
96
111
|
value: function isInsideGrid(x1, y1, x2, y2) {
|
|
@@ -99,4 +114,5 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
99
114
|
}]);
|
|
100
115
|
return CollisionIndex;
|
|
101
116
|
}();
|
|
117
|
+
|
|
102
118
|
exports.default = CollisionIndex;
|