build-dxf 0.0.22 → 0.0.24
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 +1371 -986
- package/src/index.css +1 -1
- package/src/index3.js +713 -693
- package/src/selectLocalFile.js +4 -0
- package/src/utils/DxfSystem/components/Dxf.d.ts +40 -13
- 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 +7 -19
- 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 +17 -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];
|
|
@@ -2,6 +2,8 @@ import { Component } from '../../ComponentManager';
|
|
|
2
2
|
import { Point } from '../../Quadtree/Point';
|
|
3
3
|
import { Box2 } from '../../Quadtree/Box2';
|
|
4
4
|
import { LineSegment } from '../../Quadtree/LineSegment';
|
|
5
|
+
import { Quadtree, QuadtreeNode } from '../../Quadtree/Quadtree';
|
|
6
|
+
import * as THREE from "three";
|
|
5
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";
|
|
6
8
|
export interface OriginalDataItem {
|
|
7
9
|
start: {
|
|
@@ -37,6 +39,7 @@ export interface OriginalDataItem {
|
|
|
37
39
|
z?: number;
|
|
38
40
|
};
|
|
39
41
|
};
|
|
42
|
+
wallWidth?: number;
|
|
40
43
|
isWindow?: boolean;
|
|
41
44
|
isVerticalReferenceLine?: boolean;
|
|
42
45
|
drawWindow?: {
|
|
@@ -49,6 +52,20 @@ export interface OriginalDataItem {
|
|
|
49
52
|
full: boolean;
|
|
50
53
|
}[];
|
|
51
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
|
+
};
|
|
52
69
|
/**
|
|
53
70
|
* [开始点, 结束点, 相交点, 是否是门, 索引]
|
|
54
71
|
*/
|
|
@@ -100,12 +117,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
100
117
|
wallsGroup: Point[][];
|
|
101
118
|
doors: DataItem[];
|
|
102
119
|
doorLineSegment: LineSegment[];
|
|
103
|
-
lineSegments: LineSegment<
|
|
104
|
-
isDoor: boolean;
|
|
105
|
-
isWindow: boolean;
|
|
106
|
-
drawDoorData: any;
|
|
107
|
-
drawWindow: any[];
|
|
108
|
-
}>[];
|
|
120
|
+
lineSegments: LineSegment<LineUserData>[];
|
|
109
121
|
originalZAverage: number;
|
|
110
122
|
static EndType: {
|
|
111
123
|
etOpenSquare: number;
|
|
@@ -119,25 +131,31 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
119
131
|
};
|
|
120
132
|
/** 原始数据组
|
|
121
133
|
*/
|
|
122
|
-
get lines(): LineSegment<
|
|
123
|
-
isDoor: boolean;
|
|
124
|
-
isWindow: boolean;
|
|
125
|
-
drawDoorData: any;
|
|
126
|
-
drawWindow: any[];
|
|
127
|
-
}>[];
|
|
134
|
+
get lines(): LineSegment<LineUserData>[];
|
|
128
135
|
/**初始化
|
|
129
136
|
* @param data 点云数据
|
|
130
137
|
* @param width 墙体宽度
|
|
131
138
|
* @param scale 缩放比例
|
|
132
139
|
*/
|
|
133
140
|
constructor(width?: number, scale?: number);
|
|
141
|
+
/**
|
|
142
|
+
* 预处理数据
|
|
143
|
+
* @param data
|
|
144
|
+
*/
|
|
145
|
+
preprocessing(data: OriginalDataItem[], axisAlignmentCorrection?: boolean): {
|
|
146
|
+
lineSegments: LineSegment<Record<string, any>>[];
|
|
147
|
+
data: OriginalDataItem[];
|
|
148
|
+
} | {
|
|
149
|
+
lineSegments: LineSegment<LineUserData>[];
|
|
150
|
+
data: OriginalDataItem[];
|
|
151
|
+
};
|
|
134
152
|
/**
|
|
135
153
|
* 设置
|
|
136
154
|
* @param data
|
|
137
155
|
* @param width
|
|
138
156
|
* @param scale
|
|
139
157
|
*/
|
|
140
|
-
set(data: OriginalDataItem[] | string, width?: number, scale?: number): Promise<any>;
|
|
158
|
+
set(data: OriginalDataItem[] | string, width?: number, scale?: number, axisAlignmentCorrection?: boolean): Promise<any>;
|
|
141
159
|
/** 创建分组
|
|
142
160
|
* @description 根据相交数组insetionArr, 把相交的线段,划分到一组内,方便后续路径查找合并使用
|
|
143
161
|
* @returns
|
|
@@ -190,6 +208,10 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
190
208
|
* @returns
|
|
191
209
|
*/
|
|
192
210
|
private getArcAngleRange;
|
|
211
|
+
/**
|
|
212
|
+
* 线段数据转为原始json数据
|
|
213
|
+
*/
|
|
214
|
+
lineDataToOriginalData(lines: LineSegment<LineUserData>[], quadtree?: Quadtree): OriginalDataItem[];
|
|
193
215
|
/**
|
|
194
216
|
* 转为绘制数据
|
|
195
217
|
*/
|
|
@@ -208,6 +230,11 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
208
230
|
* @returns
|
|
209
231
|
*/
|
|
210
232
|
toDxfBlob(unit?: Unit): Blob;
|
|
233
|
+
/**
|
|
234
|
+
* 下载原始json
|
|
235
|
+
* @param filename
|
|
236
|
+
*/
|
|
237
|
+
downloadOriginalData(filename: string): Promise<void>;
|
|
211
238
|
/**
|
|
212
239
|
* 下载
|
|
213
240
|
* @param filename
|
|
@@ -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<import('../../../../components/Dxf').LineUserData>[];
|
|
60
|
+
};
|
|
58
61
|
/** 开始
|
|
59
62
|
* @param next
|
|
60
63
|
*/
|
|
@@ -1,36 +1,19 @@
|
|
|
1
1
|
import { LineSegment } from '../../../../Quadtree/LineSegment';
|
|
2
2
|
import { Component } from '../../../../ComponentManager';
|
|
3
|
-
import { Dxf, OriginalDataItem } from '../../../components/Dxf';
|
|
3
|
+
import { Dxf, LineUserData, OriginalDataItem } from '../../../components/Dxf';
|
|
4
4
|
import { Variable } from '../../../components/Variable';
|
|
5
5
|
import { EventInput, Renderer } from '../../RenderPlugin/components';
|
|
6
6
|
import { PointVirtualGrid } from '../../../../PointVirtualGrid';
|
|
7
7
|
import { Editor } from './Editor';
|
|
8
|
-
import { Quadtree
|
|
8
|
+
import { Quadtree } from '../../../../Quadtree/Quadtree';
|
|
9
9
|
import { DxfLineModel } from '../../ModelDataPlugin/components';
|
|
10
10
|
import * as THREE from "three";
|
|
11
|
-
export type LineUserData = {
|
|
12
|
-
doorDirectConnection?: boolean;
|
|
13
|
-
isDoor?: boolean;
|
|
14
|
-
isWindow?: boolean;
|
|
15
|
-
isVerticalReferenceLine?: boolean;
|
|
16
|
-
drawWindow?: {
|
|
17
|
-
p: THREE.Vector3;
|
|
18
|
-
width: number;
|
|
19
|
-
full: boolean;
|
|
20
|
-
}[];
|
|
21
|
-
drawDoorData?: any;
|
|
22
|
-
quadtreeNode?: QuadtreeNode;
|
|
23
|
-
};
|
|
24
11
|
export declare class RenderManager extends Component<{}> {
|
|
25
12
|
static name: string;
|
|
26
13
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
27
14
|
lines: LineSegment<LineUserData>[];
|
|
28
15
|
pointVirtualGrid: PointVirtualGrid<LineSegment<LineUserData>>;
|
|
29
16
|
quadtree: Quadtree<any>;
|
|
30
|
-
actionHistory: Set<{
|
|
31
|
-
type: "addLine" | "removeLine";
|
|
32
|
-
data: any;
|
|
33
|
-
}>;
|
|
34
17
|
verticalReferenceLineFlag: THREE.Mesh<THREE.PlaneGeometry, THREE.MeshBasicMaterial, THREE.Object3DEventMap>;
|
|
35
18
|
onAddFromParent(): void;
|
|
36
19
|
private updatedMode;
|
|
@@ -50,6 +33,11 @@ export declare class RenderManager extends Component<{}> {
|
|
|
50
33
|
* @param line
|
|
51
34
|
*/
|
|
52
35
|
removeLine(line: LineSegment<LineUserData>): void;
|
|
36
|
+
/**
|
|
37
|
+
* 删除
|
|
38
|
+
* @param lines
|
|
39
|
+
*/
|
|
40
|
+
removeLines(lines: LineSegment<LineUserData>[]): void;
|
|
53
41
|
/**
|
|
54
42
|
* 绘制
|
|
55
43
|
*/
|
|
@@ -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
|
|
@@ -140,4 +145,16 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
140
145
|
*/
|
|
141
146
|
areLinesCoincident(line: LineSegment): boolean;
|
|
142
147
|
clone(): LineSegment<T>;
|
|
148
|
+
/**
|
|
149
|
+
* 轴对齐垂直修正
|
|
150
|
+
* @param lines 待调整线段组
|
|
151
|
+
* @param targettLine 轴线段
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
static axisAlignmentCorrection(lines: LineSegment[], targettLine: LineSegment): LineSegment<Record<string, any>>[];
|
|
155
|
+
/**
|
|
156
|
+
* 获取最长线段
|
|
157
|
+
* @param lines
|
|
158
|
+
*/
|
|
159
|
+
static maxLengthLineIndex(lines: LineSegment[]): number;
|
|
143
160
|
}
|