From 472dd1b62ad2746202707bf935c598f1c969b150 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Mon, 13 Apr 2020 10:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9B=E5=B1=B1=E8=BF=90=E8=A1=8C=E5=9B=BE?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A0=A1=E9=AA=8C=E8=B0=83=E6=95=B4&?= =?UTF-8?q?=E8=A5=BF=E5=AE=89=E4=BA=8C=E5=8F=B7=E7=BA=BF=E8=BD=A6=E7=AB=99?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/xian_02.js | 13 ++++++++- src/jmapNew/constant/pathsvg.js | 7 ++--- src/jmapNew/shape/Station/ELampFilament.js | 17 +++++++++++ src/jmapNew/shape/Station/ETicketMachine.js | 17 +++++++++++ src/jmapNew/shape/Station/EUnmanned.js | 4 --- src/jmapNew/shape/Station/index.js | 32 +++++++++++++++++++-- src/jmapNew/theme/foshan_01/planConvert.js | 26 ++++++++++------- 7 files changed, 94 insertions(+), 22 deletions(-) create mode 100644 src/jmapNew/shape/Station/ELampFilament.js create mode 100644 src/jmapNew/shape/Station/ETicketMachine.js diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 699cb7edc..775161c45 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -343,11 +343,22 @@ class SkinCode extends defaultStyle { lamp: 1, // 灯数量 lampSpace: 60 // 灯间距 }, - unmanned: { + unmanned: { // 无人折返标识 width: 35, // 无人折返宽度 defaultColor: '#9F9C9C', // 默认颜色 activeColor: '#FFFFFF' // 激活颜色 }, + lampFilament:{ // 信号机灯丝警告 + width: 15, + defaultColor: '#9F9C9C', // 默认颜色 + warningColor: '#FFFF00' // 告警颜色 + }, + ticketMachine: { // LCW/ATS控制开关 + width: 15, + defaultColor: '#FFFFFF', // 默认颜色 + lcwColor: '#FFFF00', // LCW控制颜色 + faultColor: '#FF0000' // 故障颜色 + }, StationControl:{ text: { distance: 2, // 灯和文字之间的距离 diff --git a/src/jmapNew/constant/pathsvg.js b/src/jmapNew/constant/pathsvg.js index 556c38caa..20efdcf91 100644 --- a/src/jmapNew/constant/pathsvg.js +++ b/src/jmapNew/constant/pathsvg.js @@ -18,15 +18,14 @@ export default function createPathSvg(model) { const svg = path.createFromString(map[model._subType].path, { shape: { zlevel: model.zlevel, - z: model.z, - x: model.x, - y: model.y + z: model.z }, style: { fill: model.fill } }); - const scaleX = model.width / map[model._type].width; + const scaleX = model.width / map[model._subType].width; svg.scale = [scaleX, scaleX]; + svg.position = [model.x, model.y]; return svg; } diff --git a/src/jmapNew/shape/Station/ELampFilament.js b/src/jmapNew/shape/Station/ELampFilament.js new file mode 100644 index 000000000..5feab8c97 --- /dev/null +++ b/src/jmapNew/shape/Station/ELampFilament.js @@ -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); + } +} diff --git a/src/jmapNew/shape/Station/ETicketMachine.js b/src/jmapNew/shape/Station/ETicketMachine.js new file mode 100644 index 000000000..fb7e22a6b --- /dev/null +++ b/src/jmapNew/shape/Station/ETicketMachine.js @@ -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); + } +} diff --git a/src/jmapNew/shape/Station/EUnmanned.js b/src/jmapNew/shape/Station/EUnmanned.js index b02989c76..20fa25327 100644 --- a/src/jmapNew/shape/Station/EUnmanned.js +++ b/src/jmapNew/shape/Station/EUnmanned.js @@ -14,8 +14,4 @@ export default class EUnmanned extends Group { this.path = createPathSvg(this.model); this.add(this.path); } - setModel(dx, dy) { - this.model.point.x += dx; - this.model.point.y += dy; - } } diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 56c15fbc2..68778d770 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -11,6 +11,8 @@ import { arrow } from '../utils/ShapePoints'; import Rect from 'zrender/src/graphic/shape/Rect'; import BoundingRect from 'zrender/src/core/BoundingRect'; import EUnmanned from './EUnmanned'; +import ELampFilament from './ELampFilament'; +import ETicketMachine from './ETicketMachine'; // import {isShowThePrdType} from '../../utils/handlePath'; export default class Station extends Group { @@ -59,11 +61,37 @@ export default class Station extends Group { this.unmanned = new EUnmanned({ zlevel: this.zlevel, z: this.z, - x: model.position.x, - y: model.position.y, + x: model.unmannedPosition.x, + y: model.unmannedPosition.y, + _subType: 'Unmanned', width: style.Station.unmanned.width, 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; if (style.Station.kmPostShow || path.includes('/map/draw')) { diff --git a/src/jmapNew/theme/foshan_01/planConvert.js b/src/jmapNew/theme/foshan_01/planConvert.js index 757303bc3..1d583bf9c 100644 --- a/src/jmapNew/theme/foshan_01/planConvert.js +++ b/src/jmapNew/theme/foshan_01/planConvert.js @@ -26,7 +26,7 @@ export default { if (dataList && dataList.length) { if (dataList && dataList.length && dataList[1] && dataList[0]) { /** 解析二维数组为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 positionList = []; // trainId所在行 let columnNum; // trainId所在列 @@ -48,11 +48,13 @@ export default { if (reg.test(trainIdDown)) { const arrivalList = []; for (let j = 1; item + j < positionList[index + 1]; j = j + 2) { - arrivalList.push({ - stationName: dataList[columnNum][item + j], - arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : '', - departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : '' - }); + if (reg3.test(dataList[i][item + j]) || reg3.test(dataList[i][item + j + 1])) { + arrivalList.push({ + stationName: dataList[columnNum][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]) : prefixTime(dataList[i][item + j]) + }); + } } JsonData.push({ code: trainIdDown, @@ -62,11 +64,13 @@ export default { } else if (reg.test(trainIdUp)) { const arrivalList = []; for (let j = 1; positionList[index + 1] - j > item; j = j + 2) { - arrivalList.push({ - stationName: dataList[columnNum][item + j], - arriveTime: reg3.test(dataList[i][item + j]) ? prefixTime(dataList[i][item + j]) : '', - departureTime: reg3.test(dataList[i][item + j + 1]) ? prefixTime(dataList[i][item + j + 1]) : '' - }); + if (reg3.test(dataList[i][item + j]) || reg3.test(dataList[i][item + j + 1])) { + arrivalList.push({ + stationName: dataList[columnNum][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]) : prefixTime(dataList[i][item + j]) + }); + } } JsonData.push({ code: trainIdUp,