首页 / 浏览问题 / 三维GIS / 问题详情
关于Vue项目中使用态势推演相关问题
Zzy
19EXP 2020年07月16日
InitPlot(viewer, serverUrl){
                if (!viewer) {
                    return;
                }
                var campos = Cesium.Cartesian3.fromDegrees(121.58041176757547, 38.859240850898405, 500);
                viewer.scene.camera.flyTo({
                    destination: campos,
                    orientation: {
                        heading: Cesium.Math.toRadians(0),
                        pitch: -0.20917672793046682,
                        roll: 2.708944180085382e-13
                    }
                });
                this.plottingLayer = new Cesium.PlottingLayer(viewer.scene, "plottingLayer");
                viewer.scene.layers.add(this.plottingLayer);

                var plotting = Cesium.Plotting.getInstance(serverUrl, viewer.scene);

                var plotEditControl = new Cesium.PlotEditControl(viewer.scene, this.plottingLayer);//编辑控件
                plotEditControl.activate();

                this.animationManager = plotting.getGOAnimationManager();
                /*this.animationManager=animationManager;*/
                window.setInterval(function execute() {
                    this.animationManager.execute();
                }, 100);
            },

老师您好,在vue项目中加载三维的态势推演,引入了js后,先是报PlottingUI.js 500的错误,然后点开三维态势按钮后,出现scene is not defined,这是为什么。

2 个回答

var plotEditControl = new Cesium.PlotEditControl(viewer.scene, this.plottingLayer);//编辑控件

这段话里的viewer.scene出现scene is not defined

Zzy
19EXP 2020年07月16日

您好,我这边将您的代码放到官网示例里面没有出现上述报错,请问您这边InitPlot()定义了吗?http://support.supermap.com.cn:8090/webgl/examples/editor.html#plot_plotGOAnimation您可以根据范例再修改一下您的代码。

6,077EXP 2020年07月16日
第一张图写了,debug能看到scene中的属性,我觉得那个500的问题可能导致的,js引入出现500
您那边的PlottingUI.js是放在根目录下面的吗?您把PlottingUI.js换成PlottingUI.Include.js

我就是这样做的,现在把WebGL安装包下整个js文件都放根目录下也不行

您那边方便把代码私发给我吗?我这边帮您测一下
能给我个邮箱吗,我把这个代码拉出来,整合成项目好发给你
kangxin@supermap.com
老师您好,项目压缩发给您了
您那边找到这两行代码,然后注释掉plotEditControl = new cesium.PlotEditControl(scene, plottingLayer);//编辑控件
        plotEditControl.activate();
...