refactor(engine): update Engine layer to accept models parameter
- Add getHighlightModels() to retrieve selected models - Rename hideSelectedModels → hideModels(models) - Rename translucentSelectedModels → translucentModels(models) - Rename isolateSelectedModels → isolateModels(models) - Update translucentOtherModels to accept models parameter - Update batch select methods to accept models parameter Tasks 1-6 completed from refactor-model-operations plan.
This commit is contained in:
@@ -834,28 +834,39 @@ export class Engine implements IBimComponent {
|
|||||||
// ==================== 构件操作 ====================
|
// ==================== 构件操作 ====================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐藏选中构件
|
* 获取当前高亮(选中)的模型
|
||||||
|
* @returns 高亮模型对象,未选中时返回 null
|
||||||
*/
|
*/
|
||||||
public hideSelectedModels(): void {
|
public getHighlightModels(): any {
|
||||||
|
if (!this._isInitialized || !this.engine) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.engine.engineStatus?.highlightModels ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐藏指定模型
|
||||||
|
* @param models 要隐藏的模型对象
|
||||||
|
*/
|
||||||
|
public hideModels(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot hide models: engine not initialized.');
|
console.warn('[Engine] Cannot hide models: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.hideModel(models);
|
this.engine.modelToolModule.hideModel(models);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 半透明选中构件
|
* 半透明指定模型
|
||||||
|
* @param models 要半透明的模型对象
|
||||||
*/
|
*/
|
||||||
public translucentSelectedModels(): void {
|
public translucentModels(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot translucent models: engine not initialized.');
|
console.warn('[Engine] Cannot translucent models: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.translucentModel(models);
|
this.engine.modelToolModule.translucentModel(models);
|
||||||
}
|
}
|
||||||
@@ -873,14 +884,14 @@ export class Engine implements IBimComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隔离选中构件(隐藏其他)
|
* 隔离指定模型(隐藏其他)
|
||||||
|
* @param models 要隔离的模型对象
|
||||||
*/
|
*/
|
||||||
public isolateSelectedModels(): void {
|
public isolateModels(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot isolate models: engine not initialized.');
|
console.warn('[Engine] Cannot isolate models: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.isolateModel(models);
|
this.engine.modelToolModule.isolateModel(models);
|
||||||
}
|
}
|
||||||
@@ -888,13 +899,13 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 半透明其他构件
|
* 半透明其他构件
|
||||||
|
* @param models 选中的模型对象(其他构件将被半透明)
|
||||||
*/
|
*/
|
||||||
public translucentOtherModels(): void {
|
public translucentOtherModels(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot translucent other models: engine not initialized.');
|
console.warn('[Engine] Cannot translucent other models: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.translucentOtherModel(models);
|
this.engine.modelToolModule.translucentOtherModel(models);
|
||||||
}
|
}
|
||||||
@@ -916,13 +927,13 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择同类模型
|
* 批量选择同类模型
|
||||||
|
* @param models 参考模型对象
|
||||||
*/
|
*/
|
||||||
public batchSelectSameTypeModel(): void {
|
public batchSelectSameTypeModel(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.batchSelectSameTypeModel(models);
|
this.engine.modelToolModule.batchSelectSameTypeModel(models);
|
||||||
}
|
}
|
||||||
@@ -930,13 +941,13 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择同层模型
|
* 批量选择同层模型
|
||||||
|
* @param models 参考模型对象
|
||||||
*/
|
*/
|
||||||
public batchSelectSameLevelModel(): void {
|
public batchSelectSameLevelModel(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.batchSelectSameLevelModel(models);
|
this.engine.modelToolModule.batchSelectSameLevelModel(models);
|
||||||
}
|
}
|
||||||
@@ -944,13 +955,13 @@ export class Engine implements IBimComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量选择同层同类模型
|
* 批量选择同层同类模型
|
||||||
|
* @param models 参考模型对象
|
||||||
*/
|
*/
|
||||||
public batchSelectSameLevelTypeModel(): void {
|
public batchSelectSameLevelTypeModel(models: any): void {
|
||||||
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
if (!this._isInitialized || !this.engine?.modelToolModule) {
|
||||||
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
console.warn('[Engine] Cannot batch select: engine not initialized.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const models = this.engine.engineStatus?.highlightModels;
|
|
||||||
if (models) {
|
if (models) {
|
||||||
this.engine.modelToolModule.batchSelectSameLevelTypeModel(models);
|
this.engine.modelToolModule.batchSelectSameLevelTypeModel(models);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user