信号机故障 绘图代码调整
This commit is contained in:
parent
92c10db690
commit
ec1c5a9bbb
@ -160,7 +160,8 @@ class SkinCode extends defaultStyle {
|
|||||||
greenColor: '#00FF00', // 信号灯绿色
|
greenColor: '#00FF00', // 信号灯绿色
|
||||||
yellowColor: '#FFFF00', // 信号灯黄色
|
yellowColor: '#FFFF00', // 信号灯黄色
|
||||||
whiteColor: '#FFFFFF', // 信号灯白色
|
whiteColor: '#FFFFFF', // 信号灯白色
|
||||||
blueColor: '#0070C0' // 信号灯蓝色
|
blueColor: '#0070C0', // 信号灯蓝色
|
||||||
|
faultType: 'flash' // 信号机故障类型 (flash为西安三号线特殊类型)
|
||||||
},
|
},
|
||||||
route: {
|
route: {
|
||||||
direction: false, // 自动进路方向
|
direction: false, // 自动进路方向
|
||||||
|
17
src/jmapNew/shape/Signal/ESigFault.js
Normal file
17
src/jmapNew/shape/Signal/ESigFault.js
Normal file
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
@ -1,6 +1,8 @@
|
|||||||
import Line from 'zrender/src/graphic/shape/Line';
|
import Line from 'zrender/src/graphic/shape/Line';
|
||||||
import Arc from 'zrender/src/graphic/shape/Arc';
|
import Arc from 'zrender/src/graphic/shape/Arc';
|
||||||
import Group from 'zrender/src/container/Group';
|
import Group from 'zrender/src/container/Group';
|
||||||
|
import Path from 'zrender/src/graphic/Path';
|
||||||
|
import {ESigFault} from './ESigFault';
|
||||||
|
|
||||||
class ESigLamp extends Group {
|
class ESigLamp extends Group {
|
||||||
constructor(model) {
|
constructor(model) {
|
||||||
@ -30,6 +32,27 @@ class ESigLamp extends Group {
|
|||||||
stroke: style.Signal.lamp.borderColor
|
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 ) {
|
if ( !style.Signal.lamp.logicDisplayNone ) {
|
||||||
this.lstop = new Line({
|
this.lstop = new Line({
|
||||||
_subType: 'SignalLamp',
|
_subType: 'SignalLamp',
|
||||||
@ -79,6 +102,14 @@ class ESigLamp extends Group {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faultShow() {
|
||||||
|
this.lampFault.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
faultHide() {
|
||||||
|
this.lampFault.hide();
|
||||||
|
}
|
||||||
|
|
||||||
setColor(color) {
|
setColor(color) {
|
||||||
if (this.model.style.Signal.lamp.borderVariable) {
|
if (this.model.style.Signal.lamp.borderVariable) {
|
||||||
this.lamp.setStyle({ fill: color, stroke: color });
|
this.lamp.setStyle({ fill: color, stroke: color });
|
||||||
|
@ -456,10 +456,16 @@ class Signal extends Group {
|
|||||||
this.sigName.setColor(this.style.Signal.text.checkColor);
|
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() {
|
fault() {
|
||||||
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
|
if (this.style.Signal.lamp.faultType && this.style.Signal.lamp.faultType == 'flash') {
|
||||||
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.blueColor);
|
this.lamps[0].faultShow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 逻辑点灯
|
// 逻辑点灯
|
||||||
@ -542,6 +548,7 @@ class Signal extends Group {
|
|||||||
// 恢复状态
|
// 恢复状态
|
||||||
recover() {
|
recover() {
|
||||||
this.lamps.forEach(item=> { item.show(); });
|
this.lamps.forEach(item=> { item.show(); });
|
||||||
|
this.lamps[0].faultHide();
|
||||||
this.sigName.setStyle({ textBorderWidth: 0 });
|
this.sigName.setStyle({ textBorderWidth: 0 });
|
||||||
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
||||||
this.setAutoClose();
|
this.setAutoClose();
|
||||||
@ -588,6 +595,7 @@ class Signal extends Group {
|
|||||||
model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭
|
model.redOpen && !model.yellowOpen && !model.greenOpen && this.close(model.logicLight); // 信号关闭
|
||||||
model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放
|
model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放
|
||||||
model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放
|
model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放
|
||||||
|
model.fault && this.fault();// 信号机故障
|
||||||
|
|
||||||
// 联锁自动进路通过
|
// 联锁自动进路通过
|
||||||
model.fleetMode && this.setAutoRouteOpen();
|
model.fleetMode && this.setAutoRouteOpen();
|
||||||
|
Loading…
Reference in New Issue
Block a user