build-dxf 0.0.52 → 0.0.53
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 +167 -156
- package/package.json +45 -45
- package/src/build.js +857 -777
- package/src/index.css +1 -1
- package/src/index.js +10 -9
- package/src/index3.js +78 -79
- package/src/utils/DxfSystem/components/Dxf.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +0 -1
- package/src/utils/DxfSystem/utils/CAD.d.ts +17 -0
- package/src/utils/DxfSystem/utils/index.d.ts +1 -0
- package/src/utils/LineSegment.d.ts +5 -0
- package/src/utils/Polygon.d.ts +11 -1
package/src/build.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as I from "three";
|
|
2
|
-
import { EventDispatcher as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { OBJExporter as
|
|
2
|
+
import { EventDispatcher as Ae, Color as Pe, Matrix4 as Zt, Vector3 as ht, Quaternion as Ie, BufferAttribute as X, REVISION as ve, CompressedTexture as wt, Source as Re, NoColorSpace as Ce, MathUtils as bt, RGBAFormat as Be, ImageUtils as Ne, DoubleSide as je, PropertyBinding as dt, InterpolateDiscrete as Fe, Scene as Ot, SRGBColorSpace as Oe, NearestFilter as qe, NearestMipmapNearestFilter as Ge, NearestMipmapLinearFilter as ze, LinearFilter as Ue, LinearMipmapNearestFilter as ke, LinearMipmapLinearFilter as _e, ClampToEdgeWrapping as We, RepeatWrapping as Ye, MirroredRepeatWrapping as Xe, InterpolateLinear as Ve } from "three";
|
|
3
|
+
import et from "clipper-lib";
|
|
4
|
+
import lt from "dxf-writer";
|
|
5
|
+
import { OBJExporter as He } from "three/examples/jsm/exporters/OBJExporter.js";
|
|
6
6
|
function V() {
|
|
7
7
|
return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(u) {
|
|
8
8
|
var t = Math.random() * 16 | 0, e = u == "x" ? t : t & 3 | 8;
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class ot extends Ae {
|
|
13
13
|
uuid = V();
|
|
14
14
|
addEventListener(t, e, n) {
|
|
15
15
|
const { once: s = !1 } = n ?? {}, r = (o) => {
|
|
@@ -30,7 +30,7 @@ class it extends Te {
|
|
|
30
30
|
e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class z extends
|
|
33
|
+
class z extends ot {
|
|
34
34
|
parent;
|
|
35
35
|
destroyed = !1;
|
|
36
36
|
constructor(...t) {
|
|
@@ -48,7 +48,7 @@ class z extends it {
|
|
|
48
48
|
this.destroyed = !0;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class
|
|
51
|
+
class Qt extends ot {
|
|
52
52
|
static EventType = {
|
|
53
53
|
ADD_COMPONENT: "addComponent"
|
|
54
54
|
};
|
|
@@ -336,7 +336,7 @@ class v {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class te extends Array {
|
|
340
340
|
userDataList() {
|
|
341
341
|
return this.map((t) => t.userData);
|
|
342
342
|
}
|
|
@@ -478,7 +478,7 @@ class G {
|
|
|
478
478
|
* @param point
|
|
479
479
|
*/
|
|
480
480
|
queryPoint(t, e = !1) {
|
|
481
|
-
const n = new
|
|
481
|
+
const n = new te();
|
|
482
482
|
let s;
|
|
483
483
|
if (t.currentData[this.id])
|
|
484
484
|
s = t.currentData[this.id]?.set;
|
|
@@ -526,7 +526,7 @@ class G {
|
|
|
526
526
|
if (t.size === 1) return [...t][0];
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function k(u) {
|
|
530
530
|
if (!u || typeof u != "object")
|
|
531
531
|
return u;
|
|
532
532
|
const t = Array.isArray(u) ? [] : {}, e = Object.keys(u);
|
|
@@ -537,17 +537,17 @@ function _(u) {
|
|
|
537
537
|
continue;
|
|
538
538
|
}
|
|
539
539
|
if (Array.isArray(s)) {
|
|
540
|
-
t[n] = s.map((r) =>
|
|
540
|
+
t[n] = s.map((r) => k(r));
|
|
541
541
|
continue;
|
|
542
542
|
}
|
|
543
543
|
if (Object.getPrototypeOf(s) === Object.prototype) {
|
|
544
|
-
t[n] =
|
|
544
|
+
t[n] = k(s);
|
|
545
545
|
continue;
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
return t;
|
|
549
549
|
}
|
|
550
|
-
class
|
|
550
|
+
class st {
|
|
551
551
|
points;
|
|
552
552
|
get p0() {
|
|
553
553
|
return this.points[0];
|
|
@@ -698,7 +698,7 @@ class nt {
|
|
|
698
698
|
*/
|
|
699
699
|
static fromByLineSegment(t, e = 0.1, n = !1, s = 0.5) {
|
|
700
700
|
const r = t.points[0], i = t.points[1], o = i.normal(r), a = n ? i.direction(r).mutiplyScalar(e * s) : D.zero(), c = n ? r.direction(i).mutiplyScalar(e * s) : D.zero(), l = o.x * e * 0.5, h = o.y * e * 0.5;
|
|
701
|
-
return new
|
|
701
|
+
return new st([
|
|
702
702
|
new D(r.x + l, r.y + h).add(c),
|
|
703
703
|
new D(i.x + l, i.y + h).add(a),
|
|
704
704
|
new D(i.x - l, i.y - h).add(a),
|
|
@@ -706,7 +706,7 @@ class nt {
|
|
|
706
706
|
]);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
class
|
|
709
|
+
class B {
|
|
710
710
|
bounds;
|
|
711
711
|
// 包围盒
|
|
712
712
|
capacity;
|
|
@@ -732,7 +732,7 @@ class N {
|
|
|
732
732
|
* @param node 线段节点
|
|
733
733
|
*/
|
|
734
734
|
insert(t) {
|
|
735
|
-
if (t instanceof
|
|
735
|
+
if (t instanceof L) {
|
|
736
736
|
this.insert({ line: t, userData: {} });
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
@@ -757,7 +757,7 @@ class N {
|
|
|
757
757
|
* @param node
|
|
758
758
|
*/
|
|
759
759
|
remove(t) {
|
|
760
|
-
if (t instanceof
|
|
760
|
+
if (t instanceof L) {
|
|
761
761
|
t = t.currentData[this.id], t && this.remove(t);
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
@@ -792,25 +792,25 @@ class N {
|
|
|
792
792
|
if (!this.isLeaf) return;
|
|
793
793
|
this.isLeaf = !1, this.children = [];
|
|
794
794
|
const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
|
|
795
|
-
this.children[0] = new
|
|
795
|
+
this.children[0] = new B(
|
|
796
796
|
new v(this.bounds.minX, t, this.bounds.minY, e),
|
|
797
797
|
this.capacity,
|
|
798
798
|
this.maxDepth,
|
|
799
799
|
this.depth + 1,
|
|
800
800
|
this.id
|
|
801
|
-
), this.children[1] = new
|
|
801
|
+
), this.children[1] = new B(
|
|
802
802
|
new v(t, this.bounds.maxX, this.bounds.minY, e),
|
|
803
803
|
this.capacity,
|
|
804
804
|
this.maxDepth,
|
|
805
805
|
this.depth + 1,
|
|
806
806
|
this.id
|
|
807
|
-
), this.children[2] = new
|
|
807
|
+
), this.children[2] = new B(
|
|
808
808
|
new v(this.bounds.minX, t, e, this.bounds.maxY),
|
|
809
809
|
this.capacity,
|
|
810
810
|
this.maxDepth,
|
|
811
811
|
this.depth + 1,
|
|
812
812
|
this.id
|
|
813
|
-
), this.children[3] = new
|
|
813
|
+
), this.children[3] = new B(
|
|
814
814
|
new v(t, this.bounds.maxX, e, this.bounds.maxY),
|
|
815
815
|
this.capacity,
|
|
816
816
|
this.maxDepth,
|
|
@@ -922,7 +922,7 @@ class N {
|
|
|
922
922
|
})), t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
class
|
|
925
|
+
class nt extends Map {
|
|
926
926
|
get valueArray() {
|
|
927
927
|
return [...this.values()];
|
|
928
928
|
}
|
|
@@ -979,14 +979,14 @@ class et extends Map {
|
|
|
979
979
|
return this.reduce((t, e, n) => (t[`${n}`] = e, t), {});
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
class H extends
|
|
982
|
+
class H extends nt {
|
|
983
983
|
append(t, ...e) {
|
|
984
984
|
return e.forEach((n) => {
|
|
985
985
|
this.has(t) || this.set(t, []), this.get(t)?.push(n);
|
|
986
986
|
}), this;
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
|
-
class
|
|
989
|
+
class pt extends nt {
|
|
990
990
|
set(t) {
|
|
991
991
|
let e = super.get(t) ?? 0;
|
|
992
992
|
return super.set(t, ++e), this;
|
|
@@ -1019,13 +1019,13 @@ class Q {
|
|
|
1019
1019
|
return t;
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
|
-
const
|
|
1023
|
-
function
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}),
|
|
1022
|
+
const ut = /* @__PURE__ */ new Set();
|
|
1023
|
+
function $e(u) {
|
|
1024
|
+
ut.size === 0 && queueMicrotask(() => {
|
|
1025
|
+
ut.forEach((t) => t.cachedLength = null), ut.clear();
|
|
1026
|
+
}), ut.add(u);
|
|
1027
1027
|
}
|
|
1028
|
-
class
|
|
1028
|
+
class L {
|
|
1029
1029
|
points = [new D(), new D()];
|
|
1030
1030
|
userData = {};
|
|
1031
1031
|
currentData = {};
|
|
@@ -1156,7 +1156,7 @@ class E {
|
|
|
1156
1156
|
new D(n.x - a, n.y - c).add(o),
|
|
1157
1157
|
new D(s.x - a, s.y - c).add(i)
|
|
1158
1158
|
];
|
|
1159
|
-
return new
|
|
1159
|
+
return new st([0, 1, 3, 2].map((h) => l[h]));
|
|
1160
1160
|
}
|
|
1161
1161
|
/**
|
|
1162
1162
|
* 计算线段的长度
|
|
@@ -1184,7 +1184,7 @@ class E {
|
|
|
1184
1184
|
*/
|
|
1185
1185
|
cachedLength = null;
|
|
1186
1186
|
length(t = !1) {
|
|
1187
|
-
return t ? (this.cachedLength === null && (this.cachedLength = this.getLength(),
|
|
1187
|
+
return t ? (this.cachedLength === null && (this.cachedLength = this.getLength(), $e(this)), this.cachedLength) : this.getLength();
|
|
1188
1188
|
}
|
|
1189
1189
|
/**
|
|
1190
1190
|
* 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
|
|
@@ -1211,7 +1211,7 @@ class E {
|
|
|
1211
1211
|
const g = Math.max(0, Math.min(1, p)), y = s.x + g * i.x, m = s.y + g * i.y;
|
|
1212
1212
|
return new D(y, m);
|
|
1213
1213
|
};
|
|
1214
|
-
return (h < 0 || h > 1) && (a = f(h)), (d < 0 || d > 1) && (c = f(d)), a.x === c.x && a.y === c.y ? new
|
|
1214
|
+
return (h < 0 || h > 1) && (a = f(h)), (d < 0 || d > 1) && (c = f(d)), a.x === c.x && a.y === c.y ? new L(a, a) : new L(a, c);
|
|
1215
1215
|
}
|
|
1216
1216
|
/**
|
|
1217
1217
|
* 计算一条线段在另一条直线上的投影
|
|
@@ -1311,7 +1311,7 @@ class E {
|
|
|
1311
1311
|
* @param line
|
|
1312
1312
|
*/
|
|
1313
1313
|
parallel(t, e = 1) {
|
|
1314
|
-
return t instanceof
|
|
1314
|
+
return t instanceof L ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
|
|
1315
1315
|
}
|
|
1316
1316
|
/** 两条线段或角度是否 垂直
|
|
1317
1317
|
* @param line
|
|
@@ -1319,7 +1319,7 @@ class E {
|
|
|
1319
1319
|
* @returns
|
|
1320
1320
|
*/
|
|
1321
1321
|
vertical(t, e = 0.1) {
|
|
1322
|
-
return t instanceof
|
|
1322
|
+
return t instanceof L ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
|
|
1323
1323
|
}
|
|
1324
1324
|
/**
|
|
1325
1325
|
* 两条线段方向相反否一致
|
|
@@ -1410,11 +1410,11 @@ class E {
|
|
|
1410
1410
|
* @returns
|
|
1411
1411
|
*/
|
|
1412
1412
|
clone() {
|
|
1413
|
-
const t = new
|
|
1413
|
+
const t = new L(
|
|
1414
1414
|
this.points[0].clone(),
|
|
1415
1415
|
this.points[1].clone()
|
|
1416
1416
|
);
|
|
1417
|
-
return t.userData =
|
|
1417
|
+
return t.userData = k(this.userData), t;
|
|
1418
1418
|
}
|
|
1419
1419
|
/**
|
|
1420
1420
|
* 获取最长线段
|
|
@@ -1433,7 +1433,7 @@ class E {
|
|
|
1433
1433
|
* @param lines
|
|
1434
1434
|
*/
|
|
1435
1435
|
static groupBySamePointAndParallel(t) {
|
|
1436
|
-
const e = new G(), n = new
|
|
1436
|
+
const e = new G(), n = new B(v.fromByLineSegment(...t));
|
|
1437
1437
|
t.forEach((o) => {
|
|
1438
1438
|
o.points.forEach((a) => e.insert(a, o)), n.insert(o);
|
|
1439
1439
|
});
|
|
@@ -1496,6 +1496,39 @@ class E {
|
|
|
1496
1496
|
}
|
|
1497
1497
|
return r;
|
|
1498
1498
|
}
|
|
1499
|
+
/** 通过最大叶子路径,给线段分组,每条路径没有分叉
|
|
1500
|
+
* @param lines
|
|
1501
|
+
* @returns
|
|
1502
|
+
*/
|
|
1503
|
+
static groupByLeafPath(t) {
|
|
1504
|
+
const e = new G(), n = /* @__PURE__ */ new Set();
|
|
1505
|
+
t.forEach((i) => i.points.forEach((o) => e.insert(o, i)));
|
|
1506
|
+
function s(i, o, a = []) {
|
|
1507
|
+
const c = e.queryPoint(i, !0);
|
|
1508
|
+
if (c.length === 0)
|
|
1509
|
+
return a.length < o.size && (a.length = 0, a.push(...o)), a;
|
|
1510
|
+
for (let l = 0; l < c.length; l++) {
|
|
1511
|
+
const h = c[l].userData, d = h.getAnotherPoint(c[l].point);
|
|
1512
|
+
if (o.has(h) || n.has(h)) {
|
|
1513
|
+
a.length < o.size && (a.length = 0, a.push(...o));
|
|
1514
|
+
continue;
|
|
1515
|
+
}
|
|
1516
|
+
o.add(h), s(d, o, a), o.delete(h);
|
|
1517
|
+
}
|
|
1518
|
+
return a;
|
|
1519
|
+
}
|
|
1520
|
+
const r = [];
|
|
1521
|
+
for (let i = 0; i < t.length; i++) {
|
|
1522
|
+
const o = t[i];
|
|
1523
|
+
if (n.has(o)) continue;
|
|
1524
|
+
n.add(o);
|
|
1525
|
+
const a = s(o.start, /* @__PURE__ */ new Set([]));
|
|
1526
|
+
a.forEach((l) => n.add(l));
|
|
1527
|
+
const c = s(o.end, /* @__PURE__ */ new Set([]));
|
|
1528
|
+
c.forEach((l) => n.add(l)), r.push([...a.reverse(), o, ...c]);
|
|
1529
|
+
}
|
|
1530
|
+
return r;
|
|
1531
|
+
}
|
|
1499
1532
|
/** 分组,通过点
|
|
1500
1533
|
* @param lines
|
|
1501
1534
|
* @returns
|
|
@@ -1535,7 +1568,7 @@ class E {
|
|
|
1535
1568
|
const f = o(d);
|
|
1536
1569
|
f < a && (a = f, r = n.projectPoint(d, !1)), f > c && (c = f, i = n.projectPoint(d, !1));
|
|
1537
1570
|
}
|
|
1538
|
-
const l = new
|
|
1571
|
+
const l = new L(r, i);
|
|
1539
1572
|
return t.forEach((h) => h.userData.fittedLine = l), l;
|
|
1540
1573
|
}
|
|
1541
1574
|
/** 合并平行线段
|
|
@@ -1554,7 +1587,7 @@ class E {
|
|
|
1554
1587
|
const g = p.x * s.x + p.y * s.y;
|
|
1555
1588
|
r = Math.min(r, g), i = Math.max(i, g), o += p.x, a += p.y;
|
|
1556
1589
|
});
|
|
1557
|
-
const c = new D(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new D(c.x + (r - l) * s.x, c.y + (r - l) * s.y), d = new D(c.x + (i - l) * s.x, c.y + (i - l) * s.y), f = new
|
|
1590
|
+
const c = new D(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new D(c.x + (r - l) * s.x, c.y + (r - l) * s.y), d = new D(c.x + (i - l) * s.x, c.y + (i - l) * s.y), f = new L(h, d);
|
|
1558
1591
|
return t.forEach((p) => p.userData.fittedLine = f), f;
|
|
1559
1592
|
}
|
|
1560
1593
|
/** 合并满足平行的线段
|
|
@@ -1629,7 +1662,7 @@ class E {
|
|
|
1629
1662
|
* @returns
|
|
1630
1663
|
*/
|
|
1631
1664
|
static clipping(t, e, n) {
|
|
1632
|
-
if (!(t instanceof
|
|
1665
|
+
if (!(t instanceof L)) throw new Error("参数1并非线段");
|
|
1633
1666
|
e = e.map((i) => t.projectPoint(i)).filter((i) => !!i);
|
|
1634
1667
|
const s = t.clone();
|
|
1635
1668
|
e.sort((i, o) => s.start.distance(i) - s.start.distance(o));
|
|
@@ -1797,7 +1830,7 @@ class D {
|
|
|
1797
1830
|
* @param length
|
|
1798
1831
|
*/
|
|
1799
1832
|
expandAsLine(t, e, n) {
|
|
1800
|
-
const s = new
|
|
1833
|
+
const s = new L(
|
|
1801
1834
|
this.clone(),
|
|
1802
1835
|
this.clone().add(t.clone().multiplyScalar(e))
|
|
1803
1836
|
);
|
|
@@ -1917,24 +1950,24 @@ async function K(u, t = !0) {
|
|
|
1917
1950
|
return t && (e = e.default), e;
|
|
1918
1951
|
}
|
|
1919
1952
|
}
|
|
1920
|
-
function
|
|
1953
|
+
function ee(u, t = 0, e, n) {
|
|
1921
1954
|
const s = u.userData, r = s.drawWindow, i = e ? e.queryLineSegment(u).filter((a) => a.line !== u && !a.userData?.isDoor).map((a) => ({ index: n?.indexOf(a.line) })) : [];
|
|
1922
1955
|
return {
|
|
1923
|
-
...
|
|
1956
|
+
...k(s),
|
|
1924
1957
|
start: u.start.toJson(t),
|
|
1925
1958
|
end: u.end.toJson(t),
|
|
1926
1959
|
insetionArr: i,
|
|
1927
1960
|
length: u.length(),
|
|
1928
1961
|
drawWindow: r && r.map((a) => ({
|
|
1929
|
-
...
|
|
1962
|
+
...k(a),
|
|
1930
1963
|
p: { x: a.p.x, y: a.p.y, z: a.p.z }
|
|
1931
1964
|
}))
|
|
1932
1965
|
};
|
|
1933
1966
|
}
|
|
1934
|
-
function
|
|
1935
|
-
return e || (e = new
|
|
1967
|
+
function it(u, t = 0, e) {
|
|
1968
|
+
return e || (e = new B(v.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 })), Promise.resolve().then(() => e?.clear())), u.map((n) => ee(n, t, e, u));
|
|
1936
1969
|
}
|
|
1937
|
-
function
|
|
1970
|
+
function qt(u, t) {
|
|
1938
1971
|
if (t.userData.isWindow && (u.userData.isWindow = !0, u.userData.drawWindow = t.userData.drawWindow?.filter((e) => {
|
|
1939
1972
|
const n = D.from(e.p);
|
|
1940
1973
|
return !!u.projectPoint(n);
|
|
@@ -1945,8 +1978,8 @@ function Ot(u, t) {
|
|
|
1945
1978
|
});
|
|
1946
1979
|
}
|
|
1947
1980
|
}
|
|
1948
|
-
function
|
|
1949
|
-
const e = new
|
|
1981
|
+
function At(u, t = 0.03) {
|
|
1982
|
+
const e = new B(v.fromByLineSegment(...u));
|
|
1950
1983
|
u.forEach((s) => e.insert({ line: s, userData: void 0 }));
|
|
1951
1984
|
const n = u.flatMap((s) => {
|
|
1952
1985
|
const r = e.queryLineSegment(s, !0).map((i) => {
|
|
@@ -1960,15 +1993,15 @@ function bt(u, t = 0.03) {
|
|
|
1960
1993
|
r.sort((a, c) => i.start.distance(a) - i.start.distance(c));
|
|
1961
1994
|
const o = r.map((a) => {
|
|
1962
1995
|
const c = i.clone();
|
|
1963
|
-
return c.set(i.start.clone(), a), i.start.copy(a),
|
|
1996
|
+
return c.set(i.start.clone(), a), i.start.copy(a), qt(c, s), c;
|
|
1964
1997
|
});
|
|
1965
|
-
return
|
|
1998
|
+
return qt(i, s), [...o, i];
|
|
1966
1999
|
}
|
|
1967
2000
|
return s;
|
|
1968
2001
|
}).filter((s) => s.length() >= t);
|
|
1969
2002
|
return e.clear(), n;
|
|
1970
2003
|
}
|
|
1971
|
-
function
|
|
2004
|
+
function at(...u) {
|
|
1972
2005
|
u.forEach((t) => {
|
|
1973
2006
|
const e = t.direction();
|
|
1974
2007
|
t.userData.drawWindow?.forEach((n) => {
|
|
@@ -1983,7 +2016,7 @@ function ot(...u) {
|
|
|
1983
2016
|
), i = t.projectPoint(
|
|
1984
2017
|
s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
|
|
1985
2018
|
!1
|
|
1986
|
-
), o = t.projectLineSegment(new
|
|
2019
|
+
), o = t.projectLineSegment(new L(r, i)), a = o.center;
|
|
1987
2020
|
n.p = {
|
|
1988
2021
|
x: a?.x ?? 0,
|
|
1989
2022
|
y: a?.y ?? 0,
|
|
@@ -1995,7 +2028,7 @@ function ot(...u) {
|
|
|
1995
2028
|
}), t.userData.drawWindow = t.userData.drawWindow?.filter((n) => n.width > 1e-9);
|
|
1996
2029
|
});
|
|
1997
2030
|
}
|
|
1998
|
-
function
|
|
2031
|
+
function ne(...u) {
|
|
1999
2032
|
u.forEach((t) => {
|
|
2000
2033
|
t.userData.drawWindow?.forEach((e) => {
|
|
2001
2034
|
try {
|
|
@@ -2010,7 +2043,7 @@ function ee(...u) {
|
|
|
2010
2043
|
}), t.userData.drawWindow = t.userData.drawWindow?.filter((e) => e.width > 1e-9);
|
|
2011
2044
|
});
|
|
2012
2045
|
}
|
|
2013
|
-
function
|
|
2046
|
+
function se(...u) {
|
|
2014
2047
|
u.forEach((t) => {
|
|
2015
2048
|
if (!t.userData.drawWindow || t.userData.drawWindow.length < 2) return;
|
|
2016
2049
|
const e = t.center, n = t.userData.drawWindow.map((l) => {
|
|
@@ -2020,7 +2053,7 @@ function ne(...u) {
|
|
|
2020
2053
|
), f = t.projectPoint(
|
|
2021
2054
|
h.clone().add(e.clone().multiplyScalar(l.width * -0.5)),
|
|
2022
2055
|
!1
|
|
2023
|
-
), p = t.projectLineSegment(new
|
|
2056
|
+
), p = t.projectLineSegment(new L(d, f));
|
|
2024
2057
|
return p.currentData.wd = l, p;
|
|
2025
2058
|
}), s = n.flatMap((l) => {
|
|
2026
2059
|
const h = l.points.map((d) => (d.currentData.line = l, d.currentData.distance = d.distance(l.start), d));
|
|
@@ -2036,7 +2069,7 @@ function ne(...u) {
|
|
|
2036
2069
|
continue;
|
|
2037
2070
|
}
|
|
2038
2071
|
if (i--, i === 0) {
|
|
2039
|
-
const d = new
|
|
2072
|
+
const d = new L(o, h);
|
|
2040
2073
|
d.currentData.wds = [...a].map((f) => f.currentData.wd), r.push(d), o = null, a.clear();
|
|
2041
2074
|
}
|
|
2042
2075
|
}
|
|
@@ -2051,20 +2084,20 @@ function ne(...u) {
|
|
|
2051
2084
|
t.userData.drawWindow = c;
|
|
2052
2085
|
});
|
|
2053
2086
|
}
|
|
2054
|
-
function
|
|
2087
|
+
function _(u, t) {
|
|
2055
2088
|
if (Array.isArray(t))
|
|
2056
|
-
return t.forEach((s) =>
|
|
2089
|
+
return t.forEach((s) => _(u, s));
|
|
2057
2090
|
const { drawWindow: e, ...n } = t.userData;
|
|
2058
2091
|
Object.keys(n).forEach((s) => {
|
|
2059
2092
|
n[s] === void 0 && delete n[s];
|
|
2060
2093
|
}), e && (u.userData.drawWindow || (u.userData.drawWindow = []), u.userData.drawWindow.push(...e)), Object.assign(u.userData, n);
|
|
2061
2094
|
}
|
|
2062
|
-
function
|
|
2095
|
+
function Pt(u, t) {
|
|
2063
2096
|
const { drawWindow: e, ...n } = t.userData;
|
|
2064
2097
|
e && (u.userData.drawWindow || (u.userData.drawWindow = []), e.forEach((s) => {
|
|
2065
2098
|
const r = D.from(s.p);
|
|
2066
2099
|
u.projectPoint(r) && u.userData.drawWindow?.push(s);
|
|
2067
|
-
}),
|
|
2100
|
+
}), at(u)), Object.assign(u.userData, n);
|
|
2068
2101
|
}
|
|
2069
2102
|
class C {
|
|
2070
2103
|
/**
|
|
@@ -2168,7 +2201,7 @@ class C {
|
|
|
2168
2201
|
* @returns
|
|
2169
2202
|
*/
|
|
2170
2203
|
static getIntersectionTypes(t) {
|
|
2171
|
-
const e = new
|
|
2204
|
+
const e = new pt();
|
|
2172
2205
|
t.forEach((s) => {
|
|
2173
2206
|
s.userData.groups && s.userData.groups.forEach((r) => e.set(r.type)), s.userData.groupType && e.set(s.userData.groupType);
|
|
2174
2207
|
});
|
|
@@ -2228,7 +2261,7 @@ class C {
|
|
|
2228
2261
|
delete t.userData.groupId, delete t.userData.groupType, delete t.userData.groups;
|
|
2229
2262
|
}
|
|
2230
2263
|
}
|
|
2231
|
-
class
|
|
2264
|
+
class gt {
|
|
2232
2265
|
static errorAngle = 4;
|
|
2233
2266
|
/** 线段投影分析
|
|
2234
2267
|
* @param index
|
|
@@ -2260,9 +2293,9 @@ class pt {
|
|
|
2260
2293
|
}
|
|
2261
2294
|
static findDoubleLine(t, e = 0.4) {
|
|
2262
2295
|
const n = t.filter((o) => !o.userData.isDoor && !C.hasType(o, "doubleWall")), s = /* @__PURE__ */ new Set(), r = [];
|
|
2263
|
-
let i = new
|
|
2296
|
+
let i = new B(v.fromByLineSegment(...n));
|
|
2264
2297
|
return n.forEach((o, a) => i.insert({ line: o, userData: a })), n.forEach((o, a) => {
|
|
2265
|
-
const c =
|
|
2298
|
+
const c = st.fromByLineSegment(o, e * 2, !1, -0.01);
|
|
2266
2299
|
i.queryRect(c).map((h) => h.userData).filter((h) => h !== a).forEach((h) => {
|
|
2267
2300
|
try {
|
|
2268
2301
|
if (s.has(`${a}-${h}`) || s.has(`${h}-${a}`)) return;
|
|
@@ -2293,23 +2326,23 @@ class pt {
|
|
|
2293
2326
|
return n.forEach((c) => {
|
|
2294
2327
|
const l = c.project, h = c.project2, d = c.source, f = c.target;
|
|
2295
2328
|
l.includedAngle(h) > 135 && (h.points = [h.points[1], h.points[0]]);
|
|
2296
|
-
const p = new
|
|
2329
|
+
const p = new L(l.start.clone(), h.start.clone()), g = new L(l.end.clone(), h.end.clone());
|
|
2297
2330
|
o.push(p, g), a(d, l), a(f, h);
|
|
2298
2331
|
}), i.forEach((c, l) => {
|
|
2299
|
-
const h =
|
|
2332
|
+
const h = L.clipping(l, c, Pt);
|
|
2300
2333
|
t.push(...h);
|
|
2301
|
-
}), t = t.filter((c) => !r.has(c)), s.clear(), s = new
|
|
2334
|
+
}), t = t.filter((c) => !r.has(c)), s.clear(), s = new B(v.fromByLineSegment(...t)), t.forEach((c) => c.userData.isDoor || s.insert(c)), o = L.autoMergeLines(o).lines, o = o.filter((c) => c.length() !== 0).map((c) => {
|
|
2302
2335
|
const l = s.queryLineSegment(c).filter((d) => !(!d.line.parallel(c) || d.line.projectLineSegment(c).length() === 0)).map((d) => d.line);
|
|
2303
2336
|
if (l.length === 0)
|
|
2304
2337
|
return s.insert(c), c;
|
|
2305
|
-
const h =
|
|
2338
|
+
const h = L.mergeLines(...l, c);
|
|
2306
2339
|
return l.forEach((d) => {
|
|
2307
|
-
|
|
2340
|
+
_(h, d), s.remove(d), r.add(d);
|
|
2308
2341
|
}), s.insert(h), h;
|
|
2309
|
-
}), o = o.filter((c) => !r.has(c)), t = t.filter((c) => !r.has(c)), t.push(...o), t =
|
|
2342
|
+
}), o = o.filter((c) => !r.has(c)), t = t.filter((c) => !r.has(c)), t.push(...o), t = At(t, 1e-9), s.clear(), t;
|
|
2310
2343
|
}
|
|
2311
2344
|
}
|
|
2312
|
-
class
|
|
2345
|
+
class yt {
|
|
2313
2346
|
index = 0;
|
|
2314
2347
|
get size() {
|
|
2315
2348
|
return this.index;
|
|
@@ -2345,22 +2378,22 @@ function $(u) {
|
|
|
2345
2378
|
t.insert(e.start, e), t.insert(e.end, e);
|
|
2346
2379
|
return t;
|
|
2347
2380
|
}
|
|
2348
|
-
function
|
|
2349
|
-
const t = new
|
|
2381
|
+
function It(u) {
|
|
2382
|
+
const t = new B(v.fromByLineSegment(...u));
|
|
2350
2383
|
for (const e of u)
|
|
2351
2384
|
t.insert(e);
|
|
2352
2385
|
return t;
|
|
2353
2386
|
}
|
|
2354
|
-
const
|
|
2387
|
+
const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2355
2388
|
__proto__: null,
|
|
2356
2389
|
createPointVirtualGrid: $,
|
|
2357
|
-
createQuadtree:
|
|
2390
|
+
createQuadtree: It
|
|
2358
2391
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2359
|
-
function
|
|
2392
|
+
function Ke(u, t, e, n = !0) {
|
|
2360
2393
|
e = e ?? /* @__PURE__ */ new Set();
|
|
2361
2394
|
const s = !!t, r = t || $(u);
|
|
2362
2395
|
function i(o) {
|
|
2363
|
-
if (!(o instanceof
|
|
2396
|
+
if (!(o instanceof L) || e?.has(o)) return;
|
|
2364
2397
|
const a = r?.queryPoint(o.start, !0), c = r?.queryPoint(o.end, !0);
|
|
2365
2398
|
a && c && (a?.length === 0 || c?.length === 0) && (e?.add(o), r.remove(o.start), r.remove(o.end), n && (a.forEach(({ userData: l }) => i(l)), c.forEach(({ userData: l }) => i(l))));
|
|
2366
2399
|
}
|
|
@@ -2370,9 +2403,9 @@ function Je(u, t, e, n = !0) {
|
|
|
2370
2403
|
}
|
|
2371
2404
|
return s || r.clear(), e;
|
|
2372
2405
|
}
|
|
2373
|
-
function
|
|
2406
|
+
function vt(u, t, e = !1) {
|
|
2374
2407
|
t = t || /* @__PURE__ */ new Set();
|
|
2375
|
-
const n = new
|
|
2408
|
+
const n = new nt();
|
|
2376
2409
|
for (u.forEach((s) => {
|
|
2377
2410
|
t.size && t.has(s) || s.points.forEach((r) => {
|
|
2378
2411
|
const i = r.hashCode();
|
|
@@ -2391,8 +2424,8 @@ function Pt(u, t, e = !1) {
|
|
|
2391
2424
|
}
|
|
2392
2425
|
return t;
|
|
2393
2426
|
}
|
|
2394
|
-
function
|
|
2395
|
-
const t = new
|
|
2427
|
+
function re(u) {
|
|
2428
|
+
const t = new nt(), e = new nt();
|
|
2396
2429
|
u.forEach((n) => {
|
|
2397
2430
|
n.points.forEach((s, r) => {
|
|
2398
2431
|
const i = s.hashCode();
|
|
@@ -2406,7 +2439,7 @@ function se(u) {
|
|
|
2406
2439
|
}
|
|
2407
2440
|
return t;
|
|
2408
2441
|
}
|
|
2409
|
-
class
|
|
2442
|
+
class ie {
|
|
2410
2443
|
adjacencyList;
|
|
2411
2444
|
get size() {
|
|
2412
2445
|
return this.adjacencyList.size;
|
|
@@ -2448,7 +2481,8 @@ class re {
|
|
|
2448
2481
|
* @returns
|
|
2449
2482
|
*/
|
|
2450
2483
|
getPaths() {
|
|
2451
|
-
|
|
2484
|
+
let t = [];
|
|
2485
|
+
const e = /* @__PURE__ */ new Set(), n = (s, r) => {
|
|
2452
2486
|
r.push(s), e.add(s);
|
|
2453
2487
|
let i = !1;
|
|
2454
2488
|
const o = this.getNeighbors(s);
|
|
@@ -2469,7 +2503,7 @@ class re {
|
|
|
2469
2503
|
t(e, n);
|
|
2470
2504
|
}
|
|
2471
2505
|
}
|
|
2472
|
-
class
|
|
2506
|
+
class mt extends ie {
|
|
2473
2507
|
// 线段存储:使用规范化 key (小索引-大索引) 避免双向存储
|
|
2474
2508
|
lineMap = /* @__PURE__ */ new Map();
|
|
2475
2509
|
// 点坐标映射
|
|
@@ -2560,7 +2594,8 @@ class yt extends re {
|
|
|
2560
2594
|
return t.map((i) => (i.start.rotate(r, e * (Math.PI / 180)), i.end.rotate(r, e * (Math.PI / 180)), n && n(i, r, e), i));
|
|
2561
2595
|
}
|
|
2562
2596
|
}
|
|
2563
|
-
|
|
2597
|
+
let Mt = !1;
|
|
2598
|
+
class ct extends Array {
|
|
2564
2599
|
constructor(t = []) {
|
|
2565
2600
|
super(...t);
|
|
2566
2601
|
}
|
|
@@ -2614,56 +2649,82 @@ class at extends Array {
|
|
|
2614
2649
|
pointWithin(t) {
|
|
2615
2650
|
return this.pointPosition(t) !== "inside";
|
|
2616
2651
|
}
|
|
2617
|
-
/**
|
|
2652
|
+
/** 转为线段
|
|
2653
|
+
* @param closed
|
|
2654
|
+
* @returns
|
|
2655
|
+
*/
|
|
2656
|
+
toLines(t = !0) {
|
|
2657
|
+
const e = [];
|
|
2658
|
+
for (let n = 0; n < this.length && !(!t && n === this.length - 1); n++) {
|
|
2659
|
+
const s = this[n], r = this[(n + 1) % this.length];
|
|
2660
|
+
e.push(new L(s, r));
|
|
2661
|
+
}
|
|
2662
|
+
return e;
|
|
2663
|
+
}
|
|
2664
|
+
/** 通过线段创建, 默认路径只有一条
|
|
2618
2665
|
* @param lines
|
|
2619
2666
|
* @returns
|
|
2620
2667
|
*/
|
|
2621
2668
|
static fromByLines(t) {
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2669
|
+
Mt || (t = L.groupByLeafPath(t).sort((i, o) => o.length - i.length)[0]);
|
|
2670
|
+
const e = new G(), n = /* @__PURE__ */ new Set();
|
|
2671
|
+
t.forEach((i) => i.points.forEach((o) => e.insert(o, i))), e.queryPoint(t[0].start, !0).length, e.queryPoint(t[0].end, !0).length;
|
|
2672
|
+
const s = t[0].start;
|
|
2673
|
+
for (let i = 0; i < t.length; i++)
|
|
2674
|
+
t[i];
|
|
2675
|
+
let r = s;
|
|
2676
|
+
for (n.add(t[0].end), n.add(r); ; ) {
|
|
2626
2677
|
const i = e.queryPoint(r, !0);
|
|
2627
2678
|
if (i.length !== 1) break;
|
|
2628
2679
|
const { point: o, userData: a } = i[0];
|
|
2629
|
-
if (r = a?.getAnotherPoint(o),
|
|
2630
|
-
|
|
2680
|
+
if (r = a?.getAnotherPoint(o), n.has(r)) break;
|
|
2681
|
+
n.add(r);
|
|
2631
2682
|
}
|
|
2632
|
-
return
|
|
2683
|
+
return n.add(s.clone()), new ct([...n].map((i) => i.clone()));
|
|
2684
|
+
}
|
|
2685
|
+
/** 通过线段创建,返回所有路径
|
|
2686
|
+
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
2687
|
+
* @param lines
|
|
2688
|
+
*/
|
|
2689
|
+
static multipleFromByLines(t) {
|
|
2690
|
+
const e = L.groupByLeafPath(t);
|
|
2691
|
+
Mt = !0;
|
|
2692
|
+
const n = e.map((s) => this.fromByLines(s));
|
|
2693
|
+
return Mt = !0, n;
|
|
2633
2694
|
}
|
|
2634
2695
|
}
|
|
2635
|
-
const
|
|
2636
|
-
function
|
|
2637
|
-
const n = $(u), s = new
|
|
2696
|
+
const Ze = Math.PI / 180;
|
|
2697
|
+
function Rt(u, t, e = !1) {
|
|
2698
|
+
const n = $(u), s = new L(), r = new L(), i = [], o = /* @__PURE__ */ new Set(), a = new L(), c = new L();
|
|
2638
2699
|
function l(f, p, g) {
|
|
2639
2700
|
if (f.vertical(g)) {
|
|
2640
|
-
const
|
|
2641
|
-
return g.clone().directionMove(b,
|
|
2701
|
+
const E = f.center, b = f.center.direction(g.start);
|
|
2702
|
+
return g.clone().directionMove(b, E.distance(g.start));
|
|
2642
2703
|
}
|
|
2643
2704
|
const y = f.center, m = f.normal(), x = f.getAnotherPoint(p), M = x.direction(p);
|
|
2644
2705
|
s.start.copy(y), s.end.copy(y).add(m.clone().multiplyScalar(1));
|
|
2645
2706
|
const w = g.getIntersection(s);
|
|
2646
|
-
return s.end.copy(w), g.direction().angleBetween(M) >
|
|
2707
|
+
return s.end.copy(w), g.direction().angleBetween(M) > Ze * 170 && s.mirror(), s.clone();
|
|
2647
2708
|
}
|
|
2648
2709
|
function h(f, p, g, y, m, x = !0) {
|
|
2649
2710
|
if (m.length > u.length || o.has(p)) return;
|
|
2650
2711
|
o.add(p);
|
|
2651
2712
|
let M = x ? l(p, g, y) : y;
|
|
2652
2713
|
const w = p.getAnotherPoint(g);
|
|
2653
|
-
let
|
|
2654
|
-
if (
|
|
2655
|
-
const b =
|
|
2714
|
+
let E = n.queryPoint(w, !0);
|
|
2715
|
+
if (E.length === 1) {
|
|
2716
|
+
const b = E[0], S = b.userData;
|
|
2656
2717
|
if (f === S || (m.push(S), h(f, S, b.point, M, m))) return m;
|
|
2657
2718
|
} else {
|
|
2658
2719
|
r.start.copy(M.start).add(M.direction().multiplyScalar(5e-4));
|
|
2659
|
-
const b = [p, ...
|
|
2720
|
+
const b = [p, ...E.map((S) => {
|
|
2660
2721
|
const T = S.userData;
|
|
2661
2722
|
return T.length(), T;
|
|
2662
2723
|
})];
|
|
2663
|
-
for (let S = 0; S <
|
|
2664
|
-
const T =
|
|
2724
|
+
for (let S = 0; S < E.length; S++) {
|
|
2725
|
+
const T = E[S], A = T.userData;
|
|
2665
2726
|
if (f === A) return m;
|
|
2666
|
-
if (!(
|
|
2727
|
+
if (!(E.length === 4 && A.parallel(p)) && (r.end.copy(A.center), !b.some((R) => R === A ? !1 : R.intersectLineSegment(r))))
|
|
2667
2728
|
return m.push(A), h(f, A, T.point, M, m);
|
|
2668
2729
|
}
|
|
2669
2730
|
}
|
|
@@ -2675,13 +2736,13 @@ function It(u, t, e = !1) {
|
|
|
2675
2736
|
];
|
|
2676
2737
|
for (let x = 0; x < 2; x++) {
|
|
2677
2738
|
o.clear();
|
|
2678
|
-
const M = m[x], w = M.direction(),
|
|
2679
|
-
if (h(f, f, f.start, M,
|
|
2739
|
+
const M = m[x], w = M.direction(), E = [f];
|
|
2740
|
+
if (h(f, f, f.start, M, E, !1)) {
|
|
2680
2741
|
const b = g.clone().add(w.multiplyScalar(5e-4));
|
|
2681
|
-
if (
|
|
2742
|
+
if (E.length > 5 && !ct.fromByLines(E).pointIn(b))
|
|
2682
2743
|
continue;
|
|
2683
|
-
p.push(
|
|
2684
|
-
} else e && p.push(
|
|
2744
|
+
p.push(E);
|
|
2745
|
+
} else e && p.push(E);
|
|
2685
2746
|
}
|
|
2686
2747
|
return p;
|
|
2687
2748
|
}
|
|
@@ -2691,11 +2752,11 @@ function It(u, t, e = !1) {
|
|
|
2691
2752
|
}
|
|
2692
2753
|
return i.filter((f) => f.length);
|
|
2693
2754
|
}
|
|
2694
|
-
function
|
|
2755
|
+
function oe(u) {
|
|
2695
2756
|
const t = new H(), e = [];
|
|
2696
2757
|
u.forEach((n) => t.append(n.length, n));
|
|
2697
2758
|
for (const n of t.values()) {
|
|
2698
|
-
const s = new
|
|
2759
|
+
const s = new yt(n.flat()), r = new H();
|
|
2699
2760
|
n.map((i) => {
|
|
2700
2761
|
const o = i.map((a) => s.getIndex(a)).sort((a, c) => a - c).join(",");
|
|
2701
2762
|
r.append(o, i);
|
|
@@ -2703,7 +2764,7 @@ function ie(u) {
|
|
|
2703
2764
|
}
|
|
2704
2765
|
return e;
|
|
2705
2766
|
}
|
|
2706
|
-
function
|
|
2767
|
+
function ae(u, t = !1) {
|
|
2707
2768
|
const e = /* @__PURE__ */ new Map(), n = new Q(u.length), s = [];
|
|
2708
2769
|
u.forEach((o, a) => {
|
|
2709
2770
|
for (let c = 0; c < o.length; c++) {
|
|
@@ -2711,17 +2772,17 @@ function oe(u, t = !1) {
|
|
|
2711
2772
|
e.has(l) ? n.union(a, e.get(l)) : e.set(l, a);
|
|
2712
2773
|
}
|
|
2713
2774
|
});
|
|
2714
|
-
const r = new
|
|
2775
|
+
const r = new pt(), i = n.getAllSets().valueArray.map((o) => {
|
|
2715
2776
|
let a = o.map((l) => u[l]);
|
|
2716
|
-
return a.length === 1 ? a[0] : (r.clear(), a =
|
|
2777
|
+
return a.length === 1 ? a[0] : (r.clear(), a = oe(a), a.forEach((l) => l.forEach((h) => r.set(h))), t && (r.forEach((l, h) => drawText(l, h.center)), drawLines(u.flat(), { color: randomColor() })), r.reduce((l, h, d) => (h === 1 ? l.push(d) : s.push(d), l), []));
|
|
2717
2778
|
});
|
|
2718
2779
|
return {
|
|
2719
2780
|
internalEdges: s,
|
|
2720
2781
|
rings: i
|
|
2721
2782
|
};
|
|
2722
2783
|
}
|
|
2723
|
-
function
|
|
2724
|
-
const t = new
|
|
2784
|
+
function ce(u) {
|
|
2785
|
+
const t = new mt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
2725
2786
|
function r(i) {
|
|
2726
2787
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
2727
2788
|
if (!n.has(a))
|
|
@@ -2736,14 +2797,14 @@ function ae(u) {
|
|
|
2736
2797
|
n.has(i) || r(i);
|
|
2737
2798
|
}), s;
|
|
2738
2799
|
}
|
|
2739
|
-
function
|
|
2740
|
-
let t =
|
|
2800
|
+
function le(u) {
|
|
2801
|
+
let t = vt(u, /* @__PURE__ */ new Set(), !0);
|
|
2741
2802
|
u = u.filter((o) => !t.has(o));
|
|
2742
|
-
const e =
|
|
2803
|
+
const e = L.groupByPath(u), n = [], s = [];
|
|
2743
2804
|
e.forEach((o, a) => {
|
|
2744
2805
|
try {
|
|
2745
|
-
let c =
|
|
2746
|
-
const l =
|
|
2806
|
+
let c = ce(o);
|
|
2807
|
+
const l = ae(Rt(o, c));
|
|
2747
2808
|
n.push(...l.rings), s.push(...l.internalEdges);
|
|
2748
2809
|
} catch (c) {
|
|
2749
2810
|
console.warn("环查找出现异常:", c);
|
|
@@ -2759,7 +2820,7 @@ function ce(u) {
|
|
|
2759
2820
|
function Z(u, t = [], e = !0, n = !1) {
|
|
2760
2821
|
const s = [];
|
|
2761
2822
|
u = u.filter((a) => a.userData.isBayWindow || a.userData.isWindow && C.hasType(a, "bayWindow") ? (s.push(a), !1) : !0);
|
|
2762
|
-
let { newLines: r, rings: i } =
|
|
2823
|
+
let { newLines: r, rings: i } = le(u), o = new Set(i.flat());
|
|
2763
2824
|
if (e) {
|
|
2764
2825
|
const a = new G(), c = /* @__PURE__ */ new Set();
|
|
2765
2826
|
r.forEach((d) => !o.has(d) && a.insert(d.center, d)), t.forEach((d) => a.insert(d.center, d));
|
|
@@ -2771,19 +2832,19 @@ function Z(u, t = [], e = !0, n = !1) {
|
|
|
2771
2832
|
const f = V();
|
|
2772
2833
|
d.forEach((p) => {
|
|
2773
2834
|
C.replace(p, f, "doubleWall") || C.set(p, f, "doubleWall"), C.removeByType(p, "wall");
|
|
2774
|
-
}), n && a.queryPolygon(
|
|
2835
|
+
}), n && a.queryPolygon(ct.fromByLines(d)).forEach((p) => c.add(p.userData));
|
|
2775
2836
|
}), r.forEach((d) => {
|
|
2776
2837
|
o.has(d) || C.hasType(d, "bayWindow") || (C.set(d, "default", "wall"), C.removeByType(d, "doubleWall"));
|
|
2777
2838
|
}), r = r.filter((d) => !c.has(d));
|
|
2778
2839
|
const h = t.filter((d) => !c.has(d));
|
|
2779
2840
|
t.length = 0, t.push(...h);
|
|
2780
2841
|
}
|
|
2781
|
-
return r.push(...s),
|
|
2842
|
+
return r.push(...s), L.brokenLineMerging(r, _);
|
|
2782
2843
|
}
|
|
2783
|
-
function
|
|
2844
|
+
function Tt(u, t = !0) {
|
|
2784
2845
|
const e = u.filter((s) => s.userData.isBayWindow), n = /* @__PURE__ */ new Set();
|
|
2785
2846
|
return e.forEach((s) => {
|
|
2786
|
-
let r =
|
|
2847
|
+
let r = Rt(u, [s], !1);
|
|
2787
2848
|
if (r = r.filter((i) => i.some((o) => o.userData.isWindow && C.hasType(o, "bayWindow"))), r.length) {
|
|
2788
2849
|
const i = r[0], o = V();
|
|
2789
2850
|
i.forEach((a) => {
|
|
@@ -2792,7 +2853,7 @@ function St(u, t = !0) {
|
|
|
2792
2853
|
} else t && C.clear(s);
|
|
2793
2854
|
}), t && u.forEach((s) => n.has(s) || C.clear(s)), u;
|
|
2794
2855
|
}
|
|
2795
|
-
function
|
|
2856
|
+
function Qe(u, t = 0.1, e) {
|
|
2796
2857
|
e || (e = new G(), u.forEach((r) => {
|
|
2797
2858
|
r.userData.isDoor || r.points.forEach((i) => e?.insert(i, r));
|
|
2798
2859
|
}));
|
|
@@ -2818,22 +2879,22 @@ function Ze(u, t = 0.1, e) {
|
|
|
2818
2879
|
if (c.length === 0) return;
|
|
2819
2880
|
s.add(a), s.add(c[0].point);
|
|
2820
2881
|
const l = c[0].userData, h = i.projectLineSegment(l), d = l.projectLineSegment(i), f = h.length(), p = d.length();
|
|
2821
|
-
f === 0 && p === 0 ? n.push(new
|
|
2882
|
+
f === 0 && p === 0 ? n.push(new L(a.clone(), c[0].point.clone())) : n.push(new L(h.center, d.center));
|
|
2822
2883
|
});
|
|
2823
2884
|
}
|
|
2824
2885
|
return [...u, ...n];
|
|
2825
2886
|
}
|
|
2826
|
-
function
|
|
2827
|
-
const t = new G(), e = new
|
|
2887
|
+
function tn(u) {
|
|
2888
|
+
const t = new G(), e = new B(v.fromByLineSegment(...u)), n = [];
|
|
2828
2889
|
return u.forEach((s) => {
|
|
2829
2890
|
s.userData.isDoor ? n.push(s) : (s.points.forEach((r) => t.insert(r, s)), e.insert(s));
|
|
2830
2891
|
}), n.forEach((s) => {
|
|
2831
2892
|
const r = t.queryPoint(s.start), i = t.queryPoint(s.end);
|
|
2832
2893
|
r.length ? s.userData.startIntersection = r[0].userData : s.userData.startIntersection = e.queryPoint(s.start)[0]?.line, i.length ? s.userData.endIntersection = i[0].userData : s.userData.endIntersection = e.queryPoint(s.end)[0]?.line;
|
|
2833
|
-
}), u =
|
|
2894
|
+
}), u = Qe(u, 0.4, t), t.clear(), e.clear(), u;
|
|
2834
2895
|
}
|
|
2835
|
-
function
|
|
2836
|
-
const t = new
|
|
2896
|
+
function en(u) {
|
|
2897
|
+
const t = new B(v.fromByLineSegment(...u));
|
|
2837
2898
|
u.forEach((n) => {
|
|
2838
2899
|
n.userData.isDoor || t.insert({ line: n, userData: void 0 });
|
|
2839
2900
|
});
|
|
@@ -2852,7 +2913,7 @@ function tn(u) {
|
|
|
2852
2913
|
}
|
|
2853
2914
|
return t.clear(), e;
|
|
2854
2915
|
}
|
|
2855
|
-
function
|
|
2916
|
+
function nn(u, t, e, n = 15) {
|
|
2856
2917
|
const s = [u], r = [], i = [], o = [];
|
|
2857
2918
|
function a(d) {
|
|
2858
2919
|
if (d.userData.isDoor) return i.push(d);
|
|
@@ -2904,7 +2965,7 @@ function en(u, t, e, n = 15) {
|
|
|
2904
2965
|
}
|
|
2905
2966
|
return h.forEach((d) => d()), { parallelLines: s, verticalLines: r, doorLines: i, windowLines: o };
|
|
2906
2967
|
}
|
|
2907
|
-
function
|
|
2968
|
+
function Gt(u, t, e, n, s) {
|
|
2908
2969
|
const r = [], i = /* @__PURE__ */ new Map();
|
|
2909
2970
|
u.forEach((c) => {
|
|
2910
2971
|
const l = e.projectPoint(c.start, !1);
|
|
@@ -2937,7 +2998,7 @@ function qt(u, t, e, n, s) {
|
|
|
2937
2998
|
}), f.push([...d]), f;
|
|
2938
2999
|
});
|
|
2939
3000
|
}
|
|
2940
|
-
function
|
|
3001
|
+
function zt(u, t, e, n) {
|
|
2941
3002
|
const s = /* @__PURE__ */ new Map(), r = [], i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
2942
3003
|
u.forEach((f) => {
|
|
2943
3004
|
const p = e.projectValue(f.start), g = e.projectPoint(f.start, !1), y = { value: p, line: f, point: g, index: -1 };
|
|
@@ -2946,7 +3007,7 @@ function Gt(u, t, e, n) {
|
|
|
2946
3007
|
x === 0 ? i.set(f, M) : o.set(f, M);
|
|
2947
3008
|
});
|
|
2948
3009
|
}), r.sort((f, p) => p.value - f.value).forEach((f, p) => f.index = p);
|
|
2949
|
-
const a = new Q(u.length), c = new
|
|
3010
|
+
const a = new Q(u.length), c = new yt(u);
|
|
2950
3011
|
function l(f, p) {
|
|
2951
3012
|
return f.point.distance(p.point) <= n;
|
|
2952
3013
|
}
|
|
@@ -2957,10 +3018,10 @@ function Gt(u, t, e, n) {
|
|
|
2957
3018
|
for (let f = 0; f < r.length; f++) {
|
|
2958
3019
|
const p = r[f], { line: g } = p, y = i.get(g), m = o.get(g), x = y < m ? y : m, M = y > m ? y : m;
|
|
2959
3020
|
for (let w = f - 1; w >= 0; w--) {
|
|
2960
|
-
const
|
|
2961
|
-
if (l(
|
|
2962
|
-
if (h(
|
|
2963
|
-
a.union(c.getIndex(g), c.getIndex(
|
|
3021
|
+
const E = r[w];
|
|
3022
|
+
if (l(E, p)) {
|
|
3023
|
+
if (h(E, x, M)) {
|
|
3024
|
+
a.union(c.getIndex(g), c.getIndex(E.line));
|
|
2964
3025
|
break;
|
|
2965
3026
|
}
|
|
2966
3027
|
} else break;
|
|
@@ -2971,14 +3032,14 @@ function Gt(u, t, e, n) {
|
|
|
2971
3032
|
if (f.length <= 2) return [f];
|
|
2972
3033
|
const p = f.map((A) => s.get(A)).sort((A, R) => A.value - R.value), g = p[0], y = p[p.length - 1];
|
|
2973
3034
|
if (g.point.distance(y.point) < n) return [f];
|
|
2974
|
-
const m = [...p].sort((A, R) => R.line.length() - A.line.length()), x = m[0], M = m[0], w = x.line.length(),
|
|
2975
|
-
if (x.point.distance(M.point) > n ||
|
|
3035
|
+
const m = [...p].sort((A, R) => R.line.length() - A.line.length()), x = m[0], M = m[0], w = x.line.length(), E = M.line.length(), b = x.line.projectLineSegment(M.line), S = b.length();
|
|
3036
|
+
if (x.point.distance(M.point) > n || E / w > 0.5 && S / E < 0.5) {
|
|
2976
3037
|
const A = [x.line], R = [M.line];
|
|
2977
3038
|
for (let j = 0; j < p.length; j++) {
|
|
2978
3039
|
const F = p[j];
|
|
2979
3040
|
if (F === x || F === M) continue;
|
|
2980
3041
|
const W = M.line.projectLineSegment(F.line), q = W.length();
|
|
2981
|
-
M.point.distance(F.point) <= n && q /
|
|
3042
|
+
M.point.distance(F.point) <= n && q / E > 0 ? R.push(F.line) : A.push(F.line);
|
|
2982
3043
|
}
|
|
2983
3044
|
return [A, R];
|
|
2984
3045
|
}
|
|
@@ -2990,7 +3051,7 @@ function Gt(u, t, e, n) {
|
|
|
2990
3051
|
return [p.slice(0, T).map((A) => A.line), p.slice(T).map((A) => A.line)];
|
|
2991
3052
|
}).flat(1), d;
|
|
2992
3053
|
}
|
|
2993
|
-
function
|
|
3054
|
+
function Ut(u, t) {
|
|
2994
3055
|
function e(r, i = /* @__PURE__ */ new Set()) {
|
|
2995
3056
|
if (i.has(r)) return i;
|
|
2996
3057
|
i.add(r);
|
|
@@ -3011,28 +3072,28 @@ function zt(u, t) {
|
|
|
3011
3072
|
}
|
|
3012
3073
|
return s;
|
|
3013
3074
|
}
|
|
3014
|
-
function
|
|
3075
|
+
function sn(u, t, e, n, s, r) {
|
|
3015
3076
|
const {
|
|
3016
3077
|
principalAxisThreshold: i = 0.3,
|
|
3017
3078
|
crossAxistThreshold: o = 0.08,
|
|
3018
3079
|
groupMethod: a = "principalAndCross"
|
|
3019
3080
|
} = r ?? {}, c = {
|
|
3020
3081
|
cross: () => [
|
|
3021
|
-
...
|
|
3022
|
-
...
|
|
3082
|
+
...zt(u, n, e, o),
|
|
3083
|
+
...zt(t, e, n, o)
|
|
3023
3084
|
],
|
|
3024
3085
|
principalAndCross: () => [
|
|
3025
|
-
...
|
|
3026
|
-
...
|
|
3086
|
+
...Gt(u, n, e, i, o),
|
|
3087
|
+
...Gt(t, e, n, i, o)
|
|
3027
3088
|
],
|
|
3028
3089
|
originalInterPoint: () => [
|
|
3029
|
-
...
|
|
3030
|
-
...
|
|
3090
|
+
...Ut(u, s),
|
|
3091
|
+
...Ut(t, s)
|
|
3031
3092
|
]
|
|
3032
3093
|
};
|
|
3033
3094
|
return c[a] ? c[a]() : c.originalInterPoint();
|
|
3034
3095
|
}
|
|
3035
|
-
function
|
|
3096
|
+
function rn(u, t) {
|
|
3036
3097
|
const e = /* @__PURE__ */ new Set();
|
|
3037
3098
|
return u.forEach((n) => {
|
|
3038
3099
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -3048,19 +3109,19 @@ function sn(u, t) {
|
|
|
3048
3109
|
}
|
|
3049
3110
|
}), u.map((n) => n.filter((s) => !e.has(s)));
|
|
3050
3111
|
}
|
|
3051
|
-
function
|
|
3112
|
+
function on(u, t = 0.1, e) {
|
|
3052
3113
|
const { fittingMethod: n = "average" } = e ?? {};
|
|
3053
3114
|
return u.map((s) => {
|
|
3054
3115
|
if (s.length === 0) return;
|
|
3055
3116
|
if (s.length === 1) return s[0];
|
|
3056
3117
|
const r = [];
|
|
3057
3118
|
s.forEach((f) => r.push(f.start.clone(), f.end.clone()));
|
|
3058
|
-
const i = n === "average" ?
|
|
3119
|
+
const i = n === "average" ? L.mergeLines(...s) : L.mergeLinesByMaxlength(...s);
|
|
3059
3120
|
let o = [], a = [];
|
|
3060
3121
|
s.forEach((f) => {
|
|
3061
3122
|
const { drawDoorData: p, drawWindow: g, rooftopPz: y, isWindow: m, ...x } = f.userData;
|
|
3062
3123
|
Object.assign(i.userData, x), o.push(y ?? 1 / 0), m && (a.push(...g), i.userData.isWindow = !0);
|
|
3063
|
-
}), a.length && (i.userData.drawWindow = a,
|
|
3124
|
+
}), a.length && (i.userData.drawWindow = a, ne(i)), i.userData.rooftopPz = Math.min(...o), i.userData.rooftopPz === 1 / 0 && (i.userData.rooftopPz = 0);
|
|
3064
3125
|
let c = 1 / 0, l = -1 / 0;
|
|
3065
3126
|
const h = s[0].normal().normalize();
|
|
3066
3127
|
c = 1 / 0, l = -1 / 0, r.forEach((f) => {
|
|
@@ -3073,8 +3134,8 @@ function rn(u, t = 0.1, e) {
|
|
|
3073
3134
|
}), i.currentData.isFittedLine = !0, i;
|
|
3074
3135
|
}).filter((s) => !!s);
|
|
3075
3136
|
}
|
|
3076
|
-
function
|
|
3077
|
-
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new
|
|
3137
|
+
function an(u, t, e) {
|
|
3138
|
+
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new B(v.fromByLineSegment(...u)), i = new L(), o = /* @__PURE__ */ new Map();
|
|
3078
3139
|
u.forEach((d) => {
|
|
3079
3140
|
d.userData.isDoor || (r.insert(d), d.points.forEach((f) => s.insert(f, d)));
|
|
3080
3141
|
});
|
|
@@ -3097,14 +3158,14 @@ function on(u, t, e) {
|
|
|
3097
3158
|
function l(d, f) {
|
|
3098
3159
|
let p = c(d, f);
|
|
3099
3160
|
if (p)
|
|
3100
|
-
return a(f, new
|
|
3161
|
+
return a(f, new L(d.clone(), p.clone()));
|
|
3101
3162
|
if (s.queryPoint(d).filter((M) => M.userData !== f).length !== 0 || r.queryCircle(d, 1e-3).filter((M) => M.line !== f).length > 0) return;
|
|
3102
3163
|
const y = s.queryCircle(d, n).filter((M) => M.userData !== f && M.userData?.vertical(f)).sort((M, w) => M.point.distance(d) - w.point.distance(d));
|
|
3103
3164
|
if (!y.length) return;
|
|
3104
3165
|
const m = y[0], x = m.userData?.projectPoint(d, !1);
|
|
3105
3166
|
if (x) {
|
|
3106
3167
|
const M = m.userData;
|
|
3107
|
-
a(f, new
|
|
3168
|
+
a(f, new L(d.clone(), x.clone())), a(M, new L(m.point.clone(), x.clone()));
|
|
3108
3169
|
}
|
|
3109
3170
|
}
|
|
3110
3171
|
function h(d, f, p) {
|
|
@@ -3123,19 +3184,19 @@ function on(u, t, e) {
|
|
|
3123
3184
|
y || l(f.start, f), m || l(f.end, f);
|
|
3124
3185
|
}
|
|
3125
3186
|
return o.forEach((d, f) => {
|
|
3126
|
-
const p =
|
|
3187
|
+
const p = L.mergeLines(f, ...d);
|
|
3127
3188
|
f.set(p.start, p.end);
|
|
3128
3189
|
}), s.clear(), r.clear(), u;
|
|
3129
3190
|
}
|
|
3130
|
-
function
|
|
3131
|
-
const n =
|
|
3191
|
+
function cn(u, t, e = 0.01) {
|
|
3192
|
+
const n = vt([...u, ...t]), s = $([...n]);
|
|
3132
3193
|
for (let r = 0; r < t.length; r++)
|
|
3133
3194
|
t[r].points.forEach((o) => {
|
|
3134
3195
|
s.queryPoint(o, !0).forEach((a) => n.delete(a.userData));
|
|
3135
3196
|
});
|
|
3136
|
-
return u = u.filter((r) => !n.has(r) || r.length() > e), u =
|
|
3197
|
+
return u = u.filter((r) => !n.has(r) || r.length() > e), u = L.brokenLineMerging(u, _), at(...u), u;
|
|
3137
3198
|
}
|
|
3138
|
-
function
|
|
3199
|
+
function ln(u) {
|
|
3139
3200
|
const t = [];
|
|
3140
3201
|
for (let e = 0; e < u.length; e++) {
|
|
3141
3202
|
const n = u[e];
|
|
@@ -3158,8 +3219,8 @@ function cn(u) {
|
|
|
3158
3219
|
}
|
|
3159
3220
|
return { doorLines: u, doorIntersectLines: t };
|
|
3160
3221
|
}
|
|
3161
|
-
function
|
|
3162
|
-
const e = $(u), n =
|
|
3222
|
+
function un(u, t) {
|
|
3223
|
+
const e = $(u), n = It(u);
|
|
3163
3224
|
for (let s = 0; s < t.length; s++) {
|
|
3164
3225
|
const r = t[s];
|
|
3165
3226
|
r.points.map((a) => {
|
|
@@ -3196,7 +3257,7 @@ function ln(u, t) {
|
|
|
3196
3257
|
}
|
|
3197
3258
|
}
|
|
3198
3259
|
}
|
|
3199
|
-
class
|
|
3260
|
+
class ue {
|
|
3200
3261
|
/**
|
|
3201
3262
|
* 轴对齐垂直修正
|
|
3202
3263
|
* @param lines 待调整线段组
|
|
@@ -3205,41 +3266,41 @@ class le {
|
|
|
3205
3266
|
*/
|
|
3206
3267
|
static correction(t, e, n) {
|
|
3207
3268
|
const s = t.indexOf(e);
|
|
3208
|
-
t = t.map((m) => m.clone()), e = s > -1 ? t[s] : e, t =
|
|
3209
|
-
const r =
|
|
3269
|
+
t = t.map((m) => m.clone()), e = s > -1 ? t[s] : e, t = tn(t);
|
|
3270
|
+
const r = en(t), { parallelLines: i, verticalLines: o, doorLines: a } = nn(e, t, r, 25), c = e.normal(), l = e.center, h = e.direction(), d = new L(
|
|
3210
3271
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
3211
3272
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
3212
|
-
), f = new
|
|
3273
|
+
), f = new L(
|
|
3213
3274
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
3214
3275
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
3215
3276
|
);
|
|
3216
|
-
let p =
|
|
3217
|
-
p =
|
|
3218
|
-
let g =
|
|
3219
|
-
g =
|
|
3277
|
+
let p = sn(i, o, d, f, r, n);
|
|
3278
|
+
p = rn(p, r);
|
|
3279
|
+
let g = on(p, 0.1, n);
|
|
3280
|
+
g = L.brokenLineMerging(g, _), g = an(g, r, n), g = At(g, 1e-9), ln(a), g = cn(g, a, 0.15), g = Tt(g);
|
|
3220
3281
|
const { wallGroup: y = !0 } = n ?? {};
|
|
3221
|
-
return y && (g = Z(g), g =
|
|
3282
|
+
return y && (g = Z(g), g = gt.complementSide(g), g = Z(g, a, !0, !1), g = Tt(g, !1)), un(g, a), at(...g), g.push(...a), g;
|
|
3222
3283
|
}
|
|
3223
3284
|
}
|
|
3224
|
-
const
|
|
3285
|
+
const hn = new L(
|
|
3225
3286
|
new D(0, 0),
|
|
3226
3287
|
new D(0, 1)
|
|
3227
3288
|
);
|
|
3228
|
-
function
|
|
3289
|
+
function he(u) {
|
|
3229
3290
|
const t = [...u].sort((r, i) => i.length() - r.length()).slice(0, 20), e = t.map((r) => {
|
|
3230
|
-
let i = parseInt(
|
|
3291
|
+
let i = parseInt(hn.includedAngle(r) + "");
|
|
3231
3292
|
return i > 90 && (i = 180 - i), i;
|
|
3232
3293
|
}), n = /* @__PURE__ */ new Map();
|
|
3233
3294
|
return e.forEach((r, i) => {
|
|
3234
3295
|
n.has(r) || n.set(r, []), n.get(r)?.push(t[i]);
|
|
3235
3296
|
}), [...n.values()].sort((r, i) => i.length - r.length)[0].sort((r, i) => i.length() - r.length())[0];
|
|
3236
3297
|
}
|
|
3237
|
-
function
|
|
3298
|
+
function de(u) {
|
|
3238
3299
|
let t = [], e = -1;
|
|
3239
3300
|
const n = [];
|
|
3240
3301
|
return u.forEach(({ start: r, end: i, ...o }, a) => {
|
|
3241
3302
|
n.push(r.z ?? 0, i.z ?? 0);
|
|
3242
|
-
const c = new
|
|
3303
|
+
const c = new L(
|
|
3243
3304
|
D.from(r),
|
|
3244
3305
|
D.from(i)
|
|
3245
3306
|
);
|
|
@@ -3250,7 +3311,7 @@ function he(u) {
|
|
|
3250
3311
|
verticalReferenceIndex: e
|
|
3251
3312
|
};
|
|
3252
3313
|
}
|
|
3253
|
-
function
|
|
3314
|
+
function fe(u) {
|
|
3254
3315
|
if (u.length < 3) return 0;
|
|
3255
3316
|
let t = 0;
|
|
3256
3317
|
const e = u.length;
|
|
@@ -3260,7 +3321,276 @@ function de(u) {
|
|
|
3260
3321
|
}
|
|
3261
3322
|
return Math.abs(t) / 2;
|
|
3262
3323
|
}
|
|
3263
|
-
|
|
3324
|
+
class dn extends I.LineSegments {
|
|
3325
|
+
geometry = new I.BufferGeometry();
|
|
3326
|
+
points = [];
|
|
3327
|
+
pointsObject3D;
|
|
3328
|
+
constructor(t = [], e = 16777215) {
|
|
3329
|
+
super(), this.geometry = this.geometry, this.addPoint(...t), this.frustumCulled = !1, this.pointsObject3D = new I.Points(this.geometry, new I.PointsMaterial({
|
|
3330
|
+
sizeAttenuation: !1,
|
|
3331
|
+
size: 10
|
|
3332
|
+
})), this.material = new I.LineBasicMaterial({ color: e });
|
|
3333
|
+
}
|
|
3334
|
+
addPoint(...t) {
|
|
3335
|
+
this.points.push(...t), this.updateGeometry();
|
|
3336
|
+
}
|
|
3337
|
+
setPoint(...t) {
|
|
3338
|
+
this.points.length = 0, this.addPoint(...t);
|
|
3339
|
+
}
|
|
3340
|
+
_timer = null;
|
|
3341
|
+
updateGeometry() {
|
|
3342
|
+
this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
3343
|
+
const t = this.points.flatMap((n, s) => {
|
|
3344
|
+
if (s === 0) return [];
|
|
3345
|
+
{
|
|
3346
|
+
const r = this.points[s - 1];
|
|
3347
|
+
return [r.x, r.y, r.z, n.x, n.y, n.z];
|
|
3348
|
+
}
|
|
3349
|
+
}), e = new I.BufferAttribute(new Float32Array(t), 3);
|
|
3350
|
+
this.geometry.setAttribute("position", e), this._timer = null;
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
function Dt() {
|
|
3355
|
+
return new Promise((u) => {
|
|
3356
|
+
const t = document.createElement("input");
|
|
3357
|
+
t.type = "file", t.accept = "application/json", t.click(), t.onchange = () => {
|
|
3358
|
+
t.files?.length ? u(t.files[0]) : u(null);
|
|
3359
|
+
};
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
const fn = Object.assign(Dt, {
|
|
3363
|
+
arrayBuffer() {
|
|
3364
|
+
return new Promise(async (u) => {
|
|
3365
|
+
const t = await Dt();
|
|
3366
|
+
if (t instanceof File) {
|
|
3367
|
+
const e = new FileReader();
|
|
3368
|
+
e.onload = () => {
|
|
3369
|
+
u(e.result);
|
|
3370
|
+
}, e.readAsArrayBuffer(t);
|
|
3371
|
+
} else u(null);
|
|
3372
|
+
});
|
|
3373
|
+
},
|
|
3374
|
+
text() {
|
|
3375
|
+
return new Promise(async (u) => {
|
|
3376
|
+
const t = await Dt();
|
|
3377
|
+
if (t instanceof File) {
|
|
3378
|
+
const e = new FileReader();
|
|
3379
|
+
e.onload = () => {
|
|
3380
|
+
u(e.result);
|
|
3381
|
+
}, e.readAsText(t, "utf-8");
|
|
3382
|
+
} else u(null);
|
|
3383
|
+
});
|
|
3384
|
+
},
|
|
3385
|
+
async json() {
|
|
3386
|
+
const u = await this.text();
|
|
3387
|
+
if (u) return JSON.parse(u);
|
|
3388
|
+
}
|
|
3389
|
+
});
|
|
3390
|
+
class pe extends ot {
|
|
3391
|
+
list = [];
|
|
3392
|
+
rollbacklist = [];
|
|
3393
|
+
revokeRollbacklist = [];
|
|
3394
|
+
// 是否写入操作记录
|
|
3395
|
+
writeOperationList = !0;
|
|
3396
|
+
loop = !1;
|
|
3397
|
+
setLoop(t) {
|
|
3398
|
+
return this.loop = t, this;
|
|
3399
|
+
}
|
|
3400
|
+
/**
|
|
3401
|
+
*
|
|
3402
|
+
* @param operation
|
|
3403
|
+
* @returns
|
|
3404
|
+
*/
|
|
3405
|
+
add(t) {
|
|
3406
|
+
return this.list.push(t), this;
|
|
3407
|
+
}
|
|
3408
|
+
/** 添加回滚回调列表
|
|
3409
|
+
* @param callBack
|
|
3410
|
+
*/
|
|
3411
|
+
addRollback(t) {
|
|
3412
|
+
return this.rollbacklist.push(t), this;
|
|
3413
|
+
}
|
|
3414
|
+
/** 添加撤回回滚回调列表
|
|
3415
|
+
* @param callBack
|
|
3416
|
+
* @returns
|
|
3417
|
+
*/
|
|
3418
|
+
addRevokeRollback(t) {
|
|
3419
|
+
return this.revokeRollbacklist.push(t), this;
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
class pn extends ot {
|
|
3423
|
+
commandFlowMap = /* @__PURE__ */ new Map();
|
|
3424
|
+
lock = !1;
|
|
3425
|
+
abortController = null;
|
|
3426
|
+
resolve = null;
|
|
3427
|
+
currentName = null;
|
|
3428
|
+
_disabled = !1;
|
|
3429
|
+
set disabled(t) {
|
|
3430
|
+
this._disabled = t, this._disabled && this.cancel();
|
|
3431
|
+
}
|
|
3432
|
+
get disabled() {
|
|
3433
|
+
return this._disabled;
|
|
3434
|
+
}
|
|
3435
|
+
/**
|
|
3436
|
+
* 操作记录
|
|
3437
|
+
*/
|
|
3438
|
+
operationList = [];
|
|
3439
|
+
rollbackList = [];
|
|
3440
|
+
constructor() {
|
|
3441
|
+
super();
|
|
3442
|
+
}
|
|
3443
|
+
/** 添加命令流
|
|
3444
|
+
* @param name
|
|
3445
|
+
* @returns
|
|
3446
|
+
*/
|
|
3447
|
+
addCommandFlow(t) {
|
|
3448
|
+
if (this.commandFlowMap.has(t)) throw new Error(`${t} 命令已经存在`);
|
|
3449
|
+
const e = new pe();
|
|
3450
|
+
return this.commandFlowMap.set(t, e), e;
|
|
3451
|
+
}
|
|
3452
|
+
executionPromise = null;
|
|
3453
|
+
executionResolve = null;
|
|
3454
|
+
/** 执行控制流
|
|
3455
|
+
* @param name
|
|
3456
|
+
* @returns
|
|
3457
|
+
*/
|
|
3458
|
+
async start(t, e = null, n = 0) {
|
|
3459
|
+
if (this.disabled) throw new Error("命令管理器已禁用,无法启动新的命令流");
|
|
3460
|
+
if (this.dispatchEvent({
|
|
3461
|
+
type: "startedBefore",
|
|
3462
|
+
name: t,
|
|
3463
|
+
currentName: this.currentName
|
|
3464
|
+
}), this.executionPromise && await this.executionPromise, this.executionPromise = null, this.lock)
|
|
3465
|
+
throw new Error("命令管理器已被 " + this.currentName + " 命令锁定,无法启动新的命令流,请退出或等待命令执行结束");
|
|
3466
|
+
const s = this.commandFlowMap.get(t);
|
|
3467
|
+
if (!s)
|
|
3468
|
+
throw new Error(`命令流 ${t} 不存在`);
|
|
3469
|
+
this.lock = !0, this.abortController = new AbortController(), this.currentName = t, s.dispatchEvent({ type: "started" }), this.dispatchEvent({ type: "started", name: t });
|
|
3470
|
+
try {
|
|
3471
|
+
for (let r = n; r < s.list.length; r++) {
|
|
3472
|
+
const i = s.list[r];
|
|
3473
|
+
if (s.dispatchEvent({ type: "executing", index: r }), this.dispatchEvent({ type: "executing", name: t, index: r }), e = await new Promise((o) => {
|
|
3474
|
+
this.resolve = o, i(o, e);
|
|
3475
|
+
}), this.abortController.signal.aborted) {
|
|
3476
|
+
s.dispatchEvent({ type: "executionInterrupt", index: r }), this.dispatchEvent({ type: "executionInterrupt", name: t, index: r }), this.dispatchEvent({ type: "cancel", name: t });
|
|
3477
|
+
break;
|
|
3478
|
+
} else
|
|
3479
|
+
s.dispatchEvent({ type: "executionCompleted", index: r, data: e }), this.dispatchEvent({ type: "executionCompleted", name: t, index: r, data: e });
|
|
3480
|
+
}
|
|
3481
|
+
} catch (r) {
|
|
3482
|
+
console.error(r);
|
|
3483
|
+
} finally {
|
|
3484
|
+
this.lock = !1, this.currentName = null, this.abortController && !this.abortController.signal.aborted && (s.dispatchEvent({ type: "completed", data: e }), this.dispatchEvent({ type: "completed", name: t, data: e }), s.writeOperationList && (this.operationList.push({ name: t, data: e }), this.rollbackList.length = 0), s.loop && queueMicrotask(() => this.start(t))), this.abortController = null, s.dispatchEvent({ type: "finally" }), this.dispatchEvent({ type: "finally", name: t }), this.executionResolve && (this.executionResolve(null), this.executionResolve = null);
|
|
3485
|
+
}
|
|
3486
|
+
return e;
|
|
3487
|
+
}
|
|
3488
|
+
/** 取消当前命令
|
|
3489
|
+
*/
|
|
3490
|
+
cancel() {
|
|
3491
|
+
this.abortController && (this.abortController.abort(), this.resolve && this.resolve(), this.executionPromise = new Promise((t) => this.executionResolve = t));
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* 回滚
|
|
3495
|
+
*/
|
|
3496
|
+
rollback() {
|
|
3497
|
+
try {
|
|
3498
|
+
const t = this.operationList.pop();
|
|
3499
|
+
if (!t) return !1;
|
|
3500
|
+
const e = this.commandFlowMap.get(t.name);
|
|
3501
|
+
if (!e) return !1;
|
|
3502
|
+
const n = e.rollbacklist.reduce((s, r) => r(s), t.data);
|
|
3503
|
+
return this.dispatchEvent({ type: "rollback", name: t.name }), this.rollbackList.push({
|
|
3504
|
+
data: n,
|
|
3505
|
+
name: t.name
|
|
3506
|
+
}), !0;
|
|
3507
|
+
} catch (t) {
|
|
3508
|
+
throw new Error(`回滚失败:${t}`);
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* 撤销回滚
|
|
3513
|
+
*/
|
|
3514
|
+
revokeRollback() {
|
|
3515
|
+
try {
|
|
3516
|
+
const t = this.rollbackList.pop();
|
|
3517
|
+
if (!t) return !1;
|
|
3518
|
+
const e = this.commandFlowMap.get(t.name);
|
|
3519
|
+
if (!e) return !1;
|
|
3520
|
+
const n = e.revokeRollbacklist.reduce((s, r) => r(s), t.data);
|
|
3521
|
+
return this.dispatchEvent({ type: "revokeRollback", name: t.name }), this.operationList.push({ name: t.name, data: n }), !0;
|
|
3522
|
+
} catch (t) {
|
|
3523
|
+
throw new Error(`撤回回滚失败:${t}`);
|
|
3524
|
+
}
|
|
3525
|
+
}
|
|
3526
|
+
destroy() {
|
|
3527
|
+
this.cancel(), this.addEventListener("cancel", () => {
|
|
3528
|
+
this.commandFlowMap.clear(), this.lock = !1, this.abortController = null, this.resolve = null, this.executionResolve = null, this.executionPromise = null, this.currentName = null, this.operationList.length = 0, this.rollbackList.length = 0;
|
|
3529
|
+
}, { once: !0 });
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3533
|
+
__proto__: null,
|
|
3534
|
+
ArrayMap: H,
|
|
3535
|
+
AxisAlignCorr: ue,
|
|
3536
|
+
BoundExt: Nt,
|
|
3537
|
+
Box2: v,
|
|
3538
|
+
CAD: Bn,
|
|
3539
|
+
CommandFlow: pe,
|
|
3540
|
+
CommandManager: pn,
|
|
3541
|
+
Component: z,
|
|
3542
|
+
ComponentManager: Qt,
|
|
3543
|
+
CountMap: pt,
|
|
3544
|
+
DoubleWallHelper: gt,
|
|
3545
|
+
DxfSystem: tt,
|
|
3546
|
+
EventDispatcher: ot,
|
|
3547
|
+
LineGroupType: C,
|
|
3548
|
+
LineIndexGenerator: yt,
|
|
3549
|
+
LineSegment: L,
|
|
3550
|
+
LineSegmentUndirectedGraph: mt,
|
|
3551
|
+
Lines: dn,
|
|
3552
|
+
MapEnhance: nt,
|
|
3553
|
+
Point: D,
|
|
3554
|
+
PointVirtualGrid: G,
|
|
3555
|
+
Polygon: ct,
|
|
3556
|
+
PvgList: te,
|
|
3557
|
+
Quadtree: B,
|
|
3558
|
+
Rectangle: st,
|
|
3559
|
+
SelectLocalFile: fn,
|
|
3560
|
+
UndirectedGraph: ie,
|
|
3561
|
+
UnionFindSet: Q,
|
|
3562
|
+
buildBayWindowGroup: Tt,
|
|
3563
|
+
buildDoubleWallGroup: Z,
|
|
3564
|
+
clippingDoubleWall: me,
|
|
3565
|
+
clippingLineUserData: Pt,
|
|
3566
|
+
cloneUserData: k,
|
|
3567
|
+
closedPathArea: fe,
|
|
3568
|
+
components: En,
|
|
3569
|
+
createPointVirtualGrid: $,
|
|
3570
|
+
createQuadtree: It,
|
|
3571
|
+
findCircleEdges: ce,
|
|
3572
|
+
findClosedPolygons: Cn,
|
|
3573
|
+
findDiscretePoint: re,
|
|
3574
|
+
findDiscretePointLine: Ke,
|
|
3575
|
+
findDiscretePointLine2: vt,
|
|
3576
|
+
findLargestCircle: le,
|
|
3577
|
+
findRingEdges: Me,
|
|
3578
|
+
findVerticalReference: he,
|
|
3579
|
+
lineDataToOriginalData: it,
|
|
3580
|
+
lineDataToThreeVJiaJson: xe,
|
|
3581
|
+
lineSegmentClipping: At,
|
|
3582
|
+
mergeLineUserData: _,
|
|
3583
|
+
mergeSmallestCircle: ae,
|
|
3584
|
+
mergeWindow: se,
|
|
3585
|
+
originalDataToLineData: de,
|
|
3586
|
+
recomputedWindow: at,
|
|
3587
|
+
recomputedWindowCenter: ne,
|
|
3588
|
+
ringsDeduplication: oe,
|
|
3589
|
+
smallestCircle: Rt,
|
|
3590
|
+
toOriginalDataItem: ee,
|
|
3591
|
+
tools: Je,
|
|
3592
|
+
uuid: V
|
|
3593
|
+
}, Symbol.toStringTag, { value: "Module" })), gn = {
|
|
3264
3594
|
Unitless: 1,
|
|
3265
3595
|
// 无单位,1米 = 1(无单位)
|
|
3266
3596
|
Inches: 39.37007874015748,
|
|
@@ -3304,10 +3634,10 @@ const hn = {
|
|
|
3304
3634
|
Parsecs: 3240779289666404e-32
|
|
3305
3635
|
// 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
|
|
3306
3636
|
};
|
|
3307
|
-
function
|
|
3637
|
+
function kt(u) {
|
|
3308
3638
|
const t = [];
|
|
3309
3639
|
for (let e = 0; e < u.length; e++)
|
|
3310
|
-
t.push(new
|
|
3640
|
+
t.push(new L(
|
|
3311
3641
|
u[e].clone(),
|
|
3312
3642
|
u[(e + 1) % u.length].clone()
|
|
3313
3643
|
));
|
|
@@ -3361,9 +3691,9 @@ class U extends z {
|
|
|
3361
3691
|
* @param data
|
|
3362
3692
|
*/
|
|
3363
3693
|
preprocessing(t) {
|
|
3364
|
-
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } =
|
|
3694
|
+
let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = de(t);
|
|
3365
3695
|
if (this.originalZAverage = s, n === -1) {
|
|
3366
|
-
const i =
|
|
3696
|
+
const i = he(e);
|
|
3367
3697
|
n = e.indexOf(i);
|
|
3368
3698
|
}
|
|
3369
3699
|
const r = e[n];
|
|
@@ -3372,7 +3702,7 @@ class U extends z {
|
|
|
3372
3702
|
data: t,
|
|
3373
3703
|
setData(i) {
|
|
3374
3704
|
e = i.map(({ start: o, end: a, ...c }) => {
|
|
3375
|
-
const l = new
|
|
3705
|
+
const l = new L(D.from(o), D.from(a));
|
|
3376
3706
|
return l.userData = c, l;
|
|
3377
3707
|
}), t = i;
|
|
3378
3708
|
}
|
|
@@ -3528,7 +3858,7 @@ class U extends z {
|
|
|
3528
3858
|
break;
|
|
3529
3859
|
}
|
|
3530
3860
|
}
|
|
3531
|
-
const e = this.mergeSameDirectionLine(
|
|
3861
|
+
const e = this.mergeSameDirectionLine(kt(t)), n = [e[0]];
|
|
3532
3862
|
for (let s = 1; s < e.length; s++) {
|
|
3533
3863
|
const r = e[s], i = e[(e.length + s - 1) % e.length];
|
|
3534
3864
|
if (r.length() > this.width * 0.9) {
|
|
@@ -3551,7 +3881,7 @@ class U extends z {
|
|
|
3551
3881
|
* @param path
|
|
3552
3882
|
*/
|
|
3553
3883
|
removeShortLine(t, e = this.shortLine) {
|
|
3554
|
-
const n =
|
|
3884
|
+
const n = kt(t), s = [], r = Math.PI / 180;
|
|
3555
3885
|
for (let i = 0; i < n.length; i++) {
|
|
3556
3886
|
const o = n[i], a = o.length(), c = i;
|
|
3557
3887
|
if (a > e || s.length === 0) {
|
|
@@ -3585,15 +3915,15 @@ class U extends z {
|
|
|
3585
3915
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
3586
3916
|
*/
|
|
3587
3917
|
lineOffset(t = U.EndType.etOpenSquare, e = U.JoinType.jtMiter, n = 1e4) {
|
|
3588
|
-
let s = new
|
|
3589
|
-
const r = new
|
|
3918
|
+
let s = new et.Paths();
|
|
3919
|
+
const r = new et.ClipperOffset(20, 0.25);
|
|
3590
3920
|
return this.pointsGroups.forEach((i) => {
|
|
3591
3921
|
const o = this.lineTopology(i).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
|
|
3592
3922
|
r.AddPaths(o, e, t);
|
|
3593
3923
|
}), r.Execute(s, this.width / 2 * n), this.wallsGroup = s.map((i) => {
|
|
3594
3924
|
let o = i.map((a) => D.from(a).divisionScalar(n));
|
|
3595
3925
|
return o = this.lineSegmentStraightening(o), t == U.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
|
|
3596
|
-
}).filter((i) => i.length > 4 ||
|
|
3926
|
+
}).filter((i) => i.length > 4 || fe(i) > 0.2), this.dispatchEvent({
|
|
3597
3927
|
type: "lineOffset",
|
|
3598
3928
|
wallsGroup: this.wallsGroup
|
|
3599
3929
|
}), this.wallsGroup;
|
|
@@ -3601,12 +3931,12 @@ class U extends z {
|
|
|
3601
3931
|
/** 垂直纠正
|
|
3602
3932
|
* @param option
|
|
3603
3933
|
*/
|
|
3604
|
-
axisAlignCorr(t) {
|
|
3934
|
+
async axisAlignCorr(t) {
|
|
3605
3935
|
if (this.verticalReferenceLine) {
|
|
3606
|
-
const e = this.getLineSegments(), n = performance.now(), s =
|
|
3936
|
+
const e = this.getLineSegments(), n = performance.now(), s = ue.correction(e, this.verticalReferenceLine, t);
|
|
3607
3937
|
console.log("垂直纠正消耗时间:", (performance.now() - n).toFixed(2), "ms", "处理线段数量:", e.length);
|
|
3608
|
-
const r =
|
|
3609
|
-
this.set(r);
|
|
3938
|
+
const r = it(s);
|
|
3939
|
+
await this.set(r);
|
|
3610
3940
|
} else
|
|
3611
3941
|
throw new Error("未找到一条垂直纠正基准轴线");
|
|
3612
3942
|
}
|
|
@@ -3649,13 +3979,13 @@ class U extends z {
|
|
|
3649
3979
|
* 线段数据转为原始json数据
|
|
3650
3980
|
*/
|
|
3651
3981
|
lineDataToOriginalData(t, e) {
|
|
3652
|
-
return
|
|
3982
|
+
return it(t, this.originalZAverage, e);
|
|
3653
3983
|
}
|
|
3654
3984
|
/**
|
|
3655
3985
|
* 转为绘制数据
|
|
3656
3986
|
*/
|
|
3657
3987
|
toDrawDataJson(t = "Millimeters") {
|
|
3658
|
-
const e =
|
|
3988
|
+
const e = gn[t], n = {
|
|
3659
3989
|
unit: t,
|
|
3660
3990
|
line: [],
|
|
3661
3991
|
arc: [],
|
|
@@ -3699,20 +4029,20 @@ class U extends z {
|
|
|
3699
4029
|
if (s = "cyan", l.length() < 1.2) {
|
|
3700
4030
|
l.expansion(-o * 0.5);
|
|
3701
4031
|
const h = c.normal();
|
|
3702
|
-
let d = new
|
|
4032
|
+
let d = new L(
|
|
3703
4033
|
l.start.clone(),
|
|
3704
4034
|
l.start.clone().add(h.clone().multiplyScalar(l.length()))
|
|
3705
4035
|
);
|
|
3706
4036
|
const f = d.clone().directionMove(d.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
|
|
3707
4037
|
for (let w = 0; w < a.length; w++)
|
|
3708
4038
|
if (a[w].intersectRectangle(f)) {
|
|
3709
|
-
d = new
|
|
4039
|
+
d = new L(
|
|
3710
4040
|
l.start.clone(),
|
|
3711
4041
|
l.start.clone().add(h.clone().multiplyScalar(-l.length()))
|
|
3712
4042
|
);
|
|
3713
4043
|
break;
|
|
3714
4044
|
}
|
|
3715
|
-
d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((w,
|
|
4045
|
+
d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((w, E) => r(w, E));
|
|
3716
4046
|
const p = l.length(), g = d.length(), y = (p ** 2 + g ** 2) / (2 * g), m = d.end.clone().add(d.direction().multiplyScalar(-y)), [x, M] = this.getArcAngleRange(m, l.end, d.end);
|
|
3717
4047
|
i(m, y, Math.min(x, M), Math.max(x, M)), a.push(f);
|
|
3718
4048
|
} else
|
|
@@ -3720,7 +4050,7 @@ class U extends z {
|
|
|
3720
4050
|
}), s = "yellow", this.lineSegments.forEach((c) => {
|
|
3721
4051
|
if (!c.userData.isWindow) return !1;
|
|
3722
4052
|
Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
|
|
3723
|
-
const { p: h, width: d } = l, f = D.from(h), p = f.clone().add(c.direction().multiplyScalar(d * 0.5)), g = f.clone().add(c.direction().multiplyScalar(-d * 0.5)), y = new
|
|
4053
|
+
const { p: h, width: d } = l, f = D.from(h), p = f.clone().add(c.direction().multiplyScalar(d * 0.5)), g = f.clone().add(c.direction().multiplyScalar(-d * 0.5)), y = new L(p, g);
|
|
3724
4054
|
r(y.start, y.end), y.expandToRectangle(this.width, "bothSides").path2D((m, x) => r(m, x));
|
|
3725
4055
|
});
|
|
3726
4056
|
}), n;
|
|
@@ -3764,8 +4094,8 @@ class U extends z {
|
|
|
3764
4094
|
* 将点json结构转换为Dxf string
|
|
3765
4095
|
*/
|
|
3766
4096
|
toDxfString(t = "Millimeters") {
|
|
3767
|
-
const e = new
|
|
3768
|
-
e.setUnits(t), e.addLayer("cyan",
|
|
4097
|
+
const e = new lt();
|
|
4098
|
+
e.setUnits(t), e.addLayer("cyan", lt.ACI.CYAN, "DOTTED"), e.addLayer("yellow", lt.ACI.YELLOW, "DOTTED"), e.addLayer("white", lt.ACI.WHITE, "DOTTED");
|
|
3769
4099
|
const n = this.toDrawDataJson();
|
|
3770
4100
|
return n.line.forEach((s) => {
|
|
3771
4101
|
let [r, i, o, a, c] = s;
|
|
@@ -3787,7 +4117,7 @@ class U extends z {
|
|
|
3787
4117
|
* @param filename
|
|
3788
4118
|
*/
|
|
3789
4119
|
async downloadOriginalData(t) {
|
|
3790
|
-
const e =
|
|
4120
|
+
const e = it(this.getLineSegments()), n = JSON.stringify(e);
|
|
3791
4121
|
if (typeof window < "u") {
|
|
3792
4122
|
const s = new Blob([n], { type: "application/json" }), r = document.createElement("a");
|
|
3793
4123
|
r.href = URL.createObjectURL(s), r.download = t, r.click();
|
|
@@ -3849,8 +4179,8 @@ class U extends z {
|
|
|
3849
4179
|
});
|
|
3850
4180
|
}
|
|
3851
4181
|
}
|
|
3852
|
-
const Y = new
|
|
3853
|
-
class
|
|
4182
|
+
const Y = new L();
|
|
4183
|
+
class ge extends U {
|
|
3854
4184
|
static name = "AngleCorrectionDxf";
|
|
3855
4185
|
angle = 0;
|
|
3856
4186
|
onAddFromParent(t) {
|
|
@@ -3863,7 +4193,7 @@ class fe extends U {
|
|
|
3863
4193
|
const h = e.originalData[l];
|
|
3864
4194
|
if (Y.start.copy(h.start), Y.end.copy(h.end), h.isVerticalReferenceLine) {
|
|
3865
4195
|
const [d, f] = h.start.y < h.end.y ? [Y.start, Y.end] : [Y.end, Y.start];
|
|
3866
|
-
s = -new
|
|
4196
|
+
s = -new L(d, f).direction().angleBetween(new D(0, 1), "angle", "360"), r = null;
|
|
3867
4197
|
break;
|
|
3868
4198
|
}
|
|
3869
4199
|
(!r || Y.length() > r.length()) && (r = Y.clone(), r.userData.index = l);
|
|
@@ -3871,13 +4201,13 @@ class fe extends U {
|
|
|
3871
4201
|
if (r) {
|
|
3872
4202
|
e.originalData[r.userData.index].isVerticalReferenceLine = !0;
|
|
3873
4203
|
const [l, h] = r.start.y < r.end.y ? [r.start, r.end] : [r.end, r.start];
|
|
3874
|
-
s = -new
|
|
4204
|
+
s = -new L(l, h).direction().angleBetween(new D(0, 1), "angle", "360");
|
|
3875
4205
|
}
|
|
3876
4206
|
function i(l, h) {
|
|
3877
4207
|
return l.division(o).rotate(D.zero(), h * (Math.PI / 180));
|
|
3878
4208
|
}
|
|
3879
4209
|
const o = e.originalBox.center, a = D.zero(), c = e.originalData.map((l) => {
|
|
3880
|
-
const h = i(a.copy(l.start), s).toJson(l.start.z), d = i(a.copy(l.end), s).toJson(l.start.z), f = Object.assign(
|
|
4210
|
+
const h = i(a.copy(l.start), s).toJson(l.start.z), d = i(a.copy(l.end), s).toJson(l.start.z), f = Object.assign(k(l), { start: h, end: d });
|
|
3881
4211
|
return f.drawWindow && f.drawWindow.forEach((p) => p.p = i(a.copy(p.p), s).toJson(p.p.z)), f;
|
|
3882
4212
|
});
|
|
3883
4213
|
n.appendLineSegmentList.forEach((l) => {
|
|
@@ -3896,7 +4226,7 @@ class fe extends U {
|
|
|
3896
4226
|
});
|
|
3897
4227
|
}
|
|
3898
4228
|
}
|
|
3899
|
-
class
|
|
4229
|
+
class Ct extends z {
|
|
3900
4230
|
static name = "Variable";
|
|
3901
4231
|
originalLineVisible = !0;
|
|
3902
4232
|
dxfVisible = !0;
|
|
@@ -3923,7 +4253,7 @@ class vt extends z {
|
|
|
3923
4253
|
if (t in this) return this[t];
|
|
3924
4254
|
}
|
|
3925
4255
|
}
|
|
3926
|
-
class
|
|
4256
|
+
class Bt extends z {
|
|
3927
4257
|
static name = "LineAnalysis";
|
|
3928
4258
|
Dxf = null;
|
|
3929
4259
|
Variable = null;
|
|
@@ -3937,7 +4267,7 @@ class Rt extends z {
|
|
|
3937
4267
|
* @param parent
|
|
3938
4268
|
*/
|
|
3939
4269
|
onAddFromParent(t) {
|
|
3940
|
-
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(
|
|
4270
|
+
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(Ct), this.Dxf.addEventListener("setDta", () => {
|
|
3941
4271
|
this.lineAnalysis(), this.dispatchEvent({ type: "analysisCompleted" });
|
|
3942
4272
|
});
|
|
3943
4273
|
}
|
|
@@ -3971,7 +4301,7 @@ class Rt extends z {
|
|
|
3971
4301
|
*/
|
|
3972
4302
|
addData(t, e) {
|
|
3973
4303
|
const n = this.Dxf;
|
|
3974
|
-
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new
|
|
4304
|
+
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new L(t.clone(), e.clone()));
|
|
3975
4305
|
}
|
|
3976
4306
|
/** 结果分析创建矩形
|
|
3977
4307
|
* @param result
|
|
@@ -3985,7 +4315,7 @@ class Rt extends z {
|
|
|
3985
4315
|
if (!(m.x > 0 && x.x < 0 || m.x < 0 && x.x > 0 || m.y > 0 && x.y < 0 || m.y < 0 && x.y > 0)) {
|
|
3986
4316
|
d.set(g.x, g.y), f.set(y.x, y.y);
|
|
3987
4317
|
for (let M = 1; M < o; M++) {
|
|
3988
|
-
const w = l.clone().multiplyScalar(a * M),
|
|
4318
|
+
const w = l.clone().multiplyScalar(a * M), E = h.clone().multiplyScalar(c * M), b = d.clone().add(w), S = f.clone().add(E);
|
|
3989
4319
|
this.addData(b, S);
|
|
3990
4320
|
}
|
|
3991
4321
|
}
|
|
@@ -3996,7 +4326,7 @@ class Rt extends z {
|
|
|
3996
4326
|
*/
|
|
3997
4327
|
buildQuadtree() {
|
|
3998
4328
|
const t = this.Dxf, e = [];
|
|
3999
|
-
this.quadtree = new
|
|
4329
|
+
this.quadtree = new B(t.originalBox, 2), t.lineSegments.forEach((n) => {
|
|
4000
4330
|
n.userData?.isDoor || (this.quadtree?.insert({
|
|
4001
4331
|
line: n,
|
|
4002
4332
|
userData: e.length
|
|
@@ -4013,7 +4343,7 @@ class Rt extends z {
|
|
|
4013
4343
|
this.buildQuadtree();
|
|
4014
4344
|
const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
|
|
4015
4345
|
e.forEach((r, i) => {
|
|
4016
|
-
const o = e[i], a =
|
|
4346
|
+
const o = e[i], a = st.fromByLineSegment(o, this.width * 2, !1, -0.01);
|
|
4017
4347
|
t.queryRect(a).map((l) => l.userData).filter((l) => l !== i).forEach((l) => {
|
|
4018
4348
|
try {
|
|
4019
4349
|
if (n.has(`${i}-${l}`) || n.has(`${l}-${i}`)) return;
|
|
@@ -4053,7 +4383,7 @@ class Rt extends z {
|
|
|
4053
4383
|
}
|
|
4054
4384
|
}
|
|
4055
4385
|
}
|
|
4056
|
-
class
|
|
4386
|
+
class yn {
|
|
4057
4387
|
// 所有可查找的点位
|
|
4058
4388
|
possibleDoorPoints = [];
|
|
4059
4389
|
doorPoint = [];
|
|
@@ -4117,11 +4447,11 @@ class dn {
|
|
|
4117
4447
|
);
|
|
4118
4448
|
const a = [];
|
|
4119
4449
|
return o.forEach((c) => {
|
|
4120
|
-
const l = new
|
|
4450
|
+
const l = new L(c?.start, c?.end), h = l.length();
|
|
4121
4451
|
if (h < n) return;
|
|
4122
4452
|
const d = l.normal(), f = l.direction(), p = (h - i.width * 2) / 2;
|
|
4123
4453
|
for (let g = 0; g < 3; g++) {
|
|
4124
|
-
const y = l.start.clone().add(f.clone().multiplyScalar(i.width + p * g)), m = new
|
|
4454
|
+
const y = l.start.clone().add(f.clone().multiplyScalar(i.width + p * g)), m = new L(
|
|
4125
4455
|
y,
|
|
4126
4456
|
y.clone().add(d.clone().multiplyScalar(1))
|
|
4127
4457
|
);
|
|
@@ -4159,9 +4489,9 @@ class dn {
|
|
|
4159
4489
|
if (o.doorDirectConnection) {
|
|
4160
4490
|
const { start: a, end: c, ...l } = o;
|
|
4161
4491
|
this.continueFind = !1;
|
|
4162
|
-
const h = new
|
|
4492
|
+
const h = new L(D.from(a), D.from(c));
|
|
4163
4493
|
h.userData = {
|
|
4164
|
-
...
|
|
4494
|
+
...k(l),
|
|
4165
4495
|
doorDirectConnection: !0,
|
|
4166
4496
|
isDoor: !0
|
|
4167
4497
|
}, this.dxf.doorLineSegment.push(h), h.points.forEach((d) => {
|
|
@@ -4213,18 +4543,18 @@ class dn {
|
|
|
4213
4543
|
function o({ point: y, line: m }, x, M) {
|
|
4214
4544
|
const w = m.direction();
|
|
4215
4545
|
m.start === y && w.multiplyScalar(-1);
|
|
4216
|
-
const
|
|
4217
|
-
for (let S = 0; S <
|
|
4218
|
-
const T = e.findIndex((q) => q.point ===
|
|
4546
|
+
const E = r.queryCircle(y, n).filter((S) => S.userData !== m).sort((S, T) => S.point.distance(y) - T.point.distance(y)), b = [];
|
|
4547
|
+
for (let S = 0; S < E.length; S++) {
|
|
4548
|
+
const T = e.findIndex((q) => q.point === E[S].point);
|
|
4219
4549
|
if (T === -1) continue;
|
|
4220
4550
|
const A = t[x].uuid, R = e[T].uuid;
|
|
4221
4551
|
if (M.has(`${A}.${R}`)) continue;
|
|
4222
4552
|
M.add(`${A}.${R}`), M.add(`${R}.${A}`);
|
|
4223
|
-
const j =
|
|
4553
|
+
const j = E[S].point, F = new L(y.clone(), j.clone());
|
|
4224
4554
|
if (F.direction().angleBetween(w, "angle") < s) {
|
|
4225
|
-
const q = t[x].line.direction(),
|
|
4226
|
-
|
|
4227
|
-
findData:
|
|
4555
|
+
const q = t[x].line.direction(), N = E[S].userData;
|
|
4556
|
+
N.start.equal(E[S].point) && q.multiplyScalar(-1), F.direction().multiplyScalar(-1).angleBetween(q, "angle") < s && (i.queryLineSegment(F).filter((xt) => !(xt.line.start.equal(y) || xt.line.end.equal(y) || xt.line === N)).length || b.push({
|
|
4557
|
+
findData: E[S],
|
|
4228
4558
|
findUuid: R,
|
|
4229
4559
|
doorLine: F,
|
|
4230
4560
|
doorUuid: A
|
|
@@ -4235,16 +4565,16 @@ class dn {
|
|
|
4235
4565
|
}
|
|
4236
4566
|
function a(y, m, x, M, w) {
|
|
4237
4567
|
M.add(y);
|
|
4238
|
-
const
|
|
4239
|
-
w &&
|
|
4568
|
+
const E = [];
|
|
4569
|
+
w && E.push(w);
|
|
4240
4570
|
for (let b = 0; b < x.length; b++) {
|
|
4241
4571
|
const S = x[b];
|
|
4242
4572
|
if (m.has(S.findUuid)) {
|
|
4243
4573
|
const T = m.get(S.findUuid);
|
|
4244
|
-
a(S.findUuid, m, T, M, S) &&
|
|
4245
|
-
} else
|
|
4574
|
+
a(S.findUuid, m, T, M, S) && E.push(S);
|
|
4575
|
+
} else E.push(S);
|
|
4246
4576
|
}
|
|
4247
|
-
return
|
|
4577
|
+
return E.sort((b, S) => b.doorLine.length() - S.doorLine.length()), w && E[0] === w ? (x.splice(0), !0) : (x.splice(1), !1);
|
|
4248
4578
|
}
|
|
4249
4579
|
const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
4250
4580
|
t.map((y, m) => {
|
|
@@ -4274,10 +4604,10 @@ class dn {
|
|
|
4274
4604
|
});
|
|
4275
4605
|
const g = [];
|
|
4276
4606
|
return f.forEach((y) => {
|
|
4277
|
-
const m = t.findIndex((T) => T.uuid === y.doorUuid), x = e.findIndex((T) => T.uuid === y.findUuid), M = t[m].point.clone(), w = e[x].point.clone(),
|
|
4607
|
+
const m = t.findIndex((T) => T.uuid === y.doorUuid), x = e.findIndex((T) => T.uuid === y.findUuid), M = t[m].point.clone(), w = e[x].point.clone(), E = this.findLongLineSegment(t[m].line), b = this.findLongLineSegment(e[x].line), S = E.projectPoint(w);
|
|
4278
4608
|
if (S) {
|
|
4279
4609
|
M.copy(S);
|
|
4280
|
-
const T = new
|
|
4610
|
+
const T = new L(M, w), A = b.includedAngle(T);
|
|
4281
4611
|
(A < 10 || A > 170 || Math.abs(90 - A) < 10) && g.push({
|
|
4282
4612
|
start: M,
|
|
4283
4613
|
end: w
|
|
@@ -4285,7 +4615,7 @@ class dn {
|
|
|
4285
4615
|
} else {
|
|
4286
4616
|
const T = b.projectPoint(M);
|
|
4287
4617
|
T && w.copy(T);
|
|
4288
|
-
const A = new
|
|
4618
|
+
const A = new L(M, w), R = E.includedAngle(A);
|
|
4289
4619
|
(R < 10 || R > 170 || Math.abs(90 - R) < 10) && g.push({
|
|
4290
4620
|
start: M,
|
|
4291
4621
|
end: w
|
|
@@ -4309,7 +4639,7 @@ class dn {
|
|
|
4309
4639
|
searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
|
|
4310
4640
|
const s = this.quadtree, r = e.direction();
|
|
4311
4641
|
e.start === t && r.multiplyScalar(-1);
|
|
4312
|
-
const i = t.clone().add(r.clone().multiplyScalar(n)), o = new
|
|
4642
|
+
const i = t.clone().add(r.clone().multiplyScalar(n)), o = new L(t.clone(), i), a = s.queryLineSegment(o).map((c) => ({
|
|
4313
4643
|
point: c.line.getIntersection(o),
|
|
4314
4644
|
line: c.line
|
|
4315
4645
|
})).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
|
|
@@ -4336,7 +4666,7 @@ class dn {
|
|
|
4336
4666
|
break;
|
|
4337
4667
|
}
|
|
4338
4668
|
}
|
|
4339
|
-
const l = new
|
|
4669
|
+
const l = new L(t.clone(), t.clone().add(o.multiplyScalar(n))), h = r.queryLineSegment(l).map((d) => ({
|
|
4340
4670
|
point: d.line.getIntersection(l),
|
|
4341
4671
|
line: d.line
|
|
4342
4672
|
})).filter((d) => d.point).sort((d, f) => t.distance(d.point) - t.distance(f.point));
|
|
@@ -4370,7 +4700,7 @@ class dn {
|
|
|
4370
4700
|
return e;
|
|
4371
4701
|
}
|
|
4372
4702
|
}
|
|
4373
|
-
class
|
|
4703
|
+
class ye extends z {
|
|
4374
4704
|
doorSearchNearAngle = 110;
|
|
4375
4705
|
doorSearchDistance = 2;
|
|
4376
4706
|
DoorsAnalysis;
|
|
@@ -4382,13 +4712,13 @@ class pe extends z {
|
|
|
4382
4712
|
* @param parent
|
|
4383
4713
|
*/
|
|
4384
4714
|
onAddFromParent(t) {
|
|
4385
|
-
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(
|
|
4715
|
+
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(Bt);
|
|
4386
4716
|
e.addEventListener("createGroup", () => {
|
|
4387
|
-
this.DoorsAnalysis = new
|
|
4717
|
+
this.DoorsAnalysis = new yn(n, this.skipFindDoor), this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])), this.skipFindDoor = !1, this.dispatchEvent({ type: "analysisCompleted" });
|
|
4388
4718
|
});
|
|
4389
4719
|
}
|
|
4390
4720
|
}
|
|
4391
|
-
function
|
|
4721
|
+
function mn(u) {
|
|
4392
4722
|
const t = u.reduce((d, f) => !d || f.length(!0) > d.length(!0) ? f : d), e = t.normal(), n = 0.1, s = t.center.expandAsLine(e, n).directionMove(e.multiplyScalar(-1), n * 0.5), r = s.projectValue(t.start);
|
|
4393
4723
|
let i = 1 / 0, o = null, a = -1 / 0, c = null;
|
|
4394
4724
|
for (let d = 0; d < u.length; d++) {
|
|
@@ -4401,8 +4731,8 @@ function fn(u) {
|
|
|
4401
4731
|
const [l, h] = [[r, t], [i, o], [a, c]].sort((d, f) => d[0] - f[0])[1];
|
|
4402
4732
|
return h;
|
|
4403
4733
|
}
|
|
4404
|
-
function
|
|
4405
|
-
const e = new
|
|
4734
|
+
function xn(u, t) {
|
|
4735
|
+
const e = new B(v.fromByLineSegment(...u)), n = t.clone().expansion(100), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
4406
4736
|
u.forEach((c) => e.insert(c));
|
|
4407
4737
|
const i = e.queryLineSegment(n);
|
|
4408
4738
|
for (let c = 0; c < i.length; c++) {
|
|
@@ -4414,23 +4744,23 @@ function pn(u, t) {
|
|
|
4414
4744
|
const h = l.getIntersection(n);
|
|
4415
4745
|
if (h) {
|
|
4416
4746
|
if (l.start.equal(h) || l.end.equal(h)) continue;
|
|
4417
|
-
const d =
|
|
4747
|
+
const d = L.clipping(l, [h], Pt);
|
|
4418
4748
|
s.add(l), d.forEach((f) => r.add(f));
|
|
4419
4749
|
}
|
|
4420
4750
|
}
|
|
4421
4751
|
u = u.filter((c) => !s.has(c)), u.push(...r);
|
|
4422
|
-
const o =
|
|
4752
|
+
const o = L.groupByPosition(u, n), a = [];
|
|
4423
4753
|
return o.forEach((c) => {
|
|
4424
|
-
const l = [...
|
|
4754
|
+
const l = [...re(c).keys()].sort((h, d) => h.distance(n.start, !0) - d.distance(n.start, !0));
|
|
4425
4755
|
for (let h = 0; h < l.length; h += 2) {
|
|
4426
4756
|
const d = l[h], f = l[h + 1];
|
|
4427
|
-
c.push(new
|
|
4757
|
+
c.push(new L(d.clone(), f.clone()));
|
|
4428
4758
|
}
|
|
4429
4759
|
a.push(c);
|
|
4430
4760
|
}), e.clear(), a;
|
|
4431
4761
|
}
|
|
4432
|
-
function
|
|
4433
|
-
u = u.map((i) => i.clone()), u =
|
|
4762
|
+
function me(u) {
|
|
4763
|
+
u = u.map((i) => i.clone()), u = L.brokenLineMerging(u, _);
|
|
4434
4764
|
const t = [u], e = [], n = 2e4;
|
|
4435
4765
|
let s, r = 0;
|
|
4436
4766
|
for (; (s = t.pop()) !== void 0; ) {
|
|
@@ -4439,47 +4769,47 @@ function ge(u) {
|
|
|
4439
4769
|
e.push(s);
|
|
4440
4770
|
continue;
|
|
4441
4771
|
}
|
|
4442
|
-
const i =
|
|
4772
|
+
const i = mn(s);
|
|
4443
4773
|
if (!i) {
|
|
4444
4774
|
e.push(s);
|
|
4445
4775
|
continue;
|
|
4446
4776
|
}
|
|
4447
|
-
const o =
|
|
4777
|
+
const o = xn(s, i).flatMap((a) => L.groupByPath(a));
|
|
4448
4778
|
if (o.length === 1) {
|
|
4449
4779
|
e.push(s);
|
|
4450
4780
|
continue;
|
|
4451
4781
|
}
|
|
4452
4782
|
o.forEach((a) => {
|
|
4453
|
-
a =
|
|
4783
|
+
a = L.brokenLineMerging(a, _), a.length === 4 ? e.push(a) : t.push(a);
|
|
4454
4784
|
});
|
|
4455
4785
|
}
|
|
4456
4786
|
return e;
|
|
4457
4787
|
}
|
|
4458
|
-
function
|
|
4788
|
+
function wn(u) {
|
|
4459
4789
|
const t = [];
|
|
4460
|
-
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u =
|
|
4790
|
+
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = gt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4461
4791
|
}
|
|
4462
|
-
function
|
|
4463
|
-
return t && (u =
|
|
4792
|
+
function Mn(u, t = !0) {
|
|
4793
|
+
return t && (u = wn(u)), u.reduce((n, s) => (C.get(s).forEach((i) => {
|
|
4464
4794
|
let o = i.id ?? "wall";
|
|
4465
4795
|
i.type === "wall" && (o = "wall"), n.append(o, s);
|
|
4466
4796
|
}), n), new H());
|
|
4467
4797
|
}
|
|
4468
|
-
function
|
|
4798
|
+
function Dn(u) {
|
|
4469
4799
|
const t = u.group((i) => C.everyType(i, "bayWindow") ? "wall" : C.everyType(i, "doubleWall") ? "doubleWall" : "wall"), e = t.get("wall") ?? [], n = t.get("doubleWall") ?? [];
|
|
4470
4800
|
let s = [], r = new Set(n.flat());
|
|
4471
4801
|
return e.forEach((i) => {
|
|
4472
4802
|
i.forEach((o) => r.has(o) || s.push(o));
|
|
4473
4803
|
}), n.forEach((i) => {
|
|
4474
|
-
i = [...new Set(i)],
|
|
4804
|
+
i = [...new Set(i)], me(i).forEach((a) => {
|
|
4475
4805
|
if (a.length < 4) return s.push(...a);
|
|
4476
4806
|
a = a.sort((d, f) => d.length() - f.length());
|
|
4477
|
-
const c = a[0], l = a[1], h = new
|
|
4478
|
-
|
|
4807
|
+
const c = a[0], l = a[1], h = new L(c.center.clone(), l.center.clone());
|
|
4808
|
+
_(h, a), h.userData.wallWidth = c.length(), s.push(h), se(h);
|
|
4479
4809
|
});
|
|
4480
4810
|
}), s = s.map((i) => i.clone()), s.filter((i) => !i.userData.isBayWindow);
|
|
4481
4811
|
}
|
|
4482
|
-
function
|
|
4812
|
+
function Ln(u, t = "测试", e = "") {
|
|
4483
4813
|
const s = /* @__PURE__ */ new Map();
|
|
4484
4814
|
let r = 0;
|
|
4485
4815
|
return {
|
|
@@ -4549,10 +4879,10 @@ function xn(u, t = "测试", e = "") {
|
|
|
4549
4879
|
rooms: []
|
|
4550
4880
|
};
|
|
4551
4881
|
}
|
|
4552
|
-
function
|
|
4553
|
-
const n =
|
|
4554
|
-
let s =
|
|
4555
|
-
return s =
|
|
4882
|
+
function xe(u, t = 0, e = !0) {
|
|
4883
|
+
const n = Mn(u, e);
|
|
4884
|
+
let s = Dn(n);
|
|
4885
|
+
return s = mt.rotate(s, t, (r, i, o) => {
|
|
4556
4886
|
r.userData.drawWindow && r.userData.drawWindow.forEach((a) => {
|
|
4557
4887
|
const c = D.from(a.p);
|
|
4558
4888
|
c.rotate(i, o * (Math.PI / 180)), a.p = c.toJson(a.p.z);
|
|
@@ -4560,11 +4890,11 @@ function ye(u, t = 0, e = !0) {
|
|
|
4560
4890
|
}), {
|
|
4561
4891
|
lines: s,
|
|
4562
4892
|
toJson(r = "测试", i = "") {
|
|
4563
|
-
return
|
|
4893
|
+
return Ln(s, r, i);
|
|
4564
4894
|
}
|
|
4565
4895
|
};
|
|
4566
4896
|
}
|
|
4567
|
-
class
|
|
4897
|
+
class we extends z {
|
|
4568
4898
|
static name = "ThreeVJia";
|
|
4569
4899
|
lineSegments = [];
|
|
4570
4900
|
neededUpdate = !0;
|
|
@@ -4581,7 +4911,7 @@ class me extends z {
|
|
|
4581
4911
|
updateData() {
|
|
4582
4912
|
if (!this.neededUpdate) return;
|
|
4583
4913
|
const t = this.parent?.findComponentByName("Dxf"), e = this.parent?.findComponentByName("AngleCorrectionDxf");
|
|
4584
|
-
this.cacheJson =
|
|
4914
|
+
this.cacheJson = xe(t.getLineSegments(), e.angle).toJson(), this.neededUpdate = !1;
|
|
4585
4915
|
}
|
|
4586
4916
|
/** 转为json
|
|
4587
4917
|
* @param name
|
|
@@ -4602,7 +4932,7 @@ class me extends z {
|
|
|
4602
4932
|
} else typeof global < "u" && (await K("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
|
|
4603
4933
|
}
|
|
4604
4934
|
}
|
|
4605
|
-
class tt extends
|
|
4935
|
+
class tt extends Qt {
|
|
4606
4936
|
Dxf;
|
|
4607
4937
|
AngleCorrectionDxf;
|
|
4608
4938
|
Variable;
|
|
@@ -4616,7 +4946,7 @@ class tt extends Zt {
|
|
|
4616
4946
|
* @param scale 原始数据缩放比例
|
|
4617
4947
|
*/
|
|
4618
4948
|
constructor(t = 0.1, e = 1) {
|
|
4619
|
-
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new U(this.wallWidth, e), this.AngleCorrectionDxf = new
|
|
4949
|
+
super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new U(this.wallWidth, e), this.AngleCorrectionDxf = new ge(), this.Variable = new Ct(), this.LineAnalysis = new Bt(), this.DoorsAnalysis = new ye(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(this.LineAnalysis), this.addComponent(this.DoorsAnalysis), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new we()), tt.finalInstance = this;
|
|
4620
4950
|
}
|
|
4621
4951
|
usePlugin(t) {
|
|
4622
4952
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -4629,19 +4959,19 @@ class tt extends Zt {
|
|
|
4629
4959
|
});
|
|
4630
4960
|
}
|
|
4631
4961
|
}
|
|
4632
|
-
const
|
|
4633
|
-
LineAnalysis:
|
|
4634
|
-
ThreeVJia:
|
|
4635
|
-
Variable:
|
|
4962
|
+
const En = {
|
|
4963
|
+
LineAnalysis: Bt,
|
|
4964
|
+
ThreeVJia: we,
|
|
4965
|
+
Variable: Ct,
|
|
4636
4966
|
Dxf: U,
|
|
4637
|
-
DoorsAnalysisComponent:
|
|
4638
|
-
AngleCorrectionDxf:
|
|
4967
|
+
DoorsAnalysisComponent: ye,
|
|
4968
|
+
AngleCorrectionDxf: ge
|
|
4639
4969
|
};
|
|
4640
|
-
function
|
|
4970
|
+
function Sn(u) {
|
|
4641
4971
|
const t = [];
|
|
4642
|
-
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u =
|
|
4972
|
+
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = gt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4643
4973
|
}
|
|
4644
|
-
function
|
|
4974
|
+
function Wt(u, t, e) {
|
|
4645
4975
|
return e.reduce((n, s, r) => {
|
|
4646
4976
|
const i = s.userData;
|
|
4647
4977
|
if (i.parallel(u)) n[0] = r;
|
|
@@ -4652,23 +4982,23 @@ function kt(u, t, e) {
|
|
|
4652
4982
|
return n;
|
|
4653
4983
|
}, [-1, -1, -1]);
|
|
4654
4984
|
}
|
|
4655
|
-
function
|
|
4656
|
-
const { point: r } = u[e[0]], i = new
|
|
4985
|
+
function bn(u, t, e, n, s) {
|
|
4986
|
+
const { point: r } = u[e[0]], i = new L(r.clone(), t.clone());
|
|
4657
4987
|
return i.points.forEach((o) => s.insert(o, i)), n.push(i), i;
|
|
4658
4988
|
}
|
|
4659
|
-
function
|
|
4989
|
+
function Tn(u, t, e, n) {
|
|
4660
4990
|
const { point: s } = u[e[1]];
|
|
4661
4991
|
s.copy(t), n.update(s);
|
|
4662
4992
|
}
|
|
4663
|
-
function
|
|
4993
|
+
function An(u, t, e, n) {
|
|
4664
4994
|
const { point: s } = u[e[2]];
|
|
4665
4995
|
s.copy(t), n.update(s);
|
|
4666
4996
|
}
|
|
4667
|
-
function
|
|
4997
|
+
function Yt(u, t, e, n, s) {
|
|
4668
4998
|
const r = e[0] > -1, i = e[1] > -1, o = e[2] > -1;
|
|
4669
|
-
if (i &&
|
|
4670
|
-
const a =
|
|
4671
|
-
i && (a.userData =
|
|
4999
|
+
if (i && Tn(t, u, e, s), r) {
|
|
5000
|
+
const a = bn(t, u, e, n, s);
|
|
5001
|
+
i && (a.userData = k(t[e[1]].userData?.userData ?? {}));
|
|
4672
5002
|
return;
|
|
4673
5003
|
}
|
|
4674
5004
|
if (o) {
|
|
@@ -4676,27 +5006,27 @@ function Wt(u, t, e, n, s) {
|
|
|
4676
5006
|
const a = t[e[1]].userData;
|
|
4677
5007
|
u = a.start.distance(t[e[2]].point) < a.end.distance(t[e[2]].point) ? a.start : a.end;
|
|
4678
5008
|
}
|
|
4679
|
-
|
|
5009
|
+
An(t, u, e, s);
|
|
4680
5010
|
}
|
|
4681
5011
|
}
|
|
4682
|
-
function
|
|
4683
|
-
const s = n.queryPoint(u.start, !0), r = n.queryPoint(u.end, !0), i = u.userData.expandDirect, o =
|
|
4684
|
-
u.directionMove(c, t * 0.5), u.points.forEach((l) => n.update(l)),
|
|
5012
|
+
function Pn(u, t = 0.12, e, n) {
|
|
5013
|
+
const s = n.queryPoint(u.start, !0), r = n.queryPoint(u.end, !0), i = u.userData.expandDirect, o = Wt(u, i, s), a = Wt(u, i, r), c = i === "left" ? u.getRightDirection() : u.getLeftDirection();
|
|
5014
|
+
u.directionMove(c, t * 0.5), u.points.forEach((l) => n.update(l)), Yt(u.start, s, o, e, n), Yt(u.end, r, a, e, n);
|
|
4685
5015
|
}
|
|
4686
|
-
class
|
|
5016
|
+
class Nt {
|
|
4687
5017
|
/** 通过轨迹点查找外墙
|
|
4688
5018
|
* @param lines
|
|
4689
5019
|
* @param trajectoryPoints
|
|
4690
5020
|
* @returns
|
|
4691
5021
|
*/
|
|
4692
5022
|
static findExtWallByTraj(t, e, n = 0.4) {
|
|
4693
|
-
const s = new
|
|
5023
|
+
const s = new B(v.fromByLineSegment(...t));
|
|
4694
5024
|
return t.forEach((r) => s.insert({ line: r, userData: void 0 })), t = t.filter((r) => {
|
|
4695
5025
|
if (C.hasType(r, "doubleWall") || r.userData.isDoor || r.userData.isBayWindow) return;
|
|
4696
5026
|
const i = r.center, o = /* @__PURE__ */ new Set();
|
|
4697
5027
|
for (const a of e) {
|
|
4698
5028
|
if (o.size === 2) break;
|
|
4699
|
-
const c = new
|
|
5029
|
+
const c = new L(i, a);
|
|
4700
5030
|
if (!s.queryLineSegment(c).filter((h) => h.line === r ? !1 : r.userData.groupType === "wall" ? !0 : !(h.line.parallel(r) && r.getMinLength(h.line) < n && h.line.projectLineSegment(r).length() / r.length() > 0.6)).length) {
|
|
4701
5031
|
const h = r.pointPosition(a);
|
|
4702
5032
|
h !== "on" && o.add(h);
|
|
@@ -4712,7 +5042,7 @@ class Ct {
|
|
|
4712
5042
|
static boundExtbyTrajAndOriginalData(t) {
|
|
4713
5043
|
const e = [];
|
|
4714
5044
|
let n = t.data.map(({ start: r, end: i, ...o }) => {
|
|
4715
|
-
const a = new
|
|
5045
|
+
const a = new L(D.from(r), D.from(i));
|
|
4716
5046
|
return a.userData = o, e.push(r.z ?? 0, i.z ?? 0), a;
|
|
4717
5047
|
});
|
|
4718
5048
|
const s = e.reduce((r, i) => r + i, 0) / e.length;
|
|
@@ -4727,23 +5057,23 @@ class Ct {
|
|
|
4727
5057
|
*/
|
|
4728
5058
|
static boundExtbyTraj(t) {
|
|
4729
5059
|
let { lines: e, trajectory: n, wallWidth: s = 0.12, updateDoubleWallGroup: r = !1, findCallBack: i } = t;
|
|
4730
|
-
r && (e =
|
|
5060
|
+
r && (e = Sn(e));
|
|
4731
5061
|
const o = Object.keys(n).map((d) => D.from(n[d]));
|
|
4732
|
-
let c =
|
|
5062
|
+
let c = Nt.findExtWallByTraj(e, o).filter((d) => d.userData.expandDirect);
|
|
4733
5063
|
e = e.filter((d) => !c.includes(d)), e.push(...c), i && i(c, o);
|
|
4734
5064
|
const l = $(e), h = [];
|
|
4735
5065
|
return c.forEach((d) => {
|
|
4736
|
-
d.userData.isDoor ||
|
|
4737
|
-
}), e.push(...h.filter((d) => d.length() > 1e-9)),
|
|
5066
|
+
d.userData.isDoor || Pn(d, s, h, l);
|
|
5067
|
+
}), e.push(...h.filter((d) => d.length() > 1e-9)), at(...e), {
|
|
4738
5068
|
lines: e,
|
|
4739
5069
|
toOriginalData(d) {
|
|
4740
|
-
return
|
|
5070
|
+
return it(e, d);
|
|
4741
5071
|
}
|
|
4742
5072
|
};
|
|
4743
5073
|
}
|
|
4744
5074
|
}
|
|
4745
|
-
function
|
|
4746
|
-
const t = new
|
|
5075
|
+
function Me(u) {
|
|
5076
|
+
const t = new mt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
4747
5077
|
function r(i) {
|
|
4748
5078
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
4749
5079
|
if (!n.has(a))
|
|
@@ -4758,8 +5088,8 @@ function xe(u) {
|
|
|
4758
5088
|
n.has(i) || r(i);
|
|
4759
5089
|
}), s;
|
|
4760
5090
|
}
|
|
4761
|
-
function
|
|
4762
|
-
const e = $(u), n = new
|
|
5091
|
+
function In(u, t) {
|
|
5092
|
+
const e = $(u), n = new L(), s = new L(), r = [], i = /* @__PURE__ */ new Set();
|
|
4763
5093
|
function o(c, l) {
|
|
4764
5094
|
const h = c.center, d = c.normal();
|
|
4765
5095
|
n.start.copy(h), n.end.copy(h).add(d.clone().multiplyScalar(1));
|
|
@@ -4774,13 +5104,13 @@ function bn(u, t) {
|
|
|
4774
5104
|
if (g)
|
|
4775
5105
|
if (l.vertical(d)) y = o(l, f);
|
|
4776
5106
|
else {
|
|
4777
|
-
const M = l.center, w = M.distance(f.start),
|
|
4778
|
-
y = f.directionMove(
|
|
5107
|
+
const M = l.center, w = M.distance(f.start), E = M.direction(f.start);
|
|
5108
|
+
y = f.directionMove(E, w);
|
|
4779
5109
|
}
|
|
4780
5110
|
else y = f;
|
|
4781
5111
|
let x = e.queryPoint(m, !0);
|
|
4782
5112
|
if (x.length === 1) {
|
|
4783
|
-
const M = x[0], w = M.userData,
|
|
5113
|
+
const M = x[0], w = M.userData, E = w.getAnotherPoint(M.point), b = E.direction(M.point);
|
|
4784
5114
|
if (c === w) return p;
|
|
4785
5115
|
if (w.vertical(l)) {
|
|
4786
5116
|
const S = m.direction(h), T = w.center, A = b.angleBetween(y.direction()) < 1e-9;
|
|
@@ -4789,14 +5119,14 @@ function bn(u, t) {
|
|
|
4789
5119
|
} else {
|
|
4790
5120
|
s.start.copy(y.start).add(y.direction().multiplyScalar(5e-3));
|
|
4791
5121
|
const M = [l, ...x.map((w) => {
|
|
4792
|
-
const
|
|
4793
|
-
return
|
|
5122
|
+
const E = w.userData;
|
|
5123
|
+
return E.length(), E;
|
|
4794
5124
|
})];
|
|
4795
5125
|
for (let w = 0; w < x.length; w++) {
|
|
4796
|
-
const
|
|
5126
|
+
const E = x[w], b = E.userData;
|
|
4797
5127
|
if (c === b) return p;
|
|
4798
5128
|
if (!(x.length === 4 && b.parallel(l)) && (s.end.copy(b.center), !M.some((S) => S === b ? !1 : S.intersectLineSegment(s))))
|
|
4799
|
-
return p.push(b), a(c, b,
|
|
5129
|
+
return p.push(b), a(c, b, E.point, l, y, p);
|
|
4800
5130
|
}
|
|
4801
5131
|
}
|
|
4802
5132
|
}
|
|
@@ -4810,7 +5140,7 @@ function bn(u, t) {
|
|
|
4810
5140
|
const M = y[x];
|
|
4811
5141
|
let w = g[x];
|
|
4812
5142
|
M.userData?.parallel(l) && (w = g[x ? 0 : 1].clone().multiplyScalar(-1)), i.clear();
|
|
4813
|
-
const
|
|
5143
|
+
const E = new L(h.clone(), h.clone().add(w.clone().multiplyScalar(0.2))), b = a(l, M.userData, M.point, l, E, [l, M.userData]);
|
|
4814
5144
|
b && m.push([...b]);
|
|
4815
5145
|
}
|
|
4816
5146
|
if (m.length === 2) {
|
|
@@ -4821,11 +5151,11 @@ function bn(u, t) {
|
|
|
4821
5151
|
}
|
|
4822
5152
|
return r;
|
|
4823
5153
|
}
|
|
4824
|
-
function
|
|
5154
|
+
function vn(u) {
|
|
4825
5155
|
const t = new H(), e = [];
|
|
4826
5156
|
u.forEach((n) => t.append(n.length, n));
|
|
4827
5157
|
for (const n of t.values()) {
|
|
4828
|
-
const s = new
|
|
5158
|
+
const s = new yt(n.flat()), r = new H();
|
|
4829
5159
|
n.map((i) => {
|
|
4830
5160
|
const o = i.map((a) => s.getIndex(a)).sort((a, c) => a - c).join(",");
|
|
4831
5161
|
r.append(o, i);
|
|
@@ -4833,29 +5163,29 @@ function Tn(u) {
|
|
|
4833
5163
|
}
|
|
4834
5164
|
return e;
|
|
4835
5165
|
}
|
|
4836
|
-
function
|
|
4837
|
-
const e =
|
|
5166
|
+
function Rn(u, t) {
|
|
5167
|
+
const e = In(u, t), n = /* @__PURE__ */ new Map(), s = new Q(e.length), r = [];
|
|
4838
5168
|
e.forEach((a, c) => {
|
|
4839
5169
|
for (let l = 0; l < a.length; l++) {
|
|
4840
5170
|
const h = a[l];
|
|
4841
5171
|
n.has(h) ? s.union(c, n.get(h)) : n.set(h, c);
|
|
4842
5172
|
}
|
|
4843
5173
|
});
|
|
4844
|
-
const i = new
|
|
5174
|
+
const i = new pt(), o = s.getAllSets().valueArray.map((a) => {
|
|
4845
5175
|
let c = a.map((h) => e[h]);
|
|
4846
|
-
return c.length === 1 ? c[0] : (i.clear(), c =
|
|
5176
|
+
return c.length === 1 ? c[0] : (i.clear(), c = vn(c), c.forEach((h) => h.forEach((d) => i.set(d))), i.reduce((h, d, f) => (d === 1 ? h.push(f) : r.push(f), h), []));
|
|
4847
5177
|
});
|
|
4848
5178
|
return {
|
|
4849
5179
|
internalEdges: r,
|
|
4850
5180
|
rings: o
|
|
4851
5181
|
};
|
|
4852
5182
|
}
|
|
4853
|
-
function
|
|
4854
|
-
const t =
|
|
5183
|
+
function Cn(u) {
|
|
5184
|
+
const t = L.groupByPath(u), e = [], n = [];
|
|
4855
5185
|
t.forEach((i, o) => {
|
|
4856
5186
|
try {
|
|
4857
|
-
let a =
|
|
4858
|
-
const c =
|
|
5187
|
+
let a = Me(i);
|
|
5188
|
+
const c = Rn(i, a);
|
|
4859
5189
|
e.push(...c.rings), n.push(...c.internalEdges);
|
|
4860
5190
|
} catch (a) {
|
|
4861
5191
|
console.warn("环查找出现异常:", a.message);
|
|
@@ -4868,15 +5198,34 @@ function Pn(u) {
|
|
|
4868
5198
|
internalEdges: n
|
|
4869
5199
|
};
|
|
4870
5200
|
}
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
5201
|
+
class Bn {
|
|
5202
|
+
lines = [];
|
|
5203
|
+
/** 添加线段
|
|
5204
|
+
* @param arg
|
|
5205
|
+
*/
|
|
5206
|
+
addLine(...t) {
|
|
5207
|
+
this.lines.push(...t);
|
|
5208
|
+
}
|
|
5209
|
+
removeLine() {
|
|
5210
|
+
}
|
|
5211
|
+
/** 添加线偏移
|
|
5212
|
+
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
5213
|
+
*/
|
|
5214
|
+
addLineByOffset(t, e = et.EndType.etOpenSquare, n = et.JoinType.jtMiter, s = 1e4) {
|
|
5215
|
+
return new et.Paths(), new et.ClipperOffset(20, 0.25), L.groupByPoint(t), this;
|
|
5216
|
+
}
|
|
5217
|
+
clear() {
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
function De(u, t, e = 1e-3) {
|
|
5221
|
+
if (Array.isArray(u) && u[0] instanceof D) {
|
|
5222
|
+
const s = u;
|
|
5223
|
+
u = s.map((r, i) => {
|
|
4875
5224
|
const o = s[(i + 1) % s.length];
|
|
4876
|
-
return new
|
|
5225
|
+
return new L(r, o);
|
|
4877
5226
|
});
|
|
4878
5227
|
}
|
|
4879
|
-
if (u instanceof
|
|
5228
|
+
if (u instanceof L) return De([u], t, e);
|
|
4880
5229
|
const n = tt.finalInstance;
|
|
4881
5230
|
if (n) {
|
|
4882
5231
|
const s = n.findComponentByName("Renderer");
|
|
@@ -4888,7 +5237,7 @@ function we(u, t, e = 1e-3) {
|
|
|
4888
5237
|
}
|
|
4889
5238
|
}
|
|
4890
5239
|
}
|
|
4891
|
-
function
|
|
5240
|
+
function Nn(u, t, e = 1e-3) {
|
|
4892
5241
|
const n = tt.finalInstance;
|
|
4893
5242
|
if (n) {
|
|
4894
5243
|
const s = n.findComponentByName("Renderer");
|
|
@@ -4898,7 +5247,7 @@ function In(u, t, e = 1e-3) {
|
|
|
4898
5247
|
}
|
|
4899
5248
|
}
|
|
4900
5249
|
}
|
|
4901
|
-
function
|
|
5250
|
+
function jn(u, t, e, n = 1e-3) {
|
|
4902
5251
|
const s = tt.finalInstance;
|
|
4903
5252
|
if (s) {
|
|
4904
5253
|
const r = s.findComponentByName("Renderer"), i = s.findComponentByName("Editor");
|
|
@@ -4908,7 +5257,7 @@ function vn(u, t, e, n = 1e-3) {
|
|
|
4908
5257
|
}
|
|
4909
5258
|
}
|
|
4910
5259
|
}
|
|
4911
|
-
const
|
|
5260
|
+
const Xt = {
|
|
4912
5261
|
POSITION: [
|
|
4913
5262
|
"byte",
|
|
4914
5263
|
"byte normalized",
|
|
@@ -4936,36 +5285,36 @@ const Yt = {
|
|
|
4936
5285
|
"unsigned short"
|
|
4937
5286
|
]
|
|
4938
5287
|
};
|
|
4939
|
-
class
|
|
5288
|
+
class ft {
|
|
4940
5289
|
constructor() {
|
|
4941
5290
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
4942
|
-
return new Un(t);
|
|
4943
|
-
}), this.register(function(t) {
|
|
4944
|
-
return new _n(t);
|
|
4945
|
-
}), this.register(function(t) {
|
|
4946
5291
|
return new Xn(t);
|
|
4947
5292
|
}), this.register(function(t) {
|
|
4948
5293
|
return new Vn(t);
|
|
4949
5294
|
}), this.register(function(t) {
|
|
4950
|
-
return new
|
|
5295
|
+
return new Kn(t);
|
|
4951
5296
|
}), this.register(function(t) {
|
|
4952
|
-
return new
|
|
5297
|
+
return new Zn(t);
|
|
4953
5298
|
}), this.register(function(t) {
|
|
4954
|
-
return new
|
|
5299
|
+
return new Qn(t);
|
|
4955
5300
|
}), this.register(function(t) {
|
|
4956
|
-
return new
|
|
5301
|
+
return new ts(t);
|
|
4957
5302
|
}), this.register(function(t) {
|
|
4958
|
-
return new
|
|
5303
|
+
return new Hn(t);
|
|
5304
|
+
}), this.register(function(t) {
|
|
5305
|
+
return new $n(t);
|
|
4959
5306
|
}), this.register(function(t) {
|
|
4960
5307
|
return new Jn(t);
|
|
4961
5308
|
}), this.register(function(t) {
|
|
4962
|
-
return new
|
|
5309
|
+
return new es(t);
|
|
4963
5310
|
}), this.register(function(t) {
|
|
4964
|
-
return new
|
|
5311
|
+
return new ns(t);
|
|
4965
5312
|
}), this.register(function(t) {
|
|
4966
|
-
return new
|
|
5313
|
+
return new ss(t);
|
|
4967
5314
|
}), this.register(function(t) {
|
|
4968
|
-
return new
|
|
5315
|
+
return new rs(t);
|
|
5316
|
+
}), this.register(function(t) {
|
|
5317
|
+
return new is(t);
|
|
4969
5318
|
});
|
|
4970
5319
|
}
|
|
4971
5320
|
register(t) {
|
|
@@ -4978,7 +5327,7 @@ class dt {
|
|
|
4978
5327
|
return this.textureUtils = t, this;
|
|
4979
5328
|
}
|
|
4980
5329
|
parse(t, e, n, s) {
|
|
4981
|
-
const r = new
|
|
5330
|
+
const r = new Yn(), i = [];
|
|
4982
5331
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
4983
5332
|
i.push(this.pluginCallbacks[o](r));
|
|
4984
5333
|
r.setPlugins(i), r.setTextureUtils(this.textureUtils), r.writeAsync(t, e, s).catch(n);
|
|
@@ -5014,34 +5363,34 @@ const P = {
|
|
|
5014
5363
|
CLAMP_TO_EDGE: 33071,
|
|
5015
5364
|
MIRRORED_REPEAT: 33648,
|
|
5016
5365
|
REPEAT: 10497
|
|
5017
|
-
},
|
|
5018
|
-
O[
|
|
5019
|
-
O[
|
|
5020
|
-
O[
|
|
5021
|
-
O[
|
|
5022
|
-
O[
|
|
5366
|
+
}, Lt = "KHR_mesh_quantization", O = {};
|
|
5367
|
+
O[qe] = P.NEAREST;
|
|
5368
|
+
O[Ge] = P.NEAREST_MIPMAP_NEAREST;
|
|
5369
|
+
O[ze] = P.NEAREST_MIPMAP_LINEAR;
|
|
5370
|
+
O[Ue] = P.LINEAR;
|
|
5371
|
+
O[ke] = P.LINEAR_MIPMAP_NEAREST;
|
|
5023
5372
|
O[_e] = P.LINEAR_MIPMAP_LINEAR;
|
|
5024
|
-
O[
|
|
5025
|
-
O[
|
|
5026
|
-
O[
|
|
5027
|
-
const
|
|
5373
|
+
O[We] = P.CLAMP_TO_EDGE;
|
|
5374
|
+
O[Ye] = P.REPEAT;
|
|
5375
|
+
O[Xe] = P.MIRRORED_REPEAT;
|
|
5376
|
+
const Vt = {
|
|
5028
5377
|
scale: "scale",
|
|
5029
5378
|
position: "translation",
|
|
5030
5379
|
quaternion: "rotation",
|
|
5031
5380
|
morphTargetInfluences: "weights"
|
|
5032
|
-
},
|
|
5033
|
-
function
|
|
5381
|
+
}, Fn = new Pe(), Ht = 12, On = 1179937895, qn = 2, $t = 8, Gn = 1313821514, zn = 5130562;
|
|
5382
|
+
function rt(u, t) {
|
|
5034
5383
|
return u.length === t.length && u.every(function(e, n) {
|
|
5035
5384
|
return e === t[n];
|
|
5036
5385
|
});
|
|
5037
5386
|
}
|
|
5038
|
-
function
|
|
5387
|
+
function Un(u) {
|
|
5039
5388
|
return new TextEncoder().encode(u).buffer;
|
|
5040
5389
|
}
|
|
5041
|
-
function
|
|
5042
|
-
return
|
|
5390
|
+
function kn(u) {
|
|
5391
|
+
return rt(u.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
5043
5392
|
}
|
|
5044
|
-
function
|
|
5393
|
+
function _n(u, t, e) {
|
|
5045
5394
|
const n = {
|
|
5046
5395
|
min: new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
5047
5396
|
max: new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -5049,15 +5398,15 @@ function qn(u, t, e) {
|
|
|
5049
5398
|
for (let s = t; s < t + e; s++)
|
|
5050
5399
|
for (let r = 0; r < u.itemSize; r++) {
|
|
5051
5400
|
let i;
|
|
5052
|
-
u.itemSize > 4 ? i = u.array[s * u.itemSize + r] : (r === 0 ? i = u.getX(s) : r === 1 ? i = u.getY(s) : r === 2 ? i = u.getZ(s) : r === 3 && (i = u.getW(s)), u.normalized === !0 && (i =
|
|
5401
|
+
u.itemSize > 4 ? i = u.array[s * u.itemSize + r] : (r === 0 ? i = u.getX(s) : r === 1 ? i = u.getY(s) : r === 2 ? i = u.getZ(s) : r === 3 && (i = u.getW(s)), u.normalized === !0 && (i = bt.normalize(i, u.array))), n.min[r] = Math.min(n.min[r], i), n.max[r] = Math.max(n.max[r], i);
|
|
5053
5402
|
}
|
|
5054
5403
|
return n;
|
|
5055
5404
|
}
|
|
5056
|
-
function
|
|
5405
|
+
function Le(u) {
|
|
5057
5406
|
return Math.ceil(u / 4) * 4;
|
|
5058
5407
|
}
|
|
5059
|
-
function
|
|
5060
|
-
const e =
|
|
5408
|
+
function Et(u, t = 0) {
|
|
5409
|
+
const e = Le(u.byteLength);
|
|
5061
5410
|
if (e !== u.byteLength) {
|
|
5062
5411
|
const n = new Uint8Array(e);
|
|
5063
5412
|
if (n.set(new Uint8Array(u)), t !== 0)
|
|
@@ -5067,10 +5416,10 @@ function Mt(u, t = 0) {
|
|
|
5067
5416
|
}
|
|
5068
5417
|
return u;
|
|
5069
5418
|
}
|
|
5070
|
-
function
|
|
5419
|
+
function Jt() {
|
|
5071
5420
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
5072
5421
|
}
|
|
5073
|
-
function
|
|
5422
|
+
function Wn(u, t) {
|
|
5074
5423
|
if (typeof OffscreenCanvas < "u" && u instanceof OffscreenCanvas) {
|
|
5075
5424
|
let e;
|
|
5076
5425
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), u.convertToBlob({
|
|
@@ -5080,12 +5429,12 @@ function Gn(u, t) {
|
|
|
5080
5429
|
} else
|
|
5081
5430
|
return new Promise((e) => u.toBlob(e, t));
|
|
5082
5431
|
}
|
|
5083
|
-
class
|
|
5432
|
+
class Yn {
|
|
5084
5433
|
constructor() {
|
|
5085
5434
|
this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
|
|
5086
5435
|
asset: {
|
|
5087
5436
|
version: "2.0",
|
|
5088
|
-
generator: "THREE.GLTFExporter r" +
|
|
5437
|
+
generator: "THREE.GLTFExporter r" + ve
|
|
5089
5438
|
}
|
|
5090
5439
|
}, this.cache = {
|
|
5091
5440
|
meshes: /* @__PURE__ */ new Map(),
|
|
@@ -5122,14 +5471,14 @@ class zn {
|
|
|
5122
5471
|
const s = this, r = s.buffers, i = s.json;
|
|
5123
5472
|
n = s.options;
|
|
5124
5473
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(r, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
5125
|
-
l.length > 0 && (i.extensionsUsed = l), h.length > 0 && (i.extensionsRequired = h), i.buffers && i.buffers.length > 0 && (i.buffers[0].byteLength = c.size), n.binary === !0 ?
|
|
5126
|
-
const f =
|
|
5127
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
5128
|
-
const g =
|
|
5129
|
-
y.setUint32(0, g.byteLength, !0), y.setUint32(4,
|
|
5130
|
-
const m = new ArrayBuffer(
|
|
5131
|
-
x.setUint32(0,
|
|
5132
|
-
const M =
|
|
5474
|
+
l.length > 0 && (i.extensionsUsed = l), h.length > 0 && (i.extensionsRequired = h), i.buffers && i.buffers.length > 0 && (i.buffers[0].byteLength = c.size), n.binary === !0 ? St(c).then(function(d) {
|
|
5475
|
+
const f = Et(d), p = new DataView(new ArrayBuffer($t));
|
|
5476
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, zn, !0);
|
|
5477
|
+
const g = Et(Un(JSON.stringify(i)), 32), y = new DataView(new ArrayBuffer($t));
|
|
5478
|
+
y.setUint32(0, g.byteLength, !0), y.setUint32(4, Gn, !0);
|
|
5479
|
+
const m = new ArrayBuffer(Ht), x = new DataView(m);
|
|
5480
|
+
x.setUint32(0, On, !0), x.setUint32(4, qn, !0);
|
|
5481
|
+
const M = Ht + y.byteLength + g.byteLength + p.byteLength + f.byteLength;
|
|
5133
5482
|
x.setUint32(8, M, !0);
|
|
5134
5483
|
const w = new Blob([
|
|
5135
5484
|
m,
|
|
@@ -5138,10 +5487,10 @@ class zn {
|
|
|
5138
5487
|
p,
|
|
5139
5488
|
f
|
|
5140
5489
|
], { type: "application/octet-stream" });
|
|
5141
|
-
|
|
5142
|
-
e(
|
|
5490
|
+
St(w).then((E) => {
|
|
5491
|
+
e(E);
|
|
5143
5492
|
});
|
|
5144
|
-
}) : i.buffers && i.buffers.length > 0 ?
|
|
5493
|
+
}) : i.buffers && i.buffers.length > 0 ? os(c).then((d) => {
|
|
5145
5494
|
i.buffers[0].uri = d, e(i);
|
|
5146
5495
|
}) : e(i);
|
|
5147
5496
|
}
|
|
@@ -5189,7 +5538,7 @@ class zn {
|
|
|
5189
5538
|
*/
|
|
5190
5539
|
isNormalizedNormalAttribute(t) {
|
|
5191
5540
|
if (this.cache.attributesNormalized.has(t)) return !1;
|
|
5192
|
-
const n = new
|
|
5541
|
+
const n = new ht();
|
|
5193
5542
|
for (let s = 0, r = t.count; s < r; s++)
|
|
5194
5543
|
if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
|
|
5195
5544
|
return !0;
|
|
@@ -5204,7 +5553,7 @@ class zn {
|
|
|
5204
5553
|
createNormalizedNormalAttribute(t) {
|
|
5205
5554
|
const e = this.cache;
|
|
5206
5555
|
if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
|
|
5207
|
-
const n = t.clone(), s = new
|
|
5556
|
+
const n = t.clone(), s = new ht();
|
|
5208
5557
|
for (let r = 0, i = n.count; r < i; r++)
|
|
5209
5558
|
s.fromBufferAttribute(n, r), s.x === 0 && s.y === 0 && s.z === 0 ? s.setX(1) : s.normalize(), n.setXYZ(r, s.x, s.y, s.z);
|
|
5210
5559
|
return e.attributesNormalized.set(t, n), n;
|
|
@@ -5224,14 +5573,14 @@ class zn {
|
|
|
5224
5573
|
async buildMetalRoughTextureAsync(t, e) {
|
|
5225
5574
|
if (t === e) return t;
|
|
5226
5575
|
function n(f) {
|
|
5227
|
-
return f.colorSpace ===
|
|
5576
|
+
return f.colorSpace === Oe ? function(g) {
|
|
5228
5577
|
return g < 0.04045 ? g * 0.0773993808 : Math.pow(g * 0.9478672986 + 0.0521327014, 2.4);
|
|
5229
5578
|
} : function(g) {
|
|
5230
5579
|
return g;
|
|
5231
5580
|
};
|
|
5232
5581
|
}
|
|
5233
|
-
t instanceof
|
|
5234
|
-
const s = t ? t.image : null, r = e ? e.image : null, i = Math.max(s ? s.width : 0, r ? r.width : 0), o = Math.max(s ? s.height : 0, r ? r.height : 0), a =
|
|
5582
|
+
t instanceof wt && (t = await this.decompressTextureAsync(t)), e instanceof wt && (e = await this.decompressTextureAsync(e));
|
|
5583
|
+
const s = t ? t.image : null, r = e ? e.image : null, i = Math.max(s ? s.width : 0, r ? r.width : 0), o = Math.max(s ? s.height : 0, r ? r.height : 0), a = Jt();
|
|
5235
5584
|
a.width = i, a.height = o;
|
|
5236
5585
|
const c = a.getContext("2d", {
|
|
5237
5586
|
willReadFrequently: !0
|
|
@@ -5252,7 +5601,7 @@ class zn {
|
|
|
5252
5601
|
}
|
|
5253
5602
|
c.putImageData(l, 0, 0);
|
|
5254
5603
|
const d = (t || e).clone();
|
|
5255
|
-
return d.source = new
|
|
5604
|
+
return d.source = new Re(a), d.colorSpace = Ce, d.channel = (t || e).channel, t && e && t.channel !== e.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), d;
|
|
5256
5605
|
}
|
|
5257
5606
|
async decompressTextureAsync(t, e = 1 / 0) {
|
|
5258
5607
|
if (this.textureUtils === null)
|
|
@@ -5295,12 +5644,12 @@ class zn {
|
|
|
5295
5644
|
}
|
|
5296
5645
|
let a = t.itemSize * o;
|
|
5297
5646
|
r === P.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
|
|
5298
|
-
const c =
|
|
5647
|
+
const c = Le(s * a), l = new DataView(new ArrayBuffer(c));
|
|
5299
5648
|
let h = 0;
|
|
5300
5649
|
for (let p = n; p < n + s; p++) {
|
|
5301
5650
|
for (let g = 0; g < t.itemSize; g++) {
|
|
5302
5651
|
let y;
|
|
5303
|
-
t.itemSize > 4 ? y = t.array[p * t.itemSize + g] : (g === 0 ? y = t.getX(p) : g === 1 ? y = t.getY(p) : g === 2 ? y = t.getZ(p) : g === 3 && (y = t.getW(p)), t.normalized === !0 && (y =
|
|
5652
|
+
t.itemSize > 4 ? y = t.array[p * t.itemSize + g] : (g === 0 ? y = t.getX(p) : g === 1 ? y = t.getY(p) : g === 2 ? y = t.getZ(p) : g === 3 && (y = t.getW(p)), t.normalized === !0 && (y = bt.normalize(y, t.array))), e === P.FLOAT ? l.setFloat32(h, y, !0) : e === P.INT ? l.setInt32(h, y, !0) : e === P.UNSIGNED_INT ? l.setUint32(h, y, !0) : e === P.SHORT ? l.setInt16(h, y, !0) : e === P.UNSIGNED_SHORT ? l.setUint16(h, y, !0) : e === P.BYTE ? l.setInt8(h, y) : e === P.UNSIGNED_BYTE && l.setUint8(h, y), h += o;
|
|
5304
5653
|
}
|
|
5305
5654
|
h % a !== 0 && (h += a - h % a);
|
|
5306
5655
|
}
|
|
@@ -5322,8 +5671,8 @@ class zn {
|
|
|
5322
5671
|
processBufferViewImage(t) {
|
|
5323
5672
|
const e = this, n = e.json;
|
|
5324
5673
|
return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
|
|
5325
|
-
|
|
5326
|
-
const i =
|
|
5674
|
+
St(t).then((r) => {
|
|
5675
|
+
const i = Et(r), o = {
|
|
5327
5676
|
buffer: e.processBuffer(i),
|
|
5328
5677
|
byteOffset: e.byteOffset,
|
|
5329
5678
|
byteLength: i.byteLength
|
|
@@ -5367,7 +5716,7 @@ class zn {
|
|
|
5367
5716
|
else
|
|
5368
5717
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
5369
5718
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
5370
|
-
const a =
|
|
5719
|
+
const a = _n(t, n, s);
|
|
5371
5720
|
let c;
|
|
5372
5721
|
e !== void 0 && (c = t === e.index ? P.ELEMENT_ARRAY_BUFFER : P.ARRAY_BUFFER);
|
|
5373
5722
|
const l = this.processBufferView(t, o, n, s, c), h = {
|
|
@@ -5396,13 +5745,13 @@ class zn {
|
|
|
5396
5745
|
const l = i.images.get(t), h = s + ":flipY/" + n.toString();
|
|
5397
5746
|
if (l[h] !== void 0) return l[h];
|
|
5398
5747
|
o.images || (o.images = []);
|
|
5399
|
-
const d = { mimeType: s }, f =
|
|
5748
|
+
const d = { mimeType: s }, f = Jt();
|
|
5400
5749
|
f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
|
|
5401
5750
|
const p = f.getContext("2d", {
|
|
5402
5751
|
willReadFrequently: !0
|
|
5403
5752
|
});
|
|
5404
5753
|
if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
|
|
5405
|
-
e !==
|
|
5754
|
+
e !== Be && console.error("GLTFExporter: Only RGBAFormat is supported.", e), (t.width > a.maxTextureSize || t.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", t);
|
|
5406
5755
|
const y = new Uint8ClampedArray(t.height * t.width * 4);
|
|
5407
5756
|
for (let m = 0; m < y.length; m += 4)
|
|
5408
5757
|
y[m + 0] = t.data[m + 0], y[m + 1] = t.data[m + 1], y[m + 2] = t.data[m + 2], y[m + 3] = t.data[m + 3];
|
|
@@ -5412,7 +5761,7 @@ class zn {
|
|
|
5412
5761
|
else
|
|
5413
5762
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
5414
5763
|
a.binary === !0 ? c.push(
|
|
5415
|
-
|
|
5764
|
+
Wn(f, s).then((y) => r.processBufferViewImage(y)).then((y) => {
|
|
5416
5765
|
d.bufferView = y;
|
|
5417
5766
|
})
|
|
5418
5767
|
) : d.uri = Ne.getDataURL(f, s);
|
|
@@ -5445,7 +5794,7 @@ class zn {
|
|
|
5445
5794
|
async processTextureAsync(t) {
|
|
5446
5795
|
const n = this.options, s = this.cache, r = this.json;
|
|
5447
5796
|
if (s.textures.has(t)) return s.textures.get(t);
|
|
5448
|
-
r.textures || (r.textures = []), t instanceof
|
|
5797
|
+
r.textures || (r.textures = []), t instanceof wt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
|
|
5449
5798
|
let i = t.userData.mimeType;
|
|
5450
5799
|
i === "image/webp" && (i = "image/png");
|
|
5451
5800
|
const o = {
|
|
@@ -5472,7 +5821,7 @@ class zn {
|
|
|
5472
5821
|
const s = { pbrMetallicRoughness: {} };
|
|
5473
5822
|
t.isMeshStandardMaterial !== !0 && t.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
5474
5823
|
const r = t.color.toArray().concat([t.opacity]);
|
|
5475
|
-
if (
|
|
5824
|
+
if (rt(r, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = r), t.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = t.metalness, s.pbrMetallicRoughness.roughnessFactor = t.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), t.metalnessMap || t.roughnessMap) {
|
|
5476
5825
|
const o = await this.buildMetalRoughTextureAsync(t.metalnessMap, t.roughnessMap), a = {
|
|
5477
5826
|
index: await this.processTextureAsync(o),
|
|
5478
5827
|
texCoord: o.channel
|
|
@@ -5510,7 +5859,7 @@ class zn {
|
|
|
5510
5859
|
};
|
|
5511
5860
|
t.aoMapIntensity !== 1 && (o.strength = t.aoMapIntensity), this.applyTextureTransform(o, t.aoMap), s.occlusionTexture = o;
|
|
5512
5861
|
}
|
|
5513
|
-
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side ===
|
|
5862
|
+
t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === je && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
|
|
5514
5863
|
o.writeMaterialAsync && await o.writeMaterialAsync(t, s);
|
|
5515
5864
|
});
|
|
5516
5865
|
const i = n.materials.push(s) - 1;
|
|
@@ -5524,7 +5873,7 @@ class zn {
|
|
|
5524
5873
|
async processMeshAsync(t) {
|
|
5525
5874
|
const e = this.cache, n = this.json, s = [t.geometry.uuid];
|
|
5526
5875
|
if (Array.isArray(t.material))
|
|
5527
|
-
for (let w = 0,
|
|
5876
|
+
for (let w = 0, E = t.material.length; w < E; w++)
|
|
5528
5877
|
s.push(t.material[w].uuid);
|
|
5529
5878
|
else
|
|
5530
5879
|
s.push(t.material.uuid);
|
|
@@ -5546,20 +5895,20 @@ class zn {
|
|
|
5546
5895
|
let p = null;
|
|
5547
5896
|
for (let w in i.attributes) {
|
|
5548
5897
|
if (w.slice(0, 5) === "morph") continue;
|
|
5549
|
-
const
|
|
5550
|
-
if (w = d[w] || w.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(w) || (w = "_" + w), e.attributes.has(this.getUID(
|
|
5551
|
-
c[w] = e.attributes.get(this.getUID(
|
|
5898
|
+
const E = i.attributes[w];
|
|
5899
|
+
if (w = d[w] || w.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(w) || (w = "_" + w), e.attributes.has(this.getUID(E))) {
|
|
5900
|
+
c[w] = e.attributes.get(this.getUID(E));
|
|
5552
5901
|
continue;
|
|
5553
5902
|
}
|
|
5554
5903
|
p = null;
|
|
5555
|
-
const S =
|
|
5556
|
-
w === "JOINTS_0" && !(S instanceof Uint16Array) && !(S instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new X(new Uint16Array(S),
|
|
5557
|
-
const T = this.processAccessor(p ||
|
|
5558
|
-
T !== null && (w.startsWith("_") || this.detectMeshQuantization(w,
|
|
5904
|
+
const S = E.array;
|
|
5905
|
+
w === "JOINTS_0" && !(S instanceof Uint16Array) && !(S instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new X(new Uint16Array(S), E.itemSize, E.normalized)) : (S instanceof Uint32Array || S instanceof Int32Array) && !w.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${w}" converted to type FLOAT.`), p = ft.Utils.toFloat32BufferAttribute(E));
|
|
5906
|
+
const T = this.processAccessor(p || E, i);
|
|
5907
|
+
T !== null && (w.startsWith("_") || this.detectMeshQuantization(w, E), c[w] = T, e.attributes.set(this.getUID(E), T));
|
|
5559
5908
|
}
|
|
5560
5909
|
if (f !== void 0 && i.setAttribute("normal", f), Object.keys(c).length === 0) return null;
|
|
5561
5910
|
if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
|
|
5562
|
-
const w = [],
|
|
5911
|
+
const w = [], E = [], b = {};
|
|
5563
5912
|
if (t.morphTargetDictionary !== void 0)
|
|
5564
5913
|
for (const S in t.morphTargetDictionary)
|
|
5565
5914
|
b[t.morphTargetDictionary[S]] = S;
|
|
@@ -5578,26 +5927,26 @@ class zn {
|
|
|
5578
5927
|
}
|
|
5579
5928
|
const q = j.clone();
|
|
5580
5929
|
if (!i.morphTargetsRelative)
|
|
5581
|
-
for (let
|
|
5930
|
+
for (let N = 0, Ft = j.count; N < Ft; N++)
|
|
5582
5931
|
for (let J = 0; J < j.itemSize; J++)
|
|
5583
|
-
J === 0 && q.setX(
|
|
5932
|
+
J === 0 && q.setX(N, j.getX(N) - W.getX(N)), J === 1 && q.setY(N, j.getY(N) - W.getY(N)), J === 2 && q.setZ(N, j.getZ(N) - W.getZ(N)), J === 3 && q.setW(N, j.getW(N) - W.getW(N));
|
|
5584
5933
|
T[F] = this.processAccessor(q, i), e.attributes.set(this.getUID(W, !0), T[F]);
|
|
5585
5934
|
}
|
|
5586
|
-
h.push(T), w.push(t.morphTargetInfluences[S]), t.morphTargetDictionary !== void 0 &&
|
|
5935
|
+
h.push(T), w.push(t.morphTargetInfluences[S]), t.morphTargetDictionary !== void 0 && E.push(b[S]);
|
|
5587
5936
|
}
|
|
5588
|
-
a.weights = w,
|
|
5937
|
+
a.weights = w, E.length > 0 && (a.extras = {}, a.extras.targetNames = E);
|
|
5589
5938
|
}
|
|
5590
5939
|
const g = Array.isArray(t.material);
|
|
5591
5940
|
if (g && i.groups.length === 0) return null;
|
|
5592
5941
|
let y = !1;
|
|
5593
5942
|
if (g && i.index === null) {
|
|
5594
5943
|
const w = [];
|
|
5595
|
-
for (let
|
|
5596
|
-
w[
|
|
5944
|
+
for (let E = 0, b = i.attributes.position.count; E < b; E++)
|
|
5945
|
+
w[E] = E;
|
|
5597
5946
|
i.setIndex(w), y = !0;
|
|
5598
5947
|
}
|
|
5599
5948
|
const m = g ? t.material : [t.material], x = g ? i.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
|
|
5600
|
-
for (let w = 0,
|
|
5949
|
+
for (let w = 0, E = x.length; w < E; w++) {
|
|
5601
5950
|
const b = {
|
|
5602
5951
|
mode: o,
|
|
5603
5952
|
attributes: c
|
|
@@ -5627,7 +5976,7 @@ class zn {
|
|
|
5627
5976
|
* @param {THREE.BufferAttribute} attribute
|
|
5628
5977
|
*/
|
|
5629
5978
|
detectMeshQuantization(t, e) {
|
|
5630
|
-
if (this.extensionsUsed[
|
|
5979
|
+
if (this.extensionsUsed[Lt]) return;
|
|
5631
5980
|
let n;
|
|
5632
5981
|
switch (e.array.constructor) {
|
|
5633
5982
|
case Int8Array:
|
|
@@ -5647,7 +5996,7 @@ class zn {
|
|
|
5647
5996
|
}
|
|
5648
5997
|
e.normalized && (n += " normalized");
|
|
5649
5998
|
const s = t.split("_", 1)[0];
|
|
5650
|
-
|
|
5999
|
+
Xt[s] && Xt[s].includes(n) && (this.extensionsUsed[Lt] = !0, this.extensionsRequired[Lt] = !0);
|
|
5651
6000
|
}
|
|
5652
6001
|
/**
|
|
5653
6002
|
* Process camera
|
|
@@ -5667,7 +6016,7 @@ class zn {
|
|
|
5667
6016
|
znear: t.near < 0 ? 0 : t.near
|
|
5668
6017
|
} : s.perspective = {
|
|
5669
6018
|
aspectRatio: t.aspect,
|
|
5670
|
-
yfov:
|
|
6019
|
+
yfov: bt.degToRad(t.fov),
|
|
5671
6020
|
zfar: t.far <= 0 ? 1e-3 : t.far,
|
|
5672
6021
|
znear: t.near < 0 ? 0 : t.near
|
|
5673
6022
|
}, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
|
|
@@ -5684,21 +6033,21 @@ class zn {
|
|
|
5684
6033
|
*/
|
|
5685
6034
|
processAnimation(t, e) {
|
|
5686
6035
|
const n = this.json, s = this.nodeMap;
|
|
5687
|
-
n.animations || (n.animations = []), t =
|
|
6036
|
+
n.animations || (n.animations = []), t = ft.Utils.mergeMorphTargetTracks(t.clone(), e);
|
|
5688
6037
|
const r = t.tracks, i = [], o = [];
|
|
5689
6038
|
for (let c = 0; c < r.length; ++c) {
|
|
5690
|
-
const l = r[c], h =
|
|
5691
|
-
let d =
|
|
5692
|
-
const f =
|
|
6039
|
+
const l = r[c], h = dt.parseTrackName(l.name);
|
|
6040
|
+
let d = dt.findNode(e, h.nodeName);
|
|
6041
|
+
const f = Vt[h.propertyName];
|
|
5693
6042
|
if (h.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(h.objectIndex) : d = void 0), !d || !f) {
|
|
5694
6043
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
|
|
5695
6044
|
continue;
|
|
5696
6045
|
}
|
|
5697
6046
|
const p = 1;
|
|
5698
6047
|
let g = l.values.length / l.times.length;
|
|
5699
|
-
f ===
|
|
6048
|
+
f === Vt.morphTargetInfluences && (g /= d.morphTargetInfluences.length);
|
|
5700
6049
|
let y;
|
|
5701
|
-
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (y = "CUBICSPLINE", g /= 3) : l.getInterpolation() ===
|
|
6050
|
+
l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (y = "CUBICSPLINE", g /= 3) : l.getInterpolation() === Fe ? y = "STEP" : y = "LINEAR", o.push({
|
|
5702
6051
|
input: this.processAccessor(new X(l.times, p)),
|
|
5703
6052
|
output: this.processAccessor(new X(l.values, g)),
|
|
5704
6053
|
interpolation: y
|
|
@@ -5726,7 +6075,7 @@ class zn {
|
|
|
5726
6075
|
if (r === void 0) return null;
|
|
5727
6076
|
const i = t.skeleton.bones[0];
|
|
5728
6077
|
if (i === void 0) return null;
|
|
5729
|
-
const o = [], a = new Float32Array(r.bones.length * 16), c = new
|
|
6078
|
+
const o = [], a = new Float32Array(r.bones.length * 16), c = new Zt();
|
|
5730
6079
|
for (let h = 0; h < r.bones.length; ++h)
|
|
5731
6080
|
o.push(n.get(r.bones[h])), c.copy(r.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
|
|
5732
6081
|
return e.skins === void 0 && (e.skins = []), e.skins.push({
|
|
@@ -5746,9 +6095,9 @@ class zn {
|
|
|
5746
6095
|
const r = {};
|
|
5747
6096
|
if (n.trs) {
|
|
5748
6097
|
const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
|
|
5749
|
-
|
|
6098
|
+
rt(o, [0, 0, 0, 1]) || (r.rotation = o), rt(a, [0, 0, 0]) || (r.translation = a), rt(c, [1, 1, 1]) || (r.scale = c);
|
|
5750
6099
|
} else
|
|
5751
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
6100
|
+
t.matrixAutoUpdate && t.updateMatrix(), kn(t.matrix) === !1 && (r.matrix = t.matrix.elements);
|
|
5752
6101
|
if (t.name !== "" && (r.name = String(t.name)), this.serializeUserData(t, r), t.isMesh || t.isLine || t.isPoints) {
|
|
5753
6102
|
const o = await this.processMeshAsync(t);
|
|
5754
6103
|
o !== null && (r.mesh = o);
|
|
@@ -5794,7 +6143,7 @@ class zn {
|
|
|
5794
6143
|
* @param {Array<THREE.Object3D>} objects List of objects to process
|
|
5795
6144
|
*/
|
|
5796
6145
|
async processObjectsAsync(t) {
|
|
5797
|
-
const e = new
|
|
6146
|
+
const e = new Ot();
|
|
5798
6147
|
e.name = "AuxScene";
|
|
5799
6148
|
for (let n = 0; n < t.length; n++)
|
|
5800
6149
|
e.children.push(t[n]);
|
|
@@ -5810,7 +6159,7 @@ class zn {
|
|
|
5810
6159
|
});
|
|
5811
6160
|
const n = [];
|
|
5812
6161
|
for (let s = 0; s < t.length; s++)
|
|
5813
|
-
t[s] instanceof
|
|
6162
|
+
t[s] instanceof Ot ? await this.processSceneAsync(t[s]) : n.push(t[s]);
|
|
5814
6163
|
n.length > 0 && await this.processObjectsAsync(n);
|
|
5815
6164
|
for (let s = 0; s < this.skins.length; ++s)
|
|
5816
6165
|
this.processSkin(this.skins[s]);
|
|
@@ -5825,7 +6174,7 @@ class zn {
|
|
|
5825
6174
|
await t(this.plugins[e]);
|
|
5826
6175
|
}
|
|
5827
6176
|
}
|
|
5828
|
-
class
|
|
6177
|
+
class Xn {
|
|
5829
6178
|
constructor(t) {
|
|
5830
6179
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
5831
6180
|
}
|
|
@@ -5841,7 +6190,7 @@ class Un {
|
|
|
5841
6190
|
o.push(i), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
|
|
5842
6191
|
}
|
|
5843
6192
|
}
|
|
5844
|
-
class
|
|
6193
|
+
class Vn {
|
|
5845
6194
|
constructor(t) {
|
|
5846
6195
|
this.writer = t, this.name = "KHR_materials_unlit";
|
|
5847
6196
|
}
|
|
@@ -5851,7 +6200,7 @@ class _n {
|
|
|
5851
6200
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
5852
6201
|
}
|
|
5853
6202
|
}
|
|
5854
|
-
class
|
|
6203
|
+
class Hn {
|
|
5855
6204
|
constructor(t) {
|
|
5856
6205
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
5857
6206
|
}
|
|
@@ -5882,7 +6231,7 @@ class kn {
|
|
|
5882
6231
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5883
6232
|
}
|
|
5884
6233
|
}
|
|
5885
|
-
class
|
|
6234
|
+
class $n {
|
|
5886
6235
|
constructor(t) {
|
|
5887
6236
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
5888
6237
|
}
|
|
@@ -5892,7 +6241,7 @@ class Wn {
|
|
|
5892
6241
|
r.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5893
6242
|
}
|
|
5894
6243
|
}
|
|
5895
|
-
class
|
|
6244
|
+
class Jn {
|
|
5896
6245
|
constructor(t) {
|
|
5897
6246
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
5898
6247
|
}
|
|
@@ -5916,7 +6265,7 @@ class Yn {
|
|
|
5916
6265
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5917
6266
|
}
|
|
5918
6267
|
}
|
|
5919
|
-
class
|
|
6268
|
+
class Kn {
|
|
5920
6269
|
constructor(t) {
|
|
5921
6270
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
5922
6271
|
}
|
|
@@ -5933,7 +6282,7 @@ class Xn {
|
|
|
5933
6282
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5934
6283
|
}
|
|
5935
6284
|
}
|
|
5936
|
-
class
|
|
6285
|
+
class Zn {
|
|
5937
6286
|
constructor(t) {
|
|
5938
6287
|
this.writer = t, this.name = "KHR_materials_volume";
|
|
5939
6288
|
}
|
|
@@ -5950,7 +6299,7 @@ class Vn {
|
|
|
5950
6299
|
t.attenuationDistance !== 1 / 0 && (r.attenuationDistance = t.attenuationDistance), r.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5951
6300
|
}
|
|
5952
6301
|
}
|
|
5953
|
-
class
|
|
6302
|
+
class Qn {
|
|
5954
6303
|
constructor(t) {
|
|
5955
6304
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
5956
6305
|
}
|
|
@@ -5960,12 +6309,12 @@ class Hn {
|
|
|
5960
6309
|
r.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5961
6310
|
}
|
|
5962
6311
|
}
|
|
5963
|
-
class
|
|
6312
|
+
class ts {
|
|
5964
6313
|
constructor(t) {
|
|
5965
6314
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
5966
6315
|
}
|
|
5967
6316
|
async writeMaterialAsync(t, e) {
|
|
5968
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
6317
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Fn) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
5969
6318
|
const n = this.writer, s = n.extensionsUsed, r = {};
|
|
5970
6319
|
if (t.specularIntensityMap) {
|
|
5971
6320
|
const i = {
|
|
@@ -5984,7 +6333,7 @@ class $n {
|
|
|
5984
6333
|
r.specularFactor = t.specularIntensity, r.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
5985
6334
|
}
|
|
5986
6335
|
}
|
|
5987
|
-
class
|
|
6336
|
+
class es {
|
|
5988
6337
|
constructor(t) {
|
|
5989
6338
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
5990
6339
|
}
|
|
@@ -6008,7 +6357,7 @@ class Jn {
|
|
|
6008
6357
|
r.sheenRoughnessFactor = t.sheenRoughness, r.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6009
6358
|
}
|
|
6010
6359
|
}
|
|
6011
|
-
class
|
|
6360
|
+
class ns {
|
|
6012
6361
|
constructor(t) {
|
|
6013
6362
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
6014
6363
|
}
|
|
@@ -6022,7 +6371,7 @@ class Kn {
|
|
|
6022
6371
|
r.anisotropyStrength = t.anisotropy, r.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6023
6372
|
}
|
|
6024
6373
|
}
|
|
6025
|
-
class
|
|
6374
|
+
class ss {
|
|
6026
6375
|
constructor(t) {
|
|
6027
6376
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
6028
6377
|
}
|
|
@@ -6032,7 +6381,7 @@ class Zn {
|
|
|
6032
6381
|
r.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6033
6382
|
}
|
|
6034
6383
|
}
|
|
6035
|
-
class
|
|
6384
|
+
class rs {
|
|
6036
6385
|
constructor(t) {
|
|
6037
6386
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
6038
6387
|
}
|
|
@@ -6049,13 +6398,13 @@ class Qn {
|
|
|
6049
6398
|
r.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6050
6399
|
}
|
|
6051
6400
|
}
|
|
6052
|
-
class
|
|
6401
|
+
class is {
|
|
6053
6402
|
constructor(t) {
|
|
6054
6403
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
6055
6404
|
}
|
|
6056
6405
|
writeNode(t, e) {
|
|
6057
6406
|
if (!t.isInstancedMesh) return;
|
|
6058
|
-
const n = this.writer, s = t, r = new Float32Array(s.count * 3), i = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new
|
|
6407
|
+
const n = this.writer, s = t, r = new Float32Array(s.count * 3), i = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new Zt(), c = new ht(), l = new Ie(), h = new ht();
|
|
6059
6408
|
for (let f = 0; f < s.count; f++)
|
|
6060
6409
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(r, f * 3), l.toArray(i, f * 4), h.toArray(o, f * 3);
|
|
6061
6410
|
const d = {
|
|
@@ -6066,7 +6415,7 @@ class ts {
|
|
|
6066
6415
|
s.instanceColor && (d._COLOR_0 = n.processAccessor(s.instanceColor)), e.extensions = e.extensions || {}, e.extensions[this.name] = { attributes: d }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
|
|
6067
6416
|
}
|
|
6068
6417
|
}
|
|
6069
|
-
|
|
6418
|
+
ft.Utils = {
|
|
6070
6419
|
insertKeyframe: function(u, t) {
|
|
6071
6420
|
const n = u.getValueSize(), s = new u.TimeBufferType(u.times.length + 1), r = new u.ValueBufferType(u.values.length + n), i = u.createInterpolant(new u.ValueBufferType(n));
|
|
6072
6421
|
let o;
|
|
@@ -6096,7 +6445,7 @@ dt.Utils = {
|
|
|
6096
6445
|
const e = [], n = {}, s = u.tracks;
|
|
6097
6446
|
for (let r = 0; r < s.length; ++r) {
|
|
6098
6447
|
let i = s[r];
|
|
6099
|
-
const o =
|
|
6448
|
+
const o = dt.parseTrackName(i.name), a = dt.findNode(t, o.nodeName);
|
|
6100
6449
|
if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
|
|
6101
6450
|
e.push(i);
|
|
6102
6451
|
continue;
|
|
@@ -6104,7 +6453,7 @@ dt.Utils = {
|
|
|
6104
6453
|
if (i.createInterpolant !== i.InterpolantFactoryMethodDiscrete && i.createInterpolant !== i.InterpolantFactoryMethodLinear) {
|
|
6105
6454
|
if (i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
|
|
6106
6455
|
throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
|
|
6107
|
-
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), i = i.clone(), i.setInterpolation(
|
|
6456
|
+
console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), i = i.clone(), i.setInterpolation(Ve);
|
|
6108
6457
|
}
|
|
6109
6458
|
const c = a.morphTargetInfluences.length, l = a.morphTargetDictionary[o.propertyIndex];
|
|
6110
6459
|
if (l === void 0)
|
|
@@ -6139,7 +6488,7 @@ dt.Utils = {
|
|
|
6139
6488
|
return t;
|
|
6140
6489
|
}
|
|
6141
6490
|
};
|
|
6142
|
-
async function
|
|
6491
|
+
async function os(u) {
|
|
6143
6492
|
if (typeof FileReader > "u") {
|
|
6144
6493
|
const t = await u.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
6145
6494
|
return `data:${u.type};base64,${n}`;
|
|
@@ -6149,7 +6498,7 @@ async function es(u) {
|
|
|
6149
6498
|
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(u);
|
|
6150
6499
|
});
|
|
6151
6500
|
}
|
|
6152
|
-
async function
|
|
6501
|
+
async function St(u) {
|
|
6153
6502
|
if (typeof u.arrayBuffer == "function")
|
|
6154
6503
|
return await u.arrayBuffer();
|
|
6155
6504
|
if (typeof FileReader < "u")
|
|
@@ -6162,8 +6511,8 @@ async function Dt(u) {
|
|
|
6162
6511
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
6163
6512
|
}
|
|
6164
6513
|
}
|
|
6165
|
-
const
|
|
6166
|
-
function
|
|
6514
|
+
const as = new He(), cs = new ft();
|
|
6515
|
+
function ls(u, t, e = 0.1) {
|
|
6167
6516
|
const n = t.normal(u), s = t.direction(u).mutiplyScalar(e * 0.5), r = u.direction(t).mutiplyScalar(e * 0.5), i = n.x * e * 0.5, o = n.y * e * 0.5;
|
|
6168
6517
|
return {
|
|
6169
6518
|
points: [
|
|
@@ -6178,7 +6527,7 @@ function rs(u, t, e = 0.1) {
|
|
|
6178
6527
|
rectIndices: [0, 1, 3, 2, 0]
|
|
6179
6528
|
};
|
|
6180
6529
|
}
|
|
6181
|
-
class
|
|
6530
|
+
class Ee extends z {
|
|
6182
6531
|
static name = "WhiteModel";
|
|
6183
6532
|
Dxf = null;
|
|
6184
6533
|
Variable = null;
|
|
@@ -6208,7 +6557,7 @@ class De extends z {
|
|
|
6208
6557
|
new I.LineSegments(new I.EdgesGeometry(r), new I.LineBasicMaterial({ color: 0 }))
|
|
6209
6558
|
);
|
|
6210
6559
|
}), t.originalData.map(({ start: n, end: s, insetionArr: r }) => {
|
|
6211
|
-
const i = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } =
|
|
6560
|
+
const i = new D(n.x, n.y).mutiplyScalar(t.scale), o = new D(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = ls(i, o, t.width);
|
|
6212
6561
|
return {
|
|
6213
6562
|
points: a,
|
|
6214
6563
|
indices: c,
|
|
@@ -6241,7 +6590,7 @@ class De extends z {
|
|
|
6241
6590
|
toOBJ() {
|
|
6242
6591
|
return new Promise((t) => {
|
|
6243
6592
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
6244
|
-
t(
|
|
6593
|
+
t(as.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6245
6594
|
}, 20);
|
|
6246
6595
|
});
|
|
6247
6596
|
}
|
|
@@ -6253,7 +6602,7 @@ class De extends z {
|
|
|
6253
6602
|
toGltf(t = !0) {
|
|
6254
6603
|
return new Promise((e) => {
|
|
6255
6604
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
6256
|
-
|
|
6605
|
+
cs.parse(this.whiteModelGroup.children, (n) => {
|
|
6257
6606
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6258
6607
|
}, () => {
|
|
6259
6608
|
e(void 0);
|
|
@@ -6314,7 +6663,7 @@ class De extends z {
|
|
|
6314
6663
|
}
|
|
6315
6664
|
}
|
|
6316
6665
|
}
|
|
6317
|
-
class
|
|
6666
|
+
class Se extends z {
|
|
6318
6667
|
static name = "DetailsPoint";
|
|
6319
6668
|
Dxf = null;
|
|
6320
6669
|
WhiteModel = null;
|
|
@@ -6391,7 +6740,7 @@ class Le extends z {
|
|
|
6391
6740
|
}, 50);
|
|
6392
6741
|
}
|
|
6393
6742
|
}
|
|
6394
|
-
class
|
|
6743
|
+
class be extends z {
|
|
6395
6744
|
static name = "DxfLineModel";
|
|
6396
6745
|
dxfLineModel = new I.LineSegments();
|
|
6397
6746
|
dxfDoorsLineModel = new I.LineSegments();
|
|
@@ -6414,306 +6763,37 @@ class Ee extends z {
|
|
|
6414
6763
|
});
|
|
6415
6764
|
}
|
|
6416
6765
|
}
|
|
6417
|
-
const
|
|
6766
|
+
const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6418
6767
|
__proto__: null,
|
|
6419
|
-
DetailsPoint:
|
|
6420
|
-
DxfLineModel:
|
|
6421
|
-
WhiteModel:
|
|
6768
|
+
DetailsPoint: Se,
|
|
6769
|
+
DxfLineModel: be,
|
|
6770
|
+
WhiteModel: Ee
|
|
6422
6771
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6423
|
-
function
|
|
6772
|
+
function Kt(u, t = {}) {
|
|
6424
6773
|
const {
|
|
6425
6774
|
detailsPoint: e = !0,
|
|
6426
6775
|
whiteModel: n = !0,
|
|
6427
6776
|
dxfLineModel: s = !0
|
|
6428
6777
|
} = t;
|
|
6429
|
-
s && u.addComponent(new
|
|
6778
|
+
s && u.addComponent(new be()), n && u.addComponent(new Ee()), e && u.addComponent(new Se());
|
|
6430
6779
|
}
|
|
6431
|
-
const
|
|
6780
|
+
const hs = Object.assign(Kt, {
|
|
6432
6781
|
create(u = {}) {
|
|
6433
|
-
return (t) =>
|
|
6434
|
-
}
|
|
6435
|
-
}), as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6436
|
-
__proto__: null,
|
|
6437
|
-
ModelDataPlugin: os,
|
|
6438
|
-
components: is
|
|
6439
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
6440
|
-
class cs extends I.LineSegments {
|
|
6441
|
-
geometry = new I.BufferGeometry();
|
|
6442
|
-
points = [];
|
|
6443
|
-
pointsObject3D;
|
|
6444
|
-
constructor(t = [], e = 16777215) {
|
|
6445
|
-
super(), this.geometry = this.geometry, this.addPoint(...t), this.frustumCulled = !1, this.pointsObject3D = new I.Points(this.geometry, new I.PointsMaterial({
|
|
6446
|
-
sizeAttenuation: !1,
|
|
6447
|
-
size: 10
|
|
6448
|
-
})), this.material = new I.LineBasicMaterial({ color: e });
|
|
6449
|
-
}
|
|
6450
|
-
addPoint(...t) {
|
|
6451
|
-
this.points.push(...t), this.updateGeometry();
|
|
6452
|
-
}
|
|
6453
|
-
setPoint(...t) {
|
|
6454
|
-
this.points.length = 0, this.addPoint(...t);
|
|
6455
|
-
}
|
|
6456
|
-
_timer = null;
|
|
6457
|
-
updateGeometry() {
|
|
6458
|
-
this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
6459
|
-
const t = this.points.flatMap((n, s) => {
|
|
6460
|
-
if (s === 0) return [];
|
|
6461
|
-
{
|
|
6462
|
-
const r = this.points[s - 1];
|
|
6463
|
-
return [r.x, r.y, r.z, n.x, n.y, n.z];
|
|
6464
|
-
}
|
|
6465
|
-
}), e = new I.BufferAttribute(new Float32Array(t), 3);
|
|
6466
|
-
this.geometry.setAttribute("position", e), this._timer = null;
|
|
6467
|
-
});
|
|
6468
|
-
}
|
|
6469
|
-
}
|
|
6470
|
-
function Lt() {
|
|
6471
|
-
return new Promise((u) => {
|
|
6472
|
-
const t = document.createElement("input");
|
|
6473
|
-
t.type = "file", t.accept = "application/json", t.click(), t.onchange = () => {
|
|
6474
|
-
t.files?.length ? u(t.files[0]) : u(null);
|
|
6475
|
-
};
|
|
6476
|
-
});
|
|
6477
|
-
}
|
|
6478
|
-
const ls = Object.assign(Lt, {
|
|
6479
|
-
arrayBuffer() {
|
|
6480
|
-
return new Promise(async (u) => {
|
|
6481
|
-
const t = await Lt();
|
|
6482
|
-
if (t instanceof File) {
|
|
6483
|
-
const e = new FileReader();
|
|
6484
|
-
e.onload = () => {
|
|
6485
|
-
u(e.result);
|
|
6486
|
-
}, e.readAsArrayBuffer(t);
|
|
6487
|
-
} else u(null);
|
|
6488
|
-
});
|
|
6489
|
-
},
|
|
6490
|
-
text() {
|
|
6491
|
-
return new Promise(async (u) => {
|
|
6492
|
-
const t = await Lt();
|
|
6493
|
-
if (t instanceof File) {
|
|
6494
|
-
const e = new FileReader();
|
|
6495
|
-
e.onload = () => {
|
|
6496
|
-
u(e.result);
|
|
6497
|
-
}, e.readAsText(t, "utf-8");
|
|
6498
|
-
} else u(null);
|
|
6499
|
-
});
|
|
6500
|
-
},
|
|
6501
|
-
async json() {
|
|
6502
|
-
const u = await this.text();
|
|
6503
|
-
if (u) return JSON.parse(u);
|
|
6504
|
-
}
|
|
6505
|
-
});
|
|
6506
|
-
class Se extends it {
|
|
6507
|
-
list = [];
|
|
6508
|
-
rollbacklist = [];
|
|
6509
|
-
revokeRollbacklist = [];
|
|
6510
|
-
// 是否写入操作记录
|
|
6511
|
-
writeOperationList = !0;
|
|
6512
|
-
loop = !1;
|
|
6513
|
-
setLoop(t) {
|
|
6514
|
-
return this.loop = t, this;
|
|
6515
|
-
}
|
|
6516
|
-
/**
|
|
6517
|
-
*
|
|
6518
|
-
* @param operation
|
|
6519
|
-
* @returns
|
|
6520
|
-
*/
|
|
6521
|
-
add(t) {
|
|
6522
|
-
return this.list.push(t), this;
|
|
6782
|
+
return (t) => Kt(t, u);
|
|
6523
6783
|
}
|
|
6524
|
-
|
|
6525
|
-
* @param callBack
|
|
6526
|
-
*/
|
|
6527
|
-
addRollback(t) {
|
|
6528
|
-
return this.rollbacklist.push(t), this;
|
|
6529
|
-
}
|
|
6530
|
-
/** 添加撤回回滚回调列表
|
|
6531
|
-
* @param callBack
|
|
6532
|
-
* @returns
|
|
6533
|
-
*/
|
|
6534
|
-
addRevokeRollback(t) {
|
|
6535
|
-
return this.revokeRollbacklist.push(t), this;
|
|
6536
|
-
}
|
|
6537
|
-
}
|
|
6538
|
-
class us extends it {
|
|
6539
|
-
commandFlowMap = /* @__PURE__ */ new Map();
|
|
6540
|
-
lock = !1;
|
|
6541
|
-
abortController = null;
|
|
6542
|
-
resolve = null;
|
|
6543
|
-
currentName = null;
|
|
6544
|
-
_disabled = !1;
|
|
6545
|
-
set disabled(t) {
|
|
6546
|
-
this._disabled = t, this._disabled && this.cancel();
|
|
6547
|
-
}
|
|
6548
|
-
get disabled() {
|
|
6549
|
-
return this._disabled;
|
|
6550
|
-
}
|
|
6551
|
-
/**
|
|
6552
|
-
* 操作记录
|
|
6553
|
-
*/
|
|
6554
|
-
operationList = [];
|
|
6555
|
-
rollbackList = [];
|
|
6556
|
-
constructor() {
|
|
6557
|
-
super();
|
|
6558
|
-
}
|
|
6559
|
-
/** 添加命令流
|
|
6560
|
-
* @param name
|
|
6561
|
-
* @returns
|
|
6562
|
-
*/
|
|
6563
|
-
addCommandFlow(t) {
|
|
6564
|
-
if (this.commandFlowMap.has(t)) throw new Error(`${t} 命令已经存在`);
|
|
6565
|
-
const e = new Se();
|
|
6566
|
-
return this.commandFlowMap.set(t, e), e;
|
|
6567
|
-
}
|
|
6568
|
-
executionPromise = null;
|
|
6569
|
-
executionResolve = null;
|
|
6570
|
-
/** 执行控制流
|
|
6571
|
-
* @param name
|
|
6572
|
-
* @returns
|
|
6573
|
-
*/
|
|
6574
|
-
async start(t, e = null, n = 0) {
|
|
6575
|
-
if (this.disabled) throw new Error("命令管理器已禁用,无法启动新的命令流");
|
|
6576
|
-
if (this.dispatchEvent({
|
|
6577
|
-
type: "startedBefore",
|
|
6578
|
-
name: t,
|
|
6579
|
-
currentName: this.currentName
|
|
6580
|
-
}), this.executionPromise && await this.executionPromise, this.executionPromise = null, this.lock)
|
|
6581
|
-
throw new Error("命令管理器已被 " + this.currentName + " 命令锁定,无法启动新的命令流,请退出或等待命令执行结束");
|
|
6582
|
-
const s = this.commandFlowMap.get(t);
|
|
6583
|
-
if (!s)
|
|
6584
|
-
throw new Error(`命令流 ${t} 不存在`);
|
|
6585
|
-
this.lock = !0, this.abortController = new AbortController(), this.currentName = t, s.dispatchEvent({ type: "started" }), this.dispatchEvent({ type: "started", name: t });
|
|
6586
|
-
try {
|
|
6587
|
-
for (let r = n; r < s.list.length; r++) {
|
|
6588
|
-
const i = s.list[r];
|
|
6589
|
-
if (s.dispatchEvent({ type: "executing", index: r }), this.dispatchEvent({ type: "executing", name: t, index: r }), e = await new Promise((o) => {
|
|
6590
|
-
this.resolve = o, i(o, e);
|
|
6591
|
-
}), this.abortController.signal.aborted) {
|
|
6592
|
-
s.dispatchEvent({ type: "executionInterrupt", index: r }), this.dispatchEvent({ type: "executionInterrupt", name: t, index: r }), this.dispatchEvent({ type: "cancel", name: t });
|
|
6593
|
-
break;
|
|
6594
|
-
} else
|
|
6595
|
-
s.dispatchEvent({ type: "executionCompleted", index: r, data: e }), this.dispatchEvent({ type: "executionCompleted", name: t, index: r, data: e });
|
|
6596
|
-
}
|
|
6597
|
-
} catch (r) {
|
|
6598
|
-
console.error(r);
|
|
6599
|
-
} finally {
|
|
6600
|
-
this.lock = !1, this.currentName = null, this.abortController && !this.abortController.signal.aborted && (s.dispatchEvent({ type: "completed", data: e }), this.dispatchEvent({ type: "completed", name: t, data: e }), s.writeOperationList && (this.operationList.push({ name: t, data: e }), this.rollbackList.length = 0), s.loop && queueMicrotask(() => this.start(t))), this.abortController = null, s.dispatchEvent({ type: "finally" }), this.dispatchEvent({ type: "finally", name: t }), this.executionResolve && (this.executionResolve(null), this.executionResolve = null);
|
|
6601
|
-
}
|
|
6602
|
-
return e;
|
|
6603
|
-
}
|
|
6604
|
-
/** 取消当前命令
|
|
6605
|
-
*/
|
|
6606
|
-
cancel() {
|
|
6607
|
-
this.abortController && (this.abortController.abort(), this.resolve && this.resolve(), this.executionPromise = new Promise((t) => this.executionResolve = t));
|
|
6608
|
-
}
|
|
6609
|
-
/**
|
|
6610
|
-
* 回滚
|
|
6611
|
-
*/
|
|
6612
|
-
rollback() {
|
|
6613
|
-
try {
|
|
6614
|
-
const t = this.operationList.pop();
|
|
6615
|
-
if (!t) return !1;
|
|
6616
|
-
const e = this.commandFlowMap.get(t.name);
|
|
6617
|
-
if (!e) return !1;
|
|
6618
|
-
const n = e.rollbacklist.reduce((s, r) => r(s), t.data);
|
|
6619
|
-
return this.dispatchEvent({ type: "rollback", name: t.name }), this.rollbackList.push({
|
|
6620
|
-
data: n,
|
|
6621
|
-
name: t.name
|
|
6622
|
-
}), !0;
|
|
6623
|
-
} catch (t) {
|
|
6624
|
-
throw new Error(`回滚失败:${t}`);
|
|
6625
|
-
}
|
|
6626
|
-
}
|
|
6627
|
-
/**
|
|
6628
|
-
* 撤销回滚
|
|
6629
|
-
*/
|
|
6630
|
-
revokeRollback() {
|
|
6631
|
-
try {
|
|
6632
|
-
const t = this.rollbackList.pop();
|
|
6633
|
-
if (!t) return !1;
|
|
6634
|
-
const e = this.commandFlowMap.get(t.name);
|
|
6635
|
-
if (!e) return !1;
|
|
6636
|
-
const n = e.revokeRollbacklist.reduce((s, r) => r(s), t.data);
|
|
6637
|
-
return this.dispatchEvent({ type: "revokeRollback", name: t.name }), this.operationList.push({ name: t.name, data: n }), !0;
|
|
6638
|
-
} catch (t) {
|
|
6639
|
-
throw new Error(`撤回回滚失败:${t}`);
|
|
6640
|
-
}
|
|
6641
|
-
}
|
|
6642
|
-
destroy() {
|
|
6643
|
-
this.cancel(), this.addEventListener("cancel", () => {
|
|
6644
|
-
this.commandFlowMap.clear(), this.lock = !1, this.abortController = null, this.resolve = null, this.executionResolve = null, this.executionPromise = null, this.currentName = null, this.operationList.length = 0, this.rollbackList.length = 0;
|
|
6645
|
-
}, { once: !0 });
|
|
6646
|
-
}
|
|
6647
|
-
}
|
|
6648
|
-
const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6784
|
+
}), ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6649
6785
|
__proto__: null,
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
BoundExt: Ct,
|
|
6653
|
-
Box2: v,
|
|
6654
|
-
CommandFlow: Se,
|
|
6655
|
-
CommandManager: us,
|
|
6656
|
-
Component: z,
|
|
6657
|
-
ComponentManager: Zt,
|
|
6658
|
-
CountMap: ft,
|
|
6659
|
-
DoubleWallHelper: pt,
|
|
6660
|
-
DxfSystem: tt,
|
|
6661
|
-
EventDispatcher: it,
|
|
6662
|
-
LineGroupType: C,
|
|
6663
|
-
LineIndexGenerator: gt,
|
|
6664
|
-
LineSegment: E,
|
|
6665
|
-
LineSegmentUndirectedGraph: yt,
|
|
6666
|
-
Lines: cs,
|
|
6667
|
-
MapEnhance: et,
|
|
6668
|
-
Point: D,
|
|
6669
|
-
PointVirtualGrid: G,
|
|
6670
|
-
Polygon: at,
|
|
6671
|
-
PvgList: Qt,
|
|
6672
|
-
Quadtree: N,
|
|
6673
|
-
Rectangle: nt,
|
|
6674
|
-
SelectLocalFile: ls,
|
|
6675
|
-
UndirectedGraph: re,
|
|
6676
|
-
UnionFindSet: Q,
|
|
6677
|
-
buildBayWindowGroup: St,
|
|
6678
|
-
buildDoubleWallGroup: Z,
|
|
6679
|
-
clippingDoubleWall: ge,
|
|
6680
|
-
clippingLineUserData: Tt,
|
|
6681
|
-
cloneUserData: _,
|
|
6682
|
-
closedPathArea: de,
|
|
6683
|
-
components: wn,
|
|
6684
|
-
createPointVirtualGrid: $,
|
|
6685
|
-
createQuadtree: At,
|
|
6686
|
-
findCircleEdges: ae,
|
|
6687
|
-
findClosedPolygons: Pn,
|
|
6688
|
-
findDiscretePoint: se,
|
|
6689
|
-
findDiscretePointLine: Je,
|
|
6690
|
-
findDiscretePointLine2: Pt,
|
|
6691
|
-
findLargestCircle: ce,
|
|
6692
|
-
findRingEdges: xe,
|
|
6693
|
-
findVerticalReference: ue,
|
|
6694
|
-
lineDataToOriginalData: rt,
|
|
6695
|
-
lineDataToThreeVJiaJson: ye,
|
|
6696
|
-
lineSegmentClipping: bt,
|
|
6697
|
-
mergeLineUserData: k,
|
|
6698
|
-
mergeSmallestCircle: oe,
|
|
6699
|
-
mergeWindow: ne,
|
|
6700
|
-
originalDataToLineData: he,
|
|
6701
|
-
recomputedWindow: ot,
|
|
6702
|
-
recomputedWindowCenter: ee,
|
|
6703
|
-
ringsDeduplication: ie,
|
|
6704
|
-
smallestCircle: It,
|
|
6705
|
-
toOriginalDataItem: te,
|
|
6706
|
-
tools: $e,
|
|
6707
|
-
uuid: V
|
|
6786
|
+
ModelDataPlugin: hs,
|
|
6787
|
+
components: us
|
|
6708
6788
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6709
|
-
function
|
|
6789
|
+
function fs() {
|
|
6710
6790
|
return import("./index2.js");
|
|
6711
6791
|
}
|
|
6712
|
-
function
|
|
6792
|
+
function ps() {
|
|
6713
6793
|
return import("./index3.js");
|
|
6714
6794
|
}
|
|
6715
|
-
let
|
|
6716
|
-
class
|
|
6795
|
+
let jt = null;
|
|
6796
|
+
class Te {
|
|
6717
6797
|
static preTime = performance.now();
|
|
6718
6798
|
static firstTime = performance.now();
|
|
6719
6799
|
static clear() {
|
|
@@ -6728,10 +6808,10 @@ class be {
|
|
|
6728
6808
|
return console.log(t + " %c totalTime " + parseFloat(n.toFixed(6)) + "ms", "color: green;"), this.preTime = e, n;
|
|
6729
6809
|
}
|
|
6730
6810
|
}
|
|
6731
|
-
typeof window < "u" && (window.drawLines =
|
|
6732
|
-
typeof globalThis < "u" && (globalThis.Log =
|
|
6733
|
-
async function
|
|
6734
|
-
const s = await Promise.resolve().then(() =>
|
|
6811
|
+
typeof window < "u" && (window.drawLines = De, window.drawPoint = Nn, window.drawText = jn, window.randomColor = () => Math.floor(Math.random() * 16777215), window.Log = Te, window.TEST = !1);
|
|
6812
|
+
typeof globalThis < "u" && (globalThis.Log = Te);
|
|
6813
|
+
async function Ds(u, t, e = !1, n) {
|
|
6814
|
+
const s = await Promise.resolve().then(() => ds), r = await fs(), i = await ps(), o = new tt().usePlugin(s.ModelDataPlugin.create({
|
|
6735
6815
|
detailsPoint: !1,
|
|
6736
6816
|
whiteModel: !0
|
|
6737
6817
|
})).usePlugin(r.RenderPlugin.create({
|
|
@@ -6741,12 +6821,12 @@ async function ws(u, t, e = !1, n) {
|
|
|
6741
6821
|
orbitControls: e,
|
|
6742
6822
|
camera: t
|
|
6743
6823
|
})).usePlugin(i.Editor.create({ viewPermission: n })), a = o.findComponentByType(r.components.DomContainer);
|
|
6744
|
-
return a && u.appendChild(a.domElement),
|
|
6824
|
+
return a && u.appendChild(a.domElement), jt = o, {
|
|
6745
6825
|
dxfSystem: o,
|
|
6746
|
-
getFileAll: () =>
|
|
6826
|
+
getFileAll: () => gs(o)
|
|
6747
6827
|
};
|
|
6748
6828
|
}
|
|
6749
|
-
async function
|
|
6829
|
+
async function gs(u = jt) {
|
|
6750
6830
|
const t = u.findComponentByName("WhiteModel"), e = new File([await u.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([u.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([u.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), r = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), i = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(u.Dxf.originalData)], "json.json", { type: "application/json" });
|
|
6751
6831
|
return {
|
|
6752
6832
|
dxf: n,
|
|
@@ -6758,35 +6838,35 @@ async function fs(u = Nt) {
|
|
|
6758
6838
|
correctionDxf: s
|
|
6759
6839
|
};
|
|
6760
6840
|
}
|
|
6761
|
-
function
|
|
6762
|
-
return
|
|
6841
|
+
function Ls() {
|
|
6842
|
+
return jt;
|
|
6763
6843
|
}
|
|
6764
6844
|
export {
|
|
6765
|
-
|
|
6845
|
+
ue as A,
|
|
6766
6846
|
v as B,
|
|
6767
6847
|
z as C,
|
|
6768
6848
|
tt as D,
|
|
6769
|
-
|
|
6770
|
-
|
|
6849
|
+
dn as L,
|
|
6850
|
+
hs as M,
|
|
6771
6851
|
D as P,
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6852
|
+
B as Q,
|
|
6853
|
+
fn as S,
|
|
6854
|
+
we as T,
|
|
6855
|
+
Ct as V,
|
|
6856
|
+
Ee as W,
|
|
6857
|
+
Se as a,
|
|
6858
|
+
L as b,
|
|
6779
6859
|
G as c,
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6860
|
+
k as d,
|
|
6861
|
+
ye as e,
|
|
6862
|
+
pn as f,
|
|
6863
|
+
Ds as g,
|
|
6864
|
+
gs as h,
|
|
6865
|
+
Ls as i,
|
|
6786
6866
|
U as j,
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6867
|
+
ds as k,
|
|
6868
|
+
Ms as l,
|
|
6869
|
+
En as m,
|
|
6870
|
+
at as r,
|
|
6791
6871
|
V as u
|
|
6792
6872
|
};
|