Пример #1
0
        public CommonStats GetCommonStats()
        {
            CommonStats stats = new CommonStats();

            int num = fSelectedRecords.Count;

            for (int i = 0; i < num; i++)
            {
                GDMRecord rec = fSelectedRecords[i];
                if (rec.RecordType != GDMRecordType.rtIndividual)
                {
                    continue;
                }

                GDMIndividualRecord ind = (GDMIndividualRecord)rec;
                stats.persons++;

                switch (ind.Sex)
                {
                case GDMSex.svFemale:
                    stats.persons_f++;
                    if (ind.IsLive())
                    {
                        stats.lives_f++;
                        stats.lives++;
                    }
                    break;

                case GDMSex.svMale:
                    stats.persons_m++;
                    if (ind.IsLive())
                    {
                        stats.lives_m++;
                        stats.lives++;
                    }
                    break;
                }

                string vAge = GKUtils.GetAgeStr(ind, -1);
                stats.age.TakeVal(vAge, ind.Sex, true);

                string vLife = GKUtils.GetLifeExpectancyStr(ind);
                stats.life.TakeVal(vLife, ind.Sex, true);

                int chCnt = fTree.GetTotalChildrenCount(ind);
                stats.childs.TakeVal(chCnt, ind.Sex, true);

                int vFba = GKUtils.GetFirstbornAge(ind, GKUtils.GetFirstborn(fTree, ind));
                stats.fba.TakeVal(vFba, ind.Sex, true);

                int mCnt = GKUtils.GetMarriagesCount(ind);
                stats.marr.TakeVal(mCnt, ind.Sex, true);

                int vMAge = GKUtils.GetMarriageAge(fTree, ind);
                stats.mage.TakeVal(vMAge, ind.Sex, true);

                float vCI = ind.GetCertaintyAssessment();
                stats.cIndex.TakeVal(vCI, ind.Sex, false);
            }

            return(stats);
        }