Browse Source
Deleted unused Debugger visualize files. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5880 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
20 changed files with 46 additions and 648 deletions
@ -1,45 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Text; |
|
||||||
using System.Windows; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// <see cref="DotFormatter"/> that treats node as a atomic "box". Edges go from box to box.
|
|
||||||
/// </summary>
|
|
||||||
public class BoxDotFormatter : DotFormatter |
|
||||||
{ |
|
||||||
public BoxDotFormatter(PositionedGraph posGraph) : base(posGraph) |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
protected override void appendPosNode(PositionedGraphNode node, StringBuilder builder) |
|
||||||
{ |
|
||||||
string nodeName = genId.GetNextId().ToString(); |
|
||||||
nodeNames[node] = nodeName; |
|
||||||
|
|
||||||
Rect neatoInput = transform.NodeToNeatoInput(node); |
|
||||||
|
|
||||||
string dotFormatNode = |
|
||||||
string.Format(this.neatoDoubleFormatter, |
|
||||||
"{0} [pos=\"{1},{2}!\" width=\"{3}\" height=\"{4}\"];", |
|
||||||
nodeName, neatoInput.Location.X, neatoInput.Location.Y, neatoInput.Width, neatoInput.Height); |
|
||||||
builder.AppendLine(dotFormatNode); |
|
||||||
} |
|
||||||
|
|
||||||
protected override void appendPosEdge(PositionedEdge edge, StringBuilder builder) |
|
||||||
{ |
|
||||||
string sourceNodeName = nodeNames[edge.Source.ContainingNode]; |
|
||||||
string targetNodeName = nodeNames[edge.Target]; |
|
||||||
|
|
||||||
builder.AppendLine(string.Format("{0} -> {1}", sourceNodeName, targetNodeName)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,183 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Globalization; |
|
||||||
using System.IO; |
|
||||||
using System.Text; |
|
||||||
using System.Linq; |
|
||||||
using System.Windows; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Converts <see cref="PositionedGraph/> to Graphviz's string (dot format) and back (from plain format).
|
|
||||||
/// </summary>
|
|
||||||
public abstract class DotFormatter |
|
||||||
{ |
|
||||||
protected PositionedGraph posGraph; |
|
||||||
|
|
||||||
protected NeatoPositionTransform transform; |
|
||||||
|
|
||||||
protected NeatoDoubleFormatter neatoDoubleFormatter = new NeatoDoubleFormatter(); |
|
||||||
|
|
||||||
// state (node and edge names) needed for parsing back
|
|
||||||
protected Dictionary<PositionedGraphNode, string> nodeNames = new Dictionary<PositionedGraphNode, string>(); |
|
||||||
protected Dictionary<PositionedEdge, string> edgeNames = new Dictionary<PositionedEdge, string>(); |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used for generating node and edge names.
|
|
||||||
/// </summary>
|
|
||||||
protected IdGenerator genId = new IdGenerator(); |
|
||||||
|
|
||||||
public DotFormatter(PositionedGraph posGraph) |
|
||||||
{ |
|
||||||
if (posGraph.Nodes.Count() == 0) |
|
||||||
{ |
|
||||||
throw new ArgumentException("Cannot process empty graphs."); |
|
||||||
} |
|
||||||
this.posGraph = posGraph; |
|
||||||
this.transform = new NeatoPositionTransform(this.posGraph.BoundingRect); |
|
||||||
} |
|
||||||
|
|
||||||
protected abstract void appendPosNode(PositionedGraphNode node, StringBuilder builder); |
|
||||||
|
|
||||||
protected abstract void appendPosEdge(PositionedEdge edge, StringBuilder builder); |
|
||||||
|
|
||||||
protected virtual string getGraphHeader() |
|
||||||
{ |
|
||||||
return "digraph G { node [shape = box];"; |
|
||||||
} |
|
||||||
|
|
||||||
protected virtual string getGraphFooter() |
|
||||||
{ |
|
||||||
return "}"; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets Graphviz's dot format string for wrapped positioned graph.
|
|
||||||
/// </summary>
|
|
||||||
public string OutputGraphInDotFormat() |
|
||||||
{ |
|
||||||
StringBuilder dotStringBuilder = new StringBuilder(getGraphHeader()); |
|
||||||
|
|
||||||
foreach (PositionedGraphNode posNode in this.posGraph.Nodes) |
|
||||||
{ |
|
||||||
appendPosNode(posNode, dotStringBuilder); |
|
||||||
} |
|
||||||
foreach (PositionedEdge posEdge in this.posGraph.Edges) |
|
||||||
{ |
|
||||||
appendPosEdge(posEdge, dotStringBuilder); |
|
||||||
} |
|
||||||
|
|
||||||
dotStringBuilder.AppendLine(getGraphFooter()); |
|
||||||
return dotStringBuilder.ToString(); |
|
||||||
} |
|
||||||
|
|
||||||
private bool validateSplinePoints(PositionedEdge edge) |
|
||||||
{ |
|
||||||
// must have correct number of points: one start point and 3 points per bezier segment
|
|
||||||
return ((edge.SplinePoints.Count - 1) % 3) == 0; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Parses edge positions (from Graphviz's plain format) and sets these positions to underlying positioned graph.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dotGraphString">Graph with positions in Graphviz's plain format</param>
|
|
||||||
/// <returns><see cref="PositionedGraph"/> with edge positions filled.</returns>
|
|
||||||
public PositionedGraph ParseEdgePositions(string dotGraphString) |
|
||||||
{ |
|
||||||
using (StringReader reader = new System.IO.StringReader(dotGraphString)) |
|
||||||
{ |
|
||||||
skipAfterPattern(reader, "node " + nodeNames[posGraph.Nodes.First()] + " "); |
|
||||||
Point neatoFirstNodePos = readPoint(reader); |
|
||||||
PositionedGraphNode firstNode = posGraph.Nodes.First(); |
|
||||||
Point firstNodePosOur = transform.AsNeato(firstNode.Center); |
|
||||||
// determine how Neato shifted the nodes
|
|
||||||
transform.NeatoShiftX = neatoFirstNodePos.X - firstNodePosOur.X; |
|
||||||
transform.NeatoShiftY = neatoFirstNodePos.Y - firstNodePosOur.Y; |
|
||||||
|
|
||||||
// assume that edges on output are in the same order as posGraph.Edges (!)
|
|
||||||
foreach (PositionedEdge posEdge in posGraph.Edges) |
|
||||||
{ |
|
||||||
skipAfterPattern(reader, "edge "); |
|
||||||
|
|
||||||
readWord(reader); // source node name
|
|
||||||
readWord(reader); // target node name
|
|
||||||
|
|
||||||
int splinePointCount = readInt(reader); |
|
||||||
for (int i = 0; i < splinePointCount; i++) |
|
||||||
{ |
|
||||||
Point edgePoint = readPoint(reader); |
|
||||||
edgePoint = transform.FromNeatoOutput(edgePoint); |
|
||||||
posEdge.SplinePoints.Add(edgePoint); |
|
||||||
} |
|
||||||
|
|
||||||
bool edgeOk = validateSplinePoints(posEdge); |
|
||||||
if (!edgeOk) |
|
||||||
throw new DebuggerVisualizerException("Parsed edge invalid"); |
|
||||||
} |
|
||||||
} |
|
||||||
// return original graph with filled edge positions
|
|
||||||
return this.posGraph; |
|
||||||
} |
|
||||||
|
|
||||||
private Point readPoint(TextReader reader) |
|
||||||
{ |
|
||||||
double x = readDouble(reader); |
|
||||||
double y = readDouble(reader); |
|
||||||
|
|
||||||
return new Point(x, y); |
|
||||||
} |
|
||||||
|
|
||||||
private double readDouble(TextReader reader) |
|
||||||
{ |
|
||||||
return double.Parse(readWord(reader), this.neatoDoubleFormatter.DoubleCulture); |
|
||||||
} |
|
||||||
|
|
||||||
private int readInt(TextReader reader) |
|
||||||
{ |
|
||||||
return int.Parse(readWord(reader)); |
|
||||||
} |
|
||||||
|
|
||||||
private string readWord(TextReader reader) |
|
||||||
{ |
|
||||||
StringBuilder word = new StringBuilder(); |
|
||||||
int ch = ' '; |
|
||||||
while ((ch = reader.Read()) != ' ') |
|
||||||
{ |
|
||||||
if (ch == -1 || ch == '\n' || ch == '\t') |
|
||||||
break; |
|
||||||
|
|
||||||
word.Append((char)ch); |
|
||||||
} |
|
||||||
return word.ToString(); |
|
||||||
} |
|
||||||
|
|
||||||
private bool skipAfterPattern(StringReader reader, string pattern) |
|
||||||
{ |
|
||||||
int ch = -1; |
|
||||||
int pIndex = 0; |
|
||||||
int pTarget = pattern.Length; |
|
||||||
while ((ch = reader.Read()) != -1) |
|
||||||
{ |
|
||||||
if (ch == pattern[pIndex]) |
|
||||||
{ |
|
||||||
pIndex++; |
|
||||||
if (pIndex == pTarget) |
|
||||||
return true; |
|
||||||
} |
|
||||||
else |
|
||||||
{ |
|
||||||
pIndex = 0; |
|
||||||
} |
|
||||||
} |
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,28 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Generates sequential ids, usefull for node and edge ids.
|
|
||||||
/// </summary>
|
|
||||||
public class IdGenerator |
|
||||||
{ |
|
||||||
int currentId = 0; |
|
||||||
|
|
||||||
public IdGenerator() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
public int GetNextId() |
|
||||||
{ |
|
||||||
return currentId++; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,40 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Globalization; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// When used as IFormatProvider in string.Format, formats doubles to be suitable for Neato.
|
|
||||||
/// </summary>
|
|
||||||
public class NeatoDoubleFormatter : IFormatProvider, ICustomFormatter |
|
||||||
{ |
|
||||||
private CultureInfo doubleCulture = CultureInfo.GetCultureInfo("en-US"); |
|
||||||
/// <summary>
|
|
||||||
/// CultureInfo used for formatting and parsing doubles (en-US).
|
|
||||||
/// </summary>
|
|
||||||
public CultureInfo DoubleCulture |
|
||||||
{ |
|
||||||
get { return this.doubleCulture; } |
|
||||||
} |
|
||||||
|
|
||||||
public object GetFormat(Type formatType) |
|
||||||
{ |
|
||||||
if (formatType == typeof(ICustomFormatter)) |
|
||||||
return this; |
|
||||||
else |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
public string Format(string format, object arg, IFormatProvider formatProvider) |
|
||||||
{ |
|
||||||
return string.Format(doubleCulture, "{0:0.000}", arg); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,48 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Globalization; |
|
||||||
using System.IO; |
|
||||||
using System.Text; |
|
||||||
using System.Linq; |
|
||||||
using System.Windows; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Given <see cref="PositionedGraph" /> with positions of nodes, calculates positions of edges.
|
|
||||||
/// </summary>
|
|
||||||
public class NeatoEdgeRouter |
|
||||||
{ |
|
||||||
public NeatoEdgeRouter() |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Given <see cref="PositionedGraph" /> with node positions, calculates edge positions.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="graphWithNodesPositioned"><see cref="PositionedGraph" />, the nodes must have positions filled.</param>
|
|
||||||
/// <returns><see cref="PositionedGraph" /> with preserved node positions and calculated edge positions.</returns>
|
|
||||||
public PositionedGraph CalculateEdges(PositionedGraph graphWithNodesPositioned) |
|
||||||
{ |
|
||||||
DotFormatter dotFormatter = new BoxDotFormatter(graphWithNodesPositioned); |
|
||||||
|
|
||||||
// convert PosGraph to .dot string
|
|
||||||
string dotGraphString = dotFormatter.OutputGraphInDotFormat(); |
|
||||||
|
|
||||||
// pass to neato.exe and wait for output
|
|
||||||
string dotGraphStringWithPositions = NeatoProcess.Start().CalculatePositions(dotGraphString); |
|
||||||
|
|
||||||
// parse edge positions from neato's plain output format
|
|
||||||
PositionedGraph result = dotFormatter.ParseEdgePositions(dotGraphStringWithPositions); |
|
||||||
|
|
||||||
return result; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,72 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Windows; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Transforms positions to and from Neato.
|
|
||||||
/// </summary>
|
|
||||||
public class NeatoPositionTransform |
|
||||||
{ |
|
||||||
private Rect graphBoundingRect; |
|
||||||
|
|
||||||
// So that Neato works with smaller numbers. Always > 1
|
|
||||||
double ourInputScale = 40; |
|
||||||
// Neato itself scales input by this constant. Always > 1, 1 for plain output, 72 for .dot output
|
|
||||||
double neatoOutputScale = 1; |
|
||||||
|
|
||||||
public NeatoPositionTransform(Rect graphBoundingRectangle) |
|
||||||
{ |
|
||||||
graphBoundingRect = graphBoundingRectangle; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X shift, in Neato coords.
|
|
||||||
/// </summary>
|
|
||||||
public double NeatoShiftX { get; set; } |
|
||||||
/// <summary>
|
|
||||||
/// Y shift, in Neato coords.
|
|
||||||
/// </summary>
|
|
||||||
public double NeatoShiftY { get; set; } |
|
||||||
|
|
||||||
public Point ToNeatoInput(Point ourPoint) |
|
||||||
{ |
|
||||||
// invert Y axis, as Neato expects this
|
|
||||||
return new Point(ourPoint.X / ourInputScale, (graphBoundingRect.Bottom - ourPoint.Y) / ourInputScale); |
|
||||||
} |
|
||||||
|
|
||||||
public System.Windows.Point FromNeatoOutput(Point neatoPoint) |
|
||||||
{ |
|
||||||
// Neato multiplies coords by 72 and adds arbitrary shift (which has to be parsed)
|
|
||||||
double ourX = (neatoPoint.X - NeatoShiftX) / neatoOutputScale * ourInputScale; |
|
||||||
double ourYInverted = (neatoPoint.Y - NeatoShiftY) / neatoOutputScale * ourInputScale; |
|
||||||
// invert back - our Y axis grows down
|
|
||||||
return new Point(ourX, graphBoundingRect.Bottom - ourYInverted); |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Transform points as Neato would transform it if Neato used no shift
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ourPoint"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public System.Windows.Point AsNeato(Point ourPoint) |
|
||||||
{ |
|
||||||
|
|
||||||
return new Point(ourPoint.X * neatoOutputScale / ourInputScale, (graphBoundingRect.Bottom - ourPoint.Y) * neatoOutputScale / ourInputScale); |
|
||||||
} |
|
||||||
|
|
||||||
public Rect NodeToNeatoInput(PositionedGraphNode node) |
|
||||||
{ |
|
||||||
// don't transform size
|
|
||||||
return new Rect(ToNeatoInput(node.Center), |
|
||||||
new Size(node.Width / ourInputScale, node.Height / ourInputScale)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,104 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.IO; |
|
||||||
using System.Text; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Encapsulates Neato.exe.
|
|
||||||
/// </summary>
|
|
||||||
public class NeatoProcess |
|
||||||
{ |
|
||||||
private System.Diagnostics.Process neatoProcess; |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Starts neato.exe
|
|
||||||
/// </summary>
|
|
||||||
public static NeatoProcess Start() |
|
||||||
{ |
|
||||||
System.Diagnostics.Process neatoProcess = new System.Diagnostics.Process(); |
|
||||||
neatoProcess.StartInfo.FileName = getNeatoExePath(); |
|
||||||
neatoProcess.StartInfo.RedirectStandardInput = true; |
|
||||||
neatoProcess.StartInfo.RedirectStandardError = true; |
|
||||||
neatoProcess.StartInfo.RedirectStandardOutput = true; |
|
||||||
neatoProcess.StartInfo.UseShellExecute = false; |
|
||||||
neatoProcess.StartInfo.CreateNoWindow = true; |
|
||||||
// tell neato to use splines instead of straigt lines
|
|
||||||
// output type = Graphviz's plain format
|
|
||||||
neatoProcess.StartInfo.Arguments = " -Gsplines=true -Tplain"; |
|
||||||
//p.EnableRaisingEvents = true;
|
|
||||||
neatoProcess.Exited += delegate { |
|
||||||
neatoProcess.Dispose(); |
|
||||||
}; |
|
||||||
/*p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { |
|
||||||
}; |
|
||||||
p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { |
|
||||||
};*/ |
|
||||||
|
|
||||||
neatoProcess.Start(); |
|
||||||
|
|
||||||
return new NeatoProcess(neatoProcess); |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>Creates new NeatoProcess.</summary>
|
|
||||||
/// <param name="neatoProcess">Underlying neato.exe process</param>
|
|
||||||
private NeatoProcess(System.Diagnostics.Process neatoProcess) |
|
||||||
{ |
|
||||||
this.neatoProcess = neatoProcess; |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>Gets directory where Debugger.AddIn.dll resides</summary>
|
|
||||||
private static string getCurrentAssemblyPath() |
|
||||||
{ |
|
||||||
return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); |
|
||||||
} |
|
||||||
|
|
||||||
private static string getNeatoExePath() |
|
||||||
{ |
|
||||||
return Path.Combine(getCurrentAssemblyPath(), "neato.exe"); |
|
||||||
} |
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Passes given graph to neato and reads output.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dotGraph">Graph in Graphviz dot format.</param>
|
|
||||||
/// <returns>Same graph in Graphviz plain format with position information added.</returns>
|
|
||||||
public string CalculatePositions(string dotGraph) |
|
||||||
{ |
|
||||||
// write the input to neato.exe to a file for testing purposes
|
|
||||||
/*using (var writer = new StreamWriter(Path.Combine(getCurrentAssemblyPath(), "logIn.gv"))) |
|
||||||
{ |
|
||||||
writer.Write(dotGraph); |
|
||||||
}*/ |
|
||||||
|
|
||||||
neatoProcess.StandardInput.Write(dotGraph); |
|
||||||
neatoProcess.StandardInput.Flush(); |
|
||||||
neatoProcess.StandardInput.Close(); |
|
||||||
|
|
||||||
StringBuilder output = new StringBuilder(); |
|
||||||
while(true) |
|
||||||
{ |
|
||||||
string line = neatoProcess.StandardOutput.ReadLine(); |
|
||||||
if (line == null) |
|
||||||
{ |
|
||||||
// happens if neato.exe is killed
|
|
||||||
throw new DebuggerVisualizerException("Problem getting layout information from neato.exe"); |
|
||||||
} |
|
||||||
if (line == "stop") |
|
||||||
{ |
|
||||||
break; |
|
||||||
} |
|
||||||
output.AppendLine(line); |
|
||||||
} |
|
||||||
|
|
||||||
return output.ToString(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,71 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Text; |
|
||||||
using System.Windows; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph.Layout |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// <see cref="DotFormatter"/> that treats nodes as records of properties.
|
|
||||||
/// Edges start at property, end at node.
|
|
||||||
/// </summary>
|
|
||||||
public class RecordDotFormatter : DotFormatter |
|
||||||
{ |
|
||||||
private Dictionary<PositionedNodeProperty, string> propertyIds = new Dictionary<PositionedNodeProperty, string>(); |
|
||||||
|
|
||||||
public RecordDotFormatter(PositionedGraph posGraph) : base(posGraph) |
|
||||||
{ |
|
||||||
} |
|
||||||
|
|
||||||
protected override string getGraphHeader() |
|
||||||
{ |
|
||||||
return "digraph G { rankdir=LR; node [shape = record];"; |
|
||||||
} |
|
||||||
|
|
||||||
protected override void appendPosNode(PositionedGraphNode node, StringBuilder builder) |
|
||||||
{ |
|
||||||
string nodeName = genId.GetNextId().ToString(); |
|
||||||
nodeNames[node] = nodeName; |
|
||||||
|
|
||||||
Rect neatoInput = transform.NodeToNeatoInput(node); |
|
||||||
|
|
||||||
StringBuilder recordLabel = new StringBuilder(); |
|
||||||
bool first = true; |
|
||||||
foreach (var prop in node.Properties) |
|
||||||
{ |
|
||||||
string propertyId = "f" + genId.GetNextId().ToString(); |
|
||||||
propertyIds[prop] = propertyId; |
|
||||||
if (!first) |
|
||||||
{ |
|
||||||
recordLabel.Append("|"); |
|
||||||
} |
|
||||||
recordLabel.Append(string.Format("<{0}> l", propertyId)); |
|
||||||
first = false; |
|
||||||
} |
|
||||||
|
|
||||||
string dotFormatNode = |
|
||||||
string.Format(this.neatoDoubleFormatter, |
|
||||||
"{0} [pos=\"{1},{2}!\" width=\"{3}\" height=\"{4}\" label=\"{5}\"];", |
|
||||||
nodeName, |
|
||||||
neatoInput.Location.X, neatoInput.Location.Y, neatoInput.Width, neatoInput.Height, |
|
||||||
recordLabel.ToString()); |
|
||||||
builder.AppendLine(dotFormatNode); |
|
||||||
} |
|
||||||
|
|
||||||
protected override void appendPosEdge(PositionedEdge edge, StringBuilder builder) |
|
||||||
{ |
|
||||||
string sourceNodeName = nodeNames[edge.Source.ContainingNode]; |
|
||||||
string sourcePropertyName = propertyIds[edge.Source]; |
|
||||||
string targetNodeName = nodeNames[edge.Target]; |
|
||||||
|
|
||||||
builder.AppendLine(string.Format("{0}:{1} -> {2}", sourceNodeName, sourcePropertyName, targetNodeName)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,23 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers.Graph |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Description of NestedNodeType.
|
|
||||||
/// </summary>
|
|
||||||
/*public enum NestedNodeType |
|
||||||
{ |
|
||||||
ThisNode, |
|
||||||
BaseClassNode, |
|
||||||
NonPublicInstanceMembersNode, |
|
||||||
StaticMembersNode, |
|
||||||
NonPublicStaticMembersNode |
|
||||||
}*/ |
|
||||||
} |
|
@ -1,16 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Windows; |
|
||||||
using System.Windows.Controls; |
|
||||||
using System.Windows.Media; |
|
||||||
|
|
||||||
namespace Debugger.AddIn.Visualizers |
|
||||||
{ |
|
||||||
} |
|
Loading…
Reference in new issue