rbbt-rest 1.7.3 → 1.7.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83b8b9094b9af4834099ecf4ccd86eef7b611a8e
4
- data.tar.gz: 3b66884ff196078ceb9e743cc3904b60baa74794
3
+ metadata.gz: 3e32a4a45d5c65372bcff90ae63db4b250730ca8
4
+ data.tar.gz: 1c873c7eb56e5e967a68c3386f16b02697c7e242
5
5
  SHA512:
6
- metadata.gz: a97a9160d62382ae1e786a2f63e261da90b484d16367eeb7322721611e7d4d9c76c6555fad0ec959a8c64e5ae4ae95b2ef82673d3252f388c75c8c14585e7cad
7
- data.tar.gz: 698cd1bae789d6f3ebb4126889961e02c319f66f3721045fef3af97c1a25e00c9cad03ce789278ffa9c5408c1eefb4036468e2f6c5228e1da7ac024076186d0d
6
+ metadata.gz: 8f62834e429bbdd1c810ea528430bf7e8944ab36ade62a955b3c1fbe2283d73190533d871a6cded7dc91388f79706add90200a6d23ef6970596d5356e67da6da
7
+ data.tar.gz: f470da72a984ee094dc899c8f9943117b008661702985c379ec2fec11e6ccf964d0b6d9a5f37af555172fc7d4f3c8b41c1b3f6a8da1aafdd90129ab245215409
@@ -277,6 +277,83 @@ rbbt.plots.d3js_graph = function(graph, object){
277
277
  }
278
278
 
279
279
  //{{{{ GROUP GRAPH
280
+
281
+
282
+ rbbt.plots.make_groups = function(graph, nodes, rbbt_groups){
283
+ var groups = []
284
+ var group_indices = {}
285
+ var node_indices = {}
286
+ var index
287
+ var used_nodes = []
288
+ var links = graph.links
289
+
290
+ index = 0
291
+ forArray(nodes, function(node){
292
+ node_indices[node.id] = index
293
+ index = index + 1
294
+ })
295
+
296
+ index = 0
297
+ forHash(rbbt_groups, function(term, info){
298
+ var children = info.items
299
+ group_indices[term] = index
300
+ index = index + 1
301
+ })
302
+
303
+ var new_links = []
304
+ forHash(rbbt_groups, function(term, info){
305
+ var children = info.items
306
+ var index = group_indices[term]
307
+ var leaves = new Array
308
+ var subgroups = new Array
309
+ forArray(children, function(subterm){
310
+ if (undefined === group_indices[subterm]){
311
+ var node_index = node_indices[subterm]
312
+ if (used_nodes[node_index]){
313
+ var new_index = nodes.length
314
+ var node = nodes[node_index]
315
+ nodes[new_index] = $.extend({},node)
316
+ leaves.push(new_index)
317
+ forArray(used_nodes[node_index], function(prev_index){
318
+ new_links.push({source: prev_index, target: new_index, type: 'move'})
319
+ })
320
+ used_nodes[new_index] = used_nodes[node_index]
321
+ used_nodes[new_index].push(new_index)
322
+ }else{
323
+ leaves.push(node_index)
324
+ used_nodes[node_index] = [node_index]
325
+ }
326
+ }else{
327
+ subgroups.push(group_indices[subterm])
328
+ }
329
+ forArray(links, function(l){
330
+ var orig_source=l.source
331
+ var orig_target=l.target
332
+ var sources = used_nodes[orig_source]
333
+ var targets = used_nodes[orig_target]
334
+ forArray(sources, function(source){
335
+ forArray(targets, function(target){
336
+ if (leaves.indexOf(source) > 0 && leaves.indexOf(target) > 0){
337
+ var new_link = merge_hash({},l)
338
+ new_link.source = source
339
+ new_link.target = target
340
+ new_links.push(new_link)
341
+ }
342
+ })
343
+ })
344
+ })
345
+ })
346
+ group_info = {leaves: leaves, groups: subgroups, name: info.name, id: info.id}
347
+ groups[index] = group_info
348
+ })
349
+
350
+ graph.groups = groups
351
+ graph.links = new_links
352
+
353
+ return graph
354
+ }
355
+
356
+
280
357
  rbbt.plots.d3js_group_graph = function(graph, object){
281
358
  var xsize = 300, ysize = 200, pad = 20
282
359
  var width = 1200
@@ -329,6 +406,12 @@ rbbt.plots.d3js_group_graph = function(graph, object){
329
406
  }
330
407
  })
331
408
 
409
+ force.on('end', function() {
410
+ d3cola.prepareEdgeRouting(margin / 3);
411
+ link.attr("d", function (d) { return lineFunction(d3cola.routeEdge(d)); });
412
+ if (isIE()) link.each(function (d) { this.parentNode.insertBefore(this, this) });
413
+ })
414
+
332
415
  var group = svg.selectAll(".group")
333
416
  .data(graph.groups)
334
417
  .enter().append("rect")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-09 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake