@manycore/custom-sdk 1.8.2-rc.0 → 1.9.1-rc.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 (3) hide show
  1. package/index.d.ts +499 -8
  2. package/index.js +23 -22
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -2,7 +2,9 @@ import { ELineType as ELineType_2 } from '@manycore/custom-miniapp-sdk';
2
2
  import { IExportModelData } from '@manycore/custom-miniapp-sdk';
3
3
  import { IParamModelPhotoResponse } from '@manycore/custom-miniapp-sdk';
4
4
  import { IServClientService } from 'servkit';
5
+ import { Number2 } from '@manycore/custom-miniapp-sdk';
5
6
  import { Number3 } from '@manycore/custom-miniapp-sdk';
7
+ import { PlankArea } from '@qunhe/miniapp-model-viewer-core/src/model/base/plankArea';
6
8
  import { ServService } from 'servkit';
7
9
 
8
10
  declare interface AMap<K, V> {
@@ -125,6 +127,24 @@ declare abstract class BaseService {
125
127
  __onDestroy?(): void;
126
128
  }
127
129
 
130
+ /**
131
+ * 定制模型真分类过滤列表默认值
132
+ */
133
+ export declare const CUSTOM_MODEL_CATEGORY_FILTER = [
134
+ /**
135
+ * 装饰陈设
136
+ */
137
+ 596,
138
+ /**
139
+ * 参数化软装
140
+ */
141
+ 2048,
142
+ /**
143
+ * 软装部件
144
+ */
145
+ 2049,
146
+ ];
147
+
128
148
  /**
129
149
  * 模型相关控制的逻辑
130
150
  *
@@ -206,6 +226,20 @@ export declare enum ECameraMoveDirection {
206
226
  BACK = "BACK"
207
227
  }
208
228
 
229
+ /**
230
+ * 线是否顺时针的值
231
+ */
232
+ declare enum EClockWise {
233
+ /**
234
+ * 顺时针
235
+ */
236
+ TRUE = "true",
237
+ /**
238
+ * 逆时针
239
+ */
240
+ FALSE = "false"
241
+ }
242
+
209
243
  /**
210
244
  * 交互模式
211
245
  */
@@ -349,6 +383,25 @@ export declare enum ELineType {
349
383
  ELLIPSE_ARC = 3,
350
384
  }
351
385
 
386
+ /**
387
+ * 线的类型
388
+ */
389
+ declare enum ELineType_3 {
390
+ /**
391
+ * 直线
392
+ */
393
+ SEGMENT = 0,
394
+ /**
395
+ * 圆弧
396
+ */
397
+ CIRCLE_ARC = 1,
398
+ /**
399
+ * 椭圆
400
+ * 当前代码中,暂不支持
401
+ */
402
+ ELLIPSE_ARC = 3
403
+ }
404
+
352
405
  /**
353
406
  * 模型类型
354
407
  */
@@ -386,27 +439,98 @@ declare enum EParamModelType {
386
439
  }
387
440
 
388
441
  declare enum EParamType {
442
+ /**
443
+ * 浮点数
444
+ */
389
445
  FLOAT = "float",
446
+ /**
447
+ * 二维浮点数
448
+ */
390
449
  FLOAT2 = "float2",
450
+ /**
451
+ * 三维浮点数
452
+ */
391
453
  FLOAT3 = "float3",
454
+ /**
455
+ * 浮点数
456
+ */
392
457
  FLOAT_BUFFER = "floatbuf",
458
+ /**
459
+ * 二维浮点数
460
+ */
393
461
  FLOAT2_BUFFER = "float2buf",
462
+ /**
463
+ * 三维浮点数
464
+ */
394
465
  FLOAT3_BUFFER = "float3buf",
466
+ /**
467
+ * 引用
468
+ */
395
469
  REFERENCE = "reference",
470
+ /**
471
+ * 整数
472
+ */
396
473
  INT = "int",
474
+ /**
475
+ * 整数
476
+ */
397
477
  INT_BUFFER = "intbuf",
478
+ /**
479
+ * 字符串
480
+ */
398
481
  STRING = "string",
482
+ /**
483
+ * 轮廓,一般为商品ID
484
+ */
399
485
  SHAPE = "shape",
486
+ /**
487
+ * 材质,一般存储为商品ID
488
+ */
400
489
  MATERIAL = "material",
490
+ /**
491
+ * 布尔
492
+ */
401
493
  BOOLEAN = "boolean",
494
+ /**
495
+ * 布尔
496
+ */
402
497
  BOOLEAN_BUFFER = "booleanbuf",
498
+ /**
499
+ * 适配
500
+ */
403
501
  FIT = "fit",
502
+ /**
503
+ * 路径
504
+ */
404
505
  PATH = "paramcornerpath",
506
+ /**
507
+ * 样式
508
+ */
405
509
  STYLE = "style",
510
+ /**
511
+ * 字符串
512
+ */
406
513
  FORMULA_STRING = "formulaString",
514
+ /**
515
+ * 多布尔
516
+ */
407
517
  BOOLEAN_LIST = "booleanlist"
408
518
  }
409
519
 
520
+ /**
521
+ * 板件轮廓路径类型
522
+ */
523
+ export declare enum EPlankPathType {
524
+ /**
525
+ * 内部路径,例如某个挖洞
526
+ */
527
+ INNER = 'inner',
528
+ /**
529
+ * 外部路径
530
+ */
531
+ OUTER = 'outer',
532
+ }
533
+
410
534
  /**
411
535
  * 点的类型
412
536
  */
@@ -427,6 +551,36 @@ export declare enum EPointType {
427
551
  * 切圆,就是内挖一个倒圆的形状
428
552
  */
429
553
  CUT_CIRCLE = 3,
554
+ /**
555
+ * 椭圆
556
+ */
557
+ ELLIPSE = 4,
558
+ }
559
+
560
+ /**
561
+ * 点的类型
562
+ */
563
+ declare enum EPointType_2 {
564
+ /**
565
+ * 普通点
566
+ */
567
+ NONE = 0,
568
+ /**
569
+ * 倒圆
570
+ */
571
+ CIRCLE = 1,
572
+ /**
573
+ * 倒角
574
+ */
575
+ LINE = 2,
576
+ /**
577
+ * 切圆,就是内挖一个倒圆的形状
578
+ */
579
+ CUT_CIRCLE = 3,
580
+ /**
581
+ * 椭圆
582
+ */
583
+ ELLIPSE = 4
430
584
  }
431
585
 
432
586
  /**
@@ -1160,16 +1314,104 @@ export declare class FittingDesignService extends BaseService {
1160
1314
  intersectedGroups: IIntersectedGroup[];
1161
1315
  }
1162
1316
 
1317
+ /**
1318
+ * 轮廓路径线段表示
1319
+ */
1320
+ export declare interface ILine extends ILineBase {
1321
+ /**
1322
+ * 获取实际渲染端点
1323
+ * >线段两端
1324
+ */
1325
+ getRenderPoints(): [Number2, Number2];
1326
+ /**
1327
+ * 设置线段的高亮,高亮深度为板件厚度
1328
+ * @param hint 高亮配置
1329
+ */
1330
+ setHint(hint: IHintBase): void;
1331
+ /**
1332
+ * 清除高亮
1333
+ */
1334
+ clearHint(): void;
1335
+ /**
1336
+ * 获取高亮
1337
+ */
1338
+ getHint(): IHintBase | undefined;
1339
+ }
1340
+
1341
+ /**
1342
+ * 线段表示
1343
+ */
1344
+ export declare interface ILineBase {
1345
+ /**
1346
+ * 线条类型
1347
+ */
1348
+ type: ELineType;
1349
+ /**
1350
+ * 圆弧是否为顺时针
1351
+ */
1352
+ clockwise?: boolean;
1353
+ /**
1354
+ * 圆弧是否为劣弧
1355
+ */
1356
+ minorArc?: boolean;
1357
+ /**
1358
+ * 圆弧半径
1359
+ */
1360
+ radius?: number;
1361
+ /**
1362
+ * 椭圆弧长轴
1363
+ */
1364
+ majorRadius?: number;
1365
+ /**
1366
+ * 椭圆弧短轴
1367
+ */
1368
+ minorRadius?: number;
1369
+ /**
1370
+ * 椭圆圆心
1371
+ */
1372
+ ellipseCenter?: Number2;
1373
+ }
1374
+
1375
+ declare interface ILineData$1 {
1376
+ /**
1377
+ * 线条类型
1378
+ */
1379
+ type: ELineType_3;
1380
+ /**
1381
+ * 是否顺时针
1382
+ */
1383
+ clockwise?: boolean;
1384
+ /**
1385
+ * 优弧劣弧 (只有弧线有)
1386
+ */
1387
+ minorArc?: boolean;
1388
+ /**
1389
+ * 半径 (只有弧线有)
1390
+ */
1391
+ radius?: number;
1392
+ }
1393
+
1163
1394
  export declare type ILineData = ILineDataBase | ILineDataCircle;
1164
1395
 
1165
- export declare interface ILineDataBase {
1396
+ /**
1397
+ * 直线
1398
+ */
1399
+ export declare interface ILineDataBase
1400
+ extends Omit<
1401
+ ILineBase,
1402
+ 'ellipseCenter' | 'clockwise' | 'minorArc' | 'radius' | 'majorRadius' | 'minorRadius'
1403
+ > {
1166
1404
  /**
1167
1405
  * 线条类型
1168
1406
  */
1169
1407
  type: ELineType_2.SEGMENT;
1170
1408
  }
1171
1409
 
1172
- export declare interface ILineDataCircle {
1410
+ /**
1411
+ * 弧线
1412
+ */
1413
+ export declare interface ILineDataCircle
1414
+ extends Omit<ILineBase, 'ellipseCenter' | 'majorRadius' | 'minorRadius'> {
1173
1415
  /**
1174
1416
  * 线条类型
1175
1417
  */
@@ -1318,6 +1560,20 @@ export declare class FittingDesignService extends BaseService {
1318
1560
  * @type string
1319
1561
  */
1320
1562
  readonly id: string;
1563
+ /**
1564
+ * 模型在方案中的名称
1565
+ * @readonly
1566
+ * @public
1567
+ * @type string
1568
+ */
1569
+ name: string;
1570
+ /**
1571
+ * 模型的备注信息
1572
+ * @readonly
1573
+ * @public
1574
+ * @typedef Number3
1575
+ */
1576
+ remark?: string;
1321
1577
  /**
1322
1578
  * 当前位置信息
1323
1579
  * @readonly
@@ -1390,6 +1646,26 @@ export declare class FittingDesignService extends BaseService {
1390
1646
  * @readonly
1391
1647
  */
1392
1648
  isRoot?: boolean;
1649
+ /**
1650
+ * 获取当前模型名称
1651
+ */
1652
+ getName(): string;
1653
+ /**
1654
+ * 更改当前模型名称
1655
+ *
1656
+ * @param name 需重新设置的模型名称
1657
+ */
1658
+ setName(name: string): void;
1659
+ /**
1660
+ * 获取模型备注信息
1661
+ */
1662
+ getRemark(): string | undefined;
1663
+ /**
1664
+ * 更改模型备注信息
1665
+ *
1666
+ * @param remark 备注信息
1667
+ */
1668
+ setRemark(remark: string): void;
1393
1669
  /**
1394
1670
  * 更新当前模型的位置信息
1395
1671
  * @param position {Number3} 坐标
@@ -1485,6 +1761,13 @@ export declare class FittingDesignService extends BaseService {
1485
1761
  * 将一个序列化之后的模型,进行反序列化操作
1486
1762
  */
1487
1763
  deserialize(model: string): IParamModelLite_2;
1764
+ /**
1765
+ * 刷新某个模型,此API仅适用于反向对接的模型:
1766
+ * 当前某个模型在后台更新了,但用户方案中,存储的仍然是之前的版本,调用此方法后,会自动将当前模型更新成后台最新的版本。
1767
+ * > 需要注意的是,此方法会导致更新后,模型ID存在变化
1768
+ * > 模型中,添加的appendChild或addAccessory等参数,可能会失效不起作用
1769
+ */
1770
+ forceUpdate(update?: boolean): void;
1488
1771
  }
1489
1772
 
1490
1773
  /**
@@ -1555,18 +1838,170 @@ export declare class FittingDesignService extends BaseService {
1555
1838
  setPrimitiveOverride(value: boolean): void;
1556
1839
  }
1557
1840
 
1841
+ declare interface IPathData {
1842
+ /**
1843
+ * 偏移, 正数扩大路径范围,负数缩小路径范围
1844
+ */
1845
+ offset?: number;
1846
+ /**
1847
+ * 轮廓上的点
1848
+ */
1849
+ paramPoints: IPointData$1[];
1850
+ /**
1851
+ * 轮廓上的线
1852
+ */
1853
+ paramPathLines: ILineData$1[];
1854
+ }
1855
+
1856
+ /**
1857
+ * 板件轮廓描述
1858
+ */
1859
+ export declare interface IPlankArea {
1860
+ /**
1861
+ * 由板件原始轮廓数据解析出的所有路径
1862
+ */
1863
+ paths: IPlankPath[];
1864
+
1865
+ /**
1866
+ * 对板件原始轮廓数据进行非直角端点处理、重合、偏移计算后的实际展示路径
1867
+ */
1868
+ getRealPaths(): IPlankArea;
1869
+ }
1870
+
1871
+ /**
1872
+ * 板件轮廓上的某条闭合路径,例如外轮廓、内部挖洞
1873
+ */
1874
+ export declare interface IPlankPath {
1875
+ /**
1876
+ * 路径类型
1877
+ */
1878
+ type: EPlankPathType;
1879
+ /**
1880
+ * 路径上的所有端点
1881
+ */
1882
+ points: IPoint[];
1883
+ /**
1884
+ * 路径上的所有线段
1885
+ */
1886
+ lines: ILine[];
1887
+ /**
1888
+ * 获取路径上实际渲染的端点
1889
+ */
1890
+ getRenderPoints(): Number2[];
1891
+ }
1892
+
1893
+ declare interface IPlankPathData {
1894
+ path?: IPathData;
1895
+ holes: IPathData[];
1896
+ /**
1897
+ * other fields
1898
+ */
1899
+ [key: string]: any;
1900
+ }
1901
+
1902
+ /**
1903
+ * 轮廓路径端点表示
1904
+ */
1905
+ export declare interface IPoint extends IPointBase {
1906
+ /**
1907
+ * 获取实际渲染端点
1908
+ * >非直角端点为渲染线段的两端,直角端点两个端点相同
1909
+ */
1910
+ getRenderPoints(): [Number2, Number2];
1911
+ /**
1912
+ * 设置非直角端点渲染线段的高亮,高亮深度为板件厚度
1913
+ * @param hint 高亮配置
1914
+ */
1915
+ setHint(hint: IHintBase): void;
1916
+ /**
1917
+ * 清除高亮
1918
+ */
1919
+ clearHint(): void;
1920
+ /**
1921
+ * 获取高亮
1922
+ */
1923
+ getHint(): IHintBase | undefined;
1924
+ }
1925
+
1558
1926
  /**
1559
1927
  * 点的基本类型
1560
1928
  */
1561
1929
  export declare interface IPointBase {
1562
1930
  type: EPointType;
1931
+ /**
1932
+ * 点的位置
1933
+ */
1934
+ position: Number3 | Number2;
1935
+ /**
1936
+ * 切角长度
1937
+ */
1938
+ cornerCutDistance?: [number, number];
1939
+ /**
1940
+ * 椭圆端点长轴
1941
+ */
1942
+ majorRadius?: number;
1943
+ /**
1944
+ * 椭圆端点短轴
1945
+ */
1946
+ minorRadius?: number;
1947
+ /**
1948
+ * 圆弧、切圆半径
1949
+ */
1950
+ radius?: number;
1951
+ /**
1952
+ * 圆弧是否为顺时针
1953
+ */
1954
+ clockwise?: boolean;
1955
+ /**
1956
+ * 圆弧、椭圆弧圆心偏移
1957
+ */
1958
+ offset?: Number2;
1959
+ }
1960
+
1961
+ declare interface IPointData$1 {
1563
1962
  /**
1564
1963
  * 点的位置
1565
1964
  *
1566
1965
  * @example
1567
1966
  * "123,-345"
1568
1967
  */
1569
- position: Number3;
1968
+ position: string;
1969
+ /**
1970
+ * 点的类型
1971
+ */
1972
+ type: EPointType_2;
1973
+ /**
1974
+ * 切角两边上切点距离当前点的距离(切角专用)
1975
+ */
1976
+ cornerCutDistance?: [string, string];
1977
+ /**
1978
+ * 是否顺时针, 前端必须保证逆时针
1979
+ */
1980
+ clockwise?: EClockWise;
1981
+ /**
1982
+ * 半径 (倒圆切圆专用)
1983
+ * @example
1984
+ * "345.12"
1985
+ */
1986
+ radius?: string;
1987
+ /**
1988
+ * 圆心偏移 (切圆专用)
1989
+ * @example
1990
+ * "345.12"
1991
+ */
1992
+ offset?: string;
1993
+ /**
1994
+ * 长轴 (椭圆必传)
1995
+ * @example
1996
+ * "345.12"
1997
+ */
1998
+ majorRadius?: string;
1999
+ /**
2000
+ * 短轴 (椭圆必传)
2001
+ * @example
2002
+ * "345.12"
2003
+ */
2004
+ minorRadius?: string;
1570
2005
  }
1571
2006
 
1572
2007
  /**
@@ -1577,7 +2012,11 @@ export declare class FittingDesignService extends BaseService {
1577
2012
  /**
1578
2013
  * 倒圆
1579
2014
  */
1580
- export declare interface IPointWithCircle extends IPointBase {
2015
+ export declare interface IPointWithCircle
2016
+ extends Omit<
2017
+ IPointBase,
2018
+ 'clockwise' | 'majorRadius' | 'minorRadius' | 'cornerCutDistance' | 'offset'
2019
+ > {
1581
2020
  /**
1582
2021
  * 切角类型
1583
2022
  */
@@ -1608,7 +2047,8 @@ export declare class FittingDesignService extends BaseService {
1608
2047
  /**
1609
2048
  * 切角
1610
2049
  */
1611
- export declare interface IPointWithLine extends IPointBase {
2050
+ export declare interface IPointWithLine
2051
+ extends Omit<IPointBase, 'clockwise' | 'majorRadius' | 'minorRadius' | 'radius' | 'offset'> {
1612
2052
  /**
1613
2053
  * 切角类型
1614
2054
  */
@@ -1622,7 +2062,11 @@ export declare class FittingDesignService extends BaseService {
1622
2062
  /**
1623
2063
  * 普通点类型
1624
2064
  */
1625
- export declare interface IPointWithNone extends IPointBase {
2065
+ export declare interface IPointWithNone
2066
+ extends Omit<
2067
+ IPointBase,
2068
+ 'cornerCutDistance' | 'majorRadius' | 'minorRadius' | 'radius' | 'offset'
2069
+ > {
1626
2070
  /**
1627
2071
  * 普通点
1628
2072
  */
@@ -1753,6 +2197,11 @@ export declare class FittingDesignService extends BaseService {
1753
2197
  * @default 1
1754
2198
  */
1755
2199
  grooveOpacity: number;
2200
+ /**
2201
+ * 渲染忽略模型真分类ID
2202
+ * @default CUSTOM_MODEL_CATEGORY_FILTER
2203
+ */
2204
+ renderIgnoreCategory: number | number[];
1756
2205
  }
1757
2206
 
1758
2207
  /**
@@ -1867,6 +2316,10 @@ export declare class FittingDesignService extends BaseService {
1867
2316
  * 最大值为 500
1868
2317
  */
1869
2318
  pageNum?: number;
2319
+ /**
2320
+ * 真分类ID过滤
2321
+ */
2322
+ ignoreCategory?: number | number[];
1870
2323
  }
1871
2324
 
1872
2325
  declare interface IUpdateInfo {
@@ -2235,6 +2688,7 @@ export declare class FittingDesignService extends BaseService {
2235
2688
  /**
2236
2689
  * 获取方案顶层模型列表
2237
2690
  * @param options
2691
+ * @param options.ignoreCategory 真分类id过滤,默认值 CUSTOM_MODEL_CATEGORY_FILTER
2238
2692
  */
2239
2693
  getTopParamModels(options?: ITopParamModelListOption): Promise<ITopParamModelDataResponse>;
2240
2694
  getParamModelPhotoById(modelId: string | string[]): Promise<IParamModelPhotoResponse[]>;
@@ -2441,6 +2895,7 @@ export declare class FittingDesignService extends BaseService {
2441
2895
  * - 五金与柜体交界面、五金与柜体交接体颜色
2442
2896
  * - 孔颜色、不透明度
2443
2897
  * - 槽、五金槽颜色、不透明度
2898
+ * - 模型渲染真分类过滤
2444
2899
  *
2445
2900
  * > `settings`,需要在application.start()后,立即被设置,否则展示会读取至之前配置信息,展示可能存在异常。
2446
2901
  */
@@ -2467,7 +2922,7 @@ export declare class FittingDesignService extends BaseService {
2467
2922
  /**
2468
2923
  * 二维空间下:坐标/向量/旋转/尺寸的基础表示
2469
2924
  */
2470
- declare interface Number2 {
2925
+ declare interface Number2_2 {
2471
2926
  /**
2472
2927
  * x轴上的数据
2473
2928
  */
@@ -2481,13 +2936,49 @@ export declare class FittingDesignService extends BaseService {
2481
2936
  /**
2482
2937
  * 三维空间下,坐标/向量/旋转/尺寸的基础表示
2483
2938
  */
2484
- declare interface Number3_2 extends Number2 {
2939
+ declare interface Number3_2 extends Number2_2 {
2485
2940
  /**
2486
2941
  * z轴方向数据
2487
2942
  */
2488
2943
  z: number;
2489
2944
  }
2490
2945
 
2946
+ /**
2947
+ * 底层板件轮廓服务,支持对模型json中轮廓解析为特定的类,暴露对轮廓数据查看、计算、修改的方法
2948
+ *
2949
+ * - 解析板件json数据
2950
+ * - 同步板件轮廓修改到渲染场景中
2951
+ *
2952
+ * @example
2953
+ * ```typescript
2954
+ * const plankPathService = application.getService(PlankPathService);
2955
+ * const modelID = 'xx'; // 板件模型ID
2956
+ * const plankPathData: IPlankPathData = { ... }; // 轮廓数据
2957
+ * const plankArea = plankPathService.parseModelPlankPath(modelID, plankPathData);
2958
+ * // change plankArea
2959
+ * plankPathService.syncModelPlankPath(plankArea); // 同步修改
2960
+ * ```
2961
+ */
2962
+ export declare class PlankPathService extends BaseService {
2963
+ /**
2964
+ * 解析板件轮廓
2965
+ *
2966
+ * @param option.modelID 关联模型ID
2967
+ * @param option.data `IDesignExportData.paramModel` 仅处理底层板件数据(只有板件包含轮廓路径)
2968
+ * @returns
2969
+ */
2970
+ parseModelPlankPath(option: {
2971
+ modelID: string;
2972
+ data: IPlankPathData;
2973
+ }): PlankArea;
2974
+ /**
2975
+ * 同步板件轮廓修改到渲染场景中
2976
+ *
2977
+ * @param plankArea
2978
+ */
2979
+ syncModelPlankPath(plankArea: IPlankArea): void;
2980
+ }
2981
+
2491
2982
  /**
2492
2983
  * 提供渲染场景的控制
2493
2984
  *