@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.
210 lines • 7.48 kB
JavaScript
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 AcDb2dVertexType;
(function (AcDb2dVertexType) {
/**
* A standard vertex within a 2D polyline.
*/
AcDb2dVertexType[AcDb2dVertexType["Vertex"] = 0] = "Vertex";
/**
* A vertex that was automatically generated as the result of a curve-fit operation.
* This type of vertex can go away or change automatically during subsequent editing
* operations on the polyline.
*/
AcDb2dVertexType[AcDb2dVertexType["CurveFitVertex"] = 1] = "CurveFitVertex";
/**
* A vertex that was automatically generated as the result of a spline-fit operation.
* This type of vertex can go away or change automatically during subsequent editing
* operations on the polyline.
*/
AcDb2dVertexType[AcDb2dVertexType["SplineFitVertex"] = 8] = "SplineFitVertex";
/**
* A control point for a spline or curve-fit polyline.
*/
AcDb2dVertexType[AcDb2dVertexType["SplineCtlVertex"] = 9] = "SplineCtlVertex";
})(AcDb2dVertexType || (AcDb2dVertexType = {}));
/**
* Represents the vertices in 2D polylines.
*/
var AcDb2dVertex = /** @class */ (function (_super) {
__extends(AcDb2dVertex, _super);
/**
* Creates a new 2d vertex entity.
*/
function AcDb2dVertex() {
var _this = _super.call(this) || this;
_this._position = new AcGePoint3d();
_this._bulge = 0;
_this._startWidth = 0;
_this._endWidth = 0;
_this._vertexType = AcDb2dVertexType.Vertex;
return _this;
}
Object.defineProperty(AcDb2dVertex.prototype, "position", {
/**
* Gets the position value of the vertex. The position point value must be in OCS coordinates
* (the OCS of the polyline containing the vertex), not WCS. The Z coordinate is kept in the
* owning AcDb2dPolyline only for historical purposes.
*
* @returns The position value of the vertex
*/
get: function () {
return this._position;
},
/**
* Sets the position value of the vertex. The position point value must be in OCS coordinates
* (the OCS of the polyline containing the vertex), not WCS. The Z coordinate is kept in the
* owning AcDb2dPolyline only for historical purposes.
*
* @param value - The position value of the vertex
*/
set: function (value) {
this._position.copy(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDb2dVertex.prototype, "bulge", {
/**
* Gets the vertex's bulge value.
*
* @returns The vertex's bulge value
*/
get: function () {
return this._bulge;
},
/**
* Sets the vertex's bulge value.
*
* @param value - The vertex's bulge value
*/
set: function (value) {
this._bulge = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDb2dVertex.prototype, "startWidth", {
/**
* Gets the start width for the vertex. The start width is used as the width at this vertex
* for the polyline segment from this vertex to the next vertex.
*
* @returns The start width for the vertex
*/
get: function () {
return this._startWidth;
},
/**
* Sets the start width for the vertex. The start width is used as the width at this vertex
* for the polyline segment from this vertex to the next vertex.
*
* @param value - The start width for the vertex
*/
set: function (value) {
this._startWidth = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDb2dVertex.prototype, "endWidth", {
/**
* Gets the end width for the vertex. The end width is used as the width at the end of the
* polyline segment from this vertex to the next vertex.
*
* @returns The end width for the vertex
*/
get: function () {
return this._endWidth;
},
/**
* Sets the end width for the vertex. The end width is used as the width at the end of the
* polyline segment from this vertex to the next vertex.
*
* @param value - The end width for the vertex
*/
set: function (value) {
this._endWidth = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AcDb2dVertex.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(AcDb2dVertex.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)
*/
AcDb2dVertex.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
*/
AcDb2dVertex.prototype.transformBy = function (matrix) {
this._position.applyMatrix4(matrix);
return this;
};
/**
* Draws nothing because it will be drawn by its parent 2d polyline.
*
* @param renderer - The renderer to use for drawing
* @returns undefined
*/
AcDb2dVertex.prototype.draw = function (_renderer) {
return undefined;
};
/** The entity type name */
AcDb2dVertex.typeName = '2dVertex';
return AcDb2dVertex;
}(AcDbEntity));
export { AcDb2dVertex };
//# sourceMappingURL=AcDb2dVertex.js.map