This commit is contained in:
ival 2019-08-02 18:05:17 +08:00
commit ad6e98da39
5 changed files with 106 additions and 24 deletions

View File

@ -313,6 +313,7 @@ class SkinStyle extends defaultStyle {
fontWeight: 'normal', fontWeight: 'normal',
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top', textVerticalAlign: 'top',
textColor: '#000000',
arcColor: '#00FFFF' arcColor: '#00FFFF'
} }
}; };

View File

@ -120,20 +120,21 @@ class SkinStyle extends defaultStyle {
this[deviceType.StationStand] = { this[deviceType.StationStand] = {
common: { // 通用属性 common: { // 通用属性
textFontSize: 10 // 站台默认字体大小 textFontSize: 10, // 站台默认字体大小
haveJumpShow: true // 站台是否有列车停跳显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
distance: 8, // 站台和屏蔽门之间的距离 distance: 8, // 站台和屏蔽门之间的距离
defaultColor: '#00FF00', // 屏蔽门默认颜色 defaultColor: '#00FF00', // 屏蔽门默认颜色
splitDoorColor: '#F61107' // 屏蔽门切除颜色 splitDoorColor: '#C00808' // 屏蔽门切除颜色
}, },
stand: { // 站台 stand: { // 站台
headFontSize: 10, // 站台首端字体大小 headFontSize: 10, // 站台首端字体大小
spareColor: '#606060', // 站台空闲颜色 spareColor: '#808080', // 站台空闲颜色
stopColor: '#FEFE00', // 站台列车停站颜色 stopColor: '#FFF000', // 站台列车停站颜色
jumpStopColor: '#9A99FF', // 站台跳停颜色 jumpStopColor: '#808080', // 站台跳停颜色
designatedJumpStopColor: 'lightSkyBlue' // 站台指定列车跳停颜色 designatedJumpStopColor: '#808080' // 站台指定列车跳停颜色
}, },
standEmergent: { // 紧急关闭 standEmergent: { // 紧急关闭
mergentR: 4, // 站台紧急关闭半径 mergentR: 4, // 站台紧急关闭半径
@ -149,21 +150,30 @@ class SkinStyle extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: '扣', // 扣车显示内容 text: '扣', // 扣车显示内容
direction: -1, // 扣车方向 direction: -1, // 扣车方向
offset: {x: -8, y: -6}, // 扣车偏移量 offset: {x: -8, y: -20}, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色 trainColor: '#FFFF00', // 车站扣车颜色
centerTrainColor: '#FFFFFF', // 中心扣车颜色 centerTrainColor: '#C0C0C0', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
direction: 1, // 运行时间方向 direction: 1, // 运行时间方向
offset: {x: -8, y: 26}, // 运行时间偏移量 offset: {x: -8, y: -4}, // 运行时间偏移量
textColor: '#FFFFFF' // 停站时间字体颜色 textColor: '#C0C0C0' // 停站时间字体颜色
},
jump: {
text: '跳', // 停跳显示内容
direction: -1, // 停跳方向
offset: {x: -8, y: 0},
textColor: '#0000FF', // 停跳文字颜色
arcColor: '#0000FF', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小
}, },
level: { // 运行等级 level: { // 运行等级
direction: 1, // 运行等级方向 direction: 1, // 运行等级方向
offset: {x: -8, y: 6}, // 运行等级偏移量 offset: {x: -8, y: 30}, // 运行等级偏移量
textColor: '#FFFFFF' // 停站等级字体颜色 textColor: '#FFF000' // 停站等级字体颜色
} }
}; };
@ -178,7 +188,7 @@ class SkinStyle extends defaultStyle {
textVerticalAlign: 'top' // 字体垂直对齐 textVerticalAlign: 'top' // 字体垂直对齐
}, },
lamp: { lamp: {
count: 2, // 控制模式的个数 count: 4, // 控制模式的个数
offset: {x: 0, y: 0}, // 偏移量 offset: {x: 0, y: 0}, // 偏移量
radiusR: 4, // 控制模式灯的半径 radiusR: 4, // 控制模式灯的半径
distance: 36, // 控制模式之间灯之间的距离 distance: 36, // 控制模式之间灯之间的距离

View File

@ -63,7 +63,18 @@ export default class StationControl extends Group {
context: model.zakContent, context: model.zakContent,
pop: false pop: false
}); });
this.turnedAroundControl = new ESingleControl({
_subType: 'turnedAround',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.lamp.distance * 3 / 2 + this.style.StationControl.lamp.offset.x,
y: model.position.y + this.style.StationControl.lamp.offset.y
},
context: '按图折返',
pop: false
});
// 箭头 // 箭头
if (this.style.StationControl.arrow.show) { if (this.style.StationControl.arrow.show) {
const point = arrows(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8); const point = arrows(this.model.position.x, this.model.position.y + this.style.StationControl.lamp.radiusR / 2, this.style.StationControl.lamp.distance / 6, this.style.StationControl.lamp.radiusR * 0.8);
@ -82,11 +93,13 @@ export default class StationControl extends Group {
}); });
this.add(this.arrowsControl); this.add(this.arrowsControl);
} }
this.add(this.substationControl); this.add(this.substationControl);
this.add(this.centerControl); this.add(this.centerControl);
if (this.style.StationControl.lamp.count == 3) { if (this.style.StationControl.lamp.count == 3) {
this.add(this.emergencyControl); this.add(this.emergencyControl);
} else if (this.style.StationControl.lamp.count == 4) {
this.add(this.emergencyControl);
this.add(this.turnedAroundControl);
} }
} }

View File

@ -1,11 +1,14 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Arc from 'zrender/src/graphic/shape/Arc';
class EJump extends Group { class EJump extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.isNew = false;
this.create();
this.setStatus(model.jumpStopStatus);
} }
create() { create() {
@ -23,13 +26,28 @@ class EJump extends Group {
fontWeight: 'normal', fontWeight: 'normal',
fontSize: style.StationStand.common.textFontSize, fontSize: style.StationStand.common.textFontSize,
fontFamily: style.textFontFormat, fontFamily: style.textFontFormat,
text: model.name, text: style.StationStand.jump.text,
textFill: style.StationStand.level.textColor, textFill: style.StationStand.jump.textColor,
textAlign: 'middle' textAlign: model.textAlign,
textVerticalAlign: model.textVerticalAlign
} }
}); });
this.jumpArc = new Arc({
zlevel: model.zlevel,
z: model.z,
shape: {
cx: model.cx,
cy: model.cy,
r: style.StationStand.jump.r
},
style: {
stroke: style.StationStand.jump.arcColor,
fill: style.StationStand.jump.fillColor
}
});
this.add(this.jumpArc);
this.add(this.jump); this.add(this.jump);
this.jumpArc.hide();
} }
} }
@ -37,7 +55,19 @@ class EJump extends Group {
this.create(); this.create();
this.jump.setStyle('text', val); this.jump.setStyle('text', val);
} }
setStatus(val) {
switch (val) {
case '03':
this.jumpArc.show();
break;
case '02':
this.jumpArc.hide();
break;
case '01':
this.jumpArc.hide();
break;
}
}
setColor(color) { setColor(color) {
this.create(); this.create();
this.jump.setStyle('textFill', color); this.jump.setStyle('textFill', color);

View File

@ -8,6 +8,7 @@ import ESafeDoor from './ESafeDoor';
import ESafeStand from './ESafeStand'; import ESafeStand from './ESafeStand';
import ESafeEmergent from './ESafeEmergent'; import ESafeEmergent from './ESafeEmergent';
import EMouse from './EMouse'; import EMouse from './EMouse';
import EJump from './EJump';
class StationStand extends Group { class StationStand extends Group {
constructor(model, style) { constructor(model, style) {
@ -115,7 +116,6 @@ class StationStand extends Group {
y: timeY, y: timeY,
name: model.parkingTime || '30' name: model.parkingTime || '30'
}); });
/** 运行等级*/ /** 运行等级*/
const levelD = style.StationStand.level.direction ? model.height - distance: -style.StationStand.safetyDoor.height; const levelD = style.StationStand.level.direction ? model.height - distance: -style.StationStand.safetyDoor.height;
const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD; const levelH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + levelD;
@ -129,7 +129,28 @@ class StationStand extends Group {
y: levelY, y: levelY,
name: model.intervalRunTime || '5' name: model.intervalRunTime || '5'
}); });
/** 列车停跳 */
if (style.StationStand.common.haveJumpShow) {
const jumpD = style.StationStand.jump.direction ? model.height - distance: -style.StationStand.safetyDoor.height;
const jumpH = drict > 0 ? style.StationStand.standEmergent.mergentR : style.StationStand.standEmergent.mergentR + style.StationStand.safetyDoor.distance + jumpD;
const jumpX = model.position.x - (style.StationStand.jump.direction || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpY = model.position.y + (style.StationStand.jump.direction || drict) * (style.StationStand.jump.offset.y) + drict * jumpH;
const jumpCX = model.position.x - (style.StationStand.jump.direction || drict) * (style.StationStand.jump.offset.x - model.width / 2);
const jumpCY = model.position.y + (style.StationStand.jump.direction || drict) * (style.StationStand.jump.offset.y - style.StationStand.common.textFontSize / 2) + drict * jumpH;
this.jump = new EJump({
zlevel: this.zlevel,
z: this.z + 1,
style: style,
x: jumpX,
y: jumpY,
cx: jumpCX,
cy: jumpCY,
textAlign: 'middle',
textVerticalAlign: 'top',
jumpStopStatus: model.jumpStopStatus
});
this.add(this.jump);
}
this.add(this.safeDoor); this.add(this.safeDoor);
this.add(this.safeStand); this.add(this.safeStand);
this.add(this.emergent); this.add(this.emergent);
@ -167,6 +188,7 @@ class StationStand extends Group {
this.detain.hide(); this.detain.hide();
this.reentry.hide(); this.reentry.hide();
this.emergent.hide(); this.emergent.hide();
this.jump && this.jump.hide();
if (this.model.visible) { this.safeDoor.hasDoor(false); } if (this.model.visible) { this.safeDoor.hasDoor(false); }
this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor); this.safeDoor.setColor(this.style.StationStand.safetyDoor.defaultColor);
} }
@ -184,6 +206,8 @@ class StationStand extends Group {
/** 指定列车跳站*/ /** 指定列车跳站*/
designatedJumpStop() { designatedJumpStop() {
this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor); this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
} }
/** 站台紧急关闭*/ /** 站台紧急关闭*/
@ -194,11 +218,15 @@ class StationStand extends Group {
/** 未设置跳停*/ /** 未设置跳停*/
unJumpStop() { unJumpStop() {
this.jump && this.jump.hide();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
} }
/** 站台跳停*/ /** 站台跳停*/
jumpStop() { jumpStop() {
this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor); this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
this.jump && this.jump.show();
this.jump && this.jump.setStatus(this.model.jumpStopStatus);
} }
/** 未设置扣车*/ /** 未设置扣车*/