Initial import of NODEDC BIM Viewer

This commit is contained in:
CODEX
2026-06-04 13:25:42 +03:00
commit 9aaf82862f
2075 changed files with 3592575 additions and 0 deletions
+139
View File
@@ -0,0 +1,139 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/BCFMode.js | xeokit-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-viewer"><meta property="og:site_name" content="xeokit-viewer"><meta property="og:title" content="xeokit-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-viewer"><meta property="twitter:description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Controller.js~Controller.html">Controller</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#explorer">explorer</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Classes.js~Classes.html">Classes</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Explorer.js~Explorer.html">Explorer</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Models.js~Models.html">Models</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Objects.js~Objects.html">Objects</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Storeys.js~Storeys.html">Storeys</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#toolbar">toolbar</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/BCFMode.js~BCFMode.html">BCFMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/FirstPersonMode.js~FirstPersonMode.html">FirstPersonMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/FitAction.js~FitAction.html">FitAction</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/HideMode.js~HideMode.html">HideMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/NavCubeMode.js~NavCubeMode.html">NavCubeMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/OrthoMode.js~OrthoMode.html">OrthoMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/QueryMode.js~QueryMode.html">QueryMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/ResetAction.js~ResetAction.html">ResetAction</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/SectionMode.js~SectionMode.html">SectionMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/SelectMode.js~SelectMode.html">SelectMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/Toolbar.js~Toolbar.html">Toolbar</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/BCFMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {BCFViewpointsPlugin} from &quot;../../lib/xeokit/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js&quot;;
import {math} from &quot;../../lib/xeokit/viewer/scene/math/math.js&quot;;
import {Controller} from &quot;../Controller.js&quot;;
/**
* @desc Manages BCF viewpoints.
*
* Located at {@link Toolbar#bcf}.
*/
class BCFMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
this._element = document.getElementById(cfg.bcfPanelId);
this._records = [];
this._recordsMap = {};
this._bcfViewpointsPlugin = new BCFViewpointsPlugin(this.viewer, {});
}
createViewpoint() {
const viewpointId = math.createUUID();
const viewpoint = this._bcfViewpointsPlugin.getViewpoint();
const record = {
id: viewpointId,
viewpoint: viewpoint
};
this._records.push(record);
this._recordsMap[record.id] = record;
this._repaint();
}
clearViewpoints() {
this._records = [];
this._recordsMap = {};
this._repaint();
}
_repaint() {
var h = &quot;&quot;;
for (var i = 0, len = this._records.length; i &lt; len; i++) {
const record = this._records[i];
h += &apos;&lt;br&gt;&lt;div class=&quot;panel panel-primary&quot;&gt;&apos;;
h += &apos;&lt;div class=&quot;panel-heading&quot;&gt;&apos;;
h += &apos;&lt;a id=&quot;&apos; + record.id + &apos;&quot; href=&quot;&quot;&gt;&lt;img src=&quot;&apos; + record.viewpoint.snapshot.snapshot_data + &apos;&quot; style=&quot;border: 1px solid black;&quot; width=&quot;150&quot;, height=&quot;130&quot;&gt;&lt;/a&gt;&apos;;
h += &apos;&lt;/div&gt;&apos;;
h += &apos;&lt;/div&gt;&apos;;
}
const self = this;
this._element.innerHTML = h;
for (var i = 0, len = this._records.length; i &lt; len; i++) {
(function () {
const record = self._records[i];
$(&quot;#&quot; + record.id).on(&apos;click&apos;, (event) =&gt; {
self._bcfViewpointsPlugin.setViewpoint(record.viewpoint);
event.preventDefault();
});
})();
}
}
/** @private */
destroy() {
super.destroy();
this._bcfViewpointsPlugin.destroy();
}
}
export {BCFMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/FirstPersonMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/FirstPersonMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class FirstPersonMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
const cameraControl = this.viewer.cameraControl;
const cameraControlNavModeMediator = cfg.cameraControlNavModeMediator;
cameraControl.navMode = &quot;orbit&quot;;
cameraControl.followPointer = true;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
cameraControlNavModeMediator.setFirstPersonModeActive(active);
if (active) {
cameraControl.followPointer = true;
cameraControl.pivoting = false;
} else {
cameraControl.pivoting = true;
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
const active = this.getActive();
this.setActive(!active);
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, ()=&gt;{
this.setActive(false);
});
}
}
export {FirstPersonMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+124
View File
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/FitAction.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/FitAction.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {math} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
const tempVec3 = math.vec3();
/** @private */
class FitAction extends Controller {
constructor(parent, cfg={}) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.fit();
}
event.preventDefault();
});
}
fit() {
const scene = this.viewer.scene;
const aabb = scene.getAABB(scene.visibleObjectIds);
this.viewer.cameraFlight.flyTo({
aabb: aabb
});
this.viewer.cameraControl.pivotPos = math.getAABB3Center(aabb, tempVec3);
}
set fov(fov) {
this.viewer.scene.cameraFlight.fitFOV = fov;
}
get fov() {
return this.viewer.scene.cameraFlight.fitFOV;
}
set duration(duration) {
this.viewer.scene.cameraFlight.duration = duration;
}
get duration() {
return this.viewer.scene.cameraFlight.duration;
}
}
export {FitAction};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+153
View File
@@ -0,0 +1,153 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/HideMode.js | xeokit-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-viewer"><meta property="og:site_name" content="xeokit-viewer"><meta property="og:title" content="xeokit-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#ifcobjectdefaults">IFCObjectDefaults</a><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IFCObjectDefaults">IFCObjectDefaults</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/HideMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {math} from &quot;@xeokit/xeokit-sdk/src/viewer/scene/math/math.js&quot;;
function closeEnough(p, q) {
const CLICK_DIST = 4;
return (Math.abs(p[0] - q[0]) &lt; 4) &amp;&amp; (Math.abs(p[1] - q[1]) &lt; CLICK_DIST);
}
/** @private */
class HideMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (!this.getEnabled()) {
return;
}
const active = this.getActive();
this.setActive(!active);
event.preventDefault();
});
this.viewerUI.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
this._initHideMode();
}
_initHideMode() {
var entity = null;
this._onHover = this.viewer.cameraControl.on(&quot;hover&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
entity = e.entity;
entity.highlighted = true;
});
this._onHoverOff = this.viewer.cameraControl.on(&quot;hoverOff&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
});
const lastCoords = math.vec2();
this._onMousedown = this.viewer.scene.input.on(&quot;mousedown&quot;, (coords) =&gt; {
lastCoords[0] = coords[0];
lastCoords[1] = coords[1];
});
this._onMouseup = this.viewer.scene.input.on(&quot;mouseup&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
if (!closeEnough(lastCoords, coords)) {
entity = null;
return;
}
entity.visible = false;
entity.highlighted = false;
entity = null;
}
});
}
}
export {HideMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+114
View File
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/HideTool.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/HideTool.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class HideTool extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
this.viewer.cameraControl.doublePickFlyTo = false;
this._onPick = this.viewer.cameraControl.on(&quot;picked&quot;, (pickResult) =&gt; {
if (!pickResult.entity) {
return;
}
pickResult.entity.visible = false;
});
} else {
buttonElement.classList.remove(&quot;active&quot;);
this.viewer.cameraControl.doublePickFlyTo = false;
if (this._onPick !== undefined) {
this.viewer.cameraControl.off(this._onPick);
this._onPick = undefined;
}
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.bimViewer._sectionTool.hideControl();
const active = this.getActive();
this.setActive(!active);
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
}
}
export {HideTool};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
@@ -0,0 +1,324 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/MarqueeSelectionTool.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/MarqueeSelectionTool.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {Frustum, frustumIntersectsAABB3, math, setFrustum} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
const LEFT_TO_RIGHT = 0;
const RIGHT_TO_LEFT = 1;
/** @private */
export class MarqueeSelectionTool extends Controller {
constructor(parent, cfg) {
super(parent);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
this._objectsKdTree3 = cfg.objectsKdTree3;
this._marquee = math.AABB2();
this._marqueeFrustum = new Frustum();
this._marqueeFrustumProjMat = math.mat4();
this._marqueeDir = false;
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
const nop = this._objectsKdTree3.root; // Lazy-build the kd-tree
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
const active = this.getActive();
this.setActive(!active);
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
const scene = this.viewer.scene;
const canvas = scene.canvas.canvas;
this._marqueeElement = document.createElement(&apos;div&apos;);
document.body.appendChild(this._marqueeElement);
const marqueeElement = this._marqueeElement;
const marqueeStyle = marqueeElement.style;
marqueeStyle.position = &quot;absolute&quot;;
marqueeStyle[&quot;z-index&quot;] = &quot;40000005&quot;;
marqueeStyle.width = 8 + &quot;px&quot;;
marqueeStyle.height = 8 + &quot;px&quot;;
marqueeStyle.visibility = &quot;hidden&quot;;
marqueeStyle.top = 0 + &quot;px&quot;;
marqueeStyle.left = 0 + &quot;px&quot;;
marqueeStyle[&quot;box-shadow&quot;] = &quot;0 2px 5px 0 #182A3D;&quot;;
marqueeStyle[&quot;opacity&quot;] = 1.0;
marqueeStyle[&quot;pointer-events&quot;] = &quot;none&quot;;
let canvasDragStartX;
let canvasDragStartY;
let canvasDragEndX;
let canvasDragEndY;
let canvasMarqueeStartX;
let canvasMarqueeStartY;
let canvasMarqueeEndX;
let canvasMarqueeEndY;
let isMouseDragging = false;
let mouseWasUpOffCanvas = false;
canvas.addEventListener(&quot;mousedown&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (e.button !== 0) { // Left button only
return;
}
const input = this.bimViewer.viewer.scene.input;
if (!input.keyDown[input.KEY_CTRL]) { // Clear selection unless CTRL down
scene.setObjectsSelected(scene.selectedObjectIds, false);
}
canvasDragStartX = e.pageX;
canvasDragStartY = e.pageY;
marqueeStyle.visibility = &quot;visible&quot;;
marqueeStyle.left = `${canvasDragStartX}px`;
marqueeStyle.top = `${canvasDragStartY}px`;
marqueeStyle.width = &quot;0px&quot;;
marqueeStyle.height = &quot;0px&quot;;
marqueeStyle.display = &quot;block&quot;;
canvasMarqueeStartX = e.offsetX;
canvasMarqueeStartY = e.offsetY;
isMouseDragging = true;
this.viewer.cameraControl.pointerEnabled = false; // Disable camera rotation
});
canvas.addEventListener(&quot;mouseup&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (!isMouseDragging &amp;&amp; !mouseWasUpOffCanvas) {
return
}
if (e.button !== 0) {
return;
}
canvasDragEndX = e.pageX;
canvasDragEndY = e.pageY;
const width = Math.abs(canvasDragEndX - canvasDragStartX);
const height = Math.abs(canvasDragEndY - canvasDragStartY);
marqueeStyle.width = `${width}px`;
marqueeStyle.height = `${height}px`;
marqueeStyle.visibility = &quot;hidden&quot;;
isMouseDragging = false;
this.viewer.cameraControl.pointerEnabled = true; // Enable camera rotation
if (mouseWasUpOffCanvas) {
mouseWasUpOffCanvas = false;
}
if (width &gt; 3 || height &gt; 3) { // Marquee pick if rectangle big enough
this._marqueePick();
}
}); // Bubbling
document.addEventListener(&quot;mouseup&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (e.button !== 0) { // check if left button was clicked
return;
}
if (!isMouseDragging) {
return
}
marqueeStyle.visibility = &quot;hidden&quot;;
isMouseDragging = false;
mouseWasUpOffCanvas = true;
this.viewer.cameraControl.pointerEnabled = true;
}, true); // Capturing
canvas.addEventListener(&quot;mousemove&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (e.button !== 0) { // check if left button was clicked
return;
}
if (!isMouseDragging) {
return
}
const x = e.pageX;
const y = e.pageY;
const width = x - canvasDragStartX;
const height = y - canvasDragStartY;
marqueeStyle.width = `${Math.abs(width)}px`;
marqueeStyle.height = `${Math.abs(height)}px`;
marqueeStyle.left = `${Math.min(canvasDragStartX, x)}px`;
marqueeStyle.top = `${Math.min(canvasDragStartY, y)}px`;
canvasMarqueeEndX = e.offsetX;
canvasMarqueeEndY = e.offsetY;
const marqueeDir = (canvasMarqueeStartX &lt; canvasMarqueeEndX) ? LEFT_TO_RIGHT : RIGHT_TO_LEFT;
this._setMarqueeDir(marqueeDir);
this._marquee[0] = Math.min(canvasMarqueeStartX, canvasMarqueeEndX);
this._marquee[1] = Math.min(canvasMarqueeStartY, canvasMarqueeEndY);
this._marquee[2] = Math.max(canvasMarqueeStartX, canvasMarqueeEndX);
this._marquee[3] = Math.max(canvasMarqueeStartY, canvasMarqueeEndY);
});
}
_setMarqueeDir(marqueeDir) {
if (marqueeDir !== this._marqueeDir) {
this._marqueeElement.style[&quot;background-image&quot;] =
marqueeDir === LEFT_TO_RIGHT
/* Solid */ ? &quot;url(\&quot;data:image/svg+xml,%3csvg width=&apos;100%25&apos; height=&apos;100%25&apos; xmlns=&apos;http://www.w3.org/2000/svg&apos;%3e%3crect width=&apos;100%25&apos; height=&apos;100%25&apos; fill=&apos;none&apos; rx=&apos;6&apos; ry=&apos;6&apos; stroke=&apos;%23333&apos; stroke-width=&apos;4&apos;/%3e%3c/svg%3e\&quot;)&quot;
/* Dashed */ : &quot;url(\&quot;data:image/svg+xml,%3csvg width=&apos;100%25&apos; height=&apos;100%25&apos; xmlns=&apos;http://www.w3.org/2000/svg&apos;%3e%3crect width=&apos;100%25&apos; height=&apos;100%25&apos; fill=&apos;none&apos; rx=&apos;6&apos; ry=&apos;6&apos; stroke=&apos;%23333&apos; stroke-width=&apos;4&apos; stroke-dasharray=&apos;6%2c 14&apos; stroke-dashoffset=&apos;0&apos; stroke-linecap=&apos;square&apos;/%3e%3c/svg%3e\&quot;)&quot;;
this._marqueeDir = marqueeDir;
}
}
_marqueePick() {
this._buildMarqueeFrustum();
const entities1 = [];
const visitNode = (node, intersects = Frustum.INTERSECT) =&gt; {
if (intersects === Frustum.INTERSECT) {
intersects = frustumIntersectsAABB3(this._marqueeFrustum, node.aabb);
}
if (intersects === Frustum.OUTSIDE) {
return;
}
if (node.entities) {
const entities = node.entities;
for (let i = 0, len = entities.length; i &lt; len; i++) {
const entity = entities[i];
if (!entity.visible) {
continue;
}
const entityAABB = entity.aabb;
if (this._marqueeDir === LEFT_TO_RIGHT) {
// Select entities that are completely inside marquee
const intersection = frustumIntersectsAABB3(this._marqueeFrustum, entityAABB);
if (intersection === Frustum.INSIDE) {
entities1.push(entity);
}
} else {
// Select entities that are partially inside marquee
const intersection = frustumIntersectsAABB3(this._marqueeFrustum, entityAABB);
if (intersection !== Frustum.OUTSIDE) {
entities1.push(entity);
}
}
}
}
// }
if (node.left) {
visitNode(node.left, intersects);
}
if (node.right) {
visitNode(node.right, intersects);
}
}
visitNode(this._objectsKdTree3.root);
for (let i = 0, len = entities1.length; i &lt; len; i++) {
entities1[i].selected = true;
}
return entities1;
}
_buildMarqueeFrustum() { // https://github.com/xeokit/xeokit-sdk/issues/869#issuecomment-1165375770
const canvas = this.viewer.scene.canvas.canvas;
const canvasWidth = canvas.clientWidth;
const canvasHeight = canvas.clientHeight;
const xCanvasToClip = 2.0 / canvasWidth;
const yCanvasToClip = 2.0 / canvasHeight;
const NEAR_SCALING = 17;
const ratio = canvas.clientHeight / canvas.clientWidth;
const FAR_PLANE = 10000;
const left = this._marquee[0] * xCanvasToClip + -1;
const right = this._marquee[2] * xCanvasToClip + -1;
const bottom = -this._marquee[3] * yCanvasToClip + 1;
const top = -this._marquee[1] * yCanvasToClip + 1;
const near = this.viewer.scene.camera.frustum.near * (NEAR_SCALING * ratio);
const far = FAR_PLANE;
math.frustumMat4(
left,
right,
bottom * ratio,
top * ratio,
near,
far,
this._marqueeFrustumProjMat,
);
setFrustum(this._marqueeFrustum, this.viewer.scene.camera.viewMatrix, this._marqueeFrustumProjMat);
}
}
</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+91
View File
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/NavCubeMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/NavCubeMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {NavCubePlugin} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
/** @private */
class NavCubeMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.navCubeCanvasElement) {
throw &quot;Missing config: navCubeCanvasElement&quot;;
}
const navCubeCanvasElement = cfg.navCubeCanvasElement;
this._navCube = new NavCubePlugin(this.viewer, {
canvasElement: navCubeCanvasElement,
fitVisible: true,
color: &quot;#CFCFCF&quot;
});
this._navCube.setVisible(this._active);
this.on(&quot;active&quot;, (active) =&gt; {
this._navCube.setVisible(active);
});
}
destroy() {
this._navCube.destroy();
super.destroy();
}
}
export {NavCubeMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+155
View File
@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/OrthoMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/OrthoMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class OrthoMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
this._buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
this._buttonElement.classList.add(&quot;disabled&quot;);
} else {
this._buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this._buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.setActive(!this.getActive(), () =&gt; {
});
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
this.viewer.camera.on(&quot;projection&quot;, () =&gt; {
const isOrtho = (this.viewer.camera.projection === &quot;ortho&quot;);
this._active = isOrtho;
if (this._active) {
this._buttonElement.classList.add(&quot;active&quot;);
} else {
this._buttonElement.classList.remove(&quot;active&quot;);
}
});
this._active = false;
this._buttonElement.classList.remove(&quot;active&quot;);
}
setActive(active, done) {
if (this._active === active) {
if (done) {
done();
}
return;
}
this._active = active;
if (active) {
this._buttonElement.classList.add(&quot;active&quot;);
if (done) {
this._enterOrthoMode(() =&gt; {
this.fire(&quot;active&quot;, this._active);
done();
});
} else {
this._enterOrthoMode();
this.fire(&quot;active&quot;, this._active);
}
} else {
this._buttonElement.classList.remove(&quot;active&quot;);
if (done) {
this._exitOrthoMode(() =&gt; {
this.fire(&quot;active&quot;, this._active);
done();
});
} else {
this._exitOrthoMode();
this.fire(&quot;active&quot;, this._active);
}
}
}
_enterOrthoMode(done) {
if (done) {
this.viewer.cameraFlight.flyTo({projection: &quot;ortho&quot;, duration: 0.5}, done);
} else {
this.viewer.cameraFlight.jumpTo({projection: &quot;ortho&quot;});
}
}
_exitOrthoMode(done) {
if (done) {
this.viewer.cameraFlight.flyTo({projection: &quot;perspective&quot;, duration: 0.5}, done);
} else {
this.viewer.cameraFlight.jumpTo({projection: &quot;perspective&quot;});
}
}
}
export {OrthoMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+159
View File
@@ -0,0 +1,159 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/QueryMode.js | xeokit-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-viewer"><meta property="og:site_name" content="xeokit-viewer"><meta property="og:title" content="xeokit-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#ifcobjectdefaults">IFCObjectDefaults</a><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IFCObjectDefaults">IFCObjectDefaults</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/QueryMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {math} from &quot;@xeokit/xeokit-sdk/src/viewer/scene/math/math.js&quot;;
function closeEnough(p, q) {
const CLICK_DIST = 4;
return (Math.abs(p[0] - q[0]) &lt; 4) &amp;&amp; (Math.abs(p[1] - q[1]) &lt; CLICK_DIST);
}
/** @private */
class QueryMode extends Controller {
constructor(parent, cfg) {
super(parent);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (!this.getEnabled()) {
return;
}
const active = this.getActive();
this.setActive(!active);
event.preventDefault();
});
this.viewerUI.on(&quot;reset&quot;, ()=&gt;{
this.setActive(false);
});
this._initQueryMode();
}
_initQueryMode() {
const viewer = this.viewer;
const cameraControl = viewer.cameraControl;
var entity = null;
this._onHover = cameraControl.on(&quot;hover&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
entity = e.entity;
entity.highlighted = true;
});
this._onHoverOff = cameraControl.on(&quot;hoverOff&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
});
const lastCoords = math.vec2();
this._onMousedown = viewer.scene.input.on(&quot;mousedown&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
lastCoords[0] = coords[0];
lastCoords[1] = coords[1];
});
this._onMouseup = viewer.scene.input.on(&quot;mouseup&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
if (!closeEnough(lastCoords, coords)) {
entity = null;
return;
}
this.fire(&quot;queryPicked&quot;, entity.id);
entity = null;
} else {
this.fire(&quot;queryNotPicked&quot;, false);
}
});
}
}
export {QueryMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+93
View File
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/QueryTool.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/QueryTool.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class QueryTool extends Controller {
constructor(parent, cfg) {
super(parent);
// this.on(&quot;active&quot;, (active) =&gt; {
// if (active) {
// this._onPick = this.viewer.cameraControl.on(&quot;picked&quot;, (pickResult) =&gt; {
// if (!pickResult.entity) {
// return;
// }
// // this.queryEntity(pickResult.entity);
// });
// this._onPickedNothing = this.viewer.cameraControl.on(&quot;pickedNothing&quot;, () =&gt; {
// this.fire(&quot;queryNotPicked&quot;, false);
// });
// } else {
//
// if (this._onPick !== undefined) {
// this.viewer.cameraControl.off(this._onPick);
// this.viewer.cameraControl.off(this._onPickedNothing);
// this._onPick = undefined;
// this._onPickedNothing = undefined;
// }
// }
// });
//
// this.bimViewer.on(&quot;reset&quot;, () =&gt; {
// this.setActive(false);
// });
}
}
export {QueryTool};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+184
View File
@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/ResetAction.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/ResetAction.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {ModelMemento, math} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
const tempVec3a = math.vec3();
/** @private */
class ResetAction extends Controller {
constructor(parent, cfg = {}) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
const camera = this.viewer.camera;
this._modelMementos = {};
// Initial camera position - looking down negative diagonal
camera.eye = [0.577, 0.577, 0.577];
camera.look = [0,0,0];
camera.up = [-1, 1, -1];
this.bimViewer._modelsExplorer.on(&quot;modelLoaded&quot;, (modelId) =&gt; {
this._saveModelMemento(modelId);
});
this.bimViewer._modelsExplorer.on(&quot;modelUnloaded&quot;, (modelId) =&gt; {
this._destroyModelMemento(modelId);
});
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.reset();
}
event.preventDefault();
});
}
_saveModelMemento(modelId) {
const metaModel = this.viewer.metaScene.metaModels[modelId];
if (!metaModel) {
return;
}
const modelMemento = new ModelMemento();
modelMemento.saveObjects(this.viewer.scene, metaModel, {
visible: true,
edges: true,
xrayed: true,
highlighted: true,
selected: true,
clippable: true,
pickable: true,
colorize: false, // We don&apos;t colorize objects yet - also messes up point clouds
opacity: false // FIXME: Restoring opacity broken by colorize fix - details at https://github.com/xeokit/xeokit-sdk/issues/239
});
this._modelMementos[modelId] = modelMemento;
}
_restoreModelMemento(modelId) {
const metaModel = this.viewer.metaScene.metaModels[modelId];
if (!metaModel) {
return;
}
const modelMemento = this._modelMementos[modelId];
modelMemento.restoreObjects(this.viewer.scene, metaModel);
}
_destroyModelMemento(modelId) {
delete this._modelMementos[modelId];
}
reset() {
const scene = this.viewer.scene;
const modelIds = scene.modelIds;
for (var i = 0, len = modelIds.length; i &lt; len; i++) {
const modelId = modelIds[i];
this._restoreModelMemento(modelId);
}
this.bimViewer.unShowObjectInExplorers();
this.fire(&quot;reset&quot;, true);
this._resetCamera();
}
_resetCamera() {
const viewer = this.viewer;
const scene = viewer.scene;
const aabb = scene.getAABB(scene.visibleObjectIds);
const diag = math.getAABB3Diag(aabb);
const center = math.getAABB3Center(aabb, tempVec3a);
const camera = scene.camera;
const fitFOV = camera.perspective.fov;
const dist = Math.abs(diag / Math.tan(45 * math.DEGTORAD));
const dir = math.normalizeVec3((camera.yUp) ? [-0.5, -0.7071, -0.5] : [-1, 1, -1]);
const up = math.normalizeVec3((camera.yUp) ? [-0.5, 0.7071, -0.5] : [-1, 1, 1]);
viewer.cameraControl.pivotPos = center;
viewer.cameraControl.planView = false;
viewer.cameraFlight.flyTo({
look: center,
eye: [center[0] - (dist * dir[0]), center[1] - (dist * dir[1]), center[2] - (dist * dir[2])],
up: up,
orthoScale: diag * 1.3,
projection: &quot;perspective&quot;,
duration: 1
});
}
}
export {ResetAction};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+144
View File
@@ -0,0 +1,144 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/SectionMode.js | xeokit-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-viewer"><meta property="og:site_name" content="xeokit-viewer"><meta property="og:title" content="xeokit-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#ifcobjectdefaults">IFCObjectDefaults</a><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IFCObjectDefaults">IFCObjectDefaults</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/SectionMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {SectionPlanesPlugin} from &quot;@xeokit/xeokit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js&quot;;
/** @private */
class SectionMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
if (!cfg.sectionPlanesOverviewCanvasElement) {
throw &quot;Missing config: sectionPlanesOverviewCanvasElement&quot;;
}
const buttonElement = cfg.buttonElement;
const sectionPlanesOverviewCanvasElement = cfg.sectionPlanesOverviewCanvasElement;
this._sectionPlanesPlugin = new SectionPlanesPlugin(this.viewer, {
overviewCanvas: sectionPlanesOverviewCanvasElement
});
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
this._sectionPlanesPlugin.setOverviewVisible(active);
if (!active) {
this._sectionPlanesPlugin.hideControl();
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (!this.getEnabled()) {
return;
}
const active = this.getActive();
this.setActive(!active);
event.preventDefault();
});
this.viewerUI.on(&quot;reset&quot;, () =&gt; {
this.clear();
this.setActive(false);
});
this._initSectionMode();
}
_initSectionMode() {
this._onPickedSurface = this.viewer.cameraControl.on(&quot;pickedSurface&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
const sectionPlane = this._sectionPlanesPlugin.createSectionPlane({
pos: e.worldPos,
dir: [-e.worldNormal[0], -e.worldNormal[1], -e.worldNormal[2]]
});
this._sectionPlanesPlugin.showControl(sectionPlane.id);
});
}
clear() {
this._sectionPlanesPlugin.clear();
}
destroy() {
this._sectionPlanesPlugin.destroy();
super.destroy();
}
}
export {SectionMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+270
View File
@@ -0,0 +1,270 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/SectionTool.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/SectionTool.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {SectionToolContextMenu} from &quot;./../contextMenus/SectionToolContextMenu.js&quot;;
import {math, SectionPlanesPlugin} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
/** @private */
class SectionTool extends Controller { // XX
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
if (!cfg.menuButtonElement) {
throw &quot;Missing config: menuButtonElement&quot;;
}
this._buttonElement = cfg.buttonElement;
this._counterElement = cfg.counterElement;
this._menuButtonElement = cfg.menuButtonElement;
this._menuButtonArrowElement = cfg.menuButtonArrowElement;
this._sectionPlanesPlugin = new SectionPlanesPlugin(this.viewer, {});
this._sectionToolContextMenu = new SectionToolContextMenu({
sectionPlanesPlugin: this._sectionPlanesPlugin,
hideOnMouseDown: false,
hideOnAction: false
});
this._sectionPlanesPlugin.setOverviewVisible(false);
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
this._buttonElement.classList.add(&quot;disabled&quot;);
if (this._counterElement) {
this._counterElement.classList.add(&quot;disabled&quot;);
}
this._menuButtonElement.classList.add(&quot;disabled&quot;);
this._menuButtonArrowElement.classList.add(&quot;disabled&quot;);
} else {
this._buttonElement.classList.remove(&quot;disabled&quot;);
if (this._counterElement) {
this._counterElement.classList.remove(&quot;disabled&quot;);
}
this._menuButtonElement.classList.remove(&quot;disabled&quot;);
this._menuButtonArrowElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
this._buttonElement.classList.add(&quot;active&quot;);
if (this._counterElement) {
this._counterElement.classList.add(&quot;active&quot;);
}
this._menuButtonElement.classList.add(&quot;active&quot;);
this._menuButtonArrowElement.classList.add(&quot;active&quot;);
} else {
this._buttonElement.classList.remove(&quot;active&quot;);
if (this._counterElement) {
this._counterElement.classList.remove(&quot;active&quot;);
}
this._menuButtonElement.classList.remove(&quot;active&quot;);
this._menuButtonArrowElement.classList.remove(&quot;active&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (!active) {
this._sectionPlanesPlugin.hideControl();
}
});
this._buttonElement.addEventListener(&quot;click&quot;, (e) =&gt; {
if (!this.getEnabled()) {
return;
}
if (e.target === this._menuButtonElement || e.target.parentNode === this._menuButtonElement) {
return;
}
const active = this.getActive();
this.setActive(!active);
e.preventDefault();
});
document.addEventListener(&quot;mousedown&quot;, (e) =&gt; {
if (e.target.classList.contains(&quot;xeokit-context-menu-item&quot;)) {
// Allow click on menu item
return;
}
if (e.target === this._menuButtonElement || e.target.parentNode === this._menuButtonElement) {
e.preventDefault();
if (this._sectionToolContextMenu.shown) {
this._sectionToolContextMenu.hide();
} else {
this._sectionToolContextMenu.context = {
bimViewer: this.bimViewer,
viewer: this.viewer,
sectionTool: this
};
const rect = this._menuButtonElement.getBoundingClientRect();
this._sectionToolContextMenu.show(rect.left, rect.bottom + 5);
}
} else {
this._sectionToolContextMenu.hide();
}
});
this._sectionToolContextMenu.on(&quot;shown&quot;, () =&gt; {
this._menuButtonArrowElement.classList.remove(&quot;xeokit-arrow-down&quot;);
this._menuButtonArrowElement.classList.add(&quot;xeokit-arrow-up&quot;);
});
this._sectionToolContextMenu.on(&quot;hidden&quot;, () =&gt; {
this._menuButtonArrowElement.classList.remove(&quot;xeokit-arrow-up&quot;);
this._menuButtonArrowElement.classList.add(&quot;xeokit-arrow-down&quot;);
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.clear();
this.setActive(false);
});
this.viewer.scene.on(&quot;sectionPlaneCreated&quot;, () =&gt; {
this._updateSectionPlanesCount();
});
this.viewer.scene.on(&quot;sectionPlaneDestroyed&quot;, () =&gt; {
this._updateSectionPlanesCount();
});
this._initSectionMode();
}
_initSectionMode() {
this.viewer.scene.input.on(&quot;mouseclicked&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
const pickResult = this.viewer.scene.pick({
canvasPos: coords,
pickSurface: true // &lt;&lt;------ This causes picking to find the intersection point on the entity
});
if (pickResult) {
const sectionPlane = this._sectionPlanesPlugin.createSectionPlane({
pos: pickResult.worldPos,
dir: math.mulVec3Scalar(pickResult.worldNormal, -1)
});
this._sectionPlanesPlugin.showControl(sectionPlane.id);
}
});
this._updateSectionPlanesCount();
}
_updateSectionPlanesCount() {
if (this._counterElement) {
this._counterElement.innerText = (&quot;&quot; + this.getNumSections());
}
}
getNumSections() {
return Object.keys(this.viewer.scene.sectionPlanes).length;
}
clear() {
this._sectionPlanesPlugin.clear();
this._updateSectionPlanesCount();
}
flipSections() {
this._sectionPlanesPlugin.flipSectionPlanes();
}
enableSections() {
const sectionPlanes = this.viewer.scene.sectionPlanes;
for (let id in sectionPlanes) {
const sectionPlane = sectionPlanes[id];
sectionPlane.active = true;
}
}
disableSections() {
const sectionPlanes = this.viewer.scene.sectionPlanes;
for (let id in sectionPlanes) {
const sectionPlane = sectionPlanes[id];
sectionPlane.active = false;
}
}
hideControl() {
this._sectionPlanesPlugin.hideControl();
}
destroy() {
this._sectionPlanesPlugin.destroy();
this._sectionToolContextMenu.destroy();
super.destroy();
}
}
export {SectionTool};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+158
View File
@@ -0,0 +1,158 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/SelectMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#ifcobjectdefaults">IFCObjectDefaults</a><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-IFCObjectDefaults">IFCObjectDefaults</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/SelectMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {math} from &quot;@xeokit/xeokit-sdk/src/viewer/scene/math/math.js&quot;;
function closeEnough(p, q) {
const CLICK_DIST = 4;
return (Math.abs(p[0] - q[0]) &lt; 4) &amp;&amp; (Math.abs(p[1] - q[1]) &lt; CLICK_DIST);
}
/** @private */
class SelectMode extends Controller {
constructor(parent, cfg) {
super(parent);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
} else {
buttonElement.classList.remove(&quot;active&quot;);
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (!this.getEnabled()) {
return;
}
const active = this.getActive();
this.setActive(!active);
event.preventDefault();
});
this.viewerUI.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
this._initSectionMode();
}
_initSectionMode() {
const viewer = this.viewer;
const cameraControl = viewer.cameraControl;
var entity = null;
this._onHover = cameraControl.on(&quot;hover&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
entity = e.entity;
entity.highlighted = true;
});
this._onHoverOff = cameraControl.on(&quot;hoverOff&quot;, (e) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
entity.highlighted = false;
entity = null;
}
});
const lastCoords = math.vec2();
this._onMousedown = viewer.scene.input.on(&quot;mousedown&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
lastCoords[0] = coords[0];
lastCoords[1] = coords[1];
});
this._onMouseup = viewer.scene.input.on(&quot;mouseup&quot;, (coords) =&gt; {
if (!this.getActive() || !this.getEnabled()) {
return;
}
if (entity) {
if (!closeEnough(lastCoords, coords)) {
entity = null;
return;
}
entity.selected = !entity.selected;
entity = null;
}
});
}
}
export {SelectMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+112
View File
@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/SelectionTool.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/SelectionTool.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class SelectionTool extends Controller {
constructor(parent, cfg) {
super(parent);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
const buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
buttonElement.classList.add(&quot;disabled&quot;);
} else {
buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this.on(&quot;active&quot;, (active) =&gt; {
if (active) {
buttonElement.classList.add(&quot;active&quot;);
this._onPick = this.viewer.cameraControl.on(&quot;picked&quot;, (pickResult) =&gt; {
if (!pickResult.entity) {
return;
}
pickResult.entity.selected = !pickResult.entity.selected;
});
} else {
buttonElement.classList.remove(&quot;active&quot;);
if (this._onPick !== undefined) {
this.viewer.cameraControl.off(this._onPick);
this._onPick = undefined;
}
}
});
buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.bimViewer._sectionTool.hideControl();
const active = this.getActive();
this.setActive(!active);
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(false);
});
}
}
export {SelectionTool};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/ShowSpacesMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/ShowSpacesMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
/** @private */
class ShowSpacesMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
this._buttonElement = cfg.buttonElement;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
this._buttonElement.classList.add(&quot;disabled&quot;);
} else {
this._buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this._buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.setActive(!this.getActive(), () =&gt; {
});
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(false); // IfcSpaces hidden by default
});
this.viewer.scene.on(&quot;modelLoaded&quot;, (modelId) =&gt; {
if (!this._active) {
const objectIds = this.viewer.metaScene.getObjectIDsByType(&quot;IfcSpace&quot;);
this.viewer.scene.setObjectsCulled(objectIds, true);
}
});
this._active = false;
this._buttonElement.classList.remove(&quot;active&quot;);
}
setActive(active) {
if (this._active === active) {
return;
}
this._active = active;
if (active) {
this._buttonElement.classList.add(&quot;active&quot;);
this._enterShowSpacesMode();
this.fire(&quot;active&quot;, this._active);
} else {
this._buttonElement.classList.remove(&quot;active&quot;);
this._exitShowSpacesMode();
this.fire(&quot;active&quot;, this._active);
}
}
_enterShowSpacesMode() {
const viewer = this.viewer;
const scene = viewer.scene;
const metaScene = viewer.metaScene;
const objectIds = metaScene.getObjectIDsByType(&quot;IfcSpace&quot;);
scene.setObjectsCulled(objectIds, false);
}
_exitShowSpacesMode() {
const viewer = this.viewer;
const scene = viewer.scene;
const metaScene = viewer.metaScene;
const objectIds = metaScene.getObjectIDsByType(&quot;IfcSpace&quot;);
scene.setObjectsCulled(objectIds, true);
}
}
export {ShowSpacesMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+232
View File
@@ -0,0 +1,232 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/ThreeDMode.js | xeokit-bim-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="BIM viewer built on xeokit"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-bim-viewer"><meta property="og:site_name" content="xeokit-bim-viewer"><meta property="og:title" content="xeokit-bim-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="BIM viewer built on xeokit"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-bim-viewer"><meta property="twitter:description" content="BIM viewer built on xeokit"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-bim-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/BIMViewer.js~BIMViewer.html">BIMViewer</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#collision">collision</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/collision/ObjectsKdTree3.js~ObjectsKdTree3.html">ObjectsKdTree3</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/ThreeDMode.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {math} from &quot;@xeokit/xeokit-sdk/dist/xeokit-sdk.es.js&quot;;
const tempVec3a = math.vec3();
/** @private */
class ThreeDMode extends Controller {
constructor(parent, cfg) {
super(parent, cfg);
if (!cfg.buttonElement) {
throw &quot;Missing config: buttonElement&quot;;
}
this._saveOrthoActive = null;
this._buttonElement = cfg.buttonElement;
this._cameraControlNavModeMediator = cfg.cameraControlNavModeMediator;
this._active = false;
this.on(&quot;enabled&quot;, (enabled) =&gt; {
if (!enabled) {
this._buttonElement.classList.add(&quot;disabled&quot;);
} else {
this._buttonElement.classList.remove(&quot;disabled&quot;);
}
});
this._buttonElement.addEventListener(&quot;click&quot;, (event) =&gt; {
if (this.getEnabled()) {
this.bimViewer._sectionTool.hideControl();
this.setActive(!this.getActive(), () =&gt; { // Animated
});
}
event.preventDefault();
});
this.bimViewer.on(&quot;reset&quot;, () =&gt; {
this.setActive(true, () =&gt; { // Animated
});
});
}
setEnabled(enabled) {
super.setEnabled(enabled);
this._saveOrthoActive = this.bimViewer._orthoMode.getActive();
}
setActive(active, done) {
if (this._active === active) {
if (done) {
done();
}
return;
}
this._active = active;
if (active) {
this._buttonElement.classList.add(&quot;active&quot;);
if (done) {
this._enterThreeDMode(() =&gt; {
this.fire(&quot;active&quot;, this._active);
done();
});
} else {
this._enterThreeDMode();
this.fire(&quot;active&quot;, this._active);
}
} else {
this._buttonElement.classList.remove(&quot;active&quot;);
if (done) {
this._exitThreeDMode(() =&gt; {
this.fire(&quot;active&quot;, this._active);
done();
});
} else {
this._exitThreeDMode();
this.fire(&quot;active&quot;, this._active);
}
}
}
_enterThreeDMode(done) {
const viewer = this.viewer;
const scene = viewer.scene;
const aabb = scene.getAABB(scene.visibleObjectIds);
const diag = math.getAABB3Diag(aabb);
const center = math.getAABB3Center(aabb, tempVec3a);
const dist = Math.abs(diag / Math.tan(65.0 / 2)); // TODO: fovy match with CameraFlight
const camera = scene.camera;
const dir = (camera.yUp) ? [-1, -1, -1] : [1, 1, 1];
const up = (camera.yUp) ? [-1, 1, -1] : [-1, 1, 1];
viewer.cameraControl.pivotPos = center;
this.bimViewer._navCubeMode.setActive(true);
this.bimViewer._firstPersonMode.setEnabled(true);
this._cameraControlNavModeMediator.setThreeDModeActive(true);
this.bimViewer._sectionTool.setEnabled(true);
this.bimViewer._orthoMode.setEnabled(true);
if (done) {
viewer.cameraFlight.flyTo({
look: center,
eye: [center[0] - (dist * dir[0]), center[1] - (dist * dir[1]), center[2] - (dist * dir[2])],
up: up,
orthoScale: diag * 1.3,
duration: 1,
projection: this._saveOrthoActive ? &quot;ortho&quot; : &quot;perspective&quot;
}, () =&gt; {
done();
});
} else {
viewer.cameraFlight.jumpTo({
look: center,
eye: [center[0] - (dist * dir[0]), center[1] - (dist * dir[1]), center[2] - (dist * dir[2])],
up: up,
orthoScale: diag * 1.3,
projection: this._saveOrthoActive ? &quot;ortho&quot; : &quot;perspective&quot;
});
}
}
_exitThreeDMode(done) {
const viewer = this.viewer;
const scene = viewer.scene;
const camera = scene.camera;
const aabb = scene.getAABB(scene.visibleObjectIds);
const look2 = math.getAABB3Center(aabb);
const diag = math.getAABB3Diag(aabb);
const fitFOV = 45; // fitFOV;
const sca = Math.abs(diag / Math.tan(fitFOV * math.DEGTORAD));
const orthoScale2 = diag * 1.3;
const eye2 = tempVec3a;
eye2[0] = look2[0] + (camera.worldUp[0] * sca);
eye2[1] = look2[1] + (camera.worldUp[1] * sca);
eye2[2] = look2[2] + (camera.worldUp[2] * sca);
const up2 = math.mulVec3Scalar(camera.worldForward, -1, []);
this.bimViewer._sectionTool.setActive(false);
this.bimViewer._firstPersonMode.setEnabled(false);
this._saveOrthoActive = this.bimViewer._orthoMode.getActive();
this.bimViewer._orthoMode.setEnabled(false);
this._cameraControlNavModeMediator.setThreeDModeActive(false);
if (done) {
viewer.cameraFlight.flyTo({
eye: eye2,
look: look2,
up: up2,
orthoScale: orthoScale2,
projection: &quot;ortho&quot;
}, () =&gt; {
this.bimViewer._navCubeMode.setActive(false);
});
} else {
viewer.cameraFlight.jumpTo({
eye: eye2,
look: look2,
up: up2,
orthoScale: orthoScale2,
projection: &quot;ortho&quot;
});
this.bimViewer._navCubeMode.setActive(false);
}
}
}
export {ThreeDMode};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
+177
View File
@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base data-ice="baseUrl" href="../../../">
<title data-ice="title">src/toolbar/Toolbar.js | xeokit-viewer</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
<script src="script/prettify/prettify.js"></script>
<script src="script/manual.js"></script>
<meta name="description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="og:type" content="website"><meta property="og:url" content="https://github.com/xeokit/xeokit-viewer"><meta property="og:site_name" content="xeokit-viewer"><meta property="og:title" content="xeokit-viewer"><meta property="og:image" content="./images/logo.jpg"><meta property="og:description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="og:author" content="http://xeolabs.com"><meta property="twitter:card" content="summary"><meta property="twitter:title" content="xeokit-viewer"><meta property="twitter:description" content="View large 3D BIM models in all major browsers and collaborate on issues using BCF"><meta property="twitter:image" content="./images/logo.jpg"></head>
<body class="layout-container" data-ice="rootContainer">
<header>
<a href="./" style="display: flex; align-items: center;"><img src="./image/brand_logo.jpg" style="width:34px;"></a>
<a href="identifiers.html">Reference</a>
<a href="source.html">Source</a>
<div class="search-box">
<span>
<img src="./image/search.png">
<span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
</span>
<ul class="search-result"></ul>
</div>
<a style="position:relative; top:3px;" href="https://github.com/xeokit/xeokit-viewer"><img width="20px" src="./image/github.png"></a></header>
<nav class="navigation" data-ice="nav"><div>
<ul>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/Controller.js~Controller.html">Controller</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/ViewerUI.js~ViewerUI.html">ViewerUI</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#explorer">explorer</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Classes.js~Classes.html">Classes</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Explorer.js~Explorer.html">Explorer</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Models.js~Models.html">Models</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Objects.js~Objects.html">Objects</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/explorer/Storeys.js~Storeys.html">Storeys</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#server">server</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/server/Server.js~Server.html">Server</a></span></span></li>
<li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#toolbar">toolbar</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/BCFMode.js~BCFMode.html">BCFMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/FirstPersonMode.js~FirstPersonMode.html">FirstPersonMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/FitAction.js~FitAction.html">FitAction</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/HideMode.js~HideMode.html">HideMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/NavCubeMode.js~NavCubeMode.html">NavCubeMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/OrthoMode.js~OrthoMode.html">OrthoMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/QueryMode.js~QueryMode.html">QueryMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/ResetAction.js~ResetAction.html">ResetAction</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/SectionMode.js~SectionMode.html">SectionMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/SelectMode.js~SelectMode.html">SelectMode</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/toolbar/Toolbar.js~Toolbar.html">Toolbar</a></span></span></li>
</ul>
</div>
</nav>
<div class="content" data-ice="content"><h1 data-ice="title">src/toolbar/Toolbar.js</h1>
<pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import {Controller} from &quot;../Controller.js&quot;;
import {SectionMode} from &quot;./SectionMode.js&quot;;
import {BCFMode} from &quot;./BCFMode.js&quot;;
import {HideMode} from &quot;./HideMode.js&quot;;
import {FirstPersonMode} from &quot;./FirstPersonMode.js&quot;;
import {OrthoMode} from &quot;./OrthoMode.js&quot;;
import {NavCubeMode} from &quot;./NavCubeMode.js&quot;;
import {FitAction} from &quot;./FitAction.js&quot;;
import {SelectMode} from &quot;./SelectMode.js&quot;;
import {QueryMode} from &quot;./QueryMode.js&quot;;
import {ResetAction} from &quot;./ResetAction.js&quot;;
/**
* @desc UI controller for a xeokit {@link Viewer} toolbar.
*/
class Toolbar extends Controller {
/** @private */
constructor(parent, cfg = {}) {
super(parent, cfg);
/** Resets the viewer to the state right after the most recent model was loaded.
* @type {ResetAction}
*/
this.reset = new ResetAction(this);
/** Flies the camera to show the entire model in view, from the current viewing angle.
* @type {FitAction}
*/
this.fit = new FitAction(this);
/**
* Controls first person mode.
* @type {FirstPersonMode}
*/
this.firstPerson = new FirstPersonMode(this, {
active: false
});
/**
* Controls orthographic mode.
* @type {OrthoMode}
*/
this.ortho = new OrthoMode(this, {
active: false
});
/** Click-to-hide mode.
* @type {HideMode}
*/
this.hide = new HideMode(this, {
active: false
});
/** Click-to-select mode.
* @type {SelectMode}
*/
this.select = new SelectMode(this, {
active: false
});
/** Click-to-query-element mode.
* @type {QueryMode}
*/
this.query = new QueryMode(this, {
queryPanelId: cfg.queryPanelId,
active: false
});
/**
* Controls section planes.
* @type {SectionMode}
*/
this.section = new SectionMode(this, {
sectionPlanesOverviewCanvasId: cfg.sectionPlanesOverviewCanvasId,
active: false
});
/**
* Manages BCF viewpoints.
* @type {BCFMode}
*/
this.bcf = new BCFMode(this, {
bcfPanelId: cfg.bcfPanelId,
active: false
});
/**
* Controls the NavCube.
* @type {NavCubeMode}
*/
this.navCube = new NavCubeMode(this, {
navCubeCanvasId: cfg.navCubeCanvasId,
active: true
});
this._mutexActivation([this.query, this.hide, this.select, this.section, this.bcf]);
this.firstPerson.setActive(false);
this.ortho.setActive(false);
this.navCube.setActive(true);
}
}
export {Toolbar};</code></pre>
</div>
<footer class="footer">
Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>
<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>