当前位置:网站首页 > Vue.js开发 > 正文

vue获取使用封装的函数返回值

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获取使用封装的函数返回值的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • VUE读取svg文件 修改svg图标颜色 base64编码图标路径并展示2024-11-28 17:54:09
  • JS递归实现遍历不规则多维数组的方法2024-11-28 17:54:09
  • js 判断字符串中是否包含某个字符串 删除指定字符2024-11-28 17:54:09
  • VUE实现拖拽2024-11-28 17:54:09
  • JS根据条件将扁平数组树状化2024-11-28 17:54:09
  • VUE项目通过ip访问前端页面的相关配置2024-11-28 17:54:09
  • VUE实现父子组件传值以及递归组件的传值2024-11-28 17:54:09
  • VUE非父子组件间的传值2024-11-28 17:54:09
  • JS跳出循环的遍历方法2024-11-28 17:54:09
  • vue组件中的this指向问题2024-11-28 17:54:09
  • 全屏图片