iflow-engine-base 3.4.0 → 3.4.1

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,105 @@ 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
+ camera: IssueCameraPose;
2148
+ cameraRestorePose: ICameraPose;
2149
+ };
2150
+ } | null;
2151
+ /**
2152
+ * 统一归一化问题点坐标,便于上层直接持久化。
2153
+ */
2154
+ getPoint(point: THREE.Vector3 | IssuePoint): IssuePoint;
2155
+ /**
2156
+ * 语义化别名: 获取模型中的问题点位置。
2157
+ */
2158
+ getModelPosition(point: THREE.Vector3 | IssuePoint): IssuePoint;
2159
+ /**
2160
+ * 汇总问题点所在的轴网和标高上下文。
2161
+ * 支持传入 url 以限定到指定模型,避免多模型场景下查询不准确。
2162
+ */
2163
+ getPointContext(urlOrPoint: string | THREE.Vector3 | IssuePoint, point?: THREE.Vector3 | IssuePoint): IssueContext;
2164
+ /**
2165
+ * 获取问题上报需要的简化相机参数。
2166
+ * 只返回相机位置、朝向和顶部方向。
2167
+ */
2168
+ getCameraPose(): IssueCameraPose;
2169
+ /**
2170
+ * 语义化别名: 获取当前相机参数。
2171
+ */
2172
+ getCameraParams(): IssueCameraPose;
2173
+ /**
2174
+ * 获取完整相机姿态,专门用于视角恢复。
2175
+ */
2176
+ getCameraRestorePose(): ICameraPose;
2177
+ /**
2178
+ * 恢复相机到指定完整姿态。
2179
+ */
2180
+ restoreCameraPose(pose: ICameraPose): void;
2181
+ /**
2182
+ * 一次性抓取问题点上下文、简化相机参数和恢复用姿态。
2183
+ */
2184
+ capture(point: THREE.Vector3 | IssuePoint): IssueSnapshot;
2185
+ /**
2186
+ * 直接传入模型 url 和问题点,返回可用于问题上报的完整快照。
2187
+ */
2188
+ captureByUrlAndPoint(url: string, point: THREE.Vector3 | IssuePoint): IssueSnapshotWithUrl;
2189
+ /**
2190
+ * 按指定模型 url 抓取问题点上下文、简化相机参数和恢复用姿态。
2191
+ */
2192
+ captureWithUrl(url: string, point: THREE.Vector3 | IssuePoint): IssueSnapshot;
2193
+ /**
2194
+ * 支持直接传完整快照或单独完整姿态进行恢复。
2195
+ */
2196
+ restore(snapshotOrPose: IssueSnapshot | ICameraPose): void;
2197
+ dispose(): void;
2198
+ /**
2199
+ * 兼容 getPointContext(point) 和 getPointContext(url, point) 两种调用方式。
2200
+ */
2201
+ private resolvePointLookupArgs;
2202
+ }
2203
+
2204
+ declare interface IssueSnapshot extends IssueContext {
2205
+ cameraPose: IssueCameraPose;
2206
+ cameraRestorePose: ICameraPose;
2207
+ }
2208
+
2209
+ declare interface IssueSnapshotWithUrl extends IssueSnapshot {
2210
+ url: string;
2211
+ }
2212
+
2040
2213
  declare class LayerManager {
2041
2214
  private engine;
2042
2215
  private layerMap;
@@ -2070,26 +2243,52 @@ declare class Level {
2070
2243
  private readonly COLOR;
2071
2244
  private readonly PLANE_OPACITY;
2072
2245
  constructor(engine: any);
2073
- private _initSvg;
2074
- /** 传入标高数据并渲染 */
2075
- setData(data: LevelData[], box: any): void;
2076
- /** 使用内置模拟数据(调试用) */
2246
+ setData(data?: LevelData[], box?: BoundsLike): void;
2077
2247
  setMockData(): void;
2078
- /** 显示标高 */
2079
2248
  show(): void;
2080
- /** 隐藏标高 */
2081
2249
  hide(): void;
2082
- /** 切换显示/隐藏 */
2083
2250
  toggle(): void;
2084
- /** 每帧刷新(需在动画循环中调用) */
2085
2251
  update(): void;
2086
- /** 销毁,释放资源 */
2252
+ /**
2253
+ * 根据点位高度计算所属标高,描述统一输出为“标高X”。
2254
+ * 支持传入 url 以限定到指定模型,避免多模型场景下标高串用。
2255
+ */
2256
+ getLocationByPoint(urlOrPoint: string | THREE.Vector3 | {
2257
+ x: number;
2258
+ y: number;
2259
+ z: number;
2260
+ }, point?: THREE.Vector3 | {
2261
+ x: number;
2262
+ y: number;
2263
+ z: number;
2264
+ }): LevelLocationResult | null;
2087
2265
  dispose(): void;
2266
+ private _initSvg;
2088
2267
  private _initWorldToScreen;
2089
2268
  private _clearAll;
2090
2269
  private _buildThreeObject;
2091
2270
  private _updateSvgLabels;
2092
2271
  private _makeLabel;
2272
+ /**
2273
+ * 优先读取指定 url 对应模型的标高数据;未指定时退回当前已加载标高或全部模型标高。
2274
+ */
2275
+ private getLevelData;
2276
+ /**
2277
+ * 兼容 getLocationByPoint(point) 和 getLocationByPoint(url, point) 两种调用方式。
2278
+ */
2279
+ private resolvePointLookupArgs;
2280
+ /**
2281
+ * 根据 url 查找当前引擎中的目标模型。
2282
+ */
2283
+ private findModelByUrl;
2284
+ /**
2285
+ * 点位位于两个标高之间时,归属到距离最近的那个标高。
2286
+ */
2287
+ private pickNearestLevel;
2288
+ /**
2289
+ * 合并全部模型包围盒,作为标高辅助面的默认可视范围。
2290
+ */
2291
+ private getMergedBoundingBox;
2093
2292
  }
2094
2293
 
2095
2294
  declare interface LevelData {
@@ -2098,6 +2297,16 @@ declare interface LevelData {
2098
2297
  Elevation: number;
2099
2298
  }
2100
2299
 
2300
+ declare interface LevelLocationResult {
2301
+ pointY: number;
2302
+ description: string;
2303
+ currentLevel: LevelData | null;
2304
+ lowerLevel: LevelData | null;
2305
+ upperLevel: LevelData | null;
2306
+ isOnLevel: boolean;
2307
+ isInside: boolean;
2308
+ }
2309
+
2101
2310
  declare class LightModule {
2102
2311
  private engine;
2103
2312
  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.1",
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",