aframe-babia-components 1.2.2 → 1.2.3
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/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-cyl.js +180 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +208 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +60 -73
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +203 -132
- package/components/visualizers/babia-bars.js +4 -35
- package/components/visualizers/babia-barsmap.js +2 -30
- package/components/visualizers/babia-boats.js +92 -100
- package/components/visualizers/babia-bubbles.js +9 -26
- package/components/visualizers/babia-cyls.js +197 -201
- package/components/visualizers/babia-cylsmap.js +171 -241
- package/components/visualizers/babia-doughnut.js +2 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +2 -30
- package/dist/aframe-babia-components.js +21678 -19529
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +10 -4
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +27 -0
- package/docs/APIs/QUERIERS.md +16 -0
- package/docs/RELEASE_NOTES.md +32 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
let findProdComponent = require('../others/common').findProdComponent;
|
|
2
|
+
let updateFunction = require('../others/common').updateFunction;
|
|
2
3
|
|
|
3
4
|
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
4
5
|
|
|
@@ -32,7 +33,8 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
32
33
|
height_quarter_legend_title: { type: 'number', default: 12 },
|
|
33
34
|
height_building_legend: { type: 'number', default: 0 },
|
|
34
35
|
legend_scale: { type: 'number', default: 1 },
|
|
35
|
-
|
|
36
|
+
legend_lookat: { type: 'string', default: "[camera]" },
|
|
37
|
+
field: { type: 'string', default: 'uid' },
|
|
36
38
|
},
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -86,35 +88,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
86
88
|
*/
|
|
87
89
|
|
|
88
90
|
update: function (oldData) {
|
|
89
|
-
|
|
90
|
-
let el = this.el;
|
|
91
|
-
if (!this.figures){
|
|
92
|
-
this.figures = [];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Highest priority to data
|
|
96
|
-
if (data.data && oldData.data !== data.data) {
|
|
97
|
-
// Get from the json or embedded
|
|
98
|
-
let _data = JSON.parse(data.data);
|
|
99
|
-
this.processData(_data);
|
|
100
|
-
} else if (data.from !== oldData.from) {
|
|
101
|
-
// Unregister for old treegenerator
|
|
102
|
-
if (this.prodComponent) {
|
|
103
|
-
this.prodComponent.notiBuffer.unregister(this.notiBufferId)
|
|
104
|
-
};
|
|
105
|
-
// Register for the new one
|
|
106
|
-
this.prodComponent = findProdComponent(data, el)
|
|
107
|
-
if (this.prodComponent.notiBuffer){
|
|
108
|
-
this.notiBufferId = this.prodComponent.notiBuffer
|
|
109
|
-
.register(this.processData.bind(this))
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// If changed whatever, re-print with the current data
|
|
113
|
-
else if (data !== oldData && this.newData) {
|
|
114
|
-
this.processData(this.newData)
|
|
115
|
-
}
|
|
91
|
+
updateFunction(this, oldData)
|
|
116
92
|
},
|
|
117
|
-
|
|
93
|
+
|
|
118
94
|
/**
|
|
119
95
|
* Called on each scene tick.
|
|
120
96
|
*/
|
|
@@ -135,17 +111,17 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
135
111
|
let t = { x: 0, y: 0, z: 0 };
|
|
136
112
|
|
|
137
113
|
// when animation not finished, delete figures and opa 1 to inserted
|
|
138
|
-
if (this.animation){
|
|
114
|
+
if (this.animation) {
|
|
139
115
|
this.figures_del.forEach(figure => {
|
|
140
116
|
let entity = document.getElementById(figure.id);
|
|
141
|
-
if (entity){
|
|
117
|
+
if (entity) {
|
|
142
118
|
entity.remove();
|
|
143
119
|
}
|
|
144
120
|
})
|
|
145
121
|
this.figures_in.forEach(figure => {
|
|
146
122
|
let entity = document.getElementById(figure.id);
|
|
147
|
-
if (entity){
|
|
148
|
-
setOpacity(entity, 1.0);
|
|
123
|
+
if (entity) {
|
|
124
|
+
setOpacity(entity, 1.0);
|
|
149
125
|
}
|
|
150
126
|
})
|
|
151
127
|
this.setFigures(this.figures, t);
|
|
@@ -183,7 +159,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
183
159
|
this.el.firstChild.remove();
|
|
184
160
|
this.drawElements(el, this.figures, t);
|
|
185
161
|
} else {
|
|
186
|
-
if (this.figures_old !== this.figures){
|
|
162
|
+
if (this.figures_old !== this.figures) {
|
|
187
163
|
this.animation = true;
|
|
188
164
|
this.start_time = Date.now();
|
|
189
165
|
}
|
|
@@ -336,7 +312,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
336
312
|
if (this.data.area) {
|
|
337
313
|
figure = {
|
|
338
314
|
id: "boat-" + elements[i][this.data.field],
|
|
339
|
-
name: elements[i][this.data.field],
|
|
315
|
+
name: (elements[i].name) ? elements[i].name : elements[i][this.data.field],
|
|
340
316
|
posX: posX,
|
|
341
317
|
posY: posY,
|
|
342
318
|
width: Math.sqrt(element.area),
|
|
@@ -346,7 +322,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
346
322
|
} else {
|
|
347
323
|
figure = {
|
|
348
324
|
id: "boat-" + elements[i][this.data.field],
|
|
349
|
-
name: elements[i][this.data.field],
|
|
325
|
+
name: (elements[i].name) ? elements[i].name : elements[i][this.data.field],
|
|
350
326
|
posX: posX,
|
|
351
327
|
posY: posY,
|
|
352
328
|
width: element.width,
|
|
@@ -419,7 +395,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
419
395
|
|
|
420
396
|
let entity = this.createElement(figures[i], position);
|
|
421
397
|
this.addEvents(entity, figures[i]);
|
|
422
|
-
|
|
398
|
+
|
|
423
399
|
element.appendChild(entity);
|
|
424
400
|
}
|
|
425
401
|
|
|
@@ -532,28 +508,30 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
532
508
|
entity = document.getElementById(figures[i].id);
|
|
533
509
|
// Creating... (next ticks)
|
|
534
510
|
if (figures[i].inserted) {
|
|
511
|
+
|
|
512
|
+
//TODO: This code increments the opacity in the animation part, but it adds several performance issues
|
|
535
513
|
//Increment opacity
|
|
536
|
-
let opa_inc = delta / this.duration;
|
|
537
|
-
let opacity = parseFloat(entity.getAttribute('material').opacity);
|
|
538
|
-
if (opacity + opa_inc < 1) {
|
|
539
|
-
|
|
540
|
-
} else {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
setOpacity(entity, opacity);
|
|
514
|
+
// let opa_inc = delta / this.duration;
|
|
515
|
+
// let opacity = parseFloat(entity.getAttribute('material').opacity);
|
|
516
|
+
// if (opacity + opa_inc < 1) {
|
|
517
|
+
// opacity += opa_inc;
|
|
518
|
+
// } else {
|
|
519
|
+
// opacity = 1.0;
|
|
520
|
+
// figures[i].inserted = false;
|
|
521
|
+
// }
|
|
522
|
+
//setOpacity(entity, opacity);
|
|
545
523
|
|
|
546
524
|
// If animation stops before finish
|
|
547
525
|
let cond = 'id=' + figures[i].id
|
|
548
|
-
if (findIndex(self.figures_in, cond) < 0){
|
|
526
|
+
if (findIndex(self.figures_in, cond) < 0) {
|
|
549
527
|
self.figures_in.push(figures[i])
|
|
550
528
|
}
|
|
551
529
|
|
|
552
|
-
} else {
|
|
530
|
+
} else {
|
|
553
531
|
// find index in old_figures
|
|
554
532
|
let cond = 'id=' + figures[i].id
|
|
555
533
|
let index = findIndex(figures_old, cond)
|
|
556
|
-
if (index < 0
|
|
534
|
+
if (index < 0) {
|
|
557
535
|
// encontrar el elemento que no esta en la escena con id y darle opacidad
|
|
558
536
|
// y cambiar sus propiedades a la nueva si es necesario
|
|
559
537
|
figures[i].inserted = true;
|
|
@@ -590,8 +568,11 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
590
568
|
let new_entity = this.createElement(figures[i], position);
|
|
591
569
|
this.addEvents(new_entity, figures[i]);
|
|
592
570
|
|
|
593
|
-
//Opacity 0
|
|
594
|
-
setOpacity(new_entity, 0);
|
|
571
|
+
//TODO: bad perfomance when Opacity 0 at the beginning
|
|
572
|
+
//setOpacity(new_entity, 0);
|
|
573
|
+
|
|
574
|
+
// New building and quarter, it appears with 0.5 opacity
|
|
575
|
+
setOpacity(new_entity, 0.5);
|
|
595
576
|
|
|
596
577
|
element.appendChild(new_entity);
|
|
597
578
|
figures[i].inserted = true;
|
|
@@ -600,37 +581,42 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
600
581
|
|
|
601
582
|
// Delete figures
|
|
602
583
|
let opa_dec = delta / this.duration;
|
|
603
|
-
for (let i in figures_old){
|
|
584
|
+
for (let i in figures_old) {
|
|
604
585
|
let deleted = false;
|
|
605
586
|
let cond = 'id=' + figures_old[i].id
|
|
606
587
|
let index = findIndex(figures, cond)
|
|
607
|
-
if (index < 0){
|
|
608
|
-
if (findIndex(self.figures_del, cond) < 0){
|
|
588
|
+
if (index < 0) {
|
|
589
|
+
if (findIndex(self.figures_del, cond) < 0) {
|
|
609
590
|
self.figures_del.push(figures_old[i])
|
|
610
591
|
}
|
|
611
592
|
let entity_del = document.getElementById(figures_old[i].id);
|
|
612
|
-
if (entity_del){
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
593
|
+
if (entity_del) {
|
|
594
|
+
|
|
595
|
+
//TODO: Bad perfomance issue when changing dinamically the opacity, better to just make it non vissible
|
|
596
|
+
entity_del.object3D.visible = false
|
|
597
|
+
entity_del.remove();
|
|
598
|
+
|
|
599
|
+
// let opacity = parseFloat(entity_del.components.material.opacity);
|
|
600
|
+
// if (opacity - opa_dec > 0) {
|
|
601
|
+
// opacity -= opa_dec;
|
|
602
|
+
// } else {
|
|
603
|
+
// opacity = 0.0;
|
|
604
|
+
// deleted = true;
|
|
605
|
+
// self.figures_del.pop(figures_old[i]);
|
|
606
|
+
// }
|
|
607
|
+
// setOpacity(entity_del, opacity);
|
|
608
|
+
// if (deleted) {
|
|
609
|
+
// entity_del.remove();
|
|
610
|
+
// }
|
|
625
611
|
}
|
|
626
612
|
}
|
|
627
613
|
}
|
|
628
614
|
},
|
|
629
615
|
|
|
630
|
-
setFigures: function (figures, translate){
|
|
616
|
+
setFigures: function (figures, translate) {
|
|
631
617
|
figures.forEach(figure => {
|
|
632
618
|
let entity = document.getElementById(figure.id);
|
|
633
|
-
if (entity){
|
|
619
|
+
if (entity) {
|
|
634
620
|
if (entity.getAttribute('width') != figure.width) {
|
|
635
621
|
entity.setAttribute('width', figure.width);
|
|
636
622
|
}
|
|
@@ -640,13 +626,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
640
626
|
if (entity.getAttribute('depth') != figure.depth) {
|
|
641
627
|
entity.setAttribute('depth', figure.depth);
|
|
642
628
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
|
|
629
|
+
|
|
630
|
+
//TODO: Full opacity because it was in 0.5 if new building/quarter
|
|
631
|
+
if(entity.components.material.data.opacity < 1){
|
|
632
|
+
setOpacity(entity, 1)
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
entity.object3D.position.set(
|
|
636
|
+
figure.posX - translate.x,
|
|
637
|
+
((parseFloat(figure.height) + translate.y) / 2),
|
|
638
|
+
(- figure.posY + translate.z),
|
|
639
|
+
)
|
|
640
|
+
if (figure.children) {
|
|
650
641
|
this.setFigures(figure.children, figure.translate_matrix);
|
|
651
642
|
}
|
|
652
643
|
}
|
|
@@ -697,6 +688,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
697
688
|
entity.setAttribute('width', new_width);
|
|
698
689
|
entity.setAttribute('height', new_height);
|
|
699
690
|
entity.setAttribute('depth', new_depth);
|
|
691
|
+
entity.babiaRawData = figure.rawData
|
|
700
692
|
|
|
701
693
|
} else if (((new_time - this.start_time) > this.duration) &&
|
|
702
694
|
((figure.width != figure_old.width) ||
|
|
@@ -706,7 +698,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
706
698
|
entity.setAttribute('width', figure.width);
|
|
707
699
|
entity.setAttribute('height', figure.height);
|
|
708
700
|
entity.setAttribute('depth', figure.depth);
|
|
709
|
-
entity.
|
|
701
|
+
entity.babiaRawData = figure.rawData
|
|
710
702
|
}
|
|
711
703
|
},
|
|
712
704
|
|
|
@@ -722,9 +714,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
722
714
|
let inc_y = (delta * dist_y) / (2 * this.duration);
|
|
723
715
|
let inc_z = (delta * dist_z) / this.duration;
|
|
724
716
|
|
|
725
|
-
let last_x = parseFloat(entity.
|
|
726
|
-
let last_y = parseFloat(entity.
|
|
727
|
-
let last_z = parseFloat(entity.
|
|
717
|
+
let last_x = parseFloat(entity.object3D.position.x);
|
|
718
|
+
let last_y = parseFloat(entity.object3D.position.y);
|
|
719
|
+
let last_z = parseFloat(entity.object3D.position.z);
|
|
728
720
|
|
|
729
721
|
let new_x = last_x - inc_x;
|
|
730
722
|
let new_y = last_y + inc_y;
|
|
@@ -732,18 +724,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
732
724
|
|
|
733
725
|
|
|
734
726
|
// Update entity
|
|
735
|
-
entity.
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
727
|
+
entity.object3D.position.set(
|
|
728
|
+
new_x,
|
|
729
|
+
new_y,
|
|
730
|
+
new_z
|
|
731
|
+
)
|
|
740
732
|
|
|
741
733
|
} else if ((new_time - this.start_time) > this.duration) {
|
|
742
|
-
entity.
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
734
|
+
entity.object3D.position.set(
|
|
735
|
+
(figure.posX - translate.x),
|
|
736
|
+
((parseFloat(figure.height) + translate.y) / 2),
|
|
737
|
+
(- figure.posY + translate.z),
|
|
738
|
+
)
|
|
747
739
|
}
|
|
748
740
|
}
|
|
749
741
|
},
|
|
@@ -779,7 +771,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
779
771
|
entity.setAttribute('depth', depth);
|
|
780
772
|
// rawData building
|
|
781
773
|
if (figure.rawData) {
|
|
782
|
-
entity.
|
|
774
|
+
entity.babiaRawData = figure.rawData
|
|
783
775
|
}
|
|
784
776
|
|
|
785
777
|
// add into scene
|
|
@@ -800,7 +792,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
800
792
|
let data = this.data;
|
|
801
793
|
this.newData = _data;
|
|
802
794
|
this.babiaMetadata = { id: this.babiaMetadata.id++ };
|
|
803
|
-
|
|
795
|
+
|
|
804
796
|
// If color metric activated, save in the metadata the max and min value for mapping
|
|
805
797
|
if (data.color) {
|
|
806
798
|
let [color_max, color_min] = getMaxMinColorValues(this.newData, data.color)
|
|
@@ -809,7 +801,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
809
801
|
}
|
|
810
802
|
this.notiBuffer.set(this.newData)
|
|
811
803
|
// Create city
|
|
812
|
-
this.updateChart(this.newData)
|
|
804
|
+
this.updateChart(this.newData)
|
|
813
805
|
},
|
|
814
806
|
|
|
815
807
|
addEvents: function (entity, figure) {
|
|
@@ -854,7 +846,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
854
846
|
});
|
|
855
847
|
entity.appendChild(transparentBox)
|
|
856
848
|
|
|
857
|
-
legend = generateLegend(figure.name, self.data.legend_scale, 'black', 'white');
|
|
849
|
+
legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'black', 'white');
|
|
858
850
|
let worldPos = new THREE.Vector3();
|
|
859
851
|
let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
|
|
860
852
|
let coordinatesFinal = {
|
|
@@ -919,7 +911,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
919
911
|
depth: entityGeometry.depth + 0.1,
|
|
920
912
|
width: entityGeometry.width + 0.1
|
|
921
913
|
});
|
|
922
|
-
legend = generateLegend(figure.name, self.data.legend_scale, 'white', 'black',
|
|
914
|
+
legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'white', 'black', entity.babiaRawData, self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
|
|
923
915
|
let worldPos = new THREE.Vector3();
|
|
924
916
|
let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
|
|
925
917
|
let height_real = new THREE.Box3().setFromObject(entity.object3D)
|
|
@@ -953,7 +945,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
953
945
|
depth: entityGeometry.depth + 0.1,
|
|
954
946
|
width: entityGeometry.width + 0.1
|
|
955
947
|
});
|
|
956
|
-
legend = generateLegend(figure.name, self.data.legend_scale, 'white', 'black',
|
|
948
|
+
legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'white', 'black', entity.babiaRawData, self.data.height, self.data.area, self.data.depth, self.data.width, self.data.color);
|
|
957
949
|
let worldPos = new THREE.Vector3();
|
|
958
950
|
let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
|
|
959
951
|
let height_real = new THREE.Box3().setFromObject(entity.object3D)
|
|
@@ -990,7 +982,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
990
982
|
/**
|
|
991
983
|
* This function generate a plane at the top of the building with the desired text
|
|
992
984
|
*/
|
|
993
|
-
let generateLegend = (name, legend_scale, colorPlane, colorText, data, fheight, farea, fdepth, fwidth, fcolor) => {
|
|
985
|
+
let generateLegend = (name, legend_scale, lookat, colorPlane, colorText, data, fheight, farea, fdepth, fwidth, fcolor) => {
|
|
994
986
|
let width = 2;
|
|
995
987
|
let height = 1;
|
|
996
988
|
if (name.length > 16)
|
|
@@ -1031,7 +1023,7 @@ let generateLegend = (name, legend_scale, colorPlane, colorText, data, fheight,
|
|
|
1031
1023
|
}
|
|
1032
1024
|
|
|
1033
1025
|
let entity = document.createElement('a-plane');
|
|
1034
|
-
entity.setAttribute('babia-lookat',
|
|
1026
|
+
entity.setAttribute('babia-lookat', lookat);
|
|
1035
1027
|
|
|
1036
1028
|
entity.setAttribute('rotation', { x: 0, y: 0, z: 0 });
|
|
1037
1029
|
entity.setAttribute('height', height);
|
|
@@ -1117,8 +1109,8 @@ function heatMapColorforValue(val, max, min) {
|
|
|
1117
1109
|
let findIndex = (list, condicion) => {
|
|
1118
1110
|
condicion = condicion.split('=')
|
|
1119
1111
|
//console.log(condicion)
|
|
1120
|
-
for (i = 0; i < list.length; i++){
|
|
1121
|
-
if (list[i][condicion[0]] === condicion[1]){
|
|
1112
|
+
for (i = 0; i < list.length; i++) {
|
|
1113
|
+
if (list[i][condicion[0]] === condicion[1]) {
|
|
1122
1114
|
return i
|
|
1123
1115
|
}
|
|
1124
1116
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
let findProdComponent = require('../others/common').findProdComponent;
|
|
2
1
|
let updateTitle = require('../others/common').updateTitle;
|
|
3
|
-
let parseJson = require('../others/common').parseJson;
|
|
4
2
|
const colors = require('../others/common').colors;
|
|
3
|
+
let updateFunction = require('../others/common').updateFunction;
|
|
5
4
|
|
|
6
5
|
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
7
6
|
|
|
@@ -46,36 +45,20 @@ AFRAME.registerComponent('babia-bubbles', {
|
|
|
46
45
|
*/
|
|
47
46
|
multiple: false,
|
|
48
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Called once when component is attached. Generally for initial setup.
|
|
50
|
+
*/
|
|
51
|
+
init: function () {
|
|
52
|
+
this.notiBuffer = new NotiBuffer();
|
|
53
|
+
},
|
|
54
|
+
|
|
49
55
|
/**
|
|
50
56
|
* Called when component is attached and when component data changes.
|
|
51
57
|
* Generally modifies the entity based on the data.
|
|
52
58
|
*/
|
|
53
59
|
|
|
54
60
|
update: function (oldData) {
|
|
55
|
-
|
|
56
|
-
let el = this.el;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Update or create chart component
|
|
60
|
-
*/
|
|
61
|
-
if (data.data && oldData.data !== data.data) {
|
|
62
|
-
let _data = parseJson(data.data);
|
|
63
|
-
this.processData(_data);
|
|
64
|
-
} else if (data.from !== oldData.from) {
|
|
65
|
-
// Unregister from old producer
|
|
66
|
-
if (this.prodComponent) {
|
|
67
|
-
this.prodComponent.notiBuffer.unregister(this.notiBufferId)
|
|
68
|
-
};
|
|
69
|
-
this.prodComponent = findProdComponent (data, el)
|
|
70
|
-
if (this.prodComponent.notiBuffer) {
|
|
71
|
-
this.notiBufferId = this.prodComponent.notiBuffer
|
|
72
|
-
.register(this.processData.bind(this))
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
// If changed whatever, re-print with the current data
|
|
76
|
-
else if (data !== oldData && this.newData) {
|
|
77
|
-
this.processData(this.newData)
|
|
78
|
-
}
|
|
61
|
+
updateFunction(this, oldData)
|
|
79
62
|
},
|
|
80
63
|
|
|
81
64
|
/**
|