<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>获取相机视角参数</title>
<script src="js/jquery-3.5.0.js"></script>
<script src="video-js-7.7.6/video.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="./video-js-7.7.6/video-js.min.css" />
<link href="./SuperMapAPI/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
<link href="./SuperMapAPI/css/pretty.css" rel="stylesheet">
<script src="./SuperMapAPI/js/jquery.min.js"></script>
<script src="./SuperMapAPI/js/config.js"></script>
<script src="./SuperMapAPI/js/bootstrap.min.js"></script>
<script src="./SuperMapAPI/js/bootstrap-select.min.js"></script>
<script src="./SuperMapAPI/js/bootstrap-treeview.js"></script>
<script src="./SuperMapAPI/js/spectrum.js"></script>
<script type="text/javascript" src="./SuperMapAPI/js/require.min.js" data-main="./SuperMapAPI/js/main"></script>
</head>
<body>
<div id="cesiumContainer"></div>
<div id="toolbar" class="param-container tool-bar">
<button type="button" id="search" class="button black">查询</button><br>
</div>
<script type="text/javascript">
function onload(Cesium) {
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var widget = viewer.cesiumWidget;
var list;
try {
var promise = scene.open('地址');
Cesium.when(promise, function(layers) {
scene.camera.setView({
destination: new Cesium.Cartesian3(-2226536.103064586, 4186153.489252475, 4267282.822186795),
orientation: {
heading: 0.18646594377489922,
pitch: -0.6743434092132858,
roll: 6.283185307179583
}
});
$("#search").on("click", function() {
//笛卡尔坐标与方位角,俯仰角,滚动角
console.log(viewer.scene.camera.position, viewer.scene.camera.heading, viewer.scene.camera.pitch, viewer.scene.camera.roll);
});
}, function(e) {
if (widget._showRenderLoopErrors) {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
widget.showErrorPanel(title, undefined, e);
}
});
} catch (e) {
if (widget._showRenderLoopErrors) {
var title = '渲染时发生错误,已停止渲染。';
widget.showErrorPanel(title, undefined, e);
}
};
}
</script>
</body>
</html>
SuperMapWebGL获取相机视角参数
最新推荐文章于 2023-08-12 10:29:31 发布