You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.2 KiB
96 lines
3.2 KiB
<style>
|
|
.cesium-viewer-navigationContainer {
|
|
top: 15px;
|
|
|
|
}
|
|
|
|
.sm-zoom {
|
|
display: none;
|
|
}
|
|
|
|
.sm-compass {
|
|
transform: scale(0.7);
|
|
}
|
|
</style>
|
|
<div class="dtzn1">
|
|
<div class="dtbs fl">
|
|
<ul>
|
|
<li style="display: none;">
|
|
<a href="javascript:void(0);" id="">
|
|
<div class="dtbs-img"><button class="btn" onclick="GetPoint()">点击获取坐标</button> </div>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="javascript:void(0);" id="restoration">
|
|
<div class="dtbs-img"><img src="img/xfzy-icon8.png"></div>
|
|
<div class="dtbs-tit">主视角</div>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var _handlerDis, _handlerArea, _handlerHeight;
|
|
|
|
//工具条
|
|
$("#fullscreen").click(function () {
|
|
$(".topper").slideToggle(1000);
|
|
$(".wrapper").slideToggle(1000);
|
|
});
|
|
|
|
$("#restoration").click(function () {
|
|
camera_flyTo(
|
|
// 86.03517504046759,
|
|
// 44.266641066885455,
|
|
// 2.8409812819715032,
|
|
// 177.3923228568867,
|
|
// -4.092946665902131,
|
|
// 0.0,
|
|
// 3
|
|
_flyInitialPerspective.lon,
|
|
_flyInitialPerspective.lat,
|
|
_flyInitialPerspective.hei,
|
|
_flyInitialPerspective.head,
|
|
_flyInitialPerspective.pitch,
|
|
_flyInitialPerspective.roll,
|
|
3
|
|
);
|
|
});
|
|
|
|
|
|
//点击设备:图标/模型,三维模型触发的点击事件
|
|
GetPoint = function () {
|
|
var handler3D = new _cesium.ScreenSpaceEventHandler(_viewer.scene.canvas);
|
|
handler3D.setInputAction(function (movement) {
|
|
var pick = _viewer.scene.pick(movement.position);
|
|
//获取模型坐标位置
|
|
var position = _viewer.scene.pickPosition(movement.position);
|
|
//将笛卡尔坐标转化为经纬度坐标
|
|
var cartographic = _cesium.Cartographic.fromCartesian(position);
|
|
var longitude = _cesium.Math.toDegrees(cartographic.longitude);
|
|
var latitude = _cesium.Math.toDegrees(cartographic.latitude);
|
|
var height = cartographic.height;
|
|
if (height < 0) {
|
|
height = 0;
|
|
}
|
|
console.log(longitude + "," + latitude + "," + height);
|
|
}, _cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
|
|
|
var camera = _viewer.camera;//获取当前相机对象
|
|
if(camera != null){
|
|
var cartographic=_viewer.scene.globe.ellipsoid.cartesianToCartographic(camera.position);
|
|
var lng=_cesium.Math.toDegrees(cartographic.longitude);
|
|
var lat=_cesium.Math.toDegrees(cartographic.latitude);
|
|
var alt=cartographic.height;
|
|
console.log(lng+","+lat+","+alt);//输出x,y,z(经纬度)
|
|
|
|
var heading = _cesium.Math.toDegrees(camera.heading);
|
|
var pitch = _cesium.Math.toDegrees(camera.pitch);
|
|
var roll = _cesium.Math.toDegrees(camera.roll);
|
|
console.log(heading+","+pitch+","+roll);//输出方向(度数)
|
|
}
|
|
}
|
|
|
|
</script>
|