コード例 #1
0
        private void ProcessPersonStem(TVPerson person, TVPerson relative, TVPersonType type)
        {
            try
            {
                if (person == null)
                {
                    return;
                }

                if (person.Stem == null && (type == TVPersonType.Patriarch || type == TVPersonType.Child))
                {
                    person.Stem = new TVStem();
                    fStems.Add(person.Stem);
                }

                switch (type)
                {
                case TVPersonType.Spouse:
                    relative.Stem.AddSpouse(person);
                    break;

                case TVPersonType.Child:
                    relative.Stem.AddChild(person);
                    break;

                case TVPersonType.Patriarch:
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreeVizControl.ProcessPersonStem(): " + ex.Message);
            }
        }
コード例 #2
0
        private TVPerson PreparePerson(TVPerson parent, GEDCOMIndividualRecord iRec, TVPersonType type)
        {
            try
            {
                TVPerson result;

                if (fPersonsIndex.TryGetValue(iRec.XRef, out result))
                {
                    // the person is already in the general index; so this is someone's spouse in another tree previously processed

                    if (parent == null)
                    {
                        // parent == null, if this is patriarch or someone's spouse without his parents
                        // if it's a spouse and is already in the index - therefore,
                        // this person was married with the delegates of two different genera that are processed through their patriarchs?
                    }
                    else
                    {
                        result.Parent = parent;
                        PointF prevPt   = result.Stem.Pt;
                        PointF parentPt = parent.Pt;
                        PointF midpoint = GetLineMidpoint(prevPt.X, prevPt.Y, parentPt.X, parentPt.Y);
                        result.Stem.Pt = midpoint;
                        result.Stem.Update();
                    }

                    return(null);
                }
                else
                {
                    result      = new TVPerson(parent, iRec);
                    result.Type = type;

                    fPersons.Add(result);
                    fPersonsIndex.Add(iRec.XRef, result);

                    result.BirthYear = fBase.Context.FindBirthYear(iRec);
                    result.DeathYear = fBase.Context.FindDeathYear(iRec);

                    // FIXME: alter to the pre-statistically a certain life expectancy
                    if (result.DeathYear == 0)
                    {
                        result.DeathYear = result.BirthYear + 75;
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreeVizControl.PreparePerson(): " + ex.Message);
                return(null);
            }
        }