@ndmspc/ndmvr 0.20220401.0 → 0.20230117.0

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