rt-sim-training-client/src/jmap/shape/Signal/index.js

507 lines
15 KiB
JavaScript
Raw Normal View History

2019-07-15 10:06:07 +08:00
/*
* 信号机
*/
2019-07-18 10:05:16 +08:00
import ESigPost from './ESigPost';
2019-07-23 18:30:08 +08:00
import ESigLamp from './ESigLamp';
2019-07-23 18:21:49 +08:00
import ESigAuto from './ESigAuto';
import ESigRoute from './ESigRoute';
2019-07-18 10:05:16 +08:00
import ESigButton from './ESigButton';
2019-07-23 18:49:54 +08:00
import ESigDelay from './ESigDelay';
2019-07-23 18:30:08 +08:00
import ESigName from './ESigName';
import EMouse from './EMouse';
2019-07-16 16:29:31 +08:00
import Group from 'zrender/src/container/Group';
2019-07-30 18:02:58 +08:00
import BoundingRect from 'zrender/src/core/BoundingRect';
2019-07-15 10:06:07 +08:00
2019-07-16 16:29:31 +08:00
class Signal extends Group {
2019-07-30 09:18:24 +08:00
constructor(model, style) {
2019-07-16 12:01:43 +08:00
super();
this._code = model.code;
2019-07-30 09:18:24 +08:00
this._type = model._type;
2019-07-15 10:06:07 +08:00
this.model = model;
2019-07-16 16:29:31 +08:00
this.style = style;
this.count = parseInt(model.lampPositionType);
this.lamps = new Array(this.count);
2019-07-30 09:18:24 +08:00
this.zlevel = model.zlevel;
2019-07-29 11:18:50 +08:00
this.z = 7;
2019-07-16 16:29:31 +08:00
this.create();
this.createMouseEvent();
2019-07-22 15:43:42 +08:00
this.transformRotation(this);
2019-07-30 09:18:24 +08:00
this.setState(model);
2019-07-15 10:06:07 +08:00
}
2019-07-16 16:29:31 +08:00
create() {
const model = this.model;
const style = this.style;
2019-07-16 16:29:31 +08:00
const drict = this.model.directionType == '01' ? -1 : 1; // 朝向 左:右
2019-07-18 18:24:40 +08:00
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
2019-07-15 10:06:07 +08:00
2019-07-16 16:29:31 +08:00
// 信号机高柱矮柱
2019-07-23 18:30:08 +08:00
this.sigPost = new ESigPost({
2019-07-15 10:06:07 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
style: style,
2019-07-16 16:29:31 +08:00
drict: drict,
type: model.lampPostType,
x: model.position.x,
2019-08-02 18:05:08 +08:00
y: model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR)
2019-07-15 10:06:07 +08:00
});
2019-07-16 16:29:31 +08:00
// 信号灯
2019-07-23 18:49:54 +08:00
const endPoint = this.sigPost.getLampPosition(model.lampPostType);
2019-07-16 16:29:31 +08:00
this.lamps = [];
for (let i = 0; i < this.count; i++) {
2019-07-23 18:30:08 +08:00
const lamp = new ESigLamp({
2019-07-15 10:06:07 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
style: style,
2019-07-16 16:29:31 +08:00
drict: drict,
2019-08-02 17:02:43 +08:00
x: endPoint.x + i * drict * style.Signal.lamp.radiusR * 2,
2019-07-18 18:24:40 +08:00
y: endPoint.y,
originX: model.position.x,
originY: model.position.y
2019-07-15 10:06:07 +08:00
});
2019-07-16 16:29:31 +08:00
this.lamps.push(lamp);
2019-07-15 10:06:07 +08:00
}
2019-07-16 18:37:49 +08:00
// 信号机名称
2019-08-02 17:02:43 +08:00
const sigNameX = model.position.x - drict * (style.Signal.post.standardWidth) + model.namePosition.x;
2019-08-02 18:05:08 +08:00
const sigNameY = model.position.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
2019-07-31 14:59:38 +08:00
const textAlign = style.Signal.text.isAlignCenter ? 'middle': this.model.directionType == '01'? 'right': 'left';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
2019-07-19 09:23:56 +08:00
this.sigName = new ESigName({
2019-07-16 18:37:49 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
2019-07-22 15:43:42 +08:00
silent: false,
2019-07-24 13:50:37 +08:00
isNoRotation: style.Signal.text.isNoRotation,
style: style,
2019-07-19 09:23:56 +08:00
x: sigNameX,
y: sigNameY,
text: model.name,
2019-08-06 13:02:55 +08:00
fontWeight: style.Signal.text.fontWeight,
2019-08-02 17:02:43 +08:00
fontSize: style.Signal.text.fontSize,
2019-08-06 13:09:11 +08:00
fontFamily: style.fontFamily,
2019-08-02 17:02:43 +08:00
textFill: style.Signal.text.defaultColor,
2019-07-31 14:59:38 +08:00
textAlign: textAlign,
textVerticalAlign: textVerticalAlign
2019-07-16 18:37:49 +08:00
});
// 自动进路
2019-08-02 17:02:43 +08:00
const sigRouteH = style.Signal.route.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigRouteX = endPoint.x + (style.Signal.route.offset.x + sigRouteH) * drict;
const sigRouteY = endPoint.y + (style.Signal.route.offset.y);
this.sigRoute = new ESigRoute({
2019-07-16 18:37:49 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
2019-07-23 18:49:54 +08:00
style: style,
x: sigRouteX,
y: sigRouteY,
drict: drict
2019-07-16 18:37:49 +08:00
});
// 自动通过
2019-08-02 17:02:43 +08:00
const sigAutoH = style.Signal.auto.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigAutoX = endPoint.x + (style.Signal.auto.offset.x + sigAutoH) * drict;
const sigAutoY = endPoint.y + (style.Signal.auto.offset.y);
2019-07-23 18:21:49 +08:00
this.sigAuto = new ESigAuto({
2019-07-16 18:37:49 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
style: style,
2019-07-16 18:37:49 +08:00
count: this.count,
drict: drict,
2019-07-23 18:21:49 +08:00
x: sigAutoX,
y: sigAutoY,
2019-08-06 10:54:22 +08:00
width: style.Signal.auto.width,
fill: style.Signal.auto.autoRoute,
2019-07-17 18:18:28 +08:00
lineWidth: 0.6,
stroke: style.sidelineColor
2019-07-16 18:37:49 +08:00
});
// 延迟解锁
2019-08-02 17:02:43 +08:00
const sigDelayH = style.Signal.delay.direction ? this.count * style.Signal.lamp.radiusR * 2 : -style.Signal.lamp.radiusR * 2;
const sigDelayX = endPoint.x + (style.Signal.delay.offset.x + sigDelayH) * drict;
const sigDelayY = endPoint.y - (style.Signal.delay.offset.y) * posit;
2019-07-19 09:23:56 +08:00
this.sigDelay = new ESigDelay({
2019-07-16 18:37:49 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
style: style,
2019-07-18 18:24:40 +08:00
x: sigDelayX,
y: sigDelayY,
2019-08-06 13:02:55 +08:00
fontWeight: style.Signal.delay.fontWeight,
2019-08-02 17:02:43 +08:00
fontSize: style.Signal.delay.fontSize,
2019-08-06 13:09:11 +08:00
fontFamily: style.fontFamily,
2019-07-30 09:18:24 +08:00
text: this.model.delayCount || '0',
2019-08-02 17:02:43 +08:00
textFill: style.Signal.delay.fontColor,
2019-07-16 18:37:49 +08:00
textAlign: drict > 0 ? 'right' : 'left',
textVerticalAlign: 'middle'
});
2019-07-15 10:06:07 +08:00
// 信号灯按钮
2019-07-16 16:29:31 +08:00
this.sigButton = new ESigButton({
2019-07-15 10:06:07 +08:00
zlevel: this.zlevel,
2019-07-22 13:39:03 +08:00
z: this.z,
style: style,
2019-07-16 16:29:31 +08:00
posit: posit,
show: model.buttonShow,
x: model.buttonPosition.x,
2019-08-02 17:02:43 +08:00
y: model.buttonPosition.y - posit * (style.Signal.button.distance + style.Signal.lamp.radiusR * 2)
2019-07-16 16:29:31 +08:00
});
2019-07-15 10:06:07 +08:00
2019-07-16 18:37:49 +08:00
this.add(this.sigPost);
2019-07-16 16:29:31 +08:00
this.lamps.forEach(lamp => { this.add(lamp); });
2019-07-30 16:47:11 +08:00
this.model.nameShow ? this.add(this.sigName) : null;
2019-07-23 18:21:49 +08:00
this.add(this.sigAuto);
this.add(this.sigRoute);
2019-07-16 18:37:49 +08:00
this.add(this.sigDelay);
2019-07-23 18:49:54 +08:00
// this.add(this.sigButton);
2019-07-15 10:06:07 +08:00
}
createMouseEvent() {
2019-08-02 14:17:43 +08:00
if (this.style.Signal.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
2019-07-31 14:59:38 +08:00
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
2019-07-22 15:43:42 +08:00
// 整体旋转信号灯
transformRotation(device) {
if (this.model.rotate) {
device.eachChild(item => {
if (item instanceof Group) {
this.transformRotation(item);
2019-07-24 13:50:37 +08:00
} else if (item && item.model && item.model.isNoRotation) {
2019-07-22 15:43:42 +08:00
item.origin = [this.model.position.x, this.model.position.y];
item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();
}
});
}
}
2019-07-16 18:37:49 +08:00
// 关闭
close() {
2019-07-30 09:18:24 +08:00
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 2 && this.model.lightType == '02') { // 双灯 逻辑点灯
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(true);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 1 && this.model.lightType == '01') { // 单灯 物理点灯
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
if (this.model.useType == '05') {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
2019-07-26 15:52:50 +08:00
} else {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 1 && this.model.lightType == '02') { // 单灯 逻辑点灯
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(true);
if (this.model.useType == '05') {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
2019-07-26 15:52:50 +08:00
} else {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
}
} else if (this.count == 1) {
if (this.lamps[0]) {
if (this.model.useType == '05') {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
2019-07-26 15:52:50 +08:00
} else {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
2019-07-16 18:37:49 +08:00
}
}
}
// 开放
open() {
2019-07-30 09:18:24 +08:00
if (this.count == 2 && this.model.lightType == '01' && this.model.switchLocateType == '01') { // 双灯 物理点灯 道岔定位
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
this.lamps[1].setColor(this.style.backgroundColor);
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 2 && this.model.lightType == '02' && this.model.switchLocateType == '01') { // 双灯 逻辑点灯 道岔定位
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(true);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
this.lamps[1].setColor(this.style.backgroundColor);
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 2 && this.model.lightType == '01' && this.model.switchLocateType == '02') { // 双灯 物理点灯 道岔反位
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
2019-07-26 15:52:50 +08:00
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 2 && this.model.lightType == '02' && this.model.switchLocateType == '02') { // 双灯 逻辑点灯 道岔反位
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(true);
this.lamps[0].setColor(this.style.backgroundColor);
}
if (this.lamps[1]) {
this.lamps[1].setStop(true);
2019-08-02 17:02:43 +08:00
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
2019-07-26 15:52:50 +08:00
}
2019-07-30 09:18:24 +08:00
} else if (this.count == 1 && this.model.lightType == '01' && this.model.switchLocateType == '02') { // 单灯 物理点灯 允许调车
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
// 出站信号机/阻隔信号机
if (['02', '06'].includes(this.model.useType)) {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-26 15:52:50 +08:00
} else {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
2019-07-26 15:52:50 +08:00
}
}
2019-07-30 17:27:29 +08:00
} else if (this.count == 1 && this.model.lightType == '01' && this.model.switchLocateType == '01') {
if (this.lamps[0]) {
this.lamps[0].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-30 17:27:29 +08:00
}
} else if (this.count == 1 && this.model.lightType == '02' && this.model.switchLocateType == '02') {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-30 17:27:29 +08:00
}
} else if (this.count == 1 && this.model.lightType == '02' && this.model.switchLocateType == '01' ) {
if (this.lamps[0]) {
this.lamps[0].setStop(true);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.greenColor);
2019-07-30 17:27:29 +08:00
}
2019-07-16 18:37:49 +08:00
}
}
// 列车进路
trainRoute() {
2019-07-26 15:52:50 +08:00
if (this.count == 1) {
2019-07-16 18:37:49 +08:00
/** 单灯 列兼调信号*/
2019-08-02 17:02:43 +08:00
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.yellowColor);
2019-07-16 18:37:49 +08:00
}
}
// 调车进路
shuntRoute() {
2019-07-26 15:52:50 +08:00
if (this.count == 1) {
2019-07-16 18:37:49 +08:00
/** 单灯 列兼调信号*/
/** 单灯 阻挡兼调车信号*/
2019-08-02 17:02:43 +08:00
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.lamp.whiteColor);
2019-07-16 18:37:49 +08:00
}
}
// 引导
guid() {
2019-07-30 09:18:24 +08:00
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯 允许引导信号
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[1].setColor(this.style.Signal.lamp.yellowColor);
2019-07-26 15:52:50 +08:00
}
}
2019-07-16 18:37:49 +08:00
}
// 封锁
block() {
2019-07-26 15:52:50 +08:00
if (this.count == 1) {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
// this.siglamp.setNameBorder(1)
}
2019-08-02 17:02:43 +08:00
this.sigName.setColor(this.style.Signal.text.blockColor);
if (this.style.Signal.text.nameBorderShow) {
this.sigName.setStyle({textBorderWidth: 1});
this.sigName.setColor('#fff');
}
2019-07-16 18:37:49 +08:00
}
// 功能封锁
functionBlock() {
2019-07-26 15:52:50 +08:00
if (this.count == 1) {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
2019-07-26 15:52:50 +08:00
// this.siglamp.setRectBlockByIndex(1, true);
}
2019-07-16 18:37:49 +08:00
}
// 信号保护区段监视状态显示
2019-08-02 17:02:43 +08:00
signalCheck() {
2019-07-26 15:52:50 +08:00
if (this.count == 1) {
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.redColor);
this.sigName.setColor(this.style.Signal.text.checkColor);
2019-07-26 15:52:50 +08:00
}
2019-07-16 18:37:49 +08:00
}
// 故障
fault() {
2019-07-30 09:18:24 +08:00
if (this.count == 2 && this.model.lightType == '01') { // 双灯 物理点灯
2019-07-26 15:52:50 +08:00
if (this.lamps[0]) {
this.lamps[0].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[0].setColor(this.style.Signal.lamp.blueColor);
2019-07-26 15:52:50 +08:00
}
if (this.lamps[1]) {
this.lamps[1].setStop(false);
2019-08-02 17:02:43 +08:00
this.lamps[1].setColor(this.style.Signal.lamp.blueColor);
2019-07-26 15:52:50 +08:00
}
}
2019-07-16 18:37:49 +08:00
}
// 物理点灯
logicalLight() {
2019-07-23 18:49:54 +08:00
this.lamps.forEach(lamp => { lamp.setStop(false); });
2019-07-16 18:37:49 +08:00
}
// 逻辑点灯
physicsLight() {
2019-07-23 18:49:54 +08:00
this.lamps.forEach(lamp => { lamp.setStop(true); });
2019-07-16 18:37:49 +08:00
}
// 设置自动进路模式状态类型
setAutoRouteOpen() {
2019-08-06 10:54:22 +08:00
this.sigAuto.setColor(this.style.Signal.auto.autoRoute);
2019-07-16 18:37:49 +08:00
if (this.model.linkageAutoRouteShow) {
2019-07-23 18:21:49 +08:00
this.sigAuto.show();
2019-07-16 18:37:49 +08:00
} else {
2019-07-23 18:21:49 +08:00
this.sigAuto.hide();
2019-07-16 18:37:49 +08:00
}
}
// 信号机进路自动触发模式状态类型
setAutoAccessOpen() {
2019-08-06 10:54:22 +08:00
this.sigAuto.setColor(this.style.Signal.auto.autoTrigger);
2019-07-16 18:37:49 +08:00
if (this.model.atsAutoTriggerShow) {
2019-07-23 18:21:49 +08:00
this.sigAuto.show();
2019-07-16 18:37:49 +08:00
} else {
2019-07-23 18:21:49 +08:00
this.sigAuto.hide();
2019-07-16 18:37:49 +08:00
}
}
// 设置自动信号模式状态类型
2019-07-23 18:49:54 +08:00
setAutoSignalOpen() {
this.sigRoute.show();
2019-07-16 18:37:49 +08:00
}
// 隐藏自动信号和自动进路
setAutoClose() {
2019-07-23 18:21:49 +08:00
this.sigAuto.hide();
this.sigAuto.setColor(this.style.backgroundColor);
this.sigRoute.hide();
2019-07-16 18:37:49 +08:00
}
// 自动信号和自动进路开始动画
setAutoFlicker() {
2019-07-23 18:21:49 +08:00
this.sigAuto.arrowsAnimation();
2019-07-16 18:37:49 +08:00
}
// 设置延时解锁
setDelayUnlock() {
this.sigDelay.show();
}
// 恢复状态
recover() {
this.sigName.setStyle({textBorderWidth: 0});
2019-08-06 10:54:22 +08:00
this.sigAuto.hide();
this.sigRoute.hide();
2019-07-16 18:37:49 +08:00
this.sigDelay.hide();
2019-07-23 18:21:49 +08:00
this.sigAuto.animationRecover();
2019-08-02 17:02:43 +08:00
this.sigName.setColor(this.style.Signal.text.defaultColor);
2019-07-16 18:37:49 +08:00
}
2019-07-30 09:18:24 +08:00
setState(model) {
2019-07-16 18:37:49 +08:00
this.recover();
/** 设置状态 (点灯类型)*/
2019-07-30 09:18:24 +08:00
switch (model.status) {
2019-07-16 18:37:49 +08:00
case '01': this.close(); break; // 关闭
case '02': this.open(); break; // 开放
case '03': this.guid(); break; // 引导
case '04': this.block(); break; // 封锁
case '05': this.fault(); break; // 故障
case '06': this.block(); break; // 功能封锁
2019-08-02 17:02:43 +08:00
case '07': this.signalCheck(); break; // 信号保护区段检测
2019-07-16 18:37:49 +08:00
}
/** 进路性质类型*/
2019-07-30 09:18:24 +08:00
switch (model.natureType) {
2019-07-16 18:37:49 +08:00
case '01': this.trainRoute(); break; // 列车进路
case '02': this.shuntRoute(); break; // 调车进路
}
/** 设置点灯类型*/
2019-07-30 09:18:24 +08:00
switch (model.lightType) {
2019-07-16 18:37:49 +08:00
case '01': this.logicalLight(); break; // 设置逻辑点灯
case '02': this.physicsLight(); break; // 设置物理点灯
}
/** 设置自动类型*/
2019-07-30 09:18:24 +08:00
switch (model.autoType) {
2019-07-16 18:37:49 +08:00
case '01': this.setAutoClose(); break; // 隐藏 隐藏自动信号和自动进路
2019-07-23 18:49:54 +08:00
case '02': this.setAutoSignalOpen(); break; // 显示 设置自动信号模式状态类型
2019-07-16 18:37:49 +08:00
case '03': this.setAutoRouteOpen(); break; // 显示 设置自动进路模式状态类型
case '04': this.setAutoAccessOpen(); break; // 显示 信号机进路自动触发模式状态类型
}
/** 延时解锁*/
2019-08-06 10:11:32 +08:00
switch (model.delayType) {
case '01': break; // 未延时解锁
case '02': this.setDelayUnlock(); break; // 人工闭塞延时解锁
case '03': this.setDelayUnlock(); break; // 自动闭塞延时解锁
}
2019-07-16 18:37:49 +08:00
/** 信号机进路办理,先停止动画,再判断当前颜色是否闪烁*/
2019-07-30 09:18:24 +08:00
if (model.routeSetting && (model.autoType == '03' || model.autoType == '04')) {
2019-07-16 18:37:49 +08:00
this.setAutoFlicker();
}
}
2019-07-30 15:52:30 +08:00
getBoundingRect() {
2019-07-31 14:59:38 +08:00
const rect = this.sigPost.getBoundingRect();
this.lamps.forEach(elem => {
rect.union(elem.getBoundingRect());
});
return rect;
2019-07-30 15:52:30 +08:00
}
2019-07-30 18:02:58 +08:00
getShapeTipPoint(opts) {
var rect = new BoundingRect(0, 0, 0, 0);
var drict = this.model.directionType == '01' ? -1 : 1; // 朝向 左:右
2019-08-02 17:02:43 +08:00
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
2019-07-30 18:02:58 +08:00
if (opts.val == '1' || opts.val == '2') {
rect = this.sigButton.getBoundingRect();
2019-07-16 18:37:49 +08:00
} else {
2019-07-30 18:02:58 +08:00
rect = this.sigPost.getBoundingRect();
2019-07-16 18:37:49 +08:00
}
2019-07-30 18:02:58 +08:00
return {
2019-08-02 17:02:43 +08:00
x: rect.x + drict * this.style.Signal.post.standardWidth,
2019-07-30 18:02:58 +08:00
y: rect.y - offsetY
};
2019-07-15 10:06:07 +08:00
}
}
2019-07-16 16:29:31 +08:00
export default Signal;