diff --git a/src/jmapNew/config/skinCode/xian_01.js b/src/jmapNew/config/skinCode/xian_01.js index 85181d39f..78dfb0f09 100644 --- a/src/jmapNew/config/skinCode/xian_01.js +++ b/src/jmapNew/config/skinCode/xian_01.js @@ -160,7 +160,8 @@ class SkinCode extends defaultStyle { greenColor: '#00FF00', // 信号灯绿色 yellowColor: '#FFFF00', // 信号灯黄色 whiteColor: '#FFFFFF', // 信号灯白色 - blueColor: '#0070C0' // 信号灯蓝色 + blueColor: '#0070C0', // 信号灯蓝色 + faultType: 'flash' // 信号机故障类型 (flash为西安三号线特殊类型) }, route: { direction: false, // 自动进路方向 diff --git a/src/jmapNew/shape/Signal/ESigFault.js b/src/jmapNew/shape/Signal/ESigFault.js new file mode 100644 index 000000000..00308f5c0 --- /dev/null +++ b/src/jmapNew/shape/Signal/ESigFault.js @@ -0,0 +1,17 @@ +import Path from 'zrender/src/graphic/Path'; +// 信号机故障 (主灯丝断裂) +export const ESigFault = Path.extend({ + type: 'ESigFault', + shape: { + points: null + }, + buildPath: function (ctx, shape) { + const points = shape.points; + const oldradius = shape.radius + 1; + const newradius = shape.radius + 5; + for (let i = 0; i < 8; i++) { + ctx.moveTo(points.x + oldradius * Math.sin(Math.PI / 4 * i), points.y - oldradius * Math.cos(Math.PI / 4 * i)); + ctx.lineTo(points.x + newradius * Math.sin(Math.PI / 4 * i), points.y - newradius * Math.cos(Math.PI / 4 * i)); + } + } +}); diff --git a/src/jmapNew/shape/Signal/ESigLamp.js b/src/jmapNew/shape/Signal/ESigLamp.js index 060ba8950..88a4dddc9 100644 --- a/src/jmapNew/shape/Signal/ESigLamp.js +++ b/src/jmapNew/shape/Signal/ESigLamp.js @@ -1,6 +1,8 @@ import Line from 'zrender/src/graphic/shape/Line'; import Arc from 'zrender/src/graphic/shape/Arc'; import Group from 'zrender/src/container/Group'; +import Path from 'zrender/src/graphic/Path'; +import {ESigFault} from './ESigFault'; class ESigLamp extends Group { constructor(model) { @@ -30,6 +32,27 @@ class ESigLamp extends Group { stroke: style.Signal.lamp.borderColor } }); + + if (style.Signal.lamp.faultType && style.Signal.lamp.faultType == 'flash') { + this.lampFault = new ESigFault({ + zlevel: model.zlevel, + z: model.z + 1, + style:{ + lineWidth: 1, + stroke: '#F00' + }, + shape: { + points: { + x: model.x, + y: model.y + }, + radius:style.Signal.lamp.radiusR + } + }); + this.add(this.lampFault); + this.lampFault.hide(); + } + if ( !style.Signal.lamp.logicDisplayNone ) { this.lstop = new Line({ _subType: 'SignalLamp', @@ -79,6 +102,14 @@ class ESigLamp extends Group { } } + faultShow() { + this.lampFault.show(); + } + + faultHide() { + this.lampFault.hide(); + } + setColor(color) { if (this.model.style.Signal.lamp.borderVariable) { this.lamp.setStyle({ fill: color, stroke: color }); diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index e6bc83238..3aec659eb 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -456,10 +456,16 @@ class Signal extends Group { this.sigName.setColor(this.style.Signal.text.checkColor); } - // 故障 + // // 故障 + // fault() { + // this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); + // this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.blueColor); + // } + fault() { - this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor); - this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.blueColor); + if (this.style.Signal.lamp.faultType && this.style.Signal.lamp.faultType == 'flash') { + this.lamps[0].faultShow(); + } } // 逻辑点灯 @@ -542,6 +548,7 @@ class Signal extends Group { // 恢复状态 recover() { this.lamps.forEach(item=> { item.show(); }); + this.lamps[0].faultHide(); this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setColor(this.style.Signal.text.defaultColor); this.setAutoClose(); @@ -588,6 +595,7 @@ class Signal extends Group { 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.fault && this.fault();// 信号机故障 // 联锁自动进路通过 model.fleetMode && this.setAutoRouteOpen();