UNPKG

@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

135 lines (134 loc) 6.89 kB
import { AcGePoint3d as t, AcGeBox2d as I } from "@mlightcad/geometry-engine"; var O = /* @__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", _))(O || {}), e = /* @__PURE__ */ ((_) => (_[_.ByBlock = -2] = "ByBlock", _[_.ByDIPs = -4] = "ByDIPs", _[_.ByLayer = -1] = "ByLayer", _[_.ByLineWeightDefault = -3] = "ByLineWeightDefault", _[_.LineWeight000 = 0] = "LineWeight000", _[_.LineWeight005 = 5] = "LineWeight005", _[_.LineWeight009 = 9] = "LineWeight009", _[_.LineWeight013 = 13] = "LineWeight013", _[_.LineWeight015 = 15] = "LineWeight015", _[_.LineWeight018 = 18] = "LineWeight018", _[_.LineWeight020 = 20] = "LineWeight020", _[_.LineWeight025 = 25] = "LineWeight025", _[_.LineWeight030 = 30] = "LineWeight030", _[_.LineWeight035 = 35] = "LineWeight035", _[_.LineWeight040 = 40] = "LineWeight040", _[_.LineWeight050 = 50] = "LineWeight050", _[_.LineWeight053 = 53] = "LineWeight053", _[_.LineWeight060 = 60] = "LineWeight060", _[_.LineWeight070 = 70] = "LineWeight070", _[_.LineWeight080 = 80] = "LineWeight080", _[_.LineWeight090 = 90] = "LineWeight090", _[_.LineWeight100 = 100] = "LineWeight100", _[_.LineWeight106 = 106] = "LineWeight106", _[_.LineWeight120 = 120] = "LineWeight120", _[_.LineWeight140 = 140] = "LineWeight140", _[_.LineWeight158 = 158] = "LineWeight158", _[_.LineWeight200 = 200] = "LineWeight200", _[_.LineWeight211 = 211] = "LineWeight211", _))(e || {}), E = /* @__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", _))(E || {}), u = /* @__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", _))(u || {}), B = /* @__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", _))(B || {}), H = /* @__PURE__ */ ((_) => (_[_.NON_ORTHOGRAPHIC = 0] = "NON_ORTHOGRAPHIC", _[_.TOP = 1] = "TOP", _[_.BOTTOM = 2] = "BOTTOM", _[_.FRONT = 3] = "FRONT", _[_.BACK = 4] = "BACK", _[_.LEFT = 5] = "LEFT", _[_.RIGHT = 6] = "RIGHT", _))(H || {}), D = /* @__PURE__ */ ((_) => (_[_.ONE_DISTANT_LIGHT = 0] = "ONE_DISTANT_LIGHT", _[_.TWO_DISTANT_LIGHTS = 1] = "TWO_DISTANT_LIGHTS", _))(D || {}); class h { constructor() { this._number = -1, this._id = "", this._groupId = "", this._centerPoint = new t(), this._height = 0, this._width = 0, this._viewCenter = new t(), this._viewHeight = 0; } /** * The viewport ID number. If the viewport is inactive, -1 is returned. */ get number() { return this._number; } set number(s) { this._number = s; } /** * The id of the viewport. */ get id() { return this._id; } set id(s) { this._id = s; } /** * The id of the group which this viewport belongs to. */ get groupId() { return this._groupId; } set groupId(s) { this._groupId = s; } /** * The center point of the viewport entity in WCS coordinates (within Paper Space). */ get centerPoint() { return this._centerPoint; } set centerPoint(s) { this._centerPoint.copy(s); } /** * The height of the viewport entity's window in drawing units. */ get height() { return this._height; } set height(s) { this._height = s; } /** * 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(s) { this._width = s; } /** * The bounding box (in world coordinate system coordinates) of the viewport. */ get box() { const s = new I(); return s.setFromCenterAndSize(this.centerPoint, { x: this.width, y: this.height }), s; } /** * The view center (in display coordinate system coordinates) of the view in the viewport. */ get viewCenter() { return this._viewCenter; } set viewCenter(s) { this._viewCenter.copy(s); } /** * 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(s) { this._viewHeight = s; } /** * 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 s = new I(); return s.setFromCenterAndSize(this.viewCenter, { x: this.viewWidth, y: this.viewHeight }), s; } /** * Clone this viewport * @returns Return the cloned instance of this viewport */ clone() { const s = new h(); return s.id = this.id, s.groupId = this.groupId, s.number = this.number, s.centerPoint.copy(this.centerPoint), s.height = this.height, s.width = this.width, s.viewCenter.copy(this.viewCenter), s.viewHeight = this.viewHeight, s; } /** * Copy the property values of the passed viewport to this viewport. * @param viewport Input one viewport instance * @returns Return this viewport */ copy(s) { return this.id = s.id, this.groupId = s.groupId, this.number = s.number, this.centerPoint.copy(s.centerPoint), this.height = s.height, this.width = s.width, this.viewCenter.copy(s.viewCenter), this.viewHeight = s.viewHeight, this; } } export { O as AcGiArrowType, D as AcGiDefaultLightingType, e as AcGiLineWeight, u as AcGiMTextAttachmentPoint, E as AcGiMTextFlowDirection, H as AcGiOrthographicType, B as AcGiRenderMode, h as AcGiViewport };