示例#1
0
        TransferToLayout
        (
            ILayout layout
        )
        {
            Debug.Assert(layout != null);
            AssertValid();

            layout.Margin                 = this.Margin;
            layout.LayoutStyle            = this.LayoutStyle;
            layout.BoxLayoutAlgorithm     = this.BoxLayoutAlgorithm;
            layout.GroupRectanglePenWidth = this.GroupRectanglePenWidth;
            layout.IntergroupEdgeStyle    = this.IntergroupEdgeStyle;
            layout.ImproveLayoutOfGroups  = this.ImproveLayoutOfGroups;
            layout.MaximumVerticesPerBin  = this.MaximumVerticesPerBin;
            layout.BinLength              = this.BinLength;

            if (layout is FruchtermanReingoldLayout)
            {
                FruchtermanReingoldLayout oFruchtermanReingoldLayout =
                    (FruchtermanReingoldLayout)layout;

                oFruchtermanReingoldLayout.C = this.FruchtermanReingoldC;

                oFruchtermanReingoldLayout.Iterations =
                    this.FruchtermanReingoldIterations;
            }
        }
示例#2
0
        private static ILayout ChooseLayout(GraphLayoutType s)
        {
            EdgeDrawer ed = new EdgeDrawer();

            gd.EdgeDrawer = ed;
            ed.Color      = Color.Red;
            VertexDrawer vd = new VertexDrawer();

            gd.VertexDrawer = vd;
            vd.Shape        = VertexDrawer.VertexShape.Disk;
            ILayout fr = new FruchtermanReingoldLayout();

            switch (s)
            {
            case GraphLayoutType.Fruchterman_Reingold:
                fr = new FruchtermanReingoldLayout();
                break;

            case GraphLayoutType.Random:
                fr = new RandomLayout();
                break;

            case GraphLayoutType.Circle:
                fr = new CircleLayout();
                break;

            case GraphLayoutType.Kamada_Kawaii:
                fr = new KamadaKawaiiLayout();
                break;

            case GraphLayoutType.Grid:
                fr = new GridLayout();
                break;

            case GraphLayoutType.Sugiyama:
                SugiyamaEdgeDrawer eds = new SugiyamaEdgeDrawer();
                gd.EdgeDrawer = eds;
                eds.Color     = Color.Red;
                SugiyamaVertexDrawer vds = new SugiyamaVertexDrawer();
                gd.VertexDrawer = vds;
                vds.Shape       = VertexDrawer.VertexShape.Sphere;
                fr = new SugiyamaLayout();
                break;
            }
            return(fr);
        }
示例#3
0
        public void TestFruchtermanReingold()
        {
            FruchtermanReingoldLayout layout = new FruchtermanReingoldLayout(10);

            layout.Init(2000d, 1000d, network);
            layout.DoLayout();
            foreach (Vertex v in network.Vertices)
            {
                try {
                    NETGen.Visualization.Vector3 pos = layout.GetPositionOfNode(v);
                    Assert.AreNotEqual(pos, new NETGen.Visualization.Vector3());
                }
                catch (Exception ex)
                {
                    Assert.Fail(ex.Message);
                }
            }
        }
示例#4
0
        TransferToLayout
        (
            IAsyncLayout asyncLayout
        )
        {
            Debug.Assert(asyncLayout != null);
            AssertValid();

            asyncLayout.Margin                = this.Margin;
            asyncLayout.UseBinning            = this.UseBinning;
            asyncLayout.MaximumVerticesPerBin = this.MaximumVerticesPerBin;
            asyncLayout.BinLength             = this.BinLength;

            if (asyncLayout is FruchtermanReingoldLayout)
            {
                FruchtermanReingoldLayout oFruchtermanReingoldLayout =
                    (FruchtermanReingoldLayout)asyncLayout;

                oFruchtermanReingoldLayout.C = this.FruchtermanReingoldC;

                oFruchtermanReingoldLayout.Iterations =
                    this.FruchtermanReingoldIterations;
            }
        }
示例#5
0
    public static void Main(string[] args)
    {
        hierarchy = new Network();
        root      = hierarchy.CreateVertex();
        root.Tag  = NodeType.Root;
        c[root]   = Color.Orange;


        // Assign node types and estimates
        for (int i = 0; i < individuals; i++)
        {
            Vertex aggregate = hierarchy.CreateVertex();
            hierarchy.CreateEdge(root, aggregate, EdgeType.DirectedAB);
            c[aggregate] = Color.Black;
            Aggregates.Add(aggregate);
            aggregate.Tag = NodeType.Aggregate;

            Vertex individual = hierarchy.CreateVertex();
            individual.Tag = NodeType.Individual;

            Variance[individual] = r.NextDouble();
            c[individual]        = Color.FromArgb(255 - (int)(255d * Variance[individual]), (int)(255d * Variance[individual]), 0);

            hierarchy.CreateEdge(aggregate, individual, EdgeType.DirectedAB);
            Individuals.Add(individual);
        }

        Application.Init();
        slider = new ConsensusHierarchy.TemperatureWindow();
        slider.Show();
        System.Threading.ThreadPool.QueueUserWorkItem(delegate(object o) {
            FruchtermanReingoldLayout layout = new FruchtermanReingoldLayout(15);
            NETGen.Visualization.NetworkVisualizer.Start(hierarchy, layout, c, 800, 600);
            layout.DoLayoutAsync();

            Logger.ShowInfos = false;

            while (true)
            {
                Change();
                c.RecomputeColors(new Func <Vertex, Color>(v => {
                    if (((NodeType)v.Tag) == NodeType.Aggregate)
                    {
                        if (v.OutDegree == 0)
                        {
                            return(Color.White);
                        }
                        else
                        {
                            return(Color.Black);
                        }
                    }
                    else
                    {
                        return(c[v]);
                    }
                }));

                c.RecomputeColors(new Func <Edge, Color>(e => {
                    if (((NodeType)e.Target.Tag) == NodeType.Aggregate && e.Target.OutDegree == 0)
                    {
                        return(Color.White);
                    }
                    else
                    {
                        return(c.DefaultEdgeColor);
                    }
                }));
                NetworkVisualizer.Layout.DoLayout();
            }
        });
        Application.Run();
    }
示例#6
0
 SetUp()
 {
     m_oFruchtermanReingoldLayout = new FruchtermanReingoldLayout();
 }
示例#7
0
 private static ILayout ChooseLayout(GraphLayoutType s)
 {
     EdgeDrawer ed = new EdgeDrawer();
     gd.EdgeDrawer = ed;
     ed.Color = Color.Red;
     VertexDrawer vd = new VertexDrawer();
     gd.VertexDrawer = vd;
     vd.Shape = VertexDrawer.VertexShape.Disk;
     ILayout fr = new FruchtermanReingoldLayout();
     switch (s)
     {
         case GraphLayoutType.Fruchterman_Reingold:
             fr = new FruchtermanReingoldLayout();
             break;
         case GraphLayoutType.Random:
             fr = new RandomLayout();
             break;
         case GraphLayoutType.Circle:
             fr = new CircleLayout();
             break;
         case GraphLayoutType.Kamada_Kawaii:
             fr = new KamadaKawaiiLayout();
             break;
         case GraphLayoutType.Grid:
             fr = new GridLayout();
             break;
         case GraphLayoutType.Sugiyama:
             SugiyamaEdgeDrawer eds = new SugiyamaEdgeDrawer();
             gd.EdgeDrawer = eds;
             eds.Color = Color.Red;
             SugiyamaVertexDrawer vds = new SugiyamaVertexDrawer();
             gd.VertexDrawer = vds;
             vds.Shape = VertexDrawer.VertexShape.Sphere;
             fr = new SugiyamaLayout();
             break;
     }
     return fr;
 }