Пример #1
0
        public GcTypeHeap Render()
        {
            Console.WriteLine("rendering...");
            if (this.graph.VertexCount > 500)
            {
                Console.WriteLine("too many vertices ");
                return(this);
            }

            GleeGraphPopulator <GcType, GcTypeEdge> populator = GleeGraphUtility.Create(this.graph);

            try
            {
                populator.NodeAdded += new GleeVertexNodeEventHandler <GcType>(populator_NodeAdded);
                populator.EdgeAdded += new GleeEdgeEventHandler <GcType, GcTypeEdge>(populator_EdgeAdded);
                populator.Compute();

                if (viewer == null)
                {
                    viewerForm  = new Form();
                    viewer      = new GViewer();
                    viewer.Dock = DockStyle.Fill;
                    viewerForm.Controls.Add(viewer);
                }
                viewer.Graph = populator.GleeGraph;
                viewerForm.ShowDialog();
            }
            finally
            {
                populator.NodeAdded -= new GleeVertexNodeEventHandler <GcType>(populator_NodeAdded);
                populator.EdgeAdded -= new GleeEdgeEventHandler <GcType, GcTypeEdge>(populator_EdgeAdded);
            }

            return(this);
        }
Пример #2
0
        public Graph CreateGraph(RulesEngineGraph data)
        {
            var graph = new AdjacencyGraph <Vertex, Edge <Vertex> >();

            graph.AddVertexRange(data.Vertices);
            graph.AddEdgeRange(data.Edges.Select(x => 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 Graph CreateGraph(PipelineGraphData 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);
        }