修改:根据包围盒去计算识别号位置
This commit is contained in:
parent
84f388b2d8
commit
f5152e5807
@ -457,7 +457,6 @@ class SkinCode extends defaultStyle {
|
|||||||
haveTextHSDA: true, // 是否需创建textHSDA对象
|
haveTextHSDA: true, // 是否需创建textHSDA对象
|
||||||
haveArrowText: true, // 是否需创建arrowText对象
|
haveArrowText: true, // 是否需创建arrowText对象
|
||||||
haveTrainBorder: false, // 是否需创建trainBorder对象
|
haveTrainBorder: false, // 是否需创建trainBorder对象
|
||||||
aspectRatio: 7/5, // 字体宽高比例(用以拼接text是计算位置)
|
|
||||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||||
useSelfFormat: true, // 使用配置项的nameFormat
|
useSelfFormat: true, // 使用配置项的nameFormat
|
||||||
|
@ -423,7 +423,6 @@ class SkinCode extends defaultStyle {
|
|||||||
haveTextHSDA: true, // 是否需创建textHSDA对象
|
haveTextHSDA: true, // 是否需创建textHSDA对象
|
||||||
haveArrowText: true, // 是否需创建arrowText对象
|
haveArrowText: true, // 是否需创建arrowText对象
|
||||||
haveTrainBorder: false, // 是否需创建trainBorder对象
|
haveTrainBorder: false, // 是否需创建trainBorder对象
|
||||||
aspectRatio: 4/7, // 字体宽高比例(用以拼接text是计算位置)
|
|
||||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||||
useSelfFormat: true, // 使用配置项的nameFormat
|
useSelfFormat: true, // 使用配置项的nameFormat
|
||||||
|
@ -371,7 +371,6 @@ class SkinCode extends defaultStyle {
|
|||||||
haveTextHSDA: false, // 是否需创建textHSDA对象
|
haveTextHSDA: false, // 是否需创建textHSDA对象
|
||||||
haveArrowText: true, // 是否需创建arrowText对象
|
haveArrowText: true, // 是否需创建arrowText对象
|
||||||
haveTrainBorder: false, // 是否需创建trainBorder对象
|
haveTrainBorder: false, // 是否需创建trainBorder对象
|
||||||
aspectRatio: 8/15, // 字体宽高比例(用以拼接text是计算位置)
|
|
||||||
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
||||||
trainWidthMoreText: 2 // 计算列车长度时--列车长比text多出尺寸
|
trainWidthMoreText: 2 // 计算列车长度时--列车长比text多出尺寸
|
||||||
},
|
},
|
||||||
|
@ -217,23 +217,23 @@ export default class TrainBody extends Group {
|
|||||||
formatChangePosition(model, style) {
|
formatChangePosition(model, style) {
|
||||||
if (this.nameFormat) {
|
if (this.nameFormat) {
|
||||||
const arr = this.nameFormat.split(':');
|
const arr = this.nameFormat.split(':');
|
||||||
let fontNumber = 0;
|
let widthText = 0;
|
||||||
arr.forEach(ele => {
|
arr.forEach(ele => {
|
||||||
if (ele == 'targetCode') {
|
if (ele == 'targetCode') {
|
||||||
this.textTrainNumber.setStyle('x', parseInt(model.point.x + fontNumber * model.fontSize * style.Train.common.aspectRatio + style.Train.common.textOffset) );
|
this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) );
|
||||||
fontNumber += (style.Train.trainNumber.targetCodePrefix || '').length;
|
widthText += this.textTrainNumber.getBoundingRect().width;
|
||||||
this.add(this.textTrainNumber);
|
this.add(this.textTrainNumber);
|
||||||
} else if (ele == 'serviceNumber') {
|
} else if (ele == 'serviceNumber') {
|
||||||
this.textTrainServer.setStyle('x', parseInt(model.point.x + fontNumber * model.fontSize * style.Train.common.aspectRatio + style.Train.common.textOffset));
|
this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
|
||||||
fontNumber += (style.Train.trainServer.serviceNumberPrefix || '').length;
|
widthText += this.textTrainServer.getBoundingRect().width;
|
||||||
this.add(this.textTrainServer);
|
this.add(this.textTrainServer);
|
||||||
} else if (ele == 'tripNumber') {
|
} else if (ele == 'tripNumber') {
|
||||||
this.textTrainTarget.setStyle('x', parseInt(model.point.x + fontNumber * model.fontSize * style.Train.common.aspectRatio + style.Train.common.textOffset));
|
this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
|
||||||
fontNumber += (style.Train.trainTarget.tripNumberPrefix || '').length;
|
widthText += this.textTrainTarget.getBoundingRect().width;
|
||||||
this.add(this.textTrainTarget);
|
this.add(this.textTrainTarget);
|
||||||
} else if (ele == 'groupNumber') {
|
} else if (ele == 'groupNumber') {
|
||||||
this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + fontNumber * model.fontSize * style.Train.common.aspectRatio + style.Train.common.textOffset));
|
this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
|
||||||
fontNumber += (style.Train.trainTargetNumber.groupNumberPrefix || '').length;
|
widthText += this.textTrainTargetNumber.getBoundingRect().width;
|
||||||
this.add(this.textTrainTargetNumber);
|
this.add(this.textTrainTargetNumber);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user