cesium 1.52 demo - cylinders and cones.html

<!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>cylinders and cones</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 greenCylinder = viewer.entities.add({
            name : 'Green cylinder with DARK_GREEN outline',
            position: Cesium.Cartesian3.fromDegrees(-100.0, 40.0, 200000.0), // 实体中心位置。
            cylinder : {
                length : 400000.0,  // 实体长度。
                topRadius : 200000.0,
                bottomRadius : 200000.0,
                material : Cesium.Color.GREEN.withAlpha(0.5),
                outline : true,
                outlineColor : Cesium.Color.DARK_GREEN
            }
        });

        let redCone = viewer.entities.add({
            name : 'Red cone',
            position: Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 200000.0),
            cylinder : {
                length : 400000.0,
                topRadius : 0.0,
                bottomRadius : 200000.0,
                material : Cesium.Color.RED
            }
        });

        viewer.zoomTo(viewer.entities);
    </script>
</body>

</html>

猜你喜欢

转载自blog.csdn.net/weixin_42193179/article/details/85603014