mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Prepared the adapter to support NodeReducer as a worker
This commit is contained in:
parent
630712c017
commit
bf01f6b8a0
|
@ -289,6 +289,17 @@ function AbstractAdapter(nodes, edges) {
|
||||||
nodes.push(commNode);
|
nodes.push(commNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
requestCollapse = function (focus) {
|
||||||
|
var com = reducer.getCommunity(limit, focus);
|
||||||
|
collapseCommunity(com);
|
||||||
|
},
|
||||||
|
|
||||||
|
checkNodeLimit = function (focus) {
|
||||||
|
if (limit < nodes.length) {
|
||||||
|
requestCollapse(focus);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
expandCommunity = function (commNode) {
|
expandCommunity = function (commNode) {
|
||||||
var commId = commNode._id,
|
var commId = commNode._id,
|
||||||
nodesToAdd = cachedCommunities[commId].nodes,
|
nodesToAdd = cachedCommunities[commId].nodes,
|
||||||
|
@ -296,8 +307,7 @@ function AbstractAdapter(nodes, edges) {
|
||||||
com;
|
com;
|
||||||
removeNode(commNode);
|
removeNode(commNode);
|
||||||
if (limit < nodes.length + nodesToAdd.length) {
|
if (limit < nodes.length + nodesToAdd.length) {
|
||||||
com = reducer.getCommunity(limit);
|
requestCollapse();
|
||||||
collapseCommunity(com);
|
|
||||||
}
|
}
|
||||||
_.each(nodesToAdd, function(n) {
|
_.each(nodesToAdd, function(n) {
|
||||||
delete joinedInCommunities[n._id];
|
delete joinedInCommunities[n._id];
|
||||||
|
@ -336,21 +346,11 @@ function AbstractAdapter(nodes, edges) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
checkNodeLimit = function (focus) {
|
|
||||||
if (limit < nodes.length) {
|
|
||||||
var com = reducer.getCommunity(limit, focus);
|
|
||||||
collapseCommunity(com);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
setNodeLimit = function (pLimit, callback) {
|
setNodeLimit = function (pLimit, callback) {
|
||||||
limit = pLimit;
|
limit = pLimit;
|
||||||
if (limit < nodes.length) {
|
checkNodeLimit();
|
||||||
var com = reducer.getCommunity(limit);
|
if (callback !== undefined) {
|
||||||
collapseCommunity(com);
|
callback();
|
||||||
if (callback !== undefined) {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue