Commit 88edbf14 authored by xxx's avatar xxx

修改关键点设置

parent 3cc946a1
...@@ -2357,6 +2357,68 @@ var HttpReq = function(){ ...@@ -2357,6 +2357,68 @@ var HttpReq = function(){
data:data, data:data,
}) })
}, },
//设置控制点——关键点信息表
apiCpointQuery: function(param){
return request({
url: '/api/Cpoint',
method: 'get',
params:param,
})
},
apiCpointAdd: function(data){
return request({
url: '/api/Cpoint',
method: 'POST',
data:data,
}).then((res) => {
return res
})
},
apiCpointUpdate: function(data){
return request({
url: '/api/Cpoint',
method: 'PUT',
data:data,
})
},
apiCpointDel: function(data){
return request({
url: '/api/Cpoint',
method: 'Delete',
data:data,
})
},
//设置控制点——关键点连接信息表
apiPathmapQuery: function(param){
return request({
url: '/api/Pathmap',
method: 'get',
params:param,
})
},
apiPathmapAdd: function(data){
return request({
url: '/api/Pathmap',
method: 'POST',
data:data,
}).then((res) => {
return res
})
},
apiPathmapUpdate: function(data){
return request({
url: '/api/Pathmap',
method: 'PUT',
data:data,
})
},
apiPathmapDel: function(data){
return request({
url: '/api/Pathmap',
method: 'Delete',
data:data,
})
},
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
import * as mars3d from 'mars3d' import * as mars3d from 'mars3d'
import * as Cesium from 'mars3d-cesium/Build/Cesium/Cesium' import * as Cesium from 'mars3d-cesium/Build/Cesium/Cesium'
import { initGraphicManager,initLayerManager,bindLayerContextMenu } from './js/graphicManager' import { initGraphicManager,initLayerManager,bindLayerContextMenu } from './js/graphicManager'
import zhuangchetubiao from '../../assets/images/cutGraph/zhuangchedian1.png'
import xiechetubiao from '../../assets/images/cutGraph/xiechedian1.png'
import kongzhidiantubiao from '../../assets/images/cutGraph/kongzhidian1.png'
// 导入插件(其他插件类似,插件清单访问:http://mars3d.cn/dev/guide/start/install.html) // 导入插件(其他插件类似,插件清单访问:http://mars3d.cn/dev/guide/start/install.html)
...@@ -35,14 +38,14 @@ ...@@ -35,14 +38,14 @@
name: 'mars3dViewer', name: 'mars3dViewer',
created(){ created(){
this.getCoordinate(); // this.getCoordinate();
}, },
data(){ data(){
return{ return{
zuobianData:[], zuobianData:[],
toJavaCoordinates:[], toJavaCoordinates:[],
weilanName:[], controlPointId:0,
} }
}, },
...@@ -85,28 +88,8 @@ ...@@ -85,28 +88,8 @@
methods: { methods: {
//后台获取数据 //后台获取数据
getCoordinate() { getCoordinate(data) {
let that = this; this.zuobianData = data;
// HttpReq.truckDispatching.screenMapSetUpQuery({size:9999}).then((res) => {
// if(true){;
// //console.log(res);
// let data1 = [];
// for(let key in res){
// that.weilanName.push(key);
// let arrays = [];
// res[key].forEach(function(item){
// var arr = [];
// arr[0] = item.lon;
// arr[1] = item.lat;
// arr[2] = "500";
// arrays.push(arr);
// })
// data1.push(arrays)
// }
// that.zuobianData = data1
//console.log("zuobianData",that.zuobianData);
//console.log("weilanName",that.weilanName);
if (this.appendToBody) { if (this.appendToBody) {
document.body.appendChild(this.$el) document.body.appendChild(this.$el)
} }
...@@ -118,30 +101,71 @@ ...@@ -118,30 +101,71 @@
this.initMars3d(data.map3d)// 构建地图 this.initMars3d(data.map3d)// 构建地图
}) })
} }
// }
// })
}, },
//上传关键点数据 //上传关键点数据
uploaded(text,color){ uploaded(text,type,way){
let newData = [...this.toJavaCoordinates]; if(way == 'add'){
newData.pop(); if(JSON.stringify(this.toJavaCoordinates) == '[]'){
let allObj = {};
allObj.name = text;
allObj.zuobiao = newData;
allObj.color = color;
this.toJavaCoordinates = [];
//console.log(allObj);
//发送添加电子围栏请求
HttpReq.truckDispatching.screenMapSetUpAdd(allObj).then((res) => {
this.$notify({ this.$notify({
title: '区域信息上传成功,即将重新加载', title: '未选择'+ type +'位置',
type: 'success', type: 'error',
duration: 2500 duration: 2500
})
}else{
let lastData = {};
lastData.name = text;
lastData.type = type;
lastData.lon = this.toJavaCoordinates[0][0];
lastData.lat = this.toJavaCoordinates[0][1];
HttpReq.truckDispatching.apiCpointAdd(lastData).then((res) => {
this.$notify({
title: '关键点信息上传中,请勿操作!',
type: 'success',
duration: 2000,
dangerouslyUseHTMLString: true,
});
this.$nextTick(()=>{
if(res.code == 200){
this.$notify({
title: '关键点信息上传成功,即将刷新页面!',
type: 'success',
duration: 2000,
dangerouslyUseHTMLString: true,
}); });
setTimeout(function (){ setTimeout(function (){
window.location.reload(); window.location.reload();
},2000); },2000);
}).catch(function(error) { }); }
})
})
}
}else if(way == 'edit'){
let lastData = {};
lastData.id = this.controlPointId;
lastData.name = text;
HttpReq.truckDispatching.apiCpointUpdate(lastData).then((res) => {
this.$notify({
title: '关键点信息上传中,请勿操作!',
type: 'success',
duration: 2000,
dangerouslyUseHTMLString: true,
});
this.$nextTick(()=>{
if(res.code == 200){
this.$notify({
title: '关键点信息上传成功,即将刷新页面!',
type: 'success',
duration: 2000,
dangerouslyUseHTMLString: true,
});
// setTimeout(function (){
// window.location.reload();
// },2000);
}
})
})
}
}, },
//创建地图 //创建地图
initMars3d(options) { initMars3d(options) {
...@@ -161,16 +185,33 @@ ...@@ -161,16 +185,33 @@
this[`map${this.mapKey}`] = map this[`map${this.mapKey}`] = map
//围栏回显 //围栏回显
// that.zuobianData.forEach(function(item,index){ that.zuobianData.forEach(function(item,index){
// var graphicLayer = new mars3d.layer.GraphicLayer(); var graphicLayer = new mars3d.layer.GraphicLayer();
// map.addLayer(graphicLayer); map.addLayer(graphicLayer);
// initLayerManager(graphicLayer,that.weilanName[index]); initLayerManager(graphicLayer);
// that.addGraphic_01(graphicLayer,item,that.weilanName[index]); that.bindLayerPopup(graphicLayer,item)
// }) that.addDemoGraphic1(graphicLayer,item);
})
// 抛出事件 // 抛出事件
this.$emit('onload', map) this.$emit('onload', map)
}, },
//关键点位置
addDemoGraphic1(graphicLayer,item) {
const graphic = new mars3d.graphic.BillboardEntity({
name: item.name,
position: [item.lon, item.lat, 1000],
style: {
image: item.type == '装车点' ? zhuangchetubiao : item.type == '卸车点' ? xiechetubiao : kongzhidiantubiao,
scale: 0.15,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
clampToGround: true,
label: { text: item.name, pixelOffsetY: -40, color: 'blue'},
},
})
graphicLayer.addGraphic(graphic)
},
//关键点设置 //关键点设置
btnStartDraw(){ btnStartDraw(){
this.toJavaCoordinates = []; this.toJavaCoordinates = [];
...@@ -202,6 +243,13 @@ ...@@ -202,6 +243,13 @@
}, },
}); });
}, },
bindLayerPopup(graphicLayer,item) {
let that = this;
graphicLayer.bindPopup(function (event) {
that.$parent.clickPointFn(item);
that.controlPointId = item.id;
})
},
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment