build-dxf 0.1.100 → 0.1.101

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.100",
3
+ "version": "0.1.101",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -21052,20 +21052,6 @@ function removeShortDoor(lines) {
21052
21052
  return lines;
21053
21053
  }
21054
21054
  function correction(lines, targettLine, option) {
21055
- lines.forEach((line) => {
21056
- if (line.userData.isDoor) {
21057
- delete line.userData.isDoor;
21058
- line.userData.isPassageEntrance = true;
21059
- line.userData.passageEntrance = [{
21060
- p: line.center.toJson(option?.originalZ),
21061
- width: line.len,
21062
- full: false,
21063
- groundClearance: 0,
21064
- type: "door",
21065
- height: line.userData.height
21066
- }];
21067
- }
21068
- });
21069
21055
  lines = breakpointMerging(lines);
21070
21056
  lines = lineSegmentClipping(lines, 1e-9);
21071
21057
  lines = preprocessing(lines);
@@ -21649,8 +21635,26 @@ function removeShortDoubleWall(lineSegments) {
21649
21635
  const doubleWalls = LineGroupType.getGroupsByType(lineSegments, "doubleWall"), freePointLines = [...findDiscretePointLine2(lineSegments)].filter((line) => line.length() < 0.3), grid = createPointSpatialHash(doubleWalls.flat(4)), lines = freePointLines.filter((line) => grid.queryPoint(line.start).length > 0 || grid.queryPoint(line.end).length > 0), removeSet = new Set(lines);
21650
21636
  return lineSegments.filter((line) => !removeSet.has(line));
21651
21637
  }
21638
+ function doorToHole(lines, option) {
21639
+ lines.forEach((line) => {
21640
+ if (line.userData.isDoor) {
21641
+ delete line.userData.isDoor;
21642
+ line.userData.isPassageEntrance = true;
21643
+ line.userData.passageEntrance = [{
21644
+ p: line.center.toJson(option?.originalZ),
21645
+ width: line.len,
21646
+ full: false,
21647
+ groundClearance: 0,
21648
+ type: "door",
21649
+ height: line.userData.height
21650
+ }];
21651
+ }
21652
+ });
21653
+ return lines;
21654
+ }
21652
21655
  const builtinFun = {
21653
21656
  init,
21657
+ DoorToHole: doorToHole,
21654
21658
  AxisAlignCorr: axisAlignCorr,
21655
21659
  /** 门落点查找
21656
21660
  */
@@ -22468,7 +22472,7 @@ async function buildJson(opt, dxfSystem = new DxfSystem()) {
22468
22472
  } else throw new Error("非node环境不允许使用路径");
22469
22473
  }
22470
22474
  }
22471
- dxfSystem.Dxf.linePipeline.add(LinePipeline.builtin.init).add(LinePipeline.builtin.WallHeightHandle);
22475
+ dxfSystem.Dxf.linePipeline.add(LinePipeline.builtin.init).add(LinePipeline.builtin.WallHeightHandle).add(LinePipeline.builtin.DoorToHole);
22472
22476
  doorFind && dxfSystem.Dxf.linePipeline.add(LinePipeline.builtin.DoorFind);
22473
22477
  if (opt.axisAlignCorr !== false) {
22474
22478
  dxfSystem.Dxf.linePipeline.add(LinePipeline.builtin.AxisAlignCorr).add(LinePipeline.builtin.RemoveShortDoubleWall);
@@ -1,5 +1,6 @@
1
1
  import { LineUserData, OriginalDataItem, SetDataOption } from '../../../type';
2
- import { LineSegment, Point } from '../../../../utils';
2
+ import { LineSegment } from '../../../../utils/algorithms/LineSegment';
3
+ import { Point } from '../../../../utils/algorithms/Point';
3
4
  interface IByTraj {
4
5
  lines: LineSegment[];
5
6
  trajectory: any;
@@ -23,7 +24,7 @@ export declare class BoundExt {
23
24
  static findExtWallByTraj(lines: LineSegment<LineUserData & {
24
25
  expandDirect?: 'left' | 'right' | 'on';
25
26
  }>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<{
26
- quadtreeNode?: import('../../../../utils').QuadtreeNode;
27
+ quadtreeNode?: import('../../../../utils/algorithms/Quadtree').QuadtreeNode;
27
28
  } & import('../../../type').WallLineGlobalOption & {
28
29
  expandDirect?: "left" | "right" | "on";
29
30
  }>[];
@@ -0,0 +1,9 @@
1
+ import { LineUserData, SetDataOption } from '../../../type';
2
+ import { LineSegment } from '../../../../utils';
3
+ /**
4
+ * 轴对齐垂直修正
5
+ * @param lines 待调整线段组
6
+ * @param targettLine 轴线段
7
+ * @returns
8
+ */
9
+ export declare function doorToHole(lines: LineSegment<LineUserData>[], option?: SetDataOption): LineSegment<any>[];
@@ -6,11 +6,13 @@ import { doubleWallAlignment } from './doubleWallAlignment';
6
6
  import { wallHeightHandle } from './wallHeightHandle';
7
7
  import { doorSpaceHandle } from './doorSpaceHandle';
8
8
  import { removeShortDoubleWall } from './removeShortDoubleWall';
9
+ import { doorToHole } from './doorToHole';
9
10
  /**
10
11
  * 默认提供的预处理函数
11
12
  */
12
13
  export declare const builtinFun: {
13
14
  init: typeof init;
15
+ DoorToHole: typeof doorToHole;
14
16
  AxisAlignCorr: typeof axisAlignCorr;
15
17
  /** 门落点查找
16
18
  */
@@ -4,6 +4,7 @@ import { LineUserData, SetDataOption } from '../../type';
4
4
  export declare class LinePipeline extends Pipeline<LineSegment[], SetDataOption> {
5
5
  static get builtin(): {
6
6
  init: typeof import('./builtin/init').init;
7
+ DoorToHole: typeof import('./builtin/doorToHole').doorToHole;
7
8
  AxisAlignCorr: typeof import('./builtin/axisAlignCorr').axisAlignCorr;
8
9
  DoorFind: (lines: LineSegment[]) => LineSegment<Record<string, any>>[];
9
10
  BoundExt: typeof import('./builtin/boundExt').boundExt;