Example #1
0
        public FamilyStats(FamilyMembers family)
        {
            this._family        = family;
            this._members       = family.Family;
            this._maxGeneration = _members.Count > 0 ? (int)_members.Select(m => m.Generations.Count > 0 ? m.Generations.Select(g => g.Depth).Max() : -1).Max() + 1 : 0;

            this._familyCounts         = new List <ChartData>();
            this._familyCountsExtended = new List <ChartData>();

            Member root = _family.getMember(Preferences.RootUser);

            if (root != null)
            {
                getRegionNameCounts(false, ref _familyCounts);
                getRegionNameCounts(true, ref _familyCountsExtended);
            }
        }
Example #2
0
        private void createTree(string memberName)
        {
            if (memberName == null)
            {
                return;
            }

            this.drawMinimap_Background();

            float WINDOW_HEIGHT   = treePage.Height - 50;
            float MAX_RECT_HEIGHT = 20;
            float MAX_RECT_WIDTH  = 150;

            this.currentMember = memberName;

            Member[][] nodes = _family.assignNodes(_family.getMember(memberName), 10);
            this.treePanel.Controls.Clear();

            for (int i = 0; i < nodes.Length; i++)
            {
                float containerHeight = WINDOW_HEIGHT / nodes[i].Length;

                for (int j = 0; j < nodes[i].Length; j++)
                {
                    if (nodes[i][j] == null || nodes[i][j].Name == "" || MAX_RECT_HEIGHT > (containerHeight * 4))
                    {
                        continue;
                    }

                    float rectHeight = MAX_RECT_HEIGHT < containerHeight ? MAX_RECT_HEIGHT : containerHeight;
                    float rectWidth  = MAX_RECT_HEIGHT < containerHeight ? MAX_RECT_WIDTH  : containerHeight / MAX_RECT_HEIGHT;

                    float xValue = (MAX_RECT_WIDTH)*i + 20;
                    float yValue = (j + 1) * containerHeight - (containerHeight / 2);

                    Label memberItem = new Label();

                    memberItem.Name = nodes[i][j].Name;

                    if (MAX_RECT_HEIGHT < containerHeight)
                    {
                        memberItem.Text      = nodes[i][j].CleanName;
                        memberItem.TextAlign = ContentAlignment.MiddleCenter;
                        memberItem.Font      = new Font(Preferences.TreeFontName, Preferences.TreeFontSize, FontStyle.Regular);
                    }

                    if (i == 0)
                    {
                        memberItem.ForeColor = Color.Gray;
                    }

                    memberItem.Location = new Point((int)(xValue * 1.2), (int)yValue);

                    memberItem.Width       = (int)Math.Round(MAX_RECT_WIDTH);
                    memberItem.Height      = (int)Math.Round(rectHeight);
                    memberItem.BorderStyle = BorderStyle.FixedSingle;

                    memberItem.Cursor = Cursors.Hand;

                    memberItem.Click       += new EventHandler(showInfo);
                    memberItem.DoubleClick += new EventHandler(recenterTree);
                    memberItem.MouseEnter  += new EventHandler(markSelection);
                    memberItem.MouseLeave  += new EventHandler(unmarkSelection);

                    this.treePanel.Controls.Add(memberItem);
                }
            }
        }