\\r\\n\\r\\n\\t\\r\\n\\t\\r\\n\\r\\n\\r\\n\";","module.exports = \"\\r\\n \\r\\n \\r\\n \\r\\n\";","import Split from \"split.js\";\r\nimport { autoinject,bindable } from 'aurelia-framework';\r\n\r\nimport {EventAggregator, Subscription} from \"aurelia-event-aggregator\";\r\nimport { Three_Sel } from \"../base-viewer-three-d/Three_Sel\";\r\n//import { Three_Sel } from \"app/project/quantity-takeoff/takeoff-viewer/takeoff-viewer\";\r\n\r\n@autoinject\r\nexport class BaseViewerCombined {\r\n\t@bindable threeSel:Three_Sel|undefined;\r\n\r\n\ttwoD_enabled:boolean = true;\r\n\r\n\t// (Note that we are NOT setting the @bindable decorator on this one.)\r\n\tBVC_openBimMode:boolean = true; // This is ONLY used in viewer-menu.html (we might even move it there.)\r\n\r\n\tpublic static useMPKFragments_Master:boolean = true; //false;\r\n\r\n private isViewerLoaded:boolean = false;\r\n private isSettingsVisible:boolean = false;\r\n\r\n private split: Split.Instance | undefined;\r\n private subscriptions: Subscription[] = [];\r\n\r\n\tprivate self:BaseViewerCombined;\r\n\r\n constructor(public events: EventAggregator) { this.self = this; }\r\n\r\n bind() {\r\n\t\tconsole.log('BaseViewerCombined.bind');\r\n this.subscriptions = [\r\n this.events.subscribe('WorkAreaContainer:ViewerSettingsPressed', () => { this.switchSettingsVisibility()}),\r\n this.events.subscribe('WorkAreaContainer:Move2d', () => { this.move2dViewDown()}),\r\n this.events.subscribe('base-viewer-combined:move2dView', () => { this.move2dView('event:_base-viewer-combined:move2dView',this.twoD_enabled)}),\r\n this.events.subscribe('base-viewer-combined:hide2d', () => { this.hide2dView()}),\r\n ]\r\n }\r\n\r\n hide2dView() { // a misguided? experiment.\r\n\t\tconsole.log('BaseViewerCombined.hide2dView, will now try to hide the 2d view. - twoD_enabled');\r\n\t\tthis.twoD_enabled = false;\r\n\r\n\t\t// Ser ikke ud til at virke.. is tied to concrete splitter IDs.\r\n\t\t//this.splitViewerResizeService.hide2dView();\t\t\r\n\r\n let smalldiv_2d: HTMLElement | null = document.getElementById('small-2d-view');\r\n let viewer_2d: HTMLElement | null = document.getElementById('viewer2d');\r\n if (!smalldiv_2d || !viewer_2d) { \r\n\t\t\tconsole.log('(nothing to hide)'); //'missing either', smalldiv_2d, viewer_2d)\r\n\t\t\treturn; \r\n\t\t} // can this work?\r\n\r\n\t\tconst is_viewerInSmallDiv:boolean = (smalldiv_2d.contains(viewer_2d));\r\n\t\tconsole.warn('was 2dviewer in smallDiv?', is_viewerInSmallDiv);\r\n\r\n if (!is_viewerInSmallDiv) { // ONLY do this, IFF viewer is NOT ALREADY a child of smallDiv!\r\n smalldiv_2d.style.visibility = \"none\"; // why not collapse?\r\n this.split?.setSizes([100,0]); \r\n console.log(`does split exist? [${this.split}]`,this.split );\r\n this.split?.destroy(); // her doer den for thomas. den bliver sur over, at den gutter den vil removeChild for ikke er i den forventede parent, eller omvendt.\r\n smalldiv_2d.appendChild(viewer_2d); // jeg har byttet om her, for at se om det hjaelper.\r\n // function destroy(preserveStyles, preserveGutter) \r\n }\r\n\r\n\t\t// both of these cause damage now - it refuses to resize..\r\n\t\t//this.move2dView('at end of hide2dView', true); //this.twoD_enabled);\r\n\t\t//this.move2dViewDown();//'at end of hide2dView'); // gav problemer\r\n\t\twindow.dispatchEvent(new Event('resize')); // THIS hack seems to work\r\n\t\tconsole.log('end of hide2dView');\r\n\t}\r\n\r\n move2dView(who:string, twoD_enabled:boolean) {\r\n let viewer_2d: HTMLElement | null = document.getElementById('viewer2d');\r\n let topView_3d: HTMLElement | null = document.getElementById('three-d-top');\r\n let bigDiv_2d: HTMLElement | null = document.getElementById('two-d-bottom');\r\n let smalldiv_2d: HTMLElement | null = document.getElementById('small-2d-view');\r\n\r\n\t\tconsole.log('BaseViewerCombined.move2dView, who:', who, 'twoD_enabled?', this.twoD_enabled, !!viewer_2d, !!topView_3d, !!bigDiv_2d, !!smalldiv_2d);\r\n\t\t//if (!this.twoD_enabled) { return; }\r\n\t\tif (!twoD_enabled) { return; }\r\n\r\n if (!smalldiv_2d || !viewer_2d || !bigDiv_2d) { return; } // (bah, forget about the resize-event below then.)\r\n\r\n\t\tif (smalldiv_2d.contains(viewer_2d)) {\r\n\t\t\tconsole.log('move2dView triggers handleDockTooBigDiv');\r\n\t\t\tthis.handleDockTooBigDiv(bigDiv_2d,viewer_2d,smalldiv_2d);\r\n\t\t} else { // (viewer_2d NOT currently in the smalldiv_2d)\r\n\t\t\tconsole.log('move2dView triggers destroySplit');\r\n\t\t\t// Make viewer_2d an inset overlayed on viewer3d, and let viewer3d take over all:\r\n\t\t\tsmalldiv_2d.style.visibility = \"visible\";\r\n\t\t\tsmalldiv_2d.appendChild(viewer_2d);\r\n\t\t\tthis.split?.setSizes([100,0]); \r\n\t\t\tthis.split?.destroy();\r\n\t\t} \r\n\r\n window.dispatchEvent(new Event('resize')); // hmm, why does that make sense, what does it do?\r\n }\r\n\r\n handleDockTooBigDiv(bigDiv: HTMLElement,viewer: HTMLElement,smalldiv: HTMLElement) {\r\n\t\tconsole.log('BaseViewerCombined.handleDockTooBigDiv');\r\n this.setupSplitter();\r\n bigDiv.appendChild(viewer);\r\n smalldiv.style.visibility = \"hidden\";\r\n this.split?.setSizes([50,50]); \r\n }\r\n\r\n move2dViewDown() {\r\n let viewer2d: HTMLElement | null = document.getElementById('viewer2d');\r\n let bigDiv: HTMLElement | null = document.getElementById('two-d-bottom');\r\n let smalldiv: HTMLElement | null = document.getElementById('small-2d-view');\r\n\r\n\t\tconst contains:boolean = !!(smalldiv && smalldiv.contains(viewer2d));\r\n if (smalldiv) {\r\n if (contains && bigDiv && viewer2d) {\r\n this.handleDockTooBigDiv(bigDiv,viewer2d,smalldiv);\r\n window.dispatchEvent(new Event('resize'));\r\n }\r\n }\r\n\t\t\r\n\t\t// console.log('BaseViewerCombined.move2dViewDown, (smalldiv,contain,big,2d):', !!smalldiv, contains, !!bigDiv, !!viewer2d);\r\n }\r\n\r\n unbind() {\r\n\t\tconsole.log('BaseViewerCombined.unbind');\r\n this.subscriptions.forEach(subscription => subscription.dispose());\r\n }\r\n\r\n async attached() {\r\n console.log('base-viewer-combined:attached');\r\n await this.setupSplitter();\r\n this.move2dView('attached',this.twoD_enabled); //In quantity-takeoff it was wanted to start with the 2d-view docked to the 3d-view.\r\n }\r\n\r\n async switchSettingsVisibility() {\r\n\t\tconsole.log('BaseViewerCombined.switchSettingsVisibility');\r\n this.isViewerLoaded = true;\r\n this.isSettingsVisible = !this.isSettingsVisible;\r\n }\r\n\r\n async setupSplitter(): Promise {\r\n\t\tconsole.log('BaseViewerCombined.setupSplitter');\r\n\r\n if (document.getElementById('three-d-top') == null || document.getElementById('two-d-bottom') == null) { return; }\r\n\r\n\t\tthis.split = Split(['#three-d-top','#two-d-bottom'], {\r\n\t\t\tminSize: 0,\r\n\t\t\tgutterSize: 13,\r\n\t\t\tdirection: 'vertical',\r\n\t\t\tonDrag: function (sizes: any) {\r\n\t\t\t\twindow.dispatchEvent(new Event('resize'));\r\n\t\t\t},\r\n\t\t\tsizes:[50,50]\r\n\t\t});\r\n \r\n }\r\n \r\n}\r\n","import { OpenBimHandles } from \"app/project/ifc-fun/OpenBimHandles\";\r\nimport {collectIDsFromMap, selectionHighlightName} from \"app/project/ifc-fun/openbim-highlighter\";\r\nimport * as OBC from \"openbim-components\"; \r\n\r\nexport declare let $: any;\r\n\r\nexport class Three_Sel {\r\n\t// isolates the aspect regarding selection, for baseviewer3d and friends.\r\n\t// contains variants for the current OpenBim impl, and for the earlier Catenda impl.\r\n\t\r\n\tOB: OpenBimHandles | undefined;\r\n\r\n\t//hello() { console.log('Three_Sel says hello'); }\r\n\r\n\t/////////////////////////////////////////////////////////////////////\r\n\tgetSelectedObjectIDs(objectIDs: number[]) {\r\n\t\tif (this.OB) {\r\n\t\t\tthis.openBim_getObjectIDs(objectIDs);\r\n\t\t} else {\r\n\t\t\tthis.catenda_getObjectIDs(objectIDs);\r\n\t\t}\r\n\t}\r\n\tcatenda_getObjectIDs(objectIDs: number[]) {\r\n\t\t$('#viewerContainer3d').viewer('eachSelected', function (id: number) { objectIDs.push(id); });\r\n\t} // presumably this is not async?\r\n\r\n\topenBim_getObjectIDs(objectIDs: number[]) {\r\n\t\tconst realSel:OBC.FragmentIdMap = this.OB!.highlighter!.selection[selectionHighlightName];\r\n\t\tconst asArray = collectIDsFromMap(realSel);\r\n\t\t//return this.catenda_getObjectIDs(objectIDs);\r\n\t\tfor (let bob of asArray) {\r\n\t\t\tobjectIDs.push(bob); // what is the best way to do this in typescript.\r\n\t\t}\r\n\t\tconsole.log('treeSel.objectIDs, now:', objectIDs.length);\r\n\t}\r\n\t/////////////////////////////////////////////////////////\r\n\r\n\tdeselectAll() { this.OB ? this.openBim_deselectAll() : this.catenda_deselectAll(); }\r\n\tcatenda_deselectAll() {\t$('#viewerContainer3d').viewer('deselectAll'); }\r\n\topenBim_deselectAll() { this.OB!.highlighter!.clear(); }\r\n}\r\n","import { ApiClient } from \"app/services/api-client\";\r\nimport { AppContextService } from \"app/services/app-context-service\";\r\nimport { ContextMenuService } from \"app/services/context-menu-service\";\r\nimport {autoinject,bindable} from \"aurelia-framework\";\r\nimport {EventAggregator, Subscription} from \"aurelia-event-aggregator\";\r\nimport { FileAndRevisionDto } from \"app/project/work-area/split-viewer-interfaces\";\r\nimport { ColorLegendService } from \"app/services/color-legend/color-legend-service\";\r\nimport { OpenBimHandles } from \"app/project/ifc-fun/OpenBimHandles\";\r\nimport { Three_Sel } from \"./Three_Sel\";\r\n//import { Three_Sel } from \"app/project/quantity-takeoff/takeoff-viewer/takeoff-viewer\";\r\n\r\n@autoinject\r\nexport class BaseViewerThreeD {\r\n\t@bindable threeSel:Three_Sel|undefined;\r\n\t@bindable initialOpenbimFlag:boolean = true; // used to INIT useOpenbimViewer.\r\n\r\n\t// (bool useOpenbimViewer styrer, om HTML for bv3d viser openbim-container, eller catenda-div.)\r\n\tpublic useOpenbimViewer:boolean = true; // only becomes correct at/after BV3d.BIND!, when we have an init value to transfer!\r\n\r\n\tpublic openBimHandles:OpenBimHandles = new OpenBimHandles();\r\n\r\n private subscriptions: Subscription[] = [];\r\n private viewerNotLoaded: boolean = false;\r\n private spacesLoaded: boolean = false;\r\n\tprivate spacesLoaded_inf:string = '?';\r\n private isModelLoaded: boolean = false;\r\n private lastClickedElementName: string | undefined;\r\n\r\n\tprivate loaded_fileAndRevisionId:FileAndRevisionDto|undefined; // (We remember the model we load)\r\n\t\r\n\tinit_useOpenbimViewer(who:string) { \r\n\t\tconsole.log(`(${who}) will init useOpenbimViewer to:`, this.initialOpenbimFlag, ' from this.initialOpenbimFlag');\r\n\t}\r\n\r\n constructor(private api : ApiClient, public appContext:AppContextService, \r\n public contextMenuService: ContextMenuService,\r\n\t\tpublic events: EventAggregator,\r\n private colorLegendService: ColorLegendService\r\n\t) {\r\n\t}\r\n \r\n async bind(): Promise {\r\n\t\tconsole.log('bv3d.bind');\r\n\t\t\r\n\t\tthis.init_useOpenbimViewer('bv3d.bind');\r\n\r\n this.subscriptions = [\r\n this.events.subscribe(\"project-selector:project-changed\", async () => this.reload()),\r\n this.events.subscribe('takeoff-reconvert-fragment', () => { this.reconvertFragment()}),\r\n ]\r\n }\r\n\t\r\n\torgId_bv3:string = '?';\r\n\tfileId_forBind:string = ''; // JG: These MUST init to empty, to avoid dependent components attempting to init/load based on them!\r\n\trevisionId_forBind:string = ''; // JG: These MUST init to empty, to avoid dependent components attempting to init/load based on them!\r\n\r\n async attached(): Promise {\r\n\t\tconsole.log('bv3d.attached, appCtx.prjId:', this.appContext.projectId);\r\n\t\tconst prj = this.appContext.getSelectedProject();\r\n\t\tif (prj) { this.orgId_bv3 = prj.ownerCompanyId; }\r\n\r\n\t\tconst fileAndRevisionId = await this.INIT_ConnectedModelKeys(); // maybe this is a better place to call it..\r\n\t\tconsole.log('in bv3d.attached, INIT_ConnectedModelKeys got:', fileAndRevisionId);\r\n\t\t\r\n\t\tthis.loadBlobModelWithSpaces_AlmostNOOP();\r\n }\r\n\t\r\n\tasync reconvertFragment() {\r\n\t\tconsole.log('baseViewerThreeD.reconvertFragment');\r\n\t\tconst prj = this.appContext.projectId;\r\n\t\tconst rev = this.loaded_fileAndRevisionId?.revisionId;\r\n\t\tconst user = this.appContext.currentUser!.id;\r\n\t\t\r\n\t\tlet path:string \r\n\t\t = `IfcFragment/EnqueueRevisionToFragmentJobAnonymous?revisionId=${rev}&projectId=${prj}&userId=${user}`;\r\n\r\n\t\tconst result = await this.api.project(prj).postJson(path,{}).jsonResult();\r\n\t\tconsole.log('result:', result);\r\n\t}\r\n\t\r\n async reload(): Promise {\r\n await this.loadConnectedModel_Somehow(this.loaded_fileAndRevisionId!);//in-reload\r\n }\r\n\r\n async unbind(): Promise {\r\n this.subscriptions.forEach(subscription => subscription.dispose());\r\n }\r\n\t\r\n\tasync INIT_ConnectedModelKeys():Promise {\r\n\t\tconsole.log('bv3d.INIT_ConnectedModelKeys, gotten orgToken..');\r\n\r\n let fileAndRevisionId:FileAndRevisionDto|undefined = 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\t\t\r\n\t\tconsole.log('bv3d.INIT_ConnectedModelKeys, got:', fileAndRevisionId);\r\n\r\n\t\tthis.loaded_fileAndRevisionId = fileAndRevisionId;\r\n\t\t\r\n\t\tif (fileAndRevisionId==undefined) { // The abnormal case.\r\n\t\t\tconsole.warn('INIT_ConnectedModelKeys, setting revisionId_forBind to EMPTY string, as no fileAndRevisionId found.');\r\n\t\t\tthis.fileId_forBind = '';\r\n\t\t\tthis.revisionId_forBind = '';\r\n\t\t} else {\r\n\t\t\tthis.fileId_forBind = fileAndRevisionId.fileId; // set in INIT_ConnectedModelKeys\r\n\t\t\tconsole.log('bv3d, op-c, revId changed to:', fileAndRevisionId.revisionId);\r\n\t\t\tthis.revisionId_forBind = fileAndRevisionId.revisionId;\t\r\n\t\t}\r\n\r\n\t\treturn fileAndRevisionId;\r\n\t}\r\n\r\n\t// also called from setupViewerBindings_AND_LoadModel, which is triggered by by viewer:enable-bindings-and-options.\r\n async loadConnectedModel_Somehow(fileAndRevisionId:FileAndRevisionDto) {\r\n\t\tconsole.log('XYQ second_LoadSomehow called with fileId', fileAndRevisionId.fileId, 'this.useOpenbimViewer?', this.useOpenbimViewer);\r\n\t\tif (!fileAndRevisionId?.revisionId) { \r\n\t\t\tconsole.log('second_Load_MODEL_Somehow aborts as empty rev-IDs:', fileAndRevisionId);\r\n\t\t\treturn; \r\n\t\t}\r\n\t\tconsole.log('SETTING_SPACES_LOADED-LRMS', this.spacesLoaded_inf);\r\n\t\t\r\n\t\tthis.loadBlobModelWithSpaces_AlmostNOOP();\r\n }\r\n\r\n\tloadBlobModelWithSpaces_AlmostNOOP() { // beware, this is almost a NOOP at this point - it is the assign to the bound revisionId, that triggers the OB-load.\r\n\t\tconsole.warn('openbim_load_BlobModel_WithSpaces');\r\n\r\n\t\tconsole.log('(nb, openbim_load_ConnectedModel doesnt yet do anything for spaces.)');\r\n\t\t//this.spacesLoaded = false;this.spacesLoaded_inf='2';//openbim_load_ConnectedModel\r\n\t\t//console.log('SETTING_SPACES_LOADED-OBLCM', this.spacesLoaded_inf);\t\t\r\n\r\n\t\tconsole.log('SETTING_SPACES_LOADED-STOBVFR', this.spacesLoaded_inf);\r\n\r\n\t\tconsole.log('openbim_load_BlobModel_WithSpaces publishes hide2dView for twoD_enabled')\r\n this.events.publish('base-viewer-combined:hide2d'); // for now, we don't want the 2d-view, when using openBim - because we haven't made the code for it yet.\r\n\r\n\t\tthis.spacesLoaded = true; // Just to hide the loading bar\r\n\t\t\r\n\t\t// hmm, we probably have to publish an event anyway, to tell openbim-container to act?\r\n\t\t//if (false) { // right now it auto-magic-random-loads-by-accident, so we don't do this yet..\r\n\t\t// let self = this; // hmm, hvorfor var den n'dv?\r\n\t\t//\tself.events.publish('base-viewer-combined:loadRevision',{fileAndRevisionId: fileAndRevisionId});\t\r\n\t\t//}\r\n\t}\r\n}\r\n\r\n\r\n\r\n\r\n","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 { ContextMenuService } from \"app/services/context-menu-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\nimport {Catenda_ViewerObjectInfoService} from \"../../services/viewer-object-info-service/catenda-viewer-object-info-service\";\r\n\r\ndeclare let $: 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, 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 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","BaseViewerCombined","constructor","events","twoD_enabled","BVC_openBimMode","isViewerLoaded","isSettingsVisible","subscriptions","this","self","bind","console","log","subscribe","switchSettingsVisibility","move2dViewDown","move2dView","hide2dView","smalldiv_2d","document","getElementById","viewer_2d","is_viewerInSmallDiv","contains","warn","style","visibility","split","setSizes","destroy","appendChild","window","dispatchEvent","Event","who","topView_3d","bigDiv_2d","handleDockTooBigDiv","bigDiv","viewer","smalldiv","setupSplitter","viewer2d","unbind","forEach","subscription","dispose","attached","minSize","gutterSize","direction","onDrag","sizes","useMPKFragments_Master","bindable","autoinject","EventAggregator","Three_Sel","getSelectedObjectIDs","objectIDs","OB","openBim_getObjectIDs","catenda_getObjectIDs","$","realSel","highlighter","selection","asArray","bob","length","deselectAll","openBim_deselectAll","catenda_deselectAll","clear","BaseViewerThreeD","init_useOpenbimViewer","initialOpenbimFlag","api","appContext","contextMenuService","colorLegendService","useOpenbimViewer","openBimHandles","viewerNotLoaded","spacesLoaded","spacesLoaded_inf","isModelLoaded","orgId_bv3","fileId_forBind","revisionId_forBind","async","reload","reconvertFragment","projectId","prj","getSelectedProject","ownerCompanyId","fileAndRevisionId","INIT_ConnectedModelKeys","loadBlobModelWithSpaces_AlmostNOOP","path","loaded_fileAndRevisionId","revisionId","currentUser","result","project","postJson","jsonResult","loadConnectedModel_Somehow","get","handleError","undefined","fileId","publish","BaseViewerTwoD","bimViewerThreeDService","viewerObjectInfoService","bimsyncSetupHandler","url","max2dDockWidth","middlePanelWidth","modelId","CATENDA_setupViewerBindings_2d","$viewer2d","CATENDA_loadConnectedModel","catenda_getViewer2d","setupResizeObserver","openbim_load_BlobModel_WithSpaces_AlmostNOOP_2d","Init_CATENDA_ViewerFirst_or_subsequent_2d","isBimsync_ENGINES_Setup","CATENDA_loadTwoDViewer","loadViewer2d","e","ResizeObserver","entries","entry","cr","contentRect","width","observe","catenda_handle2dviewerLoaded","event","storeys","viewerTokenDTO","hasCatenda_2dToken","viewerTokenDto","dto","token","EMPTY_TOKEN"],"sourceRoot":""}