コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public static void TestShowVisualizer(RulesEngineGraphData data)
        {
            var visualizerHost = new VisualizerDevelopmentHost(data, typeof(RulesEngineDebugVisualizer));

            visualizerHost.ShowVisualizer();
        }