@mlightcad/cad-simple-viewer 1.2.2 → 1.2.3
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.
- package/dist/__vite-browser-external-l0sNRNKZ-l0sNRNKZ.js +1 -0
- package/dist/index.js +40205 -0
- package/dist/index.umd.cjs +333 -0
- package/dist/libredwg-parser-worker.js +15458 -0
- package/dist/mtext-renderer-worker.js +29930 -0
- package/lib/app/AcApContext.d.ts +57 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +106 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +291 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +498 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +101 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +237 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +54 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +151 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApGlobalFunc.d.ts +26 -0
- package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
- package/lib/app/AcApGlobalFunc.js +66 -0
- package/lib/app/AcApGlobalFunc.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +232 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +283 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +6 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +6 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +56 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +37 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +60 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +31 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +55 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +32 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +56 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApRegenCmd.d.ts +21 -0
- package/lib/command/AcApRegenCmd.d.ts.map +1 -0
- package/lib/command/AcApRegenCmd.js +45 -0
- package/lib/command/AcApRegenCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +32 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +56 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +53 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +103 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +35 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +57 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +158 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +11 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +11 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +151 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +164 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +235 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.js +87 -0
- package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +103 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +41 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +4 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +4 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +166 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +220 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +155 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +78 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +180 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +256 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +91 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +179 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +111 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +183 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +457 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +349 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.js +2 -0
- package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
- package/lib/editor/view/index.d.ts +3 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +3 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +92 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +109 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +132 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +199 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +218 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +437 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +115 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +200 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +118 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +162 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +370 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +262 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +772 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,437 @@
|
|
|
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 AutoCAD layout (model space or paper space).
|
|
33
|
+
*
|
|
34
|
+
* A layout manages the organization and rendering of CAD entities within a specific coordinate space.
|
|
35
|
+
* It provides functionality for:
|
|
36
|
+
* - Managing entities organized by layers
|
|
37
|
+
* - Spatial indexing for efficient entity queries
|
|
38
|
+
* - Bounding box management for view operations
|
|
39
|
+
* - Entity selection and highlighting
|
|
40
|
+
* - Memory usage tracking and statistics
|
|
41
|
+
*
|
|
42
|
+
* Layouts use a spatial index (R-tree) for fast entity lookup operations and maintain
|
|
43
|
+
* a hierarchical structure where entities are grouped by layers for efficient rendering
|
|
44
|
+
* and visibility management.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const layout = new AcTrLayout();
|
|
49
|
+
* layout.addEntity(entity);
|
|
50
|
+
* const entities = layout.search(boundingBox);
|
|
51
|
+
* layout.select(['entity1', 'entity2']);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
var AcTrLayout = /** @class */ (function () {
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new layout instance.
|
|
57
|
+
* Initializes the layout with empty collections and a spatial index.
|
|
58
|
+
*/
|
|
59
|
+
function AcTrLayout() {
|
|
60
|
+
this._group = new THREE.Group();
|
|
61
|
+
this._indexTree = new RBush();
|
|
62
|
+
this._box = new THREE.Box3();
|
|
63
|
+
this._layers = new Map();
|
|
64
|
+
}
|
|
65
|
+
Object.defineProperty(AcTrLayout.prototype, "internalObject", {
|
|
66
|
+
/**
|
|
67
|
+
* The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
get: function () {
|
|
71
|
+
return this._group;
|
|
72
|
+
},
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(AcTrLayout.prototype, "layers", {
|
|
77
|
+
/**
|
|
78
|
+
* Gets the map of layers in this layout.
|
|
79
|
+
*
|
|
80
|
+
* @returns Map of layer names to layer objects
|
|
81
|
+
*/
|
|
82
|
+
get: function () {
|
|
83
|
+
return this._layers;
|
|
84
|
+
},
|
|
85
|
+
enumerable: false,
|
|
86
|
+
configurable: true
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(AcTrLayout.prototype, "box", {
|
|
89
|
+
/**
|
|
90
|
+
* Gets the bounding box that contains all entities in this layout.
|
|
91
|
+
*
|
|
92
|
+
* @returns The layout's bounding box
|
|
93
|
+
*/
|
|
94
|
+
get: function () {
|
|
95
|
+
return this._box;
|
|
96
|
+
},
|
|
97
|
+
enumerable: false,
|
|
98
|
+
configurable: true
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(AcTrLayout.prototype, "visible", {
|
|
101
|
+
/**
|
|
102
|
+
* The visibility of this layout.
|
|
103
|
+
* When set to false, the entire layout and all its contents are hidden.
|
|
104
|
+
*/
|
|
105
|
+
get: function () {
|
|
106
|
+
return this._group.visible;
|
|
107
|
+
},
|
|
108
|
+
set: function (value) {
|
|
109
|
+
this._group.visible = value;
|
|
110
|
+
},
|
|
111
|
+
enumerable: false,
|
|
112
|
+
configurable: true
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(AcTrLayout.prototype, "entityCount", {
|
|
115
|
+
/**
|
|
116
|
+
* The number of entities stored in this layout.
|
|
117
|
+
* Calculates the total by summing entities across all layers.
|
|
118
|
+
*/
|
|
119
|
+
get: function () {
|
|
120
|
+
var count = 0;
|
|
121
|
+
this._layers.forEach(function (layer) { return (count += layer.entityCount); });
|
|
122
|
+
return count;
|
|
123
|
+
},
|
|
124
|
+
enumerable: false,
|
|
125
|
+
configurable: true
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(AcTrLayout.prototype, "stats", {
|
|
128
|
+
/**
|
|
129
|
+
* The statistics of this layout.
|
|
130
|
+
* Provides detailed information about memory usage and entity counts.
|
|
131
|
+
*/
|
|
132
|
+
get: function () {
|
|
133
|
+
var layers = [];
|
|
134
|
+
var totalGeometrySize = 0;
|
|
135
|
+
var totalMappingSize = 0;
|
|
136
|
+
var lineTotalSize = 0;
|
|
137
|
+
var meshTotalSize = 0;
|
|
138
|
+
var pointTotalSize = 0;
|
|
139
|
+
this._layers.forEach(function (layer) {
|
|
140
|
+
var stats = layer.stats;
|
|
141
|
+
layers.push(stats);
|
|
142
|
+
lineTotalSize +=
|
|
143
|
+
stats.line.indexed.geometrySize + stats.line.nonIndexed.geometrySize;
|
|
144
|
+
meshTotalSize +=
|
|
145
|
+
stats.mesh.indexed.geometrySize + stats.mesh.nonIndexed.geometrySize;
|
|
146
|
+
pointTotalSize +=
|
|
147
|
+
stats.point.indexed.geometrySize + stats.point.nonIndexed.geometrySize;
|
|
148
|
+
totalGeometrySize += stats.summary.totalGeometrySize;
|
|
149
|
+
totalMappingSize += stats.summary.totalMappingSize;
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
layers: layers,
|
|
153
|
+
summary: {
|
|
154
|
+
entityCount: this.entityCount,
|
|
155
|
+
totalSize: {
|
|
156
|
+
line: lineTotalSize,
|
|
157
|
+
mesh: meshTotalSize,
|
|
158
|
+
point: pointTotalSize,
|
|
159
|
+
geometry: totalGeometrySize,
|
|
160
|
+
mapping: totalMappingSize
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
enumerable: false,
|
|
166
|
+
configurable: true
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* Clears all entities from the layout.
|
|
170
|
+
* Removes all layers, resets the bounding box, and clears the spatial index.
|
|
171
|
+
*
|
|
172
|
+
* @returns This layout instance for method chaining
|
|
173
|
+
*/
|
|
174
|
+
AcTrLayout.prototype.clear = function () {
|
|
175
|
+
var _this = this;
|
|
176
|
+
this._layers.forEach(function (layer) {
|
|
177
|
+
_this._group.remove(layer.internalObject);
|
|
178
|
+
});
|
|
179
|
+
this._layers.clear();
|
|
180
|
+
this._box.makeEmpty();
|
|
181
|
+
this._indexTree.clear();
|
|
182
|
+
return this;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Re-render points with latest point style settings.
|
|
186
|
+
* Updates the visual representation of all point entities across all layers.
|
|
187
|
+
*
|
|
188
|
+
* @param displayMode - Input display mode of points
|
|
189
|
+
*/
|
|
190
|
+
AcTrLayout.prototype.rerenderPoints = function (displayMode) {
|
|
191
|
+
this._layers.forEach(function (layer) {
|
|
192
|
+
layer.rerenderPoints(displayMode);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Return true if the object with the specified object id is intersected with the ray by using raycast.
|
|
197
|
+
*
|
|
198
|
+
* @param objectId - Input object id of object to check for intersection with the ray.
|
|
199
|
+
* @param raycaster - Input raycaster to check intersection
|
|
200
|
+
* @returns True if the object intersects with the ray, false otherwise
|
|
201
|
+
*/
|
|
202
|
+
AcTrLayout.prototype.isIntersectWith = function (objectId, raycaster) {
|
|
203
|
+
var layer = this.getLayerByObjectId(objectId);
|
|
204
|
+
return layer && layer.isIntersectWith(objectId, raycaster);
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Add one AutoCAD entity into this layout. If layer group referenced by the entity doesn't exist, create one
|
|
208
|
+
* layer group and add this entity this group.
|
|
209
|
+
*
|
|
210
|
+
* @param entity - Input AutoCAD entity to be added into this layout.
|
|
211
|
+
* @param extendBbox - Input the flag whether to extend the bounding box of the scene by union the bounding box
|
|
212
|
+
* of the specified entity. Defaults to true.
|
|
213
|
+
* @returns This layout instance for method chaining
|
|
214
|
+
*
|
|
215
|
+
* @throws {Error} When entity is missing required objectId or layerName
|
|
216
|
+
*/
|
|
217
|
+
AcTrLayout.prototype.addEntity = function (entity, extendBbox) {
|
|
218
|
+
if (extendBbox === void 0) { extendBbox = true; }
|
|
219
|
+
if (!entity.objectId) {
|
|
220
|
+
throw new Error('Object id is required to add one entity!');
|
|
221
|
+
}
|
|
222
|
+
if (!entity.layerName) {
|
|
223
|
+
throw new Error('Layer name is required to add one entity!');
|
|
224
|
+
}
|
|
225
|
+
var layer = this._layers.get(entity.layerName);
|
|
226
|
+
if (!layer) {
|
|
227
|
+
throw new Error("layer '".concat(entity.layerName, "' doesn't exist!"));
|
|
228
|
+
}
|
|
229
|
+
layer.addEntity(entity);
|
|
230
|
+
var box = entity.box;
|
|
231
|
+
// For infinitive line such as ray and xline
|
|
232
|
+
if (extendBbox)
|
|
233
|
+
this._box.union(box);
|
|
234
|
+
this._indexTree.insert({
|
|
235
|
+
minX: box.min.x,
|
|
236
|
+
minY: box.min.y,
|
|
237
|
+
maxX: box.max.x,
|
|
238
|
+
maxY: box.max.y,
|
|
239
|
+
id: entity.objectId
|
|
240
|
+
});
|
|
241
|
+
return this;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Remove the specified entity from this layout.
|
|
245
|
+
*
|
|
246
|
+
* @param objectId - Input the object id of the entity to remove
|
|
247
|
+
* @returns Return true if remove the specified entity successfully. Otherwise, return false.
|
|
248
|
+
*/
|
|
249
|
+
AcTrLayout.prototype.remove = function (objectId) {
|
|
250
|
+
var e_1, _a;
|
|
251
|
+
try {
|
|
252
|
+
for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
253
|
+
var _d = __read(_c.value, 2), _1 = _d[0], layer = _d[1];
|
|
254
|
+
if (layer.remove(objectId))
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
259
|
+
finally {
|
|
260
|
+
try {
|
|
261
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
262
|
+
}
|
|
263
|
+
finally { if (e_1) throw e_1.error; }
|
|
264
|
+
}
|
|
265
|
+
return false;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Update the specified entity in this layout.
|
|
269
|
+
*
|
|
270
|
+
* @param entity - Input the entity to update
|
|
271
|
+
* @returns Return true if update the specified entity successfully. Otherwise, return false.
|
|
272
|
+
*/
|
|
273
|
+
AcTrLayout.prototype.updateEntity = function (entity) {
|
|
274
|
+
var e_2, _a;
|
|
275
|
+
try {
|
|
276
|
+
for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
277
|
+
var _d = __read(_c.value, 2), _2 = _d[0], layer = _d[1];
|
|
278
|
+
if (layer.update(entity))
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
283
|
+
finally {
|
|
284
|
+
try {
|
|
285
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
286
|
+
}
|
|
287
|
+
finally { if (e_2) throw e_2.error; }
|
|
288
|
+
}
|
|
289
|
+
return false;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Adds layer group into this layout. If the layer already exist, do nothing.
|
|
293
|
+
*
|
|
294
|
+
* @param name - Input layer name
|
|
295
|
+
* @returns Return added layer group or the existing layer group in this layout if one layer
|
|
296
|
+
* group already exists in this layout.
|
|
297
|
+
*/
|
|
298
|
+
AcTrLayout.prototype.addLayer = function (layer) {
|
|
299
|
+
var name = layer.name;
|
|
300
|
+
var layerGroup = this._layers.get(name);
|
|
301
|
+
if (layerGroup === undefined) {
|
|
302
|
+
layerGroup = new AcTrLayer(name);
|
|
303
|
+
layerGroup.visible = !(layer.isFrozen || layer.isOff);
|
|
304
|
+
this._layers.set(name, layerGroup);
|
|
305
|
+
this._group.add(layerGroup.internalObject);
|
|
306
|
+
}
|
|
307
|
+
return layer;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Updates layer group information (such as visibility). If the layer doesn't exist, do nothing.
|
|
311
|
+
* @param layerName Input layer information
|
|
312
|
+
* @returns Returns the updated layer group.
|
|
313
|
+
*/
|
|
314
|
+
AcTrLayout.prototype.updateLayer = function (layer) {
|
|
315
|
+
var layerGroup = this._layers.get(layer.name);
|
|
316
|
+
if (layerGroup) {
|
|
317
|
+
layerGroup.visible = !(layer.isFrozen || layer.isOff);
|
|
318
|
+
}
|
|
319
|
+
return layerGroup;
|
|
320
|
+
};
|
|
321
|
+
/**
|
|
322
|
+
* Hover the specified entities.
|
|
323
|
+
* Applies hover highlighting to the entities with the given IDs.
|
|
324
|
+
*
|
|
325
|
+
* @param ids - Array of entity object IDs to hover
|
|
326
|
+
*/
|
|
327
|
+
AcTrLayout.prototype.hover = function (ids) {
|
|
328
|
+
var _this = this;
|
|
329
|
+
ids.forEach(function (id) {
|
|
330
|
+
var layer = _this.getLayerByObjectId(id);
|
|
331
|
+
if (layer) {
|
|
332
|
+
layer.hover([id]);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Unhover the specified entities.
|
|
338
|
+
* Removes hover highlighting from the entities with the given IDs.
|
|
339
|
+
*
|
|
340
|
+
* @param ids - Array of entity object IDs to unhover
|
|
341
|
+
*/
|
|
342
|
+
AcTrLayout.prototype.unhover = function (ids) {
|
|
343
|
+
var _this = this;
|
|
344
|
+
ids.forEach(function (id) {
|
|
345
|
+
var layer = _this.getLayerByObjectId(id);
|
|
346
|
+
if (layer) {
|
|
347
|
+
layer.unhover([id]);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Select the specified entities.
|
|
353
|
+
* Applies selection highlighting to the entities with the given IDs.
|
|
354
|
+
*
|
|
355
|
+
* @param ids - Array of entity object IDs to select
|
|
356
|
+
*/
|
|
357
|
+
AcTrLayout.prototype.select = function (ids) {
|
|
358
|
+
var _this = this;
|
|
359
|
+
ids.forEach(function (id) {
|
|
360
|
+
var layer = _this.getLayerByObjectId(id);
|
|
361
|
+
if (layer) {
|
|
362
|
+
layer.select([id]);
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Unselect the specified entities.
|
|
368
|
+
* Removes selection highlighting from the entities with the given IDs.
|
|
369
|
+
*
|
|
370
|
+
* @param ids - Array of entity object IDs to unselect
|
|
371
|
+
*/
|
|
372
|
+
AcTrLayout.prototype.unselect = function (ids) {
|
|
373
|
+
var _this = this;
|
|
374
|
+
ids.forEach(function (id) {
|
|
375
|
+
var layer = _this.getLayerByObjectId(id);
|
|
376
|
+
if (layer) {
|
|
377
|
+
layer.unselect([id]);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Sets the snap points object for this layout.
|
|
383
|
+
* Replaces any existing snap points object with the new one.
|
|
384
|
+
*
|
|
385
|
+
* @param object - The snap points object to display
|
|
386
|
+
*/
|
|
387
|
+
AcTrLayout.prototype.setSnapObject = function (object) {
|
|
388
|
+
if (this._snapPointsObject) {
|
|
389
|
+
this._group.remove(this._snapPointsObject);
|
|
390
|
+
}
|
|
391
|
+
this._snapPointsObject = object;
|
|
392
|
+
this._group.add(object);
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* Search entities intersected or contained in the specified bounding box.
|
|
396
|
+
* Uses the spatial index for efficient querying of entities within the given bounds.
|
|
397
|
+
*
|
|
398
|
+
* @param box - Input the query bounding box (2D or 3D)
|
|
399
|
+
* @returns Return query results containing entity IDs and their bounds
|
|
400
|
+
*/
|
|
401
|
+
AcTrLayout.prototype.search = function (box) {
|
|
402
|
+
var results = this._indexTree.search({
|
|
403
|
+
minX: box.min.x,
|
|
404
|
+
minY: box.min.y,
|
|
405
|
+
maxX: box.max.x,
|
|
406
|
+
maxY: box.max.y
|
|
407
|
+
});
|
|
408
|
+
return results;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Finds the layer containing the entity with the specified object ID.
|
|
412
|
+
*
|
|
413
|
+
* @param objectId - The object ID to search for
|
|
414
|
+
* @returns The layer containing the entity, or undefined if not found
|
|
415
|
+
*/
|
|
416
|
+
AcTrLayout.prototype.getLayerByObjectId = function (objectId) {
|
|
417
|
+
var e_3, _a;
|
|
418
|
+
try {
|
|
419
|
+
for (var _b = __values(this._layers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
420
|
+
var _d = __read(_c.value, 2), _3 = _d[0], layer = _d[1];
|
|
421
|
+
if (layer.hasEntity(objectId))
|
|
422
|
+
return layer;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
426
|
+
finally {
|
|
427
|
+
try {
|
|
428
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
429
|
+
}
|
|
430
|
+
finally { if (e_3) throw e_3.error; }
|
|
431
|
+
}
|
|
432
|
+
return undefined;
|
|
433
|
+
};
|
|
434
|
+
return AcTrLayout;
|
|
435
|
+
}());
|
|
436
|
+
export { AcTrLayout };
|
|
437
|
+
//# 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;AA8BvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAYE;;;OAGG;IACH;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,CAA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C,QAAA,EAAE,KAAK,QAAA;gBAClB,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC;oBAAE,OAAO,KAAK,CAAA;YAC7C,CAAC;;;;;;;;;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IACH,iBAAC;AAAD,CAAC,AA9VD,IA8VC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AcTrBaseView, AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
|
|
2
|
+
import { AcEdViewMode } from '../editor/view/AcEdBaseView';
|
|
3
|
+
import { AcTrScene } from './AcTrScene';
|
|
4
|
+
/**
|
|
5
|
+
* Interface for database entity event arguments.
|
|
6
|
+
* Provides context information for entity-related events.
|
|
7
|
+
*/
|
|
8
|
+
export interface AcDbEntityEventArgs {
|
|
9
|
+
/** The layout view associated with the event */
|
|
10
|
+
view: AcTrLayoutView;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Each layout has its own camera and camera control. This class represents view associated with one layout.
|
|
14
|
+
*
|
|
15
|
+
* A layout view manages the visual representation and interaction for a specific AutoCAD layout.
|
|
16
|
+
* It provides:
|
|
17
|
+
* - Camera and view controls specific to the layout
|
|
18
|
+
* - Viewport management for paper space layouts
|
|
19
|
+
* - View mode switching (selection, pan, etc.)
|
|
20
|
+
* - Axes gizmo for orientation feedback
|
|
21
|
+
* - Rendering coordination with viewports
|
|
22
|
+
*
|
|
23
|
+
* The layout view coordinates between the layout's data (entities, layers) and the visual
|
|
24
|
+
* presentation, handling camera positioning, user interaction modes, and multi-viewport
|
|
25
|
+
* rendering for paper space layouts.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const layoutView = new AcTrLayoutView(renderer, layoutId, 800, 600);
|
|
30
|
+
* layoutView.mode = AcEdViewMode.PAN;
|
|
31
|
+
* layoutView.render(scene);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class AcTrLayoutView extends AcTrBaseView {
|
|
35
|
+
/** The block table record ID associated with this layout */
|
|
36
|
+
private _layoutBtrId;
|
|
37
|
+
/** The axes gizmo for showing coordinate system orientation */
|
|
38
|
+
private _axesGizmo;
|
|
39
|
+
/** The current view mode (selection, pan, etc.) */
|
|
40
|
+
private _mode;
|
|
41
|
+
/** Map of viewport views indexed by viewport ID */
|
|
42
|
+
private _viewportViews;
|
|
43
|
+
/**
|
|
44
|
+
* Construct one instance of this class.
|
|
45
|
+
*
|
|
46
|
+
* @param renderer - Input renderer for this view
|
|
47
|
+
* @param layoutBtrId - Input the id of the block table record associated the layout
|
|
48
|
+
* @param width - Input width of this view in pixels
|
|
49
|
+
* @param height - Input height of this view in pixels
|
|
50
|
+
*/
|
|
51
|
+
constructor(renderer: AcTrRenderer, layoutBtrId: string, width: number, height: number);
|
|
52
|
+
/**
|
|
53
|
+
* Gets the block table record ID associated with this layout.
|
|
54
|
+
*
|
|
55
|
+
* @returns The layout's block table record ID
|
|
56
|
+
*/
|
|
57
|
+
get layoutBtrId(): string;
|
|
58
|
+
/**
|
|
59
|
+
* The view mode of the current layout view.
|
|
60
|
+
* Controls how mouse interactions are interpreted (selection vs pan mode).
|
|
61
|
+
*/
|
|
62
|
+
get mode(): AcEdViewMode;
|
|
63
|
+
set mode(value: AcEdViewMode);
|
|
64
|
+
/**
|
|
65
|
+
* The number of viewports in this layout view.
|
|
66
|
+
* Paper space layouts can contain multiple viewports showing different views of model space.
|
|
67
|
+
*/
|
|
68
|
+
get viewportCount(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Add one viewport view instance to this layout view.
|
|
71
|
+
* Viewports are used in paper space layouts to show different views of the model.
|
|
72
|
+
*
|
|
73
|
+
* @param viewportView - Input one viewport instance to add
|
|
74
|
+
*/
|
|
75
|
+
addViewport(viewportView: AcTrViewportView): void;
|
|
76
|
+
/**
|
|
77
|
+
* Remove the specified viewport view by its id from this layout view.
|
|
78
|
+
*
|
|
79
|
+
* @param id - Input the id of one viewport instance to remove
|
|
80
|
+
*/
|
|
81
|
+
removeViewport(id: string): void;
|
|
82
|
+
/**
|
|
83
|
+
* Resize this layout view.
|
|
84
|
+
* Updates the view dimensions and notifies all viewports of the size change.
|
|
85
|
+
*
|
|
86
|
+
* @param width - Input new width of the layout view in pixels
|
|
87
|
+
* @param height - Input new height of the layout view in pixels
|
|
88
|
+
*/
|
|
89
|
+
resize(width: number, height: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* Renders the scene in this layout view.
|
|
92
|
+
* Performs the main rendering pass and then renders any viewports if present.
|
|
93
|
+
* Updates the axes gizmo to reflect the current camera orientation.
|
|
94
|
+
*
|
|
95
|
+
* @param scene - The scene containing the layout data to render
|
|
96
|
+
*/
|
|
97
|
+
render(scene: AcTrScene): void;
|
|
98
|
+
/**
|
|
99
|
+
* Creates and configures the axes gizmo for this view.
|
|
100
|
+
* The gizmo shows the current coordinate system orientation and is positioned
|
|
101
|
+
* at the bottom-left of the view without a Z-axis (2D view).
|
|
102
|
+
*
|
|
103
|
+
* @returns The configured axes gizmo instance
|
|
104
|
+
*/
|
|
105
|
+
private createAxesGizmo;
|
|
106
|
+
/**
|
|
107
|
+
* Draw viewports into the current rendering context.
|
|
108
|
+
* Handles the complex rendering process for paper space layouts that contain
|
|
109
|
+
* multiple viewports, each with their own view of model space.
|
|
110
|
+
*
|
|
111
|
+
* @param scene - Input the scene object to draw in each viewport
|
|
112
|
+
*/
|
|
113
|
+
private drawViewports;
|
|
114
|
+
}
|
|
115
|
+
//# 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,SAA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