23 lines
582 B
JavaScript
23 lines
582 B
JavaScript
import deviceType from '../config/deviceType';
|
|
import Link from './Link';
|
|
import Section from './Section';
|
|
import Signal from './Signal';
|
|
import Switch from './Switch';
|
|
|
|
/** 图库*/
|
|
const mapShape = {};
|
|
mapShape[deviceType.Link] = Link;
|
|
mapShape[deviceType.Section] = Section;
|
|
mapShape[deviceType.Signal] = Signal;
|
|
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;
|