X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FParaViewPlugin%2FpqMEDReaderPanel.cxx;h=83b01a23a183ced82162ae973c8aaeb7848473ad;hb=ebbd2915a22d111ae165c01dbdd7cd9b12848709;hp=2053a5ad5eb3f69658e35611dcf42200b66f5f34;hpb=9dbade0021c7a8e21aedcfb28be257886abed924;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx index 2053a5ad..83b01a23 100644 --- a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx +++ b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx @@ -3,7 +3,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,6 +51,8 @@ #include +#include + static const char ZE_SEP[]="@@][@@"; class PixSingle @@ -135,7 +137,10 @@ void pqMEDReaderPanel::initAll() vtkPVSILInformation *info(vtkPVSILInformation::New()); reader->GatherInformation(info); vtkGraph *g(info->GetSIL()); - vtkMutableDirectedGraph *g2(vtkMutableDirectedGraph::SafeDownCast(g)); + if(!g)//something wrong server side... + return ; + //vtkMutableDirectedGraph *g2(vtkMutableDirectedGraph::SafeDownCast(g));// agy: this line does not work in client/server mode ! but it works in standard mode ! Don't know why. ParaView bug ? + vtkMutableDirectedGraph *g2(static_cast(g)); int idNames(0); vtkAbstractArray *verticesNames(g2->GetVertexData()->GetAbstractArray("Names",idNames)); vtkStringArray *verticesNames2(vtkStringArray::SafeDownCast(verticesNames)); @@ -210,18 +215,19 @@ void pqMEDReaderPanel::initAll() { vtkIdType id3(it2->Next()); QString name2(QString::fromStdString((const char *)verticesNames2->GetValue(id3))); QList strs2; strs2.append(name2); - QString toolTipName2(name2); pqTreeWidgetItemObject *item2(new pqTreeWidgetItemObject(item1,strs2)); item2->setData(0,Qt::UserRole,name2); - item2->setData(0,Qt::ToolTipRole,toolTipName2); item2->setData(0,Qt::CheckStateRole,0); vtkAdjacentVertexIterator *it3(vtkAdjacentVertexIterator::New());//fields ! g2->GetAdjacentVertices(id3,it3); - while(it3->HasNext()) + vtkIdType id3Arrs(it3->Next()); + vtkAdjacentVertexIterator *it3Arrs(vtkAdjacentVertexIterator::New());//arrs in fields ! + g2->GetAdjacentVertices(id3Arrs,it3Arrs); + while(it3Arrs->HasNext()) { - vtkIdType id4(it3->Next()); + vtkIdType id4(it3Arrs->Next()); std::string name3CppFull((const char *)verticesNames2->GetValue(id4)); - std::size_t pos(name3CppFull.find_first_of(ZE_SEP)); + std::size_t pos(name3CppFull.find(ZE_SEP)); std::string name3Only(name3CppFull.substr(0,pos)); std::string spatialDiscr(name3CppFull.substr(pos+sizeof(ZE_SEP)-1)); QString name3(QString::fromStdString(name3Only)); QList strs3; strs3.append(name3); QString toolTipName3(name3+QString(" (")+spatialDiscr.c_str()+QString(")")); @@ -247,15 +253,34 @@ void pqMEDReaderPanel::initAll() item3->setData(0,Qt::ToolTipRole,toolTipName3); item3->setData(0,Qt::DecorationRole,PixSingle::GetInstance().getPixFromStr(spatialDiscr)); } - this->propertyManager()->registerLink(item3,"checked",SIGNAL(checkedStateChanged(bool)),this->proxy(),SMProperty,ll); _leaves.insert(std::pair(item3,ll)); + std::ostringstream pdm; pdm << name0.toStdString() << "/" << name1.toStdString() << "/" << name2.toStdString() << "/" << name3CppFull; + (static_cast(SMProperty))->SetElement(2*ll,pdm.str().c_str()); + char tmp2[2]; tmp2[0]=(kk==0?'1':'0'); tmp2[1]='\0'; + std::string tmp(tmp2); + (static_cast(SMProperty))->SetElement(2*ll+1,tmp.c_str()); + //SMProperty->ResetToDefault(); + item2->setChecked(kk==0); + item3->setChecked(kk==0); + this->propertyManager()->registerLink(item3,"checked",SIGNAL(checkedStateChanged(bool)),this->proxy(),SMProperty,ll); connect(item2,SIGNAL(checkedStateChanged(bool)),item3,SLOT(setChecked(bool))); connect(item3,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired())); ll++; } + vtkIdType id3Gts(it3->Next()); + vtkAdjacentVertexIterator *it3Gts(vtkAdjacentVertexIterator::New());//geo types in fields ! + g2->GetAdjacentVertices(id3Gts,it3Gts); + QString toolTipName2(name2); + while(it3Gts->HasNext()) + { + vtkIdType idGt(it3Gts->Next()); + std::string gtName((const char *)verticesNames2->GetValue(idGt)); + toolTipName2=QString("%1\n- %2").arg(toolTipName2).arg(QString(gtName.c_str())); + } + item2->setData(0,Qt::ToolTipRole,toolTipName2); + it3Gts->Delete(); it3->Delete(); - if(kk==0) - item2->setChecked(true); + it3Arrs->Delete(); kk++; } it2->Delete(); @@ -448,12 +473,9 @@ int pqMEDReaderPanel::getMaxNumberOfTS() const int ret(0); for(std::vector::const_iterator it=_all_lev4.begin();it!=_all_lev4.end();it++) { - if((*it)->property("checked").toInt()) - { - QTreeWidgetItem *obj((*it)->QTreeWidgetItem::parent()->QTreeWidgetItem::parent()->QTreeWidgetItem::parent()); - pqTreeWidgetItemObject *objC(dynamic_cast(obj)); - ret=std::max(ret,objC->property("NbOfTS").toInt()); - } + QTreeWidgetItem *obj((*it)->QTreeWidgetItem::parent()->QTreeWidgetItem::parent()->QTreeWidgetItem::parent()); + pqTreeWidgetItemObject *objC(dynamic_cast(obj)); + ret=std::max(ret,objC->property("NbOfTS").toInt()); } return ret; }