Commit 6a6c31e5 authored by xxx's avatar xxx

修改轨迹展示效果

parent 2ecbbf34
......@@ -2584,6 +2584,14 @@ var HttpReq = function(){
params:param,
})
},
//获取轨迹分段时间以及坐标
apimineAlarmHistoryTjQuery: function(param){
return request({
url: '/api/mineAlarmHistory/Tj',
method: 'get',
params:param,
})
},
......
......@@ -48,6 +48,8 @@ export default {
carPlaySpeed:1,
stopPointData:[],
leadTime:false,
//获取停车时间段以及坐标点
stopCarCoordinates:[],
}
},
......@@ -137,19 +139,41 @@ export default {
hisCenterData.push(obj1);
that.historyTrajectoryData = [...hisCenterData];
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)// 构建地图
//获取停车时间段以及坐标点
if(that.leadTime){
HttpReq.truckDispatching.apimineAlarmHistoryTjQuery({number:that.carNumber,bTime:bTime,eTime:eTime}).then((resTj) => {
console.log(resTj);
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)// 构建地图
})
}
})
}
})
})
}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 {
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渲染失败后,刷新页面
map.on(mars3d.EventType.renderError,function(event){
window.location.reload();
......@@ -275,7 +307,7 @@ export default {
// 抛出事件
this.$emit('onload', map)
},
//车辆轨迹1
//车辆轨迹1:车辆运动
addGraphic_02(graphicLayer2,positions,truckName) {
let that = this;
var property = new Cesium.SampledPositionProperty();
......@@ -299,8 +331,8 @@ export default {
width: 4,
color: "rgb(251,84,48)",
opacity: 1.0,
leadTime: that.leadTime ? 9999 : 0, // 前方的路线不显示
trailTime: that.leadTime ? 9999 : 0,
leadTime: 0, // 前方的路线不显示
trailTime: 0,
//高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight: {
type: mars3d.EventType.click,
......@@ -356,6 +388,28 @@ export default {
})
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) {
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