iflow-engine-base 3.4.0 → 3.4.2

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/index.d.ts CHANGED
@@ -264,18 +264,34 @@ declare enum AnnotationType720 {
264
264
  LINK = "link"
265
265
  }
266
266
 
267
+ declare interface BoundsLike {
268
+ min: {
269
+ x: number;
270
+ y: number;
271
+ z: number;
272
+ };
273
+ max: {
274
+ x: number;
275
+ y: number;
276
+ z: number;
277
+ };
278
+ }
279
+
267
280
  declare class CameraModule {
281
+ private static readonly MIN_VISIBLE_HEIGHT;
282
+ private static readonly MIN_CAMERA_DISTANCE;
268
283
  private engine;
269
284
  perspectiveCamera: THREE.PerspectiveCamera;
270
285
  orthographicCamera: THREE.OrthographicCamera;
271
286
  constructor(engine: any);
272
- switchCurrentCamera(): void;
287
+ private getCameraAspect;
288
+ private getPerspectiveVisibleHeight;
289
+ getOrthographicVisibleHeight(camera?: THREE.OrthographicCamera): number;
290
+ setOrthographicVisibleHeight(visibleHeight: number, camera?: THREE.OrthographicCamera): void;
291
+ private getViewDirection;
273
292
  private updateComposerCamera;
274
- /**
275
- * 将透视相机调成「效果接近正交」:通过缩小 FOV 减弱透视畸变。
276
- * @param fov 垂直视野角(度),默认 60。设为 10~15 可得到近正交效果,越小越接近正交。
277
- * @param options.adjustDistance 是否按 FOV 比例调整相机距离以保持取景一致,默认 true(缩小 FOV 时自动拉远)
278
- */
293
+ private applySwitchedCamera;
294
+ switchCurrentCamera(): void;
279
295
  setPerspectiveFov(fov: number, options?: {
280
296
  adjustDistance?: boolean;
281
297
  }): void;
@@ -284,12 +300,6 @@ declare class CameraModule {
284
300
  getCameraType(): CameraType;
285
301
  getCameraPose(): ICameraPose;
286
302
  restoreCameraPose(pose: ICameraPose): void;
287
- /**
288
- * 根据视图原点与视线方向设置相机(用于打开剖面视图等)
289
- * @param origin 目标点坐标 {x, y, z}
290
- * @param direction 视线方向(相机看向的方向){x, y, z},会做归一化
291
- * @param distance 相机到目标点的距离,不传则根据场景包围盒自动计算
292
- */
293
303
  setViewFromOriginAndDirection(origin: {
294
304
  x: number;
295
305
  y: number;
@@ -495,6 +505,7 @@ declare enum CameraType {
495
505
 
496
506
  declare class Clipping {
497
507
  private engine;
508
+ private readonly clippingTolerance;
498
509
  sectionBox: any;
499
510
  sectionFace: any;
500
511
  clippingStencil: any;
@@ -509,6 +520,12 @@ declare class Clipping {
509
520
  recover(): void;
510
521
  reverse(): void;
511
522
  disActive(): void;
523
+ isPointInClippingRange(point: any, tolerance?: number): boolean;
524
+ filterIntersectionsByClipping<T extends {
525
+ point?: any;
526
+ }>(intersections: T[] | null | undefined, tolerance?: number): T[];
527
+ private getEffectiveClippingPlanes;
528
+ private isVector3Like;
512
529
  /**
513
530
  * 按视图原点与视线方向设置剖面(用于打开剖面视图)
514
531
  * 剖切面过 origin,法向指向相机侧,并生成与场景包围盒同大的剖切面
@@ -1290,6 +1307,7 @@ declare class EngineKernelV2 {
1290
1307
  minMap: MiniMap;
1291
1308
  grid: Grid;
1292
1309
  level: Level;
1310
+ issueReport: IssueReport;
1293
1311
  text: Text_2;
1294
1312
  hdr: Hdr;
1295
1313
  ground: Ground;
@@ -1705,39 +1723,72 @@ declare class Grid {
1705
1723
  private rootGroup;
1706
1724
  private isVisible;
1707
1725
  private axes;
1708
- /**
1709
- * 坐标转换:BIM(X,Y,Z) → Three.js 世界坐标
1710
- * 默认规则:BIM X=水平, Y=水平深度, Z=高度
1711
- * → Three.js X=水平, Y=高度, Z=-深度
1712
- * 可在外部替换此函数以适配不同坐标系。
1713
- */
1714
1726
  coordinateMapper: (p: GridAxisPoint) => THREE.Vector3;
1715
1727
  constructor(engine: any);
1716
- /** 传入轴网数据并在场景中构建对象 */
1717
- setData(data: GridAxisData[]): void;
1718
- /** 使用内置模拟数据(调试用) */
1728
+ setData(data?: GridAxisData[]): void;
1719
1729
  setMockData(): void;
1720
- /** 显示轴网 */
1721
1730
  show(): void;
1722
- /** 隐藏轴网 */
1723
1731
  hide(): void;
1724
- /** 切换显示/隐藏 */
1725
1732
  toggle(): void;
1733
+ update(): void;
1726
1734
  /**
1727
- * 每帧更新(在动画循环中调用)
1728
- * 根据正交相机缩放动态调整圆圈大小,保持屏幕上视觉尺寸恒定(约 30px)
1735
+ * 根据三维点计算所在轴网区间。
1736
+ * 支持传入 url 以限定到指定模型,避免多模型场景下轴网串用。
1729
1737
  */
1730
- update(): void;
1731
- /** 销毁,释放 Three.js 资源 */
1738
+ getLocationByPoint(urlOrPoint: string | THREE.Vector3 | {
1739
+ x: number;
1740
+ y: number;
1741
+ z: number;
1742
+ }, point?: THREE.Vector3 | {
1743
+ x: number;
1744
+ y: number;
1745
+ z: number;
1746
+ }): GridPointLocation | null;
1732
1747
  dispose(): void;
1733
1748
  private _initRoot;
1734
1749
  private _clearAxes;
1735
1750
  private _buildAxis;
1751
+ private _makeCircleSprite;
1736
1752
  /**
1737
- * 创建带文字的圆圈 Sprite
1738
- * Sprite 默认朝向相机(billboard),depthTest=false 保证始终可见
1753
+ * 优先读取指定 url 对应模型的轴网数据;未指定时退回当前已加载轴网或全部模型轴网。
1739
1754
  */
1740
- private _makeCircleSprite;
1755
+ private getGridData;
1756
+ /**
1757
+ * 兼容 getLocationByPoint(point) 和 getLocationByPoint(url, point) 两种调用方式。
1758
+ */
1759
+ private resolvePointLookupArgs;
1760
+ /**
1761
+ * 根据 url 查找当前引擎中的目标模型。
1762
+ */
1763
+ private findModelByUrl;
1764
+ /**
1765
+ * 将轴网按平面方向自动归并为两个主轴族。
1766
+ */
1767
+ private buildAxisFamilies;
1768
+ private createProjection;
1769
+ private normalizeDirection;
1770
+ /**
1771
+ * 在单个轴族内优先返回点位所属的最近轴网区间,避免落在线上时出现空描述。
1772
+ */
1773
+ private resolveFamilyLocation;
1774
+ /**
1775
+ * 点压在轴线上时,选取该轴与最近邻轴组成一个可用区间。
1776
+ */
1777
+ private pickAxisPairAroundIndex;
1778
+ /**
1779
+ * 点落在最外侧时,退化为该轴族最接近的一组边界轴,避免整体描述为空。
1780
+ */
1781
+ private pickNearestBoundaryPair;
1782
+ /**
1783
+ * 优先将字母轴放在前、数字轴放在后,便于输出 A-B交1-2 这种习惯格式。
1784
+ */
1785
+ private sortFamiliesForDisplay;
1786
+ private getFamilySampleLabel;
1787
+ private formatAxisPair;
1788
+ private formatGridDescription;
1789
+ private compareLabels;
1790
+ private isNumericLabel;
1791
+ private toVector3;
1741
1792
  }
1742
1793
 
1743
1794
  declare interface GridAxisData {
@@ -1752,6 +1803,28 @@ declare interface GridAxisPoint {
1752
1803
  Z: number;
1753
1804
  }
1754
1805
 
1806
+ declare interface GridFamilyLocation {
1807
+ familyIndex: number;
1808
+ description: string;
1809
+ startAxisName: string | null;
1810
+ endAxisName: string | null;
1811
+ axisName: string | null;
1812
+ pointOffset: number;
1813
+ isOnAxis: boolean;
1814
+ isInside: boolean;
1815
+ }
1816
+
1817
+ declare interface GridPointLocation {
1818
+ point: {
1819
+ x: number;
1820
+ y: number;
1821
+ z: number;
1822
+ };
1823
+ description: string;
1824
+ families: GridFamilyLocation[];
1825
+ isInside: boolean;
1826
+ }
1827
+
1755
1828
  declare class Ground {
1756
1829
  private engine;
1757
1830
  private currentId;
@@ -1947,6 +2020,7 @@ declare interface ICameraPose {
1947
2020
  z: number;
1948
2021
  };
1949
2022
  zoom?: number;
2023
+ orthographicHeight?: number;
1950
2024
  }
1951
2025
 
1952
2026
  /**
@@ -2037,6 +2111,121 @@ declare interface IRoamingPoint extends ICameraPose {
2037
2111
  stayTime?: number;
2038
2112
  }
2039
2113
 
2114
+ declare interface IssueCameraPose {
2115
+ position: IssuePoint;
2116
+ forwardDirection: IssuePoint;
2117
+ upDirection: IssuePoint;
2118
+ }
2119
+
2120
+ declare interface IssueContext {
2121
+ url?: string;
2122
+ point: IssuePoint;
2123
+ grid: GridPointLocation | null;
2124
+ level: LevelLocationResult | null;
2125
+ }
2126
+
2127
+ declare interface IssuePoint {
2128
+ x: number;
2129
+ y: number;
2130
+ z: number;
2131
+ }
2132
+
2133
+ declare class IssueReport {
2134
+ private readonly engine;
2135
+ constructor(engine: any);
2136
+ /**
2137
+ * 鏍规嵁鏋勪欢淇℃伅鎻愬彇涓績鐐癸紝骞剁粍瑁呴棶棰樹笂鎶ユ墍闇€鐨勬暟鎹€?
2138
+ */
2139
+ getMoldePosition(model: any): {
2140
+ Floor: string;
2141
+ Axis: string;
2142
+ ElementId: any;
2143
+ ElementName: string;
2144
+ modelJson: {
2145
+ url: any;
2146
+ ids: any[];
2147
+ point: IssuePoint;
2148
+ camera: IssueCameraPose;
2149
+ cameraRestorePose: ICameraPose;
2150
+ };
2151
+ } | null;
2152
+ /**
2153
+ * 鐩告満鍥炲鍒版寚瀹氫綅缃?
2154
+ * @param item
2155
+ */
2156
+ jumptoCamera(item: any): void;
2157
+ /**
2158
+ * 缁熶竴褰掍竴鍖栭棶棰樼偣鍧愭爣锛屼究浜庝笂灞傜洿鎺ユ寔涔呭寲銆?
2159
+ */
2160
+ getPoint(point: THREE.Vector3 | IssuePoint): IssuePoint;
2161
+ /**
2162
+ * 璇箟鍖栧埆鍚? 鑾峰彇妯″瀷涓殑闂鐐逛綅缃€?
2163
+ */
2164
+ getModelPosition(point: THREE.Vector3 | IssuePoint): IssuePoint;
2165
+ /**
2166
+ * 姹囨€婚棶棰樼偣鎵€鍦ㄧ殑杞寸綉鍜屾爣楂樹笂涓嬫枃銆?
2167
+ * 鏀寔浼犲叆 url 浠ラ檺瀹氬埌鎸囧畾妯″瀷锛岄伩鍏嶅妯″瀷鍦烘櫙涓嬫煡璇笉鍑嗙‘銆?
2168
+ */
2169
+ getPointContext(urlOrPoint: string | THREE.Vector3 | IssuePoint, point?: THREE.Vector3 | IssuePoint): IssueContext;
2170
+ /**
2171
+ * 鑾峰彇闂涓婃姤闇€瑕佺殑绠€鍖栫浉鏈哄弬鏁般€?
2172
+ * 鍙繑鍥炵浉鏈轰綅缃€佹湞鍚戝拰椤堕儴鏂瑰悜銆?
2173
+ */
2174
+ getCameraPose(): IssueCameraPose;
2175
+ /**
2176
+ * 璇箟鍖栧埆鍚? 鑾峰彇褰撳墠鐩告満鍙傛暟銆?
2177
+ */
2178
+ getCameraParams(): IssueCameraPose;
2179
+ /**
2180
+ * 鑾峰彇瀹屾暣鐩告満濮挎€侊紝涓撻棬鐢ㄤ簬瑙嗚鎭㈠銆?
2181
+ */
2182
+ getCameraRestorePose(): ICameraPose;
2183
+ /**
2184
+ * 鎭㈠鐩告満鍒版寚瀹氬畬鏁村Э鎬併€?
2185
+ */
2186
+ restoreCameraPose(pose: ICameraPose): void;
2187
+ /**
2188
+ * 涓€娆℃€ф姄鍙栭棶棰樼偣涓婁笅鏂囥€佺畝鍖栫浉鏈哄弬鏁板拰鎭㈠鐢ㄥЭ鎬併€?
2189
+ */
2190
+ capture(point: THREE.Vector3 | IssuePoint): IssueSnapshot;
2191
+ /**
2192
+ * 鐩存帴浼犲叆妯″瀷 url 鍜岄棶棰樼偣锛岃繑鍥炲彲鐢ㄤ簬闂涓婃姤鐨勫畬鏁村揩鐓с€?
2193
+ */
2194
+ captureByUrlAndPoint(url: string, point: THREE.Vector3 | IssuePoint): IssueSnapshotWithUrl;
2195
+ /**
2196
+ * 鎸夋寚瀹氭ā鍨?url 鎶撳彇闂鐐逛笂涓嬫枃銆佺畝鍖栫浉鏈哄弬鏁板拰鎭㈠鐢ㄥЭ鎬併€?
2197
+ */
2198
+ captureWithUrl(url: string, point: THREE.Vector3 | IssuePoint): IssueSnapshot;
2199
+ /**
2200
+ * 鏀寔鐩存帴浼犲畬鏁村揩鐓ф垨鍗曠嫭瀹屾暣濮挎€佽繘琛屾仮澶嶃€?
2201
+ */
2202
+ restore(snapshotOrPose: IssueSnapshot | ICameraPose): void;
2203
+ dispose(): void;
2204
+ /**
2205
+ * 鍏煎 getPointContext(point) 鍜?getPointContext(url, point) 涓ょ璋冪敤鏂瑰紡銆?
2206
+ */
2207
+ private resolvePointLookupArgs;
2208
+ private resolveModelJson;
2209
+ private highlightIssueModel;
2210
+ private restoreIssueCameraPose;
2211
+ private zoomToIssueModel;
2212
+ private syncOrbitOrigin;
2213
+ private toVector3;
2214
+ private resolveFocusPoint;
2215
+ private resolveModelBox;
2216
+ private normalizeRestorePose;
2217
+ private buildSafeUpDirection;
2218
+ }
2219
+
2220
+ declare interface IssueSnapshot extends IssueContext {
2221
+ cameraPose: IssueCameraPose;
2222
+ cameraRestorePose: ICameraPose;
2223
+ }
2224
+
2225
+ declare interface IssueSnapshotWithUrl extends IssueSnapshot {
2226
+ url: string;
2227
+ }
2228
+
2040
2229
  declare class LayerManager {
2041
2230
  private engine;
2042
2231
  private layerMap;
@@ -2070,26 +2259,52 @@ declare class Level {
2070
2259
  private readonly COLOR;
2071
2260
  private readonly PLANE_OPACITY;
2072
2261
  constructor(engine: any);
2073
- private _initSvg;
2074
- /** 传入标高数据并渲染 */
2075
- setData(data: LevelData[], box: any): void;
2076
- /** 使用内置模拟数据(调试用) */
2262
+ setData(data?: LevelData[], box?: BoundsLike): void;
2077
2263
  setMockData(): void;
2078
- /** 显示标高 */
2079
2264
  show(): void;
2080
- /** 隐藏标高 */
2081
2265
  hide(): void;
2082
- /** 切换显示/隐藏 */
2083
2266
  toggle(): void;
2084
- /** 每帧刷新(需在动画循环中调用) */
2085
2267
  update(): void;
2086
- /** 销毁,释放资源 */
2268
+ /**
2269
+ * 根据点位高度计算所属标高,描述统一输出为“标高X”。
2270
+ * 支持传入 url 以限定到指定模型,避免多模型场景下标高串用。
2271
+ */
2272
+ getLocationByPoint(urlOrPoint: string | THREE.Vector3 | {
2273
+ x: number;
2274
+ y: number;
2275
+ z: number;
2276
+ }, point?: THREE.Vector3 | {
2277
+ x: number;
2278
+ y: number;
2279
+ z: number;
2280
+ }): LevelLocationResult | null;
2087
2281
  dispose(): void;
2282
+ private _initSvg;
2088
2283
  private _initWorldToScreen;
2089
2284
  private _clearAll;
2090
2285
  private _buildThreeObject;
2091
2286
  private _updateSvgLabels;
2092
2287
  private _makeLabel;
2288
+ /**
2289
+ * 优先读取指定 url 对应模型的标高数据;未指定时退回当前已加载标高或全部模型标高。
2290
+ */
2291
+ private getLevelData;
2292
+ /**
2293
+ * 兼容 getLocationByPoint(point) 和 getLocationByPoint(url, point) 两种调用方式。
2294
+ */
2295
+ private resolvePointLookupArgs;
2296
+ /**
2297
+ * 根据 url 查找当前引擎中的目标模型。
2298
+ */
2299
+ private findModelByUrl;
2300
+ /**
2301
+ * 点位位于两个标高之间时,归属到距离最近的那个标高。
2302
+ */
2303
+ private pickNearestLevel;
2304
+ /**
2305
+ * 合并全部模型包围盒,作为标高辅助面的默认可视范围。
2306
+ */
2307
+ private getMergedBoundingBox;
2093
2308
  }
2094
2309
 
2095
2310
  declare interface LevelData {
@@ -2098,6 +2313,16 @@ declare interface LevelData {
2098
2313
  Elevation: number;
2099
2314
  }
2100
2315
 
2316
+ declare interface LevelLocationResult {
2317
+ pointY: number;
2318
+ description: string;
2319
+ currentLevel: LevelData | null;
2320
+ lowerLevel: LevelData | null;
2321
+ upperLevel: LevelData | null;
2322
+ isOnLevel: boolean;
2323
+ isInside: boolean;
2324
+ }
2325
+
2101
2326
  declare class LightModule {
2102
2327
  private engine;
2103
2328
  constructor(engine: any);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iflow-engine-base",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "description": "BIM Engine SDK for Vue2, Vue3, React and HTML",
5
5
  "main": "./dist/bim-engine-sdk.umd.js",
6
6
  "module": "./dist/bim-engine-sdk.es.js",