@antv/l7-layers 2.9.36 → 2.9.37
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 +0 -9
- package/es/Geometry/index.js +0 -13
- package/es/Geometry/models/billboard.d.ts +0 -9
- package/es/Geometry/models/billboard.js +0 -13
- package/es/Geometry/models/plane.d.ts +0 -9
- package/es/Geometry/models/plane.js +0 -13
- package/es/Geometry/models/sprite.d.ts +0 -9
- package/es/Geometry/models/sprite.js +0 -13
- package/es/canvas/index.d.ts +0 -9
- package/es/canvas/index.js +0 -13
- package/es/citybuliding/building.d.ts +0 -9
- package/es/citybuliding/building.js +0 -13
- package/es/core/BaseLayer.d.ts +2 -2
- package/es/core/BaseLayer.js +20 -13
- package/es/core/BaseModel.js +1 -0
- package/es/core/triangulation.d.ts +2 -0
- package/es/core/triangulation.js +2 -3
- package/es/heatmap/index.d.ts +0 -9
- package/es/heatmap/index.js +0 -13
- package/es/heatmap/models/heatmap.js +1 -3
- package/es/image/index.d.ts +0 -9
- package/es/image/index.js +0 -13
- package/es/image/models/dataImage.d.ts +0 -9
- package/es/image/models/dataImage.js +1 -15
- package/es/image/models/image.d.ts +0 -9
- package/es/image/models/image.js +1 -15
- package/es/image/models/tileDataImage.d.ts +0 -9
- package/es/image/models/tileDataImage.js +1 -15
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/line/index.d.ts +0 -9
- package/es/line/index.js +0 -13
- package/es/line/models/great_circle.js +3 -3
- package/es/mask/index.d.ts +0 -9
- package/es/mask/index.js +0 -13
- package/es/plugins/DataMappingPlugin.js +2 -2
- package/es/plugins/DataSourcePlugin.js +1 -1
- package/es/plugins/FeatureScalePlugin.js +5 -3
- package/es/plugins/LayerModelPlugin.js +1 -1
- package/es/plugins/LightingPlugin.js +1 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +8 -13
- package/es/plugins/UpdateStyleAttributePlugin.js +1 -1
- package/es/point/index.d.ts +0 -9
- package/es/point/index.js +0 -13
- package/es/point/models/earthFill.js +2 -2
- package/es/point/models/image.js +1 -1
- package/es/polygon/index.d.ts +0 -9
- package/es/polygon/index.js +0 -13
- package/es/polygon/models/ocean.js +1 -2
- package/es/polygon/models/water.js +1 -2
- package/es/raster/index.d.ts +0 -9
- package/es/raster/index.js +0 -13
- package/es/raster/models/raster.js +1 -2
- package/es/raster/models/rasterRgb.js +1 -2
- package/es/raster/models/rasterTile.js +1 -2
- package/es/raster/raster.d.ts +0 -9
- package/es/raster/raster.js +0 -13
- package/es/tile/interaction/TilePickService.d.ts +16 -0
- package/es/tile/{manager/tilePickerManager.js → interaction/TilePickService.js} +19 -84
- package/es/tile/interaction/getFeatureData.d.ts +0 -0
- package/es/tile/interaction/getFeatureData.js +0 -0
- package/es/tile/interaction/getRasterData.d.ts +4 -0
- package/es/tile/interaction/getRasterData.js +70 -0
- package/es/tile/interaction/utils.d.ts +11 -0
- package/es/tile/interaction/utils.js +97 -0
- package/es/tile/interface.d.ts +1 -2
- package/es/tile/manager/{baseTileManager.d.ts → base.d.ts} +8 -5
- package/es/tile/manager/{baseTileManager.js → base.js} +53 -14
- package/es/tile/manager/layerManager.d.ts +19 -0
- package/es/tile/manager/{tileLayerManager.js → layerManager.js} +75 -76
- package/es/tile/manager/{baseMapTileLayerManager.d.ts → mapLayerManager.d.ts} +2 -2
- package/es/tile/manager/{baseMapTileLayerManager.js → mapLayerManager.js} +4 -4
- package/es/tile/models/tileModel.js +4 -4
- package/es/tile/render/TileRenderService.d.ts +10 -0
- package/es/tile/render/TileRenderService.js +68 -0
- package/es/tile/{manager/tileConfigManager.d.ts → style/TileStyleService.d.ts} +2 -2
- package/es/tile/{manager/tileConfigManager.js → style/TileStyleService.js} +8 -11
- package/es/tile/style/constants.d.ts +13 -0
- package/es/tile/style/constants.js +17 -0
- package/es/tile/style/utils.d.ts +9 -0
- package/es/tile/style/utils.js +139 -0
- package/es/tile/tileFactory/base.d.ts +8 -7
- package/es/tile/tileFactory/base.js +116 -187
- package/es/tile/tileFactory/layers/rasterDataLayer.d.ts +11 -0
- package/es/tile/tileFactory/{rasterDataLayer.js → layers/rasterDataLayer.js} +3 -16
- package/es/tile/{tileTest.d.ts → tileFactory/layers/tileTest.d.ts} +2 -2
- package/es/tile/{tileTest.js → tileFactory/layers/tileTest.js} +2 -2
- package/es/tile/tileFactory/{vectorLayer.d.ts → layers/vectorLayer.d.ts} +9 -17
- package/es/tile/tileFactory/{vectorLayer.js → layers/vectorLayer.js} +9 -20
- package/es/tile/tileFactory/line.js +0 -3
- package/es/tile/tileFactory/mask.js +0 -3
- package/es/tile/tileFactory/point.js +0 -3
- package/es/tile/tileFactory/polygon.js +0 -3
- package/es/tile/tileFactory/raster.js +0 -3
- package/es/tile/tileFactory/rasterData.js +2 -7
- package/es/tile/tileFactory/test.js +1 -12
- package/es/tile/tileLayer/MapTileLayer.d.ts +6 -0
- package/es/tile/tileLayer/MapTileLayer.js +48 -0
- package/es/tile/tileLayer/TileLayer.d.ts +22 -0
- package/es/tile/tileLayer/TileLayer.js +198 -0
- package/es/tile/tileLayer/{baseMapTileLayer.d.ts → base.d.ts} +19 -16
- package/es/tile/tileLayer/{baseMapTileLayer.js → base.js} +118 -101
- package/es/tile/utils.d.ts +7 -4
- package/es/tile/utils.js +14 -74
- package/es/utils/dataMappingStyle.js +0 -3
- package/es/utils/extrude_polyline.d.ts +1 -0
- package/es/utils/extrude_polyline.js +5 -3
- package/es/utils/multiPassRender.js +0 -1
- package/es/wind/index.d.ts +0 -9
- package/es/wind/index.js +0 -13
- package/es/wind/models/wind.d.ts +0 -9
- package/es/wind/models/wind.js +1 -15
- package/lib/Geometry/index.js +0 -13
- package/lib/Geometry/models/billboard.js +0 -13
- package/lib/Geometry/models/plane.js +0 -13
- package/lib/Geometry/models/sprite.js +0 -13
- package/lib/canvas/index.js +0 -13
- package/lib/citybuliding/building.js +0 -13
- package/lib/core/BaseLayer.js +20 -13
- package/lib/core/BaseModel.js +1 -0
- package/lib/core/triangulation.js +2 -1
- package/lib/heatmap/index.js +0 -13
- package/lib/heatmap/models/heatmap.js +1 -3
- package/lib/image/index.js +0 -13
- package/lib/image/models/dataImage.js +1 -15
- package/lib/image/models/image.js +1 -15
- package/lib/image/models/tileDataImage.js +1 -15
- package/lib/index.js +1 -1
- package/lib/line/index.js +0 -13
- package/lib/line/models/great_circle.js +3 -3
- package/lib/mask/index.js +0 -13
- package/lib/plugins/DataMappingPlugin.js +2 -2
- package/lib/plugins/DataSourcePlugin.js +1 -1
- package/lib/plugins/FeatureScalePlugin.js +5 -3
- package/lib/plugins/LayerModelPlugin.js +1 -1
- package/lib/plugins/LightingPlugin.js +1 -1
- package/lib/plugins/RegisterStyleAttributePlugin.js +9 -13
- package/lib/plugins/UpdateStyleAttributePlugin.js +1 -1
- package/lib/point/index.js +0 -13
- package/lib/point/models/earthFill.js +2 -2
- package/lib/point/models/image.js +1 -1
- package/lib/polygon/index.js +0 -13
- package/lib/polygon/models/ocean.js +1 -2
- package/lib/polygon/models/water.js +1 -2
- package/lib/raster/index.js +0 -13
- package/lib/raster/models/raster.js +1 -2
- package/lib/raster/models/rasterRgb.js +1 -2
- package/lib/raster/models/rasterTile.js +1 -2
- package/lib/raster/raster.js +0 -13
- package/lib/tile/{manager/tilePickerManager.js → interaction/TilePickService.js} +20 -82
- package/lib/tile/interaction/getFeatureData.js +1 -0
- package/lib/tile/interaction/getRasterData.js +83 -0
- package/lib/tile/interaction/utils.js +120 -0
- package/lib/tile/manager/{baseTileManager.js → base.js} +56 -16
- package/lib/tile/manager/{tileLayerManager.js → layerManager.js} +77 -75
- package/lib/tile/manager/{baseMapTileLayerManager.js → mapLayerManager.js} +4 -4
- package/lib/tile/models/tileModel.js +4 -4
- package/lib/tile/render/TileRenderService.js +78 -0
- package/lib/tile/{manager/tileConfigManager.js → style/TileStyleService.js} +9 -9
- package/lib/tile/style/constants.js +26 -0
- package/lib/tile/style/utils.js +163 -0
- package/lib/tile/tileFactory/base.js +117 -187
- package/lib/tile/tileFactory/{rasterDataLayer.js → layers/rasterDataLayer.js} +3 -16
- package/lib/tile/{tileTest.js → tileFactory/layers/tileTest.js} +2 -2
- package/lib/tile/tileFactory/{vectorLayer.js → layers/vectorLayer.js} +8 -20
- package/lib/tile/tileFactory/line.js +0 -3
- package/lib/tile/tileFactory/mask.js +0 -3
- package/lib/tile/tileFactory/point.js +0 -3
- package/lib/tile/tileFactory/polygon.js +0 -3
- package/lib/tile/tileFactory/raster.js +0 -3
- package/lib/tile/tileFactory/rasterData.js +2 -8
- package/lib/tile/tileFactory/test.js +1 -13
- package/lib/tile/tileLayer/MapTileLayer.js +63 -0
- package/lib/tile/tileLayer/TileLayer.js +215 -0
- package/lib/tile/tileLayer/{baseMapTileLayer.js → base.js} +119 -96
- package/lib/tile/utils.js +19 -86
- package/lib/utils/dataMappingStyle.js +0 -3
- package/lib/utils/extrude_polyline.js +5 -2
- package/lib/utils/multiPassRender.js +0 -1
- package/lib/wind/index.js +0 -13
- package/lib/wind/models/wind.js +1 -15
- package/package.json +6 -6
- package/es/tile/manager/tileLayerManager.d.ts +0 -15
- package/es/tile/manager/tilePickerManager.d.ts +0 -21
- package/es/tile/tileFactory/rasterDataLayer.d.ts +0 -20
- package/es/tile/tileLayer/baseTileLayer.d.ts +0 -48
- package/es/tile/tileLayer/baseTileLayer.js +0 -420
- package/es/tile/tmsMapTileLayer.d.ts +0 -7
- package/es/tile/tmsMapTileLayer.js +0 -97
- package/es/tile/tmsTileLayer.d.ts +0 -7
- package/es/tile/tmsTileLayer.js +0 -101
- package/lib/tile/tileLayer/baseTileLayer.js +0 -429
- package/lib/tile/tmsMapTileLayer.js +0 -114
- package/lib/tile/tmsTileLayer.js +0 -118
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IBaseTileLayer, ITileLayerOPtions, IBaseTileLayerManager } from '@antv/l7-core';
|
|
2
|
+
import { Base } from './base';
|
|
3
|
+
export declare class MapTileLayer extends Base implements IBaseTileLayer {
|
|
4
|
+
tileLayerManager: IBaseTileLayerManager;
|
|
5
|
+
constructor({ parent, rendererService, mapService, layerService, }: ITileLayerOPtions);
|
|
6
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
11
|
+
import { BaseMapTileLayerManager } from "../manager/mapLayerManager";
|
|
12
|
+
import { Base } from "./base";
|
|
13
|
+
export var MapTileLayer = /*#__PURE__*/function (_Base) {
|
|
14
|
+
_inherits(MapTileLayer, _Base);
|
|
15
|
+
|
|
16
|
+
var _super = _createSuper(MapTileLayer);
|
|
17
|
+
|
|
18
|
+
function MapTileLayer(_ref) {
|
|
19
|
+
var _parentSource$data;
|
|
20
|
+
|
|
21
|
+
var _this;
|
|
22
|
+
|
|
23
|
+
var parent = _ref.parent,
|
|
24
|
+
rendererService = _ref.rendererService,
|
|
25
|
+
mapService = _ref.mapService,
|
|
26
|
+
layerService = _ref.layerService;
|
|
27
|
+
|
|
28
|
+
_classCallCheck(this, MapTileLayer);
|
|
29
|
+
|
|
30
|
+
_this = _super.call(this);
|
|
31
|
+
var parentSource = parent.getSource();
|
|
32
|
+
|
|
33
|
+
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
|
+
|
|
36
|
+
_this.sourceLayer = sourceLayer;
|
|
37
|
+
_this.parent = parent;
|
|
38
|
+
_this.mapService = mapService;
|
|
39
|
+
_this.layerService = layerService;
|
|
40
|
+
_this.tileLayerManager = new BaseMapTileLayerManager(parent, mapService, rendererService);
|
|
41
|
+
|
|
42
|
+
_this.initTileSetManager();
|
|
43
|
+
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return _createClass(MapTileLayer);
|
|
48
|
+
}(Base);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IInteractionTarget, ILayer, ITileLayer, ITileLayerManager, ITileLayerOPtions } from '@antv/l7-core';
|
|
2
|
+
import { Base } from './base';
|
|
3
|
+
export declare class TileLayer extends Base implements ITileLayer {
|
|
4
|
+
get children(): ILayer[];
|
|
5
|
+
tileLayerManager: ITileLayerManager;
|
|
6
|
+
private pickColors;
|
|
7
|
+
constructor({ parent, rendererService, mapService, layerService, pickingService, transforms }: ITileLayerOPtions);
|
|
8
|
+
clearPick(type: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* 清除 select 的选中状态
|
|
11
|
+
*/
|
|
12
|
+
clearPickState(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 瓦片图层独立的拾取逻辑
|
|
15
|
+
* @param target
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
pickLayers(target: IInteractionTarget): boolean;
|
|
19
|
+
setPickState(layers: ILayer[]): void;
|
|
20
|
+
private bindSubLayerPick;
|
|
21
|
+
protected bindSubLayerEvent(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
+
|
|
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
|
+
|
|
15
|
+
import { TileLayerManager } from "../manager/layerManager";
|
|
16
|
+
import { Base } from "./base";
|
|
17
|
+
import { setSelect, setHighlight, setPickState as _setPickState, clearPickState as _clearPickState } from "../interaction/utils";
|
|
18
|
+
export var TileLayer = /*#__PURE__*/function (_Base) {
|
|
19
|
+
_inherits(TileLayer, _Base);
|
|
20
|
+
|
|
21
|
+
var _super = _createSuper(TileLayer);
|
|
22
|
+
|
|
23
|
+
function TileLayer(_ref) {
|
|
24
|
+
var _parentSource$data;
|
|
25
|
+
|
|
26
|
+
var _this;
|
|
27
|
+
|
|
28
|
+
var parent = _ref.parent,
|
|
29
|
+
rendererService = _ref.rendererService,
|
|
30
|
+
mapService = _ref.mapService,
|
|
31
|
+
layerService = _ref.layerService,
|
|
32
|
+
pickingService = _ref.pickingService,
|
|
33
|
+
transforms = _ref.transforms;
|
|
34
|
+
|
|
35
|
+
_classCallCheck(this, TileLayer);
|
|
36
|
+
|
|
37
|
+
_this = _super.call(this);
|
|
38
|
+
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "pickColors", {
|
|
40
|
+
select: null,
|
|
41
|
+
active: null
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var parentSource = parent.getSource();
|
|
45
|
+
|
|
46
|
+
var _ref2 = (parentSource === null || parentSource === void 0 ? void 0 : (_parentSource$data = parentSource.data) === null || _parentSource$data === void 0 ? void 0 : _parentSource$data.tilesetOptions) || {},
|
|
47
|
+
sourceLayer = _ref2.sourceLayer;
|
|
48
|
+
|
|
49
|
+
_this.sourceLayer = sourceLayer;
|
|
50
|
+
_this.parent = parent;
|
|
51
|
+
_this.mapService = mapService;
|
|
52
|
+
_this.layerService = layerService;
|
|
53
|
+
_this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, transforms);
|
|
54
|
+
|
|
55
|
+
_this.initTileSetManager();
|
|
56
|
+
|
|
57
|
+
_this.bindSubLayerEvent();
|
|
58
|
+
|
|
59
|
+
_this.bindSubLayerPick();
|
|
60
|
+
|
|
61
|
+
_this.scaleField = _this.parent.getScaleOptions();
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createClass(TileLayer, [{
|
|
66
|
+
key: "children",
|
|
67
|
+
get: function get() {
|
|
68
|
+
return this.tileLayerManager.children;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "clearPick",
|
|
72
|
+
value: function clearPick(type) {
|
|
73
|
+
// Tip: 瓦片只有在 mousemove 的时候需要设置清除
|
|
74
|
+
if (type === 'mousemove') {
|
|
75
|
+
this.tileLayerManager.tilePickService.clearPick();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 清除 select 的选中状态
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
}, {
|
|
83
|
+
key: "clearPickState",
|
|
84
|
+
value: function clearPickState() {
|
|
85
|
+
_clearPickState(this.children);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 瓦片图层独立的拾取逻辑
|
|
89
|
+
* @param target
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
}, {
|
|
94
|
+
key: "pickLayers",
|
|
95
|
+
value: function pickLayers(target) {
|
|
96
|
+
return this.tileLayerManager.pickLayers(target);
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "setPickState",
|
|
100
|
+
value: function setPickState(layers) {
|
|
101
|
+
_setPickState(layers, this.pickColors);
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "bindSubLayerPick",
|
|
105
|
+
value: function bindSubLayerPick() {
|
|
106
|
+
var _this2 = this;
|
|
107
|
+
|
|
108
|
+
this.tileLayerManager.tilePickService.on('pick', function (e) {
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
var _e$pickedColors = _slicedToArray(e.pickedColors, 3),
|
|
111
|
+
r = _e$pickedColors[0],
|
|
112
|
+
g = _e$pickedColors[1],
|
|
113
|
+
b = _e$pickedColors[2];
|
|
114
|
+
|
|
115
|
+
if (e.type === 'click') {
|
|
116
|
+
var restLayers = _this2.children.filter(function (child) {
|
|
117
|
+
return child.inited && child.isVisible() && child.isVector;
|
|
118
|
+
}).filter(function (child) {
|
|
119
|
+
return child !== e.layer;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
var renderList = _this2.layerService.getRenderList();
|
|
123
|
+
|
|
124
|
+
var color = setSelect(restLayers, [r, g, b], renderList);
|
|
125
|
+
_this2.pickColors.select = color;
|
|
126
|
+
} else {
|
|
127
|
+
setHighlight(_this2.children, [r, g, b]);
|
|
128
|
+
_this2.pickColors.active = [r, g, b];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
this.tileLayerManager.tilePickService.on('unpick', function () {
|
|
132
|
+
_this2.pickColors.active = null;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: "bindSubLayerEvent",
|
|
137
|
+
value: function bindSubLayerEvent() {
|
|
138
|
+
var _this3 = this;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* layer.on('click', (ev) => {}); // 鼠标左键点击图层事件
|
|
142
|
+
* layer.on('mouseenter', (ev) => {}); // 鼠标进入图层要素
|
|
143
|
+
* layer.on('mousemove', (ev) => {}); // 鼠标在图层上移动时触发
|
|
144
|
+
* layer.on('mouseout', (ev) => {}); // 鼠标移出图层要素时触发
|
|
145
|
+
* layer.on('mouseup', (ev) => {}); // 鼠标在图层上单击抬起时触发
|
|
146
|
+
* layer.on('mousedown', (ev) => {}); // 鼠标在图层上单击按下时触发
|
|
147
|
+
* layer.on('contextmenu', (ev) => {}); // 图层要素点击右键菜单
|
|
148
|
+
*
|
|
149
|
+
* 鼠标在图层外的事件
|
|
150
|
+
* layer.on('unclick', (ev) => {}); // 图层外点击
|
|
151
|
+
* layer.on('unmousemove', (ev) => {}); // 图层外移动
|
|
152
|
+
* layer.on('unmouseup', (ev) => {}); // 图层外鼠标抬起
|
|
153
|
+
* layer.on('unmousedown', (ev) => {}); // 图层外单击按下时触发
|
|
154
|
+
* layer.on('uncontextmenu', (ev) => {}); // 图层外点击右键
|
|
155
|
+
* layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件
|
|
156
|
+
*/
|
|
157
|
+
this.parent.on('subLayerClick', function (e) {
|
|
158
|
+
_this3.parent.emit('click', _objectSpread({}, e));
|
|
159
|
+
});
|
|
160
|
+
this.parent.on('subLayerMouseMove', function (e) {
|
|
161
|
+
return _this3.parent.emit('mousemove', _objectSpread({}, e));
|
|
162
|
+
});
|
|
163
|
+
this.parent.on('subLayerMouseUp', function (e) {
|
|
164
|
+
return _this3.parent.emit('mouseup', _objectSpread({}, e));
|
|
165
|
+
});
|
|
166
|
+
this.parent.on('subLayerMouseEnter', function (e) {
|
|
167
|
+
return _this3.parent.emit('mouseenter', _objectSpread({}, e));
|
|
168
|
+
});
|
|
169
|
+
this.parent.on('subLayerMouseOut', function (e) {
|
|
170
|
+
return _this3.parent.emit('mouseout', _objectSpread({}, e));
|
|
171
|
+
});
|
|
172
|
+
this.parent.on('subLayerMouseDown', function (e) {
|
|
173
|
+
return _this3.parent.emit('mousedown', _objectSpread({}, e));
|
|
174
|
+
});
|
|
175
|
+
this.parent.on('subLayerContextmenu', function (e) {
|
|
176
|
+
return _this3.parent.emit('contextmenu', _objectSpread({}, e));
|
|
177
|
+
}); // vector layer 图层外事件
|
|
178
|
+
|
|
179
|
+
this.parent.on('subLayerUnClick', function (e) {
|
|
180
|
+
return _this3.parent.emit('unclick', _objectSpread({}, e));
|
|
181
|
+
});
|
|
182
|
+
this.parent.on('subLayerUnMouseMove', function (e) {
|
|
183
|
+
return _this3.parent.emit('unmousemove', _objectSpread({}, e));
|
|
184
|
+
});
|
|
185
|
+
this.parent.on('subLayerUnMouseUp', function (e) {
|
|
186
|
+
return _this3.parent.emit('unmouseup', _objectSpread({}, e));
|
|
187
|
+
});
|
|
188
|
+
this.parent.on('subLayerUnMouseDown', function (e) {
|
|
189
|
+
return _this3.parent.emit('unmousedown', _objectSpread({}, e));
|
|
190
|
+
});
|
|
191
|
+
this.parent.on('subLayerUnContextmenu', function (e) {
|
|
192
|
+
return _this3.parent.emit('uncontextmenu', _objectSpread({}, e));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}]);
|
|
196
|
+
|
|
197
|
+
return TileLayer;
|
|
198
|
+
}(Base);
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { ILayer,
|
|
1
|
+
import { ILayer, IMapService, ILayerService } from '@antv/l7-core';
|
|
2
2
|
import { Tile, TilesetManager } from '@antv/l7-utils';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export declare class Base {
|
|
4
|
+
tileLayerManager: any;
|
|
5
|
+
get children(): any;
|
|
6
6
|
sourceLayer: string;
|
|
7
7
|
parent: ILayer;
|
|
8
8
|
initedTileset: boolean;
|
|
9
9
|
tilesetManager: TilesetManager | undefined;
|
|
10
|
-
tileLayerManager: IBaseTileLayerManager;
|
|
11
10
|
scaleField: any;
|
|
12
|
-
private lastViewStates;
|
|
13
11
|
protected mapService: IMapService;
|
|
14
12
|
protected layerService: ILayerService;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
protected lastViewStates: {
|
|
14
|
+
zoom: number;
|
|
15
|
+
latLonBounds: [number, number, number, number];
|
|
16
|
+
};
|
|
17
|
+
protected mapchange(): void;
|
|
18
|
+
protected getCurrentView(): {
|
|
19
|
+
latLonBounds: [number, number, number, number];
|
|
20
|
+
zoom: number;
|
|
21
|
+
};
|
|
22
|
+
protected initTileSetManager(): void;
|
|
23
|
+
private bindTilesetEvent;
|
|
19
24
|
render(): void;
|
|
25
|
+
viewchange: import("lodash").DebouncedFunc<() => void>;
|
|
20
26
|
tileLoaded(tile: Tile): void;
|
|
21
27
|
tileError(error: Error): void;
|
|
28
|
+
destroy(): void;
|
|
22
29
|
tileUnLoad(tile: Tile): void;
|
|
23
30
|
tileUpdate(): void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
private bindTilesetEvent;
|
|
27
|
-
viewchange: import("lodash").DebouncedFunc<() => void>;
|
|
28
|
-
private getCurrentView;
|
|
29
|
-
destroy(): void;
|
|
31
|
+
isTileReady(tile: Tile): boolean;
|
|
32
|
+
setPickState(layers: ILayer[]): void;
|
|
30
33
|
}
|
|
@@ -1,111 +1,31 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import { BaseMapTileLayerManager } from "../manager/baseMapTileLayerManager";
|
|
5
4
|
import { debounce } from 'lodash';
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
|
|
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');
|
|
5
|
+
import { updateTileVisible } from "../utils";
|
|
6
|
+
export var Base = /*#__PURE__*/function () {
|
|
7
|
+
function Base() {
|
|
8
|
+
_classCallCheck(this, Base);
|
|
19
9
|
|
|
20
10
|
_defineProperty(this, "initedTileset", false);
|
|
21
11
|
|
|
22
12
|
_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
13
|
}
|
|
36
|
-
/**
|
|
37
|
-
* 渲染瓦片的图层
|
|
38
|
-
*/
|
|
39
14
|
|
|
40
|
-
|
|
41
|
-
_createClass(BaseTileLayer, [{
|
|
15
|
+
_createClass(Base, [{
|
|
42
16
|
key: "children",
|
|
43
17
|
get: function get() {
|
|
44
18
|
return this.tileLayerManager.children;
|
|
45
19
|
}
|
|
46
20
|
}, {
|
|
47
|
-
key: "
|
|
48
|
-
value: function
|
|
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() {
|
|
21
|
+
key: "mapchange",
|
|
22
|
+
value: function mapchange() {
|
|
84
23
|
var _this$tilesetManager;
|
|
85
24
|
|
|
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
25
|
var _this$getCurrentView = this.getCurrentView(),
|
|
95
26
|
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
96
27
|
zoom = _this$getCurrentView.zoom;
|
|
97
28
|
|
|
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
29
|
if (this.mapService.version === 'GAODE1.x') {
|
|
110
30
|
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
111
31
|
visible = _this$parent$getLayer.visible;
|
|
@@ -131,7 +51,37 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
131
51
|
zoom: zoom,
|
|
132
52
|
latLonBounds: latLonBounds
|
|
133
53
|
};
|
|
134
|
-
(_this$
|
|
54
|
+
(_this$tilesetManager = this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.throttleUpdate(zoom, latLonBounds);
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "getCurrentView",
|
|
58
|
+
value: function getCurrentView() {
|
|
59
|
+
var bounds = this.mapService.getBounds();
|
|
60
|
+
var latLonBounds = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
|
|
61
|
+
var zoom = this.mapService.getZoom();
|
|
62
|
+
return {
|
|
63
|
+
latLonBounds: latLonBounds,
|
|
64
|
+
zoom: zoom
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "initTileSetManager",
|
|
69
|
+
value: function initTileSetManager() {
|
|
70
|
+
var _this$tilesetManager2;
|
|
71
|
+
|
|
72
|
+
var source = this.parent.getSource();
|
|
73
|
+
this.tilesetManager = source.tileset;
|
|
74
|
+
|
|
75
|
+
if (!this.initedTileset) {
|
|
76
|
+
this.bindTilesetEvent();
|
|
77
|
+
this.initedTileset = true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var _this$getCurrentView2 = this.getCurrentView(),
|
|
81
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
82
|
+
zoom = _this$getCurrentView2.zoom;
|
|
83
|
+
|
|
84
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds);
|
|
135
85
|
}
|
|
136
86
|
}, {
|
|
137
87
|
key: "bindTilesetEvent",
|
|
@@ -151,6 +101,7 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
151
101
|
// 将事件抛出,图层上可以监听使用
|
|
152
102
|
_this.tileUnLoad(tile);
|
|
153
103
|
}); // 瓦片数据加载失败
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
154
105
|
|
|
155
106
|
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
156
107
|
// 将事件抛出,图层上可以监听使用
|
|
@@ -167,18 +118,22 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
167
118
|
this.mapService.on('moveend', function () {
|
|
168
119
|
return _this.viewchange();
|
|
169
120
|
});
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "render",
|
|
124
|
+
value: function render() {
|
|
125
|
+
this.tileLayerManager.render();
|
|
170
126
|
} // 防抖操作
|
|
171
127
|
|
|
172
128
|
}, {
|
|
173
|
-
key: "
|
|
174
|
-
value:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
129
|
+
key: "tileLoaded",
|
|
130
|
+
value: // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
131
|
+
function tileLoaded(tile) {//
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "tileError",
|
|
135
|
+
value: function tileError(error) {
|
|
136
|
+
console.warn('error:', error);
|
|
182
137
|
}
|
|
183
138
|
}, {
|
|
184
139
|
key: "destroy",
|
|
@@ -186,10 +141,72 @@ var BaseTileLayer = /*#__PURE__*/function () {
|
|
|
186
141
|
var _this$tilesetManager3;
|
|
187
142
|
|
|
188
143
|
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
144
|
+
this.tileLayerManager.destroy();
|
|
189
145
|
}
|
|
190
|
-
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "tileUnLoad",
|
|
148
|
+
value: function tileUnLoad(tile) {
|
|
149
|
+
this.tileLayerManager.removeTile(tile);
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "tileUpdate",
|
|
153
|
+
value: function tileUpdate() {
|
|
154
|
+
var _this2 = this;
|
|
155
|
+
|
|
156
|
+
if (!this.tilesetManager) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.tilesetManager.tiles.filter(function (tile) {
|
|
161
|
+
return tile.isLoaded;
|
|
162
|
+
}).map(function (tile) {
|
|
163
|
+
if (!_this2.isTileReady(tile)) return;
|
|
164
|
+
|
|
165
|
+
if (!_this2.tileLayerManager.hasTile(tile)) {
|
|
166
|
+
var _this2$tileLayerManag = _this2.tileLayerManager.addTile(tile),
|
|
167
|
+
layers = _this2$tileLayerManag.layers;
|
|
168
|
+
|
|
169
|
+
_this2.setPickState(layers);
|
|
170
|
+
} else {
|
|
171
|
+
if (!tile.isVisibleChange) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var _layers = _this2.tileLayerManager.getChildren(tile.layerIDList);
|
|
176
|
+
|
|
177
|
+
updateTileVisible(tile, _layers, _this2.layerService);
|
|
191
178
|
|
|
192
|
-
|
|
193
|
-
}
|
|
179
|
+
_this2.setPickState(_layers);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if (this.tilesetManager.isLoaded) {
|
|
184
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
185
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "isTileReady",
|
|
190
|
+
value: function isTileReady(tile) {
|
|
191
|
+
var _tile$data;
|
|
192
|
+
|
|
193
|
+
if ((_tile$data = tile.data) !== null && _tile$data !== void 0 && _tile$data.layers && this.sourceLayer) {
|
|
194
|
+
// vector
|
|
195
|
+
var vectorTileLayer = tile.data.layers[this.sourceLayer];
|
|
196
|
+
var features = vectorTileLayer === null || vectorTileLayer === void 0 ? void 0 : vectorTileLayer.features;
|
|
197
|
+
|
|
198
|
+
if (!(Array.isArray(features) && features.length > 0)) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return true;
|
|
204
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
205
|
+
|
|
206
|
+
}, {
|
|
207
|
+
key: "setPickState",
|
|
208
|
+
value: function setPickState(layers) {}
|
|
209
|
+
}]);
|
|
194
210
|
|
|
195
|
-
|
|
211
|
+
return Base;
|
|
212
|
+
}();
|
package/es/tile/utils.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { ILayer,
|
|
1
|
+
import { ILayer, ILayerService } from '@antv/l7-core';
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
3
|
export declare const tileVectorParser: string[];
|
|
4
|
+
/**
|
|
5
|
+
* 判断当前图层是否是瓦片图层
|
|
6
|
+
* @param layer
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function isTileGroup(layer: ILayer): boolean;
|
|
4
10
|
export declare function isVectorTile(parserType: string): boolean;
|
|
5
11
|
export declare function registerLayers(parentLayer: ILayer, layers: ILayer[]): void;
|
|
6
12
|
export declare function getLayerShape(layerType: string, layer: ILayer): string | string[];
|
|
@@ -9,11 +15,8 @@ export declare function getContainerSize(container: HTMLCanvasElement | HTMLElem
|
|
|
9
15
|
width: number;
|
|
10
16
|
height: number;
|
|
11
17
|
};
|
|
12
|
-
export declare function readRasterValue(tile: Tile, mapService: IMapService, x: number, y: number): any;
|
|
13
|
-
export declare function readPixel(x: number, y: number, rendererService: IRendererService): false | Uint8Array;
|
|
14
18
|
export declare function isTileLoaded(tile: Tile): boolean;
|
|
15
19
|
export declare function isTileChildLoaded(tile: Tile): boolean;
|
|
16
20
|
export declare function isTileParentLoaded(tile: Tile): boolean;
|
|
17
21
|
export declare function tileAllLoad(tile: Tile, callback: () => void): void;
|
|
18
|
-
export declare function updateLayersConfig(layers: ILayer[], key: string, value: any): void;
|
|
19
22
|
export declare function updateTileVisible(tile: Tile, layers: ILayer[], layerService: ILayerService): void;
|