@mlightcad/graphic-interface
Version:
The graphic-interface package provides the graphics interface for controlling how AutoCAD entities are displayed on screen. This package offers a simplified API compared to AutoCAD ObjectARX's AcGi classes, making it more developer-friendly while maintain
134 lines (133 loc) • 5.64 kB
JavaScript
import { AcGePoint3d as s, AcGeBox2d as h } from "@mlightcad/geometry-engine";
var e = /* @__PURE__ */ ((_) => (_.ClosedFilled = "", _.Dot = "_DOT", _.DotSmall = "_DOTSMALL", _.DotBlank = "_DOTBLANK", _.Origin = "_ORIGIN", _.Origin2 = "_ORIGIN2", _.Open = "_OPEN", _.Open90 = "_OPEN90", _.Open30 = "_OPEN30", _.Closed = "_CLOSED", _.Small = "_SMALL", _.None = "_NONE", _.Oblique = "_OBLIQUE", _.BoxFilled = "_BOXFILLED", _.Box = "_BOXBLANK", _.ClosedBlank = "_CLOSEDBLANK", _.DatumBlank = "_DATUMBLANK", _.DatumFilled = "_DATUMFILLED", _.Integral = "_INTEGRAL", _.ArchTick = "_ARCHTICK", _))(e || {}), O = /* @__PURE__ */ ((_) => (_[_.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", _[_.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", _[_.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", _[_.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", _[_.BY_STYLE = 5] = "BY_STYLE", _))(O || {}), E = /* @__PURE__ */ ((_) => (_[_.TopLeft = 1] = "TopLeft", _[_.TopCenter = 2] = "TopCenter", _[_.TopRight = 3] = "TopRight", _[_.MiddleLeft = 4] = "MiddleLeft", _[_.MiddleCenter = 5] = "MiddleCenter", _[_.MiddleRight = 6] = "MiddleRight", _[_.BottomLeft = 7] = "BottomLeft", _[_.BottomCenter = 8] = "BottomCenter", _[_.BottomRight = 9] = "BottomRight", _))(E || {}), H = /* @__PURE__ */ ((_) => (_[_.OPTIMIZED_2D = 0] = "OPTIMIZED_2D", _[_.WIREFRAME = 1] = "WIREFRAME", _[_.HIDDEN_LINE = 2] = "HIDDEN_LINE", _[_.FLAT_SHADED = 3] = "FLAT_SHADED", _[_.GOURAUD_SHADED = 4] = "GOURAUD_SHADED", _[_.FLAT_SHADED_WITH_WIREFRAME = 5] = "FLAT_SHADED_WITH_WIREFRAME", _[_.GOURAUD_SHADED_WITH_WIREFRAME = 6] = "GOURAUD_SHADED_WITH_WIREFRAME", _))(H || {}), u = /* @__PURE__ */ ((_) => (_[_.NON_ORTHOGRAPHIC = 0] = "NON_ORTHOGRAPHIC", _[_.TOP = 1] = "TOP", _[_.BOTTOM = 2] = "BOTTOM", _[_.FRONT = 3] = "FRONT", _[_.BACK = 4] = "BACK", _[_.LEFT = 5] = "LEFT", _[_.RIGHT = 6] = "RIGHT", _))(u || {}), L = /* @__PURE__ */ ((_) => (_[_.ONE_DISTANT_LIGHT = 0] = "ONE_DISTANT_LIGHT", _[_.TWO_DISTANT_LIGHTS = 1] = "TWO_DISTANT_LIGHTS", _))(L || {});
class I {
constructor() {
this._number = -1, this._id = "", this._groupId = "", this._centerPoint = new s(), this._height = 0, this._width = 0, this._viewCenter = new s(), this._viewHeight = 0;
}
/**
* The viewport ID number. If the viewport is inactive, -1 is returned.
*/
get number() {
return this._number;
}
set number(t) {
this._number = t;
}
/**
* The id of the viewport.
*/
get id() {
return this._id;
}
set id(t) {
this._id = t;
}
/**
* The id of the group which this viewport belongs to.
*/
get groupId() {
return this._groupId;
}
set groupId(t) {
this._groupId = t;
}
/**
* The center point of the viewport entity in WCS coordinates (within Paper Space).
*/
get centerPoint() {
return this._centerPoint;
}
set centerPoint(t) {
this._centerPoint.copy(t);
}
/**
* The height of the viewport entity's window in drawing units.
*/
get height() {
return this._height;
}
set height(t) {
this._height = t;
}
/**
* The width of the viewport entity's window in drawing units. This is the width in Paper Space
* of the viewport itself, not the width of the Model Space view within the viewport.
*/
get width() {
return this._width;
}
set width(t) {
this._width = t;
}
/**
* The bounding box (in world coordinate system coordinates) of the viewport.
*/
get box() {
const t = new h();
return t.setFromCenterAndSize(this.centerPoint, {
x: this.width,
y: this.height
}), t;
}
/**
* The view center (in display coordinate system coordinates) of the view in the viewport.
*/
get viewCenter() {
return this._viewCenter;
}
set viewCenter(t) {
this._viewCenter.copy(t);
}
/**
* The height (in display coordinate system coordinates) of the Model Space view within the viewport.
* Zooming the view out within the viewport increases this value and zooming in decreases this value.
*/
get viewHeight() {
return this._viewHeight;
}
set viewHeight(t) {
this._viewHeight = t;
}
/**
* The width (in display coordinate system coordinates) of the Model Space view within the viewport.
* This is one computed property based on 'viewHeight' and viewport ratio of width and height.
*/
get viewWidth() {
return this.viewHeight * (this.width / this.height);
}
/**
* The bounding box (in display coordinate system coordinates) of the Model Space view within the viewport.
*/
get viewBox() {
const t = new h();
return t.setFromCenterAndSize(this.viewCenter, {
x: this.viewWidth,
y: this.viewHeight
}), t;
}
/**
* Clone this viewport
* @returns Return the cloned instance of this viewport
*/
clone() {
const t = new I();
return t.id = this.id, t.groupId = this.groupId, t.number = this.number, t.centerPoint.copy(this.centerPoint), t.height = this.height, t.width = this.width, t.viewCenter.copy(this.viewCenter), t.viewHeight = this.viewHeight, t;
}
/**
* Copy the property values of the passed viewport to this viewport.
* @param viewport Input one viewport instance
* @returns Return this viewport
*/
copy(t) {
return this.id = t.id, this.groupId = t.groupId, this.number = t.number, this.centerPoint.copy(t.centerPoint), this.height = t.height, this.width = t.width, this.viewCenter.copy(t.viewCenter), this.viewHeight = t.viewHeight, this;
}
}
export {
e as AcGiArrowType,
L as AcGiDefaultLightingType,
E as AcGiMTextAttachmentPoint,
O as AcGiMTextFlowDirection,
u as AcGiOrthographicType,
H as AcGiRenderMode,
I as AcGiViewport
};