build-dxf 0.0.21 → 0.0.23

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
@@ -4,14 +4,14 @@ import F from "clipper-lib";
4
4
  import R from "dxf-writer";
5
5
  import { OBJExporter as et } from "three/examples/jsm/exporters/OBJExporter.js";
6
6
  import { GLTFExporter as nt } from "three/examples/jsm/exporters/GLTFExporter.js";
7
- function N() {
7
+ function O() {
8
8
  return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(g) {
9
9
  var t = Math.random() * 16 | 0, e = g == "x" ? t : t & 3 | 8;
10
10
  return e.toString(16);
11
11
  });
12
12
  }
13
13
  class $ extends tt {
14
- uuid = N();
14
+ uuid = O();
15
15
  addEventListener(t, e, n) {
16
16
  const { once: i = !1 } = n ?? {}, s = (r) => {
17
17
  e(r), i && o();
@@ -31,7 +31,7 @@ class $ extends tt {
31
31
  e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
32
32
  }
33
33
  }
34
- class q extends $ {
34
+ class G extends $ {
35
35
  parent;
36
36
  destroyed = !1;
37
37
  constructor(...t) {
@@ -72,7 +72,7 @@ class it extends $ {
72
72
  * @param component
73
73
  */
74
74
  removeComponent(t) {
75
- if (t instanceof q) {
75
+ if (t instanceof G) {
76
76
  const e = this.components.indexOf(t);
77
77
  e > -1 && (this.components.splice(e, 1), this.dispatchEvent({
78
78
  type: "removeComponent",
@@ -117,7 +117,7 @@ class it extends $ {
117
117
  return e || null;
118
118
  }
119
119
  }
120
- class p {
120
+ class x {
121
121
  x;
122
122
  y;
123
123
  get X() {
@@ -234,7 +234,7 @@ class p {
234
234
  */
235
235
  normal(t) {
236
236
  const e = this.x - t.x, n = this.y - t.y, i = Math.sqrt(e * e + n * n), s = -n / i, o = e / i;
237
- return new p(s, o);
237
+ return new x(s, o);
238
238
  }
239
239
  /**
240
240
  * 获取由传入的点到该点的单位方向向量
@@ -244,7 +244,7 @@ class p {
244
244
  */
245
245
  direction(t) {
246
246
  const e = this.x - t.x, n = this.y - t.y, i = Math.sqrt(e * e + n * n);
247
- return i === 0 ? new p(0, 0) : new p(e / i, n / i);
247
+ return i === 0 ? new x(0, 0) : new x(e / i, n / i);
248
248
  }
249
249
  /**
250
250
  * 计算模长
@@ -302,7 +302,7 @@ class p {
302
302
  * @returns
303
303
  */
304
304
  clone() {
305
- return new p(this.x, this.y);
305
+ return new x(this.x, this.y);
306
306
  }
307
307
  /**
308
308
  * 克隆
@@ -319,23 +319,23 @@ class p {
319
319
  };
320
320
  }
321
321
  static from(t) {
322
- return Array.isArray(t) ? new p(t[0], t[1]) : "x" in t && "y" in t ? new p(t.x, t.y) : "X" in t && "Y" in t ? new p(t.X, t.Y) : this.zero();
322
+ return Array.isArray(t) ? new x(t[0], t[1]) : "x" in t && "y" in t ? new x(t.x, t.y) : "X" in t && "Y" in t ? new x(t.X, t.Y) : this.zero();
323
323
  }
324
324
  static zero() {
325
- return new p(0, 0);
325
+ return new x(0, 0);
326
326
  }
327
327
  }
328
- class v {
328
+ class A {
329
329
  minX = 0;
330
330
  maxX = 0;
331
331
  minY = 0;
332
332
  maxY = 0;
333
333
  get points() {
334
334
  return [
335
- new p(this.minX, this.minY),
336
- new p(this.maxX, this.minY),
337
- new p(this.maxX, this.maxY),
338
- new p(this.minX, this.maxY)
335
+ new x(this.minX, this.minY),
336
+ new x(this.maxX, this.minY),
337
+ new x(this.maxX, this.maxY),
338
+ new x(this.minX, this.maxY)
339
339
  ];
340
340
  }
341
341
  get width() {
@@ -345,7 +345,7 @@ class v {
345
345
  return this.maxY - this.minY;
346
346
  }
347
347
  get center() {
348
- return new p(
348
+ return new x(
349
349
  this.minX + (this.maxX - this.minX) * 0.5,
350
350
  this.minY + (this.maxY - this.minY) * 0.5
351
351
  );
@@ -403,22 +403,22 @@ class v {
403
403
  const e = (o) => this.minX <= o.x && o.x <= this.maxX && this.minY <= o.y && o.y <= this.maxY, n = (o) => {
404
404
  let r = 0;
405
405
  for (let a = 0; a < 4; a++) {
406
- const c = t.points[a], h = t.points[(a + 1) % 4], l = { x: h.x - c.x, y: h.y - c.y }, d = { x: o.x - c.x, y: o.y - c.y }, f = l.x * d.y - l.y * d.x;
407
- if (f === 0) {
408
- const m = l.x !== 0 ? (o.x - c.x) / l.x : (o.y - c.y) / l.y;
409
- if (m >= 0 && m <= 1) return !0;
406
+ const c = t.points[a], h = t.points[(a + 1) % 4], l = { x: h.x - c.x, y: h.y - c.y }, d = { x: o.x - c.x, y: o.y - c.y }, p = l.x * d.y - l.y * d.x;
407
+ if (p === 0) {
408
+ const f = l.x !== 0 ? (o.x - c.x) / l.x : (o.y - c.y) / l.y;
409
+ if (f >= 0 && f <= 1) return !0;
410
410
  } else {
411
- const m = f > 0 ? 1 : -1;
412
- if (r === 0 && (r = m), r !== m) return !1;
411
+ const f = p > 0 ? 1 : -1;
412
+ if (r === 0 && (r = f), r !== f) return !1;
413
413
  }
414
414
  }
415
415
  return !0;
416
416
  }, i = (o, r, a, c) => {
417
- const h = (u, x, w) => {
418
- const S = (x.y - u.y) * (w.x - x.x) - (x.x - u.x) * (w.y - x.y);
419
- return S === 0 ? 0 : S > 0 ? 1 : 2;
420
- }, l = (u, x, w) => Math.min(u.x, w.x) <= x.x && x.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= x.y && x.y <= Math.max(u.y, w.y), d = h(o, r, a), f = h(o, r, c), m = h(a, c, o), y = h(a, c, r);
421
- return !!(d !== f && m !== y || d === 0 && l(o, a, r) || f === 0 && l(o, c, r) || m === 0 && l(a, o, c) || y === 0 && l(a, r, c));
417
+ const h = (u, y, w) => {
418
+ const D = (y.y - u.y) * (w.x - y.x) - (y.x - u.x) * (w.y - y.y);
419
+ return D === 0 ? 0 : D > 0 ? 1 : 2;
420
+ }, l = (u, y, w) => Math.min(u.x, w.x) <= y.x && y.x <= Math.max(u.x, w.x) && Math.min(u.y, w.y) <= y.y && y.y <= Math.max(u.y, w.y), d = h(o, r, a), p = h(o, r, c), f = h(a, c, o), m = h(a, c, r);
421
+ return !!(d !== p && f !== m || d === 0 && l(o, a, r) || p === 0 && l(o, c, r) || f === 0 && l(a, o, c) || m === 0 && l(a, r, c));
422
422
  }, s = this.points;
423
423
  for (let o = 0; o < 4; o++) {
424
424
  const r = s[o], a = s[(o + 1) % 4];
@@ -500,7 +500,7 @@ class v {
500
500
  * @returns
501
501
  */
502
502
  clone() {
503
- return new v(this.minX, this.maxX, this.minY, this.maxY);
503
+ return new A(this.minX, this.maxX, this.minY, this.maxY);
504
504
  }
505
505
  /**
506
506
  *
@@ -511,7 +511,23 @@ class v {
511
511
  const e = [], n = [];
512
512
  return t.forEach((i) => {
513
513
  e.push(i.x), n.push(i.y);
514
- }), new v(
514
+ }), new A(
515
+ Math.min(...e),
516
+ Math.max(...e),
517
+ Math.min(...n),
518
+ Math.max(...n)
519
+ );
520
+ }
521
+ /**
522
+ *
523
+ * @param points
524
+ * @returns
525
+ */
526
+ static fromByLineSegment(...t) {
527
+ const e = [], n = [];
528
+ return t.forEach((i) => i.points.forEach((s) => {
529
+ e.push(s.x), n.push(s.y);
530
+ })), new A(
515
531
  Math.min(...e),
516
532
  Math.max(...e),
517
533
  Math.min(...n),
@@ -519,7 +535,7 @@ class v {
519
535
  );
520
536
  }
521
537
  }
522
- class O {
538
+ class N {
523
539
  points;
524
540
  get p0() {
525
541
  return this.points[0];
@@ -542,7 +558,7 @@ class O {
542
558
  path2D(t) {
543
559
  return this.points.flatMap((e, n) => {
544
560
  const i = this.points[(n + 1) % this.points.length];
545
- return t && t(new p(e.x, e.y), new p(i.x, i.y)), [e.x, e.y, i.x, i.y];
561
+ return t && t(new x(e.x, e.y), new x(i.x, i.y)), [e.x, e.y, i.x, i.y];
546
562
  });
547
563
  }
548
564
  createGeometry() {
@@ -569,11 +585,11 @@ class O {
569
585
  if (t.points.length !== 2)
570
586
  throw new Error("LineSegment must have exactly 2 points");
571
587
  const [e, n] = t.points, i = (s, o, r, a) => {
572
- const c = (y, u, x) => {
573
- const w = (u.y - y.y) * (x.x - u.x) - (u.x - y.x) * (x.y - u.y);
588
+ const c = (m, u, y) => {
589
+ const w = (u.y - m.y) * (y.x - u.x) - (u.x - m.x) * (y.y - u.y);
574
590
  return w === 0 ? 0 : w > 0 ? 1 : 2;
575
- }, h = (y, u, x) => Math.min(y.x, x.x) <= u.x && u.x <= Math.max(y.x, x.x) && Math.min(y.y, x.y) <= u.y && u.y <= Math.max(y.y, x.y), l = c(s, o, r), d = c(s, o, a), f = c(r, a, s), m = c(r, a, o);
576
- return !!(l !== d && f !== m || l === 0 && h(s, r, o) || d === 0 && h(s, a, o) || f === 0 && h(r, s, a) || m === 0 && h(r, o, a));
591
+ }, h = (m, u, y) => Math.min(m.x, y.x) <= u.x && u.x <= Math.max(m.x, y.x) && Math.min(m.y, y.y) <= u.y && u.y <= Math.max(m.y, y.y), l = c(s, o, r), d = c(s, o, a), p = c(r, a, s), f = c(r, a, o);
592
+ return !!(l !== d && p !== f || l === 0 && h(s, r, o) || d === 0 && h(s, a, o) || p === 0 && h(r, s, a) || f === 0 && h(r, o, a));
577
593
  };
578
594
  for (let s = 0; s < 4; s++) {
579
595
  const o = this.points[s], r = this.points[(s + 1) % 4];
@@ -658,7 +674,7 @@ class O {
658
674
  let t = 1 / 0, e = -1 / 0, n = 1 / 0, i = -1 / 0;
659
675
  return this.points.forEach((s) => {
660
676
  e = Math.max(s.x, e), t = Math.min(s.x, t), i = Math.max(s.x, i), n = Math.min(s.x, n);
661
- }), new v(t, e, n, i);
677
+ }), new A(t, e, n, i);
662
678
  }
663
679
  /**
664
680
  *
@@ -667,21 +683,21 @@ class O {
667
683
  * @returns
668
684
  */
669
685
  static fromByLineSegment(t, e = 0.1, n = !1, i = 0.5) {
670
- const s = t.points[0], o = t.points[1], r = o.normal(s), a = n ? o.direction(s).mutiplyScalar(e * i) : p.zero(), c = n ? s.direction(o).mutiplyScalar(e * i) : p.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
671
- return new O([
672
- new p(s.x + h, s.y + l).add(c),
673
- new p(o.x + h, o.y + l).add(a),
674
- new p(o.x - h, o.y - l).add(a),
675
- new p(s.x - h, s.y - l).add(c)
686
+ const s = t.points[0], o = t.points[1], r = o.normal(s), a = n ? o.direction(s).mutiplyScalar(e * i) : x.zero(), c = n ? s.direction(o).mutiplyScalar(e * i) : x.zero(), h = r.x * e * 0.5, l = r.y * e * 0.5;
687
+ return new N([
688
+ new x(s.x + h, s.y + l).add(c),
689
+ new x(o.x + h, o.y + l).add(a),
690
+ new x(o.x - h, o.y - l).add(a),
691
+ new x(s.x - h, s.y - l).add(c)
676
692
  ]);
677
693
  }
678
694
  }
679
695
  class L {
680
- points = [new p(), new p()];
696
+ points = [new x(), new x()];
681
697
  userData = {};
682
- line;
698
+ // line: any
683
699
  get center() {
684
- return new p(
700
+ return new x(
685
701
  this.points[0].x + (this.points[1].x - this.points[0].x) * 0.5,
686
702
  this.points[0].y + (this.points[1].y - this.points[0].y) * 0.5
687
703
  );
@@ -692,7 +708,7 @@ class L {
692
708
  get end() {
693
709
  return this.points[1];
694
710
  }
695
- constructor(t = new p(), e = new p()) {
711
+ constructor(t = new x(), e = new x()) {
696
712
  this.points = [t, e];
697
713
  }
698
714
  set(t, e) {
@@ -769,15 +785,15 @@ class L {
769
785
  * @returns {Rectangle}
770
786
  */
771
787
  expandToRectangle(t = 0.1, e = "all") {
772
- const n = this.start, i = this.end, s = i.normal(n), o = e === "bothSides" ? p.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? p.zero() : n.direction(i).mutiplyScalar(t * 0.5), a = s.x * t * 0.5, c = s.y * t * 0.5, h = [
788
+ const n = this.start, i = this.end, s = i.normal(n), o = e === "bothSides" ? x.zero() : i.direction(n).mutiplyScalar(t * 0.5), r = e === "bothSides" ? x.zero() : n.direction(i).mutiplyScalar(t * 0.5), a = s.x * t * 0.5, c = s.y * t * 0.5, h = [
773
789
  // 第一条线
774
- new p(n.x + a, n.y + c).add(r),
775
- new p(i.x + a, i.y + c).add(o),
790
+ new x(n.x + a, n.y + c).add(r),
791
+ new x(i.x + a, i.y + c).add(o),
776
792
  // 第二条线
777
- new p(n.x - a, n.y - c).add(r),
778
- new p(i.x - a, i.y - c).add(o)
793
+ new x(n.x - a, n.y - c).add(r),
794
+ new x(i.x - a, i.y - c).add(o)
779
795
  ];
780
- return new O([0, 1, 3, 2].map((l) => h[l]));
796
+ return new N([0, 1, 3, 2].map((l) => h[l]));
781
797
  }
782
798
  /**
783
799
  * 计算线段的长度
@@ -814,24 +830,24 @@ class L {
814
830
  projectLineSegment(t) {
815
831
  if (t.points.length !== 2 || this.points.length !== 2)
816
832
  throw new Error("每条线段必须由两个点定义");
817
- const [e, n] = t.points, [i, s] = this.points, o = new p(s.x - i.x, s.y - i.y);
833
+ const [e, n] = t.points, [i, s] = this.points, o = new x(s.x - i.x, s.y - i.y);
818
834
  if (o.x === 0 && o.y === 0)
819
835
  throw new Error("投影目标线段的两个点不能重合");
820
- const r = (m) => {
821
- const y = new p(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y, w = (y.x * o.x + y.y * o.y) / u, S = i.x + w * o.x, b = i.y + w * o.y;
822
- return new p(S, b);
836
+ const r = (f) => {
837
+ const m = new x(f.x - i.x, f.y - i.y), u = o.x * o.x + o.y * o.y, w = (m.x * o.x + m.y * o.y) / u, D = i.x + w * o.x, b = i.y + w * o.y;
838
+ return new x(D, b);
823
839
  };
824
840
  let a = r(e), c = r(n);
825
- const h = (m) => {
826
- const y = new p(m.x - i.x, m.y - i.y), u = o.x * o.x + o.y * o.y;
827
- return (y.x * o.x + y.y * o.y) / u;
841
+ const h = (f) => {
842
+ const m = new x(f.x - i.x, f.y - i.y), u = o.x * o.x + o.y * o.y;
843
+ return (m.x * o.x + m.y * o.y) / u;
828
844
  };
829
845
  let l = h(a), d = h(c);
830
- const f = (m) => {
831
- const y = Math.max(0, Math.min(1, m)), u = i.x + y * o.x, x = i.y + y * o.y;
832
- return new p(u, x);
846
+ const p = (f) => {
847
+ const m = Math.max(0, Math.min(1, f)), u = i.x + m * o.x, y = i.y + m * o.y;
848
+ return new x(u, y);
833
849
  };
834
- return (l < 0 || l > 1) && (a = f(l)), (d < 0 || d > 1) && (c = f(d)), a.x === c.x && a.y === c.y ? new L(a, a) : new L(a, c);
850
+ return (l < 0 || l > 1) && (a = p(l)), (d < 0 || d > 1) && (c = p(d)), a.x === c.x && a.y === c.y ? new L(a, a) : new L(a, c);
835
851
  }
836
852
  /**
837
853
  * 计算一条线段在另一条直线上的投影
@@ -840,16 +856,16 @@ class L {
840
856
  * @returns 投影并裁剪后的线段
841
857
  */
842
858
  projectPoint(t, e = !0) {
843
- const [n, i] = this.points, s = new p(i.x - n.x, i.y - n.y);
859
+ const [n, i] = this.points, s = new x(i.x - n.x, i.y - n.y);
844
860
  if (s.x === 0 && s.y === 0)
845
861
  throw new Error("投影目标线段的两个点不能重合");
846
862
  let r = ((h) => {
847
- const l = new p(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y, m = (l.x * s.x + l.y * s.y) / d, y = n.x + m * s.x, u = n.y + m * s.y;
848
- return new p(y, u);
863
+ const l = new x(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y, f = (l.x * s.x + l.y * s.y) / d, m = n.x + f * s.x, u = n.y + f * s.y;
864
+ return new x(m, u);
849
865
  })(t);
850
866
  if (!e) return r;
851
867
  let c = ((h) => {
852
- const l = new p(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y;
868
+ const l = new x(h.x - n.x, h.y - n.y), d = s.x * s.x + s.y * s.y;
853
869
  return (l.x * s.x + l.y * s.y) / d;
854
870
  })(r);
855
871
  return c < 0 || c > 1 ? null : r;
@@ -862,11 +878,11 @@ class L {
862
878
  */
863
879
  intersectLineSegment(t, e = !0) {
864
880
  const n = this.start, i = this.end, s = t.start, o = t.end;
865
- function r(f, m, y) {
866
- return (m.x - f.x) * (y.y - f.y) - (m.y - f.y) * (y.x - f.x);
881
+ function r(p, f, m) {
882
+ return (f.x - p.x) * (m.y - p.y) - (f.y - p.y) * (m.x - p.x);
867
883
  }
868
- function a(f, m, y) {
869
- return Math.min(m.x, y.x) - 1e-10 <= f.x && f.x <= Math.max(m.x, y.x) + 1e-10 && Math.min(m.y, y.y) - 1e-10 <= f.y && f.y <= Math.max(m.y, y.y) + 1e-10;
884
+ function a(p, f, m) {
885
+ return Math.min(f.x, m.x) - 1e-10 <= p.x && p.x <= Math.max(f.x, m.x) + 1e-10 && Math.min(f.y, m.y) - 1e-10 <= p.y && p.y <= Math.max(f.y, m.y) + 1e-10;
870
886
  }
871
887
  const c = r(n, i, s), h = r(n, i, o), l = r(s, o, n), d = r(s, o, i);
872
888
  return !!(c * h < 0 && l * d < 0 || e && (Math.abs(c) < 1e-10 && a(s, n, i) || Math.abs(h) < 1e-10 && a(o, n, i) || Math.abs(l) < 1e-10 && a(n, s, o) || Math.abs(d) < 1e-10 && a(i, s, o)));
@@ -890,7 +906,7 @@ class L {
890
906
  if (Math.abs(o) < 1e-10)
891
907
  return null;
892
908
  const r = ((e.x - i.x) * (i.y - s.y) - (e.y - i.y) * (i.x - s.x)) / o, a = e.x + r * (n.x - e.x), c = e.y + r * (n.y - e.y);
893
- return new p(a, c);
909
+ return new x(a, c);
894
910
  }
895
911
  /**
896
912
  * 获取两条线段夹角
@@ -907,6 +923,14 @@ class L {
907
923
  directionEqual(t, e = 0.1) {
908
924
  return this.includedAngle(t) < e;
909
925
  }
926
+ /**
927
+ * 两条线段是否平行
928
+ * @param line
929
+ */
930
+ parallel(t, e = 1) {
931
+ const n = this.includedAngle(t);
932
+ return n < e || n > 180 - e;
933
+ }
910
934
  /**
911
935
  * 两条线段方向相反否一致
912
936
  * @param line
@@ -939,7 +963,7 @@ class L {
939
963
  return t.userData = { ...this.userData }, t;
940
964
  }
941
965
  }
942
- async function G(g, t = !0) {
966
+ async function Y(g, t = !0) {
943
967
  if (typeof global < "u" && typeof require < "u")
944
968
  return require(g);
945
969
  {
@@ -994,7 +1018,7 @@ const st = {
994
1018
  Parsecs: 3240779289666404e-32
995
1019
  // 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
996
1020
  };
997
- function k(g) {
1021
+ function J(g) {
998
1022
  const t = [];
999
1023
  for (let e = 0; e < g.length; e++)
1000
1024
  t.push(new L(
@@ -1003,18 +1027,18 @@ function k(g) {
1003
1027
  ));
1004
1028
  return t;
1005
1029
  }
1006
- function J(g) {
1030
+ function W(g) {
1007
1031
  return g.flatMap((t, e) => (e === g.length - 1 && [...t.points, g[0].points[0]], [t.points[0]]));
1008
1032
  }
1009
- class X extends q {
1033
+ class j extends G {
1010
1034
  static name = "Dxf";
1011
1035
  shortLine = 0.04;
1012
1036
  width = 0.04;
1013
1037
  scale = 1;
1014
1038
  originalData = [];
1015
1039
  data = [];
1016
- originalBox = new v(0, 0, 0, 0);
1017
- box = new v(0, 0, 0, 0);
1040
+ originalBox = new A(0, 0, 0, 0);
1041
+ box = new A(0, 0, 0, 0);
1018
1042
  pointsGroups = [];
1019
1043
  wallsGroup = [];
1020
1044
  doors = [];
@@ -1067,8 +1091,8 @@ class X extends q {
1067
1091
  this.data = t.map(({ start: s, end: o, insetionArr: r, isDoor: a = !1, ...c }, h) => {
1068
1092
  i.push(s.z ?? 0, o.z ?? 0);
1069
1093
  const l = new L(
1070
- p.from(s).mutiplyScalar(n),
1071
- p.from(o).mutiplyScalar(n)
1094
+ x.from(s).mutiplyScalar(n),
1095
+ x.from(o).mutiplyScalar(n)
1072
1096
  );
1073
1097
  return l.userData = { isDoor: a, ...c }, this.lineSegments.push(l), [
1074
1098
  l.points[0],
@@ -1095,8 +1119,8 @@ class X extends q {
1095
1119
  const [c, h, l, d] = this.data[o];
1096
1120
  if (e.add(o), d)
1097
1121
  return i.has(o) || i.set(o, []), i.get(o)?.push(a), n.add(this.data[o]);
1098
- r.push([c, h]), l.forEach((f) => {
1099
- e.has(f) || s(f, r, o);
1122
+ r.push([c, h]), l.forEach((p) => {
1123
+ e.has(p) || s(p, r, o);
1100
1124
  });
1101
1125
  };
1102
1126
  return this.data.forEach((o, r) => {
@@ -1188,7 +1212,7 @@ class X extends q {
1188
1212
  break;
1189
1213
  }
1190
1214
  }
1191
- const e = this.mergeSameDirectionLine(k(t)), n = [e[0]];
1215
+ const e = this.mergeSameDirectionLine(J(t)), n = [e[0]];
1192
1216
  for (let i = 1; i < e.length; i++) {
1193
1217
  const s = e[i], o = e[(e.length + i - 1) % e.length];
1194
1218
  if (s.length() > this.width * 0.9) {
@@ -1203,7 +1227,7 @@ class X extends q {
1203
1227
  const a = e[i + 2];
1204
1228
  a && o.includedAngle(a) < 2 ? (i = i + 2, n.push(a)) : n.push(s);
1205
1229
  }
1206
- return n.length > 3 ? J(this.mergeSameDirectionLine(n)) : [];
1230
+ return n.length > 3 ? W(this.mergeSameDirectionLine(n)) : [];
1207
1231
  }
1208
1232
  /**
1209
1233
  * 移除短线段
@@ -1211,7 +1235,7 @@ class X extends q {
1211
1235
  * @param path
1212
1236
  */
1213
1237
  removeShortLine(t, e = this.shortLine) {
1214
- const n = k(t), i = [], s = Math.PI / 180;
1238
+ const n = J(t), i = [], s = Math.PI / 180;
1215
1239
  for (let o = 0; o < n.length; o++) {
1216
1240
  const r = n[o], a = r.length(), c = o;
1217
1241
  if (a > e || i.length === 0) {
@@ -1221,38 +1245,38 @@ class X extends q {
1221
1245
  let h = n[++o];
1222
1246
  const l = i[i.length - 1], d = l.direction();
1223
1247
  for (; o < n.length; ) {
1224
- const m = d.angleBetween(h.direction()) / s;
1225
- if (h.length() <= e || m < 4 || m > 176)
1248
+ const f = d.angleBetween(h.direction()) / s;
1249
+ if (h.length() <= e || f < 4 || f > 176)
1226
1250
  h = n[++o];
1227
1251
  else break;
1228
1252
  }
1229
1253
  if (!h) continue;
1230
- const f = n[o - 1];
1231
- if (l.length() > f.length()) {
1232
- const m = l.getIntersection(h);
1233
- if (m) {
1234
- const y = l.points[1].clone(), u = h.points[0].clone();
1235
- l.points[1].copy(m), h.points[0].copy(m), l.length() < this.width ? (l.points[1].copy(y), h.points[0].copy(y)) : h.length() < this.width && (l.points[1].copy(u), h.points[0].copy(u));
1254
+ const p = n[o - 1];
1255
+ if (l.length() > p.length()) {
1256
+ const f = l.getIntersection(h);
1257
+ if (f) {
1258
+ const m = l.points[1].clone(), u = h.points[0].clone();
1259
+ l.points[1].copy(f), h.points[0].copy(f), l.length() < this.width ? (l.points[1].copy(m), h.points[0].copy(m)) : h.length() < this.width && (l.points[1].copy(u), h.points[0].copy(u));
1236
1260
  } else
1237
1261
  l.points[1].copy(h.points[0]);
1238
1262
  i.push(h);
1239
1263
  } else
1240
1264
  o = c;
1241
1265
  }
1242
- return i.length > 3 ? J(i) : [];
1266
+ return i.length > 3 ? W(i) : [];
1243
1267
  }
1244
1268
  /** 线偏移
1245
1269
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
1246
1270
  */
1247
- lineOffset(t = X.EndType.etOpenSquare, e = X.JoinType.jtMiter, n = 1e4) {
1271
+ lineOffset(t = j.EndType.etOpenSquare, e = j.JoinType.jtMiter, n = 1e4) {
1248
1272
  let i = new F.Paths();
1249
1273
  const s = new F.ClipperOffset(20, 0.25);
1250
1274
  return this.pointsGroups.forEach((o) => {
1251
1275
  const r = this.lineTopology(o).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
1252
1276
  s.AddPaths(r, e, t);
1253
1277
  }), s.Execute(i, this.width / 2 * n), this.wallsGroup = i.map((o) => {
1254
- let r = o.map((a) => p.from(a).divisionScalar(n));
1255
- return r = this.lineSegmentStraightening(r), t == X.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r = this.removeShortLine(r), r;
1278
+ let r = o.map((a) => x.from(a).divisionScalar(n));
1279
+ return r = this.lineSegmentStraightening(r), t == j.EndType.etOpenSquare && (r = this.squareRemoveBurr(r)), r;
1256
1280
  }), this.dispatchEvent({
1257
1281
  type: "lineOffset",
1258
1282
  wallsGroup: this.wallsGroup
@@ -1320,8 +1344,8 @@ class X extends q {
1320
1344
  }
1321
1345
  this.wallsGroup.forEach((c) => {
1322
1346
  for (let h = 0; h < c.length; h++) {
1323
- const l = c[h], d = h === c.length - 1 ? 0 : h + 1, f = c[d];
1324
- s(l, f);
1347
+ const l = c[h], d = h === c.length - 1 ? 0 : h + 1, p = c[d];
1348
+ s(l, p);
1325
1349
  }
1326
1350
  });
1327
1351
  const r = this.width * 0.2, a = [];
@@ -1335,9 +1359,9 @@ class X extends q {
1335
1359
  h.start.clone(),
1336
1360
  h.start.clone().add(l.clone().multiplyScalar(h.length()))
1337
1361
  );
1338
- const f = d.clone().directionMove(d.normal(), h.length() * -0.5).expandToRectangle(h.length(), "bothSides");
1362
+ const p = d.clone().directionMove(d.normal(), h.length() * -0.5).expandToRectangle(h.length(), "bothSides");
1339
1363
  for (let b = 0; b < a.length; b++)
1340
- if (a[b].intersectRectangle(f)) {
1364
+ if (a[b].intersectRectangle(p)) {
1341
1365
  d = new L(
1342
1366
  h.start.clone(),
1343
1367
  h.start.clone().add(l.clone().multiplyScalar(-h.length()))
@@ -1345,15 +1369,15 @@ class X extends q {
1345
1369
  break;
1346
1370
  }
1347
1371
  d.expansion(-r * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((b, P) => s(b, P));
1348
- const m = h.length(), y = d.length(), u = (m ** 2 + y ** 2) / (2 * y), x = d.end.clone().add(d.direction().multiplyScalar(-u)), [w, S] = this.getArcAngleRange(x, h.end, d.end);
1349
- o(x, u, Math.min(w, S), Math.max(w, S)), a.push(f);
1372
+ const f = h.length(), m = d.length(), u = (f ** 2 + m ** 2) / (2 * m), y = d.end.clone().add(d.direction().multiplyScalar(-u)), [w, D] = this.getArcAngleRange(y, h.end, d.end);
1373
+ o(y, u, Math.min(w, D), Math.max(w, D)), a.push(p);
1350
1374
  } else
1351
1375
  h.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), r * 0.5).directionMove(h.direction(), r * 0.5).expansion(-h.length() * 0.45, "end").forward(r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d)), h.clone().directionMove(h.normal(), -r * 0.5).directionMove(h.direction(), -r * 0.5).expansion(-h.length() * 0.45, "start").forward(-r * 0.5).expandToRectangle(r).path2D((l, d) => s(l, d));
1352
1376
  }), i = "yellow", this.lineSegments.forEach((c) => {
1353
1377
  if (!c.userData.isWindow) return !1;
1354
1378
  Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((h) => {
1355
- const { p: l, width: d } = h, f = p.from(l), m = f.clone().add(c.direction().multiplyScalar(d * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-d * 0.5)), u = new L(m, y);
1356
- s(u.start, u.end), u.expandToRectangle(this.width, "bothSides").path2D((x, w) => s(x, w));
1379
+ const { p: l, width: d } = h, p = x.from(l), f = p.clone().add(c.direction().multiplyScalar(d * 0.5)), m = p.clone().add(c.direction().multiplyScalar(-d * 0.5)), u = new L(f, m);
1380
+ s(u.start, u.end), u.expandToRectangle(this.width, "bothSides").path2D((y, w) => s(y, w));
1357
1381
  });
1358
1382
  }), n;
1359
1383
  }
@@ -1367,7 +1391,7 @@ class X extends q {
1367
1391
  if (typeof window < "u")
1368
1392
  s = document.createElement("canvas");
1369
1393
  else if (typeof global < "u") {
1370
- const { createCanvas: c } = await G("canvas");
1394
+ const { createCanvas: c } = await Y("canvas");
1371
1395
  s = c();
1372
1396
  } else
1373
1397
  throw new Error("创建画布失败");
@@ -1378,14 +1402,14 @@ class X extends q {
1378
1402
  };
1379
1403
  s.width = i.width + o * 2, s.height = i.height + o * 2;
1380
1404
  const a = s.getContext("2d");
1381
- return n && (a.fillStyle = n, a.fillRect(0, 0, s.width, s.height)), a.translate(i.width * 0.5 + o, i.height * 0.5 + o), i.line.forEach(([c, h, l, d, f]) => {
1382
- a.strokeStyle = r[f], a.beginPath(), a.moveTo(c, h), a.lineTo(l, d), a.closePath(), a.stroke();
1383
- }), i.arc.forEach(([c, h, l, d, f, m]) => {
1384
- a.strokeStyle = r[m], a.beginPath(), a.arc(c, h, l, d * (Math.PI / 180), f * (Math.PI / 180)), a.stroke();
1405
+ return n && (a.fillStyle = n, a.fillRect(0, 0, s.width, s.height)), a.translate(i.width * 0.5 + o, i.height * 0.5 + o), i.line.forEach(([c, h, l, d, p]) => {
1406
+ a.strokeStyle = r[p], a.beginPath(), a.moveTo(c, h), a.lineTo(l, d), a.closePath(), a.stroke();
1407
+ }), i.arc.forEach(([c, h, l, d, p, f]) => {
1408
+ a.strokeStyle = r[f], a.beginPath(), a.arc(c, h, l, d * (Math.PI / 180), p * (Math.PI / 180)), a.stroke();
1385
1409
  }), a.beginPath(), i.dimensionLine.forEach((c) => {
1386
- let [h, l, d, f] = c;
1387
- const m = Math.min(l, f), y = Math.max(l, f), u = (s.width * 0.5 - 0.4 * i.scale) * (h < 0 ? -1 : 1), x = (y - m) * 0.45;
1388
- a.fillStyle = "#fff", a.font = `${0.15 * i.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.fillText((y - m).toFixed(2) + "cm", u, m + (y - m) * 0.5), a.moveTo(u - 0.1 * i.scale, m), a.lineTo(u + 0.1 * i.scale, m), a.moveTo(u, m), a.lineTo(u, x + m), a.moveTo(u, y), a.lineTo(u, y - x), a.moveTo(u - 0.1 * i.scale, y), a.lineTo(u + 0.1 * i.scale, y);
1410
+ let [h, l, d, p] = c;
1411
+ const f = Math.min(l, p), m = Math.max(l, p), u = (s.width * 0.5 - 0.4 * i.scale) * (h < 0 ? -1 : 1), y = (m - f) * 0.45;
1412
+ a.fillStyle = "#fff", a.font = `${0.15 * i.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.fillText((m - f).toFixed(2) + "cm", u, f + (m - f) * 0.5), a.moveTo(u - 0.1 * i.scale, f), a.lineTo(u + 0.1 * i.scale, f), a.moveTo(u, f), a.lineTo(u, y + f), a.moveTo(u, m), a.lineTo(u, m - y), a.moveTo(u - 0.1 * i.scale, m), a.lineTo(u + 0.1 * i.scale, m);
1389
1413
  }), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in s ? new Promise((c) => {
1390
1414
  s.toBlob((h) => {
1391
1415
  c(h);
@@ -1422,7 +1446,7 @@ class X extends q {
1422
1446
  if (typeof window < "u") {
1423
1447
  const n = this.toDxfBlob(e), i = document.createElement("a");
1424
1448
  i.href = URL.createObjectURL(n), i.download = t + ".dxf", i.click();
1425
- } else typeof global < "u" && (await G("fs", !1)).writeFileSync(t, this.toDxfString(e));
1449
+ } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, this.toDxfString(e));
1426
1450
  }
1427
1451
  /**
1428
1452
  * 下载
@@ -1434,7 +1458,7 @@ class X extends q {
1434
1458
  if (typeof window < "u") {
1435
1459
  const s = document.createElement("a");
1436
1460
  s.href = URL.createObjectURL(i), s.download = t, s.click();
1437
- } else typeof global < "u" ? (await G("fs", !1)).writeFileSync(t, i) : console.error("图片下载失败");
1461
+ } else typeof global < "u" ? (await Y("fs", !1)).writeFileSync(t, i) : console.error("图片下载失败");
1438
1462
  return !0;
1439
1463
  }
1440
1464
  /**
@@ -1442,7 +1466,7 @@ class X extends q {
1442
1466
  * @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
1443
1467
  * @returns
1444
1468
  */
1445
- computedOriginalSize(t, e = new v(0, 0, 0, 0)) {
1469
+ computedOriginalSize(t, e = new A(0, 0, 0, 0)) {
1446
1470
  const n = t.flatMap((c) => [c.start.x, c.end.x]), i = t.flatMap((c) => [c.start.y, c.end.y]), s = Math.min(...n), o = Math.min(...i), r = Math.max(...n), a = Math.max(...i);
1447
1471
  return e.set(s, o, r, a), e;
1448
1472
  }
@@ -1479,9 +1503,10 @@ function V(g) {
1479
1503
  Object.prototype.hasOwnProperty.call(g, e) && (t[e] = V(g[e]));
1480
1504
  return t;
1481
1505
  }
1482
- const I = new L();
1483
- class ot extends X {
1506
+ const C = new L();
1507
+ class ot extends j {
1484
1508
  static name = "AngleCorrectionDxf";
1509
+ angle = 0;
1485
1510
  onAddFromParent(t) {
1486
1511
  t.findComponentByName("LineAnalysis").addEventListener("analysisCompleted", async () => this.update());
1487
1512
  }
@@ -1490,27 +1515,27 @@ class ot extends X {
1490
1515
  let i = 0, s = null;
1491
1516
  for (let c = 0; c < e.originalData.length; c++) {
1492
1517
  const h = e.originalData[c];
1493
- if (I.start.copy(h.start), I.end.copy(h.end), h.isVerticalReferenceLine) {
1494
- const [l, d] = h.start.y < h.end.y ? [I.start, I.end] : [I.end, I.start];
1495
- i = -new L(l, d).direction().angleBetween(new p(0, 1), "angle", "360"), s = null;
1518
+ if (C.start.copy(h.start), C.end.copy(h.end), h.isVerticalReferenceLine) {
1519
+ const [l, d] = h.start.y < h.end.y ? [C.start, C.end] : [C.end, C.start];
1520
+ i = -new L(l, d).direction().angleBetween(new x(0, 1), "angle", "360"), s = null;
1496
1521
  break;
1497
1522
  }
1498
- (!s || I.length() > s.length()) && (s = I.clone(), s.userData.index = c);
1523
+ (!s || C.length() > s.length()) && (s = C.clone(), s.userData.index = c);
1499
1524
  }
1500
1525
  if (s) {
1501
1526
  e.originalData[s.userData.index].isVerticalReferenceLine = !0;
1502
1527
  const [c, h] = s.start.y < s.end.y ? [s.start, s.end] : [s.end, s.start];
1503
- i = -new L(c, h).direction().angleBetween(new p(0, 1), "angle", "360");
1528
+ i = -new L(c, h).direction().angleBetween(new x(0, 1), "angle", "360");
1504
1529
  }
1505
- const o = e.originalBox.center, r = p.zero(), a = e.originalData.map((c) => {
1506
- const h = r.copy(c.start).division(o).rotate(p.zero(), i * (Math.PI / 180)).toJson(c.start.z), l = r.copy(c.end).division(o).rotate(p.zero(), i * (Math.PI / 180)).toJson(c.end.z), d = Object.assign(V(c), { start: h, end: l });
1507
- return d.drawWindow && d.drawWindow.forEach((f) => {
1508
- f.p = r.copy(f.p).division(o).rotate(p.zero(), i * (Math.PI / 180)).toJson(f.p.z), f.p.y = -f.p.y;
1530
+ const o = e.originalBox.center, r = x.zero(), a = e.originalData.map((c) => {
1531
+ const h = r.copy(c.start).division(o).rotate(x.zero(), i * (Math.PI / 180)).toJson(c.start.z), l = r.copy(c.end).division(o).rotate(x.zero(), i * (Math.PI / 180)).toJson(c.end.z), d = Object.assign(V(c), { start: h, end: l });
1532
+ return d.drawWindow && d.drawWindow.forEach((p) => {
1533
+ p.p = r.copy(p.p).division(o).rotate(x.zero(), i * (Math.PI / 180)).toJson(p.p.z), p.p.y = -p.p.y;
1509
1534
  }), d;
1510
1535
  });
1511
1536
  n.appendLineSegmentList.forEach((c) => {
1512
1537
  const h = c.clone();
1513
- h.start.division(o).rotate(p.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(p.zero(), i * (Math.PI / 180)), a.push({
1538
+ h.start.division(o).rotate(x.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(x.zero(), i * (Math.PI / 180)), a.push({
1514
1539
  start: h.start.toJson(e.originalZAverage),
1515
1540
  end: h.end.toJson(e.originalZAverage),
1516
1541
  insetionArr: [],
@@ -1520,11 +1545,13 @@ class ot extends X {
1520
1545
  c.start.y = -c.start.y, c.end.y = -c.end.y;
1521
1546
  }), await this.set(a, e.width, e.scale), this.lineOffset(), this.doorLineSegment = e.doorLineSegment.map((c) => {
1522
1547
  const h = c.clone();
1523
- return h.start.division(o).rotate(p.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(p.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1548
+ return h.start.division(o).rotate(x.zero(), i * (Math.PI / 180)), h.end.division(o).rotate(x.zero(), i * (Math.PI / 180)), h.start.y = -h.start.y, h.end.y = -h.end.y, h;
1549
+ }), this.angle = i, this.dispatchEvent({
1550
+ type: "updateData"
1524
1551
  });
1525
1552
  }
1526
1553
  }
1527
- class _ extends q {
1554
+ class H extends G {
1528
1555
  static name = "Variable";
1529
1556
  originalLineVisible = !0;
1530
1557
  dxfVisible = !0;
@@ -1551,7 +1578,7 @@ class _ extends q {
1551
1578
  if (t in this) return this[t];
1552
1579
  }
1553
1580
  }
1554
- class j {
1581
+ class q {
1555
1582
  bounds;
1556
1583
  // 包围盒
1557
1584
  capacity;
@@ -1617,23 +1644,23 @@ class j {
1617
1644
  if (!this.isLeaf) return;
1618
1645
  this.isLeaf = !1, this.children = [];
1619
1646
  const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
1620
- this.children[0] = new j(
1621
- new v(this.bounds.minX, t, this.bounds.minY, e),
1647
+ this.children[0] = new q(
1648
+ new A(this.bounds.minX, t, this.bounds.minY, e),
1622
1649
  this.capacity,
1623
1650
  this.maxDepth,
1624
1651
  this.depth + 1
1625
- ), this.children[1] = new j(
1626
- new v(t, this.bounds.maxX, this.bounds.minY, e),
1652
+ ), this.children[1] = new q(
1653
+ new A(t, this.bounds.maxX, this.bounds.minY, e),
1627
1654
  this.capacity,
1628
1655
  this.maxDepth,
1629
1656
  this.depth + 1
1630
- ), this.children[2] = new j(
1631
- new v(this.bounds.minX, t, e, this.bounds.maxY),
1657
+ ), this.children[2] = new q(
1658
+ new A(this.bounds.minX, t, e, this.bounds.maxY),
1632
1659
  this.capacity,
1633
1660
  this.maxDepth,
1634
1661
  this.depth + 1
1635
- ), this.children[3] = new j(
1636
- new v(t, this.bounds.maxX, e, this.bounds.maxY),
1662
+ ), this.children[3] = new q(
1663
+ new A(t, this.bounds.maxX, e, this.bounds.maxY),
1637
1664
  this.capacity,
1638
1665
  this.maxDepth,
1639
1666
  this.depth + 1
@@ -1662,7 +1689,7 @@ class j {
1662
1689
  * @returns 相交的节点数组
1663
1690
  */
1664
1691
  queryCircle(t, e) {
1665
- const n = [], i = new v(
1692
+ const n = [], i = new A(
1666
1693
  t.x - e,
1667
1694
  t.x + e,
1668
1695
  t.y - e,
@@ -1674,8 +1701,8 @@ class j {
1674
1701
  const [o, r] = s.line.points, a = r.x - o.x, c = r.y - o.y, h = a * a + c * c;
1675
1702
  let l = ((t.x - o.x) * a + (t.y - o.y) * c) / h;
1676
1703
  l = Math.max(0, Math.min(1, l));
1677
- const d = o.x + l * a, f = o.y + l * c;
1678
- t.distance(new p(d, f)) <= e && n.push(s);
1704
+ const d = o.x + l * a, p = o.y + l * c;
1705
+ t.distance(new x(d, p)) <= e && n.push(s);
1679
1706
  }
1680
1707
  if (!this.isLeaf)
1681
1708
  for (const s of this.children)
@@ -1727,7 +1754,7 @@ class j {
1727
1754
  })), t;
1728
1755
  }
1729
1756
  }
1730
- class U {
1757
+ class k {
1731
1758
  map = /* @__PURE__ */ new Map();
1732
1759
  gridSize;
1733
1760
  constructor(t = 2) {
@@ -1758,7 +1785,7 @@ class U {
1758
1785
  * @param point
1759
1786
  */
1760
1787
  remove(t) {
1761
- const { set: e, target: n } = t?.userData?.pointVirtualGrid;
1788
+ const { set: e, target: n } = t?.userData?.pointVirtualGrid ?? {};
1762
1789
  e && (e.delete(n), delete t?.userData?.pointVirtualGridMap);
1763
1790
  }
1764
1791
  /**
@@ -1777,7 +1804,7 @@ class U {
1777
1804
  */
1778
1805
  decodeGridId(t) {
1779
1806
  const [e, n] = t.split(".").map(Number);
1780
- return new p(e, n);
1807
+ return new x(e, n);
1781
1808
  }
1782
1809
  /**
1783
1810
  * 查询与矩形相交的点
@@ -1802,13 +1829,13 @@ class U {
1802
1829
  * @returns 相交的节点数组
1803
1830
  */
1804
1831
  queryCircle(t, e) {
1805
- const n = new v(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), s = Math.ceil(n.maxX / this.gridSize), o = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), a = [];
1832
+ const n = new A(t.x - e, t.x + e, t.y - e, t.y + e), i = Math.ceil(n.minX / this.gridSize), s = Math.ceil(n.maxX / this.gridSize), o = Math.ceil(n.minY / this.gridSize), r = Math.ceil(n.maxY / this.gridSize), a = [];
1806
1833
  for (let c = i; c <= s; c++)
1807
1834
  for (let h = o; h <= r; h++) {
1808
1835
  const l = `${c}.${h}`;
1809
1836
  if (!this.map.has(l)) continue;
1810
- this.map.get(l)?.forEach((f) => {
1811
- t.distance(f.point) <= e && a.push(f);
1837
+ this.map.get(l)?.forEach((p) => {
1838
+ t.distance(p.point) <= e && a.push(p);
1812
1839
  });
1813
1840
  }
1814
1841
  return a;
@@ -1854,7 +1881,7 @@ class rt {
1854
1881
  doorPoint = [];
1855
1882
  dxf;
1856
1883
  // 包含所有点的虚拟网格
1857
- pointVirtualGrid = new U();
1884
+ pointVirtualGrid = new k();
1858
1885
  // 只包含可查找点的虚拟网格
1859
1886
  findPointVirtualGrid;
1860
1887
  quadtree;
@@ -1867,7 +1894,7 @@ class rt {
1867
1894
  lineAnalysis;
1868
1895
  continueFind = !0;
1869
1896
  constructor(t) {
1870
- if (this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new U(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
1897
+ if (this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new k(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
1871
1898
  this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
1872
1899
  }), this.doorPoint = this.getDoorPoint(), !this.continueFind) return;
1873
1900
  const e = this.searchDoubleLinePoint();
@@ -1899,13 +1926,13 @@ class rt {
1899
1926
  return r.forEach((c) => {
1900
1927
  const h = new L(c?.start, c?.end), l = h.length();
1901
1928
  if (l < n) return;
1902
- const d = h.normal(), f = h.direction(), m = (l - o.width * 2) / 2;
1903
- for (let y = 0; y < 3; y++) {
1904
- const u = h.start.clone().add(f.clone().multiplyScalar(o.width + m * y)), x = new L(
1929
+ const d = h.normal(), p = h.direction(), f = (l - o.width * 2) / 2;
1930
+ for (let m = 0; m < 3; m++) {
1931
+ const u = h.start.clone().add(p.clone().multiplyScalar(o.width + f * m)), y = new L(
1905
1932
  u,
1906
1933
  u.clone().add(d.clone().multiplyScalar(1))
1907
1934
  );
1908
- if (x.directionMove(d, -0.5), this.quadtree.queryLineSegment(x).length) return;
1935
+ if (y.directionMove(d, -0.5), this.quadtree.queryLineSegment(y).length) return;
1909
1936
  }
1910
1937
  a.push(h);
1911
1938
  }), a;
@@ -1925,7 +1952,7 @@ class rt {
1925
1952
  return this.lineSegments.forEach((e) => {
1926
1953
  e.points.forEach((n, i) => {
1927
1954
  for (let o = 0; o < this._pointsExcludeRule.length; o++) if (this._pointsExcludeRule[o](e, n, i)) return;
1928
- this.pointVirtualGrid.queryPoint(n).filter((o) => o.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: N() });
1955
+ this.pointVirtualGrid.queryPoint(n).filter((o) => o.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: O() });
1929
1956
  });
1930
1957
  }), t;
1931
1958
  }
@@ -1937,21 +1964,21 @@ class rt {
1937
1964
  return e.doors.forEach((i) => {
1938
1965
  const s = e.lineSegments[i[4]], o = e.originalData[i[4]];
1939
1966
  if (o.drawDoorData) {
1940
- const r = p.from(o.drawDoorData.start), a = p.from(o.drawDoorData.n), c = n.queryPoint(r).filter((h) => {
1967
+ const r = x.from(o.drawDoorData.start), a = x.from(o.drawDoorData.n), c = n.queryPoint(r).filter((h) => {
1941
1968
  if (h.userData === s) return !1;
1942
1969
  const l = h.userData, d = l.direction();
1943
1970
  l.start.equal(r) && d.multiplyScalar(-1);
1944
- const f = a.angleBetween(d, "angle");
1945
- return f > 80 || f < 10;
1971
+ const p = a.angleBetween(d, "angle");
1972
+ return p > 80 || p < 10;
1946
1973
  });
1947
1974
  c.length && t.push({
1948
1975
  line: c[0].userData,
1949
1976
  point: r,
1950
- uuid: N()
1977
+ uuid: O()
1951
1978
  });
1952
1979
  } else if (o.doorDirectConnection) {
1953
1980
  this.continueFind = !1;
1954
- const r = new L(p.from(o.start), p.from(o.end));
1981
+ const r = new L(x.from(o.start), x.from(o.end));
1955
1982
  r.userData = {
1956
1983
  doorDirectConnection: !0,
1957
1984
  isDoor: !0
@@ -1981,48 +2008,48 @@ class rt {
1981
2008
  */
1982
2009
  searchNearby(t, e = [], n = this.doorSearchDistance, i = this.doorSearchNearAngle) {
1983
2010
  const s = this.findPointVirtualGrid, o = this.quadtree;
1984
- function r({ point: u, line: x }, w, S) {
1985
- const b = x.direction();
1986
- x.start === u && b.multiplyScalar(-1);
1987
- const P = s.queryCircle(u, n).filter((D) => D.userData !== x).sort((D, E) => D.point.distance(u) - E.point.distance(u)), A = [];
1988
- for (let D = 0; D < P.length; D++) {
1989
- const E = e.findIndex((T) => T.point === P[D].point), B = t[w].uuid, Y = e[E].uuid;
1990
- if (S.has(`${B}.${Y}`)) continue;
1991
- S.add(`${B}.${Y}`), S.add(`${Y}.${B}`);
1992
- const Q = P[D].point, C = new L(u.clone(), Q.clone());
1993
- if (C.direction().angleBetween(b, "angle") < i) {
2011
+ function r({ point: u, line: y }, w, D) {
2012
+ const b = y.direction();
2013
+ y.start === u && b.multiplyScalar(-1);
2014
+ const P = s.queryCircle(u, n).filter((S) => S.userData !== y).sort((S, E) => S.point.distance(u) - E.point.distance(u)), v = [];
2015
+ for (let S = 0; S < P.length; S++) {
2016
+ const E = e.findIndex((T) => T.point === P[S].point), B = t[w].uuid, I = e[E].uuid;
2017
+ if (D.has(`${B}.${I}`)) continue;
2018
+ D.add(`${B}.${I}`), D.add(`${I}.${B}`);
2019
+ const Q = P[S].point, X = new L(u.clone(), Q.clone());
2020
+ if (X.direction().angleBetween(b, "angle") < i) {
1994
2021
  const T = t[E].line.direction();
1995
- P[D].userData.start.equal(P[D].point) && T.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(T, "angle") < i && (o.queryLineSegment(C).length || A.push({
1996
- findData: P[D],
1997
- findUuid: Y,
1998
- doorLine: C,
2022
+ P[S].userData.start.equal(P[S].point) && T.multiplyScalar(-1), X.direction().multiplyScalar(-1).angleBetween(T, "angle") < i && (o.queryLineSegment(X).length || v.push({
2023
+ findData: P[S],
2024
+ findUuid: I,
2025
+ doorLine: X,
1999
2026
  doorUuid: B
2000
2027
  }));
2001
2028
  }
2002
2029
  }
2003
- return A;
2030
+ return v;
2004
2031
  }
2005
- function a(u, x, w, S, b) {
2006
- S.add(u);
2032
+ function a(u, y, w, D, b) {
2033
+ D.add(u);
2007
2034
  const P = [];
2008
2035
  b && P.push(b);
2009
- for (let A = 0; A < w.length; A++) {
2010
- const D = w[A];
2011
- if (x.has(D.findUuid)) {
2012
- const E = x.get(D.findUuid);
2013
- a(D.findUuid, x, E, S, D) && P.push(D);
2014
- } else P.push(D);
2036
+ for (let v = 0; v < w.length; v++) {
2037
+ const S = w[v];
2038
+ if (y.has(S.findUuid)) {
2039
+ const E = y.get(S.findUuid);
2040
+ a(S.findUuid, y, E, D, S) && P.push(S);
2041
+ } else P.push(S);
2015
2042
  }
2016
- return P.sort((A, D) => A.doorLine.length() - D.doorLine.length()), b && P[0] === b ? (w.splice(0), !0) : (w.splice(1), !1);
2043
+ return P.sort((v, S) => v.doorLine.length() - S.doorLine.length()), b && P[0] === b ? (w.splice(0), !0) : (w.splice(1), !1);
2017
2044
  }
2018
2045
  const c = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
2019
- t.map((u, x) => {
2020
- const w = r(u, x, c);
2046
+ t.map((u, y) => {
2047
+ const w = r(u, y, c);
2021
2048
  w.length && h.set(u.uuid, w);
2022
2049
  }), c.clear();
2023
2050
  const l = /* @__PURE__ */ new Map();
2024
- h.forEach((u, x) => {
2025
- if (!c.has(x) && u.length && a(x, h, u, c), u.length) {
2051
+ h.forEach((u, y) => {
2052
+ if (!c.has(y) && u.length && a(y, h, u, c), u.length) {
2026
2053
  const w = u[0];
2027
2054
  l.has(w.doorUuid) || l.set(w.doorUuid, []), l.get(w.doorUuid)?.push(w), l.has(w.findUuid) || l.set(w.findUuid, []), l.get(w.findUuid)?.push(w);
2028
2055
  }
@@ -2030,45 +2057,45 @@ class rt {
2030
2057
  const d = /* @__PURE__ */ new Set();
2031
2058
  l.forEach((u) => {
2032
2059
  if (u.length > 1) {
2033
- u.sort((x, w) => x.doorLine.length() - w.doorLine.length());
2034
- for (let x = 1; x < u.length; x++) d.add(u[x]);
2060
+ u.sort((y, w) => y.doorLine.length() - w.doorLine.length());
2061
+ for (let y = 1; y < u.length; y++) d.add(u[y]);
2035
2062
  }
2036
2063
  });
2037
- const f = [], m = [];
2064
+ const p = [], f = [];
2038
2065
  h.forEach((u) => {
2039
2066
  if (u.length) {
2040
- const x = u[0];
2041
- d.has(x) || (f.push(x), m.push(x.doorUuid, x.findUuid));
2067
+ const y = u[0];
2068
+ d.has(y) || (p.push(y), f.push(y.doorUuid, y.findUuid));
2042
2069
  }
2043
2070
  });
2044
- const y = [];
2045
- return f.forEach((u) => {
2046
- const x = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), S = t[x].point.clone(), b = e[w].point.clone(), P = this.findLongLineSegment(t[x].line), A = this.findLongLineSegment(e[w].line), D = P.projectPoint(b);
2047
- if (D) {
2048
- S.copy(D);
2049
- const E = new L(S, b), B = A.includedAngle(E);
2050
- (B < 10 || B > 170 || Math.abs(90 - B) < 10) && y.push({
2051
- start: S,
2071
+ const m = [];
2072
+ return p.forEach((u) => {
2073
+ const y = t.findIndex((E) => E.uuid === u.doorUuid), w = e.findIndex((E) => E.uuid === u.findUuid), D = t[y].point.clone(), b = e[w].point.clone(), P = this.findLongLineSegment(t[y].line), v = this.findLongLineSegment(e[w].line), S = P.projectPoint(b);
2074
+ if (S) {
2075
+ D.copy(S);
2076
+ const E = new L(D, b), B = v.includedAngle(E);
2077
+ (B < 10 || B > 170 || Math.abs(90 - B) < 10) && m.push({
2078
+ start: D,
2052
2079
  end: b
2053
2080
  });
2054
2081
  } else {
2055
- const E = A.projectPoint(S);
2082
+ const E = v.projectPoint(D);
2056
2083
  E && b.copy(E);
2057
- const B = new L(S, b), Y = P.includedAngle(B);
2058
- (Y < 10 || Y > 170 || Math.abs(90 - Y) < 10) && y.push({
2059
- start: S,
2084
+ const B = new L(D, b), I = P.includedAngle(B);
2085
+ (I < 10 || I > 170 || Math.abs(90 - I) < 10) && m.push({
2086
+ start: D,
2060
2087
  end: b
2061
2088
  });
2062
2089
  }
2063
2090
  }), e.splice(
2064
2091
  0,
2065
2092
  e.length,
2066
- ...e.filter((u) => m.indexOf(u.uuid) === -1)
2093
+ ...e.filter((u) => f.indexOf(u.uuid) === -1)
2067
2094
  ), t.splice(
2068
2095
  0,
2069
2096
  t.length,
2070
- ...t.filter((u) => m.indexOf(u.uuid) === -1)
2071
- ), y;
2097
+ ...t.filter((u) => f.indexOf(u.uuid) === -1)
2098
+ ), m;
2072
2099
  }
2073
2100
  /** 方案二: 沿方向查找
2074
2101
  * @description
@@ -2099,8 +2126,8 @@ class rt {
2099
2126
  e.start === t && o.multiplyScalar(-1), e.start === t && a.copy(e.end);
2100
2127
  const c = i.queryPoint(a).filter((d) => d.userData !== e);
2101
2128
  for (let d = 0; d < c.length; d++) {
2102
- const f = c[d], m = f.userData, y = m.direction();
2103
- if (m.start === f.point && o.multiplyScalar(-1), y.angleBetween(r) / (Math.PI / 180) > 90) {
2129
+ const p = c[d], f = p.userData, m = f.direction();
2130
+ if (f.start === p.point && o.multiplyScalar(-1), m.angleBetween(r) / (Math.PI / 180) > 90) {
2104
2131
  r.multiplyScalar(-1);
2105
2132
  break;
2106
2133
  }
@@ -2108,7 +2135,7 @@ class rt {
2108
2135
  const h = new L(t.clone(), t.clone().add(r.multiplyScalar(n))), l = s.queryLineSegment(h).map((d) => ({
2109
2136
  point: d.line.getIntersection(h),
2110
2137
  line: d.line
2111
- })).filter((d) => d.point).sort((d, f) => t.distance(d.point) - t.distance(f.point));
2138
+ })).filter((d) => d.point).sort((d, p) => t.distance(d.point) - t.distance(p.point));
2112
2139
  if (l.length) {
2113
2140
  const d = l[0];
2114
2141
  if (Math.abs(90 - d.line.direction().angleBetween(r, "angle")) < 5)
@@ -2139,7 +2166,7 @@ class rt {
2139
2166
  return e;
2140
2167
  }
2141
2168
  }
2142
- class at extends q {
2169
+ class at extends G {
2143
2170
  static name = "LineAnalysis";
2144
2171
  Dxf = null;
2145
2172
  Variable = null;
@@ -2153,7 +2180,7 @@ class at extends q {
2153
2180
  * @param parent
2154
2181
  */
2155
2182
  onAddFromParent(t) {
2156
- this.Dxf = t.findComponentByType(X), this.Variable = this.parent?.findComponentByType(_), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2183
+ this.Dxf = t.findComponentByType(j), this.Variable = this.parent?.findComponentByType(H), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2157
2184
  }
2158
2185
  /**
2159
2186
  *
@@ -2167,11 +2194,11 @@ class at extends q {
2167
2194
  return {
2168
2195
  points: [
2169
2196
  // 第一条线
2170
- new p(t.x + r, t.y + a).add(o),
2171
- new p(e.x + r, e.y + a).add(s),
2197
+ new x(t.x + r, t.y + a).add(o),
2198
+ new x(e.x + r, e.y + a).add(s),
2172
2199
  // 第二条线
2173
- new p(t.x - r, t.y - a).add(o),
2174
- new p(e.x - r, e.y - a).add(s)
2200
+ new x(t.x - r, t.y - a).add(o),
2201
+ new x(e.x - r, e.y - a).add(s)
2175
2202
  ],
2176
2203
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2177
2204
  rectIndices: [0, 1, 3, 2, 0]
@@ -2193,14 +2220,14 @@ class at extends q {
2193
2220
  createRectangle(t) {
2194
2221
  const e = this.Dxf, n = t.project, i = t.project2;
2195
2222
  n.includedAngle(i) > 135 && (i.points = [i.points[1], i.points[0]]), this.addData(n.points[0], i.points[0]), this.addData(n.points[1], i.points[1]);
2196
- const s = n.points[0].distance(i.points[0]), o = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(s, o) / e.width), a = s / r, c = o / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), f = n.points[1].clone(), m = f.direction(d);
2197
- m.multiplyScalar(e.width * 0.5);
2198
- const y = d.clone().add(m), u = f.clone().add(m.multiplyScalar(-1)), x = d.direction(f), w = y.direction(u);
2199
- if (!(x.x > 0 && w.x < 0 || x.x < 0 && w.x > 0 || x.y > 0 && w.y < 0 || x.y < 0 && w.y > 0)) {
2200
- d.set(y.x, y.y), f.set(u.x, u.y);
2201
- for (let S = 1; S < r; S++) {
2202
- const b = h.clone().multiplyScalar(a * S), P = l.clone().multiplyScalar(c * S), A = d.clone().add(b), D = f.clone().add(P);
2203
- this.addData(A, D);
2223
+ const s = n.points[0].distance(i.points[0]), o = n.points[1].distance(i.points[1]), r = Math.ceil(Math.max(s, o) / e.width), a = s / r, c = o / r, h = i.points[0].direction(n.points[0]), l = i.points[1].direction(n.points[1]), d = n.points[0].clone(), p = n.points[1].clone(), f = p.direction(d);
2224
+ f.multiplyScalar(e.width * 0.5);
2225
+ const m = d.clone().add(f), u = p.clone().add(f.multiplyScalar(-1)), y = d.direction(p), w = m.direction(u);
2226
+ if (!(y.x > 0 && w.x < 0 || y.x < 0 && w.x > 0 || y.y > 0 && w.y < 0 || y.y < 0 && w.y > 0)) {
2227
+ d.set(m.x, m.y), p.set(u.x, u.y);
2228
+ for (let D = 1; D < r; D++) {
2229
+ const b = h.clone().multiplyScalar(a * D), P = l.clone().multiplyScalar(c * D), v = d.clone().add(b), S = p.clone().add(P);
2230
+ this.addData(v, S);
2204
2231
  }
2205
2232
  }
2206
2233
  }
@@ -2210,7 +2237,7 @@ class at extends q {
2210
2237
  */
2211
2238
  buildQuadtree() {
2212
2239
  const t = this.Dxf, e = [];
2213
- this.quadtree = new j(t.originalBox, 2), t.lineSegments.forEach((n) => {
2240
+ this.quadtree = new q(t.originalBox, 2), t.lineSegments.forEach((n) => {
2214
2241
  n.userData?.isDoor || (this.quadtree?.insert({
2215
2242
  line: n,
2216
2243
  userData: e.length
@@ -2227,7 +2254,7 @@ class at extends q {
2227
2254
  this.buildQuadtree();
2228
2255
  const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), i = [];
2229
2256
  e.forEach((s, o) => {
2230
- const r = e[o], a = O.fromByLineSegment(r, this.width * 2, !1, -0.01);
2257
+ const r = e[o], a = N.fromByLineSegment(r, this.width * 2, !1, -0.01);
2231
2258
  t.queryRect(a).map((h) => h.userData).filter((h) => h !== o).forEach((h) => {
2232
2259
  try {
2233
2260
  if (n.has(`${o}-${h}`) || n.has(`${h}-${o}`)) return;
@@ -2269,13 +2296,139 @@ class at extends q {
2269
2296
  doorSearchNearAngle = 110;
2270
2297
  doorSearchDistance = 2;
2271
2298
  doors = [];
2299
+ DoorsAnalysis;
2272
2300
  doorsAnalysis() {
2273
- new rt(this), this.dispatchEvent({
2301
+ this.DoorsAnalysis = new rt(this), this.dispatchEvent({
2274
2302
  type: "analysisCompleted"
2275
2303
  });
2276
2304
  }
2277
2305
  }
2278
- class ct extends it {
2306
+ class ct extends G {
2307
+ static name = "ThreeVJia";
2308
+ lineSegments = [];
2309
+ onAddFromParent() {
2310
+ (this.parent?.findComponentByName("AngleCorrectionDxf")).addEventListener("updateData", async () => this.updateData());
2311
+ }
2312
+ updateData() {
2313
+ const t = this.parent?.findComponentByName("LineAnalysis"), e = this.parent?.findComponentByName("Dxf");
2314
+ this.parent?.findComponentByName("Renderer");
2315
+ const n = this.parent?.findComponentByName("AngleCorrectionDxf"), i = /* @__PURE__ */ new Map();
2316
+ let s = [...e.lineSegments], o = [], r = [];
2317
+ t.resultList.forEach((h) => {
2318
+ const l = i.get(h.target) ?? [], d = i.get(h.source) ?? [], p = h.project.clone(), f = h.project2.clone();
2319
+ p.includedAngle(f) > 135 && (f.points = [f.points[1], f.points[0]]), l.push(...p.points), d.push(...f.points), i.set(h.target, l), i.set(h.source, d);
2320
+ const m = new L(p.start, f.start), u = new L(p.end, f.end), y = new L(m.center, u.center);
2321
+ y.userData.wallWidth = Math.max(m.length(), u.length()), o.push(y);
2322
+ });
2323
+ const a = [];
2324
+ s = s.filter((h) => {
2325
+ if (r.indexOf(h) > -1) return !1;
2326
+ if (i.has(h)) {
2327
+ const l = i.get(h), d = h.clone();
2328
+ if (l) {
2329
+ for (let f = 0; f < l.length; f += 2) {
2330
+ const m = l[f], u = l[f + 1];
2331
+ m.userData.length = m.distance(d.start), u.userData.length = u.distance(d.start), m.userData.type = "start", u.userData.type = "end", d.start.distance(m) > d.start.distance(u) && (l[f] = u, l[f + 1] = m, m.userData.type = "end", u.userData.type = "start");
2332
+ }
2333
+ l.sort((f, m) => f.userData.length - m.userData.length);
2334
+ const p = [];
2335
+ for (let f = 0; f < l.length; f++) {
2336
+ const m = l[f];
2337
+ m.userData.type === "start" ? (p.length === 0 && (a.push(new L(d.start.clone(), m.clone())), d.start.copy(m)), p.push("start")) : (p.pop(), p.length === 0 && d.start.copy(m));
2338
+ }
2339
+ a.push(d);
2340
+ }
2341
+ return !1;
2342
+ }
2343
+ return !0;
2344
+ }), s.push(...o), s.push(...a.filter((h) => h.length() > 0.05));
2345
+ const c = e.box.center;
2346
+ s = s.map((h) => {
2347
+ const l = h.clone();
2348
+ return l.start.rotate(c, n.angle * (Math.PI / 180)), l.end.rotate(c, n.angle * (Math.PI / 180)), l;
2349
+ }), this.lineSegments = s;
2350
+ }
2351
+ toJson() {
2352
+ const e = /* @__PURE__ */ new Map();
2353
+ let n = 0;
2354
+ return {
2355
+ version: "2",
2356
+ name: "测试",
2357
+ communityName: "测试",
2358
+ city: "",
2359
+ province: "",
2360
+ height: 2.8,
2361
+ walls: this.lineSegments.map((i) => {
2362
+ if (!(i.userData.isDoor && !i.userData.doorDirectConnection))
2363
+ return e.set(i, n), {
2364
+ ID: n++,
2365
+ start: { x: i.start.x * 1, y: i.start.y * 1 },
2366
+ end: { x: i.end.x * 1, y: i.end.y * 1 },
2367
+ thickness: (i.userData.wallWidth ? i.userData.wallWidth : 0.12) * 1,
2368
+ type: "LINE",
2369
+ loadBearingWall: !1,
2370
+ height: 2.8 * 1
2371
+ };
2372
+ }).filter((i) => !!i),
2373
+ pillars: [],
2374
+ beams: [],
2375
+ holes: this.lineSegments.flatMap((i) => {
2376
+ if (i.userData.isDoor && i.userData.doorDirectConnection)
2377
+ return {
2378
+ id: n++,
2379
+ type: "DOOR",
2380
+ openSide: "RIGHT",
2381
+ start: {
2382
+ x: i.start.x * 1,
2383
+ y: i.start.y * 1
2384
+ },
2385
+ end: {
2386
+ x: i.end.x * 1,
2387
+ y: i.end.y * 1
2388
+ },
2389
+ height: 2.1 * 1,
2390
+ qroundClearance: 0,
2391
+ sillHeight: 0
2392
+ };
2393
+ if (i.userData.isWindow)
2394
+ return i.userData.drawWindow.map((s) => {
2395
+ const o = x.from(s.p), r = o.clone().add(
2396
+ i.direction().multiplyScalar(s.width * 0.5)
2397
+ ), a = o.clone().add(
2398
+ i.direction().multiplyScalar(-s.width * 0.5)
2399
+ );
2400
+ return {
2401
+ id: n++,
2402
+ type: "WINDOW",
2403
+ start: {
2404
+ x: r.x * 1,
2405
+ y: r.y * 1
2406
+ },
2407
+ end: {
2408
+ x: a.x * 1,
2409
+ y: a.y * 1
2410
+ },
2411
+ height: 1.6 * 1,
2412
+ groundClearance: 0.9 * 1,
2413
+ sillHeiqht: 0.9 * 1
2414
+ };
2415
+ });
2416
+ }).filter((i) => !!i),
2417
+ rooms: []
2418
+ };
2419
+ }
2420
+ /**
2421
+ * 下载
2422
+ * @param filename
2423
+ */
2424
+ async download(t = "download.json") {
2425
+ if (typeof window < "u") {
2426
+ const e = new Blob([JSON.stringify(this.toJson())]), n = document.createElement("a");
2427
+ n.href = URL.createObjectURL(e), n.download = t, n.click();
2428
+ } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
2429
+ }
2430
+ }
2431
+ class ht extends it {
2279
2432
  Dxf;
2280
2433
  AngleCorrectionDxf;
2281
2434
  Variable;
@@ -2286,7 +2439,7 @@ class ct extends it {
2286
2439
  * @param scale 原始数据缩放比例
2287
2440
  */
2288
2441
  constructor(t = 0.1, e = 1) {
2289
- super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new X(this.wallWidth, e), this.AngleCorrectionDxf = new ot(), this.Variable = new _(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new at()), this.addComponent(this.AngleCorrectionDxf);
2442
+ super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new j(this.wallWidth, e), this.AngleCorrectionDxf = new ot(), this.Variable = new H(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new at()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new ct());
2290
2443
  }
2291
2444
  usePlugin(t) {
2292
2445
  return typeof t == "function" && t.call(this, this), this;
@@ -2299,23 +2452,23 @@ class ct extends it {
2299
2452
  });
2300
2453
  }
2301
2454
  }
2302
- const ht = new et(), lt = new nt();
2303
- function dt(g, t, e = 0.1) {
2455
+ const lt = new et(), dt = new nt();
2456
+ function ut(g, t, e = 0.1) {
2304
2457
  const n = t.normal(g), i = t.direction(g).mutiplyScalar(e * 0.5), s = g.direction(t).mutiplyScalar(e * 0.5), o = n.x * e * 0.5, r = n.y * e * 0.5;
2305
2458
  return {
2306
2459
  points: [
2307
2460
  // 第一条线
2308
- new p(g.x + o, g.y + r).add(s),
2309
- new p(t.x + o, t.y + r).add(i),
2461
+ new x(g.x + o, g.y + r).add(s),
2462
+ new x(t.x + o, t.y + r).add(i),
2310
2463
  // 第二条线
2311
- new p(g.x - o, g.y - r).add(s),
2312
- new p(t.x - o, t.y - r).add(i)
2464
+ new x(g.x - o, g.y - r).add(s),
2465
+ new x(t.x - o, t.y - r).add(i)
2313
2466
  ],
2314
2467
  indices: [0, 1, 1, 3, 3, 2, 2, 0],
2315
2468
  rectIndices: [0, 1, 3, 2, 0]
2316
2469
  };
2317
2470
  }
2318
- class H extends q {
2471
+ class _ extends G {
2319
2472
  static name = "WhiteModel";
2320
2473
  Dxf = null;
2321
2474
  Variable = null;
@@ -2345,7 +2498,7 @@ class H extends q {
2345
2498
  new M.LineSegments(new M.EdgesGeometry(s), new M.LineBasicMaterial({ color: 0 }))
2346
2499
  );
2347
2500
  }), t.originalData.map(({ start: n, end: i, insetionArr: s }) => {
2348
- const o = new p(n.x, n.y).mutiplyScalar(t.scale), r = new p(i.x, i.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: h } = dt(o, r, t.width);
2501
+ const o = new x(n.x, n.y).mutiplyScalar(t.scale), r = new x(i.x, i.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: h } = ut(o, r, t.width);
2349
2502
  return {
2350
2503
  points: a,
2351
2504
  indices: c,
@@ -2378,7 +2531,7 @@ class H extends q {
2378
2531
  toOBJ() {
2379
2532
  return new Promise((t) => {
2380
2533
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
2381
- t(ht.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
2534
+ t(lt.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
2382
2535
  }, 20);
2383
2536
  });
2384
2537
  }
@@ -2391,7 +2544,7 @@ class H extends q {
2391
2544
  return new Promise((e) => {
2392
2545
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
2393
2546
  if (typeof window == "object")
2394
- lt.parse(this.whiteModelGroup.children, (n) => {
2547
+ dt.parse(this.whiteModelGroup.children, (n) => {
2395
2548
  e(n), this.material.opacity = 0.8, this.material.transparent = !0;
2396
2549
  }, () => {
2397
2550
  e(void 0);
@@ -2400,7 +2553,7 @@ class H extends q {
2400
2553
  });
2401
2554
  else if (typeof global != "function")
2402
2555
  try {
2403
- const n = await G("obj2gltf", !0), i = await G("fs", !1), s = await this.toOBJ(), o = Date.now().toString(16) + "-" + Math.floor(Math.random() * 16777215).toString(16);
2556
+ const n = await Y("obj2gltf", !0), i = await Y("fs", !1), s = await this.toOBJ(), o = Date.now().toString(16) + "-" + Math.floor(Math.random() * 16777215).toString(16);
2404
2557
  i.writeFileSync(o, s ?? "存贮失败");
2405
2558
  const r = await n(o, {
2406
2559
  binary: t
@@ -2443,7 +2596,7 @@ class H extends q {
2443
2596
  n.href = URL.createObjectURL(e), n.download = t, n.click();
2444
2597
  } else if (typeof global < "u") {
2445
2598
  const e = await this.toOBJ();
2446
- e && (await G("fs", !1)).writeFileSync(t, e);
2599
+ e && (await Y("fs", !1)).writeFileSync(t, e);
2447
2600
  }
2448
2601
  }
2449
2602
  /**
@@ -2459,11 +2612,11 @@ class H extends q {
2459
2612
  i.href = URL.createObjectURL(n), i.download = t, i.click();
2460
2613
  } else if (typeof global < "u") {
2461
2614
  const n = await this.toGltf(e);
2462
- n && (await G("fs", !1)).writeFileSync(t, e ? n : Buffer.from(n));
2615
+ n && (await Y("fs", !1)).writeFileSync(t, e ? n : Buffer.from(n));
2463
2616
  }
2464
2617
  }
2465
2618
  }
2466
- class Z extends q {
2619
+ class Z extends G {
2467
2620
  static name = "DetailsPoint";
2468
2621
  Dxf = null;
2469
2622
  WhiteModel = null;
@@ -2540,7 +2693,7 @@ class Z extends q {
2540
2693
  }, 50);
2541
2694
  }
2542
2695
  }
2543
- class K extends q {
2696
+ class K extends G {
2544
2697
  static name = "DxfLineModel";
2545
2698
  dxfLineModel = new M.LineSegments();
2546
2699
  dxfDoorsLineModel = new M.LineSegments();
@@ -2563,38 +2716,38 @@ class K extends q {
2563
2716
  });
2564
2717
  }
2565
2718
  }
2566
- const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2719
+ const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2567
2720
  __proto__: null,
2568
2721
  DetailsPoint: Z,
2569
2722
  DxfLineModel: K,
2570
- WhiteModel: H
2723
+ WhiteModel: _
2571
2724
  }, Symbol.toStringTag, { value: "Module" }));
2572
- function W(g, t = {}) {
2725
+ function U(g, t = {}) {
2573
2726
  const {
2574
2727
  detailsPoint: e = !0,
2575
2728
  whiteModel: n = !0,
2576
2729
  dxfLineModel: i = !0
2577
2730
  } = t;
2578
- i && g.addComponent(new K()), n && g.addComponent(new H()), e && g.addComponent(new Z());
2731
+ i && g.addComponent(new K()), n && g.addComponent(new _()), e && g.addComponent(new Z());
2579
2732
  }
2580
- const ft = Object.assign(W, {
2733
+ const pt = Object.assign(U, {
2581
2734
  create(g = {}) {
2582
- return (t) => W(t, g);
2735
+ return (t) => U(t, g);
2583
2736
  }
2584
- }), pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2737
+ }), mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2585
2738
  __proto__: null,
2586
- ModelDataPlugin: ft,
2587
- components: ut
2739
+ ModelDataPlugin: pt,
2740
+ components: ft
2588
2741
  }, Symbol.toStringTag, { value: "Module" }));
2589
- function mt() {
2742
+ function xt() {
2590
2743
  return import("./index2.js");
2591
2744
  }
2592
- function xt() {
2745
+ function yt() {
2593
2746
  return import("./index3.js");
2594
2747
  }
2595
2748
  let z = null;
2596
- async function Et(g, t, e = !1, n) {
2597
- const i = await Promise.resolve().then(() => pt), s = await mt(), o = await xt(), r = new ct().usePlugin(i.ModelDataPlugin.create({
2749
+ async function At(g, t, e = !1, n) {
2750
+ const i = await Promise.resolve().then(() => mt), s = await xt(), o = await yt(), r = new ht().usePlugin(i.ModelDataPlugin.create({
2598
2751
  detailsPoint: !1,
2599
2752
  whiteModel: !0
2600
2753
  })).usePlugin(s.RenderPlugin.create({
@@ -2606,10 +2759,10 @@ async function Et(g, t, e = !1, n) {
2606
2759
  })).usePlugin(o.Editor.create({ viewPermission: n })), a = r.findComponentByType(s.components.DomContainer);
2607
2760
  return a && g.appendChild(a.domElement), z = r, {
2608
2761
  dxfSystem: r,
2609
- getFileAll: () => yt(r)
2762
+ getFileAll: () => gt(r)
2610
2763
  };
2611
2764
  }
2612
- async function yt(g = z) {
2765
+ async function gt(g = z) {
2613
2766
  const t = g.findComponentByName("WhiteModel"), e = new File([await g.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([g.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([g.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(g.Dxf.originalData)], "json.json", { type: "application/json" });
2614
2767
  return {
2615
2768
  dxf: n,
@@ -2621,25 +2774,26 @@ async function yt(g = z) {
2621
2774
  correctionDxf: i
2622
2775
  };
2623
2776
  }
2624
- function At() {
2777
+ function vt() {
2625
2778
  return z;
2626
2779
  }
2627
2780
  export {
2628
- v as B,
2629
- q as C,
2630
- ct as D,
2781
+ A as B,
2782
+ G as C,
2783
+ ht as D,
2631
2784
  $ as E,
2632
2785
  L,
2633
- ft as M,
2634
- p as P,
2635
- j as Q,
2636
- _ as V,
2637
- H as W,
2786
+ pt as M,
2787
+ x as P,
2788
+ q as Q,
2789
+ ct as T,
2790
+ H as V,
2791
+ _ as W,
2638
2792
  Z as a,
2639
- U as b,
2640
- Et as c,
2641
- At as d,
2642
- yt as g,
2643
- ut as i,
2644
- N as u
2793
+ k as b,
2794
+ At as c,
2795
+ vt as d,
2796
+ gt as g,
2797
+ ft as i,
2798
+ O as u
2645
2799
  };