diff --git a/src/jmap/shape/Train/TrainBody/TextTrainNumber.js b/src/jmap/shape/Train/TrainBody/TextTrainNumber.js index c4bee77df..02499c220 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainNumber.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainNumber.js @@ -10,7 +10,7 @@ export default class TextTrainNumber extends Group { _create() { const model = this.model; this.textTrainNumber = new Text({ - zlevel: model.zlevel, + zlevel: model.zlevel+1, z: model.z, style: { x: parseInt(model.point.x + model.lrPadding), @@ -24,7 +24,7 @@ export default class TextTrainNumber extends Group { textAlign: 'left', textVerticalAlign: 'top' }, - cursor: 'pointer', + cursor: 'pointer' }); this.add(this.textTrainNumber); } diff --git a/src/jmap/shape/Train/TrainBody/TextTrainServer.js b/src/jmap/shape/Train/TrainBody/TextTrainServer.js index 8c1a804bd..5d91c0f67 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainServer.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainServer.js @@ -12,15 +12,15 @@ export default class TextTrainServer extends Group { zlevel: this.model.zlevel, z: this.model.z+1, style: { - x: parseInt(this.model.point.x + this.model.lrPadding), - y: parseInt(this.model.point.y + this.model.upPadding), + x: parseInt(this.model.point.x + this.model.style.Train.trainServerOffset.y), + y: parseInt(this.model.point.y + this.model.style.Train.trainServerOffset.y), text: this.model.serviceNumber.substring(this.model.serviceNumber.length - 2), textFill: this.model.trainBrownColor, textFont: this.model.textFont, textAlign: 'left', textVerticalAlign: 'top' }, - cursor: 'pointer', + cursor: 'pointer' }); this.add(this.textTrainServer); } diff --git a/src/jmap/shape/Train/TrainBody/TextTrainTarget.js b/src/jmap/shape/Train/TrainBody/TextTrainTarget.js index 2775730d0..2a2b1e491 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainTarget.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainTarget.js @@ -12,15 +12,15 @@ export default class TextTrainTarget extends Group { zlevel: this.model.zlevel, z: this.model.z+1, style: { - x: parseInt(this.model.point.x + this.model.trainWidth - this.model.lrPadding), - y: parseInt(this.model.point.y + this.model.upPadding), + x: parseInt(this.model.point.x + this.model.style.Train.trainTargetOffset.x), + y: parseInt(this.model.point.y + this.model.style.Train.trainTargetOffset.y), text: this.model.tripNumber.substring(this.model.tripNumber.length - 3), textFill: this.model.trainYellowColor, textFont: this.model.textFont, - textAlign: 'right', + textAlign: this.model.style.Train.trainTargetTextAlign, textVerticalAlign: 'top' }, - cursor: 'pointer', + cursor: 'pointer' }); this.add(this.textTrainTarget); } diff --git a/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js b/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js index ad3123a88..c33c2202e 100644 --- a/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js +++ b/src/jmap/shape/Train/TrainBody/TextTrainTargetNumber.js @@ -11,7 +11,7 @@ export default class TextTrainTargetNumber extends Group { const model = this.model; this.textTrainTargetNumber = new Text({ zlevel: model.zlevel, - z: model.z, + z: model.z+1, style: { x: parseInt(model.point.x - model.lrPadding), y: parseInt(model.point.y + model.upPadding), @@ -23,7 +23,7 @@ export default class TextTrainTargetNumber extends Group { textAlign: 'left', textVerticalAlign: 'top' }, - cursor: 'pointer', + cursor: 'pointer' }); this.add(this.textTrainTargetNumber); } diff --git a/src/jmap/shape/Train/TrainBody/index.js b/src/jmap/shape/Train/TrainBody/index.js index d5e7c573c..7e97936f6 100644 --- a/src/jmap/shape/Train/TrainBody/index.js +++ b/src/jmap/shape/Train/TrainBody/index.js @@ -18,7 +18,7 @@ export default class TrainBody extends Group { _create() { const model = this.model; const style = this.model.style; - const textFont = style.Train.trainTextFontSize + 'px ' + style.Train.textFontFormat; + const textFont = model.fontSize + 'px ' + style.Train.textFontFormat; const TextFontHSDA = style.Train.trainHSDATextFontSize + 'px ' + style.Train.textFontFormat; let destinationText = ''; @@ -99,8 +99,7 @@ export default class TrainBody extends Group { zlevel: model.zlevel, z: model.z, point: model.point, - lrPadding: style.Train.lrPadding, - upPadding: style.Train.upPadding, + style: style, serviceNumber: serviceNumber, trainBrownColor: style.trainTextColor, textFont: textFont, @@ -113,8 +112,7 @@ export default class TrainBody extends Group { z: model.z, point: model.point, trainWidth: model.style.Train.trainWidth, - lrPadding: style.Train.lrPadding, - upPadding: style.Train.upPadding, + style: style, tripNumber: tripNumber, trainYellowColor: style.trainTextColor, textFont: textFont, @@ -149,10 +147,11 @@ export default class TrainBody extends Group { }); // 根据列车类型设置显示格式 if ( style.Train.specialTrainType.length > 0) { - style.Train.specialTrainType.forEach((item) =>{ + style.Train.specialTrainType.some((item) =>{ if (model.type === item.type) { serviceNumber = item.serviceNumber; - model.nameFormat = item.nameFormat; + style.Train.nameFormat = item.nameFormat; + return true; } }); } @@ -195,8 +194,8 @@ export default class TrainBody extends Group { this.textHSDA && this.textHSDA.setAShow(isShow); } formatChangePosition(model, style) { - if (model.nameFormat) { - const arr = model.nameFormat.split(':'); + if (style.Train.trainNameFormat) { + const arr = style.Train.trainNameFormat.split(':'); arr.forEach(ele => { if (ele == 'targetCode') { this.add(this.textTrainNumber); diff --git a/src/jmap/shape/Train/index.js b/src/jmap/shape/Train/index.js index 8e00d372f..0b20afea1 100644 --- a/src/jmap/shape/Train/index.js +++ b/src/jmap/shape/Train/index.js @@ -15,7 +15,7 @@ export default class Train extends Group { this.style = style; this.z = 40; this.section = null; - this.fontSize = model.nameFontSize || style.Train.trainTextFontSize; + this.fontSize = style.Train.nameFontSize || style.Train.trainTextFontSize; this.newScale = this.fontSize / style.Train.trainTextFontSize; this._create(); this.setState(model); diff --git a/src/jmap/theme/batong.js b/src/jmap/theme/batong.js index 68540ffb9..ec1af9a5d 100644 --- a/src/jmap/theme/batong.js +++ b/src/jmap/theme/batong.js @@ -239,7 +239,11 @@ class Batong extends defaultSkin { /** 道岔反位颜色*/ switchInversionColor: '#9C9D09', /** 道岔单锁颜色*/ - switchMonolockColor: '#870E10' + switchMonolockColor: '#870E10', + /** 列车服务号偏移 */ + trainServerOffset: { x: -1, y: 1}, + /** 列车车次号偏移 */ + trainTargetOffset: { x: -1, y: 1} }; this[deviceType.Train] = { /** 车身line宽 */ @@ -328,10 +332,10 @@ class Batong extends defaultSkin { * 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ runModeStatus: [ {status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'}, - {status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'}, - {status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, - {status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'} + {status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, + {status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, + {status: '04', trainLColor: '#EA700D', trainRColor: '#EA700D'}, + {status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} ], /** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */ runControlStatus: [], @@ -344,7 +348,17 @@ class Batong extends defaultSkin { /** 列车车头矩形填充颜色 */ trainHeadFillColor: '#EF0C08', /** 列车车身填充颜色 */ - trainBodyFillColor: '#000000' + trainBodyFillColor: '#000000', + /** 列车服务号偏移 */ + trainServerOffset: { x: -1, y: 1}, + /** 列车车次号偏移 */ + trainTargetOffset: { x: -1, y: 1}, + /** 列车显示格式 */ + trainNameFormat: 'targetCode:serviceNumber:tripNumber', + /** 字体大小 */ + nameFontSize: 10, + /** 目的地码文字显示位置 */ + trainTargetTextAlign: 'left' }; this[deviceType.TrainWindow] = { /** 车次窗颜色*/ diff --git a/src/jmap/theme/bejing.js b/src/jmap/theme/bejing.js index e6a7c4cfd..2bce78b2e 100644 --- a/src/jmap/theme/bejing.js +++ b/src/jmap/theme/bejing.js @@ -362,10 +362,10 @@ class Beijing extends defaultSkin { * 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ runModeStatus: [ {status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'}, - {status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'}, - {status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'} + {status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, + {status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, + {status: '04', trainLColor: '#A0522D', trainRColor: '#A0522D'}, + {status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} ], /** 设置运行控制状态类型 01正常 02扣车 03停跳 */ runControlStatus: [ @@ -405,7 +405,13 @@ class Beijing extends defaultSkin { /** 是否需创建arrowText对象 */ haveArrowText: true, /** 是否需创建trainBorder对象 */ - haveTrainBorder: false + haveTrainBorder: false, + /** 列车服务号偏移 */ + trainServerOffset: { x: 4, y: 4}, + /** 列车车次号偏移 */ + trainTargetOffset: { x: 36, y: 4}, + /** 目的地码文字显示位置 */ + trainTargetTextAlign: 'right' }; this[deviceType.TrainWindow] = { /** 车次窗颜色*/ diff --git a/src/jmap/theme/chengdu.js b/src/jmap/theme/chengdu.js index fad8091c6..b5f185018 100644 --- a/src/jmap/theme/chengdu.js +++ b/src/jmap/theme/chengdu.js @@ -317,10 +317,10 @@ class Beijing extends defaultSkin { * 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ runModeStatus: [ {status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'}, - {status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'}, - {status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'} + {status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, + {status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, + {status: '04', trainLColor: '#A0522D', trainRColor: '#A0522D'}, + {status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} ], /** 设置运行控制状态类型 01正常 02扣车 03停跳 */ runControlStatus: [ @@ -357,7 +357,13 @@ class Beijing extends defaultSkin { /** 是否需创建arrowText对象 */ haveArrowText: false, /** 是否需创建trainBorder对象 */ - haveTrainBorder: false + haveTrainBorder: false, + /** 列车服务号偏移 */ + trainServerOffset: { x: 4, y: 4}, + /** 列车车次号偏移 */ + trainTargetOffset: { x: 56, y: 4}, + /** 目的地码文字显示位置 */ + trainTargetTextAlign: 'right' }; this[deviceType.TrainWindow] = { /** 车次窗颜色*/ diff --git a/src/jmap/theme/fuzhou.js b/src/jmap/theme/fuzhou.js index 87cd5230b..76874fb82 100644 --- a/src/jmap/theme/fuzhou.js +++ b/src/jmap/theme/fuzhou.js @@ -327,10 +327,10 @@ class Fuzhou extends defaultSkin { * 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ runModeStatus: [ {status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'}, - {status: '01', trainLColor: '#00FF00', trainRColor: '#00FF00'}, - {status: '01', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, - {status: '01', trainLColor: '#EA700D', trainRColor: '#EA700D'}, - {status: '01', trainLColor: '#A0522D', trainRColor: '#A0522D'} + {status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, + {status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, + {status: '04', trainLColor: '#EA700D', trainRColor: '#EA700D'}, + {status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} ], /** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */ runControlStatus: [], @@ -343,7 +343,17 @@ class Fuzhou extends defaultSkin { /** 列车车头矩形填充颜色 */ trainHeadFillColor: '#EF0C08', /** 列车车身填充颜色 */ - trainBodyFillColor: '#000000' + trainBodyFillColor: '#000000', + /** 列车服务号偏移 */ + trainServerOffset: { x: -1, y: 1}, + /** 列车车次号偏移 */ + trainTargetOffset: { x: -1, y: 1}, + /** 列车显示格式 */ + trainNameFormat: 'targetCode:serviceNumber:tripNumber', + /** 字体大小 */ + nameFontSize: 10, + /** 目的地码文字显示位置 */ + trainTargetTextAlign: 'left' }; this[deviceType.TrainWindow] = { /** 车次窗颜色*/