@mapgis/webclient-vue-cesium 16.2.0 → 16.2.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/dist-libs/webclient-vue-cesium.common.js +173354 -0
- package/dist-libs/webclient-vue-cesium.css +1 -1
- package/dist-libs/webclient-vue-cesium.umd.js +173364 -0
- package/dist-libs/webclient-vue-cesium.umd.min.js +6 -6
- package/package.json +88 -88
- package/src/component.js +132 -131
- package/src/components/Analysis/Contour.vue +1 -1
- package/src/components/Analysis/Explosion.vue +352 -0
- package/src/components/Analysis/Flood.vue +47 -40
- package/src/components/Analysis/HeightLimited.vue +156 -124
- package/src/components/Analysis/ModelFlatten.vue +1 -1
- package/src/components/Analysis/Profile.vue +8 -7
- package/src/components/Analysis/SkyLine.vue +2 -5
- package/src/components/Layer/IGServer/IgsDynamicLayer.vue +1 -1
- package/src/components/Layer/M3D/3DTilesetOptions.js +5 -5
- package/src/components/Layer/M3D/M3d.vue +80 -46
- package/src/components/Layer/Marker/DynamicMarkerLayer.vue +22 -13
- package/src/components/Overlay/mapv/MapvBaseLayer.js +34 -33
- package/src/components/Overlay/mapv/MapvLayer.js +132 -123
- package/src/components/Overlay/particle/ParticleEffects.vue +1 -0
- package/src/components/Overlay/themeLayer/M3DSubSectionLayer.vue +4 -0
- package/src/components/SceneEffect/components/BasicSetting.vue +9 -1
- package/src/components/SceneEffect/components/LightSetting.vue +1 -1
- package/src/components/UI/Popup/components/PopupFeatureDetail.vue +1 -1
- package/src/components/WebGlobe/ViewpointManager.vue +10 -8
- package/src/components/WebGlobe/manager.js +6 -6
- package/src/components/simulation/PondingSimulation.vue +842 -845
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</mapgis-ui-popup-content>
|
|
12
12
|
</Popup>
|
|
13
13
|
<mapgis-3d-virtual-popup
|
|
14
|
-
v-else
|
|
14
|
+
v-else-if="popupShowType === 'default'"
|
|
15
15
|
:enablePopup="enablePopup"
|
|
16
16
|
:enableTips="enableTips"
|
|
17
17
|
:enableIot="iEnableIot"
|
|
@@ -41,10 +41,19 @@ export default {
|
|
|
41
41
|
mixins: [PopupMixin],
|
|
42
42
|
props: {
|
|
43
43
|
...Tileset3dOptions,
|
|
44
|
+
// 右侧展示气泡框props
|
|
45
|
+
popupShowType: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "default"
|
|
48
|
+
},
|
|
49
|
+
popupOverlay: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => {}
|
|
52
|
+
}
|
|
44
53
|
},
|
|
45
54
|
components: {
|
|
46
55
|
modelSwitchPopup,
|
|
47
|
-
Popup
|
|
56
|
+
Popup
|
|
48
57
|
},
|
|
49
58
|
data() {
|
|
50
59
|
return {
|
|
@@ -54,7 +63,7 @@ export default {
|
|
|
54
63
|
modelSwitchVisible: false,
|
|
55
64
|
tileIndex: undefined,
|
|
56
65
|
tile: {},
|
|
57
|
-
iEnableIot: false
|
|
66
|
+
iEnableIot: false
|
|
58
67
|
};
|
|
59
68
|
},
|
|
60
69
|
created() {},
|
|
@@ -93,7 +102,7 @@ export default {
|
|
|
93
102
|
},
|
|
94
103
|
enableIot(next) {
|
|
95
104
|
this.iEnableIot = next;
|
|
96
|
-
}
|
|
105
|
+
}
|
|
97
106
|
},
|
|
98
107
|
/* render(h) {
|
|
99
108
|
return this.$_render(h);
|
|
@@ -110,17 +119,17 @@ export default {
|
|
|
110
119
|
let version = this.parseCesiumVersion(url);
|
|
111
120
|
if (version == "1.0") {
|
|
112
121
|
return new Promise(
|
|
113
|
-
|
|
122
|
+
resolve => {
|
|
114
123
|
let m3dLayer = new window.CesiumZondy.Layer.M3DLayer({
|
|
115
|
-
viewer: viewer
|
|
124
|
+
viewer: viewer
|
|
116
125
|
});
|
|
117
126
|
resolve({ layer: m3dLayer });
|
|
118
127
|
},
|
|
119
|
-
|
|
128
|
+
reject => {}
|
|
120
129
|
);
|
|
121
130
|
} else if (version == "2.0") {
|
|
122
131
|
return new Promise(
|
|
123
|
-
|
|
132
|
+
resolve => {
|
|
124
133
|
let layerIndex;
|
|
125
134
|
// 判断服务类型,三维场景服务调用Cesium底层appendSceneLayer,本质是调用appendSceneServer方法
|
|
126
135
|
if (url.indexOf("SceneServer") !== -1) {
|
|
@@ -138,7 +147,7 @@ export default {
|
|
|
138
147
|
resolve({ layerIndex: layerIndex });
|
|
139
148
|
}
|
|
140
149
|
},
|
|
141
|
-
|
|
150
|
+
reject => {}
|
|
142
151
|
);
|
|
143
152
|
}
|
|
144
153
|
|
|
@@ -148,8 +157,8 @@ export default {
|
|
|
148
157
|
getOptions() {
|
|
149
158
|
const { $props } = this;
|
|
150
159
|
let options = {};
|
|
151
|
-
Object.keys($props).forEach(function
|
|
152
|
-
if($props[key]) {
|
|
160
|
+
Object.keys($props).forEach(function(key) {
|
|
161
|
+
if ($props[key]) {
|
|
153
162
|
options[key] = $props[key];
|
|
154
163
|
}
|
|
155
164
|
});
|
|
@@ -178,7 +187,7 @@ export default {
|
|
|
178
187
|
vm.loopM3d(m3ds, "2.0");
|
|
179
188
|
vueCesium.M3DIgsManager.addSource(vueKey, vueIndex, m3ds, {
|
|
180
189
|
version: "2.0",
|
|
181
|
-
url: url
|
|
190
|
+
url: url
|
|
182
191
|
});
|
|
183
192
|
console.log("vueCesium.M3DIgsManager", vueCesium.M3DIgsManager);
|
|
184
193
|
vm.$emit("loaded", { tileset: tileset, m3ds: m3ds });
|
|
@@ -194,20 +203,20 @@ export default {
|
|
|
194
203
|
if (viewer.isDestroyed()) return;
|
|
195
204
|
|
|
196
205
|
let promise = this.createCesiumObject();
|
|
197
|
-
promise.then(
|
|
206
|
+
promise.then(payload => {
|
|
198
207
|
const { layer, layerIndex } = payload;
|
|
199
208
|
|
|
200
209
|
if (layer) {
|
|
201
210
|
// 0.0 1.0版本的处理方式
|
|
202
211
|
let options = this.getOptions();
|
|
203
|
-
options.loaded =
|
|
212
|
+
options.loaded = tileset => {
|
|
204
213
|
if (vueKey && vueIndex) {
|
|
205
214
|
vueCesium.M3DIgsManager.addSource(vueKey, vueIndex, m3ds, {
|
|
206
|
-
url: url
|
|
215
|
+
url: url
|
|
207
216
|
});
|
|
208
217
|
vm.bindPopupEvent();
|
|
209
218
|
if (!vm.show && m3ds) {
|
|
210
|
-
m3ds.forEach(
|
|
219
|
+
m3ds.forEach(m3d => {
|
|
211
220
|
m3d.show = vm.show;
|
|
212
221
|
});
|
|
213
222
|
}
|
|
@@ -260,7 +269,7 @@ export default {
|
|
|
260
269
|
vm.loopM3d(m3ds, "2.0");
|
|
261
270
|
vueCesium.M3DIgsManager.addSource(vueKey, vueIndex, m3ds, {
|
|
262
271
|
version: "2.0",
|
|
263
|
-
url: url
|
|
272
|
+
url: url
|
|
264
273
|
});
|
|
265
274
|
vm.$emit("loaded", { tileset: m3dLayer, m3ds: m3ds });
|
|
266
275
|
vm.bindPopupEvent();
|
|
@@ -283,15 +292,15 @@ export default {
|
|
|
283
292
|
return;
|
|
284
293
|
}
|
|
285
294
|
|
|
286
|
-
const layer =
|
|
287
|
-
if(!layer) return
|
|
295
|
+
const layer = viewer.scene.layers.getLayer(layerIndex);
|
|
296
|
+
if (!layer) return;
|
|
288
297
|
|
|
289
298
|
if (url.indexOf("SceneServer") != -1) {
|
|
290
|
-
if(viewer.scene.layers.sceneLayerMap._length > 0){
|
|
299
|
+
if (viewer.scene.layers.sceneLayerMap._length > 0) {
|
|
291
300
|
viewer.scene.layers.removeSceneLayerByID(layerIndex);
|
|
292
301
|
}
|
|
293
302
|
} else {
|
|
294
|
-
if(viewer.scene.layers.m3dLayersMap.length > 0) {
|
|
303
|
+
if (viewer.scene.layers.m3dLayersMap.length > 0) {
|
|
295
304
|
viewer.scene.layers.removeM3DLayerByID(layerIndex);
|
|
296
305
|
}
|
|
297
306
|
}
|
|
@@ -303,7 +312,7 @@ export default {
|
|
|
303
312
|
let m3ds = find.source;
|
|
304
313
|
!viewer.isDestroyed() &&
|
|
305
314
|
m3ds &&
|
|
306
|
-
m3ds.forEach(
|
|
315
|
+
m3ds.forEach(l => {
|
|
307
316
|
l.destroy();
|
|
308
317
|
});
|
|
309
318
|
}
|
|
@@ -346,6 +355,8 @@ export default {
|
|
|
346
355
|
find.options.hoverhandler.destroy();
|
|
347
356
|
}
|
|
348
357
|
}
|
|
358
|
+
// 关闭右侧气泡框
|
|
359
|
+
this.popupOverlay && this.popupOverlay.setContent(null);
|
|
349
360
|
},
|
|
350
361
|
pickFeature(payload) {
|
|
351
362
|
const vm = this;
|
|
@@ -386,22 +397,44 @@ export default {
|
|
|
386
397
|
let titlefield = popupOptions ? popupOptions.title : undefined;
|
|
387
398
|
if (tileset._useRawSaveAtt && Cesium.defined(feature)) {
|
|
388
399
|
let result = feature.content.getAttributeByOID(oid) || {};
|
|
389
|
-
|
|
390
|
-
{ properties: result, title: result[titlefield] },
|
|
391
|
-
];
|
|
392
|
-
} else {
|
|
393
|
-
tileset.queryAttributes(oid).then(function (result) {
|
|
394
|
-
result = result || {};
|
|
400
|
+
if (this.popupShowType === "default") {
|
|
395
401
|
vm.iClickFeatures = [
|
|
396
|
-
{ properties: result, title: result[titlefield] }
|
|
402
|
+
{ properties: result, title: result[titlefield] }
|
|
397
403
|
];
|
|
404
|
+
} else {
|
|
405
|
+
// title放在最前面
|
|
406
|
+
let popupContent = {};
|
|
407
|
+
popupContent = result[titlefield]
|
|
408
|
+
? { title: result[titlefield], ...result }
|
|
409
|
+
: { ...result };
|
|
410
|
+
vm.popupOverlay && vm.popupOverlay.setContent(popupContent);
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
tileset.queryAttributes(oid).then(function(result) {
|
|
414
|
+
result = result || {};
|
|
415
|
+
if (this.popupShowType === "default") {
|
|
416
|
+
vm.iClickFeatures = [
|
|
417
|
+
{ properties: result, title: result[titlefield] }
|
|
418
|
+
];
|
|
419
|
+
} else {
|
|
420
|
+
// title放在最前面
|
|
421
|
+
let popupContent = {};
|
|
422
|
+
popupContent = result[titlefield]
|
|
423
|
+
? { title: result[titlefield], ...result }
|
|
424
|
+
: { ...result };
|
|
425
|
+
vm.popupOverlay && vm.popupOverlay.setContent(popupContent);
|
|
426
|
+
}
|
|
398
427
|
});
|
|
399
428
|
}
|
|
400
|
-
if (
|
|
429
|
+
if (
|
|
430
|
+
this.popupShowType === "default" &&
|
|
431
|
+
vm.iClickFeatures &&
|
|
432
|
+
vm.iClickFeatures.length > 0
|
|
433
|
+
) {
|
|
401
434
|
let clickinfo = vm.iClickFeatures[0];
|
|
402
435
|
const { properties } = clickinfo;
|
|
403
436
|
if (properties) {
|
|
404
|
-
Object.keys(properties).forEach(
|
|
437
|
+
Object.keys(properties).forEach(k => {
|
|
405
438
|
if (k.toLowerCase() == "euid") vm.iEnableIot = true;
|
|
406
439
|
});
|
|
407
440
|
}
|
|
@@ -420,13 +453,14 @@ export default {
|
|
|
420
453
|
"rgba(255, 255, 0, 0.5)"
|
|
421
454
|
);
|
|
422
455
|
}
|
|
456
|
+
this.popupOverlay && this.popupOverlay.setContent(null);
|
|
423
457
|
},
|
|
424
458
|
changeShow(show) {
|
|
425
459
|
const { vueKey, vueIndex } = this;
|
|
426
460
|
let find = vueCesium.M3DIgsManager.findSource(vueKey, vueIndex);
|
|
427
461
|
if (find) {
|
|
428
462
|
let m3ds = find.source;
|
|
429
|
-
m3ds && m3ds.forEach(
|
|
463
|
+
m3ds && m3ds.forEach(m3d => (m3d.show = show));
|
|
430
464
|
}
|
|
431
465
|
this.layerList = this.parseLayers();
|
|
432
466
|
this.changeLayerVisible(this.layerList);
|
|
@@ -438,12 +472,12 @@ export default {
|
|
|
438
472
|
if (find) {
|
|
439
473
|
let m3ds = find.source;
|
|
440
474
|
if (!m3ds) return;
|
|
441
|
-
m3ds.forEach(
|
|
475
|
+
m3ds.forEach(m3d => {
|
|
442
476
|
let type = vm.checkType(m3d);
|
|
443
477
|
type = type == M3dType.UnKnow ? m3d.type : type;
|
|
444
478
|
if (type == M3dType.Model || type == M3dType.Instance) {
|
|
445
479
|
m3d.style = new Cesium.Cesium3DTileStyle({
|
|
446
|
-
color: `color('#FFFFFF', ${opacity})
|
|
480
|
+
color: `color('#FFFFFF', ${opacity})`
|
|
447
481
|
});
|
|
448
482
|
}
|
|
449
483
|
});
|
|
@@ -459,13 +493,13 @@ export default {
|
|
|
459
493
|
if (version == "0.0" || version == "1.0") {
|
|
460
494
|
// m3d 0.x 1.x版本逻辑判断 type =0是模型 =1是示例化数据 =2是点云
|
|
461
495
|
if (!children || children.length <= 0) return m3dType;
|
|
462
|
-
children.forEach(
|
|
496
|
+
children.forEach(child => {
|
|
463
497
|
let tempType = vm.checkTypeNode(child, version, callback);
|
|
464
498
|
m3dType = tempType || m3dType;
|
|
465
499
|
});
|
|
466
500
|
} else if (version == "2.0") {
|
|
467
501
|
if (!children || children.length <= 0) return m3dType;
|
|
468
|
-
children.forEach(
|
|
502
|
+
children.forEach(child => {
|
|
469
503
|
let tempType = vm.checkTypeNode(child, version, callback);
|
|
470
504
|
m3dType = tempType ? tempType : m3dType;
|
|
471
505
|
});
|
|
@@ -512,7 +546,7 @@ export default {
|
|
|
512
546
|
}
|
|
513
547
|
}
|
|
514
548
|
|
|
515
|
-
tileset.children.forEach(
|
|
549
|
+
tileset.children.forEach(child => {
|
|
516
550
|
let tempType = vm.checkTypeNode(child, version, callback);
|
|
517
551
|
m3dType = tempType ? tempType : m3dType;
|
|
518
552
|
});
|
|
@@ -522,18 +556,18 @@ export default {
|
|
|
522
556
|
loopM3d(m3ds, version) {
|
|
523
557
|
const vm = this;
|
|
524
558
|
const { vueKey, vueIndex, vueCesium, opacity, url } = this;
|
|
525
|
-
let dataCallback =
|
|
559
|
+
let dataCallback = cbtype => {
|
|
526
560
|
if (loop) {
|
|
527
561
|
window.clearInterval(loop);
|
|
528
562
|
loop = undefined;
|
|
529
|
-
m3ds.forEach(
|
|
563
|
+
m3ds.forEach(m3d => {
|
|
530
564
|
let type = vm.checkType(m3d);
|
|
531
565
|
m3d.type = type || cbtype;
|
|
532
566
|
switch (type) {
|
|
533
567
|
case M3dType.Model:
|
|
534
568
|
case M3dType.Instance:
|
|
535
569
|
m3d.style = new Cesium.Cesium3DTileStyle({
|
|
536
|
-
color: `color('#FFFFFF', ${opacity})
|
|
570
|
+
color: `color('#FFFFFF', ${opacity})`
|
|
537
571
|
});
|
|
538
572
|
break;
|
|
539
573
|
case M3dType.CloudPoint:
|
|
@@ -549,12 +583,12 @@ export default {
|
|
|
549
583
|
}
|
|
550
584
|
});
|
|
551
585
|
vueCesium.M3DIgsManager.addSource(vueKey, vueIndex, m3ds, {
|
|
552
|
-
url: url
|
|
586
|
+
url: url
|
|
553
587
|
});
|
|
554
588
|
}
|
|
555
589
|
};
|
|
556
590
|
let loop = window.setInterval(() => {
|
|
557
|
-
m3ds.forEach(
|
|
591
|
+
m3ds.forEach(m3d => {
|
|
558
592
|
vm.checkType(m3d, dataCallback);
|
|
559
593
|
});
|
|
560
594
|
}, 100);
|
|
@@ -568,7 +602,7 @@ export default {
|
|
|
568
602
|
}
|
|
569
603
|
let layerStr = layerString.replace(/layers=show:/i, "");
|
|
570
604
|
let layerStrs = layerStr.split(",");
|
|
571
|
-
let layers = layerStrs.map(
|
|
605
|
+
let layers = layerStrs.map(l => parseInt(l));
|
|
572
606
|
return layers;
|
|
573
607
|
},
|
|
574
608
|
changeLayerVisible(layers) {
|
|
@@ -578,7 +612,7 @@ export default {
|
|
|
578
612
|
if (find) {
|
|
579
613
|
let m3ds = find.source;
|
|
580
614
|
if (!m3ds) return;
|
|
581
|
-
m3ds.forEach(
|
|
615
|
+
m3ds.forEach(m3d => {
|
|
582
616
|
if (layers) {
|
|
583
617
|
m3d.show = true;
|
|
584
618
|
// @description cesium 1.84 (M3D 2.0)将layerIndex内部隐藏起来了
|
|
@@ -592,7 +626,7 @@ export default {
|
|
|
592
626
|
}
|
|
593
627
|
});
|
|
594
628
|
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
597
631
|
};
|
|
598
632
|
</script>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { Style } from "@mapgis/webclient-es6-service";
|
|
22
22
|
import VueOptions from "../../Base/Vue/VueOptions";
|
|
23
23
|
import Mapgis3dMarkerSetPro from "./Marker3dSetPro.vue";
|
|
24
|
-
import * as
|
|
24
|
+
import * as Feature from "../../service/comprehensive-query/util/feature";
|
|
25
25
|
|
|
26
26
|
const { MarkerStyle, LineStyle, PointStyle, FillStyle } = Style;
|
|
27
27
|
const DefaultActiveImagePlotting =
|
|
@@ -194,7 +194,7 @@ export default {
|
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
let markers = geojson.features.map((f, i) => {
|
|
197
|
-
let coordinates =
|
|
197
|
+
let coordinates = Feature.getGeoJSONFeatureCenter(f);
|
|
198
198
|
let id =
|
|
199
199
|
f.properties && f.properties[idField] ? f.properties[idField] : i;
|
|
200
200
|
let marker = {
|
|
@@ -257,9 +257,9 @@ export default {
|
|
|
257
257
|
ymax: b_ymax
|
|
258
258
|
} = this.getViewExtend();
|
|
259
259
|
// 先查看是否在地图范围内
|
|
260
|
-
if (xmin > b_xmin && ymin > b_ymin && xmax < b_xmax && ymax < b_ymax) {
|
|
261
|
-
|
|
262
|
-
}
|
|
260
|
+
// if (xmin > b_xmin && ymin > b_ymin && xmax < b_xmax && ymax < b_ymax) {
|
|
261
|
+
// return;
|
|
262
|
+
// }
|
|
263
263
|
// 然后查看两个矩形的范围大小,如果选择集的范围较当前大,需要做缩放
|
|
264
264
|
if (xmax - xmin > b_xmax - b_xmin || ymax - ymin > b_ymax - b_ymin) {
|
|
265
265
|
this.zoomTo({ xmin, ymin, xmax, ymax });
|
|
@@ -268,6 +268,8 @@ export default {
|
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
270
|
mouseEnterEvent(e, id) {
|
|
271
|
+
const { highlight } = this;
|
|
272
|
+
if (!highlight) return;
|
|
271
273
|
// 高亮要素
|
|
272
274
|
const marker = this.getMarker(id);
|
|
273
275
|
const { highlightStyle } = this;
|
|
@@ -282,6 +284,8 @@ export default {
|
|
|
282
284
|
}
|
|
283
285
|
},
|
|
284
286
|
mouseLeaveEvent(e, id) {
|
|
287
|
+
const { highlight } = this;
|
|
288
|
+
if (!highlight) return;
|
|
285
289
|
const marker = this.getMarker(id);
|
|
286
290
|
if (marker) {
|
|
287
291
|
this.clearHighlightFeature(marker);
|
|
@@ -395,7 +399,7 @@ export default {
|
|
|
395
399
|
if (!find) return;
|
|
396
400
|
for (let i = 0; i < find.source.entities.values.length; i++) {
|
|
397
401
|
let entity = find.source.entities.values[i];
|
|
398
|
-
if (entity.properties[idField] == marker.
|
|
402
|
+
if (entity.properties[idField]._value == marker.fid) {
|
|
399
403
|
if (entity.ellipse) {
|
|
400
404
|
const style = hpoint.toCesiumStyle(Cesium);
|
|
401
405
|
const { color, pixelSize, outlineColor } = style;
|
|
@@ -463,7 +467,7 @@ export default {
|
|
|
463
467
|
clearHighlightFeature(marker) {
|
|
464
468
|
const { vueCesium, vueKey, vueIndex, layerStyle } = this;
|
|
465
469
|
let dataSource = vueCesium.GeojsonManager.findSource(vueKey, vueIndex);
|
|
466
|
-
if(!dataSource) return;
|
|
470
|
+
if (!dataSource) return;
|
|
467
471
|
this.changeColor(dataSource.source);
|
|
468
472
|
},
|
|
469
473
|
highlightMarker(marker) {
|
|
@@ -481,15 +485,20 @@ export default {
|
|
|
481
485
|
},
|
|
482
486
|
onHighlightFeature(fid) {
|
|
483
487
|
const marker = this.getMarker(fid);
|
|
484
|
-
let bbox =
|
|
488
|
+
let bbox = Feature.getGeoJSONFeatureBound(marker.feature);
|
|
485
489
|
let bound = {
|
|
486
|
-
xmin: bbox
|
|
487
|
-
ymin: bbox
|
|
488
|
-
xmax: bbox
|
|
489
|
-
ymax: bbox
|
|
490
|
+
xmin: bbox.xmin,
|
|
491
|
+
ymin: bbox.ymin,
|
|
492
|
+
xmax: bbox.xmax,
|
|
493
|
+
ymax: bbox.ymax
|
|
490
494
|
};
|
|
491
|
-
|
|
495
|
+
if (marker.feature.geometry.type !== "Point") {
|
|
496
|
+
this.zoomTo(bound);
|
|
497
|
+
} else {
|
|
498
|
+
this.zoomOrPanTo(bound);
|
|
499
|
+
}
|
|
492
500
|
this.highlightMarker(marker);
|
|
501
|
+
this.highlightFeature(marker);
|
|
493
502
|
},
|
|
494
503
|
showMarkerDetail(data) {
|
|
495
504
|
this.$emit("show-popup", data);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
baiduMapLayer,
|
|
3
3
|
DataSet,
|
|
4
|
-
utilDataRangeIntensity as Intensity
|
|
4
|
+
utilDataRangeIntensity as Intensity,
|
|
5
5
|
} from "mapv";
|
|
6
6
|
|
|
7
|
-
import Supercluster from
|
|
7
|
+
import Supercluster from "./SuperCluster";
|
|
8
8
|
|
|
9
9
|
let BaseLayer = baiduMapLayer ? baiduMapLayer.__proto__ : Function;
|
|
10
10
|
|
|
@@ -56,7 +56,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
56
56
|
* 公式表示就是:window.devicePixelRatio = 物理像素 / dips,该函数主要应用与移动设备
|
|
57
57
|
*/
|
|
58
58
|
initDevicePixelRatio() {
|
|
59
|
-
this.devicePixelRatio =
|
|
59
|
+
this.devicePixelRatio = 1;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -175,7 +175,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
175
175
|
if (!dataSet) {
|
|
176
176
|
dataSet = this.dataSet;
|
|
177
177
|
}
|
|
178
|
-
let lnglat2Mkt = poi => {
|
|
178
|
+
let lnglat2Mkt = (poi) => {
|
|
179
179
|
let mercator = {};
|
|
180
180
|
let earthRad = 6378137.0;
|
|
181
181
|
mercator.x = ((poi.lng * Math.PI) / 180) * earthRad;
|
|
@@ -190,7 +190,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
190
190
|
let data = dataSet.get();
|
|
191
191
|
data = dataSet.transferCoordinate(
|
|
192
192
|
data,
|
|
193
|
-
function(coordinates) {
|
|
193
|
+
function (coordinates) {
|
|
194
194
|
if (
|
|
195
195
|
coordinates[0] < -180 ||
|
|
196
196
|
coordinates[0] > 180 ||
|
|
@@ -201,7 +201,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
201
201
|
} else {
|
|
202
202
|
let pixel = lnglat2Mkt({
|
|
203
203
|
lng: coordinates[0],
|
|
204
|
-
lat: coordinates[1]
|
|
204
|
+
lat: coordinates[1],
|
|
205
205
|
});
|
|
206
206
|
return [pixel.x, pixel.y];
|
|
207
207
|
}
|
|
@@ -216,15 +216,16 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
216
216
|
dataOptions() {
|
|
217
217
|
const self = this;
|
|
218
218
|
return {
|
|
219
|
-
transferCoordinate: function(coordinate) {
|
|
219
|
+
transferCoordinate: function (coordinate) {
|
|
220
220
|
let pointSphere = Cesium.Cartesian3.fromDegrees(
|
|
221
221
|
coordinate[0],
|
|
222
222
|
coordinate[1]
|
|
223
223
|
);
|
|
224
224
|
let position = self.map.camera.position;
|
|
225
|
-
let cameraHeight =
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
let cameraHeight =
|
|
226
|
+
self.map.scene.globe.ellipsoid.cartesianToCartographic(
|
|
227
|
+
position
|
|
228
|
+
).height;
|
|
228
229
|
cameraHeight += self.map.scene.globe.ellipsoid.maximumRadius * 1.2;
|
|
229
230
|
let distance = Cesium.Cartesian3.distance(position, pointSphere);
|
|
230
231
|
if (distance > cameraHeight) {
|
|
@@ -242,11 +243,11 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
242
243
|
if (self.options.draw === "cluster") {
|
|
243
244
|
return [
|
|
244
245
|
point.x * self.devicePixelRatio,
|
|
245
|
-
point.y * self.devicePixelRatio
|
|
246
|
+
point.y * self.devicePixelRatio,
|
|
246
247
|
];
|
|
247
248
|
}
|
|
248
249
|
return [point.x, point.y];
|
|
249
|
-
}
|
|
250
|
+
},
|
|
250
251
|
};
|
|
251
252
|
}
|
|
252
253
|
|
|
@@ -278,7 +279,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
278
279
|
max: this.pointCountMax,
|
|
279
280
|
minSize: this.options.minSize || 8,
|
|
280
281
|
maxSize: this.options.maxSize || 30,
|
|
281
|
-
gradient: this.options.gradient
|
|
282
|
+
gradient: this.options.gradient,
|
|
282
283
|
});
|
|
283
284
|
}
|
|
284
285
|
for (let i = 0; i < clusterData.length; i++) {
|
|
@@ -301,26 +302,26 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
301
302
|
refreshCluster(options) {
|
|
302
303
|
options = options || this.options;
|
|
303
304
|
this.supercluster = new Supercluster({
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
maxZoom: options.maxZoom || 19,
|
|
306
|
+
radius: options.clusterRadius || 100,
|
|
307
|
+
minPoints: options.minPoints || 2,
|
|
308
|
+
extent: options.extent || 512,
|
|
308
309
|
});
|
|
309
310
|
|
|
310
311
|
this.supercluster.load(this.dataSet.get());
|
|
311
312
|
// 拿到每个级别下的最大值最小值
|
|
312
|
-
this.supercluster.trees.forEach(item => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
313
|
+
this.supercluster.trees.forEach((item) => {
|
|
314
|
+
let max = 0;
|
|
315
|
+
let min = Infinity;
|
|
316
|
+
item.points.forEach((point) => {
|
|
317
|
+
max = Math.max(point.numPoints || 0, max);
|
|
318
|
+
min = Math.min(point.numPoints || Infinity, min);
|
|
319
|
+
});
|
|
320
|
+
item.max = max;
|
|
321
|
+
item.min = min;
|
|
321
322
|
});
|
|
322
323
|
this.clusterDataSet = new DataSet();
|
|
323
|
-
}
|
|
324
|
+
}
|
|
324
325
|
|
|
325
326
|
_canvasUpdate(time) {
|
|
326
327
|
let map = this.map;
|
|
@@ -368,7 +369,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
368
369
|
let dataGetOptions = this.dataOptions();
|
|
369
370
|
|
|
370
371
|
if (time !== undefined) {
|
|
371
|
-
dataGetOptions.filter = function(item) {
|
|
372
|
+
dataGetOptions.filter = function (item) {
|
|
372
373
|
let trails = animationOptions.trails || 10;
|
|
373
374
|
if (time && item.time > time - trails && item.time < time) {
|
|
374
375
|
return true;
|
|
@@ -414,7 +415,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
414
415
|
_data = _data.get();
|
|
415
416
|
}
|
|
416
417
|
if (_data != undefined) {
|
|
417
|
-
let zoom = this.getZoom();
|
|
418
|
+
let zoom = this.getZoom();
|
|
418
419
|
if (
|
|
419
420
|
this.options.draw === "cluster" &&
|
|
420
421
|
(!this.options.maxClusterZoom || this.options.maxClusterZoom >= zoom)
|
|
@@ -429,7 +430,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
429
430
|
}
|
|
430
431
|
|
|
431
432
|
super.update({
|
|
432
|
-
options: options
|
|
433
|
+
options: options,
|
|
433
434
|
});
|
|
434
435
|
}
|
|
435
436
|
|
|
@@ -440,7 +441,7 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
440
441
|
}
|
|
441
442
|
this.dataSet.add(_data);
|
|
442
443
|
this.update({
|
|
443
|
-
options: options
|
|
444
|
+
options: options,
|
|
444
445
|
});
|
|
445
446
|
}
|
|
446
447
|
|
|
@@ -453,11 +454,11 @@ export class MapvBaseLayer extends BaseLayer {
|
|
|
453
454
|
return;
|
|
454
455
|
}
|
|
455
456
|
let newData = this.dataSet.get({
|
|
456
|
-
filter: function(data) {
|
|
457
|
+
filter: function (data) {
|
|
457
458
|
return filter != null && typeof filter === "function"
|
|
458
459
|
? !filter(data)
|
|
459
460
|
: true;
|
|
460
|
-
}
|
|
461
|
+
},
|
|
461
462
|
});
|
|
462
463
|
this.dataSet.set(newData);
|
|
463
464
|
this.stopAniamation = true;
|