diff --git a/src/jmapNew/constant/nccGraphRender.js b/src/jmapNew/constant/nccGraphRender.js index 29381dc99..8e9b0d48c 100644 --- a/src/jmapNew/constant/nccGraphRender.js +++ b/src/jmapNew/constant/nccGraphRender.js @@ -17,4 +17,9 @@ nccGraphRender[nccGraphType.NccTrain] = { _type: nccGraphType.NccTrain, zlevel: 1 }; +/** StationCircle渲染配置 */ +nccGraphRender[nccGraphType.StationCircle] = { + _type: nccGraphType.StationCircle, + zlevel: 1 +}; export default nccGraphRender; diff --git a/src/jmapNew/constant/nccGraphType.js b/src/jmapNew/constant/nccGraphType.js index d4cbd113d..c7a51d84f 100644 --- a/src/jmapNew/constant/nccGraphType.js +++ b/src/jmapNew/constant/nccGraphType.js @@ -1,7 +1,8 @@ const nccGraphType = { RunLine: 'RunLine', NccStation: 'NccStation', - NccTrain: 'NccTrain' + NccTrain: 'NccTrain', + StationCircle: 'StationCircle' }; export default nccGraphType; diff --git a/src/jmapNew/parser/parser-nccGraph.js b/src/jmapNew/parser/parser-nccGraph.js index 9b35a3e50..d7fcf58e9 100644 --- a/src/jmapNew/parser/parser-nccGraph.js +++ b/src/jmapNew/parser/parser-nccGraph.js @@ -29,6 +29,10 @@ export function parser(nccData, skinCode, showConfig) { nccDevice[elem.code] = createDevice(nccGraphType.RunLine, elem, propConvert, showConfig); }, this); + zrUtil.each(nccData.stationCircleList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.StationCircle, elem, propConvert, showConfig); + }, this); + } return { nccDevice, runPositionData }; } @@ -71,6 +75,7 @@ export function updateMapData(state, model) { switch (model._type) { case nccGraphType.RunLine: updateForList(model, state, 'runLineList'); break; case nccGraphType.NccStation: updateForList(model, state, 'nccStationList'); break; + case nccGraphType.StationCircle: updateForList(model, state, 'stationCircleList'); break; } } } diff --git a/src/jmapNew/shape/nccGraph/StationCircle/index.js b/src/jmapNew/shape/nccGraph/StationCircle/index.js new file mode 100644 index 000000000..ae0bb04a6 --- /dev/null +++ b/src/jmapNew/shape/nccGraph/StationCircle/index.js @@ -0,0 +1,47 @@ +import Group from 'zrender/src/container/Group'; +import Rect from 'zrender/src/graphic/shape/Rect'; + +export default class StationCircle extends Group { + constructor(model, {style}) { + super(); + this._code = model.code; + this._type = model._type; + this.zlevel = model.zlevel; + this.z = 9; + this.model = model; + this.style = style; + this.create(); + this.setState(model); + } + create() { + const model = this.model; + this.rectBody = new Rect({ + zlevel: this.zlevel, + z: this.z, + shape: { + r: [model.r], + x: model.position.x, + y: model.position.y, + width: model.width, + height: model.height + }, + style: { + fill: model.fillColor, + stroke: model.lineColor, + lineWidth: model.lineWidth + } + }); + this.add(this.rectBody); + } + + setState(model) { + } + getAnchorPoint() { + if (this.rectBody) { + const rect = this.rectBody.getBoundingRect(); + return {x:rect.x, y:rect.y}; + } else { + return {x:this.model.position.x, y:this.model.position.y}; + } + } +} diff --git a/src/jmapNew/shape/nccGraph/index.js b/src/jmapNew/shape/nccGraph/index.js index 4c1125160..d25a5f8a7 100644 --- a/src/jmapNew/shape/nccGraph/index.js +++ b/src/jmapNew/shape/nccGraph/index.js @@ -3,10 +3,12 @@ import nccGraphType from '../../constant/nccGraphType'; import NccStation from './NccStation'; import RunLine from './RunLine'; import NccTrain from './NccTrain'; +import StationCircle from './StationCircle'; /** 图库*/ const mapShape = {}; mapShape[nccGraphType.NccStation] = NccStation; mapShape[nccGraphType.RunLine] = RunLine; mapShape[nccGraphType.NccTrain] = NccTrain; +mapShape[nccGraphType.StationCircle] = StationCircle; export default mapShape; diff --git a/src/store/modules/map.js b/src/store/modules/map.js index e7a27d9ff..72bc2ece1 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -621,6 +621,13 @@ const map = { return []; } }, + stationCircleList: state => { + if (state.nccData) { + return state.nccData.stationCircleList || []; + } else { + return []; + } + }, // trainDetails: (state) => { // return state.trainDetails; // }, @@ -1314,7 +1321,6 @@ const map = { if (window.location.href.includes('/design/usermap/map/nccDraw')) { handleOperation(state, list); } - console.log(ParserType.nccGraph.value, '*********'); commit('mapRender', {devices: list, type: ParserType.nccGraph.value}); resolve(list); }); diff --git a/src/views/newMap/newMapdraftSystem/index.vue b/src/views/newMap/newMapdraftSystem/index.vue index 57e3d4ba7..96762da2b 100644 --- a/src/views/newMap/newMapdraftSystem/index.vue +++ b/src/views/newMap/newMapdraftSystem/index.vue @@ -325,6 +325,7 @@ export default { this.$router.push({ path: `/design/usermap/home` }); }, updateMapModel(models) { // 创建 跟新元素 + console.log('updateMapModel', models); this.$store.dispatch('map/updateNccMapDevices', models); }, // 撤销 diff --git a/src/views/newMap/newMapdraftSystem/mapoperate/index.vue b/src/views/newMap/newMapdraftSystem/mapoperate/index.vue index 1188729c9..b7c2c32ec 100644 --- a/src/views/newMap/newMapdraftSystem/mapoperate/index.vue +++ b/src/views/newMap/newMapdraftSystem/mapoperate/index.vue @@ -29,6 +29,7 @@