From d7c17d0935ea4e4b257644c15d7e025a9763fe0a Mon Sep 17 00:00:00 2001 From: lVAL Date: Fri, 5 Feb 2021 18:00:06 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=81=93=E5=B2=94?= =?UTF-8?q?=E5=A4=AA=E7=9F=AD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/theme/nanjing_02/menus/menuButton.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jmapNew/theme/nanjing_02/menus/menuButton.vue b/src/jmapNew/theme/nanjing_02/menus/menuButton.vue index e90d2097e..f56b5141b 100644 --- a/src/jmapNew/theme/nanjing_02/menus/menuButton.vue +++ b/src/jmapNew/theme/nanjing_02/menus/menuButton.vue @@ -1092,17 +1092,17 @@ export default { { name: '开放信号', commandTip: '设置信号机为开放状态', cmdType: CMD.Signal.CMD_SIGNAL_REOPEN_SIGNAL, operate: OperationEvent.Signal.reopenSignal.menuButton, disabledCb: (stationControl) => !this.modeMatch }, { name: '解封信号', commandTip: '解封信号机,允许开放', cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK, operate: OperationEvent.Signal.unlock.menuButton, securityCommand: true, disabledCb: (stationControl) => !this.modeMatch }, - { name: '自排单开', commandTip: '设置单架信号机处于ATS自动排列进路模式', cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING, operate: OperationEvent.Signal.atsAutoControl.menuButton, disabledCb: (stationControl) => !this.modeMatch || stationControl.atsControl }, - { name: '自排单关', commandTip: '取消单架信号机处于ATS自动排列进路模式', cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING, operate: OperationEvent.Signal.humanControl.menuButton, disabledCb: (stationControl) => !this.modeMatch || !stationControl.atsControl }, - { name: '追踪单开', commandTip: '设置单架信号机处于联锁自动排列进路', cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO_TRIGGER, operate: OperationEvent.Signal.setAutoTrigger.menuButton, disabledCb: (stationControl) => !this.modeMatch || stationControl.ciControl }, - { name: '追踪单关', commandTip: '取消单架信号机处于联锁自动排列进路', cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO_TRIGGER, operate: OperationEvent.Signal.cancelAutoTrigger.menuButton, disabledCb: (stationControl) => !this.modeMatch || !stationControl.ciControl }, + { name: '自排单开', commandTip: '设置单架信号机处于ATS自动排列进路模式', cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING, operate: OperationEvent.Signal.atsAutoControl.menuButton, disabledCb: (stationControl) => !this.modeMatch }, // || stationControl.atsControl + { name: '自排单关', commandTip: '取消单架信号机处于ATS自动排列进路模式', cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING, operate: OperationEvent.Signal.humanControl.menuButton, disabledCb: (stationControl) => !this.modeMatch }, // || !stationControl.atsControl + { name: '追踪单开', commandTip: '设置单架信号机处于联锁自动排列进路', cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO_TRIGGER, operate: OperationEvent.Signal.setAutoTrigger.menuButton, disabledCb: (stationControl) => !this.modeMatch }, // || stationControl.ciControl + { name: '追踪单关', commandTip: '取消单架信号机处于联锁自动排列进路', cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO_TRIGGER, operate: OperationEvent.Signal.cancelAutoTrigger.menuButton, disabledCb: (stationControl) => !this.modeMatch }, // || !stationControl.ciControl { name: '开放引导', commandTip: '开放引导信号', cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE, operate: OperationEvent.Signal.reopenSignal.menuButton, securityCommand: true, disabledCb: (stationControl) => !this.modeMatch }, { name: '车队单开', commandTip: '对单架信号机开启车队模式,主要是信号机不关闭的情况下排列所有进路', cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO, operate: OperationEvent.Signal.reopenSignal.menuButton, disabledCb: (stationControl) => !this.modeMatch }, { name: '车队单关', commandTip: '对单架信号机关闭车队模式', cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO, operate: OperationEvent.Signal.reopenSignal.menuButton, disabledCb: (stationControl) => !this.modeMatch }, { name: '设置保护', cmdType: '', operate: OperationEvent.Signal.reopenSignal.menuButton, disabledCb: (stationControl) => !this.modeMatch }, { name: '未评限区', cmdType: '', operate: OperationEvent.Signal.reopenSignal.menuButton, securityCommand: true, disabledCb: (stationControl) => !this.modeMatch } - ]; + ]; this.stationParamList = this.$store.state.training.prdType === '01' ? [ { name: '关站信号', commandTip: '封锁车站所有信号机', cmdType: CMD.Station.CMD_STATION_CLOSE_ALLSIGNAL, operate: OperationEvent.Station.closeAllSignal.menuButton, disabledCb: (stationControl) => !this.modeMatch || !['Local'].includes(stationControl.controlMode) } ] : [ From a038ca70409e57332a621fad1afd9f14bbc1c72b Mon Sep 17 00:00:00 2001 From: lVAL Date: Fri, 5 Feb 2021 18:01:16 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=AE=81=E6=B3=A2?= =?UTF-8?q?=E7=BA=BF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/config/skinCode/nanjing_02.js | 3 +- src/jmapNew/map.js | 31 +- src/jmapNew/shape/Arrow/index.js | 2 +- src/jmapNew/shape/AutoTurnBack/index.js | 2 +- src/jmapNew/shape/AutomacticRoute/index.js | 2 +- src/jmapNew/shape/AxleReset/index.js | 13 +- src/jmapNew/shape/Cross/index.js | 2 +- src/jmapNew/shape/DirectionRod/index.js | 2 +- src/jmapNew/shape/FloodGate/index.js | 2 +- src/jmapNew/shape/GuideLock/index.js | 20 +- src/jmapNew/shape/LcControl/index.js | 14 +- src/jmapNew/shape/LimitControl/index.js | 13 +- src/jmapNew/shape/Line/index.js | 2 +- src/jmapNew/shape/OutFrame/index.js | 2 +- src/jmapNew/shape/OverAp/index.js | 2 +- src/jmapNew/shape/Power/index.js | 2 +- src/jmapNew/shape/Psd/index.js | 20 +- src/jmapNew/shape/Resource/index.js | 2 +- src/jmapNew/shape/Responder/index.js | 2 +- src/jmapNew/shape/SaidLamp/index.js | 2 +- src/jmapNew/shape/Section/index.js | 97 ++++--- src/jmapNew/shape/Signal/index.js | 165 +++++------ src/jmapNew/shape/SplitStation/index.js | 2 +- src/jmapNew/shape/Station/index.js | 2 +- src/jmapNew/shape/StationCounter/index.js | 2 +- src/jmapNew/shape/StationDelayUnlock/index.js | 2 +- .../shape/StationStand/detain/EDetain.js | 2 +- .../StationStand/emergent/EEmergentRhombus.js | 4 + src/jmapNew/shape/StationStand/index.js | 27 +- src/jmapNew/shape/StationTurnBack/index.js | 35 ++- src/jmapNew/shape/Switch/index.js | 125 +++++--- src/jmapNew/shape/Text/index.js | 8 +- src/jmapNew/shape/Train/index.js | 2 +- src/jmapNew/shape/TrainWindow/index.js | 2 +- src/jmapNew/shape/ZcControl/index.js | 18 +- src/jmapNew/shape/checkBox/checkBox.js | 2 +- src/jmapNew/shape/factory.js | 2 +- .../ningbo_01/menus/dialog/mapVisual.vue | 271 ++++++++++++++++++ .../ningbo_01/menus/dialog/routeSelection.vue | 196 ++++++++----- src/jmapNew/utils/parser.js | 4 +- src/utils/baseUrl.js | 4 +- 41 files changed, 790 insertions(+), 322 deletions(-) create mode 100644 src/jmapNew/theme/ningbo_01/menus/dialog/mapVisual.vue diff --git a/src/jmapNew/config/skinCode/nanjing_02.js b/src/jmapNew/config/skinCode/nanjing_02.js index 07133a24a..d73799447 100644 --- a/src/jmapNew/config/skinCode/nanjing_02.js +++ b/src/jmapNew/config/skinCode/nanjing_02.js @@ -574,8 +574,9 @@ class SkinCode extends defaultStyle { spareColor: '#5b5b5b' // 区段显示颜色 (灰色) }, core: { + rateOpen: true, // 计算道岔按照区段一半计算 splice: true, // 哈尔滨特殊显示 - length: 6 // 道岔单边长度 + length: 30 // 道岔单边A长度, }, trapezoid: { // 直角梯形元素 length: 16, // 默认长度 diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 1d4f7427a..87b217ac3 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -173,13 +173,30 @@ class Jlmap { this.$painter.updateScreenNum(opts); } + setCenterWithOffset(deviceCode, offsetX) { + const arr = Object.keys(this.mapDevice); + if (arr.length != 0) { + const device = this.mapDevice[deviceCode]; + if (device && device.instance) { + var rect = createBoundingRect(device.instance); + var dcenter = calculateDCenter(rect, offsetX, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); + this.setOptions(dcenter); + } + } else { + setTimeout(() => { + this.setCenter(deviceCode); + }, 60); + } + } + + setCenter(deviceCode) { const arr = Object.keys(this.mapDevice); if (arr.length != 0) { const device = this.mapDevice[deviceCode]; if (device && device.instance) { var rect = createBoundingRect(device.instance); - var dcenter = calculateDCenter(rect, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); + var dcenter = calculateDCenter(rect, this.$zr.getWidth()/2, { width: this.$zr.getWidth(), height: this.$zr.getHeight() }); this.setOptions(dcenter); } } else { @@ -304,8 +321,11 @@ class Jlmap { return false; } - setUpdateMapDevice(list = []) { - store.commit('map/updateMapDevice', list); + setUpdateMapDevice(list = [], fetch=true) { + if (fetch) { + store.commit('map/updateMapDevice', list); + } + list.forEach(elem => { const code = elem.code; const type = elem._type; @@ -393,8 +413,9 @@ class Jlmap { this.$painter.updateShowMode(oDevice); }); } - update(list=[]) { - this.setUpdateMapDevice(list); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 + update(list=[], fetch=true) { + this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 + const codeList = []; const controlTransferList = []; const signalDeviceList = []; diff --git a/src/jmapNew/shape/Arrow/index.js b/src/jmapNew/shape/Arrow/index.js index 96fa09298..1f95b0ffe 100644 --- a/src/jmapNew/shape/Arrow/index.js +++ b/src/jmapNew/shape/Arrow/index.js @@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group'; import Polygon from 'zrender/src/graphic/shape/Polygon'; export default class Arrow extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/AutoTurnBack/index.js b/src/jmapNew/shape/AutoTurnBack/index.js index 592318814..10d3f6873 100644 --- a/src/jmapNew/shape/AutoTurnBack/index.js +++ b/src/jmapNew/shape/AutoTurnBack/index.js @@ -9,7 +9,7 @@ import EMouse from './EMouse'; import BoundingRect from 'zrender/src/core/BoundingRect'; export default class AutoTurnBack extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; diff --git a/src/jmapNew/shape/AutomacticRoute/index.js b/src/jmapNew/shape/AutomacticRoute/index.js index 218af519b..7699f2608 100644 --- a/src/jmapNew/shape/AutomacticRoute/index.js +++ b/src/jmapNew/shape/AutomacticRoute/index.js @@ -8,7 +8,7 @@ import EMouse from './EMouse'; import BoundingRect from 'zrender/src/core/BoundingRect'; export default class AutomacticRoute extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; diff --git a/src/jmapNew/shape/AxleReset/index.js b/src/jmapNew/shape/AxleReset/index.js index ed8361b3f..bb17d4a2e 100644 --- a/src/jmapNew/shape/AxleReset/index.js +++ b/src/jmapNew/shape/AxleReset/index.js @@ -8,7 +8,7 @@ import EMouse from './EMouse'; import BoundingRect from 'zrender/src/core/BoundingRect'; export default class AxleReset extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; @@ -83,9 +83,18 @@ export default class AxleReset extends Group { this.add(this.text); } + setAshShow() { + this.control && this.control.setStyle({fill:'#FFF'}); + } + // 设置状态 setState(model) { - if (!this.isShowShape) return; + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + if (!this.isShowShape) return; + } } createMouseEvent() { diff --git a/src/jmapNew/shape/Cross/index.js b/src/jmapNew/shape/Cross/index.js index 5ec05182c..c1cfa2424 100644 --- a/src/jmapNew/shape/Cross/index.js +++ b/src/jmapNew/shape/Cross/index.js @@ -6,7 +6,7 @@ export default class Cross extends Group { // code: getUID('Cross', this.crossList), // position:each.position, // relatedSwitch:each.relatedSwitch - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/DirectionRod/index.js b/src/jmapNew/shape/DirectionRod/index.js index 1f9e71681..ce2768d9a 100644 --- a/src/jmapNew/shape/DirectionRod/index.js +++ b/src/jmapNew/shape/DirectionRod/index.js @@ -3,7 +3,7 @@ import Polygon from 'zrender/src/graphic/shape/Polygon'; import Text from 'zrender/src/graphic/Text'; export default class DirectionRod extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 5; this._code = model.code; diff --git a/src/jmapNew/shape/FloodGate/index.js b/src/jmapNew/shape/FloodGate/index.js index ca2992e10..c99094b35 100644 --- a/src/jmapNew/shape/FloodGate/index.js +++ b/src/jmapNew/shape/FloodGate/index.js @@ -5,7 +5,7 @@ import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; export default class FloodGate extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; diff --git a/src/jmapNew/shape/GuideLock/index.js b/src/jmapNew/shape/GuideLock/index.js index 9fee9be78..d67d9a644 100644 --- a/src/jmapNew/shape/GuideLock/index.js +++ b/src/jmapNew/shape/GuideLock/index.js @@ -8,7 +8,7 @@ import EMouse from './EMouse'; import BoundingRect from 'zrender/src/core/BoundingRect'; export default class GuideLock extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; @@ -86,12 +86,22 @@ export default class GuideLock extends Group { } handleSignal() { this.control.setStyle({ fill: this.style.GuideLock.lamp.lightUpColor }); - } + } + + setAshShow() { + this.control && this.control.setStyle({fill:'#FFF'}); + } + // 设置状态 setState(model) { - if (!this.isShowShape) return; - this.recover(); - model.totalGuideLock && this.handleSignal(); + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + if (!this.isShowShape) return; + this.recover(); + model.totalGuideLock && this.handleSignal(); + } } createMouseEvent() { diff --git a/src/jmapNew/shape/LcControl/index.js b/src/jmapNew/shape/LcControl/index.js index 130afab8e..aa0782268 100644 --- a/src/jmapNew/shape/LcControl/index.js +++ b/src/jmapNew/shape/LcControl/index.js @@ -6,7 +6,7 @@ import EControl from '../element/EControl'; import EMouse from './EMouse'; export default class LcControl extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; @@ -53,9 +53,19 @@ export default class LcControl extends Group { this.add(this.control); } + setAshShow() { + this.control && this.control.setControlColor('#7F7F7F'); + } + + // 设置状态 setState(model) { - if (!this.isShowShape) return; + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + if (!this.isShowShape) return; + } } createMouseEvent() { diff --git a/src/jmapNew/shape/LimitControl/index.js b/src/jmapNew/shape/LimitControl/index.js index a5577c44d..1a323be0d 100644 --- a/src/jmapNew/shape/LimitControl/index.js +++ b/src/jmapNew/shape/LimitControl/index.js @@ -6,7 +6,7 @@ import EControl from '../element/EControl'; import EMouse from './EMouse'; export default class LimitControl extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.selected = false; this._code = model.code; @@ -57,9 +57,18 @@ export default class LimitControl extends Group { this.add(this.control); } + setAshShow() { + this.control && this.control.setControlColor('#FFF'); + } + // 设置状态 setState(model) { - if (!this.isShowShape) return; + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + if (!this.isShowShape) return; + } } createMouseEvent() { diff --git a/src/jmapNew/shape/Line/index.js b/src/jmapNew/shape/Line/index.js index 2f62894be..53f488a78 100644 --- a/src/jmapNew/shape/Line/index.js +++ b/src/jmapNew/shape/Line/index.js @@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group'; import Polyline from 'zrender/src/graphic/shape/Polyline'; export default class Line2 extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/OutFrame/index.js b/src/jmapNew/shape/OutFrame/index.js index 691d66f17..5fa4e7769 100644 --- a/src/jmapNew/shape/OutFrame/index.js +++ b/src/jmapNew/shape/OutFrame/index.js @@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; export default class OutFrame extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.model = model; this._type = model._type; diff --git a/src/jmapNew/shape/OverAp/index.js b/src/jmapNew/shape/OverAp/index.js index a718bf898..5cb86223a 100644 --- a/src/jmapNew/shape/OverAp/index.js +++ b/src/jmapNew/shape/OverAp/index.js @@ -3,7 +3,7 @@ import ETextName from '../element/ETextName'; // 名称文字 (共有) import BoundingRect from 'zrender/src/core/BoundingRect'; export default class OverAp extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/Power/index.js b/src/jmapNew/shape/Power/index.js index 8cd14cbd9..44a84b8c7 100644 --- a/src/jmapNew/shape/Power/index.js +++ b/src/jmapNew/shape/Power/index.js @@ -4,7 +4,7 @@ import JTriangle from '../../utils/JTriangle'; import ESeparator from './ESeparator'; export default class Line2 extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/Psd/index.js b/src/jmapNew/shape/Psd/index.js index 818ac3a07..36c6c0e7d 100644 --- a/src/jmapNew/shape/Psd/index.js +++ b/src/jmapNew/shape/Psd/index.js @@ -7,7 +7,7 @@ import {traverseLineElements} from '../utils/ShapeStatusCovert'; import ERectDoor from './ERectDoor'; export default class Line2 extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; @@ -42,16 +42,24 @@ export default class Line2 extends Group { currentTypeList.forEach(element => { this[element].recover(); }); - } + } + + setAshShow() { + this.safetyDoorNormal && this.safetyDoorNormal.setColor('#7F7F7F'); + } setState(model) { this.recover(); if (!this.isShowShape) return; - const currentTypeList = this.style.Psd.elemnetType; - currentTypeList.forEach(element => { - this[element].setState(model); - }); + if (model._free) { + this.setAshShow(); + } else { + const currentTypeList = this.style.Psd.elemnetType; + currentTypeList.forEach(element => { + this[element].setState(model); + }); + } } drawSelected(selected) { diff --git a/src/jmapNew/shape/Resource/index.js b/src/jmapNew/shape/Resource/index.js index c4887e6e0..80fae6f5b 100644 --- a/src/jmapNew/shape/Resource/index.js +++ b/src/jmapNew/shape/Resource/index.js @@ -5,7 +5,7 @@ import Group from 'zrender/src/container/Group'; import Image from 'zrender/src/graphic/Image'; export default class Resource extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/Responder/index.js b/src/jmapNew/shape/Responder/index.js index 16d97da9e..1b39ef93e 100644 --- a/src/jmapNew/shape/Responder/index.js +++ b/src/jmapNew/shape/Responder/index.js @@ -23,7 +23,7 @@ const defaultStyle = { } }; export default class Responder extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/SaidLamp/index.js b/src/jmapNew/shape/SaidLamp/index.js index d50500d80..75855bc42 100644 --- a/src/jmapNew/shape/SaidLamp/index.js +++ b/src/jmapNew/shape/SaidLamp/index.js @@ -11,7 +11,7 @@ import EUnmanned from './EUnmanned'; import EAxle from './EAxle'; export default class SaidLamp extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 66ed85060..aa2e67242 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -13,18 +13,18 @@ import ELimitName from './ELimitName'; // 成都三号线 限速名称 import { drawSectionStyle } from '../../config/defaultStyle'; import EStopRouteImg from './EStopRouteImg'; import store from '@/store/index'; -import Vue from 'vue'; /** 区段*/ export default class Section extends Group { - constructor(model, style) { + constructor(model, {style, mapDevice}) { super(); this._code = model.code; this._type = model._type; this.zlevel = model.zlevel; this.z = 5 + parseInt(model.layer || 0); this.model = model; - this.style = style; + this.style = style; + this.mapDevice = mapDevice; this.selected = false; // 绘图选中状态 this.selectedType = ''; // 绘图批量选中状态 this.isShowShape = true; @@ -321,9 +321,9 @@ export default class Section extends Group { handleSwitchSection(model, flag) { // 哈尔滨线路 南京二 道岔相关区段设置 默认颜色 if (this.style.Switch.sectionAction.flag && model.relSwitchCode && !flag) { - const switchModel = Vue.prototype.$jlmap.mapDevice[model.relSwitchCode]; - const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode]; - const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode]; + const switchModel = this.mapDevice[model.relSwitchCode]; + const sectionB = this.mapDevice[switchModel.sectionBCode]; + const sectionC = this.mapDevice[switchModel.sectionCCode]; if (switchModel && switchModel.normalPosition === 1) { this.setSwitchSectionColor(sectionC, sectionB);// 定位 } else if (switchModel && switchModel.normalPosition === 0 && switchModel.reversePosition === 0 && switchModel.instance && switchModel.instance.switchPosition === 'reverse' && switchModel.fault !== 'SPLIT') { @@ -363,42 +363,51 @@ export default class Section extends Group { /** 设置状态*/ setState(model, flag = false) { if (!this.isShowShape) return; - this.recover(); - this.handleSwitchSection(model, flag); - // 顺序代表优先级 - /** 道岔保护区段锁闭 */ - model.overlapLock && this.protectiveLock(model.lockRight); - /** 空闲锁闭或者叫进路锁闭 */ - model.routeLock && this.routeLock(model.lockRight); - /** 计轴故障 */ - model.invalid && this.invalid(); - /** 轨道封锁 */ - model.blockade && this.block(model.routeLock); - /** 非通信车占用状态 */ - model.nctOccupied && this.unCommunicationOccupied(); - /** 通信车占用状态 */ - model.ctOccupied && this.communicationOccupied(); - // 计轴预复位 - model.preReset && this.preReset(model.blockade); - /** 区段切除*/ - model.cutOff && this.sectionCutOff(); - /** 是否限速*/ - model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit); - // 区段计轴预复位状态 (未处理) - // 区段延时解锁 - model.delayUnlock && this.delayUnlock(); - // 区段故障锁闭 之前是fault 暂时设置为faultLock - model.faultLock && this.faultLock(); - // 设置灰显 - model.noStatus && this.setAshShow(); - /** 道岔区段更新岔心颜色 */ - if (model.type === '03' && model.switch) { - const sectionSwitch = store.getters['map/getDeviceByCode'](model.switch.code); - if (sectionSwitch && sectionSwitch.sectionACode === model.code) { - sectionSwitch.instance && sectionSwitch.instance.setState(sectionSwitch); - sectionSwitch.instance && sectionSwitch.instance.setLimitState(model.speedUpLimit > 0, model.speedUpLimit); - } - } + this.recover(); + + // 只响应前端自定义类型的状态变化 + if (model._free) { + // 先初始化为灰色 + this.setAshShow() + model.preGreen && this.line.setStyle({stroke: '#00FF00'}); + model.preBlue && this.line.setStyle({stroke: '#4A76B7'}); + } else { + this.handleSwitchSection(model, flag); + // 顺序代表优先级 + /** 道岔保护区段锁闭 */ + model.overlapLock && this.protectiveLock(model.lockRight); + /** 空闲锁闭或者叫进路锁闭 */ + model.routeLock && this.routeLock(model.lockRight); + /** 计轴故障 */ + model.invalid && this.invalid(); + /** 轨道封锁 */ + model.blockade && this.block(model.routeLock); + /** 非通信车占用状态 */ + model.nctOccupied && this.unCommunicationOccupied(); + /** 通信车占用状态 */ + model.ctOccupied && this.communicationOccupied(); + // 计轴预复位 + model.preReset && this.preReset(model.blockade); + /** 区段切除*/ + model.cutOff && this.sectionCutOff(); + /** 是否限速*/ + model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit); + // 区段计轴预复位状态 (未处理) + // 区段延时解锁 + model.delayUnlock && this.delayUnlock(); + // 区段故障锁闭 之前是fault 暂时设置为faultLock + model.faultLock && this.faultLock(); + // 设置灰显 + model.noStatus && this.setAshShow(); + /** 道岔区段更新岔心颜色 */ + if (model.type === '03' && model.switch) { + const sectionSwitch = this.mapDevice[model.switch.code]; + if (sectionSwitch && sectionSwitch.sectionACode === model.code) { + sectionSwitch.instance && sectionSwitch.instance.setState(sectionSwitch); + sectionSwitch.instance && sectionSwitch.instance.setLimitState(model.speedUpLimit > 0, model.speedUpLimit); + } + } + } } /** 计算提示位置*/ @@ -434,8 +443,8 @@ export default class Section extends Group { this.line.setOrignalCross(true); } if (this.style.Switch.sectionAction.flag && this.model.relSwitchCode) { - const switchModel = Vue.prototype.$jlmap.mapDevice[this.model.relSwitchCode]; - const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode]; + const switchModel = this.mapDevice[this.model.relSwitchCode]; + const sectionC = this.mapDevice[switchModel.sectionCCode]; if (sectionC.code == this.model.code) { sectionC && sectionC.instance && sectionC.instance.line.setStyle({ stroke: this.style.Switch.sectionAction.spareColor }); } diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 89c390695..67e83f4f4 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -22,7 +22,7 @@ import { findDeviceByModelDepType } from '../utils/ShapeDepFind'; // import background from './../../../ibp/shape/background'; class Signal extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; @@ -733,87 +733,92 @@ class Signal extends Group { const path = window.location.href; this.recover(); - /** 信号机进路按钮显示 */ - /** 终端信号机按钮 */ - if (model.isRouteActive) { - this.setLowButtonActive(); - } else { - this.setLowButtonRecover(); - } - model.isRouteSignal && this.setLowButtonShow(); + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + /** 信号机进路按钮显示 */ + /** 终端信号机按钮 */ + if (model.isRouteActive) { + this.setLowButtonActive(); + } else { + this.setLowButtonRecover(); + } + model.isRouteSignal && this.setLowButtonShow(); - /** 设置灯的颜色 */ - model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭 - model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放 - model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放 - model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示 + /** 设置灯的颜色 */ + model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭 + model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放 + model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放 + model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示 - /** 信号机封锁 */ // 缺一个功能封锁 - model.blockade && this.block(); - model.reblockade && this.reblock(); - model.remainTime && this.showRemainTime(model.remainTime); - if (!path.includes('/map/draw')) { - // 联锁自动进路通过 - model.fleetMode && this.setAutoRouteOpen(); - // 联锁自动触发 - if (model.ciControl) { - this.setAutoTriggerOpen(); - } else { - !model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */ - } - } - // 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯 - if (model.logicLight) { - this.logicalLight(); // 设置逻辑点灯 - } else { - this.physicsLight(); // 设置物理点灯 - } - if (model.isStartSignal) { - this.insideTriangle && this.insideTriangle.show(); - this.lamps.forEach(item => { item.hide(); }); - this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.startSignalColor}); - } else if (model.isTerminalSignal) { - this.sigPost && this.sigPost.setTerminalOptional(); - } - if (model.isCiConfirm) { - this.setCiConfirm(); - } - if (model.isRequestLock) { - this.sigBack && this.sigBack.show(); - this.sigBack && this.sigBack.animateStyle(true) - .when(0, { fill: this.style.backgroundColor }) - .when(1000, { fill: this.style.Signal.sigBack.fillColor }) - .when(2000, { fill: this.style.backgroundColor }) - .when(3000, { fill: this.style.Signal.sigBack.fillColor }) - .start(); - } - if (model.isRequestGuide) { - this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor); - } - if (path.includes('/map/draw')) { - if (model.type == 'PASSING') { - this.lamps && this.lamps.length && this.lamps.forEach(elem => { - elem.setColor(this.style.Signal.lamp.greenColor); - }); - } else { - this.lamps && this.lamps.length && this.lamps.forEach(elem => { - elem.setColor(this.style.Signal.lamp.redColor); - }); - } - } - if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor && !model.fleetMode) { - this.sigPost.setVerColor(this.style.Signal.post.mainSignalVerColor); - } else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) { - this.sigPost.setVerColor(this.style.Signal.post.closeSignalVerColor); - } else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) { - this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor); - } - // 信号机故障 - model.fault && this.fault(); - // 设置灰显 - if (model.noStatus || model.level === 0) { - this.setAshShow(); - } + /** 信号机封锁 */ // 缺一个功能封锁 + model.blockade && this.block(); + model.reblockade && this.reblock(); + model.remainTime && this.showRemainTime(model.remainTime); + if (!path.includes('/map/draw')) { + // 联锁自动进路通过 + model.fleetMode && this.setAutoRouteOpen(); + // 联锁自动触发 + if (model.ciControl) { + this.setAutoTriggerOpen(); + } else { + !model.atsControl && this.setArtificialRouteClose(); /** 进路交人工控或自动控 */ + } + } + // 设置点灯类型 必须在最后设置不能放前面 logicLight 0 物理点灯 1 逻辑点灯 + if (model.logicLight) { + this.logicalLight(); // 设置逻辑点灯 + } else { + this.physicsLight(); // 设置物理点灯 + } + if (model.isStartSignal) { + this.insideTriangle && this.insideTriangle.show(); + this.lamps.forEach(item => { item.hide(); }); + this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.startSignalColor}); + } else if (model.isTerminalSignal) { + this.sigPost && this.sigPost.setTerminalOptional(); + } + if (model.isCiConfirm) { + this.setCiConfirm(); + } + if (model.isRequestLock) { + this.sigBack && this.sigBack.show(); + this.sigBack && this.sigBack.animateStyle(true) + .when(0, { fill: this.style.backgroundColor }) + .when(1000, { fill: this.style.Signal.sigBack.fillColor }) + .when(2000, { fill: this.style.backgroundColor }) + .when(3000, { fill: this.style.Signal.sigBack.fillColor }) + .start(); + } + if (model.isRequestGuide) { + this.lamps && this.lamps[0] && this.lamps[0].setAnimationStart(this.style.Signal.lamp.yellowColor); + } + if (path.includes('/map/draw')) { + if (model.type == 'PASSING') { + this.lamps && this.lamps.length && this.lamps.forEach(elem => { + elem.setColor(this.style.Signal.lamp.greenColor); + }); + } else { + this.lamps && this.lamps.length && this.lamps.forEach(elem => { + elem.setColor(this.style.Signal.lamp.redColor); + }); + } + } + if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor && !model.fleetMode) { + this.sigPost.setVerColor(this.style.Signal.post.mainSignalVerColor); + } else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor && !model.fleetMode) { + this.sigPost.setVerColor(this.style.Signal.post.closeSignalVerColor); + } else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) { + this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor); + } + // 信号机故障 + model.fault && this.fault(); + // 设置灰显 + if (model.noStatus || model.level === 0) { + this.setAshShow(); + } + } } getBoundingRect() { diff --git a/src/jmapNew/shape/SplitStation/index.js b/src/jmapNew/shape/SplitStation/index.js index 56ed27116..b020de3ff 100644 --- a/src/jmapNew/shape/SplitStation/index.js +++ b/src/jmapNew/shape/SplitStation/index.js @@ -4,7 +4,7 @@ import Polygon from 'zrender/src/graphic/shape/Polygon'; import Text from 'zrender/src/graphic/Text'; export default class SplitStation extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 10; this._code = model.code; diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 4bc8841a8..df5c1ff14 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -18,7 +18,7 @@ import { traverseLineElements } from '../utils/ShapeStatusCovert'; import Vue from 'vue'; export default class Station extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/StationCounter/index.js b/src/jmapNew/shape/StationCounter/index.js index 9f6217d11..af0b150be 100644 --- a/src/jmapNew/shape/StationCounter/index.js +++ b/src/jmapNew/shape/StationCounter/index.js @@ -6,7 +6,7 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; export default class StationCounter extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/StationDelayUnlock/index.js b/src/jmapNew/shape/StationDelayUnlock/index.js index df90f1276..a90f05439 100644 --- a/src/jmapNew/shape/StationDelayUnlock/index.js +++ b/src/jmapNew/shape/StationDelayUnlock/index.js @@ -6,7 +6,7 @@ import Text from 'zrender/src/graphic/Text'; import Group from 'zrender/src/container/Group'; export default class StationDelayUnlock extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/StationStand/detain/EDetain.js b/src/jmapNew/shape/StationStand/detain/EDetain.js index 856b5dd0e..d21b88942 100644 --- a/src/jmapNew/shape/StationStand/detain/EDetain.js +++ b/src/jmapNew/shape/StationStand/detain/EDetain.js @@ -47,7 +47,7 @@ class EDetain extends Group { } setColor(color) { - this.detain.setStyle('textFill', color); + this.detain && this.detain.setStyle('textFill', color); } recover() { diff --git a/src/jmapNew/shape/StationStand/emergent/EEmergentRhombus.js b/src/jmapNew/shape/StationStand/emergent/EEmergentRhombus.js index 536dd3d4e..cb8b4d3ac 100644 --- a/src/jmapNew/shape/StationStand/emergent/EEmergentRhombus.js +++ b/src/jmapNew/shape/StationStand/emergent/EEmergentRhombus.js @@ -48,6 +48,10 @@ class EEmergentRhombus extends Group { this.hideMode(); } + setColor(color) { + this.emergent && this.emergent.setStyle('stroke', color); + } + setState(model) { // 紧急停车 model.emergencyClosed && this.showMode(); diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index 4763a1d15..4a0608871 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -39,7 +39,7 @@ import EStationPlatform from './EStationPlatform'; import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert'; class StationStand extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; @@ -128,7 +128,15 @@ class StationStand extends Group { } else { this.eachChild(elem => { elem.hide(); }); } - } + } + + setAshShow() { + this.solidStand && this.solidStand.setColor('#7F7F7F'); + this.hollowStand && this.hollowStand.setColor('#7F7F7F'); + this.gapStand && this.gapStand.setColor('#7F7F7F'); + this.emergentRhombus && this.emergentRhombus.setColor('#7F7F7F'); + this.detainNormal && this.detainNormal.setColor('#7F7F7F'); + } /** 恢复初始状态*/ recover() { @@ -143,11 +151,16 @@ class StationStand extends Group { // // 新版地图使用新版状态变更方式 this.recover(); - // 更新状态 - const currentTypeList = this.style.StationStand.elemnetType; - currentTypeList.forEach(element => { - this[element].setState(model); - }); + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + // 更新状态 + const currentTypeList = this.style.StationStand.elemnetType; + currentTypeList.forEach(element => { + this[element].setState(model); + }); + } } getBoundingRect() { diff --git a/src/jmapNew/shape/StationTurnBack/index.js b/src/jmapNew/shape/StationTurnBack/index.js index 2e172d54c..c1a1c01be 100644 --- a/src/jmapNew/shape/StationTurnBack/index.js +++ b/src/jmapNew/shape/StationTurnBack/index.js @@ -6,14 +6,15 @@ import EFoldbackMode from './EFoldbackMode'; import Vue from 'vue'; export default class StationTurnBack extends Group { - constructor(model, style) { + constructor(model, {style, lineCode}) { super(); this._code = model.code; this._type = model._type; this.zlevel = model.zlevel; this.z = 40; this.model = model; - this.style = style; + this.style = style; + this.lineCode = lineCode; this.isShowShape = true; this.create(); this.setState(model); @@ -71,7 +72,7 @@ export default class StationTurnBack extends Group { }); } let turnName = '按计划执行'; - if (Vue.prototype.$jlmap.lineCode == '03') { + if (this.lineCode == '03') { turnName = '关闭'; } this.strategyText = new Text({ @@ -144,18 +145,28 @@ export default class StationTurnBack extends Group { } } + setAshShow() { + this.control && this.control.setStyle({fill:'#FFF'}); + } + // 设置状态 setState(model, tbStrategyId = null) { if (!this.isShowShape) return; - this.recover(); - if (tbStrategyId) { - model.tbStrategyId = tbStrategyId; - model.optionList.forEach(item => { - if (item.id == tbStrategyId) { - this.handleStatus(item.label); - } - }); - } + this.recover(); + + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + if (tbStrategyId) { + model.tbStrategyId = tbStrategyId; + model.optionList.forEach(item => { + if (item.id == tbStrategyId) { + this.handleStatus(item.label); + } + }); + } + } } getShapeTipPoint() { const rect = this.control.getBoundingRect(); diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index a77f492cf..8056dbf75 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -13,10 +13,9 @@ import EMouse from './EMouse'; import EHighlight from '../element/EHighlight'; import ETriangle from './ETriangle'; import store from '@/store/index'; -import Vue from 'vue'; export default class Switch extends Group { - constructor(model, style) { + constructor(model, {style, mapDevice}) { super(); this._code = model.code; this._type = model._type; @@ -25,7 +24,8 @@ export default class Switch extends Group { this.zlevel = model.zlevel; this.z = 6; this.isShowShape = true; - this.switchPosition = ''; + this.switchPosition = ''; + this.mapDevice = mapDevice; this.triangle = new JTriangle(model.intersection, model.skew); this.create(); this.createLockRect(); // 创建单锁矩形框显示 @@ -47,17 +47,19 @@ export default class Switch extends Group { create() { const model = this.model; const style = this.style; - - const swPadding = style.Switch.core.length + style.Section.line.width / 2; + const sectionAModel = this.mapDevice[model.sectionACode]; + const sectionBModel = this.mapDevice[model.sectionBCode]; + const sectionCModel = this.mapDevice[model.sectionCCode]; + const rateOpen = style.Switch.core.rateOpen; const directx = this.triangle.drictx; const directy = this.triangle.dricty; const switchWidth1 = style.Section.line.width / 2; let directxA = 1; - const sectionAModel = Vue.prototype.$jlmap.mapDevice[model.sectionACode]; - const sectionBModel = Vue.prototype.$jlmap.mapDevice[model.sectionBCode]; let sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]); let sectionBTriangle = new JTriangle(sectionBModel.points[0], sectionBModel.points[1]); + let sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]); + const sectionAPoint = { x: model.intersection.x, y: model.intersection.y }; if (sectionAModel.points[0].x == model.intersection.x && sectionAModel.points[0].y == model.intersection.y) { sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]); @@ -74,6 +76,17 @@ export default class Switch extends Group { if (sectionBModel.points[sectionBModel.points.length - 1].x == model.intersection.x && sectionBModel.points[sectionBModel.points.length - 1].y == model.intersection.y) { sectionBTriangle = new JTriangle(sectionBModel.points[sectionBModel.points.length - 2], sectionBModel.points[sectionBModel.points.length - 1]); } + + if (sectionCModel.points[0].x == model.intersection.x && sectionCModel.points[0].y == model.intersection.y) { + sectionCTriangle = new JTriangle(sectionCModel.points[0], sectionCModel.points[1]); + } + if (sectionCModel.points[sectionCModel.points.length - 1].x == model.intersection.x && sectionCModel.points[sectionCModel.points.length - 1].y == model.intersection.y) { + sectionCTriangle = new JTriangle(sectionCModel.points[sectionCModel.points.length - 2], sectionCModel.points[sectionCModel.points.length - 1]); + } + + const swPadding = rateOpen + ? sectionCTriangle.getLength() / 2 + : style.Switch.core.length + style.Section.line.width / 2; const drictyyA = sectionATriangle.dricty; const point1 = [model.intersection.x + directx * this.triangle.getCotRate() * swPadding, model.intersection.y + directy * swPadding]; const point2 = [model.intersection.x, model.intersection.y]; @@ -89,7 +102,9 @@ export default class Switch extends Group { onmouseout: () => { this.name.getArrowText().hide(); } }); - const relocShelterLength = 15; + const relocShelterLength = rateOpen + ? sectionBTriangle.getLength() / 2 + : 15; const rpoint1 = [sectionAPoint.x - directxA * (relocShelterLength * sectionBTriangle.getCosRate()), sectionAPoint.y - drictyyA * relocShelterLength * sectionBTriangle.getSinRate()]; const rpoint2 = [sectionAPoint.x, sectionAPoint.y]; const rpoint3 = [sectionAPoint.x + directxA * (switchWidth1 * sectionATriangle.getCosRate()), sectionAPoint.y + drictyyA * switchWidth1 * sectionATriangle.getSinRate()]; @@ -308,7 +323,7 @@ export default class Switch extends Group { this.shapeModelB.hide(); this.shapeModelC.hide(); } else { - this.shapeModelB.show(); + this.shapeModelB.show(); this.shapeModelB.setColor(this.style.Section.line.spareColor); this.shapeModelC.show(); this.shapeModelC.setColor(this.style.backgroundColor); @@ -399,10 +414,10 @@ export default class Switch extends Group { this.shapeModelC.hide(); } else { if (this.model.switchFaultCode && fault) { - const switchFault = store.getters['map/getDeviceByCode'](this.model.switchFaultCode); + const switchFault = this.mapDevice[this.model.switchFaultCode]; switchFault.instance.setControlColor('#F00', true); } else if (this.model.switchFaultCode && !fault) { - const switchFault = store.getters['map/getDeviceByCode'](this.model.switchFaultCode); + const switchFault = this.mapDevice[this.model.switchFaultCode]; switchFault.instance.setControlColor(this.style.backgroundColor, false); } // stopAnimation @@ -552,11 +567,11 @@ export default class Switch extends Group { // 处理岔芯颜色 setSectionState(state) { - const sectionC = store.getters['map/getDeviceByCode'](state.sectionCCode); + const sectionC = this.mapDevice[state.sectionCCode]; if (sectionC && state.reversePosition && !state.blockade) { this.setSwitchModelStatus(this.shapeModelA, sectionC); } - const sectionA = store.getters['map/getDeviceByCode'](state.sectionACode); + const sectionA = this.mapDevice[state.sectionACode]; if (sectionA && state.normalPosition && !this.style.Switch.core.graphShow && !state.blockade) { this.setSwitchModelStatus(this.shapeModelB, sectionA); } @@ -628,40 +643,60 @@ export default class Switch extends Group { } setState(model) { if (!this.isShowShape) return; - this.recover(); - this.setSwitchFault(model.fault, model.normalPosition, model.reversePosition); - if (model.normalPosition) { - this.switchPosition = 'normal'; - this.setLocationAction(model); /** 定位*/ - } else if (model.reversePosition) { - this.switchPosition = 'reverse'; - this.setInversionAction(model); /** 反位*/ - } else { - this.setLossAction(model.fault); // 失去 - } - model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示 + this.recover(); - model.singleLock && this.setMonolock(model.normalPosition, model.reversePosition); // 道岔单锁 - model.blockade && this.block(model.normalPosition, model.reversePosition); // 道岔封锁 - model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态 - const path = window.location.href; - if (!path.includes('/map/draw')) { - this.setSectionState(this.model); // 处理元素颜色 - } - model.fpLock && this.handleFpLock(); // 道岔侧防 - model.routeLock && this.handleRouteLock(); // 道岔进路锁闭 - model.overlapLock && this.handleOverlapLock(); // 道岔进路延续保护 - // this.interlockingReserved(); // 联锁预留道岔 - model.preReset && this.preReset(model.normalPosition, model.reversePosition); // 道岔预复位 + // 只响应前端自定义类型的状态变化 + if (model._free) { + if (model.normalPosition) { + this.switchPosition = 'normal'; + this.setLocationAction(model); /** 定位*/ + if (model.routeLock) { + this.setSectionState(model); + } + } else if (model.reversePosition) { + this.switchPosition = 'reverse'; + this.setInversionAction(model); /** 反位*/ + if (model.routeLock) { + this.setSectionState(model); + } + } else { + this.setAshShow() + } + } else { + this.setSwitchFault(model.fault, model.normalPosition, model.reversePosition); + if (model.normalPosition) { + this.switchPosition = 'normal'; + this.setLocationAction(model); /** 定位*/ + } else if (model.reversePosition) { + this.switchPosition = 'reverse'; + this.setInversionAction(model); /** 反位*/ + } else { + this.setLossAction(model.fault); // 失去 + } + model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示 - if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色 - const switchModel = Vue.prototype.$jlmap.mapDevice[model.code]; - const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode]; - sectionB && sectionB.instance && sectionB.instance.setState(sectionB); - const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode]; - sectionC && sectionC.instance && sectionC.instance.setState(sectionC); - } - model.noStatus && this.setAshShow(); + model.singleLock && this.setMonolock(model.normalPosition, model.reversePosition); // 道岔单锁 + model.blockade && this.block(model.normalPosition, model.reversePosition); // 道岔封锁 + model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态 + const path = window.location.href; + if (!path.includes('/map/draw')) { + this.setSectionState(this.model); // 处理元素颜色 + } + model.fpLock && this.handleFpLock(); // 道岔侧防 + model.routeLock && this.handleRouteLock(); // 道岔进路锁闭 + model.overlapLock && this.handleOverlapLock(); // 道岔进路延续保护 + // this.interlockingReserved(); // 联锁预留道岔 + model.preReset && this.preReset(model.normalPosition, model.reversePosition); // 道岔预复位 + + if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色 + const switchModel = this.mapDevice[model.code]; + const sectionB = this.mapDevice[switchModel.sectionBCode]; + sectionB && sectionB.instance && sectionB.instance.setState(sectionB); + const sectionC = this.mapDevice[switchModel.sectionCCode]; + sectionC && sectionC.instance && sectionC.instance.setState(sectionC); + } + model.noStatus && this.setAshShow(); + } } setLimitState(flag, limitValue) { if (flag) { diff --git a/src/jmapNew/shape/Text/index.js b/src/jmapNew/shape/Text/index.js index 6200f61ec..3678a6b7b 100644 --- a/src/jmapNew/shape/Text/index.js +++ b/src/jmapNew/shape/Text/index.js @@ -1,10 +1,9 @@ import Text from 'zrender/src/graphic/Text'; import Group from 'zrender/src/container/Group'; import BoundingRect from 'zrender/src/core/BoundingRect'; -import Vue from 'vue'; export default class Text2 extends Group { - constructor(model, style) { + constructor(model, {style, lineCode}) { super(); this._code = model.code; this._type = model._type; @@ -12,7 +11,8 @@ export default class Text2 extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.z = 6; + this.z = 6; + this.lineCode = lineCode; this.isShowShape = true; this.create(); this.setState(model); @@ -83,7 +83,7 @@ export default class Text2 extends Group { } } screenShow() { - if (Vue.prototype.$jlmap.lineCode == '06') { // 宁波线路隐藏 + if (this.lineCode == '06') { // 宁波线路隐藏 this.text && this.text.hide(); } else { this.text && this.text.show(); diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 1e8a3d99a..ff9b1651c 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -8,7 +8,7 @@ import EDirection from './EDirection'; /** 列车 */ export default class Train extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/TrainWindow/index.js b/src/jmapNew/shape/TrainWindow/index.js index 704660992..aba06191d 100644 --- a/src/jmapNew/shape/TrainWindow/index.js +++ b/src/jmapNew/shape/TrainWindow/index.js @@ -5,7 +5,7 @@ import EMouse from './EMouse'; import store from '@/store/index'; class TrainWindow extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this._code = model.code; this._type = model._type; diff --git a/src/jmapNew/shape/ZcControl/index.js b/src/jmapNew/shape/ZcControl/index.js index 6be973b52..b9374a2f3 100644 --- a/src/jmapNew/shape/ZcControl/index.js +++ b/src/jmapNew/shape/ZcControl/index.js @@ -6,7 +6,7 @@ import EControl from '../element/EControl'; import EMouse from './EMouse'; export default class ZcControl extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.z = 20; this._code = model.code; @@ -59,11 +59,21 @@ export default class ZcControl extends Group { } + setAshShow() { + this.control && this.control.setControlColor('#7F7F7F'); + } + // 设置状态 setState(model) { - this.recover(); - model.fault == 'FAULT' && this.fault(); - if (!this.isShowShape) return; + this.recover(); + + // 只响应前端自定义类型的状态变化 + if (model._free) { + this.setAshShow() + } else { + model.fault == 'FAULT' && this.fault(); + if (!this.isShowShape) return; + } } recover() { diff --git a/src/jmapNew/shape/checkBox/checkBox.js b/src/jmapNew/shape/checkBox/checkBox.js index 7dcf8eab5..9d35a4955 100644 --- a/src/jmapNew/shape/checkBox/checkBox.js +++ b/src/jmapNew/shape/checkBox/checkBox.js @@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; export default class checkBox extends Group { - constructor(model, style) { + constructor(model, {style}) { super(); this.model = model; this._type = model._type; diff --git a/src/jmapNew/shape/factory.js b/src/jmapNew/shape/factory.js index 879256a84..0b9b8c075 100644 --- a/src/jmapNew/shape/factory.js +++ b/src/jmapNew/shape/factory.js @@ -87,7 +87,7 @@ function shapefactory(device, jmap) { const shape = mapShape[type]; if (shape instanceof Function) { // eslint-disable-next-line - return new shape(device, jmap.style); + return new shape(device, jmap); } } diff --git a/src/jmapNew/theme/ningbo_01/menus/dialog/mapVisual.vue b/src/jmapNew/theme/ningbo_01/menus/dialog/mapVisual.vue new file mode 100644 index 000000000..d4fd52a34 --- /dev/null +++ b/src/jmapNew/theme/ningbo_01/menus/dialog/mapVisual.vue @@ -0,0 +1,271 @@ + + + + diff --git a/src/jmapNew/theme/ningbo_01/menus/dialog/routeSelection.vue b/src/jmapNew/theme/ningbo_01/menus/dialog/routeSelection.vue index 9aeaa2776..a37243ec0 100644 --- a/src/jmapNew/theme/ningbo_01/menus/dialog/routeSelection.vue +++ b/src/jmapNew/theme/ningbo_01/menus/dialog/routeSelection.vue @@ -1,32 +1,39 @@