<!DOCTYPE html>
<html lang=\"en\">
<head>
<!-- Use correct character set. -->
< charset=\"utf-8\">
<!-- Tell IE to use the latest, best version. -->
< http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\">
<!-- Make the app on mobile take up the full browser screen and disable user scaling. -->
< name=\"viewport\"
content=\"width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no\">
< >box</ >
<!-- The Cesium library. -->
< src=\"../ThirdParty/Cesium/Cesium.js\"></ >
<!-- Style our app. -->
<style>
@import url(../ThirdParty/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id=\"cesiumContainer\"></div>
< >
Cesium.Ion.defaultAccessToken = \'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNDhhYmQxOC1mYzMwLTRhYmEtOTI5Ny1iNGExNTQ3ZTZhODkiLCJpZCI6NTQ1NCwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0MzM3Mzc0NH0.RU6ynAZcwQvdfygt_N_j2rb2lpsuyyROzdaLQg0emAg\';
let viewer = new Cesium.Viewer(\'cesiumContainer\');
// 视图添加实体时,返回添加的实体。
let blueBox = viewer.entities.add({
name : \'Blue box\', // 实体名称。
position: Cesium.Cartesian3.fromDegrees(
-114.0, // 经度,以度为单位
40.0, // 纬度,以度为单位
300000.0 // 椭球面以上的高度,以米为单位,默认0.0。
), // 实体中心位置。
box : {
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0), // 尺寸( dimension的名词复数 )
// 盒子的长、宽、高。
material : Cesium.Color.BLUE // 实体颜色。
}
});
let redBox = viewer.entities.add({
name : \'Red box with black outline\',
position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
box : {
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
material : Cesium.Color.RED.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
});
let outlineOnly = viewer.entities.add({
name : \'Yellow box outline\',
position: Cesium.Cartesian3.fromDegrees(-100.0, 40.0, 300000.0),
box : {
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
fill : false, // 填充。
outline : true,
outlineColor : Cesium.Color.YELLOW
}
});
viewer.zoomTo(viewer.entities);
</ >
</body>
</html>
继续阅读与本文标签相同的文章
下一篇 :
云场景实践研究第59期:饿了么
-
充电宝逆袭共享单车,打脸王思聪?大家都打错脸了,事实并非如此
2026-05-19栏目: 教程
-
余承东说到做到,华为开启“全力反击”模式,谷歌始料未及!
2026-05-19栏目: 教程
-
等了 1 个多月,我就自己动手了
2026-05-19栏目: 教程
-
使用 Docker 构建 Nebula Graph 源码
2026-05-19栏目: 教程
-
阿里云服务器机型价格及如何选择?
2026-05-19栏目: 教程
