void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Refresh()
{
#ifdef REASSOCIATE_HACK
    m_Widget->AssociateModel( this );
#else
    std::queue<wxDataViewItem> todo;
    todo.push( wxDataViewItem() );

    while( !todo.empty() )
    {
        wxDataViewItem current = todo.front();
        wxDataViewItemArray items;

        GetChildren( current, items );
        ItemsAdded( current, items );

        for( wxDataViewItemArray::const_iterator i = items.begin(); i != items.end(); ++i )
        {
            if( IsContainer( *i ) )
                todo.push( *i );
        }

        todo.pop();
    }

#endif
}
Exemplo n.º 2
0
wxDataViewItemArray TreeListModel::AppendItems(const wxDataViewItem &parent, const wxVector<wxVector<wxVariant> >& data)
{
    wxDataViewItemArray items;
    for(size_t i=0; i<data.size(); ++i) {
        items.push_back( DoAppendItem(parent, data.at(i), false, NULL) );
    }
    ItemsAdded(parent, items);
    return items;
}
//region realizacion de la interfaz IComandoPACSNotificador
void GNC::GUI::AcquisitionTableModel::ReloadModel(std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >& results)
{
        //RELOAD MODEL FROM IMODELODICOM...
        if (!studyMap.empty()) {
                wxDataViewItemArray toDeleteList;
                for (TMapIndex::iterator it = studyMap.begin(); it !=  studyMap.end(); ++it) {
                        toDeleteList.push_back(wxDataViewItem((*it).second));
                }
                //then delete studies Nodes...
                ItemsDeleted(wxDataViewItem(0), toDeleteList);

                //delete all and reload again...
                ClearStudyMap();
        }
        Cleared();

        wxDataViewItemArray addList;
        if(results.size() == 0) {
                //add a virtual item...
                GNC::GCS::Ptr<GIL::DICOM::DicomDataset> pDataset(new GIL::DICOM::DicomDataset());
                pDataset->tags[GKDCM_PatientName] = _Std("No results found");
                pDataset->tags[GKDCM_StudyInstanceUID] = "";
                pDataset->secuencias.push_back(GIL::DICOM::DicomDataset());//dummy
                AcquisitionNode* pNode = new AcquisitionNode(NULL, pDataset);
                studyMap[pNode->uid] = pNode;
                addList.push_back(wxDataViewItem((void*)pNode));
        } else {
                for (std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >::iterator it = results.begin(); it != results.end(); ++it) {
                        std::string studyUID = (*it)->getTag(GKDCM_StudyInstanceUID);
                        if (studyMap.find(studyUID) == studyMap.end()) {
                                AcquisitionNode* pNode = new AcquisitionNode(NULL, (*it));
                                studyMap[pNode->uid] = pNode;
                                addList.push_back(wxDataViewItem((void*)pNode));
                        }
                }
        }

        ItemsAdded(wxDataViewItem(0), addList);
}
void GNC::GUI::AcquisitionTableModel::ReloadModel(const std::string& studyUID, std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >& results)
{
        if (studyMap.find(studyUID) != studyMap.end()) {
                AcquisitionNode* pStudyNode = studyMap[studyUID];
                wxDataViewItemArray arr;
                pStudyNode->GetChildren(arr);
                if (!arr.empty()) {
                        ItemsDeleted(wxDataViewItem(pStudyNode), arr);
                        pStudyNode->DestroyChildren();
                }

                if(!results.empty()) {
                        for (std::list< GNC::GCS::Ptr<GIL::DICOM::DicomDataset> >::iterator it = results.begin(); it != results.end(); ++it) {
                                AcquisitionNode* pSeriesNode = new AcquisitionNode(pStudyNode, (*it));
                                pStudyNode->AddChild(pSeriesNode);
                        }
                        arr.clear();
                        pStudyNode->GetChildren(arr);
                        if (!arr.empty()) {
                                ItemsAdded(wxDataViewItem(pStudyNode), arr);
                        }
                }
        }
}