52 lines
1.9 KiB
JavaScript
52 lines
1.9 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 Automactic from './Automactic/index.js';
|
|
import CheckBox from './checkBox/checkBox.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.Automactic] = Automactic;
|
|
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;
|