增加,信号机灯丝故障处理

This commit is contained in:
lVAL 2021-01-07 15:15:54 +08:00
parent 85a6b0c617
commit 1a0612020e
11 changed files with 188 additions and 91 deletions

View File

@ -175,7 +175,8 @@ class SkinCode extends defaultStyle {
greenColor: '#00FF00', // 信号灯绿色 greenColor: '#00FF00', // 信号灯绿色
yellowColor: '#FFFF00', // 信号灯黄色 yellowColor: '#FFFF00', // 信号灯黄色
whiteColor: '#FFFFFF', // 信号灯白色 whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0070C0' // 信号灯蓝色 blueColor: '#0070C0', // 信号灯蓝色
faultType: 'light' // 信号机故障类型 light闪
}, },
route: { route: {
direction: true, // 自动通过方向 direction: true, // 自动通过方向

View File

@ -186,7 +186,7 @@ class SkinCode extends defaultStyle {
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 2, // 信号灯边框线宽度 borderWidth: 2, // 信号灯边框线宽度
borderColor: '#000000', // 信号灯边框线颜色 borderColor: '#000000', // 信号灯边框线颜色
physicColor:'#ffffff', // 物理点灯信号灯边框线颜色 physicColor:'#ffffff', // 物理点灯信号灯边框线颜色
radiusR: 5, // 信号灯半径 radiusR: 5, // 信号灯半径
blockColor: '#EF0C08', // 信号灯锁闭 blockColor: '#EF0C08', // 信号灯锁闭
grayColor: '#C0C0C0', // 信号灯灰色 grayColor: '#C0C0C0', // 信号灯灰色
@ -195,7 +195,7 @@ class SkinCode extends defaultStyle {
yellowColor: 'yellow', // 信号灯黄色 yellowColor: 'yellow', // 信号灯黄色
whiteColor: '#FFFFFF', // 信号灯白色 whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0070C0', // 信号灯蓝色 blueColor: '#0070C0', // 信号灯蓝色
logicDisplayNone: true // 信号机上×型标识不展示 faultType: 'cross' // 信号机故障类型 cross叉形狀
}, },
route: { route: {
direction: false, // 自动通过方向 direction: false, // 自动通过方向

View File

@ -162,7 +162,7 @@ class SkinCode extends defaultStyle {
yellowColor: '#FFFF00', // 信号灯黄色 yellowColor: '#FFFF00', // 信号灯黄色
whiteColor: '#FFFFFF', // 信号灯白色 whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0070C0', // 信号灯蓝色 blueColor: '#0070C0', // 信号灯蓝色
faultType: 'flash' // 信号机故障类型 flash为西安三号线特殊类型 faultType: 'flash' // 信号机故障类型flash太阳
}, },
route: { route: {
direction: false, // 自动进路方向 direction: false, // 自动进路方向

View File

@ -175,6 +175,7 @@ class SkinCode extends defaultStyle {
yellowColor: 'yellow', // 信号灯黄色 yellowColor: 'yellow', // 信号灯黄色
whiteColor: '#FFFFFF', // 信号灯白色 whiteColor: '#FFFFFF', // 信号灯白色
blueColor: '#0070C0', // 信号灯蓝色 blueColor: '#0070C0', // 信号灯蓝色
faultType: 'watch', // 信号机故障类型 watch表形狀
logicDisplayNone: true // 信号机上×型标识不展示 logicDisplayNone: true // 信号机上×型标识不展示
}, },
route: { route: {

View File

@ -14,4 +14,7 @@ export default class ELampFilament extends Group {
this.path = createPathSvg(this.model); this.path = createPathSvg(this.model);
this.add(this.path); this.add(this.path);
} }
setControlColor(color) {
this.path.setStyle({fill: color});
}
} }

View File

@ -224,11 +224,11 @@ export default class SaidLamp extends Group {
this.isShowShape = false; this.isShowShape = false;
} }
} }
setControlColor(color, flag) { setControlColor(color, flag = false) {
this.control && this.control.getControl().stopAnimation(false); this.control && this.control.getControl && this.control.getControl().stopAnimation(false);
this.control && this.control.setControlColor(color); this.control && this.control.setControlColor && this.control.setControlColor(color);
if (flag) { 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(0, { fill: this.style.backgroundColor })
.when(1000, { fill: color }) .when(1000, { fill: color })
.when(2000, { fill: this.style.backgroundColor }) .when(2000, { fill: this.style.backgroundColor })

View File

@ -58,11 +58,7 @@ class ESigLamp extends Group {
_subType: 'SignalLamp', _subType: 'SignalLamp',
_val: '3', _val: '3',
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z + 1,
origin: {
x: model.originX,
y: model.originY
},
shape: { shape: {
x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), 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), y1: model.y + (style.Signal.lamp.radiusR + 0.5) * Math.sin(Math.PI / 4),
@ -78,11 +74,7 @@ class ESigLamp extends Group {
_subType: 'SignalLamp', _subType: 'SignalLamp',
_val: '3', _val: '3',
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z + 1,
origin: {
x: model.originX,
y: model.originY
},
shape: { shape: {
x1: model.x + (style.Signal.lamp.radiusR + 0.5) * Math.cos(Math.PI / 4), 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)), 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 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); 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) { if (!style.Signal.lamp.logicDisplayNone) {
this.add(this.lstop); this.add(this.lstop);
this.add(this.rstop); this.add(this.rstop);
@ -126,6 +161,16 @@ class ESigLamp extends Group {
this.lamp.setStyle(data); 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) { setStop(has) {
if (has) { if (has) {
this.lstop && this.lstop.show(); this.lstop && this.lstop.show();

View File

@ -17,6 +17,8 @@ import Rect from 'zrender/src/graphic/shape/Rect';
import Polygon from 'zrender/src/graphic/shape/Polygon'; import Polygon from 'zrender/src/graphic/shape/Polygon';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Isogon from 'zrender/src/graphic/shape/Isogon'; 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 BoundingRect from 'zrender/src/core/BoundingRect';
// import background from './../../../ibp/shape/background'; // import background from './../../../ibp/shape/background';
@ -491,8 +493,24 @@ class Signal extends Group {
// } // }
fault() { fault() {
if (this.style.Signal.lamp.faultType && this.style.Signal.lamp.faultType == 'flash') { if (this.style.Signal.lamp.faultType == 'flash') {
this.lamps[0].faultShow(); 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() { recover() {
this.lamps.forEach(item=> { item.show(); }); 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.setStyle({ textBorderWidth: 0 });
this.sigName.setColor(this.style.Signal.text.defaultColor); this.sigName.setColor(this.style.Signal.text.defaultColor);
this.remainTImeName.hide(); this.remainTImeName.hide();
@ -620,12 +635,27 @@ class Signal extends Group {
this.sigRoute.hide(); this.sigRoute.hide();
this.sigBack && this.sigBack.hide(); this.sigBack && this.sigBack.hide();
this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色 this.sigPost.setColor(this.style.Signal.post.standardColor); // 设置底座默认颜色
if (this.style.Signal.lamp.guidName === 'singleRY') { if (this.style.Signal.lamp.guidName === 'singleRY') {
this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth }); this.lamps[0].setStyle({ lineWidth: this.style.Signal.lamp.borderWidth });
} }
if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') { if (this.style.Signal.lamp.guidName === 'double' || this.style.Signal.lamp.guidName === 'doubleAndBase') {
this.lamps[1].hide(); 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.setStyle({fill: this.style.Signal.insideTriangle.startSignalColor, stroke: this.style.Signal.insideTriangle.strokeColor});
this.insideTriangle && this.insideTriangle.hide(); this.insideTriangle && this.insideTriangle.hide();
this.sigPost && this.sigPost.removeTerminalOptional(); this.sigPost && this.sigPost.removeTerminalOptional();
@ -641,6 +671,7 @@ class Signal extends Group {
if (!this.isShowShape) return; if (!this.isShowShape) return;
const path = window.location.href; const path = window.location.href;
this.recover(); this.recover();
/** 信号机进路按钮显示 */ /** 信号机进路按钮显示 */
if (isShowThePrdType(model.prdType, '03') && this.style.Signal.lowButton.display) { 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.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.remainTime && this.showRemainTime(model.remainTime); model.remainTime && this.showRemainTime(model.remainTime);
if (!path.includes('/map/draw')) { if (!path.includes('/map/draw')) {
// 联锁自动进路通过 // 联锁自动进路通过
@ -710,6 +740,8 @@ class Signal extends Group {
}); });
} }
} }
// 信号机故障
model.fault && this.fault();
// 设置灰显 // 设置灰显
model.noStatus && this.setAshShow(); model.noStatus && this.setAshShow();
} }

View 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;
});
}

View File

@ -2,101 +2,101 @@ import Path from 'zrender/src/graphic/Path';
/** 指向箭头坐标*/ /** 指向箭头坐标*/
export function arrow(modelX, modelY, length, radius) { export function arrow(modelX, modelY, length, radius) {
return [ return [
[modelX - length, modelY], [modelX - length, modelY],
[modelX - length + radius / 1.5, modelY - radius / 1.2], [modelX - length + radius / 1.5, modelY - radius / 1.2],
[modelX - length + radius / 1.5, modelY - radius / 3], [modelX - length + radius / 1.5, modelY - radius / 3],
[modelX + length, modelY - radius / 3], [modelX + length, modelY - radius / 3],
[modelX + length, modelY + radius / 3], [modelX + length, modelY + radius / 3],
[modelX - length + radius / 1.5, modelY + radius / 3], [modelX - length + radius / 1.5, modelY + radius / 3],
[modelX - length + radius / 1.5, modelY + radius / 1.2] [modelX - length + radius / 1.5, modelY + radius / 1.2]
]; ];
} }
/** 指向三角形坐标*/ /** 指向三角形坐标*/
export function triangular(modelX, modelY, drict, radius) { export function triangular(modelX, modelY, drict, radius) {
return [ return [
[modelX, modelY], [modelX, modelY],
[modelX - drict * (radius + 2), modelY - radius], [modelX - drict * (radius + 2), modelY - radius],
[modelX - drict * (radius + 2), modelY + radius] [modelX - drict * (radius + 2), modelY + radius]
]; ];
} }
/** 屏蔽门手电筒*/ /** 屏蔽门手电筒*/
export function flashlight(modelX, modelY, drict, width, height, offsetx, offsety, beyond) { export function flashlight(modelX, modelY, drict, width, height, offsetx, offsety, beyond) {
return [ return [
[modelX + drict * (offsetx), modelY + drict * offsety - (height + beyond) / 2], [modelX + drict * (offsetx), modelY + drict * offsety - (height + beyond) / 2],
[modelX + drict * (offsetx + beyond), modelY + drict * offsety - height / 2], [modelX + drict * (offsetx + beyond), modelY + drict * offsety - height / 2],
[modelX + drict * (offsetx + beyond + width), modelY + drict * offsety - height / 2], [modelX + drict * (offsetx + beyond + width), modelY + drict * offsety - height / 2],
[modelX + drict * (offsetx + beyond + width), modelY + drict * offsety + height / 2], [modelX + drict * (offsetx + beyond + width), modelY + drict * offsety + height / 2],
[modelX + drict * (offsetx + beyond), modelY + drict * offsety + height / 2], [modelX + drict * (offsetx + beyond), modelY + drict * offsety + height / 2],
[modelX + drict * (offsetx), modelY + drict * offsety + (height + beyond) / 2] [modelX + drict * (offsetx), modelY + drict * offsety + (height + beyond) / 2]
]; ];
} }
/** 区段限速体带方向*/ /** 区段限速体带方向*/
export function limitArrows(modelX, modelY, drict, radius) { export function limitArrows(modelX, modelY, drict, radius) {
return [ return [
[modelX + drict * radius, modelY - radius], [modelX + drict * radius, modelY - radius],
[modelX + drict * radius, modelY + radius], [modelX + drict * radius, modelY + radius],
[modelX - drict * radius, modelY + radius], [modelX - drict * radius, modelY + radius],
[modelX - drict * radius * 1.8, modelY], [modelX - drict * radius * 1.8, modelY],
[modelX - drict * radius, modelY - radius] [modelX - drict * radius, modelY - radius]
]; ];
} }
/** 区段折返标记*/ /** 区段折返标记*/
export function turnbackArrows(modelX, modelY, drict, width, height) { export function turnbackArrows(modelX, modelY, drict, width, height) {
return [ return [
[modelX - drict * (width - 1), modelY + height], [modelX - drict * (width - 1), modelY + height],
[modelX + drict * width / 2, modelY + height], [modelX + drict * width / 2, modelY + height],
[modelX + drict * width / 2, modelY - height], [modelX + drict * width / 2, modelY - height],
[modelX - drict * (width - 3), modelY - height] [modelX - drict * (width - 3), modelY - height]
]; ];
} }
export const Ugraph = Path.extend({ export const Ugraph = Path.extend({
type: 'ugraph', type: 'ugraph',
shape: { shape: {
points: null, points: null,
counterclockwise: true counterclockwise: true
}, },
style: { style: {
stroke: '#000', stroke: '#000',
fill: null fill: null
}, },
buildPath: function (ctx, shape) { buildPath: function (ctx, shape) {
var points = shape.points; var points = shape.points;
var r = Math.abs(points[1][1] - points[2][1]) / 2; var r = Math.abs(points[1][1] - points[2][1]) / 2;
var x = Math.abs(points[1][0] + points[2][0]) / 2; var x = Math.abs(points[1][0] + points[2][0]) / 2;
var y = Math.abs(points[1][1] + points[2][1]) / 2; var y = Math.abs(points[1][1] + points[2][1]) / 2;
ctx.moveTo(points[0][0], points[0][1]); ctx.moveTo(points[0][0], points[0][1]);
ctx.lineTo(points[1][0], points[1][1]); ctx.lineTo(points[1][0], points[1][1]);
shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false);
shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true); shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true);
ctx.moveTo(points[2][0], points[2][1]); ctx.moveTo(points[2][0], points[2][1]);
ctx.lineTo(points[3][0], points[3][1]); ctx.lineTo(points[3][0], points[3][1]);
ctx.closePath(); ctx.closePath();
points = shape.points; points = shape.points;
r = Math.abs(points[1][1] - points[2][1]) / 2; r = Math.abs(points[1][1] - points[2][1]) / 2;
x = Math.abs(points[1][0] + points[2][0]) / 2; x = Math.abs(points[1][0] + points[2][0]) / 2;
y = Math.abs(points[1][1] + points[2][1]) / 2; y = Math.abs(points[1][1] + points[2][1]) / 2;
ctx.moveTo(points[0][0], points[0][1]); ctx.moveTo(points[0][0], points[0][1]);
ctx.lineTo(points[1][0], points[1][1]); ctx.lineTo(points[1][0], points[1][1]);
shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false); shape.counterclockwise && ctx.arc(x, y, r, Math.PI / 2, Math.PI * 3 / 2, false);
shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true); shape.counterclockwise || ctx.arc(x, y, r, Math.PI / 2, -Math.PI / 2, true);
ctx.moveTo(points[2][0], points[2][1]); ctx.moveTo(points[2][0], points[2][1]);
ctx.lineTo(points[3][0], points[3][1]); ctx.lineTo(points[3][0], points[3][1]);
ctx.closePath(); ctx.closePath();
} }
}); });

View File

@ -35,6 +35,8 @@ module.exports = {
productionSourceMap: false, // 项目打包后是否压缩 productionSourceMap: false, // 项目打包后是否压缩
devServer: { devServer: {
port: port, port: port,
host: '0.0.0.0',
disableHostCheck: true,
hotOnly: true, hotOnly: true,
overlay: { overlay: {
warnings: false, warnings: false,