| 27 |
return; |
return; |
| 28 |
} |
} |
| 29 |
|
|
| 30 |
void BakeryGateway::ViewTreeBrowser::AddParentInTree(SmartPtr< GEDCOMParser::IndividualRecord > const &child, SmartPtr< GEDCOMParser::IndividualRecord > const & parent, GEDCOMParser::IndividualRecords_t * children) |
void BakeryGateway::ViewTreeBrowser::AddParentInTree(GEDCOMParser::IndividualRecord const * const child, GEDCOMParser::IndividualRecord * const parent, std::vector<GEDCOMParser::IndividualRecord *> * children) |
| 31 |
{ |
{ |
| 32 |
std::string individu_name; |
std::string individu_name; |
| 33 |
|
|
| 34 |
if (!(parent.Null())) |
if (parent != 0) |
| 35 |
{ |
{ |
| 36 |
individu_name = getIndividualName(parent); |
individu_name = getIndividualName(parent); |
| 37 |
if (_mmi_browser.addParent(child->getId(), parent->getId(), individu_name) == 1) |
if (_mmi_browser.addParent(child->getId(), parent->getId(), individu_name) == 1) |
| 38 |
{ |
{ |
| 39 |
(*children)[parent->getId()] = parent; |
children->push_back(parent); |
| 40 |
} |
} |
| 41 |
} |
} |
| 42 |
return; |
return; |
| 43 |
} |
} |
| 44 |
|
|
| 45 |
std::string const BakeryGateway::ViewTreeBrowser::getIndividualName(SmartPtr<GEDCOMParser::IndividualRecord> const & individual) |
std::string const BakeryGateway::ViewTreeBrowser::getIndividualName(GEDCOMParser::IndividualRecord const * const individual) |
| 46 |
{ |
{ |
| 47 |
std::string individual_name; |
std::string individual_name; |
| 48 |
if (individual->getPersonalNames().size() > 0) |
if (individual->getPersonalNames().size() > 0) |
| 60 |
{ |
{ |
| 61 |
_mmi_browser.clear(); |
_mmi_browser.clear(); |
| 62 |
GEDCOMParser::IndividualRecords_t individuals = _local_document->getIndividualRecords(); |
GEDCOMParser::IndividualRecords_t individuals = _local_document->getIndividualRecords(); |
| 63 |
|
std::vector<GEDCOMParser::IndividualRecord *> children; |
| 64 |
|
std::vector<GEDCOMParser::IndividualRecord *> * tmp_children = 0; |
| 65 |
if (individuals.size() > 0) |
if (individuals.size() > 0) |
| 66 |
{ |
{ |
| 67 |
GEDCOMParser::IndividualRecords_t children; |
if (_parent_entity != 0) |
| 68 |
GEDCOMParser::IndividualRecords_t * tmp_children = 0; |
{ |
| 69 |
|
GEDCOMParser::IndividualRecord * child = _parent_entity; |
| 70 |
std::string individu_name; |
std::string individu_name; |
| 71 |
|
|
| 72 |
children = get_document()->getRootIndividuals(); |
individu_name = getIndividualName(child); |
| 73 |
SmartPtr<GEDCOMParser::IndividualRecord> parent; |
_mmi_browser.addParent("", child->getId(), individu_name); |
| 74 |
|
children.push_back(child); |
| 75 |
|
|
| 76 |
for (GEDCOMParser::IndividualRecords_t::const_iterator child_iter = children.begin(); child_iter != children.end() ; child_iter++) |
SmartPtr<GEDCOMParser::IndividualRecord> parent; |
| 77 |
{ |
while (children.size() > 0) |
|
individu_name = getIndividualName(child_iter->second); |
|
|
_mmi_browser.addParent("", child_iter->second->getId(), individu_name); |
|
|
} |
|
|
while (children.size() > 0) |
|
|
{ |
|
|
tmp_children = new GEDCOMParser::IndividualRecords_t; |
|
|
for (GEDCOMParser::IndividualRecords_t::const_iterator child_iter = children.begin(); child_iter != children.end() ; child_iter++) |
|
| 78 |
{ |
{ |
| 79 |
parent = get_document()->getIndividualParent(child_iter->second.getPtr(), GEDCOMParser::LineageLinkageGedcom::e_Husband); |
tmp_children = new std::vector<GEDCOMParser::IndividualRecord *>; |
| 80 |
AddParentInTree(child_iter->second, parent, tmp_children); |
for (std::vector<GEDCOMParser::IndividualRecord *>::const_iterator child_iter = children.begin(); child_iter != children.end() ; child_iter++) |
| 81 |
|
{ |
| 82 |
parent = get_document()->getIndividualParent(child_iter->second.getPtr(), GEDCOMParser::LineageLinkageGedcom::e_Wife); |
parent = get_document()->getIndividualParent(*child_iter, GEDCOMParser::LineageLinkageGedcom::e_Husband); |
| 83 |
AddParentInTree(child_iter->second, parent, tmp_children); |
if (!parent.Null()) |
| 84 |
} |
{ |
| 85 |
children = (*tmp_children); |
AddParentInTree(*child_iter, parent.getPtr(), tmp_children); |
| 86 |
delete tmp_children; tmp_children = 0; |
} |
| 87 |
} |
|
| 88 |
|
parent = get_document()->getIndividualParent(*child_iter, GEDCOMParser::LineageLinkageGedcom::e_Wife); |
| 89 |
|
if (!parent.Null()) |
| 90 |
|
{ |
| 91 |
|
AddParentInTree(*child_iter, parent.getPtr(), tmp_children); |
| 92 |
|
} |
| 93 |
|
} |
| 94 |
|
children = (*tmp_children); |
| 95 |
|
delete tmp_children; tmp_children = 0; |
| 96 |
|
} |
| 97 |
|
} |
| 98 |
} |
} |
| 99 |
_mmi_browser.show(); |
_mmi_browser.show(); |
| 100 |
return; |
return; |