Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
7cac00b163
@ -284,5 +284,5 @@ deviceRender[deviceType.SignalButton] = {
|
||||
deviceRender[deviceType.IndicatorLight] = {
|
||||
_type: deviceType.IndicatorLight,
|
||||
zlevel: 1
|
||||
}
|
||||
};
|
||||
export default deviceRender;
|
||||
|
17
src/jmapNew/constant/systemGraphRender.js
Normal file
17
src/jmapNew/constant/systemGraphRender.js
Normal file
@ -0,0 +1,17 @@
|
||||
import systemGraphType from './systemGraphType';
|
||||
|
||||
const systemGraphRender = {};
|
||||
|
||||
/** Line渲染配置*/
|
||||
systemGraphRender[systemGraphType.Line] = {
|
||||
_type: systemGraphType.Line,
|
||||
zlevel: 1
|
||||
};
|
||||
|
||||
/** Text渲染配置*/
|
||||
systemGraphRender[systemGraphType.Text] = {
|
||||
_type: systemGraphType.Text,
|
||||
zlevel: 1
|
||||
};
|
||||
|
||||
export default systemGraphRender;
|
6
src/jmapNew/constant/systemGraphType.js
Normal file
6
src/jmapNew/constant/systemGraphType.js
Normal file
@ -0,0 +1,6 @@
|
||||
const systemGraphType = {
|
||||
Line: 'Line',
|
||||
Text: 'Text'
|
||||
};
|
||||
|
||||
export default systemGraphType;
|
@ -1,9 +1,10 @@
|
||||
import * as zrUtil from 'zrender/src/core/util';
|
||||
import * as vector from 'zrender/src/core/vector';
|
||||
// import * as vector from 'zrender/src/core/vector';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import deviceType from './constant/deviceType';
|
||||
import transitionDeviceStatus from './constant/stateTransition';
|
||||
import shapefactory from './shape/factory';
|
||||
// import shapefactory from './shape/factory';
|
||||
import Graphic from './shape';
|
||||
import TransformHandle from './transformHandle';
|
||||
import TransformHandleScreen from './transformHandleScreen';
|
||||
import deviceRender from './constant/deviceRender';
|
||||
@ -46,6 +47,13 @@ class Painter {
|
||||
});
|
||||
}
|
||||
|
||||
newGraph(device) {
|
||||
const type = device._type;
|
||||
// const state = this.$map.getState(); // 获取 默认状态
|
||||
const builder = Graphic.getBuilder(type); // 根据 type 绘制 面板,资源,画面对应的 instance
|
||||
return builder(device, this.$jmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重绘视图
|
||||
* @param {*} mapDevice
|
||||
@ -66,7 +74,8 @@ class Painter {
|
||||
*/
|
||||
add(device) {
|
||||
try {
|
||||
const instance = shapefactory(device, this.$jmap);
|
||||
// const instance = shapefactory(device, this.$jmap);
|
||||
const instance = this.newGraph(device);
|
||||
if (instance) {
|
||||
device.instance = instance;
|
||||
this.$transformHandle.transformView(instance);
|
||||
|
16
src/jmapNew/parser/index.js
Normal file
16
src/jmapNew/parser/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
import * as parserGraph from './parser-graph.js';
|
||||
import * as parserSystemGraph from './parser-systemGraph.js';
|
||||
|
||||
export const ParserType = {
|
||||
Graph: { name: '绘图', value: 'Graph' },
|
||||
systemGraph: { name: '系统绘图', value: 'systemGraph' }
|
||||
};
|
||||
|
||||
export function parserFactory(type) {
|
||||
switch (type) {
|
||||
case ParserType.Graph.value : return parserGraph;
|
||||
case ParserType.systemGraph.value: return parserSystemGraph;
|
||||
}
|
||||
|
||||
return parserGraph;
|
||||
}
|
357
src/jmapNew/parser/parser-graph.js
Normal file
357
src/jmapNew/parser/parser-graph.js
Normal file
@ -0,0 +1,357 @@
|
||||
import * as zrUtil from 'zrender/src/core/util';
|
||||
import deviceType from '../constant/deviceType';
|
||||
import deviceRender from '../constant/deviceRender';
|
||||
import Vue from 'vue';
|
||||
import { deepClone } from '@/utils/index';
|
||||
|
||||
export function deviceFactory(type, elem, showConfig) {
|
||||
return {...deviceRender[type], ...elem, ...showConfig};
|
||||
}
|
||||
|
||||
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, showConfig) {
|
||||
var mapDevice = {};
|
||||
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
|
||||
if (data) {
|
||||
zrUtil.each(data.stationList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Station, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.sectionList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Section, elem, propConvert, showConfig);
|
||||
elem = propConvert.initPrivateProps(elem);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.sectionList || [], elem => {
|
||||
if (elem.type == '02' || elem.type == '03') {
|
||||
mapDevice[elem.code].parentName = mapDevice[elem.parentCode] ? mapDevice[elem.parentCode].name : '';
|
||||
} else if (elem.type == '01' && (elem.standTrack || elem.reentryTrack) && elem.belongStation) {
|
||||
if (mapDevice[elem.belongStation]) {
|
||||
mapDevice[elem.belongStation].sectionCode = elem.code;
|
||||
} else {
|
||||
elem.belongStation = '';
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.signalList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Signal, elem, propConvert, showConfig);
|
||||
elem = propConvert.initPrivateProps(elem);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.stationStandList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.StationStand, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.stationControlList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.StationControl, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.counterList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.StationCounter, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.delayShowList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.StationDelayUnlock, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.lineList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.espList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Esp, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
// psd在stand后处理 -便于在stand上挂载关系
|
||||
zrUtil.each(data.psdList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Psd, elem, propConvert, showConfig);
|
||||
mapDevice[elem.standCode].psdCode = elem.code;
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.textList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.zcList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.ZcControl, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.lcList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.LcControl, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.tempSpeedLimitList || [], elem => { // 全线临时限速列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.LimitControl, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.resourceList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Resource, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.trainList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.Line || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Line, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.Text || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Text, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.cycleButtonList || [], elem => { // 自动折返列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.AutoTurnBack, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.axleCounterResetButtonList || [], elem => { // 计轴复位列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.AxleReset, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.totalGuideLockButtonVOList || [], elem => { // 引导总锁列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.GuideLock, elem, propConvert, showConfig);
|
||||
mapDevice[elem.stationCode].guideLockCode = elem.code; // 保证处理车站列表在处理引导总锁列表之前
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.automaticRouteButtonList || [], elem => { // 自动进路列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.AutomaticRoute, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.outerFrameList || [], elem => { // 矩形框列表
|
||||
mapDevice[elem.code] = createDevice(deviceType.OutFrame, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
zrUtil.each(data.splitStationList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.SplitStation, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.tbStrategyList || [], elem => { // 站后折返按钮
|
||||
mapDevice[elem.code] = createDevice(deviceType.StationTurnBack, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
zrUtil.each(data.arrowList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Arrow, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
zrUtil.each(data.powerLineList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Power, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
zrUtil.each(data.switchList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Switch, elem, propConvert, showConfig);
|
||||
elem = propConvert.initPrivateProps(elem);
|
||||
const cnodeSection = mapDevice[mapDevice[elem.code].sectionACode];
|
||||
const lnodeSection = mapDevice[mapDevice[elem.code].sectionBCode];
|
||||
const rnodeSection = mapDevice[mapDevice[elem.code].sectionCCode];
|
||||
|
||||
if (cnodeSection && lnodeSection && rnodeSection) {
|
||||
cnodeSection['switch'] = lnodeSection['switch'] = rnodeSection['switch'] = mapDevice[elem.code];
|
||||
const sectionParent = mapDevice[cnodeSection.parentCode];
|
||||
if (sectionParent) {
|
||||
sectionParent['switch'] = mapDevice[elem.code];
|
||||
}
|
||||
let sectionCStar, sectionCEnd;
|
||||
if (handleResetPoint(rnodeSection.points)) {
|
||||
sectionCStar = rnodeSection.points[rnodeSection.points.length - 2];
|
||||
sectionCEnd = rnodeSection.points[1];
|
||||
} else {
|
||||
sectionCStar = rnodeSection.points[1];
|
||||
sectionCEnd = rnodeSection.points[rnodeSection.points.length - 2];
|
||||
}
|
||||
let intersectionStar, intersectionEnd;
|
||||
if (handleResetPoint(cnodeSection.points)) {
|
||||
intersectionStar = cnodeSection.points[0];
|
||||
intersectionEnd = cnodeSection.points[cnodeSection.points.length - 1];
|
||||
} else {
|
||||
intersectionStar = cnodeSection.points[cnodeSection.points.length - 1];
|
||||
intersectionEnd = cnodeSection.points[0];
|
||||
}
|
||||
if (cnodeSection.points[0].x == lnodeSection.points[lnodeSection.points.length - 1].x && cnodeSection.points[0].y == lnodeSection.points[lnodeSection.points.length - 1].y) {
|
||||
mapDevice[elem.code].intersection = {
|
||||
x: intersectionStar.x,
|
||||
y: intersectionStar.y
|
||||
// x: cnodeSection.points[0].x,
|
||||
// y: cnodeSection.points[0].y
|
||||
};
|
||||
mapDevice[elem.code].skew = {
|
||||
x: sectionCStar.x,
|
||||
y: sectionCStar.y
|
||||
// x: rnodeSection.points[rnodeSection.points.length - 2].x,
|
||||
// y: rnodeSection.points[rnodeSection.points.length - 2].y
|
||||
};
|
||||
} else if (cnodeSection.points[cnodeSection.points.length - 1].x == lnodeSection.points[0].x && cnodeSection.points[cnodeSection.points.length - 1].y == lnodeSection.points[0].y) {
|
||||
mapDevice[elem.code].intersection = {
|
||||
x: intersectionEnd.x,
|
||||
y: intersectionEnd.y
|
||||
// x: cnodeSection.points[cnodeSection.points.length - 1].x,
|
||||
// y: cnodeSection.points[cnodeSection.points.length - 1].y
|
||||
};
|
||||
mapDevice[elem.code].skew = {
|
||||
x: sectionCEnd.x,
|
||||
y: sectionCEnd.y
|
||||
// x: rnodeSection.points[1].x,
|
||||
// y: rnodeSection.points[1].y
|
||||
};
|
||||
}
|
||||
|
||||
const section = mapDevice[cnodeSection.parentCode];
|
||||
if (section) {
|
||||
mapDevice[elem.code].sectionName = section.name;
|
||||
mapDevice[elem.code].sectionParentCode = section.code;
|
||||
section['relSwitchCode'] = elem.code;
|
||||
}
|
||||
|
||||
rnodeSection['layer'] = -1;
|
||||
}
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.indicatorLightList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(elem.type, elem, propConvert, showConfig);
|
||||
if (elem.type == 'SwitchFault' && mapDevice[elem.switchCode]) {
|
||||
mapDevice[elem.switchCode]['switchFaultCode'] = elem.code; // 道岔数据上关联道岔故障表示灯(需保证该数据在switchList之后处理)
|
||||
}
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.trainWindowList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.TrainWindow, elem, propConvert, showConfig);
|
||||
if (elem.sectionCode) {
|
||||
const section = mapDevice[elem.sectionCode];
|
||||
if (section) {
|
||||
section['trainWindowCode'] = elem.code;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.floodGateList || [], elem=> {
|
||||
mapDevice[elem.code] = createDevice(deviceType.FloodGate, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.directionRodList || [], elem=> {
|
||||
mapDevice[elem.code] = createDevice(deviceType.DirectionRod, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.responderList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.Responder, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.signalApproachSectionList || [], elem => {
|
||||
zrUtil.each(elem.sectionPathList || [], item => {
|
||||
zrUtil.each(item.sectionList || [], section => {
|
||||
if (mapDevice[section] && mapDevice[section].parentCode) {
|
||||
(mapDevice[mapDevice[section].parentCode] || {}).approach = true;
|
||||
} else if (mapDevice[section]) {
|
||||
mapDevice[section].approach = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
zrUtil.each(data.overlapList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(deviceType.OverAp, elem, propConvert, showConfig);
|
||||
});
|
||||
|
||||
// 二次处理
|
||||
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);
|
||||
|
||||
zrUtil.each(data.signalButtonList || [], elem=> {
|
||||
mapDevice[elem.code] = createDevice(deviceType.SignalButton, elem, propConvert, showConfig);
|
||||
if (elem.signalCode) {
|
||||
const signal = mapDevice[elem.signalCode];
|
||||
if (signal.signalButtonList) {
|
||||
signal.signalButtonList.push(elem.code);
|
||||
} else { signal.signalButtonList = [elem.code]; }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mapDevice;
|
||||
}
|
||||
|
||||
// 重置坐标点
|
||||
function handleResetPoint(points) {
|
||||
return (points[points.length - 1].x >= points[0].x);
|
||||
}
|
||||
|
||||
// 同步绘制数据到原始数据
|
||||
export function updateForList(model, state, lstName) {
|
||||
const list = state.map[lstName];
|
||||
if (list && list instanceof Array) {
|
||||
const i = list.findIndex(elem => elem.code == model.code );
|
||||
if (i < 0) {
|
||||
list.push(deepClone(model)); // 新增
|
||||
} else {
|
||||
if (model._dispose) {
|
||||
list.splice(i, 1);
|
||||
} else {
|
||||
list.splice(i, 1, deepClone(model));
|
||||
}
|
||||
}
|
||||
state.map[lstName] = [...list];
|
||||
} else {
|
||||
state.map[lstName] = [model];
|
||||
}
|
||||
}
|
||||
|
||||
export function updateMapData(state, model) {
|
||||
if (state.map && model) {
|
||||
switch (model._type) {
|
||||
case deviceType.Section: updateForList(model, state, 'sectionList'); break;
|
||||
case deviceType.Switch: updateForList(model, state, 'switchList'); break;
|
||||
case deviceType.Signal: updateForList(model, state, 'signalList'); break;
|
||||
case deviceType.Station: updateForList(model, state, 'stationList'); break;
|
||||
case deviceType.StationStand: updateForList(model, state, 'stationStandList'); break;
|
||||
case deviceType.StationControl: updateForList(model, state, 'stationControlList'); break;
|
||||
case deviceType.StationCounter: updateForList(model, state, 'stationCounterList'); break;
|
||||
case deviceType.ZcControl: updateForList(model, state, 'zcList'); break;
|
||||
case deviceType.StationDelayUnlock:updateForList(model, state, 'stationDelayUnlockList'); break;
|
||||
case deviceType.LcControl: updateForList(model, state, 'lcList'); break;
|
||||
case deviceType.LimitControl: updateForList(model, state, 'tempSpeedLimitList'); break;
|
||||
case deviceType.Resource: updateForList(model, state, 'resourceList'); break;
|
||||
case deviceType.Train: updateForList(model, state, 'trainList'); break;
|
||||
case deviceType.TrainWindow: updateForList(model, state, 'trainWindowList'); break;
|
||||
case deviceType.Line: updateForList(model, state, 'lineList'); break;
|
||||
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.AutoTurnBack: updateForList(model, state, 'cycleButtonList'); break;
|
||||
case deviceType.AxleReset: updateForList(model, state, 'axleCounterResetButtonList'); break;
|
||||
case deviceType.GuideLock: updateForList(model, state, 'totalGuideLockButtonVOList'); break;
|
||||
case deviceType.OutFrame: updateForList(model, state, 'outerFrameList'); break;
|
||||
case deviceType.AutomaticRoute: updateForList(model, state, 'automaticRouteButtonList'); break;
|
||||
case deviceType.AtsControl: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.CenterCommunication: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.ChainControl: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.IntersiteControl: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.LeuControl: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.LocalControl: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.Maintain: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.PowerSupply: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.NoOneReturn: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.MaintenanceLamps: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.ZcCommunication: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.FaultStatusGroup: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.ModeStatusGroup: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.LampFilament: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.ReturnModeGroup: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.ControlSwitch: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.Axle: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.SwitchFault: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.IndicatorLight: updateForList(model, state, 'indicatorLightList'); break;
|
||||
case deviceType.SplitStation: updateForList(model, state, 'splitStationList'); break;
|
||||
case deviceType.Arrow: updateForList(model, state, 'arrowList'); break;
|
||||
case deviceType.Power: updateForList(model, state, 'powerLineList'); break;
|
||||
case deviceType.StationTurnBack : updateForList(model, state, 'tbStrategyList'); break;
|
||||
case deviceType.FloodGate: updateForList(model, state, 'floodGateList'); break;
|
||||
case deviceType.DirectionRod: updateForList(model, state, 'directionRodList'); break;
|
||||
case deviceType.Responder: updateForList(model, state, 'responderList'); break;
|
||||
case deviceType.SignalButton: updateForList(model, state, 'signalButtonList'); break;
|
||||
}
|
||||
}
|
||||
}
|
60
src/jmapNew/parser/parser-systemGraph.js
Normal file
60
src/jmapNew/parser/parser-systemGraph.js
Normal file
@ -0,0 +1,60 @@
|
||||
import * as zrUtil from 'zrender/src/core/util';
|
||||
import systemGraphType from '../constant/systemGraphType';
|
||||
import systemGraphRender from '../constant/systemGraphRender';
|
||||
import Vue from 'vue';
|
||||
import { deepClone } from '@/utils/index';
|
||||
|
||||
export function deviceFactory(type, elem, showConfig) {
|
||||
return {...systemGraphRender[type], ...elem, ...showConfig};
|
||||
}
|
||||
|
||||
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, showConfig) {
|
||||
var mapDevice = {};
|
||||
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
|
||||
if (data) {
|
||||
zrUtil.each(data.lineList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(systemGraphType.Line, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
zrUtil.each(data.textList || [], elem => {
|
||||
mapDevice[elem.code] = createDevice(systemGraphType.Text, elem, propConvert, showConfig);
|
||||
}, this);
|
||||
|
||||
}
|
||||
|
||||
return mapDevice;
|
||||
}
|
||||
|
||||
// 同步绘制数据到原始数据
|
||||
export function updateForList(model, state, lstName) {
|
||||
const list = state.map[lstName];
|
||||
if (list && list instanceof Array) {
|
||||
const i = list.findIndex(elem => elem.code == model.code );
|
||||
if (i < 0) {
|
||||
list.push(deepClone(model)); // 新增
|
||||
} else {
|
||||
if (model._dispose) {
|
||||
list.splice(i, 1);
|
||||
} else {
|
||||
list.splice(i, 1, deepClone(model));
|
||||
}
|
||||
}
|
||||
state.map[lstName] = [...list];
|
||||
} else {
|
||||
state.map[lstName] = [model];
|
||||
}
|
||||
}
|
||||
|
||||
export function updateMapData(state, model) {
|
||||
if (state.map && model) {
|
||||
switch (model._type) {
|
||||
case systemGraphType.Line: updateForList(model, state, 'lineList'); break;
|
||||
case systemGraphType.Text: updateForList(model, state, 'textList'); break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
import ESeparator from './ESeparator';
|
||||
|
||||
export default class Line2 extends Group {
|
@ -1,5 +1,5 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import createPathSvg from '../../constant/pathsvg';
|
||||
import createPathSvg from '../../../constant/pathsvg';
|
||||
|
||||
export default class EControlSwitch extends Group {
|
||||
constructor(model) {
|
@ -1,5 +1,5 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import createPathSvg from '../../constant/pathsvg';
|
||||
import createPathSvg from '../../../constant/pathsvg';
|
||||
|
||||
export default class ELampFilament extends Group {
|
||||
constructor(model) {
|
@ -1,5 +1,5 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import createPathSvg from '../../constant/pathsvg';
|
||||
import createPathSvg from '../../../constant/pathsvg';
|
||||
|
||||
export default class EUnmanned extends Group {
|
||||
constructor(model) {
|
@ -1,7 +1,7 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import EControl from '../element/EControl';
|
||||
import EMouse from './EMouse';
|
||||
import deviceType from '../../constant/deviceType';
|
||||
import deviceType from '../../../constant/deviceType';
|
||||
import ELampFilament from './ELampFilament';
|
||||
import EControlSwitch from './EControlSwitch';
|
||||
import EFoldbackMode from './EFoldbackMode';
|
@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
|
||||
import Line from 'zrender/src/graphic/shape/Line';
|
||||
import Circle from 'zrender/src/graphic/shape/Circle';
|
||||
import Isogon from 'zrender/src/graphic/shape/Isogon';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
|
||||
export default class EAxle extends Group {
|
||||
constructor(model) {
|
@ -1,7 +1,7 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import BezierCurve from 'zrender/src/graphic/shape/BezierCurve';
|
||||
import Line from 'zrender/src/graphic/shape/Line';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default class EBadShunt extends Group {
|
@ -1,7 +1,7 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import BezierCurve from 'zrender/src/graphic/shape/BezierCurve';
|
||||
import Line from 'zrender/src/graphic/shape/Line';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
import Vue from 'vue';
|
||||
|
||||
export default class ELimitLines extends Group {
|
@ -3,7 +3,7 @@ import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||
import Isogon from 'zrender/src/graphic/shape/Isogon';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import BezierCurve from 'zrender/src/graphic/shape/BezierCurve';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
import {segmentsIntr} from '@/utils/index';
|
||||
import store from '@/store/index';
|
||||
|
@ -3,7 +3,7 @@ import Text from 'zrender/src/graphic/Text';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import store from '@/store/index';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
class EMouse extends Group {
|
||||
constructor(device, code) {
|
||||
super();
|
@ -1,7 +1,7 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||
import Circle from 'zrender/src/graphic/shape/Circle';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
|
||||
/** 分隔符*/
|
||||
export default class ESeparator extends Group {
|
@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Stop_Route from '@/assets/stop_route.png';
|
||||
import Pattern from 'zrender/src/graphic/Pattern';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
|
||||
export default class EStopRouteImg extends Group {
|
||||
constructor(model) {
|
@ -1,6 +1,6 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import JTriangle from '../../utils/JTriangle';
|
||||
import JTriangle from '../../../utils/JTriangle';
|
||||
|
||||
class ETextName extends Group {
|
||||
constructor(model) {
|
@ -11,7 +11,7 @@ import EDerailer from './EDerailer'; // 脱轨器
|
||||
import EBackArrowGroup from './EBackArrow'; // 折返进路箭头
|
||||
import ELimitName from './ELimitName'; // 成都三号线 限速名称
|
||||
// import JTriangle from '../../utils/JTriangle';
|
||||
import { drawSectionStyle } from '../../config/defaultStyle';
|
||||
import { drawSectionStyle } from '../../../config/defaultStyle';
|
||||
import EStopRouteImg from './EStopRouteImg';
|
||||
import EBadShunt from './EBadShunt';
|
||||
|
@ -16,7 +16,7 @@ import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import Isogon from 'zrender/src/graphic/shape/Isogon';
|
||||
import deviceType from '../../constant/deviceType';
|
||||
import deviceType from '../../../constant/deviceType';
|
||||
import { findDeviceByModelDepType } from '../utils/ShapeDepFind';
|
||||
import store from '@/store/index';
|
||||
// import BoundingRect from 'zrender/src/core/BoundingRect';
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user