某用户用web 3D插件做可视域分析,结果如下,请问是什么原因造成的
8C
//视阈分析 viewAnaylystToolStart: function () { var $btn_chooseView = $('<button type="button" id="chooseView" class="button black">绘制可视域<tton>'); var scene = viewer.scene; if (!scene.pickPositionSupported) { alert('不支持深度纹理,可视域分析功能无法使用(无法添加观测)!'); } var viewPosition; //先将此标记置为true,不激活鼠标移动事件中对可视域分析对象的操作 scene.viewFlag = true; var pointHandler = new Cesium.PointHandler(viewer); //创建可视域分析对象 var viewshed3D = new Cesium.ViewShed3D(scene); var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); //鼠标移动时间回调 handler.setInputAction(function (e) { //若此标记为false,则激活对可视域分析对象的操作 if (!scene.viewFlag) { //获取鼠标屏幕坐标,并将其转化成笛卡尔坐标 var position = e.endPosition; var last = scene.pickPosition(position); //计算该点与视口位置点坐标的距离 var distance = Cesium.Cartesian3.distance(viewPosition, last); if (distance > 0) { //将鼠标当前点坐标转化成经纬度 var cartographic = Cesium.Cartographic.fromCartesian(last); var longitude = Cesium.Math.toDegrees(cartographic.longitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude); var height = cartographic.height; //通过该点设置可视域分析对象的距离及方向 viewshed3D.setDistDirByPoint([longitude, latitude, height]); } } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); handler.setInputAction(function (e) { //鼠标右键事件回调,不再执行鼠标移动事件中对可视域的操作 scene.viewFlag = true; }, Cesium.ScreenSpaceEventType.RIGHT_CLICK); pointHandler.drawCompletedEvent.addEventListener(function (point) { var position = point.position._value; viewPosition = position; //将获取的点的位置转化成经纬度 var cartographic = Cesium.Cartographic.fromCartesian(position); var longitude = Cesium.Math.toDegrees(cartographic.longitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude); var height = cartographic.height; if (scene.viewFlag) { //设置视口位置 viewshed3D.viewPosition = [longitude, latitude, height]; viewshed3D.build(); //将标记置为false以激活鼠标移动回调里面的设置可视域操作 scene.viewFlag = false; } }); $btn_chooseView.click(function () { if (pointHandler.active) { return; } //先清除之前的可视域分析 viewer.entities.removeAll(); viewshed3D.distance = 0.1; scene.viewFlag = true; //激活绘制点类 pointHandler.activate(); }); $("#toolbar").append($btn_chooseView); $("#toolbar").show();