Cesium廣告牌

面向百度程式設計大師兄發表於2020-10-04
<!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 application 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>5-繪製簡單圖形</title>
    <script src="../Build/Cesium/Cesium.js"></script>
    <style>
        @import url(../Build/Cesium/Widgets/widgets.css);

        html,
        body,
        #cesiumContainer {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        /* 是否展現版權資訊 */
        /* .cesium-widget-credits{
            display: none !important;
        } */
    </style>
</head>

<body>
    <div id="cesiumContainer" style="height: 100%;"></div>
    <script type="text/javascript">

        // 初始化
        let viewer = new Cesium.Viewer('cesiumContainer', {
            baseLayerPicker: false,
            imageryProvider: new Cesium.UrlTemplateImageryProvider({
                // 指定影像服務
                url: 'http://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali'


            })
            //Animation控制元件和Timeline控制元件管理,也就是時間軸
            // animation:false,
            // timeline:false

        });
        //靈活的切換控制元件 Animation控制元件和Timeline控制元件管理,也就是時間軸
        //view.animation.container.style.visibility='hidden';
        // view.animation.container.style.visibility = 'visible';
        //view.timeline.container.style.visibility='hidden';
        // view.timeline.container.style.visibility = 'visible';

        //增加廣告牌
        viewer.entities.add({
            position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
            billboard: {
                image: "../images/Cesium_Logo_overlay.png",
            },
        });`在這裡插入程式碼片`
        var dataSourcePromise = Cesium.CzmlDataSource.load(czml);
        viewer.dataSources.add(dataSourcePromise);
        viewer.zoomTo(dataSourcePromise);

    </script>
</body>


</html>

相關文章