build-dxf 0.0.57 → 0.0.59
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 +4 -2
- package/src/DomEventRegister.js +3117 -1926
- package/src/bin/Main.js +269 -0
- package/src/bin/mini_cycles.js +15 -0
- package/src/bin/mini_cycles.wasm +0 -0
- package/src/bin/mini_cycles.wasm.map +1 -0
- package/src/bin/wasm_mini_cycles.js +296 -0
- package/src/build.d.ts +33 -0
- package/src/build.js +12332 -5002
- package/src/constants.d.ts +8 -0
- package/src/index.css +777 -1
- package/src/index.js +12 -9
- package/src/index2.js +516 -327
- package/src/index3.js +2755 -1739
- package/src/pages/Test.vue.d.ts +2 -0
- package/src/pages/buildJson.vue.d.ts +4 -0
- package/src/pages/modelCarrier/index.vue.d.ts +2 -0
- package/src/utils/Debouncing.d.ts +7 -0
- package/src/utils/DxfSystem/DxfSystem.d.ts +4 -5
- package/src/utils/DxfSystem/components/CorrectionDxf.d.ts +126 -0
- package/src/utils/DxfSystem/components/Dxf.d.ts +2 -3
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/Default.d.ts +16 -6
- package/src/utils/DxfSystem/plugin/Editor/components/CommandFlow/DeleteSelectLine.d.ts +2 -6
- package/src/utils/DxfSystem/plugin/Editor/components/RenderManager.d.ts +2 -2
- package/src/utils/DxfSystem/plugin/ModelDataPlugin/components/WhiteModel.d.ts +1 -1
- package/src/utils/DxfSystem/type.d.ts +4 -1
- package/src/utils/DxfSystem/utils/AxisAlignCorr.d.ts +2 -2
- package/src/utils/DxfSystem/utils/CAD.d.ts +149 -5
- package/src/utils/DxfSystem/utils/LineGroupType.d.ts +11 -0
- package/src/utils/DxfSystem/utils/getWinDrawData.d.ts +18 -0
- package/src/utils/LineSegment.d.ts +1 -0
- package/src/utils/LoadModel.d.ts +7 -0
- package/src/utils/Map.d.ts +3 -0
- package/src/utils/Point.d.ts +3 -2
- package/src/utils/Polygon.d.ts +17 -1
- package/src/utils/Rectangle.d.ts +1 -0
- package/src/utils/fff.d.ts +1 -0
- package/src/utils/modelScenario/scenario.d.ts +64 -0
- package/src/utils/DxfSystem/components/AngleCorrectionDxf.d.ts +0 -13
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
2
|
+
dom: HTMLDivElement;
|
|
3
|
+
}, any>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentManager } from '../ComponentManager';
|
|
2
|
-
import {
|
|
2
|
+
import { CorrectionDxf } from './components/CorrectionDxf';
|
|
3
3
|
import { DoorsAnalysisComponent } from './components/DoorsAnalysis';
|
|
4
4
|
import { Dxf } from './components/Dxf';
|
|
5
5
|
import { LineAnalysis } from './components/LineAnalysis';
|
|
@@ -7,18 +7,17 @@ import { ThreeVJia } from './components/ThreeVJia';
|
|
|
7
7
|
import { Variable } from './components/Variable';
|
|
8
8
|
export declare class DxfSystem extends ComponentManager {
|
|
9
9
|
Dxf: Dxf;
|
|
10
|
-
AngleCorrectionDxf: AngleCorrectionDxf;
|
|
11
10
|
Variable: Variable;
|
|
12
11
|
LineAnalysis: LineAnalysis;
|
|
13
12
|
DoorsAnalysis: DoorsAnalysisComponent;
|
|
13
|
+
CorrectionDxf: CorrectionDxf;
|
|
14
14
|
wallWidth: number;
|
|
15
15
|
environment: "node" | "browser" | "unknown";
|
|
16
16
|
static finalInstance?: DxfSystem;
|
|
17
17
|
/** 构造函数
|
|
18
18
|
* @param wallWidth 输出墙壁厚度,该墙壁厚度不受缩放影响
|
|
19
|
-
* @param scale 原始数据缩放比例
|
|
20
19
|
*/
|
|
21
|
-
constructor(wallWidth?: number
|
|
20
|
+
constructor(wallWidth?: number);
|
|
22
21
|
usePlugin(plugin: (this: DxfSystem, dxfSystem: DxfSystem) => void): this;
|
|
23
22
|
destroy(): void;
|
|
24
23
|
}
|
|
@@ -28,6 +27,6 @@ declare const components: {
|
|
|
28
27
|
Variable: typeof Variable;
|
|
29
28
|
Dxf: typeof Dxf;
|
|
30
29
|
DoorsAnalysisComponent: typeof DoorsAnalysisComponent;
|
|
31
|
-
|
|
30
|
+
CorrectionDxf: typeof CorrectionDxf;
|
|
32
31
|
};
|
|
33
32
|
export { components };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Component } from '../../ComponentManager';
|
|
2
|
+
import { Box2 } from '../../Box2';
|
|
3
|
+
import { LineSegment } from '../../LineSegment';
|
|
4
|
+
import { Quadtree } from '../../Quadtree';
|
|
5
|
+
import { SetDataOption, DataItem, LineUserData, OriginalDataItem, Unit } from '../type';
|
|
6
|
+
import { CAD } from '../utils/CAD';
|
|
7
|
+
import { DxfSystem } from '../DxfSystem';
|
|
8
|
+
type PreProcessor = (lines: LineSegment[], option: SetDataOption) => LineSegment[];
|
|
9
|
+
export declare const PRE_PROCESSOR: Record<"DoorsAnalysis" | "AxisAlignCorr" | "BoundExt" | "AngleCorr" | "ResetGeometricCenter", PreProcessor>;
|
|
10
|
+
/**
|
|
11
|
+
* 将点云结构转换为DXF格式
|
|
12
|
+
*/
|
|
13
|
+
export declare class CorrectionDxf<TEventMap extends {} = {}> extends Component<{
|
|
14
|
+
dataChange: {
|
|
15
|
+
originalData: OriginalDataItem[];
|
|
16
|
+
data: DataItem[];
|
|
17
|
+
cad: CAD;
|
|
18
|
+
};
|
|
19
|
+
cadChange: {
|
|
20
|
+
cad: CAD;
|
|
21
|
+
};
|
|
22
|
+
preprocessing: {
|
|
23
|
+
data: OriginalDataItem[];
|
|
24
|
+
setData(data: OriginalDataItem[]): void;
|
|
25
|
+
};
|
|
26
|
+
} & TEventMap> {
|
|
27
|
+
static name: string;
|
|
28
|
+
static readonly PRE_PROCESSOR: Record<"DoorsAnalysis" | "AxisAlignCorr" | "BoundExt" | "AngleCorr" | "ResetGeometricCenter", PreProcessor>;
|
|
29
|
+
width: number;
|
|
30
|
+
originalData: OriginalDataItem[];
|
|
31
|
+
data: DataItem[];
|
|
32
|
+
box: Box2;
|
|
33
|
+
cad: CAD | null;
|
|
34
|
+
lineSegments: LineSegment<LineUserData>[];
|
|
35
|
+
doorLineSegment: LineSegment[];
|
|
36
|
+
verticalReferenceLine?: LineSegment<LineUserData>;
|
|
37
|
+
originalZAverage: number;
|
|
38
|
+
private _preProcessorSet;
|
|
39
|
+
trajectory: Record<string, any> | null;
|
|
40
|
+
onBoundExt?: (lines: LineSegment[], trajectory: any) => void;
|
|
41
|
+
/** 原始数据组
|
|
42
|
+
*/
|
|
43
|
+
get lines(): LineSegment<LineUserData>[];
|
|
44
|
+
/**初始化
|
|
45
|
+
* @param width 墙体宽度
|
|
46
|
+
*/
|
|
47
|
+
constructor(width?: number);
|
|
48
|
+
setTrajectory(trajectory: Record<string, any> | null, onBoundExt?: (lines: LineSegment[], trajectory: any) => void): this;
|
|
49
|
+
onAddFromParent(parent: DxfSystem): void;
|
|
50
|
+
/** 完整线段数据
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
getLineSegments(clone?: boolean): LineSegment<LineUserData>[];
|
|
54
|
+
/**
|
|
55
|
+
* 预处理数据
|
|
56
|
+
* @param data
|
|
57
|
+
*/
|
|
58
|
+
private preprocessing;
|
|
59
|
+
/** 添加预处理
|
|
60
|
+
* @param handler
|
|
61
|
+
*/
|
|
62
|
+
addPreProcessor(handler: PreProcessor): this;
|
|
63
|
+
/** 删除预处理
|
|
64
|
+
* @param handler
|
|
65
|
+
*/
|
|
66
|
+
removePreProcessor(handler: PreProcessor): this;
|
|
67
|
+
/** 清空预处理
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
clearPreProcessor(): this;
|
|
71
|
+
/** 设置
|
|
72
|
+
* @param data 房屋结构数据,node环境可以为路径
|
|
73
|
+
* @param width 墙体宽度
|
|
74
|
+
* @param scale 缩放比例
|
|
75
|
+
* @param axisAlignmentCorrection 需要执行轴对称垂直纠正
|
|
76
|
+
* @param option
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
set(data: OriginalDataItem[], options?: SetDataOption): void;
|
|
80
|
+
/**
|
|
81
|
+
* 线段数据转为原始json数据
|
|
82
|
+
*/
|
|
83
|
+
lineDataToOriginalData(lines: LineSegment<LineUserData>[], quadtree?: Quadtree): OriginalDataItem[];
|
|
84
|
+
/**
|
|
85
|
+
* 下载原始json
|
|
86
|
+
* @param filename
|
|
87
|
+
*/
|
|
88
|
+
downloadOriginalData(filename: string): Promise<void>;
|
|
89
|
+
/** 获取绘制数据
|
|
90
|
+
*/
|
|
91
|
+
toDrawData(unit?: Unit): {
|
|
92
|
+
unit: Unit;
|
|
93
|
+
lines: [number, number, number, number, string][];
|
|
94
|
+
arcs: [number, number, number, number, number, string][];
|
|
95
|
+
texts: [string, number, number, string][];
|
|
96
|
+
center: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
};
|
|
100
|
+
width: number;
|
|
101
|
+
height: number;
|
|
102
|
+
scale: number;
|
|
103
|
+
} | undefined;
|
|
104
|
+
/** 获取 dxf 图片 二进制对象
|
|
105
|
+
* @param type
|
|
106
|
+
*/
|
|
107
|
+
toDxfImageBlob(unit?: Unit, type?: string, background?: string): Promise<any>;
|
|
108
|
+
/** 下载 dxf 图片
|
|
109
|
+
* @param filename
|
|
110
|
+
*/
|
|
111
|
+
downloadDxfImage(filename: string, unit?: Unit, type?: string): Promise<boolean | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* 将点json结构转换为Dxf 字符串
|
|
114
|
+
*/
|
|
115
|
+
toDxfString(unit?: Unit): string | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* 将点云结构转换为 DXF 二进制对象
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
toDxfBlob(unit?: Unit): Blob | undefined;
|
|
121
|
+
/** 下载Dxf
|
|
122
|
+
* @param filename
|
|
123
|
+
*/
|
|
124
|
+
downloadDxf(filename: string, unit?: Unit): Promise<void | undefined>;
|
|
125
|
+
}
|
|
126
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import { Point } from '../../Point';
|
|
|
3
3
|
import { Box2 } from '../../Box2';
|
|
4
4
|
import { LineSegment } from '../../LineSegment';
|
|
5
5
|
import { Quadtree } from '../../Quadtree';
|
|
6
|
-
import {
|
|
6
|
+
import { SetDataOption, DataItem, DrawData, LineUserData, OriginalDataItem, Unit } from '../type';
|
|
7
7
|
/**
|
|
8
8
|
* 将点云结构转换为DXF格式
|
|
9
9
|
*/
|
|
@@ -117,7 +117,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
117
117
|
/** 垂直纠正
|
|
118
118
|
* @param option
|
|
119
119
|
*/
|
|
120
|
-
axisAlignCorr(option?:
|
|
120
|
+
axisAlignCorr(option?: SetDataOption): Promise<void>;
|
|
121
121
|
/** 完整线段数据
|
|
122
122
|
* @returns
|
|
123
123
|
*/
|
|
@@ -142,7 +142,6 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
142
142
|
*/
|
|
143
143
|
toDrawDataJson(unit?: Unit): DrawData;
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
146
145
|
* @param type
|
|
147
146
|
*/
|
|
148
147
|
toDxfImageBlob(unit?: Unit, type?: string, background?: string): Promise<any>;
|
|
@@ -4,12 +4,19 @@ import { LineUserData } from '../../../../type';
|
|
|
4
4
|
import * as THREE from "three";
|
|
5
5
|
export declare class Default extends CommandFlowComponent<{
|
|
6
6
|
selectLineChange: {};
|
|
7
|
+
selectWinLineChange: {};
|
|
7
8
|
}> {
|
|
8
9
|
static name: string;
|
|
9
10
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
10
11
|
onAddFromParent(): void;
|
|
11
12
|
selectLines: LineSegment<LineUserData>[];
|
|
12
13
|
selectLineObject3D: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
14
|
+
selectWin: any;
|
|
15
|
+
/** 设置选择的窗户线
|
|
16
|
+
* @param line
|
|
17
|
+
* @param index
|
|
18
|
+
*/
|
|
19
|
+
setSelectWinLine(line: LineSegment, wiLine: LineSegment, index: number): void;
|
|
13
20
|
/** 添加选择的线段
|
|
14
21
|
* @param lineSegment
|
|
15
22
|
*/
|
|
@@ -18,17 +25,20 @@ export declare class Default extends CommandFlowComponent<{
|
|
|
18
25
|
* @param lineSegment
|
|
19
26
|
*/
|
|
20
27
|
removeSelectLine(lineSegment: LineSegment): void;
|
|
21
|
-
/**
|
|
22
|
-
* 移除所有选中线段
|
|
28
|
+
/** 移除所有选中线段
|
|
23
29
|
*/
|
|
24
30
|
removeSelectLineAll(): void;
|
|
31
|
+
getSelectData(): any;
|
|
25
32
|
private _timer;
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
private material1;
|
|
34
|
+
private material2;
|
|
35
|
+
/** 更新选择的线段
|
|
28
36
|
*/
|
|
29
37
|
updateSelectLinesGeometry(): void;
|
|
30
|
-
/**
|
|
31
|
-
|
|
38
|
+
/** 显示选择框
|
|
39
|
+
*/
|
|
40
|
+
showSelectBox(): void;
|
|
41
|
+
/** 开始执行
|
|
32
42
|
* @param next
|
|
33
43
|
*/
|
|
34
44
|
start(): void;
|
|
@@ -11,17 +11,13 @@ export declare class DeleteSelectLine extends CommandFlowComponent<{}> {
|
|
|
11
11
|
/**
|
|
12
12
|
* 进入命令约束
|
|
13
13
|
*/
|
|
14
|
-
private
|
|
15
|
-
/** 开始
|
|
16
|
-
* @param next
|
|
17
|
-
*/
|
|
18
|
-
private delete;
|
|
14
|
+
private start;
|
|
19
15
|
/** 回滚操作
|
|
20
16
|
* @param data
|
|
21
17
|
*/
|
|
22
18
|
private rollback;
|
|
23
19
|
/** 撤回回滚
|
|
24
|
-
* @param
|
|
20
|
+
* @param data
|
|
25
21
|
* @returns
|
|
26
22
|
*/
|
|
27
23
|
private revokeRollback;
|
|
@@ -33,7 +33,7 @@ export declare class RenderManager extends Component<{}> {
|
|
|
33
33
|
/** 移除线段
|
|
34
34
|
* @param line
|
|
35
35
|
*/
|
|
36
|
-
removeLine(line: LineSegment<LineUserData
|
|
36
|
+
removeLine(line: LineSegment<LineUserData>, needdraw?: boolean): void;
|
|
37
37
|
/**
|
|
38
38
|
* 删除
|
|
39
39
|
* @param lines
|
|
@@ -66,7 +66,7 @@ export declare class RenderManager extends Component<{}> {
|
|
|
66
66
|
* 转为json
|
|
67
67
|
*/
|
|
68
68
|
toJson(): OriginalDataItem[];
|
|
69
|
-
private
|
|
69
|
+
private debouncing;
|
|
70
70
|
/**
|
|
71
71
|
* 同步到dxf
|
|
72
72
|
*/
|
|
@@ -16,7 +16,7 @@ export declare class WhiteModel extends Component<{
|
|
|
16
16
|
originalWhiteMode: THREE.Group<THREE.Object3DEventMap>;
|
|
17
17
|
material: THREE.MeshStandardMaterial;
|
|
18
18
|
onAddFromParent(parent: ComponentManager): void;
|
|
19
|
-
updateModel(): void
|
|
19
|
+
updateModel(): Promise<void>;
|
|
20
20
|
/**
|
|
21
21
|
* 转为obj
|
|
22
22
|
* @returns
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QuadtreeNode } from '../Quadtree';
|
|
2
2
|
import { Point } from '../Point';
|
|
3
|
+
import { LineSegment } from '../LineSegment';
|
|
3
4
|
export 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";
|
|
4
5
|
export interface GroupItem {
|
|
5
6
|
id: string;
|
|
@@ -100,7 +101,7 @@ export type DrawData = {
|
|
|
100
101
|
scale: number;
|
|
101
102
|
};
|
|
102
103
|
export type FittingMethodType = "average" | "max";
|
|
103
|
-
export type
|
|
104
|
+
export type SetDataOption = {
|
|
104
105
|
/**
|
|
105
106
|
* 主轴阈值,默认 0.3 groupMethod是precision时生效
|
|
106
107
|
*/
|
|
@@ -131,6 +132,8 @@ export type AxisAlignmentCorrectionOption = {
|
|
|
131
132
|
*/
|
|
132
133
|
adsorptionMethod?: "originalInterPoint" | "adsorption";
|
|
133
134
|
wallGroup?: boolean;
|
|
135
|
+
trajectory?: Record<string, any>;
|
|
136
|
+
onBoundExt?: (lines: LineSegment[], trajectory: any) => void;
|
|
134
137
|
};
|
|
135
138
|
/**
|
|
136
139
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineSegment } from '../../LineSegment';
|
|
2
|
-
import {
|
|
2
|
+
import { SetDataOption, LineUserData } from '../type';
|
|
3
3
|
/**
|
|
4
4
|
* 轴对齐垂直纠正类
|
|
5
5
|
*/
|
|
@@ -10,5 +10,5 @@ export declare class AxisAlignCorr {
|
|
|
10
10
|
* @param targettLine 轴线段
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
static correction(lines: LineSegment<LineUserData>[], targettLine: LineSegment<LineUserData>, option?:
|
|
13
|
+
static correction(lines: LineSegment<LineUserData>[], targettLine: LineSegment<LineUserData>, option?: SetDataOption): LineSegment<any>[];
|
|
14
14
|
}
|
|
@@ -1,17 +1,161 @@
|
|
|
1
1
|
import { LineSegment } from '../../LineSegment';
|
|
2
|
-
import { LineUserData } from '../type';
|
|
2
|
+
import { LineUserData, Unit } from '../type';
|
|
3
|
+
import { Point } from '../../Point';
|
|
3
4
|
type LineSegmentType = LineSegment<LineUserData>;
|
|
4
|
-
|
|
5
|
+
type JoinType = "jtMiter" | "jtSquare" | "jtRound";
|
|
6
|
+
type EndType = "etOpenSquare" | "etOpenButt" | "etOpenRound";
|
|
7
|
+
type DrawData = {
|
|
8
|
+
unit: Unit;
|
|
9
|
+
lines: [number, number, number, number, string][];
|
|
10
|
+
arcs: [number, number, number, number, number, string][];
|
|
11
|
+
texts: [string, number, number, string][];
|
|
12
|
+
center: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
scale: number;
|
|
19
|
+
};
|
|
20
|
+
export type CADDrawHandler = {
|
|
21
|
+
handler: (opt: {
|
|
22
|
+
drawLine(p1: Point, p2: Point): void;
|
|
23
|
+
drawArc(pos: Point, radius: number, startAngle: number, endAngle: number): void;
|
|
24
|
+
drawDottedLine(p1: Point, p2: Point, dash?: number, gap?: number): void;
|
|
25
|
+
drawRulerLine(p1: Point, p2: Point): void;
|
|
26
|
+
group: Group;
|
|
27
|
+
setColor: (color: string) => void;
|
|
28
|
+
}) => void;
|
|
29
|
+
type: string[];
|
|
30
|
+
};
|
|
31
|
+
export interface ICADPlugin {
|
|
32
|
+
install(cad: CAD): void;
|
|
33
|
+
}
|
|
34
|
+
declare class Group {
|
|
35
|
+
type: string;
|
|
36
|
+
userData: Record<string, any>;
|
|
37
|
+
constructor(lines?: LineSegmentType[], type?: string, userData?: {});
|
|
5
38
|
lines: LineSegmentType[];
|
|
6
39
|
/** 添加线段
|
|
7
40
|
* @param arg
|
|
8
41
|
*/
|
|
9
42
|
addLine(...arg: LineSegmentType[]): void;
|
|
10
|
-
removeLine(): void;
|
|
11
|
-
|
|
43
|
+
removeLine(...lines: LineSegment[]): void;
|
|
44
|
+
clone(): Group;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 适用于所有线段
|
|
48
|
+
*/
|
|
49
|
+
export declare class CAD {
|
|
50
|
+
groups: Group[];
|
|
51
|
+
private _drawHandlerMap;
|
|
52
|
+
needUpdate: boolean;
|
|
53
|
+
getAllLines(): LineSegmentType[];
|
|
54
|
+
/** 添加组
|
|
55
|
+
* @param lines
|
|
56
|
+
* @param type
|
|
57
|
+
*/
|
|
58
|
+
addGroup(lines: LineSegmentType[], type?: string, userData?: Record<string, any>): Group;
|
|
59
|
+
/** 添加组
|
|
60
|
+
* @param lines
|
|
61
|
+
* @param type
|
|
62
|
+
*/
|
|
63
|
+
addGroups(groups: LineSegmentType[][], type?: string): Group[];
|
|
64
|
+
/** 添加组并执行偏移
|
|
12
65
|
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
13
66
|
*/
|
|
14
|
-
|
|
67
|
+
addGroupByOffset2(lines: LineSegmentType[], joinType?: JoinType, endType?: EndType, scale?: number): this;
|
|
68
|
+
/** 添加组并执行偏移
|
|
69
|
+
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
70
|
+
*/
|
|
71
|
+
addGroupByOffset(lines: LineSegmentType[], joinType?: JoinType, endType?: EndType, scale?: number): this;
|
|
72
|
+
/**
|
|
73
|
+
* 合并所有组
|
|
74
|
+
*/
|
|
75
|
+
unionGroupAll(): void;
|
|
76
|
+
/** 旋转
|
|
77
|
+
* @param angle 弧度
|
|
78
|
+
*/
|
|
79
|
+
rotate(angle: number): void;
|
|
80
|
+
/**
|
|
81
|
+
* 重置原点
|
|
82
|
+
*/
|
|
83
|
+
resetOrigin(): void;
|
|
84
|
+
/**
|
|
85
|
+
* 重置原点和旋转
|
|
86
|
+
* @param angle
|
|
87
|
+
*/
|
|
88
|
+
rotateAndResetOrigin(angle: number): void;
|
|
89
|
+
/** 添加绘制处理
|
|
90
|
+
* @param handler
|
|
91
|
+
*/
|
|
92
|
+
addDrawHandler(handler: CADDrawHandler): void;
|
|
93
|
+
/**
|
|
94
|
+
* 转为绘制数据
|
|
95
|
+
*/
|
|
96
|
+
private _cachedDrawData;
|
|
97
|
+
toDrawData(unit?: Unit): DrawData;
|
|
98
|
+
/** 转为图片
|
|
99
|
+
* @param type
|
|
100
|
+
*/
|
|
101
|
+
toDxfImageBlob(unit?: Unit, type?: string, background?: string): Promise<any>;
|
|
102
|
+
/** 下载为图片
|
|
103
|
+
* @param filename
|
|
104
|
+
* @param unit
|
|
105
|
+
* @param type
|
|
106
|
+
* @returns
|
|
107
|
+
*/
|
|
108
|
+
downloadDxfImage(filename: string, unit?: Unit, type?: string): Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* 将点json结构转换为Dxf string
|
|
111
|
+
*/
|
|
112
|
+
toDxfString(unit?: Unit): string;
|
|
113
|
+
/**
|
|
114
|
+
* 将点云结构转换为DXF格式
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
toDxfBlob(unit?: Unit): Blob;
|
|
118
|
+
/** 下载为dxf
|
|
119
|
+
* @param filename
|
|
120
|
+
* @param unit
|
|
121
|
+
*/
|
|
122
|
+
downloadDxf(filename: string, unit?: Unit): Promise<void>;
|
|
123
|
+
/** 使用插件
|
|
124
|
+
* @param plugin
|
|
125
|
+
*/
|
|
126
|
+
usePlugin(plugin: ICADPlugin): this;
|
|
127
|
+
clone(): CAD;
|
|
15
128
|
clear(): void;
|
|
129
|
+
/** 计算图的倾斜度
|
|
130
|
+
* @param cad
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
static obliquity(cad: CAD): {
|
|
134
|
+
angle: number;
|
|
135
|
+
referenceLine: LineSegment<Record<string, any>>;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/** dxf 数据处理插件
|
|
139
|
+
*/
|
|
140
|
+
export declare class DxfDrawPlugin implements ICADPlugin {
|
|
141
|
+
/** 获取角度范围
|
|
142
|
+
* @param center
|
|
143
|
+
* @param p1
|
|
144
|
+
* @param p2
|
|
145
|
+
* @returns
|
|
146
|
+
*/
|
|
147
|
+
private getArcAngleRange;
|
|
148
|
+
install(cad: CAD): void;
|
|
149
|
+
}
|
|
150
|
+
/** dxf 绘制插件
|
|
151
|
+
*/
|
|
152
|
+
export declare class DxfDataPlugin implements ICADPlugin {
|
|
153
|
+
lines: LineSegment<LineUserData>[];
|
|
154
|
+
constructor(lines: LineSegment<LineUserData>[]);
|
|
155
|
+
/** 初始化数据
|
|
156
|
+
* @param cad
|
|
157
|
+
*/
|
|
158
|
+
static initData(cad: CAD, lines: LineSegment<LineUserData>[]): void;
|
|
159
|
+
install(cad: CAD): void;
|
|
16
160
|
}
|
|
17
161
|
export {};
|
|
@@ -18,6 +18,17 @@ export declare class LineGroupType {
|
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
20
|
static set(line: LineSegment<LineUserData>, id: string, type: string): void;
|
|
21
|
+
/** 通过类型获取id
|
|
22
|
+
* @param line
|
|
23
|
+
* @param type
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
static getIdByType(line: LineSegment<LineUserData>, type: string): string | undefined;
|
|
27
|
+
/** 通过类型获取所有组
|
|
28
|
+
* @param lines
|
|
29
|
+
* @param type
|
|
30
|
+
*/
|
|
31
|
+
static getGroupsByType(lines: LineSegment[], type: string): LineSegment<Record<string, any>>[][];
|
|
21
32
|
/**
|
|
22
33
|
* 替换线段中的分组信息
|
|
23
34
|
* @param line
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LineSegment } from '../../LineSegment';
|
|
2
|
+
import { LineUserData } from '../type';
|
|
3
|
+
import { PointVirtualGrid } from '../../PointVirtualGrid';
|
|
4
|
+
/**
|
|
5
|
+
* @param line
|
|
6
|
+
*/
|
|
7
|
+
export declare function winDrawLine(line: LineSegment<LineUserData>, grid?: PointVirtualGrid): LineSegment<any>[] | null;
|
|
8
|
+
/** 获取双线窗户线段
|
|
9
|
+
* @param lines
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function doubleWinDrawLine(lines: LineSegment<LineUserData>[]): LineSegment<any>[] | null;
|
|
13
|
+
/** 获取窗户线段
|
|
14
|
+
* @param doubleWallGroup
|
|
15
|
+
* @param wall
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare function getWinDrawData(doubleWallGroup: LineSegment[][], wall: LineSegment[], lines?: LineSegment<LineUserData>[]): LineSegment<Record<string, any>>[];
|
|
@@ -7,6 +7,7 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
7
7
|
points: Point[];
|
|
8
8
|
userData: T;
|
|
9
9
|
currentData: Record<string | number | symbol, any>;
|
|
10
|
+
uuid: string;
|
|
10
11
|
get center(): Point<Record<string, any>>;
|
|
11
12
|
get start(): Point<Record<string, any>>;
|
|
12
13
|
get end(): Point<Record<string, any>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Group } from 'three';
|
|
2
|
+
export declare class LoadModel {
|
|
3
|
+
private static _cache;
|
|
4
|
+
private static _nameMap;
|
|
5
|
+
static addNameMap(mapName: string, name: string): void;
|
|
6
|
+
static loadGlb(name: string): Promise<Group<import('three').Object3DEventMap>> | undefined;
|
|
7
|
+
}
|
package/src/utils/Map.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export declare class MapEnhance<K, V> extends Map<K, V> {
|
|
|
15
15
|
export declare class ArrayMap<K, V> extends MapEnhance<K, V[]> {
|
|
16
16
|
append(k: K, ...arr: V[]): this;
|
|
17
17
|
}
|
|
18
|
+
export declare class SetMap<K, V> extends MapEnhance<K, Set<V>> {
|
|
19
|
+
append(k: K, ...arr: V[]): this;
|
|
20
|
+
}
|
|
18
21
|
export declare class CountMap<K> extends MapEnhance<K, number> {
|
|
19
22
|
set(key: K): this;
|
|
20
23
|
}
|
package/src/utils/Point.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export declare class Point<T = Record<string, any>> {
|
|
|
99
99
|
* @param direction
|
|
100
100
|
* @param length
|
|
101
101
|
*/
|
|
102
|
-
expandAsLine<T = any>(direction: Point, length: number, userData?: T): LineSegment<T>;
|
|
102
|
+
expandAsLine<T = any>(direction: Point, length: number, userData?: T, line?: LineSegment<T>): LineSegment<T>;
|
|
103
103
|
/**
|
|
104
104
|
* 计算模长
|
|
105
105
|
* @returns
|
|
@@ -158,8 +158,9 @@ export declare class Point<T = Record<string, any>> {
|
|
|
158
158
|
y: number;
|
|
159
159
|
z: number;
|
|
160
160
|
};
|
|
161
|
+
static adsorb(points: Point[], tolerance?: number): Point<Record<string, any>>[];
|
|
161
162
|
static from(arr: any): Point<Record<string, any>>;
|
|
162
163
|
static zero(): Point<Record<string, any>>;
|
|
163
164
|
private static distanceClearQueue;
|
|
164
|
-
static addDistanceCacheClear
|
|
165
|
+
private static addDistanceCacheClear;
|
|
165
166
|
}
|
package/src/utils/Polygon.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { Box2 } from './Box2';
|
|
|
2
2
|
import { LineSegment } from './LineSegment';
|
|
3
3
|
import { Point } from './Point';
|
|
4
4
|
export declare class Polygon<T = any> extends Array<Point<T>> {
|
|
5
|
+
[Symbol.iterator](): ArrayIterator<Point<T>>;
|
|
5
6
|
constructor(points?: Point<T>[]);
|
|
7
|
+
set(points?: Point<T>[]): void;
|
|
6
8
|
/** 计算二维包围盒
|
|
7
9
|
* @returns
|
|
8
10
|
*/
|
|
@@ -23,19 +25,33 @@ export declare class Polygon<T = any> extends Array<Point<T>> {
|
|
|
23
25
|
* @returns
|
|
24
26
|
*/
|
|
25
27
|
pointWithin(point: Point): boolean;
|
|
28
|
+
/** 缩放
|
|
29
|
+
* @param scale
|
|
30
|
+
*/
|
|
31
|
+
scale(scale?: number): this;
|
|
32
|
+
/**
|
|
33
|
+
* @param polygon
|
|
34
|
+
*/
|
|
35
|
+
union(polygon: Polygon): boolean;
|
|
26
36
|
/** 转为线段
|
|
27
37
|
* @param closed
|
|
28
38
|
* @returns
|
|
29
39
|
*/
|
|
30
40
|
toLines(closed?: boolean): LineSegment<Record<string, any>>[];
|
|
41
|
+
close(): this;
|
|
31
42
|
/** 通过线段创建, 默认路径只有一条
|
|
32
43
|
* @param lines
|
|
33
44
|
* @returns
|
|
34
45
|
*/
|
|
35
46
|
static fromByLines(lines: LineSegment[]): Polygon<Record<string, any>>;
|
|
47
|
+
/** 通过线段创建, 默认路径只有一条
|
|
48
|
+
* @param lines
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
static fromByLines2(lines: LineSegment[], skipGroup?: boolean): Polygon<any>;
|
|
36
52
|
/** 通过线段创建,返回所有路径
|
|
37
53
|
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
38
54
|
* @param lines
|
|
39
55
|
*/
|
|
40
|
-
static multipleFromByLines(lines: LineSegment[]): Polygon<
|
|
56
|
+
static multipleFromByLines(lines: LineSegment[]): Polygon<any>[];
|
|
41
57
|
}
|
package/src/utils/Rectangle.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class Rectangle {
|
|
|
12
12
|
get p3(): Point<Record<string, any>>;
|
|
13
13
|
get path(): number[];
|
|
14
14
|
path2D(callback?: (point1: Point, point2: Point) => void): number[];
|
|
15
|
+
toLines(): LineSegment<Record<string, any>>[];
|
|
15
16
|
createGeometry(): number[];
|
|
16
17
|
constructor(points: Point[]);
|
|
17
18
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|