From 15928a6248f9e13fe8d255fbe5f2125898b4bd99 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 15 Jan 2021 09:42:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E5=B2=94=E5=B0=81=E9=94=81=E7=8A=B6?= =?UTF-8?q?=E6=80=81=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/haerbin_01.js | 4 ++ src/jmapNew/config/skinCode/nanjing_02.js | 4 ++ src/jmapNew/shape/Section/index.js | 6 +- src/jmapNew/shape/Switch/ESwBlock.js | 68 +++++++++++++++++++ src/jmapNew/shape/Switch/ESwLnversion.js | 1 + src/jmapNew/shape/Switch/index.js | 20 +++++- .../theme/haerbin_01/menus/menuBar.vue | 15 +--- .../theme/nanjing_02/menus/menuBar.vue | 15 +--- 8 files changed, 103 insertions(+), 30 deletions(-) create mode 100644 src/jmapNew/shape/Switch/ESwBlock.js diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index bd4bdc16b..3f942d866 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -527,6 +527,10 @@ class SkinCode extends defaultStyle { rectBorderColor: 'red', // 矩形边框颜色 monolock: false, // 单锁显示 block: false // 封锁显示 + }, + coverBlock: { // 道岔封锁 遮盖物 + show: true, // 显示 + coverBlockColor: '#000080'// 遮挡物颜色 } }; diff --git a/src/jmapNew/config/skinCode/nanjing_02.js b/src/jmapNew/config/skinCode/nanjing_02.js index 4ba2d4617..1716e1a3c 100644 --- a/src/jmapNew/config/skinCode/nanjing_02.js +++ b/src/jmapNew/config/skinCode/nanjing_02.js @@ -559,6 +559,10 @@ class SkinCode extends defaultStyle { rectBorderColor: 'red', // 矩形边框颜色 monolock: false, // 单锁显示 block: false // 封锁显示 + }, + coverBlock: { // 道岔封锁 遮盖物 + show: true, // 显示 + coverBlockColor: '#000080'// 遮挡物颜色 } }; diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 99585f45d..08082745a 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -173,7 +173,7 @@ export default class Section extends Group { /** 封锁 06*/ block() { if (this.sectionBlock) { - this.sectionBlock.show(); + this.model.type !== '03' && this.sectionBlock.show(); } else { this.line && this.line.setStyle({ stroke: this.style.Section.line.blockColor, @@ -302,9 +302,9 @@ export default class Section extends Group { model.overlapLock && this.protectiveLock(model.lockRight); /** 空闲锁闭或者叫进路锁闭 */ model.routeLock && this.routeLock(model.lockRight); - /** 轨道封锁 */ - model.invalid && this.invalid(); /** 计轴故障 */ + model.invalid && this.invalid(); + /** 轨道封锁 */ model.blockade && this.block(); /** 非通信车占用状态 */ model.nctOccupied && this.unCommunicationOccupied(); diff --git a/src/jmapNew/shape/Switch/ESwBlock.js b/src/jmapNew/shape/Switch/ESwBlock.js new file mode 100644 index 000000000..93c679457 --- /dev/null +++ b/src/jmapNew/shape/Switch/ESwBlock.js @@ -0,0 +1,68 @@ +import Group from 'zrender/src/container/Group'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; + +class ESwBlock extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + + create() { + const model = this.model; + const style = this.model.style; + this.blockCover = new Polyline({ // 道岔锁闭遮盖物 + zlevel: model.zlevel, + z: model.z + 4, + z2: 2, + shape: { + points: model.coverPoints + }, + style: { + lineWidth: style.Section.line.width, + stroke: '#fff'// style.backgroundColor + }, + cursor: model.cursor, + onmouseover: model.onmouseover, + onmouseout: model.onmouseout + }); + this.hide(); + this.add(this.blockCover); + } + + hide() { + this.blockCover.hide(); + this.blockCover.setStyle({ stroke: this.model.style.backgroundColor }); + this.stopAnimation(false); + } + + show() { + this.blockCover.show(); + } + + setColor(color) { + this.blockCover.setStyle({ stroke: color }); + } + + setStyle(data) { + this.blockCover.setStyle(data); + } + + stopAnimation(flag) { + this.blockCover.stopAnimation(flag); + } + + getSection() { + return this.blockCover; + } + + animateStyle(color1, color2) { + this.blockCover.animateStyle(true) + .when(0, {stroke: color1}) + .when(500, {stroke: color2}) + .when(1000, {stroke: color1}).start(); + } + +} + +export default ESwBlock; diff --git a/src/jmapNew/shape/Switch/ESwLnversion.js b/src/jmapNew/shape/Switch/ESwLnversion.js index 8200c184c..9edd29646 100644 --- a/src/jmapNew/shape/Switch/ESwLnversion.js +++ b/src/jmapNew/shape/Switch/ESwLnversion.js @@ -14,6 +14,7 @@ class ESwLnversion extends Group { this.relocShelter = new Polyline({ // 遮盖B区段范围 zlevel: model.zlevel, z: model.z + 4, + z2: 1, shape: { points: model.shelterPoints }, diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index 08c04a173..94a5cb9ec 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -7,6 +7,7 @@ import ESwLocal from './ESwLocal.js'; import ESwLnversion from './ESwLnversion'; import ELockRect from './ELockRect'; import ELockArc from './ELockArc'; +import ESwBlock from './ESwBlock'; import EMouse from './EMouse'; import EHighlight from '../element/EHighlight'; import ETriangle from './ETriangle'; @@ -134,7 +135,18 @@ export default class Switch extends Group { onmouseover: () => { this.name.getArrowText().show(); }, onmouseout: () => { this.name.getArrowText().hide(); } }); - + const coverPoint1 = [sectionAPoint.x - 2 * directxA * (relocShelterLength * sectionBTriangle.getCosRate()), sectionAPoint.y - drictyyA * relocShelterLength * sectionBTriangle.getSinRate()]; + const coverPoint2 = [sectionAPoint.x, sectionAPoint.y]; + this.shapeBlockCover = new ESwBlock({ + zlevel: this.zlevel, + z: this.z, + style: style, + coverPoints: [coverPoint1, coverPoint2], + cursor: 'pointer', + triangle: this.triangle, + onmouseover: () => { this.name.getArrowText().show(); }, + onmouseout: () => { this.name.getArrowText().hide(); } + }); const arrowTextX = model.intersection.x + 10; const arrowTextY = model.intersection.y + 15; const nameTextX = model.namePosition.x + model.intersection.x + directx * (style.Section.line.width * 3 + style.Switch.text.offset.x) * this.triangle.getCotRate(); @@ -173,6 +185,7 @@ export default class Switch extends Group { this.add(this.shapeModelA); this.add(this.shapeModelB); this.add(this.shapeModelC); + this.add(this.shapeBlockCover); this.add(this.name); this.add(this.enabledName); style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide(); @@ -262,6 +275,7 @@ export default class Switch extends Group { this.shapeModelC.hide(); // 形状 C this.shapeModelA.hide(); // 形状 A this.shapeModelB.hide(); // 形状 B + this.shapeBlockCover.hide(); // 封锁覆盖 this.setHasTextBorder(0); this.shapeModelC.attr({ z: this.z + 3 @@ -469,6 +483,10 @@ export default class Switch extends Group { this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.blockColor, fill: this.style.Switch.rectLock.blockFillColor }); } } + if (this.style.Switch.coverBlock && this.style.Switch.coverBlock.show) { + this.shapeBlockCover.show(); + this.shapeBlockCover.setColor(this.style.Switch.coverBlock.coverBlockColor); + } } blockMonolock() { if (this.style.Switch.rectLock.block && this.style.Switch.rectLock.monolock) { diff --git a/src/jmapNew/theme/haerbin_01/menus/menuBar.vue b/src/jmapNew/theme/haerbin_01/menus/menuBar.vue index 774ee154c..c0f7cc247 100644 --- a/src/jmapNew/theme/haerbin_01/menus/menuBar.vue +++ b/src/jmapNew/theme/haerbin_01/menus/menuBar.vue @@ -255,13 +255,6 @@ export default { this.classB = this.tempClassB; } }, - '$store.state.training.prdType': function (val) { - if (val == '01' && this.centralizedStationList1.length) { - this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationList1[0].code); - } else { - this.$store.dispatch('map/setShowCentralizedStationCode', ''); - } - }, '$store.state.training.centerStationCode': function(code) { if (code) { this.stationCode = code; @@ -358,16 +351,12 @@ export default { }); this.colsNum = 24 / this.centralizedStationList1.length; if (centralizedStationList.length) { - if (this.$store.state.training.centerStationCode) { - this.stationCode = this.$store.state.training.centerStationCode; + if (this.$store.state.map.showCentralizedStationCode) { + this.stationCode = this.$store.state.map.showCentralizedStationCode; } else { this.stationCode = centralizedStationList[0].code; } } - - if (this.$store.state.training.prdType == '01') { - this.$store.dispatch('map/setShowCentralizedStationCode', this.stationCode); - } }, switchShowStation(stationCode) { this.stationCode = stationCode; diff --git a/src/jmapNew/theme/nanjing_02/menus/menuBar.vue b/src/jmapNew/theme/nanjing_02/menus/menuBar.vue index 24b3a1719..0cbf4e4de 100644 --- a/src/jmapNew/theme/nanjing_02/menus/menuBar.vue +++ b/src/jmapNew/theme/nanjing_02/menus/menuBar.vue @@ -253,13 +253,6 @@ export default { this.classB = this.tempClassB; } }, - '$store.state.training.prdType': function (val) { - if (val == '01' && this.centralizedStationList1.length) { - this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationList1[0].code); - } else { - this.$store.dispatch('map/setShowCentralizedStationCode', ''); - } - }, '$store.state.training.centerStationCode': function(code) { if (code) { this.stationCode = code; @@ -356,16 +349,12 @@ export default { }); this.colsNum = 24 / this.centralizedStationList1.length; if (centralizedStationList.length) { - if (this.$store.state.training.centerStationCode) { - this.stationCode = this.$store.state.training.centerStationCode; + if (this.$store.state.map.showCentralizedStationCode) { + this.stationCode = this.$store.state.map.showCentralizedStationCode; } else { this.stationCode = centralizedStationList[0].code; } } - - if (this.$store.state.training.prdType == '01') { - this.$store.dispatch('map/setShowCentralizedStationCode', this.stationCode); - } }, switchShowStation(stationCode) { this.stationCode = stationCode;