@x-viewer/core 0.9.0

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 (238) hide show
  1. package/README.md +2 -0
  2. package/dist/index.esm.js +11790 -0
  3. package/dist/types/Locale.d.ts +23 -0
  4. package/dist/types/components/dxf-layout-bar/DxfLayoutBar.d.ts +26 -0
  5. package/dist/types/components/dxf-layout-bar/index.d.ts +1 -0
  6. package/dist/types/components/tool-tip/Tooltip.d.ts +20 -0
  7. package/dist/types/components/tool-tip/index.d.ts +1 -0
  8. package/dist/types/core/Configs.d.ts +288 -0
  9. package/dist/types/core/Constants.d.ts +81 -0
  10. package/dist/types/core/Units.d.ts +16 -0
  11. package/dist/types/core/VersionManager.d.ts +14 -0
  12. package/dist/types/core/camera/CameraManager.d.ts +80 -0
  13. package/dist/types/core/camera/index.d.ts +1 -0
  14. package/dist/types/core/camera-controls/CameraControls.d.ts +744 -0
  15. package/dist/types/core/camera-controls/Constants.d.ts +2 -0
  16. package/dist/types/core/camera-controls/EventDispatcher.d.ts +41 -0
  17. package/dist/types/core/camera-controls/index.d.ts +3 -0
  18. package/dist/types/core/camera-controls/types.d.ts +112 -0
  19. package/dist/types/core/camera-controls/utils/extractClientCoordFromEvent.d.ts +3 -0
  20. package/dist/types/core/camera-controls/utils/math-utils.d.ts +14 -0
  21. package/dist/types/core/camera-controls/utils/notSupportedInOrthographicCamera.d.ts +2 -0
  22. package/dist/types/core/canvas/CanvasRender.d.ts +52 -0
  23. package/dist/types/core/canvas/Constants.d.ts +31 -0
  24. package/dist/types/core/canvas/Drawable.d.ts +98 -0
  25. package/dist/types/core/canvas/DrawableList.d.ts +40 -0
  26. package/dist/types/core/canvas/MarkerDrawable.d.ts +30 -0
  27. package/dist/types/core/canvas/PathDrawable.d.ts +39 -0
  28. package/dist/types/core/canvas/index.d.ts +6 -0
  29. package/dist/types/core/compare/BaseDxfCompareHelper.d.ts +104 -0
  30. package/dist/types/core/compare/CompareDrawable.d.ts +18 -0
  31. package/dist/types/core/compare/DxfCompareHelper.d.ts +69 -0
  32. package/dist/types/core/compare/DxfCompareMarkupManager.d.ts +11 -0
  33. package/dist/types/core/compare/index.d.ts +4 -0
  34. package/dist/types/core/components/Container.d.ts +38 -0
  35. package/dist/types/core/components/ProgressBar.d.ts +31 -0
  36. package/dist/types/core/components/Spinner.d.ts +16 -0
  37. package/dist/types/core/components/index.d.ts +3 -0
  38. package/dist/types/core/controls/CameraControlsEx.d.ts +37 -0
  39. package/dist/types/core/controls/Control.d.ts +17 -0
  40. package/dist/types/core/controls/OrbitControls.d.ts +13 -0
  41. package/dist/types/core/controls/PlanControls.d.ts +13 -0
  42. package/dist/types/core/controls/index.d.ts +4 -0
  43. package/dist/types/core/dxf/DxfCompare.d.ts +151 -0
  44. package/dist/types/core/dxf/DxfConstants.d.ts +33 -0
  45. package/dist/types/core/dxf/DxfLoader.d.ts +557 -0
  46. package/dist/types/core/dxf/DxfObject.d.ts +33 -0
  47. package/dist/types/core/dxf/DxfUtils.d.ts +45 -0
  48. package/dist/types/core/dxf/HatchPatternShaders.d.ts +12 -0
  49. package/dist/types/core/dxf/LinePatternShaders.d.ts +12 -0
  50. package/dist/types/core/dxf/bspline.d.ts +7 -0
  51. package/dist/types/core/dxf/dxfom-mtext.d.ts +46 -0
  52. package/dist/types/core/dxf/dxfom-text.d.ts +16 -0
  53. package/dist/types/core/dxf/index.d.ts +10 -0
  54. package/dist/types/core/dxf/round10.d.ts +1 -0
  55. package/dist/types/core/dxf-parser/AutoCadColorIndex.d.ts +8 -0
  56. package/dist/types/core/dxf-parser/DxfBaseReader.d.ts +12 -0
  57. package/dist/types/core/dxf-parser/DxfBinaryReader.d.ts +14 -0
  58. package/dist/types/core/dxf-parser/DxfParser.d.ts +324 -0
  59. package/dist/types/core/dxf-parser/DxfTextReader.d.ts +31 -0
  60. package/dist/types/core/dxf-parser/ParseHelpers.d.ts +45 -0
  61. package/dist/types/core/dxf-parser/entities/3dface.d.ts +13 -0
  62. package/dist/types/core/dxf-parser/entities/arc.d.ts +18 -0
  63. package/dist/types/core/dxf-parser/entities/attdef.d.ts +33 -0
  64. package/dist/types/core/dxf-parser/entities/attrib.d.ts +33 -0
  65. package/dist/types/core/dxf-parser/entities/circle.d.ts +15 -0
  66. package/dist/types/core/dxf-parser/entities/dimension.d.ts +24 -0
  67. package/dist/types/core/dxf-parser/entities/ellipse.d.ts +17 -0
  68. package/dist/types/core/dxf-parser/entities/geomtry.d.ts +42 -0
  69. package/dist/types/core/dxf-parser/entities/hatch.d.ts +110 -0
  70. package/dist/types/core/dxf-parser/entities/image.d.ts +39 -0
  71. package/dist/types/core/dxf-parser/entities/insert.d.ts +22 -0
  72. package/dist/types/core/dxf-parser/entities/leader.d.ts +23 -0
  73. package/dist/types/core/dxf-parser/entities/line.d.ts +12 -0
  74. package/dist/types/core/dxf-parser/entities/lwpolyline.d.ts +23 -0
  75. package/dist/types/core/dxf-parser/entities/mleader.d.ts +103 -0
  76. package/dist/types/core/dxf-parser/entities/mtext.d.ts +20 -0
  77. package/dist/types/core/dxf-parser/entities/ole2frame.d.ts +22 -0
  78. package/dist/types/core/dxf-parser/entities/point.d.ts +13 -0
  79. package/dist/types/core/dxf-parser/entities/polyline.d.ts +22 -0
  80. package/dist/types/core/dxf-parser/entities/ray.d.ts +12 -0
  81. package/dist/types/core/dxf-parser/entities/region.d.ts +12 -0
  82. package/dist/types/core/dxf-parser/entities/seqend.d.ts +10 -0
  83. package/dist/types/core/dxf-parser/entities/solid.d.ts +12 -0
  84. package/dist/types/core/dxf-parser/entities/spline.d.ts +25 -0
  85. package/dist/types/core/dxf-parser/entities/table.d.ts +44 -0
  86. package/dist/types/core/dxf-parser/entities/text.d.ts +20 -0
  87. package/dist/types/core/dxf-parser/entities/vertex.d.ts +22 -0
  88. package/dist/types/core/dxf-parser/entities/viewport.d.ts +56 -0
  89. package/dist/types/core/dxf-parser/entities/xline.d.ts +12 -0
  90. package/dist/types/core/dxf-parser/index.d.ts +27 -0
  91. package/dist/types/core/dxf-parser/objects/common.d.ts +26 -0
  92. package/dist/types/core/dxf-parser/objects/dictionary.d.ts +23 -0
  93. package/dist/types/core/dxf-parser/objects/imagedef.d.ts +24 -0
  94. package/dist/types/core/dxf-parser/objects/layout.d.ts +29 -0
  95. package/dist/types/core/dxf-parser/objects/sortentstable.d.ts +12 -0
  96. package/dist/types/core/dxf-parser/objects/spatialfilter.d.ts +22 -0
  97. package/dist/types/core/dxf-parser/objects/xrecord.d.ts +11 -0
  98. package/dist/types/core/effect/EffectManager.d.ts +43 -0
  99. package/dist/types/core/effect/index.d.ts +1 -0
  100. package/dist/types/core/font/BaseFont.d.ts +41 -0
  101. package/dist/types/core/font/FontManager.d.ts +52 -0
  102. package/dist/types/core/font/MeshFont.d.ts +14 -0
  103. package/dist/types/core/font/ShxFont.d.ts +49 -0
  104. package/dist/types/core/font/index.d.ts +1 -0
  105. package/dist/types/core/font/shx/ExtraLettersTemplate.d.ts +4 -0
  106. package/dist/types/core/font/shx/Shx.constants.d.ts +20 -0
  107. package/dist/types/core/font/shx/ShxParser.d.ts +18 -0
  108. package/dist/types/core/font/shx/TextShape.d.ts +24 -0
  109. package/dist/types/core/font/shx/gbk/index.d.ts +4 -0
  110. package/dist/types/core/font/shx/index.d.ts +1 -0
  111. package/dist/types/core/font/shx/util/BitConverter.d.ts +18 -0
  112. package/dist/types/core/geometry-offset/Edge.d.ts +27 -0
  113. package/dist/types/core/geometry-offset/Offset.d.ts +46 -0
  114. package/dist/types/core/geometry-offset/index.d.ts +1 -0
  115. package/dist/types/core/helpers/BinaryReader.d.ts +23 -0
  116. package/dist/types/core/helpers/BoxSelectHelper.d.ts +44 -0
  117. package/dist/types/core/helpers/InstantiateHelper.d.ts +26 -0
  118. package/dist/types/core/helpers/LoadingHelper.d.ts +65 -0
  119. package/dist/types/core/helpers/MeshBvhHelper.d.ts +15 -0
  120. package/dist/types/core/helpers/MobileTouchHelperDrawable.d.ts +26 -0
  121. package/dist/types/core/helpers/OSnapHelper.d.ts +159 -0
  122. package/dist/types/core/helpers/ObjectPixelSizeHelper.d.ts +13 -0
  123. package/dist/types/core/helpers/PickMarkupHelper.d.ts +29 -0
  124. package/dist/types/core/helpers/RafHelper.d.ts +18 -0
  125. package/dist/types/core/helpers/ZoomToRectHelper.d.ts +20 -0
  126. package/dist/types/core/helpers/index.d.ts +11 -0
  127. package/dist/types/core/index.d.ts +24 -0
  128. package/dist/types/core/indexeddb/BaseTable.d.ts +36 -0
  129. package/dist/types/core/indexeddb/DxfDataTable.d.ts +22 -0
  130. package/dist/types/core/indexeddb/FontDataTable.d.ts +32 -0
  131. package/dist/types/core/indexeddb/IndexedDbManager.d.ts +49 -0
  132. package/dist/types/core/indexeddb/index.d.ts +4 -0
  133. package/dist/types/core/input-manager/InputManager.d.ts +147 -0
  134. package/dist/types/core/input-manager/index.d.ts +1 -0
  135. package/dist/types/core/interactions/Interaction.d.ts +10 -0
  136. package/dist/types/core/interactions/Viewer2dInteraction.d.ts +17 -0
  137. package/dist/types/core/interactions/Viewer3dInteraction.d.ts +26 -0
  138. package/dist/types/core/interactions/index.d.ts +1 -0
  139. package/dist/types/core/materials/BimTilesHighlightMaterial.d.ts +21 -0
  140. package/dist/types/core/materials/BimTilesMaterial.d.ts +26 -0
  141. package/dist/types/core/materials/BimTilesPickMaterial.d.ts +9 -0
  142. package/dist/types/core/materials/BimTilesTransparentMaterial.d.ts +20 -0
  143. package/dist/types/core/materials/StandardMaterialEx.d.ts +16 -0
  144. package/dist/types/core/materials/constants.d.ts +0 -0
  145. package/dist/types/core/materials/index.d.ts +5 -0
  146. package/dist/types/core/model/Constants.d.ts +58 -0
  147. package/dist/types/core/model/Model.d.ts +18 -0
  148. package/dist/types/core/model/Model2d.d.ts +142 -0
  149. package/dist/types/core/model/Model3d.d.ts +137 -0
  150. package/dist/types/core/model/bimtiles/BatchedMeshesParser.d.ts +26 -0
  151. package/dist/types/core/model/bimtiles/BimTilesConfigParser.d.ts +43 -0
  152. package/dist/types/core/model/bimtiles/BimTilesData.d.ts +280 -0
  153. package/dist/types/core/model/bimtiles/BimTilesMaterialManager.d.ts +139 -0
  154. package/dist/types/core/model/bimtiles/BimTilesModel.d.ts +67 -0
  155. package/dist/types/core/model/bimtiles/BimTilesPropertyParser.d.ts +42 -0
  156. package/dist/types/core/model/bimtiles/BimTilesRenderer.d.ts +49 -0
  157. package/dist/types/core/model/bimtiles/InstancedMeshesParser.d.ts +37 -0
  158. package/dist/types/core/model/bimtiles/TileParser.d.ts +11 -0
  159. package/dist/types/core/model/bimtiles/Utils.d.ts +29 -0
  160. package/dist/types/core/model/index.d.ts +6 -0
  161. package/dist/types/core/patches/Constants.d.ts +6 -0
  162. package/dist/types/core/patches/Line.d.ts +2 -0
  163. package/dist/types/core/patches/Mesh.d.ts +2 -0
  164. package/dist/types/core/patches/Points.d.ts +2 -0
  165. package/dist/types/core/patches/index.d.ts +4 -0
  166. package/dist/types/core/patches/shaders/ShaderChunk.d.ts +2 -0
  167. package/dist/types/core/patches/shaders/shaderChunk/common_ex.glsl.d.ts +2 -0
  168. package/dist/types/core/patches/shaders/shaderChunk/id_pars_vertex.glsl.d.ts +2 -0
  169. package/dist/types/core/patches/shaders/shaderChunk/id_vertex.glsl.d.ts +2 -0
  170. package/dist/types/core/patches/shaders/shaderChunk/outine_bc_vertex.glsl.d.ts +2 -0
  171. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_fragment.glsl.d.ts +2 -0
  172. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_fragment.glsl.d.ts +2 -0
  173. package/dist/types/core/patches/shaders/shaderChunk/outline_bc_pars_vertex.glsl.d.ts +2 -0
  174. package/dist/types/core/patches/shaders/shaderChunk/state_fragment.glsl.d.ts +2 -0
  175. package/dist/types/core/patches/shaders/shaderChunk/state_highlight_fragment.glsl.d.ts +2 -0
  176. package/dist/types/core/patches/shaders/shaderChunk/state_pars_fragment.glsl.d.ts +2 -0
  177. package/dist/types/core/patches/shaders/shaderChunk/state_transparent_fragment.glsl.d.ts +2 -0
  178. package/dist/types/core/patches/shaders/shaderLib/pick_ex.glsl.d.ts +2 -0
  179. package/dist/types/core/patches/shaders/shaderLib/standard_ex.glsl.d.ts +2 -0
  180. package/dist/types/core/pick/PickManager.d.ts +52 -0
  181. package/dist/types/core/pick/index.d.ts +1 -0
  182. package/dist/types/core/scene/SceneManager.d.ts +48 -0
  183. package/dist/types/core/scene/index.d.ts +1 -0
  184. package/dist/types/core/shp-js/BitView.d.ts +12 -0
  185. package/dist/types/core/shp-js/SHPLoader.d.ts +12 -0
  186. package/dist/types/core/shp-js/Shp.d.ts +10 -0
  187. package/dist/types/core/shp-js/ShpThree.d.ts +23 -0
  188. package/dist/types/core/shp-js/index.d.ts +4 -0
  189. package/dist/types/core/text-texture/TextTexture.d.ts +45 -0
  190. package/dist/types/core/text-texture/index.d.ts +1 -0
  191. package/dist/types/core/undo/Command.d.ts +6 -0
  192. package/dist/types/core/undo/UndoManager.d.ts +24 -0
  193. package/dist/types/core/undo/index.d.ts +2 -0
  194. package/dist/types/core/utils/CSS2DObjectUtils.d.ts +14 -0
  195. package/dist/types/core/utils/CancelablePromise.d.ts +6 -0
  196. package/dist/types/core/utils/ColorUtils.d.ts +25 -0
  197. package/dist/types/core/utils/CommonUtils.d.ts +141 -0
  198. package/dist/types/core/utils/CoordinateUtils.d.ts +81 -0
  199. package/dist/types/core/utils/DecimalPrecisionUtils.d.ts +10 -0
  200. package/dist/types/core/utils/DeviceUtils.d.ts +15 -0
  201. package/dist/types/core/utils/EdgeUtils.d.ts +14 -0
  202. package/dist/types/core/utils/Event.d.ts +33 -0
  203. package/dist/types/core/utils/ExportUtils.d.ts +61 -0
  204. package/dist/types/core/utils/FpsUtils.d.ts +13 -0
  205. package/dist/types/core/utils/GeometryUtils.d.ts +78 -0
  206. package/dist/types/core/utils/LodashUtils.d.ts +208 -0
  207. package/dist/types/core/utils/LogUtils.d.ts +29 -0
  208. package/dist/types/core/utils/MaterialUtils.d.ts +40 -0
  209. package/dist/types/core/utils/MathUtils.d.ts +41 -0
  210. package/dist/types/core/utils/MergeUtils.d.ts +126 -0
  211. package/dist/types/core/utils/ObjectUtils.d.ts +216 -0
  212. package/dist/types/core/utils/PolygonUtils.d.ts +9 -0
  213. package/dist/types/core/utils/SVGObjectUtils.d.ts +22 -0
  214. package/dist/types/core/utils/SceneUtils.d.ts +26 -0
  215. package/dist/types/core/utils/SectionUtils.d.ts +11 -0
  216. package/dist/types/core/utils/SimplifyUtils.d.ts +15 -0
  217. package/dist/types/core/utils/TextureUtils.d.ts +16 -0
  218. package/dist/types/core/utils/UVUtils.d.ts +21 -0
  219. package/dist/types/core/utils/UnitConversionUtils.d.ts +31 -0
  220. package/dist/types/core/utils/index.d.ts +26 -0
  221. package/dist/types/core/viewers/BaseViewer.d.ts +253 -0
  222. package/dist/types/core/viewers/BimTilesViewer.d.ts +130 -0
  223. package/dist/types/core/viewers/Constants.d.ts +9 -0
  224. package/dist/types/core/viewers/Plugin.d.ts +30 -0
  225. package/dist/types/core/viewers/Viewer2d.d.ts +413 -0
  226. package/dist/types/core/viewers/Viewer3d.d.ts +136 -0
  227. package/dist/types/core/viewers/Viewer3dLite.d.ts +144 -0
  228. package/dist/types/core/viewers/ViewerEvent.d.ts +108 -0
  229. package/dist/types/core/viewers/index.d.ts +8 -0
  230. package/dist/types/core/webcam/WebCam.d.ts +28 -0
  231. package/dist/types/core/webcam/index.d.ts +1 -0
  232. package/dist/types/core/workers/CreateMeshBvh.worker.d.ts +1 -0
  233. package/dist/types/core/workers/GenerateMeshBvhWorker.d.ts +17 -0
  234. package/dist/types/core/workers/index.d.ts +1 -0
  235. package/dist/types/export.doc.d.ts +9 -0
  236. package/dist/types/index.d.ts +23 -0
  237. package/dist/types/version.d.ts +2 -0
  238. package/package.json +88 -0
@@ -0,0 +1,2 @@
1
+ export declare const PI_2: number;
2
+ export declare const PI_HALF: number;
@@ -0,0 +1,41 @@
1
+ export type Listener = (event?: DispatcherEvent) => void;
2
+ export interface DispatcherEvent {
3
+ type: string;
4
+ [key: string]: any;
5
+ }
6
+ export declare class EventDispatcher {
7
+ private _listeners;
8
+ /**
9
+ * Adds the specified event listener.
10
+ * @param type event name
11
+ * @param listener handler function
12
+ * @category Methods
13
+ */
14
+ addEventListener(type: string, listener: Listener): void;
15
+ /**
16
+ * Presence of the specified event listener.
17
+ * @param type event name
18
+ * @param listener handler function
19
+ * @category Methods
20
+ */
21
+ hasEventListener(type: string, listener: Listener): boolean;
22
+ /**
23
+ * Removes the specified event listener
24
+ * @param type event name
25
+ * @param listener handler function
26
+ * @category Methods
27
+ */
28
+ removeEventListener(type: string, listener: Listener): void;
29
+ /**
30
+ * Removes all event listeners
31
+ * @param type event name
32
+ * @category Methods
33
+ */
34
+ removeAllEventListeners(type?: string): void;
35
+ /**
36
+ * Fire an event type.
37
+ * @param event DispatcherEvent
38
+ * @category Methods
39
+ */
40
+ dispatchEvent(event: DispatcherEvent): void;
41
+ }
@@ -0,0 +1,3 @@
1
+ import { CameraControls } from "./CameraControls";
2
+ export * from "./types";
3
+ export default CameraControls;
@@ -0,0 +1,112 @@
1
+ import type * as _THREE from "three";
2
+ export interface THREESubset {
3
+ Vector2: typeof _THREE.Vector2;
4
+ Vector3: typeof _THREE.Vector3;
5
+ Vector4: typeof _THREE.Vector4;
6
+ Quaternion: typeof _THREE.Quaternion;
7
+ Matrix4: typeof _THREE.Matrix4;
8
+ Spherical: typeof _THREE.Spherical;
9
+ Box3: typeof _THREE.Box3;
10
+ Sphere: typeof _THREE.Sphere;
11
+ Raycaster: typeof _THREE.Raycaster;
12
+ [key: string]: any;
13
+ }
14
+ export type Ref = {
15
+ value: number;
16
+ };
17
+ export declare const MOUSE_BUTTON: {
18
+ readonly LEFT: 1;
19
+ readonly RIGHT: 2;
20
+ readonly MIDDLE: 4;
21
+ };
22
+ export type MOUSE_BUTTON = (typeof MOUSE_BUTTON)[keyof typeof MOUSE_BUTTON];
23
+ export declare const ACTION: Readonly<{
24
+ readonly NONE: 0;
25
+ readonly ROTATE: 1;
26
+ readonly TRUCK: 2;
27
+ readonly OFFSET: 4;
28
+ readonly DOLLY: 8;
29
+ readonly ZOOM: 16;
30
+ readonly TOUCH_ROTATE: 32;
31
+ readonly TOUCH_TRUCK: 64;
32
+ readonly TOUCH_OFFSET: 128;
33
+ readonly TOUCH_DOLLY: 256;
34
+ readonly TOUCH_ZOOM: 512;
35
+ readonly TOUCH_DOLLY_TRUCK: 1024;
36
+ readonly TOUCH_DOLLY_OFFSET: 2048;
37
+ readonly TOUCH_DOLLY_ROTATE: 4096;
38
+ readonly TOUCH_ZOOM_TRUCK: 8192;
39
+ readonly TOUCH_ZOOM_OFFSET: 16384;
40
+ readonly TOUCH_ZOOM_ROTATE: 32768;
41
+ }>;
42
+ export type ACTION = number;
43
+ export interface PointerInput {
44
+ pointerId: number;
45
+ clientX: number;
46
+ clientY: number;
47
+ deltaX: number;
48
+ deltaY: number;
49
+ mouseButton: MOUSE_BUTTON | null;
50
+ }
51
+ /**
52
+ * @internal
53
+ */
54
+ export type mouseButtonAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
55
+ /**
56
+ * @internal
57
+ */
58
+ export type mouseWheelAction = typeof ACTION.ROTATE | typeof ACTION.TRUCK | typeof ACTION.OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
59
+ /**
60
+ * @internal
61
+ */
62
+ export type singleTouchAction = typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.DOLLY | typeof ACTION.ZOOM | typeof ACTION.NONE;
63
+ /**
64
+ * @internal
65
+ */
66
+ export type multiTouchAction = typeof ACTION.TOUCH_DOLLY_ROTATE | typeof ACTION.TOUCH_DOLLY_TRUCK | typeof ACTION.TOUCH_DOLLY_OFFSET | typeof ACTION.TOUCH_ZOOM_ROTATE | typeof ACTION.TOUCH_ZOOM_TRUCK | typeof ACTION.TOUCH_ZOOM_OFFSET | typeof ACTION.TOUCH_DOLLY | typeof ACTION.TOUCH_ZOOM | typeof ACTION.TOUCH_ROTATE | typeof ACTION.TOUCH_TRUCK | typeof ACTION.TOUCH_OFFSET | typeof ACTION.NONE;
67
+ export interface MouseButtons {
68
+ left: mouseButtonAction;
69
+ middle: mouseButtonAction;
70
+ right: mouseButtonAction;
71
+ wheel: mouseWheelAction;
72
+ }
73
+ export interface Touches {
74
+ one: singleTouchAction;
75
+ two: multiTouchAction;
76
+ three: multiTouchAction;
77
+ }
78
+ export interface FitToOptions {
79
+ cover: boolean;
80
+ paddingLeft: number;
81
+ paddingRight: number;
82
+ paddingBottom: number;
83
+ paddingTop: number;
84
+ }
85
+ export interface CameraControlsEventMap {
86
+ update: {
87
+ type: "update";
88
+ };
89
+ wake: {
90
+ type: "wake";
91
+ };
92
+ rest: {
93
+ type: "rest";
94
+ };
95
+ sleep: {
96
+ type: "sleep";
97
+ };
98
+ transitionstart: {
99
+ type: "transitionstart";
100
+ };
101
+ controlstart: {
102
+ type: "controlstart";
103
+ };
104
+ control: {
105
+ type: "control";
106
+ };
107
+ controlend: {
108
+ type: "controlend";
109
+ };
110
+ }
111
+ export declare function isPerspectiveCamera(camera: _THREE.Camera): camera is _THREE.PerspectiveCamera;
112
+ export declare function isOrthographicCamera(camera: _THREE.Camera): camera is _THREE.OrthographicCamera;
@@ -0,0 +1,3 @@
1
+ import type * as _THREE from "three";
2
+ import type { PointerInput } from "../types";
3
+ export declare function extractClientCoordFromEvent(pointers: PointerInput[], out: _THREE.Vector2): void;
@@ -0,0 +1,14 @@
1
+ import type * as _THREE from "three";
2
+ import type { Ref } from "../types";
3
+ /**
4
+ * Degree to radius
5
+ */
6
+ export declare const Deg2Rad: number;
7
+ export declare function clamp(value: number, min: number, max: number): number;
8
+ export declare function approxZero(number: number, error?: number): boolean;
9
+ export declare function approxEquals(a: number, b: number, error?: number): boolean;
10
+ export declare function roundToStep(value: number, step: number): number;
11
+ export declare function infinityToMaxNumber(value: number): number;
12
+ export declare function maxNumberToInfinity(value: number): number;
13
+ export declare function smoothDamp(current: number, target: number, currentVelocityRef: Ref, smoothTime: number, maxSpeed: number | undefined, deltaTime: number): number;
14
+ export declare function smoothDampVec3(current: _THREE.Vector3, target: _THREE.Vector3, currentVelocityRef: _THREE.Vector3, smoothTime: number, maxSpeed: number | undefined, deltaTime: number, out: _THREE.Vector3): _THREE.Vector3;
@@ -0,0 +1,2 @@
1
+ import * as _THREE from "three";
2
+ export declare function notSupportedInOrthographicCamera(camera: _THREE.OrthographicCamera | _THREE.PerspectiveCamera, message: string): camera is _THREE.OrthographicCamera;
@@ -0,0 +1,52 @@
1
+ import * as THREE from "three";
2
+ import { DrawableData } from "./Constants";
3
+ import { Drawable } from "./Drawable";
4
+ import type { DrawableList } from "./DrawableList";
5
+ import { Event } from "../../core/utils";
6
+ import type { BaseViewer } from "../../core/viewers";
7
+ /**
8
+ * @internal
9
+ */
10
+ export type constructorReturnType<T> = new (...arg: any) => T;
11
+ /**
12
+ * @internal
13
+ */
14
+ export declare class CanvasRender extends Event {
15
+ private viewer;
16
+ private drawableLists;
17
+ private canvas?;
18
+ context?: CanvasRenderingContext2D;
19
+ private frustum;
20
+ private projScreenMatrix;
21
+ static _registerDrawableClass(drawable: constructorReturnType<Drawable>): void;
22
+ static createDrawable(data: DrawableData): Drawable<Record<string, unknown>>;
23
+ constructor(viewer: BaseViewer);
24
+ get is3d(): boolean;
25
+ get container(): HTMLElement;
26
+ get camera(): THREE.Camera;
27
+ get raycaster(): THREE.Raycaster;
28
+ private init;
29
+ private initCanvas;
30
+ private toHighDpr;
31
+ clearCanvas(): void;
32
+ addDrawableList(drawableList: DrawableList): void;
33
+ render(): void;
34
+ setSize(width: number, height: number): void;
35
+ getSortedDrawables(onlyVisible?: boolean): Drawable<Record<string, unknown>>[];
36
+ getDrawablesByDrawableListAndPosition(drawList: DrawableList, p: THREE.Vector3): Drawable<Record<string, unknown>> | undefined;
37
+ getDrawablesByPosition(p: THREE.Vector3): Drawable[];
38
+ getDrawableById(id: string): Drawable<Record<string, unknown>> | undefined;
39
+ measureTextLength(text: string, font: string): number;
40
+ /**
41
+ *
42
+ * @param option
43
+ * @returns
44
+ * @deprecated
45
+ */
46
+ /**
47
+ *
48
+ */
49
+ getImage(filter: (drawable: Drawable) => boolean): Promise<HTMLImageElement>;
50
+ getCanvas(): HTMLCanvasElement | undefined;
51
+ destroy(): void;
52
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Drawable data, including measurement data, markup data, etc.
3
+ */
4
+ export interface DrawableData {
5
+ /**
6
+ * id is used by business logic to manage(find, update, delete, etc.) drawables
7
+ */
8
+ id: string;
9
+ /**
10
+ * Two dimension float array stores 2d or 3d points.
11
+ * e.g., You can use "[[1, 1], [2.5, 3]]" to represent a distance measurement result,
12
+ * "[1, 1]" is the first point, and "[2.5, 3]" is the second point.
13
+ */
14
+ points: number[][];
15
+ position?: number[];
16
+ rotation?: number[];
17
+ scale?: number[];
18
+ lineWidth?: number;
19
+ /**
20
+ * Line color is number array. e.g: [r, g, b, a]
21
+ */
22
+ lineColor?: number[];
23
+ /**
24
+ * Fill color is number array. e.g: [r, g, b, a]
25
+ */
26
+ fillColor?: number[];
27
+ /**
28
+ * Drawable dta type
29
+ */
30
+ type: string;
31
+ }
@@ -0,0 +1,98 @@
1
+ import * as THREE from "three";
2
+ import { DrawableData } from "./Constants";
3
+ import { Event } from "../../core/utils";
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare abstract class Drawable<DrawableEvents extends Record<string, unknown> = Record<string, unknown>> extends Event<DrawableEvents> {
8
+ protected readonly DEFAULT_LINE_WIDTH = 1;
9
+ protected readonly DEFAULT_STROKE_STYLE: number[];
10
+ protected readonly DEFAULT_FILL_STYLE: number[];
11
+ id: string;
12
+ protected lineWidth: number;
13
+ protected lineColor: number[];
14
+ protected fillColor: number[];
15
+ /**
16
+ * points is world position, not screen position
17
+ * @protected
18
+ */
19
+ protected points: THREE.Vector3[];
20
+ userData: Record<any, any>;
21
+ protected tolerance: number;
22
+ /**
23
+ * @description is drawable visible, used for hide/show
24
+ */
25
+ visible: boolean;
26
+ /**
27
+ * @description is selected drawable, used for highlight
28
+ */
29
+ selected: boolean;
30
+ /**
31
+ * render order, the bigger number is on the top
32
+ */
33
+ renderOrder: number;
34
+ needsFrustumCulled: boolean;
35
+ protected editPointSize: number;
36
+ protected editPointFillColor: string;
37
+ protected editPointStrokeColor: string;
38
+ protected matrix: THREE.Matrix4;
39
+ protected ctx?: CanvasRenderingContext2D;
40
+ constructor(id?: string);
41
+ setTolerance(t: number): void;
42
+ /**
43
+ * Render the drawable on the canvas.
44
+ * @param ctx The canvas rendering context.
45
+ * @param camera The camera used for rendering.
46
+ */
47
+ render(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
48
+ getData(): DrawableData;
49
+ setData(data: DrawableData): void;
50
+ getVertexes(): THREE.Vector3[];
51
+ setLineWidth(lineWidth?: number): void;
52
+ setLineColor(color?: number[]): void;
53
+ setFillColor(color?: number[]): void;
54
+ isSelected(): boolean;
55
+ getCenter(): THREE.Vector3;
56
+ transToScreenCoord(vector: THREE.Vector3, camera: THREE.Camera): THREE.Vector2;
57
+ /**
58
+ *
59
+ * @param ctx
60
+ * @param camera
61
+ * @describe just for debug bounds
62
+ */
63
+ protected drawBounds(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
64
+ /**
65
+ *
66
+ * @param ctx
67
+ * @param camera
68
+ * @describe just for debug
69
+ */
70
+ private drawCenter;
71
+ /**
72
+ *
73
+ * @param p is world position
74
+ * @param raycaster just for 3d intersect
75
+ * @returns boolean
76
+ * @describe is point interact drawable, use to select drawable, the same as threejs object raycast
77
+ */
78
+ abstract isPointInPath(p: THREE.Vector3, raycaster?: THREE.Raycaster): boolean;
79
+ getBounds(): THREE.Box3;
80
+ /**
81
+ *
82
+ * @param ctx
83
+ * @param camera
84
+ * @describe abstract draw method
85
+ */
86
+ abstract draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
87
+ /**
88
+ *
89
+ * @param ctx
90
+ * @param camera
91
+ * @describe abstract drawSelect method
92
+ */
93
+ abstract drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
94
+ /**
95
+ * @describe class type for serialize
96
+ */
97
+ abstract getClassType(): string;
98
+ }
@@ -0,0 +1,40 @@
1
+ import * as THREE from "three";
2
+ import { DrawableData } from "./Constants";
3
+ import { Drawable } from "./Drawable";
4
+ import { Event } from "../../core/utils";
5
+ /**
6
+ * Drawable list events.
7
+ */
8
+ type DrawableListEvents = {
9
+ /**
10
+ * Triggerd when a drawable is added.
11
+ */
12
+ add: DrawableData;
13
+ /**
14
+ * Triggerd when a drawable is updated.
15
+ */
16
+ update: DrawableData;
17
+ /**
18
+ * Triggerd when a drawable is removed.
19
+ */
20
+ remove: DrawableData;
21
+ };
22
+ /**
23
+ * A group of Drawlables for a certain category
24
+ * @internal
25
+ */
26
+ export declare class DrawableList extends Event<DrawableListEvents> {
27
+ private category;
28
+ private drawableMap;
29
+ constructor(category: string);
30
+ addDrawable(drawable: Drawable): void;
31
+ updateDrawable(drawable: Drawable, newData: DrawableData): void;
32
+ removeDrawable(drawable: Drawable): void;
33
+ getDrawableById(id: string): Drawable<Record<string, unknown>> | undefined;
34
+ clear(): void;
35
+ getDrawables(): Map<string, Drawable<Record<string, unknown>>>;
36
+ getDrawableDatas(): DrawableData[];
37
+ setDrawableDatas(drawableDatas: DrawableData[]): void;
38
+ getDrawableByPosition(p: THREE.Vector3, raycaster?: THREE.Raycaster): Drawable<Record<string, unknown>> | undefined;
39
+ }
40
+ export {};
@@ -0,0 +1,30 @@
1
+ import * as THREE from "three";
2
+ import { DrawableData } from "./Constants";
3
+ import { PathDrawable } from "./PathDrawable";
4
+ export interface MarkerDrawableConfig {
5
+ width?: number;
6
+ height?: number;
7
+ imageUrl?: string;
8
+ }
9
+ export interface MarkerDrawableData extends DrawableData {
10
+ rotation2D: number;
11
+ width: number;
12
+ height: number;
13
+ imageUrl: string;
14
+ }
15
+ export declare class MarkerDrawable extends PathDrawable {
16
+ rotation2D: number;
17
+ image: HTMLImageElement;
18
+ width: number;
19
+ height: number;
20
+ needsFrustumCulled: boolean;
21
+ constructor(id: string, cfg?: MarkerDrawableConfig);
22
+ setImage(imageUrl: string): void;
23
+ setRotation(rotation: number): void;
24
+ getVertexes(): THREE.Vector3[];
25
+ drawBounds(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
26
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
27
+ getData(): MarkerDrawableData;
28
+ setData(data: MarkerDrawableData): void;
29
+ getClassType(): string;
30
+ }
@@ -0,0 +1,39 @@
1
+ import * as THREE from "three";
2
+ import { DrawableData } from "./Constants";
3
+ import { Drawable } from "./Drawable";
4
+ export declare class PathDrawable extends Drawable {
5
+ position: THREE.Vector3;
6
+ rotation: THREE.Euler;
7
+ scale: THREE.Vector3;
8
+ matrix: THREE.Matrix4;
9
+ matrixNeedsUpdate: boolean;
10
+ constructor(id: string, points?: THREE.Vector3[]);
11
+ setPoints(points: THREE.Vector3[]): void;
12
+ setPosition(x: number, y: number, z: number): void;
13
+ getPosition(): THREE.Vector3;
14
+ setRotation(x: number, y: number, z: number): void;
15
+ getRotation(): THREE.Euler;
16
+ setScale(scaleX: number, scaleY: number, scaleZ: number): void;
17
+ getScale(): THREE.Vector3;
18
+ /**
19
+ *
20
+ * @param p The point to check if it is inside the path.
21
+ * @description Check if a point is inside the path defined by the points of this drawable.can override this method to implement custom logic.
22
+ * @returns {boolean} True if the point is inside the path, false otherwise.
23
+ */
24
+ isPointInPath(p: THREE.Vector3): boolean;
25
+ getPointsBarycenter(): THREE.Vector3;
26
+ calculateMatrix(): void;
27
+ getCenter(): THREE.Vector3;
28
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
29
+ /**
30
+ * Draw the selection outline for this drawable.
31
+ * @param ctx The canvas rendering context.
32
+ * @param camera The camera used for rendering.
33
+ */
34
+ drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
35
+ getVertexes(): THREE.Vector3[];
36
+ getData(): DrawableData;
37
+ setData(data: DrawableData): void;
38
+ getClassType(): string;
39
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./CanvasRender";
2
+ export * from "./DrawableList";
3
+ export * from "./Drawable";
4
+ export * from "./PathDrawable";
5
+ export * from "./MarkerDrawable";
6
+ export * from "./Constants";
@@ -0,0 +1,104 @@
1
+ import * as THREE from "three";
2
+ import { ProgressBar } from "../components";
3
+ import { DxfCompareConfig, Model2dConfig, Viewer2dConfig } from "../../core/Configs";
4
+ import { DxfChange, DxfLoader } from "../../core/dxf";
5
+ import { FontManager } from "../../core/font";
6
+ import { Viewer2d } from "../../core/viewers/Viewer2d";
7
+ /**
8
+ * Dxf compare helper with one viewport.
9
+ * @example
10
+ * ``` html
11
+ * <div id="app">
12
+ * <div id="myCanvas" style="width: 100%; height: 100%; display: inline-block;"></div>
13
+ * </div>
14
+ * ```
15
+ * ``` typescript
16
+ * const viewerCfg = { containerId: "myCanvas" };
17
+ * const modelCfg1 = { modelId: "id_1", src: "http://www.abc.com/sample1.dxf" };
18
+ * const modelCfg2 = { modelId: "id_2", src: "http://www.abc.com/sample2.dxf" };
19
+ * const fontFiles = ["http://www.abc.com/hztxt.shx", "http://www.abc.com/simplex.shx"];
20
+ *
21
+ * const compareHelper = new BaseDxfCompareHelper(viewerCfg);
22
+ * await compareHelper.setFont(fontFiles);
23
+ * await compareHelper.compare(modelCfg1, modelCfg2);
24
+ * ```
25
+ */
26
+ export declare class BaseDxfCompareHelper {
27
+ /**
28
+ * Viewer2d of DxfCompareHelper.
29
+ */
30
+ viewer: Viewer2d;
31
+ protected fontManager?: FontManager;
32
+ protected loader: DxfLoader;
33
+ protected loadingManager?: THREE.LoadingManager;
34
+ protected changes?: Record<string, DxfChange>;
35
+ protected container: HTMLElement;
36
+ protected spinner?: HTMLDivElement;
37
+ protected jobCount: number;
38
+ protected loadingProgressBar?: ProgressBar;
39
+ constructor(viewerCfg: Viewer2dConfig);
40
+ protected initSpinner(): void;
41
+ /**
42
+ * @description {en} Sets font.
43
+ * This needs to be called before loading a dxf, it won't affect any loaded text.
44
+ * It accepts shx or typeface formats. For typeface, it only support passing in 1 font file in the array for now.
45
+ * @description {zh} 设置字体。
46
+ * 需要在加载dxf之前调用,不会影响已加载的文字。
47
+ * 支持shx或typeface格式。对于typeface,目前只支持传入1个字体文件。
48
+ * @param urls
49
+ * - {en} font file urls.
50
+ * - {zh} 字体文件链接。
51
+ * @example
52
+ * ```typescript
53
+ * compareHelper.setFont(["https://example.com/xxx.shx"]);
54
+ * ```
55
+ */
56
+ setFont(urls: string[]): Promise<void>;
57
+ /**
58
+ * Compares two dxf files. Note that:
59
+ * - It only compares model spaces.
60
+ * - It shouldn't load anything else before and after compare.
61
+ * @param modelCfg1 The first dxf to be compared
62
+ * @param modelCfg2 The second dxf to be compared
63
+ * @param onProgress loading progress
64
+ */
65
+ compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
66
+ /**
67
+ * @description {en} Gets compare changes.
68
+ * @description {zh} 获取对比变动.
69
+ * @returns
70
+ * - {en} Compare changes.
71
+ * - {zh} 对比变动列表。
72
+ * @example
73
+ * ``` typescript
74
+ * const changes = compareHelper.getChanges();
75
+ * console.log(changes);
76
+ * ```
77
+ */
78
+ getChanges(): Record<number, DxfChange> | undefined;
79
+ /**
80
+ * @description {en} Zooms to a compare change.
81
+ * @description {zh} 聚焦到图纸的一处变动。
82
+ * @param changeId
83
+ * - {en} Change id, which is an incremental integer starts from 1.
84
+ * - {zh} 变动id,该id是从数字1开始自增的整数。
85
+ * @example
86
+ * ``` typescript
87
+ * const changeId = 1;
88
+ * compareHelper.zoomToChange(changeId);
89
+ * ```
90
+ */
91
+ zoomToChange(changeId: number): void;
92
+ /**
93
+ * Sets spinner visibility
94
+ */
95
+ protected setSpinnerVisibility(visible: boolean): void;
96
+ /**
97
+ * Increases job count, and show spinner accordingly
98
+ */
99
+ protected increaseJobCount(): void;
100
+ /**
101
+ * Decreases job count, and hide spinner accordingly
102
+ */
103
+ protected decreaseJobCount(): void;
104
+ }
@@ -0,0 +1,18 @@
1
+ import * as THREE from "three";
2
+ import { Drawable } from "../../core/canvas";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare class CompareDrawable extends Drawable {
7
+ boxes: THREE.Box3[];
8
+ lineSegments: THREE.Vector3[][];
9
+ constructor(id: string, boxes: THREE.Box3[]);
10
+ private calculateCloudLineSegments;
11
+ draw(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
12
+ private drawBox;
13
+ static getControlPointByTwoPoints(p1: THREE.Vector2, p2: THREE.Vector2): THREE.Vector2;
14
+ drawSelect(ctx: CanvasRenderingContext2D, camera: THREE.Camera): void;
15
+ isPointInPath(p: THREE.Vector3): boolean;
16
+ getBounds(): THREE.Box3;
17
+ getClassType(): string;
18
+ }
@@ -0,0 +1,69 @@
1
+ import { BaseDxfCompareHelper } from "./BaseDxfCompareHelper";
2
+ import { DxfCompareConfig, Model2dConfig, Viewer2dConfig } from "../../core/Configs";
3
+ import { Viewer2d } from "../../core/viewers/Viewer2d";
4
+ /**
5
+ * Dxf compare helper with two viewports.
6
+ * @example
7
+ * ``` html
8
+ * <div id="app">
9
+ * <div id="myCanvas1" style="width: 50%; height: 100%; display: inline-block;"></div>
10
+ * <div id="myCanvas2" style="width: 50%; height: 100%; display: inline-block; padding-left: 1px;"></div>
11
+ * </div>
12
+ * ```
13
+ * ``` typescript
14
+ * const viewerCfg1 = { containerId: "myCanvas1" };
15
+ * const viewerCfg2 = { containerId: "myCanvas2" };
16
+ * const modelCfg1 = { modelId: "id_1", src: "http://www.abc.com/sample1.dxf" };
17
+ * const modelCfg2 = { modelId: "id_2", src: "http://www.abc.com/sample2.dxf" };
18
+ * const fontFiles = ["http://www.abc.com/hztxt.shx", "http://www.abc.com/simplex.shx"];
19
+ *
20
+ * const compareHelper = new DxfCompareHelper(viewerCfg1, viewerCfg2);
21
+ * await compareHelper.setFont(fontFiles);
22
+ * await compareHelper.compare(modelCfg1, modelCfg2);
23
+ * compareHelper.enableSyncCamera(true);
24
+ * ```
25
+ */
26
+ export declare class DxfCompareHelper extends BaseDxfCompareHelper {
27
+ /**
28
+ * The second Viewer2d of DxfCompareHelper.
29
+ */
30
+ viewer2: Viewer2d;
31
+ /**
32
+ * Enables to synchronize camera position when another camera is moved.
33
+ */
34
+ protected syncCamera: boolean;
35
+ constructor(viewerCfg1: Viewer2dConfig, viewerCfg2: Viewer2dConfig);
36
+ protected initSyncCameraEvent(): void;
37
+ /**
38
+ * @description {en} Enables to synchronize camera position when another camera is moved.
39
+ * @description {zh} 设置开启或关闭同步相机视角。
40
+ * @example
41
+ * ```typescript
42
+ * compareHelper.enableSyncCamera(true);
43
+ * ```
44
+ */
45
+ enableSyncCamera(enable: boolean): void;
46
+ private syncCameraControls;
47
+ /**
48
+ * Compares two dxf files. Note that:
49
+ * - It only compares model spaces.
50
+ * - It shouldn't load anything else before and after compare.
51
+ * @param modelCfg1 The first dxf to be compared
52
+ * @param modelCfg2 The second dxf to be compared
53
+ * @param onProgress loading progress
54
+ */
55
+ compare(modelCfg1: Model2dConfig, modelCfg2: Model2dConfig, compareCfg?: DxfCompareConfig, onProgress?: (event: ProgressEvent) => void): Promise<void>;
56
+ /**
57
+ * @description {en} Zooms to a compare change.
58
+ * @description {zh} 聚焦到图纸的一处变动。
59
+ * @param changeId
60
+ * - {en} Change id, which is an incremental integer starts from 1.
61
+ * - {zh} 变动id,该id是从数字1开始自增的整数。
62
+ * @example
63
+ * ``` typescript
64
+ * const changeId = 1;
65
+ * compareHelper.zoomToChange(changeId);
66
+ * ```
67
+ */
68
+ zoomToChange(changeId: number): void;
69
+ }