From 3ceb3a7a6f44fa20bccba474f78cd2d3e7e2dbd2 Mon Sep 17 00:00:00 2001
From: baigner <benedikt.aigner@rwth-aachen.de>
Date: Wed, 16 May 2018 13:48:56 +0200
Subject: [PATCH] ...now it also works for VISTOMS_Static.html

Former-commit-id: 27ce4eec738da994dc6e4e9a858c8b04765c20cf
---
 kadmos/vistoms/templates/VISTOMS_Static.html | 287 +++++++++----------
 1 file changed, 133 insertions(+), 154 deletions(-)

diff --git a/kadmos/vistoms/templates/VISTOMS_Static.html b/kadmos/vistoms/templates/VISTOMS_Static.html
index 858822d3d..b3e1d6879 100644
--- a/kadmos/vistoms/templates/VISTOMS_Static.html
+++ b/kadmos/vistoms/templates/VISTOMS_Static.html
@@ -19962,71 +19962,67 @@
 			{				
 
 				//Highlight function, that shows usage of a node in the XDSM
-				function highlight(data,aText)
+				function highlight(data)
 				{
-					aText = "/"+data.data.name+aText;
-					if (data.parent){highlight(data.parent,aText)}
-					else
-					{
-						scenarioKeys.forEach(function(k)
-						{
-							var xdsm_tmp;
-							xdsm_tmp = xdsms[k];
-							if (xdsm_tmp)
-							{
-								xdsm_tmp.svg.selectAll(".edge").each(function(p) 
-								{
-									var firstElement_tmp = p.name.split("/")[1]
-									var text_fromFirst = "/"+firstElement_tmp+aText.split(firstElement_tmp)[1]
-									if (include(p.name,text_fromFirst))
-									{
-										var highlightEdge = d3.select(this).select("polygon");
-										highlightEdge
-											.style("stroke-width",5.)
-											.style("stroke","#CC0000")
-										d3.selectAll(".treeFrame")
-											.attr("fill-opacity", 0.5)
-											.attr("stroke-opacity", 0.5);
-										d3.selectAll(".nodeText").style("fill-opacity",0.5);
-									}
-								})
-							}
-						})
-					}
+					var xPath = data.data.xPath;
+					
+                    scenarioKeys.forEach(function(k)
+                    {
+                        var xdsm_tmp;
+                        xdsm_tmp = xdsms[k];
+                        if (xdsm_tmp)
+                        {
+                            xdsm_tmp.svg.selectAll(".edge").each(function(p) 
+                            {
+                                var firstElement_tmp = p.name.split("/")[1]
+                                var text_fromFirst = "/"+firstElement_tmp+xPath.split(firstElement_tmp)[1]
+                                if (include(p.name,text_fromFirst))
+                                {
+                                    var highlightEdge = d3.select(this).select("polygon");
+                                    highlightEdge
+                                        .style("stroke-width",5.)
+                                        .style("stroke","#CC0000")
+                                    d3.selectAll(".treeFrame")
+                                        .attr("fill-opacity", 0.5)
+                                        .attr("stroke-opacity", 0.5);
+                                    d3.selectAll(".nodeText").style("fill-opacity",0.5);
+                                }
+                            })
+                        }
+                    })
+					
 				}
 				
 				//Unhighlight function again
-				function unhighlight(data,aText)
+				function unhighlight(data)
 				{
-					aText = "/"+data.data.name+aText;
-					if (data.parent){unhighlight(data.parent,aText)}
-					else
-					{
-						scenarioKeys.forEach(function(k)
-						{
-							var xdsm_tmp;
-							xdsm_tmp = xdsms[k];
-							if (xdsm_tmp)
-							{
-								xdsm_tmp.svg.selectAll(".edge").each(function(p) 
-								{
-									var firstElement_tmp = p.name.split("/")[1]
-									var text_fromFirst = "/"+firstElement_tmp+aText.split(firstElement_tmp)[1]
-									if (include(p.name,text_fromFirst))
-									{
-										var highlightEdge = d3.select(this).select("polygon");
-										highlightEdge
-											.style("stroke-width",1.)
-											.style("stroke","black");
-										d3.selectAll(".treeFrame")
-											.attr("fill-opacity", 0.8)
-											.attr("stroke-opacity", 0.8);
-										d3.selectAll(".nodeText").style("fill-opacity",1);
-									}
-								})
-							}
-						})
-					}
+					var xPath = data.data.xPath;
+					
+                    scenarioKeys.forEach(function(k)
+                    {
+                        var xdsm_tmp;
+                        xdsm_tmp = xdsms[k];
+                        if (xdsm_tmp)
+                        {
+                            xdsm_tmp.svg.selectAll(".edge").each(function(p) 
+                            {
+                                var firstElement_tmp = p.name.split("/")[1]
+                                var text_fromFirst = "/"+firstElement_tmp+xPath.split(firstElement_tmp)[1]
+                                if (include(p.name,text_fromFirst))
+                                {
+                                    var highlightEdge = d3.select(this).select("polygon");
+                                    highlightEdge
+                                        .style("stroke-width",1.)
+                                        .style("stroke","black");
+                                    d3.selectAll(".treeFrame")
+                                        .attr("fill-opacity", 0.8)
+                                        .attr("stroke-opacity", 0.8);
+                                    d3.selectAll(".nodeText").style("fill-opacity",1);
+                                }
+                            })
+                        }
+                    })
+					
 				}							
 				  
 				
@@ -20087,12 +20083,10 @@
 				{
 					title: 'Show usage of node in XDSM',
 					onMouseDown: function(elm, d, i) {
-						var theText="";
-						highlight(d,theText);
+						highlight(d);
 					},
 					onMouseUp: function(elm, d, i) {
-						var theText="";
-						unhighlight(d,theText);
+						unhighlight(d);
 					},
 					onMouseOver: function(elm, d, i) {
 					},
@@ -21777,57 +21771,53 @@
 				var classes = currentGraph.edgeBundles;
 				
 				//Highlight function, that shows usage of a node in the XDSM
-                function highlight(data,aText)
+                function highlight(data)
                 {
-                    aText = "/"+data.name+aText;
-                    if (data.parent){highlight(data.parent,aText)}
-                    else
+                    var xPath = data.xPath
+                    var allLinks = d3.selectAll(".edgeBundlesLink");
+                    allLinks[0].forEach(function(aLink)
                     {
-                        var allLinks = d3.selectAll(".edgeBundlesLink");
-                        allLinks[0].forEach(function(aLink)
+                        
+                        aLink.__data__.pipeData_in = aLink.__data__.source.pipeline_data[aLink.__data__.target.name];
+                        aLink.__data__.pipeData_out = aLink.__data__.target.pipeline_data[aLink.__data__.source.name];
+                        aLink.__data__.pipeDataName_in = "";
+                        aLink.__data__.pipeDataName_out = "";
+                        aLink.__data__.name = "";
+                        if (aLink.__data__.pipeData_in)
                         {
-                            
-                            aLink.__data__.pipeData_in = aLink.__data__.source.pipeline_data[aLink.__data__.target.name];
-                            aLink.__data__.pipeData_out = aLink.__data__.target.pipeline_data[aLink.__data__.source.name];
-                            aLink.__data__.pipeDataName_in = "";
-                            aLink.__data__.pipeDataName_out = "";
-                            aLink.__data__.name = "";
-                            if (aLink.__data__.pipeData_in)
-                            {
-                                for (var i=0; i<aLink.__data__.pipeData_in.length; i++)
-                                {
-                                    if (i==0){aLink.__data__.pipeDataName_in += aLink.__data__.pipeData_in[i];}
-                                    else{aLink.__data__.pipeDataName_in += "," + aLink.__data__.pipeData_in[i];}
-                                    
-                                }
-                                aLink.__data__.name += aLink.__data__.pipeDataName_in
-                            }
-                            if (aLink.__data__.pipeData_out)
+                            for (var i=0; i<aLink.__data__.pipeData_in.length; i++)
                             {
-                                for (var i=0; i<aLink.__data__.pipeData_out.length; i++)
-                                {
-                                    if (i==0){aLink.__data__.pipeDataName_out += aLink.__data__.pipeData_out[i];}
-                                    else{aLink.__data__.pipeDataName_out += "," + aLink.__data__.pipeData_out[i];}
-                                }
-                                aLink.__data__.name += aLink.__data__.pipeDataName_out
-                            }
-                        })
-                                        
-                        //var allLinks_tmp = allLinks[0];
-                        allLinks[0].forEach(function(p) {
-                            var firstElement_tmp = p.__data__.name.split("/")[1]
-                            var text_fromFirst = "/"+firstElement_tmp+aText.split(firstElement_tmp)[1]
-                            if (include(p.__data__.name,text_fromFirst))
-                            {
-                                d3.select(p)
-                                    .style("stroke-opacity", 1.0)
+                                if (i==0){aLink.__data__.pipeDataName_in += aLink.__data__.pipeData_in[i];}
+                                else{aLink.__data__.pipeDataName_in += "," + aLink.__data__.pipeData_in[i];}
+                                
                             }
-                            else
+                            aLink.__data__.name += aLink.__data__.pipeDataName_in
+                        }
+                        if (aLink.__data__.pipeData_out)
+                        {
+                            for (var i=0; i<aLink.__data__.pipeData_out.length; i++)
                             {
-                                d3.select(p).style("stroke-opacity", 0);			
+                                if (i==0){aLink.__data__.pipeDataName_out += aLink.__data__.pipeData_out[i];}
+                                else{aLink.__data__.pipeDataName_out += "," + aLink.__data__.pipeData_out[i];}
                             }
-                        });
-                    }
+                            aLink.__data__.name += aLink.__data__.pipeDataName_out
+                        }
+                    })
+                                    
+                    //var allLinks_tmp = allLinks[0];
+                    allLinks[0].forEach(function(p) {
+                        var firstElement_tmp = p.__data__.name.split("/")[1]
+                        var text_fromFirst = "/"+firstElement_tmp+xPath.split(firstElement_tmp)[1]
+                        if (include(p.__data__.name,text_fromFirst))
+                        {
+                            d3.select(p)
+                                .style("stroke-opacity", 1.0)
+                        }
+                        else
+                        {
+                            d3.select(p).style("stroke-opacity", 0);			
+                        }
+                    });
                 }
                     
                 //Function writeTreeToXML goes through tree nodes and puts the into an xml document
@@ -22060,8 +22050,7 @@
                     onMouseDown: function(elm, d, i) {
                         d3.selectAll(".treeFrame").attr("fill-opacity", .5);
                         d3.selectAll(".nodeText").style("fill-opacity", 0.5);					
-                        var theText="";
-                        highlight(d,theText);
+                        highlight(d);
                     },
                     onMouseUp: function(elm, d, i) {				
                         d3.selectAll(".edgeBundlesLink")
@@ -24848,27 +24837,23 @@
 			  
                 
                 //Highlight function, that shows usage of a node in the XDSM
-                function highlight(data,aText)
+                function highlight(data)
                 {
-                    aText = "/"+data.name+aText;
-                    if (data.parent){highlight(data.parent,aText)}
-                    else
-                    {
-                        var allLinks = d3.selectAll(".link");
-                        var allLinks_tmp = allLinks[0];
-                        allLinks_tmp.forEach(function(p) {
-                            var firstElement_tmp = p.__data__.name.split("/")[1]
-                            var text_fromFirst = "/"+firstElement_tmp+aText.split(firstElement_tmp)[1]
-                            if (include(p.__data__.name,text_fromFirst))
-                            {
-                                d3.select(p).style("opacity", .8);			
-                            }
-                            else
-                            {
-                                d3.select(p).style("opacity", 0);			
-                            }
-                        });
-                    }
+                    xPath = data.xPath;
+                    var allLinks = d3.selectAll(".link");
+                    var allLinks_tmp = allLinks[0];
+                    allLinks_tmp.forEach(function(p) {
+                        var firstElement_tmp = p.__data__.name.split("/")[1]
+                        var text_fromFirst = "/"+firstElement_tmp+xPath.split(firstElement_tmp)[1]
+                        if (include(p.__data__.name,text_fromFirst))
+                        {
+                            d3.select(p).style("opacity", .8);			
+                        }
+                        else
+                        {
+                            d3.select(p).style("opacity", 0);			
+                        }
+                    });
                 }
                 
                 function showVariableTable(aVariable)
@@ -24937,8 +24922,7 @@
                     onMouseDown: function(elm, d, i) {
                         d3.selectAll(".treeFrame").attr("fill-opacity", .5);
                         d3.selectAll(".nodeText").style("fill-opacity", 0.5);					
-                        var theText="";
-                        highlight(d,theText);
+                        highlight(d);
                     },
                     onMouseUp: function(elm, d, i) {				
                         d3.selectAll(".link").style("opacity",.6)
@@ -26344,27 +26328,23 @@
 				varCategories =  entireData.categories;
 				
                 //Highlight function, that shows usage of a node in the XDSM
-                function highlight(data,aText)
+                function highlight(data)
                 {
-                    aText = "/"+data.name+aText;
-                    if (data.parent){highlight(data.parent,aText)}
-                    else
-                    {
-                        var allLinks = d3.selectAll(".link");
-                        var allLinks_tmp = allLinks[0];
-                        allLinks_tmp.forEach(function(p) {
-                            var firstElement_tmp = p.__data__.name.split("/")[1]
-                            var text_fromFirst = "/"+firstElement_tmp+aText.split(firstElement_tmp)[1]
-                            if (include(p.__data__.name,text_fromFirst))
-                            {
-                                d3.select(p).style("opacity", .8);			
-                            }
-                            else
-                            {
-                                d3.select(p).style("opacity", 0);			
-                            }
-                        });
-                    }
+                    var xPath = data.xPath;
+                    var allLinks = d3.selectAll(".link");
+                    var allLinks_tmp = allLinks[0];
+                    allLinks_tmp.forEach(function(p) {
+                        var firstElement_tmp = p.__data__.name.split("/")[1]
+                        var text_fromFirst = "/"+firstElement_tmp+xPath.split(firstElement_tmp)[1]
+                        if (include(p.__data__.name,text_fromFirst))
+                        {
+                            d3.select(p).style("opacity", .8);			
+                        }
+                        else
+                        {
+                            d3.select(p).style("opacity", 0);			
+                        }
+                    });
                 }
                 
                 function showVariableTable(aVariable)
@@ -26433,8 +26413,7 @@
                     onMouseDown: function(elm, d, i) {
                         d3.selectAll(".treeFrame").attr("fill-opacity", .5);
                         d3.selectAll(".nodeText").style("fill-opacity", 0.5);					
-                        var theText="";
-                        highlight(d,theText);
+                        highlight(d);
                     },
                     onMouseUp: function(elm, d, i) {				
                         d3.selectAll(".link").style("opacity",.6)
-- 
GitLab