diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 991c6ede1..a386009a2 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -203,6 +203,20 @@ class SkinCode extends defaultStyle { } }; + this[deviceType.Automactic] = { + // 是否显示 + visible: true, + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + radiusR: 6, // 控制灯大小 + controlColor: '#b5b3b3' // 控制灯颜色 (灰色) + } + }; + this[deviceType.StationStand] = { common: { // 通用属性 textFontSize: 10, // 站台默认字体大小 diff --git a/src/jmapNew/constant/deviceRender.js b/src/jmapNew/constant/deviceRender.js index 90ed42c7b..15fd2dccf 100644 --- a/src/jmapNew/constant/deviceRender.js +++ b/src/jmapNew/constant/deviceRender.js @@ -116,4 +116,11 @@ deviceRender[deviceType.CheckBox] = { zlevel: 1 }; +/** Automactic渲染配置 自动折返*/ +deviceRender[deviceType.Automactic] = { + _type: deviceType.Automactic, + zlevel: 1 +}; + + export default deviceRender; diff --git a/src/jmapNew/constant/deviceType.js b/src/jmapNew/constant/deviceType.js index ca259fc90..6407bfeb4 100644 --- a/src/jmapNew/constant/deviceType.js +++ b/src/jmapNew/constant/deviceType.js @@ -10,6 +10,7 @@ const deviceType = { StationStand: 'StationStand', Esp: 'Esp', Psd: 'Psd', + Automactic: 'Automactic', StationControl: 'StationControl', StationCounter: 'StationCounter', StationDelayUnlock: 'StationDelayUnlock', diff --git a/src/jmapNew/constant/stateTransition.js b/src/jmapNew/constant/stateTransition.js index e315037d6..b3f456574 100644 --- a/src/jmapNew/constant/stateTransition.js +++ b/src/jmapNew/constant/stateTransition.js @@ -106,6 +106,9 @@ class Status { handleLimitControl(device) { this.statusObj = { }; } + handleAutomactic(device) { + this.statusObj = { }; + } getStatus() { return this.statusObj; } diff --git a/src/jmapNew/shape/Automactic/EMouse.js b/src/jmapNew/shape/Automactic/EMouse.js new file mode 100644 index 000000000..fdb639e95 --- /dev/null +++ b/src/jmapNew/shape/Automactic/EMouse.js @@ -0,0 +1,53 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class EMouse extends Group { + constructor(device) { + super(); + this.device = device; + this.create(); + } + create() { + this.text = new Text({ + zlevel: this.device.zlevel, + z: this.device.z+1, + position: [0, 0], + style: { + x: this.device.model.position.x, + y: this.device.model.position.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance-30, + fontWeight: 'normal', + fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, + fontFamily: this.device.style.LcControl.mouseOverStyle.fontFamily, + text: this.device.model.name, + textFill: this.device.style.LcControl.mouseOverStyle.fontColor, + textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, + textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign + } + }); + this.add(this.text); + this.text.hide(); + } + mouseover(e) { + if (e.target && e.target._subType == 'Text') { + this.text.show(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); + this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); + this.device.control.setTextBorder(true); + this.device.control.setArcBorder(true); + } + } + + mouseout(e) { + if (!this.device.model.down) { + if (e.target && e.target._subType == 'Text') { + this.text.hide(); + } else { + this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); + this.device.control.setTextColor('#FFFFFF'); + this.device.control.setTextBorder(false); + this.device.control.setArcBorder(false); + } + } + } +} diff --git a/src/jmapNew/shape/Automactic/index.js b/src/jmapNew/shape/Automactic/index.js new file mode 100644 index 000000000..869431a5a --- /dev/null +++ b/src/jmapNew/shape/Automactic/index.js @@ -0,0 +1,97 @@ +/* +* 自动折返 控制器 +*/ +import Group from 'zrender/src/container/Group'; +import EControl from '../element/EControl'; +import EMouse from './EMouse'; + +export default class LcControl extends Group { + constructor(model, style) { + super(); + this.z = 20; + this._code = model.code; + this._type = model._type; + this.zlevel = model.zlevel; + this.model = model; + this.style = style; + this.create(); + this.createMouseEvent(); + this.setState(model); + } + + create() { + const model = this.model; + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: this.style.Automactic.lamp.radiusR + }, + style: { + lineWidth: 0, + fill: this.style.Automactic.lamp.controlColor + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: model.position.x, + y: model.position.y + this.style.Automactic.lamp.radiusR + this.style.Automactic.text.distance, + fontWeight: this.style.Automactic.text.fontWeight, + fontSize: this.style.Automactic.text.fontSize, + fontFamily: this.style.fontFamily, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + } + }); + const arcRect = this.getArcBoundingRect(); + this.arcBorder = new Rect({ + zlevel: this.zlevel, + z: this.z, + silent: true, + shape: arcRect, + style: { + lineDash: this.style.arcBorderStyle.lineDash, + stroke: this.style.arcBorderStyle.stroke, + fill: this.style.arcBorderStyle.fill + } + }); + this.add(this.control); + this.add(this.text); + this.add(this.textBorder); + } + + // 设置状态 + setState(model) { + } + + createMouseEvent() { + if (this.style.LcControl.mouseOverStyle) { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); + } + } + + getShapeTipPoint() { + if (this.control) { + var distance = 2; + var rect = this.control.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } +} diff --git a/src/jmapNew/shape/factory.js b/src/jmapNew/shape/factory.js index 56a2cc918..b003bf2e4 100644 --- a/src/jmapNew/shape/factory.js +++ b/src/jmapNew/shape/factory.js @@ -15,6 +15,7 @@ import TrainWindow from './TrainWindow/index.js'; import Train from './Train/index.js'; import Line from './Line/index.js'; import Text2 from './Text/index.js'; +import Automactic from './Automactic/index.js'; import CheckBox from './checkBox/checkBox.js'; /** 图库*/ @@ -35,6 +36,7 @@ mapShape[deviceType.TrainWindow] = TrainWindow; mapShape[deviceType.Train] = Train; mapShape[deviceType.Line] = Line; mapShape[deviceType.Text] = Text2; +mapShape[deviceType.Automactic] = Automactic; mapShape[deviceType.CheckBox] = CheckBox; function shapefactory(device, jmap) { diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index b3be0c230..ca3cace52 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -115,6 +115,10 @@ export function parser(data, skinCode) { mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert); }, this); + zrUtil.each(data.Automactic || [], elem => { + mapDevice[elem.code] = createDevice(deviceType.Automactic, elem, propConvert); + }, this); + zrUtil.each(data.trainWindowList || [], elem => { mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert); if (elem.sectionCode) { @@ -205,6 +209,7 @@ export function updateMapData(state, model) { case deviceType.Text: updateForList(model, state, 'textList'); break; case deviceType.Psd: updateForList(model, state, 'psdList'); break; case deviceType.Esp: updateForList(model, state, 'espList'); break; + case deviceType.Automactic: updateForList(model, state, 'automaticList'); break; } } } diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 62ed414ce..7d6ce651e 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -316,6 +316,13 @@ const map = { return []; } }, + automaticList: (state) => { + if (state.map) { + return state.map.automaticList || []; + } else { + return []; + } + }, resourceList: (state) => { if (state.map) { return state.map.resourceList; diff --git a/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue new file mode 100644 index 000000000..1a1de81c4 --- /dev/null +++ b/src/views/newMap/newMapdraft/mapoperate/automaticControl.vue @@ -0,0 +1,270 @@ + + + + + + + + + + + {{ $t('map.updateObj') }} + {{ $t('map.deleteObj') }} + + + + + + + + + + + + {{ $t('map.create') }} + + + + + + + + diff --git a/src/views/newMap/newMapdraft/mapoperate/index.vue b/src/views/newMap/newMapdraft/mapoperate/index.vue index 46f811c85..22d14242e 100644 --- a/src/views/newMap/newMapdraft/mapoperate/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/index.vue @@ -92,6 +92,14 @@ @setCenter="setCenter" /> + + +