]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Improve ELNO data selection: issue 0020111: EDF VISU 917(Bad values are displayed...
authorrnv <rnv@opencascade.com>
Tue, 13 Jan 2009 11:28:22 +0000 (11:28 +0000)
committerrnv <rnv@opencascade.com>
Tue, 13 Jan 2009 11:28:22 +0000 (11:28 +0000)
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_ConvertorUtils.hxx

index 7bab47aebd0eafcf3e13df3942428ed17d17c369..06a9fa410c3f6693c0c95c4bcafbf8d0780ef8ad 100644 (file)
@@ -41,6 +41,7 @@
 #include <vtkPointData.h>
 #include <vtkCellData.h>
 #include <vtkDataSet.h>
+#include <vtkIdList.h>
 
 #include <vtkIntArray.h>
 #include <algorithm>
@@ -431,6 +432,33 @@ namespace VISU
     return NULL;
   }
 
+  //---------------------------------------------------------------
+  TElnoPoints
+  GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID)
+  {
+    TElnoPoints aResult;
+    if(theDataSet && IsElnoData(theDataSet)) {
+      vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
+      vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER");
+      if(aDataArray){
+        if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
+          int aNbTuples = anIntArray->GetNumberOfTuples();
+          int* aPointer = anIntArray->GetPointer(0);
+          for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+            if( *aPointer == theNodeObjID ) {
+              vtkIdList *aCellIds = vtkIdList::New();
+              theDataSet->GetPointCells(aTupleId,aCellIds);
+              if(aCellIds->GetNumberOfIds() == 1){
+                aResult.push_back(TElnoPointID(aTupleId,aCellIds->GetId(0)));
+              }
+            }
+            aPointer += 2;
+          }
+        }
+      }
+    }
+    return aResult;
+  }
 
   //---------------------------------------------------------------
   TTimerLog
index 80a44887b5b50364be48fbb0a5010f2a391cb174..f06f1d8dfd800e22c80dd2da335784e5bc4ba4ea 100644 (file)
@@ -162,6 +162,17 @@ namespace VISU
   vtkDataSet*
   GetOutput(vtkInformationVector *theOutputVector);
 
+  //! Utility for ELNO Data Selection
+  //---------------------------------------------------------------
+  typedef vtkIdType TVTKPointID;
+  typedef vtkIdType TVTKCellID;
+  typedef std::pair<TVTKPointID,TVTKCellID> TElnoPointID;
+  typedef std::vector<TElnoPointID> TElnoPoints;
+  
+  VISU_CONVERTOR_EXPORT 
+  TElnoPoints
+  GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
+
   //---------------------------------------------------------------
   //! The utility class that allows to perform perfomance mesurement
   class VISU_CONVERTOR_EXPORT TTimerLog