大铁项目 股道停稳代码调整

This commit is contained in:
joylink_cuiweidong 2022-08-11 16:29:57 +08:00
parent 86d1268744
commit 75eca3b417
4 changed files with 80 additions and 0 deletions

View File

@ -164,6 +164,10 @@ class SkinCode extends defaultStyle {
}, },
trainPosition:{ trainPosition:{
display: false // 列车实时位置显示 display: false // 列车实时位置显示
},
remainTime:{
circleBack:'',
textColor:''
} }
}; };

View File

@ -24,6 +24,7 @@ class Status {
assignSkip: device.assignSkip, // 是否指定跳停 assignSkip: device.assignSkip, // 是否指定跳停
runLevelTime: device.runLevelTime, // 区间运行时间 自动为 0 runLevelTime: device.runLevelTime, // 区间运行时间 自动为 0
parkingTime: device.parkingTime, // 站台停车时间 自动为0 parkingTime: device.parkingTime, // 站台停车时间 自动为0
remainTime:device.remainTime, // 当前剩余停站时间
fault: device.fault, /** 非故障*/ fault: device.fault, /** 非故障*/
num:device.num num:device.num
}; };
@ -95,6 +96,7 @@ class Status {
offsetp:device.offsetp, /** 列车精确位置 (成都一号线使用)*/ offsetp:device.offsetp, /** 列车精确位置 (成都一号线使用)*/
physicalCode:device.physicalCode, /** 列车所在物理区段 */ physicalCode:device.physicalCode, /** 列车所在物理区段 */
num:device.num /** 列车上的人数*/ num:device.num /** 列车上的人数*/
// parkingRemainTime
}; };
} }
handleStation(device) { handleStation(device) {

View File

@ -1,4 +1,6 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Arc from 'zrender/src/graphic/shape/Arc';
import ETextName from './ETextName'; // 名称文字 import ETextName from './ETextName'; // 名称文字
import ELimitLines from './ELimitLines'; // 区段限速 (私有) import ELimitLines from './ELimitLines'; // 区段限速 (私有)
import ELines from './ELines'; // 创建多线条 曲线 (私有) import ELines from './ELines'; // 创建多线条 曲线 (私有)
@ -132,6 +134,50 @@ export default class Section extends Group {
}); });
this.add(this[element]); this.add(this[element]);
}); });
if (this.style.Section.remainTime && (this.model.standTrack || this.model.reentryTrack || this.model.transferTrack)) {
const computedPoints = this.computedPoints;
const drict = model.trainPosType != '01' ? 1 : -1;
const x = Math.min(computedPoints[0].x, computedPoints[computedPoints.length - 1].x) + Math.abs(computedPoints[computedPoints.length - 1].x - computedPoints[0].x) / 2;
const y = Math.min(computedPoints[0].y, computedPoints[computedPoints.length - 1].y) + Math.abs(computedPoints[computedPoints.length - 1].y - computedPoints[0].y) / 2;
this.remainTimeText = new Text({
_subType: 'remainTimeText',
zlevel: this.zlevel,
z: this.z,
silent: model.silent || false,
style: {
x: x,
y: y - 23 * drict,
fontWeight: 'normal',
fontSize: 13,
fontFamily:style.fontFamily,
text: '0',
textFill:'#ff0000',
textAlign: 'center', // 水平对齐方式
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式
}
});
this.remainTimeCircle = new Arc({
_subType: 'remainTimeCircle',
zlevel: this.zlevel,
z: this.z,
shape: {
cx: x - 18,
cy: y - 23 * drict,
r: 6
},
style: {
lineWidth: 1,
fill: style.backgroundColor,
stroke: '#ffffff'
}
});
this.add(this.remainTimeText);
this.add(this.remainTimeCircle);
this.remainTimeText.hide();
this.remainTimeCircle.hide();
}
} }
} }
@ -167,6 +213,8 @@ export default class Section extends Group {
this.speedLimitName && this.speedLimitName.hide(); this.speedLimitName && this.speedLimitName.hide();
this.separator && this.separator.show(); this.separator && this.separator.show();
this.badShunt && this.badShunt.hide(); this.badShunt && this.badShunt.hide();
// this.remainTimeText && this.remainTimeText.hide();
// this.remainTimeCircle && this.remainTimeCircle.hide();
this.axle && this.axle.setStyle({ this.axle && this.axle.setStyle({
stroke: this.style.Section.line.spareColor, stroke: this.style.Section.line.spareColor,
@ -655,4 +703,22 @@ export default class Section extends Group {
y:rect.y y:rect.y
}; };
} }
showRemainTime(remainTime) {
this.remainTimeText.show();
this.remainTimeCircle.show();
this.remainTimeCircle && this.remainTimeCircle.animateStyle(true)
.when(0, { fill:this.style.backgroundColor })
.when(1000, { fill: '#ffffff' })
.when(2000, { fill:this.style.backgroundColor })
.start();
this.remainTimeText.setStyle('text', remainTime);
}
hideRemainTime() {
this.remainTimeText.hide();
this.remainTimeCircle && this.remainTimeCircle.stopAnimation(true);
this.remainTimeCircle && this.remainTimeCircle.hide();
}
} }

View File

@ -189,6 +189,14 @@ class StationStand extends Group {
this.upDetainLamp && this.upDetainLamp.show(); this.upDetainLamp && this.upDetainLamp.show();
this.downDetainLamp && this.downDetainLamp.show(); this.downDetainLamp && this.downDetainLamp.show();
} }
if (this.style.Section.remainTime) {
const section = this.mapDevice[model.standTrackCode];
if (model.remainTime) {
section.instance && section.instance.showRemainTime(model.remainTime);
} else {
section.instance && section.instance.hideRemainTime();
}
}
} }
} }