rt-sim-training-client/src/jmapNew/shape/factory.js
joylink_fanyuhong c9e8827c3a 合并代码
2020-03-05 16:43:53 +08:00

56 lines
2.1 KiB
JavaScript

import deviceType from '../constant/deviceType';
import Section from './Section/index.js';
import Signal from './Signal/index.js';
import Station from './Station/index.js';
import Resource from './Resource/index.js';
import LcControl from './LcControl/index.js';
import LimitControl from './LimitControl/index.js';
import Switch from './Switch/index.js';
import ZcControl from './ZcControl/index.js';
import StationCounter from './StationCounter/index.js';
import StationDelayUnlock from './StationDelayUnlock/index.js';
import StationStand from './StationStand/index.js';
import Psd from './Psd/index.js';
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 MapCycleButtonVO from './Automactic/index.js';
import OutFrame from './OutFrame/index.js';
import CheckBox from './checkBox/checkBox.js';
import AutomaticRoute from './AutomacticRoute/index.js';
/** 图库*/
const mapShape = {};
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
mapShape[deviceType.Station] = Station;
mapShape[deviceType.Resource] = Resource;
mapShape[deviceType.LcControl] = LcControl;
mapShape[deviceType.LimitControl] = LimitControl;
mapShape[deviceType.Switch] = Switch;
mapShape[deviceType.ZcControl] = ZcControl;
mapShape[deviceType.StationCounter] = StationCounter;
mapShape[deviceType.StationDelayUnlock] = StationDelayUnlock;
mapShape[deviceType.StationStand] = StationStand;
mapShape[deviceType.Psd] = Psd;
mapShape[deviceType.TrainWindow] = TrainWindow;
mapShape[deviceType.Train] = Train;
mapShape[deviceType.Line] = Line;
mapShape[deviceType.Text] = Text2;
mapShape[deviceType.MapCycleButtonVO] = MapCycleButtonVO;
mapShape[deviceType.OutFrame] = OutFrame;
mapShape[deviceType.CheckBox] = CheckBox;
mapShape[deviceType.AutomaticRoute] = AutomaticRoute;
function shapefactory(device, jmap) {
const type = device._type;
const shape = mapShape[type];
if (shape instanceof Function) {
// eslint-disable-next-line
return new shape(device, jmap.style);
}
}
export default shapefactory;