This commit is contained in:
joylink_cuiweidong 2021-04-14 13:58:33 +08:00
commit c9985869f1
2 changed files with 155 additions and 2 deletions

View File

@ -176,10 +176,10 @@ class SkinCode extends defaultStyle {
lamp: {
bgShow: false, // 是否被选中
guidName: 'singleRY', // 成都三号线引导类型
borderVariable: true, // 信号灯边框可变
borderVariable: false, // 信号灯边框可变
stopWidth: 2, // 禁止线宽度
borderWidth: 2, // 信号灯边框线宽度
borderColor: '#3149C3', // 信号灯边框线颜色
borderColor: '#677DBB', // 信号灯边框线颜色
radiusR: 6, // 信号灯半径
grayColor: '#7F7F7F', // 信号灯灰色
redColor: '#FF0000', // 信号灯红色

View File

@ -21,6 +21,152 @@ import { findDeviceByModelDepType } from '../utils/ShapeDepFind';
// import BoundingRect from 'zrender/src/core/BoundingRect';
// import background from './../../../ibp/shape/background';
const exec = (f,...args) => { f && f(...args); };
const SignalAspectMap = {
//1-红
1: (lamps, style) => {
const lampsMap = {
1: () => {
lamps[0].setColor(style.Signal.lamp.redColor);
},
2: () => {
lamps[0].setColor(style.Signal.lamp.redColor)
lamps[1].setColor(style.backgroundColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//2-绿
2: (lamps, style) => {
const lampsMap = {
1: () => {
lamps[0].setColor(style.Signal.lamp.greenColor);
},
2: () => {
lamps[0].setColor(style.backgroundColor);
lamps[1].setColor(style.Signal.lamp.greenColor);
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//3-黄;
3: (lamps, style) => {
const lampsMap = {
1: () => {
lamps[0].setColor(style.Signal.lamp.yellowColor);
},
2: () => {
lamps[0].setColor(style.Signal.lamp.yellowColor)
lamps[1].setColor(style.backgroundColor)
},
3: (lamps, style) => {},
}
exec(lampsMap[lamps.length]);
},
//4-黄红;
4: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.yellowColor)
lamps[1].setColor(style.Signal.lamp.redColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//5-绿绿;
5: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.greenColor)
lamps[1].setColor(style.Signal.lamp.greenColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//6-绿黄;
6: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.greenColor)
lamps[1].setColor(style.Signal.lamp.yellowColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//7-黄黄;
7: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.yellowColor)
lamps[1].setColor(style.Signal.lamp.yellowColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//8-黄闪黄;
8: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.yellowColor)
lamps[1].setAnimationStart(style.Signal.lamp.yellowColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//9-白红;
9: (lamps, style) => {
const lampsMap = {
1: () => {},
2: () => {
lamps[0].setColor(style.Signal.lamp.whiteColor)
lamps[1].setColor(style.Signal.lamp.redColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//10-蓝;
10: (lamps, style) => {
const lampsMap = {
1: () => {
lamps[0].setColor(style.Signal.lamp.blueColor)
},
2: () => {
lamps[0].setColor(style.backgroundColor)
lamps[1].setColor(style.Signal.lamp.blueColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
//11-白;
11: (lamps, style) => {
const lampsMap = {
1: () => {
lamps[0].setColor(style.Signal.lamp.whiteColor);
},
2: () => {
lamps[0].setColor(style.Signal.lamp.whiteColor);
lamps[1].setColor(style.backgroundColor)
},
3: () => {},
}
exec(lampsMap[lamps.length]);
},
}
class Signal extends Group {
constructor(model, {style, mapDevice}) {
super();
@ -825,6 +971,13 @@ class Signal extends Group {
} else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor && !model.fleetMode) {
this.sigPost.setVerColor(this.style.Signal.post.guideSignalVerColor);
}
// 灯颜色状态显示
exec(SignalAspectMap[model.signalAspect], this.lamps, this.style);
// 灯是否点灯显示
this.lamps.forEach(lamp => { lamp.setStop(model.signalLight) });
// 信号机故障
model.fault && this.fault();
// 设置灰显