| 20 |
|
|
| 21 |
**/ |
**/ |
| 22 |
#include "BakeryGateway/ViewTreeBrowser.hh" |
#include "BakeryGateway/ViewTreeBrowser.hh" |
| 23 |
|
#include "GEDCOMHelper/IndividualRecordHelper.hh" |
| 24 |
|
|
| 25 |
BakeryGateway::ViewTreeBrowser::ViewTreeBrowser(void) |
BakeryGateway::ViewTreeBrowser::ViewTreeBrowser(void) |
| 26 |
{ |
{ |
| 28 |
return; |
return; |
| 29 |
} |
} |
| 30 |
|
|
| 31 |
void BakeryGateway::ViewTreeBrowser::AddParentInTree(GEDCOMParser::IndividualRecord const * const child, GEDCOMParser::IndividualRecord * const parent, std::vector<GEDCOMParser::IndividualRecord *> * children) |
void BakeryGateway::ViewTreeBrowser::AddParentInTree(GEDCOMParser::IndividualRecord * const child, std::string const &sex, std::vector<GEDCOMParser::IndividualRecord *> * children) |
| 32 |
{ |
{ |
| 33 |
std::string individu_name; |
std::string individu_name; |
| 34 |
|
GEDCOMParser::IndividualRecord * parent = 0; |
| 35 |
|
GEDCOMHelper::IndividualRecordHelper helper(child, get_document()); |
| 36 |
|
|
| 37 |
|
parent = helper.getIndividualParent(sex); |
| 38 |
|
|
| 39 |
if (parent != 0) |
if (parent != 0) |
| 40 |
{ |
{ |
| 41 |
individu_name = getIndividualName(parent); |
individu_name = getIndividualName(parent); |
| 78 |
_mmi_browser.addParent("", child->getId(), individu_name); |
_mmi_browser.addParent("", child->getId(), individu_name); |
| 79 |
children.push_back(child); |
children.push_back(child); |
| 80 |
|
|
|
SmartPtr<GEDCOMParser::IndividualRecord> parent; |
|
| 81 |
while (children.size() > 0) |
while (children.size() > 0) |
| 82 |
{ |
{ |
| 83 |
tmp_children = new std::vector<GEDCOMParser::IndividualRecord *>; |
tmp_children = new std::vector<GEDCOMParser::IndividualRecord *>; |
| 84 |
for (std::vector<GEDCOMParser::IndividualRecord *>::const_iterator child_iter = children.begin(); child_iter != children.end() ; child_iter++) |
for (std::vector<GEDCOMParser::IndividualRecord *>::const_iterator child_iter = children.begin(); child_iter != children.end() ; child_iter++) |
| 85 |
{ |
{ |
| 86 |
parent = get_document()->getIndividualParent(*child_iter, GEDCOMParser::LineageLinkageGedcom::e_Husband); |
AddParentInTree(*child_iter, GEDCOMParser::IndividualRecord::MALE, tmp_children); |
| 87 |
if (!parent.Null()) |
AddParentInTree(*child_iter, GEDCOMParser::IndividualRecord::FEMALE, tmp_children); |
|
{ |
|
|
AddParentInTree(*child_iter, parent.getPtr(), tmp_children); |
|
|
} |
|
|
|
|
|
parent = get_document()->getIndividualParent(*child_iter, GEDCOMParser::LineageLinkageGedcom::e_Wife); |
|
|
if (!parent.Null()) |
|
|
{ |
|
|
AddParentInTree(*child_iter, parent.getPtr(), tmp_children); |
|
|
} |
|
| 88 |
} |
} |
| 89 |
children = (*tmp_children); |
children = (*tmp_children); |
| 90 |
delete tmp_children; tmp_children = 0; |
delete tmp_children; tmp_children = 0; |