Commit b6fa39c9 authored by Amina Taoui's avatar Amina Taoui

work curved link

parent a209d93d
......@@ -881,7 +881,22 @@ metExploreD3.GraphLink = {
return node.getBiologicalType()=="reaction";
});
var nodeAbs= d3.select("#" + panel).select("#D3viz").select("#graphComponent")
.selectAll("path.link.abstraction")
.filter(function (link) {
return link
}
console.log(nodeAbs);
var links = d3.select("#"+panel).select("#D3viz").select("#graphComponent").selectAll("path.link");
var a = links.filter(function (l) {
return l.abstraction === "abstraction";
});
console.log(a);
// Create arrowhead marker
d3.select("#"+panel).select("#D3viz").select("#graphComponent").append("defs").append("marker")
.attr("id", "markerExit")
......@@ -908,10 +923,14 @@ metExploreD3.GraphLink = {
var enteringLinks = links.filter(function (link) {
return node.id==link.getTarget();
});
var exitingLinks = links.filter(function (link) {
return node.id==link.getSource();
});
// Check if some links are part of a cycle and return the midsection of the arc instead of the centroid if this is the case
var centroidSourceX = 0;
var centroidSourceY = 0;
......@@ -921,9 +940,7 @@ metExploreD3.GraphLink = {
var enteringArcLink; // The entering link that is part of a cycle
var exitingArcLink; // The exiting link that is part of a cycle
enteringLinks.each(function (link) {
if(link.abstraction==="abstraction"){
//console.log('en',link);
}
if (link.partOfCycle === true){
isCycleReaction = true;
enteringArcLink = link;
......@@ -935,9 +952,7 @@ metExploreD3.GraphLink = {
}
});
exitingLinks.each(function (link) {
if(link.abstraction==="abstraction"){
}
if (link.partOfCycle === true){
isCycleReaction = true;
exitingArcLink = link;
......@@ -952,13 +967,15 @@ metExploreD3.GraphLink = {
// For each node, compute the centroid of the source nodes of the arcs entering that node and the centroid of the target nodes of the arc exiting that node;
if (isCycleReaction === false) {
var resultComputeCentroid = metExploreD3.GraphLink.computeCentroid(node, enteringLinks, exitingLinks);
centroidSourceX = resultComputeCentroid[0];
centroidSourceY = resultComputeCentroid[1];
centroidTargetX = resultComputeCentroid[2];
centroidTargetY = resultComputeCentroid[3];
}
if (isCycleReaction === false) {
var resultComputeCentroid = metExploreD3.GraphLink.computeCentroid(node, enteringLinks, exitingLinks);
centroidSourceX = resultComputeCentroid[0];
centroidSourceY = resultComputeCentroid[1];
centroidTargetX = resultComputeCentroid[2];
centroidTargetY = resultComputeCentroid[3];
}
// For each node, compare the difference between the x-coordinates of the 2 centroids and the difference between their y-coordinates
// to determine if the axis of the reaction should be horizontal or vertical
......@@ -1009,6 +1026,7 @@ metExploreD3.GraphLink = {
path = metExploreD3.GraphLink.computePathVertical(node, enteringX, enteringY, link.getSource());
axe="vertical";
}
d3.select(this).attr("d", path)
.attr("fill", "none")
.classed("horizontal", false)
......@@ -1049,16 +1067,13 @@ metExploreD3.GraphLink = {
axe="vertical";
}
if(link.abstraction==="abstraction"){
//console.log('d3',link);
}
d3.select(this).attr("d", path)
.attr("fill", "none")
.classed("horizontal", false)
.classed("vertical", false)
.classed(axe, true)
.style("opacity", 1);
})
.attr("marker-end", "url(#markerExit)")
.filter(function (link) {
......@@ -1405,6 +1420,9 @@ metExploreD3.GraphLink = {
var sourceY = 0;
var countEnter = 0;
enteringLinks.each(function (link) {
if(link.abstraction==="abstraction"){
console.log(link);
}
countEnter += 1;
sourceX += link.getSource().x;
sourceY += link.getSource().y;
......@@ -1417,6 +1435,9 @@ metExploreD3.GraphLink = {
var targetY = 0;
var countExit = 0;
exitingLinks.each(function (link) {
if(link.abstraction==="abstraction"){
console.log('ex');
}
countExit += 1;
targetX += link.getTarget().x;
targetY += link.getTarget().y;
......
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