cesium一些常用的方法

 
获取当前视角的高度
this.viewer.scene.globe.ellipsoid.cartesianToCartographic(this.camera.position).height;
去掉 entity 的双击事件
viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
/**
 * 获取当前地图的级别
 * @returns {*} 返回当前底图的级别
 */
 getLevel(){
        const level = this.viewer.scene.globe._surface._tilesToRender.length?this.viewer.scene.globe._surface._tilesToRender[0].level:this._getLevel();
        return level;
    }
    _getLevel(height) {
        //this.viewer.camera.positionCartographic获取摄像机的地图位置,经度和纬度以弧度表示,高度以米表示
        height = Cesium.defaultValue(height,this.viewer.camera.positionCartographic.height);
        let A = 40487.57;
        let B = 0.00007096758;
        let C = 91610.74;
        let D = -40467.74;
        return Math.round(D + (A - D) / (

你可能感兴趣的:(gis专栏,cesium,前端,javascript,html5)