48 lines
1.7 KiB
JavaScript
48 lines
1.7 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 ImageControl from './ImageControl/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 TrainWindow from './TrainWindow/index.js';
|
||
|
import Train from './Train/index.js';
|
||
|
import Line from './Line/index.js';
|
||
|
import Text2 from './Text/index.js';
|
||
|
import CheckBox from './checkBox/checkBox.js';
|
||
|
|
||
|
/** 图库*/
|
||
|
const mapShape = {};
|
||
|
mapShape[deviceType.Section] = Section;
|
||
|
mapShape[deviceType.Signal] = Signal;
|
||
|
mapShape[deviceType.Station] = Station;
|
||
|
mapShape[deviceType.ImageControl] = ImageControl;
|
||
|
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.TrainWindow] = TrainWindow;
|
||
|
mapShape[deviceType.Train] = Train;
|
||
|
mapShape[deviceType.Line] = Line;
|
||
|
mapShape[deviceType.Text] = Text2;
|
||
|
mapShape[deviceType.CheckBox] = CheckBox;
|
||
|
|
||
|
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;
|