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AAIiD,EAAmBH,EAAKlC,UAAUC,SAAS,cAC/CiC,EAAKlC,UAAUC,SAAS,aAAcoC,EAAQ,GAAGjE,IACjDkB,QAAQC,IAAI,wBAAyBH,GACrC8C,EAAK9C,QAAUA,CACnB,GACJ,CAEAI,iCAAiCa,GAG7B,GAFNf,QAAQC,IAAI,iCACAE,KAAKhB,WAAW6D,mBAAmB7C,KAAKf,WAAWiC,YACpDN,EAAkBR,WAAc,OAE3C,IAAI0C,QAA4C9C,KAAKjB,IAAIkC,QAAQjB,KAAKf,WAAWiC,WAChFC,IAAI,0CAA0CnB,KAAKf,WAAWiC,wBAAwBN,EAAkBR,cACxGiB,aAGIrB,KAAK+C,mBAAmBD,GAKzBA,IACH9C,KAAKT,IAAuBuD,EAAeE,eAAgBzD,IAC3DS,KAAKO,UAAUC,SAAS,UAAWR,KAAKT,MANxCM,QAAQiB,KAAK,oEAQZ,CAIHiC,mBAAmBE,GAElB,GADApD,QAAQC,IAAI,2BACDQ,MAAP2C,EAAoB,OAAO,EAC/B,IAAKA,EAAID,eAAkB,OAAO,EAElC,MAAME,EAAeD,EAAID,eAAeE,MAExC,SAD0BA,GAASA,GAAS,EAAeC,YAE5D,CAEGpD,mBACFF,QAAQC,IAAI,mBACNE,KAAKX,OAAO2C,QAAQ,kCACxB,GAfK,EAAAmB,YAAqB,sBAjJ7B,GAAC,EAAAC,S,iEARWvE,EAAc,KAD1B,EAAAwE,W,uBAW6B,KAAgC,IAAiC,IAC5D,IAAmD,IAC9C,IAAgD,IACpD,EAAAC,KAbvBzE,E","sources":["webpack://client-app/./src/app/components/base-viewer-two-d/base-viewer-two-d.scss","webpack://client-app/./src/app/components/base-viewer-two-d/base-viewer-two-d.html","webpack://client-app/./src/app/components/base-viewer-two-d/base-viewer-two-d.ts"],"sourcesContent":["// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/sourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"#viewerContainer2d{width:100%;height:100%;position:relative;overflow:hidden}#viewerContainer2d svg{background-color:rgba(255,255,255,.8)}.switch-button{position:absolute;right:0;top:0;margin-top:8px;margin-right:5px}.bs-storey-select-container{width:fit-content !important}.bs-storey-select{width:fit-content !important}.bs-storey-select button{z-index:1;height:30.85px !important}.bs-dropup{width:fit-content}\", \"\",{\"version\":3,\"sources\":[\"webpack://./src/app/components/base-viewer-two-d/base-viewer-two-d.scss\"],\"names\":[],\"mappings\":\"AAAA,mBACC,UAAA,CACA,WAAA,CACG,iBAAA,CACA,eAAA,CACA,uBACI,qCAAA,CAKR,eACI,iBAAA,CACA,OAAA,CACA,KAAA,CACA,cAAA,CACA,gBAAA,CAKJ,4BACI,4BAAA,CAGJ,kBACI,4BAAA,CACA,yBACI,SAAA,CACA,yBAAA,CAKR,WACI,iBAAA\",\"sourcesContent\":[\"#viewerContainer2d {\\r\\n\\twidth: 100%;\\r\\n\\theight: 100%;\\r\\n position: relative;\\r\\n overflow: hidden;\\r\\n svg {\\r\\n background-color: rgba(255, 255, 255, 0.8); \\r\\n }\\r\\n \\r\\n}\\r\\n\\r\\n.switch-button {\\r\\n position: absolute;\\r\\n right:0;\\r\\n top:0;\\r\\n margin-top: 8px;\\r\\n margin-right: 5px;\\r\\n}\\r\\n\\r\\n//This styling is used to remove the invisible line making the dragging of the viewpoint not work in the bottom of the screen\\r\\n//This is catenda's own setup and if things get skewed it might be due to a change in Canteda's API.\\r\\n.bs-storey-select-container {\\r\\n width:fit-content !important;\\r\\n}\\r\\n\\r\\n.bs-storey-select {\\r\\n width:fit-content !important;\\r\\n button {\\r\\n z-index:1;\\r\\n height: 30.85px!important;\\r\\n }\\r\\n\\r\\n}\\r\\n\\r\\n.bs-dropup {\\r\\n width:fit-content;\\r\\n}\\r\\n\\r\\n// .bs-button {\\r\\n// \\tbackground-color: rgba(36, 42, 48,1) !important;\\r\\n// \\tcolor: white !important;\\r\\n// \\tborder-color: black !important;\\r\\n// \\ti {\\r\\n// \\t\\tcolor: white!important;\\r\\n// \\t}\\r\\n// span {\\r\\n// white-space: nowrap!important;\\r\\n// }\\r\\n// }\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","module.exports = \"\";","import { ViewerTokenDto } from \"app/models/viewer-dtos/Dtos/Bimsync/BimsyncDtos\";\r\nimport { ApiClient } from \"app/services/api-client\";\r\nimport { AppContextService } from \"app/services/app-context-service\";\r\nimport { BimViewerThreeDService } from \"app/services/bim-viewer-three-d-service\";\r\nimport { BimsyncClient } from \"app/services/bimsync-client\";\r\nimport { ContextMenuService } from \"app/services/context-menu-service\";\r\nimport { Catenda_ViewerObjectInfoService } from \"app/services/viewer-object-info-service/viewer-object-info-service\";\r\nimport {autoinject,bindable} from \"aurelia-framework\";\r\nimport {EventAggregator, Subscription} from \"aurelia-event-aggregator\";\r\nimport { FileAndRevisionDto, GetViewerResponse2d, Story } from \"app/project/work-area/split-viewer-interfaces\";\r\nimport { BimsyncSetupHandler } from \"app/services/bimsync-setup-handler\";\r\n\r\ndeclare let $: any;\r\ndeclare let bimsync: any;\r\ndeclare let ResizeObserver: any; //Is type ResizeObserver\r\n\r\n@autoinject\r\nexport class BaseViewerTwoD {\r\n private $viewer2d: any;\r\n public url: string = \"\";\r\n private subscriptions: Subscription[] = [];\r\n public max2dDockWidth: number = 600;\r\n public middlePanelWidth: number = -1;\r\n private modelId: string = \"\";\r\n\r\n\t@bindable useOpenbimViewer: boolean = false; //true;\r\n\r\n constructor(private api : ApiClient, private bimsyncApi : BimsyncClient, public appContext:AppContextService, \r\n public contextMenuService: ContextMenuService, public bimViewerThreeDService: BimViewerThreeDService, \r\n public viewerObjectInfoService: Catenda_ViewerObjectInfoService, public events: EventAggregator,\r\n public bimsyncSetupHandler: BimsyncSetupHandler\r\n\t) { \r\n\t\tconsole.log('TWOD_ctor');\r\n\t}\r\n \r\n async bind(): Promise {\r\n\t\tconsole.log('TWOD_bind');\r\n this.subscriptions = [\r\n this.events.subscribe(\"project-selector:project-changed\", async () => this.reload()),\r\n this.events.subscribe('viewer:enable-bindings-and-options', () => {\r\n //Ensuring viewers are setup before bindings are handled.\r\n\t\t\t\tconsole.log('calling CATENDA_setupViewerBindings_2d with rev:', this.loaded_fileAndRevisionId?.revisionId);\r\n this.CATENDA_setupViewerBindings_2d(this.loaded_fileAndRevisionId!);\r\n }),\r\n ]\r\n }\r\n\r\n async reload(): Promise {\r\n\t\tconsole.log('TWOD_reload');\r\n if (this.modelId != undefined) { this.$viewer2d.viewer2d('unloadModel', this.modelId); }\r\n await this.CATENDA_loadConnectedModel(this.loaded_fileAndRevisionId!);\r\n }\r\n\r\n async attached(): Promise {\r\n\t\tconsole.log('TWOD_attached');\r\n this.$viewer2d = this.catenda_getViewer2d();\r\n this.setupResizeObserver();\r\n\r\n\t\tconst fileAndRevisionId:FileAndRevisionDto = await this.INIT_ConnectedModelKeys(); // in attached.\r\n\t\tconsole.log('attached, this.useOpenbimViewer_2d?', this.useOpenbimViewer);\r\n\t\tif (this.useOpenbimViewer) {//-attached\r\n\t\t\tconsole.warn('sketch, init openbim-2d in attached');\r\n\t\t\tthis.openbim_load_BlobModel_WithSpaces_AlmostNOOP_2d(); \r\n\t\t} else {\r\n\t\t\tawait this.Init_CATENDA_ViewerFirst_or_subsequent_2d(fileAndRevisionId);\r\n\t\t}\r\n }\r\n\r\n\tprivate loaded_fileAndRevisionId:FileAndRevisionDto|undefined; // (We remember the model we load)\r\n\tasync INIT_ConnectedModelKeys():Promise {\r\n\t\tthis.loaded_fileAndRevisionId = await this.api.project(this.appContext.projectId)\r\n .get(`BimViewer/GetConnectedRevisionAndModel?aocProjectId=${this.appContext.projectId}`) //GetConnectedRevisionId\r\n .handleError('No model found', 'There is no connected model synchronized on this project.')\r\n .jsonResult();\r\n\t\treturn this.loaded_fileAndRevisionId!;\r\n\t}\r\n\r\n\tasync Init_CATENDA_ViewerFirst_or_subsequent_2d(fileAndRevisionId: FileAndRevisionDto) {\r\n if (!this.bimsyncSetupHandler.isBimsync_ENGINES_Setup) {\r\n await this.CATENDA_loadTwoDViewer();\r\n } else {\r\n await this.CATENDA_setupViewerBindings_2d(fileAndRevisionId);\r\n }\r\n\t}\r\n\t\r\n\topenbim_load_BlobModel_WithSpaces_AlmostNOOP_2d() {\r\n\t\t// doesn't do anything yet (mostly loadSpaces and emit events; the actual loading happens when prop is set on bound key on openbim-container)\r\n\t}\r\n\r\n async CATENDA_loadTwoDViewer(): Promise {\r\n\t\tconsole.log('TWOD_loadTwoDViewer');\r\n try {\r\n this.bimsyncSetupHandler.loadViewer2d();\r\n } catch(e) {\r\n //Can fail on bimsync, if Catenda API is down.\r\n console.warn(\"the 3D viewer could not be loaded.\");\r\n }\r\n }\r\n\r\n\r\n setupResizeObserver(): void {\r\n\t\tconsole.log('TWOD_setupResizeObserver');\r\n let observer = new ResizeObserver((entries: any) => {\r\n //The only resize we care about is the panel-middle as that is dependent on how the 2d view should be displayed.\r\n for (let entry of entries) {\r\n const cr = entry.contentRect;\r\n this.middlePanelWidth = cr.width;\r\n if (cr.width < this.max2dDockWidth && cr.width > 0) {\r\n this.events.publish('WorkAreaContainer:Move2d', true);\r\n }\r\n }\r\n });\r\n observer.observe(document.getElementById(\"base-viewer-container\"));\r\n }\r\n\r\n async unbind(): Promise {\r\n\t\tconsole.log('TWOD_unbind');\r\n this.subscriptions.forEach(subscription => subscription.dispose());\r\n }\r\n\r\n catenda_getViewer2d(): void { return $(\"#viewerContainer2d\"); }\r\n\r\n async CATENDA_setupViewerBindings_2d(fileAndRevisionId: FileAndRevisionDto): Promise {\r\n\t\tconsole.log('TWOD_setupViewerBindings');\r\n //As the bimsync variable is global, this will not have to be reloaded \r\n //When switching between menu pages, but the bindings/options/viewer-ui\r\n //will have to be setup again.\r\n //And if nothing is setup, bimsync has to be intialized first, which\r\n //is why it is handled using an event.\r\n this.catenda_handle2dviewerLoaded();\r\n await this.CATENDA_loadConnectedModel(fileAndRevisionId);\r\n }\r\n\r\n catenda_handle2dviewerLoaded(): void {\r\n\t\tconsole.log('TWOD_handle2dviewerLoaded');\r\n let self = this;\r\n this.$viewer2d.bind('viewer2d.loadfail', async function(event: Event, modelId: string) {\r\n console.log(\"Failed event \" , event);\r\n console.log(\"Viewer2D model load failed\", modelId);\r\n $('#viewerContainer2d').viewer2d('unloadModel', modelId);\r\n });\r\n this.$viewer2d.bind('viewer2d.load', function(event: Event, modelId: string) {\r\n let storeys: Story[] = self.$viewer2d.viewer2d('getStoreys');\r\n self.$viewer2d.viewer2d('showStorey', storeys[0].id);\r\n console.log(\"Viewer2D model loaded\", modelId);\r\n self.modelId = modelId;\r\n });\r\n }\r\n\r\n async CATENDA_loadConnectedModel(fileAndRevisionId: FileAndRevisionDto) {\r\n\t\tconsole.log('TWOD_loadConnectedModel');\r\n await this.bimsyncApi.setTokenAndProject(this.appContext.projectId);\r\n if (!fileAndRevisionId.revisionId) { return; }\r\n\r\n\t\tlet viewerTokenDTO: GetViewerResponse2d = await this.api.project(this.appContext.projectId)\r\n\t\t.get(`BimsyncViewer/GetViewer2d?aocProjectId=${this.appContext.projectId}&revisionId=${fileAndRevisionId.revisionId}`)\r\n\t\t.jsonResult();\r\n\r\n\t\t//console.log(\"2d VIEWERTOKEN \" , viewerTokenDTO);\r\n\t\tif (!this.hasCatenda_2dToken(viewerTokenDTO)) { \r\n\t\t\tconsole.warn('(no catenda 2d token, so not proceeding with catenda-viewer-init)')\r\n\t\t\treturn; \r\n\t\t}\r\n\r\n\t\tif (viewerTokenDTO) {\r\n\t\t\tthis.url = (viewerTokenDTO.viewerTokenDto).url;\r\n\t\t\tthis.$viewer2d.viewer2d('loadUrl', this.url);\r\n\t\t}\r\n }\r\n\r\n\tstatic EMPTY_TOKEN:string = \"EMPTY_TOKEN_OPENBIM\";\r\n\r\n\thasCatenda_2dToken(dto: GetViewerResponse2d):boolean {\r\n\t\tconsole.log('TWOD_hasCatenda_2dToken');\r\n\t\tif (dto == undefined) { return false; } // (for IsCatendaEnabled==false case.)\r\n\t\tif (!dto.viewerTokenDto) { return false; }\r\n\t\t\r\n\t\tconst token:string = dto.viewerTokenDto.token;\r\n\t\tconst noToken:boolean = (!token || token == BaseViewerTwoD.EMPTY_TOKEN);\r\n\t\treturn !noToken; \r\n\t}\r\n\r\n async move2dView() {\r\n\t\tconsole.log('TWOD_move2dView');\r\n this.events.publish('base-viewer-combined:move2dView');\r\n }\r\n}\r\n"],"names":["___CSS_LOADER_EXPORT___","push","module","id","exports","BaseViewerTwoD","constructor","api","bimsyncApi","appContext","contextMenuService","bimViewerThreeDService","viewerObjectInfoService","events","bimsyncSetupHandler","url","subscriptions","max2dDockWidth","middlePanelWidth","modelId","useOpenbimViewer","console","log","async","this","subscribe","reload","loaded_fileAndRevisionId","revisionId","CATENDA_setupViewerBindings_2d","undefined","$viewer2d","viewer2d","CATENDA_loadConnectedModel","catenda_getViewer2d","setupResizeObserver","fileAndRevisionId","INIT_ConnectedModelKeys","warn","openbim_load_BlobModel_WithSpaces_AlmostNOOP_2d","Init_CATENDA_ViewerFirst_or_subsequent_2d","project","projectId","get","handleError","jsonResult","isBimsync_ENGINES_Setup","CATENDA_loadTwoDViewer","loadViewer2d","e","ResizeObserver","entries","entry","cr","contentRect","width","publish","observe","document","getElementById","forEach","subscription","dispose","$","catenda_handle2dviewerLoaded","self","bind","event","storeys","setTokenAndProject","viewerTokenDTO","hasCatenda_2dToken","viewerTokenDto","dto","token","EMPTY_TOKEN","bindable","autoinject","B"],"sourceRoot":""}