UNPKG

@mlightcad/data-model

Version:

The data-model package provides the core classes for interacting with AutoCAD's database and entities. This package mimics AutoCAD ObjectARX's AcDb (Database) classes and implements the drawing database structure that AutoCAD developers are familiar with.

133 lines 4.58 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { AcGeBox3d, AcGePoint3d } from '@mlightcad/geometry-engine'; import { AcDbEntity } from './AcDbEntity'; export var AcDb3dVertexType; (function (AcDb3dVertexType) { /** * A standard vertex within the polyface mesh. */ AcDb3dVertexType[AcDb3dVertexType["SimpleVertex"] = 0] = "SimpleVertex"; /** * A control point for a spline or curve-fit mesh. */ AcDb3dVertexType[AcDb3dVertexType["ControlVertex"] = 1] = "ControlVertex"; /** * A vertex that was automatically generated as the result of a spline or curve-fit operation. * This type of vertex can go away or change automatically during subsequent editing operations * on the mesh. */ AcDb3dVertexType[AcDb3dVertexType["FitVertex"] = 2] = "FitVertex"; })(AcDb3dVertexType || (AcDb3dVertexType = {})); /** * Represents the vertices within 3D polylines in AutoCAD. */ var AcDb3dVertex = /** @class */ (function (_super) { __extends(AcDb3dVertex, _super); /** * Creates a new 3d vertex entity. */ function AcDb3dVertex() { var _this = _super.call(this) || this; _this._position = new AcGePoint3d(); _this._vertexType = AcDb3dVertexType.SimpleVertex; return _this; } Object.defineProperty(AcDb3dVertex.prototype, "position", { /** * Gets the WCS point value of this vertex. * * @returns The WCS point value of this vertex. */ get: function () { return this._position; }, /** * Sets WCS point value of this vertex. * * @param value - The WCS point value of this vertex. */ set: function (value) { this._position.copy(value); }, enumerable: false, configurable: true }); Object.defineProperty(AcDb3dVertex.prototype, "vertexType", { /** * Gets the type of this vertex. * @returns The type of this vertex */ get: function () { return this._vertexType; }, /** * Sets the type of this vertex. * @param value - The type of this vertex */ set: function (value) { this._vertexType = value; }, enumerable: false, configurable: true }); Object.defineProperty(AcDb3dVertex.prototype, "geometricExtents", { /** * Gets the geometric extents (bounding box) of this vertex. * * @returns The bounding box that encompasses the entire vertex */ get: function () { return new AcGeBox3d().expandByPoint(this._position); }, enumerable: false, configurable: true }); /** * Gets the grip points for this vertex. * * @returns Array of grip points (center, start point, end point) */ AcDb3dVertex.prototype.subGetGripPoints = function () { var gripPoints = new Array(); gripPoints.push(this._position); return gripPoints; }; /** * Transforms this vertex by the specified matrix. * * @param matrix - The transformation matrix to apply * @returns This vertex after transformation */ AcDb3dVertex.prototype.transformBy = function (matrix) { this._position.applyMatrix4(matrix); return this; }; /** * Draws nothing because it will be drawn by its parent 3d polyline. * * @param renderer - The renderer to use for drawing * @returns undefined */ AcDb3dVertex.prototype.draw = function (_renderer) { return undefined; }; /** The entity type name */ AcDb3dVertex.typeName = '3dVertex'; return AcDb3dVertex; }(AcDbEntity)); export { AcDb3dVertex }; //# sourceMappingURL=AcDb3dVertex.js.map