# cesium笔记

1、cesium旋转矩阵 https://blog.csdn.net/u011575168/article/details/82914686

2、cesium坐标转换:

①笛卡尔→弧度→经纬度

    var ellipsoid=viewer.scene.globe.ellipsoid;
var cartesian3=new Cesium.Cartesian3(x,y,z);
var cartographic=ellipsoid.cartesianToCartographic(cartesian3);
var lat=Cesium.Math.toDegrees(cartographic.latitude);
var lng=Cesium.Math.toDegrees(cartographic.longitude);
var alt=cartographic.height;


②经纬度→笛卡尔

    var cartesian3=Cesium.Cartesian3.fromDegrees(lon,lat.elev)

③百分度→弧度

    var lon_radians=Cesium.Math.toRadians(lon)

3、cesium通视分析思路 https://blog.csdn.net/cr196/article/details/77072814

4、cesium禁止相机进入地下（未测试）  https://blog.csdn.net/thor027/article/details/82455649

viewer.clock.onTick.addEventListener(function () {
if(viewer.camera.pitch > 0){
viewer.scene.screenSpaceCameraController.enableTilt = false;
}
});

var mousePosition,startMousePosition;
var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function(movement) {
mousePosition=startMousePosition= Cesium.Cartesian3.clone(movement.position);
handler.setInputAction(function(movement) {
mousePosition = movement.endPosition;
var y = mousePosition.y - startMousePosition.y;
if(y>0){
viewer.scene.screenSpaceCameraController.enableTilt = true;
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}, Cesium.ScreenSpaceEventType.MIDDLE_DOWN);


5、cesium默认鼠标操作事件 https://blog.csdn.net/caozl1132/article/details/88849101主要时利用了这个类Cesium.ScreenSpaceCameraController(scene)，来修改鼠标操作方式；

例如：

//设置操作习惯,更换中键和右键

viewer.scene.screenSpaceCameraController.tiltEventTypes = [

Cesium.CameraEventType.RIGHT_DRAG, Cesium.CameraEventType.PINCH,

{ eventType: Cesium.CameraEventType.LEFT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL },

{ eventType: Cesium.CameraEventType.RIGHT_DRAG, modifier: Cesium.KeyboardEventModifier.CTRL }

];

viewer.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.MIDDLE_DRAG, Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];

cesium操作事件：Cesium.ScreenSpaceEventType

6、GIS常用算法  https://blog.csdn.net/cfy_qiangkeming/article/details/83643482

7、解决调用camera.lookAt方法后鼠标默认动作改变问题 https://blog.csdn.net/qq_39782968/article/details/90289705

_this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);


• 0
点赞
• 0
评论
• 0
收藏
• 一键三连
• 扫一扫，分享海报

08-02 552

09-24 2万+
05-22 6370
07-06 1万+
02-29 421
03-27 2135
06-25 6050
11-09 6754
07-26 474
02-24 571
08-11 1699
08-29 3032
07-10 677
03-01 4807