zhanmingkan
2022-05-16 fe8da266b86f12cf7a796c8c54b812310efdc16c
assets/service/drawService.js
@@ -54,36 +54,48 @@
function saveDrawEntity(type,drawEntity,id){//zzf:保存绘制的图形
    let saveData;
    if(type=='point'){
        var cartographic=Cesium.Cartographic.fromCartesian(drawEntity._position._value);
        var lng=Cesium.Math.toDegrees(cartographic.longitude);
        var lat=Cesium.Math.toDegrees(cartographic.latitude);
        var alt=cartographic.height;
        saveData= {
            "id":id,
            "type": type,
            "longitude": drawEntity._position._value.x,
            "latitude": drawEntity._position._value.y,
            "height": drawEntity._position._value.z,
            "longitude": lng,
            "latitude": lat,
            "height": alt,
        }
    }
    else if(type=='polyline'||type=='polygon'){
        let longitudeList=[],latitudeList=[],heightList=[]
        for(let i=0;i<drawEntity.length;i++){
            longitudeList.push(drawEntity[i]._position._value.x)
            latitudeList.push(drawEntity[i]._position._value.y)
            heightList.push(drawEntity[i]._position._value.z)
            var cartographic=Cesium.Cartographic.fromCartesian(drawEntity[i]._position._value);
            var lng=Cesium.Math.toDegrees(cartographic.longitude);
            var lat=Cesium.Math.toDegrees(cartographic.latitude);
            var alt=cartographic.height;
            longitudeList.push(lng)
            latitudeList.push(lat)
            heightList.push(alt)
        }
        saveData= {
            "id":id,
            "type": type,
            "longitude": longitudeList.toString(),
            "latitude":latitudeList.toString(),
            "latitude": latitudeList.toString(),
            "height": heightList.toString(),
        }
    }
    else if(type=='label'){
        var cartographic=Cesium.Cartographic.fromCartesian(drawEntity._position._value);
        var lng=Cesium.Math.toDegrees(cartographic.longitude);
        var lat=Cesium.Math.toDegrees(cartographic.latitude);
        var alt=cartographic.height;
        saveData= {
            "id":id,
            "type": type,
            "longitude": drawEntity._position._value.x,
            "latitude": drawEntity._position._value.y,
            "height": drawEntity._position._value.z,
            "longitude": lng,
            "latitude": lat,
            "height": alt,
            "content":drawEntity.title,
            "color":drawEntity._label._fillColor._value.toCssColorString(),
            "fontsize":30,