1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| /*
| *cesium组件封装
| *20190307
| */
| export default{
| install(Vue){
| /*
| *导航属性
| */
| Vue.prototype.CesiumAPI = {
| /*
| *导航接口
| */
| NavigateObj:{
| /*
| *飞到当前位置
| *参数x:经度
| *参数y:纬度
| *参数h:高度
| */
| flyToXYZ:(Cesium,Viewerc,x, y, z)=>{
| Viewerc.camera.flyTo({
| destination: Cesium.Cartesian3.fromDegrees(x, y, z)
| });
| }
| },
| /*
| *创建接口
| */
| CreateObj:{
| /*
| *创建点
| *参数point:必选项 点的属性 {
| position: cartesian,
| point: {
| color: Cesium.Color.RED,
| pixelSize: 5,
| heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
| }
| };
| */
| createPoint:(tag,Viewerc,point,callback) =>{
| var temp = _isContain(createobjlist, tag);
| if (temp.index > -1) {
| Viewerc.entities.remove(temp.item);
| createobjlist.splice(temp.index, 1);
| } else {
| var en = Viewerc.entities.add(p);
| createobjlist.push({ tag: tag, item: en });
| if (typeof callback == 'function') {
| callback({ tag: tag, item: en });
| }
| }
| }
| }
| }
|
| }
| }
| window._isContain = function(layerlist, tag) {
| for (var i = 0; i < layerlist.length; i++) {
| var temp = layerlist[i];
| if (temp.tag == tag) {
| temp.index = i;
| return temp;
| }
| }
| return { item: null, index: -1 };
| }
|
|