@manycore/custom-sdk 1.0.0-rc.0 → 1.0.1-latest.0

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.
Files changed (5) hide show
  1. package/index.css +3 -125
  2. package/index.d.ts +1165 -63
  3. package/index.js +93 -53
  4. package/package.json +11 -9
  5. package/1.index.js +0 -10
package/index.d.ts CHANGED
@@ -1,40 +1,153 @@
1
+ import { ELineType as ELineType_2 } from '@manycore/custom-miniapp-sdk';
1
2
  import { IExportModelData } from '@manycore/custom-miniapp-sdk';
3
+ import { IParamModelLite as IParamModelLite_2 } from '@qunhe/custom-apass-api';
4
+ import { IParamModelPhotoResponse } from '@manycore/custom-miniapp-sdk';
2
5
  import { Number3 } from '@manycore/custom-miniapp-sdk';
3
6
 
7
+ /**
8
+ * 对接2.0主应用
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const application = new Application();
13
+ * ```
14
+ */
4
15
  export declare class Application {
5
16
  constructor();
17
+ private serviceMap;
6
18
  /**
7
- * 启动当前应用
19
+ * 启动对接2.0应用
20
+ *
21
+ * 当前,在启动对接2.0应用时,默认会自动把酷家乐主工具当中,选中的模型,加载至对接2.0场景当中。
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * await application.start();
26
+ * ```
8
27
  */
9
28
  start(): Promise<void>;
10
29
  /**
11
- * 初始化语言类型
30
+ * 初始化语言类型(默认不需要处理)
31
+ *
32
+ * 如果你有多语言的诉求,可能会用到此功能
33
+ *
12
34
  * @param lang
13
35
  * @param resource
14
36
  */
15
37
  initLange(lang?: string, resource?: {}): void;
16
- stop(): void;
38
+ /**
39
+ * 停止对接2.0应用
40
+ *
41
+ * 当停用时,会让主工具当中,更新模型最新的锁定状态。
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * await application.stop();
46
+ * ```
47
+ */
48
+ stop(): Promise<void>;
49
+ /**
50
+ *
51
+ * 对接2.0中,获取相关的service
52
+ *
53
+ * 如果需要调用此方法,需要确保`Application`调用过`start`方法
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * const s = application.getService(FittingDesignService);
58
+ * ```
59
+ *
60
+ * @param serv
61
+ */
17
62
  getService<T extends BaseService>(serv: {
18
63
  new (): T;
19
64
  }): T;
20
65
  }
21
66
 
22
- declare class BaseService {
67
+ /**
68
+ * @private
69
+ */
70
+ declare abstract class BaseService {
71
+ __onDestroy?(): void;
72
+ }
73
+
74
+ /**
75
+ * 模型相关控制的逻辑
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const CustomModelService = application.getService(CustomModelService);
80
+ * ```
81
+ */
82
+ export declare class CustomModelService extends BaseService {
83
+ /**
84
+ * 获取所有模型
85
+ * @returns Promise<IParamModelLite[]>
86
+ */
87
+ getAllCustomModels(): Promise<IParamModelLite[]>;
88
+ /**
89
+ * 根据id获取所有模型
90
+ * @param id 模型id
91
+ * @returns Promise<IParamModelLite | undefined>
92
+ */
93
+ getCustomModelById(id: string): Promise<IParamModelLite | undefined>;
94
+ /**
95
+ * 保存模型改动
96
+ * @param models IParamModelLite[]
97
+ * @returns Promise<void>
98
+ * @example
99
+ * // 模型改动:隐藏
100
+ * model.setHidden(true);
101
+ * // 保存模型改动
102
+ * ModelService.save({ models: [model] }});
103
+ */
104
+ save(option: {
105
+ models: IParamModelLite[];
106
+ }): Promise<void>;
107
+ }
108
+
109
+ /**
110
+ * 相机展示模式
111
+ */
112
+ export declare enum ECameraMode {
113
+ /**
114
+ * 鸟瞰模式
115
+ */
116
+ View3D = "view3d",
117
+ /**
118
+ * 漫游模式
119
+ */
120
+ Roamer = "roamer"
23
121
  }
24
122
 
25
123
  /**
26
- * 配件附加参数数据类型
124
+ * 场景相机方向移动
27
125
  */
28
- export declare enum EFittingParametersType {
126
+ export declare enum ECameraMoveDirection {
127
+ /**
128
+ * 上移
129
+ */
130
+ UP = "UP",
131
+ /**
132
+ * 下移
133
+ */
134
+ DOWN = "DOWN",
135
+ /**
136
+ * 左移
137
+ */
138
+ LEFT = "LEFT",
139
+ /**
140
+ * 右移
141
+ */
142
+ RIGHT = "RIGHT",
29
143
  /**
30
- * 字符串
144
+ * 前进
31
145
  */
32
- string = "string",
33
- double = "double",
34
- long = "long",
35
- int = "int",
36
- float2 = "float2",
37
- float3 = "float3"
146
+ FRONT = "FRONT",
147
+ /**
148
+ * 后退
149
+ */
150
+ BACK = "BACK"
38
151
  }
39
152
 
40
153
  /**
@@ -53,14 +166,32 @@ export declare enum EFittingType {
53
166
  * 五金
54
167
  */
55
168
  HARDWARE = 3,
169
+ /**
170
+ * 五金槽
171
+ */
172
+ HARDWARE_GROOVE = 4,
56
173
  /**
57
174
  * 交接面信息
58
175
  */
59
- INTERSECTED = 4
176
+ INTERSECTED = "intersected"
177
+ }
178
+
179
+ /**
180
+ * 交接信息的产生方式
181
+ */
182
+ export declare enum EIntersectedCreatedType {
183
+ /**
184
+ * 板与板之间产生的交界
185
+ */
186
+ BOTH_PLANK = 0,
187
+ /**
188
+ * 板与五金之间产生的交界信息
189
+ */
190
+ PLANK_FURNITURE = 1
60
191
  }
61
192
 
62
193
  /**
63
- * 交接面、交接体数据类型
194
+ * 交接数据的数据类型
64
195
  */
65
196
  export declare enum EIntersectedType {
66
197
  /**
@@ -73,6 +204,9 @@ export declare enum EIntersectedType {
73
204
  FACE = "2"
74
205
  }
75
206
 
207
+ /**
208
+ * 语言
209
+ */
76
210
  export declare enum ELanguage {
77
211
  ZH_CN = "zh_CN",
78
212
  EN_US = "en_US",
@@ -88,6 +222,50 @@ export declare enum ELanguage {
88
222
  VI = "vi"
89
223
  }
90
224
 
225
+ /**
226
+ * 线的类型
227
+ */
228
+ export declare enum ELineType {
229
+ /**
230
+ * 直线
231
+ */
232
+ SEGMENT = 0,
233
+ /**
234
+ * 圆弧
235
+ */
236
+ CIRCLE_ARC = 1,
237
+ /**
238
+ * 椭圆
239
+ * 当前代码中,暂不支持
240
+ */
241
+ ELLIPSE_ARC = 3
242
+ }
243
+
244
+ /**
245
+ * 点的类型
246
+ */
247
+ export declare enum EPointType {
248
+ /**
249
+ * 普通点
250
+ */
251
+ NONE = 0,
252
+ /**
253
+ * 倒圆
254
+ */
255
+ CIRCLE = 1,
256
+ /**
257
+ * 倒角
258
+ */
259
+ LINE = 2,
260
+ /**
261
+ * 切圆,就是内挖一个倒圆的形状
262
+ */
263
+ CUT_CIRCLE = 3
264
+ }
265
+
266
+ /**
267
+ * 处理选中的内容
268
+ */
91
269
  export declare enum ESelectedType {
92
270
  /**
93
271
  * 未选中模型
@@ -103,53 +281,201 @@ export declare enum ESelectedType {
103
281
  CASBIN = 2
104
282
  }
105
283
 
284
+ /**
285
+ * 设置选中内容类型
286
+ */
287
+ export declare enum ESetSelectType {
288
+ /**
289
+ * 模型或商品
290
+ */
291
+ MODEL = 1,
292
+ /**
293
+ * 五金
294
+ */
295
+ CASBIN = 2
296
+ }
297
+
298
+ /**
299
+ * 定制行业工具线
300
+ */
301
+ export declare enum EToolType {
302
+ /**
303
+ * 定制厨卫
304
+ */
305
+ CABINET = "CABINET",
306
+ /**
307
+ * 定制家居
308
+ */
309
+ WARDROBE = "WARDROBE",
310
+ /**
311
+ * 定制门窗
312
+ */
313
+ DOOR_WINDOW = "DW",
314
+ /**
315
+ * 定制厨卫副本工具线
316
+ */
317
+ CABINET_COPY = "CABINET_COPY",
318
+ /**
319
+ * 定制家居副本工具线
320
+ */
321
+ WARDROBE_COPY = "WARDROBE_COPY",
322
+ /**
323
+ * 定制门窗副本工具线
324
+ */
325
+ DOOR_WINDOW_COPY = "DW_COPY"
326
+ }
327
+
328
+ /**
329
+ * 孔槽方案相关数据的管理
330
+ *
331
+ * @example
332
+ * ```typescript
333
+ * const fittingDesignService = application.getService(FittingDesignService);
334
+ * ```
335
+ */
106
336
  export declare class FittingDesignService extends BaseService {
107
337
  /**
108
338
  * 设置孔槽方案自动保存
109
339
  *
340
+ * 当你调用`appendFittingDesign`时,如果开启自动保存,就会将当前数据与之前数据作合并,并保存至后台。如果不开启,那只会临时暂存在状态中,后续调用`saveDesign`时,才会保存至后端。
341
+ *
342
+ * @default true 自动保存
343
+ *
344
+ * @example
345
+ * ```typescript
346
+ * fittingDesignService.toggleAutoSave(false);
347
+ * ```
348
+ *
110
349
  * @param autoSave 默认开启自动保存
111
350
  */
112
351
  toggleAutoSave(autoSave?: boolean): void;
113
352
  /**
114
- * 是否开启了自动保存功能
353
+ * 获取当前是否开启了自动保存
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * fittingDesignService.isAutoSave();
358
+ * ```
115
359
  */
116
360
  isAutoSave(): boolean;
117
361
  /**
362
+ * 获取孔/槽方案数据
363
+ *
364
+ * @example
365
+ * ```typescript
366
+ * fittingDesignService.getFittingDesignData();
367
+ * ```
368
+ *
369
+ * @param modelId 方案模型的ID,当没传时,就是获取场景中,正在预览的模型ID的方案数据
370
+ */
371
+ getFittingDesignData(modelId?: string): Promise<IFittingDesignData | null>;
372
+ /**
373
+ *
374
+ * 获取某个元件关联的孔/槽方案数据(仅作用于当前正在处理的模型)
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * // 获取当前正在编辑的方案信息
379
+ * fittingDesignService.getConnectedFittingDesign();
380
+ *
381
+ * // 获取某块板上关联的孔/槽数据
382
+ * fittingDesignService.getConnectedFittingDesign('id');
118
383
  *
119
- * 槽方案数据
384
+ * ```
120
385
  *
121
- * @param modelid 模型ID,如果为空时,则表示传递的为查询当前模型的数据
386
+ * @param modelid 模型ID,如果为空时,则表示传递的为查询当前正在编辑的模型的方案数据
122
387
  * @param casbin 是否为五金,当modelid为五金的id时,需要为true
123
388
  */
124
389
  getConnectedFittingDesign(modelid?: string, casbin?: boolean): Promise<IFittingDesignData | null>;
390
+ /**
391
+ * 五金槽路径验证API(非稳定API,暂不建议使用)
392
+ *
393
+ * @param path 待验证的路径
394
+ * @param linkModelId 关联的模型ID
395
+ */
396
+ validateFittingDesign(path: IHardwareGrooveData, linkModelId: string): IFittingDesignValidateResult;
125
397
  /**
126
398
  * 往当前方案中,新增孔/槽数据
127
399
  *
128
400
  * 会自动merge数据,但同一块板上,会进行覆盖
129
401
  *
130
- * @param design
402
+ * > 如果没有开启自动保存,调用此API只影响视图展示,不会立即存储至后端。
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * await fittingDesignService.save({
407
+ * ...
408
+ * })
409
+ * ```
410
+ *
411
+ * @param design 孔/槽方案信息
131
412
  * @param option { timeout, save} 调用超时,save 是否立即保存至后端,默认为true
132
413
  */
133
414
  appendFittingDesign(design: Partial<IFittingDesignData>, option?: {
415
+ /**
416
+ * 超时时间(只有在往后端保存时,才有效)
417
+ */
134
418
  timeout?: number;
419
+ /**
420
+ * 是否强制立即保存(即覆盖是否自动保存参数)
421
+ */
135
422
  save?: boolean;
136
423
  }): Promise<void>;
137
424
  /**
138
425
  * 保存孔/槽数据至方案
139
- * 如果design不传,即表示将分步保存数据保存至后端
426
+ * 如果design不传,即表示将分步保存数据存储至后端
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * await fittingDesignService.saveDesign({
431
+ * ...
432
+ * })
433
+ * ```
140
434
  *
141
- * @param design
435
+ * @param design 需要保存的方案信息
142
436
  * @param option
143
437
  */
144
438
  saveDesign(design?: IFittingDesignData, option?: {
145
439
  timeout?: number;
146
440
  }): Promise<void>;
147
441
  /**
148
- * 清空当前孔槽方案
442
+ * 删除当前孔槽方案(解锁主工具模型)
443
+ *
444
+ * 主工具当中,模型的锁定与解锁,与当前模型是不存在孔槽方案有关
445
+ * 默认情况下,option不传时,清空当前正在编辑的模型的孔槽方案,当传入modelId时,表示清空指定模型的孔槽方案数据
149
446
  *
150
- * @param timeout
447
+ * * @example
448
+ * ```typescript
449
+ * await fittingDesignService.clearDesign();
450
+ * ```
451
+ * @param options
151
452
  */
152
- clearDesign(timeout?: number): Promise<void>;
453
+ clearDesign(options?: IBaseOptions): Promise<void>;
454
+ }
455
+
456
+ /**
457
+ * 提供孔槽模型操作能力
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * const fittingModelService = application.getService(FittingModelService);
462
+ * ```
463
+ */
464
+ export declare class FittingModelService extends BaseService {
465
+ /**
466
+ * 获取所有五金孔槽模型
467
+ * @param modelId paramModel id,查找相关联孔槽五金
468
+ * @returns Promise<IFittingModelLite[]>
469
+ */
470
+ getAllFittingModels(modelId?: string): Promise<IFittingModelLite[]>;
471
+ /**
472
+ * 保存所有孔槽模型
473
+ * @param option
474
+ * @returns Promise<void>
475
+ */
476
+ save(option: {
477
+ models: IFittingModelLite[];
478
+ }): Promise<void>;
153
479
  }
154
480
 
155
481
  /**
@@ -157,25 +483,34 @@ export declare class FittingDesignService extends BaseService {
157
483
  */
158
484
  export declare interface IBaseFittingData {
159
485
  /**
160
- * 孔槽的id
486
+ * 开发者自己生成的孔、槽信息标识ID(自行区分)
161
487
  */
162
488
  id: string;
163
489
  /**
164
- * 类型
490
+ * 当前数据类型
165
491
  */
166
492
  fittingType: EFittingType;
167
493
  /**
168
- * 附加通用参数
494
+ * 附加通用参数,开发者可以自己存储一些数据
169
495
  */
170
- params?: EFittingParametersType[];
496
+ params?: IBaseFittingParameters[];
171
497
  }
172
498
 
173
499
  /**
174
500
  * 附加通用参数存储
175
501
  */
176
502
  export declare interface IBaseFittingParameters {
503
+ /**
504
+ * 通用参数的key
505
+ */
177
506
  key: string;
507
+ /**
508
+ * 通用参数的value
509
+ */
178
510
  value: string;
511
+ /**
512
+ * 当前value值的数据类型
513
+ */
179
514
  type: string;
180
515
  }
181
516
 
@@ -201,31 +536,61 @@ export declare class FittingDesignService extends BaseService {
201
536
  end: Number3;
202
537
  }
203
538
 
539
+ /**
540
+ * 交接信息
541
+ */
204
542
  export declare interface IBaseIntersected {
205
543
  /**
206
- * 板面
544
+ * 当前交接信息所处的板面信息
207
545
  */
208
546
  plankFaceId: number;
209
547
  /**
210
- * 所有点的信息
548
+ * 当前交接信息所有顶点的信息
549
+ * * 如果为交接面,length为4
550
+ * * 如果为交接体,length为8
211
551
  */
212
552
  points: Number3[];
213
553
  /**
214
- * 关联的模型ID
554
+ * 当前交接信息产生的元件ID
215
555
  */
216
556
  linkedModelId: string;
217
557
  /**
218
- * 关联的父级模型ID
558
+ * 交接信息产生元件的父母ID
219
559
  */
220
560
  linkedParentModelId: string;
221
561
  /**
222
- * 交接类型
562
+ * 交接数据的数据类型
223
563
  */
224
564
  '@type': EIntersectedType;
225
565
  /**
566
+ * @ignore
226
567
  * 交接体的shell数据
227
568
  */
228
569
  shell?: string;
570
+ /**
571
+ * 交接体板面是否需要开槽
572
+ * 当五金与板面产生的交接信息,为板面的部分,则为true
573
+ */
574
+ needGroove?: boolean;
575
+ }
576
+
577
+ /**
578
+ * 获取模型数据/交界面/体数据参数
579
+ */
580
+ export declare interface IBaseOptions {
581
+ /**
582
+ * 最长等待时间(以ms为单位)
583
+ * @default 500000
584
+ */
585
+ timeout?: number;
586
+ /**
587
+ * 模型ID
588
+ */
589
+ modelId?: string;
590
+ }
591
+
592
+ declare interface IChangeMap {
593
+ update?: IUpdateInfo[];
229
594
  }
230
595
 
231
596
  /**
@@ -248,6 +613,17 @@ export declare class FittingDesignService extends BaseService {
248
613
  * 五金数据
249
614
  */
250
615
  hardwares: IFittingHardwareCollect;
616
+ /**
617
+ * 五金槽数据
618
+ */
619
+ hardwareGrooves: IFittingHardwareGrooves;
620
+ }
621
+
622
+ export declare interface IFittingDesignValidateResult {
623
+ /**
624
+ * 是否验证通过
625
+ */
626
+ validated: boolean;
251
627
  }
252
628
 
253
629
  /**
@@ -260,11 +636,56 @@ export declare class FittingDesignService extends BaseService {
260
636
  */
261
637
  export declare type IFittingHardwareCollect = Record<string, IHardwareData[]>;
262
638
 
639
+ /**
640
+ * 五金槽数据
641
+ */
642
+ export declare type IFittingHardwareGrooves = Record<string, IHardwareGrooveData[]>;
643
+
263
644
  /**
264
645
  * 方案中,所有孔的数据
265
646
  */
266
647
  export declare type IFittingHoleCollect = Record<string, IHoleData[]>;
267
648
 
649
+ /**
650
+ * 五金孔槽通用模型
651
+ */
652
+ export declare interface IFittingModelLite {
653
+ /**
654
+ * 孔槽模型id
655
+ */
656
+ id: string;
657
+ /**
658
+ * 隐藏状态
659
+ */
660
+ isHidden: boolean;
661
+ /**
662
+ * 模型类型
663
+ */
664
+ modelType: EFittingType;
665
+ /**
666
+ * 关联 paramModel id
667
+ */
668
+ linkParamModelId: string;
669
+ /**
670
+ * 方案原始数据
671
+ */
672
+ originalData: IHoleData | IGrooveData | IHardwareData | IHardwareGrooveData;
673
+ /**
674
+ * 模型变更记录
675
+ */
676
+ __changeMap: IChangeMap;
677
+ /**
678
+ * 获取显示隐藏状态
679
+ * @returns
680
+ */
681
+ getHidden(): boolean;
682
+ /**
683
+ * 更新显示隐藏状态
684
+ * @param isHidden
685
+ */
686
+ setHidden(isHidden: boolean): void;
687
+ }
688
+
268
689
  export declare interface IGrooveData extends IBaseHoleGrooveData {
269
690
  width: number;
270
691
  }
@@ -295,6 +716,89 @@ export declare class FittingDesignService extends BaseService {
295
716
  linkedIds: string[];
296
717
  }
297
718
 
719
+ /**
720
+ * 闭合路径中的点,需要按逆时针顺序上传,否则会导致异常
721
+ */
722
+ export declare interface IHardwareGrooveData extends IBaseFittingData {
723
+ /**
724
+ * 槽的深度
725
+ */
726
+ depth: number;
727
+ /**
728
+ * 所处的板面
729
+ */
730
+ plankFaceId: number;
731
+ /**
732
+ * 闭合路径的所有点
733
+ */
734
+ points: IPointData[];
735
+ /**
736
+ * 闭合路径的所有线
737
+ */
738
+ lines: ILineData[];
739
+ }
740
+
741
+ /**
742
+ * 颜色配置信息
743
+ *
744
+ * @example
745
+ * ```json
746
+ * {
747
+ * "color": "#234432",
748
+ * "opacity": 0.8
749
+ * }
750
+ * ```
751
+ */
752
+ export declare interface IHintBase {
753
+ /**
754
+ * 颜色,以#开头,16进制
755
+ *
756
+ * @example
757
+ * ```
758
+ * #FFB6C1
759
+ * ```
760
+ */
761
+ color: string;
762
+ /**
763
+ * 透明度,范围为 0~1 ;当为1时,表示不透明;为0时,表示为全透明
764
+ */
765
+ opacity: number;
766
+ }
767
+
768
+ /**
769
+ * 配置默认的高亮配置信息
770
+ */
771
+ export declare interface IHintPlank {
772
+ /**
773
+ * 边框高亮颜色
774
+ */
775
+ hintOutline?: boolean | IHintBase;
776
+ /**
777
+ * 高亮的板面信息
778
+ */
779
+ hintPlankFace?: Array<IHintPlankFace | Omit<IHintPlankFace, keyof IHintBase>>;
780
+ }
781
+
782
+ /**
783
+ * 板面配置信息
784
+ *
785
+ * @example
786
+ * ```json
787
+ * {
788
+ * "color": "#234432",
789
+ * "opacity": 0.8,
790
+ * "plankFaceId": 1
791
+ * }
792
+ * ```
793
+ */
794
+ export declare interface IHintPlankFace extends IHintBase {
795
+ /**
796
+ * 需要展示的该信息的板面
797
+ * 支持多个板面ID或单个
798
+ */
799
+ plankFaceId: number | number[];
800
+ }
801
+
298
802
  export declare interface IHoleData extends IBaseHoleGrooveData {
299
803
  /**
300
804
  * 孔直径
@@ -302,27 +806,145 @@ export declare class FittingDesignService extends BaseService {
302
806
  diameter: number;
303
807
  }
304
808
 
809
+ /**
810
+ * 一组交接信息
811
+ */
305
812
  export declare interface IIntersectedGroup {
306
813
  /**
307
- * 交接面ID
814
+ * 交接信息的唯一标识ID
308
815
  */
309
816
  id: string;
310
817
  /**
311
- * 交接面信息
818
+ * 交接信息的产生来源
819
+ */
820
+ intersectType: EIntersectedCreatedType;
821
+ /**
822
+ * 关联元素产生的多组交接信息
312
823
  */
313
824
  intersecteds: IBaseIntersected[];
314
825
  }
315
826
 
316
827
  /**
317
- * 交接面信息
828
+ * 交接信息
318
829
  */
319
830
  export declare interface IIntersectedResult {
831
+ /**
832
+ * 交接信息集合
833
+ */
320
834
  intersectedGroups: IIntersectedGroup[];
321
835
  }
322
836
 
837
+ export declare type ILineData = ILineDataBase | ILineDataCircle;
838
+
839
+ export declare interface ILineDataBase {
840
+ /**
841
+ * 线条类型
842
+ */
843
+ type: ELineType_2.SEGMENT;
844
+ }
845
+
846
+ export declare interface ILineDataCircle {
847
+ /**
848
+ * 线条类型
849
+ */
850
+ type: ELineType_2.CIRCLE_ARC;
851
+ /**
852
+ * 是否顺时针
853
+ */
854
+ clockwise: boolean;
855
+ /**
856
+ * 优弧劣弧 (只有弧线有)
857
+ */
858
+ minorArc: boolean;
859
+ /**
860
+ * 半径 (只有弧线有)
861
+ */
862
+ radius: number;
863
+ }
864
+
865
+ /**
866
+ * 模型高亮默认配置信息
867
+ * @example
868
+ * ```json
869
+ * {
870
+ * "outline": {
871
+ * "color": "#234432",
872
+ * "opacity": 0.8,
873
+ * },
874
+ * "plankFace":{
875
+ * "color": "#234432",
876
+ * "opacity": 0.8,
877
+ * }
878
+ * }
879
+ * ```
880
+ */
881
+ export declare interface IModelDefaultHintOption {
882
+ /**
883
+ * 模型轮廓高亮信息
884
+ */
885
+ outline?: IHintBase;
886
+ /**
887
+ * 板面高亮配置信息
888
+ */
889
+ plankFace?: IHintBase;
890
+ }
891
+
892
+ /**
893
+ * 设置模型高亮时的配置信息
894
+ * @example
895
+ * ```typescript
896
+ * {
897
+ * "89D2793C-2B23-41A9-BA6E-4E3908490057": {
898
+ * // 使用默认的高亮配置信息
899
+ * "hintBorder": true,
900
+ * // 板件高亮
901
+ * "hintPlankFace": [
902
+ * {
903
+ * "color": "#234432",
904
+ * "opacity": 0.8,
905
+ * // 仅单个板面
906
+ * "plankFaceId": 1
907
+ * },
908
+ * {
909
+ * "color": "#233242",
910
+ * "opacity": 0.8,
911
+ * // 多个板面
912
+ * "plankFaceId": [2, 4]
913
+ * },
914
+ * // 使用默认颜色
915
+ * {
916
+ * "plankFaceId": 3
917
+ * }
918
+ * ]
919
+ * },
920
+ * "89D2793C-2B23-41A9-BA6E-4E3FS8490057": {
921
+ * // 自定议高亮配置信息
922
+ * "hintBorder": {
923
+ * "color": "#234432",
924
+ * "opacity": 0.8
925
+ * }
926
+ * }
927
+ * }
928
+ * ```
929
+ */
930
+ export declare type IModelHintOption = Record<string, IHintPlank>;
931
+
932
+ /**
933
+ * 获取交接信息
934
+ *
935
+ * @example
936
+ * ```typescript
937
+ * const intersectedService = application.getService(IntersectedService);
938
+ * ```
939
+ */
323
940
  export declare class IntersectedService extends BaseService {
324
941
  /**
325
- * 是否显示交接面信息
942
+ * 是否展示交接信息
943
+ *
944
+ * @example
945
+ * ```typescript
946
+ * intersectedService.toggleModelViewIntersected(true);
947
+ * ```
326
948
  *
327
949
  * @param flag
328
950
  */
@@ -330,24 +952,170 @@ export declare class FittingDesignService extends BaseService {
330
952
  /**
331
953
  * 切换展示的交接面、交接体坐标
332
954
  *
955
+ * @example
956
+ * ```typescript
957
+ * intersectedService.toggleModelViewedIntersected({
958
+ * references: true,
959
+ * plankFaceIds: [1],
960
+ * });
961
+ * ```
962
+ *
333
963
  * @param option
334
964
  */
335
965
  toggleModelViewedIntersected(option?: IToggleIntersectedViewOption): void;
336
966
  }
337
967
 
338
- export declare interface IPoint3d {
339
- x: number;
340
- y: number;
341
- z: number;
968
+ export declare interface IParamModelLite extends IParamModelLite_2 {
969
+ /**
970
+ * 获取显示隐藏状态
971
+ * @returns
972
+ */
973
+ getHidden(): boolean | undefined;
974
+ /**
975
+ * 更新显示隐藏状态
976
+ * @param isHidden
977
+ */
978
+ setHidden(isHidden: boolean): void;
342
979
  }
343
980
 
981
+ export { IParamModelPhotoResponse }
982
+
983
+ /**
984
+ * 点的基本类型
985
+ */
986
+ export declare interface IPointBase {
987
+ type: EPointType;
988
+ /**
989
+ * 点的位置
990
+ *
991
+ * @example
992
+ * "123,-345"
993
+ */
994
+ position: Number3;
995
+ }
996
+
997
+ /**
998
+ * 点的类型参数
999
+ */
1000
+ export declare type IPointData = IPointWithNone | IPointWithLine | IPointWithCircle | IPointWithCutCircle;
1001
+
1002
+ /**
1003
+ * 倒圆
1004
+ */
1005
+ export declare interface IPointWithCircle extends IPointBase {
1006
+ /**
1007
+ * 切角类型
1008
+ */
1009
+ type: EPointType.CIRCLE;
1010
+ /**
1011
+ * 切角边边距
1012
+ */
1013
+ /**
1014
+ * 半径 (倒圆切圆专用)
1015
+ * @example
1016
+ * "345.12"
1017
+ */
1018
+ radius: number;
1019
+ }
1020
+
1021
+ /**
1022
+ * 切圆(就是内挖一个倒圆的形状)
1023
+ */
1024
+ export declare interface IPointWithCutCircle extends Omit<IPointWithCircle, 'type'> {
1025
+ type: EPointType.CUT_CIRCLE;
1026
+ /**
1027
+ * 是否顺时针
1028
+ * 未设置时,则为false
1029
+ */
1030
+ clockwise: boolean;
1031
+ }
1032
+
1033
+ /**
1034
+ * 切角
1035
+ */
1036
+ export declare interface IPointWithLine extends IPointBase {
1037
+ /**
1038
+ * 切角类型
1039
+ */
1040
+ type: EPointType.LINE;
1041
+ /**
1042
+ * 切角边边距
1043
+ */
1044
+ cornerCutDistance: [number, number];
1045
+ }
1046
+
1047
+ /**
1048
+ * 普通点类型
1049
+ */
1050
+ export declare interface IPointWithNone extends IPointBase {
1051
+ /**
1052
+ * 普通点
1053
+ */
1054
+ type: EPointType.NONE;
1055
+ /**
1056
+ * 是否顺时针
1057
+ * 未设置时,则为false
1058
+ */
1059
+ clockwise?: boolean;
1060
+ }
1061
+
1062
+ /**
1063
+ * 房间信息
1064
+ */
1065
+ declare interface IRoomInfo {
1066
+ /**
1067
+ * 所属房间ID
1068
+ */
1069
+ roomId?: string;
1070
+ /**
1071
+ * 所属房间名
1072
+ */
1073
+ roomName?: string;
1074
+ }
1075
+
1076
+ /**
1077
+ * 当前选中的数据
1078
+ */
344
1079
  export declare interface ISelected {
1080
+ /**
1081
+ * 选中的数据内容
1082
+ */
345
1083
  data: IExportModelData[] | IHardwareData[];
1084
+ /**
1085
+ * 选中的数据类型
1086
+ */
346
1087
  type: ESelectedType;
347
1088
  }
348
1089
 
349
1090
  /**
350
- * 处理场景当中
1091
+ * 通过ID选中模型参数
1092
+ */
1093
+ export declare interface ISetSelectedByIdOption {
1094
+ /**
1095
+ * 模型ID/五金ID
1096
+ */
1097
+ id: string;
1098
+ /**
1099
+ * 选中的类型
1100
+ */
1101
+ type: ESetSelectType;
1102
+ }
1103
+
1104
+ /**
1105
+ * 场景中,模型的颜色配置能力
1106
+ *
1107
+ * @example
1108
+ * ```json
1109
+ * {
1110
+ * // 交接页数据信息
1111
+ * intersectedColor: 0xff4500,
1112
+ * // 交接体颜色
1113
+ * intersectedBodyColor: 0xff00ff,
1114
+ * holeColor: 0x00ff00,
1115
+ * grooveColor: 0x1e90ff,
1116
+ * }
1117
+ * ```
1118
+ *
351
1119
  */
352
1120
  export declare interface ISettingColor {
353
1121
  /**
@@ -358,6 +1126,14 @@ export declare class FittingDesignService extends BaseService {
358
1126
  * 交接体展示时,使用的颜色
359
1127
  */
360
1128
  intersectedBodyColor: number;
1129
+ /**
1130
+ * 五金与柜体之间,交接面产生的颜色
1131
+ */
1132
+ grooveIntersectedColor: number;
1133
+ /**
1134
+ * 五金与柜体之间,交接体产生的颜色
1135
+ */
1136
+ grooveIntersectedBodyColor: number;
361
1137
  /**
362
1138
  * 孔展示
363
1139
  */
@@ -368,80 +1144,406 @@ export declare class FittingDesignService extends BaseService {
368
1144
  grooveColor: number;
369
1145
  }
370
1146
 
1147
+ /**
1148
+ * 展示交接信息时的筛选行为
1149
+ */
371
1150
  export declare interface IToggleIntersectedViewOption {
372
1151
  /**
373
- * 是否展示
374
- * 默认为false
1152
+ * 切换展示交接信息数据
1153
+ *
1154
+ * * `true` 显示第一组交接数据
1155
+ * * `false`: 显示第二组交接数据
1156
+ *
1157
+ * @default false
375
1158
  */
376
1159
  references?: boolean;
377
- plankFaceIds?: number[];
1160
+ /**
1161
+ * 根据板面信息来筛选展示内容,null 表示空板面
1162
+ */
1163
+ plankFaceIds?: Array<number | null>;
1164
+ }
1165
+
1166
+ /**
1167
+ * 获取顶层模型返回值
1168
+ */
1169
+ export declare interface ITopParamModelDataResponse {
1170
+ /**
1171
+ * 当前查询总数
1172
+ */
1173
+ count: number;
1174
+ /**
1175
+ * 当前页码
1176
+ */
1177
+ currPage: number;
1178
+ /**
1179
+ * 是否还有可查询的结果
1180
+ */
1181
+ hasMore: boolean;
1182
+ /**
1183
+ * 查询的顶层模型结果
1184
+ */
1185
+ result: ITopParamModelList[];
1186
+ /**
1187
+ * 总的页数
1188
+ */
1189
+ totalPage: number;
1190
+ }
1191
+
1192
+ /**
1193
+ * 顶层模型信息
1194
+ */
1195
+ export declare interface ITopParamModelList {
1196
+ /**
1197
+ * 模型ID
1198
+ */
1199
+ id: string;
1200
+ /**
1201
+ * 所属工具线
1202
+ */
1203
+ toolType: EToolType;
1204
+ /**
1205
+ * 模型名称
1206
+ */
1207
+ name: string;
1208
+ /**
1209
+ * 户型信息
1210
+ */
1211
+ roomInfo: IRoomInfo;
1212
+ /**
1213
+ * 模型是否已拆单
1214
+ */
1215
+ isSplit: boolean;
1216
+ /**
1217
+ * 模型是否锁定
1218
+ */
1219
+ isLocked: boolean;
1220
+ /**
1221
+ * 模型是否隐藏
1222
+ */
1223
+ isHidden: boolean;
1224
+ /**
1225
+ * 模型是否提审
1226
+ */
1227
+ isAudited: boolean;
378
1228
  }
379
1229
 
1230
+ /**
1231
+ * 获取顶层模型参数
1232
+ */
1233
+ export declare interface ITopParamModelListOption {
1234
+ /**
1235
+ * 第几页
1236
+ * page 默认为 1
1237
+ */
1238
+ pageSize?: number;
1239
+ /**
1240
+ * 每页模型数量
1241
+ * size 默认为 20
1242
+ * 最大值为 500
1243
+ */
1244
+ pageNum?: number;
1245
+ }
1246
+
1247
+ declare interface IUpdateInfo {
1248
+ field: string;
1249
+ }
1250
+
1251
+ /**
1252
+ * 主要提供了场景相机的模式、移动等
1253
+ *
1254
+ * @example
1255
+ * ```typescript
1256
+ * const modelCameraService = application.getService(ModelCameraService);
1257
+ * ```
1258
+ */
1259
+ export declare class ModelCameraService extends BaseService {
1260
+ /**
1261
+ * 切换相机模式
1262
+ * @param mode 相机模式
1263
+ * @example
1264
+ * ```ts
1265
+ * const modelCameraService = application.getService(ModelCameraService);
1266
+ *
1267
+ * // 切换至漫游模式
1268
+ * modelCameraService.toggleCameraMode(ECameraMode.Roamer);
1269
+ * ```
1270
+ */
1271
+ toggleCameraMode(mode: ECameraMode): void;
1272
+ /**
1273
+ * 根据方向移动相机
1274
+ * @param direction 移动方向
1275
+ * @example
1276
+ * ```ts
1277
+ * const modelCameraService = application.getService(ModelCameraService);
1278
+ *
1279
+ * // 相机向上移动
1280
+ * modelCameraService.moveCamera(ECameraMoveDirection.UP);
1281
+ *
1282
+ * // 相机向前移动
1283
+ * modelCameraService.moveCamera(ECameraMoveDirection.FRONT);
1284
+ * ```
1285
+ */
1286
+ moveCamera(direction: ECameraMoveDirection): void;
1287
+ }
1288
+
1289
+ /**
1290
+ * 配置板件特殊标识
1291
+ *
1292
+ * @example
1293
+ * ```typescript
1294
+ * const modelHintService = application.getService(ModelHintService);
1295
+ * ```
1296
+ */
1297
+ export declare class ModelHintService extends BaseService {
1298
+ /**
1299
+ * 设置板件标识的特殊颜色
1300
+ * @example
1301
+ * modelHintService.setDefaultHint({
1302
+ * "outline": {
1303
+ * "color": "#234432",
1304
+ * "opacity": 0.8,
1305
+ * },
1306
+ * "plankFace":{
1307
+ * "color": "#234432",
1308
+ * "opacity": 0.8,
1309
+ * }
1310
+ * });
1311
+ */
1312
+ setDefaultHint(option: IModelDefaultHintOption): void;
1313
+ /**
1314
+ * 设置模型高亮
1315
+ *
1316
+ * @example
1317
+ * ```typescript
1318
+ * modelHintService.setModelHint({
1319
+ * "89D2793C-2B23-41A9-BA6E-4E3908490057": {
1320
+ * // 使用默认的标识信息
1321
+ * "hintBorder": true,
1322
+ * // 板件高亮
1323
+ * "hintPlankFace": [
1324
+ * {
1325
+ * "color": "#234432",
1326
+ * "opacity": 0.8,
1327
+ * // 仅单个板面
1328
+ * "plankFaceId": 1
1329
+ * },
1330
+ * {
1331
+ * "color": "#233242",
1332
+ * "opacity": 0.8,
1333
+ * // 多个板面
1334
+ * "plankFaceId": [2, 4]
1335
+ * },
1336
+ * // 使用默认颜色配置
1337
+ * {
1338
+ * "plankFaceId": 1
1339
+ * },
1340
+ * ]
1341
+ * },
1342
+ * "89D2793C-2B23-41A9-BA6E-4E3FS8490057": {
1343
+ * // 自定议标识颜色
1344
+ * "hintBorder": {
1345
+ * "color": "#234432",
1346
+ * "opacity": 0.8
1347
+ * }
1348
+ * }
1349
+ * })
1350
+ * ```
1351
+ */
1352
+ setModelHint(config: IModelHintOption): void;
1353
+ /**
1354
+ * 清空当前已经配置的标识信息
1355
+ *
1356
+ * 当id不传时,清空所有,当id传入部分时,则清除对应的内容
1357
+ *
1358
+ * @example
1359
+ * ```typescript
1360
+ * modelHintService.clearModelHint()
1361
+ * ```
1362
+ *
1363
+ * @param id 待删除标识信息的ID
1364
+ */
1365
+ clearModelHint(id?: string[]): void;
1366
+ }
1367
+
1368
+ /**
1369
+ * 主要提供了获取当前模型的 JSON 输出数据,以及当前模型的交接信息的功能。
1370
+ *
1371
+ * @example
1372
+ * ```typescript
1373
+ * const modelService = application.getService(ModelService);
1374
+ * ```
1375
+ */
380
1376
  export declare class ModelService extends BaseService {
381
1377
  /**
382
- * 获取当前整个模型数据信息
1378
+ * 开发者,通常需要来获取某个模型的 JSON 数据,所以需要用此 API。当前 API 获取 JSON 数据,主要是拿的是当前正在编辑的模型的 JSON 数据。
1379
+ * 如果传入modelId,则表示获取其他模型的JSON输出数据。
1380
+ *
1381
+ * 底层其实是通过`servkit`服务实现的。使用的是`MiniAppParamModelJsonDataService`服务。
1382
+ *
1383
+ * 使用servkit实现示例如下:
1384
+ *
1385
+ * @example
1386
+ * ```typescript
1387
+ * import { MiniAppParamModelJsonDataService } from '@manycore/custom-miniapp-sdk';
1388
+ * import { sappSDK } from 'servkit';
1389
+ *
1390
+ * const service = sappSDK.getServiceUnsafe(MiniAppParamModelJsonDataService);
1391
+ *
1392
+ * const json = await service.getModelJsonDataByModelId('请输入模型ID');
1393
+ * ```
1394
+ *
1395
+ * > 以上 API 暂不建议在非对接 2.0 环境下使用,主要是与孔/槽方案数据存在关联关系。
1396
+ > > 替代的 service 为`CustomDesignExportService`,将会在 9 月底最新的`@manycore/custom-miniapp-sdk`中提供。
383
1397
  *
384
- * @param timeout
1398
+ * @example
1399
+ * ```typescript
1400
+ * await modelService.getParamData();
1401
+ * ```
1402
+ *
1403
+ * @param options
385
1404
  */
386
- getParamData(timeout?: number): Promise<any>;
1405
+ getParamData(options?: IBaseOptions): Promise<any>;
387
1406
  /**
388
- * 获取交接面信息
1407
+ * 获取模型的交接数据
1408
+ *
1409
+ * @example
1410
+ * ```typescript
1411
+ * await modelService.getParamData();
1412
+ * ```
389
1413
  *
390
- * @param timeout
1414
+ * @param options
1415
+ */
1416
+ getParamIntersected(options?: IBaseOptions): Promise<IIntersectedResult>;
1417
+ /**
1418
+ * 获取方案顶层模型列表
1419
+ * @param options
391
1420
  */
392
- getParamIntersected(timeout?: number): Promise<IIntersectedResult>;
1421
+ getTopParamModels(options?: ITopParamModelListOption): Promise<ITopParamModelDataResponse>;
1422
+ getParamModelPhotoById(modelId: string | string[]): Promise<IParamModelPhotoResponse[]>;
393
1423
  }
394
1424
 
1425
+ /**
1426
+ * 主要是用来与场景交互的,监听当前选中的对象, 获取选中的内容
1427
+ *
1428
+ * @example
1429
+ * ```typescript
1430
+ * const viewerSelectionService = application.getService(ModelViewerSelectionService);
1431
+ * ```
1432
+ */
395
1433
  export declare class ModelViewerSelectionService extends BaseService {
396
1434
  constructor();
397
1435
  /**
398
- * 获取当前选中模型
1436
+ * 获取当前选中的数据
399
1437
  */
400
1438
  getSelected(): ISelected;
401
1439
  /**
402
- * 设置当前选中内容
1440
+ * 设置选中的模型
1441
+ * 同时选中多个模型暂未支持,请勿使用
1442
+ * @param option ISetSelectedByIdOption
1443
+ * @example
1444
+ * ```
1445
+ * const viewerSelectionService = application.getService(ModelViewerSelectionService);
1446
+ * const selectOption = {
1447
+ * id: 'modelId...',
1448
+ * type: ESetSelectType.MODEL,
1449
+ * };
1450
+ *
1451
+ * viewerSelectionService.select(selectOption);
1452
+ * ```
1453
+ */
1454
+ select(option: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
1455
+ /**
1456
+ * 取消场景当中选中内容
1457
+ * 同时取消多个模型暂未支持,请勿使用
1458
+ * @param option
1459
+ * @example
1460
+ * ```
1461
+ * const viewerSelectionService = application.getService(ModelViewerSelectionService);
1462
+ * const selectOption = {
1463
+ * id: 'modelId...',
1464
+ * type: ESetSelectType.MODEL,
1465
+ * };
1466
+ *
1467
+ * // 取消指定选中模型
1468
+ * viewerSelectionService.unSelect(selectOption);
1469
+ * // 默认取消全部选中模型
1470
+ * viewerSelectionService.unSelect();
1471
+ * ```
1472
+ */
1473
+ unSelect(option?: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
1474
+ /**
1475
+ * 根据参数生成entity
1476
+ * @param option
1477
+ * @returns entity
1478
+ * @private
1479
+ * @ignore
403
1480
  */
404
- select(selected: any[]): void;
1481
+ private __generateEntity;
405
1482
  /**
406
- * 取消选中所有内容
1483
+ * @ignore
407
1484
  */
408
- unSelect(): void;
409
1485
  private onSelectedChanged;
1486
+ /**
1487
+ * 监听当前选中内容
1488
+ * @param fn
1489
+ */
410
1490
  on(fn: (param: ISelected) => any): void;
1491
+ /**
1492
+ * 取消监听选中变化
1493
+ * @param fn
1494
+ */
411
1495
  off(fn?: (param: ISelected) => any): void;
1496
+ /**
1497
+ * 监听当前选中的内容(触发一次后自动取消)
1498
+ * @param fn
1499
+ */
412
1500
  once(fn: (param: ISelected) => any): void;
1501
+ /**
1502
+ * @ignore
1503
+ */
413
1504
  __onDestroy(): void;
414
1505
  }
415
1506
 
416
1507
  /**
417
- * 模型展示的服务
1508
+ * 主要提供了模型展示的控制能力:重置视角,边框,半透明,以及展示颜色配置
1509
+ *
1510
+ * @example
1511
+ * ```typescript
1512
+ * const modelViewerService = application.getService(ModelViewerService);
1513
+ * ```
418
1514
  */
419
1515
  export declare class ModelViewerService extends BaseService {
420
1516
  /**
421
- * 查看当前选中的模型
1517
+ * 将工具方案中,选中的模型,加载到对接 2.0 小程序中展示
1518
+ *
1519
+ * 此方法,会成Application.start方法中,默认执行
1520
+ *
422
1521
  */
423
1522
  viewSelected(): Promise<void>;
424
1523
  /**
425
- * 通过模型的ID来显示某个模型
1524
+ * 指定模型的 ID,将当前模型加载到工具方案当中
1525
+ *
426
1526
  * @param id 模型ID
427
1527
  */
428
1528
  viewModelById(id: string | string[]): Promise<void>;
429
1529
  /**
430
- * 重置视角
1530
+ * 重置视图展示视角
431
1531
  */
432
1532
  resetPerspective(): void;
433
1533
  /**
434
- * 模型渲染是都显示边框
1534
+ * 模型渲染是否显示边框
435
1535
  * @param flag
436
1536
  */
437
1537
  toggleModelBorder(flag: boolean): void;
438
1538
  /**
439
- * 模型渲染是否半透明
1539
+ * 模型渲染是否为半透明
440
1540
  * @param flag
441
1541
  */
442
1542
  toggleModelTransparent(flag: boolean): void;
443
1543
  /**
444
- * 配置场景展示界面
1544
+ * 设置交接信息展示颜色
1545
+ *
1546
+ * > `settings`,需要在application.start()后,立即被设置,否则展示会读取至之前配置信息,展示可能存在异常。
445
1547
  */
446
1548
  setting(settings: Partial<ISettingColor>): void;
447
1549
  }