diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index 8f35ec144..1b993fcaa 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -640,7 +640,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index 1f393cda8..cfc152400 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -577,7 +577,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 7 / 5, // 字体宽高比例(用以拼接text是计算位置) textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 9438beb7e..b93295509 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -761,7 +761,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index e0c76a1d0..e2d6d053d 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -617,7 +617,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: false, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 8 / 15, // 字体宽高比例(用以拼接text是计算位置) textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/fuzhou_01.js b/src/jmapNew/config/skinCode/fuzhou_01.js index 527b0c559..2a6888d14 100644 --- a/src/jmapNew/config/skinCode/fuzhou_01.js +++ b/src/jmapNew/config/skinCode/fuzhou_01.js @@ -612,7 +612,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: false, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 8 / 15, // 字体宽高比例(用以拼接text是计算位置) textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 77ce52300..5bb52302e 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -669,7 +669,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: false, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 8 / 15, // 字体宽高比例(用以拼接text是计算位置) textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 43e964ed1..db4851934 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -649,7 +649,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 7 / 5, // 字体宽高比例(用以拼接text是计算位置) textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/xian_01.js b/src/jmapNew/config/skinCode/xian_01.js index 756e13069..213ac276d 100644 --- a/src/jmapNew/config/skinCode/xian_01.js +++ b/src/jmapNew/config/skinCode/xian_01.js @@ -638,7 +638,7 @@ class SkinCode extends defaultStyle { }, trainTarget: { tripNumberPrefix: '0000', // 车次号前缀 - defaultDirectionCode: 'D', // 默认车次号1 + defaultDirectionCode: '', // 默认车次号1 defaultTripNumber: 'CCC', // 默认车次号2 trainTargetOffset: { x: 42, y: 1}, // 列车车次号偏移 smallColor: '#00FFFF', // 小交路颜色 @@ -670,7 +670,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: false, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 8 / 15, // 字体宽高比例(用以拼接text是计算位置) textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index b01385f3a..3c3118c1a 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -749,7 +749,6 @@ class SkinCode extends defaultStyle { fontFamily: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 haveArrowText: true, // 是否需创建arrowText对象 - haveTrainBorder: false, // 是否需创建trainBorder对象 aspectRatio: 7 / 5, // 字体宽高比例(用以拼接text是计算位置) textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 diff --git a/src/jmapNew/shape/Train/EMouse.js b/src/jmapNew/shape/Train/EMouse.js index 36f17f0f1..57d5c00c3 100644 --- a/src/jmapNew/shape/Train/EMouse.js +++ b/src/jmapNew/shape/Train/EMouse.js @@ -16,11 +16,11 @@ class EMouse extends Group { if (this.device.style.Train.soonerOrLater && this.device.style.Train.soonerOrLater.level === 5) { if (this.device.model.dt > 120) { 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' : '早点'; - } 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' : '晚点'; - } else if (this.device.mode.dt < -120) { + } else if (this.device.model.dt < -120) { destinationText = LangStorage.getLang() == 'en' ? 'late seriously ' : '严重晚点'; } else { destinationText = LangStorage.getLang() == 'en' ? 'on time' : '准点'; diff --git a/src/jmapNew/shape/Train/TrainBody.js b/src/jmapNew/shape/Train/TrainBody.js index cf62fbec8..c2517a597 100644 --- a/src/jmapNew/shape/Train/TrainBody.js +++ b/src/jmapNew/shape/Train/TrainBody.js @@ -26,7 +26,6 @@ export default class TrainBody extends Group { store.dispatch('map/setTrainDetails', this.deviceModel); this.mouseEvent.mouseover(); } - this.on('mouseover', () => { store.dispatch('map/setTrainDetails', this.deviceModel); this.mouseEvent.mouseover(); @@ -40,13 +39,89 @@ export default class TrainBody extends Group { create() { const model = this.model; 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({ zlevel: model.zlevel, z: model.z, point: model.point, style: style }); - const beginX = (model.point.x + style.Train.trainBody.lrPadding); 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; @@ -54,7 +129,7 @@ export default class TrainBody extends Group { this.textH = style.Train.common.haveTextHSDA ? new ETextName({ zlevel: model.zlevel, z: model.z, - x: parseInt(beginX + margin * 0), + x: parseInt(beginX), y: parseInt(beginY), text: style.Train.hsda.textHContent, textFill: style.trainYellowColor, @@ -66,7 +141,7 @@ export default class TrainBody extends Group { this.textS = style.Train.common.haveTextHSDA ? new ETextName({ zlevel: model.zlevel, z: model.z, - x: parseInt(beginX + margin * 1), + x: parseInt(beginX + margin), y: parseInt(beginY), text: style.Train.hsda.textSContent, textFill: style.trainBlueColor, @@ -99,81 +174,6 @@ export default class TrainBody extends Group { textAlign: 'middle', 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); if (style.Train.common.haveTextHSDA) { this.add(this.textH); @@ -276,22 +276,6 @@ export default class TrainBody extends Group { setTrainColor(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) { if (this.textH) { isShow ? this.textH.show() : this.textH.hide(); @@ -327,14 +311,14 @@ export default class TrainBody extends Group { if (this.textTrainServer) { const tempRect = this.textTrainServer.getBoundingRect().clone(); return tempRect; + } else if (this.textTrainTrip) { + const tempRect = this.textTrainTrip.getBoundingRect().clone(); + return tempRect; } else if (this.textTrainTarget) { const tempRect = this.textTrainTarget.getBoundingRect().clone(); return tempRect; - } else if (this.textTrainNumber) { - const tempRect = this.textTrainNumber.getBoundingRect().clone(); - return tempRect; - } else if (this.textTrainTargetNumber) { - const tempRect = this.textTrainTargetNumber.getBoundingRect().clone(); + } else if (this.textTrainGroup) { + const tempRect = this.textTrainGroup.getBoundingRect().clone(); return tempRect; } else { return new BoundingRect(0, 0, 0, 0); @@ -342,22 +326,22 @@ export default class TrainBody extends Group { } setPlanRoutingTypeColor(planRoutingTypes) { 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') { - 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') { - 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) { 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') { - this.style.Train.trainTargetNumber.manualTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.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.trainTargetNumber.manualTypeColor && this.textTrainGroup && this.textTrainGroup.setStyle({textFill: this.style.Train.trainTargetNumber.manualTypeColor}); + this.style.Train.trainNumber.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainNumber.headTypeColor}); } else if (type === 'HEAD') { - this.style.Train.trainTargetNumber.headTypeColor && this.textTrainTargetNumber && this.textTrainTargetNumber.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.trainTargetNumber.headTypeColor && this.textTrainGroup && this.textTrainGroup.setStyle({textFill: this.style.Train.trainTargetNumber.headTypeColor}); + this.style.Train.trainNumber.headTypeColor && this.textTrainTarget && this.textTrainTarget.setStyle({textFill: this.style.Train.trainNumber.headTypeColor}); } } setSoonerOrLater(dt) { @@ -374,23 +358,16 @@ export default class TrainBody extends Group { } else if (dt < -120) { this.trainBodyBox && this.trainBodyBox.setColor({stroke: 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) { if (dt > 120) { 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}); } else if (dt < -120) { 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}); - } 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; arr.forEach(ele => { if (ele == 'targetCode') { - !style.Train.common.fixedCoordinates && this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); - widthText += this.textTrainNumber.getBoundingRect().width; - this.add(this.textTrainNumber); + !style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); + widthText += this.textTrainTarget.getBoundingRect().width; + this.add(this.textTrainTarget); } else if (ele == 'serviceNumber') { !style.Train.common.fixedCoordinates && this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); widthText += this.textTrainServer.getBoundingRect().width; this.add(this.textTrainServer); } else if (ele == 'tripNumber') { - !style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTarget.getBoundingRect().width; - this.add(this.textTrainTarget); + !style.Train.common.fixedCoordinates && this.textTrainTrip.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); + widthText += this.textTrainTrip.getBoundingRect().width; + this.add(this.textTrainTrip); } 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.textTrainTargetNumberMask && this.textTrainTargetNumberMask.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTargetNumber.getBoundingRect().width; - this.add(this.textTrainTargetNumber); - this.textTrainTargetNumberMask && this.add(this.textTrainTargetNumberMask); + !style.Train.common.fixedCoordinates && this.textTrainGroup.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.textTrainGroup.getBoundingRect().width; + this.add(this.textTrainGroup); + this.textTrainGroupMask && this.add(this.textTrainGroupMask); } }); + if (style.Train.trainBody.changeTrainWidth) { + style.Train.common.trainWidth = widthText + style.Train.common.trainWidthMoreText; + } } } } diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 728d4de11..d87469e5a 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -2,7 +2,6 @@ import Group from 'zrender/src/container/Group'; import TrainHead from './TrainHead'; import TrainBody from './TrainBody'; import BoundingRect from 'zrender/src/core/BoundingRect'; -import Rect from 'zrender/src/graphic/shape/Rect'; import ETriangle from '../Train/ETriangle'; import store from '@/store/index_APP_TARGET'; import EDirection from './EDirection'; @@ -59,7 +58,6 @@ export default class Train extends Group { } create() { this._computed(); - this.isChangeTrainWidth(this.model, this.style); const model = this.model; const style = this.style; if (this.point) { @@ -133,7 +131,7 @@ export default class Train extends Group { if (oldPoint) { const temp = Math.sqrt( 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.lineLength += temp; @@ -161,9 +159,6 @@ export default class Train extends Group { this.add(this.trainL); this.add(this.trainR); } - if (style.Train.common.haveTrainBorder) { - this.createTrainBorder(); - } if (style.Train.directionArrow.hasArrow) { // 列车运行上下方箭头(eg:宁波yi) const arrowPoint = { x: 0, y: 0 }; if (model.trainWindowModel) { @@ -361,36 +356,6 @@ export default class Train extends Group { 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() { this.trainB && this.trainB.removeTrainDetail(); } @@ -412,27 +377,6 @@ export default class Train extends Group { }); 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() { } initShowStation(model) { if (model.trainWindowModel && model.trainWindowModel.instance && !model.trainWindowModel.instance.isShowShape) { @@ -447,8 +391,6 @@ export default class Train extends Group { item.show(); }); this.isShowShape = true; - this.nextPointIndex = 1; - this.currentAdd = 0; this.setState(this.model, this); } else { this.eachChild(item => { diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 836771751..778caeb7b 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,11 +2,11 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // 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.6: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://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛