build-dxf 0.1.43 → 0.1.44
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 +76 -1
- package/src/utils/DxfSystem/type.d.ts +36 -55
- package/src/utils/DxfSystem/utils/BoundExt.d.ts +3 -1
- package/src/utils/DxfSystem/utils/BoundExt02.d.ts +3 -1
- package/src/utils/DxfSystem/utils/DoorFind.d.ts +4 -0
- package/src/utils/PointVirtualGrid.d.ts +4 -0
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -366,6 +366,13 @@ class PointVirtualGrid {
|
|
|
366
366
|
}
|
|
367
367
|
return null;
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* @param point
|
|
371
|
+
*/
|
|
372
|
+
isFreePoint(point2) {
|
|
373
|
+
const list = this.queryPoint(point2, true);
|
|
374
|
+
return list.length === 0;
|
|
375
|
+
}
|
|
369
376
|
/** 查找游离的点
|
|
370
377
|
*/
|
|
371
378
|
getFreePoint() {
|
|
@@ -14641,13 +14648,81 @@ class DoorFind {
|
|
|
14641
14648
|
grid;
|
|
14642
14649
|
quadtree;
|
|
14643
14650
|
constructor(lines) {
|
|
14651
|
+
lines = this.findBrotherDoor(lines);
|
|
14644
14652
|
this.lines = lines;
|
|
14645
|
-
const doors = lines.filter((line) => line.userData.isDoor), noDoorLines = lines.filter((line) => !line.userData.isDoor)
|
|
14653
|
+
const doors = lines.filter((line) => line.userData.isDoor), noDoorLines = lines.filter((line) => !line.userData.isDoor);
|
|
14654
|
+
const openDoors = doors.filter((line) => !line.userData.doorDirectConnection), closeDoors = doors.filter((line) => line.userData.doorDirectConnection);
|
|
14646
14655
|
this.grid = createPointVirtualGrid(noDoorLines);
|
|
14647
14656
|
this.quadtree = createQuadtree([...noDoorLines, ...closeDoors]);
|
|
14657
|
+
openDoors.forEach((l) => l.userData.doorDirectConnection = true);
|
|
14648
14658
|
closeDoors.forEach((line) => this.findCloseDoors(line));
|
|
14649
14659
|
openDoors.forEach((line) => this.findOpenDoors(line));
|
|
14650
14660
|
}
|
|
14661
|
+
/**
|
|
14662
|
+
* 查找兄弟门(双开门)
|
|
14663
|
+
*/
|
|
14664
|
+
findBrotherDoor(lines) {
|
|
14665
|
+
const grid = createPointVirtualGrid(lines);
|
|
14666
|
+
const doorLines = [];
|
|
14667
|
+
findDiscretePointLine2(lines).forEach((line) => line.userData.isDoor && doorLines.push(line));
|
|
14668
|
+
const searchedList = [];
|
|
14669
|
+
doorLines.forEach((line) => {
|
|
14670
|
+
const pointStartIsFree = grid.isFreePoint(line.start);
|
|
14671
|
+
const pointEndIsFree = grid.isFreePoint(line.end);
|
|
14672
|
+
if (pointStartIsFree && pointEndIsFree) return;
|
|
14673
|
+
else if (pointStartIsFree) {
|
|
14674
|
+
searchedList.push({
|
|
14675
|
+
door: line,
|
|
14676
|
+
point: line.end
|
|
14677
|
+
});
|
|
14678
|
+
} else {
|
|
14679
|
+
searchedList.push({
|
|
14680
|
+
door: line,
|
|
14681
|
+
point: line.start
|
|
14682
|
+
});
|
|
14683
|
+
}
|
|
14684
|
+
});
|
|
14685
|
+
searchedList.forEach((item) => {
|
|
14686
|
+
let list = grid.queryPoint(item.point, true);
|
|
14687
|
+
if (list.length > 1) {
|
|
14688
|
+
list = list.filter((target) => {
|
|
14689
|
+
const otherPoint = target.userData.getAnotherPoint(target.point);
|
|
14690
|
+
return !grid.isFreePoint(otherPoint);
|
|
14691
|
+
});
|
|
14692
|
+
}
|
|
14693
|
+
item.line = list[0]?.userData;
|
|
14694
|
+
item.linePoint = list[0]?.point;
|
|
14695
|
+
});
|
|
14696
|
+
const doorGrid = new PointVirtualGrid(), minAngle = Math.PI / 180 * 170;
|
|
14697
|
+
searchedList.forEach((item, index2) => item.line && doorGrid.insert(item.point, index2));
|
|
14698
|
+
const removeLines = [];
|
|
14699
|
+
searchedList.forEach((item) => {
|
|
14700
|
+
if (!item.line || item.found) return;
|
|
14701
|
+
const dir = item.line?.getAnotherPoint(item.linePoint).direction(item.linePoint);
|
|
14702
|
+
const list = doorGrid.queryCircle(item.point, item.door.length() * 2.5).filter((result) => {
|
|
14703
|
+
const { line } = searchedList[result.userData];
|
|
14704
|
+
return line.parallel(item.line, 10);
|
|
14705
|
+
}).filter((result) => {
|
|
14706
|
+
const { line, linePoint } = searchedList[result.userData];
|
|
14707
|
+
const dir2 = line?.getAnotherPoint(linePoint).direction(linePoint);
|
|
14708
|
+
return dir.angleBetween(dir2) > minAngle;
|
|
14709
|
+
}).filter((result) => {
|
|
14710
|
+
const { point: point2 } = searchedList[result.userData];
|
|
14711
|
+
const dir2 = item.point.direction(point2);
|
|
14712
|
+
const dir3 = item.linePoint.direction(item.line.getAnotherPoint(item.linePoint));
|
|
14713
|
+
return dir2.angleBetween(dir3) > Math.PI / 180 * 75;
|
|
14714
|
+
});
|
|
14715
|
+
if (list.length) {
|
|
14716
|
+
const item2 = searchedList[list[0].userData];
|
|
14717
|
+
item2.found = true;
|
|
14718
|
+
item.door.getAnotherPoint(item.point).copy(item2.point);
|
|
14719
|
+
item.door.userData.doorDirectConnection = true;
|
|
14720
|
+
removeLines.push(item2.door);
|
|
14721
|
+
}
|
|
14722
|
+
});
|
|
14723
|
+
const set2 = new Set(removeLines);
|
|
14724
|
+
return lines.filter((line) => !set2.has(line));
|
|
14725
|
+
}
|
|
14651
14726
|
/** 处理封闭门
|
|
14652
14727
|
* @param line
|
|
14653
14728
|
* @returns
|
|
@@ -7,20 +7,30 @@ export interface GroupItem {
|
|
|
7
7
|
id: string;
|
|
8
8
|
type?: string;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
isDoor?: boolean;
|
|
13
|
-
isWindow?: boolean;
|
|
14
|
-
isVerticalReferenceLine?: boolean;
|
|
15
|
-
wallWidth?: number;
|
|
16
|
-
rooftopPz?: number;
|
|
17
|
-
height?: number;
|
|
10
|
+
export type WallLineGlobalOption = {
|
|
11
|
+
uuid?: string;
|
|
18
12
|
groupId?: string;
|
|
19
13
|
groupType?: string;
|
|
20
14
|
groups?: GroupItem[];
|
|
21
|
-
|
|
15
|
+
rooftopPz?: number;
|
|
16
|
+
height?: number;
|
|
17
|
+
wallWidth?: number;
|
|
18
|
+
sillHeight?: number;
|
|
19
|
+
length?: number;
|
|
20
|
+
isWindow?: boolean;
|
|
22
21
|
isBayWindow?: boolean;
|
|
23
|
-
|
|
22
|
+
isDoor?: boolean;
|
|
23
|
+
doorAutomaticFind?: boolean;
|
|
24
|
+
doorDirectConnection?: boolean;
|
|
25
|
+
isVerticalReferenceLine?: boolean;
|
|
26
|
+
insetionArr?: {
|
|
27
|
+
index: number;
|
|
28
|
+
p: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
z?: number;
|
|
32
|
+
};
|
|
33
|
+
}[];
|
|
24
34
|
drawWindow?: {
|
|
25
35
|
p: {
|
|
26
36
|
x: number;
|
|
@@ -32,33 +42,6 @@ export type LineUserData = {
|
|
|
32
42
|
rooftopPz?: number;
|
|
33
43
|
uuid?: string;
|
|
34
44
|
}[];
|
|
35
|
-
sillHeight?: number;
|
|
36
|
-
drawDoorData?: any;
|
|
37
|
-
quadtreeNode?: QuadtreeNode;
|
|
38
|
-
};
|
|
39
|
-
export interface OriginalDataItem {
|
|
40
|
-
start: {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
z?: number;
|
|
44
|
-
};
|
|
45
|
-
end: {
|
|
46
|
-
x: number;
|
|
47
|
-
y: number;
|
|
48
|
-
z?: number;
|
|
49
|
-
};
|
|
50
|
-
insetionArr: {
|
|
51
|
-
index: number;
|
|
52
|
-
p: {
|
|
53
|
-
x: number;
|
|
54
|
-
y: number;
|
|
55
|
-
z?: number;
|
|
56
|
-
};
|
|
57
|
-
}[];
|
|
58
|
-
length: number;
|
|
59
|
-
isDoor?: boolean;
|
|
60
|
-
doorDirectConnection?: boolean;
|
|
61
|
-
doorAutomaticFind?: boolean;
|
|
62
45
|
drawDoorData?: {
|
|
63
46
|
start: {
|
|
64
47
|
x: number;
|
|
@@ -71,24 +54,22 @@ export interface OriginalDataItem {
|
|
|
71
54
|
z?: number;
|
|
72
55
|
};
|
|
73
56
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}[];
|
|
91
|
-
}
|
|
57
|
+
};
|
|
58
|
+
export type LineUserData = {
|
|
59
|
+
quadtreeNode?: QuadtreeNode;
|
|
60
|
+
} & WallLineGlobalOption;
|
|
61
|
+
export type OriginalDataItem = {
|
|
62
|
+
start: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
z?: number;
|
|
66
|
+
};
|
|
67
|
+
end: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
z?: number;
|
|
71
|
+
};
|
|
72
|
+
} & WallLineGlobalOption;
|
|
92
73
|
/**
|
|
93
74
|
* [开始点, 结束点, 相交点, 是否是门, 索引]
|
|
94
75
|
*/
|
|
@@ -23,7 +23,9 @@ export declare class BoundExt {
|
|
|
23
23
|
*/
|
|
24
24
|
static findExtWallByTraj(lines: LineSegment<LineUserData & {
|
|
25
25
|
expandDirect?: 'left' | 'right' | 'on';
|
|
26
|
-
}>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<
|
|
26
|
+
}>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<{
|
|
27
|
+
quadtreeNode?: import('../../Quadtree').QuadtreeNode;
|
|
28
|
+
} & import('../type').WallLineGlobalOption & {
|
|
27
29
|
expandDirect?: "left" | "right" | "on";
|
|
28
30
|
}>[];
|
|
29
31
|
/** 通过轨迹点外扩边线
|
|
@@ -23,7 +23,9 @@ export declare class BoundExt {
|
|
|
23
23
|
*/
|
|
24
24
|
static findExtWallByTraj(lines: LineSegment<LineUserData & {
|
|
25
25
|
expandDirect?: 'left' | 'right' | 'on';
|
|
26
|
-
}>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<
|
|
26
|
+
}>[], trajectoryPoints: Point[], minWidth?: number): LineSegment<{
|
|
27
|
+
quadtreeNode?: import('../../Quadtree').QuadtreeNode;
|
|
28
|
+
} & import('../type').WallLineGlobalOption & {
|
|
27
29
|
expandDirect?: "left" | "right" | "on";
|
|
28
30
|
}>[];
|
|
29
31
|
/** 通过轨迹点外扩边线
|
|
@@ -14,6 +14,10 @@ export declare class DoorFind {
|
|
|
14
14
|
grid: PointVirtualGrid<LineSegment<LineUserData>>;
|
|
15
15
|
quadtree: Quadtree<LineSegment<LineUserData>>;
|
|
16
16
|
constructor(lines: LineSegment<LineUserData>[]);
|
|
17
|
+
/**
|
|
18
|
+
* 查找兄弟门(双开门)
|
|
19
|
+
*/
|
|
20
|
+
findBrotherDoor(lines: LineSegment<LineUserData>[]): LineSegment<LineUserData>[];
|
|
17
21
|
/** 处理封闭门
|
|
18
22
|
* @param line
|
|
19
23
|
* @returns
|