Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4234 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
13 changed files with 245 additions and 108 deletions
@ -0,0 +1,39 @@ |
|||||||
|
// <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>
|
||||||
|
/// <see cref="ObjectProperty"/> with outgoing <see cref="PositionedEdge"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class PositionedNodeProperty |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Creates new PositionedNodeProperty.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectProperty">Underlying <see cref="ObjectProperty"/></param>
|
||||||
|
public PositionedNodeProperty(ObjectProperty objectProperty) |
||||||
|
{ |
||||||
|
this.objectProperty = objectProperty; |
||||||
|
} |
||||||
|
|
||||||
|
private ObjectProperty objectProperty; |
||||||
|
/// <summary>
|
||||||
|
/// Underlying <see cref="ObjectProperty"/>.
|
||||||
|
/// </summary>
|
||||||
|
public ObjectProperty ObjectProperty |
||||||
|
{ |
||||||
|
get { return objectProperty; } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Edge outgoing from this property to another <see cref="PositionedNode"/>.
|
||||||
|
/// </summary>
|
||||||
|
public PositionedEdge Edge { get; set; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
// <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(PositionedNode node, StringBuilder builder) |
||||||
|
{ |
||||||
|
string nodeName = genId.GetNextId().ToString(); |
||||||
|
nodeNames[node] = nodeName; |
||||||
|
|
||||||
|
Rect neatoInput = transform.NodeToNeatoInput(node); |
||||||
|
|
||||||
|
string dotFormatNode = |
||||||
|
string.Format(formatCulture, |
||||||
|
"{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.SourceNode]; |
||||||
|
string targetNodeName = nodeNames[edge.TargetNode]; |
||||||
|
|
||||||
|
builder.AppendLine(string.Format("{0} -> {1}", sourceNodeName, targetNodeName)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
// <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 nodes as records of properties.
|
||||||
|
/// Edges start at property, end at node.
|
||||||
|
/// </summary>
|
||||||
|
public class RecordDotFormatter : DotFormatter |
||||||
|
{ |
||||||
|
public RecordDotFormatter(PositionedGraph posGraph) : base(posGraph) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected override void appendPosNode(PositionedNode node, StringBuilder builder) |
||||||
|
{ |
||||||
|
string nodeName = genId.GetNextId().ToString(); |
||||||
|
nodeNames[node] = nodeName; |
||||||
|
|
||||||
|
Rect neatoInput = transform.NodeToNeatoInput(node); |
||||||
|
|
||||||
|
/*LEFT [ |
||||||
|
pos="0,0!" |
||||||
|
width="1", height="1" |
||||||
|
label = "<f0> a| <f1> b| <f2> c|<f3>d"];*/ |
||||||
|
|
||||||
|
StringBuilder recordLabel = new StringBuilder(); |
||||||
|
|
||||||
|
|
||||||
|
string dotFormatNode = |
||||||
|
string.Format(formatCulture, |
||||||
|
"{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.SourceNode]; |
||||||
|
string targetNodeName = nodeNames[edge.TargetNode]; |
||||||
|
|
||||||
|
builder.AppendLine(string.Format("{0} -> {1}", sourceNodeName, targetNodeName)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue