gs-json
Version:
gs-JSON is a domain agnostic unifying 3D file format for geometric and semantic modelling (hence the 'gs').
44 lines (39 loc) • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports._castToAttribType = _castToAttribType;
exports._castToAttribTypes = _castToAttribTypes;
var _enums = require("./enums");
var _attrib_entattrib = require("./attrib_entattrib");
var _attrib_topoattrib = require("./attrib_topoattrib");
/**
* A function to cast obj class to subclass.
* @param
* @return
*/
function _castToAttribType(_kernel, geom_type, name) {
switch (geom_type) {
case _enums.EGeomType.points:
case _enums.EGeomType.objs:
return new _attrib_entattrib.EntAttrib(_kernel, name, geom_type);
default:
// topo attribs
return new _attrib_topoattrib.TopoAttrib(_kernel, name, geom_type);
}
}
function _castToAttribTypes(_kernel, geom_type, names) {
switch (geom_type) {
case _enums.EGeomType.points:
case _enums.EGeomType.objs:
return names.map(function (name) {
return new _attrib_entattrib.EntAttrib(_kernel, name, geom_type);
});
default:
// topo attribs
return names.map(function (name) {
return new _attrib_topoattrib.TopoAttrib(_kernel, name, geom_type);
});
}
}
//# sourceMappingURL=attrib_cast.js.map