线路:南京2,哈尔滨
问题: 1.绘制哈尔滨传输信号机 2.处理传输信号机的逻辑处理问题
This commit is contained in:
parent
62b5cea8fb
commit
461d64afe1
@ -202,6 +202,13 @@ class SkinCode extends defaultStyle {
|
||||
borderDashColor: '#FFFFFF', // 信号灯按钮边线
|
||||
buttonColor: 'darkgreen', // 信号灯按钮颜色
|
||||
buttonLightenColor: '#E4EF50' // 信号灯按钮闪烁颜色
|
||||
},
|
||||
transmission: { // 传输信号机
|
||||
fillColor: '#f00',
|
||||
fillColorVirtual: '#000080',
|
||||
sideLength: 20,
|
||||
textColor: '#fff',
|
||||
strokeColor: '#00FFFF',
|
||||
},
|
||||
lowButton:{
|
||||
display: false // 现地 信号机按钮
|
||||
|
@ -259,9 +259,10 @@ class SkinCode extends defaultStyle {
|
||||
},
|
||||
transmission: { // 传输信号机
|
||||
fillColor: '#f00',
|
||||
fillColorVirtual: '#000080',
|
||||
sideLength: 20,
|
||||
textColor: '#fff',
|
||||
strokeColor: '#00FFFF'
|
||||
strokeColor: '#00FFFF',
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,7 @@ import deviceType from './constant/deviceType';
|
||||
import { selectLineCode } from './config/deviceStyle';
|
||||
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import * as adapter from '@/jmapNew/utils/adapter';
|
||||
import store from '@/store/index';
|
||||
import Vue from 'vue';
|
||||
|
||||
@ -615,9 +616,9 @@ class Jlmap {
|
||||
}
|
||||
|
||||
getShapeTipPoint(opts) {
|
||||
const device = this.mapDevice[opts.code];
|
||||
const device = adapter.adapterByDevice(this.mapDevice[opts.code], this.mapDevice);
|
||||
if (device) {
|
||||
return this.$painter.getShapeTipPoint(device.instance, opts);
|
||||
return this.$painter.getShapeTipPoint(device.instance, opts);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,10 +223,9 @@ class Painter {
|
||||
getShapeTipPoint(instance, opts) {
|
||||
if (instance) {
|
||||
var point = instance.getShapeTipPoint(opts);
|
||||
if (point) {
|
||||
if (point) {
|
||||
// 矩阵变换
|
||||
var transform = this.$transformHandle.transform;
|
||||
var transPoint = vector.applyTransform([], [point.x, point.y], transform);
|
||||
var transPoint = instance.transformCoordToGlobal(point.x, point.y);
|
||||
return {
|
||||
x: transPoint[0],
|
||||
y: transPoint[1]
|
||||
|
@ -54,11 +54,11 @@ export default class Arrow extends Group {
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || this.model.stationCode === stationCode) {
|
||||
this.arrow.show();
|
||||
this.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.arrow.hide();
|
||||
this.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,12 @@ import { findDeviceByModelDepType } from '../utils/ShapeDepFind';
|
||||
// import background from './../../../ibp/shape/background';
|
||||
|
||||
class Signal extends Group {
|
||||
constructor(model, {style}) {
|
||||
constructor(model, {style, mapDevice}) {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.model = model;
|
||||
this.mapDevice = mapDevice;
|
||||
this.style = style;
|
||||
this.count = parseInt(model.lampPositionType);
|
||||
this.lamps = new Array(this.count);
|
||||
@ -321,10 +322,12 @@ class Signal extends Group {
|
||||
const drict = this.model.right ? 1 : -1; // 朝向 左:右
|
||||
const posit = this.model.positionType == '01' ? -1 : 1; // 位置 上:下
|
||||
// 信号机名称
|
||||
const actual = this.mapDevice[model.linkSignalCode];
|
||||
const sigNameX = model.position.x + model.positionPoint.x + drict * 0.433 * style.Signal.transmission.sideLength + model.namePosition.x;
|
||||
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
|
||||
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.right ? 'left' : 'right';
|
||||
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
|
||||
const fillColor = actual.virtual? style.Signal.transmission.fillColorVirtual: style.Signal.transmission.fillColor;
|
||||
this.sigName = new ESigName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
@ -353,7 +356,7 @@ class Signal extends Group {
|
||||
]
|
||||
},
|
||||
style: {
|
||||
fill: style.Signal.transmission.fillColor,
|
||||
fill: fillColor,
|
||||
stroke: style.Signal.transmission.strokeColor,
|
||||
lineWidth: 0
|
||||
}
|
||||
@ -850,7 +853,8 @@ class Signal extends Group {
|
||||
default:
|
||||
var drict = this.model.right ? 1 : -1; // 朝向 右:左
|
||||
var offsetY = this.model.positionType == '01' ? this.style.Signal.text.fontSize : 0; // 位置 上:下
|
||||
rect = this.sigPost.getBoundingRect().clone();
|
||||
var shape = this.model.type == 'TRANSMISSION'? this.transmission: this.sigPost;
|
||||
rect = shape.getBoundingRect().clone();
|
||||
rect.x = rect.x + drict * this.style.Signal.post.standardVerticalWidth;
|
||||
rect.y = rect.y - offsetY;
|
||||
break;
|
||||
|
@ -139,7 +139,9 @@ import NoticeInfo from '@/jmapNew/theme/components/menus/childDialog/noticeInfo'
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import { TrainingMode } from '@/scripts/ConstDic';
|
||||
import * as adapter from '@/jmapNew/utils/adapter';
|
||||
import BanIcon from '@/assets/ban-heb.png';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
NoticeInfo
|
||||
@ -210,6 +212,12 @@ export default {
|
||||
commandId() {
|
||||
return OperationEvent.Command.commandHaerbin.confirm.domId;
|
||||
},
|
||||
mapDevice() {
|
||||
return this.$store.state.map.mapDevice;
|
||||
},
|
||||
actualSelected() {
|
||||
return adapter.adapterAsDevice(this.selected, this.mapDevice);
|
||||
},
|
||||
cr1ConfrimId() {
|
||||
return OperationEvent.Command.commandHaerbin.confrimCr1.domId;
|
||||
},
|
||||
@ -226,13 +234,14 @@ export default {
|
||||
'01': 'Local', // 现地工作站
|
||||
'02': 'Center' // 中心调度工作站
|
||||
};
|
||||
|
||||
if (this.selected._type) {
|
||||
const control = this.getStationControl(this.selected);
|
||||
const type = State2SimulationMap[this.$store.state.training.prdType];
|
||||
if (control.controlMode != type) {
|
||||
this.clearAllMenuShow();
|
||||
if (type == 'Center' && this.selected._type == 'Station') {
|
||||
this.selectedObj = this.selected;
|
||||
this.selectedObj = this.actualSelected;
|
||||
if (this.selectedObj._type) {
|
||||
this.canCommand = true;
|
||||
const step = {
|
||||
@ -256,7 +265,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.selectedObj = this.selected;
|
||||
this.selectedObj = this.actualSelected;
|
||||
this.speedShowCon = false;
|
||||
if (this.selectedObj._type) {
|
||||
if (this.selectedObj._type == 'Section' && (this.selectedObj.type == '03' || this.selectedObj.type == '04')) { // 道岔区段 道岔计轴区段 都是道岔操作
|
||||
@ -276,10 +285,10 @@ export default {
|
||||
this.handleSwicthMenu();
|
||||
break;
|
||||
case 'Signal':
|
||||
if (this.oldClickObj && this.oldClickObj.code != this.selectedObj.code) {
|
||||
if (this.oldClickObj && this.oldClickObj.code != this.actualSelected.code) {
|
||||
this.checkSignal();
|
||||
} else {
|
||||
this.handleSingalMenu();
|
||||
this.handleSignalMenu();
|
||||
}
|
||||
break;
|
||||
case 'Section':
|
||||
@ -444,11 +453,11 @@ export default {
|
||||
sectionCode: section.code
|
||||
};
|
||||
},
|
||||
handleSingalMenu() {
|
||||
handleSignalMenu() {
|
||||
this.clearAllMenuShow();
|
||||
this.deviceHighLight(this.oldDevice, false);
|
||||
this.deviceHighLight(this.selectedObj, true);
|
||||
this.oldDevice = this.selectedObj;
|
||||
this.deviceHighLight(this.actualSelected, true);
|
||||
this.oldDevice = this.actualSelected;
|
||||
if (this.oldClickObj) { // 清除上上次信号机背景
|
||||
this.deviceHighLight(this.oldClickObj, false);
|
||||
}
|
||||
@ -519,7 +528,7 @@ export default {
|
||||
this.deviceHighLight(this.selectedObj, true);
|
||||
this.oldDevice = this.selectedObj;
|
||||
} else {
|
||||
this.handleSingalMenu();
|
||||
this.handleSignalMenu();
|
||||
}
|
||||
},
|
||||
handleSectionMenu() {
|
||||
|
@ -33,8 +33,7 @@ class Model {
|
||||
this['private'][deviceType.Signal] = {
|
||||
nameShow: true, // 信号机名称显示
|
||||
linkageAutoRouteShow: true, // 联锁自动进路表示灯显示
|
||||
atsAutoTriggerShow: true, // ATS自动触发表示灯显示
|
||||
aliasCodes: [] // 信号机别名列表
|
||||
atsAutoTriggerShow: true // ATS自动触发表示灯显示
|
||||
};
|
||||
this['private'][deviceType.Train] = {
|
||||
};
|
||||
|
@ -225,6 +225,7 @@ import { deepAssign } from '@/utils/index';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import { TrainingMode, MouseEvent } from '@/scripts/ConstDic';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import * as adapter from '@/jmapNew/utils/adapter';
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import BanIcon from '@/assets/ban-heb.png';
|
||||
|
||||
@ -316,6 +317,12 @@ export default {
|
||||
commandId() {
|
||||
return OperationEvent.Command.commandHaerbin.confirm.domId;
|
||||
},
|
||||
mapDevice() {
|
||||
return this.$store.state.map.mapDevice;
|
||||
},
|
||||
actualSelected() {
|
||||
return adapter.adapterAsDevice(this.selected, this.mapDevice);
|
||||
},
|
||||
setDetainTrainId() {
|
||||
return OperationEvent.StationStand.setDetainTrain.menuButton.domId;
|
||||
},
|
||||
@ -332,7 +339,7 @@ export default {
|
||||
return OperationEvent.Command.commandHaerbin.confrimCr2.domId;
|
||||
},
|
||||
stationContorl() {
|
||||
return this.getStationControl(this.selectedObj || {}) || this.getStationControl({_type: 'Station', code: this.$store.state.map.showCentralizedStationCode}) || {};
|
||||
return this.getStationControl(this.selected || {}) || this.getStationControl({_type: 'Station', code: this.$store.state.map.showCentralizedStationCode}) || {};
|
||||
},
|
||||
isLocal() {
|
||||
return this.$store.state.training.prdType == '01';
|
||||
@ -357,7 +364,7 @@ export default {
|
||||
'selected': function (val) {
|
||||
EventBus.$emit('sendMsg', {}); // 清空执行栏
|
||||
this.initMenus();// 初始化菜单数据
|
||||
this.selectedObj = this.selected;
|
||||
this.selectedObj = this.actualSelected;
|
||||
this.rightClickDialogVisible = false;
|
||||
if (this.selectedObj._type && (val._event == MouseEvent.Left || (val._event == MouseEvent.Right && this.$store.state.training.prdType === '01'))) {
|
||||
const type = this.State2SimulationMap[this.$store.state.training.prdType];
|
||||
|
41
src/jmapNew/utils/adapter.js
Normal file
41
src/jmapNew/utils/adapter.js
Normal file
@ -0,0 +1,41 @@
|
||||
import deviceType from '../constant/deviceType';
|
||||
|
||||
// 默认策略
|
||||
function executeStrategy(strategy, value) { return strategy? strategy(): value };
|
||||
|
||||
// 适配转换虚拟设备为正式设备
|
||||
export function adapterAsDevice(device, mapDevice) {
|
||||
if (!device) return device;
|
||||
const strategyMap = {
|
||||
[deviceType.Signal]: _ => {
|
||||
return device.type == 'TRANSMISSION'? mapDevice[device.linkSignalCode]: device;
|
||||
}
|
||||
}
|
||||
|
||||
return executeStrategy(strategyMap[device._type], device);
|
||||
}
|
||||
|
||||
// 获取当前可显示适配设备
|
||||
export function adapterByDevice(device, mapDevice) {
|
||||
if (!device) return device;
|
||||
|
||||
const strategyMap = {
|
||||
[deviceType.Signal]: _ => {
|
||||
if (device.aliasCodes) {
|
||||
for(var code of device.aliasCodes) {
|
||||
let it = mapDevice[code];
|
||||
if (it &&
|
||||
it.type == 'TRANSMISSION' &&
|
||||
it.instance &&
|
||||
it.instance.isShowShape) {
|
||||
console.log(it.instance);
|
||||
return it;
|
||||
}
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
}
|
||||
|
||||
return executeStrategy(strategyMap[device._type], device);
|
||||
}
|
@ -284,14 +284,14 @@ export function parser(data, skinCode, showConfig) {
|
||||
});
|
||||
|
||||
// 二次处理
|
||||
// zrUtil.each(data.stationStandList || [], elem => {
|
||||
// const device = mapDevice[elem.code];
|
||||
// if (device.aliasCodes) {
|
||||
// // 信号机别名列表
|
||||
// device
|
||||
// }
|
||||
// mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert, showConfig);
|
||||
// }, this);
|
||||
zrUtil.each(data.signalList || [], elem => {
|
||||
const actual = mapDevice[elem.linkSignalCode];
|
||||
if (actual && elem.type == 'TRANSMISSION') {
|
||||
// 信号机别名列表
|
||||
if (!actual.aliasCodes) { actual.aliasCodes = []; }
|
||||
actual.aliasCodes.push(elem.code);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
return mapDevice;
|
||||
|
@ -37,8 +37,7 @@ class Handler {
|
||||
const basicInfo = store.getters['training/basicInfo'];
|
||||
if (basicInfo.id && valid) {
|
||||
const group = router.currentRoute.query.group;
|
||||
const order = this.getOrder();
|
||||
sendTrainingNextStepNew(basicInfo.id, {...operation, order}, group).then(res=>{
|
||||
sendTrainingNextStepNew(basicInfo.id, operation, group).then(res=>{
|
||||
if (!valid) {
|
||||
this.pop();
|
||||
} else if (operation.cancel === true) {
|
||||
|
@ -71,12 +71,14 @@ class MenuContextHandler {
|
||||
if (type) {
|
||||
menu = [...menuList[type]];
|
||||
}
|
||||
// 特殊处理站台的右键操作( 因为小站台不允许有操作 )
|
||||
|
||||
// 特殊处理站台的右键操作( 因为小站台不允许有操作 )
|
||||
if (selected._type == 'StationStand') {
|
||||
if (selected.small) {
|
||||
menu = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (menu.constructor === Array) {
|
||||
menu.forEach(elem => {
|
||||
if (elem.children && elem.children.length > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user