creatisIOComparator.cpp

Go to the documentation of this file.
00001 #include <creatisIOComparator.h>
00002 
00003 namespace creaImageIO{
00004 
00005         Comparator::Comparator(tree::Node *i_tree, std::string i_tag) : m_discr(i_tag): bdiscr(false)
00006         {
00007                 std::map< std::string, std::string>  attr;
00008                 i_tree->GetDescriptor().BuildAttributeMap(attr);
00009                 std::map<std::string, std::string>::iterator it_att = attr.begin();
00010                 for(; it_att != attr.end(); it_att++)
00011                 {
00012                         if (it_att->first == m_discr)
00013                         {
00014                                 bdiscr = true;
00015                                 break;
00016                         }
00017                 }
00018                 tree::Node::ChildrenListType::reverse_iterator j;
00019         for (j = (*i)->GetChildrenList().rbegin(); 
00020              j!= (*i)->GetChildrenList().rend(); 
00021              ++j)
00022           {
00023             GimmickDebugMessage(1,
00024                                 "adding children "
00025                                 <<(*j)->GetLabel()
00026                                 <<"'"
00027                                 <<std::endl);
00028             
00029             wxListItem item;
00030             item.SetMask(wxLIST_MASK_STATE | 
00031                          wxLIST_MASK_TEXT |
00032                          //                      wxLIST_MASK_IMAGE |
00033                          wxLIST_MASK_DATA |
00034                          //                      wxLIST_MASK_WIDTH |
00035                          wxLIST_MASK_FORMAT
00036                          );
00037             
00038                 ItemData* data = new ItemData();
00039             data->node = *j;
00040             data->id = _id;
00041                 
00042             item.SetId(_id);
00043             item.SetData(data);
00044 
00045             _id++;
00046             GetCtrl(l)->InsertItem(item);
00047             
00048             //Setting attributes
00049             for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)                          
00050               {
00051                 std::string val;
00052                 //  Temporary correction : it works but no explanation about the problem FCY
00053                 
00054                 if(k==0 && level <3)
00055                 {
00056                   val = (*j)->GetAttribute("NumberOfChildren");
00057                 }
00058                 else
00059                   val = (*j)->GetAttribute(mLevelList[l].key[k]);
00060                 
00061         }
00062 }