UNPKG

gs-json

Version:

gs-JSON is a domain agnostic unifying 3D file format for geometric and semantic modelling (hence the 'gs').

31 lines 1.07 kB
import { Polyline } from "./entity_obj_polyline"; import { Circle } from "./entity_obj_circle"; import { Ellipse } from "./entity_obj_ellipse"; import { Polymesh } from "./entity_obj_polymesh"; import { Plane } from "./entity_obj_plane"; import { Ray } from "./entity_obj_ray"; /** * A function to cast obj class to subclass. * @param * @return */ export function _castToObjType(_kernel, id) { const obj_type = _kernel.objGetType(id); switch (obj_type) { case 1 /* ray */: return new Ray(_kernel, id); case 2 /* plane */: return new Plane(_kernel, id); case 3 /* circle */: return new Circle(_kernel, id); case 4 /* ellipse */: return new Ellipse(_kernel, id); case 100 /* polyline */: return new Polyline(_kernel, id); case 200 /* polymesh */: return new Polymesh(_kernel, id); default: throw new Error("Object type does not exist."); } } //# sourceMappingURL=entity_obj_cast.js.map