UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

46 lines (45 loc) 1.59 kB
import { isObjectAccessor } from "./ObjectAccessor.js"; import { IfcRootObjectAccessor } from "./IfcRootObjectAccessor.js"; import { StringValue } from "../value/StringValue.js"; import { isPresent } from "../util/IfcExpressionUtils.js"; export class IfcElementAccessor extends IfcRootObjectAccessor { getNestedObjectAccessor(name) { if (name === "type") { return this.getIfcTypeObjectAccessor(); } let val = this.getIfcPropertySetAccessor(name); if (isPresent(val)) { return val; } return this.getIfcPropertyAccessor(name); } getAttribute(name) { switch (name) { case "ifcClass": return new StringValue(this.getIfcClass()); default: return super.getAttribute(name); } } listNestedObjects() { return [ "type", ...this.listIfcPropertyNames(), ...this.listIfcPropertySetNames(), ]; } listAttributes() { return ["ifcClass", ...super.listAttributes()]; } } export function isIfcElementAccessor(arg) { return (typeof arg.getGuid === "function" && typeof arg.getName === "function" && typeof arg.getDescription === "function" && typeof arg.getIfcClass === "function" && typeof arg.getIfcPropertySetAccessor === "function" && typeof arg.getIfcPropertyAccessor === "function" && typeof arg.getIfcTypeObjectAccessor === "function" && isObjectAccessor(arg)); } //# sourceMappingURL=IfcElementAccessor.js.map