diff --git a/src/app/babylon/controller/serve-manager.ts b/src/app/babylon/controller/serve-manager.ts index 82098d5..34fd6b7 100644 --- a/src/app/babylon/controller/serve-manager.ts +++ b/src/app/babylon/controller/serve-manager.ts @@ -5,7 +5,7 @@ import { BuildingBasicInfosService } from "src/app/service/babylon/building-basi import { ObjectsService } from "src/app/service/objects.service"; import { ExportData } from "../model/data/institution/building/export-data"; import { InsitutionDataSimple } from "../model/data/institution/institution-data-simple"; -import { AllMarkPlanData } from "../model/data/mark/mark-plan-data"; +import { AllMarkPlanData, MarkPlanData } from "../model/data/mark/mark-plan-data"; import { DataManager } from "./data-manager"; import { ModeManager, ModeType } from "./mode-manager"; @@ -159,6 +159,61 @@ export class ServeManager { //#endregion + //#region 态势标会模板 + + /** + * 获取所有模板 + * @param onSuccess + */ + getAllMarkTemplate(onSuccess?: (data: string) => void) { + this.buildingBISrv.getAllSandBoxTemplate() + .subscribe(data => { + console.log("得到所有模板", data); + if (onSuccess) { + // onSuccess( JSON.parse((data as any).result)); + } + }, error => { + console.error("From serve:AllMarkTemplate", error); + }) + } + + /** + * 获取单个模板 + */ + getOneMarkTemplate(id: number, onSuccess?: (data: string) => void) { + this.buildingBISrv.getSandBoxTemplate(id). + subscribe(data => { + console.log("得到单个模板" + id, data); + if (onSuccess) { + // onSuccess( JSON.parse((data as any).result)); + } + }, error => { + console.error("From serve:OneMarkTemplate", error); + }) + } + + /** + * 保存为模板 + * @param id + * @param name + * @param data + * @param onSuccess + */ + saveOneMarkTemplate(id: number, name: string, data: MarkPlanData, onSuccess?: (data: string) => void) { + this.buildingBISrv.postSandBoxTemplate(name, id, data). + subscribe(data => { + console.log("保存单个模板" + id, data); + if (onSuccess) { + // onSuccess( JSON.parse((data as any).result)); + } + }, error => { + console.error("From serve:OneMarkTemplate", error); + }) + + } + + + //#endregion //#region 导出excel的信息 diff --git a/src/app/babylon/model/data/mark/mark-template-data.ts b/src/app/babylon/model/data/mark/mark-template-data.ts new file mode 100644 index 0000000..9e566d6 --- /dev/null +++ b/src/app/babylon/model/data/mark/mark-template-data.ts @@ -0,0 +1,9 @@ +import { MarkPlanData } from "./mark-plan-data"; + +/** + * 预案模板 + */ +export class MarkTemplate { + id: number; + name: string; +} \ No newline at end of file diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index 165f46c..49bb2b5 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -11,6 +11,7 @@ import { Event_MarkInfoChange, MarkInfoChangeType } from "../../controller/event import { InputController } from "../../controller/inputController"; import { ModeManager, ModeType } from "../../controller/mode-manager"; import { SceneManager } from "../../controller/scene-manager"; +import { ServeManager } from "../../controller/serve-manager"; import { BuildingStatus } from "../../controller/status/building-status"; import { IndoorStatus } from "../../controller/status/indoor-status"; import { StatusManager } from "../../controller/status/status-manager"; @@ -18,6 +19,7 @@ import { UIManager } from "../../controller/ui-manager"; import { ArcRotateCameraData } from "../../model/data/camera-data"; import { MarkData, MarkKindType, MarkTagPos, MarkType } from "../../model/data/mark/mark-data"; import { AllMarkPlanData, MarkNodeData, MarkPlanData, WeatherType, WindDirectionType, EnvironmentData, NatureData } from "../../model/data/mark/mark-plan-data"; +import { MarkTemplate } from "../../model/data/mark/mark-template-data"; import { ModelType } from "../../model/data/model-data/model-data"; import { FacilityType } from "../../model/data/model-data/model-data-facility"; import { BuildingInfo } from "../../model/info/building/building-info"; @@ -1329,11 +1331,11 @@ export class MarkWindow extends UIBase { let markData = environmentData.markDatas[i]; - if (markData.belongtoBuildingId == key) { - this.createMark(0, markData, false, null, buildingInfo, true, null, (modelInfo: ModelInfo_mark) => { - modelInfo.showFollowUI(instance.isShowProperty3d); - }); - } + //if (markData.belongtoBuildingId == key) { + this.createMark(0, markData, false, null, buildingInfo, true, null, (modelInfo: ModelInfo_mark) => { + modelInfo.showFollowUI(instance.isShowProperty3d); + }); + //} } this.shouWaterSource(this.isShowWaterSource); @@ -1581,5 +1583,53 @@ export class MarkWindow extends UIBase { //#endregion + //#region 应急模板 + + /** + * 所有应急模板 + */ + allSandBoxTemplate: MarkTemplate[]; + + /** + * 获取所有沙盒模板 + */ + getAllSandBoxTemplate() { + let instance = this; + this.allSandBoxTemplate = []; + ServeManager.instance.getAllMarkTemplate((data: string) => { + + }); + } + + /** + * 获取一个模板的详细内容 + * @param id + */ + getOneSandBoxTemplate(id: number) { + let instance = this; + ServeManager.instance.getOneMarkTemplate(id, (data: string) => { + + }) + + } + + /** + * 保存为模板 + * @param id + * @param name + * @param data + */ + saveToSandBoxTemplate(id: number, name: string, data: MarkPlanData) { + let instance = this; + ServeManager.instance.saveOneMarkTemplate(id, name, data, (data: string) => { + + }); + + } + + + + //#endregion + } diff --git a/src/app/service/babylon/building-basic-infos.service.ts b/src/app/service/babylon/building-basic-infos.service.ts index 47020e4..1ddf970 100644 --- a/src/app/service/babylon/building-basic-infos.service.ts +++ b/src/app/service/babylon/building-basic-infos.service.ts @@ -29,6 +29,17 @@ export class BuildingBasicInfosService { */ readonly api_excelData = "api/Services/3D/GasStationExcelData"; + /** + * 预案模板 + */ + readonly api_sandBoxTemplate = "api​/Services/3D/SandboxTemplate​"; + + /** + * 获取全部的预案模板 + */ + readonly api_sandBoxTemplateGetAll = "api​/Services/3D/SandboxTemplate​/GetAll"; + + /** * 获取三维信息 @@ -74,6 +85,38 @@ export class BuildingBasicInfosService { } + /** + * 获取沙盒模板 + * @param id + */ + getSandBoxTemplate(id: number) { + return this.getInfos(this.api_sandBoxTemplate, { "Id": id }); + } + + /** + * 获取所有沙盒模板 + * 较为特殊,所以没走统一的get封装 + * @param id + */ + getAllSandBoxTemplate() { + return this.http.get(this.api_sandBoxTemplateGetAll).pipe( + catchError((err) => this.handleError(err)) + ); + } + + /** + * 保存沙盒模板 + * @param name + * @param id + * @param data + */ + postSandBoxTemplate(name: string, id: number, data: object) { + return this.postInfos(this.api_sandBoxTemplate, data, { name: name, "Id": id }); + } + + + + //#region 通用封装,新增api时调用即可,不需关心具体组装规则。若修改规则,只需修改此通用封装 /** * get类api所需的固定内容