dxfview 0.0.4-beta.9 → 0.0.5-beta

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @fileoverview DxfViewer - DXF/DWG 文件的 3D 查看器核心组件
2
+ * @fileoverview DxfViewer 类- DXF/DWG 文件的3D 查看器核心组件
3
3
  *
4
- * 这个文件实现了 DxfViewer 类,该类继承自 BaseViewer,专门用于渲染和交互 DXF/DWG 格式的工程图纸。
4
+ * 这个文件实现了DxfViewer 类,该类继承自BaseViewer,专门用于渲染和交互 DXF/DWG 格式的工程图纸。
5
5
  * 主要功能包括:
6
6
  * - 3D 场景渲染和相机控制
7
7
  * - 图层管理和可见性控制
@@ -26,6 +26,8 @@ import { FontManager } from "../../core/font";
26
26
  import { EventInfo } from "../../core/input/InputManager";
27
27
  import { MarkupManager, MarkupType } from "../../core/markup";
28
28
  import { Model2d, ModelData2d } from "../../core/model";
29
+ import { // 几何体合并工具
30
+ Batch } from "../../core/utils";
29
31
  import { BaseViewer, ViewerName } from "../../core/viewers/BaseViewer";
30
32
  import { MeasurementData, MeasurementType } from "../../plugins/measure";
31
33
  import type { MeasurementPlugin } from "../../plugins/measure";
@@ -37,7 +39,7 @@ import type { MeasurementPlugin } from "../../plugins/measure";
37
39
  * DxfViewer 不维护模型和标记数据之间的关系,业务逻辑应该知道
38
40
  * 一组标记数据属于哪个模型。
39
41
  *
40
- * 这个类型继承自 DrawableData,扩展了基础的可绘制数据结构,
42
+ * 这个类型继承自DrawableData,扩展了基础的可绘制数据结构,
41
43
  * 用于支持 DXF 查看器的标记功能,如注释、测量等。
42
44
  */
43
45
  export declare type MarkupData = DrawableData;
@@ -45,24 +47,32 @@ export declare type MarkupData = DrawableData;
45
47
  * @interface EntityData
46
48
  * @description 实体数据接口
47
49
  *
48
- * 这个接口定义了 DXF 实体的数据结构,包含实体所属的模型和图层信息。
50
+ * 这个接口定义了DXF 实体的数据结构,包含实体所属的模型和图层信息。
49
51
  * 用于在查看器中唯一标识和定位一个实体对象。
50
52
  *
51
- * @property {string} modelId - 模型唯一标识符,用于区分不同的 DXF 文件
53
+ * @property {string} modelId - 模型唯一标识符,用于区分不同的DXF 文件
52
54
  * @property {string} layerName - 图层名称,表示实体所在的图层
55
+ * @property {Batch} batch - 可选,合并前的原始实体批次信息(包含顶点范围、索引范围、用户数据等)
56
+ * @property {THREE.Object3D} mergedObject - 可选,合并后的 THREE.Object3D 对象(Mesh/Line/Points)
57
+ * @property {number} faceIndex - 可选,点击的面索引(仅 Mesh 类型)
58
+ * @property {number} lineIndex - 可选,点击的线索引(仅 Line/LineSegments 类型)
53
59
  */
54
60
  export interface EntityData {
55
61
  modelId: string;
56
62
  layerName: string;
63
+ batch?: Batch;
64
+ mergedObject?: THREE.Object3D;
65
+ faceIndex?: number;
66
+ lineIndex?: number;
57
67
  }
58
68
  /**
59
69
  * @interface DxfLayers
60
70
  * @description DXF/DWG 图层组接口
61
71
  *
62
72
  * 这个接口定义了一个图纸的所有图层集合,包含图层名称到图层对象的映射。
63
- * 用于管理和组织 DXF 文件中的图层信息,支持图层的显示/隐藏、颜色设置等操作。
73
+ * 用于管理和组织DXF 文件中的图层信息,支持图层的显示/隐藏、颜色设置等操作。
64
74
  *
65
- * @property {string} modelId - 模型唯一标识符,对应具体的 DXF 文件
75
+ * @property {string} modelId - 模型唯一标识符,对应具体的DXF 文件
66
76
  * @property {Record<string, DxfLayer>} layers - 图层映射表,键为图层名称,值为图层对象
67
77
  */
68
78
  export interface DxfLayers {
@@ -73,7 +83,7 @@ export interface DxfLayers {
73
83
  * @interface PdfLayers
74
84
  * @description PDF 图层组接口
75
85
  *
76
- * 这个接口定义了一个 PDF 文件的所有图层集合,虽然主要用于 DXF 查看器,
86
+ * 这个接口定义了一个PDF 文件的所有图层集合,虽然主要用于 DXF 查看器,
77
87
  * 但也支持 PDF 文件的图层管理功能。
78
88
  *
79
89
  * @property {string} modelId - 模型唯一标识符
@@ -87,7 +97,7 @@ export interface PdfLayers {
87
97
  * @interface PdfLayer
88
98
  * @description PDF 图层接口
89
99
  *
90
- * 这个接口定义了单个 PDF 图层的属性和状态信息。
100
+ * 这个接口定义了单个PDF 图层的属性和状态信息。
91
101
  * 用于控制 PDF 图层的显示和交互行为。
92
102
  *
93
103
  * @property {string} name - 图层名称,用于标识和显示
@@ -105,13 +115,13 @@ export interface PdfLayer {
105
115
  * @interface PdfData
106
116
  * @description PDF 数据接口
107
117
  *
108
- * 这个接口定义了 PDF 文件的数据结构,虽然主要用于 DXF 查看器,
118
+ * 这个接口定义了PDF 文件的数据结构,虽然主要用于 DXF 查看器,
109
119
  * 但也支持 PDF 文件的渲染和交互功能。
110
120
  *
111
121
  * @property {THREE.Object3D} threejsObject - 整个 DXF/PDF 文件的根 Three.js 对象
112
122
  * @property {Record<string, PdfLayer>} layers - 图层映射表,包含所有图层信息
113
123
  * @property {Record<string, THREE.Object3D[]>} layersAndThreejsObjects 可选 - 按图层名称组织的 Three.js 对象数组
114
- * @property {number} loadedEntityCount - 已创建/加载的实体数量,主要用于日志记录,不是精确值
124
+ * @property {number} loadedEntityCount - 已创建加载的实体数量,主要用于日志记录,不是精确值
115
125
  */
116
126
  export interface PdfData {
117
127
  threejsObject: THREE.Object3D;
@@ -123,7 +133,7 @@ export interface PdfData {
123
133
  * Threejs 对象按以下树状视图组织:
124
134
  *
125
135
  * - modelLevelObject1 (THREE.Group, name = <modelId>)
126
- * - layoutLevelObject1 (THREE.Group, name = <布局名称>, 用于控制布局可见性)
136
+ * - layoutLevelObject1 (THREE.Group, name = <布局名称>, 用于控制布局可见性
127
137
  * - entityLevelObject1 (THREE.Point/Line/Mesh/Group)
128
138
  *
129
139
  * - 图层 threejs 对象
@@ -133,67 +143,67 @@ export interface PdfData {
133
143
  */
134
144
  /**
135
145
  * @class DxfViewer
136
- * @description DXF/DWG 文件查看器类 - 专业的工程图纸 3D 查看器
146
+ * @description DXF/DWG 文件查看器类 - 专业的工程图纸3D 查看器
137
147
  *
138
- * "dwg"是"drawing"的缩写,是AutoCAD保存的文件格式。
139
- * "dxf"是数据交换格式,可以从dwg文件转换而来。
140
- * 我们无法直接读取dwg文件,需要先通过ODA转换为dxf格式。
148
+ * "dwg"drawing"的缩写,是AutoCAD保存的文件格式、
149
+ * "dxf"是数据交换格式,可以从dwg文件转换而来、
150
+ * 我们无法直接读取dwg文件,需要先通过ODA转换为dxf格式、
141
151
  *
142
- * 支持的DXF版本:AutoCAD 2018。同时支持二进制和ASCII格式。
152
+ * 支持的DXF版本:AutoCAD 2018。同时支持二进制和ASCII格式、
143
153
  *
144
154
  * JSON编码:UTF-8编码,无BOM
145
155
  *
146
- * 坐标系统:右手坐标系,Y轴向上
156
+ * 坐标系统:右手坐标系,Y轴向个
147
157
  *
148
- * 关于单位:
149
- * - 距离单位遵循主DXF文件的单位
150
- * - 面积单位遵循主DXF文件的单位
151
- * - 角度单位为"度",逆时针方向
152
- * - 时间单位为"秒"
158
+ * 关于单位,
159
+ * - 距离单位遵循主DXF文件的单体
160
+ * - 面积单位遵循主DXF文件的单体
161
+ * - 角度单位个度,逆时针方合
162
+ * - 时间单位个移
153
163
  *
154
- * 颜色:使用rgb/rgba,值范围0-1
164
+ * 颜色:使用rgb/rgba,值范图-1
155
165
  *
156
- * 关于DxfViewer中的测量:
166
+ * 关于DxfViewer中的测量,
157
167
  * - 测量由DxfViewer生成
158
- * - 测量数据应该由用户存储,以便稍后恢复到DxfViewer
168
+ * - 测量数据应该由用户存储,以便稍后恢复到DxfViewer
159
169
  * - DxfViewer管理测量数据,可以创建、删除、隐藏等
160
170
  * - DxfViewer不维护测量与布局之间的关系
161
171
  *
162
- * 关于DxfViewer中的标记:
163
- * 标记与测量非常相似
172
+ * 关于DxfViewer中的标记,
173
+ * 标记与测量非常相传
164
174
  *
165
- * 关于DxfViewer中的热点:
175
+ * 关于DxfViewer中的热点,
166
176
  * - 热点由用户创建和存储
167
177
  * - 热点可以添加到DxfViewer中,也可以从中移除
168
178
  * - 调用者应该设置在当前DxfViewer会话中唯一的热点ID
169
- * - DxfViewer不会隐藏热点,用户可以自己操作
179
+ * - DxfViewer不会隐藏热点,用户可以自己操体
170
180
  * - DxfViewer不维护热点与布局之间的关系
171
181
  *
172
- * 关于布局:
182
+ * 关于布局,
173
183
  * - 每个布局都有自己的主视图
174
184
  * - 切换到另一个布局时,会清除所有测量、标记和热点
175
185
  * - 切换到另一个布局时,会停用任何正在进行的操作,如测量、标记等
176
186
  *
177
- * 关于叠加:
187
+ * 关于叠加,
178
188
  * - 只要浏览器有足够的内存、CPU/GPU等,就支持添加任意数量的模型
179
- * - 第一个模型称为"主模型",其他的称为"叠加模型"
180
- * - 忽略叠加模型的图纸空间
181
- * - 如果叠加模型的单位与主模型不同,应该转换为主模型的单位
189
+ * - 第一个模型称个主模型,其他的称为"叠加模型"
190
+ * - 忽略叠加模型的图纸空闭
191
+ * - 如果叠加模型的单位与主模型不同,应该转换为主模型的单体
182
192
  * - 在getLayers()中会添加modelId作为前缀
183
193
  *
184
- * 关于比较:
185
- * - 只比较"模型"空间
194
+ * 关于比较,
195
+ * - 只比输模型"空间
186
196
  * - 比较具有相同句柄和类型的实体
187
197
  * - 比较实体的几何形状、位置、缩放等
188
198
  * - 忽略图层的可见性、冻结设置
189
199
  * - 忽略实体的属性,如线型、线宽、填充图案、字体、颜色等
190
- * - 忽略块引用的空间过滤器(xclip
200
+ * - 忽略块引用的空间过滤器(xclip
191
201
  * - 忽略与图层相关的操作,如将实体移动到另一个图层、更改图层颜色等
192
- * - 默认情况下,"添加"的实体以绿色渲染,"删除"的实体以红色渲染,"修改"的实体由两部分组成,一个"删除"和一个"添加"
202
+ * - 默认情况下,"添加"的实体以绿色渲染,删除"的实体以红色渲染,修改"的实体由两部分组成,一个删除"和一个添加"
193
203
  *
194
- * 关于撤销/重做:
204
+ * 关于撤销/重做,
195
205
  * - 支持测量和标记操作的撤销/重做。例如:创建/删除/移动标记
196
- * - 设置/移除一批测量或标记将被视为一个操作
206
+ * - 设置/移除一批测量或标记将被视为一个操体
197
207
  * - 切换到另一个布局会清除所有撤销/重做历史记录
198
208
  *
199
209
  * 关于对象捕捉(OSnap):
@@ -229,17 +239,20 @@ export declare class DxfViewer extends BaseViewer {
229
239
  private readonly CAMERA_Z_POSITION;
230
240
  private readonly CAMERA_MIN_ZOOM;
231
241
  private timer;
232
- /** @protected CSS2D渲染器 - 用于在场景中渲染HTML标签 */
242
+ /** @protected CSS2D渲染器- 用于在场景中渲染HTML标签 */
233
243
  protected css2dRenderer?: CSS2DRenderer;
234
- /** @protected 字体管理器 - 处理文本渲染 */
244
+ /** @protected 字体管理器- 处理文本渲染 */
235
245
  protected fontManager?: FontManager;
236
246
  /** @protected 是否启用选择功能 */
237
247
  protected enableSelection?: boolean;
238
- /** @protected 当前选中的对象 */
248
+ /** @protected 当前选中的对象*/
239
249
  protected selectedObject?: THREE.Object3D | Drawable;
250
+ private selectedEntityData?;
251
+ private selectedEntityHighlightObject?;
252
+ private boxSelectHelper?;
240
253
  /**
241
254
  * 已加载的模型列表
242
- * 记录的"键"是modelId或src
255
+ * 记录的错是modelId或src
243
256
  * @internal
244
257
  */
245
258
  loadedModels: Model2d[];
@@ -248,19 +261,19 @@ export declare class DxfViewer extends BaseViewer {
248
261
  * @internal
249
262
  */
250
263
  masterModelId: string;
251
- /** @private DXF布局栏组件 */
264
+ /** @private DXF布局栏组件*/
252
265
  private dxfLayoutBar?;
253
- /** @private Three.js加载管理器 */
266
+ /** @private Three.js加载管理器*/
254
267
  private loadingManager?;
255
- /** @private 射线投射器 - 用于对象拾取和交互 */
268
+ /** @private 射线投射器 - 用于对象拾取和交互*/
256
269
  private raycaster?;
257
- /** @private 相机更新定时器 */
270
+ /** @private 相机更新定时器*/
258
271
  private cameraUpdateInterval?;
259
- /** @protected 是否选中状态 - TODO: 与selectedObject重复? */
272
+ /** @protected 是否选中状态 - TODO: 与selectedObject重复,*/
260
273
  protected selected: boolean;
261
- /** @private 标记管理器 - 管理活动布局的标记 */
274
+ /** @private 标记管理器 - 管理活动布局的标记*/
262
275
  private markupManager?;
263
- /** @private 缩放至矩形区域辅助工具 */
276
+ /** @private 缩放至矩形区域辅助工具*/
264
277
  private zoomToRectHelper?;
265
278
  /**
266
279
  * @private 请求动画帧辅助工具 - 用于提升渲染性能
@@ -268,7 +281,7 @@ export declare class DxfViewer extends BaseViewer {
268
281
  * 通过将raf设置为undefined可以禁用此功能
269
282
  */
270
283
  private raf?;
271
- /** @private 时钟对象 - 用于时间相关的计算 */
284
+ /** @private 时钟对象 - 用于时间相关的计算*/
272
285
  private clock;
273
286
  /** @protected 渲染启用状态 - 与RafHelper配合使用 */
274
287
  protected renderEnabled: boolean;
@@ -294,7 +307,7 @@ export declare class DxfViewer extends BaseViewer {
294
307
  private fpsUtils;
295
308
  /** @private 正在拖拽的标注可绘制对象 */
296
309
  private draggingAnnotationDrawable?;
297
- /** @private 正在拖拽的顶点索引 */
310
+ /** @private 正在拖拽的顶点索引*/
298
311
  private draggingVertexIndex?;
299
312
  /**
300
313
  * DxfViewer构造函数
@@ -331,7 +344,7 @@ export declare class DxfViewer extends BaseViewer {
331
344
  protected init(): void;
332
345
  private initInputManager;
333
346
  /**
334
- * 交互模式:
347
+ * 交互模式,
335
348
  * select 模式:左键点击选择,鼠标中键拖拽平移;鼠标样式为默认;
336
349
  * move 模式:左键拖拽平移(与中键一致),鼠标样式为 pan/grab
337
350
  */
@@ -344,12 +357,12 @@ export declare class DxfViewer extends BaseViewer {
344
357
  * - "move"模式:用于快速平移视图,左键拖拽即可平移
345
358
  *
346
359
  * 两种模式的鼠标行为:
347
- * select模式:
360
+ * select模式,
348
361
  * - 左键:选择对象
349
362
  * - 中键:拖拽平移视图
350
363
  * - 鼠标样式:默认样式
351
364
  *
352
- * move模式:
365
+ * move模式,
353
366
  * - 左键:拖拽平移视图(与中键行为一致)
354
367
  * - 鼠标样式:抓取样式(pan/grab)
355
368
  *
@@ -367,12 +380,12 @@ export declare class DxfViewer extends BaseViewer {
367
380
  setInteractionMode(mode: "select" | "move"): void;
368
381
  /**
369
382
  * 初始化Three.js核心组件
370
- * 包括场景、渲染器和相机
383
+ * 包括场景、渲染器和相术
371
384
  */
372
385
  private initThree;
373
386
  /**
374
387
  * 初始化DOM相关组件
375
- * 包括加载指示器、CSS2D渲染器、进度条和布局栏
388
+ * 包括加载指示器、CSS2D渲染器、进度条和布局标
376
389
  */
377
390
  private initDom;
378
391
  /**
@@ -382,22 +395,22 @@ export declare class DxfViewer extends BaseViewer {
382
395
  private initScene;
383
396
  /**
384
397
  * 初始化WebGL渲染器
385
- * 配置渲染参数并设置到DOM
398
+ * 配置渲染参数并设置到DOM
386
399
  */
387
400
  private initRenderer;
388
401
  /**
389
402
  * 初始化CSS2D渲染器
390
- * 用于渲染HTML标签和标注
403
+ * 用于渲染HTML标签和标法
391
404
  */
392
405
  protected initCSS2DRenderer(): void;
393
406
  /**
394
- * 初始化正交相机
407
+ * 初始化正交相术
395
408
  * 设置相机位置、缩放和投影矩阵
396
409
  */
397
410
  private initCamera;
398
411
  /**
399
412
  * 初始化相机控制器
400
- * 设置鼠标和触摸交互行为
413
+ * 设置鼠标和触摸交互行个
401
414
  * @internal
402
415
  */
403
416
  protected initControls(): void;
@@ -411,19 +424,19 @@ export declare class DxfViewer extends BaseViewer {
411
424
  */
412
425
  protected onControlsChange(viewer: DxfViewer): () => void;
413
426
  /**
414
- * 初始化鼠标/指针事件
427
+ * 初始化鼠标指针事件
415
428
  * 处理各种交互事件如点击、拖拽、键盘快捷键等
416
429
  */
417
430
  private initEvents;
418
431
  protected initOthers(): void;
419
432
  private initLoadingProgressBar;
420
433
  /**
421
- * 显示布局栏
434
+ * 显示布局标
422
435
  * @internal
423
436
  */
424
437
  showLayoutBar(): void;
425
438
  /**
426
- * 隐藏布局栏
439
+ * 隐藏布局标
427
440
  * @internal
428
441
  */
429
442
  hideLayoutBar(): void;
@@ -432,19 +445,19 @@ export declare class DxfViewer extends BaseViewer {
432
445
  * 启用渲染以提升性能
433
446
  *
434
447
  * 为获得更好的性能,应该只在必要时进行渲染。通常在以下情况应该启用渲染:
435
- * - 对象被添加到场景、从场景移除,或对象的position、scale、rotation、opacity、material等属性发生变化
448
+ * - 对象被添加到场景、从场景移除,或对象的position、scale、rotation、opacity、material等属性发生变区
436
449
  * - 对象被选择或取消选择
437
450
  * - 相机发生变化
438
451
  * - 渲染区域大小发生变化
439
452
  *
440
- * 这个方法会设置一个超时,在指定的时间后自动禁用渲染,从而避免不必要的渲染开销。
453
+ * 这个方法会设置一个超时,在指定的时间后自动禁用渲染,从而避免不必要的渲染开销、
441
454
  *
442
455
  * @param time - 渲染启用持续时间(毫秒),默认为1000ms
443
456
  * @internal 内部方法,主要由框架内部调用
444
457
  *
445
458
  * @example
446
459
  * ```typescript
447
- * // 手动启用渲染,持续2秒
460
+ * // 手动启用渲染,持绘移
448
461
  * viewer.enableRender(2000);
449
462
  *
450
463
  * // 使用默认时间启用渲染
@@ -455,8 +468,8 @@ export declare class DxfViewer extends BaseViewer {
455
468
  /**
456
469
  * 获取当前的FPS(每秒帧数)值
457
470
  *
458
- * 返回当前查看器的实时渲染帧率,用于性能监控和调试。
459
- * FPS值反映了渲染性能的高低,数值越高表示性能越好。
471
+ * 返回当前查看器的实时渲染帧率,用于性能监控和调试、
472
+ * FPS值反映了渲染性能的高低,数值越高表示性能越好、
460
473
  *
461
474
  * @returns 当前的FPS值
462
475
  * @internal 内部方法,主要用于性能监控
@@ -469,29 +482,29 @@ export declare class DxfViewer extends BaseViewer {
469
482
  */
470
483
  getFps(): number;
471
484
  /**
472
- * 判断是否为3D查看器
485
+ * 判断是否个D查看器
473
486
  *
474
- * DxfViewer是2D查看器,专门用于渲染DXF/DWG格式的工程图纸。
475
- * 这个方法返回false,表示当前查看器不支持3D渲染。
487
+ * DxfViewer明D查看器,专门用于渲染DXF/DWG格式的工程图纸、
488
+ * 这个方法返回false,表示当前查看器不支指D渲染、
476
489
  *
477
- * @returns 总是返回false,因为DxfViewer是2D查看器
478
- * @internal 内部方法,用于框架内部的查看器类型判断
490
+ * @returns 总是返回false,因为DxfViewer明D查看器
491
+ * @internal 内部方法,用于框架内部的查看器类型判方
479
492
  */
480
493
  is3d(): boolean;
481
494
  /**
482
- * 销毁 DxfViewer 实例
495
+ * 销每DxfViewer 实例
483
496
  *
484
- * 彻底清理和释放 DxfViewer 占用的所有资源,包括:
497
+ * 彻底清理和释改DxfViewer 占用的所有资源,包括,
485
498
  * - 停止所有异步任务和动画循环
486
499
  * - 销毁UI组件(布局栏、标记管理器等)
487
- * - 清理Three.js资源(渲染器、几何体、材质等)
500
+ * - 清理Three.js资源(渲染器、几何体、材质等,
488
501
  * - 移除事件监听器
489
502
  * - 释放内存和GPU资源
490
503
  *
491
504
  * 注意:销毁顺序很重要,例如测量功能依赖于渲染器,
492
- * 必须在销毁渲染器之前先销毁测量功能。
505
+ * 必须在销毁渲染器之前先销毁测量功能、
493
506
  *
494
- * 调用此方法后,DxfViewer实例将不可用,所有相关资源都会被释放。
507
+ * 调用此方法后,DxfViewer实例将不可用,所有相关资源都会被释放、
495
508
  *
496
509
  * @example
497
510
  * ```typescript
@@ -502,6 +515,7 @@ export declare class DxfViewer extends BaseViewer {
502
515
  * ```
503
516
  */
504
517
  destroy(): void;
518
+ clearLoadedModels(): void;
505
519
  /**
506
520
  * 用于指示有多少个DXF文件正在加载
507
521
  */
@@ -511,24 +525,24 @@ export declare class DxfViewer extends BaseViewer {
511
525
  *
512
526
  * 加载DXF/DWG格式的工程图纸文件,支持主模型和叠加模型的概念:
513
527
  *
514
- * **主模型 vs 叠加模型:**
515
- * - 第一个加载的文件将被视为"主模型"
516
- * - 后续加载的文件称为"叠加模型"
528
+ * **主模型vs 叠加模型,*
529
+ * - 第一个加载的文件将被视为"主模型
530
+ * - 后续加载的文件称个叠加模型"
517
531
  *
518
- * **加载内容差异:**
519
- * - **主模型**:加载所有内容,包括模型空间和图纸空间
532
+ * **加载内容差异,*
533
+ * - **主模型*:加载所有内容,包括模型空间和图纸空闭
520
534
  * - **叠加模型**:仅加载模型空间,且只能叠加到主模型的模型空间上
521
535
  *
522
536
  * **功能特性:**
523
537
  * - 支持进度回调,实时显示加载进度
524
538
  * - 支持本地缓存以提升性能
525
539
  * - 支持模型合并优化
526
- * - 支持编码设置(处理不同字符集的DXF文件)
527
- * - 支持颜色覆盖(统一修改模型颜色)
540
+ * - 支持编码设置(处理不同字符集的DXF文件,
541
+ * - 支持颜色覆盖(统一修改模型颜色,
528
542
  * - 自动处理图纸空间的忽略逻辑
529
543
  *
530
544
  * @param modelCfg - 要加载的模型配置
531
- * @param onProgress - 加载进度回调函数,可选
545
+ * @param onProgress - 加载进度回调函数,可通
532
546
  *
533
547
  * @returns Promise<void> - 当模型加载完成时resolve
534
548
  *
@@ -543,7 +557,7 @@ export declare class DxfViewer extends BaseViewer {
543
557
  *
544
558
  * const modelCfg = {
545
559
  * modelId: "primary_model",
546
- * name: "主模型",
560
+ * name: "主模型,
547
561
  * src: "http://example.com/primary.dxf",
548
562
  * merge: true, // 启用模型合并优化
549
563
  * encoding: "utf-8", // 文件编码
@@ -557,11 +571,11 @@ export declare class DxfViewer extends BaseViewer {
557
571
  * const progress = (event.loaded * 100) / event.total;
558
572
  * console.log(`加载进度: ${progress.toFixed(1)}%`);
559
573
  *
560
- * // 可以在这里更新UI进度条
574
+ * // 可以在这里更新UI进度材
561
575
  * updateProgressBar(progress);
562
576
  * });
563
577
  *
564
- * console.log("模型加载完成!");
578
+ * console.log("模型加载完成,);
565
579
  *
566
580
  * // 现在可以加载叠加模型
567
581
  * const overlayCfg = {
@@ -583,11 +597,11 @@ export declare class DxfViewer extends BaseViewer {
583
597
  *
584
598
  * @example
585
599
  * ```typescript
586
- * // 加载多个模型的示例
600
+ * // 加载多个模型的示供
587
601
  * const models = [
588
602
  * { modelId: "floor1", name: "一层平面图", src: "floor1.dxf" },
589
- * { modelId: "floor2", name: "二层平面图", src: "floor2.dxf" },
590
- * { modelId: "structure", name: "结构图", src: "structure.dxf" },
603
+ * { modelId: "floor2", name: "二层平面图, src: "floor2.dxf" },
604
+ * { modelId: "structure", name: "结构图, src: "structure.dxf" },
591
605
  * ];
592
606
  *
593
607
  * for (const model of models) {
@@ -598,13 +612,14 @@ export declare class DxfViewer extends BaseViewer {
598
612
  * ```
599
613
  */
600
614
  loadModelAsync(modelCfg: DxfModelConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
615
+ private disposeSceneObjectResources;
601
616
  /**
602
617
  * 卸载DXF模型
603
618
  *
604
- * 从查看器中移除指定的DXF模型,清理相关资源。
605
- * 这个方法目前还没有实现,是为未来版本预留的功能。
619
+ * 从查看器中移除指定的DXF模型,清理相关资源、
620
+ * 这个方法目前还没有实现,是为未来版本预留的功能、
606
621
  *
607
- * @param modelId 可选 - 要卸载的模型ID。如果不提供,则可能卸载所有模型
622
+ * @param modelId 可通- 要卸载的模型ID。如果不提供,则可能卸载所有模型
608
623
  * @internal 内部方法,暂未实现
609
624
  * @throws {Error} 抛出"Not implemented yet!"错误,表示功能尚未实现
610
625
  *
@@ -619,7 +634,7 @@ export declare class DxfViewer extends BaseViewer {
619
634
  * 将模型数据添加到查看器
620
635
  *
621
636
  * 这个方法负责将加载的DXF模型正式集成到Three.js场景中,
622
- * 设置必要的属性和状态,确保模型能够正确渲染和交互。
637
+ * 设置必要的属性和状态,确保模型能够正确渲染和交互、
623
638
  *
624
639
  * @param modelData - 2D模型数据,包含模型ID和DXF数据
625
640
  * @returns 返回创建的Model2d实例
@@ -647,10 +662,10 @@ export declare class DxfViewer extends BaseViewer {
647
662
  protected getLoadedDxfModelIds(): string[];
648
663
  /**
649
664
  * @description {en} Gets layout names of the master model.
650
- * @description {zh} 获取主模型的布局名称。
665
+ * @description {zh} 获取主模型的布局名称、
651
666
  * @returns
652
667
  * - {en} Layout names of the master model.
653
- * - {zh} 主模型的布局名称。
668
+ * - {zh} 主模型的布局名称、
654
669
  * @example
655
670
  * ```typescript
656
671
  * const layoutNames = dxfViewer.getLayoutNames();
@@ -659,17 +674,17 @@ export declare class DxfViewer extends BaseViewer {
659
674
  */
660
675
  getLayoutNames(): string[];
661
676
  /**
662
- * 获取布局。
663
- * 仅返回主模型的布局。
677
+ * 获取布局、
678
+ * 仅返回主模型的布局、
664
679
  */
665
680
  protected getLayouts(): ILayoutObject[];
666
681
  private handleOverlayDxf;
667
682
  /**
668
683
  * @description {en} Activates a layout.
669
- * @description {zh} 激活布局。
684
+ * @description {zh} 激活布局、
670
685
  * @param layoutName
671
686
  * - {en} The name of the layout to be activated.
672
- * - {zh} 要激活的布局名称。
687
+ * - {zh} 要激活的布局名称、
673
688
  * @example
674
689
  * ```typescript
675
690
  * viewer.activateLayout('Layout1');
@@ -679,10 +694,10 @@ export declare class DxfViewer extends BaseViewer {
679
694
  private cancelAllOperations;
680
695
  /**
681
696
  * @description {en} Gets active layout.
682
- * @description {zh} 获取当前布局。
697
+ * @description {zh} 获取当前布局、
683
698
  * @returns
684
699
  * - {en} Active layout name or undefined.
685
- * - {zh} 当前激活的布局名称或undefined
700
+ * - {zh} 当前激活的布局名称或undefined
686
701
  * @example
687
702
  * ``` typescript
688
703
  * const activeLayout = viewer.getActiveLayoutName();
@@ -692,10 +707,10 @@ export declare class DxfViewer extends BaseViewer {
692
707
  getActiveLayoutName(): string | undefined;
693
708
  /**
694
709
  * @description {en} Gets dxf layers.
695
- * @description {zh} 获取dxf图层。
710
+ * @description {zh} 获取dxf图层、
696
711
  * @returns
697
712
  * - {en} Dxf layers.
698
- * - {zh} dxf图层。
713
+ * - {zh} dxf图层、
699
714
  * @example
700
715
  * ``` typescript
701
716
  * const dxfLayers = viewer.getLayers();
@@ -708,26 +723,26 @@ export declare class DxfViewer extends BaseViewer {
708
723
  */
709
724
  getLayers(): (DxfLayers | PdfLayers)[];
710
725
  /**
711
- * 设置模型(即dxf文件)的可见性。
712
- * @throws 如果modelId不存在则抛出异常。
726
+ * 设置模型(即dxf文件)的可见性、
727
+ * @throws 如果modelId不存在则抛出异常、
713
728
  * @internal
714
729
  */
715
730
  setModelVisibility(modelId: string, visible: boolean): void;
716
731
  /**
717
732
  * @description {en} Sets layer's visibility.
718
- * @description {zh} 设置图层的可见性。
733
+ * @description {zh} 设置图层的可见性、
719
734
  * @param layerName
720
735
  * - {en} Layer's name to show or hide.
721
- * - {zh} 要显示或隐藏的图层名称。
736
+ * - {zh} 要显示或隐藏的图层名称、
722
737
  * @param visible
723
738
  * - {en} Layer's target visibility.
724
- * - {zh} 图层的目标可见性。
739
+ * - {zh} 图层的目标可见性、
725
740
  * @param modelId
726
741
  * - {en} Useful when more than one model is loaded, if not specified, will use the master model.
727
- * - {zh} 当加载了多个模型时有用,如果未指定,将使用主模型。
742
+ * - {zh} 当加载了多个模型时有用,如果未指定,将使用主模型、
728
743
  * @throws Error
729
744
  * - {en}: Throws exception if given modelId doesn't exist.
730
- * - {zh} 如果给定的modelId不存在,则抛出异常。
745
+ * - {zh} 如果给定的modelId不存在,则抛出异常、
731
746
  * @example
732
747
  * ``` typescript
733
748
  * // Hides layer "0"
@@ -742,12 +757,12 @@ export declare class DxfViewer extends BaseViewer {
742
757
  setLayerOpacity(layerName: string, opacity: number, modelId?: string): void;
743
758
  /**
744
759
  * 设置图层的颜色
745
- * @throws 如果图层不存在则抛出异常。
760
+ * @throws 如果图层不存在则抛出异常、
746
761
  * @internal
747
762
  */
748
763
  setLayerColor(layerName: string, color: number, modelId?: string): void;
749
764
  /**
750
- * 重置图层的颜色。
765
+ * 重置图层的颜色、
751
766
  * @internal
752
767
  */
753
768
  resetLayerColor(layerName: string, modelId?: string): void;
@@ -755,12 +770,12 @@ export declare class DxfViewer extends BaseViewer {
755
770
  * @description {en} Sets font.
756
771
  * This needs to be called before loading a dxf, it won't affect any loaded text.
757
772
  * It accepts shx or typeface formats. For typeface, it only support passing in 1 font file in the array for now.
758
- * @description {zh} 设置字体。
759
- * 需要在加载dxf之前调用,不会影响已加载的文字。
760
- * 支持shx或typeface格式。对于typeface,目前只支持传入1个字体文件。
773
+ * @description {zh} 设置字体、
774
+ * 需要在加载dxf之前调用,不会影响已加载的文字、
775
+ * 支持shx或typeface格式。对于typeface,目前只支持传入1个字体文件、
761
776
  * @param urls
762
777
  * - {en} font file urls.
763
- * - {zh} 字体文件链接。
778
+ * - {zh} 字体文件链接、
764
779
  * @example
765
780
  * ```typescript
766
781
  * viewer.setFont(["https://example.com/xxx.shx"]);
@@ -769,9 +784,9 @@ export declare class DxfViewer extends BaseViewer {
769
784
  setFont(urls: string[]): Promise<void>;
770
785
  getFont(): FontManager | undefined;
771
786
  /**
772
- * 设置加载管理器。
787
+ * 设置加载管理器、
773
788
  * @internal
774
- * 需要在加载dxf之前调用,用于加载本地外部链接。
789
+ * 需要在加载dxf之前调用,用于加载本地外部链接、
775
790
  * @param manager
776
791
  */
777
792
  setLoadingManager(manager: THREE.LoadingManager): void;
@@ -796,8 +811,8 @@ export declare class DxfViewer extends BaseViewer {
796
811
  /**
797
812
  * @description {en} Gets current view extent.
798
813
  * This is useful for user to save this value as a viewpoint, and jump to this viewpoint next time.
799
- * @description {zh} 获取当前视图范围。
800
- * 用户可使用该接口获取当前视口范围,并在适当的场景下跳转到该视口范围。
814
+ * @description {zh} 获取当前视图范围、
815
+ * 用户可使用该接口获取当前视口范围,并在适当的场景下跳转到该视口范围、
801
816
  * @example
802
817
  * ``` typescript
803
818
  * const box = viewer.getCurrentViewExtent();
@@ -813,7 +828,7 @@ export declare class DxfViewer extends BaseViewer {
813
828
  get measurePlugin(): MeasurementPlugin | undefined;
814
829
  /**
815
830
  * @description {en} Activates one of "Distance", "Area" or "Angle" measurement
816
- * @description {zh} 激活"距离", "面积" 或者 "角度"测量
831
+ * @description {zh} 激活距离", "面积" 或者"角度"测量
817
832
  * @param type
818
833
  * - "Distance", "Area" or "Angle"
819
834
  * @example
@@ -825,7 +840,7 @@ export declare class DxfViewer extends BaseViewer {
825
840
  activateMeasurement(type: MeasurementType): void;
826
841
  /**
827
842
  * @description {en} Deactivates measurement.
828
- * @description {zh} 退出测量。
843
+ * @description {zh} 退出测量、
829
844
  * @example
830
845
  * ``` typescript
831
846
  * viewer.deactivateMeasurement();
@@ -835,7 +850,7 @@ export declare class DxfViewer extends BaseViewer {
835
850
  deactivateMeasurement(): void;
836
851
  /**
837
852
  * @description {en} Gets active measurement type.
838
- * @description {zh} 获取当前激活的测量类型。
853
+ * @description {zh} 获取当前激活的测量类型、
839
854
  * @returns
840
855
  * - "Distance", "Area" or "Angle" or undefined
841
856
  * @example
@@ -848,10 +863,10 @@ export declare class DxfViewer extends BaseViewer {
848
863
  getActiveMeasurementType(): MeasurementType | undefined;
849
864
  /**
850
865
  * @description {en} Gets all measurements.
851
- * @description {zh} 获取所有测量数据。
866
+ * @description {zh} 获取所有测量数据、
852
867
  * @returns
853
868
  * - {en} measurement data array.
854
- * - {zh} 测量数据数组。
869
+ * - {zh} 测量数据数组、
855
870
  * @example
856
871
  * ``` typescript
857
872
  * const measurementData = viewer.getMeasurements();
@@ -862,16 +877,16 @@ export declare class DxfViewer extends BaseViewer {
862
877
  getMeasurements(): MeasurementData[];
863
878
  /**
864
879
  * @description {en} Cancels current measurement. This won't deactivate measurement, rather, you can start a new measurement.
865
- * @description {zh} 取消当前的测量绘制。这并不会退出测量,用户可以开始一个新的测量。
880
+ * @description {zh} 取消当前的测量绘制。这并不会退出测量,用户可以开始一个新的测量、
866
881
  * @deprecated use MeasurePlugin instead
867
882
  */
868
883
  cancelMeasurement(): void;
869
884
  /**
870
885
  * @description {en} Sets measurement data.
871
- * @description {zh} 设置测量数据。
886
+ * @description {zh} 设置测量数据、
872
887
  * @param measurementData
873
888
  * - {en} measurement data array.
874
- * - {zh} 测量数据数组。
889
+ * - {zh} 测量数据数组、
875
890
  * @example
876
891
  * ``` typescript
877
892
  * const measurementData = [{
@@ -898,10 +913,10 @@ export declare class DxfViewer extends BaseViewer {
898
913
  unselectMeasurement(): void;
899
914
  /**
900
915
  * @description {en} Removes a measurement by id.
901
- * @description {zh} 根据id删除测量数据。
916
+ * @description {zh} 根据id删除测量数据、
902
917
  * @param id
903
918
  * - {en} Measurement data id.
904
- * - {zh} 测量数据id
919
+ * - {zh} 测量数据id
905
920
  * @example
906
921
  * ``` typescript
907
922
  * const id = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
@@ -919,7 +934,7 @@ export declare class DxfViewer extends BaseViewer {
919
934
  setMeasurementVisibility(id: string, visible: boolean): boolean;
920
935
  /**
921
936
  * @description {en} Clears measurement results.
922
- * @description {zh} 清除测量结果。
937
+ * @description {zh} 清除测量结果、
923
938
  * @example
924
939
  * ``` typescript
925
940
  * viewer.clearMeasurements();
@@ -934,10 +949,10 @@ export declare class DxfViewer extends BaseViewer {
934
949
  getMarkupManager(): MarkupManager | undefined;
935
950
  /**
936
951
  * @description {en} Activates markup feature.
937
- * @description {zh} 激活标注功能。
952
+ * @description {zh} 激活标注功能、
938
953
  * @param type
939
954
  * - {en} markup type.
940
- * - {zh} 标注类型。
955
+ * - {zh} 标注类型、
941
956
  * @example
942
957
  * ``` typescript
943
958
  * const markupType = MarkupType.Arrow;
@@ -948,7 +963,7 @@ export declare class DxfViewer extends BaseViewer {
948
963
  activateMarkup(type: MarkupType): void;
949
964
  /**
950
965
  * @description {en} Deactivates markup feature.
951
- * @description {zh} 退出标注功能。
966
+ * @description {zh} 退出标注功能、
952
967
  * @example
953
968
  * ``` typescript
954
969
  * viewer.deactivateMarkup();
@@ -957,10 +972,10 @@ export declare class DxfViewer extends BaseViewer {
957
972
  deactivateMarkup(): void;
958
973
  /**
959
974
  * @description {en} Gets active markup type.
960
- * @description {zh} 获取激活的标注类型。
975
+ * @description {zh} 获取激活的标注类型、
961
976
  * @returns
962
977
  * - {en} markup type.
963
- * - {zh} 标注类型。
978
+ * - {zh} 标注类型、
964
979
  * @example
965
980
  * ``` typescript
966
981
  * const markupType = viewer.getActiveMarkupType();
@@ -1006,10 +1021,10 @@ export declare class DxfViewer extends BaseViewer {
1006
1021
  getMarkupFontSize(): number | undefined;
1007
1022
  /**
1008
1023
  * @description {en} Gets all markups.
1009
- * @description {zh} 获取所有标注数据。
1024
+ * @description {zh} 获取所有标注数据、
1010
1025
  * @returns
1011
1026
  * - {en} markup data array.
1012
- * - {zh} 标注数据数组。
1027
+ * - {zh} 标注数据数组、
1013
1028
  * @example
1014
1029
  * ``` typescript
1015
1030
  * const markupData = viewer.getMarkups();
@@ -1019,10 +1034,10 @@ export declare class DxfViewer extends BaseViewer {
1019
1034
  getMarkups(): MarkupData[];
1020
1035
  /**
1021
1036
  * @description {en} Adds markups to active layout.
1022
- * @description {zh} 添加标注到当前布局。
1037
+ * @description {zh} 添加标注到当前布局、
1023
1038
  * @param markupDataArray
1024
1039
  * - {en} markup data array.
1025
- * - {zh} 标注数据数组。
1040
+ * - {zh} 标注数据数组、
1026
1041
  * @example
1027
1042
  * ``` typescript
1028
1043
  * const markupData = [{
@@ -1045,13 +1060,13 @@ export declare class DxfViewer extends BaseViewer {
1045
1060
  setMarkupVisibility(id: string, visible: boolean): boolean;
1046
1061
  /**
1047
1062
  * @description {en} Updates a markup.
1048
- * @description {zh} 更新标注。
1063
+ * @description {zh} 更新标注、
1049
1064
  * @param {MarkupData} markup
1050
1065
  * - {en} markup data.
1051
- * - {zh} 标注数据。
1066
+ * - {zh} 标注数据、
1052
1067
  * @returns
1053
1068
  * - {en} Whether update successfully, true means success, false means failure.
1054
- * - {zh} 是否更新成功,true表示成功,false表示失败。
1069
+ * - {zh} 是否更新成功,true表示成功,false表示失败、
1055
1070
  * @example
1056
1071
  * ``` typescript
1057
1072
  * const markupData = {
@@ -1067,13 +1082,13 @@ export declare class DxfViewer extends BaseViewer {
1067
1082
  updateMarkup(markup: MarkupData): boolean;
1068
1083
  /**
1069
1084
  * @description {en} Removes a markup by markup id.
1070
- * @description {zh} 根据标注id删除标注。
1085
+ * @description {zh} 根据标注id删除标注、
1071
1086
  * @param {string} id
1072
1087
  * - {en} markup id.
1073
- * - {zh} 标注id
1088
+ * - {zh} 标注id
1074
1089
  * @returns
1075
1090
  * - {en} Whether remove successfully, true means success, false means failure.
1076
- * - {zh} 是否删除成功,true表示成功,false表示失败。
1091
+ * - {zh} 是否删除成功,true表示成功,false表示失败、
1077
1092
  * @example
1078
1093
  * ``` typescript
1079
1094
  * const markupId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
@@ -1083,7 +1098,7 @@ export declare class DxfViewer extends BaseViewer {
1083
1098
  removeMarkup(id: string): boolean;
1084
1099
  /**
1085
1100
  * @description {en} Clears markups.
1086
- * @description {zh} 清除所有标注。
1101
+ * @description {zh} 清除所有标注、
1087
1102
  * @example
1088
1103
  * ``` typescript
1089
1104
  * viewer.clearMarkups();
@@ -1114,7 +1129,7 @@ export declare class DxfViewer extends BaseViewer {
1114
1129
  protected getHitResultByNdcCoordinate(coord: Vector2): Vector2 | undefined;
1115
1130
  /**
1116
1131
  * @description {en} Asks user to select a box area, and zooms to it.
1117
- * @description {zh} 询问用户选择一个框选区域,然后缩放到该区域。
1132
+ * @description {zh} 询问用户选择一个框选区域,然后缩放到该区域、
1118
1133
  * @example
1119
1134
  * ``` typescript
1120
1135
  * viewer.zoomToRect();
@@ -1152,10 +1167,10 @@ export declare class DxfViewer extends BaseViewer {
1152
1167
  * @description {zh} 重置视图大小
1153
1168
  * @param {number} width
1154
1169
  * - {en} width of viewer
1155
- * - {zh} 视图宽度。
1170
+ * - {zh} 视图宽度、
1156
1171
  * @param {number} height
1157
1172
  * - {en} height of viewer
1158
- * - {zh} 视图高度。
1173
+ * - {zh} 视图高度、
1159
1174
  * @example
1160
1175
  * ```typescript
1161
1176
  * const width = 800;
@@ -1180,23 +1195,23 @@ export declare class DxfViewer extends BaseViewer {
1180
1195
  /**
1181
1196
  * 根据给定的鼠标位置获取相交对象
1182
1197
  *
1183
- * 使用射线投射技术检测鼠标位置与场景中的3D对象的相交情况。
1184
- * 这个方法是对象选择和交互的基础,用于确定用户点击了哪个对象。
1198
+ * 使用射线投射技术检测鼠标位置与场景中的3D对象的相交情况、
1199
+ * 这个方法是对象选择和交互的基础,用于确定用户点击了哪个对象、
1185
1200
  *
1186
1201
  * @param event - 鼠标事件信息,可选。如果不传入,则使用(0, 0)作为射线投射起点
1187
- * @returns 相交对象的数组,按距离排序(最近的在前)
1202
+ * @returns 相交对象的数组,按距离排序(最近的在前,
1188
1203
  * @private 内部方法,仅供框架内部使用
1189
1204
  */
1190
1205
  private getIntersections;
1191
1206
  /**
1192
- * 重写:事件级缓存的射线相交
1207
+ * 重写:事件级缓存的射线相事
1193
1208
  */
1194
1209
  intersectObjectsCached(event: EventInfo, objects: THREE.Object3D[], recursive: boolean, cacheKey: string): THREE.Intersection<THREE.Object3D<THREE.Event>>[];
1195
1210
  /**
1196
1211
  * 处理鼠标点击事件
1197
1212
  *
1198
- * 处理用户的鼠标点击交互,包括对象选择、取消选择等操作。
1199
- * 这个方法会检查各种状态(如测量模式、标注模式等)以避免冲突。
1213
+ * 处理用户的鼠标点击交互,包括对象选择、取消选择等操作、
1214
+ * 这个方法会检查各种状态(如测量模式、标注模式等)以避免冲突、
1200
1215
  *
1201
1216
  * @param event - 鼠标事件信息,包含点击位置、按钮状态等
1202
1217
  * @private 内部方法,由事件系统调用
@@ -1214,7 +1229,11 @@ export declare class DxfViewer extends BaseViewer {
1214
1229
  * 处理标注顶点拖拽结束
1215
1230
  */
1216
1231
  private handleAnnotationVertexDragEnd;
1232
+ private findDrawableByEvent;
1233
+ setSelectedOverlayDrawable(drawable?: Drawable | null): void;
1234
+ private selectDrawable;
1217
1235
  private selectDrawableByEvent;
1236
+ private isPreferredOverlayDrawable;
1218
1237
  /**
1219
1238
  * 检查对象是否为标注 drawable(鸭子类型检查)
1220
1239
  */
@@ -1225,7 +1244,7 @@ export declare class DxfViewer extends BaseViewer {
1225
1244
  */
1226
1245
  private selectSmallestDrawable;
1227
1246
  /**
1228
- * 判断 drawable 是否为封闭图形
1247
+ * 判断 drawable 是否为封闭图录
1229
1248
  */
1230
1249
  private isClosedShape;
1231
1250
  /**
@@ -1245,15 +1264,141 @@ export declare class DxfViewer extends BaseViewer {
1245
1264
  */
1246
1265
  private calculateLineLength;
1247
1266
  /**
1248
- * 选择或取消选择一个对象。
1249
- * depthTest 默认关闭。当对象相互覆盖时,高亮效果会更加明显。
1267
+ * 选择或取消选择一个对象、
1268
+ * depthTest 默认关闭。当对象相互覆盖时,高亮效果会更加明显、
1250
1269
  */
1251
- protected selectObject(object?: THREE.Object3D, depthTest?: boolean): void;
1270
+ protected selectObject(object?: THREE.Object3D, depthTest?: boolean, highlight?: boolean): void;
1252
1271
  /**
1253
1272
  * Clears the current selection
1254
1273
  * @internal
1255
1274
  */
1256
1275
  clearSelection(): void;
1276
+ private clearEntityHighlight;
1277
+ private highlightEntity;
1278
+ private createEntityHighlightObject;
1279
+ private extractBatchGeometry;
1280
+ private getAttributeComponent;
1281
+ private getNestedBatches;
1282
+ private createAbsoluteBatch;
1283
+ private resolveNestedMeshBatchByPointIndex;
1284
+ private resolveNestedMeshBatch;
1285
+ private resolveNestedLineBatchByIndex;
1286
+ private resolveNestedLineBatch;
1287
+ /**
1288
+ * 通过屏幕坐标拾取合并前的单个实体信息
1289
+ *
1290
+ * 使用射线投射检测指定屏幕坐标处的实体,并通过 Batch 反查获取合并前的原始实体信息。
1291
+ *
1292
+ * @param screenX - 页面坐标 X(即 MouseEvent.clientX)
1293
+ * @param screenY - 页面坐标 Y(即 MouseEvent.clientY)
1294
+ * @returns 实体数据(包含 batch 信息),如果未命中则返回 undefined
1295
+ */
1296
+ getEntityAtPoint(screenX: number, screenY: number): EntityData | undefined;
1297
+ /**
1298
+ * 获取与单击选择高亮范围完全一致的闭合轮廓。
1299
+ *
1300
+ * - 命中 batch 时,提取与 `highlightEntity()` 相同的 batch 几何。
1301
+ * - 未命中 batch 时,按 `selectObject()` 的整对象选择结果提取轮廓。
1302
+ *
1303
+ * 对于纯线条等非闭合对象,返回 `undefined`。
1304
+ */
1305
+ getSelectionRingsAtPoint(screenX: number, screenY: number): THREE.Vector3[][] | undefined;
1306
+ /**
1307
+ * 通过世界坐标拾取合并前的单个实体信息
1308
+ *
1309
+ * @param worldPoint - 世界坐标点
1310
+ * @param radius - 搜索半径(世界坐标单位),默认使用当前 raycaster 阈值
1311
+ * @returns 实体数据(包含 batch 信息),如果未命中则返回 undefined
1312
+ */
1313
+ getEntityAtWorldPoint(worldPoint: THREE.Vector3, radius?: number): EntityData | undefined;
1314
+ /**
1315
+ * 获取框选范围内的所有合并前实体信息
1316
+ *
1317
+ * 通过屏幕空间的矩形区域,提取该区域内所有合并前的原始实体(batch)信息。
1318
+ *
1319
+ * @param screenBox - 页面坐标的矩形区域 (Box2, 使用 MouseEvent.clientX/clientY 坐标系: min=左上, max=右下)
1320
+ * @returns 框选范围内所有实体的数据数组
1321
+ */
1322
+ getEntitiesInScreenBox(screenBox: THREE.Box2): EntityData[];
1323
+ /**
1324
+ * 获取世界坐标 Box3 范围内的所有合并前实体信息
1325
+ *
1326
+ * @param worldBox - 世界坐标的包围盒
1327
+ * @returns 范围内所有实体的数据数组
1328
+ */
1329
+ getEntitiesInWorldBox(worldBox: THREE.Box3): EntityData[];
1330
+ /**
1331
+ * 获取所有合并前的实体 batch 列表
1332
+ *
1333
+ * 遍历当前场景中所有可选择对象,收集所有 batch 信息。
1334
+ *
1335
+ * @returns 所有实体的数据数组
1336
+ */
1337
+ getAllEntities(): EntityData[];
1338
+ /**
1339
+ * 根据 batch 信息提取该实体的顶点数据(世界坐标)
1340
+ *
1341
+ * @param mergedObject - 合并后的 THREE.Object3D
1342
+ * @param batch - 批次信息
1343
+ * @returns 顶点坐标数组
1344
+ */
1345
+ getEntityVertices(mergedObject: THREE.Object3D, batch: Batch): THREE.Vector3[];
1346
+ /**
1347
+ * 根据 batch 信息计算该实体的包围盒
1348
+ *
1349
+ * @param mergedObject - 合并后的 THREE.Object3D
1350
+ * @param batch - 批次信息
1351
+ * @returns 包围盒
1352
+ */
1353
+ getEntityBoundingBox(mergedObject: THREE.Object3D, batch: Batch): THREE.Box3;
1354
+ private getFirstVisibleIntersectionAtPoint;
1355
+ private extractSelectionRingsFromEntity;
1356
+ private shouldRejectCanvasSizedSelection;
1357
+ private getCanvasSelectionFilterExtent;
1358
+ private extractClosedPolygonsFromSelectionBatch;
1359
+ private extractClosedPolygonsFromWholeSelectionObject;
1360
+ private extractClosedPolygonsFromLineObject;
1361
+ private resolveSelectionRings;
1362
+ private buildSelectionLoopInfos;
1363
+ private normalizeSelectionPolygon;
1364
+ private isSelectionPolygonInside;
1365
+ private findClosestFilledLoop;
1366
+ private getDistanceToSelectionPolygonEdges;
1367
+ private getDistanceToSelectionSegment;
1368
+ /**
1369
+ * 获取场景中可选择的对象列表
1370
+ * 从已加载模型的当前布局中获取有几何体的叶子对象
1371
+ */
1372
+ private getSelectableSceneObjects;
1373
+ /**
1374
+ * 从 intersection 构建 EntityData
1375
+ */
1376
+ private buildEntityDataFromIntersection;
1377
+ /**
1378
+ * 从非合并对象构建 EntityData
1379
+ */
1380
+ private buildEntityDataFromObject;
1381
+ /**
1382
+ * 从 batch 信息构建 EntityData
1383
+ */
1384
+ private buildEntityDataFromBatch;
1385
+ /**
1386
+ * 递归查找对象所属的模型 ID(向上遍历到场景根节点的直接子对象)
1387
+ */
1388
+ private findModelIdByObject;
1389
+ /**
1390
+ * 计算 batch 的包围盒
1391
+ */
1392
+ private computeBatchBoundingBox;
1393
+ /**
1394
+ * 从 NDC 坐标的矩形构建视锥体
1395
+ * 平面法线指向视锥体内部(THREE.Frustum 要求物体在所有平面的正半空间才算在视锥体内)
1396
+ */
1397
+ private buildFrustumFromNDCBox;
1398
+ /**
1399
+ * 收集视锥体内的所有实体
1400
+ */
1401
+ private collectEntitiesInFrustum;
1257
1402
  /**
1258
1403
  * 使相机飞向对象
1259
1404
  */
@@ -1267,7 +1412,7 @@ export declare class DxfViewer extends BaseViewer {
1267
1412
  */
1268
1413
  protected flyToSelectedObject(): void;
1269
1414
  /**
1270
- * 飞向随机对象(通过 alt + r)。
1415
+ * 飞向随机对象(通过 alt + r)、
1271
1416
  * 当数据错误或程序有bug时很有用,
1272
1417
  * 这时我们在场景中看不到任何东西!
1273
1418
  */
@@ -1297,20 +1442,20 @@ export declare class DxfViewer extends BaseViewer {
1297
1442
  goToHomeView(): void;
1298
1443
  /**
1299
1444
  * @description {en} Zooms to specific bounding box.
1300
- * @description {zh} 缩放到指定的包围盒.
1445
+ * @description {zh} 缩放到指定的包围监
1301
1446
  * @param bbox
1302
1447
  * - {en} 2d bounding box
1303
- * - {zh} 2d 包围盒。
1448
+ * - {zh} 2d 包围盒、
1304
1449
  * @example
1305
1450
  * ``` typescript
1306
1451
  * const box = { min: { x: 0, y: 0 }, max: { x: 10000, y: 10000} };
1307
1452
  * viewer.zoomToBBox(box);
1308
1453
  * ```
1309
1454
  */
1310
- zoomToBBox(bbox: Box2): void;
1455
+ zoomToBBox(bbox: Box2, animate?: boolean): void;
1311
1456
  /**
1312
1457
  * @description {en} Zooms to view extent.
1313
- * @description {zh} 缩放到视图范围.
1458
+ * @description {zh} 缩放到视图范图
1314
1459
  * @example
1315
1460
  * ``` typescript
1316
1461
  * viewer.zoomToExtent();
@@ -1319,16 +1464,16 @@ export declare class DxfViewer extends BaseViewer {
1319
1464
  zoomToExtent(): void;
1320
1465
  /**
1321
1466
  * @description {en} Sets background color.
1322
- * @description {zh} 设置背景颜色。
1467
+ * @description {zh} 设置背景颜色、
1323
1468
  * @param r
1324
1469
  * - {en} Red channel value between 0 and 1.
1325
- * - {zh} 红色通道值,介于 0 和 1 之间。
1470
+ * - {zh} 红色通道值,介于 0 和1 之间、
1326
1471
  * @param g
1327
1472
  * - {en} Green channel value between 0 and 1.
1328
- * - {zh} 绿色通道值,介于 0 和 1 之间。
1473
+ * - {zh} 绿色通道值,介于 0 和1 之间、
1329
1474
  * @param b
1330
1475
  * - {en} Blue channel value between 0 and 1.
1331
- * -{zh} 蓝色通道值,介于 0 和 1 之间。
1476
+ * -{zh} 蓝色通道值,介于 0 和1 之间、
1332
1477
  * @example
1333
1478
  * ``` typescript
1334
1479
  * // {en} Sets background to gray
@@ -1342,7 +1487,7 @@ export declare class DxfViewer extends BaseViewer {
1342
1487
  */
1343
1488
  private getLayoutInfo;
1344
1489
  /**
1345
- * 创建一个比包围盒大得多的地面平面。
1490
+ * 创建一个比包围盒大得多的地面平面、
1346
1491
  */
1347
1492
  private updateGroundPlane;
1348
1493
  /**