build-dxf 0.0.9 → 0.0.10
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/README.md +21 -3
- package/package.json +9 -23
- package/src/build.js +2021 -0
- package/src/index.css +1 -0
- package/src/index.d.ts +80 -0
- package/src/index.js +4 -1758
- package/src/index2.js +7361 -0
- package/src/plugins/ModelDataPlugin/index.d.ts +0 -596
- package/src/plugins/ModelDataPlugin/index.js +0 -498
- package/src/plugins/RenderPlugin/index.d.ts +0 -762
- package/src/plugins/RenderPlugin/index.js +0 -19348
|
@@ -1,762 +0,0 @@
|
|
|
1
|
-
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
-
import { ComponentProvideOptions } from 'vue';
|
|
3
|
-
import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
4
|
-
import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
5
|
-
import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
6
|
-
import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
7
|
-
import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
8
|
-
import { DefineComponent } from 'vue';
|
|
9
|
-
import { EventDispatcher as EventDispatcher_2 } from 'three';
|
|
10
|
-
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
11
|
-
import { PublicProps } from 'vue';
|
|
12
|
-
import * as THREE from 'three';
|
|
13
|
-
|
|
14
|
-
declare type __VLS_Props = {
|
|
15
|
-
lines?: OriginalDataItem[];
|
|
16
|
-
detailsPoint?: {
|
|
17
|
-
position: {
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
|
-
z: number;
|
|
21
|
-
};
|
|
22
|
-
direction: {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
z: number;
|
|
26
|
-
};
|
|
27
|
-
desc: string;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
declare class Box2 {
|
|
32
|
-
minX: number;
|
|
33
|
-
maxX: number;
|
|
34
|
-
minY: number;
|
|
35
|
-
maxY: number;
|
|
36
|
-
get points(): Point[];
|
|
37
|
-
get width(): number;
|
|
38
|
-
get height(): number;
|
|
39
|
-
get center(): Point;
|
|
40
|
-
constructor(minX?: number, maxX?: number, minY?: number, maxY?: number);
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param z
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
getPaths3D(z?: number): number[];
|
|
47
|
-
/**
|
|
48
|
-
* 判断线段是与包围盒相交
|
|
49
|
-
* @description Liang-Barsky算法的变种
|
|
50
|
-
* @param line
|
|
51
|
-
*/
|
|
52
|
-
intersectLineSegment(line: LineSegment): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* 判断线段是在包围盒内
|
|
55
|
-
* @param line
|
|
56
|
-
*/
|
|
57
|
-
containsLineSegment(line: LineSegment): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* 判断矩形与包围盒相交
|
|
60
|
-
* @param rectangle
|
|
61
|
-
*/
|
|
62
|
-
intersectRectangle(rectangle: Rectangle): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 判断矩形是在包围盒内
|
|
65
|
-
* @param rectangle
|
|
66
|
-
*/
|
|
67
|
-
containsRectangle(rectangle: Rectangle): boolean;
|
|
68
|
-
/**
|
|
69
|
-
* 判断包围盒与包围盒相交
|
|
70
|
-
* @param box
|
|
71
|
-
*/
|
|
72
|
-
intersectBox(box: Box2): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* 判断包围盒是在包围盒内
|
|
75
|
-
* @param box
|
|
76
|
-
*/
|
|
77
|
-
containsBox(box: Box2): boolean;
|
|
78
|
-
/** 判断点是在包围盒内
|
|
79
|
-
* @param point
|
|
80
|
-
*/
|
|
81
|
-
containsPoint(point: Point): boolean;
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* @param minX
|
|
85
|
-
* @param minY
|
|
86
|
-
* @param maxX
|
|
87
|
-
* @param maxY
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
90
|
-
set(minX: number, minY: number, maxX: number, maxY: number): this;
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
* @param maxWidth
|
|
94
|
-
* @param maxHeight
|
|
95
|
-
* @param mode
|
|
96
|
-
* @returns
|
|
97
|
-
*/
|
|
98
|
-
scaleSize(maxWidth: number, maxHeight: number, mode?: 'min' | 'max'): number;
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
* @param scalar
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
|
-
multiplyScalar(scalar: number): this;
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @returns
|
|
108
|
-
*/
|
|
109
|
-
clone(): Box2;
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* @param points
|
|
113
|
-
* @returns
|
|
114
|
-
*/
|
|
115
|
-
static fromByPoints(...points: Point[]): Box2;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
declare class Component<TEventMap extends {} = {}> extends EventDispatcher<{
|
|
119
|
-
addFromParent: {
|
|
120
|
-
parent: ComponentManager;
|
|
121
|
-
};
|
|
122
|
-
removeFromParent: {
|
|
123
|
-
parent: ComponentManager;
|
|
124
|
-
};
|
|
125
|
-
update: {};
|
|
126
|
-
} & TEventMap> {
|
|
127
|
-
parent?: ComponentManager;
|
|
128
|
-
constructor(...arg: any[]);
|
|
129
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
130
|
-
onRemoveFromParent(parent: ComponentManager): void;
|
|
131
|
-
destroy(): void;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
declare class ComponentManager<TEventMap extends {} = {}> extends EventDispatcher<TEventMap & EventTypeMap> {
|
|
135
|
-
static readonly EventType: {
|
|
136
|
-
ADD_COMPONENT: string;
|
|
137
|
-
};
|
|
138
|
-
components: Component[];
|
|
139
|
-
/**
|
|
140
|
-
* 添加组件
|
|
141
|
-
* @param component
|
|
142
|
-
*/
|
|
143
|
-
addComponent(component: Component): this;
|
|
144
|
-
/**
|
|
145
|
-
* 移除组件
|
|
146
|
-
* @param component
|
|
147
|
-
*/
|
|
148
|
-
removeComponent(component: Component): void;
|
|
149
|
-
/**
|
|
150
|
-
* 查找符合条件的第一个组件
|
|
151
|
-
* @param callBack
|
|
152
|
-
*/
|
|
153
|
-
findComponent(predicate: (component: Component, index: number) => boolean): Component<{}> | undefined;
|
|
154
|
-
/**
|
|
155
|
-
* 查找所有符合条件的组件
|
|
156
|
-
* @param callBack
|
|
157
|
-
*/
|
|
158
|
-
findComponents(predicate: (component: Component, index: number) => boolean): Component<{}> | undefined;
|
|
159
|
-
/**
|
|
160
|
-
*
|
|
161
|
-
* @param type
|
|
162
|
-
*/
|
|
163
|
-
findComponentByType<T extends typeof Component>(type: T): InstanceType<T> | null;
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* @param type
|
|
167
|
-
*/
|
|
168
|
-
findComponentByName(name: string): Component<{}> | null;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
declare namespace components {
|
|
172
|
-
export {
|
|
173
|
-
DetailsPointRender,
|
|
174
|
-
DomContainer,
|
|
175
|
-
OriginalLineRender,
|
|
176
|
-
RendererDescription,
|
|
177
|
-
Renderer,
|
|
178
|
-
PointGroup,
|
|
179
|
-
ModelDataRender,
|
|
180
|
-
DomEventRegister
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
export { components }
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* [开始点, 结束点, 相交点, 是否是门, 索引]
|
|
187
|
-
*/
|
|
188
|
-
declare type DataItem = [Point, Point, number[], boolean, number];
|
|
189
|
-
|
|
190
|
-
declare class DetailsPointRender extends Component {
|
|
191
|
-
Dxf: Dxf | null;
|
|
192
|
-
Renderer: Renderer | null;
|
|
193
|
-
WhiteModel: WhiteModel | null;
|
|
194
|
-
Variable: Variable | null;
|
|
195
|
-
desPointGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
196
|
-
rayLineGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
197
|
-
data: any[];
|
|
198
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
199
|
-
/**
|
|
200
|
-
* 更新模型
|
|
201
|
-
*/
|
|
202
|
-
updateModel(): void;
|
|
203
|
-
createDesPoint(): void;
|
|
204
|
-
createRayline(): void;
|
|
205
|
-
private _desBoxInfo;
|
|
206
|
-
/**
|
|
207
|
-
* 显示详情div盒子
|
|
208
|
-
* @param point
|
|
209
|
-
* @param div
|
|
210
|
-
* @param param2
|
|
211
|
-
* @returns
|
|
212
|
-
*/
|
|
213
|
-
showDesBox(point: THREE.Vector3, div: HTMLDivElement, { message, position }: any): void;
|
|
214
|
-
/**
|
|
215
|
-
* 隐藏详情盒子
|
|
216
|
-
*/
|
|
217
|
-
hideDesBox(): void;
|
|
218
|
-
private orbitControlsTarget;
|
|
219
|
-
private fov;
|
|
220
|
-
/**
|
|
221
|
-
* 查看详情点
|
|
222
|
-
* @param point
|
|
223
|
-
* @param position
|
|
224
|
-
*/
|
|
225
|
-
onLook(point: THREE.Vector3, position: THREE.Vector3): void;
|
|
226
|
-
/**
|
|
227
|
-
* 取消查看详情点
|
|
228
|
-
*/
|
|
229
|
-
cancelLook(): void;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
declare class DomContainer extends Component {
|
|
233
|
-
domElement: HTMLDivElement;
|
|
234
|
-
canvas: HTMLCanvasElement;
|
|
235
|
-
html2DRenderer: HTMLDivElement;
|
|
236
|
-
constructor();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
declare class DomEventRegister extends Component {
|
|
240
|
-
/**
|
|
241
|
-
*
|
|
242
|
-
* @param parent
|
|
243
|
-
*/
|
|
244
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
245
|
-
/**
|
|
246
|
-
*
|
|
247
|
-
* @param el
|
|
248
|
-
* @param callBack
|
|
249
|
-
* @param offset
|
|
250
|
-
* @param condition
|
|
251
|
-
*/
|
|
252
|
-
dragMoveHelper(el: HTMLElement, callBack: (offset: {
|
|
253
|
-
x: number;
|
|
254
|
-
y: number;
|
|
255
|
-
}, mx: number, my: number) => void, offset?: {
|
|
256
|
-
x: number;
|
|
257
|
-
y: number;
|
|
258
|
-
}, condition?: () => boolean): void;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* 将点云结构转换为DXF格式
|
|
263
|
-
*/
|
|
264
|
-
declare class Dxf extends Component<{
|
|
265
|
-
setDta: {
|
|
266
|
-
originalData: OriginalDataItem[];
|
|
267
|
-
data: DataItem[];
|
|
268
|
-
};
|
|
269
|
-
lineOffset: {
|
|
270
|
-
wallsGroup: Point[][];
|
|
271
|
-
};
|
|
272
|
-
createGroup: {
|
|
273
|
-
groups: Point[][][];
|
|
274
|
-
};
|
|
275
|
-
}> {
|
|
276
|
-
width: number;
|
|
277
|
-
scale: number;
|
|
278
|
-
originalData: OriginalDataItem[];
|
|
279
|
-
data: DataItem[];
|
|
280
|
-
originalBox: Box2;
|
|
281
|
-
box: Box2;
|
|
282
|
-
pointsGroups: Point[][][];
|
|
283
|
-
wallsGroup: Point[][];
|
|
284
|
-
doors: DataItem[];
|
|
285
|
-
lineSegments: LineSegment<{
|
|
286
|
-
isDoor: boolean;
|
|
287
|
-
}>[];
|
|
288
|
-
originalZAverage: number;
|
|
289
|
-
static EndType: {
|
|
290
|
-
etOpenSquare: number;
|
|
291
|
-
etOpenRound: number;
|
|
292
|
-
etOpenButt: number;
|
|
293
|
-
};
|
|
294
|
-
static JoinType: {
|
|
295
|
-
jtSquare: number;
|
|
296
|
-
jtRound: number;
|
|
297
|
-
jtMiter: number;
|
|
298
|
-
};
|
|
299
|
-
/** 原始数据组
|
|
300
|
-
*/
|
|
301
|
-
get lines(): LineSegment<{
|
|
302
|
-
isDoor: boolean;
|
|
303
|
-
}>[];
|
|
304
|
-
/**初始化
|
|
305
|
-
* @param data 点云数据
|
|
306
|
-
* @param width 墙体宽度
|
|
307
|
-
* @param scale 缩放比例
|
|
308
|
-
*/
|
|
309
|
-
constructor(width?: number, scale?: number);
|
|
310
|
-
/**
|
|
311
|
-
* 设置
|
|
312
|
-
* @param data
|
|
313
|
-
* @param width
|
|
314
|
-
* @param scale
|
|
315
|
-
*/
|
|
316
|
-
set(data: OriginalDataItem[] | string, width?: number, scale?: number): Promise<any>;
|
|
317
|
-
/** 创建分组
|
|
318
|
-
* @description 根据相交数组insetionArr, 把相交的线段,划分到一组内,方便后续路径查找合并使用
|
|
319
|
-
* @returns
|
|
320
|
-
*/
|
|
321
|
-
private createGroups;
|
|
322
|
-
/** 计算当前墙体数据的边界框
|
|
323
|
-
* @description 根据分组数据pointsGroups,计算包围盒, pointsGroups数据为缩放后数据。
|
|
324
|
-
* @description 可通过box属性查看计算结果。
|
|
325
|
-
* @returns
|
|
326
|
-
*/
|
|
327
|
-
computedSize(): Box2;
|
|
328
|
-
/** 线路拓扑
|
|
329
|
-
* @description 处理线路拓扑,使线路有序链接,形成长路径
|
|
330
|
-
* @param lines
|
|
331
|
-
*/
|
|
332
|
-
private lineTopology;
|
|
333
|
-
/** etOpenRound 去除毛刺
|
|
334
|
-
* @description 检查连续的短线段数量,去除合并后产生的毛刺
|
|
335
|
-
*/
|
|
336
|
-
private squareRemoveBurr;
|
|
337
|
-
/** 线偏移
|
|
338
|
-
* @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
|
|
339
|
-
*/
|
|
340
|
-
lineOffset(endType?: number, joinType?: number, scale?: number): Point[][];
|
|
341
|
-
/**
|
|
342
|
-
* 将点云结构转换为Float32Array
|
|
343
|
-
*/
|
|
344
|
-
to3DArray(scale: number): Float32Array<ArrayBuffer>;
|
|
345
|
-
/**
|
|
346
|
-
* 将点云结构转换为string
|
|
347
|
-
*/
|
|
348
|
-
toDxfString(unit?: Unit): string;
|
|
349
|
-
/**
|
|
350
|
-
* 将点云结构转换为DXF格式
|
|
351
|
-
* @returns
|
|
352
|
-
*/
|
|
353
|
-
toDxfBlob(unit?: Unit): Blob;
|
|
354
|
-
/**
|
|
355
|
-
* 下载
|
|
356
|
-
* @param filename
|
|
357
|
-
*/
|
|
358
|
-
download(filename: string, unit?: Unit): Promise<void>;
|
|
359
|
-
/**
|
|
360
|
-
* 计算原始数据的边界框
|
|
361
|
-
* @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
|
|
362
|
-
* @returns
|
|
363
|
-
*/
|
|
364
|
-
private computedOriginalSize;
|
|
365
|
-
/**
|
|
366
|
-
* 创建数据
|
|
367
|
-
* @param pointsGroups
|
|
368
|
-
* @returns
|
|
369
|
-
*/
|
|
370
|
-
static createData(pointsGroups: Point[][], sealed?: boolean): OriginalDataItem[];
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export declare const Dxf3DView: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
374
|
-
elRef: HTMLDivElement;
|
|
375
|
-
}, HTMLDivElement>;
|
|
376
|
-
|
|
377
|
-
declare class DxfSystem extends ComponentManager {
|
|
378
|
-
Dxf: Dxf;
|
|
379
|
-
Variable: Variable;
|
|
380
|
-
wallWidth: number;
|
|
381
|
-
environment: "node" | "browser" | "unknown";
|
|
382
|
-
/** 构造函数
|
|
383
|
-
* @param wallWidth 输出墙壁厚度,该墙壁厚度不受缩放影响
|
|
384
|
-
* @param scale 原始数据缩放比例
|
|
385
|
-
*/
|
|
386
|
-
constructor(wallWidth?: number, scale?: number);
|
|
387
|
-
usePlugin(plugin: (this: DxfSystem, dxfSystem: DxfSystem) => void): this;
|
|
388
|
-
destroy(): void;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
declare type EventData<T> = {
|
|
392
|
-
value: T;
|
|
393
|
-
oldValue: T;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
declare class EventDispatcher<TEventMap extends {} = {}> extends EventDispatcher_2<TEventMap> {
|
|
397
|
-
uuid: string;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
declare interface EventType {
|
|
401
|
-
originalLineVisible: EventData<boolean>;
|
|
402
|
-
dxfVisible: EventData<boolean>;
|
|
403
|
-
whiteModelVisible: EventData<boolean>;
|
|
404
|
-
isLook: EventData<boolean>;
|
|
405
|
-
currentWheel: EventData<number>;
|
|
406
|
-
pointerMove: EventData<{
|
|
407
|
-
x: number;
|
|
408
|
-
y: number;
|
|
409
|
-
}>;
|
|
410
|
-
currentKeyUp: EventData<string>;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
declare interface EventTypeMap {
|
|
414
|
-
addComponent: {
|
|
415
|
-
component: Component;
|
|
416
|
-
};
|
|
417
|
-
removeComponent: {
|
|
418
|
-
component: Component;
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* 非轴对称线段
|
|
424
|
-
*/
|
|
425
|
-
declare class LineSegment<T = Record<string, any>> {
|
|
426
|
-
points: Point[];
|
|
427
|
-
userData?: T;
|
|
428
|
-
get center(): Point;
|
|
429
|
-
get start(): Point;
|
|
430
|
-
get end(): Point;
|
|
431
|
-
constructor(p1?: Point, p2?: Point);
|
|
432
|
-
/**
|
|
433
|
-
* 计算线段的长度
|
|
434
|
-
* @returns 线段的长度
|
|
435
|
-
*/
|
|
436
|
-
getLength(): number;
|
|
437
|
-
/**
|
|
438
|
-
* 获取方向
|
|
439
|
-
* @returns
|
|
440
|
-
*/
|
|
441
|
-
direction(): Point;
|
|
442
|
-
/**
|
|
443
|
-
* 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
|
|
444
|
-
* @param line 要投影的线段
|
|
445
|
-
* @returns 投影并裁剪后的线段
|
|
446
|
-
*/
|
|
447
|
-
projectLineSegment(line: LineSegment): LineSegment;
|
|
448
|
-
clone(): LineSegment<Record<string, any>>;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
declare class ModelDataRender extends Component {
|
|
452
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
453
|
-
dxf(parent: ComponentManager): void;
|
|
454
|
-
whiteModel(parent: ComponentManager): void;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
declare interface OriginalDataItem {
|
|
458
|
-
start: {
|
|
459
|
-
x: number;
|
|
460
|
-
y: number;
|
|
461
|
-
z: number;
|
|
462
|
-
};
|
|
463
|
-
end: {
|
|
464
|
-
x: number;
|
|
465
|
-
y: number;
|
|
466
|
-
z: number;
|
|
467
|
-
};
|
|
468
|
-
insetionArr: {
|
|
469
|
-
index: number;
|
|
470
|
-
p: {
|
|
471
|
-
x: number;
|
|
472
|
-
y: number;
|
|
473
|
-
z: number;
|
|
474
|
-
};
|
|
475
|
-
}[];
|
|
476
|
-
isDoor?: boolean;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
declare class OriginalLineRender extends Component {
|
|
480
|
-
Dxf: Dxf | null;
|
|
481
|
-
Renderer: Renderer | null;
|
|
482
|
-
originalLineMode: THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
483
|
-
appendLineMode: THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
484
|
-
textGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
485
|
-
pointGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
486
|
-
distanceGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
487
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
488
|
-
updateMode(data: any): void;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
declare class Point {
|
|
492
|
-
x: number;
|
|
493
|
-
y: number;
|
|
494
|
-
get X(): number;
|
|
495
|
-
get Y(): number;
|
|
496
|
-
/**
|
|
497
|
-
*
|
|
498
|
-
* @param x
|
|
499
|
-
* @param y
|
|
500
|
-
*/
|
|
501
|
-
constructor(x?: number, y?: number);
|
|
502
|
-
set(x: number, y: number): this;
|
|
503
|
-
setX(x: number): this;
|
|
504
|
-
setY(y: number): this;
|
|
505
|
-
/**
|
|
506
|
-
*
|
|
507
|
-
* @param point
|
|
508
|
-
* @returns
|
|
509
|
-
*/
|
|
510
|
-
equal(point: Point): boolean;
|
|
511
|
-
/**
|
|
512
|
-
*
|
|
513
|
-
* @param arr
|
|
514
|
-
*/
|
|
515
|
-
setByArray(arr: number[]): this;
|
|
516
|
-
/**
|
|
517
|
-
*
|
|
518
|
-
*/
|
|
519
|
-
toArray(): [number, number];
|
|
520
|
-
/**
|
|
521
|
-
* multiplyScalar
|
|
522
|
-
* @param scalar
|
|
523
|
-
*/
|
|
524
|
-
mutiplyScalar(scalar: number): this;
|
|
525
|
-
multiplyScalar(scalar: number): this;
|
|
526
|
-
/**
|
|
527
|
-
*
|
|
528
|
-
* @param scalar
|
|
529
|
-
* @returns
|
|
530
|
-
*/
|
|
531
|
-
divisionScalar(scalar: number): this;
|
|
532
|
-
/**
|
|
533
|
-
* 减法
|
|
534
|
-
* @description 将当前点的坐标减去指定点的坐标
|
|
535
|
-
* @param point
|
|
536
|
-
* @returns
|
|
537
|
-
*/
|
|
538
|
-
division(point: Point): this;
|
|
539
|
-
/**
|
|
540
|
-
* 加法
|
|
541
|
-
* @description 将当前点的坐标加上指定点的坐标
|
|
542
|
-
* @param point
|
|
543
|
-
* @returns
|
|
544
|
-
*/
|
|
545
|
-
add(point: Point): this;
|
|
546
|
-
/**
|
|
547
|
-
* 保留小数位数
|
|
548
|
-
* @param count
|
|
549
|
-
*/
|
|
550
|
-
fixed(count: number): this;
|
|
551
|
-
/**
|
|
552
|
-
* 归一化
|
|
553
|
-
* @description 将当前点的坐标归一化为单位向量
|
|
554
|
-
* @returns
|
|
555
|
-
*/
|
|
556
|
-
normalize(): this;
|
|
557
|
-
/**
|
|
558
|
-
* 获取单位法向量
|
|
559
|
-
* @description 计算当前点到指定点的方向向量,并返回逆时针旋转90度后的单位法向量
|
|
560
|
-
* @param point
|
|
561
|
-
* @returns
|
|
562
|
-
*/
|
|
563
|
-
normal(point: Point): Point;
|
|
564
|
-
/**
|
|
565
|
-
* 获取由传入的点到该点的单位方向向量
|
|
566
|
-
* @description 计算当前点到指定点的方向向量,并返回单位方向
|
|
567
|
-
* @param point
|
|
568
|
-
* @returns
|
|
569
|
-
*/
|
|
570
|
-
direction(point: Point): Point;
|
|
571
|
-
/**
|
|
572
|
-
* 计算模长
|
|
573
|
-
* @returns
|
|
574
|
-
*/
|
|
575
|
-
magnitude(): number;
|
|
576
|
-
/**
|
|
577
|
-
* 计算点点积
|
|
578
|
-
* @param point
|
|
579
|
-
* @returns
|
|
580
|
-
*/
|
|
581
|
-
dot(point: Point): number;
|
|
582
|
-
/** 计算两个向量夹角
|
|
583
|
-
* @description 公式:a · b = |a| × |b| × cosθ
|
|
584
|
-
* @param point
|
|
585
|
-
* @returns
|
|
586
|
-
*/
|
|
587
|
-
angleBetween(point: Point): number;
|
|
588
|
-
/** 获取向量长度
|
|
589
|
-
*/
|
|
590
|
-
length(): number;
|
|
591
|
-
/**
|
|
592
|
-
* 获取两个点长度
|
|
593
|
-
* @param point
|
|
594
|
-
*/
|
|
595
|
-
distance(point: Point): number;
|
|
596
|
-
/**
|
|
597
|
-
* 克隆
|
|
598
|
-
* @returns
|
|
599
|
-
*/
|
|
600
|
-
clone(): Point;
|
|
601
|
-
static from(arr: any): Point;
|
|
602
|
-
static zero(): Point;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
declare interface PointGroup {
|
|
606
|
-
points: Point[];
|
|
607
|
-
indices: number[];
|
|
608
|
-
rectIndices: number[];
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* 非轴对称矩形
|
|
613
|
-
*/
|
|
614
|
-
declare class Rectangle {
|
|
615
|
-
points: Point[];
|
|
616
|
-
get path(): number[];
|
|
617
|
-
constructor(points: Point[]);
|
|
618
|
-
/**
|
|
619
|
-
* 判断线段是否与矩形相交
|
|
620
|
-
* @param line 线段
|
|
621
|
-
* @returns 是否与矩形相交
|
|
622
|
-
*/
|
|
623
|
-
intersectLineSegment(line: LineSegment): boolean;
|
|
624
|
-
/**
|
|
625
|
-
* 判断线段是否完全位于矩形内部
|
|
626
|
-
* @param line 线段
|
|
627
|
-
* @returns 是否完全在矩形内部
|
|
628
|
-
*/
|
|
629
|
-
containsLineSegment(line: LineSegment): boolean;
|
|
630
|
-
/**
|
|
631
|
-
* 判断点是否完全位于矩形内部
|
|
632
|
-
* @param point
|
|
633
|
-
*/
|
|
634
|
-
containsPoint(point: Point): boolean;
|
|
635
|
-
/**
|
|
636
|
-
*
|
|
637
|
-
* @returns
|
|
638
|
-
*/
|
|
639
|
-
toBox(): Box2;
|
|
640
|
-
/**
|
|
641
|
-
*
|
|
642
|
-
* @param line
|
|
643
|
-
* @param width
|
|
644
|
-
* @returns
|
|
645
|
-
*/
|
|
646
|
-
static fromByLineSegment(line: LineSegment, width?: number, horizontal?: boolean, hScale?: number): Rectangle;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
declare class Renderer extends Component {
|
|
650
|
-
static CSS2DObject: typeof CSS2DObject;
|
|
651
|
-
static CSS3DObject: typeof CSS3DObject;
|
|
652
|
-
static CSS3DSprite: typeof CSS3DSprite;
|
|
653
|
-
static Group: typeof THREE.Group;
|
|
654
|
-
static Object3D: typeof THREE.Object3D;
|
|
655
|
-
static Mesh: typeof THREE.Mesh;
|
|
656
|
-
static Line: typeof THREE.Line;
|
|
657
|
-
static LineSegments: typeof THREE.LineSegments;
|
|
658
|
-
static Points: typeof THREE.Points;
|
|
659
|
-
scene: THREE.Scene;
|
|
660
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
661
|
-
renderer: THREE.WebGLRenderer;
|
|
662
|
-
orbitControls?: OrbitControls;
|
|
663
|
-
private resizeObserver?;
|
|
664
|
-
private description;
|
|
665
|
-
html2DRenderer?: CSS2DRenderer;
|
|
666
|
-
html3DRenderer?: CSS3DRenderer;
|
|
667
|
-
container: THREE.Group<THREE.Object3DEventMap>;
|
|
668
|
-
onUpdate?: () => void;
|
|
669
|
-
onResize?: (width: number, height: number) => void;
|
|
670
|
-
private tweenTaskList;
|
|
671
|
-
constructor(description: RendererDescription);
|
|
672
|
-
/**
|
|
673
|
-
* 世界坐标转屏幕坐标
|
|
674
|
-
* @param worldPosition
|
|
675
|
-
* @param camera
|
|
676
|
-
* @param renderer
|
|
677
|
-
* @returns
|
|
678
|
-
*/
|
|
679
|
-
worldToScreenPosition(worldPosition: THREE.Vector3): THREE.Vector2;
|
|
680
|
-
cameraPositionRecord: [THREE.Vector3, THREE.Quaternion][];
|
|
681
|
-
/**
|
|
682
|
-
* 相机
|
|
683
|
-
* @param position
|
|
684
|
-
* @param lookAt
|
|
685
|
-
* @param onEnd
|
|
686
|
-
*/
|
|
687
|
-
cameraTo(position: THREE.Vector3, lookAt: THREE.Vector3, onEnd?: any): void;
|
|
688
|
-
cameraBack(): void;
|
|
689
|
-
/**
|
|
690
|
-
* 创建点
|
|
691
|
-
* @param pos
|
|
692
|
-
*/
|
|
693
|
-
createPointMesh(pos?: Point | THREE.Vector3, size?: number, parameters?: THREE.MeshBasicMaterialParameters, parent?: THREE.Object3D): void;
|
|
694
|
-
/**
|
|
695
|
-
* 创建文本
|
|
696
|
-
* @param text
|
|
697
|
-
* @param pos
|
|
698
|
-
* @param style
|
|
699
|
-
*/
|
|
700
|
-
createText(text: any, pos?: Point | THREE.Vector3, style?: any, parent?: THREE.Object3D): void;
|
|
701
|
-
/**
|
|
702
|
-
* 创建几何缓冲区
|
|
703
|
-
* @param map
|
|
704
|
-
* @param count
|
|
705
|
-
*/
|
|
706
|
-
createLineSegments(map: Record<string, number[]>, count: number, parameters?: THREE.LineBasicMaterialParameters, parent?: THREE.Object3D): THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
|
|
707
|
-
destroy(): void;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
declare interface RendererDescription {
|
|
711
|
-
canvas: HTMLCanvasElement;
|
|
712
|
-
orbitControls?: {
|
|
713
|
-
enableDamping?: boolean;
|
|
714
|
-
dampingFactor?: number;
|
|
715
|
-
domElement: HTMLElement;
|
|
716
|
-
};
|
|
717
|
-
htmlRenderer?: {
|
|
718
|
-
'2d'?: HTMLElement;
|
|
719
|
-
'3d'?: HTMLElement;
|
|
720
|
-
};
|
|
721
|
-
resizeObserver?: HTMLElement | null;
|
|
722
|
-
scene?: THREE.Scene;
|
|
723
|
-
camera?: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
export declare function RenderPlugin(dxfSystem: DxfSystem): void;
|
|
727
|
-
|
|
728
|
-
declare 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";
|
|
729
|
-
|
|
730
|
-
declare class Variable extends Component<EventType> {
|
|
731
|
-
originalLineVisible: boolean;
|
|
732
|
-
dxfVisible: boolean;
|
|
733
|
-
whiteModelVisible: boolean;
|
|
734
|
-
isLook: boolean;
|
|
735
|
-
currentWheel: number;
|
|
736
|
-
pointerMove: {
|
|
737
|
-
x: number;
|
|
738
|
-
y: number;
|
|
739
|
-
};
|
|
740
|
-
currentKeyUp: string;
|
|
741
|
-
set<KeyT extends keyof EventType>(key: KeyT, value: any): void;
|
|
742
|
-
get<KeyT extends keyof EventType>(key: KeyT): this[KeyT] | undefined;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
declare class WhiteModel extends Component<{
|
|
746
|
-
updateModel: {
|
|
747
|
-
whiteModelGroup: THREE.Group;
|
|
748
|
-
originalWhiteMode: THREE.Group;
|
|
749
|
-
};
|
|
750
|
-
}> {
|
|
751
|
-
Dxf: Dxf | null;
|
|
752
|
-
Variable: Variable | null;
|
|
753
|
-
whiteModelGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
754
|
-
originalWhiteMode: THREE.Group<THREE.Object3DEventMap>;
|
|
755
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
756
|
-
updateModel(): void;
|
|
757
|
-
toOBJ(): Promise<string>;
|
|
758
|
-
toBlob(): Promise<Blob | undefined>;
|
|
759
|
-
download(filename: string): Promise<void>;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
export { }
|