function getView() {
if(!SuperMap3D) SuperMap3D = Cesium
var longitude = SuperMap3D.Math.toDegrees(SuperMap3D.Cartographic.fromCartesian(viewer.camera.position).longitude)
var latitude = SuperMap3D.Math.toDegrees(SuperMap3D.Cartographic.fromCartesian(viewer.camera.position).latitude)
var height = SuperMap3D.Cartographic.fromCartesian(viewer.camera.position).height
var pitch = viewer.camera.pitch
var roll = viewer.camera.roll
var heading = viewer.camera.heading
return {
longitude,
latitude,
height,
pitch,
roll,
heading
}
}
function setView(view,isfly) {
// 用的超图 SuperMap3D 和 Cesium 一样
if(!SuperMap3D) SuperMap3D = Cesium
if(!isfly){
viewer.camera.setView({
// fromDegrees()方法,将经纬度和高程转换为世界坐标
destination: SuperMap3D.Cartesian3.fromDegrees(view.longitude, view.latitude,
view.height),
orientation: {
// 方向
heading: view.heading,
// 视角
pitch:view.pitch,
// 倾斜角度
roll: view.roll
}
})
}else {
viewer.camera.flyTo({
// fromDegrees()方法,将经纬度和高程转换为世界坐标
destination: SuperMap3D.Cartesian3.fromDegrees(view.longitude, view.latitude,
view.height),
orientation: {
// 方向
heading: view.heading,
// 视角
pitch:view.pitch,
// 倾斜角度
roll: view.roll
}
})
}
}
GIS Cesium 控制相机的视角定位 (控制台获取当前视角)
最新推荐文章于 2024-08-12 15:45:00 发布