Skip to content
Snippets Groups Projects
Commit 15c41039 authored by Dennis Wobbe's avatar Dennis Wobbe :speech_balloon:
Browse files

Changing class ColoredDotWriter

parent d81ad28e
Branches
No related tags found
1 merge request!21Near final implementation of Convert package + documentation
......@@ -7,20 +7,38 @@ using DataStructures;
namespace SparseTransform.Convert
{
internal class ColoredDotWriter : DotWriter
{
private bool textcolor;
private string[] dictColor = new string[65];
public ColoredDotWriter(bool textColor)
{
this.textcolor = textColor;
for (int i = 0; i <= 3; i++)
{
for (int j = 0; j <= 3; j++)
{
for (int k = 0; k <= 4; k++)
{
dictColor[i * 16 + j * 4 + k] = ("#" + (255 - i * 60).ToString("X2") + (255 - j * 60).ToString("X2") + (255 - k * 60).ToString("X2"));
}
}
}
}
public override String NodeLabel(GraphNode node, String präfix)
{
return "\t" + präfix + node.Index + " [shape=circle, style=filled, fillcolor=" + node.Color + "]";
if (textcolor || node.Color > 64)
{
return "\t" + präfix + node.Index + " [shape=circle, style=filled, label=\"" + präfix + node.Index + "\\n Farbe " + node.Color + "\"]";
}
else
{
return "\t" + präfix + node.Index + " [shape=circle, style=filled, fillcolor=\"" + dictColor[node.Color] + "\"]";
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment