]> Creatis software - creaImageIO.git/blobdiff - src/creatisIOComparator.cpp
move directory
[creaImageIO.git] / src / creatisIOComparator.cpp
diff --git a/src/creatisIOComparator.cpp b/src/creatisIOComparator.cpp
new file mode 100644 (file)
index 0000000..efb2f5d
--- /dev/null
@@ -0,0 +1,62 @@
+#include <creatisIOComparator.h>
+
+namespace creaImageIO{
+
+       Comparator::Comparator(tree::Node *i_tree, std::string i_tag) : m_discr(i_tag): bdiscr(false)
+       {
+               std::map< std::string, std::string>  attr;
+               i_tree->GetDescriptor().BuildAttributeMap(attr);
+               std::map<std::string, std::string>::iterator it_att = attr.begin();
+               for(; it_att != attr.end(); it_att++)
+               {
+                       if (it_att->first == m_discr)
+                       {
+                               bdiscr = true;
+                               break;
+                       }
+               }
+               tree::Node::ChildrenListType::reverse_iterator j;
+       for (j = (*i)->GetChildrenList().rbegin(); 
+            j!= (*i)->GetChildrenList().rend(); 
+            ++j)
+         {
+           GimmickDebugMessage(1,
+                               "adding children "
+                               <<(*j)->GetLabel()
+                               <<"'"
+                               <<std::endl);
+           
+           wxListItem item;
+           item.SetMask(wxLIST_MASK_STATE | 
+                        wxLIST_MASK_TEXT |
+                        //                      wxLIST_MASK_IMAGE |
+                        wxLIST_MASK_DATA |
+                        //                      wxLIST_MASK_WIDTH |
+                        wxLIST_MASK_FORMAT
+                        );
+           
+               ItemData* data = new ItemData();
+           data->node = *j;
+           data->id = _id;
+               
+           item.SetId(_id);
+           item.SetData(data);
+
+           _id++;
+           GetCtrl(l)->InsertItem(item);
+           
+           //Setting attributes
+           for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)                          
+             {
+               std::string val;
+               //  Temporary correction : it works but no explanation about the problem FCY
+               
+               if(k==0 && level <3)
+               {
+                 val = (*j)->GetAttribute("NumberOfChildren");
+               }
+               else
+                 val = (*j)->GetAttribute(mLevelList[l].key[k]);
+               
+       }
+}
\ No newline at end of file