This commit is contained in:
lVAL 2021-01-15 15:25:49 +08:00
commit bc8f65c149
4 changed files with 77 additions and 17 deletions

View File

@ -127,7 +127,7 @@ class SkinCode extends defaultStyle {
nameNumberColor: '#C00808', // 限速值颜色
nameBackground: '#000', // 限速名称背景颜色
drogueWidth: 15, // 浮标宽度
drogueHeight: 12, // 浮标高度
drogueHeight: 12 // 浮标高度
},
separator: {
z: 3, // 分割符层级
@ -168,6 +168,13 @@ class SkinCode extends defaultStyle {
distance: 10, // 设备距离区段的距离
post: {
standardShow: true, // 灯柱显示
reblockHorColor: '#000080', // 信号机重复封锁灯柱颜色
guideHorColor: '#FF0', // 引导信号 灯柱横柱颜色
closeHorColor: '#F00', // 关闭信号 灯柱横柱颜色
openHorColor: '#0F0', // 信号出清 灯柱横柱颜色
mainSignalVerColor: '#00FF00', // 主信号控制级 灯柱竖柱颜色 level 3
closeSignalVerColor: '#FF1F10', // 关闭信号 灯柱竖柱颜色 level 1
guideSignalVerColor: '#FFFF00', // 引导信号控制级 灯柱竖柱颜色 level 2
standardVerticalShape: '8', // 灯柱 竖杆 8边型
standardLength: 12, // 高柱长度
standardHeight: 5, // 灯柱高度
@ -190,7 +197,7 @@ class SkinCode extends defaultStyle {
},
lamp: {
bgShow: true, // 是否被选中
guidName: 'double', // 默认引导类型
guidName: 'post', // 默认引导类型
stopWidth: 2, // 禁止线宽度
borderWidth: 0, // 信号灯边框线宽度
borderColor: '#FF0000', // 信号灯边框线颜色 (虚拟信号机)
@ -529,7 +536,10 @@ class SkinCode extends defaultStyle {
monolock: false, // 名称单锁显示包围框
monolockLocationColor: '#F00', // 道岔单锁'定位'颜色
monolockInversionColor: '#F00', // 道岔单锁'反位'颜色
faultFlashing: false // 故障闪烁
faultFlashing: false, // 故障闪烁
routeLockBorderColor: '#F00', // 进路锁闭道岔名称边框颜色
fpLockBorderColor: '#fff', // 进路侧防道岔名称边框颜色
overlapLockBorderColor: '#F00' // 进路延续保护道岔名称边框颜色
},
sectionAction: {
flag: true, // 道岔 关联区段显示

View File

@ -75,7 +75,12 @@ class ESigPost extends Group {
this.add(this.ver);
this.add(this.hor);
}
getVer() {
return this.ver;
}
getHor() {
return this.hor;
}
setColor(color) {
if (color) {
this.ver && this.ver.setStyle({ stroke: color });

View File

@ -375,6 +375,10 @@ class Signal extends Group {
this.lamps[1] && this.lamps[1].setColor(this.style.backgroundColor);
this.lamps[2] && this.lamps[2].setColor(this.style.backgroundColor);
}
if (this.style.Signal.post.closeHorColor) {
const hor = this.sigPost.getHor();
hor.setStyle({ stroke: this.style.Signal.post.closeHorColor });
}
}
}
@ -407,6 +411,10 @@ class Signal extends Group {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
}
}
if (this.style.Signal.post.openHorColor) {
const hor = this.sigPost.getHor();
hor.setStyle({ stroke: this.style.Signal.post.openHorColor });
}
}
}
@ -446,16 +454,18 @@ class Signal extends Group {
this.cbtcStatus = 'guid';
if (this.style.Signal.lamp.guidName === 'double') {
this.lamps[1].show();
}
if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
} else if (this.style.Signal.lamp.guidName === 'doubleAndBase') { // 设置底座颜色
this.lamps[1].show();
this.sigPost.setColor('#00FF00');
}
if (this.style.Signal.lamp.guidName !== 'singleRY') { // 双灯 允许引导信号
} else if (this.style.Signal.lamp.guidName !== 'singleRY') { // 双灯 允许引导信号
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.lamps[1] && this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
} else if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ fill: this.style.Signal.lamp.yellowColor, stroke: this.style.Signal.lamp.redColor, lineWidth: 2.5 });
} else if (this.style.Signal.lamps.guidName === 'post') {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.redColor);
const hor = this.sigPost.getHor();
hor.setStyle({ stroke: this.style.Signal.post.guideHorColor });
}
}
@ -477,7 +487,12 @@ class Signal extends Group {
this.sigBack.setStyle('fill', this.style.Signal.sigBack.fillColor);
}
}
reblock() {
if (this.style.Signal.post.reblockHorColor) {
const hor = this.sigPost.getHor();
hor.setStyle({ stroke: this.style.Signal.post.reblockHorColor });
}
}
// 功能封锁
functionBlock() {
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
@ -687,12 +702,14 @@ class Signal extends Group {
}
/** 设置灯的颜色 */
model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示
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.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示
/** 信号机封锁 */ // 缺一个功能封锁
model.blockade && this.block();
model.reblockade && this.reblock();
model.remainTime && this.showRemainTime(model.remainTime);
if (!path.includes('/map/draw')) {
// 联锁自动进路通过
@ -743,10 +760,20 @@ class Signal extends Group {
});
}
}
const ver = this.sigPost.getVer();
if ( model.level === 3 && this.style.Signal.post.mainSignalVerColor) {
ver.setStyle({ stroke: this.style.Signal.post.mainSignalVerColor, fill: this.style.Signal.post.mainSignalVerColor });
} else if (model.level === 1 && this.style.Signal.post.closeSignalVerColor) {
ver.setStyle({ stroke: this.style.Signal.post.closeSignalVerColor, fill: this.style.Signal.post.closeSignalVerColor });
} else if (model.level === 2 && this.style.Signal.post.guideSignalVerColor) {
ver.setStyle({ stroke: this.style.Signal.post.guideSignalVerColor, fill: this.style.Signal.post.guideSignalVerColor });
}
// 信号机故障
model.fault && this.fault();
// 设置灰显
model.noStatus && this.setAshShow();
if (model.noStatus || model.level === 0) {
this.setAshShow();
}
}
getBoundingRect() {

View File

@ -262,9 +262,10 @@ export default class Switch extends Group {
this.name.getNameText().setStyle(style);
}
/** 设置道岔文字边框颜色 (道岔封锁) */
setHasTextBorder(width) {
/** 设置道岔文字边框颜色 */
setHasTextBorder(width, color) {
this.name.getTextRect().setStyle({ lineWidth: width });
color && this.name.getTextRect().setStyle({ stroke: color });
}
/** 恢复状态*/
@ -585,6 +586,9 @@ export default class Switch extends Group {
if (!path.includes('/map/draw')) {
this.setSectionState(this.model); // 处理元素颜色
}
model.routeLock && this.handleRouteLock(); // 道岔进路锁闭
model.overlapLock && this.handleOverlapLock(); // 道岔进路延续保护
model.fpLock && this.handleFpLock(); // 道岔侧防
// this.interlockingReserved(); // 联锁预留道岔
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色
@ -600,7 +604,21 @@ export default class Switch extends Group {
getBoundingRect() {
return this.name.getBoundingRect();
}
handleRouteLock() {
if (this.style.Switch.text.routeLockBorderColor) {
this.setHasTextBorder(1, this.style.Switch.text.routeLockBorderColor);
}
}
handleOverlapLock() {
if (this.style.Switch.text.overlapLockBorderColor) {
this.setHasTextBorder(1, this.style.Switch.text.overlapLockBorderColor);
}
}
handleFpLock() {
if (this.style.Switch.text.fpLockBorderColor) {
this.setHasTextBorder(1, this.style.Switch.text.fpLockBorderColor);
}
}
getShapeTipPoint(opts) {
let rect;
let text;