调整哈尔滨道岔显示问题

This commit is contained in:
joylink_zyy 2020-02-29 00:04:24 +08:00
parent ff640adf39
commit 446593fded
4 changed files with 47 additions and 25 deletions

View File

@ -98,6 +98,10 @@ class Status {
this.statusObj = {
};
}
handleTrainWindow(device) {
this.statusObj = {
};
}
getStatus() {
return this.statusObj;
}

View File

@ -240,8 +240,17 @@ class Jlmap {
}
});
}
setUpdateMapDevice(list) {
store.dispatch('map/updateMapDevice', list);
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
const oDevice = this.mapDevice[code] || deviceFactory(type, elem);
this.hookHandle(oDevice, elem)
});
}
update(list) {
this.setUpdateMapDevice(list || []); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息
(list || []).forEach(elem => {
const code = elem.code;
const type = elem._type;
@ -258,9 +267,9 @@ class Jlmap {
if (elem.dispose) {
this.$painter.delete(oDevice);
} else {
if (this.hookHandle(oDevice, elem)) {
// if (this.hookHandle(oDevice, elem)) {
this.$painter.update(oDevice);
}
// }
}
}

View File

@ -11,7 +11,7 @@ import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路
import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle';
import router from '@/router';
import {drawSectionStyle} from '../../config/defaultStyle';
import { drawSectionStyle } from '../../config/defaultStyle';
import store from '@/store';
/** 区段*/
@ -38,8 +38,8 @@ export default class Section extends Group {
this.createSectionText(); // 创建区段文字
if ((model.type === '01' || model.type === '03') && (
model.logicSectionNum.length <= 0 ||
model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) ||
model.type === '02' ) {
model.logicSectionNum.length == 1 && model.logicSectionNum[0] == 0) ||
model.type === '02') {
this.createSection(); // 创建区段
this.creatRelease(); // 创建延时释放
this.createSeparator(); // 创建分隔符
@ -315,7 +315,7 @@ export default class Section extends Group {
this.add(this.name);
}
} else if (model.type == '04') {
if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft') ) {
if (router.currentRoute.path.startsWith('/design/usermap/map/draw') && router.currentRoute.path.endsWith('/draft')) {
this.name = new ETextName({
zlevel: this.zlevel,
z: this.z + 2,
@ -774,6 +774,15 @@ export default class Section extends Group {
/** 设置状态*/
setState(model) {
this.recover();
// 实际上就是 状态重置 必须在设置其他状态之前 设置颜色之类的
if (this.style.Switch.sectionAction.flag && model.relSwitchCode) {
const switchModel = store.getters['map/getDeviceByCode'](model.relSwitchCode);
if (switchModel.normalPosition && switchModel.sectionCCode == model.code) {
this.section.setStyle({ stroke: this.style.Switch.sectionAction.spareColor })
} else if (switchModel.reversePosition && switchModel.sectionBCode == model.code) {
this.section.setStyle({ stroke: this.style.Switch.sectionAction.spareColor })
}
}
/** 道岔保护区段锁闭 */
model.overlapLock && this.protectiveLock();
/** 空闲锁闭或者叫进路锁闭 */
@ -786,24 +795,16 @@ export default class Section extends Group {
/** CBTC车占用 */
model.ctOccupied && this.communicationOccupied();
/** 区段切除*/
model.cutOff && this.sectionCutOff();
model.cutOff && this.sectionCutOff();
/** 是否限速*/
model.speedUpLimit && this.setSpeedUpperLimit();
/** 道岔区段更新岔心颜色 */
if (model.type === '03' && model.switch) {
const sectionSwitch = store.getters['map/getDeviceByCode'](model.switch.code);
if ( sectionSwitch && sectionSwitch.sectionACode === model.code ) {
const sectionSwitch = store.getters['map/getDeviceByCode'](model.switch.code);
if (sectionSwitch && sectionSwitch.sectionACode === model.code) {
sectionSwitch.instance && sectionSwitch.instance.setState(sectionSwitch);
}
}
if (this.style.Switch.sectionAction.flag && model.relSwitchCode) {
const switchCode = store.getters['map/getDeviceByCode'](model.relSwitchCode);
if (switchCode.normalPosition && switchCode.sectionCCode == model.code) {
this.section.setStyle({stroke: this.style.Switch.sectionAction.spareColor })
} else if (switchCode.reversePosition && switchCode.sectionBCode == model.code){
this.section.setStyle({stroke: this.style.Switch.sectionAction.spareColor })
}
}
}
/** 计算提示位置*/
@ -835,9 +836,9 @@ export default class Section extends Group {
drawSelected(selected) {
this.selected = selected;
if (selected) {
!this.selectedType && this.section && this.section.setStyle({stroke: '#fbfbfb'});
!this.selectedType && this.section && this.section.setStyle({ stroke: '#fbfbfb' });
} else {
!this.selectedType && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
!this.selectedType && this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor });
}
}
drawBatchSelected(selected, type) {
@ -845,9 +846,9 @@ export default class Section extends Group {
return;
}
if (selected && !this.selectedType) {
this.section && this.section.setStyle({stroke: drawSectionStyle[type]});
this.section && this.section.setStyle({ stroke: drawSectionStyle[type] });
} else {
this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor });
this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor });
}
this.selectedType = type;
}
@ -855,8 +856,8 @@ export default class Section extends Group {
checkIsDrawMap() {
const path = window.location.href;
if (path.includes('/map/draw')) {
this.on('mouseout', () => { !this.selectedType && !this.selected && this.section && this.section.setStyle({stroke: this.style.Section.line.spareColor }); });
this.on('mouseover', () => { !this.selectedType && this.section && this.section.setStyle({stroke: '#fbfbfb'}); });
this.on('mouseout', () => { !this.selectedType && !this.selected && this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor }); });
this.on('mouseover', () => { !this.selectedType && this.section && this.section.setStyle({ stroke: '#fbfbfb' }); });
}
}
@ -865,7 +866,7 @@ export default class Section extends Group {
}
mouseover() {
this.section && this.section.setStyle({stroke: 'rgba(255,255,255,0.8)'});
this.section && this.section.setStyle({ stroke: 'rgba(255,255,255,0.8)' });
}
}

View File

@ -498,6 +498,11 @@ const map = {
state.mapDevice = {};
}
},
updateMapDevice: (state, list) => {
list.forEach(elem => {
state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem);
})
},
setMapConfig: (state, config) => {
state.mapConfig = config;
},
@ -624,6 +629,9 @@ const map = {
setMapData: ({ commit }, map) => { // 设置地图数据
commit('setMapData', map);
},
updateMapDevice: ({ commit }, list) => {
commit('updateMapDevice', list);
},
setMapConfig: ({ commit }, config) => { // 设置地图所属线路
commit('setMapConfig', config);
},