增加,信号机灯丝故障处理
This commit is contained in:
parent
85a6b0c617
commit
1a0612020e
@ -175,7 +175,8 @@ class SkinCode extends defaultStyle {
|
||||
greenColor: '#00FF00', // 信号灯绿色
|
||||
yellowColor: '#FFFF00', // 信号灯黄色
|
||||
whiteColor: '#FFFFFF', // 信号灯白色
|
||||
blueColor: '#0070C0' // 信号灯蓝色
|
||||
blueColor: '#0070C0', // 信号灯蓝色
|
||||
faultType: 'light' // 信号机故障类型 (light闪)
|
||||
},
|
||||
route: {
|
||||
direction: true, // 自动通过方向
|
||||
|
@ -195,7 +195,7 @@ class SkinCode extends defaultStyle {
|
||||
yellowColor: 'yellow', // 信号灯黄色
|
||||
whiteColor: '#FFFFFF', // 信号灯白色
|
||||
blueColor: '#0070C0', // 信号灯蓝色
|
||||
logicDisplayNone: true // 信号机上×型标识不展示
|
||||
faultType: 'cross' // 信号机故障类型 (cross叉形狀)
|
||||
},
|
||||
route: {
|
||||
direction: false, // 自动通过方向
|
||||
|
@ -162,7 +162,7 @@ class SkinCode extends defaultStyle {
|
||||
yellowColor: '#FFFF00', // 信号灯黄色
|
||||
whiteColor: '#FFFFFF', // 信号灯白色
|
||||
blueColor: '#0070C0', // 信号灯蓝色
|
||||
faultType: 'flash' // 信号机故障类型 (flash为西安三号线特殊类型)
|
||||
faultType: 'flash' // 信号机故障类型(flash太阳)
|
||||
},
|
||||
route: {
|
||||
direction: false, // 自动进路方向
|
||||
|
@ -175,6 +175,7 @@ class SkinCode extends defaultStyle {
|
||||
yellowColor: 'yellow', // 信号灯黄色
|
||||
whiteColor: '#FFFFFF', // 信号灯白色
|
||||
blueColor: '#0070C0', // 信号灯蓝色
|
||||
faultType: 'watch', // 信号机故障类型 (watch表形狀)
|
||||
logicDisplayNone: true // 信号机上×型标识不展示
|
||||
},
|
||||
route: {
|
||||
|
@ -14,4 +14,7 @@ export default class ELampFilament extends Group {
|
||||
this.path = createPathSvg(this.model);
|
||||
this.add(this.path);
|
||||
}
|
||||
setControlColor(color) {
|
||||
this.path.setStyle({fill: color});
|
||||
}
|
||||
}
|
||||
|
@ -224,11 +224,11 @@ export default class SaidLamp extends Group {
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
setControlColor(color, flag) {
|
||||
this.control && this.control.getControl().stopAnimation(false);
|
||||
this.control && this.control.setControlColor(color);
|
||||
setControlColor(color, flag = false) {
|
||||
this.control && this.control.getControl && this.control.getControl().stopAnimation(false);
|
||||
this.control && this.control.setControlColor && this.control.setControlColor(color);
|
||||
if (flag) {
|
||||
this.control && this.control.getControl().animateStyle(true)
|
||||
this.control && this.control.getControl && this.control.getControl().animateStyle(true)
|
||||
.when(0, { fill: this.style.backgroundColor })
|
||||
.when(1000, { fill: color })
|
||||
.when(2000, { fill: this.style.backgroundColor })
|
||||
|
@ -58,11 +58,7 @@ class ESigLamp extends Group {
|
||||
_subType: 'SignalLamp',
|
||||
_val: '3',
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
origin: {
|
||||
x: model.originX,
|
||||
y: model.originY
|
||||
},
|
||||
z: model.z + 1,
|
||||
shape: {
|
||||
x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4),
|
||||
y1: model.y + (style.Signal.lamp.radiusR + 0.5) * Math.sin(Math.PI / 4),
|
||||
@ -78,11 +74,7 @@ class ESigLamp extends Group {
|
||||
_subType: 'SignalLamp',
|
||||
_val: '3',
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
origin: {
|
||||
x: model.originX,
|
||||
y: model.originY
|
||||
},
|
||||
z: model.z + 1,
|
||||
shape: {
|
||||
x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4),
|
||||
y1: model.y + (style.Signal.lamp.radiusR + 0.5) * (Math.sin(Math.PI / 4) - Math.sqrt(2)),
|
||||
@ -94,8 +86,51 @@ class ESigLamp extends Group {
|
||||
stroke: style.Signal.xColor || style.backgroundColor
|
||||
}
|
||||
});
|
||||
|
||||
const edge = 2;
|
||||
this.lcross = new Line({
|
||||
_subType: 'SignalLamp',
|
||||
_val: '3',
|
||||
zlevel: model.zlevel,
|
||||
z: model.z + 1,
|
||||
shape: {
|
||||
x1: model.x + (style.Signal.lamp.radiusR + edge + 0.5) * Math.cos(Math.PI / 4),
|
||||
y1: model.y + (style.Signal.lamp.radiusR + edge + 0.5) * Math.sin(Math.PI / 4),
|
||||
x2: model.x - (style.Signal.lamp.radiusR + edge + 0.5) * Math.cos(Math.PI / 4),
|
||||
y2: model.y - (style.Signal.lamp.radiusR + edge + 0.5) * Math.sin(Math.PI / 4)
|
||||
},
|
||||
style: {
|
||||
lineWidth: style.Signal.lamp.stopWidth,
|
||||
stroke: '#000000',
|
||||
lineCap: 'round'
|
||||
}
|
||||
});
|
||||
this.rcross = new Line({
|
||||
_subType: 'SignalLamp',
|
||||
_val: '3',
|
||||
zlevel: model.zlevel,
|
||||
z: model.z + 1,
|
||||
shape: {
|
||||
x1: model.x + (style.Signal.lamp.radiusR + edge + 0.5) * Math.cos(Math.PI / 4),
|
||||
y1: model.y + (style.Signal.lamp.radiusR + edge + 0.5) * (Math.sin(Math.PI / 4) - Math.sqrt(2)),
|
||||
x2: model.x - (style.Signal.lamp.radiusR + edge + 0.5) * Math.cos(Math.PI / 4),
|
||||
y2: model.y - (style.Signal.lamp.radiusR + edge + 0.5) * (Math.sin(Math.PI / 4) - Math.sqrt(2))
|
||||
},
|
||||
style: {
|
||||
lineWidth: style.Signal.lamp.stopWidth,
|
||||
stroke: '#000000',
|
||||
lineCap: 'round'
|
||||
}
|
||||
});
|
||||
}
|
||||
this.add(this.lamp);
|
||||
|
||||
if (style.Signal.lamp.faultType == 'cross') {
|
||||
this.add(this.lcross);
|
||||
this.add(this.rcross);
|
||||
this.setFault2Corss(false);
|
||||
}
|
||||
|
||||
if (!style.Signal.lamp.logicDisplayNone) {
|
||||
this.add(this.lstop);
|
||||
this.add(this.rstop);
|
||||
@ -126,6 +161,16 @@ class ESigLamp extends Group {
|
||||
this.lamp.setStyle(data);
|
||||
}
|
||||
|
||||
setFault2Corss(has) {
|
||||
if (has) {
|
||||
this.lcross && this.lcross.show();
|
||||
this.rcross && this.rcross.show();
|
||||
} else {
|
||||
this.lcross && this.lcross.hide();
|
||||
this.rcross && this.rcross.hide();
|
||||
}
|
||||
}
|
||||
|
||||
setStop(has) {
|
||||
if (has) {
|
||||
this.lstop && this.lstop.show();
|
||||
|
@ -17,6 +17,8 @@ import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import Isogon from 'zrender/src/graphic/shape/Isogon';
|
||||
import deviceType from '../../constant/deviceType';
|
||||
import { findDeviceByModelDepType } from '../utils/ShapeDepFind';
|
||||
// import BoundingRect from 'zrender/src/core/BoundingRect';
|
||||
// import background from './../../../ibp/shape/background';
|
||||
|
||||
@ -491,8 +493,24 @@ class Signal extends Group {
|
||||
// }
|
||||
|
||||
fault() {
|
||||
if (this.style.Signal.lamp.faultType && this.style.Signal.lamp.faultType == 'flash') {
|
||||
if (this.style.Signal.lamp.faultType == 'flash') {
|
||||
this.lamps[0].faultShow();
|
||||
} else if (this.style.Signal.lamp.faultType == 'cross') {
|
||||
this.lamps[0].setFault2Corss(true);
|
||||
} else if (this.style.Signal.lamp.faultType == 'watch') {
|
||||
const model = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode');
|
||||
if (model && model.instance) {
|
||||
model.instance.setControlColor('red');
|
||||
// if (model.redOpen) {
|
||||
// model.instance.setControlColor('red');
|
||||
// } else if (model.greenOpen || model.yellowOpen) {
|
||||
// model.instance.setControlColor('green');
|
||||
// } else {
|
||||
// model.instance.setControlColor('#9F9C9C');
|
||||
// }
|
||||
}
|
||||
} else if (this.style.Signal.lamp.faultType == 'light') {
|
||||
this.lamps[0].setAnimationStart('red');
|
||||
}
|
||||
}
|
||||
|
||||
@ -606,9 +624,6 @@ class Signal extends Group {
|
||||
// 恢复状态
|
||||
recover() {
|
||||
this.lamps.forEach(item=> { item.show(); });
|
||||
if (this.style.Signal.lamp.faultType && this.style.Signal.lamp.faultType == 'flash') {
|
||||
this.lamps[0].faultHide();
|
||||
}
|
||||
this.sigName.setStyle({ textBorderWidth: 0 });
|
||||
this.sigName.setColor(this.style.Signal.text.defaultColor);
|
||||
this.remainTImeName.hide();
|
||||
@ -620,12 +635,27 @@ class Signal extends Group {
|
||||
this.sigRoute.hide();
|
||||
this.sigBack && this.sigBack.hide();
|
||||
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
|
||||
|
||||
if (this.style.Signal.lamp.guidName === 'singleRY') {
|
||||
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
|
||||
}
|
||||
if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') {
|
||||
this.lamps[1].hide();
|
||||
}
|
||||
|
||||
if (this.style.Signal.lamp.faultType == 'flash') {
|
||||
this.lamps[0].faultHide();
|
||||
} else if (this.style.Signal.lamp.faultType == 'cross') {
|
||||
this.lamps[0].setFault2Corss(false);
|
||||
} else if (this.style.Signal.lamp.faultType == 'watch') {
|
||||
const model = findDeviceByModelDepType(this.model, deviceType.LampFilament, 'stationCode');
|
||||
if (model && model.instance) {
|
||||
model.instance.setControlColor('#9F9C9C');
|
||||
}
|
||||
} else if (this.style.Signal.lamp.faultType == 'light') {
|
||||
this.lamps[0].setAnimationEnd();
|
||||
}
|
||||
|
||||
this.insideTriangle && this.insideTriangle.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.strokeColor});
|
||||
this.insideTriangle && this.insideTriangle.hide();
|
||||
this.sigPost && this.sigPost.removeTerminalOptional();
|
||||
@ -641,6 +671,7 @@ class Signal extends Group {
|
||||
if (!this.isShowShape) return;
|
||||
const path = window.location.href;
|
||||
this.recover();
|
||||
|
||||
/** 信号机进路按钮显示 */
|
||||
if (isShowThePrdType(model.prdType, '03') && this.style.Signal.lowButton.display) {
|
||||
/** 终端信号机按钮 */
|
||||
@ -659,7 +690,6 @@ 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.remainTime && this.showRemainTime(model.remainTime);
|
||||
if (!path.includes('/map/draw')) {
|
||||
// 联锁自动进路通过
|
||||
@ -710,6 +740,8 @@ class Signal extends Group {
|
||||
});
|
||||
}
|
||||
}
|
||||
// 信号机故障
|
||||
model.fault && this.fault();
|
||||
// 设置灰显
|
||||
model.noStatus && this.setAshShow();
|
||||
}
|
||||
|
13
src/jmapNew/shape/utils/ShapeDepFind.js
Normal file
13
src/jmapNew/shape/utils/ShapeDepFind.js
Normal file
@ -0,0 +1,13 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
// 查询有相同归属集中站的指定类型的图形
|
||||
export function findDeviceByModelDepType(model, type, compare) {
|
||||
return Object.values(Vue.prototype.$jlmap.mapDevice).find(el => {
|
||||
if (el._type == type) {
|
||||
return (compare instanceof Function)
|
||||
? compare(el, model)
|
||||
: el[compare] == model[compare];
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
@ -35,6 +35,8 @@ module.exports = {
|
||||
productionSourceMap: false, // 项目打包后是否压缩
|
||||
devServer: {
|
||||
port: port,
|
||||
host: '0.0.0.0',
|
||||
disableHostCheck: true,
|
||||
hotOnly: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
|
Loading…
Reference in New Issue
Block a user