首页 / 浏览问题 / 三维GIS / 问题详情
cesium 沿线飞行,飞着就一直转圈
22EXP 2023年03月14日
let para = {

            parentId: id,

          };

          this.axios({

            method: "post",

            url: "/fzgh/tdPathNavigation/list",

            params: para,

          }).then((res) => {

            this.viewList=[]

            res.data.forEach((item) => {

              this.viewList.push({

                x: Number(item.x),

                y: Number(item.y),

                z: Number(item.z),

                speed: Number(item.speed),

                roll: Number(item.roll),

                pitch: Number(item.pitch),

                heading: Number(item.heading),

                distance: Number(item.distance),

              });

            });

            window.flyManager.stop()

            window.flyManager.stopArrived.addEventListener((routeStop) => {

              routeStop.waitTime = 0.1; //修改站点的停留时间

              if (routeStop.index == this.viewList.length - 1) {

                this.playEnd();

              }

            });

            window.flyManager.readyPromise.then(() => {

              var route = window.flyManager.currentRoute;

              route.isLineVisible = false;

              route.isStopVisible = false;

              route._addedStops=[]

              // window.flyManager.currentIndex = 1; //飞行路线可以添加多个route,设置索引来加载不同的路线

              for (var k = 0; k < this.viewList.length; k++) {

                var position = Cesium.Cartesian3.fromDegrees(

                  this.viewList[k].x,

                  this.viewList[k].y,

                  this.viewList[k].z

                );

                var routeStop = new Cesium.RouteStop({

                  point: position,

                  heading: this.viewList[k].heading,

                  tilt: Cesium.Math.toRadians(this.viewList[k].pitch),

                  stopName: "站" + k,

                  speed: this.viewList[k].speed,

                  waitTime: 1,

                });  

                route.addStop(routeStop);

              }

            });

            window.flyManager && window.flyManager.play();

          });

        } else {

          window.flyManager && window.flyManager.play();

        }

  playEnd() {

      //路径播放结束,修改按钮状态

      this.isplay = true;

    },

FPF文件

<?xml version="1.0" encoding="UTF-8"?>

<SceneRoute xmlns="http://www.supermap.com.cn/ugc60">

<route name="飞行路线_3" speed="100" lineType="0" showroutestop="False" showrouteline="False" altitudefree="False" headingfree="False" tiltfree="False" flycircle="False" alongline="False">

<style>

<geostyle3d>

<linecolor>RGBA(147,112,219,255)</linecolor>

<linewidth>2</linewidth>

<altitudeMode>Absolute</altitudeMode>

<bottomAltitude>0.00</bottomAltitude>

</geostyle3d>

</style>

</route>

</SceneRoute>
关闭重复的问题: cesium 沿线飞行切换路线
...