UNPKG

awv3

Version:
71 lines (57 loc) 1.89 kB
import _createClass from "@babel/runtime/helpers/createClass"; import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; import Ccbaseref from './ccbaseref'; import { Member } from './command/lowlevel'; import { getClass } from './geomutils'; // Like a Ccref, but an object is not yet created, // we have a command (AST expression) that evaluates to it and geomParams var idCounter = 0; var Ccfuturef = /*#__PURE__*/ function (_Ccbaseref) { _inheritsLoose(Ccfuturef, _Ccbaseref); function Ccfuturef(command, geomParams, parent, pointType) { var _this; if (parent === void 0) { parent = undefined; } if (pointType === void 0) { pointType = undefined; } _this = _Ccbaseref.call(this) || this; _this.command = command; _this.geomParams = geomParams; _this.parent = parent || _assertThisInitialized(_this); _this.pointType = pointType ? pointType.replace('Point', '') : undefined; _this.id = --idCounter; return _this; } var _proto = Ccfuturef.prototype; _proto.getNamedChild = function getNamedChild(childName) { return new Ccfuturef(Member(this.command, childName), { start: this.geomParams[childName.replace('Point', '')] }, this, childName); }; _createClass(Ccfuturef, [{ key: "class", get: function get() { return getClass(this.geomParams); } }, { key: "children", get: function get() { switch (this.class) { case 'CC_Point': return []; case 'CC_Line': return [this.startPoint, this.endPoint]; case 'CC_Arc': return [this.startPoint, this.endPoint, this.center]; case 'CC_Circle': return [this.center]; } } }]); return Ccfuturef; }(Ccbaseref); export { Ccfuturef as default };