UNPKG

awv3

Version:
71 lines (55 loc) 1.42 kB
// Common methods of ccref and ccfuturef export default class Ccbaseref { get descendants() { return (function* descendants(ccref) { for (let child of ccref.children) yield* child.descendants; yield ccref; })(this); } get startPoint() { return this.getNamedChild('startPoint'); } get endPoint() { return this.getNamedChild('endPoint'); } get center() { return this.getNamedChild('center'); } get encompassing() { return this.isSubPoint() ? this.parent : this; } isDimension() { return this.class.endsWith('Dimension'); } isConstraint() { return this.class.endsWith('Constraint'); } isPoint() { return this.class === 'CC_Point'; } isStartPoint() { return this.pointType === 'start'; } isEndPoint() { return this.pointType === 'end'; } isCenterPoint() { return this.pointType === 'center'; } isSubPoint() { return this.isPoint() && (this.isStartPoint() || this.isEndPoint() || this.isCenterPoint()); } isLine() { return this.class === 'CC_Line'; } isArc() { return this.class === 'CC_Arc'; } isCircle() { return this.class === 'CC_Circle'; } isSketch() { return this.state.class === 'CC_Sketch'; } }