@mlightcad/cad-simple-viewer 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +797 -986
- package/dist/index.umd.cjs +10 -10
- package/lib/app/AcApDocManager.d.ts +7 -17
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +12 -33
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +111 -41
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +1 -1
- package/lib/app/AcApDocCreator.d.ts +0 -83
- package/lib/app/AcApDocCreator.d.ts.map +0 -1
- package/lib/app/AcApDocCreator.js +0 -205
- package/lib/app/AcApDocCreator.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AcDbLayout as
|
|
1
|
+
import { AcDbLayout as qe, AcCmEventManager as M, AcGePoint2d as S, AcGeBox2d as L, AcCmColor as Qe, AcGeBox3d as Ze, AcDbDatabase as ht, AcDbFileType as _e, AcGeMathUtil as lt, AcGeVector3d as fe, AcGeGeometryUtil as dt, AcGeVector2d as Ce, acdbHostApplicationServices as Je, AcDbViewport as Ke, AcDbRasterImage as et, AcDbRay as tt, AcDbXline as it, AcDbDatabaseConverter as ut, createWorkerApi as mt, AcDbLinetypeTableRecord as gt, AcDbTextStyleTableRecord as pt, AcDbDimStyleTableRecord as yt, AcDbLayerTableRecord as ft, AcDbViewportTableRecord as xt, AcDbBlockTableRecord as _t, AcDbBatchProcessing as bt, AcDbRasterImageDef as wt, AcDbArc as vt, AcDbCircle as St, AcDbEllipse as It, AcDbLine as Bt, AcGePoint3d as ze, AcDbSpline as Pe, AcDbPoint as Mt, AcDbTrace as At, AcDbPolyline as Oe, AcDbHatch as Ct, AcGePolyline2d as Lt, AcGeLoop2d as Et, AcGeLine2d as Tt, AcGeCircArc2d as Dt, AcGeEllipseArc2d as zt, AcGeSpline3d as Re, AcDbTable as Pt, AcDbText as Ot, AcDbMText as Rt, AcDbLeader as Vt, AcDbAlignedDimension as jt, AcDb3PointAngularDimension as Gt, AcDbOrdinateDimension as kt, AcDbRadialDimension as Nt, AcDbDiametricDimension as Ft, AcDbBlockReference as Ut, AcDbDxfConverter as Wt, AcDbDatabaseConverterManager as Ve } from "@mlightcad/data-model";
|
|
2
2
|
import * as d from "three";
|
|
3
|
-
import { UnifiedRenderer as
|
|
4
|
-
import { mergeGeometries as
|
|
5
|
-
import { OrbitControls as
|
|
6
|
-
import { find as
|
|
7
|
-
import
|
|
8
|
-
class
|
|
3
|
+
import { UnifiedRenderer as Xt, FontManager as J } from "@mlightcad/mtext-renderer";
|
|
4
|
+
import { mergeGeometries as $t } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
5
|
+
import { OrbitControls as Yt } from "three/examples/jsm/controls/OrbitControls";
|
|
6
|
+
import { find as Ht, findIndex as qt, defaults as Qt } from "lodash-es";
|
|
7
|
+
import Zt from "three/examples/jsm/libs/stats.module";
|
|
8
|
+
class Jt {
|
|
9
9
|
/**
|
|
10
10
|
* Creates a new application context that binds a document with its view.
|
|
11
11
|
*
|
|
@@ -28,7 +28,7 @@ class ii {
|
|
|
28
28
|
}), t.database.events.headerSysVarChanged.addEventListener((i) => {
|
|
29
29
|
i.name == "pdmode" && this._view.rerenderPoints(i.database.pdmode);
|
|
30
30
|
}), t.database.events.dictObjetSet.addEventListener((i) => {
|
|
31
|
-
i.object instanceof
|
|
31
|
+
i.object instanceof qe && this._view.addLayout(i.object);
|
|
32
32
|
}), e.selectionSet.events.selectionAdded.addEventListener((i) => {
|
|
33
33
|
e.highlight(i.ids);
|
|
34
34
|
}), e.selectionSet.events.selectionRemoved.addEventListener((i) => {
|
|
@@ -155,7 +155,7 @@ class j {
|
|
|
155
155
|
execute(e) {
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
class
|
|
158
|
+
class Kt {
|
|
159
159
|
constructor(e) {
|
|
160
160
|
this._index = 0, this._commands = [], e.forEach((t) => {
|
|
161
161
|
const i = t.groupName;
|
|
@@ -245,10 +245,10 @@ const z = class z {
|
|
|
245
245
|
i || (i = t);
|
|
246
246
|
let s = this._defaultCommandGroup;
|
|
247
247
|
if (e) {
|
|
248
|
-
const
|
|
249
|
-
(
|
|
248
|
+
const r = this._commandsByGroup.find(
|
|
249
|
+
(o) => o.groupName == e
|
|
250
250
|
);
|
|
251
|
-
|
|
251
|
+
r ? s = r : s = {
|
|
252
252
|
groupName: e,
|
|
253
253
|
commandsByGlobalName: /* @__PURE__ */ new Map(),
|
|
254
254
|
commandsByLocalName: /* @__PURE__ */ new Map()
|
|
@@ -272,7 +272,7 @@ const z = class z {
|
|
|
272
272
|
* stack.
|
|
273
273
|
*/
|
|
274
274
|
iterator() {
|
|
275
|
-
return new
|
|
275
|
+
return new Kt(this._commandsByGroup);
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Search through all of the global and untranslated names in all of the command groups in the command
|
|
@@ -336,7 +336,7 @@ const z = class z {
|
|
|
336
336
|
};
|
|
337
337
|
z.SYSTEMT_COMMAND_GROUP_NAME = "ACAD", z.DEFAUT_COMMAND_GROUP_NAME = "USER";
|
|
338
338
|
let A = z;
|
|
339
|
-
function
|
|
339
|
+
function ei(c) {
|
|
340
340
|
return { all: c = c || /* @__PURE__ */ new Map(), on: function(e, t) {
|
|
341
341
|
var i = c.get(e);
|
|
342
342
|
i ? i.push(t) : c.set(e, [t]);
|
|
@@ -352,15 +352,15 @@ function si(c) {
|
|
|
352
352
|
});
|
|
353
353
|
} };
|
|
354
354
|
}
|
|
355
|
-
const V =
|
|
356
|
-
function
|
|
355
|
+
const V = ei();
|
|
356
|
+
function Ln(c) {
|
|
357
357
|
V.emit("message", {
|
|
358
358
|
message: c,
|
|
359
359
|
type: "warning"
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
|
-
var
|
|
363
|
-
class
|
|
362
|
+
var ce = /* @__PURE__ */ ((c) => (c[c.NoSpecialCursor = -1] = "NoSpecialCursor", c[c.Crosshair = 0] = "Crosshair", c[c.RectCursor = 1] = "RectCursor", c[c.RubberBand = 2] = "RubberBand", c[c.NotRotated = 3] = "NotRotated", c[c.TargetBox = 4] = "TargetBox", c[c.RotatedCrosshair = 5] = "RotatedCrosshair", c[c.CrosshairNoRotate = 6] = "CrosshairNoRotate", c[c.Invisible = 7] = "Invisible", c[c.EntitySelect = 8] = "EntitySelect", c[c.Parallelogram = 9] = "Parallelogram", c[c.EntitySelectNoPersp = 10] = "EntitySelectNoPersp", c[c.PkfirstOrGrips = 11] = "PkfirstOrGrips", c[c.CrosshairDashed = 12] = "CrosshairDashed", c[c.Grab = 13] = "Grab", c))(ce || {});
|
|
363
|
+
class ti {
|
|
364
364
|
/**
|
|
365
365
|
* Creates a new cursor manager instance.
|
|
366
366
|
*
|
|
@@ -427,7 +427,7 @@ class ri {
|
|
|
427
427
|
* @returns Return svg string of the icon
|
|
428
428
|
*/
|
|
429
429
|
createRectCrossIcon(e, t, i = "white") {
|
|
430
|
-
const n = e / 2, s = e + 2 * t,
|
|
430
|
+
const n = e / 2, s = e + 2 * t, r = `
|
|
431
431
|
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${s}" viewBox="0 0 ${s} ${s}">
|
|
432
432
|
<rect x="${t}" y="${t}" width="${e}" height="${e}" fill="none" stroke="${i}" />
|
|
433
433
|
<line x1="${n + t}" y1="0" x2="${n + t}" y2="${t}" stroke="${i}" />
|
|
@@ -437,13 +437,13 @@ class ri {
|
|
|
437
437
|
</svg>
|
|
438
438
|
`;
|
|
439
439
|
return this.encodeSvgToCursor(
|
|
440
|
-
|
|
440
|
+
r,
|
|
441
441
|
n + t,
|
|
442
442
|
n + t
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
class
|
|
446
|
+
class Ee {
|
|
447
447
|
/**
|
|
448
448
|
* Creates a new base input instance.
|
|
449
449
|
*
|
|
@@ -509,7 +509,7 @@ class Oe {
|
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
class
|
|
512
|
+
class ii extends Ee {
|
|
513
513
|
/**
|
|
514
514
|
* Creates a new jig loop instance.
|
|
515
515
|
*
|
|
@@ -540,7 +540,7 @@ class oi extends Oe {
|
|
|
540
540
|
super.deactivate(), this.view.canvas.removeEventListener("mousemove", this.onMouseMove);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
class
|
|
543
|
+
class ni {
|
|
544
544
|
/**
|
|
545
545
|
* Creates a new jig instance for the specified view.
|
|
546
546
|
*
|
|
@@ -551,7 +551,7 @@ class ai {
|
|
|
551
551
|
constructor(e) {
|
|
552
552
|
this.onUpdate = () => {
|
|
553
553
|
this.update();
|
|
554
|
-
}, this._view = e, this._jigLoop = new
|
|
554
|
+
}, this._view = e, this._jigLoop = new ii(e), this._jigLoop.events.update.addEventListener(this.onUpdate);
|
|
555
555
|
}
|
|
556
556
|
/**
|
|
557
557
|
* Gets the view associated with this jig.
|
|
@@ -678,8 +678,8 @@ class ai {
|
|
|
678
678
|
update() {
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
|
-
const
|
|
682
|
-
class
|
|
681
|
+
const si = 16777215, ri = "1px";
|
|
682
|
+
class oi extends Ee {
|
|
683
683
|
/**
|
|
684
684
|
* Creates a new box selector instance.
|
|
685
685
|
*
|
|
@@ -701,11 +701,11 @@ class li extends Oe {
|
|
|
701
701
|
const s = new S(
|
|
702
702
|
Math.min(this.mouseDownPositionX, i.x),
|
|
703
703
|
Math.min(this.mouseDownPositionY, i.y)
|
|
704
|
-
),
|
|
704
|
+
), r = new S(
|
|
705
705
|
Math.max(this.mouseDownPositionX, i.x),
|
|
706
706
|
Math.max(this.mouseDownPositionY, i.y)
|
|
707
707
|
);
|
|
708
|
-
this.drawRect(s,
|
|
708
|
+
this.drawRect(s, r);
|
|
709
709
|
}
|
|
710
710
|
}, this.mouseup = (t) => {
|
|
711
711
|
if (this.mouseDown && this.mouseMove) {
|
|
@@ -715,11 +715,11 @@ class li extends Oe {
|
|
|
715
715
|
), s = new S(
|
|
716
716
|
Math.max(this.mouseDownPositionX, i.x),
|
|
717
717
|
Math.max(this.mouseDownPositionY, i.y)
|
|
718
|
-
),
|
|
719
|
-
this.resolve(this.toWcs(
|
|
718
|
+
), r = new L(n, s);
|
|
719
|
+
this.resolve(this.toWcs(r));
|
|
720
720
|
}
|
|
721
721
|
this.mouseDown = !1, this.mouseMove = !1, this.mouseDownPositionX = -1, this.mouseDownPositionY = -1;
|
|
722
|
-
}, this.container = e.canvas, this.color =
|
|
722
|
+
}, this.container = e.canvas, this.color = si;
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
725
725
|
* Activates the box selector.
|
|
@@ -756,8 +756,8 @@ class li extends Oe {
|
|
|
756
756
|
*/
|
|
757
757
|
drawRect(e, t) {
|
|
758
758
|
if (!this.boxDom) {
|
|
759
|
-
const s = new
|
|
760
|
-
s.color = this.color, this.boxDom = document.createElement("div"), this.boxDom.style.cssText = `position: absolute;border: ${
|
|
759
|
+
const s = new Qe();
|
|
760
|
+
s.color = this.color, this.boxDom = document.createElement("div"), this.boxDom.style.cssText = `position: absolute;border: ${ri} solid ${s.cssColor};`, document.body.appendChild(this.boxDom);
|
|
761
761
|
}
|
|
762
762
|
this.setRectDomVisible(!0), e.x <= 0 && (e.x = 0), e.y <= 0 && (e.y = 0), t.x >= this.container.clientWidth - 2 && (t.x = this.container.clientWidth - 2), t.y >= this.container.clientHeight - 2 && (t.y = this.container.clientHeight - 2), this.boxDom.style.left = `${e.x}px`, this.boxDom.style.top = `${e.y}px`;
|
|
763
763
|
const i = Math.abs(t.x - e.x), n = Math.abs(t.y - e.y);
|
|
@@ -784,7 +784,7 @@ class li extends Oe {
|
|
|
784
784
|
return t.expandByPoint(this.view.cwcs2Wcs(i)), t.expandByPoint(this.view.cwcs2Wcs(n)), t;
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
class
|
|
787
|
+
class ai extends Ee {
|
|
788
788
|
/**
|
|
789
789
|
* Creates a new point input instance.
|
|
790
790
|
*
|
|
@@ -812,14 +812,14 @@ class di extends Oe {
|
|
|
812
812
|
super.deactivate(), this.view.canvas.removeEventListener("click", this.onClick);
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
class
|
|
815
|
+
class ci {
|
|
816
816
|
/**
|
|
817
817
|
* Creates a new editor instance for the specified view.
|
|
818
818
|
*
|
|
819
819
|
* @param view - The view that this editor will handle input for
|
|
820
820
|
*/
|
|
821
821
|
constructor(e) {
|
|
822
|
-
this._view = e, this._cursorManager = new
|
|
822
|
+
this._view = e, this._cursorManager = new ti();
|
|
823
823
|
}
|
|
824
824
|
/**
|
|
825
825
|
* Gets the currently active cursor type.
|
|
@@ -870,7 +870,7 @@ class ui {
|
|
|
870
870
|
* ```
|
|
871
871
|
*/
|
|
872
872
|
async getPoint() {
|
|
873
|
-
return await new
|
|
873
|
+
return await new ai(this._view).start();
|
|
874
874
|
}
|
|
875
875
|
/**
|
|
876
876
|
* Prompts the user to select entities using box selection.
|
|
@@ -894,10 +894,10 @@ class ui {
|
|
|
894
894
|
* ```
|
|
895
895
|
*/
|
|
896
896
|
async getSelection() {
|
|
897
|
-
return await new
|
|
897
|
+
return await new oi(this._view).start();
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
|
-
class
|
|
900
|
+
class hi {
|
|
901
901
|
/**
|
|
902
902
|
* Creates a new selection set.
|
|
903
903
|
*
|
|
@@ -1009,8 +1009,8 @@ class mi {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
var
|
|
1013
|
-
class
|
|
1012
|
+
var R = /* @__PURE__ */ ((c) => (c[c.SELECTION = 0] = "SELECTION", c[c.PAN = 1] = "PAN", c))(R || {});
|
|
1013
|
+
class li {
|
|
1014
1014
|
/**
|
|
1015
1015
|
* Creates a new base view instance.
|
|
1016
1016
|
*
|
|
@@ -1031,8 +1031,8 @@ class gi {
|
|
|
1031
1031
|
unhover: new M()
|
|
1032
1032
|
}, this._canvas = e;
|
|
1033
1033
|
const t = e.getBoundingClientRect();
|
|
1034
|
-
this._bbox = new
|
|
1035
|
-
i.button === 1 && this._editor.setCursor(
|
|
1034
|
+
this._bbox = new Ze(), this._width = t.width, this._height = t.height, this._curPos = new S(), this._curScreenPos = new S(), this._selectionSet = new hi(), this._editor = new ci(this), this._canvas.addEventListener("mousemove", (i) => this.onMouseMove(i)), this._canvas.addEventListener("mousedown", (i) => {
|
|
1035
|
+
i.button === 1 && this._editor.setCursor(ce.Grab);
|
|
1036
1036
|
}), this._canvas.addEventListener("mouseup", (i) => {
|
|
1037
1037
|
i.button === 1 && this._editor.restoreCursor();
|
|
1038
1038
|
}), window.addEventListener("resize", this.onWindowResize.bind(this)), this._selectionBoxSize = 4, this._hoverTimer = null, this._pauseTimer = null, this._hoveredObjectId = null;
|
|
@@ -1184,14 +1184,14 @@ class gi {
|
|
|
1184
1184
|
}, 500);
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
|
-
class
|
|
1187
|
+
class di {
|
|
1188
1188
|
/**
|
|
1189
1189
|
* Creates a new document instance with an empty database.
|
|
1190
1190
|
*
|
|
1191
1191
|
* The document is initialized with an "Untitled" title and read-only mode enabled.
|
|
1192
1192
|
*/
|
|
1193
1193
|
constructor() {
|
|
1194
|
-
this._fileName = "", this._docTitle = "", this._isReadOnly = !0, this._database = new
|
|
1194
|
+
this._fileName = "", this._docTitle = "", this._isReadOnly = !0, this._database = new ht(), this.docTitle = "Untitled";
|
|
1195
1195
|
}
|
|
1196
1196
|
/**
|
|
1197
1197
|
* Opens a CAD document from a URI.
|
|
@@ -1238,14 +1238,14 @@ class pi {
|
|
|
1238
1238
|
let n = !0;
|
|
1239
1239
|
this._fileName = e;
|
|
1240
1240
|
try {
|
|
1241
|
-
const
|
|
1241
|
+
const r = (s = e.split(".").pop()) == null ? void 0 : s.toLocaleLowerCase();
|
|
1242
1242
|
await this._database.read(
|
|
1243
1243
|
t,
|
|
1244
1244
|
i,
|
|
1245
|
-
|
|
1245
|
+
r == "dwg" ? _e.DWG : _e.DXF
|
|
1246
1246
|
), this.docTitle = this._fileName;
|
|
1247
|
-
} catch (
|
|
1248
|
-
n = !1, V.emit("failed-to-open-file", { fileName: e }), console.error(
|
|
1247
|
+
} catch (r) {
|
|
1248
|
+
n = !1, V.emit("failed-to-open-file", { fileName: e }), console.error(r);
|
|
1249
1249
|
}
|
|
1250
1250
|
return n;
|
|
1251
1251
|
}
|
|
@@ -1307,7 +1307,7 @@ class pi {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
|
-
class
|
|
1310
|
+
class Se {
|
|
1311
1311
|
constructor() {
|
|
1312
1312
|
this._objectId = "", this._ownerId = "", this._layerName = "", this._visible = !0, this._userData = {}, this._box = new L(), this._svg = "";
|
|
1313
1313
|
}
|
|
@@ -1401,7 +1401,7 @@ class Me {
|
|
|
1401
1401
|
return this;
|
|
1402
1402
|
}
|
|
1403
1403
|
}
|
|
1404
|
-
class
|
|
1404
|
+
class ui extends Se {
|
|
1405
1405
|
constructor(e) {
|
|
1406
1406
|
if (super(), e.closed)
|
|
1407
1407
|
this.svg = `
|
|
@@ -1415,23 +1415,23 @@ class yi extends Me {
|
|
|
1415
1415
|
this._box.min.copy(t.min), this._box.max.copy(t.max);
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
class
|
|
1418
|
+
class mi extends Se {
|
|
1419
1419
|
constructor(e) {
|
|
1420
1420
|
if (super(), e.closed)
|
|
1421
1421
|
this.svg = `
|
|
1422
1422
|
<epllise cx="${e.center.x}" cy="${e.center.y}" rx="${e.majorAxisRadius}" ry="${e.minorAxisRadius}"/>`;
|
|
1423
1423
|
else {
|
|
1424
|
-
const i = e.startPoint, n = e.endPoint, s =
|
|
1425
|
-
e.majorAxis.angleTo(
|
|
1426
|
-
),
|
|
1424
|
+
const i = e.startPoint, n = e.endPoint, s = lt.radToDeg(
|
|
1425
|
+
e.majorAxis.angleTo(fe.X_AXIS)
|
|
1426
|
+
), r = e.clockwise ? 0 : 1;
|
|
1427
1427
|
this.svg = `
|
|
1428
|
-
<path d="M${i.x},${i.y} A${e.majorAxisRadius},${e.minorAxisRadius} ${s} ${e.isLargeArc},${
|
|
1428
|
+
<path d="M${i.x},${i.y} A${e.majorAxisRadius},${e.minorAxisRadius} ${s} ${e.isLargeArc},${r} ${n.x},${n.y}"/>`;
|
|
1429
1429
|
}
|
|
1430
1430
|
const t = e.box;
|
|
1431
1431
|
this._box.min.copy(t.min), this._box.max.copy(t.max);
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
|
-
class
|
|
1434
|
+
class gi extends Se {
|
|
1435
1435
|
constructor(e) {
|
|
1436
1436
|
super();
|
|
1437
1437
|
const t = e.reduce(
|
|
@@ -1441,7 +1441,7 @@ class xi extends Me {
|
|
|
1441
1441
|
t && (this.svg = `<path d="${t}" />`);
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
class
|
|
1444
|
+
class pi {
|
|
1445
1445
|
constructor() {
|
|
1446
1446
|
this._container = new Array(), this._bbox = new L();
|
|
1447
1447
|
}
|
|
@@ -1466,21 +1466,21 @@ class _i {
|
|
|
1466
1466
|
* @inheritdoc
|
|
1467
1467
|
*/
|
|
1468
1468
|
circularArc(e) {
|
|
1469
|
-
const t = new
|
|
1469
|
+
const t = new ui(e);
|
|
1470
1470
|
return this._container.push(t.svg), this._bbox.union(t.box), t;
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
1473
1473
|
* @inheritdoc
|
|
1474
1474
|
*/
|
|
1475
1475
|
ellipticalArc(e) {
|
|
1476
|
-
const t = new
|
|
1476
|
+
const t = new mi(e);
|
|
1477
1477
|
return this._container.push(t.svg), this._bbox.union(t.box), t;
|
|
1478
1478
|
}
|
|
1479
1479
|
/**
|
|
1480
1480
|
* @inheritdoc
|
|
1481
1481
|
*/
|
|
1482
1482
|
lines(e, t) {
|
|
1483
|
-
const i = new
|
|
1483
|
+
const i = new gi(e);
|
|
1484
1484
|
return this._container.push(i.svg), this._bbox.union(i.box), i;
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -1534,8 +1534,8 @@ class _i {
|
|
|
1534
1534
|
</svg>`;
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
|
-
const k = /* @__PURE__ */ new
|
|
1538
|
-
class
|
|
1537
|
+
const k = /* @__PURE__ */ new Se();
|
|
1538
|
+
class yi {
|
|
1539
1539
|
/**
|
|
1540
1540
|
* Converts the current CAD drawing to SVG format and initiates download.
|
|
1541
1541
|
*
|
|
@@ -1552,7 +1552,7 @@ class bi {
|
|
|
1552
1552
|
* ```
|
|
1553
1553
|
*/
|
|
1554
1554
|
convert() {
|
|
1555
|
-
const e = C.instance.curDocument.database.tables.blockTable.modelSpace.newIterator(), t = new
|
|
1555
|
+
const e = C.instance.curDocument.database.tables.blockTable.modelSpace.newIterator(), t = new pi();
|
|
1556
1556
|
for (const i of e)
|
|
1557
1557
|
i.draw(t);
|
|
1558
1558
|
this.createFileAndDownloadIt(t.export());
|
|
@@ -1576,7 +1576,7 @@ class bi {
|
|
|
1576
1576
|
n.href = i, n.download = "example.svg", document.body.appendChild(n), n.click();
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
|
-
class
|
|
1579
|
+
class fi extends j {
|
|
1580
1580
|
/**
|
|
1581
1581
|
* Executes the SVG conversion command.
|
|
1582
1582
|
*
|
|
@@ -1586,10 +1586,10 @@ class wi extends j {
|
|
|
1586
1586
|
* @param _context - The application context (unused in this command)
|
|
1587
1587
|
*/
|
|
1588
1588
|
execute(e) {
|
|
1589
|
-
new
|
|
1589
|
+
new yi().convert();
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
|
-
class
|
|
1592
|
+
class xi extends j {
|
|
1593
1593
|
/**
|
|
1594
1594
|
* Executes the open file command.
|
|
1595
1595
|
*
|
|
@@ -1603,7 +1603,7 @@ class vi extends j {
|
|
|
1603
1603
|
V.emit("open-file", {});
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class _i extends j {
|
|
1607
1607
|
/**
|
|
1608
1608
|
* Executes the quick new command.
|
|
1609
1609
|
*
|
|
@@ -1616,7 +1616,7 @@ class Si extends j {
|
|
|
1616
1616
|
C.instance.openUrl("https://cdn.jsdelivr.net/gh/mlight-lee/cad-data/templates/" + "acadiso.dxf");
|
|
1617
1617
|
}
|
|
1618
1618
|
}
|
|
1619
|
-
class
|
|
1619
|
+
class bi extends j {
|
|
1620
1620
|
/**
|
|
1621
1621
|
* Executes the select command.
|
|
1622
1622
|
*
|
|
@@ -1626,10 +1626,10 @@ class Ii extends j {
|
|
|
1626
1626
|
* @param context - The application context containing the view
|
|
1627
1627
|
*/
|
|
1628
1628
|
execute(e) {
|
|
1629
|
-
e.view.mode =
|
|
1629
|
+
e.view.mode = R.SELECTION, e.view.setCursor(ce.Crosshair);
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
|
-
class
|
|
1632
|
+
class wi extends j {
|
|
1633
1633
|
/**
|
|
1634
1634
|
* Executes the zoom to fit command.
|
|
1635
1635
|
*
|
|
@@ -1643,7 +1643,7 @@ class Bi extends j {
|
|
|
1643
1643
|
e.view.zoomTo(new L(t.extmin, t.extmax), 1.1);
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
|
-
class
|
|
1646
|
+
class vi extends ni {
|
|
1647
1647
|
/**
|
|
1648
1648
|
* Creates a new zoom-to-box jig.
|
|
1649
1649
|
*
|
|
@@ -1664,7 +1664,7 @@ class Mi extends ai {
|
|
|
1664
1664
|
await C.instance.editor.getSelection().then((e) => this.view.zoomTo(e, 1));
|
|
1665
1665
|
}
|
|
1666
1666
|
}
|
|
1667
|
-
class
|
|
1667
|
+
class Si extends j {
|
|
1668
1668
|
/**
|
|
1669
1669
|
* Executes the zoom-to-box command.
|
|
1670
1670
|
*
|
|
@@ -1675,10 +1675,10 @@ class Ai extends j {
|
|
|
1675
1675
|
* @returns Promise that resolves when the zoom operation completes
|
|
1676
1676
|
*/
|
|
1677
1677
|
async execute(e) {
|
|
1678
|
-
await new
|
|
1678
|
+
await new vi(e.view).drag();
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
|
-
class
|
|
1681
|
+
class Ii extends j {
|
|
1682
1682
|
/**
|
|
1683
1683
|
* Executes the pan command.
|
|
1684
1684
|
*
|
|
@@ -1688,14 +1688,14 @@ class Ci extends j {
|
|
|
1688
1688
|
* @param context - The application context containing the view
|
|
1689
1689
|
*/
|
|
1690
1690
|
execute(e) {
|
|
1691
|
-
e.view.mode =
|
|
1691
|
+
e.view.mode = R.PAN, e.view.setCursor(ce.Grab);
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
1694
|
var B;
|
|
1695
1695
|
(function(c) {
|
|
1696
1696
|
c[c.BeforeStart = 0] = "BeforeStart", c[c.EqualStart = 1] = "EqualStart", c[c.BetweenStartAndEnd = 2] = "BetweenStartAndEnd", c[c.EqualEnd = 3] = "EqualEnd", c[c.AfterEnd = 4] = "AfterEnd";
|
|
1697
1697
|
})(B || (B = {}));
|
|
1698
|
-
class
|
|
1698
|
+
class Bi {
|
|
1699
1699
|
pointsSame(e, t) {
|
|
1700
1700
|
return this.pointsSameX(e, t) && this.pointsSameY(e, t);
|
|
1701
1701
|
}
|
|
@@ -1703,19 +1703,19 @@ class Li {
|
|
|
1703
1703
|
return this.pointsSameX(e, t) ? this.pointsSameY(e, t) ? 0 : e[1] < t[1] ? -1 : 1 : e[0] < t[0] ? -1 : 1;
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
|
-
class
|
|
1706
|
+
class nt extends Bi {
|
|
1707
1707
|
constructor(e = 1e-10) {
|
|
1708
1708
|
super(), this.epsilon = e;
|
|
1709
1709
|
}
|
|
1710
1710
|
pointAboveOrOnLine(e, t, i) {
|
|
1711
|
-
const n = t[0], s = t[1],
|
|
1712
|
-
return (
|
|
1711
|
+
const n = t[0], s = t[1], r = i[0], o = i[1], a = e[0], h = e[1];
|
|
1712
|
+
return (r - n) * (h - s) - (o - s) * (a - n) >= -this.epsilon;
|
|
1713
1713
|
}
|
|
1714
1714
|
pointBetween(e, t, i) {
|
|
1715
|
-
const n = e[1] - t[1], s = i[0] - t[0],
|
|
1715
|
+
const n = e[1] - t[1], s = i[0] - t[0], r = e[0] - t[0], o = i[1] - t[1], a = r * s + n * o;
|
|
1716
1716
|
if (a < this.epsilon)
|
|
1717
1717
|
return !1;
|
|
1718
|
-
const h = s * s +
|
|
1718
|
+
const h = s * s + o * o;
|
|
1719
1719
|
return !(a - h > -this.epsilon);
|
|
1720
1720
|
}
|
|
1721
1721
|
pointsSameX(e, t) {
|
|
@@ -1725,14 +1725,14 @@ class yt extends Li {
|
|
|
1725
1725
|
return Math.abs(e[1] - t[1]) < this.epsilon;
|
|
1726
1726
|
}
|
|
1727
1727
|
pointsCollinear(e, t, i) {
|
|
1728
|
-
const n = e[0] - t[0], s = e[1] - t[1],
|
|
1729
|
-
return Math.abs(n *
|
|
1728
|
+
const n = e[0] - t[0], s = e[1] - t[1], r = t[0] - i[0], o = t[1] - i[1];
|
|
1729
|
+
return Math.abs(n * o - r * s) < this.epsilon;
|
|
1730
1730
|
}
|
|
1731
1731
|
linesIntersect(e, t, i, n) {
|
|
1732
|
-
const s = t[0] - e[0],
|
|
1732
|
+
const s = t[0] - e[0], r = t[1] - e[1], o = n[0] - i[0], a = n[1] - i[1], h = s * a - r * o;
|
|
1733
1733
|
if (Math.abs(h) < this.epsilon)
|
|
1734
1734
|
return null;
|
|
1735
|
-
const l = e[0] - i[0], m = e[1] - i[1], u = (
|
|
1735
|
+
const l = e[0] - i[0], m = e[1] - i[1], u = (o * m - a * l) / h, p = (s * m - r * l) / h, g = (f) => f <= -this.epsilon ? B.BeforeStart : f < this.epsilon ? B.EqualStart : f - 1 <= -this.epsilon ? B.BetweenStartAndEnd : f - 1 < this.epsilon ? B.EqualEnd : B.AfterEnd, y = [e[0] + u * s, e[1] + u * r];
|
|
1736
1736
|
return {
|
|
1737
1737
|
alongA: g(u),
|
|
1738
1738
|
alongB: g(p),
|
|
@@ -1740,7 +1740,7 @@ class yt extends Li {
|
|
|
1740
1740
|
};
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
|
-
class
|
|
1743
|
+
class je {
|
|
1744
1744
|
constructor() {
|
|
1745
1745
|
this.nodes = [];
|
|
1746
1746
|
}
|
|
@@ -1766,19 +1766,19 @@ class Ue {
|
|
|
1766
1766
|
findTransition(e, t) {
|
|
1767
1767
|
var i, n;
|
|
1768
1768
|
const s = (a, h) => t(h) - t(a);
|
|
1769
|
-
let
|
|
1770
|
-
for (;
|
|
1771
|
-
const a =
|
|
1772
|
-
s(this.nodes[a], e) > 0 ?
|
|
1769
|
+
let r = 0, o = this.nodes.length;
|
|
1770
|
+
for (; r < o; ) {
|
|
1771
|
+
const a = r + o >> 1;
|
|
1772
|
+
s(this.nodes[a], e) > 0 ? o = a : r = a + 1;
|
|
1773
1773
|
}
|
|
1774
1774
|
return {
|
|
1775
|
-
before:
|
|
1776
|
-
after: (n = this.nodes[
|
|
1777
|
-
insert: (a) => (this.nodes.splice(
|
|
1775
|
+
before: r <= 0 ? null : (i = this.nodes[r - 1]) !== null && i !== void 0 ? i : null,
|
|
1776
|
+
after: (n = this.nodes[r]) !== null && n !== void 0 ? n : null,
|
|
1777
|
+
insert: (a) => (this.nodes.splice(r, 0, a), a)
|
|
1778
1778
|
};
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
|
-
class
|
|
1781
|
+
class Q {
|
|
1782
1782
|
constructor(e, t, i, n) {
|
|
1783
1783
|
var s;
|
|
1784
1784
|
this.otherFill = null, this.id = (s = n == null ? void 0 : n.segmentId()) !== null && s !== void 0 ? s : -1, this.start = e, this.end = t, this.myFill = {
|
|
@@ -1787,22 +1787,22 @@ class Z {
|
|
|
1787
1787
|
};
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
|
-
class
|
|
1790
|
+
class Ge {
|
|
1791
1791
|
constructor(e, t, i, n) {
|
|
1792
1792
|
this.status = null, this.isStart = e, this.p = t, this.seg = i, this.primary = n;
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
class
|
|
1795
|
+
class ke {
|
|
1796
1796
|
constructor(e, t, i = null) {
|
|
1797
|
-
this.events = new
|
|
1797
|
+
this.events = new je(), this.status = new je(), this.selfIntersection = e, this.geo = t, this.log = i;
|
|
1798
1798
|
}
|
|
1799
|
-
compareEvents(e, t, i, n, s,
|
|
1800
|
-
const
|
|
1801
|
-
return
|
|
1799
|
+
compareEvents(e, t, i, n, s, r) {
|
|
1800
|
+
const o = this.geo.pointsCompare(t, s);
|
|
1801
|
+
return o !== 0 ? o : this.geo.pointsSame(i, r) ? 0 : e !== n ? e ? 1 : -1 : this.geo.pointAboveOrOnLine(
|
|
1802
1802
|
i,
|
|
1803
|
-
n ? s :
|
|
1803
|
+
n ? s : r,
|
|
1804
1804
|
// order matters
|
|
1805
|
-
n ?
|
|
1805
|
+
n ? r : s
|
|
1806
1806
|
) ? 1 : -1;
|
|
1807
1807
|
}
|
|
1808
1808
|
addEvent(e) {
|
|
@@ -1810,15 +1810,15 @@ class Xe {
|
|
|
1810
1810
|
}
|
|
1811
1811
|
divideEvent(e, t) {
|
|
1812
1812
|
var i;
|
|
1813
|
-
const n = new
|
|
1813
|
+
const n = new Q(t, e.seg.end, e.seg, this.log);
|
|
1814
1814
|
return (i = this.log) === null || i === void 0 || i.segmentChop(e.seg, t), this.events.remove(e.other), e.seg.end = t, e.other.p = t, this.addEvent(e.other), this.addSegment(n, e.primary);
|
|
1815
1815
|
}
|
|
1816
1816
|
newSegment(e, t) {
|
|
1817
1817
|
const i = this.geo.pointsCompare(e, t);
|
|
1818
|
-
return i === 0 ? null : i < 0 ? new
|
|
1818
|
+
return i === 0 ? null : i < 0 ? new Q(e, t, null, this.log) : new Q(t, e, null, this.log);
|
|
1819
1819
|
}
|
|
1820
1820
|
addSegment(e, t) {
|
|
1821
|
-
const i = new
|
|
1821
|
+
const i = new Ge(!0, e.start, e, t), n = new Ge(!1, e.end, e, t);
|
|
1822
1822
|
return i.other = n, n.other = i, this.addEvent(i), this.addEvent(n), i;
|
|
1823
1823
|
}
|
|
1824
1824
|
addRegion(e) {
|
|
@@ -1830,33 +1830,33 @@ class Xe {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
1832
1832
|
compareStatus(e, t) {
|
|
1833
|
-
const i = e.seg.start, n = e.seg.end, s = t.seg.start,
|
|
1834
|
-
return this.geo.pointsCollinear(i, s,
|
|
1833
|
+
const i = e.seg.start, n = e.seg.end, s = t.seg.start, r = t.seg.end;
|
|
1834
|
+
return this.geo.pointsCollinear(i, s, r) ? this.geo.pointsCollinear(n, s, r) || this.geo.pointAboveOrOnLine(n, s, r) ? 1 : -1 : this.geo.pointAboveOrOnLine(i, s, r) ? 1 : -1;
|
|
1835
1835
|
}
|
|
1836
1836
|
statusFindSurrounding(e) {
|
|
1837
1837
|
return this.status.findTransition(e, (t) => t === e ? 0 : -this.compareStatus(e, t));
|
|
1838
1838
|
}
|
|
1839
1839
|
checkIntersection(e, t) {
|
|
1840
1840
|
var i;
|
|
1841
|
-
const n = e.seg, s = t.seg,
|
|
1841
|
+
const n = e.seg, s = t.seg, r = n.start, o = n.end, a = s.start, h = s.end;
|
|
1842
1842
|
(i = this.log) === null || i === void 0 || i.checkIntersection(n, s);
|
|
1843
|
-
const l = this.geo.linesIntersect(
|
|
1843
|
+
const l = this.geo.linesIntersect(r, o, a, h);
|
|
1844
1844
|
if (l === null) {
|
|
1845
|
-
if (!this.geo.pointsCollinear(
|
|
1845
|
+
if (!this.geo.pointsCollinear(r, o, a) || this.geo.pointsSame(r, h) || this.geo.pointsSame(o, a))
|
|
1846
1846
|
return null;
|
|
1847
|
-
const m = this.geo.pointsSame(
|
|
1847
|
+
const m = this.geo.pointsSame(r, a), u = this.geo.pointsSame(o, h);
|
|
1848
1848
|
if (m && u)
|
|
1849
1849
|
return t;
|
|
1850
|
-
const p = !m && this.geo.pointBetween(
|
|
1850
|
+
const p = !m && this.geo.pointBetween(r, a, h), g = !u && this.geo.pointBetween(o, a, h);
|
|
1851
1851
|
if (m)
|
|
1852
|
-
return g ? this.divideEvent(t,
|
|
1853
|
-
p && (u || (g ? this.divideEvent(t,
|
|
1852
|
+
return g ? this.divideEvent(t, o) : this.divideEvent(e, h), t;
|
|
1853
|
+
p && (u || (g ? this.divideEvent(t, o) : this.divideEvent(e, h)), this.divideEvent(t, r));
|
|
1854
1854
|
} else
|
|
1855
|
-
l.alongA === B.BetweenStartAndEnd && (l.alongB === B.EqualStart ? this.divideEvent(e, a) : l.alongB === B.BetweenStartAndEnd ? this.divideEvent(e, l.p) : l.alongB === B.EqualEnd && this.divideEvent(e, h)), l.alongB === B.BetweenStartAndEnd && (l.alongA === B.EqualStart ? this.divideEvent(t,
|
|
1855
|
+
l.alongA === B.BetweenStartAndEnd && (l.alongB === B.EqualStart ? this.divideEvent(e, a) : l.alongB === B.BetweenStartAndEnd ? this.divideEvent(e, l.p) : l.alongB === B.EqualEnd && this.divideEvent(e, h)), l.alongB === B.BetweenStartAndEnd && (l.alongA === B.EqualStart ? this.divideEvent(t, r) : l.alongA === B.BetweenStartAndEnd ? this.divideEvent(t, l.p) : l.alongA === B.EqualEnd && this.divideEvent(t, o));
|
|
1856
1856
|
return null;
|
|
1857
1857
|
}
|
|
1858
1858
|
calculate(e, t) {
|
|
1859
|
-
var i, n, s,
|
|
1859
|
+
var i, n, s, r, o, a, h, l;
|
|
1860
1860
|
const m = [];
|
|
1861
1861
|
for (; !this.events.isEmpty(); ) {
|
|
1862
1862
|
const u = this.events.getHead();
|
|
@@ -1878,10 +1878,10 @@ class Xe {
|
|
|
1878
1878
|
u.seg.myFill.below === null ? x = !0 : x = u.seg.myFill.above !== u.seg.myFill.below, x && (_.seg.myFill.above = !_.seg.myFill.above);
|
|
1879
1879
|
} else
|
|
1880
1880
|
_.seg.otherFill = u.seg.myFill;
|
|
1881
|
-
(
|
|
1881
|
+
(r = this.log) === null || r === void 0 || r.segmentUpdate(_.seg), this.events.remove(u.other), this.events.remove(u);
|
|
1882
1882
|
}
|
|
1883
1883
|
if (this.events.getHead() !== u) {
|
|
1884
|
-
(
|
|
1884
|
+
(o = this.log) === null || o === void 0 || o.rewind(u.seg);
|
|
1885
1885
|
continue;
|
|
1886
1886
|
}
|
|
1887
1887
|
if (this.selfIntersection) {
|
|
@@ -1925,35 +1925,35 @@ class Xe {
|
|
|
1925
1925
|
return (l = this.log) === null || l === void 0 || l.done(), m;
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1928
|
+
function K(c, e, t) {
|
|
1929
1929
|
const i = [];
|
|
1930
1930
|
for (const n of c) {
|
|
1931
1931
|
const s = (n.myFill.above ? 8 : 0) + (n.myFill.below ? 4 : 0) + (n.otherFill && n.otherFill.above ? 2 : 0) + (n.otherFill && n.otherFill.below ? 1 : 0);
|
|
1932
1932
|
if (e[s] !== 0) {
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1933
|
+
const r = new Q(n.start, n.end, null, t);
|
|
1934
|
+
r.myFill.above = e[s] === 1, r.myFill.below = e[s] === 2, i.push(r);
|
|
1935
1935
|
}
|
|
1936
1936
|
}
|
|
1937
1937
|
return t == null || t.selected(i), i;
|
|
1938
1938
|
}
|
|
1939
|
-
class
|
|
1939
|
+
class ee {
|
|
1940
1940
|
static union(e, t) {
|
|
1941
|
-
return
|
|
1941
|
+
return K(e, [0, 2, 1, 0, 2, 2, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], t);
|
|
1942
1942
|
}
|
|
1943
1943
|
static intersect(e, t) {
|
|
1944
|
-
return
|
|
1944
|
+
return K(e, [0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 1, 1, 0, 2, 1, 0], t);
|
|
1945
1945
|
}
|
|
1946
1946
|
static difference(e, t) {
|
|
1947
|
-
return
|
|
1947
|
+
return K(e, [0, 0, 0, 0, 2, 0, 2, 0, 1, 1, 0, 0, 0, 1, 2, 0], t);
|
|
1948
1948
|
}
|
|
1949
1949
|
static differenceRev(e, t) {
|
|
1950
|
-
return
|
|
1950
|
+
return K(e, [0, 2, 1, 0, 0, 0, 1, 1, 0, 2, 0, 2, 0, 0, 0, 0], t);
|
|
1951
1951
|
}
|
|
1952
1952
|
static xor(e, t) {
|
|
1953
|
-
return
|
|
1953
|
+
return K(e, [0, 2, 1, 0, 2, 0, 0, 1, 1, 0, 0, 2, 0, 1, 2, 0], t);
|
|
1954
1954
|
}
|
|
1955
1955
|
}
|
|
1956
|
-
function
|
|
1956
|
+
function Mi(c, e, t) {
|
|
1957
1957
|
const i = [], n = [];
|
|
1958
1958
|
for (const s of c) {
|
|
1959
1959
|
let m = function(_, x, w) {
|
|
@@ -1966,8 +1966,8 @@ function Ei(c, e, t) {
|
|
|
1966
1966
|
const P = w[w.length - 2], v = b[0], G = b[1];
|
|
1967
1967
|
e.pointsCollinear(P, I, v) && (t == null || t.chainRemoveTail(_, I), w.pop(), I = P), e.pointsCollinear(I, v, G) && (t == null || t.chainRemoveHead(x, v), b.shift()), t == null || t.chainJoin(_, x), i[_] = w.concat(b), i.splice(x, 1);
|
|
1968
1968
|
};
|
|
1969
|
-
const
|
|
1970
|
-
if (e.pointsSame(
|
|
1969
|
+
const r = s.start, o = s.end;
|
|
1970
|
+
if (e.pointsSame(r, o)) {
|
|
1971
1971
|
console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large");
|
|
1972
1972
|
continue;
|
|
1973
1973
|
}
|
|
@@ -1984,25 +1984,25 @@ function Ei(c, e, t) {
|
|
|
1984
1984
|
let l = a;
|
|
1985
1985
|
for (let _ = 0; _ < i.length; _++) {
|
|
1986
1986
|
const x = i[_], w = x[0], b = x[x.length - 1];
|
|
1987
|
-
if (e.pointsSame(w,
|
|
1987
|
+
if (e.pointsSame(w, r)) {
|
|
1988
1988
|
if (m(_, !0, !0))
|
|
1989
1989
|
break;
|
|
1990
|
-
} else if (e.pointsSame(w,
|
|
1990
|
+
} else if (e.pointsSame(w, o)) {
|
|
1991
1991
|
if (m(_, !0, !1))
|
|
1992
1992
|
break;
|
|
1993
|
-
} else if (e.pointsSame(b,
|
|
1993
|
+
} else if (e.pointsSame(b, r)) {
|
|
1994
1994
|
if (m(_, !1, !0))
|
|
1995
1995
|
break;
|
|
1996
|
-
} else if (e.pointsSame(b,
|
|
1996
|
+
} else if (e.pointsSame(b, o) && m(_, !1, !1))
|
|
1997
1997
|
break;
|
|
1998
1998
|
}
|
|
1999
1999
|
if (l === a) {
|
|
2000
|
-
i.push([
|
|
2000
|
+
i.push([r, o]), t == null || t.chainNew(r, o);
|
|
2001
2001
|
continue;
|
|
2002
2002
|
}
|
|
2003
2003
|
if (l === h) {
|
|
2004
2004
|
t == null || t.chainMatch(a.index);
|
|
2005
|
-
const _ = a.index, x = a.matches_pt1 ?
|
|
2005
|
+
const _ = a.index, x = a.matches_pt1 ? o : r, w = a.matches_head, b = i[_];
|
|
2006
2006
|
let I = w ? b[0] : b[b.length - 1];
|
|
2007
2007
|
const P = w ? b[1] : b[b.length - 2], v = w ? b[b.length - 1] : b[0], G = w ? b[b.length - 2] : b[1];
|
|
2008
2008
|
if (e.pointsCollinear(P, I, x) && (w ? (t == null || t.chainRemoveHead(a.index, x), b.shift()) : (t == null || t.chainRemoveTail(a.index, x), b.pop()), I = P), e.pointsSame(v, x)) {
|
|
@@ -2019,7 +2019,7 @@ function Ei(c, e, t) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
return n;
|
|
2021
2021
|
}
|
|
2022
|
-
class
|
|
2022
|
+
class Ai {
|
|
2023
2023
|
constructor() {
|
|
2024
2024
|
this.list = [], this.nextSegmentId = 0, this.curVert = NaN;
|
|
2025
2025
|
}
|
|
@@ -2099,16 +2099,16 @@ class Ti {
|
|
|
2099
2099
|
this.push("done", null);
|
|
2100
2100
|
}
|
|
2101
2101
|
}
|
|
2102
|
-
class
|
|
2102
|
+
class st {
|
|
2103
2103
|
constructor(e) {
|
|
2104
2104
|
this.log = null, this.geo = e;
|
|
2105
2105
|
}
|
|
2106
2106
|
buildLog(e) {
|
|
2107
2107
|
var t;
|
|
2108
|
-
return this.log = e ? new
|
|
2108
|
+
return this.log = e ? new Ai() : null, (t = this.log) === null || t === void 0 ? void 0 : t.list;
|
|
2109
2109
|
}
|
|
2110
2110
|
segments(e) {
|
|
2111
|
-
const t = new
|
|
2111
|
+
const t = new ke(!0, this.geo, this.log);
|
|
2112
2112
|
for (const i of e.regions)
|
|
2113
2113
|
t.addRegion(i);
|
|
2114
2114
|
return {
|
|
@@ -2117,11 +2117,11 @@ class ft {
|
|
|
2117
2117
|
};
|
|
2118
2118
|
}
|
|
2119
2119
|
combine(e, t) {
|
|
2120
|
-
const i = new
|
|
2120
|
+
const i = new ke(!1, this.geo, this.log);
|
|
2121
2121
|
for (const n of e.segments)
|
|
2122
|
-
i.addSegment(new
|
|
2122
|
+
i.addSegment(new Q(n.start, n.end, n, this.log), !0);
|
|
2123
2123
|
for (const n of t.segments)
|
|
2124
|
-
i.addSegment(new
|
|
2124
|
+
i.addSegment(new Q(n.start, n.end, n, this.log), !1);
|
|
2125
2125
|
return {
|
|
2126
2126
|
combined: i.calculate(e.inverted, t.inverted),
|
|
2127
2127
|
inverted1: e.inverted,
|
|
@@ -2130,64 +2130,64 @@ class ft {
|
|
|
2130
2130
|
}
|
|
2131
2131
|
selectUnion(e) {
|
|
2132
2132
|
return {
|
|
2133
|
-
segments:
|
|
2133
|
+
segments: ee.union(e.combined, this.log),
|
|
2134
2134
|
inverted: e.inverted1 || e.inverted2
|
|
2135
2135
|
};
|
|
2136
2136
|
}
|
|
2137
2137
|
selectIntersect(e) {
|
|
2138
2138
|
return {
|
|
2139
|
-
segments:
|
|
2139
|
+
segments: ee.intersect(e.combined, this.log),
|
|
2140
2140
|
inverted: e.inverted1 && e.inverted2
|
|
2141
2141
|
};
|
|
2142
2142
|
}
|
|
2143
2143
|
selectDifference(e) {
|
|
2144
2144
|
return {
|
|
2145
|
-
segments:
|
|
2145
|
+
segments: ee.difference(e.combined, this.log),
|
|
2146
2146
|
inverted: e.inverted1 && !e.inverted2
|
|
2147
2147
|
};
|
|
2148
2148
|
}
|
|
2149
2149
|
selectDifferenceRev(e) {
|
|
2150
2150
|
return {
|
|
2151
|
-
segments:
|
|
2151
|
+
segments: ee.differenceRev(e.combined, this.log),
|
|
2152
2152
|
inverted: !e.inverted1 && e.inverted2
|
|
2153
2153
|
};
|
|
2154
2154
|
}
|
|
2155
2155
|
selectXor(e) {
|
|
2156
2156
|
return {
|
|
2157
|
-
segments:
|
|
2157
|
+
segments: ee.xor(e.combined, this.log),
|
|
2158
2158
|
inverted: e.inverted1 !== e.inverted2
|
|
2159
2159
|
};
|
|
2160
2160
|
}
|
|
2161
2161
|
polygon(e) {
|
|
2162
2162
|
return {
|
|
2163
|
-
regions:
|
|
2163
|
+
regions: Mi(e.segments, this.geo, this.log),
|
|
2164
2164
|
inverted: e.inverted
|
|
2165
2165
|
};
|
|
2166
2166
|
}
|
|
2167
2167
|
// helper functions for common operations
|
|
2168
2168
|
union(e, t) {
|
|
2169
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2170
|
-
return this.polygon(
|
|
2169
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectUnion(s);
|
|
2170
|
+
return this.polygon(r);
|
|
2171
2171
|
}
|
|
2172
2172
|
intersect(e, t) {
|
|
2173
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2174
|
-
return this.polygon(
|
|
2173
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectIntersect(s);
|
|
2174
|
+
return this.polygon(r);
|
|
2175
2175
|
}
|
|
2176
2176
|
difference(e, t) {
|
|
2177
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2178
|
-
return this.polygon(
|
|
2177
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectDifference(s);
|
|
2178
|
+
return this.polygon(r);
|
|
2179
2179
|
}
|
|
2180
2180
|
differenceRev(e, t) {
|
|
2181
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2182
|
-
return this.polygon(
|
|
2181
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectDifferenceRev(s);
|
|
2182
|
+
return this.polygon(r);
|
|
2183
2183
|
}
|
|
2184
2184
|
xor(e, t) {
|
|
2185
|
-
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n),
|
|
2186
|
-
return this.polygon(
|
|
2185
|
+
const i = this.segments(e), n = this.segments(t), s = this.combine(i, n), r = this.selectXor(s);
|
|
2186
|
+
return this.polygon(r);
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
|
-
new
|
|
2190
|
-
class
|
|
2189
|
+
new st(new nt());
|
|
2190
|
+
class be extends d.Object3D {
|
|
2191
2191
|
/**
|
|
2192
2192
|
* Flatten the hierarchy of the specified object so that all children are moved to be direct
|
|
2193
2193
|
* children of this object. Preserve transformations.
|
|
@@ -2199,10 +2199,10 @@ class Se extends d.Object3D {
|
|
|
2199
2199
|
function i(s) {
|
|
2200
2200
|
s.position.set(0, 0, 0), s.rotation.set(0, 0, 0), s.scale.set(1, 1, 1), s.matrix.identity();
|
|
2201
2201
|
}
|
|
2202
|
-
function n(s,
|
|
2203
|
-
const
|
|
2204
|
-
for (const a of
|
|
2205
|
-
a.applyMatrix4(
|
|
2202
|
+
function n(s, r) {
|
|
2203
|
+
const o = [...s.children];
|
|
2204
|
+
for (const a of o)
|
|
2205
|
+
a.applyMatrix4(r), i(a), a.children.length > 0 ? n(a, a.matrixWorld) : t.push(a);
|
|
2206
2206
|
s.children = [];
|
|
2207
2207
|
}
|
|
2208
2208
|
e.updateMatrixWorld(!0), n(e, e.matrixWorld);
|
|
@@ -2217,8 +2217,8 @@ class Se extends d.Object3D {
|
|
|
2217
2217
|
*/
|
|
2218
2218
|
static disposeObject(e, t = !0) {
|
|
2219
2219
|
t && e.removeFromParent(), (e instanceof d.Mesh || e instanceof d.Line || e instanceof d.Points) && e.geometry && e.geometry.dispose(), (e instanceof d.Mesh || e instanceof d.Line || e instanceof d.Points) && (Array.isArray(e.material) ? e.material : [e.material]).forEach((i) => {
|
|
2220
|
-
var n, s,
|
|
2221
|
-
i.dispose(), (n = i.map) == null || n.dispose(), (s = i.envMap) == null || s.dispose(), (
|
|
2220
|
+
var n, s, r, o, a, h, l, m;
|
|
2221
|
+
i.dispose(), (n = i.map) == null || n.dispose(), (s = i.envMap) == null || s.dispose(), (r = i.lightMap) == null || r.dispose(), (o = i.bumpMap) == null || o.dispose(), (a = i.normalMap) == null || a.dispose(), (h = i.roughnessMap) == null || h.dispose(), (l = i.metalnessMap) == null || l.dispose(), (m = i.alphaMap) == null || m.dispose();
|
|
2222
2222
|
}), e.children.forEach((i) => this.disposeObject(i)), "geometry" in e && (e.geometry = null), "material" in e && (e.material = null), e.children = [];
|
|
2223
2223
|
}
|
|
2224
2224
|
/**
|
|
@@ -2226,13 +2226,13 @@ class Se extends d.Object3D {
|
|
|
2226
2226
|
* this entity. Preserve transformations.
|
|
2227
2227
|
*/
|
|
2228
2228
|
flatten() {
|
|
2229
|
-
|
|
2229
|
+
be.flattenObject(this);
|
|
2230
2230
|
}
|
|
2231
2231
|
/**
|
|
2232
2232
|
* Remove this object from its parent and release geometry and material resource used by this object.
|
|
2233
2233
|
*/
|
|
2234
2234
|
dispose() {
|
|
2235
|
-
|
|
2235
|
+
be.disposeObject(this);
|
|
2236
2236
|
}
|
|
2237
2237
|
}
|
|
2238
2238
|
const T = [
|
|
@@ -2365,7 +2365,7 @@ const T = [
|
|
|
2365
2365
|
24,
|
|
2366
2366
|
24,
|
|
2367
2367
|
25
|
|
2368
|
-
],
|
|
2368
|
+
], Ci = /* @__PURE__ */ new Map([
|
|
2369
2369
|
[
|
|
2370
2370
|
2,
|
|
2371
2371
|
{
|
|
@@ -2810,12 +2810,12 @@ const T = [
|
|
|
2810
2810
|
}
|
|
2811
2811
|
]
|
|
2812
2812
|
]);
|
|
2813
|
-
class
|
|
2813
|
+
class O {
|
|
2814
2814
|
constructor() {
|
|
2815
2815
|
this._symbols = this.initialize();
|
|
2816
2816
|
}
|
|
2817
2817
|
static get instance() {
|
|
2818
|
-
return
|
|
2818
|
+
return O._instance || (O._instance = new O()), O._instance;
|
|
2819
2819
|
}
|
|
2820
2820
|
/**
|
|
2821
2821
|
* Return true if showing one point using THREE.Points
|
|
@@ -2826,20 +2826,20 @@ class R {
|
|
|
2826
2826
|
create(e = null, t = { x: 0, y: 0, z: 0 }) {
|
|
2827
2827
|
const i = {};
|
|
2828
2828
|
if (e == null || e == 0)
|
|
2829
|
-
|
|
2829
|
+
te.copy(t), i.point = new d.BufferGeometry().setFromPoints([te]);
|
|
2830
2830
|
else if (e != 1) {
|
|
2831
2831
|
const n = this._symbols.get(e);
|
|
2832
2832
|
if (n == null)
|
|
2833
2833
|
throw new Error(
|
|
2834
2834
|
`[AcTrPointSymbolCreator] Invalid point type value: '${e}'!`
|
|
2835
2835
|
);
|
|
2836
|
-
|
|
2836
|
+
te.copy(t), Ne.identity().makeTranslation(te), i.line = n.clone().applyMatrix4(Ne), (e == 32 || e == 64 || e == 96) && (i.point = new d.BufferGeometry().setFromPoints([te]));
|
|
2837
2837
|
}
|
|
2838
2838
|
return i;
|
|
2839
2839
|
}
|
|
2840
2840
|
initialize() {
|
|
2841
2841
|
const e = /* @__PURE__ */ new Map();
|
|
2842
|
-
return
|
|
2842
|
+
return Ci.forEach((t, i) => {
|
|
2843
2843
|
const n = new d.BufferGeometry();
|
|
2844
2844
|
n.setAttribute(
|
|
2845
2845
|
"position",
|
|
@@ -2848,8 +2848,8 @@ class R {
|
|
|
2848
2848
|
}), e;
|
|
2849
2849
|
}
|
|
2850
2850
|
}
|
|
2851
|
-
const
|
|
2852
|
-
class
|
|
2851
|
+
const Ne = /* @__PURE__ */ new d.Matrix4(), te = /* @__PURE__ */ new d.Vector3(), Li = new d.Color(583902);
|
|
2852
|
+
class we {
|
|
2853
2853
|
/**
|
|
2854
2854
|
* Clone given material(s)
|
|
2855
2855
|
*/
|
|
@@ -2864,7 +2864,7 @@ class Ie {
|
|
|
2864
2864
|
}
|
|
2865
2865
|
return e.clone();
|
|
2866
2866
|
}
|
|
2867
|
-
static setMaterialColor(e, t =
|
|
2867
|
+
static setMaterialColor(e, t = Li) {
|
|
2868
2868
|
if (Array.isArray(e)) {
|
|
2869
2869
|
e.forEach((i) => this.setMaterialColor(i, t));
|
|
2870
2870
|
return;
|
|
@@ -2881,7 +2881,7 @@ class Ie {
|
|
|
2881
2881
|
return "uniforms" in e && e.uniforms !== void 0;
|
|
2882
2882
|
}
|
|
2883
2883
|
}
|
|
2884
|
-
class
|
|
2884
|
+
class he {
|
|
2885
2885
|
static getExtension(e) {
|
|
2886
2886
|
return e.substring(e.lastIndexOf(".") + 1);
|
|
2887
2887
|
}
|
|
@@ -2901,12 +2901,12 @@ class ue {
|
|
|
2901
2901
|
if (s === "string") return n.length * 2;
|
|
2902
2902
|
if (s === "symbol" || s === "function" || t.has(n)) return 0;
|
|
2903
2903
|
if (t.add(n), Array.isArray(n))
|
|
2904
|
-
return n.map(i).reduce((
|
|
2904
|
+
return n.map(i).reduce((r, o) => r + o, 0);
|
|
2905
2905
|
if (s === "object") {
|
|
2906
|
-
let
|
|
2907
|
-
for (const
|
|
2908
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
2909
|
-
return
|
|
2906
|
+
let r = 0;
|
|
2907
|
+
for (const o in n)
|
|
2908
|
+
Object.prototype.hasOwnProperty.call(n, o) && (r += o.length * 2, r += i(n[o]));
|
|
2909
|
+
return r;
|
|
2910
2910
|
}
|
|
2911
2911
|
return 0;
|
|
2912
2912
|
}
|
|
@@ -2916,7 +2916,7 @@ class ue {
|
|
|
2916
2916
|
return e.split("/").pop();
|
|
2917
2917
|
}
|
|
2918
2918
|
static getFileNameWithoutExtension(e) {
|
|
2919
|
-
const t =
|
|
2919
|
+
const t = he.getFileName(e);
|
|
2920
2920
|
if (t) {
|
|
2921
2921
|
const i = t.lastIndexOf(".");
|
|
2922
2922
|
return i === -1 ? t : t.substring(0, i);
|
|
@@ -2924,21 +2924,21 @@ class ue {
|
|
|
2924
2924
|
return e;
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
2927
|
-
function
|
|
2927
|
+
function Te(c, e) {
|
|
2928
2928
|
return c - e;
|
|
2929
2929
|
}
|
|
2930
|
-
function
|
|
2930
|
+
function De(c, e, t = 0) {
|
|
2931
2931
|
const i = e.itemSize;
|
|
2932
2932
|
if (c.isInterleavedBufferAttribute || c.array.constructor !== e.array.constructor) {
|
|
2933
2933
|
const n = c.count;
|
|
2934
2934
|
for (let s = 0; s < n; s++)
|
|
2935
|
-
for (let
|
|
2936
|
-
e.setComponent(s + t,
|
|
2935
|
+
for (let r = 0; r < i; r++)
|
|
2936
|
+
e.setComponent(s + t, r, c.getComponent(s, r));
|
|
2937
2937
|
} else
|
|
2938
2938
|
e.array.set(c.array, t * i);
|
|
2939
2939
|
e.needsUpdate = !0;
|
|
2940
2940
|
}
|
|
2941
|
-
function
|
|
2941
|
+
function Z(c, e) {
|
|
2942
2942
|
if (c.constructor !== e.constructor) {
|
|
2943
2943
|
const t = Math.min(c.length, e.length);
|
|
2944
2944
|
for (let i = 0; i < t; i++)
|
|
@@ -2948,8 +2948,8 @@ function J(c, e) {
|
|
|
2948
2948
|
e.set(new c.constructor(c.buffer, 0, t));
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
|
-
const
|
|
2952
|
-
class
|
|
2951
|
+
const Fe = /* @__PURE__ */ new d.Box3(), N = /* @__PURE__ */ new d.Vector3(), F = /* @__PURE__ */ new d.LineSegments(), le = [];
|
|
2952
|
+
class Ei extends d.LineSegments {
|
|
2953
2953
|
constructor(e = 1e3, t = e * 2, i) {
|
|
2954
2954
|
super(new d.BufferGeometry(), i), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e, this._maxIndexCount = t;
|
|
2955
2955
|
}
|
|
@@ -2965,7 +2965,7 @@ class Pi extends d.LineSegments {
|
|
|
2965
2965
|
get mappingStats() {
|
|
2966
2966
|
const e = this._geometryInfo.length;
|
|
2967
2967
|
let t = 0;
|
|
2968
|
-
return e > 0 && (t =
|
|
2968
|
+
return e > 0 && (t = he.estimateObjectSize(this._geometryInfo[0])), {
|
|
2969
2969
|
count: e,
|
|
2970
2970
|
size: e * t
|
|
2971
2971
|
};
|
|
@@ -2974,7 +2974,7 @@ class Pi extends d.LineSegments {
|
|
|
2974
2974
|
const t = this.geometry, i = this._maxVertexCount, n = this._maxIndexCount;
|
|
2975
2975
|
if (this._geometryInitialized === !1) {
|
|
2976
2976
|
for (const s in e.attributes) {
|
|
2977
|
-
const
|
|
2977
|
+
const r = e.getAttribute(s), { array: o, itemSize: a, normalized: h } = r, l = new o.constructor(i * a), m = new d.BufferAttribute(
|
|
2978
2978
|
l,
|
|
2979
2979
|
a,
|
|
2980
2980
|
h
|
|
@@ -3012,8 +3012,8 @@ class Pi extends d.LineSegments {
|
|
|
3012
3012
|
let n = this._maxIndexCount;
|
|
3013
3013
|
i && this.unusedIndexCount < t.count && (n = (this._maxIndexCount + t.count) * 1.5);
|
|
3014
3014
|
const s = e.getAttribute("position");
|
|
3015
|
-
let
|
|
3016
|
-
s && this.unusedVertexCount < s.count && (
|
|
3015
|
+
let r = this._maxVertexCount;
|
|
3016
|
+
s && this.unusedVertexCount < s.count && (r = (this._maxVertexCount + s.count) * 1.5), (n > this._maxIndexCount || r > this._maxVertexCount) && this.setGeometrySize(r, n);
|
|
3017
3017
|
}
|
|
3018
3018
|
validateGeometryId(e) {
|
|
3019
3019
|
const t = this._geometryInfo;
|
|
@@ -3038,13 +3038,13 @@ class Pi extends d.LineSegments {
|
|
|
3038
3038
|
resetGeometry(e) {
|
|
3039
3039
|
const t = this.getUserData();
|
|
3040
3040
|
this.reset();
|
|
3041
|
-
const i =
|
|
3041
|
+
const i = O.instance;
|
|
3042
3042
|
t.forEach((n) => {
|
|
3043
3043
|
if (n.position) {
|
|
3044
3044
|
const s = i.create(e, n.position);
|
|
3045
3045
|
if (s.line) {
|
|
3046
|
-
const
|
|
3047
|
-
this.setGeometryInfo(
|
|
3046
|
+
const r = this.addGeometry(s.line);
|
|
3047
|
+
this.setGeometryInfo(r, n);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
3050
3050
|
});
|
|
@@ -3087,13 +3087,13 @@ class Pi extends d.LineSegments {
|
|
|
3087
3087
|
visible: !0
|
|
3088
3088
|
}, s = this._geometryInfo;
|
|
3089
3089
|
n.vertexStart = this._nextVertexStart, n.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
|
|
3090
|
-
const
|
|
3091
|
-
if (
|
|
3090
|
+
const r = e.getIndex();
|
|
3091
|
+
if (r !== null && (n.indexStart = this._nextIndexStart, n.reservedIndexCount = i === -1 ? r.count : i), n.indexStart !== -1 && n.indexStart + n.reservedIndexCount > this._maxIndexCount || n.vertexStart + n.reservedVertexCount > this._maxVertexCount)
|
|
3092
3092
|
throw new Error(
|
|
3093
3093
|
"AcTrBatchedLine: Reserved space request exceeds the maximum buffer size."
|
|
3094
3094
|
);
|
|
3095
|
-
let
|
|
3096
|
-
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(
|
|
3095
|
+
let o;
|
|
3096
|
+
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Te), o = this._availableGeometryIds.shift(), s[o] = n) : (o = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(o, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, o;
|
|
3097
3097
|
}
|
|
3098
3098
|
setGeometryInfo(e, t) {
|
|
3099
3099
|
if (e >= this._geometryCount)
|
|
@@ -3105,18 +3105,18 @@ class Pi extends d.LineSegments {
|
|
|
3105
3105
|
if (e >= this._geometryCount)
|
|
3106
3106
|
throw new Error("AcTrBatchedLine: Maximum geometry count reached.");
|
|
3107
3107
|
this._validateGeometry(t);
|
|
3108
|
-
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(),
|
|
3109
|
-
if (n &&
|
|
3108
|
+
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(), r = t.getIndex(), o = this._geometryInfo[e];
|
|
3109
|
+
if (n && r.count > o.reservedIndexCount || t.attributes.position.count > o.reservedVertexCount)
|
|
3110
3110
|
throw new Error(
|
|
3111
3111
|
"AcTrBatchedLine: Reserved space not large enough for provided geometry."
|
|
3112
3112
|
);
|
|
3113
|
-
const a =
|
|
3114
|
-
|
|
3113
|
+
const a = o.vertexStart, h = o.reservedVertexCount;
|
|
3114
|
+
o.vertexCount = t.getAttribute("position").count;
|
|
3115
3115
|
for (const l in i.attributes) {
|
|
3116
3116
|
const m = t.getAttribute(l), u = i.getAttribute(
|
|
3117
3117
|
l
|
|
3118
3118
|
);
|
|
3119
|
-
|
|
3119
|
+
De(m, u, a);
|
|
3120
3120
|
const p = m.itemSize;
|
|
3121
3121
|
for (let g = m.count, y = h; g < y; g++) {
|
|
3122
3122
|
const f = a + g;
|
|
@@ -3129,15 +3129,15 @@ class Pi extends d.LineSegments {
|
|
|
3129
3129
|
);
|
|
3130
3130
|
}
|
|
3131
3131
|
if (n && s) {
|
|
3132
|
-
const l =
|
|
3133
|
-
|
|
3134
|
-
for (let u = 0; u <
|
|
3135
|
-
s.setX(l + u, a +
|
|
3136
|
-
for (let u =
|
|
3132
|
+
const l = o.indexStart, m = o.reservedIndexCount;
|
|
3133
|
+
o.indexCount = t.getIndex().count;
|
|
3134
|
+
for (let u = 0; u < r.count; u++)
|
|
3135
|
+
s.setX(l + u, a + r.getX(u));
|
|
3136
|
+
for (let u = r.count, p = m; u < p; u++)
|
|
3137
3137
|
s.setX(l + u, a);
|
|
3138
|
-
s.needsUpdate = !0, s.addUpdateRange(l,
|
|
3138
|
+
s.needsUpdate = !0, s.addUpdateRange(l, o.reservedIndexCount);
|
|
3139
3139
|
}
|
|
3140
|
-
return
|
|
3140
|
+
return o.start = n ? o.indexStart : o.vertexStart, o.count = n ? o.indexCount : o.vertexCount, o.boundingBox = null, t.boundingBox !== null && (o.boundingBox = t.boundingBox.clone()), o.boundingSphere = null, t.boundingSphere !== null && (o.boundingSphere = t.boundingSphere.clone()), e;
|
|
3141
3141
|
}
|
|
3142
3142
|
deleteGeometry(e) {
|
|
3143
3143
|
const t = this._geometryInfo;
|
|
@@ -3145,9 +3145,9 @@ class Pi extends d.LineSegments {
|
|
|
3145
3145
|
}
|
|
3146
3146
|
optimize() {
|
|
3147
3147
|
let e = 0, t = 0;
|
|
3148
|
-
const i = this._geometryInfo, n = i.map((
|
|
3149
|
-
for (let
|
|
3150
|
-
const a = n[
|
|
3148
|
+
const i = this._geometryInfo, n = i.map((r, o) => o).sort((r, o) => i[r].vertexStart - i[o].vertexStart), s = this.geometry;
|
|
3149
|
+
for (let r = 0, o = i.length; r < o; r++) {
|
|
3150
|
+
const a = n[r], h = i[a];
|
|
3151
3151
|
if (h.active !== !1) {
|
|
3152
3152
|
if (s.index !== null) {
|
|
3153
3153
|
if (h.indexStart !== t) {
|
|
@@ -3188,10 +3188,10 @@ class Pi extends d.LineSegments {
|
|
|
3188
3188
|
return null;
|
|
3189
3189
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3190
3190
|
if (n.boundingBox === null) {
|
|
3191
|
-
const s = new d.Box3(),
|
|
3191
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3192
3192
|
for (let a = n.start, h = n.start + n.count; a < h; a++) {
|
|
3193
3193
|
let l = a;
|
|
3194
|
-
|
|
3194
|
+
r && (l = r.getX(l)), s.expandByPoint(N.fromBufferAttribute(o, l));
|
|
3195
3195
|
}
|
|
3196
3196
|
n.boundingBox = s;
|
|
3197
3197
|
}
|
|
@@ -3204,14 +3204,14 @@ class Pi extends d.LineSegments {
|
|
|
3204
3204
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3205
3205
|
if (n.boundingSphere === null) {
|
|
3206
3206
|
const s = new d.Sphere();
|
|
3207
|
-
this.getBoundingBoxAt(e,
|
|
3208
|
-
const
|
|
3207
|
+
this.getBoundingBoxAt(e, Fe), Fe.getCenter(s.center);
|
|
3208
|
+
const r = i.index, o = i.attributes.position;
|
|
3209
3209
|
let a = 0;
|
|
3210
3210
|
for (let h = n.start, l = n.start + n.count; h < l; h++) {
|
|
3211
3211
|
let m = h;
|
|
3212
|
-
|
|
3212
|
+
r && (m = r.getX(m)), N.fromBufferAttribute(o, m), a = Math.max(
|
|
3213
3213
|
a,
|
|
3214
|
-
s.center.distanceToSquared(
|
|
3214
|
+
s.center.distanceToSquared(N)
|
|
3215
3215
|
);
|
|
3216
3216
|
}
|
|
3217
3217
|
s.radius = Math.sqrt(a), n.boundingSphere = s;
|
|
@@ -3231,9 +3231,9 @@ class Pi extends d.LineSegments {
|
|
|
3231
3231
|
const i = this.geometry;
|
|
3232
3232
|
i.dispose(), this._maxVertexCount = e, this._maxIndexCount = t, this._geometryInitialized && (this._geometryInitialized = !1, this.geometry = new d.BufferGeometry(), this._initializeGeometry(i));
|
|
3233
3233
|
const n = this.geometry;
|
|
3234
|
-
i.index &&
|
|
3234
|
+
i.index && Z(i.index.array, n.index.array);
|
|
3235
3235
|
for (const s in i.attributes)
|
|
3236
|
-
|
|
3236
|
+
Z(
|
|
3237
3237
|
i.attributes[s].array,
|
|
3238
3238
|
n.attributes[s].array
|
|
3239
3239
|
);
|
|
@@ -3260,18 +3260,18 @@ class Pi extends d.LineSegments {
|
|
|
3260
3260
|
e.geometry.index = null, e.geometry.attributes = {}, e.geometry.setDrawRange(0, 1 / 0);
|
|
3261
3261
|
}
|
|
3262
3262
|
intersectWith(e, t, i) {
|
|
3263
|
-
this._initializeRaycastObject(
|
|
3263
|
+
this._initializeRaycastObject(F), this._intersectWith(e, t, i), this._resetRaycastObjectInfo(F);
|
|
3264
3264
|
}
|
|
3265
3265
|
_intersectWith(e, t, i) {
|
|
3266
3266
|
const n = this._geometryInfo[e];
|
|
3267
3267
|
if (!(!n.visible || !n.active))
|
|
3268
3268
|
if (n.bboxIntersectionCheck) {
|
|
3269
3269
|
const s = n.boundingBox;
|
|
3270
|
-
if (t.ray.intersectBox(s,
|
|
3271
|
-
const
|
|
3270
|
+
if (t.ray.intersectBox(s, N)) {
|
|
3271
|
+
const r = t.ray.origin.distanceTo(N);
|
|
3272
3272
|
i.push({
|
|
3273
|
-
distance:
|
|
3274
|
-
point:
|
|
3273
|
+
distance: r,
|
|
3274
|
+
point: N.clone(),
|
|
3275
3275
|
object: this,
|
|
3276
3276
|
face: null,
|
|
3277
3277
|
faceIndex: void 0,
|
|
@@ -3283,24 +3283,24 @@ class Pi extends d.LineSegments {
|
|
|
3283
3283
|
}
|
|
3284
3284
|
} else {
|
|
3285
3285
|
this._setRaycastObjectInfo(
|
|
3286
|
-
|
|
3286
|
+
F,
|
|
3287
3287
|
e,
|
|
3288
3288
|
n.start,
|
|
3289
3289
|
n.count
|
|
3290
|
-
),
|
|
3291
|
-
for (let s = 0,
|
|
3292
|
-
const
|
|
3293
|
-
|
|
3290
|
+
), F.raycast(t, le);
|
|
3291
|
+
for (let s = 0, r = le.length; s < r; s++) {
|
|
3292
|
+
const o = le[s];
|
|
3293
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3294
3294
|
}
|
|
3295
|
-
|
|
3295
|
+
le.length = 0;
|
|
3296
3296
|
}
|
|
3297
3297
|
}
|
|
3298
3298
|
raycast(e, t) {
|
|
3299
3299
|
const i = this._geometryInfo;
|
|
3300
|
-
this._initializeRaycastObject(
|
|
3300
|
+
this._initializeRaycastObject(F);
|
|
3301
3301
|
for (let n = 0, s = i.length; n < s; n++)
|
|
3302
3302
|
this._intersectWith(n, e, t);
|
|
3303
|
-
this._resetRaycastObjectInfo(
|
|
3303
|
+
this._resetRaycastObjectInfo(F);
|
|
3304
3304
|
}
|
|
3305
3305
|
copy(e) {
|
|
3306
3306
|
return super.copy(e), this.geometry = e.geometry.clone(), this.boundingBox = e.boundingBox !== null ? e.boundingBox.clone() : null, this.boundingSphere = e.boundingSphere !== null ? e.boundingSphere.clone() : null, this._geometryInfo = e._geometryInfo.map((t) => ({
|
|
@@ -3313,8 +3313,8 @@ class Pi extends d.LineSegments {
|
|
|
3313
3313
|
return this.geometry.dispose(), this;
|
|
3314
3314
|
}
|
|
3315
3315
|
}
|
|
3316
|
-
const
|
|
3317
|
-
class
|
|
3316
|
+
const Ue = /* @__PURE__ */ new d.Box3(), U = /* @__PURE__ */ new d.Vector3(), W = /* @__PURE__ */ new d.Mesh(), de = [];
|
|
3317
|
+
class Ti extends d.Mesh {
|
|
3318
3318
|
constructor(e = 1e3, t = e * 2, i) {
|
|
3319
3319
|
super(new d.BufferGeometry(), i), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e, this._maxIndexCount = t;
|
|
3320
3320
|
}
|
|
@@ -3327,7 +3327,7 @@ class Ri extends d.Mesh {
|
|
|
3327
3327
|
get mappingStats() {
|
|
3328
3328
|
const e = this._geometryInfo.length;
|
|
3329
3329
|
let t = 0;
|
|
3330
|
-
return e > 0 && (t =
|
|
3330
|
+
return e > 0 && (t = he.estimateObjectSize(this._geometryInfo[0])), {
|
|
3331
3331
|
count: e,
|
|
3332
3332
|
size: e * t
|
|
3333
3333
|
};
|
|
@@ -3336,7 +3336,7 @@ class Ri extends d.Mesh {
|
|
|
3336
3336
|
const t = this.geometry, i = this._maxVertexCount, n = this._maxIndexCount;
|
|
3337
3337
|
if (this._geometryInitialized === !1) {
|
|
3338
3338
|
for (const s in e.attributes) {
|
|
3339
|
-
const
|
|
3339
|
+
const r = e.getAttribute(s), { array: o, itemSize: a, normalized: h } = r, l = new o.constructor(i * a), m = new d.BufferAttribute(
|
|
3340
3340
|
l,
|
|
3341
3341
|
a,
|
|
3342
3342
|
h
|
|
@@ -3374,8 +3374,8 @@ class Ri extends d.Mesh {
|
|
|
3374
3374
|
let n = this._maxIndexCount;
|
|
3375
3375
|
i && this.unusedIndexCount < t.count && (n = (this._maxIndexCount + t.count) * 1.5);
|
|
3376
3376
|
const s = e.getAttribute("position");
|
|
3377
|
-
let
|
|
3378
|
-
s && this.unusedVertexCount < s.count && (
|
|
3377
|
+
let r = this._maxVertexCount;
|
|
3378
|
+
s && this.unusedVertexCount < s.count && (r = (this._maxVertexCount + s.count) * 1.5), (n > this._maxIndexCount || r > this._maxVertexCount) && this.setGeometrySize(r, n);
|
|
3379
3379
|
}
|
|
3380
3380
|
validateGeometryId(e) {
|
|
3381
3381
|
const t = this._geometryInfo;
|
|
@@ -3422,13 +3422,13 @@ class Ri extends d.Mesh {
|
|
|
3422
3422
|
visible: !0
|
|
3423
3423
|
}, s = this._geometryInfo;
|
|
3424
3424
|
n.vertexStart = this._nextVertexStart, n.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
|
|
3425
|
-
const
|
|
3426
|
-
if (
|
|
3425
|
+
const r = e.getIndex();
|
|
3426
|
+
if (r !== null && (n.indexStart = this._nextIndexStart, n.reservedIndexCount = i === -1 ? r.count : i), n.indexStart !== -1 && n.indexStart + n.reservedIndexCount > this._maxIndexCount || n.vertexStart + n.reservedVertexCount > this._maxVertexCount)
|
|
3427
3427
|
throw new Error(
|
|
3428
3428
|
"AcTrBatchedMesh: Reserved space request exceeds the maximum buffer size."
|
|
3429
3429
|
);
|
|
3430
|
-
let
|
|
3431
|
-
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(
|
|
3430
|
+
let o;
|
|
3431
|
+
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Te), o = this._availableGeometryIds.shift(), s[o] = n) : (o = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(o, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, o;
|
|
3432
3432
|
}
|
|
3433
3433
|
setGeometryInfo(e, t) {
|
|
3434
3434
|
if (e >= this._geometryCount)
|
|
@@ -3440,18 +3440,18 @@ class Ri extends d.Mesh {
|
|
|
3440
3440
|
if (e >= this._geometryCount)
|
|
3441
3441
|
throw new Error("AcTrBatchedMesh: Maximum geometry count reached.");
|
|
3442
3442
|
this._validateGeometry(t);
|
|
3443
|
-
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(),
|
|
3444
|
-
if (n &&
|
|
3443
|
+
const i = this.geometry, n = i.getIndex() !== null, s = i.getIndex(), r = t.getIndex(), o = this._geometryInfo[e];
|
|
3444
|
+
if (n && r.count > o.reservedIndexCount || t.attributes.position.count > o.reservedVertexCount)
|
|
3445
3445
|
throw new Error(
|
|
3446
3446
|
"AcTrBatchedMesh: Reserved space not large enough for provided geometry."
|
|
3447
3447
|
);
|
|
3448
|
-
const a =
|
|
3449
|
-
|
|
3448
|
+
const a = o.vertexStart, h = o.reservedVertexCount;
|
|
3449
|
+
o.vertexCount = t.getAttribute("position").count;
|
|
3450
3450
|
for (const l in i.attributes) {
|
|
3451
3451
|
const m = t.getAttribute(l), u = i.getAttribute(
|
|
3452
3452
|
l
|
|
3453
3453
|
);
|
|
3454
|
-
|
|
3454
|
+
De(m, u, a);
|
|
3455
3455
|
const p = m.itemSize;
|
|
3456
3456
|
for (let g = m.count, y = h; g < y; g++) {
|
|
3457
3457
|
const f = a + g;
|
|
@@ -3464,15 +3464,15 @@ class Ri extends d.Mesh {
|
|
|
3464
3464
|
);
|
|
3465
3465
|
}
|
|
3466
3466
|
if (n && s) {
|
|
3467
|
-
const l =
|
|
3468
|
-
|
|
3469
|
-
for (let u = 0; u <
|
|
3470
|
-
s.setX(l + u, a +
|
|
3471
|
-
for (let u =
|
|
3467
|
+
const l = o.indexStart, m = o.reservedIndexCount;
|
|
3468
|
+
o.indexCount = t.getIndex().count;
|
|
3469
|
+
for (let u = 0; u < r.count; u++)
|
|
3470
|
+
s.setX(l + u, a + r.getX(u));
|
|
3471
|
+
for (let u = r.count, p = m; u < p; u++)
|
|
3472
3472
|
s.setX(l + u, a);
|
|
3473
|
-
s.needsUpdate = !0, s.addUpdateRange(l,
|
|
3473
|
+
s.needsUpdate = !0, s.addUpdateRange(l, o.reservedIndexCount);
|
|
3474
3474
|
}
|
|
3475
|
-
return
|
|
3475
|
+
return o.start = n ? o.indexStart : o.vertexStart, o.count = n ? o.indexCount : o.vertexCount, o.boundingBox = null, t.boundingBox !== null && (o.boundingBox = t.boundingBox.clone()), o.boundingSphere = null, t.boundingSphere !== null && (o.boundingSphere = t.boundingSphere.clone()), e;
|
|
3476
3476
|
}
|
|
3477
3477
|
deleteGeometry(e) {
|
|
3478
3478
|
const t = this._geometryInfo;
|
|
@@ -3480,9 +3480,9 @@ class Ri extends d.Mesh {
|
|
|
3480
3480
|
}
|
|
3481
3481
|
optimize() {
|
|
3482
3482
|
let e = 0, t = 0;
|
|
3483
|
-
const i = this._geometryInfo, n = i.map((
|
|
3484
|
-
for (let
|
|
3485
|
-
const a = n[
|
|
3483
|
+
const i = this._geometryInfo, n = i.map((r, o) => o).sort((r, o) => i[r].vertexStart - i[o].vertexStart), s = this.geometry;
|
|
3484
|
+
for (let r = 0, o = i.length; r < o; r++) {
|
|
3485
|
+
const a = n[r], h = i[a];
|
|
3486
3486
|
if (h.active !== !1) {
|
|
3487
3487
|
if (s.index !== null) {
|
|
3488
3488
|
if (h.indexStart !== t) {
|
|
@@ -3523,10 +3523,10 @@ class Ri extends d.Mesh {
|
|
|
3523
3523
|
return null;
|
|
3524
3524
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3525
3525
|
if (n.boundingBox === null) {
|
|
3526
|
-
const s = new d.Box3(),
|
|
3526
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3527
3527
|
for (let a = n.start, h = n.start + n.count; a < h; a++) {
|
|
3528
3528
|
let l = a;
|
|
3529
|
-
|
|
3529
|
+
r && (l = r.getX(l)), s.expandByPoint(U.fromBufferAttribute(o, l));
|
|
3530
3530
|
}
|
|
3531
3531
|
n.boundingBox = s;
|
|
3532
3532
|
}
|
|
@@ -3539,12 +3539,12 @@ class Ri extends d.Mesh {
|
|
|
3539
3539
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3540
3540
|
if (n.boundingSphere === null) {
|
|
3541
3541
|
const s = new d.Sphere();
|
|
3542
|
-
this.getBoundingBoxAt(e,
|
|
3543
|
-
const
|
|
3542
|
+
this.getBoundingBoxAt(e, Ue), Ue.getCenter(s.center);
|
|
3543
|
+
const r = i.index, o = i.attributes.position;
|
|
3544
3544
|
let a = 0;
|
|
3545
3545
|
for (let h = n.start, l = n.start + n.count; h < l; h++) {
|
|
3546
3546
|
let m = h;
|
|
3547
|
-
|
|
3547
|
+
r && (m = r.getX(m)), U.fromBufferAttribute(o, m), a = Math.max(
|
|
3548
3548
|
a,
|
|
3549
3549
|
s.center.distanceToSquared(U)
|
|
3550
3550
|
);
|
|
@@ -3566,9 +3566,9 @@ class Ri extends d.Mesh {
|
|
|
3566
3566
|
const i = this.geometry;
|
|
3567
3567
|
i.dispose(), this._maxVertexCount = e, this._maxIndexCount = t, this._geometryInitialized && (this._geometryInitialized = !1, this.geometry = new d.BufferGeometry(), this._initializeGeometry(i));
|
|
3568
3568
|
const n = this.geometry;
|
|
3569
|
-
i.index &&
|
|
3569
|
+
i.index && Z(i.index.array, n.index.array);
|
|
3570
3570
|
for (const s in i.attributes)
|
|
3571
|
-
|
|
3571
|
+
Z(
|
|
3572
3572
|
i.attributes[s].array,
|
|
3573
3573
|
n.attributes[s].array
|
|
3574
3574
|
);
|
|
@@ -3603,9 +3603,9 @@ class Ri extends d.Mesh {
|
|
|
3603
3603
|
if (n.bboxIntersectionCheck) {
|
|
3604
3604
|
const s = n.boundingBox;
|
|
3605
3605
|
if (t.ray.intersectBox(s, U)) {
|
|
3606
|
-
const
|
|
3606
|
+
const r = t.ray.origin.distanceTo(U);
|
|
3607
3607
|
i.push({
|
|
3608
|
-
distance:
|
|
3608
|
+
distance: r,
|
|
3609
3609
|
point: U.clone(),
|
|
3610
3610
|
object: this,
|
|
3611
3611
|
face: null,
|
|
@@ -3622,12 +3622,12 @@ class Ri extends d.Mesh {
|
|
|
3622
3622
|
e,
|
|
3623
3623
|
n.start,
|
|
3624
3624
|
n.count
|
|
3625
|
-
), W.raycast(t,
|
|
3626
|
-
for (let s = 0,
|
|
3627
|
-
const
|
|
3628
|
-
|
|
3625
|
+
), W.raycast(t, de);
|
|
3626
|
+
for (let s = 0, r = de.length; s < r; s++) {
|
|
3627
|
+
const o = de[s];
|
|
3628
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3629
3629
|
}
|
|
3630
|
-
|
|
3630
|
+
de.length = 0;
|
|
3631
3631
|
}
|
|
3632
3632
|
}
|
|
3633
3633
|
raycast(e, t) {
|
|
@@ -3648,8 +3648,8 @@ class Ri extends d.Mesh {
|
|
|
3648
3648
|
return this.geometry.dispose(), this;
|
|
3649
3649
|
}
|
|
3650
3650
|
}
|
|
3651
|
-
const
|
|
3652
|
-
class
|
|
3651
|
+
const We = /* @__PURE__ */ new d.Box3(), X = /* @__PURE__ */ new d.Vector3(), $ = /* @__PURE__ */ new d.Points(), ue = [];
|
|
3652
|
+
class Di extends d.Points {
|
|
3653
3653
|
constructor(e = 1e3, t) {
|
|
3654
3654
|
super(new d.BufferGeometry(), t), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e;
|
|
3655
3655
|
}
|
|
@@ -3662,7 +3662,7 @@ class Oi extends d.Points {
|
|
|
3662
3662
|
get mappingStats() {
|
|
3663
3663
|
const e = this._geometryInfo.length;
|
|
3664
3664
|
let t = 0;
|
|
3665
|
-
return e > 0 && (t =
|
|
3665
|
+
return e > 0 && (t = he.estimateObjectSize(this._geometryInfo[0])), {
|
|
3666
3666
|
count: e,
|
|
3667
3667
|
size: e * t
|
|
3668
3668
|
};
|
|
@@ -3671,9 +3671,9 @@ class Oi extends d.Points {
|
|
|
3671
3671
|
const t = this.geometry, i = this._maxVertexCount;
|
|
3672
3672
|
if (this._geometryInitialized === !1) {
|
|
3673
3673
|
for (const n in e.attributes) {
|
|
3674
|
-
const s = e.getAttribute(n), { array:
|
|
3674
|
+
const s = e.getAttribute(n), { array: r, itemSize: o, normalized: a } = s, h = new r.constructor(i * o), l = new d.BufferAttribute(
|
|
3675
3675
|
h,
|
|
3676
|
-
|
|
3676
|
+
o,
|
|
3677
3677
|
a
|
|
3678
3678
|
);
|
|
3679
3679
|
t.setAttribute(n, l);
|
|
@@ -3744,7 +3744,7 @@ class Oi extends d.Points {
|
|
|
3744
3744
|
}, n = this._geometryInfo;
|
|
3745
3745
|
i.vertexStart = this._nextVertexStart, i.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
|
|
3746
3746
|
let s;
|
|
3747
|
-
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(
|
|
3747
|
+
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Te), s = this._availableGeometryIds.shift(), n[s] = i) : (s = this._geometryCount, this._geometryCount++, n.push(i)), this.setGeometryAt(s, e), this._nextVertexStart = i.vertexStart + i.reservedVertexCount, this.geometry.setDrawRange(0, this._nextVertexStart), s;
|
|
3748
3748
|
}
|
|
3749
3749
|
setGeometryInfo(e, t) {
|
|
3750
3750
|
if (e >= this._geometryCount)
|
|
@@ -3756,22 +3756,22 @@ class Oi extends d.Points {
|
|
|
3756
3756
|
if (e >= this._geometryCount)
|
|
3757
3757
|
throw new Error("AcTrBatchedLine: Maximum geometry count reached.");
|
|
3758
3758
|
this._validateGeometry(t);
|
|
3759
|
-
const i = this.geometry, n = this._geometryInfo[e], s = n.vertexStart,
|
|
3759
|
+
const i = this.geometry, n = this._geometryInfo[e], s = n.vertexStart, r = n.reservedVertexCount;
|
|
3760
3760
|
n.vertexCount = t.getAttribute("position").count;
|
|
3761
|
-
for (const
|
|
3762
|
-
const a = t.getAttribute(
|
|
3763
|
-
|
|
3761
|
+
for (const o in i.attributes) {
|
|
3762
|
+
const a = t.getAttribute(o), h = i.getAttribute(
|
|
3763
|
+
o
|
|
3764
3764
|
);
|
|
3765
|
-
|
|
3765
|
+
De(a, h, s);
|
|
3766
3766
|
const l = a.itemSize;
|
|
3767
|
-
for (let m = a.count, u =
|
|
3767
|
+
for (let m = a.count, u = r; m < u; m++) {
|
|
3768
3768
|
const p = s + m;
|
|
3769
3769
|
for (let g = 0; g < l; g++)
|
|
3770
3770
|
h.setComponent(p, g, 0);
|
|
3771
3771
|
}
|
|
3772
3772
|
h.needsUpdate = !0, h.addUpdateRange(
|
|
3773
3773
|
s * l,
|
|
3774
|
-
|
|
3774
|
+
r * l
|
|
3775
3775
|
);
|
|
3776
3776
|
}
|
|
3777
3777
|
return n.boundingBox = null, t.boundingBox !== null && (n.boundingBox = t.boundingBox.clone()), n.boundingSphere = null, t.boundingSphere !== null && (n.boundingSphere = t.boundingSphere.clone()), e;
|
|
@@ -3782,9 +3782,9 @@ class Oi extends d.Points {
|
|
|
3782
3782
|
}
|
|
3783
3783
|
optimize() {
|
|
3784
3784
|
let e = 0;
|
|
3785
|
-
const t = this._geometryInfo, i = t.map((s,
|
|
3786
|
-
for (let s = 0,
|
|
3787
|
-
const
|
|
3785
|
+
const t = this._geometryInfo, i = t.map((s, r) => r).sort((s, r) => t[s].vertexStart - t[r].vertexStart), n = this.geometry;
|
|
3786
|
+
for (let s = 0, r = t.length; s < r; s++) {
|
|
3787
|
+
const o = i[s], a = t[o];
|
|
3788
3788
|
if (a.active !== !1) {
|
|
3789
3789
|
if (a.vertexStart !== e) {
|
|
3790
3790
|
const { vertexStart: h, reservedVertexCount: l } = a, m = n.attributes;
|
|
@@ -3812,10 +3812,10 @@ class Oi extends d.Points {
|
|
|
3812
3812
|
return null;
|
|
3813
3813
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3814
3814
|
if (n.boundingBox === null) {
|
|
3815
|
-
const s = new d.Box3(),
|
|
3815
|
+
const s = new d.Box3(), r = i.index, o = i.attributes.position;
|
|
3816
3816
|
for (let a = n.vertexStart, h = n.vertexStart + n.vertexCount; a < h; a++) {
|
|
3817
3817
|
let l = a;
|
|
3818
|
-
|
|
3818
|
+
r && (l = r.getX(l)), s.expandByPoint(X.fromBufferAttribute(o, l));
|
|
3819
3819
|
}
|
|
3820
3820
|
n.boundingBox = s;
|
|
3821
3821
|
}
|
|
@@ -3828,12 +3828,12 @@ class Oi extends d.Points {
|
|
|
3828
3828
|
const i = this.geometry, n = this._geometryInfo[e];
|
|
3829
3829
|
if (n.boundingSphere === null) {
|
|
3830
3830
|
const s = new d.Sphere();
|
|
3831
|
-
this.getBoundingBoxAt(e,
|
|
3832
|
-
const
|
|
3831
|
+
this.getBoundingBoxAt(e, We), We.getCenter(s.center);
|
|
3832
|
+
const r = i.index, o = i.attributes.position;
|
|
3833
3833
|
let a = 0;
|
|
3834
3834
|
for (let h = n.vertexStart, l = n.vertexStart + n.vertexCount; h < l; h++) {
|
|
3835
3835
|
let m = h;
|
|
3836
|
-
|
|
3836
|
+
r && (m = r.getX(m)), X.fromBufferAttribute(o, m), a = Math.max(
|
|
3837
3837
|
a,
|
|
3838
3838
|
s.center.distanceToSquared(X)
|
|
3839
3839
|
);
|
|
@@ -3855,9 +3855,9 @@ class Oi extends d.Points {
|
|
|
3855
3855
|
const t = this.geometry;
|
|
3856
3856
|
t.dispose(), this._maxVertexCount = e, this._geometryInitialized && (this._geometryInitialized = !1, this.geometry = new d.BufferGeometry(), this._initializeGeometry(t));
|
|
3857
3857
|
const i = this.geometry;
|
|
3858
|
-
t.index &&
|
|
3858
|
+
t.index && Z(t.index.array, i.index.array);
|
|
3859
3859
|
for (const n in t.attributes)
|
|
3860
|
-
|
|
3860
|
+
Z(
|
|
3861
3861
|
t.attributes[n].array,
|
|
3862
3862
|
i.attributes[n].array
|
|
3863
3863
|
);
|
|
@@ -3892,9 +3892,9 @@ class Oi extends d.Points {
|
|
|
3892
3892
|
if (n.bboxIntersectionCheck) {
|
|
3893
3893
|
const s = n.boundingBox;
|
|
3894
3894
|
if (t.ray.intersectBox(s, X)) {
|
|
3895
|
-
const
|
|
3895
|
+
const r = t.ray.origin.distanceTo(X);
|
|
3896
3896
|
i.push({
|
|
3897
|
-
distance:
|
|
3897
|
+
distance: r,
|
|
3898
3898
|
point: X.clone(),
|
|
3899
3899
|
object: this,
|
|
3900
3900
|
face: null,
|
|
@@ -3911,12 +3911,12 @@ class Oi extends d.Points {
|
|
|
3911
3911
|
e,
|
|
3912
3912
|
n.vertexStart,
|
|
3913
3913
|
n.vertexCount
|
|
3914
|
-
), $.raycast(t,
|
|
3915
|
-
for (let s = 0,
|
|
3916
|
-
const
|
|
3917
|
-
|
|
3914
|
+
), $.raycast(t, ue);
|
|
3915
|
+
for (let s = 0, r = ue.length; s < r; s++) {
|
|
3916
|
+
const o = ue[s];
|
|
3917
|
+
o.object = this, o.batchId = e, o.objectId = n.objectId, i.push(o);
|
|
3918
3918
|
}
|
|
3919
|
-
|
|
3919
|
+
ue.length = 0;
|
|
3920
3920
|
}
|
|
3921
3921
|
}
|
|
3922
3922
|
raycast(e, t) {
|
|
@@ -3937,7 +3937,7 @@ class Oi extends d.Points {
|
|
|
3937
3937
|
return this.geometry.dispose(), this;
|
|
3938
3938
|
}
|
|
3939
3939
|
}
|
|
3940
|
-
class
|
|
3940
|
+
class zi extends d.Group {
|
|
3941
3941
|
constructor() {
|
|
3942
3942
|
super(), this._pointBatches = /* @__PURE__ */ new Map(), this._pointSymbolBatches = /* @__PURE__ */ new Map(), this._lineBatches = /* @__PURE__ */ new Map(), this._lineWithIndexBatches = /* @__PURE__ */ new Map(), this._meshBatches = /* @__PURE__ */ new Map(), this._meshWithIndexBatches = /* @__PURE__ */ new Map(), this._entitiesMap = /* @__PURE__ */ new Map(), this._selectedObjects = new d.Group(), this._hoverObjects = new d.Group(), this.add(this._selectedObjects), this.add(this._hoverObjects);
|
|
3943
3943
|
}
|
|
@@ -4003,7 +4003,7 @@ class Vi extends d.Group {
|
|
|
4003
4003
|
return e.summary.totalGeometrySize = e.line.indexed.geometrySize + e.line.nonIndexed.geometrySize + e.mesh.indexed.geometrySize + e.mesh.nonIndexed.geometrySize + e.point.indexed.geometrySize + e.point.nonIndexed.geometrySize, e.summary.totalMappingSize = e.line.indexed.mappingSize + e.line.nonIndexed.mappingSize + e.mesh.indexed.mappingSize + e.mesh.nonIndexed.mappingSize + e.point.indexed.mappingSize + e.point.nonIndexed.mappingSize, e;
|
|
4004
4004
|
}
|
|
4005
4005
|
rerenderPoints(e) {
|
|
4006
|
-
const t =
|
|
4006
|
+
const t = O.instance.create(e);
|
|
4007
4007
|
t.line && this._pointSymbolBatches.forEach((n) => {
|
|
4008
4008
|
n.resetGeometry(e);
|
|
4009
4009
|
});
|
|
@@ -4065,11 +4065,11 @@ class Vi extends d.Group {
|
|
|
4065
4065
|
const i = this._entitiesMap.get(e);
|
|
4066
4066
|
if (i) {
|
|
4067
4067
|
const n = [];
|
|
4068
|
-
for (let s = 0,
|
|
4069
|
-
const
|
|
4068
|
+
for (let s = 0, r = i.length; s < r; s++) {
|
|
4069
|
+
const o = i[s];
|
|
4070
4070
|
if (this.getObjectById(
|
|
4071
|
-
|
|
4072
|
-
).intersectWith(
|
|
4071
|
+
o.batchedObjectId
|
|
4072
|
+
).intersectWith(o.batchId, t, n), n.length > 0) return !0;
|
|
4073
4073
|
}
|
|
4074
4074
|
}
|
|
4075
4075
|
return !1;
|
|
@@ -4091,8 +4091,8 @@ class Vi extends d.Group {
|
|
|
4091
4091
|
i && i.forEach((n) => {
|
|
4092
4092
|
const s = this.getObjectById(
|
|
4093
4093
|
n.batchedObjectId
|
|
4094
|
-
).getObjectAt(n.batchId),
|
|
4095
|
-
|
|
4094
|
+
).getObjectAt(n.batchId), r = we.cloneMaterial(s.material);
|
|
4095
|
+
we.setMaterialColor(r), s.material = r, s.userData.objectId = e, t.add(s);
|
|
4096
4096
|
});
|
|
4097
4097
|
}
|
|
4098
4098
|
unhighlight(e, t) {
|
|
@@ -4104,27 +4104,27 @@ class Vi extends d.Group {
|
|
|
4104
4104
|
addLine(e, t) {
|
|
4105
4105
|
const i = e.material, n = this.getMatchedLineBatches(e);
|
|
4106
4106
|
let s = n.get(i.id);
|
|
4107
|
-
s == null && (s = new
|
|
4108
|
-
const
|
|
4109
|
-
return s.setGeometryInfo(
|
|
4107
|
+
s == null && (s = new Ei(1e3, 2e3, i), n.set(i.id, s), this.add(s)), e.geometry.applyMatrix4(e.matrixWorld);
|
|
4108
|
+
const r = s.addGeometry(e.geometry);
|
|
4109
|
+
return s.setGeometryInfo(r, t), {
|
|
4110
4110
|
batchedObjectId: s.id,
|
|
4111
|
-
batchId:
|
|
4111
|
+
batchId: r
|
|
4112
4112
|
};
|
|
4113
4113
|
}
|
|
4114
4114
|
addMesh(e, t) {
|
|
4115
4115
|
const i = e.material, n = this.getMatchedMeshBatches(e);
|
|
4116
4116
|
let s = n.get(i.id);
|
|
4117
|
-
s == null && (s = new
|
|
4118
|
-
const
|
|
4119
|
-
return s.setGeometryInfo(
|
|
4117
|
+
s == null && (s = new Ti(1e3, 2e3, i), n.set(i.id, s), this.add(s)), e.geometry.applyMatrix4(e.matrixWorld);
|
|
4118
|
+
const r = s.addGeometry(e.geometry);
|
|
4119
|
+
return s.setGeometryInfo(r, t), {
|
|
4120
4120
|
batchedObjectId: s.id,
|
|
4121
|
-
batchId:
|
|
4121
|
+
batchId: r
|
|
4122
4122
|
};
|
|
4123
4123
|
}
|
|
4124
4124
|
addPoint(e, t) {
|
|
4125
4125
|
const i = e.material;
|
|
4126
4126
|
let n = this._pointBatches.get(i.id);
|
|
4127
|
-
n == null && (n = new
|
|
4127
|
+
n == null && (n = new Di(100, i), n.visible = e.visible, this._pointBatches.set(i.id, n), this.add(n)), e.geometry.applyMatrix4(e.matrixWorld);
|
|
4128
4128
|
const s = n.addGeometry(e.geometry);
|
|
4129
4129
|
return n.setGeometryInfo(s, t), {
|
|
4130
4130
|
batchedObjectId: n.id,
|
|
@@ -4171,7 +4171,7 @@ class Vi extends d.Group {
|
|
|
4171
4171
|
return t;
|
|
4172
4172
|
}
|
|
4173
4173
|
}
|
|
4174
|
-
class
|
|
4174
|
+
class rt extends be {
|
|
4175
4175
|
constructor(e) {
|
|
4176
4176
|
super(), this._styleManager = e;
|
|
4177
4177
|
}
|
|
@@ -4185,7 +4185,7 @@ class xt extends Se {
|
|
|
4185
4185
|
return this._styleManager = e._styleManager, super.copy(e, t);
|
|
4186
4186
|
}
|
|
4187
4187
|
}
|
|
4188
|
-
class E extends
|
|
4188
|
+
class E extends rt {
|
|
4189
4189
|
constructor(e) {
|
|
4190
4190
|
super(e), this._objectId = "", this._ownerId = "", this._layerName = "", this._box = new d.Box3();
|
|
4191
4191
|
}
|
|
@@ -4266,8 +4266,8 @@ class E extends xt {
|
|
|
4266
4266
|
if ("material" in e) {
|
|
4267
4267
|
const t = e.material;
|
|
4268
4268
|
if (e.userData.originalMaterial == null) {
|
|
4269
|
-
const i =
|
|
4270
|
-
|
|
4269
|
+
const i = we.cloneMaterial(t);
|
|
4270
|
+
we.setMaterialColor(i), e.userData.originalMaterial = e.material, e.material = i;
|
|
4271
4271
|
}
|
|
4272
4272
|
} else e.children.length > 0 && e.children.forEach((t) => {
|
|
4273
4273
|
this.highlightObject(t);
|
|
@@ -4315,13 +4315,13 @@ class E extends xt {
|
|
|
4315
4315
|
});
|
|
4316
4316
|
}
|
|
4317
4317
|
createColorArray(e, t) {
|
|
4318
|
-
const i = (e >> 16 & 255) / 256, n = (e >> 8 & 255) / 256, s = (e & 255) / 256,
|
|
4319
|
-
for (let
|
|
4320
|
-
|
|
4321
|
-
return
|
|
4318
|
+
const i = (e >> 16 & 255) / 256, n = (e >> 8 & 255) / 256, s = (e & 255) / 256, r = new Float32Array(t * 3);
|
|
4319
|
+
for (let o = 0, a = 0; o < t; o++)
|
|
4320
|
+
r[a] = i, r[a + 1] = n, r[a + 2] = s, a += 3;
|
|
4321
|
+
return r;
|
|
4322
4322
|
}
|
|
4323
4323
|
}
|
|
4324
|
-
const
|
|
4324
|
+
const ot = class H {
|
|
4325
4325
|
constructor() {
|
|
4326
4326
|
}
|
|
4327
4327
|
/**
|
|
@@ -4350,7 +4350,7 @@ const _t = class H {
|
|
|
4350
4350
|
* @param workerUrl - URL to the worker script
|
|
4351
4351
|
*/
|
|
4352
4352
|
initialize(e) {
|
|
4353
|
-
this._renderer = new
|
|
4353
|
+
this._renderer = new Xt("worker", { workerUrl: e });
|
|
4354
4354
|
}
|
|
4355
4355
|
/**
|
|
4356
4356
|
* Dispose of the renderer and reset the singleton
|
|
@@ -4359,9 +4359,9 @@ const _t = class H {
|
|
|
4359
4359
|
this._renderer && (this._renderer.destroy(), this._renderer = void 0), H._instance = null;
|
|
4360
4360
|
}
|
|
4361
4361
|
};
|
|
4362
|
-
|
|
4363
|
-
let
|
|
4364
|
-
class
|
|
4362
|
+
ot._instance = null;
|
|
4363
|
+
let Le = ot;
|
|
4364
|
+
class Pi extends E {
|
|
4365
4365
|
constructor(e, t) {
|
|
4366
4366
|
super(t), e.forEach((i) => {
|
|
4367
4367
|
if (Array.isArray(i)) {
|
|
@@ -4372,17 +4372,17 @@ class ji extends E {
|
|
|
4372
4372
|
}), this.flatten();
|
|
4373
4373
|
}
|
|
4374
4374
|
}
|
|
4375
|
-
class
|
|
4375
|
+
class Oi extends E {
|
|
4376
4376
|
constructor(e, t, i) {
|
|
4377
4377
|
super(i);
|
|
4378
4378
|
const n = URL.createObjectURL(e), s = new d.TextureLoader().load(n);
|
|
4379
4379
|
s.colorSpace = d.SRGBColorSpace;
|
|
4380
|
-
const
|
|
4380
|
+
const r = new d.MeshBasicMaterial({
|
|
4381
4381
|
side: d.DoubleSide,
|
|
4382
4382
|
map: s
|
|
4383
|
-
}),
|
|
4383
|
+
}), o = new d.Shape(t.boundary), a = new d.ShapeGeometry(o);
|
|
4384
4384
|
this.generateUVs(a);
|
|
4385
|
-
const h = new d.Mesh(a,
|
|
4385
|
+
const h = new d.Mesh(a, r);
|
|
4386
4386
|
this.add(h);
|
|
4387
4387
|
}
|
|
4388
4388
|
/**
|
|
@@ -4391,16 +4391,16 @@ class Gi extends E {
|
|
|
4391
4391
|
* @param geometry Input geometry to generate UVs
|
|
4392
4392
|
*/
|
|
4393
4393
|
generateUVs(e) {
|
|
4394
|
-
const t = e.attributes.position.array, i = new Float32Array(t.length / 3 * 2), n = Math.min(...t.filter((l, m) => m % 3 === 0)), s = Math.max(...t.filter((l, m) => m % 3 === 0)),
|
|
4394
|
+
const t = e.attributes.position.array, i = new Float32Array(t.length / 3 * 2), n = Math.min(...t.filter((l, m) => m % 3 === 0)), s = Math.max(...t.filter((l, m) => m % 3 === 0)), r = Math.min(...t.filter((l, m) => m % 3 === 1)), o = Math.max(...t.filter((l, m) => m % 3 === 1)), a = s - n, h = o - r;
|
|
4395
4395
|
for (let l = 0; l < t.length; l += 3) {
|
|
4396
4396
|
const m = t[l], u = t[l + 1];
|
|
4397
|
-
i[l / 3 * 2] = (m - n) / a, i[l / 3 * 2 + 1] = (u -
|
|
4397
|
+
i[l / 3 * 2] = (m - n) / a, i[l / 3 * 2 + 1] = (u - r) / h;
|
|
4398
4398
|
}
|
|
4399
4399
|
e.setAttribute("uv", new d.BufferAttribute(i, 2));
|
|
4400
4400
|
}
|
|
4401
4401
|
}
|
|
4402
|
-
const
|
|
4403
|
-
class
|
|
4402
|
+
const me = /* @__PURE__ */ new d.Vector3(), ge = /* @__PURE__ */ new d.Vector3();
|
|
4403
|
+
class ae {
|
|
4404
4404
|
/**
|
|
4405
4405
|
* Release memeory occupied by buffer geometry
|
|
4406
4406
|
* @param geometry
|
|
@@ -4418,7 +4418,7 @@ class le {
|
|
|
4418
4418
|
for (const n in e.attributes)
|
|
4419
4419
|
t.setAttribute(
|
|
4420
4420
|
n,
|
|
4421
|
-
|
|
4421
|
+
ae.createGeometryAttributeByIndex(
|
|
4422
4422
|
e.attributes[n],
|
|
4423
4423
|
i
|
|
4424
4424
|
)
|
|
@@ -4426,13 +4426,13 @@ class le {
|
|
|
4426
4426
|
return t;
|
|
4427
4427
|
}
|
|
4428
4428
|
static createGeometryAttributeByIndex(e, t) {
|
|
4429
|
-
const i = t.count, n = e.itemSize, s = e.array.constructor,
|
|
4430
|
-
for (let
|
|
4431
|
-
const a = t.getX(
|
|
4429
|
+
const i = t.count, n = e.itemSize, s = e.array.constructor, r = new s(i * n);
|
|
4430
|
+
for (let o = 0; o < i; o++) {
|
|
4431
|
+
const a = t.getX(o) * n;
|
|
4432
4432
|
for (let h = 0; h < n; h++)
|
|
4433
|
-
o
|
|
4433
|
+
r[o * n + h] = e.array[a + h];
|
|
4434
4434
|
}
|
|
4435
|
-
return new d.BufferAttribute(
|
|
4435
|
+
return new d.BufferAttribute(r, n, e.normalized);
|
|
4436
4436
|
}
|
|
4437
4437
|
/**
|
|
4438
4438
|
* Converts InterleavedBufferAttribute to BufferAttribute, because mergeGeometries doesn't support InterleavedBufferAttribute.
|
|
@@ -4449,9 +4449,9 @@ class le {
|
|
|
4449
4449
|
}
|
|
4450
4450
|
static createBufferGeometryByPoints(e) {
|
|
4451
4451
|
const t = new d.BufferGeometry(), i = new Float32Array(e.length * 3), n = new Uint16Array((e.length - 1) * 2);
|
|
4452
|
-
return e.forEach((s,
|
|
4453
|
-
let
|
|
4454
|
-
i[
|
|
4452
|
+
return e.forEach((s, r) => {
|
|
4453
|
+
let o = r * 3;
|
|
4454
|
+
i[o] = s.x, i[o + 1] = s.y, i[o + 2] = s.z, r > 0 && (o = (r - 1) * 2, n[o] = r - 1, n[o + 1] = r);
|
|
4455
4455
|
}), t.setAttribute(
|
|
4456
4456
|
"position",
|
|
4457
4457
|
new d.Float32BufferAttribute(i, 3)
|
|
@@ -4462,22 +4462,22 @@ class le {
|
|
|
4462
4462
|
const t = e.isLineSegments === !0;
|
|
4463
4463
|
let i = e.geometry;
|
|
4464
4464
|
const n = e.matrixWorld;
|
|
4465
|
-
if (i.index && (i =
|
|
4465
|
+
if (i.index && (i = ae.toNonIndexed(i)), i.index === null) {
|
|
4466
4466
|
const s = i.attributes.position;
|
|
4467
4467
|
if (!s || s.count === 0)
|
|
4468
4468
|
return;
|
|
4469
|
-
const
|
|
4469
|
+
const r = [];
|
|
4470
4470
|
if (t)
|
|
4471
|
-
for (let
|
|
4472
|
-
|
|
4471
|
+
for (let o = 0, a = s.count; o < a; o += 2)
|
|
4472
|
+
me.fromBufferAttribute(s, o).applyMatrix4(n), ge.fromBufferAttribute(s, o + 1).applyMatrix4(n), r[o] = o === 0 ? 0 : r[o - 1], r[o + 1] = r[o] + me.distanceTo(ge);
|
|
4473
4473
|
else {
|
|
4474
|
-
|
|
4475
|
-
for (let
|
|
4476
|
-
|
|
4474
|
+
r[0] = 0;
|
|
4475
|
+
for (let o = 1, a = s.count; o < a; o++)
|
|
4476
|
+
me.fromBufferAttribute(s, o - 1).applyMatrix4(n), ge.fromBufferAttribute(s, o).applyMatrix4(n), r[o] = r[o - 1], r[o] += me.distanceTo(ge);
|
|
4477
4477
|
}
|
|
4478
4478
|
i.setAttribute(
|
|
4479
4479
|
"lineDistance",
|
|
4480
|
-
new d.Float32BufferAttribute(
|
|
4480
|
+
new d.Float32BufferAttribute(r, 1)
|
|
4481
4481
|
), e.geometry.dispose(), e.geometry = i;
|
|
4482
4482
|
}
|
|
4483
4483
|
}
|
|
@@ -4495,16 +4495,16 @@ class le {
|
|
|
4495
4495
|
* @param scale Input scale factor
|
|
4496
4496
|
*/
|
|
4497
4497
|
static apply2dTransform(e, t, i = 0, n = 1) {
|
|
4498
|
-
const s = e.attributes.position,
|
|
4498
|
+
const s = e.attributes.position, r = s.itemSize, o = s.array;
|
|
4499
4499
|
if (i != 0) {
|
|
4500
4500
|
const a = Math.cos(i), h = Math.sin(i);
|
|
4501
|
-
for (let l = 0; l <
|
|
4502
|
-
const m =
|
|
4503
|
-
|
|
4501
|
+
for (let l = 0; l < o.length; l += r) {
|
|
4502
|
+
const m = o[l], u = o[l + 1], p = m * a - u * h, g = m * h + u * a;
|
|
4503
|
+
o[l] = p * n + t.x, o[l + 1] = g * n + t.y;
|
|
4504
4504
|
}
|
|
4505
4505
|
} else
|
|
4506
|
-
for (let a = 0; a <
|
|
4507
|
-
|
|
4506
|
+
for (let a = 0; a < o.length; a += r)
|
|
4507
|
+
o[a] = o[a] * n + t.x, o[a + 1] += o[a + 1] * n + t.y;
|
|
4508
4508
|
return s.needsUpdate = !0, e;
|
|
4509
4509
|
}
|
|
4510
4510
|
/**
|
|
@@ -4514,58 +4514,58 @@ class le {
|
|
|
4514
4514
|
* @param rotation Input roatation (in radians) around x-axis, y-axis, and z-axis
|
|
4515
4515
|
*/
|
|
4516
4516
|
static apply3dTransform(e, t, i) {
|
|
4517
|
-
const n = e.attributes.position, s = n.itemSize,
|
|
4518
|
-
for (let p = 0; p <
|
|
4519
|
-
let g =
|
|
4517
|
+
const n = e.attributes.position, s = n.itemSize, r = n.array, o = Math.cos(i.x), a = Math.sin(i.x), h = Math.cos(i.y), l = Math.sin(i.y), m = Math.cos(i.z), u = Math.sin(i.z);
|
|
4518
|
+
for (let p = 0; p < r.length; p += s) {
|
|
4519
|
+
let g = r[p], y = r[p + 1], f = r[p + 2], _ = y * o - f * a, x = y * a + f * o;
|
|
4520
4520
|
y = _, f = x;
|
|
4521
4521
|
let w = g * h + f * l;
|
|
4522
|
-
x = -g * l + f * h, g = w, f = x, w = g * m - y * u, _ = g * u + y * m, g = w, y = _,
|
|
4522
|
+
x = -g * l + f * h, g = w, f = x, w = g * m - y * u, _ = g * u + y * m, g = w, y = _, r[p] = g + t.x, r[p + 1] = y + t.y, r[p + 2] = f + t.z;
|
|
4523
4523
|
}
|
|
4524
4524
|
return n.needsUpdate = !0, e;
|
|
4525
4525
|
}
|
|
4526
4526
|
}
|
|
4527
|
-
class
|
|
4527
|
+
class Ri extends E {
|
|
4528
4528
|
constructor(e, t, i) {
|
|
4529
4529
|
super(i);
|
|
4530
4530
|
let n;
|
|
4531
4531
|
const s = t ? t.color : 16777215;
|
|
4532
4532
|
t ? n = this.styleManager.getLineShaderMaterial(t, 1) : n = new d.LineBasicMaterial({ color: s });
|
|
4533
|
-
const
|
|
4534
|
-
for (let m = 0, u = 0; m <
|
|
4533
|
+
const r = e.length, o = new Float32Array(r * 3), a = r * 2 > 65535 ? new Uint32Array(r * 2) : new Uint16Array(r * 2);
|
|
4534
|
+
for (let m = 0, u = 0; m < r; m++) {
|
|
4535
4535
|
const p = e[m];
|
|
4536
|
-
|
|
4536
|
+
o[u++] = p.x, o[u++] = p.y, o[u++] = p.z ?? 0;
|
|
4537
4537
|
}
|
|
4538
|
-
for (let m = 0, u = 0; m <
|
|
4538
|
+
for (let m = 0, u = 0; m < r - 1; m++)
|
|
4539
4539
|
a[u++] = m, a[u++] = m + 1;
|
|
4540
4540
|
const h = new d.BufferGeometry();
|
|
4541
|
-
h.setAttribute("position", new d.BufferAttribute(
|
|
4541
|
+
h.setAttribute("position", new d.BufferAttribute(o, 3)), h.setIndex(new d.BufferAttribute(a, 1)), this.setBoundingBox(h), this.geometry = h;
|
|
4542
4542
|
const l = new d.LineSegments(h, n);
|
|
4543
|
-
|
|
4543
|
+
ae.computeLineDistances(l), this.add(l);
|
|
4544
4544
|
}
|
|
4545
4545
|
setBoundingBox(e) {
|
|
4546
4546
|
e.computeBoundingBox(), this.box = e.boundingBox;
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
4549
|
-
class
|
|
4549
|
+
class Vi extends E {
|
|
4550
4550
|
constructor(e, t, i, n, s) {
|
|
4551
4551
|
super(s);
|
|
4552
|
-
let
|
|
4553
|
-
n ?
|
|
4554
|
-
const
|
|
4555
|
-
|
|
4552
|
+
let r;
|
|
4553
|
+
n ? r = this.styleManager.getLineShaderMaterial(n, 1) : r = new d.LineBasicMaterial({ color: 16777215 });
|
|
4554
|
+
const o = new d.BufferGeometry();
|
|
4555
|
+
o.setAttribute(
|
|
4556
4556
|
"position",
|
|
4557
4557
|
new d.BufferAttribute(e, t)
|
|
4558
|
-
),
|
|
4559
|
-
const a = new d.LineSegments(
|
|
4560
|
-
|
|
4558
|
+
), o.setIndex(new d.BufferAttribute(i, 1)), o.computeBoundingBox(), this.box = o.boundingBox;
|
|
4559
|
+
const a = new d.LineSegments(o, r);
|
|
4560
|
+
ae.computeLineDistances(a), this.add(a);
|
|
4561
4561
|
}
|
|
4562
4562
|
}
|
|
4563
|
-
class
|
|
4563
|
+
class ji extends E {
|
|
4564
4564
|
constructor(e, t, i) {
|
|
4565
4565
|
super(i), this._text = e, this._style = t;
|
|
4566
4566
|
}
|
|
4567
4567
|
async draw() {
|
|
4568
|
-
const e =
|
|
4568
|
+
const e = Le.getInstance();
|
|
4569
4569
|
if (e)
|
|
4570
4570
|
try {
|
|
4571
4571
|
const t = this._style;
|
|
@@ -4595,19 +4595,19 @@ class Ni extends E {
|
|
|
4595
4595
|
return e != null && e.bigFont && e.bigFont.toUpperCase().startsWith("GB") ? "gbk" : "utf8";
|
|
4596
4596
|
}
|
|
4597
4597
|
}
|
|
4598
|
-
const
|
|
4599
|
-
class
|
|
4598
|
+
const Gi = /* @__PURE__ */ new d.Vector3();
|
|
4599
|
+
class ki extends E {
|
|
4600
4600
|
constructor(e, t, i) {
|
|
4601
4601
|
super(i);
|
|
4602
|
-
const n =
|
|
4602
|
+
const n = O.instance.create(
|
|
4603
4603
|
t.displayMode,
|
|
4604
4604
|
e
|
|
4605
4605
|
);
|
|
4606
4606
|
this.isShowPoint = n.point != null;
|
|
4607
|
-
const s = n.point ?? new d.BufferGeometry().setFromPoints([
|
|
4607
|
+
const s = n.point ?? new d.BufferGeometry().setFromPoints([Gi.copy(e)]);
|
|
4608
4608
|
s.computeBoundingBox(), s.boundingBox && this.box.union(s.boundingBox);
|
|
4609
|
-
const
|
|
4610
|
-
if (
|
|
4609
|
+
const r = this.styleManager.getPointsMaterial(t.color), o = new d.Points(s, r);
|
|
4610
|
+
if (o.userData.bboxIntersectionCheck = !0, o.visible = this.isShowPoint, this.add(o), n.line) {
|
|
4611
4611
|
const a = n.line;
|
|
4612
4612
|
a.computeBoundingBox(), a.boundingBox && this.box.union(a.boundingBox);
|
|
4613
4613
|
const h = this.styleManager.getLineBasicMaterial(t.color), l = new d.LineSegments(a, h);
|
|
@@ -4615,14 +4615,14 @@ class Wi extends E {
|
|
|
4615
4615
|
}
|
|
4616
4616
|
}
|
|
4617
4617
|
}
|
|
4618
|
-
class
|
|
4618
|
+
class Ni extends E {
|
|
4619
4619
|
constructor(e, t, i) {
|
|
4620
4620
|
var n;
|
|
4621
4621
|
super(i);
|
|
4622
|
-
const s = e.getPoints(100),
|
|
4623
|
-
this.buildHatchGeometry(s,
|
|
4622
|
+
const s = e.getPoints(100), r = e.buildHierarchy(), o = [];
|
|
4623
|
+
this.buildHatchGeometry(s, r, o);
|
|
4624
4624
|
let a;
|
|
4625
|
-
if (
|
|
4625
|
+
if (o.length > 0 && (a = $t(o)), !a || !a.getIndex() || ((n = a.getIndex()) == null ? void 0 : n.count) === 0)
|
|
4626
4626
|
console.warn("Failed to convert hatch boundaries!");
|
|
4627
4627
|
else {
|
|
4628
4628
|
a.computeBoundingBox(), this.box = a.boundingBox;
|
|
@@ -4643,7 +4643,7 @@ class Xi extends E {
|
|
|
4643
4643
|
a.children.map((h) => h.index)
|
|
4644
4644
|
);
|
|
4645
4645
|
});
|
|
4646
|
-
const
|
|
4646
|
+
const r = (a) => {
|
|
4647
4647
|
try {
|
|
4648
4648
|
const h = new d.ShapeGeometry(a);
|
|
4649
4649
|
h.hasAttribute("uv") && h.deleteAttribute("uv"), h.hasAttribute("normal") && h.deleteAttribute("normal"), i.push(h);
|
|
@@ -4658,9 +4658,9 @@ class Xi extends E {
|
|
|
4658
4658
|
if (h.length === 0)
|
|
4659
4659
|
return;
|
|
4660
4660
|
const l = new d.Shape(h);
|
|
4661
|
-
|
|
4661
|
+
r(l);
|
|
4662
4662
|
});
|
|
4663
|
-
const
|
|
4663
|
+
const o = (a) => a.map((h) => h.toArray());
|
|
4664
4664
|
for (const a of s) {
|
|
4665
4665
|
const h = new d.Shape(
|
|
4666
4666
|
e[a[0]]
|
|
@@ -4678,15 +4678,15 @@ class Xi extends E {
|
|
|
4678
4678
|
try {
|
|
4679
4679
|
p.forEach((f, _) => {
|
|
4680
4680
|
y = Math.min(e[f][0].relativeEps(), 1e-6);
|
|
4681
|
-
const x = new
|
|
4681
|
+
const x = new st(new nt(y));
|
|
4682
4682
|
if (_ === 0)
|
|
4683
4683
|
g = x.segments({
|
|
4684
|
-
regions: [
|
|
4684
|
+
regions: [o(e[f])],
|
|
4685
4685
|
inverted: !1
|
|
4686
4686
|
});
|
|
4687
4687
|
else {
|
|
4688
4688
|
const w = x.segments({
|
|
4689
|
-
regions: [
|
|
4689
|
+
regions: [o(e[f])],
|
|
4690
4690
|
inverted: !1
|
|
4691
4691
|
}), b = x.combine(g, w);
|
|
4692
4692
|
l = x.polygon(x.selectUnion(b)), l.regions.length > 0 ? l.regions.forEach((I) => {
|
|
@@ -4710,7 +4710,7 @@ class Xi extends E {
|
|
|
4710
4710
|
new d.Path(e[g])
|
|
4711
4711
|
);
|
|
4712
4712
|
}
|
|
4713
|
-
|
|
4713
|
+
r(h);
|
|
4714
4714
|
}
|
|
4715
4715
|
t.children.forEach((a) => {
|
|
4716
4716
|
a.children.forEach((h) => {
|
|
@@ -4721,28 +4721,28 @@ class Xi extends E {
|
|
|
4721
4721
|
findIntersectHole(e, t) {
|
|
4722
4722
|
const i = t.length, n = [];
|
|
4723
4723
|
for (let s = 0; s < i; s++) {
|
|
4724
|
-
const
|
|
4725
|
-
let
|
|
4724
|
+
const r = e[t[s]];
|
|
4725
|
+
let o = !1;
|
|
4726
4726
|
const a = [];
|
|
4727
4727
|
for (let h = s + 1; h < i; h++) {
|
|
4728
4728
|
const l = e[t[h]];
|
|
4729
|
-
|
|
4730
|
-
|
|
4729
|
+
dt.isPolygonIntersect(
|
|
4730
|
+
r,
|
|
4731
4731
|
l
|
|
4732
|
-
) && (
|
|
4732
|
+
) && (o = !0, a.push(t[h]));
|
|
4733
4733
|
}
|
|
4734
|
-
|
|
4734
|
+
o && (a.push(t[s]), n.push(a));
|
|
4735
4735
|
}
|
|
4736
4736
|
return n;
|
|
4737
4737
|
}
|
|
4738
4738
|
}
|
|
4739
|
-
function
|
|
4739
|
+
function Fi(c, e, t, i, n = 0) {
|
|
4740
4740
|
const s = {
|
|
4741
4741
|
u_cameraZoom: t,
|
|
4742
4742
|
u_patternLines: { value: c },
|
|
4743
4743
|
u_patternAngle: { value: e },
|
|
4744
4744
|
u_color: { value: i }
|
|
4745
|
-
},
|
|
4745
|
+
}, r = (
|
|
4746
4746
|
/*glsl*/
|
|
4747
4747
|
`
|
|
4748
4748
|
varying vec3 v_pos;
|
|
@@ -4756,7 +4756,7 @@ function $i(c, e, t, i, n = 0) {
|
|
|
4756
4756
|
#include <project_vertex>
|
|
4757
4757
|
#include <clipping_planes_vertex>
|
|
4758
4758
|
}`
|
|
4759
|
-
),
|
|
4759
|
+
), o = (
|
|
4760
4760
|
/*glsl*/
|
|
4761
4761
|
`
|
|
4762
4762
|
uniform mat4 modelMatrix;
|
|
@@ -4951,28 +4951,28 @@ function $i(c, e, t, i, n = 0) {
|
|
|
4951
4951
|
);
|
|
4952
4952
|
return new d.ShaderMaterial({
|
|
4953
4953
|
uniforms: s,
|
|
4954
|
-
vertexShader:
|
|
4955
|
-
fragmentShader:
|
|
4954
|
+
vertexShader: r,
|
|
4955
|
+
fragmentShader: o,
|
|
4956
4956
|
clipping: !0
|
|
4957
4957
|
});
|
|
4958
4958
|
}
|
|
4959
|
-
class
|
|
4959
|
+
class Ui {
|
|
4960
4960
|
/**
|
|
4961
4961
|
* Creates line shader by given pattern.
|
|
4962
4962
|
* Note: remember to call line.computeLineDistances() in order to make it work!
|
|
4963
4963
|
*/
|
|
4964
4964
|
static createLineShaderMaterial(e, t, i, n, s) {
|
|
4965
|
-
let
|
|
4966
|
-
const
|
|
4965
|
+
let r = 0;
|
|
4966
|
+
const o = [];
|
|
4967
4967
|
for (let m = 0; m < e.length; m++)
|
|
4968
|
-
|
|
4969
|
-
for (let m = 0; m <
|
|
4970
|
-
|
|
4968
|
+
o[m] = e[m].elementLength * i, r += Math.abs(o[m]);
|
|
4969
|
+
for (let m = 0; m < o.length; m++)
|
|
4970
|
+
o[m] === 0 && (o[m] = r * 0.01 * i, r += o[m]);
|
|
4971
4971
|
const a = d.UniformsUtils.merge([
|
|
4972
4972
|
d.UniformsLib.common,
|
|
4973
4973
|
{
|
|
4974
|
-
pattern: { value:
|
|
4975
|
-
patternLength: { value:
|
|
4974
|
+
pattern: { value: o },
|
|
4975
|
+
patternLength: { value: r },
|
|
4976
4976
|
u_color: { value: new d.Color(t) }
|
|
4977
4977
|
}
|
|
4978
4978
|
]);
|
|
@@ -5047,7 +5047,7 @@ class Yi {
|
|
|
5047
5047
|
});
|
|
5048
5048
|
}
|
|
5049
5049
|
}
|
|
5050
|
-
const
|
|
5050
|
+
const xe = class ne {
|
|
5051
5051
|
constructor() {
|
|
5052
5052
|
this.pointMaterials = {}, this.lineShaderMaterials = {}, this.lineBasicMaterials = {}, this.hatchShaderMaterials = [], this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
|
|
5053
5053
|
}
|
|
@@ -5071,12 +5071,12 @@ const we = class oe {
|
|
|
5071
5071
|
getLineShaderMaterial(e, t) {
|
|
5072
5072
|
if (e.pattern && e.pattern.length !== 0) {
|
|
5073
5073
|
const i = `${e.name}_${e.color}_${t}`;
|
|
5074
|
-
return this.lineShaderMaterials[i] || (this.lineShaderMaterials[i] =
|
|
5074
|
+
return this.lineShaderMaterials[i] || (this.lineShaderMaterials[i] = Ui.createLineShaderMaterial(
|
|
5075
5075
|
e.pattern,
|
|
5076
5076
|
e.color,
|
|
5077
5077
|
t,
|
|
5078
|
-
|
|
5079
|
-
|
|
5078
|
+
ne.ViewportScaleUniform,
|
|
5079
|
+
ne.CameraZoomUniform
|
|
5080
5080
|
)), this.lineShaderMaterials[i];
|
|
5081
5081
|
} else
|
|
5082
5082
|
return this.getLineBasicMaterial(e.color);
|
|
@@ -5091,12 +5091,12 @@ const we = class oe {
|
|
|
5091
5091
|
const n = this.findMatchedHatchShaderMaterial(e);
|
|
5092
5092
|
if (n)
|
|
5093
5093
|
return n;
|
|
5094
|
-
const s = 5e-3,
|
|
5095
|
-
let
|
|
5094
|
+
const s = 5e-3, r = 0.05;
|
|
5095
|
+
let o = 2;
|
|
5096
5096
|
e.patternLines.forEach((u) => {
|
|
5097
|
-
|
|
5097
|
+
o = Math.max(
|
|
5098
5098
|
u.dashPattern.length,
|
|
5099
|
-
|
|
5099
|
+
o
|
|
5100
5100
|
);
|
|
5101
5101
|
});
|
|
5102
5102
|
let a = 0;
|
|
@@ -5122,14 +5122,14 @@ const we = class oe {
|
|
|
5122
5122
|
const G = u.dashPattern[v];
|
|
5123
5123
|
G > 0 && (f = !1), _ += Math.abs(G);
|
|
5124
5124
|
}
|
|
5125
|
-
const x = f ?
|
|
5125
|
+
const x = f ? r : s, w = [], b = [];
|
|
5126
5126
|
let I = 0;
|
|
5127
5127
|
b[0] = I;
|
|
5128
5128
|
for (let v = 0; v < y; ++v)
|
|
5129
5129
|
w[v] = u.dashPattern[v], w[v] === 0 && (w[v] = x * _), I += Math.abs(w[v]), b[v + 1] = I;
|
|
5130
|
-
for (let v = y; v <
|
|
5130
|
+
for (let v = y; v < o; ++v)
|
|
5131
5131
|
w[v] = 0;
|
|
5132
|
-
for (let v = b.length; v <
|
|
5132
|
+
for (let v = b.length; v < o + 1; ++v)
|
|
5133
5133
|
b[v] = I;
|
|
5134
5134
|
const P = {
|
|
5135
5135
|
origin: p,
|
|
@@ -5139,7 +5139,7 @@ const we = class oe {
|
|
|
5139
5139
|
patternSum: b,
|
|
5140
5140
|
patternLength: I
|
|
5141
5141
|
};
|
|
5142
|
-
if (a += 4, a +=
|
|
5142
|
+
if (a += 4, a += o, a += o + 1, a > ne.MaxFragmentUniforms) {
|
|
5143
5143
|
console.warn(
|
|
5144
5144
|
"There will be warning in fragment shader when number of uniforms exceeds 1024, so extra hatch line patterns are ignored here!"
|
|
5145
5145
|
);
|
|
@@ -5147,14 +5147,14 @@ const we = class oe {
|
|
|
5147
5147
|
}
|
|
5148
5148
|
h.push(P);
|
|
5149
5149
|
}
|
|
5150
|
-
const m =
|
|
5150
|
+
const m = Fi(
|
|
5151
5151
|
h,
|
|
5152
5152
|
e.patternAngle,
|
|
5153
|
-
|
|
5153
|
+
ne.CameraZoomUniform,
|
|
5154
5154
|
new d.Color(e.color)
|
|
5155
5155
|
);
|
|
5156
5156
|
return m.defines = {
|
|
5157
|
-
MAX_PATTERN_SEGMENT_COUNT:
|
|
5157
|
+
MAX_PATTERN_SEGMENT_COUNT: o
|
|
5158
5158
|
}, this.hatchShaderMaterials.push({
|
|
5159
5159
|
patternLines: e.patternLines,
|
|
5160
5160
|
patternAngle: e.patternAngle,
|
|
@@ -5173,24 +5173,24 @@ const we = class oe {
|
|
|
5173
5173
|
if (!i(a[l], h[l]))
|
|
5174
5174
|
return !1;
|
|
5175
5175
|
return !0;
|
|
5176
|
-
}, s = (a, h) => i(a.angle, h.angle) && i(a.delta.x, h.delta.x) && i(a.delta.y, h.delta.y) && i(a.origin.x, h.origin.x) && i(a.origin.y, h.origin.y) && n(a.dashPattern, h.dashPattern),
|
|
5176
|
+
}, s = (a, h) => i(a.angle, h.angle) && i(a.delta.x, h.delta.x) && i(a.delta.y, h.delta.y) && i(a.origin.x, h.origin.x) && i(a.origin.y, h.origin.y) && n(a.dashPattern, h.dashPattern), r = (a, h) => {
|
|
5177
5177
|
if (a.length !== h.length)
|
|
5178
5178
|
return !1;
|
|
5179
5179
|
for (let l = 0; l < a.length; ++l)
|
|
5180
5180
|
if (!s(a[l], h[l]))
|
|
5181
5181
|
return !1;
|
|
5182
5182
|
return !0;
|
|
5183
|
-
},
|
|
5184
|
-
return
|
|
5183
|
+
}, o = this.hatchShaderMaterials.find((a) => a.color === e.color && a.patternAngle === e.patternAngle && r(a.patternLines, t));
|
|
5184
|
+
return o == null ? void 0 : o.material;
|
|
5185
5185
|
}
|
|
5186
5186
|
};
|
|
5187
|
-
|
|
5188
|
-
let
|
|
5189
|
-
class
|
|
5187
|
+
xe.CameraZoomUniform = { value: 1 }, xe.ViewportScaleUniform = { value: 1 }, xe.MaxFragmentUniforms = 1024;
|
|
5188
|
+
let Wi = xe;
|
|
5189
|
+
class Xi {
|
|
5190
5190
|
constructor(e) {
|
|
5191
5191
|
this.events = {
|
|
5192
5192
|
fontNotFound: new M()
|
|
5193
|
-
}, this._renderer = e, this._styleManager = new
|
|
5193
|
+
}, this._renderer = e, this._styleManager = new Wi(), J.instance.events.fontNotFound.addEventListener((t) => {
|
|
5194
5194
|
this.events.fontNotFound.dispatch(t);
|
|
5195
5195
|
});
|
|
5196
5196
|
}
|
|
@@ -5258,31 +5258,31 @@ class qi {
|
|
|
5258
5258
|
return this._renderer;
|
|
5259
5259
|
}
|
|
5260
5260
|
async loadFonts(e) {
|
|
5261
|
-
return await
|
|
5261
|
+
return await J.instance.loadFontsByUrls(e);
|
|
5262
5262
|
}
|
|
5263
5263
|
/**
|
|
5264
5264
|
* @inheritdoc
|
|
5265
5265
|
*/
|
|
5266
5266
|
setFontMapping(e) {
|
|
5267
|
-
|
|
5267
|
+
J.instance.setFontMapping(e);
|
|
5268
5268
|
}
|
|
5269
5269
|
/**
|
|
5270
5270
|
* Fonts list which can't be found
|
|
5271
5271
|
*/
|
|
5272
5272
|
get missedFonts() {
|
|
5273
|
-
return
|
|
5273
|
+
return J.instance.missedFonts;
|
|
5274
5274
|
}
|
|
5275
5275
|
/**
|
|
5276
5276
|
* Clear fonts which can't be found
|
|
5277
5277
|
*/
|
|
5278
5278
|
clearMissedFonts() {
|
|
5279
|
-
|
|
5279
|
+
J.instance.missedFonts = {};
|
|
5280
5280
|
}
|
|
5281
5281
|
/**
|
|
5282
5282
|
* Create one empty drawable object
|
|
5283
5283
|
*/
|
|
5284
5284
|
createObject() {
|
|
5285
|
-
return new
|
|
5285
|
+
return new rt(this._styleManager);
|
|
5286
5286
|
}
|
|
5287
5287
|
/**
|
|
5288
5288
|
* Create one empty entity
|
|
@@ -5294,13 +5294,13 @@ class qi {
|
|
|
5294
5294
|
* @inheritdoc
|
|
5295
5295
|
*/
|
|
5296
5296
|
group(e) {
|
|
5297
|
-
return new
|
|
5297
|
+
return new Pi(e, this._styleManager);
|
|
5298
5298
|
}
|
|
5299
5299
|
/**
|
|
5300
5300
|
* @inheritdoc
|
|
5301
5301
|
*/
|
|
5302
5302
|
point(e, t) {
|
|
5303
|
-
return new
|
|
5303
|
+
return new ki(e, t, this._styleManager);
|
|
5304
5304
|
}
|
|
5305
5305
|
/**
|
|
5306
5306
|
* @inheritdoc
|
|
@@ -5324,7 +5324,7 @@ class qi {
|
|
|
5324
5324
|
* @inheritdoc
|
|
5325
5325
|
*/
|
|
5326
5326
|
lineSegments(e, t, i, n) {
|
|
5327
|
-
return new
|
|
5327
|
+
return new Vi(
|
|
5328
5328
|
e,
|
|
5329
5329
|
t,
|
|
5330
5330
|
i,
|
|
@@ -5336,25 +5336,25 @@ class qi {
|
|
|
5336
5336
|
* @inheritdoc
|
|
5337
5337
|
*/
|
|
5338
5338
|
area(e, t) {
|
|
5339
|
-
return new
|
|
5339
|
+
return new Ni(e, t, this._styleManager);
|
|
5340
5340
|
}
|
|
5341
5341
|
/**
|
|
5342
5342
|
* @inheritdoc
|
|
5343
5343
|
*/
|
|
5344
5344
|
mtext(e, t) {
|
|
5345
|
-
return new
|
|
5345
|
+
return new ji(e, t, this._styleManager);
|
|
5346
5346
|
}
|
|
5347
5347
|
/**
|
|
5348
5348
|
* @inheritdoc
|
|
5349
5349
|
*/
|
|
5350
5350
|
image(e, t) {
|
|
5351
|
-
return new
|
|
5351
|
+
return new Oi(e, t, this._styleManager);
|
|
5352
5352
|
}
|
|
5353
5353
|
linePoints(e, t = void 0) {
|
|
5354
|
-
return new
|
|
5354
|
+
return new Ri(e, t, this._styleManager);
|
|
5355
5355
|
}
|
|
5356
5356
|
}
|
|
5357
|
-
class
|
|
5357
|
+
class $i {
|
|
5358
5358
|
constructor(e) {
|
|
5359
5359
|
this._camera = e;
|
|
5360
5360
|
}
|
|
@@ -5454,7 +5454,7 @@ class Qi {
|
|
|
5454
5454
|
);
|
|
5455
5455
|
}
|
|
5456
5456
|
}
|
|
5457
|
-
class
|
|
5457
|
+
class at {
|
|
5458
5458
|
/**
|
|
5459
5459
|
* Construct one instance of this class
|
|
5460
5460
|
* @param renderer Input renderer
|
|
@@ -5466,7 +5466,7 @@ class bt {
|
|
|
5466
5466
|
viewChanged: new M()
|
|
5467
5467
|
}, this._renderer = e, this._width = t, this._height = i;
|
|
5468
5468
|
const n = this.createCamera();
|
|
5469
|
-
this._camera = new
|
|
5469
|
+
this._camera = new $i(n), this._cameraControls = this.createCameraControls(), this._cameraControls.addEventListener("change", () => {
|
|
5470
5470
|
this.events.viewChanged.dispatch({ view: this });
|
|
5471
5471
|
}), this._raycaster = new d.Raycaster();
|
|
5472
5472
|
}
|
|
@@ -5559,13 +5559,13 @@ class bt {
|
|
|
5559
5559
|
), this._raycaster.params.Line.threshold = t, this._raycaster.params.Points.threshold = t, this._raycaster;
|
|
5560
5560
|
}
|
|
5561
5561
|
zoomTo(e, t = 1.1) {
|
|
5562
|
-
const i = new
|
|
5562
|
+
const i = new Ce();
|
|
5563
5563
|
e.getSize(i);
|
|
5564
|
-
const n = new
|
|
5564
|
+
const n = new Ce();
|
|
5565
5565
|
e.getCenter(n);
|
|
5566
5566
|
const s = new d.Vector3(n.x, n.y, 0);
|
|
5567
5567
|
this._camera.position.set(n.x, n.y, this._camera.position.z), this._camera.lookAt(s), this._camera.setRotationFromEuler(new d.Euler(0, 0, 0));
|
|
5568
|
-
const
|
|
5568
|
+
const r = i.x * t, o = i.y * t, a = this._width / r, h = this._height / o;
|
|
5569
5569
|
this._camera.zoom = Math.min(a, h), this._cameraControls.target = s, this.updateCameraFrustum();
|
|
5570
5570
|
}
|
|
5571
5571
|
updateCameraFrustum(e, t) {
|
|
@@ -5584,7 +5584,7 @@ class bt {
|
|
|
5584
5584
|
return e.position.set(0, 0, 500), e.up.set(0, 1, 0), e.updateProjectionMatrix(), e;
|
|
5585
5585
|
}
|
|
5586
5586
|
createCameraControls() {
|
|
5587
|
-
const e = new
|
|
5587
|
+
const e = new Yt(
|
|
5588
5588
|
this._camera.internalCamera,
|
|
5589
5589
|
this._renderer.domElement
|
|
5590
5590
|
);
|
|
@@ -5593,7 +5593,7 @@ class bt {
|
|
|
5593
5593
|
}, e.update(), e;
|
|
5594
5594
|
}
|
|
5595
5595
|
}
|
|
5596
|
-
class
|
|
5596
|
+
class ve extends at {
|
|
5597
5597
|
/**
|
|
5598
5598
|
* Calcuate the bounding box of this viewport in client window coordinate system
|
|
5599
5599
|
*/
|
|
@@ -5608,7 +5608,7 @@ class Be extends bt {
|
|
|
5608
5608
|
* @param renderer Input renderer to draw this viewport view
|
|
5609
5609
|
*/
|
|
5610
5610
|
constructor(e, t, i) {
|
|
5611
|
-
const n =
|
|
5611
|
+
const n = ve.calculateViewportWindowBox(
|
|
5612
5612
|
e,
|
|
5613
5613
|
t
|
|
5614
5614
|
).size;
|
|
@@ -5631,7 +5631,7 @@ class Be extends bt {
|
|
|
5631
5631
|
* @param scene Input the scene to render
|
|
5632
5632
|
*/
|
|
5633
5633
|
render(e) {
|
|
5634
|
-
const t =
|
|
5634
|
+
const t = ve.calculateViewportWindowBox(
|
|
5635
5635
|
this._parentView,
|
|
5636
5636
|
this._viewport
|
|
5637
5637
|
);
|
|
@@ -5651,36 +5651,36 @@ class Be extends bt {
|
|
|
5651
5651
|
}
|
|
5652
5652
|
}
|
|
5653
5653
|
}
|
|
5654
|
-
const
|
|
5654
|
+
const Yi = (c) => new Ze(c.min, c.max), Hi = (c) => new L(
|
|
5655
5655
|
c.min,
|
|
5656
5656
|
c.max
|
|
5657
|
-
),
|
|
5657
|
+
), qi = (c) => new d.Box3(
|
|
5658
5658
|
c.min,
|
|
5659
5659
|
c.max
|
|
5660
|
-
),
|
|
5660
|
+
), Qi = (c) => new L(c.min, c.max), Zi = (c) => new d.Box2(
|
|
5661
5661
|
c.min,
|
|
5662
5662
|
c.max
|
|
5663
|
-
),
|
|
5663
|
+
), Ji = (c) => new L(c.min, c.max), Ki = (c) => {
|
|
5664
5664
|
const e = new d.Box3();
|
|
5665
5665
|
return e.min.set(c.min.x, c.min.y, 0), e.max.set(c.max.x, c.max.y, 0), e;
|
|
5666
|
-
},
|
|
5666
|
+
}, en = {
|
|
5667
5667
|
/** Converts Three.js Box2 to CAD geometry AcGeBox2d */
|
|
5668
|
-
threeBo2dToGeBox2d:
|
|
5668
|
+
threeBo2dToGeBox2d: Qi,
|
|
5669
5669
|
/** Converts CAD geometry AcGeBox2d to Three.js Box2 */
|
|
5670
|
-
geBox2dToThreeBox2d:
|
|
5670
|
+
geBox2dToThreeBox2d: Zi,
|
|
5671
5671
|
/** Converts Three.js Box3 to CAD geometry AcGeBox3d */
|
|
5672
|
-
threeBox3dToGeBox3d:
|
|
5672
|
+
threeBox3dToGeBox3d: Yi,
|
|
5673
5673
|
/** Converts CAD geometry AcGeBox3d to Three.js Box3 */
|
|
5674
|
-
geBox3dToThreeBox3d:
|
|
5674
|
+
geBox3dToThreeBox3d: qi,
|
|
5675
5675
|
/** Converts CAD geometry AcGeBox3d to CAD geometry AcGeBox2d */
|
|
5676
|
-
goBox3dToGeBox2d:
|
|
5676
|
+
goBox3dToGeBox2d: Hi,
|
|
5677
5677
|
/** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
|
|
5678
|
-
threeBox3dToGeBox2d:
|
|
5678
|
+
threeBox3dToGeBox2d: Ji,
|
|
5679
5679
|
/** Converts CAD geometry AcGeBox2d to Three.js Box3 (Z=0) */
|
|
5680
|
-
geBox2dToThreeBox3d:
|
|
5680
|
+
geBox2dToThreeBox3d: Ki
|
|
5681
5681
|
};
|
|
5682
|
-
var
|
|
5683
|
-
class
|
|
5682
|
+
var Ie = /* @__PURE__ */ ((c) => (c[c.LEFT_BOTTOM = 0] = "LEFT_BOTTOM", c[c.LEFT_TOP = 1] = "LEFT_TOP", c[c.RIGHT_TOP = 2] = "RIGHT_TOP", c[c.RIGHT_BOTTOM = 4] = "RIGHT_BOTTOM", c))(Ie || {});
|
|
5683
|
+
class tn extends d.Object3D {
|
|
5684
5684
|
/**
|
|
5685
5685
|
* Construct one instance of this gizmo
|
|
5686
5686
|
* @param camera Camera used in your canvas
|
|
@@ -5725,53 +5725,53 @@ class on extends d.Object3D {
|
|
|
5725
5725
|
}
|
|
5726
5726
|
calculateViewportPos() {
|
|
5727
5727
|
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim;
|
|
5728
|
-
let
|
|
5728
|
+
let r = t - s, o = i - s;
|
|
5729
5729
|
switch (n) {
|
|
5730
5730
|
case 0:
|
|
5731
|
-
|
|
5731
|
+
r = 0, o = 0;
|
|
5732
5732
|
break;
|
|
5733
5733
|
case 1:
|
|
5734
|
-
|
|
5734
|
+
r = 0;
|
|
5735
5735
|
break;
|
|
5736
5736
|
case 4:
|
|
5737
|
-
|
|
5737
|
+
o = 0;
|
|
5738
5738
|
break;
|
|
5739
5739
|
}
|
|
5740
|
-
return { x:
|
|
5740
|
+
return { x: r, y: o };
|
|
5741
5741
|
}
|
|
5742
5742
|
calculateViewportBbox() {
|
|
5743
|
-
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim,
|
|
5743
|
+
const e = this.renderer.domElement, t = e.offsetWidth, i = e.offsetHeight, n = this.gizmoPos, s = this.gizmoDim, r = new d.Box2(
|
|
5744
5744
|
new d.Vector2(t - s, 0),
|
|
5745
5745
|
new d.Vector2(t, s)
|
|
5746
5746
|
);
|
|
5747
5747
|
switch (n) {
|
|
5748
5748
|
case 0:
|
|
5749
|
-
|
|
5749
|
+
r.set(
|
|
5750
5750
|
new d.Vector2(0, i - s),
|
|
5751
5751
|
new d.Vector2(s, i)
|
|
5752
5752
|
);
|
|
5753
5753
|
break;
|
|
5754
5754
|
case 1:
|
|
5755
|
-
|
|
5755
|
+
r.set(new d.Vector2(0, 0), new d.Vector2(s, s));
|
|
5756
5756
|
break;
|
|
5757
5757
|
case 4:
|
|
5758
|
-
|
|
5758
|
+
r.set(
|
|
5759
5759
|
new d.Vector2(t - s, i - s),
|
|
5760
5760
|
new d.Vector2(t, i)
|
|
5761
5761
|
);
|
|
5762
5762
|
break;
|
|
5763
5763
|
}
|
|
5764
|
-
return
|
|
5764
|
+
return r;
|
|
5765
5765
|
}
|
|
5766
5766
|
}
|
|
5767
|
-
function
|
|
5768
|
-
const t = e.font || "Helvetica", i = e.fontSize || 30, n = e.width || 200, s = e.height || 200,
|
|
5767
|
+
function nn(c, e) {
|
|
5768
|
+
const t = e.font || "Helvetica", i = e.fontSize || 30, n = e.width || 200, s = e.height || 200, r = e.bgColor ? e.bgColor.join(", ") : "255, 255, 255, 1.0", o = e.color ? e.color.join(", ") : "0, 0, 0, 1.0", a = document.createElement("canvas");
|
|
5769
5769
|
a.width = n, a.height = s;
|
|
5770
5770
|
const h = a.getContext("2d");
|
|
5771
5771
|
if (h) {
|
|
5772
|
-
h.font = `bold ${i}px ${t}`, h.fillStyle = `rgba(${
|
|
5772
|
+
h.font = `bold ${i}px ${t}`, h.fillStyle = `rgba(${r})`, h.fillRect(0, 0, n, s);
|
|
5773
5773
|
const u = h.measureText(c).width;
|
|
5774
|
-
h.fillStyle = `rgba(${
|
|
5774
|
+
h.fillStyle = `rgba(${o})`, h.fillText(
|
|
5775
5775
|
c,
|
|
5776
5776
|
n / 2 - u / 2,
|
|
5777
5777
|
s / 2 + i / 2 - 2
|
|
@@ -5780,8 +5780,8 @@ function an(c, e) {
|
|
|
5780
5780
|
const l = new d.Texture(a);
|
|
5781
5781
|
return l.minFilter = d.LinearFilter, l.needsUpdate = !0, l;
|
|
5782
5782
|
}
|
|
5783
|
-
function
|
|
5784
|
-
const e =
|
|
5783
|
+
function Be(c) {
|
|
5784
|
+
const e = nn(c, {
|
|
5785
5785
|
fontSize: 100,
|
|
5786
5786
|
font: "Arial Narrow, sans-serif",
|
|
5787
5787
|
color: [255, 255, 255, 1],
|
|
@@ -5789,31 +5789,31 @@ function Ce(c) {
|
|
|
5789
5789
|
}), t = new d.SpriteMaterial({ map: e, transparent: !0 });
|
|
5790
5790
|
return new d.Sprite(t);
|
|
5791
5791
|
}
|
|
5792
|
-
|
|
5793
|
-
const
|
|
5794
|
-
pos:
|
|
5792
|
+
Ie.RIGHT_TOP;
|
|
5793
|
+
const sn = {
|
|
5794
|
+
pos: Ie.LEFT_BOTTOM,
|
|
5795
5795
|
size: 100,
|
|
5796
5796
|
hasZAxis: !0
|
|
5797
5797
|
};
|
|
5798
|
-
class
|
|
5798
|
+
class rn extends tn {
|
|
5799
5799
|
constructor(e, t, i) {
|
|
5800
5800
|
const n = {
|
|
5801
|
-
...
|
|
5801
|
+
...sn,
|
|
5802
5802
|
...i
|
|
5803
5803
|
};
|
|
5804
5804
|
super(e, t, n.size, i.pos), this.hasZAxis = n.hasZAxis;
|
|
5805
|
-
const s = [0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0],
|
|
5806
|
-
this.hasZAxis && (s.push(0, 0, 0, 0, 0, 2),
|
|
5807
|
-
const
|
|
5808
|
-
|
|
5805
|
+
const s = [0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0], r = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0];
|
|
5806
|
+
this.hasZAxis && (s.push(0, 0, 0, 0, 0, 2), r.push(0, 0, 1, 0, 0.6, 1));
|
|
5807
|
+
const o = new d.BufferGeometry();
|
|
5808
|
+
o.setAttribute(
|
|
5809
5809
|
"position",
|
|
5810
5810
|
new d.Float32BufferAttribute(s, 3)
|
|
5811
|
-
),
|
|
5811
|
+
), o.setAttribute("color", new d.Float32BufferAttribute(r, 3));
|
|
5812
5812
|
const a = new d.LineBasicMaterial({
|
|
5813
5813
|
vertexColors: !0,
|
|
5814
5814
|
toneMapped: !1
|
|
5815
5815
|
});
|
|
5816
|
-
this.axes = new d.LineSegments(
|
|
5816
|
+
this.axes = new d.LineSegments(o, a), this.axes.position.set(-1, -1, -1), this.add(this.axes), this.xText = Be("X"), this.xText.position.set(1.5, -1, -1), this.add(this.xText), this.yText = Be("Y"), this.yText.position.set(-1, 1.5, -1), this.add(this.yText), this.hasZAxis && (this.zText = Be("Z"), this.zText.position.set(-1, -1, 1.5), this.add(this.zText));
|
|
5817
5817
|
}
|
|
5818
5818
|
/**
|
|
5819
5819
|
* Set color of x-axis and y-axis
|
|
@@ -5840,7 +5840,7 @@ class hn extends on {
|
|
|
5840
5840
|
this.axes.geometry.dispose(), this.axes.material.dispose(), this.xText.geometry.dispose(), this.xText.material.dispose(), this.yText.geometry.dispose(), this.yText.material.dispose(), this.hasZAxis && ((e = this.zText) == null || e.geometry.dispose(), (t = this.zText) == null || t.material.dispose());
|
|
5841
5841
|
}
|
|
5842
5842
|
}
|
|
5843
|
-
class
|
|
5843
|
+
class on extends at {
|
|
5844
5844
|
/**
|
|
5845
5845
|
* Construct one instance of this class.
|
|
5846
5846
|
*
|
|
@@ -5850,7 +5850,7 @@ class ln extends bt {
|
|
|
5850
5850
|
* @param height - Input height of this view in pixels
|
|
5851
5851
|
*/
|
|
5852
5852
|
constructor(e, t, i, n) {
|
|
5853
|
-
super(e, i, n), this._layoutBtrId = t, this._mode =
|
|
5853
|
+
super(e, i, n), this._layoutBtrId = t, this._mode = R.SELECTION, this._axesGizmo = this.createAxesGizmo(), this._viewportViews = /* @__PURE__ */ new Map();
|
|
5854
5854
|
}
|
|
5855
5855
|
/**
|
|
5856
5856
|
* Gets the block table record ID associated with this layout.
|
|
@@ -5868,9 +5868,9 @@ class ln extends bt {
|
|
|
5868
5868
|
return this._mode;
|
|
5869
5869
|
}
|
|
5870
5870
|
set mode(e) {
|
|
5871
|
-
e ==
|
|
5871
|
+
e == R.SELECTION ? this._cameraControls.mouseButtons = {
|
|
5872
5872
|
MIDDLE: d.MOUSE.PAN
|
|
5873
|
-
} : e ==
|
|
5873
|
+
} : e == R.PAN && (this._cameraControls.mouseButtons = {
|
|
5874
5874
|
LEFT: d.MOUSE.PAN
|
|
5875
5875
|
}), this._cameraControls.update(), this._mode = e;
|
|
5876
5876
|
}
|
|
@@ -5931,12 +5931,12 @@ class ln extends bt {
|
|
|
5931
5931
|
* @returns The configured axes gizmo instance
|
|
5932
5932
|
*/
|
|
5933
5933
|
createAxesGizmo() {
|
|
5934
|
-
return new
|
|
5934
|
+
return new rn(
|
|
5935
5935
|
this._camera.internalCamera,
|
|
5936
5936
|
this._renderer.internalRenderer,
|
|
5937
5937
|
{
|
|
5938
5938
|
hasZAxis: !1,
|
|
5939
|
-
pos:
|
|
5939
|
+
pos: Ie.LEFT_BOTTOM
|
|
5940
5940
|
}
|
|
5941
5941
|
);
|
|
5942
5942
|
}
|
|
@@ -5965,7 +5965,7 @@ class ln extends bt {
|
|
|
5965
5965
|
}
|
|
5966
5966
|
}
|
|
5967
5967
|
}
|
|
5968
|
-
class
|
|
5968
|
+
class an {
|
|
5969
5969
|
/**
|
|
5970
5970
|
* Creates a new layout view manager instance.
|
|
5971
5971
|
* Initializes with no active layout and an empty collection of views.
|
|
@@ -6048,29 +6048,29 @@ class dn {
|
|
|
6048
6048
|
(t = this.activeLayoutView) == null || t.render(e);
|
|
6049
6049
|
}
|
|
6050
6050
|
}
|
|
6051
|
-
function
|
|
6051
|
+
function ct(c, e, t = 0, i = c.length - 1, n = cn) {
|
|
6052
6052
|
for (; i > t; ) {
|
|
6053
6053
|
if (i - t > 600) {
|
|
6054
6054
|
const a = i - t + 1, h = e - t + 1, l = Math.log(a), m = 0.5 * Math.exp(2 * l / 3), u = 0.5 * Math.sqrt(l * m * (a - m) / a) * (h - a / 2 < 0 ? -1 : 1), p = Math.max(t, Math.floor(e - h * m / a + u)), g = Math.min(i, Math.floor(e + (a - h) * m / a + u));
|
|
6055
|
-
|
|
6055
|
+
ct(c, e, p, g, n);
|
|
6056
6056
|
}
|
|
6057
6057
|
const s = c[e];
|
|
6058
|
-
let
|
|
6059
|
-
for (
|
|
6060
|
-
for (
|
|
6061
|
-
for (; n(c[
|
|
6058
|
+
let r = t, o = i;
|
|
6059
|
+
for (ie(c, t, e), n(c[i], s) > 0 && ie(c, t, i); r < o; ) {
|
|
6060
|
+
for (ie(c, r, o), r++, o--; n(c[r], s) < 0; ) r++;
|
|
6061
|
+
for (; n(c[o], s) > 0; ) o--;
|
|
6062
6062
|
}
|
|
6063
|
-
n(c[t], s) === 0 ?
|
|
6063
|
+
n(c[t], s) === 0 ? ie(c, t, o) : (o++, ie(c, o, i)), o <= e && (t = o + 1), e <= o && (i = o - 1);
|
|
6064
6064
|
}
|
|
6065
6065
|
}
|
|
6066
|
-
function
|
|
6066
|
+
function ie(c, e, t) {
|
|
6067
6067
|
const i = c[e];
|
|
6068
6068
|
c[e] = c[t], c[t] = i;
|
|
6069
6069
|
}
|
|
6070
|
-
function
|
|
6070
|
+
function cn(c, e) {
|
|
6071
6071
|
return c < e ? -1 : c > e ? 1 : 0;
|
|
6072
6072
|
}
|
|
6073
|
-
class
|
|
6073
|
+
class hn {
|
|
6074
6074
|
constructor(e = 9) {
|
|
6075
6075
|
this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
6076
6076
|
}
|
|
@@ -6080,12 +6080,12 @@ class mn {
|
|
|
6080
6080
|
search(e) {
|
|
6081
6081
|
let t = this.data;
|
|
6082
6082
|
const i = [];
|
|
6083
|
-
if (!
|
|
6083
|
+
if (!ye(e, t)) return i;
|
|
6084
6084
|
const n = this.toBBox, s = [];
|
|
6085
6085
|
for (; t; ) {
|
|
6086
|
-
for (let
|
|
6087
|
-
const
|
|
6088
|
-
|
|
6086
|
+
for (let r = 0; r < t.children.length; r++) {
|
|
6087
|
+
const o = t.children[r], a = t.leaf ? n(o) : o;
|
|
6088
|
+
ye(e, a) && (t.leaf ? i.push(o) : Ae(e, a) ? this._all(o, i) : s.push(o));
|
|
6089
6089
|
}
|
|
6090
6090
|
t = s.pop();
|
|
6091
6091
|
}
|
|
@@ -6093,13 +6093,13 @@ class mn {
|
|
|
6093
6093
|
}
|
|
6094
6094
|
collides(e) {
|
|
6095
6095
|
let t = this.data;
|
|
6096
|
-
if (!
|
|
6096
|
+
if (!ye(e, t)) return !1;
|
|
6097
6097
|
const i = [];
|
|
6098
6098
|
for (; t; ) {
|
|
6099
6099
|
for (let n = 0; n < t.children.length; n++) {
|
|
6100
|
-
const s = t.children[n],
|
|
6101
|
-
if (
|
|
6102
|
-
if (t.leaf ||
|
|
6100
|
+
const s = t.children[n], r = t.leaf ? this.toBBox(s) : s;
|
|
6101
|
+
if (ye(e, r)) {
|
|
6102
|
+
if (t.leaf || Ae(e, r)) return !0;
|
|
6103
6103
|
i.push(s);
|
|
6104
6104
|
}
|
|
6105
6105
|
}
|
|
@@ -6137,15 +6137,15 @@ class mn {
|
|
|
6137
6137
|
remove(e, t) {
|
|
6138
6138
|
if (!e) return this;
|
|
6139
6139
|
let i = this.data;
|
|
6140
|
-
const n = this.toBBox(e), s = [],
|
|
6141
|
-
let
|
|
6140
|
+
const n = this.toBBox(e), s = [], r = [];
|
|
6141
|
+
let o, a, h;
|
|
6142
6142
|
for (; i || s.length; ) {
|
|
6143
|
-
if (i || (i = s.pop(), a = s[s.length - 1],
|
|
6144
|
-
const l =
|
|
6143
|
+
if (i || (i = s.pop(), a = s[s.length - 1], o = r.pop(), h = !0), i.leaf) {
|
|
6144
|
+
const l = ln(e, i.children, t);
|
|
6145
6145
|
if (l !== -1)
|
|
6146
6146
|
return i.children.splice(l, 1), s.push(i), this._condense(s), this;
|
|
6147
6147
|
}
|
|
6148
|
-
!h && !i.leaf &&
|
|
6148
|
+
!h && !i.leaf && Ae(i, n) ? (s.push(i), r.push(o), o = 0, a = i, i = i.children[0]) : a ? (o++, i = a.children[o], h = !1) : i = null;
|
|
6149
6149
|
}
|
|
6150
6150
|
return this;
|
|
6151
6151
|
}
|
|
@@ -6172,36 +6172,36 @@ class mn {
|
|
|
6172
6172
|
}
|
|
6173
6173
|
_build(e, t, i, n) {
|
|
6174
6174
|
const s = i - t + 1;
|
|
6175
|
-
let
|
|
6176
|
-
if (s <=
|
|
6177
|
-
return
|
|
6178
|
-
n || (n = Math.ceil(Math.log(s) / Math.log(
|
|
6179
|
-
const a = Math.ceil(s /
|
|
6180
|
-
|
|
6175
|
+
let r = this._maxEntries, o;
|
|
6176
|
+
if (s <= r)
|
|
6177
|
+
return o = q(e.slice(t, i + 1)), Y(o, this.toBBox), o;
|
|
6178
|
+
n || (n = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, n - 1))), o = q([]), o.leaf = !1, o.height = n;
|
|
6179
|
+
const a = Math.ceil(s / r), h = a * Math.ceil(Math.sqrt(r));
|
|
6180
|
+
Xe(e, t, i, h, this.compareMinX);
|
|
6181
6181
|
for (let l = t; l <= i; l += h) {
|
|
6182
6182
|
const m = Math.min(l + h - 1, i);
|
|
6183
|
-
|
|
6183
|
+
Xe(e, l, m, a, this.compareMinY);
|
|
6184
6184
|
for (let u = l; u <= m; u += a) {
|
|
6185
6185
|
const p = Math.min(u + a - 1, m);
|
|
6186
|
-
|
|
6186
|
+
o.children.push(this._build(e, u, p, n - 1));
|
|
6187
6187
|
}
|
|
6188
6188
|
}
|
|
6189
|
-
return Y(
|
|
6189
|
+
return Y(o, this.toBBox), o;
|
|
6190
6190
|
}
|
|
6191
6191
|
_chooseSubtree(e, t, i, n) {
|
|
6192
6192
|
for (; n.push(t), !(t.leaf || n.length - 1 === i); ) {
|
|
6193
|
-
let s = 1 / 0,
|
|
6193
|
+
let s = 1 / 0, r = 1 / 0, o;
|
|
6194
6194
|
for (let a = 0; a < t.children.length; a++) {
|
|
6195
|
-
const h = t.children[a], l =
|
|
6196
|
-
m <
|
|
6195
|
+
const h = t.children[a], l = Me(h), m = mn(e, h) - l;
|
|
6196
|
+
m < r ? (r = m, s = l < s ? l : s, o = h) : m === r && l < s && (s = l, o = h);
|
|
6197
6197
|
}
|
|
6198
|
-
t =
|
|
6198
|
+
t = o || t.children[0];
|
|
6199
6199
|
}
|
|
6200
6200
|
return t;
|
|
6201
6201
|
}
|
|
6202
6202
|
_insert(e, t, i) {
|
|
6203
|
-
const n = i ? e : this.toBBox(e), s = [],
|
|
6204
|
-
for (
|
|
6203
|
+
const n = i ? e : this.toBBox(e), s = [], r = this._chooseSubtree(n, this.data, t, s);
|
|
6204
|
+
for (r.children.push(e), re(r, n); t >= 0 && s[t].children.length > this._maxEntries; )
|
|
6205
6205
|
this._split(s, t), t--;
|
|
6206
6206
|
this._adjustParentBBoxes(n, s, t);
|
|
6207
6207
|
}
|
|
@@ -6209,92 +6209,92 @@ class mn {
|
|
|
6209
6209
|
_split(e, t) {
|
|
6210
6210
|
const i = e[t], n = i.children.length, s = this._minEntries;
|
|
6211
6211
|
this._chooseSplitAxis(i, s, n);
|
|
6212
|
-
const
|
|
6213
|
-
|
|
6212
|
+
const r = this._chooseSplitIndex(i, s, n), o = q(i.children.splice(r, i.children.length - r));
|
|
6213
|
+
o.height = i.height, o.leaf = i.leaf, Y(i, this.toBBox), Y(o, this.toBBox), t ? e[t - 1].children.push(o) : this._splitRoot(i, o);
|
|
6214
6214
|
}
|
|
6215
6215
|
_splitRoot(e, t) {
|
|
6216
6216
|
this.data = q([e, t]), this.data.height = e.height + 1, this.data.leaf = !1, Y(this.data, this.toBBox);
|
|
6217
6217
|
}
|
|
6218
6218
|
_chooseSplitIndex(e, t, i) {
|
|
6219
|
-
let n, s = 1 / 0,
|
|
6220
|
-
for (let
|
|
6221
|
-
const a =
|
|
6222
|
-
l < s ? (s = l, n =
|
|
6219
|
+
let n, s = 1 / 0, r = 1 / 0;
|
|
6220
|
+
for (let o = t; o <= i - t; o++) {
|
|
6221
|
+
const a = se(e, 0, o, this.toBBox), h = se(e, o, i, this.toBBox), l = gn(a, h), m = Me(a) + Me(h);
|
|
6222
|
+
l < s ? (s = l, n = o, r = m < r ? m : r) : l === s && m < r && (r = m, n = o);
|
|
6223
6223
|
}
|
|
6224
6224
|
return n || i - t;
|
|
6225
6225
|
}
|
|
6226
6226
|
// sorts node children by the best axis for split
|
|
6227
6227
|
_chooseSplitAxis(e, t, i) {
|
|
6228
|
-
const n = e.leaf ? this.compareMinX :
|
|
6229
|
-
|
|
6228
|
+
const n = e.leaf ? this.compareMinX : dn, s = e.leaf ? this.compareMinY : un, r = this._allDistMargin(e, t, i, n), o = this._allDistMargin(e, t, i, s);
|
|
6229
|
+
r < o && e.children.sort(n);
|
|
6230
6230
|
}
|
|
6231
6231
|
// total margin of all possible split distributions where each node is at least m full
|
|
6232
6232
|
_allDistMargin(e, t, i, n) {
|
|
6233
6233
|
e.children.sort(n);
|
|
6234
|
-
const s = this.toBBox,
|
|
6235
|
-
let a =
|
|
6234
|
+
const s = this.toBBox, r = se(e, 0, t, s), o = se(e, i - t, i, s);
|
|
6235
|
+
let a = pe(r) + pe(o);
|
|
6236
6236
|
for (let h = t; h < i - t; h++) {
|
|
6237
6237
|
const l = e.children[h];
|
|
6238
|
-
|
|
6238
|
+
re(r, e.leaf ? s(l) : l), a += pe(r);
|
|
6239
6239
|
}
|
|
6240
6240
|
for (let h = i - t - 1; h >= t; h--) {
|
|
6241
6241
|
const l = e.children[h];
|
|
6242
|
-
|
|
6242
|
+
re(o, e.leaf ? s(l) : l), a += pe(o);
|
|
6243
6243
|
}
|
|
6244
6244
|
return a;
|
|
6245
6245
|
}
|
|
6246
6246
|
_adjustParentBBoxes(e, t, i) {
|
|
6247
6247
|
for (let n = i; n >= 0; n--)
|
|
6248
|
-
|
|
6248
|
+
re(t[n], e);
|
|
6249
6249
|
}
|
|
6250
6250
|
_condense(e) {
|
|
6251
6251
|
for (let t = e.length - 1, i; t >= 0; t--)
|
|
6252
6252
|
e[t].children.length === 0 ? t > 0 ? (i = e[t - 1].children, i.splice(i.indexOf(e[t]), 1)) : this.clear() : Y(e[t], this.toBBox);
|
|
6253
6253
|
}
|
|
6254
6254
|
}
|
|
6255
|
-
function
|
|
6255
|
+
function ln(c, e, t) {
|
|
6256
6256
|
if (!t) return e.indexOf(c);
|
|
6257
6257
|
for (let i = 0; i < e.length; i++)
|
|
6258
6258
|
if (t(c, e[i])) return i;
|
|
6259
6259
|
return -1;
|
|
6260
6260
|
}
|
|
6261
6261
|
function Y(c, e) {
|
|
6262
|
-
|
|
6262
|
+
se(c, 0, c.children.length, e, c);
|
|
6263
6263
|
}
|
|
6264
|
-
function
|
|
6264
|
+
function se(c, e, t, i, n) {
|
|
6265
6265
|
n || (n = q(null)), n.minX = 1 / 0, n.minY = 1 / 0, n.maxX = -1 / 0, n.maxY = -1 / 0;
|
|
6266
6266
|
for (let s = e; s < t; s++) {
|
|
6267
|
-
const
|
|
6268
|
-
|
|
6267
|
+
const r = c.children[s];
|
|
6268
|
+
re(n, c.leaf ? i(r) : r);
|
|
6269
6269
|
}
|
|
6270
6270
|
return n;
|
|
6271
6271
|
}
|
|
6272
|
-
function
|
|
6272
|
+
function re(c, e) {
|
|
6273
6273
|
return c.minX = Math.min(c.minX, e.minX), c.minY = Math.min(c.minY, e.minY), c.maxX = Math.max(c.maxX, e.maxX), c.maxY = Math.max(c.maxY, e.maxY), c;
|
|
6274
6274
|
}
|
|
6275
|
-
function
|
|
6275
|
+
function dn(c, e) {
|
|
6276
6276
|
return c.minX - e.minX;
|
|
6277
6277
|
}
|
|
6278
|
-
function
|
|
6278
|
+
function un(c, e) {
|
|
6279
6279
|
return c.minY - e.minY;
|
|
6280
6280
|
}
|
|
6281
|
-
function
|
|
6281
|
+
function Me(c) {
|
|
6282
6282
|
return (c.maxX - c.minX) * (c.maxY - c.minY);
|
|
6283
6283
|
}
|
|
6284
|
-
function
|
|
6284
|
+
function pe(c) {
|
|
6285
6285
|
return c.maxX - c.minX + (c.maxY - c.minY);
|
|
6286
6286
|
}
|
|
6287
|
-
function
|
|
6287
|
+
function mn(c, e) {
|
|
6288
6288
|
return (Math.max(e.maxX, c.maxX) - Math.min(e.minX, c.minX)) * (Math.max(e.maxY, c.maxY) - Math.min(e.minY, c.minY));
|
|
6289
6289
|
}
|
|
6290
|
-
function
|
|
6290
|
+
function gn(c, e) {
|
|
6291
6291
|
const t = Math.max(c.minX, e.minX), i = Math.max(c.minY, e.minY), n = Math.min(c.maxX, e.maxX), s = Math.min(c.maxY, e.maxY);
|
|
6292
6292
|
return Math.max(0, n - t) * Math.max(0, s - i);
|
|
6293
6293
|
}
|
|
6294
|
-
function
|
|
6294
|
+
function Ae(c, e) {
|
|
6295
6295
|
return c.minX <= e.minX && c.minY <= e.minY && e.maxX <= c.maxX && e.maxY <= c.maxY;
|
|
6296
6296
|
}
|
|
6297
|
-
function
|
|
6297
|
+
function ye(c, e) {
|
|
6298
6298
|
return e.minX <= c.maxX && e.minY <= c.maxY && e.maxX >= c.minX && e.maxY >= c.minY;
|
|
6299
6299
|
}
|
|
6300
6300
|
function q(c) {
|
|
@@ -6308,21 +6308,21 @@ function q(c) {
|
|
|
6308
6308
|
maxY: -1 / 0
|
|
6309
6309
|
};
|
|
6310
6310
|
}
|
|
6311
|
-
function
|
|
6311
|
+
function Xe(c, e, t, i, n) {
|
|
6312
6312
|
const s = [e, t];
|
|
6313
6313
|
for (; s.length; ) {
|
|
6314
6314
|
if (t = s.pop(), e = s.pop(), t - e <= i) continue;
|
|
6315
|
-
const
|
|
6316
|
-
|
|
6315
|
+
const r = e + Math.ceil((t - e) / i / 2) * i;
|
|
6316
|
+
ct(c, r, e, t, n), s.push(e, r, r, t);
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
6319
|
-
class
|
|
6319
|
+
class pn {
|
|
6320
6320
|
/**
|
|
6321
6321
|
* Construct one instance of this class
|
|
6322
6322
|
* @param name Input layer name
|
|
6323
6323
|
*/
|
|
6324
6324
|
constructor(e) {
|
|
6325
|
-
this._group = new
|
|
6325
|
+
this._group = new zi(), this._name = e;
|
|
6326
6326
|
}
|
|
6327
6327
|
/**
|
|
6328
6328
|
* Layer name
|
|
@@ -6438,13 +6438,13 @@ class _n {
|
|
|
6438
6438
|
});
|
|
6439
6439
|
}
|
|
6440
6440
|
}
|
|
6441
|
-
class
|
|
6441
|
+
class yn {
|
|
6442
6442
|
/**
|
|
6443
6443
|
* Creates a new layout instance.
|
|
6444
6444
|
* Initializes the layout with empty collections and a spatial index.
|
|
6445
6445
|
*/
|
|
6446
6446
|
constructor() {
|
|
6447
|
-
this._group = new d.Group(), this._indexTree = new
|
|
6447
|
+
this._group = new d.Group(), this._indexTree = new hn(), this._box = new d.Box3(), this._layers = /* @__PURE__ */ new Map();
|
|
6448
6448
|
}
|
|
6449
6449
|
/**
|
|
6450
6450
|
* The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
|
|
@@ -6493,10 +6493,10 @@ class bn {
|
|
|
6493
6493
|
*/
|
|
6494
6494
|
get stats() {
|
|
6495
6495
|
const e = [];
|
|
6496
|
-
let t = 0, i = 0, n = 0, s = 0,
|
|
6497
|
-
return this._layers.forEach((
|
|
6498
|
-
const a =
|
|
6499
|
-
e.push(a), n += a.line.indexed.geometrySize + a.line.nonIndexed.geometrySize, s += a.mesh.indexed.geometrySize + a.mesh.nonIndexed.geometrySize,
|
|
6496
|
+
let t = 0, i = 0, n = 0, s = 0, r = 0;
|
|
6497
|
+
return this._layers.forEach((o) => {
|
|
6498
|
+
const a = o.stats;
|
|
6499
|
+
e.push(a), n += a.line.indexed.geometrySize + a.line.nonIndexed.geometrySize, s += a.mesh.indexed.geometrySize + a.mesh.nonIndexed.geometrySize, r += a.point.indexed.geometrySize + a.point.nonIndexed.geometrySize, t += a.summary.totalGeometrySize, i += a.summary.totalMappingSize;
|
|
6500
6500
|
}), {
|
|
6501
6501
|
layers: e,
|
|
6502
6502
|
summary: {
|
|
@@ -6504,7 +6504,7 @@ class bn {
|
|
|
6504
6504
|
totalSize: {
|
|
6505
6505
|
line: n,
|
|
6506
6506
|
mesh: s,
|
|
6507
|
-
point:
|
|
6507
|
+
point: r,
|
|
6508
6508
|
geometry: t,
|
|
6509
6509
|
mapping: i
|
|
6510
6510
|
}
|
|
@@ -6688,10 +6688,10 @@ class bn {
|
|
|
6688
6688
|
*/
|
|
6689
6689
|
getLayer(e, t = !0) {
|
|
6690
6690
|
let i = this._layers.get(e);
|
|
6691
|
-
return i === void 0 && t && (i = new
|
|
6691
|
+
return i === void 0 && t && (i = new pn(e), this._layers.set(e, i), this._group.add(i.internalObject)), i;
|
|
6692
6692
|
}
|
|
6693
6693
|
}
|
|
6694
|
-
class
|
|
6694
|
+
class fn {
|
|
6695
6695
|
/**
|
|
6696
6696
|
* Creates a new CAD scene instance.
|
|
6697
6697
|
*
|
|
@@ -6771,7 +6771,7 @@ class wn {
|
|
|
6771
6771
|
* @returns Return the newly created empty layout
|
|
6772
6772
|
*/
|
|
6773
6773
|
addEmptyLayout(e) {
|
|
6774
|
-
const t = new
|
|
6774
|
+
const t = new yn();
|
|
6775
6775
|
return this._layouts.set(e, t), this._scene.add(t.internalObject), t.visible = e == this._activeLayoutBtrId, t;
|
|
6776
6776
|
}
|
|
6777
6777
|
/**
|
|
@@ -6871,10 +6871,10 @@ class wn {
|
|
|
6871
6871
|
}), this;
|
|
6872
6872
|
}
|
|
6873
6873
|
}
|
|
6874
|
-
const
|
|
6874
|
+
const $e = {
|
|
6875
6875
|
background: 0
|
|
6876
6876
|
};
|
|
6877
|
-
class
|
|
6877
|
+
class xn extends li {
|
|
6878
6878
|
/**
|
|
6879
6879
|
* Creates a new 2D CAD viewer instance.
|
|
6880
6880
|
*
|
|
@@ -6883,33 +6883,33 @@ class vn extends gi {
|
|
|
6883
6883
|
* @param options.calculateSizeCallback - Optional callback function to calculate canvas size on window resize
|
|
6884
6884
|
* @param options.background - Optional background color as hex number (default: 0x000000)
|
|
6885
6885
|
*/
|
|
6886
|
-
constructor(e =
|
|
6886
|
+
constructor(e = $e) {
|
|
6887
6887
|
const t = {
|
|
6888
|
-
|
|
6888
|
+
...$e,
|
|
6889
6889
|
...e
|
|
6890
6890
|
}, i = new d.WebGLRenderer({
|
|
6891
6891
|
antialias: !0,
|
|
6892
6892
|
alpha: !0,
|
|
6893
6893
|
canvas: e.canvas
|
|
6894
6894
|
});
|
|
6895
|
-
t.canvas == null && (t.canvas = i.domElement), super(t.canvas), e.calculateSizeCallback && this.setCalculateSizeCallback(e.calculateSizeCallback), i.setPixelRatio(Math.min(window.devicePixelRatio, 2)), i.setSize(this.width, this.height), this._renderer = new
|
|
6896
|
-
const n =
|
|
6895
|
+
t.canvas == null && (t.canvas = i.domElement), super(t.canvas), e.calculateSizeCallback && this.setCalculateSizeCallback(e.calculateSizeCallback), i.setPixelRatio(Math.min(window.devicePixelRatio, 2)), i.setSize(this.width, this.height), this._renderer = new Xi(i);
|
|
6896
|
+
const n = oe.instance.fontMapping;
|
|
6897
6897
|
this._renderer.setFontMapping(n), this._renderer.events.fontNotFound.addEventListener((s) => {
|
|
6898
6898
|
V.emit("font-not-found", {
|
|
6899
6899
|
fontName: s.fontName,
|
|
6900
6900
|
count: s.count ?? 0
|
|
6901
6901
|
});
|
|
6902
|
-
}), this._scene = this.createScene(), this._renderer.setClearColor(t.background || 0), this._stats = this.createStats(
|
|
6902
|
+
}), this._scene = this.createScene(), this._renderer.setClearColor(t.background || 0), this._stats = this.createStats(oe.instance.isShowStats), oe.instance.events.modified.addEventListener((s) => {
|
|
6903
6903
|
s.key == "isShowStats" && this.toggleStatsVisibility(this._stats, s.value);
|
|
6904
6904
|
}), this.canvas.addEventListener("click", () => {
|
|
6905
|
-
this.mode ==
|
|
6905
|
+
this.mode == R.SELECTION && this.select();
|
|
6906
6906
|
}), document.addEventListener("keydown", (s) => {
|
|
6907
6907
|
s.code === "Escape" && this.selectionSet.clear();
|
|
6908
|
-
}),
|
|
6908
|
+
}), Je().layoutManager.events.layoutSwitched.addEventListener(
|
|
6909
6909
|
(s) => {
|
|
6910
6910
|
this.activeLayoutBtrId = s.layout.blockTableRecordId;
|
|
6911
6911
|
}
|
|
6912
|
-
), this._missedImages = /* @__PURE__ */ new Map(), this._layoutViewManager = new
|
|
6912
|
+
), this._missedImages = /* @__PURE__ */ new Map(), this._layoutViewManager = new an(), this.initialize(), this.onWindowResize(), this.animate(), this._isDirty = !0;
|
|
6913
6913
|
}
|
|
6914
6914
|
/**
|
|
6915
6915
|
* Initializes the viewer after renderer and camera are created.
|
|
@@ -6920,7 +6920,7 @@ class vn extends gi {
|
|
|
6920
6920
|
* @protected
|
|
6921
6921
|
*/
|
|
6922
6922
|
initialize() {
|
|
6923
|
-
this.setCursor(
|
|
6923
|
+
this.setCursor(ce.Crosshair);
|
|
6924
6924
|
}
|
|
6925
6925
|
/**
|
|
6926
6926
|
* Gets the current view mode (selection or pan).
|
|
@@ -6930,7 +6930,7 @@ class vn extends gi {
|
|
|
6930
6930
|
*/
|
|
6931
6931
|
get mode() {
|
|
6932
6932
|
const e = this.activeLayoutView;
|
|
6933
|
-
return e ? e.mode :
|
|
6933
|
+
return e ? e.mode : R.SELECTION;
|
|
6934
6934
|
}
|
|
6935
6935
|
/**
|
|
6936
6936
|
* Sets the view mode (selection or pan).
|
|
@@ -7065,7 +7065,7 @@ class vn extends gi {
|
|
|
7065
7065
|
*/
|
|
7066
7066
|
zoomToFit() {
|
|
7067
7067
|
if (this._scene.box) {
|
|
7068
|
-
const e =
|
|
7068
|
+
const e = en.threeBox3dToGeBox2d(this._scene.box);
|
|
7069
7069
|
this.zoomTo(e), this._isDirty = !0;
|
|
7070
7070
|
}
|
|
7071
7071
|
}
|
|
@@ -7076,8 +7076,8 @@ class vn extends gi {
|
|
|
7076
7076
|
e == null && (e = this.curPos);
|
|
7077
7077
|
const t = [], i = this._scene.activeLayout;
|
|
7078
7078
|
if (i) {
|
|
7079
|
-
const n = this.activeLayoutView, s = n.pointToBox(e, this.selectionBoxSize),
|
|
7080
|
-
|
|
7079
|
+
const n = this.activeLayoutView, s = n.pointToBox(e, this.selectionBoxSize), r = this._scene.search(s), o = Math.max(s.size.width / 2, s.size.height / 2), a = n.resetRaycaster(e, o);
|
|
7080
|
+
r.forEach((h) => {
|
|
7081
7081
|
const l = h.id;
|
|
7082
7082
|
i.isIntersectWith(l, a) && t.push(l);
|
|
7083
7083
|
});
|
|
@@ -7109,7 +7109,9 @@ class vn extends gi {
|
|
|
7109
7109
|
*/
|
|
7110
7110
|
addEntity(e) {
|
|
7111
7111
|
const t = Array.isArray(e) ? e : [e];
|
|
7112
|
-
|
|
7112
|
+
setTimeout(async () => {
|
|
7113
|
+
await this.batchConvert(t);
|
|
7114
|
+
});
|
|
7113
7115
|
}
|
|
7114
7116
|
/**
|
|
7115
7117
|
* Remove the specified entity from this view.
|
|
@@ -7175,13 +7177,13 @@ class vn extends gi {
|
|
|
7175
7177
|
this._isDirty = this._scene.unhover([e]);
|
|
7176
7178
|
}
|
|
7177
7179
|
createScene() {
|
|
7178
|
-
const e = new
|
|
7180
|
+
const e = new fn();
|
|
7179
7181
|
return e.layouts.forEach((t) => {
|
|
7180
7182
|
t.setSnapObject(this.renderer.createObject());
|
|
7181
7183
|
}), e;
|
|
7182
7184
|
}
|
|
7183
7185
|
createStats(e) {
|
|
7184
|
-
const t = new
|
|
7186
|
+
const t = new Zt();
|
|
7185
7187
|
document.body.appendChild(t.dom);
|
|
7186
7188
|
const i = t.dom;
|
|
7187
7189
|
return i.style.position = "fixed", i.style.inset = "unset", i.style.bottom = "30px", i.style.right = "0px", this.toggleStatsVisibility(t, e), t;
|
|
@@ -7195,7 +7197,7 @@ class vn extends gi {
|
|
|
7195
7197
|
*/
|
|
7196
7198
|
createLayoutViewIfNeeded(e) {
|
|
7197
7199
|
let t = this._layoutViewManager.getAt(e);
|
|
7198
|
-
return t == null && (t = new
|
|
7200
|
+
return t == null && (t = new on(
|
|
7199
7201
|
this._renderer,
|
|
7200
7202
|
e,
|
|
7201
7203
|
this.width,
|
|
@@ -7217,214 +7219,37 @@ class vn extends gi {
|
|
|
7217
7219
|
* @param entities - The database entities
|
|
7218
7220
|
* @returns The converted three entities
|
|
7219
7221
|
*/
|
|
7220
|
-
batchConvert(e) {
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
const n = e[i], s = n.draw(
|
|
7222
|
+
async batchConvert(e) {
|
|
7223
|
+
for (let t = 0; t < e.length; ++t) {
|
|
7224
|
+
const i = e[t], n = i.draw(
|
|
7224
7225
|
this._renderer
|
|
7225
7226
|
);
|
|
7226
|
-
if (
|
|
7227
|
-
|
|
7228
|
-
const
|
|
7229
|
-
if (
|
|
7230
|
-
this._scene.addEntity(
|
|
7231
|
-
}),
|
|
7232
|
-
if (
|
|
7233
|
-
const r = this._layoutViewManager.getAt(
|
|
7227
|
+
if (n) {
|
|
7228
|
+
n.objectId = i.objectId, n.ownerId = i.ownerId, n.layerName = i.layer, n.visible = i.visibility;
|
|
7229
|
+
const s = !(i instanceof tt || i instanceof it);
|
|
7230
|
+
if (await n.draw().then(() => {
|
|
7231
|
+
this._scene.addEntity(n, s), n.dispose(), this._isDirty = !0;
|
|
7232
|
+
}), i instanceof Ke) {
|
|
7233
|
+
if (i.number > 1) {
|
|
7234
|
+
const r = this._layoutViewManager.getAt(i.ownerId);
|
|
7234
7235
|
if (r) {
|
|
7235
|
-
const
|
|
7236
|
+
const o = new ve(
|
|
7236
7237
|
r,
|
|
7237
|
-
|
|
7238
|
+
i.toGiViewport(),
|
|
7238
7239
|
this._renderer
|
|
7239
7240
|
);
|
|
7240
|
-
r.addViewport(
|
|
7241
|
+
r.addViewport(o);
|
|
7241
7242
|
}
|
|
7242
7243
|
}
|
|
7243
|
-
} else if (
|
|
7244
|
-
const r =
|
|
7245
|
-
r && this._missedImages.set(
|
|
7244
|
+
} else if (i instanceof et) {
|
|
7245
|
+
const r = i.imageFileName;
|
|
7246
|
+
r && this._missedImages.set(i.objectId, r);
|
|
7246
7247
|
}
|
|
7247
7248
|
}
|
|
7248
7249
|
}
|
|
7249
|
-
return t;
|
|
7250
|
-
}
|
|
7251
|
-
}
|
|
7252
|
-
const Je = "simsun";
|
|
7253
|
-
class Q {
|
|
7254
|
-
/**
|
|
7255
|
-
* Gets the singleton instance of the document creator.
|
|
7256
|
-
*
|
|
7257
|
-
* @returns The singleton AcApDocCreator instance
|
|
7258
|
-
*/
|
|
7259
|
-
static get instance() {
|
|
7260
|
-
return Q._instance || (Q._instance = new Q()), Q._instance;
|
|
7261
|
-
}
|
|
7262
|
-
/**
|
|
7263
|
-
* Creates a simple example document with circular hatches.
|
|
7264
|
-
*
|
|
7265
|
-
* This method generates a 2x2 grid of circular hatched areas,
|
|
7266
|
-
* useful for testing hatch rendering and basic geometry display.
|
|
7267
|
-
*
|
|
7268
|
-
* @param db - The database to add the example entities to
|
|
7269
|
-
*
|
|
7270
|
-
* @example
|
|
7271
|
-
* ```typescript
|
|
7272
|
-
* const creator = AcApDocCreator.instance;
|
|
7273
|
-
* const database = new AcDbDatabase();
|
|
7274
|
-
* creator.createExampleDoc1(database);
|
|
7275
|
-
* // Database now contains 4 circular hatches in a grid
|
|
7276
|
-
* ```
|
|
7277
|
-
*/
|
|
7278
|
-
createExampleDoc1(e) {
|
|
7279
|
-
for (let n = 0; n < 2; ++n)
|
|
7280
|
-
for (let s = 0; s < 2; ++s) {
|
|
7281
|
-
const o = new De(), r = new ct();
|
|
7282
|
-
r.addVertexAt(0, { x: s * 100, y: n * 100, bulge: 1 }), r.addVertexAt(1, { x: s * 100 + 100, y: n * 100, bulge: 1 }), r.closed = !0, o.add(r), e.tables.blockTable.modelSpace.appendEntity(o);
|
|
7283
|
-
}
|
|
7284
|
-
}
|
|
7285
|
-
/**
|
|
7286
|
-
* Creates a comprehensive example document with various CAD entities.
|
|
7287
|
-
*
|
|
7288
|
-
* This method generates a more complex document containing:
|
|
7289
|
-
* - Arcs and lines forming geometric shapes
|
|
7290
|
-
* - Complex hatches with boundary loops
|
|
7291
|
-
* - Formatted text (MText) with Chinese characters
|
|
7292
|
-
* - Custom text styles
|
|
7293
|
-
*
|
|
7294
|
-
* This example is useful for testing complex rendering scenarios,
|
|
7295
|
-
* text handling, and international character support.
|
|
7296
|
-
*
|
|
7297
|
-
* @param db - The database to add the example entities to
|
|
7298
|
-
*
|
|
7299
|
-
* @example
|
|
7300
|
-
* ```typescript
|
|
7301
|
-
* const creator = AcApDocCreator.instance;
|
|
7302
|
-
* const database = new AcDbDatabase();
|
|
7303
|
-
* creator.createExampleDoc2(database);
|
|
7304
|
-
* // Database now contains arcs, lines, hatches, and formatted text
|
|
7305
|
-
* ```
|
|
7306
|
-
*/
|
|
7307
|
-
createExampleDoc2(e) {
|
|
7308
|
-
const t = e.tables.blockTable.modelSpace;
|
|
7309
|
-
t.appendEntity(this.createArc()), this.createLines().forEach((n) => {
|
|
7310
|
-
e.tables.blockTable.modelSpace.appendEntity(
|
|
7311
|
-
new ht(n.startPoint, n.endPoint)
|
|
7312
|
-
);
|
|
7313
|
-
}), t.appendEntity(this.createHatch()), e.tables.textStyleTable.add(this.createTextStyle()), t.appendEntity(this.createMText());
|
|
7314
|
-
}
|
|
7315
|
-
createTextStyle() {
|
|
7316
|
-
const e = {
|
|
7317
|
-
bigFont: "",
|
|
7318
|
-
color: 16777215,
|
|
7319
|
-
extendedFont: Je,
|
|
7320
|
-
fixedTextHeight: 0,
|
|
7321
|
-
font: Je,
|
|
7322
|
-
lastHeight: 0.2,
|
|
7323
|
-
name: "Standard",
|
|
7324
|
-
obliqueAngle: 0,
|
|
7325
|
-
standardFlag: 0,
|
|
7326
|
-
textGenerationFlag: 0,
|
|
7327
|
-
widthFactor: 0.667
|
|
7328
|
-
};
|
|
7329
|
-
return new lt(e);
|
|
7330
|
-
}
|
|
7331
|
-
createMText() {
|
|
7332
|
-
const e = new dt();
|
|
7333
|
-
return e.attachmentPoint = It.MiddleLeft, e.color = new Re().setColorName("red"), e.layer = "0", e.location = new ze(9850, 86773, 0), e.contents = "{\\W0.667;\\T1.1;智慧8081}", e.height = 200, e.width = 1e3, e.styleName = "Standard", e;
|
|
7334
|
-
}
|
|
7335
|
-
createHatch() {
|
|
7336
|
-
const e = this.createLines(), t = new De(), i = new ut();
|
|
7337
|
-
return i.add(
|
|
7338
|
-
new mt(
|
|
7339
|
-
{ x: 20241.23355899991, y: 174118.6312674369 },
|
|
7340
|
-
89258.30757455899,
|
|
7341
|
-
re.degToRad(262.2471115358437),
|
|
7342
|
-
re.degToRad(264.444541053754),
|
|
7343
|
-
!1
|
|
7344
|
-
)
|
|
7345
|
-
), e.forEach((n) => {
|
|
7346
|
-
i.add(new gt(n.startPoint, n.endPoint));
|
|
7347
|
-
}), t.add(i), t;
|
|
7348
|
-
}
|
|
7349
|
-
createArc() {
|
|
7350
|
-
return new pt(
|
|
7351
|
-
{ x: 20241.23355899991, y: 174118.6312674369, z: 0 },
|
|
7352
|
-
89258.30757455899,
|
|
7353
|
-
re.degToRad(262.2471115358437),
|
|
7354
|
-
re.degToRad(264.444541053754)
|
|
7355
|
-
);
|
|
7356
|
-
}
|
|
7357
|
-
createLines() {
|
|
7358
|
-
const e = [];
|
|
7359
|
-
return e.push(
|
|
7360
|
-
new K(
|
|
7361
|
-
{
|
|
7362
|
-
x: 11600.20888122753,
|
|
7363
|
-
y: 85279.57362051727,
|
|
7364
|
-
z: 0
|
|
7365
|
-
},
|
|
7366
|
-
{
|
|
7367
|
-
x: 11600.20890652924,
|
|
7368
|
-
y: 86546.03982284805,
|
|
7369
|
-
z: 0
|
|
7370
|
-
}
|
|
7371
|
-
)
|
|
7372
|
-
), e.push(
|
|
7373
|
-
new K(
|
|
7374
|
-
{
|
|
7375
|
-
x: 11600.20890652924,
|
|
7376
|
-
y: 86546.03982284805,
|
|
7377
|
-
z: 0
|
|
7378
|
-
},
|
|
7379
|
-
{
|
|
7380
|
-
x: 10850.20885583921,
|
|
7381
|
-
y: 86546.03980174381,
|
|
7382
|
-
z: 0
|
|
7383
|
-
}
|
|
7384
|
-
)
|
|
7385
|
-
), e.push(
|
|
7386
|
-
new K(
|
|
7387
|
-
{
|
|
7388
|
-
x: 10850.2088602169,
|
|
7389
|
-
y: 86546.03967292747,
|
|
7390
|
-
z: 0
|
|
7391
|
-
},
|
|
7392
|
-
{
|
|
7393
|
-
x: 9050.208860216895,
|
|
7394
|
-
y: 86546.039672927,
|
|
7395
|
-
z: 0
|
|
7396
|
-
}
|
|
7397
|
-
)
|
|
7398
|
-
), e.push(
|
|
7399
|
-
new K(
|
|
7400
|
-
{
|
|
7401
|
-
x: 9050.208855839213,
|
|
7402
|
-
y: 86546.0397510943,
|
|
7403
|
-
z: 0
|
|
7404
|
-
},
|
|
7405
|
-
{
|
|
7406
|
-
x: 8200.209067034302,
|
|
7407
|
-
y: 86546.039727177,
|
|
7408
|
-
z: 0
|
|
7409
|
-
}
|
|
7410
|
-
)
|
|
7411
|
-
), e.push(
|
|
7412
|
-
new K(
|
|
7413
|
-
{
|
|
7414
|
-
x: 8200.209067034302,
|
|
7415
|
-
y: 86546.039727177,
|
|
7416
|
-
z: 0
|
|
7417
|
-
},
|
|
7418
|
-
{
|
|
7419
|
-
x: 8200.209067033837,
|
|
7420
|
-
y: 85676.22514764359,
|
|
7421
|
-
z: 0
|
|
7422
|
-
}
|
|
7423
|
-
)
|
|
7424
|
-
), e;
|
|
7425
7250
|
}
|
|
7426
7251
|
}
|
|
7427
|
-
class
|
|
7252
|
+
class _n {
|
|
7428
7253
|
/**
|
|
7429
7254
|
* Creates a new font loader instance.
|
|
7430
7255
|
*
|
|
@@ -7466,8 +7291,8 @@ class Sn {
|
|
|
7466
7291
|
await this.getAvaiableFonts();
|
|
7467
7292
|
const t = [];
|
|
7468
7293
|
e.forEach((n) => {
|
|
7469
|
-
const s = n.toLowerCase(),
|
|
7470
|
-
|
|
7294
|
+
const s = n.toLowerCase(), r = Ht(this._avaiableFonts, (o) => qt(o.name, (a) => a.toLowerCase() == s) >= 0);
|
|
7295
|
+
r && t.push(r.url);
|
|
7471
7296
|
}), (await this._cadRenderer.loadFonts(t)).forEach((n) => {
|
|
7472
7297
|
n.status || V.emit("font-not-loaded", {
|
|
7473
7298
|
fontName: n.fontName,
|
|
@@ -7493,7 +7318,7 @@ class C {
|
|
|
7493
7318
|
/** Fired when a document becomes active */
|
|
7494
7319
|
documentActivated: new M()
|
|
7495
7320
|
};
|
|
7496
|
-
const t = new
|
|
7321
|
+
const t = new di();
|
|
7497
7322
|
t.database.events.openProgress.addEventListener((s) => {
|
|
7498
7323
|
V.emit("open-file-progress", {
|
|
7499
7324
|
database: t.database,
|
|
@@ -7506,8 +7331,8 @@ class C {
|
|
|
7506
7331
|
const i = () => ({
|
|
7507
7332
|
width: window.innerWidth,
|
|
7508
7333
|
height: window.innerHeight - 30
|
|
7509
|
-
}), n = new
|
|
7510
|
-
this._context = new
|
|
7334
|
+
}), n = new xn({ canvas: e, calculateSizeCallback: i });
|
|
7335
|
+
this._context = new Jt(n, t), this._fontLoader = new _n(n.renderer), Je().workingDatabase = t.database, this.registerCommands();
|
|
7511
7336
|
}
|
|
7512
7337
|
/**
|
|
7513
7338
|
* Creates the singleton instance with an optional canvas element.
|
|
@@ -7638,18 +7463,6 @@ class C {
|
|
|
7638
7463
|
async loadDefaultFonts(e) {
|
|
7639
7464
|
e == null ? await this._fontLoader.load(["simkai"]) : await this._fontLoader.load(e);
|
|
7640
7465
|
}
|
|
7641
|
-
/**
|
|
7642
|
-
* Creates an example CAD document with sample content.
|
|
7643
|
-
*
|
|
7644
|
-
* This method asynchronously loads default fonts, creates example drawing content,
|
|
7645
|
-
* sets up layout information, and zooms the view to fit the content.
|
|
7646
|
-
* The creation is performed after a short delay to ensure proper initialization.
|
|
7647
|
-
*/
|
|
7648
|
-
createExampleDoc() {
|
|
7649
|
-
setTimeout(async () => {
|
|
7650
|
-
Q.instance.createExampleDoc2(this.curDocument.database), this.setLayoutInfo(), this.curView.zoomToFit();
|
|
7651
|
-
});
|
|
7652
|
-
}
|
|
7653
7466
|
/**
|
|
7654
7467
|
* Opens a CAD document from a URL.
|
|
7655
7468
|
*
|
|
@@ -7720,37 +7533,37 @@ class C {
|
|
|
7720
7533
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7721
7534
|
"pan",
|
|
7722
7535
|
"pan",
|
|
7723
|
-
new
|
|
7536
|
+
new Ii()
|
|
7724
7537
|
), e.addCommand(
|
|
7725
7538
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7726
7539
|
"select",
|
|
7727
7540
|
"select",
|
|
7728
|
-
new
|
|
7541
|
+
new bi()
|
|
7729
7542
|
), e.addCommand(
|
|
7730
7543
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7731
7544
|
"zoom",
|
|
7732
7545
|
"zoom",
|
|
7733
|
-
new
|
|
7546
|
+
new wi()
|
|
7734
7547
|
), e.addCommand(
|
|
7735
7548
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7736
7549
|
"zoomw",
|
|
7737
7550
|
"zoomw",
|
|
7738
|
-
new
|
|
7551
|
+
new Si()
|
|
7739
7552
|
), e.addCommand(
|
|
7740
7553
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7741
7554
|
"csvg",
|
|
7742
7555
|
"csvg",
|
|
7743
|
-
new
|
|
7556
|
+
new fi()
|
|
7744
7557
|
), e.addCommand(
|
|
7745
7558
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7746
7559
|
"qnew",
|
|
7747
7560
|
"qnew",
|
|
7748
|
-
new
|
|
7561
|
+
new _i()
|
|
7749
7562
|
), e.addCommand(
|
|
7750
7563
|
A.SYSTEMT_COMMAND_GROUP_NAME,
|
|
7751
7564
|
"open",
|
|
7752
7565
|
"open",
|
|
7753
|
-
new
|
|
7566
|
+
new xi()
|
|
7754
7567
|
);
|
|
7755
7568
|
}
|
|
7756
7569
|
/**
|
|
@@ -7771,6 +7584,16 @@ class C {
|
|
|
7771
7584
|
const i = A.instance.lookupGlobalCmd(e);
|
|
7772
7585
|
i == null || i.execute(this.context);
|
|
7773
7586
|
}
|
|
7587
|
+
/**
|
|
7588
|
+
* Configures layout information for the current view.
|
|
7589
|
+
*
|
|
7590
|
+
* Sets up the active layout block table record ID and model space block table
|
|
7591
|
+
* record ID based on the current document's space configuration.
|
|
7592
|
+
*/
|
|
7593
|
+
setActiveLayout() {
|
|
7594
|
+
const e = this.curView;
|
|
7595
|
+
e.activeLayoutBtrId = this.curDocument.database.currentSpaceId, e.modelSpaceBtrId = this.curDocument.database.currentSpaceId;
|
|
7596
|
+
}
|
|
7774
7597
|
/**
|
|
7775
7598
|
* Performs cleanup operations before opening a new document.
|
|
7776
7599
|
*
|
|
@@ -7795,7 +7618,7 @@ class C {
|
|
|
7795
7618
|
onAfterOpenDocument(e) {
|
|
7796
7619
|
if (e) {
|
|
7797
7620
|
const t = this.context.doc;
|
|
7798
|
-
this.events.documentActivated.dispatch({ doc: t }), this.
|
|
7621
|
+
this.events.documentActivated.dispatch({ doc: t }), this.setActiveLayout();
|
|
7799
7622
|
const i = t.database;
|
|
7800
7623
|
this.curView.zoomTo(new L(i.extmin, i.extmax));
|
|
7801
7624
|
}
|
|
@@ -7814,20 +7637,8 @@ class C {
|
|
|
7814
7637
|
setOptions(e) {
|
|
7815
7638
|
return e == null ? e = { fontLoader: this._fontLoader } : e.fontLoader == null && (e.fontLoader = this._fontLoader), e;
|
|
7816
7639
|
}
|
|
7817
|
-
/**
|
|
7818
|
-
* Configures layout information for the current view.
|
|
7819
|
-
*
|
|
7820
|
-
* This private method sets up the active layout block table record ID and
|
|
7821
|
-
* model space block table record ID based on the current document's space configuration.
|
|
7822
|
-
*
|
|
7823
|
-
* @private
|
|
7824
|
-
*/
|
|
7825
|
-
setLayoutInfo() {
|
|
7826
|
-
const e = this.curView;
|
|
7827
|
-
e.activeLayoutBtrId = this.curDocument.database.currentSpaceId, e.modelSpaceBtrId = this.curDocument.database.currentSpaceId;
|
|
7828
|
-
}
|
|
7829
7640
|
}
|
|
7830
|
-
class
|
|
7641
|
+
class Ye {
|
|
7831
7642
|
convert(e) {
|
|
7832
7643
|
const t = this.createEntity(e);
|
|
7833
7644
|
return t && this.processCommonAttrs(e, t), t;
|
|
@@ -7841,7 +7652,7 @@ class Ke {
|
|
|
7841
7652
|
return e.type == "ARC" ? this.convertArc(e) : e.type == "CIRCLE" ? this.convertCirle(e) : e.type == "DIMENSION" ? this.convertDimension(e) : e.type == "ELLIPSE" ? this.convertEllipse(e) : e.type == "HATCH" ? this.convertHatch(e) : e.type == "IMAGE" ? this.convertImage(e) : e.type == "LEADER" ? this.convertLeader(e) : e.type == "LINE" ? this.convertLine(e) : e.type == "LWPOLYLINE" ? this.convertLWPolyline(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "POINT" ? this.convertPoint(e) : e.type == "POLYLINE" ? this.convertPolyline(e) : e.type == "RAY" ? this.convertRay(e) : e.type == "SPLINE" ? this.convertSpline(e) : e.type == "ACAD_TABLE" ? this.convertTable(e) : e.type == "TEXT" ? this.convertText(e) : e.type == "SOLID" ? this.convertSolid(e) : e.type == "VIEWPORT" ? this.convertViewport(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
|
|
7842
7653
|
}
|
|
7843
7654
|
convertArc(e) {
|
|
7844
|
-
return new
|
|
7655
|
+
return new vt(
|
|
7845
7656
|
e.center,
|
|
7846
7657
|
e.radius,
|
|
7847
7658
|
e.startAngle,
|
|
@@ -7849,13 +7660,13 @@ class Ke {
|
|
|
7849
7660
|
);
|
|
7850
7661
|
}
|
|
7851
7662
|
convertCirle(e) {
|
|
7852
|
-
return new
|
|
7663
|
+
return new St(e.center, e.radius);
|
|
7853
7664
|
}
|
|
7854
7665
|
convertEllipse(e) {
|
|
7855
|
-
const t = new
|
|
7856
|
-
return new
|
|
7666
|
+
const t = new fe(e.majorAxisEndPoint), i = t.length();
|
|
7667
|
+
return new It(
|
|
7857
7668
|
e.center,
|
|
7858
|
-
|
|
7669
|
+
fe.Z_AXIS,
|
|
7859
7670
|
t,
|
|
7860
7671
|
i,
|
|
7861
7672
|
i * e.axisRatio,
|
|
@@ -7865,19 +7676,19 @@ class Ke {
|
|
|
7865
7676
|
}
|
|
7866
7677
|
convertLine(e) {
|
|
7867
7678
|
const t = e.startPoint, i = e.endPoint;
|
|
7868
|
-
return new
|
|
7679
|
+
return new Bt(
|
|
7869
7680
|
new ze(t.x, t.y, t.z),
|
|
7870
7681
|
new ze(i.x, i.y, i.z)
|
|
7871
7682
|
);
|
|
7872
7683
|
}
|
|
7873
7684
|
convertSpline(e) {
|
|
7874
|
-
return e.numberOfControlPoints > 0 && e.numberOfKnots > 0 ? new
|
|
7685
|
+
return e.numberOfControlPoints > 0 && e.numberOfKnots > 0 ? new Pe(
|
|
7875
7686
|
e.controlPoints,
|
|
7876
7687
|
e.knots,
|
|
7877
7688
|
e.weights,
|
|
7878
7689
|
e.degree,
|
|
7879
7690
|
!!(e.flag & 1)
|
|
7880
|
-
) : e.numberOfFitPoints > 0 ? new
|
|
7691
|
+
) : e.numberOfFitPoints > 0 ? new Pe(
|
|
7881
7692
|
e.fitPoints,
|
|
7882
7693
|
"Uniform",
|
|
7883
7694
|
e.degree,
|
|
@@ -7885,18 +7696,18 @@ class Ke {
|
|
|
7885
7696
|
) : null;
|
|
7886
7697
|
}
|
|
7887
7698
|
convertPoint(e) {
|
|
7888
|
-
const t = new
|
|
7699
|
+
const t = new Mt();
|
|
7889
7700
|
return t.position = e.position, t;
|
|
7890
7701
|
}
|
|
7891
7702
|
convertSolid(e) {
|
|
7892
|
-
const t = new
|
|
7703
|
+
const t = new At();
|
|
7893
7704
|
return t.setPointAt(0, { ...e.corner1, z: 0 }), t.setPointAt(1, { ...e.corner2, z: 0 }), t.setPointAt(2, { ...e.corner3, z: 0 }), t.setPointAt(
|
|
7894
7705
|
3,
|
|
7895
7706
|
e.corner4 ? { ...e.corner4, z: 0 } : { ...e.corner3, z: 0 }
|
|
7896
7707
|
), t.thickness = e.thickness, t;
|
|
7897
7708
|
}
|
|
7898
7709
|
convertLWPolyline(e) {
|
|
7899
|
-
const t = new
|
|
7710
|
+
const t = new Oe();
|
|
7900
7711
|
return t.closed = !!(e.flag & 512), e.vertices.forEach((i, n) => {
|
|
7901
7712
|
t.addVertexAt(
|
|
7902
7713
|
n,
|
|
@@ -7908,7 +7719,7 @@ class Ke {
|
|
|
7908
7719
|
}), t;
|
|
7909
7720
|
}
|
|
7910
7721
|
convertPolyline(e) {
|
|
7911
|
-
const t = new
|
|
7722
|
+
const t = new Oe();
|
|
7912
7723
|
return t.closed = !!(e.flag & 1), e.vertices.forEach((i, n) => {
|
|
7913
7724
|
t.addVertexAt(
|
|
7914
7725
|
n,
|
|
@@ -7921,7 +7732,7 @@ class Ke {
|
|
|
7921
7732
|
}
|
|
7922
7733
|
convertHatch(e) {
|
|
7923
7734
|
var t;
|
|
7924
|
-
const i = new
|
|
7735
|
+
const i = new Ct();
|
|
7925
7736
|
return (t = e.definitionLines) == null || t.forEach((n) => {
|
|
7926
7737
|
i.definitionLines.push({
|
|
7927
7738
|
angle: n.angle,
|
|
@@ -7931,24 +7742,24 @@ class Ke {
|
|
|
7931
7742
|
});
|
|
7932
7743
|
}), i.hatchStyle = e.hatchStyle, i.patternName = e.patternName, i.patternType = e.patternType, i.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, i.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((n) => {
|
|
7933
7744
|
if (n.boundaryPathTypeFlag & 2) {
|
|
7934
|
-
const s = n,
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
x:
|
|
7938
|
-
y:
|
|
7939
|
-
bulge:
|
|
7745
|
+
const s = n, r = new Lt();
|
|
7746
|
+
r.closed = s.isClosed, s.vertices.forEach((o, a) => {
|
|
7747
|
+
r.addVertexAt(a, {
|
|
7748
|
+
x: o.x,
|
|
7749
|
+
y: o.y,
|
|
7750
|
+
bulge: o.bulge
|
|
7940
7751
|
});
|
|
7941
|
-
}), i.add(
|
|
7752
|
+
}), i.add(r);
|
|
7942
7753
|
} else {
|
|
7943
|
-
const s = n,
|
|
7944
|
-
s.edges.forEach((
|
|
7945
|
-
if (
|
|
7946
|
-
const a =
|
|
7947
|
-
|
|
7948
|
-
} else if (
|
|
7949
|
-
const a =
|
|
7950
|
-
|
|
7951
|
-
new
|
|
7754
|
+
const s = n, r = new Et();
|
|
7755
|
+
s.edges.forEach((o) => {
|
|
7756
|
+
if (o.type == 1) {
|
|
7757
|
+
const a = o;
|
|
7758
|
+
r.add(new Tt(a.start, a.end));
|
|
7759
|
+
} else if (o.type == 2) {
|
|
7760
|
+
const a = o;
|
|
7761
|
+
r.add(
|
|
7762
|
+
new Dt(
|
|
7952
7763
|
a.center,
|
|
7953
7764
|
a.radius,
|
|
7954
7765
|
a.startAngle,
|
|
@@ -7956,16 +7767,16 @@ class Ke {
|
|
|
7956
7767
|
!a.isCCW
|
|
7957
7768
|
)
|
|
7958
7769
|
);
|
|
7959
|
-
} else if (
|
|
7960
|
-
const a =
|
|
7961
|
-
new
|
|
7770
|
+
} else if (o.type == 3) {
|
|
7771
|
+
const a = o;
|
|
7772
|
+
new Ce().subVectors(a.end, a.center);
|
|
7962
7773
|
const h = Math.sqrt(
|
|
7963
7774
|
Math.pow(a.end.x, 2) + Math.pow(a.end.y, 2)
|
|
7964
7775
|
), l = h * a.lengthOfMinorAxis;
|
|
7965
7776
|
let m = a.startAngle, u = a.endAngle;
|
|
7966
7777
|
const p = Math.atan2(a.end.y, a.end.x);
|
|
7967
|
-
a.isCCW || (m = Math.PI * 2 - m, u = Math.PI * 2 - u),
|
|
7968
|
-
new
|
|
7778
|
+
a.isCCW || (m = Math.PI * 2 - m, u = Math.PI * 2 - u), r.add(
|
|
7779
|
+
new zt(
|
|
7969
7780
|
{ ...a.center, z: 0 },
|
|
7970
7781
|
h,
|
|
7971
7782
|
l,
|
|
@@ -7975,8 +7786,8 @@ class Ke {
|
|
|
7975
7786
|
p
|
|
7976
7787
|
)
|
|
7977
7788
|
);
|
|
7978
|
-
} else if (
|
|
7979
|
-
const a =
|
|
7789
|
+
} else if (o.type == 4) {
|
|
7790
|
+
const a = o;
|
|
7980
7791
|
if (a.numberOfControlPoints > 0 && a.numberOfKnots > 0) {
|
|
7981
7792
|
const h = a.controlPoints.map(
|
|
7982
7793
|
(u) => ({
|
|
@@ -7987,8 +7798,8 @@ class Ke {
|
|
|
7987
7798
|
);
|
|
7988
7799
|
let l = !0;
|
|
7989
7800
|
const m = a.controlPoints.map((u) => (u.weight == null && (l = !1), u.weight || 1));
|
|
7990
|
-
|
|
7991
|
-
new
|
|
7801
|
+
r.add(
|
|
7802
|
+
new Re(
|
|
7992
7803
|
h,
|
|
7993
7804
|
a.knots,
|
|
7994
7805
|
l ? m : void 0
|
|
@@ -8000,15 +7811,15 @@ class Ke {
|
|
|
8000
7811
|
y: l.y,
|
|
8001
7812
|
z: 0
|
|
8002
7813
|
}));
|
|
8003
|
-
|
|
7814
|
+
r.add(new Re(h, "Uniform"));
|
|
8004
7815
|
}
|
|
8005
7816
|
}
|
|
8006
|
-
}), i.add(
|
|
7817
|
+
}), i.add(r);
|
|
8007
7818
|
}
|
|
8008
7819
|
}), i;
|
|
8009
7820
|
}
|
|
8010
7821
|
convertTable(e) {
|
|
8011
|
-
const t = new
|
|
7822
|
+
const t = new Pt(
|
|
8012
7823
|
e.name,
|
|
8013
7824
|
e.rowCount,
|
|
8014
7825
|
e.columnCount
|
|
@@ -8022,29 +7833,29 @@ class Ke {
|
|
|
8022
7833
|
}), t;
|
|
8023
7834
|
}
|
|
8024
7835
|
convertText(e) {
|
|
8025
|
-
const t = new
|
|
7836
|
+
const t = new Ot();
|
|
8026
7837
|
return t.textString = e.text, t.styleName = e.styleName, t.height = e.textHeight, t.position.copy(e.startPoint), t.rotation = e.rotation, t.oblique = e.obliqueAngle ?? 0, t.thickness = e.thickness, t.horizontalMode = e.halign, t.verticalMode = e.valign, t.widthFactor = e.xScale ?? 1, t;
|
|
8027
7838
|
}
|
|
8028
7839
|
convertMText(e) {
|
|
8029
|
-
const t = new
|
|
8030
|
-
return t.contents = e.text, e.styleName != null && (t.styleName = e.styleName), t.height = e.textHeight, t.width = e.rectWidth, t.rotation = e.rotation || 0, t.location = e.insertionPoint, t.attachmentPoint = e.attachmentPoint, e.direction && (t.direction = new
|
|
7840
|
+
const t = new Rt();
|
|
7841
|
+
return t.contents = e.text, e.styleName != null && (t.styleName = e.styleName), t.height = e.textHeight, t.width = e.rectWidth, t.rotation = e.rotation || 0, t.location = e.insertionPoint, t.attachmentPoint = e.attachmentPoint, e.direction && (t.direction = new fe(e.direction)), t.drawingDirection = e.drawingDirection, t;
|
|
8031
7842
|
}
|
|
8032
7843
|
convertLeader(e) {
|
|
8033
|
-
const t = new
|
|
7844
|
+
const t = new Vt();
|
|
8034
7845
|
return e.vertices.forEach((i) => {
|
|
8035
7846
|
t.appendVertex(i);
|
|
8036
7847
|
}), t.hasArrowHead = e.isArrowheadEnabled, t.hasHookLine = e.isHooklineExists, t.isSplined = e.isSpline, t.dimensionStyle = e.styleName, t.annoType = e.leaderCreationFlag, t;
|
|
8037
7848
|
}
|
|
8038
7849
|
convertDimension(e) {
|
|
8039
7850
|
if (e.subclassMarker == "AcDbAlignedDimension" || e.subclassMarker == "AcDbRotatedDimension") {
|
|
8040
|
-
const t = e, i = new
|
|
7851
|
+
const t = e, i = new jt(
|
|
8041
7852
|
t.subDefinitionPoint1,
|
|
8042
7853
|
t.subDefinitionPoint2,
|
|
8043
7854
|
t.definitionPoint
|
|
8044
7855
|
);
|
|
8045
7856
|
return i.rotation = t.rotationAngle, this.processDimensionCommonAttrs(e, i), i;
|
|
8046
7857
|
} else if (e.subclassMarker == "AcDb3PointAngularDimension") {
|
|
8047
|
-
const t = e, i = new
|
|
7858
|
+
const t = e, i = new Gt(
|
|
8048
7859
|
t.centerPoint,
|
|
8049
7860
|
t.subDefinitionPoint1,
|
|
8050
7861
|
t.subDefinitionPoint2,
|
|
@@ -8052,20 +7863,20 @@ class Ke {
|
|
|
8052
7863
|
);
|
|
8053
7864
|
return this.processDimensionCommonAttrs(e, i), i;
|
|
8054
7865
|
} else if (e.subclassMarker == "AcDbOrdinateDimension") {
|
|
8055
|
-
const t = e, i = new
|
|
7866
|
+
const t = e, i = new kt(
|
|
8056
7867
|
t.subDefinitionPoint1,
|
|
8057
7868
|
t.subDefinitionPoint2
|
|
8058
7869
|
);
|
|
8059
7870
|
return this.processDimensionCommonAttrs(e, i), i;
|
|
8060
7871
|
} else if (e.subclassMarker == "AcDbRadialDimension") {
|
|
8061
|
-
const t = e, i = new
|
|
7872
|
+
const t = e, i = new Nt(
|
|
8062
7873
|
t.definitionPoint,
|
|
8063
7874
|
t.centerPoint,
|
|
8064
7875
|
t.leaderLength
|
|
8065
7876
|
);
|
|
8066
7877
|
return this.processDimensionCommonAttrs(e, i), i;
|
|
8067
7878
|
} else if (e.subclassMarker == "AcDbDiametricDimension") {
|
|
8068
|
-
const t = e, i = new
|
|
7879
|
+
const t = e, i = new Ft(
|
|
8069
7880
|
t.definitionPoint,
|
|
8070
7881
|
t.centerPoint,
|
|
8071
7882
|
t.leaderLength
|
|
@@ -8084,7 +7895,7 @@ class Ke {
|
|
|
8084
7895
|
) * e.imageSize.y, t.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
|
|
8085
7896
|
}
|
|
8086
7897
|
convertImage(e) {
|
|
8087
|
-
const t = new
|
|
7898
|
+
const t = new et();
|
|
8088
7899
|
return this.processImage(e, t), t;
|
|
8089
7900
|
}
|
|
8090
7901
|
// private convertWipeout(wipeout: WipeoutEntity) {
|
|
@@ -8093,19 +7904,19 @@ class Ke {
|
|
|
8093
7904
|
// return dbWipeout
|
|
8094
7905
|
// }
|
|
8095
7906
|
convertViewport(e) {
|
|
8096
|
-
const t = new
|
|
7907
|
+
const t = new Ke();
|
|
8097
7908
|
return t.number = e.viewportId, t.centerPoint.copy(e.viewportCenter), t.height = e.height, t.width = e.width, t.viewCenter.copy(e.displayCenter), t.viewHeight = e.viewHeight, t;
|
|
8098
7909
|
}
|
|
8099
7910
|
convertRay(e) {
|
|
8100
|
-
const t = new
|
|
7911
|
+
const t = new tt();
|
|
8101
7912
|
return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
|
|
8102
7913
|
}
|
|
8103
7914
|
convertXline(e) {
|
|
8104
|
-
const t = new
|
|
7915
|
+
const t = new it();
|
|
8105
7916
|
return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
|
|
8106
7917
|
}
|
|
8107
7918
|
convertBlockReference(e) {
|
|
8108
|
-
const t = new
|
|
7919
|
+
const t = new Ut(e.name);
|
|
8109
7920
|
return e.insertionPoint && t.position.copy(e.insertionPoint), t.scaleFactors.x = e.xScale, t.scaleFactors.y = e.yScale, t.scaleFactors.z = e.zScale, t.rotation = e.rotation, t.normal.copy(e.extrusionDirection), t;
|
|
8110
7921
|
}
|
|
8111
7922
|
processDimensionCommonAttrs(e, t) {
|
|
@@ -8115,13 +7926,13 @@ class Ke {
|
|
|
8115
7926
|
t.layer = e.layer, t.objectId = e.handle.toString(), t.ownerId = e.ownerBlockRecordSoftId.toString(), e.lineType != null && (t.lineType = e.lineType), e.lineweight != null && (t.lineWeight = e.lineweight), e.lineTypeScale != null && (t.linetypeScale = e.lineTypeScale), e.color != null && (t.color.color = e.color), e.colorIndex != null && (t.color.colorIndex = e.colorIndex), e.colorName != null && (t.color.colorName = e.colorName), e.isVisible != null && (t.visibility = e.isVisible), e.transparency != null && (t.transparency = e.transparency);
|
|
8116
7927
|
}
|
|
8117
7928
|
}
|
|
8118
|
-
class
|
|
7929
|
+
class bn extends ut {
|
|
8119
7930
|
constructor(e = {}) {
|
|
8120
7931
|
super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
|
|
8121
7932
|
}
|
|
8122
7933
|
async parse(e) {
|
|
8123
7934
|
if (this.config.useWorker && this.config.parserWorkerUrl) {
|
|
8124
|
-
const t =
|
|
7935
|
+
const t = mt({
|
|
8125
7936
|
workerUrl: this.config.parserWorkerUrl,
|
|
8126
7937
|
// One concurrent worker needed for parser
|
|
8127
7938
|
maxConcurrentWorkers: 1
|
|
@@ -8137,19 +7948,19 @@ class In extends Bt {
|
|
|
8137
7948
|
*/
|
|
8138
7949
|
getFonts(e) {
|
|
8139
7950
|
const t = /* @__PURE__ */ new Map();
|
|
8140
|
-
e.tables.BLOCK_RECORD.entries.forEach((
|
|
8141
|
-
t.set(
|
|
7951
|
+
e.tables.BLOCK_RECORD.entries.forEach((r) => {
|
|
7952
|
+
t.set(r.name, r);
|
|
8142
7953
|
});
|
|
8143
|
-
const i = /* @__PURE__ */ new Map(), n = (
|
|
8144
|
-
if (
|
|
8145
|
-
const
|
|
8146
|
-
return
|
|
7954
|
+
const i = /* @__PURE__ */ new Map(), n = (r) => {
|
|
7955
|
+
if (r) {
|
|
7956
|
+
const o = r.lastIndexOf(".");
|
|
7957
|
+
return o >= 0 ? r.substring(0, o).toLowerCase() : r.toLowerCase();
|
|
8147
7958
|
}
|
|
8148
7959
|
};
|
|
8149
|
-
e.tables.STYLE.entries.forEach((
|
|
8150
|
-
const
|
|
8151
|
-
let a = n(
|
|
8152
|
-
a &&
|
|
7960
|
+
e.tables.STYLE.entries.forEach((r) => {
|
|
7961
|
+
const o = [];
|
|
7962
|
+
let a = n(r.font);
|
|
7963
|
+
a && o.push(a), a = n(r.bigFont), a && o.push(a), i.set(r.name, o);
|
|
8153
7964
|
});
|
|
8154
7965
|
const s = /* @__PURE__ */ new Set();
|
|
8155
7966
|
return this.getFontsInBlock(e.entities, t, i, s), Array.from(s);
|
|
@@ -8159,19 +7970,19 @@ class In extends Bt {
|
|
|
8159
7970
|
*/
|
|
8160
7971
|
getFontsInBlock(e, t, i, n) {
|
|
8161
7972
|
const s = /\\f(.*?)\|/g;
|
|
8162
|
-
e.forEach((
|
|
8163
|
-
if (
|
|
8164
|
-
const
|
|
8165
|
-
[...
|
|
7973
|
+
e.forEach((r) => {
|
|
7974
|
+
if (r.type == "MTEXT") {
|
|
7975
|
+
const o = r;
|
|
7976
|
+
[...o.text.matchAll(s)].forEach((h) => {
|
|
8166
7977
|
n.add(h[1].toLowerCase());
|
|
8167
7978
|
});
|
|
8168
|
-
const a = i.get(
|
|
7979
|
+
const a = i.get(o.styleName);
|
|
8169
7980
|
a == null || a.forEach((h) => n.add(h));
|
|
8170
|
-
} else if (
|
|
8171
|
-
const
|
|
7981
|
+
} else if (r.type == "TEXT") {
|
|
7982
|
+
const o = r, a = i.get(o.styleName);
|
|
8172
7983
|
a == null || a.forEach((h) => n.add(h));
|
|
8173
|
-
} else if (
|
|
8174
|
-
const
|
|
7984
|
+
} else if (r.type == "INSERT") {
|
|
7985
|
+
const o = r, a = t.get(o.name);
|
|
8175
7986
|
a && this.getFontsInBlock(a.entities, t, i, n);
|
|
8176
7987
|
}
|
|
8177
7988
|
});
|
|
@@ -8184,13 +7995,13 @@ class In extends Bt {
|
|
|
8184
7995
|
standardFlag: i.standardFlag,
|
|
8185
7996
|
totalPatternLength: i.totalPatternLength,
|
|
8186
7997
|
pattern: i.pattern
|
|
8187
|
-
}, s = new
|
|
7998
|
+
}, s = new gt(n);
|
|
8188
7999
|
this.processCommonTableEntryAttrs(i, s), s.name = i.name, t.tables.linetypeTable.add(s);
|
|
8189
8000
|
});
|
|
8190
8001
|
}
|
|
8191
8002
|
processTextStyles(e, t) {
|
|
8192
8003
|
e.tables.STYLE.entries.forEach((i) => {
|
|
8193
|
-
const n = new
|
|
8004
|
+
const n = new pt(i);
|
|
8194
8005
|
this.processCommonTableEntryAttrs(i, n), t.tables.textStyleTable.add(n);
|
|
8195
8006
|
});
|
|
8196
8007
|
}
|
|
@@ -8270,15 +8081,15 @@ class In extends Bt {
|
|
|
8270
8081
|
// TODO: Set correct value
|
|
8271
8082
|
dimlwd: i.DIMLWD,
|
|
8272
8083
|
dimlwe: i.DIMLWE
|
|
8273
|
-
}, s = new
|
|
8084
|
+
}, s = new yt(n);
|
|
8274
8085
|
this.processCommonTableEntryAttrs(i, s), t.tables.dimStyleTable.add(s);
|
|
8275
8086
|
});
|
|
8276
8087
|
}
|
|
8277
8088
|
processLayers(e, t) {
|
|
8278
8089
|
e.tables.LAYER.entries.forEach((i) => {
|
|
8279
|
-
const n = new
|
|
8090
|
+
const n = new Qe();
|
|
8280
8091
|
n.colorIndex = i.colorIndex;
|
|
8281
|
-
const s = new
|
|
8092
|
+
const s = new ft({
|
|
8282
8093
|
name: i.name,
|
|
8283
8094
|
standardFlags: i.standardFlag,
|
|
8284
8095
|
linetype: i.lineType,
|
|
@@ -8292,22 +8103,22 @@ class In extends Bt {
|
|
|
8292
8103
|
}
|
|
8293
8104
|
processViewports(e, t) {
|
|
8294
8105
|
e.tables.VPORT.entries.forEach((i) => {
|
|
8295
|
-
const n = new
|
|
8106
|
+
const n = new xt();
|
|
8296
8107
|
this.processCommonTableEntryAttrs(i, n), i.circleSides && (n.circleSides = i.circleSides), n.standardFlag = i.standardFlag, n.center.copy(i.center), n.lowerLeftCorner.copy(i.lowerLeftCorner), n.upperRightCorner.copy(i.upperRightCorner), i.snapBasePoint && n.snapBase.copy(i.snapBasePoint), i.snapRotationAngle && (n.snapAngle = i.snapRotationAngle), i.snapSpacing && n.snapIncrements.copy(i.snapSpacing), i.majorGridLines && (n.gridMajor = i.majorGridLines), i.gridSpacing && n.gridIncrements.copy(i.gridSpacing), i.backgroundObjectId && (n.backgroundObjectId = i.backgroundObjectId), n.gsView.center.copy(i.center), n.gsView.viewDirectionFromTarget.copy(i.viewDirectionFromTarget), n.gsView.viewTarget.copy(i.viewTarget), i.lensLength && (n.gsView.lensLength = i.lensLength), i.frontClippingPlane && (n.gsView.frontClippingPlane = i.frontClippingPlane), i.backClippingPlane && (n.gsView.backClippingPlane = i.backClippingPlane), i.viewHeight && (n.gsView.viewHeight = i.viewHeight), i.viewTwistAngle && (n.gsView.viewTwistAngle = i.viewTwistAngle), i.frozenLayers && (n.gsView.frozenLayers = i.frozenLayers), i.styleSheet && (n.gsView.styleSheet = i.styleSheet), i.renderMode && (n.gsView.renderMode = i.renderMode), i.viewMode && (n.gsView.viewMode = i.viewMode), i.ucsIconSetting && (n.gsView.ucsIconSetting = i.ucsIconSetting), i.ucsOrigin && n.gsView.ucsOrigin.copy(i.ucsOrigin), i.ucsXAxis && n.gsView.ucsXAxis.copy(i.ucsXAxis), i.ucsYAxis && n.gsView.ucsYAxis.copy(i.ucsYAxis), i.orthographicType && (n.gsView.orthographicType = i.orthographicType), i.shadePlotSetting && (n.gsView.shadePlotSetting = i.shadePlotSetting), i.shadePlotObjectId && (n.gsView.shadePlotObjectId = i.shadePlotObjectId), i.visualStyleObjectId && (n.gsView.visualStyleObjectId = i.visualStyleObjectId), i.isDefaultLightingOn && (n.gsView.isDefaultLightingOn = i.isDefaultLightingOn), i.defaultLightingType && (n.gsView.defaultLightingType = i.defaultLightingType), i.brightness && (n.gsView.brightness = i.brightness), i.contrast && (n.gsView.contrast = i.contrast), i.ambientColor && (n.gsView.ambientColor = i.ambientColor), t.tables.viewportTable.add(n);
|
|
8297
8108
|
});
|
|
8298
8109
|
}
|
|
8299
8110
|
processBlockTables(e, t) {
|
|
8300
8111
|
e.tables.BLOCK_RECORD.entries.forEach((i) => {
|
|
8301
8112
|
let n = t.tables.blockTable.getAt(i.name);
|
|
8302
|
-
n || (n = new
|
|
8113
|
+
n || (n = new _t(), n.objectId = i.handle.toString(), n.name = i.name, n.ownerId = i.ownerHandle.toString(), n.origin.copy(i.basePoint), n.layoutId = i.layout.toString(), t.tables.blockTable.add(n)), !n.isModelSapce && !n.isPaperSapce && i.entities && i.entities.length > 0 && this.processEntitiesInBlock(i.entities, n);
|
|
8303
8114
|
});
|
|
8304
8115
|
}
|
|
8305
8116
|
processBlocks(e, t) {
|
|
8306
8117
|
}
|
|
8307
8118
|
async processEntitiesInBlock(e, t) {
|
|
8308
|
-
const i = new
|
|
8309
|
-
for (let
|
|
8310
|
-
const
|
|
8119
|
+
const i = new Ye(), n = e.length, s = [];
|
|
8120
|
+
for (let r = 0; r < n; r++) {
|
|
8121
|
+
const o = e[r], a = i.convert(o);
|
|
8311
8122
|
a && s.push(a);
|
|
8312
8123
|
}
|
|
8313
8124
|
t.appendEntity(s);
|
|
@@ -8318,19 +8129,19 @@ class In extends Bt {
|
|
|
8318
8129
|
* smaller pieces and executed in small intervals to allow the UI to remain responsive.
|
|
8319
8130
|
*/
|
|
8320
8131
|
async processEntities(e, t, i, n, s) {
|
|
8321
|
-
const
|
|
8322
|
-
let
|
|
8323
|
-
const a =
|
|
8132
|
+
const r = new Ye();
|
|
8133
|
+
let o = e.entities;
|
|
8134
|
+
const a = o.length, h = new bt(
|
|
8324
8135
|
a,
|
|
8325
8136
|
100 - n.value,
|
|
8326
8137
|
i
|
|
8327
8138
|
);
|
|
8328
|
-
this.config.convertByEntityType && (
|
|
8139
|
+
this.config.convertByEntityType && (o = this.groupAndFlattenByType(o));
|
|
8329
8140
|
const l = t.tables.blockTable.modelSpace;
|
|
8330
8141
|
await h.processChunk(async (m, u) => {
|
|
8331
8142
|
const p = [];
|
|
8332
8143
|
for (let g = m; g < u; g++) {
|
|
8333
|
-
const y =
|
|
8144
|
+
const y = o[g], f = r.convert(y);
|
|
8334
8145
|
f && p.push(f);
|
|
8335
8146
|
}
|
|
8336
8147
|
if (l.appendEntity(p), s) {
|
|
@@ -8352,13 +8163,13 @@ class In extends Bt {
|
|
|
8352
8163
|
processLayouts(e, t) {
|
|
8353
8164
|
const i = t.dictionaries.layouts;
|
|
8354
8165
|
e.objects.LAYOUT.forEach((n) => {
|
|
8355
|
-
const s = new
|
|
8166
|
+
const s = new qe();
|
|
8356
8167
|
s.layoutName = n.layoutName, s.tabOrder = n.tabOrder;
|
|
8357
|
-
const
|
|
8168
|
+
const r = t.tables.blockTable.newIterator();
|
|
8358
8169
|
s.objectId = n.handle.toString();
|
|
8359
|
-
for (const
|
|
8360
|
-
if (
|
|
8361
|
-
s.blockTableRecordId =
|
|
8170
|
+
for (const o of r)
|
|
8171
|
+
if (o.layoutId === s.objectId) {
|
|
8172
|
+
s.blockTableRecordId = o.objectId;
|
|
8362
8173
|
break;
|
|
8363
8174
|
}
|
|
8364
8175
|
s.limits.min.copy(n.minLimit), s.limits.max.copy(n.maxLimit), s.extents.min.copy(n.minExtent), s.extents.max.copy(n.maxExtent), this.processCommonObjectAttrs(n, s), i.setAt(s.layoutName, s);
|
|
@@ -8367,7 +8178,7 @@ class In extends Bt {
|
|
|
8367
8178
|
processImageDefs(e, t) {
|
|
8368
8179
|
const i = t.dictionaries.imageDefs;
|
|
8369
8180
|
e.objects.IMAGEDEF.forEach((n) => {
|
|
8370
|
-
const s = new
|
|
8181
|
+
const s = new wt();
|
|
8371
8182
|
s.sourceFileName = n.fileName, this.processCommonObjectAttrs(n, s), i.setAt(s.objectId, s);
|
|
8372
8183
|
});
|
|
8373
8184
|
}
|
|
@@ -8394,42 +8205,42 @@ class In extends Bt {
|
|
|
8394
8205
|
return i.flatMap((n) => t[n]);
|
|
8395
8206
|
}
|
|
8396
8207
|
}
|
|
8397
|
-
function
|
|
8208
|
+
function wn() {
|
|
8398
8209
|
try {
|
|
8399
|
-
const c = new
|
|
8210
|
+
const c = new Wt({
|
|
8400
8211
|
convertByEntityType: !1,
|
|
8401
8212
|
useWorker: !0,
|
|
8402
8213
|
parserWorkerUrl: "./assets/dxf-parser-worker.js"
|
|
8403
8214
|
});
|
|
8404
|
-
|
|
8215
|
+
Ve.instance.register(_e.DXF, c);
|
|
8405
8216
|
} catch (c) {
|
|
8406
8217
|
console.error("Failed to register dxf converter: ", c);
|
|
8407
8218
|
}
|
|
8408
8219
|
try {
|
|
8409
|
-
const c = new
|
|
8220
|
+
const c = new bn({
|
|
8410
8221
|
convertByEntityType: !1,
|
|
8411
8222
|
useWorker: !0,
|
|
8412
8223
|
parserWorkerUrl: "./assets/libredwg-parser-worker.js"
|
|
8413
8224
|
});
|
|
8414
|
-
|
|
8225
|
+
Ve.instance.register(_e.DWG, c);
|
|
8415
8226
|
} catch (c) {
|
|
8416
8227
|
console.error("Failed to register dwg converter: ", c);
|
|
8417
8228
|
}
|
|
8418
8229
|
}
|
|
8419
|
-
function
|
|
8420
|
-
|
|
8230
|
+
function En() {
|
|
8231
|
+
wn(), typeof window < "u" && !!window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? Le.getInstance().initialize(
|
|
8421
8232
|
"/assets/mtext-renderer-worker.js"
|
|
8422
|
-
) :
|
|
8233
|
+
) : Le.getInstance().initialize("./mtext-renderer-worker.js");
|
|
8423
8234
|
}
|
|
8424
|
-
const
|
|
8235
|
+
const vn = {
|
|
8425
8236
|
isDebug: !1,
|
|
8426
8237
|
isShowCommandLine: !0,
|
|
8427
8238
|
isShowCoordinate: !0,
|
|
8428
8239
|
isShowToolbar: !0,
|
|
8429
8240
|
isShowStats: !1,
|
|
8430
8241
|
fontMapping: {}
|
|
8431
|
-
},
|
|
8432
|
-
class
|
|
8242
|
+
}, He = "settings";
|
|
8243
|
+
class oe {
|
|
8433
8244
|
constructor() {
|
|
8434
8245
|
this.events = {
|
|
8435
8246
|
/** Fired when any setting is modified */
|
|
@@ -8444,7 +8255,7 @@ class he {
|
|
|
8444
8255
|
* @returns The singleton settings manager instance
|
|
8445
8256
|
*/
|
|
8446
8257
|
static get instance() {
|
|
8447
|
-
return this._instance || (this._instance = new
|
|
8258
|
+
return this._instance || (this._instance = new oe()), this._instance;
|
|
8448
8259
|
}
|
|
8449
8260
|
/**
|
|
8450
8261
|
* Sets a setting value and persists it to localStorage.
|
|
@@ -8463,7 +8274,7 @@ class he {
|
|
|
8463
8274
|
*/
|
|
8464
8275
|
set(e, t) {
|
|
8465
8276
|
const i = this.settings;
|
|
8466
|
-
i[e] = t, localStorage.setItem(
|
|
8277
|
+
i[e] = t, localStorage.setItem(He, JSON.stringify(i)), this.events.modified.dispatch({
|
|
8467
8278
|
key: e,
|
|
8468
8279
|
value: t
|
|
8469
8280
|
});
|
|
@@ -8618,36 +8429,36 @@ class he {
|
|
|
8618
8429
|
* @returns The current settings object
|
|
8619
8430
|
*/
|
|
8620
8431
|
get settings() {
|
|
8621
|
-
const e = localStorage.getItem(
|
|
8622
|
-
return
|
|
8432
|
+
const e = localStorage.getItem(He), t = e == null ? {} : JSON.parse(e);
|
|
8433
|
+
return Qt(t, vn);
|
|
8623
8434
|
}
|
|
8624
8435
|
}
|
|
8625
8436
|
export {
|
|
8626
|
-
|
|
8627
|
-
|
|
8437
|
+
Jt as AcApContext,
|
|
8438
|
+
fi as AcApConvertToSvgCmd,
|
|
8628
8439
|
C as AcApDocManager,
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8440
|
+
di as AcApDocument,
|
|
8441
|
+
xi as AcApOpenCmd,
|
|
8442
|
+
Ii as AcApPanCmd,
|
|
8443
|
+
_i as AcApQNewCmd,
|
|
8444
|
+
bi as AcApSelectCmd,
|
|
8445
|
+
oe as AcApSettingManager,
|
|
8446
|
+
wi as AcApZoomCmd,
|
|
8447
|
+
Si as AcApZoomToBoxCmd,
|
|
8448
|
+
vi as AcApZoomToBoxJig,
|
|
8449
|
+
li as AcEdBaseView,
|
|
8639
8450
|
j as AcEdCommand,
|
|
8640
8451
|
A as AcEdCommandStack,
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8452
|
+
ce as AcEdCorsorType,
|
|
8453
|
+
ti as AcEdCursorManager,
|
|
8454
|
+
ni as AcEdJig,
|
|
8455
|
+
hi as AcEdSelectionSet,
|
|
8456
|
+
R as AcEdViewMode,
|
|
8457
|
+
ci as AcEditor,
|
|
8458
|
+
xn as AcTrView2d,
|
|
8459
|
+
$e as DEFAULT_VIEW_2D_OPTIONS,
|
|
8460
|
+
Ln as acedAlert,
|
|
8650
8461
|
V as eventBus,
|
|
8651
|
-
|
|
8652
|
-
|
|
8462
|
+
wn as registerConverters,
|
|
8463
|
+
En as registerWorkers
|
|
8653
8464
|
};
|