This commit is contained in:
zyy 2020-03-27 11:25:08 +08:00
commit 97e9c8ca47
11 changed files with 125 additions and 126 deletions

View File

@ -282,7 +282,6 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
offset: { x: -8, y: 13 }, // 扣车偏移量 offset: { x: -8, y: 13 }, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: '#FFFFFF', // 中心扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -290,9 +289,9 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: { x: -8, y: 3 }, // 运行时间偏移量 offset: { x: -8, y: 3 }, // 运行时间偏移量
textColor: '#FFFFFF' // 停站时间字体颜色 textColor: '#FFFFFF', // 停站时间字体颜色
textFontSize: 8
}, },
level: { // 运行等级 level: { // 运行等级
position: 1, // 运行等级方向 position: 1, // 运行等级方向

View File

@ -231,7 +231,6 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: 'yellow', // 车站扣车颜色
centerTrainColor: 'white', // 中心扣车颜色 centerTrainColor: 'white', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -239,9 +238,9 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: {x: -8, y: -4}, // 运行时间偏移量 offset: {x: -8, y: -4}, // 运行时间偏移量
textColor: 'white' // 停站时间字体颜色 textColor: 'white', // 停站时间字体颜色
textFontSize: 12
}, },
jump: { jump: {
text: '跳', // 停跳显示内容 text: '跳', // 停跳显示内容

View File

@ -237,7 +237,6 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: '扣', // 扣车显示内容 text: '扣', // 扣车显示内容
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: '#FFFF00', // 车站扣车颜色
centerTrainColor: '#C0C0C0', // 中心扣车颜色 centerTrainColor: '#C0C0C0', // 中心扣车颜色
andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色 andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -245,10 +244,9 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: {x: -8, y: -4}, // 运行时间偏移量 offset: {x: -8, y: -4}, // 运行时间偏移量
textColor: '#C0C0C0', // 停站时间字体颜色 textColor: '#C0C0C0', // 停站时间字体颜色
textFontSize: 12 textFontSize: 10
}, },
jump: { jump: {
text: '跳', // 停跳显示内容 text: '跳', // 停跳显示内容

View File

@ -227,7 +227,6 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
offset: {x: -8, y: 13}, // 扣车偏移量 offset: {x: -8, y: 13}, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: '#FFFFFF', // 中心扣车颜色 centerTrainColor: '#FFFFFF', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -235,10 +234,9 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: {x: -8, y: -4}, // 运行时间偏移量 offset: {x: -8, y: -4}, // 运行时间偏移量
textColor: '#C0C0C0', // 停站时间字体颜色 textColor: '#C0C0C0', // 停站时间字体颜色
textFontSize: 12 textFontSize: 11
}, },
jump: { jump: {
text: 'S', // 停跳显示内容 text: 'S', // 停跳显示内容

View File

@ -232,7 +232,6 @@ class SkinCode extends defaultStyle {
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
fontSize: 18, // 扣车字体大小 fontSize: 18, // 扣车字体大小
offset: { x: 60, y: -20 }, // 扣车偏移量 offset: { x: 60, y: -20 }, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: '#F61107', // 中心扣车颜色 centerTrainColor: '#F61107', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -246,8 +245,6 @@ class SkinCode extends defaultStyle {
fontSize: 18 fontSize: 18
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
offset: { x: -8, y: 26 }, // 运行时间偏移量
textColor: '#FFFFFF' // 停站时间字体颜色
}, },
level: { // 运行等级 level: { // 运行等级
position: 1, // 运行等级方向 position: 1, // 运行等级方向

View File

@ -275,7 +275,6 @@ class SkinCode extends defaultStyle {
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
offset: { x: -8, y: 0 }, // 扣车偏移量 offset: { x: -8, y: 0 }, // 扣车偏移量
trainColor: 'yellow', // 车站扣车颜色
centerTrainColor: 'white', // 中心扣车颜色 centerTrainColor: 'white', // 中心扣车颜色
andCenterTrainColor: 'red', // 车站+中心扣车颜色 andCenterTrainColor: 'red', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
@ -283,9 +282,9 @@ class SkinCode extends defaultStyle {
fontWeight: 'normal' fontWeight: 'normal'
}, },
stopTime: { // 停站时间 stopTime: { // 停站时间
position: 1, // 运行时间方向
offset: { x: -8, y: -4 }, // 运行时间偏移量 offset: { x: -8, y: -4 }, // 运行时间偏移量
textColor: 'white' // 停站时间字体颜色 textColor: 'white', // 停站时间字体颜色
textFontSize: 10 // 停站时间字体大小
}, },
jump: {}, jump: {},
level: { // 运行等级 level: { // 运行等级

View File

@ -6,39 +6,44 @@ class EDetain extends Group {
super(); super();
this.model = model; this.model = model;
this.detain = null; this.detain = null;
this.create(); this.isNew = false;
} }
create() { create() {
const model = this.model; if (this.isNew) {
const style = this.model.style; const model = this.model;
this.detain = new Text({ const style = this.model.style;
zlevel: model.zlevel, this.isNew = true;
z: model.z, this.detain = new Text({
position: [0, 0], zlevel: model.zlevel,
style: { z: model.z,
x: model.x, position: [0, 0],
y: model.y, style: {
text: style.StationStand.detainCar.text, x: model.x,
fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`, y: model.y,
textFill: style.StationStand.detainCar.centerTrainColor, text: style.StationStand.detainCar.text,
textStroke: style.backgroundColor, fontSize: `${style.StationStand.detainCar.fontSize} px ${style.fontFamily}`,
textAlign: style.textStyle.textAlign, textFill: style.StationStand.detainCar.centerTrainColor,
textVerticalAlign: style.textStyle.textVerticalAlign 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.detain.hide(); this.detain && this.detain.hide();
} }
show() { show() {
this.create();
this.detain.show(); this.detain.show();
} }
} }

View File

@ -6,56 +6,61 @@ class EJump extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.create(); this.isNew = false;
} }
create() { create() {
const model = this.model; if (this.isNew) {
const style = this.model.style; const model = this.model;
this.jump = new Text({ const style = this.model.style;
zlevel: model.zlevel, this.isNew = true;
z: model.z, this.jump = new Text({
style: {
x: model.x,
y: model.y,
fontWeight: style.StationStand.jump.fontWeight,
fontSize: style.StationStand.jump.fontSize,
fontFamily: style.fontFamily,
text: style.StationStand.jump.text,
textFill: style.StationStand.jump.textColor,
textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign
}
});
this.add(this.jump);
if (style.StationStand.jump.r) {
this.jumpArc = new Arc({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
shape: {
cx: model.cx,
cy: model.cy,
r: style.StationStand.jump.r
},
style: { style: {
stroke: style.StationStand.jump.arcColor, x: model.x,
fill: style.StationStand.jump.fillColor y: model.y,
fontWeight: style.StationStand.jump.fontWeight,
fontSize: style.StationStand.jump.fontSize,
fontFamily: style.fontFamily,
text: style.StationStand.jump.text,
textFill: style.StationStand.jump.textColor,
textAlign: style.textStyle.textAlign,
textVerticalAlign: style.textStyle.textVerticalAlign
} }
}); });
this.add(this.jumpArc); this.add(this.jump);
this.jumpArc.hide(); if (style.StationStand.jump.r) {
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.jumpArc.hide();
}
} }
} }
setColor(color) { setColor(color) {
this.create();
this.jump.setStyle('textFill', color); this.jump.setStyle('textFill', color);
} }
hide() { hide() {
this.jump.hide(); this.jump && this.jump.hide();
this.jumpArc && this.jumpArc.hide(); this.jumpArc && this.jumpArc.hide();
} }
show(isAllJump) { show(isAllJump) {
this.create();
if (isAllJump) { // 站台跳停 if (isAllJump) { // 站台跳停
this.jump.show(); this.jump.show();
this.jumpArc && this.jumpArc.show(); this.jumpArc && this.jumpArc.show();

View File

@ -5,6 +5,7 @@ class ELevel extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.level = null;
this.isNew = false; this.isNew = false;
} }
@ -20,16 +21,15 @@ class ELevel extends Group {
style: { style: {
x: model.x, x: model.x,
y: model.y, y: model.y,
fontWeight: 'normal', fontWeight: style.textStyle.fontWeight,
fontSize: style.StationStand.stopTime.textFontSize || style.StationStand.common.textFontSize, fontSize: style.StationStand.stopTime.textFontSize,
fontFamily: style.fontFamily, fontFamily: style.fontFamily,
text: model.name, text: model.name,
textFill: style.StationStand.level.textColor, textFill: style.StationStand.level.textColor,
textAlign: 'center', textAlign: style.textStyle.textAlign,
textVerticalAlign: 'middle' textVerticalAlign: style.textStyle.textVerticalAlign
} }
}); });
this.add(this.level); this.add(this.level);
} }
} }
@ -45,8 +45,7 @@ class ELevel extends Group {
} }
hide() { hide() {
this.create(); this.level && this.level.hide();
this.level.hide();
} }
show() { show() {

View File

@ -3,47 +3,45 @@ import Polygon from 'zrender/src/graphic/shape/Polygon';
import { flashlight } from '../utils/ShapePoints.js'; import { flashlight } from '../utils/ShapePoints.js';
class EReentry extends Group { class EReentry extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.isNew = false; this.isNew = false;
} }
create() { create() {
if (!this.isNew) { if (!this.isNew) {
const model = this.model; const model = this.model;
this.isNew = true;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.isNew = true; this.add(this.reentry);
this.reentry = new Polygon({ }
zlevel: model.zlevel, }
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.reentry); setColor(color) {
} this.create();
} this.reentry.setStyle('textFill', color);
}
setColor(color) { hide() {
this.create(); this.reentry && this.reentry.hide();
this.reentry.setStyle('textFill', color); }
}
hide() { show() {
this.create(); this.create();
this.reentry.hide(); this.reentry.show();
} }
show() {
this.create();
this.reentry.show();
}
} }
export default EReentry; export default EReentry;

View File

@ -135,8 +135,8 @@ class StationStand extends Group {
/** 站台扣车*/ /** 站台扣车*/
const detainD = model.right ? 1 : -1; const detainD = model.right ? 1 : -1;
const detainX = model.position.x - (style.StationStand.stopTime.position || detainD) * (style.StationStand.detainCar.offset.x - model.width / 2); const detainX = model.position.x - (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); const detainY = model.position.y + (detainD) * (style.StationStand.detainCar.offset.y - model.height / 2);
this.detain = new EDetain({ this.detain = new EDetain({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -150,18 +150,20 @@ class StationStand extends Group {
this.add(this.detain); this.add(this.detain);
/** 停站时间*/ /** 停站时间*/
const timeDrict = model.right ? 1 : -1; if (style.StationStand.stopTime.offset) {
const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2); const timeDrict = model.right ? 1 : -1;
const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y; const timeX = model.position.x - timeDrict * (style.StationStand.stopTime.offset.x - model.width / 2);
this.time = new ETime({ const timeY = model.position.y + timeDrict * style.StationStand.stopTime.offset.y;
zlevel: this.zlevel, this.time = new ETime({
z: this.z + 1, zlevel: this.zlevel,
style: style, z: this.z + 1,
x: timeX, style: style,
y: timeY, x: timeX,
name: model.parkingTime || '30' y: timeY,
}); name: model.parkingTime || '30'
this.add(this.time); });
this.add(this.time);
}
/** 运行等级*/ /** 运行等级*/
const levelDrict = model.right ? 1 : -1; const levelDrict = model.right ? 1 : -1;