<!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 app 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>box</title> <!-- The Cesium library. --> <script src="../ThirdParty/Cesium/Cesium.js"></script> <!-- 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> <script> 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); </script> </body> </html>
cesium 1.52 demo _ box.html
猜你喜欢
转载自blog.csdn.net/weixin_42193179/article/details/85046409
今日推荐
周排行