列车整理

This commit is contained in:
fan 2020-06-17 13:35:21 +08:00
parent 6cc44b5528
commit 89ae6e8c0f
13 changed files with 115 additions and 202 deletions

View File

@ -640,7 +640,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗

View File

@ -577,7 +577,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸

View File

@ -761,7 +761,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗

View File

@ -617,7 +617,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: false, // 是否需创建textHSDA对象 haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置
textOffset: 1, // 字体偏移(用以控制字体据车头的距离) textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸

View File

@ -612,7 +612,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: false, // 是否需创建textHSDA对象 haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置
textOffset: 1, // 字体偏移(用以控制字体据车头的距离) textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸

View File

@ -669,7 +669,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: false, // 是否需创建textHSDA对象 haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置
textOffset: 1, // 字体偏移(用以控制字体据车头的距离) textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸

View File

@ -649,7 +649,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸

View File

@ -638,7 +638,7 @@ class SkinCode extends defaultStyle {
}, },
trainTarget: { trainTarget: {
tripNumberPrefix: '0000', // 车次号前缀 tripNumberPrefix: '0000', // 车次号前缀
defaultDirectionCode: 'D', // 默认车次号1 defaultDirectionCode: '', // 默认车次号1
defaultTripNumber: 'CCC', // 默认车次号2 defaultTripNumber: 'CCC', // 默认车次号2
trainTargetOffset: { x: 42, y: 1}, // 列车车次号偏移 trainTargetOffset: { x: 42, y: 1}, // 列车车次号偏移
smallColor: '#00FFFF', // 小交路颜色 smallColor: '#00FFFF', // 小交路颜色
@ -670,7 +670,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: false, // 是否需创建textHSDA对象 haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 8 / 15, // 字体宽高比例用以拼接text是计算位置
textOffset: 1, // 字体偏移(用以控制字体据车头的距离) textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸

View File

@ -749,7 +749,6 @@ class SkinCode extends defaultStyle {
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false, // 是否需创建trainBorder对象
aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置 aspectRatio: 7 / 5, // 字体宽高比例用以拼接text是计算位置
textOffset: 4, // 字体偏移(用以控制字体据车头的距离) textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸

View File

@ -16,11 +16,11 @@ class EMouse extends Group {
if (this.device.style.Train.soonerOrLater && this.device.style.Train.soonerOrLater.level === 5) { if (this.device.style.Train.soonerOrLater && this.device.style.Train.soonerOrLater.level === 5) {
if (this.device.model.dt > 120) { if (this.device.model.dt > 120) {
destinationText = LangStorage.getLang() == 'en' ? 'early seriously' : '严重早点'; destinationText = LangStorage.getLang() == 'en' ? 'early seriously' : '严重早点';
} else if (this.device.mode.dt >= 15 && this.device.mode.dt <= 120) { } else if (this.device.model.dt >= 15 && this.device.model.dt <= 120) {
destinationText = LangStorage.getLang() == 'en' ? 'early' : '早点'; destinationText = LangStorage.getLang() == 'en' ? 'early' : '早点';
} else if (this.device.mode.dt >= -120 && this.device.mode.dt <= -15) { } else if (this.device.model.dt >= -120 && this.device.model.dt <= -15) {
destinationText = LangStorage.getLang() == 'en' ? 'late' : '晚点'; destinationText = LangStorage.getLang() == 'en' ? 'late' : '晚点';
} else if (this.device.mode.dt < -120) { } else if (this.device.model.dt < -120) {
destinationText = LangStorage.getLang() == 'en' ? 'late seriously ' : '严重晚点'; destinationText = LangStorage.getLang() == 'en' ? 'late seriously ' : '严重晚点';
} else { } else {
destinationText = LangStorage.getLang() == 'en' ? 'on time' : '准点'; destinationText = LangStorage.getLang() == 'en' ? 'on time' : '准点';

View File

@ -26,7 +26,6 @@ export default class TrainBody extends Group {
store.dispatch('map/setTrainDetails', this.deviceModel); store.dispatch('map/setTrainDetails', this.deviceModel);
this.mouseEvent.mouseover(); this.mouseEvent.mouseover();
} }
this.on('mouseover', () => { this.on('mouseover', () => {
store.dispatch('map/setTrainDetails', this.deviceModel); store.dispatch('map/setTrainDetails', this.deviceModel);
this.mouseEvent.mouseover(); this.mouseEvent.mouseover();
@ -40,13 +39,89 @@ export default class TrainBody extends Group {
create() { create() {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号)
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号
const targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号
// 服务号
this.textTrainServer = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x),
y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y),
text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length),
textFill: model.style.Train.trainServer.fontColor || style.trainTextColor,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
// 车次号
this.textTrainTrip = new ETextName({
zlevel: this.model.zlevel,
z: this.model.z + 1,
x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x),
y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y),
text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length),
textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
this.textTrainTarget = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y),
text: targetCode.substring(targetCode.length - style.Train.trainNumber.targetCodePrefix.length),
textFill: model.style.Train.trainNumber.fontColor || style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
this.textTrainGroup = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y),
text: groupNumber.substring(groupNumber.length - style.Train.trainTargetNumber.groupNumberPrefix.length),
textFill: style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
if (style.Train.trainTargetNumber.maskText) {
this.textTrainGroupMask = new ETextName({
zlevel: model.zlevel,
z: model.z + 2,
x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y),
text: style.Train.trainTargetNumber.maskText,
textFill: style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
}
this.formatChangePosition(model, style);
this.trainBodyBox = new TrainBodyBox({ this.trainBodyBox = new TrainBodyBox({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
point: model.point, point: model.point,
style: style style: style
}); });
const beginX = (model.point.x + style.Train.trainBody.lrPadding); const beginX = (model.point.x + style.Train.trainBody.lrPadding);
const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA); const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA);
const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4; const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4;
@ -54,7 +129,7 @@ export default class TrainBody extends Group {
this.textH = style.Train.common.haveTextHSDA ? new ETextName({ this.textH = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 0), x: parseInt(beginX),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textHContent, text: style.Train.hsda.textHContent,
textFill: style.trainYellowColor, textFill: style.trainYellowColor,
@ -66,7 +141,7 @@ export default class TrainBody extends Group {
this.textS = style.Train.common.haveTextHSDA ? new ETextName({ this.textS = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 1), x: parseInt(beginX + margin),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textSContent, text: style.Train.hsda.textSContent,
textFill: style.trainBlueColor, textFill: style.trainBlueColor,
@ -99,81 +174,6 @@ export default class TrainBody extends Group {
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号
const targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号
this.textTrainServer = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x),
y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y),
text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length),
textFill: model.style.Train.trainServer.fontColor || style.trainTextColor,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
this.textTrainTarget = new ETextName({
zlevel: this.model.zlevel,
z: this.model.z + 1,
x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x),
y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y),
text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length),
textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
this.textTrainNumber = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y),
text: targetCode.substring(targetCode.length - style.Train.trainNumber.targetCodePrefix.length),
textFill: model.style.Train.trainNumber.fontColor || style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
this.textTrainTargetNumber = new ETextName({
zlevel: model.zlevel,
z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y),
text: groupNumber.substring(groupNumber.length - style.Train.trainTargetNumber.groupNumberPrefix.length),
textFill: style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
if (style.Train.trainTargetNumber.maskText) {
this.textTrainTargetNumberMask = new ETextName({
zlevel: model.zlevel,
z: model.z + 2,
x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y),
text: style.Train.trainTargetNumber.maskText,
textFill: style.trainTextColor,
textStroke: style.trainTextColor,
textStrokeWidth: 0,
fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily,
textAlign: 'left',
textVerticalAlign: 'top'
});
}
this.formatChangePosition(model, style);
this.add(this.trainBodyBox); this.add(this.trainBodyBox);
if (style.Train.common.haveTextHSDA) { if (style.Train.common.haveTextHSDA) {
this.add(this.textH); this.add(this.textH);
@ -276,22 +276,6 @@ export default class TrainBody extends Group {
setTrainColor(color) { setTrainColor(color) {
this.trainBodyBox && this.trainBodyBox.setStyle('fill', color); this.trainBodyBox && this.trainBodyBox.setStyle('fill', color);
} }
setTextTrainServerColor(color) {
this.textTrainServer && this.textTrainServer.setStyle('textFill', color);
this.textTrainServer && this.textTrainServer.setStyle('textStroke', color);
}
setTextTrainTargetColor(color) {
this.textTrainTarget && this.textTrainTarget.setStyle('textFill', color);
this.textTrainTarget && this.textTrainTarget.setStyle('textStroke', color);
}
setTextTrainNumberColor(color) {
this.textTrainNumber && this.textTrainNumber.setStyle('textFill', color);
this.textTrainNumber && this.textTrainNumber.setStyle('textStroke', color);
}
setTextTrainTargetNumberColor(color) {
this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textFill', color);
this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textStroke', color);
}
setHShow(isShow) { setHShow(isShow) {
if (this.textH) { if (this.textH) {
isShow ? this.textH.show() : this.textH.hide(); isShow ? this.textH.show() : this.textH.hide();
@ -327,14 +311,14 @@ export default class TrainBody extends Group {
if (this.textTrainServer) { if (this.textTrainServer) {
const tempRect = this.textTrainServer.getBoundingRect().clone(); const tempRect = this.textTrainServer.getBoundingRect().clone();
return tempRect; return tempRect;
} else if (this.textTrainTrip) {
const tempRect = this.textTrainTrip.getBoundingRect().clone();
return tempRect;
} else if (this.textTrainTarget) { } else if (this.textTrainTarget) {
const tempRect = this.textTrainTarget.getBoundingRect().clone(); const tempRect = this.textTrainTarget.getBoundingRect().clone();
return tempRect; return tempRect;
} else if (this.textTrainNumber) { } else if (this.textTrainGroup) {
const tempRect = this.textTrainNumber.getBoundingRect().clone(); const tempRect = this.textTrainGroup.getBoundingRect().clone();
return tempRect;
} else if (this.textTrainTargetNumber) {
const tempRect = this.textTrainTargetNumber.getBoundingRect().clone();
return tempRect; return tempRect;
} else { } else {
return new BoundingRect(0, 0, 0, 0); return new BoundingRect(0, 0, 0, 0);
@ -342,22 +326,22 @@ export default class TrainBody extends Group {
} }
setPlanRoutingTypeColor(planRoutingTypes) { setPlanRoutingTypeColor(planRoutingTypes) {
if (planRoutingTypes === 'BIG') { if (planRoutingTypes === 'BIG') {
this.style.Train.trainTarget.bigColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.bigColor}); this.style.Train.trainTarget.bigColor && this.textTrainTrip && this.textTrainTrip.setStyle({textFill: this.style.Train.trainTarget.bigColor});
} else if (planRoutingTypes === 'SMALL') { } else if (planRoutingTypes === 'SMALL') {
this.style.Train.trainTarget.smallColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.smallColor}); this.style.Train.trainTarget.smallColor && this.textTrainTrip && this.textTrainTrip.setStyle({textFill: this.style.Train.trainTarget.smallColor});
} else if (planRoutingTypes === 'INBOUND') { } else if (planRoutingTypes === 'INBOUND') {
this.style.Train.trainTarget.inboundColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.inboundColor}); this.style.Train.trainTarget.inboundColor && this.textTrainTrip && this.textTrainTrip.setStyle({textFill: this.style.Train.trainTarget.inboundColor});
} }
} }
setTrainTypeColor(type) { setTrainTypeColor(type) {
if (type === 'PLAN') { if (type === 'PLAN') {
this.style.Train.trainTarget.planTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainTarget.planTypeColor}); this.style.Train.trainTarget.planTypeColor && this.textTrainTrip && this.textTrainTrip.setStyle({textFill: this.style.Train.trainTarget.planTypeColor});
} else if (type === 'MANUAL') { } else if (type === 'MANUAL') {
this.style.Train.trainTargetNumber.manualTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle({textFill: this.style.Train.trainTargetNumber.manualTypeColor}); this.style.Train.trainTargetNumber.manualTypeColor && this.textTrainGroup && this.textTrainGroup.setStyle({textFill: this.style.Train.trainTargetNumber.manualTypeColor});
this.style.Train.trainNumber.headTypeColor && this.textTrainNumber && this.textTrainNumber.setStyle({textFill: this.style.Train.trainNumber.headTypeColor}); this.style.Train.trainNumber.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainNumber.headTypeColor});
} else if (type === 'HEAD') { } else if (type === 'HEAD') {
this.style.Train.trainTargetNumber.headTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle({textFill: this.style.Train.trainTargetNumber.headTypeColor}); this.style.Train.trainTargetNumber.headTypeColor && this.textTrainGroup && this.textTrainGroup.setStyle({textFill: this.style.Train.trainTargetNumber.headTypeColor});
this.style.Train.trainNumber.headTypeColor && this.textTrainNumber && this.textTrainNumber.setStyle({textFill: this.style.Train.trainNumber.headTypeColor}); this.style.Train.trainNumber.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainNumber.headTypeColor});
} }
} }
setSoonerOrLater(dt) { setSoonerOrLater(dt) {
@ -374,23 +358,16 @@ export default class TrainBody extends Group {
} else if (dt < -120) { } else if (dt < -120) {
this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.severeLateColor}); this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.severeLateColor});
this.delayTime && this.delayTime.setStyle({textFill: this.style.Train.soonerOrLater.severeLateColor}); this.delayTime && this.delayTime.setStyle({textFill: this.style.Train.soonerOrLater.severeLateColor});
} else {
this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.normalColor});
this.delayTime && this.delayTime.setStyle({textFill: this.style.Train.soonerOrLater.normalColor});
} }
} else if (this.style.Train.soonerOrLater && this.style.Train.soonerOrLater.level === 3) { } else if (this.style.Train.soonerOrLater && this.style.Train.soonerOrLater.level === 3) {
if (dt > 120) { if (dt > 120) {
this.style.Train.soonerOrLater.serviceNumber && this.textTrainServer && this.textTrainServer.setStyle({textFill: this.style.Train.soonerOrLater.earlyColor}); this.style.Train.soonerOrLater.serviceNumber && this.textTrainServer && this.textTrainServer.setStyle({textFill: this.style.Train.soonerOrLater.earlyColor});
this.style.Train.soonerOrLater.destinationCode && this.textTrainNumber && this.textTrainNumber.setStyle({textFill: this.style.Train.soonerOrLater.earlyColor}); this.style.Train.soonerOrLater.destinationCode && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.soonerOrLater.earlyColor});
this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.earlyColor}); this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.earlyColor});
} else if (dt < -120) { } else if (dt < -120) {
this.style.Train.soonerOrLater.serviceNumber && this.textTrainServer && this.textTrainServer.setStyle({textFill: this.style.Train.soonerOrLater.lateColor}); this.style.Train.soonerOrLater.serviceNumber && this.textTrainServer && this.textTrainServer.setStyle({textFill: this.style.Train.soonerOrLater.lateColor});
this.style.Train.soonerOrLater.destinationCode && this.textTrainNumber && this.textTrainNumber.setStyle({textFill: this.style.Train.soonerOrLater.lateColor}); this.style.Train.soonerOrLater.destinationCode && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.soonerOrLater.lateColor});
this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.lateColor}); this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.lateColor});
} else {
this.style.Train.soonerOrLater.serviceNumber && this.textTrainServer && this.textTrainServer.setStyle({textFill: this.style.Train.soonerOrLater.normalColor});
this.style.Train.soonerOrLater.trainBody && this.trainBodyBox && this.trainBodyBox.setColor({stroke: this.style.Train.soonerOrLater.normalColor});
this.style.Train.soonerOrLater.destinationCode && this.textTrainNumber && this.textTrainNumber.setStyle({textFill: this.style.Train.soonerOrLater.normalColor});
} }
} }
} }
@ -400,25 +377,28 @@ export default class TrainBody extends Group {
let widthText = 0; let widthText = 0;
arr.forEach(ele => { arr.forEach(ele => {
if (ele == 'targetCode') { if (ele == 'targetCode') {
!style.Train.common.fixedCoordinates && this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); !style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) );
widthText += this.textTrainNumber.getBoundingRect().width; widthText += this.textTrainTarget.getBoundingRect().width;
this.add(this.textTrainNumber); this.add(this.textTrainTarget);
} else if (ele == 'serviceNumber') { } else if (ele == 'serviceNumber') {
!style.Train.common.fixedCoordinates && this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainServer.getBoundingRect().width; widthText += this.textTrainServer.getBoundingRect().width;
this.add(this.textTrainServer); this.add(this.textTrainServer);
} else if (ele == 'tripNumber') { } else if (ele == 'tripNumber') {
!style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainTrip.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainTarget.getBoundingRect().width; widthText += this.textTrainTrip.getBoundingRect().width;
this.add(this.textTrainTarget); this.add(this.textTrainTrip);
} else if (ele == 'groupNumber') { } else if (ele == 'groupNumber') {
!style.Train.common.fixedCoordinates && this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainGroup.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
!style.Train.common.fixedCoordinates && this.textTrainTargetNumberMask && this.textTrainTargetNumberMask.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainGroupMask && this.textTrainGroupMask.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainTargetNumber.getBoundingRect().width; widthText += this.textTrainGroup.getBoundingRect().width;
this.add(this.textTrainTargetNumber); this.add(this.textTrainGroup);
this.textTrainTargetNumberMask && this.add(this.textTrainTargetNumberMask); this.textTrainGroupMask && this.add(this.textTrainGroupMask);
} }
}); });
if (style.Train.trainBody.changeTrainWidth) {
style.Train.common.trainWidth = widthText + style.Train.common.trainWidthMoreText;
}
} }
} }
} }

View File

@ -2,7 +2,6 @@ import Group from 'zrender/src/container/Group';
import TrainHead from './TrainHead'; import TrainHead from './TrainHead';
import TrainBody from './TrainBody'; import TrainBody from './TrainBody';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import Rect from 'zrender/src/graphic/shape/Rect';
import ETriangle from '../Train/ETriangle'; import ETriangle from '../Train/ETriangle';
import store from '@/store/index_APP_TARGET'; import store from '@/store/index_APP_TARGET';
import EDirection from './EDirection'; import EDirection from './EDirection';
@ -59,7 +58,6 @@ export default class Train extends Group {
} }
create() { create() {
this._computed(); this._computed();
this.isChangeTrainWidth(this.model, this.style);
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (this.point) { if (this.point) {
@ -133,7 +131,7 @@ export default class Train extends Group {
if (oldPoint) { if (oldPoint) {
const temp = Math.sqrt( const temp = Math.sqrt(
Math.pow(point.x - oldPoint.x, 2) + Math.pow(point.x - oldPoint.x, 2) +
Math.pow(point.y - oldPoint.y, 2), Math.pow(point.y - oldPoint.y, 2),
); );
this.pointList.push({ length: temp, pointStart: { x: oldPoint.x, y: oldPoint.y }, pointEnd: { x: point.x, y: point.y } }); this.pointList.push({ length: temp, pointStart: { x: oldPoint.x, y: oldPoint.y }, pointEnd: { x: point.x, y: point.y } });
this.lineLength += temp; this.lineLength += temp;
@ -161,9 +159,6 @@ export default class Train extends Group {
this.add(this.trainL); this.add(this.trainL);
this.add(this.trainR); this.add(this.trainR);
} }
if (style.Train.common.haveTrainBorder) {
this.createTrainBorder();
}
if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头eg:宁波yi if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头eg:宁波yi
const arrowPoint = { x: 0, y: 0 }; const arrowPoint = { x: 0, y: 0 };
if (model.trainWindowModel) { if (model.trainWindowModel) {
@ -361,36 +356,6 @@ export default class Train extends Group {
setPlanRoutingTypeColor(planRoutingType) { setPlanRoutingTypeColor(planRoutingType) {
this.trainB && this.trainB.setPlanRoutingTypeColor(planRoutingType); this.trainB && this.trainB.setPlanRoutingTypeColor(planRoutingType);
} }
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (this.nameFormat) {
const arr = this.nameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += (style.Train.trainNumber.targetCodePrefix || '').length;
break;
}
case 'serviceNumber': {
this.size += (style.Train.trainServer.serviceNumberPrefix || '').length;
break;
}
case 'tripNumber': {
this.size += (style.Train.trainTarget.tripNumberPrefix || '').length;
break;
}
case 'groupNumber': {
this.size += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
break;
}
}
});
} else {
this.size = 9;
}
this.style.Train.common.trainWidth = this.size * this.fontSize * this.style.Train.common.aspectRatio + this.style.Train.common.trainWidthMoreText;
}
removeTrainDetail() { removeTrainDetail() {
this.trainB && this.trainB.removeTrainDetail(); this.trainB && this.trainB.removeTrainDetail();
} }
@ -412,27 +377,6 @@ export default class Train extends Group {
}); });
return rect || new BoundingRect(0, 0, 0, 0); return rect || new BoundingRect(0, 0, 0, 0);
} }
createTrainBorder() {
const rect = Object.assign({}, this.getBoundingRect());
rect.x -= this.style.Train.common.trainWidth / 2;
rect.y -= 5;
rect.width += this.style.Train.common.trainWidth;
rect.height += 10;
this.trainBorder = new Rect({
zlevel: this.zlevel,
z: this.z,
silent: true,
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.style.borderColor,
fill: this.style.transparentColor
}
});
this.add(this.trainBorder);
}
setShowMode() { } setShowMode() { }
initShowStation(model) { initShowStation(model) {
if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) { if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) {
@ -447,8 +391,6 @@ export default class Train extends Group {
item.show(); item.show();
}); });
this.isShowShape = true; this.isShowShape = true;
this.nextPointIndex = 1;
this.currentAdd = 0;
this.setState(this.model, this); this.setState(this.model, this);
} else { } else {
this.eachChild(item => { this.eachChild(item => {

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛