This commit is contained in:
zyy 2019-07-24 14:33:56 +08:00
commit 42ae0b4a0d
20 changed files with 113 additions and 59 deletions

View File

@ -36,11 +36,13 @@ export default class LcControl extends Group {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance,
fontWeight: 'normal',
fontSize: this.style.stationControlTextSize,
fontFamily: this.style.textFontFormat,
text: model.name,
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat
textVerticalAlign: 'top'
},
style: this.style
});

View File

@ -35,11 +35,13 @@ export default class LimitControl extends Group {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance,
fontWeight: 'normal',
fontSize: this.style.stationControlTextSize,
fontFamily: this.style.textFontFormat,
text: model.name,
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat
textVerticalAlign: 'top'
},
style: this.style
});

View File

@ -161,20 +161,22 @@ export default class Section extends Group {
}
// 创建区段名称
const fontSize = style.type == '02' ? style.Section.text.fontSize + 2 : style.Section.text.fontSize;
const fontSize = model.type == '02' ? style.Section.text.fontSize + 2: style.Section.text.fontSize;
this.sectionText = new ETextName({
_subType: 'Text',
zlevel: this.zlevel,
z: this.z + 6,
style: this.style,
silent: false,
x: tempx,
y: tempy,
fontWeight: 'bold',
fontSize: fontSize,
fontFamily: style.textFontFormat,
text: model.name,
textFont: fontSize + 'px ' + style.Section.text.fontFormat,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
textVerticalAlign: style.Section.text.textVerticalAlign,
style: this.style
textVerticalAlign: style.Section.text.textVerticalAlign
});
this.add(this.sectionText);
}
@ -195,8 +197,10 @@ export default class Section extends Group {
z: 6,
x: tempx + model.standTrackNamePosition.x,
y: tempy + model.standTrackNamePosition.y,
fontWeight: 'bold',
fontSize: style.Section.text.fontSize,
fontFamily: style.textFontFormat,
text: model.standTrackName,
textFont: style.Section.text.fontSize + 'px ' + style.Section.text.fontFormat,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
@ -214,8 +218,10 @@ export default class Section extends Group {
z: 6,
x: x + model.reentryTrackNamePosition.x,
y: y + model.reentryTrackNamePosition.y + style.nameDistance + style.Section.text.fontSize,
fontWeight: 'bold',
fontSize: style.Section.text.fontSize,
fontFamily: style.textFontFormat,
text: model.reentryTrackName,
textFont: style.Section.text.fontSize + 'px ' + style.Section.text.fontFormat,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
@ -233,8 +239,10 @@ export default class Section extends Group {
z: 6,
x: x + model.transferTrackNamePosition.x,
y: y + model.transferTrackNamePosition.y + style.nameDistance + style.Section.text.fontSize * 2,
fontWeight: 'bold',
fontSize: style.Section.text.fontSize,
fontFamily: style.textFontFormat,
text: model.transferTrackName,
textFont: style.Section.text.fontSize + 'px ' + style.Section.text.fontFormat,
textFill: style.Section.text.fontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,
@ -252,8 +260,10 @@ export default class Section extends Group {
z: 6,
x: x + model.destinationCodePoint.x,
y: y + model.destinationCodePoint.y,
fontWeight: 'bold',
fontSize: style.Section.text.fontSize,
fontFamily: style.textFontFormat,
text: model.destinationCode,
textFont: style.Section.text.fontSize + 'px ' + style.Section.text.fontFormat,
textFill: style.destinationTextFontColor,
textAlign: style.Section.text.textAlign,
textPosition: style.Section.text.textPosition,

View File

@ -21,8 +21,10 @@ class ESigDelay extends Group {
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',

View File

@ -11,15 +11,16 @@ class ESigName extends Group {
_create() {
const model = this.model;
this.name = new Text({
_subType: model._subType,
zlevel: model.zlevel,
z: model.z,
silent: model.silent,
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',

View File

@ -71,11 +71,14 @@ class Signal extends Group {
zlevel: this.zlevel,
z: this.z,
silent: false,
isNoRotation: style.Signal.text.isNoRotation,
style: style,
x: sigNameX,
y: sigNameY,
text: model.name,
textFont: `bold ${style.Signal.text.signalTextFontSize} px ${style.textFontFormat}`,
fontWeight: 'bold',
fontSize: style.Signal.text.signalTextFontSize,
fontFamily: style.textFontFormat,
textFill: style.Signal.text.signalDefaultTextColor,
textAlign: 'middle',
textVerticalAlign: posit == 1 ? 'top' : 'bottom'
@ -122,8 +125,10 @@ class Signal extends Group {
style: style,
x: sigDelayX,
y: sigDelayY,
fontWeight: 'bold',
fontSize: style.Signal.delay.signalDelayTextFontSize,
fontFamily: style.textFontFormat,
text: this.state.delayCount || '0',
textFont: `bold ${style.Signal.delay.signalDelayTextFontSize} px ${style.textFontFormat}`,
textFill: style.Signal.delay.signalDelayTextColor,
textAlign: drict > 0 ? 'right' : 'left',
textVerticalAlign: 'middle'
@ -155,7 +160,7 @@ class Signal extends Group {
device.eachChild(item => {
if (item instanceof Group) {
this.transformRotation(item);
} else {
} else if (item && item.model && item.model.isNoRotation) {
item.origin = [this.model.position.x, this.model.position.y];
item.rotation = -Math.PI / 180 * Number(this.model.rotate);
item.dirty();

View File

@ -29,10 +29,12 @@ export default class Station extends Group {
position: [0, 0],
x: model.position.x,
y: model.position.y,
fontWeight: 'bold',
fontSize: model.nameFont || 18,
fontFamily: style.textFontFormat,
text: model.name,
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: model.nameFont || '18px ' + style.textFontFormat,
textFill: model.nameFontColor
});
let direction = 1;
@ -45,10 +47,12 @@ export default class Station extends Group {
position: [0, 0],
x: model.position.x,
y: model.position.y + ((parseInt(model.nameFont) + 2) * direction),
fontWeight: 'bold',
fontSize: model.kmPostFont || 18,
fontFamily: style.textFontFormat,
text: model.kmPost,
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: model.kmPostFont || '18px ' + style.textFontFormat,
textFill: model.kmPostFontColor
});

View File

@ -48,9 +48,11 @@ export default class ESingleControl extends Group {
style: {
x: model.point.x,
y: model.point.y + model.style.StationControl.stationControlmodeR + model.style.nameDistance,
fontWeight: 'normal',
fontSize: model.style.textFontSize,
fontFamily: model.style.textFontFormat,
text: model.context,
textFill: model.style.textFontColor,
textFont: model.style.textFontSize + 'px ' + model.style.textFontFormat,
textAlign: 'middle',
textVerticalAlign: 'top'
}

View File

@ -29,11 +29,13 @@ export default class StationCounter extends Group {
style: {
x: model.position.x,
y: model.position.y,
fontWeight: 'normal',
fontSize: style.textFontSize,
fontFamily: style.textFontFormat,
text: model.val,
textFill: style.stationCounterTextColor,
textAlign: 'middle',
textStrokeWidth: 1,
textFont: style.textFontSize + 'px ' + style.textFontFormat
textStrokeWidth: 1
}
});
@ -64,12 +66,14 @@ export default class StationCounter extends Group {
style: {
x: model.position.x,
y: model.position.y + this.rect.width + this.vPadding + style.textFontSize + style.nameDistance,
fontWeight: 'bold',
fontSize: style.textFontSize,
fontFamily: style.textFontFormat,
text: model.name,
textFill: style.stationCounterTextColor,
textAlign: 'middle',
textVerticalAlign: 'top',
textStrokeWidth: 1,
textFont: style.textFontSize + 'px ' + style.textFontFormat
textStrokeWidth: 1
}
});
this.add(this.counterName);

View File

@ -29,10 +29,12 @@ export default class StationDelayUnlock extends Group {
style: {
x: model.position.x,
y: model.position.y,
fontWeight: 'normal',
fontSize: model.textFont,
fontFamily: style.textFontFormat,
text: model.deviceName + ' ',
textFill: style.stationDelayUnlockTextColor,
textStrokeWidth: 1,
textFont: model.textFont + 'px ' + style.textFontFormat,
textAlign: 'left'
}
});
@ -45,10 +47,12 @@ export default class StationDelayUnlock extends Group {
style: {
x: model.position.x,
y: model.position.y + fontSize + style.stationDelayUnlockDistance,
fontWeight: 'normal',
fontSize: model.textFont,
fontFamily: style.textFontFormat,
text: model.remainTime || '',
textFill: style.stationDelayUnlockTextColor,
textStrokeWidth: 1,
textFont: model.textFont + 'px ' + style.textFontFormat,
textAlign: 'left'
}
});

View File

@ -20,10 +20,12 @@ class EJump extends Group {
style: {
x: model.x,
y: model.y,
fontWeight: 'normal',
fontSize: style.StationStand.common.textFontSize,
fontFamily: style.textFontFormat,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
textAlign: 'middle'
}
});

View File

@ -20,10 +20,12 @@ class ELevel extends Group {
style: {
x: model.x,
y: model.y,
fontWeight: 'normal',
fontSize: style.StationStand.common.textFontSize,
fontFamily: style.textFontFormat,
text: model.name,
textFill: style.StationStand.level.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
textAlign: 'middle'
}
});

View File

@ -20,10 +20,12 @@ class ETime extends Group {
style: {
x: model.x,
y: model.y,
fontWeight: 'normal',
fontSize: style.StationStand.common.textFontSize,
fontFamily: style.textFontFormat,
text: model.name,
textFill: style.StationStand.stopTime.textColor,
textAlign: 'middle',
textFont: `${style.StationStand.common.textFontSize} px ${style.textFontFormat}`
textAlign: 'middle'
}
});

View File

@ -19,10 +19,12 @@ class ESwName extends Group {
style: {
x: model.nameTextX,
y: model.nameTextY,
fontWeight: 'normal',
fontSize: style.textFontSize,
fontFamily: style.textFontFormat,
text: model.name,
textAlign: model.triangle.drictx === 1 ? 'left' : 'right',
textVerticalAlign: model.triangle.dricty === 1 ? 'top' : 'bottom',
textFont: style.textFontSize + 'px ' + style.textFontFormat,
textFill: style.Switch.text.switchTextLossColor
}
});
@ -58,10 +60,12 @@ class ESwName extends Group {
style: {
x: model.arrowTextX,
y: model.arrowTextY,
fontWeight: 'normal',
fontSize: 10,
fontFamily: style.textFontFormat,
text: `道岔区段名称: ${model.sectionName}`,
textFill: '#000',
textAlign: 'letf',
textFont: 10 + 'px consolas',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}

View File

@ -35,10 +35,10 @@ class TrainBody extends Group {
style: {
x: model.point.x + 50,
y: model.point.y + 25,
font: 10 + 'px consolas',
text: `列车类型: 计划车\n\0\0\0\0号: ${model.serviceNumber}\n\0\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n\0\0号: ${model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.trackName : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`,
textFill: '#000',
textAlign: 'letf',
textFont: 10 + 'px consolas',
textPadding: 3,
textBackgroundColor: style.tipBackgroundColor
}
@ -72,9 +72,9 @@ class TrainBody extends Group {
style: {
x: parseInt(beginX + margin * 0),
y: parseInt(beginY),
font: TextFontHSDA,
text: 'H',
textFill: style.trainYellowColor,
textFont: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}
@ -86,9 +86,9 @@ class TrainBody extends Group {
style: {
x: parseInt(beginX + margin * 1),
y: parseInt(beginY),
font: TextFontHSDA,
text: 'S',
textFill: style.trainBlueColor,
textFont: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}
@ -100,9 +100,9 @@ class TrainBody extends Group {
style: {
x: parseInt(beginX + margin * 2),
y: parseInt(beginY),
font: TextFontHSDA,
text: 'D',
textFill: style.trainGreenColor,
textFont: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}
@ -114,9 +114,9 @@ class TrainBody extends Group {
style: {
x: parseInt(beginX + margin * 3),
y: parseInt(beginY),
font: TextFontHSDA,
text: 'A',
textFill: style.trainRedColor,
textFont: TextFontHSDA,
textAlign: 'middle',
textVerticalAlign: 'top'
}
@ -135,9 +135,9 @@ class TrainBody extends Group {
style: {
x: parseInt(model.point.x + lrPadding),
y: parseInt(model.point.y + upPadding),
font: textFont,
text: serviceNumber.substring(serviceNumber.length - 2),
textFill: style.trainBrownColor,
textFont: textFont,
textAlign: 'left',
textVerticalAlign: 'top'
}
@ -149,9 +149,9 @@ class TrainBody extends Group {
style: {
x: parseInt(model.point.x + style.trainWidth - lrPadding),
y: parseInt(model.point.y + upPadding),
font: textFont,
text: tripNumber.substring(tripNumber.length - 3),
textFill: style.trainYellowColor,
textFont: textFont,
textAlign: 'right',
textVerticalAlign: 'top'
}

View File

@ -34,11 +34,13 @@ export default class ZcControl extends Group {
position: [0, 0],
x: model.position.x,
y: model.position.y + this.style.zcControlmodeR + this.style.nameDistance,
fontWeight: 'normal',
fontSize: this.style.stationControlTextSize,
fontFamily: this.style.textFontFormat,
text: model.name,
textFill: '#fff',
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: this.style.stationControlTextSize + 'px ' + this.style.textFontFormat
textVerticalAlign: 'top'
},
style: this.style
});

View File

@ -35,11 +35,13 @@ export default class EControl extends Group {
style: {
x: this.textStyle.x,
y: this.textStyle.y,
fontWeight: this.textStyle.fontWeight,
fontSize: this.textStyle.fontSize,
fontFamily: this.textStyle.fontFamily,
text: this.textStyle.text,
textFill: this.textStyle.textFill,
textAlign: this.textStyle.textAlign,
textVerticalAlign: this.textStyle.textVerticalAlign,
textFont: this.textStyle.textFont
textVerticalAlign: this.textStyle.textVerticalAlign
}
});

View File

@ -4,15 +4,16 @@ import Text from 'zrender/src/graphic/Text';
/** 名称元素*/
export default function ETextName(model) {
const TextName = new Text({
_subType: model._subType,
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
fontWeight: model.fontWeight,
fontSize: model.fontSize,
fontFamily: model.fontFamily,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',

View File

@ -22,7 +22,7 @@ class Beijing extends defaultSkin {
textAlign: 'center', // 水平对齐方式
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle', // 文字垂直对齐方式
position: 0 // 区段名称位置 1 上行 -1 下面 0 默认
position: 1 // 区段名称位置 1 上面 -1 下面 0 默认
},
line: {
width: 5, // 区段宽度
@ -57,8 +57,8 @@ class Beijing extends defaultSkin {
lineColor: '#FFFF00' // 限速线颜色
},
separator: {
width: 1.2, // 分隔符宽度
endWidth: 1.2, // 尽头分隔符宽度
width: 1.5, // 分隔符宽度
endWidth: 1.5, // 尽头分隔符宽度
endColor: '#7F7F7F', // 尽头分隔符颜色
color: '#7F7F7F' // 区段边界符颜色
}
@ -72,8 +72,10 @@ class Beijing extends defaultSkin {
signalLampStandardWidth: 1.5
},
text: {
/** 是否禁止旋转*/
isNoRotation: true,
/** 信号机名称字体大小*/
signalTextFontSize: 12,
signalTextFontSize: 10,
/** 信号灯字体默认色*/
signalDefaultTextColor: '#C0C0C0',
/** 信号灯字体锁定颜色*/
@ -87,7 +89,7 @@ class Beijing extends defaultSkin {
/** 信号灯边框线颜色*/
signalBorderColor: '#3149C3',
/** 信号机宽度 */
signalR: 7,
signalR: 6,
/** 信号灯锁闭*/
signalBlockColor: '#EF0C08',
/** 信号灯灰色*/
@ -194,12 +196,12 @@ class Beijing extends defaultSkin {
this[deviceType.StationControl] = {
singleControlNum: 3,
stationOffset: {x: 20, y: 0},
stationOffset: { x: 20, y: 0 },
arrowsShow: false, // 控制模式箭头显隐
/** 控制模式字体大小*/
stationControlTextSize: 10,
/** 控制模式灯的半径 */
stationControlmodeR: 4,
stationControlmodeR: 6,
/** 控制模式之间灯之间的距离*/
stationControlDistance: 36,
/** 控制模式灰色*/

View File

@ -17,8 +17,7 @@ class Fuzhou extends defaultSkin {
this[deviceType.Section] = {
text: { // 区段文字属性
fontSize: 10, // 字体大小
fontFormat: 'consolas', // 字体族类
fontColor: '#C0C0C0', // 字体颜色
fontColor: '#FFFFFF', // 字体颜色
textAlign: 'center', // 水平对齐方式
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle', // 文字垂直对齐方式
@ -71,8 +70,10 @@ class Fuzhou extends defaultSkin {
signalLampStandardWidth: 2
},
text: {
/** 是否禁止旋转*/
isNoRotation: true,
/** 信号机名称字体大小*/
signalTextFontSize: 8,
signalTextFontSize: 10,
/** 信号灯字体默认色*/
signalDefaultTextColor: '#FFFFFF',
/** 信号灯字体锁定颜色*/