rt-sim-training-client/src/jmapNew/shape/factory.js

71 lines
2.7 KiB
JavaScript
Raw Normal View History

2019-11-29 12:51:58 +08:00
import deviceType from '../constant/deviceType';
import Section from './Section/index.js';
import Signal from './Signal/index.js';
import Station from './Station/index.js';
2019-12-23 10:53:25 +08:00
import Resource from './Resource/index.js';
2019-11-29 12:51:58 +08:00
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';
2019-11-29 12:51:58 +08:00
import TrainWindow from './TrainWindow/index.js';
import Train from './Train/index.js';
import Line from './Line/index.js';
import Text2 from './Text/index.js';
2020-03-17 16:12:15 +08:00
import AxleReset from './AxleReset/index';
import GuideLock from './GuideLock/index';
import AutoTurnBack from './Automactic/index.js';
2020-03-05 15:48:51 +08:00
import OutFrame from './OutFrame/index.js';
2019-11-29 12:51:58 +08:00
import CheckBox from './checkBox/checkBox.js';
2020-03-05 16:39:49 +08:00
import AutomaticRoute from './AutomacticRoute/index.js';
2020-03-24 15:02:14 +08:00
import SaidLamp from './SaidLamp/index.js';
2019-11-29 12:51:58 +08:00
/** 图库*/
const mapShape = {};
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
mapShape[deviceType.Station] = Station;
2019-12-23 10:53:25 +08:00
mapShape[deviceType.Resource] = Resource;
2019-11-29 12:51:58 +08:00
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;
2019-11-29 12:51:58 +08:00
mapShape[deviceType.TrainWindow] = TrainWindow;
mapShape[deviceType.Train] = Train;
mapShape[deviceType.Line] = Line;
mapShape[deviceType.Text] = Text2;
mapShape[deviceType.AutoTurnBack] = AutoTurnBack;
2020-03-05 15:48:51 +08:00
mapShape[deviceType.OutFrame] = OutFrame;
2020-03-17 16:12:15 +08:00
mapShape[deviceType.AxleReset] = AxleReset;
mapShape[deviceType.GuideLock] = GuideLock;
2019-11-29 12:51:58 +08:00
mapShape[deviceType.CheckBox] = CheckBox;
2020-03-05 16:39:49 +08:00
mapShape[deviceType.AutomaticRoute] = AutomaticRoute;
2020-03-24 15:02:14 +08:00
mapShape[deviceType.AtsControl] = SaidLamp;
mapShape[deviceType.CenterCommunication] = SaidLamp;
mapShape[deviceType.ChainControl] = SaidLamp;
mapShape[deviceType.IntersiteControl] = SaidLamp;
mapShape[deviceType.LeuControl] = SaidLamp;
mapShape[deviceType.LocalControl] = SaidLamp;
mapShape[deviceType.Maintain] = SaidLamp;
mapShape[deviceType.PowerSupply] = SaidLamp;
mapShape[deviceType.NoOneReturn] = SaidLamp;
mapShape[deviceType.MaintenanceLamps] = SaidLamp;
2019-11-29 12:51:58 +08:00
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;