build-dxf 0.0.21 → 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 +429 -275
- package/src/index.css +1 -1
- package/src/index2.js +10 -10
- package/src/index3.js +1159 -922
- package/src/selectLocalFile.js +4 -0
- package/src/utils/DxfSystem/components/AngleCorrectionDxf.d.ts +4 -1
- 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/CommandFlowComponent.d.ts +11 -0
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +2 -6
- 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 -1
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection copy.d.ts +0 -82
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];
|
|
@@ -3,8 +3,11 @@ import { Dxf } from './Dxf';
|
|
|
3
3
|
/**
|
|
4
4
|
* 角度修正过后的DXF格式数据
|
|
5
5
|
*/
|
|
6
|
-
export declare class AngleCorrectionDxf extends Dxf<{
|
|
6
|
+
export declare class AngleCorrectionDxf extends Dxf<{
|
|
7
|
+
updateData: {};
|
|
8
|
+
}> {
|
|
7
9
|
static name: string;
|
|
10
|
+
angle: number;
|
|
8
11
|
onAddFromParent(parent: ComponentManager): void;
|
|
9
12
|
update(): Promise<void>;
|
|
10
13
|
}
|
|
@@ -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
|
+
}
|
|
@@ -4,6 +4,8 @@ import { EventInput, Renderer } from '../../../RenderPlugin/components';
|
|
|
4
4
|
import { CommandManager } from '../../../../../CommandManager';
|
|
5
5
|
import { RenderManager } from '../RenderManager';
|
|
6
6
|
import { Default } from './Default';
|
|
7
|
+
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
8
|
+
import { Point } from '../../../../../Quadtree/Point';
|
|
7
9
|
export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Component<TEventMap> {
|
|
8
10
|
private _renderer?;
|
|
9
11
|
get renderer(): Renderer;
|
|
@@ -43,4 +45,13 @@ export declare class CommandFlowComponent<TEventMap extends {} = {}> extends Com
|
|
|
43
45
|
* @returns
|
|
44
46
|
*/
|
|
45
47
|
createFinally(keys?: string[]): () => void;
|
|
48
|
+
/**
|
|
49
|
+
* 创建鼠标移动
|
|
50
|
+
* @param callBack
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
createPointerMove(callBack: (point: Point, isAdsorb: boolean) => void): {
|
|
54
|
+
destroy(): void;
|
|
55
|
+
setBaseLine(line: LineSegment | null, point: Point | null): void;
|
|
56
|
+
};
|
|
46
57
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { Component } from '../../../../../ComponentManager';
|
|
2
|
-
import { Editor } from '../Editor';
|
|
3
|
-
import { Renderer } from '../../../RenderPlugin/components';
|
|
4
1
|
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
5
2
|
import { LineUserData } from '../RenderManager';
|
|
3
|
+
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
6
4
|
import * as THREE from "three";
|
|
7
|
-
export declare class Default extends
|
|
5
|
+
export declare class Default extends CommandFlowComponent<{
|
|
8
6
|
selectLineChange: {};
|
|
9
7
|
}> {
|
|
10
8
|
static name: string;
|
|
11
|
-
get editor(): Editor;
|
|
12
|
-
renderer?: Renderer;
|
|
13
9
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
14
10
|
onAddFromParent(): void;
|
|
15
11
|
selectLines: LineSegment<LineUserData>[];
|
|
@@ -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
|
}
|
|
@@ -6,7 +6,6 @@ import { Rectangle } from './Rectangle';
|
|
|
6
6
|
export declare class LineSegment<T = Record<string, any>> {
|
|
7
7
|
points: Point[];
|
|
8
8
|
userData: T;
|
|
9
|
-
line: any;
|
|
10
9
|
get center(): Point<Record<string, any>>;
|
|
11
10
|
get start(): Point<Record<string, any>>;
|
|
12
11
|
get end(): Point<Record<string, any>>;
|
|
@@ -124,6 +123,11 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
124
123
|
* @param line
|
|
125
124
|
*/
|
|
126
125
|
directionEqual(line: LineSegment, errAngle?: number): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 两条线段是否平行
|
|
128
|
+
* @param line
|
|
129
|
+
*/
|
|
130
|
+
parallel(line: LineSegment, errAngle?: number): boolean;
|
|
127
131
|
/**
|
|
128
132
|
* 两条线段方向相反否一致
|
|
129
133
|
* @param line
|
package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/VerticalCorrection copy.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { CommandFlowComponent } from './CommandFlowComponent';
|
|
2
|
-
import { ComponentManager } from '../../../../../ComponentManager';
|
|
3
|
-
import { LineSegment } from '../../../../../Quadtree/LineSegment';
|
|
4
|
-
import { Point } from '../../../../../Quadtree/Point';
|
|
5
|
-
import * as THREE from "three";
|
|
6
|
-
/**
|
|
7
|
-
* 垂直纠正
|
|
8
|
-
*/
|
|
9
|
-
export declare class VerticalCorrection extends CommandFlowComponent<{}> {
|
|
10
|
-
static name: string;
|
|
11
|
-
container: THREE.Group<THREE.Object3DEventMap>;
|
|
12
|
-
shortcutKeys: string[];
|
|
13
|
-
shortcutKeys2: string[];
|
|
14
|
-
static commandName: string;
|
|
15
|
-
recursion: boolean;
|
|
16
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
17
|
-
/**
|
|
18
|
-
* 进入命令约束
|
|
19
|
-
*/
|
|
20
|
-
constraint(next: any, selectLines: LineSegment[]): void;
|
|
21
|
-
/**
|
|
22
|
-
* 线段是否为结尾线段
|
|
23
|
-
* @param line
|
|
24
|
-
*/
|
|
25
|
-
lineIsPathEnd(line: LineSegment): boolean;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param line0
|
|
29
|
-
* @param line1
|
|
30
|
-
*/
|
|
31
|
-
isTowLineSegmentConnect(line0: LineSegment, line1: LineSegment): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 获取所有相同点的位置信息
|
|
34
|
-
* @param point
|
|
35
|
-
* @param point2
|
|
36
|
-
*/
|
|
37
|
-
getSamePointAll(point: Point, line: LineSegment): {
|
|
38
|
-
queryList: {
|
|
39
|
-
point: Point;
|
|
40
|
-
userData?: LineSegment<import('..').LineUserData> | undefined;
|
|
41
|
-
}[];
|
|
42
|
-
parallelList: {
|
|
43
|
-
point: Point;
|
|
44
|
-
userData?: LineSegment<import('..').LineUserData> | undefined;
|
|
45
|
-
}[];
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param line
|
|
50
|
-
* @param point
|
|
51
|
-
* @param newPoint
|
|
52
|
-
*/
|
|
53
|
-
setLinePoint(line: LineSegment, newStartPoint?: Point, newEndPoint?: Point, mode?: "start" | "end" | "all", record?: any[]): void;
|
|
54
|
-
/** 修正2
|
|
55
|
-
* 第一步:确定需要修复的线段
|
|
56
|
-
* 第二步:查找与该线段相交的其他线段
|
|
57
|
-
* 第三步:找出两端点相交的线段,其他为区间相交
|
|
58
|
-
* 第四步:修正相交的线段的另一个端点
|
|
59
|
-
* 第五步:判断是否有方向一致的线段,有就调整,调整方法:查找连续平行的线段,求点在线段方向的投影,直到不平行的线段结束
|
|
60
|
-
* 第六步: 中间线段采用投影修正
|
|
61
|
-
* @param targettLine
|
|
62
|
-
* @param vistedList
|
|
63
|
-
*/
|
|
64
|
-
correction(targettLine: LineSegment, entryPoint?: Point, resultList?: any[], vistedList?: Set<LineSegment | Point>): any[] | undefined;
|
|
65
|
-
/** 开始
|
|
66
|
-
* @param next
|
|
67
|
-
*/
|
|
68
|
-
verticalCorrection(next: any, selectLines: LineSegment[]): void;
|
|
69
|
-
/** 执行完成
|
|
70
|
-
* @param data
|
|
71
|
-
*/
|
|
72
|
-
private completed;
|
|
73
|
-
/** 回滚操作
|
|
74
|
-
* @param data
|
|
75
|
-
*/
|
|
76
|
-
private rollback;
|
|
77
|
-
/** 撤回回滚
|
|
78
|
-
* @param lines
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
private revokeRollback;
|
|
82
|
-
}
|