@mlightcad/cad-simple-viewer 1.2.1 → 1.2.2
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/package.json +6 -6
- package/dist/index.js +0 -33474
- package/dist/index.umd.cjs +0 -294
- package/dist/libredwg-parser-worker.js +0 -15411
- package/dist/mtext-renderer-worker.js +0 -29938
- package/lib/app/AcApContext.d.ts +0 -57
- package/lib/app/AcApContext.d.ts.map +0 -1
- package/lib/app/AcApContext.js +0 -106
- package/lib/app/AcApContext.js.map +0 -1
- package/lib/app/AcApDocManager.d.ts +0 -291
- package/lib/app/AcApDocManager.d.ts.map +0 -1
- package/lib/app/AcApDocManager.js +0 -498
- package/lib/app/AcApDocManager.js.map +0 -1
- package/lib/app/AcApDocument.d.ts +0 -101
- package/lib/app/AcApDocument.d.ts.map +0 -1
- package/lib/app/AcApDocument.js +0 -237
- package/lib/app/AcApDocument.js.map +0 -1
- package/lib/app/AcApFontLoader.d.ts +0 -54
- package/lib/app/AcApFontLoader.d.ts.map +0 -1
- package/lib/app/AcApFontLoader.js +0 -151
- package/lib/app/AcApFontLoader.js.map +0 -1
- package/lib/app/AcApGlobalFunc.d.ts +0 -26
- package/lib/app/AcApGlobalFunc.d.ts.map +0 -1
- package/lib/app/AcApGlobalFunc.js +0 -66
- package/lib/app/AcApGlobalFunc.js.map +0 -1
- package/lib/app/AcApSettingManager.d.ts +0 -232
- package/lib/app/AcApSettingManager.d.ts.map +0 -1
- package/lib/app/AcApSettingManager.js +0 -283
- package/lib/app/AcApSettingManager.js.map +0 -1
- package/lib/app/index.d.ts +0 -6
- package/lib/app/index.d.ts.map +0 -1
- package/lib/app/index.js +0 -6
- package/lib/app/index.js.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts +0 -32
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.js +0 -56
- package/lib/command/AcApConvertToSvgCmd.js.map +0 -1
- package/lib/command/AcApOpenCmd.d.ts +0 -37
- package/lib/command/AcApOpenCmd.d.ts.map +0 -1
- package/lib/command/AcApOpenCmd.js +0 -60
- package/lib/command/AcApOpenCmd.js.map +0 -1
- package/lib/command/AcApPanCmd.d.ts +0 -31
- package/lib/command/AcApPanCmd.d.ts.map +0 -1
- package/lib/command/AcApPanCmd.js +0 -55
- package/lib/command/AcApPanCmd.js.map +0 -1
- package/lib/command/AcApQNewCmd.d.ts +0 -32
- package/lib/command/AcApQNewCmd.d.ts.map +0 -1
- package/lib/command/AcApQNewCmd.js +0 -56
- package/lib/command/AcApQNewCmd.js.map +0 -1
- package/lib/command/AcApRegenCmd.d.ts +0 -21
- package/lib/command/AcApRegenCmd.d.ts.map +0 -1
- package/lib/command/AcApRegenCmd.js +0 -45
- package/lib/command/AcApRegenCmd.js.map +0 -1
- package/lib/command/AcApSelectCmd.d.ts +0 -32
- package/lib/command/AcApSelectCmd.d.ts.map +0 -1
- package/lib/command/AcApSelectCmd.js +0 -56
- package/lib/command/AcApSelectCmd.js.map +0 -1
- package/lib/command/AcApSvgConvertor.d.ts +0 -53
- package/lib/command/AcApSvgConvertor.d.ts.map +0 -1
- package/lib/command/AcApSvgConvertor.js +0 -103
- package/lib/command/AcApSvgConvertor.js.map +0 -1
- package/lib/command/AcApZoomCmd.d.ts +0 -35
- package/lib/command/AcApZoomCmd.d.ts.map +0 -1
- package/lib/command/AcApZoomCmd.js +0 -57
- package/lib/command/AcApZoomCmd.js.map +0 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +0 -68
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
- package/lib/command/AcApZoomToBoxCmd.js +0 -158
- package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
- package/lib/command/index.d.ts +0 -11
- package/lib/command/index.d.ts.map +0 -1
- package/lib/command/index.js +0 -11
- package/lib/command/index.js.map +0 -1
- package/lib/editor/command/AcEdCommand.d.ts +0 -151
- package/lib/editor/command/AcEdCommand.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommand.js +0 -164
- package/lib/editor/command/AcEdCommand.js.map +0 -1
- package/lib/editor/command/AcEdCommandIterator.d.ts +0 -36
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommandIterator.js +0 -65
- package/lib/editor/command/AcEdCommandIterator.js.map +0 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +0 -120
- package/lib/editor/command/AcEdCommandStack.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommandStack.js +0 -235
- package/lib/editor/command/AcEdCommandStack.js.map +0 -1
- package/lib/editor/command/index.d.ts +0 -3
- package/lib/editor/command/index.d.ts.map +0 -1
- package/lib/editor/command/index.js +0 -3
- package/lib/editor/command/index.js.map +0 -1
- package/lib/editor/global/AcEdConditionWaiter.d.ts +0 -51
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +0 -1
- package/lib/editor/global/AcEdConditionWaiter.js +0 -87
- package/lib/editor/global/AcEdConditionWaiter.js.map +0 -1
- package/lib/editor/global/AcEdGlobalFunc.d.ts +0 -8
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +0 -1
- package/lib/editor/global/AcEdGlobalFunc.js +0 -14
- package/lib/editor/global/AcEdGlobalFunc.js.map +0 -1
- package/lib/editor/global/AcEdMessage.d.ts +0 -5
- package/lib/editor/global/AcEdMessage.d.ts.map +0 -1
- package/lib/editor/global/AcEdMessage.js +0 -6
- package/lib/editor/global/AcEdMessage.js.map +0 -1
- package/lib/editor/global/eventBus.d.ts +0 -103
- package/lib/editor/global/eventBus.d.ts.map +0 -1
- package/lib/editor/global/eventBus.js +0 -41
- package/lib/editor/global/eventBus.js.map +0 -1
- package/lib/editor/global/index.d.ts +0 -4
- package/lib/editor/global/index.d.ts.map +0 -1
- package/lib/editor/global/index.js +0 -4
- package/lib/editor/global/index.js.map +0 -1
- package/lib/editor/index.d.ts +0 -5
- package/lib/editor/index.d.ts.map +0 -1
- package/lib/editor/index.js +0 -5
- package/lib/editor/index.js.map +0 -1
- package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
- package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
- package/lib/editor/input/AcEdBaseInput.js +0 -166
- package/lib/editor/input/AcEdBaseInput.js.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.js +0 -220
- package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +0 -130
- package/lib/editor/input/AcEdCursorManager.d.ts.map +0 -1
- package/lib/editor/input/AcEdCursorManager.js +0 -155
- package/lib/editor/input/AcEdCursorManager.js.map +0 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
- package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
- package/lib/editor/input/AcEdInputPoint.js +0 -78
- package/lib/editor/input/AcEdInputPoint.js.map +0 -1
- package/lib/editor/input/AcEdJig.d.ts +0 -180
- package/lib/editor/input/AcEdJig.d.ts.map +0 -1
- package/lib/editor/input/AcEdJig.js +0 -256
- package/lib/editor/input/AcEdJig.js.map +0 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
- package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
- package/lib/editor/input/AcEdJigLoop.js +0 -91
- package/lib/editor/input/AcEdJigLoop.js.map +0 -1
- package/lib/editor/input/AcEdSelectionSet.d.ts +0 -146
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +0 -1
- package/lib/editor/input/AcEdSelectionSet.js +0 -179
- package/lib/editor/input/AcEdSelectionSet.js.map +0 -1
- package/lib/editor/input/AcEditor.d.ts +0 -111
- package/lib/editor/input/AcEditor.d.ts.map +0 -1
- package/lib/editor/input/AcEditor.js +0 -183
- package/lib/editor/input/AcEditor.js.map +0 -1
- package/lib/editor/input/index.d.ts +0 -5
- package/lib/editor/input/index.d.ts.map +0 -1
- package/lib/editor/input/index.js +0 -5
- package/lib/editor/input/index.js.map +0 -1
- package/lib/editor/view/AcEdBaseView.d.ts +0 -457
- package/lib/editor/view/AcEdBaseView.d.ts.map +0 -1
- package/lib/editor/view/AcEdBaseView.js +0 -349
- package/lib/editor/view/AcEdBaseView.js.map +0 -1
- package/lib/editor/view/AcEdLayerInfo.d.ts +0 -21
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +0 -1
- package/lib/editor/view/AcEdLayerInfo.js +0 -2
- package/lib/editor/view/AcEdLayerInfo.js.map +0 -1
- package/lib/editor/view/index.d.ts +0 -3
- package/lib/editor/view/index.d.ts.map +0 -1
- package/lib/editor/view/index.js +0 -3
- package/lib/editor/view/index.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
- package/lib/util/AcTrGeometryUtil.d.ts +0 -92
- package/lib/util/AcTrGeometryUtil.d.ts.map +0 -1
- package/lib/util/AcTrGeometryUtil.js +0 -109
- package/lib/util/AcTrGeometryUtil.js.map +0 -1
- package/lib/util/index.d.ts +0 -2
- package/lib/util/index.d.ts.map +0 -1
- package/lib/util/index.js +0 -2
- package/lib/util/index.js.map +0 -1
- package/lib/view/AcTrLayer.d.ts +0 -132
- package/lib/view/AcTrLayer.d.ts.map +0 -1
- package/lib/view/AcTrLayer.js +0 -199
- package/lib/view/AcTrLayer.js.map +0 -1
- package/lib/view/AcTrLayout.d.ts +0 -218
- package/lib/view/AcTrLayout.d.ts.map +0 -1
- package/lib/view/AcTrLayout.js +0 -437
- package/lib/view/AcTrLayout.js.map +0 -1
- package/lib/view/AcTrLayoutView.d.ts +0 -115
- package/lib/view/AcTrLayoutView.d.ts.map +0 -1
- package/lib/view/AcTrLayoutView.js +0 -200
- package/lib/view/AcTrLayoutView.js.map +0 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +0 -89
- package/lib/view/AcTrLayoutViewManager.d.ts.map +0 -1
- package/lib/view/AcTrLayoutViewManager.js +0 -118
- package/lib/view/AcTrLayoutViewManager.js.map +0 -1
- package/lib/view/AcTrScene.d.ts +0 -162
- package/lib/view/AcTrScene.d.ts.map +0 -1
- package/lib/view/AcTrScene.js +0 -370
- package/lib/view/AcTrScene.js.map +0 -1
- package/lib/view/AcTrView2d.d.ts +0 -262
- package/lib/view/AcTrView2d.d.ts.map +0 -1
- package/lib/view/AcTrView2d.js +0 -772
- package/lib/view/AcTrView2d.js.map +0 -1
- package/lib/view/index.d.ts +0 -2
- package/lib/view/index.d.ts.map +0 -1
- package/lib/view/index.js +0 -2
- package/lib/view/index.js.map +0 -1
package/lib/app/AcApContext.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { AcEdBaseView } from '../editor/view/AcEdBaseView';
|
|
2
|
-
import { AcApDocument } from './AcApDocument';
|
|
3
|
-
/**
|
|
4
|
-
* Application context that binds a CAD document with its associated view.
|
|
5
|
-
*
|
|
6
|
-
* This class establishes the connection between a CAD document (containing the drawing database)
|
|
7
|
-
* and its visual representation (the view). It handles event forwarding between the document
|
|
8
|
-
* and view to keep them synchronized.
|
|
9
|
-
*
|
|
10
|
-
* The context manages:
|
|
11
|
-
* - Entity lifecycle events (add, modify, remove)
|
|
12
|
-
* - Layer visibility changes
|
|
13
|
-
* - System variable changes (like point display mode)
|
|
14
|
-
* - Entity selection and highlighting
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const document = new AcApDocument();
|
|
19
|
-
* const view = new AcTrView2d();
|
|
20
|
-
* const context = new AcApContext(view, document);
|
|
21
|
-
*
|
|
22
|
-
* // The context will automatically sync changes between document and view
|
|
23
|
-
* // For example, when entities are added to the document, they appear in the view
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare class AcApContext {
|
|
27
|
-
/** The view component that renders the CAD drawing */
|
|
28
|
-
private _view;
|
|
29
|
-
/** The document containing the CAD database */
|
|
30
|
-
private _doc;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a new application context that binds a document with its view.
|
|
33
|
-
*
|
|
34
|
-
* The constructor sets up event listeners to synchronize the document and view:
|
|
35
|
-
* - Entity additions/modifications are reflected in the view
|
|
36
|
-
* - Layer visibility changes update the view
|
|
37
|
-
* - System variable changes (like point display mode) update rendering
|
|
38
|
-
* - Entity selections show/hide grip points
|
|
39
|
-
*
|
|
40
|
-
* @param view - The view used to display the drawing
|
|
41
|
-
* @param doc - The document containing the drawing database
|
|
42
|
-
*/
|
|
43
|
-
constructor(view: AcEdBaseView, doc: AcApDocument);
|
|
44
|
-
/**
|
|
45
|
-
* Gets the view component that renders the CAD drawing.
|
|
46
|
-
*
|
|
47
|
-
* @returns The associated view instance
|
|
48
|
-
*/
|
|
49
|
-
get view(): AcEdBaseView;
|
|
50
|
-
/**
|
|
51
|
-
* Gets the document containing the CAD database.
|
|
52
|
-
*
|
|
53
|
-
* @returns The associated document instance
|
|
54
|
-
*/
|
|
55
|
-
get doc(): AcApDocument;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=AcApContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApContext.d.ts","sourceRoot":"","sources":["../../src/app/AcApContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,WAAW;IACtB,sDAAsD;IACtD,OAAO,CAAC,KAAK,CAAc;IAC3B,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAc;IAE1B;;;;;;;;;;;OAWG;gBACS,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY;IAgDjD;;;;OAIG;IACH,IAAI,IAAI,iBAEP;IAED;;;;OAIG;IACH,IAAI,GAAG,IAAI,YAAY,CAEtB;CACF"}
|
package/lib/app/AcApContext.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { AcDbLayout } from '@mlightcad/data-model';
|
|
2
|
-
/**
|
|
3
|
-
* Application context that binds a CAD document with its associated view.
|
|
4
|
-
*
|
|
5
|
-
* This class establishes the connection between a CAD document (containing the drawing database)
|
|
6
|
-
* and its visual representation (the view). It handles event forwarding between the document
|
|
7
|
-
* and view to keep them synchronized.
|
|
8
|
-
*
|
|
9
|
-
* The context manages:
|
|
10
|
-
* - Entity lifecycle events (add, modify, remove)
|
|
11
|
-
* - Layer visibility changes
|
|
12
|
-
* - System variable changes (like point display mode)
|
|
13
|
-
* - Entity selection and highlighting
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const document = new AcApDocument();
|
|
18
|
-
* const view = new AcTrView2d();
|
|
19
|
-
* const context = new AcApContext(view, document);
|
|
20
|
-
*
|
|
21
|
-
* // The context will automatically sync changes between document and view
|
|
22
|
-
* // For example, when entities are added to the document, they appear in the view
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
var AcApContext = /** @class */ (function () {
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new application context that binds a document with its view.
|
|
28
|
-
*
|
|
29
|
-
* The constructor sets up event listeners to synchronize the document and view:
|
|
30
|
-
* - Entity additions/modifications are reflected in the view
|
|
31
|
-
* - Layer visibility changes update the view
|
|
32
|
-
* - System variable changes (like point display mode) update rendering
|
|
33
|
-
* - Entity selections show/hide grip points
|
|
34
|
-
*
|
|
35
|
-
* @param view - The view used to display the drawing
|
|
36
|
-
* @param doc - The document containing the drawing database
|
|
37
|
-
*/
|
|
38
|
-
function AcApContext(view, doc) {
|
|
39
|
-
var _this = this;
|
|
40
|
-
this._view = view;
|
|
41
|
-
this._doc = doc;
|
|
42
|
-
// Add entity to scene
|
|
43
|
-
doc.database.events.entityAppended.addEventListener(function (args) {
|
|
44
|
-
_this.view.addEntity(args.entity);
|
|
45
|
-
});
|
|
46
|
-
// Update entity
|
|
47
|
-
doc.database.events.entityModified.addEventListener(function (args) {
|
|
48
|
-
_this.view.updateEntity(args.entity);
|
|
49
|
-
});
|
|
50
|
-
// Set layer visibility
|
|
51
|
-
doc.database.events.layerAppended.addEventListener(function (args) {
|
|
52
|
-
_this._view.addLayer(args.layer);
|
|
53
|
-
});
|
|
54
|
-
// Update layer information such as visibility
|
|
55
|
-
doc.database.events.layerModified.addEventListener(function (args) {
|
|
56
|
-
_this._view.updateLayer(args.layer);
|
|
57
|
-
});
|
|
58
|
-
// Set point display mode
|
|
59
|
-
doc.database.events.headerSysVarChanged.addEventListener(function (args) {
|
|
60
|
-
if (args.name == 'pdmode') {
|
|
61
|
-
;
|
|
62
|
-
_this._view.rerenderPoints(args.database.pdmode);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
doc.database.events.dictObjetSet.addEventListener(function (args) {
|
|
66
|
-
if (args.object instanceof AcDbLayout) {
|
|
67
|
-
_this._view.addLayout(args.object);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
// Show their grip points when entities are selected
|
|
71
|
-
view.selectionSet.events.selectionAdded.addEventListener(function (args) {
|
|
72
|
-
view.highlight(args.ids);
|
|
73
|
-
});
|
|
74
|
-
// Hide their grip points when entities are deselected
|
|
75
|
-
view.selectionSet.events.selectionRemoved.addEventListener(function (args) {
|
|
76
|
-
view.unhighlight(args.ids);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
Object.defineProperty(AcApContext.prototype, "view", {
|
|
80
|
-
/**
|
|
81
|
-
* Gets the view component that renders the CAD drawing.
|
|
82
|
-
*
|
|
83
|
-
* @returns The associated view instance
|
|
84
|
-
*/
|
|
85
|
-
get: function () {
|
|
86
|
-
return this._view;
|
|
87
|
-
},
|
|
88
|
-
enumerable: false,
|
|
89
|
-
configurable: true
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(AcApContext.prototype, "doc", {
|
|
92
|
-
/**
|
|
93
|
-
* Gets the document containing the CAD database.
|
|
94
|
-
*
|
|
95
|
-
* @returns The associated document instance
|
|
96
|
-
*/
|
|
97
|
-
get: function () {
|
|
98
|
-
return this._doc;
|
|
99
|
-
},
|
|
100
|
-
enumerable: false,
|
|
101
|
-
configurable: true
|
|
102
|
-
});
|
|
103
|
-
return AcApContext;
|
|
104
|
-
}());
|
|
105
|
-
export { AcApContext };
|
|
106
|
-
//# sourceMappingURL=AcApContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApContext.js","sourceRoot":"","sources":["../../src/app/AcApContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAMlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;IAME;;;;;;;;;;;OAWG;IACH,qBAAY,IAAkB,EAAE,GAAiB;QAAjD,iBA8CC;QA7CC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;QAEf,sBAAsB;QACtB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAA,IAAI;YACtD,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;QAEF,gBAAgB;QAChB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAA,IAAI;YACtD,KAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,uBAAuB;QACvB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,UAAA,IAAI;YACrD,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;QAEF,8C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ACH;YACE,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IACH,kBAAC;AAAD,CAAC,AAnFD,IAmFC"}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { AcCmEventManager, AcDbOpenDatabaseOptions } from '@mlightcad/data-model';
|
|
2
|
-
import { AcTrView2d } from '../view';
|
|
3
|
-
import { AcApContext } from './AcApContext';
|
|
4
|
-
import { AcApDocument } from './AcApDocument';
|
|
5
|
-
/**
|
|
6
|
-
* Event arguments for document-related events.
|
|
7
|
-
*/
|
|
8
|
-
export interface AcDbDocumentEventArgs {
|
|
9
|
-
/** The document involved in the event */
|
|
10
|
-
doc: AcApDocument;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Options for creating AcApDocManager instance
|
|
14
|
-
*/
|
|
15
|
-
export interface AcApDocManagerOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Optional HTML canvas element for rendering. If not provided, a new canvas will be created
|
|
18
|
-
*/
|
|
19
|
-
canvas?: HTMLCanvasElement;
|
|
20
|
-
/**
|
|
21
|
-
* Base URL to load resources (such as fonts annd drawing templates) needed
|
|
22
|
-
*/
|
|
23
|
-
baseUrl?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The flag whether to use main thread or webwork to render drawing.
|
|
26
|
-
* - true: use main thread to render drawing. This approach take less memory and take longer time to show
|
|
27
|
-
* rendering results.
|
|
28
|
-
* - false: use web worker to render drawing. This approach take more memory and take shorter time to show
|
|
29
|
-
* rendering results.
|
|
30
|
-
*/
|
|
31
|
-
useMainThreadDraw?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Document manager that handles CAD document lifecycle and provides the main entry point for the CAD viewer.
|
|
35
|
-
*
|
|
36
|
-
* This singleton class manages:
|
|
37
|
-
* - Document creation and opening (from URLs or file content)
|
|
38
|
-
* - View and context management
|
|
39
|
-
* - Command registration and execution
|
|
40
|
-
* - Font loading for text rendering
|
|
41
|
-
* - Event handling for document lifecycle
|
|
42
|
-
*
|
|
43
|
-
* The manager follows a singleton pattern to ensure only one instance manages the application state.
|
|
44
|
-
*/
|
|
45
|
-
export declare class AcApDocManager {
|
|
46
|
-
/** The current application context binding document and view */
|
|
47
|
-
private _context;
|
|
48
|
-
/** Font loader for managing CAD text fonts */
|
|
49
|
-
private _fontLoader;
|
|
50
|
-
/** Base URL to get fonts, templates, and example files */
|
|
51
|
-
private _baseUrl;
|
|
52
|
-
/** Singleton instance */
|
|
53
|
-
private static _instance?;
|
|
54
|
-
/** Events fired during document lifecycle */
|
|
55
|
-
readonly events: {
|
|
56
|
-
/** Fired when a new document is created */
|
|
57
|
-
documentCreated: AcCmEventManager<AcDbDocumentEventArgs>;
|
|
58
|
-
/** Fired when a document becomes active */
|
|
59
|
-
documentActivated: AcCmEventManager<AcDbDocumentEventArgs>;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Private constructor for singleton pattern.
|
|
63
|
-
*
|
|
64
|
-
* Creates an empty document with a 2D view and sets up the application context.
|
|
65
|
-
* Registers default commands and creates an example document.
|
|
66
|
-
*
|
|
67
|
-
* @param options -Options for creating AcApDocManager instance
|
|
68
|
-
* @private
|
|
69
|
-
*/
|
|
70
|
-
private constructor();
|
|
71
|
-
/**
|
|
72
|
-
* Creates the singleton instance with an optional canvas element.
|
|
73
|
-
*
|
|
74
|
-
* This method should be called before accessing the `instance` property
|
|
75
|
-
* if you want to provide a specific canvas element.
|
|
76
|
-
*
|
|
77
|
-
* @param options -Options for creating AcApDocManager instance
|
|
78
|
-
* @returns The singleton instance
|
|
79
|
-
*/
|
|
80
|
-
static createInstance(options?: AcApDocManagerOptions): AcApDocManager | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Gets the singleton instance of the document manager.
|
|
83
|
-
*
|
|
84
|
-
* Creates a new instance if one doesn't exist yet.
|
|
85
|
-
*
|
|
86
|
-
* @returns The singleton document manager instance
|
|
87
|
-
*/
|
|
88
|
-
static get instance(): AcApDocManager;
|
|
89
|
-
/**
|
|
90
|
-
* Gets the current application context.
|
|
91
|
-
*
|
|
92
|
-
* The context binds the current document with its associated view.
|
|
93
|
-
*
|
|
94
|
-
* @returns The current application context
|
|
95
|
-
*/
|
|
96
|
-
get context(): AcApContext;
|
|
97
|
-
/**
|
|
98
|
-
* Gets the currently open CAD document.
|
|
99
|
-
*
|
|
100
|
-
* @returns The current document instance
|
|
101
|
-
*/
|
|
102
|
-
get curDocument(): AcApDocument;
|
|
103
|
-
/**
|
|
104
|
-
* Gets the currently active document.
|
|
105
|
-
*
|
|
106
|
-
* For now, this is the same as `curDocument` since only one document
|
|
107
|
-
* can be active at a time.
|
|
108
|
-
*
|
|
109
|
-
* @returns The current active document
|
|
110
|
-
*/
|
|
111
|
-
get mdiActiveDocument(): AcApDocument;
|
|
112
|
-
/**
|
|
113
|
-
* Gets the current 2D view used to display the drawing.
|
|
114
|
-
*
|
|
115
|
-
* @returns The current 2D view instance
|
|
116
|
-
*/
|
|
117
|
-
get curView(): AcTrView2d;
|
|
118
|
-
/**
|
|
119
|
-
* Gets the editor instance for handling user input.
|
|
120
|
-
*
|
|
121
|
-
* @returns The current editor instance
|
|
122
|
-
*/
|
|
123
|
-
get editor(): import("../editor").AcEditor;
|
|
124
|
-
/**
|
|
125
|
-
* Base URL to load fonts
|
|
126
|
-
*/
|
|
127
|
-
get baseUrl(): string;
|
|
128
|
-
/**
|
|
129
|
-
* Gets the list of available fonts that can be loaded.
|
|
130
|
-
*
|
|
131
|
-
* Note: These fonts are available for loading but may not be loaded yet.
|
|
132
|
-
*
|
|
133
|
-
* @returns Array of available font names
|
|
134
|
-
*/
|
|
135
|
-
get avaiableFonts(): import("@mlightcad/data-model").AcDbFontInfo[];
|
|
136
|
-
/**
|
|
137
|
-
* Loads the specified fonts for text rendering.
|
|
138
|
-
*
|
|
139
|
-
* @param fonts - Array of font names to load
|
|
140
|
-
* @returns Promise that resolves when fonts are loaded
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* await docManager.loadFonts(['Arial', 'Times New Roman']);
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
loadFonts(fonts: string[]): Promise<void>;
|
|
148
|
-
/**
|
|
149
|
-
* Loads default fonts for CAD text rendering.
|
|
150
|
-
*
|
|
151
|
-
* This method loads either the specified fonts or falls back to default Chinese fonts
|
|
152
|
-
* (specifically 'simkai') if no fonts are provided. The loaded fonts are used for
|
|
153
|
-
* rendering CAD text entities like MText and Text in the viewer.
|
|
154
|
-
*
|
|
155
|
-
* It is better to load default fonts when viewer is initialized so that the viewer can
|
|
156
|
-
* render text correctly if fonts used in the document are not available.
|
|
157
|
-
*
|
|
158
|
-
* @param fonts - Optional array of font names to load. If not provided or null,
|
|
159
|
-
* defaults to ['simkai'] for Chinese text support
|
|
160
|
-
* @returns Promise that resolves when all specified fonts are loaded
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```typescript
|
|
164
|
-
* // Load default fonts (simkai)
|
|
165
|
-
* await docManager.loadDefaultFonts();
|
|
166
|
-
*
|
|
167
|
-
* // Load specific fonts
|
|
168
|
-
* await docManager.loadDefaultFonts(['Arial', 'SimSun']);
|
|
169
|
-
*
|
|
170
|
-
* // Load no fonts (empty array)
|
|
171
|
-
* await docManager.loadDefaultFonts([]);
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
|
-
* @see {@link AcApFontLoader.load} - The underlying font loading implementation
|
|
175
|
-
* @see {@link createExampleDoc} - Method that uses this for example document creation
|
|
176
|
-
*/
|
|
177
|
-
loadDefaultFonts(fonts?: string[]): Promise<void>;
|
|
178
|
-
/**
|
|
179
|
-
* Opens a CAD document from a URL.
|
|
180
|
-
*
|
|
181
|
-
* This method loads a document from the specified URL and replaces the current document.
|
|
182
|
-
* It handles the complete document lifecycle including before/after open events.
|
|
183
|
-
*
|
|
184
|
-
* @param url - The URL of the CAD file to open
|
|
185
|
-
* @param options - Optional database opening options. If not provided, default options with font loader will be used
|
|
186
|
-
* @returns Promise that resolves to true if the document was successfully opened, false otherwise
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```typescript
|
|
190
|
-
* const success = await docManager.openUrl('https://example.com/drawing.dwg');
|
|
191
|
-
* if (success) {
|
|
192
|
-
* console.log('Document opened successfully');
|
|
193
|
-
* }
|
|
194
|
-
* ```
|
|
195
|
-
*/
|
|
196
|
-
openUrl(url: string, options?: AcDbOpenDatabaseOptions): Promise<boolean>;
|
|
197
|
-
/**
|
|
198
|
-
* Opens a CAD document from file content.
|
|
199
|
-
*
|
|
200
|
-
* This method loads a document from the provided file content (binary data)
|
|
201
|
-
* and replaces the current document. It handles the complete document lifecycle
|
|
202
|
-
* including before/after open events.
|
|
203
|
-
*
|
|
204
|
-
* @param fileName - The name of the file being opened (used for format detection)
|
|
205
|
-
* @param content - The file content
|
|
206
|
-
* @param options - Database opening options including font loader settings
|
|
207
|
-
* @returns Promise that resolves to true if the document was successfully opened, false otherwise
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* ```typescript
|
|
211
|
-
* const fileContent = await file.arrayBuffer();
|
|
212
|
-
* const success = await docManager.openDocument('drawing.dwg', fileContent, options);
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
|
-
openDocument(fileName: string, content: ArrayBuffer, options: AcDbOpenDatabaseOptions): Promise<boolean>;
|
|
216
|
-
/**
|
|
217
|
-
* Redraws the current view. Currently it is used once you modified font mapping
|
|
218
|
-
* for missed fonts so that the drawing can apply new fonts.
|
|
219
|
-
*/
|
|
220
|
-
regen(): void;
|
|
221
|
-
/**
|
|
222
|
-
* Registers all default commands available in the CAD viewer.
|
|
223
|
-
*
|
|
224
|
-
* This method sets up the command system by registering built-in commands including:
|
|
225
|
-
* - pan: Pan/move the view
|
|
226
|
-
* - select: Select entities
|
|
227
|
-
* - zoom: Zoom in/out
|
|
228
|
-
* - zoomw: Zoom to window/box
|
|
229
|
-
* - csvg: Convert to SVG
|
|
230
|
-
* - qnew: Quick new document
|
|
231
|
-
* - open: Open document
|
|
232
|
-
*
|
|
233
|
-
* All commands are registered under the system command group.
|
|
234
|
-
*/
|
|
235
|
-
registerCommands(): void;
|
|
236
|
-
/**
|
|
237
|
-
* Executes a command by its string name.
|
|
238
|
-
*
|
|
239
|
-
* This method looks up a registered command by name and executes it with the current context.
|
|
240
|
-
* If the command is not found, no action is taken.
|
|
241
|
-
*
|
|
242
|
-
* @param cmdStr - The command string to execute (e.g., 'pan', 'zoom', 'select')
|
|
243
|
-
*
|
|
244
|
-
* @example
|
|
245
|
-
* ```typescript
|
|
246
|
-
* docManager.sendStringToExecute('zoom');
|
|
247
|
-
* docManager.sendStringToExecute('pan');
|
|
248
|
-
* ```
|
|
249
|
-
*/
|
|
250
|
-
sendStringToExecute(cmdStr: string): void;
|
|
251
|
-
/**
|
|
252
|
-
* Configures layout information for the current view.
|
|
253
|
-
*
|
|
254
|
-
* Sets up the active layout block table record ID and model space block table
|
|
255
|
-
* record ID based on the current document's space configuration.
|
|
256
|
-
*/
|
|
257
|
-
setActiveLayout(): void;
|
|
258
|
-
/**
|
|
259
|
-
* Performs cleanup operations before opening a new document.
|
|
260
|
-
*
|
|
261
|
-
* This protected method is called automatically before any document opening operation.
|
|
262
|
-
* It clears the current view to prepare for the new document content.
|
|
263
|
-
*
|
|
264
|
-
* @protected
|
|
265
|
-
*/
|
|
266
|
-
protected onBeforeOpenDocument(): void;
|
|
267
|
-
/**
|
|
268
|
-
* Performs setup operations after a document opening attempt.
|
|
269
|
-
*
|
|
270
|
-
* This protected method is called automatically after any document opening operation.
|
|
271
|
-
* If the document was successfully opened, it dispatches the documentActivated event,
|
|
272
|
-
* sets up layout information, and zooms the view to fit the content.
|
|
273
|
-
*
|
|
274
|
-
* @param isSuccess - Whether the document was successfully opened
|
|
275
|
-
* @protected
|
|
276
|
-
*/
|
|
277
|
-
protected onAfterOpenDocument(isSuccess: boolean): void;
|
|
278
|
-
/**
|
|
279
|
-
* Sets up or validates database opening options.
|
|
280
|
-
*
|
|
281
|
-
* This private method ensures that the options object has a font loader configured.
|
|
282
|
-
* If no options are provided, creates new options with the font loader.
|
|
283
|
-
* If options are provided but missing a font loader, adds the font loader.
|
|
284
|
-
*
|
|
285
|
-
* @param options - Optional database opening options to validate/modify
|
|
286
|
-
* @returns The validated options object with font loader configured
|
|
287
|
-
* @private
|
|
288
|
-
*/
|
|
289
|
-
private setOptions;
|
|
290
|
-
}
|
|
291
|
-
//# sourceMappingURL=AcApDocManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocManager.d.ts","sourceRoot":"","sources":["../../src/app/AcApDocManager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,uBAAuB,EAExB,MAAM,uBAAuB,CAAA;AAe9B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAK7C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,GAAG,EAAE,YAAY,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,cAAc;IACzB,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAa;IAC7B,8CAA8C;IAC9C,OAAO,CAAC,WAAW,CAAgB;IACnC,0DAA0D;IAC1D,OAAO,CAAC,QAAQ,CAAQ;IACxB,yBAAyB;IACzB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAgB;IAEzC,6CAA6C;IAC7C,SAAgB,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