@cognite/reveal 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/src/public/migration/Cognite3DViewer.d.ts +58 -2
- package/core/src/public/migration/types.d.ts +24 -0
- package/index.js +37 -37
- package/index.map +1 -1
- package/package.json +2 -2
- package/packages/camera-manager/src/ComboControls.d.ts +34 -18
- package/packages/utilities/src/NumericRange.d.ts +1 -0
- package/tools.js +12 -12
- package/tools.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognite/reveal",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
|
|
5
5
|
"homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@tweenjs/tween.js": "^18.6.4",
|
|
27
27
|
"@types/three": "0.133.0",
|
|
28
28
|
"assert": "^2.0.0",
|
|
29
|
-
"comlink": "4.3.1",
|
|
29
|
+
"comlink": "^4.3.1",
|
|
30
30
|
"geo-three": "^0.0.15",
|
|
31
31
|
"glslify": "^7.1.1",
|
|
32
32
|
"glslify-import": "^3.1.0",
|
|
@@ -32,25 +32,34 @@ export default class ComboControls extends EventDispatcher {
|
|
|
32
32
|
minZoom: number;
|
|
33
33
|
maxZoom: number;
|
|
34
34
|
orthographicCameraDollyFactor: number;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
lookAtViewTarget: boolean;
|
|
36
|
+
useScrollTarget: boolean;
|
|
37
|
+
zoomToCursor: boolean;
|
|
38
|
+
minDeltaRatio: number;
|
|
39
|
+
maxDeltaRatio: number;
|
|
40
|
+
minDeltaDownscaleCoefficient: number;
|
|
41
|
+
maxDeltaDownscaleCoefficient: number;
|
|
42
|
+
private _temporarilyDisableDamping;
|
|
43
|
+
private readonly _camera;
|
|
44
|
+
private _firstPersonMode;
|
|
45
|
+
private readonly _reusableCamera;
|
|
46
|
+
private readonly _reusableVector3;
|
|
40
47
|
private readonly _accumulatedMouseMove;
|
|
41
|
-
private readonly
|
|
42
|
-
private readonly
|
|
43
|
-
private readonly
|
|
44
|
-
private readonly
|
|
45
|
-
private
|
|
46
|
-
private readonly
|
|
47
|
-
private
|
|
48
|
-
private readonly
|
|
49
|
-
private
|
|
50
|
-
private readonly
|
|
51
|
-
private readonly
|
|
52
|
-
private
|
|
53
|
-
private
|
|
48
|
+
private readonly _domElement;
|
|
49
|
+
private readonly _target;
|
|
50
|
+
private readonly _viewTarget;
|
|
51
|
+
private readonly _scrollTarget;
|
|
52
|
+
private readonly _targetEnd;
|
|
53
|
+
private readonly _spherical;
|
|
54
|
+
private _sphericalEnd;
|
|
55
|
+
private readonly _deltaTarget;
|
|
56
|
+
private _keyboard;
|
|
57
|
+
private readonly _offsetVector;
|
|
58
|
+
private readonly _panVector;
|
|
59
|
+
private readonly _raycaster;
|
|
60
|
+
private readonly _targetFPS;
|
|
61
|
+
private _targetFPSOverActualFPS;
|
|
62
|
+
private _isFocused;
|
|
54
63
|
constructor(camera: PerspectiveCamera | OrthographicCamera, domElement: HTMLElement);
|
|
55
64
|
update: (deltaTime: number) => boolean;
|
|
56
65
|
getState: () => {
|
|
@@ -58,8 +67,11 @@ export default class ComboControls extends EventDispatcher {
|
|
|
58
67
|
position: Vector3;
|
|
59
68
|
};
|
|
60
69
|
setState: (position: Vector3, target: Vector3) => void;
|
|
70
|
+
setViewTarget: (target: Vector3) => void;
|
|
71
|
+
setScrollTarget: (target: Vector3) => void;
|
|
61
72
|
triggerCameraChangeEvent: () => void;
|
|
62
73
|
private calculateShortestDeltaTheta;
|
|
74
|
+
private readonly convertPixelCoordinatesToNormalized;
|
|
63
75
|
private readonly onMouseDown;
|
|
64
76
|
private readonly onMouseUp;
|
|
65
77
|
private readonly onMouseWheel;
|
|
@@ -76,6 +88,10 @@ export default class ComboControls extends EventDispatcher {
|
|
|
76
88
|
private readonly rotateFirstPersonMode;
|
|
77
89
|
private readonly pan;
|
|
78
90
|
private readonly dollyOrthographicCamera;
|
|
91
|
+
private readonly calculateNewRadiusAndTargetOffsetLerp;
|
|
92
|
+
private readonly clampedMap;
|
|
93
|
+
private readonly calculateNewRadiusAndTargetOffsetScrollTarget;
|
|
94
|
+
private readonly dollyWithWheelScroll;
|
|
79
95
|
private readonly dollyPerspectiveCamera;
|
|
80
96
|
private readonly dolly;
|
|
81
97
|
private readonly getDollyDeltaDistance;
|
package/tools.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* Copyright 2021 Cognite AS
|
|
4
4
|
*/
|
|
5
|
-
function n(e,t){if(t(e))for(let r=0;r<e.children.length;r++)n(e.children[r],t)}function o(e,t){if(void 0===e)return;const{position:r,target:n}=e;return r.applyMatrix4(t),n.applyMatrix4(t),{position:r,target:n}}r.d(t,"t",(function(){return n})),r.d(t,"s",(function(){return o})),r.d(t,"d",(function(){return c})),r.d(t,"l",(function(){return a})),r.d(t,"k",(function(){return l})),r.d(t,"h",(function(){return d})),r.d(t,"m",(function(){return h})),r.d(t,"e",(function(){return w})),r.d(t,"q",(function(){return x})),r.d(t,"c",(function(){return S})),r.d(t,"a",(function(){return E})),r.d(t,"b",(function(){return P})),r.d(t,"o",(function(){return D})),r.d(t,"p",(function(){return
|
|
5
|
+
function n(e,t){if(t(e))for(let r=0;r<e.children.length;r++)n(e.children[r],t)}function o(e,t){if(void 0===e)return;const{position:r,target:n}=e;return r.applyMatrix4(t),n.applyMatrix4(t),{position:r,target:n}}r.d(t,"t",(function(){return n})),r.d(t,"s",(function(){return o})),r.d(t,"d",(function(){return c})),r.d(t,"l",(function(){return a})),r.d(t,"k",(function(){return l})),r.d(t,"h",(function(){return d})),r.d(t,"m",(function(){return h})),r.d(t,"e",(function(){return w})),r.d(t,"q",(function(){return x})),r.d(t,"c",(function(){return S})),r.d(t,"a",(function(){return E})),r.d(t,"b",(function(){return P})),r.d(t,"o",(function(){return D})),r.d(t,"p",(function(){return N})),r.d(t,"i",(function(){return T})),r.d(t,"j",(function(){return O})),r.d(t,"f",(function(){return z})),r.d(t,"g",(function(){return $})),r.d(t,"n",(function(){return j})),r.d(t,"r",(function(){return F}));var i=r(0);
|
|
6
6
|
/*!
|
|
7
7
|
* Copyright 2021 Cognite AS
|
|
8
8
|
*/class s{static color(e){const t=s._colors.get(e);if(void 0!==t)return t;const r=s.generateRandomColor();return s._colors.set(e,r),r}static colorRGB(e){const t=s.color(e);return[Math.floor(255*t.r),Math.floor(255*t.g),Math.floor(255*t.b)]}static colorCSS(e){const[t,r,n]=s.colorRGB(e);return`rgb(${t}, ${r}, ${n})`}static generateRandomColor(){const e=Math.random(),t=.4+.6*Math.random(),r=.3+.4*Math.random();return(new i.Color).setHSL(e,t,r)}}
|
|
@@ -21,13 +21,13 @@ function a(e,t){const r=t.getBoundingClientRect();if(e instanceof MouseEvent)ret
|
|
|
21
21
|
*/function l(e,t){throw new Error(t||"Unexpected object: "+e)}
|
|
22
22
|
/*!
|
|
23
23
|
* Copyright 2021 Cognite AS
|
|
24
|
-
*/class d{constructor(e,t){if(t<0)throw new Error("Range cannot have negative number of elements");this.from=e,this.count=t,this.toInclusive=e+t-1}static createFromInterval(e,t){return new d(e,t-e+1)}*values(){for(let e=this.from;e<=this.toInclusive;++e)yield e}toArray(){return Array.from(this.values())}equal(e){return this.from===e.from&&this.count===e.count}contains(e){return e>=this.from&&e<=this.toInclusive}intersects(e){return this.from<=e.toInclusive&&this.toInclusive>=e.from}intersectsOrCoinciding(e){return this.from<=e.toInclusive+1&&this.toInclusive+1>=e.from}intersectionWith(e){return this.intersects(e)?d.createFromInterval(Math.max(this.from,e.from),Math.min(this.toInclusive,e.toInclusive)):void 0}isInside(e){return this.from>=e.from&&this.toInclusive<=e.toInclusive}union(e){return d.createFromInterval(Math.min(this.from,e.from),Math.max(this.toInclusive,e.toInclusive))}forEach(e){for(let t=this.from;t<=this.toInclusive;++t)e(t)}toString(){return"("+this.from+", "+this.toInclusive+")"}}
|
|
24
|
+
*/class d{constructor(e,t){if(t<0)throw new Error("Range cannot have negative number of elements");this.from=e,this.count=t,this.toInclusive=e+t-1}static createFromInterval(e,t){return new d(e,t-e+1)}*values(){for(let e=this.from;e<=this.toInclusive;++e)yield e}toArray(){return Array.from(this.values())}equal(e){return this.from===e.from&&this.count===e.count}contains(e){return e>=this.from&&e<=this.toInclusive}intersects(e){return this.from<=e.toInclusive&&this.toInclusive>=e.from}intersectsOrCoinciding(e){return this.from<=e.toInclusive+1&&this.toInclusive+1>=e.from}intersectionWith(e){return this.intersects(e)?d.createFromInterval(Math.max(this.from,e.from),Math.min(this.toInclusive,e.toInclusive)):void 0}isInside(e){return this.from>=e.from&&this.toInclusive<=e.toInclusive}union(e){return d.createFromInterval(Math.min(this.from,e.from),Math.max(this.toInclusive,e.toInclusive))}forEach(e){for(let t=this.from;t<=this.toInclusive;++t)e(t)}toString(){return"("+this.from+", "+this.toInclusive+")"}static isNumericRange(e){if(!e)return!1;const t=e;return void 0!==t.from&&void 0!==t.count&&void 0!==t.toInclusive}}
|
|
25
25
|
/*!
|
|
26
26
|
* Copyright 2021 Cognite AS
|
|
27
27
|
*/function h(e){const t=Math.max(1,m(Math.sqrt(e)));return{width:t,height:Math.max(1,m(e/t))}}const u=Math.log(2);function m(e){return Math.pow(2,Math.ceil(Math.log(e)/u))}var p=r(7),f=r.n(p);class g{constructor(e,t){this.left=e,this.right=t,this.maxSubtreeDepth=Math.max(this.left.maxSubtreeDepth,this.right.maxSubtreeDepth)+1,this.range=d.createFromInterval(this.left.range.from,this.right.range.toInclusive),this.count=this.left.count+this.right.count}static fromIndexNodesAndBalance(e,t){return e.range.from>t.range.toInclusive+1?new g(t,e).balance():e.range.toInclusive+1<t.range.from?new g(e,t).balance():void f()(!1,"Internal error in IndexSet: Overlapping nodes")}traverse(e){this.left.traverse(e),this.right.traverse(e)}contains(e){return!!this.range.contains(e)&&(this.left.contains(e)||this.right.contains(e))}addRange(e){if(!e.intersectsOrCoinciding(this.range)){if(e.from<this.range.from){const t=this.left.addRange(e);return g.fromIndexNodesAndBalance(t,this.right)}{const t=this.right.addRange(e);return g.fromIndexNodesAndBalance(this.left,t)}}const t=e.intersectsOrCoinciding(this.left.range),r=e.intersectsOrCoinciding(this.right.range);if(t&&r){const[t,r]=this.left.soak(e),[n,o]=this.right.soak(e),i=r.union(o);if(void 0===t&&void 0===n)return new v(i);if(void 0===t&&void 0!==n)return n.addRange(i);if(void 0===n&&void 0!==t)return t.addRange(i);return g.fromIndexNodesAndBalance(t,n).addRange(i)}return t?g.fromIndexNodesAndBalance(this.left.addRange(e),this.right):r?g.fromIndexNodesAndBalance(this.left,this.right.addRange(e)):this.left.maxSubtreeDepth<this.right.maxSubtreeDepth?g.fromIndexNodesAndBalance(this.left.addRange(e),this.right):g.fromIndexNodesAndBalance(this.left,this.right.addRange(e))}removeRange(e){if(!e.intersects(this.range))return this;const[t,r]=this.soak(e);let n=void 0,o=void 0;if(r.from<e.from&&(n=d.createFromInterval(r.from,e.from-1)),r.toInclusive>e.toInclusive&&(o=d.createFromInterval(e.toInclusive+1,r.toInclusive)),void 0===t)return void 0!==n&&void 0!==o?g.fromIndexNodesAndBalance(new v(n),new v(o)):null!=n?new v(n):null!=o?new v(o):void 0;{let e=t;return void 0!==n&&(e=e.addRange(n)),void 0!==o&&(e=e.addRange(o)),e}}balance(){const e=this.left.maxSubtreeDepth,t=this.right.maxSubtreeDepth;if(t+2<=e){const e=this.left.rotateSmallerRight();return new g(e,this.right).rotateRight().balance()}if(e+2<=t){const e=this.right.rotateSmallerLeft();return new g(this.left,e).rotateLeft().balance()}return this}clone(){return g.fromIndexNodesAndBalance(this.left.clone(),this.right.clone())}hasIntersectionWith(e){return!!e.range.intersects(this.range)&&(this.range.isInside(e.range)?e.hasIntersectionWith(this):!(!this.left.range.intersects(e.range)||!this.left.hasIntersectionWith(e))||!(!this.right.range.intersects(e.range)||!this.right.hasIntersectionWith(e)))}soak(e){let[t,r]=[this.left,e],[n,o]=[this.right,e];if(this.right.range.isInside(e)&&this.left.range.isInside(e))return[void 0,e];this.left.range.intersectsOrCoinciding(e)&&([t,r]=this.left.soak(e)),this.right.range.intersectsOrCoinciding(e)&&([n,o]=this.right.soak(e));const i=r.union(o);if(null==n)return[t,i];if(null==t)return[n,i];return[g.fromIndexNodesAndBalance(t,n),i]}rotateRight(){return"right"in this.left?new g(this.left.left,new g(this.left.right,this.right)):this}rotateLeft(){return"left"in this.right?new g(new g(this.left,this.right.left),this.right.right):this}rotateSmallerLeft(){if(this.left.maxSubtreeDepth>this.right.maxSubtreeDepth){let e=this.rotateRight();return e=e.rotateSmallerLeft(),e}return this}rotateSmallerRight(){if(this.right.maxSubtreeDepth>this.left.maxSubtreeDepth){let e=this.rotateLeft();return e=e.rotateSmallerRight(),e}return this}}
|
|
28
28
|
/*!
|
|
29
29
|
* Copyright 2021 Cognite AS../NumericRange
|
|
30
|
-
*/class v{constructor(e){this.range=e,this.maxSubtreeDepth=0,this.count=e.count}static fromInterval(e,t){return new v(d.createFromInterval(e,t))}traverse(e){e(this.range)}contains(e){return this.range.contains(e)}addRange(e){return this.range.intersectsOrCoinciding(e)?new v(this.range.union(e)):g.fromIndexNodesAndBalance(this,new v(e))}removeRange(e){if(!e.intersects(this.range))return this;if(this.range.isInside(e))return;let t=void 0,r=void 0;return this.range.from<e.from&&(t=d.createFromInterval(this.range.from,e.from-1)),this.range.toInclusive>e.toInclusive&&(r=d.createFromInterval(e.toInclusive+1,this.range.toInclusive)),null!=t&&null!=r?g.fromIndexNodesAndBalance(new v(t),new v(r)):null!=t?new v(t):null!=r?new v(r):void 0}hasIntersectionWith(e){return e.range.intersects(this.range)}soak(e){return this.range.intersectsOrCoinciding(e)?[void 0,this.range.union(e)]:[this,e]}clone(){return new v(this.range)}}class w{constructor(e){if(null==e)this.rootNode=void 0;else if(e
|
|
30
|
+
*/class v{constructor(e){this.range=e,this.maxSubtreeDepth=0,this.count=e.count}static fromInterval(e,t){return new v(d.createFromInterval(e,t))}traverse(e){e(this.range)}contains(e){return this.range.contains(e)}addRange(e){return this.range.intersectsOrCoinciding(e)?new v(this.range.union(e)):g.fromIndexNodesAndBalance(this,new v(e))}removeRange(e){if(!e.intersects(this.range))return this;if(this.range.isInside(e))return;let t=void 0,r=void 0;return this.range.from<e.from&&(t=d.createFromInterval(this.range.from,e.from-1)),this.range.toInclusive>e.toInclusive&&(r=d.createFromInterval(e.toInclusive+1,this.range.toInclusive)),null!=t&&null!=r?g.fromIndexNodesAndBalance(new v(t),new v(r)):null!=t?new v(t):null!=r?new v(r):void 0}hasIntersectionWith(e){return e.range.intersects(this.range)}soak(e){return this.range.intersectsOrCoinciding(e)?[void 0,this.range.union(e)]:[this,e]}clone(){return new v(this.range)}}class w{constructor(e){if(null==e)this.rootNode=void 0;else if(d.isNumericRange(e))this.addRange(e);else for(const t of e)this.add(t)}forEachRange(e){this.rootNode&&this.rootNode.traverse(e)}add(e){const t=new d(e,1);this.addRange(t)}addRange(e){this.rootNode?this.rootNode=this.rootNode.addRange(e):this.rootNode=new v(e)}remove(e){const t=new d(e,1);this.removeRange(t)}removeRange(e){this.rootNode&&(this.rootNode=this.rootNode.removeRange(e))}contains(e){return!!this.rootNode&&this.rootNode.contains(e)}get count(){return this.rootNode?this.rootNode.count:0}toRangeArray(){const e=[];return this.forEachRange(t=>{e.push(t)}),e}toIndexArray(){const e=[];return this.rootNode&&this.forEachRange(t=>{t.forEach(t=>{e.push(t)})}),e}toPlainSet(){const e=this.toIndexArray();return new Set(e)}invertedRanges(){const e=this.toRangeArray(),t=[];for(let r=0;r<e.length-1;r++)e[r].toInclusive+1>=e[r+1].from||t.push(d.createFromInterval(e[r].toInclusive+1,e[r+1].from-1));return t}unionWith(e){return this.rootNode?e.forEachRange(e=>{this.rootNode=this.rootNode.addRange(e)}):this.rootNode=e.rootNode,this}differenceWith(e){return this.rootNode&&e.forEachRange(e=>{var t;this.rootNode=null===(t=this.rootNode)||void 0===t?void 0:t.removeRange(e)}),this}hasIntersectionWith(e){if(e instanceof w)return void 0!==this.rootNode&&void 0!==e.rootNode&&this.rootNode.hasIntersectionWith(e.rootNode);for(const t of e)if(this.contains(t))return!0;return!1}intersectWith(e){if(this.rootNode&&e.rootNode){if(this.rootNode.range.from<e.rootNode.range.from){const t=d.createFromInterval(this.rootNode.range.from,e.rootNode.range.from-1);if(this.rootNode=this.rootNode.removeRange(t),!this.rootNode)return this}if(this.rootNode.range.toInclusive>e.rootNode.range.toInclusive){const t=d.createFromInterval(e.rootNode.range.toInclusive+1,this.rootNode.range.toInclusive);this.rootNode=this.rootNode.removeRange(t)}e.invertedRanges().forEach(e=>{this.rootNode&&(this.rootNode=this.rootNode.removeRange(e))})}else this.rootNode&&(this.rootNode=void 0);return this}clear(){this.rootNode=void 0}clone(){const e=new w;return this.rootNode&&(e.rootNode=this.rootNode.clone()),e}}
|
|
31
31
|
/*!
|
|
32
32
|
* Copyright 2021 Cognite AS
|
|
33
33
|
*/function x(e,t,r){const n=B(e);if(0==n)return;const o=_(0,-e);let i=C(M(n));const s=n/y(i);s<1&&(i-=1),i+=127,t[r]=128*o+C(i*y(-1)),t[r+1]=128*b(i,2)+b(C(128*s),128),t[r+2]=C(b(C(s*y(15)),y(8))),t[r+3]=C(y(23)*b(s,y(-15)))}function _(e,t){return t<e?0:1}function y(e){return Math.pow(2,e)}function b(e,t){return e-t*C(e/t)}function C(e){return Math.floor(e)}function M(e){return Math.log(e)/Math.log(2)}function B(e){return Math.abs(e)}
|
|
@@ -45,10 +45,10 @@ function a(e,t){const r=t.getBoundingClientRect();if(e instanceof MouseEvent)ret
|
|
|
45
45
|
*/function D(e){return[new i.Vector3(e.min.x,e.min.y,e.min.z),new i.Vector3(e.min.x,e.min.y,e.max.z),new i.Vector3(e.min.x,e.max.y,e.min.z),new i.Vector3(e.min.x,e.max.y,e.max.z),new i.Vector3(e.max.x,e.min.y,e.min.z),new i.Vector3(e.max.x,e.min.y,e.max.z),new i.Vector3(e.max.x,e.max.y,e.min.z),new i.Vector3(e.max.x,e.max.y,e.max.z)]}
|
|
46
46
|
/*!
|
|
47
47
|
* Copyright 2021 Cognite AS
|
|
48
|
-
*/function
|
|
48
|
+
*/function N(){let e=!1;var t;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e}
|
|
49
49
|
/*!
|
|
50
50
|
* Copyright 2021 Cognite AS
|
|
51
|
-
*/class
|
|
51
|
+
*/class T{constructor(e){this._originalState={},this._renderer=e,this._originalState={}}setClearColor(e,t){this._originalState={clearColor:this._renderer.getClearColor(new i.Color),clearAlpha:this._renderer.getClearAlpha(),...this._originalState},this._renderer.setClearColor(e,t)}setSize(e,t){this._originalState={size:this._renderer.getSize(new i.Vector2),...this._originalState},this._renderer.setSize(e,t)}set localClippingEnabled(e){this._originalState={localClippingEnabled:this._renderer.localClippingEnabled,...this._originalState},this._renderer.localClippingEnabled=e}set autoClear(e){this._originalState={autoClear:this._renderer.autoClear,...this._originalState},this._renderer.autoClear=e}setRenderTarget(e){this._originalState={renderTarget:this._renderer.getRenderTarget(),...this._originalState},this._renderer.setRenderTarget(e)}resetState(){void 0!==this._originalState.autoClear&&(this._renderer.autoClear=this._originalState.autoClear),void 0!==this._originalState.clearColor&&this._renderer.setClearColor(this._originalState.clearColor,this._originalState.clearAlpha),void 0!==this._originalState.localClippingEnabled&&(this._renderer.localClippingEnabled=this._originalState.localClippingEnabled),void 0!==this._originalState.size&&this._renderer.setSize(this._originalState.size.width,this._originalState.size.height),void 0!==this._originalState.renderTarget&&this._renderer.setRenderTarget(this._originalState.renderTarget),this._originalState={}}}var A=r(22);
|
|
52
52
|
/*!
|
|
53
53
|
* Copyright 2021 Cognite AS
|
|
54
54
|
*/const F={publicPath:""};
|
|
@@ -57,7 +57,7 @@ function a(e,t){const r=t.getBoundingClientRect();if(e instanceof MouseEvent)ret
|
|
|
57
57
|
*/var R=r(10);
|
|
58
58
|
/*!
|
|
59
59
|
* Copyright 2021 Cognite AS
|
|
60
|
-
*/class O{constructor(){this.workerList=[];const e=this.determineNumberOfWorkers();for(let t=0;t<e;t++){const e={worker:Object(
|
|
60
|
+
*/class O{constructor(){this.workerList=[];const e=this.determineNumberOfWorkers();for(let t=0;t<e;t++){const e={worker:Object(A.wrap)(this.createWorker()),activeJobCount:0,messageIdCounter:0};this.workerList.push(e)}(async function(e){let t;try{t=await e.getVersion()}catch(e){t="1.1.0"}const r="1.2.0",[n,o,i]=r.split(".").map(e=>parseInt(e,10)),[s,a,c]=t.split(".").map(e=>parseInt(e,10)),l=`Update your local copy of @cognite/reveal-parser-worker. Required version is ${r}. Received ${t}.`;if(n!==s)throw new Error(l);if(a<o)throw new Error(l);if(a===o&&c<i)throw new Error(l)}
|
|
61
61
|
/*!
|
|
62
62
|
* Copyright 2021 Cognite AS
|
|
63
63
|
*/)(this.workerList[0].worker).catch(e=>R.a.error(e)),this.workerObjUrl&&URL.revokeObjectURL(this.workerObjUrl)}static get defaultPool(){return O._defaultPool=O._defaultPool||new O,O._defaultPool}createWorker(){const e=(F.publicPath||r.p)+"reveal.parser.worker.js",t={name:"reveal.parser #"+this.workerList.length};if(function(e,t=location.origin){const r=e=>!e.match(/^.*\/\//);if(r(t))throw new Error("isTheSameDomain: the second argument must be an absolute url or omitted. Received "+t);if(r(e))return!0;try{const r=[e,t].map(e=>e.startsWith("//")?"https:"+e:e).map(e=>new URL(e));return r[0].host===r[1].host}catch(r){return console.error(`can not create URLs for ${e} and ${t}`,r),!1}}(e))return new Worker(e,t);if(!this.workerObjUrl){const t=new Blob([`importScripts(${JSON.stringify(e)});`],{type:"text/javascript"});this.workerObjUrl=URL.createObjectURL(t)}return new Worker(this.workerObjUrl,t)}async postWorkToAvailable(e){const t=this.workerList.reduce((e,t)=>e.activeJobCount>t.activeJobCount?t:e,this.workerList[0]);t.activeJobCount+=1;return await(async()=>{try{return await e(t.worker)}finally{t.activeJobCount-=1}})()}determineNumberOfWorkers(){return Math.max(2,Math.min(4,window.navigator.hardwareConcurrency||2))}}class V{constructor(e){this._value=e,this._lastAccessTime=Date.now()}get value(){return this.touch(),this._value}get lastAccessTime(){return this._lastAccessTime}touch(){this._lastAccessTime=Date.now()}}class z{constructor(e=50,t,r=10){this._data=new Map,this._maxElementsInCache=e,this._defaultCleanupCount=r,this._removeCallback=t}has(e){return this._data.has(e)}forceInsert(e,t){this.isFull()&&this.cleanCache(this._defaultCleanupCount),this.insert(e,t)}insert(e,t){if(!(this._data.size<this._maxElementsInCache))throw new Error("Cache full, please clean Cache and retry adding data");this._data.set(e,new V(t))}remove(e){if(void 0!==this._removeCallback){const t=this._data.get(e);void 0!==t&&this._removeCallback(t.value)}this._data.delete(e)}get(e){const t=this._data.get(e);if(void 0!==t)return t.value;throw new Error(`Cache element ${e} does not exist`)}isFull(){return!(this._data.size<this._maxElementsInCache)}cleanCache(e){const t=Array.from(this._data.entries());t.sort((e,t)=>t[1].lastAccessTime-e[1].lastAccessTime);for(let r=0;r<e;r++){const e=t.pop();if(void 0===e)return;this.remove(e[0])}}clear(){if(void 0!==this._removeCallback)for(const e of this._data.values())this._removeCallback(e.value);this._data.clear()}}
|
|
@@ -69,7 +69,7 @@ function a(e,t){const r=t.getBoundingClientRect();if(e instanceof MouseEvent)ret
|
|
|
69
69
|
*/function j(){this.array=null}
|
|
70
70
|
/*!
|
|
71
71
|
* Copyright 2021 Cognite AS
|
|
72
|
-
*/},function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return h})),r.d(t,"g",(function(){return f})),r.d(t,"f",(function(){return g})),r.d(t,"e",(function(){return v})),r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return u})),r.d(t,"n",(function(){return M})),r.d(t,"o",(function(){return B})),r.d(t,"p",(function(){return I})),r.d(t,"q",(function(){return S})),r.d(t,"m",(function(){return k})),r.d(t,"i",(function(){return P})),r.d(t,"t",(function(){return
|
|
72
|
+
*/},function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return h})),r.d(t,"g",(function(){return f})),r.d(t,"f",(function(){return g})),r.d(t,"e",(function(){return v})),r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return u})),r.d(t,"n",(function(){return M})),r.d(t,"o",(function(){return B})),r.d(t,"p",(function(){return I})),r.d(t,"q",(function(){return S})),r.d(t,"m",(function(){return k})),r.d(t,"i",(function(){return P})),r.d(t,"t",(function(){return N})),r.d(t,"k",(function(){return R})),r.d(t,"x",(function(){return A})),r.d(t,"r",(function(){return $})),r.d(t,"w",(function(){return V})),r.d(t,"j",(function(){return D})),r.d(t,"u",(function(){return T})),r.d(t,"v",(function(){return z})),r.d(t,"s",(function(){return j})),r.d(t,"h",(function(){return d})),r.d(t,"l",(function(){return L}));var n=r(0),o=r(1),i=r(24),s=r.n(i);
|
|
73
73
|
/*!
|
|
74
74
|
* Copyright 2021 Cognite AS
|
|
75
75
|
*/
|
|
@@ -116,7 +116,7 @@ function C(e,t,r,o){const i=Array.from(t.values()).reduce((e,t)=>Math.max(e,t.of
|
|
|
116
116
|
const E={p:new n.Vector3,instanceMatrix:new n.Matrix4,baseBounds:new n.Box3,instanceBounds:new n.Box3};function k(e,t,r,n){if(null===n)return r;const{p:o,instanceMatrix:i,baseBounds:s,instanceBounds:a}=E;s.makeEmpty();for(let n=r.triangleOffset;n<r.triangleOffset+r.triangleCount;++n){const r=t[3*n+0],i=t[3*n+1],a=t[3*n+2];o.set(e[r+0],e[r+1],e[r+2]),s.expandByPoint(o),o.set(e[i+0],e[i+1],e[i+2]),s.expandByPoint(o),o.set(e[a+0],e[a+1],e[a+2]),s.expandByPoint(o)}let c=0;const l=r.treeIndices.length,d=new Float32Array(r.instanceMatrices.length),h=new Float32Array(l),u=new Uint8Array(4*l);for(let e=0;e<l;++e)if(m=r.instanceMatrices,p=e,i.set(m[p+0],m[p+4],m[p+8],m[p+12],m[p+1],m[p+5],m[p+9],m[p+13],m[p+2],m[p+6],m[p+10],m[p+14],m[p+3],m[p+7],m[p+11],m[p+15]),a.copy(s).applyMatrix4(i),n.intersectsBox(a)){const t=r.instanceMatrices.subarray(16*e,16*(e+1)),n=r.colors.subarray(4*e,4*(e+1)),o=r.treeIndices[e];d.set(t,16*c),u.set(n,4*c),h[c]=o,c++}var m,p;if(l===c)return r;return{triangleCount:r.triangleCount,triangleOffset:r.triangleOffset,instanceMatrices:d.slice(0,16*c),colors:u.slice(0,4*c),treeIndices:h.slice(0,c)}}
|
|
117
117
|
/*!
|
|
118
118
|
* Copyright 2021 Cognite AS
|
|
119
|
-
*/const{boxGeometry:P,boxGeometryBoundingBox:D}=(()=>{const e=new n.BoxBufferGeometry(1,1,1,1,1,1);try{const t={index:e.getIndex(),position:e.getAttribute("position"),normal:e.getAttribute("normal")};return e.computeBoundingBox(),{boxGeometry:t,boxGeometryBoundingBox:e.boundingBox}}finally{e.dispose()}})(),{quadGeometry:
|
|
119
|
+
*/const{boxGeometry:P,boxGeometryBoundingBox:D}=(()=>{const e=new n.BoxBufferGeometry(1,1,1,1,1,1);try{const t={index:e.getIndex(),position:e.getAttribute("position"),normal:e.getAttribute("normal")};return e.computeBoundingBox(),{boxGeometry:t,boxGeometryBoundingBox:e.boundingBox}}finally{e.dispose()}})(),{quadGeometry:N,quadGeometryBoundingBox:T}=(()=>{const e=new n.PlaneBufferGeometry(1,1,1,1);try{const t={index:e.getIndex(),position:e.getAttribute("position"),normal:e.getAttribute("normal")};return e.computeBoundingBox(),{quadGeometry:t,quadGeometryBoundingBox:e.boundingBox}}finally{e.dispose()}})(),{trapeziumGeometry:A,trapeziumGeometryBoundingBox:F}=(()=>{const e=[0,0,0,1,1,1,2,2,2,3,3,3];return{trapeziumGeometry:{index:new n.BufferAttribute(new Uint16Array([0,1,3,0,3,2]),1),position:new n.BufferAttribute(new Float32Array(e),3)},trapeziumGeometryBoundingBox:(new n.Box3).setFromArray(e)}})(),{coneGeometry:R,coneGeometryBoundingBox:O}=(()=>{const e=[];e.push(-1,1,-1),e.push(-1,-1,-1),e.push(1,1,-1),e.push(1,-1,-1),e.push(1,1,1),e.push(1,-1,1);const t=new Uint16Array([1,2,0,1,3,2,3,4,2,3,5,4]);return{coneGeometry:{index:new n.BufferAttribute(t,1),position:new n.BufferAttribute(new Float32Array(e),3)},coneGeometryBoundingBox:(new n.Box3).setFromArray(e)}})(),{torusLodGeometries:V,torusGeometryBoundingBox:z}=(()=>{const e=(e,t)=>[e,2*t*Math.PI],t=[{tubularSegments:9,radialSegments:18},{tubularSegments:5,radialSegments:12},{tubularSegments:4,radialSegments:5}].map(({tubularSegments:t,radialSegments:r})=>function(e,t,r=((e,t)=>[e,t,0])){const o=[],i=[],s=1/e,a=1/t;for(let n=0;n<=t;n++)for(let t=0;t<=e;t++){const[e,i,c]=r(t*s,n*a);o.push(e||0,i||0,c||0)}for(let r=1;r<=t;r++)for(let t=1;t<=e;t++){const n=(e+1)*r+t-1,o=(e+1)*(r-1)+t-1,s=(e+1)*(r-1)+t,a=(e+1)*r+t;i.push(n,o,a),i.push(o,s,a)}return{index:new n.Uint16BufferAttribute(i,1),position:new n.Float32BufferAttribute(o,3)}}(r,t,e));return{torusLodGeometries:t,torusGeometryBoundingBox:(new n.Box3).setFromArray(t[t.length-1].position.array)}})(),{nutGeometry:$,nutGeometryBoundingBox:j}=(()=>{const e=new n.CylinderBufferGeometry(.5,.5,1,6);try{e.applyMatrix4((new n.Matrix4).makeRotationX(-Math.PI/2));const t={index:e.getIndex(),position:e.getAttribute("position"),normal:e.getAttribute("normal")};return{nutGeometry:t,nutGeometryBoundingBox:(new n.Box3).setFromArray(t.position.array)}}finally{e.dispose()}})();
|
|
120
120
|
/*!
|
|
121
121
|
* Copyright 2021 Cognite AS
|
|
122
122
|
*/
|
|
@@ -154,7 +154,7 @@ const a=(new s.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);function c(e,t){sw
|
|
|
154
154
|
*/class g{getModelUri(e){if(!(e instanceof f))throw new Error(`Model must be a ${f.name}, but got ${e.toString()}`);return Promise.resolve(`${location.origin}/${e.localPath}`)}async getModelMatrix(e){if(!(e instanceof f))throw new Error(`Model must be a ${f.name}, but got ${e.toString()}`);const t=new s.Matrix4;return c(t,i.RevealCadModel),t}getModelCamera(e){if(!(e instanceof f))throw new Error(`Model must be a ${f.name}, but got ${e.toString()}`);return Promise.resolve(void 0)}}
|
|
155
155
|
/*!
|
|
156
156
|
* Copyright 2021 Cognite AS
|
|
157
|
-
*/},function(e,t){e.exports=require("assert")},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12),o=r.n(n),i=r(10);const{VERSION:s,MIXPANEL_TOKEN:a}={VERSION:"2.2.
|
|
157
|
+
*/},function(e,t){e.exports=require("assert")},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12),o=r.n(n),i=r(10);const{VERSION:s,MIXPANEL_TOKEN:a}={VERSION:"2.2.2",WORKER_VERSION:"1.2.0",MIXPANEL_TOKEN:"8c900bdfe458e32b768450c20750853d",IS_DEVELOPMENT_MODE:!1};class c{constructor(e,t,r){o.a.init(a,{disable_cookie:!0,disable_persistence:!0,ip:!1,property_blacklist:["$city","$region","mp_country_code","$geo_source","$timezone","mp_lib","$lib_version","$device_id","$user_id","$current_url","$screen_width","$screen_height","$referrer","$referring_domain","$initial_referrer","$initial_referring_domain"]}),o.a.reset(),o.a.identify("reveal-single-user"),this._sessionProps={VERSION:s,project:"unknown",application:"unknown",sessionId:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},e&&(this._sessionProps.project=e),t&&(this._sessionProps.application=t),this.innerTrackEvent("init",r)}static init(e,t,r,n){if(void 0===globalThis.revealMetricsLogger&&e){const e=new c(t,r,n);globalThis.revealMetricsLogger={metricsLogger:e}}}innerTrackEvent(e,t){const r={...this._sessionProps,...t};o.a.track(e,r)}static trackEvent(e,t){globalThis.revealMetricsLogger&&globalThis.revealMetricsLogger.metricsLogger.innerTrackEvent(e,t)}static trackCreateTool(e){c.trackEvent("toolCreated",{toolName:e})}static trackLoadModel(e,t){c.trackEvent("loadModel",{...e,modelIdentifier:t})}static trackCadModelStyled(e,t){c.trackEvent("cadModelStyleAssigned",{nodeCollectionClassToken:e,style:t})}static trackError(e,t){i.a.error(e),this.trackEvent("error",{message:e.message,name:e.name,stack:e.stack,...t})}static trackCameraNavigation(e){c.trackEvent("cameraNavigated",e)}}
|
|
158
158
|
/*!
|
|
159
159
|
* Copyright 2021 Cognite AS
|
|
160
160
|
*/},,function(e,t,r){"use strict";var n=r(23);
|
|
@@ -171,7 +171,7 @@ const o={renderSize:new n.Vector2,position:new n.Vector3};function i(e,t,r=new n
|
|
|
171
171
|
/*!
|
|
172
172
|
* Copyright 2021 Cognite AS
|
|
173
173
|
*/
|
|
174
|
-
class o{constructor(e){this._clippingPlanes=[new n.Plane,new n.Plane,new n.Plane,new n.Plane,new n.Plane,new n.Plane],this._box=e||new n.Box3,this.updatePlanes()}set minX(e){this._box.min.x=e,this.updatePlanes()}get minX(){return this._box.min.x}set minY(e){this._box.min.y=e,this.updatePlanes()}get minY(){return this._box.min.y}set minZ(e){this._box.min.z=e,this.updatePlanes()}get minZ(){return this._box.min.z}set maxX(e){this._box.max.x=e,this.updatePlanes()}get maxX(){return this._box.max.x}set maxY(e){this._box.max.y=e,this.updatePlanes()}get maxY(){return this._box.max.y}set maxZ(e){this._box.max.z=e,this.updatePlanes()}get maxZ(){return this._box.max.z}updatePlanes(){this._clippingPlanes[0].setFromNormalAndCoplanarPoint(new n.Vector3(1,0,0),new n.Vector3(this.minX,0,0)),this._clippingPlanes[1].setFromNormalAndCoplanarPoint(new n.Vector3(-1,0,0),new n.Vector3(this.maxX,0,0)),this._clippingPlanes[2].setFromNormalAndCoplanarPoint(new n.Vector3(0,1,0),new n.Vector3(0,this.minY,0)),this._clippingPlanes[3].setFromNormalAndCoplanarPoint(new n.Vector3(0,-1,0),new n.Vector3(0,this.maxY,0)),this._clippingPlanes[4].setFromNormalAndCoplanarPoint(new n.Vector3(0,0,1),new n.Vector3(0,0,this.minZ)),this._clippingPlanes[5].setFromNormalAndCoplanarPoint(new n.Vector3(0,0,-1),new n.Vector3(0,0,this.maxZ))}get clippingPlanes(){return this._clippingPlanes}}},function(e,t){e.exports=require("lodash/debounce")},function(e,t){e.exports=require("lodash/range")},,function(e,t){e.exports=require("comlink")},function(e,t){e.exports=require("loglevel")},function(e,t){e.exports=require("skmeans")},,,,,,,,function(e,t){e.exports=require("lodash/merge")},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t),r.d(t,"HtmlOverlayTool",(function(){return u})),r.d(t,"ExplodedViewTool",(function(){return p})),r.d(t,"DebugCameraTool",(function(){return f})),r.d(t,"AxisViewTool",(function(){return S})),r.d(t,"Corner",(function(){return g})),r.d(t,"GeomapTool",(function(){return z})),r.d(t,"MapProviders",(function(){return I})),r.d(t,"MapboxMode",(function(){return E})),r.d(t,"MapboxStyle",(function(){return k})),r.d(t,"MapboxImageFormat",(function(){return D})),r.d(t,"BingMapType",(function(){return
|
|
174
|
+
class o{constructor(e){this._clippingPlanes=[new n.Plane,new n.Plane,new n.Plane,new n.Plane,new n.Plane,new n.Plane],this._box=e||new n.Box3,this.updatePlanes()}set minX(e){this._box.min.x=e,this.updatePlanes()}get minX(){return this._box.min.x}set minY(e){this._box.min.y=e,this.updatePlanes()}get minY(){return this._box.min.y}set minZ(e){this._box.min.z=e,this.updatePlanes()}get minZ(){return this._box.min.z}set maxX(e){this._box.max.x=e,this.updatePlanes()}get maxX(){return this._box.max.x}set maxY(e){this._box.max.y=e,this.updatePlanes()}get maxY(){return this._box.max.y}set maxZ(e){this._box.max.z=e,this.updatePlanes()}get maxZ(){return this._box.max.z}updatePlanes(){this._clippingPlanes[0].setFromNormalAndCoplanarPoint(new n.Vector3(1,0,0),new n.Vector3(this.minX,0,0)),this._clippingPlanes[1].setFromNormalAndCoplanarPoint(new n.Vector3(-1,0,0),new n.Vector3(this.maxX,0,0)),this._clippingPlanes[2].setFromNormalAndCoplanarPoint(new n.Vector3(0,1,0),new n.Vector3(0,this.minY,0)),this._clippingPlanes[3].setFromNormalAndCoplanarPoint(new n.Vector3(0,-1,0),new n.Vector3(0,this.maxY,0)),this._clippingPlanes[4].setFromNormalAndCoplanarPoint(new n.Vector3(0,0,1),new n.Vector3(0,0,this.minZ)),this._clippingPlanes[5].setFromNormalAndCoplanarPoint(new n.Vector3(0,0,-1),new n.Vector3(0,0,this.maxZ))}get clippingPlanes(){return this._clippingPlanes}}},function(e,t){e.exports=require("lodash/debounce")},function(e,t){e.exports=require("lodash/range")},,function(e,t){e.exports=require("comlink")},function(e,t){e.exports=require("loglevel")},function(e,t){e.exports=require("skmeans")},,,,,,,,function(e,t){e.exports=require("lodash/merge")},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t),r.d(t,"HtmlOverlayTool",(function(){return u})),r.d(t,"ExplodedViewTool",(function(){return p})),r.d(t,"DebugCameraTool",(function(){return f})),r.d(t,"AxisViewTool",(function(){return S})),r.d(t,"Corner",(function(){return g})),r.d(t,"GeomapTool",(function(){return z})),r.d(t,"MapProviders",(function(){return I})),r.d(t,"MapboxMode",(function(){return E})),r.d(t,"MapboxStyle",(function(){return k})),r.d(t,"MapboxImageFormat",(function(){return D})),r.d(t,"BingMapType",(function(){return N})),r.d(t,"BingMapImageFormat",(function(){return T})),r.d(t,"HereMapType",(function(){return A})),r.d(t,"HereMapScheme",(function(){return F})),r.d(t,"HereMapImageFormat",(function(){return R})),r.d(t,"TimelineTool",(function(){return j})),r.d(t,"Keyframe",(function(){return $})),r.d(t,"Cognite3DViewerToolBase",(function(){return i})),r.d(t,"DebugLoadedSectorsTool",(function(){return G}));var n=r(0),o=r(17);
|
|
175
175
|
/*!
|
|
176
176
|
* Copyright 2021 Cognite AS
|
|
177
177
|
*/
|
|
@@ -196,10 +196,10 @@ class u extends i{constructor(e,t){super(),this._htmlOverlays=new Map,this._comp
|
|
|
196
196
|
/*!
|
|
197
197
|
* Copyright 2021 Cognite AS
|
|
198
198
|
*/
|
|
199
|
-
class S extends i{constructor(e,t){super(),this._dynamicUpdatePosition=()=>{},this._updateClickDiv=()=>{},this._screenPosition=new n.Vector2,this._boxFaceGeometry=new n.PlaneGeometry(.85,.85,1,1),this._raycastCamera=new n.OrthographicCamera(-1,1,1,-1,-1,1),this._raycaster=new n.Raycaster,this._viewer=e,this._layoutConfig=_()(w()(B),t),this._axisGroup=new n.Group,this._interactiveObjects=this.createAxisCross(this._axisGroup),[this._updateClickDiv,this._disposeClickDiv]=this.createClickDiv(e),this.addAxisBoxToViewer(this._axisGroup,this._layoutConfig.position),l.a.trackCreateTool("AxisViewTool")}dispose(){super.dispose(),this._viewer.removeUiObject(this._axisGroup),this._disposeClickDiv()}createClickDiv(e){if(null===e.domElement.querySelector("canvas"))throw new Error("Could not find canvas");const t=document.createElement("div");t.style.position="absolute",t.style.height=this._layoutConfig.size+"px",t.style.width=this._layoutConfig.size+"px",t.style.zIndex="1";let r=0,n=0;return t.addEventListener("mousedown",t=>{const o=new MouseEvent("mousedown",{clientX:t.clientX,clientY:t.clientY,button:t.button});r=t.clientX,n=t.clientY,e.renderer.domElement.dispatchEvent(o)}),t.addEventListener("mousemove",t=>{const r=new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY,button:t.button});e.renderer.domElement.dispatchEvent(r)}),t.addEventListener("contextmenu",e=>e.preventDefault()),t.addEventListener("mouseup",t=>{const o=new MouseEvent("mouseup",{clientX:t.clientX,clientY:t.clientY,button:t.button}),i=e.domElement.getBoundingClientRect(),s=t.clientX-i.left,a=t.clientY-i.top;Math.abs(r-t.clientX)+Math.abs(n-t.clientY)<=10&&!this.handleClick(s,a,i)&&e.renderer.domElement.dispatchEvent(o)}),e.domElement.appendChild(t),[()=>{t.style.left=this._screenPosition.x+"px",t.style.bottom=this._screenPosition.y+"px"},()=>{e.domElement.removeChild(t)}]}addAxisBoxToViewer(e,t){const r=this._layoutConfig.size;if(function(e){return void 0!==e.xAbsolute&&void 0!==e.yAbsolute}(t))this._screenPosition.x=t.xAbsolute,this._screenPosition.y=t.yAbsolute;else{switch(t.corner){case g.BottomRight:this._screenPosition.y=t.padding.y,this._dynamicUpdatePosition=()=>{this._screenPosition.x=this._viewer.renderer.domElement.clientWidth-t.padding.x-r};break;case g.TopRight:this._dynamicUpdatePosition=()=>{this._screenPosition.x=this._viewer.renderer.domElement.clientWidth-t.padding.x-r,this._screenPosition.y=this._viewer.renderer.domElement.clientHeight-t.padding.y-r};break;case g.TopLeft:this._screenPosition.x=t.padding.x,this._dynamicUpdatePosition=()=>{this._screenPosition.y=this._viewer.renderer.domElement.clientHeight-t.padding.y-r};break;case g.BottomLeft:this._screenPosition.x=t.padding.x,this._screenPosition.y=t.padding.y;break;default:throw new Error("Unknown corner position for Axis Cross: Corner = "+t.corner)}this._dynamicUpdatePosition()}this._viewer.addUiObject(e,this._screenPosition,new n.Vector2(r,r))}handleClick(e,t,r){const o=2*(e-this._screenPosition.x)/this._layoutConfig.size-1,i=2*(r.height-t-this._screenPosition.y)/this._layoutConfig.size-1;this._raycaster.setFromCamera({x:o,y:i},this._raycastCamera);const s=new n.Vector3(o,i,1),a=new n.Vector3(0,0,-1).normalize();this._raycaster.set(s,a);const c=this._raycaster.intersectObjects(this._interactiveObjects);if(!(c.length>0))return!1;const l=c[0].object.position.clone().normalize(),d=c[0].object.userData.upVector.clone();return this.moveCameraTo(this._viewer.getCamera(),this._viewer.cameraControls,l,d),!0}createAxisCross(e){const t=this.createBoxFaces();e.add(...t);const r=this.createCompass();return e.add(r),this.setupTransformOnRender(e),t}setupTransformOnRender(e){e.children[0].onBeforeRender=()=>{this._dynamicUpdatePosition(),e.quaternion.copy(this._viewer.getCamera().quaternion).invert(),e.updateMatrixWorld(),this._updateClickDiv()}}createBoxFaces(){const e=this._layoutConfig.faces;return[this.createBoxFace(new n.Vector3(1,0,0),e.xPositiveFace),this.createBoxFace(new n.Vector3(-1,0,0),e.xNegativeFace),this.createBoxFace(new n.Vector3(0,1,0),e.yPositiveFace,new n.Vector3(0,0,-1)),this.createBoxFace(new n.Vector3(0,-1,0),e.yNegativeFace,new n.Vector3(0,0,1)),this.createBoxFace(new n.Vector3(0,0,1),e.zPositiveFace),this.createBoxFace(new n.Vector3(0,0,-1),e.zNegativeFace)]}createCompass(){const e=new n.PlaneGeometry(2.1,2.1,1,1),t=new n.Mesh(e,new n.MeshBasicMaterial({map:this.createCompassTexture(),side:n.DoubleSide,transparent:!0})),r=Math.sin(this._layoutConfig.compass.labelDelta),o=Math.cos(this._layoutConfig.compass.labelDelta);return t.position.y=-.5,t.up.copy(new n.Vector3(r,0,o)),t.lookAt(0,0,0),t}createCompassTexture(){var e;const t=this._layoutConfig.compass,r=this._layoutConfig.size,o=document.createElement("canvas");o.width=r,o.height=r;const i=o.getContext("2d"),s=r/2,a=s-s/4,c=r/32,l=r/8;if(i.strokeStyle=t.tickColor.getStyle(),i.lineWidth=r/16,i.setLineDash([c,l]),i.beginPath(),i.arc(s,s,a,0,2*Math.PI),i.stroke(),t.ringLabel&&t.ringLabel.length>0){const n=null!==(e=t.fontSize)&&void 0!==e?e:r/5;i.font=`bold ${n}px Arial`,i.textAlign="center",i.fillStyle=t.fontColor.getStyle(),i.fillText(t.ringLabel,s,s*(1/4)+n/3)}return new n.CanvasTexture(o)}getFaceTexture(e,t){var r,o;const i=t/2,s=document.createElement("canvas");s.width=i,s.height=i;const a=s.getContext("2d");a.fillStyle=e.outlineColor.getStyle(),a.fillRect(0,0,i,i),a.fillStyle=e.faceColor.getStyle();const c=null!==(r=e.outlineSize)&&void 0!==r?r:i/32;if(a.fillRect(c,c,i-2*c,i-2*c),a.fill(),""!==e.label){const t=null!==(o=e.fontSize)&&void 0!==o?o:i/3;a.font=`bold ${t}px Arial`,a.textAlign="center",a.fillStyle=e.fontColor.getStyle(),a.fillText(e.label,i/2,i/2+t/3)}return new n.CanvasTexture(s)}createBoxFace(e,t,r=new n.Vector3(0,1,0)){const o=new n.Mesh(this._boxFaceGeometry,new n.MeshBasicMaterial({map:this.getFaceTexture(t,this._layoutConfig.size)}));return o.position.copy(e.multiplyScalar(.5*this._boxFaceGeometry.parameters.width)),o.lookAt(e.multiplyScalar(2)),o.userData.upVector=r,o}moveCameraTo(e,t,r,o){const i=e.position.clone(),s=t.getState().target,a=i.clone().sub(s),c=a.length(),l=a.clone().normalize(),d=Math.acos(l.dot(r)),h={t:0},u=new b.a.Tween(h),m=r.clone(),p=e.quaternion.clone(),f=(new n.Quaternion).setFromRotationMatrix((new n.Matrix4).makeBasis(o.clone().cross(m),o,m));if(p.angleTo(f)<1e-6)return;const g=new n.Vector3,v=new n.Quaternion;let w;u.to({t:1},this._layoutConfig.animationSpeed).onUpdate(()=>{g.copy(l).multiplyScalar(Math.sin((1-h.t)*d)/Math.sin(d)).add(r.clone().multiplyScalar(Math.sin(h.t*d)/Math.sin(d))),g.multiplyScalar(c),g.add(s),v.slerpQuaternions(p,f,h.t),e.position.copy(g),e.setRotationFromQuaternion(v)}).start(b.a.now()).onStart(()=>{w=t.enabled,t.enabled=!1}).onComplete(()=>{t.setState(e.position,s),t.enabled=w}).update(b.a.now())}}var I,E,k,P,D,T,A,
|
|
199
|
+
class S extends i{constructor(e,t){super(),this._dynamicUpdatePosition=()=>{},this._updateClickDiv=()=>{},this._screenPosition=new n.Vector2,this._boxFaceGeometry=new n.PlaneGeometry(.85,.85,1,1),this._raycastCamera=new n.OrthographicCamera(-1,1,1,-1,-1,1),this._raycaster=new n.Raycaster,this._viewer=e,this._layoutConfig=_()(w()(B),t),this._axisGroup=new n.Group,this._interactiveObjects=this.createAxisCross(this._axisGroup),[this._updateClickDiv,this._disposeClickDiv]=this.createClickDiv(e),this.addAxisBoxToViewer(this._axisGroup,this._layoutConfig.position),l.a.trackCreateTool("AxisViewTool")}dispose(){super.dispose(),this._viewer.removeUiObject(this._axisGroup),this._disposeClickDiv()}createClickDiv(e){if(null===e.domElement.querySelector("canvas"))throw new Error("Could not find canvas");const t=document.createElement("div");t.style.position="absolute",t.style.height=this._layoutConfig.size+"px",t.style.width=this._layoutConfig.size+"px",t.style.zIndex="1";let r=0,n=0;return t.addEventListener("mousedown",t=>{const o=new MouseEvent("mousedown",{clientX:t.clientX,clientY:t.clientY,button:t.button});r=t.clientX,n=t.clientY,e.renderer.domElement.dispatchEvent(o)}),t.addEventListener("mousemove",t=>{const r=new MouseEvent("mousemove",{clientX:t.clientX,clientY:t.clientY,button:t.button});e.renderer.domElement.dispatchEvent(r)}),t.addEventListener("contextmenu",e=>e.preventDefault()),t.addEventListener("mouseup",t=>{const o=new MouseEvent("mouseup",{clientX:t.clientX,clientY:t.clientY,button:t.button}),i=e.domElement.getBoundingClientRect(),s=t.clientX-i.left,a=t.clientY-i.top;Math.abs(r-t.clientX)+Math.abs(n-t.clientY)<=10&&!this.handleClick(s,a,i)&&e.renderer.domElement.dispatchEvent(o)}),e.domElement.appendChild(t),[()=>{t.style.left=this._screenPosition.x+"px",t.style.bottom=this._screenPosition.y+"px"},()=>{e.domElement.removeChild(t)}]}addAxisBoxToViewer(e,t){const r=this._layoutConfig.size;if(function(e){return void 0!==e.xAbsolute&&void 0!==e.yAbsolute}(t))this._screenPosition.x=t.xAbsolute,this._screenPosition.y=t.yAbsolute;else{switch(t.corner){case g.BottomRight:this._screenPosition.y=t.padding.y,this._dynamicUpdatePosition=()=>{this._screenPosition.x=this._viewer.renderer.domElement.clientWidth-t.padding.x-r};break;case g.TopRight:this._dynamicUpdatePosition=()=>{this._screenPosition.x=this._viewer.renderer.domElement.clientWidth-t.padding.x-r,this._screenPosition.y=this._viewer.renderer.domElement.clientHeight-t.padding.y-r};break;case g.TopLeft:this._screenPosition.x=t.padding.x,this._dynamicUpdatePosition=()=>{this._screenPosition.y=this._viewer.renderer.domElement.clientHeight-t.padding.y-r};break;case g.BottomLeft:this._screenPosition.x=t.padding.x,this._screenPosition.y=t.padding.y;break;default:throw new Error("Unknown corner position for Axis Cross: Corner = "+t.corner)}this._dynamicUpdatePosition()}this._viewer.addUiObject(e,this._screenPosition,new n.Vector2(r,r))}handleClick(e,t,r){const o=2*(e-this._screenPosition.x)/this._layoutConfig.size-1,i=2*(r.height-t-this._screenPosition.y)/this._layoutConfig.size-1;this._raycaster.setFromCamera({x:o,y:i},this._raycastCamera);const s=new n.Vector3(o,i,1),a=new n.Vector3(0,0,-1).normalize();this._raycaster.set(s,a);const c=this._raycaster.intersectObjects(this._interactiveObjects);if(!(c.length>0))return!1;const l=c[0].object.position.clone().normalize(),d=c[0].object.userData.upVector.clone();return this.moveCameraTo(this._viewer.getCamera(),this._viewer.cameraControls,l,d),!0}createAxisCross(e){const t=this.createBoxFaces();e.add(...t);const r=this.createCompass();return e.add(r),this.setupTransformOnRender(e),t}setupTransformOnRender(e){e.children[0].onBeforeRender=()=>{this._dynamicUpdatePosition(),e.quaternion.copy(this._viewer.getCamera().quaternion).invert(),e.updateMatrixWorld(),this._updateClickDiv()}}createBoxFaces(){const e=this._layoutConfig.faces;return[this.createBoxFace(new n.Vector3(1,0,0),e.xPositiveFace),this.createBoxFace(new n.Vector3(-1,0,0),e.xNegativeFace),this.createBoxFace(new n.Vector3(0,1,0),e.yPositiveFace,new n.Vector3(0,0,-1)),this.createBoxFace(new n.Vector3(0,-1,0),e.yNegativeFace,new n.Vector3(0,0,1)),this.createBoxFace(new n.Vector3(0,0,1),e.zPositiveFace),this.createBoxFace(new n.Vector3(0,0,-1),e.zNegativeFace)]}createCompass(){const e=new n.PlaneGeometry(2.1,2.1,1,1),t=new n.Mesh(e,new n.MeshBasicMaterial({map:this.createCompassTexture(),side:n.DoubleSide,transparent:!0})),r=Math.sin(this._layoutConfig.compass.labelDelta),o=Math.cos(this._layoutConfig.compass.labelDelta);return t.position.y=-.5,t.up.copy(new n.Vector3(r,0,o)),t.lookAt(0,0,0),t}createCompassTexture(){var e;const t=this._layoutConfig.compass,r=this._layoutConfig.size,o=document.createElement("canvas");o.width=r,o.height=r;const i=o.getContext("2d"),s=r/2,a=s-s/4,c=r/32,l=r/8;if(i.strokeStyle=t.tickColor.getStyle(),i.lineWidth=r/16,i.setLineDash([c,l]),i.beginPath(),i.arc(s,s,a,0,2*Math.PI),i.stroke(),t.ringLabel&&t.ringLabel.length>0){const n=null!==(e=t.fontSize)&&void 0!==e?e:r/5;i.font=`bold ${n}px Arial`,i.textAlign="center",i.fillStyle=t.fontColor.getStyle(),i.fillText(t.ringLabel,s,s*(1/4)+n/3)}return new n.CanvasTexture(o)}getFaceTexture(e,t){var r,o;const i=t/2,s=document.createElement("canvas");s.width=i,s.height=i;const a=s.getContext("2d");a.fillStyle=e.outlineColor.getStyle(),a.fillRect(0,0,i,i),a.fillStyle=e.faceColor.getStyle();const c=null!==(r=e.outlineSize)&&void 0!==r?r:i/32;if(a.fillRect(c,c,i-2*c,i-2*c),a.fill(),""!==e.label){const t=null!==(o=e.fontSize)&&void 0!==o?o:i/3;a.font=`bold ${t}px Arial`,a.textAlign="center",a.fillStyle=e.fontColor.getStyle(),a.fillText(e.label,i/2,i/2+t/3)}return new n.CanvasTexture(s)}createBoxFace(e,t,r=new n.Vector3(0,1,0)){const o=new n.Mesh(this._boxFaceGeometry,new n.MeshBasicMaterial({map:this.getFaceTexture(t,this._layoutConfig.size)}));return o.position.copy(e.multiplyScalar(.5*this._boxFaceGeometry.parameters.width)),o.lookAt(e.multiplyScalar(2)),o.userData.upVector=r,o}moveCameraTo(e,t,r,o){const i=e.position.clone(),s=t.getState().target,a=i.clone().sub(s),c=a.length(),l=a.clone().normalize(),d=Math.acos(l.dot(r)),h={t:0},u=new b.a.Tween(h),m=r.clone(),p=e.quaternion.clone(),f=(new n.Quaternion).setFromRotationMatrix((new n.Matrix4).makeBasis(o.clone().cross(m),o,m));if(p.angleTo(f)<1e-6)return;const g=new n.Vector3,v=new n.Quaternion;let w;u.to({t:1},this._layoutConfig.animationSpeed).onUpdate(()=>{g.copy(l).multiplyScalar(Math.sin((1-h.t)*d)/Math.sin(d)).add(r.clone().multiplyScalar(Math.sin(h.t*d)/Math.sin(d))),g.multiplyScalar(c),g.add(s),v.slerpQuaternions(p,f,h.t),e.position.copy(g),e.setRotationFromQuaternion(v)}).start(b.a.now()).onStart(()=>{w=t.enabled,t.enabled=!1}).onComplete(()=>{t.setState(e.position,s),t.enabled=w}).update(b.a.now())}}var I,E,k,P,D,N,T,A,F,R,O=r(15);
|
|
200
200
|
/*!
|
|
201
201
|
* Copyright 2021 Cognite AS
|
|
202
|
-
*/!function(e){e.BingMap="BingMap",e.HereMap="HereMap",e.MapboxMap="MapboxMap",e.OpenStreetMap="OpenStreetMap"}(I||(I={})),function(e){e[e.Style=100]="Style",e[e.Map_Id=101]="Map_Id"}(E||(E={})),function(e){e.Streets="mapbox/streets-v10",e.Outdoor="mapbox/outdoors-v10",e.Light="mapbox/light-v9",e.Dark="mapbox/dark-v9",e.Satellite="mapbox/satellite-v9",e.Satellite_Streets="mapbox/satellite-streets-v10",e.Navigation_Day="mapbox/navigation-preview-day-v4",e.Navigation_Night="mapbox/navigation-preview-night-v4",e.Navigation_Guide_Day="mapbox/navigation-guidance-day-v4",e.Navigation_Guide_Night="mapbox/navigation-guidance-night-v4"}(k||(k={})),function(e){e.Streets="mapbox.mapbox-streets-v7",e.Satellite="mapbox.satellite",e.Terrain="mapbox.mapbox-terrain-v2",e.Traffic="mapbox.mapbox-traffic-v1",e.TerrainRGB="mapbox.terrain-rgb"}(P||(P={})),function(e){e.PNG="png",e.PNG32="png32",e.PNG64="png64",e.PNG128="png128",e.PNG256="png256",e.JPG70="jpg70",e.JPG80="jpg80",e.JPG90="jpg90",e.PNGRAW="pngraw"}(D||(D={})),function(e){e.Aerial="a",e.Road="r",e.Aerial_Labels="h",e.Oblique="o",e.Oblique_Labels="b"}(
|
|
202
|
+
*/!function(e){e.BingMap="BingMap",e.HereMap="HereMap",e.MapboxMap="MapboxMap",e.OpenStreetMap="OpenStreetMap"}(I||(I={})),function(e){e[e.Style=100]="Style",e[e.Map_Id=101]="Map_Id"}(E||(E={})),function(e){e.Streets="mapbox/streets-v10",e.Outdoor="mapbox/outdoors-v10",e.Light="mapbox/light-v9",e.Dark="mapbox/dark-v9",e.Satellite="mapbox/satellite-v9",e.Satellite_Streets="mapbox/satellite-streets-v10",e.Navigation_Day="mapbox/navigation-preview-day-v4",e.Navigation_Night="mapbox/navigation-preview-night-v4",e.Navigation_Guide_Day="mapbox/navigation-guidance-day-v4",e.Navigation_Guide_Night="mapbox/navigation-guidance-night-v4"}(k||(k={})),function(e){e.Streets="mapbox.mapbox-streets-v7",e.Satellite="mapbox.satellite",e.Terrain="mapbox.mapbox-terrain-v2",e.Traffic="mapbox.mapbox-traffic-v1",e.TerrainRGB="mapbox.terrain-rgb"}(P||(P={})),function(e){e.PNG="png",e.PNG32="png32",e.PNG64="png64",e.PNG128="png128",e.PNG256="png256",e.JPG70="jpg70",e.JPG80="jpg80",e.JPG90="jpg90",e.PNGRAW="pngraw"}(D||(D={})),function(e){e.Aerial="a",e.Road="r",e.Aerial_Labels="h",e.Oblique="o",e.Oblique_Labels="b"}(N||(N={})),function(e){e.GIF="gif",e.JPEG="jpeg",e.PNG="png"}(T||(T={})),function(e){e.Aerial="aerial",e.Base="base",e.Pano="pano",e.Traffic="traffic"}(A||(A={})),function(e){e.Day="normal.day",e.Night="normal.night",e.Terrain="terrain.day",e.Satellite="satellite.day"}(F||(F={})),function(e){e.PNG="png",e.PNG8="png8",e.JPG="jpg"}(R||(R={}));
|
|
203
203
|
/*!
|
|
204
204
|
* Copyright 2021 Cognite AS
|
|
205
205
|
*/
|