@mlightcad/cad-simple-viewer 1.0.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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/dist/index.js +2422 -0
  4. package/dist/index.umd.cjs +9 -0
  5. package/lib/app/AcApContext.d.ts +15 -0
  6. package/lib/app/AcApContext.d.ts.map +1 -0
  7. package/lib/app/AcApContext.js +56 -0
  8. package/lib/app/AcApContext.js.map +1 -0
  9. package/lib/app/AcApDocCreator.d.ts +17 -0
  10. package/lib/app/AcApDocCreator.d.ts.map +1 -0
  11. package/lib/app/AcApDocCreator.js +140 -0
  12. package/lib/app/AcApDocCreator.js.map +1 -0
  13. package/lib/app/AcApDocManager.d.ts +60 -0
  14. package/lib/app/AcApDocManager.d.ts.map +1 -0
  15. package/lib/app/AcApDocManager.js +275 -0
  16. package/lib/app/AcApDocManager.js.map +1 -0
  17. package/lib/app/AcApDocument.d.ts +27 -0
  18. package/lib/app/AcApDocument.d.ts.map +1 -0
  19. package/lib/app/AcApDocument.js +165 -0
  20. package/lib/app/AcApDocument.js.map +1 -0
  21. package/lib/app/AcApFontLoader.d.ts +20 -0
  22. package/lib/app/AcApFontLoader.d.ts.map +1 -0
  23. package/lib/app/AcApFontLoader.js +135 -0
  24. package/lib/app/AcApFontLoader.js.map +1 -0
  25. package/lib/app/AcApSettingManager.d.ts +44 -0
  26. package/lib/app/AcApSettingManager.d.ts.map +1 -0
  27. package/lib/app/AcApSettingManager.js +122 -0
  28. package/lib/app/AcApSettingManager.js.map +1 -0
  29. package/lib/app/index.d.ts +5 -0
  30. package/lib/app/index.d.ts.map +1 -0
  31. package/lib/app/index.js +5 -0
  32. package/lib/app/index.js.map +1 -0
  33. package/lib/command/AcApConvertToSvgCmd.d.ts +6 -0
  34. package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
  35. package/lib/command/AcApConvertToSvgCmd.js +30 -0
  36. package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
  37. package/lib/command/AcApOpenCmd.d.ts +6 -0
  38. package/lib/command/AcApOpenCmd.d.ts.map +1 -0
  39. package/lib/command/AcApOpenCmd.js +29 -0
  40. package/lib/command/AcApOpenCmd.js.map +1 -0
  41. package/lib/command/AcApPanCmd.d.ts +6 -0
  42. package/lib/command/AcApPanCmd.d.ts.map +1 -0
  43. package/lib/command/AcApPanCmd.js +30 -0
  44. package/lib/command/AcApPanCmd.js.map +1 -0
  45. package/lib/command/AcApQNewCmd.d.ts +6 -0
  46. package/lib/command/AcApQNewCmd.d.ts.map +1 -0
  47. package/lib/command/AcApQNewCmd.js +30 -0
  48. package/lib/command/AcApQNewCmd.js.map +1 -0
  49. package/lib/command/AcApSelectCmd.d.ts +6 -0
  50. package/lib/command/AcApSelectCmd.d.ts.map +1 -0
  51. package/lib/command/AcApSelectCmd.js +30 -0
  52. package/lib/command/AcApSelectCmd.js.map +1 -0
  53. package/lib/command/AcApSvgConvertor.d.ts +5 -0
  54. package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
  55. package/lib/command/AcApSvgConvertor.js +55 -0
  56. package/lib/command/AcApSvgConvertor.js.map +1 -0
  57. package/lib/command/AcApZoomCmd.d.ts +6 -0
  58. package/lib/command/AcApZoomCmd.d.ts.map +1 -0
  59. package/lib/command/AcApZoomCmd.js +28 -0
  60. package/lib/command/AcApZoomCmd.js.map +1 -0
  61. package/lib/command/AcApZoomToBoxCmd.d.ts +11 -0
  62. package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
  63. package/lib/command/AcApZoomToBoxCmd.js +101 -0
  64. package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
  65. package/lib/command/index.d.ts +10 -0
  66. package/lib/command/index.d.ts.map +1 -0
  67. package/lib/command/index.js +10 -0
  68. package/lib/command/index.js.map +1 -0
  69. package/lib/editor/command/AcEdCommand.d.ts +42 -0
  70. package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
  71. package/lib/editor/command/AcEdCommand.js +60 -0
  72. package/lib/editor/command/AcEdCommand.js.map +1 -0
  73. package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
  74. package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
  75. package/lib/editor/command/AcEdCommandIterator.js +65 -0
  76. package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
  77. package/lib/editor/command/AcEdCommandStack.d.ts +66 -0
  78. package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
  79. package/lib/editor/command/AcEdCommandStack.js +192 -0
  80. package/lib/editor/command/AcEdCommandStack.js.map +1 -0
  81. package/lib/editor/command/index.d.ts +3 -0
  82. package/lib/editor/command/index.d.ts.map +1 -0
  83. package/lib/editor/command/index.js +3 -0
  84. package/lib/editor/command/index.js.map +1 -0
  85. package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
  86. package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
  87. package/lib/editor/global/AcEdGlobalFunc.js +14 -0
  88. package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
  89. package/lib/editor/global/AcEdMessage.d.ts +5 -0
  90. package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
  91. package/lib/editor/global/AcEdMessage.js +6 -0
  92. package/lib/editor/global/AcEdMessage.js.map +1 -0
  93. package/lib/editor/global/eventBus.d.ts +34 -0
  94. package/lib/editor/global/eventBus.d.ts.map +1 -0
  95. package/lib/editor/global/eventBus.js +3 -0
  96. package/lib/editor/global/eventBus.js.map +1 -0
  97. package/lib/editor/global/index.d.ts +3 -0
  98. package/lib/editor/global/index.d.ts.map +1 -0
  99. package/lib/editor/global/index.js +3 -0
  100. package/lib/editor/global/index.js.map +1 -0
  101. package/lib/editor/index.d.ts +5 -0
  102. package/lib/editor/index.d.ts.map +1 -0
  103. package/lib/editor/index.js +5 -0
  104. package/lib/editor/index.js.map +1 -0
  105. package/lib/editor/input/AcEdBaseInput.d.ts +25 -0
  106. package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
  107. package/lib/editor/input/AcEdBaseInput.js +105 -0
  108. package/lib/editor/input/AcEdBaseInput.js.map +1 -0
  109. package/lib/editor/input/AcEdBoxSelector.d.ts +27 -0
  110. package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
  111. package/lib/editor/input/AcEdBoxSelector.js +140 -0
  112. package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
  113. package/lib/editor/input/AcEdCursorManager.d.ts +43 -0
  114. package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
  115. package/lib/editor/input/AcEdCursorManager.js +71 -0
  116. package/lib/editor/input/AcEdCursorManager.js.map +1 -0
  117. package/lib/editor/input/AcEdInputPoint.d.ts +14 -0
  118. package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
  119. package/lib/editor/input/AcEdInputPoint.js +41 -0
  120. package/lib/editor/input/AcEdInputPoint.js.map +1 -0
  121. package/lib/editor/input/AcEdJig.d.ts +14 -0
  122. package/lib/editor/input/AcEdJig.d.ts.map +1 -0
  123. package/lib/editor/input/AcEdJig.js +92 -0
  124. package/lib/editor/input/AcEdJig.js.map +1 -0
  125. package/lib/editor/input/AcEdJigLoop.d.ts +14 -0
  126. package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
  127. package/lib/editor/input/AcEdJigLoop.js +43 -0
  128. package/lib/editor/input/AcEdJigLoop.js.map +1 -0
  129. package/lib/editor/input/AcEdSelectionSet.d.ts +26 -0
  130. package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
  131. package/lib/editor/input/AcEdSelectionSet.js +63 -0
  132. package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
  133. package/lib/editor/input/AcEditor.d.ts +27 -0
  134. package/lib/editor/input/AcEditor.d.ts.map +1 -0
  135. package/lib/editor/input/AcEditor.js +103 -0
  136. package/lib/editor/input/AcEditor.js.map +1 -0
  137. package/lib/editor/input/index.d.ts +5 -0
  138. package/lib/editor/input/index.d.ts.map +1 -0
  139. package/lib/editor/input/index.js +5 -0
  140. package/lib/editor/input/index.js.map +1 -0
  141. package/lib/editor/view/AcEdBaseView.d.ts +261 -0
  142. package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
  143. package/lib/editor/view/AcEdBaseView.js +260 -0
  144. package/lib/editor/view/AcEdBaseView.js.map +1 -0
  145. package/lib/editor/view/index.d.ts +2 -0
  146. package/lib/editor/view/index.d.ts.map +1 -0
  147. package/lib/editor/view/index.js +2 -0
  148. package/lib/editor/view/index.js.map +1 -0
  149. package/lib/index.d.ts +5 -0
  150. package/lib/index.d.ts.map +1 -0
  151. package/lib/index.js +5 -0
  152. package/lib/index.js.map +1 -0
  153. package/lib/util/AcTrGeometryUtil.d.ts +18 -0
  154. package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
  155. package/lib/util/AcTrGeometryUtil.js +33 -0
  156. package/lib/util/AcTrGeometryUtil.js.map +1 -0
  157. package/lib/util/index.d.ts +2 -0
  158. package/lib/util/index.d.ts.map +1 -0
  159. package/lib/util/index.js +2 -0
  160. package/lib/util/index.js.map +1 -0
  161. package/lib/view/AcTrLayer.d.ts +97 -0
  162. package/lib/view/AcTrLayer.d.ts.map +1 -0
  163. package/lib/view/AcTrLayer.js +170 -0
  164. package/lib/view/AcTrLayer.js.map +1 -0
  165. package/lib/view/AcTrLayout.d.ts +114 -0
  166. package/lib/view/AcTrLayout.d.ts.map +1 -0
  167. package/lib/view/AcTrLayout.js +344 -0
  168. package/lib/view/AcTrLayout.js.map +1 -0
  169. package/lib/view/AcTrLayoutView.d.ts +57 -0
  170. package/lib/view/AcTrLayoutView.d.ts.map +1 -0
  171. package/lib/view/AcTrLayoutView.js +151 -0
  172. package/lib/view/AcTrLayoutView.js.map +1 -0
  173. package/lib/view/AcTrLayoutViewManager.d.ts +43 -0
  174. package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
  175. package/lib/view/AcTrLayoutViewManager.js +74 -0
  176. package/lib/view/AcTrLayoutViewManager.js.map +1 -0
  177. package/lib/view/AcTrScene.d.ts +115 -0
  178. package/lib/view/AcTrScene.d.ts.map +1 -0
  179. package/lib/view/AcTrScene.js +319 -0
  180. package/lib/view/AcTrScene.js.map +1 -0
  181. package/lib/view/AcTrView2d.d.ts +160 -0
  182. package/lib/view/AcTrView2d.d.ts.map +1 -0
  183. package/lib/view/AcTrView2d.js +473 -0
  184. package/lib/view/AcTrView2d.js.map +1 -0
  185. package/lib/view/index.d.ts +2 -0
  186. package/lib/view/index.d.ts.map +1 -0
  187. package/lib/view/index.js +2 -0
  188. package/lib/view/index.js.map +1 -0
  189. package/package.json +55 -0
@@ -0,0 +1,74 @@
1
+ var AcTrLayoutViewManager = /** @class */ (function () {
2
+ function AcTrLayoutViewManager() {
3
+ this._activeLayoutBtrId = '';
4
+ this._layoutViews = new Map();
5
+ }
6
+ Object.defineProperty(AcTrLayoutViewManager.prototype, "activeLayoutBtrId", {
7
+ /**
8
+ * The block table record id associated with the active layout
9
+ */
10
+ get: function () {
11
+ return this._activeLayoutBtrId;
12
+ },
13
+ set: function (value) {
14
+ this._activeLayoutBtrId = value;
15
+ this._layoutViews.forEach(function (layoutView) {
16
+ layoutView.enabled = layoutView.layoutBtrId == value;
17
+ });
18
+ },
19
+ enumerable: false,
20
+ configurable: true
21
+ });
22
+ Object.defineProperty(AcTrLayoutViewManager.prototype, "activeLayoutView", {
23
+ /**
24
+ * The active layout view.
25
+ */
26
+ get: function () {
27
+ return this._layoutViews.get(this._activeLayoutBtrId);
28
+ },
29
+ enumerable: false,
30
+ configurable: true
31
+ });
32
+ /**
33
+ * Return true if the layout view manager contains one layout view associated with the sepcified block
34
+ * table record id. Otherwise it returns false.
35
+ * @param name Input the block table record id associated with the layout view
36
+ * @returns Return true if the layout view manager contains one layout view associated with the sepcified
37
+ * block table record id. Otherwise it returns false.
38
+ */
39
+ AcTrLayoutViewManager.prototype.has = function (layoutBtrId) {
40
+ return this._layoutViews.has(layoutBtrId);
41
+ };
42
+ /**
43
+ * Get the layout view by the block table record id associated with the layout
44
+ * @param layoutBtrId Input the id of the block table record associated the layout
45
+ * @returns Return the layout view by the block table record id associated with the layout
46
+ */
47
+ AcTrLayoutViewManager.prototype.getAt = function (layoutBtrId) {
48
+ return this._layoutViews.get(layoutBtrId);
49
+ };
50
+ /**
51
+ * Resize all of layout views managed by layout view manager
52
+ * @param width Input new width of the layout view
53
+ * @param height Input new height of the layout view
54
+ */
55
+ AcTrLayoutViewManager.prototype.resize = function (width, height) {
56
+ this._layoutViews.forEach(function (layoutView) {
57
+ layoutView.resize(width, height);
58
+ });
59
+ };
60
+ AcTrLayoutViewManager.prototype.add = function (layoutView) {
61
+ this._layoutViews.set(layoutView.layoutBtrId, layoutView);
62
+ };
63
+ /**
64
+ * Render the specified scene in the current layout view
65
+ * @param scene Input the scene to render
66
+ */
67
+ AcTrLayoutViewManager.prototype.render = function (scene) {
68
+ var _a;
69
+ (_a = this.activeLayoutView) === null || _a === void 0 ? void 0 : _a.render(scene);
70
+ };
71
+ return AcTrLayoutViewManager;
72
+ }());
73
+ export { AcTrLayoutViewManager };
74
+ //# sourceMappingURL=AcTrLayoutViewManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayoutViewManager.js","sourceRoot":"","sources":["../../src/view/AcTrLayoutViewManager.ts"],"names":[],"mappings":"AAGA;IAIE;QACE,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAA;IAC/B,CAAC;IAKD,sBAAI,oDAAiB;QAHrB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,kBAAkB,CAAA;QAChC,CAAC;aACD,UAAsB,KAAa;YACjC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAA;YAC/B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAA,UAAU;gBAClC,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,WAAW,IAAI,KAAK,CAAA;YACtD,CAAC,CAAC,CAAA;QACJ,CAAC;;;OANA;IAWD,sBAAI,mDAAgB;QAHpB;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;QACvD,CAAC;;;OAAA;IAED;;;;;;OAMG;IACH,mCAAG,GAAH,UAAI,WAAmB;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IAC3C,CAAC;IAED;;;;OAIG;IACH,qCAAK,GAAL,UAAM,WAAmB;QACvB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IAC3C,CAAC;IAED;;;;OAIG;IACH,sCAAM,GAAN,UAAO,KAAa,EAAE,MAAc;QAClC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,UAAA,UAAU;YAClC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,mCAAG,GAAH,UAAI,UAA0B;QAC5B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;IAC3D,CAAC;IAED;;;OAGG;IACH,sCAAM,GAAN,UAAO,KAAgB;;QACrB,MAAA,IAAI,CAAC,gBAAgB,0CAAE,MAAM,CAAC,KAAK,CAAC,CAAA;IACtC,CAAC;IACH,4BAAC;AAAD,CAAC,AAvED,IAuEC"}
@@ -0,0 +1,115 @@
1
+ import { AcDbObjectId, AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
2
+ import { AcTrEntity, AcTrObject } from '@mlightcad/three-renderer';
3
+ import * as THREE from 'three';
4
+ import { AcTrLayout, AcTrLayoutStats } from './AcTrLayout';
5
+ /**
6
+ * The scene is orginaized according to the following hierarchy.
7
+ * - layout (AcTrLayout)
8
+ * - layer (AcTrLayer)
9
+ * - entity (AcTrEntity)
10
+ */
11
+ export declare class AcTrScene {
12
+ private _scene;
13
+ private _layouts;
14
+ private _activeLayoutBtrId;
15
+ private _modelSpaceBtrId;
16
+ constructor();
17
+ /**
18
+ * The layouts in this scene
19
+ */
20
+ get layouts(): Map<string, AcTrLayout>;
21
+ /**
22
+ * The bounding box of the visibile objects in this secene
23
+ */
24
+ get box(): THREE.Box3 | undefined;
25
+ /**
26
+ * The scene object of THREE.js. This is internally used only. Try to avoid using it.
27
+ */
28
+ get internalScene(): THREE.Scene;
29
+ /**
30
+ * The block table record id of the model space
31
+ */
32
+ get modelSpaceBtrId(): AcDbObjectId;
33
+ set modelSpaceBtrId(value: AcDbObjectId);
34
+ /**
35
+ * The block table record id associated with the current active layout
36
+ */
37
+ get activeLayoutBtrId(): string;
38
+ set activeLayoutBtrId(value: string);
39
+ /**
40
+ * Get active layout
41
+ */
42
+ get activeLayout(): AcTrLayout | undefined;
43
+ /**
44
+ * Get the layout of the model space
45
+ */
46
+ get modelSpaceLayout(): AcTrLayout | undefined;
47
+ /**
48
+ * The statistics of this scene
49
+ */
50
+ get stats(): {
51
+ layouts: AcTrLayoutStats[];
52
+ };
53
+ /**
54
+ * Add one empty layout with the specified block table record id as the its key
55
+ * @param ownerId Input the block table record id associated with this layout
56
+ * @returns Return the newly created empty layout
57
+ */
58
+ addEmptyLayout(ownerId: AcDbObjectId): AcTrLayout;
59
+ /**
60
+ * Clear scene
61
+ * @returns Return this scene
62
+ */
63
+ clear(): this;
64
+ /**
65
+ * Set layer's visibility
66
+ * @param layerName Input layer name
67
+ * @param visible Input visibility of the layer
68
+ */
69
+ setLayerVisibility(layerName: string, visible: boolean): boolean;
70
+ /**
71
+ * Hover the specified entities
72
+ */
73
+ hover(ids: AcDbObjectId[]): boolean;
74
+ /**
75
+ * Unhover the specified entities
76
+ */
77
+ unhover(ids: AcDbObjectId[]): boolean;
78
+ /**
79
+ * Select the specified entities
80
+ */
81
+ select(ids: AcDbObjectId[]): boolean;
82
+ /**
83
+ * Unselect the specified entities
84
+ */
85
+ unselect(ids: AcDbObjectId[]): boolean;
86
+ /**
87
+ * Search entities intersected or contained in the specified bounding box.
88
+ * @param box Input the query bounding box
89
+ * @returns Return query results
90
+ */
91
+ search(box: AcGeBox2d | AcGeBox3d): import("..").AcEdSpatialQueryResultItem[];
92
+ /**
93
+ * Add one AutoCAD entity into this scene. If the layout associated with this entity doesn't exist,
94
+ * then create one layout, add this layout into this scene, and add the entity into the layout.
95
+ * @param entity Input AutoCAD entity to be added into scene.
96
+ * @param extendBbox Input the flag whether to extend the bounding box of this scene by union the bounding box
97
+ * of the specified entity.
98
+ * @returns Return this scene
99
+ */
100
+ addEntity(entity: AcTrEntity, extendBbox?: boolean): this;
101
+ /**
102
+ * Remove the specified entity from this scene.
103
+ * @param objectId Input the object id of the entity to remove
104
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
105
+ */
106
+ remove(objectId: AcDbObjectId): boolean;
107
+ /**
108
+ * Update the specified entity in this scene.
109
+ * @param objectId Input the entity to update
110
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
111
+ */
112
+ update(entity: AcTrEntity): boolean;
113
+ setSnapObject(object: AcTrObject): this;
114
+ }
115
+ //# sourceMappingURL=AcTrScene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrScene.d.ts","sourceRoot":"","sources":["../../src/view/AcTrScene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE1D;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,gBAAgB,CAAc;;IAStC;;OAEG;IACH,IAAI,OAAO,4BAEV;IAED;;OAEG;IACH,IAAI,GAAG,2BAEN;IAED;;OAEG;IACH,IAAI,aAAa,gBAEhB;IAED;;OAEG;IACH,IAAI,eAAe,IAGQ,YAAY,CADtC;IACD,IAAI,eAAe,CAAC,KAAK,EAAE,YAAY,EAOtC;IAED;;OAEG;IACH,IAAI,iBAAiB,IAGQ,MAAM,CADlC;IACD,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAKlC;IAED;;OAEG;IACH,IAAI,YAAY,2BAKf;IAED;;OAEG;IACH,IAAI,gBAAgB,2BAKnB;IAED;;OAEG;IACH,IAAI,KAAK;;MAMR;IAED;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,YAAY;IAQpC;;;OAGG;IACH,KAAK;IAUL;;;;OAIG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAWtD;;OAEG;IACH,KAAK,CAAC,GAAG,EAAE,YAAY,EAAE;IASzB;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE;IAS3B;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE;IAS1B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE;IAS5B;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS;IAKjC;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,GAAE,OAAc;IAexD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY;IAO7B;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU;IAOzB,aAAa,CAAC,MAAM,EAAE,UAAU;CAMjC"}
@@ -0,0 +1,319 @@
1
+ var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ import * as THREE from 'three';
29
+ import { AcTrLayout } from './AcTrLayout';
30
+ /**
31
+ * The scene is orginaized according to the following hierarchy.
32
+ * - layout (AcTrLayout)
33
+ * - layer (AcTrLayer)
34
+ * - entity (AcTrEntity)
35
+ */
36
+ var AcTrScene = /** @class */ (function () {
37
+ function AcTrScene() {
38
+ this._scene = new THREE.Scene();
39
+ this._layouts = new Map();
40
+ this._activeLayoutBtrId = '';
41
+ this._modelSpaceBtrId = '';
42
+ }
43
+ Object.defineProperty(AcTrScene.prototype, "layouts", {
44
+ /**
45
+ * The layouts in this scene
46
+ */
47
+ get: function () {
48
+ return this._layouts;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ Object.defineProperty(AcTrScene.prototype, "box", {
54
+ /**
55
+ * The bounding box of the visibile objects in this secene
56
+ */
57
+ get: function () {
58
+ var _a;
59
+ return (_a = this.activeLayout) === null || _a === void 0 ? void 0 : _a.box;
60
+ },
61
+ enumerable: false,
62
+ configurable: true
63
+ });
64
+ Object.defineProperty(AcTrScene.prototype, "internalScene", {
65
+ /**
66
+ * The scene object of THREE.js. This is internally used only. Try to avoid using it.
67
+ */
68
+ get: function () {
69
+ return this._scene;
70
+ },
71
+ enumerable: false,
72
+ configurable: true
73
+ });
74
+ Object.defineProperty(AcTrScene.prototype, "modelSpaceBtrId", {
75
+ /**
76
+ * The block table record id of the model space
77
+ */
78
+ get: function () {
79
+ return this._modelSpaceBtrId;
80
+ },
81
+ set: function (value) {
82
+ this._modelSpaceBtrId = value;
83
+ if (!this._layouts.has(value)) {
84
+ throw new Error("[AcTrScene] No layout assiciated with the specified block table record id '".concat(value, "'!"));
85
+ }
86
+ },
87
+ enumerable: false,
88
+ configurable: true
89
+ });
90
+ Object.defineProperty(AcTrScene.prototype, "activeLayoutBtrId", {
91
+ /**
92
+ * The block table record id associated with the current active layout
93
+ */
94
+ get: function () {
95
+ return this._activeLayoutBtrId;
96
+ },
97
+ set: function (value) {
98
+ this._activeLayoutBtrId = value;
99
+ this._layouts.forEach(function (layout, key) {
100
+ layout.visible = value == key;
101
+ });
102
+ },
103
+ enumerable: false,
104
+ configurable: true
105
+ });
106
+ Object.defineProperty(AcTrScene.prototype, "activeLayout", {
107
+ /**
108
+ * Get active layout
109
+ */
110
+ get: function () {
111
+ if (this._activeLayoutBtrId && this._layouts.has(this._activeLayoutBtrId)) {
112
+ return this._layouts.get(this._activeLayoutBtrId);
113
+ }
114
+ return undefined;
115
+ },
116
+ enumerable: false,
117
+ configurable: true
118
+ });
119
+ Object.defineProperty(AcTrScene.prototype, "modelSpaceLayout", {
120
+ /**
121
+ * Get the layout of the model space
122
+ */
123
+ get: function () {
124
+ if (this._modelSpaceBtrId && this._layouts.has(this._modelSpaceBtrId)) {
125
+ return this._layouts.get(this._modelSpaceBtrId);
126
+ }
127
+ return undefined;
128
+ },
129
+ enumerable: false,
130
+ configurable: true
131
+ });
132
+ Object.defineProperty(AcTrScene.prototype, "stats", {
133
+ /**
134
+ * The statistics of this scene
135
+ */
136
+ get: function () {
137
+ var layouts = [];
138
+ this._layouts.forEach(function (layout) { return layouts.push(layout.stats); });
139
+ return {
140
+ layouts: layouts
141
+ };
142
+ },
143
+ enumerable: false,
144
+ configurable: true
145
+ });
146
+ /**
147
+ * Add one empty layout with the specified block table record id as the its key
148
+ * @param ownerId Input the block table record id associated with this layout
149
+ * @returns Return the newly created empty layout
150
+ */
151
+ AcTrScene.prototype.addEmptyLayout = function (ownerId) {
152
+ var layout = new AcTrLayout();
153
+ this._layouts.set(ownerId, layout);
154
+ this._scene.add(layout.internalObject);
155
+ layout.visible = ownerId == this._activeLayoutBtrId;
156
+ return layout;
157
+ };
158
+ /**
159
+ * Clear scene
160
+ * @returns Return this scene
161
+ */
162
+ AcTrScene.prototype.clear = function () {
163
+ var _this = this;
164
+ this._layouts.forEach(function (layout) {
165
+ _this._scene.remove(layout.internalObject);
166
+ layout.clear();
167
+ });
168
+ this._layouts.clear();
169
+ this._scene.clear();
170
+ return this;
171
+ };
172
+ /**
173
+ * Set layer's visibility
174
+ * @param layerName Input layer name
175
+ * @param visible Input visibility of the layer
176
+ */
177
+ AcTrScene.prototype.setLayerVisibility = function (layerName, visible) {
178
+ var _a;
179
+ var isDirty = false;
180
+ (_a = this.activeLayout) === null || _a === void 0 ? void 0 : _a.layers.forEach(function (layer) {
181
+ if (layer.name === layerName) {
182
+ layer.visible = visible;
183
+ isDirty = true;
184
+ }
185
+ });
186
+ return isDirty;
187
+ };
188
+ /**
189
+ * Hover the specified entities
190
+ */
191
+ AcTrScene.prototype.hover = function (ids) {
192
+ var activeLayout = this.activeLayout;
193
+ if (activeLayout) {
194
+ this.activeLayout.hover(ids);
195
+ return true;
196
+ }
197
+ return false;
198
+ };
199
+ /**
200
+ * Unhover the specified entities
201
+ */
202
+ AcTrScene.prototype.unhover = function (ids) {
203
+ var activeLayout = this.activeLayout;
204
+ if (activeLayout) {
205
+ this.activeLayout.unhover(ids);
206
+ return true;
207
+ }
208
+ return false;
209
+ };
210
+ /**
211
+ * Select the specified entities
212
+ */
213
+ AcTrScene.prototype.select = function (ids) {
214
+ var activeLayout = this.activeLayout;
215
+ if (activeLayout) {
216
+ this.activeLayout.select(ids);
217
+ return true;
218
+ }
219
+ return false;
220
+ };
221
+ /**
222
+ * Unselect the specified entities
223
+ */
224
+ AcTrScene.prototype.unselect = function (ids) {
225
+ var activeLayout = this.activeLayout;
226
+ if (activeLayout) {
227
+ this.activeLayout.unselect(ids);
228
+ return true;
229
+ }
230
+ return false;
231
+ };
232
+ /**
233
+ * Search entities intersected or contained in the specified bounding box.
234
+ * @param box Input the query bounding box
235
+ * @returns Return query results
236
+ */
237
+ AcTrScene.prototype.search = function (box) {
238
+ var activeLayout = this.activeLayout;
239
+ return activeLayout ? activeLayout === null || activeLayout === void 0 ? void 0 : activeLayout.search(box) : [];
240
+ };
241
+ /**
242
+ * Add one AutoCAD entity into this scene. If the layout associated with this entity doesn't exist,
243
+ * then create one layout, add this layout into this scene, and add the entity into the layout.
244
+ * @param entity Input AutoCAD entity to be added into scene.
245
+ * @param extendBbox Input the flag whether to extend the bounding box of this scene by union the bounding box
246
+ * of the specified entity.
247
+ * @returns Return this scene
248
+ */
249
+ AcTrScene.prototype.addEntity = function (entity, extendBbox) {
250
+ if (extendBbox === void 0) { extendBbox = true; }
251
+ var ownerId = entity.ownerId;
252
+ if (ownerId) {
253
+ var layout = this._layouts.get(ownerId);
254
+ if (!layout) {
255
+ layout = this.addEmptyLayout(ownerId);
256
+ }
257
+ layout.addEntity(entity, extendBbox);
258
+ }
259
+ else {
260
+ console.warn('[AcTrSecene] The owner id of one entity cannot be empty!');
261
+ }
262
+ return this;
263
+ };
264
+ /**
265
+ * Remove the specified entity from this scene.
266
+ * @param objectId Input the object id of the entity to remove
267
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
268
+ */
269
+ AcTrScene.prototype.remove = function (objectId) {
270
+ var e_1, _a;
271
+ try {
272
+ for (var _b = __values(this._layouts), _c = _b.next(); !_c.done; _c = _b.next()) {
273
+ var _d = __read(_c.value, 2), _1 = _d[0], layout = _d[1];
274
+ if (layout.remove(objectId))
275
+ return true;
276
+ }
277
+ }
278
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
279
+ finally {
280
+ try {
281
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
282
+ }
283
+ finally { if (e_1) throw e_1.error; }
284
+ }
285
+ return false;
286
+ };
287
+ /**
288
+ * Update the specified entity in this scene.
289
+ * @param objectId Input the entity to update
290
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
291
+ */
292
+ AcTrScene.prototype.update = function (entity) {
293
+ var e_2, _a;
294
+ try {
295
+ for (var _b = __values(this._layouts), _c = _b.next(); !_c.done; _c = _b.next()) {
296
+ var _d = __read(_c.value, 2), _2 = _d[0], layout = _d[1];
297
+ if (layout.update(entity))
298
+ return true;
299
+ }
300
+ }
301
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
302
+ finally {
303
+ try {
304
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
305
+ }
306
+ finally { if (e_2) throw e_2.error; }
307
+ }
308
+ return false;
309
+ };
310
+ AcTrScene.prototype.setSnapObject = function (object) {
311
+ this._layouts.forEach(function (layout) {
312
+ layout.setSnapObject(object);
313
+ });
314
+ return this;
315
+ };
316
+ return AcTrScene;
317
+ }());
318
+ export { AcTrScene };
319
+ //# sourceMappingURL=AcTrScene.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrScene.js","sourceRoot":"","sources":["../../src/view/AcTrScene.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAA;AAE1D;;;;;GAKG;AACH;IAME;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAA;QACzB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAC5B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAA;IAC5B,CAAC;IAKD,sBAAI,8BAAO;QAHX;;W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,CAAC;;;;;;;;;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;OAIG;IACH,0BAAM,GAAN,UAAO,MAAkB;;;YACvB,KAA0B,IAAA,KAAA,SAAA,IAAI,CAAC,QAAQ,CAAA,gBAAA,4BAAE,CAAC;gBAA/B,IAAA,KAAA,mBAAW,EAAV,EAAC,QAAA,EAAE,MAAM,QAAA;gBACnB,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAA;YACxC,CAAC;;;;;;;;;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,iCAAa,GAAb,UAAc,MAAkB;QAC9B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,MAAM;YAC1B,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IACH,gBAAC;AAAD,CAAC,AAvPD,IAuPC"}
@@ -0,0 +1,160 @@
1
+ import { AcDbEntity, AcDbObjectId, AcGeBox2d, AcGeBox3d, AcGePoint2d, AcGePoint2dLike } from '@mlightcad/data-model';
2
+ import { AcTrEntity, AcTrRenderer } from '@mlightcad/three-renderer';
3
+ import { AcEdBaseView, AcEdCalculateSizeCallback, AcEdViewMode } from '../editor';
4
+ import { AcTrLayoutView } from './AcTrLayoutView';
5
+ import { AcTrScene } from './AcTrScene';
6
+ /**
7
+ * Options to customize view
8
+ */
9
+ export interface AcTrView2dOptions {
10
+ /**
11
+ * Canvas HTML element used by renderer
12
+ */
13
+ canvas?: HTMLCanvasElement;
14
+ /**
15
+ * Callback function used to calculate size of canvas when window resized
16
+ */
17
+ calculateSizeCallback?: AcEdCalculateSizeCallback;
18
+ /**
19
+ * Background color
20
+ */
21
+ background?: number;
22
+ }
23
+ /**
24
+ * Default view option values
25
+ */
26
+ export declare const DEFAULT_VIEW_2D_OPTIONS: AcTrView2dOptions;
27
+ export declare class AcTrView2d extends AcEdBaseView {
28
+ private _renderer;
29
+ private _layoutViewManager;
30
+ private _scene;
31
+ private _isDirty;
32
+ private _stats;
33
+ private _missedImages;
34
+ constructor(options?: AcTrView2dOptions);
35
+ initialize(): void;
36
+ /**
37
+ * @inheritdoc
38
+ */
39
+ get mode(): AcEdViewMode;
40
+ set mode(value: AcEdViewMode);
41
+ get renderer(): AcTrRenderer;
42
+ get isDirty(): boolean;
43
+ set isDirty(value: boolean);
44
+ get missedData(): {
45
+ fonts: Record<string, number>;
46
+ images: Map<string, string>;
47
+ };
48
+ get center(): AcGePoint2d;
49
+ set center(value: AcGePoint2d);
50
+ /**
51
+ * The block table record id of the model space
52
+ */
53
+ get modelSpaceBtrId(): AcDbObjectId;
54
+ set modelSpaceBtrId(value: AcDbObjectId);
55
+ /**
56
+ * The block table record id associated with the active layout
57
+ */
58
+ get activeLayoutBtrId(): string;
59
+ set activeLayoutBtrId(value: string);
60
+ /**
61
+ * The active layout view
62
+ */
63
+ get activeLayoutView(): AcTrLayoutView;
64
+ /**
65
+ * The statistics of the current scene
66
+ */
67
+ get stats(): {
68
+ layouts: import("./AcTrLayout").AcTrLayoutStats[];
69
+ };
70
+ animate(): void;
71
+ /**
72
+ * @inheritdoc
73
+ */
74
+ cwcs2Wcs(point: AcGePoint2dLike): AcGePoint2d;
75
+ /**
76
+ * @inheritdoc
77
+ */
78
+ wcs2Cwcs(point: AcGePoint2dLike): AcGePoint2d;
79
+ /**
80
+ * @inheritdoc
81
+ */
82
+ zoomTo(box: AcGeBox2d, margin?: number): void;
83
+ /**
84
+ * Re-render points with latest point style settings
85
+ * @param displayMode Input display mode of points
86
+ */
87
+ rerenderPoints(displayMode: number): void;
88
+ /**
89
+ * @inheritdoc
90
+ */
91
+ zoomToFit(): void;
92
+ /**
93
+ * @inheritdoc
94
+ */
95
+ pick(point?: AcGePoint2dLike): string[];
96
+ /**
97
+ * @inheritdoc
98
+ */
99
+ search(box: AcGeBox2d | AcGeBox3d): import("../editor").AcEdSpatialQueryResultItem[];
100
+ /**
101
+ * @inheritdoc
102
+ */
103
+ select(point?: AcGePoint2dLike): void;
104
+ /**
105
+ * @inheritdoc
106
+ */
107
+ selectByBox(box: AcGeBox2d): void;
108
+ /**
109
+ * @inheritdoc
110
+ */
111
+ addEntity(entity: AcDbEntity): void;
112
+ /**
113
+ * Remove the specified entity from this view.
114
+ * @param objectId Input the object id of the entity to remove
115
+ */
116
+ removeEntity(objectId: AcDbObjectId): void;
117
+ /**
118
+ * @inheritdoc
119
+ */
120
+ updateEntity(entity: AcDbEntity): AcTrEntity;
121
+ /**
122
+ * @inheritdoc
123
+ */
124
+ clear(): void;
125
+ /**
126
+ * @inheritdoc
127
+ */
128
+ highlight(ids: AcDbObjectId[]): void;
129
+ /**
130
+ * @inheritdoc
131
+ */
132
+ unhighlight(ids: AcDbObjectId[]): void;
133
+ /**
134
+ * @inheritdoc
135
+ */
136
+ setLayerVisibility(layerName: string, visible: boolean): void;
137
+ /**
138
+ * @inheritdoc
139
+ */
140
+ protected onHover(id: AcDbObjectId): void;
141
+ /**
142
+ * @inheritdoc
143
+ */
144
+ protected onUnhover(id: AcDbObjectId): void;
145
+ protected createScene(): AcTrScene;
146
+ private createStats;
147
+ protected onWindowResize(): void;
148
+ /**
149
+ * Create the layout view with the specified block table record id.
150
+ * @param layoutBtrId Input the block table record id associated with the layout view.
151
+ */
152
+ private createLayoutViewIfNeeded;
153
+ /**
154
+ * Show or hide stats component
155
+ * @param show If it is true, show stats component. Otherwise, hide stats component.
156
+ * Default value is false.
157
+ */
158
+ private toggleStatsVisibility;
159
+ }
160
+ //# sourceMappingURL=AcTrView2d.d.ts.map