美文网首页cesium3D
Cesium快速上手5-地形影像的加载

Cesium快速上手5-地形影像的加载

作者: 彩云飘过 | 来源:发表于2020-04-07 18:46 被阅读0次

    Cesium快速上手5-地形影像的加载

    地形的加载

    image.png

    http://localhost:8080/Apps/Sandcastle/index.html?src=Terrain.html&label=Development

    image.png

    //更改地形数据,这里viewer.terrainProvider其实是个快捷方式,完整的是viewer.scene.globe.terrainProvider
    //地形数据只能加一个

     viewer.terrainProvider = worldTerrain; 
     viewer.scene.globe.enableLighting = true
    

    关键点
    EllipsoidTerrainProvider
    VRTheWorldTerrainProvider
    CesiumTerrainProvider/createWorldTerrain

    影像的加载

    image.png

    http://localhost:8080/Apps/Sandcastle/index.html?src=Imagery%20Layers.html&label=Development

    image.png

    影像图层是一个数组,可以加载很多个影像
    Cesium.ImageryProvider() //图层提供者
    viewer.scene.imageryLayers :Cesium.ImageryLayerCollection() //拥有图层提供者,另外还有其他属性:亮度 色调
    影像图层的管理(删除图层/提升显示层级/增加图层)。。。
    Cesium.ImageryLayerCollection(). addImageryProvider(imageryProvider, index)

    影像的某些功能

    ** 图层的叠加**
    http://localhost:8080/Apps/Sandcastle/index.html?src=Imagery%20Layers%20Manipulation.html&label=Development

    image.png

    ** 通过键盘 控制点亮区域 **
    http://localhost:8080/Apps/Sandcastle/index.html?src=Imagery%20Cutout.html&label=Development

    image.png

    增加一个地图的地图,开启夜间模式;
    增加一个图层,根据键盘控制旋转的角度

    // Add an Earth at Night layer and a "traveling" cutout
    var earthAtNight = layers.addImageryProvider(new Cesium.IonImageryProvider({ assetId: 3812 }));
    earthAtNight.cutoutRectangle = Cesium.Rectangle.fromDegrees(-100, 10, -60, 50);
    earthAtNight.alpha = 0.9;
    。。。
    
     var travelingRectangle = earthAtNight.cutoutRectangle;
    。。。
        travelingRectangle.east = wrapLongitude(travelingRectangle.east);
        travelingRectangle.west = wrapLongitude(travelingRectangle.west);
    });
    
    function wrapLongitude(value) {
        if (value < -Cesium.Math.PI) {
            return value + Cesium.Math.TWO_PI;
        }
        if (value > Cesium.Math.PI) {
            return value - Cesium.Math.TWO_PI;
        }
        return value;
    }
    
    

    ** 只显示地球的某一边界之内的图层 **

    http://localhost:8080/Apps/Sandcastle/index.html?src=Cartographic%20Limit%20Rectangle.html&label=Development

    // Tropics of Cancer and Capricorn
    var coffeeBeltRectangle = Cesium.Rectangle.fromDegrees(-180.0, -23.43687, 180.0, 23.43687);
    
    viewer.scene.globe.cartographicLimitRectangle = coffeeBeltRectangle; //地图限制矩形区域 设置成似咖啡杯的区域
    viewer.scene.globe.showSkirts = true;//是否显示地形群
    viewer.scene.skyAtmosphere.show = false;//天空的氛围笼罩
    
    
    image.png

    相关文章

      网友评论

        本文标题:Cesium快速上手5-地形影像的加载

        本文链接:https://www.haomeiwen.com/subject/pbwcphtx.html