@vtx/map 1.1.39 → 1.1.41
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/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -432,10 +432,24 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
432
432
|
});
|
|
433
433
|
|
|
434
434
|
if (feature) {
|
|
435
|
-
var target = feature.getProperties();
|
|
435
|
+
var target = feature.getProperties();
|
|
436
|
+
var id = '';
|
|
437
|
+
var elementId = '';
|
|
438
|
+
|
|
439
|
+
if ((0, _lodash.isArray)(target.features)) {
|
|
440
|
+
// 处理聚合点击
|
|
441
|
+
var properties = target.features[0].getProperties();
|
|
442
|
+
id = properties.id;
|
|
443
|
+
elementId = properties.id;
|
|
444
|
+
target = target.features;
|
|
445
|
+
} else {
|
|
446
|
+
id = target.id;
|
|
447
|
+
elementId = target.element;
|
|
448
|
+
} // top: e.clientY,//当前点所在的位置(屏幕)
|
|
436
449
|
// left: e.clientX,
|
|
437
450
|
|
|
438
|
-
|
|
451
|
+
|
|
452
|
+
t.clickGraphic(id || elementId, evt, target);
|
|
439
453
|
} else {
|
|
440
454
|
t.clickMap(evt);
|
|
441
455
|
}
|
|
@@ -3299,9 +3313,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3299
3313
|
function clusterMemberStyle(clusterMember) {
|
|
3300
3314
|
var style = clusterMember.getStyle();
|
|
3301
3315
|
var image = style && style.getImage ? style.getImage() : null;
|
|
3316
|
+
var text = style && style.getText ? style.getText() : null;
|
|
3302
3317
|
return new ol.style.Style({
|
|
3303
|
-
|
|
3304
|
-
|
|
3318
|
+
image: image,
|
|
3319
|
+
text: text
|
|
3305
3320
|
});
|
|
3306
3321
|
}
|
|
3307
3322
|
|
|
@@ -3371,7 +3386,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3371
3386
|
function clusterStyle(feature) {
|
|
3372
3387
|
var size = feature.get('features').length;
|
|
3373
3388
|
|
|
3374
|
-
if (size >
|
|
3389
|
+
if (size > 2) {
|
|
3375
3390
|
return [new ol.style.Style({
|
|
3376
3391
|
image: new ol.style.Circle({
|
|
3377
3392
|
radius: 20,
|
|
@@ -3398,15 +3413,17 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3398
3413
|
})
|
|
3399
3414
|
})];
|
|
3400
3415
|
} else {
|
|
3401
|
-
|
|
3402
|
-
|
|
3416
|
+
return feature.get('features').map(function (originalFeature) {
|
|
3417
|
+
return clusterMemberStyle(originalFeature);
|
|
3418
|
+
});
|
|
3403
3419
|
}
|
|
3404
3420
|
}
|
|
3405
3421
|
}
|
|
3406
3422
|
}, {
|
|
3407
3423
|
key: "clearCluster",
|
|
3408
|
-
value: function clearCluster() {
|
|
3424
|
+
value: function clearCluster(arg) {
|
|
3409
3425
|
var t = this;
|
|
3426
|
+
var ids = arg && (arg === null || arg === void 0 ? void 0 : arg.length) > 0 ? arg : t.state.pointIds;
|
|
3410
3427
|
|
|
3411
3428
|
if (t.clusterInfo.clusterHulls) {
|
|
3412
3429
|
t.state.gis.removeLayer(t.clusterInfo.clusterHulls);
|
|
@@ -3423,10 +3440,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3423
3440
|
t.clusterInfo.clusterCircles = null;
|
|
3424
3441
|
}
|
|
3425
3442
|
|
|
3426
|
-
|
|
3427
|
-
if (t.GM.getGraphic(
|
|
3428
|
-
t.GM.removeGraphic(
|
|
3443
|
+
ids.map(function (id) {
|
|
3444
|
+
if (t.GM.getGraphic(id)) {
|
|
3445
|
+
t.GM.removeGraphic(id);
|
|
3429
3446
|
}
|
|
3447
|
+
|
|
3448
|
+
t.state.pointIds.splice(t.state.pointIds.indexOf(id), 1);
|
|
3430
3449
|
});
|
|
3431
3450
|
t.addPoint(t.props.mapPoints);
|
|
3432
3451
|
t.refresh();
|
|
@@ -4185,8 +4204,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
4185
4204
|
|
|
4186
4205
|
if (typeof setCluster == 'boolean' && setCluster || setCluster && setCluster !== t.props.setCluster) {
|
|
4187
4206
|
t.cluster(mapCluster);
|
|
4188
|
-
}
|
|
4189
|
-
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
if (!setCluster && setCluster !== t.props.setCluster) {
|
|
4210
|
+
t.clearCluster(mapCluster);
|
|
4190
4211
|
} //图元编辑调用
|
|
4191
4212
|
|
|
4192
4213
|
|