public void UpdateCommonStats()
        {
            CommonStats stats = fTreeStats.GetCommonStats();

            fView.Summary.BeginUpdate();
            try {
                fView.Summary.ClearItems();

                fView.Summary.AddItem(null, LangMan.LS(LSID.LSID_People),
                                      stats.persons.ToString(),
                                      stats.persons_m.ToString() + GetPercent(stats.persons_m, stats.persons),
                                      stats.persons_f.ToString() + GetPercent(stats.persons_f, stats.persons));

                fView.Summary.AddItem(null, LangMan.LS(LSID.LSID_Living),
                                      stats.lives.ToString(),
                                      stats.lives_m.ToString(),
                                      stats.lives_f.ToString());

                fView.Summary.AddItem(null, LangMan.LS(LSID.LSID_Deads),
                                      (stats.persons - stats.lives).ToString(),
                                      (stats.persons_m - stats.lives_m).ToString(),
                                      (stats.persons_f - stats.lives_f).ToString());

                AddCompositeItem(LSID.LSID_AvgAge, stats.age);
                AddCompositeItem(LSID.LSID_AvgLife, stats.life);
                AddCompositeItem(LSID.LSID_AvgChilds, stats.childs);
                AddCompositeItem(LSID.LSID_AvgBorn, stats.fba);
                AddCompositeItem(LSID.LSID_AvgMarriagesCount, stats.marr);
                AddCompositeItem(LSID.LSID_AvgMarriagesAge, stats.mage);
                AddCompositeItem(LSID.LSID_CertaintyIndex, stats.cIndex);
            } finally {
                fView.Summary.EndUpdate();
            }
        }
예제 #2
0
        private void UpdateCommonStats()
        {
            CommonStats stats = fTreeStats.GetCommonStats();

            lvSummary.Items.Clear();

            ListViewItem item = lvSummary.Items.Add(LangMan.LS(LSID.LSID_People));

            item.SubItems.Add(stats.persons.ToString());
            item.SubItems.Add(stats.persons_m.ToString() + GetPercent(stats.persons_m, stats.persons));
            item.SubItems.Add(stats.persons_f.ToString() + GetPercent(stats.persons_f, stats.persons));

            item = lvSummary.Items.Add(LangMan.LS(LSID.LSID_Living));
            item.SubItems.Add(stats.lives.ToString());
            item.SubItems.Add(stats.lives_m.ToString());
            item.SubItems.Add(stats.lives_f.ToString());

            item = lvSummary.Items.Add(LangMan.LS(LSID.LSID_Deads));
            item.SubItems.Add((stats.persons - stats.lives).ToString());
            item.SubItems.Add((stats.persons_m - stats.lives_m).ToString());
            item.SubItems.Add((stats.persons_f - stats.lives_f).ToString());

            AddCompositeItem(LSID.LSID_AvgAge, stats.age);
            AddCompositeItem(LSID.LSID_AvgLife, stats.life);
            AddCompositeItem(LSID.LSID_AvgChilds, stats.childs);
            AddCompositeItem(LSID.LSID_AvgBorn, stats.fba);
            AddCompositeItem(LSID.LSID_AvgMarriagesCount, stats.marr);
            AddCompositeItem(LSID.LSID_AvgMarriagesAge, stats.mage);
            AddCompositeItem(LSID.LSID_CertaintyIndex, stats.cIndex);
        }
예제 #3
0
        protected override void InternalGenerate()
        {
            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont = fWriter.CreateFont("", 22f, true, false, clrBlack);
            fChapFont  = fWriter.CreateFont("", 16f, true, false, clrBlack);
            fTextFont  = fWriter.CreateFont("", 10f, false, false, clrBlack);

            var stats = new TreeStats(fBase.Context, fBase.GetContentList(GDMRecordType.rtIndividual));

            fStats = stats.GetCommonStats();

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taLeft);

            var personRange = GetIndividualDates(fPerson);

            fWriter.AddParagraph(GetPersonalInfo(fPerson), fChapFont, TextAlignment.taLeft);

            fWriter.BeginList();

            var       enumer = fBase.Context.Tree.GetEnumerator(GDMRecordType.rtIndividual);
            GDMRecord record;

            while (enumer.MoveNext(out record))
            {
                var iRec     = record as GDMIndividualRecord;
                var indRange = GetIndividualDates(iRec);
                try {
                    if (personRange.IsOverlapped(indRange))
                    {
                        fWriter.AddListItem(" " + GetPersonalInfo(iRec), fTextFont);
                    }
                } catch (Exception ex) {
                    Logger.LogWrite("ContemporariesReport.InternalGenerate(): " + ex.Message);
                }
            }

            fWriter.EndList();
        }
예제 #4
0
        public void Test_Stats()
        {
            CompositeItem compositeItem = new CompositeItem();

            Assert.IsNotNull(compositeItem);
            compositeItem.TakeVal(0.0f, GDMSex.svMale, true);
            Assert.AreEqual(0, compositeItem.CommonVal);
            Assert.AreEqual(0, compositeItem.MaleVal);
            Assert.AreEqual(0, compositeItem.FemaleVal);
            compositeItem.TakeVal(1f, GDMSex.svFemale, true);
            compositeItem.TakeVal(1f, GDMSex.svMale, true);
            Assert.AreEqual(1, compositeItem.CommonVal);
            Assert.AreEqual(1, compositeItem.MaleVal);
            Assert.AreEqual(1, compositeItem.FemaleVal);
            compositeItem.TakeVal("1", GDMSex.svFemale, true);
            compositeItem.TakeVal("1", GDMSex.svMale, true);
            Assert.AreEqual(1, compositeItem.CommonVal);
            Assert.AreEqual(1, compositeItem.MaleVal);
            Assert.AreEqual(1, compositeItem.FemaleVal);

            StatsItem statsItem = new StatsItem("test", false);

            Assert.IsNotNull(statsItem);
            Assert.AreEqual("test", statsItem.ToString());

            statsItem = new StatsItem("test2", 0);
            Assert.IsNotNull(statsItem);
            Assert.AreEqual("test2", statsItem.ToString());

            List <GDMRecord>      selectedRecords = new List <GDMRecord>();
            IGEDCOMTreeEnumerator iEnum           = fContext.Tree.GetEnumerator(GDMRecordType.rtIndividual);
            GDMRecord             current;

            while (iEnum.MoveNext(out current))
            {
                selectedRecords.Add(current);
            }

            TreeStats treeStats = new TreeStats(fContext, selectedRecords);

            Assert.IsNotNull(treeStats);

            CommonStats commonStats = treeStats.GetCommonStats();

            Assert.IsNotNull(commonStats);
            Assert.AreEqual(6, commonStats.persons, "Stats.TotalPersons");
            Assert.AreEqual(2, commonStats.persons_m, "Stats.SumM");
            Assert.AreEqual(4, commonStats.persons_f, "Stats.SumF");

            List <StatsItem> values = new List <StatsItem>();

            treeStats.GetSpecStats(StatsMode.smAncestors, values);
            treeStats.GetSpecStats(StatsMode.smDescendants, values);
            treeStats.GetSpecStats(StatsMode.smDescGenerations, values);
            treeStats.GetSpecStats(StatsMode.smSurnames, values);
            treeStats.GetSpecStats(StatsMode.smNames, values);
            treeStats.GetSpecStats(StatsMode.smPatronymics, values);
            treeStats.GetSpecStats(StatsMode.smAge, values);
            treeStats.GetSpecStats(StatsMode.smLifeExpectancy, values);
            treeStats.GetSpecStats(StatsMode.smBirthYears, values);
            treeStats.GetSpecStats(StatsMode.smBirthTenYears, values);
            treeStats.GetSpecStats(StatsMode.smDeathYears, values);
            treeStats.GetSpecStats(StatsMode.smDeathTenYears, values);
            treeStats.GetSpecStats(StatsMode.smChildsCount, values);
            treeStats.GetSpecStats(StatsMode.smChildsDistribution, values);
            treeStats.GetSpecStats(StatsMode.smBirthPlaces, values);
            treeStats.GetSpecStats(StatsMode.smDeathPlaces, values);
            treeStats.GetSpecStats(StatsMode.smResidences, values);
            treeStats.GetSpecStats(StatsMode.smOccupation, values);
            treeStats.GetSpecStats(StatsMode.smReligious, values);
            treeStats.GetSpecStats(StatsMode.smNational, values);
            treeStats.GetSpecStats(StatsMode.smEducation, values);
            treeStats.GetSpecStats(StatsMode.smCaste, values);
            treeStats.GetSpecStats(StatsMode.smFirstbornAge, values);
            treeStats.GetSpecStats(StatsMode.smMarriages, values);
            treeStats.GetSpecStats(StatsMode.smMarriageAge, values);
            treeStats.GetSpecStats(StatsMode.smSpousesDiff, values);
            treeStats.GetSpecStats(StatsMode.smHobby, values);
            treeStats.GetSpecStats(StatsMode.smAward, values);
            treeStats.GetSpecStats(StatsMode.smMili, values);
            treeStats.GetSpecStats(StatsMode.smMiliInd, values);
            treeStats.GetSpecStats(StatsMode.smMiliDis, values);
            treeStats.GetSpecStats(StatsMode.smMiliRank, values);
            treeStats.GetSpecStats(StatsMode.smAAF_1, values);
            treeStats.GetSpecStats(StatsMode.smAAF_2, values);
            treeStats.GetSpecStats(StatsMode.smCertaintyIndex, values);
            treeStats.GetSpecStats(StatsMode.smBirthByMonth, values);
            treeStats.GetSpecStats(StatsMode.smDemography, values);
        }