@mlightcad/cad-simple-viewer 1.0.0 → 1.0.1
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/README.md +296 -2
- package/dist/index.js +1347 -122
- package/dist/index.umd.cjs +2 -2
- package/lib/app/AcApContext.d.ts +45 -3
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +43 -3
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocCreator.d.ts +68 -2
- package/lib/app/AcApDocCreator.d.ts.map +1 -1
- package/lib/app/AcApDocCreator.js +67 -2
- package/lib/app/AcApDocCreator.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +227 -12
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +228 -17
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts +77 -3
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +75 -3
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApFontLoader.d.ts +32 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -1
- package/lib/app/AcApFontLoader.js +30 -0
- package/lib/app/AcApFontLoader.js.map +1 -1
- package/lib/app/AcApSettingManager.d.ts +191 -3
- package/lib/app/AcApSettingManager.d.ts.map +1 -1
- package/lib/app/AcApSettingManager.js +161 -0
- package/lib/app/AcApSettingManager.js.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts +26 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -1
- package/lib/command/AcApConvertToSvgCmd.js +26 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -1
- package/lib/command/AcApOpenCmd.d.ts +31 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -1
- package/lib/command/AcApOpenCmd.js +31 -0
- package/lib/command/AcApOpenCmd.js.map +1 -1
- package/lib/command/AcApPanCmd.d.ts +25 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -1
- package/lib/command/AcApPanCmd.js +25 -0
- package/lib/command/AcApPanCmd.js.map +1 -1
- package/lib/command/AcApQNewCmd.d.ts +26 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -1
- package/lib/command/AcApQNewCmd.js +26 -0
- package/lib/command/AcApQNewCmd.js.map +1 -1
- package/lib/command/AcApSelectCmd.d.ts +26 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -1
- package/lib/command/AcApSelectCmd.js +26 -0
- package/lib/command/AcApSelectCmd.js.map +1 -1
- package/lib/command/AcApSvgConvertor.d.ts +48 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -1
- package/lib/command/AcApSvgConvertor.js +48 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -1
- package/lib/command/AcApZoomCmd.d.ts +29 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomCmd.js +29 -0
- package/lib/command/AcApZoomCmd.js.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +57 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -1
- package/lib/command/AcApZoomToBoxCmd.js +57 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -1
- package/lib/editor/command/AcEdCommand.d.ts +118 -9
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommand.js +113 -9
- package/lib/editor/command/AcEdCommand.js.map +1 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +59 -5
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommandStack.js +48 -5
- package/lib/editor/command/AcEdCommandStack.js.map +1 -1
- package/lib/editor/global/eventBus.d.ts +69 -1
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js +37 -0
- package/lib/editor/global/eventBus.js.map +1 -1
- package/lib/editor/input/AcEdBaseInput.d.ts +65 -1
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -1
- package/lib/editor/input/AcEdBaseInput.js +62 -1
- package/lib/editor/input/AcEdBaseInput.js.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +81 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -1
- package/lib/editor/input/AcEdBoxSelector.js +80 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +95 -8
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +95 -11
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +38 -1
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -1
- package/lib/editor/input/AcEdInputPoint.js +38 -1
- package/lib/editor/input/AcEdInputPoint.js.map +1 -1
- package/lib/editor/input/AcEdJig.d.ts +166 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -1
- package/lib/editor/input/AcEdJig.js +164 -0
- package/lib/editor/input/AcEdJig.js.map +1 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +49 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -1
- package/lib/editor/input/AcEdJigLoop.js +48 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.d.ts +122 -2
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -1
- package/lib/editor/input/AcEdSelectionSet.js +117 -1
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -1
- package/lib/editor/input/AcEditor.d.ts +90 -6
- package/lib/editor/input/AcEditor.d.ts.map +1 -1
- package/lib/editor/input/AcEditor.js +86 -6
- package/lib/editor/input/AcEditor.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +163 -16
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +94 -5
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/util/AcTrGeometryUtil.d.ts +65 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -1
- package/lib/util/AcTrGeometryUtil.js +65 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -1
- package/lib/view/AcTrLayer.d.ts +40 -5
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +34 -5
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayout.d.ts +122 -23
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +103 -23
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrLayoutView.d.ts +74 -16
- package/lib/view/AcTrLayoutView.d.ts.map +1 -1
- package/lib/view/AcTrLayoutView.js +65 -16
- package/lib/view/AcTrLayoutView.js.map +1 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +58 -12
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -1
- package/lib/view/AcTrLayoutViewManager.js +56 -12
- package/lib/view/AcTrLayoutViewManager.js.map +1 -1
- package/lib/view/AcTrScene.d.ts +48 -4
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +44 -4
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +71 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +65 -0
- package/lib/view/AcTrView2d.js.map +1 -1
- package/package.json +8 -4
package/lib/view/AcTrLayout.d.ts
CHANGED
|
@@ -3,111 +3,210 @@ import { AcTrEntity, AcTrObject } from '@mlightcad/three-renderer';
|
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import { AcEdSpatialQueryResultItem } from '../editor';
|
|
5
5
|
import { AcTrLayer, AcTrLayerStats } from './AcTrLayer';
|
|
6
|
+
/**
|
|
7
|
+
* Interface representing statistics for a layout.
|
|
8
|
+
* Provides detailed information about the layout's content including
|
|
9
|
+
* layer statistics and memory usage breakdown.
|
|
10
|
+
*/
|
|
6
11
|
export interface AcTrLayoutStats {
|
|
12
|
+
/** Statistics for each layer in the layout */
|
|
7
13
|
layers: AcTrLayerStats[];
|
|
14
|
+
/** Summary statistics for the entire layout */
|
|
8
15
|
summary: {
|
|
16
|
+
/** Total number of entities across all layers */
|
|
9
17
|
entityCount: number;
|
|
18
|
+
/** Memory usage breakdown by object type */
|
|
10
19
|
totalSize: {
|
|
20
|
+
/** Memory used by line geometries (bytes) */
|
|
11
21
|
line: number;
|
|
22
|
+
/** Memory used by mesh geometries (bytes) */
|
|
12
23
|
mesh: number;
|
|
24
|
+
/** Memory used by point geometries (bytes) */
|
|
13
25
|
point: number;
|
|
26
|
+
/** Total geometry memory usage (bytes) */
|
|
14
27
|
geometry: number;
|
|
28
|
+
/** Memory used by entity mappings (bytes) */
|
|
15
29
|
mapping: number;
|
|
16
30
|
};
|
|
17
31
|
};
|
|
18
32
|
}
|
|
19
33
|
/**
|
|
20
|
-
* This class represents objects contained in one
|
|
34
|
+
* This class represents objects contained in one AutoCAD layout (model space or paper space).
|
|
35
|
+
*
|
|
36
|
+
* A layout manages the organization and rendering of CAD entities within a specific coordinate space.
|
|
37
|
+
* It provides functionality for:
|
|
38
|
+
* - Managing entities organized by layers
|
|
39
|
+
* - Spatial indexing for efficient entity queries
|
|
40
|
+
* - Bounding box management for view operations
|
|
41
|
+
* - Entity selection and highlighting
|
|
42
|
+
* - Memory usage tracking and statistics
|
|
43
|
+
*
|
|
44
|
+
* Layouts use a spatial index (R-tree) for fast entity lookup operations and maintain
|
|
45
|
+
* a hierarchical structure where entities are grouped by layers for efficient rendering
|
|
46
|
+
* and visibility management.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const layout = new AcTrLayout();
|
|
51
|
+
* layout.addEntity(entity);
|
|
52
|
+
* const entities = layout.search(boundingBox);
|
|
53
|
+
* layout.select(['entity1', 'entity2']);
|
|
54
|
+
* ```
|
|
21
55
|
*/
|
|
22
56
|
export declare class AcTrLayout {
|
|
57
|
+
/** The group that contains all entities in this layout */
|
|
23
58
|
private _group;
|
|
59
|
+
/** Spatial index tree for efficient entity queries */
|
|
24
60
|
private _indexTree;
|
|
61
|
+
/** Bounding box containing all entities in this layout */
|
|
25
62
|
private _box;
|
|
63
|
+
/** Map of layers indexed by layer name */
|
|
26
64
|
private _layers;
|
|
65
|
+
/** Optional object for displaying snap points */
|
|
27
66
|
private _snapPointsObject?;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new layout instance.
|
|
69
|
+
* Initializes the layout with empty collections and a spatial index.
|
|
70
|
+
*/
|
|
28
71
|
constructor();
|
|
29
72
|
/**
|
|
30
73
|
* The internal THREE.js object to use by scene. This is internally used only. Try to avoid using it.
|
|
31
74
|
* @internal
|
|
32
75
|
*/
|
|
33
76
|
get internalObject(): THREE.Group<THREE.Object3DEventMap>;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the map of layers in this layout.
|
|
79
|
+
*
|
|
80
|
+
* @returns Map of layer names to layer objects
|
|
81
|
+
*/
|
|
34
82
|
get layers(): Map<string, AcTrLayer>;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the bounding box that contains all entities in this layout.
|
|
85
|
+
*
|
|
86
|
+
* @returns The layout's bounding box
|
|
87
|
+
*/
|
|
35
88
|
get box(): THREE.Box3;
|
|
36
89
|
/**
|
|
37
|
-
* The visibility of this layout
|
|
90
|
+
* The visibility of this layout.
|
|
91
|
+
* When set to false, the entire layout and all its contents are hidden.
|
|
38
92
|
*/
|
|
39
93
|
get visible(): boolean;
|
|
40
94
|
set visible(value: boolean);
|
|
41
95
|
/**
|
|
42
|
-
* The number of entities stored in this
|
|
96
|
+
* The number of entities stored in this layout.
|
|
97
|
+
* Calculates the total by summing entities across all layers.
|
|
43
98
|
*/
|
|
44
99
|
get entityCount(): number;
|
|
45
100
|
/**
|
|
46
|
-
* The statistics of this layout
|
|
101
|
+
* The statistics of this layout.
|
|
102
|
+
* Provides detailed information about memory usage and entity counts.
|
|
47
103
|
*/
|
|
48
104
|
get stats(): AcTrLayoutStats;
|
|
105
|
+
/**
|
|
106
|
+
* Clears all entities from the layout.
|
|
107
|
+
* Removes all layers, resets the bounding box, and clears the spatial index.
|
|
108
|
+
*
|
|
109
|
+
* @returns This layout instance for method chaining
|
|
110
|
+
*/
|
|
49
111
|
clear(): this;
|
|
50
112
|
/**
|
|
51
|
-
* Re-render points with latest point style settings
|
|
52
|
-
*
|
|
113
|
+
* Re-render points with latest point style settings.
|
|
114
|
+
* Updates the visual representation of all point entities across all layers.
|
|
115
|
+
*
|
|
116
|
+
* @param displayMode - Input display mode of points
|
|
53
117
|
*/
|
|
54
118
|
rerenderPoints(displayMode: number): void;
|
|
55
119
|
/**
|
|
56
120
|
* Return true if the object with the specified object id is intersected with the ray by using raycast.
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
121
|
+
*
|
|
122
|
+
* @param objectId - Input object id of object to check for intersection with the ray.
|
|
123
|
+
* @param raycaster - Input raycaster to check intersection
|
|
124
|
+
* @returns True if the object intersects with the ray, false otherwise
|
|
59
125
|
*/
|
|
60
126
|
isIntersectWith(objectId: string, raycaster: THREE.Raycaster): boolean | undefined;
|
|
61
127
|
/**
|
|
62
128
|
* Add one AutoCAD entity into this layout. If layer group referenced by the entity doesn't exist, create one
|
|
63
129
|
* layer group and add this entity this group.
|
|
64
|
-
*
|
|
65
|
-
* @param
|
|
66
|
-
* of the
|
|
130
|
+
*
|
|
131
|
+
* @param entity - Input AutoCAD entity to be added into this layout.
|
|
132
|
+
* @param extendBbox - Input the flag whether to extend the bounding box of the scene by union the bounding box
|
|
133
|
+
* of the specified entity. Defaults to true.
|
|
134
|
+
* @returns This layout instance for method chaining
|
|
135
|
+
*
|
|
136
|
+
* @throws {Error} When entity is missing required objectId or layerName
|
|
67
137
|
*/
|
|
68
138
|
addEntity(entity: AcTrEntity, extendBbox?: boolean): this;
|
|
69
139
|
/**
|
|
70
140
|
* Remove the specified entity from this layout.
|
|
71
|
-
*
|
|
141
|
+
*
|
|
142
|
+
* @param objectId - Input the object id of the entity to remove
|
|
72
143
|
* @returns Return true if remove the specified entity successfully. Otherwise, return false.
|
|
73
144
|
*/
|
|
74
145
|
remove(objectId: AcDbObjectId): boolean;
|
|
75
146
|
/**
|
|
76
147
|
* Update the specified entity in this layout.
|
|
77
|
-
*
|
|
148
|
+
*
|
|
149
|
+
* @param entity - Input the entity to update
|
|
78
150
|
* @returns Return true if update the specified entity successfully. Otherwise, return false.
|
|
79
151
|
*/
|
|
80
152
|
update(entity: AcTrEntity): boolean;
|
|
81
153
|
/**
|
|
82
|
-
* Hover the specified entities
|
|
154
|
+
* Hover the specified entities.
|
|
155
|
+
* Applies hover highlighting to the entities with the given IDs.
|
|
156
|
+
*
|
|
157
|
+
* @param ids - Array of entity object IDs to hover
|
|
83
158
|
*/
|
|
84
159
|
hover(ids: AcDbObjectId[]): void;
|
|
85
160
|
/**
|
|
86
|
-
* Unhover the specified entities
|
|
161
|
+
* Unhover the specified entities.
|
|
162
|
+
* Removes hover highlighting from the entities with the given IDs.
|
|
163
|
+
*
|
|
164
|
+
* @param ids - Array of entity object IDs to unhover
|
|
87
165
|
*/
|
|
88
166
|
unhover(ids: AcDbObjectId[]): void;
|
|
89
167
|
/**
|
|
90
|
-
* Select the specified entities
|
|
168
|
+
* Select the specified entities.
|
|
169
|
+
* Applies selection highlighting to the entities with the given IDs.
|
|
170
|
+
*
|
|
171
|
+
* @param ids - Array of entity object IDs to select
|
|
91
172
|
*/
|
|
92
173
|
select(ids: AcDbObjectId[]): void;
|
|
93
174
|
/**
|
|
94
|
-
* Unselect the specified entities
|
|
175
|
+
* Unselect the specified entities.
|
|
176
|
+
* Removes selection highlighting from the entities with the given IDs.
|
|
177
|
+
*
|
|
178
|
+
* @param ids - Array of entity object IDs to unselect
|
|
95
179
|
*/
|
|
96
180
|
unselect(ids: AcDbObjectId[]): void;
|
|
181
|
+
/**
|
|
182
|
+
* Sets the snap points object for this layout.
|
|
183
|
+
* Replaces any existing snap points object with the new one.
|
|
184
|
+
*
|
|
185
|
+
* @param object - The snap points object to display
|
|
186
|
+
*/
|
|
97
187
|
setSnapObject(object: AcTrObject): void;
|
|
98
188
|
/**
|
|
99
189
|
* Search entities intersected or contained in the specified bounding box.
|
|
100
|
-
*
|
|
101
|
-
*
|
|
190
|
+
* Uses the spatial index for efficient querying of entities within the given bounds.
|
|
191
|
+
*
|
|
192
|
+
* @param box - Input the query bounding box (2D or 3D)
|
|
193
|
+
* @returns Return query results containing entity IDs and their bounds
|
|
102
194
|
*/
|
|
103
195
|
search(box: AcGeBox2d | AcGeBox3d): AcEdSpatialQueryResultItem[];
|
|
196
|
+
/**
|
|
197
|
+
* Finds the layer containing the entity with the specified object ID.
|
|
198
|
+
*
|
|
199
|
+
* @param objectId - The object ID to search for
|
|
200
|
+
* @returns The layer containing the entity, or undefined if not found
|
|
201
|
+
*/
|
|
104
202
|
private getLayerByObjectId;
|
|
105
203
|
/**
|
|
106
204
|
* Get layer group by name. If the layer doesn't exist, create one layer group into this layout.
|
|
107
|
-
*
|
|
108
|
-
* @param
|
|
109
|
-
*
|
|
110
|
-
*
|
|
205
|
+
*
|
|
206
|
+
* @param name - Input layer name
|
|
207
|
+
* @param createIfNotExist - Input one flag to indicate whether to create layer group if it doesn't exist in
|
|
208
|
+
* this layout. Defaults to true.
|
|
209
|
+
* @returns Return matched layer, or undefined if not found and createIfNotExist is false
|
|
111
210
|
*/
|
|
112
211
|
private getLayer;
|
|
113
212
|
}
|
|
@@ -1 +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,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,CAAC,GAAG,EAAE,YAAY,EAAE;IAS5B;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,UAAU;IAQhC;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS;IAUjC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAO1B;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CASjB"}
|
package/lib/view/AcTrLayout.js
CHANGED
|
@@ -29,9 +29,33 @@ import RBush from 'rbush';
|
|
|
29
29
|
import * as THREE from 'three';
|
|
30
30
|
import { AcTrLayer } from './AcTrLayer';
|
|
31
31
|
/**
|
|
32
|
-
* This class represents objects contained in one
|
|
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
|
+
* ```
|
|
33
53
|
*/
|
|
34
54
|
var AcTrLayout = /** @class */ (function () {
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new layout instance.
|
|
57
|
+
* Initializes the layout with empty collections and a spatial index.
|
|
58
|
+
*/
|
|
35
59
|
function AcTrLayout() {
|
|
36
60
|
this._group = new THREE.Group();
|
|
37
61
|
this._indexTree = new RBush();
|
|
@@ -50,6 +74,11 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
50
74
|
configurable: true
|
|
51
75
|
});
|
|
52
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
|
+
*/
|
|
53
82
|
get: function () {
|
|
54
83
|
return this._layers;
|
|
55
84
|
},
|
|
@@ -57,6 +86,11 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
57
86
|
configurable: true
|
|
58
87
|
});
|
|
59
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
|
+
*/
|
|
60
94
|
get: function () {
|
|
61
95
|
return this._box;
|
|
62
96
|
},
|
|
@@ -65,7 +99,8 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
65
99
|
});
|
|
66
100
|
Object.defineProperty(AcTrLayout.prototype, "visible", {
|
|
67
101
|
/**
|
|
68
|
-
* The visibility of this layout
|
|
102
|
+
* The visibility of this layout.
|
|
103
|
+
* When set to false, the entire layout and all its contents are hidden.
|
|
69
104
|
*/
|
|
70
105
|
get: function () {
|
|
71
106
|
return this._group.visible;
|
|
@@ -78,7 +113,8 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
78
113
|
});
|
|
79
114
|
Object.defineProperty(AcTrLayout.prototype, "entityCount", {
|
|
80
115
|
/**
|
|
81
|
-
* The number of entities stored in this
|
|
116
|
+
* The number of entities stored in this layout.
|
|
117
|
+
* Calculates the total by summing entities across all layers.
|
|
82
118
|
*/
|
|
83
119
|
get: function () {
|
|
84
120
|
var count = 0;
|
|
@@ -90,7 +126,8 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
90
126
|
});
|
|
91
127
|
Object.defineProperty(AcTrLayout.prototype, "stats", {
|
|
92
128
|
/**
|
|
93
|
-
* The statistics of this layout
|
|
129
|
+
* The statistics of this layout.
|
|
130
|
+
* Provides detailed information about memory usage and entity counts.
|
|
94
131
|
*/
|
|
95
132
|
get: function () {
|
|
96
133
|
var layers = [];
|
|
@@ -128,6 +165,12 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
128
165
|
enumerable: false,
|
|
129
166
|
configurable: true
|
|
130
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
|
+
*/
|
|
131
174
|
AcTrLayout.prototype.clear = function () {
|
|
132
175
|
var _this = this;
|
|
133
176
|
this._layers.forEach(function (layer) {
|
|
@@ -139,8 +182,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
139
182
|
return this;
|
|
140
183
|
};
|
|
141
184
|
/**
|
|
142
|
-
* Re-render points with latest point style settings
|
|
143
|
-
*
|
|
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
|
|
144
189
|
*/
|
|
145
190
|
AcTrLayout.prototype.rerenderPoints = function (displayMode) {
|
|
146
191
|
this._layers.forEach(function (layer) {
|
|
@@ -149,8 +194,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
149
194
|
};
|
|
150
195
|
/**
|
|
151
196
|
* Return true if the object with the specified object id is intersected with the ray by using raycast.
|
|
152
|
-
*
|
|
153
|
-
* @param
|
|
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
|
|
154
201
|
*/
|
|
155
202
|
AcTrLayout.prototype.isIntersectWith = function (objectId, raycaster) {
|
|
156
203
|
var layer = this.getLayerByObjectId(objectId);
|
|
@@ -159,9 +206,13 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
159
206
|
/**
|
|
160
207
|
* Add one AutoCAD entity into this layout. If layer group referenced by the entity doesn't exist, create one
|
|
161
208
|
* layer group and add this entity this group.
|
|
162
|
-
*
|
|
163
|
-
* @param
|
|
164
|
-
* of the
|
|
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
|
|
165
216
|
*/
|
|
166
217
|
AcTrLayout.prototype.addEntity = function (entity, extendBbox) {
|
|
167
218
|
if (extendBbox === void 0) { extendBbox = true; }
|
|
@@ -190,7 +241,8 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
190
241
|
};
|
|
191
242
|
/**
|
|
192
243
|
* Remove the specified entity from this layout.
|
|
193
|
-
*
|
|
244
|
+
*
|
|
245
|
+
* @param objectId - Input the object id of the entity to remove
|
|
194
246
|
* @returns Return true if remove the specified entity successfully. Otherwise, return false.
|
|
195
247
|
*/
|
|
196
248
|
AcTrLayout.prototype.remove = function (objectId) {
|
|
@@ -213,7 +265,8 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
213
265
|
};
|
|
214
266
|
/**
|
|
215
267
|
* Update the specified entity in this layout.
|
|
216
|
-
*
|
|
268
|
+
*
|
|
269
|
+
* @param entity - Input the entity to update
|
|
217
270
|
* @returns Return true if update the specified entity successfully. Otherwise, return false.
|
|
218
271
|
*/
|
|
219
272
|
AcTrLayout.prototype.update = function (entity) {
|
|
@@ -235,7 +288,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
235
288
|
return false;
|
|
236
289
|
};
|
|
237
290
|
/**
|
|
238
|
-
* Hover the specified entities
|
|
291
|
+
* Hover the specified entities.
|
|
292
|
+
* Applies hover highlighting to the entities with the given IDs.
|
|
293
|
+
*
|
|
294
|
+
* @param ids - Array of entity object IDs to hover
|
|
239
295
|
*/
|
|
240
296
|
AcTrLayout.prototype.hover = function (ids) {
|
|
241
297
|
var _this = this;
|
|
@@ -247,7 +303,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
247
303
|
});
|
|
248
304
|
};
|
|
249
305
|
/**
|
|
250
|
-
* Unhover the specified entities
|
|
306
|
+
* Unhover the specified entities.
|
|
307
|
+
* Removes hover highlighting from the entities with the given IDs.
|
|
308
|
+
*
|
|
309
|
+
* @param ids - Array of entity object IDs to unhover
|
|
251
310
|
*/
|
|
252
311
|
AcTrLayout.prototype.unhover = function (ids) {
|
|
253
312
|
var _this = this;
|
|
@@ -259,7 +318,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
259
318
|
});
|
|
260
319
|
};
|
|
261
320
|
/**
|
|
262
|
-
* Select the specified entities
|
|
321
|
+
* Select the specified entities.
|
|
322
|
+
* Applies selection highlighting to the entities with the given IDs.
|
|
323
|
+
*
|
|
324
|
+
* @param ids - Array of entity object IDs to select
|
|
263
325
|
*/
|
|
264
326
|
AcTrLayout.prototype.select = function (ids) {
|
|
265
327
|
var _this = this;
|
|
@@ -271,7 +333,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
271
333
|
});
|
|
272
334
|
};
|
|
273
335
|
/**
|
|
274
|
-
* Unselect the specified entities
|
|
336
|
+
* Unselect the specified entities.
|
|
337
|
+
* Removes selection highlighting from the entities with the given IDs.
|
|
338
|
+
*
|
|
339
|
+
* @param ids - Array of entity object IDs to unselect
|
|
275
340
|
*/
|
|
276
341
|
AcTrLayout.prototype.unselect = function (ids) {
|
|
277
342
|
var _this = this;
|
|
@@ -282,6 +347,12 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
282
347
|
}
|
|
283
348
|
});
|
|
284
349
|
};
|
|
350
|
+
/**
|
|
351
|
+
* Sets the snap points object for this layout.
|
|
352
|
+
* Replaces any existing snap points object with the new one.
|
|
353
|
+
*
|
|
354
|
+
* @param object - The snap points object to display
|
|
355
|
+
*/
|
|
285
356
|
AcTrLayout.prototype.setSnapObject = function (object) {
|
|
286
357
|
if (this._snapPointsObject) {
|
|
287
358
|
this._group.remove(this._snapPointsObject);
|
|
@@ -291,8 +362,10 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
291
362
|
};
|
|
292
363
|
/**
|
|
293
364
|
* Search entities intersected or contained in the specified bounding box.
|
|
294
|
-
*
|
|
295
|
-
*
|
|
365
|
+
* Uses the spatial index for efficient querying of entities within the given bounds.
|
|
366
|
+
*
|
|
367
|
+
* @param box - Input the query bounding box (2D or 3D)
|
|
368
|
+
* @returns Return query results containing entity IDs and their bounds
|
|
296
369
|
*/
|
|
297
370
|
AcTrLayout.prototype.search = function (box) {
|
|
298
371
|
var results = this._indexTree.search({
|
|
@@ -303,6 +376,12 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
303
376
|
});
|
|
304
377
|
return results;
|
|
305
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* Finds the layer containing the entity with the specified object ID.
|
|
381
|
+
*
|
|
382
|
+
* @param objectId - The object ID to search for
|
|
383
|
+
* @returns The layer containing the entity, or undefined if not found
|
|
384
|
+
*/
|
|
306
385
|
AcTrLayout.prototype.getLayerByObjectId = function (objectId) {
|
|
307
386
|
var e_3, _a;
|
|
308
387
|
try {
|
|
@@ -323,10 +402,11 @@ var AcTrLayout = /** @class */ (function () {
|
|
|
323
402
|
};
|
|
324
403
|
/**
|
|
325
404
|
* Get layer group by name. If the layer doesn't exist, create one layer group into this layout.
|
|
326
|
-
*
|
|
327
|
-
* @param
|
|
328
|
-
*
|
|
329
|
-
*
|
|
405
|
+
*
|
|
406
|
+
* @param name - Input layer name
|
|
407
|
+
* @param createIfNotExist - Input one flag to indicate whether to create layer group if it doesn't exist in
|
|
408
|
+
* this layout. Defaults to true.
|
|
409
|
+
* @returns Return matched layer, or undefined if not found and createIfNotExist is false
|
|
330
410
|
*/
|
|
331
411
|
AcTrLayout.prototype.getLayer = function (name, createIfNotExist) {
|
|
332
412
|
if (createIfNotExist === void 0) { createIfNotExist = true; }
|
|
@@ -1 +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;
|
|
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,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;IAOD,sBAAI,8BAAM;QALV;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,OAAO,CAAA;QACrB,CAAC;;;OAAA;IAOD,sBAAI,2BAAG;QALP;;;;WAIG;aACH;YACE,OAAO,IAAI,CAAC,IAAI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C,SAAS,CAAC,QAAQ,CAAC;oBAAE,OAAO,KAAK,CAAA;YAC7C,CAAC;;;;;;;;;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;;;;OAOG;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,AA7UD,IA6UC"}
|
|
@@ -1,56 +1,114 @@
|
|
|
1
1
|
import { AcTrBaseView, AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
|
|
2
2
|
import { AcEdViewMode } from '../editor/view/AcEdBaseView';
|
|
3
3
|
import { AcTrScene } from './AcTrScene';
|
|
4
|
+
/**
|
|
5
|
+
* Interface for database entity event arguments.
|
|
6
|
+
* Provides context information for entity-related events.
|
|
7
|
+
*/
|
|
4
8
|
export interface AcDbEntityEventArgs {
|
|
9
|
+
/** The layout view associated with the event */
|
|
5
10
|
view: AcTrLayoutView;
|
|
6
11
|
}
|
|
7
12
|
/**
|
|
8
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
|
+
* ```
|
|
9
33
|
*/
|
|
10
34
|
export declare class AcTrLayoutView extends AcTrBaseView {
|
|
35
|
+
/** The block table record ID associated with this layout */
|
|
11
36
|
private _layoutBtrId;
|
|
37
|
+
/** The axes gizmo for showing coordinate system orientation */
|
|
12
38
|
private _axesGizmo;
|
|
39
|
+
/** The current view mode (selection, pan, etc.) */
|
|
13
40
|
private _mode;
|
|
41
|
+
/** Map of viewport views indexed by viewport ID */
|
|
14
42
|
private _viewportViews;
|
|
15
43
|
/**
|
|
16
|
-
* Construct one instance of this class
|
|
17
|
-
*
|
|
18
|
-
* @param renderer Input renderer
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
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
|
|
21
50
|
*/
|
|
22
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
|
+
*/
|
|
23
57
|
get layoutBtrId(): string;
|
|
24
58
|
/**
|
|
25
|
-
* The view mode of the current layout view
|
|
59
|
+
* The view mode of the current layout view.
|
|
60
|
+
* Controls how mouse interactions are interpreted (selection vs pan mode).
|
|
26
61
|
*/
|
|
27
62
|
get mode(): AcEdViewMode;
|
|
28
63
|
set mode(value: AcEdViewMode);
|
|
29
64
|
/**
|
|
30
|
-
* The number of viewports in this layout view
|
|
65
|
+
* The number of viewports in this layout view.
|
|
66
|
+
* Paper space layouts can contain multiple viewports showing different views of model space.
|
|
31
67
|
*/
|
|
32
68
|
get viewportCount(): number;
|
|
33
69
|
/**
|
|
34
|
-
* Add one viewport view instance to this layout view
|
|
35
|
-
*
|
|
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
|
|
36
74
|
*/
|
|
37
75
|
addViewport(viewportView: AcTrViewportView): void;
|
|
38
76
|
/**
|
|
39
|
-
* Remove the specified viewport view by its id from this layout view
|
|
40
|
-
*
|
|
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
|
|
41
80
|
*/
|
|
42
81
|
removeViewport(id: string): void;
|
|
43
82
|
/**
|
|
44
|
-
* Resize this layout view
|
|
45
|
-
*
|
|
46
|
-
*
|
|
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
|
|
47
88
|
*/
|
|
48
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
|
+
*/
|
|
49
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
|
+
*/
|
|
50
105
|
private createAxesGizmo;
|
|
51
106
|
/**
|
|
52
|
-
* Draw viewports
|
|
53
|
-
*
|
|
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
|
|
54
112
|
*/
|
|
55
113
|
private drawViewports;
|
|
56
114
|
}
|