Skip to content
Browse files

Merge branch 'master' of github.com:mattgu74/sigma.js

  • Loading branch information...
2 parents ca64593 + 8331c7e commit 42ba9d328ce9462ceecf4b695bd910df541dd7f0 @mattgu74 mattgu74 committed Apr 2, 2012
Showing with 30 additions and 7 deletions.
  1. +1 −1 TODO.txt
  2. +14 −2 plugins/sigma.parseGexf.js
  3. +10 −1 src/core/graph.js
  4. +5 −3 src/core/plotter.js
View
2 TODO.txt
@@ -18,5 +18,5 @@
**** Others ****
- Implement multitouch features - Next version
- Change the code such as it is possible
- to use the MINIDY_ADVANCED Closure
+ to use the MINIFY_ADVANCED Closure
option.
View
16 plugins/sigma.parseGexf.js
@@ -131,12 +131,24 @@ sigma.publicPrototype.parseGexf = function(gexfPath) {
var source = edgeNode.getAttribute('source');
var target = edgeNode.getAttribute('target');
var label = edgeNode.getAttribute('label');
- var edge = {id:j, sourceID:source, targetID:target,label:label, attributes:[]};
+ var edge = {
+ id: j,
+ sourceID: source,
+ targetID: target,
+ label: label,
+ attributes: []
+ };
+
+ var weight = edgeNode.getAttribute('weight');
+ if(weight!=undefined){
+ edge['weight'] = weight;
+ }
+
var attvalueNodes = edgeNode.getElementsByTagName('attvalue');
for(k=0; k<attvalueNodes.length; k++){
var attvalueNode = attvalueNodes[k];
var attr = attvalueNode.getAttribute('for');
- var al = attvalueNode.getAttribute('value');
+ var val = attvalueNode.getAttribute('value');
edge.attributes.push({attr:attr, val:val});
}
View
11 src/core/graph.js
@@ -247,6 +247,7 @@ function Graph() {
'displaySize': 0.5,
'label': id.toString(),
'id': id.toString(),
+ 'hidden': false,
'attr': {}
};
@@ -261,7 +262,11 @@ function Graph() {
case 'source':
case 'target':
break;
+ case 'hidden':
+ e[k] = !!params[k];
+ break;
case 'size':
+ case 'weight':
e[k] = +params[k];
break;
case 'color':
@@ -299,6 +304,7 @@ function Graph() {
'weight': edge['weight'],
'displaySize': edge['displaySize'],
'label': edge['label'],
+ 'hidden': edge['hidden'],
'id': edge['id'],
'attr': edge['attr'],
'color': edge['color']
@@ -318,16 +324,19 @@ function Graph() {
for (var k in copy) {
switch (k) {
case 'id':
- case 'weight':
case 'displaySize':
break;
+ case 'weight':
case 'size':
edge[k] = +copy[k];
break;
case 'source':
case 'target':
edge[k] = self.nodesIndex[k] || edge[k];
break;
+ case 'hidden':
+ edge[k] = !!copy[k];
+ break;
case 'color':
case 'label':
case 'type':
View
8 src/core/plotter.js
@@ -207,9 +207,11 @@ function Plotter(nodesCtx, edgesCtx, labelsCtx, hoverCtx, graph, w, h) {
var s, t, i = 0;
while (i++< self.p.edgesSpeed && self.currentEdgeIndex < c) {
- s = graph.edges[self.currentEdgeIndex]['source'];
- t = graph.edges[self.currentEdgeIndex]['target'];
- if (s['hidden'] ||
+ e = graph.edges[self.currentEdgeIndex];
+ s = e['source'];
+ t = e['target'];
+ if (e['hidden'] ||
+ s['hidden'] ||
t['hidden'] ||
(!self.isOnScreen(s) && !self.isOnScreen(t))) {
self.currentEdgeIndex++;

0 comments on commit 42ba9d3

Please sign in to comment.
Something went wrong with that request. Please try again.