rt-sim-training-client/src/jmapNew/shape/factory.js
2020-08-20 13:17:58 +08:00

91 lines
3.6 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 AxleReset from './AxleReset/index';
import GuideLock from './GuideLock/index';
import AutoTurnBack from './AutoTurnBack/index.js';
import OutFrame from './OutFrame/index.js';
import CheckBox from './checkBox/checkBox.js';
import AutomaticRoute from './AutomacticRoute/index.js';
import SaidLamp from './SaidLamp/index.js';
import SplitStation from './SplitStation/index';
import Arrow from './Arrow/index';
import Power from './Power/index';
import StationTurnBack from './StationTurnBack/index';
import OverAp from './OverAp/index.js';
import FloodGate from './FloodGate/index';
/** 图库*/
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.AutoTurnBack] = AutoTurnBack;
mapShape[deviceType.OutFrame] = OutFrame;
mapShape[deviceType.AxleReset] = AxleReset;
mapShape[deviceType.GuideLock] = GuideLock;
mapShape[deviceType.CheckBox] = CheckBox;
mapShape[deviceType.AutomaticRoute] = AutomaticRoute;
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;
mapShape[deviceType.ZcCommunication] = SaidLamp;
mapShape[deviceType.ControlSwitch] = SaidLamp;
mapShape[deviceType.LampFilament] = SaidLamp;
mapShape[deviceType.ModeStatusGroup] = SaidLamp;
mapShape[deviceType.FaultStatusGroup] = SaidLamp;
mapShape[deviceType.ReturnModeGroup] = SaidLamp;
mapShape[deviceType.Axle] = SaidLamp;
mapShape[deviceType.SwitchFault] = SaidLamp;
mapShape[deviceType.SplitStation] = SplitStation;
mapShape[deviceType.Arrow] = Arrow;
mapShape[deviceType.Power] = Power;
mapShape[deviceType.StationTurnBack] = StationTurnBack;
mapShape[deviceType.OverAp] = OverAp;
mapShape[deviceType.FloodGate] = FloodGate;
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;