@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,97 @@
1
+ import { AcDbObjectId } from '@mlightcad/data-model';
2
+ import { AcTrBatchedGroup, AcTrBatchedGroupStats, AcTrEntity } from '@mlightcad/three-renderer';
3
+ import * as THREE from 'three';
4
+ export type AcTrLayerStats = AcTrBatchedGroupStats & {
5
+ name: string;
6
+ };
7
+ /**
8
+ * The class is used to render layer in AutoCAD.
9
+ *
10
+ * Notes:
11
+ * Layers provided by THREE.js aren't used to control visibility of entities because it supports 32 layers only.
12
+ * Instead groups are used to represent layers in AutoCAD. One AutoCAD layer is represented by one group in
13
+ * THREE.js.
14
+ */
15
+ export declare class AcTrLayer {
16
+ /**
17
+ * Layer name
18
+ */
19
+ private _name;
20
+ /**
21
+ * This group contains all entities in this layer
22
+ */
23
+ private _group;
24
+ /**
25
+ * Construct one instance of this class
26
+ * @param name Input layer name
27
+ */
28
+ constructor(name: string);
29
+ /**
30
+ * Layer name
31
+ */
32
+ get name(): string;
33
+ set name(value: string);
34
+ get visible(): boolean;
35
+ set visible(value: boolean);
36
+ get internalObject(): AcTrBatchedGroup;
37
+ /**
38
+ * The statistics of this layer
39
+ */
40
+ get stats(): AcTrLayerStats;
41
+ /**
42
+ * The number of entities stored in this layer
43
+ */
44
+ get entityCount(): number;
45
+ /**
46
+ * Re-render points with latest point style settings
47
+ * @param displayMode Input display mode of points
48
+ */
49
+ rerenderPoints(displayMode: number): void;
50
+ /**
51
+ * Return true if this layer contains the entity with the specified object id. Otherwise, return false.
52
+ * @param objectId Input the object id of one entity
53
+ * @returns Return true if this layer contains the entity with the specified object id. Otherwise,
54
+ * return false.
55
+ */
56
+ hasEntity(objectId: AcDbObjectId): boolean;
57
+ /**
58
+ * Add one AutoCAD entity into this layer.
59
+ * @param entity Input AutoCAD entity to be added into this layer.
60
+ */
61
+ addEntity(entity: AcTrEntity): void;
62
+ /**
63
+ * Return true if the object with the specified object id is intersected with the ray by using raycast.
64
+ * @param objectId Input object id of object to check for intersection with the ray.
65
+ * @param raycaster Input raycaster to check intersection
66
+ */
67
+ isIntersectWith(objectId: string, raycaster: THREE.Raycaster): boolean;
68
+ /**
69
+ * Remove the specified entity from this layer.
70
+ * @param objectId Input the object id of the entity to remove
71
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
72
+ */
73
+ remove(_objectId: AcDbObjectId): boolean;
74
+ /**
75
+ * Update the specified entity in this layer.
76
+ * @param entity Input the entity to update
77
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
78
+ */
79
+ update(entity: AcTrEntity): boolean;
80
+ /**
81
+ * Hover the specified entities
82
+ */
83
+ hover(ids: AcDbObjectId[]): void;
84
+ /**
85
+ * Unhover the specified entities
86
+ */
87
+ unhover(ids: AcDbObjectId[]): void;
88
+ /**
89
+ * Select the specified entities
90
+ */
91
+ select(ids: AcDbObjectId[]): void;
92
+ /**
93
+ * Unselect the specified entities
94
+ */
95
+ unselect(ids: AcDbObjectId[]): void;
96
+ }
97
+ //# sourceMappingURL=AcTrLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayer.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACX,MAAM,2BAA2B,CAAA;AAClC,OAAO,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|| function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { AcTrBatchedGroup } from '@mlightcad/three-renderer';
13
+ /**
14
+ * The class is used to render layer in AutoCAD.
15
+ *
16
+ * Notes:
17
+ * Layers provided by THREE.js aren't used to control visibility of entities because it supports 32 layers only.
18
+ * Instead groups are used to represent layers in AutoCAD. One AutoCAD layer is represented by one group in
19
+ * THREE.js.
20
+ */
21
+ var AcTrLayer = /** @class */ (function () {
22
+ /**
23
+ * Construct one instance of this class
24
+ * @param name Input layer name
25
+ */
26
+ function AcTrLayer(name) {
27
+ this._group = new AcTrBatchedGroup();
28
+ this._name = name;
29
+ }
30
+ Object.defineProperty(AcTrLayer.prototype, "name", {
31
+ /**
32
+ * Layer name
33
+ */
34
+ get: function () {
35
+ return this._name;
36
+ },
37
+ set: function (value) {
38
+ this._name = value;
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ Object.defineProperty(AcTrLayer.prototype, "visible", {
44
+ get: function () {
45
+ return this._group.visible;
46
+ },
47
+ set: function (value) {
48
+ this._group.visible = value;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ Object.defineProperty(AcTrLayer.prototype, "internalObject", {
54
+ get: function () {
55
+ return this._group;
56
+ },
57
+ enumerable: false,
58
+ configurable: true
59
+ });
60
+ Object.defineProperty(AcTrLayer.prototype, "stats", {
61
+ /**
62
+ * The statistics of this layer
63
+ */
64
+ get: function () {
65
+ var batchedGroupStats = this._group.stats;
66
+ return __assign({ name: this._name }, batchedGroupStats);
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ Object.defineProperty(AcTrLayer.prototype, "entityCount", {
72
+ /**
73
+ * The number of entities stored in this layer
74
+ */
75
+ get: function () {
76
+ return this._group.entityCount;
77
+ },
78
+ enumerable: false,
79
+ configurable: true
80
+ });
81
+ /**
82
+ * Re-render points with latest point style settings
83
+ * @param displayMode Input display mode of points
84
+ */
85
+ AcTrLayer.prototype.rerenderPoints = function (displayMode) {
86
+ this._group.rerenderPoints(displayMode);
87
+ };
88
+ /**
89
+ * Return true if this layer contains the entity with the specified object id. Otherwise, return false.
90
+ * @param objectId Input the object id of one entity
91
+ * @returns Return true if this layer contains the entity with the specified object id. Otherwise,
92
+ * return false.
93
+ */
94
+ AcTrLayer.prototype.hasEntity = function (objectId) {
95
+ return this._group.hasEntity(objectId);
96
+ };
97
+ /**
98
+ * Add one AutoCAD entity into this layer.
99
+ * @param entity Input AutoCAD entity to be added into this layer.
100
+ */
101
+ AcTrLayer.prototype.addEntity = function (entity) {
102
+ this._group.addEntity(entity);
103
+ };
104
+ /**
105
+ * Return true if the object with the specified object id is intersected with the ray by using raycast.
106
+ * @param objectId Input object id of object to check for intersection with the ray.
107
+ * @param raycaster Input raycaster to check intersection
108
+ */
109
+ AcTrLayer.prototype.isIntersectWith = function (objectId, raycaster) {
110
+ return this._group.isIntersectWith(objectId, raycaster);
111
+ };
112
+ /**
113
+ * Remove the specified entity from this layer.
114
+ * @param objectId Input the object id of the entity to remove
115
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
116
+ */
117
+ AcTrLayer.prototype.remove = function (_objectId) {
118
+ // TODO: Finish it
119
+ throw new Error('Not implemented yet!');
120
+ };
121
+ /**
122
+ * Update the specified entity in this layer.
123
+ * @param entity Input the entity to update
124
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
125
+ */
126
+ AcTrLayer.prototype.update = function (entity) {
127
+ // TODO: Finish it
128
+ this._group.add(entity);
129
+ return true;
130
+ };
131
+ /**
132
+ * Hover the specified entities
133
+ */
134
+ AcTrLayer.prototype.hover = function (ids) {
135
+ var _this = this;
136
+ ids.forEach(function (id) {
137
+ _this._group.hover(id);
138
+ });
139
+ };
140
+ /**
141
+ * Unhover the specified entities
142
+ */
143
+ AcTrLayer.prototype.unhover = function (ids) {
144
+ var _this = this;
145
+ ids.forEach(function (id) {
146
+ _this._group.unhover(id);
147
+ });
148
+ };
149
+ /**
150
+ * Select the specified entities
151
+ */
152
+ AcTrLayer.prototype.select = function (ids) {
153
+ var _this = this;
154
+ ids.forEach(function (id) {
155
+ _this._group.select(id);
156
+ });
157
+ };
158
+ /**
159
+ * Unselect the specified entities
160
+ */
161
+ AcTrLayer.prototype.unselect = function (ids) {
162
+ var _this = this;
163
+ ids.forEach(function (id) {
164
+ _this._group.unselect(id);
165
+ });
166
+ };
167
+ return AcTrLayer;
168
+ }());
169
+ export { AcTrLayer };
170
+ //# sourceMappingURL=AcTrLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayer.js","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EACL,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;AAOlC;;;;;;;GAOG;AACH;IAUE;;;OAGG;IACH,mBAAY,IAAY;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAA;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAKD,sBAAI,2BAAI;QAHR;;WAEG;aACH;YACE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;aACD,UAAS,KAAa;YACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,CAAC;;;OAHA;IAKD,sBAAI,8BAAO;aAAX;YACE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAA;QAC5B,CAAC;aACD,UAAY,KAAc;YACxB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA;QAC7B,CAAC;;;OAHA;IAKD,sBAAI,qCAAc;aAAlB;YACE,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;;;OAAA;IAKD,sBAAI,4BAAK;QAHT;;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CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,2BAAO,GAAP,UAAQ,GAAmB;QAA3B,iBAIC;QAHC,GAAG,CAAC,OAAO,CAAC,UAAA,EAAE;YACZ,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,0BAAM,GAAN,UAAO,GAAmB;QAA1B,iBAIC;QAHC,GAAG,CAAC,OAAO,CAAC,UAAA,EAAE;YACZ,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACxB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,4BAAQ,GAAR,UAAS,GAAmB;QAA5B,iBAIC;QAHC,GAAG,CAAC,OAAO,CAAC,UAAA,EAAE;YACZ,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,gBAAC;AAAD,CAAC,AArJD,IAqJC"}
@@ -0,0 +1,114 @@
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 { AcEdSpatialQueryResultItem } from '../editor';
5
+ import { AcTrLayer, AcTrLayerStats } from './AcTrLayer';
6
+ export interface AcTrLayoutStats {
7
+ layers: AcTrLayerStats[];
8
+ summary: {
9
+ entityCount: number;
10
+ totalSize: {
11
+ line: number;
12
+ mesh: number;
13
+ point: number;
14
+ geometry: number;
15
+ mapping: number;
16
+ };
17
+ };
18
+ }
19
+ /**
20
+ * This class represents objects contained in one AuotCAD layout (model space or paper space).
21
+ */
22
+ export declare class AcTrLayout {
23
+ private _group;
24
+ private _indexTree;
25
+ private _box;
26
+ private _layers;
27
+ private _snapPointsObject?;
28
+ constructor();
29
+ /**
30
+ * The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
31
+ * @internal
32
+ */
33
+ get internalObject(): THREE.Group<THREE.Object3DEventMap>;
34
+ get layers(): Map<string, AcTrLayer>;
35
+ get box(): THREE.Box3;
36
+ /**
37
+ * The visibility of this layout
38
+ */
39
+ get visible(): boolean;
40
+ set visible(value: boolean);
41
+ /**
42
+ * The number of entities stored in this layer
43
+ */
44
+ get entityCount(): number;
45
+ /**
46
+ * The statistics of this layout
47
+ */
48
+ get stats(): AcTrLayoutStats;
49
+ clear(): this;
50
+ /**
51
+ * Re-render points with latest point style settings
52
+ * @param displayMode Input display mode of points
53
+ */
54
+ rerenderPoints(displayMode: number): void;
55
+ /**
56
+ * Return true if the object with the specified object id is intersected with the ray by using raycast.
57
+ * @param objectId Input object id of object to check for intersection with the ray.
58
+ * @param raycaster Input raycaster to check intersection
59
+ */
60
+ isIntersectWith(objectId: string, raycaster: THREE.Raycaster): boolean | undefined;
61
+ /**
62
+ * Add one AutoCAD entity into this layout. If layer group referenced by the entity doesn't exist, create one
63
+ * layer group and add this entity this group.
64
+ * @param entity Input AutoCAD entity to be added into this layout.
65
+ * @param extendBbox Input the flag whether to extend the bounding box of the scene by union the bounding box
66
+ * of the specified entity.
67
+ */
68
+ addEntity(entity: AcTrEntity, extendBbox?: boolean): this;
69
+ /**
70
+ * Remove the specified entity from this layout.
71
+ * @param objectId Input the object id of the entity to remove
72
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
73
+ */
74
+ remove(objectId: AcDbObjectId): boolean;
75
+ /**
76
+ * Update the specified entity in this layout.
77
+ * @param objectId Input the entity to update
78
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
79
+ */
80
+ update(entity: AcTrEntity): boolean;
81
+ /**
82
+ * Hover the specified entities
83
+ */
84
+ hover(ids: AcDbObjectId[]): void;
85
+ /**
86
+ * Unhover the specified entities
87
+ */
88
+ unhover(ids: AcDbObjectId[]): void;
89
+ /**
90
+ * Select the specified entities
91
+ */
92
+ select(ids: AcDbObjectId[]): void;
93
+ /**
94
+ * Unselect the specified entities
95
+ */
96
+ unselect(ids: AcDbObjectId[]): void;
97
+ setSnapObject(object: AcTrObject): void;
98
+ /**
99
+ * Search entities intersected or contained in the specified bounding box.
100
+ * @param box Input the query bounding box
101
+ * @returns Return query results
102
+ */
103
+ search(box: AcGeBox2d | AcGeBox3d): AcEdSpatialQueryResultItem[];
104
+ private getLayerByObjectId;
105
+ /**
106
+ * Get layer group by name. If the layer doesn't exist, create one layer group into this layout.
107
+ * @param name Input layer name
108
+ * @param createIfNotExist Input one flag to indicate whether to create layer group if it doesn't exist in
109
+ * this layout.
110
+ * @returns Return matched layer
111
+ */
112
+ private getLayer;
113
+ }
114
+ //# sourceMappingURL=AcTrLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayout.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayout.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;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEvD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAA;QACnB,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,KAAK,EAAE,MAAM,CAAA;YACb,QAAQ,EAAE,MAAM,CAAA;YAChB,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;KACF,CAAA;CACF;AAED;;GAEG;AACH,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,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