Commit 6a6c31e5 authored by xxx's avatar xxx

修改轨迹展示效果

parent 2ecbbf34
...@@ -2584,6 +2584,14 @@ var HttpReq = function(){ ...@@ -2584,6 +2584,14 @@ var HttpReq = function(){
params:param, params:param,
}) })
}, },
//获取轨迹分段时间以及坐标
apimineAlarmHistoryTjQuery: function(param){
return request({
url: '/api/mineAlarmHistory/Tj',
method: 'get',
params:param,
})
},
......
...@@ -48,6 +48,8 @@ export default { ...@@ -48,6 +48,8 @@ export default {
carPlaySpeed:1, carPlaySpeed:1,
stopPointData:[], stopPointData:[],
leadTime:false, leadTime:false,
//获取停车时间段以及坐标点
stopCarCoordinates:[],
} }
}, },
...@@ -137,6 +139,12 @@ export default { ...@@ -137,6 +139,12 @@ export default {
hisCenterData.push(obj1); hisCenterData.push(obj1);
that.historyTrajectoryData = [...hisCenterData]; that.historyTrajectoryData = [...hisCenterData];
//获取停车时间段以及坐标点
if(that.leadTime){
HttpReq.truckDispatching.apimineAlarmHistoryTjQuery({number:that.carNumber,bTime:bTime,eTime:eTime}).then((resTj) => {
console.log(resTj);
that.stopCarCoordinates = [];
this.$nextTick(()=>{ this.$nextTick(()=>{
if (this.appendToBody) { if (this.appendToBody) {
document.body.appendChild(this.$el) document.body.appendChild(this.$el)
...@@ -150,6 +158,22 @@ export default { ...@@ -150,6 +158,22 @@ export default {
} }
}) })
})
}else{
that.stopCarCoordinates = [];
this.$nextTick(()=>{
if (this.appendToBody) {
document.body.appendChild(this.$el)
}
if (this.mapKey) {
this.initMars3d(this.options)
} else {
mars3d.Resource.fetchJson({ url: this.url }).then((data) => {
this.initMars3d(data.map3d)// 构建地图
})
}
})
}
} }
} }
}) })
...@@ -262,6 +286,14 @@ export default { ...@@ -262,6 +286,14 @@ export default {
that.addDemoGraphic1(graphicLayer2,item.lon,item.lat,item.alarmTime,item.time); that.addDemoGraphic1(graphicLayer2,item.lon,item.lat,item.alarmTime,item.time);
}) })
//展示轨迹
that.stopCarCoordinates,forEach((item,index)=>{
var graphicLayer3 = new mars3d.layer.GraphicLayer();
map.addLayer(graphicLayer3);
initGraphicManager(graphicLayer3);
that.addDemoGraphic2(graphicLayer3,item);
})
//webgl渲染失败后,刷新页面 //webgl渲染失败后,刷新页面
map.on(mars3d.EventType.renderError,function(event){ map.on(mars3d.EventType.renderError,function(event){
window.location.reload(); window.location.reload();
...@@ -275,7 +307,7 @@ export default { ...@@ -275,7 +307,7 @@ export default {
// 抛出事件 // 抛出事件
this.$emit('onload', map) this.$emit('onload', map)
}, },
//车辆轨迹1 //车辆轨迹1:车辆运动
addGraphic_02(graphicLayer2,positions,truckName) { addGraphic_02(graphicLayer2,positions,truckName) {
let that = this; let that = this;
var property = new Cesium.SampledPositionProperty(); var property = new Cesium.SampledPositionProperty();
...@@ -299,8 +331,8 @@ export default { ...@@ -299,8 +331,8 @@ export default {
width: 4, width: 4,
color: "rgb(251,84,48)", color: "rgb(251,84,48)",
opacity: 1.0, opacity: 1.0,
leadTime: that.leadTime ? 9999 : 0, // 前方的路线不显示 leadTime: 0, // 前方的路线不显示
trailTime: that.leadTime ? 9999 : 0, trailTime: 0,
//高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用 //高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight: { highlight: {
type: mars3d.EventType.click, type: mars3d.EventType.click,
...@@ -356,6 +388,28 @@ export default { ...@@ -356,6 +388,28 @@ export default {
}) })
graphicLayer.addGraphic(graphic) graphicLayer.addGraphic(graphic)
}, },
//展示轨迹
addDemoGraphic2(graphicLayer,item) {
const graphic = new mars3d.graphic.PolylineEntity({
positions: item.lines,
style: {
width: 6,
materialType: mars3d.MaterialType.PolylineOutline,
color: Cesium.Color.ORANGE,
outlineWidth: 2,
outlineColor: Cesium.Color.BLACK,
label: {
text: '开始时间',
font_size: 18,
color: "black",
distanceDisplayCondition: true,
distanceDisplayCondition_far: 500000,
distanceDisplayCondition_near: 0
}
},
})
graphicLayer.addGraphic(graphic)
},
//测距画线 //测距画线
startDrawGraphic(boo) { startDrawGraphic(boo) {
let that = this; let that = this;
......
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