cesium/src/Utils/cesium.js
var basicAttr = { / * 将实体从兵力组织拖拽至地图控件,落点 * @pick1 pick2:落点坐标 */ screenToworld(_this,pick1,pick2){ // 屏幕坐标转世界坐标 var pick= new Cesium.Cartesian2(pick1,pick2); // var cartesian = _this.viewer.scene.globe.pick(_this.viewer.camera.getPickRay(pick),_this.viewer.scene);//3D屏幕坐标转世界坐标 var cartesian = _this.viewer.camera.pickEllipsoid(pick, _this.viewer.scene.globe.ellipsoid);//2D屏幕坐标转世界坐标 //世界坐标转地理坐标(经纬度) var Geography = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian); var positionParam={ longitude:Cesium.Math.toDegrees(Geography.longitude), latitude:Cesium.Math.toDegrees(Geography.latitude), altitude:0.0 }; _this.viewer.entities.add({ position : Cesium.Cartesian3.fromDegrees(positionParam.longitude, positionParam.latitude), billboard :{ "image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACvSURBVDhPrZDRDcMgDAU9GqN0lIzijw6SUbJJygUeNQgSqepJTyHG91LVVpwDdfxM3T9TSl1EXZvDwii471fivK73cBFFQNTT/d2KoGpfGOpSIkhUpgUMxq9DFEsWv4IXhlyCnhBFnZcFEEuYqbiUlNwWgMTdrZ3JbQFoEVG53rd8ztG9aPJMnBUQf/VFraBJeWnLS0RfjbKyLJA8FkT5seDYS1Qwyv8t0B/5C2ZmH2/eTGNNBgMmAAAAAElFTkSuQmCC", } }) return positionParam }, } export { basicAttr, }
cesium/src/components/Siderbar.vue
// 将实体从兵力组织拖拽至地图控件 dragend (event) { if(event.clientX>200&&event.clientY>90){ //basicAttr.screenToworld(this,event.clientX-200,event.clientY-90); console.log(basicAttr.screenToworld(this,event.clientX-200,event.clientY-90),"ces11") }; event.dataTransfer.clearData() }
到此这篇vue获取使用封装的函数返回值的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/qdvuejs/11279.html