build-dxf 0.1.18 → 0.1.20

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.18",
3
+ "version": "0.1.20",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -2107,6 +2107,34 @@ class LineSegment {
2107
2107
  return true;
2108
2108
  });
2109
2109
  }
2110
+ static createModifyManager() {
2111
+ const modifyMap = new MapEnhance();
2112
+ function setPoint(line, point2, value) {
2113
+ if (!modifyMap.has(line)) modifyMap.set(line, new ArrayMap());
2114
+ const arrayMap = modifyMap.get(line);
2115
+ arrayMap.append(point2, value);
2116
+ }
2117
+ function modify2() {
2118
+ modifyMap.forEach((arrayMap, line) => {
2119
+ arrayMap.forEach((list, point2) => {
2120
+ const otherPoint = line.getAnotherPoint(point2);
2121
+ list.push(point2);
2122
+ list.sort((p1, p2) => p2.distance(otherPoint, true) - p1.distance(otherPoint, true));
2123
+ if (list[0] === point2) point2.copy(list[1]);
2124
+ else point2.copy(list[0]);
2125
+ });
2126
+ });
2127
+ modifyMap.clear();
2128
+ }
2129
+ return {
2130
+ get setPoint() {
2131
+ return setPoint;
2132
+ },
2133
+ get modify() {
2134
+ return modify2;
2135
+ }
2136
+ };
2137
+ }
2110
2138
  }
2111
2139
  class Point {
2112
2140
  x;
@@ -4261,7 +4289,6 @@ class DxfDrawPlugin {
4261
4289
  type: ["door"],
4262
4290
  handler: ({ group: group2, drawArc, drawLine, setColor }) => {
4263
4291
  group2.lines.forEach((lineSegment) => {
4264
- if (lineSegment.length() < 0.4) return;
4265
4292
  const line = lineSegment.clone();
4266
4293
  const doorThickness = DEFAULT_WALL_WIDTH * 0.2;
4267
4294
  const list = [];
@@ -5510,6 +5537,7 @@ function modify(reference, cell, opt, appendLines, grid) {
5510
5537
  if (hasParallel) {
5511
5538
  const newLine = createNewLine(cell, reference, opt, appendLines, grid);
5512
5539
  if (hasSameDirection) newLine.userData = cloneUserData(cell[opt[1]].userData?.userData ?? {});
5540
+ newLine.userData.rooftopPz = cell[opt[1]]?.userData?.userData.rooftopPz ?? newLine.userData.rooftopPz;
5513
5541
  return;
5514
5542
  }
5515
5543
  if (hasDifferentDirection) {
@@ -5618,7 +5646,7 @@ class BoundExt {
5618
5646
  exteriorLines.forEach((line) => correction(line, wallWidth, appendLines, grid, quadtree));
5619
5647
  lines.push(...appendLines.filter((line) => line.length() > 1e-9));
5620
5648
  recomputedWindow(...lines);
5621
- lines = lines.filter((line) => line.length() > 1e-3);
5649
+ lines = lines.filter((line) => line.length() > 0.01);
5622
5650
  findCallBack && findCallBack(exteriorLines, trajectoryPoints);
5623
5651
  return {
5624
5652
  lines,
@@ -6063,34 +6091,36 @@ class Scenario {
6063
6091
  return false;
6064
6092
  });
6065
6093
  const Mesh = this.drawTheModel(E, 0, Number(i), wallHeight);
6066
- Mesh.material.envMap = texture;
6067
- Mesh.material.needsUpdate = true;
6068
- const doubleLinesWindow = doubleWinDrawLine(a[i]);
6069
- if (doubleLinesWindow) {
6070
- let houMesh = null;
6071
- for (const x in doubleLinesWindow) {
6072
- if (doubleLinesWindow.length === 1) {
6073
- const edges = new THREE.EdgesGeometry(this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight).geometry);
6074
- new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6075
- this.installWindows(doubleLinesWindow[x], x);
6076
- this.group.add(this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight));
6077
- } else if (houMesh) {
6078
- if (Number(x) === doubleLinesWindow.length - 1) {
6079
- const edges = new THREE.EdgesGeometry(this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight).geometry);
6094
+ if (Mesh) {
6095
+ Mesh.material.envMap = texture;
6096
+ Mesh.material.needsUpdate = true;
6097
+ const doubleLinesWindow = doubleWinDrawLine(a[i]);
6098
+ if (doubleLinesWindow && doubleLinesWindow.length != 0) {
6099
+ let houMesh = null;
6100
+ for (const x in doubleLinesWindow) {
6101
+ if (doubleLinesWindow.length === 1) {
6102
+ const edges = new THREE.EdgesGeometry(this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight).geometry);
6080
6103
  new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6081
6104
  this.installWindows(doubleLinesWindow[x], x);
6082
- this.group.add(this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight));
6105
+ this.group.add(this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight));
6106
+ } else if (houMesh) {
6107
+ if (Number(x) === doubleLinesWindow.length - 1) {
6108
+ const edges = new THREE.EdgesGeometry(this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight).geometry);
6109
+ new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6110
+ this.installWindows(doubleLinesWindow[x], x);
6111
+ this.group.add(this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight));
6112
+ } else {
6113
+ this.installWindows(doubleLinesWindow[x], x);
6114
+ houMesh = this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight);
6115
+ }
6083
6116
  } else {
6084
6117
  this.installWindows(doubleLinesWindow[x], x);
6085
- houMesh = this.windowTreatment(doubleLinesWindow[x], houMesh, wallHeight);
6118
+ houMesh = this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight);
6086
6119
  }
6087
- } else {
6088
- this.installWindows(doubleLinesWindow[x], x);
6089
- houMesh = this.windowTreatment(doubleLinesWindow[x], Mesh, wallHeight);
6090
6120
  }
6121
+ } else {
6122
+ this.group.add(Mesh);
6091
6123
  }
6092
- } else {
6093
- this.group.add(Mesh);
6094
6124
  }
6095
6125
  }
6096
6126
  }
@@ -6104,28 +6134,33 @@ class Scenario {
6104
6134
  // 可以不是矩形
6105
6135
  new THREE.Vector3(data[3].x, data[3].y, this.height ? this.height : 0)
6106
6136
  ];
6107
- const geometry = this.createParallelepipedFromBase(basePoints, wallHeight);
6108
- const material = new THREE.MeshStandardMaterial({
6109
- color: this.color,
6110
- side: THREE.DoubleSide
6111
- // roughness: this.numdu,
6112
- // metalness: 0.0,
6113
- // envMapRotation: new THREE.Euler(0, 0, 0),
6114
- // polygonOffset: true,
6115
- // polygonOffsetFactor: 10,
6116
- // polygonOffsetUnits: 10,
6117
- });
6118
- const cube = new THREE.Mesh(geometry, material);
6119
- const edges = new THREE.EdgesGeometry(geometry);
6120
- new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6121
- if (num === 0) {
6122
- cube.name = `双线墙_${index2}`;
6123
- cube.userData.category = "doubleWall";
6137
+ const spacing = basePoints[0].distanceTo(basePoints[3]);
6138
+ if (spacing < 5e-3) {
6139
+ return null;
6124
6140
  } else {
6125
- cube.name = `单线墙_${index2}`;
6126
- cube.userData.category = "wall";
6141
+ const geometry = this.createParallelepipedFromBase(basePoints, wallHeight);
6142
+ const material = new THREE.MeshStandardMaterial({
6143
+ color: this.color,
6144
+ side: THREE.DoubleSide
6145
+ // roughness: this.numdu,
6146
+ // metalness: 0.0,
6147
+ // envMapRotation: new THREE.Euler(0, 0, 0),
6148
+ // polygonOffset: true,
6149
+ // polygonOffsetFactor: 10,
6150
+ // polygonOffsetUnits: 10,
6151
+ });
6152
+ const cube = new THREE.Mesh(geometry, material);
6153
+ const edges = new THREE.EdgesGeometry(geometry);
6154
+ new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6155
+ if (num === 0) {
6156
+ cube.name = `双线墙_${index2}`;
6157
+ cube.userData.category = "doubleWall";
6158
+ } else {
6159
+ cube.name = `单线墙_${index2}`;
6160
+ cube.userData.category = "wall";
6161
+ }
6162
+ return cube;
6127
6163
  }
6128
- return cube;
6129
6164
  }
6130
6165
  // 执行偏移
6131
6166
  executionOffset(data, index2, wallHeight) {
@@ -6622,39 +6657,41 @@ class Scenario {
6622
6657
  }
6623
6658
  const wallHeight = listS[x].wallHeight;
6624
6659
  let Mesh = this.executionOffset(a, Number(x) / 2, wallHeight);
6625
- if (winDraw && winDraw.length > 0) {
6626
- let houMesh = null;
6627
- for (const x2 in winDraw) {
6628
- if (winDraw.length === 1) {
6629
- const edges = new THREE.EdgesGeometry(this.windowTreatment(winDraw[x2], Mesh, wallHeight).geometry);
6630
- new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6631
- this.installWindows(winDraw[x2], x2);
6632
- let mesh = this.windowTreatment(winDraw[x2], Mesh, wallHeight);
6633
- mesh.name = `单线墙_${Number(x2) / 2}`;
6634
- mesh.userData.category = "wall";
6635
- this.group.add(mesh);
6636
- } else if (houMesh) {
6637
- if (Number(x2) === winDraw.length - 1) {
6638
- const edges = new THREE.EdgesGeometry(this.windowTreatment(winDraw[x2], houMesh, wallHeight).geometry);
6639
- this.installWindows(winDraw[x2], x2);
6660
+ if (Mesh) {
6661
+ if (winDraw && winDraw.length > 0) {
6662
+ let houMesh = null;
6663
+ for (const x2 in winDraw) {
6664
+ if (winDraw.length === 1) {
6665
+ const edges = new THREE.EdgesGeometry(this.windowTreatment(winDraw[x2], Mesh, wallHeight).geometry);
6640
6666
  new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6641
- let mesh = this.windowTreatment(winDraw[x2], houMesh, wallHeight);
6667
+ this.installWindows(winDraw[x2], x2);
6668
+ let mesh = this.windowTreatment(winDraw[x2], Mesh, wallHeight);
6642
6669
  mesh.name = `单线墙_${Number(x2) / 2}`;
6643
6670
  mesh.userData.category = "wall";
6644
6671
  this.group.add(mesh);
6672
+ } else if (houMesh) {
6673
+ if (Number(x2) === winDraw.length - 1) {
6674
+ const edges = new THREE.EdgesGeometry(this.windowTreatment(winDraw[x2], houMesh, wallHeight).geometry);
6675
+ this.installWindows(winDraw[x2], x2);
6676
+ new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0 }));
6677
+ let mesh = this.windowTreatment(winDraw[x2], houMesh, wallHeight);
6678
+ mesh.name = `单线墙_${Number(x2) / 2}`;
6679
+ mesh.userData.category = "wall";
6680
+ this.group.add(mesh);
6681
+ } else {
6682
+ this.installWindows(winDraw[x2], x2);
6683
+ houMesh = this.windowTreatment(winDraw[x2], houMesh, wallHeight);
6684
+ }
6645
6685
  } else {
6646
6686
  this.installWindows(winDraw[x2], x2);
6647
- houMesh = this.windowTreatment(winDraw[x2], houMesh, wallHeight);
6687
+ houMesh = this.windowTreatment(winDraw[x2], Mesh, wallHeight);
6648
6688
  }
6649
- } else {
6650
- this.installWindows(winDraw[x2], x2);
6651
- houMesh = this.windowTreatment(winDraw[x2], Mesh, wallHeight);
6652
6689
  }
6690
+ } else {
6691
+ Mesh.name = `单线墙_${Number(x) / 2}`;
6692
+ Mesh.userData.category = "wall";
6693
+ this.group.add(Mesh);
6653
6694
  }
6654
- } else {
6655
- Mesh.name = `单线墙_${Number(x) / 2}`;
6656
- Mesh.userData.category = "wall";
6657
- this.group.add(Mesh);
6658
6695
  }
6659
6696
  }
6660
6697
  }
@@ -13807,6 +13844,9 @@ class SceneAutoGenerat {
13807
13844
  await this.buildPlane(this.lines);
13808
13845
  await this.buildWall();
13809
13846
  globalScenario.scene.add(this.scene);
13847
+ globalScenario.scene.traverse((child) => {
13848
+ child.updateWorldMatrix(false, false);
13849
+ });
13810
13850
  }
13811
13851
  buildPlane(lines) {
13812
13852
  lines = lineSegmentClipping(lines, 0);
@@ -13886,6 +13926,7 @@ class SceneAutoGenerat {
13886
13926
  await Promise.all(this.itemList.map(async (item) => await this.getModel(item)));
13887
13927
  }
13888
13928
  static itemParse(item) {
13929
+ if (!Array.isArray(item.contour) || !item.contour.length) return null;
13889
13930
  const contour = Point.fromByList(item.contour ?? []), rectangle = new Polygon(Qa(contour.map((p) => [p.x, p.y])).map((p) => Point.from(p)));
13890
13931
  rectangle.pop();
13891
13932
  const z = item.box.min.z, height = Math.abs(item.box.max.z - z), max = rectangle.getMaxLengthInfo(), min = rectangle.getMinLengthInfo(), direction = max.start.y < max.end.y ? max.start.direction(max.end) : max.end.direction(max.start), shape = new THREE.Shape();
@@ -13905,6 +13946,7 @@ class SceneAutoGenerat {
13905
13946
  const zStart = new THREE.Vector3().copy(rectangle[0].toJson(z)), zEnd = zStart.clone();
13906
13947
  zEnd.z += height;
13907
13948
  return {
13949
+ geometry,
13908
13950
  box: lineSegments,
13909
13951
  center,
13910
13952
  category: item.category,
@@ -14430,6 +14472,7 @@ class CorrectionDxf extends Dxf {
14430
14472
  const lines = parent.Dxf.getLineSegments(true);
14431
14473
  this.set(lineDataToOriginalData(lines, parent.Dxf.originalZAverage), {
14432
14474
  trajectory: e.options.trajectory,
14475
+ publicInfo: e.options.publicInfo,
14433
14476
  onBoundExt: e.options.onBoundExt
14434
14477
  });
14435
14478
  this.clearPreProcessor();
@@ -14455,6 +14498,7 @@ class CorrectionDxf extends Dxf {
14455
14498
  data = res.data;
14456
14499
  this.lineSegments = res.lineSegments;
14457
14500
  this.originalData = data;
14501
+ this.lineSegments = PRE_PROCESSOR.WallHeightHandle(this.lineSegments, options);
14458
14502
  }
14459
14503
  const zList = [];
14460
14504
  data.forEach(({ start, end }) => zList.push(start.z ?? 0, end.z ?? 0));
@@ -14684,7 +14728,6 @@ class WhiteModel extends Component {
14684
14728
  whiteModelGroup = new THREE.Group();
14685
14729
  // dxf数据白模边缘线
14686
14730
  whiteModelLineGroup = new THREE.Group();
14687
- material = new THREE.MeshStandardMaterial({ color: 16777215, transparent: true, opacity: 0.8, side: THREE.DoubleSide });
14688
14731
  itemList = [];
14689
14732
  promise;
14690
14733
  /** 设置物品列表
@@ -14730,13 +14773,7 @@ class WhiteModel extends Component {
14730
14773
  toOBJ() {
14731
14774
  return new Promise(async (resolve) => {
14732
14775
  await this.promise;
14733
- this.material.opacity = 1;
14734
- this.material.needsUpdate = true;
14735
- setTimeout(() => {
14736
- resolve(exporter.parse(this.whiteModelGroup));
14737
- this.material.opacity = 0.8;
14738
- this.material.transparent = true;
14739
- }, 20);
14776
+ resolve(exporter.parse(this.whiteModelGroup));
14740
14777
  });
14741
14778
  }
14742
14779
  /**
@@ -14748,19 +14785,13 @@ class WhiteModel extends Component {
14748
14785
  if (!glbExporter) glbExporter = new gltf.GLTFExporter();
14749
14786
  return new Promise(async (resolve) => {
14750
14787
  await this.promise;
14751
- this.material.opacity = 1;
14752
- this.material.needsUpdate = true;
14753
- setTimeout(async () => {
14754
- glbExporter.parse(this.whiteModelGroup.children, (gltf2) => {
14755
- resolve(gltf2);
14756
- this.material.opacity = 0.8;
14757
- this.material.transparent = true;
14758
- }, () => {
14759
- resolve(void 0);
14760
- }, {
14761
- binary
14762
- });
14763
- }, 20);
14788
+ glbExporter.parse(this.whiteModelGroup.children, (gltf2) => {
14789
+ resolve(gltf2);
14790
+ }, () => {
14791
+ resolve(void 0);
14792
+ }, {
14793
+ binary
14794
+ });
14764
14795
  });
14765
14796
  }
14766
14797
  /**
package/src/index.css CHANGED
@@ -680,7 +680,7 @@
680
680
  inherits: false
681
681
  }
682
682
 
683
- [data-v-74cfb8d6] {
683
+ [data-v-adaee1e3] {
684
684
  font-family: 宋体;
685
685
  }
686
686
 
package/src/index3.js CHANGED
@@ -11772,7 +11772,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11772
11772
  onMousedown: dragMoveHelper,
11773
11773
  class: normalizeClass([{ "border-b-[#eee] border-b-1": toolBarExpand.value }, "flex flex-row justify-between header text-[14px] font-bold p-[10px 0px]"])
11774
11774
  }, [
11775
- _cache[12] || (_cache[12] = createStaticVNode('<div class="flex flex-row" data-v-74cfb8d6><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-74cfb8d6><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-74cfb8d6><path d="M341.333333 298.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m0 298.666666a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z m85.333334 213.333334a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m256-512a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m85.333333 213.333333a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m-85.333333 384a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z" data-v-74cfb8d6></path></svg></div><h5 class="flex text-nowrap text-[12px] items-center pointer-events-none" data-v-74cfb8d6>绘制工具</h5></div>', 1)),
11775
+ _cache[12] || (_cache[12] = createStaticVNode('<div class="flex flex-row" data-v-adaee1e3><div class="p-[2px_5px] flex items-center pointer-events-none" data-v-adaee1e3><svg fill="#aaa" width="20" height="20" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" data-v-adaee1e3><path d="M341.333333 298.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m0 298.666666a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z m85.333334 213.333334a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m256-512a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m85.333333 213.333333a85.333333 85.333333 0 1 1-170.666667 0 85.333333 85.333333 0 0 1 170.666667 0z m-85.333333 384a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z" data-v-adaee1e3></path></svg></div><h5 class="flex text-nowrap text-[12px] items-center pointer-events-none" data-v-adaee1e3>绘制工具</h5></div>', 1)),
11776
11776
  createElementVNode("div", {
11777
11777
  onMousedown: _cache[0] || (_cache[0] = (e) => e.stopPropagation()),
11778
11778
  onClick: _cache[1] || (_cache[1] = ($event) => toolBarExpand.value = !toolBarExpand.value),
@@ -11886,7 +11886,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11886
11886
  style: { "padding": "5px", "font-size": "10px" },
11887
11887
  size: "small",
11888
11888
  type: "primary",
11889
- onClick: _cache[4] || (_cache[4] = ($event) => unref(dxfSystem).Dxf.downloadOriginalData("json.json"))
11889
+ onClick: _cache[4] || (_cache[4] = ($event) => unref(dxfSystem).CorrectionDxf.downloadOriginalData("json.json"))
11890
11890
  }, {
11891
11891
  default: withCtx(() => _cache[17] || (_cache[17] = [
11892
11892
  createTextVNode(" 下载Json ", -1)
@@ -12011,7 +12011,7 @@ const _export_sfc = (sfc, props) => {
12011
12011
  }
12012
12012
  return target;
12013
12013
  };
12014
- const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-74cfb8d6"]]);
12014
+ const EditorTool = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-adaee1e3"]]);
12015
12015
  class Editor extends Component {
12016
12016
  static name = "Editor";
12017
12017
  container = new THREE.Group();
@@ -80,9 +80,9 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
80
80
  */
81
81
  lineDataToOriginalData(lines: LineSegment<LineUserData>[], quadtree?: Quadtree): OriginalDataItem[];
82
82
  /**
83
- * 下载原始json
84
- * @param filename
85
- */
83
+ * 下载原始json
84
+ * @param filename
85
+ */
86
86
  downloadOriginalData(filename: string): Promise<void>;
87
87
  /** 获取绘制数据
88
88
  */
@@ -12,7 +12,6 @@ export declare class WhiteModel extends Component<{
12
12
  Variable: Variable | null;
13
13
  whiteModelGroup: THREE.Group<THREE.Object3DEventMap>;
14
14
  whiteModelLineGroup: THREE.Group<THREE.Object3DEventMap>;
15
- material: THREE.MeshStandardMaterial;
16
15
  itemList: any[];
17
16
  promise?: Promise<THREE.Group>;
18
17
  /** 设置物品列表
@@ -15,7 +15,7 @@ interface IByTrajAnOriginData {
15
15
  updateDoubleWallGroup?: boolean;
16
16
  findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
17
17
  }
18
- /** 执行纠正
18
+ /** 执行纠正更加全面
19
19
  * @param line
20
20
  * @param grid
21
21
  */
@@ -25,6 +25,7 @@ export declare class SceneAutoGenerat {
25
25
  */
26
26
  buildItem(): Promise<void>;
27
27
  static itemParse(item: any): {
28
+ geometry: THREE.ExtrudeGeometry;
28
29
  box: THREE.LineSegments<THREE.EdgesGeometry<THREE.ExtrudeGeometry>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
29
30
  center: THREE.Vector3;
30
31
  category: any;
@@ -35,5 +36,5 @@ export declare class SceneAutoGenerat {
35
36
  end: THREE.Vector3;
36
37
  length: number;
37
38
  }[];
38
- };
39
+ } | null;
39
40
  }
@@ -307,4 +307,8 @@ export declare class LineSegment<T = Record<string, any>> {
307
307
  * @param clippingLine
308
308
  */
309
309
  static clippingByLine(target: LineSegment, clippingLine: LineSegment, callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[];
310
+ static createModifyManager(): {
311
+ readonly setPoint: (line: LineSegment, point: Point, value: Point) => void;
312
+ readonly modify: () => void;
313
+ };
310
314
  }
@@ -0,0 +1,83 @@
1
+ import { Octant, PointData } from 'sparse-octree';
2
+ import { OBB } from 'three/addons/math/OBB.js';
3
+ import * as THREE from 'three';
4
+ /** 查询点是否在obb内,通过gpu计算
5
+ * @param points
6
+ * @param obbs
7
+ * @returns
8
+ */
9
+ export declare function pointInOBBByGpu(points: THREE.Vector3[], obbs: OBBBox[]): Promise<number[]>;
10
+ export declare class OBBBox extends OBB {
11
+ getBoxMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
12
+ getBoxEdge(color?: number): THREE.LineSegments<THREE.EdgesGeometry<THREE.BoxGeometry>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
13
+ toJson(): {
14
+ size: THREE.Vector3Tuple;
15
+ center: THREE.Vector3Tuple;
16
+ quaternion: THREE.QuaternionTuple;
17
+ };
18
+ static fromByBox(box: THREE.Vector3, position: THREE.Vector3, rotation: THREE.Euler | THREE.Quaternion, obb?: OBBBox): OBBBox;
19
+ static fromByPath2D(path: {
20
+ x: number;
21
+ y: number;
22
+ }[], origin: THREE.Vector3, height: number, obb_?: OBBBox): OBBBox;
23
+ }
24
+ export declare class PCSparseOctree<T> {
25
+ private octree;
26
+ bound: THREE.Box3;
27
+ constructor(bound: THREE.Box3);
28
+ /** 插入点 + 数据
29
+ * @param point
30
+ * @param data
31
+ */
32
+ insert(point: THREE.Vector3, data: T): void;
33
+ /** 批量插入(推荐大批量时用)
34
+ * @param points
35
+ * @param datas
36
+ */
37
+ insertBatch(points: THREE.Vector3[], datas: T[]): void;
38
+ /** 查找所有在 oBB 内的盒子
39
+ * @param queryOBB
40
+ * @returns
41
+ */
42
+ findNodeInOBB(queryOBB: OBB): Octant<PointData<T>>[];
43
+ /** 查找所有在 oBB 内的点(带数据)
44
+ * @param queryOBB
45
+ * @returns
46
+ */
47
+ findPointsInOBB(queryOBB: OBB): Array<{
48
+ point: THREE.Vector3;
49
+ data: T;
50
+ }>;
51
+ /** 通过半径查找
52
+ * @param position
53
+ * @param radius
54
+ * @param skipSelf
55
+ * @returns
56
+ */
57
+ findPointsByCircle(position: THREE.Vector3, radius: number, skipSelf?: boolean): import('sparse-octree').PointContainer<T>[];
58
+ /** 查找最近的点
59
+ * @param position
60
+ * @param maxDistance
61
+ * @param skipSelf
62
+ * @returns
63
+ */
64
+ findNearestPoint(position: THREE.Vector3, maxDistance: number, skipSelf?: boolean): import('sparse-octree').PointContainer<T> | null;
65
+ /** 批量查询
66
+ * @param obbList
67
+ * @returns
68
+ */
69
+ findPointsInOBBBatch(obbList: OBBBox[]): {
70
+ point: THREE.Vector3;
71
+ data: T;
72
+ }[][];
73
+ /**
74
+ * @param obbList
75
+ */
76
+ findPointsByGpu(obbList: OBBBox[]): Promise<{
77
+ point: THREE.Vector3;
78
+ data: T;
79
+ }[][]>;
80
+ static fromPoints(points: THREE.Vector3[]): PCSparseOctree<{
81
+ index: number;
82
+ }>;
83
+ }
@@ -0,0 +1,7 @@
1
+ import * as THREE from 'three';
2
+ export declare function encode(points: THREE.Vector3[], colors: number[]): ArrayBuffer;
3
+ export declare function decode(buffer: ArrayBuffer | Blob): Promise<{
4
+ points: Float32Array;
5
+ colors: Float32Array;
6
+ pointCount: number;
7
+ }>;
@@ -0,0 +1 @@
1
+ export declare function download(path: string, file: any): Promise<void>;
@@ -39,8 +39,8 @@ export default class Scenario {
39
39
  constructor(scene: THREE.Scene, camera: THREE.PerspectiveCamera, renderer: THREE.WebGLRenderer, controls: OrbitControls);
40
40
  drawGraphics(lines: LineSegment[], z: number, trajectoryJson: any): Promise<any>;
41
41
  splitProcessData(lines: LineSegment[], texture: THREE.DataTexture): void;
42
- drawTheModel(data: any, num: number, index: number, wallHeight: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap>;
43
- executionOffset(data: any, index: number, wallHeight: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | undefined;
42
+ drawTheModel(data: any, num: number, index: number, wallHeight: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null;
43
+ executionOffset(data: any, index: number, wallHeight: number): THREE.Mesh<THREE.ExtrudeGeometry, THREE.MeshStandardMaterial, THREE.Object3DEventMap> | null | undefined;
44
44
  windowTreatment(dblWin: any, mesh: any, wallHeight: number): Brush;
45
45
  TheHandlingOfTheDoor1(data: LineSegment<LineUserData>): THREE.Vector3[];
46
46
  TheHandlingOfTheDoor(data: LineSegment<LineUserData>[]): void;
@@ -1,48 +0,0 @@
1
- type ValueType = "f32" | "vec2" | "vec3" | "vec4" | "mat3x3" | "mat4x4";
2
- type OptionType = {
3
- workgroup_size?: [number, number, number];
4
- workgroupCount: [number, number?, number?];
5
- globalInvocationIdName?: string;
6
- workgroupIndexName?: string;
7
- synchronize?: string[];
8
- };
9
- type BufferType = {
10
- buffer: number[];
11
- stride: number;
12
- layout: {
13
- name: string;
14
- type: ValueType;
15
- offset: number;
16
- size: number;
17
- }[];
18
- count: number;
19
- };
20
- export declare class GpuComputed {
21
- constructor();
22
- getDevice(): Promise<{
23
- adapter: GPUAdapter | null;
24
- device: GPUDevice;
25
- }>;
26
- createPipleline(code: string, buffers: Record<string, BufferType>): Promise<{
27
- pipeline: GPUComputePipeline;
28
- group: GPUBindGroup;
29
- device: GPUDevice;
30
- bufferInfoList: {
31
- name: string;
32
- buffer: GPUBuffer;
33
- float32Array: Float32Array<ArrayBuffer>;
34
- groupLayoutItem: GPUBindGroupLayoutEntry;
35
- groupItem: {
36
- binding: number;
37
- resource: {
38
- buffer: GPUBuffer;
39
- };
40
- };
41
- }[];
42
- }>;
43
- private buildBuffer;
44
- capitalize(str: string): string;
45
- private buildCode;
46
- computed(code: string, data: Record<string, any[]>, option: OptionType): Promise<number[][]>;
47
- }
48
- export {};