Permalink
Browse files

Make sub-object links navigable (busy with issue #43)

  • Loading branch information...
1 parent 00acd32 commit 5715b95761018c4ae6caf98e07baf9155dd30c63 @rehno-lindeque rehno-lindeque committed Nov 4, 2011
Showing with 20 additions and 21 deletions.
  1. +1 −0 index.html
  2. +7 −11 src/events.controls.coffee
  3. +1 −1 src/events.dialog.importbimserver.coffee
  4. +1 −0 src/events.register.coffee
  5. +9 −8 static/lib/app.js
  6. +1 −1 static/lib/app.min.js
View
1 index.html
@@ -609,6 +609,7 @@
}
.controls-table-label {
background: #ddd;
+ font-size: 11px;
width: 65px;
}
.controls-table-value {
View
18 src/events.controls.coffee
@@ -32,7 +32,8 @@ controlsPropertiesSelectObject = (id) ->
html += "</li>"
html = "<ul class='controls-table'>"
- html += tableItem 'Global Id', id
+ if keyStack.length == 1
+ html += tableItem 'Global Id', id
if objectProperties?
for key, value of objectProperties
html += tableItem key, value
@@ -43,16 +44,6 @@ controlsPropertiesSelectObject = (id) ->
($ '#controls-properties').html html
-# Display the selected link
-controlsPropertiesSelectLink = (object) ->
- # Check that the object is valid
- if not object?
- return
-
- # Add the link to the stack
- state.controls.properties.stack.push object
-
-
# Toggle an IFC object's tree node in the objects tab to open/closed state
controlsToggleTreeOpen = (event) ->
$parent = ($ event.target).parent()
@@ -132,6 +123,11 @@ controlsShowProperties = (event) ->
# TODO: Unfortunately this line below doesn't seem to work correctly because the click event is sent after dblclick, but before ui-accordion-content-active is set
helpShortcutsHide 'inspection'
+# Navigate the selected link (display its properties)
+controlsNavigateLink = (event) ->
+ controlsPropertiesSelectObject (($ event.target).attr 'href').slice 1
+ return false
+
# Toggle the visibility of a layer based on the state of its checkbox in the layers tab
controlsToggleLayer = (event) ->
elements = ($ '#controls-layers input:checked').toArray()
View
2 src/events.dialog.importbimserver.coffee
@@ -66,7 +66,7 @@ bimserverImportDialogLogin = () ->
# NOTE: Writing a correct url validation regex (with no false positives or false negatives) is close to impossible.
# Instead we are relying on the browsers validation on the field itself and then simply try to use the url.
- # If the server answers the url is clearly correct.
+ # If the server answers, the url is clearly correct.
# Ensure root url ends with /
if url[url.length - 1] != '/'
View
1 src/events.register.coffee
@@ -43,6 +43,7 @@ registerControlEvents = () ->
($ '#controls-relationships').delegate '.controls-tree-item', 'click', controlsToggleTreeOpen
($ '#controls-relationships').delegate '.controls-tree-item', 'dblclick', controlsShowProperties
($ '#controls-relationships').delegate 'input', 'change', controlsToggleTreeVisibility
+ ($ '#controls-properties').delegate '.ifc-link', 'click', controlsNavigateLink
($ '#controls-layers').delegate 'input', 'change', controlsToggleLayer
($ '#snapshot-placeholder').click snapshotsPush
View
17 static/lib/app.js
@@ -5,7 +5,7 @@
"use strict";
(function() {
- var bimserverImport, bimserverImportDialogClearMessages, bimserverImportDialogLoad, bimserverImportDialogLogin, bimserverImportDialogRefresh, bimserverImportDialogSelect, bimserverImportDialogShow, bimserverImportDialogShowTab1, bimserverImportDialogShowTab2, bimserverImportDialogToggleTab2, canvasCaptureThumbnail, canvasInit, constants, controlsInit, controlsPropertiesSelectLink, controlsPropertiesSelectObject, controlsShowProperties, controlsToggleLayer, controlsToggleTreeOpen, controlsToggleTreeVisibility, controlsTreeSelectObject, fileImportDialogLoad, fileImportDialogShow, helpShortcuts, helpShortcutsHide, helpStatus, helpStatusClear, hideDialog, ifcTreeInit, keyDown, lerpLookAt, lerpLookAtNode, loadScene, lookAtNodePanRelative, lookAtPanRelative, lookAtToQuaternion, mainmenuViewsReset, modifySubAttr, mouseCoordsWithinElement, mouseDown, mouseMove, mouseUp, mouseWheel, orbitLookAt, orbitLookAtNode, recordToVec3, recordToVec4, registerControlEvents, registerDOMEvents, sceneInit, snapshotsDelete, snapshotsPlay, snapshotsPush, snapshotsToggle, state, topmenuHelp, topmenuImportBimserver, topmenuImportSceneJS, topmenuModeAdvanced, topmenuModeBasic, topmenuPerformancePerformance, topmenuPerformanceQuality, vec3ToRecord, vec4ToRecord, viewportInit, windowResize, zoomLookAt, zoomLookAtNode;
+ var bimserverImport, bimserverImportDialogClearMessages, bimserverImportDialogLoad, bimserverImportDialogLogin, bimserverImportDialogRefresh, bimserverImportDialogSelect, bimserverImportDialogShow, bimserverImportDialogShowTab1, bimserverImportDialogShowTab2, bimserverImportDialogToggleTab2, canvasCaptureThumbnail, canvasInit, constants, controlsInit, controlsNavigateLink, controlsPropertiesSelectObject, controlsShowProperties, controlsToggleLayer, controlsToggleTreeOpen, controlsToggleTreeVisibility, controlsTreeSelectObject, fileImportDialogLoad, fileImportDialogShow, helpShortcuts, helpShortcutsHide, helpStatus, helpStatusClear, hideDialog, ifcTreeInit, keyDown, lerpLookAt, lerpLookAtNode, loadScene, lookAtNodePanRelative, lookAtPanRelative, lookAtToQuaternion, mainmenuViewsReset, modifySubAttr, mouseCoordsWithinElement, mouseDown, mouseMove, mouseUp, mouseWheel, orbitLookAt, orbitLookAtNode, recordToVec3, recordToVec4, registerControlEvents, registerDOMEvents, sceneInit, snapshotsDelete, snapshotsPlay, snapshotsPush, snapshotsToggle, state, topmenuHelp, topmenuImportBimserver, topmenuImportSceneJS, topmenuModeAdvanced, topmenuModeBasic, topmenuPerformancePerformance, topmenuPerformanceQuality, vec3ToRecord, vec4ToRecord, viewportInit, windowResize, zoomLookAt, zoomLookAtNode;
var __indexOf = Array.prototype.indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (this[i] === item) return i;
@@ -628,7 +628,9 @@
return html += "</li>";
};
html = "<ul class='controls-table'>";
- html += tableItem('Global Id', id);
+ if (keyStack.length === 1) {
+ html += tableItem('Global Id', id);
+ }
if (objectProperties != null) {
for (key in objectProperties) {
value = objectProperties[key];
@@ -641,12 +643,6 @@
}
return ($('#controls-properties')).html(html);
};
- controlsPropertiesSelectLink = function(object) {
- if (!(object != null)) {
- return;
- }
- return state.controls.properties.stack.push(object);
- };
controlsToggleTreeOpen = function(event) {
var $parent, id;
$parent = ($(event.target)).parent();
@@ -733,6 +729,10 @@
($('#controls-accordion')).accordion('activate', 1);
return helpShortcutsHide('inspection');
};
+ controlsNavigateLink = function(event) {
+ controlsPropertiesSelectObject((($(event.target)).attr('href')).slice(1));
+ return false;
+ };
controlsToggleLayer = function(event) {
var el, elements, tags;
elements = ($('#controls-layers input:checked')).toArray();
@@ -995,6 +995,7 @@
($('#controls-relationships')).delegate('.controls-tree-item', 'click', controlsToggleTreeOpen);
($('#controls-relationships')).delegate('.controls-tree-item', 'dblclick', controlsShowProperties);
($('#controls-relationships')).delegate('input', 'change', controlsToggleTreeVisibility);
+ ($('#controls-properties')).delegate('.ifc-link', 'click', controlsNavigateLink);
($('#controls-layers')).delegate('input', 'change', controlsToggleLayer);
($('#snapshot-placeholder')).click(snapshotsPush);
($('#snapshots')).delegate('.snapshot', 'click', snapshotsToggle);
View
2 static/lib/app.min.js
@@ -1,4 +1,4 @@
/*
* BIMsurfer
* Copyright 2011, BIMserver.org.
- */"use strict",function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1};RegExp.escape=function(a){return a.replace(/[[\]\\$().{},?*+|^-]/g,"\\$&")},k=function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n;return l=document.createElement("canvas"),l.width=d,l.height=e,m=l.getContext("2d"),n=$(a).width(),j=$(a).height(),g=Math.min(n,b),f=Math.min(j,c),h=Math.floor((n-g)/2),i=Math.floor((j-f)/2),m.drawImage(a,h,i,g,f,0,0,d,e),k=l.toDataURL("image/png"),k},L=function(a,b,c,d){var e;return e=a.get(b),e[c]=d,a.set(b,e)},T=function(a){return[a.x,a.y,a.z]},U=function(a){return[a.x,a.y,a.z,a.w]},bj=function(a){return{x:a[0],y:a[1],z:a[2]}},bk=function(a){return{x:a[0],y:a[1],z:a[2],w:a[3]}},J=function(a){var b,c,d,e,f,g;return b=T(a.eye),c=T(a.look),d=T(a.up),e=[0,0,0],f=[0,0,0],g=[0,0,0],SceneJS_math_subVec3(c,b,g),SceneJS_math_cross3Vec3(d,g,e),SceneJS_math_cross3Vec3(g,e,f),SceneJS_math_normalizeVec3(e),SceneJS_math_normalizeVec3(f),SceneJS_math_normalizeVec3(g),SceneJS_math_newQuaternionFromMat3(e.concat(f,g))},R=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;return a[0]===0&&a[1]===0?{eye:c.eye,look:c.look,up:c.up}:(g=T(c.eye),q=T(c.up),i=T(c.look),d=[[0,0,0],[0,0,0],[0,0,0]],e=[[0,0,0],[0,0,0],[0,0,0]],SceneJS_math_subVec3(g,i,d[2]),SceneJS_math_cross3Vec3(q,d[2],d[0]),SceneJS_math_normalizeVec3(d[0],e[0]),SceneJS_math_normalizeVec3(d[2],e[2]),SceneJS_math_cross3Vec3(e[2],e[0],e[1]),k=[e[0][0]*-a[1]+e[1][0]*-a[0],e[0][1]*-a[1]+e[1][1]*-a[0],e[0][2]*-a[1]+e[1][2]*-a[0]],f=SceneJS_math_lenVec2(a),l=SceneJS_math_rotationMat4v(f,k),o=SceneJS_math_transformVector3(l,e[0]),p=SceneJS_math_transformVector3(l,d[2]),h=[0,0,0],SceneJS_math_addVec3(i,p,h),m=o,n=[0,0,0],SceneJS_math_mulVec3(m,b,n),SceneJS_math_subVec3(m,n),r=[0,0,0],SceneJS_math_cross3Vec3(p,m,r),j={eye:bj(h),look:c.look,up:bj(r)})},S=function(a,b,c){return a.set(R(b,c,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},bn=function(a,b,c){var d,e,f,g,h,i;return d=T(c.eye),h=T(c.look),e=SceneJS_math_lenVec3(d),g=Math.clamp(e+a,b[0],b[1]),f=[0,0,0],SceneJS_math_mulVec3Scalar(d,g/e,f),i={eye:bj(f),look:c.look,up:c.up}},bo=function(a,b,c){return a.set(bn(b,c,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},I=function(a,b){var c,d,e,f,g,h;return a[0]===0&&a[1]===0?{eye:b.eye,look:b.look,up:b.up}:(e=T(b.eye),f=T(b.look),h=T(b.up),c=[[0,0,0],[0,0,0],[0,0,0]],SceneJS_math_subVec3(e,f,c[2]),SceneJS_math_cross3Vec3(h,c[2],c[0]),SceneJS_math_normalizeVec3(c[0]),SceneJS_math_cross3Vec3(c[2],c[0],c[1]),SceneJS_math_normalizeVec3(c[1]),SceneJS_math_mulVec3Scalar(c[0],a[0]),SceneJS_math_mulVec3Scalar(c[1],a[1]),d=[0,0,0],SceneJS_math_addVec3(c[0],c[1],d),g={eye:bj(SceneJS_math_addVec3(e,d)),look:bj(SceneJS_math_addVec3(f,d)),up:b.up})},H=function(a,b){return a.set(I(b,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},E=function(a,b,c){var d,e,f,g;return e=J(b),f=J(c),d=SceneJS_math_slerp(a,e,f),g={eye:SceneJS_math_lerpVec3(a,0,1,b.eye,c.eye),look:SceneJS_math_lerpVec3(a,0,1,b.look,c.look),up:bj(SceneJS_math_newUpVec3FromQuaternion(d))}},F=function(a,b,c,d){return a.set(E(b,c,d))},SceneJS.FX={},SceneJS.FX.Tween={},SceneJS.FX.TweenSpline=function(){var a,b,c,d,e,f;return a=function(){function a(a,b){this._target=a,this._sequence=[],this._timeline=[],this._play=b!=null?b:!0,this._t=0}return a.prototype.tick=function(a){if(this._play)return this._t+=a},a.prototype.start=function(a){return this._sequence=[a!=null?a:{eye:this._target.get("eye"),look:this._target.get("look"),up:this._target.get("up")}],this._timeline=[0],this._t=0},a.prototype.push=function(a,b){var c;return this._sequence.length===0&&(this._t=0),c=b!=null?b:5e3,this._timeline.length===0&&(c=0),this._timeline.push(this.totalTime()+c),this._sequence.push(a)},a.prototype.sequence=function(a,b){var c,d,e,f;this._sequence.length===0&&(this._t=0);for(e=0,f=a.length;e<f;e++)d=a[e],c=b!=null?b:5e3,this._timeline.length===0&&(c=0),this._timeline.push(this.totalTime()+c),this._sequence.push(d);return null},a.prototype.pause=function(){return this._play=!1},a.prototype.play=function(){return this._play=!0},a.prototype.totalTime=function(){return this._timeline.length>0?this._timeline[this._timeline.length-1]:0},a.prototype.update=function(){var a,b;if(this._sequence.length===0)return!1;if(!this._play)return!0;if(this._t>=this.totalTime()||this._sequence.length===1)return this._target.set(this._sequence[this._sequence.length-1]),!1;b=0;while(this._timeline[b]<=this._t)++b;return a=this._timeline[b]-this._timeline[b-1],F(this._target,(this._t-this._timeline[b-1])/a,this._sequence[b-1],this._sequence[b]),!0},a}(),f=[],c=null,b=0,e=function(){var a,c,d;for(c=0,d=f.length;c<d;c++)a=f[c],a.tick(b);return null},d=function(d,g){var h;return b=g||50,c!==null&&clearInterval(c),c=setInterval(e,b),h=new a(d),f.push(h),h},d.update=function(){var a,b,c;a=0,c=[];while(a<f.length)b=f[a],c.push(b.update()?a+=1:f.splice(a,1));return c},d}(),SceneJS.FX.idle=function(){return SceneJS.FX.TweenSpline.update(),null},m={camera:{maxOrbitSpeed:Math.PI*.1,orbitSpeedFactor:.01,zoomSpeedFactor:.05,panSpeedFactor:.1},mouse:{pickDragThreshold:10},canvas:{defaultSize:[1024,512],topOffset:122},thumbnails:{size:[125,100],scale:2},highlightMaterial:{type:"material",id:"highlight",emit:0,baseColor:{r:0,g:.5,b:.5}}},Math.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)},bb={scene:function(){try{return SceneJS.scene("Scene")}catch(a){return null}}(),canvas:document.getElementById("scenejsCanvas"),settings:{performance:"quality",mode:"basic"},viewport:{domElement:document.getElementById("viewport"),selectedIfcObject:null,mouse:{last:[0,0],leftDown:!1,middleDown:!1,leftDragDistance:0,middleDragDistance:0,pickRecord:null}},camera:{distanceLimits:[0,0]},lookAt:{defaultParameters:{look:{x:0,y:0,z:0},eye:{x:10,y:10,z:10},up:{x:0,y:0,z:1}}},snapshots:{lookAts:[]},application:{initialized:!1}},M=function(a){var b,c,d,e;b=[0,0];if(!a)a=window.event,b=[a.x,a.y];else{c=a.target,d=0,e=0;while(c.offsetParent)d+=c.offsetLeft,e+=c.offsetTop,c=c.offsetParent;b=[a.pageX-d,a.pageY-e]}return b},bm=function(){var a,b;switch(bb.settings.performance){case"performance":bb.canvas.width=m.canvas.defaultSize[0],bb.canvas.height=m.canvas.defaultSize[1];break;case"quality":bb.canvas.width=$("#viewport").width(),bb.canvas.height=$("#viewport").height()}if(bb.scene!=null)return a=bb.scene.findNode("main-camera"),b=a.get("optics"),b.aspect=bb.canvas.width/bb.canvas.height,a.set("optics",b)},N=function(a){var b;if(bb.scene==null)return;bb.viewport.mouse.last=[a.clientX,a.clientY];switch(a.which){case 1:bb.viewport.mouse.leftDown=!0;break;case 2:bb.viewport.mouse.middleDown=!0}if(a.which===1)return b=M(a),bb.viewport.mouse.pickRecord=bb.scene.pick(b[0],b[1])},P=function(a){if(bb.scene==null)return;a.which===1&&bb.viewport.mouse.leftDragDistance<m.mouse.pickDragThreshold&&(bb.viewport.mouse.pickRecord!=null?u(bb.viewport.mouse.pickRecord.name):(u(),y("selection")),bb.viewport.mouse.pickRecord=null);switch(a.which){case 1:return bb.viewport.mouse.leftDown=!1,bb.viewport.mouse.leftDragDistance=0;case 2:return bb.viewport.mouse.middleDown=!1,bb.viewport.mouse.middleDragDistance=0}},O=function(a){var b,c,d,e;b=[a.clientX-bb.viewport.mouse.last[0],a.clientY-bb.viewport.mouse.last[1]],c=SceneJS_math_lenVec2(b),bb.viewport.mouse.leftDown&&(bb.viewport.mouse.leftDragDistance+=c),bb.viewport.mouse.middleDown&&(bb.viewport.mouse.middleDragDistance+=c);if(bb.viewport.mouse.leftDown&&a.which===1){d=[0,0],SceneJS_math_mulVec2Scalar(b,m.camera.orbitSpeedFactor/c,d),d=[Math.clamp(d[0],-m.camera.maxOrbitSpeed,m.camera.maxOrbitSpeed),Math.clamp(d[1],-m.camera.maxOrbitSpeed,m.camera.maxOrbitSpeed)];if(isNaN(d[0])||Math.abs(d[0])===Infinity)d[0]=0;if(isNaN(d[1])||Math.abs(d[1])===Infinity)d[1]=0;S(bb.scene.findNode("main-lookAt"),d,[0,0,1])}else bb.viewport.mouse.middleDown&&a.which===2&&(e=[0,0],SceneJS_math_mulVec2Scalar([-b[0],b[1]],m.camera.panSpeedFactor/c,e),H(bb.scene.findNode("main-lookAt"),e));return bb.viewport.mouse.last=[a.clientX,a.clientY]},Q=function(a){var b,c;if(bb.scene==null)return;return b=a.wheelDelta!=null?a.wheelDelta/-120:Math.clamp(a.detail,-1,1),c=b*bb.camera.distanceLimits[1]*m.camera.zoomSpeedFactor,bo(bb.scene.findNode("main-lookAt"),c,bb.camera.distanceLimits)},D=function(a){switch(a.which){case 72:return bc()}},z=function(a){return $("#main-view-help").html(a)},A=function(){return $("#main-view-help").html("")},x=function(){var a,b,c,d;$(".shortcut").hide(),d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push($(".shortcut-"+a).show());return d},y=function(){var a,b,c,d;d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push($(".shortcut-"+a).hide());return d},bd=function(a){return g()},be=function(a){return w()},bi=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-performance-performance").removeClass("top-menu-activated"),$("#viewport").removeClass("viewport-performance"),bb.settings.performance="quality",bm()},bh=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-performance-quality").removeClass("top-menu-activated"),$("#viewport").addClass("viewport-performance"),bb.settings.performance="performance",bm()},bg=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-mode-advanced").removeClass("top-menu-activated"),bb.settings.mode="basic"},bf=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-mode-basic").removeClass("top-menu-activated"),bb.settings.mode="performance"},bc=function(){return $("#top-menu-help").toggleClass("top-menu-activated"),$("#main-view-help").toggle(),$("#main-view-keys").toggle()},K=function(a){var b;if(bb.scene!=null)return b=bb.scene.findNode("main-lookAt"),b.set("eye",bb.lookAt.defaultParameters.eye),b.set("look",bb.lookAt.defaultParameters.look),b.set("up",bb.lookAt.defaultParameters.up)},p=function(a){var b,c,d,e,f,g,h,i,j;f=bb.scene.data().properties;if(a==null)return $("#controls-properties").html("<p class='controls-message'>Select an object to see its properties.</p>");if(f==null)return $("#controls-properties").html("<p class='controls-message'>No properties could be found in the scene.</p>");d=a.split("/"),e=f;for(i=0,j=d.length;i<j;i++)c=d[i],e=e[c];g=function(a,b){var c,e,f,g;c="<li class='controls-table-item'>",c+="<label class='controls-table-label'>"+a+"</label>",c+="<div class='controls-table-value'>";if(Array.isArray(b))c+=b;else if(typeof b=="object"){c+="<a class='ifc-link' href='#";for(f=0,g=d.length;f<g;f++)e=d[f],c+=e+"/";c+=a+"'>...</a>"}else c+=b;return c+="</div>",c+="</li>"},b="<ul class='controls-table'>",b+=g("Global Id",a);if(e!=null)for(c in e)h=e[c],b+=g(c,h);return b+="</ul>",e||(b+="<p class='controls-message'>No additional properties could be found for the object with id '"+a+"'.</p>"),$("#controls-properties").html(b)},o=function(a){if(a==null)return;return bb.controls.properties.stack.push(a)},s=function(a){var b,c;return b=$(a.target).parent(),c=b.attr("id"),b.toggleClass("controls-tree-open"),u(c),p(c)},t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;b=$(a.target).closest(".controls-tree-rel"),i=b.attr("id"),g=[i];if(a.target.checked){f=bb.scene.findNodes("^disable-.*?-"+RegExp.escape(i)+"$");for(m=0,p=f.length;m<p;m++)h=f[m],h.splice();return}b.find(".controls-tree-rel").each(function(){return g.push(this.id)}),s=bb.scene.data().ifcTypes;for(n=0,q=s.length;n<q;n++){k=s[n],k=k.toLowerCase(),l=bb.scene.findNode(k),e={type:"tag",tag:"disable",id:"disable-"+k+"-"+i};if(l!=null){c=[],l.eachNode(function(){var a;return this.get("type")==="name"&&(a=this.get("id"),bp.call(g,a)>=0)&&this.parent().get("id")!==e.id&&c.push(this),!1},{depthFirst:!0});for(o=0,r=c.length;o<r;o++)h=c[o],j=h.parent(),d=(t=j.node(e.id))!=null?t:j.add("node",e).node(e.id),d.add("node",h.disconnect())}}return!1},u=function(a){var b,c,d,e;$(".controls-tree-selected").removeClass("controls-tree-selected"),$(".controls-tree-selected-parent").removeClass("controls-tree-selected-parent"),d=bb.scene.findNode(m.highlightMaterial.id),d!=null&&d.splice();if(a!=null){e=document.getElementById(a),b=$(e).children(".controls-tree-item"),b.addClass("controls-tree-selected"),$(".controls-tree:has(.controls-tree-selected)").addClass("controls-tree-selected-parent"),p(a),c=bb.scene.findNode(a);if(c!=null){c.insert("node",m.highlightMaterial),x("selection","navigation","standard");if($("#controls-accordion-properties").hasClass("ui-accordion-content-active"))return y("inspection")}}},q=function(a){if(a!=null&&a.target.nodeName==="INPUT")return;return $("#controls-accordion").accordion("activate",1),y("inspection")},r=function(a){var b,c,d;return c=$("#controls-layers input:checked").toArray(),d=function(){var a,d,e;e=[];for(a=0,d=c.length;a<d;a++)b=c[a],e.push($(b).attr("id").split(/^layer\-/)[1]);return e}(),bb.scene.set("tagMask","^("+d.join("|")+")$")},_=function(){var a,b,c;if(bb.scene==null)return;return $.browser.webkit&&bb.scene.renderFrame({force:!0}),c=m.thumbnails.size,a=k(bb.canvas,512*c[0]/c[1],512,m.thumbnails.scale*c[0],m.thumbnails.scale*c[1]),b=bb.scene.findNode("main-lookAt"),bb.snapshots.lookAts.push({eye:b.get("eye"),look:b.get("look"),up:b.get("up")}),$("#snapshots").append("<div class='snapshot'><div class='snapshot-thumb'><a href='#' class='snapshot-delete'>x</a><img width='"+c[0]+"px' height='"+c[1]+"px' src='"+a+"'></div></div>")},Y=function(a){var b;return b=$(a.target).parent(),bb.snapshots.lookAts.splice(b.index()+1,1),b.remove()},ba=function(a){bb.scene!=null},Z=function(a){if(bb.scene==null)return;return SceneJS.FX.TweenSpline(bb.scene.findNode("main-lookAt")).sequence(bb.snapshots.lookAts)},a=function(a,b){var c,d,e;return typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Load BIMserver project with oid "+b+"..."),e=$("#bimserver-login-username").val(),d=$("#bimserver-login-password").val(),c=function(a,b,c){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Download complete");try{G(a),A()}catch(d){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(d)}},$.ajax({username:encodeURIComponent(e),password:encodeURIComponent(d),type:"GET",url:a+"download",dataType:"json",data:"poid="+b+"&serializerName=SceneJS"}).done(c).fail(function(a,b,c){return console.log(b),typeof console!="undefined"&&console!==null?typeof console.log=="function"?console.log("...BIMserver import failed"):void 0:void 0})},B=function(){return $("#dialog-background,#dialog-bimserver-import,#dialog-file-import").hide()},b=function(){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html(""),$(".error").removeClass("error")},g=function(){return h(),$("#dialog-background,#dialog-bimserver-import").show()},h=function(){var a;return b(),a=$("#dialog-bimserver-import .dialog-step"),$(a.get(0)).addClass("dialog-step-active"),$(a.get(1)).removeClass("dialog-step-active"),$("#dialog-tab-bimserver1").show(),$("#dialog-tab-bimserver2").hide()},i=function(){var a;return b(),a=$("#dialog-bimserver-import .dialog-step"),$(a.get(0)).removeClass("dialog-step-active"),$(a.get(1)).addClass("dialog-step-active"),$("#dialog-tab-bimserver1").hide(),$("#dialog-tab-bimserver2").show()},j=function(){return i()},d=function(){var a,c,d,f;return b(),$("bimserver-projects").html(""),c=$("#bimserver-login-url").val(),d=$("#bimserver-login-username").val(),a=$("#bimserver-login-password").val(),f=!0,c.length<1&&($("#bimserver-login-url").addClass("error"),f=!1),d.length<1&&($("#bimserver-login-username").addClass("error"),f=!1),a.length<1&&($("#bimserver-login-password").addClass("error"),f=!1),f?($("#dialog-tab-bimserver1 input, #dialog-tab-bimserver1 button").attr("disabled","disabled"),c[c.length-1]!=="/"&&(c+="/"),$("#bimserver-import-message-info").html("Sending login request..."),$.ajax({username:encodeURIComponent(d),password:encodeURIComponent(a),url:c+"rest/login",data:"username="+encodeURIComponent(d)+"&password="+encodeURIComponent(a)}).done(function(a,b,c){return $("#bimserver-import-message-info").html("Login request succeeded",i(),e())}).fail(function(a,b,c){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html("Login request failed")}).always(function(a,b,c){return $("#dialog-tab-bimserver1 input, #dialog-tab-bimserver1 button").removeAttr("disabled")}),a=null,!0):($("#bimserver-import-message-error").html("Some fields are incorrect"),!1)},e=function(){var a,b;return b=$("#bimserver-login-url").val(),b[b.length-1]!=="/"&&(b+="/"),$("#dialog-tab-bimserver2 button").attr("disabled","disabled"),$("#bimserver-projects-submit").attr("disabled","disabled"),a=$("#bimserver-projects"),a.html(""),$.get(b+"rest/getAllProjects",void 0,void 0,"xml").done(function(b,c,d){return $("#bimserver-import-message-info").html("Fetched all projects"),$(b).find("sProject").each(function(){return a.append("<li class='bimserver-project' bimserveroid='"+$(this).find("oid").text()+"'>"+$(this).find("name").text()+"</li>")})}).fail(function(a,b,c){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html("Couldn't fetch projects")}).always(function(a,b,c){return $("#dialog-tab-bimserver2 button").removeAttr("disabled")})},f=function(a){return $(".bimserver-project-selected").removeClass("bimserver-project-selected"),$(a.target).addClass("bimserver-project-selected"),$("#bimserver-projects-submit").removeAttr("disabled")},c=function(){var b,c;return b=$(".bimserver-project-selected"),b.length===0?$("#bimserver-import-message-error").html("No project selected"):(B(),c=$("#bimserver-login-url").val(),c[c.length-1]!=="/"&&(c+="/"),a(c,b.attr("bimserveroid")))},w=function(a){return $("#dialog-background,#dialog-file-import").show()},v=function(a){var b,c,d;return c=new FileReader,c.onloadend=function(a){try{return G($.parseJSON(a.target.result)),A()}catch(b){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(b)}},b=(d=$("#upload-file").get(0))!=null?d.files[0]:void 0,b!=null?(c.readAsText(b),B()):($("#file-import-message-error").html("No file selected"),typeof console!="undefined"&&console!==null?typeof console.log=="function"?console.log("No file selected"):void 0:void 0)},W=function(){return $(bb.viewport.domElement).mousedown(N),$(bb.viewport.domElement).mouseup(P),$(bb.viewport.domElement).mousemove(O),bb.viewport.domElement.addEventListener("mousewheel",Q,!0),bb.viewport.domElement.addEventListener("DOMMouseScroll",Q,!0),document.addEventListener("keydown",D,!0),window.addEventListener("resize",bm,!0)},V=function(){return $("#upload-form").submit(v),$(".dialog-close").click(B),$("#dialog-tab-bimserver1").submit(d),$("#dialog-tab-bimserver2").submit(c),$("#bimserver-import-step1").click(h),$("#bimserver-import-step2").click(j),$("#bimserver-projects-refresh").click(e),$("#bimserver-projects").delegate("li","click",f),$("#top-menu-import-bimserver").click(bd),$("#top-menu-import-scenejs").click(be),$("#top-menu-performance-quality").click(bi),$("#top-menu-performance-performance").click(bh),$("#top-menu-mode-basic").click(bg),$("#top-menu-mode-advanced").click(bf),$("#top-menu-help").click(bc),$("#main-views-reset").click(K),$("#controls-relationships").delegate(".controls-tree-item","click",s),$("#controls-relationships").delegate(".controls-tree-item","dblclick",q),$("#controls-relationships").delegate("input","change",t),$("#controls-layers").delegate("input","change",r),$("#snapshot-placeholder").click(_),$("#snapshots").delegate(".snapshot","click",ba),$("#snapshots").delegate(".snapshot-delete","click",Y),$("#snapshots-play").click(Z),$(bb.viewport.domElement).dblclick(q)},l=function(){return bm()},X=function(){var a,b,c,d;return L(bb.scene.findNode("main-camera"),"optics","aspect",bb.canvas.width/bb.canvas.height),b=SceneJS_math_lenVec3(bb.scene.data().bounds),bb.camera.distanceLimits=[b*.1,b*2],d=function(){var a,b,d,e;d=bb.scene.data().ifcTypes,e=[];for(a=0,b=d.length;a<b;a++)c=d[a],e.push(c.toLowerCase());return e}(),bb.scene.set("tagMask","^("+d.join("|")+")$"),a=bb.scene.findNode("main-lookAt"),bb.lookAt.defaultParameters.eye=a.get("eye"),bb.lookAt.defaultParameters.look=a.get("look"),bb.lookAt.defaultParameters.up=a.get("up")},n=function(){var a,b,c;return c=bb.scene.data(),b=function(){var b,d,e,f;e=c.ifcTypes,f=[];for(b=0,d=e.length;b<d;b++)a=e[b],f.push("<div><input id='layer-"+a.toLowerCase()+"' type='checkbox' checked='checked'> "+a+"</div>");return f}(),$("#controls-layers").html(b.join("")),p(),$("#controls-accordion").accordion({header:"h3"}),$("#main-view-controls").removeAttr("style")},bl=function(){return $("#scenejsCanvas").toggleClass("bimsurfer-empty-watermark",bb.scene==null)},C=function(){var a,b,c,d,e,f,g,h,i,j,k,l;h=bb.scene.data(),d=function(b,d){return"<li class='controls-tree-rel' id='"+b.id+"'><div class='controls-tree-item'><span class='indent-"+String(d)+"'/>"+"<input type='checkbox' checked='checked'> "+b.name+"<span class='controls-tree-postfix'>("+b.type+")</span></div>"+c(b.decomposedBy,d)+c(b.definedBy,d)+a(b.contains,d)+"</li>"},e=function(b){return"<li class='controls-tree-root' id='"+b.id+"'><div class='controls-tree-item'>"+b.name+"<span class='controls-tree-postfix'>("+b.type+")</span></div>"+c(b.decomposedBy,0)+c(b.definedBy,0)+a(b.contains,0)+"</li>"},f=function(a,b,c){var e,f,g,h;if(b!=null&&b.length>0){c=Math.min(c+1,6),e="<ul class='controls-tree'>",e+="<div class='controls-tree-heading'><hr><h4>"+a+"</h4></div>";for(g=0,h=b.length;g<h;g++)f=b[g],e+=d(f,c);return e+="</ul>"}return""},b=function(a,b){return f("Decomposed By",a,b)},c=function(a,b){return f("Defined By",a,b)},a=function(a,b){return f("Contains",a,b)},i="<ul class='controls-tree'>",l=h.relationships;for(j=0,k=l.length;j<k;j++)g=l[j],i+=e(g);return i+="</ul>",$("#controls-relationships").html(i)},l(),bb.scene!=null&&(X(),bb.scene.start({idleFunc:SceneJS.FX.idle})),$(function(){return bl(),bb.scene!=null?(n(),C(),x("standard","navigation")):(z("Please load a project from the <strong>File</strong> menu in the top left-hand corner."),x("standard")),W(),V(),bb.application.initialized=!0}),G=function(a){bb.scene!=null&&(bb.scene.destroy(),bb.scene=null);try{typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Create scene..."),SceneJS.createScene(a),bb.scene=SceneJS.scene("Scene"),bl();if(bb.scene!=null)return typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize scene..."),X(),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Start scene..."),bb.scene.start({idleFunc:SceneJS.FX.idle}),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize controls..."),n(),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize IFC object tree..."),C(),x("standard","navigation"),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Done"),bb.scene}catch(b){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(b),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Errors occured")}return x("standard"),null}}.call(this)
+ */"use strict",function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1};RegExp.escape=function(a){return a.replace(/[[\]\\$().{},?*+|^-]/g,"\\$&")},k=function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n;return l=document.createElement("canvas"),l.width=d,l.height=e,m=l.getContext("2d"),n=$(a).width(),j=$(a).height(),g=Math.min(n,b),f=Math.min(j,c),h=Math.floor((n-g)/2),i=Math.floor((j-f)/2),m.drawImage(a,h,i,g,f,0,0,d,e),k=l.toDataURL("image/png"),k},L=function(a,b,c,d){var e;return e=a.get(b),e[c]=d,a.set(b,e)},T=function(a){return[a.x,a.y,a.z]},U=function(a){return[a.x,a.y,a.z,a.w]},bj=function(a){return{x:a[0],y:a[1],z:a[2]}},bk=function(a){return{x:a[0],y:a[1],z:a[2],w:a[3]}},J=function(a){var b,c,d,e,f,g;return b=T(a.eye),c=T(a.look),d=T(a.up),e=[0,0,0],f=[0,0,0],g=[0,0,0],SceneJS_math_subVec3(c,b,g),SceneJS_math_cross3Vec3(d,g,e),SceneJS_math_cross3Vec3(g,e,f),SceneJS_math_normalizeVec3(e),SceneJS_math_normalizeVec3(f),SceneJS_math_normalizeVec3(g),SceneJS_math_newQuaternionFromMat3(e.concat(f,g))},R=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;return a[0]===0&&a[1]===0?{eye:c.eye,look:c.look,up:c.up}:(g=T(c.eye),q=T(c.up),i=T(c.look),d=[[0,0,0],[0,0,0],[0,0,0]],e=[[0,0,0],[0,0,0],[0,0,0]],SceneJS_math_subVec3(g,i,d[2]),SceneJS_math_cross3Vec3(q,d[2],d[0]),SceneJS_math_normalizeVec3(d[0],e[0]),SceneJS_math_normalizeVec3(d[2],e[2]),SceneJS_math_cross3Vec3(e[2],e[0],e[1]),k=[e[0][0]*-a[1]+e[1][0]*-a[0],e[0][1]*-a[1]+e[1][1]*-a[0],e[0][2]*-a[1]+e[1][2]*-a[0]],f=SceneJS_math_lenVec2(a),l=SceneJS_math_rotationMat4v(f,k),o=SceneJS_math_transformVector3(l,e[0]),p=SceneJS_math_transformVector3(l,d[2]),h=[0,0,0],SceneJS_math_addVec3(i,p,h),m=o,n=[0,0,0],SceneJS_math_mulVec3(m,b,n),SceneJS_math_subVec3(m,n),r=[0,0,0],SceneJS_math_cross3Vec3(p,m,r),j={eye:bj(h),look:c.look,up:bj(r)})},S=function(a,b,c){return a.set(R(b,c,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},bn=function(a,b,c){var d,e,f,g,h,i;return d=T(c.eye),h=T(c.look),e=SceneJS_math_lenVec3(d),g=Math.clamp(e+a,b[0],b[1]),f=[0,0,0],SceneJS_math_mulVec3Scalar(d,g/e,f),i={eye:bj(f),look:c.look,up:c.up}},bo=function(a,b,c){return a.set(bn(b,c,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},I=function(a,b){var c,d,e,f,g,h;return a[0]===0&&a[1]===0?{eye:b.eye,look:b.look,up:b.up}:(e=T(b.eye),f=T(b.look),h=T(b.up),c=[[0,0,0],[0,0,0],[0,0,0]],SceneJS_math_subVec3(e,f,c[2]),SceneJS_math_cross3Vec3(h,c[2],c[0]),SceneJS_math_normalizeVec3(c[0]),SceneJS_math_cross3Vec3(c[2],c[0],c[1]),SceneJS_math_normalizeVec3(c[1]),SceneJS_math_mulVec3Scalar(c[0],a[0]),SceneJS_math_mulVec3Scalar(c[1],a[1]),d=[0,0,0],SceneJS_math_addVec3(c[0],c[1],d),g={eye:bj(SceneJS_math_addVec3(e,d)),look:bj(SceneJS_math_addVec3(f,d)),up:b.up})},H=function(a,b){return a.set(I(b,{eye:a.get("eye"),look:a.get("look"),up:a.get("up")}))},E=function(a,b,c){var d,e,f,g;return e=J(b),f=J(c),d=SceneJS_math_slerp(a,e,f),g={eye:SceneJS_math_lerpVec3(a,0,1,b.eye,c.eye),look:SceneJS_math_lerpVec3(a,0,1,b.look,c.look),up:bj(SceneJS_math_newUpVec3FromQuaternion(d))}},F=function(a,b,c,d){return a.set(E(b,c,d))},SceneJS.FX={},SceneJS.FX.Tween={},SceneJS.FX.TweenSpline=function(){var a,b,c,d,e,f;return a=function(){function a(a,b){this._target=a,this._sequence=[],this._timeline=[],this._play=b!=null?b:!0,this._t=0}return a.prototype.tick=function(a){if(this._play)return this._t+=a},a.prototype.start=function(a){return this._sequence=[a!=null?a:{eye:this._target.get("eye"),look:this._target.get("look"),up:this._target.get("up")}],this._timeline=[0],this._t=0},a.prototype.push=function(a,b){var c;return this._sequence.length===0&&(this._t=0),c=b!=null?b:5e3,this._timeline.length===0&&(c=0),this._timeline.push(this.totalTime()+c),this._sequence.push(a)},a.prototype.sequence=function(a,b){var c,d,e,f;this._sequence.length===0&&(this._t=0);for(e=0,f=a.length;e<f;e++)d=a[e],c=b!=null?b:5e3,this._timeline.length===0&&(c=0),this._timeline.push(this.totalTime()+c),this._sequence.push(d);return null},a.prototype.pause=function(){return this._play=!1},a.prototype.play=function(){return this._play=!0},a.prototype.totalTime=function(){return this._timeline.length>0?this._timeline[this._timeline.length-1]:0},a.prototype.update=function(){var a,b;if(this._sequence.length===0)return!1;if(!this._play)return!0;if(this._t>=this.totalTime()||this._sequence.length===1)return this._target.set(this._sequence[this._sequence.length-1]),!1;b=0;while(this._timeline[b]<=this._t)++b;return a=this._timeline[b]-this._timeline[b-1],F(this._target,(this._t-this._timeline[b-1])/a,this._sequence[b-1],this._sequence[b]),!0},a}(),f=[],c=null,b=0,e=function(){var a,c,d;for(c=0,d=f.length;c<d;c++)a=f[c],a.tick(b);return null},d=function(d,g){var h;return b=g||50,c!==null&&clearInterval(c),c=setInterval(e,b),h=new a(d),f.push(h),h},d.update=function(){var a,b,c;a=0,c=[];while(a<f.length)b=f[a],c.push(b.update()?a+=1:f.splice(a,1));return c},d}(),SceneJS.FX.idle=function(){return SceneJS.FX.TweenSpline.update(),null},m={camera:{maxOrbitSpeed:Math.PI*.1,orbitSpeedFactor:.01,zoomSpeedFactor:.05,panSpeedFactor:.1},mouse:{pickDragThreshold:10},canvas:{defaultSize:[1024,512],topOffset:122},thumbnails:{size:[125,100],scale:2},highlightMaterial:{type:"material",id:"highlight",emit:0,baseColor:{r:0,g:.5,b:.5}}},Math.clamp=function(a,b,c){return Math.min(Math.max(a,b),c)},bb={scene:function(){try{return SceneJS.scene("Scene")}catch(a){return null}}(),canvas:document.getElementById("scenejsCanvas"),settings:{performance:"quality",mode:"basic"},viewport:{domElement:document.getElementById("viewport"),selectedIfcObject:null,mouse:{last:[0,0],leftDown:!1,middleDown:!1,leftDragDistance:0,middleDragDistance:0,pickRecord:null}},camera:{distanceLimits:[0,0]},lookAt:{defaultParameters:{look:{x:0,y:0,z:0},eye:{x:10,y:10,z:10},up:{x:0,y:0,z:1}}},snapshots:{lookAts:[]},application:{initialized:!1}},M=function(a){var b,c,d,e;b=[0,0];if(!a)a=window.event,b=[a.x,a.y];else{c=a.target,d=0,e=0;while(c.offsetParent)d+=c.offsetLeft,e+=c.offsetTop,c=c.offsetParent;b=[a.pageX-d,a.pageY-e]}return b},bm=function(){var a,b;switch(bb.settings.performance){case"performance":bb.canvas.width=m.canvas.defaultSize[0],bb.canvas.height=m.canvas.defaultSize[1];break;case"quality":bb.canvas.width=$("#viewport").width(),bb.canvas.height=$("#viewport").height()}if(bb.scene!=null)return a=bb.scene.findNode("main-camera"),b=a.get("optics"),b.aspect=bb.canvas.width/bb.canvas.height,a.set("optics",b)},N=function(a){var b;if(bb.scene==null)return;bb.viewport.mouse.last=[a.clientX,a.clientY];switch(a.which){case 1:bb.viewport.mouse.leftDown=!0;break;case 2:bb.viewport.mouse.middleDown=!0}if(a.which===1)return b=M(a),bb.viewport.mouse.pickRecord=bb.scene.pick(b[0],b[1])},P=function(a){if(bb.scene==null)return;a.which===1&&bb.viewport.mouse.leftDragDistance<m.mouse.pickDragThreshold&&(bb.viewport.mouse.pickRecord!=null?u(bb.viewport.mouse.pickRecord.name):(u(),y("selection")),bb.viewport.mouse.pickRecord=null);switch(a.which){case 1:return bb.viewport.mouse.leftDown=!1,bb.viewport.mouse.leftDragDistance=0;case 2:return bb.viewport.mouse.middleDown=!1,bb.viewport.mouse.middleDragDistance=0}},O=function(a){var b,c,d,e;b=[a.clientX-bb.viewport.mouse.last[0],a.clientY-bb.viewport.mouse.last[1]],c=SceneJS_math_lenVec2(b),bb.viewport.mouse.leftDown&&(bb.viewport.mouse.leftDragDistance+=c),bb.viewport.mouse.middleDown&&(bb.viewport.mouse.middleDragDistance+=c);if(bb.viewport.mouse.leftDown&&a.which===1){d=[0,0],SceneJS_math_mulVec2Scalar(b,m.camera.orbitSpeedFactor/c,d),d=[Math.clamp(d[0],-m.camera.maxOrbitSpeed,m.camera.maxOrbitSpeed),Math.clamp(d[1],-m.camera.maxOrbitSpeed,m.camera.maxOrbitSpeed)];if(isNaN(d[0])||Math.abs(d[0])===Infinity)d[0]=0;if(isNaN(d[1])||Math.abs(d[1])===Infinity)d[1]=0;S(bb.scene.findNode("main-lookAt"),d,[0,0,1])}else bb.viewport.mouse.middleDown&&a.which===2&&(e=[0,0],SceneJS_math_mulVec2Scalar([-b[0],b[1]],m.camera.panSpeedFactor/c,e),H(bb.scene.findNode("main-lookAt"),e));return bb.viewport.mouse.last=[a.clientX,a.clientY]},Q=function(a){var b,c;if(bb.scene==null)return;return b=a.wheelDelta!=null?a.wheelDelta/-120:Math.clamp(a.detail,-1,1),c=b*bb.camera.distanceLimits[1]*m.camera.zoomSpeedFactor,bo(bb.scene.findNode("main-lookAt"),c,bb.camera.distanceLimits)},D=function(a){switch(a.which){case 72:return bc()}},z=function(a){return $("#main-view-help").html(a)},A=function(){return $("#main-view-help").html("")},x=function(){var a,b,c,d;$(".shortcut").hide(),d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push($(".shortcut-"+a).show());return d},y=function(){var a,b,c,d;d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push($(".shortcut-"+a).hide());return d},bd=function(a){return g()},be=function(a){return w()},bi=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-performance-performance").removeClass("top-menu-activated"),$("#viewport").removeClass("viewport-performance"),bb.settings.performance="quality",bm()},bh=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-performance-quality").removeClass("top-menu-activated"),$("#viewport").addClass("viewport-performance"),bb.settings.performance="performance",bm()},bg=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-mode-advanced").removeClass("top-menu-activated"),bb.settings.mode="basic"},bf=function(a){return $(a.target).addClass("top-menu-activated"),$("#top-menu-mode-basic").removeClass("top-menu-activated"),bb.settings.mode="performance"},bc=function(){return $("#top-menu-help").toggleClass("top-menu-activated"),$("#main-view-help").toggle(),$("#main-view-keys").toggle()},K=function(a){var b;if(bb.scene!=null)return b=bb.scene.findNode("main-lookAt"),b.set("eye",bb.lookAt.defaultParameters.eye),b.set("look",bb.lookAt.defaultParameters.look),b.set("up",bb.lookAt.defaultParameters.up)},p=function(a){var b,c,d,e,f,g,h,i,j;f=bb.scene.data().properties;if(a==null)return $("#controls-properties").html("<p class='controls-message'>Select an object to see its properties.</p>");if(f==null)return $("#controls-properties").html("<p class='controls-message'>No properties could be found in the scene.</p>");d=a.split("/"),e=f;for(i=0,j=d.length;i<j;i++)c=d[i],e=e[c];g=function(a,b){var c,e,f,g;c="<li class='controls-table-item'>",c+="<label class='controls-table-label'>"+a+"</label>",c+="<div class='controls-table-value'>";if(Array.isArray(b))c+=b;else if(typeof b=="object"){c+="<a class='ifc-link' href='#";for(f=0,g=d.length;f<g;f++)e=d[f],c+=e+"/";c+=a+"'>...</a>"}else c+=b;return c+="</div>",c+="</li>"},b="<ul class='controls-table'>",d.length===1&&(b+=g("Global Id",a));if(e!=null)for(c in e)h=e[c],b+=g(c,h);return b+="</ul>",e||(b+="<p class='controls-message'>No additional properties could be found for the object with id '"+a+"'.</p>"),$("#controls-properties").html(b)},s=function(a){var b,c;return b=$(a.target).parent(),c=b.attr("id"),b.toggleClass("controls-tree-open"),u(c),p(c)},t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;b=$(a.target).closest(".controls-tree-rel"),i=b.attr("id"),g=[i];if(a.target.checked){f=bb.scene.findNodes("^disable-.*?-"+RegExp.escape(i)+"$");for(m=0,p=f.length;m<p;m++)h=f[m],h.splice();return}b.find(".controls-tree-rel").each(function(){return g.push(this.id)}),s=bb.scene.data().ifcTypes;for(n=0,q=s.length;n<q;n++){k=s[n],k=k.toLowerCase(),l=bb.scene.findNode(k),e={type:"tag",tag:"disable",id:"disable-"+k+"-"+i};if(l!=null){c=[],l.eachNode(function(){var a;return this.get("type")==="name"&&(a=this.get("id"),bp.call(g,a)>=0)&&this.parent().get("id")!==e.id&&c.push(this),!1},{depthFirst:!0});for(o=0,r=c.length;o<r;o++)h=c[o],j=h.parent(),d=(t=j.node(e.id))!=null?t:j.add("node",e).node(e.id),d.add("node",h.disconnect())}}return!1},u=function(a){var b,c,d,e;$(".controls-tree-selected").removeClass("controls-tree-selected"),$(".controls-tree-selected-parent").removeClass("controls-tree-selected-parent"),d=bb.scene.findNode(m.highlightMaterial.id),d!=null&&d.splice();if(a!=null){e=document.getElementById(a),b=$(e).children(".controls-tree-item"),b.addClass("controls-tree-selected"),$(".controls-tree:has(.controls-tree-selected)").addClass("controls-tree-selected-parent"),p(a),c=bb.scene.findNode(a);if(c!=null){c.insert("node",m.highlightMaterial),x("selection","navigation","standard");if($("#controls-accordion-properties").hasClass("ui-accordion-content-active"))return y("inspection")}}},q=function(a){if(a!=null&&a.target.nodeName==="INPUT")return;return $("#controls-accordion").accordion("activate",1),y("inspection")},o=function(a){return p($(a.target).attr("href").slice(1)),!1},r=function(a){var b,c,d;return c=$("#controls-layers input:checked").toArray(),d=function(){var a,d,e;e=[];for(a=0,d=c.length;a<d;a++)b=c[a],e.push($(b).attr("id").split(/^layer\-/)[1]);return e}(),bb.scene.set("tagMask","^("+d.join("|")+")$")},_=function(){var a,b,c;if(bb.scene==null)return;return $.browser.webkit&&bb.scene.renderFrame({force:!0}),c=m.thumbnails.size,a=k(bb.canvas,512*c[0]/c[1],512,m.thumbnails.scale*c[0],m.thumbnails.scale*c[1]),b=bb.scene.findNode("main-lookAt"),bb.snapshots.lookAts.push({eye:b.get("eye"),look:b.get("look"),up:b.get("up")}),$("#snapshots").append("<div class='snapshot'><div class='snapshot-thumb'><a href='#' class='snapshot-delete'>x</a><img width='"+c[0]+"px' height='"+c[1]+"px' src='"+a+"'></div></div>")},Y=function(a){var b;return b=$(a.target).parent(),bb.snapshots.lookAts.splice(b.index()+1,1),b.remove()},ba=function(a){bb.scene!=null},Z=function(a){if(bb.scene==null)return;return SceneJS.FX.TweenSpline(bb.scene.findNode("main-lookAt")).sequence(bb.snapshots.lookAts)},a=function(a,b){var c,d,e;return typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Load BIMserver project with oid "+b+"..."),e=$("#bimserver-login-username").val(),d=$("#bimserver-login-password").val(),c=function(a,b,c){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Download complete");try{G(a),A()}catch(d){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(d)}},$.ajax({username:encodeURIComponent(e),password:encodeURIComponent(d),type:"GET",url:a+"download",dataType:"json",data:"poid="+b+"&serializerName=SceneJS"}).done(c).fail(function(a,b,c){return console.log(b),typeof console!="undefined"&&console!==null?typeof console.log=="function"?console.log("...BIMserver import failed"):void 0:void 0})},B=function(){return $("#dialog-background,#dialog-bimserver-import,#dialog-file-import").hide()},b=function(){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html(""),$(".error").removeClass("error")},g=function(){return h(),$("#dialog-background,#dialog-bimserver-import").show()},h=function(){var a;return b(),a=$("#dialog-bimserver-import .dialog-step"),$(a.get(0)).addClass("dialog-step-active"),$(a.get(1)).removeClass("dialog-step-active"),$("#dialog-tab-bimserver1").show(),$("#dialog-tab-bimserver2").hide()},i=function(){var a;return b(),a=$("#dialog-bimserver-import .dialog-step"),$(a.get(0)).removeClass("dialog-step-active"),$(a.get(1)).addClass("dialog-step-active"),$("#dialog-tab-bimserver1").hide(),$("#dialog-tab-bimserver2").show()},j=function(){return i()},d=function(){var a,c,d,f;return b(),$("bimserver-projects").html(""),c=$("#bimserver-login-url").val(),d=$("#bimserver-login-username").val(),a=$("#bimserver-login-password").val(),f=!0,c.length<1&&($("#bimserver-login-url").addClass("error"),f=!1),d.length<1&&($("#bimserver-login-username").addClass("error"),f=!1),a.length<1&&($("#bimserver-login-password").addClass("error"),f=!1),f?($("#dialog-tab-bimserver1 input, #dialog-tab-bimserver1 button").attr("disabled","disabled"),c[c.length-1]!=="/"&&(c+="/"),$("#bimserver-import-message-info").html("Sending login request..."),$.ajax({username:encodeURIComponent(d),password:encodeURIComponent(a),url:c+"rest/login",data:"username="+encodeURIComponent(d)+"&password="+encodeURIComponent(a)}).done(function(a,b,c){return $("#bimserver-import-message-info").html("Login request succeeded",i(),e())}).fail(function(a,b,c){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html("Login request failed")}).always(function(a,b,c){return $("#dialog-tab-bimserver1 input, #dialog-tab-bimserver1 button").removeAttr("disabled")}),a=null,!0):($("#bimserver-import-message-error").html("Some fields are incorrect"),!1)},e=function(){var a,b;return b=$("#bimserver-login-url").val(),b[b.length-1]!=="/"&&(b+="/"),$("#dialog-tab-bimserver2 button").attr("disabled","disabled"),$("#bimserver-projects-submit").attr("disabled","disabled"),a=$("#bimserver-projects"),a.html(""),$.get(b+"rest/getAllProjects",void 0,void 0,"xml").done(function(b,c,d){return $("#bimserver-import-message-info").html("Fetched all projects"),$(b).find("sProject").each(function(){return a.append("<li class='bimserver-project' bimserveroid='"+$(this).find("oid").text()+"'>"+$(this).find("name").text()+"</li>")})}).fail(function(a,b,c){return $("#bimserver-import-message-info").html(""),$("#bimserver-import-message-error").html("Couldn't fetch projects")}).always(function(a,b,c){return $("#dialog-tab-bimserver2 button").removeAttr("disabled")})},f=function(a){return $(".bimserver-project-selected").removeClass("bimserver-project-selected"),$(a.target).addClass("bimserver-project-selected"),$("#bimserver-projects-submit").removeAttr("disabled")},c=function(){var b,c;return b=$(".bimserver-project-selected"),b.length===0?$("#bimserver-import-message-error").html("No project selected"):(B(),c=$("#bimserver-login-url").val(),c[c.length-1]!=="/"&&(c+="/"),a(c,b.attr("bimserveroid")))},w=function(a){return $("#dialog-background,#dialog-file-import").show()},v=function(a){var b,c,d;return c=new FileReader,c.onloadend=function(a){try{return G($.parseJSON(a.target.result)),A()}catch(b){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(b)}},b=(d=$("#upload-file").get(0))!=null?d.files[0]:void 0,b!=null?(c.readAsText(b),B()):($("#file-import-message-error").html("No file selected"),typeof console!="undefined"&&console!==null?typeof console.log=="function"?console.log("No file selected"):void 0:void 0)},W=function(){return $(bb.viewport.domElement).mousedown(N),$(bb.viewport.domElement).mouseup(P),$(bb.viewport.domElement).mousemove(O),bb.viewport.domElement.addEventListener("mousewheel",Q,!0),bb.viewport.domElement.addEventListener("DOMMouseScroll",Q,!0),document.addEventListener("keydown",D,!0),window.addEventListener("resize",bm,!0)},V=function(){return $("#upload-form").submit(v),$(".dialog-close").click(B),$("#dialog-tab-bimserver1").submit(d),$("#dialog-tab-bimserver2").submit(c),$("#bimserver-import-step1").click(h),$("#bimserver-import-step2").click(j),$("#bimserver-projects-refresh").click(e),$("#bimserver-projects").delegate("li","click",f),$("#top-menu-import-bimserver").click(bd),$("#top-menu-import-scenejs").click(be),$("#top-menu-performance-quality").click(bi),$("#top-menu-performance-performance").click(bh),$("#top-menu-mode-basic").click(bg),$("#top-menu-mode-advanced").click(bf),$("#top-menu-help").click(bc),$("#main-views-reset").click(K),$("#controls-relationships").delegate(".controls-tree-item","click",s),$("#controls-relationships").delegate(".controls-tree-item","dblclick",q),$("#controls-relationships").delegate("input","change",t),$("#controls-properties").delegate(".ifc-link","click",o),$("#controls-layers").delegate("input","change",r),$("#snapshot-placeholder").click(_),$("#snapshots").delegate(".snapshot","click",ba),$("#snapshots").delegate(".snapshot-delete","click",Y),$("#snapshots-play").click(Z),$(bb.viewport.domElement).dblclick(q)},l=function(){return bm()},X=function(){var a,b,c,d;return L(bb.scene.findNode("main-camera"),"optics","aspect",bb.canvas.width/bb.canvas.height),b=SceneJS_math_lenVec3(bb.scene.data().bounds),bb.camera.distanceLimits=[b*.1,b*2],d=function(){var a,b,d,e;d=bb.scene.data().ifcTypes,e=[];for(a=0,b=d.length;a<b;a++)c=d[a],e.push(c.toLowerCase());return e}(),bb.scene.set("tagMask","^("+d.join("|")+")$"),a=bb.scene.findNode("main-lookAt"),bb.lookAt.defaultParameters.eye=a.get("eye"),bb.lookAt.defaultParameters.look=a.get("look"),bb.lookAt.defaultParameters.up=a.get("up")},n=function(){var a,b,c;return c=bb.scene.data(),b=function(){var b,d,e,f;e=c.ifcTypes,f=[];for(b=0,d=e.length;b<d;b++)a=e[b],f.push("<div><input id='layer-"+a.toLowerCase()+"' type='checkbox' checked='checked'> "+a+"</div>");return f}(),$("#controls-layers").html(b.join("")),p(),$("#controls-accordion").accordion({header:"h3"}),$("#main-view-controls").removeAttr("style")},bl=function(){return $("#scenejsCanvas").toggleClass("bimsurfer-empty-watermark",bb.scene==null)},C=function(){var a,b,c,d,e,f,g,h,i,j,k,l;h=bb.scene.data(),d=function(b,d){return"<li class='controls-tree-rel' id='"+b.id+"'><div class='controls-tree-item'><span class='indent-"+String(d)+"'/>"+"<input type='checkbox' checked='checked'> "+b.name+"<span class='controls-tree-postfix'>("+b.type+")</span></div>"+c(b.decomposedBy,d)+c(b.definedBy,d)+a(b.contains,d)+"</li>"},e=function(b){return"<li class='controls-tree-root' id='"+b.id+"'><div class='controls-tree-item'>"+b.name+"<span class='controls-tree-postfix'>("+b.type+")</span></div>"+c(b.decomposedBy,0)+c(b.definedBy,0)+a(b.contains,0)+"</li>"},f=function(a,b,c){var e,f,g,h;if(b!=null&&b.length>0){c=Math.min(c+1,6),e="<ul class='controls-tree'>",e+="<div class='controls-tree-heading'><hr><h4>"+a+"</h4></div>";for(g=0,h=b.length;g<h;g++)f=b[g],e+=d(f,c);return e+="</ul>"}return""},b=function(a,b){return f("Decomposed By",a,b)},c=function(a,b){return f("Defined By",a,b)},a=function(a,b){return f("Contains",a,b)},i="<ul class='controls-tree'>",l=h.relationships;for(j=0,k=l.length;j<k;j++)g=l[j],i+=e(g);return i+="</ul>",$("#controls-relationships").html(i)},l(),bb.scene!=null&&(X(),bb.scene.start({idleFunc:SceneJS.FX.idle})),$(function(){return bl(),bb.scene!=null?(n(),C(),x("standard","navigation")):(z("Please load a project from the <strong>File</strong> menu in the top left-hand corner."),x("standard")),W(),V(),bb.application.initialized=!0}),G=function(a){bb.scene!=null&&(bb.scene.destroy(),bb.scene=null);try{typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Create scene..."),SceneJS.createScene(a),bb.scene=SceneJS.scene("Scene"),bl();if(bb.scene!=null)return typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize scene..."),X(),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Start scene..."),bb.scene.start({idleFunc:SceneJS.FX.idle}),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize controls..."),n(),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("Initialize IFC object tree..."),C(),x("standard","navigation"),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Done"),bb.scene}catch(b){typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log(b),typeof console!="undefined"&&console!==null&&typeof console.log=="function"&&console.log("...Errors occured")}return x("standard"),null}}.call(this)

0 comments on commit 5715b95

Please sign in to comment.