dxfview 0.0.2

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 (258) hide show
  1. package/README.md +1 -0
  2. package/dist/dxfview.esm.min.js +7 -0
  3. package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
  4. package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
  5. package/dist/types/components/pop-panel/PopPanel.d.ts +14 -0
  6. package/dist/types/components/pop-panel/index.d.ts +1 -0
  7. package/dist/types/components/progress-bar/ProgressBar.d.ts +34 -0
  8. package/dist/types/components/progress-bar/index.d.ts +1 -0
  9. package/dist/types/components/settings/ProjectSettingsDef.d.ts +44 -0
  10. package/dist/types/components/settings/index.d.ts +1 -0
  11. package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
  12. package/dist/types/components/tool-tip/index.d.ts +1 -0
  13. package/dist/types/core/Configs.d.ts +238 -0
  14. package/dist/types/core/Constants.d.ts +164 -0
  15. package/dist/types/core/Units.d.ts +16 -0
  16. package/dist/types/core/VersionManager.d.ts +3 -0
  17. package/dist/types/core/camera-controls/CameraControls.d.ts +773 -0
  18. package/dist/types/core/camera-controls/Constants.d.ts +2 -0
  19. package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
  20. package/dist/types/core/camera-controls/index.d.ts +2 -0
  21. package/dist/types/core/camera-controls/types.d.ts +112 -0
  22. package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
  23. package/dist/types/core/camera-controls/utils/math-utils.d.ts +11 -0
  24. package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
  25. package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
  26. package/dist/types/core/canvas/Constants.d.ts +28 -0
  27. package/dist/types/core/canvas/Drawable.d.ts +87 -0
  28. package/dist/types/core/canvas/DrawableList.d.ts +29 -0
  29. package/dist/types/core/canvas/index.d.ts +4 -0
  30. package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
  31. package/dist/types/core/compare/CompareDrawable.d.ts +17 -0
  32. package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
  33. package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
  34. package/dist/types/core/compare/index.d.ts +4 -0
  35. package/dist/types/core/controls/CameraControlsEx.d.ts +34 -0
  36. package/dist/types/core/controls/index.d.ts +1 -0
  37. package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
  38. package/dist/types/core/dxf/DxfConstants.d.ts +15 -0
  39. package/dist/types/core/dxf/DxfLoader.d.ts +526 -0
  40. package/dist/types/core/dxf/DxfObject.d.ts +32 -0
  41. package/dist/types/core/dxf/DxfUtils.d.ts +79 -0
  42. package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
  43. package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
  44. package/dist/types/core/dxf/bspline.d.ts +8 -0
  45. package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
  46. package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
  47. package/dist/types/core/dxf/index.d.ts +10 -0
  48. package/dist/types/core/dxf/round10.d.ts +2 -0
  49. package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
  50. package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
  51. package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
  52. package/dist/types/core/dxf-parser/DxfParser.d.ts +327 -0
  53. package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
  54. package/dist/types/core/dxf-parser/ParseHelpers.d.ts +36 -0
  55. package/dist/types/core/dxf-parser/entities/3dface.d.ts +11 -0
  56. package/dist/types/core/dxf-parser/entities/arc.d.ts +16 -0
  57. package/dist/types/core/dxf-parser/entities/attdef.d.ts +31 -0
  58. package/dist/types/core/dxf-parser/entities/attrib.d.ts +31 -0
  59. package/dist/types/core/dxf-parser/entities/circle.d.ts +13 -0
  60. package/dist/types/core/dxf-parser/entities/dimension.d.ts +22 -0
  61. package/dist/types/core/dxf-parser/entities/ellipse.d.ts +15 -0
  62. package/dist/types/core/dxf-parser/entities/geomtry.d.ts +40 -0
  63. package/dist/types/core/dxf-parser/entities/hatch.d.ts +108 -0
  64. package/dist/types/core/dxf-parser/entities/image.d.ts +37 -0
  65. package/dist/types/core/dxf-parser/entities/insert.d.ts +20 -0
  66. package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
  67. package/dist/types/core/dxf-parser/entities/line.d.ts +10 -0
  68. package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +21 -0
  69. package/dist/types/core/dxf-parser/entities/mleader.d.ts +101 -0
  70. package/dist/types/core/dxf-parser/entities/mtext.d.ts +18 -0
  71. package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +20 -0
  72. package/dist/types/core/dxf-parser/entities/point.d.ts +11 -0
  73. package/dist/types/core/dxf-parser/entities/polyline.d.ts +20 -0
  74. package/dist/types/core/dxf-parser/entities/ray.d.ts +10 -0
  75. package/dist/types/core/dxf-parser/entities/region.d.ts +10 -0
  76. package/dist/types/core/dxf-parser/entities/seqend.d.ts +8 -0
  77. package/dist/types/core/dxf-parser/entities/solid.d.ts +10 -0
  78. package/dist/types/core/dxf-parser/entities/spline.d.ts +23 -0
  79. package/dist/types/core/dxf-parser/entities/table.d.ts +42 -0
  80. package/dist/types/core/dxf-parser/entities/text.d.ts +18 -0
  81. package/dist/types/core/dxf-parser/entities/vertex.d.ts +20 -0
  82. package/dist/types/core/dxf-parser/entities/viewport.d.ts +46 -0
  83. package/dist/types/core/dxf-parser/entities/xline.d.ts +10 -0
  84. package/dist/types/core/dxf-parser/index.d.ts +27 -0
  85. package/dist/types/core/dxf-parser/objects/common.d.ts +15 -0
  86. package/dist/types/core/dxf-parser/objects/dictionary.d.ts +19 -0
  87. package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
  88. package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
  89. package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
  90. package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
  91. package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
  92. package/dist/types/core/font/BaseFont.d.ts +88 -0
  93. package/dist/types/core/font/FontManager.d.ts +107 -0
  94. package/dist/types/core/font/MeshFont.d.ts +44 -0
  95. package/dist/types/core/font/ShxFont.d.ts +108 -0
  96. package/dist/types/core/font/index.d.ts +1 -0
  97. package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +1 -0
  98. package/dist/types/core/font/shx/Shx.constants.d.ts +11 -0
  99. package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
  100. package/dist/types/core/font/shx/TextShape.d.ts +24 -0
  101. package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
  102. package/dist/types/core/font/shx/index.d.ts +1 -0
  103. package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
  104. package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
  105. package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
  106. package/dist/types/core/geometry-offset/index.d.ts +1 -0
  107. package/dist/types/core/helpers/BinaryReader.d.ts +24 -0
  108. package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
  109. package/dist/types/core/helpers/LoadingHelper.d.ts +46 -0
  110. package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
  111. package/dist/types/core/helpers/OSnapHelper.d.ts +167 -0
  112. package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
  113. package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
  114. package/dist/types/core/helpers/RafHelper.d.ts +18 -0
  115. package/dist/types/core/helpers/ZoomToRectHelper.d.ts +17 -0
  116. package/dist/types/core/helpers/index.d.ts +9 -0
  117. package/dist/types/core/index.d.ts +18 -0
  118. package/dist/types/core/indexeddb/AnnotationTable.d.ts +14 -0
  119. package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
  120. package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
  121. package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
  122. package/dist/types/core/indexeddb/IndexedDbManager.d.ts +29 -0
  123. package/dist/types/core/indexeddb/ViewpointTable.d.ts +14 -0
  124. package/dist/types/core/indexeddb/index.d.ts +6 -0
  125. package/dist/types/core/input/InputManager.d.ts +161 -0
  126. package/dist/types/core/input/index.d.ts +1 -0
  127. package/dist/types/core/license/AutoConfig.d.ts +17 -0
  128. package/dist/types/core/license/LicenseManager.d.ts +107 -0
  129. package/dist/types/core/license/PublicKey.d.ts +1 -0
  130. package/dist/types/core/license/index.d.ts +1 -0
  131. package/dist/types/core/markup/ArrowMarkup.d.ts +14 -0
  132. package/dist/types/core/markup/BaseMarkup.d.ts +28 -0
  133. package/dist/types/core/markup/CircleMarkup.d.ts +12 -0
  134. package/dist/types/core/markup/CloudLineMarkup.d.ts +10 -0
  135. package/dist/types/core/markup/CloudRectMarkup.d.ts +11 -0
  136. package/dist/types/core/markup/CloudRectWithTextMarkup.d.ts +43 -0
  137. package/dist/types/core/markup/Constants.d.ts +17 -0
  138. package/dist/types/core/markup/DotMarkup.d.ts +9 -0
  139. package/dist/types/core/markup/EllipseMarkup.d.ts +12 -0
  140. package/dist/types/core/markup/LeaderLineMarkup.d.ts +25 -0
  141. package/dist/types/core/markup/MarkupManager.d.ts +91 -0
  142. package/dist/types/core/markup/PolylineMarkup.d.ts +11 -0
  143. package/dist/types/core/markup/RectMarkup.d.ts +10 -0
  144. package/dist/types/core/markup/TextMarkup.d.ts +40 -0
  145. package/dist/types/core/markup/XMarkup.d.ts +10 -0
  146. package/dist/types/core/markup/index.d.ts +13 -0
  147. package/dist/types/core/model/Constants.d.ts +51 -0
  148. package/dist/types/core/model/Model.d.ts +18 -0
  149. package/dist/types/core/model/Model2d.d.ts +115 -0
  150. package/dist/types/core/model/index.d.ts +3 -0
  151. package/dist/types/core/patches/Constants.d.ts +4 -0
  152. package/dist/types/core/patches/Line.d.ts +2 -0
  153. package/dist/types/core/patches/Mesh.d.ts +2 -0
  154. package/dist/types/core/patches/Points.d.ts +2 -0
  155. package/dist/types/core/patches/index.d.ts +4 -0
  156. package/dist/types/core/undo-redo/AddAnnotationCommand.d.ts +11 -0
  157. package/dist/types/core/undo-redo/AddMarkupCommand.d.ts +10 -0
  158. package/dist/types/core/undo-redo/AddMeasurementCommand.d.ts +9 -0
  159. package/dist/types/core/undo-redo/Command.d.ts +6 -0
  160. package/dist/types/core/undo-redo/RemoveAnnotationCommand.d.ts +11 -0
  161. package/dist/types/core/undo-redo/RemoveMarkupCommand.d.ts +10 -0
  162. package/dist/types/core/undo-redo/RemoveMeasurementCommand.d.ts +9 -0
  163. package/dist/types/core/undo-redo/UndoRedoManager.d.ts +21 -0
  164. package/dist/types/core/undo-redo/UpdateMarkupCommand.d.ts +11 -0
  165. package/dist/types/core/undo-redo/index.d.ts +9 -0
  166. package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
  167. package/dist/types/core/utils/ColorUtils.d.ts +21 -0
  168. package/dist/types/core/utils/CommonUtils.d.ts +125 -0
  169. package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
  170. package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +4 -0
  171. package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
  172. package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
  173. package/dist/types/core/utils/Event.d.ts +33 -0
  174. package/dist/types/core/utils/FpsUtils.d.ts +13 -0
  175. package/dist/types/core/utils/GeometryUtils.d.ts +111 -0
  176. package/dist/types/core/utils/Locale.d.ts +190 -0
  177. package/dist/types/core/utils/LogUtils.d.ts +7 -0
  178. package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
  179. package/dist/types/core/utils/MathUtils.d.ts +59 -0
  180. package/dist/types/core/utils/MergeUtils.d.ts +638 -0
  181. package/dist/types/core/utils/ObjectUtils.d.ts +87 -0
  182. package/dist/types/core/utils/PolygonUtils.d.ts +8 -0
  183. package/dist/types/core/utils/SVGObjectUtils.d.ts +16 -0
  184. package/dist/types/core/utils/SceneUtils.d.ts +26 -0
  185. package/dist/types/core/utils/SectionUtils.d.ts +11 -0
  186. package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
  187. package/dist/types/core/utils/index.d.ts +21 -0
  188. package/dist/types/core/viewers/BaseViewer.d.ts +265 -0
  189. package/dist/types/core/viewers/DxfViewer.d.ts +1372 -0
  190. package/dist/types/core/viewers/Plugin.d.ts +29 -0
  191. package/dist/types/core/viewers/ViewerEvent.d.ts +178 -0
  192. package/dist/types/core/viewers/index.d.ts +4 -0
  193. package/dist/types/export.doc.d.ts +10 -0
  194. package/dist/types/fetch-polyfill.d.ts +2 -0
  195. package/dist/types/index.d.ts +8 -0
  196. package/dist/types/plugins/annotation/AnnotationPlugin.d.ts +139 -0
  197. package/dist/types/plugins/annotation/AutoDrawAnnotation.d.ts +63 -0
  198. package/dist/types/plugins/annotation/BaseAnnotation.d.ts +113 -0
  199. package/dist/types/plugins/annotation/BaseAnnotationDrawable.d.ts +139 -0
  200. package/dist/types/plugins/annotation/CopyAnnotation.d.ts +36 -0
  201. package/dist/types/plugins/annotation/CopyDrawable.d.ts +26 -0
  202. package/dist/types/plugins/annotation/FreeDrawAnnotation.d.ts +59 -0
  203. package/dist/types/plugins/annotation/RectAnnotation.d.ts +53 -0
  204. package/dist/types/plugins/annotation/RectDrawable.d.ts +42 -0
  205. package/dist/types/plugins/annotation/ShapeFinder.d.ts +51 -0
  206. package/dist/types/plugins/annotation/freeDrawDrawable.d.ts +21 -0
  207. package/dist/types/plugins/annotation/index.d.ts +8 -0
  208. package/dist/types/plugins/annotation/type.d.ts +182 -0
  209. package/dist/types/plugins/axis-gizmo/AxisGizmoPlugin.d.ts +49 -0
  210. package/dist/types/plugins/axis-gizmo/CoordinateAxes.d.ts +12 -0
  211. package/dist/types/plugins/axis-gizmo/index.d.ts +1 -0
  212. package/dist/types/plugins/bottom-bar/BottomBarPlugin.d.ts +44 -0
  213. package/dist/types/plugins/bottom-bar/index.d.ts +1 -0
  214. package/dist/types/plugins/divide/CoverLayerManager.d.ts +44 -0
  215. package/dist/types/plugins/divide/DivGeometryUtils.d.ts +66 -0
  216. package/dist/types/plugins/divide/DividePlugin.d.ts +181 -0
  217. package/dist/types/plugins/divide/FrameAnnotation.d.ts +142 -0
  218. package/dist/types/plugins/divide/FrameDrawable.d.ts +75 -0
  219. package/dist/types/plugins/divide/index.d.ts +6 -0
  220. package/dist/types/plugins/divide/types.d.ts +38 -0
  221. package/dist/types/plugins/hotpoint/HotpointPlugin.d.ts +93 -0
  222. package/dist/types/plugins/hotpoint/index.d.ts +1 -0
  223. package/dist/types/plugins/index.d.ts +12 -0
  224. package/dist/types/plugins/layer-manager/LayerManagerPlugin.d.ts +59 -0
  225. package/dist/types/plugins/layer-manager/index.d.ts +1 -0
  226. package/dist/types/plugins/local-model-uploader/IUploader.d.ts +10 -0
  227. package/dist/types/plugins/local-model-uploader/LocalDxfUploader.d.ts +19 -0
  228. package/dist/types/plugins/local-model-uploader/index.d.ts +1 -0
  229. package/dist/types/plugins/measure/AngleMeasureDrawable.d.ts +12 -0
  230. package/dist/types/plugins/measure/AngleMeasurement.d.ts +16 -0
  231. package/dist/types/plugins/measure/AreaMeasureDrawable.d.ts +14 -0
  232. package/dist/types/plugins/measure/AreaMeasurement.d.ts +31 -0
  233. package/dist/types/plugins/measure/BaseMeasureDrawable.d.ts +35 -0
  234. package/dist/types/plugins/measure/BaseMeasurement.d.ts +127 -0
  235. package/dist/types/plugins/measure/CoordinateMeasureDrawable.d.ts +10 -0
  236. package/dist/types/plugins/measure/CoordinateMeasurement.d.ts +15 -0
  237. package/dist/types/plugins/measure/DistanceMeasureDrawable.d.ts +15 -0
  238. package/dist/types/plugins/measure/DistanceMeasurement.d.ts +28 -0
  239. package/dist/types/plugins/measure/MeasurementPlugin.d.ts +131 -0
  240. package/dist/types/plugins/measure/index.d.ts +3 -0
  241. package/dist/types/plugins/overview-map/ImageDrawable.d.ts +41 -0
  242. package/dist/types/plugins/overview-map/LineDrawable.d.ts +20 -0
  243. package/dist/types/plugins/overview-map/OverviewMapDrawable.d.ts +24 -0
  244. package/dist/types/plugins/overview-map/OverviewMapPlugin.d.ts +156 -0
  245. package/dist/types/plugins/overview-map/TextDrawable.d.ts +50 -0
  246. package/dist/types/plugins/overview-map/index.d.ts +5 -0
  247. package/dist/types/plugins/screenshot/ScreenshotPlugin.d.ts +88 -0
  248. package/dist/types/plugins/screenshot/index.d.ts +1 -0
  249. package/dist/types/plugins/stats/StatsPlugin.d.ts +20 -0
  250. package/dist/types/plugins/stats/index.d.ts +1 -0
  251. package/dist/types/plugins/toolbars/DxfViewerToolbarPlugin.d.ts +67 -0
  252. package/dist/types/plugins/toolbars/MarkupToolbar.d.ts +33 -0
  253. package/dist/types/plugins/toolbars/Toolbar.config.d.ts +5 -0
  254. package/dist/types/plugins/toolbars/Toolbar.constants.d.ts +96 -0
  255. package/dist/types/plugins/toolbars/Toolbar.d.ts +102 -0
  256. package/dist/types/plugins/toolbars/index.d.ts +5 -0
  257. package/dist/types/version.d.ts +2 -0
  258. package/package.json +90 -0
@@ -0,0 +1,66 @@
1
+ import * as THREE from "three";
2
+ /**
3
+ * 几何计算工具类 - 提供用于图框识别的几何计算方法
4
+ * 包含点的处理、包围盒计算、矩形判断等功能
5
+ */
6
+ export declare class DivGeometryUtils {
7
+ /**
8
+ * 获取三维对象的二维包围盒
9
+ * 将三维对象投影到XY平面上,获取其二维包围盒
10
+ * @param object 三维对象
11
+ * @returns 二维包围盒或undefined(如果获取失败)
12
+ */
13
+ static getObjectBox2(object: THREE.Object3D): THREE.Box2 | undefined;
14
+ /**
15
+ * 判断一个二维包围盒是否完全包含另一个包围盒
16
+ * 用于判断对象是否在图框内部
17
+ * @param outer 外层包围盒(图框)
18
+ * @param inner 内层包围盒(对象)
19
+ * @param epsilon 容差值,用于处理浮点数精度问题
20
+ * @returns true=完全包含, false=不包含或部分包含
21
+ */
22
+ static box2ContainsBox2(outer: THREE.Box2, inner: THREE.Box2, epsilon?: number): boolean;
23
+ /**
24
+ * 获取折线对象的有序点列
25
+ * 从 THREE.Line 对象中提取所有顶点,并转换为世界坐标系下的二维点
26
+ * @param line 线条对象
27
+ * @returns 二维点数组或undefined(如果点数不足)
28
+ */
29
+ static getOrderedPolylinePoints(line: THREE.Line): THREE.Vector2[] | undefined;
30
+ /**
31
+ * 将点集转换为轴对齐包围盒(AABB)
32
+ * 计算所有点的最小包围矩形
33
+ * @param points 二维点数组
34
+ * @returns 包围盒对象 {minX, minY, maxX, maxY}
35
+ */
36
+ static pointsToAabb(points: THREE.Vector2[]): {
37
+ minX: number;
38
+ minY: number;
39
+ maxX: number;
40
+ maxY: number;
41
+ };
42
+ /**
43
+ * 获取相邻非重复的点序列
44
+ * 移除相邻且距离过近的重复点,用于清理折线数据
45
+ * @param points 原始点数组
46
+ * @param epsilon 距离阈值,小于该值的相邻点被视为重复
47
+ * @returns 去重后的点数组
48
+ */
49
+ static getAdjacentNonRepeatVec2(points: THREE.Vector2[], epsilon?: number): THREE.Vector2[];
50
+ /**
51
+ * 判断点序列是否形成闭合曲线
52
+ * 检查第一个点和最后一个点的距离是否足够近
53
+ * @param points 点数组
54
+ * @param epsilon 距离阈值
55
+ * @returns true=闭合, false=开放
56
+ */
57
+ static isClosed(points: THREE.Vector2[], epsilon?: number): boolean;
58
+ /**
59
+ * 判断四个点是否构成轴对齐矩形
60
+ * 使用两种检验:1)对角线中点相同且到各点距离相等 2)轴对齐(水平垂直边)
61
+ * @param points 四个点的数组
62
+ * @param epsilon 数值精度阈值
63
+ * @returns true=是轴对齐矩形, false=不是
64
+ */
65
+ static isRectangle(points: THREE.Vector2[], epsilon?: number): boolean;
66
+ }
@@ -0,0 +1,181 @@
1
+ import type { DivideFrameInfo } from "./types";
2
+ import type { BaseViewer } from "../../core/viewers";
3
+ import { Plugin } from "../../core/viewers/Plugin";
4
+ /**
5
+ * 划分图纸插件 - 手动绘制并管理DXF文件中的图框结构
6
+ * 主要功能:手动绘制矩形图框、提供图框内容的显隐控制、支持图框重命名和缩放功能
7
+ */
8
+ export declare class DividePlugin extends Plugin {
9
+ static DEFAULT_ID: string;
10
+ private active;
11
+ private frames;
12
+ private outlineGroup?;
13
+ private hiddenRefCount;
14
+ private originalVisible;
15
+ private coverLayerManager;
16
+ private frameAnnotation?;
17
+ private overlayRender?;
18
+ private drawableList?;
19
+ private osnapHelper?;
20
+ private inputManager?;
21
+ /**
22
+ * 构造划分图纸插件
23
+ * @param viewer 3D查看器实例
24
+ */
25
+ constructor(viewer: BaseViewer);
26
+ /**
27
+ * 检查插件是否已激活
28
+ * @returns true=已激活, false=未激活
29
+ */
30
+ isActive(): boolean;
31
+ /**
32
+ * 激活插件 - 开始手动绘制图框功能
33
+ */
34
+ activate(): void;
35
+ /**
36
+ * 停用插件 - 清理所有图框显示并恢复原始状态
37
+ */
38
+ deactivate(): void;
39
+ /**
40
+ * 销毁插件 - 释放所有资源
41
+ */
42
+ destroy(): void;
43
+ /**
44
+ * 初始化手动绘制组件
45
+ */
46
+ private initManualDrawing;
47
+ /**
48
+ * 更新吸附容差
49
+ */
50
+ private updateSnapTolerance;
51
+ /**
52
+ * 初始化手动绘制事件
53
+ */
54
+ private initManualDrawingEvents;
55
+ /**
56
+ * 将FrameDrawable转换为InternalFrame
57
+ */
58
+ private convertDrawableToFrame;
59
+ /**
60
+ * 设置指定图框的种类
61
+ */
62
+ setFrameCategory(id: string, category: string): boolean;
63
+ /**
64
+ * 添加图框到列表
65
+ */
66
+ private addFrame;
67
+ /**
68
+ * 获取所有手动绘制的图框信息(只读)
69
+ * @returns 图框信息数组,不包含内部对象引用
70
+ */
71
+ getFrames(): DivideFrameInfo[];
72
+ /**
73
+ * 激活手动绘制模式
74
+ */
75
+ private activateManualDrawing;
76
+ /**
77
+ * 停用手动绘制模式
78
+ */
79
+ private deactivateManualDrawing;
80
+ /**
81
+ * 根据ID删除指定图框
82
+ */
83
+ removeFrameById(id: string): boolean;
84
+ /**
85
+ * 清除所有手动绘制的图框
86
+ */
87
+ clearFrames(): void;
88
+ /**
89
+ * 重命名指定的图框
90
+ * @param id 图框ID
91
+ * @param newTitle 新的图框名称
92
+ * @returns true=成功, false=找不到指定图框
93
+ */
94
+ renameFrame(id: string, newTitle: string): boolean;
95
+ /**
96
+ * 设置图框轮廓的可见性(仅影响边框线条)
97
+ * @param id 图框ID
98
+ * @param visible true=显示轮廓, false=隐藏轮廓
99
+ * @returns true=成功, false=找不到指定图框
100
+ */
101
+ setFrameOutlineVisible(id: string, visible: boolean): boolean;
102
+ /**
103
+ * 获取图框轮廓的可见性状态
104
+ * @param id 图框ID
105
+ * @returns true=可见, false=隐藏, undefined=找不到指定图框
106
+ */
107
+ getFrameOutlineVisible(id: string): boolean | undefined;
108
+ /**
109
+ * 切换图框轮廓的显隐状态
110
+ * @param id 图框ID
111
+ * @returns 切换后的状态(true=可见, false=隐藏)或undefined(找不到指定图框)
112
+ */
113
+ toggleFrameOutline(id: string): boolean | undefined;
114
+ /**
115
+ * 设置图框内容的可见性(使用覆盖层伪显隐)
116
+ * 注意:这是伪显隐,实际上是通过覆盖层遮挡内容
117
+ * @param id 图框ID
118
+ * @param visible true=显示内容(隐藏覆盖层), false=隐藏内容(显示覆盖层)
119
+ * @returns true=成功, false=找不到指定图框
120
+ */
121
+ setInsideVisibility(id: string, visible: boolean): boolean;
122
+ /**
123
+ * 重置所有图框的可见性 - 显示所有内容
124
+ * 清除所有覆盖层和隐藏状态,恢复初始显示状态
125
+ */
126
+ resetVisibility(): void;
127
+ /**
128
+ * 缩放相机到指定图框区域
129
+ * 调整相机视角使指定图框充满视口
130
+ * @param id 图框ID
131
+ * @returns true=成功, false=找不到指定图框
132
+ */
133
+ zoomToFrame(id: string): boolean;
134
+ /**
135
+ * 清理所有图框轮廓和覆盖层 - 释放相关资源
136
+ * 在停用插件或刷新图框时调用
137
+ */
138
+ private clearOutlines;
139
+ /**
140
+ * 绘制所有图框的轮廓线条和覆盖层
141
+ * 为每个识别到的图框创建青色的轮廓线框和对应的覆盖层
142
+ */
143
+ private drawOutlines;
144
+ /**
145
+ * 恢复所有对象的原始可见性状态
146
+ * 清除所有隐藏引用计数,恢复对象的原始 visible 属性
147
+ */
148
+ private restoreAllObjectsVisibility;
149
+ /**
150
+ * 获取当前活动布局的三维对象
151
+ * 通过访问查看器的内部状态来获取当前模型和布局
152
+ * @returns 布局对象或undefined(如果获取失败)
153
+ */
154
+ private getActiveLayoutObject;
155
+ /**
156
+ * 统一设置图框的整体可见性(包括轮廓和内容)
157
+ * @param id 图框ID
158
+ * @param visible true=显示整个图框, false=隐藏整个图框
159
+ * @returns true=成功, false=找不到指定图框
160
+ */
161
+ setFrameVisible(id: string, visible: boolean): boolean;
162
+ /**
163
+ * 获取图框的整体可见性状态
164
+ * 直接返回图框的visible属性
165
+ * @param id 图框ID
166
+ * @returns true=整个图框可见, false=整个或部分图框隐藏, undefined=找不到指定图框
167
+ */
168
+ getFrameVisible(id: string): boolean | undefined;
169
+ /**
170
+ * 创建带有信息的图框
171
+ * @param drawable 绘制数据
172
+ * @param title 图框标题
173
+ * @param category 图框分类
174
+ */
175
+ createFrameWithInfo(drawable: any, title: string, category: string): void;
176
+ /**
177
+ * 取消图框创建
178
+ * @param drawable 要取消的绘制数据
179
+ */
180
+ cancelFrameCreation(drawable: any): void;
181
+ }
@@ -0,0 +1,142 @@
1
+ import * as THREE from "three";
2
+ import { FrameDrawable } from "./FrameDrawable";
3
+ import { DrawableList } from "../../core/canvas";
4
+ import { OSnapHelper } from "../../core/helpers";
5
+ import { EventInfo, InputManager } from "../../core/input/InputManager";
6
+ import { Event } from "../../core/utils";
7
+ import type { BaseViewer } from "../../core/viewers";
8
+ /**
9
+ * 图框标注事件类型
10
+ */
11
+ declare type FrameAnnotationEvents = {
12
+ /** 绘制图框完成时触发 */
13
+ Completed: FrameDrawable;
14
+ /** 停用图框工具时触发 */
15
+ Deactivate: void;
16
+ /** 绘制时第一个点被拾取时触发 */
17
+ FirstPointPicked: FrameDrawable;
18
+ /** 图框即将被添加到列表时触发 */
19
+ WillBeAdded: FrameDrawable;
20
+ /** 图框被更新时触发 */
21
+ Updated: FrameDrawable;
22
+ /** 图框即将被移除时触发 */
23
+ WillBeRemoved: FrameDrawable;
24
+ };
25
+ /**
26
+ * 图框手动绘制工具
27
+ * 支持通过两次点击绘制矩形图框:第一次点击确定起始点,第二次点击确定结束点
28
+ * 在绘制过程中提供实时预览
29
+ */
30
+ export declare class FrameAnnotation extends Event<FrameAnnotationEvents> {
31
+ protected viewer: BaseViewer;
32
+ private inputManager;
33
+ protected drawList: DrawableList;
34
+ protected osnapHelper: OSnapHelper;
35
+ protected raycaster?: THREE.Raycaster;
36
+ protected mouseMoved: boolean;
37
+ protected mouseDowned: boolean;
38
+ protected mouseDownPositionX: number;
39
+ protected mouseDownPositionY: number;
40
+ protected lastMoveEvent?: EventInfo;
41
+ protected lastMouseDownPosition?: THREE.Vector3;
42
+ protected currentFrameDrawable?: FrameDrawable;
43
+ protected drawingPoints?: THREE.Vector3[];
44
+ protected completed?: boolean;
45
+ protected snapPoint?: THREE.Vector3;
46
+ private startPoint?;
47
+ constructor(viewer: BaseViewer, inputManager: InputManager, drawList: DrawableList, osnapHelper: OSnapHelper);
48
+ get canvas(): HTMLCanvasElement;
49
+ get camera(): THREE.Camera;
50
+ /**
51
+ * 检查是否处于激活状态
52
+ */
53
+ get isActive(): boolean;
54
+ /**
55
+ * 检查是否正在绘制
56
+ */
57
+ get isAnnotating(): boolean;
58
+ /**
59
+ * 激活图框绘制工具
60
+ */
61
+ activate(): void;
62
+ /**
63
+ * 停用图框绘制工具
64
+ */
65
+ deactivate(): void;
66
+ /**
67
+ * 绑定事件监听器
68
+ */
69
+ private bindEvents;
70
+ /**
71
+ * 解绑事件监听器
72
+ */
73
+ private unbindEvents;
74
+ /**
75
+ * 鼠标按下事件处理
76
+ */
77
+ private onMouseDown;
78
+ /**
79
+ * 鼠标移动事件处理
80
+ */
81
+ private onMouseMove;
82
+ /**
83
+ * 鼠标松开事件处理
84
+ */
85
+ private onMouseUp;
86
+ /**
87
+ * 鼠标点击事件处理
88
+ */
89
+ private onMouseClick;
90
+ /**
91
+ * 键盘事件处理
92
+ */
93
+ private onKeyDown;
94
+ /**
95
+ * 开始绘制图框
96
+ */
97
+ private startDrawing;
98
+ /**
99
+ * 完成绘制图框
100
+ */
101
+ private finishDrawing;
102
+ /**
103
+ * 退出绘制
104
+ */
105
+ exitDrawing(): void;
106
+ /**
107
+ * 取消当前绘制
108
+ */
109
+ cancel(): void;
110
+ /**
111
+ * 完成当前绘制
112
+ */
113
+ protected complete(): void;
114
+ /**
115
+ * 创建图框drawable
116
+ */
117
+ protected createFrameDrawable(): FrameDrawable | undefined;
118
+ /**
119
+ * 添加drawable到列表
120
+ */
121
+ protected addDrawable(drawable: FrameDrawable): void;
122
+ /**
123
+ * 从列表移除drawable
124
+ */
125
+ protected removeDrawable(drawable: FrameDrawable): void;
126
+ /**
127
+ * 鼠标移动时更新绘制
128
+ */
129
+ protected onMouseMove_UpdateDrawing(position: THREE.Vector3): void;
130
+ /**
131
+ * 创建或更新当前的图框 drawable
132
+ * 类似于 BaseAnnotation 的 createOrUpdateAnnotationDrawable 方法
133
+ */
134
+ protected createOrUpdateFrameDrawable(position?: THREE.Vector3): void;
135
+ get renderer(): THREE.WebGLRenderer;
136
+ /**
137
+ * 获取射线与场景的交点列表(已按距离排序且过滤被裁剪的点)
138
+ * 完全按照 BaseAnnotation.ts 的实现
139
+ */
140
+ getIntersections: (e: EventInfo) => THREE.Intersection[];
141
+ }
142
+ export {};
@@ -0,0 +1,75 @@
1
+ import * as THREE from "three";
2
+ import { Drawable } from "../../core/canvas";
3
+ import { OSnapHelper } from "../../core/helpers";
4
+ import type { BaseViewer } from "../../core/viewers";
5
+ /**
6
+ * 图框绘制Drawable
7
+ * 支持通过两个对角点绘制矩形图框,具有边框和可选填充
8
+ */
9
+ export declare class FrameDrawable extends Drawable {
10
+ protected osnapHelper: OSnapHelper;
11
+ protected viewer?: BaseViewer;
12
+ protected raycaster?: THREE.Raycaster;
13
+ protected isDrawing: boolean;
14
+ protected editPointSize: number;
15
+ protected editPointFillColor: string;
16
+ protected editPointStrokeColor: string;
17
+ protected frameLineColor: number[];
18
+ protected selectedFrameLineColor: number[];
19
+ protected frameLineWidth: number;
20
+ constructor(id: string, osnapHelper: OSnapHelper, points: THREE.Vector3[], viewer?: BaseViewer);
21
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
22
+ /**
23
+ * 根据两个对角点计算矩形的四个顶点
24
+ */
25
+ private getRectPoints;
26
+ /**
27
+ * 绘制编辑点
28
+ */
29
+ private drawEditPoints;
30
+ isPointInPath(): boolean;
31
+ getVertexes(): THREE.Vector3[];
32
+ getClassType(): string;
33
+ /**
34
+ * 绘制选中状态
35
+ */
36
+ drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
37
+ /**
38
+ * 重写更新方法,确保图框只需要两个点
39
+ */
40
+ update(points: THREE.Vector3[]): this;
41
+ /**
42
+ * 设置绘制状态
43
+ */
44
+ setDrawingState(isDrawing: boolean): void;
45
+ /**
46
+ * 获取图框的边界框
47
+ */
48
+ getFrameBounds(): {
49
+ minX: number;
50
+ minY: number;
51
+ maxX: number;
52
+ maxY: number;
53
+ };
54
+ /**
55
+ * 获取图框的四个角点
56
+ */
57
+ getFrameCorners(): {
58
+ leftTop: THREE.Vector2;
59
+ rightTop: THREE.Vector2;
60
+ rightBottom: THREE.Vector2;
61
+ leftBottom: THREE.Vector2;
62
+ };
63
+ /**
64
+ * 获取图框中心点
65
+ */
66
+ getFrameCenter(): THREE.Vector2;
67
+ /**
68
+ * 激活射线检测器(用于吸附)
69
+ */
70
+ activateRaycaster(): void;
71
+ /**
72
+ * 停用射线检测器
73
+ */
74
+ deactivateRaycaster(): void;
75
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./types";
2
+ export * from "./DividePlugin";
3
+ export * from "./DivGeometryUtils";
4
+ export * from "./CoverLayerManager";
5
+ export * from "./FrameAnnotation";
6
+ export * from "./FrameDrawable";
@@ -0,0 +1,38 @@
1
+ import * as THREE from "three";
2
+ /**
3
+ * 图框信息接口 - 对外暴露的图框数据结构
4
+ * 包含图框的基本信息和几何参数,不包含内部对象引用
5
+ */
6
+ export interface DivideFrameInfo {
7
+ /** 图框唯一标识符 */
8
+ id: string;
9
+ /** 图框显示名称 */
10
+ title: string;
11
+ /** 所属布局名称 */
12
+ layoutName: string;
13
+ /** 图框的四个角点坐标 */
14
+ corners: {
15
+ leftTop: THREE.Vector2;
16
+ rightTop: THREE.Vector2;
17
+ rightBottom: THREE.Vector2;
18
+ leftBottom: THREE.Vector2;
19
+ };
20
+ /** 图框中心点坐标 */
21
+ center: THREE.Vector2;
22
+ /** 图框种类 */
23
+ category?: string;
24
+ /** 图框可见性 */
25
+ visible: boolean;
26
+ }
27
+ /**
28
+ * 内部图框类型 - 插件内部使用的图框数据结构
29
+ * 在 DivideFrameInfo 基础上扩展了内部对象引用和覆盖层索引
30
+ */
31
+ export declare type InternalFrame = DivideFrameInfo & {
32
+ /** 图框轮廓线条对象 */
33
+ outlineObject: THREE.Line | undefined;
34
+ /** 图框内包含的所有对象集合 */
35
+ insideObjects?: Set<THREE.Object3D>;
36
+ /** 在覆盖层InstancedMesh中的实例索引 */
37
+ coverInstanceIndex?: number;
38
+ };
@@ -0,0 +1,93 @@
1
+ import * as THREE from "three";
2
+ import { CSS2DObject, CSS2DRenderer } from "three/examples/jsm/renderers/CSS2DRenderer.js";
3
+ import { BaseViewer, Hotpoint, Plugin, Vector2, Vector3 } from "../../core";
4
+ /**
5
+ * Hotpoint plugin manages hotpoints in a viewer.
6
+ * It can be used by DxfViewer and BimViewer.
7
+ * The hotpoint feature in VRViewer is more complex, that one has nothing to do with this plugin.
8
+ * VRViewer is able to use this plugin though.
9
+ * - A hotpoint is created and stored by user. User define its html and css.
10
+ * - A hotpoint can be added to, and removed from viewer.
11
+ * - Caller should set a hotpointId that is unique in the session of current viewer.
12
+ * - DxfViewer doesn't maintain the relationship between hotpoint and layout.
13
+ */
14
+ export declare class HotpointPlugin extends Plugin {
15
+ protected hotpointRoot?: THREE.Group;
16
+ protected css2dRenderer: CSS2DRenderer;
17
+ constructor(viewer: BaseViewer);
18
+ /**
19
+ * @description {en} Adds a hotpoint.
20
+ * Caller should set a hotpointId that is unique in the session of current viewer.
21
+ * @description {zh} 添加热点。
22
+ * 调用者应该设置一个在当前Viewer会话中唯一的热点id。
23
+ * @param hotpoint
24
+ * - {en} hotpoint data.
25
+ * - {zh} 热点数据。
26
+ * @example
27
+ * ``` typescript
28
+ * const hotpoint = {
29
+ * hotpointId: "c6ea70a3-ddb0-4dd0-87c8-bd2491936428",
30
+ * anchorPosition: [0, 0, 0],
31
+ * html: "<div>hotpoint</div>",
32
+ * visible: true,
33
+ * };
34
+ * const plugin = new HotpointPlugin(viewer);
35
+ * plugin.add(hotpoint);
36
+ * ```
37
+ */
38
+ add(hotpoint: Hotpoint): void;
39
+ /**
40
+ * @description {en} Removes a hotpoint by given hotpointId.
41
+ * @description {zh} 根据热点id删除热点。
42
+ * @param {string} hotpointId
43
+ * - {en} hotpoint id.
44
+ * - {zh} 热点id。
45
+ * @example
46
+ * ``` typescript
47
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
48
+ * const plugin = new HotpointPlugin(viewer);
49
+ * plugin.remove(hotpointId);
50
+ * ```
51
+ */
52
+ remove(hotpointId: string): void;
53
+ /**
54
+ * @description {en} Clears all hotpoints.
55
+ * @description {zh} 清除所有热点。
56
+ * @example
57
+ * ``` typescript
58
+ * const plugin = new HotpointPlugin(viewer);
59
+ * plugin.clear();
60
+ * ```
61
+ */
62
+ clear(): void;
63
+ /**
64
+ * Checks if hotpoint with specific id already exist
65
+ * Caller should set a hotpointId that is unique in the session of current DxfViewer.
66
+ * @internal
67
+ */
68
+ has(hotpointId: string): boolean;
69
+ /**
70
+ * @description {en} Moves a hotpoint.
71
+ * @description {zh} 移动热点的位置。
72
+ * @example
73
+ * ``` typescript
74
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
75
+ * const plugin = new HotpointPlugin(viewer);
76
+ * plugin.move(hotpointId, [10, 10, 0]);
77
+ * ```
78
+ */
79
+ move(hotpointId: string, position: Vector2 | Vector3): void;
80
+ /**
81
+ * @description {en} Hides or show a hotpoint.
82
+ * @description {zh} 显示或隐藏一个热点。
83
+ * @example
84
+ * ``` typescript
85
+ * const hotpointId = "c6ea70a3-ddb0-4dd0-87c8-bd2491936428";
86
+ * const plugin = new HotpointPlugin(viewer);
87
+ * plugin.setVisible(hotpointId, false);
88
+ * ```
89
+ */
90
+ setVisible(hotpointId: string, visible: boolean): void;
91
+ protected findHotpointObject(hotpointId: string): CSS2DObject | undefined;
92
+ protected onAfterRender: () => void;
93
+ }
@@ -0,0 +1 @@
1
+ export * from "./HotpointPlugin";
@@ -0,0 +1,12 @@
1
+ export * from "./annotation";
2
+ export * from "./axis-gizmo";
3
+ export * from "./bottom-bar";
4
+ export * from "./layer-manager";
5
+ export * from "./local-model-uploader";
6
+ export * from "./hotpoint";
7
+ export * from "./measure";
8
+ export * from "./screenshot";
9
+ export * from "./stats";
10
+ export * from "./toolbars";
11
+ export * from "./overview-map";
12
+ export * from "./divide";
@@ -0,0 +1,59 @@
1
+ import { DxfLayers, DxfViewer, PdfLayers, Plugin, PluginConfig } from "../../core";
2
+ /**
3
+ * Dxf layer manager config.
4
+ */
5
+ export interface LayerManagerPluginConfig extends Partial<PluginConfig> {
6
+ /**
7
+ * Container div id.
8
+ */
9
+ containerId: string;
10
+ /**
11
+ * If panel is visible. It is visible by default.
12
+ */
13
+ visible?: boolean;
14
+ }
15
+ /**
16
+ * Layer manager plugin events.
17
+ */
18
+ declare type LayerManagerPluginEvents = {
19
+ /**
20
+ * Panel visibility change handler.
21
+ */
22
+ Visibilitychange: boolean;
23
+ };
24
+ /**
25
+ * Dxf layer manager.
26
+ * Can be used by DxfViewer.
27
+ */
28
+ export declare class LayerManagerPlugin extends Plugin<LayerManagerPluginEvents> {
29
+ static DEFAULT_ID: string;
30
+ protected cfg: LayerManagerPluginConfig;
31
+ protected container?: HTMLDivElement;
32
+ protected layerMgrRoot?: HTMLDivElement;
33
+ protected layerList?: HTMLDivElement;
34
+ protected headerText?: HTMLSpanElement;
35
+ protected closeBtn?: HTMLSpanElement;
36
+ protected dxfLayersArray?: (DxfLayers | PdfLayers)[];
37
+ protected checkboxes?: HTMLInputElement[];
38
+ protected mouseDownPositionX: number;
39
+ protected mouseDownPositionY: number;
40
+ constructor(viewer: DxfViewer, cfg?: LayerManagerPluginConfig);
41
+ protected init(): void;
42
+ setVisible(visible: boolean): void;
43
+ protected show(): void;
44
+ protected hide(): void;
45
+ destroy(): void;
46
+ buildPage(): void;
47
+ addContent(): void;
48
+ generateListItem(layer: string, visible: boolean, color?: string): string;
49
+ closePanel(): void;
50
+ addEventHandlers(): void;
51
+ protected onPointerDown: (e: MouseEvent) => void;
52
+ protected onPointerMove: (e: MouseEvent) => void;
53
+ protected onPointerUp: () => void;
54
+ checkboxHandler(checkbox: HTMLInputElement): void;
55
+ updatePage(): void;
56
+ updateHeaderText(): void;
57
+ convertDecimalToHex(decimal: number): string | undefined;
58
+ }
59
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./LayerManagerPlugin";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare class IUploader {
5
+ protected input: HTMLInputElement;
6
+ constructor(elementId?: string);
7
+ protected formats(): string[];
8
+ protected uploadFiles(files: FileList): void;
9
+ openFileBrowserToUpload(): void;
10
+ }