@antv/l7-layers 2.17.3 → 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 +112 -63
- 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 +136 -85
- package/es/line/models/linearline.js +74 -42
- package/es/line/models/simpleLine.js +67 -38
- 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 +122 -61
- 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 +144 -83
- package/lib/line/models/linearline.js +86 -42
- package/lib/line/models/simpleLine.js +77 -38
- 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
|
@@ -7,21 +7,33 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
|
|
10
11
|
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); }; }
|
|
12
|
+
|
|
11
13
|
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; } }
|
|
14
|
+
|
|
12
15
|
import BaseLayer from "../../../core/BaseLayer";
|
|
16
|
+
|
|
13
17
|
var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
14
18
|
_inherits(TileDebugLayer, _BaseLayer);
|
|
19
|
+
|
|
15
20
|
var _super = _createSuper(TileDebugLayer);
|
|
21
|
+
|
|
16
22
|
function TileDebugLayer() {
|
|
17
23
|
var _this;
|
|
24
|
+
|
|
18
25
|
_classCallCheck(this, TileDebugLayer);
|
|
26
|
+
|
|
19
27
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
28
|
args[_key] = arguments[_key];
|
|
21
29
|
}
|
|
30
|
+
|
|
22
31
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
|
|
23
33
|
_defineProperty(_assertThisInitialized(_this), "type", 'TileDebugLayer');
|
|
34
|
+
|
|
24
35
|
_defineProperty(_assertThisInitialized(_this), "zIndex", 10000);
|
|
36
|
+
|
|
25
37
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
26
38
|
data: [],
|
|
27
39
|
options: {
|
|
@@ -30,28 +42,37 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
});
|
|
45
|
+
|
|
33
46
|
return _this;
|
|
34
47
|
}
|
|
48
|
+
|
|
35
49
|
_createClass(TileDebugLayer, [{
|
|
36
50
|
key: "buildModels",
|
|
37
51
|
value: function () {
|
|
38
52
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
39
53
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
-
while (1)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
while (1) {
|
|
55
|
+
switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
return _context.abrupt("return");
|
|
58
|
+
|
|
59
|
+
case 1:
|
|
60
|
+
case "end":
|
|
61
|
+
return _context.stop();
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
}, _callee);
|
|
48
65
|
}));
|
|
66
|
+
|
|
49
67
|
function buildModels() {
|
|
50
68
|
return _buildModels.apply(this, arguments);
|
|
51
69
|
}
|
|
70
|
+
|
|
52
71
|
return buildModels;
|
|
53
72
|
}()
|
|
54
73
|
}]);
|
|
74
|
+
|
|
55
75
|
return TileDebugLayer;
|
|
56
76
|
}(BaseLayer);
|
|
77
|
+
|
|
57
78
|
export { TileDebugLayer as default };
|
|
@@ -5,12 +5,15 @@ export function getTileLayer(type) {
|
|
|
5
5
|
if (type === 'PolygonLayer') {
|
|
6
6
|
return PolygonLayer;
|
|
7
7
|
}
|
|
8
|
+
|
|
8
9
|
if (type === 'LineLayer') {
|
|
9
10
|
return LineLayer;
|
|
10
11
|
}
|
|
12
|
+
|
|
11
13
|
if (type === 'PointLayer') {
|
|
12
14
|
return PointLayer;
|
|
13
15
|
}
|
|
16
|
+
|
|
14
17
|
return PointLayer;
|
|
15
18
|
}
|
|
16
19
|
export function isNeedMask(type) {
|
|
@@ -9,81 +9,96 @@ import { TileLayerService } from "../service/TileLayerService";
|
|
|
9
9
|
import { TilePickService } from "../service/TilePickService";
|
|
10
10
|
import { ProxyFuncs } from "../style/constants";
|
|
11
11
|
import { getTileFactory } from "../tileFactory";
|
|
12
|
+
|
|
12
13
|
var BaseTileLayer = /*#__PURE__*/function () {
|
|
13
14
|
// 瓦片数据管理器
|
|
14
|
-
|
|
15
15
|
function BaseTileLayer(parent) {
|
|
16
16
|
var _this = this;
|
|
17
|
+
|
|
17
18
|
_classCallCheck(this, BaseTileLayer);
|
|
19
|
+
|
|
18
20
|
_defineProperty(this, "initedTileset", false);
|
|
21
|
+
|
|
19
22
|
_defineProperty(this, "mapchange", function () {
|
|
20
23
|
var _this$tilesetManager;
|
|
24
|
+
|
|
21
25
|
var _this$getCurrentView = _this.getCurrentView(),
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
27
|
+
zoom = _this$getCurrentView.zoom;
|
|
28
|
+
|
|
24
29
|
if (_this.mapService.version === 'GAODE1.x') {
|
|
25
30
|
var _this$parent$getLayer = _this.parent.getLayerConfig(),
|
|
26
|
-
|
|
31
|
+
visible = _this$parent$getLayer.visible;
|
|
32
|
+
|
|
27
33
|
if (zoom < 2 && visible) {
|
|
28
34
|
_this.parent.updateLayerConfig({
|
|
29
35
|
visible: false
|
|
30
36
|
});
|
|
37
|
+
|
|
31
38
|
_this.layerService.reRender();
|
|
32
39
|
} else if (zoom >= 2 && !visible) {
|
|
33
40
|
_this.parent.updateLayerConfig({
|
|
34
41
|
visible: true
|
|
35
42
|
});
|
|
43
|
+
|
|
36
44
|
_this.layerService.reRender();
|
|
37
45
|
}
|
|
38
46
|
}
|
|
47
|
+
|
|
39
48
|
if (_this.lastViewStates && _this.lastViewStates.zoom === zoom && _this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
40
49
|
return;
|
|
41
50
|
}
|
|
51
|
+
|
|
42
52
|
_this.lastViewStates = {
|
|
43
53
|
zoom: zoom,
|
|
44
54
|
latLonBounds: latLonBounds
|
|
45
55
|
};
|
|
46
56
|
(_this$tilesetManager = _this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
|
|
47
57
|
});
|
|
58
|
+
|
|
48
59
|
_defineProperty(this, "viewchange", debounce(this.mapchange, 24));
|
|
60
|
+
|
|
49
61
|
this.parent = parent;
|
|
50
62
|
var container = this.parent.getContainer();
|
|
51
63
|
this.rendererService = container.get(TYPES.IRendererService);
|
|
52
64
|
this.layerService = container.get(TYPES.ILayerService);
|
|
53
65
|
this.mapService = container.get(TYPES.IMapService);
|
|
54
|
-
this.pickingService = container.get(TYPES.IPickingService);
|
|
66
|
+
this.pickingService = container.get(TYPES.IPickingService); // 初始化瓦片管理服务
|
|
55
67
|
|
|
56
|
-
// 初始化瓦片管理服务
|
|
57
68
|
this.tileLayerService = new TileLayerService({
|
|
58
69
|
rendererService: this.rendererService,
|
|
59
70
|
layerService: this.layerService,
|
|
60
71
|
parent: parent
|
|
61
|
-
});
|
|
62
|
-
|
|
72
|
+
}); // 初始化拾取服务
|
|
73
|
+
|
|
63
74
|
this.tilePickService = new TilePickService({
|
|
64
75
|
tileLayerService: this.tileLayerService,
|
|
65
76
|
layerService: this.layerService,
|
|
66
77
|
parent: parent
|
|
67
|
-
});
|
|
78
|
+
}); // 重置
|
|
68
79
|
|
|
69
|
-
// 重置
|
|
70
80
|
this.parent.setLayerPickService(this.tilePickService);
|
|
71
81
|
this.proxy(parent);
|
|
72
82
|
this.initTileSetManager();
|
|
73
83
|
}
|
|
84
|
+
|
|
74
85
|
_createClass(BaseTileLayer, [{
|
|
75
86
|
key: "initTileSetManager",
|
|
76
87
|
value: function initTileSetManager() {
|
|
77
88
|
var _this$tilesetManager2;
|
|
89
|
+
|
|
78
90
|
var source = this.parent.getSource();
|
|
79
91
|
this.tilesetManager = source.tileset;
|
|
92
|
+
|
|
80
93
|
if (!this.initedTileset) {
|
|
81
94
|
this.bindTilesetEvent();
|
|
82
95
|
this.initedTileset = true;
|
|
83
96
|
}
|
|
97
|
+
|
|
84
98
|
var _this$getCurrentView2 = this.getCurrentView(),
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
100
|
+
zoom = _this$getCurrentView2.zoom;
|
|
101
|
+
|
|
87
102
|
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
88
103
|
}
|
|
89
104
|
}, {
|
|
@@ -101,31 +116,27 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
101
116
|
key: "bindTilesetEvent",
|
|
102
117
|
value: function bindTilesetEvent() {
|
|
103
118
|
var _this2 = this;
|
|
119
|
+
|
|
104
120
|
// 瓦片数据加载成功
|
|
105
121
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
-
this.tilesetManager.on('tile-loaded', function (tile) {
|
|
107
|
-
|
|
108
|
-
});
|
|
122
|
+
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
123
|
+
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
109
124
|
|
|
110
|
-
// 瓦片数据从缓存删除或被执行重新加载
|
|
111
125
|
this.tilesetManager.on('tile-unload', function (tile) {
|
|
112
126
|
// 将事件抛出,图层上可以监听使用
|
|
113
127
|
_this2.tileUnLoad(tile);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// 瓦片数据加载失败
|
|
128
|
+
}); // 瓦片数据加载失败
|
|
117
129
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
130
|
+
|
|
118
131
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
119
132
|
// 将事件抛出,图层上可以监听使用
|
|
120
133
|
_this2.tileError(error);
|
|
121
|
-
});
|
|
134
|
+
}); // 瓦片显隐状态更新
|
|
122
135
|
|
|
123
|
-
// 瓦片显隐状态更新
|
|
124
136
|
this.tilesetManager.on('tile-update', function () {
|
|
125
137
|
_this2.tileUpdate();
|
|
126
|
-
});
|
|
138
|
+
}); // 地图视野发生改变
|
|
127
139
|
|
|
128
|
-
// 地图视野发生改变
|
|
129
140
|
this.mapService.on('zoomend', this.mapchange);
|
|
130
141
|
this.mapService.on('moveend', this.viewchange);
|
|
131
142
|
}
|
|
@@ -148,15 +159,12 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
148
159
|
key: "getTile",
|
|
149
160
|
value: function getTile(key) {
|
|
150
161
|
return this.tileLayerService.getTile(key);
|
|
151
|
-
}
|
|
162
|
+
} // 防抖操作
|
|
152
163
|
|
|
153
|
-
// 防抖操作
|
|
154
164
|
}, {
|
|
155
165
|
key: "tileLoaded",
|
|
156
|
-
value:
|
|
157
|
-
|
|
158
|
-
function tileLoaded(tile) {
|
|
159
|
-
//
|
|
166
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
167
|
+
function tileLoaded(tile) {//
|
|
160
168
|
}
|
|
161
169
|
}, {
|
|
162
170
|
key: "tileError",
|
|
@@ -167,21 +175,25 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
167
175
|
key: "destroy",
|
|
168
176
|
value: function destroy() {
|
|
169
177
|
var _this$tilesetManager3;
|
|
178
|
+
|
|
170
179
|
this.mapService.off('zoomend', this.mapchange);
|
|
171
180
|
this.mapService.off('moveend', this.viewchange);
|
|
172
181
|
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
173
182
|
this.tileLayerService.destroy();
|
|
174
|
-
}
|
|
175
|
-
|
|
183
|
+
} // 重新加载
|
|
184
|
+
|
|
176
185
|
}, {
|
|
177
186
|
key: "reload",
|
|
178
187
|
value: function reload() {
|
|
179
188
|
var _this$tilesetManager4;
|
|
189
|
+
|
|
180
190
|
// 瓦片重新加载
|
|
181
191
|
this.tilesetManager.clear();
|
|
192
|
+
|
|
182
193
|
var _this$getCurrentView3 = this.getCurrentView(),
|
|
183
|
-
|
|
184
|
-
|
|
194
|
+
latLonBounds = _this$getCurrentView3.latLonBounds,
|
|
195
|
+
zoom = _this$getCurrentView3.zoom;
|
|
196
|
+
|
|
185
197
|
(_this$tilesetManager4 = this.tilesetManager) === null || _this$tilesetManager4 === void 0 ? void 0 : _this$tilesetManager4.update(zoom, latLonBounds);
|
|
186
198
|
}
|
|
187
199
|
}, {
|
|
@@ -194,84 +206,106 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
194
206
|
value: function () {
|
|
195
207
|
var _tileUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
196
208
|
var _this3 = this;
|
|
209
|
+
|
|
197
210
|
var minZoom, maxZoom;
|
|
198
211
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
199
|
-
while (1)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
212
|
+
while (1) {
|
|
213
|
+
switch (_context2.prev = _context2.next) {
|
|
214
|
+
case 0:
|
|
215
|
+
if (this.tilesetManager) {
|
|
216
|
+
_context2.next = 2;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return _context2.abrupt("return");
|
|
221
|
+
|
|
222
|
+
case 2:
|
|
223
|
+
minZoom = this.parent.getMinZoom();
|
|
224
|
+
maxZoom = this.parent.getMaxZoom();
|
|
225
|
+
_context2.next = 6;
|
|
226
|
+
return Promise.all(this.tilesetManager.tiles.filter(function (tile) {
|
|
227
|
+
return tile.isLoaded;
|
|
228
|
+
}) // 过滤未加载完成的
|
|
229
|
+
.filter(function (tile) {
|
|
230
|
+
return tile.isVisibleChange;
|
|
231
|
+
}) // 过滤未发生变化的
|
|
232
|
+
.filter(function (tile) {
|
|
233
|
+
return tile.data;
|
|
234
|
+
}).filter(function (tile) {
|
|
235
|
+
return tile.z >= minZoom && tile.z < maxZoom;
|
|
236
|
+
}).map( /*#__PURE__*/function () {
|
|
237
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(tile) {
|
|
238
|
+
var tileInstance, tileLayer;
|
|
239
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
240
|
+
while (1) {
|
|
241
|
+
switch (_context.prev = _context.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
if (_this3.tileLayerService.hasTile(tile.key)) {
|
|
244
|
+
_context.next = 9;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
tileInstance = getTileFactory(_this3.parent);
|
|
249
|
+
tileLayer = new tileInstance(tile, _this3.parent);
|
|
250
|
+
_context.next = 5;
|
|
251
|
+
return tileLayer.initTileLayer();
|
|
252
|
+
|
|
253
|
+
case 5:
|
|
254
|
+
_this3.tilePickService.setPickState();
|
|
255
|
+
|
|
256
|
+
if (tileLayer.getLayers().length !== 0) {
|
|
257
|
+
_this3.tileLayerService.addTile(tileLayer);
|
|
258
|
+
|
|
259
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
260
|
+
|
|
261
|
+
_this3.layerService.reRender();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
_context.next = 12;
|
|
265
|
+
break;
|
|
266
|
+
|
|
267
|
+
case 9:
|
|
268
|
+
// 已加载瓦片
|
|
269
|
+
_this3.tileLayerService.updateTileVisible(tile);
|
|
270
|
+
|
|
271
|
+
_this3.tilePickService.setPickState();
|
|
272
|
+
|
|
273
|
+
_this3.layerService.reRender();
|
|
274
|
+
|
|
275
|
+
case 12:
|
|
276
|
+
case "end":
|
|
277
|
+
return _context.stop();
|
|
240
278
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (this.tilesetManager.isLoaded) {
|
|
261
|
-
// 将事件抛出,图层上可以使用瓦片
|
|
262
|
-
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
263
|
-
}
|
|
264
|
-
case 7:
|
|
265
|
-
case "end":
|
|
266
|
-
return _context2.stop();
|
|
279
|
+
}
|
|
280
|
+
}, _callee);
|
|
281
|
+
}));
|
|
282
|
+
|
|
283
|
+
return function (_x) {
|
|
284
|
+
return _ref.apply(this, arguments);
|
|
285
|
+
};
|
|
286
|
+
}()));
|
|
287
|
+
|
|
288
|
+
case 6:
|
|
289
|
+
if (this.tilesetManager.isLoaded) {
|
|
290
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
291
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
case 7:
|
|
295
|
+
case "end":
|
|
296
|
+
return _context2.stop();
|
|
297
|
+
}
|
|
267
298
|
}
|
|
268
299
|
}, _callee2, this);
|
|
269
300
|
}));
|
|
301
|
+
|
|
270
302
|
function tileUpdate() {
|
|
271
303
|
return _tileUpdate.apply(this, arguments);
|
|
272
304
|
}
|
|
305
|
+
|
|
273
306
|
return tileUpdate;
|
|
274
307
|
}() // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
308
|
+
|
|
275
309
|
}, {
|
|
276
310
|
key: "setPickState",
|
|
277
311
|
value: function setPickState(layers) {
|
|
@@ -292,39 +326,46 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
292
326
|
value: function highlightPickedFeature(pickedColors) {
|
|
293
327
|
this.tilePickService.highlightPickedFeature(pickedColors);
|
|
294
328
|
}
|
|
295
|
-
|
|
296
329
|
/**
|
|
297
330
|
* 实现 TileLayer 对子图层方法的代理
|
|
298
331
|
* @param parent
|
|
299
332
|
*/
|
|
333
|
+
|
|
300
334
|
}, {
|
|
301
335
|
key: "proxy",
|
|
302
336
|
value: function proxy(parent) {
|
|
303
337
|
var _this4 = this;
|
|
338
|
+
|
|
304
339
|
ProxyFuncs.forEach(function (func) {
|
|
305
340
|
// @ts-ignore
|
|
306
|
-
var oldStyleFunc = parent[func].bind(parent);
|
|
307
|
-
|
|
341
|
+
var oldStyleFunc = parent[func].bind(parent); // @ts-ignore
|
|
342
|
+
|
|
308
343
|
parent[func] = function () {
|
|
309
344
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
310
345
|
args[_key] = arguments[_key];
|
|
311
346
|
}
|
|
347
|
+
|
|
312
348
|
oldStyleFunc.apply(void 0, args);
|
|
349
|
+
|
|
313
350
|
_this4.getLayers().map(function (child) {
|
|
314
351
|
// @ts-ignore
|
|
315
352
|
child[func].apply(child, args);
|
|
316
|
-
});
|
|
317
|
-
|
|
353
|
+
}); // Tip: 目前在更新 RasterData 的 colorTexture 的时候需要额外优化
|
|
354
|
+
|
|
355
|
+
|
|
318
356
|
if (func === 'style') {
|
|
319
357
|
_this4.getTiles().forEach(function (tile) {
|
|
320
358
|
return tile.styleUpdate.apply(tile, args);
|
|
321
359
|
});
|
|
322
360
|
}
|
|
361
|
+
|
|
323
362
|
return parent;
|
|
324
363
|
};
|
|
325
364
|
});
|
|
326
365
|
}
|
|
327
366
|
}]);
|
|
367
|
+
|
|
328
368
|
return BaseTileLayer;
|
|
329
369
|
}();
|
|
370
|
+
|
|
330
371
|
export { BaseTileLayer as default };
|
package/es/tile/utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DOM } from '@antv/l7-utils';
|
|
2
2
|
export var tileVectorParser = ['mvt', 'geojsonvt', 'testTile'];
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* 判断当前图层是否是瓦片图层
|
|
6
5
|
* @param layer
|
|
7
6
|
* @returns
|
|
8
7
|
*/
|
|
8
|
+
|
|
9
9
|
export function isTileGroup(layer) {
|
|
10
10
|
var source = layer.getSource();
|
|
11
11
|
return tileVectorParser.includes(source.parser.type);
|
package/es/utils/blend.js
CHANGED
|
@@ -9,20 +9,24 @@ import GridIndex from "./grid-index";
|
|
|
9
9
|
* 基于网格实现文本避让,大幅提升包围盒碰撞检测效率
|
|
10
10
|
* @see https://zhuanlan.zhihu.com/p/74373214
|
|
11
11
|
*/
|
|
12
|
+
|
|
12
13
|
var CollisionIndex = /*#__PURE__*/function () {
|
|
13
14
|
function CollisionIndex(width, height) {
|
|
14
15
|
_classCallCheck(this, CollisionIndex);
|
|
16
|
+
|
|
15
17
|
_defineProperty(this, "viewportPadding", 100);
|
|
18
|
+
|
|
16
19
|
this.width = width;
|
|
17
20
|
this.height = height;
|
|
18
|
-
this.viewportPadding = Math.max(width, height);
|
|
19
|
-
|
|
21
|
+
this.viewportPadding = Math.max(width, height); // 创建网格索引
|
|
22
|
+
|
|
20
23
|
this.grid = new GridIndex(width + this.viewportPadding, height + this.viewportPadding, 25);
|
|
21
24
|
this.screenRightBoundary = width + this.viewportPadding;
|
|
22
25
|
this.screenBottomBoundary = height + this.viewportPadding;
|
|
23
26
|
this.gridRightBoundary = width + 2 * this.viewportPadding;
|
|
24
27
|
this.gridBottomBoundary = height + 2 * this.viewportPadding;
|
|
25
28
|
}
|
|
29
|
+
|
|
26
30
|
_createClass(CollisionIndex, [{
|
|
27
31
|
key: "placeCollisionBox",
|
|
28
32
|
value: function placeCollisionBox(collisionBox) {
|
|
@@ -31,16 +35,17 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
31
35
|
// collisionBox.anchorPointX,
|
|
32
36
|
// collisionBox.anchorPointY,
|
|
33
37
|
// );
|
|
34
|
-
|
|
35
38
|
var tlX = collisionBox.x1 + collisionBox.anchorPointX + this.viewportPadding;
|
|
36
39
|
var tlY = collisionBox.y1 + collisionBox.anchorPointY + this.viewportPadding;
|
|
37
40
|
var brX = collisionBox.x2 + collisionBox.anchorPointX + this.viewportPadding;
|
|
38
41
|
var brY = collisionBox.y2 + collisionBox.anchorPointY + this.viewportPadding;
|
|
42
|
+
|
|
39
43
|
if (!this.isInsideGrid(tlX, tlY, brX, brY) || this.grid.hitTest(tlX, tlY, brX, brY)) {
|
|
40
44
|
return {
|
|
41
45
|
box: []
|
|
42
46
|
};
|
|
43
47
|
}
|
|
48
|
+
|
|
44
49
|
return {
|
|
45
50
|
box: [tlX, tlY, brX, brY]
|
|
46
51
|
};
|
|
@@ -53,7 +58,6 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
53
58
|
};
|
|
54
59
|
this.grid.insert(key, box[0], box[1], box[2], box[3]);
|
|
55
60
|
}
|
|
56
|
-
|
|
57
61
|
/**
|
|
58
62
|
* 后续碰撞检测都需要投影到 viewport 坐标系
|
|
59
63
|
* @param {THREE.Matrix4} mvpMatrix mvp矩阵
|
|
@@ -61,21 +65,21 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
61
65
|
* @param {number} y P20 平面坐标Y
|
|
62
66
|
* @return {Point} projectedPoint
|
|
63
67
|
*/
|
|
68
|
+
|
|
64
69
|
}, {
|
|
65
70
|
key: "project",
|
|
66
71
|
value: function project(mvpMatrix, x, y) {
|
|
67
72
|
var point = vec4.fromValues(x, y, 0, 1);
|
|
68
|
-
var out = vec4.create();
|
|
69
|
-
|
|
73
|
+
var out = vec4.create(); // @ts-ignore
|
|
74
|
+
|
|
70
75
|
var mat = mat4.fromValues.apply(mat4, _toConsumableArray(mvpMatrix));
|
|
71
|
-
vec4.transformMat4(out, point, mat);
|
|
72
|
-
|
|
76
|
+
vec4.transformMat4(out, point, mat); // GL 坐标系[-1, 1] -> viewport 坐标系[width, height]
|
|
77
|
+
|
|
73
78
|
return {
|
|
74
79
|
x: (out[0] / out[3] + 1) / 2 * this.width + this.viewportPadding,
|
|
75
80
|
y: (-out[1] / out[3] + 1) / 2 * this.height + this.viewportPadding
|
|
76
81
|
};
|
|
77
82
|
}
|
|
78
|
-
|
|
79
83
|
/**
|
|
80
84
|
* 判断包围盒是否在整个网格内,需要加上 buffer
|
|
81
85
|
* @param {number} x1 x1
|
|
@@ -84,12 +88,15 @@ var CollisionIndex = /*#__PURE__*/function () {
|
|
|
84
88
|
* @param {number} y2 y2
|
|
85
89
|
* @return {Point} isInside
|
|
86
90
|
*/
|
|
91
|
+
|
|
87
92
|
}, {
|
|
88
93
|
key: "isInsideGrid",
|
|
89
94
|
value: function isInsideGrid(x1, y1, x2, y2) {
|
|
90
95
|
return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;
|
|
91
96
|
}
|
|
92
97
|
}]);
|
|
98
|
+
|
|
93
99
|
return CollisionIndex;
|
|
94
100
|
}();
|
|
101
|
+
|
|
95
102
|
export { CollisionIndex as default };
|