@antv/l7-component 2.9.21 → 2.9.23
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/control/BaseControl.js +5 -26
- package/es/control/layer.js +13 -28
- package/es/control/logo.js +3 -4
- package/es/control/scale.js +6 -11
- package/es/control/zoom.js +3 -12
- package/es/css/l7.css +502 -0
- package/es/images/layers.png +0 -0
- package/es/images/layers.svg +1 -0
- package/es/images/logo.png +0 -0
- package/es/index.js +10 -10
- package/es/interface.js +1 -2
- package/es/marker-layer.js +27 -27
- package/es/marker.js +21 -27
- package/es/popup.js +16 -34
- package/es/utils/anchor.js +1 -2
- package/lib/control/BaseControl.js +100 -163
- package/lib/control/layer.js +248 -347
- package/lib/control/logo.js +52 -77
- package/lib/control/scale.js +112 -165
- package/lib/control/zoom.js +95 -143
- package/lib/css/l7.css +502 -0
- package/lib/images/layers.png +0 -0
- package/lib/images/layers.svg +1 -0
- package/lib/images/logo.png +0 -0
- package/lib/index.js +53 -135
- package/lib/interface.js +17 -2
- package/lib/marker-layer.js +224 -330
- package/lib/marker.js +271 -404
- package/lib/popup.js +201 -309
- package/lib/utils/anchor.js +54 -37
- package/package.json +9 -9
- package/es/control/BaseControl.js.map +0 -1
- package/es/control/layer.js.map +0 -1
- package/es/control/logo.js.map +0 -1
- package/es/control/scale.js.map +0 -1
- package/es/control/zoom.js.map +0 -1
- package/es/index.js.map +0 -1
- package/es/interface.js.map +0 -1
- package/es/marker-layer.js.map +0 -1
- package/es/marker.js.map +0 -1
- package/es/popup.js.map +0 -1
- package/es/utils/anchor.js.map +0 -1
- package/lib/control/BaseControl.js.map +0 -1
- package/lib/control/layer.js.map +0 -1
- package/lib/control/logo.js.map +0 -1
- package/lib/control/scale.js.map +0 -1
- package/lib/control/zoom.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interface.js.map +0 -1
- package/lib/marker-layer.js.map +0 -1
- package/lib/marker.js.map +0 -1
- package/lib/popup.js.map +0 -1
- package/lib/utils/anchor.js.map +0 -1
package/lib/marker-layer.js
CHANGED
|
@@ -1,344 +1,238 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/marker-layer.ts
|
|
23
|
+
var marker_layer_exports = {};
|
|
24
|
+
__export(marker_layer_exports, {
|
|
25
|
+
default: () => MarkerLayer
|
|
7
26
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _l7Core = require("@antv/l7-core");
|
|
27
|
-
|
|
28
|
-
var _l7Utils = require("@antv/l7-utils");
|
|
29
|
-
|
|
30
|
-
var _eventemitter = require("eventemitter3");
|
|
31
|
-
|
|
32
|
-
var _supercluster = _interopRequireDefault(require("supercluster/dist/supercluster"));
|
|
33
|
-
|
|
34
|
-
var _marker = _interopRequireDefault(require("./marker"));
|
|
35
|
-
|
|
36
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
-
|
|
38
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
-
|
|
40
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
|
-
|
|
42
|
-
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; } }
|
|
43
|
-
|
|
44
|
-
var MarkerLayer = function (_EventEmitter) {
|
|
45
|
-
(0, _inherits2.default)(MarkerLayer, _EventEmitter);
|
|
46
|
-
|
|
47
|
-
var _super = _createSuper(MarkerLayer);
|
|
48
|
-
|
|
49
|
-
function MarkerLayer(option) {
|
|
50
|
-
var _this$markerLayerOpti;
|
|
51
|
-
|
|
52
|
-
var _this;
|
|
53
|
-
|
|
54
|
-
(0, _classCallCheck2.default)(this, MarkerLayer);
|
|
55
|
-
_this = _super.call(this);
|
|
56
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "markers", []);
|
|
57
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "markerLayerOption", void 0);
|
|
58
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clusterIndex", void 0);
|
|
59
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "points", []);
|
|
60
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clusterMarkers", []);
|
|
61
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mapsService", void 0);
|
|
62
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scene", void 0);
|
|
63
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "zoom", void 0);
|
|
64
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "bbox", void 0);
|
|
65
|
-
_this.markerLayerOption = (0, _merge2.default)(_this.getDefault(), option);
|
|
66
|
-
(0, _l7Utils.bindAll)(['update'], (0, _assertThisInitialized2.default)(_this));
|
|
67
|
-
_this.zoom = ((_this$markerLayerOpti = _this.markerLayerOption.clusterOption) === null || _this$markerLayerOpti === void 0 ? void 0 : _this$markerLayerOpti.zoom) || -99;
|
|
68
|
-
return _this;
|
|
27
|
+
module.exports = __toCommonJS(marker_layer_exports);
|
|
28
|
+
var import_l7_core = require("@antv/l7-core");
|
|
29
|
+
var import_l7_utils = require("@antv/l7-utils");
|
|
30
|
+
var import_eventemitter3 = require("eventemitter3");
|
|
31
|
+
var import_lodash = require("lodash");
|
|
32
|
+
var import_supercluster = __toESM(require("supercluster/dist/supercluster"));
|
|
33
|
+
var import_marker = __toESM(require("./marker"));
|
|
34
|
+
var MarkerLayer = class extends import_eventemitter3.EventEmitter {
|
|
35
|
+
constructor(option) {
|
|
36
|
+
var _a;
|
|
37
|
+
super();
|
|
38
|
+
this.markers = [];
|
|
39
|
+
this.points = [];
|
|
40
|
+
this.clusterMarkers = [];
|
|
41
|
+
this.markerLayerOption = (0, import_lodash.merge)(this.getDefault(), option);
|
|
42
|
+
(0, import_l7_utils.bindAll)(["update"], this);
|
|
43
|
+
this.zoom = ((_a = this.markerLayerOption.clusterOption) == null ? void 0 : _a.zoom) || -99;
|
|
69
44
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
zoom: -99,
|
|
81
|
-
style: {},
|
|
82
|
-
className: ''
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "addTo",
|
|
88
|
-
value: function addTo(scene) {
|
|
89
|
-
this.scene = scene;
|
|
90
|
-
this.mapsService = scene.get(_l7Core.TYPES.IMapService);
|
|
91
|
-
|
|
92
|
-
if (this.markerLayerOption.cluster) {
|
|
93
|
-
this.initCluster();
|
|
94
|
-
this.update();
|
|
95
|
-
this.mapsService.on('camerachange', this.update);
|
|
96
|
-
this.mapsService.on('viewchange', this.update);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this.addMarkers();
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
key: "addMarker",
|
|
104
|
-
value: function addMarker(marker) {
|
|
105
|
-
var cluster = this.markerLayerOption.cluster;
|
|
106
|
-
|
|
107
|
-
if (cluster) {
|
|
108
|
-
this.addPoint(marker, this.markers.length);
|
|
109
|
-
|
|
110
|
-
if (this.mapsService) {
|
|
111
|
-
var zoom = this.mapsService.getZoom();
|
|
112
|
-
var bbox = this.mapsService.getBounds();
|
|
113
|
-
this.bbox = (0, _l7Utils.padBounds)(bbox, 0.5);
|
|
114
|
-
this.zoom = Math.floor(zoom);
|
|
115
|
-
this.getClusterMarker(this.bbox, this.zoom);
|
|
116
|
-
}
|
|
45
|
+
getDefault() {
|
|
46
|
+
return {
|
|
47
|
+
cluster: false,
|
|
48
|
+
clusterOption: {
|
|
49
|
+
radius: 80,
|
|
50
|
+
maxZoom: 20,
|
|
51
|
+
minZoom: 0,
|
|
52
|
+
zoom: -99,
|
|
53
|
+
style: {},
|
|
54
|
+
className: ""
|
|
117
55
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
addTo(scene) {
|
|
59
|
+
this.scene = scene;
|
|
60
|
+
this.mapsService = scene.get(import_l7_core.TYPES.IMapService);
|
|
61
|
+
if (this.markerLayerOption.cluster) {
|
|
62
|
+
this.initCluster();
|
|
63
|
+
this.update();
|
|
64
|
+
this.mapsService.on("camerachange", this.update);
|
|
65
|
+
this.mapsService.on("viewchange", this.update);
|
|
66
|
+
}
|
|
67
|
+
this.addMarkers();
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
addMarker(marker) {
|
|
71
|
+
const cluster = this.markerLayerOption.cluster;
|
|
72
|
+
if (cluster) {
|
|
73
|
+
this.addPoint(marker, this.markers.length);
|
|
74
|
+
if (this.mapsService) {
|
|
75
|
+
const zoom = this.mapsService.getZoom();
|
|
76
|
+
const bbox = this.mapsService.getBounds();
|
|
77
|
+
this.bbox = (0, import_l7_utils.padBounds)(bbox, 0.5);
|
|
78
|
+
this.zoom = Math.floor(zoom);
|
|
79
|
+
this.getClusterMarker(this.bbox, this.zoom);
|
|
129
80
|
}
|
|
130
81
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.
|
|
138
|
-
m.getElement().style.opacity = '0';
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "show",
|
|
143
|
-
value: function show() {
|
|
144
|
-
this.markers.map(function (m) {
|
|
145
|
-
m.getElement().style.opacity = '1';
|
|
146
|
-
});
|
|
147
|
-
this.clusterMarkers.map(function (m) {
|
|
148
|
-
m.getElement().style.opacity = '1';
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
key: "getMarkers",
|
|
153
|
-
value: function getMarkers() {
|
|
154
|
-
var cluster = this.markerLayerOption.cluster;
|
|
155
|
-
return cluster ? this.clusterMarkers : this.markers;
|
|
156
|
-
}
|
|
157
|
-
}, {
|
|
158
|
-
key: "addMarkers",
|
|
159
|
-
value: function addMarkers() {
|
|
160
|
-
var _this2 = this;
|
|
161
|
-
|
|
162
|
-
this.getMarkers().forEach(function (marker) {
|
|
163
|
-
marker.addTo(_this2.scene);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}, {
|
|
167
|
-
key: "clear",
|
|
168
|
-
value: function clear() {
|
|
169
|
-
this.markers.forEach(function (marker) {
|
|
170
|
-
marker.remove();
|
|
171
|
-
});
|
|
172
|
-
this.clusterMarkers.forEach(function (clusterMarker) {
|
|
173
|
-
clusterMarker.remove();
|
|
174
|
-
});
|
|
175
|
-
this.mapsService.off('camerachange', this.update);
|
|
176
|
-
this.markers = [];
|
|
177
|
-
this.clusterMarkers = [];
|
|
178
|
-
}
|
|
179
|
-
}, {
|
|
180
|
-
key: "destroy",
|
|
181
|
-
value: function destroy() {
|
|
182
|
-
this.clear();
|
|
183
|
-
this.removeAllListeners();
|
|
184
|
-
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "addPoint",
|
|
187
|
-
value: function addPoint(marker, id) {
|
|
188
|
-
var _marker$getLnglat = marker.getLnglat(),
|
|
189
|
-
lng = _marker$getLnglat.lng,
|
|
190
|
-
lat = _marker$getLnglat.lat;
|
|
191
|
-
|
|
192
|
-
var feature = {
|
|
193
|
-
geometry: {
|
|
194
|
-
type: 'Point',
|
|
195
|
-
coordinates: [lng, lat]
|
|
196
|
-
},
|
|
197
|
-
properties: _objectSpread(_objectSpread({}, marker.getExtData()), {}, {
|
|
198
|
-
marker_id: id
|
|
199
|
-
})
|
|
200
|
-
};
|
|
201
|
-
this.points.push(feature);
|
|
202
|
-
|
|
203
|
-
if (this.clusterIndex) {
|
|
204
|
-
this.clusterIndex.load(this.points);
|
|
205
|
-
}
|
|
82
|
+
this.markers.push(marker);
|
|
83
|
+
}
|
|
84
|
+
removeMarker(marker) {
|
|
85
|
+
this.markers.indexOf(marker);
|
|
86
|
+
const markerIndex = this.markers.indexOf(marker);
|
|
87
|
+
if (markerIndex > -1) {
|
|
88
|
+
this.markers.splice(markerIndex, 1);
|
|
206
89
|
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
90
|
+
}
|
|
91
|
+
hide() {
|
|
92
|
+
this.markers.map((m) => {
|
|
93
|
+
m.getElement().style.opacity = "0";
|
|
94
|
+
});
|
|
95
|
+
this.clusterMarkers.map((m) => {
|
|
96
|
+
m.getElement().style.opacity = "0";
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
show() {
|
|
100
|
+
this.markers.map((m) => {
|
|
101
|
+
m.getElement().style.opacity = "1";
|
|
102
|
+
});
|
|
103
|
+
this.clusterMarkers.map((m) => {
|
|
104
|
+
m.getElement().style.opacity = "1";
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
getMarkers() {
|
|
108
|
+
const cluster = this.markerLayerOption.cluster;
|
|
109
|
+
return cluster ? this.clusterMarkers : this.markers;
|
|
110
|
+
}
|
|
111
|
+
addMarkers() {
|
|
112
|
+
this.getMarkers().forEach((marker) => {
|
|
113
|
+
marker.addTo(this.scene);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
clear() {
|
|
117
|
+
this.markers.forEach((marker) => {
|
|
118
|
+
marker.remove();
|
|
119
|
+
});
|
|
120
|
+
this.clusterMarkers.forEach((clusterMarker) => {
|
|
121
|
+
clusterMarker.remove();
|
|
122
|
+
});
|
|
123
|
+
this.mapsService.off("camerachange", this.update);
|
|
124
|
+
this.markers = [];
|
|
125
|
+
this.clusterMarkers = [];
|
|
126
|
+
}
|
|
127
|
+
destroy() {
|
|
128
|
+
this.clear();
|
|
129
|
+
this.removeAllListeners();
|
|
130
|
+
}
|
|
131
|
+
addPoint(marker, id) {
|
|
132
|
+
const { lng, lat } = marker.getLnglat();
|
|
133
|
+
const feature = {
|
|
134
|
+
geometry: {
|
|
135
|
+
type: "Point",
|
|
136
|
+
coordinates: [lng, lat]
|
|
137
|
+
},
|
|
138
|
+
properties: {
|
|
139
|
+
...marker.getExtData(),
|
|
140
|
+
marker_id: id
|
|
212
141
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
_ref$minZoom = _ref.minZoom,
|
|
217
|
-
minZoom = _ref$minZoom === void 0 ? 0 : _ref$minZoom,
|
|
218
|
-
maxZoom = _ref.maxZoom;
|
|
219
|
-
this.clusterIndex = new _supercluster.default({
|
|
220
|
-
radius: radius,
|
|
221
|
-
minZoom: minZoom,
|
|
222
|
-
maxZoom: maxZoom
|
|
223
|
-
});
|
|
142
|
+
};
|
|
143
|
+
this.points.push(feature);
|
|
144
|
+
if (this.clusterIndex) {
|
|
224
145
|
this.clusterIndex.load(this.points);
|
|
225
146
|
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
147
|
+
}
|
|
148
|
+
initCluster() {
|
|
149
|
+
if (!this.markerLayerOption.cluster) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const { radius, minZoom = 0, maxZoom } = this.markerLayerOption.clusterOption;
|
|
153
|
+
this.clusterIndex = new import_supercluster.default({
|
|
154
|
+
radius,
|
|
155
|
+
minZoom,
|
|
156
|
+
maxZoom
|
|
157
|
+
});
|
|
158
|
+
this.clusterIndex.load(this.points);
|
|
159
|
+
}
|
|
160
|
+
getClusterMarker(viewBounds, zoom) {
|
|
161
|
+
const viewBBox = viewBounds[0].concat(viewBounds[1]);
|
|
162
|
+
const clusterPoint = this.clusterIndex.getClusters(viewBBox, zoom);
|
|
163
|
+
this.clusterMarkers.forEach((marker) => {
|
|
164
|
+
marker.remove();
|
|
165
|
+
});
|
|
166
|
+
this.clusterMarkers = [];
|
|
167
|
+
clusterPoint.forEach((feature) => {
|
|
168
|
+
var _a, _b;
|
|
169
|
+
const { field, method } = this.markerLayerOption.clusterOption;
|
|
170
|
+
if (feature.properties && ((_a = feature.properties) == null ? void 0 : _a.cluster_id)) {
|
|
171
|
+
const clusterData = this.getLeaves((_b = feature.properties) == null ? void 0 : _b.cluster_id);
|
|
172
|
+
feature.properties.clusterData = clusterData;
|
|
173
|
+
if (field && method) {
|
|
174
|
+
const columnData = clusterData == null ? void 0 : clusterData.map((item) => {
|
|
175
|
+
const data = {
|
|
176
|
+
[field]: item.properties[field]
|
|
177
|
+
};
|
|
178
|
+
return data;
|
|
179
|
+
});
|
|
180
|
+
const column = import_l7_utils.Satistics.getColumn(columnData, field);
|
|
181
|
+
const stat = import_l7_utils.Satistics.getSatByColumn(method, column);
|
|
182
|
+
const fieldName = "point_" + method;
|
|
183
|
+
feature.properties[fieldName] = stat.toFixed(2);
|
|
264
184
|
}
|
|
265
|
-
|
|
266
|
-
var marker = _this3.clusterMarker(feature);
|
|
267
|
-
|
|
268
|
-
_this3.clusterMarkers.push(marker);
|
|
269
|
-
|
|
270
|
-
marker.addTo(_this3.scene);
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
key: "getLeaves",
|
|
275
|
-
value: function getLeaves(clusterId) {
|
|
276
|
-
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
|
277
|
-
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
278
|
-
|
|
279
|
-
if (!clusterId) {
|
|
280
|
-
return null;
|
|
281
185
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
_ref2$element = _ref2.element,
|
|
291
|
-
element = _ref2$element === void 0 ? this.generateElement.bind(this) : _ref2$element;
|
|
292
|
-
var marker = new _marker.default({
|
|
293
|
-
element: element(feature)
|
|
294
|
-
}).setLnglat({
|
|
295
|
-
lng: feature.geometry.coordinates[0],
|
|
296
|
-
lat: feature.geometry.coordinates[1]
|
|
297
|
-
});
|
|
298
|
-
return marker;
|
|
299
|
-
}
|
|
300
|
-
}, {
|
|
301
|
-
key: "normalMarker",
|
|
302
|
-
value: function normalMarker(feature) {
|
|
303
|
-
var marker_id = feature.properties.marker_id;
|
|
304
|
-
return this.markers[marker_id];
|
|
186
|
+
const marker = this.clusterMarker(feature);
|
|
187
|
+
this.clusterMarkers.push(marker);
|
|
188
|
+
marker.addTo(this.scene);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
getLeaves(clusterId, limit = Infinity, offset = 0) {
|
|
192
|
+
if (!clusterId) {
|
|
193
|
+
return null;
|
|
305
194
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
195
|
+
return this.clusterIndex.getLeaves(clusterId, limit, offset);
|
|
196
|
+
}
|
|
197
|
+
clusterMarker(feature) {
|
|
198
|
+
const clusterOption = this.markerLayerOption.clusterOption;
|
|
199
|
+
const {
|
|
200
|
+
element = this.generateElement.bind(this)
|
|
201
|
+
} = clusterOption;
|
|
202
|
+
const marker = new import_marker.default({
|
|
203
|
+
element: element(feature)
|
|
204
|
+
}).setLnglat({
|
|
205
|
+
lng: feature.geometry.coordinates[0],
|
|
206
|
+
lat: feature.geometry.coordinates[1]
|
|
207
|
+
});
|
|
208
|
+
return marker;
|
|
209
|
+
}
|
|
210
|
+
normalMarker(feature) {
|
|
211
|
+
const marker_id = feature.properties.marker_id;
|
|
212
|
+
return this.markers[marker_id];
|
|
213
|
+
}
|
|
214
|
+
update() {
|
|
215
|
+
if (!this.mapsService) {
|
|
216
|
+
return;
|
|
321
217
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
var span = _l7Utils.DOM.create('span', '', label);
|
|
330
|
-
|
|
331
|
-
var _this$markerLayerOpti2 = this.markerLayerOption.clusterOption,
|
|
332
|
-
field = _this$markerLayerOpti2.field,
|
|
333
|
-
method = _this$markerLayerOpti2.method;
|
|
334
|
-
feature.properties.point_count = feature.properties.point_count || 1;
|
|
335
|
-
var text = field && method ? feature.properties['point_' + method] || feature.properties[field] : feature.properties.point_count;
|
|
336
|
-
span.textContent = text;
|
|
337
|
-
return el;
|
|
218
|
+
const zoom = this.mapsService.getZoom();
|
|
219
|
+
const bbox = this.mapsService.getBounds();
|
|
220
|
+
if (!this.bbox || Math.abs(zoom - this.zoom) >= 1 || !(0, import_l7_utils.boundsContains)(this.bbox, bbox)) {
|
|
221
|
+
this.bbox = (0, import_l7_utils.padBounds)(bbox, 0.5);
|
|
222
|
+
this.zoom = Math.floor(zoom);
|
|
223
|
+
this.getClusterMarker(this.bbox, this.zoom);
|
|
338
224
|
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
225
|
+
}
|
|
226
|
+
generateElement(feature) {
|
|
227
|
+
const el = import_l7_utils.DOM.create("div", "l7-marker-cluster");
|
|
228
|
+
const label = import_l7_utils.DOM.create("div", "", el);
|
|
229
|
+
const span = import_l7_utils.DOM.create("span", "", label);
|
|
230
|
+
const { field, method } = this.markerLayerOption.clusterOption;
|
|
231
|
+
feature.properties.point_count = feature.properties.point_count || 1;
|
|
232
|
+
const text = field && method ? feature.properties["point_" + method] || feature.properties[field] : feature.properties.point_count;
|
|
233
|
+
span.textContent = text;
|
|
234
|
+
return el;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
238
|
+
0 && (module.exports = {});
|