2019-11-29 12:51:58 +08:00
|
|
|
/*
|
|
|
|
* 道岔
|
|
|
|
*/
|
|
|
|
import Line from 'zrender/src/graphic/shape/Line';
|
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import JTriangle from '../../utils/JTriangle';
|
|
|
|
import ESwName from './ESwName.js';
|
|
|
|
import ESwLocal from './ESwLocal.js';
|
|
|
|
import ESwLnversion from './ESwLnversion';
|
|
|
|
import ELockRect from './ELockRect';
|
2020-03-04 18:03:50 +08:00
|
|
|
import ELockArc from './ELockArc';
|
2019-11-29 12:51:58 +08:00
|
|
|
import EMouse from './EMouse';
|
2019-12-04 11:32:30 +08:00
|
|
|
import EHighlight from '../element/EHighlight';
|
2020-02-04 14:28:18 +08:00
|
|
|
import ERhomboid from './ERhomboid';
|
2020-02-18 18:39:12 +08:00
|
|
|
import ETriangle from './ETriangle';
|
2020-04-01 13:47:29 +08:00
|
|
|
import store from '@/store/index_APP_TARGET';
|
2020-03-13 13:01:58 +08:00
|
|
|
import Vue from 'vue';
|
2019-11-29 12:51:58 +08:00
|
|
|
|
|
|
|
export default class Switch extends Group {
|
|
|
|
constructor(model, style) {
|
|
|
|
super();
|
|
|
|
this._code = model.code;
|
|
|
|
this._type = model._type;
|
|
|
|
this.model = model;
|
|
|
|
this.style = style;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = 6;
|
2020-03-13 13:01:58 +08:00
|
|
|
this.isShowShape = true;
|
2019-11-29 12:51:58 +08:00
|
|
|
this.triangle = new JTriangle(model.intersection, model.skew);
|
|
|
|
this.create();
|
|
|
|
this.createLockRect(); // 创建单锁矩形框显示
|
|
|
|
this.createMouseEvent();
|
|
|
|
this.setState(model);
|
2019-12-04 11:32:30 +08:00
|
|
|
this.checkIsDrawMap();
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
createMouseEvent() {
|
|
|
|
// 鼠标事件
|
|
|
|
if (this.style.Switch.mouseOverStyle) {
|
|
|
|
this.mouseEvent = new EMouse(this);
|
|
|
|
this.add(this.mouseEvent);
|
|
|
|
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
|
|
|
|
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
const model = this.model;
|
|
|
|
const style = this.style;
|
|
|
|
|
2020-03-24 13:39:20 +08:00
|
|
|
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2; // 超出宽度多少
|
2019-11-29 12:51:58 +08:00
|
|
|
const swPadding = style.Switch.core.length;
|
|
|
|
const directx = this.triangle.drictx;
|
|
|
|
const directy = this.triangle.dricty;
|
|
|
|
const direct = -this.triangle.drictx * this.triangle.dricty;
|
|
|
|
const coverLength = switchWidth * 1.5;
|
|
|
|
|
2020-03-27 10:02:41 +08:00
|
|
|
const switchWidth1 = style.Section.line.width / 2;
|
|
|
|
const width1 = switchWidth1 * this.triangle.getSinRate();
|
|
|
|
const height1 = switchWidth1 * this.triangle.getCosRate();
|
|
|
|
const width2 = (height1 + switchWidth1) / this.triangle.getTanRate();
|
|
|
|
const width3 = (style.Section.line.width / this.triangle.getSinRate()) - width2 - width1;
|
|
|
|
const detailWidth = 0.2; // 调整定位模糊宽度
|
|
|
|
|
|
|
|
const point1 = [model.intersection.x - directx * width3 - directx * detailWidth, model.intersection.y + directy * switchWidth1];
|
|
|
|
const point2 = [model.intersection.x + directx * (width2 + width1) + directx * detailWidth, point1[1]];
|
2019-11-29 12:51:58 +08:00
|
|
|
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
|
2020-03-27 10:02:41 +08:00
|
|
|
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth) - directx * 2 * detailWidth, point3[1] - direct * this.triangle.getCos(switchWidth)];
|
2020-03-27 18:19:40 +08:00
|
|
|
this.locShelter = new ESwLocal({ // 定位 覆盖形状 A
|
2019-11-29 12:51:58 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
shelterPoints: [point1, point2, point3, point4],
|
|
|
|
cursor: 'pointer',
|
|
|
|
triangle: this.triangle,
|
|
|
|
onmouseover: () => { this.name.getArrowText().show(); },
|
|
|
|
onmouseout: () => { this.name.getArrowText().hide(); }
|
|
|
|
});
|
|
|
|
|
2020-03-24 13:39:20 +08:00
|
|
|
const rpoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
|
|
|
|
const rpoint2 = [rpoint1[0] + directx * (width2 + width1) - directx * width3, model.intersection.y + directy * switchWidth1];
|
|
|
|
const rpoint3 = [rpoint2[0] + directx * 10, rpoint2[1]];
|
|
|
|
const rpoint4 = [rpoint2[0] + directx * 10, rpoint1[1]];
|
2020-03-27 18:19:40 +08:00
|
|
|
this.relocShelter = new ESwLnversion({ // 反位覆盖形状 B
|
2019-11-29 12:51:58 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
shelterPoints: [rpoint1, rpoint2, rpoint3, rpoint4],
|
|
|
|
cursor: 'pointer',
|
|
|
|
onmouseover: () => { this.name.getArrowText().show(); },
|
|
|
|
onmouseout: () => { this.name.getArrowText().hide(); }
|
|
|
|
});
|
|
|
|
|
2020-02-26 22:10:48 +08:00
|
|
|
const spoint1 = [model.intersection.x + directx * width3, model.intersection.y - directy * switchWidth1];
|
|
|
|
const spoint2 = [spoint1[0] - directx * (width2 + width1) - directx * width3, spoint1[1]];
|
|
|
|
const spoint3 = [model.intersection.x - directx * width3, model.intersection.y + directy * switchWidth1];
|
|
|
|
const spoint4 = [spoint1[0] + directx * (width2 + width1) - directx * width3, spoint3[1]];
|
2020-03-27 18:19:40 +08:00
|
|
|
this.rhomboid = new ERhomboid({ // 岔芯 平行四边形 C
|
2020-02-04 14:28:18 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
sectionPoints: [spoint1, spoint2, spoint3, spoint4],
|
|
|
|
cursor: 'pointer',
|
|
|
|
onmouseover: () => { this.name.getArrowText().show(); },
|
|
|
|
onmouseout: () => { this.name.getArrowText().hide(); }
|
|
|
|
});
|
|
|
|
|
2020-03-27 18:19:40 +08:00
|
|
|
const trapezoidWidth = this.style.Switch.jointImg.trapezoidLength;
|
2020-02-18 18:39:12 +08:00
|
|
|
const Tspoint1 = [model.intersection.x + directx * width3 + directx * (width2 + width1) - directx * width3, model.intersection.y + directy * switchWidth1];
|
2020-03-27 18:19:40 +08:00
|
|
|
const Tspoint2 = [Tspoint1[0] - directx * trapezoidWidth, Tspoint1[1]];
|
|
|
|
const Tspoint3 = [Tspoint1[0] - directx * trapezoidWidth, model.intersection.y - directy * switchWidth1];
|
2020-02-18 18:39:12 +08:00
|
|
|
const Tspoint4 = [model.intersection.x + directx * width3, Tspoint3[1]];
|
|
|
|
const Tspoint5 = [Tspoint1[0], Tspoint1[1]];
|
2020-03-27 18:19:40 +08:00
|
|
|
this.sheltertriangle = new ETriangle({ // 岔芯 直角梯形 (用于'挤岔') D
|
2020-02-18 18:39:12 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
sectionPoints: [Tspoint1, Tspoint2, Tspoint3, Tspoint4, Tspoint5],
|
|
|
|
cursor: 'pointer',
|
|
|
|
onmouseover: () => { this.name.getArrowText().show(); },
|
|
|
|
onmouseout: () => { this.name.getArrowText().hide(); }
|
|
|
|
});
|
|
|
|
|
2020-03-24 13:39:20 +08:00
|
|
|
this.releaseBackground = new Line({
|
2019-11-29 12:51:58 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
shape: {
|
|
|
|
x1: model.intersection.x - (coverLength * this.triangle.getCotRate()),
|
|
|
|
y1: model.intersection.y,
|
|
|
|
x2: model.intersection.x + (coverLength * this.triangle.getCotRate()),
|
|
|
|
y2: model.intersection.y
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineWidth: style.Section.line.width + style.Section.line.beyondWidth + 1,
|
|
|
|
stroke: style.backgroundColor
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const arrowTextX = model.intersection.x + 10;
|
|
|
|
const arrowTextY = model.intersection.y + 15;
|
|
|
|
const nameTextX = model.namePosition.x + model.intersection.x + directx * (style.Section.line.width * 3 + style.Switch.text.offset.x) * this.triangle.getCotRate();
|
|
|
|
const nameTextY = model.namePosition.y + model.intersection.y + style.Switch.text.offset.y * (style.Switch.text.position || directy);
|
|
|
|
|
2020-02-04 14:28:18 +08:00
|
|
|
this.name = new ESwName({ // 道岔名称
|
2019-11-29 12:51:58 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
style: style,
|
|
|
|
arrowTextX: arrowTextX,
|
|
|
|
arrowTextY: arrowTextY,
|
|
|
|
nameTextX: nameTextX,
|
|
|
|
nameTextY: nameTextY,
|
|
|
|
sectionName: model.sectionName,
|
|
|
|
name: model.name,
|
|
|
|
nameShow: style.Switch.text.show,
|
|
|
|
triangle: this.triangle
|
|
|
|
});
|
|
|
|
|
|
|
|
this.add(this.locShelter);
|
|
|
|
this.add(this.relocShelter);
|
2020-02-04 14:28:18 +08:00
|
|
|
this.add(this.rhomboid);
|
2020-02-18 18:39:12 +08:00
|
|
|
this.add(this.sheltertriangle);
|
2019-11-29 12:51:58 +08:00
|
|
|
this.add(this.releaseBackground);
|
|
|
|
this.add(this.name);
|
|
|
|
}
|
|
|
|
|
|
|
|
createLockRect() {
|
2020-04-15 11:17:19 +08:00
|
|
|
let offsetX = this.model.locateType == '01' ? 3 : 0;
|
|
|
|
let offsetY = 0;
|
|
|
|
if (this.style.Switch.rectLock.offset) {
|
|
|
|
const directx = this.triangle.drictx;
|
|
|
|
const directy = this.triangle.dricty;
|
|
|
|
offsetX = directx * this.style.Switch.rectLock.offset.x;
|
|
|
|
offsetY = directy * this.style.Switch.rectLock.offset.y;
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.lockRect = new ELockRect({ // 锁定矩形
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 6,
|
2020-03-27 18:19:40 +08:00
|
|
|
x: this.model.intersection.x - this.style.Switch.rectLock.rectWidth / 2 + offsetX,
|
2020-04-15 11:17:19 +08:00
|
|
|
y: this.model.intersection.y - this.style.Switch.rectLock.rectWidth / 2 + offsetY,
|
2020-03-27 18:19:40 +08:00
|
|
|
width: this.style.Switch.rectLock.rectWidth,
|
2019-11-29 12:51:58 +08:00
|
|
|
lineWidth: 1.8,
|
2020-03-27 18:19:40 +08:00
|
|
|
stroke: this.style.Switch.rectLock.rectBorderColor,
|
2019-11-29 12:51:58 +08:00
|
|
|
fill: this.style.transparentColor
|
|
|
|
});
|
|
|
|
this.add(this.lockRect);
|
|
|
|
this.lockRect.hide();
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.arcBlcok) {
|
2020-04-15 11:17:19 +08:00
|
|
|
this.lockArc = new ELockArc({ // 锁定矩形 圆形
|
2020-03-27 18:19:40 +08:00
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z + 6,
|
|
|
|
x: this.model.intersection.x,
|
|
|
|
y: this.model.intersection.y,
|
|
|
|
lineWidth: 1.2,
|
|
|
|
stroke: this.style.Switch.arcBlcok.arcBorderColor,
|
|
|
|
fill: this.style.transparentColor
|
|
|
|
});
|
|
|
|
this.add(this.lockArc);
|
|
|
|
this.lockArc.hide();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 名称动画*/
|
|
|
|
nameTextAnimation() {
|
|
|
|
this.name.getNameText().animateStyle(true)
|
|
|
|
.when(0, { textFill: this.style.backgroundColor })
|
|
|
|
.when(1000, { textFill: this.style.Switch.text.lossColor })
|
|
|
|
.when(2000, { textFill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
|
|
|
|
this.name.getTextRect().animateStyle(true)
|
|
|
|
.when(0, { textFill: this.style.backgroundColor })
|
|
|
|
.when(1000, { textFill: this.style.Switch.text.borderColor })
|
|
|
|
.when(2000, { textFill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置道岔文字颜色*/
|
|
|
|
setTextColor(color) {
|
2020-02-04 14:28:18 +08:00
|
|
|
this.name.getNameText().setStyle({ textFill: color });
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置道岔背景颜色*/
|
|
|
|
setTextStyle(style) {
|
|
|
|
this.name.getNameText().setStyle(style);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置道岔文字边框颜色 (道岔封锁) */
|
|
|
|
setHasTextBorder(width) {
|
2020-02-04 14:28:18 +08:00
|
|
|
this.name.getTextRect().setStyle({ lineWidth: width });
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 恢复状态*/
|
|
|
|
recover() {
|
2020-02-04 14:28:18 +08:00
|
|
|
this.lockRect.hide(); // 矩形包围框
|
2020-03-11 15:10:08 +08:00
|
|
|
this.lockArc.hide(); // 圆形单锁框
|
2019-11-29 12:51:58 +08:00
|
|
|
this.name.getNameText().stopAnimation(false);
|
2020-04-15 11:17:19 +08:00
|
|
|
this.sheltertriangle.hide(); // 直角梯形覆盖图形
|
2020-02-04 14:28:18 +08:00
|
|
|
this.rhomboid.stopAnimation(false);
|
2019-11-29 12:51:58 +08:00
|
|
|
this.releaseBackground.hide();
|
|
|
|
this.setHasTextBorder(0);
|
2020-04-15 11:17:19 +08:00
|
|
|
this.locShelter.hide(); // 定位覆盖图形
|
|
|
|
this.relocShelter.hide(); // 反位覆盖图形
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 定位*/
|
2020-02-18 18:39:12 +08:00
|
|
|
setLocationAction() {
|
2020-04-09 17:03:22 +08:00
|
|
|
// this.recover();
|
2020-02-04 14:28:18 +08:00
|
|
|
if (this.style.Switch.core.splice) {
|
|
|
|
this.locShelter.hide();
|
|
|
|
} else {
|
|
|
|
this.locShelter.show();
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
this.relocShelter.hide();
|
2020-02-04 14:28:18 +08:00
|
|
|
this.rhomboid.hide();
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setTextColor(this.style.Switch.text.locateColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 反位*/
|
2020-02-18 18:39:12 +08:00
|
|
|
setInversionAction() {
|
2020-04-09 17:03:22 +08:00
|
|
|
// this.recover();
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setTextColor(this.style.Switch.text.inversionColor);
|
2020-02-04 14:28:18 +08:00
|
|
|
if (this.style.Switch.core.splice) {
|
|
|
|
this.relocShelter.hide();
|
|
|
|
} else {
|
|
|
|
this.relocShelter.show(); // 反位
|
|
|
|
}
|
|
|
|
this.locShelter.hide(); // 定位
|
2020-03-24 13:39:20 +08:00
|
|
|
this.rhomboid.show(); // 平行四边形
|
2020-02-04 14:28:18 +08:00
|
|
|
this.setSectionState(this.rhomboid.getSection(), 'fill', this.model);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 失去*/
|
|
|
|
setLossAction(nameFlicker) {
|
2020-04-09 17:03:22 +08:00
|
|
|
// this.recover();
|
2020-03-24 13:39:20 +08:00
|
|
|
this.locShelter.show();
|
|
|
|
this.relocShelter.show();
|
2020-02-04 14:28:18 +08:00
|
|
|
this.rhomboid.hide();
|
2020-03-24 13:39:20 +08:00
|
|
|
this.sheltertriangle.show();
|
|
|
|
this.sheltertriangle.setColor(this.style.backgroundColor);
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setTextColor(this.style.Switch.text.lossColor);
|
|
|
|
nameFlicker && this.nameTextAnimation();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 挤叉*/
|
|
|
|
setForkAction() {
|
2020-03-24 13:39:20 +08:00
|
|
|
this.rhomboid.hide(); // 平行四边形
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.jointImg.fork) {
|
2020-03-24 13:39:20 +08:00
|
|
|
this.recover();
|
|
|
|
this.relocShelter.show();
|
|
|
|
this.relocShelter.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
|
|
|
.when(1000, { fill: 'red' })
|
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
2020-02-19 17:26:15 +08:00
|
|
|
this.sheltertriangle.show(); // 宁波线路挤叉特殊显示
|
2020-03-24 13:39:20 +08:00
|
|
|
this.sheltertriangle.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
|
|
|
.when(1000, { fill: 'red' })
|
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
|
|
|
this.locShelter.show();
|
|
|
|
this.locShelter.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
|
|
|
.when(1000, { fill: 'red' })
|
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
2020-02-19 17:26:15 +08:00
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 单锁*/
|
|
|
|
setMonolock() {
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.rectLock.monolock) { // 判断单锁矩形是否显示
|
2019-11-29 12:51:58 +08:00
|
|
|
this.lockRect.show();
|
2020-04-15 11:17:19 +08:00
|
|
|
if (this.style.Switch.rectLock.rectBorderFillColor) {
|
|
|
|
this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.rectBorderColor, fill: this.style.Switch.rectLock.rectBorderFillColor });
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.text.monolock) { // 单锁显示名称包围框
|
2020-02-28 15:20:26 +08:00
|
|
|
this.setHasTextBorder(1);
|
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.arcBlcok.show) { // 圆形单锁是否显示
|
2020-03-04 18:03:50 +08:00
|
|
|
this.lockArc.show();
|
2020-03-27 18:19:40 +08:00
|
|
|
this.model.normalPosition && this.lockArc.setStyle({ stroke: this.style.Switch.arcBlcok.locationColor });
|
|
|
|
!this.model.normalPosition && this.lockArc.setStyle({ stroke: this.style.Switch.aBrclcok.inversionColor });
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
this.model.normalPosition && this.setTextColor(this.style.Switch.text.monolockLocationColor); // 定位 设置道岔名称颜色
|
|
|
|
this.model.reversePosition && this.setTextColor(this.style.Switch.text.monolockInversionColor); // 反位 设置道岔名称颜色
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 封锁 */
|
|
|
|
block() {
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.jointImg.block) {
|
2020-04-09 17:03:22 +08:00
|
|
|
// this.recover();
|
2020-03-25 18:26:19 +08:00
|
|
|
this.relocShelter.show();
|
|
|
|
this.relocShelter.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
2020-03-27 18:19:40 +08:00
|
|
|
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
|
2020-03-25 18:26:19 +08:00
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
2020-03-27 18:19:40 +08:00
|
|
|
this.sheltertriangle.show();
|
2020-03-25 18:26:19 +08:00
|
|
|
this.sheltertriangle.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
2020-03-27 18:19:40 +08:00
|
|
|
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
|
2020-03-25 18:26:19 +08:00
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
|
|
|
this.locShelter.show();
|
|
|
|
this.locShelter.animateStyle(item => {
|
|
|
|
item.animateStyle(true)
|
|
|
|
.when(0, { fill: this.style.backgroundColor })
|
2020-03-27 18:19:40 +08:00
|
|
|
.when(1000, { fill: this.style.Switch.jointImg.flashingColors })
|
2020-03-25 18:26:19 +08:00
|
|
|
.when(2000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
});
|
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.text.block) {
|
2019-11-29 12:51:58 +08:00
|
|
|
this.setHasTextBorder(1);
|
2020-03-27 18:19:40 +08:00
|
|
|
}
|
|
|
|
if (this.style.Switch.jointImg.trapezoidBlock && this.model.reversePosition) { // 范围且封锁时显示
|
2020-02-28 15:20:26 +08:00
|
|
|
this.sheltertriangle.show();
|
|
|
|
this.sheltertriangle.getSection().setStyle('fill', '#000080');
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
if (this.style.Switch.rectLock.block) {
|
|
|
|
this.lockRect.show();
|
|
|
|
this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.blockColor });
|
2020-04-15 11:17:19 +08:00
|
|
|
if (this.style.Switch.rectLock.blockFillColor) {
|
|
|
|
this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.blockColor, fill: this.style.Switch.rectLock.blockFillColor });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
blockMonolock() {
|
|
|
|
if (this.style.Switch.rectLock.block && this.style.Switch.rectLock.monolock) {
|
|
|
|
if (this.style.Switch.rectLock.blockFillColor && this.style.Switch.rectLock.rectBorderFillColor) {
|
|
|
|
this.lockRect.show();
|
|
|
|
this.lockRect.setStyle({ stroke: 'rgba(0,0,0,0)', fill: this.style.Switch.rectLock.blockMonolockFillColor });
|
|
|
|
}
|
2020-03-27 18:19:40 +08:00
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 延时释放*/
|
|
|
|
timeRelease() {
|
|
|
|
this.releaseBackground.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 设置道岔切除*/
|
|
|
|
setSwitchCutOff() {
|
2020-02-17 13:40:20 +08:00
|
|
|
if (this.model.normalPosition) {
|
|
|
|
this.releaseBackground.hide(); /** 定位*/
|
|
|
|
} else if (this.model.reversePosition) {
|
2020-02-18 18:39:12 +08:00
|
|
|
this.relocShelter.getSection().animateStyle(true)
|
|
|
|
.when(1000, { fill: this.style.backgroundColor })
|
|
|
|
.start();
|
|
|
|
this.rhomboid.getSection().animateStyle(true)
|
|
|
|
.when(1000, { fill: this.style.backgroundColor })
|
|
|
|
.start(); /** 反位*/
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sectionCutOff(section) {
|
|
|
|
const lineWidth = this.style.Section.line.width + (this.model.sectionAstatus != '01' ? this.style.Section.line.beyondWidth : 0);
|
|
|
|
if (section) {
|
|
|
|
section.animateStyle(true, [
|
|
|
|
{ time: 0, styles: { lineWidth: lineWidth } },
|
|
|
|
{ time: 1000, styles: { stroke: this.style.backgroundColor } },
|
|
|
|
{ time: 2000, styles: { lineWidth: lineWidth } }
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setSectionState(section, style, state) {
|
|
|
|
if (section && !section.animators.length) {
|
2020-02-17 13:40:20 +08:00
|
|
|
const sectionA = store.getters['map/getDeviceByCode'](state.sectionACode);
|
|
|
|
/** 空闲 */
|
2020-02-18 14:45:32 +08:00
|
|
|
section.setStyle(style, this.style.Section.line.spareColor);
|
2020-02-17 13:40:20 +08:00
|
|
|
/** 道岔保护区段锁闭 */
|
|
|
|
if (sectionA.overlapLock) {
|
2020-02-18 14:45:32 +08:00
|
|
|
section.setStyle(style, this.style.Section.line.protectiveLockColor);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
2020-02-17 13:40:20 +08:00
|
|
|
/** 空闲锁闭或者叫进路锁闭 */
|
|
|
|
if (sectionA.routeLock) {
|
|
|
|
section.setStyle(style, this.style.Section.line.routeLockColor);
|
|
|
|
}
|
|
|
|
/** 非CBTC车占用 */
|
|
|
|
if (sectionA.nctOccupied) {
|
|
|
|
section.setStyle(style, this.style.Section.line.unCommunicationOccupiedColor);
|
|
|
|
}
|
|
|
|
/** CBTC车占用 */
|
|
|
|
if (sectionA.ctOccupied) {
|
|
|
|
section.setStyle(style, this.style.Section.line.communicationOccupiedColor);
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
if (state.cutOff) {
|
|
|
|
this.sectionCutOff(section);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(model) {
|
2020-03-13 13:01:58 +08:00
|
|
|
if (!this.isShowShape) return;
|
2020-04-09 17:03:22 +08:00
|
|
|
this.recover();
|
2020-02-21 15:49:30 +08:00
|
|
|
if (model.normalPosition) {
|
|
|
|
this.setLocationAction(model); /** 定位*/
|
|
|
|
} else if (model.reversePosition) {
|
|
|
|
this.setInversionAction(model); /** 反位*/
|
|
|
|
} else {
|
|
|
|
this.setLossAction(true);
|
|
|
|
}
|
2020-02-11 11:32:19 +08:00
|
|
|
/** 道岔单锁 */
|
2020-02-18 18:39:12 +08:00
|
|
|
model.singleLock && this.setMonolock();
|
2020-02-28 15:20:26 +08:00
|
|
|
/** 道岔封锁 */
|
2020-02-18 18:39:12 +08:00
|
|
|
model.blockade && this.block();
|
2020-04-15 11:17:19 +08:00
|
|
|
model.singleLock && model.blockade && this.blockMonolock(); // 单锁&锁闭状态
|
2020-02-17 13:40:20 +08:00
|
|
|
/** 区段切除*/
|
2020-03-24 13:39:20 +08:00
|
|
|
// this.setForkAction(); // 道岔挤岔完成
|
2020-02-18 18:39:12 +08:00
|
|
|
model.cutOff && this.setSwitchCutOff();
|
2020-03-23 13:48:35 +08:00
|
|
|
if (this.style.Switch.sectionAction.flag) { // 哈尔滨线路处理道岔相关区段颜色
|
2020-03-09 17:02:13 +08:00
|
|
|
const switchModel = Vue.prototype.$jlmap.mapDevice[model.code];
|
|
|
|
if (switchModel.normalPosition != 0) { // 定位情况
|
|
|
|
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];
|
|
|
|
sectionC && sectionC.instance && sectionC.instance.setState(sectionC);
|
|
|
|
} else if (switchModel.normalPosition == 0) { // 反位情况
|
|
|
|
const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode];
|
|
|
|
sectionB && sectionB.instance && sectionB.instance.setState(sectionB);
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
getBoundingRect() {
|
|
|
|
return this.name.getBoundingRect();
|
|
|
|
}
|
|
|
|
|
|
|
|
getShapeTipPoint() {
|
|
|
|
const text = this.name.getNameText();
|
|
|
|
if (text) {
|
|
|
|
const rect = text.getBoundingRect();
|
|
|
|
return {
|
|
|
|
x: rect.x + rect.width / 2,
|
|
|
|
y: rect.y
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2019-12-04 11:32:30 +08:00
|
|
|
|
|
|
|
drawSelected(selected) {
|
|
|
|
this.highlight && this.highlight.drawSelected(selected);
|
|
|
|
}
|
|
|
|
|
|
|
|
checkIsDrawMap() {
|
|
|
|
const path = window.location.href;
|
|
|
|
if (path.includes('/map/draw')) {
|
|
|
|
this.highlight = new EHighlight(this);
|
|
|
|
this.add(this.highlight);
|
|
|
|
this.on('mouseout', () => { this.highlight.mouseout(); });
|
|
|
|
this.on('mouseover', () => { this.highlight.mouseover(); });
|
|
|
|
}
|
|
|
|
}
|
2020-03-11 15:10:08 +08:00
|
|
|
setShowMode() {}
|
2020-03-13 13:01:58 +08:00
|
|
|
setShowStation(stationCode) {
|
|
|
|
if (!stationCode || this.model.stationCode === stationCode) {
|
|
|
|
this.eachChild(item => {
|
|
|
|
item.show();
|
|
|
|
});
|
|
|
|
this.isShowShape = true;
|
|
|
|
this.setState(this.model);
|
|
|
|
} else {
|
|
|
|
this.eachChild(item => {
|
|
|
|
item.hide();
|
|
|
|
});
|
|
|
|
this.isShowShape = false;
|
|
|
|
}
|
|
|
|
}
|
2019-11-29 12:51:58 +08:00
|
|
|
}
|