]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Minor: replacing annoying tabulations with whitespaces ...
authorbruneton <bruneton>
Wed, 4 Sep 2013 07:28:39 +0000 (07:28 +0000)
committerbruneton <bruneton>
Wed, 4 Sep 2013 07:28:39 +0000 (07:28 +0000)
18 files changed:
CMakeLists.txt
src/Plugins/MedReader/IO/vtkMedDriver.cxx
src/Plugins/MedReader/IO/vtkMedFamilyOnEntityOnProfile.cxx
src/Plugins/MedReader/IO/vtkMedReader.cxx
src/Plugins/NavigationMode/pqSetModeStarter.cxx
src/Plugins/ParaMEDCorba/VTKMEDCouplingMultiFieldsClient.cxx
src/Plugins/ParaMEDCorba/vtkParaMEDCorbaSource.cxx
src/Plugins/ParaMEDCorba/vtkParaMEDCorbaSource.h
src/Plugins/TableReader/ParaViewPlugin/pqCustomChartDisplayPanelImplementation.cxx
src/Plugins/TableReader/ParaViewPlugin/pqCustomPlotSettingsModel.cxx
src/Plugins/TableReader/ParaViewPlugin/pqCustomXYChartDisplayPanel.cxx
src/Plugins/TableReader/ParaViewPlugin/pqTableReaderPanel.cxx
src/Plugins/TableReader/ParaViewPlugin/pqTableTo3DPanel.cxx
src/Plugins/TableReader/Reader/TableParser.cxx
src/Plugins/TableReader/Reader/TableParser.h
src/Plugins/TableReader/Reader/vtkVisuTableReader.cxx
src/Plugins/TableReader/TableTo3DFilter/vtkTableTo3D.cxx
src/Plugins/TableReader/TableTo3DFilter/vtkTableTo3D.h

index 34c9699be510f340c2596cbc23f9dbafdfc21c67..906d2579361b0070188df74c1083c59862b69217 100644 (file)
@@ -69,9 +69,6 @@ MARK_AS_ADVANCED(QT_HELP_GENERATOR)
 
 # Specific to ParaVis:
 FIND_PACKAGE(SalomeParaView)
-IF(TARGET vtkTools)
- message("bli !!")
-endif()
 
 # GUI has to be loaded AFTER ParaView: the ParaView config doesn't mix
 # well with the VTK one (and GUI loads VTK):
@@ -106,7 +103,7 @@ FIND_PACKAGE(SalomeMED REQUIRED)
 FIND_PACKAGE(SalomeMEDFile REQUIRED)
 
 # TODO: the below requires ParaView in the PYTHONPATH ... not so nice:
-MESSAGE(STATUS "Generating wrapped class list (??) ...")
+MESSAGE(STATUS "Generating list of wrapped VTK classes ...")
 LIST(GET PARAVIEW_INCLUDE_DIRS 0 PARAVIEW_INCLUDE_DIR0)
 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIR0}
     RESULT_VARIABLE _res)
@@ -153,7 +150,7 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PARAVIS_version.h DESTINATION include/
 OPTION(BUILD_TESTING "Build ParaVis Testing" ON)
 IF(BUILD_TESTING)
    SET(PARAVIS_TEST_DIR ${ParaVis_BINARY_DIR}/Test/Temporary)
-   MAKE_DIRECTORY(${PARAVIS_TEST_DIR})
+   MAKE_DIRECTORY(${PARAVIS_TEST_DIR})  # TODO: replace with FILE(MAKE_DIRECTORY ...)
    ENABLE_TESTING()
    INCLUDE (CTest)
    ADD_SUBDIRECTORY(test)
index 938f4f3cc3712f88fbe7bf3cd1c15c63fde0f9d1..432d836e4013a0bef7b1c7dc59c60fa67ea993da 100644 (file)
@@ -182,7 +182,7 @@ int vtkMedDriver::Open()
 #ifdef MedReader_HAVE_PARALLEL_INFRASTRUCTURE
     // the following code opens the file in parallel
     vtkMultiProcessController* controller =
-               vtkMultiProcessController::GetGlobalController();
+        vtkMultiProcessController::GetGlobalController();
     int lpID = 0;
     if (controller == NULL)
       {
index 6e7db881dd9c13d81fb7a97e35c9a17cacbc42b5..e528f2ce139f8f845ae0a0b72b046b8ab132a619 100644 (file)
@@ -102,7 +102,7 @@ int vtkMedFamilyOnEntityOnProfile::CanMapField(vtkMedFieldOnProfile* fop)
 
   int numProc = 1;
   vtkMultiProcessController* controller =
-                 vtkMultiProcessController::GetGlobalController();
+        vtkMultiProcessController::GetGlobalController();
   if (controller != NULL)
     {
     numProc = controller->GetNumberOfProcesses();
index 1a52df2dacf9ecc2b9b48641f479ba651d80f428..4e45660e928a8b79d9c6d0eab7fc047e067a2e82 100644 (file)
@@ -384,7 +384,7 @@ int vtkMedReader::RequestData(vtkInformation *request,
   else
     {
     vtkMultiProcessController* controller =
-               vtkMultiProcessController::GetGlobalController();
+          vtkMultiProcessController::GetGlobalController();
     if(controller)
       {
       this->Internal->NumberOfPieces=controller->GetNumberOfProcesses();
@@ -403,7 +403,7 @@ int vtkMedReader::RequestData(vtkInformation *request,
     {
     this->Internal->CurrentPieceNumber=0;
     vtkMultiProcessController* controller =
-               vtkMultiProcessController::GetGlobalController();
+            vtkMultiProcessController::GetGlobalController();
     if(controller)
       {
       this->Internal->CurrentPieceNumber= controller->GetLocalProcessId();
@@ -2317,7 +2317,7 @@ void vtkMedReader::SetVTKFieldOnSupport(vtkMedFieldOnProfile* fop,
       {
       if(vtkfield.DataArray->GetNumberOfTuples()!=ds->GetNumberOfPoints())
         {
-         vtkDebugMacro("the data array " << vtkfield.DataArray->GetName()
+          vtkDebugMacro("the data array " << vtkfield.DataArray->GetName()
                       << " do not have the good number of tuples");
         return;
         }
index 7f49003ec3e256bcca88181fcdba21cb28478ad3..19649055f5f100c3ed1a9cfd1c1ce26bff769ee1 100644 (file)
@@ -28,7 +28,7 @@
 
 //-----------------------------------------------------------------------------
 pqSetModeStarter::pqSetModeStarter(QObject* p/*=0*/)
-  : QObject(p)
+: QObject(p)
 {
 }
 
@@ -57,49 +57,49 @@ void pqSetModeStarter::setStandardMode()
 
     // Copy default settings, make changes for Ctrl+MB and MB modes
     for(int i=0; i<9; i++)
-      {
-       manips[i] = default3DManips[i];
-
-       // Ctrl+MB
-       if (manips[i].Shift == 0 && manips[i].Control == 1) {
-         if (manips[i].Mouse == 1)
-           manips[i].Name = QByteArray("Zoom");
-         else  if (manips[i].Mouse == 2)
-           manips[i].Name = QByteArray("Pan");
-         else  if (manips[i].Mouse == 3)
-           manips[i].Name = QByteArray("Rotate");
-       }
-
-       // MB only
-       if (manips[i].Shift == 0 && manips[i].Control == 0) {
-         if (manips[i].Mouse == 1)
-           manips[i].Name = QByteArray("Rotate");
-         else  if (manips[i].Mouse == 2)
-           manips[i].Name = QByteArray("Pan");
-         else  if (manips[i].Mouse == 3)
-           manips[i].Name = QByteArray("Zoom");
-       }
+    {
+      manips[i] = default3DManips[i];
+
+      // Ctrl+MB
+      if (manips[i].Shift == 0 && manips[i].Control == 1) {
+        if (manips[i].Mouse == 1)
+          manips[i].Name = QByteArray("Zoom");
+        else  if (manips[i].Mouse == 2)
+          manips[i].Name = QByteArray("Pan");
+        else  if (manips[i].Mouse == 3)
+          manips[i].Name = QByteArray("Rotate");
+      }
+
+      // MB only
+      if (manips[i].Shift == 0 && manips[i].Control == 0) {
+        if (manips[i].Mouse == 1)
+          manips[i].Name = QByteArray("Rotate");
+        else  if (manips[i].Mouse == 2)
+          manips[i].Name = QByteArray("Pan");
+        else  if (manips[i].Mouse == 3)
+          manips[i].Name = QByteArray("Zoom");
       }
+    }
 
     // Save settings
     for(int i=0; i<9; i++)
-      {
-       strs << QString("Manipulator%1Mouse%2Shift%3Control%4Name%5")
-         .arg(i+1)
-         .arg(manips[i].Mouse)
-         .arg(manips[i].Shift)
-         .arg(manips[i].Control)
-         .arg(QString(manips[i].Name));
-      }
-      
+    {
+      strs << QString("Manipulator%1Mouse%2Shift%3Control%4Name%5")
+        .arg(i+1)
+        .arg(manips[i].Mouse)
+        .arg(manips[i].Shift)
+        .arg(manips[i].Control)
+        .arg(QString(manips[i].Name));
+    }
+
     settings->setValue("InteractorStyle/CameraManipulators", strs);
   }
   settings->endGroup();
 
   // Loop through render views and apply the settings
   QList<pqRenderViewBase*> views =
-    pqApplicationCore::instance()->getServerManagerModel()->
-    findItems<pqRenderViewBase*>();
+      pqApplicationCore::instance()->getServerManagerModel()->
+      findItems<pqRenderViewBase*>();
 
   foreach(pqRenderViewBase* view, views) {
     view->restoreSettings(true);
index 730a51bf636f998038fcb9aa52a688dcc93bc128..499503df3dd3a38f055cbb40945c192cdfa41e34 100644 (file)
@@ -40,7 +40,7 @@
 const double ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::EPS_TIME=1e-7;
 
 ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::MEDCouplingMultiFieldsFetcher(int bufferingPolicy,
-                                                                            SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_ptr mfieldsPtr):_effective_pol(bufferingPolicy),_mfields_ptr_released(false)
+    SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_ptr mfieldsPtr):_effective_pol(bufferingPolicy),_mfields_ptr_released(false)
 {
   _mfields_ptr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_duplicate(mfieldsPtr);
   _mfields_ptr->Register();
@@ -49,15 +49,15 @@ ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::MEDCouplingMultiFieldsFetcher(int
 ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::~MEDCouplingMultiFieldsFetcher()
 {
   for(std::vector<vtkDataSet *>::iterator it=_meshes.begin();it!=_meshes.end();it++)
-    {
-      if(*it)
-       (*it)->Delete();
-    }
+  {
+    if(*it)
+      (*it)->Delete();
+  }
   for(std::vector<vtkDoubleArray *>::iterator it2=_arrays.begin();it2!=_arrays.end();it2++)
-    {
-      if(*it2)
-       (*it2)->Delete();
-    }
+  {
+    if(*it2)
+      (*it2)->Delete();
+  }
   if(!_mfields_ptr_released)
     _mfields_ptr->UnRegister();
 }
@@ -70,36 +70,36 @@ std::vector<double> ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::getTimeStepsF
   _time_label_per_field.resize(nbOfFields);
   SALOME_MED::MEDCouplingFieldOverTimeCorbaInterface_var fotPtr=SALOME_MED::MEDCouplingFieldOverTimeCorbaInterface::_narrow(_mfields_ptr);
   if(CORBA::is_nil(fotPtr))
-    {
-      for(CORBA::Long i=0;i<nbOfFields;i++)
-       _time_label_per_field[i]=(double)i;
-    }
+  {
+    for(CORBA::Long i=0;i<nbOfFields;i++)
+      _time_label_per_field[i]=(double)i;
+  }
   else
+  {
+    double tmp=0.;
+    for(CORBA::Long i=0;i<nbOfFields;i++)
     {
-      double tmp=0.;
-      for(CORBA::Long i=0;i<nbOfFields;i++)
-       {
-         if(!_time_def_per_field[i].empty())
-           _time_label_per_field[i]=_time_def_per_field[i].front();
-         else
-           _time_label_per_field[i]=tmp++;
-       }
+      if(!_time_def_per_field[i].empty())
+        _time_label_per_field[i]=_time_def_per_field[i].front();
+      else
+        _time_label_per_field[i]=tmp++;
     }
+  }
   return _time_label_per_field;
 }
 
 void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::fetchRegardingPolicy()
 {
   if(_effective_pol>=10)
-    {
-      fetchAll();
-      return ;
-    }
+  {
+    fetchAll();
+    return ;
+  }
   if(_effective_pol>=1 && _effective_pol<=9)
-    {
-      fetchMeshes();
-      return ;
-    }
+  {
+    fetchMeshes();
+    return ;
+  }
 }
 
 vtkDataSet *ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::buildDataSetOnTime(double time)
@@ -112,34 +112,34 @@ vtkDataSet *ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::buildDataSetOnTime(do
   vtkDataSet *ret0=_meshes[meshId];
   std::string clsName=ret0->GetClassName();
   if(clsName=="vtkUnstructuredGrid")
-    {
-      vtkUnstructuredGrid *ret1=vtkUnstructuredGrid::New();
-      ret1->DeepCopy(ret0);
-      if(_is_meshes_polyhedron[meshId])//bug VTK polyhedron
-        {//bug VTK polyhedron part
-          ret1->Faces->UnRegister(ret1);
-          ret1->Faces=vtkIdTypeArray::New();
-          ret1->Faces->DeepCopy(((vtkUnstructuredGrid *)ret0)->GetFaces());
-          ret1->Faces->Register(ret1);
-          ret1->Faces->Delete();
-          ret1->FaceLocations->UnRegister(ret1);
-          ret1->FaceLocations=vtkIdTypeArray::New();
-          ret1->FaceLocations->DeepCopy(((vtkUnstructuredGrid *)ret0)->GetFaceLocations());
-          ret1->FaceLocations->Register(ret1);
-          ret1->FaceLocations->Delete();
-        }//end bug VTK polyhedron part
-      appendFieldValueOnAlreadyFetchedData(ret1,fieldId);
-      applyBufferingPolicy();
-      return ret1;
-    }
+  {
+    vtkUnstructuredGrid *ret1=vtkUnstructuredGrid::New();
+    ret1->DeepCopy(ret0);
+    if(_is_meshes_polyhedron[meshId])//bug VTK polyhedron
+    {//bug VTK polyhedron part
+      ret1->Faces->UnRegister(ret1);
+      ret1->Faces=vtkIdTypeArray::New();
+      ret1->Faces->DeepCopy(((vtkUnstructuredGrid *)ret0)->GetFaces());
+      ret1->Faces->Register(ret1);
+      ret1->Faces->Delete();
+      ret1->FaceLocations->UnRegister(ret1);
+      ret1->FaceLocations=vtkIdTypeArray::New();
+      ret1->FaceLocations->DeepCopy(((vtkUnstructuredGrid *)ret0)->GetFaceLocations());
+      ret1->FaceLocations->Register(ret1);
+      ret1->FaceLocations->Delete();
+    }//end bug VTK polyhedron part
+    appendFieldValueOnAlreadyFetchedData(ret1,fieldId);
+    applyBufferingPolicy();
+    return ret1;
+  }
   if(clsName=="vtkRectilinearGrid")
-    {
-      vtkRectilinearGrid *ret1=vtkRectilinearGrid::New();
-      ret1->DeepCopy(ret0);
-      appendFieldValueOnAlreadyFetchedData(ret1,fieldId);
-      applyBufferingPolicy();
-      return ret1;
-    }
+  {
+    vtkRectilinearGrid *ret1=vtkRectilinearGrid::New();
+    ret1->DeepCopy(ret0);
+    appendFieldValueOnAlreadyFetchedData(ret1,fieldId);
+    applyBufferingPolicy();
+    return ret1;
+  }
   return 0;
 }
 
@@ -161,20 +161,20 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::retrievesMainTinyInfo()
   int offsetTime=0;
   int offsetArrays=0;
   for(int i=0;i<sz;i++)
-    {
-      _mesh_id_per_field[i]=(*tinyL)[3+i];
-      int nbOfArrayForCurField=(*tinyL)[sz+3+i];
-      _array_ids_per_field[i].resize(nbOfArrayForCurField);
-      for(int k=0;k<nbOfArrayForCurField;k++)
-       _array_ids_per_field[i][k]=(*tinyL)[5*sz+3+offsetArrays+k];
-      _time_discr_per_field[i]=(*tinyL)[2*sz+3+i];
-      int nbOfTimeSpot=(*tinyL)[3*sz+3+i]-1;//-1 because time precision is not useful here.
-      _time_def_per_field[i].resize(nbOfTimeSpot);
-      for(int j=0;j<nbOfTimeSpot;j++)
-       _time_def_per_field[i][j]=(*tinyD)[offsetTime+1+j];
-      offsetTime+=nbOfTimeSpot+1;
-      offsetArrays+=nbOfArrayForCurField;
-    }
+  {
+    _mesh_id_per_field[i]=(*tinyL)[3+i];
+    int nbOfArrayForCurField=(*tinyL)[sz+3+i];
+    _array_ids_per_field[i].resize(nbOfArrayForCurField);
+    for(int k=0;k<nbOfArrayForCurField;k++)
+      _array_ids_per_field[i][k]=(*tinyL)[5*sz+3+offsetArrays+k];
+    _time_discr_per_field[i]=(*tinyL)[2*sz+3+i];
+    int nbOfTimeSpot=(*tinyL)[3*sz+3+i]-1;//-1 because time precision is not useful here.
+    _time_def_per_field[i].resize(nbOfTimeSpot);
+    for(int j=0;j<nbOfTimeSpot;j++)
+      _time_def_per_field[i][j]=(*tinyD)[offsetTime+1+j];
+    offsetTime+=nbOfTimeSpot+1;
+    offsetArrays+=nbOfArrayForCurField;
+  }
   delete tinyL;
   delete tinyD;
   //
@@ -184,14 +184,14 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::retrievesMainTinyInfo()
   //
   _info_per_field.resize(nbOfFields);
   for(int i=0;i<nbOfFields;i++)
-    {
-      _mfields_ptr->getTinyInfo(i,tinyL,tinyD,tinyS);
-      _info_per_field[i]._type=(*tinyL)[0];
-      _info_per_field[i]._name=(*tinyS)[0];
-      delete tinyL;
-      delete tinyD;
-      delete tinyS;
-    }
+  {
+    _mfields_ptr->getTinyInfo(i,tinyL,tinyD,tinyS);
+    _info_per_field[i]._type=(*tinyL)[0];
+    _info_per_field[i]._name=(*tinyS)[0];
+    delete tinyL;
+    delete tinyD;
+    delete tinyS;
+  }
 }
 
 void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::fetchAll()
@@ -199,13 +199,13 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::fetchAll()
   fetchMeshes();
   int nbOfArrays=_arrays.size();
   for(int i=0;i<nbOfArrays;i++)
-    {
-      SALOME_MED::DataArrayDoubleCorbaInterface_var daPtr=_mfields_ptr->getArray(i);
-      if(_arrays[i])
-       _arrays[i]->Delete();
-      _arrays[i]=ParaMEDMEM2VTK::BuildFromMEDCouplingFieldDoubleArr(daPtr);
-      daPtr->UnRegister();
-    }
+  {
+    SALOME_MED::DataArrayDoubleCorbaInterface_var daPtr=_mfields_ptr->getArray(i);
+    if(_arrays[i])
+      _arrays[i]->Delete();
+    _arrays[i]=ParaMEDMEM2VTK::BuildFromMEDCouplingFieldDoubleArr(daPtr);
+    daPtr->UnRegister();
+  }
   unregisterRemoteServantIfAllFetched();
 }
 
@@ -216,15 +216,15 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::fetchMeshes()
 {
   int nbOfMeshes=_meshes.size();
   for(int i=0;i<nbOfMeshes;i++)
-    {
-      SALOME_MED::MEDCouplingMeshCorbaInterface_var mPtr=_mfields_ptr->getMeshWithId(i);
-      if(_meshes[i])
-       _meshes[i]->Delete();
-      bool polyh=false;//bug VTK
-      _meshes[i]=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(mPtr,polyh);//bug VTK
-      _is_meshes_polyhedron[i]=polyh;//bug VTK
-      mPtr->UnRegister();
-    }
+  {
+    SALOME_MED::MEDCouplingMeshCorbaInterface_var mPtr=_mfields_ptr->getMeshWithId(i);
+    if(_meshes[i])
+      _meshes[i]->Delete();
+    bool polyh=false;//bug VTK
+    _meshes[i]=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(mPtr,polyh);//bug VTK
+    _is_meshes_polyhedron[i]=polyh;//bug VTK
+    mPtr->UnRegister();
+  }
   unregisterRemoteServantIfAllFetched();
 }
 
@@ -237,65 +237,65 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::fetchDataIfNeeded(int fieldI
   std::vector<int> arrayIds=_array_ids_per_field[fieldId];
   int meshId=_mesh_id_per_field[fieldId];
   if(!_meshes[meshId])
-    {
-      SALOME_MED::MEDCouplingMeshCorbaInterface_var mPtr=_mfields_ptr->getMeshWithId(meshId);
-      bool polyh=false;//bug VTK
-      _meshes[meshId]=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(mPtr,polyh);//bug VTK
-      _is_meshes_polyhedron[meshId]=polyh;//bug VTK
-      mPtr->UnRegister();
-    }
+  {
+    SALOME_MED::MEDCouplingMeshCorbaInterface_var mPtr=_mfields_ptr->getMeshWithId(meshId);
+    bool polyh=false;//bug VTK
+    _meshes[meshId]=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(mPtr,polyh);//bug VTK
+    _is_meshes_polyhedron[meshId]=polyh;//bug VTK
+    mPtr->UnRegister();
+  }
   for(std::vector<int>::const_iterator it=arrayIds.begin();it!=arrayIds.end();it++)
+  {
+    if(!_arrays[*it])
     {
-      if(!_arrays[*it])
-        {
-          SALOME_MED::DataArrayDoubleCorbaInterface_var daPtr=_mfields_ptr->getArray(*it);
-          _arrays[*it]=ParaMEDMEM2VTK::BuildFromMEDCouplingFieldDoubleArr(daPtr);
-          daPtr->UnRegister();
-        }
+      SALOME_MED::DataArrayDoubleCorbaInterface_var daPtr=_mfields_ptr->getArray(*it);
+      _arrays[*it]=ParaMEDMEM2VTK::BuildFromMEDCouplingFieldDoubleArr(daPtr);
+      daPtr->UnRegister();
     }
+  }
   unregisterRemoteServantIfAllFetched();
 }
 
 void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::unregisterRemoteServantIfAllFetched()
 {
   for(std::vector<vtkDataSet *>::iterator it=_meshes.begin();it!=_meshes.end();it++)
-    {
-      if((*it)==0)
-       return ;
-    }
+  {
+    if((*it)==0)
+      return ;
+  }
   for(std::vector<vtkDoubleArray *>::iterator it2=_arrays.begin();it2!=_arrays.end();it2++)
-    {
-      if((*it2)==0)
-       return ;
-    }
+  {
+    if((*it2)==0)
+      return ;
+  }
   if(!_mfields_ptr_released)
-    {
-      _mfields_ptr_released=true;
-      _mfields_ptr->UnRegister();
-    }
+  {
+    _mfields_ptr_released=true;
+    _mfields_ptr->UnRegister();
+  }
 }
 
 void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::applyBufferingPolicy()
 {
   if(_effective_pol==0)
-    {//
-      for(std::vector<vtkDataSet *>::iterator it=_meshes.begin();it!=_meshes.end();it++)
-        {
-          if(*it)
-            {
-              (*it)->Delete();
-              *it=0;
-            }
-        }
-      for(std::vector<vtkDoubleArray *>::iterator it2=_arrays.begin();it2!=_arrays.end();it2++)
-        {
-          if(*it2)
-            {
-              (*it2)->Delete();
-              *it2=0;
-            }
-        }
+  {//
+    for(std::vector<vtkDataSet *>::iterator it=_meshes.begin();it!=_meshes.end();it++)
+    {
+      if(*it)
+      {
+        (*it)->Delete();
+        *it=0;
+      }
+    }
+    for(std::vector<vtkDoubleArray *>::iterator it2=_arrays.begin();it2!=_arrays.end();it2++)
+    {
+      if(*it2)
+      {
+        (*it2)->Delete();
+        *it2=0;
+      }
     }
+  }
   //else nothing to do let the plugin bufferize
 }
 
@@ -305,15 +305,15 @@ void ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::appendFieldValueOnAlreadyFet
   vtkDoubleArray *arr=_arrays[_array_ids_per_field[fieldId].front()];
   arr->SetName(info._name.c_str());
   if(info._type==0)//ON_CELLS
-    {
-      ds->GetCellData()->AddArray(arr);
-      return ;
-    }
+  {
+    ds->GetCellData()->AddArray(arr);
+    return ;
+  }
   if(info._type==1)//ON_NODES
-    {
-      ds->GetPointData()->AddArray(arr);
-      return ;
-    }
+  {
+    ds->GetPointData()->AddArray(arr);
+    return ;
+  }
 }
 
 int ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::getPosGivenTimeLabel(double t)
@@ -324,7 +324,7 @@ int ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher::getPosGivenTimeLabel(double t
       return i;
   //2nd chance
   std::vector<double>::iterator it=std::find_if(_time_label_per_field.begin(),_time_label_per_field.end(),
-                                                std::bind2nd(std::greater<double>(),t));
+      std::bind2nd(std::greater<double>(),t));
   if(it!=_time_label_per_field.end() && it!=_time_label_per_field.end())
     return std::distance(_time_label_per_field.begin(),it);
   //
index 51472886e1ca4befe35c2d4f13bc655656a9cf20..06b50bf44366efb2572f1e3db975b129f085c768 100644 (file)
@@ -57,12 +57,12 @@ vtkParaMEDCorbaSource::vtkParaMEDCorbaSource():mfieldsFetcher(0)
 {
   this->MyDataSet=0;
   if(!Orb)
-    {
-      CORBA::ORB_var *OrbC=new CORBA::ORB_var;
-      int argc=0;
-      *OrbC=CORBA::ORB_init(argc,0);
-      this->Orb=OrbC;
-    }
+  {
+    CORBA::ORB_var *OrbC=new CORBA::ORB_var;
+    int argc=0;
+    *OrbC=CORBA::ORB_init(argc,0);
+    this->Orb=OrbC;
+  }
   this->SetNumberOfInputPorts(0);
   this->SetNumberOfOutputPorts(1);
 }
@@ -99,11 +99,11 @@ int vtkParaMEDCorbaSource::GetBufferingPolicy()
   return BufferingPolicy;
 }
 
- //int vtkParaMEDCorbaSource::RequestUpdateExtent( vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo )
- //{
- //return this->Superclass::RequestUpdateExtent(request,inInfo,outInfo);
+//int vtkParaMEDCorbaSource::RequestUpdateExtent( vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo )
+//{
+//return this->Superclass::RequestUpdateExtent(request,inInfo,outInfo);
 
-  /*vtkParaMEDCorbaDataSet* output = vtkParaMEDCorbaDataSet::SafeDownCast( info->Get( vtkDataObject::DATA_OBJECT() ) );
+/*vtkParaMEDCorbaDataSet* output = vtkParaMEDCorbaDataSet::SafeDownCast( info->Get( vtkDataObject::DATA_OBJECT() ) );
   if ( ! output )
     {
     output = vtkParaMEDCorbaDataSet::New();
@@ -112,22 +112,22 @@ int vtkParaMEDCorbaSource::GetBufferingPolicy()
     this->GetOutputPortInformation( 0 )->Set( vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType() );
     }*/
 
- // return 1;
- //}
+// return 1;
+//}
 
 int vtkParaMEDCorbaSource::ProcessRequest(vtkInformation* request,
-                                         vtkInformationVector** inputVector,
-                                         vtkInformationVector* outputVector)
+    vtkInformationVector** inputVector,
+    vtkInformationVector* outputVector)
 {
   // generate the data
   if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA()))
-    {
+  {
     return this->RequestData(request, inputVector, outputVector);
-    }
+  }
   if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
-    {
+  {
     return this->RequestInformation(request, inputVector, outputVector);
-    }
+  }
   return this->Superclass::ProcessRequest(request, inputVector, outputVector);
 }
 
@@ -142,44 +142,44 @@ int vtkParaMEDCorbaSource::RequestInformation(vtkInformation* request, vtkInform
   vtkInformation* myInfo=outInfo->GetInformationObject(0);
   //myInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkUnstructuredGrid");
   if(!IOR.empty())
+  {
+    //myInfo->Remove(vtkDataObject::DATA_TYPE_NAME());
+    //myInfo->Remove(PORT_REQUIREMENTS_FILLED());
+    //myInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkUnstructuredGrid");
+    //myInfo->Set(PORT_REQUIREMENTS_FILLED(),1);
+    //vtkUnstructuredGrid *tony=vtkUnstructuredGrid::New();
+    //tony->SetInformation(myInfo);
+    //myInfo->Set(vtkDataObject::DATA_OBJECT(),tony);
+    //
+    CORBA::ORB_var *OrbC=(CORBA::ORB_var *)this->Orb;
+    CORBA::Object_var obj=(*OrbC)->string_to_object(&IOR[0]);
+    //
+    Engines::MPIObject_ptr objPara=Engines::MPIObject::_narrow(obj);
+    if(CORBA::is_nil(objPara))
+    {//sequential
+      this->TotalNumberOfPieces=1;
+      SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
+      if(!CORBA::is_nil(multiPtr))
+      {//Request for multiFields
+        delete mfieldsFetcher;
+        mfieldsFetcher=new ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher(BufferingPolicy,multiPtr);
+        std::vector<double> tsteps=mfieldsFetcher->getTimeStepsForPV();
+        double timeRange[2];
+        timeRange[0]=tsteps.front();
+        timeRange[1]=tsteps.back();
+        myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
+        myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
+      }
+    }
+    else
     {
-      //myInfo->Remove(vtkDataObject::DATA_TYPE_NAME());
-      //myInfo->Remove(PORT_REQUIREMENTS_FILLED());
-      //myInfo->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkUnstructuredGrid");
-      //myInfo->Set(PORT_REQUIREMENTS_FILLED(),1);
-      //vtkUnstructuredGrid *tony=vtkUnstructuredGrid::New();
-      //tony->SetInformation(myInfo);
-      //myInfo->Set(vtkDataObject::DATA_OBJECT(),tony);
-      //
-      CORBA::ORB_var *OrbC=(CORBA::ORB_var *)this->Orb;
-      CORBA::Object_var obj=(*OrbC)->string_to_object(&IOR[0]);
-      //
-      Engines::MPIObject_ptr objPara=Engines::MPIObject::_narrow(obj);
-      if(CORBA::is_nil(objPara))
-        {//sequential
-         this->TotalNumberOfPieces=1;
-         SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
-          if(!CORBA::is_nil(multiPtr))
-           {//Request for multiFields
-              delete mfieldsFetcher;
-              mfieldsFetcher=new ParaMEDMEM2VTK::MEDCouplingMultiFieldsFetcher(BufferingPolicy,multiPtr);
-              std::vector<double> tsteps=mfieldsFetcher->getTimeStepsForPV();
-              double timeRange[2];
-              timeRange[0]=tsteps.front();
-              timeRange[1]=tsteps.back();
-              myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
-              myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
-           }
-        }
-      else
-        {
-          Engines::IORTab *iorTab=objPara->tior();
-          this->TotalNumberOfPieces=iorTab->length();
-          delete iorTab;
-          CORBA::release(objPara);
-        }
-      myInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),this->TotalNumberOfPieces);
+      Engines::IORTab *iorTab=objPara->tior();
+      this->TotalNumberOfPieces=iorTab->length();
+      delete iorTab;
+      CORBA::release(objPara);
     }
+    myInfo->Set(vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES(),this->TotalNumberOfPieces);
+  }
   return 1;
 }
 
@@ -202,67 +202,67 @@ int vtkParaMEDCorbaSource::RequestData(vtkInformation* request, vtkInformationVe
   //
   Engines::MPIObject_var objPara=Engines::MPIObject::_narrow(obj);
   if(CORBA::is_nil(objPara))
-    {//sequential
-       SALOME_MED::MEDCouplingMeshCorbaInterface_var meshPtr=SALOME_MED::MEDCouplingMeshCorbaInterface::_narrow(obj);
-       if(!CORBA::is_nil(meshPtr))
-         {
-           bool dummy;//bug VTK
-           vtkDataSet *ret=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(meshPtr,dummy);//bug VTK
-           if(!ret)
-             return 0;
-           ret0->SetBlock(0,ret);
-           ret->Delete();
-           return 1;
-         }
-       SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_var fieldPtr=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
-       if(!CORBA::is_nil(fieldPtr))
-         {
-           std::vector<double> ret2;
-           vtkDataSet *ret=ParaMEDMEM2VTK::BuildFullyFilledFromMEDCouplingFieldDoubleInstance(fieldPtr,ret2);
-           if(!ret)
-             {
-               vtkErrorMacro("On single field CORBA fetching an error occurs !");
-               return 0;
-             }
-           ret0->SetBlock(0,ret);
-           ret->Delete();
-           //
-           double timeRange[2];
-           timeRange[0]=ret2[0];
-           timeRange[1]=ret2[0];
-           outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&ret2[0],1);
-           outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
-           ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),ret2[0]);
-           return 1;
-         }
-       SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
-       if(!CORBA::is_nil(multiPtr))
-         {
-           vtkDataSet *ret=mfieldsFetcher->buildDataSetOnTime(reqTS);
-           if(!ret)
-             {
-               vtkErrorMacro("On multi fields CORBA fetching an error occurs !");
-               return 0;
-             }
-           ret0->SetBlock(0,ret);
-           ret->Delete();
-           ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS);
-           return 1;
-         }
-       vtkErrorMacro("Unrecognized sequential CORBA reference !");
-       return 0;
+  {//sequential
+    SALOME_MED::MEDCouplingMeshCorbaInterface_var meshPtr=SALOME_MED::MEDCouplingMeshCorbaInterface::_narrow(obj);
+    if(!CORBA::is_nil(meshPtr))
+    {
+      bool dummy;//bug VTK
+      vtkDataSet *ret=ParaMEDMEM2VTK::BuildFromMEDCouplingMeshInstance(meshPtr,dummy);//bug VTK
+      if(!ret)
+        return 0;
+      ret0->SetBlock(0,ret);
+      ret->Delete();
+      return 1;
+    }
+    SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_var fieldPtr=SALOME_MED::MEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
+    if(!CORBA::is_nil(fieldPtr))
+    {
+      std::vector<double> ret2;
+      vtkDataSet *ret=ParaMEDMEM2VTK::BuildFullyFilledFromMEDCouplingFieldDoubleInstance(fieldPtr,ret2);
+      if(!ret)
+      {
+        vtkErrorMacro("On single field CORBA fetching an error occurs !");
+        return 0;
+      }
+      ret0->SetBlock(0,ret);
+      ret->Delete();
+      //
+      double timeRange[2];
+      timeRange[0]=ret2[0];
+      timeRange[1]=ret2[0];
+      outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&ret2[0],1);
+      outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
+      ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),ret2[0]);
+      return 1;
+    }
+    SALOME_MED::MEDCouplingMultiFieldsCorbaInterface_var multiPtr=SALOME_MED::MEDCouplingMultiFieldsCorbaInterface::_narrow(obj);
+    if(!CORBA::is_nil(multiPtr))
+    {
+      vtkDataSet *ret=mfieldsFetcher->buildDataSetOnTime(reqTS);
+      if(!ret)
+      {
+        vtkErrorMacro("On multi fields CORBA fetching an error occurs !");
+        return 0;
+      }
+      ret0->SetBlock(0,ret);
+      ret->Delete();
+      ret0->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS);
+      return 1;
     }
+    vtkErrorMacro("Unrecognized sequential CORBA reference !");
+    return 0;
+  }
   else
+  {
+    SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface_var paraFieldCorba=SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
+    if(!CORBA::is_nil(paraFieldCorba))
     {
-      SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface_var paraFieldCorba=SALOME_MED::ParaMEDCouplingFieldDoubleCorbaInterface::_narrow(obj);
-      if(!CORBA::is_nil(paraFieldCorba))
-        {
-          ParaMEDMEM2VTK::FillMEDCouplingParaFieldDoubleInstanceFrom(paraFieldCorba,this->StartPiece,this->EndPiece,ret0);
-          return 1;
-        }
-      vtkErrorMacro("Unrecognized parallel CORBA reference !");
-      return 0;
+      ParaMEDMEM2VTK::FillMEDCouplingParaFieldDoubleInstanceFrom(paraFieldCorba,this->StartPiece,this->EndPiece,ret0);
+      return 1;
     }
+    vtkErrorMacro("Unrecognized parallel CORBA reference !");
+    return 0;
+  }
 }
 
 void vtkParaMEDCorbaSource::PrintSelf(ostream& os, vtkIndent indent)
index b9ddf7e74ba7f5d972bb15f1692061e127cde283..c01c63e9b638a759aa76ed9c4f4e8a3c628a1fc8 100644 (file)
@@ -65,10 +65,10 @@ protected:
   //not clean but to avoid to include CORBA.h in this *.h
   static void *Orb;
   //ETX
- private:
+private:
   /*void traduceMedMeshToUnstructuredDataset(vtkUnstructuredGrid *ret, int nbOfCells, int nbOfNodes, 
-                                          int nbOfTypes, const int *types, const int *nbOfEltsPerTypes, const int *nodalConnectivity,
-                                          const double *coords, int spaceDim);
+            int nbOfTypes, const int *types, const int *nbOfEltsPerTypes, const int *nodalConnectivity,
+            const double *coords, int spaceDim);
   vtkDoubleArray *buildDataArrayFromMedCoords(const double *coords, int nbOfNodes, int spaceDim);
   void reorganizeCellConnectivity(int vtkType, int nbOfNodes, const int *medConn, int *vtkConn);
   int transformMedGeomEltType2VtkType(int typeMed, int *nbOfNodesPerCell);*/
index ca5b9b9720f30145cd4d5638ea310403e325713c..0582ae730b1d937b82fcf59b637d06a882838161 100755 (executable)
 
 pqCustomChartDisplayPanelImplementation::pqCustomChartDisplayPanelImplementation(QObject* p):
 QObject(p)
-    {
-    }
+{
+}
 
 bool pqCustomChartDisplayPanelImplementation::canCreatePanel(pqRepresentation* repr) const
 {
   if(!repr || !repr->getProxy() || 
-     (repr->getProxy()->GetXMLName() != QString("XYChartRepresentation")))
-    {
-      return false;
-    }
+      (repr->getProxy()->GetXMLName() != QString("XYChartRepresentation")))
+  {
+    return false;
+  }
 
   pqDataRepresentation* dataRepr = qobject_cast<pqDataRepresentation*>(repr);
   if(dataRepr)
+  {
+    pqPipelineSource* input = dataRepr->getInput();
+    QString name = input->getProxy()->GetXMLName();
+    if (name == "TableReader")
     {
-      pqPipelineSource* input = dataRepr->getInput(); 
-      QString name = input->getProxy()->GetXMLName();
-      if (name == "TableReader")
-       {
-         return true;
-       }
+      return true;
     }
-  
+  }
+
   return false;
 }
 
 pqDisplayPanel* pqCustomChartDisplayPanelImplementation::createPanel(pqRepresentation* repr, QWidget* p)
 {
   if(!repr || !repr->getProxy() ||
-     (repr->getProxy()->GetXMLName() != QString("XYChartRepresentation")))
-    {
-      return NULL;
-    }
+      (repr->getProxy()->GetXMLName() != QString("XYChartRepresentation")))
+  {
+    return NULL;
+  }
 
   pqDataRepresentation* dataRepr = qobject_cast<pqDataRepresentation*>(repr);
   if(dataRepr)
-    {
-      pqPipelineSource* input = dataRepr->getInput(); 
-      QString name=input->getProxy()->GetXMLName();
+  {
+    pqPipelineSource* input = dataRepr->getInput();
+    QString name=input->getProxy()->GetXMLName();
 
-      if (name == "TableReader")
-       {
-         return new pqCustomXYChartDisplayPanel(repr, p);
-       }
+    if (name == "TableReader")
+    {
+      return new pqCustomXYChartDisplayPanel(repr, p);
     }
-  
+  }
+
   return NULL;
 }
 
index 789e5cf2f06bd1a9d7e16afa9ef92d1ec860e020..75a65fdb22d0129953a01bf20fc7cda613bfdfa9 100644 (file)
@@ -31,15 +31,15 @@ class pqCustomPlotSettingsModel::pqImplementation
 {
 public:
   pqImplementation()
-  {
-  }
+{
+}
 
   vtkWeakPointer<vtkSMChartRepresentationProxy> RepresentationProxy;
   QPointer<pqDataRepresentation> Representation;
 };
 
 pqCustomPlotSettingsModel::pqCustomPlotSettingsModel(QObject* parentObject) :
-  Superclass(parentObject), Implementation(new pqImplementation())
+      Superclass(parentObject), Implementation(new pqImplementation())
 {
 }
 
@@ -54,17 +54,17 @@ void pqCustomPlotSettingsModel::setRepresentation(pqDataRepresentation* rep)
   Superclass::setRepresentation(rep);
 
   if (!rep || rep == this->Implementation->Representation)
-    {
+  {
     return;
-    }
+  }
 
   if (this->Implementation->Representation)
-    {
+  {
     QObject::disconnect(this->Implementation->Representation, 0, this, 0);
-    }
+  }
 
   this->Implementation->RepresentationProxy =
-    vtkSMChartRepresentationProxy::SafeDownCast(rep->getProxy());
+      vtkSMChartRepresentationProxy::SafeDownCast(rep->getProxy());
   this->Implementation->Representation = rep;
 }
 
@@ -76,26 +76,26 @@ pqDataRepresentation* pqCustomPlotSettingsModel::representation() const
 
 //-----------------------------------------------------------------------------
 bool pqCustomPlotSettingsModel::setData(const QModelIndex &idx, const QVariant &value,
-                                       int role)
+    int role)
 {
   bool result = false;
   if (idx.isValid() && idx.model() == this)
-    {
+  {
     if (idx.column() == 1 && (role == Qt::DisplayRole || role == Qt::EditRole))
-      {
+    {
       QString name = value.toString();
       if (!name.isEmpty())
-        {
+      {
         this->setSeriesLabel(idx.row(), name);
-        }
       }
+    }
     else if(idx.column() == 0 && role == Qt::CheckStateRole)
-      {
+    {
       result = true;
       int checkstate = value.toInt();
       this->setSeriesEnabled(idx.row(), checkstate == Qt::Checked);
-      }
     }
+  }
   return result;
 }
 
@@ -103,65 +103,65 @@ bool pqCustomPlotSettingsModel::setData(const QModelIndex &idx, const QVariant &
 void pqCustomPlotSettingsModel::setSeriesEnabled(int row, bool enabled)
 {
   if (row >= 0 && row < this->rowCount(QModelIndex()))
+  {
+    int minRow = row;
+    int maxRow = row;
+
+    if (enabled && !(this->IgnoreUnitsModeOn))
     {
-      int minRow = row;
-      int maxRow = row;
-      
-      if (enabled && !(this->IgnoreUnitsModeOn)) 
-       {
-         QString unit = getUnit(QString(this->getSeriesName(row)));
-
-         for (int i = 0; i < rowCount(QModelIndex()); i++)
-           {
-             if (i == row)
-               {
-                 continue;
-               }
-
-             bool rowChanged = false;
-             QString seriesName = QString(this->getSeriesName(i));
-             QString seriesUnit = getUnit(seriesName);
-
-             if ((seriesUnit != unit) && getSeriesEnabled(i))
-               {
-                 vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
-                 "SeriesVisibility").SetStatus(this->getSeriesName(i), 0);
-                 rowChanged = true;
-               }
-             
-             if (!seriesUnit.isEmpty() && this->AutoSelectModeOn &&
-                 (seriesUnit == unit) && !getSeriesEnabled(i))
-               {
-                 vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
-                 "SeriesVisibility").SetStatus(this->getSeriesName(i), 1);
-                 rowChanged = true;
-               }
-             
-             if (rowChanged)
-               {
-                 if (i < minRow)
-                   {
-                     minRow = i;
-                   }
-                 else if (i > maxRow)
-                   {
-                     maxRow = i;
-                   }
-               }
-           }
-       }
-      
-      vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
-      "SeriesVisibility").SetStatus(this->getSeriesName(row), enabled ? 1 : 0);
-      this->Implementation->RepresentationProxy->UpdateVTKObjects();
-    
-      this->setSeriesColor(row, this->getSeriesColor(row));
-      QModelIndex topLeft = this->createIndex(minRow, 0);
-      QModelIndex bottomRight = this->createIndex(maxRow, 0);
-      emit this->dataChanged(topLeft, bottomRight);
-      emit this->redrawChart();
-      this->updateCheckState(0, Qt::Horizontal);
+      QString unit = getUnit(QString(this->getSeriesName(row)));
+
+      for (int i = 0; i < rowCount(QModelIndex()); i++)
+      {
+        if (i == row)
+        {
+          continue;
+        }
+
+        bool rowChanged = false;
+        QString seriesName = QString(this->getSeriesName(i));
+        QString seriesUnit = getUnit(seriesName);
+
+        if ((seriesUnit != unit) && getSeriesEnabled(i))
+        {
+          vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
+              "SeriesVisibility").SetStatus(this->getSeriesName(i), 0);
+          rowChanged = true;
+        }
+
+        if (!seriesUnit.isEmpty() && this->AutoSelectModeOn &&
+            (seriesUnit == unit) && !getSeriesEnabled(i))
+        {
+          vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
+              "SeriesVisibility").SetStatus(this->getSeriesName(i), 1);
+          rowChanged = true;
+        }
+
+        if (rowChanged)
+        {
+          if (i < minRow)
+          {
+            minRow = i;
+          }
+          else if (i > maxRow)
+          {
+            maxRow = i;
+          }
+        }
+      }
     }
+
+    vtkSMPropertyHelper(this->Implementation->RepresentationProxy,
+        "SeriesVisibility").SetStatus(this->getSeriesName(row), enabled ? 1 : 0);
+    this->Implementation->RepresentationProxy->UpdateVTKObjects();
+
+    this->setSeriesColor(row, this->getSeriesColor(row));
+    QModelIndex topLeft = this->createIndex(minRow, 0);
+    QModelIndex bottomRight = this->createIndex(maxRow, 0);
+    emit this->dataChanged(topLeft, bottomRight);
+    emit this->redrawChart();
+    this->updateCheckState(0, Qt::Horizontal);
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -170,15 +170,15 @@ void pqCustomPlotSettingsModel::SetIgnoreUnitsModeOn(bool enabled)
   this->IgnoreUnitsModeOn = enabled;
 
   if (this->IgnoreUnitsModeOn)
-    {
-      this->setCheckable(0, Qt::Horizontal, true);
-      this->setCheckState(0, Qt::Horizontal, Qt::Unchecked);
-    }
+  {
+    this->setCheckable(0, Qt::Horizontal, true);
+    this->setCheckState(0, Qt::Horizontal, Qt::Unchecked);
+  }
   else
-    {
-      this->setCheckState(0, Qt::Horizontal, Qt::Unchecked);
-      this->setCheckable(0, Qt::Horizontal, false);
-    }
+  {
+    this->setCheckState(0, Qt::Horizontal, Qt::Unchecked);
+    this->setCheckable(0, Qt::Horizontal, false);
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -186,33 +186,33 @@ void pqCustomPlotSettingsModel::SetAutoSelectModeOn(bool enabled)
 {
   this->AutoSelectModeOn = enabled;
   if (enabled && !this->IgnoreUnitsModeOn)
+  {
+    for (int i = 0; i < rowCount(QModelIndex()); i++)
     {
-      for (int i = 0; i < rowCount(QModelIndex()); i++)
-       {
-         if (getSeriesEnabled(i))
-           {
-             setSeriesEnabled(i, true);
-             break;
-           }
-       }
+      if (getSeriesEnabled(i))
+      {
+        setSeriesEnabled(i, true);
+        break;
+      }
     }
+  }
 }
 
 //-----------------------------------------------------------------------------
 QString pqCustomPlotSettingsModel::getUnit(const QString& seriesName)
 {
   QString unit("");
-  
+
   int index1 = seriesName.lastIndexOf("]");
   if (index1 == seriesName.size() - 1)
+  {
+    int index2 = seriesName.lastIndexOf(" [");
+    if (index2 > 0)
     {
-      int index2 = seriesName.lastIndexOf(" [");
-      if (index2 > 0)
-       {
-         int start = index2 + 2;
-         unit = seriesName.mid(index2 + 2, index1 - start);
-       }
+      int start = index2 + 2;
+      unit = seriesName.mid(index2 + 2, index1 - start);
     }
+  }
 
   return unit;
 }
index a2fb94b9e652af52985ee14fa7bcd4ecc911b867..c4ed2cb1d2d0bb7deb52a8013aa12e5b45bb59b2 100644 (file)
@@ -58,20 +58,20 @@ class pqCustomXYChartDisplayPanel::pqInternal : public Ui::CustomXYChartDisplayP
 {
 public:
   pqInternal()
-    {
+{
     this->SettingsModel = 0;
     this->XAxisArrayDomain = 0;
     this->XAxisArrayAdaptor = 0;
 
     this->VTKConnect = vtkSmartPointer<vtkEventQtSlotConnect>::New();
-    }
+}
 
   ~pqInternal()
-    {
+  {
     delete this->SettingsModel;
     delete this->XAxisArrayDomain;
     delete this->XAxisArrayAdaptor;
-    }
+  }
 
   vtkWeakPointer<vtkSMChartRepresentationProxy> ChartRepresentation;
   pqCustomPlotSettingsModel* SettingsModel;
@@ -86,7 +86,7 @@ public:
 
 //-----------------------------------------------------------------------------
 pqCustomXYChartDisplayPanel::pqCustomXYChartDisplayPanel(
-  pqRepresentation* display,QWidget* p)
+    pqRepresentation* display,QWidget* p)
 : pqDisplayPanel(display, p)
 {
   this->Internal = new pqCustomXYChartDisplayPanel::pqInternal();
@@ -96,64 +96,64 @@ pqCustomXYChartDisplayPanel::pqCustomXYChartDisplayPanel(
   this->Internal->SeriesList->setModel(this->Internal->SettingsModel);
 
   this->Internal->XAxisArrayAdaptor = new pqSignalAdaptorComboBox(
-    this->Internal->XAxisArray);
+      this->Internal->XAxisArray);
 
   QObject::connect(
-    this->Internal->SeriesList, SIGNAL(activated(const QModelIndex &)),
-    this, SLOT(activateItem(const QModelIndex &)));
+      this->Internal->SeriesList, SIGNAL(activated(const QModelIndex &)),
+      this, SLOT(activateItem(const QModelIndex &)));
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   QObject::connect(model,
-    SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
-    this, SLOT(updateOptionsWidgets()));
+      SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+      this, SLOT(updateOptionsWidgets()));
   QObject::connect(model,
-    SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
-    this, SLOT(updateOptionsWidgets()));
+      SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+      this, SLOT(updateOptionsWidgets()));
   QObject::connect(this->Internal->SettingsModel, SIGNAL(modelReset()),
-    this, SLOT(updateOptionsWidgets()));
+      this, SLOT(updateOptionsWidgets()));
   QObject::connect(this->Internal->SettingsModel, SIGNAL(redrawChart()),
-    this, SLOT(updateAllViews()));
+      this, SLOT(updateAllViews()));
   QObject::connect(this->Internal->XAxisArray, SIGNAL(currentIndexChanged(int)),
-    this, SLOT(updateAllViews()));
+      this, SLOT(updateAllViews()));
 
   QObject::connect(this->Internal->UseArrayIndex, SIGNAL(toggled(bool)),
-    this, SLOT(useArrayIndexToggled(bool)));
+      this, SLOT(useArrayIndexToggled(bool)));
   QObject::connect(this->Internal->UseDataArray, SIGNAL(toggled(bool)),
-    this, SLOT(useDataArrayToggled(bool)));
+      this, SLOT(useDataArrayToggled(bool)));
 
   QObject::connect(
-    this->Internal->ColorButton, SIGNAL(chosenColorChanged(const QColor &)),
-    this, SLOT(setCurrentSeriesColor(const QColor &)));
+      this->Internal->ColorButton, SIGNAL(chosenColorChanged(const QColor &)),
+      this, SLOT(setCurrentSeriesColor(const QColor &)));
   QObject::connect(this->Internal->Thickness, SIGNAL(valueChanged(int)),
-    this, SLOT(setCurrentSeriesThickness(int)));
+      this, SLOT(setCurrentSeriesThickness(int)));
   QObject::connect(this->Internal->StyleList, SIGNAL(currentIndexChanged(int)),
-    this, SLOT(setCurrentSeriesStyle(int)));
+      this, SLOT(setCurrentSeriesStyle(int)));
   QObject::connect(this->Internal->AxisList, SIGNAL(currentIndexChanged(int)),
-    this, SLOT(setCurrentSeriesAxes(int)));
+      this, SLOT(setCurrentSeriesAxes(int)));
   QObject::connect(this->Internal->MarkerStyleList, SIGNAL(currentIndexChanged(int)),
-    this, SLOT(setCurrentSeriesMarkerStyle(int)));
+      this, SLOT(setCurrentSeriesMarkerStyle(int)));
 
   QObject::connect(
-    this->Internal->AutoSelect, SIGNAL(toggled(bool)),
-    this, SLOT(autoSelectToggled(bool)));
+      this->Internal->AutoSelect, SIGNAL(toggled(bool)),
+      this, SLOT(autoSelectToggled(bool)));
 
   QObject::connect(
-    this->Internal->IgnoreUnits, SIGNAL(toggled(bool)),
-    this, SLOT(ignoreUnitsToggled(bool)));
+      this->Internal->IgnoreUnits, SIGNAL(toggled(bool)),
+      this, SLOT(ignoreUnitsToggled(bool)));
 
   QObject::connect(
-    this->Internal->GenerateAxesTitles, SIGNAL(toggled(bool)),
-    this, SLOT(updateViewOptions()));
+      this->Internal->GenerateAxesTitles, SIGNAL(toggled(bool)),
+      this, SLOT(updateViewOptions()));
   QObject::connect(this->Internal->SettingsModel, SIGNAL(redrawChart()),
-    this, SLOT(updateViewOptions()));
+      this, SLOT(updateViewOptions()));
 
   resetUnitsControls();
 
   this->setDisplay(display);
 
   QObject::connect(&this->Internal->Links, SIGNAL(qtWidgetChanged()),
-                   this, SLOT(reloadSeries()), Qt::QueuedConnection);
+      this, SLOT(reloadSeries()), Qt::QueuedConnection);
   QObject::connect(&this->Internal->Links, SIGNAL(qtWidgetChanged()),
-                   this->Internal->SettingsModel, SLOT(reload()));
+      this->Internal->SettingsModel, SLOT(reload()));
 }
 
 //-----------------------------------------------------------------------------
@@ -166,7 +166,7 @@ pqCustomXYChartDisplayPanel::~pqCustomXYChartDisplayPanel()
 void pqCustomXYChartDisplayPanel::reloadSeries()
 {
   updateViewOptions();
-  
+
   this->updateAllViews();
   this->updateOptionsWidgets();
 }
@@ -177,14 +177,14 @@ void pqCustomXYChartDisplayPanel::setDisplay(pqRepresentation* disp)
   this->setEnabled(false);
 
   vtkSMChartRepresentationProxy* proxy =
-    vtkSMChartRepresentationProxy::SafeDownCast(disp->getProxy());
+      vtkSMChartRepresentationProxy::SafeDownCast(disp->getProxy());
   this->Internal->ChartRepresentation = proxy;
   if (!this->Internal->ChartRepresentation)
-    {
+  {
     qWarning() << "pqCustomXYChartDisplayPanel given a representation proxy "
-                  "that is not an XYChartRepresentation. Cannot edit.";
+        "that is not an XYChartRepresentation. Cannot edit.";
     return;
-    }
+  }
 
   // this is essential to ensure that when you undo-redo, the representation is
   // indeed update-to-date, thus ensuring correct domains etc.
@@ -204,13 +204,13 @@ void pqCustomXYChartDisplayPanel::setDisplay(pqRepresentation* disp)
 
   // Link to set whether the index is used for the x axis
   this->Internal->Links.addPropertyLink(
-    this->Internal->UseArrayIndex, "checked",
-    SIGNAL(toggled(bool)),
-    proxy, proxy->GetProperty("UseIndexForXAxis"));
+      this->Internal->UseArrayIndex, "checked",
+      SIGNAL(toggled(bool)),
+      proxy, proxy->GetProperty("UseIndexForXAxis"));
 
   // Proxy changed
   this->Internal->VTKConnect->Connect(proxy->GetProperty("SeriesNamesInfo"),
-       vtkCommand::PropertyModifiedEvent, this, SLOT(resetUnitsControls()));
+      vtkCommand::PropertyModifiedEvent, this, SLOT(resetUnitsControls()));
 
   this->changeDialog(disp);
 
@@ -223,13 +223,13 @@ void pqCustomXYChartDisplayPanel::setDisplay(pqRepresentation* disp)
 void pqCustomXYChartDisplayPanel::changeDialog(pqRepresentation* disp)
 {
   vtkSMChartRepresentationProxy* proxy =
-    vtkSMChartRepresentationProxy::SafeDownCast(disp->getProxy());
+      vtkSMChartRepresentationProxy::SafeDownCast(disp->getProxy());
   bool visible = true;
   if (QString("Bar") == vtkSMPropertyHelper(proxy,"ChartType").GetAsString())
-    {
-      visible = false;
-    }
-  
+  {
+    visible = false;
+  }
+
   this->Internal->Thickness->setVisible(visible);
   this->Internal->ThicknessLabel->setVisible(visible);
   this->Internal->StyleList->setVisible(visible);
@@ -245,10 +245,10 @@ void pqCustomXYChartDisplayPanel::activateItem(const QModelIndex &index)
 {
   if(!this->Internal->ChartRepresentation
       || !index.isValid() || index.column() != 1)
-    {
+  {
     // We are interested in clicks on the color swab alone.
     return;
-    }
+  }
 
   // Get current color
   QColor color = this->Internal->SettingsModel->getSeriesColor(index.row());
@@ -256,14 +256,14 @@ void pqCustomXYChartDisplayPanel::activateItem(const QModelIndex &index)
   // Show color selector dialog to get a new color
   color = QColorDialog::getColor(color, this);
   if (color.isValid())
-    {
+  {
     // Set the new color
     this->Internal->SettingsModel->setSeriesColor(index.row(), color);
     this->Internal->ColorButton->blockSignals(true);
     this->Internal->ColorButton->setChosenColor(color);
     this->Internal->ColorButton->blockSignals(false);
     this->updateAllViews();
-    }
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -271,15 +271,15 @@ void pqCustomXYChartDisplayPanel::updateOptionsWidgets()
 {
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   if(model)
-    {
+  {
     // Show the options for the current item.
     QModelIndex current = model->currentIndex();
     QModelIndexList indexes = model->selectedIndexes();
     if((!current.isValid() || !model->isSelected(current)) &&
         indexes.size() > 0)
-      {
+    {
       current = indexes.last();
-      }
+    }
 
     this->Internal->ColorButton->blockSignals(true);
     this->Internal->Thickness->blockSignals(true);
@@ -287,27 +287,27 @@ void pqCustomXYChartDisplayPanel::updateOptionsWidgets()
     this->Internal->MarkerStyleList->blockSignals(true);
     this->Internal->AxisList->blockSignals(true);
     if (current.isValid())
-      {
+    {
       int seriesIndex = current.row();
       QColor color = this->Internal->SettingsModel->getSeriesColor(seriesIndex);
       this->Internal->ColorButton->setChosenColor(color);
       this->Internal->Thickness->setValue(
-        this->Internal->SettingsModel->getSeriesThickness(seriesIndex));
+          this->Internal->SettingsModel->getSeriesThickness(seriesIndex));
       this->Internal->StyleList->setCurrentIndex(
-        this->Internal->SettingsModel->getSeriesStyle(seriesIndex));
+          this->Internal->SettingsModel->getSeriesStyle(seriesIndex));
       this->Internal->MarkerStyleList->setCurrentIndex(
-        this->Internal->SettingsModel->getSeriesMarkerStyle(seriesIndex));
+          this->Internal->SettingsModel->getSeriesMarkerStyle(seriesIndex));
       this->Internal->AxisList->setCurrentIndex(
-        this->Internal->SettingsModel->getSeriesAxisCorner(seriesIndex));
-      }
+          this->Internal->SettingsModel->getSeriesAxisCorner(seriesIndex));
+    }
     else
-      {
+    {
       this->Internal->ColorButton->setChosenColor(Qt::white);
       this->Internal->Thickness->setValue(1);
       this->Internal->StyleList->setCurrentIndex(0);
       this->Internal->MarkerStyleList->setCurrentIndex(0);
       this->Internal->AxisList->setCurrentIndex(0);
-      }
+    }
 
     this->Internal->ColorButton->blockSignals(false);
     this->Internal->Thickness->blockSignals(false);
@@ -322,7 +322,7 @@ void pqCustomXYChartDisplayPanel::updateOptionsWidgets()
     this->Internal->StyleList->setEnabled(hasItems);
     this->Internal->MarkerStyleList->setEnabled(hasItems);
     this->Internal->AxisList->setEnabled(hasItems);
-    }
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -330,16 +330,16 @@ void pqCustomXYChartDisplayPanel::setCurrentSeriesColor(const QColor &color)
 {
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   if(model)
-    {
+  {
     this->Internal->InChange = true;
     QModelIndexList indexes = model->selectedIndexes();
     QModelIndexList::Iterator iter = indexes.begin();
     for( ; iter != indexes.end(); ++iter)
-      {
+    {
       this->Internal->SettingsModel->setSeriesColor(iter->row(), color);
-      }
-    this->Internal->InChange = false;
     }
+    this->Internal->InChange = false;
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -347,16 +347,16 @@ void pqCustomXYChartDisplayPanel::setCurrentSeriesThickness(int thickness)
 {
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   if (model)
-    {
+  {
     this->Internal->InChange = true;
     QModelIndexList indexes = model->selectedIndexes();
     QModelIndexList::Iterator iter = indexes.begin();
     for( ; iter != indexes.end(); ++iter)
-      {
+    {
       this->Internal->SettingsModel->setSeriesThickness(iter->row(), thickness);
-      }
-    this->Internal->InChange = false;
     }
+    this->Internal->InChange = false;
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -364,16 +364,16 @@ void pqCustomXYChartDisplayPanel::setCurrentSeriesStyle(int style)
 {
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   if (model)
-    {
+  {
     this->Internal->InChange = true;
     QModelIndexList indexes = model->selectedIndexes();
     QModelIndexList::Iterator iter = indexes.begin();
     for( ; iter != indexes.end(); ++iter)
-      {
+    {
       this->Internal->SettingsModel->setSeriesStyle(iter->row(), style);
-      }
-    this->Internal->InChange = false;
     }
+    this->Internal->InChange = false;
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -381,16 +381,16 @@ void pqCustomXYChartDisplayPanel::setCurrentSeriesMarkerStyle(int style)
 {
   QItemSelectionModel *model = this->Internal->SeriesList->selectionModel();
   if (model)
-    {
+  {
     this->Internal->InChange = true;
     QModelIndexList indexes = model->selectedIndexes();
     QModelIndexList::Iterator iter = indexes.begin();
     for( ; iter != indexes.end(); ++iter)
-      {
+    {
       this->Internal->SettingsModel->setSeriesMarkerStyle(iter->row(), style);
-      }
-    this->Internal->InChange = false;
     }
+    this->Internal->InChange = false;
+  }
 }
 
 //-----------------------------------------------------------------------------
@@ -432,7 +432,7 @@ void pqCustomXYChartDisplayPanel::ignoreUnitsToggled(bool checked)
   this->Internal->AutoSelect->setEnabled(!checked);
   this->Internal->SettingsModel->SetIgnoreUnitsModeOn(checked);
   this->Internal->SettingsModel->SetAutoSelectModeOn(!checked && 
-                                                    this->Internal->AutoSelect->isChecked());
+      this->Internal->AutoSelect->isChecked());
 }
 
 //-----------------------------------------------------------------------------
@@ -447,65 +447,64 @@ void pqCustomXYChartDisplayPanel::updateViewOptions()
 {
   pqRepresentation* disp = this->getRepresentation();
   if (!disp || !this->Internal->ChartRepresentation)
+  {
+    return;
+  }
+
+  pqXYChartView* view = qobject_cast<pqXYChartView*>(disp->getView());
+  if (view && view->getProxy())
+  {
+    vtkSMProxy* proxy = view->getProxy();
+
+    QList<QVariant> values =
+        pqSMAdaptor::getMultipleElementProperty(proxy->GetProperty("AxisTitle"));
+    if (values.size() < 2)
     {
       return;
     }
 
-  pqXYChartView* view = qobject_cast<pqXYChartView*>(disp->getView());
-  if (view && view->getProxy())
+    if (!this->Internal->GenerateAxesTitles->isChecked())
     {
-      vtkSMProxy* proxy = view->getProxy();
-      
-      QList<QVariant> values = 
-       pqSMAdaptor::getMultipleElementProperty(proxy->GetProperty("AxisTitle"));
-      if (values.size() < 2)
-       {
-         return;
-       }
-      
-      if (!this->Internal->GenerateAxesTitles->isChecked())
-       {
-         values.insert(0, QVariant(""));
-         values.insert(1, QVariant(""));
-       }
-      else
-       {
-         // Set X axis title
-         int useIndexForXAxis = vtkSMPropertyHelper(
-              this->Internal->ChartRepresentation, "UseIndexForXAxis").GetAsInt();
-         
-         QString xTitle("");
-         if (!useIndexForXAxis) 
-           {
-             xTitle = vtkSMPropertyHelper(this->Internal->ChartRepresentation, "XArrayName")
-               .GetAsString();
-           }
-      
-         // Set Y axis title
-         int nbRows = this->Internal->SettingsModel->rowCount(QModelIndex());
-         int nbEnabled = 0;
-         int row = 0;
-         for (int i = 0; i < nbRows && nbEnabled < 2; i++)
-           {
-             if (this->Internal->SettingsModel->getSeriesEnabled(i))
-               {
-                 nbEnabled++;
-                 row = i;
-               }
-           }
-         
-         QString yTitle("");
-         if (nbEnabled == 1)
-           {
-             yTitle = this->Internal->SettingsModel->getSeriesName(row);
-           }
-         values.insert(0, QVariant(yTitle));
-         values.insert(1, QVariant(xTitle));
-       }
-
-      pqSMAdaptor::setMultipleElementProperty(proxy->GetProperty("AxisTitle"), values);
-
-      view->getProxy()->UpdateVTKObjects();
-      view->render();
+      values.insert(0, QVariant(""));
+      values.insert(1, QVariant(""));
+    }
+    else
+    {
+      // Set X axis title
+      int useIndexForXAxis = vtkSMPropertyHelper(
+          this->Internal->ChartRepresentation, "UseIndexForXAxis").GetAsInt();
+
+      QString xTitle("");
+      if (!useIndexForXAxis)
+      {
+        xTitle = vtkSMPropertyHelper(this->Internal->ChartRepresentation, "XArrayName").GetAsString();
+      }
+
+      // Set Y axis title
+      int nbRows = this->Internal->SettingsModel->rowCount(QModelIndex());
+      int nbEnabled = 0;
+      int row = 0;
+      for (int i = 0; i < nbRows && nbEnabled < 2; i++)
+      {
+        if (this->Internal->SettingsModel->getSeriesEnabled(i))
+        {
+          nbEnabled++;
+          row = i;
+        }
+      }
+
+      QString yTitle("");
+      if (nbEnabled == 1)
+      {
+        yTitle = this->Internal->SettingsModel->getSeriesName(row);
+      }
+      values.insert(0, QVariant(yTitle));
+      values.insert(1, QVariant(xTitle));
     }
+
+    pqSMAdaptor::setMultipleElementProperty(proxy->GetProperty("AxisTitle"), values);
+
+    view->getProxy()->UpdateVTKObjects();
+    view->render();
+  }
 }
index f5594f3c8c4350d9683a369a5ecfb2645cb87077..ef676539a794da0c9ba95b5e210a0a563588a5d4 100644 (file)
@@ -33,8 +33,8 @@ class pqTableReaderPanel::pqUI: public QObject, public Ui::TableReaderPanel
 {
 public:
   pqUI(pqTableReaderPanel* p) : QObject(p)
-  {
-  }
+{
+}
 
   ~pqUI()
   {
@@ -45,18 +45,18 @@ public:
 
 
 pqTableReaderPanel::pqTableReaderPanel(pqProxy* proxy, QWidget* p) :
-  Superclass(proxy, p)
+      Superclass(proxy, p)
 {
   this->UI = new pqUI(this);
   this->UI->setupUi(this);
-  
+
   this->linkServerManagerProperties();
   this->updateAvailableTables(false);
 
   this->connect(this->UI->ValueDelimiter, SIGNAL(textChanged(const QString&)),
-               this, SLOT(onDelimiterChanged(const QString&)));
+      this, SLOT(onDelimiterChanged(const QString&)));
   this->connect(this->UI->TableNames, SIGNAL(currentIndexChanged(int)),
-               this, SLOT(onCurrentTableChanged(int)));
+      this, SLOT(onCurrentTableChanged(int)));
 }
 
 pqTableReaderPanel::~pqTableReaderPanel()
@@ -76,8 +76,8 @@ void pqTableReaderPanel::onDelimiterChanged(const QString& value)
 void pqTableReaderPanel::linkServerManagerProperties()
 {
   this->UI->Links.addPropertyLink(this->UI->TableNames, "currentIndex",
-         SIGNAL(currentIndexChanged(int)), this->proxy(), 
-         this->proxy()->GetProperty("TableNumber"));
+      SIGNAL(currentIndexChanged(int)), this->proxy(),
+      this->proxy()->GetProperty("TableNumber"));
 
   // To hook up the rest widgets
   this->Superclass::linkServerManagerProperties();
@@ -86,27 +86,27 @@ void pqTableReaderPanel::linkServerManagerProperties()
 void pqTableReaderPanel::updateAvailableTables(const bool keepCurrent)
 {
   vtkSMStringVectorProperty* prop = vtkSMStringVectorProperty::SafeDownCast(
-                                this->proxy()->GetProperty("AvailableTables"));
-  
+      this->proxy()->GetProperty("AvailableTables"));
+
   int currentIndex = this->UI->TableNames->currentIndex();
   QString currentText = this->UI->TableNames->currentText();
 
   this->UI->TableNames->clear();
-  
+
   for(int id = 0; id < prop->GetNumberOfElements(); id++) 
+  {
+    QString text(prop->GetElement(id));
+    if (text.isEmpty())
     {
-      QString text(prop->GetElement(id));
-      if (text.isEmpty()) 
-       {
-         text = QString("Table:%1").arg(id);
-       }
-      this->UI->TableNames->addItem(text);
+      text = QString("Table:%1").arg(id);
     }
+    this->UI->TableNames->addItem(text);
+  }
 
   if (keepCurrent && 
       currentIndex < this->UI->TableNames->maxCount() &&
       currentText == this->UI->TableNames->itemText(currentIndex)) 
-    {
-      this->UI->TableNames->setCurrentIndex(currentIndex);
-    }
+  {
+    this->UI->TableNames->setCurrentIndex(currentIndex);
+  }
 }
index 09db15651f14dea5b6fbb75c2ec133d5b2079151..f5a418a24305cd114c7c63562f32ac98a0cb18e1 100644 (file)
 #include <QComboBox>
 
 pqTableTo3DPanel::pqTableTo3DPanel(pqProxy* proxy, QWidget* p) :
-  Superclass(proxy, p)
+Superclass(proxy, p)
 {
   QLineEdit* scaleFactor = this->findChild<QLineEdit*>("ScaleFactor");
   QCheckBox* useOptimusScale = this->findChild<QCheckBox*>("UseOptimusScale");
   QComboBox* presentationType = this->findChild<QComboBox*>("PresentationType");
   QWidget* numberContours = this->findChild<QWidget*>("NumberOfContours");
-  
+
   if (scaleFactor && useOptimusScale)
-    {
-      this->connect(useOptimusScale, SIGNAL(toggled(bool)),
-                   this, SLOT(onScaleModeChanged(bool)));
-      onScaleModeChanged(useOptimusScale->isChecked());
-    }
+  {
+    this->connect(useOptimusScale, SIGNAL(toggled(bool)),
+        this, SLOT(onScaleModeChanged(bool)));
+    onScaleModeChanged(useOptimusScale->isChecked());
+  }
 
   if (presentationType && numberContours)
-    {
-      this->connect(presentationType, SIGNAL(currentIndexChanged(const QString &)),
-                   this, SLOT(onPrsTypeChanged(const QString &)));
-      onPrsTypeChanged(presentationType->currentText());
-    }
+  {
+    this->connect(presentationType, SIGNAL(currentIndexChanged(const QString &)),
+        this, SLOT(onPrsTypeChanged(const QString &)));
+    onPrsTypeChanged(presentationType->currentText());
+  }
 }
 
 pqTableTo3DPanel::~pqTableTo3DPanel()
@@ -54,16 +54,16 @@ void pqTableTo3DPanel::onScaleModeChanged(bool checked)
 {
   QLineEdit* scaleFactor = this->findChild<QLineEdit*>("ScaleFactor");
   if (scaleFactor)
-    {
-      scaleFactor->setEnabled(!checked);
-    }
+  {
+    scaleFactor->setEnabled(!checked);
+  }
 }
 
 void pqTableTo3DPanel::onPrsTypeChanged(const QString& type)
 {
   QWidget* numberContours = this->findChild<QWidget*>("NumberOfContours");
   if (numberContours)
-    {
-      numberContours->setEnabled(type == "Contour");
-    }
+  {
+    numberContours->setEnabled(type == "Contour");
+  }
 }
index 887b42bb679b04fe18014685218de007d6884a66..b8ae1b31666efbe4373a55cefecd38bf3998aa7d 100644 (file)
@@ -33,16 +33,16 @@ int getLine(std::ifstream& streamIn, QString& str)
 {
   char tmp;
   std::ostringstream streamOut;
-  
+
   while (streamIn.get(tmp)) {
     streamOut<<tmp;
     if (tmp == '\n') 
       break;
   }
-  
+
   streamOut<<std::ends;
   str = streamOut.str().c_str();
-  
+
   return !streamIn.eof();
 }
 
@@ -54,35 +54,35 @@ bool Table2D::Check()
 
   int iEnd = myRows[0].myValues.size();
   if (iEnd == 0)
-    {
-      return false;
-    }
+  {
+    return false;
+  }
 
   if (myColumnTitles.size() != iEnd) 
-    {
-      myColumnTitles.resize(iEnd);
-    }
+  {
+    myColumnTitles.resize(iEnd);
+  }
 
   if (myColumnUnits.size() != iEnd)
-    {
-      myColumnUnits.resize(iEnd);
-    }
+  {
+    myColumnUnits.resize(iEnd);
+  }
 
   int jEnd = myRows.size();
   for (int j = 0; j < jEnd; j++)
+  {
+    if (myRows[j].myValues.size() != iEnd)
     {
-      if (myRows[j].myValues.size() != iEnd)
-       {
-         return false;
-       }
+      return false;
     }
-  
+  }
+
   return true;
 }
 
 std::vector<std::string> GetTableNames(const char* fname, const char* separator,
-                                      const bool firstStringAsTitles)
-{
+    const bool firstStringAsTitles)
+    {
   Table2D table;
   std::vector<std::string> tableTitles;
 
@@ -92,20 +92,20 @@ std::vector<std::string> GetTableNames(const char* fname, const char* separator,
     tableTitles.push_back(table.myTitle);
     table = GetTable(fname, separator, ++nb, firstStringAsTitles);
   }
-  
+
   return tableTitles;
-}
+    }
 
 Table2D GetTable(const char* fname, const char* separator, const int tableNb,
-                const bool firstStringAsTitles)
+    const bool firstStringAsTitles)
 {
   std::ifstream streamIn(fname);
-  
+
   if(!streamIn.good())
-    {
-      throw std::runtime_error("Unable to open input Post-Pro table file.");
-    }
-  
+  {
+    throw std::runtime_error("Unable to open input Post-Pro table file.");
+  }
+
   QString tmp;
   int count = 0;
   do {
@@ -116,145 +116,145 @@ Table2D GetTable(const char* fname, const char* separator, const int tableNb,
 
     bool isFirst = true;
     while (!streamIn.eof() && tmp.trimmed() != "") 
+    {
+      QString data = tmp.trimmed();
+      QString cmt = "";
+      QString keyword = "";
+
+      // Split string to data and comment (comment starts from '#' symbol)
+      int index = tmp.indexOf("#");
+      if (index >= 0)
       {
-       QString data = tmp.trimmed();
-       QString cmt = "";
-       QString keyword = "";
-
-       // Split string to data and comment (comment starts from '#' symbol)
-       int index = tmp.indexOf("#");
-       if (index >= 0) 
-         {
-           data = tmp.left(index).trimmed();
-           cmt = tmp.mid(index+1).trimmed();
-         }
-
-       // If comment is not empty, try to get keyword from it (separated by ':' symbol)
-       if (!cmt.isEmpty()) 
-         {
-           int index1 = cmt.indexOf(":");
-
-           if (index1 >= 0) 
-             {
-               QString tmpstr = cmt.left(index1).trimmed();
-               if (tmpstr == QString("TITLE") ||
-                   tmpstr == QString("COLUMN_TITLES") ||
-                   tmpstr == QString("COLUMN_UNITS") ||
-                   tmpstr == QString("COMMENT")) 
-                 {
-                   keyword = tmpstr;
-                   cmt = cmt.mid(index1+1).trimmed();
-                 }
-             }
-         }
-       
-       // If data is empty, process only comment
-       if (data.isEmpty()) 
-         {
-           // If keyword is found, try to process it
-           // elsewise it is a simple comment, just ignore it
-           if (!keyword.isEmpty()) 
-             {
-               if (keyword == QString( "TITLE" )) 
-                 {
-                   QString title = cmt;
-                   if (table2D.myTitle != "") {
-                     title = QString(table2D.myTitle.c_str()) + QString(" ") + title;
-                   }
-                   table2D.myTitle = title.toLatin1().constData();
-                 }
-               else if (keyword == QString("COLUMN_TITLES")) 
-                 {
-                   // Comment may contain column headers
-                   QStringList strList = cmt.split("|", QString::SkipEmptyParts);
-
-                   for ( int i = 0; i < strList.count(); i++ ) 
-                     {
-                       QString tmpstr = strList[i].trimmed();
-                       table2D.myColumnTitles.push_back(tmpstr.toLatin1().constData());
-                     }
-                 }
-               else if (keyword == QString("COLUMN_UNITS")) 
-                 {
-                   // Comment may contain column units
-                   QStringList strList = cmt.split( " ", QString::SkipEmptyParts );
-           
-                   for (int i = 0; i < strList.count(); i++) 
-                     {
-                       QString tmpstr = strList[i].trimmed();
-                       table2D.myColumnUnits.push_back(tmpstr.toLatin1().constData());
-                     }
-                 }
-               else if (keyword == QString("COMMENT")) 
-                 {
-                   // Keyword 'COMMENT' processing can be here,
-                   // currently it is ignored
-                 }
-             }
-           else {
-             // Simple comment processing can be here,
-             // currently it is ignored
-           }
-         }
-       // If data is not empty, try to process it
-       else {
-         Table2D::Row row;
-       
-         QString datar1 = data.replace(QRegExp("\t"), " ");
-         QStringList valList = datar1.split(separator, QString::SkipEmptyParts);
-         if(table2D.myColumnTitles.size() == 0 && isFirst && firstStringAsTitles) 
-           {
-             for ( int i = 0; i < valList.count(); i++ ) 
-               {
-                 QString tmpstr = valList[i].trimmed();
-                 table2D.myColumnTitles.push_back(tmpstr.toLatin1().constData());
-               }
-           }
-         else 
-           {
-             if (!cmt.isEmpty()) 
-               {
-                 row.myTitle = cmt.toLatin1().constData();
-               }
-          
-             for (int i = 0; i < valList.count(); i++) 
-               {
-                 if (valList[i].trimmed() != "") 
-                   {
-                     Table2D::Value val = valList[i].trimmed().toLatin1().constData();
-                     row.myValues.push_back(val);
-                   }
-               }
-         
-             if(row.myValues.size() > 0)
-               {
-                 table2D.myRows.push_back(row);
-               }
-           }
-
-         isFirst = false;
-       }
-       getLine(streamIn, tmp);
+        data = tmp.left(index).trimmed();
+        cmt = tmp.mid(index+1).trimmed();
+      }
+
+      // If comment is not empty, try to get keyword from it (separated by ':' symbol)
+      if (!cmt.isEmpty())
+      {
+        int index1 = cmt.indexOf(":");
+
+        if (index1 >= 0)
+        {
+          QString tmpstr = cmt.left(index1).trimmed();
+          if (tmpstr == QString("TITLE") ||
+              tmpstr == QString("COLUMN_TITLES") ||
+              tmpstr == QString("COLUMN_UNITS") ||
+              tmpstr == QString("COMMENT"))
+          {
+            keyword = tmpstr;
+            cmt = cmt.mid(index1+1).trimmed();
+          }
+        }
       }
-    
-    
+
+      // If data is empty, process only comment
+      if (data.isEmpty())
+      {
+        // If keyword is found, try to process it
+        // elsewise it is a simple comment, just ignore it
+        if (!keyword.isEmpty())
+        {
+          if (keyword == QString( "TITLE" ))
+          {
+            QString title = cmt;
+            if (table2D.myTitle != "") {
+              title = QString(table2D.myTitle.c_str()) + QString(" ") + title;
+            }
+            table2D.myTitle = title.toLatin1().constData();
+          }
+          else if (keyword == QString("COLUMN_TITLES"))
+          {
+            // Comment may contain column headers
+            QStringList strList = cmt.split("|", QString::SkipEmptyParts);
+
+            for ( int i = 0; i < strList.count(); i++ )
+            {
+              QString tmpstr = strList[i].trimmed();
+              table2D.myColumnTitles.push_back(tmpstr.toLatin1().constData());
+            }
+          }
+          else if (keyword == QString("COLUMN_UNITS"))
+          {
+            // Comment may contain column units
+            QStringList strList = cmt.split( " ", QString::SkipEmptyParts );
+
+            for (int i = 0; i < strList.count(); i++)
+            {
+              QString tmpstr = strList[i].trimmed();
+              table2D.myColumnUnits.push_back(tmpstr.toLatin1().constData());
+            }
+          }
+          else if (keyword == QString("COMMENT"))
+          {
+            // Keyword 'COMMENT' processing can be here,
+            // currently it is ignored
+          }
+        }
+        else {
+          // Simple comment processing can be here,
+          // currently it is ignored
+        }
+      }
+      // If data is not empty, try to process it
+      else {
+        Table2D::Row row;
+
+        QString datar1 = data.replace(QRegExp("\t"), " ");
+        QStringList valList = datar1.split(separator, QString::SkipEmptyParts);
+        if(table2D.myColumnTitles.size() == 0 && isFirst && firstStringAsTitles)
+        {
+          for ( int i = 0; i < valList.count(); i++ )
+          {
+            QString tmpstr = valList[i].trimmed();
+            table2D.myColumnTitles.push_back(tmpstr.toLatin1().constData());
+          }
+        }
+        else
+        {
+          if (!cmt.isEmpty())
+          {
+            row.myTitle = cmt.toLatin1().constData();
+          }
+
+          for (int i = 0; i < valList.count(); i++)
+          {
+            if (valList[i].trimmed() != "")
+            {
+              Table2D::Value val = valList[i].trimmed().toLatin1().constData();
+              row.myValues.push_back(val);
+            }
+          }
+
+          if(row.myValues.size() > 0)
+          {
+            table2D.myRows.push_back(row);
+          }
+        }
+
+        isFirst = false;
+      }
+      getLine(streamIn, tmp);
+    }
+
+
     if(table2D.Check()) 
+    {
+      if (count == tableNb)
       {
-       if (count == tableNb) 
-         {
-           if (QString::fromStdString(table2D.myTitle).isEmpty()) 
-             {
-               table2D.myTitle = QString("Table:%1").arg(tableNb).toStdString();
-             }
-           return table2D;
-         }
-       count++;
+        if (QString::fromStdString(table2D.myTitle).isEmpty())
+        {
+          table2D.myTitle = QString("Table:%1").arg(tableNb).toStdString();
+        }
+        return table2D;
       }
-    
+      count++;
+    }
+
   } while (!streamIn.eof());
-  
+
   streamIn.close();
-  
+
   // Return empty table
   Table2D emptyTable;
   return emptyTable;
index a8dbe9546e319357f2eda5f0a13134e5d2fe8f40..5086fdf0eacb7756ada213c7f136f71a6aaac761 100644 (file)
@@ -46,8 +46,8 @@ struct Table2D
 };
 
 std::vector<std::string> GetTableNames(const char* fname, const char* separator,
-                                      const bool firstStringAsTitles);
+    const bool firstStringAsTitles);
 Table2D GetTable(const char* fname, const char* separator, const int tableNb,
-                const bool firstStringAsTitles);
+    const bool firstStringAsTitles);
 
 #endif //__TableParser_h_
index 4a5e8c9ffbda4e0910e4a5855d1a058b0e26cd8a..383eaaa16ee857ec17821b04991c8015ed59fc0a 100644 (file)
@@ -40,13 +40,13 @@ using namespace std;
 vtkStandardNewMacro(vtkVisuTableReader);
 
 vtkVisuTableReader::vtkVisuTableReader():
-  FileName(0)
+      FileName(0)
 {
   this->SetNumberOfInputPorts(0);
   this->SetNumberOfOutputPorts(1);
 
   this->FileName = NULL;
-  
+
   this->DetectNumericColumns = true;
   this->FirstStringAsTitles = false;
 
@@ -54,7 +54,7 @@ vtkVisuTableReader::vtkVisuTableReader():
 
   this->ValueDelimiter = 0;
   this->SetValueDelimiter(" ");
-  
+
   this->AvailableTables = vtkStringArray::New();
 }
 
@@ -74,131 +74,131 @@ void vtkVisuTableReader::PrintSelf(ostream& os, vtkIndent indent)
 {
   this->Superclass::PrintSelf(os, indent);
   os << indent << "FileName: " 
-     << (this->FileName ? this->FileName : "(none)") << endl;
+      << (this->FileName ? this->FileName : "(none)") << endl;
   os << indent << "DetectNumericColumns: "
-     << (this->DetectNumericColumns? "true" : "false") << endl;
+      << (this->DetectNumericColumns? "true" : "false") << endl;
   os << indent << "ValueDelimiter: "
-     << (this->ValueDelimiter ? this->ValueDelimiter : "(none)") << endl;
+      << (this->ValueDelimiter ? this->ValueDelimiter : "(none)") << endl;
   os << indent << "TableNumber: " << this->TableNumber<< endl;
 }
 
 int vtkVisuTableReader::RequestData(vtkInformation*, 
-                                   vtkInformationVector**, 
-                                   vtkInformationVector* outputVector)
+    vtkInformationVector**,
+    vtkInformationVector* outputVector)
 {
   vtkTable* const output_table = vtkTable::GetData(outputVector);
 
   try
+  {
+    vtkInformation* const outInfo = outputVector->GetInformationObject(0);
+    if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) &&
+        outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) > 0)
     {
-      vtkInformation* const outInfo = outputVector->GetInformationObject(0);
-      if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) &&
-        outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) > 0) 
-       {
-         return 1;
-       }
-
-      // If the filename is not defined
-      if(!this->FileName || this->TableNumber < 0) 
-       {
-         return 1;
-       }
-
-      // Read table with the given number from the file
-      Table2D table = GetTable(this->FileName, this->ValueDelimiter,
-                              this->TableNumber, this->FirstStringAsTitles);
-
-      // Set table name
-      output_table->GetInformation()->Set(vtkDataObject::FIELD_NAME(), 
-                                         table.myTitle.c_str());
-      
-      int nbRows = table.myRows.size();
-      int nbCols = table.myRows[0].myValues.size();
-
-      for (int col=0; col < nbCols; col++) 
-       {
-         vtkStringArray* newCol = vtkStringArray::New();
-         newCol->SetNumberOfValues(nbRows);
-
-         // Set value
-         for (int row=0; row < nbRows; row++) 
-           {
-             newCol->SetValue(row, table.myRows[row].myValues[col].c_str());
-           }
-           
-         // Set title
-         bool hasUnit = !table.myColumnUnits[col].empty();
-       
-         if (table.myColumnTitles[col].empty()) 
-           {
-             vtksys_ios::stringstream buffer;
-             if (hasUnit) 
-               {
-                 buffer << col <<" [" << table.myColumnUnits[col].c_str() << "]";
-               }
-             else 
-               {
-                 buffer << col;
-               }
-             newCol->SetName(buffer.str().c_str());
-           }
-       else 
-         {
-           if (hasUnit) 
-             {
-               vtksys_ios::stringstream buffer;
-               buffer << table.myColumnTitles[col].c_str() 
-                      <<" [" << table.myColumnUnits[col].c_str() << "]";
-               newCol->SetName(buffer.str().c_str());
-             }
-         else 
-           {
-             newCol->SetName(table.myColumnTitles[col].c_str());
-           }
-         }
-       
-         output_table->AddColumn(newCol);
-         newCol->Delete();
-       }
-      
-      // Detect numeric columns if needed
-      if (this->DetectNumericColumns) 
-       {
-         vtkStringToNumeric* convertor = vtkStringToNumeric::New();
-         vtkTable* clone = output_table->NewInstance();
-         clone->ShallowCopy(output_table);
-         convertor->SetInputData(clone);
-         convertor->Update();
-         clone->Delete();
-         output_table->ShallowCopy(convertor->GetOutputDataObject(0));
-         convertor->Delete();
-       }
-    } 
-  catch(vtksys_stl::exception& e) 
+      return 1;
+    }
+
+    // If the filename is not defined
+    if(!this->FileName || this->TableNumber < 0)
     {
-      vtkErrorMacro(<< "caught exception: " << e.what() << endl);
-      output_table->Initialize();
+      return 1;
     }
-  catch(...) 
+
+    // Read table with the given number from the file
+    Table2D table = GetTable(this->FileName, this->ValueDelimiter,
+        this->TableNumber, this->FirstStringAsTitles);
+
+    // Set table name
+    output_table->GetInformation()->Set(vtkDataObject::FIELD_NAME(),
+        table.myTitle.c_str());
+
+    int nbRows = table.myRows.size();
+    int nbCols = table.myRows[0].myValues.size();
+
+    for (int col=0; col < nbCols; col++)
     {
-      vtkErrorMacro(<< "caught unknown exception." << endl);
-      output_table->Initialize();
+      vtkStringArray* newCol = vtkStringArray::New();
+      newCol->SetNumberOfValues(nbRows);
+
+      // Set value
+      for (int row=0; row < nbRows; row++)
+      {
+        newCol->SetValue(row, table.myRows[row].myValues[col].c_str());
+      }
+
+      // Set title
+      bool hasUnit = !table.myColumnUnits[col].empty();
+
+      if (table.myColumnTitles[col].empty())
+      {
+        vtksys_ios::stringstream buffer;
+        if (hasUnit)
+        {
+          buffer << col <<" [" << table.myColumnUnits[col].c_str() << "]";
+        }
+        else
+        {
+          buffer << col;
+        }
+        newCol->SetName(buffer.str().c_str());
+      }
+      else
+      {
+        if (hasUnit)
+        {
+          vtksys_ios::stringstream buffer;
+          buffer << table.myColumnTitles[col].c_str()
+                 <<" [" << table.myColumnUnits[col].c_str() << "]";
+          newCol->SetName(buffer.str().c_str());
+        }
+        else
+        {
+          newCol->SetName(table.myColumnTitles[col].c_str());
+        }
+      }
+
+      output_table->AddColumn(newCol);
+      newCol->Delete();
     }
-  
+
+    // Detect numeric columns if needed
+    if (this->DetectNumericColumns)
+    {
+      vtkStringToNumeric* convertor = vtkStringToNumeric::New();
+      vtkTable* clone = output_table->NewInstance();
+      clone->ShallowCopy(output_table);
+      convertor->SetInputData(clone);
+      convertor->Update();
+      clone->Delete();
+      output_table->ShallowCopy(convertor->GetOutputDataObject(0));
+      convertor->Delete();
+    }
+  }
+  catch(vtksys_stl::exception& e)
+  {
+    vtkErrorMacro(<< "caught exception: " << e.what() << endl);
+    output_table->Initialize();
+  }
+  catch(...)
+  {
+    vtkErrorMacro(<< "caught unknown exception." << endl);
+    output_table->Initialize();
+  }
+
   return 1;
 }
 
 vtkStringArray* vtkVisuTableReader::GetAvailableTables()
 {
   this->AvailableTables->Initialize();
-  
+
   vector<string> titles = 
-    GetTableNames(this->FileName, this->ValueDelimiter,
-                 this->FirstStringAsTitles);
-  
+      GetTableNames(this->FileName, this->ValueDelimiter,
+          this->FirstStringAsTitles);
+
   for(int i = 0; i < titles.size(); i++)
-    {
-      this->AvailableTables->InsertNextValue(titles[i].c_str());
-    }
-  
+  {
+    this->AvailableTables->InsertNextValue(titles[i].c_str());
+  }
+
   return this->AvailableTables;
 }
index 77c99585d54d2c8bdf092f88817a8a5bdcd186ee..3a3e0da3ee0b8a4f4b3313a9ec3b0c2902360dd3 100644 (file)
@@ -50,152 +50,152 @@ vtkTableTo3D::~vtkTableTo3D()
 }
 
 int vtkTableTo3D::FillInputPortInformation(
-  int vtkNotUsed(port), vtkInformation* info)
+    int vtkNotUsed(port), vtkInformation* info)
 {
   info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkTable");
   return 1;
 }
 
 int vtkTableTo3D::RequestData(vtkInformation* vtkNotUsed(request),
-  vtkInformationVector** inputVector, vtkInformationVector* outputVector)
+    vtkInformationVector** inputVector, vtkInformationVector* outputVector)
 {
   vtkTable* input = vtkTable::GetData(inputVector[0], 0);
   vtkPolyData* output = vtkPolyData::GetData(outputVector, 0);
 
   if (input->GetNumberOfRows() == 0 ||input->GetNumberOfColumns() < 2)
-    {
-      return 1;
-    }
-  
+  {
+    return 1;
+  }
+
   vtkIdType xSize = input->GetNumberOfRows();
   vtkIdType ySize = input->GetNumberOfColumns() - 1; 
   vtkIdType nbPoints = xSize * ySize;
 
   vtkDataArray* xAxis = vtkDataArray::SafeDownCast(input->GetColumn(0));
   if (!xAxis)
-    {
-      vtkErrorMacro("The first column is not numeric.");
-      return 1;
-    }
-    
+  {
+    vtkErrorMacro("The first column is not numeric.");
+    return 1;
+  }
+
   double xRange = xAxis->GetTuple1(xSize - 1) - xAxis->GetTuple1(0);
   double yDelta = xRange / ySize;
-  
+
   vtkSmartPointer<vtkDoubleArray> yAxis = 
-    vtkSmartPointer<vtkDoubleArray>::New();
+      vtkSmartPointer<vtkDoubleArray>::New();
   yAxis->SetNumberOfValues(ySize);
   for (vtkIdType i = 0; i < ySize; i++ )
-    {
-      yAxis->SetValue(i, i*yDelta);
-    }
+  {
+    yAxis->SetValue(i, i*yDelta);
+  }
 
   vtkSmartPointer<vtkPoints> points = 
-    vtkSmartPointer<vtkPoints>::New();
+      vtkSmartPointer<vtkPoints>::New();
   points->SetNumberOfPoints(nbPoints);
 
   vtkSmartPointer<vtkIntArray> pointsIdMapper = 
-    vtkSmartPointer<vtkIntArray>::New();
+      vtkSmartPointer<vtkIntArray>::New();
   pointsIdMapper->SetName("POINTS_ID_MAPPER");
   pointsIdMapper->SetNumberOfComponents(2);
   pointsIdMapper->SetNumberOfTuples(nbPoints);
   int *pointsIdMapperPtr = pointsIdMapper->GetPointer(0);
 
   for (vtkIdType i = 0, pntId = 0; i < ySize; i++) 
+  {
+    for (vtkIdType j = 0; j < xSize; j++, pntId++)
     {
-      for (vtkIdType j = 0; j < xSize; j++, pntId++) 
-       {
-         points->SetPoint(pntId, xAxis->GetTuple1(j), 
-                                 yAxis->GetValue(i), 
-                                  0.0);
-
-         *pointsIdMapperPtr++ = pntId;
-         *pointsIdMapperPtr++ = 0;
-       }
+      points->SetPoint(pntId, xAxis->GetTuple1(j),
+          yAxis->GetValue(i),
+          0.0);
+
+      *pointsIdMapperPtr++ = pntId;
+      *pointsIdMapperPtr++ = 0;
     }
+  }
 
   vtkSmartPointer<vtkDoubleArray> scalars = 
-    vtkSmartPointer<vtkDoubleArray>::New();
+      vtkSmartPointer<vtkDoubleArray>::New();
   scalars->SetNumberOfComponents(1);
   scalars->SetNumberOfTuples(nbPoints);
   double *scalarsPtr = scalars->GetPointer(0);
   for (vtkIdType i = 0; i < ySize; i++) 
+  {
+    vtkDataArray* col =
+        vtkDataArray::SafeDownCast(input->GetColumn(i + 1));
+
+    if (!col)
+    {
+      vtkErrorMacro("Column "<< i <<"is not numeric.");
+      return 1;
+    }
+
+    for ( vtkIdType j = 0; j < xSize; j++ )
     {
-      vtkDataArray* col = 
-       vtkDataArray::SafeDownCast(input->GetColumn(i + 1));
-      
-      if (!col)
-       {
-         vtkErrorMacro("Column "<< i <<"is not numeric.");
-         return 1;
-       }
-      
-      for ( vtkIdType j = 0; j < xSize; j++ ) 
-       {
-         double value = col->GetTuple1(j);
-         *scalarsPtr++ = value;
-       }
+      double value = col->GetTuple1(j);
+      *scalarsPtr++ = value;
     }
+  }
 
   vtkSmartPointer<vtkStructuredGrid> structuredGrid = 
-    vtkSmartPointer<vtkStructuredGrid>::New();
+      vtkSmartPointer<vtkStructuredGrid>::New();
   structuredGrid->SetPoints(points);
 
   structuredGrid->SetDimensions(xSize, ySize, 1);
 
   // structuredGrid->GetPointData()->AddArray(pointsIdMapper);
   if (input->GetInformation()->Has(vtkDataObject::FIELD_NAME()))
-    {
-      scalars->SetName(input->GetInformation()->Get(vtkDataObject::FIELD_NAME()));
-    }
+  {
+    scalars->SetName(input->GetInformation()->Get(vtkDataObject::FIELD_NAME()));
+  }
   else
-    {
-      scalars->SetName("Table");
-    }
+  {
+    scalars->SetName("Table");
+  }
   structuredGrid->GetPointData()->SetScalars(scalars);
 
   vtkSmartPointer<vtkStructuredGridGeometryFilter> geomFilter = 
-    vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();
+      vtkSmartPointer<vtkStructuredGridGeometryFilter>::New();
   geomFilter->SetInputData(structuredGrid);
   geomFilter->Update();
-  
+
   vtkSmartPointer<vtkWarpScalar> warpScalar = 
-    vtkSmartPointer<vtkWarpScalar>::New();
-  
+      vtkSmartPointer<vtkWarpScalar>::New();
+
   double scaleFactor = this->ScaleFactor;
   if (this->UseOptimusScale)
+  {
+    double range[2];
+    geomFilter->GetOutput()->GetScalarRange(range);
+    double length = geomFilter->GetOutput()->GetLength();
+    if (range[1] > 0)
     {
-      double range[2];
-      geomFilter->GetOutput()->GetScalarRange(range);
-      double length = geomFilter->GetOutput()->GetLength();
-      if (range[1] > 0)
-       {
-         scaleFactor = length / range[1] * 0.3;
-       }
-      else
-       {
-         scaleFactor = 0;
-       }
+      scaleFactor = length / range[1] * 0.3;
     }
-
-  if (this->PresentationType == TABLETO3D_SURFACE)
+    else
     {
-      warpScalar->SetInputConnection(geomFilter->GetOutputPort(0));
-      warpScalar->SetScaleFactor(scaleFactor);
+      scaleFactor = 0;
     }
+  }
+
+  if (this->PresentationType == TABLETO3D_SURFACE)
+  {
+    warpScalar->SetInputConnection(geomFilter->GetOutputPort(0));
+    warpScalar->SetScaleFactor(scaleFactor);
+  }
   else
-    {
-      vtkSmartPointer<vtkContourFilter> contourFilter = 
-       vtkSmartPointer<vtkContourFilter>::New();
-      contourFilter->SetInputConnection(geomFilter->GetOutputPort(0));
-      contourFilter->GenerateValues(this->NumberOfContours, 
-                                   geomFilter->GetOutput()->GetScalarRange());
-      warpScalar->SetInputConnection(contourFilter->GetOutputPort(0));
-      warpScalar->SetScaleFactor(scaleFactor);
-    }
+  {
+    vtkSmartPointer<vtkContourFilter> contourFilter =
+        vtkSmartPointer<vtkContourFilter>::New();
+    contourFilter->SetInputConnection(geomFilter->GetOutputPort(0));
+    contourFilter->GenerateValues(this->NumberOfContours,
+        geomFilter->GetOutput()->GetScalarRange());
+    warpScalar->SetInputConnection(contourFilter->GetOutputPort(0));
+    warpScalar->SetScaleFactor(scaleFactor);
+  }
 
   warpScalar->Update();
   output->ShallowCopy(warpScalar->GetPolyDataOutput());
-  
+
   return 1;
 }
 
@@ -206,9 +206,9 @@ void vtkTableTo3D::PrintSelf(ostream& os, vtkIndent indent)
 
   os << indent << "ScaleFactor: " << this->ScaleFactor << endl;
   os << indent << "UseOptimusScale: "
-     << (this->UseOptimusScale? "true" : "false") << endl;
+      << (this->UseOptimusScale? "true" : "false") << endl;
   os << indent << "PresentationType: " 
-     << ((this->PresentationType == TABLETO3D_SURFACE)? "Surface" : "Contour")
-     << endl;
+      << ((this->PresentationType == TABLETO3D_SURFACE)? "Surface" : "Contour")
+      << endl;
   os << indent << "NumberOfContours: " << this->NumberOfContours << endl;
 }
index 8afdd412253535828f3de6a1f2cea13f5be34331..dca55b5578cfcc55639c5468b479bf7b4b5a6ff4 100644 (file)
@@ -47,7 +47,7 @@ public:
   // Description:
   // Specify type of presentation: surface of contour.
   vtkSetClampMacro(PresentationType, int,
-                  TABLETO3D_SURFACE, TABLETO3D_CONTOUR);
+                   TABLETO3D_SURFACE, TABLETO3D_CONTOUR);
   vtkGetMacro(PresentationType, int);
 
   // Description: