@antv/l7-layers 2.9.25-alpha.0 → 2.9.26-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/heatmap/models/heatmap.js +1 -1
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/utils.js +1 -1
- package/lib/Geometry/index.js +114 -77
- package/lib/Geometry/models/billboard.js +232 -181
- package/lib/Geometry/models/index.js +18 -34
- package/lib/Geometry/models/plane.js +407 -278
- package/lib/Geometry/models/sprite.js +291 -189
- package/lib/canvas/index.js +101 -66
- package/lib/canvas/models/canvas.js +207 -140
- package/lib/canvas/models/index.js +12 -30
- package/lib/citybuliding/building.js +98 -63
- package/lib/citybuliding/models/build.js +192 -146
- package/lib/core/BaseLayer.js +1331 -814
- package/lib/core/BaseModel.js +457 -279
- package/lib/core/interface.js +40 -53
- package/lib/core/schema.js +21 -39
- package/lib/core/shape/Path.js +67 -79
- package/lib/core/shape/extrude.js +132 -91
- package/lib/core/triangulation.js +378 -196
- package/lib/earth/index.js +100 -62
- package/lib/earth/models/atmosphere.js +146 -112
- package/lib/earth/models/base.js +210 -150
- package/lib/earth/models/bloomsphere.js +146 -112
- package/lib/earth/utils.js +111 -91
- package/lib/heatmap/index.js +149 -92
- package/lib/heatmap/models/grid.js +118 -91
- package/lib/heatmap/models/grid3d.js +155 -123
- package/lib/heatmap/models/heatmap.js +475 -338
- package/lib/heatmap/models/hexagon.js +121 -92
- package/lib/heatmap/models/index.js +22 -37
- package/lib/heatmap/triangulation.js +31 -47
- package/lib/image/index.js +111 -74
- package/lib/image/models/dataImage.js +232 -174
- package/lib/image/models/image.js +175 -128
- package/lib/image/models/index.js +15 -32
- package/lib/index.js +263 -97
- package/lib/line/index.js +131 -85
- package/lib/line/models/arc.js +352 -237
- package/lib/line/models/arc_3d.js +334 -228
- package/lib/line/models/earthArc_3d.js +336 -228
- package/lib/line/models/great_circle.js +291 -200
- package/lib/line/models/half.js +286 -201
- package/lib/line/models/index.js +42 -50
- package/lib/line/models/line.js +428 -299
- package/lib/line/models/linearline.js +277 -203
- package/lib/line/models/simpleLine.js +239 -175
- package/lib/line/models/tile.js +348 -237
- package/lib/line/models/wall.js +327 -235
- package/lib/mask/index.js +92 -59
- package/lib/mask/models/fill.js +134 -82
- package/lib/mask/models/index.js +12 -30
- package/lib/plugins/DataMappingPlugin.js +342 -224
- package/lib/plugins/DataSourcePlugin.js +102 -87
- package/lib/plugins/FeatureScalePlugin.js +330 -240
- package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
- package/lib/plugins/LayerModelPlugin.js +80 -73
- package/lib/plugins/LayerStylePlugin.js +48 -51
- package/lib/plugins/LightingPlugin.js +80 -68
- package/lib/plugins/MultiPassRendererPlugin.js +91 -65
- package/lib/plugins/PixelPickingPlugin.js +150 -109
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
- package/lib/plugins/ShaderUniformPlugin.js +118 -99
- package/lib/plugins/UpdateModelPlugin.js +40 -47
- package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
- package/lib/point/index.js +226 -150
- package/lib/point/models/earthExtrude.js +279 -201
- package/lib/point/models/earthFill.js +287 -202
- package/lib/point/models/extrude.js +299 -203
- package/lib/point/models/fill.js +406 -275
- package/lib/point/models/fillmage.js +365 -256
- package/lib/point/models/image.js +241 -168
- package/lib/point/models/index.js +46 -52
- package/lib/point/models/normal.js +183 -134
- package/lib/point/models/radar.js +304 -211
- package/lib/point/models/simplePoint.js +194 -142
- package/lib/point/models/text.js +608 -385
- package/lib/point/models/tile.js +314 -223
- package/lib/point/shape/extrude.js +56 -52
- package/lib/polygon/index.js +154 -102
- package/lib/polygon/models/extrude.js +311 -223
- package/lib/polygon/models/fill.js +215 -153
- package/lib/polygon/models/index.js +46 -52
- package/lib/polygon/models/ocean.js +244 -173
- package/lib/polygon/models/tile.js +144 -100
- package/lib/polygon/models/water.js +222 -153
- package/lib/raster/buffers/triangulation.js +27 -40
- package/lib/raster/index.js +115 -75
- package/lib/raster/models/index.js +16 -33
- package/lib/raster/models/raster.js +178 -135
- package/lib/raster/raster.js +187 -132
- package/lib/tile/interface.js +4 -16
- package/lib/tile/manager/tileConfigManager.js +125 -86
- package/lib/tile/manager/tileLayerManager.js +313 -229
- package/lib/tile/manager/tilePickerManager.js +192 -123
- package/lib/tile/models/tileModel.js +71 -52
- package/lib/tile/tileFactory/base.js +432 -309
- package/lib/tile/tileFactory/index.js +51 -49
- package/lib/tile/tileFactory/line.js +65 -50
- package/lib/tile/tileFactory/point.js +65 -50
- package/lib/tile/tileFactory/polygon.js +65 -50
- package/lib/tile/tileFactory/raster.js +66 -54
- package/lib/tile/tileFactory/rasterData.js +88 -76
- package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
- package/lib/tile/tileFactory/vectorLayer.js +168 -109
- package/lib/tile/tileLayer/baseTileLayer.js +420 -221
- package/lib/tile/tmsTileLayer.js +110 -67
- package/lib/tile/utils.js +110 -92
- package/lib/utils/blend.js +59 -79
- package/lib/utils/collision-index.js +107 -64
- package/lib/utils/dataMappingStyle.js +105 -60
- package/lib/utils/extrude_polyline.js +600 -398
- package/lib/utils/grid-index.js +163 -111
- package/lib/utils/layerData.js +130 -99
- package/lib/utils/multiPassRender.js +49 -41
- package/lib/utils/polylineNormal.js +148 -96
- package/lib/utils/simpleLine.js +100 -85
- package/lib/utils/symbol-layout.js +219 -116
- package/lib/utils/updateShape.js +15 -41
- package/lib/wind/index.js +109 -71
- package/lib/wind/models/index.js +12 -30
- package/lib/wind/models/utils.js +144 -105
- package/lib/wind/models/wind.js +333 -224
- package/lib/wind/models/windRender.js +329 -218
- package/lib/wind/models/windShader.js +23 -181
- package/package.json +6 -6
|
@@ -1,248 +1,447 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/tile/tileLayer/baseTileLayer.ts
|
|
20
|
-
var baseTileLayer_exports = {};
|
|
21
|
-
__export(baseTileLayer_exports, {
|
|
22
|
-
default: () => BaseTileLayer
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
23
7
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
20
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
21
|
+
|
|
22
|
+
var _tileLayerManager = require("../manager/tileLayerManager");
|
|
23
|
+
|
|
24
|
+
var BaseTileLayer = /*#__PURE__*/function () {
|
|
25
|
+
function BaseTileLayer(_ref) {
|
|
26
|
+
var _parentSource$data;
|
|
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
|
+
(0, _classCallCheck2.default)(this, BaseTileLayer);
|
|
35
|
+
(0, _defineProperty2.default)(this, "type", 'baseTile');
|
|
36
|
+
(0, _defineProperty2.default)(this, "initedTileset", false);
|
|
37
|
+
(0, _defineProperty2.default)(this, "pickColors", {
|
|
39
38
|
select: null,
|
|
40
39
|
active: null
|
|
41
|
-
};
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
});
|
|
41
|
+
var parentSource = parent.getSource();
|
|
42
|
+
|
|
43
|
+
var _ref2 = (parentSource === null || parentSource === void 0 ? void 0 : (_parentSource$data = parentSource.data) === null || _parentSource$data === void 0 ? void 0 : _parentSource$data.tilesetOptions) || {},
|
|
44
|
+
sourceLayer = _ref2.sourceLayer,
|
|
45
|
+
coords = _ref2.coords,
|
|
46
|
+
featureId = _ref2.featureId;
|
|
47
|
+
|
|
45
48
|
this.sourceLayer = sourceLayer;
|
|
46
49
|
this.parent = parent;
|
|
47
50
|
this.mapService = mapService;
|
|
48
51
|
this.layerService = layerService;
|
|
49
|
-
this.tileLayerManager = new
|
|
52
|
+
this.tileLayerManager = new _tileLayerManager.TileLayerManager(parent, mapService, rendererService, pickingService, layerService, transforms);
|
|
50
53
|
this.initTileSetManager();
|
|
51
54
|
this.bindSubLayerEvent();
|
|
52
55
|
this.bindSubLayerPick();
|
|
53
56
|
this.scaleField = this.parent.getScaleOptions();
|
|
54
57
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
/**
|
|
59
|
+
* 渲染瓦片的图层
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
(0, _createClass2.default)(BaseTileLayer, [{
|
|
64
|
+
key: "children",
|
|
65
|
+
get: function get() {
|
|
66
|
+
return this.tileLayerManager.children;
|
|
61
67
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.tileLayerManager
|
|
68
|
+
}, {
|
|
69
|
+
key: "render",
|
|
70
|
+
value: function render() {
|
|
71
|
+
if (this.tileLayerManager) {
|
|
72
|
+
this.tileLayerManager.render();
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
pickLayers(target) {
|
|
75
|
-
return this.tileLayerManager.pickLayers(target);
|
|
76
|
-
}
|
|
77
|
-
tileLoaded(tile) {
|
|
78
|
-
}
|
|
79
|
-
tileError(error) {
|
|
80
|
-
console.warn("error:", error);
|
|
81
|
-
}
|
|
82
|
-
tileUnLoad(tile) {
|
|
83
|
-
this.tileLayerManager.removeChilds(tile.layerIDList, false);
|
|
84
|
-
}
|
|
85
|
-
tileUpdate() {
|
|
86
|
-
if (!this.tilesetManager) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.tilesetManager.tiles.filter((tile) => tile.isLoaded).map((tile) => {
|
|
90
|
-
if (tile.layerIDList.length === 0) {
|
|
91
|
-
const { layers, layerIDList } = this.tileLayerManager.createTile(tile);
|
|
92
|
-
tile.layerIDList = layerIDList;
|
|
93
|
-
this.tileLayerManager.addChilds(layers);
|
|
94
|
-
} else {
|
|
95
|
-
if (!tile.isVisibleChange) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const layers = this.tileLayerManager.getChilds(tile.layerIDList);
|
|
99
|
-
this.tileLayerManager.updateLayersConfig(layers, "visible", tile.isVisible);
|
|
75
|
+
}, {
|
|
76
|
+
key: "clearPick",
|
|
77
|
+
value: function clearPick(type) {
|
|
78
|
+
if (type === 'mousemove') {
|
|
79
|
+
this.tileLayerManager.tilePickManager.clearPick();
|
|
100
80
|
}
|
|
101
|
-
});
|
|
102
|
-
if (this.tilesetManager.isLoaded) {
|
|
103
|
-
this.parent.emit("tiles-loaded", this.tilesetManager.currentTiles);
|
|
104
81
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
82
|
+
/**
|
|
83
|
+
* 清除 select 的选中状态
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
}, {
|
|
87
|
+
key: "clearPickState",
|
|
88
|
+
value: function clearPickState() {
|
|
89
|
+
var _this = this;
|
|
90
|
+
|
|
91
|
+
this.children.filter(function (child) {
|
|
92
|
+
return child.inited && child.isVisible();
|
|
93
|
+
}).filter(function (child) {
|
|
94
|
+
return child.getCurrentSelectedId() !== null;
|
|
95
|
+
}).map(function (child) {
|
|
96
|
+
_this.selectFeature(child, new Uint8Array([0, 0, 0, 0]));
|
|
97
|
+
|
|
98
|
+
child.setCurrentSelectedId(null);
|
|
112
99
|
});
|
|
113
100
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
101
|
+
/**
|
|
102
|
+
* 瓦片图层独立的拾取逻辑
|
|
103
|
+
* @param target
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
}, {
|
|
108
|
+
key: "pickLayers",
|
|
109
|
+
value: function pickLayers(target) {
|
|
110
|
+
return this.tileLayerManager.pickLayers(target);
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "tileLoaded",
|
|
114
|
+
value: function tileLoaded(tile) {//
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "tileError",
|
|
118
|
+
value: function tileError(error) {
|
|
119
|
+
console.warn('error:', error);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "tileUnLoad",
|
|
123
|
+
value: function tileUnLoad(tile) {
|
|
124
|
+
this.tileLayerManager.removeChilds(tile.layerIDList, false);
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "tileUpdate",
|
|
128
|
+
value: function tileUpdate() {
|
|
129
|
+
var _this2 = this;
|
|
130
|
+
|
|
131
|
+
// Base Function
|
|
132
|
+
if (!this.tilesetManager) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
this.tilesetManager.tiles.filter(function (tile) {
|
|
137
|
+
return tile.isLoaded;
|
|
138
|
+
}).map(function (tile) {
|
|
139
|
+
if (tile.layerIDList.length === 0) {
|
|
140
|
+
var _this2$tileLayerManag = _this2.tileLayerManager.createTile(tile),
|
|
141
|
+
layers = _this2$tileLayerManag.layers,
|
|
142
|
+
layerIDList = _this2$tileLayerManag.layerIDList;
|
|
143
|
+
|
|
144
|
+
tile.layerIDList = layerIDList;
|
|
145
|
+
|
|
146
|
+
_this2.tileLayerManager.addChilds(layers);
|
|
147
|
+
} else {
|
|
148
|
+
if (!tile.isVisibleChange) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var _layers = _this2.tileLayerManager.getChilds(tile.layerIDList);
|
|
153
|
+
|
|
154
|
+
_this2.tileLayerManager.updateLayersConfig(_layers, 'visible', tile.isVisible);
|
|
155
|
+
}
|
|
119
156
|
});
|
|
157
|
+
|
|
158
|
+
if (this.tilesetManager.isLoaded) {
|
|
159
|
+
// 将事件抛出,图层上可以使用瓦片
|
|
160
|
+
this.parent.emit('tiles-loaded', this.tilesetManager.currentTiles);
|
|
161
|
+
}
|
|
120
162
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
163
|
+
}, {
|
|
164
|
+
key: "setPickState",
|
|
165
|
+
value: function setPickState(layers) {
|
|
166
|
+
var _this3 = this;
|
|
167
|
+
|
|
168
|
+
if (this.pickColors.select) {
|
|
169
|
+
var selectedId = (0, _l7Utils.decodePickingColor)(this.pickColors.select);
|
|
170
|
+
layers.map(function (layer) {
|
|
171
|
+
_this3.selectFeature(layer, _this3.pickColors.select);
|
|
172
|
+
|
|
173
|
+
layer.setCurrentSelectedId(selectedId);
|
|
174
|
+
});
|
|
130
175
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
child.hooks.beforeHighlight.call(pickedColors);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
setSelect(layers, pickedColors) {
|
|
145
|
-
const selectedId = (0, import_l7_utils.decodePickingColor)(pickedColors);
|
|
146
|
-
layers.map((layer) => {
|
|
147
|
-
if (layer.getCurrentSelectedId() === null || selectedId !== layer.getCurrentSelectedId()) {
|
|
148
|
-
this.selectFeature(layer, pickedColors);
|
|
149
|
-
layer.setCurrentSelectedId(selectedId);
|
|
150
|
-
this.pickColors.select = pickedColors;
|
|
151
|
-
} else {
|
|
152
|
-
this.selectFeature(layer, new Uint8Array([0, 0, 0, 0]));
|
|
153
|
-
layer.setCurrentSelectedId(null);
|
|
154
|
-
this.pickColors.select = null;
|
|
176
|
+
|
|
177
|
+
if (this.pickColors.active) {
|
|
178
|
+
var _selectedId = (0, _l7Utils.decodePickingColor)(this.pickColors.active);
|
|
179
|
+
|
|
180
|
+
layers.filter(function (layer) {
|
|
181
|
+
return layer.inited && layer.isVisible();
|
|
182
|
+
}).map(function (layer) {
|
|
183
|
+
layer.hooks.beforeHighlight.call(_this3.pickColors.active);
|
|
184
|
+
layer.setCurrentPickId(_selectedId);
|
|
185
|
+
});
|
|
155
186
|
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "bindSubLayerPick",
|
|
190
|
+
value: function bindSubLayerPick() {
|
|
191
|
+
var _this4 = this;
|
|
192
|
+
|
|
193
|
+
this.tileLayerManager.tilePickManager.on('pick', function (e) {
|
|
194
|
+
// @ts-ignore
|
|
195
|
+
var _e$pickedColors = (0, _slicedToArray2.default)(e.pickedColors, 3),
|
|
196
|
+
r = _e$pickedColors[0],
|
|
197
|
+
g = _e$pickedColors[1],
|
|
198
|
+
b = _e$pickedColors[2];
|
|
199
|
+
|
|
200
|
+
if (e.type === 'click') {
|
|
201
|
+
var restLayers = _this4.children.filter(function (child) {
|
|
202
|
+
return child.inited && child.isVisible() && child.isVector;
|
|
203
|
+
}).filter(function (child) {
|
|
204
|
+
return child !== e.layer;
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
_this4.setSelect(restLayers, [r, g, b]);
|
|
208
|
+
} else {
|
|
209
|
+
_this4.setHighlight([r, g, b]);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
this.tileLayerManager.tilePickManager.on('unpick', function () {
|
|
213
|
+
_this4.pickColors.active = null;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "setHighlight",
|
|
218
|
+
value: function setHighlight(pickedColors) {
|
|
219
|
+
var pickId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
220
|
+
this.pickColors.active = pickedColors;
|
|
221
|
+
this.children.filter(function (child) {
|
|
222
|
+
return child.inited && child.isVisible() && child.isVector;
|
|
223
|
+
}) // Tip: 使用 vectorLayer 上的 pickID 优化高亮操作(过滤重复操作)
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
.filter(function (child) {
|
|
226
|
+
return child.getPickID() !== pickId;
|
|
227
|
+
}).map(function (child) {
|
|
228
|
+
// @ts-ignore
|
|
229
|
+
child.setPickID(pickId);
|
|
230
|
+
child.hooks.beforeHighlight.call(pickedColors);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "setSelect",
|
|
235
|
+
value: function setSelect(layers, pickedColors) {
|
|
236
|
+
var _this5 = this;
|
|
237
|
+
|
|
238
|
+
var selectedId = (0, _l7Utils.decodePickingColor)(pickedColors);
|
|
239
|
+
layers.map(function (layer) {
|
|
240
|
+
if (layer.getCurrentSelectedId() === null || selectedId !== layer.getCurrentSelectedId()) {
|
|
241
|
+
_this5.selectFeature(layer, pickedColors);
|
|
242
|
+
|
|
243
|
+
layer.setCurrentSelectedId(selectedId);
|
|
244
|
+
_this5.pickColors.select = pickedColors;
|
|
245
|
+
} else {
|
|
246
|
+
_this5.selectFeature(layer, new Uint8Array([0, 0, 0, 0])); // toggle select
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
layer.setCurrentSelectedId(null);
|
|
250
|
+
_this5.pickColors.select = null;
|
|
251
|
+
}
|
|
252
|
+
}); // unselect normal layer
|
|
253
|
+
|
|
254
|
+
var renderList = this.layerService.getRenderList();
|
|
255
|
+
renderList.filter(function (layer) {
|
|
256
|
+
return layer.inited && !layer.isVector && layer.isVisible() && layer.needPick('click');
|
|
257
|
+
}).filter(function (layer) {
|
|
258
|
+
return layer.getCurrentSelectedId() !== null;
|
|
259
|
+
}).map(function (layer) {
|
|
260
|
+
_this5.selectFeature(layer, new Uint8Array([0, 0, 0, 0]));
|
|
261
|
+
|
|
262
|
+
layer.setCurrentSelectedId(null);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
key: "selectFeature",
|
|
267
|
+
value: function selectFeature(layer, pickedColors) {
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
270
|
+
r = _pickedColors[0],
|
|
271
|
+
g = _pickedColors[1],
|
|
272
|
+
b = _pickedColors[2];
|
|
273
|
+
|
|
274
|
+
layer.hooks.beforeSelect.call([r, g, b]);
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "bindSubLayerEvent",
|
|
278
|
+
value: function bindSubLayerEvent() {
|
|
279
|
+
var _this6 = this;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* layer.on('click', (ev) => {}); // 鼠标左键点击图层事件
|
|
283
|
+
* layer.on('mouseenter', (ev) => {}); // 鼠标进入图层要素
|
|
284
|
+
* layer.on('mousemove', (ev) => {}); // 鼠标在图层上移动时触发
|
|
285
|
+
* layer.on('mouseout', (ev) => {}); // 鼠标移出图层要素时触发
|
|
286
|
+
* layer.on('mouseup', (ev) => {}); // 鼠标在图层上单击抬起时触发
|
|
287
|
+
* layer.on('mousedown', (ev) => {}); // 鼠标在图层上单击按下时触发
|
|
288
|
+
* layer.on('contextmenu', (ev) => {}); // 图层要素点击右键菜单
|
|
289
|
+
*
|
|
290
|
+
* 鼠标在图层外的事件
|
|
291
|
+
* layer.on('unclick', (ev) => {}); // 图层外点击
|
|
292
|
+
* layer.on('unmousemove', (ev) => {}); // 图层外移动
|
|
293
|
+
* layer.on('unmouseup', (ev) => {}); // 图层外鼠标抬起
|
|
294
|
+
* layer.on('unmousedown', (ev) => {}); // 图层外单击按下时触发
|
|
295
|
+
* layer.on('uncontextmenu', (ev) => {}); // 图层外点击右键
|
|
296
|
+
* layer.on('unpick', (ev) => {}); // 图层外的操作的所有事件
|
|
297
|
+
*/
|
|
298
|
+
this.parent.on('subLayerClick', function (e) {
|
|
299
|
+
_this6.parent.emit('click', (0, _objectSpread2.default)({}, e));
|
|
300
|
+
});
|
|
301
|
+
this.parent.on('subLayerMouseMove', function (e) {
|
|
302
|
+
return _this6.parent.emit('mousemove', (0, _objectSpread2.default)({}, e));
|
|
303
|
+
});
|
|
304
|
+
this.parent.on('subLayerMouseUp', function (e) {
|
|
305
|
+
return _this6.parent.emit('mouseup', (0, _objectSpread2.default)({}, e));
|
|
306
|
+
});
|
|
307
|
+
this.parent.on('subLayerMouseEnter', function (e) {
|
|
308
|
+
return _this6.parent.emit('mouseenter', (0, _objectSpread2.default)({}, e));
|
|
309
|
+
});
|
|
310
|
+
this.parent.on('subLayerMouseOut', function (e) {
|
|
311
|
+
return _this6.parent.emit('mouseout', (0, _objectSpread2.default)({}, e));
|
|
312
|
+
});
|
|
313
|
+
this.parent.on('subLayerMouseDown', function (e) {
|
|
314
|
+
return _this6.parent.emit('mousedown', (0, _objectSpread2.default)({}, e));
|
|
315
|
+
});
|
|
316
|
+
this.parent.on('subLayerContextmenu', function (e) {
|
|
317
|
+
return _this6.parent.emit('contextmenu', (0, _objectSpread2.default)({}, e));
|
|
318
|
+
}); // vector layer 图层外事件
|
|
319
|
+
|
|
320
|
+
this.parent.on('subLayerUnClick', function (e) {
|
|
321
|
+
return _this6.parent.emit('unclick', (0, _objectSpread2.default)({}, e));
|
|
322
|
+
});
|
|
323
|
+
this.parent.on('subLayerUnMouseMove', function (e) {
|
|
324
|
+
return _this6.parent.emit('unmousemove', (0, _objectSpread2.default)({}, e));
|
|
325
|
+
});
|
|
326
|
+
this.parent.on('subLayerUnMouseUp', function (e) {
|
|
327
|
+
return _this6.parent.emit('unmouseup', (0, _objectSpread2.default)({}, e));
|
|
328
|
+
});
|
|
329
|
+
this.parent.on('subLayerUnMouseDown', function (e) {
|
|
330
|
+
return _this6.parent.emit('unmousedown', (0, _objectSpread2.default)({}, e));
|
|
331
|
+
});
|
|
332
|
+
this.parent.on('subLayerUnContextmenu', function (e) {
|
|
333
|
+
return _this6.parent.emit('uncontextmenu', (0, _objectSpread2.default)({}, e));
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
key: "initTileSetManager",
|
|
338
|
+
value: function initTileSetManager() {
|
|
339
|
+
var _this$tilesetManager;
|
|
340
|
+
|
|
341
|
+
var source = this.parent.getSource();
|
|
342
|
+
this.tilesetManager = source.tileset;
|
|
343
|
+
|
|
344
|
+
if (!this.initedTileset) {
|
|
345
|
+
this.bindTilesetEvent();
|
|
346
|
+
this.initedTileset = true;
|
|
205
347
|
}
|
|
348
|
+
|
|
349
|
+
var _this$getCurrentView = this.getCurrentView(),
|
|
350
|
+
latLonBounds = _this$getCurrentView.latLonBounds,
|
|
351
|
+
zoom = _this$getCurrentView.zoom;
|
|
352
|
+
|
|
353
|
+
(_this$tilesetManager = this.tilesetManager) === null || _this$tilesetManager === void 0 ? void 0 : _this$tilesetManager.update(zoom, latLonBounds);
|
|
206
354
|
}
|
|
207
|
-
|
|
208
|
-
|
|
355
|
+
}, {
|
|
356
|
+
key: "mapchange",
|
|
357
|
+
value: function mapchange() {
|
|
358
|
+
var _this$tilesetManager2;
|
|
359
|
+
|
|
360
|
+
var _this$getCurrentView2 = this.getCurrentView(),
|
|
361
|
+
latLonBounds = _this$getCurrentView2.latLonBounds,
|
|
362
|
+
zoom = _this$getCurrentView2.zoom;
|
|
363
|
+
|
|
364
|
+
if (this.mapService.version === 'GAODE1.x') {
|
|
365
|
+
var _this$parent$getLayer = this.parent.getLayerConfig(),
|
|
366
|
+
visible = _this$parent$getLayer.visible;
|
|
367
|
+
|
|
368
|
+
if (zoom < 3 && visible) {
|
|
369
|
+
this.parent.updateLayerConfig({
|
|
370
|
+
visible: false
|
|
371
|
+
});
|
|
372
|
+
this.layerService.updateLayerRenderList();
|
|
373
|
+
} else if (zoom >= 3 && !visible) {
|
|
374
|
+
this.parent.updateLayerConfig({
|
|
375
|
+
visible: true
|
|
376
|
+
});
|
|
377
|
+
this.layerService.updateLayerRenderList();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (this.lastViewStates && this.lastViewStates.zoom === zoom && this.lastViewStates.latLonBounds.toString() === latLonBounds.toString()) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
this.lastViewStates = {
|
|
386
|
+
zoom: zoom,
|
|
387
|
+
latLonBounds: latLonBounds
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
if (this.timer) {
|
|
391
|
+
clearTimeout(this.timer);
|
|
392
|
+
this.timer = null;
|
|
393
|
+
} // this.timer = setTimeout(() => {
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
(_this$tilesetManager2 = this.tilesetManager) === null || _this$tilesetManager2 === void 0 ? void 0 : _this$tilesetManager2.update(zoom, latLonBounds); // }, 250);
|
|
209
397
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
398
|
+
}, {
|
|
399
|
+
key: "bindTilesetEvent",
|
|
400
|
+
value: function bindTilesetEvent() {
|
|
401
|
+
var _this7 = this;
|
|
402
|
+
|
|
403
|
+
if (!this.tilesetManager) {
|
|
404
|
+
return;
|
|
405
|
+
} // 瓦片数据加载成功
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
this.tilesetManager.on('tile-loaded', function (tile) {// todo: 将事件抛出,图层上可以监听使用
|
|
409
|
+
}); // 瓦片数据从缓存删除或被执行重新加载
|
|
410
|
+
|
|
411
|
+
this.tilesetManager.on('tile-unload', function (tile) {
|
|
412
|
+
// todo: 将事件抛出,图层上可以监听使用
|
|
413
|
+
_this7.tileUnLoad(tile);
|
|
414
|
+
}); // 瓦片数据加载失败
|
|
415
|
+
|
|
416
|
+
this.tilesetManager.on('tile-error', function (error, tile) {
|
|
417
|
+
// todo: 将事件抛出,图层上可以监听使用
|
|
418
|
+
_this7.tileError(error);
|
|
419
|
+
}); // 瓦片显隐状态更新
|
|
420
|
+
|
|
421
|
+
this.tilesetManager.on('tile-update', function () {
|
|
422
|
+
_this7.tileUpdate();
|
|
423
|
+
}); // 地图视野发生改变
|
|
424
|
+
|
|
425
|
+
this.mapService.on('zoomend', function () {
|
|
426
|
+
return _this7.mapchange();
|
|
427
|
+
});
|
|
428
|
+
this.mapService.on('moveend', function () {
|
|
429
|
+
return _this7.mapchange();
|
|
430
|
+
});
|
|
214
431
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
432
|
+
}, {
|
|
433
|
+
key: "getCurrentView",
|
|
434
|
+
value: function getCurrentView() {
|
|
435
|
+
var bounds = this.mapService.getBounds();
|
|
436
|
+
var latLonBounds = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
|
|
437
|
+
var zoom = this.mapService.getZoom();
|
|
438
|
+
return {
|
|
439
|
+
latLonBounds: latLonBounds,
|
|
440
|
+
zoom: zoom
|
|
441
|
+
};
|
|
220
442
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
this.tilesetManager.on("tile-error", (error, tile) => {
|
|
227
|
-
this.tileError(error);
|
|
228
|
-
});
|
|
229
|
-
this.tilesetManager.on("tile-update", () => {
|
|
230
|
-
this.tileUpdate();
|
|
231
|
-
});
|
|
232
|
-
this.mapService.on("zoomend", () => this.mapchange());
|
|
233
|
-
this.mapService.on("moveend", () => this.mapchange());
|
|
234
|
-
}
|
|
235
|
-
getCurrentView() {
|
|
236
|
-
const bounds = this.mapService.getBounds();
|
|
237
|
-
const latLonBounds = [
|
|
238
|
-
bounds[0][0],
|
|
239
|
-
bounds[0][1],
|
|
240
|
-
bounds[1][0],
|
|
241
|
-
bounds[1][1]
|
|
242
|
-
];
|
|
243
|
-
const zoom = this.mapService.getZoom();
|
|
244
|
-
return { latLonBounds, zoom };
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
248
|
-
0 && (module.exports = {});
|
|
443
|
+
}]);
|
|
444
|
+
return BaseTileLayer;
|
|
445
|
+
}();
|
|
446
|
+
|
|
447
|
+
exports.default = BaseTileLayer;
|