@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,23 @@
1
+ export declare const en: {
2
+ ProgressBar: {
3
+ Loading: string;
4
+ LoadingFailed: string;
5
+ Comparing: string;
6
+ };
7
+ Tooltip: {
8
+ boxSelect: string;
9
+ pickMarkup: string;
10
+ };
11
+ };
12
+ export declare const cn: {
13
+ ProgressBar: {
14
+ Loading: string;
15
+ LoadingFailed: string;
16
+ Comparing: string;
17
+ };
18
+ Tooltip: {
19
+ boxSelect: string;
20
+ pickMarkup: string;
21
+ };
22
+ };
23
+ export declare const i18n: import("i18next").i18n;
@@ -0,0 +1,26 @@
1
+ import type { Viewer2d } from "../../core/viewers";
2
+ export declare class DxfLayoutBar {
3
+ protected readonly viewer: Viewer2d;
4
+ private element?;
5
+ private content?;
6
+ private itemList;
7
+ constructor(viewer: Viewer2d);
8
+ init(): void;
9
+ private handleMouseWheel;
10
+ private createItem;
11
+ destroy(): void;
12
+ show(): void;
13
+ hide(): void;
14
+ }
15
+ export declare class ModelLayoutSwitchItem {
16
+ protected readonly viewer: Viewer2d;
17
+ private eventBus;
18
+ element: HTMLElement;
19
+ resetActivate?: () => void;
20
+ active: boolean;
21
+ constructor(viewer: Viewer2d, name: string);
22
+ private createItem;
23
+ setActive(active: boolean): void;
24
+ resetActive(): void;
25
+ destroy(): void;
26
+ }
@@ -0,0 +1 @@
1
+ export * from "./DxfLayoutBar";
@@ -0,0 +1,20 @@
1
+ interface TooltipConfig {
2
+ showOnCreate?: boolean;
3
+ followPointer?: boolean;
4
+ parentNode?: HTMLElement;
5
+ target?: HTMLElement;
6
+ }
7
+ export declare class Tooltip {
8
+ private node;
9
+ private parentNode;
10
+ private target;
11
+ private childNode;
12
+ constructor(id: string, content?: string | HTMLElement | null, cfg?: TooltipConfig);
13
+ setContent(content: string | HTMLElement): void;
14
+ updateChildContent(content: string | HTMLElement): void;
15
+ follow: (event: MouseEvent) => void;
16
+ show: () => false | void;
17
+ hide: () => false | void;
18
+ destroy: () => void;
19
+ }
20
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Tooltip";
@@ -0,0 +1,288 @@
1
+ import * as THREE from "three";
2
+ /**
3
+ * Camera projection type.
4
+ */
5
+ export declare enum CameraProjection {
6
+ Perspective = "Perspective",
7
+ Orthographic = "Orthographic"
8
+ }
9
+ /**
10
+ * Camera info
11
+ */
12
+ export interface CameraInfo {
13
+ /**
14
+ * Camera projection type
15
+ */
16
+ projection: CameraProjection;
17
+ /**
18
+ * The camera position
19
+ */
20
+ position: THREE.Vector3;
21
+ /**
22
+ * The target that the camera looks to
23
+ */
24
+ target: THREE.Vector3;
25
+ /**
26
+ * @internal
27
+ */
28
+ up?: THREE.Vector3;
29
+ /**
30
+ * The camera zoom
31
+ */
32
+ zoom?: number;
33
+ /**
34
+ * The camera's near clip plane
35
+ */
36
+ near?: number;
37
+ /**
38
+ * The camera's far clip plane
39
+ */
40
+ far?: number;
41
+ /**
42
+ * Used by perspective camera
43
+ */
44
+ fov?: number;
45
+ /**
46
+ * Used by perspective camera
47
+ */
48
+ aspect?: number;
49
+ /**
50
+ * Used by orthographic camera
51
+ */
52
+ left?: number;
53
+ /**
54
+ * Used by orthographic camera
55
+ */
56
+ right?: number;
57
+ /**
58
+ * Used by orthographic camera
59
+ */
60
+ bottom?: number;
61
+ /**
62
+ * Used by orthographic camera
63
+ */
64
+ top?: number;
65
+ }
66
+ /**
67
+ * Model config
68
+ */
69
+ export interface ModelConfig {
70
+ /**
71
+ * Unique id of the model
72
+ */
73
+ modelId?: string;
74
+ /**
75
+ * Model name
76
+ */
77
+ name?: string;
78
+ /**
79
+ * Source url of the model
80
+ */
81
+ src: string;
82
+ /**
83
+ * Used to distinguish format, because it may be hard to know the format by src!
84
+ * @internal
85
+ */
86
+ fileFormat?: string;
87
+ /**
88
+ * File encoding, can be used by dxf. Common encoding include "UTF-8", "gb2312", etc.
89
+ * @internal
90
+ */
91
+ encoding?: string;
92
+ /**
93
+ * A float array of length 16, definds model's position, rotation and scale
94
+ */
95
+ matrix?: number[];
96
+ /**
97
+ * If we want to merge meshes/lines/points with the same material
98
+ * @internal
99
+ * @default false
100
+ */
101
+ merge?: boolean;
102
+ /**
103
+ * If we want to generate and show edges/outlines to the modle.
104
+ * It is useful for Viewer3d.
105
+ * @internal
106
+ */
107
+ edges?: boolean;
108
+ /**
109
+ * If this model is visible by default.
110
+ * @internal
111
+ */
112
+ visible?: boolean;
113
+ /**
114
+ * This is only useful for obj model, mtl is material file.
115
+ * @internal
116
+ */
117
+ mtlUrls?: string[];
118
+ }
119
+ /**
120
+ * 2d model config
121
+ */
122
+ export interface Model2dConfig extends ModelConfig {
123
+ /**
124
+ * If to ignore anything of paper space.
125
+ * There are some scenarios to ignore paper space by default, includes:
126
+ * - Dxf overlay, aka, loading more than one dxf files into a viewer. We'll only load model space for the first file.
127
+ * - Dxf compare. Since we'll only compare model space, it won't load paper space at all.
128
+ *
129
+ * This option is useful when user want to explicitly ignore paper space.
130
+ * @default false
131
+ */
132
+ ignorePaperSpace?: boolean;
133
+ /**
134
+ * Applies this color to everything in this model.
135
+ * This allows user to show a drawing with a pure color (black, white, etc.).
136
+ * Color value is between 0 and 1, e.g., [1, 0, 0] means 'red'.
137
+ */
138
+ overrideColor?: number[];
139
+ }
140
+ /**
141
+ * Common viewer config
142
+ */
143
+ export interface BaseViewerConfig {
144
+ /**
145
+ * @description canvas id to contain the viewer.
146
+ */
147
+ containerId: string;
148
+ /**
149
+ * Language of the viewer.
150
+ * @description Default is `en`.
151
+ */
152
+ language?: "cn" | "en";
153
+ /**
154
+ * @internal
155
+ */
156
+ logLevel?: "debug" | "info" | "warn" | "error" | "silent";
157
+ /**
158
+ * @internal
159
+ */
160
+ enableSpinner?: boolean;
161
+ /**
162
+ * @internal
163
+ */
164
+ enableProgressBar?: boolean;
165
+ /**
166
+ * @description just for react native
167
+ * @internal
168
+ */
169
+ context?: WebGLRenderingContext | WebGL2RenderingContext;
170
+ /**
171
+ * @description just for react native
172
+ * @internal
173
+ */
174
+ context2d?: CanvasRenderingContext2D;
175
+ }
176
+ /**
177
+ * This wrappers most config for Viewer3d
178
+ */
179
+ export interface Viewer3dConfig extends BaseViewerConfig {
180
+ /**
181
+ * Default is `meters`
182
+ * @internal
183
+ */
184
+ units?: string;
185
+ }
186
+ /**
187
+ * This wrappers most config for Viewer2d
188
+ */
189
+ export interface Viewer2dConfig extends BaseViewerConfig {
190
+ /**
191
+ * Enables layout bar so we can switch to other layouts.
192
+ * The default layout bar is an example UI of the viewer, since plenty of APIs are exposed,
193
+ * you are recommended to create your own layout bar with customized style, location, etc.
194
+ */
195
+ enableLayoutBar?: boolean;
196
+ /**
197
+ * If to cache model into indexeddb (or maybe local storage in future).
198
+ * If enabled, it will get model data from cache the next time model is loaded.
199
+ * @internal
200
+ * @default true
201
+ */
202
+ enableLocalCache?: boolean;
203
+ }
204
+ /**
205
+ * Dxf compare config.
206
+ */
207
+ export interface DxfCompareConfig {
208
+ /**
209
+ * Enables to compare properties (color, linetype, line width, etc.)
210
+ */
211
+ enableDetailComparision: boolean;
212
+ }
213
+ /**
214
+ * A default Viewer3dConfig as a template, which enables most plugins.
215
+ * @internal
216
+ */
217
+ export declare const DefaultViewer3dConfig: Viewer3dConfig;
218
+ /**
219
+ * @internal
220
+ */
221
+ export interface IsolateObjectsParam {
222
+ id: string;
223
+ modelId: string;
224
+ }
225
+ /**
226
+ * @internal
227
+ */
228
+ export interface IsolateObjectsParams {
229
+ familyInstanceIds: IsolateObjectsParam[];
230
+ }
231
+ /**
232
+ * @internal
233
+ */
234
+ export interface ScreenshotConfig {
235
+ type: string;
236
+ quality: number;
237
+ includeOverlay: boolean;
238
+ }
239
+ /**
240
+ * Viewpoint definition.
241
+ */
242
+ export interface Viewpoint {
243
+ /**
244
+ * The camera location
245
+ */
246
+ eye: THREE.Vector3;
247
+ /**
248
+ * The location that the camera looks to
249
+ */
250
+ look: THREE.Vector3;
251
+ /**
252
+ * @internal
253
+ */
254
+ up?: THREE.Vector3;
255
+ /**
256
+ * The camera zoom, used by Orthographic camera.
257
+ */
258
+ zoom?: number;
259
+ }
260
+ /**
261
+ * View direction.
262
+ */
263
+ export declare enum ViewDirection {
264
+ Top = "Top",
265
+ Bottom = "Bottom",
266
+ Front = "Front",
267
+ Back = "Back",
268
+ Left = "Left",
269
+ Right = "Right"
270
+ }
271
+ /**
272
+ * Icon class.
273
+ * Used by toolbar and bottom bar icons, etc.
274
+ */
275
+ export interface IconClass {
276
+ /**
277
+ * The default icon.
278
+ */
279
+ default: string;
280
+ /**
281
+ * The icon when item is actived.
282
+ */
283
+ active?: string;
284
+ /**
285
+ * The icon font class name.
286
+ */
287
+ iconFont?: string;
288
+ }
@@ -0,0 +1,81 @@
1
+ export declare const DefaultLanguage = "en";
2
+ /**
3
+ * To improve performance, we can set object.matrixAutoUpdate = false for static or rarely moving objects and
4
+ * manually call object.updateMatrix() whenever their position/rotation/quaternion/scale are updated.
5
+ * Add a constrant here, so developer can change it here easily for debugging.
6
+ * @internal
7
+ */
8
+ export declare const MatrixAutoUpdate = false;
9
+ /**
10
+ * These concept can be complex: hitable, snapable, selectable, visible
11
+ * Mesh Y Y Y Y
12
+ * text in Viewer2d Y N Y Y
13
+ * ground plan Y Y N Y
14
+ * outline N Y N Y
15
+ * OSnap auxiliary object N Y N N
16
+ *
17
+ * So, we must handle them properly. We'll try to put them into different layers.
18
+ *
19
+ * For each created object with geometry and material, the default layer is set to enableAll.
20
+ * If the object is only displayed, it is not necessary to call enableAll. For example, some auxiliary display objects.
21
+ * For objects that cannot be hitable, snapable, selectable, etc., call ObjectUtils.disableLayerChannels to exclude the corresponding channel.
22
+ * @example
23
+ * ``` typescript
24
+ * this.groundPlane.layers.enableAll();
25
+ * ObjectUtils.disableLayerChannels(this.groundPlane, [LayerForSelectableObjects]);
26
+ * ```
27
+ */
28
+ /**
29
+ * @internal
30
+ */
31
+ export declare const LayerForHitableObjects = 10;
32
+ /**
33
+ * @internal
34
+ */
35
+ export declare const LayerForSnapableObjects = 11;
36
+ /**
37
+ * @internal
38
+ */
39
+ export declare const LayerForSelectableObjects = 12;
40
+ /**
41
+ * Object highlight color.
42
+ */
43
+ export declare const HighlightColor = 583902;
44
+ /**
45
+ * Object highlight color in rgba format.
46
+ */
47
+ export declare const HighlightColorRgba: number[];
48
+ /**
49
+ * Object outline color.
50
+ */
51
+ export declare const OutlineColorRgba: number[];
52
+ /**
53
+ * Default object opacity value.
54
+ */
55
+ export declare const DefaultOpacity = 0.5;
56
+ /**
57
+ * Default camera settings.
58
+ */
59
+ export declare const DefaultCameraNear = 1;
60
+ export declare const DefaultCameraFar = 5000;
61
+ export declare const DefaultCameraFov = 45;
62
+ /**
63
+ * Iconfont class name for toolbar, bottombar, section, etc..
64
+ * This sdk should not provide any UI (toolbar, layoutbar, etc.), thus, it doesn't
65
+ * need to provide any icon either.
66
+ * For internal usage, we implemented some icons using iconfont. They are:
67
+ * - public/iconfont/iconfont.css
68
+ * - public/iconfont/iconfont2.css
69
+ * They sould be loaded by user's app, rather than in this sdk.
70
+ * @internal
71
+ */
72
+ export declare const IconfontClass = "x-viewer-iconfont";
73
+ /**
74
+ * @internal
75
+ */
76
+ export declare const IconfontClass2 = "x-viewer-iconfont2";
77
+ /**
78
+ * @internal
79
+ * Angle threshold at which two plane normals are parallel. Used to calculate edges.
80
+ */
81
+ export declare const ThresholdAngleForEdge = 10;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Units are defined the same order as to Dxf format
3
+ */
4
+ export declare enum Units {
5
+ Unitless = "Unitless",
6
+ Inches = "Inches",
7
+ Feet = "Feet",
8
+ Millimeters = "Millimeters",
9
+ Centimeters = "Centimeters",
10
+ Meters = "Meters"
11
+ }
12
+ /**
13
+ * Gets the unit scale when converting to meter.
14
+ */
15
+ export declare const UnitScaleToMeter: (src: Units) => number;
16
+ export declare const UnitScaleConversion: (src: Units, dest: Units) => number;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Gets the sdk version ran on this device from local storage.
3
+ */
4
+ export declare const getVersionFromLocalStorage: () => string | null;
5
+ /**
6
+ * Sets the sdk version to local storage.
7
+ */
8
+ export declare const setVersionToLocalStorage: () => void;
9
+ /**
10
+ * Checks if current sdk version and last version are different.
11
+ * There can be storage data formant change if sdk version is updated,
12
+ * we may simply clean up local storage in this case.
13
+ */
14
+ export declare const checkIsNewVersion: () => boolean;
@@ -0,0 +1,80 @@
1
+ import * as THREE from "three";
2
+ import { CameraInfo, CameraProjection, Viewpoint } from "../../core/Configs";
3
+ import CameraControls from "../../core/camera-controls";
4
+ import { FitToOptions } from "../../core/camera-controls/types";
5
+ import { ControlsMode } from "../../core/controls/Control";
6
+ import { type BaseViewer } from "../../core/viewers/BaseViewer";
7
+ export declare class CameraManager {
8
+ private viewer;
9
+ readonly perspectiveCamera: THREE.PerspectiveCamera;
10
+ readonly orthographicCamera: THREE.OrthographicCamera;
11
+ activeCamera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
12
+ readonly cameraControls: CameraControls;
13
+ private previousDistance;
14
+ private previousAzimuthRotateSpeed;
15
+ private previousPolarRotateSpeed;
16
+ private previousDollySpeed;
17
+ private previousTruckSpeed;
18
+ private previousMouseLeft;
19
+ protected enableKeyDown: boolean;
20
+ /**
21
+ * A map/list of different controls
22
+ */
23
+ private controlsMap;
24
+ private activeControls;
25
+ private projection;
26
+ /**
27
+ * For OrbitControls, a user would like to rotate around where mouse is clicked,
28
+ * rather than the screen center.
29
+ * We'll display an anchor at where mouse is clicked.
30
+ */
31
+ protected anchor: HTMLElement;
32
+ constructor(viewer: BaseViewer);
33
+ get viewerContainer(): HTMLElement;
34
+ get inputManager(): import("../../core/input-manager/InputManager").InputManager;
35
+ private createAnchor;
36
+ protected setAnchorPosition(x: number, y: number): void;
37
+ setOrbitPointVisible(visible: boolean): void;
38
+ isOrbitPointVisible(): boolean;
39
+ private setOrthoCameraAspect;
40
+ private setupCameras;
41
+ private setCameraPositionAndTarget;
42
+ private setupControls;
43
+ private onKeyDown;
44
+ private onChange;
45
+ setOrthoCamera(): void;
46
+ private getDims;
47
+ private setupOrthoCamera;
48
+ private setPerspectiveCamera;
49
+ update(delta: number): boolean;
50
+ updateAspect(): void;
51
+ get camera(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
52
+ enableKeyControl(enable: boolean): void;
53
+ getTarget(): THREE.Vector3;
54
+ getPosition(): THREE.Vector3;
55
+ adjustCameraByBBox(bbox: THREE.Box3): void;
56
+ enableControl(active: boolean): void;
57
+ get enableRotate(): boolean;
58
+ set enableRotate(enable: boolean);
59
+ enableZoom(enable: boolean): void;
60
+ enablePan(enable: boolean): void;
61
+ enableMouseLeft(enable: boolean): void;
62
+ setCameraPosition(position: THREE.Vector3): void;
63
+ setCameraTarget(target: THREE.Vector3): void;
64
+ flyTo(position: THREE.Vector3, lookAt: THREE.Vector3, enableTransition?: boolean): void;
65
+ flyToPosition(x: number, y: number, z: number): void;
66
+ flyToBox(box: THREE.Box3, fitOptions?: Partial<FitToOptions>): void;
67
+ fitToSphere(box: THREE.Object3D | THREE.Sphere): void;
68
+ flyToObject(object: THREE.Object3D): void;
69
+ flyToViewpoint(viewpoint: Viewpoint): void;
70
+ getDistanceToFitSphere(radius: number): number;
71
+ setNavigationMode(mode: ControlsMode): void;
72
+ getProjection(): CameraProjection;
73
+ setProjection(proj: CameraProjection): void;
74
+ setOrbitPoint(point: THREE.Vector3): void;
75
+ getCameraDirection(): THREE.Vector3;
76
+ getCameraInfo(): CameraInfo;
77
+ getCurrentViewpoint(): Viewpoint;
78
+ goToViewpoint(vp: Viewpoint): void;
79
+ destroy(): void;
80
+ }
@@ -0,0 +1 @@
1
+ export * from "./CameraManager";