docs(engine): add JSDoc comments to all public methods
Add documentation for: - saveMeasureSetting: 保存测量设置 - fitSectionBoxToModel: 剖切盒适应选中模型 - setWalkSpeed/Gravity/Collision: 漫游参数设置 - toggleMiniMap: 切换小地图 - getTypeTreeData/LevelTreeData/MajorTreeData: 模型树数据获取 - activateZoomBox: 框选放大 - getEngineInfo: 获取引擎信息
This commit is contained in:
@@ -342,6 +342,10 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.measure.clearAll();
|
this.engine.measure.clearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存测量设置
|
||||||
|
* @param setting 测量设置,包含单位和精度
|
||||||
|
*/
|
||||||
public saveMeasureSetting(setting: { unit: MeasureUnit; precision: MeasurePrecision }): void {
|
public saveMeasureSetting(setting: { unit: MeasureUnit; precision: MeasurePrecision }): void {
|
||||||
if (!this._isInitialized || !this.engine?.measure) {
|
if (!this._isInitialized || !this.engine?.measure) {
|
||||||
return;
|
return;
|
||||||
@@ -493,6 +497,10 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.clipping.recover();
|
this.engine.clipping.recover();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剖切盒适应选中模型
|
||||||
|
* @remarks 将剖切盒调整为刚好包围选中的模型
|
||||||
|
*/
|
||||||
public fitSectionBoxToModel(): void {
|
public fitSectionBoxToModel(): void {
|
||||||
if (!this._isInitialized || !this.engine) {
|
if (!this._isInitialized || !this.engine) {
|
||||||
console.error('[Engine] Cannot fit section box: engine not initialized.');
|
console.error('[Engine] Cannot fit section box: engine not initialized.');
|
||||||
@@ -560,6 +568,10 @@ export class Engine implements IBimComponent {
|
|||||||
private static WALK_GRAVITY_KEY = 'bim-walk-gravity';
|
private static WALK_GRAVITY_KEY = 'bim-walk-gravity';
|
||||||
private static WALK_COLLISION_KEY = 'bim-walk-collision';
|
private static WALK_COLLISION_KEY = 'bim-walk-collision';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置漫游移动速度
|
||||||
|
* @param speed 移动速度值
|
||||||
|
*/
|
||||||
public setWalkSpeed(speed: number): void {
|
public setWalkSpeed(speed: number): void {
|
||||||
if (!this._isInitialized || !this.engine?.controlModule) {
|
if (!this._isInitialized || !this.engine?.controlModule) {
|
||||||
console.error('[Engine] Cannot set walk speed: engine not initialized.');
|
console.error('[Engine] Cannot set walk speed: engine not initialized.');
|
||||||
@@ -569,6 +581,10 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.controlModule.setMoveSpeed(speed);
|
this.engine.controlModule.setMoveSpeed(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置漫游重力开关
|
||||||
|
* @param enabled 是否启用重力
|
||||||
|
*/
|
||||||
public setWalkGravity(enabled: boolean): void {
|
public setWalkGravity(enabled: boolean): void {
|
||||||
if (!this._isInitialized || !this.engine?.controlModule) {
|
if (!this._isInitialized || !this.engine?.controlModule) {
|
||||||
console.error('[Engine] Cannot set walk gravity: engine not initialized.');
|
console.error('[Engine] Cannot set walk gravity: engine not initialized.');
|
||||||
@@ -578,6 +594,10 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.controlModule.setApplyGravity(enabled);
|
this.engine.controlModule.setApplyGravity(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置漫游碰撞检测开关
|
||||||
|
* @param enabled 是否启用碰撞检测
|
||||||
|
*/
|
||||||
public setWalkCollision(enabled: boolean): void {
|
public setWalkCollision(enabled: boolean): void {
|
||||||
if (!this._isInitialized || !this.engine?.controlModule) {
|
if (!this._isInitialized || !this.engine?.controlModule) {
|
||||||
console.error('[Engine] Cannot set walk collision: engine not initialized.');
|
console.error('[Engine] Cannot set walk collision: engine not initialized.');
|
||||||
@@ -599,6 +619,9 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.controlModule.setApplyCollision(collision === 'true');
|
this.engine.controlModule.setApplyCollision(collision === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换小地图显示状态
|
||||||
|
*/
|
||||||
public toggleMiniMap(): void {
|
public toggleMiniMap(): void {
|
||||||
if (!this._isInitialized || !this.engine?.controlModule) {
|
if (!this._isInitialized || !this.engine?.controlModule) {
|
||||||
console.error('[Engine] Cannot toggle mini map: engine not initialized.');
|
console.error('[Engine] Cannot toggle mini map: engine not initialized.');
|
||||||
@@ -656,6 +679,10 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
// ==================== 模型树 ====================
|
// ==================== 模型树 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型树数据
|
||||||
|
* @returns 类型树节点数组
|
||||||
|
*/
|
||||||
public getTypeTreeData(): any[] {
|
public getTypeTreeData(): any[] {
|
||||||
if (!this._isInitialized || !this.engine?.modelTree) {
|
if (!this._isInitialized || !this.engine?.modelTree) {
|
||||||
return [];
|
return [];
|
||||||
@@ -663,6 +690,10 @@ export class Engine implements IBimComponent {
|
|||||||
return this.engine.modelTree.getTypeTreeData();
|
return this.engine.modelTree.getTypeTreeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取楼层树数据
|
||||||
|
* @returns 楼层树节点数组
|
||||||
|
*/
|
||||||
public getLevelTreeData(): any[] {
|
public getLevelTreeData(): any[] {
|
||||||
if (!this._isInitialized || !this.engine?.modelTree) {
|
if (!this._isInitialized || !this.engine?.modelTree) {
|
||||||
return [];
|
return [];
|
||||||
@@ -670,6 +701,10 @@ export class Engine implements IBimComponent {
|
|||||||
return this.engine.modelTree.getLevelTreeData();
|
return this.engine.modelTree.getLevelTreeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取专业树数据
|
||||||
|
* @returns 专业树节点数组
|
||||||
|
*/
|
||||||
public getMajorTreeData(): any[] {
|
public getMajorTreeData(): any[] {
|
||||||
if (!this._isInitialized || !this.engine?.modelTree) {
|
if (!this._isInitialized || !this.engine?.modelTree) {
|
||||||
return [];
|
return [];
|
||||||
@@ -679,7 +714,10 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
// ==================== 结束:模型树 ====================
|
// ==================== 结束:模型树 ====================
|
||||||
|
|
||||||
/** 激活框选放大功能 */
|
/**
|
||||||
|
* 激活框选放大功能
|
||||||
|
* @remarks 允许用户通过框选区域来放大视图
|
||||||
|
*/
|
||||||
public activateZoomBox(): void {
|
public activateZoomBox(): void {
|
||||||
if (!this._isInitialized || !this.engine) {
|
if (!this._isInitialized || !this.engine) {
|
||||||
console.warn('[Engine] Engine not initialized.');
|
console.warn('[Engine] Engine not initialized.');
|
||||||
@@ -688,6 +726,10 @@ export class Engine implements IBimComponent {
|
|||||||
this.engine.rangeScale?.active();
|
this.engine.rangeScale?.active();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取引擎基本信息
|
||||||
|
* @returns 引擎信息对象,包含构件数量、三角面数量、顶点数量等
|
||||||
|
*/
|
||||||
public getEngineInfo(): EngineInfo | null {
|
public getEngineInfo(): EngineInfo | null {
|
||||||
if (!this._isInitialized || !this.engine) {
|
if (!this._isInitialized || !this.engine) {
|
||||||
console.warn('[Engine] Engine not initialized.');
|
console.warn('[Engine] Engine not initialized.');
|
||||||
@@ -866,6 +908,9 @@ export class Engine implements IBimComponent {
|
|||||||
console.warn('[Engine] Cannot show all models: engine not initialized.');
|
console.warn('[Engine] Cannot show all models: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 取消剖切
|
||||||
|
this.deactivateSection()
|
||||||
|
// 显示所有模型
|
||||||
this.engine.modelToolModule.showAllModels();
|
this.engine.modelToolModule.showAllModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user