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()
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值