rt-sim-training-client/src/jmap/shape/factory.js
2019-07-16 09:44:31 +08:00

45 lines
1.5 KiB
JavaScript

import deviceType from '../config/deviceType';
import Link from './Link';
import Section from './Section';
import Signal from './Signal';
import Station from './Station';
import StationControl from './StationControl';
import ImageControl from './ImageControl';
import LcControl from './LcControl';
import LimitControl from './LimitControl';
import Switch from './Switch';
import ZcControl from './ZcControl';
import StationCounter from './StationCounter';
import StationDelayUnlock from './StationDelayUnlock';
import StationStand from './StationStand';
import TrainWindow from './TrainWindow';
import Train from './Train';
/** 图库*/
const mapShape = {};
mapShape[deviceType.Link] = Link;
mapShape[deviceType.Section] = Section;
mapShape[deviceType.Signal] = Signal;
mapShape[deviceType.Station] = Station;
mapShape[deviceType.StationControl] = StationControl;
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;
function shapefactory(type, device, jmap) {
const style = jmap.getStyleDict();
const shape = mapShape[type];
if (shape instanceof Function) {
return new shape(device, style[type], jmap);
}
}
export default shapefactory;