运行图编制 折返数据解析 代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-30 11:26:25 +08:00
parent 770bdff791
commit 0fb623ef59
2 changed files with 118 additions and 110 deletions

View File

@ -7,8 +7,8 @@ const defaultConfig = {
/** 间隔高度*/
multiple: 3,
/** 偏移时间*/
translation: 60 * 60 * 2,
}
translation: 60 * 60 * 2
};
class EqualDistanceParser {
constructor() {
@ -27,7 +27,7 @@ class EqualDistanceParser {
importData(sheet, data) {
if (this.config &&
this.config.importData) {
this.config.importData(sheet, data)
this.config.importData(sheet, data);
} else {
console.info('no import data function');
}
@ -74,6 +74,9 @@ class EqualDistanceParser {
/** 计算折返点车次坐标点集合*/
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
const currentTimeList = service.tripNumberDataList[j].stationTimeList;
const nextTimeList = service.tripNumberDataList[j + 1].stationTimeList;
if (currentTimeList[currentTimeList.length - 1].secondTime != nextTimeList[0].secondTime) {
lastPoint = train.stationTimeList[idx];
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
// ${train.directionCode}
@ -81,6 +84,7 @@ class EqualDistanceParser {
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true), lastPoint.stationCode, aa, '折返轨']);
}
}
/** 如果是备用车,按车次添加线*/
if (train.backup) {
@ -261,7 +265,7 @@ class EqualDistanceParser {
}
getTranslation() {
return this.config.translation
return this.config.translation;
}
getEdge() {

View File

@ -11,8 +11,8 @@ const defaultConfig = {
/** 间隔高度*/
multiple: 1,
/** 偏移时间*/
translation: 0,
}
translation: 0
};
class EqualRatioParser {
constructor() {
@ -28,7 +28,7 @@ class EqualRatioParser {
importData(sheet, data) {
if (this.config &&
this.config.importData) {
this.config.importData(sheet, data)
this.config.importData(sheet, data);
} else {
console.info('no import data function');
}
@ -81,6 +81,9 @@ class EqualRatioParser {
/** 计算折返点车次坐标点集合*/
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
const currentTimeList = service.tripNumberDataList[j].stationTimeList;
const nextTimeList = service.tripNumberDataList[j + 1].stationTimeList;
if (currentTimeList[currentTimeList.length - 1].secondTime != nextTimeList[0].secondTime) {
lastPoint = train.stationTimeList[train.stationTimeList.length - 1];
nextPoint = service.tripNumberDataList[j + 1].stationTimeList[0];
num = this.computedReentryNumber(train.tripNumber);
@ -88,6 +91,7 @@ class EqualRatioParser {
opt.data.push([lastPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, lastPoint, pointdata.directionCode, true, num), lastPoint.stationCode, aa]);
opt.data.push([nextPoint.secondTime, this.getCoordYByElem(stations, kmRangeMap, nextPoint, pointdata.directionCode, true, num), nextPoint.stationCode, aa]);
}
}
/** 如果是备用车,按车次添加线*/
if (train.backup) {
@ -275,7 +279,7 @@ class EqualRatioParser {
}
getTranslation() {
return this.config.translation
return this.config.translation;
}
getEdge() {