public void SaveGraphToFile(RulesEngineGraphData data, int width, int height, string filename) { Graph gleeGraph = CreateGraph(data); var renderer = new GraphRenderer(gleeGraph); renderer.CalculateLayout(); var bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); renderer.Render(bitmap); Trace.WriteLine("Saving graph to " + filename); bitmap.Save(filename, ImageFormat.Png); }
public Graph CreateGraph(RulesEngineGraphData data) { var graph = new AdjacencyGraph <Vertex, Edge <Vertex> >(); data.Vertices.Each(x => graph.AddVertex(x)); data.Edges.Each(x => graph.AddEdge(new Edge <Vertex>(x.From, x.To))); GleeGraphPopulator <Vertex, Edge <Vertex> > glee = graph.CreateGleePopulator(); glee.NodeAdded += NodeStyler; glee.EdgeAdded += EdgeStyler; glee.Compute(); Graph gleeGraph = glee.GleeGraph; return(gleeGraph); }
public override void GetData(object target, Stream outgoingData) { if (target == null) { return; } if (!typeof(RulesEngine).IsAssignableFrom(target.GetType())) { return; } var engine = (RulesEngine)target; RulesEngineGraphData data = engine.GetGraphData(); base.GetData(data, outgoingData); }
public static void TestShowVisualizer(RulesEngineGraphData data) { var visualizerHost = new VisualizerDevelopmentHost(data, typeof(RulesEngineDebugVisualizer)); visualizerHost.ShowVisualizer(); }