成都三号线运行图解析

This commit is contained in:
ival 2019-08-07 15:32:35 +08:00
parent 3751748979
commit 7feea79e44
5 changed files with 42 additions and 59 deletions

View File

@ -1,8 +1,8 @@
const mapDeviceStyle = { const mapDeviceStyle = {
// '01': 'chengdu_04', // '01': 'chengdu_04',
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'bejing_01', // '03': 'bejing_01',
'04': 'chengdu_03', '03': 'chengdu_03',
'05': 'batong_01' // 暂时没有画北京八通线 '05': 'batong_01' // 暂时没有画北京八通线
}; };

View File

@ -83,7 +83,7 @@ export default class Switch extends Group {
const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth]; const rpoint3 = [rpoint2[0], rpoint2[1] + directy * switchWidth];
const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)]; const rpoint4 = [rpoint1[0] + this.triangle.getCos(slen), rpoint1[1] + this.triangle.getSin(slen)];
const switchWidth1 = style.Section.line.width / 2; const switchWidth1 = style.Section.line.width / 2 + 0.1;
const width1 = switchWidth1 * this.triangle.getSinRate(); const width1 = switchWidth1 * this.triangle.getSinRate();
const height1 = switchWidth1 * this.triangle.getCosRate(); const height1 = switchWidth1 * this.triangle.getCosRate();
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate(); const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
@ -213,10 +213,8 @@ export default class Switch extends Group {
this.setSwitchCoreColor(this.style.backgroundColor); this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false); this.name.getNameText().stopAnimation(false);
this.swCore.stopAnimation(false); this.swCore.stopAnimation(false);
if (!this.model.cutOff) { this.relocShelter.stopAnimation(false);
this.relocShelter.stopAnimation(false); this.relocShelter.hide();
this.relocShelter.hide();
}
this.releaseBackground.hide(); this.releaseBackground.hide();
this.setHasTextBorder(0); this.setHasTextBorder(0);
} }
@ -234,9 +232,9 @@ export default class Switch extends Group {
setInversionAction() { setInversionAction() {
this.recover(); this.recover();
this.setSwitchCoreInvisible(true); this.setSwitchCoreInvisible(true);
this.setTextColor(this.style.Switch.text.inversionColor);
this.locShelter.hide(); this.locShelter.hide();
this.relocShelter.show(); this.relocShelter.show();
this.setTextColor(this.style.Switch.text.inversionColor);
this.setSectionState(this.relocShelter.getSection(), 'fill', this.model); this.setSectionState(this.relocShelter.getSection(), 'fill', this.model);
} }
@ -324,7 +322,7 @@ export default class Switch extends Group {
} }
setSectionState(section, style, state) { setSectionState(section, style, state) {
if (section) { if (section && !section.animators.length) {
switch (state.sectionAstatus) { switch (state.sectionAstatus) {
case '00': break; case '00': break;
case '01': /** 空闲*/ case '01': /** 空闲*/
@ -359,11 +357,12 @@ export default class Switch extends Group {
section.setStyle(style, this.style.Section.line.protectiveLockColor); section.setStyle(style, this.style.Section.line.protectiveLockColor);
break; break;
} }
if (state.cutOff) {
this.sectionCutOff(section);
}
} }
if (state.cutOff && !section.animators.length ) {
this.sectionCutOff(section);
}
} }
setLocateType(model) { setLocateType(model) {
@ -387,6 +386,7 @@ export default class Switch extends Group {
setState(model) { setState(model) {
this.setLocateType(model); this.setLocateType(model);
switch (model.status) { switch (model.status) {
case '01': case '01':
this.spare(); /** 空闲*/ this.spare(); /** 空闲*/

View File

@ -14,10 +14,10 @@ export default {
ExcelConfig: { ExcelConfig: {
beginRow: 1, beginRow: 1,
beginCol: 0, beginCol: 0,
fieldNum: 10, fieldNum: 8,
sepField: '车次', sepField: '车次',
columns: { columns: {
'车站名': { key: 'stationName', formatter: (val) => { return val; } }, '车站名': { key: 'stationName', formatter: (val) => { return val; } },
'到点': { key: 'arriveTime', formatter: (val) => { return val; } }, '到点': { key: 'arriveTime', formatter: (val) => { return val; } },
'发点': { key: 'departureTime', formatter: (val) => { return val; } } '发点': { key: 'departureTime', formatter: (val) => { return val; } }
} }
@ -25,64 +25,46 @@ export default {
/** 解析exal数据转换为Json后台数据*/ /** 解析exal数据转换为Json后台数据*/
importData(Sheet, JsonData) { importData(Sheet, JsonData) {
var dataList = convertSheetToList(Sheet, true); var dataList = convertSheetToList(Sheet, false);
var needList = Object.keys(this.ExcelConfig.columns); var needList = Object.keys(this.ExcelConfig.columns);
if (dataList && dataList.length) { if (dataList && dataList.length) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList.length; colIndex += this.ExcelConfig.fieldNum + 1) { for (var rowIndex = this.ExcelConfig.beginRow; rowIndex < dataList.length; rowIndex += 1) {
var isContinue = true; for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList[this.ExcelConfig.beginCol].length; colIndex += this.ExcelConfig.fieldNum + 1) {
var tripObj = { code: '', arrivalList: [] }; var tripNew, tripObj;
for (var rowIndex = this.ExcelConfig.beginRow; isContinue; rowIndex += 1) {
isContinue = false;
var stationObj = {}; var stationObj = {};
tripNew = tripObj = { code: '', arrivalList: [] };
for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) { for (var index = 0; index < this.ExcelConfig.fieldNum; index += 1) {
if (dataList[colIndex + index]) { var title = dataList[0][colIndex + index];
var title = dataList[colIndex + index][0]; var value = dataList[rowIndex][colIndex + index];
var value = dataList[colIndex + index][rowIndex];
if (title && value) { if (title && value) {
// 数据列解析 var titleStr = `${title}`.trim();
isContinue = true; var valueStr = `${value}`.trim();
var titleStr = `${title}`.trim();
var valueStr = `${value}`.trim();
if (titleStr == this.ExcelConfig.sepField) { if (titleStr.includes(this.ExcelConfig.sepField)) {
if (tripObj.code) { tripObj.code = valueStr;
const length = tripObj.arrivalList.length; JsonData.forEach(elem => {
if (length == 1) { if (elem.code == valueStr) {
tripObj.arrivalList[0]['flag'] = true; tripObj = elem;
} return;
JsonData.push(tripObj);
tripObj = { code: valueStr, arrivalList: [] };
} else {
tripObj.code = valueStr;
} }
} });
}
// 取需要的字段 // 取需要的字段
if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) { if (needList.findIndex(elem => { return elem == titleStr; }) >= 0) {
stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr); stationObj[this.ExcelConfig.columns[titleStr].key] = this.ExcelConfig.columns[titleStr].formatter(valueStr);
}
} }
} }
} }
// 添加字段值 tripObj.arrivalList.push(stationObj);
if (Object.keys(stationObj).length) { if (tripObj == tripNew) {
tripObj.arrivalList.push(stationObj); JsonData.push(tripObj);
} }
} }
// 添加最后那条没有车次的记录
if (tripObj.code) {
const length = tripObj.arrivalList.length;
if (length) {
tripObj.arrivalList[length - 1]['flag'] = true;
}
JsonData.push(tripObj);
}
} }
} }

View File

@ -3,8 +3,8 @@ class Theme {
this._code = '02'; this._code = '02';
this._mapMenu = { this._mapMenu = {
'02': 'fuzhou_01', '02': 'fuzhou_01',
'03': 'beijing_01', // '03': 'beijing_01',
'04': 'chengdou_03', '03': 'chengdou_03',
'05': 'batong_01' '05': 'batong_01'
}; };
} }

View File

@ -177,6 +177,7 @@
case '5': return 'targetCode:serviceNumber:tripNumber'; //++ case '5': return 'targetCode:serviceNumber:tripNumber'; //++
case '6': return 'targetCode:serviceNumber:groupNumber'; //++ case '6': return 'targetCode:serviceNumber:groupNumber'; //++
} }
return ''; // return ''; //
} }
} }