]> Creatis software - creaImageIO.git/blob - src/creatisIOComparator.cpp
efb2f5da556c2b6007a893cd87b86b5115390210
[creaImageIO.git] / src / creatisIOComparator.cpp
1 #include <creatisIOComparator.h>
2
3 namespace creaImageIO{
4
5         Comparator::Comparator(tree::Node *i_tree, std::string i_tag) : m_discr(i_tag): bdiscr(false)
6         {
7                 std::map< std::string, std::string>  attr;
8                 i_tree->GetDescriptor().BuildAttributeMap(attr);
9                 std::map<std::string, std::string>::iterator it_att = attr.begin();
10                 for(; it_att != attr.end(); it_att++)
11                 {
12                         if (it_att->first == m_discr)
13                         {
14                                 bdiscr = true;
15                                 break;
16                         }
17                 }
18                 tree::Node::ChildrenListType::reverse_iterator j;
19         for (j = (*i)->GetChildrenList().rbegin(); 
20              j!= (*i)->GetChildrenList().rend(); 
21              ++j)
22           {
23             GimmickDebugMessage(1,
24                                 "adding children "
25                                 <<(*j)->GetLabel()
26                                 <<"'"
27                                 <<std::endl);
28             
29             wxListItem item;
30             item.SetMask(wxLIST_MASK_STATE | 
31                          wxLIST_MASK_TEXT |
32                          //                      wxLIST_MASK_IMAGE |
33                          wxLIST_MASK_DATA |
34                          //                      wxLIST_MASK_WIDTH |
35                          wxLIST_MASK_FORMAT
36                          );
37             
38                 ItemData* data = new ItemData();
39             data->node = *j;
40             data->id = _id;
41                 
42             item.SetId(_id);
43             item.SetData(data);
44
45             _id++;
46             GetCtrl(l)->InsertItem(item);
47             
48             //Setting attributes
49             for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)                          
50               {
51                 std::string val;
52                 //  Temporary correction : it works but no explanation about the problem FCY
53                 
54                 if(k==0 && level <3)
55                 {
56                   val = (*j)->GetAttribute("NumberOfChildren");
57                 }
58                 else
59                   val = (*j)->GetAttribute(mLevelList[l].key[k]);
60                 
61         }
62 }