mxcad 1.0.35 → 1.0.37

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 CHANGED
@@ -32,6 +32,77 @@ export declare const MxTools: {
32
32
  export declare function drawText(): Promise<void>;
33
33
  /** 绘制圆*/
34
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
+ }
35
106
  declare class MdRxObjectImp {
36
107
  }
37
108
  export interface MdCmColor {
@@ -126,13 +197,15 @@ export declare class MdDbDatabase extends MdRxObject {
126
197
  }
127
198
  export declare class McObject {
128
199
  private imp;
200
+ private mxObject;
129
201
  static currentFileName: string;
130
202
  constructor(imp: any);
203
+ initMxObject(mxObject: any): void;
131
204
  getImp(): any;
132
205
  getMxCppImp(): any;
133
206
  updateDisplay(modelViewMatrix: number[], projectionMatrix: number[]): void;
134
207
  test(): void;
135
- openWebFile(sFileUrl: string): boolean;
208
+ openWebFile(sFileUrl: string, retCall?: (iRet: number) => void, isWorkThread?: boolean): boolean;
136
209
  getCurrentFileName(): string;
137
210
  saveFileToUrl(sSaveProgramUrl: string): boolean;
138
211
  saveFile(pszFilePath?: string, call?: (data: any) => void, isDownland?: boolean, isShowSaveFileDialog?: boolean): boolean;
@@ -145,8 +218,8 @@ export declare class McObject {
145
218
  SetSysVarLong(varName: string, val: number): boolean;
146
219
  get DrawColor(): MdCmColor;
147
220
  set DrawColor(val: MdCmColor);
148
- get DrawLineWeight(): number;
149
- set DrawLineWeight(val: number);
221
+ get DrawLineWeight(): McDb.LineWeight;
222
+ set DrawLineWeight(val: McDb.LineWeight);
150
223
  get DrawLineTypeScale(): number;
151
224
  set DrawLineTypeScale(val: number);
152
225
  get DrawLinetype(): string;
@@ -224,22 +297,6 @@ export declare class MdDbLine extends MdDbCurve {
224
297
  get endPoint(): MdGePoint3d;
225
298
  set endPoint(pt: MdGePoint3d);
226
299
  }
227
- export declare namespace McDb {
228
- enum TextHorzMode {
229
- kTextLeft = 0,
230
- kTextCenter = 1,
231
- kTextRight = 2,
232
- kTextAlign = 3,
233
- kTextMid = 4,
234
- kTextFit = 5
235
- }
236
- enum TextVertMode {
237
- kTextBase = 0,
238
- kTextBottom = 1,
239
- kTextVertMid = 2,
240
- kTextTop = 3
241
- }
242
- }
243
300
  export declare class MdDbText extends MdDbEntity {
244
301
  constructor(imp?: any);
245
302
  get position(): MdGePoint3d;
@@ -263,18 +320,18 @@ export declare class MdDbText extends MdDbEntity {
263
320
  }
264
321
  export declare class MdDbCircle extends MdDbCurve {
265
322
  constructor(imp?: any);
323
+ setCenter(x: number, y: number, z?: number): void;
266
324
  get center(): MdGePoint3d;
267
- setCenter(x: number, y: number, z?: number): any;
268
325
  set center(pt: MdGePoint3d);
269
326
  get radius(): number;
270
327
  set radius(r: number);
271
328
  }
272
329
  export declare class MdDbPolyline extends MdDbCurve {
273
330
  constructor(imp?: any);
274
- setClosed(bClosed: boolean): void;
275
- setConstantWidth(dWdith: number): void;
276
- isClosed(): boolean;
277
- getConstantWidth(): number;
331
+ get isClosed(): boolean;
332
+ set isClosed(val: boolean);
333
+ get constantWidth(): number;
334
+ set constantWidth(val: number);
278
335
  addVertexAt(index: number, pt: McGePoint3d, bulge: number, startWidth: number, endWidth: number): boolean;
279
336
  removeVertexAt(index: number): boolean;
280
337
  numVerts(): number;
@@ -358,7 +415,104 @@ export declare function drawArc(): Promise<void>;
358
415
  export declare function drawEllipticalArc(): void;
359
416
  /** 绘制文字 */
360
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
+ }
361
513
  export declare let MxCpp: MxCppType;
362
- 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>;
363
517
 
364
518
  export {};