@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,46 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export type DxfMTextContentElement = DxfMTextContentElement[] | string | {
5
+ /** font family */
6
+ f?: string;
7
+ /** bold */
8
+ b?: 0 | 1;
9
+ /** italic */
10
+ i?: 0 | 1;
11
+ /** code page */
12
+ c?: number;
13
+ /** pitch */
14
+ p?: number;
15
+ /** angle in degrees */
16
+ Q?: number;
17
+ /** character height (with unit) */
18
+ H?: [number, string];
19
+ /** character width (with unit) */
20
+ W?: [number, string];
21
+ /** stacking */
22
+ S?: [string, "^" | "/" | "#", string];
23
+ /** alignment (0: bottom, 1: center, 2: top) */
24
+ A?: 0 | 1 | 2;
25
+ /** color index */
26
+ C?: number;
27
+ /** character spacing */
28
+ T?: number;
29
+ /** underscore */
30
+ L?: 0 | 1;
31
+ /** overscore */
32
+ O?: 0 | 1;
33
+ /** strike through */
34
+ K?: 0 | 1;
35
+ };
36
+ /**
37
+ * @internal
38
+ * [{f:""},
39
+ * {W:[,]},
40
+ * {C:number},
41
+ * ...
42
+ * ""] // The last one must be the test string
43
+ */
44
+ export declare const parseDxfMTextContent: (s: string, options?: {
45
+ readonly encoding?: string | TextDecoder;
46
+ }) => DxfMTextContentElement[];
@@ -0,0 +1,16 @@
1
+ export interface DxfTextContentElement {
2
+ /** text content */
3
+ text: string;
4
+ /** strike-through */
5
+ k?: 1;
6
+ /** overscore */
7
+ o?: 1;
8
+ /** underscore */
9
+ u?: 1;
10
+ }
11
+ export declare const decodeDxfTextCharacterCodes: (text: string, mbcsEncoding?: string | TextDecoder) => string;
12
+ export declare const decodeDxfTextUnicodeCodePoints: (text: string) => string;
13
+ export declare const decodeDxfTextMbcsCharacterCodes: (text: string, encoding: string | TextDecoder) => string;
14
+ export declare const parseDxfTextContent: (text: string, options?: {
15
+ readonly encoding?: string | TextDecoder;
16
+ }) => DxfTextContentElement[];
@@ -0,0 +1,10 @@
1
+ export * from "./DxfCompare";
2
+ export * from "./DxfLoader";
3
+ export * from "./bspline";
4
+ export * from "./dxfom-mtext";
5
+ export * from "./round10";
6
+ export * from "./DxfConstants";
7
+ export * from "./DxfUtils";
8
+ export * from "./HatchPatternShaders";
9
+ export * from "./LinePatternShaders";
10
+ export * from "./dxfom-text";
@@ -0,0 +1 @@
1
+ export declare const round10: (value: number, exp: number) => number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * AutoCad files sometimes use an indexed color value between 1 and 255 inclusive.
3
+ * Each value corresponds to a color. index 1 is red, that is 16711680 or 0xFF0000.
4
+ * index 0 and 256, while included in this array, are actually reserved for inheritance
5
+ * values in AutoCad so they should not be used for index color lookups.
6
+ */
7
+ declare const _default: number[];
8
+ export default _default;
@@ -0,0 +1,12 @@
1
+ export interface IGroup {
2
+ code: number;
3
+ value: number | string | boolean;
4
+ }
5
+ export declare abstract class DxfBaseReader {
6
+ protected pointer: number;
7
+ protected eof: boolean;
8
+ lastReadGroup: IGroup | undefined;
9
+ abstract next(): IGroup;
10
+ abstract hasNext(): boolean;
11
+ abstract isEOF(): boolean;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { DxfBaseReader, IGroup } from "./DxfBaseReader";
2
+ export default class DxfBinaryReader extends DxfBaseReader {
3
+ private reader;
4
+ private decoder;
5
+ private int8Array;
6
+ private caches;
7
+ constructor(data: ArrayBuffer);
8
+ next(): IGroup;
9
+ hasNext(): boolean;
10
+ isEOF(): boolean;
11
+ private parseGroupValue;
12
+ private readNullTerminatedString;
13
+ private ReadBinaryData;
14
+ }
@@ -0,0 +1,324 @@
1
+ import IGeometry, { IEntity, IPoint } from "./entities/geomtry";
2
+ import { IClass, IObject, IObjectParser } from "./objects/common";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare enum BlockTypeFlags {
7
+ None = 0,
8
+ AnonymousBlock = 1,
9
+ NonConstantAttributeDefinitions = 2,
10
+ XRef = 4,
11
+ XRefOverlay = 8,
12
+ ExternallyDependent = 16,
13
+ ResolvedExternalReference = 32,
14
+ DefinitionExternalReference = 64
15
+ }
16
+ /**
17
+ * Definition of a block. Which contains entities, name, handle, etc.
18
+ * @internal
19
+ */
20
+ export interface IBlock {
21
+ entities: IEntity[];
22
+ ownerHandle: string;
23
+ xrefPath: string;
24
+ name: string;
25
+ name2: string;
26
+ handle: string;
27
+ layer: string;
28
+ position: IPoint;
29
+ paperSpace: boolean;
30
+ blockType: BlockTypeFlags;
31
+ description?: string;
32
+ }
33
+ /**
34
+ * Definition of a viewport.
35
+ * @internal
36
+ */
37
+ export interface IViewport {
38
+ name: string;
39
+ handle?: string;
40
+ lowerLeftCorner: IPoint;
41
+ upperRightCorner: IPoint;
42
+ center: IPoint;
43
+ snapBasePoint: IPoint;
44
+ snapSpacing: IPoint;
45
+ gridSpacing: IPoint;
46
+ viewDirectionFromTarget: IPoint;
47
+ viewTarget: IPoint;
48
+ aspectRatio: number;
49
+ lensLength: number;
50
+ frontClippingPlane: string | number | boolean;
51
+ backClippingPlane: string | number | boolean;
52
+ viewHeight: number;
53
+ snapRotationAngle: number;
54
+ viewTwistAngle: number;
55
+ orthographicType: number;
56
+ ucsOrigin: IPoint;
57
+ ucsXAxis: IPoint;
58
+ ucsYAxis: IPoint;
59
+ renderMode: string;
60
+ defaultLightingType: number;
61
+ defaultLightingOn: boolean;
62
+ ownerHandle: string;
63
+ ambientColor: number;
64
+ }
65
+ /**
66
+ * Viewport table definition.
67
+ * @internal
68
+ */
69
+ export interface IViewportTableDefinition {
70
+ dxfSymbolName: "VPORT";
71
+ parseTableRecords(): IViewport[];
72
+ }
73
+ /**
74
+ * Line type.
75
+ * @internal
76
+ */
77
+ export interface ILineType {
78
+ name: string;
79
+ description: string;
80
+ pattern: number[];
81
+ patternLength: number;
82
+ }
83
+ /**
84
+ * Line type table definition.
85
+ * @internal
86
+ */
87
+ export interface ILineTypeTableDefinition {
88
+ dxfSymbolName: "LTYPE";
89
+ parseTableRecords(): Record<string, ILineType>;
90
+ }
91
+ /**
92
+ * Definition of a layer.
93
+ */
94
+ export interface ILayer {
95
+ /**
96
+ * Unique layer name with the dxf/dwg file.
97
+ */
98
+ name: string;
99
+ /**
100
+ * AutoCAD entity handle as hex string
101
+ * @internal
102
+ */
103
+ handle: string;
104
+ visible: boolean;
105
+ /**
106
+ * @internal
107
+ */
108
+ colorIndex: number;
109
+ /**
110
+ * color in decimal
111
+ */
112
+ color: number;
113
+ /**
114
+ * @internal
115
+ */
116
+ frozen: boolean;
117
+ /**
118
+ * @internal
119
+ */
120
+ flag: number;
121
+ /**
122
+ * @internal
123
+ */
124
+ lineType: string;
125
+ /**
126
+ * @internal
127
+ */
128
+ lineweight: 0 | 5 | 9 | 13 | 15 | 18 | 20 | 25 | 30 | 35 | 40 | 50 | 53 | 60 | 70 | 80 | 90 | 100 | 106 | 120 | 140 | 158 | 200 | 211 | -3 | -2 | -1;
129
+ }
130
+ /**
131
+ * Layer table definition.
132
+ * @internal
133
+ */
134
+ export interface ILayerTableDefinition {
135
+ dxfSymbolName: "LAYER";
136
+ parseTableRecords(): Record<string, ILayer>;
137
+ }
138
+ /**
139
+ * BlockRecord
140
+ * @internal
141
+ */
142
+ export interface IBlockRecord {
143
+ handle: string;
144
+ ownerHandle: string;
145
+ blockName: string;
146
+ layoutHandle: string;
147
+ blockInsertUnits: number;
148
+ blockExplodability: number;
149
+ blockScalability: number;
150
+ bitmap?: string;
151
+ }
152
+ /**
153
+ * @internal
154
+ */
155
+ export interface IBlockRecordTableDefinition {
156
+ dxfSymbolName: "BLOCK_RECORD";
157
+ parseTableRecords(): Record<string, IBlockRecord>;
158
+ }
159
+ /**
160
+ * Definition of a style.
161
+ * @internal
162
+ */
163
+ export interface IStyle {
164
+ handle: string;
165
+ ownerHandle: string;
166
+ styleName: string;
167
+ priorTextHeight: number;
168
+ textHeight: number;
169
+ xScale: number;
170
+ rotation: number;
171
+ mirrorType: number;
172
+ fontFile: string;
173
+ bigFontFile: string;
174
+ }
175
+ /**
176
+ * Style table definition.
177
+ * @internal
178
+ */
179
+ export interface IStyleTableDefinition {
180
+ dxfSymbolName: "STYLE";
181
+ parseTableRecords(): Record<string, IStyle>;
182
+ }
183
+ /**
184
+ * Dim style.
185
+ * @internal
186
+ */
187
+ export interface IDimStyle {
188
+ styleName: string;
189
+ DIMSCALE: number;
190
+ DIMASZ: number;
191
+ DIMEXO: string;
192
+ DIMEXE: string;
193
+ DIMSE1: string;
194
+ DIMSE2: string;
195
+ DIMTAD: string;
196
+ DIMTXT: string;
197
+ DIMGAP: number;
198
+ DIMCLRD: number;
199
+ DIMCLRT: number;
200
+ DIMLFAC: number;
201
+ DIMDEC: string;
202
+ DIMLDRBLK: string;
203
+ }
204
+ /**
205
+ * Dim style table definition
206
+ * @internal
207
+ */
208
+ export interface IDimStyleTableDefinition {
209
+ dxfSymbolName: "DIMSTYLE";
210
+ parseTableRecords(): Record<string, IDimStyle>;
211
+ }
212
+ /**
213
+ * Table definitions.
214
+ * @internal
215
+ */
216
+ export interface ITableDefinitions {
217
+ VPORT: IViewportTableDefinition;
218
+ LTYPE: ILineTypeTableDefinition;
219
+ LAYER: ILayerTableDefinition;
220
+ BLOCK_RECORD: IBlockRecordTableDefinition;
221
+ STYLE: IStyleTableDefinition;
222
+ DIMSTYLE: IDimStyleTableDefinition;
223
+ }
224
+ /**
225
+ * Base table
226
+ * @internal
227
+ */
228
+ export interface IBaseTable {
229
+ handle: string;
230
+ ownerHandle: string;
231
+ }
232
+ /**
233
+ * Viewport table
234
+ * @internal
235
+ */
236
+ export interface IViewportTable extends IBaseTable {
237
+ entries: IViewport[];
238
+ }
239
+ /**
240
+ * @internal
241
+ */
242
+ export interface ILayerTypesTable extends IBaseTable {
243
+ entries: Record<string, ILineType>;
244
+ }
245
+ /**
246
+ * @internal
247
+ */
248
+ export interface ILayersTable extends IBaseTable {
249
+ entries: Record<string, ILayer>;
250
+ }
251
+ /**
252
+ * @internal
253
+ */
254
+ export interface IStylesTable extends IBaseTable {
255
+ entries: Record<string, IStyle>;
256
+ }
257
+ /**
258
+ * @internal
259
+ */
260
+ export interface IDimStyleTable extends IBaseTable {
261
+ entries: Record<string, IDimStyle>;
262
+ }
263
+ /**
264
+ * @internal
265
+ */
266
+ export interface IBlockRecordsTable extends IBaseTable {
267
+ entries: Record<string, IBlockRecord>;
268
+ }
269
+ /**
270
+ * @internal
271
+ */
272
+ export interface ITables {
273
+ VPORT: IViewportTable;
274
+ LTYPE: ILayerTypesTable;
275
+ LAYER: ILayersTable;
276
+ BLOCK_RECORD: IBlockRecordsTable;
277
+ STYLE: IStylesTable;
278
+ DIMSTYLE: IDimStyleTable;
279
+ }
280
+ /**
281
+ * @internal
282
+ */
283
+ export type ITable = IViewportTable | ILayerTypesTable | ILayersTable | IBlockRecordsTable | IStylesTable | IDimStyleTable;
284
+ /**
285
+ * @internal
286
+ */
287
+ export interface IDxf {
288
+ header: Record<string, IPoint | number | string>;
289
+ entities: IEntity[];
290
+ blocks: Record<string, IBlock>;
291
+ tables: ITables;
292
+ objects: Record<string, IObject[]>;
293
+ classes: IClass[];
294
+ }
295
+ export default class DxfParser {
296
+ private encoding?;
297
+ private _entityHandlers;
298
+ private _objectHandlers;
299
+ private _layoutBlocks;
300
+ private unhandledSections;
301
+ private unhandledObjects;
302
+ private unhandledEntities;
303
+ private unsupportedLineTypes;
304
+ constructor(encoding?: string);
305
+ parse(source: string | ArrayBuffer): IDxf;
306
+ registerEntityHandler(handlerType: new () => IGeometry): void;
307
+ registerObjectHandler(handlerType: new () => IObjectParser): void;
308
+ private _parse;
309
+ /**
310
+ * Converts DwgEntity to IEntity
311
+ */
312
+ private _parseDwgEntity;
313
+ private _parseDwgEntities;
314
+ /**
315
+ * Simply call libredwg.convertEx(). For test usage.
316
+ */
317
+ private libredwgConvertEx;
318
+ private parseDwg;
319
+ /**
320
+ * Splits a string to string array by line separator, "\r\n", "\r", "\n", etc.
321
+ * We do this instead of using "String.prototype.split(/\r\n|\r|\n/g)", because it is extreamly slow!
322
+ */
323
+ private splitByLineSeparator;
324
+ }
@@ -0,0 +1,31 @@
1
+ import { IGroup, DxfBaseReader } from './DxfBaseReader';
2
+ /**
3
+ *
4
+ * Based off the AutoCad 2012 DXF Reference
5
+ * http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf
6
+ *
7
+ * Reads through an array representing lines of a dxf file. Takes an array and
8
+ * provides an easy interface to extract group code and value pairs.
9
+ * @param data - an array where each element represents a line in the dxf file
10
+ * @constructor
11
+ */
12
+ export default class DxfTextRender extends DxfBaseReader {
13
+ private data;
14
+ constructor(data: string[]);
15
+ /**
16
+ * Gets the next group (code, value) from the array. A group is two consecutive elements
17
+ * in the array. The first is the code, the second is the value.
18
+ * @returns {{code: Number}|*}
19
+ */
20
+ next(): IGroup;
21
+ /**
22
+ * Returns true if there is another code/value pair (2 elements in the array).
23
+ * @returns {boolean}
24
+ */
25
+ hasNext(): boolean;
26
+ /**
27
+ * Returns true if the scanner is at the end of the array
28
+ * @returns {boolean}
29
+ */
30
+ isEOF(): boolean;
31
+ }
@@ -0,0 +1,45 @@
1
+ import { DwgEntity } from "@mlightcad/libredwg-web";
2
+ import { DxfBaseReader, IGroup } from "./DxfBaseReader";
3
+ import { IEntity, IPoint } from "./entities/geomtry";
4
+ import { IObject } from "./objects/common";
5
+ /**
6
+ * This sdk cannot support some entity types, like "PROXY" and "REGION",
7
+ * and it cannot support all "HATCH". An unsupported entity may be exploded
8
+ * and be replaced by an insert (in dwg2dxf tool), in this case, we need to
9
+ * know its original type.
10
+ */
11
+ export declare const OriginalTypes: string[];
12
+ /**
13
+ * Returns the truecolor value of the given AutoCad color index value
14
+ * @return {Number} truecolor value as a number
15
+ */
16
+ export declare function getAcadColor(index: number): number;
17
+ /**
18
+ * Parses the 2D or 3D coordinate, vector, or point. When complete,
19
+ * the scanner remains on the last group of the coordinate.
20
+ * @param {*} scanner
21
+ */
22
+ export declare function parsePoint(scanner: DxfBaseReader): IPoint;
23
+ /**
24
+ * Parses 16 numbers as an array. When complete,
25
+ * the scanner remains on the last group of the value.
26
+ * @param {*} scanner
27
+ * @param {*} groupCode
28
+ */
29
+ export declare function parseMatrix(scanner: DxfBaseReader, groupCode: number): number[];
30
+ /**
31
+ * Attempts to parse codes common to all entities. Returns true if the group
32
+ * was handled by this function.
33
+ * @param {*} entity - the entity currently being parsed
34
+ * @param {*} curr - the current group being parsed
35
+ */
36
+ export declare function checkCommonEntityProperties(entity: IEntity, curr: IGroup): boolean;
37
+ /**
38
+ * Attempts to parse codes common to all objects. Returns true if the group
39
+ * was handled by this function.
40
+ * @param {*} object - the object currently being parsed
41
+ * @param {*} curr - the current group being parsed
42
+ */
43
+ export declare function checkCommonObjectProperties(object: IObject, curr: IGroup): boolean;
44
+ export declare function convertDwgCommonEntityProperties(entity: DwgEntity, newEntity: IEntity): void;
45
+ export declare function bigInt2HexString(val: bigint | number): string;
@@ -0,0 +1,13 @@
1
+ import { Dwg3dFaceEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface I3DfaceEntity extends IEntity {
5
+ shape: boolean;
6
+ hasContinuousLinetypePattern: boolean;
7
+ vertices: IPoint[];
8
+ }
9
+ export default class ThreeDface implements IGeometry {
10
+ ForEntityName: "3DFACE";
11
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): I3DfaceEntity;
12
+ parseDwgEntity(entity: Dwg3dFaceEntity): IEntity;
13
+ }
@@ -0,0 +1,18 @@
1
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DwgArcEntity } from "@mlightcad/libredwg-web";
4
+ export interface IArcEntity extends IEntity {
5
+ center: IPoint;
6
+ radius: number;
7
+ startAngle: number;
8
+ endAngle: number;
9
+ angleLength: number;
10
+ extrusionDirectionX: number;
11
+ extrusionDirectionY: number;
12
+ extrusionDirectionZ: number;
13
+ }
14
+ export default class Arc implements IGeometry {
15
+ ForEntityName: "ARC";
16
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): IArcEntity;
17
+ parseDwgEntity(entity: DwgArcEntity): IEntity;
18
+ }
@@ -0,0 +1,33 @@
1
+ import { DwgAttdefEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface IAttdefEntity extends IEntity {
5
+ xScale: number;
6
+ textStyle: "STANDARD" | string;
7
+ text: string;
8
+ tag: string;
9
+ prompt: string;
10
+ startPoint: IPoint;
11
+ endPoint: IPoint;
12
+ thickness: number;
13
+ textHeight: number;
14
+ rotation: number;
15
+ obliqueAngle: number;
16
+ invisible: boolean;
17
+ constant: boolean;
18
+ verificationRequired: boolean;
19
+ preset: boolean;
20
+ backwards: boolean;
21
+ mirrored: boolean;
22
+ horizontalJustification: number;
23
+ fieldLength: number;
24
+ verticalJustification: number;
25
+ extrusionDirectionX: number;
26
+ extrusionDirectionY: number;
27
+ extrusionDirectionZ: number;
28
+ }
29
+ export default class Attdef implements IGeometry {
30
+ ForEntityName: "ATTDEF";
31
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): IAttdefEntity;
32
+ parseDwgEntity(entity: DwgAttdefEntity): IEntity;
33
+ }
@@ -0,0 +1,33 @@
1
+ import { DwgAttribEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface IAttribEntity extends IEntity {
5
+ xScale: number;
6
+ textStyle: "STANDARD" | string;
7
+ text: string;
8
+ tag: string;
9
+ prompt: string;
10
+ startPoint: IPoint;
11
+ endPoint: IPoint;
12
+ thickness: number;
13
+ textHeight: number;
14
+ rotation: number;
15
+ obliqueAngle: number;
16
+ invisible: boolean;
17
+ constant: boolean;
18
+ verificationRequired: boolean;
19
+ preset: boolean;
20
+ backwards: boolean;
21
+ mirrored: boolean;
22
+ horizontalJustification: number;
23
+ fieldLength: number;
24
+ verticalJustification: number;
25
+ extrusionDirectionX: number;
26
+ extrusionDirectionY: number;
27
+ extrusionDirectionZ: number;
28
+ }
29
+ export default class Attrib implements IGeometry {
30
+ ForEntityName: "ATTRIB";
31
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): IAttribEntity;
32
+ parseDwgEntity(entity: DwgAttribEntity): IEntity;
33
+ }
@@ -0,0 +1,15 @@
1
+ import { DwgCircleEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface ICircleEntity extends IEntity {
5
+ center: IPoint;
6
+ radius: number;
7
+ startAngle: number;
8
+ endAngle: number;
9
+ angleLength: number;
10
+ }
11
+ export default class Circle implements IGeometry {
12
+ ForEntityName: "CIRCLE";
13
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): ICircleEntity;
14
+ parseDwgEntity(entity: DwgCircleEntity): IEntity;
15
+ }
@@ -0,0 +1,24 @@
1
+ import { DwgDimensionEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface IDimensionEntity extends IEntity {
5
+ block: string;
6
+ dimStyleName: string;
7
+ anchorPoint: IPoint;
8
+ middleOfText: IPoint;
9
+ insertionPoint: IPoint;
10
+ linearOrAngularPoint1: IPoint;
11
+ linearOrAngularPoint2: IPoint;
12
+ diameterOrRadiusPoint: IPoint;
13
+ arcPoint: IPoint;
14
+ dimensionType: number;
15
+ attachmentPoint: number;
16
+ actualMeasurement: number;
17
+ text: string;
18
+ angle: number;
19
+ }
20
+ export default class Dimension implements IGeometry {
21
+ ForEntityName: "DIMENSION";
22
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): IDimensionEntity;
23
+ parseDwgEntity(entity: DwgDimensionEntity): IEntity;
24
+ }
@@ -0,0 +1,17 @@
1
+ import { DwgEllipseEntity } from "@mlightcad/libredwg-web";
2
+ import IGeometry, { IEntity, IPoint } from "./geomtry";
3
+ import { DxfBaseReader, IGroup } from "../DxfBaseReader";
4
+ export interface IEllipseEntity extends IEntity {
5
+ center: IPoint;
6
+ majorAxisEndPoint: IPoint;
7
+ axisRatio: number;
8
+ startAngle: number;
9
+ endAngle: number;
10
+ name: string;
11
+ extrusionDirection: IPoint;
12
+ }
13
+ export default class Ellipse implements IGeometry {
14
+ ForEntityName: "ELLIPSE";
15
+ parseEntity(scanner: DxfBaseReader, curr: IGroup): IEllipseEntity;
16
+ parseDwgEntity(entity: DwgEllipseEntity): IEntity;
17
+ }