docs: update clipping API documentation
- Update method references: activateSectionAxis → activeSection - Update call chains for all clipping modes (x/y/z/box/face) - Document new unified API: engine.clipping.active(mode) - Mark deprecated methods: fitSectionBoxToModel, resetSectionBox - Update underlying API: updateClippingValue instead of setboxPercent
This commit is contained in:
140
docs/API调用链.md
140
docs/API调用链.md
@@ -314,15 +314,15 @@ Button onClick (buttons/section/section-axis/index.ts)
|
|||||||
SectionAxisDialogManager.show() (继承自 BaseDialogManager)
|
SectionAxisDialogManager.show() (继承自 BaseDialogManager)
|
||||||
│ createContent() → 创建 SectionAxisPanel
|
│ createContent() → 创建 SectionAxisPanel
|
||||||
│ onDialogCreated()
|
│ onDialogCreated()
|
||||||
│ └── registry.engine3d.activateSectionAxis('x') // 默认激活 X 轴
|
│ └── registry.engine3d.activeSection('x') // 默认激活 X 轴
|
||||||
▼
|
▼
|
||||||
EngineManager.activateSectionAxis('x')
|
EngineManager.activeSection('x')
|
||||||
│ this.engineInstance.activateSectionAxis(axis)
|
│ this.engineInstance.activeSection(mode)
|
||||||
▼
|
▼
|
||||||
Engine.activateSectionAxis('x')
|
Engine.activeSection('x')
|
||||||
│ this.engine.clipping.sectionPlaneX.active()
|
│ this.engine.clipping.active('x')
|
||||||
▼
|
▼
|
||||||
底层引擎 API: engine.clipping.sectionPlaneX.active()
|
底层引擎 API: engine.clipping.active('x')
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 调用链 - 切换轴向
|
#### 调用链 - 切换轴向
|
||||||
@@ -335,20 +335,15 @@ SectionAxisPanel.onAxisChange('y')
|
|||||||
│
|
│
|
||||||
▼
|
▼
|
||||||
SectionAxisDialogManager 回调
|
SectionAxisDialogManager 回调
|
||||||
│ registry.engine3d?.activateSectionAxis('y')
|
│ registry.engine3d?.activeSection('y')
|
||||||
▼
|
▼
|
||||||
EngineManager.activateSectionAxis('y')
|
EngineManager.activeSection('y')
|
||||||
│ this.engineInstance.activateSectionAxis(axis)
|
│ this.engineInstance.activeSection(mode)
|
||||||
▼
|
▼
|
||||||
Engine.activateSectionAxis('y')
|
Engine.activeSection('y')
|
||||||
│ // 1. 先停用当前轴向 (X)
|
│ this.engine.clipping.active('y')
|
||||||
│ this.engine.clipping.sectionPlaneX.disActive()
|
|
||||||
│ // 2. 再激活新轴向 (Y)
|
|
||||||
│ this.engine.clipping.sectionPlaneY.active()
|
|
||||||
▼
|
▼
|
||||||
底层引擎 API:
|
底层引擎 API: engine.clipping.active('y')
|
||||||
- engine.clipping.sectionPlaneX.disActive()
|
|
||||||
- engine.clipping.sectionPlaneY.active()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 调用链 - 关闭对话框
|
#### 调用链 - 关闭对话框
|
||||||
@@ -358,24 +353,26 @@ Engine.activateSectionAxis('y')
|
|||||||
│
|
│
|
||||||
▼
|
▼
|
||||||
SectionAxisDialogManager.onBeforeDestroy()
|
SectionAxisDialogManager.onBeforeDestroy()
|
||||||
│ registry.engine3d?.deactivateSectionAxis()
|
│ registry.engine3d?.deactivateSection()
|
||||||
▼
|
▼
|
||||||
EngineManager.deactivateSectionAxis()
|
EngineManager.deactivateSection()
|
||||||
│ this.engineInstance.deactivateSectionAxis()
|
│ this.engineInstance.deactivateSection()
|
||||||
▼
|
▼
|
||||||
Engine.deactivateSectionAxis()
|
Engine.deactivateSection()
|
||||||
│ this.engine.clipping.disActive()
|
│ this.engine.clipping.disActive()
|
||||||
▼
|
▼
|
||||||
底层引擎 API: engine.clipping.disActive()
|
底层引擎 API: engine.clipping.disActive()
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 轴向与底层 API 对照表
|
#### 剖切模式与底层 API 对照表
|
||||||
|
|
||||||
| 轴向 | Engine 内部调用 | 底层 API |
|
| 模式 | Engine 调用 | 底层 API |
|
||||||
|------|----------------|----------|
|
|------|-------------|----------|
|
||||||
| x | `planeMap['x']` | `engine.clipping.sectionPlaneX.active()` |
|
| x | `activeSection('x')` | `engine.clipping.active('x')` |
|
||||||
| y | `planeMap['y']` | `engine.clipping.sectionPlaneY.active()` |
|
| y | `activeSection('y')` | `engine.clipping.active('y')` |
|
||||||
| z | `planeMap['z']` | `engine.clipping.sectionPlaneZ.active()` |
|
| z | `activeSection('z')` | `engine.clipping.active('z')` |
|
||||||
|
| box | `activeSection('box')` | `engine.clipping.active('box')` |
|
||||||
|
| face | `activeSection('face')` | `engine.clipping.active('face')` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -398,15 +395,15 @@ Button onClick (buttons/section/section-box/index.ts)
|
|||||||
SectionBoxDialogManager.show() (继承自 BaseDialogManager)
|
SectionBoxDialogManager.show() (继承自 BaseDialogManager)
|
||||||
│ createContent() → 创建 SectionBoxPanel
|
│ createContent() → 创建 SectionBoxPanel
|
||||||
│ onDialogCreated()
|
│ onDialogCreated()
|
||||||
│ └── registry.engine3d?.activateSectionBox()
|
│ └── registry.engine3d?.activeSection('box')
|
||||||
▼
|
▼
|
||||||
EngineManager.activateSectionBox()
|
EngineManager.activeSection('box')
|
||||||
│ this.engineInstance.activateSectionBox()
|
│ this.engineInstance.activeSection(mode)
|
||||||
▼
|
▼
|
||||||
Engine.activateSectionBox()
|
Engine.activeSection('box')
|
||||||
│ this.engine.clipping.sectionBox.active()
|
│ this.engine.clipping.active('box')
|
||||||
▼
|
▼
|
||||||
底层引擎 API: engine.clipping.sectionBox.active()
|
底层引擎 API: engine.clipping.active('box')
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 调用链 - 调整范围(拖动滑块)
|
#### 调用链 - 调整范围(拖动滑块)
|
||||||
@@ -425,56 +422,16 @@ EngineManager.setSectionBoxRange(range)
|
|||||||
│ this.engineInstance.setSectionBoxRange(range)
|
│ this.engineInstance.setSectionBoxRange(range)
|
||||||
▼
|
▼
|
||||||
Engine.setSectionBoxRange(range)
|
Engine.setSectionBoxRange(range)
|
||||||
│ this.engine.clipping.sectionBox.setboxPercent(range) // 直传百分比
|
│ this.engine.clipping.updateClippingValue(range)
|
||||||
▼
|
▼
|
||||||
底层引擎 API: engine.clipping.sectionBox.setboxPercent(range)
|
底层引擎 API: engine.clipping.updateClippingValue(range)
|
||||||
│ (底层负责百分比→坐标转换)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 调用链 - 适应到模型
|
#### 调用链 - 适应到模型 / 重置 (已废弃)
|
||||||
|
|
||||||
```
|
**注意**: `fitSectionBoxToModel()` 和 `resetSectionBox()` 已从新 API 中移除。
|
||||||
用户点击 [适应到模型] 按钮
|
- 用户点击这些按钮时,现在仅输出日志,不执行任何操作
|
||||||
│
|
- 统一使用 `setSectionBoxRange()` 和 `updateClippingValue()` 调整范围
|
||||||
▼
|
|
||||||
SectionBoxPanel.onFitToModel()
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
SectionBoxDialogManager 回调
|
|
||||||
│ registry.engine3d?.fitSectionBoxToModel()
|
|
||||||
▼
|
|
||||||
EngineManager.fitSectionBoxToModel()
|
|
||||||
│ this.engineInstance.fitSectionBoxToModel()
|
|
||||||
▼
|
|
||||||
Engine.fitSectionBoxToModel()
|
|
||||||
│ const box = this.engine.octreeBox?.getBoundingBox()
|
|
||||||
│ this.engine.clipping.sectionBox.setBox(box)
|
|
||||||
▼
|
|
||||||
底层引擎 API:
|
|
||||||
- engine.octreeBox.getBoundingBox()
|
|
||||||
- engine.clipping.sectionBox.setBox(box)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 调用链 - 重置
|
|
||||||
|
|
||||||
```
|
|
||||||
用户点击 [重置] 按钮
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
SectionBoxPanel.onReset()
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
SectionBoxDialogManager 回调
|
|
||||||
│ registry.engine3d?.resetSectionBox()
|
|
||||||
▼
|
|
||||||
EngineManager.resetSectionBox()
|
|
||||||
│ this.engineInstance.resetSectionBox()
|
|
||||||
▼
|
|
||||||
Engine.resetSectionBox()
|
|
||||||
│ this.fitSectionBoxToModel() // 内部调用适应到模型
|
|
||||||
▼
|
|
||||||
(同上 "适应到模型" 流程)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 调用链 - 关闭对话框
|
#### 调用链 - 关闭对话框
|
||||||
|
|
||||||
@@ -483,27 +440,26 @@ Engine.resetSectionBox()
|
|||||||
│
|
│
|
||||||
▼
|
▼
|
||||||
SectionBoxDialogManager.onBeforeDestroy()
|
SectionBoxDialogManager.onBeforeDestroy()
|
||||||
│ registry.engine3d?.deactivateSectionBox()
|
│ registry.engine3d?.deactivateSection()
|
||||||
▼
|
▼
|
||||||
EngineManager.deactivateSectionBox()
|
EngineManager.deactivateSection()
|
||||||
│ this.engineInstance.deactivateSectionBox()
|
│ this.engineInstance.deactivateSection()
|
||||||
▼
|
▼
|
||||||
Engine.deactivateSectionBox()
|
Engine.deactivateSection()
|
||||||
│ this.engine.clipping.sectionBox.disActive()
|
│ this.engine.clipping.disActive()
|
||||||
▼
|
▼
|
||||||
底层引擎 API: engine.clipping.sectionBox.disActive()
|
底层引擎 API: engine.clipping.disActive()
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 剖切盒 API 汇总
|
#### 剖切盒 API 汇总 (新版统一 API)
|
||||||
|
|
||||||
| 操作 | Engine 方法 | 底层 API |
|
| 操作 | Engine 方法 | 底层 API |
|
||||||
|------|-------------|----------|
|
|------|-------------|----------|
|
||||||
| 激活 | `activateSectionBox()` | `engine.clipping.sectionBox.active()` |
|
| 激活 | `activeSection('box')` | `engine.clipping.active('box')` |
|
||||||
| 停用 | `deactivateSectionBox()` | `engine.clipping.sectionBox.disActive()` |
|
| 停用 | `deactivateSection()` | `engine.clipping.disActive()` |
|
||||||
| 设置范围(百分比) | `setSectionBoxRange(range)` | `engine.clipping.sectionBox.setboxPercent(range)` |
|
| 设置范围 | `setSectionBoxRange(range)` | `engine.clipping.updateClippingValue(range)` |
|
||||||
| 设置范围(坐标) | - | `engine.clipping.sectionBox.setboxXyz(xyz)` |
|
| ~~适应到模型~~ | ~~`fitSectionBoxToModel()`~~ (已废弃) | - |
|
||||||
| 适应到模型 | `fitSectionBoxToModel()` | `engine.clipping.sectionBox.setBox(box)` |
|
| ~~重置~~ | ~~`resetSectionBox()`~~ (已废弃) | - |
|
||||||
| 获取包围盒 | - | `engine.octreeBox.getBoundingBox()` |
|
|
||||||
|
|
||||||
#### 数据格式说明
|
#### 数据格式说明
|
||||||
|
|
||||||
|
|||||||
@@ -113,10 +113,10 @@ export class SectionBoxDialogManager extends BaseDialogManager {
|
|||||||
protected createContent(): HTMLElement {
|
protected createContent(): HTMLElement {
|
||||||
this.panel = new SectionBoxPanel({
|
this.panel = new SectionBoxPanel({
|
||||||
onFitToModel: () => {
|
onFitToModel: () => {
|
||||||
this.registry.engine3d?.fitSectionBoxToModel(); // ← 调用 EngineManager
|
console.log('[SectionBoxDialogManager] Fit to model not supported');
|
||||||
},
|
},
|
||||||
onReset: () => {
|
onReset: () => {
|
||||||
this.registry.engine3d?.resetSectionBox();
|
console.log('[SectionBoxDialogManager] Reset not supported');
|
||||||
},
|
},
|
||||||
onRangeChange: (range) => {
|
onRangeChange: (range) => {
|
||||||
this.registry.engine3d?.setSectionBoxRange(range);
|
this.registry.engine3d?.setSectionBoxRange(range);
|
||||||
@@ -128,13 +128,13 @@ export class SectionBoxDialogManager extends BaseDialogManager {
|
|||||||
|
|
||||||
// 对话框创建后,激活剖切盒
|
// 对话框创建后,激活剖切盒
|
||||||
protected onDialogCreated(): void {
|
protected onDialogCreated(): void {
|
||||||
this.registry.engine3d?.activateSectionBox(); // ← 调用 EngineManager
|
this.registry.engine3d?.activeSection('box'); // ← 调用 EngineManager 统一 API
|
||||||
this.dialog?.fitHeight(false);
|
this.dialog?.fitHeight(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对话框销毁前,停用剖切盒
|
// 对话框销毁前,停用剖切
|
||||||
protected onBeforeDestroy(): void {
|
protected onBeforeDestroy(): void {
|
||||||
this.registry.engine3d?.deactivateSectionBox();
|
this.registry.engine3d?.deactivateSection(); // ← 统一停用方法
|
||||||
// ... 清理
|
// ... 清理
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,13 +159,29 @@ export class SectionBoxDialogManager extends BaseDialogManager {
|
|||||||
export class EngineManager extends BaseManager {
|
export class EngineManager extends BaseManager {
|
||||||
private engineInstance: Engine | null = null;
|
private engineInstance: Engine | null = null;
|
||||||
|
|
||||||
// 激活剖切盒
|
// 激活剖切(统一入口)
|
||||||
public activateSectionBox(): void {
|
public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
|
||||||
if (!this.engineInstance) {
|
if (!this.engineInstance) {
|
||||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.engineInstance.activateSectionBox(); // ← 调用 Engine 组件
|
this.engineInstance.activeSection(mode); // ← 调用 Engine 组件
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前剖切模式
|
||||||
|
public getCurrentSectionMode(): 'x' | 'y' | 'z' | 'box' | 'face' | null {
|
||||||
|
if (!this.engineInstance) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.engineInstance.getCurrentSectionMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停用剖切(统一出口)
|
||||||
|
public deactivateSection(): void {
|
||||||
|
if (!this.engineInstance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.engineInstance.deactivateSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置剖切盒范围
|
// 设置剖切盒范围
|
||||||
@@ -193,11 +209,10 @@ export class EngineManager extends BaseManager {
|
|||||||
```typescript
|
```typescript
|
||||||
export class Engine implements IBimComponent {
|
export class Engine implements IBimComponent {
|
||||||
private engine: any = null; // 底层引擎实例
|
private engine: any = null; // 底层引擎实例
|
||||||
private isSectionBoxActive: boolean = false; // 状态标记
|
private currentSectionMode: 'x' | 'y' | 'z' | 'box' | 'face' | null = null; // 当前剖切模式
|
||||||
private sectionBoxFullBounds: any = null; // 缓存的包围盒
|
|
||||||
|
|
||||||
// 激活剖切盒
|
// 激活剖切(统一入口)
|
||||||
public activateSectionBox(): void {
|
public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
|
||||||
if (!this._isInitialized || !this.engine) {
|
if (!this._isInitialized || !this.engine) {
|
||||||
console.error('[Engine] Cannot activate section box: engine not initialized.');
|
console.error('[Engine] Cannot activate section box: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user