Ejemplo n.º 1
0
        public void SaveGraphToFile(ChannelGraphData 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);
        }
Ejemplo n.º 2
0
        public Graph CreateGraph(ChannelGraphData 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(Channel).IsAssignableFrom(target.GetType()))
            {
                return;
            }

            var visitor = new GraphChannelVisitor();

            visitor.FastInvoke("Visit", target);

            ChannelGraphData data = visitor.GetGraphData();

            base.GetData(data, outgoingData);
        }
Ejemplo n.º 4
0
        public static void TestShowVisualizer(ChannelGraphData data)
        {
            var visualizerHost = new VisualizerDevelopmentHost(data, typeof(ChannelDebugVisualizer));

            visualizerHost.ShowVisualizer();
        }