From 143325e6f6d185dca74cec71a9dbf9e34d81e499 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Tue, 23 Jun 2020 13:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A5=BF=E5=AE=89=E4=B8=80?= =?UTF-8?q?=E4=B8=89=E7=BA=BF=E8=B7=AF=20=E5=AF=BC=E8=88=AA=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E6=98=BE=E7=A4=BA=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/Section/index.js | 39 +++++++++++++++---- src/jmapNew/shape/Signal/index.js | 3 +- src/jmapNew/shape/Station/index.js | 3 ++ src/jmapNew/shape/Switch/index.js | 3 ++ .../xian_01/menus/menuDialog/viewName.vue | 25 ++++++------ 5 files changed, 51 insertions(+), 22 deletions(-) diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 08542bfdf..78eb61fed 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -116,7 +116,7 @@ export default class Section extends Group { const y = Math.min(model.points[0].y, model.points[model.points.length - 1].y) + Math.abs(model.points[model.points.length - 1].y - model.points[0].y) / 2; const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]); const drict = model.trainPosType != '01' ? 1 : -1; - if (model.type == '01' && model.nameShow && style.Section.text.show) { // 物理区段名称 + if (model.type == '01') { // 物理区段名称 const opposite = style.Section.text.opposite ? -1 : 1; const tempx = x + traingle.getSin(style.Section.text.distance); const tempy = y + traingle.getCos(style.Section.text.distance) * (style.Section.text.position || opposite * drict); @@ -137,7 +137,8 @@ export default class Section extends Group { textVerticalAlign: style.Section.text.textVerticalAlign }); this.add(this.name); - } else if (model.type == '02' && model.nameShow && style.Section.logicText.show) { // 逻辑区段 + model.nameShow && style.Section.text.show ? this.name.show() : this.name.hide(); + } else if (model.type == '02') { // 逻辑区段 const opposite = style.Section.logicText.opposite ? -1 : 1; const tempx = x + traingle.getSin(style.Section.logicText.distance); const tempy = y + traingle.getCos(style.Section.logicText.distance) * (style.Section.logicText.position || opposite * drict); @@ -158,7 +159,8 @@ export default class Section extends Group { textVerticalAlign: style.Section.logicText.textVerticalAlign }); this.add(this.name); - } else if (model.type == '04' && model.nameShow) { // 道岔计轴区段 + model.nameShow && style.Section.logicText.show ? this.name.show() : this.name.hide(); + } else if (model.type == '04') { // 道岔计轴区段 this.name = new ETextName({ zlevel: this.zlevel, z: this.z + 2, @@ -176,10 +178,11 @@ export default class Section extends Group { textVerticalAlign: style.Section.text.textVerticalAlign }); this.add(this.name); + model.nameShow ? this.name.show() : this.name.hide(); } /** 站台轨名称*/ - if (model.standTrack && model.standTrackNameShow && style.Section.standText.show) { + if (model.standTrack) { const opposite = style.Section.standText.opposite ? -1 : 1; const tempx = x + traingle.getSin(style.Section.standText.distance); const tempy = y + traingle.getCos(style.Section.standText.distance) * (style.Section.standText.position || opposite * drict); @@ -199,10 +202,11 @@ export default class Section extends Group { textVerticalAlign: style.Section.standText.textVerticalAlign }); this.add(this.standTrackText); + model.standTrackNameShow && style.Section.standText.show ? this.standTrackText.show() : this.standTrackText.hide(); } /** 折返轨名称*/ - if (model.reentryTrack && model.reentryTrackNameShow && style.Section.reentryText.show) { + if (model.reentryTrack) { const opposite = style.Section.reentryText.opposite ? -1 : 1; const tempx = x + traingle.getSin(style.Section.reentryText.distance); const tempy = y + traingle.getCos(style.Section.reentryText.distance) * (style.Section.reentryText.position || opposite * drict); @@ -222,10 +226,11 @@ export default class Section extends Group { textVerticalAlign: style.Section.reentryText.textVerticalAlign }); this.add(this.reentryTrackText); + model.reentryTrackNameShow && style.Section.reentryText.show ? this.reentryTrackText.show() : this.reentryTrackText.hide(); } /** 转换轨名称*/ - if (model.transferTrack && model.transferTrackNameShow && style.Section.transferText.show) { + if (model.transferTrack) { const opposite = style.Section.transferText.opposite ? -1 : 1; const tempx = x + traingle.getSin(style.Section.transferText.distance); const tempy = y + traingle.getCos(style.Section.transferText.distance) * (style.Section.transferText.position || opposite * drict); @@ -245,10 +250,11 @@ export default class Section extends Group { textVerticalAlign: style.Section.transferText.textVerticalAlign }); this.add(this.transferTrackText); + model.transferTrackNameShow && style.Section.transferText.show ? this.transferTrackText.show() : this.transferTrackText.hide(); } /** 目的码名称*/ - if (model.destinationCode && model.destinationNameShow && style.Section.destinationText.show) { + if (model.destinationCode) { const opposite = style.Section.destinationText.opposite ? -1 : 1; let tempx = x + traingle.getSin(style.Section.destinationText.distance); let tempy = y + traingle.getCos(style.Section.destinationText.distance) * (style.Section.destinationText.position || opposite * drict); @@ -272,6 +278,7 @@ export default class Section extends Group { textVerticalAlign: style.Section.destinationText.textVerticalAlign }); this.add(this.destinationText); + model.destinationNameShow && style.Section.destinationText.show ? this.destinationText.show() : this.destinationText.hide(); } } @@ -826,7 +833,7 @@ export default class Section extends Group { getBoundingRect() { if (this.section) { return this.section.getBoundingRect(); - } else { + } else if (this.name) { return this.name.getBoundingRect(); } } @@ -885,6 +892,22 @@ export default class Section extends Group { item.show(); }); this.isShowShape = true; + if (this.name) { + this.model.nameShow && this.style.Section.text.show ? this.name.show() : this.name.hide(); + } + if (this.transferTrackText) { + this.model.transferTrackNameShow && this.style.Section.transferText.show ? this.transferTrackText.show() : this.transferTrackText.hide(); + } + if (this.standTrackText) { + this.model.standTrackNameShow && this.style.Section.standText.show ? this.standTrackText.show() : this.standTrackText.hide(); + } + if (this.destinationText) { + this.model.destinationNameShow && this.style.Section.destinationText.show ? this.destinationText.show() : this.destinationText.hide(); + } + if (this.reentryTrackText) { + this.model.reentryTrackNameShow && this.style.Section.reentryText.show ? this.reentryTrackText.show() : this.reentryTrackText.hide(); + } + this.setState(this.model); } else { this.eachChild(item => { diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index e58f575a2..e6bc83238 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -543,12 +543,12 @@ class Signal extends Group { recover() { this.lamps.forEach(item=> { item.show(); }); this.sigName.setStyle({ textBorderWidth: 0 }); + this.sigName.setColor(this.style.Signal.text.defaultColor); this.setAutoClose(); this.sigDelay.hide(); this.sigAuto.animationRecover(); this.sigRoute.hide(); this.sigBack && this.sigBack.hide(); - this.sigName.setColor(this.style.Signal.text.defaultColor); this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 if (this.style.Signal.lamp.guidName === 'singleRY') { this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); @@ -718,6 +718,7 @@ class Signal extends Group { this.eachChild(item => { item.show(); }); + this.style.Signal.text.show && this.model.nameShow ? this.sigName.show() : this.sigName.hide(); this.isShowShape = true; this.setState(this.model); } else { diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 78436a7a5..d26c8da9c 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -449,6 +449,9 @@ export default class Station extends Group { this.eachChild(item => { item.show(); }); + if (this.mileageText) { + this.model.kmPostShow ? this.mileageText.show() : this.mileageText.hide(); + } this.isShowShape = true; this.setState(this.model); } else { diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index a0f7847e8..b2989f0fa 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -583,6 +583,9 @@ export default class Switch extends Group { this.eachChild(item => { item.show(); }); + if (this.name) { + this.style.Switch.text.show && this.model.nameShow ? this.name.show() : this.name.hide(); + } this.isShowShape = true; this.setState(this.model); } else { diff --git a/src/jmapNew/theme/xian_01/menus/menuDialog/viewName.vue b/src/jmapNew/theme/xian_01/menus/menuDialog/viewName.vue index 9d2eb1c66..675dbe8b5 100644 --- a/src/jmapNew/theme/xian_01/menus/menuDialog/viewName.vue +++ b/src/jmapNew/theme/xian_01/menus/menuDialog/viewName.vue @@ -49,6 +49,7 @@ {{ $t('menu.menuDialog.destinationName') }} + @@ -190,9 +191,10 @@ export default { // 区段 nameShow = false; - let standTrackNameShow = false; - let reentryTrackNameShow = false; - let transferTrackNameShow = false; + let standTrackNameShow = true; + let reentryTrackNameShow = true; + let transferTrackNameShow = true; + let destinationNameShow = true; const sectionList = this.$store.getters['map/sectionList']; if (sectionList && sectionList.length > 0) { sectionList.forEach(elem => { @@ -214,21 +216,18 @@ export default { } // 站台轨名称 - if (elem.isStandTrack) { - standTrackNameShow = this.nameLevels.indexOf(2) !== -1; - } + standTrackNameShow = this.nameLevels.indexOf(2) !== -1; // 折返轨名称 - if (elem.isReentryTrack) { - reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1; - } + reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1; // 转换轨名称 - if (elem.isTransferTrack) { - transferTrackNameShow = this.nameLevels.indexOf(6) !== -1; - } + transferTrackNameShow = this.nameLevels.indexOf(6) !== -1; - deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); + // 目的地名称 + destinationNameShow = this.nameLevels.indexOf(10) !== -1; + + deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow, destinationNameShow })); }); }