Files
bim_engine/.recycle/2026-01-22/src/index.d.ts
yuding f2460fb981 refactor: 重命名SDK为iflow-engine,使用npm包引入第三方引擎
- 将包名从 @fishdingding/bim-engine-sdk 改为 iflow-engine
- 将构建输出文件从 bim-engine-sdk.*.js 改为 iflow-engine.*.js
- 将全局变量从 LyzBimEngineSDK 改为 IflowEngine
- 将第三方引擎SDK从本地引入改为npm包引入 (iflow-engine-base)
- 移除本地 src/engine_base 目录,移至回收站
- 更新所有文档和demo中的引用
2026-01-22 11:29:51 +08:00

449 lines
11 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { default as default_2 } from 'stats.js';
import * as THREE from 'three';
declare class CameraModule {
private engine;
perspectiveCamera: THREE.PerspectiveCamera;
orthographicCamera: THREE.OrthographicCamera;
constructor(engine: any);
switchToPerspectiveCamera(): void;
switchToOrthographicCamera(): void;
getCameraType(): CameraType;
getCameraPose(): ICameraPose;
restoreCameraPose(pose: ICameraPose): void;
}
declare enum CameraType {
PERSPECTIVE = "perspective",
ORTHOGRAPHIC = "orthographic"
}
declare class Clipping {
private engine;
sectionPlaneX: any;
sectionPlaneY: any;
sectionPlaneZ: any;
sectionBox: any;
constructor(engine: any);
disActive(): void;
}
declare class ComposerModule {
private engine;
composer: any;
private saturationPass;
constructor(engine: any);
resize(): void;
init(): void;
}
declare class ControlModule {
private engine;
orbitControls: any;
firstPersonControls: any;
isActive: boolean;
constructor(engine: any);
init(): void;
active(): void;
disActive(): void;
switchFirstPersonMode(): void;
switchDefaultMode(): void;
update(): void;
}
/**
* Factory function to create the BIM Engine instance.
*
* @param options Configuration options
* @returns An instance adhering to IBimEngine interface
*/
export declare function createEngine(options: EngineOptions): EngineKernelV2;
declare class DeviceModule {
private engine;
deviceType: string;
constructor(engine: any);
getDeviceType(): string;
getContainerSize(): {
width: any;
height: any;
};
}
/**
* 引擎信息统计类
* 用于统计引擎中模型的顶点和三角面数量
*/
declare class EngineInfo {
private engine;
constructor(engine: any);
/**
* 获取引擎统计信息
* 统计场景中所有网格的顶点数和三角面数
* @returns 返回包含顶点数和三角面数的对象
*/
getEngineInfo(): {
totalVertices: number;
totalTriangles: number;
meshCount: number;
};
}
declare class EngineKernelV2 {
private options;
private DeviceType;
private animationId;
private animate;
scene: THREE.Scene | null;
camera: THREE.Camera | null;
renderer: THREE.WebGLRenderer | null;
sceneModule: SceneModule;
cameraModule: CameraModule;
deviceModule: DeviceModule;
renderModule: RenderModule;
controlModule: ControlModule;
composerModule: ComposerModule;
loaderModule: LoaderModule;
engineStatus: EngineStatus;
events: EventModule;
lightModule: LightModule;
interactionModule: InteractionModule;
modelToolModule: ModelToolModule;
handelBehaved: typeof HandelBehaved;
octreeBox: any;
controls: any;
stats: default_2;
viewCube: ViewCube;
rangeScale: RangeScale;
setting: Setting;
measure: Measure;
clipping: Clipping;
modelTree: ModelTree;
engineInfo: EngineInfo;
modelProperties: ModelProperties;
modelMapperBatch: ModelMapperBatch;
models: any[];
private container;
constructor(options: any);
}
/**
* 引擎初始化配置
*/
declare interface EngineOptions {
containerId: string;
backgroundColor?: string | number | null;
antialias?: boolean;
version?: 'v1' | 'v2';
showStats?: boolean;
showViewCube?: boolean;
}
declare class EngineStatus {
private engine;
isFree: boolean;
highlightModels: any[];
hideModels: any[];
models: any[];
constructor(engine: any);
init(): void;
updateFree(status: boolean): void;
closeAllFunction: () => void;
}
declare class EventModule {
private listeners;
on<T = any>(event: EventType, callback: (data: T) => void): void;
off<T = any>(event: EventType, callback: (data: T) => void): void;
trigger(event: EventType, data?: any): void;
}
/**
* 事件类型枚举
*/
declare enum EventType {
ModelLoadStart = "model-load-start",
ModelLoadProgress = "model-load-progress",
ModelLoaded = "model-loaded",
ModelError = "model-error",
SelectionChanged = "selection-changed",// data: { ids: string[], modelId: string }
HoverChanged = "hover-changed",// data: { id: string | null, point: Vector3 }
Click = "click",// data: MouseEventData
MouseMove = "mouse-move",// data: MouseEventData - 鼠标移动事件
CameraChanged = "camera-changed",// 相机移动时持续触发
CameraIdle = "camera-idle",// 相机静止后触发
EngineFree = "engine-free",
EngineBusy = "engine-busy"
}
/**
* 行为处理器 - 管理引擎的交互行为(鼠标、键盘事件等)
* @param engine 引擎实例
* @returns 行为处理器对象
*/
declare function HandelBehaved(engine: any): any;
declare interface ICameraPose {
type: CameraType;
position: {
x: number;
y: number;
z: number;
};
rotation: {
x: number;
y: number;
z: number;
};
quaternion: {
x: number;
y: number;
z: number;
w: number;
};
target?: {
x: number;
y: number;
z: number;
};
zoom?: number;
}
declare class InteractionModule {
private engine;
private behavior;
private isCtrlDown;
constructor(engine: any);
init(): void;
active(): void;
disActive(): void;
handelKeyCtrlUp(): void;
handelKeyCtrlDown(): void;
handleMouseClick(event: any): void;
handleMouseDoubleClick(event: any): void;
}
declare class LightModule {
private engine;
constructor(engine: any);
init(): void;
}
declare class LoaderModule {
private engine;
constructor(engine: any);
loadModels(urls: string[], options?: LoadModelOptions): Promise<void>;
}
/**
* 模型加载配置项
*/
declare interface LoadModelOptions {
/** 自定义模型 ID若不提供则自动生成 UUID */
id?: string;
/** 初始名称 */
name?: string;
/** 初始变换矩阵 (平移、旋转、缩放) */
matrix?: number[];
/** 初始位置 [x, y, z] (如果提供了 matrix此项可能被忽略或叠加) */
position?: [number, number, number];
/** 初始旋转 [x, y, z] (欧拉角,弧度) */
rotation?: [number, number, number];
/** 初始缩放 [x, y, z] */
scale?: [number, number, number];
/** 加载进度回调 (0-100) */
onProgress?: (progress: number) => void;
}
declare class Measure {
private isActive;
private engine;
private clearHeightMeasure;
private distanceMeasure;
private clearDistanceMeasure;
private elevationMeasure;
private pointMeasure;
private angleMeasure;
private areaMeasure;
private slopeMeasure;
private tools;
private annotationContainer;
private annotationData;
constructor(engine: any);
active(): void;
disActive(): void;
clearAll(): void;
update(): void;
}
declare class ModelMapperBatch {
private engine;
constructor(engine: any);
getModelTypes(): void;
getModelMajors(): void;
getModelLevels(): void;
getModelMappers(models: any[]): void;
getModelMapper(url: string, id: number): any;
getModelSWithType(type: string, callback: any): any[];
getModelSWithLevel(level: string, callback: any): any[];
getModelsWithMajor(major: string, callback: any): any[];
}
declare class ModelProperties {
private engine;
constructor(engine: any);
init(): void;
getModelProperties(url: string, id: string, callback: (properties: any) => void): void;
}
declare class ModelToolModule {
private engine;
private highlightMaterial;
private hideMaterial;
constructor(engine_: any);
highlightModel(models: any): void;
unhighlightModel(models: any): void;
unhighlightAllModels(): void;
hideModel(models: any): void;
showModel(models: any): void;
showAllModels(): void;
setModelColor(model: any, color: string): void;
setAllModelsColor(color: string): void;
restoreAllModelsColor(): void;
getModelsBox(models: any): THREE.Box3;
getModelDescription(model: any): void;
}
declare class ModelTree {
private engine;
constructor(engine: any);
getTreeData(): any[];
}
/**
* RangeScale - 范围缩放工具
*
* 功能:
* 1. 用户在屏幕上绘制一个区域(通过鼠标拖拽)
* 2. 将屏幕区域转换为世界坐标
* 3. 计算该区域在世界空间中的包围盒
* 4. 调整相机位置和视角,使该区域适合视口
*/
declare class RangeScale {
private engine;
private isDrawing;
private startPoint;
private endPoint;
private selectionBox;
private worldToScreen;
private boundMouseDown;
private boundMouseMove;
private boundMouseUp;
private boundKeyDown;
constructor(engine: any);
/**
* 初始化工具
* 创建绘制框UI元素初始化坐标转换工具
*/
init(): void;
/**
* 激活工具
* 禁用控制器,添加鼠标事件监听器和键盘事件监听器
*/
active(): void;
/**
* 停用工具
* 启用控制器,移除鼠标事件监听器和键盘事件监听器
*/
disActive(): void;
/**
* 创建绘制框UI元素
* 用于在屏幕上显示用户绘制的区域
*/
private createSelectionBoxElement;
/**
* 鼠标按下事件处理
* 开始绘制区域
*/
private onMouseDown;
/**
* 鼠标移动事件处理
* 更新绘制框的显示
*/
private onMouseMove;
/**
* 鼠标释放事件处理
* 结束绘制,执行缩放操作
*/
private onMouseUp;
/**
* 键盘按下事件处理
* 按下 ESC 键时退出功能
*/
private onKeyDown;
/**
* 结束绘制
* 隐藏绘制框
*/
private endDrawing;
/**
* 更新绘制框UI
* 根据起点和终点更新绘制框的位置和大小
*/
private updateSelectionBoxUI;
/**
* 执行缩放操作
* 将屏幕区域转换为世界坐标,计算包围盒,调整相机视角
*/
private performZoom;
/**
* 调整相机视角以适应包围盒
* @param boundingBox - 要适应的包围盒
*/
private fitCameraToBoundingBox;
}
declare class RenderModule {
private engine;
renderer: THREE.WebGLRenderer | null;
constructor(engine: any);
createRenderer(): THREE.WebGLRenderer;
disposeRenderer(): void;
}
declare class SceneModule {
private engine;
scene: THREE.Scene | null;
constructor(engine: any);
}
declare class Setting {
private engine;
constructor(engine: any);
init(): void;
}
declare class ViewCube {
private engine;
cubeTool: any;
constructor(engine: any);
init(): void;
CameraGoHome(): void;
zoomToModel(box: any): void;
}
export { }
declare module 'three' {
namespace THREE {
class OrbitControls {
enabled: boolean;
dampingFactor: number;
constructor(_Engine: any, object: any, domElement: HTMLElement);
update(): void;
addEventListener(type: string, listener: (event: any) => void): void;
[key: string]: any;
}
}
}