Cesium监听 三个参数heading pitch roll获取 经纬度

var camera = viewer.camera;

// 监听相机的changed事件,获取相应的参数值

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);

handler.setInputAction(function() {

    var position = camera.position;

    var heading = camera.heading;

    var pitch = camera.pitch;

    var roll = camera.roll;


    // 将位置转换为经纬度坐标

    var ellipsoid = viewer.scene.globe.ellipsoid;

    var cartographic = ellipsoid.cartesianToCartographic(position);

    var longitude = Cesium.Math.toDegrees(cartographic.longitude);

    var latitude = Cesium.Math.toDegrees(cartographic.latitude);

    var height = cartographic.height;


    // 输出位置和姿态参数值

    console.log("Position: " + position);

    console.log("Heading: " + heading);

    console.log("Pitch: " + pitch);

    console.log("Roll: " + roll);

    console.log("Longitude: " + longitude);

    console.log("Latitude: " + latitude);

    console.log("Height: " + height);

}, Cesium.ScreenSpaceEventType.LEFT_UP);

你可能感兴趣的:(Cesium监听 三个参数heading pitch roll获取 经纬度)