佛山运行图导入校验调整&西安二号线车站调整

This commit is contained in:
fan 2020-04-13 10:43:02 +08:00
parent 826504d9c7
commit 472dd1b62a
7 changed files with 94 additions and 22 deletions

View File

@ -343,11 +343,22 @@ class SkinCode extends defaultStyle {
lamp: 1, // 灯数量 lamp: 1, // 灯数量
lampSpace: 60 // 灯间距 lampSpace: 60 // 灯间距
}, },
unmanned: { unmanned: { // 无人折返标识
width: 35, // 无人折返宽度 width: 35, // 无人折返宽度
defaultColor: '#9F9C9C', // 默认颜色 defaultColor: '#9F9C9C', // 默认颜色
activeColor: '#FFFFFF' // 激活颜色 activeColor: '#FFFFFF' // 激活颜色
}, },
lampFilament:{ // 信号机灯丝警告
width: 15,
defaultColor: '#9F9C9C', // 默认颜色
warningColor: '#FFFF00' // 告警颜色
},
ticketMachine: { // LCW/ATS控制开关
width: 15,
defaultColor: '#FFFFFF', // 默认颜色
lcwColor: '#FFFF00', // LCW控制颜色
faultColor: '#FF0000' // 故障颜色
},
StationControl:{ StationControl:{
text: { text: {
distance: 2, // 灯和文字之间的距离 distance: 2, // 灯和文字之间的距离

View File

@ -18,15 +18,14 @@ export default function createPathSvg(model) {
const svg = path.createFromString(map[model._subType].path, { const svg = path.createFromString(map[model._subType].path, {
shape: { shape: {
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z
x: model.x,
y: model.y
}, },
style: { style: {
fill: model.fill fill: model.fill
} }
}); });
const scaleX = model.width / map[model._type].width; const scaleX = model.width / map[model._subType].width;
svg.scale = [scaleX, scaleX]; svg.scale = [scaleX, scaleX];
svg.position = [model.x, model.y];
return svg; return svg;
} }

View File

@ -0,0 +1,17 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from '../../constant/pathsvg';
export default class ELampFilament extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.z;
this._subType = model._subType;
this.create();
}
create() {
this.path = createPathSvg(this.model);
this.add(this.path);
}
}

View File

@ -0,0 +1,17 @@
import Group from 'zrender/src/container/Group';
import createPathSvg from '../../constant/pathsvg';
export default class ETicketMachine extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.z;
this._subType = model._subType;
this.create();
}
create() {
this.path = createPathSvg(this.model);
this.add(this.path);
}
}

View File

@ -14,8 +14,4 @@ export default class EUnmanned extends Group {
this.path = createPathSvg(this.model); this.path = createPathSvg(this.model);
this.add(this.path); this.add(this.path);
} }
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
} }

View File

@ -11,6 +11,8 @@ import { arrow } from '../utils/ShapePoints';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import EUnmanned from './EUnmanned'; import EUnmanned from './EUnmanned';
import ELampFilament from './ELampFilament';
import ETicketMachine from './ETicketMachine';
// import {isShowThePrdType} from '../../utils/handlePath'; // import {isShowThePrdType} from '../../utils/handlePath';
export default class Station extends Group { export default class Station extends Group {
@ -59,11 +61,37 @@ export default class Station extends Group {
this.unmanned = new EUnmanned({ this.unmanned = new EUnmanned({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
x: model.position.x, x: model.unmannedPosition.x,
y: model.position.y, y: model.unmannedPosition.y,
_subType: 'Unmanned',
width: style.Station.unmanned.width, width: style.Station.unmanned.width,
fill: style.Station.unmanned.defaultColor fill: style.Station.unmanned.defaultColor
}); });
this.add(this.unmanned);
}
if (style.Station.lampFilament && model.showLampFilament) {
this.lampFilament = new ELampFilament({
zlevel: this.zlevel,
z: this.z,
x: model.lampFilamentPosition.x,
y: model.lampFilamentPosition.y,
_subType: 'LampFilament',
width: style.Station.lampFilament.width,
fill: style.Station.lampFilament.defaultColor
});
this.add(this.lampFilament);
}
if (style.Station.ticketMachine && model.showTicketMachine) {
this.ticketMachine = new ETicketMachine({
zlevel: this.zlevel,
z: this.z,
x: model.ticketMachinePosition.x,
y: model.ticketMachinePosition.y,
_subType: 'TicketMachine',
width: style.Station.ticketMachine.width,
fill: style.Station.ticketMachine.defaultColor
});
this.add(this.ticketMachine);
} }
const path = window.location.href; const path = window.location.href;
if (style.Station.kmPostShow || path.includes('/map/draw')) { if (style.Station.kmPostShow || path.includes('/map/draw')) {

View File

@ -26,7 +26,7 @@ export default {
if (dataList && dataList.length) { if (dataList && dataList.length) {
if (dataList && dataList.length && dataList[1] && dataList[0]) { if (dataList && dataList.length && dataList[1] && dataList[0]) {
/** 解析二维数组为json对象*/ /** 解析二维数组为json对象*/
const reg3 = /^(\d+:\d+:\d+|)/; // 06:12:00 const reg3 = /^(\d{1,2})(:)(\d{2})(:)(\d{2})$/; // 06:12:00
const reg = /^[0-9]{5}/; const reg = /^[0-9]{5}/;
const positionList = []; // trainId所在行 const positionList = []; // trainId所在行
let columnNum; // trainId所在列 let columnNum; // trainId所在列
@ -48,12 +48,14 @@ export default {
if (reg.test(trainIdDown)) { if (reg.test(trainIdDown)) {
const arrivalList = []; const arrivalList = [];
for (let j = 1; item + j < positionList[index + 1]; j = j + 2) { for (let j = 1; item + j < positionList[index + 1]; j = j + 2) {
if (reg3.test(dataList[i][item + j]) || reg3.test(dataList[i][item + j + 1])) {
arrivalList.push({ arrivalList.push({
stationName: dataList[columnNum][item + j], stationName: dataList[columnNum][item + j],
arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : '', arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : prefixTime(dataList[i][item + j + 1]),
departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : '' departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : prefixTime(dataList[i][item + j])
}); });
} }
}
JsonData.push({ JsonData.push({
code: trainIdDown, code: trainIdDown,
destinationCode: '1', destinationCode: '1',
@ -62,12 +64,14 @@ export default {
} else if (reg.test(trainIdUp)) { } else if (reg.test(trainIdUp)) {
const arrivalList = []; const arrivalList = [];
for (let j = 1; positionList[index + 1] - j > item; j = j + 2) { for (let j = 1; positionList[index + 1] - j > item; j = j + 2) {
if (reg3.test(dataList[i][item + j]) || reg3.test(dataList[i][item + j + 1])) {
arrivalList.push({ arrivalList.push({
stationName: dataList[columnNum][item + j], stationName: dataList[columnNum][item + j],
arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : '', arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : prefixTime(dataList[i][item + j + 1]),
departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : '' departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : prefixTime(dataList[i][item + j])
}); });
} }
}
JsonData.push({ JsonData.push({
code: trainIdUp, code: trainIdUp,
destinationCode: '2', destinationCode: '2',