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
|
@@ -55,7 +55,7 @@ AFRAME.registerComponent('babia-ui', {
|
|
|
55
55
|
// Register to target component notiBuffer
|
|
56
56
|
if (this.targetComponent.notiBuffer) {
|
|
57
57
|
this.notiBufferId = this.targetComponent.notiBuffer
|
|
58
|
-
.register(this.
|
|
58
|
+
.register(this.updateInterface.bind(this))
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
|
|
@@ -66,10 +66,18 @@ AFRAME.registerComponent('babia-ui', {
|
|
|
66
66
|
dataQueriers: undefined,
|
|
67
67
|
handController: undefined,
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Only for babia-network
|
|
71
|
+
*/
|
|
72
|
+
nodesQueriers: undefined,
|
|
73
|
+
linksQueriers: undefined,
|
|
74
|
+
|
|
75
|
+
updateInterface: function(data) {
|
|
70
76
|
let self = this;
|
|
71
77
|
if(data){
|
|
72
|
-
|
|
78
|
+
// if (!self.targetComponent.el.components['babia-network']){
|
|
79
|
+
getDataMetrics(self,data, self.targetComponentVisProperties)
|
|
80
|
+
//}
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
while (self.el.firstChild)
|
|
@@ -99,23 +107,48 @@ AFRAME.registerComponent('babia-ui', {
|
|
|
99
107
|
},
|
|
100
108
|
|
|
101
109
|
findQuerierComponents: function() {
|
|
102
|
-
this.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
if (this.targetComponent.el.components['babia-network'] && (this.targetComponent.el.components['babia-network'].data.nodesFrom || this.targetComponent.el.components['babia-network'].data.nodes)){
|
|
111
|
+
console.log("nodesFrom or nodes")
|
|
112
|
+
this.nodesQueriers = [];
|
|
113
|
+
this.linksQueriers = [];
|
|
114
|
+
document.querySelectorAll('[babia-queryjson]').forEach(querier => {
|
|
115
|
+
// Skip querier data when the target visualizer has included filtered data too.
|
|
116
|
+
if (querier.id != this.data.target || ( querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')){
|
|
117
|
+
this.nodesQueriers.push(querier.id)
|
|
118
|
+
this.linksQueriers.push(querier.id)
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
document.querySelectorAll('[babia-queryes]').forEach(querier => {
|
|
122
|
+
this.nodesQueriers.push(querier.id)
|
|
123
|
+
this.linksQueriers.push(querier.id)
|
|
124
|
+
});
|
|
125
|
+
document.querySelectorAll('[babia-querygithub]').forEach(querier => {
|
|
126
|
+
this.nodesQueriers.push(querier.id)
|
|
127
|
+
this.linksQueriers.push(querier.id)
|
|
128
|
+
});
|
|
129
|
+
document.querySelectorAll('[babia-filter]').forEach(querier => {
|
|
130
|
+
this.nodesQueriers.push(querier.id)
|
|
131
|
+
this.linksQueriers.push(querier.id)
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
this.dataQueriers = []
|
|
135
|
+
// All queriers and filterdatas of the scene
|
|
136
|
+
document.querySelectorAll('[babia-queryjson]').forEach(querier => {
|
|
137
|
+
// Skip querier data when the target visualizer has included filtered data too.
|
|
138
|
+
if (querier.id != this.data.target || ( querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')){
|
|
139
|
+
this.dataQueriers.push(querier.id)
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
document.querySelectorAll('[babia-queryes]').forEach(querier => {
|
|
107
143
|
this.dataQueriers.push(querier.id)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
document.querySelectorAll('[babia-filter]').forEach(querier => {
|
|
117
|
-
this.dataQueriers.push(querier.id)
|
|
118
|
-
});
|
|
144
|
+
});
|
|
145
|
+
document.querySelectorAll('[babia-querygithub]').forEach(querier => {
|
|
146
|
+
this.dataQueriers.push(querier.id)
|
|
147
|
+
});
|
|
148
|
+
document.querySelectorAll('[babia-filter]').forEach(querier => {
|
|
149
|
+
this.dataQueriers.push(querier.id)
|
|
150
|
+
});
|
|
151
|
+
}
|
|
119
152
|
}
|
|
120
153
|
})
|
|
121
154
|
|
|
@@ -139,37 +172,106 @@ let insertInterfaceOnHand = (self, hand) => {
|
|
|
139
172
|
}
|
|
140
173
|
|
|
141
174
|
let getDataMetrics = (self, data, properties) =>{
|
|
142
|
-
self.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if(self.targetComponent.attrName == 'babia-city')
|
|
150
|
-
{
|
|
151
|
-
// Get last child of the tree
|
|
152
|
-
last_child = getLastChild(data)
|
|
153
|
-
} else if (self.targetComponent.attrName == 'babia-boats'){
|
|
154
|
-
last_child = getLastChild(data[0])
|
|
155
|
-
} else {
|
|
156
|
-
last_child = data[0]
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
Object.keys(last_child).forEach(metric => {
|
|
160
|
-
if (typeof last_child[metric] == 'number'){
|
|
161
|
-
number_metrics.push(metric)
|
|
175
|
+
if (self.targetComponent.attrName == 'babia-network') {
|
|
176
|
+
if (data.nodes){
|
|
177
|
+
self.dataMetrics={
|
|
178
|
+
'nodes': [],
|
|
179
|
+
'links': []
|
|
180
|
+
}
|
|
162
181
|
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
// Create structure
|
|
183
|
+
let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
|
|
184
|
+
let number_metrics = []
|
|
185
|
+
let last_child
|
|
186
|
+
|
|
187
|
+
last_child = getLastChild(data.nodes[0])
|
|
188
|
+
|
|
189
|
+
Object.keys(last_child).forEach(metric => {
|
|
190
|
+
if (typeof last_child[metric] == 'number'){
|
|
191
|
+
number_metrics.push(metric)
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
properties['nodes'].forEach(property => {
|
|
196
|
+
if (number_properties.includes(property)){
|
|
197
|
+
self.dataMetrics['nodes'].push({property: property, metrics: number_metrics})
|
|
198
|
+
} else {
|
|
199
|
+
self.dataMetrics['nodes'].push({property: property, metrics: Object.keys(data.nodes[0])})
|
|
200
|
+
}
|
|
201
|
+
});
|
|
165
202
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
203
|
+
properties['links1'].forEach(property => {
|
|
204
|
+
if (number_properties.includes(property)){
|
|
205
|
+
self.dataMetrics['links'].push({property: property, metrics: number_metrics})
|
|
206
|
+
} else {
|
|
207
|
+
self.dataMetrics['links'].push({property: property, metrics: Object.keys(data.links[0])})
|
|
208
|
+
}
|
|
209
|
+
});
|
|
169
210
|
} else {
|
|
170
|
-
self.dataMetrics
|
|
211
|
+
self.dataMetrics=[]
|
|
212
|
+
|
|
213
|
+
// Create structure
|
|
214
|
+
let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
|
|
215
|
+
let number_metrics = []
|
|
216
|
+
let last_child
|
|
217
|
+
|
|
218
|
+
last_child = getLastChild(data[0])
|
|
219
|
+
|
|
220
|
+
Object.keys(last_child).forEach(metric => {
|
|
221
|
+
if (typeof last_child[metric] == 'number'){
|
|
222
|
+
number_metrics.push(metric)
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
properties['nodes'].forEach(property => {
|
|
227
|
+
if (number_properties.includes(property)){
|
|
228
|
+
self.dataMetrics.push({property: property, metrics: number_metrics})
|
|
229
|
+
} else {
|
|
230
|
+
self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
properties['links0'].forEach(property => {
|
|
235
|
+
if (number_properties.includes(property)){
|
|
236
|
+
self.dataMetrics.push({property: property, metrics: number_metrics})
|
|
237
|
+
} else {
|
|
238
|
+
self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
} else {
|
|
244
|
+
self.dataMetrics=[]
|
|
245
|
+
|
|
246
|
+
// Create structure
|
|
247
|
+
let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
|
|
248
|
+
let number_metrics = []
|
|
249
|
+
let last_child
|
|
250
|
+
|
|
251
|
+
if(self.targetComponent.attrName == 'babia-city')
|
|
252
|
+
{
|
|
253
|
+
// Get last child of the tree
|
|
254
|
+
last_child = getLastChild(data)
|
|
255
|
+
} else if (self.targetComponent.attrName == 'babia-boats'){
|
|
256
|
+
last_child = getLastChild(data[0])
|
|
257
|
+
} else {
|
|
258
|
+
last_child = data[0]
|
|
171
259
|
}
|
|
172
|
-
|
|
260
|
+
|
|
261
|
+
Object.keys(last_child).forEach(metric => {
|
|
262
|
+
if (typeof last_child[metric] == 'number'){
|
|
263
|
+
number_metrics.push(metric)
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
properties.forEach(property => {
|
|
268
|
+
if (number_properties.includes(property)){
|
|
269
|
+
self.dataMetrics.push({property: property, metrics: number_metrics})
|
|
270
|
+
} else {
|
|
271
|
+
self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
173
275
|
}
|
|
174
276
|
|
|
175
277
|
let getLastChild = (data) =>{
|
|
@@ -189,36 +291,97 @@ let generateInterface = (self, metrics, parent) =>{
|
|
|
189
291
|
let posX = 0
|
|
190
292
|
let maxX = 0
|
|
191
293
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
294
|
+
if (self.targetComponent.el.components['babia-network'] && (self.targetComponent.el.components['babia-network'].data.nodesFrom || self.targetComponent.el.components['babia-network'].data.nodes)){
|
|
295
|
+
// Nodes files
|
|
296
|
+
if (self.nodesQueriers.length > 1) {
|
|
297
|
+
let button = createProperty("Nodes", posX, posY)
|
|
298
|
+
self.interface.appendChild(button)
|
|
299
|
+
self.nodesQueriers.forEach(data => {
|
|
300
|
+
posX += 3.25
|
|
301
|
+
let button = createDataSelect(self, data, posX, posY, 'nodes')
|
|
302
|
+
button.classList.add("babiaxraycasterclass")
|
|
303
|
+
self.interface.appendChild(button)
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
--posY
|
|
307
|
+
if(maxX < posX) { maxX = posX }
|
|
308
|
+
posX = 0
|
|
309
|
+
|
|
310
|
+
// Links files
|
|
311
|
+
if (self.linksQueriers.length > 1) {
|
|
312
|
+
let button = createProperty("Links", posX, posY)
|
|
313
|
+
self.interface.appendChild(button)
|
|
314
|
+
self.linksQueriers.forEach(data => {
|
|
315
|
+
posX += 3.25
|
|
316
|
+
let button = createDataSelect(self, data, posX, posY, 'links')
|
|
317
|
+
button.classList.add("babiaxraycasterclass")
|
|
318
|
+
self.interface.appendChild(button)
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
--posY
|
|
322
|
+
if(maxX < posX) { maxX = posX }
|
|
323
|
+
posX = 0
|
|
324
|
+
|
|
325
|
+
// Properties and metrics
|
|
326
|
+
metrics.nodes.forEach(property => {
|
|
327
|
+
let button = createProperty(property.property, posX, posY)
|
|
328
|
+
self.interface.appendChild(button)
|
|
329
|
+
property.metrics.forEach(metric => {
|
|
330
|
+
posX += 3.25
|
|
331
|
+
let button = createMetric(self, property.property, metric, posX, posY)
|
|
332
|
+
button.classList.add("babiaxraycasterclass")
|
|
333
|
+
self.interface.appendChild(button)
|
|
334
|
+
});
|
|
335
|
+
--posY
|
|
336
|
+
if(maxX < posX) { maxX = posX }
|
|
337
|
+
posX = 0
|
|
201
338
|
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
posX = 0
|
|
206
|
-
|
|
207
|
-
// Properties and metrics
|
|
208
|
-
metrics.forEach(property => {
|
|
209
|
-
let button = createProperty(property.property, posX, posY)
|
|
210
|
-
self.interface.appendChild(button)
|
|
211
|
-
property.metrics.forEach(metric => {
|
|
212
|
-
posX += 3.25
|
|
213
|
-
let button = createMetric(self, property.property, metric, posX, posY)
|
|
214
|
-
button.classList.add("babiaxraycasterclass")
|
|
339
|
+
|
|
340
|
+
metrics.links.forEach(property => {
|
|
341
|
+
let button = createProperty(property.property, posX, posY)
|
|
215
342
|
self.interface.appendChild(button)
|
|
343
|
+
property.metrics.forEach(metric => {
|
|
344
|
+
posX += 3.25
|
|
345
|
+
let button = createMetric(self, property.property, metric, posX, posY)
|
|
346
|
+
button.classList.add("babiaxraycasterclass")
|
|
347
|
+
self.interface.appendChild(button)
|
|
348
|
+
});
|
|
349
|
+
--posY
|
|
350
|
+
if(maxX < posX) { maxX = posX }
|
|
351
|
+
posX = 0
|
|
216
352
|
});
|
|
353
|
+
} else {
|
|
354
|
+
// Data files
|
|
355
|
+
if (self.dataQueriers.length > 1) {
|
|
356
|
+
let button = createProperty("Data", posX, posY)
|
|
357
|
+
self.interface.appendChild(button)
|
|
358
|
+
self.dataQueriers.forEach(data => {
|
|
359
|
+
posX += 3.25
|
|
360
|
+
let button = createDataSelect(self, data, posX, posY)
|
|
361
|
+
button.classList.add("babiaxraycasterclass")
|
|
362
|
+
self.interface.appendChild(button)
|
|
363
|
+
});
|
|
364
|
+
}
|
|
217
365
|
--posY
|
|
218
366
|
if(maxX < posX) { maxX = posX }
|
|
219
|
-
posX = 0
|
|
220
|
-
|
|
221
|
-
|
|
367
|
+
posX = 0
|
|
368
|
+
|
|
369
|
+
// Properties and metrics
|
|
370
|
+
metrics.forEach(property => {
|
|
371
|
+
let button = createProperty(property.property, posX, posY)
|
|
372
|
+
self.interface.appendChild(button)
|
|
373
|
+
property.metrics.forEach(metric => {
|
|
374
|
+
posX += 3.25
|
|
375
|
+
let button = createMetric(self, property.property, metric, posX, posY)
|
|
376
|
+
button.classList.add("babiaxraycasterclass")
|
|
377
|
+
self.interface.appendChild(button)
|
|
378
|
+
});
|
|
379
|
+
--posY
|
|
380
|
+
if(maxX < posX) { maxX = posX }
|
|
381
|
+
posX = 0
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
|
|
222
385
|
self.interface.width = maxX + 3;
|
|
223
386
|
self.interface.height = Math.abs(posY)
|
|
224
387
|
|
|
@@ -303,6 +466,10 @@ let selection_events = (entity, visualizer, isData) =>{
|
|
|
303
466
|
// Change selected querier in visualializer (from)
|
|
304
467
|
} else if (entity.from) {
|
|
305
468
|
visualizer.el.setAttribute(visualizer.attrName, "from", entity.from )
|
|
469
|
+
} else if (entity.nodes) {
|
|
470
|
+
visualizer.el.setAttribute(visualizer.attrName, 'nodesFrom', entity.nodes)
|
|
471
|
+
} else if (entity.links) {
|
|
472
|
+
visualizer.el.setAttribute(visualizer.attrName, 'linksFrom', entity.links)
|
|
306
473
|
}
|
|
307
474
|
});
|
|
308
475
|
}
|
|
@@ -323,9 +490,15 @@ let createProperty = (property, positionX, positionY) =>{
|
|
|
323
490
|
return entity
|
|
324
491
|
}
|
|
325
492
|
|
|
326
|
-
let createDataSelect = (self, id, positionX, positionY) =>{
|
|
493
|
+
let createDataSelect = (self, id, positionX, positionY, networkType) =>{
|
|
327
494
|
let entity = document.createElement('a-box')
|
|
328
|
-
|
|
495
|
+
if (networkType == 'nodes'){
|
|
496
|
+
entity.nodes = id
|
|
497
|
+
} else if (networkType == 'links'){
|
|
498
|
+
entity.links = id
|
|
499
|
+
} else {
|
|
500
|
+
entity.from = id;
|
|
501
|
+
}
|
|
329
502
|
entity.classList.add("babiaxraycasterclass")
|
|
330
503
|
entity.setAttribute('position', { x: positionX, y: positionY, z: 0})
|
|
331
504
|
entity.setAttribute('rotation', { x: 0, y: 0, z: 0 })
|
|
@@ -16,75 +16,6 @@ const colors = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
let dataReadyToSend = (propertyName, self) => {
|
|
21
|
-
self.interestedElements.forEach(element => {
|
|
22
|
-
dispatchEventOnElement(element, propertyName)
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
let dispatchEventOnElement = (element, propertyName) => {
|
|
27
|
-
element.emit("babiaVisualizerUpdated", propertyName)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let findDataComponent = (data, el, self) => {
|
|
31
|
-
let eventName = "babiaQuerierDataReady"
|
|
32
|
-
if (data.from) {
|
|
33
|
-
// Save the reference to the querier or filterdata
|
|
34
|
-
let dataElement = document.getElementById(data.from)
|
|
35
|
-
if (dataElement.components['babia-filter']) {
|
|
36
|
-
self.dataComponent = dataElement.components['babia-filter']
|
|
37
|
-
eventName = "babiaFilterDataReady"
|
|
38
|
-
} else if (dataElement.components['babia-queryjson']) {
|
|
39
|
-
self.dataComponent = dataElement.components['babia-queryjson']
|
|
40
|
-
} else if (dataElement.components['babia-queryes']) {
|
|
41
|
-
self.dataComponent = dataElement.components['babia-queryes']
|
|
42
|
-
} else if (dataElement.components['babia-querygithub']) {
|
|
43
|
-
self.dataComponent = dataElement.components['babia-querygithub']
|
|
44
|
-
} else if (dataElement.components['babia-selector']) {
|
|
45
|
-
self.dataComponent = dataElement.components['babia-selector'];
|
|
46
|
-
eventName = "babiaSelectorDataReady";
|
|
47
|
-
} else {
|
|
48
|
-
console.error("Problem registering to the querier", el);
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
// Look for a querier or filterdata in the same element and register
|
|
53
|
-
if (el.components['babia-filter']) {
|
|
54
|
-
self.dataComponent = el.components['babia-filter']
|
|
55
|
-
eventName = "babiaFilterDataReady"
|
|
56
|
-
} else if (el.components['babia-queryjson']) {
|
|
57
|
-
self.dataComponent = el.components['babia-queryjson']
|
|
58
|
-
} else if (el.components['babia-queryes']) {
|
|
59
|
-
self.dataComponent = el.components['babia-queryes']
|
|
60
|
-
} else if (el.components['babia-querygithub']) {
|
|
61
|
-
self.dataComponent = el.components['babia-querygithub']
|
|
62
|
-
} else if (el.components['babia-selector']) {
|
|
63
|
-
self.dataComponent = el.components['babia-selector'];
|
|
64
|
-
eventName = "babiaSelectorDataReady";
|
|
65
|
-
} else {
|
|
66
|
-
// Look for a querier or filterdata in the scene
|
|
67
|
-
if (document.querySelectorAll("[babia-filter]").length > 0) {
|
|
68
|
-
self.dataComponent = document.querySelectorAll("[babia-filter]")[0].components['babia-filter']
|
|
69
|
-
eventName = "babiaFilterDataReady"
|
|
70
|
-
} else if (document.querySelectorAll("[babia-queryjson]").length > 0) {
|
|
71
|
-
self.dataComponent = document.querySelectorAll("[babia-queryjson]")[0].components['babia-queryjson']
|
|
72
|
-
} else if (document.querySelectorAll("[babia-queryjson]").length > 0) {
|
|
73
|
-
self.dataComponent = document.querySelectorAll("[babia-queryes]")[0].components['babia-queryes']
|
|
74
|
-
} else if (document.querySelectorAll("[babia-querygithub]").length > 0) {
|
|
75
|
-
self.dataComponent = document.querySelectorAll("[babia-querygithub]")[0].components['babia-querygithub']
|
|
76
|
-
} else if (document.querySelectorAll('[babia-selector]').length > 0) {
|
|
77
|
-
self.dataComponent = document.querySelectorAll('[babia-selector]')[0].components['babia-selector'];
|
|
78
|
-
eventName = "babiaSelectorDataReady";
|
|
79
|
-
} else {
|
|
80
|
-
console.error("Error, querier not found", el, el.components, el.components['babia-selector']);
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return eventName
|
|
86
|
-
}
|
|
87
|
-
|
|
88
19
|
let findProdComponent = (data, el, selfProducer) => {
|
|
89
20
|
let prodComponent;
|
|
90
21
|
if (data.from) {
|
|
@@ -94,6 +25,8 @@ let findProdComponent = (data, el, selfProducer) => {
|
|
|
94
25
|
prodComponent = prodElement.components['babia-filter']
|
|
95
26
|
} else if (prodElement.components['babia-queryjson']) {
|
|
96
27
|
prodComponent = prodElement.components['babia-queryjson']
|
|
28
|
+
} else if (prodElement.components['babia-querycsv']) {
|
|
29
|
+
prodComponent = prodElement.components['babia-querycsv']
|
|
97
30
|
} else if (prodElement.components['babia-queryes']) {
|
|
98
31
|
prodComponent = prodElement.components['babia-queryes']
|
|
99
32
|
} else if (prodElement.components['babia-querygithub']) {
|
|
@@ -113,6 +46,8 @@ let findProdComponent = (data, el, selfProducer) => {
|
|
|
113
46
|
prodComponentNodes = prodElementNodes.components['babia-filter']
|
|
114
47
|
} else if (prodElementNodes.components['babia-queryjson']) {
|
|
115
48
|
prodComponentNodes = prodElementNodes.components['babia-queryjson']
|
|
49
|
+
} else if (prodElementNodes.components['babia-querycsv']) {
|
|
50
|
+
prodComponentNodes = prodElementNodes.components['babia-querycsv']
|
|
116
51
|
} else if (prodElementNodes.components['babia-queryes']) {
|
|
117
52
|
prodComponentNodes = prodElementNodes.components['babia-queryes']
|
|
118
53
|
} else if (prodElementNodes.components['babia-querygithub']) {
|
|
@@ -128,6 +63,8 @@ let findProdComponent = (data, el, selfProducer) => {
|
|
|
128
63
|
prodComponentLinks = prodElementLinks.components['babia-filter']
|
|
129
64
|
} else if (prodElementLinks.components['babia-queryjson']) {
|
|
130
65
|
prodComponentLinks = prodElementLinks.components['babia-queryjson']
|
|
66
|
+
} else if (prodElementLinks.components['babia-querycsv']) {
|
|
67
|
+
prodComponentLinks = prodElementLinks.components['babia-querycsv']
|
|
131
68
|
} else if (prodElementLinks.components['babia-queryes']) {
|
|
132
69
|
prodComponentLinks = prodElementLinks.components['babia-queryes']
|
|
133
70
|
} else if (prodElementLinks.components['babia-querygithub']) {
|
|
@@ -144,6 +81,8 @@ let findProdComponent = (data, el, selfProducer) => {
|
|
|
144
81
|
prodComponent = el.components['babia-filter']
|
|
145
82
|
} else if (el.components['babia-queryjson'] && selfProducer != 'babia-queryjson') {
|
|
146
83
|
prodComponent = el.components['babia-queryjson']
|
|
84
|
+
} else if (el.components['babia-querycsv'] && selfProducer != 'babia-querycsv') {
|
|
85
|
+
prodComponent = el.components['babia-querycsv']
|
|
147
86
|
} else if (el.components['babia-queryes'] && selfProducer != 'babia-queryes') {
|
|
148
87
|
prodComponent = el.components['babia-queryes']
|
|
149
88
|
} else if (el.components['babia-querygithub'] && selfProducer != 'babia-querygithub') {
|
|
@@ -158,7 +97,9 @@ let findProdComponent = (data, el, selfProducer) => {
|
|
|
158
97
|
prodComponent = document.querySelectorAll("[babia-filter]")[0].components['babia-filter']
|
|
159
98
|
} else if (document.querySelectorAll("[babia-queryjson]").length > 0) {
|
|
160
99
|
prodComponent = document.querySelectorAll("[babia-queryjson]")[0].components['babia-queryjson']
|
|
161
|
-
} else if (document.querySelectorAll("[babia-
|
|
100
|
+
} else if (document.querySelectorAll("[babia-querycsv]").length > 0) {
|
|
101
|
+
prodComponent = document.querySelectorAll("[babia-querycsv]")[0].components['babia-queryjson']
|
|
102
|
+
} else if (document.querySelectorAll("[babia-queryes]").length > 0) {
|
|
162
103
|
prodComponent = document.querySelectorAll("[babia-queryes]")[0].components['babia-queryes']
|
|
163
104
|
} else if (document.querySelectorAll("[babia-querygithub]").length > 0) {
|
|
164
105
|
prodComponent = document.querySelectorAll("[babia-querygithub]")[0].components['babia-querygithub']
|
|
@@ -226,6 +167,8 @@ let findTargetComponent = (data, self) => {
|
|
|
226
167
|
targetComponent = targetElement.components['babia-city']
|
|
227
168
|
} else if (targetElement.components['babia-boats']) {
|
|
228
169
|
targetComponent = targetElement.components['babia-boats']
|
|
170
|
+
} else if (targetElement.components['babia-network']){
|
|
171
|
+
targetComponent = targetElement.components['babia-network']
|
|
229
172
|
} else {
|
|
230
173
|
console.error("Visualizer not found.")
|
|
231
174
|
return
|
|
@@ -262,13 +205,57 @@ let parseJson = (json) => {
|
|
|
262
205
|
return object;
|
|
263
206
|
}
|
|
264
207
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
208
|
+
let updateFunction = (self, oldData) => {
|
|
209
|
+
let data = self.data;
|
|
210
|
+
let el = self.el;
|
|
211
|
+
|
|
212
|
+
if (el.components["babia-bars"] || el.components["babia-barsmap"] || el.components["babia-cyls"]){
|
|
213
|
+
if (!data.index){
|
|
214
|
+
data.index = data.x_axis;
|
|
215
|
+
}
|
|
216
|
+
self.animation = data.animation;
|
|
217
|
+
self.bar_array = [];
|
|
218
|
+
}
|
|
219
|
+
if (el.components["babia-boats"]){
|
|
220
|
+
if (!self.figures){
|
|
221
|
+
self.figures = [];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (data.data && oldData.data !== data.data) {
|
|
226
|
+
let _data = parseJson(data.data);
|
|
227
|
+
self.processData(_data);
|
|
228
|
+
} else if (data.from !== oldData.from) {
|
|
229
|
+
if (self.slice_array) {
|
|
230
|
+
self.slice_array = [];
|
|
231
|
+
}
|
|
232
|
+
// Unregister from old producer
|
|
233
|
+
if (self.prodComponent) {
|
|
234
|
+
self.prodComponent.notiBuffer.unregister(self.notiBufferId);
|
|
235
|
+
};
|
|
236
|
+
self.prodComponent = findProdComponent (data, el);
|
|
237
|
+
if (self.prodComponent.notiBuffer) {
|
|
238
|
+
self.notiBufferId = self.prodComponent.notiBuffer
|
|
239
|
+
.register(self.processData.bind(self));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// If changed whatever, re-print with the current data
|
|
243
|
+
else if (data !== oldData && self.newData) {
|
|
244
|
+
if (self.slice_array){
|
|
245
|
+
self.slice_array = [];
|
|
246
|
+
}
|
|
247
|
+
if (self.bar_array){
|
|
248
|
+
self.bar_array = [];
|
|
249
|
+
}
|
|
250
|
+
self.processData(self.newData);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
268
254
|
module.exports.findProdComponent = findProdComponent;
|
|
269
255
|
module.exports.findNavComponent = findNavComponent;
|
|
270
256
|
module.exports.findTargetComponent = findTargetComponent;
|
|
271
257
|
module.exports.colors = colors;
|
|
272
258
|
module.exports.updateTitle = updateTitle;
|
|
273
259
|
module.exports.parseJson = parseJson;
|
|
260
|
+
module.exports.updateFunction = updateFunction;
|
|
274
261
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
let parseCSV = require('papaparse').parse;
|
|
2
|
+
|
|
3
|
+
/* global AFRAME */
|
|
4
|
+
if (typeof AFRAME === 'undefined') {
|
|
5
|
+
throw new Error('Component attempted to register before AFRAME was available.');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Babia QueryCSV component for A-Frame.
|
|
12
|
+
*/
|
|
13
|
+
AFRAME.registerComponent('babia-querycsv', {
|
|
14
|
+
schema: {
|
|
15
|
+
url: { type: 'string' },
|
|
16
|
+
// data, for debugging, highest priority
|
|
17
|
+
data: { type: 'string' }
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Set if component needs multiple instancing.
|
|
22
|
+
*/
|
|
23
|
+
multiple: false,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Called once when component is attached. Generally for initial setup.
|
|
27
|
+
*/
|
|
28
|
+
init: function () {
|
|
29
|
+
// Buffer for setting the data obtained and notifying consumers
|
|
30
|
+
this.notiBuffer = new NotiBuffer();
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Called when component is attached and when component data changes.
|
|
35
|
+
* Generally modifies the entity based on the data.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
update: function (oldData) {
|
|
39
|
+
let data = this.data;
|
|
40
|
+
|
|
41
|
+
// Highest priority to data
|
|
42
|
+
if (data.data && oldData.data !== data.data) {
|
|
43
|
+
let _data = parseCSV(data.data, {
|
|
44
|
+
header: true, dynamicTyping: true,
|
|
45
|
+
skipEmptyLines: true
|
|
46
|
+
});
|
|
47
|
+
this.notiBuffer.set(_data['data']);
|
|
48
|
+
} else if (oldData.url !== data.url) {
|
|
49
|
+
this.getCSV(data.url);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Called when a component is removed (e.g., via removeAttribute).
|
|
54
|
+
* Generally undoes all modifications to the entity.
|
|
55
|
+
*/
|
|
56
|
+
remove: function () { },
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Called on each scene tick.
|
|
60
|
+
*/
|
|
61
|
+
// tick: function (t) { },
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Called when entity pauses.
|
|
65
|
+
* Use to stop or remove any dynamic or background behavior such as events.
|
|
66
|
+
*/
|
|
67
|
+
pause: function () { },
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Called when entity resumes.
|
|
71
|
+
* Use to continue or add any dynamic or background behavior such as events.
|
|
72
|
+
*/
|
|
73
|
+
play: function () { },
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* Asynchronous function to get a JSON document.
|
|
77
|
+
* Returns a promise that resolves to the object corresponding to the
|
|
78
|
+
* retrieved JSON document, or to undefined, if some error happened.
|
|
79
|
+
* It is non blocking, since it gives a promise. No value has to be
|
|
80
|
+
* obtained once fulfilled and all the synchronous code is inside the
|
|
81
|
+
* function (two awaits that block the code until promises are fulfilled)
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
getCSV: async function(url) {
|
|
85
|
+
let notiBuffer = this.notiBuffer
|
|
86
|
+
parseCSV(url, {
|
|
87
|
+
download: true, header: true, skipEmptyLines: true,
|
|
88
|
+
dynamicTyping: true,
|
|
89
|
+
complete: function(response) {
|
|
90
|
+
notiBuffer.set(response['data']);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
},// TODO: Try-catch to get and print errors outside
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
})
|