<!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>
收藏 打印