1:中文文档地址:Cesium中文api文档 | Index - Cesium Documentation
2:初始化镜头(飞行到某个位置)
viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(121.479802, 31.225271, 5000.0) });
3:对地图进行一些操作设置
//设置中键放大缩小 viewer.scene.screenSpaceCameraController.zoomEventTypes = [ Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.MIDDLE_DRAG, Cesium.CameraEventType.PINCH ]; //设置右键旋转 viewer.scene.screenSpaceCameraController.tiltEventTypes = [ Cesium.CameraEventType.RIGHT_DRAG, Cesium.CameraEventType.PINCH, { eventType: Cesium.CameraEventType.RIGHT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL }, { eventType: Cesium.CameraEventType.MIDDLE_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL } ];
4:注册场景点击事件
// 事件绑定 handler.setInputAction(function(movement) { // 返回地图表面上的点在世界坐标系中 let cartesian1 = viewer.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid); // 将世界坐标转换为经纬度 let cartographic1 = viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian1); let lon1 = Cesium.Math.toDegrees(cartographic1.longitude); //经度值 let lat1 = Cesium.Math.toDegrees(cartographic1.latitude); //纬度值 }, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
标签:viewer,Cesium1,scene,学习,CameraEventType,DRAG,let,Cesium From: https://www.cnblogs.com/l-s-f/p/17141475.html