diff --git a/src/i18n/langs/en/map.js b/src/i18n/langs/en/map.js index 98746137f..72cb8a8ff 100644 --- a/src/i18n/langs/en/map.js +++ b/src/i18n/langs/en/map.js @@ -605,5 +605,9 @@ export default { whetherAutoRoute: 'Whether auto route', hostileData: 'Hostile 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' }; diff --git a/src/i18n/langs/zh/map.js b/src/i18n/langs/zh/map.js index d2a845f57..68f5800cd 100644 --- a/src/i18n/langs/zh/map.js +++ b/src/i18n/langs/zh/map.js @@ -598,5 +598,11 @@ export default { whetherAutoRoute: '是否自定进路', hostileData: '敌对数据', routeContinuesToProtectSectorData: '进路延续保护区段数据', - physicalSectionID: '物理区段ID' + physicalSectionID: '物理区段ID', + physicalSectionName: '物理区段名称', + routePhysicalSectionData: '进路物理区段数据', + routeSideDefenseSwitch: '进路侧防道岔', + switchID: '道岔ID', + normalPosition: '定位', + reversePosition: '反位' }; diff --git a/src/jmap/shape/Train/TrainBody.js b/src/jmap/shape/Train/TrainBody.js index 86a9a54fe..58596d45f 100644 --- a/src/jmap/shape/Train/TrainBody.js +++ b/src/jmap/shape/Train/TrainBody.js @@ -7,234 +7,234 @@ import store from '@/store'; /** 车身*/ export default class TrainBody extends Group { - constructor(model) { - super(); - this.model = model; - this.deviceModel = model.model; - this.nameFormat = model.nameFormat; - this.create(); - this.createMouse(); // 鼠标事件 - } + constructor(model) { + super(); + this.model = model; + this.deviceModel = model.model; + this.nameFormat = model.nameFormat; + this.create(); + this.createMouse(); // 鼠标事件 + } - createMouse() { - this.mouseEvent = new EMouse(this); - this.add(this.mouseEvent); - if (this.deviceModel.down) { - store.dispatch('map/setTrainDetails', this.deviceModel); - this.mouseEvent.mouseover(); - } + createMouse() { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + if (this.deviceModel.down) { + store.dispatch('map/setTrainDetails', this.deviceModel); + this.mouseEvent.mouseover(); + } - this.on('mouseover', () => { - store.dispatch('map/setTrainDetails', this.deviceModel); - this.mouseEvent.mouseover(); - }); - this.on('mouseout', () => { - store.dispatch('map/setTrainDetails', null); - this.mouseEvent.mouseout(); - }); - } + this.on('mouseover', () => { + store.dispatch('map/setTrainDetails', this.deviceModel); + this.mouseEvent.mouseover(); + }); + this.on('mouseout', () => { + store.dispatch('map/setTrainDetails', null); + this.mouseEvent.mouseout(); + }); + } - create() { - const model = this.model; - const style = this.model.style; - this.trainBodyBox = new TrainBodyBox({ - zlevel: model.zlevel, - z: model.z, - point: model.point, - style: style - }); + create() { + const model = this.model; + const style = this.model.style; + this.trainBodyBox = new TrainBodyBox({ + zlevel: model.zlevel, + z: model.z, + point: model.point, + style: style + }); - const beginX = (model.point.x + style.Train.trainBody.lrPadding); - const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA); - const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4; + const beginX = (model.point.x + style.Train.trainBody.lrPadding); + const beginY = (model.point.y - style.Train.hsda.trainHSDATextFontSize - style.Train.hsda.upPaddingHSDA); + const margin = (style.Train.common.trainWidth - style.Train.hsda.lrPaddingHSDA * 2) / 4; - this.textH = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 0), - y: parseInt(beginY), - text: style.Train.hsda.textHContent, - textFill: style.trainYellowColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textS = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 1), - y: parseInt(beginY), - text: style.Train.hsda.textSContent, - textFill: style.trainBlueColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textD = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 2), - y: parseInt(beginY), - text: style.Train.hsda.textDContent, - textFill: style.trainGreenColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - this.textA = style.Train.common.haveTextHSDA ? new ETextName({ - zlevel: model.zlevel, - z: model.z, - x: parseInt(beginX + margin * 3), - y: parseInt(beginY), - text: style.Train.hsda.textAContent, - textFill: style.trainRedColor, - fontSize: style.Train.hsda.trainHSDATextFontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'middle', - textVerticalAlign: 'top' - }) : ''; - const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号) - const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode - ?(model.directionCode||style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) - :model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号 - const targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码 - const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号 - this.textTrainServer = new ETextName({ - zlevel: model.zlevel, - z: model.z+1, - x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x), - y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y), - text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length), - textFill: style.trainTextColor, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.textTrainTarget = new ETextName({ - zlevel: this.model.zlevel, - z: this.model.z+1, - x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x), - y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y), - text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length), - textFill: style.trainTextColor, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: style.Train.trainTarget.trainTargetTextAlign, - textVerticalAlign: 'top' - }); - this.textTrainNumber = new ETextName({ - zlevel: model.zlevel, - z: model.z+1, - x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x), - y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y), - text: targetCode.substring(targetCode.length - 3), - textFill: style.trainTextColor, - textStroke: style.trainTextColor, - fontWeight: 400, - textStrokeWidth: 0, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.textTrainTargetNumber = new ETextName({ - zlevel: model.zlevel, - z: model.z+1, - x: parseInt(model.point.x - style.Train.trainBody.lrPadding), - y: parseInt(model.point.y + style.Train.trainBody.upPadding), - text: groupNumber.substring(groupNumber.length - 3), - textFill: style.trainTextColor, - textStroke: style.trainTextColor, - textStrokeWidth: 0, - fontSize: model.fontSize, - fontFamily: style.Train.common.fontFamily, - textAlign: 'left', - textVerticalAlign: 'top' - }); - this.formatChangePosition(model, style); - this.add(this.trainBodyBox); - if (style.Train.common.haveTextHSDA) { - this.add(this.textH); - this.add(this.textS); - this.add(this.textD); - this.add(this.textA); - } - } + this.textH = style.Train.common.haveTextHSDA ? new ETextName({ + zlevel: model.zlevel, + z: model.z, + x: parseInt(beginX + margin * 0), + y: parseInt(beginY), + text: style.Train.hsda.textHContent, + textFill: style.trainYellowColor, + fontSize: style.Train.hsda.trainHSDATextFontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'middle', + textVerticalAlign: 'top' + }) : ''; + this.textS = style.Train.common.haveTextHSDA ? new ETextName({ + zlevel: model.zlevel, + z: model.z, + x: parseInt(beginX + margin * 1), + y: parseInt(beginY), + text: style.Train.hsda.textSContent, + textFill: style.trainBlueColor, + fontSize: style.Train.hsda.trainHSDATextFontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'middle', + textVerticalAlign: 'top' + }) : ''; + this.textD = style.Train.common.haveTextHSDA ? new ETextName({ + zlevel: model.zlevel, + z: model.z, + x: parseInt(beginX + margin * 2), + y: parseInt(beginY), + text: style.Train.hsda.textDContent, + textFill: style.trainGreenColor, + fontSize: style.Train.hsda.trainHSDATextFontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'middle', + textVerticalAlign: 'top' + }) : ''; + this.textA = style.Train.common.haveTextHSDA ? new ETextName({ + zlevel: model.zlevel, + z: model.z, + x: parseInt(beginX + margin * 3), + y: parseInt(beginY), + text: style.Train.hsda.textAContent, + textFill: style.trainRedColor, + fontSize: style.Train.hsda.trainHSDATextFontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'middle', + textVerticalAlign: 'top' + }) : ''; + const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || style.Train.trainServer.defaultServiceNumber) + '';// 服务号(表号) + const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode + ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) + : model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号 + const targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码 + const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号 + this.textTrainServer = new ETextName({ + zlevel: model.zlevel, + z: model.z + 1, + x: parseInt(model.point.x + style.Train.trainServer.trainServerOffset.x), + y: parseInt(model.point.y + style.Train.trainServer.trainServerOffset.y), + text: serviceNumber.substring(serviceNumber.length - style.Train.trainServer.serviceNumberPrefix.length), + textFill: style.trainTextColor, + fontSize: model.fontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'left', + textVerticalAlign: 'top' + }); + this.textTrainTarget = new ETextName({ + zlevel: this.model.zlevel, + z: this.model.z + 1, + x: parseInt(model.point.x + model.style.Train.trainTarget.trainTargetOffset.x), + y: parseInt(model.point.y + model.style.Train.trainTarget.trainTargetOffset.y), + text: tripNumber.substring(tripNumber.length - style.Train.trainTarget.tripNumberPrefix.length), + textFill: style.trainTextColor, + fontSize: model.fontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: style.Train.trainTarget.trainTargetTextAlign, + textVerticalAlign: 'top' + }); + this.textTrainNumber = new ETextName({ + zlevel: model.zlevel, + z: model.z + 1, + x: parseInt(model.point.x + style.Train.trainNumber.trainNumberOffset.x), + y: parseInt(model.point.y + style.Train.trainNumber.trainNumberOffset.y), + text: targetCode.substring(targetCode.length - 3), + textFill: style.trainTextColor, + textStroke: style.trainTextColor, + fontWeight: 400, + textStrokeWidth: 0, + fontSize: model.fontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'left', + textVerticalAlign: 'top' + }); + this.textTrainTargetNumber = new ETextName({ + zlevel: model.zlevel, + z: model.z + 1, + x: parseInt(model.point.x - style.Train.trainBody.lrPadding), + y: parseInt(model.point.y + style.Train.trainBody.upPadding), + text: groupNumber.substring(groupNumber.length - 3), + textFill: style.trainTextColor, + textStroke: style.trainTextColor, + textStrokeWidth: 0, + fontSize: model.fontSize, + fontFamily: style.Train.common.fontFamily, + textAlign: 'left', + textVerticalAlign: 'top' + }); + this.formatChangePosition(model, style); + this.add(this.trainBodyBox); + if (style.Train.common.haveTextHSDA) { + this.add(this.textH); + this.add(this.textS); + this.add(this.textD); + this.add(this.textA); + } + } - removeTrainDetail() { - this.mouseEvent.mouseout(); - store.dispatch('map/setTrainDetails', null); - this.deviceModel.down = false; - } - setTrainColor(color) { - this.trainBodyBox && this.trainBodyBox.setStyle('fill', color); - } - setTextTrainServerColor(color) { - this.textTrainServer&&this.textTrainServer.setStyle('textFill', color); - this.textTrainServer&&this.textTrainServer.setStyle('textStroke', color); - } - setTextTrainTargetColor(color) { - this.textTrainTarget&&this.textTrainTarget.setStyle('textFill', color); - this.textTrainTarget&&this.textTrainTarget.setStyle('textStroke', color); - } - setTextTrainNumberColor(color) { - this.textTrainNumber&&this.textTrainNumber.setStyle('textFill', color); - this.textTrainNumber&&this.textTrainNumber.setStyle('textStroke', color); - } - setTextTrainTargetNumberColor(color) { - this.textTrainTargetNumber&&this.textTrainTargetNumber.setStyle('textFill', color); - this.textTrainTargetNumber&&this.textTrainTargetNumber.setStyle('textStroke', color); - } - setHShow(isShow) { - if (this.textH) { - isShow ? this.textH.show() : this.textH.hide(); - } - } - setSShow(isShow) { - if (this.textS) { - isShow ? this.textS.show() : this.textS.hide(); - } - } - setDShow(isShow) { - if (this.textD) { - isShow ? this.textD.show() : this.textD.hide(); - } - } - setAShow(isShow) { - if (this.textA) { - isShow ? this.textA.show() : this.textA.hide(); - } - } - setBodyBoxShape(key, color) { - this.trainBodyBox && this.trainBodyBox.setColor(key, color); - } - formatChangePosition(model, style) { - if (this.nameFormat) { - const arr = this.nameFormat.split(':'); - let widthText = 0; - arr.forEach(ele => { - if (ele == 'targetCode') { - this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); - widthText += this.textTrainNumber.getBoundingRect().width; - this.add(this.textTrainNumber); - } else if (ele == 'serviceNumber') { - this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainServer.getBoundingRect().width; - this.add(this.textTrainServer); - } else if (ele == 'tripNumber') { - this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTarget.getBoundingRect().width; - this.add(this.textTrainTarget); - } else if (ele == 'groupNumber') { - this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); - widthText += this.textTrainTargetNumber.getBoundingRect().width; - this.add(this.textTrainTargetNumber); - } - }); - } - } + removeTrainDetail() { + this.mouseEvent.mouseout(); + store.dispatch('map/setTrainDetails', null); + this.deviceModel.down = false; + } + setTrainColor(color) { + this.trainBodyBox && this.trainBodyBox.setStyle('fill', color); + } + setTextTrainServerColor(color) { + this.textTrainServer && this.textTrainServer.setStyle('textFill', color); + this.textTrainServer && this.textTrainServer.setStyle('textStroke', color); + } + setTextTrainTargetColor(color) { + this.textTrainTarget && this.textTrainTarget.setStyle('textFill', color); + this.textTrainTarget && this.textTrainTarget.setStyle('textStroke', color); + } + setTextTrainNumberColor(color) { + this.textTrainNumber && this.textTrainNumber.setStyle('textFill', color); + this.textTrainNumber && this.textTrainNumber.setStyle('textStroke', color); + } + setTextTrainTargetNumberColor(color) { + this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textFill', color); + this.textTrainTargetNumber && this.textTrainTargetNumber.setStyle('textStroke', color); + } + setHShow(isShow) { + if (this.textH) { + isShow ? this.textH.show() : this.textH.hide(); + } + } + setSShow(isShow) { + if (this.textS) { + isShow ? this.textS.show() : this.textS.hide(); + } + } + setDShow(isShow) { + if (this.textD) { + isShow ? this.textD.show() : this.textD.hide(); + } + } + setAShow(isShow) { + if (this.textA) { + isShow ? this.textA.show() : this.textA.hide(); + } + } + setBodyBoxShape(key, color) { + this.trainBodyBox && this.trainBodyBox.setColor(key, color); + } + formatChangePosition(model, style) { + if (this.nameFormat) { + const arr = this.nameFormat.split(':'); + let widthText = 0; + arr.forEach(ele => { + if (ele == 'targetCode') { + this.textTrainNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset) ); + widthText += this.textTrainNumber.getBoundingRect().width; + this.add(this.textTrainNumber); + } else if (ele == 'serviceNumber') { + this.textTrainServer.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); + widthText += this.textTrainServer.getBoundingRect().width; + this.add(this.textTrainServer); + } else if (ele == 'tripNumber') { + this.textTrainTarget.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); + widthText += this.textTrainTarget.getBoundingRect().width; + this.add(this.textTrainTarget); + } else if (ele == 'groupNumber') { + this.textTrainTargetNumber.setStyle('x', parseInt(model.point.x + widthText + style.Train.common.textOffset)); + widthText += this.textTrainTargetNumber.getBoundingRect().width; + this.add(this.textTrainTargetNumber); + } + }); + } + } } diff --git a/src/jmapNew/config/defaultStyle.js b/src/jmapNew/config/defaultStyle.js index 6f74eecd4..3000e43e3 100644 --- a/src/jmapNew/config/defaultStyle.js +++ b/src/jmapNew/config/defaultStyle.js @@ -125,5 +125,7 @@ export default class defaultStyle { export const drawSectionStyle = { routePhysicalSection: 'rgba(255,255,0,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)' }; diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index ada8ab466..7e1d9fb83 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -212,7 +212,7 @@ class SkinCode extends defaultStyle { this[deviceType.MapCycleButtonVO] = { // 是否显示 - visibleConditions: ['01'], + visibleConditions: '03', text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 @@ -239,7 +239,7 @@ class SkinCode extends defaultStyle { this[deviceType.StationStand] = { common: { // 通用属性 textFontSize: 8, // 站台默认字体大小 - functionButtonShow: ['01'] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) }, safetyDoor: { // 屏蔽门 height: 1.6, // 站台屏蔽门高度 @@ -320,7 +320,7 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: true, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示 kilometerPosition: 'down', // 公里标位置 fontWeight: 'bold', // 文字错细 text: { @@ -492,7 +492,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: [], // 显示条件 prdType + displayCondition: '03', // 显示条件 prdType text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index 3fc506cf9..ebf7ad2a4 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -209,7 +209,7 @@ class SkinCode extends defaultStyle { common: { // 通用属性 textFontSize: 10, // 站台默认字体大小 haveJumpShow: false, // 站台是否有列车停跳显示 - functionButtonShow: [] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) }, safetyDoor: { // 屏蔽门 height: 3, // 站台屏蔽门高度 @@ -289,13 +289,37 @@ class SkinCode extends defaultStyle { 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] = { // text: { // show: true // 公里标名称显示 // }, kmPostShow: false, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示 kilometerPosition: 'up', // 公里标朝向 text: { fontSize: 11, // 字体大小 @@ -426,7 +450,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: [], // 显示条件 prdType + displayCondition: '03', // 显示条件 prdType text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index ad1c8fba2..5e8f30c4c 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -212,7 +212,7 @@ class SkinCode extends defaultStyle { common: { // 通用属性 textFontSize: 10, // 站台默认字体大小 haveJumpShow: true, // 站台是否有列车停跳显示 - functionButtonShow: ['01'] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(prdType) }, safetyDoor: { // 屏蔽门 height: 3, // 站台屏蔽门高度 @@ -300,7 +300,7 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: false, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示 kilometerPosition: 'up', // 公里标朝向 text: { fontSize: 11, // 字体大小 @@ -451,7 +451,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: ['01'], // 显示条件prdType 为01 + displayCondition: '03', // 显示条件prdType 为01 text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 @@ -465,7 +465,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.MapCycleButtonVO] = { // 是否显示 - visibleConditions: ['01'], + visibleConditions: '03', text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/config/skinCode/fuzhou_01.js b/src/jmapNew/config/skinCode/fuzhou_01.js index 4bc15dab7..7f3a26437 100644 --- a/src/jmapNew/config/skinCode/fuzhou_01.js +++ b/src/jmapNew/config/skinCode/fuzhou_01.js @@ -200,7 +200,7 @@ class SkinCode extends defaultStyle { this[deviceType.StationStand] = { common: { // 通用属性 textFontSize: 11, // 站台默认字体大小 - functionButtonShow: [] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) }, safetyDoor: { // 屏蔽门 height: 3, // 站台屏蔽门高度 @@ -272,13 +272,37 @@ class SkinCode extends defaultStyle { 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] = { // text: { // show: true // 公里标名称显示 // }, kmPostShow: true, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示 kilometerPosition: 'up', // 公里标朝向 text: { fontSize: 11, // 字体大小 @@ -442,7 +466,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: [], // 显示条件 prdType + displayCondition: '03', // 显示条件 prdType text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 4b7256d8c..ae71cd15f 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -204,7 +204,7 @@ class SkinCode extends defaultStyle { textFontSize: 11, // 站台默认字体大小 special: true, // 特殊站台 haveJumpShow: true, // 站台是否有列车停跳显示 - functionButtonShow: [] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) }, safetyDoor: { // 屏蔽门 height: 3, // 站台屏蔽门高度 @@ -287,13 +287,37 @@ class SkinCode extends defaultStyle { 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] = { // text: { // show: true // 公里标名称显示 // }, kmPostShow: true, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 kilometerPosition: 'up', // 公里标朝向 text: { borderShow: true, // 车站包围框显示 @@ -464,7 +488,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: ['01'], + displayCondition: '03', text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index c8ddb61a5..1f4dbd6ee 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -208,7 +208,7 @@ class SkinCode extends defaultStyle { this[deviceType.MapCycleButtonVO] = { // 是否显示 - visibleConditions: ['01', '02'], + visibleConditions: '01', text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 @@ -236,7 +236,7 @@ class SkinCode extends defaultStyle { common: { // 通用属性 textFontSize: 10, // 站台默认字体大小 haveJumpShow: false, // 站台是否有列车停跳显示 - functionButtonShow: [] // 功能灯按钮显示条件(prdType) + functionButtonShow: '03' // 功能灯按钮显示条件(01所有模式下显示 02 行调显示 03现地显示) }, safetyDoor: { // 屏蔽门 height: 3, // 站台屏蔽门高度 @@ -322,7 +322,7 @@ class SkinCode extends defaultStyle { // show: true // 公里标名称显示 // }, kmPostShow: false, // 公里标显示 - functionButtonShow: ['01'], // 功能灯按钮(引导总锁)显示条件(prdType) + functionButtonShow: '03', // 功能灯按钮(引导总锁)显示条件 01全部模式下显示 02 行调显示 03 现地显示 kilometerPosition: 'up', // 公里标朝向 text: { fontSize: 11, // 字体大小 @@ -458,7 +458,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.AutomaticRoute] = { // 是否显示 - displayCondition: [], // 显示条件 prdType + displayCondition: '03', // 显示条件 prdType text: { fontSize: 11, // 字体大小 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/constant/deviceState.js b/src/jmapNew/constant/deviceState.js index fd5406736..93875ee7a 100644 --- a/src/jmapNew/constant/deviceState.js +++ b/src/jmapNew/constant/deviceState.js @@ -4,16 +4,16 @@ const deviceState = {}; deviceState[deviceType.Section] = { /** 区段状态*/ - blockade: false, // 是否封锁 - routeLock: false, // 是否进路锁闭 - overlapLock: false, // 进路延续保护锁闭 - ctOccupied: false, // 通信车占用 - nctOccupied: false, // 非通信车占用 - cutOff: false, // 是否切除 - invalid: false, // 是否失效 + blockade: 0, // 是否封锁 + routeLock: 0, // 是否进路锁闭 + overlapLock: 0, // 进路延续保护锁闭 + ctOccupied: 0, // 通信车占用 + nctOccupied: 0, // 非通信车占用 + cutOff: 0, // 是否切除 + invalid: 0, // 是否失效 speedUpLimit: 0, // 最高限速 /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ }; deviceState[deviceType.Switch] = { @@ -50,7 +50,7 @@ deviceState[deviceType.Switch] = { // State14: '14' /** 道岔状态类型 - 封锁*/ // }, /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ // /** 是否切除*/ // cutOff: { // Default: false /** 是否切除*/ @@ -58,19 +58,19 @@ deviceState[deviceType.Switch] = { }; deviceState[deviceType.Signal] = { - blockade: false, // 是否锁闭 - logicLight: false, // 逻辑点灯 - greenOpen: false, // 绿灯开放 - yellowOpen: false, // 黄灯开放 - redOpen: true, // 红灯开放(默认状态) + blockade: 0, // 是否锁闭 + logicLight: 0, // 逻辑点灯 + greenOpen: 0, // 绿灯开放 + yellowOpen: 0, // 黄灯开放 + redOpen: 1, // 红灯开放(默认状态) delayTime: 0, // 信号机延迟解锁倒计时 atsControl: 1, // 0是人工,1是自动 - fault: false // 是否故障 + fault: 0 // 是否故障 }; deviceState[deviceType.Station] = { /** 是否故障*/ - fault: false, /** 非故障*/ + fault: 0, /** 非故障*/ controlMode: 'Center' // controlMode: 'Local' // Center 中控 Local 站控 Emergency 紧急站控 Interlock 联锁控 }; @@ -87,7 +87,7 @@ deviceState[deviceType.Psd] = { // State03: '03' /** 切除 */ // }, /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ }; deviceState[deviceType.StationDelayUnlock] = { @@ -99,7 +99,7 @@ deviceState[deviceType.StationDelayUnlock] = { // }, /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ }; deviceState[deviceType.StationStand] = { @@ -123,7 +123,7 @@ deviceState[deviceType.StationStand] = { // State04: '04' /** 默认 */ // }, /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ }; deviceState[deviceType.Train] = { @@ -207,7 +207,7 @@ deviceState[deviceType.Train] = { // State02: '02' /** 有报警 */ // }, /** 车门是否关闭且锁闭 */ - doorCloseLock: true, + doorCloseLock: 1, /** 列车运行级别 */ runLevel: 'CBTC', /** 驾驶模式 */ @@ -219,7 +219,7 @@ deviceState[deviceType.Train] = { /** 列车是否向右形式 */ right: 1, /** 是否故障*/ - fault: false /** 非故障*/ + fault: 0 /** 非故障*/ }; export default deviceState; diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index 6d0a32ca3..f8c48a7c5 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -43,6 +43,7 @@ class Jlmap { const width = opts.dom.clientWidth; const height = opts.dom.clientHeight; this.zoomOnMouseWheel = opts.options.zoomOnMouseWheel; + this.previewOrMapDraw = opts.showConfig.previewOrMapDraw; 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.enable(); + this.showConfig = opts.showConfig; } loadStyle(lineCode) { @@ -136,6 +138,7 @@ class Jlmap { this.$mouseController.disable(); } else { opts['zoomOnMouseWheel'] = this.zoomOnMouseWheel; + opts['previewOrMapDraw'] = this.previewOrMapDraw; this.$mouseController.enable(opts); } @@ -159,7 +162,7 @@ class Jlmap { (list || []).forEach(elem => { const code = elem.code; 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); this.$painter.delete(oDevice); delete this.mapDevice[code]; @@ -246,9 +249,23 @@ class Jlmap { const code = elem.code; const type = elem._type; 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) { this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 (list || []).forEach(elem => { @@ -263,12 +280,12 @@ class Jlmap { this.$painter.update(signalDevice); } } else { - const oDevice = this.mapDevice[code] || deviceFactory(type, elem); + const oDevice = this.mapDevice[code] || deviceFactory(type, elem, this.showConfig); if (elem.dispose) { this.$painter.delete(oDevice); } else { // if (this.hookHandle(oDevice, elem)) { - this.$painter.update(oDevice); + this.$painter.update(oDevice); // } } } diff --git a/src/jmapNew/mouseController.js b/src/jmapNew/mouseController.js index e29b617e7..510143007 100644 --- a/src/jmapNew/mouseController.js +++ b/src/jmapNew/mouseController.js @@ -54,6 +54,7 @@ class MouseController extends Eventful { this._moveOnMouseMove = opts.moveOnMouseMove || true; this._zoomOnMouseWheel = opts.zoomOnMouseWheel || false; this._preventDefaultMouseMove = opts.preventDefaultMouseMove || true; + this._previewOrMapDraw = opts.previewOrMapDraw || false; this.disable(); @@ -121,7 +122,7 @@ class MouseController extends Eventful { this._preventDefaultMouseMove && eventTool.stop(e.event); 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}); } } diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index d1c7af375..4ecb76566 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -161,7 +161,14 @@ class Painter { } } } - + /** + * 更新显示模式 + */ + updateShowMode(device) { + if (device && device.instance) { + device.instance.setShowMode(); + } + } /** * 更新transform变化 * @param {*} opt diff --git a/src/jmapNew/shape/Automactic/index.js b/src/jmapNew/shape/Automactic/index.js index 335b5bf38..38778b06e 100644 --- a/src/jmapNew/shape/Automactic/index.js +++ b/src/jmapNew/shape/Automactic/index.js @@ -6,7 +6,7 @@ import Arc from 'zrender/src/graphic/shape/Arc'; import Text from 'zrender/src/graphic/Text'; import Rect from 'zrender/src/graphic/shape/Rect'; import EMouse from './EMouse'; -import {getPrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; export default class Automactic extends Group { constructor(model, style) { @@ -17,12 +17,14 @@ export default class Automactic extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.prdType = getPrdType(); - if (!this.prdType || this.style.MapCycleButtonVO.visibleConditions.indexOf(this.prdType) !== -1) { + if (isShowThePrdType(model.prdType, style.MapCycleButtonVO.visibleConditions) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } } create() { @@ -136,4 +138,19 @@ export default class Automactic extends Group { } 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(); + } + } } diff --git a/src/jmapNew/shape/AutomacticRoute/index.js b/src/jmapNew/shape/AutomacticRoute/index.js index 0e9f8c14e..dfa8499a5 100644 --- a/src/jmapNew/shape/AutomacticRoute/index.js +++ b/src/jmapNew/shape/AutomacticRoute/index.js @@ -5,7 +5,7 @@ import Group from 'zrender/src/container/Group'; import Arc from 'zrender/src/graphic/shape/Arc'; import Text from 'zrender/src/graphic/Text'; import EMouse from './EMouse'; -import {getPrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; export default class LcControl extends Group { constructor(model, style) { @@ -16,12 +16,14 @@ export default class LcControl extends Group { this.zlevel = model.zlevel; this.model = model; this.style = style; - this.prdType = getPrdType(); - if (!this.prdType || this.style.AutomaticRoute.displayCondition.indexOf(this.prdType) !== -1) { + if (isShowThePrdType(model.prdType, style.AutomaticRoute.displayCondition) || model.previewOrMapDraw) { this.create(); this.createMouseEvent(); this.setState(model); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } } create() { @@ -106,4 +108,17 @@ export default class LcControl extends Group { } 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(); + } + } } diff --git a/src/jmapNew/shape/LcControl/index.js b/src/jmapNew/shape/LcControl/index.js index 53da947a2..d160a39c7 100644 --- a/src/jmapNew/shape/LcControl/index.js +++ b/src/jmapNew/shape/LcControl/index.js @@ -76,4 +76,5 @@ export default class LcControl extends Group { } return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/LimitControl/index.js b/src/jmapNew/shape/LimitControl/index.js index e6ded2ee0..e93aa7760 100644 --- a/src/jmapNew/shape/LimitControl/index.js +++ b/src/jmapNew/shape/LimitControl/index.js @@ -80,4 +80,5 @@ export default class LimitControl extends Group { } return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/Line/index.js b/src/jmapNew/shape/Line/index.js index eaa50caaf..87601d9ef 100644 --- a/src/jmapNew/shape/Line/index.js +++ b/src/jmapNew/shape/Line/index.js @@ -1,6 +1,6 @@ import Line from 'zrender/src/graphic/shape/Line'; import Group from 'zrender/src/container/Group'; -import {getPrdType, isShowThePrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; export default class Line2 extends Group { constructor(model, style) { @@ -11,11 +11,13 @@ export default class Line2 extends Group { this.z = 0; this.model = model; this.style = style; - this.prdType = getPrdType(); - if (isShowThePrdType(this.prdType, model.showConditions)) { + if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); this.setState(model); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } } create() { @@ -55,4 +57,18 @@ export default class Line2 extends Group { setState(model) { 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(); + }); + } + } } diff --git a/src/jmapNew/shape/OutFrame/index.js b/src/jmapNew/shape/OutFrame/index.js index 2d8053a57..6a8dd70b8 100644 --- a/src/jmapNew/shape/OutFrame/index.js +++ b/src/jmapNew/shape/OutFrame/index.js @@ -1,6 +1,6 @@ import Group from 'zrender/src/container/Group'; 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 { constructor(model, style) { @@ -11,11 +11,13 @@ export default class OutFrame extends Group { this.style = style; this.zlevel = model.zlevel; this.z = 0; - this.prdType = getPrdType(); - if (isShowThePrdType(this.prdType, model.showConditions)) { + if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); this.setState(model); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } } create() { @@ -42,4 +44,14 @@ export default class OutFrame extends Group { // 设置状态 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(); + } + } } diff --git a/src/jmapNew/shape/Psd/index.js b/src/jmapNew/shape/Psd/index.js index 111828796..71f5d1e2d 100644 --- a/src/jmapNew/shape/Psd/index.js +++ b/src/jmapNew/shape/Psd/index.js @@ -96,4 +96,6 @@ export default class Line2 extends Group { this.on('mouseover', () => { this.highlight.mouseover(); }); } } + + setShowMode() {} } diff --git a/src/jmapNew/shape/Resource/index.js b/src/jmapNew/shape/Resource/index.js index 27d37e290..650eb1f49 100644 --- a/src/jmapNew/shape/Resource/index.js +++ b/src/jmapNew/shape/Resource/index.js @@ -66,4 +66,5 @@ export default class Resource extends Group { } return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index 2f93998e8..a4c277b4b 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -251,7 +251,7 @@ export default class Section extends Group { /** 区段名称 (逻辑区段名称 或 物理区段名称 是否显示)*/ let tempx = x; let tempy = y; - if (model.type == '01') { + if (model.type == '01') { // 物理区段名称 if (style.Section.text.show) { const opposite = style.Section.text.opposite ? -1 : 1; tempx += traingle.getSin(style.Section.text.distance); @@ -274,7 +274,7 @@ export default class Section extends Group { }); this.add(this.name); } - } else if (model.type == '02') { + } else if (model.type == '02') { // 逻辑区段 if (style.Section.logicText.show) { const opposite = style.Section.logicText.opposite ? -1 : 1; tempx += traingle.getSin(style.Section.logicText.distance); @@ -297,7 +297,7 @@ export default class Section extends Group { }); this.add(this.name); } - } else if (model.type == '03') { + } else if (model.type == '03') { // 道岔区段 if (style.Section.switchText.show) { this.name = new ETextName({ zlevel: this.zlevel, @@ -317,7 +317,7 @@ export default class Section extends Group { }); 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')) { this.name = new ETextName({ zlevel: this.zlevel, @@ -863,7 +863,7 @@ export default class Section extends Group { if (this.selectedType === type) { return; } - if (selected && !this.selectedType) { + if (selected && type) { this.section && this.section.setStyle({ stroke: drawSectionStyle[type] }); } else { this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor }); @@ -886,5 +886,5 @@ export default class Section extends Group { mouseover() { this.section && this.section.setStyle({ stroke: 'rgba(255,255,255,0.8)' }); } - + setShowMode() {} } diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index db2e4db40..c8f1a2bbb 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -588,6 +588,7 @@ class Signal extends Group { }); } } + setShowMode() {} } export default Signal; diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index 498095a88..c43b575f7 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -10,7 +10,7 @@ import EArrow from './EArrow'; import { arrow } from '../utils/ShapePoints'; import Rect from 'zrender/src/graphic/shape/Rect'; import BoundingRect from 'zrender/src/core/BoundingRect'; -import {getPrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; export default class Station extends Group { constructor(model, style) { @@ -24,10 +24,12 @@ export default class Station extends Group { this.create(); this.createTurnBack(); // 创建按图折返 - this.prdType = getPrdType(); - if ((!this.prdType || this.style.StationStand.common.functionButtonShow.indexOf(this.prdType) !== -1) && model.guideTotalLockPoint) { + if (isShowThePrdType(model.prdType, style.Station.functionButtonShow) || model.previewOrMapDraw) { this.createGuideTotalLock(); // 创建引导总锁 } + if (model.previewOrMapDraw) { + this.setShowMode(); + } this.createControlMode(); this.setState(model); this.checkIsDrawMap(); @@ -366,4 +368,14 @@ export default class Station extends Group { 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(); + } + } } diff --git a/src/jmapNew/shape/StationControl/index.js b/src/jmapNew/shape/StationControl/index.js index 087037322..43e2a090c 100644 --- a/src/jmapNew/shape/StationControl/index.js +++ b/src/jmapNew/shape/StationControl/index.js @@ -178,4 +178,5 @@ export default class StationControl extends Group { } return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/StationCounter/index.js b/src/jmapNew/shape/StationCounter/index.js index 9c637089c..4e17573d8 100644 --- a/src/jmapNew/shape/StationCounter/index.js +++ b/src/jmapNew/shape/StationCounter/index.js @@ -86,5 +86,6 @@ export default class StationCounter extends Group { getShapeTipPoint() { return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/StationDelayUnlock/index.js b/src/jmapNew/shape/StationDelayUnlock/index.js index 7ad486668..a068cf5ca 100644 --- a/src/jmapNew/shape/StationDelayUnlock/index.js +++ b/src/jmapNew/shape/StationDelayUnlock/index.js @@ -104,4 +104,5 @@ export default class StationDelayUnlock extends Group { getShapeTipPoint() { return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index ee5ce2dfa..e5ee7e4e3 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -12,7 +12,7 @@ import EHighlight from '../element/EHighlight'; import ETrainStop from './ETrainStop'; import ETrainDepart from './ETrainDepart'; import EControl from '../element/EControl'; -import {getPrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; class StationStand extends Group { constructor(model, style) { @@ -24,12 +24,14 @@ class StationStand extends Group { this.zlevel = model.zlevel; this.z = 1; this.doors = new Group(); - this.prdType = getPrdType(); this.create(); 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(); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } this.setVisible(model.visible); this.setState(model); this.checkIsDrawMap(); @@ -563,5 +565,21 @@ class StationStand extends Group { 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; diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index d47c73450..567771dd9 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -201,7 +201,7 @@ export default class Switch extends Group { stroke: this.style.Switch.monolock.rectBorderColor, fill: this.style.transparentColor }); - + this.lockArc = new ELockArc({ // 锁定矩形 zlevel: this.zlevel, z: this.z + 6, @@ -264,7 +264,7 @@ export default class Switch extends Group { /** 恢复状态*/ recover() { this.lockRect.hide(); // 矩形包围框 - this.lockArc.hide(); // 圆形单锁框 + this.lockArc.hide(); // 圆形单锁框 this.setSwitchCoreColor(this.style.backgroundColor); this.name.getNameText().stopAnimation(false); this.swCore.stopAnimation(false); @@ -482,4 +482,5 @@ export default class Switch extends Group { this.on('mouseover', () => { this.highlight.mouseover(); }); } } + setShowMode() {} } diff --git a/src/jmapNew/shape/Text/index.js b/src/jmapNew/shape/Text/index.js index 6b197771c..b2209aa4d 100644 --- a/src/jmapNew/shape/Text/index.js +++ b/src/jmapNew/shape/Text/index.js @@ -1,6 +1,6 @@ import Text from 'zrender/src/graphic/Text'; import Group from 'zrender/src/container/Group'; -import {getPrdType, isShowThePrdType} from '../utils/handlePath'; +import {isShowThePrdType} from '../../utils/handlePath'; export default class Text2 extends Group { constructor(model, style) { @@ -12,11 +12,13 @@ export default class Text2 extends Group { this.model = model; this.style = style; this.z = 6; - this.prdType = getPrdType(); - if (isShowThePrdType(this.prdType, model.showConditions)) { + if (isShowThePrdType(model.prdType, model.showConditions) || model.previewOrMapDraw) { this.create(); this.setState(model); } + if (model.previewOrMapDraw) { + this.setShowMode(); + } } create() { @@ -45,4 +47,14 @@ export default class Text2 extends Group { 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(); + } + } } diff --git a/src/jmapNew/shape/Train/EMouse.js b/src/jmapNew/shape/Train/EMouse.js index f0a1ab761..2bcd4d25a 100644 --- a/src/jmapNew/shape/Train/EMouse.js +++ b/src/jmapNew/shape/Train/EMouse.js @@ -27,9 +27,9 @@ class EMouse extends Group { } let text = ''; 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 { - 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({ diff --git a/src/jmapNew/shape/Train/ETriangle.js b/src/jmapNew/shape/Train/ETriangle.js index d47ec973e..f658cb6bc 100644 --- a/src/jmapNew/shape/Train/ETriangle.js +++ b/src/jmapNew/shape/Train/ETriangle.js @@ -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]] }, style: { - stroke:'#FFFF00', + stroke:'#00FF00', lineWidth: 0.5, - fill: '#FFFF00' + fill: '#00FF00' } }); this.add(this.angle); diff --git a/src/jmapNew/shape/Train/TrainBody.js b/src/jmapNew/shape/Train/TrainBody.js index c58218619..20329f85b 100644 --- a/src/jmapNew/shape/Train/TrainBody.js +++ b/src/jmapNew/shape/Train/TrainBody.js @@ -102,7 +102,7 @@ export default class TrainBody extends Group { const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) : model.tripNumber || style.Train.trainTarget.defaultTripNumber) + ''; // 车次号 - const targetCode = style.Train.trainNumber.targetCodePrefix + (model.targetCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码 + const targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode) + ''; // 目的地码 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber) + ''; // 车组号 this.textTrainServer = new ETextName({ zlevel: model.zlevel, diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 19b3f9e76..35f5b5d15 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -18,6 +18,8 @@ export default class Train extends Group { this.z = 40; this.size = 0; 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.newScale = this.fontSize / style.Train.common.trainTextFontSize; 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, serviceNumber: model.serviceNumber, tripNumber: model.tripNumber, - targetCode: model.targetCode, + destinationCode: model.destinationCode, groupNumber: model.groupNumber, directionType: model.directionType, directionCode: model.directionCode, @@ -105,21 +107,37 @@ export default class Train extends Group { scale: this.newScale }); - const data = this.model.physicalCode; - const oldmodel = store.getters['map/getDeviceByCode'](data); - const leftPoint = oldmodel.points[0]; - const rightPoint = oldmodel.points[oldmodel.points.length - 1]; - const right = this.model.right == 1 ? 1 : 0; - this.startX = leftPoint.x + (1 - right) * (rightPoint.x - leftPoint.x); - this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y); - 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); + if (style.Section.trainPosition.display) { + const data = this.model.physicalCode; + const oldmodel = store.getters['map/getDeviceByCode'](data); + const leftPoint = oldmodel.points[0]; + const rightPoint = oldmodel.points[oldmodel.points.length - 1]; + const right = this.model.right == 1 ? 1 : 0; + this.startX = leftPoint.x + (1 - right) * (rightPoint.x - leftPoint.x); + this.startY = leftPoint.y + (1 - right) * (rightPoint.y - leftPoint.y); + // 算出折线的长度 + this.lineLength = 0; + let oldPoint = null; + oldmodel.points.forEach((point)=>{ + if (oldPoint) { + const temp = Math.sqrt( + 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.trainL); @@ -136,20 +154,66 @@ export default class Train extends Group { updateSection() { const train = this.model; - if (train.physicalCode && train.offsetp) { + if (train.physicalCode && train.offsetp && this.triangle) { const data = train.physicalCode; const oldmodel = store.getters['map/getDeviceByCode'](data); - const leftPoint = oldmodel.points[0]; - const rightPoint = oldmodel.points[oldmodel.points.length - 1]; - if (this.triangle) { + // 待处理(多个点的问题) + // const points = train.right == 1 ? oldmodel.points : oldmodel.points.reverse(); + 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.startY = leftPoint.y + (rightPoint.y - leftPoint.y) * train.offsetp; - const point = {x:this.startX, y:this.startY}; - this.triangle.point = point; - this.triangle.updateTriangle(point, train.right); - this.triangle.dirty(); - this.dirty(); + } else { + // debugger; + // this.lineLength * train.offsetp + // if (this.currentLength > targetDistance) { + // 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); } + setShowMode() {} } diff --git a/src/jmapNew/shape/TrainWindow/index.js b/src/jmapNew/shape/TrainWindow/index.js index e432ffdcb..5f35f4cff 100644 --- a/src/jmapNew/shape/TrainWindow/index.js +++ b/src/jmapNew/shape/TrainWindow/index.js @@ -39,7 +39,7 @@ class TrainWindow extends Group { zlevel: this.zlevel, z: this.z - 1, shape: { - smooth: this.style.TrainWindow.trainWindowSmooth, + smooth: this.style.TrainWindow.trainWindowSmooth, // 圆滑程度 points: [ [point.x - model.width / 2, point.y], [point.x + model.width / 2, point.y], @@ -78,6 +78,7 @@ class TrainWindow extends Group { getInstanceByCode(code) { return (store.getters['map/getDeviceByCode'](code) || {}).instance; } + setShowMode() {} } export default TrainWindow; diff --git a/src/jmapNew/shape/ZcControl/index.js b/src/jmapNew/shape/ZcControl/index.js index 324f69377..2797866f3 100644 --- a/src/jmapNew/shape/ZcControl/index.js +++ b/src/jmapNew/shape/ZcControl/index.js @@ -80,4 +80,5 @@ export default class ZcControl extends Group { } return null; } + setShowMode() {} } diff --git a/src/jmapNew/shape/checkBox/checkBox.js b/src/jmapNew/shape/checkBox/checkBox.js index 5e3e64902..7dcf8eab5 100644 --- a/src/jmapNew/shape/checkBox/checkBox.js +++ b/src/jmapNew/shape/checkBox/checkBox.js @@ -30,4 +30,5 @@ export default class checkBox extends Group { }); this.add(this.box); } + setShowMode() {} } diff --git a/src/jmapNew/shape/element/EControl.js b/src/jmapNew/shape/element/EControl.js index 18b4c3897..ca72e7336 100644 --- a/src/jmapNew/shape/element/EControl.js +++ b/src/jmapNew/shape/element/EControl.js @@ -102,4 +102,12 @@ export default class EControl extends Group { this.text.setStyle('textFill', color); } } + hide() { + this.control.hide(); + this.text.hide(); + } + show() { + this.control.show(); + this.text.show(); + } } diff --git a/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue b/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue index 3243e7651..77f0d2202 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuRequest.vue @@ -41,7 +41,7 @@ export default { }, data() { return { - unfold: false, + unfold: true, tempData: [], tableStyle: { 'border-bottom': 'none', @@ -105,7 +105,8 @@ export default { const operate = { over: true, 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.loading = false; diff --git a/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue b/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue index d59afe815..6c70337c7 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuSignal.vue @@ -49,13 +49,13 @@ export default { }, { label: '开放自动进路', - handler: this.atsAutoControl, - cmdType: CMD.Signal.CMD_SIGNAL_OPEN_AUTO_SETTING + handler: this.singalPassModel, + cmdType: CMD.Signal.CMD_SIGNAL_SET_CI_AUTO }, { label: '关闭自动进路', - handler: this.humanControl, - cmdType: CMD.Signal.CMD_SIGNAL_CLOSE_AUTO_SETTING + handler: this.singalCancelPassModel, + cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_CI_AUTO }, { label: '终端信号封锁', @@ -307,24 +307,45 @@ export default { arrangementRoute() { const step = { start: true, - // over:true, code: `${this.selected.code}`, operation: OperationEvent.Signal.arrangementRoute.menu.operation, param: { signalCode: `${this.selected.code}` - }, - // cmdType: CMD.Signal.CMD_SIGNAL_SET_ROUTE + } }; this.$store.dispatch('training/nextNew', step).then(({ valid }) => { if (valid) { 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(() => { this.$refs.noticeInfo.doShow(step); }); }, + checkRoutes(routes) { + const route = routes.filter(route => { + return route.greenOpen; + }); + return route[0].code; + }, // 进路引导 guide() { const step = { @@ -334,13 +355,13 @@ export default { operation: OperationEvent.Signal.guide.menu.operation, param: { signalCode: `${this.selected.code}` - }, + } // cmdType: CMD.Signal.CMD_SIGNAL_ROUTE_GUIDE }; this.$store.dispatch('training/nextNew', step).then(({ valid, response }) => { if (valid) { 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, param: { signalCode: `${this.selected.code}` - }, + } // cmdType: CMD.Signal.CMD_SIGNAL_CANCEL_ROUTE }; this.$store.dispatch('training/nextNew', step).then(({ valid }) => { if (valid) { 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, param: { signalCode: `${this.selected.code}` - }, + } // cmdType: CMD.Signal.CMD_SIGNAL_BLOCK }; this.$store.dispatch('training/nextNew', step).then(({ valid }) => { if (valid) { 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(() => { this.$refs.noticeInfo.doShow(step); @@ -394,13 +415,13 @@ export default { operation: OperationEvent.Signal.unlock.menu.operation, param: { signalCode: `${this.selected.code}` - }, + } // cmdType: CMD.Signal.CMD_SIGNAL_UNBLOCK }; this.$store.dispatch('training/nextNew', step).then(({ valid }) => { if (valid) { 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}}); } }); }, diff --git a/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue b/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue index b29cd645f..87afa9c2f 100644 --- a/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue +++ b/src/jmapNew/theme/chengdu_01/menus/menuTrain.vue @@ -1,7 +1,7 @@  diff --git a/src/jmapNew/theme/ningbo_01/menus/menuSignal.vue b/src/jmapNew/theme/ningbo_01/menus/menuSignal.vue index fd994a67e..9f646ef57 100644 --- a/src/jmapNew/theme/ningbo_01/menus/menuSignal.vue +++ b/src/jmapNew/theme/ningbo_01/menus/menuSignal.vue @@ -525,7 +525,7 @@ export default { this.$refs.routerCommand.doShow(step, this.selected, '是否执行引导命令'); } }); - }, + } } }; diff --git a/src/jmapNew/shape/utils/handlePath.js b/src/jmapNew/utils/handlePath.js similarity index 58% rename from src/jmapNew/shape/utils/handlePath.js rename to src/jmapNew/utils/handlePath.js index aa92d6364..034ea8b28 100644 --- a/src/jmapNew/shape/utils/handlePath.js +++ b/src/jmapNew/utils/handlePath.js @@ -12,14 +12,14 @@ export function getPrdType() { return prdType; } export function isShowThePrdType (prdType, showConditions) { - const path = window.location.href; - if (path.indexOf('map/draw') !== -1 ) { + if (showConditions === '01' || (showConditions === '02' && prdType === '02') || (showConditions === '03' && prdType === '01')) { return true; - } else { - if (showConditions === '01' || (showConditions === '02' && prdType === '02') || (showConditions === '03' && prdType === '01')) { - return true; - } else if (!showConditions) { - return true; // 兼容老数据没有showConditions - } + } else if (!showConditions) { + return true; // 兼容老数据没有showConditions } + +} +export function isPreviewOrMapDraw() { + const path = window.location.href; + return path.indexOf('map/draw') !== -1 || path.indexOf('mapPreviewNew') !== -1; } diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index ee489847d..edf7a60e2 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -30,105 +30,105 @@ export function calculateDCenter(viewRect, zrbound) { return { dx: dx, dy: dy }; } -export function deviceFactory(type, elem) { - return {...deviceRender[type], ...elem}; +export function deviceFactory(type, elem, showConfig) { + return {...deviceRender[type], ...elem, ...showConfig}; } -export function createDevice(type, elem, propConvert) { - const device = deviceFactory(type, Object.assign(elem, { _type: type } )); +export function createDevice(type, elem, propConvert, showConfig) { + const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig); return propConvert ? propConvert.initPrivateProps(device) : device; } -export function parser(data, skinCode) { +export function parser(data, skinCode, showConfig) { var mapDevice = {}; var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; if (data) { zrUtil.each(data.sectionList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert, showConfig); }, this); zrUtil.each(data.signalList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert, showConfig); }, this); zrUtil.each(data.stationList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig); }, this); zrUtil.each(data.stationStandList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert, showConfig); }, this); zrUtil.each(data.stationControlList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert, showConfig); }, this); zrUtil.each(data.counterList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert, showConfig); }, this); zrUtil.each(data.delayShowList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert, showConfig); }, this); zrUtil.each(data.lineList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig); }, this); zrUtil.each(data.espList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Esp, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Esp, elem, propConvert, showConfig); }, this); zrUtil.each(data.psdList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Psd, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Psd, elem, propConvert, showConfig); }, this); zrUtil.each(data.textList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig); }, this); zrUtil.each(data.zcList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert, showConfig); }, this); zrUtil.each(data.lcList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert, showConfig); }, this); zrUtil.each(data.tempSpeedLimitList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert, showConfig); }, this); zrUtil.each(data.resourceList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert, showConfig); }, this); zrUtil.each(data.trainList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig); }, this); zrUtil.each(data.Line || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig); }, this); zrUtil.each(data.Text || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig); }, this); zrUtil.each(data.cycleButtonList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.MapCycleButtonVO, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.MapCycleButtonVO, elem, propConvert, showConfig); }, this); zrUtil.each(data.automaticRouteButtonList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.AutomaticRoute, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.AutomaticRoute, elem, propConvert, showConfig); }, this); zrUtil.each(data.outerFrameList || [], elem => { - mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert); + mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert, showConfig); }, this); 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) { const section = mapDevice[elem.sectionCode]; if (section) { @@ -138,7 +138,7 @@ export function parser(data, skinCode) { }, this); 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 lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode]; const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode]; diff --git a/src/store/modules/map.js b/src/store/modules/map.js index d21039c44..83955aa87 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -195,7 +195,7 @@ const map = { mapDataLoadedCount: 0, // 地图数据加载完成标识 trainDetails: null, // 地图'列车详情'显示 deleteCount: 0, // 绘图快捷删除标识 - updateCount: 0, // 绘图快捷修改标识 + updateCount: 0, // 绘图快捷修改标识 mousemove: 0 // 实训战场图移动标识 }, @@ -515,7 +515,11 @@ const map = { setMapData: (state, map) => { if (map && map.skinVO) { 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); } else { state.map = null; diff --git a/src/views/newMap/jlmapNew/index.vue b/src/views/newMap/jlmapNew/index.vue index a15641cee..c32936182 100644 --- a/src/views/newMap/jlmapNew/index.vue +++ b/src/views/newMap/jlmapNew/index.vue @@ -4,6 +4,7 @@
+
@@ -33,7 +34,8 @@ import Vue from 'vue'; import localStore from 'storejs'; 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 { mapGetters } from 'vuex'; import { TrainingMode } from '@/scripts/ConstDic'; @@ -44,7 +46,8 @@ export default { name: 'JlmapVisual', components: { ZoomBox, - ProgressBar + ProgressBar, + ShowMode }, data() { return { @@ -89,6 +92,9 @@ export default { }, maskOpen() { return this.$store.state.config.maskOpen; + }, + isDesign() { + return this.$route.path.indexOf('mapPreviewNew') !== -1 || this.$route.path.indexOf('map/draw') !== -1; } }, watch: { @@ -152,11 +158,15 @@ export default { }; // 默认个人地图绘制可以滚轮放大缩小 其他地图显示不允许此操作 const path = window.location.href; - let mouseWheelFlag = false; - if (path.includes('design/userlist/map/draw') || path.includes('design/usermap/map/draw')) { - mouseWheelFlag = true; + const mouseWheelFlag = true; + let previewOrMapDraw = false; + // 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.$jlmap = new Jlmap({ dom: document.getElementById(this.canvasId), @@ -171,6 +181,11 @@ export default { offsetY: 0, zoomOnMouseWheel: mouseWheelFlag }, + showConfig: { + prdType: prdType, + previewOrMapDraw: previewOrMapDraw, + showMode: '03' + }, methods: { dataLoaded: this.handleDataLoaded, viewLoaded: this.handleViewLoaded, @@ -312,6 +327,13 @@ export default { y: e.offsetY + Number(this.dataZoom.offsetY) }; 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); } } }; diff --git a/src/views/newMap/jlmapNew/pendant/showMode.vue b/src/views/newMap/jlmapNew/pendant/showMode.vue new file mode 100644 index 000000000..469b9d02c --- /dev/null +++ b/src/views/newMap/jlmapNew/pendant/showMode.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/views/newMap/jlmapNew/zoom/zoom.vue b/src/views/newMap/jlmapNew/pendant/zoom.vue similarity index 51% rename from src/views/newMap/jlmapNew/zoom/zoom.vue rename to src/views/newMap/jlmapNew/pendant/zoom.vue index 957a7cb6e..87764c435 100644 --- a/src/views/newMap/jlmapNew/zoom/zoom.vue +++ b/src/views/newMap/jlmapNew/pendant/zoom.vue @@ -10,54 +10,54 @@