build-dxf 0.1.71 → 0.1.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -8443,8 +8443,15 @@ LoadModel.addNameMap("window", "窗户");
8443
8443
  LoadModel.addNameMap("wall", "单线墙");
8444
8444
  LoadModel.addNameMap("doubleWall", "双线墙");
8445
8445
  LoadModel.addNameMap("balcony", "阳台");
8446
+ LoadModel.addNameMap("balconyFilm", "阳台片");
8447
+ LoadModel.addNameMap("balconyFilmFilm", "阳台片片");
8448
+ LoadModel.addNameMap("balconyFilmFilmFilm", "阳台片片片");
8446
8449
  class BayWindow {
8447
8450
  bayWindowExpansion = [];
8451
+ dottedLinePoints = [];
8452
+ singleLine;
8453
+ bayWindowArea;
8454
+ bayWindowGroup;
8448
8455
  static _instance;
8449
8456
  static get Instance() {
8450
8457
  return BayWindow._instance;
@@ -8452,22 +8459,22 @@ class BayWindow {
8452
8459
  constructor() {
8453
8460
  BayWindow._instance = this;
8454
8461
  this.bayWindowExpansion = [];
8462
+ this.dottedLinePoints = [];
8463
+ this.singleLine = [];
8464
+ this.bayWindowArea = null;
8465
+ this.bayWindowGroup = new THREE.Group();
8455
8466
  }
8456
8467
  // 飘窗处理
8457
- overhangTreatment(data) {
8468
+ overhangTreatment(data, singleLine) {
8469
+ this.singleLine = singleLine;
8458
8470
  const grid = createPointVirtualGrid(Scenario.Instance.lines);
8459
8471
  for (const i in data) {
8472
+ this.bayWindowGroup = new THREE.Group();
8473
+ this.dottedLinePoints.push(data[i].dottedLine);
8460
8474
  let dashedLine = Scenario.Instance.correctionSorting([data[i].dottedLine]);
8461
8475
  let lines = data[i].lines.slice();
8462
8476
  let listS = Scenario.Instance.correctionSorting(lines);
8463
8477
  const centroidPoint = this.getPolygonCentroid(listS);
8464
- this.dashedLineTreatment(dashedLine, centroidPoint, data[i].data);
8465
- const geometry = new THREE.BoxGeometry(0.05, 0.05, 0.05);
8466
- const materialLine = new THREE.MeshBasicMaterial({
8467
- color: 16776960
8468
- });
8469
- let mesh = new THREE.Mesh(geometry, materialLine);
8470
- mesh.position.set(centroidPoint.x, centroidPoint.y, centroidPoint.z);
8471
8478
  for (const a2 in listS) {
8472
8479
  if (Number(a2) % 2 === 0 && Number(a2) !== listS.length - 1) {
8473
8480
  const direction = this.pointSideOfLine(listS[a2].dian, listS[Number(a2) + 1].dian, centroidPoint);
@@ -8477,6 +8484,8 @@ class BayWindow {
8477
8484
  }
8478
8485
  let dataList = data[i].lines.slice();
8479
8486
  dataList.push(data[i].dottedLine);
8487
+ this.bayWindowArea = Polygon.fromByLines2(dataList);
8488
+ this.dashedLineTreatment(dashedLine, centroidPoint, data[i].data);
8480
8489
  let quanti = Scenario.Instance.correctionSorting(dataList);
8481
8490
  this.createBayWindowLayout(quanti, data[i].data);
8482
8491
  for (const x in listS) {
@@ -8513,20 +8522,23 @@ class BayWindow {
8513
8522
  for (const x2 in winDraw) {
8514
8523
  if (winDraw.length === 1) {
8515
8524
  this.installWindows(winDraw[x2], x2, Mesh.points3);
8516
- let mesh2 = this.windowTreatment(winDraw[x2], Mesh.mesh3, wallHeight, Mesh.points3, a2);
8517
- mesh2.name = `飘窗墙_${Number(x2) / 2}组`;
8518
- mesh2.userData.category = "wall";
8519
- Scenario.Instance.group.add(mesh2);
8525
+ let mesh = this.windowTreatment(winDraw[x2], Mesh.mesh3, wallHeight, Mesh.points3, a2);
8526
+ mesh.name = `飘窗墙_${Number(x2) / 2}组`;
8527
+ mesh.userData.category = "bayWindowWall";
8528
+ this.bayWindowGroup.add(mesh);
8520
8529
  }
8521
8530
  }
8522
8531
  } else {
8523
- Mesh.mesh3.name = `单线墙_${Number(x) / 2}`;
8524
- Mesh.mesh3.userData.category = "wall";
8525
- Scenario.Instance.group.add(Mesh.mesh3);
8532
+ Mesh.mesh3.name = `飘窗墙_${Number(x) / 2}组`;
8533
+ Mesh.mesh3.userData.category = "bayWindowWall";
8534
+ this.bayWindowGroup.add(Mesh.mesh3);
8526
8535
  }
8527
8536
  }
8528
8537
  }
8529
8538
  }
8539
+ this.bayWindowGroup.name = `飘窗_${i}`;
8540
+ this.bayWindowGroup.userData.category = "bayWindow";
8541
+ Scenario.Instance.group.add(this.bayWindowGroup);
8530
8542
  }
8531
8543
  }
8532
8544
  // 虚线处理
@@ -8571,13 +8583,13 @@ class BayWindow {
8571
8583
  } else {
8572
8584
  a2 = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: true, index: x, direction: listS[x].direction, shared: false };
8573
8585
  }
8574
- let Meshlist = this.bayWindowExecutionOffset(a2, Number(x) / 2, item.height3, item, true);
8586
+ let Meshlist = this.bayWindowExecutionOffset(a2, Number(x) / 2, item.height3, item, false);
8575
8587
  if (!Meshlist) {
8576
8588
  console.log("夹角异常1", Meshlist);
8577
8589
  continue;
8578
8590
  }
8579
- Scenario.Instance.group.add(Meshlist.mesh1);
8580
- Scenario.Instance.group.add(Meshlist.mesh2);
8591
+ this.bayWindowGroup.add(Meshlist.mesh1);
8592
+ this.bayWindowGroup.add(Meshlist.mesh2);
8581
8593
  }
8582
8594
  }
8583
8595
  }
@@ -8592,9 +8604,34 @@ class BayWindow {
8592
8604
  const MobileY = this.angleToXAxisDegrees(data.start.x, data.start.y, data.end.x, data.end.y, scale2, false);
8593
8605
  let startingPoint;
8594
8606
  let finishLine;
8607
+ if (statuc) {
8608
+ const dottedGrid = createPointVirtualGrid(this.singleLine);
8609
+ const a2 = new Point(data.start.x, data.start.y);
8610
+ const b4 = new Point(data.end.x, data.end.y);
8611
+ if (dottedGrid.queryCircle(a2, 1e-4).length > 0 || dottedGrid.queryCircle(b4, 1e-4).length > 0) {
8612
+ startingPoint = this.xinLine(MobileX, MobileY, data.start, data.direction);
8613
+ finishLine = this.xinLine(MobileX, MobileY, data.end, data.direction);
8614
+ startingPoint.push(finishLine[1]);
8615
+ startingPoint.push(finishLine[0]);
8616
+ return {
8617
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8618
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8619
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8620
+ points3: startingPoint
8621
+ };
8622
+ }
8623
+ }
8595
8624
  if (data.shared) {
8596
8625
  startingPoint = this.xinLine(MobileX, MobileY, data.start, data.direction * -1);
8597
8626
  finishLine = this.xinLine(MobileX, MobileY, data.end, data.direction * -1);
8627
+ startingPoint.push(finishLine[1]);
8628
+ startingPoint.push(finishLine[0]);
8629
+ return {
8630
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8631
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8632
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8633
+ points3: startingPoint
8634
+ };
8598
8635
  } else {
8599
8636
  startingPoint = this.xinLine(MobileX, MobileY, data.start, data.direction);
8600
8637
  finishLine = this.xinLine(MobileX, MobileY, data.end, data.direction);
@@ -8654,23 +8691,43 @@ class BayWindow {
8654
8691
  };
8655
8692
  }
8656
8693
  } else {
8657
- const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8658
- const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8659
- const n = end.sub(start);
8660
- this.bayWindowExpansion.push({ point: data.end, n });
8661
- startingPoint.push(finishLine1[1]);
8662
- startingPoint.push(finishLine1[0]);
8663
- let winPointList = [];
8664
- winPointList.push(startingPoint[0]);
8665
- winPointList.push(startingPoint[1]);
8666
- winPointList.push(finishLine[1]);
8667
- winPointList.push(finishLine[0]);
8668
- return {
8669
- mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8670
- mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8671
- mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8672
- points3: winPointList
8673
- };
8694
+ if (this.bayWindowArea.pointWithin(Point.from(finishLine1[0]))) {
8695
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8696
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8697
+ const n = end.sub(start);
8698
+ this.bayWindowExpansion.push({ point: data.end, n });
8699
+ startingPoint.push(finishLine[1]);
8700
+ startingPoint.push(finishLine[0]);
8701
+ let winPointList = [];
8702
+ winPointList.push(startingPoint[0]);
8703
+ winPointList.push(startingPoint[1]);
8704
+ winPointList.push(finishLine[1]);
8705
+ winPointList.push(finishLine[0]);
8706
+ return {
8707
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8708
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8709
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8710
+ points3: winPointList
8711
+ };
8712
+ } else {
8713
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8714
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8715
+ const n = end.sub(start);
8716
+ this.bayWindowExpansion.push({ point: data.end, n });
8717
+ startingPoint.push(finishLine1[1]);
8718
+ startingPoint.push(finishLine1[0]);
8719
+ let winPointList = [];
8720
+ winPointList.push(startingPoint[0]);
8721
+ winPointList.push(startingPoint[1]);
8722
+ winPointList.push(finishLine[1]);
8723
+ winPointList.push(finishLine[0]);
8724
+ return {
8725
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8726
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8727
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8728
+ points3: winPointList
8729
+ };
8730
+ }
8674
8731
  }
8675
8732
  }
8676
8733
  if (!isDouble && isDouble1) {
@@ -8743,7 +8800,10 @@ class BayWindow {
8743
8800
  const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8744
8801
  const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8745
8802
  const n = end.sub(start);
8746
- anglea = n.dot(this.bayWindowExpansion[x].n);
8803
+ n.normalize();
8804
+ const v2 = new THREE.Vector3(this.bayWindowExpansion[x].n.x, this.bayWindowExpansion[x].n.y, this.bayWindowExpansion[x].n.z);
8805
+ v2.normalize();
8806
+ anglea = n.dot(v2);
8747
8807
  anglea = Math.abs(anglea);
8748
8808
  }
8749
8809
  if (this.bayWindowExpansion[x].point.x === data.end.x && this.bayWindowExpansion[x].point.y === data.end.y && this.bayWindowExpansion[x].point.z === data.end.z) {
@@ -8751,7 +8811,10 @@ class BayWindow {
8751
8811
  const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8752
8812
  const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8753
8813
  const n = end.sub(start);
8754
- angleb = n.dot(this.bayWindowExpansion[x].n);
8814
+ n.normalize();
8815
+ const v2 = new THREE.Vector3(this.bayWindowExpansion[x].n.x, this.bayWindowExpansion[x].n.y, this.bayWindowExpansion[x].n.z);
8816
+ v2.normalize();
8817
+ angleb = n.dot(v2);
8755
8818
  angleb = Math.abs(angleb);
8756
8819
  }
8757
8820
  }
@@ -8818,8 +8881,147 @@ class BayWindow {
8818
8881
  const n = end.sub(start);
8819
8882
  this.bayWindowExpansion.push({ point: data.end, n });
8820
8883
  if (anglea !== null && anglea < 0.1) {
8821
- startingPoint.push(finishLine1[1]);
8822
- startingPoint.push(finishLine1[0]);
8884
+ if (this.bayWindowArea.pointWithin(Point.from(finishLine1[0]))) {
8885
+ startingPoint.push(finishLine[1]);
8886
+ startingPoint.push(finishLine[0]);
8887
+ let winPointList = [];
8888
+ winPointList.push(startingPoint[0]);
8889
+ winPointList.push(startingPoint[1]);
8890
+ winPointList.push(finishLine[1]);
8891
+ winPointList.push(finishLine[0]);
8892
+ return {
8893
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8894
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8895
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8896
+ points3: winPointList
8897
+ };
8898
+ } else {
8899
+ startingPoint.push(finishLine1[1]);
8900
+ startingPoint.push(finishLine1[0]);
8901
+ let winPointList = [];
8902
+ winPointList.push(startingPoint[0]);
8903
+ winPointList.push(startingPoint[1]);
8904
+ winPointList.push(finishLine[1]);
8905
+ winPointList.push(finishLine[0]);
8906
+ return {
8907
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8908
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8909
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8910
+ points3: winPointList
8911
+ };
8912
+ }
8913
+ } else if (anglea !== null && anglea > 0.9) {
8914
+ if (this.bayWindowArea.pointWithin(Point.from(finishLine1[0]))) {
8915
+ startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
8916
+ startingPoint1.push(finishLine[1]);
8917
+ startingPoint1.push(finishLine[0]);
8918
+ let winPointList = [];
8919
+ winPointList.push(startingPoint[0]);
8920
+ winPointList.push(startingPoint[1]);
8921
+ winPointList.push(finishLine[1]);
8922
+ winPointList.push(finishLine[0]);
8923
+ return {
8924
+ mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
8925
+ mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
8926
+ mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
8927
+ points3: winPointList
8928
+ };
8929
+ } else {
8930
+ startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
8931
+ startingPoint1.push(finishLine1[1]);
8932
+ startingPoint1.push(finishLine1[0]);
8933
+ let winPointList = [];
8934
+ winPointList.push(startingPoint[0]);
8935
+ winPointList.push(startingPoint[1]);
8936
+ winPointList.push(finishLine[1]);
8937
+ winPointList.push(finishLine[0]);
8938
+ return {
8939
+ mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
8940
+ mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
8941
+ mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
8942
+ points3: winPointList
8943
+ };
8944
+ }
8945
+ }
8946
+ } else if (!statua && statub) {
8947
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8948
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8949
+ const n = end.sub(start);
8950
+ this.bayWindowExpansion.push({ point: data.start, n });
8951
+ if (angleb !== null && angleb < 0.1) {
8952
+ if (this.bayWindowArea.pointWithin(Point.from(startingPoint1[0]))) {
8953
+ startingPoint.push(finishLine[1]);
8954
+ startingPoint.push(finishLine[0]);
8955
+ let winPointList = [];
8956
+ winPointList.push(startingPoint[0]);
8957
+ winPointList.push(startingPoint[1]);
8958
+ winPointList.push(finishLine[1]);
8959
+ winPointList.push(finishLine[0]);
8960
+ return {
8961
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8962
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8963
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8964
+ points3: winPointList
8965
+ };
8966
+ } else {
8967
+ startingPoint1.push(finishLine[1]);
8968
+ startingPoint1.push(finishLine[0]);
8969
+ let winPointList = [];
8970
+ winPointList.push(startingPoint[0]);
8971
+ winPointList.push(startingPoint[1]);
8972
+ winPointList.push(finishLine[1]);
8973
+ winPointList.push(finishLine[0]);
8974
+ return {
8975
+ mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
8976
+ mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
8977
+ mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
8978
+ points3: winPointList
8979
+ };
8980
+ }
8981
+ } else if (angleb !== null && angleb > 0.9) {
8982
+ if (this.bayWindowArea.pointWithin(Point.from(startingPoint1[0]))) {
8983
+ finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
8984
+ startingPoint.push(finishLine1[1]);
8985
+ startingPoint.push(finishLine1[0]);
8986
+ let winPointList = [];
8987
+ winPointList.push(startingPoint[0]);
8988
+ winPointList.push(startingPoint[1]);
8989
+ winPointList.push(finishLine[1]);
8990
+ winPointList.push(finishLine[0]);
8991
+ return {
8992
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
8993
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
8994
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8995
+ points3: winPointList
8996
+ };
8997
+ } else {
8998
+ finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
8999
+ startingPoint1.push(finishLine1[1]);
9000
+ startingPoint1.push(finishLine1[0]);
9001
+ let winPointList = [];
9002
+ winPointList.push(startingPoint[0]);
9003
+ winPointList.push(startingPoint[1]);
9004
+ winPointList.push(finishLine[1]);
9005
+ winPointList.push(finishLine[0]);
9006
+ return {
9007
+ mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
9008
+ mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
9009
+ mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
9010
+ points3: winPointList
9011
+ };
9012
+ }
9013
+ }
9014
+ } else if (!statua && !statub) {
9015
+ let npc1 = this.bayWindowArea.pointWithin(Point.from(startingPoint1[0]));
9016
+ let npc2 = this.bayWindowArea.pointWithin(Point.from(finishLine1[0]));
9017
+ if (npc1 && npc2) {
9018
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
9019
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
9020
+ const n = end.sub(start);
9021
+ this.bayWindowExpansion.push({ point: data.start, n });
9022
+ this.bayWindowExpansion.push({ point: data.end, n });
9023
+ startingPoint.push(finishLine[1]);
9024
+ startingPoint.push(finishLine[0]);
8823
9025
  let winPointList = [];
8824
9026
  winPointList.push(startingPoint[0]);
8825
9027
  winPointList.push(startingPoint[1]);
@@ -8831,28 +9033,31 @@ class BayWindow {
8831
9033
  mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8832
9034
  points3: winPointList
8833
9035
  };
8834
- } else if (anglea !== null && anglea > 0.9) {
8835
- startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
8836
- startingPoint1.push(finishLine1[1]);
8837
- startingPoint1.push(finishLine1[0]);
9036
+ } else if (npc1 && !npc2) {
9037
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
9038
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
9039
+ const n = end.sub(start);
9040
+ this.bayWindowExpansion.push({ point: data.start, n });
9041
+ this.bayWindowExpansion.push({ point: data.end, n });
9042
+ startingPoint.push(finishLine1[1]);
9043
+ startingPoint.push(finishLine1[0]);
8838
9044
  let winPointList = [];
8839
9045
  winPointList.push(startingPoint[0]);
8840
9046
  winPointList.push(startingPoint[1]);
8841
9047
  winPointList.push(finishLine[1]);
8842
9048
  winPointList.push(finishLine[0]);
8843
9049
  return {
8844
- mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
8845
- mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
8846
- mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
9050
+ mesh1: Scenario.Instance.drawTheModel(startingPoint, 1, index2, wallHeightc),
9051
+ mesh2: this.createDashedLineCeilingWall(startingPoint, index2, item, 0),
9052
+ mesh3: this.createDashedLineCeilingWall(startingPoint, index2, item, 1),
8847
9053
  points3: winPointList
8848
9054
  };
8849
- }
8850
- } else if (!statua && statub) {
8851
- const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8852
- const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8853
- const n = end.sub(start);
8854
- this.bayWindowExpansion.push({ point: data.start, n });
8855
- if (angleb !== null && angleb < 0.1) {
9055
+ } else if (!npc1 && npc2) {
9056
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
9057
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
9058
+ const n = end.sub(start);
9059
+ this.bayWindowExpansion.push({ point: data.start, n });
9060
+ this.bayWindowExpansion.push({ point: data.end, n });
8856
9061
  startingPoint1.push(finishLine[1]);
8857
9062
  startingPoint1.push(finishLine[0]);
8858
9063
  let winPointList = [];
@@ -8866,8 +9071,12 @@ class BayWindow {
8866
9071
  mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
8867
9072
  points3: winPointList
8868
9073
  };
8869
- } else if (angleb !== null && angleb > 0.9) {
8870
- finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
9074
+ } else {
9075
+ const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
9076
+ const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
9077
+ const n = end.sub(start);
9078
+ this.bayWindowExpansion.push({ point: data.start, n });
9079
+ this.bayWindowExpansion.push({ point: data.end, n });
8871
9080
  startingPoint1.push(finishLine1[1]);
8872
9081
  startingPoint1.push(finishLine1[0]);
8873
9082
  let winPointList = [];
@@ -8882,25 +9091,6 @@ class BayWindow {
8882
9091
  points3: winPointList
8883
9092
  };
8884
9093
  }
8885
- } else if (!statua && !statub) {
8886
- const start = new THREE.Vector3(data.start.x, data.start.y, data.start.z);
8887
- const end = new THREE.Vector3(data.end.x, data.end.y, data.end.z);
8888
- const n = end.sub(start);
8889
- this.bayWindowExpansion.push({ point: data.start, n });
8890
- this.bayWindowExpansion.push({ point: data.end, n });
8891
- startingPoint1.push(finishLine1[1]);
8892
- startingPoint1.push(finishLine1[0]);
8893
- let winPointList = [];
8894
- winPointList.push(startingPoint[0]);
8895
- winPointList.push(startingPoint[1]);
8896
- winPointList.push(finishLine[1]);
8897
- winPointList.push(finishLine[0]);
8898
- return {
8899
- mesh1: Scenario.Instance.drawTheModel(startingPoint1, 1, index2, wallHeightc),
8900
- mesh2: this.createDashedLineCeilingWall(startingPoint1, index2, item, 0),
8901
- mesh3: this.createDashedLineCeilingWall(startingPoint1, index2, item, 1),
8902
- points3: winPointList
8903
- };
8904
9094
  }
8905
9095
  }
8906
9096
  }
@@ -9070,7 +9260,7 @@ class BayWindow {
9070
9260
  menModel.userData.depth = wallWidth;
9071
9261
  menModel.userData.height = height;
9072
9262
  menModel.userData.groundHeight = groundClearance;
9073
- Scenario.Instance.group.add(menModel);
9263
+ this.bayWindowGroup.add(menModel);
9074
9264
  }
9075
9265
  }
9076
9266
  // 创建飘窗平面
@@ -9138,40 +9328,42 @@ class BayWindow {
9138
9328
  Scenario.Instance?.group.add(mesh2);
9139
9329
  }
9140
9330
  // 共用线处理
9141
- sharedLineProcessing(sharedLine, data) {
9142
- let listS = Scenario.Instance.correctionSorting(sharedLine);
9143
- for (const x in listS) {
9144
- if (Number(x) % 2 === 0 && Number(x) !== listS.length - 1) {
9145
- let point1;
9146
- let point2;
9147
- let distance2;
9148
- if (Number(x) < listS.length - 2) {
9149
- point1 = new THREE.Vector3(listS[Number(x) + 1].dian.x, listS[Number(x) + 1].dian.y, listS[Number(x) + 1].dian.z);
9150
- point2 = new THREE.Vector3(listS[Number(x) + 2].dian.x, listS[Number(x) + 2].dian.y, listS[Number(x) + 2].dian.z);
9151
- } else {
9152
- point1 = new THREE.Vector3(0, 0, 0);
9153
- point2 = new THREE.Vector3(0, 0, 0);
9154
- }
9155
- distance2 = point1.distanceTo(point2);
9156
- let a2;
9157
- if (x === "0") {
9158
- a2 = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: true, index: x, direction: listS[x].direction };
9159
- }
9160
- if (distance2 < 0.01) {
9161
- a2 = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: false, index: x, direction: listS[x].direction };
9162
- } else {
9163
- a2 = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: true, index: x, direction: listS[x].direction };
9164
- }
9165
- const wallHeight = listS[x].wallHeight;
9166
- let Mesh = this.bayWindowExecutionOffset(a2, Number(x) / 2, wallHeight, data, true);
9167
- if (!Mesh) {
9168
- console.log("夹角异常!");
9169
- continue;
9170
- }
9171
- Scenario.Instance.group.add(Mesh.mesh3);
9172
- }
9173
- }
9174
- }
9331
+ // sharedLineProcessing(sharedLine: any, data: any) {
9332
+ // let listS: any = scenario.Instance!.correctionSorting(sharedLine);
9333
+ // for (const x in listS) {
9334
+ // // console.log('listS', listS);
9335
+ // // LineGroupType.getIdsByType(line, "bayWindow").length === 2 加个是否是共用飘窗线的判断
9336
+ // if (Number(x) % 2 === 0 && Number(x) !== listS.length - 1) {
9337
+ // let point1;
9338
+ // let point2;
9339
+ // let distance;
9340
+ // if (Number(x) < listS.length - 2) {
9341
+ // point1 = new THREE.Vector3(listS[Number(x) + 1].dian.x, listS[Number(x) + 1].dian.y, listS[Number(x) + 1].dian.z);
9342
+ // point2 = new THREE.Vector3(listS[Number(x) + 2].dian.x, listS[Number(x) + 2].dian.y, listS[Number(x) + 2].dian.z);
9343
+ // } else {
9344
+ // point1 = new THREE.Vector3(0, 0, 0);
9345
+ // point2 = new THREE.Vector3(0, 0, 0);
9346
+ // }
9347
+ // distance = point1.distanceTo(point2);
9348
+ // let a;
9349
+ // if (x === '0') {
9350
+ // a = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: true, index: x, direction: listS[x].direction }
9351
+ // }
9352
+ // if (distance < 0.01) {
9353
+ // a = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: false, index: x, direction: listS[x].direction }
9354
+ // } else {
9355
+ // a = { start: listS[x].dian, end: listS[Number(x) + 1].dian, isTheFirst: true, index: x, direction: listS[x].direction }
9356
+ // }
9357
+ // const wallHeight = listS[x].wallHeight;
9358
+ // let Mesh: any = this.bayWindowExecutionOffset(a, Number(x) / 2, wallHeight, data, true);
9359
+ // if (!Mesh) {
9360
+ // console.log('夹角异常!');
9361
+ // continue
9362
+ // }
9363
+ // scenario.Instance!.group.add(Mesh.mesh3);
9364
+ // }
9365
+ // }
9366
+ // }
9175
9367
  }
9176
9368
  const DEFAULT_WALL_HALF_WIDTH = DEFAULT_WALL_WIDTH * 0.5;
9177
9369
  class Scenario {
@@ -9214,6 +9406,7 @@ class Scenario {
9214
9406
  expandedList;
9215
9407
  wallHeight;
9216
9408
  box;
9409
+ singleLineWallValue;
9217
9410
  static _instance;
9218
9411
  static get Instance() {
9219
9412
  return Scenario._instance;
@@ -9252,6 +9445,7 @@ class Scenario {
9252
9445
  this.expandedList = [];
9253
9446
  this.wallHeight = DEFAULT_WALL_HEIGHT;
9254
9447
  this.box = null;
9448
+ this.singleLineWallValue = null;
9255
9449
  }
9256
9450
  // 绘制图形
9257
9451
  async drawGraphics(lines, z, trajectoryJson) {
@@ -9293,6 +9487,7 @@ class Scenario {
9293
9487
  this.expandedList = [];
9294
9488
  if (!BayWindow.Instance) new BayWindow();
9295
9489
  BayWindow.Instance.bayWindowExpansion = [];
9490
+ BayWindow.Instance.dottedLinePoints = [];
9296
9491
  this.splitProcessData(lines, this.texture);
9297
9492
  this.scene.add(this.group);
9298
9493
  return this.group;
@@ -9333,15 +9528,9 @@ class Scenario {
9333
9528
  }
9334
9529
  }
9335
9530
  });
9336
- BayWindow.Instance?.overhangTreatment(bayWinList);
9337
- groups = groups.filter((group2) => {
9338
- if (group2.length < 4) {
9339
- singleLineWall.push(...group2);
9340
- return false;
9341
- }
9342
- return true;
9343
- });
9531
+ BayWindow.Instance?.overhangTreatment(bayWinList, singleLineWall);
9344
9532
  this.TheHandlingOfTheDoor(menList);
9533
+ this.singleLineWallValue = createPointVirtualGrid(singleLineWall);
9345
9534
  this.overallTreatmentOfSingleLineWalls(singleLineWall);
9346
9535
  for (const g in groups) {
9347
9536
  let wallHeight = 0;
@@ -9537,10 +9726,18 @@ class Scenario {
9537
9726
  startingPoint.push(finishLine1[0]);
9538
9727
  return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9539
9728
  } else {
9540
- this.expandedList.push(data.end);
9541
- startingPoint.push(finishLine1[1]);
9542
- startingPoint.push(finishLine1[0]);
9543
- return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9729
+ const npcEnd = new Point(data.start.x, data.start.y);
9730
+ if (this.singleLineWallValue.queryCircle(npcEnd, 1e-4).length <= 1) {
9731
+ this.expandedList.push(data.end);
9732
+ startingPoint.push(finishLine[1]);
9733
+ startingPoint.push(finishLine[0]);
9734
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9735
+ } else {
9736
+ this.expandedList.push(data.end);
9737
+ startingPoint.push(finishLine1[1]);
9738
+ startingPoint.push(finishLine1[0]);
9739
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9740
+ }
9544
9741
  }
9545
9742
  }
9546
9743
  if (!isDouble && isDouble1) {
@@ -9556,10 +9753,18 @@ class Scenario {
9556
9753
  startingPoint1.push(finishLine[0]);
9557
9754
  return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9558
9755
  } else {
9559
- this.expandedList.push(data.start);
9560
- startingPoint1.push(finishLine[1]);
9561
- startingPoint1.push(finishLine[0]);
9562
- return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9756
+ const npcStart = new Point(data.start.x, data.start.y);
9757
+ if (this.singleLineWallValue.queryCircle(npcStart, 1e-4).length <= 1) {
9758
+ this.expandedList.push(data.start);
9759
+ startingPoint.push(finishLine[1]);
9760
+ startingPoint.push(finishLine[0]);
9761
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9762
+ } else {
9763
+ this.expandedList.push(data.start);
9764
+ startingPoint1.push(finishLine[1]);
9765
+ startingPoint1.push(finishLine[0]);
9766
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9767
+ }
9563
9768
  }
9564
9769
  }
9565
9770
  if (!isDouble && !isDouble1) {
@@ -9580,23 +9785,65 @@ class Scenario {
9580
9785
  startingPoint1.push(finishLine1[0]);
9581
9786
  return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9582
9787
  } else if (statua && !statub) {
9583
- this.expandedList.push(data.end);
9584
- startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
9585
- startingPoint1.push(finishLine1[1]);
9586
- startingPoint1.push(finishLine1[0]);
9587
- return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9788
+ const npcEnd = new Point(data.end.x, data.end.y);
9789
+ if (this.singleLineWallValue.queryCircle(npcEnd, 1e-4).length <= 1) {
9790
+ this.expandedList.push(data.end);
9791
+ startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
9792
+ startingPoint1.push(finishLine[1]);
9793
+ startingPoint1.push(finishLine[0]);
9794
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9795
+ } else {
9796
+ this.expandedList.push(data.end);
9797
+ startingPoint1 = this.xinLine1(MobileY, MobileX, startingPoint[0], startingPoint[1], 1, wallHeightc);
9798
+ startingPoint1.push(finishLine1[1]);
9799
+ startingPoint1.push(finishLine1[0]);
9800
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9801
+ }
9588
9802
  } else if (!statua && statub) {
9589
- this.expandedList.push(data.start);
9590
- finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
9591
- startingPoint1.push(finishLine1[1]);
9592
- startingPoint1.push(finishLine1[0]);
9593
- return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9803
+ const npcStart = new Point(data.start.x, data.start.y);
9804
+ if (this.singleLineWallValue.queryCircle(npcStart, 1e-4).length <= 1) {
9805
+ this.expandedList.push(data.start);
9806
+ finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
9807
+ startingPoint.push(finishLine1[1]);
9808
+ startingPoint.push(finishLine1[0]);
9809
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9810
+ } else {
9811
+ this.expandedList.push(data.start);
9812
+ finishLine1 = this.xinLine1(MobileY, MobileX, finishLine[0], finishLine[1], 0, wallHeightc);
9813
+ startingPoint1.push(finishLine1[1]);
9814
+ startingPoint1.push(finishLine1[0]);
9815
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9816
+ }
9594
9817
  } else if (!statua && !statub) {
9595
- this.expandedList.push(data.start);
9596
- this.expandedList.push(data.end);
9597
- startingPoint1.push(finishLine1[1]);
9598
- startingPoint1.push(finishLine1[0]);
9599
- return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9818
+ const npcStart = new Point(data.start.x, data.start.y);
9819
+ const npcEnd = new Point(data.end.x, data.end.y);
9820
+ let npc1 = this.singleLineWallValue.queryCircle(npcStart, 1e-4).length <= 1;
9821
+ let npc2 = this.singleLineWallValue.queryCircle(npcEnd, 1e-4).length <= 1;
9822
+ if (npc1 && npc2) {
9823
+ this.expandedList.push(data.start);
9824
+ this.expandedList.push(data.end);
9825
+ startingPoint.push(finishLine[1]);
9826
+ startingPoint.push(finishLine[0]);
9827
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9828
+ } else if (!npc1 && npc2) {
9829
+ this.expandedList.push(data.start);
9830
+ this.expandedList.push(data.end);
9831
+ startingPoint1.push(finishLine[1]);
9832
+ startingPoint1.push(finishLine[0]);
9833
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9834
+ } else if (npc1 && !npc2) {
9835
+ this.expandedList.push(data.start);
9836
+ this.expandedList.push(data.end);
9837
+ startingPoint.push(finishLine1[1]);
9838
+ startingPoint.push(finishLine1[0]);
9839
+ return this.drawTheModel(startingPoint, 1, index2, wallHeightc);
9840
+ } else {
9841
+ this.expandedList.push(data.start);
9842
+ this.expandedList.push(data.end);
9843
+ startingPoint1.push(finishLine1[1]);
9844
+ startingPoint1.push(finishLine1[0]);
9845
+ return this.drawTheModel(startingPoint1, 1, index2, wallHeightc);
9846
+ }
9600
9847
  }
9601
9848
  }
9602
9849
  }
@@ -9755,6 +10002,8 @@ class Scenario {
9755
10002
  }
9756
10003
  // 安装阳台
9757
10004
  installBalconys(data, index2) {
10005
+ let balconyGroup = new Group$1();
10006
+ balconyGroup.name = `阳台${index2}`;
9758
10007
  const point1 = new THREE.Vector3(data.start.x, data.start.y, 0);
9759
10008
  const point2 = new THREE.Vector3(data.end.x, data.end.y, 0);
9760
10009
  new THREE.Vector3(data.center.x, data.center.y, 0);
@@ -9766,19 +10015,57 @@ class Scenario {
9766
10015
  const wallWidth = data.userData.wallWidth ? data.userData.wallWidth : 0.18;
9767
10016
  (data.userData.groundClearance ?? this.WindowGroundHeight) + this.height;
9768
10017
  let menModel = this.balconyModely.clone();
9769
- if (data.center && distance2) {
9770
- menModel.position.set(data.center.x, data.center.y, 0);
9771
- const box32 = new THREE.Box3();
9772
- box32.setFromObject(menModel);
9773
- let size2 = new THREE.Vector3();
9774
- box32.getSize(size2);
9775
- menModel.rotation.x = Math.PI / 2;
9776
- menModel.rotation.y = angleRad;
9777
- menModel.scale.set(distance2 / size2.x, height / size2.y, wallWidth / size2.z);
9778
- menModel.position.set(data.center.x, data.center.y, this.height);
9779
- menModel.name = `阳台_${index2}`;
9780
- menModel.userData.category = "balcony";
9781
- this.group.add(menModel);
10018
+ if (distance2 < 1.2) {
10019
+ if (data.center && distance2) {
10020
+ menModel.position.set(data.center.x, data.center.y, 0);
10021
+ const box32 = new THREE.Box3();
10022
+ box32.setFromObject(menModel);
10023
+ let size2 = new THREE.Vector3();
10024
+ box32.getSize(size2);
10025
+ menModel.rotation.x = Math.PI / 2;
10026
+ menModel.rotation.y = angleRad;
10027
+ menModel.scale.set(distance2 / size2.x, height / size2.y, wallWidth / size2.z);
10028
+ menModel.position.set(data.center.x, data.center.y, this.height);
10029
+ menModel.name = `阳台_${index2}`;
10030
+ menModel.userData.category = "balcony";
10031
+ balconyGroup.add(menModel);
10032
+ this.group.add(balconyGroup);
10033
+ }
10034
+ } else {
10035
+ let splitLineInto7Points = function(startPoint, endPoint) {
10036
+ const points2 = [];
10037
+ const startVec = new THREE.Vector3(startPoint.x, startPoint.y, startPoint.z);
10038
+ const endVec = new THREE.Vector3(endPoint.x, endPoint.y, endPoint.z);
10039
+ for (let i = 0; i <= npc; i++) {
10040
+ const fraction = i / npc;
10041
+ const point3 = new THREE.Vector3();
10042
+ point3.lerpVectors(startVec, endVec, fraction);
10043
+ points2.push(point3);
10044
+ }
10045
+ return points2;
10046
+ };
10047
+ let npc = 0;
10048
+ npc = distance2 / 0.8;
10049
+ npc = Math.round(npc);
10050
+ const points = splitLineInto7Points(point1, point2);
10051
+ for (let o = 0; o < points.length - 1; o++) {
10052
+ const spacing = points[o].distanceTo(points[o + 1]);
10053
+ const center = new THREE.Vector3();
10054
+ center.lerpVectors(points[o], points[o + 1], 0.5);
10055
+ let balconyModel = this.balconyModely.clone();
10056
+ const box32 = new THREE.Box3();
10057
+ box32.setFromObject(menModel);
10058
+ let size2 = new THREE.Vector3();
10059
+ box32.getSize(size2);
10060
+ balconyModel.rotation.x = Math.PI / 2;
10061
+ balconyModel.rotation.y = angleRad;
10062
+ balconyModel.scale.set(spacing / size2.x, height / size2.y, wallWidth / size2.z);
10063
+ balconyModel.position.set(center.x, center.y, this.height);
10064
+ balconyModel.name = `阳台_${index2}`;
10065
+ balconyModel.userData.category = "balcony";
10066
+ balconyGroup.add(balconyModel);
10067
+ }
10068
+ this.group.add(balconyGroup);
9782
10069
  }
9783
10070
  }
9784
10071
  // 放置柜子
@@ -10217,7 +10504,7 @@ class Scenario {
10217
10504
  }
10218
10505
  // 获取阳台模型
10219
10506
  async balconyModelLoader() {
10220
- this.balconyModely = await LoadModel.loadGlb("balcony");
10507
+ this.balconyModely = await LoadModel.loadGlb("balconyFilmFilmFilm");
10221
10508
  }
10222
10509
  damian() {
10223
10510
  const planeGeometry = new THREE.BufferGeometry();
@@ -3,10 +3,14 @@ import * as THREE from 'three';
3
3
  export declare const DEFAULT_WALL_HALF_WIDTH: number;
4
4
  export default class BayWindow {
5
5
  bayWindowExpansion: any;
6
+ dottedLinePoints: any;
7
+ singleLine: any;
8
+ bayWindowArea: any;
9
+ bayWindowGroup: THREE.Group;
6
10
  private static _instance?;
7
11
  static get Instance(): BayWindow | undefined;
8
12
  constructor();
9
- overhangTreatment(data: any): void;
13
+ overhangTreatment(data: any, singleLine: any): void;
10
14
  dashedLineTreatment(data: any, centroidPoint: any, item: any): void;
11
15
  bayWindowExecutionOffset(data: any, index: number, wallHeight: number, item?: any, statuc?: boolean): {
12
16
  mesh1: THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null;
@@ -28,5 +32,4 @@ export default class BayWindow {
28
32
  windowTreatment(dblWin: any, mesh: any, wallHeight: number, startingPoint: any, data: any): import('three-bvh-csg').Brush;
29
33
  installWindows(data: any, index: string, startingPoint: any): void;
30
34
  createBayWindowLayout(listS: any, objData: any): void;
31
- sharedLineProcessing(sharedLine: any, data: any): void;
32
35
  }
@@ -36,6 +36,7 @@ export default class Scenario {
36
36
  expandedList: any;
37
37
  wallHeight: any;
38
38
  box: any;
39
+ singleLineWallValue: any;
39
40
  private static _instance?;
40
41
  static get Instance(): Scenario | undefined;
41
42
  constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera, renderer: THREE.WebGLRenderer, controls: OrbitControls);