2019-03-24 18:58:32 -05:00
|
|
|
export {BodyView} from './body-view';
|
|
|
|
|
2019-03-22 11:25:20 -05:00
|
|
|
import {PolygonShape} from './polygon';
|
|
|
|
export {PolygonShape};
|
|
|
|
|
2019-04-12 23:51:40 -05:00
|
|
|
import {CircleShape} from './circle';
|
|
|
|
export {CircleShape};
|
|
|
|
|
2019-03-22 11:25:20 -05:00
|
|
|
import {RectangleShape} from './rectangle';
|
|
|
|
export {RectangleShape};
|
|
|
|
|
|
|
|
import {ShapeList} from './list';
|
|
|
|
export {ShapeList};
|
|
|
|
|
2019-03-28 02:39:04 -05:00
|
|
|
export {ShapeView} from './shape-view';
|
|
|
|
|
2019-03-22 11:25:20 -05:00
|
|
|
export function shapeFromJSON(json) {
|
|
|
|
let shape;
|
|
|
|
switch (json.type) {
|
2019-04-12 23:51:40 -05:00
|
|
|
case 'circle':
|
|
|
|
shape = new CircleShape();
|
|
|
|
break;
|
2019-03-22 11:25:20 -05:00
|
|
|
case 'list':
|
|
|
|
shape = new ShapeList();
|
|
|
|
break;
|
|
|
|
case 'polygon':
|
|
|
|
shape = new PolygonShape();
|
|
|
|
break;
|
|
|
|
case 'rectangle':
|
|
|
|
shape = new RectangleShape();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return shape.fromJSON(json);
|
|
|
|
}
|