@mlightcad/cad-simple-viewer 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33647 -0
- package/dist/index.umd.cjs +295 -0
- package/dist/libredwg-parser-worker.js +15458 -0
- package/dist/mtext-renderer-worker.js +29930 -0
- package/lib/app/AcApContext.d.ts +57 -0
- package/lib/app/AcApContext.d.ts.map +1 -0
- package/lib/app/AcApContext.js +106 -0
- package/lib/app/AcApContext.js.map +1 -0
- package/lib/app/AcApDocManager.d.ts +291 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -0
- package/lib/app/AcApDocManager.js +498 -0
- package/lib/app/AcApDocManager.js.map +1 -0
- package/lib/app/AcApDocument.d.ts +101 -0
- package/lib/app/AcApDocument.d.ts.map +1 -0
- package/lib/app/AcApDocument.js +237 -0
- package/lib/app/AcApDocument.js.map +1 -0
- package/lib/app/AcApFontLoader.d.ts +54 -0
- package/lib/app/AcApFontLoader.d.ts.map +1 -0
- package/lib/app/AcApFontLoader.js +151 -0
- package/lib/app/AcApFontLoader.js.map +1 -0
- package/lib/app/AcApGlobalFunc.d.ts +26 -0
- package/lib/app/AcApGlobalFunc.d.ts.map +1 -0
- package/lib/app/AcApGlobalFunc.js +66 -0
- package/lib/app/AcApGlobalFunc.js.map +1 -0
- package/lib/app/AcApSettingManager.d.ts +232 -0
- package/lib/app/AcApSettingManager.d.ts.map +1 -0
- package/lib/app/AcApSettingManager.js +283 -0
- package/lib/app/AcApSettingManager.js.map +1 -0
- package/lib/app/index.d.ts +6 -0
- package/lib/app/index.d.ts.map +1 -0
- package/lib/app/index.js +6 -0
- package/lib/app/index.js.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts +32 -0
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +1 -0
- package/lib/command/AcApConvertToSvgCmd.js +56 -0
- package/lib/command/AcApConvertToSvgCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +37 -0
- package/lib/command/AcApOpenCmd.d.ts.map +1 -0
- package/lib/command/AcApOpenCmd.js +60 -0
- package/lib/command/AcApOpenCmd.js.map +1 -0
- package/lib/command/AcApPanCmd.d.ts +31 -0
- package/lib/command/AcApPanCmd.d.ts.map +1 -0
- package/lib/command/AcApPanCmd.js +55 -0
- package/lib/command/AcApPanCmd.js.map +1 -0
- package/lib/command/AcApQNewCmd.d.ts +32 -0
- package/lib/command/AcApQNewCmd.d.ts.map +1 -0
- package/lib/command/AcApQNewCmd.js +56 -0
- package/lib/command/AcApQNewCmd.js.map +1 -0
- package/lib/command/AcApRegenCmd.d.ts +21 -0
- package/lib/command/AcApRegenCmd.d.ts.map +1 -0
- package/lib/command/AcApRegenCmd.js +45 -0
- package/lib/command/AcApRegenCmd.js.map +1 -0
- package/lib/command/AcApSelectCmd.d.ts +32 -0
- package/lib/command/AcApSelectCmd.d.ts.map +1 -0
- package/lib/command/AcApSelectCmd.js +56 -0
- package/lib/command/AcApSelectCmd.js.map +1 -0
- package/lib/command/AcApSvgConvertor.d.ts +53 -0
- package/lib/command/AcApSvgConvertor.d.ts.map +1 -0
- package/lib/command/AcApSvgConvertor.js +103 -0
- package/lib/command/AcApSvgConvertor.js.map +1 -0
- package/lib/command/AcApZoomCmd.d.ts +35 -0
- package/lib/command/AcApZoomCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomCmd.js +57 -0
- package/lib/command/AcApZoomCmd.js.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts +68 -0
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +1 -0
- package/lib/command/AcApZoomToBoxCmd.js +158 -0
- package/lib/command/AcApZoomToBoxCmd.js.map +1 -0
- package/lib/command/index.d.ts +11 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +11 -0
- package/lib/command/index.js.map +1 -0
- package/lib/editor/command/AcEdCommand.d.ts +151 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommand.js +164 -0
- package/lib/editor/command/AcEdCommand.js.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts +36 -0
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandIterator.js +65 -0
- package/lib/editor/command/AcEdCommandIterator.js.map +1 -0
- package/lib/editor/command/AcEdCommandStack.d.ts +120 -0
- package/lib/editor/command/AcEdCommandStack.d.ts.map +1 -0
- package/lib/editor/command/AcEdCommandStack.js +235 -0
- package/lib/editor/command/AcEdCommandStack.js.map +1 -0
- package/lib/editor/command/index.d.ts +3 -0
- package/lib/editor/command/index.d.ts.map +1 -0
- package/lib/editor/command/index.js +3 -0
- package/lib/editor/command/index.js.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts +51 -0
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +1 -0
- package/lib/editor/global/AcEdConditionWaiter.js +87 -0
- package/lib/editor/global/AcEdConditionWaiter.js.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts +8 -0
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +1 -0
- package/lib/editor/global/AcEdGlobalFunc.js +14 -0
- package/lib/editor/global/AcEdGlobalFunc.js.map +1 -0
- package/lib/editor/global/AcEdMessage.d.ts +5 -0
- package/lib/editor/global/AcEdMessage.d.ts.map +1 -0
- package/lib/editor/global/AcEdMessage.js +6 -0
- package/lib/editor/global/AcEdMessage.js.map +1 -0
- package/lib/editor/global/eventBus.d.ts +103 -0
- package/lib/editor/global/eventBus.d.ts.map +1 -0
- package/lib/editor/global/eventBus.js +41 -0
- package/lib/editor/global/eventBus.js.map +1 -0
- package/lib/editor/global/index.d.ts +4 -0
- package/lib/editor/global/index.d.ts.map +1 -0
- package/lib/editor/global/index.js +4 -0
- package/lib/editor/global/index.js.map +1 -0
- package/lib/editor/index.d.ts +5 -0
- package/lib/editor/index.d.ts.map +1 -0
- package/lib/editor/index.js +5 -0
- package/lib/editor/index.js.map +1 -0
- package/lib/editor/input/AcEdBaseInput.d.ts +89 -0
- package/lib/editor/input/AcEdBaseInput.d.ts.map +1 -0
- package/lib/editor/input/AcEdBaseInput.js +166 -0
- package/lib/editor/input/AcEdBaseInput.js.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts +108 -0
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +1 -0
- package/lib/editor/input/AcEdBoxSelector.js +220 -0
- package/lib/editor/input/AcEdBoxSelector.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts +130 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -0
- package/lib/editor/input/AcEdCursorManager.js +155 -0
- package/lib/editor/input/AcEdCursorManager.js.map +1 -0
- package/lib/editor/input/AcEdInputPoint.d.ts +51 -0
- package/lib/editor/input/AcEdInputPoint.d.ts.map +1 -0
- package/lib/editor/input/AcEdInputPoint.js +78 -0
- package/lib/editor/input/AcEdInputPoint.js.map +1 -0
- package/lib/editor/input/AcEdJig.d.ts +180 -0
- package/lib/editor/input/AcEdJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdJig.js +256 -0
- package/lib/editor/input/AcEdJig.js.map +1 -0
- package/lib/editor/input/AcEdJigLoop.d.ts +63 -0
- package/lib/editor/input/AcEdJigLoop.d.ts.map +1 -0
- package/lib/editor/input/AcEdJigLoop.js +91 -0
- package/lib/editor/input/AcEdJigLoop.js.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts +146 -0
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionSet.js +179 -0
- package/lib/editor/input/AcEdSelectionSet.js.map +1 -0
- package/lib/editor/input/AcEditor.d.ts +111 -0
- package/lib/editor/input/AcEditor.d.ts.map +1 -0
- package/lib/editor/input/AcEditor.js +183 -0
- package/lib/editor/input/AcEditor.js.map +1 -0
- package/lib/editor/input/index.d.ts +5 -0
- package/lib/editor/input/index.d.ts.map +1 -0
- package/lib/editor/input/index.js +5 -0
- package/lib/editor/input/index.js.map +1 -0
- package/lib/editor/view/AcEdBaseView.d.ts +457 -0
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -0
- package/lib/editor/view/AcEdBaseView.js +349 -0
- package/lib/editor/view/AcEdBaseView.js.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts +21 -0
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +1 -0
- package/lib/editor/view/AcEdLayerInfo.js +2 -0
- package/lib/editor/view/AcEdLayerInfo.js.map +1 -0
- package/lib/editor/view/index.d.ts +3 -0
- package/lib/editor/view/index.d.ts.map +1 -0
- package/lib/editor/view/index.js +3 -0
- package/lib/editor/view/index.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/util/AcTrGeometryUtil.d.ts +92 -0
- package/lib/util/AcTrGeometryUtil.d.ts.map +1 -0
- package/lib/util/AcTrGeometryUtil.js +109 -0
- package/lib/util/AcTrGeometryUtil.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +132 -0
- package/lib/view/AcTrLayer.d.ts.map +1 -0
- package/lib/view/AcTrLayer.js +199 -0
- package/lib/view/AcTrLayer.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +218 -0
- package/lib/view/AcTrLayout.d.ts.map +1 -0
- package/lib/view/AcTrLayout.js +437 -0
- package/lib/view/AcTrLayout.js.map +1 -0
- package/lib/view/AcTrLayoutView.d.ts +115 -0
- package/lib/view/AcTrLayoutView.d.ts.map +1 -0
- package/lib/view/AcTrLayoutView.js +200 -0
- package/lib/view/AcTrLayoutView.js.map +1 -0
- package/lib/view/AcTrLayoutViewManager.d.ts +89 -0
- package/lib/view/AcTrLayoutViewManager.d.ts.map +1 -0
- package/lib/view/AcTrLayoutViewManager.js +118 -0
- package/lib/view/AcTrLayoutViewManager.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +162 -0
- package/lib/view/AcTrScene.d.ts.map +1 -0
- package/lib/view/AcTrScene.js +370 -0
- package/lib/view/AcTrScene.js.map +1 -0
- package/lib/view/AcTrView2d.d.ts +262 -0
- package/lib/view/AcTrView2d.d.ts.map +1 -0
- package/lib/view/AcTrView2d.js +772 -0
- package/lib/view/AcTrView2d.js.map +1 -0
- package/lib/view/index.d.ts +2 -0
- package/lib/view/index.d.ts.map +1 -0
- package/lib/view/index.js +2 -0
- package/lib/view/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcEdCommand } from '../command';
|
|
17
|
+
import { eventBus } from '../editor';
|
|
18
|
+
/**
|
|
19
|
+
* Command to open a CAD file.
|
|
20
|
+
*
|
|
21
|
+
* This command triggers the file opening workflow by emitting an 'open-file' event
|
|
22
|
+
* on the global event bus. The actual file opening logic is handled by other
|
|
23
|
+
* components listening for this event (typically the UI layer).
|
|
24
|
+
*
|
|
25
|
+
* The command follows the standard CAD pattern where the command itself is lightweight
|
|
26
|
+
* and delegates the actual work to specialized handlers.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const openCommand = new AcApOpenCmd();
|
|
31
|
+
* openCommand.globalName = 'OPEN';
|
|
32
|
+
* openCommand.localName = 'Open File';
|
|
33
|
+
*
|
|
34
|
+
* // Trigger the command
|
|
35
|
+
* openCommand.trigger(docManager.context);
|
|
36
|
+
*
|
|
37
|
+
* // The command will emit 'open-file' event for UI components to handle
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
var AcApOpenCmd = /** @class */ (function (_super) {
|
|
41
|
+
__extends(AcApOpenCmd, _super);
|
|
42
|
+
function AcApOpenCmd() {
|
|
43
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Executes the open file command.
|
|
47
|
+
*
|
|
48
|
+
* Emits an 'open-file' event on the global event bus to trigger
|
|
49
|
+
* the file opening workflow. UI components typically listen for
|
|
50
|
+
* this event to display file selection dialogs.
|
|
51
|
+
*
|
|
52
|
+
* @param _context - The current application context (not used in this command)
|
|
53
|
+
*/
|
|
54
|
+
AcApOpenCmd.prototype.execute = function (_context) {
|
|
55
|
+
eventBus.emit('open-file', {});
|
|
56
|
+
};
|
|
57
|
+
return AcApOpenCmd;
|
|
58
|
+
}(AcEdCommand));
|
|
59
|
+
export { AcApOpenCmd };
|
|
60
|
+
//# sourceMappingURL=AcApOpenCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApOpenCmd.js","sourceRoot":"","sources":["../../src/command/AcApOpenCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAAiC,+BAAW;IAA5C;;IAaA,CAAC;IAZC;;;;;;;;OAQG;IACH,6BAAO,GAAP,UAAQ,QAAqB;QAC3B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAChC,CAAC;IACH,kBAAC;AAAD,CAAC,AAbD,CAAiC,WAAW,GAa3C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../command';
|
|
3
|
+
/**
|
|
4
|
+
* Command for enabling pan mode in the CAD viewer.
|
|
5
|
+
*
|
|
6
|
+
* This command switches the view to pan mode, allowing users to drag
|
|
7
|
+
* and move the drawing around the canvas. When executed, it:
|
|
8
|
+
* - Sets the view mode to PAN
|
|
9
|
+
* - Changes the cursor to a grab cursor for visual feedback
|
|
10
|
+
*
|
|
11
|
+
* Pan mode allows users to click and drag to move the viewport,
|
|
12
|
+
* providing an intuitive way to navigate large drawings.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const panCmd = new AcApPanCmd();
|
|
17
|
+
* panCmd.execute(context); // Enables pan mode
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class AcApPanCmd extends AcEdCommand {
|
|
21
|
+
/**
|
|
22
|
+
* Executes the pan command.
|
|
23
|
+
*
|
|
24
|
+
* Sets the view to pan mode and updates the cursor appearance
|
|
25
|
+
* to indicate that panning is active.
|
|
26
|
+
*
|
|
27
|
+
* @param context - The application context containing the view
|
|
28
|
+
*/
|
|
29
|
+
execute(context: AcApContext): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=AcApPanCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApPanCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApPanCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,UAAW,SAAQ,WAAW;IACzC;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;CAI7B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcEdCommand } from '../command';
|
|
17
|
+
import { AcEdCorsorType, AcEdViewMode } from '../editor';
|
|
18
|
+
/**
|
|
19
|
+
* Command for enabling pan mode in the CAD viewer.
|
|
20
|
+
*
|
|
21
|
+
* This command switches the view to pan mode, allowing users to drag
|
|
22
|
+
* and move the drawing around the canvas. When executed, it:
|
|
23
|
+
* - Sets the view mode to PAN
|
|
24
|
+
* - Changes the cursor to a grab cursor for visual feedback
|
|
25
|
+
*
|
|
26
|
+
* Pan mode allows users to click and drag to move the viewport,
|
|
27
|
+
* providing an intuitive way to navigate large drawings.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const panCmd = new AcApPanCmd();
|
|
32
|
+
* panCmd.execute(context); // Enables pan mode
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
var AcApPanCmd = /** @class */ (function (_super) {
|
|
36
|
+
__extends(AcApPanCmd, _super);
|
|
37
|
+
function AcApPanCmd() {
|
|
38
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Executes the pan command.
|
|
42
|
+
*
|
|
43
|
+
* Sets the view to pan mode and updates the cursor appearance
|
|
44
|
+
* to indicate that panning is active.
|
|
45
|
+
*
|
|
46
|
+
* @param context - The application context containing the view
|
|
47
|
+
*/
|
|
48
|
+
AcApPanCmd.prototype.execute = function (context) {
|
|
49
|
+
context.view.mode = AcEdViewMode.PAN;
|
|
50
|
+
context.view.setCursor(AcEdCorsorType.Grab);
|
|
51
|
+
};
|
|
52
|
+
return AcApPanCmd;
|
|
53
|
+
}(AcEdCommand));
|
|
54
|
+
export { AcApPanCmd };
|
|
55
|
+
//# sourceMappingURL=AcApPanCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApPanCmd.js","sourceRoot":"","sources":["../../src/command/AcApPanCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH;IAAgC,8BAAW;IAA3C;;IAaA,CAAC;IAZC;;;;;;;OAOG;IACH,4BAAO,GAAP,UAAQ,OAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,GAAG,CAAA;QACpC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;IACH,iBAAC;AAAD,CAAC,AAbD,CAAgC,WAAW,GAa1C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../command';
|
|
3
|
+
/**
|
|
4
|
+
* Command for creating a new CAD document from a template.
|
|
5
|
+
*
|
|
6
|
+
* This command opens a predefined template drawing (acadiso.dxf) from
|
|
7
|
+
* a CDN to create a new document. The template provides:
|
|
8
|
+
* - Standard ISO drawing settings
|
|
9
|
+
* - Predefined layers and styles
|
|
10
|
+
* - Default drawing setup
|
|
11
|
+
*
|
|
12
|
+
* This is equivalent to "Quick New" functionality in traditional CAD applications,
|
|
13
|
+
* providing users with a ready-to-use drawing environment.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const qNewCmd = new AcApQNewCmd();
|
|
18
|
+
* qNewCmd.execute(context); // Creates new document from template
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class AcApQNewCmd extends AcEdCommand {
|
|
22
|
+
/**
|
|
23
|
+
* Executes the quick new command.
|
|
24
|
+
*
|
|
25
|
+
* Opens the ISO template from the CDN to create a new document
|
|
26
|
+
* with standard drawing settings.
|
|
27
|
+
*
|
|
28
|
+
* @param _context - The application context (unused in this command)
|
|
29
|
+
*/
|
|
30
|
+
execute(_context: AcApContext): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=AcApQNewCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApQNewCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApQNewCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,EAAE,WAAW;CAI9B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcApDocManager } from '../app';
|
|
17
|
+
import { AcEdCommand } from '../command';
|
|
18
|
+
/**
|
|
19
|
+
* Command for creating a new CAD document from a template.
|
|
20
|
+
*
|
|
21
|
+
* This command opens a predefined template drawing (acadiso.dxf) from
|
|
22
|
+
* a CDN to create a new document. The template provides:
|
|
23
|
+
* - Standard ISO drawing settings
|
|
24
|
+
* - Predefined layers and styles
|
|
25
|
+
* - Default drawing setup
|
|
26
|
+
*
|
|
27
|
+
* This is equivalent to "Quick New" functionality in traditional CAD applications,
|
|
28
|
+
* providing users with a ready-to-use drawing environment.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const qNewCmd = new AcApQNewCmd();
|
|
33
|
+
* qNewCmd.execute(context); // Creates new document from template
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
var AcApQNewCmd = /** @class */ (function (_super) {
|
|
37
|
+
__extends(AcApQNewCmd, _super);
|
|
38
|
+
function AcApQNewCmd() {
|
|
39
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Executes the quick new command.
|
|
43
|
+
*
|
|
44
|
+
* Opens the ISO template from the CDN to create a new document
|
|
45
|
+
* with standard drawing settings.
|
|
46
|
+
*
|
|
47
|
+
* @param _context - The application context (unused in this command)
|
|
48
|
+
*/
|
|
49
|
+
AcApQNewCmd.prototype.execute = function (_context) {
|
|
50
|
+
var baseUrl = AcApDocManager.instance.baseUrl;
|
|
51
|
+
AcApDocManager.instance.openUrl(baseUrl + 'templates/acadiso.dxf');
|
|
52
|
+
};
|
|
53
|
+
return AcApQNewCmd;
|
|
54
|
+
}(AcEdCommand));
|
|
55
|
+
export { AcApQNewCmd };
|
|
56
|
+
//# sourceMappingURL=AcApQNewCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApQNewCmd.js","sourceRoot":"","sources":["../../src/command/AcApQNewCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH;IAAiC,+BAAW;IAA5C;;IAaA,CAAC;IAZC;;;;;;;OAOG;IACH,6BAAO,GAAP,UAAQ,QAAqB;QAC3B,IAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAA;QAC/C,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,GAAG,uBAAuB,CAAC,CAAA;IACpE,CAAC;IACH,kBAAC;AAAD,CAAC,AAbD,CAAiC,WAAW,GAa3C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AcEdCommand } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* Command to redraw the current drawing in the CAD viewer.
|
|
4
|
+
*
|
|
5
|
+
* This command redraws the current drawing. It can be used after users set font
|
|
6
|
+
* mapping for missed fonts so that the current drawing can display texts with
|
|
7
|
+
* correct fonts.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const regenCmd = new AcApRegenCmd();
|
|
12
|
+
* regenCmd.execute(context); // Redraw the current drawing
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class AcApRegenCmd extends AcEdCommand {
|
|
16
|
+
/**
|
|
17
|
+
* Executes the regen command to redraw the current drawing
|
|
18
|
+
*/
|
|
19
|
+
execute(): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=AcApRegenCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApRegenCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApRegenCmd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAA;AAE/B;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,OAAO;CAGR"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcApDocManager } from '../app';
|
|
17
|
+
import { AcEdCommand } from '.';
|
|
18
|
+
/**
|
|
19
|
+
* Command to redraw the current drawing in the CAD viewer.
|
|
20
|
+
*
|
|
21
|
+
* This command redraws the current drawing. It can be used after users set font
|
|
22
|
+
* mapping for missed fonts so that the current drawing can display texts with
|
|
23
|
+
* correct fonts.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const regenCmd = new AcApRegenCmd();
|
|
28
|
+
* regenCmd.execute(context); // Redraw the current drawing
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
var AcApRegenCmd = /** @class */ (function (_super) {
|
|
32
|
+
__extends(AcApRegenCmd, _super);
|
|
33
|
+
function AcApRegenCmd() {
|
|
34
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Executes the regen command to redraw the current drawing
|
|
38
|
+
*/
|
|
39
|
+
AcApRegenCmd.prototype.execute = function () {
|
|
40
|
+
AcApDocManager.instance.regen();
|
|
41
|
+
};
|
|
42
|
+
return AcApRegenCmd;
|
|
43
|
+
}(AcEdCommand));
|
|
44
|
+
export { AcApRegenCmd };
|
|
45
|
+
//# sourceMappingURL=AcApRegenCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApRegenCmd.js","sourceRoot":"","sources":["../../src/command/AcApRegenCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAA;AAE/B;;;;;;;;;;;;GAYG;AACH;IAAkC,gCAAW;IAA7C;;IAOA,CAAC;IANC;;OAEG;IACH,8BAAO,GAAP;QACE,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACjC,CAAC;IACH,mBAAC;AAAD,CAAC,AAPD,CAAkC,WAAW,GAO5C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../command';
|
|
3
|
+
/**
|
|
4
|
+
* Command for enabling selection mode in the CAD viewer.
|
|
5
|
+
*
|
|
6
|
+
* This command switches the view to selection mode, allowing users to
|
|
7
|
+
* select CAD entities by clicking on them. When executed, it:
|
|
8
|
+
* - Sets the view mode to SELECTION
|
|
9
|
+
* - Changes the cursor to a crosshair for precise selection
|
|
10
|
+
*
|
|
11
|
+
* In selection mode, users can click on entities to select them,
|
|
12
|
+
* which will add them to the selection set and typically show
|
|
13
|
+
* grip points for manipulation.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const selectCmd = new AcApSelectCmd();
|
|
18
|
+
* selectCmd.execute(context); // Enables selection mode
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class AcApSelectCmd extends AcEdCommand {
|
|
22
|
+
/**
|
|
23
|
+
* Executes the select command.
|
|
24
|
+
*
|
|
25
|
+
* Sets the view to selection mode and updates the cursor appearance
|
|
26
|
+
* to indicate that entity selection is active.
|
|
27
|
+
*
|
|
28
|
+
* @param context - The application context containing the view
|
|
29
|
+
*/
|
|
30
|
+
execute(context: AcApContext): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=AcApSelectCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApSelectCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApSelectCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;CAI7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { AcEdCommand } from '../command';
|
|
17
|
+
import { AcEdCorsorType, AcEdViewMode } from '../editor';
|
|
18
|
+
/**
|
|
19
|
+
* Command for enabling selection mode in the CAD viewer.
|
|
20
|
+
*
|
|
21
|
+
* This command switches the view to selection mode, allowing users to
|
|
22
|
+
* select CAD entities by clicking on them. When executed, it:
|
|
23
|
+
* - Sets the view mode to SELECTION
|
|
24
|
+
* - Changes the cursor to a crosshair for precise selection
|
|
25
|
+
*
|
|
26
|
+
* In selection mode, users can click on entities to select them,
|
|
27
|
+
* which will add them to the selection set and typically show
|
|
28
|
+
* grip points for manipulation.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const selectCmd = new AcApSelectCmd();
|
|
33
|
+
* selectCmd.execute(context); // Enables selection mode
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
var AcApSelectCmd = /** @class */ (function (_super) {
|
|
37
|
+
__extends(AcApSelectCmd, _super);
|
|
38
|
+
function AcApSelectCmd() {
|
|
39
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Executes the select command.
|
|
43
|
+
*
|
|
44
|
+
* Sets the view to selection mode and updates the cursor appearance
|
|
45
|
+
* to indicate that entity selection is active.
|
|
46
|
+
*
|
|
47
|
+
* @param context - The application context containing the view
|
|
48
|
+
*/
|
|
49
|
+
AcApSelectCmd.prototype.execute = function (context) {
|
|
50
|
+
context.view.mode = AcEdViewMode.SELECTION;
|
|
51
|
+
context.view.setCursor(AcEdCorsorType.Crosshair);
|
|
52
|
+
};
|
|
53
|
+
return AcApSelectCmd;
|
|
54
|
+
}(AcEdCommand));
|
|
55
|
+
export { AcApSelectCmd };
|
|
56
|
+
//# sourceMappingURL=AcApSelectCmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApSelectCmd.js","sourceRoot":"","sources":["../../src/command/AcApSelectCmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH;IAAmC,iCAAW;IAA9C;;IAaA,CAAC;IAZC;;;;;;;OAOG;IACH,+BAAO,GAAP,UAAQ,OAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,SAAS,CAAA;QAC1C,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;IAClD,CAAC;IACH,oBAAC;AAAD,CAAC,AAbD,CAAmC,WAAW,GAa7C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for converting CAD drawings to SVG format.
|
|
3
|
+
*
|
|
4
|
+
* This class provides functionality to export the current CAD drawing
|
|
5
|
+
* to SVG format and download it as a file. It iterates through all
|
|
6
|
+
* entities in the model space and renders them using the SVG renderer.
|
|
7
|
+
*
|
|
8
|
+
* The conversion process:
|
|
9
|
+
* 1. Gets all entities from the current document's model space
|
|
10
|
+
* 2. Uses the SVG renderer to convert each entity to SVG markup
|
|
11
|
+
* 3. Exports the complete SVG content
|
|
12
|
+
* 4. Creates a downloadable file for the user
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const converter = new AcApSvgConvertor();
|
|
17
|
+
*
|
|
18
|
+
* // Convert and download current drawing as SVG
|
|
19
|
+
* converter.convert();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class AcApSvgConvertor {
|
|
23
|
+
/**
|
|
24
|
+
* Converts the current CAD drawing to SVG format and initiates download.
|
|
25
|
+
*
|
|
26
|
+
* This method:
|
|
27
|
+
* - Retrieves all entities from the current document's model space
|
|
28
|
+
* - Renders each entity using the SVG renderer
|
|
29
|
+
* - Exports the complete SVG markup
|
|
30
|
+
* - Automatically downloads the SVG file as 'example.svg'
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const converter = new AcApSvgConvertor();
|
|
35
|
+
* converter.convert(); // Downloads the drawing as SVG
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
convert(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a downloadable SVG file and triggers the download.
|
|
41
|
+
*
|
|
42
|
+
* This method:
|
|
43
|
+
* - Creates a Blob from the SVG content with proper MIME type
|
|
44
|
+
* - Generates a temporary download URL
|
|
45
|
+
* - Creates and triggers a download link
|
|
46
|
+
* - Cleans up the temporary elements
|
|
47
|
+
*
|
|
48
|
+
* @param svgContent - The SVG markup content to download
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private createFileAndDownloadIt;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=AcApSvgConvertor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApSvgConvertor.d.ts","sourceRoot":"","sources":["../../src/command/AcApSvgConvertor.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;IACH,OAAO;IAUP;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,uBAAuB;CAoBhC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
import { AcSvgRenderer } from '@mlightcad/svg-renderer';
|
|
13
|
+
import { AcApDocManager } from '../app';
|
|
14
|
+
/**
|
|
15
|
+
* Utility class for converting CAD drawings to SVG format.
|
|
16
|
+
*
|
|
17
|
+
* This class provides functionality to export the current CAD drawing
|
|
18
|
+
* to SVG format and download it as a file. It iterates through all
|
|
19
|
+
* entities in the model space and renders them using the SVG renderer.
|
|
20
|
+
*
|
|
21
|
+
* The conversion process:
|
|
22
|
+
* 1. Gets all entities from the current document's model space
|
|
23
|
+
* 2. Uses the SVG renderer to convert each entity to SVG markup
|
|
24
|
+
* 3. Exports the complete SVG content
|
|
25
|
+
* 4. Creates a downloadable file for the user
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const converter = new AcApSvgConvertor();
|
|
30
|
+
*
|
|
31
|
+
* // Convert and download current drawing as SVG
|
|
32
|
+
* converter.convert();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
var AcApSvgConvertor = /** @class */ (function () {
|
|
36
|
+
function AcApSvgConvertor() {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Converts the current CAD drawing to SVG format and initiates download.
|
|
40
|
+
*
|
|
41
|
+
* This method:
|
|
42
|
+
* - Retrieves all entities from the current document's model space
|
|
43
|
+
* - Renders each entity using the SVG renderer
|
|
44
|
+
* - Exports the complete SVG markup
|
|
45
|
+
* - Automatically downloads the SVG file as 'example.svg'
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const converter = new AcApSvgConvertor();
|
|
50
|
+
* converter.convert(); // Downloads the drawing as SVG
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
AcApSvgConvertor.prototype.convert = function () {
|
|
54
|
+
var e_1, _a;
|
|
55
|
+
var entities = AcApDocManager.instance.curDocument.database.tables.blockTable.modelSpace.newIterator();
|
|
56
|
+
var renderer = new AcSvgRenderer();
|
|
57
|
+
try {
|
|
58
|
+
for (var entities_1 = __values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
|
|
59
|
+
var entity = entities_1_1.value;
|
|
60
|
+
entity.draw(renderer);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
64
|
+
finally {
|
|
65
|
+
try {
|
|
66
|
+
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
|
|
67
|
+
}
|
|
68
|
+
finally { if (e_1) throw e_1.error; }
|
|
69
|
+
}
|
|
70
|
+
this.createFileAndDownloadIt(renderer.export());
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Creates a downloadable SVG file and triggers the download.
|
|
74
|
+
*
|
|
75
|
+
* This method:
|
|
76
|
+
* - Creates a Blob from the SVG content with proper MIME type
|
|
77
|
+
* - Generates a temporary download URL
|
|
78
|
+
* - Creates and triggers a download link
|
|
79
|
+
* - Cleans up the temporary elements
|
|
80
|
+
*
|
|
81
|
+
* @param svgContent - The SVG markup content to download
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
AcApSvgConvertor.prototype.createFileAndDownloadIt = function (svgContent) {
|
|
85
|
+
// Convert the SVG content into a Blob
|
|
86
|
+
var svgBlob = new Blob([svgContent], {
|
|
87
|
+
type: 'image/svg+xml;charset=utf-8'
|
|
88
|
+
});
|
|
89
|
+
// Create a URL for the Blob
|
|
90
|
+
var url = URL.createObjectURL(svgBlob);
|
|
91
|
+
// Create a download link and trigger the download
|
|
92
|
+
var downloadLink = document.createElement('a');
|
|
93
|
+
downloadLink.href = url;
|
|
94
|
+
downloadLink.download = 'example.svg';
|
|
95
|
+
// Append the link to the body (it needs to be in the DOM to work in some browsers)
|
|
96
|
+
document.body.appendChild(downloadLink);
|
|
97
|
+
// Trigger the download
|
|
98
|
+
downloadLink.click();
|
|
99
|
+
};
|
|
100
|
+
return AcApSvgConvertor;
|
|
101
|
+
}());
|
|
102
|
+
export { AcApSvgConvertor };
|
|
103
|
+
//# sourceMappingURL=AcApSvgConvertor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApSvgConvertor.js","sourceRoot":"","sources":["../../src/command/AcApSvgConvertor.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAAA;IA0DA,CAAC;IAzDC;;;;;;;;;;;;;;OAcG;IACH,kCAAO,GAAP;;QACE,IAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;QACzF,IAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAA;;YACpC,KAAqB,IAAA,aAAA,SAAA,QAAQ,CAAA,kCAAA,wDAAE,CAAC;gBAA3B,IAAM,MAAM,qBAAA;gBACf,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACvB,CAAC;;;;;;;;;QACD,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;;;;;;;;OAWG;IACK,kDAAuB,GAA/B,UAAgC,UAAkB;QAChD,sCAAsC;QACtC,IAAM,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE;YACrC,IAAI,EAAE,6BAA6B;SACpC,CAAC,CAAA;QAEF,4BAA4B;QAC5B,IAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;QAExC,kDAAkD;QAClD,IAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;QAChD,YAAY,CAAC,IAAI,GAAG,GAAG,CAAA;QACvB,YAAY,CAAC,QAAQ,GAAG,aAAa,CAAA;QAErC,mFAAmF;QACnF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;QAEvC,uBAAuB;QACvB,YAAY,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;IACH,uBAAC;AAAD,CAAC,AA1DD,IA0DC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AcApContext } from '../app';
|
|
2
|
+
import { AcEdCommand } from '../command';
|
|
3
|
+
/**
|
|
4
|
+
* Command to zoom the view to fit all visible entities.
|
|
5
|
+
*
|
|
6
|
+
* This command adjusts the view's zoom level and position to show all
|
|
7
|
+
* visible entities in the current drawing within the viewport. It's
|
|
8
|
+
* equivalent to the "Zoom Extents" or "Fit to Window" functionality
|
|
9
|
+
* found in most CAD applications.
|
|
10
|
+
*
|
|
11
|
+
* The command calculates the bounding box of all visible entities and
|
|
12
|
+
* adjusts the camera to show them all with appropriate padding.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const zoomCommand = new AcApZoomCmd();
|
|
17
|
+
* zoomCommand.globalName = 'ZOOM';
|
|
18
|
+
* zoomCommand.localName = 'Zoom to Fit';
|
|
19
|
+
*
|
|
20
|
+
* // Execute the command to fit all entities in view
|
|
21
|
+
* zoomCommand.trigger(docManager.context);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class AcApZoomCmd extends AcEdCommand {
|
|
25
|
+
/**
|
|
26
|
+
* Executes the zoom to fit command.
|
|
27
|
+
*
|
|
28
|
+
* Calls the view's `zoomToFit()` method to adjust the camera position
|
|
29
|
+
* and zoom level to display all visible entities within the viewport.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The current application context containing the view to zoom
|
|
32
|
+
*/
|
|
33
|
+
execute(context: AcApContext): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=AcApZoomCmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcApZoomCmd.d.ts","sourceRoot":"","sources":["../../src/command/AcApZoomCmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,WAAW;CAG7B"}
|