build-dxf 0.0.50 → 0.0.52
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/{selectLocalFile.js → DomEventRegister.js} +738 -806
- package/src/build.d.ts +2 -2
- package/src/build.js +2678 -1985
- package/src/index.js +6 -6
- package/src/index2.js +8 -8
- package/src/index3.js +297 -428
- package/src/utils/Box2.d.ts +1 -1
- package/src/utils/DxfSystem/DxfSystem.d.ts +10 -0
- package/src/utils/DxfSystem/components/ThreeVJia.d.ts +7 -45
- package/src/utils/DxfSystem/index.d.ts +1 -1
- package/src/utils/DxfSystem/plugin/Editor/index.d.ts +1 -0
- package/src/utils/DxfSystem/utils/BoundExt.d.ts +27 -1
- package/src/utils/DxfSystem/utils/DoubleWallHelper.d.ts +15 -0
- package/src/utils/DxfSystem/utils/LineGroupType.d.ts +12 -1
- package/src/utils/DxfSystem/utils/buildGroup.d.ts +12 -0
- package/src/utils/DxfSystem/utils/clippingDoubleWall.d.ts +1 -1
- package/src/utils/DxfSystem/utils/findDiscretePointLine.d.ts +9 -2
- package/src/utils/DxfSystem/utils/index.d.ts +8 -2
- package/src/utils/DxfSystem/utils/lineDataToThreeVJiaJson.d.ts +46 -0
- package/src/utils/DxfSystem/utils/mergeSmallestCircle.d.ts +1 -1
- package/src/utils/DxfSystem/utils/recomputedWindow.d.ts +4 -0
- package/src/utils/DxfSystem/utils/{createPointVirtualGrid.d.ts → tools.d.ts} +2 -0
- package/src/utils/LineSegment.d.ts +10 -4
- package/src/utils/Point.d.ts +4 -1
- package/src/utils/PointVirtualGrid/index.d.ts +13 -2
- package/src/utils/Polygon.d.ts +6 -1
- package/src/utils/UndirectedGraph.d.ts +13 -0
- package/src/utils/index.d.ts +3 -3
- /package/src/utils/DxfSystem/utils/{findClosedPolygons01.d.ts → findClosedPolygons.d.ts} +0 -0
package/src/utils/Box2.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { AngleCorrectionDxf } from './components/AngleCorrectionDxf';
|
|
|
3
3
|
import { DoorsAnalysisComponent } from './components/DoorsAnalysis';
|
|
4
4
|
import { Dxf } from './components/Dxf';
|
|
5
5
|
import { LineAnalysis } from './components/LineAnalysis';
|
|
6
|
+
import { ThreeVJia } from './components/ThreeVJia';
|
|
6
7
|
import { Variable } from './components/Variable';
|
|
7
8
|
export declare class DxfSystem extends ComponentManager {
|
|
8
9
|
Dxf: Dxf;
|
|
@@ -21,3 +22,12 @@ export declare class DxfSystem extends ComponentManager {
|
|
|
21
22
|
usePlugin(plugin: (this: DxfSystem, dxfSystem: DxfSystem) => void): this;
|
|
22
23
|
destroy(): void;
|
|
23
24
|
}
|
|
25
|
+
declare const components: {
|
|
26
|
+
LineAnalysis: typeof LineAnalysis;
|
|
27
|
+
ThreeVJia: typeof ThreeVJia;
|
|
28
|
+
Variable: typeof Variable;
|
|
29
|
+
Dxf: typeof Dxf;
|
|
30
|
+
DoorsAnalysisComponent: typeof DoorsAnalysisComponent;
|
|
31
|
+
AngleCorrectionDxf: typeof AngleCorrectionDxf;
|
|
32
|
+
};
|
|
33
|
+
export { components };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from '../../ComponentManager';
|
|
2
2
|
import { LineSegment } from '../../LineSegment';
|
|
3
3
|
import { LineUserData } from '../type';
|
|
4
|
-
import {
|
|
4
|
+
import { ThreeVJiaJsonObject } from '../utils/lineDataToThreeVJiaJson';
|
|
5
5
|
/**
|
|
6
6
|
* 转为 三维家 墙体结构
|
|
7
7
|
*/
|
|
@@ -14,54 +14,16 @@ export declare class ThreeVJia extends Component<{
|
|
|
14
14
|
/**
|
|
15
15
|
*/
|
|
16
16
|
onAddFromParent(): void;
|
|
17
|
-
|
|
18
|
-
* @param lines
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
getGroups(lines: LineSegment<LineUserData>[]): ArrayMap<string, LineSegment<Record<string, any>>> | null;
|
|
17
|
+
private cacheJson?;
|
|
22
18
|
/** 更新
|
|
23
19
|
*/
|
|
24
20
|
updateData(): void;
|
|
25
|
-
/**
|
|
26
|
-
* @param
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 角度纠正
|
|
31
|
-
*/
|
|
32
|
-
angleCorrection(): void;
|
|
33
|
-
/**
|
|
34
|
-
* 处理没有分组
|
|
21
|
+
/** 转为json
|
|
22
|
+
* @param name
|
|
23
|
+
* @param communityName
|
|
24
|
+
* @returns
|
|
35
25
|
*/
|
|
36
|
-
|
|
37
|
-
toJson(): {
|
|
38
|
-
version: string;
|
|
39
|
-
name: string;
|
|
40
|
-
communityName: string;
|
|
41
|
-
city: string;
|
|
42
|
-
province: string;
|
|
43
|
-
height: number;
|
|
44
|
-
walls: {
|
|
45
|
-
ID: number;
|
|
46
|
-
start: {
|
|
47
|
-
x: number;
|
|
48
|
-
y: number;
|
|
49
|
-
};
|
|
50
|
-
end: {
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
};
|
|
54
|
-
thickness: number;
|
|
55
|
-
type: string;
|
|
56
|
-
isDoor: boolean | undefined;
|
|
57
|
-
loadBearingWall: boolean;
|
|
58
|
-
height: number;
|
|
59
|
-
}[];
|
|
60
|
-
pillars: never[];
|
|
61
|
-
beams: never[];
|
|
62
|
-
holes: any[];
|
|
63
|
-
rooms: never[];
|
|
64
|
-
};
|
|
26
|
+
toJson(name?: string, communityName?: string): ThreeVJiaJsonObject | undefined;
|
|
65
27
|
/**
|
|
66
28
|
* 下载
|
|
67
29
|
* @param filename
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './DxfSystem';
|
|
2
|
-
export *
|
|
2
|
+
export * from './utils';
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { LineSegment } from '../../LineSegment';
|
|
2
2
|
import { Point } from '../../Point';
|
|
3
3
|
import { LineUserData, OriginalDataItem } from '../type';
|
|
4
|
+
interface IByTraj {
|
|
5
|
+
lines: LineSegment[];
|
|
6
|
+
trajectory: any;
|
|
7
|
+
wallWidth: number;
|
|
8
|
+
updateDoubleWallGroup?: boolean;
|
|
9
|
+
findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
|
|
10
|
+
}
|
|
11
|
+
interface IByTrajAnOriginData {
|
|
12
|
+
data: OriginalDataItem[];
|
|
13
|
+
trajectory: any;
|
|
14
|
+
wallWidth: number;
|
|
15
|
+
updateDoubleWallGroup?: boolean;
|
|
16
|
+
findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
|
|
17
|
+
}
|
|
4
18
|
export declare class BoundExt {
|
|
5
19
|
/** 通过轨迹点查找外墙
|
|
6
20
|
* @param lines
|
|
@@ -16,5 +30,17 @@ export declare class BoundExt {
|
|
|
16
30
|
* @param lines
|
|
17
31
|
* @param trajectoryPoints
|
|
18
32
|
*/
|
|
19
|
-
static
|
|
33
|
+
static boundExtbyTrajAndOriginalData(opt: IByTrajAnOriginData): OriginalDataItem[];
|
|
34
|
+
/** 通过轨迹点外扩边线
|
|
35
|
+
* @param lines
|
|
36
|
+
* @param trajectory
|
|
37
|
+
* @param wallWidth
|
|
38
|
+
* @param findCallBack
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
static boundExtbyTraj(opt: IByTraj): {
|
|
42
|
+
lines: LineSegment<Record<string, any>>[];
|
|
43
|
+
toOriginalData(originalZAverage: number): OriginalDataItem[];
|
|
44
|
+
};
|
|
20
45
|
}
|
|
46
|
+
export {};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { LineSegment } from '../../LineSegment';
|
|
2
|
+
import { Quadtree } from '../../Quadtree';
|
|
2
3
|
import { LineUserData } from '../type';
|
|
4
|
+
type ProjectionAnalysisResult = {
|
|
5
|
+
source: LineSegment;
|
|
6
|
+
sourceIndex: number;
|
|
7
|
+
target: LineSegment;
|
|
8
|
+
targetIndex: number;
|
|
9
|
+
project: LineSegment;
|
|
10
|
+
project2: LineSegment;
|
|
11
|
+
};
|
|
3
12
|
export declare class DoubleWallHelper {
|
|
4
13
|
static errorAngle: number;
|
|
5
14
|
/** 线段投影分析
|
|
@@ -9,6 +18,11 @@ export declare class DoubleWallHelper {
|
|
|
9
18
|
* @returns
|
|
10
19
|
*/
|
|
11
20
|
private static projectionAnalysis;
|
|
21
|
+
static findDoubleLine(lines: LineSegment<LineUserData>[], wallWidth?: number): {
|
|
22
|
+
resultList: ProjectionAnalysisResult[];
|
|
23
|
+
walls: LineSegment<LineUserData>[];
|
|
24
|
+
quadtree: Quadtree<number>;
|
|
25
|
+
};
|
|
12
26
|
/**
|
|
13
27
|
* @param lines
|
|
14
28
|
* @param wallWidth
|
|
@@ -16,3 +30,4 @@ export declare class DoubleWallHelper {
|
|
|
16
30
|
*/
|
|
17
31
|
static complementSide(lines: LineSegment<LineUserData>[], wallWidth?: number): LineSegment<LineUserData>[];
|
|
18
32
|
}
|
|
33
|
+
export {};
|
|
@@ -26,6 +26,10 @@ export declare class LineGroupType {
|
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
28
|
static replace(line: LineSegment<LineUserData>, id: string, type: string): boolean;
|
|
29
|
+
/** 有组
|
|
30
|
+
* @param line
|
|
31
|
+
*/
|
|
32
|
+
static hasGroup(line: LineSegment<LineUserData>): boolean;
|
|
29
33
|
/**
|
|
30
34
|
* 检查线段是否包含指定的分组ID
|
|
31
35
|
* @param line
|
|
@@ -67,12 +71,19 @@ export declare class LineGroupType {
|
|
|
67
71
|
*/
|
|
68
72
|
static getUnionTypes(lines: LineSegment<LineUserData>[]): string[];
|
|
69
73
|
/**
|
|
70
|
-
*
|
|
74
|
+
*
|
|
71
75
|
* @param line
|
|
72
76
|
* @param id
|
|
73
77
|
* @returns
|
|
74
78
|
*/
|
|
75
79
|
static remove(line: LineSegment<LineUserData>, id: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* 获取所有线段的交集类型(所有线段都包含的类型)
|
|
82
|
+
* @param line
|
|
83
|
+
* @param id
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
static removeByType(line: LineSegment<LineUserData>, type: string): boolean;
|
|
76
87
|
/**
|
|
77
88
|
* 清空线段的所有分组信息
|
|
78
89
|
* @param line
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LineSegment } from '../../LineSegment';
|
|
2
|
+
import { LineUserData } from '../type';
|
|
3
|
+
/** 构建双线墙组结构
|
|
4
|
+
* @param newLines
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildDoubleWallGroup(lines: LineSegment<LineUserData>[], doorLines?: LineSegment[], grouped?: boolean, clearInternalLine?: boolean): LineSegment<Record<string, any>>[];
|
|
8
|
+
/** 构建飘窗组组结构
|
|
9
|
+
* @param lines
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildBayWindowGroup(lines: LineSegment<LineUserData>[], clear?: boolean): LineSegment<LineUserData>[];
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { PointVirtualGrid } from '../../PointVirtualGrid';
|
|
2
2
|
import { LineSegment } from '../../LineSegment';
|
|
3
|
+
import { MapEnhance } from '../../Map';
|
|
4
|
+
import { Point } from '../../Point';
|
|
3
5
|
/** 查找有游离的点的线段,也就是有一端没有其他链接线的线段
|
|
4
6
|
* @param lines
|
|
5
7
|
* @param grid
|
|
6
8
|
* @returns
|
|
7
9
|
*/
|
|
8
|
-
export declare function findDiscretePointLine<T = any>(lines: LineSegment<T>[], grid0?: PointVirtualGrid<LineSegment<T>>,
|
|
10
|
+
export declare function findDiscretePointLine<T = any>(lines: LineSegment<T>[], grid0?: PointVirtualGrid<LineSegment<T>>, lineSet?: Set<LineSegment<T>>, deep?: boolean): Set<LineSegment<T>>;
|
|
9
11
|
/** 查找有游离的点的线段, 通过点的统计,而不是虚拟网格
|
|
10
12
|
* @param lines
|
|
11
13
|
* @param grid
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
|
-
export declare function findDiscretePointLine2<T = any>(lines: LineSegment<T>[],
|
|
16
|
+
export declare function findDiscretePointLine2<T = any>(lines: LineSegment<T>[], lineSet?: Set<LineSegment<T>> | null, deep?: boolean): Set<LineSegment<T>>;
|
|
17
|
+
/** 获取游离的点
|
|
18
|
+
* @param lines
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function findDiscretePoint<T = any>(lines: LineSegment<T>[]): MapEnhance<Point<Record<string, any>>, LineSegment<T>>;
|
|
@@ -6,11 +6,17 @@ export * from './DoubleWallHelper';
|
|
|
6
6
|
export * from './clippingDoubleWall';
|
|
7
7
|
export * from './clippingLineUserData';
|
|
8
8
|
export * from './closedPathArea';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './tools';
|
|
10
10
|
export * from './findLargestCircle';
|
|
11
11
|
export * from './findDiscretePointLine';
|
|
12
12
|
export * from './findVerticalReference';
|
|
13
|
-
export * from './lineDataToOriginalData';
|
|
14
13
|
export * from './mergeLineUserData';
|
|
15
14
|
export * from './originalDataToLineData';
|
|
16
15
|
export * from './recomputedWindow';
|
|
16
|
+
export * from './buildGroup';
|
|
17
|
+
export * from './LineGroupType';
|
|
18
|
+
export * from './findClosedPolygons';
|
|
19
|
+
export * from './lineDataToThreeVJiaJson';
|
|
20
|
+
export * from './mergeSmallestCircle';
|
|
21
|
+
export * from './smallestCircle';
|
|
22
|
+
export * as tools from './tools';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LineSegment } from '../../LineSegment';
|
|
2
|
+
import { LineUserData } from '../type';
|
|
3
|
+
import { Point } from '../../Point';
|
|
4
|
+
type Hole = {
|
|
5
|
+
id: number;
|
|
6
|
+
type: "DOOR" | "WINDOW";
|
|
7
|
+
start: Point;
|
|
8
|
+
end: Point;
|
|
9
|
+
height: number;
|
|
10
|
+
groundClearance?: number;
|
|
11
|
+
sillHeight: number;
|
|
12
|
+
openSide?: "RIGHT" | "LEFT" | "UP" | "DOWN";
|
|
13
|
+
};
|
|
14
|
+
type Wall = {
|
|
15
|
+
ID: number;
|
|
16
|
+
start: Point;
|
|
17
|
+
end: Point;
|
|
18
|
+
thickness: number;
|
|
19
|
+
type: "LINE";
|
|
20
|
+
isDoor: boolean;
|
|
21
|
+
loadBearingWall: boolean;
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
24
|
+
type Room = {};
|
|
25
|
+
export type ThreeVJiaJsonObject = {
|
|
26
|
+
version: string;
|
|
27
|
+
name: string;
|
|
28
|
+
communityName: string;
|
|
29
|
+
city: string;
|
|
30
|
+
province: string;
|
|
31
|
+
height: number;
|
|
32
|
+
walls: Wall[];
|
|
33
|
+
pillars: any[];
|
|
34
|
+
beams: any[];
|
|
35
|
+
holes: Hole[];
|
|
36
|
+
rooms: Room[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 转为 三维家 墙体结构
|
|
40
|
+
* @param data
|
|
41
|
+
*/
|
|
42
|
+
export declare function lineDataToThreeVJiaJson(lineSegments: LineSegment[], angle?: number, updateGroup?: boolean): {
|
|
43
|
+
lines: LineSegment<LineUserData>[];
|
|
44
|
+
toJson(name?: string, communityName?: string): ThreeVJiaJsonObject;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -8,7 +8,7 @@ export declare function ringsDeduplication(rings: LineSegment[][]): LineSegment<
|
|
|
8
8
|
* @param lines
|
|
9
9
|
* @param ringEdges
|
|
10
10
|
*/
|
|
11
|
-
export declare function mergeSmallestCircle(rings: LineSegment[][]): {
|
|
11
|
+
export declare function mergeSmallestCircle(rings: LineSegment[][], test?: boolean): {
|
|
12
12
|
internalEdges: LineSegment<Record<string, any>>[];
|
|
13
13
|
rings: LineSegment<Record<string, any>>[][];
|
|
14
14
|
};
|
|
@@ -10,3 +10,7 @@ export declare function recomputedWindow(...windowLines: LineSegment<LineUserDat
|
|
|
10
10
|
* @param windowLines
|
|
11
11
|
*/
|
|
12
12
|
export declare function recomputedWindowCenter(...windowLines: LineSegment<LineUserData>[]): void;
|
|
13
|
+
/**
|
|
14
|
+
* @param windowLines
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeWindow(...windowLines: LineSegment<LineUserData>[]): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { PointVirtualGrid } from '../../PointVirtualGrid';
|
|
2
2
|
import { LineSegment } from '../../LineSegment';
|
|
3
|
+
import { Quadtree } from '../../Quadtree';
|
|
3
4
|
export declare function createPointVirtualGrid<T = any>(lines: LineSegment<T>[]): PointVirtualGrid<LineSegment<T>>;
|
|
5
|
+
export declare function createQuadtree<T = any>(lines: LineSegment<T>[]): Quadtree<LineSegment<T>>;
|
|
@@ -67,7 +67,7 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
67
67
|
/** 旋转
|
|
68
68
|
* @param angle 弧度
|
|
69
69
|
*/
|
|
70
|
-
rotate(angle: number): this;
|
|
70
|
+
rotate(angle: number, center?: Point<Record<string, any>>): this;
|
|
71
71
|
/** 镜像线段
|
|
72
72
|
*/
|
|
73
73
|
mirror(): void;
|
|
@@ -95,10 +95,11 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
95
95
|
*/
|
|
96
96
|
normal(): Point<Record<string, any>>;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* 线段长度(缓存优化)
|
|
99
99
|
* @returns
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
cachedLength: number | null;
|
|
102
|
+
length(cached?: boolean): number;
|
|
102
103
|
/**
|
|
103
104
|
* 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
|
|
104
105
|
* @param line 要投影的线段
|
|
@@ -194,6 +195,7 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
194
195
|
* @returns
|
|
195
196
|
*/
|
|
196
197
|
areLinesCoincident(line: LineSegment): boolean;
|
|
198
|
+
isSameLine(line: LineSegment, eps?: number): boolean;
|
|
197
199
|
/** 克隆
|
|
198
200
|
* @returns
|
|
199
201
|
*/
|
|
@@ -223,6 +225,10 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
223
225
|
* @returns
|
|
224
226
|
*/
|
|
225
227
|
static groupByPoint(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
|
|
228
|
+
/** 分组,通过方向
|
|
229
|
+
* @param lines
|
|
230
|
+
*/
|
|
231
|
+
static groupByDirection(lines: LineSegment[], errAngle?: number): LineSegment<Record<string, any>>[][];
|
|
226
232
|
/** 合并线段到最长线段
|
|
227
233
|
* @param lines
|
|
228
234
|
* @returns
|
|
@@ -246,7 +252,7 @@ export declare class LineSegment<T = Record<string, any>> {
|
|
|
246
252
|
* @param callBack
|
|
247
253
|
* @returns
|
|
248
254
|
*/
|
|
249
|
-
static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void): LineSegment<Record<string, any>>[];
|
|
255
|
+
static brokenLineMerging(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void, removeLines?: Set<LineSegment<Record<string, any>>>, newLines?: LineSegment[]): LineSegment<Record<string, any>>[];
|
|
250
256
|
/** 去重
|
|
251
257
|
* @param lines
|
|
252
258
|
* @returns
|
package/src/utils/Point.d.ts
CHANGED
|
@@ -137,7 +137,8 @@ export declare class Point<T = Record<string, any>> {
|
|
|
137
137
|
* 获取两个点长度
|
|
138
138
|
* @param point
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
private _distanceMap;
|
|
141
|
+
distance(point: Point, cached?: boolean): number;
|
|
141
142
|
hashCode(fixed?: number): string;
|
|
142
143
|
/**
|
|
143
144
|
* 克隆
|
|
@@ -159,4 +160,6 @@ export declare class Point<T = Record<string, any>> {
|
|
|
159
160
|
};
|
|
160
161
|
static from(arr: any): Point<Record<string, any>>;
|
|
161
162
|
static zero(): Point<Record<string, any>>;
|
|
163
|
+
private static distanceClearQueue;
|
|
164
|
+
static addDistanceCacheClear(...points: Point[]): void;
|
|
162
165
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Box2 } from '../Box2';
|
|
2
2
|
import { Point } from '../Point';
|
|
3
|
+
import { Polygon } from '../Polygon';
|
|
3
4
|
import { Rectangle } from '../Rectangle';
|
|
4
5
|
type Target<T> = {
|
|
5
6
|
point: Point;
|
|
@@ -21,7 +22,7 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
|
|
|
21
22
|
* @param point
|
|
22
23
|
* @param userData
|
|
23
24
|
*/
|
|
24
|
-
insert(point: Point, userData?: T): this;
|
|
25
|
+
insert(point: Point, userData?: T): this | undefined;
|
|
25
26
|
/**
|
|
26
27
|
* 批量加入
|
|
27
28
|
* @param points
|
|
@@ -56,7 +57,10 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
|
|
|
56
57
|
* @param rectangle 矩形
|
|
57
58
|
* @returns 相交的节点数组
|
|
58
59
|
*/
|
|
59
|
-
queryRect(rectangle: Rectangle):
|
|
60
|
+
queryRect(rectangle: Rectangle): {
|
|
61
|
+
point: Point;
|
|
62
|
+
userData?: T;
|
|
63
|
+
}[];
|
|
60
64
|
/**
|
|
61
65
|
* 查询与圆形区域相交的点
|
|
62
66
|
* @param pos 圆心
|
|
@@ -81,6 +85,13 @@ export declare class PointVirtualGrid<T = Record<string, any>> {
|
|
|
81
85
|
* @param point
|
|
82
86
|
*/
|
|
83
87
|
queryPoint(point: Point, excludeOneself?: boolean): PvgList<T>;
|
|
88
|
+
/** 获取多边形内的点
|
|
89
|
+
* @param polygon
|
|
90
|
+
*/
|
|
91
|
+
queryPolygon(polygon: Polygon): {
|
|
92
|
+
point: Point;
|
|
93
|
+
userData?: T;
|
|
94
|
+
}[];
|
|
84
95
|
/**
|
|
85
96
|
* 查找点自己
|
|
86
97
|
* @param point
|
package/src/utils/Polygon.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import { Box2 } from './Box2';
|
|
1
2
|
import { LineSegment } from './LineSegment';
|
|
2
3
|
import { Point } from './Point';
|
|
3
4
|
export declare class Polygon<T = any> extends Array<Point<T>> {
|
|
4
5
|
constructor(points?: Point<T>[]);
|
|
6
|
+
/** 计算二维包围盒
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
getBox2(): Box2;
|
|
5
10
|
/**
|
|
6
11
|
* 获取点相对于多边形的位置
|
|
7
12
|
* @param point
|
|
8
13
|
* @returns 'on' 边上,'inside' 内部,'outside' 外部
|
|
9
14
|
*/
|
|
10
|
-
pointPosition(point: Point): "
|
|
15
|
+
pointPosition(point: Point): "outside" | "on" | "inside";
|
|
11
16
|
/** 点在多边形上:包括路径和内部
|
|
12
17
|
* @param point
|
|
13
18
|
* @returns
|
|
@@ -10,6 +10,10 @@ export declare class UndirectedGraph {
|
|
|
10
10
|
removeNode(node: number): void;
|
|
11
11
|
getNeighbors(node: number): Set<number> | undefined;
|
|
12
12
|
printGraph(): void;
|
|
13
|
+
/** 获取能组成的所有路径
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
getPaths(): number[][];
|
|
13
17
|
/** 循环
|
|
14
18
|
* @param callbackFun
|
|
15
19
|
*/
|
|
@@ -51,8 +55,17 @@ export declare class LineSegmentUndirectedGraph extends UndirectedGraph {
|
|
|
51
55
|
* 批量添加线段(比逐条 addLine 更快)
|
|
52
56
|
*/
|
|
53
57
|
addLines(lines: readonly LineSegment[]): this;
|
|
58
|
+
/** 路径转线段组
|
|
59
|
+
* @param path
|
|
60
|
+
*/
|
|
61
|
+
pathToLines(path: number[]): LineSegment<Record<string, any>>[];
|
|
54
62
|
/**
|
|
55
63
|
* 清空图
|
|
56
64
|
*/
|
|
57
65
|
clear(): void;
|
|
66
|
+
/** 线段图旋转
|
|
67
|
+
* @param lines
|
|
68
|
+
* @param angle 角度
|
|
69
|
+
*/
|
|
70
|
+
static rotate(lines: LineSegment[], angle: number, callbackFun?: (line: LineSegment, center: Point, angle: number) => void): LineSegment<Record<string, any>>[];
|
|
58
71
|
}
|
package/src/utils/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export * from './UnionFindSet';
|
|
|
12
12
|
export * from './cloneUserData';
|
|
13
13
|
export * from './selectLocalFile';
|
|
14
14
|
export * from './PointVirtualGrid';
|
|
15
|
-
export *
|
|
16
|
-
export *
|
|
17
|
-
export *
|
|
15
|
+
export * from './DxfSystem';
|
|
16
|
+
export * from './CommandManager';
|
|
17
|
+
export * from './ComponentManager';
|
|
File without changes
|