Commit 6da0e3d1 authored by Fintan Mc Gee's avatar Fintan Mc Gee

fixed issue where grpah structure was not being copied for layout

parent b82be5ff
......@@ -367,7 +367,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
********************************/
g.cleanNodeData = function () {
var attrib = undefined;
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
// following code fixes an issue where is not possible
// to send an apostrophe "'" to the R backend
// so they are removed from any attributes
......@@ -400,10 +400,10 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
newNodes.push({id: n.id});
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
});
return new MultiLayerGraph(newNodes, newLinks);
......@@ -422,7 +422,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
newNodes.push({id: n.id});
nodeAttributes.forEach(function(attribName){
if(n.hasOwnProperty(attribName)) {
......@@ -430,7 +430,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
}
});
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
edgeAttributes.forEach(function(attribName){
if(l.hasOwnProperty(attribName)) {
......@@ -454,13 +454,13 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
var nodeIndex = newNodes.push({id: n.id});
newNodes[nodeIndex-1].x = n.x;
newNodes[nodeIndex-1].y = n.y;
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
});
return new MultiLayerGraph(newNodes, newLinks);
......@@ -599,8 +599,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
return updatedNodeCount;
};
if (nodes === undefined) {
nodes = [];
if (g.nodes === undefined) {
g.nodes = [];
}
if (links === undefined) {
links = [];
......@@ -2915,6 +2915,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
targetLayer.links = targetLayer.links.filter(projectionEdgesfilter);
g.links = g.links.filter(projectionEdgesfilter);
g.buildLinkLookUp();
g.buildAdjacencyList();
targetLayer.nodes.forEach(function(n) {
var nodeID = n.uid;
......@@ -3013,8 +3015,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
// nee to add to master grpah and then copy it to child
if(!g.link[nLink.uid]) {
g.links.push(nLink);
targetLayer.copyEdgeToLayer(nLink);
//targetLayer.links.push(nLink);
//targetLayer.copyEdgeToLayer(nLink);
targetLayer.links.push(nLink);
}
});
g.buildLinkLookUp();
......
......@@ -535,10 +535,10 @@ angular.module('blizaarModule.services')
var layerNames = multiLayerGraphService.getLayerNames();
this.updateDHTemporalData();
multiLayerGraphService.getGraph().projectNodesInLayer("locations",["resource"],null,"proj_edge_resource" );
multiLayerGraphService.getGraph().projectNodesInLayer("organizations",["resource"],null,"proj_edge_resource" );
dataService.updateLayerOnServer("projectNodesInLayer","locations",["resource"],null,null,null,"proj_edge_resource" );
dataService.updateLayerOnServer("projectNodesInLayer","organizations",["resource"],null,null,null,"proj_edge_resource" )
multiLayerGraphService.getGraph().projectNodesInLayer("locations",["resource"],null,"proj_edge_loc_resource" );
multiLayerGraphService.getGraph().projectNodesInLayer("organizations",["resource"],null,"proj_edge_org_resource" );
dataService.updateLayerOnServer("projectNodesInLayer","locations",["resource"],null,null,null,"proj_edge_loc_resource" );
dataService.updateLayerOnServer("projectNodesInLayer","organizations",["resource"],null,null,null,"proj_edge_org_resource" )
// storing layer types as an entitiy
if(multiLayerGraphService.getGraph().aspects.hasOwnProperty("EntityType")) {
......
......@@ -389,7 +389,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
********************************/
g.cleanNodeData = function () {
var attrib = undefined;
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
// following code fixes an issue where is not possible
// to send an apostrophe "'" to the R backend
// so they are removed from any attributes
......@@ -422,10 +422,10 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
newNodes.push({id: n.id});
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
});
return new MultiLayerGraph(newNodes, newLinks);
......@@ -444,7 +444,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
newNodes.push({id: n.id});
nodeAttributes.forEach(function(attribName){
if(n.hasOwnProperty(attribName)) {
......@@ -452,7 +452,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
}
});
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
edgeAttributes.forEach(function(attribName){
if(l.hasOwnProperty(attribName)) {
......@@ -476,13 +476,13 @@ var MultiLayerGraph = function (nodes, links, layerName) {
var newNodes = [],
newLinks = [];
nodes.forEach(function (n) {
g.nodes.forEach(function (n) {
var nodeIndex = newNodes.push({id: n.id});
newNodes[nodeIndex-1].x = n.x;
newNodes[nodeIndex-1].y = n.y;
});
links.forEach(function (l) {
g.links.forEach(function (l) {
newLinks.push({id: l.id, source: l.source, target: l.target});
});
return new MultiLayerGraph(newNodes, newLinks);
......@@ -621,8 +621,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
return updatedNodeCount;
};
if (nodes === undefined) {
nodes = [];
if (g.nodes === undefined) {
g.nodes = [];
}
if (links === undefined) {
links = [];
......@@ -1449,7 +1449,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
g.aspectCombinations.forEach(function (layer) {
if (layer.name === layerName) {
foundLayer = layer;
console.log("getLayerByName found the specified layer in a combination: " + layerName );
// console.log("getLayerByName found the specified layer in a combination: " + layerName );
}
});
}
......@@ -2937,6 +2937,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
targetLayer.links = targetLayer.links.filter(projectionEdgesfilter);
g.links = g.links.filter(projectionEdgesfilter);
g.buildLinkLookUp();
g.buildAdjacencyList();
targetLayer.nodes.forEach(function(n) {
var nodeID = n.uid;
......@@ -3035,8 +3037,8 @@ var MultiLayerGraph = function (nodes, links, layerName) {
// nee to add to master grpah and then copy it to child
if(!g.link[nLink.uid]) {
g.links.push(nLink);
targetLayer.copyEdgeToLayer(nLink);
//targetLayer.links.push(nLink);
//targetLayer.copyEdgeToLayer(nLink);
targetLayer.links.push(nLink);
}
});
g.buildLinkLookUp();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment