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'; /** 图库*/ 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; 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;