]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To show all data in picking functionality
authorapo <apo@opencascade.com>
Tue, 15 Nov 2005 08:13:09 +0000 (08:13 +0000)
committerapo <apo@opencascade.com>
Tue, 15 Nov 2005 08:13:09 +0000 (08:13 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/PIPELINE/VISU_Extractor.cxx

index 14b6921ef7229f877f65647c0ad9ebfd5f280171..a39c626692fb81080a60f81aa6726321d2d9338b 100644 (file)
 #include <vtkTextProperty.h>
 
 #include <vtkCellData.h>
+#include <vtkPointData.h>
+
 #include <vtkDataArray.h>
+#include <vtkFloatArray.h>
 
 #include <vtkSphereSource.h>
 #include <vtkPolyDataMapper.h>
@@ -720,12 +723,9 @@ VISU_GaussPtsAct
     float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
     //
     vtkDataSet* aDataSet = GetInput();
-    vtkCellData* aCellData = aDataSet->GetCellData();
+    vtkCellData* aDataSetAttributes = aDataSet->GetCellData();
     //
-    vtkDataArray* aScalarArray = aCellData->GetScalars();
-    vtkDataArray *aVectorArray = aCellData->GetVectors();
-    // 
-    if(aScalarArray){
+    if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
       aVal = aScalarArray->GetTuple1(aVtkId);
       aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
       //
@@ -734,7 +734,7 @@ VISU_GaussPtsAct
       GetScalarBarCtrl()->Update();
       //
       float aPyramidHeight = myPickingSettings->GetPyramidHeight();
-      aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+      aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
       myCursorPyramidSelected->Init(aPyramidHeight,
                                    aRadius,
                                    aNodeCoord,
@@ -756,9 +756,20 @@ VISU_GaussPtsAct
       aStr<<"\nLocalPntID: "<<aLocalPntID;
       aStr<<"\nScalar: "<<aVal;
     }
-    if(aVectorArray) {
-      float* pVec = aVectorArray->GetTuple3(aVtkId);
-      aStr<<"\nVector: {"<<pVec[0]<<"; "<<pVec[1]<<"; "<<pVec[2]<<"}";
+
+    if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
+      if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
+       int aNbComp = aFloatArray->GetNumberOfComponents();
+       aStr<<"\nData: {";
+       int anId = 0;
+       while(anId < aNbComp){
+         float aComp = aFloatArray->GetComponent(aVtkId,anId++);
+         aStr<<aComp;
+         if(anId < aNbComp)
+           aStr<<"; ";
+       }
+       aStr<<"}";
+      }
     }
     //
     // myTextActor
index 6b182da22977a6e9fe77db9a7599890de02cfb20..63e26e038b97dec56bb789aff5cf08807efcb484 100644 (file)
@@ -62,7 +62,6 @@ execute(int theNbElems,
 {
   if(theNbElems < 1 )
     return;
-  vtkDataArray* aVectors = theInputData->GetVectors();
   vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
   if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
     int aNbComp = aFloatArray->GetNumberOfComponents();
@@ -104,6 +103,7 @@ void VISU_Extractor::Execute(){
     else
       output->GetPointData()->CopyScalarsOn();
     outData->PassData(inData);
+    outData->AddArray(inData->GetArray("VISU_FIELD"));
   }else{
     output->GetCellData()->CopyVectorsOn();
     int aNbElems = input->GetNumberOfCells();
@@ -113,5 +113,6 @@ void VISU_Extractor::Execute(){
     else
       output->GetCellData()->CopyScalarsOn();
     outData->PassData(inData);
+    outData->AddArray(inData->GetArray("VISU_FIELD"));
   }
 }