mxcad 1.0.34 → 1.0.36
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/mxcad.d.ts +197 -30
- package/dist/mxcad.es.js +505 -5808
- package/dist/mxcad.umd.js +529 -47
- package/dist/mxdraw3d_min.a2ae27fc.mjs +8644 -0
- package/dist/mxdraw3d_min.wasm +0 -0
- package/dist/mxdrawassembly_min.wasm +0 -0
- package/dist/mxdrawassembly_min.worker.js +1 -0
- package/package.json +8 -3
- package/dist/test.mxweb +0 -0
- package/dist/test2.mxweb +0 -0
package/dist/mxcad.d.ts
CHANGED
|
@@ -9,14 +9,100 @@ import { McGePoint3d } from 'mxdraw';
|
|
|
9
9
|
export declare function fetchAndInstantiate(url: string, importObject: WebAssembly.Imports): Promise<WebAssembly.WebAssemblyInstantiatedSource>;
|
|
10
10
|
export declare function b64Encode(str: string): string;
|
|
11
11
|
export declare function b64Decode(str: string): string;
|
|
12
|
+
export type FileTypes = {
|
|
13
|
+
description?: string;
|
|
14
|
+
accept: {
|
|
15
|
+
[type: string]: string[];
|
|
16
|
+
};
|
|
17
|
+
}[];
|
|
18
|
+
/** 文件下载保存(另存为只支持 Chrome86 或 Edge 86 以及 Opera 72)兼容 iE10等较低版本的浏览器 */
|
|
19
|
+
export declare function saveAsFileDialog({ blob, filename, types }: {
|
|
20
|
+
blob: Blob;
|
|
21
|
+
filename?: string;
|
|
22
|
+
types?: FileTypes;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
export declare function downloadFile(blob: any, filename: string): void;
|
|
12
25
|
export declare const MxTools: {
|
|
13
26
|
b64Encode: typeof b64Encode;
|
|
14
27
|
b64Decode: typeof b64Decode;
|
|
28
|
+
saveAsFileDialog: typeof saveAsFileDialog;
|
|
29
|
+
downloadFile: typeof downloadFile;
|
|
15
30
|
};
|
|
16
31
|
/** 绘制文字 */
|
|
17
32
|
export declare function drawText(): Promise<void>;
|
|
18
33
|
/** 绘制圆*/
|
|
19
34
|
export declare function drawCircle(): void;
|
|
35
|
+
export declare namespace McDb {
|
|
36
|
+
enum TextHorzMode {
|
|
37
|
+
kTextLeft = 0,
|
|
38
|
+
kTextCenter = 1,
|
|
39
|
+
kTextRight = 2,
|
|
40
|
+
kTextAlign = 3,
|
|
41
|
+
kTextMid = 4,
|
|
42
|
+
kTextFit = 5
|
|
43
|
+
}
|
|
44
|
+
enum TextVertMode {
|
|
45
|
+
kTextBase = 0,
|
|
46
|
+
kTextBottom = 1,
|
|
47
|
+
kTextVertMid = 2,
|
|
48
|
+
kTextTop = 3
|
|
49
|
+
}
|
|
50
|
+
enum AttachmentPoint {
|
|
51
|
+
kTopLeft = 1,
|
|
52
|
+
kTopCenter = 2,
|
|
53
|
+
kTopRight = 3,
|
|
54
|
+
kMiddleLeft = 4,
|
|
55
|
+
kMiddleCenter = 5,
|
|
56
|
+
kMiddleRight = 6,
|
|
57
|
+
kBottomLeft = 7,
|
|
58
|
+
kBottomCenter = 8,
|
|
59
|
+
kBottomRight = 9,
|
|
60
|
+
kBaseLeft = 10,
|
|
61
|
+
kBaseCenter = 11,
|
|
62
|
+
kBaseRight = 12,
|
|
63
|
+
kBaseAlign = 13,
|
|
64
|
+
kBottomAlign = 14,
|
|
65
|
+
kMiddleAlign = 15,
|
|
66
|
+
kTopAlign = 16,
|
|
67
|
+
kBaseFit = 17,
|
|
68
|
+
kBottomFit = 18,
|
|
69
|
+
kMiddleFit = 19,
|
|
70
|
+
kTopFit = 20,
|
|
71
|
+
kBaseMid = 21,
|
|
72
|
+
kBottomMid = 22,
|
|
73
|
+
kMiddleMid = 23,
|
|
74
|
+
kTopMid = 24
|
|
75
|
+
}
|
|
76
|
+
enum LineWeight {
|
|
77
|
+
kLnWt000 = 0,
|
|
78
|
+
kLnWt005 = 5,
|
|
79
|
+
kLnWt009 = 9,
|
|
80
|
+
kLnWt013 = 13,
|
|
81
|
+
kLnWt015 = 15,
|
|
82
|
+
kLnWt018 = 18,
|
|
83
|
+
kLnWt020 = 20,
|
|
84
|
+
kLnWt025 = 25,
|
|
85
|
+
kLnWt030 = 30,
|
|
86
|
+
kLnWt035 = 35,
|
|
87
|
+
kLnWt040 = 40,
|
|
88
|
+
kLnWt050 = 50,
|
|
89
|
+
kLnWt053 = 53,
|
|
90
|
+
kLnWt060 = 60,
|
|
91
|
+
kLnWt070 = 70,
|
|
92
|
+
kLnWt080 = 80,
|
|
93
|
+
kLnWt090 = 90,
|
|
94
|
+
kLnWt100 = 100,
|
|
95
|
+
kLnWt106 = 106,
|
|
96
|
+
kLnWt120 = 120,
|
|
97
|
+
kLnWt140 = 140,
|
|
98
|
+
kLnWt158 = 158,
|
|
99
|
+
kLnWt200 = 200,
|
|
100
|
+
kLnWt211 = 211,
|
|
101
|
+
kLnWtByLayer = -1,
|
|
102
|
+
kLnWtByBlock = -2,
|
|
103
|
+
kLnWtByLwDefault = -3
|
|
104
|
+
}
|
|
105
|
+
}
|
|
20
106
|
declare class MdRxObjectImp {
|
|
21
107
|
}
|
|
22
108
|
export interface MdCmColor {
|
|
@@ -111,18 +197,18 @@ export declare class MdDbDatabase extends MdRxObject {
|
|
|
111
197
|
}
|
|
112
198
|
export declare class McObject {
|
|
113
199
|
private imp;
|
|
114
|
-
|
|
200
|
+
private mxObject;
|
|
201
|
+
static currentFileName: string;
|
|
115
202
|
constructor(imp: any);
|
|
203
|
+
initMxObject(mxObject: any): void;
|
|
116
204
|
getImp(): any;
|
|
117
205
|
getMxCppImp(): any;
|
|
118
206
|
updateDisplay(modelViewMatrix: number[], projectionMatrix: number[]): void;
|
|
119
207
|
test(): void;
|
|
120
|
-
openWebFile(sFileUrl: string): boolean;
|
|
121
|
-
|
|
208
|
+
openWebFile(sFileUrl: string, retCall?: (iRet: number) => void, isWorkThread?: boolean): boolean;
|
|
209
|
+
getCurrentFileName(): string;
|
|
122
210
|
saveFileToUrl(sSaveProgramUrl: string): boolean;
|
|
123
|
-
|
|
124
|
-
private downloadFile;
|
|
125
|
-
saveFile(pszFilePath?: string, call?: (data: any) => void, isDownland?: boolean): boolean;
|
|
211
|
+
saveFile(pszFilePath?: string, call?: (data: any) => void, isDownland?: boolean, isShowSaveFileDialog?: boolean): boolean;
|
|
126
212
|
GetDatabase(): MdDbDatabase;
|
|
127
213
|
GetSysVarString(varName: string): string;
|
|
128
214
|
SetSysVarString(varName: string, val: string): any;
|
|
@@ -132,8 +218,8 @@ export declare class McObject {
|
|
|
132
218
|
SetSysVarLong(varName: string, val: number): boolean;
|
|
133
219
|
get DrawColor(): MdCmColor;
|
|
134
220
|
set DrawColor(val: MdCmColor);
|
|
135
|
-
get DrawLineWeight():
|
|
136
|
-
set DrawLineWeight(val:
|
|
221
|
+
get DrawLineWeight(): McDb.LineWeight;
|
|
222
|
+
set DrawLineWeight(val: McDb.LineWeight);
|
|
137
223
|
get DrawLineTypeScale(): number;
|
|
138
224
|
set DrawLineTypeScale(val: number);
|
|
139
225
|
get DrawLinetype(): string;
|
|
@@ -211,22 +297,6 @@ export declare class MdDbLine extends MdDbCurve {
|
|
|
211
297
|
get endPoint(): MdGePoint3d;
|
|
212
298
|
set endPoint(pt: MdGePoint3d);
|
|
213
299
|
}
|
|
214
|
-
export declare namespace McDb {
|
|
215
|
-
enum TextHorzMode {
|
|
216
|
-
kTextLeft = 0,
|
|
217
|
-
kTextCenter = 1,
|
|
218
|
-
kTextRight = 2,
|
|
219
|
-
kTextAlign = 3,
|
|
220
|
-
kTextMid = 4,
|
|
221
|
-
kTextFit = 5
|
|
222
|
-
}
|
|
223
|
-
enum TextVertMode {
|
|
224
|
-
kTextBase = 0,
|
|
225
|
-
kTextBottom = 1,
|
|
226
|
-
kTextVertMid = 2,
|
|
227
|
-
kTextTop = 3
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
300
|
export declare class MdDbText extends MdDbEntity {
|
|
231
301
|
constructor(imp?: any);
|
|
232
302
|
get position(): MdGePoint3d;
|
|
@@ -250,18 +320,18 @@ export declare class MdDbText extends MdDbEntity {
|
|
|
250
320
|
}
|
|
251
321
|
export declare class MdDbCircle extends MdDbCurve {
|
|
252
322
|
constructor(imp?: any);
|
|
323
|
+
setCenter(x: number, y: number, z?: number): void;
|
|
253
324
|
get center(): MdGePoint3d;
|
|
254
|
-
setCenter(x: number, y: number, z?: number): any;
|
|
255
325
|
set center(pt: MdGePoint3d);
|
|
256
326
|
get radius(): number;
|
|
257
327
|
set radius(r: number);
|
|
258
328
|
}
|
|
259
329
|
export declare class MdDbPolyline extends MdDbCurve {
|
|
260
330
|
constructor(imp?: any);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
331
|
+
get isClosed(): boolean;
|
|
332
|
+
set isClosed(val: boolean);
|
|
333
|
+
get constantWidth(): number;
|
|
334
|
+
set constantWidth(val: number);
|
|
265
335
|
addVertexAt(index: number, pt: McGePoint3d, bulge: number, startWidth: number, endWidth: number): boolean;
|
|
266
336
|
removeVertexAt(index: number): boolean;
|
|
267
337
|
numVerts(): number;
|
|
@@ -345,7 +415,104 @@ export declare function drawArc(): Promise<void>;
|
|
|
345
415
|
export declare function drawEllipticalArc(): void;
|
|
346
416
|
/** 绘制文字 */
|
|
347
417
|
export declare function mxErase(): Promise<void>;
|
|
418
|
+
declare const getWasmURL: (wasmURL: string, baseURL: string | URL) => string;
|
|
419
|
+
/** wasm importObject 的可配置选项 */
|
|
420
|
+
export interface WasmConfig {
|
|
421
|
+
/** 二进制数据 设置wasmBinary 则 locateFile 不生效**/
|
|
422
|
+
wasmBinary?: ArrayBuffer;
|
|
423
|
+
/** 手动指定wasm文件位置 */
|
|
424
|
+
locateFile?: typeof getWasmURL;
|
|
425
|
+
/** 打印 */
|
|
426
|
+
print?: (theText: string) => string;
|
|
427
|
+
/** 打印错误 */
|
|
428
|
+
printErr?: (theText: string) => void;
|
|
429
|
+
/** 监听运行时初始化 */
|
|
430
|
+
onRuntimeInitialized?: () => void;
|
|
431
|
+
}
|
|
432
|
+
/** MxDraw3d的构造函数参数 的可配置选项 */
|
|
433
|
+
export interface MxDraw3dConfig extends WasmConfig {
|
|
434
|
+
[x: string]: any;
|
|
435
|
+
canvas: string | HTMLCanvasElement;
|
|
436
|
+
/** canvas最小宽度 默认300 */
|
|
437
|
+
minWidth?: number;
|
|
438
|
+
/** canvas最小高度 默认300 */
|
|
439
|
+
minHeight?: number;
|
|
440
|
+
/** 指定更新Canvas大小的函数,不指定则默认自动处理(指定该函数则 minHeight, minWidth无效) */
|
|
441
|
+
updateCanvasSize?: () => void;
|
|
442
|
+
}
|
|
443
|
+
export declare class MxDraw3d implements MxDraw3dConfig {
|
|
444
|
+
[x: string]: any;
|
|
445
|
+
/** 监听wasm 文件加载成功事件 */
|
|
446
|
+
static onloadWasmMxDraw3dModel: (mxDraw3d: MxDraw3d) => void;
|
|
447
|
+
canvas: HTMLCanvasElement;
|
|
448
|
+
constructor(options: MxDraw3dConfig);
|
|
449
|
+
}
|
|
450
|
+
export interface MxDraw3d extends WasmConfig {
|
|
451
|
+
canvas: HTMLCanvasElement;
|
|
452
|
+
_malloc: (len: number) => Buffer;
|
|
453
|
+
HEAPU8: {
|
|
454
|
+
set(dataArray: Uint8Array, dataBuffer: Buffer): void;
|
|
455
|
+
};
|
|
456
|
+
ctx: WebGLRenderingContext | WebGL2RenderingContext | null;
|
|
457
|
+
/** 设置Canvas大小
|
|
458
|
+
* @param w 宽度
|
|
459
|
+
* @param h 高度
|
|
460
|
+
* @param noUpdate 不更新调整侦听器大小 默认 是true
|
|
461
|
+
* */
|
|
462
|
+
setCanvasSize(w: number, h: number, noUpdate?: boolean): void;
|
|
463
|
+
/** 暂停主循环 */
|
|
464
|
+
pauseMainLoop(): void;
|
|
465
|
+
/** 恢复主循环 */
|
|
466
|
+
resumeMainLoop(): void;
|
|
467
|
+
/** 从内存打开
|
|
468
|
+
* @param fileName 表示文件名称 (可通过浏览器 File对象的name属性或者自定义) 是生成渲染3D对象的唯一标识
|
|
469
|
+
* @param dataBuffer 文件数据的缓冲区
|
|
470
|
+
* @param len 缓冲区的长度
|
|
471
|
+
* @param is 是否为压缩格式
|
|
472
|
+
* */
|
|
473
|
+
openFromMemory(fileName: string, dataBuffer: Buffer, len: number, is?: boolean): boolean;
|
|
474
|
+
/** 从内存打开
|
|
475
|
+
* @param fileName 表示文件名称 (可通过浏览器 File对象的name属性或者自定义) 是生成渲染3D对象的唯一标识
|
|
476
|
+
* @param dataBuffer 文件数据的缓冲区
|
|
477
|
+
* @param len 缓冲区的长度
|
|
478
|
+
* @param is 是否为压缩格式
|
|
479
|
+
* */
|
|
480
|
+
openBRepFromMemory(fileName: string, dataBuffer: Buffer, len: number, is?: boolean): boolean;
|
|
481
|
+
/** 从Url打开
|
|
482
|
+
* @param name 名称 是生成渲染3D对象的唯一标识
|
|
483
|
+
* @param fileUrl 文件路径
|
|
484
|
+
* */
|
|
485
|
+
openFromUrl: (name: string, fileUrl: string) => void;
|
|
486
|
+
/** 设置多维数据集贴图背景 */
|
|
487
|
+
setCubemapBackground(url: string): void;
|
|
488
|
+
/** 完成初始化 */
|
|
489
|
+
ready: Promise<MxDraw3d>;
|
|
490
|
+
/*** 显示地面或地面网格 */
|
|
491
|
+
displayGround(is: boolean): void;
|
|
492
|
+
/**
|
|
493
|
+
* 显示对象
|
|
494
|
+
* @param 唯一标识名称 是openFromUrl、openBRepFromMemory、 openFromMemory、 (open3DFile参数 file的name属性)
|
|
495
|
+
* */
|
|
496
|
+
displayObject(name: string): boolean;
|
|
497
|
+
/**
|
|
498
|
+
* 擦除对象
|
|
499
|
+
* @param 唯一标识名称 是openFromUrl、openBRepFromMemory、 openFromMemory、 (open3DFile参数 file的name属性)
|
|
500
|
+
* */
|
|
501
|
+
eraseObject(name: string): boolean;
|
|
502
|
+
/** 适应所有对象 */
|
|
503
|
+
fitAllObjects(is: boolean): void;
|
|
504
|
+
/** 删除所有对象 */
|
|
505
|
+
removeAllObjects(): void;
|
|
506
|
+
/** 更新画布大小 */
|
|
507
|
+
updateCanvasSize: () => void;
|
|
508
|
+
/** 通过浏览器器File对象打开3D文件
|
|
509
|
+
* @param file File对象
|
|
510
|
+
*/
|
|
511
|
+
open3DFile: (file: File) => void;
|
|
512
|
+
}
|
|
348
513
|
export declare let MxCpp: MxCppType;
|
|
349
|
-
export declare function loadMxCADassembly(call: (MxCpp: MxCppType) => void, locateFile?: (wasmURL: string, baseURL: string | URL) => string): void
|
|
514
|
+
export declare function loadMxCADassembly(call: (MxCpp: MxCppType) => void, locateFile?: (wasmURL: string, baseURL: string | URL) => string, wasmBinary?: ArrayBuffer): Promise<void>;
|
|
515
|
+
export declare function loadMxCADassembly3d(config: MxDraw3dConfig, call?: (mxDraw3d: MxDraw3d) => void): Promise<MxDraw3d>;
|
|
516
|
+
export declare function loadWasmModule(wasmUrl: string): Promise<unknown>;
|
|
350
517
|
|
|
351
518
|
export {};
|