@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
|
@@ -2,26 +2,100 @@ import { AcCmEventManager, AcGeBox3d, AcGePoint2d } from '@mlightcad/data-model'
|
|
|
2
2
|
import { AcEdCorsorType, AcEdSelectionSet } from '../input';
|
|
3
3
|
import { AcEditor } from '../input/AcEditor';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Enumeration of view interaction modes.
|
|
6
|
+
*
|
|
7
|
+
* The view mode determines how the view responds to user mouse interactions:
|
|
8
|
+
* - In SELECTION mode, clicks select entities
|
|
9
|
+
* - In PAN mode, clicks and drags pan the view
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Set to selection mode for entity picking
|
|
14
|
+
* view.mode = AcEdViewMode.SELECTION;
|
|
15
|
+
*
|
|
16
|
+
* // Set to pan mode for view navigation
|
|
17
|
+
* view.mode = AcEdViewMode.PAN;
|
|
18
|
+
* ```
|
|
6
19
|
*/
|
|
7
20
|
export var AcEdViewMode;
|
|
8
21
|
(function (AcEdViewMode) {
|
|
9
22
|
/**
|
|
10
|
-
*
|
|
23
|
+
* Selection mode - mouse clicks select entities.
|
|
24
|
+
*
|
|
25
|
+
* In this mode:
|
|
26
|
+
* - Single clicks select individual entities
|
|
27
|
+
* - Drag operations can create selection boxes
|
|
28
|
+
* - Selected entities are highlighted with grip points
|
|
11
29
|
*/
|
|
12
30
|
AcEdViewMode[AcEdViewMode["SELECTION"] = 0] = "SELECTION";
|
|
13
31
|
/**
|
|
14
|
-
*
|
|
32
|
+
* Pan mode - mouse interactions pan the view.
|
|
33
|
+
*
|
|
34
|
+
* In this mode:
|
|
35
|
+
* - Click and drag operations move the view
|
|
36
|
+
* - The cursor typically changes to indicate pan mode
|
|
37
|
+
* - Entity selection is disabled
|
|
15
38
|
*/
|
|
16
39
|
AcEdViewMode[AcEdViewMode["PAN"] = 1] = "PAN";
|
|
17
40
|
})(AcEdViewMode || (AcEdViewMode = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Abstract base class for all CAD view implementations.
|
|
43
|
+
*
|
|
44
|
+
* This class provides the foundation for rendering and interacting with CAD drawings.
|
|
45
|
+
* It manages:
|
|
46
|
+
* - Canvas and viewport dimensions
|
|
47
|
+
* - Mouse event handling and coordinate conversion
|
|
48
|
+
* - Entity selection and highlighting
|
|
49
|
+
* - View modes (selection, pan, etc.)
|
|
50
|
+
* - Spatial queries for entity picking
|
|
51
|
+
* - Hover/unhover detection with timing
|
|
52
|
+
*
|
|
53
|
+
* Concrete implementations must provide specific rendering logic and coordinate
|
|
54
|
+
* transformations appropriate for their rendering technology (e.g., Three.js, SVG).
|
|
55
|
+
*
|
|
56
|
+
* ## Key Responsibilities
|
|
57
|
+
* - **Input Management**: Handles mouse events and user interactions
|
|
58
|
+
* - **Selection**: Manages selected entities and visual feedback
|
|
59
|
+
* - **Coordinate Systems**: Converts between screen and world coordinates
|
|
60
|
+
* - **Spatial Queries**: Finds entities at specific locations
|
|
61
|
+
* - **View State**: Tracks current position, zoom, and view mode
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* class MyView extends AcEdBaseView {
|
|
66
|
+
* // Implement required abstract methods
|
|
67
|
+
* get missedData() { return { fonts: {}, images: new Map() }; }
|
|
68
|
+
* get mode() { return this._mode; }
|
|
69
|
+
* set mode(value) { this._mode = value; }
|
|
70
|
+
* // ... other abstract methods
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* const view = new MyView(canvasElement);
|
|
74
|
+
* view.events.mouseMove.addEventListener(args => {
|
|
75
|
+
* console.log('Mouse at world coords:', args.x, args.y);
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
18
79
|
var AcEdBaseView = /** @class */ (function () {
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new base view instance.
|
|
82
|
+
*
|
|
83
|
+
* Sets up the canvas, initializes internal state, and registers event listeners
|
|
84
|
+
* for mouse interactions and window resize events.
|
|
85
|
+
*
|
|
86
|
+
* @param canvas - The HTML canvas element to render into
|
|
87
|
+
*/
|
|
19
88
|
function AcEdBaseView(canvas) {
|
|
20
89
|
var _this = this;
|
|
90
|
+
/** Events fired by the view for various interactions */
|
|
21
91
|
this.events = {
|
|
92
|
+
/** Fired when mouse moves over the view */
|
|
22
93
|
mouseMove: new AcCmEventManager(),
|
|
94
|
+
/** Fired when the view is resized */
|
|
23
95
|
viewResize: new AcCmEventManager(),
|
|
96
|
+
/** Fired when mouse hovers over an entity */
|
|
24
97
|
hover: new AcCmEventManager(),
|
|
98
|
+
/** Fired when mouse stops hovering over an entity */
|
|
25
99
|
unhover: new AcCmEventManager()
|
|
26
100
|
};
|
|
27
101
|
this._canvas = canvas;
|
|
@@ -55,7 +129,12 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
55
129
|
}
|
|
56
130
|
Object.defineProperty(AcEdBaseView.prototype, "editor", {
|
|
57
131
|
/**
|
|
58
|
-
*
|
|
132
|
+
* Gets the input manager for handling user interactions.
|
|
133
|
+
*
|
|
134
|
+
* The editor provides high-level methods for getting user input like
|
|
135
|
+
* point selection, entity selection, and cursor management.
|
|
136
|
+
*
|
|
137
|
+
* @returns The editor instance
|
|
59
138
|
*/
|
|
60
139
|
get: function () {
|
|
61
140
|
return this._editor;
|
|
@@ -65,11 +144,21 @@ var AcEdBaseView = /** @class */ (function () {
|
|
|
65
144
|
});
|
|
66
145
|
Object.defineProperty(AcEdBaseView.prototype, "selectionBoxSize", {
|
|
67
146
|
/**
|
|
68
|
-
*
|
|
147
|
+
* Gets the size of the selection box used for entity picking.
|
|
148
|
+
*
|
|
149
|
+
* This determines how close the mouse needs to be to an entity
|
|
150
|
+
* to select it, measured in screen pixels.
|
|
151
|
+
*
|
|
152
|
+
* @returns Selection box size in pixels
|
|
69
153
|
*/
|
|
70
154
|
get: function () {
|
|
71
155
|
return this._selectionBoxSize;
|
|
72
156
|
},
|
|
157
|
+
/**
|
|
158
|
+
* Sets the size of the selection box used for entity picking.
|
|
159
|
+
*
|
|
160
|
+
* @param value - Selection box size in pixels
|
|
161
|
+
*/
|
|
73
162
|
set: function (value) {
|
|
74
163
|
this._selectionBoxSize = value;
|
|
75
164
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcEdBaseView.js","sourceRoot":"","sources":["../../../src/editor/view/AcEdBaseView.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,WAAW,EAEZ,MAAM,uBA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E,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAEO,sCAAe,GAAvB,UAAwB,CAAS,EAAE,CAAS;QAA5C,iBAKC;QAJC,IAAI,CAAC,eAAe,EAAE,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACpB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;IAEO,sCAAe,GAAvB,UAAwB,EAAgB;QAAxC,iBAQC;QAPC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC5B,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;gBACzB,EAAE,EAAE,EAAE;gBACN,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;gBACtB,CAAC,EAAE,KAAI,CAAC,YAAY,CAAC,CAAC;aACvB,CAAC,CAAA;QACJ,CAAC,EAAE,GAAG,CAAC,CAAA;IACT,CAAC;IACH,mBAAC;AAAD,CAAC,AAhbD,IAgbC"}
|
|
@@ -1,17 +1,82 @@
|
|
|
1
1
|
import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Three.js Box3 to a CAD geometry Box3d.
|
|
5
|
+
*
|
|
6
|
+
* @param from - The Three.js Box3 to convert
|
|
7
|
+
* @returns The equivalent CAD geometry Box3d
|
|
8
|
+
*/
|
|
3
9
|
declare const threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a CAD geometry Box3d to a Three.js Box3.
|
|
12
|
+
*
|
|
13
|
+
* @param from - The CAD geometry Box3d to convert
|
|
14
|
+
* @returns The equivalent Three.js Box3
|
|
15
|
+
*/
|
|
4
16
|
declare const goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a Three.js Box2 to a CAD geometry Box2d.
|
|
19
|
+
*
|
|
20
|
+
* @param from - The Three.js Box2 to convert
|
|
21
|
+
* @returns The equivalent CAD geometry Box2d
|
|
22
|
+
*/
|
|
5
23
|
declare const threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a CAD geometry Box2d to a Three.js Box2.
|
|
26
|
+
*
|
|
27
|
+
* @param from - The CAD geometry Box2d to convert
|
|
28
|
+
* @returns The equivalent Three.js Box2
|
|
29
|
+
*/
|
|
6
30
|
declare const goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
|
|
31
|
+
/**
|
|
32
|
+
* Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
|
|
33
|
+
*
|
|
34
|
+
* @param from - The Three.js Box3 to convert
|
|
35
|
+
* @returns The equivalent CAD geometry Box2d (Z dimension discarded)
|
|
36
|
+
*/
|
|
7
37
|
declare const threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
|
|
38
|
+
/**
|
|
39
|
+
* Converts a CAD geometry Box2d to a Three.js Box3 by setting Z dimension to 0.
|
|
40
|
+
*
|
|
41
|
+
* @param from - The CAD geometry Box2d to convert
|
|
42
|
+
* @returns The equivalent Three.js Box3 with Z=0
|
|
43
|
+
*/
|
|
8
44
|
declare const goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
|
|
45
|
+
/**
|
|
46
|
+
* Utility object containing geometry conversion functions between Three.js and CAD geometry types.
|
|
47
|
+
*
|
|
48
|
+
* This utility provides bidirectional conversion functions for bounding boxes:
|
|
49
|
+
* - Between 2D and 3D bounding boxes
|
|
50
|
+
* - Between Three.js and CAD geometry coordinate systems
|
|
51
|
+
* - Cross-dimensional conversions (2D ↔ 3D)
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* // Convert Three.js box to CAD geometry
|
|
56
|
+
* const threeBox = new THREE.Box3();
|
|
57
|
+
* const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
|
|
58
|
+
*
|
|
59
|
+
* // Convert CAD geometry box to Three.js
|
|
60
|
+
* const cadBox2d = new AcGeBox2d();
|
|
61
|
+
* const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
|
|
62
|
+
*
|
|
63
|
+
* // Cross-dimensional conversion
|
|
64
|
+
* const threeBox3d = new THREE.Box3();
|
|
65
|
+
* const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
9
68
|
declare const AcTrGeometryUtil: {
|
|
69
|
+
/** Converts Three.js Box2 to CAD geometry Box2d */
|
|
10
70
|
threeBo2dToGeBox2d: (from: THREE.Box2) => AcGeBox2d;
|
|
71
|
+
/** Converts CAD geometry Box2d to Three.js Box2 */
|
|
11
72
|
goBox2dToThreeBox2d: (from: AcGeBox2d) => THREE.Box2;
|
|
73
|
+
/** Converts Three.js Box3 to CAD geometry Box3d */
|
|
12
74
|
threeBox3dToGeBox3d: (from: THREE.Box3) => AcGeBox3d;
|
|
75
|
+
/** Converts CAD geometry Box3d to Three.js Box3 */
|
|
13
76
|
goBox3dToThreeBox3d: (from: AcGeBox3d) => THREE.Box3;
|
|
77
|
+
/** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
|
|
14
78
|
threeBox3dToGeBox2d: (from: THREE.Box3) => AcGeBox2d;
|
|
79
|
+
/** Converts CAD geometry Box2d to Three.js Box3 (Z=0) */
|
|
15
80
|
goBox2dToThreeBox3d: (from: AcGeBox2d) => THREE.Box3;
|
|
16
81
|
};
|
|
17
82
|
export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d, goBox2dToThreeBox3d, AcTrGeometryUtil };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,kBAAkB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE3C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED,QAAA,MAAM,gBAAgB;+
|
|
1
|
+
{"version":3,"file":"AcTrGeometryUtil.d.ts","sourceRoot":"","sources":["../../src/util/AcTrGeometryUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE3C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,KAAK,CAAC,IAAI,cAE5C,CAAA;AAED;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,MAAM,SAAS,eAK3C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,gBAAgB;IACpB,mDAAmD;+BAhEnB,KAAK,CAAC,IAAI;IAkE1C,mDAAmD;gCAxDlB,SAAS;IA0D1C,mDAAmD;gCA3FlB,KAAK,CAAC,IAAI;IA6F3C,mDAAmD;gCAnFlB,SAAS;IAqF1C,+DAA+D;gCAjD9B,KAAK,CAAC,IAAI;IAmD3C,yDAAyD;gCAzCxB,SAAS;CA2C3C,CAAA;AAED,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EACjB,CAAA"}
|
|
@@ -1,32 +1,97 @@
|
|
|
1
1
|
import { AcGeBox2d, AcGeBox3d } from '@mlightcad/data-model';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Three.js Box3 to a CAD geometry Box3d.
|
|
5
|
+
*
|
|
6
|
+
* @param from - The Three.js Box3 to convert
|
|
7
|
+
* @returns The equivalent CAD geometry Box3d
|
|
8
|
+
*/
|
|
3
9
|
var threeBox3dToGeBox3d = function (from) {
|
|
4
10
|
return new AcGeBox3d(from.min, from.max);
|
|
5
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Converts a CAD geometry Box3d to a Three.js Box3.
|
|
14
|
+
*
|
|
15
|
+
* @param from - The CAD geometry Box3d to convert
|
|
16
|
+
* @returns The equivalent Three.js Box3
|
|
17
|
+
*/
|
|
6
18
|
var goBox3dToThreeBox3d = function (from) {
|
|
7
19
|
return new THREE.Box3(from.min, from.max);
|
|
8
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Converts a Three.js Box2 to a CAD geometry Box2d.
|
|
23
|
+
*
|
|
24
|
+
* @param from - The Three.js Box2 to convert
|
|
25
|
+
* @returns The equivalent CAD geometry Box2d
|
|
26
|
+
*/
|
|
9
27
|
var threeBo2dToGeBox2d = function (from) {
|
|
10
28
|
return new AcGeBox2d(from.min, from.max);
|
|
11
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Converts a CAD geometry Box2d to a Three.js Box2.
|
|
32
|
+
*
|
|
33
|
+
* @param from - The CAD geometry Box2d to convert
|
|
34
|
+
* @returns The equivalent Three.js Box2
|
|
35
|
+
*/
|
|
12
36
|
var goBox2dToThreeBox2d = function (from) {
|
|
13
37
|
return new THREE.Box2(from.min, from.max);
|
|
14
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Converts a Three.js Box3 to a CAD geometry Box2d by ignoring the Z dimension.
|
|
41
|
+
*
|
|
42
|
+
* @param from - The Three.js Box3 to convert
|
|
43
|
+
* @returns The equivalent CAD geometry Box2d (Z dimension discarded)
|
|
44
|
+
*/
|
|
15
45
|
var threeBox3dToGeBox2d = function (from) {
|
|
16
46
|
return new AcGeBox2d(from.min, from.max);
|
|
17
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Converts a CAD geometry Box2d to a Three.js Box3 by setting Z dimension to 0.
|
|
50
|
+
*
|
|
51
|
+
* @param from - The CAD geometry Box2d to convert
|
|
52
|
+
* @returns The equivalent Three.js Box3 with Z=0
|
|
53
|
+
*/
|
|
18
54
|
var goBox2dToThreeBox3d = function (from) {
|
|
19
55
|
var threeBox3d = new THREE.Box3();
|
|
20
56
|
threeBox3d.min.set(from.min.x, from.min.y, 0);
|
|
21
57
|
threeBox3d.max.set(from.max.x, from.max.y, 0);
|
|
22
58
|
return threeBox3d;
|
|
23
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* Utility object containing geometry conversion functions between Three.js and CAD geometry types.
|
|
62
|
+
*
|
|
63
|
+
* This utility provides bidirectional conversion functions for bounding boxes:
|
|
64
|
+
* - Between 2D and 3D bounding boxes
|
|
65
|
+
* - Between Three.js and CAD geometry coordinate systems
|
|
66
|
+
* - Cross-dimensional conversions (2D ↔ 3D)
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* // Convert Three.js box to CAD geometry
|
|
71
|
+
* const threeBox = new THREE.Box3();
|
|
72
|
+
* const cadBox = AcTrGeometryUtil.threeBox3dToGeBox3d(threeBox);
|
|
73
|
+
*
|
|
74
|
+
* // Convert CAD geometry box to Three.js
|
|
75
|
+
* const cadBox2d = new AcGeBox2d();
|
|
76
|
+
* const threeBox2d = AcTrGeometryUtil.goBox2dToThreeBox2d(cadBox2d);
|
|
77
|
+
*
|
|
78
|
+
* // Cross-dimensional conversion
|
|
79
|
+
* const threeBox3d = new THREE.Box3();
|
|
80
|
+
* const cadBox2d = AcTrGeometryUtil.threeBox3dToGeBox2d(threeBox3d);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
24
83
|
var AcTrGeometryUtil = {
|
|
84
|
+
/** Converts Three.js Box2 to CAD geometry Box2d */
|
|
25
85
|
threeBo2dToGeBox2d: threeBo2dToGeBox2d,
|
|
86
|
+
/** Converts CAD geometry Box2d to Three.js Box2 */
|
|
26
87
|
goBox2dToThreeBox2d: goBox2dToThreeBox2d,
|
|
88
|
+
/** Converts Three.js Box3 to CAD geometry Box3d */
|
|
27
89
|
threeBox3dToGeBox3d: threeBox3dToGeBox3d,
|
|
90
|
+
/** Converts CAD geometry Box3d to Three.js Box3 */
|
|
28
91
|
goBox3dToThreeBox3d: goBox3dToThreeBox3d,
|
|
92
|
+
/** Converts Three.js Box3 to CAD geometry Box2d (ignores Z) */
|
|
29
93
|
threeBox3dToGeBox2d: threeBox3dToGeBox2d,
|
|
94
|
+
/** Converts CAD geometry Box2d to Three.js Box3 (Z=0) */
|
|
30
95
|
goBox2dToThreeBox3d: goBox2dToThreeBox3d
|
|
31
96
|
};
|
|
32
97
|
export { threeBo2dToGeBox2d, goBox2dToThreeBox2d, threeBox3dToGeBox3d, goBox3dToThreeBox3d, threeBox3dToGeBox2d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 @@
|
|
|
1
1
|
import { AcDbObjectId } from '@mlightcad/data-model';
|
|
2
2
|
import { AcTrBatchedGroup, AcTrBatchedGroupStats, AcTrEntity } from '@mlightcad/three-renderer';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
|
+
/**
|
|
5
|
+
* Statistics for a CAD layer including name and batched rendering metrics.
|
|
6
|
+
*
|
|
7
|
+
* Extends the standard batched group statistics with layer-specific information.
|
|
8
|
+
*/
|
|
4
9
|
export type AcTrLayerStats = AcTrBatchedGroupStats & {
|
|
10
|
+
/** The name of the layer */
|
|
5
11
|
name: string;
|
|
6
12
|
};
|
|
7
13
|
/**
|
|
8
|
-
*
|
|
14
|
+
* Represents a CAD layer for organizing and rendering entities in Three.js.
|
|
15
|
+
*
|
|
16
|
+
* This class manages a collection of CAD entities that belong to the same logical layer.
|
|
17
|
+
* It provides:
|
|
18
|
+
* - Entity organization and grouping
|
|
19
|
+
* - Layer visibility control
|
|
20
|
+
* - Efficient batched rendering through Three.js groups
|
|
21
|
+
* - Performance monitoring and statistics
|
|
22
|
+
*
|
|
23
|
+
* ## Technical Notes
|
|
24
|
+
* Unlike Three.js built-in layers (which only support 32 layers), this implementation
|
|
25
|
+
* uses Three.js groups to represent AutoCAD layers, allowing unlimited layer support.
|
|
26
|
+
* Each AutoCAD layer corresponds to one Three.js group containing all entities.
|
|
27
|
+
*
|
|
28
|
+
* ## Performance Benefits
|
|
29
|
+
* - Batched rendering reduces draw calls
|
|
30
|
+
* - Efficient visibility toggling for entire layers
|
|
31
|
+
* - Optimized entity grouping for better GPU performance
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Create a new layer
|
|
36
|
+
* const layer = new AcTrLayer('Dimensions');
|
|
37
|
+
*
|
|
38
|
+
* // Add entities to the layer
|
|
39
|
+
* const line = new AcTrLine(startPoint, endPoint);
|
|
40
|
+
* layer.add(line);
|
|
41
|
+
*
|
|
42
|
+
* // Control layer visibility
|
|
43
|
+
* layer.visible = false; // Hide all entities in this layer
|
|
9
44
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
45
|
+
* // Get layer statistics
|
|
46
|
+
* const stats = layer.stats;
|
|
47
|
+
* console.log(`Layer ${stats.name} has ${stats.entityCount} entities`);
|
|
48
|
+
* ```
|
|
14
49
|
*/
|
|
15
50
|
export declare class AcTrLayer {
|
|
16
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcTrLayer.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACX,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG;IACnD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"AcTrLayer.d.ts","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACX,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG;IACnD,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,OAAO,CAAC,KAAK,CAAQ;IACrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAkB;IAEhC;;;OAGG;gBACS,IAAI,EAAE,MAAM;IAKxB;;OAEG;IACH,IAAI,IAAI,IAGQ,MAAM,CADrB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED,IAAI,OAAO,IAGQ,OAAO,CADzB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAED,IAAI,cAAc,qBAEjB;IAED;;OAEG;IACH,IAAI,KAAK,IAKF,cAAc,CACpB;IAED;;OAEG;IACH,IAAI,WAAW,WAEd;IAED;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM;IAIlC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY;IAIhC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU;IAI5B;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS;IAI5D;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,GAAG,OAAO;IAKxC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO;IAMnC;;OAEG;IACH,KAAK,CAAC,GAAG,EAAE,YAAY,EAAE;IAMzB;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE;IAM3B;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE;IAM1B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE;CAK7B"}
|
package/lib/view/AcTrLayer.js
CHANGED
|
@@ -11,12 +11,41 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { AcTrBatchedGroup } from '@mlightcad/three-renderer';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Represents a CAD layer for organizing and rendering entities in Three.js.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* This class manages a collection of CAD entities that belong to the same logical layer.
|
|
17
|
+
* It provides:
|
|
18
|
+
* - Entity organization and grouping
|
|
19
|
+
* - Layer visibility control
|
|
20
|
+
* - Efficient batched rendering through Three.js groups
|
|
21
|
+
* - Performance monitoring and statistics
|
|
22
|
+
*
|
|
23
|
+
* ## Technical Notes
|
|
24
|
+
* Unlike Three.js built-in layers (which only support 32 layers), this implementation
|
|
25
|
+
* uses Three.js groups to represent AutoCAD layers, allowing unlimited layer support.
|
|
26
|
+
* Each AutoCAD layer corresponds to one Three.js group containing all entities.
|
|
27
|
+
*
|
|
28
|
+
* ## Performance Benefits
|
|
29
|
+
* - Batched rendering reduces draw calls
|
|
30
|
+
* - Efficient visibility toggling for entire layers
|
|
31
|
+
* - Optimized entity grouping for better GPU performance
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* // Create a new layer
|
|
36
|
+
* const layer = new AcTrLayer('Dimensions');
|
|
37
|
+
*
|
|
38
|
+
* // Add entities to the layer
|
|
39
|
+
* const line = new AcTrLine(startPoint, endPoint);
|
|
40
|
+
* layer.add(line);
|
|
41
|
+
*
|
|
42
|
+
* // Control layer visibility
|
|
43
|
+
* layer.visible = false; // Hide all entities in this layer
|
|
44
|
+
*
|
|
45
|
+
* // Get layer statistics
|
|
46
|
+
* const stats = layer.stats;
|
|
47
|
+
* console.log(`Layer ${stats.name} has ${stats.entityCount} entities`);
|
|
48
|
+
* ```
|
|
20
49
|
*/
|
|
21
50
|
var AcTrLayer = /** @class */ (function () {
|
|
22
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcTrLayer.js","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EACL,gBAAgB,EAGjB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"AcTrLayer.js","sourceRoot":"","sources":["../../src/view/AcTrLayer.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EACL,gBAAgB,EAGjB,MA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