From 5c7394454d440bcfca8b69df5ce00aa1c4fd8f6e Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 27 Mar 2020 11:35:46 +0800 Subject: [PATCH 1/4] =?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/bejing_01.js | 7 +-- src/jmapNew/config/skinCode/chengdu_01.js | 7 +-- src/jmapNew/config/skinCode/chengdu_03.js | 7 +-- src/jmapNew/config/skinCode/foshan_01.js | 7 +-- src/jmapNew/config/skinCode/haerbin_01.js | 10 +--- src/jmapNew/config/skinCode/ningbo_01.js | 7 +-- src/jmapNew/shape/StationStand/EDetain.js | 2 +- src/jmapNew/shape/StationStand/EJump.js | 2 +- .../shape/StationStand/ESafeEmergent.js | 48 ++++++++++--------- src/jmapNew/shape/StationStand/index.js | 40 ++++++++-------- 10 files changed, 55 insertions(+), 82 deletions(-) diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index c9af34074..6dfef8e23 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -273,12 +273,7 @@ class SkinCode extends defaultStyle { offset: { x: 0, y: 0 }, // 站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: { x: -16, y: 18 }, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: { x: -8, y: 13 }, // 扣车偏移量 diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index ea7c7dd31..b34d696a5 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -222,12 +222,7 @@ class SkinCode extends defaultStyle { offset: {x: 0, y: 40}, // 站台紧急关闭偏移量 closeColor: 'red' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: {x: -16, y: 20}, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 88e0082a6..633f18e5a 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -228,12 +228,7 @@ class SkinCode extends defaultStyle { offset: {x: 0, y: 15}, // 站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: {x: -16, y: 20}, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: '扣', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index d9b96adc3..8a94c1198 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -218,12 +218,7 @@ class SkinCode extends defaultStyle { offset: {x: -6, y: -15}, // 站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: {x: -16, y: 20}, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: {x: -8, y: 13}, // 扣车偏移量 diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 7ad30dda3..c118f992e 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -222,12 +222,7 @@ class SkinCode extends defaultStyle { offset: { x: 0, y: 40 }, // 站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: { x: -16, y: 20 }, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: 'H', // 扣车显示内容 fontSize: 18, // 扣车字体大小 @@ -244,8 +239,7 @@ class SkinCode extends defaultStyle { fontWeight: 'bold', fontSize: 18 }, - stopTime: { // 停站时间 - }, + stopTime: {}, // 停站时间 level: { // 运行等级 position: 1, // 运行等级方向 offset: { x: -8, y: 6 }, // 运行等级偏移量 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 92de804a3..c59a74fff 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -266,12 +266,7 @@ class SkinCode extends defaultStyle { offset: { x: 0, y: 3 }, // 站台紧急关闭偏移量 closeColor: 'red' // 站台紧急关闭颜色 }, - reentry: { // 站台折返策略 - position: 0, // 折返方向 - offset: { x: -16, y: 20 }, // 折返偏移量 - noHumanColor: '#0F16DA', // 站台无人折返 - autoChangeEndsColor: '#0BF400' // 站台自动换端 - }, + reentry: {}, // 站台折返策略 detainCar: { // 扣车 text: 'H', // 扣车显示内容 offset: { x: -8, y: 0 }, // 扣车偏移量 diff --git a/src/jmapNew/shape/StationStand/EDetain.js b/src/jmapNew/shape/StationStand/EDetain.js index ca90a91f2..150547a63 100644 --- a/src/jmapNew/shape/StationStand/EDetain.js +++ b/src/jmapNew/shape/StationStand/EDetain.js @@ -10,7 +10,7 @@ class EDetain extends Group { } create() { - if (this.isNew) { + if (!this.isNew) { const model = this.model; const style = this.model.style; this.isNew = true; diff --git a/src/jmapNew/shape/StationStand/EJump.js b/src/jmapNew/shape/StationStand/EJump.js index 8b9d3155d..4c1b72dca 100644 --- a/src/jmapNew/shape/StationStand/EJump.js +++ b/src/jmapNew/shape/StationStand/EJump.js @@ -9,7 +9,7 @@ class EJump extends Group { this.isNew = false; } create() { - if (this.isNew) { + if (!this.isNew) { const model = this.model; const style = this.model.style; this.isNew = true; diff --git a/src/jmapNew/shape/StationStand/ESafeEmergent.js b/src/jmapNew/shape/StationStand/ESafeEmergent.js index 3543df357..ad04bdf73 100644 --- a/src/jmapNew/shape/StationStand/ESafeEmergent.js +++ b/src/jmapNew/shape/StationStand/ESafeEmergent.js @@ -19,27 +19,30 @@ class ESafeEmergent extends Group { this.isNew = true; if (style.StationStand.common.special) { - const gagT = 19; - const gagB = 26; - let cy = model.inside ? model.y + 22 : model.y - 22; - let cx = model.inside ? model.x + model.width / 8 : model.x - model.width / 8; - if (model.right) { - if (model.inside) { - cy = model.y - gagB; - cx = model.x - model.width / 8; - } else { - cy = model.y + gagT; - cx = model.x + model.width / 8; - } - } else { - if (model.inside) { - cy = model.y + gagT; - cx = model.x + model.width / 8; - } else { - cy = model.y - gagB; - cx = model.x - model.width / 8; - } - } + console.log('------------------------------'); + // const gagT = 19; + // const gagB = 26; + // let cy = model.inside ? model.y + 22 : model.y - 22; + // let cx = model.inside ? model.x + model.width / 8 : model.x - model.width / 8; + // if (model.right) { + // if (model.inside) { + // cy = model.y - gagB; + // cx = model.x - model.width / 8; + // } else { + // cy = model.y + gagT; + // cx = model.x + model.width / 8; + // } + // } else { + // if (model.inside) { + // cy = model.y + gagT; + // cx = model.x + model.width / 8; + // } else { + // cy = model.y - gagB; + // cx = model.x - model.width / 8; + // } + // } + const cx = model.x; + const cy = model.y; this.emergent = new Polyline({ zlevel: model.zlevel, z: model.z, @@ -85,8 +88,7 @@ class ESafeEmergent extends Group { } hide() { - this.create(); - this.emergent.hide(); + this.emergent && this.emergent.hide(); } show() { diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index 458eb8e8f..fa7bea5bf 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -67,10 +67,10 @@ class StationStand extends Group { } let emergentX = model.position.x + (style.StationStand.stopTime.position || emergentH) * style.StationStand.standEmergent.offset.x - emergentWidth; let emergentY = model.position.y + emergentH * (model.height / 2 + style.StationStand.standEmergent.offset.y); - if (style.StationStand.common.special) { - emergentX = model.position.x; - emergentY = model.position.y; - } + // if (style.StationStand.common.special) { + // emergentX = model.position.x; + // emergentY = model.position.y; + // } this.emergent = new ESafeEmergent({ zlevel: this.zlevel, z: this.z + 1, @@ -118,20 +118,22 @@ class StationStand extends Group { this.add(this.trainDepart); /** 站台折返策略*/ - const reentryH = style.StationStand.standEmergent.mergentR; - const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2); - const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH; - this.reentry = new EReentry({ - zlevel: this.zlevel, - z: this.z + 1, - style: style, - drict: drict, - x: reentryX, - y: reentryY, - lineWidth: 0, - fill: style.StationStand.reentry.noHumanColor - }); - this.add(this.reentry); + if (style.StationStand.reentry.offset) { + const reentryH = style.StationStand.standEmergent.mergentR; + const reentryX = model.position.x - (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.x - model.width / 2); + const reentryY = model.position.y + (style.StationStand.reentry.position || drict) * (style.StationStand.reentry.offset.y) + drict * reentryH; + this.reentry = new EReentry({ + zlevel: this.zlevel, + z: this.z + 1, + style: style, + drict: drict, + x: reentryX, + y: reentryY, + lineWidth: 0, + fill: style.StationStand.reentry.noHumanColor + }); + this.add(this.reentry); + } /** 站台扣车*/ const detainD = model.right ? 1 : -1; @@ -347,7 +349,7 @@ class StationStand extends Group { this.time && this.time.hide(); this.level && this.level.hide(); this.detain && this.detain.hide(); - this.emergent && this.emergent.hide(); + // this.emergent && this.emergent.hide(); this.trainStop && this.trainStop.hide(); // 列车停站 this.trainDepart && this.trainDepart.hide(); this.reentry && this.reentry.hide(); From 19b945962bcec6aa54adda3af67d2991a7a14ce3 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Fri, 27 Mar 2020 17:26:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=AB=99=E5=8F=B0=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/bejing_01.js | 3 +- src/jmapNew/config/skinCode/chengdu_01.js | 3 +- src/jmapNew/config/skinCode/chengdu_03.js | 3 +- src/jmapNew/config/skinCode/foshan_01.js | 6 +- src/jmapNew/config/skinCode/haerbin_01.js | 7 +- src/jmapNew/config/skinCode/ningbo_01.js | 3 +- src/jmapNew/shape/StationStand/EDetain.js | 4 +- src/jmapNew/shape/StationStand/EJump.js | 4 +- src/jmapNew/shape/StationStand/ELevel.js | 4 +- src/jmapNew/shape/StationStand/EReentry.js | 4 +- .../shape/StationStand/ESafeEmergent.js | 58 +++--------- src/jmapNew/shape/StationStand/ETime.js | 88 +++++++++---------- src/jmapNew/shape/StationStand/index.js | 67 +++++--------- 13 files changed, 102 insertions(+), 152 deletions(-) diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index 6dfef8e23..b2ed1f9ec 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -270,7 +270,8 @@ class SkinCode extends defaultStyle { }, standEmergent: { // 紧急关闭 mergentR: 4, // 站台紧急关闭半径 - offset: { x: 0, y: 0 }, // 站台紧急关闭偏移量 + insideOffset: { x: 0, y: -40 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: 20 }, // 外站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, reentry: {}, // 站台折返策略 diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index b34d696a5..bc672df9a 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -219,7 +219,8 @@ class SkinCode extends defaultStyle { }, standEmergent: { // 紧急关闭 mergentR: 4, // 站台紧急关闭半径 - offset: {x: 0, y: 40}, // 站台紧急关闭偏移量 + insideOffset: { x: 0, y: 25 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: -25}, // 外站台紧急关闭偏移量 closeColor: 'red' // 站台紧急关闭颜色 }, reentry: {}, // 站台折返策略 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 633f18e5a..00b6a9753 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -225,7 +225,8 @@ class SkinCode extends defaultStyle { standEmergent: { // 紧急关闭 flicker: true, // 闪烁 mergentR: 5, // 站台紧急关闭半径 - offset: {x: 0, y: 15}, // 站台紧急关闭偏移量 + insideOffset: { x: 0, y: 30 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: -30}, // 外站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, reentry: {}, // 站台折返策略 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index 8a94c1198..9b38a36b5 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -214,8 +214,8 @@ class SkinCode extends defaultStyle { }, standEmergent: { // 紧急关闭 mergentR: 4, // 站台紧急关闭半径 - position: -1, - offset: {x: -6, y: -15}, // 站台紧急关闭偏移量 + insideOffset: { x: 0, y: 25}, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: 15}, // 外站台紧急关闭偏移量 closeColor: '#F61107' // 站台紧急关闭颜色 }, reentry: {}, // 站台折返策略 @@ -229,7 +229,7 @@ class SkinCode extends defaultStyle { fontWeight: 'normal' }, stopTime: { // 停站时间 - offset: {x: -8, y: -4}, // 运行时间偏移量 + offset: {x: 37, y: 5}, // 停站时间偏移量 textColor: '#C0C0C0', // 停站时间字体颜色 textFontSize: 11 }, diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index c118f992e..7d464bf9d 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -219,8 +219,11 @@ class SkinCode extends defaultStyle { }, standEmergent: { // 紧急关闭 mergentR: 4, // 站台紧急关闭半径 - offset: { x: 0, y: 40 }, // 站台紧急关闭偏移量 - closeColor: '#F61107' // 站台紧急关闭颜色 + insideOffset: { x: -10, y: -20 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: -10, y: -10}, // 外站台紧急关闭偏移量 + closeColor: '#F61107', // 站台紧急关闭颜色 + width: 4, + radiusR: 6 }, reentry: {}, // 站台折返策略 detainCar: { // 扣车 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index c59a74fff..84f756c0a 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -263,7 +263,8 @@ class SkinCode extends defaultStyle { }, standEmergent: { // 紧急关闭 mergentR: 4, // 站台紧急关闭半径 - offset: { x: 0, y: 3 }, // 站台紧急关闭偏移量 + insideOffset: { x: 0, y: 25 }, // 内站台紧急关闭偏移量 + outsideOffset: { x: 0, y: -25 }, // 外站台紧急关闭偏移量 closeColor: 'red' // 站台紧急关闭颜色 }, reentry: {}, // 站台折返策略 diff --git a/src/jmapNew/shape/StationStand/EDetain.js b/src/jmapNew/shape/StationStand/EDetain.js index 150547a63..fd3fd2a50 100644 --- a/src/jmapNew/shape/StationStand/EDetain.js +++ b/src/jmapNew/shape/StationStand/EDetain.js @@ -38,11 +38,11 @@ class EDetain extends Group { this.detain.setStyle('textFill', color); } - hide() { + hideMode() { this.detain && this.detain.hide(); } - show() { + showMode() { this.create(); this.detain.show(); } diff --git a/src/jmapNew/shape/StationStand/EJump.js b/src/jmapNew/shape/StationStand/EJump.js index 4c1b72dca..5f88dc255 100644 --- a/src/jmapNew/shape/StationStand/EJump.js +++ b/src/jmapNew/shape/StationStand/EJump.js @@ -54,12 +54,12 @@ class EJump extends Group { this.jump.setStyle('textFill', color); } - hide() { + hideMode() { this.jump && this.jump.hide(); this.jumpArc && this.jumpArc.hide(); } - show(isAllJump) { + showMode(isAllJump) { this.create(); if (isAllJump) { // 站台跳停 this.jump.show(); diff --git a/src/jmapNew/shape/StationStand/ELevel.js b/src/jmapNew/shape/StationStand/ELevel.js index 985dcf2ef..d3bc09d28 100644 --- a/src/jmapNew/shape/StationStand/ELevel.js +++ b/src/jmapNew/shape/StationStand/ELevel.js @@ -44,11 +44,11 @@ class ELevel extends Group { this.level.setStyle('textFill', color); } - hide() { + hideMode() { this.level && this.level.hide(); } - show() { + showMode() { this.create(); this.level.show(); } diff --git a/src/jmapNew/shape/StationStand/EReentry.js b/src/jmapNew/shape/StationStand/EReentry.js index b98720e27..0f6fb7c32 100644 --- a/src/jmapNew/shape/StationStand/EReentry.js +++ b/src/jmapNew/shape/StationStand/EReentry.js @@ -34,11 +34,11 @@ class EReentry extends Group { this.reentry.setStyle('textFill', color); } - hide() { + hideMode() { this.reentry && this.reentry.hide(); } - show() { + showMode() { this.create(); this.reentry.show(); } diff --git a/src/jmapNew/shape/StationStand/ESafeEmergent.js b/src/jmapNew/shape/StationStand/ESafeEmergent.js index ad04bdf73..e06d27cd1 100644 --- a/src/jmapNew/shape/StationStand/ESafeEmergent.js +++ b/src/jmapNew/shape/StationStand/ESafeEmergent.js @@ -1,15 +1,13 @@ import Group from 'zrender/src/container/Group'; import Isogon from 'zrender/src/graphic/shape/Isogon'; -import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Polygon from 'zrender/src/graphic/shape/Polygon'; +import {arrow} from '../utils/ShapePoints'; class ESafeEmergent extends Group { constructor(model) { super(); this.model = model; this.isNew = false; - if (this.model.style.StationStand.common.special) { - this.create(); - } } create() { @@ -18,51 +16,19 @@ class ESafeEmergent extends Group { const style = this.model.style; this.isNew = true; - if (style.StationStand.common.special) { - console.log('------------------------------'); - // const gagT = 19; - // const gagB = 26; - // let cy = model.inside ? model.y + 22 : model.y - 22; - // let cx = model.inside ? model.x + model.width / 8 : model.x - model.width / 8; - // if (model.right) { - // if (model.inside) { - // cy = model.y - gagB; - // cx = model.x - model.width / 8; - // } else { - // cy = model.y + gagT; - // cx = model.x + model.width / 8; - // } - // } else { - // if (model.inside) { - // cy = model.y + gagT; - // cx = model.x + model.width / 8; - // } else { - // cy = model.y - gagB; - // cx = model.x - model.width / 8; - // } - // } - const cx = model.x; - const cy = model.y; - this.emergent = new Polyline({ + if (style.StationStand.standEmergent.radiusR) { + const rotation = model.right == 1 ? Math.PI / 2 : Math.PI * 3 / 2; + this.emergent = new Polygon({ zlevel: model.zlevel, z: model.z, + origin: [model.x, model.y], + rotation: rotation, shape: { - points: [ - [cx, cy - 2], - [cx + 5, cy], - [cx + 5, cy + 2], - [cx + 2, cy + 2], - [cx + 2, cy + 6], - [cx - 2, cy + 6], - [cx - 2, cy + 2], - [cx - 5, cy + 2], - [cx - 5, cy], - [cx, cy - 2] - ] + points: arrow(model.x, model.y, style.StationStand.standEmergent.width, style.StationStand.standEmergent.radiusR * 0.8) }, style: { - stroke: 'red', - fill: 'red' + stroke: style.StationStand.standEmergent.closeColor, + fill: style.StationStand.standEmergent.closeColor } }); this.add(this.emergent); @@ -87,11 +53,11 @@ class ESafeEmergent extends Group { } } - hide() { + hideMode() { this.emergent && this.emergent.hide(); } - show() { + showMode() { this.create(); this.emergent.show(); } diff --git a/src/jmapNew/shape/StationStand/ETime.js b/src/jmapNew/shape/StationStand/ETime.js index 654bad9fe..73a24b89d 100644 --- a/src/jmapNew/shape/StationStand/ETime.js +++ b/src/jmapNew/shape/StationStand/ETime.js @@ -2,57 +2,57 @@ import Group from 'zrender/src/container/Group'; import Text from 'zrender/src/graphic/Text'; class ETime extends Group { - constructor(model) { - super(); - this.model = model; - this.isNew = false; - } + constructor(model) { + super(); + this.model = model; + this.isNew = false; + } - create() { - if (!this.isNew) { - const model = this.model; - const style = this.model.style; + create() { + if (!this.isNew) { + const model = this.model; + const style = this.model.style; - this.isNew = true; - this.time = new Text({ - zlevel: model.zlevel, - z: model.z, - style: { - x: model.x, - y: model.y, - fontWeight: 'normal', - fontSize: style.StationStand.common.textFontSize, - fontFamily: style.fontFamily, - text: model.name, - textFill: style.StationStand.stopTime.textColor, - textAlign: 'center', - textVerticalAlign: 'middle' - } - }); + this.isNew = true; + this.time = new Text({ + zlevel: model.zlevel, + z: model.z, + style: { + x: model.x, + y: model.y, + fontWeight: style.textStyle.fontWeight, + fontSize: style.StationStand.common.textFontSize, + fontFamily: style.fontFamily, + text: model.name, + textFill: style.StationStand.stopTime.textColor, + textAlign: style.textStyle.textAlign, + textVerticalAlign: style.textStyle.textVerticalAlign + } + }); - this.add(this.time); - } - } + this.add(this.time); + } + } - setName(val) { - this.create(); - this.time.setStyle('text', val); - } + setName(val) { + this.create(); + this.time.setStyle('text', val); + } - setColor(color) { - this.create(); - this.time.setStyle('textFill', color); - } + setColor(color) { + this.create(); + this.time.setStyle('textFill', color); + } - hide() { - this.create(); - this.time.hide(); - } + hideMode() { + this.create(); + this.time.hide(); + } - show() { - this.create(); - this.time.show(); - } + showMode() { + this.create(); + this.time.show(); + } } export default ETime; diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index fa7bea5bf..27c812509 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -60,17 +60,10 @@ class StationStand extends Group { this.add(this.safeStand); /** 站台紧急关闭*/ - const emergentH = model.inside ? model.right ? 1 : -1 : model.right ? -1 : 1; - let emergentWidth = 0; - if (style.StationStand.stopTime.position) { - emergentWidth = model.width / 2; - } - let emergentX = model.position.x + (style.StationStand.stopTime.position || emergentH) * style.StationStand.standEmergent.offset.x - emergentWidth; - let emergentY = model.position.y + emergentH * (model.height / 2 + style.StationStand.standEmergent.offset.y); - // if (style.StationStand.common.special) { - // emergentX = model.position.x; - // emergentY = model.position.y; - // } + const emergentOffset = model.inside ? style.StationStand.standEmergent.insideOffset : style.StationStand.standEmergent.outsideOffset; + const emergentH = model.right ? 1 : -1; + const emergentX = model.position.x + emergentH * emergentOffset.x; + const emergentY = model.position.y + emergentH * emergentOffset.y; this.emergent = new ESafeEmergent({ zlevel: this.zlevel, z: this.z + 1, @@ -154,7 +147,7 @@ class StationStand extends Group { /** 停站时间*/ if (style.StationStand.stopTime.offset) { const timeDrict = model.right ? 1 : -1; - const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2); + const timeX = model.position.x + timeDrict * style.StationStand.stopTime.offset.x; const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y; this.time = new ETime({ zlevel: this.zlevel, @@ -346,14 +339,14 @@ class StationStand extends Group { /** 恢复初始状态*/ recover() { - this.time && this.time.hide(); - this.level && this.level.hide(); - this.detain && this.detain.hide(); - // this.emergent && this.emergent.hide(); + this.time && this.time.hideMode(); + this.level && this.level.hideMode(); + this.detain && this.detain.hideMode(); + this.emergent && this.emergent.hideMode(); this.trainStop && this.trainStop.hide(); // 列车停站 this.trainDepart && this.trainDepart.hide(); - this.reentry && this.reentry.hide(); - this.jump && this.jump.hide(); + this.reentry && this.reentry.hideMode(); + this.jump && this.jump.hideMode(); } /** 空闲*/ @@ -378,11 +371,7 @@ class StationStand extends Group { if (!this.style.StationStand.common.special) { this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.spareColor); } - if (this.style.StationStand.common.special) { - this.detain && this.detain.show('E'); - this.detain && this.detain.setColor('#fff'); - } - this.emergent && this.emergent.show(); + this.emergent && this.emergent.showMode(); if (this.style.StationStand.standEmergent.flicker) { this.emergent.getElement().animateStyle(true) .when(0, { fill: this.style.backgroundColor }) @@ -395,70 +384,58 @@ class StationStand extends Group { /** 指定列车跳站*/ designatedJumpStop() { this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor); - this.jump && this.jump.show(0); + this.jump && this.jump.showMode(0); } /** 站台跳停*/ jumpStop() { this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor); - this.jump && this.jump.show(1); + this.jump && this.jump.showMode(1); } /** 车站扣车*/ standDetainTrain() { - if (this.style.StationStand.common.special) { - this.detain && this.detain.show('H'); - } else { - this.detain && this.detain.show(); - } + this.detain && this.detain.showMode(); this.detain && this.detain.setColor(this.style.StationStand.detainCar.detainTrainTextColor); } /** 中心扣车*/ centerDetainTrain() { - if (this.style.StationStand.common.special) { - this.detain && this.detain.show('H'); - } else { - this.detain && this.detain.show(); - } + this.detain && this.detain.showMode(); this.detain && this.detain.setColor(this.style.StationStand.detainCar.centerTrainColor); } /** 中心+车站扣车*/ standAndCenterDetainTrain() { - if (this.style.StationStand.common.special) { - this.detain && this.detain.show('H'); - } else { - this.detain && this.detain.show(); - } + this.detain && this.detain.showMode(); this.detain && this.detain.setColor(this.style.StationStand.detainCar.andCenterTrainColor); } /** 人工设置停战时间*/ setManuallyArmisticeTime(val) { - this.time && this.time.show(); + this.time && this.time.showMode(); this.time && this.time.setName(val); } /** 人工设置运行等级*/ setManuallyOperationLevel(val) { - this.level && this.level.show(); + this.level && this.level.showMode(); this.level && this.level.setName(val); } /** 无折返(默认)*/ noReentry() { - this.reentry && this.reentry.hide(); + this.reentry && this.reentry.hideMode(); } /** 无人折返*/ noHumanReentry() { - this.reentry && this.reentry.show(); + this.reentry && this.reentry.showMode(); this.reentry && this.reentry.setColor(this.style.StationStand.reentry.noHumanColor); } /** 自动换端*/ autoChangeEnds() { - this.reentry && this.reentry.show(); + this.reentry && this.reentry.showMode(); this.reentry && this.reentry.setColor(this.style.StationStand.reentry.autoChangeEndsColor); } From 93dc9a6983419051da6b352e6b296f8079ba57ea Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Fri, 27 Mar 2020 17:29:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=B0=E7=89=88=E5=89=A7=E6=9C=AC?= =?UTF-8?q?=E7=BC=96=E5=88=B6=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/simulation.js | 17 ++++ .../theme/foshan_01/menus/menuButton.vue | 3 +- src/utils/baseUrl.js | 4 +- .../scriptManage/display/tipScriptRecord.vue | 43 +++++--- .../scriptManage/scriptRecord/addAction.vue | 90 +++++++++++------ .../scriptManage/scriptRecord/addRole.vue | 25 ++--- .../scriptManage/scriptRecord/getAction.vue | 97 ++++++++++--------- 7 files changed, 167 insertions(+), 112 deletions(-) diff --git a/src/api/simulation.js b/src/api/simulation.js index b8eccf7d6..7716515c6 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -193,6 +193,14 @@ export function saveScriptData(group) { }); } +/** 保存录制任务数据(新版)*/ +export function saveScriptDataNew(group) { + return request({ + url: `/api/scriptSimulation/${group}/saveData`, + method: 'put' + }); +} + /** 更新任务地图定位信息*/ export function updateMapLocation(group, data) { return request({ @@ -310,6 +318,15 @@ export function addScriptAction(group, data) { }); } +/** 添加剧本动作(新版) */ +export function addScriptActionNew(group, data) { + return request({ + url: `/api/scriptSimulation/${group}/addAction`, + method: 'PUT', + data + }); +} + /** 删除剧本动作 */ export function deleteScriptAction(group, actionId) { return request({ diff --git a/src/jmapNew/theme/foshan_01/menus/menuButton.vue b/src/jmapNew/theme/foshan_01/menus/menuButton.vue index 6399648d5..c566bfb5b 100644 --- a/src/jmapNew/theme/foshan_01/menus/menuButton.vue +++ b/src/jmapNew/theme/foshan_01/menus/menuButton.vue @@ -246,7 +246,7 @@ import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler'; import OperationHandler from '@/scripts/cmdPlugin/OperationHandler'; import Handler from '@/scripts/cmdPlugin/Handler'; -import CMD from '@/scripts/cmdPlugin/CommandEnum'; +// import CMD from '@/scripts/cmdPlugin/CommandEnum'; // import { deepAssign } from '@/utils/index'; export default { @@ -341,6 +341,7 @@ export default { selectedChange() { const model = this.$store.state.menuOperation.selected; if (model && model._type) { + } else { Handler.clear(); this.$store.dispatch('menuOperation/setButtonOperation', null); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 4a0fe9bcf..5e119f4f0 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -6,8 +6,8 @@ export function getBaseUrl() { // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.6:9000'; // 旭强 - // BASE_API = 'http://192.168.3.41:9000'; // 张赛 - BASE_API = 'http://192.168.3.82:9000'; // 杜康 + BASE_API = 'http://192.168.3.41:9000'; // 张赛 + // BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 diff --git a/src/views/scriptManage/display/tipScriptRecord.vue b/src/views/scriptManage/display/tipScriptRecord.vue index 8b3d7e9d8..e8c34c051 100644 --- a/src/views/scriptManage/display/tipScriptRecord.vue +++ b/src/views/scriptManage/display/tipScriptRecord.vue @@ -31,7 +31,7 @@ import Vue from 'vue'; import AddAction from '../scriptRecord/addAction'; import GetAction from '../scriptRecord/getAction'; import AddRole from '../scriptRecord/addRole'; -import {saveScriptScenes, saveScriptData, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation'; +import {saveScriptScenes, saveScriptData, saveScriptDataNew, dumpScriptData, updateMapLocation, scriptPause, executeScript} from '@/api/simulation'; export default { name: 'TipScriptRecord', @@ -134,19 +134,36 @@ export default { }, saveScenesData() { this.isSavingScript = true; - saveScriptData(this.group).then(resp => { - this.$message.success(this.$t('scriptRecord.saveDataSucess')); - this.isSavingScript = false; - this.initAutoSaveScript(); - }).catch(error => { - this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); - this.isSavingScript = false; - if (error.code === 40004 || error.code === 40005 || error.code === 40003) { - this.clearAutoSave(); - } else { + + if (this.$route.query.drawWay == 'true') { + saveScriptDataNew(this.group).then(resp => { + this.$message.success(this.$t('scriptRecord.saveDataSucess')); + this.isSavingScript = false; this.initAutoSaveScript(); - } - }); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); + this.isSavingScript = false; + if (error.code === 40004 || error.code === 40005 || error.code === 40003) { + this.clearAutoSave(); + } else { + this.initAutoSaveScript(); + } + }); + } else { + saveScriptData(this.group).then(resp => { + this.$message.success(this.$t('scriptRecord.saveDataSucess')); + this.isSavingScript = false; + this.initAutoSaveScript(); + }).catch(error => { + this.$messageBox(`${this.$t('scriptRecord.saveDataFail')}: ${error.message}`); + this.isSavingScript = false; + if (error.code === 40004 || error.code === 40005 || error.code === 40003) { + this.clearAutoSave(); + } else { + this.initAutoSaveScript(); + } + }); + } }, dumpScenesData() { this.clearAutoSave(); diff --git a/src/views/scriptManage/scriptRecord/addAction.vue b/src/views/scriptManage/scriptRecord/addAction.vue index ac3236e7c..2c0f7d1a8 100644 --- a/src/views/scriptManage/scriptRecord/addAction.vue +++ b/src/views/scriptManage/scriptRecord/addAction.vue @@ -7,12 +7,12 @@