# Conflicts:
#	src/jmapNew/config/skinCode/haerbin_01.js
This commit is contained in:
zyy 2020-03-09 17:03:08 +08:00
commit 751a8e792c
10 changed files with 293 additions and 295 deletions

View File

@ -127,19 +127,19 @@ class SkinCode extends defaultStyle {
color: '#3149C3' // 区段边界符颜色 color: '#3149C3' // 区段边界符颜色
}, },
block: { block: {
special: true, // 区段特殊显示 special: true // 区段特殊显示
}, },
trainPosition:{ trainPosition:{
display: false // 列车实时位置显示 display: false // 列车实时位置显示
} }
}; };
this[deviceType.Signal] = { this[deviceType.Signal] = {
distance: 10, // 设备距离区段的距离 distance: 10, // 设备距离区段的距离
post: { post: {
standardShow: true, // 灯柱显示 standardShow: true, // 灯柱显示
standardLength: 4, // 高柱长度 standardLength: 4, // 高柱长度
standardHeight: 5, // 灯柱高度 standardHeight: 5, // 灯柱高度
standardColor: '#3149C3', // 灯柱颜色 standardColor: '#3149C3', // 灯柱颜色
standardWidth: 4 // 灯柱宽度 standardWidth: 4 // 灯柱宽度
}, },
@ -155,7 +155,7 @@ class SkinCode extends defaultStyle {
nameBorderShow: true // 信号机名字边框显示 nameBorderShow: true // 信号机名字边框显示
}, },
lamp: { lamp: {
logicDisplayNone: true, // 逻辑点灯斜线不显示 logicDisplayNone: true, // 逻辑点灯斜线不显示
guidName: 'defult', // 默认引导类型 guidName: 'defult', // 默认引导类型
stopWidth: 2, // 禁止线宽度 stopWidth: 2, // 禁止线宽度
borderWidth: 1, // 信号灯边框线宽度 borderWidth: 1, // 信号灯边框线宽度
@ -215,7 +215,7 @@ class SkinCode extends defaultStyle {
}, },
stand: { // 站台 stand: { // 站台
headFontSize: 11, // 站台首端字体大小 headFontSize: 11, // 站台首端字体大小
textFill: '#fff', // 站台字体颜色 textFill: '#fff', // 站台字体颜色
spareColor: '#00ffff', // 站台空闲颜色 spareColor: '#00ffff', // 站台空闲颜色
stopColor: '#FEFE00', // 站台列车停站颜色 stopColor: '#FEFE00', // 站台列车停站颜色
jumpStopColor: '#9A99FF', // 站台跳停颜色 jumpStopColor: '#9A99FF', // 站台跳停颜色
@ -234,11 +234,11 @@ class SkinCode extends defaultStyle {
}, },
detainCar: { // 扣车 detainCar: { // 扣车
text: 'H', // 扣车显示内容 text: 'H', // 扣车显示内容
fontSize: 18, // 扣车字体大小 fontSize: 18, // 扣车字体大小
position: -1, // 扣车方向 position: -1, // 扣车方向
offset: { x: -8, y: -6 }, // 扣车偏移量 offset: { x: -8, y: -6 }, // 扣车偏移量
trainColor: '#E4EF50', // 车站扣车颜色 trainColor: '#E4EF50', // 车站扣车颜色
centerTrainColor: 'red', // 中心扣车颜色 centerTrainColor: 'red', // 中心扣车颜色
andCenterTrainColor: '#F61107', // 车站+中心扣车颜色 andCenterTrainColor: '#F61107', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色 detainTrainTextColor: '#E4EF50' // 车站扣除文字颜色
}, },
@ -268,7 +268,7 @@ class SkinCode extends defaultStyle {
}, },
lamp: { lamp: {
radiusR: 6, // 控制灯大小 radiusR: 6, // 控制灯大小
lampColor: '#5A5D5A' // 功能按钮颜色 lampColor: '#5A5D5A' // 功能按钮颜色
} }
}; };
@ -296,7 +296,7 @@ class SkinCode extends defaultStyle {
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
borderShow: true, // 车站包围框显示 borderShow: true, // 车站包围框显示
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离 distance: 5 // 灯跟文字距离
@ -373,15 +373,15 @@ class SkinCode extends defaultStyle {
spareColor: '#5b5b5b', // 区段显示颜色 (灰色) spareColor: '#5b5b5b', // 区段显示颜色 (灰色)
}, },
core: { core: {
splice: true, // 哈尔滨特殊显示 splice: true, // 哈尔滨特殊显示
length: 6 // 道岔单边长度 length: 6 // 道岔单边长度
}, },
block: { // 道岔封锁配置 block: { // 道岔封锁配置
blockName: 'default', // 默认道岔封锁类型 blockName: 'default', // 默认道岔封锁类型
nameBorderShow: false, // 道岔名称是否有包围框 显示 nameBorderShow: false, // 道岔名称是否有包围框 显示
contentRectShow: false, // 道岔封锁显示 contentRectShow: false, // 道岔封锁显示
contentRectColor: '#fff', // 道岔封锁名称颜色 contentRectColor: '#fff', // 道岔封锁名称颜色
rhomboidShow: true, // 道岔单独显示 rhomboidShow: true // 道岔单独显示
}, },
monolock: { // 道岔单锁配置 monolock: { // 道岔单锁配置
locationColor: '#fff', // 道岔单锁定位颜色 (红色) locationColor: '#fff', // 道岔单锁定位颜色 (红色)
@ -471,7 +471,7 @@ class SkinCode extends defaultStyle {
distance: 5 // 灯跟文字距离 distance: 5 // 灯跟文字距离
}, },
lamp: { lamp: {
fill: 'rgba(0,0,0,0)', // 填充色 fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小 radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色) controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
} }
@ -514,11 +514,12 @@ class SkinCode extends defaultStyle {
textAContent: '警' // textA文本 textAContent: '警' // textA文本
}, },
trainAtrStatus: { trainAtrStatus: {
trainAtrStatusOffset: { x: 68, y: 9}, trainAtrStatusOffset: { x: 74, y: 8},
r: 5 r: 5
}, },
travelSigns: { travelSigns: {
trainTravelSignsOffset: { x:3, y: 3} trainTravelLeftSignsOffset: { x:3, y: 3},
trainTravelRightSignsOffset: { x: 62, y: 3}
}, },
delayTime: { delayTime: {
trainDelayTimeOffset: { x:5, y: 14} trainDelayTimeOffset: { x:5, y: 14}
@ -573,7 +574,7 @@ class SkinCode extends defaultStyle {
fixedCoordinates: true, // 列车车组号等固定坐标 fixedCoordinates: true, // 列车车组号等固定坐标
trainHeight: 40, // 列车高度 trainHeight: 40, // 列车高度
trainHeadDistance: 2, // 列车和车头之间的间距 trainHeadDistance: 2, // 列车和车头之间的间距
trainWidth: 76, // 列车长度 trainWidth: 82, // 列车长度
trainTextFontSize: 12, // 列车字号 trainTextFontSize: 12, // 列车字号
fontFamily: 'consolas', // 默认字体 族类 fontFamily: 'consolas', // 默认字体 族类
nameFontSize: 12, // 字体大小 nameFontSize: 12, // 字体大小

View File

@ -24,10 +24,6 @@ export default class Station extends Group {
this.create(); this.create();
this.createTurnBack(); // 创建按图折返 this.createTurnBack(); // 创建按图折返
const path = window.location.href; const path = window.location.href;
if (!path.includes('/map/draw')) {
this.createGuideTotalLock(); // 创建引导总锁
}
this.prdType = '';
if (path.includes('?')) { if (path.includes('?')) {
const arr = window.location.href.split('?')[1].split('&'); const arr = window.location.href.split('?')[1].split('&');
arr.forEach(elem => { arr.forEach(elem => {
@ -36,6 +32,9 @@ export default class Station extends Group {
} }
}); });
} }
if ((!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) && model.guideTotalLockPoint) {
this.createGuideTotalLock(); // 创建引导总锁
}
this.createControlMode(); this.createControlMode();
this.setState(model); this.setState(model);
this.checkIsDrawMap(); this.checkIsDrawMap();
@ -121,7 +120,7 @@ export default class Station extends Group {
createGuideTotalLock() { // 创建引导总锁 createGuideTotalLock() { // 创建引导总锁
const model = this.model; const model = this.model;
const style = this.style; const style = this.style;
if (model.guideTotalLock || (!this.prdType && style.Station.functionButtonShow.indexOf(this.prdType) !== -1 && model.guideTotalLockPoint)) { if (model.guideTotalLock) {
this.guideLamp = new EControl({ this.guideLamp = new EControl({
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
@ -316,26 +315,26 @@ export default class Station extends Group {
// 设置状态 // 设置状态
setState(model) { setState(model) {
switch (model.controlMode) { switch (model.controlMode) {
case '': // 无状态 case '': // 无状态
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
break; break;
case 'Center': // 中控 case 'Center': // 中控
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor); this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.greenColor);
break; break;
case 'Local': // 站控 case 'Local': // 站控
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor); this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.yellowColor);
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
break; break;
case 'Emergency': // 紧急站控 case 'Emergency': // 紧急站控
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor); this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.redColor);
this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.substationControl && this.substationControl.setColor(this.style.Station.StationControl.lamp.grayColor);
this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.centerControl && this.centerControl.setColor(this.style.Station.StationControl.lamp.grayColor);
break; break;
} }
} }

View File

@ -35,7 +35,7 @@ class StationStand extends Group {
} }
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
if (!this.prdType || (this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1 && model.guideTotalLockPoint)) { if (!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) {
this.createFunctionButton(); this.createFunctionButton();
} }
this.setVisible(model.visible); this.setVisible(model.visible);

View File

@ -5,167 +5,167 @@ import ETextName from '../element/ETextName'; // 名称文字 (共有)
import EMouse from './EMouse'; import EMouse from './EMouse';
import store from '@/store'; import store from '@/store';
import Circle from 'zrender/src/graphic/shape/Circle'; import Circle from 'zrender/src/graphic/shape/Circle';
import BoundingRect from "zrender/src/core/BoundingRect"; import BoundingRect from 'zrender/src/core/BoundingRect';
/** 车身*/ /** 车身*/
export default class TrainBody extends Group { export default class TrainBody extends Group {
constructor(model) { constructor(model) {
super(); super();
this.model = model; this.model = model;
this.deviceModel = model.model; this.deviceModel = model.model;
this.nameFormat = model.nameFormat; this.nameFormat = model.nameFormat;
this.create(); this.create();
this.createMouse(); // 鼠标事件 this.createMouse(); // 鼠标事件
} }
createMouse() { createMouse() {
this.mouseEvent = new EMouse(this); this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent); this.add(this.mouseEvent);
if (this.deviceModel.down) { if (this.deviceModel.down) {
store.dispatch('map/setTrainDetails', this.deviceModel); store.dispatch('map/setTrainDetails', this.deviceModel);
this.mouseEvent.mouseover(); this.mouseEvent.mouseover();
} }
this.on('mouseover', () => { this.on('mouseover', () => {
store.dispatch('map/setTrainDetails', this.deviceModel); store.dispatch('map/setTrainDetails', this.deviceModel);
this.mouseEvent.mouseover(); this.mouseEvent.mouseover();
}); });
this.on('mouseout', () => { this.on('mouseout', () => {
store.dispatch('map/setTrainDetails', null); store.dispatch('map/setTrainDetails', null);
this.mouseEvent.mouseout(); this.mouseEvent.mouseout();
}); });
} }
create() { create() {
const model = this.model; const model = this.model;
const style = this.model.style; const style = this.model.style;
this.trainBodyBox = new TrainBodyBox({ this.trainBodyBox = new TrainBodyBox({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
point: model.point, point: model.point,
style: style style: style
}); });
const beginX = (model.point.x + style.Train.trainBody.lrPadding); const beginX = (model.point.x + style.Train.trainBody.lrPadding);
const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA); 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; const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4;
this.textH = style.Train.common.haveTextHSDA ? new ETextName({ this.textH = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 0), x: parseInt(beginX + margin * 0),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textHContent, text: style.Train.hsda.textHContent,
textFill: style.trainYellowColor, textFill: style.trainYellowColor,
fontSize: style.Train.hsda.trainHSDATextFontSize, fontSize: style.Train.hsda.trainHSDATextFontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
this.textS = style.Train.common.haveTextHSDA ? new ETextName({ this.textS = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 1), x: parseInt(beginX + margin * 1),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textSContent, text: style.Train.hsda.textSContent,
textFill: style.trainBlueColor, textFill: style.trainBlueColor,
fontSize: style.Train.hsda.trainHSDATextFontSize, fontSize: style.Train.hsda.trainHSDATextFontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
this.textD = style.Train.common.haveTextHSDA ? new ETextName({ this.textD = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 2), x: parseInt(beginX + margin * 2),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textDContent, text: style.Train.hsda.textDContent,
textFill: style.trainGreenColor, textFill: style.trainGreenColor,
fontSize: style.Train.hsda.trainHSDATextFontSize, fontSize: style.Train.hsda.trainHSDATextFontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
this.textA = style.Train.common.haveTextHSDA ? new ETextName({ this.textA = style.Train.common.haveTextHSDA ? new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z, z: model.z,
x: parseInt(beginX + margin * 3), x: parseInt(beginX + margin * 3),
y: parseInt(beginY), y: parseInt(beginY),
text: style.Train.hsda.textAContent, text: style.Train.hsda.textAContent,
textFill: style.trainRedColor, textFill: style.trainRedColor,
fontSize: style.Train.hsda.trainHSDATextFontSize, fontSize: style.Train.hsda.trainHSDATextFontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'middle', textAlign: 'middle',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}) : ''; }) : '';
const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号) const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号)
const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode
?(model.directionCode||style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber)
: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 targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码
const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号
this.textTrainServer = new ETextName({ this.textTrainServer = new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z+1, z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x), x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x),
y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y), y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y),
text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length), text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length),
textFill: model.style.Train.trainServer.fontColor || style.trainTextColor, textFill: model.style.Train.trainServer.fontColor || style.trainTextColor,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}); });
this.textTrainTarget = new ETextName({ this.textTrainTarget = new ETextName({
zlevel: this.model.zlevel, zlevel: this.model.zlevel,
z: this.model.z+1, z: this.model.z + 1,
x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x), x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x),
y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y), y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y),
text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length), text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length),
textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor, textFill: model.style.Train.trainTarget.fontColor || style.trainTextColor,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: style.Train.trainTarget.trainTargetTextAlign, textAlign: style.Train.trainTarget.trainTargetTextAlign,
textVerticalAlign: 'top' textVerticalAlign: 'top'
}); });
this.textTrainNumber = new ETextName({ this.textTrainNumber = new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z+1, z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x), x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y), y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y),
text: targetCode.substring(targetCode.length - 3), text: targetCode.substring(targetCode.length - 3),
textFill: style.trainTextColor, textFill: style.trainTextColor,
textStroke: style.trainTextColor, textStroke: style.trainTextColor,
fontWeight: 400, fontWeight: 400,
textStrokeWidth: 0, textStrokeWidth: 0,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}); });
this.textTrainTargetNumber = new ETextName({ this.textTrainTargetNumber = new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z+1, z: model.z + 1,
x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x), x: parseInt(model.point.x + style.Train.trainTargetNumber.trainTargetNumberOffset.x),
y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y), y: parseInt(model.point.y + style.Train.trainTargetNumber.trainTargetNumberOffset.y),
text: groupNumber.substring(groupNumber.length - 3), text: groupNumber.substring(groupNumber.length - 3),
textFill: style.trainTextColor, textFill: style.trainTextColor,
textStroke: style.trainTextColor, textStroke: style.trainTextColor,
textStrokeWidth: 0, textStrokeWidth: 0,
fontSize: model.fontSize, fontSize: model.fontSize,
fontFamily: style.Train.common.fontFamily, fontFamily: style.Train.common.fontFamily,
textAlign: 'left', textAlign: 'left',
textVerticalAlign: 'top' textVerticalAlign: 'top'
}); });
this.formatChangePosition(model, style); this.formatChangePosition(model, style);
this.add(this.trainBodyBox); this.add(this.trainBodyBox);
if (style.Train.common.haveTextHSDA) { if (style.Train.common.haveTextHSDA) {
this.add(this.textH); this.add(this.textH);
this.add(this.textS); this.add(this.textS);
this.add(this.textD); this.add(this.textD);
this.add(this.textA); this.add(this.textA);
} }
if (style.Train.common.hasAtrStatus) { if (style.Train.common.hasAtrStatus) {
this.atrStatus = new Circle({ this.atrStatus = new Circle({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z + 1, z: model.z + 1,
@ -180,12 +180,14 @@ export default class TrainBody extends Group {
}); });
// this.add(this.atrStatus); // this.add(this.atrStatus);
} }
const travelSignsOffsetX = this.deviceModel.right ? style.Train.travelSigns.trainTravelRightSignsOffset.x : style.Train.travelSigns.trainTravelLeftSignsOffset.x;
const travelSignsOffsetY = this.deviceModel.right ? style.Train.travelSigns.trainTravelRightSignsOffset.y : style.Train.travelSigns.trainTravelLeftSignsOffset.y;
if (style.Train.common.hasTravelSigns) { if (style.Train.common.hasTravelSigns) {
this.travelSigns = new ETextName({ this.travelSigns = new ETextName({
zlevel: model.zlevel, zlevel: model.zlevel,
z: model.z + 1, z: model.z + 1,
x: parseInt(model.point.x + style.Train.travelSigns.trainTravelSignsOffset.x), x: parseInt(model.point.x + travelSignsOffsetX),
y: parseInt(model.point.y + style.Train.travelSigns.trainTravelSignsOffset.y), y: parseInt(model.point.y + travelSignsOffsetY),
text: this.deviceModel.right ? '>' : '<', text: this.deviceModel.right ? '>' : '<',
textFill: '#00C300', textFill: '#00C300',
textStroke: style.trainTextColor, textStroke: style.trainTextColor,
@ -248,55 +250,55 @@ export default class TrainBody extends Group {
}); });
this.add(this.delayTime); this.add(this.delayTime);
} }
} }
removeTrainDetail() { removeTrainDetail() {
this.mouseEvent.mouseout(); this.mouseEvent.mouseout();
store.dispatch('map/setTrainDetails', null); store.dispatch('map/setTrainDetails', null);
this.deviceModel.down = false; this.deviceModel.down = false;
} }
setTrainColor(color) { setTrainColor(color) {
this.trainBodyBox && this.trainBodyBox.setStyle('fill', color); this.trainBodyBox && this.trainBodyBox.setStyle('fill', color);
} }
setTextTrainServerColor(color) { setTextTrainServerColor(color) {
this.textTrainServer&&this.textTrainServer.setStyle('textFill', color); this.textTrainServer && this.textTrainServer.setStyle('textFill', color);
this.textTrainServer&&this.textTrainServer.setStyle('textStroke', color); this.textTrainServer && this.textTrainServer.setStyle('textStroke', color);
} }
setTextTrainTargetColor(color) { setTextTrainTargetColor(color) {
this.textTrainTarget&&this.textTrainTarget.setStyle('textFill', color); this.textTrainTarget && this.textTrainTarget.setStyle('textFill', color);
this.textTrainTarget&&this.textTrainTarget.setStyle('textStroke', color); this.textTrainTarget && this.textTrainTarget.setStyle('textStroke', color);
} }
setTextTrainNumberColor(color) { setTextTrainNumberColor(color) {
this.textTrainNumber&&this.textTrainNumber.setStyle('textFill', color); this.textTrainNumber && this.textTrainNumber.setStyle('textFill', color);
this.textTrainNumber&&this.textTrainNumber.setStyle('textStroke', color); this.textTrainNumber && this.textTrainNumber.setStyle('textStroke', color);
} }
setTextTrainTargetNumberColor(color) { setTextTrainTargetNumberColor(color) {
this.textTrainTargetNumber&&this.textTrainTargetNumber.setStyle('textFill', color); this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textFill', color);
this.textTrainTargetNumber&&this.textTrainTargetNumber.setStyle('textStroke', color); this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textStroke', color);
} }
setHShow(isShow) { setHShow(isShow) {
if (this.textH) { if (this.textH) {
isShow ? this.textH.show() : this.textH.hide(); isShow ? this.textH.show() : this.textH.hide();
} }
} }
setSShow(isShow) { setSShow(isShow) {
if (this.textS) { if (this.textS) {
isShow ? this.textS.show() : this.textS.hide(); isShow ? this.textS.show() : this.textS.hide();
} }
} }
setDShow(isShow) { setDShow(isShow) {
if (this.textD) { if (this.textD) {
isShow ? this.textD.show() : this.textD.hide(); isShow ? this.textD.show() : this.textD.hide();
} }
} }
setAShow(isShow) { setAShow(isShow) {
if (this.textA) { if (this.textA) {
isShow ? this.textA.show() : this.textA.hide(); isShow ? this.textA.show() : this.textA.hide();
} }
} }
setBodyBoxShape(key, color) { setBodyBoxShape(key, color) {
this.trainBodyBox && this.trainBodyBox.setColor(key, color); this.trainBodyBox && this.trainBodyBox.setColor(key, color);
} }
getBoundingRect() { getBoundingRect() {
let rect = null; let rect = null;
this.eachChild(elem => { this.eachChild(elem => {
@ -313,29 +315,29 @@ export default class TrainBody extends Group {
}); });
return rect || new BoundingRect(0, 0, 0, 0); return rect || new BoundingRect(0, 0, 0, 0);
} }
formatChangePosition(model, style) { formatChangePosition(model, style) {
if (this.nameFormat) { if (this.nameFormat) {
const arr = this.nameFormat.split(':'); const arr = this.nameFormat.split(':');
let widthText = 0; let widthText = 0;
arr.forEach(ele => { arr.forEach(ele => {
if (ele == 'targetCode') { if (ele == 'targetCode') {
!style.Train.common.fixedCoordinates && this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); !style.Train.common.fixedCoordinates && this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) );
widthText += this.textTrainNumber.getBoundingRect().width; widthText += this.textTrainNumber.getBoundingRect().width;
this.add(this.textTrainNumber); this.add(this.textTrainNumber);
} else if (ele == 'serviceNumber') { } else if (ele == 'serviceNumber') {
!style.Train.common.fixedCoordinates && this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainServer.getBoundingRect().width; widthText += this.textTrainServer.getBoundingRect().width;
this.add(this.textTrainServer); this.add(this.textTrainServer);
} else if (ele == 'tripNumber') { } else if (ele == 'tripNumber') {
!style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainTarget.getBoundingRect().width; widthText += this.textTrainTarget.getBoundingRect().width;
this.add(this.textTrainTarget); this.add(this.textTrainTarget);
} else if (ele == 'groupNumber') { } else if (ele == 'groupNumber') {
!style.Train.common.fixedCoordinates && this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); !style.Train.common.fixedCoordinates && this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset));
widthText += this.textTrainTargetNumber.getBoundingRect().width; widthText += this.textTrainTargetNumber.getBoundingRect().width;
this.add(this.textTrainTargetNumber); this.add(this.textTrainTargetNumber);
} }
}); });
} }
} }
} }

View File

@ -2,7 +2,7 @@ import store from '@/store';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
function handle(state, data) { function handle(state, data) {
console.log(data, 'socket订阅'); // console.log(data, 'socket订阅');
const msg = data.body; const msg = data.body;
const path = window.location.href; const path = window.location.href;
switch (data.type) { switch (data.type) {

View File

@ -22,7 +22,7 @@ export function creatSubscribe(topic, header) {
function callback(Response) { function callback(Response) {
if (store) { if (store) {
var data = JSON.parse(Response.body); var data = JSON.parse(Response.body);
// console.log(data); // console.log(Response.body);
store.dispatch('socket/setStomp', data); store.dispatch('socket/setStomp', data);
} else { } else {
callback(Response); callback(Response);

View File

@ -322,6 +322,16 @@ export default {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0; this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`)); this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`));
if (resp.data.planRunning) {
this.$store.dispatch('training/simulationStart');
} else {
this.$store.dispatch('training/over');
}
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
} else if (this.isScript) {
this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
}
} }
}, },
// //

View File

@ -113,21 +113,14 @@ export default {
if (this.try != '0') { if (this.try != '0') {
this.loadInitData(); this.loadInitData();
} }
const resp = '';// await runDiagramIsStart(this.group);
if (resp && resp.data) {
this.isDisable = true;
this.$store.dispatch('training/simulationStart');
} else {
this.isDisable = false;
this.$store.dispatch('training/over');
}
this.change3dname(); this.change3dname();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
loadInitData() { loadInitData() {
const data = { const data = {
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,

View File

@ -21,7 +21,6 @@
import SetTime from './demon/setTime'; import SetTime from './demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation'; import { ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation';
import { runDiagramIsStart } from '@/api/simulation';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
@ -76,20 +75,14 @@ export default {
methods: { methods: {
async initLoadPage() { async initLoadPage() {
try { try {
const resp = '';// await runDiagramIsStart(this.group);
if (resp && resp.data) {
this.isDisable = true;
this.$store.dispatch('training/simulationStart');
} else {
this.isDisable = false;
this.$store.dispatch('training/over');
}
await this.loadSystemTime(); await this.loadSystemTime();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}, },
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
selectBeginTime() { selectBeginTime() {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },

View File

@ -115,7 +115,7 @@ export default {
{ prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' }, { prop: 'position.x', firstLevel: 'position', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px' },
{ prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' } { prop: 'position.y', firstLevel: 'position', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px' }
] }, ] },
{ prop:'cycleCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, { prop:'cycleCode', label: '自动折返进路code:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList },
] ]
} }
} }
@ -126,7 +126,7 @@ export default {
const form = { const form = {
labelWidth: '150px', labelWidth: '150px',
items: [ items: [
{ prop:'cycleCode', label: '自动折返进路:', type: 'select', optionLabel: 'name', optionValue: 'code', options: this.autoList }, { prop:'cycleCode', label: '自动折返进路:', type: 'select', optionLabel: 'name&&code', optionValue: 'code', options: this.autoList },
{ prop: 'name', label: '自动折返名称:', type: 'input' }, { prop: 'name', label: '自动折返名称:', type: 'input' },
{ prop: 'subtitleName', label: '副标题名称:', type: 'input' }, { prop: 'subtitleName', label: '副标题名称:', type: 'input' },
{ prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [ { prop: 'position', label: '坐标:', type: 'coordinate', width: '140px', children: [