Cesium 遥感卫星影像推送效果绘制

//添加卫星
        function addSatellite() {
            satellite.curRouteLine \= viewer.entities.add({
                name: "satelliteline",
                polyline: {
                    positions: new Cesium.CallbackProperty(function (time, result) {
                        return satellite.curRoutePositions;
                    }, false),
                    material: new Cesium.ColorMaterialProperty(Cesium.Color.YELLOW),
                     3,
                },
            });

            satellite.entity \= viewer.entities.add({
                position: Cesium.Cartesian3.fromDegrees(\-75.59777, 40.03883),
                billboard: {
                    image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADJSURBVDhPnZHRDcMgEEMZjVEYpaNklIzSEfLfD4qNnXAJSFWfhO7w2Zc0Tf9QG2rXrEzSUeZLOGm47WoH95x3Hl3jEgilvDgsOQUTqsNl68ezEwn1vae6lceSEEYvvWNT/Rxc4CXQNGadho1NXoJ+9iaqc2xi2xbt23PJCDIB6TQjOC6Bho/sDy3fBQT8PrVhibU7yBFcEPaRxOoseTwbwByCOYf9VGp1BYI1BA+EeHhmfzKbBoJEQwn1yzUZtyspIQUha85MpkNIXB7GizqDEECsAAAAASUVORK5CYII=",
                },
                label: {
                    text: 'Landsat8'
                },
                polyline: {
                    positions: new Cesium.CallbackProperty(function (time, result) {
                        //return satellite.entity.position.concat(satellite.curNadir);
                        return (satellite.curNadir && satellite.entity) ? \[satellite.entity.position.\_value, satellite.curNadir\] : \[\]
                    }, false),
                    material: new Cesium.ColorMaterialProperty(Cesium.Color.BLUE),
                     1
                }
            });
            var redCone = viewer.entities.add({//红色圆锥体
                name: 'Red cone',
                position: new Cesium.CallbackProperty(function (time, result) {
                    if (satellite.entity) {
                        let p \= cesiumCoordUtil.cartesian3ToDegree2(satellite.entity.position.\_value);
                        return Cesium.Cartesian3.fromDegrees(p.lon, p.lat, p.height / 6 \* 5);
                    } else {
                        return Cesium.Cartesian3.fromDegrees(0, 0, 0);
                    }

                }, false),
                cylinder: {
                    length: new Cesium.CallbackProperty(function (time, result) {
                        return (satellite.entity ? cesiumCoordUtil.cartesian3ToDegree2(satellite.entity.position.\_value).height : 0) / 3;
                    }, false),
                    topRadius: 0.0,
                    bottomRadius: new Cesium.CallbackProperty(function (time, result) {
                        return (satellite.entity ? cesiumCoordUtil.cartesian3ToDegree2(satellite.entity.position.\_value).height : 0) / 6;
                    }, false),
                    material: Cesium.Color.RED
                }
            });
        }
//动态推送图像
        function addByTime() {
            clear1();
            Cesium.Resource.fetchJson({
                url: './datas/testfilenew.json'
            }).then(function (jsonData) {
                if (!jsonData) {
                    return;
                }
                let level0 \= jsonData.level3;
                for (let index = 0; index < level0.length; index++) {
                    const tileData \= level0\[index\];
                    let bbox \= tileData.bbox;

                    let imagePath \= tileData.imagePath;
                    let id \= tileData.id;
                    console.log(id);
                    console.log(imagePath);
                    let xnum \= id.split('\_')\[0\];
                    let ynum \= id.split('\_')\[1\];
                    imagePath \= './datas' + imagePath.replace('./', '/');
                    // start(bbox, imagePath);
                    (function (index) {
                        setTimeout(function () {
                            console.log(index, "interval");
                            //addImage(bbox, './datas/aaa.jpg');
                            addImage(bbox, imagePath);
                            let curSillitePos \= Cesium.Cartesian3.fromArray(satellite.routeLine\[index\]);
                            satellite.curRoutePositions.push(curSillitePos);
                            satellite.entity.position \= curSillitePos;
                            satellite.curNadir \= Cesium.Cartesian3.fromDegrees(satellite.nadirs\[index\]\[0\], satellite.nadirs\[index\]\[1\], 0.0);

                        }, index \* 300);
                    })(index);
                }
            }).otherwise(function (error) {

            });

            addSatellite();
        }

本文转自 https://www.cnblogs.com/dog2016/p/14044005.html,如有侵权,请联系删除。

原文地址:https://www.cnblogs.com/hustshu/p/15614312.html