@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,344 @@
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 RBush from 'rbush';
29
+ import * as THREE from 'three';
30
+ import { AcTrLayer } from './AcTrLayer';
31
+ /**
32
+ * This class represents objects contained in one AuotCAD layout (model space or paper space).
33
+ */
34
+ var AcTrLayout = /** @class */ (function () {
35
+ function AcTrLayout() {
36
+ this._group = new THREE.Group();
37
+ this._indexTree = new RBush();
38
+ this._box = new THREE.Box3();
39
+ this._layers = new Map();
40
+ }
41
+ Object.defineProperty(AcTrLayout.prototype, "internalObject", {
42
+ /**
43
+ * The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
44
+ * @internal
45
+ */
46
+ get: function () {
47
+ return this._group;
48
+ },
49
+ enumerable: false,
50
+ configurable: true
51
+ });
52
+ Object.defineProperty(AcTrLayout.prototype, "layers", {
53
+ get: function () {
54
+ return this._layers;
55
+ },
56
+ enumerable: false,
57
+ configurable: true
58
+ });
59
+ Object.defineProperty(AcTrLayout.prototype, "box", {
60
+ get: function () {
61
+ return this._box;
62
+ },
63
+ enumerable: false,
64
+ configurable: true
65
+ });
66
+ Object.defineProperty(AcTrLayout.prototype, "visible", {
67
+ /**
68
+ * The visibility of this layout
69
+ */
70
+ get: function () {
71
+ return this._group.visible;
72
+ },
73
+ set: function (value) {
74
+ this._group.visible = value;
75
+ },
76
+ enumerable: false,
77
+ configurable: true
78
+ });
79
+ Object.defineProperty(AcTrLayout.prototype, "entityCount", {
80
+ /**
81
+ * The number of entities stored in this layer
82
+ */
83
+ get: function () {
84
+ var count = 0;
85
+ this._layers.forEach(function (layer) { return (count += layer.entityCount); });
86
+ return count;
87
+ },
88
+ enumerable: false,
89
+ configurable: true
90
+ });
91
+ Object.defineProperty(AcTrLayout.prototype, "stats", {
92
+ /**
93
+ * The statistics of this layout
94
+ */
95
+ get: function () {
96
+ var layers = [];
97
+ var totalGeometrySize = 0;
98
+ var totalMappingSize = 0;
99
+ var lineTotalSize = 0;
100
+ var meshTotalSize = 0;
101
+ var pointTotalSize = 0;
102
+ this._layers.forEach(function (layer) {
103
+ var stats = layer.stats;
104
+ layers.push(stats);
105
+ lineTotalSize +=
106
+ stats.line.indexed.geometrySize + stats.line.nonIndexed.geometrySize;
107
+ meshTotalSize +=
108
+ stats.mesh.indexed.geometrySize + stats.mesh.nonIndexed.geometrySize;
109
+ pointTotalSize +=
110
+ stats.point.indexed.geometrySize + stats.point.nonIndexed.geometrySize;
111
+ totalGeometrySize += stats.summary.totalGeometrySize;
112
+ totalMappingSize += stats.summary.totalMappingSize;
113
+ });
114
+ return {
115
+ layers: layers,
116
+ summary: {
117
+ entityCount: this.entityCount,
118
+ totalSize: {
119
+ line: lineTotalSize,
120
+ mesh: meshTotalSize,
121
+ point: pointTotalSize,
122
+ geometry: totalGeometrySize,
123
+ mapping: totalMappingSize
124
+ }
125
+ }
126
+ };
127
+ },
128
+ enumerable: false,
129
+ configurable: true
130
+ });
131
+ AcTrLayout.prototype.clear = function () {
132
+ var _this = this;
133
+ this._layers.forEach(function (layer) {
134
+ _this._group.remove(layer.internalObject);
135
+ });
136
+ this._layers.clear();
137
+ this._box.makeEmpty();
138
+ this._indexTree.clear();
139
+ return this;
140
+ };
141
+ /**
142
+ * Re-render points with latest point style settings
143
+ * @param displayMode Input display mode of points
144
+ */
145
+ AcTrLayout.prototype.rerenderPoints = function (displayMode) {
146
+ this._layers.forEach(function (layer) {
147
+ layer.rerenderPoints(displayMode);
148
+ });
149
+ };
150
+ /**
151
+ * Return true if the object with the specified object id is intersected with the ray by using raycast.
152
+ * @param objectId Input object id of object to check for intersection with the ray.
153
+ * @param raycaster Input raycaster to check intersection
154
+ */
155
+ AcTrLayout.prototype.isIntersectWith = function (objectId, raycaster) {
156
+ var layer = this.getLayerByObjectId(objectId);
157
+ return layer && layer.isIntersectWith(objectId, raycaster);
158
+ };
159
+ /**
160
+ * Add one AutoCAD entity into this layout. If layer group referenced by the entity doesn't exist, create one
161
+ * layer group and add this entity this group.
162
+ * @param entity Input AutoCAD entity to be added into this layout.
163
+ * @param extendBbox Input the flag whether to extend the bounding box of the scene by union the bounding box
164
+ * of the specified entity.
165
+ */
166
+ AcTrLayout.prototype.addEntity = function (entity, extendBbox) {
167
+ if (extendBbox === void 0) { extendBbox = true; }
168
+ if (!entity.objectId) {
169
+ throw new Error('[AcTrEntity] Object id is required to add one entity!');
170
+ }
171
+ if (!entity.layerName) {
172
+ throw new Error('[AcTrEntity] Layer name is required to add one entity!');
173
+ }
174
+ var layer = this.getLayer(entity.layerName, true);
175
+ if (layer) {
176
+ layer.addEntity(entity);
177
+ var box = entity.box;
178
+ // For infinitive line such as ray and xline
179
+ if (extendBbox)
180
+ this._box.union(box);
181
+ this._indexTree.insert({
182
+ minX: box.min.x,
183
+ minY: box.min.y,
184
+ maxX: box.max.x,
185
+ maxY: box.max.y,
186
+ id: entity.objectId
187
+ });
188
+ }
189
+ return this;
190
+ };
191
+ /**
192
+ * Remove the specified entity from this layout.
193
+ * @param objectId Input the object id of the entity to remove
194
+ * @returns Return true if remove the specified entity successfully. Otherwise, return false.
195
+ */
196
+ AcTrLayout.prototype.remove = function (objectId) {
197
+ var e_1, _a;
198
+ try {
199
+ for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
200
+ var _d = __read(_c.value, 2), _1 = _d[0], layer = _d[1];
201
+ if (layer.remove(objectId))
202
+ return true;
203
+ }
204
+ }
205
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
206
+ finally {
207
+ try {
208
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
209
+ }
210
+ finally { if (e_1) throw e_1.error; }
211
+ }
212
+ return false;
213
+ };
214
+ /**
215
+ * Update the specified entity in this layout.
216
+ * @param objectId Input the entity to update
217
+ * @returns Return true if update the specified entity successfully. Otherwise, return false.
218
+ */
219
+ AcTrLayout.prototype.update = function (entity) {
220
+ var e_2, _a;
221
+ try {
222
+ for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
223
+ var _d = __read(_c.value, 2), _2 = _d[0], layer = _d[1];
224
+ if (layer.update(entity))
225
+ return true;
226
+ }
227
+ }
228
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
229
+ finally {
230
+ try {
231
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
232
+ }
233
+ finally { if (e_2) throw e_2.error; }
234
+ }
235
+ return false;
236
+ };
237
+ /**
238
+ * Hover the specified entities
239
+ */
240
+ AcTrLayout.prototype.hover = function (ids) {
241
+ var _this = this;
242
+ ids.forEach(function (id) {
243
+ var layer = _this.getLayerByObjectId(id);
244
+ if (layer) {
245
+ layer.hover([id]);
246
+ }
247
+ });
248
+ };
249
+ /**
250
+ * Unhover the specified entities
251
+ */
252
+ AcTrLayout.prototype.unhover = function (ids) {
253
+ var _this = this;
254
+ ids.forEach(function (id) {
255
+ var layer = _this.getLayerByObjectId(id);
256
+ if (layer) {
257
+ layer.unhover([id]);
258
+ }
259
+ });
260
+ };
261
+ /**
262
+ * Select the specified entities
263
+ */
264
+ AcTrLayout.prototype.select = function (ids) {
265
+ var _this = this;
266
+ ids.forEach(function (id) {
267
+ var layer = _this.getLayerByObjectId(id);
268
+ if (layer) {
269
+ layer.select([id]);
270
+ }
271
+ });
272
+ };
273
+ /**
274
+ * Unselect the specified entities
275
+ */
276
+ AcTrLayout.prototype.unselect = function (ids) {
277
+ var _this = this;
278
+ ids.forEach(function (id) {
279
+ var layer = _this.getLayerByObjectId(id);
280
+ if (layer) {
281
+ layer.unselect([id]);
282
+ }
283
+ });
284
+ };
285
+ AcTrLayout.prototype.setSnapObject = function (object) {
286
+ if (this._snapPointsObject) {
287
+ this._group.remove(this._snapPointsObject);
288
+ }
289
+ this._snapPointsObject = object;
290
+ this._group.add(object);
291
+ };
292
+ /**
293
+ * Search entities intersected or contained in the specified bounding box.
294
+ * @param box Input the query bounding box
295
+ * @returns Return query results
296
+ */
297
+ AcTrLayout.prototype.search = function (box) {
298
+ var results = this._indexTree.search({
299
+ minX: box.min.x,
300
+ minY: box.min.y,
301
+ maxX: box.max.x,
302
+ maxY: box.max.y
303
+ });
304
+ return results;
305
+ };
306
+ AcTrLayout.prototype.getLayerByObjectId = function (objectId) {
307
+ var e_3, _a;
308
+ try {
309
+ for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
310
+ var _d = __read(_c.value, 2), _3 = _d[0], layer = _d[1];
311
+ if (layer.hasEntity(objectId))
312
+ return layer;
313
+ }
314
+ }
315
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
316
+ finally {
317
+ try {
318
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
319
+ }
320
+ finally { if (e_3) throw e_3.error; }
321
+ }
322
+ return undefined;
323
+ };
324
+ /**
325
+ * Get layer group by name. If the layer doesn't exist, create one layer group into this layout.
326
+ * @param name Input layer name
327
+ * @param createIfNotExist Input one flag to indicate whether to create layer group if it doesn't exist in
328
+ * this layout.
329
+ * @returns Return matched layer
330
+ */
331
+ AcTrLayout.prototype.getLayer = function (name, createIfNotExist) {
332
+ if (createIfNotExist === void 0) { createIfNotExist = true; }
333
+ var layer = this._layers.get(name);
334
+ if (layer === undefined && createIfNotExist) {
335
+ layer = new AcTrLayer(name);
336
+ this._layers.set(name, layer);
337
+ this._group.add(layer.internalObject);
338
+ }
339
+ return layer;
340
+ };
341
+ return AcTrLayout;
342
+ }());
343
+ export { AcTrLayout };
344
+ //# sourceMappingURL=AcTrLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayout.js","sourceRoot":"","sources":["../../src/view/AcTrLayout.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,SAAS,EAAkB,MAAM,aAAa,CAAA;AAgBvD;;GAEG;AACH;IAQE;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,EAAE,CAAA;QAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1B,CAAC;IAMD,sBAAI,sCAAc;QAJlB;;;WAGG;aACH;YACE,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;;;OAAA;IAED,sBAAI,8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A,EAAE,KAAK,QAAA;gBAClB,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;oBAAE,OAAO,KAAK,CAAA;YAC7C,CAAC;;;;;;;;;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;;OAMG;IACK,6BAAQ,GAAhB,UAAiB,IAAY,EAAE,gBAAgC;QAAhC,iCAAA,EAAA,uBAAgC;QAC7D,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,KAAK,KAAK,SAAS,IAAI,gBAAgB,EAAE,CAAC;YAC5C,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;YAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACvC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IACH,iBAAC;AAAD,CAAC,AA7QD,IA6QC"}
@@ -0,0 +1,57 @@
1
+ import { AcTrBaseView, AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
2
+ import { AcEdViewMode } from '../editor/view/AcEdBaseView';
3
+ import { AcTrScene } from './AcTrScene';
4
+ export interface AcDbEntityEventArgs {
5
+ view: AcTrLayoutView;
6
+ }
7
+ /**
8
+ * Each layout has its own camera and camera control. This class represents view associated with one layout.
9
+ */
10
+ export declare class AcTrLayoutView extends AcTrBaseView {
11
+ private _layoutBtrId;
12
+ private _axesGizmo;
13
+ private _mode;
14
+ private _viewportViews;
15
+ /**
16
+ * Construct one instance of this class
17
+ * @param layoutBtrId Input the id of the block table record associated the layout
18
+ * @param renderer Input renderer
19
+ * @param width Input width of this view
20
+ * @param height Input height of this view
21
+ */
22
+ constructor(renderer: AcTrRenderer, layoutBtrId: string, width: number, height: number);
23
+ get layoutBtrId(): string;
24
+ /**
25
+ * The view mode of the current layout view
26
+ */
27
+ get mode(): AcEdViewMode;
28
+ set mode(value: AcEdViewMode);
29
+ /**
30
+ * The number of viewports in this layout view
31
+ */
32
+ get viewportCount(): number;
33
+ /**
34
+ * Add one viewport view instance to this layout view
35
+ * @param viewportView Input one viewport instance
36
+ */
37
+ addViewport(viewportView: AcTrViewportView): void;
38
+ /**
39
+ * Remove the specified viewport view by its id from this layout view
40
+ * @param id Input the id of one viewport instance
41
+ */
42
+ removeViewport(id: string): void;
43
+ /**
44
+ * Resize this layout view
45
+ * @param width Input new width of the layout view
46
+ * @param height Input new height of the layout view
47
+ */
48
+ resize(width: number, height: number): void;
49
+ render(scene: AcTrScene): void;
50
+ private createAxesGizmo;
51
+ /**
52
+ * Draw viewports
53
+ * @param scene Input the scene to draw
54
+ */
55
+ private drawViewports;
56
+ }
57
+ //# sourceMappingURL=AcTrLayoutView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayoutView.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayoutView.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,gBAAgB,EACjB,MAAM,2BAA2B,CAAA;AAIlC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAA;CACrB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,cAAc,CAA+B;IAErD;;;;;;OAMG;gBAED,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAShB,IAAI,WAAW,WAEd;IAED;;OAEG;IACH,IAAI,IAAI,IAGQ,YAAY,CAD3B;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,YAAY,EAY3B;IAED;;OAEG;IACH,IAAI,aAAa,WAEhB;IAED;;;OAGG;IACH,WAAW,CAAC,YAAY,EAAE,gBAAgB;IAI1C;;;OAGG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM;IAIzB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IASpC,MAAM,CAAC,KAAK,EAAE,SAAS;IAUvB,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,aAAa;CA4BtB"}
@@ -0,0 +1,151 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import { AcTrBaseView } from '@mlightcad/three-renderer';
17
+ import { AxesGizmo, ObjectPosition } from '@mlightcad/three-viewcube';
18
+ import * as THREE from 'three';
19
+ import { AcEdViewMode } from '../editor/view/AcEdBaseView';
20
+ /**
21
+ * Each layout has its own camera and camera control. This class represents view associated with one layout.
22
+ */
23
+ var AcTrLayoutView = /** @class */ (function (_super) {
24
+ __extends(AcTrLayoutView, _super);
25
+ /**
26
+ * Construct one instance of this class
27
+ * @param layoutBtrId Input the id of the block table record associated the layout
28
+ * @param renderer Input renderer
29
+ * @param width Input width of this view
30
+ * @param height Input height of this view
31
+ */
32
+ function AcTrLayoutView(renderer, layoutBtrId, width, height) {
33
+ var _this = _super.call(this, renderer, width, height) || this;
34
+ _this._layoutBtrId = layoutBtrId;
35
+ _this._mode = AcEdViewMode.SELECTION;
36
+ _this._axesGizmo = _this.createAxesGizmo();
37
+ _this._viewportViews = new Map();
38
+ return _this;
39
+ }
40
+ Object.defineProperty(AcTrLayoutView.prototype, "layoutBtrId", {
41
+ get: function () {
42
+ return this._layoutBtrId;
43
+ },
44
+ enumerable: false,
45
+ configurable: true
46
+ });
47
+ Object.defineProperty(AcTrLayoutView.prototype, "mode", {
48
+ /**
49
+ * The view mode of the current layout view
50
+ */
51
+ get: function () {
52
+ return this._mode;
53
+ },
54
+ set: function (value) {
55
+ if (value == AcEdViewMode.SELECTION) {
56
+ this._cameraControls.mouseButtons = {
57
+ MIDDLE: THREE.MOUSE.PAN
58
+ };
59
+ }
60
+ else if (value == AcEdViewMode.PAN) {
61
+ this._cameraControls.mouseButtons = {
62
+ LEFT: THREE.MOUSE.PAN
63
+ };
64
+ }
65
+ this._cameraControls.update();
66
+ this._mode = value;
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ Object.defineProperty(AcTrLayoutView.prototype, "viewportCount", {
72
+ /**
73
+ * The number of viewports in this layout view
74
+ */
75
+ get: function () {
76
+ return this._viewportViews.size;
77
+ },
78
+ enumerable: false,
79
+ configurable: true
80
+ });
81
+ /**
82
+ * Add one viewport view instance to this layout view
83
+ * @param viewportView Input one viewport instance
84
+ */
85
+ AcTrLayoutView.prototype.addViewport = function (viewportView) {
86
+ this._viewportViews.set(viewportView.viewport.id, viewportView);
87
+ };
88
+ /**
89
+ * Remove the specified viewport view by its id from this layout view
90
+ * @param id Input the id of one viewport instance
91
+ */
92
+ AcTrLayoutView.prototype.removeViewport = function (id) {
93
+ this._viewportViews.delete(id);
94
+ };
95
+ /**
96
+ * Resize this layout view
97
+ * @param width Input new width of the layout view
98
+ * @param height Input new height of the layout view
99
+ */
100
+ AcTrLayoutView.prototype.resize = function (width, height) {
101
+ this._height = height;
102
+ this._width = width;
103
+ this.updateCameraFrustum();
104
+ this._viewportViews.forEach(function (viewportView) {
105
+ viewportView.update();
106
+ });
107
+ };
108
+ AcTrLayoutView.prototype.render = function (scene) {
109
+ var _a;
110
+ this._renderer.clear();
111
+ this._renderer.render(scene.internalScene, this._camera);
112
+ var modelSpaceLayout = scene.modelSpaceLayout;
113
+ if (modelSpaceLayout) {
114
+ this.drawViewports(modelSpaceLayout.internalObject);
115
+ }
116
+ (_a = this._axesGizmo) === null || _a === void 0 ? void 0 : _a.update();
117
+ };
118
+ AcTrLayoutView.prototype.createAxesGizmo = function () {
119
+ var axesGizmo = new AxesGizmo(this._camera.internalCamera, this._renderer.internalRenderer, {
120
+ hasZAxis: false,
121
+ pos: ObjectPosition.LEFT_BOTTOM
122
+ });
123
+ return axesGizmo;
124
+ };
125
+ /**
126
+ * Draw viewports
127
+ * @param scene Input the scene to draw
128
+ */
129
+ AcTrLayoutView.prototype.drawViewports = function (scene) {
130
+ if (this._viewportViews.size > 0) {
131
+ // Store autoClear flag value
132
+ var autoClear = this._renderer.autoClear;
133
+ this._renderer.autoClear = false;
134
+ var oldViewport = new THREE.Vector4();
135
+ this._renderer.getViewport(oldViewport);
136
+ this._renderer.clearDepth();
137
+ var visibility = scene.visible;
138
+ scene.visible = true;
139
+ this._viewportViews.forEach(function (viewportView) {
140
+ viewportView.render(scene);
141
+ });
142
+ scene.visible = visibility;
143
+ this._renderer.setViewport(oldViewport.x, oldViewport.y, oldViewport.z, oldViewport.w);
144
+ // Restore autoClear flag vlaue
145
+ this._renderer.autoClear = autoClear;
146
+ }
147
+ };
148
+ return AcTrLayoutView;
149
+ }(AcTrBaseView));
150
+ export { AcTrLayoutView };
151
+ //# sourceMappingURL=AcTrLayoutView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayoutView.js","sourceRoot":"","sources":["../../src/view/AcTrLayoutView.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,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YACE,QAAQ,EAAE,KAAK;YACf,GAAG,EAAE,cAAc,CAAC,WAAW;SAChC,CACF,CAAA;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;OAGG;IACK,sCAAa,GAArB,UAAsB,KAAqB;QACzC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACjC,6BAA6B;YAC7B,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAA;YAC1C,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,KAAK,CAAA;YAEhC,IAAM,WAAW,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAA;YACvC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;YACvC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAA;YAE3B,IAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAA;YAChC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAA;YACpB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,UAAA,YAAY;gBACtC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC5B,CAAC,CAAC,CAAA;YACF,KAAK,CAAC,OAAO,GAAG,UAAU,CAAA;YAE1B,IAAI,CAAC,SAAS,CAAC,WAAW,CACxB,WAAW,CAAC,CAAC,EACb,WAAW,CAAC,CAAC,EACb,WAAW,CAAC,CAAC,EACb,WAAW,CAAC,CAAC,CACd,CAAA;YAED,+BAA+B;YAC/B,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;QACtC,CAAC;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AA7ID,CAAoC,YAAY,GA6I/C"}
@@ -0,0 +1,43 @@
1
+ import { AcTrLayoutView } from './AcTrLayoutView';
2
+ import { AcTrScene } from './AcTrScene';
3
+ export declare class AcTrLayoutViewManager {
4
+ private _activeLayoutBtrId;
5
+ private _layoutViews;
6
+ constructor();
7
+ /**
8
+ * The block table record id associated with the active layout
9
+ */
10
+ get activeLayoutBtrId(): string;
11
+ set activeLayoutBtrId(value: string);
12
+ /**
13
+ * The active layout view.
14
+ */
15
+ get activeLayoutView(): AcTrLayoutView | undefined;
16
+ /**
17
+ * Return true if the layout view manager contains one layout view associated with the sepcified block
18
+ * table record id. Otherwise it returns false.
19
+ * @param name Input the block table record id associated with the layout view
20
+ * @returns Return true if the layout view manager contains one layout view associated with the sepcified
21
+ * block table record id. Otherwise it returns false.
22
+ */
23
+ has(layoutBtrId: string): boolean;
24
+ /**
25
+ * Get the layout view by the block table record id associated with the layout
26
+ * @param layoutBtrId Input the id of the block table record associated the layout
27
+ * @returns Return the layout view by the block table record id associated with the layout
28
+ */
29
+ getAt(layoutBtrId: string): AcTrLayoutView | undefined;
30
+ /**
31
+ * Resize all of layout views managed by layout view manager
32
+ * @param width Input new width of the layout view
33
+ * @param height Input new height of the layout view
34
+ */
35
+ resize(width: number, height: number): void;
36
+ add(layoutView: AcTrLayoutView): void;
37
+ /**
38
+ * Render the specified scene in the current layout view
39
+ * @param scene Input the scene to render
40
+ */
41
+ render(scene: AcTrScene): void;
42
+ }
43
+ //# sourceMappingURL=AcTrLayoutViewManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcTrLayoutViewManager.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayoutViewManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,qBAAa,qBAAqB;IAChC,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,YAAY,CAA6B;;IAOjD;;OAEG;IACH,IAAI,iBAAiB,IAGQ,MAAM,CADlC;IACD,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAKlC;IAED;;OAEG;IACH,IAAI,gBAAgB,+BAEnB;IAED;;;;;;OAMG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM;IAIvB;;;;OAIG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM;IAIzB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAMpC,GAAG,CAAC,UAAU,EAAE,cAAc;IAI9B;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,SAAS;CAGxB"}