build-dxf 0.0.51 → 0.0.52

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.
@@ -3,6 +3,7 @@ import { AngleCorrectionDxf } from './components/AngleCorrectionDxf';
3
3
  import { DoorsAnalysisComponent } from './components/DoorsAnalysis';
4
4
  import { Dxf } from './components/Dxf';
5
5
  import { LineAnalysis } from './components/LineAnalysis';
6
+ import { ThreeVJia } from './components/ThreeVJia';
6
7
  import { Variable } from './components/Variable';
7
8
  export declare class DxfSystem extends ComponentManager {
8
9
  Dxf: Dxf;
@@ -21,3 +22,12 @@ export declare class DxfSystem extends ComponentManager {
21
22
  usePlugin(plugin: (this: DxfSystem, dxfSystem: DxfSystem) => void): this;
22
23
  destroy(): void;
23
24
  }
25
+ declare const components: {
26
+ LineAnalysis: typeof LineAnalysis;
27
+ ThreeVJia: typeof ThreeVJia;
28
+ Variable: typeof Variable;
29
+ Dxf: typeof Dxf;
30
+ DoorsAnalysisComponent: typeof DoorsAnalysisComponent;
31
+ AngleCorrectionDxf: typeof AngleCorrectionDxf;
32
+ };
33
+ export { components };
@@ -1,7 +1,7 @@
1
1
  import { Component } from '../../ComponentManager';
2
2
  import { LineSegment } from '../../LineSegment';
3
3
  import { LineUserData } from '../type';
4
- import { ArrayMap } from '../../Map';
4
+ import { ThreeVJiaJsonObject } from '../utils/lineDataToThreeVJiaJson';
5
5
  /**
6
6
  * 转为 三维家 墙体结构
7
7
  */
@@ -14,54 +14,16 @@ export declare class ThreeVJia extends Component<{
14
14
  /**
15
15
  */
16
16
  onAddFromParent(): void;
17
- /** 获取分组
18
- * @param lines
19
- * @returns
20
- */
21
- getGroups(lines: LineSegment<LineUserData>[]): ArrayMap<string, LineSegment<Record<string, any>>> | null;
17
+ private cacheJson?;
22
18
  /** 更新
23
19
  */
24
20
  updateData(): void;
25
- /** 处理有分组
26
- * @param map
27
- */
28
- handleGroup(map: ArrayMap<string, LineSegment<LineUserData>>): void;
29
- /**
30
- * 角度纠正
31
- */
32
- angleCorrection(): void;
33
- /**
34
- * 处理没有分组
21
+ /** 转为json
22
+ * @param name
23
+ * @param communityName
24
+ * @returns
35
25
  */
36
- handle(): void;
37
- toJson(name?: string, communityName?: string): {
38
- version: string;
39
- name: string;
40
- communityName: string;
41
- city: string;
42
- province: string;
43
- height: number;
44
- walls: {
45
- ID: number;
46
- start: {
47
- x: number;
48
- y: number;
49
- };
50
- end: {
51
- x: number;
52
- y: number;
53
- };
54
- thickness: number;
55
- type: string;
56
- isDoor: boolean | undefined;
57
- loadBearingWall: boolean;
58
- height: number;
59
- }[];
60
- pillars: never[];
61
- beams: never[];
62
- holes: any[];
63
- rooms: never[];
64
- };
26
+ toJson(name?: string, communityName?: string): ThreeVJiaJsonObject | undefined;
65
27
  /**
66
28
  * 下载
67
29
  * @param filename
@@ -1,2 +1,2 @@
1
1
  export * from './DxfSystem';
2
- export * as utils from './utils';
2
+ export * from './utils';
@@ -1,4 +1,5 @@
1
1
  import { DxfSystem } from '../../DxfSystem';
2
+ export * as components from './components';
2
3
  type Option = {
3
4
  viewPermission?: "admin";
4
5
  };
@@ -1,6 +1,20 @@
1
1
  import { LineSegment } from '../../LineSegment';
2
2
  import { Point } from '../../Point';
3
3
  import { LineUserData, OriginalDataItem } from '../type';
4
+ interface IByTraj {
5
+ lines: LineSegment[];
6
+ trajectory: any;
7
+ wallWidth: number;
8
+ updateDoubleWallGroup?: boolean;
9
+ findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
10
+ }
11
+ interface IByTrajAnOriginData {
12
+ data: OriginalDataItem[];
13
+ trajectory: any;
14
+ wallWidth: number;
15
+ updateDoubleWallGroup?: boolean;
16
+ findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
17
+ }
4
18
  export declare class BoundExt {
5
19
  /** 通过轨迹点查找外墙
6
20
  * @param lines
@@ -16,5 +30,17 @@ export declare class BoundExt {
16
30
  * @param lines
17
31
  * @param trajectoryPoints
18
32
  */
19
- static boundExtbyTraj(data: OriginalDataItem[], trajectory: any, wallWidth?: number, findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void): OriginalDataItem[];
33
+ static boundExtbyTrajAndOriginalData(opt: IByTrajAnOriginData): OriginalDataItem[];
34
+ /** 通过轨迹点外扩边线
35
+ * @param lines
36
+ * @param trajectory
37
+ * @param wallWidth
38
+ * @param findCallBack
39
+ * @returns
40
+ */
41
+ static boundExtbyTraj(opt: IByTraj): {
42
+ lines: LineSegment<Record<string, any>>[];
43
+ toOriginalData(originalZAverage: number): OriginalDataItem[];
44
+ };
20
45
  }
46
+ export {};
@@ -1,5 +1,14 @@
1
1
  import { LineSegment } from '../../LineSegment';
2
+ import { Quadtree } from '../../Quadtree';
2
3
  import { LineUserData } from '../type';
4
+ type ProjectionAnalysisResult = {
5
+ source: LineSegment;
6
+ sourceIndex: number;
7
+ target: LineSegment;
8
+ targetIndex: number;
9
+ project: LineSegment;
10
+ project2: LineSegment;
11
+ };
3
12
  export declare class DoubleWallHelper {
4
13
  static errorAngle: number;
5
14
  /** 线段投影分析
@@ -9,6 +18,11 @@ export declare class DoubleWallHelper {
9
18
  * @returns
10
19
  */
11
20
  private static projectionAnalysis;
21
+ static findDoubleLine(lines: LineSegment<LineUserData>[], wallWidth?: number): {
22
+ resultList: ProjectionAnalysisResult[];
23
+ walls: LineSegment<LineUserData>[];
24
+ quadtree: Quadtree<number>;
25
+ };
12
26
  /**
13
27
  * @param lines
14
28
  * @param wallWidth
@@ -16,3 +30,4 @@ export declare class DoubleWallHelper {
16
30
  */
17
31
  static complementSide(lines: LineSegment<LineUserData>[], wallWidth?: number): LineSegment<LineUserData>[];
18
32
  }
33
+ export {};
@@ -0,0 +1,12 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ import { LineUserData } from '../type';
3
+ /** 构建双线墙组结构
4
+ * @param newLines
5
+ * @returns
6
+ */
7
+ export declare function buildDoubleWallGroup(lines: LineSegment<LineUserData>[], doorLines?: LineSegment[], grouped?: boolean, clearInternalLine?: boolean): LineSegment<Record<string, any>>[];
8
+ /** 构建飘窗组组结构
9
+ * @param lines
10
+ * @returns
11
+ */
12
+ export declare function buildBayWindowGroup(lines: LineSegment<LineUserData>[], clear?: boolean): LineSegment<LineUserData>[];
@@ -1,11 +1,6 @@
1
1
  import { LineSegment } from '../../LineSegment';
2
- /** 分割多边形环为长方形
2
+ /** 分割多边形环为长方形,多边形环必须满足,每个角都为90度
3
3
  * @param lines
4
4
  * @returns
5
5
  */
6
6
  export declare function clippingDoubleWall(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
7
- /** 分割多边形环为长方形
8
- * @param lines
9
- * @returns
10
- */
11
- export declare function clippingDoubleWall2(lines: LineSegment[]): void;
@@ -1,5 +1,7 @@
1
1
  import { PointVirtualGrid } from '../../PointVirtualGrid';
2
2
  import { LineSegment } from '../../LineSegment';
3
+ import { MapEnhance } from '../../Map';
4
+ import { Point } from '../../Point';
3
5
  /** 查找有游离的点的线段,也就是有一端没有其他链接线的线段
4
6
  * @param lines
5
7
  * @param grid
@@ -12,3 +14,8 @@ export declare function findDiscretePointLine<T = any>(lines: LineSegment<T>[],
12
14
  * @returns
13
15
  */
14
16
  export declare function findDiscretePointLine2<T = any>(lines: LineSegment<T>[], lineSet?: Set<LineSegment<T>> | null, deep?: boolean): Set<LineSegment<T>>;
17
+ /** 获取游离的点
18
+ * @param lines
19
+ * @returns
20
+ */
21
+ export declare function findDiscretePoint<T = any>(lines: LineSegment<T>[]): MapEnhance<Point<Record<string, any>>, LineSegment<T>>;
@@ -10,7 +10,13 @@ export * from './tools';
10
10
  export * from './findLargestCircle';
11
11
  export * from './findDiscretePointLine';
12
12
  export * from './findVerticalReference';
13
- export * from './lineDataToOriginalData';
14
13
  export * from './mergeLineUserData';
15
14
  export * from './originalDataToLineData';
16
15
  export * from './recomputedWindow';
16
+ export * from './buildGroup';
17
+ export * from './LineGroupType';
18
+ export * from './findClosedPolygons';
19
+ export * from './lineDataToThreeVJiaJson';
20
+ export * from './mergeSmallestCircle';
21
+ export * from './smallestCircle';
22
+ export * as tools from './tools';
@@ -0,0 +1,46 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ import { LineUserData } from '../type';
3
+ import { Point } from '../../Point';
4
+ type Hole = {
5
+ id: number;
6
+ type: "DOOR" | "WINDOW";
7
+ start: Point;
8
+ end: Point;
9
+ height: number;
10
+ groundClearance?: number;
11
+ sillHeight: number;
12
+ openSide?: "RIGHT" | "LEFT" | "UP" | "DOWN";
13
+ };
14
+ type Wall = {
15
+ ID: number;
16
+ start: Point;
17
+ end: Point;
18
+ thickness: number;
19
+ type: "LINE";
20
+ isDoor: boolean;
21
+ loadBearingWall: boolean;
22
+ height: number;
23
+ };
24
+ type Room = {};
25
+ export type ThreeVJiaJsonObject = {
26
+ version: string;
27
+ name: string;
28
+ communityName: string;
29
+ city: string;
30
+ province: string;
31
+ height: number;
32
+ walls: Wall[];
33
+ pillars: any[];
34
+ beams: any[];
35
+ holes: Hole[];
36
+ rooms: Room[];
37
+ };
38
+ /**
39
+ * 转为 三维家 墙体结构
40
+ * @param data
41
+ */
42
+ export declare function lineDataToThreeVJiaJson(lineSegments: LineSegment[], angle?: number, updateGroup?: boolean): {
43
+ lines: LineSegment<LineUserData>[];
44
+ toJson(name?: string, communityName?: string): ThreeVJiaJsonObject;
45
+ };
46
+ export {};
@@ -67,7 +67,7 @@ export declare class LineSegment<T = Record<string, any>> {
67
67
  /** 旋转
68
68
  * @param angle 弧度
69
69
  */
70
- rotate(angle: number): this;
70
+ rotate(angle: number, center?: Point<Record<string, any>>): this;
71
71
  /** 镜像线段
72
72
  */
73
73
  mirror(): void;
@@ -195,6 +195,7 @@ export declare class LineSegment<T = Record<string, any>> {
195
195
  * @returns
196
196
  */
197
197
  areLinesCoincident(line: LineSegment): boolean;
198
+ isSameLine(line: LineSegment, eps?: number): boolean;
198
199
  /** 克隆
199
200
  * @returns
200
201
  */
@@ -224,6 +225,10 @@ export declare class LineSegment<T = Record<string, any>> {
224
225
  * @returns
225
226
  */
226
227
  static groupByPoint(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
228
+ /** 分组,通过方向
229
+ * @param lines
230
+ */
231
+ static groupByDirection(lines: LineSegment[], errAngle?: number): LineSegment<Record<string, any>>[][];
227
232
  /** 合并线段到最长线段
228
233
  * @param lines
229
234
  * @returns
@@ -247,7 +252,7 @@ export declare class LineSegment<T = Record<string, any>> {
247
252
  * @param callBack
248
253
  * @returns
249
254
  */
250
- static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void): LineSegment<Record<string, any>>[];
255
+ static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void, removeLines?: Set<LineSegment<Record<string, any>>>, newLines?: LineSegment[]): LineSegment<Record<string, any>>[];
251
256
  /** 去重
252
257
  * @param lines
253
258
  * @returns
@@ -137,7 +137,8 @@ export declare class Point<T = Record<string, any>> {
137
137
  * 获取两个点长度
138
138
  * @param point
139
139
  */
140
- distance(point: Point): number;
140
+ private _distanceMap;
141
+ distance(point: Point, cached?: boolean): number;
141
142
  hashCode(fixed?: number): string;
142
143
  /**
143
144
  * 克隆
@@ -159,4 +160,6 @@ export declare class Point<T = Record<string, any>> {
159
160
  };
160
161
  static from(arr: any): Point<Record<string, any>>;
161
162
  static zero(): Point<Record<string, any>>;
163
+ private static distanceClearQueue;
164
+ static addDistanceCacheClear(...points: Point[]): void;
162
165
  }
@@ -22,7 +22,7 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
22
22
  * @param point
23
23
  * @param userData
24
24
  */
25
- insert(point: Point, userData?: T): this;
25
+ insert(point: Point, userData?: T): this | undefined;
26
26
  /**
27
27
  * 批量加入
28
28
  * @param points
@@ -10,6 +10,10 @@ export declare class UndirectedGraph {
10
10
  removeNode(node: number): void;
11
11
  getNeighbors(node: number): Set<number> | undefined;
12
12
  printGraph(): void;
13
+ /** 获取能组成的所有路径
14
+ * @returns
15
+ */
16
+ getPaths(): number[][];
13
17
  /** 循环
14
18
  * @param callbackFun
15
19
  */
@@ -51,8 +55,17 @@ export declare class LineSegmentUndirectedGraph extends UndirectedGraph {
51
55
  * 批量添加线段(比逐条 addLine 更快)
52
56
  */
53
57
  addLines(lines: readonly LineSegment[]): this;
58
+ /** 路径转线段组
59
+ * @param path
60
+ */
61
+ pathToLines(path: number[]): LineSegment<Record<string, any>>[];
54
62
  /**
55
63
  * 清空图
56
64
  */
57
65
  clear(): void;
66
+ /** 线段图旋转
67
+ * @param lines
68
+ * @param angle 角度
69
+ */
70
+ static rotate(lines: LineSegment[], angle: number, callbackFun?: (line: LineSegment, center: Point, angle: number) => void): LineSegment<Record<string, any>>[];
58
71
  }
@@ -12,6 +12,6 @@ export * from './UnionFindSet';
12
12
  export * from './cloneUserData';
13
13
  export * from './selectLocalFile';
14
14
  export * from './PointVirtualGrid';
15
- export * as dxfSystem from './DxfSystem';
16
- export * as commandManager from './CommandManager';
17
- export * as componentManager from './ComponentManager';
15
+ export * from './DxfSystem';
16
+ export * from './CommandManager';
17
+ export * from './ComponentManager';