This commit is contained in:
ival 2019-08-05 16:14:53 +08:00
commit efa91ae5a0
9 changed files with 580 additions and 529 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,8 +18,8 @@ export default class TrainBody extends Group {
create() {
const model = this.model;
const style = this.model.style;
const textFont = model.fontSize + 'px ' + style.Train.textFontFormat;
const TextFontHSDA = style.Train.trainHSDATextFontSize + 'px ' + style.Train.textFontFormat;
const textFont = model.fontSize + 'px ' + style.Train.common.textFontFormat;
const TextFontHSDA = style.Train.hsda.trainHSDATextFontSize + 'px ' + style.Train.common.textFontFormat;
let destinationText = '';
switch (model.destinationStatus) {
@ -31,7 +31,7 @@ export default class TrainBody extends Group {
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`;
this.arrowText = style.Train.haveArrowText ? new ArrowText({
this.arrowText = style.Train.common.haveArrowText ? new ArrowText({
zlevel: model.zlevel,
z: model.z,
x: model.point.x+50,
@ -49,24 +49,24 @@ export default class TrainBody extends Group {
shape: {
x: model.point.x,
y: model.point.y,
width: style.Train.trainWidth,
height: style.Train.trainHeight
width: style.Train.common.trainWidth,
height: style.Train.common.trainHeight
},
style: {
lineWidth: style.Train.trainBodyLineWidth,
lineWidth: style.Train.trainBody.trainBodyLineWidth,
stroke: style.trainSidelineColor,
fill: style.Train.trainBodyFillColor
fill: style.Train.trainBody.trainBodyFillColor
},
cursor: 'pointer',
arrowText: this.arrowText,
onmouseover: () => { style.Train.trainBodyOnMouseOver.train?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.train?this.arrowText.getArrowText().hide():''; }
onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.train?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.train?this.arrowText.getArrowText().hide():''; }
});
const beginX = (model.point.x + style.Train.lrPadding);
const beginY = (model.point.y - style.Train.trainHSDATextFontSize - style.Train.upPaddingHSDA);
const margin = (style.Train.trainWidth - style.Train.lrPaddingHSDA * 2) / 4;
this.textHSDA = style.Train.haveTextHSDA ? new TextHSDA({
const beginX = (model.point.x + style.Train.trainBody.lrPadding);
const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA);
const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4;
this.textHSDA = style.Train.common.haveTextHSDA ? new TextHSDA({
zlevel: model.zlevel,
z: model.z,
beginX: beginX,
@ -79,12 +79,12 @@ export default class TrainBody extends Group {
textVerticalAlign: 'top'
}) : '';
let serviceNumber = style.Train.serviceNumberPrefix + (model.serviceNumber || style.Train.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.tripNumberPrefix + (style.Train.defaultDirectionCode
?(model.directionCode||style.Train.defaultDirectionCode) + (model.tripNumber || style.Train.defaultTripNumber)
:model.tripNumber || style.Train.defaultTripNumber) + ''; // 车次号
const targetCode = style.Train.targetCodePrefix + (model.targetCode || style.Train.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.groupNumberPrefix + (model.groupNumber || style.Train.defaultGroupNumber) + ''; // 车组号
let serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
?(model.directionCode||style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
:model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号
const targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号
this.textTrainServer = new TextTrainServer({
zlevel: model.zlevel,
@ -94,34 +94,34 @@ export default class TrainBody extends Group {
serviceNumber: serviceNumber,
trainBrownColor: style.trainTextColor,
textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainServer?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainServer?this.arrowText.getArrowText().hide():''; }
onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainServer?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainServer?this.arrowText.getArrowText().hide():''; }
});
this.textTrainTarget = new TextTrainTarget({
zlevel: model.zlevel,
z: model.z,
point: model.point,
trainWidth: model.style.Train.trainWidth,
trainWidth: model.style.Train.common.trainWidth,
style: style,
tripNumber: tripNumber,
trainYellowColor: style.trainTextColor,
textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainTarget?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainTarget?this.arrowText.getArrowText().hide():''; }
onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTarget?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTarget?this.arrowText.getArrowText().hide():''; }
});
this.textTrainNumber = new TextTrainNumber({
zlevel: model.zlevel,
z: model.z,
point: model.point,
lrPadding: style.Train.lrPadding,
upPadding: style.Train.upPadding,
lrPadding: style.Train.trainBody.lrPadding,
upPadding: style.Train.trainBody.upPadding,
targetCode: targetCode,
trainTextColor: style.trainTextColor,
textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainNumber?this.arrowText.getArrowText().hide():''; }
onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainNumber?this.arrowText.getArrowText().hide():''; }
});
this.textTrainTargetNumber = new TextTrainTargetNumber({
@ -133,29 +133,23 @@ export default class TrainBody extends Group {
groupNumber: groupNumber,
trainTextColor: style.trainTextColor,
textFont: textFont,
onmouseover: () => { style.Train.trainBodyOnMouseOver.textTrainTargetNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBodyOnMouseOut.textTrainTargetNumber?this.arrowText.getArrowText().hide():''; }
onmouseover: () => { style.Train.trainBody.trainBodyOnMouseOver.textTrainTargetNumber?this.arrowText.getArrowText().show():''; },
onmouseout: () => { style.Train.trainBody.trainBodyOnMouseOut.textTrainTargetNumber?this.arrowText.getArrowText().hide():''; }
});
// 根据列车类型设置显示格式
if ( style.Train.specialTrainType.length > 0) {
style.Train.specialTrainType.some((item) =>{
if ( style.Train.trainBody.specialTrainType.length > 0) {
style.Train.trainBody.specialTrainType.some((item) =>{
if (model.type === item.type) {
serviceNumber = item.serviceNumber;
style.Train.nameFormat = item.nameFormat;
style.Train.trainBody.nameFormat = item.nameFormat;
return true;
}
});
}
if ( style.Train.dynamicLoadingDisplay ) {
this.formatChangePosition(model, style);
} else {
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textHSDA);
}
this.add(this.train);
this.add(this.arrowText);
this.add(this.textHSDA);
}
removeTrainDetail() {
@ -190,51 +184,23 @@ export default class TrainBody extends Group {
this.arrowText.getArrowText().show();
}
formatChangePosition(model, style) {
if (style.Train.trainNameFormat) {
const arr = style.Train.trainNameFormat.split(':');
if (style.Train.trainBody.trainNameFormat) {
const arr = style.Train.trainBody.trainNameFormat.split(':');
arr.forEach(ele => {
if (ele == 'targetCode') {
this.textTrainNumber.setShapeStyle('x', parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x));
this.add(this.textTrainNumber);
} else if (ele == 'serviceNumber') {
const show = arr.includes('targetCode');
if (show) {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x));
this.add(this.textTrainServer);
} else if (ele == 'tripNumber') {
const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
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 + style.Train.trainTarget.trainTargetOffset.x));
this.add(this.textTrainTarget);
} else if (ele == 'groupNumber') {
const show = arr.includes('targetCode');
const serverNoShow = arr.includes('serviceNumber');
if (show) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (3 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
if (serverNoShow) {
this.textTrainTargetNumber.setShapeStyle('x', parseInt(model.point.x + (2 * model.fontSize * (2 / 3)) - 3 - style.Train.lrPadding));
}
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 + style.Train.textTrainTargetNumber.trainTargetNumberOffset.x));
this.add(this.textTrainTargetNumber);
}
});
} else {
this.textTrainServer.setShapeStyle('x', parseInt(model.point.x + 27 - style.Train.lrPadding));
this.textTrainTarget.setShapeStyle('x', parseInt(model.point.x + 43 - style.Train.lrPadding));
this.add(this.textTrainServer);
this.add(this.textTrainTarget);
this.add(this.textTrainNumber);
}
}
}

View File

@ -17,15 +17,15 @@ export default class TrainHead extends Group {
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x - baseMargin * (style.trainConntWidth),
x: model.point.x - baseMargin * (style.Train.trainHead.trainConntWidth),
y: model.point.y,
width: style.trainConntWidth * model.scale,
height: style.Train.trainHeadRectHeight
width: style.Train.trainHead.trainConntWidth * model.scale,
height: style.Train.trainHead.trainHeadRectHeight
},
style: {
lineWidth: 0.1,
stroke: style.trainSidelineColor,
fill: style.Train.trainHeadFillColor
fill: style.Train.trainHead.trainHeadFillColor
}
});
this.arrow = new Polygon({
@ -33,15 +33,15 @@ export default class TrainHead extends Group {
z: model.z,
shape: {
points: [
[model.point.x + model.drect * (style.Train.trainHeadTriangleFirst.x), model.point.y + style.Train.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.trainHeadTriangleThird.x), model.point.y + style.Train.trainHeadTriangleThird.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.trainHead.trainHeadTriangleSecond.x), model.point.y + style.Train.trainHead.trainHeadTriangleSecond.y],
[model.point.x + model.drect * (style.Train.trainHead.trainHeadTriangleThird.x), model.point.y + style.Train.trainHead.trainHeadTriangleThird.y]
]
},
style: {
lineWidth: 0.1,
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.size = 0;
this.section = null;
this.fontSize = style.Train.nameFontSize || style.Train.trainTextFontSize;
this.newScale = this.fontSize / style.Train.trainTextFontSize;
this.fontSize = style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.create();
this.setState(model);
}
@ -30,16 +30,15 @@ export default class Train extends Group {
x: model.trainWindowModel.point.x,
y: model.trainWindowModel.point.y
};
switch (model.directionType) {
case '01': // 未知方向
this.point.x = this.point.x + model.trainWindowModel.width / 2 + Math.abs((style.Train.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;
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;
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;
}
} else {
@ -77,7 +76,7 @@ export default class Train extends Group {
zlevel: this.zlevel,
z: this.z,
point: {
x: this.point.x - style.Train.trainHeadDistance,
x: this.point.x - style.Train.common.trainHeadDistance,
y: this.point.y
},
drect: -1,
@ -89,7 +88,7 @@ export default class Train extends Group {
zlevel: this.zlevel,
z: this.z,
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
},
drect: 1,
@ -100,7 +99,7 @@ export default class Train extends Group {
this.add(this.trainL);
this.add(this.trainR);
}
if (style.Train.haveTrainBorder) {
if (style.Train.common.haveTrainBorder) {
this.createTrainBorder();
}
}
@ -127,25 +126,25 @@ export default class Train extends Group {
// 设置服务号状态类型
setServerNoType(type) {
if (this.style.Train.serverNoType.length>0) {
const flag = this.style.Train.serverNoType.some((item) =>{
if (this.style.Train.trainStatusStyle.serverNoType.length>0) {
const flag = this.style.Train.trainStatusStyle.serverNoType.some((item) =>{
if (type === item.type) {
this.trainB.setTextTrainServerColor(item.showColor);
return true;
}
});
if (this.style.Train.defaultServerNoColor && !flag) {
this.trainB.setTextTrainServerColor(this.style.Train.defaultServerNoColor);
if (this.style.Train.trainStatusStyle.defaultServerNoColor && !flag) {
this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultServerNoColor);
}
}
}
// 设置目的地状态
setDestinationStatus(status) {
if (this.style.Train.destinationStatus.length>0) {
const flag = this.style.Train.destinationStatus.some((item) =>{
if (this.style.Train.trainStatusStyle.destinationStatus.length>0) {
const flag = this.style.Train.trainStatusStyle.destinationStatus.some((item) =>{
if (status === item.status) {
switch (this.style.Train.destinationStatusSetText) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB.setTextTrainTargetColor(item.showColor);
break;
@ -158,16 +157,16 @@ export default class Train extends Group {
return true;
}
});
if (this.style.Train.defaultDestinationColor && !flag) {
switch (this.style.Train.destinationStatusSetText) {
if (this.style.Train.trainStatusStyle.defaultDestinationColor && !flag) {
switch (this.style.Train.trainStatusStyle.destinationStatusSetText) {
case 'trainTarget':
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
case 'trainServer':
this.trainB.setTextTrainServerColor(this.style.Train.defaultDestinationColor);
this.trainB.setTextTrainServerColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
break;
default:
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
this.trainB.setTextTrainTargetColor(this.style.Train.trainStatusStyle.defaultDestinationColor);
}
}
}
@ -175,8 +174,8 @@ export default class Train extends Group {
// 设置运行方向状态类型
setDirectionType(type) {
if (this.style.Train.directionType.length > 0) {
this.style.Train.directionType.some((item) => {
if (this.style.Train.trainStatusStyle.directionType.length > 0) {
this.style.Train.trainStatusStyle.directionType.some((item) => {
if (type === item.type) {
this.trainL.setLineShow(item.lineLShow);
this.trainL.setArrowShow(item.arrowLShow);
@ -189,8 +188,8 @@ export default class Train extends Group {
}
// 设置列车停止方向类型
setDirectionStopType(type) {
if (this.style.Train.directionStopType.length > 0) {
this.style.Train.directionStopType.some((item) => {
if (this.style.Train.trainStatusStyle.directionStopType.length > 0) {
this.style.Train.trainStatusStyle.directionStopType.some((item) => {
if (type === item.type) {
this.trainL.setLineShow(item.lineLShow);
this.trainR.setLineShow(item.lineRShow);
@ -213,8 +212,8 @@ export default class Train extends Group {
}
// 设置运行模式
setRunMode(status) {
if (this.style.Train.runModeStatus.length > 0) {
this.style.Train.runModeStatus.some((item) => {
if (this.style.Train.trainStatusStyle.runModeStatus.length > 0) {
this.style.Train.trainStatusStyle.runModeStatus.some((item) => {
if (status === item.status) {
this.trainL.setColor(item.trainLColor);
this.trainR.setColor(item.trainRColor);
@ -225,8 +224,8 @@ export default class Train extends Group {
}
// 设置运行控制状态类型
setRunControlStatus(status) {
if (this.style.Train.runControlStatus.length > 0) {
this.style.Train.runControlStatus.some((item) => {
if (this.style.Train.trainStatusStyle.runControlStatus.length > 0) {
this.style.Train.trainStatusStyle.runControlStatus.some((item) => {
if (status === item.status) {
this.trainB.setHShow(item.hShow);
this.trainB.setSShow(item.sShow);
@ -237,8 +236,8 @@ export default class Train extends Group {
}
// 设置车门状态类型
setDoorStatus(status) {
if (this.style.Train.doorStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (this.style.Train.trainStatusStyle.doorStatus.length > 0) {
this.style.Train.trainStatusStyle.doorStatus.some((item) => {
if (status === item.status) {
this.trainB.setDShow(item.dShow);
return true;
@ -248,8 +247,8 @@ export default class Train extends Group {
}
// 设置通信状态类型
setCommunicationStatus() {
if (this.style.Train.communicationStatus.length > 0) {
this.style.Train.doorStatus.some((item) => {
if (this.style.Train.trainStatusStyle.communicationStatus.length > 0) {
this.style.Train.trainStatusStyle.communicationStatus.some((item) => {
if (status === item.status) {
this.trainB.setTrainColor(item.trainColor);
return true;
@ -259,8 +258,8 @@ export default class Train extends Group {
}
// 设置报警状态
setAlarmStatus(status) {
if (this.style.Train.alarmStatus.length >0) {
this.style.Train.alarmStatus.some((item) => {
if (this.style.Train.trainStatusStyle.alarmStatus.length >0) {
this.style.Train.trainStatusStyle.alarmStatus.some((item) => {
if (status === item.status) {
this.trainB.setAShow(item.aShow);
return true;
@ -286,25 +285,25 @@ export default class Train extends Group {
}
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
isChangeTrainWidth(model, style) {
if (!style.Train.changeTrainWidth) { return; }
if (style.Train.trainNameFormat) {
const arr = style.Train.trainNameFormat.split(':');
if (!style.Train.trainBody.changeTrainWidth) { return; }
if (style.Train.trainBody.trainNameFormat) {
const arr = style.Train.trainBody.trainNameFormat.split(':');
arr.forEach(ele => {
switch (ele) {
case 'targetCode': {
this.size += 3;
this.size += style.Train.trainNumber.targetCodePrefix.length || 0;
break;
}
case 'serviceNumber': {
this.size += 2;
this.size += style.Train.trainServer.serviceNumberPrefix.length || 0;
break;
}
case 'tripNumber': {
this.size += 4;
this.size += style.Train.trainTarget.tripNumberPrefix.length || 0;
break;
}
case 'groupNumber': {
this.size += 3;
this.size += style.Train.trainTargetNumber.groupNumberPrefix.length || 0;
break;
}
}
@ -312,8 +311,7 @@ export default class Train extends Group {
} else {
this.size = 9;
}
this.style.Train.trainWidth = this.size * this.fontSize * (2 / 3) - 16;
this.style.Train.common.trainWidth = this.size * this.fontSize * (2 / 3) -16;
}
removeTrainDetail() {
this.trainB.removeTrainDetail();
@ -340,9 +338,9 @@ export default class Train extends Group {
}
createTrainBorder() {
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.width += this.style.Train.trainWidth;
rect.width += this.style.Train.common.trainWidth;
rect.height += 10;
this.trainBorder = new Rect({