@ndmspc/ndmvr 0.20220401.1 → 0.20230212.0

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.
@@ -1,4572 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { Subject } from 'rxjs';
3
- import AFRAME$1 from 'aframe';
4
- import { io } from 'socket.io-client';
5
- import { Vector3, Quaternion } from 'three';
6
-
7
- function _defineProperties(target, props) {
8
- for (var i = 0; i < props.length; i++) {
9
- var descriptor = props[i];
10
- descriptor.enumerable = descriptor.enumerable || false;
11
- descriptor.configurable = true;
12
- if ("value" in descriptor) descriptor.writable = true;
13
- Object.defineProperty(target, descriptor.key, descriptor);
14
- }
15
- }
16
-
17
- function _createClass(Constructor, protoProps, staticProps) {
18
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
19
- if (staticProps) _defineProperties(Constructor, staticProps);
20
- return Constructor;
21
- }
22
-
23
- var id = 0;
24
-
25
- function _classPrivateFieldLooseKey(name) {
26
- return "__private_" + id++ + "_" + name;
27
- }
28
-
29
- function _classPrivateFieldLooseBase(receiver, privateKey) {
30
- if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
31
- throw new TypeError("attempted to use private field on non-instance");
32
- }
33
-
34
- return receiver;
35
- }
36
-
37
- var _subject = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
38
-
39
- var JsrootSubject = /*#__PURE__*/function () {
40
- function JsrootSubject() {
41
- Object.defineProperty(this, _subject, {
42
- writable: true,
43
- value: void 0
44
- });
45
- _classPrivateFieldLooseBase(this, _subject)[_subject] = new Subject();
46
- }
47
-
48
- var _proto = JsrootSubject.prototype;
49
-
50
- _proto.showBinProjection = function showBinProjection(binData) {
51
- _classPrivateFieldLooseBase(this, _subject)[_subject].next(binData);
52
- };
53
-
54
- _proto.getServiceEvent = function getServiceEvent() {
55
- return _classPrivateFieldLooseBase(this, _subject)[_subject].asObservable();
56
- };
57
-
58
- return JsrootSubject;
59
- }();
60
-
61
- var jsrootSubject = new JsrootSubject();
62
-
63
- var _jsroot = /*#__PURE__*/_classPrivateFieldLooseKey("jsroot");
64
-
65
- var JsrootService = /*#__PURE__*/function () {
66
- function JsrootService() {
67
- Object.defineProperty(this, _jsroot, {
68
- writable: true,
69
- value: null
70
- });
71
- }
72
-
73
- var _proto = JsrootService.prototype;
74
-
75
- _proto.createTH1Projection = function createTH1Projection(projectionAxis, info, idTargetElm, axisArray) {
76
- var _info$obj$secondaryAx;
77
-
78
- if (!info || !projectionAxis || _classPrivateFieldLooseBase(this, _jsroot)[_jsroot] === null) {
79
- return;
80
- }
81
-
82
- var projectionTargetAxis = projectionAxis === axisArray[0];
83
- var primary = projectionTargetAxis ? axisArray[0] : axisArray[1];
84
- var secondary = projectionTargetAxis ? axisArray[1] : axisArray[0];
85
- var primaryAxis = "f" + secondary + "axis";
86
- var secondaryAxis = "f" + primary + "axis";
87
- var binAxis = primary.toLowerCase() + "Pos";
88
-
89
- var h1 = _classPrivateFieldLooseBase(this, _jsroot)[_jsroot].createHistogram('TH1I', info.obj[primaryAxis].fNbins);
90
-
91
- h1.fXaxis.fXmin = info.obj[primaryAxis].fXmin;
92
- h1.fXaxis.fXmax = info.obj[primaryAxis].fXmax;
93
- h1.fXaxis.fTitle = info.obj[primaryAxis].fTitle;
94
- h1.fXaxis.fLabels = info.obj[primaryAxis].fLabels;
95
- var currLabel = ((_info$obj$secondaryAx = info.obj[secondaryAxis].fLabels) === null || _info$obj$secondaryAx === void 0 ? void 0 : _info$obj$secondaryAx.arr.length) > 0 ? info.obj[secondaryAxis].fLabels.arr[info.bin[binAxis] - 1].fString : '';
96
-
97
- for (var n = 0; n < info.obj[primaryAxis].fNbins; n++) {
98
- console.log(info.obj);
99
- h1.setBinContent(n + 1, projectionAxis === axisArray[0] ? info.obj.getBinContent(info.bin[binAxis], n + 1) : info.obj.getBinContent(n + 1, info.bin[binAxis]));
100
- }
101
-
102
- h1.fName = 'px';
103
- h1.fTitle = "Projection of bin=" + projectionAxis + (info.bin.binName !== '' ? info.bin.name : info.bin[binAxis] - 1) + "[" + currLabel + "]";
104
-
105
- _classPrivateFieldLooseBase(this, _jsroot)[_jsroot].redraw(idTargetElm, h1);
106
- };
107
-
108
- _proto.openTH1Projection = function openTH1Projection(projectionAxis, info, idTargetElm, axisArray, projections, projIndex) {
109
- var _this = this;
110
-
111
- var xBin = info.bin.xPos - 1;
112
- var yBin = info.bin.yPos - 1;
113
-
114
- try {
115
- var projection = projections.fFolders.arr[xBin].fFolders.arr[yBin].fFolders.arr[projIndex || 0];
116
-
117
- _classPrivateFieldLooseBase(this, _jsroot)[_jsroot].redraw(idTargetElm, projection);
118
-
119
- setTimeout(function () {
120
- _this.displayImageOfProjection('projectionContainer', 'th-mapping', '500px', '400px');
121
- }, 200);
122
- } catch (e) {
123
- console.log("you don't have this projection");
124
- }
125
- };
126
-
127
- _proto.displayImageOfProjection = function displayImageOfProjection(idSourceElement, idTargetElement, width, height) {
128
- try {
129
- var sourceSvgElement = document.getElementById(idSourceElement).firstElementChild;
130
- var targetElement = document.getElementById(idTargetElement);
131
- var canvas = document.createElement('canvas');
132
- sourceSvgElement.setAttribute('height', height);
133
- sourceSvgElement.setAttribute('width', width);
134
- canvas.setAttribute('height', height);
135
- canvas.setAttribute('width', width);
136
- var svgString = new XMLSerializer().serializeToString(sourceSvgElement);
137
- var ctx = canvas.getContext('2d');
138
- ctx.fillStyle = '#ffffff';
139
- ctx.fillRect(0, 0, canvas.width, canvas.height);
140
- var DOMURL = self.URL || self.webkitURL || self;
141
- var img = new Image();
142
- var svg = new Blob([svgString], {
143
- type: 'image/svg+xml;charset=utf-8'
144
- });
145
- var url = DOMURL.createObjectURL(svg);
146
-
147
- img.onload = function () {
148
- ctx.drawImage(img, 0, 0);
149
- var png = canvas.toDataURL('image/png');
150
- targetElement.setAttribute('material', "src", png);
151
- DOMURL.revokeObjectURL(png);
152
- };
153
-
154
- img.src = url;
155
- } catch (e) {}
156
- };
157
-
158
- _createClass(JsrootService, [{
159
- key: "jsrootLibrary",
160
- get: function get() {
161
- return _classPrivateFieldLooseBase(this, _jsroot)[_jsroot];
162
- },
163
- set: function set(JSROOT) {
164
- _classPrivateFieldLooseBase(this, _jsroot)[_jsroot] = JSROOT;
165
- }
166
- }]);
167
-
168
- return JsrootService;
169
- }();
170
-
171
- var jsrootService = new JsrootService();
172
-
173
- var styles = {
174
- box: {
175
- display: 'block',
176
- margin: 'auto',
177
- width: '90%',
178
- textAlign: 'center',
179
- align: 'center',
180
- paddingTop: 4
181
- },
182
- projection: {
183
- display: 'block',
184
- margin: 'auto',
185
- width: '420px',
186
- height: '350px'
187
- },
188
- form: {
189
- display: 'block',
190
- width: '60%',
191
- margin: 'auto',
192
- paddingTop: '2%',
193
- paddingBottom: '2%'
194
- },
195
- label: {
196
- display: 'block'
197
- },
198
- input: {
199
- display: 'block',
200
- width: '85%',
201
- margin: 'auto',
202
- height: 40,
203
- border: '1px solid grey',
204
- borderRadius: 3,
205
- textAlign: 'center',
206
- fontSize: 20,
207
- color: 'black',
208
- opacity: 0.8
209
- }
210
- };
211
-
212
- var JsrootHistogram = function JsrootHistogram(_ref) {
213
- var histogram = _ref.histogram,
214
- projectionAxes = _ref.projectionAxes,
215
- projections = _ref.projections,
216
- projIndex = _ref.projIndex;
217
- var subscription;
218
-
219
- var _useState = useState('X'),
220
- axis = _useState[0],
221
- setAxis = _useState[1];
222
-
223
- var _useState2 = useState(null),
224
- selectedBin = _useState2[0],
225
- setSelectedBin = _useState2[1];
226
-
227
- var handleInputChange = function handleInputChange(event) {
228
- setAxis(event.target.value);
229
- };
230
-
231
- var handleSubscription = function handleSubscription(data) {
232
- setSelectedBin(data);
233
- };
234
-
235
- var renderForm = function renderForm() {
236
- return /*#__PURE__*/React.createElement("div", {
237
- className: "form-group",
238
- style: styles.form
239
- }, /*#__PURE__*/React.createElement("label", {
240
- htmlFor: "formGroupExampleInput",
241
- style: styles.label
242
- }, "Projection axis"), /*#__PURE__*/React.createElement("select", {
243
- onChange: handleInputChange,
244
- className: "form-control",
245
- id: "axisProjection",
246
- style: styles.input
247
- }, /*#__PURE__*/React.createElement("option", {
248
- value: projectionAxes[0]
249
- }, histogram["f" + projectionAxes[0] + "axis"].fTitle ? histogram["f" + projectionAxes[0] + "axis"].fTitle : projectionAxes[0]), /*#__PURE__*/React.createElement("option", {
250
- value: projectionAxes[1]
251
- }, histogram["f" + projectionAxes[1] + "axis"].fTitle ? histogram["f" + projectionAxes[1] + "axis"].fTitle : projectionAxes[1])));
252
- };
253
-
254
- var createAndDisplayProjection = function createAndDisplayProjection() {
255
- if (projections !== null) {
256
- jsrootService.openTH1Projection(axis, {
257
- obj: histogram,
258
- bin: selectedBin
259
- }, 'projectionContainer', projectionAxes, projections, projIndex);
260
- } else {
261
- jsrootService.createTH1Projection(axis, {
262
- obj: histogram,
263
- bin: selectedBin
264
- }, 'projectionContainer', projectionAxes);
265
- setTimeout(function () {
266
- jsrootService.displayImageOfProjection('projectionContainer', 'th-mapping', '500px', '500px');
267
- }, 500);
268
- }
269
- };
270
-
271
- useEffect(function () {
272
- jsrootService.jsrootLibrary = window.JSROOT;
273
- setSelectedBin(null);
274
- subscription = jsrootSubject.getServiceEvent().subscribe(handleSubscription);
275
- return function () {
276
- return subscription.unsubscribe();
277
- };
278
- }, [histogram]);
279
- useEffect(function () {
280
- if (selectedBin != null) createAndDisplayProjection();
281
- }, [axis, selectedBin, projections]);
282
- return /*#__PURE__*/React.createElement("div", {
283
- style: styles.box
284
- }, projections === null && selectedBin !== null && renderForm(), /*#__PURE__*/React.createElement("div", {
285
- id: "projectionContainer",
286
- style: styles.projection
287
- }));
288
- };
289
-
290
- var _subject$1 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
291
-
292
- var CameraSubject = /*#__PURE__*/function () {
293
- function CameraSubject() {
294
- Object.defineProperty(this, _subject$1, {
295
- writable: true,
296
- value: void 0
297
- });
298
- _classPrivateFieldLooseBase(this, _subject$1)[_subject$1] = new Subject();
299
- }
300
-
301
- var _proto = CameraSubject.prototype;
302
-
303
- _proto.setVisibilityOfBanners = function setVisibilityOfBanners(inputDevice) {
304
- _classPrivateFieldLooseBase(this, _subject$1)[_subject$1].next({
305
- device: inputDevice
306
- });
307
- };
308
-
309
- _proto.shiftBanners = function shiftBanners() {
310
- _classPrivateFieldLooseBase(this, _subject$1)[_subject$1].next('shift');
311
- };
312
-
313
- _proto.setUserState = function setUserState() {
314
- _classPrivateFieldLooseBase(this, _subject$1)[_subject$1].next('show');
315
- };
316
-
317
- _proto.getCameraSubject = function getCameraSubject() {
318
- return _classPrivateFieldLooseBase(this, _subject$1)[_subject$1].asObservable();
319
- };
320
-
321
- return CameraSubject;
322
- }();
323
-
324
- var cameraSubject = new CameraSubject();
325
-
326
- var _cameraWrapper = /*#__PURE__*/_classPrivateFieldLooseKey("cameraWrapper");
327
-
328
- var _setVerticalOffset = /*#__PURE__*/_classPrivateFieldLooseKey("setVerticalOffset");
329
-
330
- var CameraService = function CameraService() {
331
- var _this = this;
332
-
333
- Object.defineProperty(this, _cameraWrapper, {
334
- writable: true,
335
- value: void 0
336
- });
337
-
338
- this.verticalMoveCamera = function (moveUp, speed) {
339
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
340
-
341
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
342
- if (moveUp) {
343
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y += speed;
344
- } else {
345
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y > 0) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y -= speed;
346
- }
347
- }
348
- };
349
-
350
- this.horizontalMoveCamera = function (axis, increment, speed) {
351
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] === null) _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
352
-
353
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
354
- if (increment) {
355
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] += speed;
356
- } else {
357
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position[axis] -= speed;
358
- }
359
- }
360
- };
361
-
362
- Object.defineProperty(this, _setVerticalOffset, {
363
- writable: true,
364
- value: function value(elm, offset, rotation) {
365
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null && elm !== null) {
366
- var newXPos = elm.object3D.position.x + 1 * elm.object3D.position.x;
367
- var newZPos = elm.object3D.position.z + 1 * elm.object3D.position.z;
368
- var newYPos = offset;
369
-
370
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos + 1) + " " + newYPos + " " + (newZPos + 1) + "; dur: 100;");
371
-
372
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation__1', "property: rotation; to: " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.x + " " + rotation + " " + _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.rotation.z + "; dur: 100;");
373
- }
374
- }
375
- });
376
-
377
- this.setCameraPosition = function (offsets) {
378
- if (_classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper] !== null) {
379
- var newZPos = _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].object3D.position.y;
380
-
381
- if (offsets.zOffset !== undefined) {
382
- newZPos = offsets.zOffset * 2;
383
- }
384
-
385
- var newXPos = offsets.xOffset + offsets.xOffset;
386
- var newYPos = offsets.yOffset + offsets.yOffset;
387
- setTimeout(function () {
388
- _classPrivateFieldLooseBase(_this, _cameraWrapper)[_cameraWrapper].setAttribute('animation', "property: position; to: " + (newXPos - 3) + " " + newZPos + " " + (newYPos - 3) + "; dur: 40;");
389
- }, 1800);
390
- }
391
- };
392
-
393
- this.setPredefinedDownPosition = function () {
394
- var labelElement = document.getElementById('downLabel');
395
-
396
- if (labelElement !== undefined) {
397
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 180);
398
- }
399
- };
400
-
401
- this.setPredefinedUpPosition = function () {
402
- var labelElement = document.getElementById('upLabel');
403
-
404
- if (labelElement !== undefined) {
405
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 0);
406
- }
407
- };
408
-
409
- this.setPredefinedRightPosition = function () {
410
- var labelElement = document.getElementById('rightLabel');
411
-
412
- if (labelElement !== undefined) {
413
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 90);
414
- }
415
- };
416
-
417
- this.setPredefinedLeftPosition = function () {
418
- var labelElement = document.getElementById('leftLabel');
419
-
420
- if (labelElement !== undefined) {
421
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 0, 270);
422
- }
423
- };
424
-
425
- this.setPredefinedDownPositionWithOffset = function () {
426
- var labelElement = document.getElementById('downLabel');
427
-
428
- if (labelElement !== undefined) {
429
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 180);
430
- }
431
- };
432
-
433
- this.setPredefinedUpPositionWithOffset = function () {
434
- var labelElement = document.getElementById('upLabel');
435
-
436
- if (labelElement !== undefined) {
437
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 0);
438
- }
439
- };
440
-
441
- this.setPredefinedRightPositionWithOffset = function () {
442
- var labelElement = document.getElementById('rightLabel');
443
-
444
- if (labelElement !== undefined) {
445
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 90);
446
- }
447
- };
448
-
449
- this.setPredefinedLeftPositionWithOffset = function () {
450
- var labelElement = document.getElementById('leftLabel');
451
-
452
- if (labelElement !== undefined) {
453
- _classPrivateFieldLooseBase(_this, _setVerticalOffset)[_setVerticalOffset](labelElement, 10, 270);
454
- }
455
- };
456
-
457
- _classPrivateFieldLooseBase(this, _cameraWrapper)[_cameraWrapper] = document.getElementById('cameraWrapper');
458
- };
459
-
460
- var _subject$2 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
461
-
462
- var HistogramSubject = /*#__PURE__*/function () {
463
- function HistogramSubject() {
464
- Object.defineProperty(this, _subject$2, {
465
- writable: true,
466
- value: void 0
467
- });
468
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2] = new Subject();
469
- }
470
-
471
- var _proto = HistogramSubject.prototype;
472
-
473
- _proto.changeHistogramSectionByOffset = function changeHistogramSectionByOffset(axis, histogramType, increment, defaultRange) {
474
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
475
- name: histogramType,
476
- axis: axis,
477
- increment: increment,
478
- defaultRange: defaultRange
479
- });
480
- };
481
-
482
- _proto.changeHistogramFunction = function changeHistogramFunction(typeFunction, histogramType) {
483
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
484
- fFunction: typeFunction,
485
- name: histogramType
486
- });
487
- };
488
-
489
- _proto.changeTypeOfBinMark = function changeTypeOfBinMark(value, histogramType) {
490
- _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].next({
491
- binMarkMode: value,
492
- name: histogramType
493
- });
494
- };
495
-
496
- _proto.getChangedSection = function getChangedSection() {
497
- return _classPrivateFieldLooseBase(this, _subject$2)[_subject$2].asObservable();
498
- };
499
-
500
- return HistogramSubject;
501
- }();
502
-
503
- var histogramTH2Service = new HistogramSubject();
504
- var histogramTH3Service = new HistogramSubject();
505
-
506
- var _subject$3 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
507
-
508
- var BinSubject = /*#__PURE__*/function () {
509
- function BinSubject() {
510
- Object.defineProperty(this, _subject$3, {
511
- writable: true,
512
- value: void 0
513
- });
514
- _classPrivateFieldLooseBase(this, _subject$3)[_subject$3] = new Subject();
515
- }
516
-
517
- var _proto = BinSubject.prototype;
518
-
519
- _proto.saveSelectedBinToLocalStorage = function saveSelectedBinToLocalStorage() {
520
- _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].next(true);
521
- };
522
-
523
- _proto.deleteBinFromLocalStorage = function deleteBinFromLocalStorage() {
524
- _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].next(false);
525
- };
526
-
527
- _proto.getKeyboardEvent = function getKeyboardEvent() {
528
- return _classPrivateFieldLooseBase(this, _subject$3)[_subject$3].asObservable();
529
- };
530
-
531
- return BinSubject;
532
- }();
533
-
534
- var binSubject = new BinSubject();
535
-
536
- var keyPressed = {};
537
- var cameraService = new CameraService();
538
- var aframeObj;
539
- var geoAttributes;
540
- var toolsSelector = new Subject();
541
- var activeTool;
542
-
543
- var handlePositioning = function handlePositioning(property, event) {
544
- var difference = 0.2;
545
- if (property.name === 'scale') difference = 0.01;else if (property.name === 'rotation') difference = 2;
546
-
547
- if (event.key === 'ArrowDown') {
548
- property.xValue = property.xValue + difference;
549
- } else if (event.key === 'ArrowUp') {
550
- property.xValue = property.xValue - difference;
551
- } else if (event.key === '=') {
552
- property.yValue = property.yValue + difference;
553
- } else if (event.key === '-') {
554
- property.yValue = property.yValue - difference;
555
- } else if (event.key === 'ArrowRight') {
556
- property.zValue = property.zValue + difference;
557
- } else if (event.key === 'ArrowLeft') {
558
- property.zValue = property.zValue - difference;
559
- }
560
-
561
- aframeObj.setAttribute(property.name, property.xValue + " " + property.yValue + " " + property.zValue);
562
- };
563
-
564
- var handleChangeHistogramSectionByDefaultRange = function handleChangeHistogramSectionByDefaultRange(event) {
565
- if (event.key === 'k' || event.key === 'K') {
566
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, true);
567
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, true);
568
- } else if (event.key === 'i' || event.key === 'I') {
569
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, true);
570
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, true);
571
- } else if (event.key === 'u' || event.key === 'U') {
572
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, true);
573
- } else if (event.key === 'o' || event.key === 'O') {
574
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, true);
575
- } else if (event.key === 'l' || event.key === 'L') {
576
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, true);
577
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, true);
578
- } else if (event.key === 'j' || event.key === 'J') {
579
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, true);
580
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, true);
581
- }
582
- };
583
-
584
- var handleChangeHistogramSectionByOwnRange = function handleChangeHistogramSectionByOwnRange(event) {
585
- if (event.key === 'k' || event.key === 'K') {
586
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, false);
587
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, false);
588
- } else if (event.key === 'i' || event.key === 'I') {
589
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, false);
590
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, false);
591
- } else if (event.key === 'u' || event.key === 'U') {
592
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, false);
593
- } else if (event.key === 'o' || event.key === 'O') {
594
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, false);
595
- } else if (event.key === 'l' || event.key === 'L') {
596
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, false);
597
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, false);
598
- } else if (event.key === 'j' || event.key === 'J') {
599
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, false);
600
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, false);
601
- }
602
- };
603
-
604
- var keyPressHandlerFunction = function keyPressHandlerFunction(event) {
605
- keyPressed[event.key] = true;
606
-
607
- if (keyPressed.Z || keyPressed.z) {
608
- handlePositioning(geoAttributes[0], event);
609
- }
610
-
611
- if (keyPressed.X || keyPressed.x) {
612
- handlePositioning(geoAttributes[1], event);
613
- }
614
-
615
- if (keyPressed.C || keyPressed.c) {
616
- handlePositioning(geoAttributes[2], event);
617
- }
618
-
619
- if (keyPressed.Shift) {
620
- handleChangeHistogramSectionByOwnRange(event);
621
- }
622
-
623
- handleChangeHistogramSectionByDefaultRange(event);
624
-
625
- if (event.key === ' ') {
626
- cameraService.verticalMoveCamera(true, 0.3);
627
- }
628
-
629
- if (event.shiftKey) {
630
- cameraService.verticalMoveCamera(false, 0.3);
631
- }
632
-
633
- if (event.key === '1') {
634
- toolsSelector.next(1);
635
- activeTool = 1;
636
- }
637
-
638
- if (event.key === '2') {
639
- toolsSelector.next(2);
640
- activeTool = 2;
641
- }
642
-
643
- if (event.key === '3') {
644
- toolsSelector.next(3);
645
- activeTool = 3;
646
- }
647
-
648
- if (event.key === '4') {
649
- toolsSelector.next(4);
650
- activeTool = 4;
651
- }
652
-
653
- if (event.key === '5') {
654
- toolsSelector.next(5);
655
- activeTool = 5;
656
- }
657
-
658
- if (event.key === '6') {
659
- toolsSelector.next(6);
660
- activeTool = 6;
661
- }
662
-
663
- if (event.key === '7') {
664
- toolsSelector.next(7);
665
- activeTool = 7;
666
- }
667
-
668
- if (event.key === '8') {
669
- toolsSelector.next(8);
670
- activeTool = 8;
671
- }
672
-
673
- if (event.key === '9') {
674
- toolsSelector.next(9);
675
- activeTool = 9;
676
- }
677
-
678
- if (event.key === '0') {
679
- toolsSelector.next(0);
680
- activeTool = 0;
681
- }
682
-
683
- if (event.key === 'Enter') {
684
- binSubject.saveSelectedBinToLocalStorage();
685
- ['th-mapping', 'bannerId_1', 'bannerId_2', 'bannerId_3', 'bannerId_4'].forEach(function (targetId) {
686
- if (document.getElementById(targetId) !== null) {
687
- jsrootService.displayImageOfProjection('projectionContainer', targetId, '500px', '400px');
688
- }
689
- });
690
- }
691
-
692
- if (event.key === 'r' || event.key === 'R') {
693
- binSubject.deleteBinFromLocalStorage();
694
- }
695
-
696
- if (event.key === 'm' || event.key === 'M') {
697
- histogramTH2Service.changeHistogramFunction('feet', 'TH2');
698
- }
699
-
700
- if (event.key === 'n' || event.key === 'N') {
701
- histogramTH2Service.changeHistogramFunction('default', 'TH2');
702
- }
703
-
704
- if (event.key === 'c' || event.key === 'C') {
705
- cameraSubject.setUserState();
706
- }
707
-
708
- if (event.key === 'v' || event.key === 'V') {
709
- cameraSubject.setVisibilityOfBanners('keyboard');
710
- }
711
-
712
- if (event.key === 'x' || event.key === 'X') {
713
- cameraSubject.shiftBanners();
714
- }
715
-
716
- if (event.key === 'x' || event.key === 'X') {
717
- cameraSubject.shiftBanners();
718
- }
719
- };
720
-
721
- var switchDisplayModeOnBin = function switchDisplayModeOnBin(event) {
722
- event.preventDefault();
723
- var binDisplayMode;
724
-
725
- if (event.deltaY > 0) {
726
- binDisplayMode = 1;
727
- } else {
728
- binDisplayMode = -1;
729
- }
730
-
731
- histogramTH2Service.changeTypeOfBinMark(binDisplayMode, 'TH2');
732
- histogramTH3Service.changeTypeOfBinMark(binDisplayMode, 'TH3');
733
- };
734
-
735
- var getActiveTool = function getActiveTool() {
736
- return activeTool;
737
- };
738
-
739
- var keyReleaseHandlerFunction = function keyReleaseHandlerFunction(event) {
740
- delete keyPressed[event.key];
741
- };
742
-
743
- var initialKeyboardController = function initialKeyboardController(data, object) {
744
- aframeObj = object;
745
- geoAttributes = [data.position, data.scale, data.rotation];
746
-
747
- for (var i = 0; i < 3; i++) {
748
- aframeObj.setAttribute(geoAttributes[i].name, geoAttributes[i].xValue + " " + geoAttributes[i].yValue + " " + geoAttributes[i].zValue);
749
- }
750
- };
751
-
752
- var keyboardUpdateCameraReference = function keyboardUpdateCameraReference() {
753
- cameraService = new CameraService();
754
- };
755
-
756
- var _storage = /*#__PURE__*/_classPrivateFieldLooseKey("storage");
757
-
758
- var _camera = /*#__PURE__*/_classPrivateFieldLooseKey("camera");
759
-
760
- var _selectedBins = /*#__PURE__*/_classPrivateFieldLooseKey("selectedBins");
761
-
762
- var _deleteCurrentBin = /*#__PURE__*/_classPrivateFieldLooseKey("deleteCurrentBin");
763
-
764
- var NdmVrStorageService = /*#__PURE__*/function () {
765
- function NdmVrStorageService() {
766
- var _this = this;
767
-
768
- Object.defineProperty(this, _storage, {
769
- writable: true,
770
- value: void 0
771
- });
772
- Object.defineProperty(this, _camera, {
773
- writable: true,
774
- value: void 0
775
- });
776
- Object.defineProperty(this, _selectedBins, {
777
- writable: true,
778
- value: []
779
- });
780
- Object.defineProperty(this, _deleteCurrentBin, {
781
- writable: true,
782
- value: function value(binData) {
783
- return _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
784
- return item.id !== binData.id;
785
- });
786
- }
787
- });
788
-
789
- this.containThisBin = function (binData) {
790
- var updatedArray = _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].filter(function (item) {
791
- return item.id === binData.id;
792
- });
793
-
794
- return updatedArray.length !== 0;
795
- };
796
-
797
- this.storeBinToLocalStorage = function (binData) {
798
- if (!_this.containThisBin(binData)) {
799
- _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins].push(binData);
800
-
801
- _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
802
- }
803
- };
804
-
805
- this.deleteBinFromLocalStorage = function (binData) {
806
- if (_this.containThisBin(binData)) {
807
- _classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins] = _classPrivateFieldLooseBase(_this, _deleteCurrentBin)[_deleteCurrentBin](binData);
808
-
809
- _classPrivateFieldLooseBase(_this, _storage)[_storage].setItem('selectedBins', JSON.stringify(_classPrivateFieldLooseBase(_this, _selectedBins)[_selectedBins]));
810
- }
811
- };
812
-
813
- this.getBinsFromLocalStorage = function () {
814
- var selectedBins = JSON.parse(_classPrivateFieldLooseBase(_this, _storage)[_storage].getItem('selectedBins'));
815
-
816
- if (selectedBins === null) {
817
- return [];
818
- } else {
819
- return selectedBins;
820
- }
821
- };
822
-
823
- _classPrivateFieldLooseBase(this, _storage)[_storage] = window.localStorage;
824
- _classPrivateFieldLooseBase(this, _camera)[_camera] = document.getElementById('cameraWrapper');
825
- _classPrivateFieldLooseBase(this, _selectedBins)[_selectedBins] = this.getBinsFromLocalStorage();
826
- }
827
-
828
- var _proto = NdmVrStorageService.prototype;
829
-
830
- _proto.storeCurrentBinToLocalStorage = function storeCurrentBinToLocalStorage(binData) {
831
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('currentBin', JSON.stringify(binData));
832
- };
833
-
834
- _proto.getCurrentBinFromLocalStorage = function getCurrentBinFromLocalStorage() {
835
- var currentBin = JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem('currentBin'));
836
-
837
- if (currentBin === undefined || currentBin === '') {
838
- return null;
839
- }
840
-
841
- return currentBin;
842
- };
843
-
844
- _proto.loadProperty = function loadProperty(property) {
845
- return JSON.parse(_classPrivateFieldLooseBase(this, _storage)[_storage].getItem(property));
846
- };
847
-
848
- _proto.storeProperty = function storeProperty(property, object) {
849
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem(property, JSON.stringify(object));
850
- };
851
-
852
- _proto.initHistogramData = function initHistogramData(histogram) {
853
- if (histogram._typename.includes('TH3')) {
854
- this.storeTH3HistogramLimits(histogram);
855
- } else if (histogram._typename.includes('TH2')) {
856
- this.storeTH2HistogramLimits(histogram);
857
- }
858
- };
859
-
860
- _proto.storeTH2Offsets = function storeTH2Offsets(xOffset, yOffset, range) {
861
- var object = this.loadProperty('TH2');
862
- var section;
863
-
864
- if (object === null) {
865
- object = {};
866
- section = {
867
- name: 'TH2',
868
- xOffset: 1,
869
- yOffset: 1,
870
- range: 8
871
- };
872
- } else {
873
- section = {
874
- name: 'TH2',
875
- xOffset: xOffset,
876
- yOffset: yOffset,
877
- range: range
878
- };
879
- }
880
-
881
- object.section = section;
882
- this.storeProperty('TH2', object);
883
- };
884
-
885
- _proto.storeTH3Offsets = function storeTH3Offsets(xOffset, yOffset, zOffset, range) {
886
- var object = this.loadProperty('TH3');
887
- var section;
888
-
889
- if (object === null) {
890
- object = {};
891
- section = {
892
- name: 'TH3',
893
- xOffset: 1,
894
- yOffset: 1,
895
- zOffset: 1,
896
- range: 4
897
- };
898
- } else {
899
- section = {
900
- name: 'TH3',
901
- xOffset: xOffset,
902
- yOffset: yOffset,
903
- zOffset: zOffset,
904
- range: range
905
- };
906
- }
907
-
908
- object.section = section;
909
- this.storeProperty('TH3', object);
910
- };
911
-
912
- _proto.storeOffsets = function storeOffsets(section) {
913
- if (section.name.includes('TH3') || section.name.includes('th3')) {
914
- this.storeTH3Offsets(section.xOffset, section.yOffset, section.zOffset, section.range);
915
- } else if (section.name.includes('TH2') || section.name.includes('th2')) {
916
- this.storeTH2Offsets(section.xOffset, section.yOffset, section.range);
917
- }
918
- };
919
-
920
- _proto.storeFilePath = function storeFilePath(filePath) {
921
- _classPrivateFieldLooseBase(this, _storage)[_storage].setItem('rootFile', filePath);
922
- };
923
-
924
- _proto.loadFilePath = function loadFilePath() {
925
- var filename = _classPrivateFieldLooseBase(this, _storage)[_storage].getItem('rootFile');
926
-
927
- if (filename === null || filename === undefined) {
928
- return 'defaultHistogram';
929
- }
930
-
931
- return filename;
932
- };
933
-
934
- _proto.loadTH2Offsets = function loadTH2Offsets() {
935
- var object = this.loadProperty('TH2');
936
-
937
- if (object !== null) {
938
- return object.section;
939
- } else {
940
- return null;
941
- }
942
- };
943
-
944
- _proto.loadTH3Offsets = function loadTH3Offsets() {
945
- var object = this.loadProperty('TH3');
946
-
947
- if (object !== null) {
948
- return object.section;
949
- } else {
950
- return null;
951
- }
952
- };
953
-
954
- _proto.loadOffsets = function loadOffsets(type) {
955
- if (type.includes('TH3') || type.includes('th3')) {
956
- return this.loadTH3Offsets();
957
- } else if (type.includes('TH2') || type.includes('th2')) {
958
- return this.loadTH2Offsets();
959
- }
960
- };
961
-
962
- return NdmVrStorageService;
963
- }();
964
- var localStorageService = new NdmVrStorageService();
965
-
966
- var _subject$4 = /*#__PURE__*/_classPrivateFieldLooseKey("subject");
967
-
968
- var BinDataDistributor = /*#__PURE__*/function () {
969
- function BinDataDistributor() {
970
- Object.defineProperty(this, _subject$4, {
971
- writable: true,
972
- value: void 0
973
- });
974
- _classPrivateFieldLooseBase(this, _subject$4)[_subject$4] = new Subject();
975
- }
976
-
977
- var _proto = BinDataDistributor.prototype;
978
-
979
- _proto.sendDataOfTheSelectedBin = function sendDataOfTheSelectedBin(binData) {
980
- _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].next(binData);
981
- };
982
-
983
- _proto.getBinDistributor = function getBinDistributor() {
984
- return _classPrivateFieldLooseBase(this, _subject$4)[_subject$4].asObservable();
985
- };
986
-
987
- return BinDataDistributor;
988
- }();
989
-
990
- var binDataDistributor = new BinDataDistributor();
991
-
992
- var binData = new Subject();
993
- AFRAME$1.registerComponent('mouseevent', {
994
- init: function init() {
995
- var subscription;
996
- var el = this.el;
997
- var clickCount = 0;
998
- var checked = false;
999
- el.addEventListener('mouseenter', function setHover(evt) {
1000
- var _this = this;
1001
-
1002
- checked = false;
1003
- var intersection = evt.detail.intersection;
1004
- subscription = binSubject.getKeyboardEvent().subscribe(function (save) {
1005
- if (save) {
1006
- localStorageService.storeBinToLocalStorage(_this.userData);
1007
- localStorageService.storeCurrentBinToLocalStorage(_this.userData);
1008
- binDataDistributor.sendDataOfTheSelectedBin(_this.userData);
1009
- _this.userData.markedColor = _this.userData.selectColor;
1010
-
1011
- _this.setAttribute('material', 'opacity', '0.70');
1012
-
1013
- jsrootSubject.showBinProjection(_this.userData);
1014
- } else {
1015
- localStorageService.deleteBinFromLocalStorage(_this.userData);
1016
- _this.userData.markedColor = _this.userData.color;
1017
-
1018
- _this.setAttribute('material', 'opacity', '0.50');
1019
- }
1020
- });
1021
-
1022
- if (intersection.face.normal.x !== 0) {
1023
- this.setAttribute('material', 'color', this.userData.axisZ);
1024
- } else if (intersection.face.normal.y !== 0) {
1025
- this.setAttribute('material', 'color', this.userData.axisY);
1026
- } else {
1027
- this.setAttribute('material', 'color', this.userData.axisX);
1028
- }
1029
-
1030
- this.setAttribute('material', 'opacity', '0.70');
1031
- });
1032
- el.addEventListener('mouseleave', function setPassive() {
1033
- subscription.unsubscribe();
1034
-
1035
- if (checked === false) {
1036
- this.setAttribute('material', 'color', this.userData.markedColor);
1037
- this.setAttribute('material', 'opacity', '0.50');
1038
- }
1039
-
1040
- clickCount = 0;
1041
- });
1042
- el.addEventListener('click', function setActive(evt) {
1043
- clickCount = clickCount + 1;
1044
- checked = false;
1045
- setTimeout(function () {
1046
- clickCount = 0;
1047
- }, 600);
1048
-
1049
- if (clickCount === 2) {
1050
- clickCount = 0;
1051
- checked = true;
1052
- this.setAttribute('material', 'color', '#99ff00');
1053
- this.setAttribute('material', 'opacity', '1');
1054
- var camera = document.getElementById('cameraWrapper');
1055
-
1056
- if (camera !== null) {
1057
- camera.object3D.position.y = this.object3D.position.y + 0.4;
1058
-
1059
- if (this.userData.content > 0.5) {
1060
- camera.setAttribute('animation', "property: position; to: " + (-0.5 + this.object3D.position.x) + " " + this.object3D.position.y + " " + this.object3D.position.z + "\n ; dur: 600; easing: linear;");
1061
- } else if (this.userData.content > 0.2) {
1062
- camera.setAttribute('animation', "property: position; to: " + (-0.5 + this.object3D.position.x) + " " + (this.object3D.position.y + 0.1) + " " + (this.object3D.position.z + 0.5) + "\n ; dur: 600; easing: linear;");
1063
- } else {
1064
- camera.setAttribute('animation', "property: position; to: " + (this.object3D.position.x + 2) + " " + (this.object3D.position.y + 0.1) + " " + (this.object3D.position.z + 8.5) + "\n ; dur: 600; easing: linear;");
1065
- }
1066
- }
1067
- } else if (clickCount === 1) {
1068
- this.setAttribute('material', 'color', '#99ff00');
1069
- this.setAttribute('material', 'opacity', '1');
1070
- localStorageService.storeCurrentBinToLocalStorage(this.userData);
1071
- jsrootSubject.showBinProjection(this.userData);
1072
-
1073
- switch (getActiveTool()) {
1074
- case 1:
1075
- binData.next(this.userData);
1076
- break;
1077
- }
1078
- }
1079
-
1080
- var infoBanner = document.getElementById('th2-banner');
1081
-
1082
- if (infoBanner === null) {
1083
- infoBanner = document.getElementById('th3-banner');
1084
- }
1085
-
1086
- if (infoBanner !== null) {
1087
- var planes = infoBanner.childNodes;
1088
-
1089
- if (this.userData.typeName === 'TH3' && planes.length === 5) {
1090
- var zCor = "[" + this.userData.zTitle + "] [" + this.userData.zMin + "," + this.userData.zMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1091
- var xCor = "[" + this.userData.xTitle + "] [" + this.userData.xMin + "," + this.userData.xMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1092
- var yCor = "[" + this.userData.yTitle + "] [" + this.userData.yMin + "," + this.userData.yMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1093
- var content = "Content: " + this.userData.absoluteContent + " [" + this.userData.content + "]\n";
1094
- planes[0].setAttribute('text', "value: " + content + "; color: " + this.userData.color + "; align: center; width: 30; height: auto;");
1095
- planes[1].setAttribute('text', "value: " + xCor + "; color: " + this.userData.axisX + "; align: center; width: 30; height: auto;");
1096
- planes[2].setAttribute('text', "value: " + yCor + "; color: " + this.userData.axisY + "; align: center; width: 30; height: auto;");
1097
- planes[3].setAttribute('text', "value: " + zCor + "; color: " + this.userData.axisZ + "; align: center; width: 30; height: auto;");
1098
- } else {
1099
- var _content = "Content: " + this.userData.absoluteContent + " [" + this.userData.content + "]\n";
1100
-
1101
- var _xCor = "[" + this.userData.xTitle + "] [" + this.userData.xMin + "," + this.userData.xMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1102
-
1103
- var _yCor = "[" + this.userData.yTitle + "] [" + this.userData.yMin + "," + this.userData.yMax + "] " + (this.userData.binName !== '' ? this.userData.binName + '\n' : '\n');
1104
-
1105
- planes[0].setAttribute('text', "value: " + _content + "; color: " + this.userData.color + "; align: center; baseline: center; width: 30; height: auto;");
1106
- planes[1].setAttribute('text', "value: " + _xCor + "; color: " + this.userData.axisX + "; align: center; width: 30; height: auto;");
1107
- planes[2].setAttribute('text', "value: " + _yCor + "; color: " + this.userData.axisY + "; align: center; width: 30; height: auto;");
1108
- }
1109
- }
1110
- });
1111
- },
1112
- update: function update() {
1113
- var el = this.el;
1114
- el.setAttribute('material', 'color', el.userData.markedColor);
1115
- el.setAttribute('material', 'opacity', '0.75');
1116
- }
1117
- });
1118
-
1119
- var AFRAME = window.AFRAME;
1120
-
1121
- var NdmVrCamera = function NdmVrCamera() {
1122
- var subscription;
1123
- var activeToolHighlight = '0 -0.75 -1';
1124
- var binDataSubscription;
1125
-
1126
- var _useState = useState('value: Bin data:\nX: null\nY: null\nZ: null;color: black;'),
1127
- selectedBinData = _useState[0],
1128
- setSelectedBinData = _useState[1];
1129
-
1130
- var offset = 30;
1131
-
1132
- var _useState2 = useState(0),
1133
- rotation = _useState2[0],
1134
- setRotation = _useState2[1];
1135
-
1136
- var _useState3 = useState(null),
1137
- prevPosition = _useState3[0],
1138
- setPrevPosition = _useState3[1];
1139
-
1140
- var _useState4 = useState('keyboard'),
1141
- inputDevice = _useState4[0],
1142
- setInputDevice = _useState4[1];
1143
-
1144
- var _useState5 = useState(false),
1145
- show = _useState5[0],
1146
- setShow = _useState5[1];
1147
-
1148
- var _useState6 = useState(false),
1149
- showProjection = _useState6[0],
1150
- setShowProjection = _useState6[1];
1151
-
1152
- var _useState7 = useState(3),
1153
- activeTool = _useState7[0],
1154
- setActiveTool = _useState7[1];
1155
-
1156
- toolsSelector.subscribe(function (value) {
1157
- setActiveTool(value);
1158
-
1159
- if (value === 1) {
1160
- binDataSubscription = binData.subscribe(function (value) {
1161
- return setSelectedBinData(String('value: Bin data:\n' + 'X: ' + value.xPos + '\n' + 'Y: ' + value.yPos + '\n' + 'Z: ' + value.zPos + '; color: black;'));
1162
- });
1163
- } else {
1164
- if (binDataSubscription) binDataSubscription.unsubscribe();
1165
- }
1166
- });
1167
-
1168
- var handleSubscription = function handleSubscription(data) {
1169
- if (data.device) {
1170
- if (inputDevice !== data.device) {
1171
- setInputDevice(data.device);
1172
- }
1173
-
1174
- setShow(!show);
1175
- } else if (data === 'shift') {
1176
- compileRotation();
1177
- } else if (data === 'show') {
1178
- setShowProjection(!showProjection);
1179
- }
1180
- };
1181
-
1182
- var compileRotation = function compileRotation() {
1183
- var currentRotation = rotation + 90;
1184
- if (currentRotation >= 360) currentRotation = 0;
1185
- setRotation(currentRotation);
1186
- };
1187
-
1188
- var renderProjectionsBanners = function renderProjectionsBanners() {
1189
- return /*#__PURE__*/React.createElement("a-entity", {
1190
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1191
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
1192
- material: "color: white"
1193
- }, /*#__PURE__*/React.createElement("a-entity", {
1194
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1195
- position: "-30 28 0",
1196
- rotation: "45 90 0",
1197
- material: "color:white;"
1198
- }, /*#__PURE__*/React.createElement("a-text", {
1199
- color: "black",
1200
- width: 50,
1201
- value: inputDevice === 'keyboard' ? 'Press C to show help panels' : 'Press Button X to show help panels',
1202
- position: "-20 2.8 1"
1203
- }), /*#__PURE__*/React.createElement("a-text", {
1204
- color: "black",
1205
- width: 50,
1206
- value: inputDevice === 'keyboard' ? 'Press V to switch to histogram view' : 'Press Button Y to switch to histogram view',
1207
- position: "-20 0 1"
1208
- }), /*#__PURE__*/React.createElement("a-text", {
1209
- color: "black",
1210
- width: 50,
1211
- value: inputDevice === 'keyboard' ? 'Press X to shift panels' : 'Press right Trigger to shift panels',
1212
- position: "-20 -2.8 1"
1213
- })), /*#__PURE__*/React.createElement("a-box", {
1214
- id: "bannerId_1",
1215
- scale: "80 50 2",
1216
- animation__position: "property: position; from: 0 0 -60; to: 0 -1 -42; delay: 0; dur: 800; easing: linear;",
1217
- material: "transparent:true"
1218
- }), /*#__PURE__*/React.createElement("a-box", {
1219
- scale: "80 52 2",
1220
- animation__position: "property: position; from: 0 0 -60; to: 0 0 -42.5; delay: 0; dur: 800; easing: linear;",
1221
- material: "color: white;"
1222
- }), /*#__PURE__*/React.createElement("a-box", {
1223
- id: "bannerId_2",
1224
- scale: "80 50 2",
1225
- animation__position: "property: position; from: 60 0 0; to: 42 -1 0; delay: 200; dur: 800; easing: linear;",
1226
- rotation: "0 90 0",
1227
- material: "transparent:true"
1228
- }), /*#__PURE__*/React.createElement("a-box", {
1229
- scale: "80 52 2",
1230
- animation__position: "property: position; from: 60 0 0; to: 42.5 0 0; delay: 200; dur: 800; easing: linear;",
1231
- rotation: "0 90 0",
1232
- material: "color: white;"
1233
- }), /*#__PURE__*/React.createElement("a-box", {
1234
- id: "bannerId_3",
1235
- scale: "80 50 2",
1236
- animation__position: "property: position; from: 0 0 60; to: 0 -1 42; delay: 400; dur: 800; easing: linear;",
1237
- material: "transparent:true"
1238
- }), /*#__PURE__*/React.createElement("a-box", {
1239
- scale: "80 52 2",
1240
- animation__position: "property: position; from: 0 0 60; to: 0 0 42.5; delay: 400; dur: 800; easing: linear;",
1241
- material: "color: white;"
1242
- }), /*#__PURE__*/React.createElement("a-box", {
1243
- id: "bannerId_4",
1244
- scale: "80 50 2",
1245
- animation__position: "property: position; from: -60 0 0; to: -42 -1 0; delay: 600; dur: 800; easing: linear;",
1246
- rotation: "0 90 0",
1247
- material: "transparent:true"
1248
- }), /*#__PURE__*/React.createElement("a-box", {
1249
- scale: "80 52 2",
1250
- animation__position: "property: position; from: -60 0 0; to: -42.5 0 0; delay: 600; dur: 800; easing: linear;",
1251
- rotation: "0 90 0",
1252
- material: "color: white;"
1253
- }));
1254
- };
1255
-
1256
- var renderBannersWithControls = function renderBannersWithControls() {
1257
- if (inputDevice === 'keyboard') {
1258
- return /*#__PURE__*/React.createElement("a-entity", {
1259
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1260
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;",
1261
- material: "color: white"
1262
- }, /*#__PURE__*/React.createElement("a-entity", {
1263
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1264
- position: "-30 28 0",
1265
- rotation: "45 90 0",
1266
- material: "color: white"
1267
- }, /*#__PURE__*/React.createElement("a-text", {
1268
- color: "black",
1269
- width: "50",
1270
- value: showProjection ? 'Press C to show help panels' : 'Press C to show projection panels',
1271
- position: "-20 2.8 1"
1272
- }), /*#__PURE__*/React.createElement("a-text", {
1273
- color: "black",
1274
- width: "50",
1275
- value: "Press V to switch to histogram view",
1276
- position: "-20 0 1"
1277
- }), /*#__PURE__*/React.createElement("a-text", {
1278
- color: "black",
1279
- width: "50",
1280
- value: "Press X to shift panels",
1281
- position: "-20 -2.8 1"
1282
- })), /*#__PURE__*/React.createElement("a-box", {
1283
- scale: "80 50 2",
1284
- animation__position: "property: position; from: -30 0 60; to: -30 0 30; delay: 0; dur: 800; easing: linear;",
1285
- rotation: "0 -45 0",
1286
- src: "./ndmvr/keyboardControls/keyboard.png"
1287
- }), /*#__PURE__*/React.createElement("a-box", {
1288
- scale: "80 50 2",
1289
- animation__position: "property: position; from: -30 0 -60; to: -30 0 -30; delay: 200; dur: 800; easing: linear;",
1290
- rotation: "0 45 0",
1291
- src: "./ndmvr/keyboardControls/keyboard1.png"
1292
- }), /*#__PURE__*/React.createElement("a-box", {
1293
- scale: "80 50 2",
1294
- animation__position: "property: position; from: 30 0 -60; to: 30 0 -30; delay: 400; dur: 800; easing: linear;",
1295
- rotation: "0 -45 0",
1296
- src: "./ndmvr/keyboardControls/keyboard2.png"
1297
- }), /*#__PURE__*/React.createElement("a-box", {
1298
- scale: "80 50 2",
1299
- animation__position: "property: position; from: 30 0 60; to: 30 0 30; delay: 600; dur: 800; easing: linear;",
1300
- rotation: " 0 45 0",
1301
- src: "./ndmvr/keyboardControls/keyboard3.png"
1302
- }));
1303
- } else {
1304
- return /*#__PURE__*/React.createElement("a-entity", {
1305
- position: prevPosition === null ? "0 " + offset + " 0" : prevPosition.x + " " + offset + " " + prevPosition.z,
1306
- animation__rotation: "property: rotation; to: 0 " + rotation + " 0; dur: 1000; easing: linear;"
1307
- }, /*#__PURE__*/React.createElement("a-entity", {
1308
- geometry: "primitive: box; width: 50; height: 10; depth: 0.1;",
1309
- position: "-30 28 0",
1310
- rotation: "45 90 0",
1311
- material: "color: white"
1312
- }, /*#__PURE__*/React.createElement("a-text", {
1313
- color: "black",
1314
- width: "50",
1315
- value: showProjection ? 'Press Button X to show help panels' : 'Press Button X to show projection panels',
1316
- position: "-20 2.8 1"
1317
- }), /*#__PURE__*/React.createElement("a-text", {
1318
- color: "black",
1319
- width: "50",
1320
- value: "Press Button Y to switch to histogram view",
1321
- position: "-20 0 1"
1322
- }), /*#__PURE__*/React.createElement("a-text", {
1323
- color: "black",
1324
- width: "50",
1325
- value: "Press right Trigger to shift panels",
1326
- position: "-20 -2.8 1"
1327
- })), /*#__PURE__*/React.createElement("a-box", {
1328
- scale: "80 50 2",
1329
- animation__position: "property: position; from: -35 0 60; to: -32 0 32; delay: 0; dur: 800; easing: linear;",
1330
- rotation: "-10 -45 0",
1331
- src: "./ndmvr/oculusControls/oculus.png"
1332
- }), /*#__PURE__*/React.createElement("a-box", {
1333
- scale: "80 50 2",
1334
- animation__position: "property: position; from: -35 0 -60; to: -32 0 -32; delay: 200; dur: 800; easing: linear;",
1335
- rotation: "10 45 0",
1336
- src: "./ndmvr/oculusControls/oculus2.png"
1337
- }), /*#__PURE__*/React.createElement("a-box", {
1338
- scale: "80 50 2",
1339
- animation__position: "property: position; from: 35 0 -60; to: 32 0 -32; delay: 400; dur: 800; easing: linear;",
1340
- rotation: "10 -45 0",
1341
- src: "./ndmvr/oculusControls/oculus1.png"
1342
- }), /*#__PURE__*/React.createElement("a-box", {
1343
- scale: "80 50 2",
1344
- animation__position: "property: position; from: 35 0 60; to: 32 0 32; delay: 600; dur: 800; easing: linear;",
1345
- rotation: "-10 45 0",
1346
- src: "./ndmvr/oculusControls/oculus3.png"
1347
- }));
1348
- }
1349
- };
1350
-
1351
- var hideMappingBanner = function hideMappingBanner() {
1352
- var banner = document.getElementById('th-mapping');
1353
-
1354
- if (banner !== undefined) {
1355
- banner.setAttribute('material', 'opacity', 0);
1356
- }
1357
- };
1358
-
1359
- var showMappingBanner = function showMappingBanner() {
1360
- var banner = document.getElementById('th-mapping');
1361
-
1362
- if (banner !== undefined) {
1363
- banner.setAttribute('material', 'opacity', 1);
1364
- }
1365
- };
1366
-
1367
- useEffect(function () {
1368
- subscription = cameraSubject.getCameraSubject().subscribe(handleSubscription);
1369
- return function () {
1370
- return subscription.unsubscribe();
1371
- };
1372
- }, [show, showProjection, rotation]);
1373
- useEffect(function () {
1374
- var camera = document.getElementById('camera');
1375
-
1376
- if (!show) {
1377
- camera.object3D.position.y = 1.6;
1378
-
1379
- if (prevPosition !== null) {
1380
- camera.object3D.position.x = prevPosition.x;
1381
- camera.object3D.position.z = prevPosition.z;
1382
- camera.object3D.position.y = prevPosition.y;
1383
- }
1384
-
1385
- showMappingBanner();
1386
- } else {
1387
- setPrevPosition({
1388
- x: camera.object3D.position.x,
1389
- y: camera.object3D.position.y,
1390
- z: camera.object3D.position.z
1391
- });
1392
- camera.object3D.position.y = camera.object3D.position.y + offset;
1393
- hideMappingBanner();
1394
- }
1395
- }, [show, inputDevice]);
1396
- useEffect(function () {
1397
- if (showProjection) {
1398
- jsrootService.displayImageOfProjection('projectionContainer', 'bannerId_1', '500px', '400px');
1399
- }
1400
- }, [showProjection]);
1401
-
1402
- var renderActiveTool = function renderActiveTool() {
1403
- switch (activeTool) {
1404
- case 1:
1405
- activeToolHighlight = '-0.675 -0.825 -1';
1406
- break;
1407
-
1408
- case 2:
1409
- activeToolHighlight = '-0.525 -0.825 -1';
1410
- break;
1411
-
1412
- case 3:
1413
- activeToolHighlight = '-0.375 -0.825 -1';
1414
- break;
1415
-
1416
- case 4:
1417
- activeToolHighlight = '-0.225 -0.825 -1';
1418
- break;
1419
-
1420
- case 5:
1421
- activeToolHighlight = '-0.075 -0.825 -1';
1422
- break;
1423
-
1424
- case 6:
1425
- activeToolHighlight = '0.075 -0.825 -1';
1426
- break;
1427
-
1428
- case 7:
1429
- activeToolHighlight = '0.225 -0.825 -1';
1430
- break;
1431
-
1432
- case 8:
1433
- activeToolHighlight = '0.375 -0.825 -1';
1434
- break;
1435
-
1436
- case 9:
1437
- activeToolHighlight = '0.525 -0.825 -1';
1438
- break;
1439
-
1440
- case 0:
1441
- activeToolHighlight = '0.675 -0.825 -1';
1442
- break;
1443
- }
1444
-
1445
- var tools = ['info', 2, 3, 4, 5, 6, 7, 8, 9, 0];
1446
- var toolNumXPos = -0.825;
1447
- return /*#__PURE__*/React.createElement(React.Fragment, null, tools.map(function (tool) {
1448
- var txt;
1449
- toolNumXPos = toolNumXPos + 0.15;
1450
- var txtPos = String(toolNumXPos + ' -0.78' + ' -1');
1451
- if (tools.indexOf(tool) + 1 === activeTool) txt = String('value: ' + tool + '; color: #0F52BA;width:1.4;align:center');else txt = String('value: ' + tool + '; color: black;width:1;align:center');
1452
- return /*#__PURE__*/React.createElement("a-entity", {
1453
- key: tools.indexOf(tool),
1454
- text: txt,
1455
- position: txtPos,
1456
- material: "shader: flat;"
1457
- });
1458
- }), /*#__PURE__*/React.createElement("a-entity", {
1459
- geometry: "primitive: plane; height: 0.007; width: 0.17",
1460
- position: activeToolHighlight,
1461
- material: "color: #0F52BA;"
1462
- }));
1463
- };
1464
-
1465
- var renderOculusControls = function renderOculusControls() {
1466
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a-entity", {
1467
- "laser-controls": "hand: right",
1468
- raycaster: "objects: .clickable; lineOpacity: 0.5; far: 20;"
1469
- }), /*#__PURE__*/React.createElement("a-entity", {
1470
- "oculus-touch-controls": "hand: left",
1471
- "left-controller-logging": true
1472
- }), /*#__PURE__*/React.createElement("a-entity", {
1473
- "oculus-touch-controls": "hand: right",
1474
- "right-controller-logging": true
1475
- }));
1476
- };
1477
-
1478
- return /*#__PURE__*/React.createElement("a-entity", {
1479
- id: "cameraWrapper",
1480
- rotation: "0 -135 0",
1481
- position: "-7 2 -7"
1482
- }, show && !showProjection && renderBannersWithControls(), show && showProjection && renderProjectionsBanners(), /*#__PURE__*/React.createElement("a-camera", {
1483
- id: "camera",
1484
- "look-control": true,
1485
- "wasd-controls-enabled": "acceleration:=50"
1486
- }, /*#__PURE__*/React.createElement("a-entity", {
1487
- geometry: "primitive: plane; height: 0.2; width: 2",
1488
- position: "0 -0.825 -1",
1489
- material: "color: #eee;shader: flat;"
1490
- }), /*#__PURE__*/React.createElement("a-entity", {
1491
- geometry: "primitive: plane; height: 0.001; width: 1.75",
1492
- position: "0 -0.825 -1",
1493
- material: "color: #aaa;shader: flat;"
1494
- }), activeTool === 1 && /*#__PURE__*/React.createElement("a-entity", {
1495
- text: selectedBinData,
1496
- position: "-0.8 0.7 -1"
1497
- }), renderActiveTool(), !AFRAME.utils.device.checkHeadsetConnected() && /*#__PURE__*/React.createElement("a-entity", {
1498
- cursor: "fuse: false; fuseTimeout: 2000;",
1499
- raycaster: "objects: .clickable; showLine: false; far: 100;",
1500
- animation__click: "property: scale; startEvents: click; from: 0.1 0.1 0.1; to: 1.4 1.4 1.4; dur: 150",
1501
- animation__mouseenter: "property: scale; startEvents: mouseenter; from: 1 1 1; to: 1.4 1.4 1.4; dur: 180",
1502
- animation__mouseleave: "property: scale; startEvents: mouseleave; from: 1.4 1.4 1.4; to: 1 1 1; dur: 180",
1503
- line: "color: orange; opacity: 0.5",
1504
- far: "100",
1505
- position: "0 0 -1",
1506
- geometry: "primitive: ring; radiusInner: 0.02; radiusOuter: 0.03",
1507
- material: "color: white; shader: flat"
1508
- })), AFRAME.utils.device.checkHeadsetConnected() && renderOculusControls());
1509
- };
1510
-
1511
- AFRAME$1.registerComponent('binth', {
1512
- schema: {
1513
- id: {
1514
- type: 'string'
1515
- },
1516
- typeName: {
1517
- type: 'string'
1518
- },
1519
- content: {
1520
- "default": 0
1521
- },
1522
- absoluteContent: {
1523
- "default": 0
1524
- },
1525
- binName: {
1526
- "default": ''
1527
- },
1528
- xTitle: {
1529
- type: 'string'
1530
- },
1531
- yTitle: {
1532
- type: 'string'
1533
- },
1534
- zTitle: {
1535
- type: 'string'
1536
- },
1537
- xMin: {
1538
- type: 'number'
1539
- },
1540
- yMin: {
1541
- type: 'number'
1542
- },
1543
- zMin: {
1544
- type: 'number'
1545
- },
1546
- xMax: {
1547
- type: 'number'
1548
- },
1549
- yMax: {
1550
- type: 'number'
1551
- },
1552
- zMax: {
1553
- type: 'number'
1554
- },
1555
- xPos: {
1556
- type: 'number'
1557
- },
1558
- yPos: {
1559
- type: 'number'
1560
- },
1561
- zPos: {
1562
- type: 'number'
1563
- },
1564
- xCenter: {
1565
- type: 'number'
1566
- },
1567
- yCenter: {
1568
- type: 'number'
1569
- },
1570
- zCenter: {
1571
- type: 'number'
1572
- },
1573
- xWidth: {
1574
- type: 'number'
1575
- },
1576
- yWidth: {
1577
- type: 'number'
1578
- },
1579
- zWidth: {
1580
- type: 'number'
1581
- },
1582
- color: {
1583
- type: 'string'
1584
- },
1585
- axisX: {
1586
- type: 'string'
1587
- },
1588
- axisY: {
1589
- type: 'string'
1590
- },
1591
- axisZ: {
1592
- type: 'string'
1593
- },
1594
- selectColor: {
1595
- type: 'string'
1596
- },
1597
- markedColor: {
1598
- type: 'string'
1599
- }
1600
- },
1601
- init: function init() {
1602
- var el = this.el;
1603
- el.userData = {
1604
- typeName: this.data.typeName,
1605
- id: this.data.id,
1606
- content: this.data.content,
1607
- absoluteContent: this.data.absoluteContent,
1608
- binName: this.data.binName,
1609
- xTitle: this.data.xTitle,
1610
- yTitle: this.data.yTitle,
1611
- zTitle: this.data.zTitle,
1612
- xMin: this.data.xMin,
1613
- yMin: this.data.yMin,
1614
- zMin: this.data.zMin,
1615
- xMax: this.data.xMax,
1616
- yMax: this.data.yMax,
1617
- zMax: this.data.zMax,
1618
- xPos: this.data.xPos,
1619
- yPos: this.data.yPos,
1620
- zPos: this.data.zPos,
1621
- xCenter: this.data.xCenter,
1622
- yCenter: this.data.yCenter,
1623
- zCenter: this.data.zCenter,
1624
- xWidth: this.data.xWidth,
1625
- yWidth: this.data.yWidth,
1626
- zWidth: this.data.zWidth,
1627
- color: this.data.color,
1628
- axisX: this.data.axisX,
1629
- axisY: this.data.axisY,
1630
- axisZ: this.data.axisZ,
1631
- selectColor: this.data.selectColor,
1632
- markedColor: this.data.markedColor
1633
- };
1634
- },
1635
- update: function update() {
1636
- var el = this.el;
1637
- el.userData = {
1638
- typeName: this.data.typeName,
1639
- id: this.data.id,
1640
- content: this.data.content,
1641
- absoluteContent: this.data.absoluteContent,
1642
- binName: this.data.binName,
1643
- xTitle: this.data.xTitle,
1644
- yTitle: this.data.yTitle,
1645
- zTitle: this.data.zTitle,
1646
- xMin: this.data.xMin,
1647
- yMin: this.data.yMin,
1648
- zMin: this.data.zMin,
1649
- xMax: this.data.xMax,
1650
- yMax: this.data.yMax,
1651
- zMax: this.data.zMax,
1652
- xPos: this.data.xPos,
1653
- yPos: this.data.yPos,
1654
- zPos: this.data.zPos,
1655
- xCenter: this.data.xCenter,
1656
- yCenter: this.data.yCenter,
1657
- zCenter: this.data.zCenter,
1658
- xWidth: this.data.xWidth,
1659
- yWidth: this.data.yWidth,
1660
- zWidth: this.data.zWidth,
1661
- color: this.data.color,
1662
- axisX: this.data.axisX,
1663
- axisY: this.data.axisY,
1664
- axisZ: this.data.axisZ,
1665
- selectColor: this.data.selectColor,
1666
- markedColor: this.data.markedColor
1667
- };
1668
- }
1669
- });
1670
-
1671
- AFRAME$1.registerComponent('histogram-control', {
1672
- schema: {
1673
- position: {
1674
- name: 'position',
1675
- xValue: 0,
1676
- yValue: 0,
1677
- zValue: 0
1678
- },
1679
- scale: {
1680
- name: 'scale',
1681
- xValue: 2,
1682
- yValue: 2,
1683
- zValue: 2
1684
- },
1685
- rotation: {
1686
- name: 'rotation',
1687
- xValue: 0,
1688
- yValue: 0,
1689
- zValue: 0
1690
- }
1691
- },
1692
- init: function init() {
1693
- var el = this.el;
1694
- initialKeyboardController(this.schema, el);
1695
- document.addEventListener('keydown', keyPressHandlerFunction);
1696
- document.addEventListener('keyup', keyReleaseHandlerFunction);
1697
- document.addEventListener('wheel', switchDisplayModeOnBin);
1698
- },
1699
- update: function update() {
1700
- keyboardUpdateCameraReference();
1701
- }
1702
- });
1703
-
1704
- AFRAME$1.registerComponent('label-handler', {
1705
- schema: {
1706
- value: {
1707
- type: 'string'
1708
- },
1709
- delay: {
1710
- type: 'number'
1711
- }
1712
- },
1713
- init: function init() {
1714
- var el = this.el;
1715
- this.value = this.data.value;
1716
- el.setAttribute('text', 'value', this.data.value);
1717
- },
1718
- update: function update() {
1719
- var _this = this;
1720
-
1721
- var el = this.el;
1722
-
1723
- if (this.value !== this.data.value) {
1724
- setTimeout(function () {
1725
- el.setAttribute('text', 'value', _this.data.value);
1726
- }, this.data.delay);
1727
- this.value = this.data.value;
1728
- }
1729
- }
1730
- });
1731
-
1732
- var palette = {
1733
- def: {
1734
- colorPalette: ['#4b0066', '#8300b3', '#bb00ff', '#cf4dff', '#e499ff', '#ffffcc', '#ffff99', '#ffff66', '#ffff33', '#fcba03'],
1735
- axis: {
1736
- x: '#ad0c00',
1737
- y: '#0206de',
1738
- z: '#007d1d'
1739
- },
1740
- accent: {
1741
- primary: '#4b0066',
1742
- secondary: '#FF3700'
1743
- },
1744
- font: {
1745
- primary: 'black',
1746
- secondary: 'black'
1747
- }
1748
- },
1749
- fire: {
1750
- colorPalette: ['#5b0000', '#7b2100', '#a23b00', '#c84900', '#df5900', '#f18800', '#f1a000', '#ffae00', '#ffcd19', '#ffe159'],
1751
- axis: {
1752
- x: '#ad0c00',
1753
- y: '#0206de',
1754
- z: '#007d1d'
1755
- },
1756
- accent: {
1757
- primary: '#5b0000',
1758
- secondary: '#b000d4'
1759
- },
1760
- font: {
1761
- primary: 'black',
1762
- secondary: 'black'
1763
- }
1764
- },
1765
- nebula: {
1766
- colorPalette: ['#13004b', '#320065', '#4e0085', '#6100a5', '#7000b8', '#9800c6', '#ab00c6', '#b900d2', '#d700da', '#ff6efc'],
1767
- axis: {
1768
- x: '#ad0c00',
1769
- y: '#0206de',
1770
- z: '#007d1d'
1771
- },
1772
- accent: {
1773
- primary: '#13004b',
1774
- secondary: '#ff3700'
1775
- },
1776
- font: {
1777
- primary: 'black',
1778
- secondary: 'black'
1779
- }
1780
- },
1781
- rainforest: {
1782
- colorPalette: ['#005b01', '#007b23', '#00a23d', '#00c84c', '#00df5c', '#00f18b', '#00ffb1', '#19ffd0', '#a6fffe', '#56fffe'],
1783
- axis: {
1784
- x: '#ad0c00',
1785
- y: '#0206de',
1786
- z: '#007d1d'
1787
- },
1788
- accent: {
1789
- primary: '#005b01',
1790
- secondary: '#ff3700'
1791
- },
1792
- font: {
1793
- primary: 'black',
1794
- secondary: 'black'
1795
- }
1796
- },
1797
- nature: {
1798
- colorPalette: ['#4a691a', '#5e8425', '#79a834', '#91c640', '#9ed64b', '#a8dc59', '#b0e166', '#bfeb7c', '#d7fba2', '#deffad'],
1799
- axis: {
1800
- x: '#ad0c00',
1801
- y: '#0206de',
1802
- z: '#007d1d'
1803
- },
1804
- accent: {
1805
- primary: '#4a691a',
1806
- secondary: '#b000d4'
1807
- },
1808
- font: {
1809
- primary: 'black',
1810
- secondary: 'black'
1811
- }
1812
- },
1813
- water: {
1814
- colorPalette: ['#00545a', '#00717a', '#0097a2', '#00bac8', '#00cede', '#00dff0', '#00edff', '#45f2ff', '#7ef6ff', '#bdfaff'],
1815
- axis: {
1816
- x: '#ad0c00',
1817
- y: '#0206de',
1818
- z: '#007d1d'
1819
- },
1820
- accent: {
1821
- primary: '#00545a',
1822
- secondary: '#ff3700'
1823
- },
1824
- font: {
1825
- primary: 'black',
1826
- secondary: 'black'
1827
- }
1828
- },
1829
- sunflower: {
1830
- colorPalette: ['#1e3600', '#2e4d00', '#507001', '#91a004', '#b4bb06', '#d2d309', '#eeed0f', '#ffff28', '#ffff85', '#ffffc2'],
1831
- axis: {
1832
- x: '#ad0c00',
1833
- y: '#0206de',
1834
- z: '#007d1d'
1835
- },
1836
- accent: {
1837
- primary: '#1e3600',
1838
- secondary: '#ff3700'
1839
- },
1840
- font: {
1841
- primary: 'black',
1842
- secondary: 'black'
1843
- }
1844
- },
1845
- blood: {
1846
- colorPalette: ['#470101', '#6e0101', '#800b0b', '#940c0c', '#a30000', '#bd0909', '#e01f1f', '#d43b3b', '#db5e5e', '#f78888'],
1847
- axis: {
1848
- x: '#ad0c00',
1849
- y: '#0206de',
1850
- z: '#007d1d'
1851
- },
1852
- accent: {
1853
- primary: '#470101',
1854
- secondary: '#f6ff00'
1855
- },
1856
- font: {
1857
- primary: 'black',
1858
- secondary: 'black'
1859
- }
1860
- },
1861
- magma: {
1862
- colorPalette: ['#dbff1d', '#d5e814', '#d5d007', '#cc9b00', '#b87600', '#9c4a00', '#812f00', '#661900', '#661420', '#2b0000'],
1863
- axis: {
1864
- x: '#8a0000',
1865
- y: '#03017a',
1866
- z: '#015e03'
1867
- },
1868
- accent: {
1869
- primary: '#2b0000',
1870
- secondary: '#ae2000'
1871
- },
1872
- font: {
1873
- primary: 'black',
1874
- secondary: 'black'
1875
- }
1876
- },
1877
- jupiter: {
1878
- colorPalette: ['#00340f', '#00344f', '#006e3a', '#00976a', '#26efd0', '#9c4a00', '#9c4a00', '#812f00', '#661900', '#2b0000'],
1879
- axis: {
1880
- x: '#8a0000',
1881
- y: '#03017a',
1882
- z: '#015e03'
1883
- },
1884
- accent: {
1885
- primary: '#00340f',
1886
- secondary: '#e3ff5b'
1887
- },
1888
- font: {
1889
- primary: 'black',
1890
- secondary: 'black'
1891
- }
1892
- },
1893
- magic: {
1894
- colorPalette: ['#342000', '#6e5e00', '#888500', '#919700', '#8dbe00', '#caef26', '#cf6e85', '#b300b8', '#6b0090', '#3b0066'],
1895
- axis: {
1896
- x: '#8a0000',
1897
- y: '#03017a',
1898
- z: '#015e03'
1899
- },
1900
- accent: {
1901
- primary: '#342000',
1902
- secondary: '#c85bff'
1903
- },
1904
- font: {
1905
- primary: 'black',
1906
- secondary: 'black'
1907
- }
1908
- }
1909
- };
1910
-
1911
- var ThemeProvider = /*#__PURE__*/function () {
1912
- function ThemeProvider(theme) {
1913
- if (palette[theme]) {
1914
- this.xAxis = palette[theme].axis.x;
1915
- this.yAxis = palette[theme].axis.y;
1916
- this.zAxis = palette[theme].axis.z;
1917
- this.palette = palette[theme].colorPalette;
1918
- this.primaryAccent = palette[theme].accent.primary;
1919
- this.secondaryAccent = palette[theme].accent.secondary;
1920
- this.primaryFont = palette[theme].font.primary;
1921
- this.secondaryFont = palette[theme].font.secondary;
1922
- } else {
1923
- this.xAxis = palette.def.axis.x;
1924
- this.yAxis = palette.def.axis.y;
1925
- this.zAxis = palette.def.axis.z;
1926
- this.palette = palette.def.colorPalette;
1927
- this.primaryAccent = palette.def.accent.primary;
1928
- this.secondaryAccent = palette.def.accent.secondary;
1929
- this.primaryFont = palette.def.font.primary;
1930
- this.secondaryFont = palette.def.font.secondary;
1931
- }
1932
- }
1933
-
1934
- var _proto = ThemeProvider.prototype;
1935
-
1936
- _proto.getAxisColor = function getAxisColor(axis) {
1937
- if (axis === 'x' || axis === 'X') return this.xAxis;
1938
- if (axis === 'y' || axis === 'Y') return this.yAxis;
1939
- if (axis === 'z' || axis === 'Z') return this.zAxis;
1940
- return null;
1941
- };
1942
-
1943
- _proto.getPrimaryAccentColor = function getPrimaryAccentColor() {
1944
- return this.primaryAccent;
1945
- };
1946
-
1947
- _proto.getSecondaryAccentColor = function getSecondaryAccentColor() {
1948
- return this.secondaryAccent;
1949
- };
1950
-
1951
- _proto.getPrimaryFontColor = function getPrimaryFontColor() {
1952
- return this.primaryFont;
1953
- };
1954
-
1955
- _proto.getSecondaryFontColor = function getSecondaryFontColor() {
1956
- return this.secondaryFont;
1957
- };
1958
-
1959
- _proto.getBinColor = function getBinColor(content) {
1960
- var fullContent = 1;
1961
- var color = this.palette[0];
1962
-
1963
- if (content >= fullContent) {
1964
- return this.palette[9];
1965
- }
1966
-
1967
- var difference = 0.12;
1968
- var sum = difference;
1969
-
1970
- for (var i = 0; i <= 9; i++) {
1971
- if (content <= sum) {
1972
- color = this.palette[i];
1973
- break;
1974
- }
1975
-
1976
- sum += difference;
1977
- }
1978
-
1979
- return color;
1980
- };
1981
-
1982
- return ThemeProvider;
1983
- }();
1984
-
1985
- var _id = /*#__PURE__*/_classPrivateFieldLooseKey("id");
1986
-
1987
- var _selectedBins$1 = /*#__PURE__*/_classPrivateFieldLooseKey("selectedBins");
1988
-
1989
- var _histogram = /*#__PURE__*/_classPrivateFieldLooseKey("histogram");
1990
-
1991
- var _type = /*#__PURE__*/_classPrivateFieldLooseKey("type");
1992
-
1993
- var _projections = /*#__PURE__*/_classPrivateFieldLooseKey("projections");
1994
-
1995
- var _themeProvider = /*#__PURE__*/_classPrivateFieldLooseKey("themeProvider");
1996
-
1997
- var _xOffset = /*#__PURE__*/_classPrivateFieldLooseKey("xOffset");
1998
-
1999
- var _yOffset = /*#__PURE__*/_classPrivateFieldLooseKey("yOffset");
2000
-
2001
- var _zOffset = /*#__PURE__*/_classPrivateFieldLooseKey("zOffset");
2002
-
2003
- var _xLimit = /*#__PURE__*/_classPrivateFieldLooseKey("xLimit");
2004
-
2005
- var _yLimit = /*#__PURE__*/_classPrivateFieldLooseKey("yLimit");
2006
-
2007
- var _zLimit = /*#__PURE__*/_classPrivateFieldLooseKey("zLimit");
2008
-
2009
- var _xWidth = /*#__PURE__*/_classPrivateFieldLooseKey("xWidth");
2010
-
2011
- var _yWidth = /*#__PURE__*/_classPrivateFieldLooseKey("yWidth");
2012
-
2013
- var _zWidth = /*#__PURE__*/_classPrivateFieldLooseKey("zWidth");
2014
-
2015
- var _range = /*#__PURE__*/_classPrivateFieldLooseKey("range");
2016
-
2017
- var _labels = /*#__PURE__*/_classPrivateFieldLooseKey("labels");
2018
-
2019
- var _contentScale = /*#__PURE__*/_classPrivateFieldLooseKey("contentScale");
2020
-
2021
- var _minDisplayedContent = /*#__PURE__*/_classPrivateFieldLooseKey("minDisplayedContent");
2022
-
2023
- var _binScaleCoef = /*#__PURE__*/_classPrivateFieldLooseKey("binScaleCoef");
2024
-
2025
- var _shift = /*#__PURE__*/_classPrivateFieldLooseKey("shift");
2026
-
2027
- var _previousBins = /*#__PURE__*/_classPrivateFieldLooseKey("previousBins");
2028
-
2029
- var _checkOffsetValue = /*#__PURE__*/_classPrivateFieldLooseKey("checkOffsetValue");
2030
-
2031
- var _checkBinState = /*#__PURE__*/_classPrivateFieldLooseKey("checkBinState");
2032
-
2033
- var _createAxisEntity = /*#__PURE__*/_classPrivateFieldLooseKey("createAxisEntity");
2034
-
2035
- var _createTH3Histogram = /*#__PURE__*/_classPrivateFieldLooseKey("createTH3Histogram");
2036
-
2037
- var _createTH2Histogram = /*#__PURE__*/_classPrivateFieldLooseKey("createTH2Histogram");
2038
-
2039
- var _optimizeBinContent = /*#__PURE__*/_classPrivateFieldLooseKey("optimizeBinContent");
2040
-
2041
- var _getValidOffset = /*#__PURE__*/_classPrivateFieldLooseKey("getValidOffset");
2042
-
2043
- var _editTH3OffsetByOffset = /*#__PURE__*/_classPrivateFieldLooseKey("editTH3OffsetByOffset");
2044
-
2045
- var _projectionFunction = /*#__PURE__*/_classPrivateFieldLooseKey("projectionFunction");
2046
-
2047
- var _editTH2OffsetByOffset = /*#__PURE__*/_classPrivateFieldLooseKey("editTH2OffsetByOffset");
2048
-
2049
- var _getPreviousBinScales = /*#__PURE__*/_classPrivateFieldLooseKey("getPreviousBinScales");
2050
-
2051
- var _getPreviousBinColor = /*#__PURE__*/_classPrivateFieldLooseKey("getPreviousBinColor");
2052
-
2053
- var HistogramReactFactory = /*#__PURE__*/function () {
2054
- function HistogramReactFactory(uniqueName, histogram, section, range, projections, theme) {
2055
- var _this = this;
2056
-
2057
- Object.defineProperty(this, _id, {
2058
- writable: true,
2059
- value: ''
2060
- });
2061
- Object.defineProperty(this, _selectedBins$1, {
2062
- writable: true,
2063
- value: []
2064
- });
2065
- Object.defineProperty(this, _histogram, {
2066
- writable: true,
2067
- value: null
2068
- });
2069
- Object.defineProperty(this, _type, {
2070
- writable: true,
2071
- value: ''
2072
- });
2073
- Object.defineProperty(this, _projections, {
2074
- writable: true,
2075
- value: null
2076
- });
2077
- Object.defineProperty(this, _themeProvider, {
2078
- writable: true,
2079
- value: null
2080
- });
2081
- Object.defineProperty(this, _xOffset, {
2082
- writable: true,
2083
- value: 1
2084
- });
2085
- Object.defineProperty(this, _yOffset, {
2086
- writable: true,
2087
- value: 1
2088
- });
2089
- Object.defineProperty(this, _zOffset, {
2090
- writable: true,
2091
- value: 1
2092
- });
2093
- Object.defineProperty(this, _xLimit, {
2094
- writable: true,
2095
- value: 0
2096
- });
2097
- Object.defineProperty(this, _yLimit, {
2098
- writable: true,
2099
- value: 0
2100
- });
2101
- Object.defineProperty(this, _zLimit, {
2102
- writable: true,
2103
- value: 0
2104
- });
2105
- Object.defineProperty(this, _xWidth, {
2106
- writable: true,
2107
- value: 1
2108
- });
2109
- Object.defineProperty(this, _yWidth, {
2110
- writable: true,
2111
- value: 1
2112
- });
2113
- Object.defineProperty(this, _zWidth, {
2114
- writable: true,
2115
- value: 1
2116
- });
2117
- Object.defineProperty(this, _range, {
2118
- writable: true,
2119
- value: 8
2120
- });
2121
- Object.defineProperty(this, _labels, {
2122
- writable: true,
2123
- value: {
2124
- xInitial: 0,
2125
- yInitial: 0,
2126
- zInitial: 0
2127
- }
2128
- });
2129
- Object.defineProperty(this, _contentScale, {
2130
- writable: true,
2131
- value: 1
2132
- });
2133
- Object.defineProperty(this, _minDisplayedContent, {
2134
- writable: true,
2135
- value: 0
2136
- });
2137
- Object.defineProperty(this, _binScaleCoef, {
2138
- writable: true,
2139
- value: 2
2140
- });
2141
- Object.defineProperty(this, _shift, {
2142
- writable: true,
2143
- value: {
2144
- xOffset: 0,
2145
- yOffset: 0,
2146
- zOffset: 0
2147
- }
2148
- });
2149
- Object.defineProperty(this, _previousBins, {
2150
- writable: true,
2151
- value: []
2152
- });
2153
-
2154
- this.getXOffset = function () {
2155
- return _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset];
2156
- };
2157
-
2158
- this.getYOffset = function () {
2159
- return _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset];
2160
- };
2161
-
2162
- this.getZOffset = function () {
2163
- return _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset];
2164
- };
2165
-
2166
- this.getRange = function () {
2167
- return _classPrivateFieldLooseBase(_this, _range)[_range];
2168
- };
2169
-
2170
- Object.defineProperty(this, _checkOffsetValue, {
2171
- writable: true,
2172
- value: function value(offsetValue, limit) {
2173
- var currOffset = offsetValue > limit - _classPrivateFieldLooseBase(_this, _range)[_range] ? limit - _classPrivateFieldLooseBase(_this, _range)[_range] : offsetValue;
2174
-
2175
- if (currOffset < 1) {
2176
- currOffset = 1;
2177
- }
2178
-
2179
- return currOffset;
2180
- }
2181
- });
2182
- Object.defineProperty(this, _checkBinState, {
2183
- writable: true,
2184
- value: function value(binId) {
2185
- var updatedArray = _classPrivateFieldLooseBase(_this, _selectedBins$1)[_selectedBins$1].filter(function (item) {
2186
- return item.id === binId;
2187
- });
2188
-
2189
- return updatedArray.length !== 0;
2190
- }
2191
- });
2192
- Object.defineProperty(this, _createAxisEntity, {
2193
- writable: true,
2194
- value: function value(id, positionX, positionY, positionZ, rotationX, rotationY, rotationZ, width, height, _value, color, fontColor) {
2195
- return {
2196
- key: id + _classPrivateFieldLooseBase(_this, _id)[_id],
2197
- geometry: {
2198
- primitive: 'plane',
2199
- width: width,
2200
- height: height
2201
- },
2202
- text: {
2203
- color: fontColor,
2204
- width: 4,
2205
- height: 'auto'
2206
- },
2207
- labelHandler: {
2208
- value: _value,
2209
- delay: 500
2210
- },
2211
- rotation: {
2212
- x: rotationX,
2213
- y: rotationY,
2214
- z: rotationZ
2215
- },
2216
- material: {
2217
- color: color
2218
- },
2219
- animation: {
2220
- fromX: positionX + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2221
- fromY: positionY + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2222
- fromZ: positionZ + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2223
- toX: positionX,
2224
- toY: positionY,
2225
- toZ: positionZ
2226
- }
2227
- };
2228
- }
2229
- });
2230
- Object.defineProperty(this, _createTH3Histogram, {
2231
- writable: true,
2232
- value: function value() {
2233
- _classPrivateFieldLooseBase(_this, _selectedBins$1)[_selectedBins$1] = localStorageService.getBinsFromLocalStorage();
2234
- var elements = {
2235
- type: 'TH3',
2236
- bins: [],
2237
- labels: [],
2238
- banners: [],
2239
- ground: {},
2240
- titles: [],
2241
- axisLabels: []
2242
- };
2243
- var xcenter, xmin, xmax, xwidth;
2244
- var ycenter, ymin, ymax, ywidth;
2245
- var zcenter, zmin, zmax, zwidth;
2246
- var binName = '';
2247
- var absoluteContent;
2248
- var c;
2249
- var count = 0;
2250
- var maxXLength = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] ? _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] : _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _range)[_range];
2251
- var maxYLength = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] ? _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] : _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range];
2252
- var maxZLength = _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _zLimit)[_zLimit] ? _classPrivateFieldLooseBase(_this, _zLimit)[_zLimit] : _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] + _classPrivateFieldLooseBase(_this, _range)[_range];
2253
-
2254
- var xTitle = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fTitle;
2255
-
2256
- var yTitle = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fTitle;
2257
-
2258
- var zTitle = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fZaxis.fTitle;
2259
-
2260
- var xLabels = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fLabels ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fLabels.arr : [];
2261
- var yLabels = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fLabels ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fLabels.arr : [];
2262
- var zLabels = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fZaxis.fLabels ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fZaxis.fLabels.arr : [];
2263
- var currentBinScales = [];
2264
-
2265
- for (var iz = _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset]; iz <= maxZLength; iz++) {
2266
- for (var iy = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset]; iy <= maxYLength; iy++) {
2267
- for (var ix = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset]; ix <= maxXLength; ix++) {
2268
- xcenter = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.GetBinCenter(ix);
2269
- xmin = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.GetBinLowEdge(ix);
2270
- xmax = xcenter + (xcenter - xmin);
2271
- xwidth = xmax - xmin;
2272
- ycenter = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.GetBinCenter(iy);
2273
- ymin = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.GetBinLowEdge(iy);
2274
- ymax = ycenter + (ycenter - ymin);
2275
- ywidth = ymax - ymin;
2276
- zcenter = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fZaxis.GetBinCenter(iz);
2277
- zmin = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fZaxis.GetBinLowEdge(iz);
2278
- zmax = zcenter + (zcenter - zmin);
2279
- zwidth = zmax - zmin;
2280
- absoluteContent = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].getBinContent(ix, iy, iz);
2281
- c = _classPrivateFieldLooseBase(_this, _optimizeBinContent)[_optimizeBinContent](absoluteContent, _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fMaximum);
2282
-
2283
- if (c > _classPrivateFieldLooseBase(_this, _minDisplayedContent)[_minDisplayedContent]) {
2284
- var size = c;
2285
- if (c < 0.15) size = 0.15;
2286
-
2287
- var color = _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getBinColor(c);
2288
-
2289
- var id = _classPrivateFieldLooseBase(_this, _id)[_id] + xmin + 'th3' + xmax + 'th3' + zmin + 'th3' + zmax + 'th3' + ymin + 'th3' + ymax;
2290
- var markedColor = void 0;
2291
-
2292
- if (_classPrivateFieldLooseBase(_this, _checkBinState)[_checkBinState](id)) {
2293
- markedColor = _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor();
2294
- } else {
2295
- markedColor = color;
2296
- }
2297
-
2298
- var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: " + zTitle + ";\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + zmin + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + zmax + ";\n xPos: " + ix + ";\n yPos: " + iy + ";\n zPos: " + iz + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n zCenter: " + zcenter + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + zwidth + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2299
-
2300
- var width = size * 0.8;
2301
- var posX = ix - 1;
2302
- var posY = iz - 1;
2303
- var posZ = iy - 1;
2304
- elements.bins[count] = {
2305
- id: id,
2306
- color: color,
2307
- binData: binData,
2308
- content: absoluteContent,
2309
- animation: {
2310
- fromWidth: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2311
- fromHeight: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2312
- fromDepth: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2313
- toWidth: width,
2314
- toHeight: width,
2315
- toDepth: width
2316
- },
2317
- animation2: {
2318
- fromX: posX + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2319
- fromY: posY + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2320
- fromZ: posZ + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2321
- toX: posX,
2322
- toY: posY,
2323
- toZ: posZ
2324
- },
2325
- animation3: {
2326
- fromColor: _classPrivateFieldLooseBase(_this, _getPreviousBinColor)[_getPreviousBinColor](id),
2327
- toColor: markedColor
2328
- }
2329
- };
2330
- currentBinScales[count] = {
2331
- key: id,
2332
- scale: width,
2333
- color: markedColor
2334
- };
2335
- }
2336
-
2337
- count++;
2338
- }
2339
- }
2340
- }
2341
-
2342
- _classPrivateFieldLooseBase(_this, _previousBins)[_previousBins] = currentBinScales;
2343
- var normalAxis = [];
2344
- var reversedAxis = [];
2345
- count = 0;
2346
-
2347
- for (var _iz = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset]; _iz <= maxYLength; _iz++) {
2348
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](50000 + count, -2.5 + _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset], _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, _iz - 1, 270, 180, 0, 2, 1, "" + (yLabels[_iz - 1] ? yLabels[_iz - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].yInitial + _iz - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2349
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](55000 + count, maxXLength + 0.5, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, _iz - 1, 270, 360, 0, 2, 1, "" + (yLabels[_iz - 1] ? yLabels[_iz - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].yInitial + _iz - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2350
- count++;
2351
- }
2352
-
2353
- elements.axisLabels[0] = {
2354
- id: 'leftLabel',
2355
- key: 6000 + _classPrivateFieldLooseBase(_this, _id)[_id],
2356
- text: {
2357
- value: yTitle,
2358
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z')
2359
- },
2360
- rotation: {
2361
- x: 270,
2362
- y: 270,
2363
- z: 0
2364
- },
2365
- animation: {
2366
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 4 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2367
- fromY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2368
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2369
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 4,
2370
- toY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1,
2371
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 0.5
2372
- }
2373
- };
2374
- elements.axisLabels[1] = {
2375
- id: 'rightLabel',
2376
- key: 64001 + _classPrivateFieldLooseBase(_this, _id)[_id],
2377
- text: {
2378
- value: yTitle,
2379
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z')
2380
- },
2381
- rotation: {
2382
- x: 270,
2383
- y: 90,
2384
- z: 0
2385
- },
2386
- animation: {
2387
- fromX: maxXLength + 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2388
- fromY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2389
- fromZ: maxYLength - 2.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2390
- toX: maxXLength + 2,
2391
- toY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1,
2392
- toZ: maxYLength - 2.5
2393
- }
2394
- };
2395
-
2396
- for (var _ix = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset]; _ix <= maxXLength; _ix++) {
2397
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](70000 + count, _ix - 1, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 270, 0, 2, 1, "" + (xLabels[_ix - 1] ? xLabels[_ix - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].xInitial + _ix - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2398
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](75000 + count, _ix - 1, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, maxYLength + 0.5, 270, 90, 0, 2, 1, "" + (xLabels[_ix - 1] ? xLabels[_ix - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].xInitial + _ix - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2399
- count++;
2400
- }
2401
-
2402
- elements.axisLabels[2] = {
2403
- id: 'downLabel',
2404
- key: 84002 + _classPrivateFieldLooseBase(_this, _id)[_id],
2405
- text: {
2406
- value: xTitle,
2407
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x')
2408
- },
2409
- rotation: {
2410
- x: 270,
2411
- y: 180,
2412
- z: 0
2413
- },
2414
- animation: {
2415
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2416
- fromY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2417
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 4 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2418
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset],
2419
- toY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1,
2420
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 4
2421
- }
2422
- };
2423
- elements.axisLabels[3] = {
2424
- id: 'upLabel',
2425
- key: 85003 + _classPrivateFieldLooseBase(_this, _id)[_id],
2426
- text: {
2427
- value: xTitle,
2428
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x')
2429
- },
2430
- rotation: {
2431
- x: 270,
2432
- y: 0,
2433
- z: 0
2434
- },
2435
- animation: {
2436
- fromX: maxXLength - 2.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2437
- fromY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2438
- fromZ: maxYLength + 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2439
- toX: maxXLength - 2.5,
2440
- toY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1,
2441
- toZ: maxYLength + 2
2442
- }
2443
- };
2444
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](90000 + count, maxXLength + 0.5, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, maxYLength + 0.5, 270, 360, 0, 2, 2, "" + (zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1] ? zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].zInitial + _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2445
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](91000 + count, maxXLength + 0.5, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 90, 0, 2, 2, "" + (zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1] ? zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].zInitial + _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2446
- count++;
2447
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](92000 + count, _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2.5, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, maxYLength + 0.5, 270, 270, 0, 2, 2, "" + (zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1] ? zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].zInitial + _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2448
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](93000 + count, _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2.5, _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 180, 0, 2, 2, "" + (zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1] ? zLabels[_classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].zInitial + _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1 + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2449
- count++;
2450
- elements.axisLabels[4] = {
2451
- id: 'upLabel1',
2452
- key: 95004 + _classPrivateFieldLooseBase(_this, _id)[_id],
2453
- text: {
2454
- value: zTitle,
2455
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y')
2456
- },
2457
- rotation: {
2458
- x: 0,
2459
- y: 270,
2460
- z: 90
2461
- },
2462
- animation: {
2463
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 1.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2464
- fromY: maxZLength - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2465
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2466
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 1.5,
2467
- toY: maxZLength - 1,
2468
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2
2469
- }
2470
- };
2471
- elements.axisLabels[5] = {
2472
- id: 'upLabel2',
2473
- key: 100005 + _classPrivateFieldLooseBase(_this, _id)[_id],
2474
- text: {
2475
- value: zTitle,
2476
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y')
2477
- },
2478
- rotation: {
2479
- x: 0,
2480
- y: 90,
2481
- z: 90
2482
- },
2483
- animation: {
2484
- fromX: maxXLength - 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2485
- fromY: maxZLength - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2486
- fromZ: maxYLength + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2487
- toX: maxXLength - 0.5,
2488
- toY: maxZLength - 1,
2489
- toZ: maxYLength
2490
- }
2491
- };
2492
- elements.axisLabels[6] = {
2493
- id: 'upLabel3',
2494
- key: 105006 + _classPrivateFieldLooseBase(_this, _id)[_id],
2495
- text: {
2496
- value: zTitle,
2497
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y')
2498
- },
2499
- rotation: {
2500
- x: 0,
2501
- y: 360,
2502
- z: 90
2503
- },
2504
- animation: {
2505
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2506
- fromY: maxZLength - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2507
- fromZ: maxYLength - 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2508
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2,
2509
- toY: maxZLength - 1,
2510
- toZ: maxYLength - 0.5
2511
- }
2512
- };
2513
- elements.axisLabels[7] = {
2514
- id: 'upLabel4',
2515
- key: 105007 + _classPrivateFieldLooseBase(_this, _id)[_id],
2516
- text: {
2517
- value: zTitle,
2518
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y')
2519
- },
2520
- rotation: {
2521
- x: 0,
2522
- y: 180,
2523
- z: 90
2524
- },
2525
- animation: {
2526
- fromX: maxXLength - 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2527
- fromY: maxZLength - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2528
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 1.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2529
- toX: maxXLength - 0.5,
2530
- toY: maxZLength - 1,
2531
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 1.5
2532
- }
2533
- };
2534
- count++;
2535
- var bannerWidthX = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] ? _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2536
- var bannerWidthY = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] ? _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2537
- elements.ground = {
2538
- key: 125000 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2539
- scale: {
2540
- width: bannerWidthX + 8,
2541
- height: 0.2,
2542
- depth: bannerWidthY + 8
2543
- },
2544
- animation: {
2545
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + bannerWidthX * 0.5 - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2546
- fromY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2547
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + bannerWidthY * 0.5 - 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2548
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + bannerWidthX * 0.5 - 1,
2549
- toY: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] - 1.5,
2550
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + bannerWidthY * 0.5 - 0.5
2551
- }
2552
- };
2553
- count++;
2554
- elements.banners[1] = {
2555
- key: 130000 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2556
- id: 'th-mapping',
2557
- geometry: {
2558
- width: 1,
2559
- height: 15,
2560
- depth: 22
2561
- },
2562
- position: {
2563
- x: maxXLength + 8,
2564
- y: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 0.5,
2565
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 2.5
2566
- },
2567
- material: {
2568
- color: '#ffffff',
2569
- transparent: true
2570
- }
2571
- };
2572
- elements.labels = [].concat(normalAxis, reversedAxis);
2573
- return elements;
2574
- }
2575
- });
2576
- Object.defineProperty(this, _createTH2Histogram, {
2577
- writable: true,
2578
- value: function value(projectionFunction) {
2579
- _classPrivateFieldLooseBase(_this, _selectedBins$1)[_selectedBins$1] = localStorageService.getBinsFromLocalStorage();
2580
- var elements = {
2581
- type: 'TH2',
2582
- bins: [],
2583
- labels: [],
2584
- banners: [],
2585
- ground: {},
2586
- titles: [],
2587
- axisLabels: []
2588
- };
2589
- var centeredYPosition;
2590
- var xcenter, xmin, xmax, xwidth;
2591
- var ycenter, ymin, ymax, ywidth;
2592
- var c;
2593
- var binName = '';
2594
- var absoluteContent;
2595
- var count = 0;
2596
- var maxXLength = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fNbins ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fNbins : _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _range)[_range];
2597
- var maxYLength = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fNbins ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fNbins : _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range];
2598
- var xTitle = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fTitle !== '' ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fTitle : 'x';
2599
- var yTitle = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fTitle !== '' ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fTitle : 'y';
2600
- var xLabels = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fLabels ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.fLabels.arr : [];
2601
- var yLabels = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fLabels ? _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.fLabels.arr : [];
2602
- var currentBinScales = [];
2603
-
2604
- for (var iy = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset]; iy <= maxYLength; iy++) {
2605
- for (var ix = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset]; ix <= maxXLength; ix++) {
2606
- xcenter = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.GetBinCenter(ix);
2607
- xmin = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fXaxis.GetBinLowEdge(ix);
2608
- xmax = xcenter + (xcenter - xmin);
2609
- xwidth = xmax - xmin;
2610
- ycenter = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.GetBinCenter(iy);
2611
- ymin = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fYaxis.GetBinLowEdge(iy);
2612
- ymax = ycenter + (ycenter - ymin);
2613
- ywidth = ymax - ymin;
2614
- absoluteContent = _classPrivateFieldLooseBase(_this, _histogram)[_histogram].getBinContent(ix, iy);
2615
- c = _classPrivateFieldLooseBase(_this, _optimizeBinContent)[_optimizeBinContent](absoluteContent, _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fMaximum);
2616
- centeredYPosition = c * _classPrivateFieldLooseBase(_this, _range)[_range] * _classPrivateFieldLooseBase(_this, _contentScale)[_contentScale] / 16;
2617
-
2618
- if (c > _classPrivateFieldLooseBase(_this, _minDisplayedContent)[_minDisplayedContent]) {
2619
- var projectionColor = _classPrivateFieldLooseBase(_this, _projectionFunction)[_projectionFunction](projectionFunction, xmin, ymin);
2620
-
2621
- var color = projectionColor === '' ? _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getBinColor(c) : projectionColor;
2622
- var id = _classPrivateFieldLooseBase(_this, _id)[_id] + xmin + 'th2' + xmax + 'th2' + ymin + 'th2' + ymax;
2623
- var markedColor = void 0;
2624
-
2625
- if (_classPrivateFieldLooseBase(_this, _checkBinState)[_checkBinState](id)) {
2626
- markedColor = _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor();
2627
- } else {
2628
- markedColor = color;
2629
- }
2630
-
2631
- var binData = "id: " + id + ";\n typeName: 'TH2'\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n zTitle: 'none';\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n zMin: " + 0 + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n zMax: " + 0 + ";\n xPos: " + ix + ";\n yPos: " + iy + ";\n zPos: " + 0 + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n yCenter: " + 0 + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n zWidth: " + 0 + ";\n markedColor: " + markedColor + ";\n selectColor: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryAccentColor() + ";\n axisX: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x') + ";\n axisY: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y') + ";\n axisZ: " + _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z');
2632
-
2633
- var width = xwidth / _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth] / _classPrivateFieldLooseBase(_this, _binScaleCoef)[_binScaleCoef];
2634
-
2635
- var depth = ywidth / _classPrivateFieldLooseBase(_this, _yWidth)[_yWidth] / _classPrivateFieldLooseBase(_this, _binScaleCoef)[_binScaleCoef];
2636
-
2637
- var posX = ix - 1;
2638
- var posY = iy - 1;
2639
- elements.bins[count] = {
2640
- id: id,
2641
- color: color,
2642
- binData: binData,
2643
- content: absoluteContent,
2644
- animation: {
2645
- fromWidth: width,
2646
- fromHeight: _classPrivateFieldLooseBase(_this, _getPreviousBinScales)[_getPreviousBinScales](id),
2647
- fromDepth: depth,
2648
- toWidth: width,
2649
- toHeight: c * _classPrivateFieldLooseBase(_this, _range)[_range] * _classPrivateFieldLooseBase(_this, _contentScale)[_contentScale] / 8,
2650
- toDepth: depth
2651
- },
2652
- animation2: {
2653
- fromX: posX + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2654
- fromY: centeredYPosition,
2655
- fromZ: posY + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2656
- toX: posX,
2657
- toY: centeredYPosition,
2658
- toZ: posY
2659
- },
2660
- animation3: {
2661
- fromColor: _classPrivateFieldLooseBase(_this, _getPreviousBinColor)[_getPreviousBinColor](id),
2662
- toColor: markedColor
2663
- }
2664
- };
2665
- currentBinScales[count] = {
2666
- key: id,
2667
- scale: c,
2668
- color: markedColor
2669
- };
2670
- }
2671
-
2672
- count++;
2673
- }
2674
- }
2675
-
2676
- _classPrivateFieldLooseBase(_this, _previousBins)[_previousBins] = currentBinScales;
2677
- var normalAxis = [];
2678
- var reversedAxis = [];
2679
- count = 0;
2680
-
2681
- for (var _iy = _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset]; _iy <= maxYLength; _iy++) {
2682
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](1500 + count, _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2.5, 0, _iy - 1, 270, 180, 0, 2, 1, "" + (yLabels[_iy - 1] ? yLabels[_iy - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].yInitial + (_iy - 1) * _classPrivateFieldLooseBase(_this, _yWidth)[_yWidth] + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2683
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](3000 + count, maxXLength + 0.5, 0, _iy - 1, 270, 360, 0, 2, 1, "" + (yLabels[_iy - 1] ? yLabels[_iy - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].yInitial + (_iy - 1) * _classPrivateFieldLooseBase(_this, _yWidth)[_yWidth] + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2684
- count++;
2685
- }
2686
-
2687
- elements.axisLabels[0] = {
2688
- id: 'leftLabel',
2689
- key: 4500 + _classPrivateFieldLooseBase(_this, _id)[_id],
2690
- text: {
2691
- value: yTitle,
2692
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z')
2693
- },
2694
- rotation: {
2695
- x: 270,
2696
- y: 270,
2697
- z: 0
2698
- },
2699
- animation: {
2700
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 4 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2701
- fromY: _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2702
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2703
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 4,
2704
- toY: 0,
2705
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 0.5
2706
- }
2707
- };
2708
- elements.axisLabels[1] = {
2709
- id: 'rightLabel',
2710
- key: 6001 + _classPrivateFieldLooseBase(_this, _id)[_id],
2711
- text: {
2712
- value: yTitle,
2713
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('z')
2714
- },
2715
- rotation: {
2716
- x: 270,
2717
- y: 90,
2718
- z: 0
2719
- },
2720
- animation: {
2721
- fromX: maxXLength + 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2722
- fromY: _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2723
- fromZ: maxYLength - 2.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2724
- toX: maxXLength + 2,
2725
- toY: 0,
2726
- toZ: maxYLength - 2.5
2727
- }
2728
- };
2729
-
2730
- for (var _ix2 = _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset]; _ix2 <= maxXLength; _ix2++) {
2731
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](7500 + count, _ix2 - 1, 0, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 270, 0, 2, 1, "" + (xLabels[_ix2 - 1] ? xLabels[_ix2 - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].xInitial + (_ix2 - 1) * _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth] + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2732
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](9000 + count, _ix2 - 1, 0, maxYLength + 0.5, 270, 90, 0, 2, 1, "" + (xLabels[_ix2 - 1] ? xLabels[_ix2 - 1].fString : Math.round((_classPrivateFieldLooseBase(_this, _labels)[_labels].xInitial + (_ix2 - 1) * _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth] + Number.EPSILON) * 100) / 100), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2733
- count++;
2734
- }
2735
-
2736
- elements.axisLabels[2] = {
2737
- id: 'downLabel',
2738
- key: 10502 + _classPrivateFieldLooseBase(_this, _id)[_id],
2739
- text: {
2740
- value: xTitle,
2741
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x')
2742
- },
2743
- rotation: {
2744
- x: 270,
2745
- y: 180,
2746
- z: 0
2747
- },
2748
- animation: {
2749
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2750
- fromY: _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2751
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 4 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2752
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset],
2753
- toY: 0,
2754
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 4
2755
- }
2756
- };
2757
- elements.axisLabels[3] = {
2758
- id: 'upLabel',
2759
- key: 12003 + _classPrivateFieldLooseBase(_this, _id)[_id],
2760
- text: {
2761
- value: xTitle,
2762
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('x')
2763
- },
2764
- rotation: {
2765
- x: 270,
2766
- y: 0,
2767
- z: 0
2768
- },
2769
- animation: {
2770
- fromX: maxXLength - 2.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2771
- fromY: _classPrivateFieldLooseBase(_this, _shift)[_shift].zOffset,
2772
- fromZ: maxYLength + 2 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2773
- toX: maxXLength - 2.5,
2774
- toY: 0,
2775
- toZ: maxYLength + 2
2776
- }
2777
- };
2778
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](13500 + count, maxXLength + 0.5, 0, maxYLength + 0.5, 270, 360, 0, 2, 2, "0", _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2779
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](15000 + count, maxXLength + 0.5, 0, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 180, 0, 2, 2, "0", _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2780
- count++;
2781
- normalAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](16500 + count, _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2.5, 0, maxYLength + 0.5, 270, 180, 0, 2, 2, "0", _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2782
- reversedAxis[count] = _classPrivateFieldLooseBase(_this, _createAxisEntity)[_createAxisEntity](18000 + count, _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 2.5, 0, _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] - 2.5, 270, 180, 0, 2, 2, "0", _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getAxisColor('y'), _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getSecondaryFontColor());
2783
- count++;
2784
- elements.titles[0] = {
2785
- key: 195000 + _classPrivateFieldLooseBase(_this, _id)[_id],
2786
- text: {
2787
- value: _classPrivateFieldLooseBase(_this, _histogram)[_histogram].fTitle,
2788
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2789
- },
2790
- rotation: {
2791
- x: 0,
2792
- y: 123,
2793
- z: 0
2794
- },
2795
- position: {
2796
- x: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] - 90,
2797
- y: 16.5,
2798
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + 90
2799
- },
2800
- innerText: {
2801
- value: 'Press V to show projections or controls',
2802
- color: _classPrivateFieldLooseBase(_this, _themeProvider)[_themeProvider].getPrimaryFontColor()
2803
- }
2804
- };
2805
- count++;
2806
- var bannerWidthX = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] ? _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2807
- var bannerWidthY = _classPrivateFieldLooseBase(_this, _range)[_range] > _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] ? _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit] + 1 : _classPrivateFieldLooseBase(_this, _range)[_range];
2808
- elements.ground = {
2809
- key: 22500 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2810
- scale: {
2811
- width: bannerWidthX + 8,
2812
- height: 0.2,
2813
- depth: bannerWidthY + 8
2814
- },
2815
- animation: {
2816
- fromX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + bannerWidthX * 0.5 - 1 + _classPrivateFieldLooseBase(_this, _shift)[_shift].xOffset,
2817
- fromY: -0.5,
2818
- fromZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + bannerWidthY * 0.5 - 0.5 + _classPrivateFieldLooseBase(_this, _shift)[_shift].yOffset,
2819
- toX: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] + bannerWidthX * 0.5 - 1,
2820
- toY: -0.5,
2821
- toZ: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + bannerWidthY * 0.5 - 0.5
2822
- }
2823
- };
2824
- count++;
2825
- elements.banners[1] = {
2826
- key: 240000 + count + _classPrivateFieldLooseBase(_this, _id)[_id],
2827
- id: 'th-mapping',
2828
- geometry: {
2829
- width: 0.1,
2830
- height: 15,
2831
- depth: 22
2832
- },
2833
- position: {
2834
- x: maxXLength + 8,
2835
- y: 7,
2836
- z: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] + _classPrivateFieldLooseBase(_this, _range)[_range] / 2 + 2.5
2837
- },
2838
- material: {
2839
- color: '#ffffff',
2840
- transparent: true
2841
- }
2842
- };
2843
- elements.labels = [].concat(normalAxis, reversedAxis);
2844
- return elements;
2845
- }
2846
- });
2847
- Object.defineProperty(this, _optimizeBinContent, {
2848
- writable: true,
2849
- value: function value(binContent, maxContent) {
2850
- if (binContent <= 0) return 0;
2851
-
2852
- if (maxContent > 1) {
2853
- binContent = Math.round((binContent / maxContent + Number.EPSILON) * 100) / 100;
2854
- }
2855
-
2856
- return binContent;
2857
- }
2858
- });
2859
- Object.defineProperty(this, _getValidOffset, {
2860
- writable: true,
2861
- value: function value(limits, offsets, increment, axisOffset, defaultRange) {
2862
- _classPrivateFieldLooseBase(_this, _shift)[_shift] = {
2863
- xOffset: 0,
2864
- yOffset: 0,
2865
- zOffset: 0
2866
- };
2867
-
2868
- if (increment) {
2869
- if (defaultRange) {
2870
- offsets[axisOffset] += 1;
2871
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = -1;
2872
- } else {
2873
- offsets[axisOffset] += offsets.range;
2874
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = -offsets.range;
2875
- }
2876
-
2877
- if (limits[axisOffset] <= offsets.range) {
2878
- offsets[axisOffset] = 1;
2879
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = 0;
2880
- return offsets;
2881
- }
2882
-
2883
- if (offsets[axisOffset] > limits[axisOffset] - offsets.range) {
2884
- offsets[axisOffset] = limits[axisOffset] - offsets.range;
2885
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = 0;
2886
- return offsets;
2887
- }
2888
- } else {
2889
- if (defaultRange) {
2890
- offsets[axisOffset] -= 1;
2891
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = 1;
2892
- } else {
2893
- offsets[axisOffset] -= offsets.range;
2894
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = offsets.range;
2895
- }
2896
-
2897
- if (offsets[axisOffset] < 1) {
2898
- offsets[axisOffset] = 1;
2899
- _classPrivateFieldLooseBase(_this, _shift)[_shift][axisOffset] = 0;
2900
- return offsets;
2901
- }
2902
- }
2903
-
2904
- return offsets;
2905
- }
2906
- });
2907
- Object.defineProperty(this, _editTH3OffsetByOffset, {
2908
- writable: true,
2909
- value: function value(axisOffset, increment, defaultRange) {
2910
- var limits = {
2911
- xOffset: _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit],
2912
- yOffset: _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit],
2913
- zOffset: _classPrivateFieldLooseBase(_this, _zLimit)[_zLimit]
2914
- };
2915
- var offsets = {
2916
- name: 'TH3',
2917
- xOffset: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset],
2918
- yOffset: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset],
2919
- zOffset: _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset],
2920
- range: _classPrivateFieldLooseBase(_this, _range)[_range]
2921
- };
2922
-
2923
- var result = _classPrivateFieldLooseBase(_this, _getValidOffset)[_getValidOffset](limits, offsets, increment, axisOffset, defaultRange);
2924
-
2925
- _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] = result.xOffset;
2926
- _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] = result.yOffset;
2927
- _classPrivateFieldLooseBase(_this, _zOffset)[_zOffset] = result.zOffset;
2928
- return result;
2929
- }
2930
- });
2931
- Object.defineProperty(this, _projectionFunction, {
2932
- writable: true,
2933
- value: function value(projectionFunction, xMin, yMin) {
2934
- if (projectionFunction === 'feet' && _classPrivateFieldLooseBase(_this, _projections)[_projections] !== null) {
2935
- var xIndex = xMin / _classPrivateFieldLooseBase(_this, _xWidth)[_xWidth];
2936
-
2937
- var yIndex = yMin / _classPrivateFieldLooseBase(_this, _yWidth)[_yWidth];
2938
-
2939
- try {
2940
- var projectionHistogram = _classPrivateFieldLooseBase(_this, _projections)[_projections].fFolders.arr[xIndex].fFolders.arr[yIndex].fFolders.arr[0];
2941
-
2942
- var LineColor = projectionHistogram.fFunctions.arr[0].fLineColor;
2943
-
2944
- if (LineColor === 600) {
2945
- return 'blue';
2946
- } else if (LineColor === 632) {
2947
- return 'red';
2948
- }
2949
- } catch (e) {
2950
- return '';
2951
- }
2952
- }
2953
-
2954
- return '';
2955
- }
2956
- });
2957
- Object.defineProperty(this, _editTH2OffsetByOffset, {
2958
- writable: true,
2959
- value: function value(axisOffset, increment, defaultRange) {
2960
- var limits = {
2961
- xOffset: _classPrivateFieldLooseBase(_this, _xLimit)[_xLimit],
2962
- yOffset: _classPrivateFieldLooseBase(_this, _yLimit)[_yLimit]
2963
- };
2964
- var offsets = {
2965
- name: 'TH2',
2966
- xOffset: _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset],
2967
- yOffset: _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset],
2968
- range: _classPrivateFieldLooseBase(_this, _range)[_range]
2969
- };
2970
-
2971
- var result = _classPrivateFieldLooseBase(_this, _getValidOffset)[_getValidOffset](limits, offsets, increment, axisOffset, defaultRange);
2972
-
2973
- _classPrivateFieldLooseBase(_this, _xOffset)[_xOffset] = result.xOffset;
2974
- _classPrivateFieldLooseBase(_this, _yOffset)[_yOffset] = result.yOffset;
2975
- return result;
2976
- }
2977
- });
2978
- Object.defineProperty(this, _getPreviousBinScales, {
2979
- writable: true,
2980
- value: function value(id) {
2981
- var previousBin = _classPrivateFieldLooseBase(_this, _previousBins)[_previousBins].filter(function (prevBin) {
2982
- return prevBin.key === id;
2983
- });
2984
-
2985
- if (previousBin[0] && previousBin[0].scale) {
2986
- return previousBin[0].scale;
2987
- }
2988
-
2989
- return 0;
2990
- }
2991
- });
2992
- Object.defineProperty(this, _getPreviousBinColor, {
2993
- writable: true,
2994
- value: function value(id) {
2995
- var previousBin = _classPrivateFieldLooseBase(_this, _previousBins)[_previousBins].filter(function (prevBin) {
2996
- return prevBin.key === id;
2997
- });
2998
-
2999
- if (previousBin[0] && previousBin[0].scale) {
3000
- return previousBin[0].color;
3001
- }
3002
-
3003
- return '#ffffff';
3004
- }
3005
- });
3006
- this.initializeFactory(uniqueName, histogram, section, range, projections, theme);
3007
- }
3008
-
3009
- var _proto = HistogramReactFactory.prototype;
3010
-
3011
- _proto.initializeFactory = function initializeFactory(uniqueName, histogram, section, range, projections, theme) {
3012
- this.setUniqueName(uniqueName);
3013
- this.setTheme(theme);
3014
- this.setHistogram(histogram, projections);
3015
- this.setSection(section);
3016
- this.setRange(range);
3017
- };
3018
-
3019
- _proto.setUniqueName = function setUniqueName(uniqueName) {
3020
- _classPrivateFieldLooseBase(this, _id)[_id] = uniqueName;
3021
- };
3022
-
3023
- _proto.setSection = function setSection(section) {
3024
- if (section !== null && section !== undefined) {
3025
- if (section.xOffset) _classPrivateFieldLooseBase(this, _xOffset)[_xOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](section.xOffset, _classPrivateFieldLooseBase(this, _xLimit)[_xLimit]);
3026
- if (section.yOffset) _classPrivateFieldLooseBase(this, _yOffset)[_yOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](section.yOffset, _classPrivateFieldLooseBase(this, _yLimit)[_yLimit]);
3027
- }
3028
-
3029
- if (_classPrivateFieldLooseBase(this, _histogram)[_histogram]._typename.includes('TH3')) {
3030
- if (section !== null && section !== undefined) {
3031
- if (section.zOffset) _classPrivateFieldLooseBase(this, _zOffset)[_zOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](section.zOffset, _classPrivateFieldLooseBase(this, _zLimit)[_zLimit]);
3032
- }
3033
- }
3034
- };
3035
-
3036
- _proto.setHistogram = function setHistogram(histogram, projections) {
3037
- _classPrivateFieldLooseBase(this, _projections)[_projections] = projections;
3038
- _classPrivateFieldLooseBase(this, _histogram)[_histogram] = histogram;
3039
- _classPrivateFieldLooseBase(this, _type)[_type] = histogram._typename;
3040
- _classPrivateFieldLooseBase(this, _xLimit)[_xLimit] = histogram.fXaxis.fNbins;
3041
- _classPrivateFieldLooseBase(this, _yLimit)[_yLimit] = histogram.fYaxis.fNbins;
3042
- _classPrivateFieldLooseBase(this, _xWidth)[_xWidth] = (histogram.fXaxis.fXmax - histogram.fXaxis.fXmin) / histogram.fXaxis.fNbins;
3043
- _classPrivateFieldLooseBase(this, _yWidth)[_yWidth] = (histogram.fYaxis.fXmax - histogram.fYaxis.fXmin) / histogram.fYaxis.fNbins;
3044
- _classPrivateFieldLooseBase(this, _labels)[_labels].xInitial = histogram.fXaxis.fXmin;
3045
- _classPrivateFieldLooseBase(this, _labels)[_labels].yInitial = histogram.fYaxis.fXmin;
3046
- _classPrivateFieldLooseBase(this, _xOffset)[_xOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](_classPrivateFieldLooseBase(this, _xOffset)[_xOffset], _classPrivateFieldLooseBase(this, _xLimit)[_xLimit]);
3047
- _classPrivateFieldLooseBase(this, _yOffset)[_yOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](_classPrivateFieldLooseBase(this, _yOffset)[_yOffset], _classPrivateFieldLooseBase(this, _yLimit)[_yLimit]);
3048
-
3049
- if (histogram._typename.includes('TH3')) {
3050
- _classPrivateFieldLooseBase(this, _zLimit)[_zLimit] = histogram.fZaxis.fNbins;
3051
- _classPrivateFieldLooseBase(this, _zWidth)[_zWidth] = histogram.fZaxis.fXmax / histogram.fZaxis.fNbins;
3052
- _classPrivateFieldLooseBase(this, _labels)[_labels].zInitial = histogram.fZaxis.fXmin;
3053
- _classPrivateFieldLooseBase(this, _zOffset)[_zOffset] = _classPrivateFieldLooseBase(this, _checkOffsetValue)[_checkOffsetValue](_classPrivateFieldLooseBase(this, _zOffset)[_zOffset], _classPrivateFieldLooseBase(this, _zLimit)[_zLimit]);
3054
- }
3055
- };
3056
-
3057
- _proto.setRange = function setRange(range) {
3058
- if (range) {
3059
- if (range < 4) _classPrivateFieldLooseBase(this, _range)[_range] = 4;
3060
- _classPrivateFieldLooseBase(this, _range)[_range] = range;
3061
- }
3062
- };
3063
-
3064
- _proto.setTheme = function setTheme(theme) {
3065
- _classPrivateFieldLooseBase(this, _themeProvider)[_themeProvider] = new ThemeProvider(theme);
3066
- };
3067
-
3068
- _proto.getElements = function getElements(projectionFunction) {
3069
- var elements = {};
3070
-
3071
- if (_classPrivateFieldLooseBase(this, _type)[_type].includes('TH2')) {
3072
- elements = _classPrivateFieldLooseBase(this, _createTH2Histogram)[_createTH2Histogram](projectionFunction);
3073
- } else if (_classPrivateFieldLooseBase(this, _type)[_type].includes('TH3')) {
3074
- elements = _classPrivateFieldLooseBase(this, _createTH3Histogram)[_createTH3Histogram]();
3075
- }
3076
-
3077
- return elements;
3078
- };
3079
-
3080
- _proto.updateSection = function updateSection(axisOffset, increment, defaultRange) {
3081
- if (_classPrivateFieldLooseBase(this, _type)[_type].includes('TH3')) return _classPrivateFieldLooseBase(this, _editTH3OffsetByOffset)[_editTH3OffsetByOffset](axisOffset, increment, defaultRange);else if (_classPrivateFieldLooseBase(this, _type)[_type].includes('TH2')) return _classPrivateFieldLooseBase(this, _editTH2OffsetByOffset)[_editTH2OffsetByOffset](axisOffset, increment, defaultRange);
3082
- };
3083
-
3084
- return HistogramReactFactory;
3085
- }();
3086
-
3087
- var NdmVrHistogram3D = function NdmVrHistogram3D(_ref) {
3088
- var name = _ref.name,
3089
- histogram = _ref.histogram,
3090
- histoSection = _ref.histoSection,
3091
- projections = _ref.projections,
3092
- range = _ref.range,
3093
- theme = _ref.theme;
3094
- var subscription;
3095
-
3096
- var _useState = useState(new HistogramReactFactory(name, histogram, histoSection || null, range, projections, theme || 'def')),
3097
- factory = _useState[0];
3098
-
3099
- var _useState2 = useState('default'),
3100
- mode = _useState2[0],
3101
- setMode = _useState2[1];
3102
-
3103
- var _useState3 = useState(factory.getElements(mode)),
3104
- elements = _useState3[0],
3105
- setElements = _useState3[1];
3106
-
3107
- var _useState4 = useState(1),
3108
- binMarkState = _useState4[0],
3109
- setBinMarkState = _useState4[1];
3110
-
3111
- var handleSubscription = function handleSubscription(data) {
3112
- if (histogram._typename.includes(data.name)) {
3113
- if (data.axis) {
3114
- factory.updateSection(data.axis, data.increment, data.defaultRange);
3115
- setElements(factory.getElements(mode));
3116
- } else if (data.binMarkMode) {
3117
- setBinMarkState(function (prevState) {
3118
- if (prevState + data.binMarkMode > 2) return 2;
3119
- if (prevState + data.binMarkMode < 1) return 1;
3120
- return prevState + data.binMarkMode;
3121
- });
3122
- } else {
3123
- setMode(function (prevState) {
3124
- return prevState !== data.fFunction ? data.fFunction : prevState;
3125
- });
3126
- }
3127
- }
3128
- };
3129
-
3130
- useEffect(function () {
3131
- factory.setUniqueName(name);
3132
- setElements(factory.getElements(mode));
3133
- }, [name]);
3134
- useEffect(function () {
3135
- factory.setHistogram(histogram, projections);
3136
- setElements(factory.getElements(mode));
3137
- }, [histogram, projections]);
3138
- useEffect(function () {
3139
- factory.setSection(histoSection);
3140
- setElements(factory.getElements(mode));
3141
- }, [histoSection]);
3142
- useEffect(function () {
3143
- factory.setRange(range);
3144
- setElements(factory.getElements(mode));
3145
- }, [range]);
3146
- useEffect(function () {
3147
- factory.setTheme(theme);
3148
- setElements(factory.getElements(mode));
3149
- }, [theme]);
3150
- useEffect(function () {
3151
- setElements(factory.getElements(mode));
3152
- }, [mode]);
3153
- useEffect(function () {
3154
- if (histogram._typename.includes('TH2')) {
3155
- subscription = histogramTH2Service.getChangedSection().subscribe(handleSubscription);
3156
- } else if (histogram._typename.includes('TH3')) {
3157
- subscription = histogramTH3Service.getChangedSection().subscribe(handleSubscription);
3158
- }
3159
-
3160
- return function () {
3161
- return subscription.unsubscribe();
3162
- };
3163
- }, [elements]);
3164
-
3165
- if (elements !== null && elements !== void 0 && elements.bins) {
3166
- return /*#__PURE__*/React.createElement("a-entity", {
3167
- "histogram-control": true
3168
- }, elements.bins.map(function (bin) {
3169
- return /*#__PURE__*/React.createElement("a-box", {
3170
- key: bin.id,
3171
- "class": "clickable",
3172
- material: "color: " + bin.color + "; transparent: true",
3173
- binth: bin.binData,
3174
- mouseevent: true,
3175
- animation: "property: scale; from: " + bin.animation.fromWidth + " " + bin.animation.fromHeight + " " + bin.animation.fromDepth + "; to: " + bin.animation.toWidth + " " + bin.animation.toHeight + " " + bin.animation.toDepth + "; delay:100; dur: 1500; easing: linear;",
3176
- animation__1: "property: material.opacity; from: 0; to: 0.50; dur: 2000;",
3177
- animation__2: "property: position; from: " + bin.animation2.fromX + " " + bin.animation2.fromY + " " + bin.animation2.fromZ + "; to: " + bin.animation2.toX + " " + bin.animation2.toY + " " + bin.animation2.toZ + "; dur: 1000;",
3178
- animation__3: "property: material.color; from: " + bin.animation3.fromColor + "; to: " + bin.animation3.toColor + "; dur: 1600;"
3179
- }, /*#__PURE__*/React.createElement("a-text", {
3180
- value: bin.content,
3181
- align: "center",
3182
- width: "10",
3183
- color: "black",
3184
- geometry: "primitive:plane; width: 1; height: 1",
3185
- material: "color: " + bin.animation3.toColor + "; opacity: 0.50; transparent: true",
3186
- rotation: "270 180 0",
3187
- position: "0 " + (binMarkState === 1 ? -0.5 : 0.501) + " 0"
3188
- }));
3189
- }), elements.labels.map(function (label) {
3190
- return /*#__PURE__*/React.createElement("a-entity", {
3191
- key: label.key,
3192
- geometry: "primitive: " + label.geometry.primitive + "; width:" + label.geometry.width + "; height:" + label.geometry.height + ";",
3193
- text: "color: " + label.text.color + "; width: " + label.text.width + "; height: " + label.text.height + "; align:center;",
3194
- "label-handler": "value: " + label.labelHandler.value + "; delay:" + label.labelHandler.delay,
3195
- rotation: label.rotation.x + " " + label.rotation.y + " " + label.rotation.z,
3196
- material: "color: " + label.material.color + "; transparent: true",
3197
- animation: "property: text.width; from: 0; to: 4; dur: 1000;",
3198
- animation__1: "property: material.opacity; from: 0; to: 0.8; dur: 1500;",
3199
- animation__2: "property: position; from: " + label.animation.fromX + " " + label.animation.fromY + " " + label.animation.fromZ + "; to: " + label.animation.toX + " " + label.animation.toY + " " + label.animation.toZ + "; dur: 1005;"
3200
- });
3201
- }), elements.titles.map(function (title) {
3202
- return /*#__PURE__*/React.createElement("a-entity", {
3203
- key: title.key,
3204
- text: "value: " + title.text.value + "; color: " + title.text.color + "; width: 230; height:auto; align:center;",
3205
- rotation: title.rotation.x + " " + title.rotation.y + " " + title.rotation.z,
3206
- position: title.position.x + " " + title.position.y + " " + title.position.z,
3207
- material: "transparent: true"
3208
- }, /*#__PURE__*/React.createElement("a-text", {
3209
- value: title.innerText.value,
3210
- position: "0 10 0",
3211
- width: "150",
3212
- height: "auto",
3213
- align: "center",
3214
- color: title.innerText.color
3215
- }), /*#__PURE__*/React.createElement("a-entity", {
3216
- geometry: "primitive: plane; width:170; height:30;",
3217
- position: "0 0 -1",
3218
- material: "opacity: 0.9; color: white; transparent: true"
3219
- }));
3220
- }), elements.axisLabels.map(function (axisLabel) {
3221
- return /*#__PURE__*/React.createElement("a-entity", {
3222
- id: axisLabel.id,
3223
- key: axisLabel.key,
3224
- text: "value: " + axisLabel.text.value + "; color: " + axisLabel.text.color + "; width: 10; height:auto; align:center;",
3225
- rotation: axisLabel.rotation.x + " " + axisLabel.rotation.y + " " + axisLabel.rotation.z,
3226
- animation: "property: position; from: " + axisLabel.animation.fromX + " " + axisLabel.animation.fromY + " " + axisLabel.animation.fromZ + "; to: " + axisLabel.animation.toX + " " + axisLabel.animation.toY + " " + axisLabel.animation.toZ + "; dur: 1000;",
3227
- material: "opacity: 0; transparent: true"
3228
- });
3229
- }), elements.ground && /*#__PURE__*/React.createElement("a-box", {
3230
- key: elements.ground.key,
3231
- width: elements.ground.scale.width,
3232
- material: "color: #fafafa",
3233
- height: elements.ground.scale.height,
3234
- depth: elements.ground.scale.depth,
3235
- animation: "property: position; from: " + elements.ground.animation.fromX + " " + elements.ground.animation.fromY + " " + elements.ground.animation.fromZ + ";\n to:\n " + elements.ground.animation.toX + " " + elements.ground.animation.toY + " " + elements.ground.animation.toZ + "; dur: 1000;"
3236
- }), elements.banners.map(function (banner) {
3237
- return /*#__PURE__*/React.createElement("a-box", {
3238
- key: banner.key,
3239
- id: banner.id,
3240
- geometry: "width:" + banner.geometry.width + "; height:" + banner.geometry.height + "; depth:" + banner.geometry.depth + ";",
3241
- position: banner.position.x + " " + banner.position.y + " " + banner.position.z,
3242
- material: "color: " + banner.material.color + ", transparent: " + banner.material.transparent
3243
- });
3244
- }));
3245
- } else {
3246
- return /*#__PURE__*/React.createElement("a-box", {
3247
- animation__1: "property: rotation; to: 0 180 360; dur: 10000; easing: linear; loop: true",
3248
- animation__2: "property: scale; from: 1 1 1; to: 10 10 10; dur: 15000; timeout: 15000; loop: true; easing: linear; dir: alternate",
3249
- animation__color: "property: material.color; from: #003682; to: #7d0002; dur: 80000: easing: linear: loop: true; dir: alternate",
3250
- position: "0 1.5 -2"
3251
- });
3252
- }
3253
- };
3254
-
3255
- function NdmVrLaboratory() {
3256
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a-sky", {
3257
- color: "#dbf0fe"
3258
- }), /*#__PURE__*/React.createElement("a-plane", {
3259
- rotation: "-90 0 0",
3260
- position: "0 -0.5 0",
3261
- width: "1000",
3262
- height: "1000",
3263
- color: "#aaa",
3264
- material: "shader:flat;"
3265
- }));
3266
- }
3267
-
3268
- var Controller = function Controller(_ref) {
3269
- var socket = _ref.socket;
3270
-
3271
- var _useState = useState(0),
3272
- time = _useState[0],
3273
- setTime = _useState[1];
3274
-
3275
- useEffect(function () {
3276
- var camera = document.getElementById('camera');
3277
- var absolutePosition = new Vector3();
3278
- var rotationQuaternion = new Quaternion();
3279
- camera.object3D.getWorldPosition(absolutePosition);
3280
- var id = socket.id;
3281
- var interval = setInterval(function () {
3282
- camera.object3D.getWorldPosition(absolutePosition);
3283
- camera.object3D.getWorldQuaternion(rotationQuaternion);
3284
- socket.emit('move', {
3285
- id: id,
3286
- position: absolutePosition.toArray(),
3287
- rotation: rotationQuaternion.toArray()
3288
- });
3289
- setTime(function (prevTime) {
3290
- return prevTime + 1;
3291
- });
3292
- }, 10);
3293
- return function () {
3294
- return clearInterval(interval);
3295
- };
3296
- }, [time]);
3297
- return /*#__PURE__*/React.createElement("a-entity", null);
3298
- };
3299
-
3300
- var UserWrapper = function UserWrapper(_ref) {
3301
- var position = _ref.position,
3302
- rotation = _ref.rotation,
3303
- id = _ref.id;
3304
- useEffect(function () {
3305
- var quaternionToApply = new Quaternion().fromArray(rotation);
3306
- var user = document.getElementById(id).object3D;
3307
- user.setRotationFromQuaternion(quaternionToApply);
3308
- }, [rotation]);
3309
- return /*#__PURE__*/React.createElement("a-box", {
3310
- position: position,
3311
- id: id,
3312
- color: "#4CC3D9"
3313
- });
3314
- };
3315
-
3316
- var NetworkingComponent = function NetworkingComponent(_ref) {
3317
- var socketClient = _ref.socketClient,
3318
- clients = _ref.clients;
3319
- return /*#__PURE__*/React.createElement("a-entity", null, /*#__PURE__*/React.createElement(Controller, {
3320
- socket: socketClient
3321
- }), Object.keys(clients).filter(function (clientKey) {
3322
- return clientKey !== socketClient.id;
3323
- }).map(function (client) {
3324
- var _clients$client = clients[client],
3325
- position = _clients$client.position,
3326
- rotation = _clients$client.rotation;
3327
- var positionParse = position.join(' ');
3328
- return /*#__PURE__*/React.createElement(UserWrapper, {
3329
- key: client,
3330
- id: client,
3331
- position: positionParse,
3332
- rotation: rotation
3333
- });
3334
- }));
3335
- };
3336
-
3337
- var NdmVrShared = function NdmVrShared() {
3338
- var _useState = useState(0),
3339
- socketClient = _useState[0],
3340
- setSocketClient = _useState[1];
3341
-
3342
- var _useState2 = useState({}),
3343
- clients = _useState2[0],
3344
- setClients = _useState2[1];
3345
-
3346
- useEffect(function () {
3347
- setSocketClient(io.connect('http://localhost:3001'));
3348
- return function () {
3349
- if (socketClient) socketClient.disconnect();
3350
- };
3351
- }, []);
3352
- useEffect(function () {
3353
- if (socketClient) {
3354
- socketClient.on('move', function (clients) {
3355
- setClients(clients);
3356
- });
3357
- }
3358
- }, [socketClient]);
3359
- return socketClient && /*#__PURE__*/React.createElement(NetworkingComponent, {
3360
- socketClient: socketClient,
3361
- clients: clients
3362
- });
3363
- };
3364
-
3365
- var NdmVrScene = function NdmVrScene(_ref) {
3366
- var data = _ref.data,
3367
- info = _ref.info;
3368
- return /*#__PURE__*/React.createElement("a-scene", {
3369
- embedded: true,
3370
- style: {
3371
- zIndex: '1',
3372
- width: '100%',
3373
- minHeight: 'calc(90vh)'
3374
- }
3375
- }, /*#__PURE__*/React.createElement("a-assets", null, /*#__PURE__*/React.createElement("img", {
3376
- id: "skyTexture",
3377
- src: info.background.url,
3378
- alt: "background"
3379
- })), /*#__PURE__*/React.createElement(NdmVrLaboratory, null), /*#__PURE__*/React.createElement(NdmVrCamera, null), /*#__PURE__*/React.createElement(NdmVrHistogram3D, {
3380
- name: info.name,
3381
- histogram: data.histogram,
3382
- histoSection: data.section,
3383
- projections: data.projections,
3384
- range: data.range,
3385
- theme: info.theme
3386
- }), /*#__PURE__*/React.createElement(NdmVrShared, null));
3387
- };
3388
-
3389
- var EntityBuilder = /*#__PURE__*/function () {
3390
- function EntityBuilder(model) {
3391
- this.model = null;
3392
- this.model = model;
3393
- }
3394
-
3395
- var _proto = EntityBuilder.prototype;
3396
-
3397
- _proto.updateElement = function updateElement(count, histogramElm, element, entityType) {
3398
- if (this.model[element].elements[count]) {
3399
- if (element === 'titles') {
3400
- this.createTitle(this.model[element].elements[count], this.model[element].attributes[count]);
3401
- } else {
3402
- this.createElement(this.model[element].elements[count], this.model[element].attributes[count], entityType);
3403
- }
3404
- } else {
3405
- var newElement;
3406
-
3407
- if (element === 'titles') {
3408
- newElement = this.createTitle(undefined, this.model[element].attributes[count]);
3409
- } else {
3410
- newElement = this.createElement(undefined, this.model[element].attributes[count], entityType);
3411
- }
3412
-
3413
- this.model[element].elements[count] = newElement;
3414
- histogramElm.appendChild(newElement);
3415
- }
3416
- };
3417
-
3418
- _proto.deleteUnnecessaryElements = function deleteUnnecessaryElements(count, element) {
3419
- var newLength = count;
3420
-
3421
- if (element.length === 1) {
3422
- while (this.model[element[0]].elements[count]) {
3423
- this.model[element[0]].elements[count].remove();
3424
- count++;
3425
- }
3426
-
3427
- this.model[element[0]].elements.length = newLength;
3428
- this.model[element[0]].attributes.length = newLength;
3429
- } else {
3430
- while (this.model[element[0]].elements[count]) {
3431
- this.model[element[0]].elements[count].remove();
3432
- this.model[element[1]].elements[count].remove();
3433
- count++;
3434
- }
3435
-
3436
- this.model[element[0]].elements.length = newLength;
3437
- this.model[element[0]].attributes.length = newLength;
3438
- this.model[element[1]].elements.length = newLength;
3439
- this.model[element[1]].attributes.length = newLength;
3440
- }
3441
- };
3442
-
3443
- _proto.createElement = function createElement(Element, data, type) {
3444
- var element = Element;
3445
-
3446
- if (element === undefined || element === null) {
3447
- var entityType = this.checkEntityType(type);
3448
- element = document.createElement(entityType);
3449
- }
3450
-
3451
- for (var feature in data) {
3452
- element.setAttribute(feature, data[feature]);
3453
- }
3454
-
3455
- return element;
3456
- };
3457
-
3458
- _proto.createBannerElement = function createBannerElement(Element, linesCount, data) {
3459
- var parent = Element;
3460
-
3461
- if (parent === undefined || parent === null) {
3462
- parent = document.createElement('a-entity');
3463
- var array = this.createBannerLines(linesCount, data);
3464
- array.map(function (element) {
3465
- return parent.append(element);
3466
- });
3467
- }
3468
-
3469
- parent.setAttribute('position', data.position);
3470
- parent.setAttribute('id', data.id);
3471
- return parent;
3472
- };
3473
-
3474
- _proto.createBannerLines = function createBannerLines(linesCount, data) {
3475
- var array = [];
3476
-
3477
- for (var i = linesCount - 1; i > -1; i--) {
3478
- data.line.position.y = 2 * i;
3479
- var line = document.createElement('a-entity');
3480
- line.setAttribute('rotation', data.line.rotation);
3481
- line.setAttribute('position', data.line.position);
3482
- line.setAttribute('text', data.line.text);
3483
- array.push(line);
3484
- }
3485
-
3486
- var background = document.createElement('a-entity');
3487
- background.setAttribute('geometry', data.background.geometry);
3488
- background.setAttribute('position', data.background.position);
3489
- background.setAttribute('material', data.background.material);
3490
- array.push(background);
3491
- return array;
3492
- };
3493
-
3494
- _proto.createTitle = function createTitle(Element, data) {
3495
- var parent = Element;
3496
-
3497
- if (parent === undefined || parent === null) {
3498
- parent = document.createElement('a-entity');
3499
- var child = this.createElement(undefined, data.background);
3500
- parent.appendChild(child);
3501
- }
3502
-
3503
- delete data.background;
3504
- return this.createElement(parent, data);
3505
- };
3506
-
3507
- _proto.checkEntityType = function checkEntityType(type) {
3508
- if (type === 'a-box' || type === 'a-sphere' || type === 'a-text' || type === 'a-circle' || type === 'a-text') {
3509
- return type;
3510
- } else {
3511
- return 'a-entity';
3512
- }
3513
- };
3514
-
3515
- return EntityBuilder;
3516
- }();
3517
-
3518
- var EntityTemplate = /*#__PURE__*/function () {
3519
- function EntityTemplate() {}
3520
-
3521
- var _proto = EntityTemplate.prototype;
3522
-
3523
- _proto.bannerTemplate = function bannerTemplate(data, lineData, backgroundData) {
3524
- var position = {
3525
- x: data.positionX,
3526
- y: data.positionY,
3527
- z: data.positionZ
3528
- };
3529
- var id = data.id;
3530
- var background = this.bannerBackgroundTemplate(backgroundData);
3531
- var line = this.lineTemplate(lineData);
3532
- return {
3533
- position: position,
3534
- id: id,
3535
- background: background,
3536
- line: line
3537
- };
3538
- };
3539
-
3540
- _proto.binTemplate = function binTemplate(data) {
3541
- var position = {
3542
- x: data.positionX,
3543
- y: data.positionY,
3544
- z: data.positionZ
3545
- };
3546
- var scale = {
3547
- x: data.scaleX,
3548
- y: data.scaleY,
3549
- z: data.scaleZ
3550
- };
3551
- var material = {
3552
- color: data.color,
3553
- opacity: 0.75
3554
- };
3555
- var clas = data["class"];
3556
- var binTh2 = data.data;
3557
- var id = data.id;
3558
- return {
3559
- position: position,
3560
- scale: scale,
3561
- material: material,
3562
- id: id,
3563
- "class": clas,
3564
- binth2: binTh2,
3565
- mouseevent: ''
3566
- };
3567
- };
3568
-
3569
- _proto.labelTemplate = function labelTemplate(data) {
3570
- var position = {
3571
- x: data.positionX,
3572
- y: data.positionY,
3573
- z: data.positionZ
3574
- };
3575
- var rotation = {
3576
- x: data.rotationX,
3577
- y: data.rotationY,
3578
- z: data.rotationZ
3579
- };
3580
- var geometry = {
3581
- primitive: 'plane',
3582
- width: 4,
3583
- height: 1
3584
- };
3585
- var text = {
3586
- value: data.value,
3587
- color: data.color,
3588
- width: 10,
3589
- height: 'auto',
3590
- align: 'center'
3591
- };
3592
- var material = {
3593
- opacity: 0
3594
- };
3595
- var id = data.id;
3596
- return {
3597
- position: position,
3598
- rotation: rotation,
3599
- geometry: geometry,
3600
- text: text,
3601
- material: material,
3602
- id: id
3603
- };
3604
- };
3605
-
3606
- _proto.axisTemplate = function axisTemplate(data) {
3607
- var position = {
3608
- x: data.positionX,
3609
- y: data.positionY,
3610
- z: data.positionZ
3611
- };
3612
- var rotation = {
3613
- x: data.rotationX,
3614
- y: data.rotationY,
3615
- z: data.rotationZ
3616
- };
3617
- var geometry = {
3618
- primitive: 'plane',
3619
- width: data.width,
3620
- height: data.height
3621
- };
3622
- var text = {
3623
- value: data.value,
3624
- color: 'black',
3625
- width: 4,
3626
- height: 'auto',
3627
- align: 'center'
3628
- };
3629
- var material = {
3630
- color: data.color,
3631
- opacity: 0.8
3632
- };
3633
- return {
3634
- position: position,
3635
- rotation: rotation,
3636
- geometry: geometry,
3637
- text: text,
3638
- material: material
3639
- };
3640
- };
3641
-
3642
- _proto.titleTemplate = function titleTemplate(data, textData) {
3643
- var position = {
3644
- x: data.positionX,
3645
- y: data.positionY,
3646
- z: data.positionZ
3647
- };
3648
- var rotation = {
3649
- x: data.rotationX,
3650
- y: data.rotationY,
3651
- z: data.rotationZ
3652
- };
3653
- var material = {
3654
- opacity: 0
3655
- };
3656
- var text = {
3657
- value: data.title,
3658
- color: data.color,
3659
- width: 230,
3660
- height: 'auto',
3661
- align: 'center'
3662
- };
3663
- var back = this.titleTextTemplate(textData);
3664
- return {
3665
- position: position,
3666
- rotation: rotation,
3667
- material: material,
3668
- text: text,
3669
- background: back
3670
- };
3671
- };
3672
-
3673
- _proto.titleTextTemplate = function titleTextTemplate(data) {
3674
- var geometry = {
3675
- primitive: 'plane',
3676
- width: data.width,
3677
- height: data.height
3678
- };
3679
- var position = {
3680
- x: data.positionX,
3681
- y: data.positionY,
3682
- z: data.positionZ
3683
- };
3684
- var material = {
3685
- color: data.color,
3686
- opacity: 0.6
3687
- };
3688
- return {
3689
- position: position,
3690
- geometry: geometry,
3691
- material: material
3692
- };
3693
- };
3694
-
3695
- _proto.lineTemplate = function lineTemplate(data) {
3696
- var position = {
3697
- x: data.positionX,
3698
- y: data.positionY,
3699
- z: data.positionZ
3700
- };
3701
- var rotation = {
3702
- x: data.rotationX,
3703
- y: data.rotationY,
3704
- z: data.rotationZ
3705
- };
3706
- var text = {
3707
- value: '',
3708
- width: 14,
3709
- height: 'auto',
3710
- align: 'center'
3711
- };
3712
- return {
3713
- position: position,
3714
- rotation: rotation,
3715
- text: text
3716
- };
3717
- };
3718
-
3719
- _proto.bannerBackgroundTemplate = function bannerBackgroundTemplate(data) {
3720
- var position = {
3721
- x: data.positionX,
3722
- y: data.positionY,
3723
- z: data.positionZ
3724
- };
3725
- var geometry = {
3726
- primitive: 'box',
3727
- width: data.width,
3728
- height: data.height,
3729
- depth: data.depth
3730
- };
3731
- var material = {
3732
- color: data.color
3733
- };
3734
- return {
3735
- position: position,
3736
- geometry: geometry,
3737
- material: material
3738
- };
3739
- };
3740
-
3741
- return EntityTemplate;
3742
- }();
3743
-
3744
- var selectedBins = [];
3745
-
3746
- function checkBinState(binId) {
3747
- var updatedArray = selectedBins.filter(function (item) {
3748
- return item.id === binId;
3749
- });
3750
- return updatedArray.length !== 0;
3751
- }
3752
-
3753
- function createTH2Histogram(Element, model, histogram, xOffset, yOffset, range, theme) {
3754
- selectedBins = localStorageService.getBinsFromLocalStorage();
3755
- var entityTemplate = new EntityTemplate();
3756
- var entityBuilder = new EntityBuilder(model);
3757
- var themeProvider = new ThemeProvider(theme);
3758
- var data = {};
3759
- var histogramElm = Element;
3760
- var centeredYPosition;
3761
- var xcenter, xmin, xmax, xwidth;
3762
- var ycenter, ymin, ymax, ywidth;
3763
- var c;
3764
- var binName = '';
3765
- var absoluteContent;
3766
- var count = 0;
3767
- var maxXLength = xOffset + range > histogram.fXaxis.fXmax ? histogram.fXaxis.fXmax : xOffset + range;
3768
- var maxYLength = yOffset + range > histogram.fYaxis.fXmax ? histogram.fYaxis.fXmax : yOffset + range;
3769
- var xTitle = histogram.fXaxis.fTitle;
3770
- var yTitle = histogram.fYaxis.fTitle;
3771
- var xLabels = histogram.fXaxis.fLabels ? histogram.fXaxis.fLabels.arr : [];
3772
- var yLabels = histogram.fYaxis.fLabels ? histogram.fYaxis.fLabels.arr : [];
3773
-
3774
- for (var iy = yOffset; iy <= maxYLength; iy++) {
3775
- for (var ix = xOffset; ix <= maxXLength; ix++) {
3776
- xcenter = histogram.fXaxis.GetBinCenter(ix);
3777
- xmin = histogram.fXaxis.GetBinLowEdge(ix);
3778
- xmax = xcenter + (xcenter - xmin);
3779
- xwidth = xmax - xmin;
3780
- ycenter = histogram.fYaxis.GetBinCenter(iy);
3781
- ymin = histogram.fYaxis.GetBinLowEdge(iy);
3782
- ymax = ycenter + (ycenter - ymin);
3783
- ywidth = ymax - ymin;
3784
- absoluteContent = histogram.getBinContent(ix, iy);
3785
- c = optimizeBinContent(absoluteContent, histogram.fMaximum);
3786
- centeredYPosition = c / 2;
3787
-
3788
- if (c > 0) {
3789
- var color = themeProvider.getBinColor(c);
3790
- var id = xmin + 'th2' + xmax + 'th2' + ymin + 'th2' + ymax;
3791
- var markedColor = void 0;
3792
-
3793
- if (checkBinState(id)) {
3794
- markedColor = themeProvider.getSecondaryAccentColor();
3795
- } else {
3796
- markedColor = color;
3797
- }
3798
-
3799
- var binData = "id: " + id + ";\n content: " + c + ";\n color: " + color + ";\n yTitle: " + yTitle + ";\n xTitle: " + xTitle + ";\n absoluteContent: " + absoluteContent + ";\n binName: " + binName + ";\n xMin: " + xmin + ";\n yMin: " + ymin + ";\n xMax: " + xmax + ";\n yMax: " + ymax + ";\n xCenter: " + xcenter + ";\n yCenter: " + ycenter + ";\n xWidth: " + xwidth + ";\n yWidth: " + ywidth + ";\n markedColor: " + markedColor + ";\n selectColor: " + themeProvider.getSecondaryAccentColor() + ";\n axisX: " + themeProvider.getAxisColor('x') + ";\n axisY: " + themeProvider.getAxisColor('y') + ";\n axisZ: " + themeProvider.getAxisColor('z');
3800
- data.id = id;
3801
- data.positionX = xmin;
3802
- data.positionY = centeredYPosition;
3803
- data.positionZ = ymin;
3804
- data.scaleX = xwidth / 2;
3805
- data.scaleY = c;
3806
- data.scaleZ = ywidth / 2;
3807
- data.color = markedColor;
3808
- data["class"] = 'clickable';
3809
- data.data = binData;
3810
- model.bins.attributes[count] = entityTemplate.binTemplate(data);
3811
- entityBuilder.updateElement(count, histogramElm, 'bins', 'a-box');
3812
- count++;
3813
- }
3814
- }
3815
- }
3816
-
3817
- entityBuilder.deleteUnnecessaryElements(count, ['bins']);
3818
- data.id = 1500 + count;
3819
- data.positionX = maxXLength + 0.5;
3820
- data.positionY = 0;
3821
- data.positionZ = maxYLength + 0.5;
3822
- data.rotationX = 270;
3823
- data.rotationY = 360;
3824
- data.rotationZ = 0;
3825
- data.width = 2;
3826
- data.height = 2;
3827
- data.value = "0";
3828
- data.color = themeProvider.getAxisColor('y');
3829
- model.normalXAxis.attributes[0] = entityTemplate.axisTemplate(data);
3830
- entityBuilder.updateElement(0, histogramElm, 'normalXAxis', 'a-entity');
3831
- data.positionZ = yOffset - 2.5;
3832
- data.rotationX = 270;
3833
- data.rotationY = 180;
3834
- model.reversedYAxis.attributes[0] = entityTemplate.axisTemplate(data);
3835
- entityBuilder.updateElement(0, histogramElm, 'reversedYAxis', 'a-entity');
3836
- data.positionX = xOffset - 2.5;
3837
- data.positionZ = maxYLength + 0.5;
3838
- model.normalYAxis.attributes[0] = entityTemplate.axisTemplate(data);
3839
- entityBuilder.updateElement(0, histogramElm, 'normalYAxis', 'a-entity');
3840
- data.positionZ = yOffset - 2.5;
3841
- data.rotationY = 180;
3842
- model.reversedXAxis.attributes[0] = entityTemplate.axisTemplate(data);
3843
- entityBuilder.updateElement(0, histogramElm, 'reversedXAxis', 'a-entity');
3844
- count = 1;
3845
-
3846
- for (var _iy = yOffset; _iy <= maxYLength; _iy++) {
3847
- data.id = 1500 + count;
3848
- data.positionX = xOffset - 2.5;
3849
- data.positionY = 0;
3850
- data.positionZ = _iy - 1;
3851
- data.rotationX = 270;
3852
- data.rotationY = 180;
3853
- data.rotationZ = 0;
3854
- data.width = 2;
3855
- data.height = 1;
3856
- data.value = "" + (yLabels[_iy - 1] ? yLabels[_iy - 1].fString : _iy - 1);
3857
- data.color = themeProvider.getAxisColor('z');
3858
- model.normalYAxis.attributes[count] = entityTemplate.axisTemplate(data);
3859
- entityBuilder.updateElement(count, histogramElm, 'normalYAxis', 'a-entity');
3860
- data.id = 4500 + count;
3861
- data.positionX = maxXLength + 0.5;
3862
- data.rotationY = 360;
3863
- data.value = "" + (yLabels[_iy - 1] ? yLabels[_iy - 1].fString : _iy - 1);
3864
- model.reversedYAxis.attributes[count] = entityTemplate.axisTemplate(data);
3865
- entityBuilder.updateElement(count, histogramElm, 'reversedYAxis', 'a-entity');
3866
- count++;
3867
- }
3868
-
3869
- entityBuilder.deleteUnnecessaryElements(count, ['normalYAxis', 'reversedYAxis']);
3870
- count = 1;
3871
-
3872
- for (var _ix = xOffset; _ix <= maxXLength; _ix++) {
3873
- data.id = 1500 + count;
3874
- data.positionX = _ix - 1;
3875
- data.positionY = 0;
3876
- data.positionZ = yOffset - 2.5;
3877
- data.rotationX = 270;
3878
- data.rotationY = 270;
3879
- data.rotationZ = 0;
3880
- data.width = 2;
3881
- data.height = 1;
3882
- data.value = "" + (xLabels[_ix - 1] ? xLabels[_ix - 1].fString : _ix - 1);
3883
- data.color = themeProvider.getAxisColor('x');
3884
- model.normalXAxis.attributes[count] = entityTemplate.axisTemplate(data);
3885
- entityBuilder.updateElement(count, histogramElm, 'normalXAxis', 'a-entity');
3886
- data.id = 4500 + count;
3887
- data.positionZ = maxYLength + 0.5;
3888
- data.rotationX = 270;
3889
- data.rotationY = 90;
3890
- data.value = "" + (xLabels[_ix - 1] ? xLabels[_ix - 1].fString : _ix - 1);
3891
- model.reversedXAxis.attributes[count] = entityTemplate.axisTemplate(data);
3892
- entityBuilder.updateElement(count, histogramElm, 'reversedXAxis', 'a-entity');
3893
- count++;
3894
- }
3895
-
3896
- entityBuilder.deleteUnnecessaryElements(count, ['normalXAxis', 'reversedXAxis']);
3897
- data.positionX = xOffset;
3898
- data.positionY = 0;
3899
- data.positionZ = yOffset - 4;
3900
- data.rotationX = 270;
3901
- data.rotationY = 180;
3902
- data.rotationZ = 0;
3903
- data.width = 4;
3904
- data.height = 1;
3905
- data.value = xTitle;
3906
- data.id = 'downLabel';
3907
- model.labels.attributes[0] = entityTemplate.labelTemplate(data);
3908
- entityBuilder.updateElement(0, histogramElm, 'labels', 'a-entity');
3909
- data.positionX = maxXLength - 2.5;
3910
- data.positionZ = maxYLength + 2;
3911
- data.rotationY = 0;
3912
- data.id = 'upLabel';
3913
- model.labels.attributes[1] = entityTemplate.labelTemplate(data);
3914
- entityBuilder.updateElement(1, histogramElm, 'labels', 'a-entity');
3915
- data.positionX = xOffset - 4;
3916
- data.positionY = 0;
3917
- data.positionZ = yOffset + 0.5;
3918
- data.rotationX = 270;
3919
- data.rotationY = 270;
3920
- data.rotationZ = 0;
3921
- data.width = 4;
3922
- data.height = 1;
3923
- data.value = yTitle;
3924
- data.color = themeProvider.getAxisColor('z');
3925
- data.id = 'leftLabel';
3926
- model.labels.attributes[2] = entityTemplate.labelTemplate(data);
3927
- entityBuilder.updateElement(2, histogramElm, 'labels', 'a-entity');
3928
- data.positionX = maxXLength + 2;
3929
- data.positionZ = maxYLength - 2.5;
3930
- data.rotationX = 270;
3931
- data.rotationY = 90;
3932
- data.id = 'rightLabel';
3933
- model.labels.attributes[3] = entityTemplate.labelTemplate(data);
3934
- entityBuilder.updateElement(3, histogramElm, 'labels', 'a-entity');
3935
- data.positionX = xOffset - 90;
3936
- data.positionY = -6.5;
3937
- data.positionZ = yOffset + 90;
3938
- data.rotationX = 0;
3939
- data.rotationY = 123;
3940
- data.rotationZ = 0;
3941
- data.title = histogram.fTitle;
3942
- data.color = themeProvider.getPrimaryFontColor();
3943
- var back = {};
3944
- back.positionX = 0;
3945
- back.positionY = 0;
3946
- back.positionZ = -1;
3947
- back.width = 170;
3948
- back.height = 30;
3949
- back.color = 'white';
3950
- model.titles.attributes[0] = entityTemplate.titleTemplate(data, back);
3951
- entityBuilder.updateElement(0, histogramElm, 'titles', 'a-entity');
3952
- data.positionX = xOffset + 120;
3953
- data.positionZ = yOffset - 70;
3954
- data.rotationY = 330;
3955
- data.title = histogram.fName;
3956
- model.titles.attributes[1] = entityTemplate.titleTemplate(data, back);
3957
- entityBuilder.updateElement(1, histogramElm, 'titles', 'a-entity');
3958
- }
3959
-
3960
- var optimizeBinContent = function optimizeBinContent(binContent, maxContent) {
3961
- if (binContent <= 0) return 0;
3962
-
3963
- if (maxContent > 1) {
3964
- binContent = Math.round((binContent / maxContent + Number.EPSILON) * 100) / 100;
3965
- }
3966
-
3967
- return binContent;
3968
- };
3969
-
3970
- AFRAME$1.registerComponent('binth2', {
3971
- schema: {
3972
- id: {
3973
- type: 'string'
3974
- },
3975
- content: {
3976
- "default": 0
3977
- },
3978
- absoluteContent: {
3979
- "default": 0
3980
- },
3981
- binName: {
3982
- "default": ''
3983
- },
3984
- xTitle: {
3985
- type: 'string'
3986
- },
3987
- yTitle: {
3988
- type: 'string'
3989
- },
3990
- xMin: {
3991
- type: 'number'
3992
- },
3993
- yMin: {
3994
- type: 'number'
3995
- },
3996
- xMax: {
3997
- type: 'number'
3998
- },
3999
- yMax: {
4000
- type: 'number'
4001
- },
4002
- xCenter: {
4003
- type: 'number'
4004
- },
4005
- yCenter: {
4006
- type: 'number'
4007
- },
4008
- xWidth: {
4009
- type: 'number'
4010
- },
4011
- yWidth: {
4012
- type: 'number'
4013
- },
4014
- color: {
4015
- type: 'string'
4016
- },
4017
- axisX: {
4018
- type: 'string'
4019
- },
4020
- axisY: {
4021
- type: 'string'
4022
- },
4023
- axisZ: {
4024
- type: 'string'
4025
- },
4026
- selectColor: {
4027
- type: 'string'
4028
- },
4029
- markedColor: {
4030
- type: 'string'
4031
- }
4032
- },
4033
- init: function init() {
4034
- var el = this.el;
4035
- el.userData = {
4036
- typeName: 'TH2',
4037
- id: this.data.id,
4038
- content: this.data.content,
4039
- absoluteContent: this.data.absoluteContent,
4040
- binName: this.data.binName,
4041
- xTitle: this.data.xTitle,
4042
- yTitle: this.data.yTitle,
4043
- xMin: this.data.xMin,
4044
- yMin: this.data.yMin,
4045
- xMax: this.data.xMax,
4046
- yMax: this.data.yMax,
4047
- xCenter: this.data.xCenter,
4048
- yCenter: this.data.yCenter,
4049
- xWidth: this.data.xWidth,
4050
- yWidth: this.data.yWidth,
4051
- color: this.data.color,
4052
- axisX: this.data.axisX,
4053
- axisY: this.data.axisY,
4054
- axisZ: this.data.axisZ,
4055
- selectColor: this.data.selectColor,
4056
- markedColor: this.data.markedColor
4057
- };
4058
- },
4059
- update: function update() {
4060
- var el = this.el;
4061
- el.userData = {
4062
- typeName: 'TH2',
4063
- id: this.data.id,
4064
- content: this.data.content,
4065
- absoluteContent: this.data.absoluteContent,
4066
- binName: this.data.binName,
4067
- xTitle: this.data.xTitle,
4068
- yTitle: this.data.yTitle,
4069
- xMin: this.data.xMin,
4070
- yMin: this.data.yMin,
4071
- xMax: this.data.xMax,
4072
- yMax: this.data.yMax,
4073
- xCenter: this.data.xCenter,
4074
- yCenter: this.data.yCenter,
4075
- xWidth: this.data.xWidth,
4076
- yWidth: this.data.yWidth,
4077
- color: this.data.color,
4078
- axisX: this.data.axisX,
4079
- axisY: this.data.axisY,
4080
- axisZ: this.data.axisZ,
4081
- selectColor: this.data.selectColor,
4082
- markedColor: this.data.markedColor
4083
- };
4084
- }
4085
- });
4086
-
4087
- var _jsroot$1 = /*#__PURE__*/_classPrivateFieldLooseKey("jsroot");
4088
-
4089
- var HistogramDemoFactory = /*#__PURE__*/function () {
4090
- function HistogramDemoFactory(jsroot) {
4091
- Object.defineProperty(this, _jsroot$1, {
4092
- writable: true,
4093
- value: void 0
4094
- });
4095
- _classPrivateFieldLooseBase(this, _jsroot$1)[_jsroot$1] = jsroot;
4096
- }
4097
-
4098
- var _proto = HistogramDemoFactory.prototype;
4099
-
4100
- _proto.createTH2DemoHistogram = function createTH2DemoHistogram(xLength, yLength, initialContent, contentIncrement) {
4101
- var histo = _classPrivateFieldLooseBase(this, _jsroot$1)[_jsroot$1].createHistogram('TH2I', xLength, yLength);
4102
-
4103
- var cnt = initialContent;
4104
-
4105
- for (var iy = 1; iy <= 20; iy++) {
4106
- for (var ix = 1; ix <= 20; ix++) {
4107
- var bin = histo.getBin(ix, iy);
4108
- var val = 0;
4109
- val = cnt;
4110
- histo.setBinContent(bin, val);
4111
- cnt += contentIncrement;
4112
- }
4113
- }
4114
-
4115
- histo.fXaxis.fTitle = 'x Axis';
4116
- histo.fYaxis.fTitle = 'y Axis';
4117
- histo.fName = "You don't have a valid file path";
4118
- histo.fTitle = 'This is a TH2 histogram demo';
4119
- histo.fMaximum = cnt;
4120
- return histo;
4121
- };
4122
-
4123
- _proto.createTH3DemoHistogram = function createTH3DemoHistogram(xLength, yLength, zLength, initialContent, contentIncrement) {
4124
- var histo = _classPrivateFieldLooseBase(this, _jsroot$1)[_jsroot$1].createHistogram('TH3I', xLength, yLength, zLength);
4125
-
4126
- var cnt = initialContent;
4127
-
4128
- for (var iz = 1; iz <= 20; iz++) {
4129
- for (var iy = 1; iy <= 20; iy++) {
4130
- for (var ix = 1; ix <= 20; ix++) {
4131
- var bin = histo.getBin(ix, iy, iz);
4132
- var val = 0;
4133
- val = cnt;
4134
- histo.setBinContent(bin, val);
4135
- cnt += contentIncrement;
4136
- }
4137
- }
4138
- }
4139
-
4140
- histo.fXaxis.fTitle = 'x Axis';
4141
- histo.fYaxis.fTitle = 'y Axis';
4142
- histo.fZaxis.fTitle = 'z Axis';
4143
- histo.fName = "You don't have a valid file path";
4144
- histo.fTitle = 'This is a TH3 histogram demo';
4145
- histo.fMaximum = cnt;
4146
- return histo;
4147
- };
4148
-
4149
- return HistogramDemoFactory;
4150
- }();
4151
-
4152
- var index = AFRAME$1.registerComponent('th2-histogram', {
4153
- schema: {
4154
- section: {
4155
- type: 'string'
4156
- },
4157
- filename: {
4158
- type: 'string'
4159
- },
4160
- theme: {
4161
- type: 'string',
4162
- "default": 'def'
4163
- },
4164
- position: {
4165
- name: 'position',
4166
- xValue: 0,
4167
- yValue: 0,
4168
- zValue: 0
4169
- },
4170
- scale: {
4171
- name: 'scale',
4172
- xValue: 2,
4173
- yValue: 2,
4174
- zValue: 2
4175
- },
4176
- rotation: {
4177
- name: 'rotation',
4178
- xValue: 0,
4179
- yValue: 0,
4180
- zValue: 0
4181
- }
4182
- },
4183
- init: function init() {
4184
- var _this = this;
4185
-
4186
- var el = this.el;
4187
- initialKeyboardController(this.schema, el);
4188
- document.addEventListener('keydown', keyPressHandlerFunction);
4189
- document.addEventListener('keyup', keyReleaseHandlerFunction);
4190
- this.JSROOT = window.JSROOT;
4191
- this.demoHistogramService = new HistogramDemoFactory(this.JSROOT);
4192
- this.localStorageService = new NdmVrStorageService();
4193
- this.cameraService = new CameraService();
4194
- this.render = false;
4195
- this.histogram = null;
4196
- this.model = {
4197
- bins: {
4198
- elements: [],
4199
- attributes: []
4200
- },
4201
- labels: {
4202
- elements: [],
4203
- attributes: []
4204
- },
4205
- titles: {
4206
- elements: [],
4207
- attributes: []
4208
- },
4209
- banners: {
4210
- elements: [],
4211
- attributes: []
4212
- },
4213
- normalXAxis: {
4214
- elements: [],
4215
- attributes: []
4216
- },
4217
- reversedXAxis: {
4218
- elements: [],
4219
- attributes: []
4220
- },
4221
- normalYAxis: {
4222
- elements: [],
4223
- attributes: []
4224
- },
4225
- reversedYAxis: {
4226
- elements: [],
4227
- attributes: []
4228
- }
4229
- };
4230
- this.section = null;
4231
-
4232
- var updateHistogramSection = function updateHistogramSection(newSection) {
4233
- console.log(newSection);
4234
- _this.section.xOffset = newSection.xOffset;
4235
- _this.section.yOffset = newSection.yOffset;
4236
- _this.range = newSection.range;
4237
-
4238
- _this.cameraService.setCameraPosition(newSection);
4239
-
4240
- createTH2Histogram(_this.el, _this.model, _this.histogram, _this.section.xOffset, _this.section.yOffset, _this.section.range, _this.data.theme);
4241
- _this.render = true;
4242
- };
4243
-
4244
- var handleSubscription = function handleSubscription(section) {
4245
- _this.localStorageService.storeTH2Offsets(section.xOffset, section.yOffset, section.range);
4246
-
4247
- updateHistogramSection(section);
4248
- };
4249
-
4250
- this.subscription = histogramTH2Service.getChangedSection().subscribe(handleSubscription);
4251
- },
4252
- update: function update() {
4253
- var _this2 = this;
4254
-
4255
- keyboardUpdateCameraReference();
4256
- this.section = JSON.parse(this.data.section);
4257
- this.JSROOT.openFile(this.data.filename).then(function (file) {
4258
- return file.readObject('hUsersVsProjects');
4259
- }).then(function (obj) {
4260
- _this2.localStorageService.initHistogramData(obj);
4261
-
4262
- _this2.histogram = obj;
4263
- createTH2Histogram(_this2.el, _this2.model, _this2.histogram, _this2.section.xOffset, _this2.section.yOffset, _this2.section.range, _this2.data.theme);
4264
- _this2.render = true;
4265
- }).then(function () {
4266
- return console.log('drawing completed');
4267
- })["catch"](function (error) {
4268
- _this2.histogram = _this2.demoHistogramService.createTH2DemoHistogram(20, 20, 0, 0.1);
4269
-
4270
- _this2.localStorageService.initHistogramData(_this2.histogram);
4271
-
4272
- createTH2Histogram(_this2.el, _this2.model, _this2.histogram, _this2.section.xOffset, _this2.section.yOffset, _this2.section.range, _this2.data.theme);
4273
- _this2.render = true;
4274
- console.log(error);
4275
- });
4276
- },
4277
- tick: function tick() {
4278
- if (this.render) {
4279
- this.render = false;
4280
- console.log(this.section);
4281
- console.log(this.elements);
4282
- }
4283
- },
4284
- remove: function remove() {
4285
- this.subscription.unsubscribe();
4286
- document.removeEventListener('keydown', keyPressHandlerFunction);
4287
- document.removeEventListener('keyup', keyReleaseHandlerFunction);
4288
- }
4289
- });
4290
-
4291
- var infoBannerAframeComponent = AFRAME$1.registerComponent('banner-control', {
4292
- schema: {
4293
- position: {
4294
- name: 'position',
4295
- xValue: -1.28,
4296
- yValue: 0.3,
4297
- zValue: -1
4298
- },
4299
- scale: {
4300
- name: 'scale',
4301
- xValue: 0.5,
4302
- yValue: 0.7,
4303
- zValue: 0.1
4304
- },
4305
- rotation: {
4306
- name: 'rotation',
4307
- xValue: 0,
4308
- yValue: 20,
4309
- zValue: 0
4310
- }
4311
- },
4312
- init: function init() {}
4313
- });
4314
-
4315
- var cameraService$1 = new CameraService();
4316
-
4317
- var thumbStickByOwnOffset = function thumbStickByOwnOffset(event) {
4318
- if (event.detail.y > 0.95) {
4319
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, false);
4320
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, false);
4321
- }
4322
-
4323
- if (event.detail.y < -0.95) {
4324
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, false);
4325
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, false);
4326
- }
4327
-
4328
- if (event.detail.x < -0.95) {
4329
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, false);
4330
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, false);
4331
- }
4332
-
4333
- if (event.detail.x > 0.95) {
4334
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, false);
4335
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, false);
4336
- }
4337
- };
4338
-
4339
- var thumbStickByDefaultOffset = function thumbStickByDefaultOffset(event) {
4340
- if (event.detail.y > 0.95) {
4341
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', false, true);
4342
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', false, true);
4343
- }
4344
-
4345
- if (event.detail.y < -0.95) {
4346
- histogramTH2Service.changeHistogramSectionByOffset('yOffset', 'TH2', true, true);
4347
- histogramTH3Service.changeHistogramSectionByOffset('yOffset', 'TH3', true, true);
4348
- }
4349
-
4350
- if (event.detail.x < -0.95) {
4351
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', true, true);
4352
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', true, true);
4353
- }
4354
-
4355
- if (event.detail.x > 0.95) {
4356
- histogramTH2Service.changeHistogramSectionByOffset('xOffset', 'TH2', false, true);
4357
- histogramTH3Service.changeHistogramSectionByOffset('xOffset', 'TH3', false, true);
4358
- }
4359
- };
4360
-
4361
- var thumbStickForMoving = function thumbStickForMoving(event, speed) {
4362
- if (event.detail.y > 0.95) {
4363
- cameraService$1.horizontalMoveCamera('z', false, speed);
4364
- }
4365
-
4366
- if (event.detail.y < -0.95) {
4367
- cameraService$1.horizontalMoveCamera('z', true, speed);
4368
- }
4369
-
4370
- if (event.detail.x < -0.95) {
4371
- cameraService$1.horizontalMoveCamera('x', true, speed);
4372
- }
4373
-
4374
- if (event.detail.x > 0.95) {
4375
- cameraService$1.horizontalMoveCamera('x', false, speed);
4376
- }
4377
- };
4378
-
4379
- var thumbStickPredefinedPositionWithOffset = function thumbStickPredefinedPositionWithOffset(event) {
4380
- if (event.detail.y > 0.95) {
4381
- cameraService$1.setPredefinedUpPositionWithOffset();
4382
- }
4383
-
4384
- if (event.detail.y < -0.95) {
4385
- cameraService$1.setPredefinedDownPositionWithOffset();
4386
- }
4387
-
4388
- if (event.detail.x < -0.95) {
4389
- cameraService$1.setPredefinedLeftPositionWithOffset();
4390
- }
4391
-
4392
- if (event.detail.x > 0.95) {
4393
- cameraService$1.setPredefinedRightPositionWithOffset();
4394
- }
4395
- };
4396
-
4397
- var oculusUpSection = function oculusUpSection(defaultRange) {
4398
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', true, defaultRange);
4399
- };
4400
-
4401
- var oculusDownSection = function oculusDownSection(typeOfRange) {
4402
- histogramTH3Service.changeHistogramSectionByOffset('zOffset', 'TH3', false, typeOfRange);
4403
- };
4404
-
4405
- var oculusUpdateCameraReference = function oculusUpdateCameraReference() {
4406
- cameraService$1 = new CameraService();
4407
- };
4408
-
4409
- var oculusThumbStickFunction = function oculusThumbStickFunction(event) {
4410
- thumbStickByOwnOffset(event);
4411
- };
4412
-
4413
- var oculusThumbStickWithGripFunction = function oculusThumbStickWithGripFunction(event) {
4414
- thumbStickByDefaultOffset(event);
4415
- };
4416
-
4417
- var oculusThumbStickPredefinedCameraPositionWithOffset = function oculusThumbStickPredefinedCameraPositionWithOffset(event) {
4418
- thumbStickPredefinedPositionWithOffset(event);
4419
- };
4420
-
4421
- var oculusThumbStickForMoving = function oculusThumbStickForMoving(event, speed) {
4422
- thumbStickForMoving(event, speed);
4423
- };
4424
-
4425
- var oculusXButtonDownFunction = function oculusXButtonDownFunction(speed) {
4426
- cameraService$1.verticalMoveCamera(true, speed / 2);
4427
- };
4428
-
4429
- var oculusYButtonDownFunction = function oculusYButtonDownFunction(speed) {
4430
- cameraService$1.verticalMoveCamera(false, speed / 2);
4431
- };
4432
-
4433
- var oculusThumbStickMarkBin = function oculusThumbStickMarkBin() {
4434
- binSubject.saveSelectedBinToLocalStorage();
4435
- };
4436
-
4437
- var oculusThumbStickUnmarkBin = function oculusThumbStickUnmarkBin() {
4438
- binSubject.deleteBinFromLocalStorage();
4439
- };
4440
-
4441
- var oculusShowFunctionView = function oculusShowFunctionView() {
4442
- histogramTH2Service.changeHistogramFunction('feet', 'TH2');
4443
- };
4444
-
4445
- var oculusShowDefaultView = function oculusShowDefaultView() {
4446
- histogramTH2Service.changeHistogramFunction('default', 'TH2');
4447
- };
4448
-
4449
- var oculusSwitchViewWithBanners = function oculusSwitchViewWithBanners() {
4450
- cameraSubject.setVisibilityOfBanners('oculus');
4451
- };
4452
-
4453
- var oculusChangeBannerContent = function oculusChangeBannerContent() {
4454
- cameraSubject.setUserState();
4455
- };
4456
-
4457
- var oculusShiftBanners = function oculusShiftBanners() {
4458
- cameraSubject.shiftBanners();
4459
- };
4460
-
4461
- var oculusRedrawHistogramBanners = function oculusRedrawHistogramBanners() {
4462
- ['th-mapping', 'bannerId_1', 'bannerId_2', 'bannerId_3', 'bannerId_4'].forEach(function (targetId) {
4463
- if (document.getElementById(targetId) !== null) {
4464
- jsrootService.displayImageOfProjection('projectionContainer', targetId, '500px', '400px');
4465
- }
4466
- });
4467
- };
4468
-
4469
- var leftOculusController = AFRAME$1.registerComponent('left-controller-logging', {
4470
- init: function init() {
4471
- var gripActive = false;
4472
- var speed = 1;
4473
- var el = this.el;
4474
- el.addEventListener('gripdown', function () {
4475
- gripActive = true;
4476
- });
4477
- el.addEventListener('gripup', function () {
4478
- gripActive = false;
4479
- });
4480
- el.addEventListener('thumbstickdown', function () {
4481
- if (gripActive) {
4482
- speed++;
4483
- if (speed > 20) speed = 20;
4484
- } else {
4485
- speed--;
4486
- if (speed < 1) speed = 1;
4487
- }
4488
- });
4489
- el.addEventListener('thumbstickmoved', function (event) {
4490
- if (gripActive) {
4491
- oculusThumbStickPredefinedCameraPositionWithOffset(event);
4492
- } else {
4493
- oculusThumbStickForMoving(event, speed);
4494
- }
4495
- });
4496
- el.addEventListener('ybuttondown', function () {
4497
- if (gripActive) {
4498
- oculusXButtonDownFunction(speed);
4499
- } else {
4500
- oculusSwitchViewWithBanners();
4501
- }
4502
- });
4503
- el.addEventListener('xbuttondown', function () {
4504
- if (gripActive) {
4505
- oculusYButtonDownFunction(speed);
4506
- } else {
4507
- oculusChangeBannerContent();
4508
- }
4509
- });
4510
- },
4511
- update: function update() {
4512
- oculusUpdateCameraReference();
4513
- }
4514
- });
4515
-
4516
- var rightOculusController = AFRAME$1.registerComponent('right-controller-logging', {
4517
- init: function init() {
4518
- var gripActive = false;
4519
- var el = this.el;
4520
- el.addEventListener('gripdown', function () {
4521
- gripActive = true;
4522
- });
4523
- el.addEventListener('gripup', function () {
4524
- gripActive = false;
4525
- });
4526
- el.addEventListener('thumbstickmoved', function (event) {
4527
- if (gripActive) {
4528
- oculusThumbStickFunction(event);
4529
- } else {
4530
- oculusThumbStickWithGripFunction(event);
4531
- }
4532
- });
4533
- el.addEventListener('bbuttondown', function () {
4534
- if (gripActive) {
4535
- oculusUpSection(false);
4536
- } else {
4537
- oculusUpSection(true);
4538
- }
4539
- });
4540
- el.addEventListener('abuttondown', function () {
4541
- if (gripActive) {
4542
- oculusDownSection(false);
4543
- } else {
4544
- oculusDownSection(true);
4545
- }
4546
- });
4547
- el.addEventListener('thumbstickdown', function () {
4548
- if (gripActive) {
4549
- oculusShowFunctionView();
4550
- } else {
4551
- oculusShowDefaultView();
4552
- }
4553
- });
4554
- el.addEventListener('triggerdown', function () {
4555
- if (gripActive) {
4556
- oculusThumbStickMarkBin();
4557
- oculusRedrawHistogramBanners();
4558
- } else {
4559
- oculusThumbStickUnmarkBin();
4560
- oculusShiftBanners();
4561
- }
4562
- });
4563
- },
4564
- update: function update() {
4565
- oculusUpdateCameraReference();
4566
- }
4567
- });
4568
-
4569
- var ndmVrStorage = new NdmVrStorageService();
4570
-
4571
- export { infoBannerAframeComponent as Banner, index as HistogramTH2, JsrootHistogram as JSrootHistogram, leftOculusController as LeftController, NdmVrScene, rightOculusController as RightController, binDataDistributor, ndmVrStorage };
4572
- //# sourceMappingURL=index.modern.js.map