コード例 #1
0
ファイル: PedigreeCouple.cs プロジェクト: mahitosh/HRA4
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PedigreeCouple couple = obj as PedigreeCouple;

            if (couple == null)
            {
                return(false);
            }
            return(father.HraPerson.relativeID == couple.father.HraPerson.relativeID && mother.HraPerson.relativeID == couple.mother.HraPerson.relativeID);
        }
コード例 #2
0
ファイル: AttractCouples.cs プロジェクト: mahitosh/HRA4
        private void SeperateCouple(PedigreeCouple pc, PedigreeModel model, double sibMedian, ref List<PedigreeIndividual> kidsPulledToParents)
        {
            if (!model.parameters.hideNonBloodRelatives || (pc.mother.bloodRelative && pc.father.bloodRelative))
            {
                if (pc.mother.point.x < pc.father.point.x)
                {
                    PedigreeUtils.PullTowardX(pc.mother.point.x - 1, pc.mother.point, 0.1, model);
                    PedigreeUtils.PullTowardX(pc.father.point.x + 1, pc.father.point, 0.1, model);
                }
                else
                {
                    PedigreeUtils.PullTowardX(pc.mother.point.x + 1, pc.mother.point, 0.1, model);
                    PedigreeUtils.PullTowardX(pc.father.point.x - 1, pc.father.point, 0.1, model);
                }
            }
            else
            {
                double coupleAvg = (pc.mother.point.x + pc.father.point.x) / (2.0);
                pc.mother.point.x = coupleAvg;
                pc.father.point.x = coupleAvg;
            }

            double target = ((pc.mother.point.x + pc.father.point.x)/2) - sibMedian;
            foreach(PedigreeIndividual pi in pc.children)
            {
                if (kidsPulledToParents.Contains(pi) == false)
                {
                    PedigreeUtils.PullTowardX((pc.mother.point.x + pc.father.point.x) / 2, pi.point, 0.075, model);
                    kidsPulledToParents.Add(pi);
                }
                //PedigreeUtils.PullTowardX(pi.point.x + target, pi.point, 0.1, model);
            }

            foreach (PedigreeCouple nested_pc in model.couples)
            {
                if (nested_pc != pc)
                {
                    if (pc.children.Contains(nested_pc.mother) || pc.children.Contains(nested_pc.father))
                    {
                        SeperateCouple(nested_pc, model, sibMedian, ref kidsPulledToParents);
                    }
                }
            }
        }
コード例 #3
0
ファイル: PedigreeModel.cs プロジェクト: mahitosh/HRA4
 public CoupleID(PedigreeCouple couple)
 {
     fatherId = couple.father.HraPerson.relativeID;
     motherId = couple.mother.HraPerson.relativeID;
 }
コード例 #4
0
ファイル: PedigreeModel.cs プロジェクト: mahitosh/HRA4
        public PedigreeModel(FamilyHistory p_familyHistory)
        {
            familyHistory = p_familyHistory;

            //Store the individuals as PedigreeIndividuals
            lock (familyHistory.Relatives)
            {
                foreach (Person Person in familyHistory.Relatives)
                {
                    PedigreeIndividual pedigreeIndividual = new PedigreeIndividual(Person);
                    individuals.Add(pedigreeIndividual);
                    individualsDictionary[Person.relativeID] = pedigreeIndividual;
                    points.Add(pedigreeIndividual.point);
                }
            }
            //here keys are the couple ids, values are the couples to which they map
            couplesDictionary = new Dictionary <CoupleID, PedigreeCouple>();

            //Link PedigreeIndividuals with their parents in the object model, derive couples
            foreach (PedigreeIndividual child in individuals)
            {
                //determine whether or not each parent exists in the data
                bool     hasMother = individualsDictionary.ContainsKey(child.HraPerson.motherID);
                bool     hasFather = individualsDictionary.ContainsKey(child.HraPerson.fatherID);
                CoupleID coupleId  = new CoupleID(child.HraPerson.fatherID, child.HraPerson.motherID);
                if (hasMother || hasFather)
                {
                    //link individuals with their parents in the object model, forming a pointer graph
                    if (hasMother)
                    {
                        child.Mother = individualsDictionary[child.HraPerson.motherID];
                    }
                    if (hasFather)
                    {
                        child.Father = individualsDictionary[child.HraPerson.fatherID];
                    }

                    //derive couples and store them
                    {
                        //if this individual has parents, set it's "parents" pointer to the
                        //couple representing it's parents (deriving couples from the data as needed).

                        //get the parents couple
                        PedigreeCouple parents = null;
                        {
                            //check if the parents have already been stored as a couple

                            if (couplesDictionary.ContainsKey(coupleId))
                            {
                                //if so, then use the previously stored couple.
                                parents = couplesDictionary[coupleId];
                            }
                            else
                            {
                                //if not store parents as a couple if they haven't been already
                                parents = new PedigreeCouple(child.Mother, child.Father);
                                couplesDictionary[coupleId] = parents;
                                couples.Add(parents);
                                points.Add(parents.point);



                                //link participating individuals with the new couple
                                if (child.Mother != null)
                                {
                                    if (child.Mother.spouseCouples != null)
                                    {
                                        child.Mother.spouseCouples.Add(parents);
                                    }
                                }

                                if (child.Father != null)
                                {
                                    if (child.Father.spouseCouples != null)
                                    {
                                        child.Father.spouseCouples.Add(parents);
                                    }
                                }
                            }
                        }
                        //set this individual's "parents" pointer to the parents couple
                        child.Parents = parents;

                        //add the child to the children of the parents couple
                        parents.children.Add(child);
                    }
                }
            }

            // derive the intergenerational edges of the couples graph
            foreach (PedigreeIndividual parent in individuals)
            {
                bool parentHasGrandparents = parent.Parents != null;
                bool parentIsPartOfACouple = parent.spouseCouples.Count != 0;

                if (parentHasGrandparents && parentIsPartOfACouple)
                {
                    foreach (PedigreeCouple parents in parent.spouseCouples)
                    {
                        PedigreeCouple grandparents      = parent.Parents;
                        bool           intergenerational = true;
                        coupleEdges.Add(new PedigreeCoupleEdge(grandparents, parents, intergenerational));
                    }
                }
            }

            // derive the intragenerational edges of the couples graph
            // (from half sibling relationships)
            foreach (PedigreeIndividual parent in individuals)
            {
                if (parent.spouseCouples.Count == 2)
                {
                    PedigreeCouple u = parent.spouseCouples[0];
                    PedigreeCouple v = parent.spouseCouples[1];
                    bool           intergenerational = false;
                    coupleEdges.Add(new PedigreeCoupleEdge(u, v, intergenerational));
                }
                //else if (parent.spouseCouples.Count > 2)
                //    throw new Exception("Pedigree not drawable: individual " + parent.relativeID + " has more than two spouses");
            }

            //derive generational levels
            bool undefinedLevelsRemain = true;
            int  minGenerationalLevel  = 0;
            int  maxGenerationalLevel  = 0;

            if (couples.Count > 0)
            {
                //assign the seed level
                couples[0].GenerationalLevel = 0;

                //propagate the seed level through the graph
                int NULL = PedigreeCouple.UNDEFINED_GENERATION;
                while (undefinedLevelsRemain)
                {
                    undefinedLevelsRemain = false;
                    foreach (PedigreeCoupleEdge e in coupleEdges)
                    {
                        if (e.intergenerational)
                        {
                            PedigreeCouple grandparents = e.u;
                            PedigreeCouple parents      = e.v;

                            bool parentsHaveLevel      = parents.GenerationalLevel != NULL;
                            bool grandparentsHaveLevel = grandparents.GenerationalLevel != NULL;

                            if (!parentsHaveLevel || !grandparentsHaveLevel)
                            {
                                undefinedLevelsRemain = true;
                            }

                            if (!parentsHaveLevel && !grandparentsHaveLevel)
                            {
                                undefinedLevelsRemain = false;
                            }

                            if (parentsHaveLevel && !grandparentsHaveLevel)
                            {
                                grandparents.GenerationalLevel = parents.GenerationalLevel - 1;
                                if (grandparents.GenerationalLevel < minGenerationalLevel)
                                {
                                    minGenerationalLevel = grandparents.GenerationalLevel;
                                }
                            }
                            else if (!parentsHaveLevel && grandparentsHaveLevel)
                            {
                                parents.GenerationalLevel = grandparents.GenerationalLevel + 1;
                                if (parents.GenerationalLevel > maxGenerationalLevel)
                                {
                                    maxGenerationalLevel = parents.GenerationalLevel;
                                }
                            }
                        }
                        else
                        {
                            //propagate levels through intragenerational edges (half siblings)
                            if (e.u.GenerationalLevel == NULL)
                            {
                                e.u.GenerationalLevel = e.v.GenerationalLevel;
                            }
                            else if (e.v.GenerationalLevel == NULL)
                            {
                                e.v.GenerationalLevel = e.u.GenerationalLevel;
                            }
                        }
                    }
                }
            }

            //normalize the levels
            foreach (PedigreeCouple couple in couples)
            {
                couple.GenerationalLevel -= minGenerationalLevel;
            }

            //store the (normalized) max level in the model
            this.maxGenerationalLevel = maxGenerationalLevel - minGenerationalLevel;

            //when a parent set of half siblings (father, mother, father)
            //is detedted, the mother id is added to this list. If a
            //couple involving this mother is detected later, this
            //list is checked to see if she has already been counted.
            List <int> halfSiblingParentsMotherIds = new List <int>();

            //derive individual sets
            foreach (PedigreeCouple couple in couples)
            {
                //add the [mother,father] individual sets
                if (couple.mother != null && couple.father != null)
                {
                    if (couple.mother.Parents == null && couple.father.Parents == null)
                    {
                        //if the mother has a single spouse
                        if (couple.mother.spouseCouples.Count == 1)
                        {
                            PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple);
                            parentsIndividualSet.Add(couple.mother);
                            parentsIndividualSet.Add(couple.father);
                            AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet);
                        }
                        //if the mother has a two spouses
                        else if (couple.mother.spouseCouples.Count == 2)
                        {
                            //collapse parents of half siblings into a single individual set
                            if (!halfSiblingParentsMotherIds.Contains(couple.mother.HraPerson.relativeID))
                            {
                                halfSiblingParentsMotherIds.Add(couple.mother.HraPerson.relativeID);
                                PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple);
                                parentsIndividualSet.Add(couple.mother);
                                parentsIndividualSet.Add(couple.mother.spouseCouples[0].father);
                                parentsIndividualSet.Add(couple.mother.spouseCouples[1].father);
                                AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet);
                            }
                        }
                    }

                    try
                    {
                        //add the children individual sets
                        PedigreeIndividualSet childrenIndividualSet = new PedigreeIndividualSet(couple);
                        foreach (PedigreeIndividual child in couple.children)
                        {
                            childrenIndividualSet.Add(child);
                            foreach (PedigreeCouple pc in child.spouseCouples)
                            {
                                if (pc.mother.HraPerson.relativeID == child.HraPerson.relativeID)
                                {
                                    childrenIndividualSet.Add(pc.father);
                                }
                                else
                                {
                                    childrenIndividualSet.Add(pc.mother);
                                }
                            }
                        }
                        AddIndividualSet(couple.GenerationalLevel + 1, childrenIndividualSet);
                    }
                    catch (Exception e)
                    {
                        Logger.Instance.WriteToLog(e.ToString());
                    }
                }
            }

            if (individualsDictionary.ContainsKey(1))
            {
                SetBloodRelatives(individualsDictionary[1]);
            }

            foreach (PedigreeIndividual pi in individuals)
            {
                if (pi.bloodRelative == false)
                {
                    if (pi.spouseCouples.Count == 0)
                    {
                        pi.bloodRelative = true;
                    }
                    else
                    {
                        bool bloodFound = false;
                        foreach (PedigreeCouple pc in pi.spouseCouples)
                        {
                            if ((pc.mother != null) && (pc.father != null))
                            {
                                if (pc.mother.bloodRelative == true || pc.father.bloodRelative == true)
                                {
                                    bloodFound = true;
                                }
                            }
                        }
                        if (bloodFound == false)
                        {
                            foreach (PedigreeCouple pc in pi.spouseCouples)
                            {
                                if (pc.mother != null)
                                {
                                    pc.mother.bloodRelative = true;
                                }
                                if (pc.father != null)
                                {
                                    pc.father.bloodRelative = true;
                                }
                            }
                        }
                    }
                }
            }
            this.FamilialVariants = p_familyHistory.ReloadFamilialVariants();
        }
コード例 #5
0
ファイル: PedigreeCoupleEdge.cs プロジェクト: mahitosh/HRA4
 public PedigreeCoupleEdge(PedigreeCouple u, PedigreeCouple v,bool intergenerational)
 {
     this.u = u;
     this.v = v;
     this.intergenerational = intergenerational;
 }
コード例 #6
0
 public PedigreeIndividualSet(PedigreeCouple associatedCouple)
 {
     this.associatedCouple = associatedCouple;
 }
コード例 #7
0
ファイル: StaticLayout.cs プロジェクト: mahitosh/HRA4
        private static void MoveChildren(double dx, PedigreeCouple couple, PedigreeModel model)
        {
            foreach (PedigreeIndividual child in couple.children)
            {
                child.point.x += dx;
                child.wasMoved = true;
                foreach (PedigreeCouple pc in child.spouseCouples)
                {

                    PedigreeIndividual spouse;
                    if (child.HraPerson.relativeID == pc.mother.HraPerson.relativeID)
                        spouse = pc.father;
                    else
                        spouse = pc.mother;

                    if (spouse.Parents != null)
                    {
                        PedigreeCouple nestedCouple = GetCoupleFromLR(model, child, spouse);
                        if (nestedCouple != null)
                            MoveChildren(dx / 2, nestedCouple, model);
                    }
                    else
                    {
                        spouse.point.x += dx;
                        spouse.wasMoved = true;
                        PedigreeCouple nestedCouple = GetCoupleFromLR(model, child, spouse);
                        if (nestedCouple != null)
                            MoveChildren(dx / 2, nestedCouple, model);

                    }

                }
            }
        }
コード例 #8
0
ファイル: PedigreeModel.cs プロジェクト: mahitosh/HRA4
 public CoupleID(PedigreeCouple couple)
 {
     fatherId = couple.father.HraPerson.relativeID;
     motherId = couple.mother.HraPerson.relativeID;
 }
コード例 #9
0
ファイル: PedigreeModel.cs プロジェクト: mahitosh/HRA4
        public PedigreeModel(FamilyHistory p_familyHistory)
        {
            familyHistory = p_familyHistory;

            //Store the individuals as PedigreeIndividuals
            lock (familyHistory.Relatives)
            {
                foreach (Person Person in familyHistory.Relatives)
                {
                    PedigreeIndividual pedigreeIndividual = new PedigreeIndividual(Person);
                    individuals.Add(pedigreeIndividual);
                    individualsDictionary[Person.relativeID] = pedigreeIndividual;
                    points.Add(pedigreeIndividual.point);
                }
            }
            //here keys are the couple ids, values are the couples to which they map
            couplesDictionary = new Dictionary<CoupleID, PedigreeCouple>();

            //Link PedigreeIndividuals with their parents in the object model, derive couples
            foreach (PedigreeIndividual child in individuals)
            {
                //determine whether or not each parent exists in the data
                bool hasMother = individualsDictionary.ContainsKey(child.HraPerson.motherID);
                bool hasFather = individualsDictionary.ContainsKey(child.HraPerson.fatherID);
                CoupleID coupleId = new CoupleID(child.HraPerson.fatherID, child.HraPerson.motherID);
                if (hasMother || hasFather)
                {
                    //link individuals with their parents in the object model, forming a pointer graph
                    if (hasMother)
                        child.Mother = individualsDictionary[child.HraPerson.motherID];
                    if (hasFather)
                        child.Father = individualsDictionary[child.HraPerson.fatherID];

                    //derive couples and store them
                    {
                        //if this individual has parents, set it's "parents" pointer to the
                        //couple representing it's parents (deriving couples from the data as needed).

                        //get the parents couple
                        PedigreeCouple parents = null;
                        {
                            //check if the parents have already been stored as a couple

                            if (couplesDictionary.ContainsKey(coupleId))
                                //if so, then use the previously stored couple.
                                parents = couplesDictionary[coupleId];
                            else
                            {
                                //if not store parents as a couple if they haven't been already
                                parents = new PedigreeCouple(child.Mother, child.Father);
                                couplesDictionary[coupleId] = parents;
                                couples.Add(parents);
                                points.Add(parents.point);

                                //link participating individuals with the new couple
                                if (child.Mother != null)
                                    if (child.Mother.spouseCouples != null)
                                        child.Mother.spouseCouples.Add(parents);

                                if (child.Father != null)
                                    if (child.Father.spouseCouples != null)
                                        child.Father.spouseCouples.Add(parents);
                            }
                        }
                        //set this individual's "parents" pointer to the parents couple
                        child.Parents = parents;

                        //add the child to the children of the parents couple
                        parents.children.Add(child);
                    }
                }
            }

            // derive the intergenerational edges of the couples graph
            foreach (PedigreeIndividual parent in individuals)
            {
                bool parentHasGrandparents = parent.Parents != null;
                bool parentIsPartOfACouple = parent.spouseCouples.Count != 0;

                if (parentHasGrandparents && parentIsPartOfACouple)
                {
                    foreach (PedigreeCouple parents in parent.spouseCouples)
                    {
                        PedigreeCouple grandparents = parent.Parents;
                        bool intergenerational = true;
                        coupleEdges.Add(new PedigreeCoupleEdge(grandparents, parents, intergenerational));
                    }
                }
            }

            // derive the intragenerational edges of the couples graph
            // (from half sibling relationships)
            foreach (PedigreeIndividual parent in individuals)
            {
                if (parent.spouseCouples.Count == 2)
                {
                    PedigreeCouple u = parent.spouseCouples[0];
                    PedigreeCouple v = parent.spouseCouples[1];
                    bool intergenerational = false;
                    coupleEdges.Add(new PedigreeCoupleEdge(u, v, intergenerational));
                }
                //else if (parent.spouseCouples.Count > 2)
                //    throw new Exception("Pedigree not drawable: individual " + parent.relativeID + " has more than two spouses");
            }

            //derive generational levels
            bool undefinedLevelsRemain = true;
            int minGenerationalLevel = 0;
            int maxGenerationalLevel = 0;
            if (couples.Count > 0)
            {
                //assign the seed level
                couples[0].GenerationalLevel = 0;

                //propagate the seed level through the graph
                int NULL = PedigreeCouple.UNDEFINED_GENERATION;
                while (undefinedLevelsRemain)
                {
                    undefinedLevelsRemain = false;
                    foreach (PedigreeCoupleEdge e in coupleEdges)
                    {
                        if (e.intergenerational)
                        {
                            PedigreeCouple grandparents = e.u;
                            PedigreeCouple parents = e.v;

                            bool parentsHaveLevel = parents.GenerationalLevel != NULL;
                            bool grandparentsHaveLevel = grandparents.GenerationalLevel != NULL;

                            if (!parentsHaveLevel || !grandparentsHaveLevel)
                                undefinedLevelsRemain = true;

                            if (!parentsHaveLevel && !grandparentsHaveLevel)
                            {
                                undefinedLevelsRemain = false;
                            }

                            if (parentsHaveLevel && !grandparentsHaveLevel)
                            {
                                grandparents.GenerationalLevel = parents.GenerationalLevel - 1;
                                if (grandparents.GenerationalLevel < minGenerationalLevel)
                                    minGenerationalLevel = grandparents.GenerationalLevel;
                            }
                            else if (!parentsHaveLevel && grandparentsHaveLevel)
                            {
                                parents.GenerationalLevel = grandparents.GenerationalLevel + 1;
                                if (parents.GenerationalLevel > maxGenerationalLevel)
                                    maxGenerationalLevel = parents.GenerationalLevel;
                            }

                        }
                        else
                        {
                            //propagate levels through intragenerational edges (half siblings)
                            if (e.u.GenerationalLevel == NULL)
                                e.u.GenerationalLevel = e.v.GenerationalLevel;
                            else if (e.v.GenerationalLevel == NULL)
                                e.v.GenerationalLevel = e.u.GenerationalLevel;
                        }
                    }
                }
            }

            //normalize the levels
            foreach (PedigreeCouple couple in couples)
                couple.GenerationalLevel -= minGenerationalLevel;

            //store the (normalized) max level in the model
            this.maxGenerationalLevel = maxGenerationalLevel - minGenerationalLevel;

            //when a parent set of half siblings (father, mother, father)
            //is detedted, the mother id is added to this list. If a
            //couple involving this mother is detected later, this
            //list is checked to see if she has already been counted.
            List<int> halfSiblingParentsMotherIds = new List<int>();

            //derive individual sets
            foreach (PedigreeCouple couple in couples)
            {
                //add the [mother,father] individual sets
                if (couple.mother != null && couple.father != null)
                {
                    if (couple.mother.Parents == null && couple.father.Parents == null)
                    {
                        //if the mother has a single spouse
                        if (couple.mother.spouseCouples.Count == 1)
                        {
                            PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple);
                            parentsIndividualSet.Add(couple.mother);
                            parentsIndividualSet.Add(couple.father);
                            AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet);
                        }
                        //if the mother has a two spouses
                        else if (couple.mother.spouseCouples.Count == 2)
                        {
                            //collapse parents of half siblings into a single individual set
                            if (!halfSiblingParentsMotherIds.Contains(couple.mother.HraPerson.relativeID))
                            {
                                halfSiblingParentsMotherIds.Add(couple.mother.HraPerson.relativeID);
                                PedigreeIndividualSet parentsIndividualSet = new PedigreeIndividualSet(couple);
                                parentsIndividualSet.Add(couple.mother);
                                parentsIndividualSet.Add(couple.mother.spouseCouples[0].father);
                                parentsIndividualSet.Add(couple.mother.spouseCouples[1].father);
                                AddIndividualSet(couple.GenerationalLevel, parentsIndividualSet);
                            }
                        }
                    }

                    try
                    {

                        //add the children individual sets
                        PedigreeIndividualSet childrenIndividualSet = new PedigreeIndividualSet(couple);
                        foreach (PedigreeIndividual child in couple.children)
                        {
                            childrenIndividualSet.Add(child);
                            foreach (PedigreeCouple pc in child.spouseCouples)
                            {
                                if (pc.mother.HraPerson.relativeID == child.HraPerson.relativeID)
                                {
                                    childrenIndividualSet.Add(pc.father);
                                }
                                else
                                {
                                    childrenIndividualSet.Add(pc.mother);
                                }
                            }
                        }
                        AddIndividualSet(couple.GenerationalLevel + 1, childrenIndividualSet);
                    }
                    catch (Exception e)
                    {
                        Logger.Instance.WriteToLog(e.ToString());
                    }
                }
            }

            if (individualsDictionary.ContainsKey(1))
                SetBloodRelatives(individualsDictionary[1]);

            foreach(PedigreeIndividual pi in individuals)
            {
                if (pi.bloodRelative == false)
                {
                    if (pi.spouseCouples.Count == 0)
                    {
                        pi.bloodRelative = true;
                    }
                    else
                    {
                        bool bloodFound = false;
                        foreach (PedigreeCouple pc in pi.spouseCouples)
                        {
                            if ((pc.mother != null) && (pc.father != null))
                            {
                                if (pc.mother.bloodRelative == true || pc.father.bloodRelative == true)
                                    bloodFound = true;
                            }
                        }
                        if (bloodFound == false)
                        {
                            foreach (PedigreeCouple pc in pi.spouseCouples)
                            {
                                if (pc.mother != null) pc.mother.bloodRelative = true;
                                if (pc.father != null) pc.father.bloodRelative = true;
                            }
                        }
                    }
                }
            }
            this.FamilialVariants = p_familyHistory.ReloadFamilialVariants();
        }
コード例 #10
0
ファイル: PedigreeCoupleEdge.cs プロジェクト: mahitosh/HRA4
 public PedigreeCoupleEdge(PedigreeCouple u, PedigreeCouple v, bool intergenerational)
 {
     this.u = u;
     this.v = v;
     this.intergenerational = intergenerational;
 }
コード例 #11
0
ファイル: LayoutCouples.cs プロジェクト: mahitosh/HRA4
        private static void pullParents(PedigreeModel model, PedigreeCouple couple, bool fatherToLeft)
        {
            double halfHSpacing = model.parameters.horizontalSpacing / 2;
            double reversal = fatherToLeft ? 1 : -1;
            //position the father to the left
            {
                double goalX = couple.point.x - reversal * halfHSpacing;
                PointWithVelocity point = couple.father.point;
                double strength = model.parameters.layoutCouplesStrength;
                PedigreeUtils.PullTowardX(goalX, point, strength, model);
            }

            //position the mother to the right
            {
                double goalX = couple.point.x + reversal * halfHSpacing;
                PointWithVelocity point = couple.mother.point;
                double strength = model.parameters.layoutCouplesStrength;
                PedigreeUtils.PullTowardX(goalX, point, strength, model);
            }
        }
コード例 #12
0
ファイル: FamilyHistory.cs プロジェクト: mahitosh/HRA4
        internal void LinkRelative(Person person, PedigreeCouple newParents)
        {
            person.Person_motherID = newParents.mother.HraPerson.relativeID;
            person.Person_fatherID = newParents.father.HraPerson.relativeID;
            string newRelationsip = "";
            string newRelationsipOther = "";
            string newBloodline = "";

            //newParents.children.Add(
            Relationship.SetRelationshipByChildType(Gender.Parse(person.gender),
                                                    Relationship.Parse(newParents.mother.HraPerson.relationship), Bloodline.Parse(newParents.mother.HraPerson.bloodline),
                                                    out newRelationsip, out newRelationsipOther,
                                                    out newBloodline);

            person.Person_relationship = newRelationsip;
            person.Person_relationshipOther = newRelationsipOther;
            person.Person_bloodline = newBloodline;
        }