feat(clipping): add hideSection and recoverSection methods

Add new methods for temporary section plane visibility control:
- hideSection(): Hide section plane temporarily (calls engine.clipping.disabled())
- recoverSection(): Recover hidden section plane (calls engine.clipping.recover())

Update SectionPlaneDialogManager to use hideSection() instead of direct API call.
This commit is contained in:
yuding
2026-02-02 16:32:22 +08:00
parent 6db24d23bb
commit 41abd9ed67
3 changed files with 69 additions and 4 deletions

View File

@@ -521,6 +521,51 @@ export class Engine implements IBimComponent {
this.currentSectionMode = null; this.currentSectionMode = null;
} }
/**
* 隐藏剖切面(临时隐藏,可恢复)
* @remarks
* - 隐藏当前剖切面,但不停用剖切功能
* - 配合 recoverSection() 使用
* - 底层调用 engine.clipping.disabled()
* @example
* ```typescript
* // 临时隐藏剖切面
* engine.hideSection();
* // 稍后恢复
* engine.recoverSection();
* ```
*/
public hideSection(): void {
if (!this._isInitialized || !this.engine?.clipping) {
console.error('[Engine] Cannot hide section: engine not initialized.');
return;
}
console.log('[Engine] Hiding section');
this.engine.clipping.disabled();
}
/**
* 恢复剖切面(从隐藏状态恢复)
* @remarks
* - 恢复被 hideSection() 隐藏的剖切面
* - 底层调用 engine.clipping.recover()
* @example
* ```typescript
* // 隐藏后恢复剖切面
* engine.hideSection();
* // ... 一段时间后
* engine.recoverSection();
* ```
*/
public recoverSection(): void {
if (!this._isInitialized || !this.engine?.clipping) {
console.error('[Engine] Cannot recover section: engine not initialized.');
return;
}
console.log('[Engine] Recovering section');
this.engine.clipping.recover();
}
// ==================== 结束:剖切功能 ==================== // ==================== 结束:剖切功能 ====================
// ==================== 漫游功能 ==================== // ==================== 漫游功能 ====================

View File

@@ -302,6 +302,28 @@ export class EngineManager extends BaseManager {
this.engineInstance.setSectionBoxRange(range); this.engineInstance.setSectionBoxRange(range);
} }
/**
* 隐藏剖切面(临时隐藏,可恢复)
* @remarks 配合 recoverSection() 使用
*/
public hideSection(): void {
if (!this.engineInstance) {
return;
}
this.engineInstance.hideSection();
}
/**
* 恢复剖切面(从隐藏状态恢复)
* @remarks 恢复被 hideSection() 隐藏的剖切面
*/
public recoverSection(): void {
if (!this.engineInstance) {
return;
}
this.engineInstance.recoverSection();
}
/** 激活框选放大功能 */ /** 激活框选放大功能 */
public activateZoomBox(): void { public activateZoomBox(): void {
if (!this.engineInstance) { if (!this.engineInstance) {

View File

@@ -48,10 +48,8 @@ export class SectionPlaneDialogManager extends BaseDialogManager {
protected createContent(): HTMLElement { protected createContent(): HTMLElement {
this.panel = new SectionPlanePanel({ this.panel = new SectionPlanePanel({
onHide: () => { onHide: () => {
console.log('[SectionPlaneDialogManager] 隐藏'); console.log('[SectionPlaneDialogManager] 隐藏剖切面');
if (this.registry.engine3d) { this.registry.engine3d?.hideSection();
(this.registry.engine3d as any).engine?.clipping?.disabled();
}
}, },
onReverse: () => { onReverse: () => {
console.log('[SectionPlaneDialogManager] 反向 (not supported in new API)'); console.log('[SectionPlaneDialogManager] 反向 (not supported in new API)');