53 Star 413 Fork 193

elusive/Cesium-test

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 2.66 KB
一键复制 编辑 原始数据 按行查看 历史
elusive 提交于 6年前 . add logo
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
#controls {
position: absolute;
left: 10px;
top: 10px;
color: #2ec5ad;
border-radius: 5px;
padding: 10px;
background-color: rgba(38, 38, 38, 0.75);
cursor: pointer;
}
</style>
</head>
<body>
<div id="credit"></div>
<div id="cesiumContainer">
<div id="cesiumxin" style="position:fixed;left:0;z-index:99"><a href="http://cesium.xin" style="color:aliceblue;text-decoration:none">cesium中文网 http://cesium.xin </a></div>
</div>
<div id="controls">
添加图层
</div>
<script>
var viewer = new Cesium.Viewer('cesiumContainer', {
//2.????
imageryProvider: new Cesium.SingleTileImageryProvider({
url: '../img/worldimage.jpg'
}),
geocoder: false,
//homeButton: false,
sceneModePicker: false,
baseLayerPicker: false,
navigationHelpButton: false,
animation: false,
creditContainer: "credit",
timeline: false,
fullscreenButton: false,
vrButton: false
});
document.getElementById('controls').onclick = function() {
let tileInfo = prompt("请输入http://ip:port/*/tileset.json");
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: tileInfo
}));
tileset.readyPromise.then(function() {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}).otherwise(function(error) {
throw (error);
});
}
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/HQCode/Cesium-test.git
git@gitee.com:HQCode/Cesium-test.git
HQCode
Cesium-test
Cesium-test
master

搜索帮助