private Pedigrees GetPedigree(string ident, bool checkErrors = false) { // I4 is child of I2 // I2 is biologic child of I1 // I2 is adopted child of I3 // I5 is unrelated var txt = "0 @I1@ INDI\n1 FAMS @F2@\n" + "0 @I2@ INDI\n1 ADOP\n2 FAMC @F3@\n1 FAMC @F2@\n1 FAMS @F1@\n" + "0 @I3@ INDI\n1 FAMS @F3@\n" + "0 @I4@ INDI\n1 FAMC @F1@\n" + "0 @I5@ INDI\n" + "0 @F1@ FAM\n1 HUSB @I2@\n1 CHIL @I4@\n" + "0 @F2@ FAM\n1 HUSB @I1@\n1 CHIL @I2@\n" + "0 @F3@ FAM\n1 HUSB @I3@\n1 CHIL @I2@\n"; Forest f = LoadGEDFromStream(txt); Assert.IsNotNull(f, ident); if (checkErrors) { Assert.AreEqual(0, f.ErrorsCount); Assert.AreEqual(0, f.Errors.Count); } Person p = f.PersonById(ident); Assert.IsNotNull(p, ident); Pedigrees pd = new Pedigrees(p, false); Assert.IsNotNull(pd, ident); return(pd); }
private void Form1_LoadGed(object sender, EventArgs e) { //logit("LoadGed 1", true); Forest gedtrees = new Forest(); // TODO Using LastFile is a hack... pass path in args? not as event? gedtrees.LoadGEDCOM(LastFile); //logit("LoadGed 2"); // populate combobox with individuals // www.ahnenbuch.de-AMMON has multiple individuals with the same name. Need to distinguish // them somehow for the combobox. // TODO is there a better way? unique thing for combobox selection? HashSet <string> comboNames = new HashSet <string>(); foreach (var indiId in gedtrees.AllIndiIds) { Person p = gedtrees.PersonById(indiId); // for each person, show the # of individuals available in (first) pedigree Pedigrees pd = new Pedigrees(p, firstOnly: true); p.Ahnen = pd.GetPedigreeMax(0); var text = string.Format("{0} [{1}] ({2})", p.Name, indiId, p.Ahnen); comboNames.Add(text); _cmbItems.Add(new { Text = text, Value = p }); } cmbPerson.DisplayMember = "Text"; cmbPerson.ValueMember = "Value"; cmbPerson.DataSource = _cmbItems; cmbPerson.Enabled = true; //logit("LoadGed 4"); }
private void TreePerson(Person val) { _pedigrees = new Pedigrees(val, firstOnly: false); // TODO currently re-calculating - any benefit from caching these? updatePedigreeList(_pedigrees); _ancIndi = _pedigrees.GetPedigree(0); DoAncTree(); }
private void updatePedigreeList(Pedigrees p) { _noUpdate = true; int count = p.PedigreeCount; cmbPedigree.DataSource = null; // force rebuild when pedigree count changes if (count < 2) { cmbPedigree.Enabled = false; } else { // Establish list of pedigrees _cmbPedItems.Clear(); for (int i = 1; i <= count; i++) { string text = string.Format("Pedigree {0}", i); _cmbPedItems.Add(new { Text = text, Value = (i - 1) }); } cmbPedigree.DataSource = _cmbPedItems; cmbPedigree.DisplayMember = "Text"; cmbPedigree.ValueMember = "Value"; cmbPedigree.SelectedIndex = 0; cmbPedigree.Enabled = true; } _noUpdate = false; }
private void cmbSelectPerson_SelectedIndexChanged(object sender, EventArgs e) { var val = cmbPerson.SelectedValue as Person; if (val == null) { return; } _pedigrees = new Pedigrees(val, firstOnly: false); // TODO currently re-calculating - any benefit from caching these? //updatePedigreeList(_pedigrees); // TODO ability to select from alternate pedigrees _ancIndi = _pedigrees.GetPedigree(0); _pedDraw.Ancestors = _ancIndi; _ped5Draw.Ancestors = _ancIndi; fillWeb(); }
void Form1_LoadGed(object sender, EventArgs e) { gedtrees = new Forest(); gedtrees.LoadGEDCOM(LastFile); DateEstimator.Estimate(gedtrees); foreach (var union in gedtrees.AllUnions) { var text = union.Id; // TODO add spouse names _cmbItems.Add(new { Text = text, Value = union }); } cmbFamilies.DisplayMember = "Text"; cmbFamilies.ValueMember = "Value"; cmbFamilies.DataSource = _cmbItems; cmbFamilies.SelectedIndex = 0; cmbFamilies.Enabled = rbFamGroup.Checked; // populate combobox with individuals // www.ahnenbuch.de-AMMON has multiple individuals with the same name. Need to distinguish // them somehow for the combobox. // TODO is there a better way? unique thing for combobox selection? HashSet <string> comboNames = new HashSet <string>(); foreach (var indiId in gedtrees.AllIndiIds) { Person p = gedtrees.PersonById(indiId); // for each person, show the # of individuals available in (first) pedigree Pedigrees pd = new Pedigrees(p, firstOnly: true); p.Ahnen = pd.GetPedigreeMax(0); var text = string.Format("{0} [{1}] ({2})", p.Name, indiId, p.Ahnen); comboNames.Add(text); _cmbPedItems.Add(new { Text = text, Value = p }); } cmbPerson.DisplayMember = "Text"; cmbPerson.ValueMember = "Value"; cmbPerson.DataSource = _cmbPedItems; cmbPerson.SelectedIndex = 0; cmbPerson.Enabled = !rbFamGroup.Checked; }