宁波一、三号线,西安二号线 运行图 转换函数 调整

This commit is contained in:
joylink_cuiweidong 2021-01-28 14:45:33 +08:00
parent f6d3a6f030
commit 909a5cb7f9
4 changed files with 36 additions and 28 deletions

View File

@ -142,7 +142,7 @@ export default {
if (!store.state.map.mapConfig.upRight) {
pointdata.directionCode = train.right ? '1' : '2';
}
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], pointdata.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata));
@ -158,7 +158,7 @@ export default {
index > 0 && index < train.stationTimeList.length - 1) {
// ${train.directionCode}
const aa = `${train.tripNumber}`;
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, aa, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, elem, pointdata.directionCode, false), elem.stationCode, aa, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
}
});
@ -167,8 +167,8 @@ export default {
lastPoint = train.stationTimeList[idx - 1];
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[1];
num = this.computedReentryNumber(train.tripNumber);
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, true, num), lastPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, train.directionCode, true, num), nextPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, `${service.serviceNumber}${train.tripNumber}${train.destinationCode || ''}`]);
}
/** 如果是备用车,按车次添加线*/
@ -229,15 +229,14 @@ export default {
runPlanData[elem.serviceNumber][elem.tripNumber].sort((a, b) => {
return parseInt(a.secondTime) - parseInt(b.secondTime);
});
let directionCode = elem.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
directionCode = elem.right ? '1' : '2';
}
/** 如果此记录车组号的数据为第一条时,则打上标签*/
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
const result = serie.markPoint.data.some(ele => ele.name == `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`);
if (!result) {
let directionCode = elem.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
directionCode = elem.right ? '1' : '2';
}
serie.markPoint.data.push(createMartPoint({
directionCode: directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
@ -248,7 +247,7 @@ export default {
}
/** 计算折返点*/
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), elem.directionCode];
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false), directionCode];
if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) {

View File

@ -1,5 +1,5 @@
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
import store from '@/store/index';
export default {
/** 边缘高度*/
EdgeHeight: 600,
@ -173,8 +173,12 @@ export default {
// pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`;
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
pointdata.color = '#000' || lineStyle.color;
pointdata.directionCode = train.directionCode;
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)];
// pointdata.directionCode = train.directionCode;
pointdata.directionCode = train.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
pointdata.directionCode = train.right ? '1' : '2';
}
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], pointdata.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata));
@ -190,7 +194,7 @@ export default {
index > 0 && index < train.stationTimeList.length - 1) {
// ${train.directionCode}
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, pointdata.directionCode, false), elem.stationCode, aa]);
}
});
@ -201,8 +205,8 @@ export default {
num = this.computedReentryNumber(train.tripNumber);
// ${train.directionCode}
const aa = `${train.tripNumber}`;
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, 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([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, aa]);
}
/** 如果是备用车,按车次添加线*/
@ -267,12 +271,16 @@ export default {
return parseInt(a.secondTime) - parseInt(b.secondTime);
});
let directionCode = elem.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
directionCode = elem.right ? '1' : '2';
}
/** 如果此记录车组号的数据为第一条时,则打上标签*/
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
const result = serie.markPoint.data.some(ele => ele.name == `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`);
if (!result) {
serie.markPoint.data.push(createMartPoint({
directionCode: elem.directionCode,
directionCode: directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`,
color: lineStyle.color || '#000'
@ -282,7 +290,7 @@ export default {
/** 计算折返点*/
var num = this.computedReentryNumber(elem.tripNumber);
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false, num), elem.directionCode];
var nextPoint = [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, false, num), directionCode];
if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1];
if (lastPoint[2] !== nextPoint[2]) {

View File

@ -128,7 +128,7 @@ export default {
if (!store.state.map.mapConfig.upRight) {
pointdata.directionCode = train.right ? '1' : '2';
}
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], pointdata.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata));

View File

@ -182,7 +182,7 @@ export default {
if (!store.state.map.mapConfig.upRight) {
pointdata.directionCode = train.right ? '1' : '2';
}
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], pointdata.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata));
@ -198,7 +198,7 @@ export default {
index > 0 && index < train.stationTimeList.length - 1) {
// ${train.directionCode}
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, pointdata.directionCode, false), elem.stationCode, aa]);
}
});
@ -209,8 +209,8 @@ export default {
num = this.computedReentryNumber(train.tripNumber);
// ${train.directionCode}
const aa = `${train.tripNumber}`;
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, train.directionCode, 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([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, aa]);
}
/** 如果是备用车,按车次添加线*/
@ -276,14 +276,15 @@ export default {
return parseInt(a.secondTime) - parseInt(b.secondTime);
});
let directionCode = elem.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
directionCode = elem.right ? '1' : '2';
}
/** 如果此记录车组号的数据为第一条时,则打上标签*/
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
const result = serie.markPoint.data.some(ele => ele.name == `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`);
if (!result) {
let directionCode = elem.right ? '2' : '1';
if (!store.state.map.mapConfig.upRight) {
directionCode = elem.right ? '1' : '2';
}
serie.markPoint.data.push(createMartPoint({
directionCode: directionCode,
coord: [parseInt(time), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
@ -295,7 +296,7 @@ export default {
/** 计算折返点*/
// var num = this.computedReentryNumber(elem.tripNumber);
var nextPoint = [parseInt(time), this.getCoordYByElem(stations, kmRangeCoordMap, elem, elem.directionCode, false), elem.stationCode, elem.directionCode];
var nextPoint = [parseInt(time), this.getCoordYByElem(stations, kmRangeCoordMap, elem, directionCode, false), elem.stationCode, directionCode];
if (serie.data.length > 0) {
var lastPoint = serie.data[serie.data.length - 1];