aframe-babia-components 1.2.6 → 1.2.8
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/common/noti-buffer.js +4 -1
- package/components/filters/babia-treebuilder.js +14 -4
- package/components/others/babia-slider.js +296 -296
- package/components/visualizers/babia-boats.js +218 -84
- package/components/visualizers/babia-html.js +255 -0
- package/cypress.json +1 -1
- package/dist/aframe-babia-components.js +41889 -46000
- package/dist/aframe-babia-components.min.js +2 -7
- package/dist/aframe-babia-components.min.js.LICENSE.txt +12 -0
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +5 -1
- package/docs/APIs/OTHERS.md +18 -8
- package/docs/RELEASE_NOTES.md +4 -0
- package/docs/Tutorials/get_started.md +2 -2
- package/docs/Tutorials/temporal_evol_with_boats.md +3 -3
- package/examples/ar/multichart/index.html +75 -0
- package/examples/assets/fonts/regular.json +1 -0
- package/examples/async/index.html +3 -3
- package/examples/async/index_filter.html +3 -3
- package/examples/async/index_noti_buffer.html +3 -3
- package/examples/async/index_noti_buffer_filter.html +3 -3
- package/examples/boats/boats/index.html +3 -3
- package/examples/boats/boats2/data.json +13 -206
- package/examples/boats/boats2/index.html +4 -4
- package/examples/boats/boats_city/index.html +4 -4
- package/examples/boats/boats_city_plan_view/index.html +4 -4
- package/examples/boats/boats_dependency/experiment.html +8 -7
- package/examples/boats/boats_dependency/index.html +1 -1
- package/examples/boats/boats_dependency/index_gradient.html +1 -1
- package/examples/boats/boats_dependency/index_normalcity.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_01.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_02.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_03.html +1 -1
- package/examples/boats/boats_dependency/index_quarter_levels_querystring.html +1 -1
- package/examples/boats/boats_dependency/index_tree.html +1 -1
- package/examples/boats/boats_dependency/index_tree_gradient.html +1 -1
- package/examples/boats/boats_dependency/index_tree_wireframe.html +1 -1
- package/examples/boats/boats_new_element/index.html +3 -3
- package/examples/boats/boats_new_quarter/index.html +3 -3
- package/examples/boats/boats_plan_view/index.html +3 -3
- package/examples/boats/boats_plan_view2/index.html +4 -4
- package/examples/boats/boats_quarter_resize/index.html +3 -3
- package/examples/boats/boats_quarter_resize2/index.html +3 -3
- package/examples/boats/boats_resize/index.html +3 -3
- package/examples/boats/boats_temporal/index.html +3 -3
- package/examples/boats/boats_treegenerator/index.html +3 -3
- package/examples/boats/jetuml_evol/ar.html +333 -0
- package/examples/boats/jetuml_evol/data.json +62382 -0
- package/examples/boats/jetuml_evol/index.html +381 -0
- package/examples/charts/bars/bars_change.html +2 -2
- package/examples/charts/bars/bars_json.html +2 -2
- package/examples/charts/bars/index.html +3 -3
- package/examples/charts/barsmap/index.html +3 -3
- package/examples/charts/bubbles/index.html +3 -3
- package/examples/charts/cyls/index.html +3 -3
- package/examples/charts/cyls/primitive.html +3 -3
- package/examples/charts/cylsmap/index.html +3 -3
- package/examples/charts/doughnut/index.html +3 -3
- package/examples/charts/multichart/index.html +3 -3
- package/examples/charts/network_chart/network_chart.html +1 -1
- package/examples/charts/network_chart/network_large_chart.html +3 -3
- package/examples/charts/network_chart/network_nodes_links_chart.html +3 -3
- package/examples/charts/network_chart/network_nodes_links_directed_chart.html +2 -2
- package/examples/charts/network_chart/network_random_chart.html +2 -2
- package/examples/charts/pie/index.html +2 -2
- package/examples/charts_querier/bars_querier/bars_axis_name.html +3 -3
- package/examples/charts_querier/bars_querier/index.html +3 -3
- package/examples/charts_querier/bars_querier/index_csv.html +3 -3
- package/examples/charts_querier/barsmap_querier/barsmap_axis_name.html +3 -3
- package/examples/charts_querier/barsmap_querier/index.html +3 -3
- package/examples/charts_querier/bubbles_querier/index.html +3 -3
- package/examples/charts_querier/cyls_querier/index.html +3 -3
- package/examples/charts_querier/cylsmap_querier/index.html +3 -3
- package/examples/charts_querier/doughnut_querier/index.html +3 -3
- package/examples/charts_querier/multichart_querier/index.html +3 -3
- package/examples/charts_querier/multichart_querier/manual_colors.html +3 -3
- package/examples/charts_querier/pie_querier/index.html +3 -3
- package/examples/codecityjs/argouml/index.html +4 -4
- package/examples/codecityjs/basic/index.html +2 -2
- package/examples/codecityjs/basic_treegenerator/index.html +2 -2
- package/examples/codecityjs/perceval/index.html +2 -2
- package/examples/codecityjs/perceval2021/index.html +4 -4
- package/examples/codecityjs/projects_analysis/argouml_landscape.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_numfuns.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_table.html +2 -2
- package/examples/codecityjs/projects_analysis/argouml_tokens.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_task5.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_2021.html +2 -2
- package/examples/codecityjs/projects_analysis/experiment_interface_vr_task5.html +2 -2
- package/examples/codecityjs/projects_analysis/perceval_landscape.html +2 -2
- package/examples/codecityjs/projects_analysis/perceval_table.html +2 -2
- package/examples/codecityjs/sortinghat/index.html +2 -2
- package/examples/codecityjs/sortinghat/indexcolor.html +2 -2
- package/examples/codecityjs/time_evolution_angular/index.html +2 -2
- package/examples/dashboard/chaoss-dashboards.html +1 -1
- package/examples/dashboard/chaoss-issues.html +1 -1
- package/examples/dashboard/chaoss-pr.html +1 -1
- package/examples/dashboard/index.html +1 -1
- package/examples/dashboard/range.html +3 -3
- package/examples/dashboard/template.html +1 -1
- package/examples/demos/1.0.11/index.html +4 -4
- package/examples/demos/1.0.11/index_multiuser.html +3 -3
- package/examples/demos/1.0.11/index_multiuser_ui.html +3 -3
- package/examples/demos/1.0.7/index.html +3 -3
- package/examples/demos/citations/babiaxr.json +1 -0
- package/examples/demos/citations/citations.html +72 -0
- package/examples/demos/citations/music.mp3 +0 -0
- package/examples/demos/citations/stl.js +28 -0
- package/examples/elevation/elevation basic/index.html +2 -2
- package/examples/elevation/elevation filled/index.html +2 -2
- package/{example-template.html → examples/example-template.html} +10 -9
- package/examples/experiment/city.html +15 -11
- package/examples/experiment/index.html +1 -1
- package/examples/experiment/pie.html +2 -2
- package/examples/experiment/third_party.html +92 -0
- package/examples/htmlinxr/complex.html +219 -0
- package/examples/htmlinxr/simple.html +163 -0
- package/examples/img/codecitytree.png +0 -0
- package/examples/img/codecityvs.png +0 -0
- package/examples/img/dashboard.png +0 -0
- package/examples/img/elevatedcity.png +0 -0
- package/examples/img/experiment.png +0 -0
- package/examples/img/time.png +0 -0
- package/examples/img/uinetwork.png +0 -0
- package/examples/img/uinetwork_json.png +0 -0
- package/examples/multi_bars/index.html +3 -3
- package/examples/multi_bars/index1.html +3 -3
- package/examples/multi_bars/index2.html +3 -3
- package/examples/multi_bars/index3.html +3 -3
- package/examples/multi_boats/index_multi_boats.html +3 -3
- package/examples/multi_boats/jetuml.html +3 -3
- package/examples/multi_boats/jetuml_evolution_experiment.html +3 -3
- package/examples/multi_boats/only_queryjson.html +3 -3
- package/examples/multi_boats/only_queryjson2.html +3 -3
- package/examples/multi_boats/only_queryjson3.html +3 -3
- package/examples/multi_boats/queryjson_treebuilder.html +3 -3
- package/examples/multi_boats/with_selector.html +3 -3
- package/examples/multiuser/choose_avatar/desert_demo.html +3 -3
- package/examples/multiuser/demo_esLibre_audio.html +3 -3
- package/examples/multiuser/demo_esLibre_no_audio.html +3 -3
- package/examples/multiuser/demo_no_share_ui.html +3 -3
- package/examples/multiuser/meaningful.html +3 -3
- package/examples/multiuser/new_demo.html +3 -3
- package/examples/multiuser/no_persistence.html +3 -3
- package/examples/multiuser/persistence.html +3 -3
- package/examples/multiuser/simple_scene.html +3 -3
- package/examples/performance/500bars_100anime/index.html +3 -3
- package/examples/performance/500bars_anime/index.html +3 -3
- package/examples/performance/500simplebars_100anime/index.html +3 -3
- package/examples/publications/codecityvs/aframe-lounge-component.min.js +1 -0
- package/examples/publications/codecityvs/index.html +535 -0
- package/examples/publications/codecityvs/jetuml_code_data.json +1 -0
- package/examples/publications/dashboard/index.html +764 -0
- package/examples/publications/dashboard/staticdata/80-percent-open-time-issues2.json +1 -0
- package/examples/publications/dashboard/staticdata/80-percent-open-time-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/issues-by-organization.json +1 -0
- package/examples/publications/dashboard/staticdata/issues.json +1 -0
- package/examples/publications/dashboard/staticdata/median-open-time-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/median-open-time-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/organizations-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/organizations-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/projects-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/projects-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/pull-requests-by-organization.json +1 -0
- package/examples/publications/dashboard/staticdata/pull-requests.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-asignees.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-count.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-issues-submitters.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-asignees.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-count.json +1 -0
- package/examples/publications/dashboard/staticdata/repositories-pr-submitters.json +1 -0
- package/examples/publications/dashboard/staticdata/status-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/status-pr.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-count.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-issues-repo.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-avgdays.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-count.json +1 -0
- package/examples/publications/dashboard/staticdata/submitter-pr-repo.json +1 -0
- package/examples/publications/dashboard/staticdata/submitters-issues.json +1 -0
- package/examples/publications/dashboard/staticdata/submitters-pr.json +1 -0
- package/examples/publications/elevated/dependencieslist_ghdesktop.json +127660 -0
- package/examples/publications/elevated/dependencieslist_pm2.json +13726 -0
- package/examples/publications/elevated/dependencieslist_portainer.json +41818 -0
- package/examples/publications/elevated/dependencieslist_sh.json +5194 -0
- package/examples/publications/elevated/index.html +278 -0
- package/examples/selector/index.html +2 -2
- package/examples/selector_boats/index.html +3 -3
- package/examples/selector_boats/index2.html +3 -3
- package/examples/selector_boats/jetuml.html +3 -3
- package/examples/selector_boats/jetumltest.html +3 -3
- package/examples/temporal_evol/bars/index.html +3 -3
- package/examples/temporal_evol/barsmap/index.html +3 -3
- package/examples/timeline/index.html +3 -3
- package/examples/timeline/index2.html +3 -3
- package/examples/timeline/index3.html +3 -3
- package/examples/ui/bars/index.html +3 -3
- package/examples/ui/barsmap/index.html +3 -3
- package/examples/ui/boats_treegenerator/index.html +3 -3
- package/examples/ui/city_treegenerator/index.html +3 -3
- package/examples/ui/cylsmap/index.html +3 -3
- package/examples/ui/link/index.html +3 -3
- package/examples/ui/network/network.html +3 -3
- package/examples/ui/network/network_nodes_links.html +2 -2
- package/examples/ui/oculus/index.html +3 -3
- package/examples/ui/pie/index.html +3 -3
- package/examples/ui/ui_treegenerator/index.html +3 -3
- package/examples/watcher/querier_watcher/index.html +2 -2
- package/index.html +186 -168
- package/index.js +6 -1
- package/package.json +15 -14
- package/tests/index.html +2 -2
- package/tests/treebuilder.js +69 -0
- package/webpack.dev.js +12 -7
- package/webpack.devall.js +12 -7
- package/webpack.devnossl.js +5 -4
- package/webpack.prod.js +1 -1
|
@@ -22,8 +22,14 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
22
22
|
area: { type: 'string' },
|
|
23
23
|
color: { type: 'string' },
|
|
24
24
|
height: { type: 'string', default: 'height' },
|
|
25
|
+
// Maximum height for a building, in VR units (meters)
|
|
25
26
|
maxBuildingHeight: { type: 'number', default: 2 },
|
|
27
|
+
// Minimum height for a building, in VR units (meters)
|
|
26
28
|
minBuildingHeight: { type: 'number', default: 0.03 },
|
|
29
|
+
// Differential heights for buildings (the height of
|
|
30
|
+
// buildings is calculated relative to the difference between
|
|
31
|
+
// highest and lowest value)
|
|
32
|
+
diffBuildingHeight: { type: 'boolean', default: false },
|
|
27
33
|
zone_elevation: { type: 'number', default: 0.01 },
|
|
28
34
|
building_separation: { type: 'number', default: 0.25 },
|
|
29
35
|
extra: { type: 'number', default: 1.0 },
|
|
@@ -39,8 +45,12 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
39
45
|
height_building_legend: { type: 'number', default: 0 },
|
|
40
46
|
legend_scale: { type: 'number', default: 1 },
|
|
41
47
|
legend_lookat: { type: 'string', default: "[camera]" },
|
|
48
|
+
legendsAsChildren: { type: 'boolean', default: false },
|
|
49
|
+
legendsAsChildrenHeight: { type: 'number', default: 3 },
|
|
42
50
|
metricsInfoId: { type: 'string', default: "" },
|
|
43
51
|
highlightQuarter: { type: 'boolean', default: false },
|
|
52
|
+
hideQuarterBoxLegend: { type: 'boolean', default: false },
|
|
53
|
+
highlightQuarterByClick: { type: 'boolean', default: false },
|
|
44
54
|
field: { type: 'string', default: 'uid' },
|
|
45
55
|
|
|
46
56
|
// Numeric color legend entity to hide/show
|
|
@@ -185,9 +195,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
185
195
|
y: self.data.height_quarter_legend_title,
|
|
186
196
|
z: coordinates.z
|
|
187
197
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
self.
|
|
198
|
+
|
|
199
|
+
// If legend is a child of the building/quarter
|
|
200
|
+
if (self.data.legendsAsChildren) {
|
|
201
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
202
|
+
entity.legend.setAttribute('visible', true);
|
|
203
|
+
entity.appendChild(entity.legend)
|
|
204
|
+
} else {
|
|
205
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
206
|
+
entity.legend.setAttribute('visible', true);
|
|
207
|
+
self.el.parentElement.appendChild(entity.legend)
|
|
208
|
+
}
|
|
209
|
+
|
|
191
210
|
|
|
192
211
|
self.legendsActive.push(entity.legend)
|
|
193
212
|
entity.alreadyActive = true
|
|
@@ -217,7 +236,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
217
236
|
},
|
|
218
237
|
|
|
219
238
|
updateChart: function (items) {
|
|
220
|
-
console.log('Data Loaded.');
|
|
239
|
+
//console.log('Data Loaded.');
|
|
221
240
|
let t = { x: 0, y: 0, z: 0 };
|
|
222
241
|
this.idsToNotRepeatWireframe = []
|
|
223
242
|
this.idsToNotRepeat20Transparent = []
|
|
@@ -285,6 +304,26 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
285
304
|
categoricColorIndex: 0,
|
|
286
305
|
categoricColorMaps: {},
|
|
287
306
|
|
|
307
|
+
/**
|
|
308
|
+
* generateElements
|
|
309
|
+
*
|
|
310
|
+
* Generate width, depth and translation coords for the center,
|
|
311
|
+
* and list of figures to visualize, from a tree of data elements and
|
|
312
|
+
* a partial list of figures.
|
|
313
|
+
*
|
|
314
|
+
* Each element is a data element, obtained from the data to visualize,
|
|
315
|
+
* which may include children elements (so, in fact, it may also be the root
|
|
316
|
+
* of a tree of elements).
|
|
317
|
+
*
|
|
318
|
+
* Each figure includes all data needed to visualize it (which will be done
|
|
319
|
+
* later, in another function).
|
|
320
|
+
*
|
|
321
|
+
* @param {*} elements Array of elements
|
|
322
|
+
* @param {*} figures Array of figures
|
|
323
|
+
* @param {*} translate Translation from the center
|
|
324
|
+
* @param {*} inc Increment
|
|
325
|
+
* @returns [width, depth, translate, figures]
|
|
326
|
+
*/
|
|
288
327
|
generateElements: function (elements, figures, translate, inc) {
|
|
289
328
|
const self = this;
|
|
290
329
|
var increment = inc;
|
|
@@ -328,7 +367,16 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
328
367
|
element.width = elements[i][this.data.width] || 0.5
|
|
329
368
|
}
|
|
330
369
|
if (this.data.height) {
|
|
331
|
-
|
|
370
|
+
let height_min = 0;
|
|
371
|
+
if (self.data.diffBuildingHeight) {
|
|
372
|
+
height_min = self.babiaMetadata['heightMin'];
|
|
373
|
+
};
|
|
374
|
+
element.height = self.normalizeValues(height_min,
|
|
375
|
+
self.babiaMetadata['heightMax'],
|
|
376
|
+
self.data.minBuildingHeight,
|
|
377
|
+
self.data.maxBuildingHeight,
|
|
378
|
+
elements[i][this.data.height])
|
|
379
|
+
|| this.data.minBuildingHeight
|
|
332
380
|
}
|
|
333
381
|
if (this.data.depth) {
|
|
334
382
|
element.depth = elements[i][this.data.depth] || 0.5
|
|
@@ -337,6 +385,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
337
385
|
element.area = elements[i][this.data.area] || 0.5
|
|
338
386
|
}
|
|
339
387
|
if (elements[i].children) {
|
|
388
|
+
// There are elements hanging from this element
|
|
340
389
|
element.children = elements[i].children
|
|
341
390
|
this.quarter = true;
|
|
342
391
|
var children = [];
|
|
@@ -360,11 +409,13 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
360
409
|
});
|
|
361
410
|
}
|
|
362
411
|
|
|
363
|
-
[element.width, element.depth, translate_matrix, children]
|
|
412
|
+
[element.width, element.depth, translate_matrix, children]
|
|
413
|
+
= this.generateElements(element.children, children, translate_matrix, increment);
|
|
364
414
|
translate_matrix.y = element.height;
|
|
365
415
|
increment = inc;
|
|
366
416
|
}
|
|
367
417
|
if (i == 0) {
|
|
418
|
+
// This is the first element to place
|
|
368
419
|
if (this.data.area && !elements[i].children) {
|
|
369
420
|
limit_up += Math.sqrt(element.area) / 2;
|
|
370
421
|
limit_down -= Math.sqrt(element.area) / 2;
|
|
@@ -431,60 +482,54 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
431
482
|
}
|
|
432
483
|
|
|
433
484
|
// Save information about the figure
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
depth: element.depth,
|
|
444
|
-
children: children,
|
|
445
|
-
alpha: self.data.baseAlpha,
|
|
446
|
-
translate_matrix: translate_matrix
|
|
447
|
-
}
|
|
485
|
+
// First, fill in common properties, then add those specific for
|
|
486
|
+
// bases or buildings
|
|
487
|
+
let figure = {
|
|
488
|
+
id: "boat-" + elements[i][this.data.field],
|
|
489
|
+
posX: posX,
|
|
490
|
+
posY: posY,
|
|
491
|
+
height: element.height,
|
|
492
|
+
translate_matrix: translate_matrix
|
|
493
|
+
}
|
|
448
494
|
|
|
495
|
+
if (elements[i].children) {
|
|
496
|
+
// This is the base for a quarter
|
|
497
|
+
figure.name = elements[i][this.data.field] || '',
|
|
498
|
+
figure.width = element.width,
|
|
499
|
+
figure.depth = element.depth,
|
|
500
|
+
figure.children = children,
|
|
501
|
+
figure.alpha = self.data.baseAlpha,
|
|
502
|
+
figure.translate_matrix = translate_matrix
|
|
449
503
|
// TEST TREE
|
|
450
504
|
if (self.data.treeLayout) {
|
|
451
505
|
figure.treeMetaphorHeight = element.treeMetaphorHeight
|
|
452
506
|
}
|
|
453
|
-
|
|
454
507
|
// Gradient color
|
|
455
508
|
let hierarchyLevel = figure.name.split("/").length - 1
|
|
456
509
|
figure.hierarchyLevel = hierarchyLevel
|
|
457
510
|
figure.renderOrder = hierarchyLevel
|
|
458
511
|
if (self.data.gradientBaseColor) {
|
|
459
|
-
figure.color = greenColorsurface(Math.round(
|
|
512
|
+
figure.color = greenColorsurface(Math.round(
|
|
513
|
+
self.normalizeValues(1,
|
|
514
|
+
self.babiaMetadata['maxLevels'],
|
|
515
|
+
15,
|
|
516
|
+
100,
|
|
517
|
+
hierarchyLevel)
|
|
518
|
+
));
|
|
460
519
|
} else {
|
|
461
520
|
figure.color = self.data.base_color;
|
|
462
521
|
}
|
|
463
|
-
|
|
464
522
|
} else {
|
|
523
|
+
// This is a building
|
|
524
|
+
figure.name = (elements[i].name) ? elements[i].name : elements[i][this.data.field],
|
|
525
|
+
figure.alpha = self.data.buildingAlpha
|
|
465
526
|
if (this.data.area) {
|
|
466
|
-
figure =
|
|
467
|
-
|
|
468
|
-
name: (elements[i].name) ? elements[i].name : elements[i][this.data.field],
|
|
469
|
-
posX: posX,
|
|
470
|
-
posY: posY,
|
|
471
|
-
width: Math.sqrt(element.area),
|
|
472
|
-
height: element.height,
|
|
473
|
-
alpha: self.data.buildingAlpha,
|
|
474
|
-
depth: Math.sqrt(element.area)
|
|
475
|
-
}
|
|
527
|
+
figure.width = Math.sqrt(element.area);
|
|
528
|
+
figure.depth = Math.sqrt(element.area);
|
|
476
529
|
} else {
|
|
477
|
-
figure =
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
posX: posX,
|
|
481
|
-
posY: posY,
|
|
482
|
-
width: element.width,
|
|
483
|
-
height: element.height,
|
|
484
|
-
alpha: self.data.buildingAlpha,
|
|
485
|
-
depth: element.depth
|
|
486
|
-
}
|
|
487
|
-
}
|
|
530
|
+
figure.width = element.width;
|
|
531
|
+
figure.depth = element.depth;
|
|
532
|
+
};
|
|
488
533
|
if (typeof elements[i][self.data.color] === 'number') {
|
|
489
534
|
figure.color = heatMapColorforValue(elements[i][self.data.color], self.babiaMetadata['color_max'], self.babiaMetadata['color_min'])
|
|
490
535
|
} else if (typeof elements[i][self.data.color] === 'string') {
|
|
@@ -641,7 +686,15 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
641
686
|
} else {
|
|
642
687
|
// Quarters on top of the buildings
|
|
643
688
|
if (figures[i].treeMetaphorHeight !== undefined) {
|
|
644
|
-
|
|
689
|
+
let height_min = 0;
|
|
690
|
+
if (self.data.diffBuildingHeight) {
|
|
691
|
+
height_min = self.babiaMetadata['heightMin'];
|
|
692
|
+
};
|
|
693
|
+
position.y = (self.normalizeValues(height_min,
|
|
694
|
+
self.babiaMetadata['heightMax'],
|
|
695
|
+
self.data.minBuildingHeight,
|
|
696
|
+
self.data.maxBuildingHeight,
|
|
697
|
+
figures[i].treeMetaphorHeight))
|
|
645
698
|
} else {
|
|
646
699
|
position.y = ((height / 2 + translate.y / 2)) - height - 0.001
|
|
647
700
|
}
|
|
@@ -796,6 +849,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
796
849
|
// find index in old_figures
|
|
797
850
|
let cond = 'id=' + figures[i].id
|
|
798
851
|
let index = findIndex(figures_old, cond)
|
|
852
|
+
|
|
853
|
+
// Update rawData
|
|
854
|
+
entity.babiaRawData = figures[i].rawData
|
|
799
855
|
if (index < 0) {
|
|
800
856
|
// encontrar el elemento que no esta en la escena con id y darle opacidad
|
|
801
857
|
// y cambiar sus propiedades a la nueva si es necesario
|
|
@@ -1017,10 +1073,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1017
1073
|
}
|
|
1018
1074
|
} else {
|
|
1019
1075
|
if (figure.treeMetaphorHeight !== undefined) {
|
|
1076
|
+
let height_min = 0;
|
|
1077
|
+
if (self.data.diffBuildingHeight) {
|
|
1078
|
+
height_min = self.babiaMetadata['heightMin'];
|
|
1079
|
+
};
|
|
1020
1080
|
entity.object3D.position.set(
|
|
1021
1081
|
figure.posX - translate.x,
|
|
1022
|
-
|
|
1023
|
-
|
|
1082
|
+
self.normalizeValues(height_min,
|
|
1083
|
+
self.babiaMetadata['heightMax'],
|
|
1084
|
+
self.data.minBuildingHeight,
|
|
1085
|
+
self.data.maxBuildingHeight,
|
|
1086
|
+
figure.treeMetaphorHeight),
|
|
1087
|
+
- figure.posY + translate.z,
|
|
1024
1088
|
)
|
|
1025
1089
|
} else {
|
|
1026
1090
|
entity.object3D.position.set(
|
|
@@ -1091,7 +1155,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1091
1155
|
entity.setAttribute('width', new_width);
|
|
1092
1156
|
entity.setAttribute('height', new_height);
|
|
1093
1157
|
entity.setAttribute('depth', new_depth);
|
|
1094
|
-
entity.babiaRawData = figure.rawData
|
|
1095
1158
|
|
|
1096
1159
|
//Check if has transparent box as a quarter
|
|
1097
1160
|
if (entity.classList.contains('babiaquarterboxactivated')) {
|
|
@@ -1113,7 +1176,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1113
1176
|
entity.setAttribute('width', figure.width);
|
|
1114
1177
|
entity.setAttribute('height', figure.height);
|
|
1115
1178
|
entity.setAttribute('depth', figure.depth);
|
|
1116
|
-
entity.babiaRawData = figure.rawData
|
|
1117
1179
|
|
|
1118
1180
|
//Check if has transparent box as a quarter
|
|
1119
1181
|
if (entity.classList.contains('babiaquarterboxactivated')) {
|
|
@@ -1217,6 +1279,8 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1217
1279
|
|
|
1218
1280
|
// create box
|
|
1219
1281
|
entity.setAttribute('color', color);
|
|
1282
|
+
// Store init color
|
|
1283
|
+
entity.setAttribute('babiaxrFirstColor', color)
|
|
1220
1284
|
entity.setAttribute('width', width);
|
|
1221
1285
|
entity.setAttribute('height', height);
|
|
1222
1286
|
entity.setAttribute('depth', depth);
|
|
@@ -1259,7 +1323,7 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1259
1323
|
*/
|
|
1260
1324
|
processData: function (_data) {
|
|
1261
1325
|
const self = this
|
|
1262
|
-
console.log("processData", _data);
|
|
1326
|
+
//console.log("processData", _data);
|
|
1263
1327
|
let data = this.data;
|
|
1264
1328
|
this.newData = _data;
|
|
1265
1329
|
this.babiaMetadata = { id: this.babiaMetadata.id++ };
|
|
@@ -1407,15 +1471,33 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1407
1471
|
// dont add events flag (if transparent)
|
|
1408
1472
|
if (!figure.dontAddEvents) {
|
|
1409
1473
|
let transparentBox;
|
|
1474
|
+
|
|
1410
1475
|
entity.addEventListener('click', function (e) {
|
|
1411
1476
|
// Just launch the event on the child
|
|
1412
1477
|
if (e.target !== this)
|
|
1413
1478
|
return;
|
|
1414
1479
|
|
|
1415
1480
|
if (entity.legend) {
|
|
1416
|
-
|
|
1481
|
+
// Only if it not activated
|
|
1482
|
+
if (!self.data.hideQuarterBoxLegend) {
|
|
1483
|
+
self.el.parentElement.removeChild(transparentBox)
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// Only if highlighted activated
|
|
1487
|
+
if (self.data.highlightQuarterByClick) {
|
|
1488
|
+
entity.setAttribute('material', 'color', entity.getAttribute('babiaxrFirstColor'))
|
|
1489
|
+
entity.setAttribute('babiaxrHightlightedByClick', false)
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1417
1492
|
entity.classList.remove("babiaquarterboxactivated");
|
|
1418
|
-
|
|
1493
|
+
|
|
1494
|
+
// If legend is a child of the building/quarter
|
|
1495
|
+
if (self.data.legendsAsChildren) {
|
|
1496
|
+
entity.removeChild(entity.legend)
|
|
1497
|
+
} else {
|
|
1498
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1419
1501
|
|
|
1420
1502
|
// Remove from the array that has the entity activated and the legend
|
|
1421
1503
|
const index = self.entitiesWithLegend.findIndex(item => item.entity === entity);
|
|
@@ -1431,27 +1513,39 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1431
1513
|
transparentBox = undefined
|
|
1432
1514
|
|
|
1433
1515
|
} else {
|
|
1434
|
-
|
|
1435
|
-
transparentBox.setAttribute('class', 'babiaquarterlegendbox')
|
|
1436
|
-
entity.classList.add("babiaquarterboxactivated");
|
|
1437
|
-
let oldGeometry = entity.getAttribute('geometry')
|
|
1438
|
-
let scale = self.el.getAttribute("scale") || { x: 1, y: 1, z: 1 }
|
|
1439
|
-
let tsBoxHeight = (oldGeometry.height * scale.y) + self.data.height_quarter_legend_box
|
|
1440
|
-
transparentBox.setAttribute('geometry', {
|
|
1441
|
-
height: tsBoxHeight,
|
|
1442
|
-
depth: oldGeometry.depth * scale.z,
|
|
1443
|
-
width: oldGeometry.width * scale.x
|
|
1444
|
-
});
|
|
1445
|
-
transparentBox.setAttribute('material', {
|
|
1446
|
-
'visible': true,
|
|
1447
|
-
'opacity': 0.4
|
|
1448
|
-
});
|
|
1449
|
-
// This is because the webGL render order does not work well with the transparencies
|
|
1450
|
-
transparentBox.object3D.renderOrder = 1000000000
|
|
1516
|
+
// Global coordinates
|
|
1451
1517
|
let worldPos = new THREE.Vector3();
|
|
1452
1518
|
let coordinates = worldPos.setFromMatrixPosition(entity.object3D.matrixWorld);
|
|
1453
|
-
|
|
1454
|
-
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
if (!self.data.hideQuarterBoxLegend) {
|
|
1522
|
+
transparentBox = document.createElement('a-entity');
|
|
1523
|
+
transparentBox.setAttribute('class', 'babiaquarterlegendbox')
|
|
1524
|
+
entity.classList.add("babiaquarterboxactivated");
|
|
1525
|
+
let oldGeometry = entity.getAttribute('geometry')
|
|
1526
|
+
let scale = self.el.getAttribute("scale") || { x: 1, y: 1, z: 1 }
|
|
1527
|
+
let tsBoxHeight = (oldGeometry.height * scale.y) + self.data.height_quarter_legend_box
|
|
1528
|
+
transparentBox.setAttribute('geometry', {
|
|
1529
|
+
height: tsBoxHeight,
|
|
1530
|
+
depth: oldGeometry.depth * scale.z,
|
|
1531
|
+
width: oldGeometry.width * scale.x
|
|
1532
|
+
});
|
|
1533
|
+
transparentBox.setAttribute('material', {
|
|
1534
|
+
'visible': true,
|
|
1535
|
+
'opacity': 0.4
|
|
1536
|
+
});
|
|
1537
|
+
// This is because the webGL render order does not work well with the transparencies
|
|
1538
|
+
transparentBox.object3D.renderOrder = 1000000000
|
|
1539
|
+
|
|
1540
|
+
transparentBox.setAttribute('position', coordinates)
|
|
1541
|
+
self.el.parentElement.appendChild(transparentBox)
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
// If quarter is highlighted using the click
|
|
1545
|
+
if (self.data.highlightQuarterByClick) {
|
|
1546
|
+
//entity.setAttribute('babiaxrFirstColor', entity.getAttribute("material")["color"])
|
|
1547
|
+
entity.setAttribute('material', 'color', '#bfbfbf')
|
|
1548
|
+
}
|
|
1455
1549
|
|
|
1456
1550
|
let coordinatesFinal = {
|
|
1457
1551
|
x: coordinates.x,
|
|
@@ -1459,9 +1553,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1459
1553
|
z: coordinates.z
|
|
1460
1554
|
}
|
|
1461
1555
|
entity.legend = generateLegend(figure.name, self.data.legend_scale, self.data.legend_lookat, 'black', 'white');
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
self.
|
|
1556
|
+
|
|
1557
|
+
// If legend is a child of the building/quarter
|
|
1558
|
+
if (self.data.legendsAsChildren) {
|
|
1559
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1560
|
+
entity.legend.setAttribute('visible', true);
|
|
1561
|
+
entity.appendChild(entity.legend)
|
|
1562
|
+
} else {
|
|
1563
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1564
|
+
entity.legend.setAttribute('visible', true);
|
|
1565
|
+
self.el.parentElement.appendChild(entity.legend)
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1465
1568
|
|
|
1466
1569
|
// Add to the elements that has the legend activated
|
|
1467
1570
|
self.entitiesWithLegend.push({ 'figure': figure, 'entity': entity })
|
|
@@ -1506,7 +1609,13 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1506
1609
|
entity.setAttribute('material', {
|
|
1507
1610
|
'color': entity.getAttribute('babiaxrFirstColor')
|
|
1508
1611
|
});
|
|
1509
|
-
|
|
1612
|
+
|
|
1613
|
+
// If legend is a child of the building/quarter
|
|
1614
|
+
if (self.data.legendsAsChildren) {
|
|
1615
|
+
entity.removeChild(entity.legend)
|
|
1616
|
+
} else {
|
|
1617
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1618
|
+
}
|
|
1510
1619
|
|
|
1511
1620
|
// Remove from the array that has the entity activated
|
|
1512
1621
|
const index = self.entitiesWithLegend.findIndex(item => item.entity === entity);
|
|
@@ -1567,9 +1676,19 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1567
1676
|
y: height_real.max.y + 1 + self.data.height_building_legend,
|
|
1568
1677
|
z: coordinates.z
|
|
1569
1678
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
self.
|
|
1679
|
+
|
|
1680
|
+
// If legend is a child of the building/quarter
|
|
1681
|
+
if (self.data.legendsAsChildren) {
|
|
1682
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1683
|
+
entity.legend.setAttribute('visible', true);
|
|
1684
|
+
entity.appendChild(entity.legend)
|
|
1685
|
+
} else {
|
|
1686
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1687
|
+
entity.legend.setAttribute('visible', true);
|
|
1688
|
+
self.el.parentElement.appendChild(entity.legend);
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
|
|
1573
1692
|
}
|
|
1574
1693
|
|
|
1575
1694
|
// Higlight quarter
|
|
@@ -1578,7 +1697,6 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1578
1697
|
let oldPosition = entity.parentElement.getAttribute("position")
|
|
1579
1698
|
entity.parentElement.setAttribute('babiaxrFirstYPosition', oldPosition.y)
|
|
1580
1699
|
entity.parentElement.setAttribute("position", { x: oldPosition.x, y: oldPosition.y + 0.2, z: oldPosition.z })
|
|
1581
|
-
entity.parentElement.setAttribute('babiaxrFirstColor', entity.parentElement.getAttribute("material")["color"])
|
|
1582
1700
|
entity.parentElement.setAttribute('material', 'color', '#bfbfbf')
|
|
1583
1701
|
entity.parentElement.setAttribute('babiaxrHightlighted', 1)
|
|
1584
1702
|
} else {
|
|
@@ -1612,7 +1730,9 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1612
1730
|
entityGeometry = entity.getAttribute('geometry')
|
|
1613
1731
|
let boxPosition = entity.getAttribute('position')
|
|
1614
1732
|
entity.setAttribute('position', boxPosition)
|
|
1615
|
-
|
|
1733
|
+
// If the color is not a field, it is stored at "color"
|
|
1734
|
+
let firstColor = entity.getAttribute("material")["color"] !== "undefined" ? entity.getAttribute("material")["color"] : self.data.building_color;
|
|
1735
|
+
entity.setAttribute('babiaxrFirstColor', firstColor)
|
|
1616
1736
|
entity.setAttribute('material', {
|
|
1617
1737
|
'color': 'white'
|
|
1618
1738
|
});
|
|
@@ -1630,9 +1750,18 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1630
1750
|
y: height_real.max.y + 1 + self.data.height_building_legend,
|
|
1631
1751
|
z: coordinates.z
|
|
1632
1752
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
self.
|
|
1753
|
+
|
|
1754
|
+
// If legend is a child of the building/quarter
|
|
1755
|
+
if (self.data.legendsAsChildren) {
|
|
1756
|
+
entity.legend.setAttribute('position', { x: 0, y: self.data.legendsAsChildrenHeight, z: 0 })
|
|
1757
|
+
entity.legend.setAttribute('visible', true);
|
|
1758
|
+
entity.appendChild(entity.legend)
|
|
1759
|
+
} else {
|
|
1760
|
+
entity.legend.setAttribute('position', coordinatesFinal)
|
|
1761
|
+
entity.legend.setAttribute('visible', true);
|
|
1762
|
+
self.el.parentElement.appendChild(entity.legend);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1636
1765
|
|
|
1637
1766
|
// Hihglight by field
|
|
1638
1767
|
if (self.data.highlightBuildingByField) {
|
|
@@ -1660,7 +1789,12 @@ AFRAME.registerComponent('babia-boats', {
|
|
|
1660
1789
|
entity.setAttribute('material', {
|
|
1661
1790
|
'color': entity.getAttribute('babiaxrFirstColor')
|
|
1662
1791
|
});
|
|
1663
|
-
|
|
1792
|
+
// If legend is a child of the building/quarter
|
|
1793
|
+
if (self.data.legendsAsChildren) {
|
|
1794
|
+
entity.removeChild(entity.legend)
|
|
1795
|
+
} else {
|
|
1796
|
+
self.el.parentElement.removeChild(entity.legend)
|
|
1797
|
+
}
|
|
1664
1798
|
entity.legend = undefined
|
|
1665
1799
|
}
|
|
1666
1800
|
|