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