@antv/l7-layers 2.9.36-alpha.1 → 2.9.37-alpha.1
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
|
@@ -1,420 +0,0 @@
|
|
|
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 _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
-
import { decodePickingColor } from '@antv/l7-utils';
|
|
7
|
-
import { TileLayerManager } from "../manager/tileLayerManager";
|
|
8
|
-
import { debounce } from 'lodash';
|
|
9
|
-
|
|
10
|
-
var BaseTileLayer = /*#__PURE__*/function () {
|
|
11
|
-
function BaseTileLayer(_ref) {
|
|
12
|
-
var _parentSource$data;
|
|
13
|
-
|
|
14
|
-
var parent = _ref.parent,
|
|
15
|
-
rendererService = _ref.rendererService,
|
|
16
|
-
mapService = _ref.mapService,
|
|
17
|
-
layerService = _ref.layerService,
|
|
18
|
-
pickingService = _ref.pickingService,
|
|
19
|
-
transforms = _ref.transforms;
|
|
20
|
-
|
|
21
|
-
_classCallCheck(this, BaseTileLayer);
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "type", 'baseTile');
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "initedTileset", false);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "pickColors", {
|
|
28
|
-
select: null,
|
|
29
|
-
active: null
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
_defineProperty(this, "viewchange", debounce(this.mapchange, 200));
|
|
33
|
-
|
|
34
|
-
var parentSource = parent.getSource();
|
|
35
|
-
|
|
36
|
-
var _ref2 = (parentSource === null || parentSource === void 0 ? void 0 : (_parentSource$data = parentSource.data) === null || _parentSource$data === void 0 ? void 0 : _parentSource$data.tilesetOptions) || {},
|
|
37
|
-
sourceLayer = _ref2.sourceLayer;
|
|
38
|
-
|
|
39
|
-
this.sourceLayer = sourceLayer;
|
|
40
|
-
this.parent = parent;
|
|
41
|
-
this.mapService = mapService;
|
|
42
|
-
this.layerService = layerService;
|
|
43
|
-
this.tileLayerManager = new TileLayerManager(parent, mapService, rendererService, pickingService, transforms);
|
|
44
|
-
this.initTileSetManager();
|
|
45
|
-
this.bindSubLayerEvent();
|
|
46
|
-
this.bindSubLayerPick();
|
|
47
|
-
this.scaleField = this.parent.getScaleOptions();
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* 渲染瓦片的图层
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
_createClass(BaseTileLayer, [{
|
|
55
|
-
key: "children",
|
|
56
|
-
get: function get() {
|
|
57
|
-
return this.tileLayerManager.children;
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "render",
|
|
61
|
-
value: function render() {
|
|
62
|
-
if (this.tileLayerManager) {
|
|
63
|
-
this.tileLayerManager.render();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "clearPick",
|
|
68
|
-
value: function clearPick(type) {
|
|
69
|
-
if (type === 'mousemove') {
|
|
70
|
-
this.tileLayerManager.tilePickManager.clearPick();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* 清除 select 的选中状态
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
}, {
|
|
78
|
-
key: "clearPickState",
|
|
79
|
-
value: function clearPickState() {
|
|
80
|
-
var _this = this;
|
|
81
|
-
|
|
82
|
-
this.children.filter(function (child) {
|
|
83
|
-
return child.inited && child.isVisible();
|
|
84
|
-
}).filter(function (child) {
|
|
85
|
-
return child.getCurrentSelectedId() !== null;
|
|
86
|
-
}).map(function (child) {
|
|
87
|
-
_this.selectFeature(child, new Uint8Array([0, 0, 0, 0]));
|
|
88
|
-
|
|
89
|
-
child.setCurrentSelectedId(null);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 瓦片图层独立的拾取逻辑
|
|
94
|
-
* @param target
|
|
95
|
-
* @returns
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
}, {
|
|
99
|
-
key: "pickLayers",
|
|
100
|
-
value: function pickLayers(target) {
|
|
101
|
-
return this.tileLayerManager.pickLayers(target);
|
|
102
|
-
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
|
-
|
|
104
|
-
}, {
|
|
105
|
-
key: "tileLoaded",
|
|
106
|
-
value: function tileLoaded(tile) {//
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "tileError",
|
|
110
|
-
value: function tileError(error) {
|
|
111
|
-
console.warn('error:', error);
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "tileUnLoad",
|
|
115
|
-
value: function tileUnLoad(tile) {
|
|
116
|
-
this.tileLayerManager.removeChilds(tile.layerIDList, false);
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
key: "tileUpdate",
|
|
120
|
-
value: function tileUpdate() {
|
|
121
|
-
// Base Function
|
|
122
|
-
if (!this.tilesetManager) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.tilesetManager.isLoaded) {
|
|
127
|
-
// 将事件抛出,图层上可以使用瓦片
|
|
128
|
-
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
key: "setPickState",
|
|
133
|
-
value: function setPickState(layers) {
|
|
134
|
-
var _this2 = this;
|
|
135
|
-
|
|
136
|
-
if (this.pickColors.select) {
|
|
137
|
-
var selectedId = decodePickingColor(this.pickColors.select);
|
|
138
|
-
layers.map(function (layer) {
|
|
139
|
-
_this2.selectFeature(layer, _this2.pickColors.select);
|
|
140
|
-
|
|
141
|
-
layer.setCurrentSelectedId(selectedId);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (this.pickColors.active) {
|
|
146
|
-
var _selectedId = decodePickingColor(this.pickColors.active);
|
|
147
|
-
|
|
148
|
-
layers.filter(function (layer) {
|
|
149
|
-
return layer.inited && layer.isVisible();
|
|
150
|
-
}).map(function (layer) {
|
|
151
|
-
layer.hooks.beforeHighlight.call(_this2.pickColors.active);
|
|
152
|
-
layer.setCurrentPickId(_selectedId);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, {
|
|
157
|
-
key: "bindSubLayerPick",
|
|
158
|
-
value: function bindSubLayerPick() {
|
|
159
|
-
var _this3 = this;
|
|
160
|
-
|
|
161
|
-
this.tileLayerManager.tilePickManager.on('pick', function (e) {
|
|
162
|
-
// @ts-ignore
|
|
163
|
-
var _e$pickedColors = _slicedToArray(e.pickedColors, 3),
|
|
164
|
-
r = _e$pickedColors[0],
|
|
165
|
-
g = _e$pickedColors[1],
|
|
166
|
-
b = _e$pickedColors[2];
|
|
167
|
-
|
|
168
|
-
if (e.type === 'click') {
|
|
169
|
-
var restLayers = _this3.children.filter(function (child) {
|
|
170
|
-
return child.inited && child.isVisible() && child.isVector;
|
|
171
|
-
}).filter(function (child) {
|
|
172
|
-
return child !== e.layer;
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
_this3.setSelect(restLayers, [r, g, b]);
|
|
176
|
-
} else {
|
|
177
|
-
_this3.setHighlight([r, g, b]);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
this.tileLayerManager.tilePickManager.on('unpick', function () {
|
|
181
|
-
_this3.pickColors.active = null;
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}, {
|
|
185
|
-
key: "setHighlight",
|
|
186
|
-
value: function setHighlight(pickedColors) {
|
|
187
|
-
var pickId = decodePickingColor(pickedColors);
|
|
188
|
-
this.pickColors.active = pickedColors;
|
|
189
|
-
this.children.filter(function (child) {
|
|
190
|
-
return child.inited && child.isVisible() && child.isVector;
|
|
191
|
-
}) // Tip: 使用 vectorLayer 上的 pickID 优化高亮操作(过滤重复操作)
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
.filter(function (child) {
|
|
194
|
-
return child.getPickID() !== pickId;
|
|
195
|
-
}).map(function (child) {
|
|
196
|
-
// @ts-ignore
|
|
197
|
-
child.setPickID(pickId);
|
|
198
|
-
child.hooks.beforeHighlight.call(pickedColors);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "setSelect",
|
|
203
|
-
value: function setSelect(layers, pickedColors) {
|
|
204
|
-
var _this4 = this;
|
|
205
|
-
|
|
206
|
-
var selectedId = decodePickingColor(pickedColors);
|
|
207
|
-
layers.map(function (layer) {
|
|
208
|
-
if (layer.getCurrentSelectedId() === null || selectedId !== layer.getCurrentSelectedId()) {
|
|
209
|
-
_this4.selectFeature(layer, pickedColors);
|
|
210
|
-
|
|
211
|
-
layer.setCurrentSelectedId(selectedId);
|
|
212
|
-
_this4.pickColors.select = pickedColors;
|
|
213
|
-
} else {
|
|
214
|
-
_this4.selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
layer.setCurrentSelectedId(null);
|
|
218
|
-
_this4.pickColors.select = null;
|
|
219
|
-
}
|
|
220
|
-
}); // unselect normal layer
|
|
221
|
-
|
|
222
|
-
var renderList = this.layerService.getRenderList();
|
|
223
|
-
renderList.filter(function (layer) {
|
|
224
|
-
return layer.inited && !layer.isVector && layer.isVisible() && layer.needPick('click');
|
|
225
|
-
}).filter(function (layer) {
|
|
226
|
-
return layer.getCurrentSelectedId() !== null;
|
|
227
|
-
}).map(function (layer) {
|
|
228
|
-
_this4.selectFeature(layer, new Uint8Array([0, 0, 0, 0]));
|
|
229
|
-
|
|
230
|
-
layer.setCurrentSelectedId(null);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
key: "selectFeature",
|
|
235
|
-
value: function selectFeature(layer, pickedColors) {
|
|
236
|
-
// @ts-ignore
|
|
237
|
-
var _pickedColors = _slicedToArray(pickedColors, 3),
|
|
238
|
-
r = _pickedColors[0],
|
|
239
|
-
g = _pickedColors[1],
|
|
240
|
-
b = _pickedColors[2];
|
|
241
|
-
|
|
242
|
-
layer.hooks.beforeSelect.call([r, g, b]);
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "bindSubLayerEvent",
|
|
246
|
-
value: function bindSubLayerEvent() {
|
|
247
|
-
var _this5 = this;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* layer.on('click', (ev) => {}); // 鼠标左键点击图层事件
|
|
251
|
-
* layer.on('mouseenter', (ev) => {}); // 鼠标进入图层要素
|
|
252
|
-
* layer.on('mousemove', (ev) => {}); // 鼠标在图层上移动时触发
|
|
253
|
-
* layer.on('mouseout', (ev) => {}); // 鼠标移出图层要素时触发
|
|
254
|
-
* layer.on('mouseup', (ev) => {}); // 鼠标在图层上单击抬起时触发
|
|
255
|
-
* layer.on('mousedown', (ev) => {}); // 鼠标在图层上单击按下时触发
|
|
256
|
-
* layer.on('contextmenu', (ev) => {}); // 图层要素点击右键菜单
|
|
257
|
-
*
|
|
258
|
-
* 鼠标在图层外的事件
|
|
259
|
-
* layer.on('unclick', (ev) => {}); // 图层外点击
|
|
260
|
-
* layer.on('unmousemove', (ev) => {}); // 图层外移动
|
|
261
|
-
* layer.on('unmouseup', (ev) => {}); // 图层外鼠标抬起
|
|
262
|
-
* layer.on('unmousedown', (ev) => {}); // 图层外单击按下时触发
|
|
263
|
-
* layer.on('uncontextmenu', (ev) => {}); // 图层外点击右键
|
|
264
|
-
* layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件
|
|
265
|
-
*/
|
|
266
|
-
this.parent.on('subLayerClick', function (e) {
|
|
267
|
-
_this5.parent.emit('click', _objectSpread({}, e));
|
|
268
|
-
});
|
|
269
|
-
this.parent.on('subLayerMouseMove', function (e) {
|
|
270
|
-
return _this5.parent.emit('mousemove', _objectSpread({}, e));
|
|
271
|
-
});
|
|
272
|
-
this.parent.on('subLayerMouseUp', function (e) {
|
|
273
|
-
return _this5.parent.emit('mouseup', _objectSpread({}, e));
|
|
274
|
-
});
|
|
275
|
-
this.parent.on('subLayerMouseEnter', function (e) {
|
|
276
|
-
return _this5.parent.emit('mouseenter', _objectSpread({}, e));
|
|
277
|
-
});
|
|
278
|
-
this.parent.on('subLayerMouseOut', function (e) {
|
|
279
|
-
return _this5.parent.emit('mouseout', _objectSpread({}, e));
|
|
280
|
-
});
|
|
281
|
-
this.parent.on('subLayerMouseDown', function (e) {
|
|
282
|
-
return _this5.parent.emit('mousedown', _objectSpread({}, e));
|
|
283
|
-
});
|
|
284
|
-
this.parent.on('subLayerContextmenu', function (e) {
|
|
285
|
-
return _this5.parent.emit('contextmenu', _objectSpread({}, e));
|
|
286
|
-
}); // vector layer 图层外事件
|
|
287
|
-
|
|
288
|
-
this.parent.on('subLayerUnClick', function (e) {
|
|
289
|
-
return _this5.parent.emit('unclick', _objectSpread({}, e));
|
|
290
|
-
});
|
|
291
|
-
this.parent.on('subLayerUnMouseMove', function (e) {
|
|
292
|
-
return _this5.parent.emit('unmousemove', _objectSpread({}, e));
|
|
293
|
-
});
|
|
294
|
-
this.parent.on('subLayerUnMouseUp', function (e) {
|
|
295
|
-
return _this5.parent.emit('unmouseup', _objectSpread({}, e));
|
|
296
|
-
});
|
|
297
|
-
this.parent.on('subLayerUnMouseDown', function (e) {
|
|
298
|
-
return _this5.parent.emit('unmousedown', _objectSpread({}, e));
|
|
299
|
-
});
|
|
300
|
-
this.parent.on('subLayerUnContextmenu', function (e) {
|
|
301
|
-
return _this5.parent.emit('uncontextmenu', _objectSpread({}, e));
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}, {
|
|
305
|
-
key: "initTileSetManager",
|
|
306
|
-
value: function initTileSetManager() {
|
|
307
|
-
var _this$tilesetManager;
|
|
308
|
-
|
|
309
|
-
var source = this.parent.getSource();
|
|
310
|
-
this.tilesetManager = source.tileset;
|
|
311
|
-
|
|
312
|
-
if (!this.initedTileset) {
|
|
313
|
-
this.bindTilesetEvent();
|
|
314
|
-
this.initedTileset = true;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
var _this$getCurrentView = this.getCurrentView(),
|
|
318
|
-
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
319
|
-
zoom = _this$getCurrentView.zoom;
|
|
320
|
-
|
|
321
|
-
(_this$tilesetManager = this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.update(zoom, latLonBounds);
|
|
322
|
-
}
|
|
323
|
-
}, {
|
|
324
|
-
key: "mapchange",
|
|
325
|
-
value: function mapchange() {
|
|
326
|
-
var _this$tilesetManager2;
|
|
327
|
-
|
|
328
|
-
var _this$getCurrentView2 = this.getCurrentView(),
|
|
329
|
-
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
330
|
-
zoom = _this$getCurrentView2.zoom;
|
|
331
|
-
|
|
332
|
-
if (this.mapService.version === 'GAODE1.x') {
|
|
333
|
-
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
334
|
-
visible = _this$parent$getLayer.visible;
|
|
335
|
-
|
|
336
|
-
if (zoom < 3 && visible) {
|
|
337
|
-
this.parent.updateLayerConfig({
|
|
338
|
-
visible: false
|
|
339
|
-
});
|
|
340
|
-
this.layerService.reRender();
|
|
341
|
-
} else if (zoom >= 3 && !visible) {
|
|
342
|
-
this.parent.updateLayerConfig({
|
|
343
|
-
visible: true
|
|
344
|
-
});
|
|
345
|
-
this.layerService.reRender();
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
this.lastViewStates = {
|
|
354
|
-
zoom: zoom,
|
|
355
|
-
latLonBounds: latLonBounds
|
|
356
|
-
};
|
|
357
|
-
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.throttleUpdate(zoom, latLonBounds);
|
|
358
|
-
}
|
|
359
|
-
}, {
|
|
360
|
-
key: "bindTilesetEvent",
|
|
361
|
-
value: function bindTilesetEvent() {
|
|
362
|
-
var _this6 = this;
|
|
363
|
-
|
|
364
|
-
if (!this.tilesetManager) {
|
|
365
|
-
return;
|
|
366
|
-
} // 瓦片数据加载成功
|
|
367
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
this.tilesetManager.on('tile-loaded', function (tile) {// 将事件抛出,图层上可以监听使用
|
|
371
|
-
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
372
|
-
|
|
373
|
-
this.tilesetManager.on('tile-unload', function (tile) {
|
|
374
|
-
// 将事件抛出,图层上可以监听使用
|
|
375
|
-
_this6.tileUnLoad(tile);
|
|
376
|
-
}); // 瓦片数据加载失败
|
|
377
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
378
|
-
|
|
379
|
-
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
380
|
-
// 将事件抛出,图层上可以监听使用
|
|
381
|
-
_this6.tileError(error);
|
|
382
|
-
}); // 瓦片显隐状态更新
|
|
383
|
-
|
|
384
|
-
this.tilesetManager.on('tile-update', function () {
|
|
385
|
-
_this6.tileUpdate();
|
|
386
|
-
}); // 地图视野发生改变
|
|
387
|
-
|
|
388
|
-
this.mapService.on('zoomend', function () {
|
|
389
|
-
return _this6.viewchange();
|
|
390
|
-
});
|
|
391
|
-
this.mapService.on('moveend', function () {
|
|
392
|
-
return _this6.viewchange();
|
|
393
|
-
});
|
|
394
|
-
} // 防抖操作
|
|
395
|
-
|
|
396
|
-
}, {
|
|
397
|
-
key: "getCurrentView",
|
|
398
|
-
value: function getCurrentView() {
|
|
399
|
-
var bounds = this.mapService.getBounds();
|
|
400
|
-
var latLonBounds = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
|
|
401
|
-
var zoom = this.mapService.getZoom();
|
|
402
|
-
return {
|
|
403
|
-
latLonBounds: latLonBounds,
|
|
404
|
-
zoom: zoom
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
}, {
|
|
408
|
-
key: "destroy",
|
|
409
|
-
value: function destroy() {
|
|
410
|
-
var _this$tilesetManager3;
|
|
411
|
-
|
|
412
|
-
(_this$tilesetManager3 = this.tilesetManager) === null || _this$tilesetManager3 === void 0 ? void 0 : _this$tilesetManager3.destroy();
|
|
413
|
-
this.tileLayerManager.destroy();
|
|
414
|
-
}
|
|
415
|
-
}]);
|
|
416
|
-
|
|
417
|
-
return BaseTileLayer;
|
|
418
|
-
}();
|
|
419
|
-
|
|
420
|
-
export { BaseTileLayer as default };
|
|
@@ -1,97 +0,0 @@
|
|
|
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 { updateTileVisible } 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
|
-
updateTileVisible(tile, _layers, _this2.layerService);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if (this.tilesetManager.isLoaded) {
|
|
90
|
-
// 将事件抛出,图层上可以使用瓦片
|
|
91
|
-
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}]);
|
|
95
|
-
|
|
96
|
-
return TMSBaseMapTileLayer;
|
|
97
|
-
}(BaseTileLayer);
|
package/es/tile/tmsTileLayer.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
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/baseTileLayer";
|
|
15
|
-
import { updateTileVisible } from "./utils";
|
|
16
|
-
export var TMSTileLayer = /*#__PURE__*/function (_BaseTileLayer) {
|
|
17
|
-
_inherits(TMSTileLayer, _BaseTileLayer);
|
|
18
|
-
|
|
19
|
-
var _super = _createSuper(TMSTileLayer);
|
|
20
|
-
|
|
21
|
-
function TMSTileLayer() {
|
|
22
|
-
var _this;
|
|
23
|
-
|
|
24
|
-
_classCallCheck(this, TMSTileLayer);
|
|
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", 'TMS');
|
|
33
|
-
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
_createClass(TMSTileLayer, [{
|
|
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
|
-
|
|
79
|
-
_this2.setPickState(layers);
|
|
80
|
-
} else {
|
|
81
|
-
if (!tile.isVisibleChange) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
86
|
-
|
|
87
|
-
updateTileVisible(tile, _layers, _this2.layerService);
|
|
88
|
-
|
|
89
|
-
_this2.setPickState(_layers);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (this.tilesetManager.isLoaded) {
|
|
94
|
-
// 将事件抛出,图层上可以使用瓦片
|
|
95
|
-
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}]);
|
|
99
|
-
|
|
100
|
-
return TMSTileLayer;
|
|
101
|
-
}(BaseTileLayer);
|