build-dxf 0.0.53 → 0.0.54
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/src/build.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as I from "three";
|
|
2
|
-
import { EventDispatcher as Ae, Color as Pe, Matrix4 as Zt, Vector3 as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { EventDispatcher as Ae, Color as Pe, Matrix4 as Zt, Vector3 as ut, Quaternion as Ie, BufferAttribute as X, REVISION as ve, CompressedTexture as xt, Source as Re, NoColorSpace as Ce, MathUtils as St, RGBAFormat as Be, ImageUtils as Ne, DoubleSide as je, PropertyBinding as ht, InterpolateDiscrete as Fe, Scene as Ft, 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 Ot from "clipper-lib";
|
|
4
|
+
import ct from "dxf-writer";
|
|
5
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) {
|
|
@@ -9,7 +9,7 @@ function V() {
|
|
|
9
9
|
return e.toString(16);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class it 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 ot extends Ae {
|
|
|
30
30
|
e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class z extends
|
|
33
|
+
class z extends it {
|
|
34
34
|
parent;
|
|
35
35
|
destroyed = !1;
|
|
36
36
|
constructor(...t) {
|
|
@@ -48,7 +48,7 @@ class z extends ot {
|
|
|
48
48
|
this.destroyed = !0;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
class Qt extends
|
|
51
|
+
class Qt extends it {
|
|
52
52
|
static EventType = {
|
|
53
53
|
ADD_COMPONENT: "addComponent"
|
|
54
54
|
};
|
|
@@ -547,7 +547,7 @@ function k(u) {
|
|
|
547
547
|
}
|
|
548
548
|
return t;
|
|
549
549
|
}
|
|
550
|
-
class
|
|
550
|
+
class nt {
|
|
551
551
|
points;
|
|
552
552
|
get p0() {
|
|
553
553
|
return this.points[0];
|
|
@@ -698,7 +698,7 @@ class st {
|
|
|
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 nt([
|
|
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),
|
|
@@ -732,7 +732,7 @@ class B {
|
|
|
732
732
|
* @param node 线段节点
|
|
733
733
|
*/
|
|
734
734
|
insert(t) {
|
|
735
|
-
if (t instanceof
|
|
735
|
+
if (t instanceof E) {
|
|
736
736
|
this.insert({ line: t, userData: {} });
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
@@ -757,7 +757,7 @@ class B {
|
|
|
757
757
|
* @param node
|
|
758
758
|
*/
|
|
759
759
|
remove(t) {
|
|
760
|
-
if (t instanceof
|
|
760
|
+
if (t instanceof E) {
|
|
761
761
|
t = t.currentData[this.id], t && this.remove(t);
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
@@ -922,7 +922,7 @@ class B {
|
|
|
922
922
|
})), t;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
|
-
class
|
|
925
|
+
class et extends Map {
|
|
926
926
|
get valueArray() {
|
|
927
927
|
return [...this.values()];
|
|
928
928
|
}
|
|
@@ -979,14 +979,14 @@ class nt 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 et {
|
|
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 ft extends et {
|
|
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
|
|
1022
|
+
const lt = /* @__PURE__ */ new Set();
|
|
1023
1023
|
function $e(u) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}),
|
|
1024
|
+
lt.size === 0 && queueMicrotask(() => {
|
|
1025
|
+
lt.forEach((t) => t.cachedLength = null), lt.clear();
|
|
1026
|
+
}), lt.add(u);
|
|
1027
1027
|
}
|
|
1028
|
-
class
|
|
1028
|
+
class E {
|
|
1029
1029
|
points = [new D(), new D()];
|
|
1030
1030
|
userData = {};
|
|
1031
1031
|
currentData = {};
|
|
@@ -1156,7 +1156,7 @@ class L {
|
|
|
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 nt([0, 1, 3, 2].map((h) => l[h]));
|
|
1160
1160
|
}
|
|
1161
1161
|
/**
|
|
1162
1162
|
* 计算线段的长度
|
|
@@ -1211,7 +1211,7 @@ class L {
|
|
|
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 E(a, a) : new E(a, c);
|
|
1215
1215
|
}
|
|
1216
1216
|
/**
|
|
1217
1217
|
* 计算一条线段在另一条直线上的投影
|
|
@@ -1311,7 +1311,7 @@ class L {
|
|
|
1311
1311
|
* @param line
|
|
1312
1312
|
*/
|
|
1313
1313
|
parallel(t, e = 1) {
|
|
1314
|
-
return t instanceof
|
|
1314
|
+
return t instanceof E ? 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 L {
|
|
|
1319
1319
|
* @returns
|
|
1320
1320
|
*/
|
|
1321
1321
|
vertical(t, e = 0.1) {
|
|
1322
|
-
return t instanceof
|
|
1322
|
+
return t instanceof E ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
|
|
1323
1323
|
}
|
|
1324
1324
|
/**
|
|
1325
1325
|
* 两条线段方向相反否一致
|
|
@@ -1410,7 +1410,7 @@ class L {
|
|
|
1410
1410
|
* @returns
|
|
1411
1411
|
*/
|
|
1412
1412
|
clone() {
|
|
1413
|
-
const t = new
|
|
1413
|
+
const t = new E(
|
|
1414
1414
|
this.points[0].clone(),
|
|
1415
1415
|
this.points[1].clone()
|
|
1416
1416
|
);
|
|
@@ -1568,7 +1568,7 @@ class L {
|
|
|
1568
1568
|
const f = o(d);
|
|
1569
1569
|
f < a && (a = f, r = n.projectPoint(d, !1)), f > c && (c = f, i = n.projectPoint(d, !1));
|
|
1570
1570
|
}
|
|
1571
|
-
const l = new
|
|
1571
|
+
const l = new E(r, i);
|
|
1572
1572
|
return t.forEach((h) => h.userData.fittedLine = l), l;
|
|
1573
1573
|
}
|
|
1574
1574
|
/** 合并平行线段
|
|
@@ -1587,7 +1587,7 @@ class L {
|
|
|
1587
1587
|
const g = p.x * s.x + p.y * s.y;
|
|
1588
1588
|
r = Math.min(r, g), i = Math.max(i, g), o += p.x, a += p.y;
|
|
1589
1589
|
});
|
|
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
|
|
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 E(h, d);
|
|
1591
1591
|
return t.forEach((p) => p.userData.fittedLine = f), f;
|
|
1592
1592
|
}
|
|
1593
1593
|
/** 合并满足平行的线段
|
|
@@ -1662,7 +1662,7 @@ class L {
|
|
|
1662
1662
|
* @returns
|
|
1663
1663
|
*/
|
|
1664
1664
|
static clipping(t, e, n) {
|
|
1665
|
-
if (!(t instanceof
|
|
1665
|
+
if (!(t instanceof E)) throw new Error("参数1并非线段");
|
|
1666
1666
|
e = e.map((i) => t.projectPoint(i)).filter((i) => !!i);
|
|
1667
1667
|
const s = t.clone();
|
|
1668
1668
|
e.sort((i, o) => s.start.distance(i) - s.start.distance(o));
|
|
@@ -1830,7 +1830,7 @@ class D {
|
|
|
1830
1830
|
* @param length
|
|
1831
1831
|
*/
|
|
1832
1832
|
expandAsLine(t, e, n) {
|
|
1833
|
-
const s = new
|
|
1833
|
+
const s = new E(
|
|
1834
1834
|
this.clone(),
|
|
1835
1835
|
this.clone().add(t.clone().multiplyScalar(e))
|
|
1836
1836
|
);
|
|
@@ -1964,7 +1964,7 @@ function ee(u, t = 0, e, n) {
|
|
|
1964
1964
|
}))
|
|
1965
1965
|
};
|
|
1966
1966
|
}
|
|
1967
|
-
function
|
|
1967
|
+
function rt(u, t = 0, e) {
|
|
1968
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));
|
|
1969
1969
|
}
|
|
1970
1970
|
function qt(u, t) {
|
|
@@ -1978,7 +1978,7 @@ function qt(u, t) {
|
|
|
1978
1978
|
});
|
|
1979
1979
|
}
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function Tt(u, t = 0.03) {
|
|
1982
1982
|
const e = new B(v.fromByLineSegment(...u));
|
|
1983
1983
|
u.forEach((s) => e.insert({ line: s, userData: void 0 }));
|
|
1984
1984
|
const n = u.flatMap((s) => {
|
|
@@ -2001,7 +2001,7 @@ function At(u, t = 0.03) {
|
|
|
2001
2001
|
}).filter((s) => s.length() >= t);
|
|
2002
2002
|
return e.clear(), n;
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function ot(...u) {
|
|
2005
2005
|
u.forEach((t) => {
|
|
2006
2006
|
const e = t.direction();
|
|
2007
2007
|
t.userData.drawWindow?.forEach((n) => {
|
|
@@ -2016,7 +2016,7 @@ function at(...u) {
|
|
|
2016
2016
|
), i = t.projectPoint(
|
|
2017
2017
|
s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
|
|
2018
2018
|
!1
|
|
2019
|
-
), o = t.projectLineSegment(new
|
|
2019
|
+
), o = t.projectLineSegment(new E(r, i)), a = o.center;
|
|
2020
2020
|
n.p = {
|
|
2021
2021
|
x: a?.x ?? 0,
|
|
2022
2022
|
y: a?.y ?? 0,
|
|
@@ -2053,7 +2053,7 @@ function se(...u) {
|
|
|
2053
2053
|
), f = t.projectPoint(
|
|
2054
2054
|
h.clone().add(e.clone().multiplyScalar(l.width * -0.5)),
|
|
2055
2055
|
!1
|
|
2056
|
-
), p = t.projectLineSegment(new
|
|
2056
|
+
), p = t.projectLineSegment(new E(d, f));
|
|
2057
2057
|
return p.currentData.wd = l, p;
|
|
2058
2058
|
}), s = n.flatMap((l) => {
|
|
2059
2059
|
const h = l.points.map((d) => (d.currentData.line = l, d.currentData.distance = d.distance(l.start), d));
|
|
@@ -2069,7 +2069,7 @@ function se(...u) {
|
|
|
2069
2069
|
continue;
|
|
2070
2070
|
}
|
|
2071
2071
|
if (i--, i === 0) {
|
|
2072
|
-
const d = new
|
|
2072
|
+
const d = new E(o, h);
|
|
2073
2073
|
d.currentData.wds = [...a].map((f) => f.currentData.wd), r.push(d), o = null, a.clear();
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
@@ -2092,12 +2092,12 @@ function _(u, t) {
|
|
|
2092
2092
|
n[s] === void 0 && delete n[s];
|
|
2093
2093
|
}), e && (u.userData.drawWindow || (u.userData.drawWindow = []), u.userData.drawWindow.push(...e)), Object.assign(u.userData, n);
|
|
2094
2094
|
}
|
|
2095
|
-
function
|
|
2095
|
+
function At(u, t) {
|
|
2096
2096
|
const { drawWindow: e, ...n } = t.userData;
|
|
2097
2097
|
e && (u.userData.drawWindow || (u.userData.drawWindow = []), e.forEach((s) => {
|
|
2098
2098
|
const r = D.from(s.p);
|
|
2099
2099
|
u.projectPoint(r) && u.userData.drawWindow?.push(s);
|
|
2100
|
-
}),
|
|
2100
|
+
}), ot(u)), Object.assign(u.userData, n);
|
|
2101
2101
|
}
|
|
2102
2102
|
class C {
|
|
2103
2103
|
/**
|
|
@@ -2201,7 +2201,7 @@ class C {
|
|
|
2201
2201
|
* @returns
|
|
2202
2202
|
*/
|
|
2203
2203
|
static getIntersectionTypes(t) {
|
|
2204
|
-
const e = new
|
|
2204
|
+
const e = new ft();
|
|
2205
2205
|
t.forEach((s) => {
|
|
2206
2206
|
s.userData.groups && s.userData.groups.forEach((r) => e.set(r.type)), s.userData.groupType && e.set(s.userData.groupType);
|
|
2207
2207
|
});
|
|
@@ -2261,7 +2261,7 @@ class C {
|
|
|
2261
2261
|
delete t.userData.groupId, delete t.userData.groupType, delete t.userData.groups;
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
|
-
class
|
|
2264
|
+
class pt {
|
|
2265
2265
|
static errorAngle = 4;
|
|
2266
2266
|
/** 线段投影分析
|
|
2267
2267
|
* @param index
|
|
@@ -2295,7 +2295,7 @@ class gt {
|
|
|
2295
2295
|
const n = t.filter((o) => !o.userData.isDoor && !C.hasType(o, "doubleWall")), s = /* @__PURE__ */ new Set(), r = [];
|
|
2296
2296
|
let i = new B(v.fromByLineSegment(...n));
|
|
2297
2297
|
return n.forEach((o, a) => i.insert({ line: o, userData: a })), n.forEach((o, a) => {
|
|
2298
|
-
const c =
|
|
2298
|
+
const c = nt.fromByLineSegment(o, e * 2, !1, -0.01);
|
|
2299
2299
|
i.queryRect(c).map((h) => h.userData).filter((h) => h !== a).forEach((h) => {
|
|
2300
2300
|
try {
|
|
2301
2301
|
if (s.has(`${a}-${h}`) || s.has(`${h}-${a}`)) return;
|
|
@@ -2326,23 +2326,23 @@ class gt {
|
|
|
2326
2326
|
return n.forEach((c) => {
|
|
2327
2327
|
const l = c.project, h = c.project2, d = c.source, f = c.target;
|
|
2328
2328
|
l.includedAngle(h) > 135 && (h.points = [h.points[1], h.points[0]]);
|
|
2329
|
-
const p = new
|
|
2329
|
+
const p = new E(l.start.clone(), h.start.clone()), g = new E(l.end.clone(), h.end.clone());
|
|
2330
2330
|
o.push(p, g), a(d, l), a(f, h);
|
|
2331
2331
|
}), i.forEach((c, l) => {
|
|
2332
|
-
const h =
|
|
2332
|
+
const h = E.clipping(l, c, At);
|
|
2333
2333
|
t.push(...h);
|
|
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 =
|
|
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 = E.autoMergeLines(o).lines, o = o.filter((c) => c.length() !== 0).map((c) => {
|
|
2335
2335
|
const l = s.queryLineSegment(c).filter((d) => !(!d.line.parallel(c) || d.line.projectLineSegment(c).length() === 0)).map((d) => d.line);
|
|
2336
2336
|
if (l.length === 0)
|
|
2337
2337
|
return s.insert(c), c;
|
|
2338
|
-
const h =
|
|
2338
|
+
const h = E.mergeLines(...l, c);
|
|
2339
2339
|
return l.forEach((d) => {
|
|
2340
2340
|
_(h, d), s.remove(d), r.add(d);
|
|
2341
2341
|
}), s.insert(h), h;
|
|
2342
|
-
}), 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 = Tt(t, 1e-9), s.clear(), t;
|
|
2343
2343
|
}
|
|
2344
2344
|
}
|
|
2345
|
-
class
|
|
2345
|
+
class gt {
|
|
2346
2346
|
index = 0;
|
|
2347
2347
|
get size() {
|
|
2348
2348
|
return this.index;
|
|
@@ -2378,7 +2378,7 @@ function $(u) {
|
|
|
2378
2378
|
t.insert(e.start, e), t.insert(e.end, e);
|
|
2379
2379
|
return t;
|
|
2380
2380
|
}
|
|
2381
|
-
function
|
|
2381
|
+
function Pt(u) {
|
|
2382
2382
|
const t = new B(v.fromByLineSegment(...u));
|
|
2383
2383
|
for (const e of u)
|
|
2384
2384
|
t.insert(e);
|
|
@@ -2387,13 +2387,13 @@ function It(u) {
|
|
|
2387
2387
|
const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2388
2388
|
__proto__: null,
|
|
2389
2389
|
createPointVirtualGrid: $,
|
|
2390
|
-
createQuadtree:
|
|
2390
|
+
createQuadtree: Pt
|
|
2391
2391
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2392
2392
|
function Ke(u, t, e, n = !0) {
|
|
2393
2393
|
e = e ?? /* @__PURE__ */ new Set();
|
|
2394
2394
|
const s = !!t, r = t || $(u);
|
|
2395
2395
|
function i(o) {
|
|
2396
|
-
if (!(o instanceof
|
|
2396
|
+
if (!(o instanceof E) || e?.has(o)) return;
|
|
2397
2397
|
const a = r?.queryPoint(o.start, !0), c = r?.queryPoint(o.end, !0);
|
|
2398
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))));
|
|
2399
2399
|
}
|
|
@@ -2403,9 +2403,9 @@ function Ke(u, t, e, n = !0) {
|
|
|
2403
2403
|
}
|
|
2404
2404
|
return s || r.clear(), e;
|
|
2405
2405
|
}
|
|
2406
|
-
function
|
|
2406
|
+
function It(u, t, e = !1) {
|
|
2407
2407
|
t = t || /* @__PURE__ */ new Set();
|
|
2408
|
-
const n = new
|
|
2408
|
+
const n = new et();
|
|
2409
2409
|
for (u.forEach((s) => {
|
|
2410
2410
|
t.size && t.has(s) || s.points.forEach((r) => {
|
|
2411
2411
|
const i = r.hashCode();
|
|
@@ -2425,7 +2425,7 @@ function vt(u, t, e = !1) {
|
|
|
2425
2425
|
return t;
|
|
2426
2426
|
}
|
|
2427
2427
|
function re(u) {
|
|
2428
|
-
const t = new
|
|
2428
|
+
const t = new et(), e = new et();
|
|
2429
2429
|
u.forEach((n) => {
|
|
2430
2430
|
n.points.forEach((s, r) => {
|
|
2431
2431
|
const i = s.hashCode();
|
|
@@ -2503,7 +2503,7 @@ class ie {
|
|
|
2503
2503
|
t(e, n);
|
|
2504
2504
|
}
|
|
2505
2505
|
}
|
|
2506
|
-
class
|
|
2506
|
+
class yt extends ie {
|
|
2507
2507
|
// 线段存储:使用规范化 key (小索引-大索引) 避免双向存储
|
|
2508
2508
|
lineMap = /* @__PURE__ */ new Map();
|
|
2509
2509
|
// 点坐标映射
|
|
@@ -2594,8 +2594,8 @@ class mt extends ie {
|
|
|
2594
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));
|
|
2595
2595
|
}
|
|
2596
2596
|
}
|
|
2597
|
-
let
|
|
2598
|
-
class
|
|
2597
|
+
let wt = !1;
|
|
2598
|
+
class at extends Array {
|
|
2599
2599
|
constructor(t = []) {
|
|
2600
2600
|
super(...t);
|
|
2601
2601
|
}
|
|
@@ -2657,7 +2657,7 @@ class ct extends Array {
|
|
|
2657
2657
|
const e = [];
|
|
2658
2658
|
for (let n = 0; n < this.length && !(!t && n === this.length - 1); n++) {
|
|
2659
2659
|
const s = this[n], r = this[(n + 1) % this.length];
|
|
2660
|
-
e.push(new
|
|
2660
|
+
e.push(new E(s, r));
|
|
2661
2661
|
}
|
|
2662
2662
|
return e;
|
|
2663
2663
|
}
|
|
@@ -2666,12 +2666,10 @@ class ct extends Array {
|
|
|
2666
2666
|
* @returns
|
|
2667
2667
|
*/
|
|
2668
2668
|
static fromByLines(t) {
|
|
2669
|
-
|
|
2669
|
+
wt || (t = E.groupByLeafPath(t).sort((i, o) => o.length - i.length)[0]);
|
|
2670
2670
|
const e = new G(), n = /* @__PURE__ */ new Set();
|
|
2671
|
-
t.forEach((i) => i.points.forEach((o) => e.insert(o, i)))
|
|
2671
|
+
t.forEach((i) => i.points.forEach((o) => e.insert(o, i)));
|
|
2672
2672
|
const s = t[0].start;
|
|
2673
|
-
for (let i = 0; i < t.length; i++)
|
|
2674
|
-
t[i];
|
|
2675
2673
|
let r = s;
|
|
2676
2674
|
for (n.add(t[0].end), n.add(r); ; ) {
|
|
2677
2675
|
const i = e.queryPoint(r, !0);
|
|
@@ -2680,26 +2678,26 @@ class ct extends Array {
|
|
|
2680
2678
|
if (r = a?.getAnotherPoint(o), n.has(r)) break;
|
|
2681
2679
|
n.add(r);
|
|
2682
2680
|
}
|
|
2683
|
-
return n.add(s.clone()), new
|
|
2681
|
+
return n.add(s.clone()), new at([...n].map((i) => i.clone()));
|
|
2684
2682
|
}
|
|
2685
2683
|
/** 通过线段创建,返回所有路径
|
|
2686
2684
|
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
2687
2685
|
* @param lines
|
|
2688
2686
|
*/
|
|
2689
2687
|
static multipleFromByLines(t) {
|
|
2690
|
-
const e =
|
|
2691
|
-
|
|
2688
|
+
const e = E.groupByLeafPath(t);
|
|
2689
|
+
wt = !0;
|
|
2692
2690
|
const n = e.map((s) => this.fromByLines(s));
|
|
2693
|
-
return
|
|
2691
|
+
return wt = !0, n;
|
|
2694
2692
|
}
|
|
2695
2693
|
}
|
|
2696
2694
|
const Ze = Math.PI / 180;
|
|
2697
|
-
function
|
|
2698
|
-
const n = $(u), s = new
|
|
2695
|
+
function vt(u, t, e = !1) {
|
|
2696
|
+
const n = $(u), s = new E(), r = new E(), i = [], o = /* @__PURE__ */ new Set(), a = new E(), c = new E();
|
|
2699
2697
|
function l(f, p, g) {
|
|
2700
2698
|
if (f.vertical(g)) {
|
|
2701
|
-
const
|
|
2702
|
-
return g.clone().directionMove(b,
|
|
2699
|
+
const L = f.center, b = f.center.direction(g.start);
|
|
2700
|
+
return g.clone().directionMove(b, L.distance(g.start));
|
|
2703
2701
|
}
|
|
2704
2702
|
const y = f.center, m = f.normal(), x = f.getAnotherPoint(p), M = x.direction(p);
|
|
2705
2703
|
s.start.copy(y), s.end.copy(y).add(m.clone().multiplyScalar(1));
|
|
@@ -2711,20 +2709,20 @@ function Rt(u, t, e = !1) {
|
|
|
2711
2709
|
o.add(p);
|
|
2712
2710
|
let M = x ? l(p, g, y) : y;
|
|
2713
2711
|
const w = p.getAnotherPoint(g);
|
|
2714
|
-
let
|
|
2715
|
-
if (
|
|
2716
|
-
const b =
|
|
2712
|
+
let L = n.queryPoint(w, !0);
|
|
2713
|
+
if (L.length === 1) {
|
|
2714
|
+
const b = L[0], S = b.userData;
|
|
2717
2715
|
if (f === S || (m.push(S), h(f, S, b.point, M, m))) return m;
|
|
2718
2716
|
} else {
|
|
2719
2717
|
r.start.copy(M.start).add(M.direction().multiplyScalar(5e-4));
|
|
2720
|
-
const b = [p, ...
|
|
2718
|
+
const b = [p, ...L.map((S) => {
|
|
2721
2719
|
const T = S.userData;
|
|
2722
2720
|
return T.length(), T;
|
|
2723
2721
|
})];
|
|
2724
|
-
for (let S = 0; S <
|
|
2725
|
-
const T =
|
|
2722
|
+
for (let S = 0; S < L.length; S++) {
|
|
2723
|
+
const T = L[S], A = T.userData;
|
|
2726
2724
|
if (f === A) return m;
|
|
2727
|
-
if (!(
|
|
2725
|
+
if (!(L.length === 4 && A.parallel(p)) && (r.end.copy(A.center), !b.some((R) => R === A ? !1 : R.intersectLineSegment(r))))
|
|
2728
2726
|
return m.push(A), h(f, A, T.point, M, m);
|
|
2729
2727
|
}
|
|
2730
2728
|
}
|
|
@@ -2736,13 +2734,13 @@ function Rt(u, t, e = !1) {
|
|
|
2736
2734
|
];
|
|
2737
2735
|
for (let x = 0; x < 2; x++) {
|
|
2738
2736
|
o.clear();
|
|
2739
|
-
const M = m[x], w = M.direction(),
|
|
2740
|
-
if (h(f, f, f.start, M,
|
|
2737
|
+
const M = m[x], w = M.direction(), L = [f];
|
|
2738
|
+
if (h(f, f, f.start, M, L, !1)) {
|
|
2741
2739
|
const b = g.clone().add(w.multiplyScalar(5e-4));
|
|
2742
|
-
if (
|
|
2740
|
+
if (L.length > 5 && !at.fromByLines(L).pointIn(b))
|
|
2743
2741
|
continue;
|
|
2744
|
-
p.push(
|
|
2745
|
-
} else e && p.push(
|
|
2742
|
+
p.push(L);
|
|
2743
|
+
} else e && p.push(L);
|
|
2746
2744
|
}
|
|
2747
2745
|
return p;
|
|
2748
2746
|
}
|
|
@@ -2756,7 +2754,7 @@ function oe(u) {
|
|
|
2756
2754
|
const t = new H(), e = [];
|
|
2757
2755
|
u.forEach((n) => t.append(n.length, n));
|
|
2758
2756
|
for (const n of t.values()) {
|
|
2759
|
-
const s = new
|
|
2757
|
+
const s = new gt(n.flat()), r = new H();
|
|
2760
2758
|
n.map((i) => {
|
|
2761
2759
|
const o = i.map((a) => s.getIndex(a)).sort((a, c) => a - c).join(",");
|
|
2762
2760
|
r.append(o, i);
|
|
@@ -2772,7 +2770,7 @@ function ae(u, t = !1) {
|
|
|
2772
2770
|
e.has(l) ? n.union(a, e.get(l)) : e.set(l, a);
|
|
2773
2771
|
}
|
|
2774
2772
|
});
|
|
2775
|
-
const r = new
|
|
2773
|
+
const r = new ft(), i = n.getAllSets().valueArray.map((o) => {
|
|
2776
2774
|
let a = o.map((l) => u[l]);
|
|
2777
2775
|
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), []));
|
|
2778
2776
|
});
|
|
@@ -2782,7 +2780,7 @@ function ae(u, t = !1) {
|
|
|
2782
2780
|
};
|
|
2783
2781
|
}
|
|
2784
2782
|
function ce(u) {
|
|
2785
|
-
const t = new
|
|
2783
|
+
const t = new yt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
2786
2784
|
function r(i) {
|
|
2787
2785
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
2788
2786
|
if (!n.has(a))
|
|
@@ -2798,13 +2796,13 @@ function ce(u) {
|
|
|
2798
2796
|
}), s;
|
|
2799
2797
|
}
|
|
2800
2798
|
function le(u) {
|
|
2801
|
-
let t =
|
|
2799
|
+
let t = It(u, /* @__PURE__ */ new Set(), !0);
|
|
2802
2800
|
u = u.filter((o) => !t.has(o));
|
|
2803
|
-
const e =
|
|
2801
|
+
const e = E.groupByPath(u), n = [], s = [];
|
|
2804
2802
|
e.forEach((o, a) => {
|
|
2805
2803
|
try {
|
|
2806
2804
|
let c = ce(o);
|
|
2807
|
-
const l = ae(
|
|
2805
|
+
const l = ae(vt(o, c));
|
|
2808
2806
|
n.push(...l.rings), s.push(...l.internalEdges);
|
|
2809
2807
|
} catch (c) {
|
|
2810
2808
|
console.warn("环查找出现异常:", c);
|
|
@@ -2828,23 +2826,22 @@ function Z(u, t = [], e = !0, n = !1) {
|
|
|
2828
2826
|
t.forEach((d) => {
|
|
2829
2827
|
C.replace(d, l, "door") || C.set(d, l, "door");
|
|
2830
2828
|
}), i.forEach((d) => {
|
|
2831
|
-
TEST;
|
|
2832
2829
|
const f = V();
|
|
2833
2830
|
d.forEach((p) => {
|
|
2834
2831
|
C.replace(p, f, "doubleWall") || C.set(p, f, "doubleWall"), C.removeByType(p, "wall");
|
|
2835
|
-
}), n && a.queryPolygon(
|
|
2832
|
+
}), n && a.queryPolygon(at.fromByLines(d)).forEach((p) => c.add(p.userData));
|
|
2836
2833
|
}), r.forEach((d) => {
|
|
2837
2834
|
o.has(d) || C.hasType(d, "bayWindow") || (C.set(d, "default", "wall"), C.removeByType(d, "doubleWall"));
|
|
2838
2835
|
}), r = r.filter((d) => !c.has(d));
|
|
2839
2836
|
const h = t.filter((d) => !c.has(d));
|
|
2840
2837
|
t.length = 0, t.push(...h);
|
|
2841
2838
|
}
|
|
2842
|
-
return r.push(...s),
|
|
2839
|
+
return r.push(...s), E.brokenLineMerging(r, _);
|
|
2843
2840
|
}
|
|
2844
|
-
function
|
|
2841
|
+
function bt(u, t = !0) {
|
|
2845
2842
|
const e = u.filter((s) => s.userData.isBayWindow), n = /* @__PURE__ */ new Set();
|
|
2846
2843
|
return e.forEach((s) => {
|
|
2847
|
-
let r =
|
|
2844
|
+
let r = vt(u, [s], !1);
|
|
2848
2845
|
if (r = r.filter((i) => i.some((o) => o.userData.isWindow && C.hasType(o, "bayWindow"))), r.length) {
|
|
2849
2846
|
const i = r[0], o = V();
|
|
2850
2847
|
i.forEach((a) => {
|
|
@@ -2879,7 +2876,7 @@ function Qe(u, t = 0.1, e) {
|
|
|
2879
2876
|
if (c.length === 0) return;
|
|
2880
2877
|
s.add(a), s.add(c[0].point);
|
|
2881
2878
|
const l = c[0].userData, h = i.projectLineSegment(l), d = l.projectLineSegment(i), f = h.length(), p = d.length();
|
|
2882
|
-
f === 0 && p === 0 ? n.push(new
|
|
2879
|
+
f === 0 && p === 0 ? n.push(new E(a.clone(), c[0].point.clone())) : n.push(new E(h.center, d.center));
|
|
2883
2880
|
});
|
|
2884
2881
|
}
|
|
2885
2882
|
return [...u, ...n];
|
|
@@ -3007,7 +3004,7 @@ function zt(u, t, e, n) {
|
|
|
3007
3004
|
x === 0 ? i.set(f, M) : o.set(f, M);
|
|
3008
3005
|
});
|
|
3009
3006
|
}), r.sort((f, p) => p.value - f.value).forEach((f, p) => f.index = p);
|
|
3010
|
-
const a = new Q(u.length), c = new
|
|
3007
|
+
const a = new Q(u.length), c = new gt(u);
|
|
3011
3008
|
function l(f, p) {
|
|
3012
3009
|
return f.point.distance(p.point) <= n;
|
|
3013
3010
|
}
|
|
@@ -3018,10 +3015,10 @@ function zt(u, t, e, n) {
|
|
|
3018
3015
|
for (let f = 0; f < r.length; f++) {
|
|
3019
3016
|
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;
|
|
3020
3017
|
for (let w = f - 1; w >= 0; w--) {
|
|
3021
|
-
const
|
|
3022
|
-
if (l(
|
|
3023
|
-
if (h(
|
|
3024
|
-
a.union(c.getIndex(g), c.getIndex(
|
|
3018
|
+
const L = r[w];
|
|
3019
|
+
if (l(L, p)) {
|
|
3020
|
+
if (h(L, x, M)) {
|
|
3021
|
+
a.union(c.getIndex(g), c.getIndex(L.line));
|
|
3025
3022
|
break;
|
|
3026
3023
|
}
|
|
3027
3024
|
} else break;
|
|
@@ -3032,14 +3029,14 @@ function zt(u, t, e, n) {
|
|
|
3032
3029
|
if (f.length <= 2) return [f];
|
|
3033
3030
|
const p = f.map((A) => s.get(A)).sort((A, R) => A.value - R.value), g = p[0], y = p[p.length - 1];
|
|
3034
3031
|
if (g.point.distance(y.point) < n) return [f];
|
|
3035
|
-
const m = [...p].sort((A, R) => R.line.length() - A.line.length()), x = m[0], M = m[0], w = x.line.length(),
|
|
3036
|
-
if (x.point.distance(M.point) > n ||
|
|
3032
|
+
const m = [...p].sort((A, R) => R.line.length() - A.line.length()), x = m[0], M = m[0], w = x.line.length(), L = M.line.length(), b = x.line.projectLineSegment(M.line), S = b.length();
|
|
3033
|
+
if (x.point.distance(M.point) > n || L / w > 0.5 && S / L < 0.5) {
|
|
3037
3034
|
const A = [x.line], R = [M.line];
|
|
3038
3035
|
for (let j = 0; j < p.length; j++) {
|
|
3039
3036
|
const F = p[j];
|
|
3040
3037
|
if (F === x || F === M) continue;
|
|
3041
3038
|
const W = M.line.projectLineSegment(F.line), q = W.length();
|
|
3042
|
-
M.point.distance(F.point) <= n && q /
|
|
3039
|
+
M.point.distance(F.point) <= n && q / L > 0 ? R.push(F.line) : A.push(F.line);
|
|
3043
3040
|
}
|
|
3044
3041
|
return [A, R];
|
|
3045
3042
|
}
|
|
@@ -3116,7 +3113,7 @@ function on(u, t = 0.1, e) {
|
|
|
3116
3113
|
if (s.length === 1) return s[0];
|
|
3117
3114
|
const r = [];
|
|
3118
3115
|
s.forEach((f) => r.push(f.start.clone(), f.end.clone()));
|
|
3119
|
-
const i = n === "average" ?
|
|
3116
|
+
const i = n === "average" ? E.mergeLines(...s) : E.mergeLinesByMaxlength(...s);
|
|
3120
3117
|
let o = [], a = [];
|
|
3121
3118
|
s.forEach((f) => {
|
|
3122
3119
|
const { drawDoorData: p, drawWindow: g, rooftopPz: y, isWindow: m, ...x } = f.userData;
|
|
@@ -3135,7 +3132,7 @@ function on(u, t = 0.1, e) {
|
|
|
3135
3132
|
}).filter((s) => !!s);
|
|
3136
3133
|
}
|
|
3137
3134
|
function an(u, t, e) {
|
|
3138
|
-
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new B(v.fromByLineSegment(...u)), i = new
|
|
3135
|
+
const { snapThreshold: n = 0.2 } = e ?? {}, s = new G(), r = new B(v.fromByLineSegment(...u)), i = new E(), o = /* @__PURE__ */ new Map();
|
|
3139
3136
|
u.forEach((d) => {
|
|
3140
3137
|
d.userData.isDoor || (r.insert(d), d.points.forEach((f) => s.insert(f, d)));
|
|
3141
3138
|
});
|
|
@@ -3158,14 +3155,14 @@ function an(u, t, e) {
|
|
|
3158
3155
|
function l(d, f) {
|
|
3159
3156
|
let p = c(d, f);
|
|
3160
3157
|
if (p)
|
|
3161
|
-
return a(f, new
|
|
3158
|
+
return a(f, new E(d.clone(), p.clone()));
|
|
3162
3159
|
if (s.queryPoint(d).filter((M) => M.userData !== f).length !== 0 || r.queryCircle(d, 1e-3).filter((M) => M.line !== f).length > 0) return;
|
|
3163
3160
|
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));
|
|
3164
3161
|
if (!y.length) return;
|
|
3165
3162
|
const m = y[0], x = m.userData?.projectPoint(d, !1);
|
|
3166
3163
|
if (x) {
|
|
3167
3164
|
const M = m.userData;
|
|
3168
|
-
a(f, new
|
|
3165
|
+
a(f, new E(d.clone(), x.clone())), a(M, new E(m.point.clone(), x.clone()));
|
|
3169
3166
|
}
|
|
3170
3167
|
}
|
|
3171
3168
|
function h(d, f, p) {
|
|
@@ -3184,17 +3181,17 @@ function an(u, t, e) {
|
|
|
3184
3181
|
y || l(f.start, f), m || l(f.end, f);
|
|
3185
3182
|
}
|
|
3186
3183
|
return o.forEach((d, f) => {
|
|
3187
|
-
const p =
|
|
3184
|
+
const p = E.mergeLines(f, ...d);
|
|
3188
3185
|
f.set(p.start, p.end);
|
|
3189
3186
|
}), s.clear(), r.clear(), u;
|
|
3190
3187
|
}
|
|
3191
3188
|
function cn(u, t, e = 0.01) {
|
|
3192
|
-
const n =
|
|
3189
|
+
const n = It([...u, ...t]), s = $([...n]);
|
|
3193
3190
|
for (let r = 0; r < t.length; r++)
|
|
3194
3191
|
t[r].points.forEach((o) => {
|
|
3195
3192
|
s.queryPoint(o, !0).forEach((a) => n.delete(a.userData));
|
|
3196
3193
|
});
|
|
3197
|
-
return u = u.filter((r) => !n.has(r) || r.length() > e), u =
|
|
3194
|
+
return u = u.filter((r) => !n.has(r) || r.length() > e), u = E.brokenLineMerging(u, _), ot(...u), u;
|
|
3198
3195
|
}
|
|
3199
3196
|
function ln(u) {
|
|
3200
3197
|
const t = [];
|
|
@@ -3220,7 +3217,7 @@ function ln(u) {
|
|
|
3220
3217
|
return { doorLines: u, doorIntersectLines: t };
|
|
3221
3218
|
}
|
|
3222
3219
|
function un(u, t) {
|
|
3223
|
-
const e = $(u), n =
|
|
3220
|
+
const e = $(u), n = Pt(u);
|
|
3224
3221
|
for (let s = 0; s < t.length; s++) {
|
|
3225
3222
|
const r = t[s];
|
|
3226
3223
|
r.points.map((a) => {
|
|
@@ -3267,22 +3264,22 @@ class ue {
|
|
|
3267
3264
|
static correction(t, e, n) {
|
|
3268
3265
|
const s = t.indexOf(e);
|
|
3269
3266
|
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
|
|
3267
|
+
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 E(
|
|
3271
3268
|
l.clone().add(c.clone().multiplyScalar(-1e3)),
|
|
3272
3269
|
l.clone().add(c.clone().multiplyScalar(1e3))
|
|
3273
|
-
), f = new
|
|
3270
|
+
), f = new E(
|
|
3274
3271
|
l.clone().add(h.clone().multiplyScalar(-1e3)),
|
|
3275
3272
|
l.clone().add(h.clone().multiplyScalar(1e3))
|
|
3276
3273
|
);
|
|
3277
3274
|
let p = sn(i, o, d, f, r, n);
|
|
3278
3275
|
p = rn(p, r);
|
|
3279
3276
|
let g = on(p, 0.1, n);
|
|
3280
|
-
g =
|
|
3277
|
+
g = E.brokenLineMerging(g, _), g = an(g, r, n), g = Tt(g, 1e-9), ln(a), g = cn(g, a, 0.15), g = bt(g);
|
|
3281
3278
|
const { wallGroup: y = !0 } = n ?? {};
|
|
3282
|
-
return y && (g = Z(g), g =
|
|
3279
|
+
return y && (g = Z(g), g = pt.complementSide(g), g = Z(g, a, !0, !1), g = bt(g, !1)), un(g, a), ot(...g), g.push(...a), g;
|
|
3283
3280
|
}
|
|
3284
3281
|
}
|
|
3285
|
-
const hn = new
|
|
3282
|
+
const hn = new E(
|
|
3286
3283
|
new D(0, 0),
|
|
3287
3284
|
new D(0, 1)
|
|
3288
3285
|
);
|
|
@@ -3300,7 +3297,7 @@ function de(u) {
|
|
|
3300
3297
|
const n = [];
|
|
3301
3298
|
return u.forEach(({ start: r, end: i, ...o }, a) => {
|
|
3302
3299
|
n.push(r.z ?? 0, i.z ?? 0);
|
|
3303
|
-
const c = new
|
|
3300
|
+
const c = new E(
|
|
3304
3301
|
D.from(r),
|
|
3305
3302
|
D.from(i)
|
|
3306
3303
|
);
|
|
@@ -3321,276 +3318,7 @@ function fe(u) {
|
|
|
3321
3318
|
}
|
|
3322
3319
|
return Math.abs(t) / 2;
|
|
3323
3320
|
}
|
|
3324
|
-
|
|
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 = {
|
|
3321
|
+
const dn = {
|
|
3594
3322
|
Unitless: 1,
|
|
3595
3323
|
// 无单位,1米 = 1(无单位)
|
|
3596
3324
|
Inches: 39.37007874015748,
|
|
@@ -3637,7 +3365,7 @@ const Ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3637
3365
|
function kt(u) {
|
|
3638
3366
|
const t = [];
|
|
3639
3367
|
for (let e = 0; e < u.length; e++)
|
|
3640
|
-
t.push(new
|
|
3368
|
+
t.push(new E(
|
|
3641
3369
|
u[e].clone(),
|
|
3642
3370
|
u[(e + 1) % u.length].clone()
|
|
3643
3371
|
));
|
|
@@ -3702,7 +3430,7 @@ class U extends z {
|
|
|
3702
3430
|
data: t,
|
|
3703
3431
|
setData(i) {
|
|
3704
3432
|
e = i.map(({ start: o, end: a, ...c }) => {
|
|
3705
|
-
const l = new
|
|
3433
|
+
const l = new E(D.from(o), D.from(a));
|
|
3706
3434
|
return l.userData = c, l;
|
|
3707
3435
|
}), t = i;
|
|
3708
3436
|
}
|
|
@@ -3915,8 +3643,8 @@ class U extends z {
|
|
|
3915
3643
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
3916
3644
|
*/
|
|
3917
3645
|
lineOffset(t = U.EndType.etOpenSquare, e = U.JoinType.jtMiter, n = 1e4) {
|
|
3918
|
-
let s = new
|
|
3919
|
-
const r = new
|
|
3646
|
+
let s = new Ot.Paths();
|
|
3647
|
+
const r = new Ot.ClipperOffset(20, 0.25);
|
|
3920
3648
|
return this.pointsGroups.forEach((i) => {
|
|
3921
3649
|
const o = this.lineTopology(i).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
|
|
3922
3650
|
r.AddPaths(o, e, t);
|
|
@@ -3935,7 +3663,7 @@ class U extends z {
|
|
|
3935
3663
|
if (this.verticalReferenceLine) {
|
|
3936
3664
|
const e = this.getLineSegments(), n = performance.now(), s = ue.correction(e, this.verticalReferenceLine, t);
|
|
3937
3665
|
console.log("垂直纠正消耗时间:", (performance.now() - n).toFixed(2), "ms", "处理线段数量:", e.length);
|
|
3938
|
-
const r =
|
|
3666
|
+
const r = rt(s);
|
|
3939
3667
|
await this.set(r);
|
|
3940
3668
|
} else
|
|
3941
3669
|
throw new Error("未找到一条垂直纠正基准轴线");
|
|
@@ -3979,13 +3707,13 @@ class U extends z {
|
|
|
3979
3707
|
* 线段数据转为原始json数据
|
|
3980
3708
|
*/
|
|
3981
3709
|
lineDataToOriginalData(t, e) {
|
|
3982
|
-
return
|
|
3710
|
+
return rt(t, this.originalZAverage, e);
|
|
3983
3711
|
}
|
|
3984
3712
|
/**
|
|
3985
3713
|
* 转为绘制数据
|
|
3986
3714
|
*/
|
|
3987
3715
|
toDrawDataJson(t = "Millimeters") {
|
|
3988
|
-
const e =
|
|
3716
|
+
const e = dn[t], n = {
|
|
3989
3717
|
unit: t,
|
|
3990
3718
|
line: [],
|
|
3991
3719
|
arc: [],
|
|
@@ -4029,20 +3757,20 @@ class U extends z {
|
|
|
4029
3757
|
if (s = "cyan", l.length() < 1.2) {
|
|
4030
3758
|
l.expansion(-o * 0.5);
|
|
4031
3759
|
const h = c.normal();
|
|
4032
|
-
let d = new
|
|
3760
|
+
let d = new E(
|
|
4033
3761
|
l.start.clone(),
|
|
4034
3762
|
l.start.clone().add(h.clone().multiplyScalar(l.length()))
|
|
4035
3763
|
);
|
|
4036
3764
|
const f = d.clone().directionMove(d.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
|
|
4037
3765
|
for (let w = 0; w < a.length; w++)
|
|
4038
3766
|
if (a[w].intersectRectangle(f)) {
|
|
4039
|
-
d = new
|
|
3767
|
+
d = new E(
|
|
4040
3768
|
l.start.clone(),
|
|
4041
3769
|
l.start.clone().add(h.clone().multiplyScalar(-l.length()))
|
|
4042
3770
|
);
|
|
4043
3771
|
break;
|
|
4044
3772
|
}
|
|
4045
|
-
d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((w,
|
|
3773
|
+
d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((w, L) => r(w, L));
|
|
4046
3774
|
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);
|
|
4047
3775
|
i(m, y, Math.min(x, M), Math.max(x, M)), a.push(f);
|
|
4048
3776
|
} else
|
|
@@ -4050,7 +3778,7 @@ class U extends z {
|
|
|
4050
3778
|
}), s = "yellow", this.lineSegments.forEach((c) => {
|
|
4051
3779
|
if (!c.userData.isWindow) return !1;
|
|
4052
3780
|
Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
|
|
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
|
|
3781
|
+
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 E(p, g);
|
|
4054
3782
|
r(y.start, y.end), y.expandToRectangle(this.width, "bothSides").path2D((m, x) => r(m, x));
|
|
4055
3783
|
});
|
|
4056
3784
|
}), n;
|
|
@@ -4094,8 +3822,8 @@ class U extends z {
|
|
|
4094
3822
|
* 将点json结构转换为Dxf string
|
|
4095
3823
|
*/
|
|
4096
3824
|
toDxfString(t = "Millimeters") {
|
|
4097
|
-
const e = new
|
|
4098
|
-
e.setUnits(t), e.addLayer("cyan",
|
|
3825
|
+
const e = new ct();
|
|
3826
|
+
e.setUnits(t), e.addLayer("cyan", ct.ACI.CYAN, "DOTTED"), e.addLayer("yellow", ct.ACI.YELLOW, "DOTTED"), e.addLayer("white", ct.ACI.WHITE, "DOTTED");
|
|
4099
3827
|
const n = this.toDrawDataJson();
|
|
4100
3828
|
return n.line.forEach((s) => {
|
|
4101
3829
|
let [r, i, o, a, c] = s;
|
|
@@ -4117,7 +3845,7 @@ class U extends z {
|
|
|
4117
3845
|
* @param filename
|
|
4118
3846
|
*/
|
|
4119
3847
|
async downloadOriginalData(t) {
|
|
4120
|
-
const e =
|
|
3848
|
+
const e = rt(this.getLineSegments()), n = JSON.stringify(e);
|
|
4121
3849
|
if (typeof window < "u") {
|
|
4122
3850
|
const s = new Blob([n], { type: "application/json" }), r = document.createElement("a");
|
|
4123
3851
|
r.href = URL.createObjectURL(s), r.download = t, r.click();
|
|
@@ -4179,8 +3907,8 @@ class U extends z {
|
|
|
4179
3907
|
});
|
|
4180
3908
|
}
|
|
4181
3909
|
}
|
|
4182
|
-
const Y = new
|
|
4183
|
-
class
|
|
3910
|
+
const Y = new E();
|
|
3911
|
+
class pe extends U {
|
|
4184
3912
|
static name = "AngleCorrectionDxf";
|
|
4185
3913
|
angle = 0;
|
|
4186
3914
|
onAddFromParent(t) {
|
|
@@ -4193,7 +3921,7 @@ class ge extends U {
|
|
|
4193
3921
|
const h = e.originalData[l];
|
|
4194
3922
|
if (Y.start.copy(h.start), Y.end.copy(h.end), h.isVerticalReferenceLine) {
|
|
4195
3923
|
const [d, f] = h.start.y < h.end.y ? [Y.start, Y.end] : [Y.end, Y.start];
|
|
4196
|
-
s = -new
|
|
3924
|
+
s = -new E(d, f).direction().angleBetween(new D(0, 1), "angle", "360"), r = null;
|
|
4197
3925
|
break;
|
|
4198
3926
|
}
|
|
4199
3927
|
(!r || Y.length() > r.length()) && (r = Y.clone(), r.userData.index = l);
|
|
@@ -4201,7 +3929,7 @@ class ge extends U {
|
|
|
4201
3929
|
if (r) {
|
|
4202
3930
|
e.originalData[r.userData.index].isVerticalReferenceLine = !0;
|
|
4203
3931
|
const [l, h] = r.start.y < r.end.y ? [r.start, r.end] : [r.end, r.start];
|
|
4204
|
-
s = -new
|
|
3932
|
+
s = -new E(l, h).direction().angleBetween(new D(0, 1), "angle", "360");
|
|
4205
3933
|
}
|
|
4206
3934
|
function i(l, h) {
|
|
4207
3935
|
return l.division(o).rotate(D.zero(), h * (Math.PI / 180));
|
|
@@ -4226,7 +3954,7 @@ class ge extends U {
|
|
|
4226
3954
|
});
|
|
4227
3955
|
}
|
|
4228
3956
|
}
|
|
4229
|
-
class
|
|
3957
|
+
class Rt extends z {
|
|
4230
3958
|
static name = "Variable";
|
|
4231
3959
|
originalLineVisible = !0;
|
|
4232
3960
|
dxfVisible = !0;
|
|
@@ -4253,7 +3981,7 @@ class Ct extends z {
|
|
|
4253
3981
|
if (t in this) return this[t];
|
|
4254
3982
|
}
|
|
4255
3983
|
}
|
|
4256
|
-
class
|
|
3984
|
+
class Ct extends z {
|
|
4257
3985
|
static name = "LineAnalysis";
|
|
4258
3986
|
Dxf = null;
|
|
4259
3987
|
Variable = null;
|
|
@@ -4267,7 +3995,7 @@ class Bt extends z {
|
|
|
4267
3995
|
* @param parent
|
|
4268
3996
|
*/
|
|
4269
3997
|
onAddFromParent(t) {
|
|
4270
|
-
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(
|
|
3998
|
+
this.Dxf = t.findComponentByType(U), this.Variable = this.parent?.findComponentByType(Rt), this.Dxf.addEventListener("setDta", () => {
|
|
4271
3999
|
this.lineAnalysis(), this.dispatchEvent({ type: "analysisCompleted" });
|
|
4272
4000
|
});
|
|
4273
4001
|
}
|
|
@@ -4301,7 +4029,7 @@ class Bt extends z {
|
|
|
4301
4029
|
*/
|
|
4302
4030
|
addData(t, e) {
|
|
4303
4031
|
const n = this.Dxf;
|
|
4304
|
-
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new
|
|
4032
|
+
n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new E(t.clone(), e.clone()));
|
|
4305
4033
|
}
|
|
4306
4034
|
/** 结果分析创建矩形
|
|
4307
4035
|
* @param result
|
|
@@ -4315,7 +4043,7 @@ class Bt extends z {
|
|
|
4315
4043
|
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)) {
|
|
4316
4044
|
d.set(g.x, g.y), f.set(y.x, y.y);
|
|
4317
4045
|
for (let M = 1; M < o; M++) {
|
|
4318
|
-
const w = l.clone().multiplyScalar(a * M),
|
|
4046
|
+
const w = l.clone().multiplyScalar(a * M), L = h.clone().multiplyScalar(c * M), b = d.clone().add(w), S = f.clone().add(L);
|
|
4319
4047
|
this.addData(b, S);
|
|
4320
4048
|
}
|
|
4321
4049
|
}
|
|
@@ -4343,7 +4071,7 @@ class Bt extends z {
|
|
|
4343
4071
|
this.buildQuadtree();
|
|
4344
4072
|
const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
|
|
4345
4073
|
e.forEach((r, i) => {
|
|
4346
|
-
const o = e[i], a =
|
|
4074
|
+
const o = e[i], a = nt.fromByLineSegment(o, this.width * 2, !1, -0.01);
|
|
4347
4075
|
t.queryRect(a).map((l) => l.userData).filter((l) => l !== i).forEach((l) => {
|
|
4348
4076
|
try {
|
|
4349
4077
|
if (n.has(`${i}-${l}`) || n.has(`${l}-${i}`)) return;
|
|
@@ -4383,7 +4111,7 @@ class Bt extends z {
|
|
|
4383
4111
|
}
|
|
4384
4112
|
}
|
|
4385
4113
|
}
|
|
4386
|
-
class
|
|
4114
|
+
class fn {
|
|
4387
4115
|
// 所有可查找的点位
|
|
4388
4116
|
possibleDoorPoints = [];
|
|
4389
4117
|
doorPoint = [];
|
|
@@ -4447,11 +4175,11 @@ class yn {
|
|
|
4447
4175
|
);
|
|
4448
4176
|
const a = [];
|
|
4449
4177
|
return o.forEach((c) => {
|
|
4450
|
-
const l = new
|
|
4178
|
+
const l = new E(c?.start, c?.end), h = l.length();
|
|
4451
4179
|
if (h < n) return;
|
|
4452
4180
|
const d = l.normal(), f = l.direction(), p = (h - i.width * 2) / 2;
|
|
4453
4181
|
for (let g = 0; g < 3; g++) {
|
|
4454
|
-
const y = l.start.clone().add(f.clone().multiplyScalar(i.width + p * g)), m = new
|
|
4182
|
+
const y = l.start.clone().add(f.clone().multiplyScalar(i.width + p * g)), m = new E(
|
|
4455
4183
|
y,
|
|
4456
4184
|
y.clone().add(d.clone().multiplyScalar(1))
|
|
4457
4185
|
);
|
|
@@ -4489,7 +4217,7 @@ class yn {
|
|
|
4489
4217
|
if (o.doorDirectConnection) {
|
|
4490
4218
|
const { start: a, end: c, ...l } = o;
|
|
4491
4219
|
this.continueFind = !1;
|
|
4492
|
-
const h = new
|
|
4220
|
+
const h = new E(D.from(a), D.from(c));
|
|
4493
4221
|
h.userData = {
|
|
4494
4222
|
...k(l),
|
|
4495
4223
|
doorDirectConnection: !0,
|
|
@@ -4543,18 +4271,18 @@ class yn {
|
|
|
4543
4271
|
function o({ point: y, line: m }, x, M) {
|
|
4544
4272
|
const w = m.direction();
|
|
4545
4273
|
m.start === y && w.multiplyScalar(-1);
|
|
4546
|
-
const
|
|
4547
|
-
for (let S = 0; S <
|
|
4548
|
-
const T = e.findIndex((q) => q.point ===
|
|
4274
|
+
const L = r.queryCircle(y, n).filter((S) => S.userData !== m).sort((S, T) => S.point.distance(y) - T.point.distance(y)), b = [];
|
|
4275
|
+
for (let S = 0; S < L.length; S++) {
|
|
4276
|
+
const T = e.findIndex((q) => q.point === L[S].point);
|
|
4549
4277
|
if (T === -1) continue;
|
|
4550
4278
|
const A = t[x].uuid, R = e[T].uuid;
|
|
4551
4279
|
if (M.has(`${A}.${R}`)) continue;
|
|
4552
4280
|
M.add(`${A}.${R}`), M.add(`${R}.${A}`);
|
|
4553
|
-
const j =
|
|
4281
|
+
const j = L[S].point, F = new E(y.clone(), j.clone());
|
|
4554
4282
|
if (F.direction().angleBetween(w, "angle") < s) {
|
|
4555
|
-
const q = t[x].line.direction(), N =
|
|
4556
|
-
N.start.equal(
|
|
4557
|
-
findData:
|
|
4283
|
+
const q = t[x].line.direction(), N = L[S].userData;
|
|
4284
|
+
N.start.equal(L[S].point) && q.multiplyScalar(-1), F.direction().multiplyScalar(-1).angleBetween(q, "angle") < s && (i.queryLineSegment(F).filter((mt) => !(mt.line.start.equal(y) || mt.line.end.equal(y) || mt.line === N)).length || b.push({
|
|
4285
|
+
findData: L[S],
|
|
4558
4286
|
findUuid: R,
|
|
4559
4287
|
doorLine: F,
|
|
4560
4288
|
doorUuid: A
|
|
@@ -4565,16 +4293,16 @@ class yn {
|
|
|
4565
4293
|
}
|
|
4566
4294
|
function a(y, m, x, M, w) {
|
|
4567
4295
|
M.add(y);
|
|
4568
|
-
const
|
|
4569
|
-
w &&
|
|
4296
|
+
const L = [];
|
|
4297
|
+
w && L.push(w);
|
|
4570
4298
|
for (let b = 0; b < x.length; b++) {
|
|
4571
4299
|
const S = x[b];
|
|
4572
4300
|
if (m.has(S.findUuid)) {
|
|
4573
4301
|
const T = m.get(S.findUuid);
|
|
4574
|
-
a(S.findUuid, m, T, M, S) &&
|
|
4575
|
-
} else
|
|
4302
|
+
a(S.findUuid, m, T, M, S) && L.push(S);
|
|
4303
|
+
} else L.push(S);
|
|
4576
4304
|
}
|
|
4577
|
-
return
|
|
4305
|
+
return L.sort((b, S) => b.doorLine.length() - S.doorLine.length()), w && L[0] === w ? (x.splice(0), !0) : (x.splice(1), !1);
|
|
4578
4306
|
}
|
|
4579
4307
|
const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
4580
4308
|
t.map((y, m) => {
|
|
@@ -4604,10 +4332,10 @@ class yn {
|
|
|
4604
4332
|
});
|
|
4605
4333
|
const g = [];
|
|
4606
4334
|
return f.forEach((y) => {
|
|
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(),
|
|
4335
|
+
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(), L = this.findLongLineSegment(t[m].line), b = this.findLongLineSegment(e[x].line), S = L.projectPoint(w);
|
|
4608
4336
|
if (S) {
|
|
4609
4337
|
M.copy(S);
|
|
4610
|
-
const T = new
|
|
4338
|
+
const T = new E(M, w), A = b.includedAngle(T);
|
|
4611
4339
|
(A < 10 || A > 170 || Math.abs(90 - A) < 10) && g.push({
|
|
4612
4340
|
start: M,
|
|
4613
4341
|
end: w
|
|
@@ -4615,7 +4343,7 @@ class yn {
|
|
|
4615
4343
|
} else {
|
|
4616
4344
|
const T = b.projectPoint(M);
|
|
4617
4345
|
T && w.copy(T);
|
|
4618
|
-
const A = new
|
|
4346
|
+
const A = new E(M, w), R = L.includedAngle(A);
|
|
4619
4347
|
(R < 10 || R > 170 || Math.abs(90 - R) < 10) && g.push({
|
|
4620
4348
|
start: M,
|
|
4621
4349
|
end: w
|
|
@@ -4639,7 +4367,7 @@ class yn {
|
|
|
4639
4367
|
searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
|
|
4640
4368
|
const s = this.quadtree, r = e.direction();
|
|
4641
4369
|
e.start === t && r.multiplyScalar(-1);
|
|
4642
|
-
const i = t.clone().add(r.clone().multiplyScalar(n)), o = new
|
|
4370
|
+
const i = t.clone().add(r.clone().multiplyScalar(n)), o = new E(t.clone(), i), a = s.queryLineSegment(o).map((c) => ({
|
|
4643
4371
|
point: c.line.getIntersection(o),
|
|
4644
4372
|
line: c.line
|
|
4645
4373
|
})).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
|
|
@@ -4666,7 +4394,7 @@ class yn {
|
|
|
4666
4394
|
break;
|
|
4667
4395
|
}
|
|
4668
4396
|
}
|
|
4669
|
-
const l = new
|
|
4397
|
+
const l = new E(t.clone(), t.clone().add(o.multiplyScalar(n))), h = r.queryLineSegment(l).map((d) => ({
|
|
4670
4398
|
point: d.line.getIntersection(l),
|
|
4671
4399
|
line: d.line
|
|
4672
4400
|
})).filter((d) => d.point).sort((d, f) => t.distance(d.point) - t.distance(f.point));
|
|
@@ -4700,7 +4428,7 @@ class yn {
|
|
|
4700
4428
|
return e;
|
|
4701
4429
|
}
|
|
4702
4430
|
}
|
|
4703
|
-
class
|
|
4431
|
+
class ge extends z {
|
|
4704
4432
|
doorSearchNearAngle = 110;
|
|
4705
4433
|
doorSearchDistance = 2;
|
|
4706
4434
|
DoorsAnalysis;
|
|
@@ -4712,13 +4440,13 @@ class ye extends z {
|
|
|
4712
4440
|
* @param parent
|
|
4713
4441
|
*/
|
|
4714
4442
|
onAddFromParent(t) {
|
|
4715
|
-
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(
|
|
4443
|
+
const e = t.findComponentByType(U), n = this.parent?.findComponentByType(Ct);
|
|
4716
4444
|
e.addEventListener("createGroup", () => {
|
|
4717
|
-
this.DoorsAnalysis = new
|
|
4445
|
+
this.DoorsAnalysis = new fn(n, this.skipFindDoor), this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])), this.skipFindDoor = !1, this.dispatchEvent({ type: "analysisCompleted" });
|
|
4718
4446
|
});
|
|
4719
4447
|
}
|
|
4720
4448
|
}
|
|
4721
|
-
function
|
|
4449
|
+
function pn(u) {
|
|
4722
4450
|
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);
|
|
4723
4451
|
let i = 1 / 0, o = null, a = -1 / 0, c = null;
|
|
4724
4452
|
for (let d = 0; d < u.length; d++) {
|
|
@@ -4731,7 +4459,7 @@ function mn(u) {
|
|
|
4731
4459
|
const [l, h] = [[r, t], [i, o], [a, c]].sort((d, f) => d[0] - f[0])[1];
|
|
4732
4460
|
return h;
|
|
4733
4461
|
}
|
|
4734
|
-
function
|
|
4462
|
+
function gn(u, t) {
|
|
4735
4463
|
const e = new B(v.fromByLineSegment(...u)), n = t.clone().expansion(100), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
4736
4464
|
u.forEach((c) => e.insert(c));
|
|
4737
4465
|
const i = e.queryLineSegment(n);
|
|
@@ -4744,23 +4472,23 @@ function xn(u, t) {
|
|
|
4744
4472
|
const h = l.getIntersection(n);
|
|
4745
4473
|
if (h) {
|
|
4746
4474
|
if (l.start.equal(h) || l.end.equal(h)) continue;
|
|
4747
|
-
const d =
|
|
4475
|
+
const d = E.clipping(l, [h], At);
|
|
4748
4476
|
s.add(l), d.forEach((f) => r.add(f));
|
|
4749
4477
|
}
|
|
4750
4478
|
}
|
|
4751
4479
|
u = u.filter((c) => !s.has(c)), u.push(...r);
|
|
4752
|
-
const o =
|
|
4480
|
+
const o = E.groupByPosition(u, n), a = [];
|
|
4753
4481
|
return o.forEach((c) => {
|
|
4754
4482
|
const l = [...re(c).keys()].sort((h, d) => h.distance(n.start, !0) - d.distance(n.start, !0));
|
|
4755
4483
|
for (let h = 0; h < l.length; h += 2) {
|
|
4756
4484
|
const d = l[h], f = l[h + 1];
|
|
4757
|
-
c.push(new
|
|
4485
|
+
c.push(new E(d.clone(), f.clone()));
|
|
4758
4486
|
}
|
|
4759
4487
|
a.push(c);
|
|
4760
4488
|
}), e.clear(), a;
|
|
4761
4489
|
}
|
|
4762
|
-
function
|
|
4763
|
-
u = u.map((i) => i.clone()), u =
|
|
4490
|
+
function ye(u) {
|
|
4491
|
+
u = u.map((i) => i.clone()), u = E.brokenLineMerging(u, _);
|
|
4764
4492
|
const t = [u], e = [], n = 2e4;
|
|
4765
4493
|
let s, r = 0;
|
|
4766
4494
|
for (; (s = t.pop()) !== void 0; ) {
|
|
@@ -4769,47 +4497,47 @@ function me(u) {
|
|
|
4769
4497
|
e.push(s);
|
|
4770
4498
|
continue;
|
|
4771
4499
|
}
|
|
4772
|
-
const i =
|
|
4500
|
+
const i = pn(s);
|
|
4773
4501
|
if (!i) {
|
|
4774
4502
|
e.push(s);
|
|
4775
4503
|
continue;
|
|
4776
4504
|
}
|
|
4777
|
-
const o =
|
|
4505
|
+
const o = gn(s, i).flatMap((a) => E.groupByPath(a));
|
|
4778
4506
|
if (o.length === 1) {
|
|
4779
4507
|
e.push(s);
|
|
4780
4508
|
continue;
|
|
4781
4509
|
}
|
|
4782
4510
|
o.forEach((a) => {
|
|
4783
|
-
a =
|
|
4511
|
+
a = E.brokenLineMerging(a, _), a.length === 4 ? e.push(a) : t.push(a);
|
|
4784
4512
|
});
|
|
4785
4513
|
}
|
|
4786
4514
|
return e;
|
|
4787
4515
|
}
|
|
4788
|
-
function
|
|
4516
|
+
function yn(u) {
|
|
4789
4517
|
const t = [];
|
|
4790
|
-
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u =
|
|
4518
|
+
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = pt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4791
4519
|
}
|
|
4792
|
-
function
|
|
4793
|
-
return t && (u =
|
|
4520
|
+
function mn(u, t = !0) {
|
|
4521
|
+
return t && (u = yn(u)), u.reduce((n, s) => (C.get(s).forEach((i) => {
|
|
4794
4522
|
let o = i.id ?? "wall";
|
|
4795
4523
|
i.type === "wall" && (o = "wall"), n.append(o, s);
|
|
4796
4524
|
}), n), new H());
|
|
4797
4525
|
}
|
|
4798
|
-
function
|
|
4526
|
+
function xn(u) {
|
|
4799
4527
|
const t = u.group((i) => C.everyType(i, "bayWindow") ? "wall" : C.everyType(i, "doubleWall") ? "doubleWall" : "wall"), e = t.get("wall") ?? [], n = t.get("doubleWall") ?? [];
|
|
4800
4528
|
let s = [], r = new Set(n.flat());
|
|
4801
4529
|
return e.forEach((i) => {
|
|
4802
4530
|
i.forEach((o) => r.has(o) || s.push(o));
|
|
4803
4531
|
}), n.forEach((i) => {
|
|
4804
|
-
i = [...new Set(i)],
|
|
4532
|
+
i = [...new Set(i)], ye(i).forEach((a) => {
|
|
4805
4533
|
if (a.length < 4) return s.push(...a);
|
|
4806
4534
|
a = a.sort((d, f) => d.length() - f.length());
|
|
4807
|
-
const c = a[0], l = a[1], h = new
|
|
4535
|
+
const c = a[0], l = a[1], h = new E(c.center.clone(), l.center.clone());
|
|
4808
4536
|
_(h, a), h.userData.wallWidth = c.length(), s.push(h), se(h);
|
|
4809
4537
|
});
|
|
4810
4538
|
}), s = s.map((i) => i.clone()), s.filter((i) => !i.userData.isBayWindow);
|
|
4811
4539
|
}
|
|
4812
|
-
function
|
|
4540
|
+
function wn(u, t = "测试", e = "") {
|
|
4813
4541
|
const s = /* @__PURE__ */ new Map();
|
|
4814
4542
|
let r = 0;
|
|
4815
4543
|
return {
|
|
@@ -4879,10 +4607,10 @@ function Ln(u, t = "测试", e = "") {
|
|
|
4879
4607
|
rooms: []
|
|
4880
4608
|
};
|
|
4881
4609
|
}
|
|
4882
|
-
function
|
|
4883
|
-
const n =
|
|
4884
|
-
let s =
|
|
4885
|
-
return s =
|
|
4610
|
+
function me(u, t = 0, e = !0) {
|
|
4611
|
+
const n = mn(u, e);
|
|
4612
|
+
let s = xn(n);
|
|
4613
|
+
return s = yt.rotate(s, t, (r, i, o) => {
|
|
4886
4614
|
r.userData.drawWindow && r.userData.drawWindow.forEach((a) => {
|
|
4887
4615
|
const c = D.from(a.p);
|
|
4888
4616
|
c.rotate(i, o * (Math.PI / 180)), a.p = c.toJson(a.p.z);
|
|
@@ -4890,11 +4618,11 @@ function xe(u, t = 0, e = !0) {
|
|
|
4890
4618
|
}), {
|
|
4891
4619
|
lines: s,
|
|
4892
4620
|
toJson(r = "测试", i = "") {
|
|
4893
|
-
return
|
|
4621
|
+
return wn(s, r, i);
|
|
4894
4622
|
}
|
|
4895
4623
|
};
|
|
4896
4624
|
}
|
|
4897
|
-
class
|
|
4625
|
+
class xe extends z {
|
|
4898
4626
|
static name = "ThreeVJia";
|
|
4899
4627
|
lineSegments = [];
|
|
4900
4628
|
neededUpdate = !0;
|
|
@@ -4911,7 +4639,7 @@ class we extends z {
|
|
|
4911
4639
|
updateData() {
|
|
4912
4640
|
if (!this.neededUpdate) return;
|
|
4913
4641
|
const t = this.parent?.findComponentByName("Dxf"), e = this.parent?.findComponentByName("AngleCorrectionDxf");
|
|
4914
|
-
this.cacheJson =
|
|
4642
|
+
this.cacheJson = me(t.getLineSegments(), e.angle).toJson(), this.neededUpdate = !1;
|
|
4915
4643
|
}
|
|
4916
4644
|
/** 转为json
|
|
4917
4645
|
* @param name
|
|
@@ -4946,7 +4674,7 @@ class tt extends Qt {
|
|
|
4946
4674
|
* @param scale 原始数据缩放比例
|
|
4947
4675
|
*/
|
|
4948
4676
|
constructor(t = 0.1, e = 1) {
|
|
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
|
|
4677
|
+
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 pe(), this.Variable = new Rt(), this.LineAnalysis = new Ct(), this.DoorsAnalysis = new ge(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(this.LineAnalysis), this.addComponent(this.DoorsAnalysis), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new xe()), tt.finalInstance = this;
|
|
4950
4678
|
}
|
|
4951
4679
|
usePlugin(t) {
|
|
4952
4680
|
return typeof t == "function" && t.call(this, this), this;
|
|
@@ -4959,17 +4687,17 @@ class tt extends Qt {
|
|
|
4959
4687
|
});
|
|
4960
4688
|
}
|
|
4961
4689
|
}
|
|
4962
|
-
const
|
|
4963
|
-
LineAnalysis:
|
|
4964
|
-
ThreeVJia:
|
|
4965
|
-
Variable:
|
|
4690
|
+
const Mn = {
|
|
4691
|
+
LineAnalysis: Ct,
|
|
4692
|
+
ThreeVJia: xe,
|
|
4693
|
+
Variable: Rt,
|
|
4966
4694
|
Dxf: U,
|
|
4967
|
-
DoorsAnalysisComponent:
|
|
4968
|
-
AngleCorrectionDxf:
|
|
4695
|
+
DoorsAnalysisComponent: ge,
|
|
4696
|
+
AngleCorrectionDxf: pe
|
|
4969
4697
|
};
|
|
4970
|
-
function
|
|
4698
|
+
function Dn(u) {
|
|
4971
4699
|
const t = [];
|
|
4972
|
-
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u =
|
|
4700
|
+
return u = u.filter((e) => e.userData.isDoor ? (t.push(e), !1) : !0), u = Z(u), u = pt.complementSide(u), u = Z(u, t, !0, !0), [...u, ...t];
|
|
4973
4701
|
}
|
|
4974
4702
|
function Wt(u, t, e) {
|
|
4975
4703
|
return e.reduce((n, s, r) => {
|
|
@@ -4982,22 +4710,22 @@ function Wt(u, t, e) {
|
|
|
4982
4710
|
return n;
|
|
4983
4711
|
}, [-1, -1, -1]);
|
|
4984
4712
|
}
|
|
4985
|
-
function
|
|
4986
|
-
const { point: r } = u[e[0]], i = new
|
|
4713
|
+
function Ln(u, t, e, n, s) {
|
|
4714
|
+
const { point: r } = u[e[0]], i = new E(r.clone(), t.clone());
|
|
4987
4715
|
return i.points.forEach((o) => s.insert(o, i)), n.push(i), i;
|
|
4988
4716
|
}
|
|
4989
|
-
function
|
|
4717
|
+
function En(u, t, e, n) {
|
|
4990
4718
|
const { point: s } = u[e[1]];
|
|
4991
4719
|
s.copy(t), n.update(s);
|
|
4992
4720
|
}
|
|
4993
|
-
function
|
|
4721
|
+
function Sn(u, t, e, n) {
|
|
4994
4722
|
const { point: s } = u[e[2]];
|
|
4995
4723
|
s.copy(t), n.update(s);
|
|
4996
4724
|
}
|
|
4997
4725
|
function Yt(u, t, e, n, s) {
|
|
4998
4726
|
const r = e[0] > -1, i = e[1] > -1, o = e[2] > -1;
|
|
4999
|
-
if (i &&
|
|
5000
|
-
const a =
|
|
4727
|
+
if (i && En(t, u, e, s), r) {
|
|
4728
|
+
const a = Ln(t, u, e, n, s);
|
|
5001
4729
|
i && (a.userData = k(t[e[1]].userData?.userData ?? {}));
|
|
5002
4730
|
return;
|
|
5003
4731
|
}
|
|
@@ -5006,14 +4734,14 @@ function Yt(u, t, e, n, s) {
|
|
|
5006
4734
|
const a = t[e[1]].userData;
|
|
5007
4735
|
u = a.start.distance(t[e[2]].point) < a.end.distance(t[e[2]].point) ? a.start : a.end;
|
|
5008
4736
|
}
|
|
5009
|
-
|
|
4737
|
+
Sn(t, u, e, s);
|
|
5010
4738
|
}
|
|
5011
4739
|
}
|
|
5012
|
-
function
|
|
4740
|
+
function bn(u, t = 0.12, e, n) {
|
|
5013
4741
|
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
4742
|
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);
|
|
5015
4743
|
}
|
|
5016
|
-
class
|
|
4744
|
+
class Bt {
|
|
5017
4745
|
/** 通过轨迹点查找外墙
|
|
5018
4746
|
* @param lines
|
|
5019
4747
|
* @param trajectoryPoints
|
|
@@ -5026,7 +4754,7 @@ class Nt {
|
|
|
5026
4754
|
const i = r.center, o = /* @__PURE__ */ new Set();
|
|
5027
4755
|
for (const a of e) {
|
|
5028
4756
|
if (o.size === 2) break;
|
|
5029
|
-
const c = new
|
|
4757
|
+
const c = new E(i, a);
|
|
5030
4758
|
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) {
|
|
5031
4759
|
const h = r.pointPosition(a);
|
|
5032
4760
|
h !== "on" && o.add(h);
|
|
@@ -5042,7 +4770,7 @@ class Nt {
|
|
|
5042
4770
|
static boundExtbyTrajAndOriginalData(t) {
|
|
5043
4771
|
const e = [];
|
|
5044
4772
|
let n = t.data.map(({ start: r, end: i, ...o }) => {
|
|
5045
|
-
const a = new
|
|
4773
|
+
const a = new E(D.from(r), D.from(i));
|
|
5046
4774
|
return a.userData = o, e.push(r.z ?? 0, i.z ?? 0), a;
|
|
5047
4775
|
});
|
|
5048
4776
|
const s = e.reduce((r, i) => r + i, 0) / e.length;
|
|
@@ -5057,23 +4785,23 @@ class Nt {
|
|
|
5057
4785
|
*/
|
|
5058
4786
|
static boundExtbyTraj(t) {
|
|
5059
4787
|
let { lines: e, trajectory: n, wallWidth: s = 0.12, updateDoubleWallGroup: r = !1, findCallBack: i } = t;
|
|
5060
|
-
r && (e =
|
|
4788
|
+
r && (e = Dn(e));
|
|
5061
4789
|
const o = Object.keys(n).map((d) => D.from(n[d]));
|
|
5062
|
-
let c =
|
|
4790
|
+
let c = Bt.findExtWallByTraj(e, o).filter((d) => d.userData.expandDirect);
|
|
5063
4791
|
e = e.filter((d) => !c.includes(d)), e.push(...c), i && i(c, o);
|
|
5064
4792
|
const l = $(e), h = [];
|
|
5065
4793
|
return c.forEach((d) => {
|
|
5066
|
-
d.userData.isDoor ||
|
|
5067
|
-
}), e.push(...h.filter((d) => d.length() > 1e-9)),
|
|
4794
|
+
d.userData.isDoor || bn(d, s, h, l);
|
|
4795
|
+
}), e.push(...h.filter((d) => d.length() > 1e-9)), ot(...e), {
|
|
5068
4796
|
lines: e,
|
|
5069
4797
|
toOriginalData(d) {
|
|
5070
|
-
return
|
|
4798
|
+
return rt(e, d);
|
|
5071
4799
|
}
|
|
5072
4800
|
};
|
|
5073
4801
|
}
|
|
5074
4802
|
}
|
|
5075
|
-
function
|
|
5076
|
-
const t = new
|
|
4803
|
+
function we(u) {
|
|
4804
|
+
const t = new yt(u), e = new Q(t.size), n = /* @__PURE__ */ new Set(), s = [];
|
|
5077
4805
|
function r(i) {
|
|
5078
4806
|
n.add(i), t.getNeighbors(i)?.forEach((a) => {
|
|
5079
4807
|
if (!n.has(a))
|
|
@@ -5088,8 +4816,8 @@ function Me(u) {
|
|
|
5088
4816
|
n.has(i) || r(i);
|
|
5089
4817
|
}), s;
|
|
5090
4818
|
}
|
|
5091
|
-
function
|
|
5092
|
-
const e = $(u), n = new
|
|
4819
|
+
function Tn(u, t) {
|
|
4820
|
+
const e = $(u), n = new E(), s = new E(), r = [], i = /* @__PURE__ */ new Set();
|
|
5093
4821
|
function o(c, l) {
|
|
5094
4822
|
const h = c.center, d = c.normal();
|
|
5095
4823
|
n.start.copy(h), n.end.copy(h).add(d.clone().multiplyScalar(1));
|
|
@@ -5104,13 +4832,13 @@ function In(u, t) {
|
|
|
5104
4832
|
if (g)
|
|
5105
4833
|
if (l.vertical(d)) y = o(l, f);
|
|
5106
4834
|
else {
|
|
5107
|
-
const M = l.center, w = M.distance(f.start),
|
|
5108
|
-
y = f.directionMove(
|
|
4835
|
+
const M = l.center, w = M.distance(f.start), L = M.direction(f.start);
|
|
4836
|
+
y = f.directionMove(L, w);
|
|
5109
4837
|
}
|
|
5110
4838
|
else y = f;
|
|
5111
4839
|
let x = e.queryPoint(m, !0);
|
|
5112
4840
|
if (x.length === 1) {
|
|
5113
|
-
const M = x[0], w = M.userData,
|
|
4841
|
+
const M = x[0], w = M.userData, L = w.getAnotherPoint(M.point), b = L.direction(M.point);
|
|
5114
4842
|
if (c === w) return p;
|
|
5115
4843
|
if (w.vertical(l)) {
|
|
5116
4844
|
const S = m.direction(h), T = w.center, A = b.angleBetween(y.direction()) < 1e-9;
|
|
@@ -5119,14 +4847,14 @@ function In(u, t) {
|
|
|
5119
4847
|
} else {
|
|
5120
4848
|
s.start.copy(y.start).add(y.direction().multiplyScalar(5e-3));
|
|
5121
4849
|
const M = [l, ...x.map((w) => {
|
|
5122
|
-
const
|
|
5123
|
-
return
|
|
4850
|
+
const L = w.userData;
|
|
4851
|
+
return L.length(), L;
|
|
5124
4852
|
})];
|
|
5125
4853
|
for (let w = 0; w < x.length; w++) {
|
|
5126
|
-
const
|
|
4854
|
+
const L = x[w], b = L.userData;
|
|
5127
4855
|
if (c === b) return p;
|
|
5128
4856
|
if (!(x.length === 4 && b.parallel(l)) && (s.end.copy(b.center), !M.some((S) => S === b ? !1 : S.intersectLineSegment(s))))
|
|
5129
|
-
return p.push(b), a(c, b,
|
|
4857
|
+
return p.push(b), a(c, b, L.point, l, y, p);
|
|
5130
4858
|
}
|
|
5131
4859
|
}
|
|
5132
4860
|
}
|
|
@@ -5140,7 +4868,7 @@ function In(u, t) {
|
|
|
5140
4868
|
const M = y[x];
|
|
5141
4869
|
let w = g[x];
|
|
5142
4870
|
M.userData?.parallel(l) && (w = g[x ? 0 : 1].clone().multiplyScalar(-1)), i.clear();
|
|
5143
|
-
const
|
|
4871
|
+
const L = new E(h.clone(), h.clone().add(w.clone().multiplyScalar(0.2))), b = a(l, M.userData, M.point, l, L, [l, M.userData]);
|
|
5144
4872
|
b && m.push([...b]);
|
|
5145
4873
|
}
|
|
5146
4874
|
if (m.length === 2) {
|
|
@@ -5151,11 +4879,11 @@ function In(u, t) {
|
|
|
5151
4879
|
}
|
|
5152
4880
|
return r;
|
|
5153
4881
|
}
|
|
5154
|
-
function
|
|
4882
|
+
function An(u) {
|
|
5155
4883
|
const t = new H(), e = [];
|
|
5156
4884
|
u.forEach((n) => t.append(n.length, n));
|
|
5157
4885
|
for (const n of t.values()) {
|
|
5158
|
-
const s = new
|
|
4886
|
+
const s = new gt(n.flat()), r = new H();
|
|
5159
4887
|
n.map((i) => {
|
|
5160
4888
|
const o = i.map((a) => s.getIndex(a)).sort((a, c) => a - c).join(",");
|
|
5161
4889
|
r.append(o, i);
|
|
@@ -5163,29 +4891,29 @@ function vn(u) {
|
|
|
5163
4891
|
}
|
|
5164
4892
|
return e;
|
|
5165
4893
|
}
|
|
5166
|
-
function
|
|
5167
|
-
const e =
|
|
4894
|
+
function Pn(u, t) {
|
|
4895
|
+
const e = Tn(u, t), n = /* @__PURE__ */ new Map(), s = new Q(e.length), r = [];
|
|
5168
4896
|
e.forEach((a, c) => {
|
|
5169
4897
|
for (let l = 0; l < a.length; l++) {
|
|
5170
4898
|
const h = a[l];
|
|
5171
4899
|
n.has(h) ? s.union(c, n.get(h)) : n.set(h, c);
|
|
5172
4900
|
}
|
|
5173
4901
|
});
|
|
5174
|
-
const i = new
|
|
4902
|
+
const i = new ft(), o = s.getAllSets().valueArray.map((a) => {
|
|
5175
4903
|
let c = a.map((h) => e[h]);
|
|
5176
|
-
return c.length === 1 ? c[0] : (i.clear(), c =
|
|
4904
|
+
return c.length === 1 ? c[0] : (i.clear(), c = An(c), c.forEach((h) => h.forEach((d) => i.set(d))), i.reduce((h, d, f) => (d === 1 ? h.push(f) : r.push(f), h), []));
|
|
5177
4905
|
});
|
|
5178
4906
|
return {
|
|
5179
4907
|
internalEdges: r,
|
|
5180
4908
|
rings: o
|
|
5181
4909
|
};
|
|
5182
4910
|
}
|
|
5183
|
-
function
|
|
5184
|
-
const t =
|
|
4911
|
+
function In(u) {
|
|
4912
|
+
const t = E.groupByPath(u), e = [], n = [];
|
|
5185
4913
|
t.forEach((i, o) => {
|
|
5186
4914
|
try {
|
|
5187
|
-
let a =
|
|
5188
|
-
const c =
|
|
4915
|
+
let a = we(i);
|
|
4916
|
+
const c = Pn(i, a);
|
|
5189
4917
|
e.push(...c.rings), n.push(...c.internalEdges);
|
|
5190
4918
|
} catch (a) {
|
|
5191
4919
|
console.warn("环查找出现异常:", a.message);
|
|
@@ -5198,34 +4926,15 @@ function Cn(u) {
|
|
|
5198
4926
|
internalEdges: n
|
|
5199
4927
|
};
|
|
5200
4928
|
}
|
|
5201
|
-
|
|
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) {
|
|
4929
|
+
function Me(u, t, e = 1e-3) {
|
|
5221
4930
|
if (Array.isArray(u) && u[0] instanceof D) {
|
|
5222
4931
|
const s = u;
|
|
5223
4932
|
u = s.map((r, i) => {
|
|
5224
4933
|
const o = s[(i + 1) % s.length];
|
|
5225
|
-
return new
|
|
4934
|
+
return new E(r, o);
|
|
5226
4935
|
});
|
|
5227
4936
|
}
|
|
5228
|
-
if (u instanceof
|
|
4937
|
+
if (u instanceof E) return Me([u], t, e);
|
|
5229
4938
|
const n = tt.finalInstance;
|
|
5230
4939
|
if (n) {
|
|
5231
4940
|
const s = n.findComponentByName("Renderer");
|
|
@@ -5237,7 +4946,7 @@ function De(u, t, e = 1e-3) {
|
|
|
5237
4946
|
}
|
|
5238
4947
|
}
|
|
5239
4948
|
}
|
|
5240
|
-
function
|
|
4949
|
+
function vn(u, t, e = 1e-3) {
|
|
5241
4950
|
const n = tt.finalInstance;
|
|
5242
4951
|
if (n) {
|
|
5243
4952
|
const s = n.findComponentByName("Renderer");
|
|
@@ -5247,7 +4956,7 @@ function Nn(u, t, e = 1e-3) {
|
|
|
5247
4956
|
}
|
|
5248
4957
|
}
|
|
5249
4958
|
}
|
|
5250
|
-
function
|
|
4959
|
+
function Rn(u, t, e, n = 1e-3) {
|
|
5251
4960
|
const s = tt.finalInstance;
|
|
5252
4961
|
if (s) {
|
|
5253
4962
|
const r = s.findComponentByName("Renderer"), i = s.findComponentByName("Editor");
|
|
@@ -5285,36 +4994,36 @@ const Xt = {
|
|
|
5285
4994
|
"unsigned short"
|
|
5286
4995
|
]
|
|
5287
4996
|
};
|
|
5288
|
-
class
|
|
4997
|
+
class dt {
|
|
5289
4998
|
constructor() {
|
|
5290
4999
|
this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
|
|
5291
|
-
return new
|
|
5000
|
+
return new kn(t);
|
|
5001
|
+
}), this.register(function(t) {
|
|
5002
|
+
return new _n(t);
|
|
5292
5003
|
}), this.register(function(t) {
|
|
5293
5004
|
return new Vn(t);
|
|
5294
5005
|
}), this.register(function(t) {
|
|
5295
|
-
return new
|
|
5006
|
+
return new Hn(t);
|
|
5296
5007
|
}), this.register(function(t) {
|
|
5297
|
-
return new
|
|
5008
|
+
return new $n(t);
|
|
5298
5009
|
}), this.register(function(t) {
|
|
5299
|
-
return new
|
|
5010
|
+
return new Jn(t);
|
|
5300
5011
|
}), this.register(function(t) {
|
|
5301
|
-
return new
|
|
5012
|
+
return new Wn(t);
|
|
5302
5013
|
}), this.register(function(t) {
|
|
5303
|
-
return new
|
|
5014
|
+
return new Yn(t);
|
|
5304
5015
|
}), this.register(function(t) {
|
|
5305
|
-
return new
|
|
5306
|
-
}), this.register(function(t) {
|
|
5307
|
-
return new Jn(t);
|
|
5016
|
+
return new Xn(t);
|
|
5308
5017
|
}), this.register(function(t) {
|
|
5309
|
-
return new
|
|
5018
|
+
return new Kn(t);
|
|
5310
5019
|
}), this.register(function(t) {
|
|
5311
|
-
return new
|
|
5020
|
+
return new Zn(t);
|
|
5312
5021
|
}), this.register(function(t) {
|
|
5313
|
-
return new
|
|
5022
|
+
return new Qn(t);
|
|
5314
5023
|
}), this.register(function(t) {
|
|
5315
|
-
return new
|
|
5024
|
+
return new ts(t);
|
|
5316
5025
|
}), this.register(function(t) {
|
|
5317
|
-
return new
|
|
5026
|
+
return new es(t);
|
|
5318
5027
|
});
|
|
5319
5028
|
}
|
|
5320
5029
|
register(t) {
|
|
@@ -5327,7 +5036,7 @@ class ft {
|
|
|
5327
5036
|
return this.textureUtils = t, this;
|
|
5328
5037
|
}
|
|
5329
5038
|
parse(t, e, n, s) {
|
|
5330
|
-
const r = new
|
|
5039
|
+
const r = new Un(), i = [];
|
|
5331
5040
|
for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
|
|
5332
5041
|
i.push(this.pluginCallbacks[o](r));
|
|
5333
5042
|
r.setPlugins(i), r.setTextureUtils(this.textureUtils), r.writeAsync(t, e, s).catch(n);
|
|
@@ -5363,7 +5072,7 @@ const P = {
|
|
|
5363
5072
|
CLAMP_TO_EDGE: 33071,
|
|
5364
5073
|
MIRRORED_REPEAT: 33648,
|
|
5365
5074
|
REPEAT: 10497
|
|
5366
|
-
},
|
|
5075
|
+
}, Mt = "KHR_mesh_quantization", O = {};
|
|
5367
5076
|
O[qe] = P.NEAREST;
|
|
5368
5077
|
O[Ge] = P.NEAREST_MIPMAP_NEAREST;
|
|
5369
5078
|
O[ze] = P.NEAREST_MIPMAP_LINEAR;
|
|
@@ -5378,19 +5087,19 @@ const Vt = {
|
|
|
5378
5087
|
position: "translation",
|
|
5379
5088
|
quaternion: "rotation",
|
|
5380
5089
|
morphTargetInfluences: "weights"
|
|
5381
|
-
},
|
|
5382
|
-
function
|
|
5090
|
+
}, Cn = new Pe(), Ht = 12, Bn = 1179937895, Nn = 2, $t = 8, jn = 1313821514, Fn = 5130562;
|
|
5091
|
+
function st(u, t) {
|
|
5383
5092
|
return u.length === t.length && u.every(function(e, n) {
|
|
5384
5093
|
return e === t[n];
|
|
5385
5094
|
});
|
|
5386
5095
|
}
|
|
5387
|
-
function
|
|
5096
|
+
function On(u) {
|
|
5388
5097
|
return new TextEncoder().encode(u).buffer;
|
|
5389
5098
|
}
|
|
5390
|
-
function
|
|
5391
|
-
return
|
|
5099
|
+
function qn(u) {
|
|
5100
|
+
return st(u.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
5392
5101
|
}
|
|
5393
|
-
function
|
|
5102
|
+
function Gn(u, t, e) {
|
|
5394
5103
|
const n = {
|
|
5395
5104
|
min: new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),
|
|
5396
5105
|
max: new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)
|
|
@@ -5398,15 +5107,15 @@ function _n(u, t, e) {
|
|
|
5398
5107
|
for (let s = t; s < t + e; s++)
|
|
5399
5108
|
for (let r = 0; r < u.itemSize; r++) {
|
|
5400
5109
|
let 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 =
|
|
5110
|
+
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 = St.normalize(i, u.array))), n.min[r] = Math.min(n.min[r], i), n.max[r] = Math.max(n.max[r], i);
|
|
5402
5111
|
}
|
|
5403
5112
|
return n;
|
|
5404
5113
|
}
|
|
5405
|
-
function
|
|
5114
|
+
function De(u) {
|
|
5406
5115
|
return Math.ceil(u / 4) * 4;
|
|
5407
5116
|
}
|
|
5408
|
-
function
|
|
5409
|
-
const e =
|
|
5117
|
+
function Dt(u, t = 0) {
|
|
5118
|
+
const e = De(u.byteLength);
|
|
5410
5119
|
if (e !== u.byteLength) {
|
|
5411
5120
|
const n = new Uint8Array(e);
|
|
5412
5121
|
if (n.set(new Uint8Array(u)), t !== 0)
|
|
@@ -5419,7 +5128,7 @@ function Et(u, t = 0) {
|
|
|
5419
5128
|
function Jt() {
|
|
5420
5129
|
return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
|
|
5421
5130
|
}
|
|
5422
|
-
function
|
|
5131
|
+
function zn(u, t) {
|
|
5423
5132
|
if (typeof OffscreenCanvas < "u" && u instanceof OffscreenCanvas) {
|
|
5424
5133
|
let e;
|
|
5425
5134
|
return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), u.convertToBlob({
|
|
@@ -5429,7 +5138,7 @@ function Wn(u, t) {
|
|
|
5429
5138
|
} else
|
|
5430
5139
|
return new Promise((e) => u.toBlob(e, t));
|
|
5431
5140
|
}
|
|
5432
|
-
class
|
|
5141
|
+
class Un {
|
|
5433
5142
|
constructor() {
|
|
5434
5143
|
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 = {
|
|
5435
5144
|
asset: {
|
|
@@ -5471,13 +5180,13 @@ class Yn {
|
|
|
5471
5180
|
const s = this, r = s.buffers, i = s.json;
|
|
5472
5181
|
n = s.options;
|
|
5473
5182
|
const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(r, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
|
|
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 ?
|
|
5475
|
-
const f =
|
|
5476
|
-
p.setUint32(0, f.byteLength, !0), p.setUint32(4,
|
|
5477
|
-
const g =
|
|
5478
|
-
y.setUint32(0, g.byteLength, !0), y.setUint32(4,
|
|
5183
|
+
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 ? Lt(c).then(function(d) {
|
|
5184
|
+
const f = Dt(d), p = new DataView(new ArrayBuffer($t));
|
|
5185
|
+
p.setUint32(0, f.byteLength, !0), p.setUint32(4, Fn, !0);
|
|
5186
|
+
const g = Dt(On(JSON.stringify(i)), 32), y = new DataView(new ArrayBuffer($t));
|
|
5187
|
+
y.setUint32(0, g.byteLength, !0), y.setUint32(4, jn, !0);
|
|
5479
5188
|
const m = new ArrayBuffer(Ht), x = new DataView(m);
|
|
5480
|
-
x.setUint32(0,
|
|
5189
|
+
x.setUint32(0, Bn, !0), x.setUint32(4, Nn, !0);
|
|
5481
5190
|
const M = Ht + y.byteLength + g.byteLength + p.byteLength + f.byteLength;
|
|
5482
5191
|
x.setUint32(8, M, !0);
|
|
5483
5192
|
const w = new Blob([
|
|
@@ -5487,10 +5196,10 @@ class Yn {
|
|
|
5487
5196
|
p,
|
|
5488
5197
|
f
|
|
5489
5198
|
], { type: "application/octet-stream" });
|
|
5490
|
-
|
|
5491
|
-
e(
|
|
5199
|
+
Lt(w).then((L) => {
|
|
5200
|
+
e(L);
|
|
5492
5201
|
});
|
|
5493
|
-
}) : i.buffers && i.buffers.length > 0 ?
|
|
5202
|
+
}) : i.buffers && i.buffers.length > 0 ? ns(c).then((d) => {
|
|
5494
5203
|
i.buffers[0].uri = d, e(i);
|
|
5495
5204
|
}) : e(i);
|
|
5496
5205
|
}
|
|
@@ -5538,7 +5247,7 @@ class Yn {
|
|
|
5538
5247
|
*/
|
|
5539
5248
|
isNormalizedNormalAttribute(t) {
|
|
5540
5249
|
if (this.cache.attributesNormalized.has(t)) return !1;
|
|
5541
|
-
const n = new
|
|
5250
|
+
const n = new ut();
|
|
5542
5251
|
for (let s = 0, r = t.count; s < r; s++)
|
|
5543
5252
|
if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
|
|
5544
5253
|
return !0;
|
|
@@ -5553,7 +5262,7 @@ class Yn {
|
|
|
5553
5262
|
createNormalizedNormalAttribute(t) {
|
|
5554
5263
|
const e = this.cache;
|
|
5555
5264
|
if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
|
|
5556
|
-
const n = t.clone(), s = new
|
|
5265
|
+
const n = t.clone(), s = new ut();
|
|
5557
5266
|
for (let r = 0, i = n.count; r < i; r++)
|
|
5558
5267
|
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);
|
|
5559
5268
|
return e.attributesNormalized.set(t, n), n;
|
|
@@ -5579,7 +5288,7 @@ class Yn {
|
|
|
5579
5288
|
return g;
|
|
5580
5289
|
};
|
|
5581
5290
|
}
|
|
5582
|
-
t instanceof
|
|
5291
|
+
t instanceof xt && (t = await this.decompressTextureAsync(t)), e instanceof xt && (e = await this.decompressTextureAsync(e));
|
|
5583
5292
|
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();
|
|
5584
5293
|
a.width = i, a.height = o;
|
|
5585
5294
|
const c = a.getContext("2d", {
|
|
@@ -5644,12 +5353,12 @@ class Yn {
|
|
|
5644
5353
|
}
|
|
5645
5354
|
let a = t.itemSize * o;
|
|
5646
5355
|
r === P.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
|
|
5647
|
-
const c =
|
|
5356
|
+
const c = De(s * a), l = new DataView(new ArrayBuffer(c));
|
|
5648
5357
|
let h = 0;
|
|
5649
5358
|
for (let p = n; p < n + s; p++) {
|
|
5650
5359
|
for (let g = 0; g < t.itemSize; g++) {
|
|
5651
5360
|
let 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 =
|
|
5361
|
+
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 = St.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;
|
|
5653
5362
|
}
|
|
5654
5363
|
h % a !== 0 && (h += a - h % a);
|
|
5655
5364
|
}
|
|
@@ -5671,8 +5380,8 @@ class Yn {
|
|
|
5671
5380
|
processBufferViewImage(t) {
|
|
5672
5381
|
const e = this, n = e.json;
|
|
5673
5382
|
return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
|
|
5674
|
-
|
|
5675
|
-
const i =
|
|
5383
|
+
Lt(t).then((r) => {
|
|
5384
|
+
const i = Dt(r), o = {
|
|
5676
5385
|
buffer: e.processBuffer(i),
|
|
5677
5386
|
byteOffset: e.byteOffset,
|
|
5678
5387
|
byteLength: i.byteLength
|
|
@@ -5716,7 +5425,7 @@ class Yn {
|
|
|
5716
5425
|
else
|
|
5717
5426
|
throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
|
|
5718
5427
|
if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
|
|
5719
|
-
const a =
|
|
5428
|
+
const a = Gn(t, n, s);
|
|
5720
5429
|
let c;
|
|
5721
5430
|
e !== void 0 && (c = t === e.index ? P.ELEMENT_ARRAY_BUFFER : P.ARRAY_BUFFER);
|
|
5722
5431
|
const l = this.processBufferView(t, o, n, s, c), h = {
|
|
@@ -5761,7 +5470,7 @@ class Yn {
|
|
|
5761
5470
|
else
|
|
5762
5471
|
throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
|
|
5763
5472
|
a.binary === !0 ? c.push(
|
|
5764
|
-
|
|
5473
|
+
zn(f, s).then((y) => r.processBufferViewImage(y)).then((y) => {
|
|
5765
5474
|
d.bufferView = y;
|
|
5766
5475
|
})
|
|
5767
5476
|
) : d.uri = Ne.getDataURL(f, s);
|
|
@@ -5794,7 +5503,7 @@ class Yn {
|
|
|
5794
5503
|
async processTextureAsync(t) {
|
|
5795
5504
|
const n = this.options, s = this.cache, r = this.json;
|
|
5796
5505
|
if (s.textures.has(t)) return s.textures.get(t);
|
|
5797
|
-
r.textures || (r.textures = []), t instanceof
|
|
5506
|
+
r.textures || (r.textures = []), t instanceof xt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
|
|
5798
5507
|
let i = t.userData.mimeType;
|
|
5799
5508
|
i === "image/webp" && (i = "image/png");
|
|
5800
5509
|
const o = {
|
|
@@ -5821,7 +5530,7 @@ class Yn {
|
|
|
5821
5530
|
const s = { pbrMetallicRoughness: {} };
|
|
5822
5531
|
t.isMeshStandardMaterial !== !0 && t.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
|
|
5823
5532
|
const r = t.color.toArray().concat([t.opacity]);
|
|
5824
|
-
if (
|
|
5533
|
+
if (st(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) {
|
|
5825
5534
|
const o = await this.buildMetalRoughTextureAsync(t.metalnessMap, t.roughnessMap), a = {
|
|
5826
5535
|
index: await this.processTextureAsync(o),
|
|
5827
5536
|
texCoord: o.channel
|
|
@@ -5873,7 +5582,7 @@ class Yn {
|
|
|
5873
5582
|
async processMeshAsync(t) {
|
|
5874
5583
|
const e = this.cache, n = this.json, s = [t.geometry.uuid];
|
|
5875
5584
|
if (Array.isArray(t.material))
|
|
5876
|
-
for (let w = 0,
|
|
5585
|
+
for (let w = 0, L = t.material.length; w < L; w++)
|
|
5877
5586
|
s.push(t.material[w].uuid);
|
|
5878
5587
|
else
|
|
5879
5588
|
s.push(t.material.uuid);
|
|
@@ -5895,20 +5604,20 @@ class Yn {
|
|
|
5895
5604
|
let p = null;
|
|
5896
5605
|
for (let w in i.attributes) {
|
|
5897
5606
|
if (w.slice(0, 5) === "morph") continue;
|
|
5898
|
-
const
|
|
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(
|
|
5900
|
-
c[w] = e.attributes.get(this.getUID(
|
|
5607
|
+
const L = i.attributes[w];
|
|
5608
|
+
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(L))) {
|
|
5609
|
+
c[w] = e.attributes.get(this.getUID(L));
|
|
5901
5610
|
continue;
|
|
5902
5611
|
}
|
|
5903
5612
|
p = null;
|
|
5904
|
-
const S =
|
|
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),
|
|
5906
|
-
const T = this.processAccessor(p ||
|
|
5907
|
-
T !== null && (w.startsWith("_") || this.detectMeshQuantization(w,
|
|
5613
|
+
const S = L.array;
|
|
5614
|
+
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), L.itemSize, L.normalized)) : (S instanceof Uint32Array || S instanceof Int32Array) && !w.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${w}" converted to type FLOAT.`), p = dt.Utils.toFloat32BufferAttribute(L));
|
|
5615
|
+
const T = this.processAccessor(p || L, i);
|
|
5616
|
+
T !== null && (w.startsWith("_") || this.detectMeshQuantization(w, L), c[w] = T, e.attributes.set(this.getUID(L), T));
|
|
5908
5617
|
}
|
|
5909
5618
|
if (f !== void 0 && i.setAttribute("normal", f), Object.keys(c).length === 0) return null;
|
|
5910
5619
|
if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
|
|
5911
|
-
const w = [],
|
|
5620
|
+
const w = [], L = [], b = {};
|
|
5912
5621
|
if (t.morphTargetDictionary !== void 0)
|
|
5913
5622
|
for (const S in t.morphTargetDictionary)
|
|
5914
5623
|
b[t.morphTargetDictionary[S]] = S;
|
|
@@ -5927,26 +5636,26 @@ class Yn {
|
|
|
5927
5636
|
}
|
|
5928
5637
|
const q = j.clone();
|
|
5929
5638
|
if (!i.morphTargetsRelative)
|
|
5930
|
-
for (let N = 0,
|
|
5639
|
+
for (let N = 0, jt = j.count; N < jt; N++)
|
|
5931
5640
|
for (let J = 0; J < j.itemSize; J++)
|
|
5932
5641
|
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));
|
|
5933
5642
|
T[F] = this.processAccessor(q, i), e.attributes.set(this.getUID(W, !0), T[F]);
|
|
5934
5643
|
}
|
|
5935
|
-
h.push(T), w.push(t.morphTargetInfluences[S]), t.morphTargetDictionary !== void 0 &&
|
|
5644
|
+
h.push(T), w.push(t.morphTargetInfluences[S]), t.morphTargetDictionary !== void 0 && L.push(b[S]);
|
|
5936
5645
|
}
|
|
5937
|
-
a.weights = w,
|
|
5646
|
+
a.weights = w, L.length > 0 && (a.extras = {}, a.extras.targetNames = L);
|
|
5938
5647
|
}
|
|
5939
5648
|
const g = Array.isArray(t.material);
|
|
5940
5649
|
if (g && i.groups.length === 0) return null;
|
|
5941
5650
|
let y = !1;
|
|
5942
5651
|
if (g && i.index === null) {
|
|
5943
5652
|
const w = [];
|
|
5944
|
-
for (let
|
|
5945
|
-
w[
|
|
5653
|
+
for (let L = 0, b = i.attributes.position.count; L < b; L++)
|
|
5654
|
+
w[L] = L;
|
|
5946
5655
|
i.setIndex(w), y = !0;
|
|
5947
5656
|
}
|
|
5948
5657
|
const m = g ? t.material : [t.material], x = g ? i.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
|
|
5949
|
-
for (let w = 0,
|
|
5658
|
+
for (let w = 0, L = x.length; w < L; w++) {
|
|
5950
5659
|
const b = {
|
|
5951
5660
|
mode: o,
|
|
5952
5661
|
attributes: c
|
|
@@ -5976,7 +5685,7 @@ class Yn {
|
|
|
5976
5685
|
* @param {THREE.BufferAttribute} attribute
|
|
5977
5686
|
*/
|
|
5978
5687
|
detectMeshQuantization(t, e) {
|
|
5979
|
-
if (this.extensionsUsed[
|
|
5688
|
+
if (this.extensionsUsed[Mt]) return;
|
|
5980
5689
|
let n;
|
|
5981
5690
|
switch (e.array.constructor) {
|
|
5982
5691
|
case Int8Array:
|
|
@@ -5996,7 +5705,7 @@ class Yn {
|
|
|
5996
5705
|
}
|
|
5997
5706
|
e.normalized && (n += " normalized");
|
|
5998
5707
|
const s = t.split("_", 1)[0];
|
|
5999
|
-
Xt[s] && Xt[s].includes(n) && (this.extensionsUsed[
|
|
5708
|
+
Xt[s] && Xt[s].includes(n) && (this.extensionsUsed[Mt] = !0, this.extensionsRequired[Mt] = !0);
|
|
6000
5709
|
}
|
|
6001
5710
|
/**
|
|
6002
5711
|
* Process camera
|
|
@@ -6016,7 +5725,7 @@ class Yn {
|
|
|
6016
5725
|
znear: t.near < 0 ? 0 : t.near
|
|
6017
5726
|
} : s.perspective = {
|
|
6018
5727
|
aspectRatio: t.aspect,
|
|
6019
|
-
yfov:
|
|
5728
|
+
yfov: St.degToRad(t.fov),
|
|
6020
5729
|
zfar: t.far <= 0 ? 1e-3 : t.far,
|
|
6021
5730
|
znear: t.near < 0 ? 0 : t.near
|
|
6022
5731
|
}, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
|
|
@@ -6033,11 +5742,11 @@ class Yn {
|
|
|
6033
5742
|
*/
|
|
6034
5743
|
processAnimation(t, e) {
|
|
6035
5744
|
const n = this.json, s = this.nodeMap;
|
|
6036
|
-
n.animations || (n.animations = []), t =
|
|
5745
|
+
n.animations || (n.animations = []), t = dt.Utils.mergeMorphTargetTracks(t.clone(), e);
|
|
6037
5746
|
const r = t.tracks, i = [], o = [];
|
|
6038
5747
|
for (let c = 0; c < r.length; ++c) {
|
|
6039
|
-
const l = r[c], h =
|
|
6040
|
-
let d =
|
|
5748
|
+
const l = r[c], h = ht.parseTrackName(l.name);
|
|
5749
|
+
let d = ht.findNode(e, h.nodeName);
|
|
6041
5750
|
const f = Vt[h.propertyName];
|
|
6042
5751
|
if (h.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(h.objectIndex) : d = void 0), !d || !f) {
|
|
6043
5752
|
console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
|
|
@@ -6095,9 +5804,9 @@ class Yn {
|
|
|
6095
5804
|
const r = {};
|
|
6096
5805
|
if (n.trs) {
|
|
6097
5806
|
const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
|
|
6098
|
-
|
|
5807
|
+
st(o, [0, 0, 0, 1]) || (r.rotation = o), st(a, [0, 0, 0]) || (r.translation = a), st(c, [1, 1, 1]) || (r.scale = c);
|
|
6099
5808
|
} else
|
|
6100
|
-
t.matrixAutoUpdate && t.updateMatrix(),
|
|
5809
|
+
t.matrixAutoUpdate && t.updateMatrix(), qn(t.matrix) === !1 && (r.matrix = t.matrix.elements);
|
|
6101
5810
|
if (t.name !== "" && (r.name = String(t.name)), this.serializeUserData(t, r), t.isMesh || t.isLine || t.isPoints) {
|
|
6102
5811
|
const o = await this.processMeshAsync(t);
|
|
6103
5812
|
o !== null && (r.mesh = o);
|
|
@@ -6143,7 +5852,7 @@ class Yn {
|
|
|
6143
5852
|
* @param {Array<THREE.Object3D>} objects List of objects to process
|
|
6144
5853
|
*/
|
|
6145
5854
|
async processObjectsAsync(t) {
|
|
6146
|
-
const e = new
|
|
5855
|
+
const e = new Ft();
|
|
6147
5856
|
e.name = "AuxScene";
|
|
6148
5857
|
for (let n = 0; n < t.length; n++)
|
|
6149
5858
|
e.children.push(t[n]);
|
|
@@ -6159,7 +5868,7 @@ class Yn {
|
|
|
6159
5868
|
});
|
|
6160
5869
|
const n = [];
|
|
6161
5870
|
for (let s = 0; s < t.length; s++)
|
|
6162
|
-
t[s] instanceof
|
|
5871
|
+
t[s] instanceof Ft ? await this.processSceneAsync(t[s]) : n.push(t[s]);
|
|
6163
5872
|
n.length > 0 && await this.processObjectsAsync(n);
|
|
6164
5873
|
for (let s = 0; s < this.skins.length; ++s)
|
|
6165
5874
|
this.processSkin(this.skins[s]);
|
|
@@ -6174,7 +5883,7 @@ class Yn {
|
|
|
6174
5883
|
await t(this.plugins[e]);
|
|
6175
5884
|
}
|
|
6176
5885
|
}
|
|
6177
|
-
class
|
|
5886
|
+
class kn {
|
|
6178
5887
|
constructor(t) {
|
|
6179
5888
|
this.writer = t, this.name = "KHR_lights_punctual";
|
|
6180
5889
|
}
|
|
@@ -6190,7 +5899,7 @@ class Xn {
|
|
|
6190
5899
|
o.push(i), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
|
|
6191
5900
|
}
|
|
6192
5901
|
}
|
|
6193
|
-
class
|
|
5902
|
+
class _n {
|
|
6194
5903
|
constructor(t) {
|
|
6195
5904
|
this.writer = t, this.name = "KHR_materials_unlit";
|
|
6196
5905
|
}
|
|
@@ -6200,7 +5909,7 @@ class Vn {
|
|
|
6200
5909
|
e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
|
|
6201
5910
|
}
|
|
6202
5911
|
}
|
|
6203
|
-
class
|
|
5912
|
+
class Wn {
|
|
6204
5913
|
constructor(t) {
|
|
6205
5914
|
this.writer = t, this.name = "KHR_materials_clearcoat";
|
|
6206
5915
|
}
|
|
@@ -6231,7 +5940,7 @@ class Hn {
|
|
|
6231
5940
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6232
5941
|
}
|
|
6233
5942
|
}
|
|
6234
|
-
class
|
|
5943
|
+
class Yn {
|
|
6235
5944
|
constructor(t) {
|
|
6236
5945
|
this.writer = t, this.name = "KHR_materials_dispersion";
|
|
6237
5946
|
}
|
|
@@ -6241,7 +5950,7 @@ class $n {
|
|
|
6241
5950
|
r.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6242
5951
|
}
|
|
6243
5952
|
}
|
|
6244
|
-
class
|
|
5953
|
+
class Xn {
|
|
6245
5954
|
constructor(t) {
|
|
6246
5955
|
this.writer = t, this.name = "KHR_materials_iridescence";
|
|
6247
5956
|
}
|
|
@@ -6265,7 +5974,7 @@ class Jn {
|
|
|
6265
5974
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6266
5975
|
}
|
|
6267
5976
|
}
|
|
6268
|
-
class
|
|
5977
|
+
class Vn {
|
|
6269
5978
|
constructor(t) {
|
|
6270
5979
|
this.writer = t, this.name = "KHR_materials_transmission";
|
|
6271
5980
|
}
|
|
@@ -6282,7 +5991,7 @@ class Kn {
|
|
|
6282
5991
|
e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6283
5992
|
}
|
|
6284
5993
|
}
|
|
6285
|
-
class
|
|
5994
|
+
class Hn {
|
|
6286
5995
|
constructor(t) {
|
|
6287
5996
|
this.writer = t, this.name = "KHR_materials_volume";
|
|
6288
5997
|
}
|
|
@@ -6299,7 +6008,7 @@ class Zn {
|
|
|
6299
6008
|
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;
|
|
6300
6009
|
}
|
|
6301
6010
|
}
|
|
6302
|
-
class
|
|
6011
|
+
class $n {
|
|
6303
6012
|
constructor(t) {
|
|
6304
6013
|
this.writer = t, this.name = "KHR_materials_ior";
|
|
6305
6014
|
}
|
|
@@ -6309,12 +6018,12 @@ class Qn {
|
|
|
6309
6018
|
r.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6310
6019
|
}
|
|
6311
6020
|
}
|
|
6312
|
-
class
|
|
6021
|
+
class Jn {
|
|
6313
6022
|
constructor(t) {
|
|
6314
6023
|
this.writer = t, this.name = "KHR_materials_specular";
|
|
6315
6024
|
}
|
|
6316
6025
|
async writeMaterialAsync(t, e) {
|
|
6317
|
-
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(
|
|
6026
|
+
if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Cn) && !t.specularIntensityMap && !t.specularColorMap) return;
|
|
6318
6027
|
const n = this.writer, s = n.extensionsUsed, r = {};
|
|
6319
6028
|
if (t.specularIntensityMap) {
|
|
6320
6029
|
const i = {
|
|
@@ -6333,7 +6042,7 @@ class ts {
|
|
|
6333
6042
|
r.specularFactor = t.specularIntensity, r.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6334
6043
|
}
|
|
6335
6044
|
}
|
|
6336
|
-
class
|
|
6045
|
+
class Kn {
|
|
6337
6046
|
constructor(t) {
|
|
6338
6047
|
this.writer = t, this.name = "KHR_materials_sheen";
|
|
6339
6048
|
}
|
|
@@ -6357,7 +6066,7 @@ class es {
|
|
|
6357
6066
|
r.sheenRoughnessFactor = t.sheenRoughness, r.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6358
6067
|
}
|
|
6359
6068
|
}
|
|
6360
|
-
class
|
|
6069
|
+
class Zn {
|
|
6361
6070
|
constructor(t) {
|
|
6362
6071
|
this.writer = t, this.name = "KHR_materials_anisotropy";
|
|
6363
6072
|
}
|
|
@@ -6371,7 +6080,7 @@ class ns {
|
|
|
6371
6080
|
r.anisotropyStrength = t.anisotropy, r.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6372
6081
|
}
|
|
6373
6082
|
}
|
|
6374
|
-
class
|
|
6083
|
+
class Qn {
|
|
6375
6084
|
constructor(t) {
|
|
6376
6085
|
this.writer = t, this.name = "KHR_materials_emissive_strength";
|
|
6377
6086
|
}
|
|
@@ -6381,7 +6090,7 @@ class ss {
|
|
|
6381
6090
|
r.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6382
6091
|
}
|
|
6383
6092
|
}
|
|
6384
|
-
class
|
|
6093
|
+
class ts {
|
|
6385
6094
|
constructor(t) {
|
|
6386
6095
|
this.writer = t, this.name = "EXT_materials_bump";
|
|
6387
6096
|
}
|
|
@@ -6398,13 +6107,13 @@ class rs {
|
|
|
6398
6107
|
r.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = r, s[this.name] = !0;
|
|
6399
6108
|
}
|
|
6400
6109
|
}
|
|
6401
|
-
class
|
|
6110
|
+
class es {
|
|
6402
6111
|
constructor(t) {
|
|
6403
6112
|
this.writer = t, this.name = "EXT_mesh_gpu_instancing";
|
|
6404
6113
|
}
|
|
6405
6114
|
writeNode(t, e) {
|
|
6406
6115
|
if (!t.isInstancedMesh) return;
|
|
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
|
|
6116
|
+
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 ut(), l = new Ie(), h = new ut();
|
|
6408
6117
|
for (let f = 0; f < s.count; f++)
|
|
6409
6118
|
s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(r, f * 3), l.toArray(i, f * 4), h.toArray(o, f * 3);
|
|
6410
6119
|
const d = {
|
|
@@ -6415,7 +6124,7 @@ class is {
|
|
|
6415
6124
|
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;
|
|
6416
6125
|
}
|
|
6417
6126
|
}
|
|
6418
|
-
|
|
6127
|
+
dt.Utils = {
|
|
6419
6128
|
insertKeyframe: function(u, t) {
|
|
6420
6129
|
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));
|
|
6421
6130
|
let o;
|
|
@@ -6445,7 +6154,7 @@ ft.Utils = {
|
|
|
6445
6154
|
const e = [], n = {}, s = u.tracks;
|
|
6446
6155
|
for (let r = 0; r < s.length; ++r) {
|
|
6447
6156
|
let i = s[r];
|
|
6448
|
-
const o =
|
|
6157
|
+
const o = ht.parseTrackName(i.name), a = ht.findNode(t, o.nodeName);
|
|
6449
6158
|
if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
|
|
6450
6159
|
e.push(i);
|
|
6451
6160
|
continue;
|
|
@@ -6488,7 +6197,7 @@ ft.Utils = {
|
|
|
6488
6197
|
return t;
|
|
6489
6198
|
}
|
|
6490
6199
|
};
|
|
6491
|
-
async function
|
|
6200
|
+
async function ns(u) {
|
|
6492
6201
|
if (typeof FileReader > "u") {
|
|
6493
6202
|
const t = await u.arrayBuffer(), n = Buffer.from(t).toString("base64");
|
|
6494
6203
|
return `data:${u.type};base64,${n}`;
|
|
@@ -6498,7 +6207,7 @@ async function os(u) {
|
|
|
6498
6207
|
n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(u);
|
|
6499
6208
|
});
|
|
6500
6209
|
}
|
|
6501
|
-
async function
|
|
6210
|
+
async function Lt(u) {
|
|
6502
6211
|
if (typeof u.arrayBuffer == "function")
|
|
6503
6212
|
return await u.arrayBuffer();
|
|
6504
6213
|
if (typeof FileReader < "u")
|
|
@@ -6511,8 +6220,8 @@ async function St(u) {
|
|
|
6511
6220
|
return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
|
|
6512
6221
|
}
|
|
6513
6222
|
}
|
|
6514
|
-
const
|
|
6515
|
-
function
|
|
6223
|
+
const ss = new He(), rs = new dt();
|
|
6224
|
+
function is(u, t, e = 0.1) {
|
|
6516
6225
|
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;
|
|
6517
6226
|
return {
|
|
6518
6227
|
points: [
|
|
@@ -6527,7 +6236,7 @@ function ls(u, t, e = 0.1) {
|
|
|
6527
6236
|
rectIndices: [0, 1, 3, 2, 0]
|
|
6528
6237
|
};
|
|
6529
6238
|
}
|
|
6530
|
-
class
|
|
6239
|
+
class Le extends z {
|
|
6531
6240
|
static name = "WhiteModel";
|
|
6532
6241
|
Dxf = null;
|
|
6533
6242
|
Variable = null;
|
|
@@ -6557,7 +6266,7 @@ class Ee extends z {
|
|
|
6557
6266
|
new I.LineSegments(new I.EdgesGeometry(r), new I.LineBasicMaterial({ color: 0 }))
|
|
6558
6267
|
);
|
|
6559
6268
|
}), t.originalData.map(({ start: n, end: s, insetionArr: r }) => {
|
|
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 } =
|
|
6269
|
+
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 } = is(i, o, t.width);
|
|
6561
6270
|
return {
|
|
6562
6271
|
points: a,
|
|
6563
6272
|
indices: c,
|
|
@@ -6590,7 +6299,7 @@ class Ee extends z {
|
|
|
6590
6299
|
toOBJ() {
|
|
6591
6300
|
return new Promise((t) => {
|
|
6592
6301
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
|
|
6593
|
-
t(
|
|
6302
|
+
t(ss.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6594
6303
|
}, 20);
|
|
6595
6304
|
});
|
|
6596
6305
|
}
|
|
@@ -6602,7 +6311,7 @@ class Ee extends z {
|
|
|
6602
6311
|
toGltf(t = !0) {
|
|
6603
6312
|
return new Promise((e) => {
|
|
6604
6313
|
this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
|
|
6605
|
-
|
|
6314
|
+
rs.parse(this.whiteModelGroup.children, (n) => {
|
|
6606
6315
|
e(n), this.material.opacity = 0.8, this.material.transparent = !0;
|
|
6607
6316
|
}, () => {
|
|
6608
6317
|
e(void 0);
|
|
@@ -6663,7 +6372,7 @@ class Ee extends z {
|
|
|
6663
6372
|
}
|
|
6664
6373
|
}
|
|
6665
6374
|
}
|
|
6666
|
-
class
|
|
6375
|
+
class Ee extends z {
|
|
6667
6376
|
static name = "DetailsPoint";
|
|
6668
6377
|
Dxf = null;
|
|
6669
6378
|
WhiteModel = null;
|
|
@@ -6740,7 +6449,7 @@ class Se extends z {
|
|
|
6740
6449
|
}, 50);
|
|
6741
6450
|
}
|
|
6742
6451
|
}
|
|
6743
|
-
class
|
|
6452
|
+
class Se extends z {
|
|
6744
6453
|
static name = "DxfLineModel";
|
|
6745
6454
|
dxfLineModel = new I.LineSegments();
|
|
6746
6455
|
dxfDoorsLineModel = new I.LineSegments();
|
|
@@ -6763,11 +6472,11 @@ class be extends z {
|
|
|
6763
6472
|
});
|
|
6764
6473
|
}
|
|
6765
6474
|
}
|
|
6766
|
-
const
|
|
6475
|
+
const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6767
6476
|
__proto__: null,
|
|
6768
|
-
DetailsPoint:
|
|
6769
|
-
DxfLineModel:
|
|
6770
|
-
WhiteModel:
|
|
6477
|
+
DetailsPoint: Ee,
|
|
6478
|
+
DxfLineModel: Se,
|
|
6479
|
+
WhiteModel: Le
|
|
6771
6480
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6772
6481
|
function Kt(u, t = {}) {
|
|
6773
6482
|
const {
|
|
@@ -6775,24 +6484,293 @@ function Kt(u, t = {}) {
|
|
|
6775
6484
|
whiteModel: n = !0,
|
|
6776
6485
|
dxfLineModel: s = !0
|
|
6777
6486
|
} = t;
|
|
6778
|
-
s && u.addComponent(new
|
|
6487
|
+
s && u.addComponent(new Se()), n && u.addComponent(new Le()), e && u.addComponent(new Ee());
|
|
6779
6488
|
}
|
|
6780
|
-
const
|
|
6489
|
+
const as = Object.assign(Kt, {
|
|
6781
6490
|
create(u = {}) {
|
|
6782
6491
|
return (t) => Kt(t, u);
|
|
6783
6492
|
}
|
|
6784
|
-
}),
|
|
6493
|
+
}), cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6785
6494
|
__proto__: null,
|
|
6786
|
-
ModelDataPlugin:
|
|
6787
|
-
components:
|
|
6495
|
+
ModelDataPlugin: as,
|
|
6496
|
+
components: os
|
|
6788
6497
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6789
|
-
|
|
6498
|
+
class ls extends I.LineSegments {
|
|
6499
|
+
geometry = new I.BufferGeometry();
|
|
6500
|
+
points = [];
|
|
6501
|
+
pointsObject3D;
|
|
6502
|
+
constructor(t = [], e = 16777215) {
|
|
6503
|
+
super(), this.geometry = this.geometry, this.addPoint(...t), this.frustumCulled = !1, this.pointsObject3D = new I.Points(this.geometry, new I.PointsMaterial({
|
|
6504
|
+
sizeAttenuation: !1,
|
|
6505
|
+
size: 10
|
|
6506
|
+
})), this.material = new I.LineBasicMaterial({ color: e });
|
|
6507
|
+
}
|
|
6508
|
+
addPoint(...t) {
|
|
6509
|
+
this.points.push(...t), this.updateGeometry();
|
|
6510
|
+
}
|
|
6511
|
+
setPoint(...t) {
|
|
6512
|
+
this.points.length = 0, this.addPoint(...t);
|
|
6513
|
+
}
|
|
6514
|
+
_timer = null;
|
|
6515
|
+
updateGeometry() {
|
|
6516
|
+
this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
6517
|
+
const t = this.points.flatMap((n, s) => {
|
|
6518
|
+
if (s === 0) return [];
|
|
6519
|
+
{
|
|
6520
|
+
const r = this.points[s - 1];
|
|
6521
|
+
return [r.x, r.y, r.z, n.x, n.y, n.z];
|
|
6522
|
+
}
|
|
6523
|
+
}), e = new I.BufferAttribute(new Float32Array(t), 3);
|
|
6524
|
+
this.geometry.setAttribute("position", e), this._timer = null;
|
|
6525
|
+
});
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
function Et() {
|
|
6529
|
+
return new Promise((u) => {
|
|
6530
|
+
const t = document.createElement("input");
|
|
6531
|
+
t.type = "file", t.accept = "application/json", t.click(), t.onchange = () => {
|
|
6532
|
+
t.files?.length ? u(t.files[0]) : u(null);
|
|
6533
|
+
};
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
const us = Object.assign(Et, {
|
|
6537
|
+
arrayBuffer() {
|
|
6538
|
+
return new Promise(async (u) => {
|
|
6539
|
+
const t = await Et();
|
|
6540
|
+
if (t instanceof File) {
|
|
6541
|
+
const e = new FileReader();
|
|
6542
|
+
e.onload = () => {
|
|
6543
|
+
u(e.result);
|
|
6544
|
+
}, e.readAsArrayBuffer(t);
|
|
6545
|
+
} else u(null);
|
|
6546
|
+
});
|
|
6547
|
+
},
|
|
6548
|
+
text() {
|
|
6549
|
+
return new Promise(async (u) => {
|
|
6550
|
+
const t = await Et();
|
|
6551
|
+
if (t instanceof File) {
|
|
6552
|
+
const e = new FileReader();
|
|
6553
|
+
e.onload = () => {
|
|
6554
|
+
u(e.result);
|
|
6555
|
+
}, e.readAsText(t, "utf-8");
|
|
6556
|
+
} else u(null);
|
|
6557
|
+
});
|
|
6558
|
+
},
|
|
6559
|
+
async json() {
|
|
6560
|
+
const u = await this.text();
|
|
6561
|
+
if (u) return JSON.parse(u);
|
|
6562
|
+
}
|
|
6563
|
+
});
|
|
6564
|
+
class be extends it {
|
|
6565
|
+
list = [];
|
|
6566
|
+
rollbacklist = [];
|
|
6567
|
+
revokeRollbacklist = [];
|
|
6568
|
+
// 是否写入操作记录
|
|
6569
|
+
writeOperationList = !0;
|
|
6570
|
+
loop = !1;
|
|
6571
|
+
setLoop(t) {
|
|
6572
|
+
return this.loop = t, this;
|
|
6573
|
+
}
|
|
6574
|
+
/**
|
|
6575
|
+
*
|
|
6576
|
+
* @param operation
|
|
6577
|
+
* @returns
|
|
6578
|
+
*/
|
|
6579
|
+
add(t) {
|
|
6580
|
+
return this.list.push(t), this;
|
|
6581
|
+
}
|
|
6582
|
+
/** 添加回滚回调列表
|
|
6583
|
+
* @param callBack
|
|
6584
|
+
*/
|
|
6585
|
+
addRollback(t) {
|
|
6586
|
+
return this.rollbacklist.push(t), this;
|
|
6587
|
+
}
|
|
6588
|
+
/** 添加撤回回滚回调列表
|
|
6589
|
+
* @param callBack
|
|
6590
|
+
* @returns
|
|
6591
|
+
*/
|
|
6592
|
+
addRevokeRollback(t) {
|
|
6593
|
+
return this.revokeRollbacklist.push(t), this;
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
class hs extends it {
|
|
6597
|
+
commandFlowMap = /* @__PURE__ */ new Map();
|
|
6598
|
+
lock = !1;
|
|
6599
|
+
abortController = null;
|
|
6600
|
+
resolve = null;
|
|
6601
|
+
currentName = null;
|
|
6602
|
+
_disabled = !1;
|
|
6603
|
+
set disabled(t) {
|
|
6604
|
+
this._disabled = t, this._disabled && this.cancel();
|
|
6605
|
+
}
|
|
6606
|
+
get disabled() {
|
|
6607
|
+
return this._disabled;
|
|
6608
|
+
}
|
|
6609
|
+
/**
|
|
6610
|
+
* 操作记录
|
|
6611
|
+
*/
|
|
6612
|
+
operationList = [];
|
|
6613
|
+
rollbackList = [];
|
|
6614
|
+
constructor() {
|
|
6615
|
+
super();
|
|
6616
|
+
}
|
|
6617
|
+
/** 添加命令流
|
|
6618
|
+
* @param name
|
|
6619
|
+
* @returns
|
|
6620
|
+
*/
|
|
6621
|
+
addCommandFlow(t) {
|
|
6622
|
+
if (this.commandFlowMap.has(t)) throw new Error(`${t} 命令已经存在`);
|
|
6623
|
+
const e = new be();
|
|
6624
|
+
return this.commandFlowMap.set(t, e), e;
|
|
6625
|
+
}
|
|
6626
|
+
executionPromise = null;
|
|
6627
|
+
executionResolve = null;
|
|
6628
|
+
/** 执行控制流
|
|
6629
|
+
* @param name
|
|
6630
|
+
* @returns
|
|
6631
|
+
*/
|
|
6632
|
+
async start(t, e = null, n = 0) {
|
|
6633
|
+
if (this.disabled) throw new Error("命令管理器已禁用,无法启动新的命令流");
|
|
6634
|
+
if (this.dispatchEvent({
|
|
6635
|
+
type: "startedBefore",
|
|
6636
|
+
name: t,
|
|
6637
|
+
currentName: this.currentName
|
|
6638
|
+
}), this.executionPromise && await this.executionPromise, this.executionPromise = null, this.lock)
|
|
6639
|
+
throw new Error("命令管理器已被 " + this.currentName + " 命令锁定,无法启动新的命令流,请退出或等待命令执行结束");
|
|
6640
|
+
const s = this.commandFlowMap.get(t);
|
|
6641
|
+
if (!s)
|
|
6642
|
+
throw new Error(`命令流 ${t} 不存在`);
|
|
6643
|
+
this.lock = !0, this.abortController = new AbortController(), this.currentName = t, s.dispatchEvent({ type: "started" }), this.dispatchEvent({ type: "started", name: t });
|
|
6644
|
+
try {
|
|
6645
|
+
for (let r = n; r < s.list.length; r++) {
|
|
6646
|
+
const i = s.list[r];
|
|
6647
|
+
if (s.dispatchEvent({ type: "executing", index: r }), this.dispatchEvent({ type: "executing", name: t, index: r }), e = await new Promise((o) => {
|
|
6648
|
+
this.resolve = o, i(o, e);
|
|
6649
|
+
}), this.abortController.signal.aborted) {
|
|
6650
|
+
s.dispatchEvent({ type: "executionInterrupt", index: r }), this.dispatchEvent({ type: "executionInterrupt", name: t, index: r }), this.dispatchEvent({ type: "cancel", name: t });
|
|
6651
|
+
break;
|
|
6652
|
+
} else
|
|
6653
|
+
s.dispatchEvent({ type: "executionCompleted", index: r, data: e }), this.dispatchEvent({ type: "executionCompleted", name: t, index: r, data: e });
|
|
6654
|
+
}
|
|
6655
|
+
} catch (r) {
|
|
6656
|
+
console.error(r);
|
|
6657
|
+
} finally {
|
|
6658
|
+
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);
|
|
6659
|
+
}
|
|
6660
|
+
return e;
|
|
6661
|
+
}
|
|
6662
|
+
/** 取消当前命令
|
|
6663
|
+
*/
|
|
6664
|
+
cancel() {
|
|
6665
|
+
this.abortController && (this.abortController.abort(), this.resolve && this.resolve(), this.executionPromise = new Promise((t) => this.executionResolve = t));
|
|
6666
|
+
}
|
|
6667
|
+
/**
|
|
6668
|
+
* 回滚
|
|
6669
|
+
*/
|
|
6670
|
+
rollback() {
|
|
6671
|
+
try {
|
|
6672
|
+
const t = this.operationList.pop();
|
|
6673
|
+
if (!t) return !1;
|
|
6674
|
+
const e = this.commandFlowMap.get(t.name);
|
|
6675
|
+
if (!e) return !1;
|
|
6676
|
+
const n = e.rollbacklist.reduce((s, r) => r(s), t.data);
|
|
6677
|
+
return this.dispatchEvent({ type: "rollback", name: t.name }), this.rollbackList.push({
|
|
6678
|
+
data: n,
|
|
6679
|
+
name: t.name
|
|
6680
|
+
}), !0;
|
|
6681
|
+
} catch (t) {
|
|
6682
|
+
throw new Error(`回滚失败:${t}`);
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
/**
|
|
6686
|
+
* 撤销回滚
|
|
6687
|
+
*/
|
|
6688
|
+
revokeRollback() {
|
|
6689
|
+
try {
|
|
6690
|
+
const t = this.rollbackList.pop();
|
|
6691
|
+
if (!t) return !1;
|
|
6692
|
+
const e = this.commandFlowMap.get(t.name);
|
|
6693
|
+
if (!e) return !1;
|
|
6694
|
+
const n = e.revokeRollbacklist.reduce((s, r) => r(s), t.data);
|
|
6695
|
+
return this.dispatchEvent({ type: "revokeRollback", name: t.name }), this.operationList.push({ name: t.name, data: n }), !0;
|
|
6696
|
+
} catch (t) {
|
|
6697
|
+
throw new Error(`撤回回滚失败:${t}`);
|
|
6698
|
+
}
|
|
6699
|
+
}
|
|
6700
|
+
destroy() {
|
|
6701
|
+
this.cancel(), this.addEventListener("cancel", () => {
|
|
6702
|
+
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;
|
|
6703
|
+
}, { once: !0 });
|
|
6704
|
+
}
|
|
6705
|
+
}
|
|
6706
|
+
const ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6707
|
+
__proto__: null,
|
|
6708
|
+
ArrayMap: H,
|
|
6709
|
+
AxisAlignCorr: ue,
|
|
6710
|
+
BoundExt: Bt,
|
|
6711
|
+
Box2: v,
|
|
6712
|
+
CommandFlow: be,
|
|
6713
|
+
CommandManager: hs,
|
|
6714
|
+
Component: z,
|
|
6715
|
+
ComponentManager: Qt,
|
|
6716
|
+
CountMap: ft,
|
|
6717
|
+
DoubleWallHelper: pt,
|
|
6718
|
+
DxfSystem: tt,
|
|
6719
|
+
EventDispatcher: it,
|
|
6720
|
+
LineGroupType: C,
|
|
6721
|
+
LineIndexGenerator: gt,
|
|
6722
|
+
LineSegment: E,
|
|
6723
|
+
LineSegmentUndirectedGraph: yt,
|
|
6724
|
+
Lines: ls,
|
|
6725
|
+
MapEnhance: et,
|
|
6726
|
+
Point: D,
|
|
6727
|
+
PointVirtualGrid: G,
|
|
6728
|
+
Polygon: at,
|
|
6729
|
+
PvgList: te,
|
|
6730
|
+
Quadtree: B,
|
|
6731
|
+
Rectangle: nt,
|
|
6732
|
+
SelectLocalFile: us,
|
|
6733
|
+
UndirectedGraph: ie,
|
|
6734
|
+
UnionFindSet: Q,
|
|
6735
|
+
buildBayWindowGroup: bt,
|
|
6736
|
+
buildDoubleWallGroup: Z,
|
|
6737
|
+
clippingDoubleWall: ye,
|
|
6738
|
+
clippingLineUserData: At,
|
|
6739
|
+
cloneUserData: k,
|
|
6740
|
+
closedPathArea: fe,
|
|
6741
|
+
components: Mn,
|
|
6742
|
+
createPointVirtualGrid: $,
|
|
6743
|
+
createQuadtree: Pt,
|
|
6744
|
+
findCircleEdges: ce,
|
|
6745
|
+
findClosedPolygons: In,
|
|
6746
|
+
findDiscretePoint: re,
|
|
6747
|
+
findDiscretePointLine: Ke,
|
|
6748
|
+
findDiscretePointLine2: It,
|
|
6749
|
+
findLargestCircle: le,
|
|
6750
|
+
findRingEdges: we,
|
|
6751
|
+
findVerticalReference: he,
|
|
6752
|
+
lineDataToOriginalData: rt,
|
|
6753
|
+
lineDataToThreeVJiaJson: me,
|
|
6754
|
+
lineSegmentClipping: Tt,
|
|
6755
|
+
mergeLineUserData: _,
|
|
6756
|
+
mergeSmallestCircle: ae,
|
|
6757
|
+
mergeWindow: se,
|
|
6758
|
+
originalDataToLineData: de,
|
|
6759
|
+
recomputedWindow: ot,
|
|
6760
|
+
recomputedWindowCenter: ne,
|
|
6761
|
+
ringsDeduplication: oe,
|
|
6762
|
+
smallestCircle: vt,
|
|
6763
|
+
toOriginalDataItem: ee,
|
|
6764
|
+
tools: Je,
|
|
6765
|
+
uuid: V
|
|
6766
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6767
|
+
function ds() {
|
|
6790
6768
|
return import("./index2.js");
|
|
6791
6769
|
}
|
|
6792
|
-
function
|
|
6770
|
+
function fs() {
|
|
6793
6771
|
return import("./index3.js");
|
|
6794
6772
|
}
|
|
6795
|
-
let
|
|
6773
|
+
let Nt = null;
|
|
6796
6774
|
class Te {
|
|
6797
6775
|
static preTime = performance.now();
|
|
6798
6776
|
static firstTime = performance.now();
|
|
@@ -6808,10 +6786,10 @@ class Te {
|
|
|
6808
6786
|
return console.log(t + " %c totalTime " + parseFloat(n.toFixed(6)) + "ms", "color: green;"), this.preTime = e, n;
|
|
6809
6787
|
}
|
|
6810
6788
|
}
|
|
6811
|
-
typeof window < "u" && (window.drawLines =
|
|
6789
|
+
typeof window < "u" && (window.drawLines = Me, window.drawPoint = vn, window.drawText = Rn, window.randomColor = () => Math.floor(Math.random() * 16777215), window.Log = Te, window.TEST = !1);
|
|
6812
6790
|
typeof globalThis < "u" && (globalThis.Log = Te);
|
|
6813
|
-
async function
|
|
6814
|
-
const s = await Promise.resolve().then(() =>
|
|
6791
|
+
async function Ms(u, t, e = !1, n) {
|
|
6792
|
+
const s = await Promise.resolve().then(() => cs), r = await ds(), i = await fs(), o = new tt().usePlugin(s.ModelDataPlugin.create({
|
|
6815
6793
|
detailsPoint: !1,
|
|
6816
6794
|
whiteModel: !0
|
|
6817
6795
|
})).usePlugin(r.RenderPlugin.create({
|
|
@@ -6821,12 +6799,12 @@ async function Ds(u, t, e = !1, n) {
|
|
|
6821
6799
|
orbitControls: e,
|
|
6822
6800
|
camera: t
|
|
6823
6801
|
})).usePlugin(i.Editor.create({ viewPermission: n })), a = o.findComponentByType(r.components.DomContainer);
|
|
6824
|
-
return a && u.appendChild(a.domElement),
|
|
6802
|
+
return a && u.appendChild(a.domElement), Nt = o, {
|
|
6825
6803
|
dxfSystem: o,
|
|
6826
|
-
getFileAll: () =>
|
|
6804
|
+
getFileAll: () => ps(o)
|
|
6827
6805
|
};
|
|
6828
6806
|
}
|
|
6829
|
-
async function
|
|
6807
|
+
async function ps(u = Nt) {
|
|
6830
6808
|
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" });
|
|
6831
6809
|
return {
|
|
6832
6810
|
dxf: n,
|
|
@@ -6838,35 +6816,35 @@ async function gs(u = jt) {
|
|
|
6838
6816
|
correctionDxf: s
|
|
6839
6817
|
};
|
|
6840
6818
|
}
|
|
6841
|
-
function
|
|
6842
|
-
return
|
|
6819
|
+
function Ds() {
|
|
6820
|
+
return Nt;
|
|
6843
6821
|
}
|
|
6844
6822
|
export {
|
|
6845
6823
|
ue as A,
|
|
6846
6824
|
v as B,
|
|
6847
6825
|
z as C,
|
|
6848
6826
|
tt as D,
|
|
6849
|
-
|
|
6850
|
-
|
|
6827
|
+
ls as L,
|
|
6828
|
+
as as M,
|
|
6851
6829
|
D as P,
|
|
6852
6830
|
B as Q,
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6831
|
+
us as S,
|
|
6832
|
+
xe as T,
|
|
6833
|
+
Rt as V,
|
|
6834
|
+
Le as W,
|
|
6835
|
+
Ee as a,
|
|
6836
|
+
E as b,
|
|
6859
6837
|
G as c,
|
|
6860
6838
|
k as d,
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6839
|
+
ge as e,
|
|
6840
|
+
hs as f,
|
|
6841
|
+
Ms as g,
|
|
6842
|
+
ps as h,
|
|
6843
|
+
Ds as i,
|
|
6866
6844
|
U as j,
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6845
|
+
cs as k,
|
|
6846
|
+
ws as l,
|
|
6847
|
+
Mn as m,
|
|
6848
|
+
ot as r,
|
|
6871
6849
|
V as u
|
|
6872
6850
|
};
|