]> 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:26:46 +0000 (11:26 +0000)
committerrnv <rnv@opencascade.com>
Tue, 13 Jan 2009 11:26:46 +0000 (11:26 +0000)
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_ConvertorUtils.hxx

index be843100a107a683d883105595f28b607020a341..c3740649609dac2ad331e8a390b7f83898711bd6 100644 (file)
@@ -42,6 +42,7 @@
 #include <vtkPointData.h>
 #include <vtkCellData.h>
 #include <vtkDataSet.h>
+#include <vtkIdList.h>
 
 #include <vtkIntArray.h>
 #include <algorithm>
@@ -432,6 +433,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..b3a9ddf42dc25463c02ab564718d4c327131fbfc 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