Ejemplo n.º 1
0
        public ArborViewer()
        {
            InitializeComponent();


            // repulsion - отталкивание, stiffness - тугоподвижность, friction - сила трения
            fSystem = new ArborSystemEx(10000.0f, 500.0f /*1000.0f*/, 0.1f, this);
            fSystem.SetViewSize((int)Width, (int)Height);
            fSystem.AutoStop = true;
            fSystem.Graph    = new Graph();

            fDragged       = null;
            fEnergyDebug   = false;
            fNodesDragging = false;

            //fDrawFont = new Font("Calibri", 9);

            //fLinePen = new Pen(Color.Gray, 1);
            //fLinePen.StartCap = LineCap.NoAnchor;
            //fLinePen.EndCap = LineCap.ArrowAnchor;

            fStrFormat = new CanvasTextFormat();
            fStrFormat.HorizontalAlignment = CanvasHorizontalAlignment.Center;
            fStrFormat.VerticalAlignment   = CanvasVerticalAlignment.Center;
            fStrFormat.FontSize            = 9;
            fStrFormat.WordWrapping        = CanvasWordWrapping.NoWrap;

            fBlackBrush = new SolidColorBrush(Colors.Black);
            fWhiteBrush = new SolidColorBrush(Colors.White);
        }
Ejemplo n.º 2
0
        public PatriarchsViewerWin(IBaseWindow baseWin, int minGens)
        {
            InitializeComponent();

            fBase    = baseWin;
            fTipShow = false;

            using (Graph graph = PatriarchsMan.GetPatriarchsGraph(fBase.Context, minGens, false, true)) {
                ArborSystem sys = fArborViewer.Sys;

                foreach (Vertex vtx in graph.Vertices)
                {
                    var    arbNode = sys.addNode(vtx.Sign) as ArborNodeEx;
                    PGNode pgNode  = (PGNode)vtx.Value;

                    arbNode.Color = (pgNode.Type == PGNodeType.Intersection) ? Colors.BlueViolet : Colors.Navy;
                    arbNode.Mass  = pgNode.Size;
                }

                foreach (Edge edge in graph.Edges)
                {
                    sys.addEdge(edge.Source.Sign, edge.Target.Sign);
                }
            }

            fArborViewer.NodesDragging = true;
        }
Ejemplo n.º 3
0
        public ArborSampleForm()
        {
            InitializeComponent();

            fTip     = new ToolTip();
            fTipShow = false;

            arborViewer1.EnergyDebug   = true;
            arborViewer1.NodesDragging = true;

            ArborSystem.CreateSample(arborViewer1.System.Graph);
            arborViewer1.System.Start();
        }
Ejemplo n.º 4
0
        public void Graph2_Tests()
        {
            using (Graph graph = new Graph())
            {
                ArborSystem.CreateSample(graph);

                Vertex vertex = graph.FindVertex("1");
                graph.FindPathTree(vertex);

                IEnumerable <Edge> path = graph.GetPath(graph.FindVertex("110"));
                // 110, 88, 67, 53, 23, 4, 1
            }
        }
Ejemplo n.º 5
0
        public void CreateArborGraph(IBaseWindow baseWin, int minGens, bool loneSuppress)
        {
            fBase = baseWin;

            try
            {
                fSys = new ArborSystem(1000, 1000, 0.1, null); //(10000, 1000, 0.1, this);
                fSys.setScreenSize(50, 50);
                fSys.OnStop += OnArborStop;

                using (ExtList <PatriarchObj> patList = PatriarchsMan.GetPatriarchsLinks(
                           baseWin.Context, minGens, false, loneSuppress))
                {
                    int num = patList.Count;
                    for (int i = 0; i < num; i++)
                    {
                        PatriarchObj pObj = patList[i];

                        if (!loneSuppress || pObj.HasLinks)
                        {
                            ArborNode node = fSys.addNode(pObj.IRec.XRef);
                            node.Data = pObj;
                        }
                    }

                    for (int i = 0; i < num; i++)
                    {
                        PatriarchObj pat1 = patList[i];

                        foreach (PatriarchObj pat2 in pat1.Links)
                        {
                            fSys.addEdge(pat1.IRec.XRef, pat2.IRec.XRef);
                        }
                    }
                }

                z = -50;

                fSys.start();
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreeVizControl.CreateArborGraph(): " + ex.Message);
            }
        }