调整:列车调整

This commit is contained in:
fan 2019-08-05 13:36:00 +08:00
parent 072495709a
commit 15d0ea03e5
9 changed files with 416 additions and 373 deletions

View File

@ -330,142 +330,158 @@ class SkinStyle extends defaultStyle {
}; };
this[deviceType.Train] = { this[deviceType.Train] = {
/** 车身line宽 */ trainBody: {
trainBodyLineWidth: 0.1, trainBodyLineWidth: 0.1, // 车身line宽
/** 车身鼠标悬浮事件 */ trainBodyOnMouseOver: {
trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, train: true,
/** 车身鼠标移出事件 */ textTrainNumber: false,
trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, textTrainServer: false,
/** 服务号(表号)前缀 */ textTrainTarget: false,
serviceNumberPrefix: '00', textTrainTargetNumber: false
/** 默认服务号(表号) */ }, // 车身鼠标悬浮事件
defaultServiceNumber: 'AA', trainBodyOnMouseOut: {
/** 车次号前缀 */ train: true,
tripNumberPrefix: '000', textTrainNumber: false,
/** 默认车次号2 */ textTrainServer: false,
defaultTripNumber: 'DDD', textTrainTarget: false,
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ textTrainTargetNumber: false
trainMoreLength: 0, }, // 车身鼠标移出事件
/** 列车车头三角坐标1偏移量 */ changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
trainHeadTriangleFirst: { x: 7, y: 1}, dynamicLoadingDisplay: false, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码
/** 列车车头三角坐标2偏移量 */ specialTrainType: [], // 特殊列车类型需设置显示格式
trainHeadTriangleSecond: { x: 13, y: 10}, lrPadding: 4, // 两边间隔
/** 列车车头三角坐标3偏移量 */ upPadding: 4, // 上边距离
trainHeadTriangleThird: { x: 7, y: 19}, trainBodyFillColor: '#725A64'// 列车车身填充颜色
/** 列车高度*/ },
trainHeight: 20, hsda: {
/** 列车和车头之间的间距*/ lrPaddingHSDA: 3, // HSDA两边间隔
trainHeadDistance: 4, upPaddingHSDA: 4, // HSDA上边距离
/** 列车车头矩形高度 */ trainHSDATextFontSize: 9, // 列车HDSA字号
trainHeadRectHeight: 20, textHContent: 'H', // textH文本
/** 列车长度*/ textSContent: 'S', // textS文本
trainWidth: 40, textDContent: 'D', // textD文本
/** 列车竖杠的宽度*/ textAContent: 'A'// textA文本
trainConntWidth: 3, },
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */ trainNumber: {
changeTrainWidth: false, },
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */ trainServer: {
dynamicLoadingDisplay: false, serviceNumberPrefix: '00', // 服务号(表号)前缀
/** 特殊列车类型需设置显示格式 */ defaultServiceNumber: 'AA', // 默认服务号(表号)
specialTrainType: [], trainServerOffset: { x: 4, y: 4}// 列车服务号偏移
/** 两边间隔 */ },
lrPadding: 4, trainTarget: {
/** 上边距离 */ tripNumberPrefix: '000', // 车次号前缀
upPadding: 4, defaultTripNumber: 'DDD', // 默认车次号2
/** HSDA两边间隔 */ trainTargetOffset: { x: 36, y: 4}, // 列车车次号偏移
lrPaddingHSDA: 3, trainTargetTextAlign: 'right'// 目的地码文字显示位置
/** HSDA上边距离 */ },
upPaddingHSDA: 4, trainTargetNumber: {
/** 列车字号*/ },
trainTextFontSize: 12, trainHead: {
/** 目的地状态 01准点 02早点 03晚点 04头码车 */ trainMoreLength: 0, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 7, y: 1}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 20, // 列车车头矩形高度
trainConntWidth: 3, // 列车竖杠的宽度
trainHeadFillColor: '#000000'// 列车车头矩形填充颜色
},
common: {
trainHeight: 20, // 列车高度
trainHeadDistance: 4, // 列车和车头之间的间距
trainWidth: 40, // 列车长度
trainTextFontSize: 12, // 列车字号
textFontFormat: 'consolas', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false// 是否需创建trainBorder对象
},
trainStatusStyle: {
destinationStatus: [ destinationStatus: [
{status: '01', showColor: '#FFFFFF'}, {status: '01', showColor: '#FFFFFF'},
{status: '02', showColor: '#00FF00'}, {status: '02', showColor: '#00FF00'},
{status: '03', showColor: '#A0522D'}, {status: '03', showColor: '#A0522D'},
{status: '04', showColor: '#FFFF00'} {status: '04', showColor: '#FFFF00'}
], ], // 目的地状态 01准点 02早点 03晚点 04头码车
/** 默认目的地状态显示颜色 */ defaultDestinationColor: '#FFFFFF', // 默认目的地状态显示颜色
defaultDestinationColor: '#FFFFFF', destinationStatusSetText: 'trainTarget', // 目的地状态设置的对应哪个text的颜色
/** 目的地状态设置的对应哪个text的颜色 */
destinationStatusSetText: 'trainTarget',
/** 默认字体 族类*/
textFontFormat: 'consolas',
/** 列车HDSA字号*/
trainHSDATextFontSize: 9,
/** 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车 */
serverNoType: [
{type: '01', showColor: '#FFFFFF'},
{type: '02', showColor: '#FFF000'}
],
/** 默认服务号状态显示颜色 */
defaultServerNoColor: '#FFFFFF',
/** 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [ directionType: [
{type: '01', lineLShow: true, lineRShow: true, arrowLShow: false, arrowRShow: false }, {
{type: '02', lineLShow: false, lineRShow: true, arrowLShow: false, arrowRShow: true }, type: '01',
{type: '03', lineLShow: true, lineRShow: false, arrowLShow: true, arrowRShow: false } lineLShow: true,
], lineRShow: true,
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */ arrowLShow: false,
arrowRShow: false
},
{
type: '02',
lineLShow: false,
lineRShow: true,
arrowLShow: false,
arrowRShow: true
},
{
type: '03',
lineLShow: true,
lineRShow: false,
arrowLShow: true,
arrowRShow: false
}
], // 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
directionStopType: [ directionStopType: [
{type: '01', lineLShow: false, lineRShow: false}, {type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true}, {type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false} {type: '03', lineLShow: true, lineRShow: false}
], ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
/** 01 02 ATOAM 03 ATPCM
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/
runModeStatus: [ runModeStatus: [
{status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'}, {
{status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, status: '01',
{status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, trainLColor: '#FFFFFF',
{status: '04', trainLColor: '#A0522D', trainRColor: '#A0522D'}, trainRColor: '#FFFFFF'
{status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} },
], {
/** 设置运行控制状态类型 01正常 02扣车 03停跳 */ 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 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM
runControlStatus: [ runControlStatus: [
{status: '01', hShow: false, sShow: false}, {status: '01', hShow: false, sShow: false},
{status: '02', hShow: true, sShow: false}, {status: '02', hShow: true, sShow: false},
{status: '03', hShow: false, sShow: true} {status: '03', hShow: false, sShow: true}
], ], // 设置运行控制状态类型 01正常 02扣车 03停跳
/** 设置车门状态类型 01关门 02开门 */
doorStatus: [ doorStatus: [
{status: '01', dShow: false}, {status: '01', dShow: false},
{status: '02', dShow: true} {status: '02', dShow: true}
], ], // 设置车门状态类型 01关门 02开门
/** 设置通信状态 01正常 02故障 */
communicationStatus: [ communicationStatus: [
{status: '01', trainColor: '#725A64'}, {status: '01', trainColor: '#725A64'},
{status: '02', trainColor: '#C0C0C0'} {status: '02', trainColor: '#C0C0C0'}
], ], // 设置通信状态 01正常 02故障
/** 设置报警状态 01不报警 02报警 */
alarmStatus: [ alarmStatus: [
{status: '01', aShow: false}, {status: '01', aShow: false},
{status: '02', aShow: true} {status: '02', aShow: true}
], ], // 设置报警状态 01不报警 02报警
/** 列车车头矩形填充颜色 */ serverNoType: [
trainHeadFillColor: '#000000', {type: '01', showColor: '#FFFFFF'},
/** 列车车身填充颜色 */ {type: '02', showColor: '#FFF000'}
trainBodyFillColor: '#725A64', ], // 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车
/** textH文本 */ defaultServerNoColor: '#FFFFFF' // 默认服务号状态显示颜色
textHContent: 'H', }
/** textS文本 */
textSContent: 'S',
/** textD文本 */
textDContent: 'D',
/** textA文本 */
textAContent: 'A',
/** 是否需创建textHSDA对象 */
haveTextHSDA: true,
/** 是否需创建arrowText对象 */
haveArrowText: true,
/** 是否需创建trainBorder对象 */
haveTrainBorder: false,
/** 列车服务号偏移 */
trainServerOffset: { x: 4, y: 4},
/** 列车车次号偏移 */
trainTargetOffset: { x: 36, y: 4},
/** 目的地码文字显示位置 */
trainTargetTextAlign: 'right'
}; };
} }
} }

View File

@ -301,26 +301,30 @@ class SkinStyle extends defaultStyle {
textTrainTargetNumber: false textTrainTargetNumber: false
}, // 车身鼠标移出事件 }, // 车身鼠标移出事件
changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
dynamicLoadingDisplay: false, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 dynamicLoadingDisplay: true, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码
specialTrainType: [], // 特殊列车类型需设置显示格式 specialTrainType: [], // 特殊列车类型需设置显示格式
lrPadding: 4, // 两边间隔 lrPadding: 4, // 两边间隔
upPadding: 4, // 上边距离 upPadding: 4, // 上边距离
trainBodyFillColor: '#000099'// 列车车身填充颜色 trainBodyFillColor: '#000099', // 列车车身填充颜色
trainNameFormat: 'serviceNumber:targetCode'// 列车显示格式
}, },
hsda: { hsda: {
lrPaddingHSDA: 3, // HSDA两边间隔 lrPaddingHSDA: 3, // HSDA两边间隔
upPaddingHSDA: 4, // HSDA上边距离 upPaddingHSDA: 4, // HSDA上边距离
trainHSDATextFontSize: 9, // 列车HDSA字号 trainHSDATextFontSize: 9, // 列车HDSA字号
textHContent: 'H', // textH文本 textHContent: '', // textH文本
textSContent: 'S', // textS文本 textSContent: '', // textS文本
textDContent: 'D', // textD文本 textDContent: '', // textD文本
textAContent: 'A' // textA文本 textAContent: '' // textA文本
}, },
trainNumber: { trainNumber: {
targetCodePrefix: '000', // 目的地码前缀
defaultTargetCode: 'DDD', // 默认目的地码
trainTargetTextAlign: 'left'// 目的地码文字显示位置
}, },
trainServer: { trainServer: {
serviceNumberPrefix: '00', // 服务号(表号)前缀 serviceNumberPrefix: '000', // 服务号(表号)前缀
defaultServiceNumber: 'AA', // 默认服务号(表号) defaultServiceNumber: 'TTT', // 默认服务号(表号)
defaultServerNoColor: '#FFFFFF', // 默认服务号状态显示颜色 defaultServerNoColor: '#FFFFFF', // 默认服务号状态显示颜色
trainServerOffset: { x: 4, y: 4} // 列车服务号偏移 trainServerOffset: { x: 4, y: 4} // 列车服务号偏移
}, },
@ -338,13 +342,13 @@ class SkinStyle extends defaultStyle {
trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量 trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量 trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量
trainConntWidth: 3, // 列车竖杠的宽度 trainConntWidth: 3, // 列车竖杠的宽度
trainHeadFillColor: '#000000' // 列车车头矩形填充颜色 trainHeadFillColor: '#000000', // 列车车头矩形填充颜色
trainHeadRectHeight: 20 // 列车车头矩形高度
}, },
common: { common: {
trainHeight: 20, // 列车高度 trainHeight: 20, // 列车高度
trainHeadDistance: 4, // 列车和车头之间的间距 trainHeadDistance: 4, // 列车和车头之间的间距
trainHeadRectHeight: 20, // 列车车头矩形高度
trainWidth: 40, // 列车长度 trainWidth: 40, // 列车长度
trainTextFontSize: 12, // 列车字号 trainTextFontSize: 12, // 列车字号
textFontFormat: 'consolas', // 默认字体 族类 textFontFormat: 'consolas', // 默认字体 族类

View File

@ -243,61 +243,80 @@ class SkinStyle extends defaultStyle {
}; };
this[deviceType.Train] = { this[deviceType.Train] = {
/** 车身line宽 */ trainBody: {
trainBodyLineWidth: 0, trainBodyLineWidth: 0, // 车身line宽
/** 车身鼠标悬浮事件 */ trainBodyOnMouseOver: {
trainBodyOnMouseOver: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, train: true,
/** 车身鼠标移出事件 */ textTrainNumber: false,
trainBodyOnMouseOut: {train: true, textTrainNumber: false, textTrainServer: false, textTrainTarget: false, textTrainTargetNumber: false}, textTrainServer: false,
/** 目的地码前缀*/ textTrainTarget: false,
targetCodePrefix: '000', textTrainTargetNumber: false
/** 默认目的地码 */ }, // 车身鼠标悬浮事件
defaultTargetCode: 'AAA', trainBodyOnMouseOut: {
/** 服务号(表号)前缀 */ train: true,
serviceNumberPrefix: '00', textTrainNumber: false,
/** 默认服务号(表号) */ textTrainServer: false,
defaultServiceNumber: 'BB', textTrainTarget: false,
/** 车次号前缀 */ textTrainTargetNumber: false
tripNumberPrefix: '0000', }, // 车身鼠标移出事件
/** 默认车次号1 */ changeTrainWidth: true, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
defaultDirectionCode: 'D', dynamicLoadingDisplay: true, // 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码
/** 默认车次号2 */ specialTrainType: [
defaultTripNumber: 'CCC', {
/** 车组号前缀 */ type: '03',
groupNumberPrefix: '000', serviceNumber: 'MM',
/** 默认车组号 */ nameFormat: 'serviceNumber:groupNumber'
defaultGroupNumber: 'EEE', }
/** 列车车头比车身高出的长度,上下相比车体伸出去的边框*/ ], // 特殊列车类型需设置显示格式
trainMoreLength: 1, lrPadding: 1, // 两边间隔
/** 列车车头三角坐标1偏移量 */ upPadding: 1, // 上边距离
trainHeadTriangleFirst: { x: 0, y: 0}, trainBodyFillColor: '#000000', // 列车车身填充颜色
/** 列车车头三角坐标2偏移量 */ trainNameFormat: 'targetCode:serviceNumber:tripNumber'// 列车显示格式
trainHeadTriangleSecond: { x: 4, y: 8.5}, },
/** 列车车头三角坐标3偏移量 */ hsda: {
trainHeadTriangleThird: { x: 0, y: 15}, trainHSDATextFontSize: 8// 列车HDSA字号
/** 列车高度*/ },
trainHeight: 17, trainNumber: {
/** 列车和车头之间的间距*/ targetCodePrefix: '000', // 目的地码前缀
trainHeadDistance: 2, defaultTargetCode: 'AAA', // 默认目的地码
/** 列车车头矩形高度 */ trainTargetTextAlign: 'left'// 目的地码文字显示位置
trainHeadRectHeight: 15, },
/** 列车长度*/ trainServer: {
trainWidth: 76, serviceNumberPrefix: '00', // 服务号(表号)前缀
/** 列车竖杠的宽度*/ defaultServiceNumber: 'BB', // 默认服务号(表号)
trainConntWidth: 4, trainServerOffset: { x: -1, y: 1}// 列车服务号偏移
/** 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 */ },
changeTrainWidth: true, trainTarget: {
/** 是否根据nameFormat去动态加载车组号、服务号、车次号、目的地码 */ tripNumberPrefix: '0000', // 车次号前缀
dynamicLoadingDisplay: true, defaultDirectionCode: 'D', // 默认车次号1
/** 特殊列车类型需设置显示格式 */ defaultTripNumber: 'CCC', // 默认车次号2
specialTrainType: [{ type: '03', serviceNumber: 'MM', nameFormat: 'serviceNumber:groupNumber'}], trainTargetOffset: { x: -1, y: 1}// 列车车次号偏移
/** 两边间隔 */ },
lrPadding: 1, trainTargetNumber: {
/** 上边距离 */ groupNumberPrefix: '000', // 车组号前缀
upPadding: 1, defaultGroupNumber: 'EEE'// 默认车组号
/** 列车字号*/ },
trainTextFontSize: 15, trainHead: {
/** 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除 */ trainMoreLength: 1, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量
trainHeadTriangleSecond: { x: 4, y: 8.5}, // 列车车头三角坐标2偏移量
trainHeadTriangleThird: { x: 0, y: 15}, // 列车车头三角坐标3偏移量
trainHeadRectHeight: 15, // 列车车头矩形高度
trainConntWidth: 4, // 列车竖杠的宽度
trainHeadFillColor: '#EF0C08'// 列车车头矩形填充颜色
},
common: {
trainHeight: 17, // 列车高度
trainHeadDistance: 2, // 列车和车头之间的间距
trainWidth: 76, // 列车长度
trainTextFontSize: 15, // 列车字号
textFontFormat: '宋体', // 默认字体 族类
nameFontSize: 10, // 字体大小
haveTextHSDA: false, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false// 是否需创建trainBorder对象
},
trainStatusStyle: {
destinationStatus: [ destinationStatus: [
{status: '01', showColor: '#FFFFFF'}, {status: '01', showColor: '#FFFFFF'},
{status: '02', showColor: '#00FF00'}, {status: '02', showColor: '#00FF00'},
@ -306,64 +325,69 @@ class SkinStyle extends defaultStyle {
{status: '05', showColor: '#EF0C08'}, {status: '05', showColor: '#EF0C08'},
{status: '06', showColor: '#FFFFFF'}, {status: '06', showColor: '#FFFFFF'},
{status: '07', showColor: '#FFFF00'} {status: '07', showColor: '#FFFF00'}
], ], // 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除
/** 目的地状态设置的对应哪个text的颜色 */ destinationStatusSetText: 'trainServer', // 目的地状态设置的对应哪个text的颜色
destinationStatusSetText: 'trainServer',
/** 默认字体 族类*/
textFontFormat: '宋体',
/** 列车HDSA字号*/
trainHSDATextFontSize: 8,
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */
serverNoType: [],
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/
directionType: [ directionType: [
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false }, {
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true }, type: '01',
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false } lineLShow: false,
], lineRShow: false,
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */ arrowLShow: false,
arrowRShow: false
},
{
type: '02',
lineLShow: false,
lineRShow: false,
arrowLShow: false,
arrowRShow: true
},
{
type: '03',
lineLShow: false,
lineRShow: false,
arrowLShow: true,
arrowRShow: false
}
], // 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
directionStopType: [ directionStopType: [
{type: '01', lineLShow: false, lineRShow: false}, {type: '01', lineLShow: false, lineRShow: false},
{type: '02', lineLShow: false, lineRShow: true}, {type: '02', lineLShow: false, lineRShow: true},
{type: '03', lineLShow: true, lineRShow: false} {type: '03', lineLShow: true, lineRShow: false}
], ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
/** 01 02 ATOAM 03 ATPCM
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/
runModeStatus: [ runModeStatus: [
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'}, {
{status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, status: '01',
{status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, trainLColor: '#EF0C08',
{status: '04', trainLColor: '#EA700D', trainRColor: '#EA700D'}, trainRColor: '#EF0C08'
{status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} },
], {
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */ status: '02',
runControlStatus: [], trainLColor: '#00FF00',
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */ trainRColor: '#00FF00'
doorStatus: [], },
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */ {
communicationStatus: [], status: '03',
/** 设置报警状态 eg:{status: '01', aShow: false}, */ trainLColor: '#FFFF00',
alarmStatus: [], trainRColor: '#FFFF00'
/** 列车车头矩形填充颜色 */ },
trainHeadFillColor: '#EF0C08', {
/** 列车车身填充颜色 */ status: '04',
trainBodyFillColor: '#000000', trainLColor: '#EA700D',
/** 列车服务号偏移 */ trainRColor: '#EA700D'
trainServerOffset: { x: -1, y: 1}, },
/** 列车车次号偏移 */ {
trainTargetOffset: { x: -1, y: 1}, status: '05',
/** 列车显示格式 */ trainLColor: '#A0522D',
trainNameFormat: 'targetCode:serviceNumber:tripNumber', trainRColor: '#A0522D'
/** 字体大小 */ }
nameFontSize: 10, ], // 列车运行模式对应车头颜色 01信号中断 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM
/** 目的地码文字显示位置 */ runControlStatus: [], // 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}
trainTargetTextAlign: 'left', doorStatus: [], // 设置车门状态类型 eg:{status: '01', dShow: false}
/** 是否需创建textHSDA对象 */ communicationStatus: [], // 设置通信状态 eg:{status: '01', trainColor:'#725A64'}
haveTextHSDA: false, alarmStatus: [], // 设置报警状态 eg:{status: '01', aShow: false}
/** 是否需创建arrowText对象 */ serverNoType: []// 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'}
haveArrowText: true, }
/** 是否需创建trainBorder对象 */
haveTrainBorder: false
}; };
} }
} }

View File

@ -12,9 +12,9 @@ export default class TextTrainServer extends Group {
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
z: this.model.z+1, z: this.model.z+1,
style: { style: {
x: parseInt(this.model.point.x + this.model.style.Train.trainServerOffset.y), x: parseInt(this.model.point.x + this.model.style.Train.trainServer.trainServerOffset.x),
y: parseInt(this.model.point.y + this.model.style.Train.trainServerOffset.y), y: parseInt(this.model.point.y + this.model.style.Train.trainServer.trainServerOffset.y),
text: this.model.serviceNumber.substring(this.model.serviceNumber.length - 2), text: this.model.serviceNumber.substring(this.model.serviceNumber.length - this.model.style.Train.trainServer.serviceNumberPrefix.length),
textFill: this.model.trainBrownColor, textFill: this.model.trainBrownColor,
textFont: this.model.textFont, textFont: this.model.textFont,
textAlign: 'left', textAlign: 'left',

View File

@ -12,12 +12,12 @@ export default class TextTrainTarget extends Group {
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
z: this.model.z+1, z: this.model.z+1,
style: { style: {
x: parseInt(this.model.point.x + this.model.style.Train.trainTargetOffset.x), x: parseInt(this.model.point.x + this.model.style.Train.trainTarget.trainTargetOffset.x),
y: parseInt(this.model.point.y + this.model.style.Train.trainTargetOffset.y), y: parseInt(this.model.point.y + this.model.style.Train.trainTarget.trainTargetOffset.y),
text: this.model.tripNumber.substring(this.model.tripNumber.length - 3), text: this.model.tripNumber.substring(this.model.tripNumber.length - 3),
textFill: this.model.trainYellowColor, textFill: this.model.trainYellowColor,
textFont: this.model.textFont, textFont: this.model.textFont,
textAlign: this.model.style.Train.trainTargetTextAlign, textAlign: this.model.style.Train.trainTarget.trainTargetTextAlign,
textVerticalAlign: 'top', textVerticalAlign: 'top',
onmouseover: this.model.onmouseover, onmouseover: this.model.onmouseover,
onmouseout: this.model.onmouseout onmouseout: this.model.onmouseout

View File

@ -1,6 +1,5 @@
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
export default class Train extends Group { export default class Train extends Group {
constructor(model) { constructor(model) {

View File

@ -18,8 +18,8 @@ export default class TrainBody extends Group {
create() { create() {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
const textFont = model.fontSize + 'px ' + style.Train.textFontFormat; const textFont = model.fontSize + 'px ' + style.Train.common.textFontFormat;
const TextFontHSDA = style.Train.trainHSDATextFontSize + 'px ' + style.Train.textFontFormat; const TextFontHSDA = style.Train.hsda.trainHSDATextFontSize + 'px ' + style.Train.common.textFontFormat;
let destinationText = ''; let destinationText = '';
switch (model.destinationStatus) { switch (model.destinationStatus) {
@ -31,7 +31,7 @@ export default class TrainBody extends Group {
default: destinationText = '未知'; break; default: destinationText = '未知'; break;
} }
const textContain = `列车类型: 计划车\n\0\0\0\0号: ${model.serviceNumber}\n\0\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n\0\0号: ${model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`; const textContain = `列车类型: 计划车\n\0\0\0\0号: ${model.serviceNumber}\n\0\0号: ${model.tripNumber}\n目的地号: ${model.targetCode ? model.targetCode : ''}\n\0\0号: ${model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${model.sectionModel ? model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${model.runControlStatus == '01' ? '正常' : model.runControlStatus == '03' ? '跳停' : '扣车'}\n停稳状态: ${model.runStatus == '02' ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${model.speed || 0} km/h\n列车移动授权距离: ${model.maLen || 0} m`;
this.arrowText = style.Train.haveArrowText ? new ArrowText({ this.arrowText = style.Train.common.haveArrowText ? new ArrowText({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: model.point.x+50, x: model.point.x+50,
@ -49,24 +49,24 @@ export default class TrainBody extends Group {
shape: { shape: {
x: model.point.x, x: model.point.x,
y: model.point.y, y: model.point.y,
width: style.Train.trainWidth, width: style.Train.common.trainWidth,
height: style.Train.trainHeight height: style.Train.common.trainHeight
}, },
style: { style: {
lineWidth: style.Train.trainBodyLineWidth, lineWidth: style.Train.trainBody.trainBodyLineWidth,
stroke: style.trainSidelineColor, stroke: style.trainSidelineColor,
fill: style.Train.trainBodyFillColor fill: style.Train.trainBody.trainBodyFillColor
}, },
cursor: 'pointer', cursor: 'pointer',
arrowText: this.arrowText, arrowText: this.arrowText,
onmouseover: () => { style.Train.trainBodyOnMouseOver.train?this.arrowText.getArrowText().show():''; }, onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.train?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.train?this.arrowText.getArrowText().hide():''; } onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.train?this.arrowText.getArrowText().hide():''; }
}); });
const beginX = (model.point.x + style.Train.lrPadding); const beginX = (model.point.x + style.Train.trainBody.lrPadding);
const beginY = (model.point.y - style.Train.trainHSDATextFontSize - style.Train.upPaddingHSDA); const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA);
const margin = (style.Train.trainWidth - style.Train.lrPaddingHSDA * 2) / 4; const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4;
this.textHSDA = style.Train.haveTextHSDA ? new TextHSDA({ this.textHSDA = style.Train.common.haveTextHSDA ? new TextHSDA({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
beginX: beginX, beginX: beginX,
@ -79,12 +79,12 @@ export default class TrainBody extends Group {
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
let serviceNumber = style.Train.serviceNumberPrefix + (model.serviceNumber || style.Train.defaultServiceNumber) + '';// 服务号(表号) let serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.tripNumberPrefix + (style.Train.defaultDirectionCode const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
?(model.directionCode||style.Train.defaultDirectionCode) + (model.tripNumber || style.Train.defaultTripNumber) ?(model.directionCode||style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
:model.tripNumber || style.Train.defaultTripNumber) + ''; // 车次号 :model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号
const targetCode = style.Train.targetCodePrefix + (model.targetCode || style.Train.defaultTargetCode) + ''; // 目的地码 const targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.groupNumberPrefix + (model.groupNumber || style.Train.defaultGroupNumber) + ''; // 车组号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号
this.textTrainServer = new TextTrainServer({ this.textTrainServer = new TextTrainServer({
zlevel: model.zlevel, zlevel: model.zlevel,
@ -94,34 +94,34 @@ export default class TrainBody extends Group {
serviceNumber: serviceNumber, serviceNumber: serviceNumber,
trainBrownColor: style.trainTextColor, trainBrownColor: style.trainTextColor,
textFont: textFont, textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainServer?this.arrowText.getArrowText().show():''; }, onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainServer?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainServer?this.arrowText.getArrowText().hide():''; } onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainServer?this.arrowText.getArrowText().hide():''; }
}); });
this.textTrainTarget = new TextTrainTarget({ this.textTrainTarget = new TextTrainTarget({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
point: model.point, point: model.point,
trainWidth: model.style.Train.trainWidth, trainWidth: model.style.Train.common.trainWidth,
style: style, style: style,
tripNumber: tripNumber, tripNumber: tripNumber,
trainYellowColor: style.trainTextColor, trainYellowColor: style.trainTextColor,
textFont: textFont, textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainTarget?this.arrowText.getArrowText().show():''; }, onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTarget?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainTarget?this.arrowText.getArrowText().hide():''; } onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTarget?this.arrowText.getArrowText().hide():''; }
}); });
this.textTrainNumber = new TextTrainNumber({ this.textTrainNumber = new TextTrainNumber({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
point: model.point, point: model.point,
lrPadding: style.Train.lrPadding, lrPadding: style.Train.trainBody.lrPadding,
upPadding: style.Train.upPadding, upPadding: style.Train.trainBody.upPadding,
targetCode: targetCode, targetCode: targetCode,
trainTextColor: style.trainTextColor, trainTextColor: style.trainTextColor,
textFont: textFont, textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainNumber?this.arrowText.getArrowText().show():''; }, onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainNumber?this.arrowText.getArrowText().hide():''; } onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainNumber?this.arrowText.getArrowText().hide():''; }
}); });
this.textTrainTargetNumber = new TextTrainTargetNumber({ this.textTrainTargetNumber = new TextTrainTargetNumber({
@ -133,20 +133,20 @@ export default class TrainBody extends Group {
groupNumber: groupNumber, groupNumber: groupNumber,
trainTextColor: style.trainTextColor, trainTextColor: style.trainTextColor,
textFont: textFont, textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainTargetNumber?this.arrowText.getArrowText().show():''; }, onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTargetNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainTargetNumber?this.arrowText.getArrowText().hide():''; } onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTargetNumber?this.arrowText.getArrowText().hide():''; }
}); });
// 根据列车类型设置显示格式 // 根据列车类型设置显示格式
if ( style.Train.specialTrainType.length > 0) { if ( style.Train.trainBody.specialTrainType.length > 0) {
style.Train.specialTrainType.some((item) =>{ style.Train.trainBody.specialTrainType.some((item) =>{
if (model.type === item.type) { if (model.type === item.type) {
serviceNumber = item.serviceNumber; serviceNumber = item.serviceNumber;
style.Train.nameFormat = item.nameFormat; style.Train.trainBody.nameFormat = item.nameFormat;
return true; return true;
} }
}); });
} }
if ( style.Train.dynamicLoadingDisplay ) { if ( style.Train.trainBody.dynamicLoadingDisplay ) {
this.formatChangePosition(model, style); this.formatChangePosition(model, style);
} else { } else {
this.add(this.textTrainServer); this.add(this.textTrainServer);
@ -190,48 +190,48 @@ export default class TrainBody extends Group {
this.arrowText.getArrowText().show(); this.arrowText.getArrowText().show();
} }
formatChangePosition(model, style) { formatChangePosition(model, style) {
if (style.Train.trainNameFormat) { if (style.Train.trainBody.trainNameFormat) {
const arr = style.Train.trainNameFormat.split(':'); const arr = style.Train.trainBody.trainNameFormat.split(':');
arr.forEach(ele => { arr.forEach(ele => {
if (ele == 'targetCode') { if (ele == 'targetCode') {
this.add(this.textTrainNumber); this.add(this.textTrainNumber);
} else if (ele == 'serviceNumber') { } else if (ele == 'serviceNumber') {
const show = arr.includes('targetCode'); const show = arr.includes('targetCode');
if (show) { if (show) {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding)); this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding));
} }
this.add(this.textTrainServer); this.add(this.textTrainServer);
} else if (ele == 'tripNumber') { } else if (ele == 'tripNumber') {
const show = arr.includes('targetCode'); const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber'); const serverNoShow = arr.includes('serviceNumber');
if (show) { if (show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding)); this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding));
} }
if (serverNoShow) { if (serverNoShow) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding)); this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding));
} }
if (serverNoShow && show) { if (serverNoShow && show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding)); this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.trainBody.lrPadding));
} }
this.add(this.textTrainTarget); this.add(this.textTrainTarget);
} else if (ele == 'groupNumber') { } else if (ele == 'groupNumber') {
const show = arr.includes('targetCode'); const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber'); const serverNoShow = arr.includes('serviceNumber');
if (show) { if (show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding)); this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding));
} }
if (serverNoShow) { if (serverNoShow) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding)); this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.trainBody.lrPadding));
} }
if (serverNoShow && show) { if (serverNoShow && show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.lrPadding)); this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (5 * model.fontSize * (2 / 3)) - 6.5 - style.Train.trainBody.lrPadding));
} }
this.add(this.textTrainTargetNumber); this.add(this.textTrainTargetNumber);
} }
}); });
} else { } else {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + 27 - style.Train.lrPadding)); this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + 27 - style.Train.trainBody.lrPadding));
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + 43 - style.Train.lrPadding)); this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + 43 - style.Train.trainBody.lrPadding));
this.add(this.textTrainServer); this.add(this.textTrainServer);
this.add(this.textTrainTarget); this.add(this.textTrainTarget);
this.add(this.textTrainNumber); this.add(this.textTrainNumber);

View File

@ -17,15 +17,15 @@ export default class TrainHead extends Group {
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
shape: { shape: {
x: model.point.x - baseMargin * (style.trainConntWidth), x: model.point.x - baseMargin * (style.Train.trainHead.trainConntWidth),
y: model.point.y, y: model.point.y,
width: style.trainConntWidth * model.scale, width: style.Train.trainHead.trainConntWidth * model.scale,
height: style.Train.trainHeadRectHeight height: style.Train.trainHead.trainHeadRectHeight
}, },
style: { style: {
lineWidth: 0.1, lineWidth: 0.1,
stroke: style.trainSidelineColor, stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor fill: style.Train.trainHead.trainHeadFillColor
} }
}); });
this.arrow = new Polygon({ this.arrow = new Polygon({
@ -33,15 +33,15 @@ export default class TrainHead extends Group {
z: model.z, z: model.z,
shape: { shape: {
points: [ points: [
[model.point.x + model.drect * (style.Train.trainHeadTriangleFirst.x), model.point.y + style.Train.trainHeadTriangleFirst.y], [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleFirst.x), model.point.y + style.Train.trainHead.trainHeadTriangleFirst.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHeadTriangleSecond.y], [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHead.trainHeadTriangleSecond.y],
[model.point.x + model.drect * (style.Train.trainHeadTriangleThird.x), model.point.y + style.Train.trainHeadTriangleThird.y] [model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleThird.x), model.point.y + style.Train.trainHead.trainHeadTriangleThird.y]
] ]
}, },
style: { style: {
lineWidth: 0.1, lineWidth: 0.1,
stroke: style.trainSidelineColor, stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor fill: style.Train.trainHead.trainHeadFillColor
} }
}); });

View File

@ -16,8 +16,8 @@ export default class Train extends Group {
this.z = 40; this.z = 40;
this.size = 0; this.size = 0;
this.section = null; this.section = null;
this.fontSize = style.Train.nameFontSize || style.Train.trainTextFontSize; this.fontSize = style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.create(); this.create();
this.setState(model); this.setState(model);
} }
@ -33,13 +33,13 @@ export default class Train extends Group {
switch (model.directionType) { switch (model.directionType) {
case '01': // 未知方向 case '01': // 未知方向
this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.trainWidth - model.trainWindowModel.width) / 2); this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.common.trainWidth - model.trainWindowModel.width) / 2);
break; break;
case '02': // 从左向右 case '02': // 从左向右
this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainConntWidth * this.newScale - style.Train.trainWidth; this.point.x = this.point.x + model.trainWindowModel.width / 2 - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth;
break; break;
case '03': // 从右向左 case '03': // 从右向左
this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainConntWidth * this.newScale; this.point.x = this.point.x - model.trainWindowModel.width / 2 + style.Train.trainHead.trainConntWidth * this.newScale;
break; break;
} }
} else { } else {
@ -77,7 +77,7 @@ export default class Train extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: this.point.x - style.Train.trainHeadDistance, x: this.point.x - style.Train.common.trainHeadDistance,
y: this.point.y y: this.point.y
}, },
drect: -1, drect: -1,
@ -89,7 +89,7 @@ export default class Train extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
point: { point: {
x: this.point.x + style.Train.trainWidth + style.Train.trainHeadDistance, x: this.point.x + style.Train.common.trainWidth + style.Train.common.trainHeadDistance,
y: this.point.y y: this.point.y
}, },
drect: 1, drect: 1,
@ -100,7 +100,7 @@ export default class Train extends Group {
this.add(this.trainL); this.add(this.trainL);
this.add(this.trainR); this.add(this.trainR);
} }
if (style.Train.haveTrainBorder) { if (style.Train.common.haveTrainBorder) {
this.createTrainBorder(); this.createTrainBorder();
} }
} }
@ -127,25 +127,25 @@ export default class Train extends Group {
// 设置服务号状态类型 // 设置服务号状态类型
setServerNoType(type) { setServerNoType(type) {
if (this.style.Train.serverNoType.length>0) { if (this.style.Train.trainStatusStyle.serverNoType.length>0) {
const flag = this.style.Train.serverNoType.some((item) =>{ const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{
if (type === item.type) { if (type === item.type) {
this.trainB.setTextTrainServerColor(item.showColor); this.trainB.setTextTrainServerColor(item.showColor);
return true; return true;
} }
}); });
if (this.style.Train.defaultServerNoColor && !flag) { if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB.setTextTrainServerColor(this.style.Train.defaultServerNoColor); this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
} }
} }
} }
// 设置目的地状态 // 设置目的地状态
setDestinationStatus(status) { setDestinationStatus(status) {
if (this.style.Train.destinationStatus.length>0) { if (this.style.Train.trainStatusStyle.destinationStatus.length>0) {
const flag = this.style.Train.destinationStatus.some((item) =>{ const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{
if (status === item.status) { if (status === item.status) {
switch (this.style.Train.destinationStatusSetText) { switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget': case 'trainTarget':
this.trainB.setTextTrainTargetColor(item.showColor); this.trainB.setTextTrainTargetColor(item.showColor);
break; break;
@ -158,16 +158,16 @@ export default class Train extends Group {
return true; return true;
} }
}); });
if (this.style.Train.defaultDestinationColor && !flag) { if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
switch (this.style.Train.destinationStatusSetText) { switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget': case 'trainTarget':
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor); this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break; break;
case 'trainServer': case 'trainServer':
this.trainB.setTextTrainServerColor(this.style.Train.defaultDestinationColor); this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break; break;
default: default:
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor); this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
} }
} }
} }
@ -175,8 +175,8 @@ export default class Train extends Group {
// 设置运行方向状态类型 // 设置运行方向状态类型
setDirectionType(type) { setDirectionType(type) {
if (this.style.Train.directionType.length > 0) { if (this.style.Train.trainStatusStyle.directionType.length > 0) {
this.style.Train.directionType.some((item) => { this.style.Train.trainStatusStyle.directionType.some((item) => {
if (type === item.type) { if (type === item.type) {
this.trainL.setLineShow(item.lineLShow); this.trainL.setLineShow(item.lineLShow);
this.trainL.setArrowShow(item.arrowLShow); this.trainL.setArrowShow(item.arrowLShow);
@ -189,8 +189,8 @@ export default class Train extends Group {
} }
// 设置列车停止方向类型 // 设置列车停止方向类型
setDirectionStopType(type) { setDirectionStopType(type) {
if (this.style.Train.directionStopType.length > 0) { if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
this.style.Train.directionStopType.some((item) => { this.style.Train.trainStatusStyle.directionStopType.some((item) => {
if (type === item.type) { if (type === item.type) {
this.trainL.setLineShow(item.lineLShow); this.trainL.setLineShow(item.lineLShow);
this.trainR.setLineShow(item.lineRShow); this.trainR.setLineShow(item.lineRShow);
@ -213,8 +213,8 @@ export default class Train extends Group {
} }
// 设置运行模式 // 设置运行模式
setRunMode(status) { setRunMode(status) {
if (this.style.Train.runModeStatus.length > 0) { if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) {
this.style.Train.runModeStatus.some((item) => { this.style.Train.trainStatusStyle.runModeStatus.some((item) => {
if (status === item.status) { if (status === item.status) {
this.trainL.setColor(item.trainLColor); this.trainL.setColor(item.trainLColor);
this.trainR.setColor(item.trainRColor); this.trainR.setColor(item.trainRColor);
@ -225,8 +225,8 @@ export default class Train extends Group {
} }
// 设置运行控制状态类型 // 设置运行控制状态类型
setRunControlStatus(status) { setRunControlStatus(status) {
if (this.style.Train.runControlStatus.length > 0) { if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) {
this.style.Train.runControlStatus.some((item) => { this.style.Train.trainStatusStyle.runControlStatus.some((item) => {
if (status === item.status) { if (status === item.status) {
this.trainB.setHShow(item.hShow); this.trainB.setHShow(item.hShow);
this.trainB.setSShow(item.sShow); this.trainB.setSShow(item.sShow);
@ -237,8 +237,8 @@ export default class Train extends Group {
} }
// 设置车门状态类型 // 设置车门状态类型
setDoorStatus(status) { setDoorStatus(status) {
if (this.style.Train.doorStatus.length > 0) { if (this.style.Train.trainStatusStyle.doorStatus.length > 0) {
this.style.Train.doorStatus.some((item) => { this.style.Train.trainStatusStyle.doorStatus.some((item) => {
if (status === item.status) { if (status === item.status) {
this.trainB.setDShow(item.dShow); this.trainB.setDShow(item.dShow);
return true; return true;
@ -248,8 +248,8 @@ export default class Train extends Group {
} }
// 设置通信状态类型 // 设置通信状态类型
setCommunicationStatus() { setCommunicationStatus() {
if (this.style.Train.communicationStatus.length > 0) { if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
this.style.Train.doorStatus.some((item) => { this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
if (status === item.status) { if (status === item.status) {
this.trainB.setTrainColor(item.trainColor); this.trainB.setTrainColor(item.trainColor);
return true; return true;
@ -259,8 +259,8 @@ export default class Train extends Group {
} }
// 设置报警状态 // 设置报警状态
setAlarmStatus(status) { setAlarmStatus(status) {
if (this.style.Train.alarmStatus.length >0) { if (this.style.Train.trainStatusStyle.alarmStatus.length >0) {
this.style.Train.alarmStatus.some((item) => { this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) { if (status === item.status) {
this.trainB.setAShow(item.aShow); this.trainB.setAShow(item.aShow);
return true; return true;
@ -286,9 +286,9 @@ export default class Train extends Group {
} }
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) { isChangeTrainWidth(model, style) {
if (!style.Train.changeTrainWidth) { return; } if (!style.Train.trainBody.changeTrainWidth) { return; }
if (style.Train.trainNameFormat) { if (style.Train.trainBody.trainNameFormat) {
const arr = style.Train.trainNameFormat.split(':'); const arr = style.Train.trainBody.trainNameFormat.split(':');
arr.forEach(ele => { arr.forEach(ele => {
switch (ele) { switch (ele) {
case 'targetCode': { case 'targetCode': {
@ -313,7 +313,7 @@ export default class Train extends Group {
this.size = 9; this.size = 9;
} }
this.style.Train.trainWidth = this.size * this.fontSize * (2 / 3) - 16; this.style.Train.common.trainWidth = this.size * this.fontSize * (2 / 3) - 16;
} }
removeTrainDetail() { removeTrainDetail() {
this.trainB.removeTrainDetail(); this.trainB.removeTrainDetail();
@ -340,9 +340,9 @@ export default class Train extends Group {
} }
createTrainBorder() { createTrainBorder() {
const rect = Object.assign({}, this.getBoundingRect()); const rect = Object.assign({}, this.getBoundingRect());
rect.x -= this.style.Train.trainWidth / 2; rect.x -= this.style.Train.common.trainWidth / 2;
rect.y -= 5; rect.y -= 5;
rect.width += this.style.Train.trainWidth; rect.width += this.style.Train.common.trainWidth;
rect.height += 10; rect.height += 10;
this.trainBorder = new Rect({ this.trainBorder = new Rect({