@maqiuyao/dxf-viewer 0.2.25 → 0.2.26
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/README.md +1 -0
- package/dist/dxf-viewer.cjs +11 -11
- package/dist/dxf-viewer.js +209 -195
- package/dist/src/dxfViewer/core/dxf/DxfLoader.d.ts +4 -0
- package/package.json +1 -1
package/dist/dxf-viewer.js
CHANGED
|
@@ -3324,7 +3324,7 @@ const ki = class ki {
|
|
|
3324
3324
|
}
|
|
3325
3325
|
};
|
|
3326
3326
|
g(ki, "twinklingObjectIds", {});
|
|
3327
|
-
let
|
|
3327
|
+
let j = ki;
|
|
3328
3328
|
const s0 = (c, t, e) => {
|
|
3329
3329
|
const {
|
|
3330
3330
|
default: i,
|
|
@@ -4875,13 +4875,13 @@ const ph = new p.Vector3(0, 1, 0), Ze = class Ze {
|
|
|
4875
4875
|
if (!t) return [];
|
|
4876
4876
|
if (t.children.length === 0 && (e.onlyVisible && !t.visible || e.meshOnly && !(t instanceof p.Mesh)))
|
|
4877
4877
|
return [];
|
|
4878
|
-
const s = [], n = t, r = n.children.length, a = Math.round(Math.pow(r, 0.5)), o =
|
|
4878
|
+
const s = [], n = t, r = n.children.length, a = Math.round(Math.pow(r, 0.5)), o = j.getUpdateProgressFuncAsync(i);
|
|
4879
4879
|
for (let l = r - 1; l >= 0; --l) {
|
|
4880
4880
|
const h = r - l - 1;
|
|
4881
4881
|
let d;
|
|
4882
4882
|
if (i && (h % a === 0 || h === 0 || h === r - 1)) {
|
|
4883
4883
|
const m = h * 90 / r, b = (h + 1) * 90 / r;
|
|
4884
|
-
d =
|
|
4884
|
+
d = j.getUpdateSubProgressFunc(m, b, i);
|
|
4885
4885
|
}
|
|
4886
4886
|
const u = n.children[l], f = await this.createOutlines(u, e, d);
|
|
4887
4887
|
s.push(...f);
|
|
@@ -5610,7 +5610,7 @@ class Ft {
|
|
|
5610
5610
|
if (a.updateMatrix(), a instanceof p.InstancedMesh) {
|
|
5611
5611
|
const o = Ft.getInstancedMeshBoundingBox(a);
|
|
5612
5612
|
o.isEmpty() || i.union(o);
|
|
5613
|
-
} else if (
|
|
5613
|
+
} else if (j.isMatrixValid(a.matrixWorld)) {
|
|
5614
5614
|
const o = Ft.getBoundingBox(a);
|
|
5615
5615
|
o.isEmpty() || i.union(o);
|
|
5616
5616
|
} else
|
|
@@ -5628,7 +5628,7 @@ class Ft {
|
|
|
5628
5628
|
const n = t.geometry.clone();
|
|
5629
5629
|
if (n.boundingBox) {
|
|
5630
5630
|
const r = n.boundingBox.applyMatrix4(i);
|
|
5631
|
-
!r.isEmpty() &&
|
|
5631
|
+
!r.isEmpty() && j.isBoxValid(r) && e.union(r);
|
|
5632
5632
|
}
|
|
5633
5633
|
}
|
|
5634
5634
|
return e.applyMatrix4(t.matrixWorld), e;
|
|
@@ -14094,7 +14094,7 @@ class un extends li {
|
|
|
14094
14094
|
const n = i[s];
|
|
14095
14095
|
e(n) && n.render(this.context, this.camera);
|
|
14096
14096
|
}
|
|
14097
|
-
return
|
|
14097
|
+
return j.canvasToImage(this.canvas);
|
|
14098
14098
|
}
|
|
14099
14099
|
getCanvas() {
|
|
14100
14100
|
return this.canvas;
|
|
@@ -14176,7 +14176,7 @@ class oi extends li {
|
|
|
14176
14176
|
g(this, "editPointStrokeColor");
|
|
14177
14177
|
g(this, "matrix");
|
|
14178
14178
|
g(this, "ctx");
|
|
14179
|
-
this.lineWidth = this.DEFAULT_LINE_WIDTH, this.lineColor = this.DEFAULT_STROKE_STYLE, this.fillColor = this.DEFAULT_FILL_STYLE, this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.points = [], this.userData = {}, this.tolerance = 1, this.visible = !0, this.selected = !1, this.renderOrder = 1, this.needsFrustumCulled = !0, this.editPointSize = 3, this.editPointFillColor = "#ffffff", this.editPointStrokeColor = "#939ea4", this.matrix = new p.Matrix4(), this.id = e ||
|
|
14179
|
+
this.lineWidth = this.DEFAULT_LINE_WIDTH, this.lineColor = this.DEFAULT_STROKE_STYLE, this.fillColor = this.DEFAULT_FILL_STYLE, this.x = 0, this.y = 0, this.width = 0, this.height = 0, this.points = [], this.userData = {}, this.tolerance = 1, this.visible = !0, this.selected = !1, this.renderOrder = 1, this.needsFrustumCulled = !0, this.editPointSize = 3, this.editPointFillColor = "#ffffff", this.editPointStrokeColor = "#939ea4", this.matrix = new p.Matrix4(), this.id = e || j.guid();
|
|
14180
14180
|
}
|
|
14181
14181
|
setTolerance(e) {
|
|
14182
14182
|
this.tolerance = e;
|
|
@@ -14907,7 +14907,7 @@ const vt = class vt {
|
|
|
14907
14907
|
* @returns {Promise<void>}
|
|
14908
14908
|
*/
|
|
14909
14909
|
async compareEntities(t, e, i) {
|
|
14910
|
-
const s =
|
|
14910
|
+
const s = j.getUpdateProgressFuncForLoop(t.length, i);
|
|
14911
14911
|
for (let n = 0; n < t.length; n++) {
|
|
14912
14912
|
const r = t[n].handle;
|
|
14913
14913
|
if (!e.has(r)) this.changes[ke] = {
|
|
@@ -15304,7 +15304,7 @@ g(vt, "ENTITY_COLOR_ADDED", 65280), g(vt, "ENTITY_COLOR_REMOVED", 16711680), g(v
|
|
|
15304
15304
|
let yt = vt;
|
|
15305
15305
|
var G = /* @__PURE__ */ ((c) => (c[c.Object = 0] = "Object", c[c.Point = 1] = "Point", c[c.Line = 2] = "Line", c[c.LineSegment = 3] = "LineSegment", c[c.Mesh = 4] = "Mesh", c))(G || {});
|
|
15306
15306
|
const Fn = new Le(), zn = new ot();
|
|
15307
|
-
class
|
|
15307
|
+
class U {
|
|
15308
15308
|
constructor(t = 0) {
|
|
15309
15309
|
g(this, "name");
|
|
15310
15310
|
g(this, "type");
|
|
@@ -15349,7 +15349,7 @@ class V {
|
|
|
15349
15349
|
e[i].traverse(t);
|
|
15350
15350
|
}
|
|
15351
15351
|
clone(t = !0) {
|
|
15352
|
-
return new
|
|
15352
|
+
return new U().copy(this, t);
|
|
15353
15353
|
}
|
|
15354
15354
|
copy(t, e = !0) {
|
|
15355
15355
|
if (this.name = t.name, this.type = t.type, this.matrix.copy(t.matrix), this.layers.mask = t.layers.mask, this.renderOrder = t.renderOrder, this.userData = JSON.parse(JSON.stringify(t.userData)), this.material = t.material, this.geometry = t.geometry, e === !0)
|
|
@@ -15572,15 +15572,15 @@ class kt {
|
|
|
15572
15572
|
if (u.type === G.Mesh) {
|
|
15573
15573
|
const x = _e(f);
|
|
15574
15574
|
if (!x) return;
|
|
15575
|
-
x.userData = {}, w = new
|
|
15575
|
+
x.userData = {}, w = new U(u.type), w.geometry = x, w.material = u.material, r.push(w);
|
|
15576
15576
|
} else if (u.type === G.Line || u.type === G.LineSegment) {
|
|
15577
15577
|
const x = xe.mergeLineGeometries(f, e, u.material instanceof p.LineDashedMaterial || u.material instanceof p.ShaderMaterial, S);
|
|
15578
15578
|
if (!x) return;
|
|
15579
|
-
w = new
|
|
15579
|
+
w = new U(G.LineSegment), w.geometry = x, w.material = u.material, a.push(w);
|
|
15580
15580
|
} else if (u.type === G.Point) {
|
|
15581
15581
|
const x = _e(f);
|
|
15582
15582
|
if (!x) return;
|
|
15583
|
-
x.userData = {}, w = new
|
|
15583
|
+
x.userData = {}, w = new U(u.type), w.geometry = x, w.material = u.material, o.push(w);
|
|
15584
15584
|
}
|
|
15585
15585
|
w && (e ? w.userData.batches = S : (w.userData = u.userData, w.userData.batches = void 0), w.userData.layerName = u.userData.layerName, w.name = "[Merged] " + u.name, w.renderOrder = u.renderOrder, w.layers.mask = u.layers.mask, l.push(...d)), f.forEach((x) => {
|
|
15586
15586
|
x.dispose(), H.releaseGeometryManually(x);
|
|
@@ -15684,15 +15684,15 @@ class kt {
|
|
|
15684
15684
|
if (w.type === G.Mesh) {
|
|
15685
15685
|
const C = _e(x);
|
|
15686
15686
|
if (!C) return;
|
|
15687
|
-
C.userData = {}, v = new
|
|
15687
|
+
C.userData = {}, v = new U(w.type), v.geometry = C, v.material = w.material, h.push(v);
|
|
15688
15688
|
} else if (w.type === G.Line || w.type === G.LineSegment) {
|
|
15689
15689
|
const C = xe.mergeLineGeometries(x, n, w.material instanceof p.LineDashedMaterial || w.material instanceof p.ShaderMaterial, T);
|
|
15690
15690
|
if (!C) return;
|
|
15691
|
-
v = new
|
|
15691
|
+
v = new U(G.LineSegment), v.geometry = C, v.material = w.material, d.push(v);
|
|
15692
15692
|
} else if (w.type === G.Point) {
|
|
15693
15693
|
const C = _e(x);
|
|
15694
15694
|
if (!C) return;
|
|
15695
|
-
C.userData = {}, v = new
|
|
15695
|
+
C.userData = {}, v = new U(w.type), v.geometry = C, v.material = w.material, u.push(v);
|
|
15696
15696
|
}
|
|
15697
15697
|
v && (n ? v.userData.batches = T : (v.userData = w.userData, v.userData.batches = void 0), v.userData.layerName = w.userData.layerName, v.name = "[Merged] " + w.name, v.renderOrder = w.renderOrder, v.layers.mask = w.layers.mask, S.forEach((C) => f.push(C))), x.forEach((C) => {
|
|
15698
15698
|
C.dispose(), H.releaseGeometryManually(C);
|
|
@@ -19983,7 +19983,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
19983
19983
|
color: zt
|
|
19984
19984
|
}), xi = new p.MeshBasicMaterial({
|
|
19985
19985
|
color: zt
|
|
19986
|
-
}), ma = new p.BufferGeometry().setFromPoints([new p.Vector3()]), ga = new p.Matrix4(), et = new p.Matrix4(), ue = new p.Matrix4(),
|
|
19986
|
+
}), ma = new p.BufferGeometry().setFromPoints([new p.Vector3()]), ga = new p.Matrix4(), et = new p.Matrix4(), ue = new p.Matrix4(), N = new p.Vector3(), $ = new p.Vector3(), tt = new p.Vector3(), Zi = new p.Vector2(), ge = new p.Quaternion(), Rs = new p.Object3D(), ut = new p.Box3(), ya = new p.PointsMaterial({
|
|
19987
19987
|
color: 65280,
|
|
19988
19988
|
size: 5,
|
|
19989
19989
|
depthTest: !1
|
|
@@ -20041,10 +20041,11 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20041
20041
|
const e = [], i = c.length;
|
|
20042
20042
|
for (let s = 0; s < i; s++) {
|
|
20043
20043
|
const n = c[s];
|
|
20044
|
-
if (n.
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20044
|
+
if (!(!Number.isFinite(n.x) || !Number.isFinite(n.y)))
|
|
20045
|
+
if (n.bulge && (s !== i - 1 || t)) {
|
|
20046
|
+
const r = n.bulge, a = s + 1 < i ? c[s + 1] : e[0], o = Wd(n, a, r);
|
|
20047
|
+
Number.isFinite(a.x) && Number.isFinite(a.y) ? e.push(...o) : e.push(new p.Vector3(n.x, n.y, 0));
|
|
20048
|
+
} else e.push(new p.Vector3(n.x, n.y, 0));
|
|
20048
20049
|
}
|
|
20049
20050
|
return e;
|
|
20050
20051
|
}, qd = (c) => {
|
|
@@ -20072,7 +20073,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20072
20073
|
!a || r.length === 0 || (r.push(r[0]), i.push(r));
|
|
20073
20074
|
}
|
|
20074
20075
|
return i;
|
|
20075
|
-
},
|
|
20076
|
+
}, V = class V extends p.Loader {
|
|
20076
20077
|
/**
|
|
20077
20078
|
* DxfLoader constructor
|
|
20078
20079
|
*/
|
|
@@ -20203,7 +20204,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20203
20204
|
const r = s;
|
|
20204
20205
|
n[s.ownerHandle].push(r);
|
|
20205
20206
|
}
|
|
20206
|
-
}, i && (this.ignorePaperSpace = i.ignorePaperSpace === !0, this.enableLocalCache = i.enableLocalCache === !0, this.enableMerge =
|
|
20207
|
+
}, i && (this.ignorePaperSpace = i.ignorePaperSpace === !0, this.enableLocalCache = i.enableLocalCache === !0, this.enableMerge = V.LOADLLDATA ? !1 : i.enableMerge !== !1, this.encoding = i.encoding || "UTF-8", i.requestHeaders && (this.requestHeader = i.requestHeaders), i.overrideColor != null && (this.overrideColor = hs.rgb2Hex(i.overrideColor)), i.overrideHatchPatternLineThickness != null && (this.overrideHatchPatternLineThickness = i.overrideHatchPatternLineThickness)), this.pointsMaterials[zt] = Ls, this.lineBasicMaterials[zt] = me, this.meshBasicMaterials[zt] = xi;
|
|
20207
20208
|
}
|
|
20208
20209
|
/**
|
|
20209
20210
|
* 说明:该成员与 setRequestHeader 方法未收录在发布的 d.ts 中(类型滞后),按 bundle 实现保留。
|
|
@@ -20248,7 +20249,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20248
20249
|
* @param onProgress on progress callback
|
|
20249
20250
|
*/
|
|
20250
20251
|
async loadAsync(e, i) {
|
|
20251
|
-
const s =
|
|
20252
|
+
const s = j.getUpdateSubProgressFunc(0, 50, i), n = j.getUpdateSubProgressFunc(50, 100, i), r = j.getUpdateSubProgressFunc(10, 100, i);
|
|
20252
20253
|
if (Re.isBrowser && this.enableLocalCache && this.dxfDataId) {
|
|
20253
20254
|
let l;
|
|
20254
20255
|
try {
|
|
@@ -20268,7 +20269,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20268
20269
|
* Parses dxf contents from given url.
|
|
20269
20270
|
*/
|
|
20270
20271
|
async parse(e, i) {
|
|
20271
|
-
const s =
|
|
20272
|
+
const s = j.getUpdateProgressFunc(i), n = j.getUpdateSubProgressFunc(0, 40, i), r = await this.download(e, n);
|
|
20272
20273
|
if (!r) return Promise.reject("[Dxf] Failed to download " + e);
|
|
20273
20274
|
if (this.aborted) return Promise.reject("[Dxf] Job aborted");
|
|
20274
20275
|
this.timer = Date.now(), P.info("[Dxf] Start parsing...");
|
|
@@ -20313,7 +20314,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20313
20314
|
*/
|
|
20314
20315
|
tryFixDxfData(e) {
|
|
20315
20316
|
e && (!e.objects && (P.warn("[Dxf] No objects found, Will add one."), e.objects = {}), !e.objects.LAYOUT && (P.warn("[Dxf] No layout defined! Will add a default 'Model' layout!"), e.objects.LAYOUT = [{
|
|
20316
|
-
layoutName:
|
|
20317
|
+
layoutName: V.MODEL_LAYOUT_NAME
|
|
20317
20318
|
}]), !e.tables && (P.warn("[Dxf] No tables found, Will add one."), e.tables = {}), !e.tables.layer && (e.tables.layer = {}), !e.tables.layer.layers && (e.tables.layer.layers = {}));
|
|
20318
20319
|
}
|
|
20319
20320
|
/**
|
|
@@ -20330,13 +20331,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20330
20331
|
this.entityCount = r, Object.keys(e.blocks).forEach((x) => {
|
|
20331
20332
|
this.entityCount += e.blocks[x].entities?.length || 0;
|
|
20332
20333
|
});
|
|
20333
|
-
const a =
|
|
20334
|
+
const a = j.getUpdateProgressFuncForLoop(r, i);
|
|
20334
20335
|
let o = {};
|
|
20335
20336
|
const l = (x) => {
|
|
20336
20337
|
const E = x.userData.layerName;
|
|
20337
20338
|
let M = o[E];
|
|
20338
20339
|
!M && (M = [], o[E] = M), M.push(x);
|
|
20339
|
-
}, h = {}, d = {}, u = new
|
|
20340
|
+
}, h = {}, d = {}, u = new U();
|
|
20340
20341
|
for (let x = 0; x < r && !this.aborted; x++) {
|
|
20341
20342
|
const E = e.entities[x];
|
|
20342
20343
|
this.addViewport(E, h);
|
|
@@ -20344,7 +20345,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20344
20345
|
if (!M && await a(x), !M) continue;
|
|
20345
20346
|
const O = this.getLayout(e, E), T = O.layoutName;
|
|
20346
20347
|
let v = u.children.find((C) => C.name === T);
|
|
20347
|
-
if (!v && (v = new
|
|
20348
|
+
if (!v && (v = new U(), v.name = T, v.userData.isLayoutLevelObject = !0, u.add(v)), M.traverse((C) => {
|
|
20348
20349
|
C.userData.isSnapObject && (!this.layoutsSnapObjectsMap[T] && (this.layoutsSnapObjectsMap[T] = []), this.layoutsSnapObjectsMap[T].push(C));
|
|
20349
20350
|
}), this.enableMerge) {
|
|
20350
20351
|
kt.merge(M, !1), !d[T] && (d[T] = {
|
|
@@ -20368,17 +20369,17 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20368
20369
|
}
|
|
20369
20370
|
e.objects.LAYOUT.forEach((x) => {
|
|
20370
20371
|
const E = x, M = E.layoutName;
|
|
20371
|
-
if (this.ignorePaperSpace && M !==
|
|
20372
|
+
if (this.ignorePaperSpace && M !== V.MODEL_LAYOUT_NAME) return;
|
|
20372
20373
|
const O = E.associatedBlockName, T = e.blocks[O];
|
|
20373
20374
|
T && this.loadLayout(T, e, E, u, o, h);
|
|
20374
20375
|
}), P.debug("[Dxf] Drew entities in " + (Date.now() - s) / 1e3 + "s");
|
|
20375
20376
|
for (const x in this.layoutsSnapObjectsMap) {
|
|
20376
|
-
const E = u.children.find((T) => T.name === x), M = new
|
|
20377
|
-
M.name =
|
|
20377
|
+
const E = u.children.find((T) => T.name === x), M = new U();
|
|
20378
|
+
M.name = V.SNAP_GROUP_NAME, M.userData.isSnapGroup = !0, E.add(M);
|
|
20378
20379
|
const O = this.layoutsSnapObjectsMap[x];
|
|
20379
20380
|
for (let T = 0; T < O.length; T++) {
|
|
20380
20381
|
const v = O[T], C = v.userData.layerName;
|
|
20381
|
-
this.getLayerVisible(e, C) === !1 && v.layers.disable(Ye),
|
|
20382
|
+
this.getLayerVisible(e, C) === !1 && v.layers.disable(Ye), V.SHOW_SNAP_OBJECT && (v.layers.enableAll(), v.material instanceof p.PointsMaterial ? v.material = ya : v.material instanceof p.LineBasicMaterial ? v.material = xa : v.material instanceof p.MeshBasicMaterial && (v.material = ba));
|
|
20382
20383
|
let _ = v;
|
|
20383
20384
|
const A = ue.identity();
|
|
20384
20385
|
for (; _ && _.userData.isLayoutLevelObject !== !0; )
|
|
@@ -20407,7 +20408,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20407
20408
|
E.layerObjects[O] = [];
|
|
20408
20409
|
}
|
|
20409
20410
|
}
|
|
20410
|
-
this.printStatsInfo(), this.enableReleaseData && (this.releaseCachedData(), this.releaseDxfData(e)), this.enableMerge &&
|
|
20411
|
+
this.printStatsInfo(), this.enableReleaseData && (this.releaseCachedData(), this.releaseDxfData(e)), this.enableMerge && V.mergeDxfObjects({
|
|
20411
20412
|
root: u,
|
|
20412
20413
|
layersAndObjects: o
|
|
20413
20414
|
/* 类型桥接:形参类型滞后,实际为 DxfObject[] */
|
|
@@ -20428,12 +20429,12 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20428
20429
|
if (Q.setSharedVariablesOfObject(x), !x.userData.isLayoutLevelObject) return;
|
|
20429
20430
|
const E = x.name;
|
|
20430
20431
|
let M;
|
|
20431
|
-
if (E !==
|
|
20432
|
+
if (E !== V.MODEL_LAYOUT_NAME) {
|
|
20432
20433
|
const O = b[E];
|
|
20433
20434
|
!O.directAssociatedLeafObjectSet && (O.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), M = O.directAssociatedLeafObjectSet;
|
|
20434
20435
|
}
|
|
20435
20436
|
x.traverse((O) => {
|
|
20436
|
-
if (Q.setSharedVariablesOfObject(O), O.userData.isSnapGroup && (O.visible =
|
|
20437
|
+
if (Q.setSharedVariablesOfObject(O), O.userData.isSnapGroup && (O.visible = V.SHOW_SNAP_OBJECT), O.geometry) {
|
|
20437
20438
|
const T = O.userData.layerName;
|
|
20438
20439
|
this.getLayerVisible(e, T) === !1 && (O.visible = !1, O.userData.layerVisible = !1), S(O), M && M.add(O);
|
|
20439
20440
|
}
|
|
@@ -20445,7 +20446,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20445
20446
|
loadedEntityCount: n,
|
|
20446
20447
|
layoutViewportsMap: h
|
|
20447
20448
|
});
|
|
20448
|
-
if (
|
|
20449
|
+
if (V.LOADLLDATA) {
|
|
20449
20450
|
const x = m.children[0].children, E = [];
|
|
20450
20451
|
for (let M = 0; M < x.length; M++) {
|
|
20451
20452
|
const O = x[M];
|
|
@@ -20485,7 +20486,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20485
20486
|
*/
|
|
20486
20487
|
async loadEntitiesForCompare(e, i, s, n = !0, r) {
|
|
20487
20488
|
const a = e.entities.length, o = i.entities.length, l = async () => {
|
|
20488
|
-
const d = this.compareContext, u = d.isTheFirstFile, f = u ? e : i, m = new
|
|
20489
|
+
const d = this.compareContext, u = d.isTheFirstFile, f = u ? e : i, m = new U(), b = u ? a : o;
|
|
20489
20490
|
this.entityCount = b, Object.keys(f.blocks).forEach((v) => {
|
|
20490
20491
|
this.entityCount += f.blocks[v].entities?.length || 0;
|
|
20491
20492
|
});
|
|
@@ -20499,7 +20500,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20499
20500
|
total: a + o
|
|
20500
20501
|
}));
|
|
20501
20502
|
const _ = 500, A = Date.now();
|
|
20502
|
-
(A - S > _ || v === b - 1) && (await
|
|
20503
|
+
(A - S > _ || v === b - 1) && (await j.sleep(0), S = A);
|
|
20503
20504
|
}
|
|
20504
20505
|
};
|
|
20505
20506
|
this.parseHeader(f.header);
|
|
@@ -20507,7 +20508,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20507
20508
|
for (let v = 0; v < b; v++) {
|
|
20508
20509
|
if (this.aborted) return;
|
|
20509
20510
|
const C = f.entities[v], _ = this.getLayout(f, C);
|
|
20510
|
-
if (_.layoutName !==
|
|
20511
|
+
if (_.layoutName !== V.MODEL_LAYOUT_NAME) {
|
|
20511
20512
|
await w(v);
|
|
20512
20513
|
continue;
|
|
20513
20514
|
}
|
|
@@ -20516,8 +20517,8 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20516
20517
|
await w(v);
|
|
20517
20518
|
continue;
|
|
20518
20519
|
}
|
|
20519
|
-
let I = m.children.find((B) => B.name ===
|
|
20520
|
-
!I && (I = new
|
|
20520
|
+
let I = m.children.find((B) => B.name === V.MODEL_LAYOUT_NAME);
|
|
20521
|
+
!I && (I = new U(), I.name = V.MODEL_LAYOUT_NAME, I.userData.isLayoutLevelObject = !0, m.add(I)), I.add(A), A.traverse((B) => {
|
|
20521
20522
|
if (B.geometry) {
|
|
20522
20523
|
const k = B.userData.layerName, D = this.getLayerVisible(f, k);
|
|
20523
20524
|
B.userData.isSnapObject && (!this.layoutsSnapObjectsMap[_.layoutName] && (this.layoutsSnapObjectsMap[_.layoutName] = []), this.layoutsSnapObjectsMap[_.layoutName].push(B), D === !1 && A.layers.disable(Ye));
|
|
@@ -20550,17 +20551,17 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20550
20551
|
for (; A && A.userData.isLayoutLevelObject !== !0; )
|
|
20551
20552
|
I.premultiply(A.matrix), A = A.parent;
|
|
20552
20553
|
ut.makeEmpty();
|
|
20553
|
-
const B =
|
|
20554
|
+
const B = U.getBox(_, ut);
|
|
20554
20555
|
B.applyMatrix4(I), C.type === qe.Added ? !u && (C.box = new p.Box3().copy(B)) : C.type === qe.Removed ? u && (C.box = new p.Box3().copy(B)) : C.type === qe.Modified && (C.box ? C.box.union(B) : C.box = new p.Box3().copy(B));
|
|
20555
20556
|
}
|
|
20556
20557
|
}
|
|
20557
20558
|
for (const v in this.layoutsSnapObjectsMap) {
|
|
20558
|
-
const C = m.children.find((I) => I.name === v), _ = new
|
|
20559
|
-
_.name =
|
|
20559
|
+
const C = m.children.find((I) => I.name === v), _ = new U();
|
|
20560
|
+
_.name = V.SNAP_GROUP_NAME, C.add(_);
|
|
20560
20561
|
const A = this.layoutsSnapObjectsMap[v];
|
|
20561
20562
|
for (let I = 0; I < A.length; I++) {
|
|
20562
20563
|
const B = A[I];
|
|
20563
|
-
|
|
20564
|
+
V.SHOW_SNAP_OBJECT && (B.layers.enableAll(), B.material instanceof p.PointsMaterial ? B.material = ya : B.material instanceof p.LineBasicMaterial ? B.material = xa : B.material instanceof p.MeshBasicMaterial && (B.material = ba));
|
|
20564
20565
|
let k = B;
|
|
20565
20566
|
const D = ue.identity();
|
|
20566
20567
|
for (; k && k.userData.isLayoutLevelObject !== !0; )
|
|
@@ -20568,7 +20569,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20568
20569
|
B.matrix.copy(D), _.add(B);
|
|
20569
20570
|
}
|
|
20570
20571
|
}
|
|
20571
|
-
this.enableMerge &&
|
|
20572
|
+
this.enableMerge && V.mergeDxfObjects({
|
|
20572
20573
|
root: m,
|
|
20573
20574
|
layersAndObjects: x
|
|
20574
20575
|
/* 类型桥接:形参类型滞后,实际为 DxfObject[] */
|
|
@@ -20582,7 +20583,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20582
20583
|
};
|
|
20583
20584
|
E.children.forEach((v) => {
|
|
20584
20585
|
Q.setSharedVariablesOfObject(v), v.userData.isLayoutLevelObject && v.traverse((C) => {
|
|
20585
|
-
if (Q.setSharedVariablesOfObject(C), C.userData.isSnapGroup && (C.visible =
|
|
20586
|
+
if (Q.setSharedVariablesOfObject(C), C.userData.isSnapGroup && (C.visible = V.SHOW_SNAP_OBJECT), C.geometry) {
|
|
20586
20587
|
const _ = C.userData.layerName;
|
|
20587
20588
|
this.getLayerVisible(f, _) === !1 && (C.visible = !1, C.userData.layerVisible = !1), O(C);
|
|
20588
20589
|
}
|
|
@@ -20595,10 +20596,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20595
20596
|
this.compareContext = {
|
|
20596
20597
|
changes: s,
|
|
20597
20598
|
isTheFirstFile: !0
|
|
20598
|
-
},
|
|
20599
|
+
}, j.printMemory("Before loading entities for first dxf"), await l(), P.info("[Dxf] loadEntities for first dxf in " + (Date.now() - h) / 1e3 + "s"), j.printMemory("After loading entities for first dxf"), this.releaseCachedData(!1), this.releaseDxfData(e), j.printMemory("Before loading entities for second dxf"), h = Date.now(), this.compareContext.isTheFirstFile = !1, await l(), P.info("[Dxf] loadEntities for second dxf in " + (Date.now() - h) / 1e3 + "s"), this.printStatsInfo();
|
|
20599
20600
|
for (const d of Object.values(s))
|
|
20600
20601
|
!d.box && delete s[d.id];
|
|
20601
|
-
this.compareContext.preservedHandles = void 0, this.enableReleaseData && (this.releaseCachedData(), this.releaseDxfData(i)),
|
|
20602
|
+
this.compareContext.preservedHandles = void 0, this.enableReleaseData && (this.releaseCachedData(), this.releaseDxfData(i)), j.printMemory("After loading entities for second dxf");
|
|
20602
20603
|
}
|
|
20603
20604
|
setObjectColorByChange(e, i) {
|
|
20604
20605
|
const s = (a) => {
|
|
@@ -20612,7 +20613,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20612
20613
|
else if (l.material instanceof p.PointsMaterial) l.material = this.getPointsMaterial(o);
|
|
20613
20614
|
else if (l.material instanceof p.ShaderMaterial) {
|
|
20614
20615
|
const h = l.material.clone();
|
|
20615
|
-
|
|
20616
|
+
V.updateMaterialUniforms(h), h.uniforms.u_color.value.set(o), l.material = h;
|
|
20616
20617
|
}
|
|
20617
20618
|
}
|
|
20618
20619
|
});
|
|
@@ -20785,9 +20786,9 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20785
20786
|
const w = new p.Vector3();
|
|
20786
20787
|
let x = !1;
|
|
20787
20788
|
this.enableRTC && (x = H.checkAndRebasePositionsOnRTC(y, w));
|
|
20788
|
-
const E = new p.BufferGeometry().setFromPoints(y), M = new
|
|
20789
|
+
const E = new p.BufferGeometry().setFromPoints(y), M = new U(G.Line);
|
|
20789
20790
|
M.geometry = E, M.material = me;
|
|
20790
|
-
const O = new
|
|
20791
|
+
const O = new U(G.Point);
|
|
20791
20792
|
return O.geometry = ma, O.material = Ls, O.matrix.setPosition(e.center.x, e.center.y, e.center.z), O.userData.isSnapObject = !0, O.userData.type = "CircleCenter", O.layers.set(Ye), M.add(O), x && (this.setRTCUserData(M), M.matrix.setPosition(w.x, w.y, 0)), M.layers.enableAll(), M;
|
|
20792
20793
|
}
|
|
20793
20794
|
// 说明:以下为源码中注释掉的 loadMText 旧实现(保真保留)。
|
|
@@ -20940,13 +20941,14 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
20940
20941
|
// }
|
|
20941
20942
|
loadMText(e, i, s) {
|
|
20942
20943
|
if (!e.text) return;
|
|
20944
|
+
if (!V.hasFiniteTextPlacement(e)) return P.warn("[Dxf] MText (handle '%s') has non-finite placement, ignored!", e.handle), void 0;
|
|
20943
20945
|
if (!this.font) return P.info("[Dxf] Font file not set, ignoring text entity."), void 0;
|
|
20944
20946
|
const n = this.getTextStyle(i, e), r = $s(e.text, {
|
|
20945
20947
|
encoding: this.getTextEncoding(n)
|
|
20946
20948
|
}), a = this.getMTextGroup(r, e, n, i, s), o = a && a.object;
|
|
20947
20949
|
if (!o) return;
|
|
20948
20950
|
o.matrix.decompose($, ge, tt), e.position && ($.x += e.position.x, $.y += e.position.y, o.matrix.compose($, ge, tt)), ut.makeEmpty();
|
|
20949
|
-
const l =
|
|
20951
|
+
const l = U.getBox(o, ut), h = l.getSize(N), d = e.width || h.x, u = e.height || h.y, f = h.y > 0 ? h.y : u, m = e.text;
|
|
20950
20952
|
let b = 0, y = 0;
|
|
20951
20953
|
switch (document.createElement("canvas").getContext("2d"), e.attachmentPoint) {
|
|
20952
20954
|
case 1:
|
|
@@ -21009,7 +21011,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21009
21011
|
const x = e.position ? $.clone().sub(e.position) : $;
|
|
21010
21012
|
et.makeTranslation(-x.x, -x.y, 0), ue.makeRotationZ(w), o.matrix.multiply(et), o.matrix.multiply(ue), o.matrix.multiply(et.invert()), o.userData || (o.userData = {});
|
|
21011
21013
|
const E = o.matrix.elements, M = E && E[12] || 0, O = E && E[13] || 0, T = E && E[14] || 0, v = new p.Box3();
|
|
21012
|
-
|
|
21014
|
+
U.getBox(o, v);
|
|
21013
21015
|
const C = new p.Vector3();
|
|
21014
21016
|
v.getCenter(C);
|
|
21015
21017
|
const _ = new p.Vector3();
|
|
@@ -21063,7 +21065,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21063
21065
|
}), a = this.getMTextGroup(r, e, n, i, s), o = a && a.object;
|
|
21064
21066
|
if (!o) return;
|
|
21065
21067
|
o.matrix.decompose($, ge, tt), e.position && ($.x += e.position.x, $.y += e.position.y, o.matrix.compose($, ge, tt)), ut.makeEmpty();
|
|
21066
|
-
const l =
|
|
21068
|
+
const l = U.getBox(o, ut), h = l.getSize(N), d = e.width || h.x, u = e.height || h.y, f = h.y > 0 ? h.y : u;
|
|
21067
21069
|
let m = 0, b = 0;
|
|
21068
21070
|
switch (e.attachmentPoint) {
|
|
21069
21071
|
case 1:
|
|
@@ -21135,7 +21137,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21135
21137
|
}
|
|
21136
21138
|
let d = "Left";
|
|
21137
21139
|
i.width && i.attachmentPoint && ([1, 4, 7].includes(i.attachmentPoint) ? d = "Left" : [2, 5, 8].includes(i.attachmentPoint) ? d = "Center" : [3, 6, 9].includes(i.attachmentPoint) && (d = "Right"));
|
|
21138
|
-
const u = i.width || 0, f = new
|
|
21140
|
+
const u = i.width || 0, f = new U();
|
|
21139
21141
|
let m, b = s.fontFile, y = 1, S = 1, w = 256, x = h * 0.8, E = x + h;
|
|
21140
21142
|
for (let M = 0; M < e.length; M++) {
|
|
21141
21143
|
const O = e[M];
|
|
@@ -21186,16 +21188,16 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21186
21188
|
a += B, l.push(C);
|
|
21187
21189
|
}
|
|
21188
21190
|
l.length > 0 && (v(l, a), l = []);
|
|
21189
|
-
const _ = new
|
|
21191
|
+
const _ = new U();
|
|
21190
21192
|
if (T.length > 0) {
|
|
21191
21193
|
!m && (m = i.colorIndex), w !== void 0 && w !== 256 ? (i.color = Li(w), i.colorIndex = w) : i.colorIndex = m;
|
|
21192
21194
|
const A = this.getColor(i, n, r), I = T.filter((k) => k instanceof p.ExtrudeGeometry), B = T.filter((k) => !(k instanceof p.ExtrudeGeometry));
|
|
21193
21195
|
if (I.length > 0) {
|
|
21194
|
-
const k = new
|
|
21196
|
+
const k = new U(G.Mesh);
|
|
21195
21197
|
k.geometry = _e(I), k.material = this.getMeshBasicMaterial(A), _.add(k);
|
|
21196
21198
|
}
|
|
21197
21199
|
if (B.length > 0) {
|
|
21198
|
-
const k = new
|
|
21200
|
+
const k = new U(G.LineSegment);
|
|
21199
21201
|
k.geometry = _e(B), k.material = this.getLineBasicMaterial(A), _.add(k);
|
|
21200
21202
|
}
|
|
21201
21203
|
}
|
|
@@ -21276,7 +21278,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21276
21278
|
const s = new p.Vector3();
|
|
21277
21279
|
let n = !1;
|
|
21278
21280
|
this.enableRTC && (n = H.checkAndRebasePositionsOnRTC(i, s));
|
|
21279
|
-
const r = new p.BufferGeometry().setFromPoints(i), a = new
|
|
21281
|
+
const r = new p.BufferGeometry().setFromPoints(i), a = new U(G.Line);
|
|
21280
21282
|
return a.geometry = r, a.material = me, n && (this.setRTCUserData(a), a.matrix.setPosition(s.x, s.y, 0)), a.layers.enableAll(), a;
|
|
21281
21283
|
}
|
|
21282
21284
|
loadSpline(e, i) {
|
|
@@ -21294,27 +21296,27 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21294
21296
|
this.enableRTC && (m = H.checkAndRebasePositionsOnRTC(u, f));
|
|
21295
21297
|
const b = H.getAdjacentNonRepeatPoints(u);
|
|
21296
21298
|
if (b.length < 2) return P.warn("[Dxf] Spline entity (handle '%s') contains less than 2 points, ignored!", e.handle), void 0;
|
|
21297
|
-
const y = new p.BufferGeometry().setFromPoints(b), S = new
|
|
21299
|
+
const y = new p.BufferGeometry().setFromPoints(b), S = new U(G.Line);
|
|
21298
21300
|
return S.geometry = y, S.material = me, m && (this.setRTCUserData(S), S.matrix.setPosition(f.x, f.y, 0)), S.layers.enableAll(), S;
|
|
21299
21301
|
}
|
|
21300
21302
|
loadXLine(e) {
|
|
21301
21303
|
if (!e.vertices || e.vertices.length === 0) return P.warn("[Dxf] Entity is missing vertices:", e.handle), void 0;
|
|
21302
|
-
const i =
|
|
21304
|
+
const i = j.arrayOrObjectToVector3(e.directionVector), s = new p.Vector3(e.vertices[0].x, e.vertices[0].y, 0), n = [];
|
|
21303
21305
|
if (n.push(i.clone().multiplyScalar(-1e6).add(s)), n.push(i.clone().multiplyScalar(1e6).add(s)), n.length === 0) return;
|
|
21304
21306
|
const r = new p.Vector3();
|
|
21305
21307
|
let a = !1;
|
|
21306
21308
|
this.enableRTC && (a = H.checkAndRebasePositionsOnRTC(n, r));
|
|
21307
|
-
const o = new p.BufferGeometry().setFromPoints(n), l = new
|
|
21309
|
+
const o = new p.BufferGeometry().setFromPoints(n), l = new U(G.Line);
|
|
21308
21310
|
return l.geometry = o, l.material = me, a && (this.setRTCUserData(l), l.matrix.setPosition(r.x, r.y, 0)), l.layers.enableAll(), l;
|
|
21309
21311
|
}
|
|
21310
21312
|
loadRay(e) {
|
|
21311
21313
|
if (!e.vertices || e.vertices.length === 0) return P.warn("[Dxf] Entity is missing vertices:", e.handle), void 0;
|
|
21312
|
-
const i =
|
|
21314
|
+
const i = j.arrayOrObjectToVector3(e.directionVector), s = e.vertices.map((l) => new p.Vector3(l.x, l.y, 0));
|
|
21313
21315
|
if (s.push(i.multiplyScalar(1e6).add(s[0])), s.length === 0) return;
|
|
21314
21316
|
const n = new p.Vector3();
|
|
21315
21317
|
let r = !1;
|
|
21316
21318
|
this.enableRTC && (r = H.checkAndRebasePositionsOnRTC(s, n));
|
|
21317
|
-
const a = new p.BufferGeometry().setFromPoints(s), o = new
|
|
21319
|
+
const a = new p.BufferGeometry().setFromPoints(s), o = new U(G.Line);
|
|
21318
21320
|
return o.geometry = a, o.material = me, r && (this.setRTCUserData(o), o.matrix.setPosition(n.x, n.y, 0)), o.layers.enableAll(), o;
|
|
21319
21321
|
}
|
|
21320
21322
|
// 说明:以下为源码中注释掉的 loadLine 旧实现(保真保留)。
|
|
@@ -21436,11 +21438,11 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21436
21438
|
}), w(y);
|
|
21437
21439
|
} else
|
|
21438
21440
|
y.setIndex(u);
|
|
21439
|
-
l = new
|
|
21441
|
+
l = new U(G.LineSegment), l.geometry = y, l.material = S;
|
|
21440
21442
|
}
|
|
21441
21443
|
if (n.length > 0) {
|
|
21442
21444
|
a && H.checkAndRebasePositionsOnRTC(n, r);
|
|
21443
|
-
const h = new p.BufferGeometry().setFromPoints(n), d = new
|
|
21445
|
+
const h = new p.BufferGeometry().setFromPoints(n), d = new U(G.Point);
|
|
21444
21446
|
d.geometry = h, d.material = Ls, l ? console.warn("Line has both segments and points – consider using a Group") : l = d;
|
|
21445
21447
|
}
|
|
21446
21448
|
if (l)
|
|
@@ -21460,10 +21462,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21460
21462
|
}
|
|
21461
21463
|
const n = [...e.vertices];
|
|
21462
21464
|
if (e.extrusionDirectionX !== void 0 && e.extrusionDirectionY !== void 0 && e.extrusionDirectionZ !== void 0) {
|
|
21463
|
-
|
|
21464
|
-
const b =
|
|
21465
|
+
N.set(e.extrusionDirectionX, e.extrusionDirectionY, e.extrusionDirectionZ);
|
|
21466
|
+
const b = V.getOcsMatrix(N).invert(), y = e.elevation !== void 0 ? e.elevation : 0;
|
|
21465
21467
|
n.forEach((S) => {
|
|
21466
|
-
|
|
21468
|
+
N.set(S.x, S.y, y).applyMatrix4(b), S.x = N.x, S.y = N.y;
|
|
21467
21469
|
});
|
|
21468
21470
|
}
|
|
21469
21471
|
let r = jn(n, e.shape);
|
|
@@ -21471,7 +21473,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21471
21473
|
P.warn("[Dxf] Invalid LWPolyline entity (handle '%s'), ignored!", e.handle);
|
|
21472
21474
|
return;
|
|
21473
21475
|
}
|
|
21474
|
-
let a = new
|
|
21476
|
+
let a = new U();
|
|
21475
21477
|
const o = e.extendedData;
|
|
21476
21478
|
if (o?.outlines) {
|
|
21477
21479
|
const b = o.outlines, y = [];
|
|
@@ -21481,7 +21483,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21481
21483
|
O === 0 ? E.moveTo(M[0], M[1]) : E.lineTo(M[0], M[1]);
|
|
21482
21484
|
}), E.closePath(), y.push(new p.ShapeGeometry(E));
|
|
21483
21485
|
});
|
|
21484
|
-
const S = _e(y), w = new
|
|
21486
|
+
const S = _e(y), w = new U(G.Mesh);
|
|
21485
21487
|
w.geometry = S, w.material = xi, w.layers.enableAll(), w.layers.disable(Ye), a.add(w);
|
|
21486
21488
|
}
|
|
21487
21489
|
let l = !1;
|
|
@@ -21502,14 +21504,14 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21502
21504
|
if (this.statsInfo.unsupportedPolylineCount++, b ? y = this.createTaperedPolylineGeometry(n, u) : y = H.convertWidthLineToMeshGeometry(d, u), !y)
|
|
21503
21505
|
P.warn("[Dxf] Failed to convert line with width to mesh geometry: %s", e.handle);
|
|
21504
21506
|
else {
|
|
21505
|
-
const E = new
|
|
21507
|
+
const E = new U(G.Mesh);
|
|
21506
21508
|
E.geometry = y, E.material = xi, E.layers.enableAll(), E.layers.disable(Ye), a.add(E);
|
|
21507
|
-
const M = Q.createOutline(y, me, E.matrix), O = new
|
|
21509
|
+
const M = Q.createOutline(y, me, E.matrix), O = new U(G.LineSegment);
|
|
21508
21510
|
O.geometry = M.geometry, O.material = M.material, O.matrix = M.matrix, O.layers.enableAll(), O.layers.disable(Ye), a.add(O);
|
|
21509
21511
|
}
|
|
21510
21512
|
}
|
|
21511
21513
|
}
|
|
21512
|
-
const m = new
|
|
21514
|
+
const m = new U(G.Line);
|
|
21513
21515
|
return m.geometry = new p.BufferGeometry().setFromPoints(d), m.material = me, m.layers.enableAll(), a.children.length > 0 ? a.add(m) : a = m, l && (this.setRTCUserData(a), a.matrix.setPosition(h)), a;
|
|
21514
21516
|
}
|
|
21515
21517
|
/**
|
|
@@ -21536,10 +21538,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21536
21538
|
loadMLeader(e, i, s) {
|
|
21537
21539
|
const n = i.tables.dimStyle.dimStyles[e.dimensionStyle] || this.getDefaultDimensionStyle(i), r = e.contextData?.defaultTextContents;
|
|
21538
21540
|
if (!r) return;
|
|
21539
|
-
const a = new
|
|
21541
|
+
const a = new U(), o = $s(r), l = this.getTextStyle(i, e), h = this.getMTextGroup(o, e, l, i, s), d = h && h.object;
|
|
21540
21542
|
if (d) {
|
|
21541
21543
|
d.matrix.decompose($, ge, tt), e.contextData?.textLocation && ($.x += e.contextData.textLocation.x, $.y += e.contextData.textLocation.y, d.matrix.compose($, ge, tt)), ut.makeEmpty();
|
|
21542
|
-
const u =
|
|
21544
|
+
const u = U.getBox(d, ut), f = u.getSize(N), m = f.x, b = f.y;
|
|
21543
21545
|
let y = 0, S = 0;
|
|
21544
21546
|
switch (e.contextData?.textAttachment) {
|
|
21545
21547
|
case 1:
|
|
@@ -21580,8 +21582,8 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21580
21582
|
const E = e.contextData.textDirection, M = new p.Vector3(E.x, E.y, E.z), O = M.clone().cross(We), T = We.angleTo(M);
|
|
21581
21583
|
w += O.z > 0 ? -T : T;
|
|
21582
21584
|
}
|
|
21583
|
-
H.shouldRebasePositionOnRTC($) && this.setRTCUserData(d), d.matrix.compose($, ge, tt), e.contextData?.textLocation ?
|
|
21584
|
-
const x = $.clone().sub(
|
|
21585
|
+
H.shouldRebasePositionOnRTC($) && this.setRTCUserData(d), d.matrix.compose($, ge, tt), e.contextData?.textLocation ? N.set(e.contextData.textLocation.x, e.contextData.textLocation.y, 0) : N.set(0, 0, 0);
|
|
21586
|
+
const x = $.clone().sub(N);
|
|
21585
21587
|
et.makeTranslation(-x.x, -x.y, 0), ue.makeRotationZ(w), d.matrix.multiply(et), d.matrix.multiply(ue), d.matrix.multiply(et.invert()), d.renderOrder = Te.Text, a.add(d);
|
|
21586
21588
|
}
|
|
21587
21589
|
if (e.leaderLineType !== 0) {
|
|
@@ -21602,7 +21604,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21602
21604
|
for (let B = 0; B < O.length; B++)
|
|
21603
21605
|
u.push(T, O[B]), T = O[B];
|
|
21604
21606
|
if (u.length < 2) continue;
|
|
21605
|
-
const v =
|
|
21607
|
+
const v = N.subVectors(u[0], u[1]).length(), C = e.arrowHeadSize || n.DIMASZ || 2.5, _ = e.arrowHeadScale || n.DIMSCALE || 1, A = C * _;
|
|
21606
21608
|
e.leaderLineType;
|
|
21607
21609
|
let I = "";
|
|
21608
21610
|
if (e.arrowHeadId ? I = e.arrowHeadId : n && n.DIMLDRBLK && (I = n.DIMLDRBLK), I) {
|
|
@@ -21612,7 +21614,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21612
21614
|
const D = this.loadEntity(B.entities[k], i, e);
|
|
21613
21615
|
if (D) {
|
|
21614
21616
|
const F = new p.Vector3(u[u.length - 1].x, u[u.length - 1].y, u[u.length - 1].z), se = new p.Vector3(u[u.length - 2].x, u[u.length - 2].y, u[u.length - 2].z), ne = Math.atan2(F.y - se.y, F.x - se.x);
|
|
21615
|
-
|
|
21617
|
+
N.copy(F), $.setScalar(A), ge.setFromAxisAngle(yi, ne), D.matrix.compose(N, ge, $), a.add(D);
|
|
21616
21618
|
}
|
|
21617
21619
|
}
|
|
21618
21620
|
} else this.loadDefaultLeadArrow(u[u.length - 2], u[u.length - 1], v / 2e3, u);
|
|
@@ -21620,7 +21622,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21620
21622
|
const y = new p.Vector3();
|
|
21621
21623
|
let S = !1;
|
|
21622
21624
|
this.enableRTC && (S = H.checkAndRebasePositionsOnRTC(u, y));
|
|
21623
|
-
const w = new p.BufferGeometry().setFromPoints(u), x = new
|
|
21625
|
+
const w = new p.BufferGeometry().setFromPoints(u), x = new U(G.LineSegment);
|
|
21624
21626
|
x.geometry = w, x.material = me, x.renderOrder = Te.Line, S && (this.setRTCUserData(x), x.matrix.setPosition(y.x, y.y, 0)), a.add(x);
|
|
21625
21627
|
} else return d?.traverse((u) => {
|
|
21626
21628
|
u.layers.enableAll();
|
|
@@ -21649,7 +21651,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21649
21651
|
const w = a[S], x = a[S + 1];
|
|
21650
21652
|
n.push(w, x);
|
|
21651
21653
|
}
|
|
21652
|
-
const o =
|
|
21654
|
+
const o = N.subVectors(n[0], n[1]).setZ(0).length(), l = e.arrowHeight || r.DIMASZ || 2.5, h = e.arrowHeadScale || r.DIMSCALE || 1, d = l * h, u = new U();
|
|
21653
21655
|
if (e.arrowFlag === 1) {
|
|
21654
21656
|
let S = "";
|
|
21655
21657
|
e.arrowHeadBlockHandle ? S = e.arrowHeadBlockHandle : r && r.DIMLDRBLK && (S = r.DIMLDRBLK);
|
|
@@ -21660,7 +21662,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21660
21662
|
const E = this.loadEntity(w.entities[x], i, e);
|
|
21661
21663
|
if (E) {
|
|
21662
21664
|
const M = new p.Vector3(n[0].x, n[0].y, n[0].z), O = new p.Vector3(n[1].x, n[1].y, n[1].z), T = Math.atan2(M.y - O.y, M.x - O.x);
|
|
21663
|
-
|
|
21665
|
+
N.copy(M), $.setScalar(d), ge.setFromAxisAngle(yi, T), E.matrix.compose(N, ge, $), u.add(E);
|
|
21664
21666
|
}
|
|
21665
21667
|
}
|
|
21666
21668
|
} else this.loadDefaultLeadArrow(n[1], n[0], d / o / 2, n);
|
|
@@ -21669,7 +21671,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21669
21671
|
const f = new p.Vector3();
|
|
21670
21672
|
let m = !1;
|
|
21671
21673
|
this.enableRTC && (m = H.checkAndRebasePositionsOnRTC(n, f));
|
|
21672
|
-
const b = new p.BufferGeometry().setFromPoints(n), y = new
|
|
21674
|
+
const b = new p.BufferGeometry().setFromPoints(n), y = new U(G.Line);
|
|
21673
21675
|
return y.geometry = b, y.material = me, y.renderOrder = Te.Line, m && (this.setRTCUserData(y), y.matrix.setPosition(f.x, f.y, 0)), u.children.length > 0 ? (u.add(y), kt.merge(u, !1), u.traverse((S) => {
|
|
21674
21676
|
S.layers.enableAll();
|
|
21675
21677
|
}), u.children.length === 1 ? u.children[0] : u) : (y.layers.enableAll(), y);
|
|
@@ -21808,7 +21810,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21808
21810
|
P.warn("[Dxf] Entity is missing columnWidthArr:", e.handle);
|
|
21809
21811
|
return;
|
|
21810
21812
|
}
|
|
21811
|
-
const n = new
|
|
21813
|
+
const n = new U(), {
|
|
21812
21814
|
cells: r,
|
|
21813
21815
|
rowCount: a,
|
|
21814
21816
|
columnCount: o,
|
|
@@ -21870,7 +21872,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21870
21872
|
w && b.push(new p.Vector3(m[y], S, 0), new p.Vector3(m[y], f[a], 0));
|
|
21871
21873
|
}
|
|
21872
21874
|
if (b.length > 0) {
|
|
21873
|
-
const y = new p.BufferGeometry().setFromPoints(b), S = new
|
|
21875
|
+
const y = new p.BufferGeometry().setFromPoints(b), S = new U(G.LineSegment);
|
|
21874
21876
|
S.geometry = y, S.material = me, S.layers.enableAll(), n.add(S);
|
|
21875
21877
|
}
|
|
21876
21878
|
for (let y = 0; y < a; y++)
|
|
@@ -21886,7 +21888,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21886
21888
|
O += l[y + C];
|
|
21887
21889
|
w.colorIndex = e.colorIndex, w.height = w.textHeight || 2.5;
|
|
21888
21890
|
const T = this.getTableTextOffset(w.attachmentPoint || 1, M, O);
|
|
21889
|
-
|
|
21891
|
+
N.set(x, E, 0), N.add(T), w.position = N.clone();
|
|
21890
21892
|
const v = this.loadMText(w, i, s);
|
|
21891
21893
|
v && n.add(v);
|
|
21892
21894
|
}
|
|
@@ -21899,7 +21901,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21899
21901
|
w && n.add(w);
|
|
21900
21902
|
}
|
|
21901
21903
|
}
|
|
21902
|
-
return n.matrix.decompose(
|
|
21904
|
+
return n.matrix.decompose(N, ge, tt), N.x += e.startPoint.x, N.y += e.startPoint.y, n.matrix.compose(N, ge, tt), n;
|
|
21903
21905
|
}
|
|
21904
21906
|
// ========== 辅助方法:获取合并区域的“主单元格”引用 ==========
|
|
21905
21907
|
_getMergeOwner(e, i, s, n, r) {
|
|
@@ -21934,19 +21936,19 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21934
21936
|
return this.blocksCache[i];
|
|
21935
21937
|
}
|
|
21936
21938
|
static updateMaterialUniforms(e) {
|
|
21937
|
-
e instanceof p.ShaderMaterial && (e.uniforms.u_cameraZoom && (e.uniforms.u_cameraZoom =
|
|
21939
|
+
e instanceof p.ShaderMaterial && (e.uniforms.u_cameraZoom && (e.uniforms.u_cameraZoom = V.CameraZoomUniform), e.uniforms.u_viewportScale && (e.uniforms.u_viewportScale = V.ViewportScaleUniform));
|
|
21938
21940
|
}
|
|
21939
21941
|
static transformAngleByOcsMatrix(e, i) {
|
|
21940
|
-
const s =
|
|
21942
|
+
const s = N.set(Math.cos(i) * 1, Math.sin(i) * 1, 0), n = s.applyMatrix4(e);
|
|
21941
21943
|
return Math.atan2(n.y, n.x);
|
|
21942
21944
|
}
|
|
21943
21945
|
static getArcAnglesByOcsMatrix(e, i, s) {
|
|
21944
21946
|
let n = z.getArcAngleSpanInRadian(i, s);
|
|
21945
|
-
const r =
|
|
21947
|
+
const r = V.transformAngleByOcsMatrix(e, i), a = V.transformAngleByOcsMatrix(e, s);
|
|
21946
21948
|
let o;
|
|
21947
21949
|
if (z.areNumbersClose(n, Math.PI)) {
|
|
21948
21950
|
n = 1;
|
|
21949
|
-
const l =
|
|
21951
|
+
const l = V.transformAngleByOcsMatrix(e, i + n);
|
|
21950
21952
|
o = z.getArcAngleSpanInRadian(r, l);
|
|
21951
21953
|
} else {
|
|
21952
21954
|
if (z.areNumbersClose(n, Math.PI * 2)) return [r, r + Math.PI * 2];
|
|
@@ -21959,13 +21961,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21959
21961
|
if (!e.radius || e.radius < 1e-3) return P.warn("[Dxf] The radius of arc (handle '" + e.handle + "') is too small, ignored!"), void 0;
|
|
21960
21962
|
const n = new p.Vector3(0, 0, 1);
|
|
21961
21963
|
e.extrusionDirectionX !== void 0 && e.extrusionDirectionY !== void 0 && e.extrusionDirectionZ !== void 0 && n.set(e.extrusionDirectionX, e.extrusionDirectionY, e.extrusionDirectionZ);
|
|
21962
|
-
const r =
|
|
21964
|
+
const r = V.getOcsMatrix(n);
|
|
21963
21965
|
let a, o;
|
|
21964
21966
|
if (e.type === "CIRCLE") a = e.startAngle || 0, o = a + 2 * Math.PI;
|
|
21965
21967
|
else {
|
|
21966
21968
|
if (e.startAngle == null || e.endAngle == null || (a = e.startAngle, o = e.endAngle, z.areNumbersEqual(a, o, 1e-6))) return;
|
|
21967
21969
|
if (!z.areNumbersClose(z.getArcAngleSpanInRadian(a, o), Math.PI * 2)) {
|
|
21968
|
-
const O =
|
|
21970
|
+
const O = V.getArcAnglesByOcsMatrix(r, a, o);
|
|
21969
21971
|
a = O[0], o = O[1];
|
|
21970
21972
|
}
|
|
21971
21973
|
}
|
|
@@ -21976,13 +21978,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21976
21978
|
const u = this.getDivision(a, o, e.radius * h), f = l.getPoints(u), m = new p.Vector3();
|
|
21977
21979
|
let b = !1;
|
|
21978
21980
|
this.enableRTC && (b = H.checkAndRebasePositionsOnRTC(f, m));
|
|
21979
|
-
const y = new p.BufferGeometry().setFromPoints(f), S = new
|
|
21981
|
+
const y = new p.BufferGeometry().setFromPoints(f), S = new U(G.Line);
|
|
21980
21982
|
S.geometry = y, S.material = me;
|
|
21981
21983
|
const w = new p.Vector3();
|
|
21982
21984
|
e.center && (w.x = e.center.x, w.y = e.center.y);
|
|
21983
21985
|
const x = new p.Vector3(e.center?.x, e.center?.y, e.center?.z).applyMatrix4(r.invert());
|
|
21984
21986
|
w.x = x.x, w.y = x.y;
|
|
21985
|
-
const E = w, M = new
|
|
21987
|
+
const E = w, M = new U(G.Point);
|
|
21986
21988
|
return M.geometry = ma, M.material = Ls, M.userData.handle = e.handle, M.userData.isSnapObject = !0, M.userData.type = "CircleCenter", M.layers.set(Ye), S.add(M), b ? (this.setRTCUserData(S), E.x += m.x, E.y += m.y) : H.shouldRebasePositionOnRTC(E) && this.setRTCUserData(S), S.matrix.setPosition(E), S.layers.enableAll(), S;
|
|
21987
21989
|
}
|
|
21988
21990
|
addTriangleFacingCamera(e, i, s, n) {
|
|
@@ -21995,10 +21997,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
21995
21997
|
const n = e.points;
|
|
21996
21998
|
if (!n || n.length < 4) return;
|
|
21997
21999
|
if (e.extrusionDirection && e.extrusionDirection.z) {
|
|
21998
|
-
|
|
21999
|
-
const u =
|
|
22000
|
+
N.set(0, 0, e.extrusionDirection.z);
|
|
22001
|
+
const u = V.getOcsMatrix(N).invert();
|
|
22000
22002
|
n.forEach((f) => {
|
|
22001
|
-
const m =
|
|
22003
|
+
const m = N.set(f.x, f.y, 0).applyMatrix4(u);
|
|
22002
22004
|
f.x = m.x, f.y = m.y;
|
|
22003
22005
|
});
|
|
22004
22006
|
}
|
|
@@ -22009,7 +22011,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22009
22011
|
this.enableRTC && (l = H.checkAndRebasePositionsOnRTC(r, o));
|
|
22010
22012
|
const h = new p.BufferGeometry().setFromPoints(r);
|
|
22011
22013
|
h.setIndex(a);
|
|
22012
|
-
const d = new
|
|
22014
|
+
const d = new U(G.Mesh);
|
|
22013
22015
|
return d.geometry = h, d.material = xi, l && (this.setRTCUserData(d), d.matrix.setPosition(o.x, o.y, 0)), d.layers.enableAll(), d;
|
|
22014
22016
|
}
|
|
22015
22017
|
getTextStyle(e, i) {
|
|
@@ -22041,7 +22043,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22041
22043
|
}), l;
|
|
22042
22044
|
}
|
|
22043
22045
|
createTextMeshByText(e, i, s = 12, n = 0, r = 0, a = 1, o = 1 / 0, l = 0) {
|
|
22044
|
-
const h = new
|
|
22046
|
+
const h = new U(), d = [];
|
|
22045
22047
|
let u = 0, f = 0;
|
|
22046
22048
|
i?.xScale;
|
|
22047
22049
|
const m = n + s, b = i?.fontFile || "", y = typeof b == "string" && b.toLowerCase().endsWith(".shx"), S = y ? s * 0.06 : s * 0.04, w = [];
|
|
@@ -22074,7 +22076,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22074
22076
|
u = 0, f -= m;
|
|
22075
22077
|
else {
|
|
22076
22078
|
!T.boundingBox && T.computeBoundingBox();
|
|
22077
|
-
const v = T.boundingBox.getSize(
|
|
22079
|
+
const v = T.boundingBox.getSize(N).x, C = O.charCodeAt(0), A = C >= 19968 && C <= 40959 || // CJK 统一汉字
|
|
22078
22080
|
C >= 13312 && C <= 19903 || // 扩展 A
|
|
22079
22081
|
C >= 63744 && C <= 64255 || // 兼容汉字
|
|
22080
22082
|
C >= 12288 && C <= 12351 || // CJK 符号与标点(、。《》等)
|
|
@@ -22088,11 +22090,11 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22088
22090
|
if (d.length > 0) {
|
|
22089
22091
|
const M = d.filter((T) => T instanceof p.ExtrudeGeometry), O = d.filter((T) => !(T instanceof p.ExtrudeGeometry));
|
|
22090
22092
|
if (M.length > 0) {
|
|
22091
|
-
const T = new
|
|
22093
|
+
const T = new U(G.Mesh);
|
|
22092
22094
|
T.geometry = _e(M), T.material = xi, h.add(T);
|
|
22093
22095
|
}
|
|
22094
22096
|
if (O.length > 0) {
|
|
22095
|
-
const T = new
|
|
22097
|
+
const T = new U(G.LineSegment);
|
|
22096
22098
|
T.geometry = _e(O), T.material = me, h.add(T);
|
|
22097
22099
|
}
|
|
22098
22100
|
}
|
|
@@ -22100,7 +22102,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22100
22102
|
}
|
|
22101
22103
|
transformTextMesh(e, i) {
|
|
22102
22104
|
ut.makeEmpty();
|
|
22103
|
-
const s =
|
|
22105
|
+
const s = U.getBox(i, ut), n = s.getSize(N), {
|
|
22104
22106
|
halign: r,
|
|
22105
22107
|
valign: a
|
|
22106
22108
|
} = e;
|
|
@@ -22161,6 +22163,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22161
22163
|
return o.position.z = 0, o.updateMatrix(), i.matrix.copy(o.matrix), i;
|
|
22162
22164
|
}
|
|
22163
22165
|
loadText(e, i, s) {
|
|
22166
|
+
if (!V.hasFiniteTextPlacement(e)) return P.warn("[Dxf] Text (handle '%s') has non-finite placement, ignored!", e.handle), void 0;
|
|
22164
22167
|
const n = e.text;
|
|
22165
22168
|
if (!n)
|
|
22166
22169
|
return;
|
|
@@ -22173,8 +22176,8 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22173
22176
|
}).map((d) => d.text).join(""), l = this.getTextMesh(o, e.textHeight, r, e);
|
|
22174
22177
|
if (!l || l.children.length === 0)
|
|
22175
22178
|
return;
|
|
22176
|
-
this.transformTextMesh(e, l),
|
|
22177
|
-
const h = H.shouldRebasePositionOnRTC(
|
|
22179
|
+
this.transformTextMesh(e, l), N.set(l.matrix.elements[12], l.matrix.elements[13], l.matrix.elements[14]);
|
|
22180
|
+
const h = H.shouldRebasePositionOnRTC(N);
|
|
22178
22181
|
return h && this.setRTCUserData(l), l.userData = {
|
|
22179
22182
|
...l.userData,
|
|
22180
22183
|
textContent: n,
|
|
@@ -22201,14 +22204,15 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22201
22204
|
}), l.layers.enableAll(), l;
|
|
22202
22205
|
}
|
|
22203
22206
|
loadAttDef(e, i, s) {
|
|
22207
|
+
if (!V.hasFiniteTextPlacement(e)) return P.warn("[Dxf] AttDef (handle '%s') has non-finite placement, ignored!", e.handle), void 0;
|
|
22204
22208
|
let n = e.tag || e.text || e.prompt;
|
|
22205
22209
|
if (!n || !this.font) return;
|
|
22206
22210
|
const r = this.getTextStyle(i, e);
|
|
22207
22211
|
n = Vn(n).map((h) => h.text).join();
|
|
22208
22212
|
const o = this.getTextMesh(n, e.textHeight, r, e);
|
|
22209
22213
|
if (!o || o.children.length === 0) return;
|
|
22210
|
-
this.transformTextMesh(e, o),
|
|
22211
|
-
const l = H.shouldRebasePositionOnRTC(
|
|
22214
|
+
this.transformTextMesh(e, o), N.set(o.matrix.elements[12], o.matrix.elements[13], o.matrix.elements[14]);
|
|
22215
|
+
const l = H.shouldRebasePositionOnRTC(N);
|
|
22212
22216
|
return l && this.setRTCUserData(o), o.traverse((h) => {
|
|
22213
22217
|
const d = h.geometry;
|
|
22214
22218
|
if (d) {
|
|
@@ -22226,6 +22230,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22226
22230
|
}), o.layers.enableAll(), o;
|
|
22227
22231
|
}
|
|
22228
22232
|
loadAttrib(e, i, s) {
|
|
22233
|
+
if (!V.hasFiniteTextPlacement(e)) return P.warn("[Dxf] Attrib (handle '%s') has non-finite placement, ignored!", e.handle), void 0;
|
|
22229
22234
|
let n = e.text;
|
|
22230
22235
|
if (!n || !this.font) return;
|
|
22231
22236
|
const r = this.getTextStyle(i, e);
|
|
@@ -22241,8 +22246,8 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22241
22246
|
} catch {
|
|
22242
22247
|
h = l;
|
|
22243
22248
|
}
|
|
22244
|
-
o.userData.textContent = n || "", o.userData.dxfType = "ATTRIB", o.userData.layer = e.layer || "0", o.userData.handle = e.handle || "", this.transformTextMesh(e, o),
|
|
22245
|
-
const d = H.shouldRebasePositionOnRTC(
|
|
22249
|
+
o.userData.textContent = n || "", o.userData.dxfType = "ATTRIB", o.userData.layer = e.layer || "0", o.userData.handle = e.handle || "", this.transformTextMesh(e, o), N.set(o.matrix.elements[12], o.matrix.elements[13], o.matrix.elements[14]);
|
|
22250
|
+
const d = H.shouldRebasePositionOnRTC(N);
|
|
22246
22251
|
return d && this.setRTCUserData(o), o.traverse((u) => {
|
|
22247
22252
|
const f = u.geometry;
|
|
22248
22253
|
if (f) {
|
|
@@ -22260,13 +22265,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22260
22265
|
}), o.layers.enableAll(), o;
|
|
22261
22266
|
}
|
|
22262
22267
|
loadPoint(e, i, s) {
|
|
22263
|
-
if (!e.position) return;
|
|
22268
|
+
if (!V.isFinitePoint(e.position)) return;
|
|
22264
22269
|
const n = new p.BufferGeometry(), r = [new p.Vector3(e.position.x, e.position.y, e.position.z)];
|
|
22265
|
-
|
|
22266
|
-
const a =
|
|
22270
|
+
N.set(0, 0, 0);
|
|
22271
|
+
const a = N;
|
|
22267
22272
|
let o = !1;
|
|
22268
22273
|
this.enableRTC && (o = H.checkAndRebasePositionsOnRTC(r, a)), n.setFromPoints(r);
|
|
22269
|
-
const l = new
|
|
22274
|
+
const l = new U(G.Point);
|
|
22270
22275
|
return l.geometry = n, l.material = me, o && (this.setRTCUserData(l), l.matrix.setPosition(a.x, a.y, 0)), l.layers.enableAll(), l;
|
|
22271
22276
|
}
|
|
22272
22277
|
loadDimension(e, i) {
|
|
@@ -22275,7 +22280,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22275
22280
|
if (!s || !s.entities) return;
|
|
22276
22281
|
const n = i.tables.dimStyle.dimStyles[e.dimStyleName] || this.getDefaultDimensionStyle(i);
|
|
22277
22282
|
n && n.DIMCLRD > 0 && (e.colorIndex = n.DIMCLRD, e.color = Li(e.colorIndex));
|
|
22278
|
-
const r = new
|
|
22283
|
+
const r = new U();
|
|
22279
22284
|
for (let o = 0; o < s.entities.length; o++) {
|
|
22280
22285
|
const l = this.loadEntity(s.entities[o], i, e);
|
|
22281
22286
|
l && r.add(l);
|
|
@@ -22290,13 +22295,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22290
22295
|
}
|
|
22291
22296
|
r.name = e.type + "<" + s.name + ">", r.userData.entityType = e.type;
|
|
22292
22297
|
const a = e.insertionPoint;
|
|
22293
|
-
return
|
|
22298
|
+
return N.set(0, 0, 0), a && N.set(a.x, a.y, 0), H.shouldRebasePositionOnRTC(N) && this.setRTCUserData(r), r.matrix.setPosition(N), r;
|
|
22294
22299
|
}
|
|
22295
22300
|
loadImage(e, i, s) {
|
|
22296
22301
|
if (!e.imageSize || !i.objects.IMAGEDEF?.length) return;
|
|
22297
22302
|
const n = i.objects.IMAGEDEF.filter((y) => y.handle === e.imageDefHandle)[0];
|
|
22298
22303
|
if (!n) return;
|
|
22299
|
-
const r = e.imageSize.x, a = e.imageSize.y, o = new
|
|
22304
|
+
const r = e.imageSize.x, a = e.imageSize.y, o = new U();
|
|
22300
22305
|
let l = !1;
|
|
22301
22306
|
e.flags === Js.ShowImageWhenNotAlignedWithScreen || e.flags === Js.UseClippingBoundary || e.flags === Js.TransparencyIsOn || (l = !0);
|
|
22302
22307
|
const h = new p.PlaneGeometry(r, a);
|
|
@@ -22309,24 +22314,25 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22309
22314
|
transparent: !0,
|
|
22310
22315
|
side: p.FrontSide,
|
|
22311
22316
|
map: y
|
|
22312
|
-
}), w = new
|
|
22317
|
+
}), w = new U(G.Mesh);
|
|
22313
22318
|
w.geometry = h, w.material = S, o.add(w);
|
|
22314
22319
|
}
|
|
22315
|
-
const d = new p.EdgesGeometry(h), u = this.getColor(e, i, s), f = new
|
|
22320
|
+
const d = new p.EdgesGeometry(h), u = this.getColor(e, i, s), f = new U(G.Line);
|
|
22316
22321
|
f.geometry = d, f.material = this.getLineBasicMaterial(u);
|
|
22317
22322
|
const m = e.uPixel ? new p.Vector3(e.uPixel.x, e.uPixel.y, e.uPixel.z) : new p.Vector3(n.pixelSize.x, 0, 0), b = e.vPixel ? new p.Vector3(e.vPixel.x, e.vPixel.y, e.vPixel.z) : new p.Vector3(n.pixelSize.y, 0, 0);
|
|
22318
|
-
if (o.add(f), $.set(m.x, b.y, 1),
|
|
22323
|
+
if (o.add(f), $.set(m.x, b.y, 1), N.set(0, 0, 0), e.position) {
|
|
22319
22324
|
const y = new p.Vector3(e.position.x, e.position.y, e.position.z);
|
|
22320
|
-
y.add(m.multiplyScalar(r / 2)).add(b.multiplyScalar(a / 2)),
|
|
22325
|
+
y.add(m.multiplyScalar(r / 2)).add(b.multiplyScalar(a / 2)), N.copy(y);
|
|
22321
22326
|
}
|
|
22322
|
-
return H.shouldRebasePositionOnRTC(
|
|
22327
|
+
return H.shouldRebasePositionOnRTC(N) && this.setRTCUserData(o), ge.identity(), o.matrix.compose(N, ge, $), o;
|
|
22323
22328
|
}
|
|
22324
22329
|
loadInsert(e, i, s, n = !1) {
|
|
22325
22330
|
if (!e || !e.block) return;
|
|
22331
|
+
if (e.position && !V.isFinitePoint(e.position)) return P.warn("[Dxf] Insert (handle '%s') has non-finite position, ignored!", e.handle), void 0;
|
|
22326
22332
|
const r = i.blocks[e.block];
|
|
22327
22333
|
if (!r || !r.entities) return;
|
|
22328
22334
|
s && e.layer === "0" && (e.layer = s.layer), e.blockPosition = r.position;
|
|
22329
|
-
const a = new
|
|
22335
|
+
const a = new U(), o = e.zdysx;
|
|
22330
22336
|
let l;
|
|
22331
22337
|
if (o)
|
|
22332
22338
|
try {
|
|
@@ -22337,7 +22343,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22337
22343
|
for (let m = 0; m < r.entities.length; m++) {
|
|
22338
22344
|
if (r.entities[m].type === "ATTDEF") continue;
|
|
22339
22345
|
const b = this.loadEntity(r.entities[m], i, e, n);
|
|
22340
|
-
b && (o &&
|
|
22346
|
+
b && (o && V.LOADLLDATA && (b.userData.llbData = o), l !== void 0 && b.traverse((y) => {
|
|
22341
22347
|
y.geometry && (y.userData.xdata = l);
|
|
22342
22348
|
}), a.add(b));
|
|
22343
22349
|
}
|
|
@@ -22350,7 +22356,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22350
22356
|
m.referenceCount++;
|
|
22351
22357
|
}
|
|
22352
22358
|
a.name = e.type + "<" + r.name + ">", a.userData.entityType = e.type, l !== void 0 && (a.userData.xdata = l), e.extendedData?.originalType && (a.userData.originalType = e.extendedData?.originalType), e?.blockPosition && a.matrix.setPosition(-e.blockPosition.x, -e.blockPosition.y, 0);
|
|
22353
|
-
const h =
|
|
22359
|
+
const h = N.set(1, 1, 1);
|
|
22354
22360
|
e.xScale && (h.x = e.xScale), e.yScale && (h.y = e.yScale);
|
|
22355
22361
|
const d = new p.Euler();
|
|
22356
22362
|
e.rotation && (d.z = e.rotation * Math.PI / 180), ge.setFromEuler(d, !1);
|
|
@@ -22420,7 +22426,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22420
22426
|
}
|
|
22421
22427
|
loadLayout(e, i, s, n, r, a) {
|
|
22422
22428
|
if (!e.entities) return;
|
|
22423
|
-
const o = new
|
|
22429
|
+
const o = new U();
|
|
22424
22430
|
for (let d = 0; d < e.entities.length; d++) {
|
|
22425
22431
|
const u = e.entities[d];
|
|
22426
22432
|
this.addViewport(u, a);
|
|
@@ -22437,7 +22443,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22437
22443
|
o.userData.layerName = e.layer;
|
|
22438
22444
|
const l = s.layoutName;
|
|
22439
22445
|
let h = n.children.find((d) => d.name === l);
|
|
22440
|
-
!h && (h = new
|
|
22446
|
+
!h && (h = new U(), h.name = l, h.userData.isLayoutLevelObject = !0, n.add(h)), h.add(o), e.position && o.matrix.setPosition(e.position.x, e.position.y, e.position.z || 0);
|
|
22441
22447
|
}
|
|
22442
22448
|
convertEdgeToPoints(e) {
|
|
22443
22449
|
const i = [];
|
|
@@ -22627,7 +22633,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22627
22633
|
}
|
|
22628
22634
|
T.forEach((_) => {
|
|
22629
22635
|
!z.areVector2sEqual(_[0], _[_.length - 1]) && _.push(_[0]);
|
|
22630
|
-
const A = _.map((I) => new p.Vector2(
|
|
22636
|
+
const A = _.map((I) => new p.Vector2(j.roundNumber(I.x, 7), j.roundNumber(I.y, 7)));
|
|
22631
22637
|
if (A?.length > 0) {
|
|
22632
22638
|
l.push(A);
|
|
22633
22639
|
const I = new p.Box2().setFromPoints(A);
|
|
@@ -22650,7 +22656,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22650
22656
|
this.buildHatchGeometry(l, y, S);
|
|
22651
22657
|
let w;
|
|
22652
22658
|
if (S.length > 0 && (w = _e(S)), !w || !w.getIndex() || w.getIndex()?.count === 0) return P.warn("[Dxf] Failed to convert hatch boundaries!"), void 0;
|
|
22653
|
-
const x = new
|
|
22659
|
+
const x = new U(G.Mesh);
|
|
22654
22660
|
x.geometry = w, x.material = xi, this.setHatchMaterial(x, n, i, f, s);
|
|
22655
22661
|
const E = x;
|
|
22656
22662
|
return m && (this.setRTCUserData(E), E.matrix.setPosition(f.x, f.y, 0)), E.traverse((M) => {
|
|
@@ -22668,9 +22674,9 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22668
22674
|
const o = [new p.Vector2(s, n), new p.Vector2(s, a), new p.Vector2(r, a), new p.Vector2(r, n), new p.Vector2(s, n)], l = new p.Vector3();
|
|
22669
22675
|
let h = !1;
|
|
22670
22676
|
this.enableRTC && (h = H.checkAndRebasePositionsOnRTC(o, l));
|
|
22671
|
-
const d = new p.BufferGeometry().setFromPoints(o), u = this.getLineBasicMaterial(16777215), f = new
|
|
22677
|
+
const d = new p.BufferGeometry().setFromPoints(o), u = this.getLineBasicMaterial(16777215), f = new U(G.Line);
|
|
22672
22678
|
f.geometry = d, f.material = u, f.layers.enableAll(), h && (this.setRTCUserData(f), f.matrix.setPosition(l.x, l.y, 0));
|
|
22673
|
-
const m = new
|
|
22679
|
+
const m = new U();
|
|
22674
22680
|
m.add(f);
|
|
22675
22681
|
let b;
|
|
22676
22682
|
const y = i.objects.DICTIONARY;
|
|
@@ -22687,7 +22693,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22687
22693
|
for (let w = 0; w < i.objects.XRECORD.length; w++) {
|
|
22688
22694
|
const x = i.objects.XRECORD[w];
|
|
22689
22695
|
if (x.handle === b) {
|
|
22690
|
-
const E = x.binaryData, M =
|
|
22696
|
+
const E = x.binaryData, M = j.hexToBase64(E), O = "data:image/jpg;base64," + M, T = new p.TextureLoader(this.manager).load(O);
|
|
22691
22697
|
T.colorSpace = p.SRGBColorSpace;
|
|
22692
22698
|
const v = new p.MeshBasicMaterial({
|
|
22693
22699
|
transparent: !0,
|
|
@@ -22698,13 +22704,21 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22698
22704
|
}
|
|
22699
22705
|
}
|
|
22700
22706
|
if (S) {
|
|
22701
|
-
const w = new p.Box2().setFromPoints(o), x = w.getSize(Zi), E = new p.PlaneGeometry(x.x, x.y), M = new
|
|
22707
|
+
const w = new p.Box2().setFromPoints(o), x = w.getSize(Zi), E = new p.PlaneGeometry(x.x, x.y), M = new U(G.Mesh);
|
|
22702
22708
|
M.geometry = E, M.material = S;
|
|
22703
22709
|
const O = w.getCenter(Zi);
|
|
22704
|
-
|
|
22710
|
+
N.set(O.x, O.y, 0), h && (this.setRTCUserData(M), N.x += l.x, N.y += l.y), M.matrix.setPosition(N), M.layers.enableAll(), m.add(M);
|
|
22705
22711
|
}
|
|
22706
22712
|
return m.children.length > 1 ? m : f;
|
|
22707
22713
|
}
|
|
22714
|
+
/** 校验坐标点是否为有限数值(业务系统导出的 DXF 可能含 nan/inf 坏值文本,parseFloat 后为非有限数,会污染几何包围盒导致渲染异常) */
|
|
22715
|
+
static isFinitePoint(e) {
|
|
22716
|
+
return !!e && Number.isFinite(e.x) && Number.isFinite(e.y) && (e.z === void 0 || Number.isFinite(e.z));
|
|
22717
|
+
}
|
|
22718
|
+
/** 文字类实体(TEXT/MTEXT/ATTDEF/ATTRIB)位置与旋转有效性校验 */
|
|
22719
|
+
static hasFiniteTextPlacement(e) {
|
|
22720
|
+
return e.position && !V.isFinitePoint(e.position) || e.startPoint && !V.isFinitePoint(e.startPoint) || e.endPoint && !V.isFinitePoint(e.endPoint) ? !1 : Number.isFinite(e.rotation ?? 0);
|
|
22721
|
+
}
|
|
22708
22722
|
static getOcsMatrix(e) {
|
|
22709
22723
|
let i = We, s = Un, n = yi;
|
|
22710
22724
|
const r = new p.Vector3(0, 1, 0), a = new p.Vector3(0, 0, 1);
|
|
@@ -22720,10 +22734,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22720
22734
|
return f.makeBasis(l, h, d), u.premultiply(f), u.premultiply(ue.identity().compose(a.clone(), new p.Quaternion().setFromAxisAngle(new p.Vector3(0, 0, 1), p.MathUtils.degToRad(i ? o : -o)), new p.Vector3(1, 1, 1))), u;
|
|
22721
22735
|
}
|
|
22722
22736
|
getViewportMsToPsMatrix(e) {
|
|
22723
|
-
const i = e.centerPoint_dcs ?? { x: 0, y: 0 }, s = e.centerPoint ?? { x: 0, y: 0, z: 0 }, n = new p.Vector3(i.x, i.y, 0), r = new p.Vector3(s.x, s.y, s.z), a = e.viewHeight, o = e.height_paperSpace || 1, l = (a || o) / o, h =
|
|
22737
|
+
const i = e.centerPoint_dcs ?? { x: 0, y: 0 }, s = e.centerPoint ?? { x: 0, y: 0, z: 0 }, n = new p.Vector3(i.x, i.y, 0), r = new p.Vector3(s.x, s.y, s.z), a = e.viewHeight, o = e.height_paperSpace || 1, l = (a || o) / o, h = V.getDcs2WcsMatrix(e, this.angDir), d = new p.Matrix4();
|
|
22724
22738
|
d.setPosition(pa.clone().sub(r));
|
|
22725
22739
|
const u = ga.identity();
|
|
22726
|
-
u.scale(
|
|
22740
|
+
u.scale(N.set(l, l, l));
|
|
22727
22741
|
const f = et.identity().setPosition(pa.clone().sub(r));
|
|
22728
22742
|
u.premultiply(f.clone().invert()).multiply(f), d.multiply(u);
|
|
22729
22743
|
const m = ue.identity();
|
|
@@ -22758,7 +22772,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22758
22772
|
let l = !1;
|
|
22759
22773
|
const h = new p.Vector3();
|
|
22760
22774
|
this.enableRTC && (l = H.checkAndRebasePositionsOnRTC(o, h));
|
|
22761
|
-
const d = new p.BufferGeometry().setFromPoints(o), u = new
|
|
22775
|
+
const d = new p.BufferGeometry().setFromPoints(o), u = new U(G.Line);
|
|
22762
22776
|
u.geometry = d, u.material = me, u.userData.entityType = e.type, u.layers.enableAll(), l && (this.setRTCUserData(u), u.matrix.setPosition(h.x, h.y, 0));
|
|
22763
22777
|
const f = e.psBBox.clone();
|
|
22764
22778
|
f.applyMatrix4(e.msToPsMatrix.clone().invert()), f.min.z = 0, f.max.z = 0;
|
|
@@ -22772,9 +22786,9 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22772
22786
|
let b = !1;
|
|
22773
22787
|
const y = new p.Vector3();
|
|
22774
22788
|
this.enableRTC && (b = H.checkAndRebasePositionsOnRTC(m, y));
|
|
22775
|
-
const S = new p.BufferGeometry().setFromPoints(m), w = new
|
|
22789
|
+
const S = new p.BufferGeometry().setFromPoints(m), w = new U(G.Line);
|
|
22776
22790
|
w.geometry = S, w.material = me, w.userData.entityType = e.type, w.userData.inPaperSpace = [], w.layers.enableAll(), b && (this.setRTCUserData(w), w.matrix.setPosition(y.x, y.y, 0));
|
|
22777
|
-
const x = new
|
|
22791
|
+
const x = new U();
|
|
22778
22792
|
return x.add(u), x.add(w), u;
|
|
22779
22793
|
}
|
|
22780
22794
|
/**
|
|
@@ -22890,7 +22904,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22890
22904
|
if (a.material instanceof p.ShaderMaterial) {
|
|
22891
22905
|
h = a.material;
|
|
22892
22906
|
const d = new p.Color(o);
|
|
22893
|
-
!a.material.uniforms.u_color.value.equals(d) && (h = a.material.clone(),
|
|
22907
|
+
!a.material.uniforms.u_color.value.equals(d) && (h = a.material.clone(), V.updateMaterialUniforms(h), h.uniforms.u_color.value.set(o));
|
|
22894
22908
|
} else h = this.getHatchShaderMaterial(i, o, n);
|
|
22895
22909
|
l = Te.MeshWithPattern;
|
|
22896
22910
|
}
|
|
@@ -22920,7 +22934,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22920
22934
|
const n = e.name + "_" + i + "_" + s;
|
|
22921
22935
|
if (!this.lineShaderMaterials[n]) {
|
|
22922
22936
|
const r = this.getLineTypeScales(), a = r.ltScale * r.celtScale * s;
|
|
22923
|
-
this.lineShaderMaterials[n] = Rh.createLineShaderMaterial(e.pattern, i, a,
|
|
22937
|
+
this.lineShaderMaterials[n] = Rh.createLineShaderMaterial(e.pattern, i, a, V.ViewportScaleUniform, V.CameraZoomUniform);
|
|
22924
22938
|
}
|
|
22925
22939
|
return this.lineShaderMaterials[n];
|
|
22926
22940
|
}
|
|
@@ -22966,13 +22980,13 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
22966
22980
|
patternSum: M,
|
|
22967
22981
|
patternLength: O
|
|
22968
22982
|
};
|
|
22969
|
-
if (l += 4, l += o, l += o + 1, l >
|
|
22983
|
+
if (l += 4, l += o, l += o + 1, l > V.MaxFragmentUniforms) {
|
|
22970
22984
|
P.warn("[Dxf] There will be warning in fragment shader when number of uniforms exceeds 1024, so extra hatch line patterns are ignored here!");
|
|
22971
22985
|
break;
|
|
22972
22986
|
}
|
|
22973
22987
|
h.push(T);
|
|
22974
22988
|
}
|
|
22975
|
-
const u = Fh(h, e.patternAngle,
|
|
22989
|
+
const u = Fh(h, e.patternAngle, V.CameraZoomUniform, new p.Color(i), this.overrideHatchPatternLineThickness);
|
|
22976
22990
|
return u.defines = {
|
|
22977
22991
|
MAX_PATTERN_SEGMENT_COUNT: o
|
|
22978
22992
|
}, this.hatchShaderMaterials.push({
|
|
@@ -23042,7 +23056,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23042
23056
|
let u = o + 1;
|
|
23043
23057
|
for (; u < r; u++) {
|
|
23044
23058
|
const f = s[u], m = e[f];
|
|
23045
|
-
if (i[f].containsBox(d) && H.isPointInPolygon(h[
|
|
23059
|
+
if (i[f].containsBox(d) && H.isPointInPolygon(h[j.generateRandomInt(0, h.length - 1)], m)) {
|
|
23046
23060
|
n.get(f)?.children.push(n.get(l));
|
|
23047
23061
|
break;
|
|
23048
23062
|
}
|
|
@@ -23257,7 +23271,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23257
23271
|
});
|
|
23258
23272
|
}
|
|
23259
23273
|
const n = this.entitiesCache[i.ownerHandle];
|
|
23260
|
-
return n ? this.getLayout(e, n) : e.objects.LAYOUT.find((r) => r.layoutName ===
|
|
23274
|
+
return n ? this.getLayout(e, n) : e.objects.LAYOUT.find((r) => r.layoutName === V.MODEL_LAYOUT_NAME);
|
|
23261
23275
|
}
|
|
23262
23276
|
getLayerVisible(e, i) {
|
|
23263
23277
|
const s = e.tables?.layer?.layers;
|
|
@@ -23276,10 +23290,10 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23276
23290
|
if (i.has(o.id)) a.push(i.get(o.id));
|
|
23277
23291
|
else {
|
|
23278
23292
|
const l = o.clone();
|
|
23279
|
-
|
|
23293
|
+
V.updateMaterialUniforms(l), i.set(o.id, l), a.push(l);
|
|
23280
23294
|
}
|
|
23281
23295
|
});
|
|
23282
|
-
} else n && (i.has(n.id) ? r = i.get(n.id) : (r = n.clone(),
|
|
23296
|
+
} else n && (i.has(n.id) ? r = i.get(n.id) : (r = n.clone(), V.updateMaterialUniforms(r), i.set(n.id, r)));
|
|
23283
23297
|
return r;
|
|
23284
23298
|
};
|
|
23285
23299
|
e.traverse((n) => {
|
|
@@ -23330,11 +23344,11 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23330
23344
|
const a = [];
|
|
23331
23345
|
if (i)
|
|
23332
23346
|
for (let o = 0, l = r.count; o < l; o += 2)
|
|
23333
|
-
|
|
23347
|
+
N.fromBufferAttribute(r, o).applyMatrix4(n), $.fromBufferAttribute(r, o + 1).applyMatrix4(n), a[o] = o === 0 ? 0 : a[o - 1], a[o + 1] = a[o] + N.distanceTo($);
|
|
23334
23348
|
else {
|
|
23335
23349
|
a[0] = 0;
|
|
23336
23350
|
for (let o = 1, l = r.count; o < l; o++)
|
|
23337
|
-
|
|
23351
|
+
N.fromBufferAttribute(r, o - 1).applyMatrix4(n), $.fromBufferAttribute(r, o).applyMatrix4(n), a[o] = a[o - 1], a[o] += N.distanceTo($);
|
|
23338
23352
|
}
|
|
23339
23353
|
s.setAttribute("lineDistance", new p.Float32BufferAttribute(a, 1)), e.geometry = s;
|
|
23340
23354
|
} else P.warn("[Dxf] computeLineDistances only possible with non-indexed BufferGeometry.");
|
|
@@ -23343,7 +23357,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23343
23357
|
const i = Date.now();
|
|
23344
23358
|
e.traverse((s) => {
|
|
23345
23359
|
const n = s;
|
|
23346
|
-
n.isLine && n.material instanceof p.ShaderMaterial &&
|
|
23360
|
+
n.isLine && n.material instanceof p.ShaderMaterial && V.computeLineDistance(n);
|
|
23347
23361
|
}), P.debug("[Dxf] Computed line distances in " + (Date.now() - i) / 1e3 + "s");
|
|
23348
23362
|
}
|
|
23349
23363
|
static mergeDxfObjects(e) {
|
|
@@ -23353,7 +23367,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23353
23367
|
const d = Date.now();
|
|
23354
23368
|
for (const u in s) {
|
|
23355
23369
|
const f = s[u];
|
|
23356
|
-
|
|
23370
|
+
V.removeEmptyObjectsFromRemovingMarkedObjects2(f.children, f.object), f.children = [];
|
|
23357
23371
|
}
|
|
23358
23372
|
a = 0, o += Date.now() - d;
|
|
23359
23373
|
};
|
|
@@ -23393,7 +23407,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23393
23407
|
const M = E.length > r;
|
|
23394
23408
|
if (M) {
|
|
23395
23409
|
const O = Date.now();
|
|
23396
|
-
|
|
23410
|
+
V.removeEmptyObjectsFromRemovingMarkedObjects2(E, S.object), o += Date.now() - O;
|
|
23397
23411
|
} else a += E.length;
|
|
23398
23412
|
if (E.length === S.children.length) !M && E.forEach((O) => {
|
|
23399
23413
|
s[y].children.push(O);
|
|
@@ -23427,7 +23441,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23427
23441
|
P.debug("[Dxf] Totally merged " + h.removedObjects + " objects to " + h.mergedMeshes + "meshes, " + h.mergedLines + "lines, " + h.mergedPoints + "points, " + (h.mergedUnknownTypeObjects ? h.mergedUnknownTypeObjects + " unknown type," : " ") + " ");
|
|
23428
23442
|
}
|
|
23429
23443
|
static async merge(e, i) {
|
|
23430
|
-
const s =
|
|
23444
|
+
const s = j.getUpdateProgressFuncAsync(i), n = {};
|
|
23431
23445
|
e.objects.LAYOUT.forEach((y) => {
|
|
23432
23446
|
const S = y;
|
|
23433
23447
|
n[S.layoutName] = S, S.directAssociatedLeafObjectSet?.clear();
|
|
@@ -23438,7 +23452,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23438
23452
|
const y = Date.now();
|
|
23439
23453
|
for (const S in a) {
|
|
23440
23454
|
const w = a[S];
|
|
23441
|
-
|
|
23455
|
+
V.removeEmptyObjectsFromRemovingMarkedObjects(w.children, w.object), w.children = [];
|
|
23442
23456
|
}
|
|
23443
23457
|
h = 0, d += Date.now() - y;
|
|
23444
23458
|
}, f = Object.keys(e.layersAndThreejsObjects).length;
|
|
@@ -23474,7 +23488,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23474
23488
|
let O = 0;
|
|
23475
23489
|
for (const T in x) {
|
|
23476
23490
|
let v;
|
|
23477
|
-
if (T !==
|
|
23491
|
+
if (T !== V.MODEL_LAYOUT_NAME) {
|
|
23478
23492
|
const k = n[T];
|
|
23479
23493
|
!k.directAssociatedLeafObjectSet && (k.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), v = k.directAssociatedLeafObjectSet;
|
|
23480
23494
|
}
|
|
@@ -23489,7 +23503,7 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23489
23503
|
const B = I.length > l;
|
|
23490
23504
|
if (B) {
|
|
23491
23505
|
const k = Date.now();
|
|
23492
|
-
|
|
23506
|
+
V.removeEmptyObjectsFromRemovingMarkedObjects(I, C.object), d += Date.now() - k;
|
|
23493
23507
|
} else h += I.length;
|
|
23494
23508
|
if (I.length === C.children.length) !B && I.forEach((k) => {
|
|
23495
23509
|
a[T].children.push(k);
|
|
@@ -23515,8 +23529,8 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23515
23529
|
for (const y in o) {
|
|
23516
23530
|
const S = o[y], w = e.threejsObject.children.find((x) => x.name === y);
|
|
23517
23531
|
if (w) {
|
|
23518
|
-
const x = w.children.find((E) => E.name ===
|
|
23519
|
-
if (x && y !==
|
|
23532
|
+
const x = w.children.find((E) => E.name === V.SNAP_GROUP_NAME);
|
|
23533
|
+
if (x && y !== V.MODEL_LAYOUT_NAME) {
|
|
23520
23534
|
const E = n[y];
|
|
23521
23535
|
!E.directAssociatedLeafObjectSet && (E.directAssociatedLeafObjectSet = /* @__PURE__ */ new Set()), x.children.forEach((M) => E.directAssociatedLeafObjectSet?.add(M));
|
|
23522
23536
|
}
|
|
@@ -23603,29 +23617,29 @@ const We = new p.Vector3(1, 0, 0), Un = new p.Vector3(0, 1, 0), yi = new p.Vecto
|
|
|
23603
23617
|
return !1;
|
|
23604
23618
|
}
|
|
23605
23619
|
};
|
|
23606
|
-
g(
|
|
23620
|
+
g(V, "MODEL_LAYOUT_NAME", "Model"), g(V, "SNAP_GROUP_NAME", "InvisibleObjectGroupForOSnap"), g(V, "SHOW_SNAP_OBJECT", !1), /**
|
|
23607
23621
|
* 说明:以下静态字段在 bundle 中于类定义之后统一赋值,此处以字段初始化器的形式等价还原。
|
|
23608
23622
|
*/
|
|
23609
|
-
g(
|
|
23623
|
+
g(V, "CameraZoomUniform", {
|
|
23610
23624
|
value: 1
|
|
23611
23625
|
}), /**
|
|
23612
23626
|
* Used for drawing dashed lines properly in a viewport.
|
|
23613
23627
|
*/
|
|
23614
|
-
g(
|
|
23628
|
+
g(V, "ViewportScaleUniform", {
|
|
23615
23629
|
value: 1
|
|
23616
|
-
}), g(
|
|
23630
|
+
}), g(V, "TransformMatrixUniform", {
|
|
23617
23631
|
value: new p.Matrix4()
|
|
23618
|
-
}), g(
|
|
23632
|
+
}), g(V, "ResolutionUniform", {
|
|
23619
23633
|
value: new p.Vector2()
|
|
23620
23634
|
}), /**
|
|
23621
23635
|
* 说明:LOADLLDATA 未收录在发布的 d.ts 中(类型滞后),按 bundle 实现保留。
|
|
23622
23636
|
*/
|
|
23623
|
-
g(
|
|
23637
|
+
g(V, "LOADLLDATA", !1), /**
|
|
23624
23638
|
* WebGL has a limited capability for FragmentUniforms. Thus, cannot have as many
|
|
23625
23639
|
* clippingPlanes as expected.
|
|
23626
23640
|
*/
|
|
23627
|
-
g(
|
|
23628
|
-
let Z =
|
|
23641
|
+
g(V, "MaxFragmentUniforms", 1024);
|
|
23642
|
+
let Z = V;
|
|
23629
23643
|
class Ta extends li {
|
|
23630
23644
|
constructor(e) {
|
|
23631
23645
|
super();
|
|
@@ -23641,7 +23655,7 @@ class Ta extends li {
|
|
|
23641
23655
|
h && (l.type === qe.Added ? i.push(h) : l.type === qe.Removed ? s.push(h) : n.push(h));
|
|
23642
23656
|
}
|
|
23643
23657
|
const r = H.mergeBBoxes(i), a = H.mergeBBoxes(s), o = H.mergeBBoxes(n);
|
|
23644
|
-
this.drawableList.addDrawable(new Et(
|
|
23658
|
+
this.drawableList.addDrawable(new Et(j.guid(), r, [0.1, 0.9, 0.2, 1])), this.drawableList.addDrawable(new Et(j.guid(), a, [1, 0.15, 0.15, 1])), this.drawableList.addDrawable(new Et(j.guid(), o, [1, 0.85, 0.1, 1])), this.viewer.enableRender();
|
|
23645
23659
|
}
|
|
23646
23660
|
setCompareDrawableVisible(e) {
|
|
23647
23661
|
this.drawableList.getDrawables().forEach((i) => i.visible = e), this.viewer.enableRender();
|
|
@@ -23918,7 +23932,7 @@ class ds extends br {
|
|
|
23918
23932
|
*/
|
|
23919
23933
|
switchTransformMs(e) {
|
|
23920
23934
|
const i = this.msTransformMatrix;
|
|
23921
|
-
if (bi.identity(), !i || !
|
|
23935
|
+
if (bi.identity(), !i || !j.isMatrixValid(i) || i.equals(bi)) return;
|
|
23922
23936
|
const s = this.getLayoutLevelObject(Z.MODEL_LAYOUT_NAME);
|
|
23923
23937
|
s && (e === Z.MODEL_LAYOUT_NAME ? s.applyMatrix4(i) : s.applyMatrix4(i.clone().invert()), s.updateMatrixWorld(!0));
|
|
23924
23938
|
}
|
|
@@ -25618,7 +25632,7 @@ class f1 {
|
|
|
25618
25632
|
this.baseUrl = t, this.protoRoot = e;
|
|
25619
25633
|
}
|
|
25620
25634
|
async getProperty(t, e, i) {
|
|
25621
|
-
return
|
|
25635
|
+
return j.isBinaryFile(t) ? this.getPropertyFromBinary(t, e, i) : this.getPropertyFromJson(t, e);
|
|
25622
25636
|
}
|
|
25623
25637
|
async getPropertyFromJson(t, e) {
|
|
25624
25638
|
return await fetch(this.baseUrl + t, e).then((i) => {
|
|
@@ -25936,7 +25950,7 @@ const ii = class ii {
|
|
|
25936
25950
|
async getInstancedMeshByUrlAndBlobId(t, e, i) {
|
|
25937
25951
|
if (!ii.instanceDataMap[t]) {
|
|
25938
25952
|
const s = await fetch(t).then((r) => r.arrayBuffer()), n = new Uint8Array(s);
|
|
25939
|
-
|
|
25953
|
+
j.isGzip(n) && i ? ii.instanceDataMap[t] = this.parseInstanceProto(n, i) : ii.instanceDataMap[t] = this.parseInstanceBuffer(s);
|
|
25940
25954
|
}
|
|
25941
25955
|
return ii.instanceDataMap[t][e];
|
|
25942
25956
|
}
|
|
@@ -25946,7 +25960,7 @@ let an = ii;
|
|
|
25946
25960
|
class g1 {
|
|
25947
25961
|
async parse(t, e, i) {
|
|
25948
25962
|
const s = new Uint8Array(t);
|
|
25949
|
-
return
|
|
25963
|
+
return j.isGzip(s) ? this.parseProto(s, e, i) : this.parseBinary(t, e);
|
|
25950
25964
|
}
|
|
25951
25965
|
async parseBinary(t, e) {
|
|
25952
25966
|
const i = new pn(t), s = i.readUtf8String(4), n = i.readUint32(), r = i.readUint64(), a = i.readUint32(), o = i.readUint32(), l = i.readUint32(), h = i.readUint64(), d = t.slice(a, a + o), u = Mo(new Uint8Array(d, 0, o)), f = JSON.parse(u);
|
|
@@ -28454,7 +28468,7 @@ class P1 {
|
|
|
28454
28468
|
t.getSize(s);
|
|
28455
28469
|
const n = s.length(), r = 5, a = n / r, o = n * r;
|
|
28456
28470
|
if (e > a || i < o) {
|
|
28457
|
-
const l = (h) =>
|
|
28471
|
+
const l = (h) => j.numberToString(h);
|
|
28458
28472
|
P.info("[Viewer] BBox's longest side is: " + l(n)), e > a && (P.warn(
|
|
28459
28473
|
"[Viewer] camera.near(" + l(e) + ") shouldn't bigger than " + l(a) + ", will change it!"
|
|
28460
28474
|
), this.camera.near = a), i < o && (P.warn(
|
|
@@ -30423,13 +30437,13 @@ class Tt {
|
|
|
30423
30437
|
this.releaseFontData(), this.fontMap.clear();
|
|
30424
30438
|
}
|
|
30425
30439
|
static isShxFile(t) {
|
|
30426
|
-
return
|
|
30440
|
+
return j.getExtension(t) === "shx";
|
|
30427
30441
|
}
|
|
30428
30442
|
static isTtfFile(t) {
|
|
30429
|
-
return ["WOFF", "OTF", "TTF"].includes(
|
|
30443
|
+
return ["WOFF", "OTF", "TTF"].includes(j.getExtension(t).toUpperCase());
|
|
30430
30444
|
}
|
|
30431
30445
|
static isJsonFile(t) {
|
|
30432
|
-
return
|
|
30446
|
+
return j.getExtension(t) === "json";
|
|
30433
30447
|
}
|
|
30434
30448
|
static getFileName(t) {
|
|
30435
30449
|
const e = t.lastIndexOf("/");
|
|
@@ -31233,7 +31247,7 @@ const V1 = (c, t, e = 800, i = 45) => {
|
|
|
31233
31247
|
return e * r;
|
|
31234
31248
|
}, Hs = new p.Vector2(), Gs = new p.Vector2(), Ws = new p.Vector2(), Va = new p.Vector2(), U1 = new p.Vector2(), j1 = new p.Vector2(), ye = class ye extends oi {
|
|
31235
31249
|
constructor(e) {
|
|
31236
|
-
super(
|
|
31250
|
+
super(j.guid());
|
|
31237
31251
|
g(this, "needsFrustumCulled");
|
|
31238
31252
|
g(this, "renderOrder");
|
|
31239
31253
|
g(this, "snapType");
|
|
@@ -32198,7 +32212,7 @@ class ja {
|
|
|
32198
32212
|
* 在叠加层用云线框高亮指定结果(替换上一个高亮)。
|
|
32199
32213
|
*/
|
|
32200
32214
|
highlight(t) {
|
|
32201
|
-
this.overlayRender && (!this.drawableList && (this.drawableList = new fn("text-search"), this.overlayRender.addDrawableList(this.drawableList)), this.clearHighlight(), this.drawableList.addDrawable(new Et(
|
|
32215
|
+
this.overlayRender && (!this.drawableList && (this.drawableList = new fn("text-search"), this.overlayRender.addDrawableList(this.drawableList)), this.clearHighlight(), this.drawableList.addDrawable(new Et(j.guid(), [t.box.clone()], [1, 0.55, 0, 1], [1, 0.55, 0, 0.15])), this.viewer.enableRender());
|
|
32202
32216
|
}
|
|
32203
32217
|
/**
|
|
32204
32218
|
* 清除当前高亮。
|
|
@@ -32571,7 +32585,7 @@ class J1 {
|
|
|
32571
32585
|
);
|
|
32572
32586
|
}
|
|
32573
32587
|
}
|
|
32574
|
-
r.setPixelRatio(window.devicePixelRatio), r.setSize(i, s), r.outputColorSpace = p.SRGBColorSpace, r.toneMappingExposure = 1, r.localClippingEnabled = !0, r.shadowMap.enabled = !1, r.shadowMap.type = p.PCFSoftShadowMap, r.shadowMap.autoUpdate = !1, r.domElement.style.outlineWidth = "0", n?.appendChild(r.domElement), this.renderer = r,
|
|
32588
|
+
r.setPixelRatio(window.devicePixelRatio), r.setSize(i, s), r.outputColorSpace = p.SRGBColorSpace, r.toneMappingExposure = 1, r.localClippingEnabled = !0, r.shadowMap.enabled = !1, r.shadowMap.type = p.PCFSoftShadowMap, r.shadowMap.autoUpdate = !1, r.domElement.style.outlineWidth = "0", n?.appendChild(r.domElement), this.renderer = r, j.printGpuInfo(r.getContext());
|
|
32575
32589
|
}
|
|
32576
32590
|
/**
|
|
32577
32591
|
* WebGL 上下文创建失败时,在查看器容器内显示用户可读的提示浮层
|
|
@@ -33019,7 +33033,7 @@ class vr extends li {
|
|
|
33019
33033
|
if (e.equals(i)) {
|
|
33020
33034
|
P.error("[Viewer] camera position and lookAt cannot be the same!");
|
|
33021
33035
|
return;
|
|
33022
|
-
} else if (!
|
|
33036
|
+
} else if (!j.isVectorValid(e) || !j.isVectorValid(i)) {
|
|
33023
33037
|
P.error("[Viewer] invalid position or lookAt!");
|
|
33024
33038
|
return;
|
|
33025
33039
|
}
|
|
@@ -33333,7 +33347,7 @@ class Do extends vr {
|
|
|
33333
33347
|
*/
|
|
33334
33348
|
highlightEntityBox(e) {
|
|
33335
33349
|
const i = this.getOverlayRender();
|
|
33336
|
-
i && (!this.clickHighlightList && (this.clickHighlightList = new fn("entity-click-highlight"), i.addDrawableList(this.clickHighlightList)), this.clickHighlightList.clear(), this.clickHighlightList.addDrawable(new Et(
|
|
33350
|
+
i && (!this.clickHighlightList && (this.clickHighlightList = new fn("entity-click-highlight"), i.addDrawableList(this.clickHighlightList)), this.clickHighlightList.clear(), this.clickHighlightList.addDrawable(new Et(j.guid(), [e.clone()], [0.031, 0.906, 0.867, 1], [0.031, 0.906, 0.867, 0.15])), this.enableRender());
|
|
33337
33351
|
}
|
|
33338
33352
|
/**
|
|
33339
33353
|
* Gets if click-to-highlight entity is enabled. Default is false.
|
|
@@ -34163,7 +34177,7 @@ class Do extends vr {
|
|
|
34163
34177
|
const d = h.geometry;
|
|
34164
34178
|
d.boundingBox || d.computeBoundingBox();
|
|
34165
34179
|
const u = d.boundingBox.clone();
|
|
34166
|
-
if (!u || !
|
|
34180
|
+
if (!u || !j.isBoxValid(u)) return;
|
|
34167
34181
|
u.applyMatrix4(h.matrixWorld), u.getSize(Ci);
|
|
34168
34182
|
const f = Math.max(Ci.x, Ci.y), m = o / f;
|
|
34169
34183
|
m < 1 / 0 ? r.push({
|
|
@@ -34310,7 +34324,7 @@ class tu {
|
|
|
34310
34324
|
total: 100
|
|
34311
34325
|
}));
|
|
34312
34326
|
}, f = (B) => u(B, 0, 15), m = (B) => u(B, 15, 30), b = (B) => u(B, 30, 60), y = (B) => u(B, 60, 95);
|
|
34313
|
-
|
|
34327
|
+
j.printMemory("Before comparing"), this.loadingProgressBar?.addProgressItem(l), d(0);
|
|
34314
34328
|
let S = Date.now();
|
|
34315
34329
|
const w = this.loader.parse(n, f), x = this.loader.parse(a, m), [E, M] = await Promise.allSettled([w, x]);
|
|
34316
34330
|
if (E.status === "rejected") throw "[DxfCompareHelper] Failed to parse " + n;
|
|
@@ -34320,7 +34334,7 @@ class tu {
|
|
|
34320
34334
|
S = Date.now();
|
|
34321
34335
|
const v = await new yt(O, T, i).compare(b);
|
|
34322
34336
|
if (P.info("[DxfCompareHelper] Compared in " + (Date.now() - S) / 1e3 + "s"), P.debug("[DxfCompareHelper] Compared results:", v), this.loader.isAborted()) throw "[DxfCompareHelper] compare change aborted";
|
|
34323
|
-
|
|
34337
|
+
j.printMemory("After getting the comparison results"), S = Date.now(), await this.loader.loadEntitiesForCompare(O, T, v, !0, y), j.printMemory("After Creating threejs objects based on comparison result"), this.fontManager?.releaseFontData(), this.changes = v, P.info("[DxfCompareHelper] Creates threejs objects based on comparison result in " + (Date.now() - S) / 1e3 + "s");
|
|
34324
34338
|
const C = O, _ = T;
|
|
34325
34339
|
if (!Object.keys(v).length && P.info("[DxfCompareHelper] No change found"), C.threejsObject?.children.length === 0 && _.threejsObject?.children.length === 0) {
|
|
34326
34340
|
const B = "[DxfCompareHelper] Nothing was loaded from " + n + " and " + a;
|
|
@@ -34330,10 +34344,10 @@ class tu {
|
|
|
34330
34344
|
A.name = n, I.name = a, S = Date.now(), this.viewer.addModel(new ds({
|
|
34331
34345
|
modelId: t.modelId || t.src,
|
|
34332
34346
|
dxfData: C
|
|
34333
|
-
})), this.viewer.flyToObject(A),
|
|
34347
|
+
})), this.viewer.flyToObject(A), j.printMemory("After adding first loaded Model to scene"), d(95), this.viewer.addModel(new ds({
|
|
34334
34348
|
modelId: e.modelId || e.src,
|
|
34335
34349
|
dxfData: _
|
|
34336
|
-
})),
|
|
34350
|
+
})), j.printMemory("After adding second loaded Model to scene"), P.info("[DxfCompareHelper] Added compared objects to scene in " + (Date.now() - S) / 1e3 + "s"), P.info("[DxfCompareHelper] The comparison between " + n + "' and '" + a + "' is completed in " + (Date.now() - o) / 1e3 + "s !"), d(100), this.loadingProgressBar?.delayRemoveProgressItem(l);
|
|
34337
34351
|
} catch (l) {
|
|
34338
34352
|
throw this.loadingProgressBar?.removeProgressItem(n + a), l;
|
|
34339
34353
|
} finally {
|
|
@@ -34477,7 +34491,7 @@ class C0 extends tu {
|
|
|
34477
34491
|
total: 100
|
|
34478
34492
|
}));
|
|
34479
34493
|
}, b = (D) => m(D, 0, 15), y = (D) => m(D, 15, 30), S = (D) => m(D, 30, 60), w = (D) => m(D, 60, 95);
|
|
34480
|
-
|
|
34494
|
+
j.printMemory("Before comparing"), this.loadingProgressBar?.addProgressItem(d), f(0);
|
|
34481
34495
|
let x = Date.now();
|
|
34482
34496
|
const E = this.loader.parse(r, b), M = this.loader.parse(o, y), [O, T] = await Promise.allSettled([E, M]);
|
|
34483
34497
|
if (O.status === "rejected") throw "[DxfCompareHelper] Failed to parse " + r;
|
|
@@ -34487,7 +34501,7 @@ class C0 extends tu {
|
|
|
34487
34501
|
x = Date.now();
|
|
34488
34502
|
const _ = await new yt(v, C, s).compare(S);
|
|
34489
34503
|
if (P.info("[DxfCompareHelper] Compared in " + (Date.now() - x) / 1e3 + "s"), P.debug("Compared results:", _), this.loader.isAborted()) throw "[DxfCompareHelper] compare change aborted";
|
|
34490
|
-
|
|
34504
|
+
j.printMemory("After getting the comparison results"), x = Date.now(), await this.loader.loadEntitiesForCompare(v, C, _, !1, w), j.printMemory("After Creating threejs objects based on comparison result"), this.fontManager?.releaseFontData(), this.changes = _, P.info("[DxfCompareHelper] Creates threejs objects based on comparison result in " + (Date.now() - x) / 1e3 + "s");
|
|
34491
34505
|
const A = v, I = C;
|
|
34492
34506
|
if (!Object.keys(_).length && P.info("[DxfCompareHelper] No change found"), A.threejsObject?.children.length === 0 && I.threejsObject?.children.length === 0) {
|
|
34493
34507
|
const D = "[DxfCompareHelper] Nothing was loaded from " + r + " and " + o;
|
|
@@ -34497,10 +34511,10 @@ class C0 extends tu {
|
|
|
34497
34511
|
B.name = r, k.name = o, x = Date.now(), this.viewer.addModel(new ds({
|
|
34498
34512
|
modelId: e.modelId || e.src,
|
|
34499
34513
|
dxfData: A
|
|
34500
|
-
})),
|
|
34514
|
+
})), j.printMemory("After adding first loaded Model to scene"), f(95), this.viewer2.addModel(new ds({
|
|
34501
34515
|
modelId: i.modelId || i.src,
|
|
34502
34516
|
dxfData: I
|
|
34503
|
-
})),
|
|
34517
|
+
})), j.printMemory("After adding second loaded Model to scene"), this.drawCompareBoxes(), P.info("[DxfCompareHelper] Added compared objects to scene in " + (Date.now() - x) / 1e3 + "s"), P.info("[DxfCompareHelper] The comparison between " + r + "' and '" + o + "' is completed in " + (Date.now() - h) / 1e3 + "s !"), f(100), this.loadingProgressBar?.delayRemoveProgressItem(d);
|
|
34504
34518
|
} catch (d) {
|
|
34505
34519
|
throw this.loadingProgressBar?.removeProgressItem(r + o), d;
|
|
34506
34520
|
} finally {
|
|
@@ -35953,7 +35967,7 @@ class P0 {
|
|
|
35953
35967
|
if (!s || !n) return;
|
|
35954
35968
|
t = Array.isArray(t) ? new p.Vector3(t[0], t[1], t[2]) : t, e = Array.isArray(e) ? new p.Vector3(e[0], e[1], e[2]) : e;
|
|
35955
35969
|
const r = t, a = e;
|
|
35956
|
-
P.info("[Viewer] flyTo: ",
|
|
35970
|
+
P.info("[Viewer] flyTo: ", j.vectorToString(r)), n.setPosition(r.x, r.y, r.z), n.setTarget(a.x, a.y, a.z), this.isBrowserMode() || this.renderer?.render(this.scene, s), i && i();
|
|
35957
35971
|
}
|
|
35958
35972
|
goToHomeView() {
|
|
35959
35973
|
const t = new p.Sphere();
|
|
@@ -35977,7 +35991,7 @@ class P0 {
|
|
|
35977
35991
|
if (!this.scene || !t) return;
|
|
35978
35992
|
const e = this.bbox, i = t.near, s = t.far, n = e.max.x - e.min.x, r = e.max.y - e.min.y, a = e.max.z - e.min.z, o = Math.max(n, r, a), l = 5, h = o / l, d = o * l;
|
|
35979
35993
|
if (i > h || s < d) {
|
|
35980
|
-
const u = (f) =>
|
|
35994
|
+
const u = (f) => j.numberToString(f);
|
|
35981
35995
|
P.info("[Viewer] BBox's longest side is: " + u(o)), i > h && (P.warn(
|
|
35982
35996
|
"[Viewer] camera.near(" + u(i) + ") shouldn't bigger than " + u(h) + ", will change it!"
|
|
35983
35997
|
), t.near = h), s < d && (P.warn(
|
|
@@ -36074,7 +36088,7 @@ export {
|
|
|
36074
36088
|
i0 as CancelablePromise,
|
|
36075
36089
|
un as CanvasRender,
|
|
36076
36090
|
hs as ColorUtils,
|
|
36077
|
-
|
|
36091
|
+
j as CommonUtils,
|
|
36078
36092
|
Et as CompareDrawable,
|
|
36079
36093
|
Eo as Container,
|
|
36080
36094
|
xt as ControlsMode,
|