/* *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 }; }