@mint-ui/map 0.3.0-beta → 0.3.2-beta
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/dist/components/mint-map/core/util/cluster.d.ts +1 -1
- package/dist/components/mint-map/core/util/cluster.js +137 -0
- package/dist/components/mint-map/core/util/index.d.ts +1 -0
- package/dist/index.es.js +131 -1
- package/dist/index.js +2 -0
- package/dist/index.umd.js +131 -0
- package/package.json +1 -1
|
@@ -15,4 +15,4 @@ export interface ClusterStatus {
|
|
|
15
15
|
max: number;
|
|
16
16
|
}
|
|
17
17
|
export declare type ClusterSizeCalculator = (info: ClusterInfo, status: ClusterStatus) => number;
|
|
18
|
-
export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) =>
|
|
18
|
+
export declare const getClusterInfo: (basePixelSize: number, mapBounds: Bounds, mapWidth: number, mapHeight: number, itemList: Position[], sizeFunction?: ClusterSizeCalculator) => ClusterInfo[];
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var MintMap = require('../../MintMap.js');
|
|
6
|
+
|
|
7
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
8
|
+
var _a;
|
|
9
|
+
|
|
10
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
11
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1;
|
|
12
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
13
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7));
|
|
14
|
+
var boundsPos = [];
|
|
15
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
16
|
+
|
|
17
|
+
for (var i = 0; i < rowCount; i++) {
|
|
18
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
19
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
20
|
+
var rows = [];
|
|
21
|
+
boundsPos.push(rows);
|
|
22
|
+
|
|
23
|
+
for (var k = 0; k < colCount; k++) {
|
|
24
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
25
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
26
|
+
var thisBounds = MintMap.Bounds.fromNWSE(new MintMap.Position(tempY1, tempX1), new MintMap.Position(tempY2, tempX2));
|
|
27
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
28
|
+
rows.push({
|
|
29
|
+
bounds: thisBounds,
|
|
30
|
+
checked: false,
|
|
31
|
+
center: false,
|
|
32
|
+
centerPosition: thisBounds.getCenter(),
|
|
33
|
+
incList: [],
|
|
34
|
+
itemList: includedList,
|
|
35
|
+
size: basePixelSize
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var centerList = [];
|
|
41
|
+
var totalItemCount = 0;
|
|
42
|
+
var min;
|
|
43
|
+
var max;
|
|
44
|
+
|
|
45
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
46
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
47
|
+
var curr = boundsPos[i][k];
|
|
48
|
+
if (curr.checked) continue;
|
|
49
|
+
curr.checked = true;
|
|
50
|
+
var incList = [];
|
|
51
|
+
|
|
52
|
+
if (boundsPos[i]) {
|
|
53
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
54
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (boundsPos[i - 1]) {
|
|
58
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
59
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
60
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (boundsPos[i + 1]) {
|
|
64
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
65
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
66
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
70
|
+
var inc = incList_1[_i];
|
|
71
|
+
if (inc.checked) continue;
|
|
72
|
+
inc.checked = true;
|
|
73
|
+
|
|
74
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
75
|
+
curr.incList.push(inc);
|
|
76
|
+
|
|
77
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
78
|
+
|
|
79
|
+
curr.center = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (curr.center) {
|
|
84
|
+
centerList.push(curr);
|
|
85
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
86
|
+
return item.lat;
|
|
87
|
+
}));
|
|
88
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
89
|
+
return item.lng;
|
|
90
|
+
}));
|
|
91
|
+
curr.centerPosition = new MintMap.Position(avrLat, avrLng);
|
|
92
|
+
totalItemCount += curr.itemList.length;
|
|
93
|
+
|
|
94
|
+
if (!min || curr.itemList.length < min) {
|
|
95
|
+
min = curr.itemList.length;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!max || curr.itemList.length > max) {
|
|
99
|
+
max = curr.itemList.length;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var status = {
|
|
106
|
+
total: totalItemCount,
|
|
107
|
+
average: totalItemCount / centerList.length,
|
|
108
|
+
min: min,
|
|
109
|
+
max: max
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
113
|
+
var minSize = basePixelSize / 4;
|
|
114
|
+
var maxSize = basePixelSize;
|
|
115
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
119
|
+
var center = centerList_1[_b];
|
|
120
|
+
center.size = sizeFunction(center, status);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return centerList;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
var calculateAverage = function (nums) {
|
|
127
|
+
var sum = 0;
|
|
128
|
+
|
|
129
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
130
|
+
var num = nums_1[_i];
|
|
131
|
+
sum += num;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return Number((sum / nums.length).toFixed(7));
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
exports.getClusterInfo = getClusterInfo;
|
package/dist/index.es.js
CHANGED
|
@@ -2167,6 +2167,136 @@ function MapBuildingProjection(props) {
|
|
|
2167
2167
|
}, "".concat(title, " (").concat(numberOfFloor, "\uCE35)")))));
|
|
2168
2168
|
}
|
|
2169
2169
|
|
|
2170
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
2171
|
+
var _a;
|
|
2172
|
+
|
|
2173
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
2174
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1;
|
|
2175
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
2176
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7));
|
|
2177
|
+
var boundsPos = [];
|
|
2178
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
2179
|
+
|
|
2180
|
+
for (var i = 0; i < rowCount; i++) {
|
|
2181
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
2182
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
2183
|
+
var rows = [];
|
|
2184
|
+
boundsPos.push(rows);
|
|
2185
|
+
|
|
2186
|
+
for (var k = 0; k < colCount; k++) {
|
|
2187
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
2188
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
2189
|
+
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
2190
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
2191
|
+
rows.push({
|
|
2192
|
+
bounds: thisBounds,
|
|
2193
|
+
checked: false,
|
|
2194
|
+
center: false,
|
|
2195
|
+
centerPosition: thisBounds.getCenter(),
|
|
2196
|
+
incList: [],
|
|
2197
|
+
itemList: includedList,
|
|
2198
|
+
size: basePixelSize
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
var centerList = [];
|
|
2204
|
+
var totalItemCount = 0;
|
|
2205
|
+
var min;
|
|
2206
|
+
var max;
|
|
2207
|
+
|
|
2208
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
2209
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
2210
|
+
var curr = boundsPos[i][k];
|
|
2211
|
+
if (curr.checked) continue;
|
|
2212
|
+
curr.checked = true;
|
|
2213
|
+
var incList = [];
|
|
2214
|
+
|
|
2215
|
+
if (boundsPos[i]) {
|
|
2216
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
2217
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
if (boundsPos[i - 1]) {
|
|
2221
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
2222
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
2223
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
if (boundsPos[i + 1]) {
|
|
2227
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
2228
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
2229
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
2233
|
+
var inc = incList_1[_i];
|
|
2234
|
+
if (inc.checked) continue;
|
|
2235
|
+
inc.checked = true;
|
|
2236
|
+
|
|
2237
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
2238
|
+
curr.incList.push(inc);
|
|
2239
|
+
|
|
2240
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
2241
|
+
|
|
2242
|
+
curr.center = true;
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
if (curr.center) {
|
|
2247
|
+
centerList.push(curr);
|
|
2248
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
2249
|
+
return item.lat;
|
|
2250
|
+
}));
|
|
2251
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
2252
|
+
return item.lng;
|
|
2253
|
+
}));
|
|
2254
|
+
curr.centerPosition = new Position(avrLat, avrLng);
|
|
2255
|
+
totalItemCount += curr.itemList.length;
|
|
2256
|
+
|
|
2257
|
+
if (!min || curr.itemList.length < min) {
|
|
2258
|
+
min = curr.itemList.length;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
if (!max || curr.itemList.length > max) {
|
|
2262
|
+
max = curr.itemList.length;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
var status = {
|
|
2269
|
+
total: totalItemCount,
|
|
2270
|
+
average: totalItemCount / centerList.length,
|
|
2271
|
+
min: min,
|
|
2272
|
+
max: max
|
|
2273
|
+
};
|
|
2274
|
+
|
|
2275
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
2276
|
+
var minSize = basePixelSize / 4;
|
|
2277
|
+
var maxSize = basePixelSize;
|
|
2278
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
2279
|
+
};
|
|
2280
|
+
|
|
2281
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
2282
|
+
var center = centerList_1[_b];
|
|
2283
|
+
center.size = sizeFunction(center, status);
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
return centerList;
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
var calculateAverage = function (nums) {
|
|
2290
|
+
var sum = 0;
|
|
2291
|
+
|
|
2292
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
2293
|
+
var num = nums_1[_i];
|
|
2294
|
+
sum += num;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
return Number((sum / nums.length).toFixed(7));
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2170
2300
|
var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n position: absolute;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
|
|
2171
2301
|
var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
|
|
2172
2302
|
styleInject(css_248z);
|
|
@@ -2263,4 +2393,4 @@ function MapPolylineWrapper(_a) {
|
|
|
2263
2393
|
return React.createElement(React.Fragment, null, options && children);
|
|
2264
2394
|
}
|
|
2265
2395
|
|
|
2266
|
-
export { AnimationPlayer, Bounds, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapControlWrapper, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, Marker, MintMap, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, Polygon, PolygonCalculator, Polyline, Position, useMarkerMoving, useMintMapController, waiting };
|
|
2396
|
+
export { AnimationPlayer, Bounds, Drawable, GeoCalulator, GoogleMintMapController, MapBuildingProjection, MapControlWrapper, MapMarkerWrapper, MapPolygonWrapper, MapPolylineWrapper, Marker, MintMap, MintMapController, MintMapCore, MintMapProvider, NaverMintMapController, Offset, Polygon, PolygonCalculator, Polyline, Position, getClusterInfo, useMarkerMoving, useMintMapController, waiting };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var MintMapProvider = require('./components/mint-map/core/provider/MintMapProvid
|
|
|
11
11
|
var animation = require('./components/mint-map/core/util/animation.js');
|
|
12
12
|
var calculate = require('./components/mint-map/core/util/calculate.js');
|
|
13
13
|
var waiting = require('./components/mint-map/core/util/waiting.js');
|
|
14
|
+
var cluster = require('./components/mint-map/core/util/cluster.js');
|
|
14
15
|
var MapControlWrapper = require('./components/mint-map/core/wrapper/MapControlWrapper.js');
|
|
15
16
|
var MapMarkerWrapper = require('./components/mint-map/core/wrapper/MapMarkerWrapper.js');
|
|
16
17
|
var MapPolygonWrapper = require('./components/mint-map/core/wrapper/MapPolygonWrapper.js');
|
|
@@ -38,6 +39,7 @@ exports.AnimationPlayer = animation.AnimationPlayer;
|
|
|
38
39
|
exports.GeoCalulator = calculate.GeoCalulator;
|
|
39
40
|
exports.PolygonCalculator = calculate.PolygonCalculator;
|
|
40
41
|
exports.waiting = waiting.waiting;
|
|
42
|
+
exports.getClusterInfo = cluster.getClusterInfo;
|
|
41
43
|
exports.MapControlWrapper = MapControlWrapper.MapControlWrapper;
|
|
42
44
|
exports.MapMarkerWrapper = MapMarkerWrapper.MapMarkerWrapper;
|
|
43
45
|
exports.MapPolygonWrapper = MapPolygonWrapper.MapPolygonWrapper;
|
package/dist/index.umd.js
CHANGED
|
@@ -2172,6 +2172,136 @@
|
|
|
2172
2172
|
}, "".concat(title, " (").concat(numberOfFloor, "\uCE35)")))));
|
|
2173
2173
|
}
|
|
2174
2174
|
|
|
2175
|
+
var getClusterInfo = function (basePixelSize, mapBounds, mapWidth, mapHeight, itemList, sizeFunction) {
|
|
2176
|
+
var _a;
|
|
2177
|
+
|
|
2178
|
+
var rowCount = Number((mapWidth / basePixelSize).toFixed(0)) || 1;
|
|
2179
|
+
var colCount = Number((mapHeight / basePixelSize).toFixed(0)) || 1;
|
|
2180
|
+
var boundsLineSizeX = Number(((mapBounds.ne.lng - mapBounds.nw.lng) / rowCount).toFixed(7));
|
|
2181
|
+
var boundsLineSizeY = Number(((mapBounds.nw.lat - mapBounds.se.lat) / colCount).toFixed(7));
|
|
2182
|
+
var boundsPos = [];
|
|
2183
|
+
var tempX1, tempY1, tempX2, tempY2;
|
|
2184
|
+
|
|
2185
|
+
for (var i = 0; i < rowCount; i++) {
|
|
2186
|
+
tempX1 = mapBounds.nw.lng + boundsLineSizeX * i;
|
|
2187
|
+
tempX2 = mapBounds.nw.lng + boundsLineSizeX * (i + 1);
|
|
2188
|
+
var rows = [];
|
|
2189
|
+
boundsPos.push(rows);
|
|
2190
|
+
|
|
2191
|
+
for (var k = 0; k < colCount; k++) {
|
|
2192
|
+
tempY2 = mapBounds.se.lat + boundsLineSizeY * k;
|
|
2193
|
+
tempY1 = mapBounds.se.lat + boundsLineSizeY * (k + 1);
|
|
2194
|
+
var thisBounds = Bounds.fromNWSE(new Position(tempY1, tempX1), new Position(tempY2, tempX2));
|
|
2195
|
+
var includedList = thisBounds.getIncludedPositions(itemList);
|
|
2196
|
+
rows.push({
|
|
2197
|
+
bounds: thisBounds,
|
|
2198
|
+
checked: false,
|
|
2199
|
+
center: false,
|
|
2200
|
+
centerPosition: thisBounds.getCenter(),
|
|
2201
|
+
incList: [],
|
|
2202
|
+
itemList: includedList,
|
|
2203
|
+
size: basePixelSize
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
var centerList = [];
|
|
2209
|
+
var totalItemCount = 0;
|
|
2210
|
+
var min;
|
|
2211
|
+
var max;
|
|
2212
|
+
|
|
2213
|
+
for (var i = 0; i < boundsPos.length; i++) {
|
|
2214
|
+
for (var k = 0; k < boundsPos[i].length; k++) {
|
|
2215
|
+
var curr = boundsPos[i][k];
|
|
2216
|
+
if (curr.checked) continue;
|
|
2217
|
+
curr.checked = true;
|
|
2218
|
+
var incList = [];
|
|
2219
|
+
|
|
2220
|
+
if (boundsPos[i]) {
|
|
2221
|
+
boundsPos[i][k - 1] && incList.push(boundsPos[i][k - 1]);
|
|
2222
|
+
boundsPos[i][k + 1] && incList.push(boundsPos[i][k + 1]);
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
if (boundsPos[i - 1]) {
|
|
2226
|
+
boundsPos[i - 1][k - 1] && incList.push(boundsPos[i - 1][k - 1]);
|
|
2227
|
+
boundsPos[i - 1][k] && incList.push(boundsPos[i - 1][k]);
|
|
2228
|
+
boundsPos[i - 1][k + 1] && incList.push(boundsPos[i - 1][k + 1]);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
if (boundsPos[i + 1]) {
|
|
2232
|
+
boundsPos[i + 1][k + 1] && incList.push(boundsPos[i + 1][k + 1]);
|
|
2233
|
+
boundsPos[i + 1][k] && incList.push(boundsPos[i + 1][k]);
|
|
2234
|
+
boundsPos[i + 1][k - 1] && incList.push(boundsPos[i + 1][k - 1]);
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
for (var _i = 0, incList_1 = incList; _i < incList_1.length; _i++) {
|
|
2238
|
+
var inc = incList_1[_i];
|
|
2239
|
+
if (inc.checked) continue;
|
|
2240
|
+
inc.checked = true;
|
|
2241
|
+
|
|
2242
|
+
if (inc.itemList && inc.itemList.length > 0) {
|
|
2243
|
+
curr.incList.push(inc);
|
|
2244
|
+
|
|
2245
|
+
(_a = curr.itemList).push.apply(_a, inc.itemList);
|
|
2246
|
+
|
|
2247
|
+
curr.center = true;
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
if (curr.center) {
|
|
2252
|
+
centerList.push(curr);
|
|
2253
|
+
var avrLat = calculateAverage(curr.itemList.map(function (item) {
|
|
2254
|
+
return item.lat;
|
|
2255
|
+
}));
|
|
2256
|
+
var avrLng = calculateAverage(curr.itemList.map(function (item) {
|
|
2257
|
+
return item.lng;
|
|
2258
|
+
}));
|
|
2259
|
+
curr.centerPosition = new Position(avrLat, avrLng);
|
|
2260
|
+
totalItemCount += curr.itemList.length;
|
|
2261
|
+
|
|
2262
|
+
if (!min || curr.itemList.length < min) {
|
|
2263
|
+
min = curr.itemList.length;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
if (!max || curr.itemList.length > max) {
|
|
2267
|
+
max = curr.itemList.length;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
var status = {
|
|
2274
|
+
total: totalItemCount,
|
|
2275
|
+
average: totalItemCount / centerList.length,
|
|
2276
|
+
min: min,
|
|
2277
|
+
max: max
|
|
2278
|
+
};
|
|
2279
|
+
|
|
2280
|
+
sizeFunction = sizeFunction || function (info, status) {
|
|
2281
|
+
var minSize = basePixelSize / 4;
|
|
2282
|
+
var maxSize = basePixelSize;
|
|
2283
|
+
return Math.min(Math.max(basePixelSize * info.itemList.length / status.average, minSize), maxSize);
|
|
2284
|
+
};
|
|
2285
|
+
|
|
2286
|
+
for (var _b = 0, centerList_1 = centerList; _b < centerList_1.length; _b++) {
|
|
2287
|
+
var center = centerList_1[_b];
|
|
2288
|
+
center.size = sizeFunction(center, status);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
return centerList;
|
|
2292
|
+
};
|
|
2293
|
+
|
|
2294
|
+
var calculateAverage = function (nums) {
|
|
2295
|
+
var sum = 0;
|
|
2296
|
+
|
|
2297
|
+
for (var _i = 0, nums_1 = nums; _i < nums_1.length; _i++) {
|
|
2298
|
+
var num = nums_1[_i];
|
|
2299
|
+
sum += num;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
return Number((sum / nums.length).toFixed(7));
|
|
2303
|
+
};
|
|
2304
|
+
|
|
2175
2305
|
var css_248z = ".MintMapWrapper-module_mint-map-control-wrapper__DDb4y {\n position: absolute;\n z-index: 101;\n}\n\n.MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV {\n position: absolute;\n z-index: 1;\n}";
|
|
2176
2306
|
var styles = {"mint-map-control-wrapper":"MintMapWrapper-module_mint-map-control-wrapper__DDb4y","mint-map-overlay-wrapper":"MintMapWrapper-module_mint-map-overlay-wrapper__Jn4wV"};
|
|
2177
2307
|
styleInject__default["default"](css_248z);
|
|
@@ -2289,6 +2419,7 @@
|
|
|
2289
2419
|
exports.PolygonCalculator = PolygonCalculator;
|
|
2290
2420
|
exports.Polyline = Polyline;
|
|
2291
2421
|
exports.Position = Position;
|
|
2422
|
+
exports.getClusterInfo = getClusterInfo;
|
|
2292
2423
|
exports.useMarkerMoving = useMarkerMoving;
|
|
2293
2424
|
exports.useMintMapController = useMintMapController;
|
|
2294
2425
|
exports.waiting = waiting;
|