build-dxf 0.0.35 → 0.0.36
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 +1 -1
- package/src/build.js +1240 -1091
- package/src/index3.js +539 -580
- package/src/utils/DxfSystem/components/Dxf.d.ts +12 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/MergeLine.d.ts +0 -2
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection.d.ts +0 -5
- package/src/utils/Quadtree/LineSegment.d.ts +22 -0
- package/src/utils/Quadtree/Quadtree.d.ts +8 -3
- package/src/utils/DxfSystem/components/Dxf copy.d.ts +0 -276
|
@@ -267,6 +267,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
267
267
|
* @returns
|
|
268
268
|
*/
|
|
269
269
|
private computedOriginalSize;
|
|
270
|
+
get boundaryExtension(): typeof Dxf.boundaryExtension;
|
|
270
271
|
/**
|
|
271
272
|
* 线段数据转为原始json数据
|
|
272
273
|
*/
|
|
@@ -277,6 +278,16 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
277
278
|
* @returns
|
|
278
279
|
*/
|
|
279
280
|
static createData(pointsGroups: Point[][], sealed?: boolean): OriginalDataItem[];
|
|
281
|
+
/** 根据交点,对线段进行裁剪
|
|
282
|
+
* @param this
|
|
283
|
+
* @param lines
|
|
284
|
+
*/
|
|
285
|
+
static lineSegmentClipping(lines: LineSegment<LineUserData>[]): LineSegment<LineUserData>[];
|
|
286
|
+
/**
|
|
287
|
+
* 重新计算窗户
|
|
288
|
+
* @param windowLines
|
|
289
|
+
*/
|
|
290
|
+
static recomputedWindow(...windowLines: LineSegment<LineUserData>[]): void;
|
|
280
291
|
/**
|
|
281
292
|
* 轴对齐垂直修正
|
|
282
293
|
* @param lines 待调整线段组
|
|
@@ -284,7 +295,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
284
295
|
* @returns
|
|
285
296
|
*/
|
|
286
297
|
static axisAlignmentCorrection(lines: LineSegment[], targettLine: LineSegment, option?: AxisAlignmentCorrectionOption): LineSegment<LineUserData>[];
|
|
287
|
-
/**
|
|
298
|
+
/** 查找外墙
|
|
288
299
|
* @param lines
|
|
289
300
|
* @param trajectoryPoints
|
|
290
301
|
* @returns
|
|
@@ -295,6 +306,5 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
295
306
|
* @param trajectoryPoints
|
|
296
307
|
*/
|
|
297
308
|
static boundaryExtension(data: OriginalDataItem[], trajectory: any, wallWidth?: number): OriginalDataItem[];
|
|
298
|
-
boundaryExtension: typeof Dxf.boundaryExtension;
|
|
299
309
|
}
|
|
300
310
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
2
|
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
|
-
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
4
3
|
/**
|
|
5
4
|
* 合并同向线段
|
|
6
5
|
*/
|
|
@@ -13,7 +12,6 @@ export declare class MergeLine extends CommandFlowComponent<{}> {
|
|
|
13
12
|
* 进入命令约束
|
|
14
13
|
*/
|
|
15
14
|
private constraint;
|
|
16
|
-
mergeLine(line1: LineSegment, line2: LineSegment): false | LineSegment<Record<string, any>>;
|
|
17
15
|
/** 开始
|
|
18
16
|
* @param next
|
|
19
17
|
* @todo 合并所有
|
|
@@ -60,11 +60,6 @@ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
|
|
|
60
60
|
* @param next
|
|
61
61
|
*/
|
|
62
62
|
verticalCorrection(next: any, selectLines: LineSegment[]): void;
|
|
63
|
-
/**
|
|
64
|
-
* 窗户恢复
|
|
65
|
-
* @param doorLines
|
|
66
|
-
*/
|
|
67
|
-
windowRecover(doorLines: LineSegment<LineUserData>[]): void;
|
|
68
63
|
/** 执行完成
|
|
69
64
|
* @param data
|
|
70
65
|
*/
|
|
@@ -175,4 +175,26 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
175
175
|
* @param lines
|
|
176
176
|
*/
|
|
177
177
|
static maxLengthLineIndex(lines: LineSegment[], excludeCallBack?: (line: LineSegment) => boolean): number;
|
|
178
|
+
/** 对平行并且共线线段分组
|
|
179
|
+
* @param selectLines
|
|
180
|
+
*/
|
|
181
|
+
static groupBySamePointAndParallel(selectLines: LineSegment[]): LineSegment<Record<string, any>>[][];
|
|
182
|
+
/** 合并平行线段
|
|
183
|
+
* @param lines
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
static mergeLines(...lines: LineSegment[]): LineSegment<Record<string, any>>;
|
|
187
|
+
/** 合并满足平行的线段
|
|
188
|
+
* @param selectLines
|
|
189
|
+
*/
|
|
190
|
+
static autoMergeLines(selectLines: LineSegment[]): {
|
|
191
|
+
lines: LineSegment<Record<string, any>>[];
|
|
192
|
+
newLines: LineSegment<Record<string, any>>[];
|
|
193
|
+
deleteLines: LineSegment<Record<string, any>>[];
|
|
194
|
+
};
|
|
195
|
+
/** 去重
|
|
196
|
+
* @param lines
|
|
197
|
+
* @returns
|
|
198
|
+
*/
|
|
199
|
+
static deduplication(lines: LineSegment[]): LineSegment<Record<string, any>>[];
|
|
178
200
|
}
|
|
@@ -16,16 +16,21 @@ export declare class Quadtree<T = any> {
|
|
|
16
16
|
children: Quadtree[] | null;
|
|
17
17
|
nodes: QuadtreeNode<T>[];
|
|
18
18
|
color: number[];
|
|
19
|
-
|
|
19
|
+
targetMap: Map<LineSegment, QuadtreeNode<T>>;
|
|
20
|
+
constructor(bounds: Box2, capacity?: number, maxDepth?: number, depth?: number, targetMap?: Map<LineSegment<Record<string, any>>, QuadtreeNode<T>>);
|
|
20
21
|
/**
|
|
21
22
|
* 插入线段节点
|
|
22
23
|
* @param node 线段节点
|
|
23
24
|
*/
|
|
24
|
-
insert(node: QuadtreeNode<T>): void;
|
|
25
|
+
insert(node: QuadtreeNode<T> | LineSegment): void;
|
|
25
26
|
/** 移除
|
|
26
27
|
* @param node
|
|
27
28
|
*/
|
|
28
|
-
remove(node: QuadtreeNode<T>): void;
|
|
29
|
+
remove(node: QuadtreeNode<T> | LineSegment): void;
|
|
30
|
+
/** 移除
|
|
31
|
+
* @param node
|
|
32
|
+
*/
|
|
33
|
+
update(node: QuadtreeNode<T> | LineSegment): void;
|
|
29
34
|
/**
|
|
30
35
|
* 获取线段所属的象限
|
|
31
36
|
* @param line 线段
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { Component } from '../../ComponentManager';
|
|
2
|
-
import { Point } from '../../Quadtree/Point';
|
|
3
|
-
import { Box2 } from '../../Quadtree/Box2';
|
|
4
|
-
import { LineSegment } from '../../Quadtree/LineSegment';
|
|
5
|
-
import { Quadtree, QuadtreeNode } from '../../Quadtree/Quadtree';
|
|
6
|
-
import * as THREE from "three";
|
|
7
|
-
type Unit = "Unitless" | "Inches" | "Feet" | "Miles" | "Millimeters" | "Centimeters" | "Meters" | "Kilometers" | "Microinches" | "Mils" | "Yards" | "Angstroms" | "Nanometers" | "Microns" | "Decimeters" | "Decameters" | "Hectometers" | "Gigameters" | "Astronomical units" | "Light years" | "Parsecs";
|
|
8
|
-
export interface OriginalDataItem {
|
|
9
|
-
start: {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
z?: number;
|
|
13
|
-
};
|
|
14
|
-
end: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
z?: number;
|
|
18
|
-
};
|
|
19
|
-
insetionArr: {
|
|
20
|
-
index: number;
|
|
21
|
-
p: {
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
z?: number;
|
|
25
|
-
};
|
|
26
|
-
}[];
|
|
27
|
-
length: number;
|
|
28
|
-
isDoor?: boolean;
|
|
29
|
-
doorDirectConnection?: boolean;
|
|
30
|
-
drawDoorData?: {
|
|
31
|
-
start: {
|
|
32
|
-
x: number;
|
|
33
|
-
y: number;
|
|
34
|
-
z?: number;
|
|
35
|
-
};
|
|
36
|
-
n: {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
z?: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
wallWidth?: number;
|
|
43
|
-
isWindow?: boolean;
|
|
44
|
-
isVerticalReferenceLine?: boolean;
|
|
45
|
-
drawWindow?: {
|
|
46
|
-
p: {
|
|
47
|
-
x: number;
|
|
48
|
-
y: number;
|
|
49
|
-
z?: number;
|
|
50
|
-
};
|
|
51
|
-
width: number;
|
|
52
|
-
full: boolean;
|
|
53
|
-
}[];
|
|
54
|
-
}
|
|
55
|
-
export type LineUserData = {
|
|
56
|
-
doorDirectConnection?: boolean;
|
|
57
|
-
isDoor?: boolean;
|
|
58
|
-
isWindow?: boolean;
|
|
59
|
-
isVerticalReferenceLine?: boolean;
|
|
60
|
-
wallWidth?: number;
|
|
61
|
-
drawWindow?: {
|
|
62
|
-
p: THREE.Vector3;
|
|
63
|
-
width: number;
|
|
64
|
-
full: boolean;
|
|
65
|
-
}[];
|
|
66
|
-
drawDoorData?: any;
|
|
67
|
-
quadtreeNode?: QuadtreeNode;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* [开始点, 结束点, 相交点, 是否是门, 索引]
|
|
71
|
-
*/
|
|
72
|
-
export type DataItem = [Point, Point, number[], boolean, number];
|
|
73
|
-
export type DrawData = {
|
|
74
|
-
unit: Unit;
|
|
75
|
-
line: [number, number, number, number, string][];
|
|
76
|
-
arc: [number, number, number, number, number, string][];
|
|
77
|
-
dimensionLine: number[][];
|
|
78
|
-
center: {
|
|
79
|
-
x: number;
|
|
80
|
-
y: number;
|
|
81
|
-
};
|
|
82
|
-
width: number;
|
|
83
|
-
height: number;
|
|
84
|
-
scale: number;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
export interface PointGroup {
|
|
90
|
-
points: Point[];
|
|
91
|
-
indices: number[];
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 将点云结构转换为DXF格式
|
|
95
|
-
*/
|
|
96
|
-
export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
97
|
-
setDta: {
|
|
98
|
-
originalData: OriginalDataItem[];
|
|
99
|
-
data: DataItem[];
|
|
100
|
-
};
|
|
101
|
-
lineOffset: {
|
|
102
|
-
wallsGroup: Point[][];
|
|
103
|
-
};
|
|
104
|
-
createGroup: {
|
|
105
|
-
groups: Point[][][];
|
|
106
|
-
};
|
|
107
|
-
} & TEventMap> {
|
|
108
|
-
static name: string;
|
|
109
|
-
shortLine: number;
|
|
110
|
-
width: number;
|
|
111
|
-
scale: number;
|
|
112
|
-
originalData: OriginalDataItem[];
|
|
113
|
-
data: DataItem[];
|
|
114
|
-
originalBox: Box2;
|
|
115
|
-
box: Box2;
|
|
116
|
-
pointsGroups: Point[][][];
|
|
117
|
-
wallsGroup: Point[][];
|
|
118
|
-
doors: DataItem[];
|
|
119
|
-
doorLineSegment: LineSegment[];
|
|
120
|
-
lineSegments: LineSegment<LineUserData>[];
|
|
121
|
-
originalZAverage: number;
|
|
122
|
-
static EndType: {
|
|
123
|
-
etOpenSquare: number;
|
|
124
|
-
etOpenRound: number;
|
|
125
|
-
etOpenButt: number;
|
|
126
|
-
};
|
|
127
|
-
static JoinType: {
|
|
128
|
-
jtSquare: number;
|
|
129
|
-
jtRound: number;
|
|
130
|
-
jtMiter: number;
|
|
131
|
-
};
|
|
132
|
-
/** 原始数据组
|
|
133
|
-
*/
|
|
134
|
-
get lines(): LineSegment<LineUserData>[];
|
|
135
|
-
/**初始化
|
|
136
|
-
* @param data 点云数据
|
|
137
|
-
* @param width 墙体宽度
|
|
138
|
-
* @param scale 缩放比例
|
|
139
|
-
*/
|
|
140
|
-
constructor(width?: number, scale?: number);
|
|
141
|
-
/**
|
|
142
|
-
* 预处理数据
|
|
143
|
-
* @param data
|
|
144
|
-
*/
|
|
145
|
-
preprocessing(data: OriginalDataItem[], axisAlignmentCorrection?: boolean): {
|
|
146
|
-
lineSegments: LineSegment<LineUserData>[];
|
|
147
|
-
data: OriginalDataItem[];
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* 设置
|
|
151
|
-
* @param data
|
|
152
|
-
* @param width
|
|
153
|
-
* @param scale
|
|
154
|
-
*/
|
|
155
|
-
set(data: OriginalDataItem[] | string, width?: number, scale?: number, axisAlignmentCorrection?: boolean): Promise<any>;
|
|
156
|
-
/** 创建分组
|
|
157
|
-
* @description 根据相交数组insetionArr, 把相交的线段,划分到一组内,方便后续路径查找合并使用
|
|
158
|
-
* @returns
|
|
159
|
-
*/
|
|
160
|
-
private createGroups;
|
|
161
|
-
/** 计算当前墙体数据的边界框
|
|
162
|
-
* @description 根据分组数据pointsGroups,计算包围盒, pointsGroups数据为缩放后数据。
|
|
163
|
-
* @description 可通过box属性查看计算结果。
|
|
164
|
-
* @returns
|
|
165
|
-
*/
|
|
166
|
-
computedSize(): Box2;
|
|
167
|
-
/** 线路拓扑
|
|
168
|
-
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
169
|
-
* @param lines
|
|
170
|
-
*/
|
|
171
|
-
lineTopology(lines: Point[][]): Point<Record<string, any>>[][];
|
|
172
|
-
/** 合并方向相同的线段
|
|
173
|
-
* @param lines
|
|
174
|
-
* @param errAngle
|
|
175
|
-
*/
|
|
176
|
-
private mergeSameDirectionLine;
|
|
177
|
-
/** etOpenRound 去除毛刺
|
|
178
|
-
* @description 检查连续的短线段数量,去除合并后产生的毛刺
|
|
179
|
-
*/
|
|
180
|
-
private squareRemoveBurr;
|
|
181
|
-
/**
|
|
182
|
-
* 线段矫直, 线段中心突刺
|
|
183
|
-
* @description 突变长度小于墙体宽度,该线段可能为突起线段,
|
|
184
|
-
* @description 判断后续第2线段与上一条线段是否方向相同,相同就为突刺
|
|
185
|
-
*/
|
|
186
|
-
lineSegmentStraightening(path: Point[]): Point<Record<string, any>>[];
|
|
187
|
-
/**
|
|
188
|
-
* 移除短线段
|
|
189
|
-
* @todo 根据线段两端线段长度,选取参照物_|▔▔
|
|
190
|
-
* @param path
|
|
191
|
-
*/
|
|
192
|
-
removeShortLine(path: Point[], shortLine?: number): Point<Record<string, any>>[];
|
|
193
|
-
/** 线偏移
|
|
194
|
-
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
195
|
-
*/
|
|
196
|
-
lineOffset(endType?: number, joinType?: number, scale?: number): Point<Record<string, any>>[][];
|
|
197
|
-
/**
|
|
198
|
-
* 将点云结构转换为Float32Array
|
|
199
|
-
*/
|
|
200
|
-
to3DArray(scale: number, z?: number): Float32Array<ArrayBuffer>;
|
|
201
|
-
/** 获取角度范围
|
|
202
|
-
* @param center
|
|
203
|
-
* @param p1
|
|
204
|
-
* @param p2
|
|
205
|
-
* @returns
|
|
206
|
-
*/
|
|
207
|
-
private getArcAngleRange;
|
|
208
|
-
/**
|
|
209
|
-
* 线段数据转为原始json数据
|
|
210
|
-
*/
|
|
211
|
-
lineDataToOriginalData(lines: LineSegment<LineUserData>[], quadtree?: Quadtree): OriginalDataItem[];
|
|
212
|
-
/**
|
|
213
|
-
* 转为绘制数据
|
|
214
|
-
*/
|
|
215
|
-
toDrawDataJson(unit?: Unit): DrawData;
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
* @param type
|
|
219
|
-
*/
|
|
220
|
-
toDxfImageBlob(unit?: Unit, type?: string, background?: string): Promise<any>;
|
|
221
|
-
/**
|
|
222
|
-
* 将点json结构转换为Dxf string
|
|
223
|
-
*/
|
|
224
|
-
toDxfString(unit?: Unit): string;
|
|
225
|
-
/**
|
|
226
|
-
* 将点云结构转换为DXF格式
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
|
-
toDxfBlob(unit?: Unit): Blob;
|
|
230
|
-
/**
|
|
231
|
-
* 下载原始json
|
|
232
|
-
* @param filename
|
|
233
|
-
*/
|
|
234
|
-
downloadOriginalData(filename: string): Promise<void>;
|
|
235
|
-
/**
|
|
236
|
-
* 下载
|
|
237
|
-
* @param filename
|
|
238
|
-
*/
|
|
239
|
-
download(filename: string, unit?: Unit): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* 下载
|
|
242
|
-
* @param filename
|
|
243
|
-
*/
|
|
244
|
-
downloadImage(filename: string, unit?: Unit, type?: string): Promise<boolean>;
|
|
245
|
-
/**
|
|
246
|
-
* 计算原始数据的边界框
|
|
247
|
-
* @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
|
|
248
|
-
* @returns
|
|
249
|
-
*/
|
|
250
|
-
private computedOriginalSize;
|
|
251
|
-
/**
|
|
252
|
-
* 创建数据
|
|
253
|
-
* @param pointsGroups
|
|
254
|
-
* @returns
|
|
255
|
-
*/
|
|
256
|
-
static createData(pointsGroups: Point[][], sealed?: boolean): OriginalDataItem[];
|
|
257
|
-
/**
|
|
258
|
-
* 轴对齐垂直修正
|
|
259
|
-
* @param lines 待调整线段组
|
|
260
|
-
* @param targettLine 轴线段
|
|
261
|
-
* @returns
|
|
262
|
-
*/
|
|
263
|
-
static axisAlignmentCorrection(lines: LineSegment[], targettLine: LineSegment): LineSegment<LineUserData>[];
|
|
264
|
-
/**
|
|
265
|
-
* @param lines
|
|
266
|
-
* @param trajectoryPositions
|
|
267
|
-
* @returns
|
|
268
|
-
*/
|
|
269
|
-
static excessLineSegments(lines: LineSegment[], trajectoryPositions: Point[]): LineSegment<Record<string, any>>[];
|
|
270
|
-
/** 边线外扩
|
|
271
|
-
* @param lines
|
|
272
|
-
* @param trajectory
|
|
273
|
-
*/
|
|
274
|
-
static boundaryExtension(lines: LineSegment<LineUserData>[], trajectory: Point[]): LineSegment<LineUserData>[];
|
|
275
|
-
}
|
|
276
|
-
export {};
|