站台调整

This commit is contained in:
fan 2020-03-26 15:04:52 +08:00
parent 8a90e2389b
commit ead5bd01e6
10 changed files with 117 additions and 266 deletions

View File

@ -120,6 +120,13 @@ export default class defaultStyle {
stroke: '#FFFFFF', stroke: '#FFFFFF',
fill: '#00FFFF' fill: '#00FFFF'
}; };
/** 常规字体样式 */
this.textStyle = {
textAlign: 'center', // 文字居中
textVerticalAlign: 'middle', // 文字垂直对齐方式
textPosition: 'inside', // 文字位置
fontWeight: 'normal' // 字体粗细
};
} }
} }
export const drawSectionStyle = { export const drawSectionStyle = {

View File

@ -281,12 +281,13 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
position: 1, // 扣车方向
offset: { x: -8, y: 13 }, // 扣车偏移量 offset: { x: -8, y: 13 }, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色 trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: '#FFFFFF', // 中心扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
headFontSize: 8,
fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向 position: 1, // 运行时间方向

View File

@ -230,12 +230,13 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
position: -1, // 扣车方向
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: 'yellow', // 车站扣车颜色 trainColor: 'yellow', // 车站扣车颜色
centerTrainColor: 'white', // 中心扣车颜色 centerTrainColor: 'white', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 10,
fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向 position: 1, // 运行时间方向
@ -244,12 +245,13 @@ class SkinCode extends defaultStyle {
}, },
jump: { jump: {
text: '跳', // 停跳显示内容 text: '跳', // 停跳显示内容
position: -1, // 停跳方向 offset: {x: -8, y: 10},
offset: {x: -8, y: 0}, textColor: '#00ffcc', // 停跳文字颜色
textColor: '#0000FF', // 停跳文字颜色 arcColor: '#00ffcc', // 停跳圆圈颜色
arcColor: '#0000FF', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色 fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小 r: 8, // 圆半径大小
fontWeight: 'normal', // 文字居中
textFontSize: 11 // 圆半径大小
}, },
level: { // 运行等级 level: { // 运行等级
position: 1, // 运行等级方向 position: 1, // 运行等级方向

View File

@ -236,12 +236,13 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: '扣', // 扣车显示内容 text: '扣', // 扣车显示内容
position: -1, // 扣车方向
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: '#FFFF00', // 车站扣车颜色 trainColor: '#FFFF00', // 车站扣车颜色
centerTrainColor: '#C0C0C0', // 中心扣车颜色 centerTrainColor: '#C0C0C0', // 中心扣车颜色
andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色 andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 10,
fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向 position: 1, // 运行时间方向
@ -251,12 +252,13 @@ class SkinCode extends defaultStyle {
}, },
jump: { jump: {
text: '跳', // 停跳显示内容 text: '跳', // 停跳显示内容
position: -1, // 停跳方向
offset: {x: -8, y: 10}, offset: {x: -8, y: 10},
textColor: '#00ffcc', // 停跳文字颜色 textColor: '#00ffcc', // 停跳文字颜色
arcColor: '#00ffcc', // 停跳圆圈颜色 arcColor: '#00ffcc', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色 fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小 r: 8, // 圆半径大小
fontWeight: 'normal',
textFontSize: 11
}, },
level: { // 运行等级 level: { // 运行等级
position: 1, // 运行等级方向 position: 1, // 运行等级方向

View File

@ -226,12 +226,13 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
position: -1, // 扣车方向
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色 trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: '#FFFFFF', // 中心扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 11,
fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向 position: 1, // 运行时间方向
@ -241,12 +242,13 @@ class SkinCode extends defaultStyle {
}, },
jump: { jump: {
text: 'S', // 停跳显示内容 text: 'S', // 停跳显示内容
position: -1, // 停跳方向 offset: {x: -8, y: -5},
offset: {x: -8, y: 10},
textColor: '#5376B3', // 停跳文字颜色 textColor: '#5376B3', // 停跳文字颜色
arcColor: '#000000', // 停跳圆圈颜色 arcColor: '#000000', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色 fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小 r: 8, // 圆半径大小
fontWeight: 'normal', // 文字居中
textFontSize: 11
}, },
level: { // 运行等级 level: { // 运行等级
position: 1, // 运行等级方向 position: 1, // 运行等级方向

View File

@ -231,24 +231,21 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
fontSize: 18, // 扣车字体大小 fontSize: 18, // 扣车字体大小
position: -1, // 扣车方向 offset: { x: 60, y: -20 }, // 扣车偏移量
offset: { x: -8, y: -6 }, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色 trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: 'red', // 中心扣车颜色 centerTrainColor: '#F61107', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontWeight: 'bold'
}, },
jump: { jump: {
text: '跳', // 停跳显示内容 text: 'S', // 停跳显示内容
position: -1, // 停跳方向 offset: { x: 10, y: 20 },
offset: { x: -8, y: 0 }, textColor: '#00FF00', // 停跳文字颜色
textColor: '#0000FF', // 停跳文字颜色 fontWeight: 'bold',
arcColor: '#0000FF', // 停跳圆圈颜色 fontSize: 18
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: { x: -8, y: 26 }, // 运行时间偏移量 offset: { x: -8, y: 26 }, // 运行时间偏移量
textColor: '#FFFFFF' // 停站时间字体颜色 textColor: '#FFFFFF' // 停站时间字体颜色
}, },

View File

@ -274,27 +274,20 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
position: 1, // 扣车方向
offset: { x: -8, y: 0 }, // 扣车偏移量 offset: { x: -8, y: 0 }, // 扣车偏移量
trainColor: 'yellow', // 车站扣车颜色 trainColor: 'yellow', // 车站扣车颜色
centerTrainColor: 'white', // 中心扣车颜色 centerTrainColor: 'white', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 10,
fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向 position: 1, // 运行时间方向
offset: { x: -8, y: -4 }, // 运行时间偏移量 offset: { x: -8, y: -4 }, // 运行时间偏移量
textColor: 'white' // 停站时间字体颜色 textColor: 'white' // 停站时间字体颜色
}, },
jump: { jump: {},
text: '跳', // 停跳显示内容
position: -1, // 停跳方向
offset: { x: -8, y: 0 },
textColor: '#0000FF', // 停跳文字颜色
arcColor: '#0000FF', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8 // 圆半径大小
},
level: { // 运行等级 level: { // 运行等级
position: -1, // 运行等级方向 position: -1, // 运行等级方向
offset: { x: -8, y: 4 }, // 运行等级偏移量 offset: { x: -8, y: 4 }, // 运行等级偏移量

View File

@ -5,61 +5,13 @@ class EDetain extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false;
this.detain = null; this.detain = null;
// if (this.model.style.StationStand.common.special) {
this.create(); this.create();
// }
} }
create(textName) { create() {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
if (style.StationStand.common.special) {
// inside true 内侧
const gag = 22;
const gagX = 6; // 左右间隔
let height = '';
let position = '';
if (model.right) {
if (model.inside) {
height = -gag;
position = -model.width / 4 - gagX;
} else {
height = gag;
position = model.width / 4 + gagX;
}
} else {
if (model.inside) {
height = gag;
position = model.width / 4 + gagX;
} else {
height = -gag;
position = -model.width / 4 - gagX;
}
}
this.detain = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x + position,
y: model.y + height,
text: textName,
// textAlign: model.inside ? 'left' : 'right',
textAlign: 'center',
fontWeight: 'blod',
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
textFill: textName == 'E' ? '#fff' : 'red',
textVerticalAlign: 'middle'
}
});
this.add(this.detain);
} else {
this.detain = new Text({ this.detain = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -68,35 +20,25 @@ class EDetain extends Group {
x: model.x, x: model.x,
y: model.y, y: model.y,
text: style.StationStand.detainCar.text, text: style.StationStand.detainCar.text,
textAlign: model.textAlign, fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
textVerticalAlign: model.textVerticalAlign,
fontSize: `${style.StationStand.stand.headFontSize} px ${style.fontFamily}`,
textFill: style.StationStand.detainCar.centerTrainColor, textFill: style.StationStand.detainCar.centerTrainColor,
textStroke: style.backgroundColor textStroke: style.backgroundColor,
textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign
} }
}); });
this.add(this.detain); this.add(this.detain);
} }
}
}
setColor(color) { setColor(color) {
this.create();
this.detain.setStyle('textFill', color); this.detain.setStyle('textFill', color);
} }
hide() { hide() {
this.create();
this.detain.hide(); this.detain.hide();
} }
show(nameText) { show() {
if (this.model.style.StationStand.common.special && nameText) {
this.create();
this.detain.setStyle('text', nameText);
} else {
this.create();
}
this.detain.show(); this.detain.show();
} }
} }

View File

@ -6,72 +6,28 @@ class EJump extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false;
this.create(); this.create();
this.setStatus(model.allSkip, model.assignSkip);
} }
create() {
create(textName) {
if (!this.isNew) {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.isNew = true;
if (style.StationStand.common.special) {
// inside true 内侧
const gag = 22;
const gagX = 6; // 左右间隔
let height = '';
let position = '';
if (model.right) {
if (model.inside) {
height = -gag;
position = -model.width / 4 - gagX;
} else {
height = gag;
position = model.width / 4 + gagX;
}
} else {
if (model.inside) {
height = gag;
position = model.width / 4 + gagX;
} else {
height = -gag;
position = -model.width / 4 - gagX;
}
}
this.jump = new Text({
zlevel: model.zlevel,
z: model.z,
position: [0, 0],
style: {
x: model.x + position,
y: model.y + height,
text: textName,
textAlign: 'center',
fontWeight: 'blod',
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
textFill: textName == 'S' ? 'green' : '#fff',
textVerticalAlign: 'middle'
}
});
this.add(this.jump);
} else {
this.jump = new Text({ this.jump = new Text({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
style: { style: {
x: model.x, x: model.x,
y: model.y, y: model.y,
fontWeight: 'normal', fontWeight: style.StationStand.jump.fontWeight,
fontSize: style.StationStand.common.textFontSize, fontSize: style.StationStand.jump.fontSize,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: style.StationStand.jump.text, text: style.StationStand.jump.text,
textFill: style.StationStand.jump.textColor, textFill: style.StationStand.jump.textColor,
textAlign: model.textAlign, textAlign: style.textStyle.textAlign,
textVerticalAlign: model.textVerticalAlign textVerticalAlign: style.textStyle.textVerticalAlign
} }
}); });
this.add(this.jump);
if (style.StationStand.jump.r) {
this.jumpArc = new Arc({ this.jumpArc = new Arc({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
@ -86,44 +42,26 @@ class EJump extends Group {
} }
}); });
this.add(this.jumpArc); this.add(this.jumpArc);
this.add(this.jump);
this.jumpArc.hide(); this.jumpArc.hide();
} }
} }
}
setName(val) {
this.create();
this.jump.setStyle('text', val);
}
setStatus(allSkip, assignSkip) {
if (this.jumpArc) {
this.jumpArc.hide();
if (assignSkip) {
this.jumpArc.hide(); // 指定站台跳停
} else if (allSkip) {
this.jumpArc.show(); // 站台全部跳停
}
}
}
setColor(color) { setColor(color) {
this.create();
this.jump.setStyle('textFill', color); this.jump.setStyle('textFill', color);
} }
hide() { hide() {
this.create();
this.jump.hide(); this.jump.hide();
this.jumpArc && this.jumpArc.hide();
} }
show(nameText) { show(isAllJump) {
if (this.model.style.StationStand.common.special && nameText) { if (isAllJump) { // 站台跳停
this.create();
this.jump.setStyle('text', nameText);
} else {
this.create();
}
this.jump.show(); this.jump.show();
this.jumpArc && this.jumpArc.show();
} else { // 指定列车跳停
this.jump.show();
}
} }
} }

View File

@ -135,12 +135,8 @@ class StationStand extends Group {
/** 站台扣车*/ /** 站台扣车*/
const detainD = model.right ? 1 : -1; const detainD = model.right ? 1 : -1;
let detainX = model.position.x - (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.x - model.width / 2); const detainX = model.position.x - (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.x - model.width / 2);
let detainY = model.position.y + (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.y - model.height / 2); const detainY = model.position.y + (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.y - model.height / 2);
if (style.StationStand.common.special) {
detainX = model.position.x;
detainY = model.position.y;
}
this.detain = new EDetain({ this.detain = new EDetain({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -149,9 +145,7 @@ class StationStand extends Group {
y: detainY, y: detainY,
width: model.width, width: model.width,
inside: model.inside, inside: model.inside,
right: model.right, right: model.right
textAlign: 'middle',
textVerticalAlign: 'top'
}); });
this.add(this.detain); this.add(this.detain);
@ -186,14 +180,10 @@ class StationStand extends Group {
/** 列车停跳 */ /** 列车停跳 */
if (style.StationStand.common.haveJumpShow) { if (style.StationStand.common.haveJumpShow) {
const jumpDirct = model.right ? -1 : 1; const jumpDirct = model.right ? -1 : 1;
let jumpX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2); const jumpX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2);
let jumpY = model.position.y + jumpDirct * style.StationStand.jump.offset.y; const jumpY = model.position.y + jumpDirct * style.StationStand.jump.offset.y;
const jumpCX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2); const jumpCX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2);
const jumpCY = model.position.y + jumpDirct * style.StationStand.jump.offset.y; const jumpCY = model.position.y + jumpDirct * style.StationStand.jump.offset.y;
if (style.StationStand.common.special) {
jumpX = model.position.x;
jumpY = model.position.y;
}
this.jump = new EJump({ this.jump = new EJump({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z + 1, z: this.z + 1,
@ -204,11 +194,7 @@ class StationStand extends Group {
cy: jumpCY, cy: jumpCY,
width: model.width, width: model.width,
inside: model.inside, inside: model.inside,
right: model.right, right: model.right
textAlign: 'center',
textVerticalAlign: 'middle',
allSkip: model.allSkip,
assignSkip: model.assignSkip
}); });
this.add(this.jump); this.add(this.jump);
} }
@ -222,7 +208,7 @@ class StationStand extends Group {
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
} }
} }
createFunctionButton() { // createFunctionButton() {
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (model.stopJumpLamp) { if (model.stopJumpLamp) {
@ -364,7 +350,6 @@ class StationStand extends Group {
this.trainDepart && this.trainDepart.hide(); this.trainDepart && this.trainDepart.hide();
this.reentry && this.reentry.hide(); this.reentry && this.reentry.hide();
this.jump && this.jump.hide(); this.jump && this.jump.hide();
this.jump && this.jump.setStatus(0, 0);
} }
/** 空闲*/ /** 空闲*/
@ -406,31 +391,13 @@ class StationStand extends Group {
/** 指定列车跳站*/ /** 指定列车跳站*/
designatedJumpStop() { designatedJumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor); this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
if (this.style.StationStand.common.special) { this.jump && this.jump.show(0);
this.jump && this.jump.show('S');
this.jump && this.jump.setColor('green');
} else {
this.jump && this.jump.show();
}
this.jump && this.jump.setStatus(0, 1);
}
/** 未设置跳停*/
unJumpStop() {
this.jump && this.jump.hide();
this.jump && this.jump.setStatus(0, 0);
} }
/** 站台跳停*/ /** 站台跳停*/
jumpStop() { jumpStop() {
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor); this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
if (this.style.StationStand.common.special) { this.jump && this.jump.show(1);
this.jump && this.jump.show('S');
this.jump && this.jump.setColor('green');
} else {
this.jump && this.jump.show();
}
this.jump && this.jump.setStatus(1, 0);
} }
/** 车站扣车*/ /** 车站扣车*/