build-dxf 0.0.22 → 0.0.23
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 +425 -298
- package/src/index.css +1 -1
- package/src/index3.js +1078 -917
- package/src/selectLocalFile.js +4 -0
- package/src/utils/DxfSystem/components/Dxf.d.ts +1 -0
- package/src/utils/DxfSystem/components/LineAnalysis.d.ts +77 -0
- package/src/utils/DxfSystem/components/ThreeVJia.d.ts +45 -0
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection.d.ts +10 -7
- package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +6 -4
- package/src/utils/DxfSystem/plugin/RenderPlugin/components/Renderer.d.ts +2 -1
- package/src/utils/Quadtree/Box2.d.ts +6 -0
- package/src/utils/Quadtree/LineSegment.d.ts +5 -0
package/src/selectLocalFile.js
CHANGED
|
@@ -125,6 +125,10 @@ class yn extends at {
|
|
|
125
125
|
* @param count
|
|
126
126
|
*/
|
|
127
127
|
createLineSegments(t, n, r, a = this.container) {
|
|
128
|
+
if (Array.isArray(t)) {
|
|
129
|
+
const s = t.flatMap((l) => l?.points?.flatMap((u) => [u.x, u.y, 0]));
|
|
130
|
+
return this.createLineSegments({ position: s }, t.length * 2, r, a);
|
|
131
|
+
}
|
|
128
132
|
const o = new _.BufferGeometry();
|
|
129
133
|
Object.keys(t).forEach((s) => {
|
|
130
134
|
const l = t[s];
|
|
@@ -4,6 +4,7 @@ import { Variable } from './Variable';
|
|
|
4
4
|
import { Quadtree } from '../../Quadtree/Quadtree';
|
|
5
5
|
import { LineSegment } from '../../Quadtree/LineSegment';
|
|
6
6
|
import { Point } from '../../Quadtree/Point';
|
|
7
|
+
import { PointVirtualGrid } from '../../PointVirtualGrid';
|
|
7
8
|
import * as THREE from "three";
|
|
8
9
|
type ProjectionAnalysisResult = {
|
|
9
10
|
source: LineSegment;
|
|
@@ -13,6 +14,81 @@ type ProjectionAnalysisResult = {
|
|
|
13
14
|
project: LineSegment;
|
|
14
15
|
project2: LineSegment;
|
|
15
16
|
};
|
|
17
|
+
type DoorPoint = {
|
|
18
|
+
line: LineSegment;
|
|
19
|
+
point: Point;
|
|
20
|
+
uuid: string;
|
|
21
|
+
};
|
|
22
|
+
declare class DoorsAnalysis {
|
|
23
|
+
possibleDoorPoints: DoorPoint[];
|
|
24
|
+
doorPoint: DoorPoint[];
|
|
25
|
+
dxf: Dxf;
|
|
26
|
+
pointVirtualGrid: PointVirtualGrid<LineSegment<Record<string, any>>>;
|
|
27
|
+
findPointVirtualGrid: PointVirtualGrid<LineSegment>;
|
|
28
|
+
quadtree: Quadtree;
|
|
29
|
+
resultList: ProjectionAnalysisResult[];
|
|
30
|
+
lineSegments: LineSegment[];
|
|
31
|
+
doorSearchNearAngle: number;
|
|
32
|
+
doorSearchDistance: number;
|
|
33
|
+
doors: LineSegment[];
|
|
34
|
+
lineAnalysis: LineAnalysis;
|
|
35
|
+
continueFind: boolean;
|
|
36
|
+
constructor(lineAnalysis: LineAnalysis);
|
|
37
|
+
private handle;
|
|
38
|
+
private search;
|
|
39
|
+
/** 添加可查找点的过滤规则
|
|
40
|
+
* @param rule
|
|
41
|
+
*/
|
|
42
|
+
addPointsExcludeRule(rule: (line: LineSegment, point: Point, pointIndex: number) => boolean): void;
|
|
43
|
+
private _pointsExcludeRule;
|
|
44
|
+
/**
|
|
45
|
+
* 查找所有可能为门的点位
|
|
46
|
+
*/
|
|
47
|
+
getPossiblePoints(): DoorPoint[];
|
|
48
|
+
/**
|
|
49
|
+
* 查找已知为门的点位
|
|
50
|
+
*/
|
|
51
|
+
getDoorPoint(): DoorPoint[];
|
|
52
|
+
/**
|
|
53
|
+
* 查找双线墙的点位
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
searchDoubleLinePoint(): Map<number, 0 | 1 | -1>;
|
|
57
|
+
/** 查找方案一:最近点查找
|
|
58
|
+
* @description 以点为圆心,查找半径内符合角度的点
|
|
59
|
+
* @param doorPoints
|
|
60
|
+
* @param possibleDoorPoints
|
|
61
|
+
* @param doorSearchDistance 查找的距离(半径)
|
|
62
|
+
* @param doorSearchNearAngle 查找的角度
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
searchNearby(doorPoints: DoorPoint[], possibleDoorPoints?: DoorPoint[], doorSearchDistance?: number, doorSearchNearAngle?: number): any[];
|
|
66
|
+
/** 方案二: 沿方向查找
|
|
67
|
+
* @description
|
|
68
|
+
* @param param0
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
searchAlongDirection({ point, line }: DoorPoint, doorSearchDistance?: number): {
|
|
72
|
+
point: Point;
|
|
73
|
+
line: LineSegment<Record<string, any>>;
|
|
74
|
+
} | undefined;
|
|
75
|
+
/** 方案三: 沿法线方向查找
|
|
76
|
+
* @description
|
|
77
|
+
* @param param0
|
|
78
|
+
* @param doorSearchDistance
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
searchAlongNormalDirection({ point, line }: DoorPoint, doorSearchDistance?: number): {
|
|
82
|
+
point: Point;
|
|
83
|
+
line: LineSegment<Record<string, any>>;
|
|
84
|
+
} | undefined;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @param line
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
findLongLineSegment(line: LineSegment): LineSegment<Record<string, any>>;
|
|
91
|
+
}
|
|
16
92
|
export declare class LineAnalysis extends Component<{
|
|
17
93
|
analysisCompleted: {};
|
|
18
94
|
}> {
|
|
@@ -76,6 +152,7 @@ export declare class LineAnalysis extends Component<{
|
|
|
76
152
|
doorSearchNearAngle: number;
|
|
77
153
|
doorSearchDistance: number;
|
|
78
154
|
doors: LineSegment[];
|
|
155
|
+
DoorsAnalysis?: DoorsAnalysis;
|
|
79
156
|
doorsAnalysis(): void;
|
|
80
157
|
}
|
|
81
158
|
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component } from '../../ComponentManager';
|
|
2
|
+
import { LineSegment } from '../../Quadtree/LineSegment';
|
|
3
|
+
/**
|
|
4
|
+
* 转为 三维家 墙体结构
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThreeVJia extends Component<{
|
|
7
|
+
updateData: {};
|
|
8
|
+
}> {
|
|
9
|
+
static name: string;
|
|
10
|
+
lineSegments: LineSegment<any>[];
|
|
11
|
+
onAddFromParent(): void;
|
|
12
|
+
updateData(): void;
|
|
13
|
+
toJson(): {
|
|
14
|
+
version: string;
|
|
15
|
+
name: string;
|
|
16
|
+
communityName: string;
|
|
17
|
+
city: string;
|
|
18
|
+
province: string;
|
|
19
|
+
height: number;
|
|
20
|
+
walls: {
|
|
21
|
+
ID: number;
|
|
22
|
+
start: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
end: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
thickness: number;
|
|
31
|
+
type: string;
|
|
32
|
+
loadBearingWall: boolean;
|
|
33
|
+
height: number;
|
|
34
|
+
}[];
|
|
35
|
+
pillars: never[];
|
|
36
|
+
beams: never[];
|
|
37
|
+
holes: any[];
|
|
38
|
+
rooms: never[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 下载
|
|
42
|
+
* @param filename
|
|
43
|
+
*/
|
|
44
|
+
download(filename?: string): Promise<void>;
|
|
45
|
+
}
|
|
@@ -12,26 +12,21 @@ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
|
|
|
12
12
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
13
13
|
shortcutKeys: string[];
|
|
14
14
|
shortcutKeys2: string[];
|
|
15
|
+
shortcutKeys3: string[];
|
|
15
16
|
static commandName: string;
|
|
16
17
|
recursion: boolean;
|
|
18
|
+
axisAlignment: boolean;
|
|
17
19
|
onAddFromParent(parent: ComponentManager): void;
|
|
18
20
|
/**
|
|
19
21
|
* 进入命令约束
|
|
20
22
|
*/
|
|
21
23
|
constraint(next: any, selectLines: LineSegment[]): void;
|
|
22
24
|
/**
|
|
23
|
-
* 线段是否为结尾线段
|
|
24
|
-
* @param line
|
|
25
|
-
*/
|
|
26
|
-
lineIsPathEnd(line: LineSegment): boolean;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
25
|
* @param line0
|
|
30
26
|
* @param line1
|
|
31
27
|
*/
|
|
32
28
|
isTowLineSegmentConnect(line0: LineSegment, line1: LineSegment): boolean;
|
|
33
29
|
/**
|
|
34
|
-
*
|
|
35
30
|
* @param line
|
|
36
31
|
* @param newStartPoint
|
|
37
32
|
* @param newEndPoint
|
|
@@ -55,6 +50,14 @@ export declare class VerticalCorrection extends CommandFlowComponent<{}> {
|
|
|
55
50
|
* @param vistedList
|
|
56
51
|
*/
|
|
57
52
|
correction(targettLine: LineSegment, resultList?: any[], vistedList?: Set<LineSegment>): any[];
|
|
53
|
+
/** 轴对齐垂直修正
|
|
54
|
+
* @param targettLine
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
axisAlignmentCorrection(targettLine: LineSegment): {
|
|
58
|
+
newLines: LineSegment<Record<string, any>>[];
|
|
59
|
+
oldLines: LineSegment<LineUserData>[];
|
|
60
|
+
};
|
|
58
61
|
/** 开始
|
|
59
62
|
* @param next
|
|
60
63
|
*/
|
|
@@ -13,6 +13,7 @@ export type LineUserData = {
|
|
|
13
13
|
isDoor?: boolean;
|
|
14
14
|
isWindow?: boolean;
|
|
15
15
|
isVerticalReferenceLine?: boolean;
|
|
16
|
+
wallWidth?: number;
|
|
16
17
|
drawWindow?: {
|
|
17
18
|
p: THREE.Vector3;
|
|
18
19
|
width: number;
|
|
@@ -27,10 +28,6 @@ export declare class RenderManager extends Component<{}> {
|
|
|
27
28
|
lines: LineSegment<LineUserData>[];
|
|
28
29
|
pointVirtualGrid: PointVirtualGrid<LineSegment<LineUserData>>;
|
|
29
30
|
quadtree: Quadtree<any>;
|
|
30
|
-
actionHistory: Set<{
|
|
31
|
-
type: "addLine" | "removeLine";
|
|
32
|
-
data: any;
|
|
33
|
-
}>;
|
|
34
31
|
verticalReferenceLineFlag: THREE.Mesh<THREE.PlaneGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
|
|
35
32
|
onAddFromParent(): void;
|
|
36
33
|
private updatedMode;
|
|
@@ -50,6 +47,11 @@ export declare class RenderManager extends Component<{}> {
|
|
|
50
47
|
* @param line
|
|
51
48
|
*/
|
|
52
49
|
removeLine(line: LineSegment<LineUserData>): void;
|
|
50
|
+
/**
|
|
51
|
+
* 删除
|
|
52
|
+
* @param lines
|
|
53
|
+
*/
|
|
54
|
+
removeLines(lines: LineSegment<LineUserData>[]): void;
|
|
53
55
|
/**
|
|
54
56
|
* 绘制
|
|
55
57
|
*/
|
|
@@ -3,6 +3,7 @@ import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer
|
|
|
3
3
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
4
4
|
import { Component } from '../../../../ComponentManager';
|
|
5
5
|
import { Point } from '../../../../Quadtree/Point';
|
|
6
|
+
import { LineSegment } from '../../../../Quadtree/LineSegment';
|
|
6
7
|
import * as THREE from "three";
|
|
7
8
|
export interface RendererDescription {
|
|
8
9
|
canvas: HTMLCanvasElement;
|
|
@@ -85,6 +86,6 @@ export declare class Renderer extends Component<{
|
|
|
85
86
|
* @param map
|
|
86
87
|
* @param count
|
|
87
88
|
*/
|
|
88
|
-
createLineSegments(map: Record<string, number[]
|
|
89
|
+
createLineSegments(map: Record<string, number[]> | LineSegment[], count: number, parameters?: THREE.LineBasicMaterialParameters, parent?: THREE.Object3D): THREE.LineSegments;
|
|
89
90
|
destroy(): void;
|
|
90
91
|
}
|
|
@@ -123,6 +123,11 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
123
123
|
* @param line
|
|
124
124
|
*/
|
|
125
125
|
directionEqual(line: LineSegment, errAngle?: number): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 两条线段是否平行
|
|
128
|
+
* @param line
|
|
129
|
+
*/
|
|
130
|
+
parallel(line: LineSegment, errAngle?: number): boolean;
|
|
126
131
|
/**
|
|
127
132
|
* 两条线段方向相反否一致
|
|
128
133
|
* @param line
|