@ndmspc/ndmvr 0.20220401.1 → 0.20230212.0

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