修改点功能完善
parent
716dec950b
commit
504b9c9225
|
@ -138,8 +138,8 @@
|
|||
</div>
|
||||
<canvas v-show="checkRealityWait" id="scaleBar"></canvas>
|
||||
<div class="update-btns" v-show="updatePointVisible">
|
||||
<div><el-button type="primary" @click="selectPoint" :disabled="isSelectPointDisabled">选取点</el-button></div>
|
||||
<div><el-button type="primary" @click="savePoint">保存点</el-button></div>
|
||||
<div><el-button type="primary" @click.stop="selectPoint" :disabled="isSelectPointDisabled">选取点</el-button></div>
|
||||
<div><el-button type="primary" @click.stop="savePoint">保存点</el-button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -261,15 +261,13 @@ export default {
|
|||
updatePointVisible:false,
|
||||
currentSelectPoint: null, //当前选择修改的点对象
|
||||
updatedPoint:null, // 修改后的点对象
|
||||
isClickEventOpen:true,
|
||||
isClickEventOpen:true, //
|
||||
isSelectPointDisabled:false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
cu.initCesium("cesiumView");
|
||||
// if(this.isClickEventOpen){
|
||||
// cu.handleClick();
|
||||
// }
|
||||
cu.handleClick();
|
||||
cu.addlayer(this.geoWorkSpace, this.geoLayerName);
|
||||
let gp = this.geoLayerPos;
|
||||
cu.flyToLayerRect(gp[0], gp[1], gp[2], gp[3]);
|
||||
|
@ -439,9 +437,10 @@ export default {
|
|||
}
|
||||
},
|
||||
pickValue() {
|
||||
if(this.isClickEventOpen){
|
||||
cu.handleClick();
|
||||
}
|
||||
cu.destoryHandleClick()
|
||||
if(this.isClickEventOpen){
|
||||
cu.handleClick();
|
||||
}
|
||||
},
|
||||
changeSampleFun(sfVal) {
|
||||
//保存样本抽样方法
|
||||
|
@ -610,6 +609,7 @@ export default {
|
|||
});
|
||||
},
|
||||
editSelected(index, simpleData) {
|
||||
cu.destoryHandleClick() //先销毁
|
||||
//显示地图按钮
|
||||
this.updatePointVisible = true;
|
||||
this.isClickEventOpen = false;//关闭弹窗事件
|
||||
|
@ -629,6 +629,7 @@ export default {
|
|||
},
|
||||
//选择点
|
||||
selectPoint(){
|
||||
this.isClickEventOpen = false;//关闭弹窗事件
|
||||
//启动新增点,点击地图,新增一个点
|
||||
cu.clickToAddPoint(point=>{
|
||||
this.updatedPoint = {
|
||||
|
@ -652,13 +653,15 @@ export default {
|
|||
cu.addPoint(this.simpleData[i].lng, this.simpleData[i].lat, 10);
|
||||
}
|
||||
}
|
||||
//对表格内容实现全部选中
|
||||
this.$refs.multipleTable.toggleAllSelection();
|
||||
//关闭地图按钮
|
||||
this.updatePointVisible = false;
|
||||
//销毁监听
|
||||
cu.destroyClickToAddPoint()
|
||||
this.isClickEventOpen = true;
|
||||
this.isSelectPointDisabled = false;
|
||||
this.isClickEventOpen = true;
|
||||
cu.handleClick()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -178,13 +178,13 @@ class CesiumUtils {
|
|||
//修改点的位置
|
||||
static clickToAddPoint(callback){
|
||||
//清空之前的handler
|
||||
if (this.handler) {
|
||||
this.handler.destroy();
|
||||
if (this.addPointHandler) {
|
||||
this.addPointHandler.destroy();
|
||||
}
|
||||
var scene = this.viewer.scene;
|
||||
this.handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
||||
this.addPointHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
||||
const that = this;
|
||||
this.handler.setInputAction(function (movement) {
|
||||
this.addPointHandler.setInputAction(function (movement) {
|
||||
// 清除历史单击点
|
||||
var cartesian = that.viewer.camera.pickEllipsoid(
|
||||
movement.position,
|
||||
|
@ -215,17 +215,19 @@ class CesiumUtils {
|
|||
}
|
||||
//销毁监听
|
||||
static destroyClickToAddPoint(){
|
||||
this.handler.destroy();
|
||||
if(this.addPointHandler){
|
||||
this.addPointHandler.destroy();
|
||||
}
|
||||
}
|
||||
//鼠标点击
|
||||
static handleClick() {
|
||||
var scene = this.viewer.scene;
|
||||
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
||||
this.clickShowPopHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
|
||||
const that = this;
|
||||
|
||||
handler.setInputAction(function (movement) {
|
||||
that.clickShowPopHandler.setInputAction(function (movement) {
|
||||
console.log(123);
|
||||
// 清除历史单击点
|
||||
handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
that.clickShowPopHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
// movement.position 像素的x、y坐标
|
||||
var cartesian = that.viewer.camera.pickEllipsoid(
|
||||
movement.position,
|
||||
|
@ -343,6 +345,12 @@ class CesiumUtils {
|
|||
});
|
||||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
}
|
||||
//销毁点击事件
|
||||
static destoryHandleClick(){
|
||||
if(this.clickShowPopHandler){
|
||||
this.clickShowPopHandler.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default CesiumUtils;
|
||||
|
|
Loading…
Reference in New Issue