@vitrosoftware/common-ui-ts 1.1.109 → 1.1.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/std/controls/bim-viewer/bim-viewer-index.css +368 -0
- package/css/std/controls/bim-viewer/bim-viewer.css +368 -0
- package/css/std/controls/bim-viewer/img/all-windows.svg +6 -0
- package/css/std/controls/bim-viewer/img/cancel-white.svg +1 -0
- package/css/std/controls/bim-viewer/img/collapse-bottom-blue.svg +1 -0
- package/css/std/controls/bim-viewer/img/collapse-bottom.svg +1 -0
- package/css/std/controls/bim-viewer/img/compare-dlg-separator.svg +1 -0
- package/css/std/controls/bim-viewer/img/hide.svg +4 -0
- package/css/std/controls/bim-viewer/img/maximize.svg +6 -0
- package/css/std/controls/bim-viewer/img/options.svg +4 -0
- package/dist/index.js +1 -1
- package/lib/third-party.js +0 -17986
- package/package.json +1 -1
- package/src/controls/BimViewer/js/bim-viewer-models.js +8 -5
- package/src/controls/BimViewer/js/bim-viewer.js +375 -32
- package/src/controls/PdfViewer/js/pdf-viewer.js +17985 -1
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
{
|
|
3
3
|
FileItemId: undefined,
|
|
4
4
|
FileVersion: undefined,
|
|
5
|
+
FileCompareVersion: undefined,
|
|
5
6
|
|
|
6
7
|
GetFileItem: function (itemId, version, callback, error) {
|
|
7
8
|
var webRelativeUrl = BIMCommon.CreateWebServerUrl();
|
|
@@ -333,14 +334,16 @@
|
|
|
333
334
|
|
|
334
335
|
var webRelativeUrl = BIMCommon.CreateWebServerUrl();
|
|
335
336
|
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
var paramObj = {};
|
|
338
|
+
paramObj.itemId = BIMCommon.FileItemId;
|
|
339
|
+
paramObj.version = BIMCommon.FileVersion;
|
|
340
|
+
paramObj.comparedVersion = BIMCommon.FileCompareVersion;
|
|
341
|
+
|
|
342
|
+
var jsonString = JSON.stringify(paramObj);
|
|
340
343
|
|
|
341
344
|
$.ajax({
|
|
342
345
|
type: "POST",
|
|
343
|
-
url: webRelativeUrl + "/
|
|
346
|
+
url: webRelativeUrl + "/bimViewer/api/ModelElement/Compare",
|
|
344
347
|
data: jsonString,
|
|
345
348
|
contentType: "application/json; charset=utf-8",
|
|
346
349
|
dataType: "json",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js?version=1.1.
|
|
1
|
+
import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js?version=1.1.111';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Viewer, XKTLoaderPlugin, NavCubePlugin, SectionPlanesPlugin, math, BCFViewpointsPlugin, AnnotationsPlugin,
|
|
5
5
|
ContextMenu, TreeViewPlugin, StoreyViewsPlugin, AngleMeasurementsPlugin, CameraMemento, DistanceMeasurementsPlugin,
|
|
6
6
|
GLTFLoaderPlugin, utils, FastNavPlugin, MetaObject
|
|
7
7
|
}
|
|
8
|
-
from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=1.1.
|
|
8
|
+
from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=1.1.111';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
const processByChildIdList = (treeViewNode, event) => {
|
|
@@ -623,7 +623,9 @@ class VitroTreeViewPlugin extends TreeViewPlugin
|
|
|
623
623
|
switchElement.addEventListener('click', this._switchCollapseHandler);
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
|
|
626
|
+
|
|
627
|
+
/*! jquery-dialogextend 2.0.3 2014-07-08 */
|
|
628
|
+
(function(){var i;i=jQuery,i.widget("ui.dialogExtend",{version:"2.0.0",modes:{},options:{closable:!0,dblclick:!1,titlebar:!1,icons:{close:"ui-icon-closethick",restore:"ui-icon-newwin"},load:null,beforeRestore:null,restore:null},_create:function(){return this._state="normal",i(this.element[0]).data("ui-dialog")||i.error("jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted"),this._verifyOptions(),this._initStyles(),this._initButtons(),this._initTitleBar(),this._setState("normal"),this._on("load",function(i){return console.log("test",i)}),this._trigger("load")},_setState:function(t){return i(this.element[0]).removeClass("ui-dialog-"+this._state).addClass("ui-dialog-"+t),this._state=t},_verifyOptions:function(){var t,e,o;!this.options.dblclick||this.options.dblclick in this.modes||(i.error("jQuery.dialogExtend Error : Invalid <dblclick> value '"+this.options.dblclick+"'"),this.options.dblclick=!1),this.options.titlebar&&"none"!==(e=this.options.titlebar)&&"transparent"!==e&&(i.error("jQuery.dialogExtend Error : Invalid <titlebar> value '"+this.options.titlebar+"'"),this.options.titlebar=!1),o=[];for(t in this.modes)this["_verifyOptions_"+t]?o.push(this["_verifyOptions_"+t]()):o.push(void 0);return o},_initStyles:function(){var t,e,o;i(".dialog-extend-css").length||(e="",e+='<style class="dialog-extend-css" type="text/css">',e+=".ui-dialog .ui-dialog-titlebar-buttonpane>a { float: right; }",e+=".ui-dialog .ui-dialog-titlebar-restore { width: 19px; height: 18px; }",e+=".ui-dialog .ui-dialog-titlebar-restore span { display: block; margin: 1px; }",e+=".ui-dialog .ui-dialog-titlebar-restore:hover,",e+=".ui-dialog .ui-dialog-titlebar-restore:focus { padding: 0; }",e+=".ui-dialog .ui-dialog-titlebar ::selection { background-color: transparent; }",e+="</style>",i(e).appendTo("body")),o=[];for(t in this.modes)o.push(this["_initStyles_"+t]());return o},_initButtons:function(){var t,e,o,n,a,l=this;n=i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar"),t=i('<div class="ui-dialog-titlebar-buttonpane"></div>').appendTo(n),t.css({position:"absolute",top:"50%",right:"0.3em","margin-top":"-10px",height:"18px"}),n.find(".ui-dialog-titlebar-close").css({position:"relative","float":"right",top:"auto",right:"auto",margin:0}).find(".ui-icon").removeClass("ui-icon-closethick").addClass(this.options.icons.close).end().appendTo(t).end(),t.append('<a class="ui-dialog-titlebar-restore ui-corner-all ui-state-default" href="#"><span class="ui-icon '+this.options.icons.restore+'" title="restore">restore</span></a>').find(".ui-dialog-titlebar-restore").attr("role","button").mouseover(function(){return i(this).addClass("ui-state-hover")}).mouseout(function(){return i(this).removeClass("ui-state-hover")}).focus(function(){return i(this).addClass("ui-state-focus")}).blur(function(){return i(this).removeClass("ui-state-focus")}).end().find(".ui-dialog-titlebar-close").toggle(this.options.closable).end().find(".ui-dialog-titlebar-restore").hide().click(function(i){return i.preventDefault(),l.restore()}).end(),a=this.modes;for(o in a)e=a[o],this._initModuleButton(o,e);return n.dblclick(function(){return l.options.dblclick?"normal"!==l._state?l.restore():l[l.options.dblclick]():void 0}).select(function(){return!1})},_initModuleButton:function(t,e){var o,n=this;return o=i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-buttonpane"),o.append('<a class="ui-dialog-titlebar-'+t+' ui-corner-all ui-state-default" href="#" title="'+t+'"><span class="ui-icon '+this.options.icons[t]+'">'+t+"</span></a>").find(".ui-dialog-titlebar-"+t).attr("role","button").mouseover(function(){return i(this).addClass("ui-state-hover")}).mouseout(function(){return i(this).removeClass("ui-state-hover")}).focus(function(){return i(this).addClass("ui-state-focus")}).blur(function(){return i(this).removeClass("ui-state-focus")}).end().find(".ui-dialog-titlebar-"+t).toggle(this.options[e.option]).click(function(i){return i.preventDefault(),n[t]()}).end()},_initTitleBar:function(){var t;switch(this.options.titlebar){case!1:return 0;case"none":return i(this.element[0]).dialog("option","draggable")&&(t=i("<div />").addClass("ui-dialog-draggable-handle").css("cursor","move").height(5),i(this.element[0]).dialog("widget").prepend(t).draggable("option","handle",t)),i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").find(".ui-dialog-title").html(" ").end().css({"background-color":"transparent","background-image":"none",border:0,position:"absolute",right:0,top:0,"z-index":9999}).end();case"transparent":return i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css({"background-color":"transparent","background-image":"none",border:0});default:return i.error("jQuery.dialogExtend Error : Invalid <titlebar> value '"+this.options.titlebar+"'")}},state:function(){return this._state},restore:function(){return this._trigger("beforeRestore"),this._restore(),this._toggleButtons(),this._trigger("restore")},_restore:function(){return"normal"!==this._state?(this["_restore_"+this._state](),this._setState("normal"),i(this.element[0]).dialog("widget").focus()):void 0},_saveSnapshot:function(){return"normal"===this._state?(this.original_config_resizable=i(this.element[0]).dialog("option","resizable"),this.original_config_draggable=i(this.element[0]).dialog("option","draggable"),this.original_size_height=i(this.element[0]).dialog("widget").outerHeight(),this.original_size_width=i(this.element[0]).dialog("option","width"),this.original_size_maxHeight=i(this.element[0]).dialog("option","maxHeight"),this.original_position_mode=i(this.element[0]).dialog("widget").css("position"),this.original_position_left=i(this.element[0]).dialog("widget").offset().left-i("body").scrollLeft(),this.original_position_top=i(this.element[0]).dialog("widget").offset().top-i("body").scrollTop(),this.original_titlebar_wrap=i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").css("white-space")):void 0},_loadSnapshot:function(){return{config:{resizable:this.original_config_resizable,draggable:this.original_config_draggable},size:{height:this.original_size_height,width:this.original_size_width,maxHeight:this.original_size_maxHeight},position:{mode:this.original_position_mode,left:this.original_position_left,top:this.original_position_top},titlebar:{wrap:this.original_titlebar_wrap}}},_toggleButtons:function(t){var e,o,n,a,l,s;n=t||this._state,i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").toggle("normal"!==n).css({right:"1.4em"}).end(),a=this.modes;for(o in a)e=a[o],i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-"+o).toggle(n!==e.state&&this.options[e.option]);l=this.modes,s=[];for(o in l)e=l[o],e.state===n?s.push(i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-restore").insertAfter(i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar-"+o)).end()):s.push(void 0);return s}})}).call(this),function(){var i;i=jQuery,i.extend(!0,i.ui.dialogExtend.prototype,{modes:{collapse:{option:"collapsable",state:"collapsed"}},options:{collapsable:!1,icons:{collapse:"ui-icon-triangle-1-s"},beforeCollapse:null,collapse:null},collapse:function(){var t,e;return t=i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").height()+15,this._trigger("beforeCollapse"),"normal"!==this._state&&this._restore(),this._saveSnapshot(),e=i(this.element[0]).dialog("widget").position(),i(this.element[0]).dialog("option",{resizable:!1,height:t,maxHeight:t,position:[e.left-i(document).scrollLeft(),e.top-i(document).scrollTop()]}).on("dialogclose",this._collapse_restore).hide().dialog("widget").find(".ui-dialog-buttonpane:visible").hide().end().find(".ui-dialog-titlebar").css("white-space","nowrap").end().find(".ui-dialog-content"),this._setState("collapsed"),this._toggleButtons(),this._trigger("collapse")},_restore_collapsed:function(){var t;return t=this._loadSnapshot(),i(this.element[0]).show().dialog("widget").find(".ui-dialog-buttonpane:hidden").show().end().find(".ui-dialog-titlebar").css("white-space",t.titlebar.wrap).end().find(".ui-dialog-content").dialog("option",{resizable:t.config.resizable,height:t.size.height,maxHeight:t.size.maxHeight}).off("dialogclose",this._collapse_restore)},_initStyles_collapse:function(){var t;return i(".dialog-extend-collapse-css").length?void 0:(t="",t+='<style class="dialog-extend-collapse-css" type="text/css">',t+=".ui-dialog .ui-dialog-titlebar-collapse { width: 19px; height: 18px; }",t+=".ui-dialog .ui-dialog-titlebar-collapse span { display: block; margin: 1px; }",t+=".ui-dialog .ui-dialog-titlebar-collapse:hover,",t+=".ui-dialog .ui-dialog-titlebar-collapse:focus { padding: 0; }",t+="</style>",i(t).appendTo("body"))},_collapse_restore:function(){return i(this).dialogExtend("restore")}})}.call(this),function(){var i;i=jQuery,i.extend(!0,i.ui.dialogExtend.prototype,{modes:{maximize:{option:"maximizable",state:"maximized"}},options:{maximizable:!1,icons:{maximize:"ui-icon-extlink"},beforeMaximize:null,maximize:null},maximize:function(){var t,e;return t=i(window).height()-11,e=i(window).width()-11,this._trigger("beforeMaximize"),"normal"!==this._state&&this._restore(),this._saveSnapshot(),i(this.element[0]).dialog("option","draggable")&&i(this.element[0]).dialog("widget").draggable("option","handle",null).find(".ui-dialog-draggable-handle").css("cursor","text").end(),i(this.element[0]).dialog("widget").css("position","fixed").find(".ui-dialog-content").show().dialog("widget").find(".ui-dialog-buttonpane").show().end().find(".ui-dialog-content").dialog("option",{resizable:!1,draggable:!1,height:t,width:e,position:{my:"left top",at:"left top",of:window}}),this._setState("maximized"),this._toggleButtons(),this._trigger("maximize")},_restore_maximized:function(){var t;return t=this._loadSnapshot(),i(this.element[0]).dialog("widget").css("position",t.position.mode).find(".ui-dialog-titlebar").css("white-space",t.titlebar.wrap).end().find(".ui-dialog-content").dialog("option",{resizable:t.config.resizable,draggable:t.config.draggable,height:t.size.height,width:t.size.width,maxHeight:t.size.maxHeight,position:{my:"left top",at:"left+"+t.position.left+" top+"+t.position.top,of:window}}),i(this.element[0]).dialog("option","draggable")?i(this.element[0]).dialog("widget").draggable("option","handle",i(this.element[0]).dialog("widget").find(".ui-dialog-draggable-handle").length?i(this.element[0]).dialog("widget").find(".ui-dialog-draggable-handle"):".ui-dialog-titlebar").find(".ui-dialog-draggable-handle").css("cursor","move"):void 0},_initStyles_maximize:function(){var t;return i(".dialog-extend-maximize-css").length?void 0:(t="",t+='<style class="dialog-extend-maximize-css" type="text/css">',t+=".ui-dialog .ui-dialog-titlebar-maximize { width: 19px; height: 18px; }",t+=".ui-dialog .ui-dialog-titlebar-maximize span { display: block; margin: 1px; }",t+=".ui-dialog .ui-dialog-titlebar-maximize:hover,",t+=".ui-dialog .ui-dialog-titlebar-maximize:focus { padding: 0; }",t+="</style>",i(t).appendTo("body"))}})}.call(this),function(){var i;i=jQuery,i.extend(!0,i.ui.dialogExtend.prototype,{modes:{minimize:{option:"minimizable",state:"minimized"}},options:{minimizable:!1,minimizeLocation:"left",icons:{minimize:"ui-icon-minus"},beforeMinimize:null,minimize:null},minimize:function(){var t,e,o;return this._trigger("beforeMinimize"),"normal"!==this._state&&this._restore(),o=200,i("#dialog-extend-fixed-container").length?e=i("#dialog-extend-fixed-container"):(e=i('<div id="dialog-extend-fixed-container"></div>').appendTo("body"),e.css({position:"fixed",bottom:1,left:1,right:1,"z-index":9999})),this._toggleButtons("minimized"),t=i(this.element[0]).dialog("widget").clone().children().remove().end(),i(this.element[0]).dialog("widget").find(".ui-dialog-titlebar").clone(!0,!0).appendTo(t),t.css({"float":this.options.minimizeLocation,margin:1}),e.append(t),i(this.element[0]).data("dialog-extend-minimize-controls",t),i(this.element[0]).dialog("option","draggable")&&t.removeClass("ui-draggable"),t.css({height:"auto",width:o,position:"static"}),i(this.element[0]).on("dialogbeforeclose",this._minimize_restoreOnClose).dialog("widget").hide(),this._setState("minimized"),this._trigger("minimize")},_restore_minimized:function(){return i(this.element[0]).dialog("widget").show(),i(this.element[0]).off("dialogbeforeclose",this._minimize_restoreOnClose),i(this.element[0]).data("dialog-extend-minimize-controls").remove(),i(this.element[0]).removeData("dialog-extend-minimize-controls")},_initStyles_minimize:function(){var t;return i(".dialog-extend-minimize-css").length?void 0:(t="",t+='<style class="dialog-extend-minimize-css" type="text/css">',t+=".ui-dialog .ui-dialog-titlebar-minimize { width: 19px; height: 18px; }",t+=".ui-dialog .ui-dialog-titlebar-minimize span { display: block; margin: 1px; }",t+=".ui-dialog .ui-dialog-titlebar-minimize:hover,",t+=".ui-dialog .ui-dialog-titlebar-minimize:focus { padding: 0; }",t+="</style>",i(t).appendTo("body"))},_verifyOptions_minimize:function(){var t;return!this.options.minimizeLocation||"left"!==(t=this.options.minimizeLocation)&&"right"!==t?(i.error("jQuery.dialogExtend Error : Invalid <minimizeLocation> value '"+this.options.minimizeLocation+"'"),this.options.minimizeLocation="left"):void 0},_minimize_restoreOnClose:function(){return i(this).dialogExtend("restore")}})}.call(this);window.initBimViewer = function(context) {var angleMeasurementsData = [
|
|
627
629
|
|
|
628
630
|
];
|
|
629
631
|
var bcfData = {};
|
|
@@ -2294,14 +2296,14 @@ function compareModels(isSideBySide) {
|
|
|
2294
2296
|
|
|
2295
2297
|
function doCompareModels(isSideBySide) {
|
|
2296
2298
|
|
|
2297
|
-
|
|
2299
|
+
BIMModel.Compare(function (result) {
|
|
2298
2300
|
var objResult = JSON.parse(result);
|
|
2299
2301
|
compareModelsResult = objResult;
|
|
2300
2302
|
viewerSceneObjectsNewBeforeCompare = {};
|
|
2301
2303
|
|
|
2302
|
-
if(compareModelsResult['new'] && compareModelsResult['new'].length) {
|
|
2303
|
-
for(let i=0; i < compareModelsResult['new'].length; i++) {
|
|
2304
|
-
viewerSceneObjectsNewBeforeCompare[compareModelsResult['new'][i]] = Object.assign({},viewer.scene.objects[compareModelsResult['new'][i]]);
|
|
2304
|
+
if (compareModelsResult['new'] && compareModelsResult['new'].length) {
|
|
2305
|
+
for (let i = 0; i < compareModelsResult['new'].length; i++) {
|
|
2306
|
+
viewerSceneObjectsNewBeforeCompare[compareModelsResult['new'][i]] = Object.assign({}, viewer.scene.objects[compareModelsResult['new'][i]]);
|
|
2305
2307
|
}
|
|
2306
2308
|
}
|
|
2307
2309
|
|
|
@@ -2311,7 +2313,7 @@ function doCompareModels(isSideBySide) {
|
|
|
2311
2313
|
createComparisonResultPopup();
|
|
2312
2314
|
viewer.scene.canvas.spinner.processes--;
|
|
2313
2315
|
},
|
|
2314
|
-
function() {
|
|
2316
|
+
function () {
|
|
2315
2317
|
viewer.scene.canvas.spinner.processes--;
|
|
2316
2318
|
});
|
|
2317
2319
|
}
|
|
@@ -2388,12 +2390,12 @@ function getComparisonResultRemovedItemsListElm(allItemsList) {
|
|
|
2388
2390
|
|
|
2389
2391
|
function getComparisonResulItemsListElm(arCustomMeta, resultData, cssClass, allItemsList) {
|
|
2390
2392
|
var itemsList = $('<ul class="list-items">');
|
|
2391
|
-
for (var i=0; i < resultData.length; i++) {
|
|
2393
|
+
for (var i = 0; i < resultData.length; i++) {
|
|
2392
2394
|
var objId = arCustomMeta[resultData[i]]['id'];
|
|
2393
2395
|
var objName = arCustomMeta[resultData[i]]['name'];
|
|
2394
|
-
var item = $('<li class="'+cssClass+'"><span class="name">'+objName+'</span><span class="props">'+' [ '+objId+' ]'+'</span></li>');
|
|
2396
|
+
var item = $('<li class="' + cssClass + '"><span class="name">' + objName + '</span><span class="props">' + ' [ ' + objId + ' ]' + '</span></li>');
|
|
2395
2397
|
item.data('objId', objId);
|
|
2396
|
-
item.on('click', function() {
|
|
2398
|
+
item.on('click', function () {
|
|
2397
2399
|
goToObject($(this).data('objId'));
|
|
2398
2400
|
});
|
|
2399
2401
|
allItemsList.append(item.clone(true));
|
|
@@ -2442,7 +2444,7 @@ function createComparisonResultPopupHeader(countAdded, labelAdded, countRemoved,
|
|
|
2442
2444
|
function highlightModelsDifference(result, isSideBySide) {
|
|
2443
2445
|
var color, arObjId;
|
|
2444
2446
|
|
|
2445
|
-
if(result['old']['unique'].length) {
|
|
2447
|
+
if (result['old']['unique'].length) {
|
|
2446
2448
|
arObjId = result['old']['unique'];
|
|
2447
2449
|
var opacity = 0.4; // TODO: old Model unique-objects opacity
|
|
2448
2450
|
if (isSideBySide) {
|
|
@@ -2479,7 +2481,6 @@ function highlightModelsDifference(result, isSideBySide) {
|
|
|
2479
2481
|
});
|
|
2480
2482
|
}*/
|
|
2481
2483
|
|
|
2482
|
-
|
|
2483
2484
|
function colorizeArObject(arObjId, color) {
|
|
2484
2485
|
viewer.scene.setObjectsColorized(arObjId, color);
|
|
2485
2486
|
}
|
|
@@ -2517,7 +2518,7 @@ function goToObject(objId) {
|
|
|
2517
2518
|
var entity = viewer.scene.objects[objId];
|
|
2518
2519
|
viewer.scene.setObjectsSelected(viewer.scene.selectedObjectIds, false);
|
|
2519
2520
|
|
|
2520
|
-
if(entity) {
|
|
2521
|
+
if (entity) {
|
|
2521
2522
|
entity.selected = true;
|
|
2522
2523
|
viewer.cameraFlight.flyTo(entity);
|
|
2523
2524
|
}
|
|
@@ -3143,33 +3144,372 @@ function hidePropInspector() {
|
|
|
3143
3144
|
$('#propInspector').hide();
|
|
3144
3145
|
}
|
|
3145
3146
|
|
|
3146
|
-
|
|
3147
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
3148
|
+
// Compare dialog
|
|
3149
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
3150
|
+
function bindSelect(select) {
|
|
3151
|
+
$(select).click(function (e) {
|
|
3152
|
+
let input = $(select).children()[0];
|
|
3153
|
+
if (e.target.localName == 'li') {
|
|
3154
|
+
let value = $(e.target).attr('value');
|
|
3155
|
+
let text = $(e.target).text();
|
|
3156
|
+
$(input).val(text);
|
|
3157
|
+
$(input).data('value', value);
|
|
3158
|
+
input.dispatchEvent(new CustomEvent('change', { detail: { value: value } }));
|
|
3159
|
+
$(select).removeClass('active');
|
|
3160
|
+
}
|
|
3161
|
+
else if (e.currentTarget == select && !$(select).hasClass('active') && !$(select).hasClass('readonly')) {
|
|
3162
|
+
$(select).addClass('active');
|
|
3163
|
+
} else {
|
|
3164
|
+
$(select).removeClass('active');
|
|
3165
|
+
}
|
|
3166
|
+
});
|
|
3147
3167
|
|
|
3148
|
-
|
|
3168
|
+
$(document).click(function (e) {
|
|
3169
|
+
if (!Array.from($(select).children()).includes(e.target)) {
|
|
3170
|
+
$(select).removeClass('active');
|
|
3171
|
+
}
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3149
3174
|
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3175
|
+
function bindSelectList() {
|
|
3176
|
+
$('.select').each(function (i, item) {
|
|
3177
|
+
bindSelect(item);
|
|
3178
|
+
});
|
|
3179
|
+
}
|
|
3153
3180
|
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3181
|
+
function hideDlgOverlay() {
|
|
3182
|
+
$('.dlg-overlay').hide();
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
function hideDlgCompare() {
|
|
3186
|
+
$('.compare-dlg-wrap').hide();
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3189
|
+
function toggleCompareButtons() {
|
|
3190
|
+
$('#btnCompareOneOverOne').removeClass('toggled');
|
|
3191
|
+
$('#btnCompareSideBySide').removeClass('toggled');
|
|
3192
|
+
$('#btnToggleCompare').removeClass('toggled');
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
function bindBtnCompareDlgClose() {
|
|
3196
|
+
$('.compare-dlg-header .close').click(function () {
|
|
3197
|
+
hideDlgOverlay();
|
|
3198
|
+
hideDlgCompare();
|
|
3199
|
+
toggleCompareButtons();
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
function bindBtnCompareCancel() {
|
|
3204
|
+
$('#btnCompareCancel').click(function () {
|
|
3205
|
+
hideDlgOverlay();
|
|
3206
|
+
hideDlgCompare();
|
|
3207
|
+
toggleCompareButtons();
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
function bindBtnDoCompare() {
|
|
3212
|
+
$('#btnDoCompare').click(function () {
|
|
3213
|
+
if ($(this).hasClass('disabled')) {
|
|
3214
|
+
return false;
|
|
3215
|
+
} else {
|
|
3216
|
+
compareObjList = getCompareObjList();
|
|
3217
|
+
hideDlgCompare();
|
|
3218
|
+
hideDlgOverlay();
|
|
3219
|
+
doCompare();
|
|
3220
|
+
}
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
function bindCompareDlgVersionChange() {
|
|
3225
|
+
bindCompareDlgDcoAVersionChange();
|
|
3226
|
+
bindCompareDlgDcoBVersionChange();
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
function showComparisonWarning() {
|
|
3230
|
+
$('.compare-dlg_warning').text(context.createLocale('app.viewer.bim.compare.warning')).show();
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
function hideComparisonWarning() {
|
|
3234
|
+
$('.compare-dlg_warning').text('').hide();
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
function isEqualComparisonDocs() {
|
|
3238
|
+
if (compareObjList.modelAVersion == compareObjList.modelBVersion) {
|
|
3239
|
+
return true;
|
|
3240
|
+
} else {
|
|
3241
|
+
return false;
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
function checkIsAllowedCompare() {
|
|
3246
|
+
if (isEqualComparisonDocs()) {
|
|
3247
|
+
showComparisonWarning();
|
|
3248
|
+
$('#btnDoCompare').addClass('disabled');
|
|
3249
|
+
} else {
|
|
3250
|
+
hideComparisonWarning();
|
|
3251
|
+
$('#btnDoCompare').removeClass('disabled');
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
function bindCompareDlgDcoAVersionChange() {
|
|
3256
|
+
$('#docAVersion').on('change', function () {
|
|
3257
|
+
compareObjList.modelAVersion = getModelAVersion();
|
|
3258
|
+
checkIsAllowedCompare();
|
|
3259
|
+
});
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
function bindCompareDlgDcoBVersionChange() {
|
|
3263
|
+
$('#docBVersion').on('change', function () {
|
|
3264
|
+
compareObjList.modelBVersion = getModelBVersion();
|
|
3265
|
+
checkIsAllowedCompare();
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
function initVersionSelectValues() {
|
|
3270
|
+
let version = context.fileVersionList.find(item => item.id == context.versionId);
|
|
3271
|
+
let currentVersion = `v${version.name}`;
|
|
3272
|
+
if (currentVersion != $('#docAVersion').val()) {
|
|
3273
|
+
$('#docAVersion').val(currentVersion);
|
|
3274
|
+
let currentVersionArray = version.name.split('.');
|
|
3275
|
+
let versionMinor = currentVersionArray[1];
|
|
3276
|
+
let versionMajor = currentVersionArray[0];
|
|
3277
|
+
if (versionMinor > 1) {
|
|
3278
|
+
$('#docBVersion').val(`v${versionMajor}.${--versionMinor}`);
|
|
3279
|
+
} else {
|
|
3280
|
+
$('#docBVersion').val(currentVersion);
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
function initCompare() {
|
|
3286
|
+
$('#docAVersionList').html(null);
|
|
3287
|
+
$('#docBVersionList').html(null);
|
|
3288
|
+
|
|
3289
|
+
bindBtnCompareCancel();
|
|
3290
|
+
bindBtnCompareDlgClose();
|
|
3291
|
+
bindBtnDoCompare();
|
|
3292
|
+
bindCompareDlgVersionChange();
|
|
3293
|
+
|
|
3294
|
+
let fileName = context.file.fieldValueMap.name;
|
|
3295
|
+
$('div.compare-dlg_doc-a_name').text(fileName);
|
|
3296
|
+
$('div.compare-dlg_doc-b_name').text(fileName);
|
|
3297
|
+
|
|
3298
|
+
$.each(context.fileVersionList, function (i, item) {
|
|
3299
|
+
let value = 'v' + item.name;
|
|
3300
|
+
$('#docAVersionList').append($('<li>', {
|
|
3301
|
+
value: value,
|
|
3302
|
+
text: value,
|
|
3303
|
+
}));
|
|
3304
|
+
$('#docBVersionList').append($('<li>', {
|
|
3305
|
+
value: value,
|
|
3306
|
+
text: value,
|
|
3307
|
+
}));
|
|
3308
|
+
});
|
|
3309
|
+
|
|
3310
|
+
initVersionSelectValues();
|
|
3311
|
+
|
|
3312
|
+
compareObjList = getCompareObjList();
|
|
3313
|
+
checkIsAllowedCompare();
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
var compareObjList;
|
|
3317
|
+
var isCompareSideBySide;
|
|
3318
|
+
|
|
3319
|
+
function getCompareObjList() {
|
|
3320
|
+
return {
|
|
3321
|
+
modelAVersion: getModelAVersion(),
|
|
3322
|
+
modelBVersion: getModelBVersion(),
|
|
3160
3323
|
};
|
|
3324
|
+
}
|
|
3161
3325
|
|
|
3162
|
-
|
|
3163
|
-
|
|
3326
|
+
function getModelAVersion() {
|
|
3327
|
+
const docAVersionValue = $("#docAVersion").val();
|
|
3328
|
+
const modelAVersion = docAVersionValue.substring(1);
|
|
3329
|
+
return modelAVersion;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
function getModelBVersion() {
|
|
3333
|
+
const docBVersionValue = $("#docBVersion").val();
|
|
3334
|
+
const modelBVersion = docBVersionValue.substring(1);
|
|
3335
|
+
return modelBVersion;
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
function showDlgCompare() {
|
|
3339
|
+
initVersionSelectValues();
|
|
3340
|
+
$('.dlg-overlay').show();
|
|
3341
|
+
$('.compare-dlg-wrap').show();
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
function compareModels(isSideBySide) {
|
|
3345
|
+
isCompareSideBySide = isSideBySide;
|
|
3346
|
+
showDlgCompare();
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
function doCompareModels(isSideBySide) {
|
|
3350
|
+
|
|
3351
|
+
BIMModel.Compare(function (objResult) {
|
|
3352
|
+
|
|
3353
|
+
compareModelsResult = objResult;
|
|
3354
|
+
viewerSceneObjectsNewBeforeCompare = {};
|
|
3355
|
+
|
|
3356
|
+
if (compareModelsResult['new'] && compareModelsResult['new'].length) {
|
|
3357
|
+
for (let i = 0; i < compareModelsResult['new'].length; i++) {
|
|
3358
|
+
viewerSceneObjectsNewBeforeCompare[compareModelsResult['new'][i]] = Object.assign({}, viewer.scene.objects[compareModelsResult['new'][i]]);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
window.objResult = objResult;
|
|
3363
|
+
|
|
3364
|
+
highlightModelsDifference(objResult, isSideBySide);
|
|
3365
|
+
createComparisonResultPopup();
|
|
3366
|
+
viewer.scene.canvas.spinner.processes--;
|
|
3367
|
+
},
|
|
3368
|
+
function () {
|
|
3369
|
+
viewer.scene.canvas.spinner.processes--;
|
|
3370
|
+
});
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
function getComparisonResultAddedItemsListElm(allItemsList) {
|
|
3374
|
+
var cssClass = 'item-added';
|
|
3375
|
+
return getComparisonResulItemsListElm(window.model2, compareModelsResult['new'], cssClass, allItemsList);
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
function getComparisonResultRemovedItemsListElm(allItemsList) {
|
|
3379
|
+
var cssClass = 'item-removed';
|
|
3380
|
+
return getComparisonResulItemsListElm(window.model, compareModelsResult['old']['unique'], cssClass, allItemsList);
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
function getComparisonResulItemsListElm(sceneModel, resultData, cssClass, allItemsList) {
|
|
3384
|
+
var itemsList = $('<ul class="list-items">');
|
|
3385
|
+
for (var i = 0; i < resultData.length; i++) {
|
|
3386
|
+
var objId = resultData[i].id;
|
|
3387
|
+
var objName = resultData[i].name;
|
|
3388
|
+
var objUuid = resultData[i].uuid;
|
|
3389
|
+
var item = $('<li class="' + cssClass + '"><span class="name">' + objName + '</span><span class="props">' + ' [ ' + objUuid + ' ]' + '</span></li>');
|
|
3390
|
+
item.data('objId', objId);
|
|
3391
|
+
item.data('modelId', sceneModel.id);
|
|
3392
|
+
item.on('click', function () {
|
|
3393
|
+
goToObject($(this).data('modelId'), $(this).data('objId'));
|
|
3394
|
+
});
|
|
3395
|
+
allItemsList.append(item.clone(true));
|
|
3396
|
+
itemsList.append(item);
|
|
3164
3397
|
}
|
|
3165
3398
|
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3399
|
+
return itemsList;
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
// Gltf
|
|
3403
|
+
function highlightModelsDifference(result, isSideBySide) {
|
|
3404
|
+
var color, arObjId;
|
|
3405
|
+
|
|
3406
|
+
if (result['old']['unique'].length) {
|
|
3407
|
+
arObjId = result['old']['unique'];
|
|
3408
|
+
var opacity = 0.4; // TODO: old Model unique-objects opacity
|
|
3409
|
+
if (isSideBySide) {
|
|
3410
|
+
color = [1.0, 0.0, 0.8];
|
|
3411
|
+
} else {
|
|
3412
|
+
color = [0.9, 0.9, 0.9]; // TODO: old Model unique-objects color -> gray
|
|
3413
|
+
setOpacityArObject(window.model, arObjId, opacity);
|
|
3414
|
+
}
|
|
3415
|
+
colorizeArObject(window.model, arObjId, color); // TODO: old Model unique-objects change color
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
// Make old Model not unique-objects unvisible
|
|
3419
|
+
if (result['old']['notUnique'].length && !isSideBySide) {
|
|
3420
|
+
arObjId = result['old']['notUnique'];
|
|
3421
|
+
setVisibilityArObject(window.model, arObjId, false);
|
|
3422
|
+
}
|
|
3423
|
+
|
|
3424
|
+
if (result['new'].length) {
|
|
3425
|
+
arObjId = result['new'];
|
|
3426
|
+
color = [1.0, 0.0, 0.8]; // TODO: new Model unique-objects color
|
|
3427
|
+
colorizeArObject(window.model2, arObjId, color);
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
function withObjects(sceneModel, dbObjs, callback) {
|
|
3432
|
+
let changed = false;
|
|
3433
|
+
for (let i = 0, len = dbObjs.length; i < len; i++) {
|
|
3434
|
+
const id = dbObjs[i].id;
|
|
3435
|
+
let entity = sceneModel.objects[id];
|
|
3436
|
+
if (entity) {
|
|
3437
|
+
changed = callback(entity) || changed;
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
return changed;
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
function colorizeArObject(sceneModel, dbObjs, color) {
|
|
3444
|
+
withObjects(sceneModel, dbObjs, entity => {
|
|
3445
|
+
entity.colorize = color;
|
|
3170
3446
|
});
|
|
3171
3447
|
}
|
|
3172
|
-
|
|
3448
|
+
|
|
3449
|
+
function highlightArObject(sceneModel, dbObjs, highlighted) {
|
|
3450
|
+
withObjects(sceneModel, dbObjs, entity => {
|
|
3451
|
+
entity.highlighted = highlighted;
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
function setOpacityArObject(sceneModel, dbObjs, opacity) {
|
|
3456
|
+
withObjects(sceneModel, dbObjs, entity => {
|
|
3457
|
+
entity.opacity = opacity;
|
|
3458
|
+
});
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
function setVisibilityArObject(sceneModel, dbObjs, visible) {
|
|
3462
|
+
withObjects(sceneModel, dbObjs, entity => {
|
|
3463
|
+
entity.visible = visible;
|
|
3464
|
+
});
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
function goToObject(modelId, objId) {
|
|
3468
|
+
const scene = viewer.scene;
|
|
3469
|
+
const sceneModel = scene.models[modelId];
|
|
3470
|
+
var entity = sceneModel.objects[objId];
|
|
3471
|
+
|
|
3472
|
+
window.model.selected = false;
|
|
3473
|
+
window.model2.selected = false;
|
|
3474
|
+
|
|
3475
|
+
if (entity) {
|
|
3476
|
+
entity.selected = true;
|
|
3477
|
+
viewer.cameraFlight.flyTo(entity);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
function doCompare() {
|
|
3482
|
+
const versionA = compareObjList.modelAVersion;
|
|
3483
|
+
const versionB = compareObjList.modelBVersion;
|
|
3484
|
+
|
|
3485
|
+
BIMCommon.GetFileItem(context.file.id, versionB, function (modelId) {
|
|
3486
|
+
|
|
3487
|
+
context.getItem(modelId).then(item => {
|
|
3488
|
+
var filePath = context.getFilePath(item.id);
|
|
3489
|
+
var settings = {
|
|
3490
|
+
id: Date.now(),
|
|
3491
|
+
src: filePath,
|
|
3492
|
+
edges: true,
|
|
3493
|
+
performance: true,
|
|
3494
|
+
position: [0, 0, 0]
|
|
3495
|
+
};
|
|
3496
|
+
|
|
3497
|
+
if (isCompareSideBySide) {
|
|
3498
|
+
settings.position = [-55, 0, 0];
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
BIMCommon.FileCompareVersion = versionB;
|
|
3502
|
+
window.model2 = xktLoader.load(settings);
|
|
3503
|
+
window.model2.on('loaded', () => {
|
|
3504
|
+
viewer.scene.canvas.spinner.processes++;
|
|
3505
|
+
doCompareModels(isCompareSideBySide);
|
|
3506
|
+
});
|
|
3507
|
+
})
|
|
3508
|
+
|
|
3509
|
+
}, function () {
|
|
3510
|
+
alert("The file is being processed");
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3173
3513
|
//------------------------------------------------------------------------------------------------------------------
|
|
3174
3514
|
// Do action wherever we click on an object
|
|
3175
3515
|
//------------------------------------------------------------------------------------------------------------------
|
|
@@ -3272,6 +3612,9 @@ function init() {
|
|
|
3272
3612
|
bindBtnCompareOneOverOne();
|
|
3273
3613
|
bindBtnCompareSideBySide();
|
|
3274
3614
|
bindBtnClearComparison();
|
|
3615
|
+
|
|
3616
|
+
initCompare();
|
|
3617
|
+
bindSelectList();
|
|
3275
3618
|
}
|
|
3276
3619
|
|
|
3277
3620
|
init();
|