awv3
Version:
⚡ AWV3 embedded CAD
155 lines (124 loc) • 3.89 kB
JavaScript
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _createClass from "@babel/runtime/helpers/createClass";
// Common methods of ccref and ccfuturef
var Ccbaseref =
/*#__PURE__*/
function () {
function Ccbaseref() {}
var _proto = Ccbaseref.prototype;
_proto.isDimension = function isDimension() {
return this.class.endsWith('Dimension');
};
_proto.isConstraint = function isConstraint() {
return this.class.endsWith('Constraint');
};
_proto.isContainer = function isContainer() {
return this.class === 'CC_Container';
};
_proto.isPoint = function isPoint() {
return this.class === 'CC_Point';
};
_proto.isStartPoint = function isStartPoint() {
return this.pointType === 'start';
};
_proto.isEndPoint = function isEndPoint() {
return this.pointType === 'end';
};
_proto.isCenterPoint = function isCenterPoint() {
return this.pointType === 'center';
};
_proto.isSubPoint = function isSubPoint() {
return this.isPoint() && (this.isStartPoint() || this.isEndPoint() || this.isCenterPoint());
};
_proto.isLine = function isLine() {
return this.class === 'CC_Line';
};
_proto.isArc = function isArc() {
return this.class === 'CC_Arc';
};
_proto.isCircle = function isCircle() {
return this.class === 'CC_Circle';
};
_proto.isCurve = function isCurve() {
return this.isLine() || this.isArc() || this.isCircle();
};
_proto.isSketch = function isSketch() {
return this.state.class === 'CC_Sketch';
};
_createClass(Ccbaseref, [{
key: "descendants",
get: function get() {
return (
/*#__PURE__*/
_regeneratorRuntime.mark(function descendants(ccref) {
var _iterator, _isArray, _i, _ref, _child;
return _regeneratorRuntime.wrap(function descendants$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_iterator = ccref.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();
case 1:
if (!_isArray) {
_context.next = 7;
break;
}
if (!(_i >= _iterator.length)) {
_context.next = 4;
break;
}
return _context.abrupt("break", 15);
case 4:
_ref = _iterator[_i++];
_context.next = 11;
break;
case 7:
_i = _iterator.next();
if (!_i.done) {
_context.next = 10;
break;
}
return _context.abrupt("break", 15);
case 10:
_ref = _i.value;
case 11:
_child = _ref;
return _context.delegateYield(_child.descendants, "t0", 13);
case 13:
_context.next = 1;
break;
case 15:
_context.next = 17;
return ccref;
case 17:
case "end":
return _context.stop();
}
}
}, descendants, this);
})(this)
);
}
}, {
key: "startPoint",
get: function get() {
return this.getNamedChild('startPoint');
}
}, {
key: "endPoint",
get: function get() {
return this.getNamedChild('endPoint');
}
}, {
key: "center",
get: function get() {
return this.getNamedChild('center');
}
}, {
key: "encompassing",
get: function get() {
return this.isSubPoint() ? this.parent : this;
}
}]);
return Ccbaseref;
}();
export { Ccbaseref as default };