Browse Source

删除设备

dev
陈鹏飞 3 years ago
parent
commit
c698f1e918
  1. 37
      src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts
  2. 25
      src/app/pages/plan/plan.component.ts

37
src/app/babylon/view/facilityinfoinscene-window/facilityinfoinscene-window.ts

@ -151,30 +151,21 @@ export class FacilityInfoInSceneWindow extends UIBase {
//选中,通知前端 //选中,通知前端
selectFacilityItemToThree(facilityInfoUIItem: FacilityInfoUIItem[], isChecked?: boolean) { selectFacilityItemToThree(facilityInfoUIItem: FacilityInfoUIItem[], isChecked?: boolean) {
this.three = PlanComponent.instance; this.three = PlanComponent.instance;
// if (this.isMultiselect) { // 多选 if (this.isMultiselect) { // 多选
// if (isChecked) { //选中 if (isChecked) { //选中
// facilityInfoUIItem.forEach(element => {
// element.isChecked = isChecked } else { //取消选中
// let isFind = this.three.beforeOnefacilityInfoList.find(item => { return item === element.getID() })
// isFind == undefined || isFind == null ? this.three.beforeOnefacilityInfoList.push(element.getID()) : null }
// }) } else { // 单选
// } else { //取消选中 if (isChecked) { //选中
// this.three.isShowRightNature = false this.three.beforeOnefacilityInfo = facilityInfoUIItem[0].getID();
// facilityInfoUIItem.forEach(element => { this.three.getPropertyData(facilityInfoUIItem[0])
// element.isChecked = isChecked } else { //取消选中
// let index = this.three.beforeOnefacilityInfoList.findIndex(value => value === element.getID())
// index != undefined && index != null ? this.three.beforeOnefacilityInfoList.splice(index, 1) : null
// })
// }
// } else { // 单选
// if (isChecked) { //选中
// this.three.beforeOnefacilityInfo = facilityInfoUIItem[0].getID();
// this.three.getPropertyData(facilityInfoUIItem[0])
// } else { //取消选中
// this.three.isShowRightNature = false // this.three.isShowRightNature = false
// this.three.beforeOnefacilityInfo = null this.three.beforeOnefacilityInfo = null
// } }
// } }
} }
/** /**

25
src/app/pages/plan/plan.component.ts

@ -14,6 +14,8 @@ import { BuildingType } from 'src/app/babylon/model/data/institution/building/bu
import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window'; import { BuildingWindow } from 'src/app/babylon/view/building-window/building-window';
import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item'; import { FacilityUIItem } from 'src/app/babylon/view/facility-window/facility-ui-item';
import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window'; import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-window';
import { FacilityInfoUIItem } from 'src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item';
import { EventManager } from '@angular/platform-browser';
@ -24,7 +26,7 @@ import { FacilityWindow } from 'src/app/babylon/view/facility-window/facility-wi
}) })
export class PlanComponent implements OnInit { export class PlanComponent implements OnInit {
constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService) { } constructor(private element: ElementRef, private buildingBISrv: BuildingBasicInfosService, private objectsSrv: ObjectsService, private eventManager: EventManager) { }
static instance: PlanComponent; static instance: PlanComponent;
public game: Game = new Game(); public game: Game = new Game();
@ -36,6 +38,16 @@ export class PlanComponent implements OnInit {
ServeManager.Init(this.buildingBISrv, this.objectsSrv); ServeManager.Init(this.buildingBISrv, this.objectsSrv);
this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement; this.canvas = this.element.nativeElement.querySelector('#center') as HTMLCanvasElement;
this.game.init(this.canvas); this.game.init(this.canvas);
//监听 delete键盘事件
this.eventManager.addGlobalEventListener('window', 'keydown', (event: any) => {
if (event.keyCode == 46) { //delete
if (this.beforeOnePropertyData) {
let isDelete = confirm("是否删除已选择模型?");
if (isDelete) { this.beforeOnePropertyData.askDelete(false) };
}
}
})
//监听 delete键盘事件
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
@ -179,6 +191,14 @@ export class PlanComponent implements OnInit {
e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50 e == 0 ? bootomDiv.scrollLeft = bootomDiv.scrollLeft + 50 : bootomDiv.scrollLeft = bootomDiv.scrollLeft - 50
} }
beforeOnePropertyData: FacilityInfoUIItem = null; //当前选择 设备
beforeOnefacilityInfo: string = null; //当前选择 设备ID
//获取选择设备 属性
getPropertyData(e: FacilityInfoUIItem) {
this.beforeOnePropertyData = e
}
selectRightTopFast: number = 0; //当前选择功能 快捷栏 selectRightTopFast: number = 0; //当前选择功能 快捷栏
selectAdsorb: boolean = false; //吸附状态 selectAdsorb: boolean = false; //吸附状态
topLevelView: boolean = false; //顶视图状态 topLevelView: boolean = false; //顶视图状态
@ -190,8 +210,11 @@ export class PlanComponent implements OnInit {
//清空设备 //清空设备
clearDevice() { clearDevice() {
let isClear = confirm('您确定要清空吗?')
if (isClear) {
ToolbarWindow.instance.clearHomeLessFacilityData() ToolbarWindow.instance.clearHomeLessFacilityData()
} }
}
//平移 //平移
translation() { translation() {

Loading…
Cancel
Save