调整佛山线路,成都一号线运行图 方向信息

This commit is contained in:
zyy 2020-04-14 10:27:33 +08:00
parent feca56f94b
commit cc984c8eb0
4 changed files with 38 additions and 19 deletions

View File

@ -1,4 +1,4 @@
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList } from '@/utils/runPlan'; import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList } from '@/utils/runPlan';
export default { export default {
/** 边缘高度*/ /** 边缘高度*/
@ -116,7 +116,7 @@ export default {
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.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/ /** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata)); opt.markPointData.push(createMartPointReverse(pointdata));
/** 创建服务号名称*/ /** 创建服务号名称*/
opt.name = `${service.serviceNumber}`; opt.name = `${service.serviceNumber}`;
} }
@ -206,7 +206,7 @@ export default {
/** 如果此记录车组号的数据为第一条时,则打上标签*/ /** 如果此记录车组号的数据为第一条时,则打上标签*/
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
serie.markPoint.data.push(createMartPoint({ serie.markPoint.data.push(createMartPointReverse({
directionCode: elem.directionCode, directionCode: elem.directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`,
@ -290,9 +290,9 @@ export default {
/** 根据方向计算y折返偏移量*/ /** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) { getYvalueByDirectionCode(defaultVlue, directionCode, num) {
if (directionCode === '1') { if (directionCode === '1') {
defaultVlue -= this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue += this.EdgeHeight / 2 * num; defaultVlue += this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue -= this.EdgeHeight / 2 * num;
} }
return defaultVlue; return defaultVlue;

View File

@ -1,4 +1,4 @@
import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan'; import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan';
export default { export default {
/** 边缘高度*/ /** 边缘高度*/
@ -111,7 +111,7 @@ export default {
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.directionCode, false)];
/** 给服务对象添加服务名称和标记点*/ /** 给服务对象添加服务名称和标记点*/
opt.markPointData.push(createMartPoint(pointdata)); opt.markPointData.push(createMartPointReverse(pointdata));
/** 创建服务号名称*/ /** 创建服务号名称*/
opt.name = `${service.serviceNumber}`; opt.name = `${service.serviceNumber}`;
} }
@ -197,7 +197,7 @@ export default {
/** 如果此记录车组号的数据为第一条时,则打上标签*/ /** 如果此记录车组号的数据为第一条时,则打上标签*/
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
serie.markPoint.data.push(createMartPoint({ serie.markPoint.data.push(createMartPointReverse({
directionCode: elem.directionCode, directionCode: elem.directionCode,
coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)],
name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`,
@ -282,9 +282,9 @@ export default {
/** 根据方向计算y折返偏移量*/ /** 根据方向计算y折返偏移量*/
getYvalueByDirectionCode(defaultVlue, directionCode, num) { getYvalueByDirectionCode(defaultVlue, directionCode, num) {
if (directionCode === '1') { if (directionCode === '1') {
defaultVlue -= this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue += this.EdgeHeight / 2 * num; defaultVlue += this.EdgeHeight / 2 * num;
} else if (directionCode === '2') {
defaultVlue -= this.EdgeHeight / 2 * num;
} }
return defaultVlue; return defaultVlue;

View File

@ -20,6 +20,25 @@ export function createMartPoint(opt) {
}; };
} }
/** 创建一个车次数据点*/
export function createMartPointReverse(opt) {
const rotate = opt.directionCode == '1' ? 45 : (opt.directionCode == '2' ? -45 : 0);
const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft';
return {
coord: opt.coord,
name: opt.name,
label: {
normal: {
rotate: rotate,
formatter: '{b}',
backgroundColor: 'rgb(242,242,242,0.1)',
color: 'black',
position: position
}
}
};
}
/** 创建一个车次数据序列*/ /** 创建一个车次数据序列*/
export function createSeriesModel(opt, lineStyle) { export function createSeriesModel(opt, lineStyle) {
if (opt) { if (opt) {

View File

@ -280,20 +280,20 @@ export default {
const serviceNumber = this.$store.state.runPlan.selected.serviceNumber; const serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
let tripNumber = null; let tripNumber = null;
if (row) { if (row) {
let data; const data = [];
tripNumber = row.tripNumber; tripNumber = row.tripNumber;
const op = this.myChart.getOption(); const op = this.myChart.getOption();
op.series.forEach((item, index) => { op.series.forEach((item, index) => {
switch (item.name) { switch (item.name) {
case serviceNumber: { case serviceNumber: {
const param = '\\[\\d*,\\d*,"Station_\\d*_[.\\d]*","' + tripNumber + '"\\]'; // const param = '\\[\\d*,\\d*,"Station_\\d*_[.\\d]*","' + tripNumber + '"\\]';
const temp = JSON.stringify(item.data).match(new RegExp(param, 'g')); // const temp = JSON.stringify(item.data).match(new RegExp(param, 'g'));
data = JSON.parse('[' + temp.toString() + ']'); // data = JSON.parse('[' + temp.toString() + ']');
// item.data.forEach(nor => { item.data.forEach(nor => {
// if (nor[3] == tripNumber) { if (nor[3] == tripNumber) {
// data.push(nor); data.push(nor);
// } }
// }); });
break; break;
} }
case 'trainLabel': { case 'trainLabel': {