站台调整
This commit is contained in:
parent
8a90e2389b
commit
ead5bd01e6
@ -120,6 +120,13 @@ export default class defaultStyle {
|
||||
stroke: '#FFFFFF',
|
||||
fill: '#00FFFF'
|
||||
};
|
||||
/** 常规字体样式 */
|
||||
this.textStyle = {
|
||||
textAlign: 'center', // 文字居中
|
||||
textVerticalAlign: 'middle', // 文字垂直对齐方式
|
||||
textPosition: 'inside', // 文字位置
|
||||
fontWeight: 'normal' // 字体粗细
|
||||
};
|
||||
}
|
||||
}
|
||||
export const drawSectionStyle = {
|
||||
|
@ -281,12 +281,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
detainCar: { // 扣车
|
||||
text: 'H', // 扣车显示内容
|
||||
position: 1, // 扣车方向
|
||||
offset: { x: -8, y: 13 }, // 扣车偏移量
|
||||
trainColor: '#E4EF50', // 车站扣车颜色
|
||||
centerTrainColor: '#FFFFFF', // 中心扣车颜色
|
||||
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
headFontSize: 8,
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
|
@ -230,12 +230,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
detainCar: { // 扣车
|
||||
text: 'H', // 扣车显示内容
|
||||
position: -1, // 扣车方向
|
||||
offset: {x: -8, y: 13}, // 扣车偏移量
|
||||
trainColor: 'yellow', // 车站扣车颜色
|
||||
centerTrainColor: 'white', // 中心扣车颜色
|
||||
andCenterTrainColor: 'red', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontSize: 10,
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
@ -244,12 +245,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
jump: {
|
||||
text: '跳', // 停跳显示内容
|
||||
position: -1, // 停跳方向
|
||||
offset: {x: -8, y: 0},
|
||||
textColor: '#0000FF', // 停跳文字颜色
|
||||
arcColor: '#0000FF', // 停跳圆圈颜色
|
||||
offset: {x: -8, y: 10},
|
||||
textColor: '#00ffcc', // 停跳文字颜色
|
||||
arcColor: '#00ffcc', // 停跳圆圈颜色
|
||||
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
|
||||
r: 8 // 圆半径大小
|
||||
r: 8, // 圆半径大小
|
||||
fontWeight: 'normal', // 文字居中
|
||||
textFontSize: 11 // 圆半径大小
|
||||
},
|
||||
level: { // 运行等级
|
||||
position: 1, // 运行等级方向
|
||||
|
@ -236,12 +236,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
detainCar: { // 扣车
|
||||
text: '扣', // 扣车显示内容
|
||||
position: -1, // 扣车方向
|
||||
offset: {x: -8, y: 13}, // 扣车偏移量
|
||||
trainColor: '#FFFF00', // 车站扣车颜色
|
||||
centerTrainColor: '#C0C0C0', // 中心扣车颜色
|
||||
andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontSize: 10,
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
@ -251,12 +252,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
jump: {
|
||||
text: '跳', // 停跳显示内容
|
||||
position: -1, // 停跳方向
|
||||
offset: {x: -8, y: 10},
|
||||
textColor: '#00ffcc', // 停跳文字颜色
|
||||
arcColor: '#00ffcc', // 停跳圆圈颜色
|
||||
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
|
||||
r: 8 // 圆半径大小
|
||||
r: 8, // 圆半径大小
|
||||
fontWeight: 'normal',
|
||||
textFontSize: 11
|
||||
},
|
||||
level: { // 运行等级
|
||||
position: 1, // 运行等级方向
|
||||
|
@ -226,12 +226,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
detainCar: { // 扣车
|
||||
text: 'H', // 扣车显示内容
|
||||
position: -1, // 扣车方向
|
||||
offset: {x: -8, y: 13}, // 扣车偏移量
|
||||
trainColor: '#E4EF50', // 车站扣车颜色
|
||||
centerTrainColor: '#FFFFFF', // 中心扣车颜色
|
||||
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontSize: 11,
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
@ -241,12 +242,13 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
jump: {
|
||||
text: 'S', // 停跳显示内容
|
||||
position: -1, // 停跳方向
|
||||
offset: {x: -8, y: 10},
|
||||
offset: {x: -8, y: -5},
|
||||
textColor: '#5376B3', // 停跳文字颜色
|
||||
arcColor: '#000000', // 停跳圆圈颜色
|
||||
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
|
||||
r: 8 // 圆半径大小
|
||||
r: 8, // 圆半径大小
|
||||
fontWeight: 'normal', // 文字居中
|
||||
textFontSize: 11
|
||||
},
|
||||
level: { // 运行等级
|
||||
position: 1, // 运行等级方向
|
||||
|
@ -231,24 +231,21 @@ class SkinCode extends defaultStyle {
|
||||
detainCar: { // 扣车
|
||||
text: 'H', // 扣车显示内容
|
||||
fontSize: 18, // 扣车字体大小
|
||||
position: -1, // 扣车方向
|
||||
offset: { x: -8, y: -6 }, // 扣车偏移量
|
||||
offset: { x: 60, y: -20 }, // 扣车偏移量
|
||||
trainColor: '#E4EF50', // 车站扣车颜色
|
||||
centerTrainColor: 'red', // 中心扣车颜色
|
||||
centerTrainColor: '#F61107', // 中心扣车颜色
|
||||
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontWeight: 'bold'
|
||||
},
|
||||
jump: {
|
||||
text: '跳', // 停跳显示内容
|
||||
position: -1, // 停跳方向
|
||||
offset: { x: -8, y: 0 },
|
||||
textColor: '#0000FF', // 停跳文字颜色
|
||||
arcColor: '#0000FF', // 停跳圆圈颜色
|
||||
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
|
||||
r: 8 // 圆半径大小
|
||||
text: 'S', // 停跳显示内容
|
||||
offset: { x: 10, y: 20 },
|
||||
textColor: '#00FF00', // 停跳文字颜色
|
||||
fontWeight: 'bold',
|
||||
fontSize: 18
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
offset: { x: -8, y: 26 }, // 运行时间偏移量
|
||||
textColor: '#FFFFFF' // 停站时间字体颜色
|
||||
},
|
||||
|
@ -274,27 +274,20 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
detainCar: { // 扣车
|
||||
text: 'H', // 扣车显示内容
|
||||
position: 1, // 扣车方向
|
||||
offset: { x: -8, y: 0 }, // 扣车偏移量
|
||||
trainColor: 'yellow', // 车站扣车颜色
|
||||
centerTrainColor: 'white', // 中心扣车颜色
|
||||
andCenterTrainColor: 'red', // 车站+中心扣车颜色
|
||||
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
|
||||
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
|
||||
fontSize: 10,
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
stopTime: { // 停站时间
|
||||
position: 1, // 运行时间方向
|
||||
offset: { x: -8, y: -4 }, // 运行时间偏移量
|
||||
textColor: 'white' // 停站时间字体颜色
|
||||
},
|
||||
jump: {
|
||||
text: '跳', // 停跳显示内容
|
||||
position: -1, // 停跳方向
|
||||
offset: { x: -8, y: 0 },
|
||||
textColor: '#0000FF', // 停跳文字颜色
|
||||
arcColor: '#0000FF', // 停跳圆圈颜色
|
||||
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
|
||||
r: 8 // 圆半径大小
|
||||
},
|
||||
jump: {},
|
||||
level: { // 运行等级
|
||||
position: -1, // 运行等级方向
|
||||
offset: { x: -8, y: 4 }, // 运行等级偏移量
|
||||
|
@ -5,61 +5,13 @@ class EDetain extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.isNew = false;
|
||||
this.detain = null;
|
||||
// if (this.model.style.StationStand.common.special) {
|
||||
this.create();
|
||||
// }
|
||||
}
|
||||
|
||||
create(textName) {
|
||||
if (!this.isNew) {
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
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({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
@ -68,35 +20,25 @@ class EDetain extends Group {
|
||||
x: model.x,
|
||||
y: model.y,
|
||||
text: style.StationStand.detainCar.text,
|
||||
textAlign: model.textAlign,
|
||||
textVerticalAlign: model.textVerticalAlign,
|
||||
fontSize: `${style.StationStand.stand.headFontSize} px ${style.fontFamily}`,
|
||||
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
|
||||
textFill: style.StationStand.detainCar.centerTrainColor,
|
||||
textStroke: style.backgroundColor
|
||||
textStroke: style.backgroundColor,
|
||||
textAlign: style.textStyle.textAlign,
|
||||
textVerticalAlign: style.textStyle.textVerticalAlign
|
||||
}
|
||||
});
|
||||
this.add(this.detain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setColor(color) {
|
||||
this.create();
|
||||
this.detain.setStyle('textFill', color);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.create();
|
||||
this.detain.hide();
|
||||
}
|
||||
|
||||
show(nameText) {
|
||||
if (this.model.style.StationStand.common.special && nameText) {
|
||||
this.create();
|
||||
this.detain.setStyle('text', nameText);
|
||||
} else {
|
||||
this.create();
|
||||
}
|
||||
show() {
|
||||
this.detain.show();
|
||||
}
|
||||
}
|
||||
|
@ -6,72 +6,28 @@ class EJump extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.isNew = false;
|
||||
this.create();
|
||||
this.setStatus(model.allSkip, model.assignSkip);
|
||||
}
|
||||
|
||||
create(textName) {
|
||||
if (!this.isNew) {
|
||||
create() {
|
||||
const model = this.model;
|
||||
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({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
style: {
|
||||
x: model.x,
|
||||
y: model.y,
|
||||
fontWeight: 'normal',
|
||||
fontSize: style.StationStand.common.textFontSize,
|
||||
fontWeight: style.StationStand.jump.fontWeight,
|
||||
fontSize: style.StationStand.jump.fontSize,
|
||||
fontFamily: style.fontFamily,
|
||||
text: style.StationStand.jump.text,
|
||||
textFill: style.StationStand.jump.textColor,
|
||||
textAlign: model.textAlign,
|
||||
textVerticalAlign: model.textVerticalAlign
|
||||
textAlign: style.textStyle.textAlign,
|
||||
textVerticalAlign: style.textStyle.textVerticalAlign
|
||||
}
|
||||
});
|
||||
this.add(this.jump);
|
||||
if (style.StationStand.jump.r) {
|
||||
this.jumpArc = new Arc({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
@ -86,44 +42,26 @@ class EJump extends Group {
|
||||
}
|
||||
});
|
||||
this.add(this.jumpArc);
|
||||
this.add(this.jump);
|
||||
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) {
|
||||
this.create();
|
||||
this.jump.setStyle('textFill', color);
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.create();
|
||||
this.jump.hide();
|
||||
this.jumpArc && this.jumpArc.hide();
|
||||
}
|
||||
|
||||
show(nameText) {
|
||||
if (this.model.style.StationStand.common.special && nameText) {
|
||||
this.create();
|
||||
this.jump.setStyle('text', nameText);
|
||||
} else {
|
||||
this.create();
|
||||
}
|
||||
show(isAllJump) {
|
||||
if (isAllJump) { // 站台跳停
|
||||
this.jump.show();
|
||||
this.jumpArc && this.jumpArc.show();
|
||||
} else { // 指定列车跳停
|
||||
this.jump.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,12 +135,8 @@ class StationStand extends Group {
|
||||
|
||||
/** 站台扣车*/
|
||||
const detainD = model.right ? 1 : -1;
|
||||
let 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);
|
||||
if (style.StationStand.common.special) {
|
||||
detainX = model.position.x;
|
||||
detainY = model.position.y;
|
||||
}
|
||||
const detainX = model.position.x - (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.x - model.width / 2);
|
||||
const detainY = model.position.y + (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.y - model.height / 2);
|
||||
this.detain = new EDetain({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -149,9 +145,7 @@ class StationStand extends Group {
|
||||
y: detainY,
|
||||
width: model.width,
|
||||
inside: model.inside,
|
||||
right: model.right,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top'
|
||||
right: model.right
|
||||
});
|
||||
this.add(this.detain);
|
||||
|
||||
@ -186,14 +180,10 @@ class StationStand extends Group {
|
||||
/** 列车停跳 */
|
||||
if (style.StationStand.common.haveJumpShow) {
|
||||
const jumpDirct = model.right ? -1 : 1;
|
||||
let 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 jumpX = model.position.x - jumpDirct * (style.StationStand.jump.offset.x - model.width / 2);
|
||||
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 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({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z + 1,
|
||||
@ -204,11 +194,7 @@ class StationStand extends Group {
|
||||
cy: jumpCY,
|
||||
width: model.width,
|
||||
inside: model.inside,
|
||||
right: model.right,
|
||||
textAlign: 'center',
|
||||
textVerticalAlign: 'middle',
|
||||
allSkip: model.allSkip,
|
||||
assignSkip: model.assignSkip
|
||||
right: model.right
|
||||
});
|
||||
this.add(this.jump);
|
||||
}
|
||||
@ -222,7 +208,7 @@ class StationStand extends Group {
|
||||
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
|
||||
}
|
||||
}
|
||||
createFunctionButton() { //
|
||||
createFunctionButton() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
if (model.stopJumpLamp) {
|
||||
@ -364,7 +350,6 @@ class StationStand extends Group {
|
||||
this.trainDepart && this.trainDepart.hide();
|
||||
this.reentry && this.reentry.hide();
|
||||
this.jump && this.jump.hide();
|
||||
this.jump && this.jump.setStatus(0, 0);
|
||||
}
|
||||
|
||||
/** 空闲*/
|
||||
@ -406,31 +391,13 @@ class StationStand extends Group {
|
||||
/** 指定列车跳站*/
|
||||
designatedJumpStop() {
|
||||
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.designatedJumpStopColor);
|
||||
if (this.style.StationStand.common.special) {
|
||||
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);
|
||||
this.jump && this.jump.show(0);
|
||||
}
|
||||
|
||||
/** 站台跳停*/
|
||||
jumpStop() {
|
||||
this.safeStand && this.safeStand.setColor(this.style.StationStand.stand.jumpStopColor);
|
||||
if (this.style.StationStand.common.special) {
|
||||
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);
|
||||
this.jump && this.jump.show(1);
|
||||
}
|
||||
|
||||
/** 车站扣车*/
|
||||
|
Loading…
Reference in New Issue
Block a user