Salome HOME
Porting to PV50
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 29 Jul 2015 08:12:51 +0000 (10:12 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 17 Dec 2015 08:21:25 +0000 (09:21 +0100)
70 files changed:
src/PVGUI/PVGUI_Module.cxx
src/Plugins/JSONReader/ParaViewPlugin/vtkJSONReader.cxx
src/Plugins/MEDReader/CMakeLists.txt
src/Plugins/MEDReader/IO/CMakeLists.txt
src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx
src/Plugins/MEDReader/IO/module.cmake
src/Plugins/MEDReader/IO/vtkExtractCellType.cxx
src/Plugins/MEDReader/IO/vtkExtractGroup.cxx
src/Plugins/MEDReader/IO/vtkExtractGroup.h
src/Plugins/MEDReader/IO/vtkGenerateVectors.cxx
src/Plugins/MEDReader/IO/vtkMEDReader.cxx
src/Plugins/MEDReader/IO/vtkMEDReader.h
src/Plugins/MEDReader/IO/vtkMEDReader2.cxx [new file with mode: 0644]
src/Plugins/MEDReader/IO/vtkMEDReader2.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/CMakeLists.txt
src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderClient2.xml [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml
src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractCellTypePanel.ui [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractGroupPanel.ui [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderPanel.ui [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderTimeModeWidget.ui [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderVectorsWidget.ui [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/Resources/pqMEDReader.qrc
src/Plugins/MEDReader/ParaViewPlugin/VectBoolSpreadSheet.cxx
src/Plugins/MEDReader/ParaViewPlugin/VectBoolWidget.cxx
src/Plugins/MEDReader/ParaViewPlugin/VectBoolWidget.h
src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.cxx [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.h [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.cxx [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.h [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.h [deleted file]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.h [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.cxx [new file with mode: 0644]
src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.h [new file with mode: 0644]
src/Plugins/MEDReader/Test/CMakeLists.txt
src/Plugins/MEDReader/Test/CTestTestfileInstall.cmake
src/Plugins/MEDReader/Test/testMEDReader0.py
src/Plugins/MEDReader/Test/testMEDReader1.py
src/Plugins/MEDReader/Test/testMEDReader10.py
src/Plugins/MEDReader/Test/testMEDReader11.py
src/Plugins/MEDReader/Test/testMEDReader12.py
src/Plugins/MEDReader/Test/testMEDReader13.py
src/Plugins/MEDReader/Test/testMEDReader14.py
src/Plugins/MEDReader/Test/testMEDReader15.py
src/Plugins/MEDReader/Test/testMEDReader2.py
src/Plugins/MEDReader/Test/testMEDReader3.py
src/Plugins/MEDReader/Test/testMEDReader4.py
src/Plugins/MEDReader/Test/testMEDReader5.py
src/Plugins/MEDReader/Test/testMEDReader6.py
src/Plugins/MEDReader/Test/testMEDReader7.py
src/Plugins/MEDReader/Test/testMEDReader8.py
src/Plugins/ParaMEDCorba/vtkParaMEDCorbaSource.cxx
src/Plugins/ParaMEDCorba/vtkParaMEDCorbaSource.h
test/standalone/gui/CMakeLists.txt

index 2b95663400a3c4b3bd0d2bfc293363a0b7c49347..2902f451c2f1959468e58b33bb0c23d9cd8a9297 100644 (file)
@@ -798,24 +798,25 @@ QString PVGUI_Module::getTraceString()
   }
 
   // Save camera position to, which is no longer output by the tracer ...
-  VTK_PY_GIL_ENSURE
-  PyObject * mods(PySys_GetObject(const_cast<char*>("modules")));
-  PyObject * trace_mod(PyDict_GetItemString(mods, "paraview.smtrace"));  // module was already (really) imported by vtkSMTrace
-  if (PyModule_Check(trace_mod)) {
-      vtkSmartPyObject save_cam(PyObject_GetAttrString(trace_mod, const_cast<char*>("SaveCameras")));
-      vtkSmartPyObject camera_trace(PyObject_CallMethod(save_cam, const_cast<char*>("get_trace"), NULL));
-      // Convert to a single string
-      vtkSmartPyObject ret(PyString_FromString(end_line.toStdString().c_str()));
-      vtkSmartPyObject final_string(PyObject_CallMethod(ret, const_cast<char*>("join"),
-          const_cast<char*>("O"), (PyObject*)camera_trace));
-      if (PyString_CheckExact(final_string))
-        {
-          QString camera_qs(PyString_AsString(final_string));  // deep copy
-          traceString = traceString + end_line  + end_line + QString("#### saving camera placements for all active views")
-              + end_line + end_line + camera_qs + end_line;
-        }
-    }
-  VTK_PY_GIL_RELEASE
+  {
+    vtkPythonScopeGilEnsurer psge;
+    PyObject * mods(PySys_GetObject(const_cast<char*>("modules")));
+    PyObject * trace_mod(PyDict_GetItemString(mods, "paraview.smtrace"));  // module was already (really) imported by vtkSMTrace
+    if (PyModule_Check(trace_mod)) {
+        vtkSmartPyObject save_cam(PyObject_GetAttrString(trace_mod, const_cast<char*>("SaveCameras")));
+        vtkSmartPyObject camera_trace(PyObject_CallMethod(save_cam, const_cast<char*>("get_trace"), NULL));
+        // Convert to a single string
+        vtkSmartPyObject ret(PyString_FromString(end_line.toStdString().c_str()));
+        vtkSmartPyObject final_string(PyObject_CallMethod(ret, const_cast<char*>("join"),
+            const_cast<char*>("O"), (PyObject*)camera_trace));
+        if (PyString_CheckExact(final_string))
+          {
+            QString camera_qs(PyString_AsString(final_string));  // deep copy
+            traceString = traceString + end_line  + end_line + QString("#### saving camera placements for all active views")
+                + end_line + end_line + camera_qs + end_line;
+          }
+      }
+  } 
 
   return traceString;
 }
index 5a02d465cce8e3c781b6c4080e228b2a42bbf9d1..adec0627896d1bfe1b3a6c2924024cfc6ca596aa 100644 (file)
@@ -30,8 +30,8 @@
 #include <vtkStringArray.h>
 #include <vtkStringToNumeric.h>
 
-#include <vtksys/stl/stdexcept>
-#include <vtksys/ios/sstream>
+#include <stdexcept>
+#include <sstream>
 
 vtkStandardNewMacro(vtkJSONReader);
 
index dc157a4a6f1b41bb314bf3deca24852d341dab6c..36f86d08eeef57a2afc9fb3a6aa64e2f06998c3c 100644 (file)
 #       -DMEDFILE_ROOT_DIR=/where/is/med-3.0.7_install -DMEDCOUPLING_ROOT_DIR=/where/is/medcoupling_install \ 
 #       -DParaView_DIR=<PARAVIEW_INSTALL>/lib/cmake/paraview-4.3 
 
+IF(NOT KW_TESTING_PLATFORM)
 PROJECT(MEDReader)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+ENDIF(NOT KW_TESTING_PLATFORM)
 
 IF(COMMAND cmake_policy)
   cmake_policy(SET CMP0003 NEW)
@@ -107,6 +109,7 @@ IF(MEDReader_BUILD_ParaView_Plugin)
   ADD_SUBDIRECTORY(ParaViewPlugin)
 ENDIF(MEDReader_BUILD_ParaView_Plugin)
 
+SET(SALOME_BUILD_TESTS ON CACHE BOOL "Build Salome Test")
 IF(SALOME_BUILD_TESTS)
   ENABLE_TESTING()
   ADD_SUBDIRECTORY(Test)
index 1f763b884056f951c70e4e6673a9a84826913cdb..ec86a8289d595ba82b6dba277f35daa165b2efe0 100644 (file)
@@ -48,9 +48,7 @@ ELSE(HDF5_IS_PARALLEL)
 ENDIF(HDF5_IS_PARALLEL)
 
 VTK_MODULE_LIBRARY(vtkMEDReader ${MEDReader_SRCS})
-TARGET_LINK_LIBRARIES(vtkMEDReader vtkPVVTKExtensionsRendering vtkRenderingFreeType vtkRenderingOpenGL 
-                                   vtkRenderingFreeTypeOpenGL vtkInteractionStyle vtkFiltersCore vtkFiltersGeneral 
-                                   MEDLoaderForPV ${MEDFILE_C_LIBRARIES})
+TARGET_LINK_LIBRARIES(vtkMEDReader ${PARAVIEW_LIBRARIES} MEDLoaderForPV ${MEDFILE_C_LIBRARIES})
 
 INSTALL(
   TARGETS vtkMEDReader MEDLoaderForPV
index b3512390494ebdf34402d64cd8e12af539acb7d1..7367368faba520ac21bf3e3678ccfb36c69e4c34 100644 (file)
@@ -50,9 +50,6 @@
 #include "vtkFieldData.h"
 #include "vtkCellData.h"
 
-#include "vtksys/stl/string"
-#include "vtksys/ios/fstream"
-#include "vtksys/stl/algorithm"
 #include "vtkMutableDirectedGraph.h"
 
 using namespace ParaMEDMEM;
@@ -110,7 +107,7 @@ vtkIdTypeArray *ELGACmp::isExisting(const std::vector<std::string>& locsReallyUs
 
 vtkIdTypeArray *ELGACmp::createNew(const ParaMEDMEM::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDoubleArray *vtkd, vtkDataSet *ds) const
 {
-  static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
+  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
   std::vector< std::vector<std::string> > locNames(_loc_names);
   std::vector<vtkIdTypeArray *> elgas(_elgas);
   std::vector< std::pair< vtkQuadratureSchemeDefinition *, unsigned char > > defs;
@@ -167,7 +164,7 @@ vtkIdTypeArray *ELGACmp::createNew(const ParaMEDMEM::MEDFileFieldGlobsReal *glob
       offset+=delta;
     }
   elga->GetInformation()->Set(MEDUtilities::ELGA(),1);
-  elga->SetArray(pt,ncell,0,VTK_DATA_ARRAY_DELETE);
+  elga->SetVoidArray(pt,ncell,0,VTK_DATA_ARRAY_DELETE);
   std::ostringstream oss; oss << "ELGA" << "@" << _loc_names.size();
   std::string ossStr(oss.str());
   elga->SetName(ossStr.c_str());
@@ -275,8 +272,8 @@ bool MEDFileFieldRepresentationLeavesArrays::setStatus(bool status) const
 
 void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, const ParaMEDMEM::MEDFileFieldGlobsReal *globs, const ParaMEDMEM::MEDMeshMultiLev *mml, const ParaMEDMEM::MEDFileMeshStruct *mst, vtkDataSet *ds) const
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
-  static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
   tr->setNumberOfTS((operator->())->getNumberOfTS());
   tr->initIterator();
   for(int timeStepId=0;timeStepId<tr->size();timeStepId++,++(*tr))
@@ -366,7 +363,7 @@ void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr,
                   offset+=delta;
                 }
               elno->GetInformation()->Set(MEDUtilities::ELNO(),1);
-              elno->SetArray(pt,ncell,0,VTK_DATA_ARRAY_DELETE);
+              elno->SetVoidArray(pt,ncell,0,VTK_DATA_ARRAY_DELETE);
               std::string nameElno("ELNO"); nameElno+="@"; nameElno+=name;
               elno->SetName(nameElno.c_str());
               ds->GetCellData()->AddArray(elno);
@@ -634,7 +631,7 @@ void MEDFileFieldRepresentationLeaves::appendFields(const MEDTimeReq *tr, const
 
 vtkUnstructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationUnstructured(MEDUMeshMultiLev *mm) const
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   DataArrayDouble *coordsMC(0);
   DataArrayByte *typesMC(0);
   DataArrayInt *cellLocationsMC(0),*cellsMC(0),*faceLocationsMC(0),*facesMC(0);
@@ -648,18 +645,18 @@ vtkUnstructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInt
   vtkUnsignedCharArray *cellTypes(vtkUnsignedCharArray::New());
   cellTypes->SetArray(reinterpret_cast<unsigned char *>(typesSafe->getPointer()),nbOfCells,0,VTK_DATA_ARRAY_FREE); typesSafe->accessToMemArray().setSpecificDeallocator(0);
   vtkIdTypeArray *cellLocations(vtkIdTypeArray::New());
-  cellLocations->SetArray(cellLocationsSafe->getPointer(),nbOfCells,0,VTK_DATA_ARRAY_FREE); cellLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
+  cellLocations->SetVoidArray(cellLocationsSafe->getPointer(),nbOfCells,0,VTK_DATA_ARRAY_FREE); cellLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
   vtkCellArray *cells(vtkCellArray::New());
   vtkIdTypeArray *cells2(vtkIdTypeArray::New());
-  cells2->SetArray(cellsSafe->getPointer(),cellsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); cellsSafe->accessToMemArray().setSpecificDeallocator(0);
+  cells2->SetVoidArray(cellsSafe->getPointer(),cellsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); cellsSafe->accessToMemArray().setSpecificDeallocator(0);
   cells->SetCells(nbOfCells,cells2);
   cells2->Delete();
   if(faceLocationsMC!=0 && facesMC!=0)
     {
       vtkIdTypeArray *faces(vtkIdTypeArray::New());
-      faces->SetArray(facesSafe->getPointer(),facesSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); facesSafe->accessToMemArray().setSpecificDeallocator(0);
+      faces->SetVoidArray(facesSafe->getPointer(),facesSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); facesSafe->accessToMemArray().setSpecificDeallocator(0);
       vtkIdTypeArray *faceLocations(vtkIdTypeArray::New());
-      faceLocations->SetArray(faceLocationsSafe->getPointer(),faceLocationsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); faceLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
+      faceLocations->SetVoidArray(faceLocationsSafe->getPointer(),faceLocationsSafe->getNbOfElems(),0,VTK_DATA_ARRAY_FREE); faceLocationsSafe->accessToMemArray().setSpecificDeallocator(0);
       ret->SetCells(cellTypes,cellLocations,cells,faceLocations,faces);
       faceLocations->Delete();
       faces->Delete();
@@ -689,7 +686,7 @@ vtkUnstructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInt
 
 vtkRectilinearGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationCartesian(ParaMEDMEM::MEDCMeshMultiLev *mm) const
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   bool isInternal;
   std::vector< DataArrayDouble * > arrs(mm->buildVTUArrays(isInternal));
   vtkDoubleArray *vtkTmp(0);
@@ -742,7 +739,7 @@ vtkRectilinearGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInte
 
 vtkStructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolationCurveLinear(ParaMEDMEM::MEDCurveLinearMeshMultiLev *mm) const
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   int meshStr[3]={1,1,1};
   DataArrayDouble *coords(0);
   std::vector<int> nodeStrct;
@@ -784,7 +781,7 @@ vtkStructuredGrid *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInter
  
 vtkDataSet *MEDFileFieldRepresentationLeaves::buildVTKInstanceNoTimeInterpolation(const MEDTimeReq *tr, const MEDFileFieldGlobsReal *globs, const ParaMEDMEM::MEDFileMeshes *meshes) const
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   vtkDataSet *ret(0);
   //_fsp->isDataSetSupportEqualToThePreviousOne(i,globs);
   MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> mml(_fsp->buildFromScratchDataSetSupport(0,globs));//0=timestep Id. Make the hypothesis that support does not change 
@@ -1207,12 +1204,12 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam
   this->_data_structure.resize(allFMTSLeavesPerTimeSeriesSafe.size());
   for(std::size_t i=0;i<allFMTSLeavesPerTimeSeriesSafe.size();i++)
     {
-      vtksys_stl::vector< vtksys_stl::string > meshNamesLoc;
+      std::vector< std::string > meshNamesLoc;
       std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> > > splitByMeshName;
       for(std::size_t j=0;j<allFMTSLeavesPerTimeSeriesSafe[i].size();j++)
         {
           std::string meshName(allFMTSLeavesPerTimeSeriesSafe[i][j]->getMeshName());
-          vtksys_stl::vector< vtksys_stl::string >::iterator it(std::find(meshNamesLoc.begin(),meshNamesLoc.end(),meshName));
+          std::vector< std::string >::iterator it(std::find(meshNamesLoc.begin(),meshNamesLoc.end(),meshName));
           if(it==meshNamesLoc.end())
             {
               meshNamesLoc.push_back(meshName);
@@ -1476,7 +1473,7 @@ void MEDFileFieldRepresentationTree::AppendFieldFromMeshes(const ParaMEDMEM::MED
 
 std::string MEDFileFieldRepresentationTree::BuildAUniqueArrayNameForMesh(const std::string& meshName, const ParaMEDMEM::MEDFileFields *ret)
 {
-  static const char KEY_STR_TO_AVOID_COLLIDE[]="MESH@";
+  const char KEY_STR_TO_AVOID_COLLIDE[]="MESH@";
   if(!ret)
     throw INTERP_KERNEL::Exception("MEDFileFieldRepresentationTree::BuildAUniqueArrayNameForMesh : internal error ! NULL ret !");
   std::vector<std::string> fieldNamesAlreadyExisting(ret->getFieldsNames());
@@ -1536,7 +1533,7 @@ std::vector<std::string> MEDFileFieldRepresentationTree::SplitFieldNameIntoParts
 */
 std::string MEDFileFieldRepresentationTree::PostProcessFieldName(const std::string& fullFieldName)
 {
-  static const char SEP('_');
+  const char SEP('_');
   std::vector<std::string> v(SplitFieldNameIntoParts(fullFieldName,SEP));
   if(v.empty())
     return fullFieldName;//should never happen
index 645d5d44e7859d048f0056e86c2f3f95d8c4bc22..5363aad1a3e1cb0c675cd84ec7ae464f422aaeab 100644 (file)
@@ -7,6 +7,6 @@ vtk_module(vtkMEDReader
     vtkRenderingCore
     vtkTestingRendering
     vtkInteractionStyle
-    vtkRenderingFreeTypeOpenGL
+    #vtkRenderingFreeTypeOpenGL
   EXCLUDE_FROM_WRAP_HIERARCHY
 )
index 21c1b4b93b500c52ed3198078209cdd5ff5279d9..841257afe180e6bffc87f0614a87faa08cce81be 100644 (file)
@@ -368,8 +368,8 @@ int vtkExtractCellType::RequestInformation(vtkInformation *request, vtkInformati
 
 vtkDataSet *FilterFamilies(vtkDataSet *input, const std::vector<int>& idsToKeep, bool insideOut)
 {
-  static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
-  static const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@";
+  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
+  const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@";
   vtkDataSet *output(input->NewInstance());
   output->ShallowCopy(input);
   vtkSmartPointer<vtkThreshold> thres(vtkSmartPointer<vtkThreshold>::New());
index 1db4ee4975a34415338d9e917fc951cafa492f14..06ceb7a911cea4e01abf2b9b5c6d3ff4f1596a79 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "vtkExtractGroup.h"
 #include "MEDFileFieldRepresentationTree.hxx"
+#include "vtkMEDReader.h"
 
 #include "vtkAdjacentVertexIterator.h"
 #include "vtkIntArray.h"
@@ -54,6 +55,7 @@
 #include "vtkThreshold.h"
 #include "vtkMultiBlockDataGroupFilter.h"
 #include "vtkCompositeDataToUnstructuredGridFilter.h"
+#include "vtkInformationDataObjectMetaDataKey.h"
 
 #include <map>
 #include <deque>
@@ -163,9 +165,12 @@ bool ExtractGroupGrp::isSameAs(const ExtractGroupGrp& other) const
 
 bool vtkExtractGroup::vtkExtractGroupInternal::IsInformationOK(vtkInformation *info)
 {
-  if(!info->Has(vtkDataObject::SIL()))
+  // Check the information contain meta data key
+  if(!info->Has(vtkMEDReader::META_DATA()))
     return false;
-  vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::SafeDownCast(info->Get(vtkDataObject::SIL())));
+
+  // Recover Meta Data
+  vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::SafeDownCast(info->Get(vtkMEDReader::META_DATA())));
   if(!sil)
     return false;
   int idNames(0);
@@ -182,6 +187,16 @@ bool vtkExtractGroup::vtkExtractGroupInternal::IsInformationOK(vtkInformation *i
   return false;
 }
 
+const char* vtkExtractGroup::GetGrpStart()
+{
+  return ExtractGroupGrp::START;
+}
+
+const char* vtkExtractGroup::GetFamStart()
+{
+  return ExtractGroupFam::START;
+}
+
 const char *vtkExtractGroup::vtkExtractGroupInternal::getMeshName() const
 {
   return this->_mesh_name.c_str();
@@ -249,7 +264,7 @@ void vtkExtractGroup::vtkExtractGroupInternal::loadFrom(vtkMutableDirectedGraph
         }
       itFams->Delete();
     }
-  it0->Delete(); 
+  it0->Delete();
   //
   std::size_t szg(_groups.size()),szf(_fams.size());
   if(szg==oldGrps.size() && szf==oldFams.size())
@@ -427,32 +442,22 @@ void vtkExtractGroup::SetInsideOut(int val)
 
 int vtkExtractGroup::RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 {
-  vtkUnstructuredGridAlgorithm::RequestInformation(request,inputVector,outputVector);
+//  vtkUnstructuredGridAlgorithm::RequestInformation(request,inputVector,outputVector);
   try
     {
-      //std::cerr << "########################################## vtkExtractGroup::RequestInformation ##########################################" << std::endl;
+//      std::cerr << "########################################## vtkExtractGroup::RequestInformation ##########################################" << std::endl;
+//      request->Print(cout);
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
-      vtkInformation *inputInfo(inputVector[0]->GetInformationObject(0));//unfortunately inputInfo->Has(vtkDataObject::SIL) returns false... use executive to find it !
-      //
-      vtkExecutive *exe(GetExecutive());
-      vtkAlgorithm *alg(this);
-      vtkInformation *infoOnSIL(alg->GetOutputInformation(0));
-      while(!vtkExtractGroup::vtkExtractGroupInternal::IsInformationOK(infoOnSIL))// skipping vtkPVPostFilter
-       {
-         if(exe->GetNumberOfInputConnections(0)<1)
-           {
-             vtkErrorMacro("No SIL Data available ! The source of this filter must be MEDReader !");
+      vtkInformation *inputInfo(inputVector[0]->GetInformationObject(0));
+      if(!vtkExtractGroup::vtkExtractGroupInternal::IsInformationOK(inputInfo))
+        {
+        vtkErrorMacro("No SIL Data available ! The source of this filter must be MEDReader !");
              return 0;
-           }
-         vtkExecutive *exe2(exe->GetInputExecutive(0,0));
-         //
-         alg=exe2->GetAlgorithm(); exe=exe2; infoOnSIL=alg->GetOutputInformation(0);
-       }
-      //
-      this->SetSIL(vtkMutableDirectedGraph::SafeDownCast(infoOnSIL->Get(vtkDataObject::SIL())));
+        }
+
+      this->SetSIL(vtkMutableDirectedGraph::SafeDownCast(inputInfo->Get(vtkMEDReader::META_DATA())));
       this->Internal->loadFrom(this->SIL);
       //this->Internal->printMySelf(std::cerr);
-      outInfo->Set(vtkDataObject::SIL(),this->SIL);
     }
   catch(INTERP_KERNEL::Exception& e)
     {
@@ -477,8 +482,8 @@ vtkDataSet *FilterFamilies(vtkSmartPointer<vtkThreshold>& thres,
                            vtkDataSet *input, const std::set<int>& idsToKeep, bool insideOut, const char *arrNameOfFamilyField,
                            const char *associationForThreshold, bool& catchAll, bool& catchSmth)
 {
-  static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
-  static const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@";
+  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
+  const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@";
   vtkDataSet *output(input->NewInstance());
   output->ShallowCopy(input);
   thres->SetInputData(output);
@@ -487,7 +492,7 @@ vtkDataSet *FilterFamilies(vtkSmartPointer<vtkThreshold>& thres,
   //
   double vMin(insideOut==0?1.:0.),vMax(insideOut==0?2.:1.);
   thres->ThresholdBetween(vMin,vMax);
-  // OK for the output 
+  // OK for the output
   //
   CellPointExtractor cpe2(input);
   vtkDataArray *da(cpe2.Get()->GetScalars(arrNameOfFamilyField));
@@ -560,7 +565,8 @@ int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector *
 {
   try
     {
-      //std::cerr << "########################################## vtkExtractGroup::RequestData        ##########################################" << std::endl;
+//      std::cerr << "########################################## vtkExtractGroup::RequestData        ##########################################" << std::endl;
+//      request->Print(cout);
       vtkInformation* inputInfo=inputVector[0]->GetInformationObject(0);
       vtkDataSet *input(vtkDataSet::SafeDownCast(inputInfo->Get(vtkDataObject::DATA_OBJECT())));
       vtkInformation *info(input->GetInformation());
@@ -679,14 +685,14 @@ int vtkExtractGroup::GetNumberOfGroupsFlagsArrays()
 const char *vtkExtractGroup::GetGroupsFlagsArrayName(int index)
 {
   const char *ret(this->Internal->getKeyOfEntry(index));
-  //std::cerr << "vtkExtractGroup::GetFieldsTreeArrayName(" << index << ") -> " << ret << std::endl;
+//  std::cerr << "vtkExtractGroup::GetFieldsTreeArrayName(" << index << ") -> " << ret << std::endl;
   return ret;
 }
 
 int vtkExtractGroup::GetGroupsFlagsArrayStatus(const char *name)
 {
   int ret((int)this->Internal->getStatusOfEntryStr(name));
-  //std::cerr << "vtkExtractGroup::GetGroupsFlagsArrayStatus(" << name << ") -> " << ret << std::endl;
+//  std::cerr << "vtkExtractGroup::GetGroupsFlagsArrayStatus(" << name << ") -> " << ret << std::endl;
   return ret;
 }
 
index fa01f37d76f71bd77e881f271652cbea27bf00ac..d3cca44b904e519b302d3ab6b01a28bf3efdfc9d 100644 (file)
@@ -40,6 +40,8 @@ public:
   // Every time the SIL is updated a this will return a different value.
   virtual int GetSILUpdateStamp();
   const char *GetMeshName();
+  static const char* GetGrpStart();
+  static const char* GetFamStart();
 protected:
   vtkExtractGroup();
   ~vtkExtractGroup();
@@ -49,6 +51,7 @@ protected:
 
   int RequestData(vtkInformation *request, vtkInformationVector **inputVector,
       vtkInformationVector *outputVector);
+
   // Description:
   // This SIL stores the structure of the mesh/groups/cell types
   // that can be selected.
index ceefad3641e99fd43b06352c8f5553b06c0d0bea..c60d249c1209cfbcf46ceaf6f06c31aff7bf43f1 100644 (file)
@@ -70,7 +70,7 @@ void vtkGenerateVectors::Operate(vtkFieldData *fd)
 
 vtkDoubleArray *vtkGenerateVectors::Operate2Compo(vtkDoubleArray *oldArr)
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   vtkDoubleArray *ret(vtkDoubleArray::New());
   std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
   const double *inPt(oldArr->GetPointer(0));
@@ -93,7 +93,7 @@ vtkDoubleArray *vtkGenerateVectors::Operate2Compo(vtkDoubleArray *oldArr)
 
 vtkDoubleArray *vtkGenerateVectors::OperateMoreThan3Compo(vtkDoubleArray *oldArr)
 {
-  static const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
+  const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
   vtkDoubleArray *ret(vtkDoubleArray::New());
   int nbOfCompo(oldArr->GetNumberOfComponents());
   std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
index 07d89f1b74021ad6f331516b6542e793cb8e47e2..dba03ca0f5c769e7dd31f06d73b82e9e5f0df7a9 100644 (file)
@@ -44,6 +44,8 @@
 #include "vtkCellArray.h"
 #include "vtkDoubleArray.h"
 #include "vtkObjectFactory.h"
+#include "vtkInformationDataObjectMetaDataKey.h"
+
 #ifdef MEDREADER_USE_MPI
 #include "vtkMultiProcessController.h"
 #endif
@@ -58,7 +60,7 @@
 
 /*!
  * This class stores properties in loading state mode (pvsm) when the MED file has not been read yet.
- * The file is not read beacause FileName has not been informed yet ! So this class stores properties of vtkMEDReader instance that 
+ * The file is not read beacause FileName has not been informed yet ! So this class stores properties of vtkMEDReader instance that
  * owns it and wait the vtkMEDReader::SetFileName to apply properties afterwards.
  */
 class PropertyKeeper
@@ -154,15 +156,16 @@ public:
   vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),FirstCall0(2),PK(master),MyMTime(0)
   {
   }
-  
+
   bool PluginStart0()
   {
+    return false; // TODO Useless and buggy
     if(FirstCall0==0)
       return false;
     FirstCall0--;
     return true;
   }
-  
+
   ~vtkMEDReaderInternal()
   {
     if(this->SIL)
@@ -188,11 +191,13 @@ public:
   int MyMTime;
   std::set<std::string> _wonderful_set;// this set is used by SetFieldsStatus method to detect the fact that SetFieldsStatus has been called for all items ! Great Items are not sorted ! Why ?
   std::map<std::string,bool> _wonderful_ref;// this map stores the state before a SetFieldsStatus status.
+
 private:
   unsigned char FirstCall0;
 };
 
 vtkStandardNewMacro(vtkMEDReader);
+vtkInformationKeyMacro(vtkMEDReader, META_DATA, DataObjectMetaData);
 
 vtkMEDReader::vtkMEDReader():Internal(new vtkMEDReaderInternal(this))
 {
@@ -206,11 +211,8 @@ vtkMEDReader::~vtkMEDReader()
   this->Internal = 0;
 }
 
-void vtkMEDReader::Reload(int a)
+void vtkMEDReader::Reload()
 {
-  if(a==0)
-    return;
-  std::cerr << "vtkMEDReader::Reload" << a << std::endl;
   std::string fName((const char *)this->GetFileName());
   delete this->Internal;
   this->Internal=new vtkMEDReaderInternal(this);
@@ -255,7 +257,6 @@ void vtkMEDReader::ChangeMode(int newMode)
     }
   //not pvsm mode (general case)
   this->Internal->IsStdOrMode=newMode!=0;
-  //std::cerr << "vtkMEDReader::ChangeMode : " << this->Internal->IsStdOrMode << std::endl;
   this->Modified();
 }
 
@@ -320,15 +321,20 @@ char *vtkMEDReader::GetFileName()
 
 int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 {
-  //std::cerr << "########################################## RequestInformation ##########################################" << std::endl;
+//  std::cout << "########################################## vtkMEDReader::RequestInformation ##########################################" << std::endl;
   if(!this->Internal)
     return 0;
   try
     {
+//      request->Print(cout);
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       outInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkMultiBlockDataSet");
-      this->UpdateSIL(outInfo);
-      //
+      this->UpdateSIL(request, outInfo);
+
+      // Set the meta data graph as a meta data key in the information
+      // That's all that is needed to transfer it along the pipeline
+      outInfo->Set(vtkMEDReader::META_DATA(),this->Internal->SIL);
+
       bool dummy(false);
       this->PublishTimeStepsIfNeeded(outInfo,dummy);
     }
@@ -348,22 +354,23 @@ int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVect
 
 int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 {
-  //std::cerr << "########################################## RequestData        ##########################################";
+//  std::cout << "########################################## vtkMEDReader::RequestData ##########################################" << std::endl;
   if(!this->Internal)
     return 0;
   try
     {
+//      request->Print(cout);
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       vtkMultiBlockDataSet *output(vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
       bool isUpdated(false);
       double reqTS(0.);
       if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
         reqTS=outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
-      //std::cerr << reqTS << std::endl;
       this->FillMultiBlockDataSetInstance(output,reqTS);
       output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS);
-      this->UpdateSIL(outInfo);
-      //this->UpdateProgress((float) progress/((float) maxprogress-1));
+
+      // Is it really needed ? TODO
+      this->UpdateSIL(request, outInfo);
     }
   catch(INTERP_KERNEL::Exception& e)
     {
@@ -419,7 +426,6 @@ int vtkMEDReader::GetNumberOfFieldsTreeArrays()
   if(!this->Internal)
     return 0;
   return this->Internal->Tree.getNumberOfLeavesArrays();
-  //std::cerr << "vtkMEDReader::GetNumberOfFieldsTreeArrays called ! " << ret << std::endl;
 }
 
 const char *vtkMEDReader::GetFieldsTreeArrayName(int index)
@@ -427,7 +433,6 @@ const char *vtkMEDReader::GetFieldsTreeArrayName(int index)
   if(!this->Internal)
     return 0;
   return this->Internal->Tree.getNameOfC(index);
-  //std::cerr << "vtkMEDReader::GetFieldsTreeArrayName(" << index << ") called ! " << ret << std::endl;
 }
 
 int vtkMEDReader::GetFieldsTreeArrayStatus(const char *name)
@@ -483,11 +488,13 @@ int vtkMEDReader::GetTimesFlagsArrayStatus(const char *name)
   return (int)this->Internal->TK.getTimesFlagArray()[pos].first;
 }
 
-void vtkMEDReader::UpdateSIL(vtkInformation *info)
+void vtkMEDReader::UpdateSIL(vtkInformation* request, vtkInformation *info)
 {
   if(!this->Internal)
       return;
   vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::New());
+
+  // This Should be more clever, TODO
   std::string meshName(this->BuildSIL(sil));
   if(meshName!=this->Internal->DftMeshName)
     {
@@ -495,8 +502,6 @@ void vtkMEDReader::UpdateSIL(vtkInformation *info)
         this->Internal->SIL->Delete();
       this->Internal->SIL=sil;
       this->Internal->DftMeshName=meshName;
-      info->Set(vtkDataObject::SIL(),this->Internal->SIL);
-      //request->AppendUnique(vtkExecutive::KEYS_TO_COPY(),vtkDataObject::SIL());
     }
   else
     {
index 8412f3a2e7847b0e922565b3209c0e6f8882c5d6..646bbb42901f0a9745b64296142ea4516eb5ef2e 100644 (file)
@@ -26,6 +26,7 @@
 #include "vtkMultiBlockDataSetAlgorithm.h"
 
 class vtkMutableDirectedGraph;
+class vtkInformationDataObjectMetaDataKey;
 
 class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
 {
@@ -52,24 +53,34 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
   virtual const char *GetTimesFlagsArrayName(int index);
   //! Build the graph used to pass information to the client on the supports
   virtual std::string BuildSIL(vtkMutableDirectedGraph*);
-  virtual void Reload(int);
+
+  // Description
+  // Reload will delete the internal reader and recreate it with default properties
+  virtual void Reload();
+
   virtual int GetServerModifTime();
   //
   virtual void GenerateVectors(int);
   virtual void ChangeMode(int);
-  virtual const char *GetSeparator();
+  static const char *GetSeparator();
+
+  // Description
+  // Static information key used to transfer the meta data graph along the pipeline
+  static vtkInformationDataObjectMetaDataKey* META_DATA();
+
  protected:
   vtkMEDReader();
   virtual ~vtkMEDReader();
   virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
   virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
  private:
-  void UpdateSIL(vtkInformation *info);
+  void UpdateSIL(vtkInformation *request, vtkInformation *info);
   virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated);
   virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS);
  private:
   //BTX
   //ETX
+
   class vtkMEDReaderInternal;
   vtkMEDReaderInternal* Internal;
 };
diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader2.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader2.cxx
new file mode 100644 (file)
index 0000000..a0035f7
--- /dev/null
@@ -0,0 +1,573 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "vtkMEDReader.h"
+#include "vtkGenerateVectors.h"
+
+#include "vtkMultiBlockDataSet.h"
+#include "vtkInformation.h"
+#include "vtkDataSetAttributes.h"
+#include "vtkStringArray.h"
+#include "vtkMutableDirectedGraph.h"
+#include "vtkInformationStringKey.h"
+//
+#include "vtkUnsignedCharArray.h"
+#include "vtkInformationVector.h"
+#include "vtkSmartPointer.h"
+#include "vtkVariantArray.h"
+#include "vtkExecutive.h"
+#include "vtkStreamingDemandDrivenPipeline.h"
+#include "vtkMultiTimeStepAlgorithm.h"
+#include "vtkUnstructuredGrid.h"
+#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
+#include "vtkQuadratureSchemeDefinition.h"
+#include "vtkPointData.h"
+#include "vtkCellData.h"
+#include "vtkCellType.h"
+#include "vtkCellArray.h"
+#include "vtkDoubleArray.h"
+#include "vtkObjectFactory.h"
+#ifdef MEDREADER_USE_MPI
+#include "vtkMultiProcessController.h"
+#endif
+
+#include "MEDFileFieldRepresentationTree.hxx"
+
+#include <map>
+#include <string>
+#include <vector>
+#include <sstream>
+#include <algorithm>
+
+/*!
+ * This class stores properties in loading state mode (pvsm) when the MED file has not been read yet.
+ * The file is not read beacause FileName has not been informed yet ! So this class stores properties of vtkMEDReader instance that 
+ * owns it and wait the vtkMEDReader::SetFileName to apply properties afterwards.
+ */
+class PropertyKeeper
+{
+public:
+  PropertyKeeper(vtkMEDReader *master):_master(master),IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0) { }
+  void assignPropertiesIfNeeded();
+  bool arePropertiesOnTreeToSetAfter() const;
+  //
+  void pushFieldStatusEntry(const char* name, int status);
+  void pushGenerateVectorsValue(int value);
+  void pushChangeModeValue(int value);
+  void pushTimesFlagsStatusEntry(const char* name, int status);
+protected:
+  // pool of pairs to assign in SetFieldsStatus if needed. The use case is the load using pvsm.
+  std::vector< std::pair<std::string,int> > SetFieldsStatusPairs;
+  // generate vector
+  bool IsGVActivated;
+  int GVValue;
+  // change mode
+  bool IsCMActivated;
+  int CMValue;
+  //
+  std::vector< std::pair<std::string,int> > TimesFlagsStatusPairs;
+  vtkMEDReader *_master;
+};
+
+void PropertyKeeper::assignPropertiesIfNeeded()
+{
+  if(!this->SetFieldsStatusPairs.empty())
+    {
+      for(std::vector< std::pair<std::string,int> >::const_iterator it=this->SetFieldsStatusPairs.begin();it!=this->SetFieldsStatusPairs.end();it++)
+        _master->SetFieldsStatus((*it).first.c_str(),(*it).second);
+      this->SetFieldsStatusPairs.clear();
+    }
+  if(!this->TimesFlagsStatusPairs.empty())
+    {
+      for(std::vector< std::pair<std::string,int> >::const_iterator it=this->TimesFlagsStatusPairs.begin();it!=this->TimesFlagsStatusPairs.end();it++)
+        _master->SetTimesFlagsStatus((*it).first.c_str(),(*it).second);
+      this->TimesFlagsStatusPairs.clear();
+    }
+  if(this->IsGVActivated)
+    {
+      _master->GenerateVectors(this->GVValue);
+      this->IsGVActivated=false;
+    }
+  if(this->IsCMActivated)
+    {
+      _master->ChangeMode(this->CMValue);
+      this->IsCMActivated=false;
+    }
+}
+
+void PropertyKeeper::pushFieldStatusEntry(const char* name, int status)
+{
+  bool found(false);
+  for(std::vector< std::pair<std::string,int> >::const_iterator it=this->SetFieldsStatusPairs.begin();it!=this->SetFieldsStatusPairs.end() && !found;it++)
+    found=(*it).first==name;
+  if(!found)
+    this->SetFieldsStatusPairs.push_back(std::pair<std::string,int>(name,status));
+}
+
+void PropertyKeeper::pushTimesFlagsStatusEntry(const char* name, int status)
+{
+  bool found(false);
+  for(std::vector< std::pair<std::string,int> >::const_iterator it=this->TimesFlagsStatusPairs.begin();it!=this->TimesFlagsStatusPairs.end() && !found;it++)
+    found=(*it).first==name;
+  if(!found)
+    this->TimesFlagsStatusPairs.push_back(std::pair<std::string,int>(name,status));
+}
+
+void PropertyKeeper::pushGenerateVectorsValue(int value)
+{
+  this->IsGVActivated=true;
+  this->GVValue=value;
+}
+
+void PropertyKeeper::pushChangeModeValue(int value)
+{
+  this->IsCMActivated=true;
+  this->CMValue=value;
+}
+
+bool PropertyKeeper::arePropertiesOnTreeToSetAfter() const
+{
+  return !SetFieldsStatusPairs.empty();
+}
+
+class vtkMEDReader::vtkMEDReaderInternal
+{
+
+public:
+  vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),FirstCall0(2),PK(master),MyMTime(0), ReloadReq(0)
+  {
+  }
+  
+  bool PluginStart0()
+  {
+    if(FirstCall0==0)
+      return false;
+    FirstCall0--;
+    return true;
+  }
+  
+  ~vtkMEDReaderInternal()
+  {
+    if(this->SIL)
+      this->SIL->Delete();
+  }
+public:
+  MEDFileFieldRepresentationTree Tree;
+  TimeKeeper TK;
+  std::string FileName;
+  //when true the file is MED file. when false it is a Sauv file
+  bool IsMEDOrSauv;
+  //when false -> std, true -> mode. By default std (false).
+  bool IsStdOrMode;
+  //when false -> do nothing. When true cut off or extend to nbOfCompo=3 vector arrays.
+  bool GenerateVect;
+  std::string DftMeshName;
+  // Store the vtkMutableDirectedGraph that represents links between family, groups and cell types
+  vtkMutableDirectedGraph* SIL;
+  // store the lev0 id in Tree corresponding to the TIME_STEPS in the pipeline.
+  int LastLev0;
+  // The property keeper is usable only in pvsm mode.
+  PropertyKeeper PK;
+  int MyMTime;
+  std::set<std::string> _wonderful_set;// this set is used by SetFieldsStatus method to detect the fact that SetFieldsStatus has been called for all items ! Great Items are not sorted ! Why ?
+  std::map<std::string,bool> _wonderful_ref;// this map stores the state before a SetFieldsStatus status.
+
+  int ReloadReq;
+private:
+  unsigned char FirstCall0;
+};
+
+vtkStandardNewMacro(vtkMEDReader);
+
+vtkMEDReader::vtkMEDReader():Internal(new vtkMEDReaderInternal(this))
+{
+  this->SetNumberOfInputPorts(0);
+  this->SetNumberOfOutputPorts(1);
+}
+
+vtkMEDReader::~vtkMEDReader()
+{
+  delete this->Internal;
+}
+
+void vtkMEDReader::Reload()
+{
+  this->Internal->ReloadReq = this->Internal->ReloadReq++;
+  std::cerr << "vtkMEDReader::Reload" << std::endl;
+  std::string fName((const char *)this->GetFileName());
+  delete this->Internal;
+  this->Internal=new vtkMEDReaderInternal(this);
+  this->SetFileName(fName.c_str());
+}
+
+int vtkMEDReader::GetReloadReq()
+{
+  cout<<"Get Reload Req Null" <<endl;
+/*  int ret = this->Internal->ReloadReq;
+ // this->Internal->ReloadReq = 0;
+  return ret;*/
+}
+int vtkMEDReader::GetReloadReq(int a)
+{
+  cout<<"Get Reload Req:"<< a <<endl;
+ /* int ret = this->Internal->ReloadReq;
+ // this->Internal->ReloadReq = 0;
+  return ret;*/
+}
+
+int vtkMEDReader::GetServerModifTime()
+{
+  return this->Internal->MyMTime;
+}
+
+void vtkMEDReader::GenerateVectors(int val)
+{
+  if(this->Internal->FileName.empty())
+    {//pvsm mode
+      this->Internal->PK.pushGenerateVectorsValue(val);
+      return ;
+    }
+  //not pvsm mode (general case)
+  bool val2((bool)val);
+  if(val2!=this->Internal->GenerateVect)
+    {
+      this->Internal->GenerateVect=val2;
+      this->Modified();
+    }
+}
+
+void vtkMEDReader::ChangeMode(int newMode)
+{
+  if(this->Internal->FileName.empty())
+    {//pvsm mode
+      this->Internal->PK.pushChangeModeValue(newMode);
+      return ;
+    }
+  //not pvsm mode (general case)
+  this->Internal->IsStdOrMode=newMode!=0;
+  this->Modified();
+}
+
+const char *vtkMEDReader::GetSeparator()
+{
+  return MEDFileFieldRepresentationLeavesArrays::ZE_SEP;
+}
+
+void vtkMEDReader::SetFileName(const char *fname)
+{
+  try
+    {
+      this->Internal->FileName=fname;
+      std::size_t pos(this->Internal->FileName.find_last_of('.'));
+      if(pos!=std::string::npos)
+        {
+          std::string ext(this->Internal->FileName.substr(pos));
+          if(ext.find("sauv")!=std::string::npos)
+            this->Internal->IsMEDOrSauv=false;
+        }
+      if(this->Internal->Tree.getNumberOfLeavesArrays()==0)
+        {
+          int iPart(-1),nbOfParts(-1);
+#ifdef MEDREADER_USE_MPI
+          vtkMultiProcessController *vmpc(vtkMultiProcessController::GetGlobalController());
+          if(vmpc)
+            {
+              iPart=vmpc->GetLocalProcessId();
+              nbOfParts=vmpc->GetNumberOfProcesses();
+            }
+#endif
+          this->Internal->Tree.loadMainStructureOfFile(this->Internal->FileName.c_str(),this->Internal->IsMEDOrSauv,iPart,nbOfParts);
+          if(!this->Internal->PK.arePropertiesOnTreeToSetAfter())
+            this->Internal->Tree.activateTheFirst();//This line manually initialize the status of server (this) with the remote client.
+          this->Internal->TK.setMaxNumberOfTimeSteps(this->Internal->Tree.getMaxNumberOfTimeSteps());
+        }
+      this->Modified();
+      this->Internal->PK.assignPropertiesIfNeeded();
+    }
+  catch(INTERP_KERNEL::Exception& e)
+    {
+      delete this->Internal;
+      this->Internal=0;
+      std::ostringstream oss;
+      oss << "Exception has been thrown in vtkMEDReader::SetFileName : " << e.what() << std::endl;
+      if(this->HasObserver("ErrorEvent") )
+        this->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
+      else
+        vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
+      vtkObject::BreakOnError();
+    }
+}
+
+char *vtkMEDReader::GetFileName()
+{
+  return const_cast<char *>(this->Internal->FileName.c_str());
+}
+
+int vtkMEDReader::RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
+{
+  std::cout << "########################################## RequestInformation ##########################################" << std::endl;
+  if(!this->Internal)
+    return 0;
+  try
+    {
+      vtkInformation *outInfo(outputVector->GetInformationObject(0));
+      outInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkMultiBlockDataSet");
+      this->UpdateSIL(outInfo);
+      //
+      bool dummy(false);
+      this->PublishTimeStepsIfNeeded(outInfo,dummy);
+    }
+  catch(INTERP_KERNEL::Exception& e)
+    {
+      std::ostringstream oss;
+      oss << "Exception has been thrown in vtkMEDReader::RequestInformation : " << e.what() << std::endl;
+      if(this->HasObserver("ErrorEvent") )
+        this->InvokeEvent("ErrorEvent",const_cast<char *>(oss.str().c_str()));
+      else
+        vtkOutputWindowDisplayErrorText(const_cast<char *>(oss.str().c_str()));
+      vtkObject::BreakOnError();
+      return 0;
+    }
+  return 1;
+}
+
+int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
+{
+  std::cout << "########################################## RequestData ##########################################" << std::endl;
+  if(!this->Internal)
+    return 0;
+  try
+    {
+      vtkInformation *outInfo(outputVector->GetInformationObject(0));
+      vtkMultiBlockDataSet *output(vtkMultiBlockDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
+      bool isUpdated(false);
+      double reqTS(0.);
+      if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
+        reqTS=outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
+      this->FillMultiBlockDataSetInstance(output,reqTS);
+      output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS);
+      this->UpdateSIL(outInfo);
+      //this->UpdateProgress((float) progress/((float) maxprogress-1));
+    }
+  catch(INTERP_KERNEL::Exception& e)
+    {
+      std::cerr << "Exception has been thrown in vtkMEDReader::RequestData : " << e.what() << std::endl;
+      return 0;
+    }
+  return 1;
+}
+
+void vtkMEDReader::SetFieldsStatus(const char* name, int status)
+{
+  //this->Internal->_wonderful_set.insert(name);
+  if(this->Internal->FileName.empty())
+    {//pvsm mode
+      this->Internal->PK.pushFieldStatusEntry(name,status);
+      return ;
+    }
+  if(this->Internal->_wonderful_set.empty())
+    this->Internal->_wonderful_ref=this->Internal->Tree.dumpState();// start of SetFieldsStatus serie -> store ref to compare at the end of the SetFieldsStatus serie.
+  this->Internal->_wonderful_set.insert(name);
+  //not pvsm mode (general case)
+  try
+    {
+      this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(this->Internal->Tree.getIdHavingZeName(name),status);
+      if(this->Internal->_wonderful_set.size()==GetNumberOfFieldsTreeArrays())
+        {
+          if(this->Internal->_wonderful_ref!=this->Internal->Tree.dumpState())
+            {
+              if(!this->Internal->PluginStart0())
+                {
+                  this->Modified();
+                }
+              this->Internal->MyMTime++;
+            }
+          this->Internal->_wonderful_set.clear();
+        }
+    }
+  catch(INTERP_KERNEL::Exception& e)
+    {
+      if(!this->Internal->FileName.empty())
+        {
+          std::cerr << "vtkMEDReader::SetFieldsStatus error : " << e.what() << " *** WITH STATUS=" << status << endl;
+          return ;
+        }
+    }
+}
+
+int vtkMEDReader::GetNumberOfFieldsTreeArrays()
+{
+  if(!this->Internal)
+    return 0;
+//  std::cout << "vtkMEDReader::GetNumberOfFieldsTreeArrays called ! " << std::endl;
+  return this->Internal->Tree.getNumberOfLeavesArrays();
+}
+
+const char *vtkMEDReader::GetFieldsTreeArrayName(int index)
+{
+//  std::cout << "vtkMEDReader::GetFieldsTreeArrayName(" << index << ") called ! " << std::endl;
+  return this->Internal->Tree.getNameOfC(index);
+}
+
+int vtkMEDReader::GetFieldsTreeArrayStatus(const char *name)
+{
+  int zeId(this->Internal->Tree.getIdHavingZeName(name));
+  int ret(this->Internal->Tree.getStatusOf(zeId));
+  return ret;
+}
+
+void vtkMEDReader::SetTimesFlagsStatus(const char *name, int status)
+{
+  if(this->Internal->FileName.empty())
+    {//pvsm mode
+      this->Internal->PK.pushTimesFlagsStatusEntry(name,status);
+      return ;
+    }
+  //not pvsm mode (general case)
+  int pos(0);
+  std::istringstream iss(name); iss >> pos;
+  this->Internal->TK.getTimesFlagArray()[pos].first=(bool)status;
+  if(pos==this->Internal->TK.getTimesFlagArray().size()-1)
+    if(!this->Internal->PluginStart0())
+      {
+        this->Modified();
+        //this->Internal->TK.printSelf(std::cerr);
+      }
+}
+
+int vtkMEDReader::GetNumberOfTimesFlagsArrays()
+{
+  if(!this->Internal)
+    return 0;
+  return (int)this->Internal->TK.getTimesFlagArray().size();
+}
+
+const char *vtkMEDReader::GetTimesFlagsArrayName(int index)
+{
+  return this->Internal->TK.getTimesFlagArray()[index].second.c_str();
+}
+
+int vtkMEDReader::GetTimesFlagsArrayStatus(const char *name)
+{
+  int pos(0);
+  std::istringstream iss(name); iss >> pos;
+  return (int)this->Internal->TK.getTimesFlagArray()[pos].first;
+}
+
+void vtkMEDReader::UpdateSIL(vtkInformation *info)
+{
+  if(!this->Internal)
+      return ;
+  vtkMutableDirectedGraph *sil(vtkMutableDirectedGraph::New());
+  std::string meshName(this->BuildSIL(sil));
+  if(meshName!=this->Internal->DftMeshName)
+    {
+      if(this->Internal->SIL)
+        this->Internal->SIL->Delete();
+      this->Internal->SIL=sil;
+      this->Internal->DftMeshName=meshName;
+      info->Set(vtkDataObject::SIL(),this->Internal->SIL);
+      //request->AppendUnique(vtkExecutive::KEYS_TO_COPY(),vtkDataObject::SIL());
+    }
+  else
+    {
+      sil->Delete();
+    }
+}
+
+/*!
+ * The returned string is the name of the mesh activated which groups and families are in \a sil.
+ */
+std::string vtkMEDReader::BuildSIL(vtkMutableDirectedGraph* sil)
+{
+  sil->Initialize();
+  vtkSmartPointer<vtkVariantArray> childEdge(vtkSmartPointer<vtkVariantArray>::New());
+  childEdge->InsertNextValue(0);
+  vtkSmartPointer<vtkVariantArray> crossEdge(vtkSmartPointer<vtkVariantArray>::New());
+  crossEdge->InsertNextValue(1);
+  // CrossEdge is an edge linking hierarchies.
+  vtkUnsignedCharArray* crossEdgesArray=vtkUnsignedCharArray::New();
+  crossEdgesArray->SetName("CrossEdges");
+  sil->GetEdgeData()->AddArray(crossEdgesArray);
+  crossEdgesArray->Delete();
+  std::vector<std::string> names;
+  // Now build the hierarchy.
+  vtkIdType rootId=sil->AddVertex();
+  names.push_back("SIL");
+  // Add global fields root
+  vtkIdType fieldsRoot(sil->AddChild(rootId,childEdge));
+  names.push_back("FieldsStatusTree");
+  this->Internal->Tree.feedSIL(sil,fieldsRoot,childEdge,names);
+  vtkIdType meshesFamsGrpsRoot(sil->AddChild(rootId,childEdge));
+  names.push_back("MeshesFamsGrps");
+  std::string dftMeshName(this->Internal->Tree.feedSILForFamsAndGrps(sil,meshesFamsGrpsRoot,childEdge,names));
+  // This array is used to assign names to nodes.
+  vtkStringArray *namesArray(vtkStringArray::New());
+  namesArray->SetName("Names");
+  namesArray->SetNumberOfTuples(sil->GetNumberOfVertices());
+  sil->GetVertexData()->AddArray(namesArray);
+  namesArray->Delete();
+  std::vector<std::string>::const_iterator iter;
+  vtkIdType cc;
+  for(cc=0, iter=names.begin(); iter!=names.end(); ++iter, ++cc)
+    namesArray->SetValue(cc,(*iter).c_str());
+  return dftMeshName;
+}
+
+double vtkMEDReader::PublishTimeStepsIfNeeded(vtkInformation *outInfo, bool& isUpdated)
+{
+  int lev0(-1);
+  std::vector<double> tsteps;
+  if(!this->Internal->IsStdOrMode)
+    tsteps=this->Internal->Tree.getTimeSteps(lev0,this->Internal->TK);
+  else
+    { tsteps.resize(1); tsteps[0]=0.; }
+  isUpdated=false;
+  if(lev0!=this->Internal->LastLev0)
+    {
+      isUpdated=true;
+      double timeRange[2];
+      timeRange[0]=tsteps.front();
+      timeRange[1]=tsteps.back();
+      outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
+      outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
+      this->Internal->LastLev0=lev0;
+    }
+  return tsteps.front();
+}
+
+void vtkMEDReader::FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS)
+{
+  std::string meshName;
+  vtkDataSet *ret(this->Internal->Tree.buildVTKInstance(this->Internal->IsStdOrMode,reqTS,meshName,this->Internal->TK));
+  if(this->Internal->GenerateVect)
+    {
+      vtkGenerateVectors::Operate(ret->GetPointData());
+      vtkGenerateVectors::Operate(ret->GetCellData());
+      vtkGenerateVectors::Operate(ret->GetFieldData());
+    }
+  output->SetBlock(0,ret);
+  ret->Delete();
+}
+
+void vtkMEDReader::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os, indent);
+}
diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader2.h b/src/Plugins/MEDReader/IO/vtkMEDReader2.h
new file mode 100644 (file)
index 0000000..17bc123
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __vtkMEDReader_h_
+#define __vtkMEDReader_h_
+
+#include <string>
+
+#include "vtkMultiBlockDataSetAlgorithm.h"
+
+class vtkMutableDirectedGraph;
+
+class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm
+{
+ private:
+  vtkMEDReader(const vtkMEDReader&); // Not implemented.
+  void operator=(const vtkMEDReader&); // Not implemented.
+ public:
+  static vtkMEDReader *New();
+  vtkTypeMacro(vtkMEDReader, vtkMultiBlockDataSetAlgorithm);
+  void PrintSelf(ostream& os, vtkIndent indent);
+  virtual void SetFileName(const char*);
+  virtual char *GetFileName();
+  virtual const char *GetFileExtensions() { return ".med .rmed .sauv .sauve"; }
+  virtual const char *GetDescriptiveName() { return "MED file (Data Exchange Model)"; }
+  //
+  virtual void SetFieldsStatus(const char *name, int status);
+  virtual int GetNumberOfFieldsTreeArrays();
+  virtual const char *GetFieldsTreeArrayName(int index);
+  virtual int GetFieldsTreeArrayStatus(const char *name);
+  //
+  virtual int GetTimesFlagsArrayStatus(const char *name);
+  virtual void SetTimesFlagsStatus(const char *name, int status);
+  virtual int GetNumberOfTimesFlagsArrays();
+  virtual const char *GetTimesFlagsArrayName(int index);
+  //! Build the graph used to pass information to the client on the supports
+  virtual std::string BuildSIL(vtkMutableDirectedGraph*);
+  virtual void Reload();
+  virtual int GetReloadReq(int a);
+  virtual int GetReloadReq();
+  virtual int GetServerModifTime();
+  //
+  virtual void GenerateVectors(int);
+  virtual void ChangeMode(int);
+  static const char *GetSeparator();
+
+ protected:
+  vtkMEDReader();
+  virtual ~vtkMEDReader();
+  virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
+  virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
+ private:
+  void UpdateSIL(vtkInformation *info);
+  virtual double PublishTimeStepsIfNeeded(vtkInformation*, bool& isUpdated);
+  virtual void FillMultiBlockDataSetInstance(vtkMultiBlockDataSet *output, double reqTS);
+ private:
+  //BTX
+  //ETX
+  class vtkMEDReaderInternal;
+  vtkMEDReaderInternal* Internal;
+};
+
+#endif //__vtkMEDReader_h_
index cf81df2547101ad1d7544c0146f7862c3c789ca7..65991d570a197a4f059562d6b62c2e64bac6c6b8 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/IO )
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../IO )
 
 IF(PARAVIEW_BUILD_QT_GUI)
 
-  QT4_WRAP_UI(CLIENT_UI_SRCS Resources/UI/MEDReaderPanel.ui Resources/UI/ExtractGroupPanel.ui Resources/UI/ExtractCellTypePanel.ui)
-  
+  QT4_WRAP_UI(CLIENT_UI_SRCS
+    Resources/UI/MEDReaderVectorsWidget.ui
+    Resources/UI/MEDReaderTimeModeWidget.ui)
+
   # create a plugin that implements an object panel for the reader
-  SET(CLIENT_SRCS pqMEDReaderPanel.cxx pqExtractGroupPanel.cxx pqExtractCellTypePanel.cxx VectBoolSpreadSheet.cxx VectBoolWidget.cxx)
-  
-  QT4_WRAP_CPP(MOC_SRCS pqMEDReaderPanel.h pqExtractGroupPanel.h pqExtractCellTypePanel.h VectBoolSpreadSheet.h VectBoolWidget.h)
-  
-  ADD_PARAVIEW_OBJECT_PANEL(MEDREADER_IFACES MEDREADER_IFACE_SRCS
-    CLASS_NAME pqMEDReaderPanel
-    XML_NAME MEDReader
-    XML_GROUP sources
-    )
-  
-  ADD_PARAVIEW_OBJECT_PANEL(EXTRACTGROUP_IFACES EXTRACTGROUP_IFACE_SRCS
-    CLASS_NAME pqExtractGroupPanel
-    XML_NAME ExtractGroup
-    XML_GROUP filters
-    )
+  SET(SM_SRCS
+    vtkPVMetaDataInformation.cxx)
+
+  SET(CLIENT_SRCS
+    pqExtractGroupFieldsWidget.cxx
+    pqAbstractFieldsWidget.cxx
+    VectBoolSpreadSheet.cxx
+    VectBoolWidget.cxx
+    pqMEDReaderGraphUtils.cxx
+    pqMEDReaderVectorsWidget.cxx
+    pqMEDReaderTimeModeWidget.cxx
+    pqMEDReaderReloadWidget.cxx
+    pqMEDReaderTimesFlagsWidget.cxx
+    pqMEDReaderFieldsWidget.cxx)
+
+  QT4_WRAP_CPP(MOC_SRCS
+    pqExtractGroupFieldsWidget.h
+    pqAbstractFieldsWidget.h
+    VectBoolSpreadSheet.h
+    VectBoolWidget.h
+    pqMEDReaderVectorsWidget.h
+    pqMEDReaderTimeModeWidget.h
+    pqMEDReaderReloadWidget.h
+    pqMEDReaderTimesFlagsWidget.h
+    pqMEDReaderFieldsWidget.h)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(MEDREADER_TIMEMODE_IFACES MEDREADER_TIMEMODE_IFACE_SRCS
+    TYPE "MEDReaderTimeModeWidgetType"
+    CLASS_NAME pqMEDReaderTimeModeWidget)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(MEDREADER_RELOAD_IFACES MEDREADER_RELOAD_IFACE_SRCS
+    TYPE "MEDReaderReloadWidgetType"
+    CLASS_NAME pqMEDReaderReloadWidget)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(MEDREADER_VECTORS_IFACES MEDREADER_VECTORS_IFACE_SRCS
+    TYPE "MEDReaderVectorsWidgetType"
+    CLASS_NAME pqMEDReaderVectorsWidget)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(MEDREADER_TIMESFLAGS_IFACES MEDREADER_TIMESFLAGS_IFACE_SRCS
+    TYPE "MEDReaderTimesFlagsWidgetType"
+    CLASS_NAME pqMEDReaderTimesFlagsWidget)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(MEDREADER_FIELDS_IFACES MEDREADER_FIELDS_IFACE_SRCS
+    TYPE "MEDReaderFieldsWidgetType"
+    CLASS_NAME pqMEDReaderFieldsWidget)
+
+  ADD_PARAVIEW_PROPERTY_WIDGET(EXTRACTGROUP_FIELDS_IFACES EXTRACTGROUP_FIELDS_IFACES_SRCS
+    TYPE "ExtractGroupFieldsWidgetType"
+    CLASS_NAME pqExtractGroupFieldsWidget)
 
-  ADD_PARAVIEW_OBJECT_PANEL(EXTRACTCELLTYPE_IFACES EXTRACTCELLTYPE_IFACE_SRCS
-    CLASS_NAME pqExtractCellTypePanel
-    XML_NAME ExtractCellType
-    XML_GROUP filters
-    )
-  
   # create the med reader plugin itself
   ADD_PARAVIEW_PLUGIN(MEDReaderPlugin "4.0"
+    SERVER_MANAGER_SOURCES ${SM_SRCS}
     SERVER_MANAGER_XML Resources/MEDReaderServer.xml
-    GUI_INTERFACES ${MEDREADER_IFACES} ${EXTRACTGROUP_IFACES} ${EXTRACTCELLTYPE_IFACES}
+    GUI_INTERFACES
+      ${MEDREADER_TIMEMODE_IFACES}
+      ${MEDREADER_RELOAD_IFACES}
+      ${MEDREADER_TIMESFLAGS_IFACES}
+      ${MEDREADER_FIELDS_IFACES}
+      ${MEDREADER_VECTORS_IFACES}
+      ${EXTRACTGROUP_FIELDS_IFACES}
     GUI_RESOURCES Resources/pqMEDReader.qrc
-    GUI_SOURCES ${CLIENT_SRCS}
-    ${CLIENT_UI_SRCS}
-    ${MOC_SRCS}
-    ${MEDREADER_IFACE_SRCS} ${EXTRACTGROUP_IFACE_SRCS} ${EXTRACTCELLTYPE_IFACE_SRCS}
+    SOURCES
+      ${CLIENT_SRCS}
+      ${CLIENT_UI_SRCS}
+      ${MOC_SRCS}
+      ${MEDREADER_TIMEMODE_IFACE_SRCS}
+      ${MEDREADER_RELOAD_IFACE_SRCS}
+      ${MEDREADER_TIMESFLAGS_IFACE_SRCS}
+      ${MEDREADER_FIELDS_IFACE_SRCS}
+      ${MEDREADER_VECTORS_IFACE_SRCS}
+      ${EXTRACTGROUP_FIELDS_IFACES_SRCS}
     CS_KITS
     # this is the same name as the name in module.cmake file IO
     # directory.
     vtkMEDReader
     )
-  
+
 ELSE(PARAVIEW_BUILD_QT_GUI)
-  
+
   # create the med reader plugin itself
   ADD_PARAVIEW_PLUGIN(MEDReaderPlugin "4.0"
     SERVER_MANAGER_SOURCES ${SM_SRCS}
@@ -72,7 +115,7 @@ ELSE(PARAVIEW_BUILD_QT_GUI)
     # directory.
     vtkMEDReader
     )
-  
+
 ENDIF(PARAVIEW_BUILD_QT_GUI)
 
 TARGET_LINK_LIBRARIES(MEDReaderPlugin vtkMEDReader vtkMEDReaderCS)
@@ -85,5 +128,3 @@ INSTALL(
   )
 
 
-
-
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderClient2.xml b/src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderClient2.xml
deleted file mode 100644 (file)
index 415554f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<ParaViewFilters>
-    <Filter name="ExtractGroup"/>
-    <Filter name="ExtractCellType"/>
-    <Category name="Mechanics" menu_label="&amp;Mechanics" preserve_order="1">
-      <Filter name="ELNOPoints"/>
-      <Filter name="ELNOMesh"/>
-      <Filter name="ELNOSurface"/>
-      <Filter name="GaussPoints"/>
-    </Category>
-</ParaViewFilters>
index cf89105d40eb69d57e2851ed3757814d4423f9ca..f4a772d654e3a6171f6a9e20debaba8496233a0f 100644 (file)
@@ -8,53 +8,31 @@
        </ReaderFactory>
       </Hints>
 
+      <Property name="Reload"
+                command="Reload"
+                panel_widget="MEDReaderReloadWidgetType"/>
+
       <StringVectorProperty
         name="FileName"
         command="SetFileName"
         number_of_elements="1"
+        panel_visibility="never"
         animateable="0">
         <FileListDomain name="files" />
         <Documentation>
           This property specifies the file name for the MED reader.
         </Documentation>
       </StringVectorProperty>
-      
-      <IntVectorProperty
-        name="ReloadReq"
-        command="Reload"
-        number_of_elements="1"
-        default_values="0"
-        animateable="0">
-        <SimpleIntInformationHelper />
-      </IntVectorProperty>
 
       <IntVectorProperty command="GetServerModifTime" information_only="1" name="ServerModifTime">
         <SimpleIntInformationHelper />
       </IntVectorProperty>
 
-      <IntVectorProperty
-        name="GenerateVectors"
-        command="GenerateVectors"
-        number_of_elements="1"
-        default_values="0"
-        animateable="0">
-        <SimpleIntInformationHelper />
-      </IntVectorProperty>
-
-      <IntVectorProperty
-        name="TimeOrModal"
-        command="ChangeMode"
-        number_of_elements="1"
-        default_values="0"
-        animateable="0">
-        <SimpleIntInformationHelper />
-      </IntVectorProperty>
-
       <!-- retrieves using GetNumberOf[FieldsTree]Arrays and GetFieldsTreeArrayName the keys used by FieldsStatus -->
       <StringVectorProperty name="FieldsTreeInfo" information_only="1">
         <ArraySelectionInformationHelper attribute_name="FieldsTree" />
       </StringVectorProperty>
-      
+
       <StringVectorProperty
         name="FieldsStatus"
         command="SetFieldsStatus"
@@ -63,7 +41,9 @@
         repeat_command="1"
         number_of_elements_per_command="2"
         element_types="2 0"
-        information_property="FieldsTreeInfo">
+        information_property="FieldsTreeInfo"
+        immediate_update="1"
+        panel_widget="MEDReaderFieldsWidgetType">
         <ArraySelectionDomain name="array_list">
           <RequiredProperties>
             <Property name="FieldsTreeInfo" function="ArrayList" />
        </Documentation>
       </StringVectorProperty>
 
-      <StringVectorProperty name="TimesFlagsInfo" information_only="1">
-       <ArraySelectionInformationHelper attribute_name="TimesFlags" />
-     </StringVectorProperty>
-     
-     <StringVectorProperty name="TimesFlagsStatus" command="SetTimesFlagsStatus"
-                           label="All TimeSteps"
-                           number_of_elements="0"
-                           repeat_command="1"
-                           number_of_elements_per_command="2"
-                           element_types="2 0"
-                           information_property="TimesFlagsInfo">
-       <ArraySelectionDomain name="array_list">
-         <RequiredProperties>
-           <Property name="TimesFlagsInfo" function="ArrayList" />
-         </RequiredProperties>
-       </ArraySelectionDomain>
-       <Documentation>
-          This property lists all groups and families to select.
-       </Documentation>
-     </StringVectorProperty>
+      <IntVectorProperty name="VectorsProperty"
+                         label="Generate Vectors"
+                         command="GenerateVectors"
+                         number_of_elements="1"
+                         default_values="0"
+                         panel_widget="MEDReaderVectorsWidgetType">
+        <Documentation>
+          This property define if the reader generate vectors.
+        </Documentation>
+        <BooleanDomain name="bool"/>
+      </IntVectorProperty>
+      <IntVectorProperty name="TimeModeProperty"
+                         label="Activate Mode"
+                         command="ChangeMode"
+                         number_of_elements="1"
+                         default_values="0"
+                         panel_widget="MEDReaderTimeModeWidgetType">
+        <Documentation>
+          This property define if the reader read time steps as modes or not.
+        </Documentation>
+        <BooleanDomain name="bool"/>
+      </IntVectorProperty>
 
       <StringVectorProperty
         name="Separator"
         </Documentation>
       </DoubleVectorProperty>
 
-    </SourceProxy>
+      <StringVectorProperty name="TimesFlagsInfo" information_only="1">
+       <ArraySelectionInformationHelper attribute_name="TimesFlags" />
+     </StringVectorProperty>
+
+     <StringVectorProperty name="TimesFlagsStatus" command="SetTimesFlagsStatus"
+                           label="All TimeSteps"
+                           number_of_elements="0"
+                           repeat_command="1"
+                           number_of_elements_per_command="2"
+                           element_types="2 0"
+                           information_property="TimesFlagsInfo"
+                           panel_widget="MEDReaderTimesFlagsWidgetType">
+       <ArraySelectionDomain name="array_list">
+         <RequiredProperties>
+           <Property name="TimesFlagsInfo" function="ArrayList" />
+         </RequiredProperties>
+       </ArraySelectionDomain>
+        <Documentation>
+          This property define which time steps the reader should read.
+        </Documentation>
+        <Hints>
+          <PropertyWidgetDecorator type="ShowWidgetDecorator">
+            <Property name="TimeModeProperty" function="boolean" />
+          </PropertyWidgetDecorator>
+        </Hints>
+     </StringVectorProperty>
+
+   </SourceProxy>
   </ProxyGroup>
 
   <ProxyGroup name="filters">
          This property specifies the input to the Level Scalars filter.
        </Documentation>
      </InputProperty>
-     
-     <IntVectorProperty name="SILUpdateStamp" command="GetSILUpdateStamp" information_only="1">
-       <SimpleIntInformationHelper />
-       <Documentation>
-         Information property indicating the update stamp of the SIL. Every
-         time the SIL is rebuild, this
-         time stamp is changed.
-       </Documentation>
-     </IntVectorProperty>
-     
+
      <StringVectorProperty name="GroupsFlagsInfo" information_only="1">
        <ArraySelectionInformationHelper attribute_name="GroupsFlags" />
      </StringVectorProperty>
-     
+
      <StringVectorProperty name="GroupsFlagsStatus" command="SetGroupsFlagsStatus"
                            label="All Groups"
                            number_of_elements="0"
                            repeat_command="1"
                            number_of_elements_per_command="2"
                            element_types="2 0"
-                           information_property="GroupsFlagsInfo">
+                           information_property="GroupsFlagsInfo"
+                           panel_widget="ExtractGroupFieldsWidgetType">
        <ArraySelectionDomain name="array_list">
          <RequiredProperties>
            <Property name="GroupsFlagsInfo" function="ArrayList" />
        </Documentation>
      </StringVectorProperty>
 
-     <IntVectorProperty command="SetInsideOut" default_values="0" name="InsideOut" number_of_elements="1">
+     <IntVectorProperty command="SetInsideOut" default_values="0" name="InsideOut" label="Extract Complementary" number_of_elements="1">
        <BooleanDomain name="bool"/>
        <Documentation>Choose which part of the dataset to keep regarding the selected Groups/Families. When 0 (default) the direct selection
        is kept. When 1 the complementary part is selected.
           This property returns the name of the mesh.
         </Documentation>
       </StringVectorProperty>
+
     </SourceProxy>
   </ProxyGroup>
-  
+
   <ProxyGroup name="filters">
     <SourceProxy name="ExtractCellType" class="vtkExtractCellType" label="Extract Cell Type">
      <InputProperty name="Input" command="SetInputConnection">
          This property specifies the input to the Level Scalars filter.
        </Documentation>
      </InputProperty>
-     
-     <IntVectorProperty name="SILUpdateStamp" command="GetSILUpdateStamp" information_only="1">
-       <SimpleIntInformationHelper />
-       <Documentation>
-         Information property indicating the update stamp of the SIL. Every
-         time the SIL is rebuild, this
-         time stamp is changed.
-       </Documentation>
-     </IntVectorProperty>
-     
+
      <StringVectorProperty name="GeoTypesInfo" information_only="1">
        <ArraySelectionInformationHelper attribute_name="GeoTypes" />
      </StringVectorProperty>
-     
+
      <StringVectorProperty name="GeoTypesStatus" command="SetGeoTypesStatus"
-                           label="All GeoTypes"
+                           label="All Geo Types"
                            number_of_elements="0"
                            repeat_command="1"
                            number_of_elements_per_command="2"
           This property lists all the geometric types to select.
        </Documentation>
      </StringVectorProperty>
-     <IntVectorProperty command="SetInsideOut" default_values="0" name="InsideOut" number_of_elements="1">
+     <IntVectorProperty command="SetInsideOut" label="Extract Complementary" default_values="0" name="InsideOut" number_of_elements="1">
        <BooleanDomain name="bool"/>
        <Documentation>Choose which part of the dataset to keep regarding the selected geometric types. When 0 (default) the direct selection
        is kept. When 1 the complementary part is selected.
           </RequiredProperties>
         </ArrayListDomain>
       </StringVectorProperty>
-      <Hints> 
+      <Hints>
         <Property name="SelectSourceArray" show="0"/>
       </Hints>
     </SourceProxy>
       </Hints>
 
     </SourceProxy>
-    
+
     <SourceProxy name="ELNOPoints" class="vtkELNOFilter" label="ELNO Points">
       <Documentation
         long_help="Create a point set with data at ELNO points. Cells are shrinked by a given factor towards the cell center."
       </Hints>
     </SourceProxy>
 
-
     <SourceProxy
       name="GenerateStructuralElement"
       class="vtkGenerateStructElement"
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractCellTypePanel.ui b/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractCellTypePanel.ui
deleted file mode 100644 (file)
index 85ed177..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ExtractCellTypePanel</class>
- <widget class="QWidget" name="ExtractCellTypePanel">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>649</width>
-    <height>839</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <property name="margin">
-    <number>9</number>
-   </property>
-   <item row="0" column="0" colspan="3">
-    <widget class="QGroupBox" name="geometryGroupBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>1</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title">
-      <string>Geometric types available</string>
-     </property>
-     <layout class="QVBoxLayout">
-      <property name="spacing">
-       <number>6</number>
-      </property>
-      <property name="margin">
-       <number>9</number>
-      </property>
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-         <widget class="pqTreeWidget" name="Fields">
-          <property name="minimumSize">
-           <size>
-            <width>0</width>
-            <height>200</height>
-           </size>
-          </property>
-          <column>
-           <property name="text">
-            <string notr="true">1</string>
-           </property>
-          </column>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QCheckBox" name="ExtractComplementary">
-        <property name="text">
-         <string>Extract the complementary</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>pqTreeWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>pqTreeWidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
- <designerdata>
-  <property name="gridDeltaX">
-   <number>10</number>
-  </property>
-  <property name="gridDeltaY">
-   <number>10</number>
-  </property>
-  <property name="gridSnapX">
-   <bool>false</bool>
-  </property>
-  <property name="gridSnapY">
-   <bool>false</bool>
-  </property>
-  <property name="gridVisible">
-   <bool>true</bool>
-  </property>
- </designerdata>
-</ui>
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractGroupPanel.ui b/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/ExtractGroupPanel.ui
deleted file mode 100644 (file)
index b328a63..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ExtractGroupPanel</class>
- <widget class="QWidget" name="ExtractGroupPanel">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>649</width>
-    <height>839</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QGridLayout" name="gridLayout">
-   <property name="margin">
-    <number>9</number>
-   </property>
-   <item row="0" column="0" colspan="3">
-    <widget class="QGroupBox" name="geometryGroupBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>1</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title">
-      <string>Groups And Families</string>
-     </property>
-     <layout class="QVBoxLayout">
-      <property name="spacing">
-       <number>6</number>
-      </property>
-      <property name="margin">
-       <number>9</number>
-      </property>
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-         <widget class="pqTreeWidget" name="Fields">
-          <property name="minimumSize">
-           <size>
-            <width>0</width>
-            <height>200</height>
-           </size>
-          </property>
-          <column>
-           <property name="text">
-            <string notr="true">1</string>
-           </property>
-          </column>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QCheckBox" name="ExtractComplementary">
-        <property name="text">
-         <string>Extract the complementary</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>pqTreeWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>pqTreeWidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
- <designerdata>
-  <property name="gridDeltaX">
-   <number>10</number>
-  </property>
-  <property name="gridDeltaY">
-   <number>10</number>
-  </property>
-  <property name="gridSnapX">
-   <bool>false</bool>
-  </property>
-  <property name="gridSnapY">
-   <bool>false</bool>
-  </property>
-  <property name="gridVisible">
-   <bool>true</bool>
-  </property>
- </designerdata>
-</ui>
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderPanel.ui b/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderPanel.ui
deleted file mode 100644 (file)
index e6da8d9..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MEDReaderPanel</class>
- <widget class="QWidget" name="MEDReaderPanel">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>649</width>
-    <height>839</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QHBoxLayout" name="horizontalLayout_5">
-   <property name="margin">
-    <number>9</number>
-   </property>
-   <item>
-    <widget class="QGroupBox" name="geometryGroupBox">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
-       <horstretch>0</horstretch>
-       <verstretch>1</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title">
-      <string>Representation</string>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <property name="spacing">
-       <number>6</number>
-      </property>
-      <property name="margin">
-       <number>9</number>
-      </property>
-      <item>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_3">
-          <item>
-           <spacer name="horizontalSpacer">
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>40</width>
-              <height>20</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-          <item>
-           <widget class="QPushButton" name="Reload">
-            <property name="enabled">
-             <bool>true</bool>
-            </property>
-            <property name="toolTip">
-             <string>Reload current file</string>
-            </property>
-            <property name="autoFillBackground">
-             <bool>true</bool>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="icon">
-             <iconset resource="../pqMEDReader.qrc">
-              <normaloff>:/ParaViewResources/Icons/pqReloadFile16.png</normaloff>:/ParaViewResources/Icons/pqReloadFile16.png</iconset>
-            </property>
-            <property name="checkable">
-             <bool>false</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-        <item>
-         <widget class="pqExodusIIVariableSelectionWidget" name="Fields">
-          <property name="minimumSize">
-           <size>
-            <width>0</width>
-            <height>200</height>
-           </size>
-          </property>
-          <column>
-           <property name="text">
-            <string notr="true">1</string>
-           </property>
-          </column>
-         </widget>
-        </item>
-        <item>
-         <widget class="QGroupBox" name="groupBox_2">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="maximumSize">
-           <size>
-            <width>16777215</width>
-            <height>16777215</height>
-           </size>
-          </property>
-          <property name="title">
-           <string/>
-          </property>
-          <layout class="QVBoxLayout" name="verticalLayout_2">
-           <property name="spacing">
-            <number>0</number>
-           </property>
-           <property name="margin">
-            <number>0</number>
-           </property>
-           <item>
-            <widget class="QCheckBox" name="GenerateVects">
-             <property name="sizePolicy">
-              <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-             <property name="maximumSize">
-              <size>
-               <width>16777215</width>
-               <height>25</height>
-              </size>
-             </property>
-             <property name="text">
-              <string>GenerateVectors</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </item>
-        <item>
-         <widget class="QGroupBox" name="groupBox">
-          <property name="enabled">
-           <bool>true</bool>
-          </property>
-          <property name="title">
-           <string/>
-          </property>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <item>
-            <widget class="QRadioButton" name="stdMode">
-             <property name="text">
-              <string>Time</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QRadioButton" name="modeMode">
-             <property name="text">
-              <string>Mode</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </item>
-        <item>
-         <widget class="QWidget" name="timeStepsInspector" native="true">
-          <property name="sizePolicy">
-           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="minimumSize">
-           <size>
-            <width>250</width>
-            <height>400</height>
-           </size>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_4"/>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>pqExodusIIVariableSelectionWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>pqExodusIIVariableSelectionWidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources>
-  <include location="../pqMEDReader.qrc"/>
- </resources>
- <connections/>
- <designerdata>
-  <property name="gridDeltaX">
-   <number>10</number>
-  </property>
-  <property name="gridDeltaY">
-   <number>10</number>
-  </property>
-  <property name="gridSnapX">
-   <bool>false</bool>
-  </property>
-  <property name="gridSnapY">
-   <bool>false</bool>
-  </property>
-  <property name="gridVisible">
-   <bool>true</bool>
-  </property>
- </designerdata>
-</ui>
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderTimeModeWidget.ui b/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderTimeModeWidget.ui
new file mode 100644 (file)
index 0000000..419d1e7
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MEDReaderTimeModeWidget</class>
+ <widget class="QWidget" name="widget">
+   <layout class="QGridLayout" name="layout">
+     <item>
+       <widget class="QGroupBox" name="groupBox">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="title">
+         <string/>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QRadioButton" name="stdMode">
+           <property name="text">
+            <string>Time</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+         </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="modeMode">
+           <property name="text">
+            <string>Mode</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+     </item>
+    </layout>
+ </widget>
+</ui>
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderVectorsWidget.ui b/src/Plugins/MEDReader/ParaViewPlugin/Resources/UI/MEDReaderVectorsWidget.ui
new file mode 100644 (file)
index 0000000..c942427
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MEDReaderVectorsWidget</class>
+ <widget class="QWidget" name="widgetVectors">
+   <layout class="QGridLayout" name="layoutVectors">
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+     <item>
+       <widget class="QGroupBox" name="groupBoxVectors">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="title">
+         <string/>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayoutVectors">
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QCheckBox" name="GenerateVects">
+           <property name="text">
+            <string>GenerateVectors</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+     </item>
+    </layout>
+ </widget>
+</ui>
index 5b3479aa12bd5d60050489a77be037e0686f45ee..1006ebf720fd6322fb0115ed14db26444158c8b2 100644 (file)
@@ -3,7 +3,6 @@
         <file>Icons/pqCellData16.png</file>
         <file>Icons/pqPointData16.png</file>
         <file>Icons/pqQuadratureData16.png</file>
-        <file>MEDReaderClient2.xml</file>
         <file>Icons/pqElnoData16.png</file>
         <file>Icons/pqReloadFile16.png</file>
        <file>Icons/pqCellDataForWholeMesh16.png</file>
index 2e29fce922cf42171d96cbd1782e68d2befa5bfc..b878cbb3ba841d06fa6f82eaf8e4d8b4c680587e 100644 (file)
@@ -233,6 +233,7 @@ void VectBoolSpreadSheet::selectionChanged(const QItemSelection & selected, cons
       m->setData(ind,QVariant(true),Qt::UserRole);
     }
   QTableView::selectionChanged(selected,deselected);
+  this->clearSelection();
 }
 
 void VectBoolSpreadSheet::nbOfRowsHasChanged(int newNbOfRows)
index 534fa2f188b4ed60eab19fd4d436fbe37c030221..5af5d9f86d762bfade56890a9a58208979cacb71 100644 (file)
@@ -62,7 +62,8 @@ bool VectBoolItem::isActivated() const
 
 void VectBoolItem::activated(bool val)
 {
-  //_model->setStatusAt(_pos,val);
+  _model->setStatusAt(_pos,val);
+  _old_status=val;
 }
 
 void VectBoolItem::theModelHasChanged()
@@ -149,11 +150,11 @@ VectBoolWidget::VectBoolWidget(QWidget *parent, int nbOfItems):QFrame(parent)
   _vbm->selectUnselectAll();
   _nb_of_rows_selecter->setValue(_nb_of_rows_selecter->maximum());
   //
-  _items.resize(nbOfItems);
   for(int i=0;i<nbOfItems;i++)
     {
-      _items[i]=new VectBoolItem(this,i,_vbm);
-      connect(_vbm,SIGNAL(nbOfTimeStepsOnChanged(int,int)),_items[i],SLOT(theModelHasChanged()));
+      VectBoolItem* item = new VectBoolItem(this,i,_vbm);
+      _items["000"+QString::number(i)]=item;
+      connect(_vbm, SIGNAL(nbOfTimeStepsOnChanged(int,int)), item, SLOT(theModelHasChanged()));
     }
 }
 
@@ -163,6 +164,7 @@ void VectBoolWidget::setItems(const QStringList& dts, const QStringList& its, co
   if(curNbOfItems>getNumberOfBoolItems())
     {
       std::cerr << "ERROR ! Internal Error in VectBoolWidget::setItems ! Current number of items is bigger than the current one !" << std::endl;
+      std::cerr << curNbOfItems << " "<<getNumberOfBoolItems()<<std::endl;
       return ;
     }
   if(_vbm->setCurrentItems(dts,its,tts))
index 510d2ff4024174edf87dd09268f3b56c527a09f8..ba4f137ae582366c1b247161bd0f4bc06b4f3e0d 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <QFrame>
 #include <QLabel>
+#include <QMap>
 
 class QSlider;
 class QGroupBox;
@@ -71,11 +72,11 @@ public:
   ~VectBoolWidget();
   int getNumberOfBoolItems() const;
   void setItems(const QStringList& dts, const QStringList& its, const QStringList& tts);
-  const QVector<VectBoolItem *>& getItems() const { return _items; }
+  const QMap<QString, VectBoolItem *>& getItems() const { return _items; }
 private:
   static int GetMaxTickValueOfSlider(int val);
 private:
-  QVector<VectBoolItem *> _items;
+  QMap<QString, VectBoolItem *> _items;
   QHBoxLayout *_horizontal_layout;
   QFrame *_spreadsheet_container;
   QGridLayout *_grid_layout;
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.cxx
new file mode 100644 (file)
index 0000000..bde2657
--- /dev/null
@@ -0,0 +1,147 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqAbstractFieldsWidget.h"
+
+#include "pqArrayListDomain.h"
+#include "pqTreeWidget.h"
+#include "pqTreeWidgetItemObject.h"
+
+#include <QGridLayout>
+#include <QHeaderView>
+//-----------------------------------------------------------------------------
+pqAbstractFieldsWidget::pqAbstractFieldsWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, parentObject)
+{
+  this->NItems = 0;
+  this->visibleHeader = true;
+  this->setShowLabel(false);
+
+  // Grid Layout
+  QGridLayout* gridLayout = new QGridLayout(this);
+
+  // Tree widget
+  this->TreeWidget = new pqTreeWidget(this);
+  gridLayout->addWidget(this->TreeWidget);
+}
+
+//-----------------------------------------------------------------------------
+pqAbstractFieldsWidget::~pqAbstractFieldsWidget()
+{
+  delete this->TreeWidget;
+}
+
+void pqAbstractFieldsWidget::initializeTreeWidget(vtkSMProxy *smproxy, vtkSMProperty *smproperty)
+{
+  // Load Tree Widget Items
+  this->loadTreeWidgetItems();
+
+  // Connect Property Domain to the fieldDomain property,
+  // so setFieldDomain is called when the domain changes.
+  vtkSMDomain* arraySelectionDomain = smproperty->GetDomain("array_list");
+  new pqArrayListDomain(this,"fieldsDomain", smproxy, smproperty, arraySelectionDomain);
+
+  // Connect property to field QProperty using a biderectionnal property link
+  this->addPropertyLink(this, "fields", SIGNAL(fieldsChanged()),
+                        smproxy, smproperty);
+
+  // Call slot when the tree is changed
+  QObject::connect(this->TreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
+                   this, SLOT(onItemChanged(QTreeWidgetItem*, int)));
+
+}
+
+//-----------------------------------------------------------------------------
+QSize pqAbstractFieldsWidget::sizeHint() const
+{
+  // TreeWidget sizeHintForRow is too low, correcting to +3.
+  int pix = (this->TreeWidget->sizeHintForRow(0) + 3) * this->NItems;
+  int margin[4];
+  this->TreeWidget->getContentsMargins(margin, margin + 1, margin + 2, margin + 3);
+  int h =  pix + margin[1] + margin[3];
+  if (this->visibleHeader)
+    {
+    h += this->TreeWidget->header()->frameSize().height();
+    } 
+  h = std::min(300, h);
+  return QSize(156, h);
+}
+
+//-----------------------------------------------------------------------------
+void pqAbstractFieldsWidget::onItemChanged(QTreeWidgetItem* item, int column) const
+{
+  if (column != 0)
+    {
+    return;
+    }
+  emit fieldsChanged();
+}
+
+//-----------------------------------------------------------------------------
+QList< QList< QVariant> > pqAbstractFieldsWidget::getFields() const
+{
+  // Put together a Field list, using ItemMap
+  QList< QList< QVariant> > ret;
+  QList< QVariant > field;
+  QMap<QString, pqTreeWidgetItemObject*>::const_iterator it;
+  for (it = this->ItemMap.begin(); it != this->ItemMap.end(); it++)
+    {
+    field.clear();
+    field.append(it.key());
+    field.append(it.value()->isChecked());
+    ret.append(field);
+    }
+  return ret;
+}
+
+//-----------------------------------------------------------------------------
+void pqAbstractFieldsWidget::setFields(QList< QList< QVariant> > fields)
+{
+  // Update each item checkboxes, using fields names and ItemMap
+  QMap<QString, pqTreeWidgetItemObject*>::iterator it;
+  foreach (QList< QVariant> field, fields)
+    {
+    it = this->ItemMap.find(field[0].toString());
+    if (it == this->ItemMap.end())
+      {
+      qDebug("Found an unknow Field in pqAbstractFieldsWidget::setFields, ignoring");
+      continue;
+      }
+    it.value()->setChecked(field[1].toBool());
+    }
+}
+
+//-----------------------------------------------------------------------------
+void pqAbstractFieldsWidget::setFieldsDomain(QList< QList< QVariant> > fields)
+{
+  // Block signals so the reloading does not trigger
+  // UncheckPropertyModified event
+  this->blockSignals(true);
+
+  // Load the tree widget
+  this->loadTreeWidgetItems();
+
+  // Set fields checkboxes
+  this->setFields(fields);
+
+  // Restore signals
+  this->blockSignals(false);
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqAbstractFieldsWidget.h
new file mode 100644 (file)
index 0000000..c4f29c8
--- /dev/null
@@ -0,0 +1,103 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqAbstractFieldsWidget_h
+#define __pqAbstractFieldsWidget_h
+
+#include "pqPropertyWidget.h"
+
+class pqTreeWidget;
+class pqTreeWidgetItemObject;
+class QTreeWidgetItem;
+class vtkSMProxy;
+class vtkSMProperty;
+
+class pqAbstractFieldsWidget : public pqPropertyWidget
+{
+  typedef pqPropertyWidget Superclass;
+  Q_OBJECT
+
+  // Description
+  // Property Qt used to set/get the fields with the property link
+  Q_PROPERTY(QList< QList< QVariant> > fields READ getFields WRITE setFields)
+
+  // Description
+  // Property Qt used to set the gorup fields domain with the property link
+  Q_PROPERTY(QList< QList< QVariant> > fieldsDomain READ getFields WRITE setFieldsDomain)
+public:
+  pqAbstractFieldsWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqAbstractFieldsWidget();
+
+  // Description
+  // Corrected size hint, +3 pixel on each line
+  virtual QSize sizeHint() const;
+
+signals:
+  // Description
+  // Signal emited when selected field changed
+  void fieldsChanged() const;
+
+protected:
+  // Description
+  // bidrectionnal property link setter/getter
+  virtual QList< QList< QVariant> > getFields() const;
+  virtual void setFields(QList< QList< QVariant> > fields);
+
+  // Description
+  // Update the domain, eg: reload
+  virtual void setFieldsDomain(QList< QList< QVariant> > fields);
+
+
+  // Description
+  // Initialize the widget items and connect it to property
+  // To be called by subclasses in constructor
+  virtual void initializeTreeWidget(vtkSMProxy *smproxy, vtkSMProperty *smproperty);
+
+  // Description
+  // (Re)Load the tree widget items using recovered meta data graph
+  virtual void loadTreeWidgetItems() = 0;
+
+  // Description
+  // Tree widget
+  pqTreeWidget* TreeWidget;
+
+  // Description
+  // Number of items, for graphic purpose
+  int NItems;
+
+  // Description
+  // Map of ItemPropertyName -> Item Pointer, contains only leaf.
+  QMap< QString, pqTreeWidgetItemObject*> ItemMap;
+
+  // Description
+  // Bug in qt, header->isVisible always return false, storing this info here
+  // https://bugreports.qt.io/browse/QTBUG-12939
+  bool visibleHeader;
+protected slots:
+  // Description
+  // Slot called when the tree widget changed
+  virtual void onItemChanged(QTreeWidgetItem* itemOrig, int column) const;
+
+private:
+  Q_DISABLE_COPY(pqAbstractFieldsWidget);
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.cxx
deleted file mode 100644 (file)
index b27a6cd..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#include "pqExtractCellTypePanel.h"
-#include "ui_ExtractCellTypePanel.h"
-
-#include "vtkProcessModule.h"
-#include "vtkMultiBlockDataSet.h"
-#include "vtkInformation.h"
-#include "vtkIntArray.h"
-#include "vtkSMDoubleVectorProperty.h"
-#include "vtkSMIntVectorProperty.h"
-#include "vtkSMStringVectorProperty.h"
-#include "vtkSMProxy.h"
-#include "vtkSMSourceProxy.h"
-#include "vtkEventQtSlotConnect.h"
-#include "vtkPVSILInformation.h"
-#include "vtkGraph.h"
-#include "vtkMutableDirectedGraph.h"
-#include "vtkAdjacentVertexIterator.h"
-#include "vtkSMPropertyHelper.h"
-#include "vtkStringArray.h"
-#include "vtkDataSetAttributes.h"
-#include "vtkExtractCellType.h"
-
-#include "pqTreeWidgetItemObject.h"
-#include "pqSMAdaptor.h"
-#include "pqProxy.h"
-#include "pqPropertyManager.h"
-#include "pqSILModel.h"
-#include "pqProxySILModel.h"
-#include "pqTreeViewSelectionHelper.h"
-#include "pqTreeWidgetSelectionHelper.h"
-#include "pqPropertyLinks.h"
-
-#include <QHeaderView>
-
-#include <sstream>
-
-static const char ZE_SEP[]="@@][@@";
-
-class pqExtractCellTypePanel::pqUI: public QObject, public Ui::ExtractCellTypePanel
-{
-public:
-  pqUI(pqExtractCellTypePanel* p):QObject(p)
-  {
-    this->VTKConnect = vtkSmartPointer<vtkEventQtSlotConnect>::New();
-    this->SILUpdateStamp = -1;
-  }
-
-  ~pqUI() { }
-
-  pqSILModel SILModel;
-  vtkSmartPointer<vtkEventQtSlotConnect> VTKConnect;
-  pqPropertyLinks Links;
-  QMap<QTreeWidgetItem*, QString> TreeItemToPropMap;
-  int SILUpdateStamp;
-};
-
-pqExtractCellTypePanel::pqExtractCellTypePanel(pqProxy* object_proxy, QWidget* p):Superclass(object_proxy, p)
-{
-  this->UI=new pqUI(this);
-  this->UI->setupUi(this);
-  pqProxySILModel*proxyModel2 = new pqProxySILModel("GeoTypesStatusTree", &this->UI->SILModel);
-  proxyModel2->setSourceModel(&this->UI->SILModel);
-  this->UI->Fields->setHeaderHidden(true);
-  this->updateSIL();
-  this->linkServerManagerProperties();
-  ////////////////////
-  vtkSMProperty *SMProperty(this->proxy()->GetProperty("GeoTypesStatus"));
-  ////////////////////
-  vtkSMProxy* reader = this->referenceProxy()->getProxy();
-  vtkPVSILInformation* info=vtkPVSILInformation::New();
-  reader->GatherInformation(info);
-  vtkGraph *g(info->GetSIL());
-  //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<vtkMutableDirectedGraph *>(g));
-  if(!g2)
-    return ;
-  int idNames(0);
-  vtkAbstractArray *verticesNames(g2->GetVertexData()->GetAbstractArray("Names",idNames));
-  vtkStringArray *verticesNames2(vtkStringArray::SafeDownCast(verticesNames));
-  vtkIdType id0;
-  bool found(false);
-  for(int i=0;i<verticesNames2->GetNumberOfValues();i++)
-    {
-      vtkStdString &st(verticesNames2->GetValue(i));
-      if(st=="CellTypesTree")
-        {
-          id0=i;
-          found=true;
-        }
-    }
-  if(!found)
-    std::cerr << "There is an internal error ! The tree on server side has not the expected look !" << std::endl;
-  vtkAdjacentVertexIterator *it0(vtkAdjacentVertexIterator::New());
-  g2->GetAdjacentVertices(id0,it0);
-  int kk(0),ll(0);
-  while(it0->HasNext())
-    {
-      vtkIdType id1(it0->Next());
-      QString geoTypeName(QString::fromStdString((const char *)verticesNames2->GetValue(id1)));
-      vtkAdjacentVertexIterator *it1(vtkAdjacentVertexIterator::New());
-      g2->GetAdjacentVertices(id1,it1);
-      QList<QString> strs0; strs0.append(QString("%1").arg(geoTypeName));
-      pqTreeWidgetItemObject *item0(new pqTreeWidgetItemObject(this->UI->Fields,strs0));
-      vtkAdjacentVertexIterator *itGrps(vtkAdjacentVertexIterator::New());
-      g2->GetAdjacentVertices(id1,itGrps);
-      vtkIdType idg(itGrps->Next());
-      QString name0(QString::fromStdString((const char *)verticesNames2->GetValue(idg)));
-      QString toolTipName0(QString("%1 (vtkId=%2)").arg(geoTypeName).arg(name0));
-      item0->setData(0,Qt::UserRole,geoTypeName);
-      item0->setData(0,Qt::ToolTipRole,toolTipName0);
-      item0->setData(0,Qt::CheckStateRole,0);
-      item0->setProperty("PosInStringVector",QVariant(ll++));
-      connect(item0,SIGNAL(checkedStateChanged(bool)),this,SLOT(anItemAsBeenFired()));
-    }
-  it0->Delete(); 
-  this->UI->Fields->header()->setStretchLastSection(true);
-  this->UI->Fields->expandAll();
-  info->Delete();
-  ////////////////////
-  vtkSMProperty *SMPropertyExtractComp(this->proxy()->GetProperty("InsideOut"));
-  this->propertyManager()->registerLink(this->UI->ExtractComplementary,"checked",SIGNAL(stateChanged(int)),this->proxy(),SMPropertyExtractComp);
-  ////////////////////
-  this->UI->VTKConnect->Connect(this->proxy(),vtkCommand::UpdateInformationEvent,this,SLOT(updateSIL()));
-}
-
-pqExtractCellTypePanel::~pqExtractCellTypePanel()
-{
-}
-
-void pqExtractCellTypePanel::linkServerManagerProperties()
-{
-  this->Superclass::linkServerManagerProperties();
-}
-
-void pqExtractCellTypePanel::updateSIL()
-{
-  vtkSMProxy* reader = this->referenceProxy()->getProxy();
-  reader->UpdatePropertyInformation(reader->GetProperty("SILUpdateStamp"));
-  int stamp = vtkSMPropertyHelper(reader, "SILUpdateStamp").GetAsInt();
-  if (stamp != this->UI->SILUpdateStamp)
-    {
-      this->UI->SILUpdateStamp = stamp;
-      vtkPVSILInformation* info = vtkPVSILInformation::New();
-      reader->GatherInformation(info);
-      vtkGraph *sil(info->GetSIL());
-      if(sil)
-        {
-          this->UI->SILModel.update(sil);
-          this->UI->Fields->expandAll();
-        }
-      info->Delete();
-    }
-}
-
-void pqExtractCellTypePanel::anItemAsBeenFired()
-{
-  ///
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("GeoTypesStatus"));
-  vtkSMStringVectorProperty *sm(dynamic_cast<vtkSMStringVectorProperty *>(SMProperty));
-  unsigned int nb(sm->GetNumberOfElements());
-  std::vector<std::string> sts(nb);
-  for(unsigned int i=0;i<nb;i++)
-    sts[i]=sm->GetElement(i);
-  ///
-  pqTreeWidget *sc(this->UI->Fields);
-  for(int i0=0;i0<sc->topLevelItemCount();i0++)
-    {
-      QTreeWidgetItem *lev0(sc->topLevelItem(i0));
-      pqTreeWidgetItemObject *scc(dynamic_cast<pqTreeWidgetItemObject *>(lev0));
-      int ll(scc->property("PosInStringVector").toInt());
-      int v(scc->isChecked());
-      std::ostringstream oss; oss << v;
-      sts[2*ll+1]=oss.str();
-    }
-  ///
-  const char **args=new const char *[nb];
-  for(unsigned int i=0;i<nb;i++)
-    {
-      args[i]=sts[i].c_str();
-    }
-  {
-    int iup(sm->GetImmediateUpdate());
-    //sm->SetNumberOfElements(0);
-    sm->SetElements(args,nb);
-    proxy->UpdateVTKObjects();
-    sm->SetImmediateUpdate(iup);
-  }
-  delete [] args;
-  //
-  ((vtkSMSourceProxy *)proxy)->UpdatePipelineInformation();
-  setModified();
-}
-
-void pqExtractCellTypePanel::updateInformationAndDomains()
-{
-  pqNamedObjectPanel::updateInformationAndDomains();
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("GeoTypesStatus"));
-  SMProperty->Modified();// agy : THE LINE FOR 7.5.1 !
-}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.h b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractCellTypePanel.h
deleted file mode 100644 (file)
index 2a9bc41..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#ifndef _pqExtractCellTypePanel_h
-#define _pqExtractCellTypePanel_h
-
-#include "pqNamedObjectPanel.h"
-
-#include <map>
-
-class pqTreeWidgetItemObject;
-
-class vtkSMProperty;
-class vtkMutableDirectedGraph;
-
-class pqExtractCellTypePanel : public pqNamedObjectPanel
-{
-Q_OBJECT
-  typedef pqNamedObjectPanel Superclass;
-public:
-  pqExtractCellTypePanel(pqProxy* proxy, QWidget* p = NULL);
-  ~pqExtractCellTypePanel();
-  void updateInformationAndDomains();
-protected slots:
-  void anItemAsBeenFired();
-  void updateSIL();
-protected:
-  /// populate widgets with properties from the server manager
-  virtual void linkServerManagerProperties();
-  class pqUI;
-  pqUI* UI;
-};
-
-#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.cxx
new file mode 100644 (file)
index 0000000..80e2751
--- /dev/null
@@ -0,0 +1,202 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqExtractGroupFieldsWidget.h"
+
+#include "vtkMEDReader.h"
+#include "vtkExtractGroup.h"
+#include "vtkPVMetaDataInformation.h"
+
+#include "pqTreeWidget.h"
+#include "pqTreeWidgetItemObject.h"
+#include "vtkGraph.h"
+#include "vtkNew.h"
+#include "vtkStringArray.h"
+#include "vtkDataSetAttributes.h"
+#include "vtkTree.h"
+
+#include <QStringList>
+
+//-----------------------------------------------------------------------------
+pqExtractGroupFieldsWidget::pqExtractGroupFieldsWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, smproperty, parentObject)
+{
+  this->TreeWidget->setHeaderLabel("Groups And Families");
+  this->initializeTreeWidget(smproxy, smproperty);
+}
+
+//-----------------------------------------------------------------------------
+pqExtractGroupFieldsWidget::~pqExtractGroupFieldsWidget()
+{
+}
+
+//-----------------------------------------------------------------------------
+void pqExtractGroupFieldsWidget::loadTreeWidgetItems()
+{
+  // Recover Graph
+  vtkPVMetaDataInformation *info(vtkPVMetaDataInformation::New());
+  this->proxy()->GatherInformation(info);
+  vtkGraph* graph = vtkGraph::SafeDownCast(info->GetInformationData());
+  if(!graph)
+    {
+    return;
+    }
+
+  // Clear Tree Widget
+  this->TreeWidget->clear();
+
+  // Clear Item Map
+  this->ItemMap.clear();
+
+  // Create a tree
+  vtkNew<vtkTree> tree;
+  tree->CheckedShallowCopy(graph);
+  vtkStringArray* names = vtkStringArray::SafeDownCast(tree->GetVertexData()->GetAbstractArray("Names"));
+
+  vtkIdType root = tree->GetRoot();
+  vtkIdType mfg = tree->GetChild(root, 1); // MeshesFamsGrps
+
+  vtkIdType mesh = tree->GetChild(mfg, 0); // mesh
+  QString meshName = QString(names->GetValue(mesh));
+
+  this->NItems = 0;
+
+  vtkIdType grps = tree->GetChild(mesh, 0); // grps
+  pqTreeWidgetItemObject* grpsItem = new pqTreeWidgetItemObject(this->TreeWidget, QStringList());
+  this->NItems++;
+  grpsItem->setText(0, QString("Groups of \"" + meshName + "\""));
+
+  vtkIdType fams = tree->GetChild(mesh, 1); // fams
+  pqTreeWidgetItemObject* famsItem = new pqTreeWidgetItemObject(this->TreeWidget, QStringList());
+  this->NItems++;
+  famsItem->setText(0, QString("Families of \"" + meshName + "\""));
+
+  std::map<std::string, int> famDataTypeMap;
+
+  for (int i = 0; i < tree->GetNumberOfChildren(fams); i++)
+    {
+    // Familly Item
+    vtkIdType fam = tree->GetChild(fams, i);
+    pqTreeWidgetItemObject *famItem = new pqTreeWidgetItemObject(famsItem, QStringList());
+    this->NItems++;
+
+    // Familly name
+    std::string str = names->GetValue(fam);
+    const char* separator = vtkMEDReader::GetSeparator();
+    size_t pos = str.find(separator);
+    std::string name = str.substr(0, pos);
+    famItem->setText(0, QString(name.c_str()));
+
+    // Property Name
+    QString propertyName = QString(vtkExtractGroup::GetFamStart()) + QString(str.c_str());
+    this->ItemMap[propertyName] = famItem;
+
+    // Datatype flag
+    int dataTypeFlag = atoi(str.substr(pos + strlen(separator)).c_str());
+    famDataTypeMap[name] = dataTypeFlag;
+
+    // Checkbox
+    famItem->setFlags(famItem->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
+    famItem->setChecked(true);
+
+    // Tooltip
+    QString famToolTip(QString("%1 (%2)").arg(QString(name.c_str())).arg(dataTypeFlag));
+    famItem->setData(0, Qt::ToolTipRole, famToolTip);
+
+    // Pixmap
+    if (dataTypeFlag<0)
+      {
+      famItem->setData(0, Qt::DecorationRole,
+                       QPixmap(":/ParaViewResources/Icons/pqCellData16.png"));
+      }
+    if (dataTypeFlag>0)
+      {
+      famItem->setData(0, Qt::DecorationRole,
+                       QPixmap(":/ParaViewResources/Icons/pqPointData16.png"));
+      }
+    }
+
+  for (int i = 0; i < tree->GetNumberOfChildren(grps); i++)
+    {
+    // Grp Item
+    vtkIdType grp = tree->GetChild(grps, i);
+    pqTreeWidgetItemObject *grpItem = new pqTreeWidgetItemObject(grpsItem, QStringList());
+    this->NItems++;
+
+    // Group name
+    QString name = QString(names->GetValue(grp));
+    grpItem->setText(0, name);
+
+    // Property Name
+    QString propertyName = QString(vtkExtractGroup::GetGrpStart()) + name;
+    this->ItemMap[propertyName] = grpItem;
+
+    // Datatype flag
+    bool hasPoint = false;
+    bool hasCell = false;
+    int dataTypeFlag = 0;
+    for (int j = 0; j < tree->GetNumberOfChildren(grp); j++)
+      {
+      dataTypeFlag = famDataTypeMap[names->GetValue(tree->GetChild(grp, j))];
+      if (dataTypeFlag > 0)
+        {
+        hasPoint = true;
+        }
+      else if (dataTypeFlag < 0)
+        {
+        hasCell = true;
+        }
+      else
+        {
+        dataTypeFlag = 0;
+        break;
+        }
+
+      if (hasPoint && hasCell)
+        {
+        dataTypeFlag = 0;
+        break;
+        }
+      }
+
+    // Checkbox
+    grpItem->setFlags(grpItem->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
+    grpItem->setChecked(true);
+
+    // Tooltip
+    grpItem->setData(0, Qt::ToolTipRole, name);
+
+    // Pixmap
+    if (dataTypeFlag<0)
+      {
+      grpItem->setData(0, Qt::DecorationRole,
+                       QPixmap(":/ParaViewResources/Icons/pqCellData16.png"));
+      }
+    if (dataTypeFlag>0)
+      {
+      grpItem->setData(0, Qt::DecorationRole,
+                       QPixmap(":/ParaViewResources/Icons/pqPointData16.png"));
+      }
+    }
+
+  // Expand Widget
+  this->TreeWidget->expandAll();
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupFieldsWidget.h
new file mode 100644 (file)
index 0000000..0ea16dd
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqExtractGroupFieldsWidget_h
+#define __pqExtractGroupFieldsWidget_h
+
+#include "pqAbstractFieldsWidget.h"
+
+class vtkSMProxy;
+class vtkSMProperty;
+
+class pqExtractGroupFieldsWidget : public pqAbstractFieldsWidget
+{
+  typedef pqAbstractFieldsWidget Superclass;
+  Q_OBJECT
+
+public:
+  pqExtractGroupFieldsWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqExtractGroupFieldsWidget();
+
+protected:
+  // Description
+  // Load the tree widget using recovered meta data graph
+  void loadTreeWidgetItems();
+
+private:
+  Q_DISABLE_COPY(pqExtractGroupFieldsWidget);
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.cxx
deleted file mode 100644 (file)
index f07387e..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#include "pqExtractGroupPanel.h"
-#include "ui_ExtractGroupPanel.h"
-
-#include "vtkProcessModule.h"
-#include "vtkMultiBlockDataSet.h"
-#include "vtkInformation.h"
-#include "vtkIntArray.h"
-#include "vtkSMDoubleVectorProperty.h"
-#include "vtkSMIntVectorProperty.h"
-#include "vtkSMStringVectorProperty.h"
-#include "vtkSMProxy.h"
-#include "vtkSMSourceProxy.h"
-#include "vtkEventQtSlotConnect.h"
-#include "vtkPVSILInformation.h"
-#include "vtkGraph.h"
-#include "vtkMutableDirectedGraph.h"
-#include "vtkAdjacentVertexIterator.h"
-#include "vtkSMPropertyHelper.h"
-#include "vtkStringArray.h"
-#include "vtkDataSetAttributes.h"
-#include "vtkExtractGroup.h"
-
-#include "pqTreeWidgetItemObject.h"
-#include "pqSMAdaptor.h"
-#include "pqProxy.h"
-#include "pqPropertyManager.h"
-#include "pqSILModel.h"
-#include "pqProxySILModel.h"
-#include "pqTreeViewSelectionHelper.h"
-#include "pqTreeWidgetSelectionHelper.h"
-#include "pqPropertyLinks.h"
-
-#include <QHeaderView>
-
-#include <sstream>
-
-static const char ZE_SEP[]="@@][@@";
-
-class PixSingleExtractPanel
-{
-public:
-  static const PixSingleExtractPanel &GetInstance();
-  QPixmap getPixFromStr(int pos) const;
-  PixSingleExtractPanel();
-private:
-  static const int NB_OF_DISCR=4;
-  static PixSingleExtractPanel *UNIQUE_INSTANCE;
-  QPixmap _pixmaps[NB_OF_DISCR];
-};
-
-PixSingleExtractPanel *PixSingleExtractPanel::UNIQUE_INSTANCE=0;
-
-const PixSingleExtractPanel &PixSingleExtractPanel::GetInstance()
-{
-  if(!UNIQUE_INSTANCE)
-    UNIQUE_INSTANCE=new PixSingleExtractPanel;
-  return *UNIQUE_INSTANCE;
-}
-
-PixSingleExtractPanel::PixSingleExtractPanel()
-{
-  _pixmaps[0]=QPixmap(":/ParaViewResources/Icons/pqCellData16.png");
-  _pixmaps[1]=QPixmap(":/ParaViewResources/Icons/pqPointData16.png");
-}
-
-QPixmap PixSingleExtractPanel::getPixFromStr(int pos) const
-{
-  if(pos>=0 && pos<=1)
-    return _pixmaps[pos];
-  else
-    return QPixmap();
-}
-
-class pqExtractGroupPanel::pqUI: public QObject, public Ui::ExtractGroupPanel
-{
-public:
-  pqUI(pqExtractGroupPanel* p):QObject(p)
-  {
-    this->VTKConnect = vtkSmartPointer<vtkEventQtSlotConnect>::New();
-    this->SILUpdateStamp = -1;
-  }
-
-  ~pqUI() { }
-
-  pqSILModel SILModel;
-  vtkSmartPointer<vtkEventQtSlotConnect> VTKConnect;
-  pqPropertyLinks Links;
-  QMap<QTreeWidgetItem*, QString> TreeItemToPropMap;
-  int SILUpdateStamp;
-};
-
-pqExtractGroupPanel::pqExtractGroupPanel(pqProxy* object_proxy, QWidget* p):Superclass(object_proxy, p)
-{
-  this->UI=new pqUI(this);
-  this->UI->setupUi(this);
-  pqProxySILModel*proxyModel2 = new pqProxySILModel("GroupsFlagsStatusTree", &this->UI->SILModel);
-  proxyModel2->setSourceModel(&this->UI->SILModel);
-  this->UI->Fields->setHeaderHidden(true);
-  this->updateSIL();
-  this->linkServerManagerProperties();
-  ////////////////////
-  vtkSMProperty *SMProperty(this->proxy()->GetProperty("GroupsFlagsStatus"));
-  ////////////////////
-  vtkSMProxy* reader = this->referenceProxy()->getProxy();
-  vtkPVSILInformation* info=vtkPVSILInformation::New();
-  reader->GatherInformation(info);
-  vtkGraph *g(info->GetSIL());
-  //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<vtkMutableDirectedGraph *>(g));
-  int idNames(0);
-  if(!g2)
-    return ;
-  vtkAbstractArray *verticesNames(g2->GetVertexData()->GetAbstractArray("Names",idNames));
-  vtkStringArray *verticesNames2(vtkStringArray::SafeDownCast(verticesNames));
-  vtkIdType id0;
-  bool found(false);
-  for(int i=0;i<verticesNames2->GetNumberOfValues();i++)
-    {
-      vtkStdString &st(verticesNames2->GetValue(i));
-      if(st=="MeshesFamsGrps")
-        {
-          id0=i;
-          found=true;
-        }
-    }
-  if(!found)
-    std::cerr << "There is an internal error ! The tree on server side has not the expected look !" << std::endl;
-  vtkAdjacentVertexIterator *it0(vtkAdjacentVertexIterator::New());
-  g2->GetAdjacentVertices(id0,it0);
-  int kk(0),ll(0);
-  while(it0->HasNext())
-    {
-      vtkIdType id1(it0->Next());
-      QString meshName(QString::fromStdString((const char *)verticesNames2->GetValue(id1)));
-      vtkAdjacentVertexIterator *it1(vtkAdjacentVertexIterator::New());
-      g2->GetAdjacentVertices(id1,it1);
-      vtkIdType idZeGrps(it1->Next());//zeGroups
-      QList<QString> strs0; strs0.append(QString("Groups of \"%1\"").arg(meshName));
-      pqTreeWidgetItemObject *item0(new pqTreeWidgetItemObject(this->UI->Fields,strs0));
-      std::map<std::string,int> famIds(DeduceMapOfFamilyFromSIL(g2));
-      //item0->setData(0,Qt::CheckStateRole,0);
-      vtkAdjacentVertexIterator *itGrps(vtkAdjacentVertexIterator::New());
-      g2->GetAdjacentVertices(idZeGrps,itGrps);
-      while(itGrps->HasNext())
-        {
-          vtkIdType idg(itGrps->Next());
-          QString name0(QString::fromStdString((const char *)verticesNames2->GetValue(idg))); QList<QString> strs0; strs0.append(name0);
-          QString toolTipName0(name0);
-          pqTreeWidgetItemObject *item1(new pqTreeWidgetItemObject(item0,strs0));
-          //
-          vtkAdjacentVertexIterator *itFamsOnGrp(vtkAdjacentVertexIterator::New());
-          g2->GetAdjacentVertices(idg,itFamsOnGrp);
-          bool isOnCell(true),isOnPoint(true);
-          while(itFamsOnGrp->HasNext())
-            {
-              vtkIdType idfg(itFamsOnGrp->Next());
-              std::string namefg((const char *)verticesNames2->GetValue(idfg));
-              std::map<std::string,int>::const_iterator ittt(famIds.find(namefg));
-              if(ittt==famIds.end())
-                { isOnCell=false; isOnPoint=false; break; }
-              int zeId((*ittt).second);
-              if(zeId<0)
-                {
-                  if(!isOnCell)
-                    { isOnCell=false; isOnPoint=false; break; }
-                  else
-                    isOnPoint=false;
-                }
-              if(zeId>0)
-                {
-                  if(!isOnPoint)
-                    { isOnCell=false; isOnPoint=false; break; }
-                  else
-                    isOnCell=false;
-                }
-            }
-          itFamsOnGrp->Delete();
-          item1->setData(0,Qt::UserRole,name0);
-          item1->setData(0,Qt::ToolTipRole,toolTipName0);
-          item1->setData(0,Qt::CheckStateRole,0);
-          if(isOnCell && !isOnPoint)
-            item1->setData(0,Qt::DecorationRole,PixSingleExtractPanel::GetInstance().getPixFromStr(0));
-          if(!isOnCell && isOnPoint)
-            item1->setData(0,Qt::DecorationRole,PixSingleExtractPanel::GetInstance().getPixFromStr(1));
-          item1->setProperty("PosInStringVector",QVariant(ll++));
-          connect(item1,SIGNAL(checkedStateChanged(bool)),this,SLOT(anItemAsBeenFired()));
-        }
-      itGrps->Delete();
-      // families 
-      vtkIdType idZeFams(it1->Next());//zeFams
-      strs0.clear(); strs0.append(QString("Families of \"%1\"").arg(meshName));
-      pqTreeWidgetItemObject *item00(new pqTreeWidgetItemObject(this->UI->Fields,strs0));
-      //item00->setData(0,Qt::CheckStateRole,0);
-      vtkAdjacentVertexIterator *itFams(vtkAdjacentVertexIterator::New());
-      g2->GetAdjacentVertices(idZeFams,itFams);
-      while(itFams->HasNext())
-        {
-          vtkIdType idf(itFams->Next());
-          std::string crudeFamName((const char *)verticesNames2->GetValue(idf));
-          std::size_t pos(crudeFamName.find_first_of(ZE_SEP));
-          std::string famName(crudeFamName.substr(0,pos)); std::string idStr(crudeFamName.substr(pos+strlen(ZE_SEP)));
-          int idInt(QString(idStr.c_str()).toInt());
-          famIds[famName]=idInt;
-          QString name0(famName.c_str()); QList<QString> strs0; strs0.append(name0);
-          QString toolTipName0(QString("%1 (%2)").arg(QString(famName.c_str())).arg(QString(idStr.c_str())));
-          pqTreeWidgetItemObject *item1(new pqTreeWidgetItemObject(item00,strs0));
-          item1->setData(0,Qt::UserRole,name0);
-          item1->setData(0,Qt::ToolTipRole,toolTipName0);
-          item1->setData(0,Qt::CheckStateRole,0);
-          if(idInt<0)
-            item1->setData(0,Qt::DecorationRole,PixSingleExtractPanel::GetInstance().getPixFromStr(0));
-          if(idInt>0)
-            item1->setData(0,Qt::DecorationRole,PixSingleExtractPanel::GetInstance().getPixFromStr(1));
-          item1->setProperty("PosInStringVector",QVariant(ll++));
-          connect(item1,SIGNAL(checkedStateChanged(bool)),this,SLOT(anItemAsBeenFired()));
-        }
-      itFams->Delete();
-    }
-  it0->Delete(); 
-  this->UI->Fields->header()->setStretchLastSection(true);
-  this->UI->Fields->expandAll();
-  info->Delete();
-  ////////////////////
-  vtkSMProperty *SMPropertyExtractComp(this->proxy()->GetProperty("InsideOut"));
-  this->propertyManager()->registerLink(this->UI->ExtractComplementary,"checked",SIGNAL(stateChanged(int)),this->proxy(),SMPropertyExtractComp);
-  ////////////////////
-  this->UI->VTKConnect->Connect(this->proxy(),vtkCommand::UpdateInformationEvent, this, SLOT(updateSIL()));
-}
-
-pqExtractGroupPanel::~pqExtractGroupPanel()
-{
-}
-
-void pqExtractGroupPanel::linkServerManagerProperties()
-{
-  this->Superclass::linkServerManagerProperties();
-}
-
-void pqExtractGroupPanel::updateSIL()
-{
-  vtkSMProxy* reader = this->referenceProxy()->getProxy();
-  reader->UpdatePropertyInformation(reader->GetProperty("SILUpdateStamp"));
-  int stamp = vtkSMPropertyHelper(reader, "SILUpdateStamp").GetAsInt();
-  if (stamp != this->UI->SILUpdateStamp)
-    {
-    this->UI->SILUpdateStamp = stamp;
-    vtkPVSILInformation* info = vtkPVSILInformation::New();
-    reader->GatherInformation(info);
-    vtkGraph *sil(info->GetSIL());
-    if(sil)
-      {
-        this->UI->SILModel.update(sil);
-        this->UI->Fields->expandAll();
-        info->Delete();
-      }
-    }
-}
-
-void pqExtractGroupPanel::anItemAsBeenFired()
-{
-  ///
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("GroupsFlagsStatus"));
-  vtkSMStringVectorProperty *sm(dynamic_cast<vtkSMStringVectorProperty *>(SMProperty));
-  unsigned int nb(sm->GetNumberOfElements());
-  std::vector<std::string> sts(nb);
-  for(unsigned int i=0;i<nb;i++)
-    sts[i]=sm->GetElement(i);
-  ///
-  pqTreeWidget *sc(this->UI->Fields);
-  for(int i0=0;i0<sc->topLevelItemCount();i0++)
-    {
-      QTreeWidgetItem *lev0(sc->topLevelItem(i0));//Group and Fam
-      for(int i1=0;i1<lev0->childCount();i1++)
-        {
-          QTreeWidgetItem *lev1(lev0->child(i1));
-          pqTreeWidgetItemObject *scc(dynamic_cast<pqTreeWidgetItemObject *>(lev1));
-          int ll(scc->property("PosInStringVector").toInt());
-          int v(scc->isChecked());
-          std::ostringstream oss; oss << v;
-          sts[2*ll+1]=oss.str();
-        }
-    }
-  ///
-  const char **args=new const char *[nb];
-  for(unsigned int i=0;i<nb;i++)
-    {
-      args[i]=sts[i].c_str();
-    }
-  {
-    int iup(sm->GetImmediateUpdate());
-    //sm->SetNumberOfElements(0);
-    sm->SetElements(args,nb);
-    proxy->UpdateVTKObjects();
-    sm->SetImmediateUpdate(iup);
-  }
-  delete [] args;
-  //
-  ((vtkSMSourceProxy *)proxy)->UpdatePipelineInformation();
-  setModified();
-}
-
-std::map<std::string,int> pqExtractGroupPanel::DeduceMapOfFamilyFromSIL(vtkMutableDirectedGraph *graph)
-{
-  std::map<std::string,int> ret;
-  int idNames(0);
-  vtkAbstractArray *verticesNames(graph->GetVertexData()->GetAbstractArray("Names",idNames));
-  vtkStringArray *verticesNames2(vtkStringArray::SafeDownCast(verticesNames));
-  vtkAdjacentVertexIterator *it0(vtkAdjacentVertexIterator::New());
-  vtkIdType id0;
-  bool found(false);
-  for(int i=0;i<verticesNames2->GetNumberOfValues();i++)
-    {
-      vtkStdString &st(verticesNames2->GetValue(i));
-      if(st=="MeshesFamsGrps")
-        {
-          id0=i;
-          found=true;
-        }
-    }
-  if(!found)
-    std::cerr << "There is an internal error ! The tree on server side has not the expected look !" << std::endl;
-  graph->GetAdjacentVertices(id0,it0);
-  while(it0->HasNext())
-    {
-      vtkIdType id1(it0->Next());//meshName
-      vtkAdjacentVertexIterator *it1(vtkAdjacentVertexIterator::New());
-      graph->GetAdjacentVertices(id1,it1);
-      it1->Next();//zeGroups
-      vtkIdType idZeFams(it1->Next());//zeFams
-      vtkAdjacentVertexIterator *itFams(vtkAdjacentVertexIterator::New());
-      graph->GetAdjacentVertices(idZeFams,itFams);
-      while(itFams->HasNext())
-        {
-          vtkIdType idf(itFams->Next());
-          std::string crudeFamName((const char *)verticesNames2->GetValue(idf));
-          std::size_t pos(crudeFamName.find_first_of(ZE_SEP));
-          std::string famName(crudeFamName.substr(0,pos)); std::string idStr(crudeFamName.substr(pos+strlen(ZE_SEP)));
-          int idInt(QString(idStr.c_str()).toInt());
-          ret[famName]=idInt;
-        }
-      it1->Delete();
-    }
-  it0->Delete();
-  return ret;
-}
-
-void pqExtractGroupPanel::updateInformationAndDomains()
-{
-  pqNamedObjectPanel::updateInformationAndDomains();
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("GroupsFlagsStatus"));
-  SMProperty->Modified();// agy : THE LINE FOR 7.5.1 !
-}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.h b/src/Plugins/MEDReader/ParaViewPlugin/pqExtractGroupPanel.h
deleted file mode 100644 (file)
index ac24434..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#ifndef _pqExtractGroupPanel_h
-#define _pqExtractGroupPanel_h
-
-#include "pqNamedObjectPanel.h"
-
-#include <map>
-
-class pqTreeWidgetItemObject;
-
-class vtkSMProperty;
-class vtkMutableDirectedGraph;
-
-class pqExtractGroupPanel: public pqNamedObjectPanel
-{
-Q_OBJECT
-  typedef pqNamedObjectPanel Superclass;
-public:
-  pqExtractGroupPanel(pqProxy* proxy, QWidget* p = NULL);
-  ~pqExtractGroupPanel();
-  void updateInformationAndDomains();
-protected slots:
-  void updateSIL();
-  void anItemAsBeenFired();
-private:
-  static std::map<std::string,int> DeduceMapOfFamilyFromSIL(vtkMutableDirectedGraph *graph);
-protected:
-  /// populate widgets with properties from the server manager
-  virtual void linkServerManagerProperties();
-  class pqUI;
-  pqUI* UI;
-};
-
-#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.cxx
new file mode 100644 (file)
index 0000000..1009a77
--- /dev/null
@@ -0,0 +1,273 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqMEDReaderFieldsWidget.h"
+
+#include "vtkMEDReader.h"
+#include "vtkPVMetaDataInformation.h"
+
+#include "pqTreeWidget.h"
+#include "pqTreeWidgetItemObject.h"
+#include "vtkDataSetAttributes.h"
+#include "vtkGraph.h"
+#include "vtkNew.h"
+#include "vtkStringArray.h"
+#include "vtkTree.h"
+
+#include <QStringList>
+#include <QHeaderView>
+
+//-----------------------------------------------------------------------------
+pqMEDReaderFieldsWidget::pqMEDReaderFieldsWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, smproperty, parentObject)
+{
+  this->TreeWidget->header()->hide();
+  this->visibleHeader = false;
+  this->TransmitToParent = true;
+  this->initializeTreeWidget(smproxy, smproperty);
+}
+
+//-----------------------------------------------------------------------------
+pqMEDReaderFieldsWidget::~pqMEDReaderFieldsWidget()
+{
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderFieldsWidget::loadTreeWidgetItems()
+{
+  //Clear Item Map
+  this->ItemMap.clear();
+
+  // Clear tree
+  this->TreeWidget->clear();
+
+  // Clear unique checked item vector
+  this->UniqueCheckedItems.clear();
+
+  // Recover meta data graph
+  vtkPVMetaDataInformation *info(vtkPVMetaDataInformation::New());
+  this->proxy()->GatherInformation(info);
+  vtkGraph* graph = vtkGraph::SafeDownCast(info->GetInformationData());
+
+  // Create a tree
+  vtkNew<vtkTree> tree;
+  tree->CheckedShallowCopy(graph);
+  vtkStringArray* names =
+    vtkStringArray::SafeDownCast(tree->GetVertexData()->GetAbstractArray("Names"));
+
+  vtkIdType root = tree->GetRoot();
+  vtkIdType fst = tree->GetChild(root, 0); // FieldsStatusTree
+
+  this->NItems = 0;
+  int nLeaves = 0;
+  for (int i = 1; i < tree->GetNumberOfChildren(fst); i += 2)
+    {
+    // Browse all interessting tree node
+
+    // TSX Node
+    vtkIdType tsxId = tree->GetChild(fst, i);
+    vtkIdType tsId = tree->GetChild(fst, i - 1);
+    pqTreeWidgetItemObject *ts = new pqTreeWidgetItemObject(this->TreeWidget, QStringList());
+    this->NItems++;
+    QString tsxName = QString(names->GetValue(tsxId));
+    ts->setText(0, tsxName);
+    ts->setData(0, Qt::ToolTipRole, QString(names->GetValue(tsId)));
+
+    // MAIL Node
+    vtkIdType mailId = tree->GetChild(tsxId, 0);
+    pqTreeWidgetItemObject *mail = new pqTreeWidgetItemObject(ts, QStringList());
+    this->NItems++;
+    QString mailName = QString(names->GetValue(mailId));
+    mail->setText(0, mailName);
+    mail->setData(0, Qt::ToolTipRole, QString(names->GetValue(mailId)));
+
+    QString propertyBaseName = tsxName + "/" + mailName + "/";
+
+    // ComsupX node
+    for (int comsupi = 0; comsupi < tree->GetNumberOfChildren(mailId); comsupi++)
+      {
+      vtkIdType comSupId = tree->GetChild(mailId, comsupi);
+      pqTreeWidgetItemObject *comsup = new pqTreeWidgetItemObject(mail, QStringList());
+      this->NItems++;
+      QString comsupName = QString(names->GetValue(comSupId));
+      comsup->setText(0, comsupName);
+
+      // ComSup tooltip
+      vtkIdType geoTypeId = tree->GetChild(comSupId, 1);
+      QString comSupToolTipName(names->GetValue(comSupId));
+      for (int geoi = 0; geoi < tree->GetNumberOfChildren(geoTypeId); geoi++)
+        {
+        comSupToolTipName += QString("\n- %1").arg(
+          QString(names->GetValue(tree->GetChild(geoTypeId, geoi))));
+        }
+      comsup->setData(0, Qt::ToolTipRole, comSupToolTipName);
+
+      comsup->setFlags(comsup->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
+      comsup->setChecked(true);
+      QObject::connect(comsup, SIGNAL(checkedStateChanged(bool)), this, SLOT(updateChecks()));
+      this->UniqueCheckedItems.push_back(comsup);
+
+      QString fullComsupName = propertyBaseName + comsupName + "/";
+      // Arrs node
+      vtkIdType arrId = tree->GetChild(comSupId, 0);
+      for (int arri = 0; arri < tree->GetNumberOfChildren(arrId); arri++)
+        {
+        pqTreeWidgetItemObject *array = new pqTreeWidgetItemObject(comsup, QStringList());
+        this->NItems++;
+
+        vtkIdType arrayId = tree->GetChild(arrId, arri);
+        std::string str = names->GetValue(arrayId);
+        this->ItemMap[fullComsupName + QString(str.c_str())] = array;
+
+        const char* separator = vtkMEDReader::GetSeparator();
+        size_t pos = str.find(separator);
+        std::string name = str.substr(0, pos);
+
+        array->setText(0, QString(name.c_str()));
+        array->setFlags(array->flags() | Qt::ItemIsUserCheckable);
+        array->setChecked(true);
+
+        // Special Field
+        if (tree->GetNumberOfChildren(arrayId) != 0)
+          {
+          QFont font;
+          font.setItalic(true);
+          font.setUnderline(true);
+          array->setData(0, Qt::FontRole, QVariant(font));
+
+          array->setData(0, Qt::ToolTipRole,
+                         QString("Whole \" %1\" mesh").arg(name.c_str()));
+          array->setData(0, Qt::DecorationRole,
+            QPixmap(":/ParaViewResources/Icons/pqCellDataForWholeMesh16.png"));
+          }
+        // Standard Field
+        else
+          {
+          std::string spatialDiscr = str.substr(pos + strlen(separator));
+          QString tooltip = QString(name.c_str() + QString(" (") +
+                                    spatialDiscr.c_str() + QString(")"));
+          array->setData(0, Qt::ToolTipRole, tooltip);
+
+          QPixmap pix;
+          if (spatialDiscr == "P0")
+            {
+            pix.load(":/ParaViewResources/Icons/pqCellData16.png");
+            }
+          else if (spatialDiscr == "P1")
+            {
+            pix.load(":/ParaViewResources/Icons/pqPointData16.png");
+            }
+          else if (spatialDiscr == "GAUSS")
+            {
+            pix.load(":/ParaViewResources/Icons/pqQuadratureData16.png");
+            }
+          else if (spatialDiscr == "GSSNE")
+            {
+            pix.load(":/ParaViewResources/Icons/pqElnoData16.png");
+            }
+          array->setData(0, Qt::DecorationRole, pix);
+          }
+
+        // Connection and updating checks for each item
+        QObject::connect(array, SIGNAL(checkedStateChanged(bool)), this, SLOT(updateChecks()));
+        nLeaves++;
+        }
+      }
+    }
+
+  // Expand tree
+  this->TreeWidget->expandAll();
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderFieldsWidget::uncheckOtherUniqueItems(pqTreeWidgetItemObject* item)
+{
+  // Uncheck all other items in vector
+  foreach (pqTreeWidgetItemObject* otherItems, this->UniqueCheckedItems)
+    {
+    if (otherItems != item)
+      {
+      otherItems->setCheckState(0, Qt::Unchecked);
+      }
+    }
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderFieldsWidget::updateChecks()
+{
+  // Call updateCheck on the sender
+  pqTreeWidgetItemObject* item = qobject_cast<pqTreeWidgetItemObject*>(QObject::sender());
+  this->updateChecks(item);
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderFieldsWidget::updateChecks(pqTreeWidgetItemObject* item)
+{
+  // When a Leaf item is checked, the parent will be checked (partially or not).
+  // Then other parents will be unchecked using uncheckOtherUniqueItems
+  // Then other parent leaf will be unchecked using updateChecks(parent)
+  //
+  // When a Parent item is checked, the leaf will be checked
+  // Then other parents will be unchecked using uncheckOtherUniqueItems
+  // Then other parent leaf will be unchecked using updateChecks(parent)
+
+  if (item->childCount() == 0)
+    {
+    // Only first level leaf will transmit checks to parent
+    if (this->TransmitToParent)
+      {
+      // Recover correct parent state
+      Qt::CheckState state = item->checkState(0);
+      pqTreeWidgetItemObject* parent =
+        dynamic_cast<pqTreeWidgetItemObject*>(item->QTreeWidgetItem::parent());
+      for (int i = 0; i < parent->childCount(); i++)
+        {
+        if (parent->child(i)->checkState(0) != state)
+          {
+          state = Qt::PartiallyChecked;
+          }
+        }
+      // Set Parent State
+      parent->setCheckState(0, state);
+      }
+    }
+  else
+    {
+    // Check/Uncheck childs, blocking looped call to slot
+    if (item->checkState(0) != Qt::PartiallyChecked)
+      {
+      this->TransmitToParent = false;
+      for (int i = 0; i < item->childCount(); i++)
+        {
+        pqTreeWidgetItemObject* leaf =
+          dynamic_cast<pqTreeWidgetItemObject*>(item->child(i));
+        leaf->setCheckState(0, item->checkState(0));
+        }
+      this->TransmitToParent = true;
+      }
+
+    // Uncheck other unique checked items
+    if (item->checkState(0) != Qt::Unchecked)
+      {
+      this->uncheckOtherUniqueItems(item);
+      }
+    }
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderFieldsWidget.h
new file mode 100644 (file)
index 0000000..be3140c
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqMEDReaderFieldsWidget_h
+#define __pqMEDReaderFieldsWidget_h
+
+#include "pqAbstractFieldsWidget.h"
+
+class vtkSMProxy;
+class vtkSMProperty;
+class pqMEDReaderFieldsWidget : public pqAbstractFieldsWidget
+{
+  typedef pqAbstractFieldsWidget Superclass;
+  Q_OBJECT
+
+public:
+  pqMEDReaderFieldsWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqMEDReaderFieldsWidget();
+
+protected:
+  // Descritpion
+  // Load the tree widget using recovered meta data graph
+  // and connect each item to indexed property
+  void loadTreeWidgetItems();
+
+  // Description
+  // Uncheck other unique checked item
+  void uncheckOtherUniqueItems(pqTreeWidgetItemObject* item);
+
+  // Description
+  // Update check state of other items using provided item
+  void updateChecks(pqTreeWidgetItemObject* item);
+
+  // Description
+  // Vector of unique checked items
+  std::vector<pqTreeWidgetItemObject*> UniqueCheckedItems;
+
+  // Description
+  // Flag indicating if updateCheck method is recursivelly called,
+  // to avoid infinite loop
+  bool TransmitToParent;
+
+protected slots:
+  // Description
+  // Update check state of other items using the sender object
+  void updateChecks();
+
+private:
+  Q_DISABLE_COPY(pqMEDReaderFieldsWidget);
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.cxx
new file mode 100644 (file)
index 0000000..06bc848
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqMEDReaderGraphUtils.h"
+
+#include "vtkGraph.h"
+#include "vtkTree.h"
+#include "vtkNew.h"
+#include "vtkStringArray.h"
+#include "vtkDataSetAttributes.h"
+
+namespace pqMedReaderGraphUtils
+{
+void getCurrentTS(vtkGraph* graph, vtkIdType id, QStringList& dts, QStringList& its,
+                  QStringList& tts)
+{
+  vtkNew<vtkTree> tree;
+  tree->CheckedShallowCopy(graph);
+  vtkStringArray* names = vtkStringArray::SafeDownCast(
+    tree->GetVertexData()->GetAbstractArray("Names"));
+  vtkIdType root = tree->GetRoot();
+  vtkIdType fst = tree->GetChild(root, 0); // FieldsStatusTree
+  vtkIdType tsr = tree->GetChild(tree->GetChild(fst, id*2), 0); //Time Step root node
+  vtkIdType tmp;
+  for (int i = 0; i < tree->GetNumberOfChildren(tsr); i++)
+    {
+    // Each Time Step
+    // Recover step
+    tmp = tree->GetChild(tsr, i);
+    dts << QString(names->GetValue(tmp));
+
+    // Recover mode
+    tmp = tree->GetChild(tmp, 0);
+    its << QString(names->GetValue(tmp));
+
+    // Recover value
+    tmp = tree->GetChild(tmp, 0);
+    tts << QString(names->GetValue(tmp));
+    }
+}
+
+int getMaxNumberOfTS(vtkGraph* graph)
+{
+  vtkNew<vtkTree> tree;
+  tree->CheckedShallowCopy(graph);
+  vtkStringArray* names = vtkStringArray::SafeDownCast(
+    tree->GetVertexData()->GetAbstractArray("Names"));
+  vtkIdType root = tree->GetRoot();
+  vtkIdType fst = tree->GetChild(root, 0); // FieldsStatusTree
+  vtkIdType tmp;
+  int nbTS = 0;
+  for (int i = 0; i < tree->GetNumberOfChildren(fst); i += 2)
+    {
+    // Look for max time steps
+    tmp = tree->GetChild(tree->GetChild(fst, i), 0);
+    nbTS = std::max(nbTS, names->GetVariantValue(tmp).ToInt());
+    }
+  return nbTS;
+}
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderGraphUtils.h
new file mode 100644 (file)
index 0000000..f906096
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef _pqMEDReaderGraphUtils_h
+#define _pqMEDReaderGraphUtils_h
+
+#include "vtkType.h"
+
+#include <QStringList>
+
+class vtkGraph;
+class pqTreeWidget;
+
+namespace pqMedReaderGraphUtils
+{
+  // Description
+  // Extract Current Time Step from a meta data graph
+  void getCurrentTS(vtkGraph* graph, vtkIdType id, QStringList& dts,
+                    QStringList& its, QStringList& tts);
+
+  // Description
+  // Extract the maximum number of timestep from a meta data graph
+  int getMaxNumberOfTS(vtkGraph* graph);
+}
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.cxx
deleted file mode 100644 (file)
index 00b7dd6..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#include "pqMEDReaderPanel.h"
-#include "ui_MEDReaderPanel.h"
-#include "VectBoolWidget.h"
-
-#include "vtkProcessModule.h"
-#include "vtkMultiBlockDataSet.h"
-#include "vtkInformation.h"
-#include "vtkIntArray.h"
-#include "vtkSMDoubleVectorProperty.h"
-#include "vtkSMIntVectorProperty.h"
-#include "vtkSMStringVectorProperty.h"
-#include "vtkSMProxy.h"
-#include "vtkEventQtSlotConnect.h"
-#include "vtkPVSILInformation.h"
-#include "vtkGraph.h"
-#include "vtkMutableDirectedGraph.h"
-#include "vtkAdjacentVertexIterator.h"
-#include "vtkSMPropertyHelper.h"
-#include "vtkStringArray.h"
-#include "vtkDataSetAttributes.h"
-#include "vtkMEDReader.h"
-#include "vtkSMSourceProxy.h"
-
-#include "pqTreeWidgetItemObject.h"
-#include "pqSMAdaptor.h"
-#include "pqProxy.h"
-#include "pqPropertyManager.h"
-#include "pqSILModel.h"
-#include "pqProxySILModel.h"
-#include "pqTreeViewSelectionHelper.h"
-#include "pqTreeWidgetSelectionHelper.h"
-
-#include <QHeaderView>
-
-#include <sstream>
-
-static const char ZE_SEP[]="@@][@@";
-
-class PixSingle
-{
-public:
-  static const PixSingle &GetInstance();
-  QPixmap getPixFromStr(const std::string& st) const;
-  QPixmap getWholeMeshPix() const;
-  PixSingle();
-private:
-  static const int NB_OF_DISCR=4;
-  static PixSingle *UNIQUE_PIX_SINGLE;
-  QPixmap _pixmaps[NB_OF_DISCR];
-  std::map<std::string,int> _ze_map;
-  QPixmap _whole_mesh;
-};
-
-PixSingle *PixSingle::UNIQUE_PIX_SINGLE=0;
-
-const PixSingle &PixSingle::GetInstance()
-{
-  if(!UNIQUE_PIX_SINGLE)
-    UNIQUE_PIX_SINGLE=new PixSingle;
-  return *UNIQUE_PIX_SINGLE;
-}
-
-PixSingle::PixSingle()
-{
-  _pixmaps[0]=QPixmap(":/ParaViewResources/Icons/pqCellData16.png");
-  _pixmaps[1]=QPixmap(":/ParaViewResources/Icons/pqPointData16.png");
-  _pixmaps[2]=QPixmap(":/ParaViewResources/Icons/pqQuadratureData16.png");
-  _pixmaps[3]=QPixmap(":/ParaViewResources/Icons/pqElnoData16.png");
-  _ze_map[std::string("P0")]=0;
-  _ze_map[std::string("P1")]=1;
-  _ze_map[std::string("GAUSS")]=2;
-  _ze_map[std::string("GSSNE")]=3;
-  _whole_mesh=QPixmap(":/ParaViewResources/Icons/pqCellDataForWholeMesh16.png");
-}
-
-QPixmap PixSingle::getPixFromStr(const std::string& st) const
-{
-  std::map<std::string,int>::const_iterator it(_ze_map.find(st));
-  if(it!=_ze_map.end())
-    return _pixmaps[(*it).second];
-  else
-    return QPixmap();
-}
-
-QPixmap PixSingle::getWholeMeshPix() const
-{
-  return _whole_mesh;
-}
-
-class pqMEDReaderPanel::pqUI: public QObject, public Ui::MEDReaderPanel
-{
-public:
-  pqUI(pqMEDReaderPanel *p):QObject(p)
-  {
-    this->VTKConnect = vtkSmartPointer<vtkEventQtSlotConnect>::New();
-  }
-
-  ~pqUI() { }
-  
-  vtkSmartPointer<vtkEventQtSlotConnect> VTKConnect;
-  QMap<QTreeWidgetItem*, QString> TreeItemToPropMap;
-};
-
-pqMEDReaderPanel::pqMEDReaderPanel(pqProxy *object_proxy, QWidget *p):Superclass(object_proxy,p),_reload_req(false),_optional_widget(0),_my_mtime(0),_sm_prop_remote_mtime(0)
-{
-  initAll();
-}
-
-// VSR, 16/03/2015, PAL22921
-// Below is the helper class which is implemented a workaround about ugly pqTreeWidgetItemObject class.
-// We use this helper class to make 1st and 2nd level tree items uncheckable.
-class pqMyTreeWidgetItemObject : public pqTreeWidgetItemObject
-{
-public:
-  pqMyTreeWidgetItemObject(const QStringList& t, int type=QTreeWidgetItem::UserType): pqTreeWidgetItemObject(t, type){}
-  pqMyTreeWidgetItemObject(QTreeWidget* p, const QStringList& t, int type=QTreeWidgetItem::UserType): pqTreeWidgetItemObject(p, t, type){}
-  pqMyTreeWidgetItemObject(QTreeWidgetItem* p, const QStringList& t, int type=QTreeWidgetItem::UserType): pqTreeWidgetItemObject(p, t, type){}
-  virtual void setData ( int column, int role, const QVariant & value )
-  {
-    if ( role != Qt::CheckStateRole)
-      pqTreeWidgetItemObject::setData(column, role, value );
-  }
-};
-
-void pqMEDReaderPanel::initAll()
-{
-  _all_lev4.clear();
-  this->UI=new pqUI(this);
-  this->UI->setupUi(this);
-  this->UI->Fields->setHeaderHidden(true);
-  this->updateSIL();
-  //
-  _sm_prop_remote_mtime=dynamic_cast<vtkSMIntVectorProperty *>(this->proxy()->GetProperty("ServerModifTime"));
-  if(_sm_prop_remote_mtime)
-    _sm_prop_remote_mtime->SetImmediateUpdate(1);
-  //
-  vtkSMProxy *reader(this->referenceProxy()->getProxy());
-  vtkPVSILInformation *info(vtkPVSILInformation::New());
-  reader->GatherInformation(info);
-  vtkGraph *g(info->GetSIL());
-  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<vtkMutableDirectedGraph *>(g));
-  int idNames(0);
-  vtkAbstractArray *verticesNames(g2->GetVertexData()->GetAbstractArray("Names",idNames));
-  vtkStringArray *verticesNames2(vtkStringArray::SafeDownCast(verticesNames));
-  vtkIdType id0;
-  bool found(false);
-  for(int i=0;i<verticesNames2->GetNumberOfValues();i++)
-    {
-      vtkStdString &st(verticesNames2->GetValue(i));
-      if(st=="FieldsStatusTree")
-        {
-          id0=i;
-          found=true;
-        }
-    }
-  if(!found)
-    std::cerr << "There is an internal error ! The tree on server side has not the expected look !" << std::endl;
-  vtkAdjacentVertexIterator *it0(vtkAdjacentVertexIterator::New());
-  g2->GetAdjacentVertices(id0,it0);
-  int kk(0),ll(0);
-  while(it0->HasNext())
-    {
-      vtkIdType idToolTipForTS(it0->Next());
-      QString toolTipName0(QString::fromStdString((const char *)verticesNames2->GetValue(idToolTipForTS)));
-      QString nbTS;
-      QList<QString> dts,its,tts;
-      {
-        vtkAdjacentVertexIterator *itForTS(vtkAdjacentVertexIterator::New());
-        g2->GetAdjacentVertices(idToolTipForTS,itForTS);
-        vtkIdType idForNbTS(itForTS->Next());
-        nbTS=QString::fromStdString((const char *)verticesNames2->GetValue(idForNbTS));
-        itForTS->Delete();
-        int nbTSInt(nbTS.toInt());
-        for(int ii=0;ii<nbTSInt;ii++)
-          {
-            dts.push_back(QString::fromStdString((const char *)verticesNames2->GetValue(idForNbTS+3*ii+1)));
-            its.push_back(QString::fromStdString((const char *)verticesNames2->GetValue(idForNbTS+3*ii+2)));
-            tts.push_back(QString::fromStdString((const char *)verticesNames2->GetValue(idForNbTS+3*ii+3)));
-          }
-      }
-      vtkIdType id1(it0->Next());
-      //
-      vtkSMProperty *SMProperty(this->proxy()->GetProperty("FieldsStatus"));
-      vtkSMProperty *SMPropertyRead(this->proxy()->GetProperty("FieldsTreeInfo"));
-      SMProperty->ResetToDefault();//this line is very important !
-      //
-      QString name0(QString::fromStdString((const char *)verticesNames2->GetValue(id1))); QList<QString> strs0; strs0.append(name0);
-      pqTreeWidgetItemObject *item0(new pqMyTreeWidgetItemObject(this->UI->Fields,strs0));
-      item0->setData(0,Qt::UserRole,name0);
-      item0->setData(0,Qt::ToolTipRole,toolTipName0);
-      //
-      QList<QVariant> modulesAct;
-      for(int i=0;i<nbTS.toInt();i++)
-        modulesAct.push_back(QVariant(true));
-      item0->setProperty("NbOfTS",nbTS);
-      item0->setProperty("DTS",QVariant(dts));
-      item0->setProperty("ITS",QVariant(its));
-      item0->setProperty("TTS",QVariant(tts));
-      item0->setProperty("ChosenTS",QVariant(modulesAct));
-      //
-      vtkAdjacentVertexIterator *it1(vtkAdjacentVertexIterator::New());//mesh
-      g2->GetAdjacentVertices(id1,it1);
-      while(it1->HasNext())
-        {
-          vtkIdType id2(it1->Next());
-          QString name1(QString::fromStdString((const char *)verticesNames2->GetValue(id2))); QList<QString> strs1; strs1.append(name1);
-          QString toolTipName1(name1);
-          pqTreeWidgetItemObject *item1(new pqMyTreeWidgetItemObject(item0,strs1));
-          item1->setData(0,Qt::UserRole,name1);
-          item1->setData(0,Qt::ToolTipRole,toolTipName1);
-          vtkAdjacentVertexIterator *it2(vtkAdjacentVertexIterator::New());//common support
-          g2->GetAdjacentVertices(id2,it2);
-          while(it2->HasNext())
-            {
-              vtkIdType id3(it2->Next());
-              QString name2(QString::fromStdString((const char *)verticesNames2->GetValue(id3))); QList<QString> strs2; strs2.append(name2);
-              pqTreeWidgetItemObject *item2(new pqTreeWidgetItemObject(item1,strs2));
-              item2->setData(0,Qt::UserRole,name2);
-              item2->setChecked(false);
-              vtkAdjacentVertexIterator *it3(vtkAdjacentVertexIterator::New());//fields !
-              g2->GetAdjacentVertices(id3,it3);
-              vtkIdType id3Arrs(it3->Next());
-              vtkAdjacentVertexIterator *it3Arrs(vtkAdjacentVertexIterator::New());//arrs in fields !
-              g2->GetAdjacentVertices(id3Arrs,it3Arrs);
-              while(it3Arrs->HasNext())
-                {
-                  vtkIdType id4(it3Arrs->Next());
-                  std::string name3CppFull((const char *)verticesNames2->GetValue(id4));
-                  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<QString> strs3; strs3.append(name3);
-                  QString toolTipName3(name3+QString(" (")+spatialDiscr.c_str()+QString(")"));
-                  //
-                  vtkAdjacentVertexIterator *it4(vtkAdjacentVertexIterator::New());// is it a special field ? A field mesh ?
-                  g2->GetAdjacentVertices(id4,it4);
-                  bool isSpecial(it4->HasNext());
-                  it4->Delete();
-                  //
-                  pqTreeWidgetItemObject *item3(new pqTreeWidgetItemObject(item2,strs3));
-                  _all_lev4.push_back(item3);
-                  item3->setData(0,Qt::UserRole,name3);
-                  if(isSpecial)
-                    {
-                      QFont font; font.setItalic(true);        font.setUnderline(true);
-                      item3->setData(0,Qt::FontRole,QVariant(font));
-                      item3->setData(0,Qt::ToolTipRole,QString("Whole \"%1\" mesh").arg(name3));
-                      item3->setData(0,Qt::DecorationRole,PixSingle::GetInstance().getWholeMeshPix());
-                    }
-                  else
-                    {
-                      item3->setData(0,Qt::ToolTipRole,toolTipName3);
-                      item3->setData(0,Qt::DecorationRole,PixSingle::GetInstance().getPixFromStr(spatialDiscr));
-                    }
-                  _leaves.insert(std::pair<pqTreeWidgetItemObject *,int>(item3,ll));
-                  std::ostringstream pdm; pdm << name0.toStdString() << "/" << name1.toStdString() << "/" << name2.toStdString() << "/" << name3CppFull;
-                  (static_cast<vtkSMStringVectorProperty *>(SMProperty))->SetElement(2*ll,pdm.str().c_str());
-                  const char *tmp((static_cast<vtkSMStringVectorProperty *>(SMPropertyRead))->GetElement(2*ll+1));
-                  item3->setChecked(tmp[0]=='1');
-                  item3->setProperty("PosInStringVector",QVariant(ll));
-                  item3->setProperty("ZeKey",QVariant(QString(pdm.str().c_str())));
-                  connect(item3,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-                  ll++;
-                }
-                connect(item2,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev3HasBeenFired(bool)));
-                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();
-                it3Arrs->Delete();
-                kk++;
-              }
-            it2->Delete();
-          }
-        it1->Delete();
-      }
-  it0->Delete();
-  this->UI->Fields->header()->setStretchLastSection(true);
-  this->UI->Fields->expandAll();
-  info->Delete();
-  this->UI->stdMode->setChecked(true);
-  this->UI->VTKConnect->Connect(this->proxy(),vtkCommand::UpdateInformationEvent, this, SLOT(updateSIL()));
-  ///
-  this->UI->Reload->setProperty("NbOfReloadDynProp",QVariant(1));
-  vtkSMProperty *SMProperty(this->proxy()->GetProperty("ReloadReq"));
-  connect(this->UI->Reload,SIGNAL(pressed()),this,SLOT(reloadFired()));
-  this->propertyManager()->registerLink(this->UI->Reload,"NbOfReloadDynProp",SIGNAL(pressed()),this->proxy(),SMProperty);
-  ///
-  vtkSMProperty *SMProperty0(this->proxy()->GetProperty("GenerateVectors"));
-  this->propertyManager()->registerLink(this->UI->GenerateVects,"checked",SIGNAL(stateChanged(int)),this->proxy(),SMProperty0);
-  ///
-  vtkSMProperty *SMProperty2(this->proxy()->GetProperty("TimeOrModal"));
-  SMProperty2->ResetToDefault();//this line is very important !
-  this->propertyManager()->registerLink(this->UI->modeMode,"checked",SIGNAL(toggled(bool)),this->proxy(),SMProperty2);
-  ///
-  delete _optional_widget;
-  _optional_widget=new VectBoolWidget(this->UI->timeStepsInspector,getMaxNumberOfTS());
-  _optional_widget->hide();
-  this->UI->timeStepsInspector->setMinimumSize(QSize(0,0));
-  connect(this->UI->modeMode,SIGNAL(toggled(bool)),this,SLOT(vectOfBoolWidgetRequested(bool)));
-  vtkSMProperty *SMProperty3(this->proxy()->GetProperty("TimesFlagsStatus"));
-  SMProperty3->ResetToDefault();
-  const QVector<VectBoolItem *>& items(_optional_widget->getItems());
-  int itt(0);
-  foreach(VectBoolItem *item,items)
-    {
-      this->propertyManager()->registerLink(item,"activated",SIGNAL(changed()),this->proxy(),SMProperty3,itt++);
-    }
-}
-
-pqMEDReaderPanel::~pqMEDReaderPanel()
-{
-  delete _optional_widget;
-}
-
-void pqMEDReaderPanel::linkServerManagerProperties()
-{
-  this->Superclass::linkServerManagerProperties();
-}
-
-void pqMEDReaderPanel::updateSIL()
-{
-  if(_reload_req)
-    {
-      _reload_req=false;
-      this->UI->geometryGroupBox->hide();
-      delete this->UI;
-      foreach(QObject *child,children())
-        {
-          QLayout *layout(qobject_cast<QLayout *>(child));
-          if(layout)
-            delete layout;
-        }
-      initAll();
-    }
-}
-
-void pqMEDReaderPanel::aLev3HasBeenFired(bool v)
-{
-  pqTreeWidgetItemObject *zeItem(qobject_cast<pqTreeWidgetItemObject *>(sender()));
-  if(!zeItem)
-    return;
-  for(int i=0;i<zeItem->childCount();i++)
-    {
-      QTreeWidgetItem *elt(zeItem->child(i));
-      pqTreeWidgetItemObject *eltC(dynamic_cast<pqTreeWidgetItemObject *>(elt));
-      if(eltC)
-        {
-          eltC->setChecked(v);
-          aLev4HasBeenFiredBy(eltC);
-        }
-    }
-  putLev3InOrder();
-  somethingChangedInFieldRepr();
-}
-
-void pqMEDReaderPanel::aLev4HasBeenFired()
-{
-  pqTreeWidgetItemObject *zeItem(qobject_cast<pqTreeWidgetItemObject *>(sender()));
-  if(zeItem)
-    aLev4HasBeenFiredBy(zeItem);
-  putLev3InOrder();
-  somethingChangedInFieldRepr();
-}
-
-void pqMEDReaderPanel::aLev4HasBeenFiredBy(pqTreeWidgetItemObject *zeItem)
-{
-  pqTreeWidgetItemObject *father(dynamic_cast<pqTreeWidgetItemObject *>(zeItem->QTreeWidgetItem::parent()));
-  QTreeWidgetItem *godFather(father->QTreeWidgetItem::parent()->parent());
-  if(!father)
-    return ;
-  if(zeItem->isChecked())
-    {
-      bool isActivatedTSChanged(false);
-      // This part garantees that all leaves having not the same father than zeItem are desactivated
-      foreach(pqTreeWidgetItemObject* elt,this->_all_lev4)
-      {
-        QTreeWidgetItem *testFath(elt->QTreeWidgetItem::parent());
-        if(testFath!=father)
-          if(elt->isChecked())
-            {
-              {
-                disconnect(elt,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-                elt->setChecked(false);
-                connect(elt,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-              }
-              if(godFather!=testFath->parent()->parent())
-                isActivatedTSChanged=true;
-            }
-      }
-      // the user by clicking to a new entry has changed of TimeStepSeries -> notify it to thee time step selector widget
-      if(isActivatedTSChanged)
-        {
-          QStringList its,dts,tts;
-          getCurrentTS(its,dts,tts);
-          _optional_widget->setItems(its,dts,tts);
-        }
-    }
-  else
-    {
-      // if all are unchecked - check it again
-      bool allItemsAreUnChked(true);
-      foreach(pqTreeWidgetItemObject* elt,this->_all_lev4)
-        {
-          if(elt && elt->isChecked())
-            allItemsAreUnChked=false;
-        }
-      if(allItemsAreUnChked)
-        {
-          disconnect(zeItem,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-          zeItem->setChecked(true);// OK zeItem was required to be unchecked but as it is the last one. Recheck it !
-          connect(zeItem,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-        }
-    }
-}
-
-void pqMEDReaderPanel::putLev3InOrder()
-{
-  std::vector<pqTreeWidgetItemObject *>::iterator it0(_all_lev4.begin()),it1;
-  while(it0!=_all_lev4.end())
-    {
-      QTreeWidgetItem *curFather((*it0)->QTreeWidgetItem::parent());
-      for(it1=it0+1;it1!=_all_lev4.end() && (*it1)->QTreeWidgetItem::parent()==curFather;it1++);
-      bool isAllFalse(true),isAllTrue(true);
-      for(std::vector<pqTreeWidgetItemObject *>::iterator it=it0;it!=it1;it++)
-        {
-          if((*it)->isChecked())
-            isAllFalse=false;
-          else
-            isAllTrue=false;
-        }
-      if(isAllFalse || isAllTrue)
-        {
-          pqTreeWidgetItemObject *father(dynamic_cast<pqTreeWidgetItemObject *>(curFather));
-          if(father)
-            {
-              disconnect(father,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev3HasBeenFired(bool)));
-              father->setChecked(isAllTrue);
-              connect(father,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev3HasBeenFired(bool)));
-            }
-        }
-      it0=it1;
-    }
-}
-
-void pqMEDReaderPanel::reloadFired()
-{
-  static int iii(1);
-  QVariant v(iii++);
-  this->UI->Reload->setProperty("NbOfReloadDynProp",v);
-  _reload_req=true;
-  for(std::set<std::pair<pqTreeWidgetItemObject *,int> >::const_iterator it=_leaves.begin();it!=_leaves.end();it++)
-    ((*it).first)->disconnect(SIGNAL(checkedStateChanged(bool)));
-  //
-  vtkSMProperty *SMProperty(this->proxy()->GetProperty("FieldsStatus"));
-  for(std::set<std::pair<pqTreeWidgetItemObject *,int> >::const_iterator it=_leaves.begin();it!=_leaves.end();it++)
-    this->propertyManager()->unregisterLink((*it).first,"checked",SIGNAL(checkedStateChanged(bool)),this->proxy(),SMProperty,(*it).second);
-  this->propertyManager()->propertyChanged();
-  vtkSMProperty *SMProperty3(this->proxy()->GetProperty("TimeOrModal"));
-  this->propertyManager()->unregisterLink(this->UI->modeMode,"checked",SIGNAL(toggled(bool)),this->proxy(),SMProperty3);
-}
-
-void pqMEDReaderPanel::vectOfBoolWidgetRequested(bool isMode)
-{
-  if(isMode)
-    {
-      this->UI->timeStepsInspector->setMinimumSize(QSize(200,250));
-      _optional_widget->show();
-      QStringList its,dts,tts;
-      getCurrentTS(its,dts,tts);
-      _optional_widget->setItems(its,dts,tts);
-    }
-  else
-    {
-      _optional_widget->hide();
-      this->UI->timeStepsInspector->setMinimumSize(QSize(0,0));
-    }
-}
-
-void pqMEDReaderPanel::updateCheckStatusOfLev4FromServerState()
-{
-  this->proxy()->UpdatePropertyInformation();
-  vtkSMStringVectorProperty *SMProperty(static_cast<vtkSMStringVectorProperty *>(this->proxy()->GetProperty("FieldsTreeInfo")));
-  for(std::vector<pqTreeWidgetItemObject *>::const_iterator it=_all_lev4.begin();it!=_all_lev4.end();it++)
-    {
-      pqTreeWidgetItemObject *elt(*it);
-      if(!elt)
-        continue;
-      QVariant v(elt->property("PosInStringVector"));
-      if(v.isNull())
-        continue;
-      bool isOK;
-      int pos(v.toInt(&isOK));
-      if(!isOK)
-        continue;
-      const char *tmp(SMProperty->GetElement(2*pos+1));
-      bool posCheckTarget(tmp[0]=='1'),actualPos(elt->isChecked());
-      if(actualPos!=posCheckTarget)
-        {
-          QTreeWidgetItem *curFather(elt->QTreeWidgetItem::parent());
-          pqTreeWidgetItemObject *father(dynamic_cast<pqTreeWidgetItemObject *>(curFather));
-          disconnect(father,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev3HasBeenFired(bool)));
-          disconnect(elt,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-          elt->setChecked(posCheckTarget);
-          connect(elt,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev4HasBeenFired()));
-          connect(father,SIGNAL(checkedStateChanged(bool)),this,SLOT(aLev3HasBeenFired(bool)));
-        }
-    }
-}
-
-void pqMEDReaderPanel::getCurrentTS(QStringList& its, QStringList& dts, QStringList& tts) const
-{
-  
-  for(std::vector<pqTreeWidgetItemObject *>::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<pqTreeWidgetItemObject *>(obj));
-          its=objC->property("ITS").toStringList();
-          dts=objC->property("DTS").toStringList();
-          tts=objC->property("TTS").toStringList();
-          return;
-        }
-    }
-  std::cerr << "pqMEDReaderPanel::getCurrentTS : internal error ! Something is going wrong !" << std::endl;
-}
-
-int pqMEDReaderPanel::getMaxNumberOfTS() const
-{
-  int ret(0);
-  for(std::vector<pqTreeWidgetItemObject *>::const_iterator it=_all_lev4.begin();it!=_all_lev4.end();it++)
-    {
-      QTreeWidgetItem *obj((*it)->QTreeWidgetItem::parent()->QTreeWidgetItem::parent()->QTreeWidgetItem::parent());
-      pqTreeWidgetItemObject *objC(dynamic_cast<pqTreeWidgetItemObject *>(obj));
-      ret=std::max(ret,objC->property("NbOfTS").toInt());
-    }
-  return ret;
-}
-
-void pqMEDReaderPanel::updateInformationAndDomains()
-{
-  //std::cerr << "updateInformationAndDomains called !" << std::endl;
-  pqNamedObjectPanel::updateInformationAndDomains();
-  if(_sm_prop_remote_mtime)
-    {
-      int remoteMTimeVal(_sm_prop_remote_mtime->GetElement(0));
-      if(remoteMTimeVal>_my_mtime)
-        {
-          //std::cout << "Refresh MEDReader panel due to external update." << std::endl;
-          updateCheckStatusOfLev4FromServerState();
-          _my_mtime=remoteMTimeVal;
-        }
-    }
-  // now force modification of FieldsStatus property to appear in trace as AllArrays.
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("FieldsStatus"));
-  SMProperty->Modified();// agy : THE LINE FOR 7.5.1 !
-}
-
-/*!
- * This slot is called by this->UI->Fields when one/several leaves have been modified.
- */
-void pqMEDReaderPanel::somethingChangedInFieldRepr()
-{
-  ///
-  vtkSMProxy *proxy(this->proxy());
-  vtkSMProperty *SMProperty(proxy->GetProperty("FieldsStatus"));
-  vtkSMStringVectorProperty *sm(dynamic_cast<vtkSMStringVectorProperty *>(SMProperty));
-  unsigned int nb(sm->GetNumberOfElements());
-  std::vector<std::string> sts(nb);
-  ///
-  pqExodusIIVariableSelectionWidget *sc(this->UI->Fields);
-  for(int i0=0;i0<sc->topLevelItemCount();i0++)
-    {
-      QTreeWidgetItem *lev0(sc->topLevelItem(i0));//TS
-      for(int i1=0;i1<lev0->childCount();i1++)
-        {
-          QTreeWidgetItem *lev1(lev0->child(i1));//Mesh
-          for(int i2=0;i2<lev1->childCount();i2++)
-            {
-              QTreeWidgetItem *lev2(lev1->child(i2));//Comp
-              for(int i3=0;i3<lev2->childCount();i3++)
-                {
-                  QTreeWidgetItem *lev3(lev2->child(i3));
-                  pqTreeWidgetItemObject *scc(dynamic_cast<pqTreeWidgetItemObject *>(lev3));
-                  int ll(scc->property("PosInStringVector").toInt());
-                  int v(scc->isChecked());
-                  std::ostringstream oss; oss << v;
-                  sts[2*ll]=scc->property("ZeKey").toString().toStdString();
-                  sts[2*ll+1]=oss.str();
-                }
-            }
-        }
-    }
-  //
-  const char **args=new const char *[nb];
-  for(unsigned int i=0;i<nb;i++)
-    {
-      args[i]=sts[i].c_str();
-    }
-  {//agy : let's go to put info in property FieldsStatus
-    int iup(sm->GetImmediateUpdate());
-    //sm->SetNumberOfElements(0);
-    sm->SetElements(args,nb);
-    proxy->UpdateVTKObjects(); // push properties states abroad
-    sm->SetImmediateUpdate(iup);
-  }
-  delete [] args;
-  //
-  ((vtkSMSourceProxy *)proxy)->UpdatePipelineInformation();//performs an update of all properties of proxy and proxy itself
-  // here wonderful proxy is declared modified right after FieldsStatus and FieldsTreeInfo -> IMPORTANT : The updated MTime of proxy will be the ref
-  // to detect modified properties. The idea here is to make FieldsTreeInfo property deprecated and so avoid to appear in trace. Don't know why InformationOnly property appear in trace ?
-  setModified();
-}
-
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderPanel.h
deleted file mode 100644 (file)
index f7d07f3..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
-//
-// 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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay
-
-#ifndef _pqMEDReaderPanel_h
-#define _pqMEDReaderPanel_h
-
-#include "pqNamedObjectPanel.h"
-
-#include <set>
-
-class pqTreeWidgetItemObject;
-class VectBoolWidget;
-
-class vtkSMProperty;
-class vtkSMIntVectorProperty;
-
-class pqMEDReaderPanel: public pqNamedObjectPanel
-{
-Q_OBJECT
-  typedef pqNamedObjectPanel Superclass;
-public:
-  pqMEDReaderPanel(pqProxy* proxy, QWidget* p = NULL);
-  ~pqMEDReaderPanel();
-  void updateInformationAndDomains();
-  void aLev4HasBeenFiredBy(pqTreeWidgetItemObject *zeItem);
-protected slots:
-  void aLev4HasBeenFired();
-  void aLev3HasBeenFired(bool);
-  //
-  void updateSIL();
-  void reloadFired();
-  void vectOfBoolWidgetRequested(bool isMode);
-  void updateCheckStatusOfLev4FromServerState();
-private:
-  int getMaxNumberOfTS() const;
-  void getCurrentTS(QStringList& its, QStringList& dts, QStringList& tts) const;
-protected:
-  void putLev3InOrder();
-  void somethingChangedInFieldRepr();
-  /// populate widgets with properties from the server manager
-  virtual void linkServerManagerProperties();
-  void initAll();
-  class pqUI;
-  pqUI* UI;
-  std::vector<pqTreeWidgetItemObject *> _all_lev4;
-private:
-  bool _reload_req;
-  std::set<std::pair<pqTreeWidgetItemObject *,int> > _leaves;
-  VectBoolWidget *_optional_widget;
-  int _my_mtime;
-  vtkSMIntVectorProperty *_sm_prop_remote_mtime;
-};
-
-#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.cxx
new file mode 100644 (file)
index 0000000..2dc1065
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqMEDReaderReloadWidget.h"
+
+#include "vtkSMProxy.h"
+#include "vtkSMSourceProxy.h"
+#include "vtkSMProperty.h"
+
+#include "pqPropertiesPanel.h"
+
+#include <QPushButton>
+#include <QGridLayout>
+
+pqMEDReaderReloadWidget::pqMEDReaderReloadWidget(vtkSMProxy *smProxy,
+                                                 vtkSMProperty *proxyProperty,
+                                                 QWidget *pWidget)
+: pqPropertyWidget(smProxy, pWidget),
+  Property(proxyProperty)
+{
+  this->setShowLabel(false);
+
+  // Grid Layout
+  QGridLayout* gridLayout = new QGridLayout(this);
+  gridLayout->setAlignment(Qt::AlignRight);
+
+  // Reload Button
+  QPushButton *button = new QPushButton();
+  button->setIcon(QIcon(":/ParaViewResources/Icons/pqReloadFile16.png"));
+  button->setFixedSize(button->sizeHint());
+  gridLayout->addWidget(button);
+
+  // Connection
+  connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
+}
+
+pqMEDReaderReloadWidget::~pqMEDReaderReloadWidget()
+{
+}
+
+void pqMEDReaderReloadWidget::buttonClicked()
+{
+  // Recovering Property Panel
+  pqPropertiesPanel* panel = NULL;
+  QObject* tmp = this;
+  while (panel == NULL)
+    {
+    tmp = tmp->parent();
+    if (!tmp)
+      {
+      break;
+      }
+    panel = qobject_cast<pqPropertiesPanel*>(tmp);
+    }
+
+  if (!panel)
+    {
+    qDebug() << "Cannot find pqPropertiesPanel, reload may not work";
+    }
+  else
+    {
+    // Restoring property to defaults, necessary when unchecked property are not applied
+    panel->propertiesRestoreDefaults();
+    }
+
+  // Reloading the data and associated properties
+  this->Property->Modified();
+  this->proxy()->UpdateProperty(this->proxy()->GetPropertyName(this->Property));
+  vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipelineInformation();
+
+  // Restting properties to dufault using domains and XML values
+  this->proxy()->ResetPropertiesToDefault();
+
+  if (panel)
+    {
+    // Disabled apply button inderectly
+    panel->propertiesRestoreDefaults();
+    }
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderReloadWidget.h
new file mode 100644 (file)
index 0000000..cae0f3c
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef _pqMEDReaderReloadWidget_h
+#define _pqMEDReaderReloadWidget_h
+
+#include "pqPropertyWidget.h"
+
+class pqMEDReaderReloadWidget : public pqPropertyWidget
+{
+  Q_OBJECT
+
+public:
+  explicit pqMEDReaderReloadWidget(vtkSMProxy *proxy,
+                                   vtkSMProperty *property,
+                                   QWidget *parent = 0);
+  ~pqMEDReaderReloadWidget();
+
+private slots:
+  // Description
+  // Called when button is clicked
+  // Reload the med reader
+  void buttonClicked();
+
+private:
+  vtkSMProperty* Property;
+};
+
+#endif // _pqMEDReaderReloadWidget_h
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.cxx
new file mode 100644 (file)
index 0000000..b5df7be
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "ui_MEDReaderTimeModeWidget.h"
+#include "pqMEDReaderTimeModeWidget.h"
+
+#include "pqCoreUtilities.h"
+//-----------------------------------------------------------------------------
+// Internals
+class pqMEDReaderTimeModeWidget::pqInternals : public Ui::MEDReaderTimeModeWidget
+{
+public:
+  pqInternals(pqMEDReaderTimeModeWidget* self)
+    {
+    this->setupUi(self);
+    }
+};
+
+//-----------------------------------------------------------------------------
+pqMEDReaderTimeModeWidget::pqMEDReaderTimeModeWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, parentObject), Internals(new pqMEDReaderTimeModeWidget::pqInternals(this))
+{
+  this->setShowLabel(false);
+  this->ModeEnabled = false;
+
+  this->addPropertyLink(this, "ModeEnabled" , SIGNAL(modeEnabled(bool)), smproperty);
+  QObject::connect(this->Internals->modeMode, SIGNAL(toggled(bool)),
+                   this, SLOT(setModeEnabled(bool)));
+}
+
+//-----------------------------------------------------------------------------
+pqMEDReaderTimeModeWidget::~pqMEDReaderTimeModeWidget()
+{
+}
+
+//-----------------------------------------------------------------------------
+bool pqMEDReaderTimeModeWidget::isModeEnabled() const
+{
+  return this->ModeEnabled;
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimeModeWidget::setModeEnabled(bool enable)
+{
+  this->ModeEnabled = enable;
+  this->Internals->modeMode->setChecked(enable);
+  this->Internals->stdMode->setChecked(!enable);
+  emit modeEnabled(enable);
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimeModeWidget.h
new file mode 100644 (file)
index 0000000..6f53763
--- /dev/null
@@ -0,0 +1,66 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqMEDReaderTimeModeWidget_h
+#define __pqMEDReaderTimeModeWidget_h
+
+#include "pqPropertyWidget.h"
+
+class pqMEDReaderTimeModeWidget : public pqPropertyWidget
+{
+  Q_OBJECT
+
+  // Qt property to link to vtk property
+  Q_PROPERTY(bool ModeEnabled READ isModeEnabled WRITE setModeEnabled)
+
+  typedef pqPropertyWidget Superclass;
+public:
+  pqMEDReaderTimeModeWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqMEDReaderTimeModeWidget();
+
+  // Description
+  // Qt property getter
+  bool isModeEnabled() const;
+
+public slots:
+  // Description
+  // Qt Property setter
+  void setModeEnabled(bool enable);
+
+signals:
+  // Description
+  // Qt Property signal
+  void modeEnabled(bool enable);
+
+private:
+  Q_DISABLE_COPY(pqMEDReaderTimeModeWidget);
+
+  // Description
+  // Qt property value
+  bool ModeEnabled;
+
+  // Description
+  // UI Internals
+  class pqInternals;
+  pqInternals* Internals;
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.cxx
new file mode 100644 (file)
index 0000000..25113c7
--- /dev/null
@@ -0,0 +1,213 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqMEDReaderTimesFlagsWidget.h"
+
+#include "VectBoolWidget.h"
+#include "pqMEDReaderGraphUtils.h"
+#include "vtkMEDReader.h"
+#include "vtkPVMetaDataInformation.h"
+
+#include "pqCoreUtilities.h"
+#include "pqArrayListDomain.h"
+#include "pqPropertiesPanel.h"
+#include "vtkGraph.h"
+#include "vtkGraphWriter.h"
+#include "vtkInformationDataObjectMetaDataKey.h"
+#include "vtkNew.h"
+#include "vtkSMDoubleVectorProperty.h"
+#include "vtkSMStringVectorProperty.h"
+#include "vtkTree.h"
+
+#include <QGridLayout>
+#include <QStringList>
+
+//-----------------------------------------------------------------------------
+pqMEDReaderTimesFlagsWidget::pqMEDReaderTimesFlagsWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, parentObject)
+{
+  this->CachedTsId = -1;
+  this->TimesVectWidget = NULL;
+  this->setShowLabel(false);
+
+  // Grid Layout
+  this->TimesVectLayout = new QGridLayout(this);
+
+  // VectBoolWidget
+  this->CreateTimesVectWidget();
+  this->UpdateTimeSteps();
+
+  // Connect timeStepStatus property to update time steps method
+  vtkSMProperty* prop = smproxy? smproxy->GetProperty("FieldsStatus") : NULL;
+  if (!prop)
+    {
+    qDebug("Could not locate property named 'FieldsStatus'. "
+           "pqMEDReaderTimesFlagsWidget will have no updated labels.");
+    }
+  else
+    {
+    pqCoreUtilities::connect(prop, vtkCommand::UncheckedPropertyModifiedEvent,
+                             this, SLOT(UpdateTimeSteps()));
+    }
+
+  // Connect Property Domain to the timeStepDomain property,
+  // so setTimeStepDomain is called when the domain changes.
+  vtkSMDomain* arraySelectionDomain = smproperty->GetDomain("array_list");
+  new pqArrayListDomain(this,"timeStepsDomain", smproxy, smproperty, arraySelectionDomain);
+
+  // Connect property to timeStep QProperty using a biderectionnal property link
+  this->addPropertyLink(this, "timeSteps", SIGNAL(timeStepsChanged()),
+                        smproxy, smproperty);
+
+  const QMap<QString, VectBoolItem*>& items(this->TimesVectWidget->getItems());
+  QMap<QString, VectBoolItem*>::const_iterator it;
+  for (it = items.begin(); it != items.end(); it++)
+    {
+    QObject::connect(it.value(), SIGNAL(changed()), this, SLOT(onItemChanged()));
+    }
+}
+
+//-----------------------------------------------------------------------------
+pqMEDReaderTimesFlagsWidget::~pqMEDReaderTimesFlagsWidget()
+{
+  delete this->TimesVectWidget;
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimesFlagsWidget::onItemChanged() const
+{
+  emit timeStepsChanged();
+}
+
+//-----------------------------------------------------------------------------
+QList< QList< QVariant> > pqMEDReaderTimesFlagsWidget::getTimeSteps() const
+{
+  // Put together a TimeStep list, using ItemMap
+  QList< QList< QVariant> > ret;
+  QList< QVariant > timeStep;
+  const QMap<QString, VectBoolItem*>& items(this->TimesVectWidget->getItems());
+  QMap<QString, VectBoolItem*>::const_iterator it;
+  for (it = items.begin(); it != items.end(); it++)
+    {
+    timeStep.clear();
+    timeStep.append(it.key());
+    timeStep.append(it.value()->isActivated());
+    ret.append(timeStep);
+    }
+  return ret;
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimesFlagsWidget::setTimeSteps(QList< QList< QVariant> > timeSteps)
+{
+  // Update each item checkboxes, using timeSteps names and ItemMap
+  const QMap<QString, VectBoolItem *>& items(this->TimesVectWidget->getItems());
+  QMap<QString, VectBoolItem*>::const_iterator it;
+  foreach (QList< QVariant> timeStep, timeSteps)
+    {
+    it = items.find(timeStep[0].toString());
+    if (it == items.end())
+      {
+      qDebug("Found an unknow TimeStep in pqMEDReaderTimesFlagsWidget::setTimeSteps, ignoring");
+      continue;
+      }
+    it.value()->activated(timeStep[1].toBool());
+    }
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimesFlagsWidget::setTimeStepsDomain(QList< QList< QVariant> > timeSteps)
+{
+  cout<<"TimeStepsDomai"<<endl;
+  // Block signals so the reloading does not trigger
+  // UncheckPropertyModified event
+  this->blockSignals(true);
+
+  // Load the tree widget
+  this->CreateTimesVectWidget();
+
+  // Set timeSteps checkboxes
+  this->setTimeSteps(timeSteps);
+
+  // Restore signals
+  this->blockSignals(false);
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimesFlagsWidget::CreateTimesVectWidget()
+{
+  // Recover Graph
+  vtkPVMetaDataInformation *info(vtkPVMetaDataInformation::New());
+  this->proxy()->GatherInformation(info);
+  vtkGraph* graph = vtkGraph::SafeDownCast(info->GetInformationData());
+
+  // Delete the widget
+  if (this->TimesVectWidget != NULL)
+    {
+    delete this->TimesVectWidget;
+    }
+
+  // (Re)cretate widget
+  this->TimesVectWidget = new VectBoolWidget(this,
+    pqMedReaderGraphUtils::getMaxNumberOfTS(graph));
+  this->TimesVectLayout->addWidget(this->TimesVectWidget);
+}
+
+//-----------------------------------------------------------------------------
+void pqMEDReaderTimesFlagsWidget::UpdateTimeSteps()
+{
+  // Recover property
+  vtkSMStringVectorProperty* prop = this->proxy()?
+    vtkSMStringVectorProperty::SafeDownCast(this->proxy()->GetProperty("FieldsStatus")) : NULL;
+  vtkIdType tsId = -1;
+  if (prop)
+    {
+    // Searching first activated leaf id
+    for (int i = 1; i < prop->GetNumberOfElements(); i += 2)
+      {
+      if (prop->GetElement(i)[0] == '1')
+        {
+        const char* leafString = prop->GetElement(i - 1);
+        const char* tmp = strchr(leafString, '/');
+        size_t num = tmp - leafString;
+        char dest[num];
+        strncpy(dest, leafString, num);
+        dest[num] = '\0';
+        tsId = strtol(dest + 2, NULL, 10);
+        break;
+        }
+      }
+    }
+
+  if (tsId != -1 && tsId != this->CachedTsId)
+    {
+    // Recovering graph
+    this->CachedTsId = tsId;
+    vtkPVMetaDataInformation *info(vtkPVMetaDataInformation::New());
+    this->proxy()->GatherInformation(info);
+    vtkGraph* g = vtkGraph::SafeDownCast(info->GetInformationData());
+
+    // Updating times steps using leaf id
+    QStringList dts, its, tts;
+    pqMedReaderGraphUtils::getCurrentTS(g, tsId, dts, its, tts);
+    this->TimesVectWidget->setItems(dts, its, tts);
+    }
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderTimesFlagsWidget.h
new file mode 100644 (file)
index 0000000..e6fb06e
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqMEDReaderTimesFlagsWidget_h
+#define __pqMEDReaderTimesFlagsWidget_h
+
+#include "pqPropertyWidget.h"
+
+class VectBoolWidget;
+class QGridLayout;
+
+class pqMEDReaderTimesFlagsWidget : public pqPropertyWidget
+{
+  
+  typedef pqPropertyWidget Superclass;
+  Q_OBJECT
+  // Description
+  // Property Qt used to set/get the times steps with the property link
+  Q_PROPERTY(QList< QList< QVariant> > timeSteps READ getTimeSteps WRITE setTimeSteps)
+  // Description
+  // Property Qt used to set the gorup time steps  domain with the property link
+  Q_PROPERTY(QList< QList< QVariant> > timeStepsDomain READ getTimeSteps WRITE setTimeStepsDomain)
+public:
+  pqMEDReaderTimesFlagsWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqMEDReaderTimesFlagsWidget();
+
+signals:
+  // Description
+  // Signal emited when selected field changed
+  void timeStepsChanged() const;
+
+protected slots:
+  // Description
+  // Slot called when item is changed
+  virtual void onItemChanged() const;
+
+protected slots:
+  // Description
+  // bidrectionnal property link setter/getter
+  virtual QList< QList< QVariant> > getTimeSteps() const;
+  virtual void setTimeSteps(QList< QList< QVariant> > timeSteps);
+
+  // Description
+  // Update the domain, eg: reload
+  virtual void setTimeStepsDomain(QList< QList< QVariant> > timeSteps);
+
+
+  // Description
+  // Called when field status changed and reload the time steps
+  void UpdateTimeSteps();
+
+  // Description
+  // Called to create the vect widget, on creation or for a reload
+  void CreateTimesVectWidget();
+
+protected:
+  // Description
+  // The Vect time widget
+  VectBoolWidget* TimesVectWidget;
+
+  // Description
+  // The grid layout contian the vect times widget
+  QGridLayout* TimesVectLayout;
+
+  // Description
+  // Id of current time step, for caching purpose
+  vtkIdType CachedTsId;
+
+private:
+  Q_DISABLE_COPY(pqMEDReaderTimesFlagsWidget);
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.cxx b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.cxx
new file mode 100644 (file)
index 0000000..f7bf0e2
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "pqMEDReaderVectorsWidget.h"
+#include "ui_MEDReaderVectorsWidget.h"
+
+//-----------------------------------------------------------------------------
+// Internals
+class pqMEDReaderVectorsWidget::pqInternals : public Ui::MEDReaderVectorsWidget
+{
+public:
+  pqInternals(pqMEDReaderVectorsWidget* self)
+    {
+    this->setupUi(self);
+    }
+};
+
+//-----------------------------------------------------------------------------
+pqMEDReaderVectorsWidget::pqMEDReaderVectorsWidget(
+  vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
+: Superclass(smproxy, parentObject), Internals(new pqMEDReaderVectorsWidget::pqInternals(this))
+{
+  this->setShowLabel(false);
+  this->addPropertyLink(this->Internals->GenerateVects, "checked" ,
+                        SIGNAL(toggled(bool)), smproperty);
+}
+
+//-----------------------------------------------------------------------------
+pqMEDReaderVectorsWidget::~pqMEDReaderVectorsWidget()
+{
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.h b/src/Plugins/MEDReader/ParaViewPlugin/pqMEDReaderVectorsWidget.h
new file mode 100644 (file)
index 0000000..834274b
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __pqMEDReaderVectorsWidget_h
+#define __pqMEDReaderVectorsWidget_h
+
+#include "pqPropertyWidget.h"
+
+class pqMEDReaderVectorsWidget : public pqPropertyWidget
+{
+  Q_OBJECT
+  typedef pqPropertyWidget Superclass;
+public:
+  pqMEDReaderVectorsWidget(
+    vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject = 0);
+  virtual ~pqMEDReaderVectorsWidget();
+
+private:
+  Q_DISABLE_COPY(pqMEDReaderVectorsWidget);
+
+  class pqInternals;
+  pqInternals* Internals;
+};
+
+#endif
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.cxx b/src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.cxx
new file mode 100644 (file)
index 0000000..a498d68
--- /dev/null
@@ -0,0 +1,138 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#include "vtkPVMetaDataInformation.h"
+
+#include "vtkAlgorithm.h"
+#include "vtkAlgorithmOutput.h"
+#include "vtkClientServerStream.h"
+#include "vtkExecutive.h"
+#include "vtkDataObject.h"
+#include "vtkGenericDataObjectReader.h"
+#include "vtkGenericDataObjectWriter.h"
+#include "vtkInformationDataObjectMetaDataKey.h"
+#include "vtkInformation.h"
+#include "vtkObjectFactory.h"
+
+#include "vtkMEDReader.h"
+
+vtkStandardNewMacro(vtkPVMetaDataInformation);
+vtkCxxSetObjectMacro(vtkPVMetaDataInformation, InformationData, vtkDataObject);
+
+//----------------------------------------------------------------------------
+vtkPVMetaDataInformation::vtkPVMetaDataInformation()
+{
+  this->InformationData = NULL;
+}
+
+//----------------------------------------------------------------------------
+vtkPVMetaDataInformation::~vtkPVMetaDataInformation()
+{
+  this->SetInformationData(NULL);
+}
+
+//----------------------------------------------------------------------------
+void vtkPVMetaDataInformation::CopyFromObject(vtkObject* obj)
+{
+  this->SetInformationData(NULL);
+
+  vtkAlgorithmOutput* algOutput = vtkAlgorithmOutput::SafeDownCast(obj);
+  if (!algOutput)
+    {
+    vtkAlgorithm* alg = vtkAlgorithm::SafeDownCast(obj);
+    if (alg)
+      {
+      algOutput = alg->GetOutputPort(0);
+      }
+
+    }
+  if (!algOutput)
+    {
+    vtkErrorMacro("Information can only be gathered from a vtkAlgorithmOutput.");
+    return;
+    }
+
+  vtkAlgorithm* reader = algOutput->GetProducer();
+  vtkInformation* info = reader->GetExecutive()->GetOutputInformation(
+    algOutput->GetIndex());
+
+  if (info && info->Has(vtkMEDReader::META_DATA()))
+    {
+    this->SetInformationData(vtkDataObject::SafeDownCast(info->Get(vtkMEDReader::META_DATA())));
+    }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVMetaDataInformation::CopyToStream(vtkClientServerStream* css)
+{
+  css->Reset();
+  if (!this->InformationData)
+    {
+    *css << vtkClientServerStream::Reply
+         << vtkClientServerStream::InsertArray(
+           static_cast<unsigned char*>(NULL), 0)
+         << vtkClientServerStream::End;
+    return;
+    }
+
+  vtkDataObject* clone = this->InformationData->NewInstance();
+  clone->ShallowCopy(this->InformationData);
+
+  vtkGenericDataObjectWriter* writer = vtkGenericDataObjectWriter::New();
+  writer->SetFileTypeToBinary();
+  writer->WriteToOutputStringOn();
+  writer->SetInputData(clone);
+  writer->Write();
+
+  *css << vtkClientServerStream::Reply
+       << vtkClientServerStream::InsertArray(
+         writer->GetBinaryOutputString(),
+         writer->GetOutputStringLength())
+       << vtkClientServerStream::End;
+  writer->RemoveAllInputs();
+  writer->Delete();
+  clone->Delete();
+}
+
+//----------------------------------------------------------------------------
+void vtkPVMetaDataInformation::CopyFromStream(const vtkClientServerStream* css)
+{
+  this->SetInformationData(0);
+  vtkTypeUInt32 length;
+  if (css->GetArgumentLength(0, 0, &length) && length > 0)
+    {
+    unsigned char* raw_data = new unsigned char[length];
+    css->GetArgument(0, 0, raw_data, length);
+    vtkGenericDataObjectReader* reader = vtkGenericDataObjectReader::New();
+    reader->SetBinaryInputString(reinterpret_cast<const char*>(raw_data), length);
+    reader->ReadFromInputStringOn();
+    delete []raw_data;
+    reader->Update();
+    this->SetInformationData(reader->GetOutput());
+    reader->Delete();
+    }
+}
+
+//----------------------------------------------------------------------------
+void vtkPVMetaDataInformation::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os, indent);
+  os << indent << "InformationData: " <<  this->InformationData << endl;
+}
diff --git a/src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.h b/src/Plugins/MEDReader/ParaViewPlugin/vtkPVMetaDataInformation.h
new file mode 100644 (file)
index 0000000..879d11e
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D
+//
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay
+
+#ifndef __vtkPVMetaDataInformation_h
+#define __vtkPVMetaDataInformation_h
+
+#include "vtkPVInformation.h"
+
+class vtkDataObject;
+class vtkInformationDataObjectKey;
+
+class vtkPVMetaDataInformation : public vtkPVInformation
+{
+public:
+  static vtkPVMetaDataInformation* New();
+  vtkTypeMacro(vtkPVMetaDataInformation, vtkPVInformation);
+  void PrintSelf(ostream& os, vtkIndent indent);
+
+  // Description:
+  // Transfer information about a single object into this object.
+  virtual void CopyFromObject(vtkObject*);
+
+  //BTX
+  // Description:
+  // Manage a serialized version of the information.
+  virtual void CopyToStream(vtkClientServerStream*);
+  virtual void CopyFromStream(const vtkClientServerStream*);
+  //ETX
+
+  // Description:
+  // Returns the Information Data.
+  vtkGetObjectMacro(InformationData, vtkDataObject);
+
+//BTX
+protected:
+  vtkPVMetaDataInformation();
+  ~vtkPVMetaDataInformation();
+  void SetInformationData(vtkDataObject*);
+  vtkDataObject* InformationData;
+
+private:
+  vtkPVMetaDataInformation(const vtkPVMetaDataInformation&); // Not implemented
+  void operator=(const vtkPVMetaDataInformation&); // Not implemented
+//ETX
+};
+
+#endif
index 05bb227b3f6ffa5cf7c5634c1ad3c84f69e62209..9b1e06d97ecb202ecf5256f01485b6c4b8075f76 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
-
 SET(TEST_NUMBERS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
 
+SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDReader)
+
+IF(KW_TESTING_PLATFORM)
+
 FOREACH(tfile ${TEST_NUMBERS})
-  ADD_TEST(testMEDReader${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py)
-  SET_TESTS_PROPERTIES(testMEDReader${tfile} PROPERTIES ENVIRONMENT "${tests_env}")
+  INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py
+          DESTINATION ${TEST_INSTALL_DIRECTORY})
 ENDFOREACH()
 
+  INSTALL(FILES CTestTestfileInstall.cmake
+        DESTINATION ${TEST_INSTALL_DIRECTORY}
+        RENAME CTestTestfile.cmake)
+
+cmake_minimum_required(VERSION 2.7)
+
+find_package(ParaView REQUIRED)
+include(${PARAVIEW_USE_FILE})
+
+include(ParaViewTestingMacros)
+include(FindPythonModules)
+
+include(${PROJECT_SOURCE_DIR}/testing/testFunctions.cmake)
+set(PV_PLUGIN_PATH "${CMAKE_BINARY_DIR}/lib/")
+
+include(CTest)
+
+enable_testing()
+
+set(PARAVIEW_BIN_DIR "${ParaView_DIR}/bin" CACHE PATH "ParaView binary path")
+
+set(PVTEST_DRIVER "${PARAVIEW_BIN_DIR}/smTestDriver")
+set(PARAVIEW_CLIENT "${PARAVIEW_BIN_DIR}/paraview")
+set(PARAVIEW_SERVER "${PARAVIEW_BIN_DIR}/pvserver")
+set(PVPYTHON "${PARAVIEW_BIN_DIR}/pvpython")
+
+set(BASELINES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Baselines")
+set(PYTHON_SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(TEMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary")
+
 # Application tests
 SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDReader)
 
-FOREACH(tfile ${TEST_NUMBERS})
-  INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py
+if(NOT EXISTS ${TEMP_DIR})
+  file(MAKE_DIRECTORY ${TEMP_DIR})
+endif()
+
+# Override vtk_add_test_* variables for use with ParaView.
+macro (_myy_override_vtk_dirs)
+  set(VTK_TEST_DATA_DIR    ${PYTHON_SCRIPTS_DIR})
+  set(VTK_BASELINE_DIR     ${BASELINES_DIR})
+  set(VTK_TEST_OUTPUT_DIR  ${TEMP_DIR})
+  set(VTK_TEST_DATA_TARGET ParaViewData)
+endmacro ()
+
+function (myy_add_python_test)
+  message(STATUS "Add Python test for ${ARGV2}")
+  set(VTK_PYTHON_EXE "${PVPYTHON}")
+  list(APPEND VTK_PYTHON_ARGS -dr
+    ${PARAVIEW_PYTHON_ARGS})
+  _myy_override_vtk_dirs()
+  myvtk_add_test_python(${ARGN})
+endfunction ()
+
+# Test all python scripts
+file(GLOB scripts "${PYTHON_SCRIPTS_DIR}/*py")
+foreach(file ${scripts})
+  get_filename_component(fname ${file} NAME)
+  myy_add_python_test(
+    NO_DATA NO_RT
+    ${fname})
+  INSTALL(FILES ${file}
           DESTINATION ${TEST_INSTALL_DIRECTORY})
+endforeach()
+
+ELSE(KW_TESTING_PLATFORM)
+
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+
+FOREACH(tfile ${TEST_NUMBERS})
+  ADD_TEST(testMEDReader${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py -B ${CMAKE_CURRENT_SOURCE_DIR}/Baselines )
+  SET_TESTS_PROPERTIES(testMEDReader${tfile} PROPERTIES ENVIRONMENT ${tests_env})
 ENDFOREACH()
 
+ENDIF(KW_TESTING_PLATFORM)
+
 INSTALL(FILES CTestTestfileInstall.cmake
         DESTINATION ${TEST_INSTALL_DIRECTORY}
         RENAME CTestTestfile.cmake)
index 588e3429dd2e9d6aa7bdd7a5a79835f212ffa48e..293b2ae45441b5992582ac57e4761fd972029e8a 100644 (file)
@@ -25,7 +25,7 @@ SET(TEST_NUMBERS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
 
 FOREACH(tfile ${TEST_NUMBERS})
   SET(TEST_NAME MEDREADER_${tfile})
-  #ADD_TEST(${TEST_NAME} python testMEDReader${tfile}.py)
-  ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} testMEDReader${tfile}.py)
+  ADD_TEST(${TEST_NAME} python testMEDReader${tfile}.py)
+  #ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} testMEDReader${tfile}.py)
   SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
 ENDFOREACH()
index 8c1142af60ff3c8a233c69fa4b12c149a3f727e9..371de599b5c7eaa318a89ef63c298f8ac80817ff 100644 (file)
@@ -20,7 +20,6 @@
 # Author : Anthony Geay
 
 from MEDLoader import *
-
 fname="testMEDReader0.med"
 outImgName="testMEDReader0.png"
 #########
@@ -87,10 +86,8 @@ arr_name_with_dis=[elt.split("/")[-1] for elt in keys]
 arr_name=[elt.split(myMedReader.GetProperty("Separator").GetData())[0] for elt in arr_name_with_dis]
 myMedReader.AllArrays=keys
 RenderView1 = GetRenderView()
-ELNOMesh1=ELNOMesh()
-ELNOMesh1.Input=myMedReader
-ExtractGroup1=ExtractGroup()
-ExtractGroup1.Input=ELNOMesh1
+ELNOMesh1=ELNOMesh(Input=myMedReader)
+ExtractGroup1=ExtractGroup(Input=ELNOMesh1)
 ExtractGroup1.UpdatePipelineInformation()
 ExtractGroup1.AllGroups=['GRP_ba2','GRP_to1','GRP_web']
 assert(isinstance(ExtractGroup1.GetProperty("MeshName")[0],str))
@@ -108,8 +105,7 @@ DataRepresentation3.ColorArrayName = 'SolutionSIEQ_ELNO'
 DataRepresentation3.LookupTable = a2_SolutionSIEQ_ELNO_PVLookupTable
 DataRepresentation3.Visibility = 1
 #
-GaussPoints1=GaussPoints()
-GaussPoints1.Input=ELNOMesh1
+GaussPoints1=GaussPoints(Input=ELNOMesh1)
 GaussPoints1.SelectSourceArray=['CELLS','ELGA@0']
 DataRepresentation4 = Show()
 DataRepresentation4.ScaleFactor = 0.008999999705702066
@@ -122,5 +118,20 @@ RenderView1.CameraPosition = [0.11797550069274401, 0.20119836056342144, 0.208854
 RenderView1.CameraClippingRange = [0.14700465306315827, 0.40712447273162633]
 RenderView1.CameraFocalPoint = [1.0170565790969026e-18, 0.0599999981932342, 0.022500000894069675]
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
 
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader0.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index 970f67db142693c3240d674120deab1ad002b267..35eb88c631c9766e477f091bb2ca283969ef73a9 100644 (file)
@@ -22,7 +22,7 @@
 from MEDLoader import *
 
 """
-This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field 
+This test focused on ELNO. Here a 2 QUAD4 cells and a single ELNO field
 is defined.
 """
 fname="testMEDReader1.med"
index 0507071b799ecb35f7b08a01c06b14000a862cc6..e1e96a6ecf10edfa0d87802ded6f19d2ff21d450 100644 (file)
@@ -109,4 +109,20 @@ RenderView1.CameraClippingRange = [4.164482329590951, 9.24583527085017]
 RenderView1.CameraFocalPoint = [1.4999999999999996, 0.49999999999999944, 0.4999999999999996]
 #
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader10.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index c223bb13c8065be26918a110f2d2e9e6fd489c55..944abb26c9053e6a10b31a8eb17b90ad8fe4f239 100644 (file)
@@ -192,6 +192,21 @@ RenderView1.CameraClippingRange = [2.404636927989219, 7.163736971217594]
 RenderView1.CameraFocalPoint = [2.4191999999999996, 2.4191999999999996, 4.32745]
 RenderView1.ViewTime = 2.0
 
-Render()
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader11.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index ec76ed3ae0770a2a043051ff73ee25bd161d8937..d41de3ae44191cdeb37d1ac6f651c849a9fc147e 100644 (file)
@@ -89,6 +89,21 @@ DataRepresentation2.ScalarOpacityFunction = a1_POROSITE_PiecewiseFunction
 DataRepresentation2.ColorArrayName = ('CELLS', 'POROSITE')
 DataRepresentation2.LookupTable = a1_POROSITE_PVLookupTable
 
-Render()
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader12.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index c94b92d16d7958df1794f9c4b2ffdc440d5a6861..362be950a33d1fd7aa6dcb7a0c4778361fd7a312 100644 (file)
@@ -74,6 +74,21 @@ a3_fieldELNO_Vector_PVLookupTable = GetLookupTableForArray( "fieldELNO_Vector",
 
 a3_fieldELNO_Vector_PiecewiseFunction = CreatePiecewiseFunction( Points=[0.3464101615137755, 0.0, 0.5, 0.0, 1.9052558883257653, 1.0, 0.5, 0.0] )
 
-Render()
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader13.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index 38f9646b3034a7d47d3d1b4d012c51449cadbf64..cbd947d01898b9238e6f952795fd54d58dae6874 100644 (file)
@@ -154,6 +154,23 @@ renderView1.InteractionMode = '2D'
 renderView1.CameraPosition = [3.0, 2.0, 10000.0]
 renderView1.CameraFocalPoint = [3.0, 2.0, 0.0]
 renderView1.ViewSize =[300,300]
+renderView1.GetRenderWindow().DoubleBufferOff()
 #
+
 Render()
-WriteImage(outImgName)
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader14.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(renderView1.GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index 3adc65ea56411fcc48bc41d0a12b062be3bbc4d1..0f8ece6318d4a0327ba749ac729002670fd112cd 100644 (file)
@@ -48,7 +48,6 @@ reader=MEDReader(FileName=fname)
 ExpectedEntries=['TS0/zeName/ComSup0/zeName@@][@@P1','TS0/zeName/ComSup0/MESH@zeName@@][@@P1']
 assert(reader.GetProperty("FieldsTreeInfo")[::2]==ExpectedEntries)
 
-
 #
 glyph1=Glyph(Input=reader,GlyphType='Arrow',Scalars='FamilyIdNode',Vectors='zeName',GlyphMode='All Points',ScaleFactor=0.1,GlyphTransform='Transform2')
 
@@ -62,13 +61,6 @@ zeNameLUT.VectorMode = 'Component'
 glyph1Display=Show(glyph1,renderView1)
 glyph1Display.ColorArrayName = ['POINTS', 'FamilyIdNode']
 glyph1Display.LookupTable = zeNameLUT
-glyph1Display.OpacityArray = [None, '']
-glyph1Display.RadiusArray = [None, '']
-glyph1Display.RadiusRange = [-0.0707106813788414, 1.0099999904632568]
-glyph1Display.ConstantRadius = 1.0099999904632568
-glyph1Display.PointSpriteDefaultsInitialized = 1
-glyph1Display.SelectInputVectors = ['POINTS', 'GlyphVector']
-glyph1Display.WriteLog = ''
 # show color bar/color legend
 glyph1Display.SetScalarBarVisibility(renderView1, True)
 # set scalar coloring
@@ -78,5 +70,22 @@ glyph1Display.RescaleTransferFunctionToDataRange(True)
 # show color bar/color legend
 glyph1Display.SetScalarBarVisibility(renderView1, True)
 #
+renderView1.ViewSize =[300,300]
+renderView1.GetRenderWindow().DoubleBufferOff()
 Render()
-WriteImage(outImgName)
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader15.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index e33e495471acfbbff92f79fd1be038f3da8972ab..78d8f819d27e9f2bf5d79378bb1eb6a0bab3a496 100644 (file)
@@ -57,16 +57,13 @@ f1ts.write(fname,0)
 
 from paraview.simple import *
 
-
-
 testMEDReader1=MEDReader(FileName=fname)
 testMEDReader1.AllArrays=['TS0/mesh/ComSup0/ACellField@@][@@P0']
 testMEDReader2=MEDReader(FileName=fname)
 testMEDReader2.AllArrays=['TS0/mesh/ComSup1/mesh@@][@@P0']
 GroupDatasets1=GroupDatasets(Input=[testMEDReader1,testMEDReader2])
 
-Clip1 = Clip(ClipType="Plane")
-Clip1.Input=GroupDatasets1
+Clip1 = Clip(ClipType="Plane",Input=GroupDatasets1)
 Clip1.Scalars=['FamilyIdCell']
 Clip1.ClipType.Origin=[3.0, 3.0, 3.0]
 Clip1.InsideOut=1
@@ -82,9 +79,8 @@ DataRepresentation4.ScaleFactor = 0.6000000000000001
 DataRepresentation4.Visibility = 1
 DataRepresentation4.Representation = 'Wireframe'
 
-ExtractBlock1 = ExtractBlock()
+ExtractBlock1 = ExtractBlock(Input=Clip1)
 ExtractBlock1.BlockIndices=[1, 2]
-ExtractBlock1.Input=Clip1
 
 DataRepresentation5 = Show()
 DataRepresentation5.EdgeColor = [0.0, 0.0, 0.5000076295109483]
@@ -105,6 +101,22 @@ RenderView1.CameraClippingRange = [0.026023957813772633, 26.023957813772633]
 RenderView1.CameraFocalPoint = [2.9999999999999996, 2.9999999999999987, 2.9999999999999982]
 
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
-
-
+Render()
+
+#WriteImage(outImgName)
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader2.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index 014d1976d494095335bcd3a63a1e434d0936d4c9..be1515d8fb0b9bba4ea4f381d791a3a334cbce45 100644 (file)
@@ -115,7 +115,30 @@ a1_ANodeField_PVLookupTable.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunctio
 DataRepresentation2.ScalarOpacityFunction=a1_ANodeField_PiecewiseFunction
 DataRepresentation2.ColorArrayName='ANodeField'
 DataRepresentation2.LookupTable=a1_ANodeField_PVLookupTable
-###
-WriteImage(outImgName)
 
+# Triangulate so rendring always the same with different gpu or graphic backend.
+extSurf = ExtractSurface(Input=testMEDReader3)
+triangulate = Triangulate(Input=extSurf)
+Hide(testMEDReader3, RenderView1)
+Show(triangulate, RenderView1)
+triangulate1Display = GetDisplayProperties(triangulate, view=RenderView1)
+ColorBy(triangulate1Display, ('POINTS', 'ANodeField'))
+
+Render()
+###
 
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader3.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index f943e4705efb524382e7171ef143a1557a5e6f55..4b0541ed617458c7e75a4f9443ecfa647d1454bf 100644 (file)
@@ -92,4 +92,20 @@ RenderView1.CameraFocalPoint = [0.8087292125440382, 1.3325993334207897, 0.0]
 RenderView1.CameraParallelScale = 3.712804729456109
 
 RenderView1.ViewSize =[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader4.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index b27349bc654447ebaa3b2028ab1f31dc94b58953..71b61df75d229e97daa5b9ec2479d972437e6c3a 100644 (file)
@@ -78,8 +78,7 @@ myMedReader=MEDReader(FileName=fname)
 myMedReader.AllArrays = ['TS0/mesh/ComSup1/fNode@@][@@P1']
 myMedReader.AllTimeSteps = ['0000']
 
-Clip1=Clip(ClipType="Plane")
-Clip1.Input=myMedReader
+Clip1=Clip(ClipType="Plane",Input=myMedReader)
 Clip1.Scalars = ['POINTS', 'FamilyIdNode']
 Clip1.ClipType.Origin = [2.0, 2.0, 2.0]
 Clip1.ClipType = "Plane"
@@ -109,6 +108,21 @@ DataRepresentation2.ScaleFactor = 0.4
 DataRepresentation2.ColorArrayName=('POINTS','fNode')
 DataRepresentation2.LookupTable=LookupTable
 
-
 RenderView1.ViewSize=[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader5.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index acdb1f56474b3a69da2935c7288e90256ee959d3..1a76bfe93c36bbd6cd41dbba95b75e4de5deb7d8 100644 (file)
@@ -93,7 +93,21 @@ DataRepresentation4.ColorArrayName = 'fGauss'
 DataRepresentation4.LookupTable = a1_fGauss_PVLookupTable
 a1_fGauss_PVLookupTable.ScalarOpacityFunction = a1_fGauss_PiecewiseFunction
 
-
 RenderView1.ViewSize=[300,300]
-WriteImage(outImgName)
+Render()
 
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader6.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index e79dffc471a0017a07f5e68112c34174a2caa10d..dbbf2bafcbf89245e2f8cb00db529b3f09760f5f 100644 (file)
@@ -66,7 +66,6 @@ fmts.write(fname,0)
 ################### MED write is done -> Go to MEDReader
 from paraview.simple import *
 
-
 myMedReader=MEDReader(FileName=fname)
 myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1']
 assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.])
@@ -95,4 +94,20 @@ RenderView1.ViewTime = 1.0 #### Important # red is in right bottom
 RenderView1.CacheKey = 1.0
 RenderView1.UseCache = 1
 RenderView1.ViewSize=[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader7.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index 048f50becee1aa3670fd63b9d926cc44fce6a018..58d263a7351b22dd817dffbbe97b041f330dcf52 100644 (file)
@@ -70,14 +70,12 @@ myMedReader.AllArrays = ['TS0/mesh/ComSup0/fNode@@][@@P1']
 assert(list(myMedReader.TimestepValues)==[0.,1.,2.,3.])
 myMedReader.UpdatePipeline()
 
-extractCT=ExtractCellType()
-extractCT.Input=myMedReader
+extractCT=ExtractCellType(Input=myMedReader)
 extractCT.UpdatePipelineInformation()
 assert(list(extractCT.GetProperty("GeoTypesInfo"))==['TRI3','0','QUAD4','0'])
 extractCT.AllGeoTypes=['TRI3']
 
-extGrp=ExtractGroup()
-extGrp.Input=extractCT
+extGrp=ExtractGroup(Input=extractCT)
 extGrp.UpdatePipelineInformation()
 assert(filter(lambda x:x[:4]=="GRP_",list(extGrp.GetProperty("GroupsFlagsInfo")[::2]))==['GRP_grp0'])
 extGrp.AllGroups="GRP_grp0"
@@ -106,4 +104,20 @@ RenderView1.ViewTime = 1.0 #### Important # red is in right bottom
 RenderView1.CacheKey = 1.0
 RenderView1.UseCache = 1
 RenderView1.ViewSize=[300,300]
-WriteImage(outImgName)
+Render()
+
+# compare with baseline image
+import os
+import sys
+try:
+  baselineIndex = sys.argv.index('-B')+1
+  baselinePath = sys.argv[baselineIndex]
+except:
+  print "Could not get baseline directory. Test failed."
+  exit(1)
+baseline_file = os.path.join(baselinePath, "testMEDReader8.png")
+import vtk.test.Testing
+vtk.test.Testing.VTK_TEMP_DIR = vtk.util.misc.vtkGetTempDir()
+vtk.test.Testing.compareImage(GetActiveView().GetRenderWindow(), baseline_file,
+                                                            threshold=25)
+vtk.test.Testing.interact()
index b8a65b9e5641c65933dbc5fa379decf42529dbca..62906d3100796d4e1c25df45db452972ee6e2125 100644 (file)
@@ -35,9 +35,9 @@
 #include "vtkObjectFactory.h"
 #include "vtkInformation.h"
 //
-#include "vtksys/stl/string"
-#include "vtksys/ios/fstream"
-#include "vtksys/stl/algorithm"
+#include "string"
+#include "fstream"
+#include "algorithm"
 
 #include "VTKMEDCouplingMeshClient.hxx"
 #include "VTKMEDCouplingFieldClient.hxx"
@@ -85,7 +85,7 @@ void vtkParaMEDCorbaSource::SetIORCorba(char *ior)
     return;
   int length=strlen(ior);
   IOR.resize(length+1);
-  vtksys_stl::copy(ior,ior+length+1,&IOR[0]);
+  std::copy(ior,ior+length+1,&IOR[0]);
   this->Modified();
 }
 
index d4f07887318b442ccaec3e5ad0429b9d7a483edb..feb5d39e44e1d1f3719f6cc593e9ad33c447ad34 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "ParaMEDMEM2VTK_defines.hxx"
 #include "vtkUnstructuredGridAlgorithm.h"
-#include <vtksys/stl/vector>
+#include <vector>
 
 class vtkDoubleArray;
 class vtkUnstructuredGrid;
@@ -60,7 +60,7 @@ protected:
   int EndPiece;
   int BufferingPolicy;
   vtkUnstructuredGrid *MyDataSet;
-  vtksys_stl::vector<char> IOR;
+  std::vector<char> IOR;
   ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher *mfieldsFetcher;
   //not clean but to avoid to include CORBA.h in this *.h
   static void *Orb;
index a1a77cc786f87bdce7c995397d0c242a26e3fbfc..eea2c6e591a30fd9ab6e9d3624cd8c9cb4f89047 100644 (file)
@@ -71,6 +71,6 @@ ADD_EXECUTABLE(paraLight
     ${pl_FORMS_HEADERS}
     ${rcs_sources})
     
-TARGET_LINK_LIBRARIES(paraLight ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeTypeOpenGL)
+TARGET_LINK_LIBRARIES(paraLight ${QT_LIBRARIES} pqApplicationComponents )#vtkRenderingFreeTypeOpenGL)
 #INSTALL(TARGET paraLight bin)