道岔封锁状态调整

This commit is contained in:
fan 2021-01-15 09:42:19 +08:00
parent c8d0bf50f5
commit 15928a6248
8 changed files with 103 additions and 30 deletions

View File

@ -527,6 +527,10 @@ class SkinCode extends defaultStyle {
rectBorderColor: 'red', // 矩形边框颜色
monolock: false, // 单锁显示
block: false // 封锁显示
},
coverBlock: { // 道岔封锁 遮盖物
show: true, // 显示
coverBlockColor: '#000080'// 遮挡物颜色
}
};

View File

@ -559,6 +559,10 @@ class SkinCode extends defaultStyle {
rectBorderColor: 'red', // 矩形边框颜色
monolock: false, // 单锁显示
block: false // 封锁显示
},
coverBlock: { // 道岔封锁 遮盖物
show: true, // 显示
coverBlockColor: '#000080'// 遮挡物颜色
}
};

View File

@ -173,7 +173,7 @@ export default class Section extends Group {
/** 封锁 06*/
block() {
if (this.sectionBlock) {
this.sectionBlock.show();
this.model.type !== '03' && this.sectionBlock.show();
} else {
this.line && this.line.setStyle({
stroke: this.style.Section.line.blockColor,
@ -302,9 +302,9 @@ export default class Section extends Group {
model.overlapLock && this.protectiveLock(model.lockRight);
/** 空闲锁闭或者叫进路锁闭 */
model.routeLock && this.routeLock(model.lockRight);
/** 轨道封锁 */
model.invalid && this.invalid();
/** 计轴故障 */
model.invalid && this.invalid();
/** 轨道封锁 */
model.blockade && this.block();
/** 非通信车占用状态 */
model.nctOccupied && this.unCommunicationOccupied();

View File

@ -0,0 +1,68 @@
import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
class ESwBlock extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.blockCover = new Polyline({ // 道岔锁闭遮盖物
zlevel: model.zlevel,
z: model.z + 4,
z2: 2,
shape: {
points: model.coverPoints
},
style: {
lineWidth: style.Section.line.width,
stroke: '#fff'// style.backgroundColor
},
cursor: model.cursor,
onmouseover: model.onmouseover,
onmouseout: model.onmouseout
});
this.hide();
this.add(this.blockCover);
}
hide() {
this.blockCover.hide();
this.blockCover.setStyle({ stroke: this.model.style.backgroundColor });
this.stopAnimation(false);
}
show() {
this.blockCover.show();
}
setColor(color) {
this.blockCover.setStyle({ stroke: color });
}
setStyle(data) {
this.blockCover.setStyle(data);
}
stopAnimation(flag) {
this.blockCover.stopAnimation(flag);
}
getSection() {
return this.blockCover;
}
animateStyle(color1, color2) {
this.blockCover.animateStyle(true)
.when(0, {stroke: color1})
.when(500, {stroke: color2})
.when(1000, {stroke: color1}).start();
}
}
export default ESwBlock;

View File

@ -14,6 +14,7 @@ class ESwLnversion extends Group {
this.relocShelter = new Polyline({ // 遮盖B区段范围
zlevel: model.zlevel,
z: model.z + 4,
z2: 1,
shape: {
points: model.shelterPoints
},

View File

@ -7,6 +7,7 @@ import ESwLocal from './ESwLocal.js';
import ESwLnversion from './ESwLnversion';
import ELockRect from './ELockRect';
import ELockArc from './ELockArc';
import ESwBlock from './ESwBlock';
import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ETriangle from './ETriangle';
@ -134,7 +135,18 @@ export default class Switch extends Group {
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
const coverPoint1 = [sectionAPoint.x - 2 * directxA * (relocShelterLength * sectionBTriangle.getCosRate()), sectionAPoint.y - drictyyA * relocShelterLength * sectionBTriangle.getSinRate()];
const coverPoint2 = [sectionAPoint.x, sectionAPoint.y];
this.shapeBlockCover = new ESwBlock({
zlevel: this.zlevel,
z: this.z,
style: style,
coverPoints: [coverPoint1, coverPoint2],
cursor: 'pointer',
triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); },
onmouseout: () => { this.name.getArrowText().hide(); }
});
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();
@ -173,6 +185,7 @@ export default class Switch extends Group {
this.add(this.shapeModelA);
this.add(this.shapeModelB);
this.add(this.shapeModelC);
this.add(this.shapeBlockCover);
this.add(this.name);
this.add(this.enabledName);
style.Switch.text.show && model.nameShow ? this.name.show() : this.name.hide();
@ -262,6 +275,7 @@ export default class Switch extends Group {
this.shapeModelC.hide(); // 形状 C
this.shapeModelA.hide(); // 形状 A
this.shapeModelB.hide(); // 形状 B
this.shapeBlockCover.hide(); // 封锁覆盖
this.setHasTextBorder(0);
this.shapeModelC.attr({
z: this.z + 3
@ -469,6 +483,10 @@ export default class Switch extends Group {
this.lockRect.setStyle({ stroke: this.style.Switch.rectLock.blockColor, fill: this.style.Switch.rectLock.blockFillColor });
}
}
if (this.style.Switch.coverBlock && this.style.Switch.coverBlock.show) {
this.shapeBlockCover.show();
this.shapeBlockCover.setColor(this.style.Switch.coverBlock.coverBlockColor);
}
}
blockMonolock() {
if (this.style.Switch.rectLock.block && this.style.Switch.rectLock.monolock) {

View File

@ -255,13 +255,6 @@ export default {
this.classB = this.tempClassB;
}
},
'$store.state.training.prdType': function (val) {
if (val == '01' && this.centralizedStationList1.length) {
this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationList1[0].code);
} else {
this.$store.dispatch('map/setShowCentralizedStationCode', '');
}
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.stationCode = code;
@ -358,16 +351,12 @@ export default {
});
this.colsNum = 24 / this.centralizedStationList1.length;
if (centralizedStationList.length) {
if (this.$store.state.training.centerStationCode) {
this.stationCode = this.$store.state.training.centerStationCode;
if (this.$store.state.map.showCentralizedStationCode) {
this.stationCode = this.$store.state.map.showCentralizedStationCode;
} else {
this.stationCode = centralizedStationList[0].code;
}
}
if (this.$store.state.training.prdType == '01') {
this.$store.dispatch('map/setShowCentralizedStationCode', this.stationCode);
}
},
switchShowStation(stationCode) {
this.stationCode = stationCode;

View File

@ -253,13 +253,6 @@ export default {
this.classB = this.tempClassB;
}
},
'$store.state.training.prdType': function (val) {
if (val == '01' && this.centralizedStationList1.length) {
this.$store.dispatch('map/setShowCentralizedStationCode', this.centralizedStationList1[0].code);
} else {
this.$store.dispatch('map/setShowCentralizedStationCode', '');
}
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.stationCode = code;
@ -356,16 +349,12 @@ export default {
});
this.colsNum = 24 / this.centralizedStationList1.length;
if (centralizedStationList.length) {
if (this.$store.state.training.centerStationCode) {
this.stationCode = this.$store.state.training.centerStationCode;
if (this.$store.state.map.showCentralizedStationCode) {
this.stationCode = this.$store.state.map.showCentralizedStationCode;
} else {
this.stationCode = centralizedStationList[0].code;
}
}
if (this.$store.state.training.prdType == '01') {
this.$store.dispatch('map/setShowCentralizedStationCode', this.stationCode);
}
},
switchShowStation(stationCode) {
this.stationCode = stationCode;