cesium 1.52 demo _ wyoming.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>Wyoming</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 wyoming = viewer.entities.add({
            name : 'Wyoming',  // 实体名称。
            polygon : {  // 实体类型
                hierarchy : Cesium.Cartesian3.fromDegreesArray([
                    -109.080842,45.002073,
                    -105.91517,45.002073,
                    -104.058488,44.996596,
                    -104.053011,43.002989,
                    -104.053011,41.003906,
                    -105.728954,40.998429,
                    -107.919731,41.003906,
                    -109.04798,40.998429,
                    -111.047063,40.998429,
                    -111.047063,42.000709,
                    -111.047063,44.476286,
                    -111.05254,45.002073]),  // 分层
                height : 0,  // 指定多边形相对于椭球面的高度,默认0,此处用于启用outline属性。
                material : Cesium.Color.RED.withAlpha(0.5),  // 指定多边形的填充颜色及透明度。
                outline : true,  // 是否显示轮廓线。
                outlineColor : Cesium.Color.BLACK  // 轮廓线颜色
            }
        });
        viewer.zoomTo(wyoming);  // 视图放大到wyoming实体。
    </script>
</body>

</html>

猜你喜欢

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