Cesium 获取鼠标当前位置的模型高度,地形高度,OSGB高度,及其经纬度。

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene._imageryLayerCollection);
var ray,position1,cartographic1,lon,lat,height;
handler.setInputAction(function (event) { 
ray = viewer.scene.camera.getPickRay(event.endPosition); 
position1 = viewer.scene.globe.pick(ray,viewer.scene); 
cartographic1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position1); 
var feature = scene.pick(event.endPosition); 
if (feature == undefined) { 
lon = Cesium.Math.toDegrees(cartographic1.longitude); 
lat = Cesium.Math.toDegrees(cartographic1.latitude); 
height = cartographic1.height; } 
else if(feature instanceof Cesium.Cesium3DTileFeature){ 
var cartesian = viewer.scene.pickPosition(event.endPosition); 
if (Cesium.defined(cartesian) ){ 
var cartographic = Cesium.Cartographic.fromCartesian(cartesian); 
lng = Cesium.Math.toDegrees(cartographic.longitude); 
lat = Cesium.Math.toDegrees(cartographic.latitude); 
height = cartographic.height;//模型高度 } }
//--------------------------------------------------------------
} , Cesium.ScreenSpaceEventType.MOUSE_MOVE);

上一篇:java并发:读写锁ReadWriteLock


下一篇:使用Adobe Audition 处理声音步骤