build-dxf 0.0.51 → 0.0.53

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.
Files changed (31) hide show
  1. package/README.md +167 -156
  2. package/package.json +45 -45
  3. package/src/{selectLocalFile.js → DomEventRegister.js} +738 -806
  4. package/src/build.d.ts +2 -2
  5. package/src/build.js +2254 -1691
  6. package/src/index.css +1 -1
  7. package/src/index.js +10 -9
  8. package/src/index2.js +8 -8
  9. package/src/index3.js +297 -429
  10. package/src/utils/DxfSystem/DxfSystem.d.ts +10 -0
  11. package/src/utils/DxfSystem/components/Dxf.d.ts +1 -1
  12. package/src/utils/DxfSystem/components/ThreeVJia.d.ts +7 -45
  13. package/src/utils/DxfSystem/index.d.ts +1 -1
  14. package/src/utils/DxfSystem/plugin/Editor/components/Editor.d.ts +1 -1
  15. package/src/utils/DxfSystem/plugin/Editor/components/index.d.ts +0 -1
  16. package/src/utils/DxfSystem/plugin/Editor/index.d.ts +1 -0
  17. package/src/utils/DxfSystem/utils/BoundExt.d.ts +27 -1
  18. package/src/utils/DxfSystem/utils/CAD.d.ts +17 -0
  19. package/src/utils/DxfSystem/utils/DoubleWallHelper.d.ts +15 -0
  20. package/src/utils/DxfSystem/utils/buildGroup.d.ts +12 -0
  21. package/src/utils/DxfSystem/utils/clippingDoubleWall.d.ts +1 -6
  22. package/src/utils/DxfSystem/utils/findDiscretePointLine.d.ts +7 -0
  23. package/src/utils/DxfSystem/utils/index.d.ts +8 -1
  24. package/src/utils/DxfSystem/utils/lineDataToThreeVJiaJson.d.ts +46 -0
  25. package/src/utils/LineSegment.d.ts +12 -2
  26. package/src/utils/Point.d.ts +4 -1
  27. package/src/utils/PointVirtualGrid/index.d.ts +1 -1
  28. package/src/utils/Polygon.d.ts +11 -1
  29. package/src/utils/UndirectedGraph.d.ts +13 -0
  30. package/src/utils/index.d.ts +3 -3
  31. /package/src/utils/DxfSystem/utils/{findClosedPolygons01.d.ts → findClosedPolygons.d.ts} +0 -0
@@ -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 };
@@ -117,7 +117,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
117
117
  /** 垂直纠正
118
118
  * @param option
119
119
  */
120
- axisAlignCorr(option?: AxisAlignmentCorrectionOption): void;
120
+ axisAlignCorr(option?: AxisAlignmentCorrectionOption): Promise<void>;
121
121
  /** 完整线段数据
122
122
  * @returns
123
123
  */
@@ -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';
@@ -5,7 +5,7 @@ import { Renderer, DomContainer, DomEventRegister, EventInput } from '../../Rend
5
5
  import { RenderManager } from './RenderManager';
6
6
  import { CommandManager } from '../../../../CommandManager';
7
7
  import { App } from 'vue';
8
- import { DxfSystem } from '../../../../../build';
8
+ import { DxfSystem } from '../../..';
9
9
  import * as THREE from "three";
10
10
  export declare class Editor extends Component<{
11
11
  pointerPositionChange: {
@@ -1,4 +1,3 @@
1
- export * from './Editor';
2
1
  export * from './RenderManager';
3
2
  export * from './CommandFlow/Default';
4
3
  export * from './CommandFlow/DrawDoorLine';
@@ -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 {};
@@ -0,0 +1,17 @@
1
+ import { LineSegment } from '../../LineSegment';
2
+ import { LineUserData } from '../type';
3
+ type LineSegmentType = LineSegment<LineUserData>;
4
+ export declare class CAD {
5
+ lines: LineSegmentType[];
6
+ /** 添加线段
7
+ * @param arg
8
+ */
9
+ addLine(...arg: LineSegmentType[]): void;
10
+ removeLine(): void;
11
+ /** 添加线偏移
12
+ * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
13
+ */
14
+ addLineByOffset(lines: LineSegmentType[], endType?: any, joinType?: any, scale?: number): this;
15
+ clear(): void;
16
+ }
17
+ 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,14 @@ 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 * from './CAD';
23
+ 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
  */
@@ -219,11 +220,20 @@ export declare class LineSegment<T = Record<string, any>> {
219
220
  * @returns
220
221
  */
221
222
  static groupByPath(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
223
+ /** 通过最大叶子路径,给线段分组,每条路径没有分叉
224
+ * @param lines
225
+ * @returns
226
+ */
227
+ static groupByLeafPath(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
222
228
  /** 分组,通过点
223
229
  * @param lines
224
230
  * @returns
225
231
  */
226
232
  static groupByPoint(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
233
+ /** 分组,通过方向
234
+ * @param lines
235
+ */
236
+ static groupByDirection(lines: LineSegment[], errAngle?: number): LineSegment<Record<string, any>>[][];
227
237
  /** 合并线段到最长线段
228
238
  * @param lines
229
239
  * @returns
@@ -247,7 +257,7 @@ export declare class LineSegment<T = Record<string, any>> {
247
257
  * @param callBack
248
258
  * @returns
249
259
  */
250
- static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void): LineSegment<Record<string, any>>[];
260
+ static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void, removeLines?: Set<LineSegment<Record<string, any>>>, newLines?: LineSegment[]): LineSegment<Record<string, any>>[];
251
261
  /** 去重
252
262
  * @param lines
253
263
  * @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
@@ -23,9 +23,19 @@ export declare class Polygon<T = any> extends Array<Point<T>> {
23
23
  * @returns
24
24
  */
25
25
  pointWithin(point: Point): boolean;
26
- /** 通过线段创建
26
+ /** 转为线段
27
+ * @param closed
28
+ * @returns
29
+ */
30
+ toLines(closed?: boolean): LineSegment<Record<string, any>>[];
31
+ /** 通过线段创建, 默认路径只有一条
27
32
  * @param lines
28
33
  * @returns
29
34
  */
30
35
  static fromByLines(lines: LineSegment[]): Polygon<Record<string, any>>;
36
+ /** 通过线段创建,返回所有路径
37
+ * @description 处理线路拓扑,使线路有序链接,形成长路径
38
+ * @param lines
39
+ */
40
+ static multipleFromByLines(lines: LineSegment[]): Polygon<Record<string, any>>[];
31
41
  }
@@ -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';