This commit is contained in:
ival 2019-07-29 09:27:49 +08:00
commit 10cd98fe6f
10 changed files with 77 additions and 42 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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] = {
/** 车次窗颜色*/

View File

@ -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] = {
/** 车次窗颜色*/

View File

@ -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] = {
/** 车次窗颜色*/

View File

@ -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] = {
/** 车次窗颜色*/