调整:列车调整

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, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
destinationStatus: [ trainHeadTriangleFirst: { x: 7, y: 1}, // 列车车头三角坐标1偏移量
{status: '01', showColor: '#FFFFFF'}, trainHeadTriangleSecond: { x: 13, y: 10}, // 列车车头三角坐标2偏移量
{status: '02', showColor: '#00FF00'}, trainHeadTriangleThird: { x: 7, y: 19}, // 列车车头三角坐标3偏移量
{status: '03', showColor: '#A0522D'}, trainHeadRectHeight: 20, // 列车车头矩形高度
{status: '04', showColor: '#FFFF00'} trainConntWidth: 3, // 列车竖杠的宽度
], trainHeadFillColor: '#000000'// 列车车头矩形填充颜色
/** 默认目的地状态显示颜色 */ },
defaultDestinationColor: '#FFFFFF', common: {
/** 目的地状态设置的对应哪个text的颜色 */ trainHeight: 20, // 列车高度
destinationStatusSetText: 'trainTarget', trainHeadDistance: 4, // 列车和车头之间的间距
/** 默认字体 族类*/ trainWidth: 40, // 列车长度
textFontFormat: 'consolas', trainTextFontSize: 12, // 列车字号
/** 列车HDSA字号*/ textFontFormat: 'consolas', // 默认字体 族类
trainHSDATextFontSize: 9, haveTextHSDA: true, // 是否需创建textHSDA对象
/** 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车 */ haveArrowText: true, // 是否需创建arrowText对象
serverNoType: [ haveTrainBorder: false// 是否需创建trainBorder对象
{type: '01', showColor: '#FFFFFF'}, },
{type: '02', showColor: '#FFF000'} trainStatusStyle: {
], destinationStatus: [
/** 默认服务号状态显示颜色 */ {status: '01', showColor: '#FFFFFF'},
defaultServerNoColor: '#FFFFFF', {status: '02', showColor: '#00FF00'},
/** 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/ {status: '03', showColor: '#A0522D'},
directionType: [ {status: '04', showColor: '#FFFF00'}
{type: '01', lineLShow: true, lineRShow: true, arrowLShow: false, arrowRShow: false }, ], // 目的地状态 01准点 02早点 03晚点 04头码车
{type: '02', lineLShow: false, lineRShow: true, arrowLShow: false, arrowRShow: true }, defaultDestinationColor: '#FFFFFF', // 默认目的地状态显示颜色
{type: '03', lineLShow: true, lineRShow: false, arrowLShow: true, arrowRShow: false } destinationStatusSetText: 'trainTarget', // 目的地状态设置的对应哪个text的颜色
], directionType: [
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */ {
directionStopType: [ type: '01',
{type: '01', lineLShow: false, lineRShow: false}, lineLShow: true,
{type: '02', lineLShow: false, lineRShow: true}, lineRShow: true,
{type: '03', lineLShow: true, lineRShow: false} arrowLShow: false,
], arrowRShow: false
/** 01 02 ATOAM 03 ATPCM },
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ {
runModeStatus: [ type: '02',
{status: '01', trainLColor: '#FFFFFF', trainRColor: '#FFFFFF'}, lineLShow: false,
{status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, lineRShow: true,
{status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, arrowLShow: false,
{status: '04', trainLColor: '#A0522D', trainRColor: '#A0522D'}, arrowRShow: true
{status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} },
], {
/** 设置运行控制状态类型 01正常 02扣车 03停跳 */ type: '03',
runControlStatus: [ lineLShow: true,
{status: '01', hShow: false, sShow: false}, lineRShow: false,
{status: '02', hShow: true, sShow: false}, arrowLShow: true,
{status: '03', hShow: false, sShow: true} arrowRShow: false
], }
/** 设置车门状态类型 01关门 02开门 */ ], // 列车运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
doorStatus: [ directionStopType: [
{status: '01', dShow: false}, {type: '01', lineLShow: false, lineRShow: false},
{status: '02', dShow: true} {type: '02', lineLShow: false, lineRShow: true},
], {type: '03', lineLShow: true, lineRShow: false}
/** 设置通信状态 01正常 02故障 */ ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
communicationStatus: [ runModeStatus: [
{status: '01', trainColor: '#725A64'}, {
{status: '02', trainColor: '#C0C0C0'} status: '01',
], trainLColor: '#FFFFFF',
/** 设置报警状态 01不报警 02报警 */ trainRColor: '#FFFFFF'
alarmStatus: [ },
{status: '01', aShow: false}, {
{status: '02', aShow: true} status: '02',
], trainLColor: '#00FF00',
/** 列车车头矩形填充颜色 */ trainRColor: '#00FF00'
trainHeadFillColor: '#000000', },
/** 列车车身填充颜色 */ {
trainBodyFillColor: '#725A64', status: '03',
/** textH文本 */ trainLColor: '#FFFF00',
textHContent: 'H', trainRColor: '#FFFF00'},
/** textS文本 */ {
textSContent: 'S', status: '04',
/** textD文本 */ trainLColor: '#A0522D',
textDContent: 'D', trainRColor: '#A0522D'
/** textA文本 */ },
textAContent: 'A', {
/** 是否需创建textHSDA对象 */ status: '05',
haveTextHSDA: true, trainLColor: '#A0522D',
/** 是否需创建arrowText对象 */ trainRColor: '#A0522D'
haveArrowText: true, }
/** 是否需创建trainBorder对象 */ ], // 列车运行模式对应车头颜色 01未知 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM
haveTrainBorder: false, runControlStatus: [
/** 列车服务号偏移 */ {status: '01', hShow: false, sShow: false},
trainServerOffset: { x: 4, y: 4}, {status: '02', hShow: true, sShow: false},
/** 列车车次号偏移 */ {status: '03', hShow: false, sShow: true}
trainTargetOffset: { x: 36, y: 4}, ], // 设置运行控制状态类型 01正常 02扣车 03停跳
/** 目的地码文字显示位置 */ doorStatus: [
trainTargetTextAlign: 'right' {status: '01', dShow: false},
{status: '02', dShow: true}
], // 设置车门状态类型 01关门 02开门
communicationStatus: [
{status: '01', trainColor: '#725A64'},
{status: '02', trainColor: '#C0C0C0'}
], // 设置通信状态 01正常 02故障
alarmStatus: [
{status: '01', aShow: false},
{status: '02', aShow: true}
], // 设置报警状态 01不报警 02报警
serverNoType: [
{type: '01', showColor: '#FFFFFF'},
{type: '02', showColor: '#FFF000'}
], // 服务号状态类型 01显示服务号 计划车 02显示车组号: 头码车与人工车
defaultServerNoColor: '#FFFFFF' // 默认服务号状态显示颜色
}
}; };
} }
} }

View File

@ -285,42 +285,46 @@ class SkinStyle extends defaultStyle {
this[deviceType.Train] = { this[deviceType.Train] = {
trainBody: { trainBody: {
trainBodyLineWidth: 1, // 车身line宽 trainBodyLineWidth: 1, // 车身line宽
trainBodyOnMouseOver: { trainBodyOnMouseOver: {
train: true, train: true,
textTrainNumber: false, textTrainNumber: false,
textTrainServer: false, textTrainServer: false,
textTrainTarget: false, textTrainTarget: false,
textTrainTargetNumber: false textTrainTargetNumber: false
}, // 车身鼠标悬浮事件 }, // 车身鼠标悬浮事件
trainBodyOnMouseOut: { trainBodyOnMouseOut: {
train: true, train: true,
textTrainNumber: false, textTrainNumber: false,
textTrainServer: false, textTrainServer: false,
textTrainTarget: false, textTrainTarget: false,
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,19 +342,19 @@ 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', // 默认字体 族类
haveTextHSDA: true, // 是否需创建textHSDA对象 haveTextHSDA: true, // 是否需创建textHSDA对象
haveArrowText: true, // 是否需创建arrowText对象 haveArrowText: true, // 是否需创建arrowText对象
haveTrainBorder: false// 是否需创建trainBorder对象 haveTrainBorder: false // 是否需创建trainBorder对象
}, },
trainStatusStyle: { trainStatusStyle: {
defaultDestinationColor: '#FFFFFF', // 默认目的地状态显示颜色 defaultDestinationColor: '#FFFFFF', // 默认目的地状态显示颜色
@ -460,7 +464,7 @@ class SkinStyle extends defaultStyle {
alarmStatus: [ alarmStatus: [
{status: '01', aShow: false}, {status: '01', aShow: false},
{status: '02', aShow: true} {status: '02', aShow: true}
]// 设置报警状态 01不报警 02报警 ] // 设置报警状态 01不报警 02报警
} }
}; };
} }

View File

@ -243,127 +243,151 @@ 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, // 列车车头比车身高出的长度,上下相比车体伸出去的边框
destinationStatus: [ trainHeadTriangleFirst: { x: 0, y: 0}, // 列车车头三角坐标1偏移量
{status: '01', showColor: '#FFFFFF'}, trainHeadTriangleSecond: { x: 4, y: 8.5}, // 列车车头三角坐标2偏移量
{status: '02', showColor: '#00FF00'}, trainHeadTriangleThird: { x: 0, y: 15}, // 列车车头三角坐标3偏移量
{status: '03', showColor: '#3265FF'}, trainHeadRectHeight: 15, // 列车车头矩形高度
{status: '04', showColor: '#9B4A09'}, trainConntWidth: 4, // 列车竖杠的宽度
{status: '05', showColor: '#EF0C08'}, trainHeadFillColor: '#EF0C08'// 列车车头矩形填充颜色
{status: '06', showColor: '#FFFFFF'}, },
{status: '07', showColor: '#FFFF00'} common: {
], trainHeight: 17, // 列车高度
/** 目的地状态设置的对应哪个text的颜色 */ trainHeadDistance: 2, // 列车和车头之间的间距
destinationStatusSetText: 'trainServer', trainWidth: 76, // 列车长度
/** 默认字体 族类*/ trainTextFontSize: 15, // 列车字号
textFontFormat: '宋体', textFontFormat: '宋体', // 默认字体 族类
/** 列车HDSA字号*/ nameFontSize: 10, // 字体大小
trainHSDATextFontSize: 8, haveTextHSDA: false, // 是否需创建textHSDA对象
/** 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'} */ haveArrowText: true, // 是否需创建arrowText对象
serverNoType: [], haveTrainBorder: false// 是否需创建trainBorder对象
/** 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行*/ },
directionType: [ trainStatusStyle: {
{type: '01', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: false }, destinationStatus: [
{type: '02', lineLShow: false, lineRShow: false, arrowLShow: false, arrowRShow: true }, {status: '01', showColor: '#FFFFFF'},
{type: '03', lineLShow: false, lineRShow: false, arrowLShow: true, arrowRShow: false } {status: '02', showColor: '#00FF00'},
], {status: '03', showColor: '#3265FF'},
/** 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行 */ {status: '04', showColor: '#9B4A09'},
directionStopType: [ {status: '05', showColor: '#EF0C08'},
{type: '01', lineLShow: false, lineRShow: false}, {status: '06', showColor: '#FFFFFF'},
{type: '02', lineLShow: false, lineRShow: true}, {status: '07', showColor: '#FFFF00'}
{type: '03', lineLShow: true, lineRShow: false} ], // 目的地状态 01准点 02早点 03严重早点 04晚点 05严重晚点 06头码车 07ATP切除
], destinationStatusSetText: 'trainServer', // 目的地状态设置的对应哪个text的颜色
/** 01 02 ATOAM 03 ATPCM directionType: [
* 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM*/ {
runModeStatus: [ type: '01',
{status: '01', trainLColor: '#EF0C08', trainRColor: '#EF0C08'}, lineLShow: false,
{status: '02', trainLColor: '#00FF00', trainRColor: '#00FF00'}, lineRShow: false,
{status: '03', trainLColor: '#FFFF00', trainRColor: '#FFFF00'}, arrowLShow: false,
{status: '04', trainLColor: '#EA700D', trainRColor: '#EA700D'}, arrowRShow: false
{status: '05', trainLColor: '#A0522D', trainRColor: '#A0522D'} },
], {
/** 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}, */ type: '02',
runControlStatus: [], lineLShow: false,
/** 设置车门状态类型 eg:{status: '01', dShow: false}, */ lineRShow: false,
doorStatus: [], arrowLShow: false,
/** 设置通信状态 eg:{status: '01', trainColor:'#725A64'}, */ arrowRShow: true
communicationStatus: [], },
/** 设置报警状态 eg:{status: '01', aShow: false}, */ {
alarmStatus: [], type: '03',
/** 列车车头矩形填充颜色 */ lineLShow: false,
trainHeadFillColor: '#EF0C08', lineRShow: false,
/** 列车车身填充颜色 */ arrowLShow: true,
trainBodyFillColor: '#000000', arrowRShow: false
/** 列车服务号偏移 */ }
trainServerOffset: { x: -1, y: 1}, ], // 运行方向状态类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
/** 列车车次号偏移 */ directionStopType: [
trainTargetOffset: { x: -1, y: 1}, {type: '01', lineLShow: false, lineRShow: false},
/** 列车显示格式 */ {type: '02', lineLShow: false, lineRShow: true},
trainNameFormat: 'targetCode:serviceNumber:tripNumber', {type: '03', lineLShow: true, lineRShow: false}
/** 字体大小 */ ], // 列车停止方向类型对应车头显示状态 01未知方向 02从左往右 上行 03从右往左 下行
nameFontSize: 10, runModeStatus: [
/** 目的地码文字显示位置 */ {
trainTargetTextAlign: 'left', status: '01',
/** 是否需创建textHSDA对象 */ trainLColor: '#EF0C08',
haveTextHSDA: false, trainRColor: '#EF0C08'
/** 是否需创建arrowText对象 */ },
haveArrowText: true, {
/** 是否需创建trainBorder对象 */ status: '02',
haveTrainBorder: false trainLColor: '#00FF00',
trainRColor: '#00FF00'
},
{
status: '03',
trainLColor: '#FFFF00',
trainRColor: '#FFFF00'
},
{
status: '04',
trainLColor: '#EA700D',
trainRColor: '#EA700D'
},
{
status: '05',
trainLColor: '#A0522D',
trainRColor: '#A0522D'
}
], // 列车运行模式对应车头颜色 01信号中断 02 ATO自动驾驶模式AM 03 ATP监控下的人工驾驶模式CM 04 限制人工驾驶模式RM 05 非限制人工驾驶模式RM
runControlStatus: [], // 设置运行控制状态类型 eg:{status: '01', hShow: false, sShow: false}
doorStatus: [], // 设置车门状态类型 eg:{status: '01', dShow: false}
communicationStatus: [], // 设置通信状态 eg:{status: '01', trainColor:'#725A64'}
alarmStatus: [], // 设置报警状态 eg:{status: '01', aShow: false}
serverNoType: []// 服务号状态类型 eg:{type: '01', showColor: '#FFFFFF'}
}
}; };
} }
} }

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({