@manycore/custom-sdk 1.8.2-rc.0 → 1.8.4-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 +497 -11
  2. package/index.js +21 -35
  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,24 @@ 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
+ ELLIPSE_ARC = 3
402
+ }
403
+
352
404
  /**
353
405
  * 模型类型
354
406
  */
@@ -386,27 +438,98 @@ declare enum EParamModelType {
386
438
  }
387
439
 
388
440
  declare enum EParamType {
441
+ /**
442
+ * 浮点数
443
+ */
389
444
  FLOAT = "float",
445
+ /**
446
+ * 二维浮点数
447
+ */
390
448
  FLOAT2 = "float2",
449
+ /**
450
+ * 三维浮点数
451
+ */
391
452
  FLOAT3 = "float3",
453
+ /**
454
+ * 浮点数
455
+ */
392
456
  FLOAT_BUFFER = "floatbuf",
457
+ /**
458
+ * 二维浮点数
459
+ */
393
460
  FLOAT2_BUFFER = "float2buf",
461
+ /**
462
+ * 三维浮点数
463
+ */
394
464
  FLOAT3_BUFFER = "float3buf",
465
+ /**
466
+ * 引用
467
+ */
395
468
  REFERENCE = "reference",
469
+ /**
470
+ * 整数
471
+ */
396
472
  INT = "int",
473
+ /**
474
+ * 整数
475
+ */
397
476
  INT_BUFFER = "intbuf",
477
+ /**
478
+ * 字符串
479
+ */
398
480
  STRING = "string",
481
+ /**
482
+ * 轮廓,一般为商品ID
483
+ */
399
484
  SHAPE = "shape",
485
+ /**
486
+ * 材质,一般存储为商品ID
487
+ */
400
488
  MATERIAL = "material",
489
+ /**
490
+ * 布尔
491
+ */
401
492
  BOOLEAN = "boolean",
493
+ /**
494
+ * 布尔
495
+ */
402
496
  BOOLEAN_BUFFER = "booleanbuf",
497
+ /**
498
+ * 适配
499
+ */
403
500
  FIT = "fit",
501
+ /**
502
+ * 路径
503
+ */
404
504
  PATH = "paramcornerpath",
505
+ /**
506
+ * 样式
507
+ */
405
508
  STYLE = "style",
509
+ /**
510
+ * 字符串
511
+ */
406
512
  FORMULA_STRING = "formulaString",
513
+ /**
514
+ * 多布尔
515
+ */
407
516
  BOOLEAN_LIST = "booleanlist"
408
517
  }
409
518
 
519
+ /**
520
+ * 板件轮廓路径类型
521
+ */
522
+ export declare enum EPlankPathType {
523
+ /**
524
+ * 内部路径,例如某个挖洞
525
+ */
526
+ INNER = 'inner',
527
+ /**
528
+ * 外部路径
529
+ */
530
+ OUTER = 'outer',
531
+ }
532
+
410
533
  /**
411
534
  * 点的类型
412
535
  */
@@ -427,6 +550,32 @@ export declare enum EPointType {
427
550
  * 切圆,就是内挖一个倒圆的形状
428
551
  */
429
552
  CUT_CIRCLE = 3,
553
+ /**
554
+ * 椭圆
555
+ */
556
+ ELLIPSE = 4,
557
+ }
558
+
559
+ /**
560
+ * 点的类型
561
+ */
562
+ declare enum EPointType_2 {
563
+ /**
564
+ * 普通点
565
+ */
566
+ NONE = 0,
567
+ /**
568
+ * 倒圆
569
+ */
570
+ CIRCLE = 1,
571
+ /**
572
+ * 倒角
573
+ */
574
+ LINE = 2,
575
+ /**
576
+ * 切圆,就是内挖一个倒圆的形状
577
+ */
578
+ CUT_CIRCLE = 3
430
579
  }
431
580
 
432
581
  /**
@@ -1160,16 +1309,104 @@ export declare class FittingDesignService extends BaseService {
1160
1309
  intersectedGroups: IIntersectedGroup[];
1161
1310
  }
1162
1311
 
1312
+ /**
1313
+ * 轮廓路径线段表示
1314
+ */
1315
+ export declare interface ILine extends ILineBase {
1316
+ /**
1317
+ * 获取实际渲染端点
1318
+ * >线段两端
1319
+ */
1320
+ getRenderPoints(): [Number2, Number2];
1321
+ /**
1322
+ * 设置线段的高亮,高亮深度为板件厚度
1323
+ * @param hint 高亮配置
1324
+ */
1325
+ setHint(hint: IHintBase): void;
1326
+ /**
1327
+ * 清除高亮
1328
+ */
1329
+ clearHint(): void;
1330
+ /**
1331
+ * 获取高亮
1332
+ */
1333
+ getHint(): IHintBase | undefined;
1334
+ }
1335
+
1336
+ /**
1337
+ * 线段表示
1338
+ */
1339
+ export declare interface ILineBase {
1340
+ /**
1341
+ * 线条类型
1342
+ */
1343
+ type: ELineType;
1344
+ /**
1345
+ * 圆弧是否为顺时针
1346
+ */
1347
+ clockwise?: boolean;
1348
+ /**
1349
+ * 圆弧是否为劣弧
1350
+ */
1351
+ minorArc?: boolean;
1352
+ /**
1353
+ * 圆弧半径
1354
+ */
1355
+ radius?: number;
1356
+ /**
1357
+ * 椭圆弧长轴
1358
+ */
1359
+ majorRadius?: number;
1360
+ /**
1361
+ * 椭圆弧短轴
1362
+ */
1363
+ minorRadius?: number;
1364
+ /**
1365
+ * 椭圆圆心
1366
+ */
1367
+ ellipseCenter?: Number2;
1368
+ }
1369
+
1163
1370
  export declare type ILineData = ILineDataBase | ILineDataCircle;
1164
1371
 
1165
- export declare interface ILineDataBase {
1372
+ declare interface ILineData_2 {
1373
+ /**
1374
+ * 线条类型
1375
+ */
1376
+ type: ELineType_3;
1377
+ /**
1378
+ * 是否顺时针
1379
+ */
1380
+ clockwise?: boolean;
1381
+ /**
1382
+ * 优弧劣弧 (只有弧线有)
1383
+ */
1384
+ minorArc?: boolean;
1385
+ /**
1386
+ * 半径 (只有弧线有)
1387
+ */
1388
+ radius?: number;
1389
+ }
1390
+
1391
+ /**
1392
+ * 直线
1393
+ */
1394
+ export declare interface ILineDataBase
1395
+ extends Omit<
1396
+ ILineBase,
1397
+ 'ellipseCenter' | 'clockwise' | 'minorArc' | 'radius' | 'majorRadius' | 'minorRadius'
1398
+ > {
1166
1399
  /**
1167
1400
  * 线条类型
1168
1401
  */
1169
1402
  type: ELineType_2.SEGMENT;
1170
1403
  }
1171
1404
 
1172
- export declare interface ILineDataCircle {
1405
+ /**
1406
+ * 弧线
1407
+ */
1408
+ export declare interface ILineDataCircle
1409
+ extends Omit<ILineBase, 'ellipseCenter' | 'majorRadius' | 'minorRadius'> {
1173
1410
  /**
1174
1411
  * 线条类型
1175
1412
  */
@@ -1318,6 +1555,20 @@ export declare class FittingDesignService extends BaseService {
1318
1555
  * @type string
1319
1556
  */
1320
1557
  readonly id: string;
1558
+ /**
1559
+ * 模型在方案中的名称
1560
+ * @readonly
1561
+ * @public
1562
+ * @type string
1563
+ */
1564
+ name: string;
1565
+ /**
1566
+ * 模型的备注信息
1567
+ * @readonly
1568
+ * @public
1569
+ * @typedef Number3
1570
+ */
1571
+ remark?: string;
1321
1572
  /**
1322
1573
  * 当前位置信息
1323
1574
  * @readonly
@@ -1390,6 +1641,26 @@ export declare class FittingDesignService extends BaseService {
1390
1641
  * @readonly
1391
1642
  */
1392
1643
  isRoot?: boolean;
1644
+ /**
1645
+ * 获取当前模型名称
1646
+ */
1647
+ getName(): string;
1648
+ /**
1649
+ * 更改当前模型名称
1650
+ *
1651
+ * @param name 需重新设置的模型名称
1652
+ */
1653
+ setName(name: string): void;
1654
+ /**
1655
+ * 获取模型备注信息
1656
+ */
1657
+ getRemark(): string | undefined;
1658
+ /**
1659
+ * 更改模型备注信息
1660
+ *
1661
+ * @param remark 备注信息
1662
+ */
1663
+ setRemark(remark: string): void;
1393
1664
  /**
1394
1665
  * 更新当前模型的位置信息
1395
1666
  * @param position {Number3} 坐标
@@ -1485,6 +1756,13 @@ export declare class FittingDesignService extends BaseService {
1485
1756
  * 将一个序列化之后的模型,进行反序列化操作
1486
1757
  */
1487
1758
  deserialize(model: string): IParamModelLite_2;
1759
+ /**
1760
+ * 刷新某个模型,此API仅适用于反向对接的模型:
1761
+ * 当前某个模型在后台更新了,但用户方案中,存储的仍然是之前的版本,调用此方法后,会自动将当前模型更新成后台最新的版本。
1762
+ * > 需要注意的是,此方法会导致更新后,模型ID存在变化
1763
+ * > 模型中,添加的appendChild或addAccessory等参数,可能会失效不起作用
1764
+ */
1765
+ forceUpdate(update?: boolean): void;
1488
1766
  }
1489
1767
 
1490
1768
  /**
@@ -1555,6 +1833,91 @@ export declare class FittingDesignService extends BaseService {
1555
1833
  setPrimitiveOverride(value: boolean): void;
1556
1834
  }
1557
1835
 
1836
+ declare interface IPathData {
1837
+ /**
1838
+ * 偏移, 正数扩大路径范围,负数缩小路径范围
1839
+ */
1840
+ offset?: number;
1841
+ /**
1842
+ * 轮廓上的点
1843
+ */
1844
+ paramPoints: IPointData_2[];
1845
+ /**
1846
+ * 轮廓上的线
1847
+ */
1848
+ paramPathLines: ILineData_2[];
1849
+ }
1850
+
1851
+ /**
1852
+ * 板件轮廓描述
1853
+ */
1854
+ export declare interface IPlankArea {
1855
+ /**
1856
+ * 由板件原始轮廓数据解析出的所有路径
1857
+ */
1858
+ paths: IPlankPath[];
1859
+
1860
+ /**
1861
+ * 对板件原始轮廓数据进行非直角端点处理、重合、偏移计算后的实际展示路径
1862
+ */
1863
+ getRealPaths(): IPlankArea;
1864
+ }
1865
+
1866
+ /**
1867
+ * 板件轮廓上的某条闭合路径,例如外轮廓、内部挖洞
1868
+ */
1869
+ export declare interface IPlankPath {
1870
+ /**
1871
+ * 路径类型
1872
+ */
1873
+ type: EPlankPathType;
1874
+ /**
1875
+ * 路径上的所有端点
1876
+ */
1877
+ points: IPoint[];
1878
+ /**
1879
+ * 路径上的所有线段
1880
+ */
1881
+ lines: ILine[];
1882
+ /**
1883
+ * 获取路径上实际渲染的端点
1884
+ */
1885
+ getRenderPoints(): Number2[];
1886
+ }
1887
+
1888
+ declare interface IPlankPathData {
1889
+ path?: IPathData;
1890
+ holes: IPathData[];
1891
+ /**
1892
+ * other fields
1893
+ */
1894
+ [key: string]: any;
1895
+ }
1896
+
1897
+ /**
1898
+ * 轮廓路径端点表示
1899
+ */
1900
+ export declare interface IPoint extends IPointBase {
1901
+ /**
1902
+ * 获取实际渲染端点
1903
+ * >非直角端点为渲染线段的两端,直角端点两个端点相同
1904
+ */
1905
+ getRenderPoints(): [Number2, Number2];
1906
+ /**
1907
+ * 设置非直角端点渲染线段的高亮,高亮深度为板件厚度
1908
+ * @param hint 高亮配置
1909
+ */
1910
+ setHint(hint: IHintBase): void;
1911
+ /**
1912
+ * 清除高亮
1913
+ */
1914
+ clearHint(): void;
1915
+ /**
1916
+ * 获取高亮
1917
+ */
1918
+ getHint(): IHintBase | undefined;
1919
+ }
1920
+
1558
1921
  /**
1559
1922
  * 点的基本类型
1560
1923
  */
@@ -1562,11 +1925,32 @@ export declare class FittingDesignService extends BaseService {
1562
1925
  type: EPointType;
1563
1926
  /**
1564
1927
  * 点的位置
1565
- *
1566
- * @example
1567
- * "123,-345"
1568
1928
  */
1569
- position: Number3;
1929
+ position: Number3 | Number2;
1930
+ /**
1931
+ * 切角长度
1932
+ */
1933
+ cornerCutDistance?: [number, number];
1934
+ /**
1935
+ * 椭圆端点长轴
1936
+ */
1937
+ majorRadius?: number;
1938
+ /**
1939
+ * 椭圆端点短轴
1940
+ */
1941
+ minorRadius?: number;
1942
+ /**
1943
+ * 圆弧、切圆半径
1944
+ */
1945
+ radius?: number;
1946
+ /**
1947
+ * 圆弧是否为顺时针
1948
+ */
1949
+ clockwise?: boolean;
1950
+ /**
1951
+ * 圆弧、椭圆弧圆心偏移
1952
+ */
1953
+ offset?: Number2;
1570
1954
  }
1571
1955
 
1572
1956
  /**
@@ -1574,10 +1958,60 @@ export declare class FittingDesignService extends BaseService {
1574
1958
  */
1575
1959
  export declare type IPointData = IPointWithNone | IPointWithLine | IPointWithCircle | IPointWithCutCircle;
1576
1960
 
1961
+ declare interface IPointData_2 {
1962
+ /**
1963
+ * 点的位置
1964
+ *
1965
+ * @example
1966
+ * "123,-345"
1967
+ */
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;
2005
+ }
2006
+
1577
2007
  /**
1578
2008
  * 倒圆
1579
2009
  */
1580
- export declare interface IPointWithCircle extends IPointBase {
2010
+ export declare interface IPointWithCircle
2011
+ extends Omit<
2012
+ IPointBase,
2013
+ 'clockwise' | 'majorRadius' | 'minorRadius' | 'cornerCutDistance' | 'offset'
2014
+ > {
1581
2015
  /**
1582
2016
  * 切角类型
1583
2017
  */
@@ -1608,7 +2042,8 @@ export declare class FittingDesignService extends BaseService {
1608
2042
  /**
1609
2043
  * 切角
1610
2044
  */
1611
- export declare interface IPointWithLine extends IPointBase {
2045
+ export declare interface IPointWithLine
2046
+ extends Omit<IPointBase, 'clockwise' | 'majorRadius' | 'minorRadius' | 'radius' | 'offset'> {
1612
2047
  /**
1613
2048
  * 切角类型
1614
2049
  */
@@ -1622,7 +2057,11 @@ export declare class FittingDesignService extends BaseService {
1622
2057
  /**
1623
2058
  * 普通点类型
1624
2059
  */
1625
- export declare interface IPointWithNone extends IPointBase {
2060
+ export declare interface IPointWithNone
2061
+ extends Omit<
2062
+ IPointBase,
2063
+ 'cornerCutDistance' | 'majorRadius' | 'minorRadius' | 'radius' | 'offset'
2064
+ > {
1626
2065
  /**
1627
2066
  * 普通点
1628
2067
  */
@@ -1753,6 +2192,11 @@ export declare class FittingDesignService extends BaseService {
1753
2192
  * @default 1
1754
2193
  */
1755
2194
  grooveOpacity: number;
2195
+ /**
2196
+ * 渲染忽略模型真分类ID
2197
+ * @default CUSTOM_MODEL_CATEGORY_FILTER
2198
+ */
2199
+ renderIgnoreCategory: number | number[];
1756
2200
  }
1757
2201
 
1758
2202
  /**
@@ -1867,6 +2311,10 @@ export declare class FittingDesignService extends BaseService {
1867
2311
  * 最大值为 500
1868
2312
  */
1869
2313
  pageNum?: number;
2314
+ /**
2315
+ * 真分类ID过滤
2316
+ */
2317
+ ignoreCategory?: number | number[];
1870
2318
  }
1871
2319
 
1872
2320
  declare interface IUpdateInfo {
@@ -2235,6 +2683,7 @@ export declare class FittingDesignService extends BaseService {
2235
2683
  /**
2236
2684
  * 获取方案顶层模型列表
2237
2685
  * @param options
2686
+ * @param options.ignoreCategory 真分类id过滤,默认值 CUSTOM_MODEL_CATEGORY_FILTER
2238
2687
  */
2239
2688
  getTopParamModels(options?: ITopParamModelListOption): Promise<ITopParamModelDataResponse>;
2240
2689
  getParamModelPhotoById(modelId: string | string[]): Promise<IParamModelPhotoResponse[]>;
@@ -2441,6 +2890,7 @@ export declare class FittingDesignService extends BaseService {
2441
2890
  * - 五金与柜体交界面、五金与柜体交接体颜色
2442
2891
  * - 孔颜色、不透明度
2443
2892
  * - 槽、五金槽颜色、不透明度
2893
+ * - 模型渲染真分类过滤
2444
2894
  *
2445
2895
  * > `settings`,需要在application.start()后,立即被设置,否则展示会读取至之前配置信息,展示可能存在异常。
2446
2896
  */
@@ -2467,7 +2917,7 @@ export declare class FittingDesignService extends BaseService {
2467
2917
  /**
2468
2918
  * 二维空间下:坐标/向量/旋转/尺寸的基础表示
2469
2919
  */
2470
- declare interface Number2 {
2920
+ declare interface Number2_2 {
2471
2921
  /**
2472
2922
  * x轴上的数据
2473
2923
  */
@@ -2481,13 +2931,49 @@ export declare class FittingDesignService extends BaseService {
2481
2931
  /**
2482
2932
  * 三维空间下,坐标/向量/旋转/尺寸的基础表示
2483
2933
  */
2484
- declare interface Number3_2 extends Number2 {
2934
+ declare interface Number3_2 extends Number2_2 {
2485
2935
  /**
2486
2936
  * z轴方向数据
2487
2937
  */
2488
2938
  z: number;
2489
2939
  }
2490
2940
 
2941
+ /**
2942
+ * 底层板件轮廓服务,支持对模型json中轮廓解析为特定的类,暴露对轮廓数据查看、计算、修改的方法
2943
+ *
2944
+ * - 解析板件json数据
2945
+ * - 同步板件轮廓修改到渲染场景中
2946
+ *
2947
+ * @example
2948
+ * ```typescript
2949
+ * const plankPathService = application.getService(PlankPathService);
2950
+ * const modelID = 'xx'; // 板件模型ID
2951
+ * const plankPathData: IPlankPathData = { ... }; // 轮廓数据
2952
+ * const plankArea = plankPathService.parseModelPlankPath(modelID, plankPathData);
2953
+ * // change plankArea
2954
+ * plankPathService.syncModelPlankPath(plankArea); // 同步修改
2955
+ * ```
2956
+ */
2957
+ export declare class PlankPathService extends BaseService {
2958
+ /**
2959
+ * 解析板件轮廓
2960
+ *
2961
+ * @param option.modelID 关联模型ID
2962
+ * @param option.data `IDesignExportData.paramModel` 仅处理底层板件数据(只有板件包含轮廓路径)
2963
+ * @returns
2964
+ */
2965
+ parseModelPlankPath(option: {
2966
+ modelID: string;
2967
+ data: IPlankPathData;
2968
+ }): PlankArea;
2969
+ /**
2970
+ * 同步板件轮廓修改到渲染场景中
2971
+ *
2972
+ * @param plankArea
2973
+ */
2974
+ syncModelPlankPath(plankArea: IPlankArea): void;
2975
+ }
2976
+
2491
2977
  /**
2492
2978
  * 提供渲染场景的控制
2493
2979
  *