@xtctwins/tctwins-dxf-next-viewer 1.0.2 → 1.0.4

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.
Files changed (59) hide show
  1. package/README.md +401 -401
  2. package/dist/tctwins-dxf-next-viewer.css +1 -1
  3. package/dist/tctwins-dxf-next-viewer.css.gz +0 -0
  4. package/dist/tctwins-dxf-next-viewer.es.js +2624 -2614
  5. package/dist/tctwins-dxf-next-viewer.es.js.gz +0 -0
  6. package/dist/tctwins-dxf-next-viewer.umd.js +24 -32
  7. package/dist/tctwins-dxf-next-viewer.umd.js.gz +0 -0
  8. package/dist/tctwins-dxf-viewer/action-bar/annotation-active.svg +13 -13
  9. package/dist/tctwins-dxf-viewer/action-bar/annotation.svg +13 -13
  10. package/dist/tctwins-dxf-viewer/action-bar/comment-active.svg +13 -13
  11. package/dist/tctwins-dxf-viewer/action-bar/comment.svg +13 -13
  12. package/dist/tctwins-dxf-viewer/action-bar/fullscreen-active.svg +16 -16
  13. package/dist/tctwins-dxf-viewer/action-bar/fullscreen.svg +16 -16
  14. package/dist/tctwins-dxf-viewer/action-bar/hide.svg +19 -19
  15. package/dist/tctwins-dxf-viewer/action-bar/layer-active.svg +13 -13
  16. package/dist/tctwins-dxf-viewer/action-bar/layer.svg +13 -13
  17. package/dist/tctwins-dxf-viewer/action-bar/measure-active.svg +13 -13
  18. package/dist/tctwins-dxf-viewer/action-bar/measure.svg +13 -13
  19. package/dist/tctwins-dxf-viewer/action-bar/reset-active.svg +16 -16
  20. package/dist/tctwins-dxf-viewer/action-bar/reset.svg +18 -18
  21. package/dist/tctwins-dxf-viewer/action-bar/screenshot-active.svg +13 -13
  22. package/dist/tctwins-dxf-viewer/action-bar/screenshot.svg +13 -13
  23. package/dist/tctwins-dxf-viewer/action-bar/show.svg +15 -15
  24. package/dist/tctwins-dxf-viewer/annotation/file-active.svg +22 -0
  25. package/dist/tctwins-dxf-viewer/annotation/file.svg +7 -15
  26. package/dist/tctwins-dxf-viewer/annotation/image-active.svg +22 -0
  27. package/dist/tctwins-dxf-viewer/annotation/image.svg +7 -12
  28. package/dist/tctwins-dxf-viewer/annotation/record-active.svg +22 -0
  29. package/dist/tctwins-dxf-viewer/annotation/record.svg +7 -12
  30. package/dist/tctwins-dxf-viewer/annotation/text-active.svg +22 -0
  31. package/dist/tctwins-dxf-viewer/annotation/text.svg +7 -9
  32. package/dist/tctwins-dxf-viewer/annotation/video-active.svg +22 -0
  33. package/dist/tctwins-dxf-viewer/annotation/video.svg +7 -12
  34. package/dist/tctwins-dxf-viewer/comment/arrow-active.svg +22 -0
  35. package/dist/tctwins-dxf-viewer/comment/circle-active.svg +22 -0
  36. package/dist/tctwins-dxf-viewer/comment/circle.svg +7 -9
  37. package/dist/tctwins-dxf-viewer/comment/draw-active.svg +22 -0
  38. package/dist/tctwins-dxf-viewer/comment/draw.svg +8 -10
  39. package/dist/tctwins-dxf-viewer/comment/rectangle-active.svg +22 -0
  40. package/dist/tctwins-dxf-viewer/comment/rectangle.svg +7 -9
  41. package/dist/tctwins-dxf-viewer/comment/text-active.svg +22 -0
  42. package/dist/tctwins-dxf-viewer/comment/text.svg +7 -9
  43. package/dist/tctwins-dxf-viewer/measure/angle-active.svg +22 -0
  44. package/dist/tctwins-dxf-viewer/measure/angle.svg +7 -11
  45. package/dist/tctwins-dxf-viewer/measure/area-active.svg +22 -0
  46. package/dist/tctwins-dxf-viewer/measure/distance-active.svg +22 -0
  47. package/dist/tctwins-dxf-viewer/measure/distance.svg +5 -7
  48. package/dist/tctwins-dxf-viewer/measure/rectArea-active.svg +22 -0
  49. package/dist/tctwins-dxf-viewer/utils/back-dark-gray.svg +13 -13
  50. package/dist/tctwins-dxf-viewer/utils/clear.svg +12 -12
  51. package/dist/tctwins-dxf-viewer/utils/close-gray.svg +13 -13
  52. package/dist/tctwins-dxf-viewer/utils/close-input.svg +16 -16
  53. package/dist/tctwins-dxf-viewer/utils/close-red.svg +11 -11
  54. package/dist/tctwins-dxf-viewer/utils/close-white.svg +15 -15
  55. package/dist/tctwins-dxf-viewer/utils/delete-red.svg +8 -12
  56. package/dist/tctwins-dxf-viewer/utils/finish-white-circle.svg +12 -12
  57. package/dist/tctwins-dxf-viewer/utils/search.svg +13 -13
  58. package/dist/tctwins-dxf-viewer/utils/sure-input.svg +13 -13
  59. package/package.json +43 -43
package/README.md CHANGED
@@ -1,401 +1,401 @@
1
- # xtd 二维文件查看器
2
-
3
- ## 安装相关依赖
4
-
5
- ## 网络请求 axios
6
-
7
- <https://www.npmjs.com/package/axios>
8
-
9
- ```ssh
10
- npm i axios
11
- ```
12
-
13
- ## UI element-plus
14
-
15
- <https://www.npmjs.com/package/element-plus>
16
-
17
- ```ssh
18
- npm i element-plus
19
- ```
20
-
21
- ## 事件总线 mitt
22
-
23
- <https://www.npmjs.com/package/mitt>
24
-
25
- ```ssh
26
- npm i mitt
27
- ```
28
-
29
- ## 状态管理 pinia
30
-
31
- <https://www.npmjs.com/package/pinia>
32
-
33
- ```ssh
34
- npm i pinia@3
35
- ```
36
-
37
- ## 3D three
38
-
39
- <https://www.npmjs.com/package/three>
40
-
41
- ```ssh
42
- npm i three
43
- ```
44
-
45
- # 安装依赖
46
-
47
- ```ssh
48
- // 安装依赖
49
- npm i @xtctwins/tctwins-dxf-next-viewer
50
- // 引入样式
51
- import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
52
- ```
53
-
54
- # 拷贝资源
55
-
56
- ```
57
- 拷贝文件夹@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-viewer到项目public目录下,确保资源访问路径为:http://{访问域名}/tctwins-dxf-viewer/*
58
- ```
59
-
60
- # Example
61
-
62
- ```ts
63
- <template>
64
- <TctwinsDxf
65
- is-pc
66
- reset
67
- measure
68
- comment
69
- hidden
70
- layer
71
- anno
72
- screenshot
73
- :dxf-file-url="fileUrl"
74
- :fonts="fonts"
75
- :panel-right-keys="['anno']"
76
- :panel-right-width="300"
77
- @event-handle="eventHandle">
78
- <template #leftpanel>
79
- <!-- 左侧面板内容示例 -->
80
- <!-- <transition name="dxf-panel-transition">
81
- <PLayerTool v-if="props.isPc && toolbar.isToolActiveByKey('layer')" />
82
- </transition> -->
83
- </template>
84
- <template #rightpanel>
85
- <!-- 右侧面板内容示例 -->
86
- <!-- <transition name="dxf-panel-transition">
87
- <PCommentTool v-if="props.isPc && toolbar.isToolActiveByKey('comment')" />
88
- </transition>
89
- <transition name="dxf-panel-transition">
90
- <PAnnoTool v-if="props.isPc && toolbar.isToolActiveByKey('anno')" />
91
- </transition> -->
92
- </template>
93
- <template #toolpanel>
94
- <!-- 工具面板内容示例 -->
95
- <!-- <PToolbar
96
- v-if="props.isPc"
97
- :toolbars="toolbar.visibleTools" /> -->
98
- </template>
99
- </TctwinsDxf>
100
- </template>
101
- <script setup>
102
- import { ref } from "vue";
103
- // 引入样式
104
- import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
105
- import { TctwinsDxf } from "@xtctwins/tctwins-dxf-next-viewer";
106
- const fileUrl = ref("https://xxxxxx/demo.xtd");
107
- // 字体链接列表,默认字体可取tctwins-dxf-viewer/fonts下的文字路径
108
- const fonts = ref([]);
109
- const eventHandle = (event) => {
110
- console.log("通知事件", event);
111
- };
112
- </script>
113
- ```
114
-
115
- # Components
116
-
117
- ## 组件 TctwinsDxf
118
-
119
- 查看器组件
120
-
121
- ### Attributes
122
-
123
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
124
- | ------------------ | -------------------------------- | --------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------- |
125
- | isPc | 是否为 PC 端, 移动端传 false | boolean | - | true |
126
- | fonts | 字体链接列表 | string[] | - | - |
127
- | dxfFileUrl | xtd 文件 url | string | - | - |
128
- | dxfBuffer | xtd 文件 buffer | ArrayBuffer | - | - |
129
- | reset | 开启重置功能 | boolean | - | false |
130
- | measure | 开启测量功能 | boolean | - | false |
131
- | comment | 开启批注功能 | boolean | - | false |
132
- | anno | 开启标注功能 | boolean | - | false |
133
- | layer | 开启图层功能 | boolean | - | false |
134
- | hidden | 隐藏批注、测量、标注等信息 | boolean | - | false |
135
- | screenshot | 开启截图功能 | boolean | - | false |
136
- | fullscreen | 是否全屏 | boolean | - | false |
137
- | close | 是否开启关闭功能 | boolean | - | false |
138
- | leftExtraTools | 左侧额外工具栏 | IToolbar[] | - | [] |
139
- | rightExtraTools | 右侧额外工具栏 | IToolbar[] | - | [] |
140
- | bottomExtraTools | 底部额外工具栏 | IToolbar[] | - | [] |
141
- | panelLeftWidth | 右侧面板宽度 | number | - | 240 |
142
- | panelRightWidth | 右侧面板宽度 | number | - | 240 |
143
- | toolTopHeight | 工具栏顶部距离 | number | - | 0 |
144
- | toolLeftWidth | 工具栏左侧距离 | number | - | 0 |
145
- | toolRightWidth | 工具栏右侧距离 | number | - | 0 |
146
- | toolBottomHeight | 工具栏底部距离 | number | - | 0 |
147
- | panelLeftKeys | 左侧面板显示内容 | string[] | - | [] |
148
- | panelRightKeys | 右侧面板显示内容 | string[] | - | [] |
149
- | panelExtraKeys | 操作其他功能时,不需要关闭的面板 | number | - | [] |
150
- | annoFileAcceptType | 标注允许上传文件类型 | `{ image?: string; record?: string; video?: string; file?: string; }` | - | ` { image: 'image/*', record: 'audio/*', video: 'video/*', file: '*/*' }` |
151
-
152
- ### Events
153
-
154
- | 事件名 | 说明 | 回调参数 |
155
- | ----------- | -------- | ---------------------------------------------------------------------------------------------- |
156
- | eventHandle | 通知事件 | (event: { isTool: booolean; event_target: string; event_name: string; content: object;}) => {} |
157
-
158
- ### Slots
159
-
160
- | 方法名 | 说明 |
161
- | ---------- | ------------ |
162
- | leftpanel | 左侧面板内容 |
163
- | toolpanel | 工具面板内容 |
164
- | rightpanel | 右侧面板内容 |
165
-
166
- ## 组件 TctwinsDxfPanel (适用 PC)
167
-
168
- 自定义左侧或右侧面板组件时使用,可添加到 TctwinsDxf 组件的 leftpanel 或 rightpanel 插槽中使用
169
-
170
- ### Attributes
171
-
172
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
173
- | ----- | ---- | ------ | ------ | ------ |
174
- | title | 标题 | string | - | - |
175
-
176
- ### Events
177
-
178
- | 事件名 | 说明 | 回调参数 |
179
- | ---------- | -------- | -------- |
180
- | closePanel | 关闭面板 | - |
181
-
182
- ### Slots
183
-
184
- | 方法名 | 说明 |
185
- | ------- | ---- |
186
- | default | - |
187
-
188
- ## 组件 TctwinsDxfDialog (适用 PC)
189
-
190
- 自定义左侧或右侧可拖动面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
191
-
192
- ### Attributes
193
-
194
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
195
- | ----- | -------- | ---- | ------ | ------ |
196
- | title | 标题名称 | - | - | 标题 |
197
- | width | 宽度 | - | - | 240 |
198
-
199
- ### Events
200
-
201
- | 事件名 | 说明 | 回调参数 |
202
- | ---------- | -------- | -------- |
203
- | closePanel | 关闭面板 | - |
204
-
205
- ### Slots
206
-
207
- | 方法名 | 说明 |
208
- | ------- | ---- |
209
- | default | - |
210
-
211
- ## 组件 TctwinsDxfFile (适用 PC)
212
-
213
- 上传文件插件,结合组件 TctwinsDxfTool 使用
214
-
215
- ### Attributes
216
-
217
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
218
- | ---------- | -------- | ---- | ------ | -------------- |
219
- | acceptType | 上传类型 | - | - | 示例:image/\* |
220
-
221
- ### Events
222
-
223
- | 事件名 | 说明 | 回调参数 |
224
- | ------ | -------- | ------------ |
225
- | upload | 选择文件 | (file) => {} |
226
- | cancel | 取消上传 | () => {} |
227
-
228
- ## 组件 TctwinsMobileDxfPanel (适用 移动端)
229
-
230
- 自定义左侧或右侧面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
231
-
232
- ### Attributes
233
-
234
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
235
- | ----- | ---- | ------ | ------ | ------ |
236
- | title | 标题 | string | - | - |
237
-
238
- ### Events
239
-
240
- | 事件名 | 说明 | 回调参数 |
241
- | ---------- | -------- | -------- |
242
- | closePanel | 关闭面板 | - |
243
-
244
- ### Slots
245
-
246
- | 方法名 | 说明 |
247
- | ------- | ---- |
248
- | default | - |
249
-
250
- ## 组件 TctwinsMobileDxfFile (适用 移动端)
251
-
252
- 上传文件插件,结合组件 TctwinsDxfTool 使用
253
-
254
- ### Attributes
255
-
256
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
257
- | ---------- | -------- | ---- | ------ | -------------- |
258
- | acceptType | 上传类型 | - | - | 示例:image/\* |
259
-
260
- ### Events
261
-
262
- | 事件名 | 说明 | 回调参数 |
263
- | ------ | -------- | ------------ |
264
- | upload | 选择文件 | (file) => {} |
265
- | cancel | 取消上传 | () => {} |
266
-
267
- ## 组件 TctwinsDxfTool (适用 PC & 移动端)
268
-
269
- 自定义工具面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
270
-
271
- ### Attributes
272
-
273
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
274
- | ----------- | -------------------------------- | ------- | ------ | ------ |
275
- | hideAllTool | 工具显示时,是否隐藏其他全部按钮 | boolean | - | false |
276
-
277
- ### Slots
278
-
279
- | 方法名 | 说明 |
280
- | ------- | ---- |
281
- | default | - |
282
-
283
- # 工具方法
284
-
285
- ## 方法: setToolStatusByKey(key: string, isOpen?: boolean)
286
-
287
- 激活或关闭工具
288
-
289
- ### 参数
290
-
291
- | 参数 | 说明 |
292
- | ------ | -------- |
293
- | key | 工具 key |
294
- | isOpen | 是否激活 |
295
-
296
- ### 示例
297
-
298
- ```ts
299
- // 激活重置工具
300
- setToolStatusByKey("reset", true);
301
- ```
302
-
303
- ## 方法: isToolStatusByKey(key: string)
304
-
305
- 判断工具是否激活
306
-
307
- ### 参数
308
-
309
- | 参数 | 说明 |
310
- | ---- | -------- |
311
- | key | 工具 key |
312
-
313
- ### 示例
314
-
315
- ```ts
316
- if (isToolStatusByKey("reset")) {
317
- console.log("重置工具已激活");
318
- }
319
- ```
320
-
321
- ## 方法: closeAllTool()
322
-
323
- 关闭所有工具
324
-
325
- ### 示例
326
-
327
- ```ts
328
- closeAllTool();
329
- ```
330
-
331
- ## 方法: toggleAllTool(showState: boolean)
332
-
333
- 显示或隐藏所有工具
334
-
335
- ### 参数
336
-
337
- | 参数 | 说明 |
338
- | --------- | -------------- |
339
- | showState | 显示或隐藏工具 |
340
-
341
- ### 示例
342
-
343
- ```ts
344
- // 显示所有工具
345
- toggleAllTool(true);
346
- ```
347
-
348
- # 交互操作
349
-
350
- ## 数据存储格式
351
-
352
- ```ts
353
- interface Data {
354
- id: string || number;
355
- content: {
356
- [key: string]: any; // 数据
357
- }; // 创建方法返回的数据
358
- [key: string]: any; // 用户自定义的其他数据
359
- }
360
- ```
361
-
362
- ## 测量相关
363
-
364
- 1. 测量列表
365
- window.dxfViewer.measureTool.showMeasureList([] as Data[]);
366
- 2. 删除测量
367
- window.dxfViewer.measureTool.deleteTargetObjectById(event.content.id);
368
-
369
- ## 批注相关
370
-
371
- 1. 批注列表
372
- window.dxfViewer.commentTool.showCommentList([] as Data[]);
373
- 2. 删除批注
374
- window.dxfViewer.commentTool.deleteTargetObjectById(event.content.id);
375
-
376
- ## 标注相关
377
-
378
- 1. 标注列表
379
- window.dxfViewer.annotationTool.showAnnotationList([] as Data[]);
380
- 2. 删除标注
381
- 删除记录后重新绘制即可
382
-
383
- ## 图层数据源
384
-
385
- ```ts
386
- // 定义 LayerData 接口,用于描述图层的数据结构
387
- interface LayerData {
388
- color: number; // 图层的颜色,使用数字表示
389
- displayName: string; // 图层的显示名称
390
- lineType: string; // 图层的线条类型
391
- name: string; // 图层的名称
392
- objects: any[]; // 图层包含的对象数组
393
- visible: boolean; // 图层是否可见
394
- }
395
- // 使用 Map 类型来存储图层数据,键为字符串,值为 LayerData 对象
396
- const layerMap: Map<string, LayerData> = new Map(window.dxfViewer.layers);
397
- // 遍历图层数据,获取每个图层的信息
398
- for (const [key, value] of layerMap) {
399
- console.log(`图层名称:${value.name}`);
400
- }
401
- ```
1
+ # xtd 二维文件查看器
2
+
3
+ ## 安装相关依赖
4
+
5
+ ## 网络请求 axios
6
+
7
+ <https://www.npmjs.com/package/axios>
8
+
9
+ ```ssh
10
+ npm i axios
11
+ ```
12
+
13
+ ## UI element-plus
14
+
15
+ <https://www.npmjs.com/package/element-plus>
16
+
17
+ ```ssh
18
+ npm i element-plus
19
+ ```
20
+
21
+ ## 事件总线 mitt
22
+
23
+ <https://www.npmjs.com/package/mitt>
24
+
25
+ ```ssh
26
+ npm i mitt
27
+ ```
28
+
29
+ ## 状态管理 pinia
30
+
31
+ <https://www.npmjs.com/package/pinia>
32
+
33
+ ```ssh
34
+ npm i pinia@3
35
+ ```
36
+
37
+ ## 3D three
38
+
39
+ <https://www.npmjs.com/package/three>
40
+
41
+ ```ssh
42
+ npm i three
43
+ ```
44
+
45
+ # 安装依赖
46
+
47
+ ```ssh
48
+ // 安装依赖
49
+ npm i @xtctwins/tctwins-dxf-next-viewer
50
+ // 引入样式
51
+ import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
52
+ ```
53
+
54
+ # 拷贝资源
55
+
56
+ ```
57
+ 拷贝文件夹@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-viewer到项目public目录下,确保资源访问路径为:http://{访问域名}/tctwins-dxf-viewer/*
58
+ ```
59
+
60
+ # Example
61
+
62
+ ```ts
63
+ <template>
64
+ <TctwinsDxf
65
+ is-pc
66
+ reset
67
+ measure
68
+ comment
69
+ hidden
70
+ layer
71
+ anno
72
+ screenshot
73
+ :dxf-file-url="fileUrl"
74
+ :fonts="fonts"
75
+ :panel-right-keys="['anno']"
76
+ :panel-right-width="300"
77
+ @event-handle="eventHandle">
78
+ <template #leftpanel>
79
+ <!-- 左侧面板内容示例 -->
80
+ <!-- <transition name="dxf-panel-transition">
81
+ <PLayerTool v-if="props.isPc && toolbar.isToolActiveByKey('layer')" />
82
+ </transition> -->
83
+ </template>
84
+ <template #rightpanel>
85
+ <!-- 右侧面板内容示例 -->
86
+ <!-- <transition name="dxf-panel-transition">
87
+ <PCommentTool v-if="props.isPc && toolbar.isToolActiveByKey('comment')" />
88
+ </transition>
89
+ <transition name="dxf-panel-transition">
90
+ <PAnnoTool v-if="props.isPc && toolbar.isToolActiveByKey('anno')" />
91
+ </transition> -->
92
+ </template>
93
+ <template #toolpanel>
94
+ <!-- 工具面板内容示例 -->
95
+ <!-- <PToolbar
96
+ v-if="props.isPc"
97
+ :toolbars="toolbar.visibleTools" /> -->
98
+ </template>
99
+ </TctwinsDxf>
100
+ </template>
101
+ <script setup>
102
+ import { ref } from "vue";
103
+ // 引入样式
104
+ import "@xtctwins/tctwins-dxf-next-viewer/dist/tctwins-dxf-next-viewer.css";
105
+ import { TctwinsDxf } from "@xtctwins/tctwins-dxf-next-viewer";
106
+ const fileUrl = ref("https://xxxxxx/demo.xtd");
107
+ // 字体链接列表,默认字体可取tctwins-dxf-viewer/fonts下的文字路径
108
+ const fonts = ref([]);
109
+ const eventHandle = (event) => {
110
+ console.log("通知事件", event);
111
+ };
112
+ </script>
113
+ ```
114
+
115
+ # Components
116
+
117
+ ## 组件 TctwinsDxf
118
+
119
+ 查看器组件
120
+
121
+ ### Attributes
122
+
123
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
124
+ | ------------------ | -------------------------------- | --------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------- |
125
+ | isPc | 是否为 PC 端, 移动端传 false | boolean | - | true |
126
+ | fonts | 字体链接列表 | string[] | - | - |
127
+ | dxfFileUrl | xtd 文件 url | string | - | - |
128
+ | dxfBuffer | xtd 文件 buffer | ArrayBuffer | - | - |
129
+ | reset | 开启重置功能 | boolean | - | false |
130
+ | measure | 开启测量功能 | boolean | - | false |
131
+ | comment | 开启批注功能 | boolean | - | false |
132
+ | anno | 开启标注功能 | boolean | - | false |
133
+ | layer | 开启图层功能 | boolean | - | false |
134
+ | hidden | 隐藏批注、测量、标注等信息 | boolean | - | false |
135
+ | screenshot | 开启截图功能 | boolean | - | false |
136
+ | fullscreen | 是否全屏 | boolean | - | false |
137
+ | close | 是否开启关闭功能 | boolean | - | false |
138
+ | leftExtraTools | 左侧额外工具栏 | IToolbar[] | - | [] |
139
+ | rightExtraTools | 右侧额外工具栏 | IToolbar[] | - | [] |
140
+ | bottomExtraTools | 底部额外工具栏 | IToolbar[] | - | [] |
141
+ | panelLeftWidth | 右侧面板宽度 | number | - | 240 |
142
+ | panelRightWidth | 右侧面板宽度 | number | - | 240 |
143
+ | toolTopHeight | 工具栏顶部距离 | number | - | 0 |
144
+ | toolLeftWidth | 工具栏左侧距离 | number | - | 0 |
145
+ | toolRightWidth | 工具栏右侧距离 | number | - | 0 |
146
+ | toolBottomHeight | 工具栏底部距离 | number | - | 0 |
147
+ | panelLeftKeys | 左侧面板显示内容 | string[] | - | [] |
148
+ | panelRightKeys | 右侧面板显示内容 | string[] | - | [] |
149
+ | panelExtraKeys | 操作其他功能时,不需要关闭的面板 | number | - | [] |
150
+ | annoFileAcceptType | 标注允许上传文件类型 | `{ image?: string; record?: string; video?: string; file?: string; }` | - | ` { image: 'image/*', record: 'audio/*', video: 'video/*', file: '*/*' }` |
151
+
152
+ ### Events
153
+
154
+ | 事件名 | 说明 | 回调参数 |
155
+ | ----------- | -------- | ---------------------------------------------------------------------------------------------- |
156
+ | eventHandle | 通知事件 | (event: { isTool: booolean; event_target: string; event_name: string; content: object;}) => {} |
157
+
158
+ ### Slots
159
+
160
+ | 方法名 | 说明 |
161
+ | ---------- | ------------ |
162
+ | leftpanel | 左侧面板内容 |
163
+ | toolpanel | 工具面板内容 |
164
+ | rightpanel | 右侧面板内容 |
165
+
166
+ ## 组件 TctwinsDxfPanel (适用 PC)
167
+
168
+ 自定义左侧或右侧面板组件时使用,可添加到 TctwinsDxf 组件的 leftpanel 或 rightpanel 插槽中使用
169
+
170
+ ### Attributes
171
+
172
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
173
+ | ----- | ---- | ------ | ------ | ------ |
174
+ | title | 标题 | string | - | - |
175
+
176
+ ### Events
177
+
178
+ | 事件名 | 说明 | 回调参数 |
179
+ | ---------- | -------- | -------- |
180
+ | closePanel | 关闭面板 | - |
181
+
182
+ ### Slots
183
+
184
+ | 方法名 | 说明 |
185
+ | ------- | ---- |
186
+ | default | - |
187
+
188
+ ## 组件 TctwinsDxfDialog (适用 PC)
189
+
190
+ 自定义左侧或右侧可拖动面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
191
+
192
+ ### Attributes
193
+
194
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
195
+ | ----- | -------- | ---- | ------ | ------ |
196
+ | title | 标题名称 | - | - | 标题 |
197
+ | width | 宽度 | - | - | 240 |
198
+
199
+ ### Events
200
+
201
+ | 事件名 | 说明 | 回调参数 |
202
+ | ---------- | -------- | -------- |
203
+ | closePanel | 关闭面板 | - |
204
+
205
+ ### Slots
206
+
207
+ | 方法名 | 说明 |
208
+ | ------- | ---- |
209
+ | default | - |
210
+
211
+ ## 组件 TctwinsDxfFile (适用 PC)
212
+
213
+ 上传文件插件,结合组件 TctwinsDxfTool 使用
214
+
215
+ ### Attributes
216
+
217
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
218
+ | ---------- | -------- | ---- | ------ | -------------- |
219
+ | acceptType | 上传类型 | - | - | 示例:image/\* |
220
+
221
+ ### Events
222
+
223
+ | 事件名 | 说明 | 回调参数 |
224
+ | ------ | -------- | ------------ |
225
+ | upload | 选择文件 | (file) => {} |
226
+ | cancel | 取消上传 | () => {} |
227
+
228
+ ## 组件 TctwinsMobileDxfPanel (适用 移动端)
229
+
230
+ 自定义左侧或右侧面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
231
+
232
+ ### Attributes
233
+
234
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
235
+ | ----- | ---- | ------ | ------ | ------ |
236
+ | title | 标题 | string | - | - |
237
+
238
+ ### Events
239
+
240
+ | 事件名 | 说明 | 回调参数 |
241
+ | ---------- | -------- | -------- |
242
+ | closePanel | 关闭面板 | - |
243
+
244
+ ### Slots
245
+
246
+ | 方法名 | 说明 |
247
+ | ------- | ---- |
248
+ | default | - |
249
+
250
+ ## 组件 TctwinsMobileDxfFile (适用 移动端)
251
+
252
+ 上传文件插件,结合组件 TctwinsDxfTool 使用
253
+
254
+ ### Attributes
255
+
256
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
257
+ | ---------- | -------- | ---- | ------ | -------------- |
258
+ | acceptType | 上传类型 | - | - | 示例:image/\* |
259
+
260
+ ### Events
261
+
262
+ | 事件名 | 说明 | 回调参数 |
263
+ | ------ | -------- | ------------ |
264
+ | upload | 选择文件 | (file) => {} |
265
+ | cancel | 取消上传 | () => {} |
266
+
267
+ ## 组件 TctwinsDxfTool (适用 PC & 移动端)
268
+
269
+ 自定义工具面板组件时使用,可添加到 TctwinsDxf 组件的 toolpanel 插槽中使用
270
+
271
+ ### Attributes
272
+
273
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
274
+ | ----------- | -------------------------------- | ------- | ------ | ------ |
275
+ | hideAllTool | 工具显示时,是否隐藏其他全部按钮 | boolean | - | false |
276
+
277
+ ### Slots
278
+
279
+ | 方法名 | 说明 |
280
+ | ------- | ---- |
281
+ | default | - |
282
+
283
+ # 工具方法
284
+
285
+ ## 方法: setToolStatusByKey(key: string, isOpen?: boolean)
286
+
287
+ 激活或关闭工具
288
+
289
+ ### 参数
290
+
291
+ | 参数 | 说明 |
292
+ | ------ | -------- |
293
+ | key | 工具 key |
294
+ | isOpen | 是否激活 |
295
+
296
+ ### 示例
297
+
298
+ ```ts
299
+ // 激活重置工具
300
+ setToolStatusByKey("reset", true);
301
+ ```
302
+
303
+ ## 方法: isToolStatusByKey(key: string)
304
+
305
+ 判断工具是否激活
306
+
307
+ ### 参数
308
+
309
+ | 参数 | 说明 |
310
+ | ---- | -------- |
311
+ | key | 工具 key |
312
+
313
+ ### 示例
314
+
315
+ ```ts
316
+ if (isToolStatusByKey("reset")) {
317
+ console.log("重置工具已激活");
318
+ }
319
+ ```
320
+
321
+ ## 方法: closeAllTool()
322
+
323
+ 关闭所有工具
324
+
325
+ ### 示例
326
+
327
+ ```ts
328
+ closeAllTool();
329
+ ```
330
+
331
+ ## 方法: toggleAllTool(showState: boolean)
332
+
333
+ 显示或隐藏所有工具
334
+
335
+ ### 参数
336
+
337
+ | 参数 | 说明 |
338
+ | --------- | -------------- |
339
+ | showState | 显示或隐藏工具 |
340
+
341
+ ### 示例
342
+
343
+ ```ts
344
+ // 显示所有工具
345
+ toggleAllTool(true);
346
+ ```
347
+
348
+ # 交互操作
349
+
350
+ ## 数据存储格式
351
+
352
+ ```ts
353
+ interface Data {
354
+ id: string || number;
355
+ content: {
356
+ [key: string]: any; // 数据
357
+ }; // 创建方法返回的数据
358
+ [key: string]: any; // 用户自定义的其他数据
359
+ }
360
+ ```
361
+
362
+ ## 测量相关
363
+
364
+ 1. 测量列表
365
+ window.dxfViewer.measureTool.showMeasureList([] as Data[]);
366
+ 2. 删除测量
367
+ window.dxfViewer.measureTool.deleteTargetObjectById(event.content.id);
368
+
369
+ ## 批注相关
370
+
371
+ 1. 批注列表
372
+ window.dxfViewer.commentTool.showCommentList([] as Data[]);
373
+ 2. 删除批注
374
+ window.dxfViewer.commentTool.deleteTargetObjectById(event.content.id);
375
+
376
+ ## 标注相关
377
+
378
+ 1. 标注列表
379
+ window.dxfViewer.annotationTool.showAnnotationList([] as Data[]);
380
+ 2. 删除标注
381
+ 删除记录后重新绘制即可
382
+
383
+ ## 图层数据源
384
+
385
+ ```ts
386
+ // 定义 LayerData 接口,用于描述图层的数据结构
387
+ interface LayerData {
388
+ color: number; // 图层的颜色,使用数字表示
389
+ displayName: string; // 图层的显示名称
390
+ lineType: string; // 图层的线条类型
391
+ name: string; // 图层的名称
392
+ objects: any[]; // 图层包含的对象数组
393
+ visible: boolean; // 图层是否可见
394
+ }
395
+ // 使用 Map 类型来存储图层数据,键为字符串,值为 LayerData 对象
396
+ const layerMap: Map<string, LayerData> = new Map(window.dxfViewer.layers);
397
+ // 遍历图层数据,获取每个图层的信息
398
+ for (const [key, value] of layerMap) {
399
+ console.log(`图层名称:${value.name}`);
400
+ }
401
+ ```