From fd8b2402add0f1dcfb28335b8a17c3805a5996f4 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Mon, 5 Aug 2019 15:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E5=88=97=E8=BD=A6?= =?UTF-8?q?=E6=88=90=E9=83=BD=E7=BA=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmap/config/skinStyle/bejing_01.js | 7 ++-- src/jmap/config/skinStyle/chengdu_03.js | 10 +++--- src/jmap/config/skinStyle/fuzhou_01.js | 11 +++--- src/jmap/shape/Train/TrainBody/index.js | 46 ++++--------------------- src/jmap/shape/Train/index.js | 12 +++---- 5 files changed, 26 insertions(+), 60 deletions(-) diff --git a/src/jmap/config/skinStyle/bejing_01.js b/src/jmap/config/skinStyle/bejing_01.js index 2ec108703..5bdabc8d3 100644 --- a/src/jmap/config/skinStyle/bejing_01.js +++ b/src/jmap/config/skinStyle/bejing_01.js @@ -351,11 +351,11 @@ class SkinStyle extends defaultStyle { textTrainTargetNumber: false }, // 车身鼠标移出事件 changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 - dynamicLoadingDisplay: false, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 specialTrainType: [], // 特殊列车类型需设置显示格式 lrPadding: 4, // 两边间隔 upPadding: 4, // 上边距离 - trainBodyFillColor: '#725A64'// 列车车身填充颜色 + trainBodyFillColor: '#725A64', // 列车车身填充颜色 + trainNameFormat: 'serviceNumber:tripNumber'// 列车显示格式 }, hsda: { lrPaddingHSDA: 3, // HSDA两边间隔 @@ -377,9 +377,10 @@ class SkinStyle extends defaultStyle { tripNumberPrefix: '000', // 车次号前缀 defaultTripNumber: 'DDD', // 默认车次号2 trainTargetOffset: { x: 36, y: 4}, // 列车车次号偏移 - trainTargetTextAlign: 'right'// 目的地码文字显示位置 + trainTargetTextAlign: 'right'// 车次号文字显示位置 }, trainTargetNumber: { + trainTargetNumberOffset: {x: 0, y: 0}// 车组号偏移量 }, trainHead: { trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框 diff --git a/src/jmap/config/skinStyle/chengdu_03.js b/src/jmap/config/skinStyle/chengdu_03.js index 53189e2b3..d666b2cbc 100644 --- a/src/jmap/config/skinStyle/chengdu_03.js +++ b/src/jmap/config/skinStyle/chengdu_03.js @@ -313,7 +313,6 @@ class SkinStyle extends defaultStyle { textTrainTargetNumber: false }, // 车身鼠标移出事件 changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 - dynamicLoadingDisplay: true, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 specialTrainType: [], // 特殊列车类型需设置显示格式 lrPadding: 4, // 两边间隔 upPadding: 4, // 上边距离 @@ -332,7 +331,8 @@ class SkinStyle extends defaultStyle { trainNumber: { targetCodePrefix: '000', // 目的地码前缀 defaultTargetCode: 'DDD', // 默认目的地码 - trainTargetTextAlign: 'left'// 目的地码文字显示位置 + trainTargetTextAlign: 'left', // 目的地码文字显示位置 + trainNumberOffset: { x: 24, y: 4}// 目的地码偏移量 }, trainServer: { serviceNumberPrefix: '000', // 服务号(表号)前缀 @@ -344,9 +344,10 @@ class SkinStyle extends defaultStyle { tripNumberPrefix: '000', // 车次号前缀 defaultTripNumber: 'DDD', // 默认车次号2 trainTargetOffset: { x: 36, y: 4}, // 列车车次号偏移 - trainTargetTextAlign: 'right' // 目的地码文字显示位置 + trainTargetTextAlign: 'right' // 车次号文字显示位置 }, trainTargetNumber: { + trainTargetNumberOffset: {x: 0, y: 0}// 车组号偏移量 }, trainHead: { trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框 @@ -358,10 +359,9 @@ class SkinStyle extends defaultStyle { trainHeadRectHeight: 20 // 列车车头矩形高度 }, common: { - trainHeight: 20, // 列车高度 trainHeadDistance: 4, // 列车和车头之间的间距 - trainWidth: 40, // 列车长度 + trainWidth: 48, // 列车长度 trainTextFontSize: 12, // 列车字号 textFontFormat: 'consolas', // 默认字体 族类 haveTextHSDA: true, // 是否需创建textHSDA对象 diff --git a/src/jmap/config/skinStyle/fuzhou_01.js b/src/jmap/config/skinStyle/fuzhou_01.js index 6324b43d4..b8152ea0f 100644 --- a/src/jmap/config/skinStyle/fuzhou_01.js +++ b/src/jmap/config/skinStyle/fuzhou_01.js @@ -261,7 +261,6 @@ class SkinStyle extends defaultStyle { textTrainTargetNumber: false }, // 车身鼠标移出事件 changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 - dynamicLoadingDisplay: true, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 specialTrainType: [ { type: '03', @@ -280,22 +279,24 @@ class SkinStyle extends defaultStyle { trainNumber: { targetCodePrefix: '000', // 目的地码前缀 defaultTargetCode: 'AAA', // 默认目的地码 - trainTargetTextAlign: 'left'// 目的地码文字显示位置 + trainTargetTextAlign: 'left', // 车次号文字显示位置 + trainNumberOffset: { x: 0, y: 1}// 目的地码偏移量 }, trainServer: { serviceNumberPrefix: '00', // 服务号(表号)前缀 defaultServiceNumber: 'BB', // 默认服务号(表号) - trainServerOffset: { x: -1, y: 1}// 列车服务号偏移 + trainServerOffset: { x: 16, y: 1}// 列车服务号偏移 }, trainTarget: { tripNumberPrefix: '0000', // 车次号前缀 defaultDirectionCode: 'D', // 默认车次号1 defaultTripNumber: 'CCC', // 默认车次号2 - trainTargetOffset: { x: -1, y: 1}// 列车车次号偏移 + trainTargetOffset: { x: 26, y: 1}// 列车车次号偏移 }, trainTargetNumber: { groupNumberPrefix: '000', // 车组号前缀 - defaultGroupNumber: 'EEE'// 默认车组号 + defaultGroupNumber: 'EEE', // 默认车组号 + trainTargetNumberOffset: {x: 0, y: 0}// 车组号偏移量 }, trainHead: { trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框 diff --git a/src/jmap/shape/Train/TrainBody/index.js b/src/jmap/shape/Train/TrainBody/index.js index ac4d61cd2..6f6b2185b 100644 --- a/src/jmap/shape/Train/TrainBody/index.js +++ b/src/jmap/shape/Train/TrainBody/index.js @@ -146,16 +146,10 @@ export default class TrainBody extends Group { } }); } - if ( style.Train.trainBody.dynamicLoadingDisplay ) { - this.formatChangePosition(model, style); - } else { - this.add(this.textTrainServer); - this.add(this.textTrainTarget); - this.add(this.textHSDA); - } + this.formatChangePosition(model, style); this.add(this.train); this.add(this.arrowText); - + this.add(this.textHSDA); } removeTrainDetail() { @@ -194,47 +188,19 @@ export default class TrainBody extends Group { const arr = style.Train.trainBody.trainNameFormat.split(':'); arr.forEach(ele => { if (ele == 'targetCode') { + this.textTrainNumber.setShapeStyle('x', parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x)); this.add(this.textTrainNumber); } else if (ele == 'serviceNumber') { - const show = arr.includes('targetCode'); - if (show) { - this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding)); - } + this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x)); this.add(this.textTrainServer); } else if (ele == 'tripNumber') { - const show = arr.includes('targetCode'); - const serverNoShow = arr.includes('serviceNumber'); - if (show) { - this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding)); - } - if (serverNoShow) { - this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding)); - } - if (serverNoShow && show) { - this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.trainBody.lrPadding)); - } + this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + style.Train.trainTarget.trainTargetOffset.x)); this.add(this.textTrainTarget); } else if (ele == 'groupNumber') { - const show = arr.includes('targetCode'); - const serverNoShow = arr.includes('serviceNumber'); - if (show) { - this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding)); - } - if (serverNoShow) { - this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding)); - } - if (serverNoShow && show) { - this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.trainBody.lrPadding)); - } + this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + style.Train.textTrainTargetNumber.trainTargetNumberOffset.x)); this.add(this.textTrainTargetNumber); } }); - } else { - this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + 27 - style.Train.trainBody.lrPadding)); - this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + 43 - style.Train.trainBody.lrPadding)); - this.add(this.textTrainServer); - this.add(this.textTrainTarget); - this.add(this.textTrainNumber); } } } diff --git a/src/jmap/shape/Train/index.js b/src/jmap/shape/Train/index.js index 476108fe1..ca396517d 100644 --- a/src/jmap/shape/Train/index.js +++ b/src/jmap/shape/Train/index.js @@ -30,7 +30,6 @@ export default class Train extends Group { x: model.trainWindowModel.point.x, y: model.trainWindowModel.point.y }; - switch (model.directionType) { case '01': // 未知方向 this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2); @@ -292,19 +291,19 @@ export default class Train extends Group { arr.forEach(ele => { switch (ele) { case 'targetCode': { - this.size += 3; + this.size += style.Train.trainNumber.targetCodePrefix.length || 0; break; } case 'serviceNumber': { - this.size += 2; + this.size += style.Train.trainServer.serviceNumberPrefix.length || 0; break; } case 'tripNumber': { - this.size += 4; + this.size += style.Train.trainTarget.tripNumberPrefix.length || 0; break; } case 'groupNumber': { - this.size += 3; + this.size += style.Train.trainTargetNumber.groupNumberPrefix.length || 0; break; } } @@ -312,8 +311,7 @@ export default class Train extends Group { } else { this.size = 9; } - - this.style.Train.common.trainWidth = this.size * this.fontSize * (2 / 3) - 16; + this.style.Train.common.trainWidth = this.size * this.fontSize * (2 / 3) -16; } removeTrainDetail() { this.trainB.removeTrainDetail();