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