调整国赛运行图流程

This commit is contained in:
zyy 2020-10-28 18:34:53 +08:00
parent a0ce657912
commit b76f963a7b

View File

@ -114,7 +114,7 @@ export default {
pointdata.name = `${service.serviceNumber}${train.tripNumber}`; pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
pointdata.color = '#000' || lineStyle.color; pointdata.color = '#000' || lineStyle.color;
pointdata.directionCode = train.directionCode; pointdata.directionCode = train.directionCode;
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.right, false)];
/** 给服务对象添加服务名称和标记点*/ /** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata)); opt.markPointData.push(createMartPoint(pointdata));
@ -130,7 +130,7 @@ export default {
index > 0 && index < train.stationTimeList.length - 1) { index > 0 && index < train.stationTimeList.length - 1) {
// ${train.directionCode} // ${train.directionCode}
const aa = `${train.tripNumber}`; const aa = `${train.tripNumber}`;
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa]); opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.right, false), elem.stationCode, aa]);
} }
}); });
@ -141,8 +141,8 @@ export default {
num = this.computedReentryNumber(train.tripNumber); num = this.computedReentryNumber(train.tripNumber);
// ${train.directionCode} // ${train.directionCode}
const aa = `${train.tripNumber}`; const aa = `${train.tripNumber}`;
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, aa]); opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.right, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, aa]); opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.right, true, num), nextPoint.stationCode, aa]);
} }
/** 如果是备用车,按车次添加线*/ /** 如果是备用车,按车次添加线*/
@ -225,9 +225,9 @@ export default {
if (serie.data.length > 0) { if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1]; var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) { if (lastPoint[2] !== nextPoint[2]) {
var num = this.computedReentryNumber(elem.tripNumber); // var num = this.computedReentryNumber(elem.tripNumber);
serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([lastPoint[0], this.getYvalueByDirectionCode(lastPoint[1], lastPoint[2], elem.right), lastPoint[2]]);
serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], num), lastPoint[2]]); serie.data.push([nextPoint[0], this.getYvalueByDirectionCode(nextPoint[1], lastPoint[2], elem.right), lastPoint[2]]);
} }
} }
@ -295,10 +295,10 @@ export default {
}, },
/** 根据方向计算y折返偏移量*/ /** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) { getYvalueByDirectionCode(defaultVlue, right, num) {
if (directionCode === '1') { if (!right) {
defaultVlue -= this.EdgeHeight / 2 * num; defaultVlue -= this.EdgeHeight / 2 * num;
} else if (directionCode === '2') { } else if (right) {
defaultVlue += this.EdgeHeight / 2 * num; defaultVlue += this.EdgeHeight / 2 * num;
} }
@ -306,13 +306,13 @@ export default {
}, },
/** 根据elem计算y值*/ /** 根据elem计算y值*/
getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, isSpecial, num) { getCoordYByElem(stations, kmRangeCoordMap, elem, right, isSpecial, num) {
var defaultVlue = 0; var defaultVlue = 0;
var station = stations.find(it => { return it.code == elem.stationCode; }); var station = stations.find(it => { return it.code == elem.stationCode; });
if (station) { if (station) {
defaultVlue = kmRangeCoordMap[`${station.kmRange}`]; defaultVlue = kmRangeCoordMap[`${station.kmRange}`];
if (isSpecial) { if (isSpecial) {
defaultVlue = this.getYvalueByDirectionCode(defaultVlue, directionCode, num); defaultVlue = this.getYvalueByDirectionCode(defaultVlue, right, num);
} }
} }