@antv/l7-layers 2.9.27-alpha.1 → 2.9.27-alpha.3
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.d.ts +13 -0
- package/es/Geometry/index.js +20 -2
- package/es/Geometry/models/billboard.js +1 -2
- package/es/Geometry/models/plane.js +2 -4
- package/es/Geometry/models/sprite.js +2 -4
- package/es/canvas/index.d.ts +4 -0
- package/es/canvas/index.js +38 -2
- package/es/citybuliding/building.js +6 -2
- package/es/citybuliding/models/build.js +2 -3
- package/es/core/BaseLayer.d.ts +17 -6
- package/es/core/BaseLayer.js +89 -94
- package/es/core/BaseModel.d.ts +1 -1
- package/es/core/BaseModel.js +7 -3
- package/es/core/interface.d.ts +18 -0
- package/es/core/triangulation.d.ts +6 -0
- package/es/core/triangulation.js +64 -2
- package/es/earth/index.d.ts +5 -0
- package/es/earth/index.js +12 -1
- package/es/earth/models/base.js +2 -4
- package/es/earth/shaders/atmosphere_frag.glsl +1 -1
- package/es/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/es/heatmap/index.js +6 -2
- package/es/heatmap/models/heatmap.js +5 -3
- package/es/image/index.js +6 -2
- package/es/image/models/dataImage.js +4 -7
- package/es/image/models/image.js +4 -7
- package/es/line/index.d.ts +1 -0
- package/es/line/index.js +8 -2
- package/es/line/models/arc.js +6 -5
- package/es/line/models/half.js +3 -4
- package/es/line/models/line.js +9 -8
- package/es/line/models/simpleLine.js +2 -1
- package/es/line/models/simpleTileLine.d.ts +9 -0
- package/es/line/models/simpleTileLine.js +100 -0
- package/es/line/models/tile.d.ts +1 -4
- package/es/line/models/tile.js +49 -222
- package/es/line/models/wall.js +10 -46
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/es/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/es/line/shaders/line_arc2d_vert.glsl +1 -1
- package/es/line/shaders/line_arc_3d_frag.glsl +1 -1
- package/es/line/shaders/line_arc_3d_vert.glsl +3 -3
- package/es/line/shaders/line_arc_frag.glsl +1 -1
- package/es/line/shaders/line_arc_great_circle_frag.glsl +1 -1
- package/es/line/shaders/line_arc_great_circle_vert.glsl +1 -1
- package/es/line/shaders/line_arc_vert.glsl +5 -3
- package/es/line/shaders/line_bezier_vert.glsl +1 -1
- package/es/line/shaders/line_frag.glsl +1 -2
- package/es/line/shaders/line_vert.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
- package/es/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
- package/es/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/es/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/es/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/es/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/es/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/es/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
- package/es/line/shaders/wall/wall_vert.glsl +77 -0
- package/es/mask/index.d.ts +1 -0
- package/es/mask/index.js +80 -5
- package/es/mask/models/fill.d.ts +2 -1
- package/es/mask/models/fill.js +13 -10
- package/es/mask/shaders/mask_vert.glsl +0 -6
- package/es/plugins/DataMappingPlugin.d.ts +4 -3
- package/es/plugins/DataMappingPlugin.js +129 -58
- package/es/plugins/DataSourcePlugin.js +3 -2
- package/es/plugins/FeatureScalePlugin.d.ts +0 -2
- package/es/plugins/FeatureScalePlugin.js +8 -51
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -2
- package/es/plugins/LayerAnimateStylePlugin.js +7 -27
- package/es/plugins/LayerModelPlugin.js +2 -6
- package/es/plugins/LightingPlugin.js +1 -7
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -1
- package/es/plugins/MultiPassRendererPlugin.js +4 -16
- package/es/plugins/PixelPickingPlugin.d.ts +1 -1
- package/es/plugins/PixelPickingPlugin.js +8 -28
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +4 -0
- package/es/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/es/point/index.js +6 -2
- package/es/point/models/fill.js +2 -2
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.d.ts +0 -1
- package/es/point/models/normal.js +9 -60
- package/es/point/models/radar.js +4 -69
- package/es/point/models/simplePoint.d.ts +0 -1
- package/es/point/models/simplePoint.js +2 -11
- package/es/point/models/text.js +6 -7
- package/es/point/models/tile.d.ts +0 -7
- package/es/point/models/tile.js +22 -155
- package/es/point/models/tileText.d.ts +0 -4
- package/es/point/models/tileText.js +98 -185
- package/es/point/shaders/animate/wave_frag.glsl +3 -3
- package/es/point/shaders/earth/fill_vert.glsl +0 -1
- package/es/point/shaders/fill_vert.glsl +0 -1
- package/es/point/shaders/normal_frag.glsl +1 -10
- package/es/point/shaders/normal_vert.glsl +5 -60
- package/es/point/shaders/radar/radar_frag.glsl +4 -15
- package/es/point/shaders/radar/radar_vert.glsl +4 -54
- package/es/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/es/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/es/point/shaders/tile/text_frag.glsl +33 -0
- package/es/point/shaders/tile/text_map_frag.glsl +31 -0
- package/es/point/shaders/tile/text_map_vert.glsl +38 -0
- package/es/point/shaders/tile/text_vert.glsl +48 -0
- package/es/polygon/index.js +6 -2
- package/es/polygon/models/extrude.js +1 -3
- package/es/polygon/models/fill.js +3 -4
- package/es/polygon/models/ocean.d.ts +0 -2
- package/es/polygon/models/ocean.js +13 -47
- package/es/polygon/models/tile.d.ts +1 -4
- package/es/polygon/models/tile.js +25 -57
- package/es/polygon/models/water.d.ts +0 -2
- package/es/polygon/models/water.js +13 -47
- package/es/polygon/shaders/polygon_frag.glsl +2 -2
- package/es/polygon/shaders/polygon_vert.glsl +2 -2
- package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/es/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/es/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/es/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/es/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/es/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/es/raster/buffers/triangulation.js +1 -4
- package/es/raster/index.js +6 -2
- package/es/raster/models/raster.js +3 -2
- package/es/shader/minify_frag.glsl +7 -0
- package/es/shader/minify_picking_frag.glsl +10 -0
- package/es/tile/manager/baseMapTileLayerManager.d.ts +29 -0
- package/es/tile/manager/baseMapTileLayerManager.js +207 -0
- package/es/tile/manager/tileLayerManager.d.ts +2 -2
- package/es/tile/manager/tileLayerManager.js +2 -2
- package/es/tile/manager/tilePickerManager.d.ts +2 -3
- package/es/tile/manager/tilePickerManager.js +1 -2
- package/es/tile/models/tileModel.d.ts +1 -0
- package/es/tile/models/tileModel.js +18 -2
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +58 -33
- package/es/tile/tileFactory/line.js +3 -0
- package/es/tile/tileFactory/point.js +3 -0
- package/es/tile/tileFactory/polygon.js +3 -0
- package/es/tile/tileFactory/raster.js +3 -0
- package/es/tile/tileFactory/rasterData.js +3 -0
- package/es/tile/tileFactory/rasterDataLayer.js +6 -2
- package/es/tile/tileFactory/test.js +26 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +4 -1
- package/es/tile/tileFactory/vectorLayer.js +110 -7
- package/es/tile/tileLayer/baseMapTileLayer.d.ts +29 -0
- package/es/tile/tileLayer/baseMapTileLayer.js +188 -0
- package/es/tile/tileLayer/baseTileLayer.d.ts +4 -4
- package/es/tile/tileLayer/baseTileLayer.js +46 -75
- package/es/tile/tileTest.d.ts +1 -0
- package/es/tile/tileTest.js +3 -2
- package/es/tile/tmsMapTileLayer.d.ts +9 -0
- package/es/tile/tmsMapTileLayer.js +119 -0
- package/es/tile/tmsTileLayer.d.ts +2 -0
- package/es/tile/tmsTileLayer.js +24 -2
- package/es/tile/utils.d.ts +4 -0
- package/es/tile/utils.js +30 -0
- package/es/utils/dataMappingStyle.js +3 -0
- package/es/utils/layerData.js +2 -2
- package/es/utils/updateShape.js +2 -2
- package/es/wind/index.js +6 -2
- package/es/wind/models/wind.js +8 -8
- package/es/wind/shaders/wind_vert.glsl +1 -1
- package/lib/Geometry/index.js +19 -2
- package/lib/Geometry/models/billboard.js +1 -2
- package/lib/Geometry/models/plane.js +2 -4
- package/lib/Geometry/models/sprite.js +2 -4
- package/lib/canvas/index.js +37 -2
- package/lib/citybuliding/building.js +6 -2
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +86 -94
- package/lib/core/BaseModel.js +7 -3
- package/lib/core/triangulation.js +66 -2
- package/lib/earth/index.js +11 -1
- package/lib/earth/models/base.js +2 -4
- package/lib/earth/shaders/atmosphere_frag.glsl +1 -1
- package/lib/earth/shaders/bloomsphere_frag.glsl +1 -1
- package/lib/heatmap/index.js +6 -2
- package/lib/heatmap/models/heatmap.js +5 -3
- package/lib/image/index.js +6 -2
- package/lib/image/models/dataImage.js +4 -7
- package/lib/image/models/image.js +4 -7
- package/lib/line/index.js +7 -2
- package/lib/line/models/arc.js +6 -5
- package/lib/line/models/half.js +3 -4
- package/lib/line/models/line.js +9 -8
- package/lib/line/models/simpleLine.js +2 -1
- package/lib/line/models/simpleTileLine.js +115 -0
- package/lib/line/models/tile.js +49 -223
- package/lib/line/models/wall.js +10 -46
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -0
- package/lib/line/shaders/dash/line_dash_frag.glsl +1 -1
- package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
- package/lib/line/shaders/line_arc_3d_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_3d_vert.glsl +3 -3
- package/lib/line/shaders/line_arc_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_great_circle_frag.glsl +1 -1
- package/lib/line/shaders/line_arc_great_circle_vert.glsl +1 -1
- package/lib/line/shaders/line_arc_vert.glsl +5 -3
- package/lib/line/shaders/line_bezier_vert.glsl +1 -1
- package/lib/line/shaders/line_frag.glsl +1 -2
- package/lib/line/shaders/line_vert.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_frag.glsl +1 -1
- package/lib/line/shaders/linear/arc3d_linear_vert.glsl +3 -3
- package/lib/line/shaders/linear/arc_linear_frag.glsl +1 -1
- package/lib/line/shaders/tile/line_tile_map_vert.glsl +25 -0
- package/lib/line/shaders/tile/line_tile_vert.glsl +19 -177
- package/lib/line/shaders/tile/simpleline_map_vert.glsl +15 -0
- package/lib/line/shaders/tile/simpleline_vert.glsl +21 -0
- package/lib/line/shaders/{wall_frag.glsl → wall/wall_frag.glsl} +17 -21
- package/lib/line/shaders/wall/wall_vert.glsl +77 -0
- package/lib/mask/index.js +82 -5
- package/lib/mask/models/fill.js +14 -10
- package/lib/mask/shaders/mask_vert.glsl +0 -6
- package/lib/plugins/DataMappingPlugin.js +127 -57
- package/lib/plugins/DataSourcePlugin.js +3 -2
- package/lib/plugins/FeatureScalePlugin.js +6 -50
- package/lib/plugins/LayerAnimateStylePlugin.js +6 -29
- package/lib/plugins/LayerModelPlugin.js +2 -6
- package/lib/plugins/LightingPlugin.js +1 -7
- package/lib/plugins/MultiPassRendererPlugin.js +3 -19
- package/lib/plugins/PixelPickingPlugin.js +8 -28
- package/lib/plugins/RegisterStyleAttributePlugin.js +56 -5
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -9
- package/lib/point/index.js +6 -2
- package/lib/point/models/fill.js +2 -2
- package/lib/point/models/fillmage.js +1 -1
- package/lib/point/models/image.js +1 -1
- package/lib/point/models/normal.js +8 -59
- package/lib/point/models/radar.js +4 -69
- package/lib/point/models/simplePoint.js +1 -10
- package/lib/point/models/text.js +6 -7
- package/lib/point/models/tile.js +21 -156
- package/lib/point/models/tileText.js +97 -184
- package/lib/point/shaders/animate/wave_frag.glsl +3 -3
- package/lib/point/shaders/earth/fill_vert.glsl +0 -1
- package/lib/point/shaders/fill_vert.glsl +0 -1
- package/lib/point/shaders/normal_frag.glsl +1 -10
- package/lib/point/shaders/normal_vert.glsl +5 -60
- package/lib/point/shaders/radar/radar_frag.glsl +4 -15
- package/lib/point/shaders/radar/radar_vert.glsl +4 -54
- package/lib/point/shaders/tile/fill_tile_frag.glsl +10 -17
- package/lib/point/shaders/tile/fill_tile_vert.glsl +20 -123
- package/lib/point/shaders/tile/text_frag.glsl +33 -0
- package/lib/point/shaders/tile/text_map_frag.glsl +31 -0
- package/lib/point/shaders/tile/text_map_vert.glsl +38 -0
- package/lib/point/shaders/tile/text_vert.glsl +48 -0
- package/lib/polygon/index.js +6 -2
- package/lib/polygon/models/extrude.js +1 -3
- package/lib/polygon/models/fill.js +3 -4
- package/lib/polygon/models/ocean.js +14 -47
- package/lib/polygon/models/tile.js +24 -57
- package/lib/polygon/models/water.js +14 -47
- package/lib/polygon/shaders/polygon_frag.glsl +2 -2
- package/lib/polygon/shaders/polygon_vert.glsl +2 -2
- package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +16 -0
- package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +20 -60
- package/lib/polygon/shaders/water/polygon_ocean_frag.glsl +1 -2
- package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +0 -31
- package/lib/polygon/shaders/water/polygon_water_frag.glsl +1 -3
- package/lib/polygon/shaders/water/polygon_water_vert.glsl +0 -29
- package/lib/raster/buffers/triangulation.js +1 -4
- package/lib/raster/index.js +6 -2
- package/lib/raster/models/raster.js +3 -2
- package/lib/shader/minify_frag.glsl +7 -0
- package/lib/shader/minify_picking_frag.glsl +10 -0
- package/lib/tile/manager/baseMapTileLayerManager.js +222 -0
- package/lib/tile/manager/tileLayerManager.js +2 -2
- package/lib/tile/manager/tilePickerManager.js +1 -2
- package/lib/tile/models/tileModel.js +19 -2
- package/lib/tile/tileFactory/base.js +60 -33
- package/lib/tile/tileFactory/line.js +3 -0
- package/lib/tile/tileFactory/point.js +3 -0
- package/lib/tile/tileFactory/polygon.js +3 -0
- package/lib/tile/tileFactory/raster.js +3 -0
- package/lib/tile/tileFactory/rasterData.js +3 -0
- package/lib/tile/tileFactory/rasterDataLayer.js +6 -2
- package/lib/tile/tileFactory/test.js +26 -5
- package/lib/tile/tileFactory/vectorLayer.js +112 -8
- package/lib/tile/tileLayer/baseMapTileLayer.js +195 -0
- package/lib/tile/tileLayer/baseTileLayer.js +46 -75
- package/lib/tile/tileTest.js +3 -2
- package/lib/tile/tmsMapTileLayer.js +136 -0
- package/lib/tile/tmsTileLayer.js +25 -2
- package/lib/tile/utils.js +38 -0
- package/lib/utils/dataMappingStyle.js +3 -0
- package/lib/utils/layerData.js +2 -2
- package/lib/utils/updateShape.js +2 -2
- package/lib/wind/index.js +6 -2
- package/lib/wind/models/wind.js +7 -7
- package/lib/wind/shaders/wind_vert.glsl +1 -1
- package/package.json +8 -7
- package/es/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/es/line/shaders/wall_vert.glsl +0 -111
- package/es/mask/shaders/mask_frag.glsl +0 -7
- package/es/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
- package/lib/line/shaders/tile/line_tile_frag.glsl +0 -79
- package/lib/line/shaders/wall_vert.glsl +0 -111
- package/lib/mask/shaders/mask_frag.glsl +0 -7
- package/lib/polygon/shaders/tile/polygon_tile_frag.glsl +0 -12
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import { BaseMapTileLayerManager } from "../manager/baseMapTileLayerManager";
|
|
5
|
+
import { debounce } from 'lodash';
|
|
6
|
+
|
|
7
|
+
var BaseTileLayer = /*#__PURE__*/function () {
|
|
8
|
+
function BaseTileLayer(_ref) {
|
|
9
|
+
var _parentSource$data;
|
|
10
|
+
|
|
11
|
+
var parent = _ref.parent,
|
|
12
|
+
rendererService = _ref.rendererService,
|
|
13
|
+
mapService = _ref.mapService,
|
|
14
|
+
layerService = _ref.layerService;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, BaseTileLayer);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "type", 'baseTile');
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "initedTileset", false);
|
|
21
|
+
|
|
22
|
+
_defineProperty(this, "viewchange", debounce(this.mapchange, 200));
|
|
23
|
+
|
|
24
|
+
var parentSource = parent.getSource();
|
|
25
|
+
|
|
26
|
+
var _ref2 = (parentSource === null || parentSource === void 0 ? void 0 : (_parentSource$data = parentSource.data) === null || _parentSource$data === void 0 ? void 0 : _parentSource$data.tilesetOptions) || {},
|
|
27
|
+
sourceLayer = _ref2.sourceLayer;
|
|
28
|
+
|
|
29
|
+
this.sourceLayer = sourceLayer;
|
|
30
|
+
this.parent = parent;
|
|
31
|
+
this.mapService = mapService;
|
|
32
|
+
this.layerService = layerService;
|
|
33
|
+
this.tileLayerManager = new BaseMapTileLayerManager(parent, mapService, rendererService);
|
|
34
|
+
this.initTileSetManager();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 渲染瓦片的图层
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
_createClass(BaseTileLayer, [{
|
|
42
|
+
key: "children",
|
|
43
|
+
get: function get() {
|
|
44
|
+
return this.tileLayerManager.children;
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "render",
|
|
48
|
+
value: function render() {
|
|
49
|
+
if (this.tileLayerManager) {
|
|
50
|
+
this.tileLayerManager.render();
|
|
51
|
+
}
|
|
52
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
|
|
54
|
+
}, {
|
|
55
|
+
key: "tileLoaded",
|
|
56
|
+
value: function tileLoaded(tile) {//
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "tileError",
|
|
60
|
+
value: function tileError(error) {
|
|
61
|
+
console.warn('error:', error);
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "tileUnLoad",
|
|
65
|
+
value: function tileUnLoad(tile) {
|
|
66
|
+
this.tileLayerManager.removeChilds(tile.layerIDList, false);
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "tileUpdate",
|
|
70
|
+
value: function tileUpdate() {
|
|
71
|
+
// Base Function
|
|
72
|
+
if (!this.tilesetManager) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.tilesetManager.isLoaded) {
|
|
77
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
78
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "initTileSetManager",
|
|
83
|
+
value: function initTileSetManager() {
|
|
84
|
+
var _this$tilesetManager;
|
|
85
|
+
|
|
86
|
+
var source = this.parent.getSource();
|
|
87
|
+
this.tilesetManager = source.tileset;
|
|
88
|
+
|
|
89
|
+
if (!this.initedTileset) {
|
|
90
|
+
this.bindTilesetEvent();
|
|
91
|
+
this.initedTileset = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var _this$getCurrentView = this.getCurrentView(),
|
|
95
|
+
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
96
|
+
zoom = _this$getCurrentView.zoom;
|
|
97
|
+
|
|
98
|
+
(_this$tilesetManager = this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.update(zoom, latLonBounds);
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "mapchange",
|
|
102
|
+
value: function mapchange() {
|
|
103
|
+
var _this$tilesetManager2;
|
|
104
|
+
|
|
105
|
+
var _this$getCurrentView2 = this.getCurrentView(),
|
|
106
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
107
|
+
zoom = _this$getCurrentView2.zoom;
|
|
108
|
+
|
|
109
|
+
if (this.mapService.version === 'GAODE1.x') {
|
|
110
|
+
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
111
|
+
visible = _this$parent$getLayer.visible;
|
|
112
|
+
|
|
113
|
+
if (zoom < 3 && visible) {
|
|
114
|
+
this.parent.updateLayerConfig({
|
|
115
|
+
visible: false
|
|
116
|
+
});
|
|
117
|
+
this.layerService.reRender();
|
|
118
|
+
} else if (zoom >= 3 && !visible) {
|
|
119
|
+
this.parent.updateLayerConfig({
|
|
120
|
+
visible: true
|
|
121
|
+
});
|
|
122
|
+
this.layerService.reRender();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.lastViewStates = {
|
|
131
|
+
zoom: zoom,
|
|
132
|
+
latLonBounds: latLonBounds
|
|
133
|
+
};
|
|
134
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "bindTilesetEvent",
|
|
138
|
+
value: function bindTilesetEvent() {
|
|
139
|
+
var _this = this;
|
|
140
|
+
|
|
141
|
+
if (!this.tilesetManager) {
|
|
142
|
+
return;
|
|
143
|
+
} // 瓦片数据加载成功
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
148
|
+
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
149
|
+
|
|
150
|
+
this.tilesetManager.on('tile-unload', function (tile) {
|
|
151
|
+
// 将事件抛出,图层上可以监听使用
|
|
152
|
+
_this.tileUnLoad(tile);
|
|
153
|
+
}); // 瓦片数据加载失败
|
|
154
|
+
|
|
155
|
+
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
156
|
+
// 将事件抛出,图层上可以监听使用
|
|
157
|
+
_this.tileError(error);
|
|
158
|
+
}); // 瓦片显隐状态更新
|
|
159
|
+
|
|
160
|
+
this.tilesetManager.on('tile-update', function () {
|
|
161
|
+
_this.tileUpdate();
|
|
162
|
+
}); // 地图视野发生改变
|
|
163
|
+
|
|
164
|
+
this.mapService.on('zoomend', function () {
|
|
165
|
+
return _this.viewchange();
|
|
166
|
+
});
|
|
167
|
+
this.mapService.on('moveend', function () {
|
|
168
|
+
return _this.viewchange();
|
|
169
|
+
});
|
|
170
|
+
} // 防抖操作
|
|
171
|
+
|
|
172
|
+
}, {
|
|
173
|
+
key: "getCurrentView",
|
|
174
|
+
value: function getCurrentView() {
|
|
175
|
+
var bounds = this.mapService.getBounds();
|
|
176
|
+
var latLonBounds = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
|
|
177
|
+
var zoom = this.mapService.getZoom();
|
|
178
|
+
return {
|
|
179
|
+
latLonBounds: latLonBounds,
|
|
180
|
+
zoom: zoom
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}]);
|
|
184
|
+
|
|
185
|
+
return BaseTileLayer;
|
|
186
|
+
}();
|
|
187
|
+
|
|
188
|
+
export { BaseTileLayer as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IInteractionTarget, ILayer, ITileLayer, ITileLayerManager, ITileLayerOPtions } from '@antv/l7-core';
|
|
1
|
+
import { IInteractionTarget, ILayer, ILayerService, IMapService, ITileLayer, ITileLayerManager, ITileLayerOPtions } from '@antv/l7-core';
|
|
2
2
|
import { Tile, TilesetManager } from '@antv/l7-utils';
|
|
3
3
|
export default class BaseTileLayer implements ITileLayer {
|
|
4
4
|
get children(): ILayer[];
|
|
@@ -10,9 +10,8 @@ export default class BaseTileLayer implements ITileLayer {
|
|
|
10
10
|
tileLayerManager: ITileLayerManager;
|
|
11
11
|
scaleField: any;
|
|
12
12
|
private lastViewStates;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private layerService;
|
|
13
|
+
protected mapService: IMapService;
|
|
14
|
+
protected layerService: ILayerService;
|
|
16
15
|
private pickColors;
|
|
17
16
|
constructor({ parent, rendererService, mapService, layerService, pickingService, transforms }: ITileLayerOPtions);
|
|
18
17
|
/**
|
|
@@ -43,5 +42,6 @@ export default class BaseTileLayer implements ITileLayer {
|
|
|
43
42
|
private initTileSetManager;
|
|
44
43
|
private mapchange;
|
|
45
44
|
private bindTilesetEvent;
|
|
45
|
+
viewchange: import("lodash").DebouncedFunc<() => void>;
|
|
46
46
|
private getCurrentView;
|
|
47
47
|
}
|
|
@@ -5,6 +5,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import { decodePickingColor } from '@antv/l7-utils';
|
|
7
7
|
import { TileLayerManager } from "../manager/tileLayerManager";
|
|
8
|
+
import { debounce } from 'lodash';
|
|
8
9
|
|
|
9
10
|
var BaseTileLayer = /*#__PURE__*/function () {
|
|
10
11
|
function BaseTileLayer(_ref) {
|
|
@@ -28,18 +29,18 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
28
29
|
active: null
|
|
29
30
|
});
|
|
30
31
|
|
|
32
|
+
_defineProperty(this, "viewchange", debounce(this.mapchange, 200));
|
|
33
|
+
|
|
31
34
|
var parentSource = parent.getSource();
|
|
32
35
|
|
|
33
36
|
var _ref2 = (parentSource === null || parentSource === void 0 ? void 0 : (_parentSource$data = parentSource.data) === null || _parentSource$data === void 0 ? void 0 : _parentSource$data.tilesetOptions) || {},
|
|
34
|
-
sourceLayer = _ref2.sourceLayer
|
|
35
|
-
coords = _ref2.coords,
|
|
36
|
-
featureId = _ref2.featureId;
|
|
37
|
+
sourceLayer = _ref2.sourceLayer;
|
|
37
38
|
|
|
38
39
|
this.sourceLayer = sourceLayer;
|
|
39
40
|
this.parent = parent;
|
|
40
41
|
this.mapService = mapService;
|
|
41
42
|
this.layerService = layerService;
|
|
42
|
-
this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService,
|
|
43
|
+
this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, transforms);
|
|
43
44
|
this.initTileSetManager();
|
|
44
45
|
this.bindSubLayerEvent();
|
|
45
46
|
this.bindSubLayerPick();
|
|
@@ -116,35 +117,11 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
116
117
|
}, {
|
|
117
118
|
key: "tileUpdate",
|
|
118
119
|
value: function tileUpdate() {
|
|
119
|
-
var _this2 = this;
|
|
120
|
-
|
|
121
120
|
// Base Function
|
|
122
121
|
if (!this.tilesetManager) {
|
|
123
122
|
return;
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
this.tilesetManager.tiles.filter(function (tile) {
|
|
127
|
-
return tile.isLoaded;
|
|
128
|
-
}).map(function (tile) {
|
|
129
|
-
if (tile.layerIDList.length === 0) {
|
|
130
|
-
var _this2$tileLayerManag = _this2.tileLayerManager.createTile(tile),
|
|
131
|
-
layers = _this2$tileLayerManag.layers,
|
|
132
|
-
layerIDList = _this2$tileLayerManag.layerIDList;
|
|
133
|
-
|
|
134
|
-
tile.layerIDList = layerIDList;
|
|
135
|
-
|
|
136
|
-
_this2.tileLayerManager.addChilds(layers);
|
|
137
|
-
} else {
|
|
138
|
-
if (!tile.isVisibleChange) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
143
|
-
|
|
144
|
-
_this2.tileLayerManager.updateLayersConfig(_layers, 'visible', tile.isVisible);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
125
|
if (this.tilesetManager.isLoaded) {
|
|
149
126
|
// 将事件抛出,图层上可以使用瓦片
|
|
150
127
|
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
@@ -153,12 +130,12 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
153
130
|
}, {
|
|
154
131
|
key: "setPickState",
|
|
155
132
|
value: function setPickState(layers) {
|
|
156
|
-
var
|
|
133
|
+
var _this2 = this;
|
|
157
134
|
|
|
158
135
|
if (this.pickColors.select) {
|
|
159
136
|
var selectedId = decodePickingColor(this.pickColors.select);
|
|
160
137
|
layers.map(function (layer) {
|
|
161
|
-
|
|
138
|
+
_this2.selectFeature(layer, _this2.pickColors.select);
|
|
162
139
|
|
|
163
140
|
layer.setCurrentSelectedId(selectedId);
|
|
164
141
|
});
|
|
@@ -170,7 +147,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
170
147
|
layers.filter(function (layer) {
|
|
171
148
|
return layer.inited && layer.isVisible();
|
|
172
149
|
}).map(function (layer) {
|
|
173
|
-
layer.hooks.beforeHighlight.call(
|
|
150
|
+
layer.hooks.beforeHighlight.call(_this2.pickColors.active);
|
|
174
151
|
layer.setCurrentPickId(_selectedId);
|
|
175
152
|
});
|
|
176
153
|
}
|
|
@@ -178,7 +155,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
178
155
|
}, {
|
|
179
156
|
key: "bindSubLayerPick",
|
|
180
157
|
value: function bindSubLayerPick() {
|
|
181
|
-
var
|
|
158
|
+
var _this3 = this;
|
|
182
159
|
|
|
183
160
|
this.tileLayerManager.tilePickManager.on('pick', function (e) {
|
|
184
161
|
// @ts-ignore
|
|
@@ -188,19 +165,19 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
188
165
|
b = _e$pickedColors[2];
|
|
189
166
|
|
|
190
167
|
if (e.type === 'click') {
|
|
191
|
-
var restLayers =
|
|
168
|
+
var restLayers = _this3.children.filter(function (child) {
|
|
192
169
|
return child.inited && child.isVisible() && child.isVector;
|
|
193
170
|
}).filter(function (child) {
|
|
194
171
|
return child !== e.layer;
|
|
195
172
|
});
|
|
196
173
|
|
|
197
|
-
|
|
174
|
+
_this3.setSelect(restLayers, [r, g, b]);
|
|
198
175
|
} else {
|
|
199
|
-
|
|
176
|
+
_this3.setHighlight([r, g, b]);
|
|
200
177
|
}
|
|
201
178
|
});
|
|
202
179
|
this.tileLayerManager.tilePickManager.on('unpick', function () {
|
|
203
|
-
|
|
180
|
+
_this3.pickColors.active = null;
|
|
204
181
|
});
|
|
205
182
|
}
|
|
206
183
|
}, {
|
|
@@ -223,21 +200,21 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
223
200
|
}, {
|
|
224
201
|
key: "setSelect",
|
|
225
202
|
value: function setSelect(layers, pickedColors) {
|
|
226
|
-
var
|
|
203
|
+
var _this4 = this;
|
|
227
204
|
|
|
228
205
|
var selectedId = decodePickingColor(pickedColors);
|
|
229
206
|
layers.map(function (layer) {
|
|
230
207
|
if (layer.getCurrentSelectedId() === null || selectedId !== layer.getCurrentSelectedId()) {
|
|
231
|
-
|
|
208
|
+
_this4.selectFeature(layer, pickedColors);
|
|
232
209
|
|
|
233
210
|
layer.setCurrentSelectedId(selectedId);
|
|
234
|
-
|
|
211
|
+
_this4.pickColors.select = pickedColors;
|
|
235
212
|
} else {
|
|
236
|
-
|
|
213
|
+
_this4.selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
237
214
|
|
|
238
215
|
|
|
239
216
|
layer.setCurrentSelectedId(null);
|
|
240
|
-
|
|
217
|
+
_this4.pickColors.select = null;
|
|
241
218
|
}
|
|
242
219
|
}); // unselect normal layer
|
|
243
220
|
|
|
@@ -247,7 +224,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
247
224
|
}).filter(function (layer) {
|
|
248
225
|
return layer.getCurrentSelectedId() !== null;
|
|
249
226
|
}).map(function (layer) {
|
|
250
|
-
|
|
227
|
+
_this4.selectFeature(layer, new Uint8Array([0, 0, 0, 0]));
|
|
251
228
|
|
|
252
229
|
layer.setCurrentSelectedId(null);
|
|
253
230
|
});
|
|
@@ -266,7 +243,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
266
243
|
}, {
|
|
267
244
|
key: "bindSubLayerEvent",
|
|
268
245
|
value: function bindSubLayerEvent() {
|
|
269
|
-
var
|
|
246
|
+
var _this5 = this;
|
|
270
247
|
|
|
271
248
|
/**
|
|
272
249
|
* layer.on('click', (ev) => {}); // 鼠标左键点击图层事件
|
|
@@ -286,41 +263,41 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
286
263
|
* layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件
|
|
287
264
|
*/
|
|
288
265
|
this.parent.on('subLayerClick', function (e) {
|
|
289
|
-
|
|
266
|
+
_this5.parent.emit('click', _objectSpread({}, e));
|
|
290
267
|
});
|
|
291
268
|
this.parent.on('subLayerMouseMove', function (e) {
|
|
292
|
-
return
|
|
269
|
+
return _this5.parent.emit('mousemove', _objectSpread({}, e));
|
|
293
270
|
});
|
|
294
271
|
this.parent.on('subLayerMouseUp', function (e) {
|
|
295
|
-
return
|
|
272
|
+
return _this5.parent.emit('mouseup', _objectSpread({}, e));
|
|
296
273
|
});
|
|
297
274
|
this.parent.on('subLayerMouseEnter', function (e) {
|
|
298
|
-
return
|
|
275
|
+
return _this5.parent.emit('mouseenter', _objectSpread({}, e));
|
|
299
276
|
});
|
|
300
277
|
this.parent.on('subLayerMouseOut', function (e) {
|
|
301
|
-
return
|
|
278
|
+
return _this5.parent.emit('mouseout', _objectSpread({}, e));
|
|
302
279
|
});
|
|
303
280
|
this.parent.on('subLayerMouseDown', function (e) {
|
|
304
|
-
return
|
|
281
|
+
return _this5.parent.emit('mousedown', _objectSpread({}, e));
|
|
305
282
|
});
|
|
306
283
|
this.parent.on('subLayerContextmenu', function (e) {
|
|
307
|
-
return
|
|
284
|
+
return _this5.parent.emit('contextmenu', _objectSpread({}, e));
|
|
308
285
|
}); // vector layer 图层外事件
|
|
309
286
|
|
|
310
287
|
this.parent.on('subLayerUnClick', function (e) {
|
|
311
|
-
return
|
|
288
|
+
return _this5.parent.emit('unclick', _objectSpread({}, e));
|
|
312
289
|
});
|
|
313
290
|
this.parent.on('subLayerUnMouseMove', function (e) {
|
|
314
|
-
return
|
|
291
|
+
return _this5.parent.emit('unmousemove', _objectSpread({}, e));
|
|
315
292
|
});
|
|
316
293
|
this.parent.on('subLayerUnMouseUp', function (e) {
|
|
317
|
-
return
|
|
294
|
+
return _this5.parent.emit('unmouseup', _objectSpread({}, e));
|
|
318
295
|
});
|
|
319
296
|
this.parent.on('subLayerUnMouseDown', function (e) {
|
|
320
|
-
return
|
|
297
|
+
return _this5.parent.emit('unmousedown', _objectSpread({}, e));
|
|
321
298
|
});
|
|
322
299
|
this.parent.on('subLayerUnContextmenu', function (e) {
|
|
323
|
-
return
|
|
300
|
+
return _this5.parent.emit('uncontextmenu', _objectSpread({}, e));
|
|
324
301
|
});
|
|
325
302
|
}
|
|
326
303
|
}, {
|
|
@@ -359,12 +336,12 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
359
336
|
this.parent.updateLayerConfig({
|
|
360
337
|
visible: false
|
|
361
338
|
});
|
|
362
|
-
this.layerService.
|
|
339
|
+
this.layerService.reRender();
|
|
363
340
|
} else if (zoom >= 3 && !visible) {
|
|
364
341
|
this.parent.updateLayerConfig({
|
|
365
342
|
visible: true
|
|
366
343
|
});
|
|
367
|
-
this.layerService.
|
|
344
|
+
this.layerService.reRender();
|
|
368
345
|
}
|
|
369
346
|
}
|
|
370
347
|
|
|
@@ -376,49 +353,43 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
376
353
|
zoom: zoom,
|
|
377
354
|
latLonBounds: latLonBounds
|
|
378
355
|
};
|
|
379
|
-
|
|
380
|
-
if (this.timer) {
|
|
381
|
-
clearTimeout(this.timer);
|
|
382
|
-
this.timer = null;
|
|
383
|
-
} // this.timer = setTimeout(() => {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds); // }, 250);
|
|
356
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
387
357
|
}
|
|
388
358
|
}, {
|
|
389
359
|
key: "bindTilesetEvent",
|
|
390
360
|
value: function bindTilesetEvent() {
|
|
391
|
-
var
|
|
361
|
+
var _this6 = this;
|
|
392
362
|
|
|
393
363
|
if (!this.tilesetManager) {
|
|
394
364
|
return;
|
|
395
365
|
} // 瓦片数据加载成功
|
|
396
366
|
|
|
397
367
|
|
|
398
|
-
this.tilesetManager.on('tile-loaded', function (tile) {//
|
|
368
|
+
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
399
369
|
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
400
370
|
|
|
401
371
|
this.tilesetManager.on('tile-unload', function (tile) {
|
|
402
|
-
//
|
|
403
|
-
|
|
372
|
+
// 将事件抛出,图层上可以监听使用
|
|
373
|
+
_this6.tileUnLoad(tile);
|
|
404
374
|
}); // 瓦片数据加载失败
|
|
405
375
|
|
|
406
376
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
407
|
-
//
|
|
408
|
-
|
|
377
|
+
// 将事件抛出,图层上可以监听使用
|
|
378
|
+
_this6.tileError(error);
|
|
409
379
|
}); // 瓦片显隐状态更新
|
|
410
380
|
|
|
411
381
|
this.tilesetManager.on('tile-update', function () {
|
|
412
|
-
|
|
382
|
+
_this6.tileUpdate();
|
|
413
383
|
}); // 地图视野发生改变
|
|
414
384
|
|
|
415
385
|
this.mapService.on('zoomend', function () {
|
|
416
|
-
return
|
|
386
|
+
return _this6.viewchange();
|
|
417
387
|
});
|
|
418
388
|
this.mapService.on('moveend', function () {
|
|
419
|
-
return
|
|
389
|
+
return _this6.viewchange();
|
|
420
390
|
});
|
|
421
|
-
}
|
|
391
|
+
} // 防抖操作
|
|
392
|
+
|
|
422
393
|
}, {
|
|
423
394
|
key: "getCurrentView",
|
|
424
395
|
value: function getCurrentView() {
|
package/es/tile/tileTest.d.ts
CHANGED
package/es/tile/tileTest.js
CHANGED
|
@@ -35,7 +35,8 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
35
35
|
data: [],
|
|
36
36
|
options: {
|
|
37
37
|
parser: {
|
|
38
|
-
type: 'testTile'
|
|
38
|
+
type: 'testTile',
|
|
39
|
+
cancelExtent: true
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
});
|
|
@@ -52,7 +53,7 @@ var TileDebugLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
52
53
|
this.layerModel.initModels(function (models) {
|
|
53
54
|
_this2.models = models;
|
|
54
55
|
|
|
55
|
-
_this2.
|
|
56
|
+
_this2.emit('modelLoaded', null);
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
}]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tile } from '@antv/l7-utils';
|
|
2
|
+
import BaseTileLayer from './tileLayer/baseMapTileLayer';
|
|
3
|
+
export declare class TMSBaseMapTileLayer extends BaseTileLayer {
|
|
4
|
+
type: string;
|
|
5
|
+
tileUnLoad(tile: Tile): void;
|
|
6
|
+
tileUpdate(): void;
|
|
7
|
+
private emitTileVisibleEvent;
|
|
8
|
+
private updateTileVisible;
|
|
9
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
|
|
10
|
+
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); }; }
|
|
11
|
+
|
|
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
|
+
|
|
14
|
+
import BaseTileLayer from "./tileLayer/baseMapTileLayer";
|
|
15
|
+
import { tileAllLoad } from "./utils";
|
|
16
|
+
export var TMSBaseMapTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
17
|
+
_inherits(TMSBaseMapTileLayer, _BaseTileLayer);
|
|
18
|
+
|
|
19
|
+
var _super = _createSuper(TMSBaseMapTileLayer);
|
|
20
|
+
|
|
21
|
+
function TMSBaseMapTileLayer() {
|
|
22
|
+
var _this;
|
|
23
|
+
|
|
24
|
+
_classCallCheck(this, TMSBaseMapTileLayer);
|
|
25
|
+
|
|
26
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
+
args[_key] = arguments[_key];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
+
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "type", 'BaseMapTMS');
|
|
33
|
+
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_createClass(TMSBaseMapTileLayer, [{
|
|
38
|
+
key: "tileUnLoad",
|
|
39
|
+
value: function tileUnLoad(tile) {
|
|
40
|
+
this.tileLayerManager.removeChilds(tile.layerIDList, false);
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "tileUpdate",
|
|
44
|
+
value: function tileUpdate() {
|
|
45
|
+
var _this2 = this;
|
|
46
|
+
|
|
47
|
+
if (!this.tilesetManager) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.tilesetManager.tiles.filter(function (tile) {
|
|
52
|
+
return tile.isLoaded;
|
|
53
|
+
}).map(function (tile) {
|
|
54
|
+
var _tile$data;
|
|
55
|
+
|
|
56
|
+
if ((_tile$data = tile.data) !== null && _tile$data !== void 0 && _tile$data.layers && _this2.sourceLayer) {
|
|
57
|
+
// vector
|
|
58
|
+
var vectorTileLayer = tile.data.layers[_this2.sourceLayer];
|
|
59
|
+
var features = vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.features;
|
|
60
|
+
|
|
61
|
+
if (!(Array.isArray(features) && features.length > 0)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!tile.parentLayerIDList.includes(_this2.parent.id)) {
|
|
67
|
+
var _tile$layerIDList;
|
|
68
|
+
|
|
69
|
+
var _this2$tileLayerManag = _this2.tileLayerManager.createTile(tile),
|
|
70
|
+
layers = _this2$tileLayerManag.layers,
|
|
71
|
+
layerIDList = _this2$tileLayerManag.layerIDList;
|
|
72
|
+
|
|
73
|
+
tile.parentLayerIDList.push(_this2.parent.id);
|
|
74
|
+
|
|
75
|
+
(_tile$layerIDList = tile.layerIDList).push.apply(_tile$layerIDList, _toConsumableArray(layerIDList));
|
|
76
|
+
|
|
77
|
+
_this2.tileLayerManager.addChilds(layers);
|
|
78
|
+
} else {
|
|
79
|
+
if (!tile.isVisibleChange) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
84
|
+
|
|
85
|
+
_this2.updateTileVisible(tile, _layers);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (this.tilesetManager.isLoaded) {
|
|
90
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
91
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
92
|
+
}
|
|
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
|
+
}]);
|
|
117
|
+
|
|
118
|
+
return TMSBaseMapTileLayer;
|
|
119
|
+
}(BaseTileLayer);
|