Exemplo n.º 1
0
        public static TreeForTreeLayout <ITreeData> BuildTree(Control ctl, TreeConfiguration config, Person root)
        {
            _config = config;

            _nf       = new NodeFactory(ctl, _config.MajorFont.GetFont(), _config.MinorFont.GetFont(), _config.RootOnLeft);
            _unionSet = new Dictionary <string, ITreeData>();
            _genDepth = 1;

            ITreeData treeRoot;

            switch (root.SpouseIn.Count)
            {
            case 0:
            case 1:
                treeRoot = MakeNode(root, _genDepth);
                _tree    = new DefaultTreeForTreeLayout <ITreeData>(treeRoot);
                GrowTree(treeRoot as UnionNode);
                break;

            default:
                // Multi-marriage at the root.
                treeRoot = _nf.Create(null, null, Color.GreenYellow, 0);     // this is a "pseudo-node" which doesn't get drawn
                ((PersonNode)treeRoot).IsReal = false;
                _tree = new DefaultTreeForTreeLayout <ITreeData>(treeRoot);
                MultiMarriage(treeRoot, root, _genDepth);
                break;
            }
            return(_tree);
        }
Exemplo n.º 2
0
        public static TreeConfiguration DefaultSettings()
        {
            var config = new TreeConfiguration();

            config.Inited        = true;
            config.NodeGap       = 20; // TODO gapBetweenNodes;
            config.GenerationGap = 30; // TODO gapBetweenLevels;
            config.Align         = AlignmentInLevel.TowardsRoot;
            config.RootLoc       = Location.Top;
            config.MajorFont     = new FontValues {
                Family = "Times New Roman", Size = 10
            };
            config.MinorFont = new FontValues {
                Family = "Times New Roman", Size = 8
            };
            config.MaleColor = new ColorValues {
                ARGB = Color.PowderBlue.ToArgb()
            };
            config.FemaleColor = new ColorValues {
                ARGB = Color.Pink.ToArgb()
            };
            config.UnknownColor = new ColorValues {
                ARGB = Color.Plum.ToArgb()
            };
            config.NodeBorder = new LineStyleValues
            {
                LineColor = new ColorValues {
                    ARGB = Color.Black.ToArgb()
                },
                LineStyle  = DashStyle.Solid,
                LineWeight = 1
            };
            config.SpouseLine = new LineStyleValues
            {
                LineColor = new ColorValues {
                    ARGB = Color.Black.ToArgb()
                },
                LineStyle  = DashStyle.Solid,
                LineWeight = 1
            };
            config.ChildLine = new LineStyleValues
            {
                LineColor = new ColorValues {
                    ARGB = Color.Black.ToArgb()
                },
                LineStyle  = DashStyle.Solid,
                LineWeight = 1
            };
            config.MMargLine = new LineStyleValues
            {
                LineColor = new ColorValues {
                    ARGB = Color.Coral.ToArgb()
                },
                LineWeight = 2,
                LineStyle  = DashStyle.Dash
            };
            config.DuplLine = new LineStyleValues
            {
                LineColor = new ColorValues {
                    ARGB = Color.CornflowerBlue.ToArgb()
                },
                LineWeight = 2,
                LineStyle  = DashStyle.Dash
            };

            config.BackColor = new ColorValues {
                ARGB = Color.Bisque.ToArgb()
            };

            config.HighlightColor = new ColorValues {
                ARGB = Color.Red.ToArgb()
            };
            config.HighlightStyle = HighlightStyles.Line;

            config.MaxDepth = 99;
            return(config);
        }