This commit is contained in:
sunzhenyu 2020-03-12 18:40:17 +08:00
commit 7e6ea076f8
56 changed files with 1066 additions and 479 deletions

View File

@ -605,5 +605,9 @@ export default {
whetherAutoRoute: 'Whether auto route', whetherAutoRoute: 'Whether auto route',
hostileData: 'Hostile data', hostileData: 'Hostile data',
routeContinuesToProtectSectorData: 'Route continues to protect sector data', routeContinuesToProtectSectorData: 'Route continues to protect sector data',
physicalSectionID: 'Physical section id' physicalSectionID: 'Physical section ID',
physicalSectionName: 'Physical section name',
routePhysicalSectionData: 'Route physical section data',
routeSideDefenseSwitch: 'Route side defense switch',
switchID: 'Switch ID'
}; };

View File

@ -598,5 +598,11 @@ export default {
whetherAutoRoute: '是否自定进路', whetherAutoRoute: '是否自定进路',
hostileData: '敌对数据', hostileData: '敌对数据',
routeContinuesToProtectSectorData: '进路延续保护区段数据', routeContinuesToProtectSectorData: '进路延续保护区段数据',
physicalSectionID: '物理区段ID' physicalSectionID: '物理区段ID',
physicalSectionName: '物理区段名称',
routePhysicalSectionData: '进路物理区段数据',
routeSideDefenseSwitch: '进路侧防道岔',
switchID: '道岔ID',
normalPosition: '定位',
reversePosition: '反位'
}; };

View File

@ -7,234 +7,234 @@ import store from '@/store';
/** 车身*/ /** 车身*/
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.destinationCode || 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: style.trainTextColor, textFill: 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: style.trainTextColor, textFill: 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.trainBody.lrPadding), x: parseInt(model.point.x - style.Train.trainBody.lrPadding),
y: parseInt(model.point.y + style.Train.trainBody.upPadding), y: parseInt(model.point.y + style.Train.trainBody.upPadding),
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);
} }
} }
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);
} }
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') {
this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); 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') {
this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); 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') {
this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); 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') {
this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); 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

@ -125,5 +125,7 @@ export default class defaultStyle {
export const drawSectionStyle = { export const drawSectionStyle = {
routePhysicalSection: 'rgba(255,255,0,0.5)', routePhysicalSection: 'rgba(255,255,0,0.5)',
continueProtectSection: 'rgba(255,0,255,0.5)', continueProtectSection: 'rgba(255,0,255,0.5)',
signalNearSection: 'rgba(255, 0, 0, 0.5)' signalNearSectionCBTC: 'rgba(255, 0, 0, 0.5)',
signalNearSectionReserve: 'rgba(160, 32, 240, 0.5)',
signalNearSection: 'rgba(124, 252, 0, 0.5)'
}; };

View File

@ -212,7 +212,7 @@ class SkinCode extends defaultStyle {
this[deviceType.MapCycleButtonVO] = { this[deviceType.MapCycleButtonVO] = {
// 是否显示 // 是否显示
visibleConditions: ['01'], visibleConditions: '03',
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
@ -239,7 +239,7 @@ class SkinCode extends defaultStyle {
this[deviceType.StationStand] = { this[deviceType.StationStand] = {
common: { // 通用属性 common: { // 通用属性
textFontSize: 8, // 站台默认字体大小 textFontSize: 8, // 站台默认字体大小
functionButtonShow: ['01'] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 1.6, // 站台屏蔽门高度 height: 1.6, // 站台屏蔽门高度
@ -320,7 +320,7 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: true, // 公里标显示 kmPostShow: true, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示
kilometerPosition: 'down', // 公里标位置 kilometerPosition: 'down', // 公里标位置
fontWeight: 'bold', // 文字错细 fontWeight: 'bold', // 文字错细
text: { text: {
@ -492,7 +492,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: [], // 显示条件 prdType displayCondition: '03', // 显示条件 prdType
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -209,7 +209,7 @@ class SkinCode extends defaultStyle {
common: { // 通用属性 common: { // 通用属性
textFontSize: 10, // 站台默认字体大小 textFontSize: 10, // 站台默认字体大小
haveJumpShow: false, // 站台是否有列车停跳显示 haveJumpShow: false, // 站台是否有列车停跳显示
functionButtonShow: [] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
@ -289,13 +289,37 @@ class SkinCode extends defaultStyle {
borderColor: '#FFFFFF' // 延迟解锁边框颜色 borderColor: '#FFFFFF' // 延迟解锁边框颜色
} }
}; };
this[deviceType.MapCycleButtonVO] = {
// 是否显示
visibleConditions: '03',
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
subtitleText: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 17 // 等于副标题距离
},
lamp: {
lineDash: null, // 灯的包围框
borderShow: false, // 是否显示边框
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
},
OutFrame: {
}
};
this[deviceType.Station] = { this[deviceType.Station] = {
// text: { // text: {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: false, // 公里标显示 kmPostShow: false, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
@ -426,7 +450,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: [], // 显示条件 prdType displayCondition: '03', // 显示条件 prdType
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -212,7 +212,7 @@ class SkinCode extends defaultStyle {
common: { // 通用属性 common: { // 通用属性
textFontSize: 10, // 站台默认字体大小 textFontSize: 10, // 站台默认字体大小
haveJumpShow: true, // 站台是否有列车停跳显示 haveJumpShow: true, // 站台是否有列车停跳显示
functionButtonShow: ['01'] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件prdType
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
@ -300,7 +300,7 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: false, // 公里标显示 kmPostShow: false, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
@ -451,7 +451,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: ['01'], // 显示条件prdType 为01 displayCondition: '03', // 显示条件prdType 为01
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
@ -465,7 +465,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.MapCycleButtonVO] = { this[deviceType.MapCycleButtonVO] = {
// 是否显示 // 是否显示
visibleConditions: ['01'], visibleConditions: '03',
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -200,7 +200,7 @@ class SkinCode extends defaultStyle {
this[deviceType.StationStand] = { this[deviceType.StationStand] = {
common: { // 通用属性 common: { // 通用属性
textFontSize: 11, // 站台默认字体大小 textFontSize: 11, // 站台默认字体大小
functionButtonShow: [] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
@ -272,13 +272,37 @@ class SkinCode extends defaultStyle {
borderColor: '#FFFFFF' // 延迟解锁边框颜色 borderColor: '#FFFFFF' // 延迟解锁边框颜色
} }
}; };
this[deviceType.MapCycleButtonVO] = {
// 是否显示
visibleConditions: '03',
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
subtitleText: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 17 // 等于副标题距离
},
lamp: {
lineDash: null, // 灯的包围框
borderShow: false, // 是否显示边框
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
},
OutFrame: {
}
};
this[deviceType.Station] = { this[deviceType.Station] = {
// text: { // text: {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: true, // 公里标显示 kmPostShow: true, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
@ -442,7 +466,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: [], // 显示条件 prdType displayCondition: '03', // 显示条件 prdType
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -204,7 +204,7 @@ class SkinCode extends defaultStyle {
textFontSize: 11, // 站台默认字体大小 textFontSize: 11, // 站台默认字体大小
special: true, // 特殊站台 special: true, // 特殊站台
haveJumpShow: true, // 站台是否有列车停跳显示 haveJumpShow: true, // 站台是否有列车停跳显示
functionButtonShow: [] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
@ -287,13 +287,37 @@ class SkinCode extends defaultStyle {
borderColor: '#FFFFFF' // 延迟解锁边框颜色 borderColor: '#FFFFFF' // 延迟解锁边框颜色
} }
}; };
this[deviceType.MapCycleButtonVO] = {
// 是否显示
visibleConditions: '03',
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 5 // 灯跟文字距离
},
subtitleText: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细
distance: 17 // 等于副标题距离
},
lamp: {
lineDash: null, // 灯的包围框
borderShow: false, // 是否显示边框
stroke: '#FFFFFF', // 框的颜色
fill: 'rgba(0,0,0,0)', // 填充色
radiusR: 6, // 控制灯大小
controlColor: '#b5b3b3' // 控制灯颜色 (灰色)
},
OutFrame: {
}
};
this[deviceType.Station] = { this[deviceType.Station] = {
// text: { // text: {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: true, // 公里标显示 kmPostShow: true, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
borderShow: true, // 车站包围框显示 borderShow: true, // 车站包围框显示
@ -464,7 +488,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: ['01'], displayCondition: '03',
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -208,7 +208,7 @@ class SkinCode extends defaultStyle {
this[deviceType.MapCycleButtonVO] = { this[deviceType.MapCycleButtonVO] = {
// 是否显示 // 是否显示
visibleConditions: ['01', '02'], visibleConditions: '01',
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细
@ -236,7 +236,7 @@ class SkinCode extends defaultStyle {
common: { // 通用属性 common: { // 通用属性
textFontSize: 10, // 站台默认字体大小 textFontSize: 10, // 站台默认字体大小
haveJumpShow: false, // 站台是否有列车停跳显示 haveJumpShow: false, // 站台是否有列车停跳显示
functionButtonShow: [] // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件01所有模式下显示 02 行调显示 03现地显示
}, },
safetyDoor: { // 屏蔽门 safetyDoor: { // 屏蔽门
height: 3, // 站台屏蔽门高度 height: 3, // 站台屏蔽门高度
@ -322,7 +322,7 @@ class SkinCode extends defaultStyle {
// show: true // 公里标名称显示 // show: true // 公里标名称显示
// }, // },
kmPostShow: false, // 公里标显示 kmPostShow: false, // 公里标显示
functionButtonShow: ['01'], // 功能灯按钮引导总锁显示条件prdType functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示
kilometerPosition: 'up', // 公里标朝向 kilometerPosition: 'up', // 公里标朝向
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
@ -458,7 +458,7 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.AutomaticRoute] = { this[deviceType.AutomaticRoute] = {
// 是否显示 // 是否显示
displayCondition: [], // 显示条件 prdType displayCondition: '03', // 显示条件 prdType
text: { text: {
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -4,16 +4,16 @@ const deviceState = {};
deviceState[deviceType.Section] = { deviceState[deviceType.Section] = {
/** 区段状态*/ /** 区段状态*/
blockade: false, // 是否封锁 blockade: 0, // 是否封锁
routeLock: false, // 是否进路锁闭 routeLock: 0, // 是否进路锁闭
overlapLock: false, // 进路延续保护锁闭 overlapLock: 0, // 进路延续保护锁闭
ctOccupied: false, // 通信车占用 ctOccupied: 0, // 通信车占用
nctOccupied: false, // 非通信车占用 nctOccupied: 0, // 非通信车占用
cutOff: false, // 是否切除 cutOff: 0, // 是否切除
invalid: false, // 是否失效 invalid: 0, // 是否失效
speedUpLimit: 0, // 最高限速 speedUpLimit: 0, // 最高限速
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
}; };
deviceState[deviceType.Switch] = { deviceState[deviceType.Switch] = {
@ -50,7 +50,7 @@ deviceState[deviceType.Switch] = {
// State14: '14' /** 道岔状态类型 - 封锁*/ // State14: '14' /** 道岔状态类型 - 封锁*/
// }, // },
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
// /** 是否切除*/ // /** 是否切除*/
// cutOff: { // cutOff: {
// Default: false /** 是否切除*/ // Default: false /** 是否切除*/
@ -58,19 +58,19 @@ deviceState[deviceType.Switch] = {
}; };
deviceState[deviceType.Signal] = { deviceState[deviceType.Signal] = {
blockade: false, // 是否锁闭 blockade: 0, // 是否锁闭
logicLight: false, // 逻辑点灯 logicLight: 0, // 逻辑点灯
greenOpen: false, // 绿灯开放 greenOpen: 0, // 绿灯开放
yellowOpen: false, // 黄灯开放 yellowOpen: 0, // 黄灯开放
redOpen: true, // 红灯开放(默认状态) redOpen: 1, // 红灯开放(默认状态)
delayTime: 0, // 信号机延迟解锁倒计时 delayTime: 0, // 信号机延迟解锁倒计时
atsControl: 1, // 0是人工1是自动 atsControl: 1, // 0是人工1是自动
fault: false // 是否故障 fault: 0 // 是否故障
}; };
deviceState[deviceType.Station] = { deviceState[deviceType.Station] = {
/** 是否故障*/ /** 是否故障*/
fault: false, /** 非故障*/ fault: 0, /** 非故障*/
controlMode: 'Center' controlMode: 'Center'
// controlMode: 'Local' // Center 中控 Local 站控 Emergency 紧急站控 Interlock 联锁控 // controlMode: 'Local' // Center 中控 Local 站控 Emergency 紧急站控 Interlock 联锁控
}; };
@ -87,7 +87,7 @@ deviceState[deviceType.Psd] = {
// State03: '03' /** 切除 */ // State03: '03' /** 切除 */
// }, // },
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
}; };
deviceState[deviceType.StationDelayUnlock] = { deviceState[deviceType.StationDelayUnlock] = {
@ -99,7 +99,7 @@ deviceState[deviceType.StationDelayUnlock] = {
// }, // },
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
}; };
deviceState[deviceType.StationStand] = { deviceState[deviceType.StationStand] = {
@ -123,7 +123,7 @@ deviceState[deviceType.StationStand] = {
// State04: '04' /** 默认 */ // State04: '04' /** 默认 */
// }, // },
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
}; };
deviceState[deviceType.Train] = { deviceState[deviceType.Train] = {
@ -207,7 +207,7 @@ deviceState[deviceType.Train] = {
// State02: '02' /** 有报警 */ // State02: '02' /** 有报警 */
// }, // },
/** 车门是否关闭且锁闭 */ /** 车门是否关闭且锁闭 */
doorCloseLock: true, doorCloseLock: 1,
/** 列车运行级别 */ /** 列车运行级别 */
runLevel: 'CBTC', runLevel: 'CBTC',
/** 驾驶模式 */ /** 驾驶模式 */
@ -219,7 +219,7 @@ deviceState[deviceType.Train] = {
/** 列车是否向右形式 */ /** 列车是否向右形式 */
right: 1, right: 1,
/** 是否故障*/ /** 是否故障*/
fault: false /** 非故障*/ fault: 0 /** 非故障*/
}; };
export default deviceState; export default deviceState;

View File

@ -43,6 +43,7 @@ class Jlmap {
const width = opts.dom.clientWidth; const width = opts.dom.clientWidth;
const height = opts.dom.clientHeight; const height = opts.dom.clientHeight;
this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel; this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel;
this.previewOrMapDraw = opts.showConfig.previewOrMapDraw;
this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config)); this.$zr = zrender.init(opts.dom, deepAssign({ renderer, devicePixelRatio, width, height }, opts.config));
@ -61,6 +62,7 @@ class Jlmap {
this.$keyboardController = new KeyboardController(this); this.$keyboardController = new KeyboardController(this);
this.$keyboardController.enable(); this.$keyboardController.enable();
this.showConfig = opts.showConfig;
} }
loadStyle(lineCode) { loadStyle(lineCode) {
@ -136,6 +138,7 @@ class Jlmap {
this.$mouseController.disable(); this.$mouseController.disable();
} else { } else {
opts['zoomOnMouseWheel'] = this.zoomOnMouseWheel; opts['zoomOnMouseWheel'] = this.zoomOnMouseWheel;
opts['previewOrMapDraw'] = this.previewOrMapDraw;
this.$mouseController.enable(opts); this.$mouseController.enable(opts);
} }
@ -159,7 +162,7 @@ class Jlmap {
(list || []).forEach(elem => { (list || []).forEach(elem => {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
const nDevice = deepAssign(oDevice || {}, elem); const nDevice = deepAssign(oDevice || {}, elem);
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
delete this.mapDevice[code]; delete this.mapDevice[code];
@ -246,9 +249,23 @@ class Jlmap {
const code = elem.code; const code = elem.code;
const type = elem._type; const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
this.hookHandle(oDevice, elem) this.hookHandle(oDevice, elem);
}); });
} }
updateShowMode(list, showMode) {
this.showConfig.showMode = showMode;
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
oDevice.showMode = showMode;
this.$painter.updateShowMode(oDevice);
});
this.$painter.$transformHandle.revisibleAll();
}
getShowConfig() {
return this.showConfig;
}
update(list) { update(list) {
this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
(list || []).forEach(elem => { (list || []).forEach(elem => {
@ -263,12 +280,12 @@ class Jlmap {
this.$painter.update(signalDevice); this.$painter.update(signalDevice);
} }
} else { } else {
const oDevice = this.mapDevice[code] || deviceFactory(type, elem); const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig);
if (elem.dispose) { if (elem.dispose) {
this.$painter.delete(oDevice); this.$painter.delete(oDevice);
} else { } else {
// if (this.hookHandle(oDevice, elem)) { // if (this.hookHandle(oDevice, elem)) {
this.$painter.update(oDevice); this.$painter.update(oDevice);
// } // }
} }
} }

View File

@ -54,6 +54,7 @@ class MouseController extends Eventful {
this._moveOnMouseMove = opts.moveOnMouseMove || true; this._moveOnMouseMove = opts.moveOnMouseMove || true;
this._zoomOnMouseWheel = opts.zoomOnMouseWheel || false; this._zoomOnMouseWheel = opts.zoomOnMouseWheel || false;
this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true; this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true;
this._previewOrMapDraw = opts.previewOrMapDraw || false;
this.disable(); this.disable();
@ -121,7 +122,7 @@ class MouseController extends Eventful {
this._preventDefaultMouseMove && eventTool.stop(e.event); this._preventDefaultMouseMove && eventTool.stop(e.event);
this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y }); this.trigger(this.events.__Pan, { dx, dy, oldX, oldY, newX: this._x, newY: this._y });
} else if (e.which === 3 && this._zoomOnMouseWheel) { } else if (e.which === 3 && this._zoomOnMouseWheel && this._previewOrMapDraw) {
this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY}); this.handleMouseMoveRight({x: e.offsetX, y: e.offsetY});
} }
} }

View File

@ -161,7 +161,14 @@ class Painter {
} }
} }
} }
/**
* 更新显示模式
*/
updateShowMode(device) {
if (device && device.instance) {
device.instance.setShowMode();
}
}
/** /**
* 更新transform变化 * 更新transform变化
* @param {*} opt * @param {*} opt

View File

@ -6,7 +6,7 @@ import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import EMouse from './EMouse'; import EMouse from './EMouse';
import {getPrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class Automactic extends Group { export default class Automactic extends Group {
constructor(model, style) { constructor(model, style) {
@ -17,12 +17,14 @@ export default class Automactic extends Group {
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, style.MapCycleButtonVO.visibleConditions) || model.previewOrMapDraw) {
if (!this.prdType || this.style.MapCycleButtonVO.visibleConditions.indexOf(this.prdType) !== -1) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
} }
create() { create() {
@ -136,4 +138,19 @@ export default class Automactic extends Group {
} }
return null; return null;
} }
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.style.MapCycleButtonVO.visibleConditions;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.control.show();
this.text.show();
this.subtitleText && this.subtitleText.show();
this.arcBorder && this.arcBorder.show();
} else {
this.control.hide();
this.text.hide();
this.subtitleText && this.subtitleText.hide();
this.arcBorder && this.arcBorder.hide();
}
}
} }

View File

@ -5,7 +5,7 @@ import Group from 'zrender/src/container/Group';
import Arc from 'zrender/src/graphic/shape/Arc'; import Arc from 'zrender/src/graphic/shape/Arc';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import EMouse from './EMouse'; import EMouse from './EMouse';
import {getPrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class LcControl extends Group { export default class LcControl extends Group {
constructor(model, style) { constructor(model, style) {
@ -16,12 +16,14 @@ export default class LcControl extends Group {
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, style.AutomaticRoute.displayCondition) || model.previewOrMapDraw) {
if (!this.prdType || this.style.AutomaticRoute.displayCondition.indexOf(this.prdType) !== -1) {
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
this.setState(model); this.setState(model);
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
} }
create() { create() {
@ -106,4 +108,17 @@ export default class LcControl extends Group {
} }
return null; return null;
} }
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.style.AutomaticRoute.displayCondition;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.control.show();
this.text.show();
this.subtitleText && this.subtitleText.show();
} else {
this.control.hide();
this.text.hide();
this.subtitleText && this.subtitleText.hide();
}
}
} }

View File

@ -76,4 +76,5 @@ export default class LcControl extends Group {
} }
return null; return null;
} }
setShowMode() {}
} }

View File

@ -80,4 +80,5 @@ export default class LimitControl extends Group {
} }
return null; return null;
} }
setShowMode() {}
} }

View File

@ -1,6 +1,6 @@
import Line from 'zrender/src/graphic/shape/Line'; import Line from 'zrender/src/graphic/shape/Line';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import {getPrdType, isShowThePrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class Line2 extends Group { export default class Line2 extends Group {
constructor(model, style) { constructor(model, style) {
@ -11,11 +11,13 @@ export default class Line2 extends Group {
this.z = 0; this.z = 0;
this.model = model; this.model = model;
this.style = style; this.style = style;
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) {
if (isShowThePrdType(this.prdType, model.showConditions)) {
this.create(); this.create();
this.setState(model); this.setState(model);
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
} }
create() { create() {
@ -55,4 +57,18 @@ export default class Line2 extends Group {
setState(model) { setState(model) {
this.setLineType(model.type); this.setLineType(model.type);
} }
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.model.showConditions;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.eachChild((child) => {
child.show();
});
} else {
this.eachChild((child) => {
child.hide();
});
}
}
} }

View File

@ -1,6 +1,6 @@
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 {getPrdType, isShowThePrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class OutFrame extends Group { export default class OutFrame extends Group {
constructor(model, style) { constructor(model, style) {
@ -11,11 +11,13 @@ export default class OutFrame extends Group {
this.style = style; this.style = style;
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.z = 0; this.z = 0;
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) {
if (isShowThePrdType(this.prdType, model.showConditions)) {
this.create(); this.create();
this.setState(model); this.setState(model);
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
} }
create() { create() {
@ -42,4 +44,14 @@ export default class OutFrame extends Group {
// 设置状态 // 设置状态
setState(model) { setState(model) {
} }
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.model.showConditions;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.box && this.box.show();
} else {
this.box && this.box.hide();
}
}
} }

View File

@ -96,4 +96,6 @@ export default class Line2 extends Group {
this.on('mouseover', () => { this.highlight.mouseover(); }); this.on('mouseover', () => { this.highlight.mouseover(); });
} }
} }
setShowMode() {}
} }

View File

@ -66,4 +66,5 @@ export default class Resource extends Group {
} }
return null; return null;
} }
setShowMode() {}
} }

View File

@ -251,7 +251,7 @@ export default class Section extends Group {
/** 区段名称 (逻辑区段名称 或 物理区段名称 是否显示)*/ /** 区段名称 (逻辑区段名称 或 物理区段名称 是否显示)*/
let tempx = x; let tempx = x;
let tempy = y; let tempy = y;
if (model.type == '01') { if (model.type == '01') { // 物理区段名称
if (style.Section.text.show) { if (style.Section.text.show) {
const opposite = style.Section.text.opposite ? -1 : 1; const opposite = style.Section.text.opposite ? -1 : 1;
tempx += traingle.getSin(style.Section.text.distance); tempx += traingle.getSin(style.Section.text.distance);
@ -274,7 +274,7 @@ export default class Section extends Group {
}); });
this.add(this.name); this.add(this.name);
} }
} else if (model.type == '02') { } else if (model.type == '02') { // 逻辑区段
if (style.Section.logicText.show) { if (style.Section.logicText.show) {
const opposite = style.Section.logicText.opposite ? -1 : 1; const opposite = style.Section.logicText.opposite ? -1 : 1;
tempx += traingle.getSin(style.Section.logicText.distance); tempx += traingle.getSin(style.Section.logicText.distance);
@ -297,7 +297,7 @@ export default class Section extends Group {
}); });
this.add(this.name); this.add(this.name);
} }
} else if (model.type == '03') { } else if (model.type == '03') { // 道岔区段
if (style.Section.switchText.show) { if (style.Section.switchText.show) {
this.name = new ETextName({ this.name = new ETextName({
zlevel: this.zlevel, zlevel: this.zlevel,
@ -317,7 +317,7 @@ export default class Section extends Group {
}); });
this.add(this.name); this.add(this.name);
} }
} else if (model.type == '04') { } else if (model.type == '04') { // 道岔计轴区段名称
if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft')) { if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft')) {
this.name = new ETextName({ this.name = new ETextName({
zlevel: this.zlevel, zlevel: this.zlevel,
@ -863,7 +863,7 @@ export default class Section extends Group {
if (this.selectedType === type) { if (this.selectedType === type) {
return; return;
} }
if (selected && !this.selectedType) { if (selected && type) {
this.section && this.section.setStyle({ stroke: drawSectionStyle[type] }); this.section && this.section.setStyle({ stroke: drawSectionStyle[type] });
} else { } else {
this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor }); this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor });
@ -886,5 +886,5 @@ export default class Section extends Group {
mouseover() { mouseover() {
this.section && this.section.setStyle({ stroke: 'rgba(255,255,255,0.8)' }); this.section && this.section.setStyle({ stroke: 'rgba(255,255,255,0.8)' });
} }
setShowMode() {}
} }

View File

@ -588,6 +588,7 @@ class Signal extends Group {
}); });
} }
} }
setShowMode() {}
} }
export default Signal; export default Signal;

View File

@ -10,7 +10,7 @@ import EArrow from './EArrow';
import { arrow } from '../utils/ShapePoints'; import { arrow } from '../utils/ShapePoints';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
import BoundingRect from 'zrender/src/core/BoundingRect'; import BoundingRect from 'zrender/src/core/BoundingRect';
import {getPrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class Station extends Group { export default class Station extends Group {
constructor(model, style) { constructor(model, style) {
@ -24,10 +24,12 @@ export default class Station extends Group {
this.create(); this.create();
this.createTurnBack(); // 创建按图折返 this.createTurnBack(); // 创建按图折返
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, style.Station.functionButtonShow) || model.previewOrMapDraw) {
if ((!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) && model.guideTotalLockPoint) {
this.createGuideTotalLock(); // 创建引导总锁 this.createGuideTotalLock(); // 创建引导总锁
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
this.createControlMode(); this.createControlMode();
this.setState(model); this.setState(model);
this.checkIsDrawMap(); this.checkIsDrawMap();
@ -366,4 +368,14 @@ export default class Station extends Group {
this.on('mouseover', () => { this.EMouse.mouseover(); }); this.on('mouseover', () => { this.EMouse.mouseover(); });
} }
} }
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.style.Station.functionButtonShow;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.guideLamp && this.guideLamp.show();
} else {
this.guideLamp && this.guideLamp.hide();
}
}
} }

View File

@ -178,4 +178,5 @@ export default class StationControl extends Group {
} }
return null; return null;
} }
setShowMode() {}
} }

View File

@ -86,5 +86,6 @@ export default class StationCounter extends Group {
getShapeTipPoint() { getShapeTipPoint() {
return null; return null;
} }
setShowMode() {}
} }

View File

@ -104,4 +104,5 @@ export default class StationDelayUnlock extends Group {
getShapeTipPoint() { getShapeTipPoint() {
return null; return null;
} }
setShowMode() {}
} }

View File

@ -12,7 +12,7 @@ import EHighlight from '../element/EHighlight';
import ETrainStop from './ETrainStop'; import ETrainStop from './ETrainStop';
import ETrainDepart from './ETrainDepart'; import ETrainDepart from './ETrainDepart';
import EControl from '../element/EControl'; import EControl from '../element/EControl';
import {getPrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
class StationStand extends Group { class StationStand extends Group {
constructor(model, style) { constructor(model, style) {
@ -24,12 +24,14 @@ class StationStand extends Group {
this.zlevel = model.zlevel; this.zlevel = model.zlevel;
this.z = 1; this.z = 1;
this.doors = new Group(); this.doors = new Group();
this.prdType = getPrdType();
this.create(); this.create();
this.createMouseEvent(); this.createMouseEvent();
if (!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) { if (isShowThePrdType(model.prdType, style.StationStand.common.functionButtonShow) || model.previewOrMapDraw) {
this.createFunctionButton(); this.createFunctionButton();
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
this.setVisible(model.visible); this.setVisible(model.visible);
this.setState(model); this.setState(model);
this.checkIsDrawMap(); this.checkIsDrawMap();
@ -563,5 +565,21 @@ class StationStand extends Group {
this.on('mouseover', () => { this.highlight.mouseover(); }); this.on('mouseover', () => { this.highlight.mouseover(); });
} }
} }
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.style.StationStand.common.functionButtonShow;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.stopJumpLampButton && this.stopJumpLampButton.show();
this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.show();
this.upDetainLamp && this.upDetainLamp.show();
this.downDetainLamp && this.downDetainLamp.show();
} else {
this.stopJumpLampButton && this.stopJumpLampButton.hide();
this.cancelStopJumpLampButton && this.cancelStopJumpLampButton.hide();
this.upDetainLamp && this.upDetainLamp.hide();
this.downDetainLamp && this.downDetainLamp.hide();
}
}
} }
export default StationStand; export default StationStand;

View File

@ -264,7 +264,7 @@ export default class Switch extends Group {
/** 恢复状态*/ /** 恢复状态*/
recover() { recover() {
this.lockRect.hide(); // 矩形包围框 this.lockRect.hide(); // 矩形包围框
this.lockArc.hide(); // 圆形单锁框 this.lockArc.hide(); // 圆形单锁框
this.setSwitchCoreColor(this.style.backgroundColor); this.setSwitchCoreColor(this.style.backgroundColor);
this.name.getNameText().stopAnimation(false); this.name.getNameText().stopAnimation(false);
this.swCore.stopAnimation(false); this.swCore.stopAnimation(false);
@ -482,4 +482,5 @@ export default class Switch extends Group {
this.on('mouseover', () => { this.highlight.mouseover(); }); this.on('mouseover', () => { this.highlight.mouseover(); });
} }
} }
setShowMode() {}
} }

View File

@ -1,6 +1,6 @@
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import {getPrdType, isShowThePrdType} from '../utils/handlePath'; import {isShowThePrdType} from '../../utils/handlePath';
export default class Text2 extends Group { export default class Text2 extends Group {
constructor(model, style) { constructor(model, style) {
@ -12,11 +12,13 @@ export default class Text2 extends Group {
this.model = model; this.model = model;
this.style = style; this.style = style;
this.z = 6; this.z = 6;
this.prdType = getPrdType(); if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) {
if (isShowThePrdType(this.prdType, model.showConditions)) {
this.create(); this.create();
this.setState(model); this.setState(model);
} }
if (model.previewOrMapDraw) {
this.setShowMode();
}
} }
create() { create() {
@ -45,4 +47,14 @@ export default class Text2 extends Group {
setState(model) { setState(model) {
} }
// 设置显示模式
setShowMode() {
const showMode = this.model.showMode;
const showConditions = this.model.showConditions;
if (!showConditions || showConditions === '01' || showMode === showConditions) {
this.text && this.text.show();
} else {
this.text && this.text.hide();
}
}
} }

View File

@ -27,9 +27,9 @@ class EMouse extends Group {
} }
let text = ''; let text = '';
if (LangStorage.getLang() == 'en') { if (LangStorage.getLang() == 'en') {
text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.targetCode ? this.device.model.targetCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${this.device.model.directionType == '02' ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${!this.device.model.hold ? 'Normal' : 'Detained'}\n \n 跳停状态: ${!this.device.model.jump ? 'Normal' : 'Skip to continue moving'}Stationary: ${!this.device.model.stop ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m`; text = ` The planned train: ${trainType} \n Table No.: ${this.device.model.serviceNumber} \n Train Trip No.: ${this.device.model.tripNumber}\n Destination: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n Train No.: ${this.device.model.groupNumber}\n Early or late: ${destinationText}\n Direction: ${this.device.model.directionType == '02' ? 'up' : 'down'}\n Crew No.: \n Start Station: \n Terminal Station: \n Occupied Track: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n Current Station: \n Train-ground communication: normal \n Operation Speed level: 4 \n Detained: ${!this.device.model.hold ? 'Normal' : 'Detained'}\n \n 跳停状态: ${!this.device.model.jump ? 'Normal' : 'Skip to continue moving'}Stationary: ${!this.device.model.stop ? 'No' : 'Yes'}\n Blocked: No \n Speed: ${this.device.model.speed || 0} km/h \n Authorized Distance: ${this.device.model.maLen || 0} m`;
} else { } else {
text = `列车类型: ${trainType} \n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.targetCode ? this.device.model.targetCode : ''}\n\0\0号: ${this.device.model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${this.device.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${ !this.device.model.hold ? '正常' : '扣车'}\n 跳停状态: ${!this.device.model.jump ? '正常' : '跳停'} \n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`; text = `列车类型: ${trainType} \n\0\0\0\0号: ${this.device.model.serviceNumber}\n\0\0号: ${this.device.model.tripNumber}\n目的地号: ${this.device.model.destinationCode ? this.device.model.destinationCode : ''}\n\0\0号: ${this.device.model.groupNumber}\n\0\0点: ${destinationText}\n运行方向: ${this.device.model.directionType == '02' ? '上行' : '下行'}\n乘务组号: \n起点站名: \n终点站名: \n占用轨道: ${this.device.model.sectionModel ? this.device.model.sectionModel.name : ''}\n所在车站: \n车地通信: 正常\n运行等级: 4\n扣车状态: ${ !this.device.model.hold ? '正常' : '扣车'}\n 跳停状态: ${!this.device.model.jump ? '正常' : '跳停'} \n停稳状态: ${!this.device.model.stop ? '未停稳' : '停稳'}\n阻塞状态: 无\n列车速度: ${this.device.model.speed || 0} km/h\n列车移动授权距离: ${this.device.model.maLen || 0} m`;
} }
// 文字描述 // 文字描述
this.arrowText = new Text({ this.arrowText = new Text({

View File

@ -21,9 +21,9 @@ export default class ETriangle extends Group {
points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]] points:[[model.point.x + 10 * right, model.point.y], [model.point.x, model.point.y - 6], [model.point.x, model.point.y + 6]]
}, },
style: { style: {
stroke:'#FFFF00', stroke:'#00FF00',
lineWidth: 0.5, lineWidth: 0.5,
fill: '#FFFF00' fill: '#00FF00'
} }
}); });
this.add(this.angle); this.add(this.angle);

View File

@ -102,7 +102,7 @@ export default class TrainBody extends Group {
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.destinationCode || 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,

View File

@ -18,6 +18,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.nextPointIndex = 1;
this.currentAdd = 0;
this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize; this.fontSize = style.Train.common.useSelfText ? style.Train.common.nameFontSize || style.Train.common.trainTextFontSize : model.nameFontSize || style.Train.common.nameFontSize || style.Train.common.trainTextFontSize;
this.newScale = this.fontSize / style.Train.common.trainTextFontSize; this.newScale = this.fontSize / style.Train.common.trainTextFontSize;
this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat; this.nameFormat = style.Train.common.useSelfFormat ? style.Train.trainBody.trainNameFormat : model.nameFormat || style.Train.trainBody.trainNameFormat;
@ -68,7 +70,7 @@ export default class Train extends Group {
destinationStatus: model.destinationStatus, destinationStatus: model.destinationStatus,
serviceNumber: model.serviceNumber, serviceNumber: model.serviceNumber,
tripNumber: model.tripNumber, tripNumber: model.tripNumber,
targetCode: model.targetCode, destinationCode: model.destinationCode,
groupNumber: model.groupNumber, groupNumber: model.groupNumber,
directionType: model.directionType, directionType: model.directionType,
directionCode: model.directionCode, directionCode: model.directionCode,
@ -105,21 +107,37 @@ export default class Train extends Group {
scale: this.newScale scale: this.newScale
}); });
const data = this.model.physicalCode; if (style.Section.trainPosition.display) {
const oldmodel = store.getters['map/getDeviceByCode'](data); const data = this.model.physicalCode;
const leftPoint = oldmodel.points[0]; const oldmodel = store.getters['map/getDeviceByCode'](data);
const rightPoint = oldmodel.points[oldmodel.points.length - 1]; const leftPoint = oldmodel.points[0];
const right = this.model.right == 1 ? 1 : 0; const rightPoint = oldmodel.points[oldmodel.points.length - 1];
this.startX = leftPoint.x + (1 - right) * (rightPoint.x - leftPoint.x); const right = this.model.right == 1 ? 1 : 0;
this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y); this.startX = leftPoint.x + (1 - right) * (rightPoint.x - leftPoint.x);
this.triangle = new ETriangle({ this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y);
style: this.style, // 算出折线的长度
zlevel: this.zlevel, this.lineLength = 0;
z:10, let oldPoint = null;
right: this.model.right, oldmodel.points.forEach((point)=>{
point:{x:this.startX, y:this.startY} if (oldPoint) {
}); const temp = Math.sqrt(
this.add(this.triangle); Math.pow(point.x - oldPoint.x, 2) +
Math.pow(point.y - oldPoint.y, 2),
);
this.lineLength += temp;
}
oldPoint = point;
});
// this.animatePoint = {x:this.startX, y:this.startY};
this.triangle = new ETriangle({
style: this.style,
zlevel: this.zlevel,
z:10,
right: this.model.right,
point:{x:this.startX, y:this.startY}
});
this.add(this.triangle);
}
this.add(this.trainB); this.add(this.trainB);
this.add(this.trainL); this.add(this.trainL);
@ -136,20 +154,66 @@ export default class Train extends Group {
updateSection() { updateSection() {
const train = this.model; const train = this.model;
if (train.physicalCode && train.offsetp) { if (train.physicalCode && train.offsetp && this.triangle) {
const data = train.physicalCode; const data = train.physicalCode;
const oldmodel = store.getters['map/getDeviceByCode'](data); const oldmodel = store.getters['map/getDeviceByCode'](data);
const leftPoint = oldmodel.points[0]; // 待处理(多个点的问题)
const rightPoint = oldmodel.points[oldmodel.points.length - 1]; // const points = train.right == 1 ? oldmodel.points : oldmodel.points.reverse();
if (this.triangle) { const points = oldmodel.points;
// 目标距离
let targetDistance = Math.sqrt(
Math.pow(points[this.nextPointIndex - 1].x - points[this.nextPointIndex].x, 2) +
Math.pow(points[this.nextPointIndex - 1].y - points[this.nextPointIndex].y, 2),
);
// // 当前距离
// const currentDistance = Math.sqrt(
// Math.pow(points[this.nextPointIndex - 1].x - this.animatePoint.x, 2) +
// Math.pow(points[this.nextPointIndex - 1].y - this.animatePoint.y, 2),
// );
const currentDistance = this.lineLength * train.offsetp - this.currentAdd;
// let cureent this.lineLength * train.offsetp
// 利用运动距离与目标距离, 判断运动的点是否超过下一个目标点, 超过了就重置下一个点
if (currentDistance >= targetDistance) {
// this.animatePoint = {
// x: points[this.nextPointIndex].x,
// y: points[this.nextPointIndex].y
// };
this.nextPointIndex++;
this.currentAdd += targetDistance;
targetDistance = Math.sqrt(
Math.pow(points[this.nextPointIndex - 1].x - points[this.nextPointIndex].x, 2) +
Math.pow(points[this.nextPointIndex - 1].y - points[this.nextPointIndex].y, 2),
);
}
if (this.nextPointIndex > points.length - 1) {
const leftPoint = oldmodel.points[0];
const rightPoint = oldmodel.points[oldmodel.points.length - 1];
this.startX = leftPoint.x + (rightPoint.x - leftPoint.x) * train.offsetp; this.startX = leftPoint.x + (rightPoint.x - leftPoint.x) * train.offsetp;
this.startY = leftPoint.y + (rightPoint.y - leftPoint.y) * train.offsetp; this.startY = leftPoint.y + (rightPoint.y - leftPoint.y) * train.offsetp;
const point = {x:this.startX, y:this.startY}; } else {
this.triangle.point = point; // debugger;
this.triangle.updateTriangle(point, train.right); // this.lineLength * train.offsetp
this.triangle.dirty(); // if (this.currentLength > targetDistance) {
this.dirty(); // this.currentLength = this.currentLength - targetDistance;
// this.nextPointIndex++;
// targetDistance = Math.sqrt(
// Math.pow(points[this.nextPointIndex - 1].x - points[this.nextPointIndex].x, 2) +
// Math.pow(points[this.nextPointIndex - 1].y - points[this.nextPointIndex].y, 2),
// );
// }
const rate = (this.lineLength * train.offsetp - this.currentAdd) / targetDistance;
this.startX = points[this.nextPointIndex - 1].x + (points[this.nextPointIndex].x - points[this.nextPointIndex - 1].x) * rate;
this.startY = points[this.nextPointIndex - 1].y + (points[this.nextPointIndex].y - points[this.nextPointIndex - 1].y) * rate;
// this.animatePoint.x = this.startX;
// this.animatePoint.y = this.startY;
} }
const point = {x:this.startX, y:this.startY};
this.triangle.point = point;
this.triangle.updateTriangle(point, train.right);
this.triangle.dirty();
this.dirty();
} }
} }
@ -447,4 +511,5 @@ export default class Train extends Group {
this.add(this.trainBorder); this.add(this.trainBorder);
} }
setShowMode() {}
} }

View File

@ -39,7 +39,7 @@ class TrainWindow extends Group {
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z - 1, z: this.z - 1,
shape: { shape: {
smooth: this.style.TrainWindow.trainWindowSmooth, smooth: this.style.TrainWindow.trainWindowSmooth, // 圆滑程度
points: [ points: [
[point.x - model.width / 2, point.y], [point.x - model.width / 2, point.y],
[point.x + model.width / 2, point.y], [point.x + model.width / 2, point.y],
@ -78,6 +78,7 @@ class TrainWindow extends Group {
getInstanceByCode(code) { getInstanceByCode(code) {
return (store.getters['map/getDeviceByCode'](code) || {}).instance; return (store.getters['map/getDeviceByCode'](code) || {}).instance;
} }
setShowMode() {}
} }
export default TrainWindow; export default TrainWindow;

View File

@ -80,4 +80,5 @@ export default class ZcControl extends Group {
} }
return null; return null;
} }
setShowMode() {}
} }

View File

@ -30,4 +30,5 @@ export default class checkBox extends Group {
}); });
this.add(this.box); this.add(this.box);
} }
setShowMode() {}
} }

View File

@ -102,4 +102,12 @@ export default class EControl extends Group {
this.text.setStyle('textFill', color); this.text.setStyle('textFill', color);
} }
} }
hide() {
this.control.hide();
this.text.hide();
}
show() {
this.control.show();
this.text.show();
}
} }

View File

@ -41,7 +41,7 @@ export default {
}, },
data() { data() {
return { return {
unfold: false, unfold: true,
tempData: [], tempData: [],
tableStyle: { tableStyle: {
'border-bottom': 'none', 'border-bottom': 'none',
@ -105,7 +105,8 @@ export default {
const operate = { const operate = {
over: true, over: true,
operation: eachCmd.operation.code, operation: eachCmd.operation.code,
cmdType: eachCmd.operation.cmdType cmdType: eachCmd.operation.cmdType,
param: eachCmd.operation.param //
}; };
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
this.loading = false; this.loading = false;

View File

@ -49,13 +49,13 @@ export default {
}, },
{ {
label: '开放自动进路', label: '开放自动进路',
handler: this.atsAutoControl, handler: this.singalPassModel,
cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO
}, },
{ {
label: '关闭自动进路', label: '关闭自动进路',
handler: this.humanControl, handler: this.singalCancelPassModel,
cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO
}, },
{ {
label: '终端信号封锁', label: '终端信号封锁',
@ -307,24 +307,45 @@ export default {
arrangementRoute() { arrangementRoute() {
const step = { const step = {
start: true, start: true,
// over:true,
code: `${this.selected.code}`, code: `${this.selected.code}`,
operation: OperationEvent.Signal.arrangementRoute.menu.operation, operation: OperationEvent.Signal.arrangementRoute.menu.operation,
param: { param: {
signalCode: `${this.selected.code}` signalCode: `${this.selected.code}`
}, }
// cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true}); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true});
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.arrangementRoute.menu.operation, name: '始端/终端选择', cmdType:CMD.Signal.CMD_SIGNAL_SET_ROUTE}}); const routes = [];
this.routeList.forEach(elem => {
if (elem.startSignalCode === this.selected.code) {
routes.push(elem);
}
});
const routeCode = this.checkRoutes(routes);
this.$store.dispatch('menuOperation/pushRequestList', {
device: this.selected,
operation: {
code: OperationEvent.Signal.arrangementRoute.menu.operation,
name: '始端/终端选择',
cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE,
param: {
routeCode: routeCode
}
}
});
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow(step);
}); });
}, },
checkRoutes(routes) {
const route = routes.filter(route => {
return route.greenOpen;
});
return route[0].code;
},
// //
guide() { guide() {
const step = { const step = {
@ -334,13 +355,13 @@ export default {
operation: OperationEvent.Signal.guide.menu.operation, operation: OperationEvent.Signal.guide.menu.operation,
param: { param: {
signalCode: `${this.selected.code}` signalCode: `${this.selected.code}`
}, }
// cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE // cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid, response }) => { this.$store.dispatch('training/nextNew', step).then(({ valid, response }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.guide.menu.operation, name: '引导信号',cmdType:CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE}}); this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.guide.menu.operation, name: '引导信号', cmdType:CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE}});
} }
}); });
}, },
@ -353,14 +374,14 @@ export default {
operation: OperationEvent.Signal.cancelTrainRoute.menu.operation, operation: OperationEvent.Signal.cancelTrainRoute.menu.operation,
param: { param: {
signalCode: `${this.selected.code}` signalCode: `${this.selected.code}`
}, }
// cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE // cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.cancelTrainRoute.menu.operation, name: '取消进路',cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE}}); this.$store.dispatch('menuOperation/pushRequestList', {device: this.selected, operation: { code: OperationEvent.Signal.cancelTrainRoute.menu.operation, name: '取消进路', cmdType:CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE}});
} }
}); });
}, },
@ -373,13 +394,13 @@ export default {
operation: OperationEvent.Signal.lock.menu.operation, operation: OperationEvent.Signal.lock.menu.operation,
param: { param: {
signalCode: `${this.selected.code}` signalCode: `${this.selected.code}`
}, }
// cmdType: CMD.Signal.CMD_SIGNAL_BLOCK // cmdType: CMD.Signal.CMD_SIGNAL_BLOCK
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.lock.menu.operation, name: '终端信号机封锁',cmdType:CMD.Signal.CMD_SIGNAL_BLOCK}}); this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.lock.menu.operation, name: '终端信号机封锁', cmdType:CMD.Signal.CMD_SIGNAL_BLOCK}});
} }
}).catch(() => { }).catch(() => {
this.$refs.noticeInfo.doShow(step); this.$refs.noticeInfo.doShow(step);
@ -394,13 +415,13 @@ export default {
operation: OperationEvent.Signal.unlock.menu.operation, operation: OperationEvent.Signal.unlock.menu.operation,
param: { param: {
signalCode: `${this.selected.code}` signalCode: `${this.selected.code}`
}, }
// cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK // cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK
}; };
this.$store.dispatch('training/nextNew', step).then(({ valid }) => { this.$store.dispatch('training/nextNew', step).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.unlock.menu.operation, name: '终端信号机解封',cmdType:CMD.Signal.CMD_SIGNAL_UNBLOCK}}); this.$store.dispatch('menuOperation/pushRequestList', { device: this.selected, operation: { code: OperationEvent.Signal.unlock.menu.operation, name: '终端信号机解封', cmdType:CMD.Signal.CMD_SIGNAL_UNBLOCK}});
} }
}); });
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<pop-menu ref="popMenu" :menu="menu" /> <pop-menu ref="popMenu" :menu="menu" />
<train-init-plan ref="trainInitPlan"/> <train-init-plan ref="trainInitPlan" />
<notice-info ref="noticeInfo" /> <notice-info ref="noticeInfo" />
</div> </div>
</template> </template>

View File

@ -525,7 +525,7 @@ export default {
this.$refs.routerCommand.doShow(step, this.selected, '是否执行引导命令'); this.$refs.routerCommand.doShow(step, this.selected, '是否执行引导命令');
} }
}); });
}, }
} }
}; };
</script> </script>

View File

@ -12,14 +12,14 @@ export function getPrdType() {
return prdType; return prdType;
} }
export function isShowThePrdType (prdType, showConditions) { export function isShowThePrdType (prdType, showConditions) {
const path = window.location.href; if (showConditions === '01' || (showConditions === '02' && prdType === '02') || (showConditions === '03' && prdType === '01')) {
if (path.indexOf('map/draw') !== -1 ) {
return true; return true;
} else { } else if (!showConditions) {
if (showConditions === '01' || (showConditions === '02' && prdType === '02') || (showConditions === '03' && prdType === '01')) { return true; // 兼容老数据没有showConditions
return true;
} else if (!showConditions) {
return true; // 兼容老数据没有showConditions
}
} }
}
export function isPreviewOrMapDraw() {
const path = window.location.href;
return path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1;
} }

View File

@ -30,105 +30,105 @@ export function calculateDCenter(viewRect, zrbound) {
return { dx: dx, dy: dy }; return { dx: dx, dy: dy };
} }
export function deviceFactory(type, elem) { export function deviceFactory(type, elem, showConfig) {
return {...deviceRender[type], ...elem}; return {...deviceRender[type], ...elem, ...showConfig};
} }
export function createDevice(type, elem, propConvert) { export function createDevice(type, elem, propConvert, showConfig) {
const device = deviceFactory(type, Object.assign(elem, { _type: type } )); const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig);
return propConvert ? propConvert.initPrivateProps(device) : device; return propConvert ? propConvert.initPrivateProps(device) : device;
} }
export function parser(data, skinCode) { export function parser(data, skinCode, showConfig) {
var mapDevice = {}; var mapDevice = {};
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
if (data) { if (data) {
zrUtil.each(data.sectionList || [], elem => { zrUtil.each(data.sectionList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.signalList || [], elem => { zrUtil.each(data.signalList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.stationList || [], elem => { zrUtil.each(data.stationList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.stationStandList || [], elem => { zrUtil.each(data.stationStandList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.stationControlList || [], elem => { zrUtil.each(data.stationControlList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.counterList || [], elem => { zrUtil.each(data.counterList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.delayShowList || [], elem => { zrUtil.each(data.delayShowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.lineList || [], elem => { zrUtil.each(data.lineList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.espList || [], elem => { zrUtil.each(data.espList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Esp, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Esp, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.psdList || [], elem => { zrUtil.each(data.psdList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Psd, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Psd, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.textList || [], elem => { zrUtil.each(data.textList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.zcList || [], elem => { zrUtil.each(data.zcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.lcList || [], elem => { zrUtil.each(data.lcList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.tempSpeedLimitList || [], elem => { zrUtil.each(data.tempSpeedLimitList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.resourceList || [], elem => { zrUtil.each(data.resourceList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.trainList || [], elem => { zrUtil.each(data.trainList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.Line || [], elem => { zrUtil.each(data.Line || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.Text || [], elem => { zrUtil.each(data.Text || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.cycleButtonList || [], elem => { zrUtil.each(data.cycleButtonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.MapCycleButtonVO, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.MapCycleButtonVO, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.automaticRouteButtonList || [], elem => { zrUtil.each(data.automaticRouteButtonList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.AutomaticRoute, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.AutomaticRoute, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.outerFrameList || [], elem => { zrUtil.each(data.outerFrameList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert, showConfig);
}, this); }, this);
zrUtil.each(data.trainWindowList || [], elem => { zrUtil.each(data.trainWindowList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert, showConfig);
if (elem.sectionCode) { if (elem.sectionCode) {
const section = mapDevice[elem.sectionCode]; const section = mapDevice[elem.sectionCode];
if (section) { if (section) {
@ -138,7 +138,7 @@ export function parser(data, skinCode) {
}, this); }, this);
zrUtil.each(data.switchList || [], elem => { zrUtil.each(data.switchList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert); mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert, showConfig);
const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode]; const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode]; const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode];
const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode]; const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode];

View File

@ -195,7 +195,7 @@ const map = {
mapDataLoadedCount: 0, // 地图数据加载完成标识 mapDataLoadedCount: 0, // 地图数据加载完成标识
trainDetails: null, // 地图'列车详情'显示 trainDetails: null, // 地图'列车详情'显示
deleteCount: 0, // 绘图快捷删除标识 deleteCount: 0, // 绘图快捷删除标识
updateCount: 0, // 绘图快捷修改标识 updateCount: 0, // 绘图快捷修改标识
mousemove: 0 // 实训战场图移动标识 mousemove: 0 // 实训战场图移动标识
}, },
@ -515,7 +515,11 @@ const map = {
setMapData: (state, map) => { setMapData: (state, map) => {
if (map && map.skinVO) { if (map && map.skinVO) {
state.map = map; state.map = map;
state.mapDevice = parser(map, map.skinVO.code); let showConfig = {};
if (Vue.prototype.$jlmap && ( typeof(Vue.prototype.$jlmap.getShowConfig) === 'function')) {
showConfig = Vue.prototype.$jlmap.getShowConfig();
}
state.mapDevice = parser(map, map.skinVO.code, showConfig);
Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice); Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice);
} else { } else {
state.map = null; state.map = null;

View File

@ -4,6 +4,7 @@
<div :id="canvasId" style="background: #000;" class="display_canvas" /> <div :id="canvasId" style="background: #000;" class="display_canvas" />
<progress-bar ref="progressBar" /> <progress-bar ref="progressBar" />
<zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" /> <zoom-box v-if="!isScreen" :scale-rate="dataZoom.scaleRate" @setShrink="setShrink" @setMagnify="setMagnify" />
<show-mode v-if="isDesign" @setShowMode="setShowMode" />
<div v-if="show" class="zoom-view" :style="{ width: width +'px'}"> <div v-if="show" class="zoom-view" :style="{ width: width +'px'}">
<el-form :model="dataZoom" label-width="80px" size="mini" inline> <el-form :model="dataZoom" label-width="80px" size="mini" inline>
<el-form-item :label="$t(`global.offset`)"> <el-form-item :label="$t(`global.offset`)">
@ -33,7 +34,8 @@
import Vue from 'vue'; import Vue from 'vue';
import localStore from 'storejs'; import localStore from 'storejs';
import Jlmap from '@/jmapNew/map'; import Jlmap from '@/jmapNew/map';
import ZoomBox from './zoom/zoom'; import ZoomBox from './pendant/zoom';
import ShowMode from './pendant/showMode';
import ProgressBar from '@/views/components/progressBar/index'; import ProgressBar from '@/views/components/progressBar/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
@ -44,7 +46,8 @@ export default {
name: 'JlmapVisual', name: 'JlmapVisual',
components: { components: {
ZoomBox, ZoomBox,
ProgressBar ProgressBar,
ShowMode
}, },
data() { data() {
return { return {
@ -89,6 +92,9 @@ export default {
}, },
maskOpen() { maskOpen() {
return this.$store.state.config.maskOpen; return this.$store.state.config.maskOpen;
},
isDesign() {
return this.$route.path.indexOf('mapPreviewNew') !== -1 || this.$route.path.indexOf('map/draw') !== -1;
} }
}, },
watch: { watch: {
@ -152,11 +158,15 @@ export default {
}; };
// //
const path = window.location.href; const path = window.location.href;
let mouseWheelFlag = false; const mouseWheelFlag = true;
if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) { let previewOrMapDraw = false;
mouseWheelFlag = true; // if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) {
// mouseWheelFlag = true;
// }
if (path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1) {
previewOrMapDraw = true;
} }
const prdType = this.$route.query.prdType;
Vue.prototype.$theme = new Theme(); Vue.prototype.$theme = new Theme();
Vue.prototype.$jlmap = new Jlmap({ Vue.prototype.$jlmap = new Jlmap({
dom: document.getElementById(this.canvasId), dom: document.getElementById(this.canvasId),
@ -171,6 +181,11 @@ export default {
offsetY: 0, offsetY: 0,
zoomOnMouseWheel: mouseWheelFlag zoomOnMouseWheel: mouseWheelFlag
}, },
showConfig: {
prdType: prdType,
previewOrMapDraw: previewOrMapDraw,
showMode: '03'
},
methods: { methods: {
dataLoaded: this.handleDataLoaded, dataLoaded: this.handleDataLoaded,
viewLoaded: this.handleViewLoaded, viewLoaded: this.handleViewLoaded,
@ -312,6 +327,13 @@ export default {
y: e.offsetY + Number(this.dataZoom.offsetY) y: e.offsetY + Number(this.dataZoom.offsetY)
}; };
this.$store.dispatch('map/setMousemove'); this.$store.dispatch('map/setMousemove');
},
//
setShowMode(showMode) {
const list = [...this.$store.state.map.map.automaticRouteButtonList, ...this.$store.state.map.map.cycleButtonList,
...this.$store.state.map.map.stationList, ...this.$store.state.map.map.stationStandList,
...this.$store.state.map.map.lineList, ...this.$store.state.map.map.textList, ...this.$store.state.map.map.outerFrameList];
this.$jlmap.updateShowMode(list, showMode);
} }
} }
}; };

View File

@ -0,0 +1,104 @@
<template>
<div class="zoom-box" :style="{top: offsetY+'px', right: offsetX+ 'px'}">
<el-select v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
</div>
</template>
<script>
export default {
name: 'ShowMode',
data() {
return {
offsetY: 15,
offsetX: 20,
swch: '03',
swchList: [
{ value: '03', name: '现地' },
{ value: '02', name: '行调' }
]
};
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
this.$nextTick(() => {
this.setPosition();
});
},
'$route' () {
this.setOffsetX();
}
},
mounted() {
this.setOffsetX();
},
methods: {
setPosition() {
this.$nextTick(() => {
let offsetY = 15;
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
if (menuBar) {
offsetY += (menuBar.offsetHeight || 0);
}
if (menuTool) {
offsetY += (menuTool.offsetHeight || 0);
}
if (this.offsetY != offsetY) {
this.offsetY = offsetY;
}
});
},
setOffsetX() {
if (this.$route.path.indexOf('mapPreviewNew') !== -1) {
this.offsetX = 20;
} else if (this.$route.path.indexOf('map/draw') !== -1) {
this.offsetX = 140;
}
},
switchMode(val) {
this.$emit('setShowMode', val);
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.zoom-box {
z-index: 7;
position: absolute;
right: 20px;
width: 120px;
height: 32px;
background: rgb(224, 223, 223);
border-radius: 4px;
overflow: hidden;
.zoom {
width: 50%;
float: right;
height: 100%;
margin: 0;
padding: 0;
border-radius: 0;
display: flex;
justify-content: center;
align-items: center;
border: none;
outline: none;
color: #333;
i {
color: #000;
font-size: 18px;
font-weight: 900;
}
}
.shrink {
border-right: 1px solid #333;
}
}
</style>

View File

@ -10,54 +10,54 @@
</template> </template>
<script> <script>
export default { export default {
name: 'ZoomBox', name: 'ZoomBox',
props: { props: {
scaleRate: { scaleRate: {
type: String, type: String,
default() { default() {
return '1'; return '1';
} }
} }
}, },
data() { data() {
return { return {
offset: 15 offset: 15
}; };
}, },
watch: { watch: {
'$store.state.config.menuBarLoadedCount': function (val) { '$store.state.config.menuBarLoadedCount': function (val) {
this.$nextTick(() => { this.$nextTick(() => {
this.setPosition(); this.setPosition();
}); });
} }
}, },
methods: { methods: {
setPosition() { setPosition() {
this.$nextTick(() => { this.$nextTick(() => {
let offset = 15; let offset = 15;
const menuBar = document.getElementById('menuBar'); const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool'); const menuTool = document.getElementById('menuTool');
if (menuBar) { if (menuBar) {
offset += (menuBar.offsetHeight || 0); offset += (menuBar.offsetHeight || 0);
} }
if (menuTool) { if (menuTool) {
offset += (menuTool.offsetHeight || 0); offset += (menuTool.offsetHeight || 0);
} }
if (this.offset != offset) { if (this.offset != offset) {
this.offset = offset; this.offset = offset;
} }
}); });
}, },
setShrinkCanvas() { setShrinkCanvas() {
this.$emit('setShrink'); this.$emit('setShrink');
}, },
setMagnifyCanvas() { setMagnifyCanvas() {
this.$emit('setMagnify'); this.$emit('setMagnify');
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -306,8 +306,8 @@ export default {
name: row.name, name: row.name,
model: { model: {
items: [ items: [
{ prop: 'sectionCode', label: '物理区段ID', type: 'text' }, { prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
{ prop: 'sectionCode', label: '物理区段名称', type: 'select', options: sectionDict } { prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
] ]
} }
}; };
@ -322,12 +322,12 @@ export default {
const fieldList = { const fieldList = {
id: row.id, id: row.id,
mapId: this.$route.params.mapId, mapId: this.$route.params.mapId,
title: '进路物理区段数据', title: this.$t('map.routePhysicalSectionData'),
name: row.name, name: row.name,
model: { model: {
items: [ items: [
{ prop: 'sectionCode', label: '物理区段ID', type: 'text' }, { prop: 'sectionCode', label: this.$t('map.physicalSectionID'), type: 'text' },
{ prop: 'sectionCode', label: '物理区段名称', type: 'select', options: sectionDict } { prop: 'sectionCode', label: this.$t('map.physicalSectionName'), type: 'select', options: sectionDict }
] ]
} }
}; };
@ -355,18 +355,18 @@ export default {
const fieldList = { const fieldList = {
id: row.id, id: row.id,
mapId: this.$route.params.mapId, mapId: this.$route.params.mapId,
title: '进路侧防道', title: this.$t('map.routeSideDefenseSwitch'),
name: row.name, name: row.name,
model: { model: {
items: [ items: [
{ prop: 'switchCode', label: '道岔ID', type: 'text' }, { prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
{ prop: 'switchCode', label: '道岔名称', type: 'select', options: switchDict }, { prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
{ prop: 'switchType', label: '道岔类型', type: 'text'} { prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
] ]
} }
}; };
row.routeFlankProtectionList.forEach( item => { row.routeFlankProtectionList.forEach( item => {
item.switchType = item.normal ? '定位' : '反位'; item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
}); });
this.$refs.previewField.doShow(fieldList, row.routeFlankProtectionList); this.$refs.previewField.doShow(fieldList, row.routeFlankProtectionList);
} }
@ -378,19 +378,19 @@ export default {
const fieldList = { const fieldList = {
id: row.id, id: row.id,
mapId: this.$route.params.mapId, mapId: this.$route.params.mapId,
title: '进路道岔数据', title: this.$t('map.entryTurnout'),
name: row.name, name: row.name,
model: { model: {
field: 'routeSwitchList', field: 'routeSwitchList',
items: [ items: [
{ prop: 'switchCode', label: '道岔ID', type: 'text' }, { prop: 'switchCode', label: this.$t('map.switchID'), type: 'text' },
{ prop: 'switchCode', label: '道岔名称', type: 'select', options: switchDict }, { prop: 'switchCode', label: this.$t('map.switchName'), type: 'select', options: switchDict },
{ prop: 'switchType', label: '道岔类型', type: 'text'} { prop: 'switchType', label: this.$t('map.switchType'), type: 'text'}
] ]
} }
}; };
row.routeSwitchList.forEach( item => { row.routeSwitchList.forEach( item => {
item.switchType = item.normal ? '定位' : '反位'; item.switchType = item.normal ? this.$t('map.normalPosition') : this.$t('map.reversePosition');
}); });
this.$refs.previewField.doShow(fieldList, row.routeSwitchList); this.$refs.previewField.doShow(fieldList, row.routeSwitchList);
} }
@ -398,7 +398,7 @@ export default {
// //
saveRelated(row) { saveRelated(row) {
putRouteNew(row).then(response => { putRouteNew(row).then(response => {
this.$message.success('更新成功'); this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(() => { }).catch(() => {
this.$messageBox('操作异常'); this.$messageBox('操作异常');
}); });

View File

@ -127,6 +127,9 @@ export default {
]), ]),
newRouteSectionList() { newRouteSectionList() {
return JSON.stringify(this.addModel.routeSectionList); return JSON.stringify(this.addModel.routeSectionList);
},
newBlockSectionList() {
return JSON.stringify(this.addModel.blockSectionList);
} }
}, },
watch: { watch: {
@ -145,10 +148,23 @@ export default {
const obj = JSON.parse(val); const obj = JSON.parse(val);
const objOld = JSON.parse(old); const objOld = JSON.parse(old);
if (objOld && objOld.length) { if (objOld && objOld.length) {
this.changeSectionSelected(objOld, false, 'signalNearSection'); this.changeSectionSelected(objOld, true);
} }
if (obj && obj.length) { if (obj && obj.length) {
this.changeSectionSelected(obj, true, 'signalNearSection'); this.changeSectionSelected(obj, true);
}
},
deep: true
},
newBlockSectionList: {
handler: function(val, old) {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, true);
}
if (obj && obj.length) {
this.changeSectionSelected(obj, true);
} }
}, },
deep: true deep: true
@ -209,6 +225,8 @@ export default {
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'blockSectionList'.toUpperCase()) { } else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'blockSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03') && this.addModel.blockSectionList.indexOf(selected.code) === -1) { if ((selected.type === '01' || selected.type === '03') && this.addModel.blockSectionList.indexOf(selected.code) === -1) {
this.addModel.blockSectionList.push(selected.code); this.addModel.blockSectionList.push(selected.code);
} else if (selected.type === '02' && this.addModel.blockSectionList.indexOf(selected.parentCode) === -1) {
this.addModel.blockSectionList.push(selected.parentCode);
} }
} }
} }
@ -262,25 +280,48 @@ export default {
} }
}, },
batchSectionListFocus(flag) { batchSectionListFocus(flag) {
this.changeSectionSelected(this.addModel.routeSectionList, flag, 'signalNearSection'); this.changeSectionSelected(this.addModel.routeSectionList, flag);
this.changeSectionSelected(this.addModel.blockSectionList, flag);
this.changeSignalSelected(this.addModel.signalCode, flag, 'routeSignal'); this.changeSignalSelected(this.addModel.signalCode, flag, 'routeSignal');
}, },
changeSignalSelected(val, flag, type) { changeSignalSelected(val, flag, type) {
const signal = this.$store.getters['map/getDeviceByCode'](val); const signal = this.$store.getters['map/getDeviceByCode'](val);
signal && signal.instance.drawBatchSelected(flag, flag ? type : ''); signal && signal.instance.drawBatchSelected(flag, flag ? type : '');
}, },
changeSectionSelected(list, flag, type) { changeSectionSelected(list, cutOut) {
let flag = true;
let type = '';
list && list.forEach((item) => { list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item); const section = this.$store.getters['map/getDeviceByCode'](item);
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) { if (!cutOut) {
section.logicSectionCodeList.forEach( (logicSectionCode) => { this.setSectionSelectedType(section, cutOut, '');
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode); return;
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section && section.instance.drawBatchSelected(flag, flag ? type : '');
} }
if (this.addModel.routeSectionList.indexOf(item) !== -1 && this.addModel.blockSectionList.indexOf(item) !== -1) {
type = 'signalNearSection';
flag = true;
} else if (this.addModel.routeSectionList.indexOf(item) !== -1) {
type = 'signalNearSectionCBTC';
flag = true;
} else if (this.addModel.blockSectionList.indexOf(item) !== -1) {
type = 'signalNearSectionReserve';
flag = true;
} else {
type = '';
flag = false;
}
this.setSectionSelectedType(section, flag, type);
}); });
},
setSectionSelectedType(section, flag, type) {
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
} }
} }
}; };

View File

@ -217,6 +217,15 @@ export default {
}, },
setShowSecond(flag) { setShowSecond(flag) {
this.showSecond = flag; this.showSecond = flag;
if (flag) {
this.rules.turnBackRoute2Name = [{ required: true, message: '请选择折返进路2', trigger: 'blur' }];
this.rules.basicRoute2Name = [{ required: true, message: '请选择基础进路2', trigger: 'blur'}];
this.rules.reentryTrack2Code = [{ required: true, message: '请选择折返区段2', trigger: 'change'}];
} else {
delete this.rules.turnBackRoute2Name;
delete this.rules.basicRoute2Name;
delete this.rules.reentryTrack2Code;
}
}, },
buildModel(code) { buildModel(code) {
const model = Object.assign({}, this.addModel); const model = Object.assign({}, this.addModel);
@ -271,6 +280,7 @@ export default {
this.addModel.code = ''; this.addModel.code = '';
this.$refs.form.resetFields(); this.$refs.form.resetFields();
this.isSave = true; this.isSave = true;
this.showSecond = false;
} }
}, },
setRouteCode(data, type) { setRouteCode(data, type) {

View File

@ -386,7 +386,7 @@ export default {
.operation_box{ .operation_box{
position: absolute; position: absolute;
right: 20px; right: 20px;
top: 20px; top: 15px;
z-index: 9; z-index: 9;
} }

View File

@ -14,12 +14,50 @@
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-form ref="formModel" :model="formModel" label-width="200px" size="mini" :rules="formRules">
<el-form-item label="区段编码:" prop="modelList">
<el-select v-model="formModel.modelList" filterable multiple>
<el-option
v-for="item in sectionList"
:key="item.code"
:label="item.name + '(' + item.code + ')'"
:value="item.code"
/>
</el-select>
<el-button
:type="field === 'sectionTypeCode' ? 'danger' : 'primary'"
size="small"
@click="hover('sectionTypeCode')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item label="区段名称位置:" prop="trainPosType">
<el-select
v-model="formModel.trainPosType"
placeholder="请选择"
:clearable="true"
>
<el-option
v-for="option in positionTypes"
:key="option.type"
:label="option.name"
:value="option.type"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" size="big" @click="setPositionType">{{ $t('global.set') }}</el-button>
</el-button-group>
</el-form-item>
</el-form>
</el-scrollbar> </el-scrollbar>
</div> </div>
</template> </template>
<script> <script>
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex';
export default { export default {
name: 'BatchSettings', name: 'BatchSettings',
props: { props: {
@ -28,6 +66,12 @@ export default {
default: function() { default: function() {
return []; return [];
} }
},
field: {
type: Object,
default: function () {
return '';
}
} }
}, },
data() { data() {
@ -36,10 +80,34 @@ export default {
leftDistance: 0, leftDistance: 0,
rightDistance: 0 rightDistance: 0
}, },
tipInfoList: [] formModel: {
modelList: [],
trainPosType: ''
},
positionTypes: [
{ name: '上方', type: '01' },
{ name: '下方', type: '02' }
],
tipInfoList: [],
formRules: {
trainPosType: [
{ required: true, message: '请选择', trigger: 'change' }
],
modelList: [
{ required: true, message: '请选择', trigger: 'change' }
]
}
}; };
}, },
computed: {
...mapGetters('map', [
'sectionList'
])
},
methods:{ methods:{
hover(filed) {
this.$emit('hover', filed);
},
batchSettings() { batchSettings() {
this.tipInfoList = []; this.tipInfoList = [];
const models = []; const models = [];
@ -63,6 +131,20 @@ export default {
this.$message.success(this.$t('tip.stopPointOffsetTip')); this.$message.success(this.$t('tip.stopPointOffsetTip'));
} }
} }
},
setPositionType() {
const models = [];
this.$refs['formModel'].validate((valid) => {
if (valid) {
this.formModel.modelList.forEach(sectionCode => {
const model = deepAssign({}, this.$store.getters['map/getDeviceByCode'](sectionCode) || {});
model.trainPosType = this.formModel.trainPosType;
models.push(model);
});
this.$emit('updateMapModel', models, 'five');
this.$refs.formModel.resetFields(); //
}
});
} }
} }
}; };

View File

@ -24,7 +24,7 @@
<logic-block ref="logicBlock" :edit-model="editModel" @updateMapModel="updateMapModel" /> <logic-block ref="logicBlock" :edit-model="editModel" @updateMapModel="updateMapModel" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.batchSettings')" name="five"> <el-tab-pane class="view-control" :label="$t('map.batchSettings')" name="five">
<batch-settings ref="batchSettings" :section-list="sectionList" @updateMapModel="updateMapModel" @tipInfoHandle="tipInfoHandle" /> <batch-settings ref="batchSettings" :field="field" :section-list="sectionList" @hover="hover" @updateMapModel="updateMapModel" @tipInfoHandle="tipInfoHandle" />
</el-tab-pane> </el-tab-pane>
<tip-info ref="tipInfo" :tip-info-list="tipInfoList" /> <tip-info ref="tipInfo" :tip-info-list="tipInfoList" />
</el-tabs> </el-tabs>
@ -453,6 +453,11 @@ export default {
this.activeName = 'second'; this.activeName = 'second';
this.field = ''; this.field = '';
this.$emit('fieldSelect', ''); this.$emit('fieldSelect', '');
} else if (this.field.toUpperCase() === 'sectionTypeCode'.toUpperCase()) {
this.$refs.batchSettings.formModel.modelList.push(selected.code);
this.activeName = 'five';
// this.field = '';
// this.$emit('fieldSelect', '');
} }
} }
}, },

View File

@ -90,7 +90,7 @@ export default {
stationCode: '', // stationCode: '', //
position: { x: 0, y: 0 }, position: { x: 0, y: 0 },
visible: true, // visible: true, //
inside: false, // inside: false, //
right: true, right: true,
standTrackCode: '', standTrackCode: '',
small: false, small: false,
@ -129,7 +129,7 @@ export default {
}, },
allModel: { allModel: {
width: '', width: '',
height: '', height: ''
} }
}; };
}, },
@ -447,7 +447,7 @@ export default {
standCode: Standuid standCode: Standuid
}); });
} }
section.standTrack = true; section.standTrack = !this.addModel.small;
models.push(section); models.push(section);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
@ -512,7 +512,7 @@ export default {
}, },
// //
batchSettings() { batchSettings() {
let models = []; const models = [];
this.stationStandList.forEach(stationStand => { this.stationStandList.forEach(stationStand => {
if (!stationStand.small) { if (!stationStand.small) {
const model = deepAssign({}, stationStand); const model = deepAssign({}, stationStand);
@ -520,7 +520,7 @@ export default {
model.height = this.allModel.height; model.height = this.allModel.height;
models.push(model); models.push(model);
} }
}) });
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
} }