首页 / 浏览问题 / 三维GIS / 问题详情
cesium 沿线飞行之后暂停在飞就是一直飞
22EXP 2023年03月11日
play(id) {

      this.isplay = !this.isplay;

      if (!this.isplay) {

        //播放

        let para = {

          parentId: id,

        };

        this.axios({

          method: "post",

          url: "/fzgh/tdPathNavigation/list",

          params: para,

        }).then((res) => {

          var viewList = [];

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

            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),

            });

          });

          let arrivedStopNum = 0;

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

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

            arrivedStopNum += 1;

            if (arrivedStopNum === viewList.length - 1) {

              this.playEnd();

            }

          });

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

            var route = window.flyManager.currentRoute;

            route.isLineVisible = false;

            route.isStopVisible = false;

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

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

              var position = Cesium.Cartesian3.fromDegrees(

                viewList[k].x,

                viewList[k].y,

                viewList[k].z

              );

              var routeStop = new Cesium.RouteStop({

                point: position,

                heading: viewList[k].heading,

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

                stopName: "站" + k,

                speed: viewList[k].speed,

                waitTime: 1,

              });

              route.addStop(routeStop);

            }

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

          });

        });

      } else {

        window.flyManager && window.flyManager.pause();

      }

    },

1个回答

您好,

测试的话是正常的,没有问题

您看一下官方示例http://support.supermap.com.cn:8090/webgl/examples/webgl/editor.html#flyRoute也是可以正常使用的。

4,151EXP 2023年03月13日
...